mirror of
https://github.com/urbit/shrub.git
synced 2024-12-21 01:41:37 +03:00
185b553c99
Listens to the default dill session and passes its %blits on to subscribers. Passes any %belt pokes it gets into dill. Updates webdojo to make use of it, which is the primary motivation for herm's existence.
62 lines
1.2 KiB
Plaintext
62 lines
1.2 KiB
Plaintext
:: herm: stand-in for term.c with http interface
|
|
::
|
|
/+ default-agent, dbug, verb
|
|
=, able:jael
|
|
|%
|
|
+$ state-0 [%0 ~]
|
|
--
|
|
::
|
|
=| state-0
|
|
=* state -
|
|
%+ verb |
|
|
%- agent:dbug
|
|
^- agent:gall
|
|
|_ =bowl:gall
|
|
+* this .
|
|
def ~(. (default-agent this %|) bowl)
|
|
::
|
|
++ on-init
|
|
^- (quip card:agent:gall _this)
|
|
:_ this
|
|
[%pass /herm/1 %arvo %d %view [//term/1]~]~
|
|
::
|
|
++ on-save !>([%0 ~])
|
|
++ on-load
|
|
|= old=vase
|
|
^- (quip card:agent:gall _this)
|
|
[~ this(state [%0 ~])]
|
|
::
|
|
++ on-watch
|
|
|= =path
|
|
^- (quip card:agent:gall _this)
|
|
?. ?=([%herm ~] path) !!
|
|
[~ this]
|
|
::
|
|
++ on-arvo
|
|
|= [=wire =sign-arvo]
|
|
^- (quip card:agent:gall _this)
|
|
?. =(/herm/1 wire) !!
|
|
?. ?=([%d %blit *] sign-arvo)
|
|
~| [%unexpected-sign [- +<]:sign-arvo]
|
|
!!
|
|
:: ~& [dap.bowl %blit (turn p.sign-arvo head)]
|
|
:_ this
|
|
%+ turn p.sign-arvo
|
|
|= =blit:dill
|
|
[%give %fact [/herm]~ %blit !>(blit)]
|
|
::
|
|
++ on-poke
|
|
|= [=mark =vase]
|
|
^- (quip card:agent:gall _this)
|
|
?. ?=(%belt mark)
|
|
~| [%unexpected-mark mark]
|
|
!!
|
|
:_ this
|
|
[%pass /herm/1 %arvo %d %belt !<(belt:dill vase)]~
|
|
::
|
|
++ on-leave on-leave:def
|
|
++ on-peek on-peek:def
|
|
++ on-agent on-agent:def
|
|
++ on-fail on-fail:def
|
|
--
|