2020-10-24 02:25:44 +03:00
|
|
|
:: herm: stand-in for term.c with http interface
|
|
|
|
::
|
2021-09-25 06:14:55 +03:00
|
|
|
/- herm
|
2020-10-24 02:25:44 +03:00
|
|
|
/+ default-agent, dbug, verb
|
2021-09-25 06:14:55 +03:00
|
|
|
:: keep relevant mark conversions in cache for performance
|
|
|
|
::
|
2021-07-23 14:02:24 +03:00
|
|
|
/$ blit-to-json %blit %json
|
|
|
|
/$ json-to-blit %json %blit
|
2022-01-24 14:49:40 +03:00
|
|
|
/$ json-to-task %json %herm-task
|
2021-09-25 06:14:55 +03:00
|
|
|
::
|
2020-12-08 03:47:06 +03:00
|
|
|
=, jael
|
2020-10-24 02:25:44 +03:00
|
|
|
|%
|
|
|
|
+$ state-0 [%0 ~]
|
|
|
|
--
|
|
|
|
::
|
|
|
|
=| state-0
|
|
|
|
=* state -
|
|
|
|
%+ verb |
|
|
|
|
%- agent:dbug
|
|
|
|
^- agent:gall
|
2020-11-06 17:42:15 +03:00
|
|
|
=> |%
|
2021-09-25 06:14:55 +03:00
|
|
|
++ pass-session
|
|
|
|
|= [ses=@tas tas=session-task:dill]
|
|
|
|
[%pass /dill/[ses] %arvo %d %shot ses tas]
|
2020-11-06 17:42:15 +03:00
|
|
|
--
|
2020-10-24 02:25:44 +03:00
|
|
|
|_ =bowl:gall
|
|
|
|
+* this .
|
|
|
|
def ~(. (default-agent this %|) bowl)
|
|
|
|
::
|
|
|
|
++ on-init
|
|
|
|
^- (quip card:agent:gall _this)
|
2021-09-25 06:14:55 +03:00
|
|
|
[~ this]
|
2020-10-24 02:25:44 +03:00
|
|
|
::
|
|
|
|
++ on-save !>([%0 ~])
|
|
|
|
++ on-load
|
|
|
|
|= old=vase
|
|
|
|
^- (quip card:agent:gall _this)
|
|
|
|
[~ this(state [%0 ~])]
|
|
|
|
::
|
|
|
|
++ on-watch
|
|
|
|
|= =path
|
|
|
|
^- (quip card:agent:gall _this)
|
2020-11-05 22:13:36 +03:00
|
|
|
:_ this
|
2022-01-24 14:49:40 +03:00
|
|
|
~| path
|
|
|
|
?> ?=([%session @ %view ~] path)
|
2021-09-25 06:14:55 +03:00
|
|
|
=* ses i.t.path
|
|
|
|
:~ :: subscribe to the requested session
|
|
|
|
::
|
|
|
|
::NOTE multiple views do not result in multiple subscriptions
|
|
|
|
:: because they go over the same wire/duct
|
|
|
|
::
|
|
|
|
(pass-session ses %view ~)
|
|
|
|
:: tell session to refresh, so new client knows what's on screen
|
|
|
|
::TODO should client be responsible for this?
|
|
|
|
::
|
|
|
|
(pass-session ses %hail ~)
|
2020-11-05 22:13:36 +03:00
|
|
|
==
|
2020-10-24 02:25:44 +03:00
|
|
|
::
|
|
|
|
++ on-arvo
|
|
|
|
|= [=wire =sign-arvo]
|
|
|
|
^- (quip card:agent:gall _this)
|
2021-09-25 06:14:55 +03:00
|
|
|
~| wire
|
2021-07-23 14:02:24 +03:00
|
|
|
?+ wire (on-arvo:def wire sign-arvo)
|
2021-09-28 18:37:13 +03:00
|
|
|
[%tube *] [~ this] :: we no longer care about these
|
|
|
|
::
|
2020-11-06 17:42:15 +03:00
|
|
|
:: pass on dill blits for the session
|
|
|
|
::
|
2021-09-25 06:14:55 +03:00
|
|
|
[%dill @ ~]
|
|
|
|
=* ses i.t.wire
|
2020-12-08 03:22:26 +03:00
|
|
|
?. ?=([%dill %blit *] sign-arvo)
|
2020-11-06 17:42:15 +03:00
|
|
|
~| [%unexpected-sign [- +<]:sign-arvo]
|
|
|
|
!!
|
|
|
|
:_ this
|
|
|
|
%+ turn p.sign-arvo
|
|
|
|
|= =blit:dill
|
2022-01-24 14:49:40 +03:00
|
|
|
[%give %fact [%session ses %view ~]~ %blit !>(blit)]
|
2021-06-23 16:24:42 +03:00
|
|
|
::
|
2021-09-25 06:14:55 +03:00
|
|
|
:: clean up old-style subscriptions
|
2021-06-23 16:24:42 +03:00
|
|
|
::
|
2021-09-25 06:14:55 +03:00
|
|
|
[%view @ ~]
|
|
|
|
=* ses i.t.wire
|
2021-06-23 16:24:42 +03:00
|
|
|
:_ this
|
2021-09-25 06:14:55 +03:00
|
|
|
[%pass wire %arvo %d %shot ses %flee ~]~
|
2020-11-06 17:42:15 +03:00
|
|
|
==
|
2020-10-24 02:25:44 +03:00
|
|
|
::
|
|
|
|
++ on-poke
|
|
|
|
|= [=mark =vase]
|
|
|
|
^- (quip card:agent:gall _this)
|
|
|
|
:_ this
|
2021-09-25 06:14:55 +03:00
|
|
|
:_ ~
|
|
|
|
?+ mark ~|([%unexpected-mark mark] !!)
|
|
|
|
%belt (pass-session %$ %belt !<(belt:dill vase))
|
|
|
|
%herm-task (pass-session !<(task:herm vase))
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ on-peek
|
|
|
|
|= =path
|
|
|
|
^- (unit (unit cage))
|
|
|
|
?+ path ~
|
|
|
|
[%x %sessions ~]
|
|
|
|
:+ ~ ~
|
|
|
|
:- %json
|
|
|
|
!> ^- json
|
|
|
|
=- a+(turn ~(tap in -) (lead %s))
|
|
|
|
.^((set @tas) %dy /(scot %p our.bowl)//(scot %da now.bowl)/sessions)
|
|
|
|
==
|
2020-10-24 02:25:44 +03:00
|
|
|
::
|
|
|
|
++ on-leave on-leave:def
|
2021-09-25 06:14:55 +03:00
|
|
|
::
|
2020-10-24 02:25:44 +03:00
|
|
|
++ on-agent on-agent:def
|
|
|
|
++ on-fail on-fail:def
|
|
|
|
--
|