2020-10-24 02:25:44 +03:00
|
|
|
:: herm: stand-in for term.c with http interface
|
|
|
|
::
|
2021-04-05 23:46:23 +03:00
|
|
|
/- herm
|
2020-10-24 02:25:44 +03:00
|
|
|
/+ default-agent, dbug, verb
|
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
|
|
|
=> |%
|
|
|
|
++ request-tube
|
|
|
|
|= [bowl:gall from=mark to=mark next=?]
|
|
|
|
^- card:agent:gall
|
|
|
|
:* %pass /tube/[from]/[to]
|
|
|
|
%arvo %c %warp
|
|
|
|
our q.byk ~
|
|
|
|
::
|
|
|
|
?: next
|
|
|
|
[%next %c da+now /[from]/[to]]
|
|
|
|
[%sing %c da+now /[from]/[to]]
|
|
|
|
==
|
2021-04-05 23:46:23 +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)
|
|
|
|
:_ this
|
2021-04-05 23:46:23 +03:00
|
|
|
:: ensure the tubes we use are in cache
|
2020-11-06 17:42:15 +03:00
|
|
|
::
|
2021-04-05 23:46:23 +03:00
|
|
|
:~ (request-tube bowl %blit %json |)
|
2020-11-06 17:42:15 +03:00
|
|
|
(request-tube bowl %json %belt |)
|
2021-04-05 23:46:23 +03:00
|
|
|
(request-tube bowl %json %herm-task |)
|
2020-11-06 17:42:15 +03:00
|
|
|
==
|
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)
|
2021-04-05 23:46:23 +03:00
|
|
|
:_ this
|
2020-11-10 21:32:26 +03:00
|
|
|
?> ?=([%session @ ~] path)
|
2021-04-05 23:46:23 +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-10-24 02:25:44 +03:00
|
|
|
::
|
|
|
|
++ on-arvo
|
|
|
|
|= [=wire =sign-arvo]
|
|
|
|
^- (quip card:agent:gall _this)
|
2021-04-05 23:46:23 +03:00
|
|
|
~| wire
|
2020-11-06 17:42:15 +03:00
|
|
|
?+ wire !!
|
|
|
|
:: pass on dill blits for the session
|
|
|
|
::
|
2021-04-05 23:46:23 +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
|
2021-04-05 23:46:23 +03:00
|
|
|
[%give %fact [%session ses ~]~ %blit !>(blit)]
|
2020-11-06 17:42:15 +03:00
|
|
|
::
|
|
|
|
:: ensure the tubes we need remain in cache
|
|
|
|
::
|
|
|
|
[%tube @ @ ~]
|
|
|
|
=* from i.t.wire
|
|
|
|
=* to i.t.t.wire
|
2020-12-08 03:22:26 +03:00
|
|
|
?. ?=([%clay %writ *] sign-arvo)
|
2020-11-06 17:42:15 +03:00
|
|
|
~| [%unexpected-sign [- +<]:sign-arvo]
|
|
|
|
!!
|
|
|
|
:_ this
|
|
|
|
[(request-tube bowl from to &)]~
|
|
|
|
==
|
2020-10-24 02:25:44 +03:00
|
|
|
::
|
|
|
|
++ on-poke
|
|
|
|
|= [=mark =vase]
|
|
|
|
^- (quip card:agent:gall _this)
|
|
|
|
:_ this
|
2021-04-05 23:46:23 +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-04-05 23:46:23 +03:00
|
|
|
::
|
2020-10-24 02:25:44 +03:00
|
|
|
++ on-agent on-agent:def
|
|
|
|
++ on-fail on-fail:def
|
|
|
|
--
|