2020-12-08 03:22:26 +03:00
|
|
|
!:
|
2020-12-05 10:08:47 +03:00
|
|
|
:: :: %gall, agent execution
|
2019-08-29 21:44:37 +03:00
|
|
|
!? 163
|
2020-05-22 09:05:42 +03:00
|
|
|
::
|
2019-08-29 21:44:37 +03:00
|
|
|
::::
|
2020-12-06 11:38:37 +03:00
|
|
|
|= our=ship
|
2022-05-15 18:16:18 +03:00
|
|
|
:: veb: verbosity flags
|
|
|
|
::
|
|
|
|
=/ veb-all-off
|
|
|
|
:: TODO: add more flags?
|
|
|
|
::
|
|
|
|
:* odd=`?`%.n :: unusual events
|
|
|
|
==
|
2019-11-19 07:36:21 +03:00
|
|
|
=, gall
|
2020-04-22 08:37:12 +03:00
|
|
|
=>
|
2019-08-29 21:44:37 +03:00
|
|
|
|%
|
2022-05-15 18:16:18 +03:00
|
|
|
+| %helpers
|
|
|
|
:: +trace: print if .verb is set and we're tracking .dude
|
|
|
|
::
|
|
|
|
++ trace
|
|
|
|
|= [verb=? =dude dudes=(set dude) print=tang]
|
|
|
|
^+ same
|
|
|
|
?. verb
|
|
|
|
same
|
|
|
|
?. => [dude=dude dudes=dudes in=in]
|
|
|
|
~+ |(=(~ dudes) (~(has in dudes) dude))
|
|
|
|
same
|
|
|
|
(slog print)
|
|
|
|
::
|
|
|
|
:: $bug: debug printing configuration
|
|
|
|
::
|
|
|
|
:: veb: verbosity toggles
|
|
|
|
:: dudes: app filter; if ~, print for all
|
|
|
|
::
|
|
|
|
+$ bug
|
|
|
|
$: veb=_veb-all-off
|
|
|
|
dudes=(set dude)
|
|
|
|
==
|
|
|
|
::
|
2020-05-14 14:24:44 +03:00
|
|
|
+| %main
|
|
|
|
::
|
|
|
|
:: $move: Arvo-level move
|
2020-04-22 08:37:12 +03:00
|
|
|
::
|
|
|
|
+$ move [=duct move=(wind note-arvo gift-arvo)]
|
2023-03-12 03:35:55 +03:00
|
|
|
:: $state-12: overall gall state, versioned
|
2020-04-22 08:37:12 +03:00
|
|
|
::
|
2023-03-12 03:35:55 +03:00
|
|
|
+$ state-12 [%12 state]
|
2020-05-14 14:24:44 +03:00
|
|
|
:: $state: overall gall state
|
2020-04-22 08:37:12 +03:00
|
|
|
::
|
|
|
|
:: system-duct: TODO document
|
|
|
|
:: outstanding: outstanding request queue
|
|
|
|
:: contacts: other ships we're in communication with
|
|
|
|
:: yokes: running agents
|
|
|
|
:: blocked: moves to agents that haven't been started yet
|
2022-05-15 18:16:18 +03:00
|
|
|
:: bug: debug printing configuration
|
2020-04-22 08:37:12 +03:00
|
|
|
::
|
|
|
|
+$ state
|
|
|
|
$: system-duct=duct
|
|
|
|
outstanding=(map [wire duct] (qeu remote-request))
|
|
|
|
contacts=(set ship)
|
|
|
|
yokes=(map term yoke)
|
|
|
|
blocked=(map term (qeu blocked-move))
|
2022-05-15 18:16:18 +03:00
|
|
|
=bug
|
2020-04-22 08:37:12 +03:00
|
|
|
==
|
2020-05-14 14:24:44 +03:00
|
|
|
:: $routes: new cuff; TODO: document
|
2020-04-22 08:37:12 +03:00
|
|
|
::
|
|
|
|
+$ routes
|
|
|
|
$: disclosing=(unit (set ship))
|
|
|
|
attributing=ship
|
|
|
|
==
|
2020-05-14 14:24:44 +03:00
|
|
|
:: $yoke: agent runner state
|
2020-04-22 08:37:12 +03:00
|
|
|
::
|
|
|
|
:: control-duct: TODO document
|
2022-03-05 03:11:16 +03:00
|
|
|
:: run-nonce: unique for each rebuild
|
|
|
|
:: sub-nonce: app-wide global %watch nonce
|
2020-04-22 08:37:12 +03:00
|
|
|
:: stats: TODO document
|
2022-05-18 16:27:17 +03:00
|
|
|
:: bitt: incoming subscriptions
|
|
|
|
:: boat: outgoing subscriptions
|
|
|
|
:: boar: and their nonces
|
2022-07-07 10:12:27 +03:00
|
|
|
:: code: most recently loaded code
|
2020-04-22 08:37:12 +03:00
|
|
|
:: agent: agent core
|
|
|
|
:: beak: compilation source
|
2020-04-30 09:00:57 +03:00
|
|
|
:: marks: mark conversion requests
|
2023-03-12 03:35:55 +03:00
|
|
|
:: sky: scry bindings
|
2020-04-22 08:37:12 +03:00
|
|
|
::
|
|
|
|
+$ yoke
|
2023-03-29 21:28:36 +03:00
|
|
|
$% [%nuke sky=(map spur @ud)]
|
|
|
|
$: %live
|
|
|
|
control-duct=duct
|
|
|
|
run-nonce=@t
|
|
|
|
sub-nonce=_1
|
|
|
|
=stats
|
|
|
|
=bitt
|
|
|
|
=boat
|
|
|
|
=boar
|
|
|
|
code=*
|
|
|
|
agent=(each agent vase)
|
|
|
|
=beak
|
|
|
|
marks=(map duct mark)
|
|
|
|
sky=(map spur path-state)
|
|
|
|
== ==
|
2023-03-12 03:35:55 +03:00
|
|
|
::
|
|
|
|
+$ path-state
|
|
|
|
$: bob=(unit @ud)
|
|
|
|
fan=((mop @ud (each noun @uvI)) lte)
|
2020-04-22 08:37:12 +03:00
|
|
|
==
|
2023-03-12 03:35:55 +03:00
|
|
|
::
|
|
|
|
++ on-path ((on @ud (each noun @uvI)) lte)
|
2020-05-14 14:24:44 +03:00
|
|
|
:: $blocked-move: enqueued move to an agent
|
2020-04-22 08:37:12 +03:00
|
|
|
::
|
2021-06-19 05:13:55 +03:00
|
|
|
+$ blocked-move [=duct =routes move=(each deal unto)]
|
2020-05-14 14:24:44 +03:00
|
|
|
:: $stats: statistics
|
2020-04-22 08:37:12 +03:00
|
|
|
::
|
2020-05-14 14:24:44 +03:00
|
|
|
:: change: how many moves this agent has processed
|
|
|
|
:: eny: entropy
|
|
|
|
:: time: date of current event processing
|
2020-04-22 08:37:12 +03:00
|
|
|
::
|
|
|
|
+$ stats [change=@ud eny=@uvJ time=@da]
|
2020-05-14 14:24:44 +03:00
|
|
|
:: $ames-response: network response message (%boon)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-11-20 00:03:07 +03:00
|
|
|
:: %d: fact
|
2019-10-30 23:12:57 +03:00
|
|
|
:: %x: quit
|
|
|
|
::
|
2020-04-22 08:37:12 +03:00
|
|
|
+$ ames-response
|
2019-10-30 23:12:57 +03:00
|
|
|
$% [%d =mark noun=*]
|
2019-08-29 21:44:37 +03:00
|
|
|
[%x ~]
|
|
|
|
==
|
2020-05-14 14:24:44 +03:00
|
|
|
:: $ames-request: network request (%plea)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-10-30 23:12:57 +03:00
|
|
|
:: %m: poke
|
2019-11-20 00:03:07 +03:00
|
|
|
:: %l: watch-as
|
|
|
|
:: %s: watch
|
|
|
|
:: %u: leave
|
2019-10-30 23:12:57 +03:00
|
|
|
::
|
2020-12-01 07:12:43 +03:00
|
|
|
+$ ames-request-all
|
|
|
|
$% [%0 ames-request]
|
|
|
|
==
|
2020-04-22 08:37:12 +03:00
|
|
|
+$ ames-request
|
2019-10-30 23:12:57 +03:00
|
|
|
$% [%m =mark noun=*]
|
2019-08-29 21:44:37 +03:00
|
|
|
[%l =mark =path]
|
|
|
|
[%s =path]
|
|
|
|
[%u ~]
|
|
|
|
==
|
2020-05-14 14:24:44 +03:00
|
|
|
:: $remote-request: kinds of agent actions that can cross the network
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-10-30 23:12:57 +03:00
|
|
|
:: Used in wires to identify the kind of remote request we made.
|
|
|
|
:: Bijective with the tags of $ames-request.
|
|
|
|
::
|
2020-04-22 08:37:12 +03:00
|
|
|
+$ remote-request
|
2019-11-07 09:19:32 +03:00
|
|
|
$? %watch
|
2019-11-09 04:26:47 +03:00
|
|
|
%watch-as
|
2019-08-29 21:44:37 +03:00
|
|
|
%poke
|
2019-11-07 09:19:32 +03:00
|
|
|
%leave
|
2020-02-14 04:48:33 +03:00
|
|
|
%missing
|
2019-08-29 21:44:37 +03:00
|
|
|
==
|
2020-05-14 14:24:44 +03:00
|
|
|
:: |migrate: data structures for upgrades
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2020-05-14 14:24:44 +03:00
|
|
|
+| %migrate
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2020-05-14 14:24:44 +03:00
|
|
|
:: $spore: structures for update, produced by +stay
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2020-05-14 14:24:44 +03:00
|
|
|
+$ spore
|
2023-03-12 03:35:55 +03:00
|
|
|
$: %12
|
2019-08-29 21:44:37 +03:00
|
|
|
system-duct=duct
|
gall: remove message type from wire
%leave over the network didn't work because we included the message type
in the wire from gall, so the duct for the initial %watch and the %leave
were different. We need to know the message type so we can route the
acknowledgment as %poke-ack, %watch-ack, or no-op.
This moves this piece of information to a piece of state, where we queue
up the message types per [duct wire]. Ames guarantees that
acknowledgments will come in order.
This also includes an easy state adapter. The more interesting part of
the upgrade is that we likely have outstanding subscriptions with the
old wire format. The disadvantage of storing information in wires is
that it can't be upgraded in +load. So, here we listen for updates on
the old wire format, and when we get them we kill the old subscription,
so that it will be recreated with the new wire format.
As an aside, this is a good example of what we mean when we say
subscriptions may be killed at any time, so apps must handle this case.
Finally, this fixes the "attributing" ship to ~zod for agent requests.
This information was ignored for agent requests, but including it causes
spurious duct mismatches.
2019-12-10 04:52:53 +03:00
|
|
|
outstanding=(map [wire duct] (qeu remote-request))
|
2019-10-30 23:12:57 +03:00
|
|
|
contacts=(set ship)
|
2020-05-14 14:24:44 +03:00
|
|
|
eggs=(map term egg)
|
|
|
|
blocked=(map term (qeu blocked-move))
|
2022-05-15 18:16:18 +03:00
|
|
|
=bug
|
2019-08-29 21:44:37 +03:00
|
|
|
==
|
2020-05-14 14:24:44 +03:00
|
|
|
:: $egg: migratory agent state; $yoke with .old-state instead of .agent
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2020-05-14 14:24:44 +03:00
|
|
|
+$ egg
|
2023-03-29 21:28:36 +03:00
|
|
|
$% [%nuke sky=(map spur @ud)]
|
|
|
|
$: %live
|
|
|
|
control-duct=duct
|
|
|
|
run-nonce=@t
|
|
|
|
sub-nonce=@
|
|
|
|
=stats
|
|
|
|
=bitt
|
|
|
|
=boat
|
|
|
|
=boar
|
|
|
|
code=~
|
|
|
|
old-state=[%| vase]
|
|
|
|
=beak
|
|
|
|
marks=(map duct mark)
|
|
|
|
sky=(map spur path-state)
|
|
|
|
== ==
|
2019-08-29 21:44:37 +03:00
|
|
|
--
|
2020-05-14 14:24:44 +03:00
|
|
|
:: adult gall vane interface, for type compatibility with pupa
|
|
|
|
::
|
2023-03-12 03:35:55 +03:00
|
|
|
=| state=state-12
|
2020-12-06 11:38:37 +03:00
|
|
|
|= [now=@da eny=@uvJ rof=roof]
|
2020-05-14 14:24:44 +03:00
|
|
|
=* gall-payload .
|
2020-12-05 07:32:17 +03:00
|
|
|
~% %gall-top ..part ~
|
2019-08-29 21:44:37 +03:00
|
|
|
|%
|
|
|
|
:: +mo: Arvo-level move handling
|
|
|
|
::
|
|
|
|
:: An outer core responsible for routing moves to and from Arvo; it calls
|
|
|
|
:: an inner core, +ap, to route internal moves to and from agents.
|
|
|
|
::
|
|
|
|
++ mo
|
2019-11-19 07:36:21 +03:00
|
|
|
~% %gall-mo +> ~
|
2020-04-22 08:37:12 +03:00
|
|
|
|_ [hen=duct moves=(list move)]
|
2022-05-15 18:16:18 +03:00
|
|
|
::
|
|
|
|
++ trace
|
|
|
|
|= [verb=? =dude print=tang]
|
|
|
|
^+ same
|
|
|
|
(^trace verb dude dudes.bug.state print)
|
|
|
|
::
|
2020-04-22 08:37:12 +03:00
|
|
|
:: +mo-abed: initialise state with the provided duct
|
|
|
|
:: +mo-abet: finalize, reversing moves
|
|
|
|
:: +mo-pass: prepend a standard %pass to the current list of moves
|
|
|
|
:: +mo-give: prepend a standard %give to the current list of moves
|
2021-09-25 06:14:55 +03:00
|
|
|
:: +mo-talk: build task to print config report or failure trace
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2020-04-22 08:37:12 +03:00
|
|
|
++ mo-core .
|
|
|
|
++ mo-abed |=(hun=duct mo-core(hen hun))
|
|
|
|
++ mo-abet [(flop moves) gall-payload]
|
2020-12-08 03:47:06 +03:00
|
|
|
++ mo-give |=(g=gift mo-core(moves [[hen give+g] moves]))
|
2021-09-25 06:14:55 +03:00
|
|
|
++ mo-talk
|
|
|
|
|= rup=(each suss tang)
|
|
|
|
^- [wire note-arvo]
|
|
|
|
:+ /sys/say %d
|
|
|
|
^- task:dill
|
|
|
|
?- -.rup
|
|
|
|
%& [%text "gall: {(t q)}ed %{(t p)}":[t=trip p.rup]]
|
|
|
|
%| [%talk leaf+"gall: failed" (flop p.rup)]
|
|
|
|
==
|
2022-08-16 01:37:35 +03:00
|
|
|
++ mo-pass |=(p=[wire note-arvo] mo-core(moves [[hen pass+p] moves]))
|
|
|
|
++ mo-slip |=(p=note-arvo mo-core(moves [[hen slip+p] moves]))
|
2021-06-19 05:13:55 +03:00
|
|
|
++ mo-past
|
|
|
|
|= =(list [wire note-arvo])
|
|
|
|
?~ list
|
|
|
|
mo-core
|
|
|
|
=. mo-core (mo-pass i.list)
|
|
|
|
$(list t.list)
|
2022-07-06 10:51:11 +03:00
|
|
|
:: +mo-jolt: (re)start agent
|
2021-06-19 05:13:55 +03:00
|
|
|
::
|
2021-07-20 17:59:20 +03:00
|
|
|
++ mo-jolt
|
|
|
|
|= [dap=term =ship =desk]
|
|
|
|
^+ mo-core
|
2022-07-06 10:51:11 +03:00
|
|
|
=/ =wire /sys/cor/[dap]/(scot %p ship)/[desk]
|
|
|
|
..mo-core
|
|
|
|
:: XX (mo-pass wire %c %jolt dap ship desk)
|
2022-08-10 19:09:47 +03:00
|
|
|
:: +mo-doff: kill all outgoing subscriptions
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2022-08-10 19:09:47 +03:00
|
|
|
++ mo-doff
|
2022-08-10 21:33:07 +03:00
|
|
|
|= [dude=(unit dude) ship=(unit ship)]
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ mo-core
|
2022-08-17 00:02:59 +03:00
|
|
|
=/ apps=(list (pair term yoke))
|
|
|
|
?~ dude ~(tap by yokes.state)
|
|
|
|
(drop (bind (~(get by yokes.state) u.dude) (lead u.dude)))
|
|
|
|
|- ^+ mo-core
|
|
|
|
?~ apps mo-core
|
2023-03-29 21:28:36 +03:00
|
|
|
?: ?=(%nuke -.q.i.apps) $(apps t.apps)
|
2022-08-18 20:34:42 +03:00
|
|
|
=/ ap-core (ap-yoke:ap p.i.apps [~ our] q.i.apps)
|
2022-08-17 00:02:59 +03:00
|
|
|
$(apps t.apps, mo-core ap-abet:(ap-doff:ap-core ship))
|
2022-08-18 20:34:42 +03:00
|
|
|
:: +mo-rake: send %cork's for old subscriptions if needed
|
|
|
|
::
|
|
|
|
++ mo-rake
|
|
|
|
|= [dude=(unit dude) all=?]
|
|
|
|
^+ mo-core
|
|
|
|
=/ apps=(list (pair term yoke))
|
|
|
|
?~ dude ~(tap by yokes.state)
|
|
|
|
(drop (bind (~(get by yokes.state) u.dude) (lead u.dude)))
|
|
|
|
|- ^+ mo-core
|
|
|
|
?~ apps mo-core
|
2023-03-29 21:28:36 +03:00
|
|
|
?: ?=(%nuke -.q.i.apps) $(apps t.apps)
|
2022-08-18 20:34:42 +03:00
|
|
|
=/ ap-core (ap-yoke:ap p.i.apps [~ our] q.i.apps)
|
|
|
|
$(apps t.apps, mo-core ap-abet:(ap-rake:ap-core all))
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +mo-receive-core: receives an app core built by %ford.
|
|
|
|
::
|
|
|
|
:: Presuming we receive a good core, we first check to see if the agent
|
2019-11-19 07:36:21 +03:00
|
|
|
:: is already running. If so, we update its beak in %gall's state,
|
2019-08-29 21:44:37 +03:00
|
|
|
:: initialise an +ap core for the agent, install the core we got from
|
|
|
|
:: %ford, and then resolve any moves associated with it.
|
|
|
|
::
|
|
|
|
:: If we're dealing with a new agent, we create one using the result we
|
2019-11-19 07:36:21 +03:00
|
|
|
:: got from %ford, add it to the collection of agents %gall is keeping
|
2019-08-29 21:44:37 +03:00
|
|
|
:: track of, and then do more or less the same procedure as we did for the
|
|
|
|
:: running agent case.
|
|
|
|
::
|
|
|
|
++ mo-receive-core
|
|
|
|
~/ %mo-receive-core
|
2020-05-14 14:24:44 +03:00
|
|
|
|= [dap=term bek=beak =agent]
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ mo-core
|
|
|
|
::
|
2021-07-15 09:51:03 +03:00
|
|
|
=/ yak (~(get by yokes.state) dap)
|
2022-09-07 09:52:59 +03:00
|
|
|
=/ tex=(unit tape)
|
|
|
|
?~ yak `"installing"
|
2023-03-29 21:28:36 +03:00
|
|
|
?: ?=(%nuke -.u.yak) `"unnuking" ::TODO good message here?
|
2022-09-07 09:52:59 +03:00
|
|
|
?- -.agent.u.yak
|
|
|
|
%| `"reviving"
|
|
|
|
%&
|
|
|
|
?: =(code.u.yak agent)
|
|
|
|
~
|
|
|
|
`"reloading"
|
2021-07-15 09:51:03 +03:00
|
|
|
==
|
2022-09-07 09:52:59 +03:00
|
|
|
=+ ?~ tex ~
|
|
|
|
~> %slog.[0 leaf+"gall: {u.tex} {<dap>}"] ~
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2023-03-29 21:28:36 +03:00
|
|
|
?: ?=([~ %live *] yak)
|
2022-07-07 10:12:27 +03:00
|
|
|
?: &(=(q.beak.u.yak q.bek) =(code.u.yak agent) =(-.agent.u.yak &))
|
|
|
|
mo-core
|
|
|
|
::
|
2020-04-22 08:37:12 +03:00
|
|
|
=. yokes.state
|
2022-07-07 10:12:27 +03:00
|
|
|
(~(put by yokes.state) dap u.yak(beak bek, code agent))
|
2021-07-15 09:51:03 +03:00
|
|
|
=/ ap-core (ap-abed:ap dap `our)
|
2020-04-22 08:37:12 +03:00
|
|
|
=. ap-core (ap-reinstall:ap-core agent)
|
2020-11-17 23:53:05 +03:00
|
|
|
=. mo-core ap-abet:ap-core
|
|
|
|
(mo-clear-queue dap)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2020-04-22 08:37:12 +03:00
|
|
|
=. yokes.state
|
|
|
|
%+ ~(put by yokes.state) dap
|
2023-03-29 21:28:36 +03:00
|
|
|
%* . *$>(%live yoke)
|
|
|
|
control-duct hen
|
|
|
|
beak bek
|
|
|
|
code agent
|
|
|
|
agent &+agent
|
|
|
|
run-nonce (scot %uw (end 5 (shas %yoke-nonce eny)))
|
|
|
|
sky
|
|
|
|
?~ yak ~
|
|
|
|
(~(run by sky.u.yak) (corl (late ~) (lead ~)))
|
2020-11-19 07:12:29 +03:00
|
|
|
==
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
=/ old mo-core
|
|
|
|
=/ wag
|
2021-07-15 09:51:03 +03:00
|
|
|
=/ ap-core (ap-abed:ap dap `our)
|
2020-04-22 01:50:47 +03:00
|
|
|
(ap-upgrade-state:ap-core ~)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
=/ maybe-tang -.wag
|
2020-04-22 01:50:47 +03:00
|
|
|
=/ ap-core +.wag
|
2019-08-29 21:44:37 +03:00
|
|
|
?^ maybe-tang
|
|
|
|
=. mo-core old
|
2021-09-25 06:14:55 +03:00
|
|
|
(mo-pass (mo-talk %.n u.maybe-tang))
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2020-04-22 01:50:47 +03:00
|
|
|
=. mo-core ap-abet:ap-core
|
|
|
|
=. mo-core (mo-clear-queue dap)
|
|
|
|
=/ =suss [dap %boot now]
|
2021-09-25 06:14:55 +03:00
|
|
|
(mo-pass (mo-talk %.y suss))
|
2019-11-20 00:03:07 +03:00
|
|
|
:: +mo-send-foreign-request: handle local request to .ship
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-10-30 23:12:57 +03:00
|
|
|
++ mo-send-foreign-request
|
|
|
|
~/ %mo-send-foreign-request
|
2019-11-20 00:03:07 +03:00
|
|
|
|= [=ship foreign-agent=term =deal]
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ mo-core
|
|
|
|
::
|
2019-11-04 04:35:45 +03:00
|
|
|
=. mo-core (mo-track-ship ship)
|
gall: remove message type from wire
%leave over the network didn't work because we included the message type
in the wire from gall, so the duct for the initial %watch and the %leave
were different. We need to know the message type so we can route the
acknowledgment as %poke-ack, %watch-ack, or no-op.
This moves this piece of information to a piece of state, where we queue
up the message types per [duct wire]. Ames guarantees that
acknowledgments will come in order.
This also includes an easy state adapter. The more interesting part of
the upgrade is that we likely have outstanding subscriptions with the
old wire format. The disadvantage of storing information in wires is
that it can't be upgraded in +load. So, here we listen for updates on
the old wire format, and when we get them we kill the old subscription,
so that it will be recreated with the new wire format.
As an aside, this is a good example of what we mean when we say
subscriptions may be killed at any time, so apps must handle this case.
Finally, this fixes the "attributing" ship to ~zod for agent requests.
This information was ignored for agent requests, but including it causes
spurious duct mismatches.
2019-12-10 04:52:53 +03:00
|
|
|
?< ?=(?(%raw-poke %poke-as) -.deal)
|
2020-12-01 07:12:43 +03:00
|
|
|
=/ =ames-request-all
|
|
|
|
:- %0
|
2019-11-09 04:26:47 +03:00
|
|
|
?- -.deal
|
|
|
|
%poke [%m p.cage.deal q.q.cage.deal]
|
|
|
|
%leave [%u ~]
|
2020-05-01 09:14:16 +03:00
|
|
|
%watch-as [%l [mark path]:deal]
|
2019-11-09 04:26:47 +03:00
|
|
|
%watch [%s path.deal]
|
2019-08-29 21:44:37 +03:00
|
|
|
==
|
|
|
|
::
|
2019-11-20 00:03:07 +03:00
|
|
|
=/ wire
|
gall: remove message type from wire
%leave over the network didn't work because we included the message type
in the wire from gall, so the duct for the initial %watch and the %leave
were different. We need to know the message type so we can route the
acknowledgment as %poke-ack, %watch-ack, or no-op.
This moves this piece of information to a piece of state, where we queue
up the message types per [duct wire]. Ames guarantees that
acknowledgments will come in order.
This also includes an easy state adapter. The more interesting part of
the upgrade is that we likely have outstanding subscriptions with the
old wire format. The disadvantage of storing information in wires is
that it can't be upgraded in +load. So, here we listen for updates on
the old wire format, and when we get them we kill the old subscription,
so that it will be recreated with the new wire format.
As an aside, this is a good example of what we mean when we say
subscriptions may be killed at any time, so apps must handle this case.
Finally, this fixes the "attributing" ship to ~zod for agent requests.
This information was ignored for agent requests, but including it causes
spurious duct mismatches.
2019-12-10 04:52:53 +03:00
|
|
|
/sys/way/(scot %p ship)/[foreign-agent]
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
=/ =note-arvo
|
2019-11-01 22:06:09 +03:00
|
|
|
=/ =path /ge/[foreign-agent]
|
2020-12-01 07:12:43 +03:00
|
|
|
[%a %plea ship %g path ames-request-all]
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2020-04-22 08:37:12 +03:00
|
|
|
=. outstanding.state
|
gall: remove message type from wire
%leave over the network didn't work because we included the message type
in the wire from gall, so the duct for the initial %watch and the %leave
were different. We need to know the message type so we can route the
acknowledgment as %poke-ack, %watch-ack, or no-op.
This moves this piece of information to a piece of state, where we queue
up the message types per [duct wire]. Ames guarantees that
acknowledgments will come in order.
This also includes an easy state adapter. The more interesting part of
the upgrade is that we likely have outstanding subscriptions with the
old wire format. The disadvantage of storing information in wires is
that it can't be upgraded in +load. So, here we listen for updates on
the old wire format, and when we get them we kill the old subscription,
so that it will be recreated with the new wire format.
As an aside, this is a good example of what we mean when we say
subscriptions may be killed at any time, so apps must handle this case.
Finally, this fixes the "attributing" ship to ~zod for agent requests.
This information was ignored for agent requests, but including it causes
spurious duct mismatches.
2019-12-10 04:52:53 +03:00
|
|
|
=/ stand
|
2020-04-22 08:37:12 +03:00
|
|
|
(~(gut by outstanding.state) [wire hen] *(qeu remote-request))
|
2022-07-06 15:44:20 +03:00
|
|
|
%+ ~(put by outstanding.state) [wire hen]
|
2022-08-25 19:14:40 +03:00
|
|
|
(~(gas to stand) ?.(?=(%leave -.deal) ~[-.deal] ~[%leave]))
|
2022-07-06 15:44:20 +03:00
|
|
|
=. mo-core (mo-pass wire note-arvo)
|
|
|
|
?. ?=(%leave -.deal)
|
|
|
|
mo-core
|
|
|
|
(mo-pass wire [%a [%cork ship]])
|
2019-11-04 04:35:45 +03:00
|
|
|
:: +mo-track-ship: subscribe to ames and jael for notices about .ship
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-11-04 04:35:45 +03:00
|
|
|
++ mo-track-ship
|
2019-10-30 23:12:57 +03:00
|
|
|
|= =ship
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ mo-core
|
2019-10-30 23:12:57 +03:00
|
|
|
:: if already contacted, no-op
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2020-04-22 08:37:12 +03:00
|
|
|
?: (~(has in contacts.state) ship)
|
2019-11-05 07:19:08 +03:00
|
|
|
mo-core
|
2019-11-04 04:35:45 +03:00
|
|
|
:: first contact; update state and subscribe to notifications
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2020-04-22 08:37:12 +03:00
|
|
|
=. contacts.state (~(put in contacts.state) ship)
|
2019-11-04 04:35:45 +03:00
|
|
|
:: ask ames to track .ship's connectivity
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2020-04-22 08:37:12 +03:00
|
|
|
=. moves [[system-duct.state %pass /sys/lag %a %heed ship] moves]
|
2019-11-04 04:35:45 +03:00
|
|
|
:: ask jael to track .ship's breaches
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-10-30 23:12:57 +03:00
|
|
|
=/ =note-arvo [%j %public-keys (silt ship ~)]
|
|
|
|
=. moves
|
2020-04-22 08:37:12 +03:00
|
|
|
[[system-duct.state %pass /sys/era note-arvo] moves]
|
2019-10-30 23:12:57 +03:00
|
|
|
mo-core
|
2019-11-04 04:35:45 +03:00
|
|
|
:: +mo-untrack-ship: cancel subscriptions to ames and jael for .ship
|
2019-11-05 07:19:08 +03:00
|
|
|
::
|
2019-11-04 04:35:45 +03:00
|
|
|
++ mo-untrack-ship
|
2019-11-05 07:19:08 +03:00
|
|
|
|= =ship
|
|
|
|
^+ mo-core
|
2019-10-30 23:12:57 +03:00
|
|
|
:: if already canceled, no-op
|
|
|
|
::
|
2020-04-22 08:37:12 +03:00
|
|
|
?. (~(has in contacts.state) ship)
|
2019-10-30 23:12:57 +03:00
|
|
|
mo-core
|
2019-11-04 04:35:45 +03:00
|
|
|
:: delete .ship from state and kill subscriptions
|
2019-10-30 23:12:57 +03:00
|
|
|
::
|
2020-04-22 08:37:12 +03:00
|
|
|
=. contacts.state (~(del in contacts.state) ship)
|
2019-11-04 04:35:45 +03:00
|
|
|
::
|
2020-04-22 08:37:12 +03:00
|
|
|
=. moves [[system-duct.state %pass /sys/lag %a %jilt ship] moves]
|
2019-11-04 04:35:45 +03:00
|
|
|
::
|
2019-11-05 07:19:08 +03:00
|
|
|
=/ =note-arvo [%j %nuke (silt ship ~)]
|
|
|
|
=. moves
|
2020-04-22 08:37:12 +03:00
|
|
|
[[system-duct.state %pass /sys/era note-arvo] moves]
|
2019-11-05 07:19:08 +03:00
|
|
|
mo-core
|
|
|
|
:: +mo-breach: ship breached, so forget about them
|
|
|
|
::
|
|
|
|
++ mo-breach
|
|
|
|
|= =ship
|
|
|
|
^+ mo-core
|
2019-11-04 04:35:45 +03:00
|
|
|
=. mo-core (mo-untrack-ship ship)
|
2020-03-19 02:06:33 +03:00
|
|
|
=. mo-core (mo-filter-queue ship)
|
2020-04-22 08:37:12 +03:00
|
|
|
=/ agents=(list [name=term =yoke]) ~(tap by yokes.state)
|
2020-06-03 07:50:20 +03:00
|
|
|
=. outstanding.state
|
2020-05-08 07:15:35 +03:00
|
|
|
%- malt
|
2020-06-03 07:50:20 +03:00
|
|
|
%+ skip ~(tap by outstanding.state)
|
2020-05-08 07:15:35 +03:00
|
|
|
|= [[=wire duct] (qeu remote-request)]
|
|
|
|
=(/sys/way/(scot %p ship) (scag 3 wire))
|
|
|
|
::
|
2019-11-05 07:19:08 +03:00
|
|
|
|- ^+ mo-core
|
|
|
|
?~ agents
|
|
|
|
mo-core
|
|
|
|
=. mo-core
|
|
|
|
=/ =routes [disclosing=~ attributing=ship]
|
|
|
|
=/ app (ap-abed:ap name.i.agents routes)
|
|
|
|
ap-abet:(ap-breach:app ship)
|
|
|
|
$(agents t.agents)
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +mo-handle-sys: handle a +sign incoming over /sys.
|
|
|
|
::
|
|
|
|
:: (Note that /sys implies the +sign should be routed to a vane.)
|
|
|
|
::
|
|
|
|
++ mo-handle-sys
|
|
|
|
~/ %mo-handle-sys
|
2021-06-19 05:13:55 +03:00
|
|
|
|= [=wire =sign-arvo]
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ mo-core
|
|
|
|
::
|
2021-06-19 05:13:55 +03:00
|
|
|
?+ -.wire !!
|
2022-07-06 10:51:11 +03:00
|
|
|
%lyv ..mo-core :: vestigial
|
|
|
|
%cor ..mo-core :: vestigial
|
2021-06-19 05:13:55 +03:00
|
|
|
%era (mo-handle-sys-era wire sign-arvo)
|
|
|
|
%lag (mo-handle-sys-lag wire sign-arvo)
|
|
|
|
%req (mo-handle-sys-req wire sign-arvo)
|
|
|
|
%way (mo-handle-sys-way wire sign-arvo)
|
2019-08-29 21:44:37 +03:00
|
|
|
==
|
2019-11-04 04:35:45 +03:00
|
|
|
:: +mo-handle-sys-era: receive update about contact
|
2019-11-05 07:19:08 +03:00
|
|
|
::
|
2019-11-04 04:35:45 +03:00
|
|
|
++ mo-handle-sys-era
|
2021-06-19 05:13:55 +03:00
|
|
|
|= [=wire =sign-arvo]
|
2019-11-05 07:19:08 +03:00
|
|
|
^+ mo-core
|
2020-12-08 03:22:26 +03:00
|
|
|
?> ?=([%jael %public-keys *] sign-arvo)
|
2021-06-19 05:13:55 +03:00
|
|
|
?> ?=([%era ~] wire)
|
2019-11-05 07:19:08 +03:00
|
|
|
?. ?=(%breach -.public-keys-result.sign-arvo)
|
|
|
|
mo-core
|
|
|
|
(mo-breach who.public-keys-result.sign-arvo)
|
2019-11-04 04:35:45 +03:00
|
|
|
:: +mo-handle-sys-lag: handle an ames %clog notification
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-11-04 04:35:45 +03:00
|
|
|
++ mo-handle-sys-lag
|
2021-06-19 05:13:55 +03:00
|
|
|
|= [=wire =sign-arvo]
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ mo-core
|
|
|
|
::
|
2021-06-19 05:13:55 +03:00
|
|
|
?> ?=([%lag ~] wire)
|
2020-12-08 03:22:26 +03:00
|
|
|
?> ?=([%ames %clog *] sign-arvo)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2020-04-22 08:37:12 +03:00
|
|
|
=/ agents=(list term) ~(tap in ~(key by yokes.state))
|
2019-11-04 04:35:45 +03:00
|
|
|
|- ^+ mo-core
|
|
|
|
?~ agents mo-core
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-11-04 04:35:45 +03:00
|
|
|
=. mo-core
|
2021-07-15 09:51:03 +03:00
|
|
|
=/ app (ap-abed:ap i.agents `our)
|
2019-11-04 04:35:45 +03:00
|
|
|
ap-abet:(ap-clog:app ship.sign-arvo)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-11-04 04:35:45 +03:00
|
|
|
$(agents t.agents)
|
2019-10-30 23:12:57 +03:00
|
|
|
:: +mo-handle-sys-req: TODO description
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-10-30 23:12:57 +03:00
|
|
|
:: TODO: what should we do if the remote nacks our %pull?
|
2019-08-29 21:44:37 +03:00
|
|
|
++ mo-handle-sys-req
|
2021-06-19 05:13:55 +03:00
|
|
|
|= [=wire =sign-arvo]
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ mo-core
|
|
|
|
::
|
2021-06-19 05:13:55 +03:00
|
|
|
?> ?=([%req @ @ ~] wire)
|
|
|
|
=/ him (slav %p i.t.wire)
|
|
|
|
=/ dap i.t.t.wire
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2020-12-08 03:22:26 +03:00
|
|
|
?> ?=([?(%gall %behn) %unto *] sign-arvo)
|
2021-06-19 05:13:55 +03:00
|
|
|
=/ =unto +>.sign-arvo
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2021-06-19 05:13:55 +03:00
|
|
|
?- -.unto
|
|
|
|
%raw-fact ~|([%gall-raw-req wire] !!)
|
2019-09-12 05:55:31 +03:00
|
|
|
%poke-ack
|
2019-10-30 23:12:57 +03:00
|
|
|
=/ err=(unit error:ames)
|
2021-06-19 05:13:55 +03:00
|
|
|
?~ p.unto ~
|
|
|
|
`[%poke-ack u.p.unto]
|
2019-10-30 23:12:57 +03:00
|
|
|
(mo-give %done err)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-11-07 09:19:32 +03:00
|
|
|
%fact
|
2021-06-19 05:13:55 +03:00
|
|
|
=+ [mark noun]=[p q.q]:cage.unto
|
2019-11-01 23:18:51 +03:00
|
|
|
(mo-give %boon %d mark noun)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-11-07 09:19:32 +03:00
|
|
|
%kick
|
2019-11-01 23:18:51 +03:00
|
|
|
(mo-give %boon %x ~)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-11-07 09:19:32 +03:00
|
|
|
%watch-ack
|
2019-10-30 23:12:57 +03:00
|
|
|
=/ err=(unit error:ames)
|
2021-06-19 05:13:55 +03:00
|
|
|
?~ p.unto ~
|
|
|
|
`[%watch-ack u.p.unto]
|
2019-10-30 23:12:57 +03:00
|
|
|
(mo-give %done err)
|
2019-08-29 21:44:37 +03:00
|
|
|
==
|
2019-10-30 23:12:57 +03:00
|
|
|
:: +mo-handle-sys-way: handle response to outgoing remote request
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
++ mo-handle-sys-way
|
gall: remove message type from wire
%leave over the network didn't work because we included the message type
in the wire from gall, so the duct for the initial %watch and the %leave
were different. We need to know the message type so we can route the
acknowledgment as %poke-ack, %watch-ack, or no-op.
This moves this piece of information to a piece of state, where we queue
up the message types per [duct wire]. Ames guarantees that
acknowledgments will come in order.
This also includes an easy state adapter. The more interesting part of
the upgrade is that we likely have outstanding subscriptions with the
old wire format. The disadvantage of storing information in wires is
that it can't be upgraded in +load. So, here we listen for updates on
the old wire format, and when we get them we kill the old subscription,
so that it will be recreated with the new wire format.
As an aside, this is a good example of what we mean when we say
subscriptions may be killed at any time, so apps must handle this case.
Finally, this fixes the "attributing" ship to ~zod for agent requests.
This information was ignored for agent requests, but including it causes
spurious duct mismatches.
2019-12-10 04:52:53 +03:00
|
|
|
|= [=wire =sign-arvo]
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ mo-core
|
gall: remove message type from wire
%leave over the network didn't work because we included the message type
in the wire from gall, so the duct for the initial %watch and the %leave
were different. We need to know the message type so we can route the
acknowledgment as %poke-ack, %watch-ack, or no-op.
This moves this piece of information to a piece of state, where we queue
up the message types per [duct wire]. Ames guarantees that
acknowledgments will come in order.
This also includes an easy state adapter. The more interesting part of
the upgrade is that we likely have outstanding subscriptions with the
old wire format. The disadvantage of storing information in wires is
that it can't be upgraded in +load. So, here we listen for updates on
the old wire format, and when we get them we kill the old subscription,
so that it will be recreated with the new wire format.
As an aside, this is a good example of what we mean when we say
subscriptions may be killed at any time, so apps must handle this case.
Finally, this fixes the "attributing" ship to ~zod for agent requests.
This information was ignored for agent requests, but including it causes
spurious duct mismatches.
2019-12-10 04:52:53 +03:00
|
|
|
?> ?=([%way @ @ $@(~ [@ ~])] wire)
|
|
|
|
=/ =ship (slav %p i.t.wire)
|
|
|
|
=/ foreign-agent i.t.t.wire
|
2019-10-30 23:12:57 +03:00
|
|
|
::
|
|
|
|
?+ sign-arvo !!
|
2020-12-08 03:22:26 +03:00
|
|
|
[%ames %done *]
|
2020-04-22 08:37:12 +03:00
|
|
|
=^ remote-request outstanding.state
|
gall: remove message type from wire
%leave over the network didn't work because we included the message type
in the wire from gall, so the duct for the initial %watch and the %leave
were different. We need to know the message type so we can route the
acknowledgment as %poke-ack, %watch-ack, or no-op.
This moves this piece of information to a piece of state, where we queue
up the message types per [duct wire]. Ames guarantees that
acknowledgments will come in order.
This also includes an easy state adapter. The more interesting part of
the upgrade is that we likely have outstanding subscriptions with the
old wire format. The disadvantage of storing information in wires is
that it can't be upgraded in +load. So, here we listen for updates on
the old wire format, and when we get them we kill the old subscription,
so that it will be recreated with the new wire format.
As an aside, this is a good example of what we mean when we say
subscriptions may be killed at any time, so apps must handle this case.
Finally, this fixes the "attributing" ship to ~zod for agent requests.
This information was ignored for agent requests, but including it causes
spurious duct mismatches.
2019-12-10 04:52:53 +03:00
|
|
|
?~ t.t.t.wire
|
2020-02-14 02:12:07 +03:00
|
|
|
=/ full-wire sys+wire
|
gall: remove message type from wire
%leave over the network didn't work because we included the message type
in the wire from gall, so the duct for the initial %watch and the %leave
were different. We need to know the message type so we can route the
acknowledgment as %poke-ack, %watch-ack, or no-op.
This moves this piece of information to a piece of state, where we queue
up the message types per [duct wire]. Ames guarantees that
acknowledgments will come in order.
This also includes an easy state adapter. The more interesting part of
the upgrade is that we likely have outstanding subscriptions with the
old wire format. The disadvantage of storing information in wires is
that it can't be upgraded in +load. So, here we listen for updates on
the old wire format, and when we get them we kill the old subscription,
so that it will be recreated with the new wire format.
As an aside, this is a good example of what we mean when we say
subscriptions may be killed at any time, so apps must handle this case.
Finally, this fixes the "attributing" ship to ~zod for agent requests.
This information was ignored for agent requests, but including it causes
spurious duct mismatches.
2019-12-10 04:52:53 +03:00
|
|
|
=/ stand
|
2020-06-12 16:29:10 +03:00
|
|
|
(~(gut by outstanding.state) [full-wire hen] ~)
|
2020-06-05 04:09:01 +03:00
|
|
|
::
|
|
|
|
:: default is to send both ack types; should only hit if
|
|
|
|
:: cleared queue in +load 3-to-4 or +load-4-to-5
|
|
|
|
::
|
|
|
|
=? stand ?=(~ stand)
|
2021-03-31 21:54:28 +03:00
|
|
|
~& [%gall-missing wire hen]
|
2020-02-14 04:48:33 +03:00
|
|
|
(~(put to *(qeu remote-request)) %missing)
|
2020-06-05 04:09:01 +03:00
|
|
|
~| [full-wire=full-wire hen=hen stand=stand]
|
gall: remove message type from wire
%leave over the network didn't work because we included the message type
in the wire from gall, so the duct for the initial %watch and the %leave
were different. We need to know the message type so we can route the
acknowledgment as %poke-ack, %watch-ack, or no-op.
This moves this piece of information to a piece of state, where we queue
up the message types per [duct wire]. Ames guarantees that
acknowledgments will come in order.
This also includes an easy state adapter. The more interesting part of
the upgrade is that we likely have outstanding subscriptions with the
old wire format. The disadvantage of storing information in wires is
that it can't be upgraded in +load. So, here we listen for updates on
the old wire format, and when we get them we kill the old subscription,
so that it will be recreated with the new wire format.
As an aside, this is a good example of what we mean when we say
subscriptions may be killed at any time, so apps must handle this case.
Finally, this fixes the "attributing" ship to ~zod for agent requests.
This information was ignored for agent requests, but including it causes
spurious duct mismatches.
2019-12-10 04:52:53 +03:00
|
|
|
=^ rr stand ~(get to stand)
|
2022-04-05 05:41:03 +03:00
|
|
|
:- rr
|
2022-08-25 19:14:40 +03:00
|
|
|
?: =(~ stand)
|
2022-04-05 05:41:03 +03:00
|
|
|
(~(del by outstanding.state) [full-wire hen])
|
|
|
|
(~(put by outstanding.state) [full-wire hen] stand)
|
gall: remove message type from wire
%leave over the network didn't work because we included the message type
in the wire from gall, so the duct for the initial %watch and the %leave
were different. We need to know the message type so we can route the
acknowledgment as %poke-ack, %watch-ack, or no-op.
This moves this piece of information to a piece of state, where we queue
up the message types per [duct wire]. Ames guarantees that
acknowledgments will come in order.
This also includes an easy state adapter. The more interesting part of
the upgrade is that we likely have outstanding subscriptions with the
old wire format. The disadvantage of storing information in wires is
that it can't be upgraded in +load. So, here we listen for updates on
the old wire format, and when we get them we kill the old subscription,
so that it will be recreated with the new wire format.
As an aside, this is a good example of what we mean when we say
subscriptions may be killed at any time, so apps must handle this case.
Finally, this fixes the "attributing" ship to ~zod for agent requests.
This information was ignored for agent requests, but including it causes
spurious duct mismatches.
2019-12-10 04:52:53 +03:00
|
|
|
:: non-null case of wire is old, remove on next breach after
|
|
|
|
:: 2019/12
|
|
|
|
::
|
2020-04-22 08:37:12 +03:00
|
|
|
[;;(remote-request i.t.t.t.wire) outstanding.state]
|
gall: remove message type from wire
%leave over the network didn't work because we included the message type
in the wire from gall, so the duct for the initial %watch and the %leave
were different. We need to know the message type so we can route the
acknowledgment as %poke-ack, %watch-ack, or no-op.
This moves this piece of information to a piece of state, where we queue
up the message types per [duct wire]. Ames guarantees that
acknowledgments will come in order.
This also includes an easy state adapter. The more interesting part of
the upgrade is that we likely have outstanding subscriptions with the
old wire format. The disadvantage of storing information in wires is
that it can't be upgraded in +load. So, here we listen for updates on
the old wire format, and when we get them we kill the old subscription,
so that it will be recreated with the new wire format.
As an aside, this is a good example of what we mean when we say
subscriptions may be killed at any time, so apps must handle this case.
Finally, this fixes the "attributing" ship to ~zod for agent requests.
This information was ignored for agent requests, but including it causes
spurious duct mismatches.
2019-12-10 04:52:53 +03:00
|
|
|
::
|
2019-10-30 23:12:57 +03:00
|
|
|
=/ err=(unit tang)
|
|
|
|
?~ error=error.sign-arvo
|
|
|
|
~
|
|
|
|
`[[%leaf (trip tag.u.error)] tang.u.error]
|
2022-11-21 16:23:19 +03:00
|
|
|
:: send a %cork if we get a nack upon initial subscription
|
|
|
|
::
|
2022-11-28 19:21:41 +03:00
|
|
|
=? mo-core
|
|
|
|
&(?=(^ err) |(?=(%watch-as remote-request) ?=(%watch remote-request)))
|
2022-11-21 16:23:19 +03:00
|
|
|
(mo-pass [%sys wire] %a %cork ship)
|
2019-06-29 04:13:32 +03:00
|
|
|
::
|
2019-11-20 00:03:07 +03:00
|
|
|
?- remote-request
|
|
|
|
%watch-as (mo-give %unto %watch-ack err)
|
|
|
|
%watch (mo-give %unto %watch-ack err)
|
|
|
|
%poke (mo-give %unto %poke-ack err)
|
|
|
|
%leave mo-core
|
2022-08-19 22:39:44 +03:00
|
|
|
%missing ~>(%slog.[3 'gall: missing'] mo-core)
|
2016-12-16 09:34:01 +03:00
|
|
|
==
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2020-12-08 03:22:26 +03:00
|
|
|
[%ames %boon *]
|
gall: remove message type from wire
%leave over the network didn't work because we included the message type
in the wire from gall, so the duct for the initial %watch and the %leave
were different. We need to know the message type so we can route the
acknowledgment as %poke-ack, %watch-ack, or no-op.
This moves this piece of information to a piece of state, where we queue
up the message types per [duct wire]. Ames guarantees that
acknowledgments will come in order.
This also includes an easy state adapter. The more interesting part of
the upgrade is that we likely have outstanding subscriptions with the
old wire format. The disadvantage of storing information in wires is
that it can't be upgraded in +load. So, here we listen for updates on
the old wire format, and when we get them we kill the old subscription,
so that it will be recreated with the new wire format.
As an aside, this is a good example of what we mean when we say
subscriptions may be killed at any time, so apps must handle this case.
Finally, this fixes the "attributing" ship to ~zod for agent requests.
This information was ignored for agent requests, but including it causes
spurious duct mismatches.
2019-12-10 04:52:53 +03:00
|
|
|
?^ t.t.t.wire
|
|
|
|
:: kill subscriptions which use the old wire format
|
|
|
|
::
|
|
|
|
!!
|
2019-10-30 23:12:57 +03:00
|
|
|
=/ =ames-response ;;(ames-response payload.sign-arvo)
|
2022-08-08 23:21:34 +03:00
|
|
|
:: %d: diff; ask clay to validate .noun as .mark
|
|
|
|
:: %x: kick; tell agent the publisher canceled the subscription, and
|
|
|
|
:: cork; tell ames to close the associated flow.
|
|
|
|
::
|
|
|
|
?- -.ames-response
|
|
|
|
%d (mo-give %unto %raw-fact mark.ames-response noun.ames-response)
|
|
|
|
%x =. mo-core (mo-give %unto %kick ~)
|
2022-08-25 19:14:40 +03:00
|
|
|
=/ key [[%sys wire] hen]
|
|
|
|
=? outstanding.state =(~ (~(gut by outstanding.state) key ~))
|
|
|
|
(~(del by outstanding.state) key)
|
2022-08-11 17:53:45 +03:00
|
|
|
(mo-pass [%sys wire] %a %cork ship)
|
2022-08-08 23:21:34 +03:00
|
|
|
==
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2020-12-08 03:22:26 +03:00
|
|
|
[%ames %lost *]
|
gall: remove message type from wire
%leave over the network didn't work because we included the message type
in the wire from gall, so the duct for the initial %watch and the %leave
were different. We need to know the message type so we can route the
acknowledgment as %poke-ack, %watch-ack, or no-op.
This moves this piece of information to a piece of state, where we queue
up the message types per [duct wire]. Ames guarantees that
acknowledgments will come in order.
This also includes an easy state adapter. The more interesting part of
the upgrade is that we likely have outstanding subscriptions with the
old wire format. The disadvantage of storing information in wires is
that it can't be upgraded in +load. So, here we listen for updates on
the old wire format, and when we get them we kill the old subscription,
so that it will be recreated with the new wire format.
As an aside, this is a good example of what we mean when we say
subscriptions may be killed at any time, so apps must handle this case.
Finally, this fixes the "attributing" ship to ~zod for agent requests.
This information was ignored for agent requests, but including it causes
spurious duct mismatches.
2019-12-10 04:52:53 +03:00
|
|
|
:: note this should only happen on reverse bones, so only facts
|
|
|
|
:: and kicks
|
|
|
|
::
|
2019-11-20 00:03:07 +03:00
|
|
|
:: TODO: %drip %kick so app crash can't kill the remote %pull
|
2019-08-28 06:12:56 +03:00
|
|
|
::
|
2021-02-18 01:57:44 +03:00
|
|
|
=. mo-core (mo-send-foreign-request ship foreign-agent %leave ~)
|
2019-12-03 00:35:05 +03:00
|
|
|
=. mo-core (mo-give %unto %kick ~)
|
2019-10-30 23:12:57 +03:00
|
|
|
mo-core
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +mo-handle-use: handle a typed +sign incoming on /use.
|
|
|
|
::
|
|
|
|
:: (Note that /use implies the +sign should be routed to an agent.)
|
|
|
|
::
|
2019-11-20 00:03:07 +03:00
|
|
|
:: Initialises the specified agent and then performs an agent-level
|
|
|
|
:: +take on the supplied +sign.
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
++ mo-handle-use
|
|
|
|
~/ %mo-handle-use
|
2021-06-19 05:13:55 +03:00
|
|
|
|= [=wire =sign-arvo]
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ mo-core
|
|
|
|
::
|
2021-06-19 05:13:55 +03:00
|
|
|
?. ?=([@ @ @ *] wire)
|
|
|
|
~& [%mo-handle-use-bad-wire wire]
|
2019-08-29 21:44:37 +03:00
|
|
|
!!
|
|
|
|
::
|
2021-06-19 05:13:55 +03:00
|
|
|
=/ dap=term i.wire
|
2020-11-17 23:53:05 +03:00
|
|
|
=/ yoke (~(get by yokes.state) dap)
|
2023-03-29 21:28:36 +03:00
|
|
|
?. ?=([~ %live *] yoke)
|
2020-11-17 23:53:05 +03:00
|
|
|
%- (slog leaf+"gall: {<dap>} dead, got {<+<.sign-arvo>}" ~)
|
|
|
|
mo-core
|
2022-03-05 03:11:16 +03:00
|
|
|
?. =(run-nonce.u.yoke i.t.wire)
|
2020-11-19 07:12:29 +03:00
|
|
|
%- (slog leaf+"gall: got old {<+<.sign-arvo>} for {<dap>}" ~)
|
|
|
|
mo-core
|
2022-08-16 01:37:35 +03:00
|
|
|
::
|
2020-12-08 03:22:26 +03:00
|
|
|
?. ?=([?(%gall %behn) %unto *] sign-arvo)
|
2020-11-17 23:53:05 +03:00
|
|
|
?: ?=(%| -.agent.u.yoke)
|
|
|
|
%- (slog leaf+"gall: {<dap>} dozing, dropping {<+<.sign-arvo>}" ~)
|
|
|
|
mo-core
|
2019-11-08 01:46:06 +03:00
|
|
|
=/ app
|
2021-06-19 05:13:55 +03:00
|
|
|
=/ =ship (slav %p i.t.t.wire)
|
2019-11-08 01:46:06 +03:00
|
|
|
=/ =routes [disclosing=~ attributing=ship]
|
2020-11-17 23:53:05 +03:00
|
|
|
(ap-abed:ap dap routes)
|
2019-11-08 01:46:06 +03:00
|
|
|
::
|
2021-06-19 05:13:55 +03:00
|
|
|
=. app (ap-generic-take:app t.t.t.wire sign-arvo)
|
2019-08-29 21:44:37 +03:00
|
|
|
ap-abet:app
|
2021-06-19 05:13:55 +03:00
|
|
|
?> ?=([%out @ @ *] t.t.wire)
|
|
|
|
=/ =ship (slav %p i.t.t.t.wire)
|
2020-11-17 23:53:05 +03:00
|
|
|
=/ =routes [disclosing=~ attributing=ship]
|
2021-06-19 05:13:55 +03:00
|
|
|
=/ =unto +>.sign-arvo
|
2020-11-17 23:53:05 +03:00
|
|
|
?: ?=(%| -.agent.u.yoke)
|
|
|
|
=/ blocked=(qeu blocked-move)
|
|
|
|
=/ waiting (~(get by blocked.state) dap)
|
|
|
|
=/ deals (fall waiting *(qeu blocked-move))
|
2021-06-19 05:13:55 +03:00
|
|
|
=/ deal [hen routes |+unto]
|
2020-11-17 23:53:05 +03:00
|
|
|
(~(put to deals) deal)
|
|
|
|
::
|
2021-06-19 05:13:55 +03:00
|
|
|
%- (slog leaf+"gall: {<dap>} dozing, got {<-.unto>}" ~)
|
2020-11-17 23:53:05 +03:00
|
|
|
%_ mo-core
|
|
|
|
blocked.state (~(put by blocked.state) dap blocked)
|
|
|
|
==
|
|
|
|
=/ app (ap-abed:ap dap routes)
|
2019-09-06 04:18:31 +03:00
|
|
|
=. app
|
2021-06-19 05:13:55 +03:00
|
|
|
(ap-specific-take:app t.t.wire unto)
|
2019-09-06 04:18:31 +03:00
|
|
|
ap-abet:app
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +mo-clear-queue: clear blocked tasks from the specified running agent.
|
|
|
|
::
|
|
|
|
++ mo-clear-queue
|
2020-04-22 08:37:12 +03:00
|
|
|
|= dap=term
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ mo-core
|
2020-04-22 08:37:12 +03:00
|
|
|
?. (~(has by yokes.state) dap)
|
2019-08-29 21:44:37 +03:00
|
|
|
mo-core
|
2020-04-22 08:37:12 +03:00
|
|
|
?~ maybe-blocked=(~(get by blocked.state) dap)
|
2019-08-29 21:44:37 +03:00
|
|
|
mo-core
|
2020-04-22 08:37:12 +03:00
|
|
|
=/ blocked=(qeu blocked-move) u.maybe-blocked
|
2019-08-29 21:44:37 +03:00
|
|
|
|- ^+ mo-core
|
|
|
|
?: =(~ blocked)
|
2020-04-22 08:37:12 +03:00
|
|
|
=. blocked.state (~(del by blocked.state) dap)
|
|
|
|
mo-core
|
2021-06-19 05:13:55 +03:00
|
|
|
=^ [=duct =routes blocker=(each deal unto)] blocked
|
2020-11-17 23:53:05 +03:00
|
|
|
~(get to blocked)
|
2021-07-09 21:17:02 +03:00
|
|
|
?: ?=(%| -.blocker) $
|
2020-11-17 23:53:05 +03:00
|
|
|
=/ =move
|
2019-08-29 21:44:37 +03:00
|
|
|
=/ =sock [attributing.routes our]
|
2021-07-09 21:17:02 +03:00
|
|
|
=/ card [%slip %g %deal sock dap p.blocker]
|
2019-08-29 21:44:37 +03:00
|
|
|
[duct card]
|
|
|
|
$(moves [move moves])
|
2020-03-19 02:06:33 +03:00
|
|
|
:: +mo-filter-queue: remove all blocked tasks from ship.
|
|
|
|
::
|
|
|
|
++ mo-filter-queue
|
|
|
|
|= =ship
|
2020-04-22 08:37:12 +03:00
|
|
|
=/ agents=(list [name=term blocked=(qeu blocked-move)])
|
|
|
|
~(tap by blocked.state)
|
|
|
|
=| new-agents=(map term (qeu blocked-move))
|
2020-03-19 02:06:33 +03:00
|
|
|
|- ^+ mo-core
|
|
|
|
?~ agents
|
2020-04-22 08:37:12 +03:00
|
|
|
mo-core(blocked.state new-agents)
|
|
|
|
=| new-blocked=(qeu blocked-move)
|
2020-03-19 02:06:33 +03:00
|
|
|
|- ^+ mo-core
|
|
|
|
?: =(~ blocked.i.agents)
|
|
|
|
?~ new-blocked
|
|
|
|
^$(agents t.agents)
|
|
|
|
%= ^$
|
|
|
|
agents t.agents
|
|
|
|
new-agents (~(put by new-agents) name.i.agents new-blocked)
|
|
|
|
==
|
2020-04-22 08:37:12 +03:00
|
|
|
=^ mov=blocked-move blocked.i.agents ~(get to blocked.i.agents)
|
|
|
|
=? new-blocked !=(ship attributing.routes.mov)
|
2020-03-19 02:06:33 +03:00
|
|
|
(~(put to new-blocked) mov)
|
|
|
|
$
|
2021-07-15 09:51:03 +03:00
|
|
|
:: +mo-idle: put agent to sleep
|
2020-11-10 09:26:13 +03:00
|
|
|
::
|
2021-07-15 09:51:03 +03:00
|
|
|
++ mo-idle
|
|
|
|
|= dap=dude
|
2020-11-10 09:26:13 +03:00
|
|
|
^+ mo-core
|
2021-07-15 09:51:03 +03:00
|
|
|
?. (~(has by yokes.state) dap)
|
|
|
|
~> %slog.0^leaf/"gall: ignoring %idle for {<dap>}, not running"
|
2021-07-13 17:35:54 +03:00
|
|
|
mo-core
|
2021-07-15 09:51:03 +03:00
|
|
|
ap-abet:ap-idle:(ap-abed:ap dap `our)
|
|
|
|
:: +mo-nuke: delete agent completely
|
|
|
|
::
|
|
|
|
++ mo-nuke
|
|
|
|
|= dap=dude
|
|
|
|
^+ mo-core
|
|
|
|
?. (~(has by yokes.state) dap)
|
|
|
|
~> %slog.0^leaf/"gall: ignoring %nuke for {<dap>}, not running"
|
|
|
|
mo-core
|
2021-07-21 11:55:21 +03:00
|
|
|
~> %slog.0^leaf/"gall: nuking {<dap>}"
|
2021-07-15 09:51:03 +03:00
|
|
|
=. mo-core ap-abet:ap-nuke:(ap-abed:ap dap `our)
|
2023-03-29 21:28:36 +03:00
|
|
|
=- mo-core(yokes.state -)
|
|
|
|
%+ ~(jab by yokes.state) dap
|
|
|
|
|= =yoke
|
|
|
|
?: ?=(%nuke -.yoke) yoke
|
|
|
|
:- %nuke
|
|
|
|
%- ~(run by sky.yoke)
|
|
|
|
|= path-state
|
|
|
|
(fall (clap bob (bind (ram:on-path fan) head) max) 0)
|
2022-07-06 10:51:11 +03:00
|
|
|
:: +mo-load: install agents
|
|
|
|
::
|
|
|
|
++ mo-load
|
|
|
|
|= agents=(list [=dude =beak =agent])
|
2022-07-06 14:37:17 +03:00
|
|
|
=. mo-core
|
|
|
|
|- ^+ mo-core
|
|
|
|
?~ agents mo-core
|
|
|
|
=/ [=dude =desk] [dude q.beak]:i.agents
|
2022-09-07 09:52:59 +03:00
|
|
|
:: ~> %slog.0^leaf/"gall: starting {<dude>} on {<desk>}"
|
2022-07-06 14:37:17 +03:00
|
|
|
$(agents t.agents, mo-core (mo-receive-core i.agents))
|
|
|
|
::
|
|
|
|
=/ kil
|
2023-03-29 21:28:36 +03:00
|
|
|
=/ lol
|
|
|
|
(skim ~(tap by yokes.state) |=([* y=yoke] &(?=(%live -.y) -.agent.y)))
|
2022-09-07 09:52:59 +03:00
|
|
|
=/ mol (~(gas by *(map term yoke)) lol)
|
|
|
|
=/ sol ~(key by mol)
|
2022-07-06 14:37:17 +03:00
|
|
|
=/ new (silt (turn agents head))
|
2022-09-07 09:52:59 +03:00
|
|
|
~(tap in (~(dif in sol) new))
|
2022-07-06 14:37:17 +03:00
|
|
|
|- ^+ mo-core
|
|
|
|
?~ kil mo-core
|
|
|
|
~> %slog.0^leaf/"gall: stopping {<i.kil>}"
|
|
|
|
$(kil t.kil, mo-core (mo-idle i.kil))
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +mo-peek: call to +ap-peek (which is not accessible outside of +mo).
|
|
|
|
::
|
|
|
|
++ mo-peek
|
|
|
|
~/ %mo-peek
|
2022-02-23 08:15:37 +03:00
|
|
|
|= [veb=? dap=term =routes care=term =path]
|
2019-08-29 21:44:37 +03:00
|
|
|
^- (unit (unit cage))
|
|
|
|
::
|
2020-04-22 08:37:12 +03:00
|
|
|
=/ app (ap-abed:ap dap routes)
|
2022-02-23 08:15:37 +03:00
|
|
|
(ap-peek:app veb care path)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
++ mo-apply
|
2020-04-22 12:27:36 +03:00
|
|
|
|= [dap=term =routes =deal]
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ mo-core
|
2020-04-30 11:15:28 +03:00
|
|
|
?- -.deal
|
|
|
|
?(%watch %watch-as %leave %poke)
|
|
|
|
(mo-apply-sure dap routes deal)
|
|
|
|
::
|
|
|
|
%raw-poke
|
|
|
|
=/ =case:clay da+now
|
2023-03-29 21:28:36 +03:00
|
|
|
=/ yok (~(got by yokes.state) dap)
|
|
|
|
=/ =desk q.beak:?>(?=(%live -.yok) yok) ::TODO acceptable assertion?
|
2021-06-19 05:13:55 +03:00
|
|
|
=/ sky (rof ~ %cb [our desk case] /[mark.deal])
|
2020-04-30 11:15:28 +03:00
|
|
|
?- sky
|
|
|
|
?(~ [~ ~])
|
|
|
|
=/ ror "gall: raw-poke fail :{(trip dap)} {<mark.deal>}"
|
|
|
|
(mo-give %unto %poke-ack `[leaf+ror]~)
|
2020-04-22 08:37:12 +03:00
|
|
|
::
|
2020-04-30 11:15:28 +03:00
|
|
|
[~ ~ *]
|
|
|
|
=+ !<(=dais:clay q.u.u.sky)
|
|
|
|
=/ res (mule |.((vale:dais noun.deal)))
|
|
|
|
?: ?=(%| -.res)
|
|
|
|
=/ ror "gall: raw-poke vale fail :{(trip dap)} {<mark.deal>}"
|
|
|
|
(mo-give %unto %poke-ack `[leaf+ror p.res])
|
|
|
|
=. mo-core
|
|
|
|
%+ mo-pass /nowhere
|
2021-06-19 05:13:55 +03:00
|
|
|
[%c %warp our desk ~ %sing %b case /[mark.deal]]
|
2020-04-30 11:15:28 +03:00
|
|
|
(mo-apply-sure dap routes [%poke mark.deal p.res])
|
2020-04-07 02:40:35 +03:00
|
|
|
==
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2020-04-30 11:15:28 +03:00
|
|
|
%poke-as
|
|
|
|
=/ =case:clay da+now
|
|
|
|
=/ =mars:clay [p.cage mark]:deal
|
2020-05-01 09:14:16 +03:00
|
|
|
=/ mars-path /[a.mars]/[b.mars]
|
2023-03-29 21:28:36 +03:00
|
|
|
=/ yok (~(got by yokes.state) dap)
|
|
|
|
=/ =desk q.beak:?>(?=(%live -.yok) yok) ::TODO acceptable assertion?
|
2021-06-19 05:13:55 +03:00
|
|
|
=/ sky (rof ~ %cc [our desk case] mars-path)
|
2020-04-30 11:15:28 +03:00
|
|
|
?- sky
|
|
|
|
?(~ [~ ~])
|
|
|
|
=/ ror "gall: poke cast fail :{(trip dap)} {<mars>}"
|
|
|
|
(mo-give %unto %poke-ack `[leaf+ror]~)
|
|
|
|
::
|
|
|
|
[~ ~ *]
|
|
|
|
=+ !<(=tube:clay q.u.u.sky)
|
|
|
|
=/ res (mule |.((tube q.cage.deal)))
|
|
|
|
?: ?=(%| -.res)
|
|
|
|
=/ ror "gall: poke-as cast fail :{(trip dap)} {<mars>}"
|
|
|
|
(mo-give %unto %poke-ack `[leaf+ror p.res])
|
|
|
|
=. mo-core
|
|
|
|
%+ mo-pass /nowhere
|
2021-06-19 05:13:55 +03:00
|
|
|
[%c %warp our desk ~ %sing %c case /[a.mars]/[b.mars]]
|
2020-04-30 11:15:28 +03:00
|
|
|
(mo-apply-sure dap routes [%poke mark.deal p.res])
|
|
|
|
==
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ mo-apply-sure
|
|
|
|
|= [dap=term =routes =deal]
|
|
|
|
^+ mo-core
|
2020-04-22 12:27:36 +03:00
|
|
|
=/ app (ap-abed:ap dap routes)
|
2019-11-09 04:26:47 +03:00
|
|
|
=. app (ap-apply:app deal)
|
2019-08-29 21:44:37 +03:00
|
|
|
ap-abet:app
|
|
|
|
:: +mo-handle-local: handle locally.
|
|
|
|
::
|
2020-11-17 23:53:05 +03:00
|
|
|
:: If the agent is not running or blocked, assign it the supplied
|
|
|
|
:: +deal. Otherwise simply apply the action to the agent.
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
++ mo-handle-local
|
2019-11-20 00:03:07 +03:00
|
|
|
|= [=ship agent=term =deal]
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ mo-core
|
|
|
|
::
|
|
|
|
=/ =routes [disclosing=~ attributing=ship]
|
2020-11-17 23:53:05 +03:00
|
|
|
=/ running (~(get by yokes.state) agent)
|
2023-03-29 21:28:36 +03:00
|
|
|
=/ is-running &(?=([~ %live *] running) ?=(%& -.agent.u.running))
|
2020-04-30 09:00:57 +03:00
|
|
|
=/ is-blocked (~(has by blocked.state) agent)
|
2022-08-15 17:54:17 +03:00
|
|
|
:: agent is running; deliver move normally
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2022-08-15 17:54:17 +03:00
|
|
|
?. |(!is-running is-blocked)
|
|
|
|
(mo-apply agent routes deal)
|
|
|
|
::
|
|
|
|
=/ blocked=(qeu blocked-move)
|
|
|
|
=/ waiting (~(get by blocked.state) agent)
|
|
|
|
=/ deals (fall waiting *(qeu blocked-move))
|
|
|
|
=/ deal [hen routes &+deal]
|
|
|
|
(~(put to deals) deal)
|
|
|
|
::
|
|
|
|
%- (slog leaf+"gall: not running {<agent>} yet, got {<-.deal>}" ~)
|
|
|
|
%_ mo-core
|
|
|
|
blocked.state (~(put by blocked.state) agent blocked)
|
|
|
|
==
|
2019-11-20 00:03:07 +03:00
|
|
|
:: +mo-handle-ames-request: handle %ames request message.
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-10-30 23:12:57 +03:00
|
|
|
++ mo-handle-ames-request
|
|
|
|
|= [=ship agent-name=term =ames-request]
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ mo-core
|
2019-11-20 00:03:07 +03:00
|
|
|
:: %u/%leave gets automatically acked
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-11-27 01:56:20 +03:00
|
|
|
=. mo-core (mo-track-ship ship)
|
2019-11-03 03:52:48 +03:00
|
|
|
=? mo-core ?=(%u -.ames-request) (mo-give %done ~)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-10-30 23:12:57 +03:00
|
|
|
=/ =wire /sys/req/(scot %p ship)/[agent-name]
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-11-20 00:03:07 +03:00
|
|
|
=/ =deal
|
2019-10-30 23:12:57 +03:00
|
|
|
?- -.ames-request
|
2019-11-20 00:03:07 +03:00
|
|
|
%m [%raw-poke [mark noun]:ames-request]
|
|
|
|
%l [%watch-as [mark path]:ames-request]
|
|
|
|
%s [%watch path.ames-request]
|
|
|
|
%u [%leave ~]
|
2019-08-29 21:44:37 +03:00
|
|
|
==
|
2019-11-20 00:03:07 +03:00
|
|
|
(mo-pass wire %g %deal [ship our] agent-name deal)
|
2022-05-15 18:16:18 +03:00
|
|
|
:: +mo-spew: handle request to set verbosity toggles on debug output
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2022-05-15 18:16:18 +03:00
|
|
|
++ mo-spew
|
|
|
|
|= verbs=(list verb)
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ mo-core
|
2022-05-15 18:16:18 +03:00
|
|
|
:: start from all %.n's, then flip requested toggles
|
|
|
|
::
|
|
|
|
=. veb.bug.state
|
|
|
|
%+ roll verbs
|
|
|
|
|= [=verb acc=_veb-all-off]
|
|
|
|
^+ veb.bug.state
|
|
|
|
?- verb
|
|
|
|
%odd acc(odd %.y)
|
|
|
|
==
|
|
|
|
mo-core
|
|
|
|
:: +mo-sift: handle request to filter debug output by agent
|
|
|
|
::
|
|
|
|
++ mo-sift
|
|
|
|
|= dudes=(list dude)
|
|
|
|
^+ mo-core
|
|
|
|
=. dudes.bug.state (sy dudes)
|
|
|
|
mo-core
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +ap: agent engine
|
|
|
|
::
|
|
|
|
:: An inner, agent-level core. The sample refers to the agent we're
|
|
|
|
:: currently focused on.
|
|
|
|
::
|
|
|
|
++ ap
|
2019-11-19 07:36:21 +03:00
|
|
|
~% %gall-ap +> ~
|
2019-08-29 21:44:37 +03:00
|
|
|
|_ $: agent-name=term
|
|
|
|
agent-routes=routes
|
2019-09-12 05:55:31 +03:00
|
|
|
agent-duct=duct
|
2019-11-08 03:30:45 +03:00
|
|
|
agent-moves=(list move)
|
2019-08-29 21:44:37 +03:00
|
|
|
agent-config=(list (each suss tang))
|
2023-03-29 21:28:36 +03:00
|
|
|
=$>(%live yoke)
|
2019-08-29 21:44:37 +03:00
|
|
|
==
|
2022-05-15 18:16:18 +03:00
|
|
|
::
|
|
|
|
++ trace
|
|
|
|
|= [verb=? print=tang]
|
|
|
|
^+ same
|
|
|
|
(^trace verb agent-name print)
|
|
|
|
::
|
2022-08-09 22:20:24 +03:00
|
|
|
++ ap-nonce-wire
|
|
|
|
|= [=wire =dock]
|
|
|
|
^+ wire
|
|
|
|
=/ nonce=@ (~(got by boar.yoke) wire dock)
|
|
|
|
?: =(0 nonce) wire
|
|
|
|
[(scot %ud nonce) wire]
|
|
|
|
::
|
2019-08-29 21:44:37 +03:00
|
|
|
++ ap-core .
|
|
|
|
:: +ap-abed: initialise state for an agent, with the supplied routes.
|
|
|
|
::
|
2019-11-19 07:36:21 +03:00
|
|
|
:: The agent must already be running in +gall -- here we simply update
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +ap's state to focus on it.
|
|
|
|
::
|
|
|
|
++ ap-abed
|
|
|
|
~/ %ap-abed
|
2020-04-22 13:49:23 +03:00
|
|
|
|= [dap=term =routes]
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ ap-core
|
2023-03-29 21:28:36 +03:00
|
|
|
%^ ap-yoke dap routes
|
|
|
|
=< ?>(?=(%live -) .)
|
|
|
|
(~(got by yokes.state) dap)
|
2020-05-14 14:24:44 +03:00
|
|
|
:: +ap-yoke: initialize agent state, starting from a $yoke
|
|
|
|
::
|
|
|
|
++ ap-yoke
|
2023-03-29 21:28:36 +03:00
|
|
|
|= [dap=term =routes yak=$>(%live ^yoke)]
|
2020-05-14 14:24:44 +03:00
|
|
|
^+ ap-core
|
2021-06-19 05:13:55 +03:00
|
|
|
=. stats.yak
|
|
|
|
:+ +(change.stats.yak)
|
2022-04-27 20:30:26 +03:00
|
|
|
(shaz (mix (add dap change.stats.yak) eny)) :: TODO: so bad, use +og
|
2020-05-14 14:24:44 +03:00
|
|
|
now
|
2020-04-30 09:00:57 +03:00
|
|
|
=. agent-name dap
|
2019-08-29 21:44:37 +03:00
|
|
|
=. agent-routes routes
|
2021-06-19 05:13:55 +03:00
|
|
|
=. yoke yak
|
2019-09-12 05:55:31 +03:00
|
|
|
=. agent-duct hen
|
|
|
|
ap-core
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +ap-abet: resolve moves.
|
|
|
|
::
|
|
|
|
++ ap-abet
|
|
|
|
^+ mo-core
|
|
|
|
::
|
2021-06-19 05:13:55 +03:00
|
|
|
=/ running (~(put by yokes.state) agent-name yoke)
|
2019-08-29 21:44:37 +03:00
|
|
|
=/ moves
|
2021-09-25 06:14:55 +03:00
|
|
|
=/ talker |=(report=(each suss tang) [hen %pass (mo-talk report)])
|
|
|
|
=/ from-suss (turn agent-config talker)
|
2019-11-08 03:30:45 +03:00
|
|
|
:(weld agent-moves from-suss moves)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
%_ mo-core
|
2020-04-22 08:37:12 +03:00
|
|
|
yokes.state running
|
|
|
|
moves moves
|
2019-08-29 21:44:37 +03:00
|
|
|
==
|
2020-11-10 09:26:13 +03:00
|
|
|
::
|
2021-07-19 16:58:18 +03:00
|
|
|
++ ap-idle
|
|
|
|
?: ?=(%| -.agent.yoke) ap-core
|
|
|
|
ap-core(agent.yoke |+on-save:ap-agent-core)
|
|
|
|
::
|
2021-07-15 09:51:03 +03:00
|
|
|
++ ap-nuke
|
2020-11-10 09:26:13 +03:00
|
|
|
^+ ap-core
|
2021-07-15 09:51:03 +03:00
|
|
|
=/ inbound-paths=(set path)
|
|
|
|
%- silt
|
2022-05-18 16:27:17 +03:00
|
|
|
%+ turn ~(tap by bitt.yoke)
|
2021-07-15 09:51:03 +03:00
|
|
|
|= [=duct =ship =path]
|
|
|
|
path
|
2022-07-06 10:51:11 +03:00
|
|
|
=/ will=(list card:agent)
|
2021-07-15 09:51:03 +03:00
|
|
|
%+ welp
|
|
|
|
?: =(~ inbound-paths)
|
|
|
|
~
|
|
|
|
[%give %kick ~(tap in inbound-paths) ~]~
|
2022-05-18 16:27:17 +03:00
|
|
|
%+ turn ~(tap by boat.yoke)
|
2022-08-09 22:21:10 +03:00
|
|
|
|= [[=wire =dock] ? =path]
|
2022-08-26 00:29:51 +03:00
|
|
|
[%pass wire %agent dock %leave ~]
|
2021-07-15 09:51:03 +03:00
|
|
|
=^ maybe-tang ap-core (ap-ingest ~ |.([will *agent]))
|
|
|
|
ap-core
|
2023-03-16 19:24:25 +03:00
|
|
|
:: +ap-grow: bind a path in the agent's scry namespace
|
|
|
|
::
|
|
|
|
++ ap-grow
|
2023-03-29 14:53:25 +03:00
|
|
|
|= [=spur =noun]
|
2023-03-16 19:24:25 +03:00
|
|
|
^+ ap-core
|
|
|
|
=- ap-core(sky.yoke -)
|
2023-03-29 14:53:25 +03:00
|
|
|
%+ ~(put by sky.yoke) spur
|
|
|
|
?~ old=(~(get by sky.yoke) spur) :: insert binding at new path
|
|
|
|
`(put:on-path fan:*path-state 0 [%& noun])
|
|
|
|
=- u.old(fan (put:on-path fan.u.old - [%& noun]))
|
|
|
|
?~ lat=(clap bob.u.old (bind (ram:on-path fan.u.old) head) max)
|
|
|
|
0
|
|
|
|
+(u.lat)
|
2023-03-16 19:24:25 +03:00
|
|
|
:: +ap-tomb: tombstone -- replace bound value with hash
|
|
|
|
::
|
|
|
|
++ ap-tomb
|
|
|
|
|= [=case =spur]
|
|
|
|
^+ ap-core
|
|
|
|
=- ap-core(sky.yoke -)
|
|
|
|
=/ yon ?>(?=(%ud -.case) p.case)
|
|
|
|
=/ old (~(get by sky.yoke) spur)
|
|
|
|
?~ old :: no-op if nonexistent
|
2023-03-16 19:48:46 +03:00
|
|
|
%. sky.yoke
|
|
|
|
%+ trace odd.veb.bug.state
|
|
|
|
[leaf+"gall: {<agent-name>}: tomb {<[case spur]>} no sky"]~
|
2023-03-16 19:24:25 +03:00
|
|
|
=/ val (get:on-path fan.u.old yon)
|
|
|
|
?~ val :: no-op if nonexistent
|
2023-03-16 19:48:46 +03:00
|
|
|
%. sky.yoke
|
|
|
|
%+ trace odd.veb.bug.state
|
|
|
|
[leaf+"gall: {<agent-name>}: tomb {<[case spur]>} no val"]~
|
2023-03-16 19:24:25 +03:00
|
|
|
?- -.u.val
|
2023-03-16 19:48:46 +03:00
|
|
|
%| :: already tombstoned, no-op
|
|
|
|
%. sky.yoke
|
|
|
|
%+ trace odd.veb.bug.state
|
|
|
|
[leaf+"gall: {<agent-name>}: tomb {<[case spur]>} no-op"]~
|
|
|
|
::
|
|
|
|
%& :: replace with hash
|
2023-03-16 19:24:25 +03:00
|
|
|
%+ ~(put by sky.yoke) spur
|
|
|
|
u.old(fan (put:on-path fan.u.old yon [%| (shax (jam p.u.val))]))
|
|
|
|
==
|
|
|
|
:: +ap-cull: delete all bindings up to and including .case
|
|
|
|
::
|
2023-03-16 19:48:46 +03:00
|
|
|
:: Also store .case as the high water mark for .spur
|
|
|
|
:: to prevent any deleted cases from being re-bound later.
|
|
|
|
::
|
2023-03-16 19:24:25 +03:00
|
|
|
++ ap-cull
|
|
|
|
|= [=case =spur]
|
|
|
|
^+ ap-core
|
|
|
|
=- ap-core(sky.yoke -)
|
|
|
|
=/ yon ?>(?=(%ud -.case) p.case)
|
|
|
|
=/ old (~(get by sky.yoke) spur)
|
|
|
|
?~ old :: no-op if nonexistent
|
2023-03-16 19:48:46 +03:00
|
|
|
%. sky.yoke
|
|
|
|
%+ trace odd.veb.bug.state
|
|
|
|
[leaf+"gall: {<agent-name>}: cull {<[case spur]>} no-op"]~
|
2023-03-16 19:24:25 +03:00
|
|
|
%+ ~(put by sky.yoke) spur :: delete all older paths
|
|
|
|
[`yon (lot:on-path fan.u.old `+(yon) ~)]
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +ap-from-internal: internal move to move.
|
|
|
|
::
|
2019-09-12 05:55:31 +03:00
|
|
|
:: We convert from cards to duct-indexed moves when resolving
|
|
|
|
:: them in Arvo.
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2020-12-19 03:07:17 +03:00
|
|
|
:: We accept %huck to "fake" being a message to a ship but
|
|
|
|
:: actually send it to a vane.
|
|
|
|
::
|
2023-03-16 19:24:25 +03:00
|
|
|
+$ carp $+ carp (wind neet gift:agent)
|
|
|
|
+$ neet $+ neet
|
2023-03-29 13:52:12 +03:00
|
|
|
$< ?(%grow %tomb %cull)
|
2023-03-16 19:24:25 +03:00
|
|
|
$% note:agent
|
|
|
|
[%agent [=ship name=term] task=[%raw-poke =mark =noun]]
|
2020-12-19 03:07:17 +03:00
|
|
|
[%huck [=ship name=term] =note-arvo]
|
|
|
|
==
|
|
|
|
::
|
2019-08-29 21:44:37 +03:00
|
|
|
++ ap-from-internal
|
|
|
|
~/ %ap-from-internal
|
2023-03-16 19:24:25 +03:00
|
|
|
|= card=carp
|
2019-09-12 05:55:31 +03:00
|
|
|
^- (list move)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-09-12 05:55:31 +03:00
|
|
|
?- -.card
|
|
|
|
%slip !!
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-09-12 05:55:31 +03:00
|
|
|
%give
|
|
|
|
=/ =gift:agent p.card
|
2019-11-08 00:17:13 +03:00
|
|
|
?: ?=(%kick -.gift)
|
2019-12-22 23:12:28 +03:00
|
|
|
=/ ducts=(list duct) (ap-ducts-from-paths paths.gift ship.gift)
|
2019-11-08 00:17:13 +03:00
|
|
|
%+ turn ducts
|
|
|
|
|= =duct
|
2020-05-01 09:14:16 +03:00
|
|
|
~? &(=(duct system-duct.state) !=(agent-name %hood))
|
2019-11-08 00:17:13 +03:00
|
|
|
[%agent-giving-on-system-duct agent-name -.gift]
|
2019-11-09 04:26:47 +03:00
|
|
|
[duct %give %unto %kick ~]
|
2019-11-08 01:46:06 +03:00
|
|
|
::
|
2019-11-07 09:19:32 +03:00
|
|
|
?. ?=(%fact -.gift)
|
2019-09-12 05:55:31 +03:00
|
|
|
[agent-duct %give %unto gift]~
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-12-22 23:12:28 +03:00
|
|
|
=/ ducts=(list duct) (ap-ducts-from-paths paths.gift ~)
|
2019-09-12 05:55:31 +03:00
|
|
|
=/ =cage cage.gift
|
2020-05-01 09:14:16 +03:00
|
|
|
%- zing
|
2019-09-12 05:55:31 +03:00
|
|
|
%+ turn ducts
|
|
|
|
|= =duct
|
2021-06-19 05:13:55 +03:00
|
|
|
^- (list move)
|
2020-05-01 09:14:16 +03:00
|
|
|
~? &(=(duct system-duct.state) !=(agent-name %hood))
|
2019-09-12 05:55:31 +03:00
|
|
|
[%agent-giving-on-system-duct agent-name -.gift]
|
2021-06-19 05:13:55 +03:00
|
|
|
=/ =mark (~(gut by marks.yoke) duct p.cage)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-09-12 05:55:31 +03:00
|
|
|
?: =(mark p.cage)
|
2020-05-01 09:14:16 +03:00
|
|
|
[duct %give %unto %fact cage.gift]~
|
2020-04-30 11:15:28 +03:00
|
|
|
=/ =mars:clay [p.cage mark]
|
|
|
|
=/ =case:clay da+now
|
2021-06-19 05:13:55 +03:00
|
|
|
=/ bek=beak [our q.beak.yoke case]
|
2020-05-01 09:14:16 +03:00
|
|
|
=/ mars-path /[a.mars]/[b.mars]
|
2020-12-06 13:55:19 +03:00
|
|
|
=/ sky (rof ~ %cc bek mars-path)
|
2020-04-30 11:15:28 +03:00
|
|
|
?- sky
|
2020-05-01 09:14:16 +03:00
|
|
|
?(~ [~ ~])
|
|
|
|
%- (slog leaf+"watch-as fact conversion find-fail" >sky< ~)
|
|
|
|
(ap-kill-up-slip duct)
|
2019-09-12 05:55:31 +03:00
|
|
|
::
|
2020-04-30 11:15:28 +03:00
|
|
|
[~ ~ *]
|
|
|
|
=+ !<(=tube:clay q.u.u.sky)
|
|
|
|
=/ res (mule |.((tube q.cage)))
|
|
|
|
?: ?=(%| -.res)
|
2020-05-01 09:14:16 +03:00
|
|
|
%- (slog leaf+"watch-as fact conversion failure" p.res)
|
|
|
|
(ap-kill-up-slip duct)
|
2021-06-19 05:13:55 +03:00
|
|
|
:~ :* duct %pass /nowhere %c %warp our q.beak.yoke ~
|
|
|
|
%sing %c case mars-path
|
|
|
|
==
|
2020-05-01 09:14:16 +03:00
|
|
|
[duct %give %unto %fact b.mars p.res]
|
|
|
|
==
|
2020-04-30 11:15:28 +03:00
|
|
|
==
|
2019-09-12 05:55:31 +03:00
|
|
|
::
|
|
|
|
%pass
|
2020-04-22 08:37:12 +03:00
|
|
|
=/ =duct system-duct.state
|
2019-09-29 07:44:31 +03:00
|
|
|
=/ =wire p.card
|
2020-12-19 03:07:17 +03:00
|
|
|
=/ =neet q.card
|
2021-08-27 18:06:53 +03:00
|
|
|
?: ?=(%pyre -.neet)
|
|
|
|
%: mean
|
|
|
|
leaf/"gall: %pyre from {<agent-name>}, killing event"
|
|
|
|
leaf/"wire: {<wire>}"
|
|
|
|
tang.neet
|
|
|
|
==
|
2019-09-29 07:44:31 +03:00
|
|
|
=. wire
|
2021-06-28 02:47:24 +03:00
|
|
|
:^ %use agent-name run-nonce.yoke
|
2023-03-16 19:56:52 +03:00
|
|
|
?- -.neet
|
|
|
|
%agent [%out (scot %p ship.neet) name.neet wire]
|
|
|
|
%huck [%out (scot %p ship.neet) name.neet wire]
|
|
|
|
%arvo [(scot %p attributing.agent-routes) wire]
|
2020-12-19 03:07:17 +03:00
|
|
|
==
|
2022-03-05 03:11:16 +03:00
|
|
|
::
|
2019-09-12 05:55:31 +03:00
|
|
|
=/ =note-arvo
|
2020-12-19 03:07:17 +03:00
|
|
|
?- -.neet
|
2023-03-16 19:24:25 +03:00
|
|
|
%arvo +.neet
|
2020-12-19 03:07:17 +03:00
|
|
|
%huck note-arvo.neet
|
2023-03-16 19:24:25 +03:00
|
|
|
%agent [%g %deal [our ship.neet] [name task]:neet]
|
2019-09-12 05:55:31 +03:00
|
|
|
==
|
2019-09-29 07:44:31 +03:00
|
|
|
[duct %pass wire note-arvo]~
|
2019-09-12 05:55:31 +03:00
|
|
|
==
|
2019-11-05 07:19:08 +03:00
|
|
|
:: +ap-breach: ship breached, so forget about them
|
|
|
|
::
|
|
|
|
++ ap-breach
|
|
|
|
|= =ship
|
|
|
|
^+ ap-core
|
2022-05-18 16:27:17 +03:00
|
|
|
=/ in=(list [=duct =^ship =path]) ~(tap by bitt.yoke)
|
2019-11-05 07:19:08 +03:00
|
|
|
|- ^+ ap-core
|
|
|
|
?^ in
|
|
|
|
=? ap-core =(ship ship.i.in)
|
|
|
|
=/ core ap-load-delete(agent-duct duct.i.in)
|
|
|
|
core(agent-duct agent-duct)
|
|
|
|
$(in t.in)
|
|
|
|
::
|
2022-08-09 22:20:24 +03:00
|
|
|
=/ out=(list [=wire =^ship =term])
|
|
|
|
~(tap ^in ~(key by boat.yoke))
|
2019-11-05 07:19:08 +03:00
|
|
|
|- ^+ ap-core
|
|
|
|
?~ out
|
|
|
|
ap-core
|
|
|
|
=? ap-core =(ship ship.i.out)
|
|
|
|
=/ core
|
2020-04-30 09:00:57 +03:00
|
|
|
=. agent-duct system-duct.state
|
2022-08-09 22:20:24 +03:00
|
|
|
=. wire.i.out (ap-nonce-wire i.out)
|
|
|
|
=/ way [%out (scot %p ship) term.i.out wire.i.out]
|
2019-12-03 10:46:15 +03:00
|
|
|
(ap-specific-take way %kick ~)
|
2019-11-05 07:19:08 +03:00
|
|
|
core(agent-duct agent-duct)
|
|
|
|
$(out t.out)
|
2019-11-04 04:35:45 +03:00
|
|
|
:: +ap-clog: handle %clog notification from ames
|
|
|
|
::
|
|
|
|
:: Kills subscriptions from .ship in both directions:
|
|
|
|
:: - notifies local app that subscription is dead
|
|
|
|
:: - gives remote %quit to notify subscriber ship
|
|
|
|
:: TODO: %drip local app notification for error isolation
|
|
|
|
::
|
|
|
|
++ ap-clog
|
|
|
|
|= =ship
|
|
|
|
^+ ap-core
|
|
|
|
::
|
2022-05-18 16:27:17 +03:00
|
|
|
=/ in=(list [=duct =^ship =path]) ~(tap by bitt.yoke)
|
2019-11-04 04:35:45 +03:00
|
|
|
|- ^+ ap-core
|
|
|
|
?~ in ap-core
|
|
|
|
::
|
|
|
|
=? ap-core =(ship ship.i.in)
|
2019-11-20 00:03:07 +03:00
|
|
|
=/ core ap-kill-up(agent-duct duct.i.in)
|
|
|
|
core(agent-duct agent-duct)
|
2019-11-04 04:35:45 +03:00
|
|
|
$(in t.in)
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +ap-agent-core: agent core with current bowl and state
|
|
|
|
::
|
|
|
|
++ ap-agent-core
|
2021-06-19 05:13:55 +03:00
|
|
|
?> ?=(%& -.agent.yoke)
|
|
|
|
~(. p.agent.yoke ap-construct-bowl)
|
2019-12-22 23:12:28 +03:00
|
|
|
:: +ap-ducts-from-paths: get ducts subscribed to paths
|
|
|
|
::
|
|
|
|
++ ap-ducts-from-paths
|
|
|
|
|= [target-paths=(list path) target-ship=(unit ship)]
|
|
|
|
^- (list duct)
|
2020-05-08 04:12:57 +03:00
|
|
|
?~ target-paths
|
|
|
|
?~ target-ship
|
|
|
|
~[agent-duct]
|
2022-05-18 16:27:17 +03:00
|
|
|
%+ murn ~(tap by bitt.yoke)
|
2020-05-08 04:12:57 +03:00
|
|
|
|= [=duct =ship =path]
|
|
|
|
^- (unit ^duct)
|
|
|
|
?: =(target-ship `ship)
|
|
|
|
`duct
|
|
|
|
~
|
2019-12-22 23:12:28 +03:00
|
|
|
%- zing
|
|
|
|
%+ turn target-paths
|
|
|
|
|= =path
|
2020-05-08 04:12:57 +03:00
|
|
|
(ap-ducts-from-path path target-ship)
|
2019-09-12 05:55:31 +03:00
|
|
|
:: +ap-ducts-from-path: get ducts subscribed to path
|
|
|
|
::
|
|
|
|
++ ap-ducts-from-path
|
2020-05-08 04:12:57 +03:00
|
|
|
|= [target-path=path target-ship=(unit ship)]
|
2019-09-12 05:55:31 +03:00
|
|
|
^- (list duct)
|
2022-05-18 16:27:17 +03:00
|
|
|
%+ murn ~(tap by bitt.yoke)
|
2019-09-12 05:55:31 +03:00
|
|
|
|= [=duct =ship =path]
|
|
|
|
^- (unit ^duct)
|
2020-05-08 04:12:57 +03:00
|
|
|
?: ?& =(target-path path)
|
|
|
|
|(=(target-ship ~) =(target-ship `ship))
|
|
|
|
==
|
2019-09-12 05:55:31 +03:00
|
|
|
`duct
|
|
|
|
~
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +ap-apply: apply effect.
|
|
|
|
::
|
|
|
|
++ ap-apply
|
2019-11-09 04:26:47 +03:00
|
|
|
|= =deal
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ ap-core
|
2019-11-09 04:26:47 +03:00
|
|
|
?- -.deal
|
|
|
|
%watch-as (ap-subscribe-as +.deal)
|
|
|
|
%poke (ap-poke +.deal)
|
|
|
|
%watch (ap-subscribe +.deal)
|
|
|
|
%raw-poke !!
|
|
|
|
%poke-as !!
|
|
|
|
%leave ap-load-delete
|
2019-08-29 21:44:37 +03:00
|
|
|
==
|
|
|
|
:: +ap-peek: peek.
|
|
|
|
::
|
|
|
|
++ ap-peek
|
|
|
|
~/ %ap-peek
|
2022-02-23 08:15:37 +03:00
|
|
|
|= [veb=? care=term tyl=path]
|
2019-08-29 21:44:37 +03:00
|
|
|
^- (unit (unit cage))
|
2020-06-12 03:03:55 +03:00
|
|
|
:: take trailing mark off path for %x scrys
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2020-06-12 03:03:55 +03:00
|
|
|
=^ want=mark tyl
|
|
|
|
?. ?=(%x care) [%$ tyl]
|
|
|
|
=. tyl (flop tyl)
|
|
|
|
[(head tyl) (flop (tail tyl))]
|
|
|
|
:: call the app's +on-peek, producing [~ ~] if it crashes
|
2019-09-25 23:19:09 +03:00
|
|
|
::
|
2019-08-29 21:44:37 +03:00
|
|
|
=/ peek-result=(each (unit (unit cage)) tang)
|
2020-04-22 13:49:23 +03:00
|
|
|
(ap-mule-peek |.((on-peek:ap-agent-core [care tyl])))
|
2020-06-12 03:03:55 +03:00
|
|
|
?: ?=(%| -.peek-result)
|
2022-02-23 08:15:37 +03:00
|
|
|
?. veb [~ ~]
|
2020-06-12 03:03:55 +03:00
|
|
|
((slog leaf+"peek bad result" p.peek-result) [~ ~])
|
|
|
|
:: for non-%x scries, or failed %x scries, or %x results that already
|
|
|
|
:: have the requested mark, produce the result as-is
|
|
|
|
::
|
|
|
|
?. ?& ?=(%x care)
|
|
|
|
?=([~ ~ *] p.peek-result)
|
|
|
|
!=(mark p.u.u.p.peek-result)
|
|
|
|
==
|
|
|
|
p.peek-result
|
|
|
|
:: for %x scries, attempt to convert to the requested mark if needed
|
|
|
|
::
|
|
|
|
=* have p.u.u.p.peek-result
|
|
|
|
=* vase q.u.u.p.peek-result
|
|
|
|
=/ tub=(unit tube:clay)
|
|
|
|
?: =(have want) `(bake same ^vase)
|
|
|
|
=/ tuc=(unit (unit cage))
|
2021-06-19 05:13:55 +03:00
|
|
|
(rof ~ %cc [our q.beak.yoke da+now] /[have]/[want])
|
2020-06-12 03:03:55 +03:00
|
|
|
?. ?=([~ ~ *] tuc) ~
|
|
|
|
`!<(tube:clay q.u.u.tuc)
|
|
|
|
?~ tub
|
|
|
|
((slog leaf+"peek no tube from {(trip have)} to {(trip want)}" ~) ~)
|
|
|
|
=/ res (mule |.((u.tub vase)))
|
|
|
|
?: ?=(%& -.res)
|
|
|
|
``want^p.res
|
|
|
|
((slog leaf+"peek failed tube from {(trip have)} to {(trip want)}" ~) ~)
|
2021-06-19 05:13:55 +03:00
|
|
|
:: +ap-move: send move
|
|
|
|
::
|
|
|
|
++ ap-move
|
|
|
|
|= =(list move)
|
|
|
|
ap-core(agent-moves (weld (flop list) agent-moves))
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +ap-give: return result.
|
|
|
|
::
|
|
|
|
++ ap-give
|
2019-09-12 05:55:31 +03:00
|
|
|
|= =gift:agent
|
2021-06-19 05:13:55 +03:00
|
|
|
(ap-move (ap-from-internal %give gift))
|
|
|
|
:: +ap-pass: request action.
|
|
|
|
::
|
|
|
|
++ ap-pass
|
|
|
|
|= [=path =neet]
|
|
|
|
(ap-move (ap-from-internal %pass path neet))
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +ap-construct-bowl: set up bowl.
|
|
|
|
::
|
|
|
|
++ ap-construct-bowl
|
|
|
|
^- bowl
|
|
|
|
:* :* our :: host
|
|
|
|
attributing.agent-routes :: guest
|
|
|
|
agent-name :: agent
|
|
|
|
== ::
|
2022-05-18 16:27:17 +03:00
|
|
|
:* wex=boat.yoke :: outgoing
|
|
|
|
sup=bitt.yoke :: incoming
|
2019-08-29 21:44:37 +03:00
|
|
|
== ::
|
2021-06-19 05:13:55 +03:00
|
|
|
:* act=change.stats.yoke :: tick
|
|
|
|
eny=eny.stats.yoke :: nonce
|
|
|
|
now=time.stats.yoke :: time
|
|
|
|
byk=beak.yoke :: source
|
2019-08-29 21:44:37 +03:00
|
|
|
== ==
|
|
|
|
:: +ap-reinstall: reinstall.
|
|
|
|
::
|
|
|
|
++ ap-reinstall
|
|
|
|
~/ %ap-reinstall
|
2020-04-22 08:37:12 +03:00
|
|
|
|= =agent
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ ap-core
|
2020-11-17 23:53:05 +03:00
|
|
|
=/ old-state=vase
|
2021-06-19 05:13:55 +03:00
|
|
|
?: ?=(%& -.agent.yoke)
|
2020-11-17 23:53:05 +03:00
|
|
|
on-save:ap-agent-core
|
2021-06-19 05:13:55 +03:00
|
|
|
p.agent.yoke
|
2020-04-22 08:37:12 +03:00
|
|
|
=^ error ap-core
|
2021-06-19 05:13:55 +03:00
|
|
|
(ap-install(agent.yoke &+agent) `old-state)
|
2020-04-22 08:37:12 +03:00
|
|
|
?~ error
|
2019-08-29 21:44:37 +03:00
|
|
|
ap-core
|
2020-06-18 06:31:37 +03:00
|
|
|
(mean >%load-failed< u.error)
|
2019-11-09 04:26:47 +03:00
|
|
|
:: +ap-subscribe-as: apply %watch-as.
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-11-09 04:26:47 +03:00
|
|
|
++ ap-subscribe-as
|
2019-08-29 21:44:37 +03:00
|
|
|
|= [=mark =path]
|
|
|
|
^+ ap-core
|
2021-06-19 05:13:55 +03:00
|
|
|
=. marks.yoke (~(put by marks.yoke) agent-duct mark)
|
2019-09-12 05:55:31 +03:00
|
|
|
(ap-subscribe path)
|
2019-11-07 09:19:32 +03:00
|
|
|
:: +ap-subscribe: apply %watch.
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-09-12 05:55:31 +03:00
|
|
|
++ ap-subscribe
|
|
|
|
~/ %ap-subscribe
|
2019-08-29 21:44:37 +03:00
|
|
|
|= pax=path
|
|
|
|
^+ ap-core
|
2022-05-18 16:27:17 +03:00
|
|
|
=/ incoming [attributing.agent-routes pax]
|
|
|
|
=. bitt.yoke (~(put by bitt.yoke) agent-duct incoming)
|
2019-08-29 21:44:37 +03:00
|
|
|
=^ maybe-tang ap-core
|
2019-11-07 09:19:32 +03:00
|
|
|
%+ ap-ingest %watch-ack |.
|
|
|
|
(on-watch:ap-agent-core pax)
|
2019-08-29 21:44:37 +03:00
|
|
|
?^ maybe-tang
|
|
|
|
ap-silent-delete
|
|
|
|
ap-core
|
|
|
|
:: +ap-poke: apply %poke.
|
|
|
|
::
|
|
|
|
++ ap-poke
|
|
|
|
~/ %ap-poke
|
|
|
|
|= =cage
|
|
|
|
^+ ap-core
|
|
|
|
=^ maybe-tang ap-core
|
2019-09-12 05:55:31 +03:00
|
|
|
%+ ap-ingest %poke-ack |.
|
2019-11-07 09:19:32 +03:00
|
|
|
(on-poke:ap-agent-core cage)
|
2019-08-29 21:44:37 +03:00
|
|
|
ap-core
|
2019-09-12 05:55:31 +03:00
|
|
|
:: +ap-error: pour error.
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-09-12 05:55:31 +03:00
|
|
|
++ ap-error
|
2019-08-29 21:44:37 +03:00
|
|
|
|= [=term =tang]
|
|
|
|
^+ ap-core
|
|
|
|
=/ form |=(=tank [%rose [~ "! " ~] tank ~])
|
2019-08-29 22:57:33 +03:00
|
|
|
=^ maybe-tang ap-core
|
|
|
|
%+ ap-ingest ~ |.
|
2019-11-07 09:19:32 +03:00
|
|
|
(on-fail:ap-agent-core term (turn tang form))
|
2019-08-29 21:44:37 +03:00
|
|
|
ap-core
|
|
|
|
:: +ap-generic-take: generic take.
|
|
|
|
::
|
|
|
|
++ ap-generic-take
|
|
|
|
~/ %ap-generic-take
|
2019-09-12 05:55:31 +03:00
|
|
|
|= [=wire =sign-arvo]
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ ap-core
|
|
|
|
=^ maybe-tang ap-core
|
|
|
|
%+ ap-ingest ~ |.
|
2019-11-07 09:19:32 +03:00
|
|
|
(on-arvo:ap-agent-core wire sign-arvo)
|
2019-08-29 21:44:37 +03:00
|
|
|
?^ maybe-tang
|
2019-09-12 05:55:31 +03:00
|
|
|
(ap-error %arvo-response u.maybe-tang)
|
2019-08-29 21:44:37 +03:00
|
|
|
ap-core
|
|
|
|
:: +ap-specific-take: specific take.
|
|
|
|
::
|
|
|
|
++ ap-specific-take
|
2021-06-19 05:13:55 +03:00
|
|
|
|= [=wire =unto]
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ ap-core
|
2019-09-29 07:44:31 +03:00
|
|
|
~| wire=wire
|
|
|
|
?> ?=([%out @ @ *] wire)
|
|
|
|
=/ other-ship (slav %p i.t.wire)
|
|
|
|
=/ other-agent i.t.t.wire
|
2019-10-01 06:53:02 +03:00
|
|
|
=/ =dock [other-ship other-agent]
|
2019-09-29 07:44:31 +03:00
|
|
|
=/ agent-wire t.t.t.wire
|
2021-06-28 02:47:24 +03:00
|
|
|
=/ nonce=@ 0
|
2021-06-19 05:13:55 +03:00
|
|
|
::
|
|
|
|
=^ =sign:agent ap-core
|
|
|
|
?. ?=(%raw-fact -.unto)
|
|
|
|
[unto ap-core]
|
|
|
|
=/ =case:clay da+now
|
2021-09-24 23:24:27 +03:00
|
|
|
?: ?=(%spider agent-name)
|
|
|
|
:- [%fact mark.unto !>(noun.unto)]
|
|
|
|
ap-core
|
2021-06-19 05:13:55 +03:00
|
|
|
=/ sky (rof ~ %cb [our q.beak.yoke case] /[mark.unto])
|
|
|
|
?. ?=([~ ~ *] sky)
|
|
|
|
(mean leaf+"gall: ames mark fail {<mark.unto>}" ~)
|
|
|
|
::
|
|
|
|
=+ !<(=dais:clay q.u.u.sky)
|
|
|
|
=/ res (mule |.((vale:dais noun.unto)))
|
|
|
|
?: ?=(%| -.res)
|
|
|
|
(mean leaf+"gall: ames vale fail {<mark.unto>}" p.res)
|
|
|
|
:- [%fact mark.unto p.res]
|
|
|
|
%- ap-move :_ ~
|
|
|
|
:^ hen %pass /nowhere
|
|
|
|
[%c %warp our q.beak.yoke ~ %sing %b case /[mark.unto]]
|
2022-07-06 10:12:30 +03:00
|
|
|
|^ ^+ ap-core
|
|
|
|
:: %poke-ack has no nonce; ingest directly
|
|
|
|
::
|
|
|
|
?: ?=(%poke-ack -.sign)
|
|
|
|
ingest-and-check-error
|
|
|
|
:: if .agent-wire matches, it's an old pre-nonce subscription
|
|
|
|
::
|
|
|
|
?: (~(has by boat.yoke) sub-key)
|
|
|
|
run-sign
|
|
|
|
:: if an app happened to use a null wire, no-op
|
|
|
|
::
|
|
|
|
?: =(~ agent-wire)
|
|
|
|
on-missing
|
|
|
|
=/ has-nonce=(unit @ud) (slaw %ud (head agent-wire))
|
|
|
|
?: &(?=(~ has-nonce) ?=(%kick -.sign))
|
|
|
|
on-weird-kick
|
|
|
|
:: pop nonce off .agent-wire and match against stored subscription
|
|
|
|
::
|
|
|
|
?> ?=(^ has-nonce)
|
|
|
|
=: nonce u.has-nonce
|
|
|
|
agent-wire (tail agent-wire)
|
|
|
|
==
|
|
|
|
?~ got=(~(get by boar.yoke) sub-key)
|
|
|
|
on-missing
|
|
|
|
?: =(nonce.u.got nonce)
|
|
|
|
run-sign
|
|
|
|
(on-bad-nonce nonce.u.got)
|
2021-06-19 05:13:55 +03:00
|
|
|
::
|
2022-03-31 11:41:34 +03:00
|
|
|
++ sub-key [agent-wire dock]
|
|
|
|
++ ingest (ap-ingest ~ |.((on-agent:ap-agent-core agent-wire sign)))
|
2021-06-28 02:47:24 +03:00
|
|
|
++ run-sign
|
|
|
|
?- -.sign
|
|
|
|
%poke-ack !!
|
|
|
|
%fact
|
|
|
|
=^ tan ap-core ingest
|
|
|
|
?~ tan ap-core
|
|
|
|
=. ap-core (ap-kill-down sub-key)
|
|
|
|
(ap-error -.sign leaf/"take %fact failed, closing subscription" u.tan)
|
2021-06-26 01:11:18 +03:00
|
|
|
::
|
2021-06-28 02:47:24 +03:00
|
|
|
%kick
|
2022-05-18 16:27:17 +03:00
|
|
|
=: boar.yoke (~(del by boar.yoke) sub-key)
|
|
|
|
boat.yoke (~(del by boat.yoke) sub-key)
|
2022-05-16 10:13:40 +03:00
|
|
|
==
|
2021-06-28 02:47:24 +03:00
|
|
|
ingest-and-check-error
|
|
|
|
::
|
|
|
|
%watch-ack
|
2022-05-18 16:27:17 +03:00
|
|
|
?. (~(has by boat.yoke) sub-key)
|
2022-05-15 18:16:18 +03:00
|
|
|
%. ap-core
|
|
|
|
%+ trace odd.veb.bug.state :~
|
2019-11-06 06:55:51 +03:00
|
|
|
leaf+"{<agent-name>}: got ack for nonexistent subscription"
|
|
|
|
leaf+"{<dock>}: {<agent-wire>}"
|
2019-11-08 05:25:19 +03:00
|
|
|
>wire=wire<
|
2019-11-06 06:55:51 +03:00
|
|
|
==
|
2022-05-18 16:27:17 +03:00
|
|
|
=? boar.yoke ?=(^ p.sign) (~(del by boar.yoke) sub-key)
|
2022-05-16 10:13:40 +03:00
|
|
|
::
|
2022-05-18 16:27:17 +03:00
|
|
|
=. boat.yoke
|
|
|
|
?^ p.sign (~(del by boat.yoke) sub-key)
|
2021-06-28 02:47:24 +03:00
|
|
|
::
|
2022-05-18 16:27:17 +03:00
|
|
|
%+ ~(jab by boat.yoke) sub-key
|
2022-05-16 10:13:40 +03:00
|
|
|
|= val=[acked=? =path]
|
2022-05-15 18:16:18 +03:00
|
|
|
%. val(acked &)
|
|
|
|
%^ trace &(odd.veb.bug.state acked.val)
|
|
|
|
leaf/"{<agent-name>} 2nd watch-ack on {<val>}" ~
|
2021-06-28 02:47:24 +03:00
|
|
|
::
|
|
|
|
ingest-and-check-error
|
|
|
|
==
|
2019-11-06 06:55:51 +03:00
|
|
|
::
|
2021-06-28 02:47:24 +03:00
|
|
|
++ on-missing
|
2021-06-26 01:11:18 +03:00
|
|
|
%. ap-core
|
2022-05-15 18:16:18 +03:00
|
|
|
%+ trace odd.veb.bug.state :~
|
2021-06-26 01:11:18 +03:00
|
|
|
leaf+"{<agent-name>}: got {<-.sign>} for nonexistent subscription"
|
2021-06-28 02:47:24 +03:00
|
|
|
leaf+"{<dock>}: {<[nonce=nonce agent-wire]>}"
|
2021-06-26 01:11:18 +03:00
|
|
|
>wire=wire<
|
|
|
|
==
|
2019-10-01 06:53:02 +03:00
|
|
|
::
|
2022-04-15 18:22:01 +03:00
|
|
|
++ on-weird-kick
|
|
|
|
%. run-sign
|
2022-05-15 18:16:18 +03:00
|
|
|
%+ trace odd.veb.bug.state :~
|
2022-04-15 18:22:01 +03:00
|
|
|
leaf+"{<agent-name>}: got %kick for nonexistent subscription"
|
|
|
|
leaf+"{<dock>}: {<agent-wire>}"
|
|
|
|
>wire=wire<
|
|
|
|
==
|
2019-10-01 06:53:02 +03:00
|
|
|
::
|
2021-06-28 02:47:24 +03:00
|
|
|
++ on-bad-nonce
|
|
|
|
|= stored-nonce=@
|
2021-06-26 01:11:18 +03:00
|
|
|
%. ap-core
|
|
|
|
%- slog :~
|
2021-06-28 02:47:24 +03:00
|
|
|
=/ nonces [expected=stored-nonce got=nonce]
|
2021-06-26 01:11:18 +03:00
|
|
|
=/ ok |(?=(?(%fact %kick) -.sign) =(~ p.sign))
|
2022-06-30 16:57:02 +03:00
|
|
|
leaf+"{<agent-name>}: stale {<-.sign>} {<nonces>} ok={<ok>}"
|
2021-06-26 01:11:18 +03:00
|
|
|
::
|
|
|
|
leaf+"{<dock>}: {<agent-wire>}"
|
|
|
|
>wire=wire<
|
|
|
|
==
|
2019-11-06 06:55:51 +03:00
|
|
|
::
|
2021-06-26 01:11:18 +03:00
|
|
|
++ ingest-and-check-error
|
|
|
|
^+ ap-core
|
|
|
|
=^ tan ap-core ingest
|
|
|
|
?~(tan ap-core (ap-error -.sign leaf/"take {<-.sign>} failed" u.tan))
|
|
|
|
--
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +ap-install: install wrapper.
|
|
|
|
::
|
|
|
|
++ ap-install
|
2020-04-22 08:37:12 +03:00
|
|
|
|= old-agent-state=(unit vase)
|
2019-08-29 21:44:37 +03:00
|
|
|
^- [(unit tang) _ap-core]
|
|
|
|
::
|
2020-04-22 08:37:12 +03:00
|
|
|
=^ maybe-tang ap-core (ap-upgrade-state old-agent-state)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2020-04-30 09:00:57 +03:00
|
|
|
=. agent-config
|
2021-07-07 21:08:21 +03:00
|
|
|
:_ agent-config
|
|
|
|
^- (each suss tang)
|
|
|
|
?^ maybe-tang
|
|
|
|
|/u.maybe-tang
|
|
|
|
&/[agent-name ?~(old-agent-state %boot %bump) now]
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2020-04-22 08:37:12 +03:00
|
|
|
[maybe-tang ap-core]
|
2019-09-12 05:55:31 +03:00
|
|
|
:: +ap-upgrade-state: low-level install.
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-09-12 05:55:31 +03:00
|
|
|
++ ap-upgrade-state
|
|
|
|
~/ %ap-upgrade-state
|
2019-08-29 21:44:37 +03:00
|
|
|
|= maybe-vase=(unit vase)
|
|
|
|
^- [(unit tang) _ap-core]
|
|
|
|
::
|
|
|
|
=^ maybe-tang ap-core
|
|
|
|
%+ ap-ingest ~
|
|
|
|
?~ maybe-vase
|
2019-11-07 09:19:32 +03:00
|
|
|
|. on-init:ap-agent-core
|
|
|
|
|. (on-load:ap-agent-core u.maybe-vase)
|
2019-08-29 21:44:37 +03:00
|
|
|
[maybe-tang ap-core]
|
|
|
|
:: +ap-silent-delete: silent delete.
|
|
|
|
::
|
|
|
|
++ ap-silent-delete
|
|
|
|
^+ ap-core
|
2022-05-18 16:27:17 +03:00
|
|
|
ap-core(bitt.yoke (~(del by bitt.yoke) agent-duct))
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +ap-load-delete: load delete.
|
|
|
|
::
|
|
|
|
++ ap-load-delete
|
|
|
|
^+ ap-core
|
|
|
|
::
|
2022-05-18 16:27:17 +03:00
|
|
|
=/ maybe-incoming (~(get by bitt.yoke) agent-duct)
|
2019-08-29 21:44:37 +03:00
|
|
|
?~ maybe-incoming
|
|
|
|
ap-core
|
|
|
|
::
|
2022-05-18 16:27:17 +03:00
|
|
|
=/ incoming u.maybe-incoming
|
|
|
|
=. bitt.yoke (~(del by bitt.yoke) agent-duct)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
=^ maybe-tang ap-core
|
|
|
|
%+ ap-ingest ~ |.
|
2019-11-07 09:19:32 +03:00
|
|
|
(on-leave:ap-agent-core q.incoming)
|
2019-08-29 21:44:37 +03:00
|
|
|
?^ maybe-tang
|
2019-11-07 09:19:32 +03:00
|
|
|
(ap-error %leave u.maybe-tang)
|
2019-08-29 21:44:37 +03:00
|
|
|
ap-core
|
2019-09-29 07:44:31 +03:00
|
|
|
:: +ap-kill-up: 2-sided kill from publisher side
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-09-29 07:44:31 +03:00
|
|
|
++ ap-kill-up
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ ap-core
|
|
|
|
::
|
|
|
|
=> ap-load-delete
|
2019-11-07 09:19:32 +03:00
|
|
|
(ap-give %kick ~ ~)
|
2020-05-01 09:14:16 +03:00
|
|
|
:: +ap-kill-up-slip: 2-sided kill from publisher side by slip
|
|
|
|
::
|
|
|
|
:: +ap-kill-up is reentrant if you call it in the
|
|
|
|
:: middle of processing another deal
|
|
|
|
::
|
|
|
|
:: Should probably call +ap-error with error message
|
|
|
|
::
|
|
|
|
++ ap-kill-up-slip
|
|
|
|
|= =duct
|
|
|
|
^- (list move)
|
|
|
|
::
|
|
|
|
:~ [duct %slip %g %deal [our our] agent-name %leave ~]
|
|
|
|
[duct %give %unto %kick ~]
|
|
|
|
==
|
2019-09-29 07:44:31 +03:00
|
|
|
:: +ap-kill-down: 2-sided kill from subscriber side
|
|
|
|
::
|
2019-11-21 00:22:36 +03:00
|
|
|
:: Must process leave first in case kick handler rewatches.
|
|
|
|
::
|
2019-09-29 07:44:31 +03:00
|
|
|
++ ap-kill-down
|
2022-08-09 21:53:43 +03:00
|
|
|
|= [sub-wire=wire =dock]
|
2019-09-29 07:44:31 +03:00
|
|
|
^+ ap-core
|
|
|
|
=. ap-core
|
2022-08-09 22:20:24 +03:00
|
|
|
:: we take care to include the nonce in the "kernel-facing" wire
|
|
|
|
::
|
|
|
|
(ap-pass (ap-nonce-wire sub-wire dock) %agent dock %leave ~)
|
2022-08-09 21:53:43 +03:00
|
|
|
(ap-pass sub-wire %huck dock %b %huck `sign-arvo`[%gall %unto %kick ~])
|
2022-08-17 00:02:59 +03:00
|
|
|
:: +ap-doff: kill old-style outgoing subscriptions
|
2022-08-10 19:09:47 +03:00
|
|
|
::
|
|
|
|
++ ap-doff
|
2022-08-10 21:33:07 +03:00
|
|
|
|= ship=(unit ship)
|
2022-08-10 19:09:47 +03:00
|
|
|
^+ ap-core
|
|
|
|
=/ subs ~(tap in ~(key by boat.yoke))
|
|
|
|
|- ^+ ap-core
|
|
|
|
?~ subs ap-core
|
|
|
|
=+ [wyr dok]=i.subs
|
2022-08-11 20:48:27 +03:00
|
|
|
?: &(?=(^ ship) !=(u.ship ship.dok))
|
2022-08-10 21:33:07 +03:00
|
|
|
$(subs t.subs)
|
2022-08-17 00:02:59 +03:00
|
|
|
:: if we haven't created new-style (nonced) subscriptions yet,
|
|
|
|
:: kick the old-style (nonceless) one that's in use right now.
|
2022-08-10 19:09:47 +03:00
|
|
|
::
|
2022-08-17 00:02:59 +03:00
|
|
|
::NOTE yes, still safe for pre-release ships with nonce=1,
|
|
|
|
:: this makes a new flow but cleans it up right away.
|
2022-08-10 23:47:08 +03:00
|
|
|
::
|
2022-08-17 00:02:59 +03:00
|
|
|
=? ap-core (gte 1 (~(got by boar.yoke) wyr dok))
|
|
|
|
(ap-pass wyr %agent dok %leave ~)
|
|
|
|
$(subs t.subs)
|
2022-08-18 20:34:42 +03:00
|
|
|
:: +ap-rake: clean up the dead %leave's
|
|
|
|
::
|
|
|
|
++ ap-rake
|
|
|
|
|= all=?
|
|
|
|
=/ subs ~(tap in ~(key by boat.yoke))
|
|
|
|
|^ ^+ ap-core
|
|
|
|
?~ subs ap-core
|
|
|
|
=/ [=wire =dock] i.subs
|
|
|
|
=/ non (~(got by boar.yoke) wire dock)
|
|
|
|
?: &(!all =(0 non))
|
|
|
|
$(subs t.subs)
|
|
|
|
?~ per=(scry-peer-state p.dock)
|
|
|
|
$(subs t.subs)
|
|
|
|
::
|
|
|
|
=/ dud=(set duct)
|
2022-08-18 23:39:54 +03:00
|
|
|
=/ mod=^wire
|
2022-08-18 23:46:58 +03:00
|
|
|
:* %gall %use agent-name run-nonce.yoke
|
|
|
|
%out (scot %p p.dock) q.dock
|
|
|
|
'0' wire
|
2022-08-18 23:39:54 +03:00
|
|
|
==
|
2022-08-18 20:34:42 +03:00
|
|
|
%- ~(rep by by-duct.ossuary.u.per)
|
2022-08-18 23:39:54 +03:00
|
|
|
|= [[=duct =bone] out=(set duct)]
|
2022-08-18 20:34:42 +03:00
|
|
|
^+ out
|
2022-08-18 23:39:54 +03:00
|
|
|
?. ?& ?=([* [%gall %use @ @ %out @ @ @ *] *] duct)
|
|
|
|
=(mod i.t.duct(i.t.t.t.t.t.t.t '0'))
|
2022-08-18 20:34:42 +03:00
|
|
|
==
|
|
|
|
out
|
2022-08-18 23:39:54 +03:00
|
|
|
?: (~(has in closing.u.per) bone) out
|
2022-08-18 20:34:42 +03:00
|
|
|
~> %slog.0^leaf+"gall: rake {<i.t.duct>}"
|
|
|
|
(~(put in out) duct)
|
|
|
|
::
|
|
|
|
%- ap-move
|
|
|
|
(turn ~(tap in dud) |=(d=duct [+.d %pass -.d %a %cork p.dock]))
|
|
|
|
::
|
|
|
|
++ scry-peer-state
|
|
|
|
|= her=ship
|
|
|
|
~+ ^- (unit peer-state:ames)
|
|
|
|
=/ sky (rof [~ ~] %ax [our %$ da+now] /peers/(scot %p her))
|
|
|
|
?: |(?=(~ sky) ?=(~ u.sky))
|
|
|
|
~
|
|
|
|
=/ sat !<(ship-state:ames q.u.u.sky)
|
|
|
|
?>(?=(%known -.sat) (some +.sat))
|
|
|
|
--
|
2019-11-22 01:45:56 +03:00
|
|
|
:: +ap-mule: run virtualized with intercepted scry, preserving type
|
|
|
|
::
|
|
|
|
:: Compare +mute and +mule. Those pass through scry, which
|
|
|
|
:: doesn't allow us to catch crashes due to blocking scry. If
|
|
|
|
:: you intercept scry, you can't preserve the type
|
|
|
|
:: polymorphically. By monomorphizing, we are able to do so
|
|
|
|
:: safely.
|
|
|
|
::
|
|
|
|
++ ap-mule
|
|
|
|
|= run=_^?(|.(*step:agent))
|
|
|
|
^- (each step:agent tang)
|
2020-12-06 13:55:19 +03:00
|
|
|
=/ res (mock [run %9 2 %0 1] (look rof ~))
|
2019-11-22 01:45:56 +03:00
|
|
|
?- -.res
|
|
|
|
%0 [%& !<(step:agent [-:!>(*step:agent) p.res])]
|
2020-05-21 03:20:51 +03:00
|
|
|
%1 [%| (smyt ;;(path p.res)) ~]
|
2019-11-22 01:45:56 +03:00
|
|
|
%2 [%| p.res]
|
|
|
|
==
|
|
|
|
:: +ap-mule-peek: same as +ap-mule but for (unit (unit cage))
|
|
|
|
::
|
|
|
|
++ ap-mule-peek
|
|
|
|
|= run=_^?(|.(*(unit (unit cage))))
|
|
|
|
^- (each (unit (unit cage)) tang)
|
2020-12-06 13:55:19 +03:00
|
|
|
=/ res (mock [run %9 2 %0 1] (look rof ~))
|
2019-11-22 01:45:56 +03:00
|
|
|
?- -.res
|
|
|
|
%0 [%& !<((unit (unit cage)) [-:!>(*(unit (unit cage))) p.res])]
|
2020-05-21 03:20:51 +03:00
|
|
|
%1 [%| (smyt ;;(path p.res)) ~]
|
2019-11-22 01:45:56 +03:00
|
|
|
%2 [%| p.res]
|
|
|
|
==
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +ap-ingest: call agent arm
|
|
|
|
::
|
|
|
|
:: Handle acks here because they need to be emitted before the
|
|
|
|
:: rest of the moves.
|
|
|
|
::
|
|
|
|
++ ap-ingest
|
2019-11-07 09:19:32 +03:00
|
|
|
|= [ack=?(%poke-ack %watch-ack ~) run=_^?(|.(*step:agent))]
|
2019-08-29 21:44:37 +03:00
|
|
|
^- [(unit tang) _ap-core]
|
2019-11-22 01:45:56 +03:00
|
|
|
=/ result (ap-mule run)
|
2019-11-08 03:30:45 +03:00
|
|
|
=^ new-moves ap-core (ap-handle-result result)
|
2019-08-29 21:44:37 +03:00
|
|
|
=/ maybe-tang=(unit tang)
|
2019-09-04 22:48:36 +03:00
|
|
|
?: ?=(%& -.result)
|
2019-08-29 21:44:37 +03:00
|
|
|
~
|
2019-09-04 22:48:36 +03:00
|
|
|
`p.result
|
2019-11-08 03:30:45 +03:00
|
|
|
=/ ack-moves=(list move)
|
|
|
|
%- zing
|
|
|
|
%- turn :_ ap-from-internal
|
2023-03-16 19:24:25 +03:00
|
|
|
^- (list carp)
|
2019-08-29 21:44:37 +03:00
|
|
|
?- ack
|
|
|
|
~ ~
|
2019-11-08 03:30:45 +03:00
|
|
|
%poke-ack [%give %poke-ack maybe-tang]~
|
2019-11-07 09:19:32 +03:00
|
|
|
%watch-ack [%give %watch-ack maybe-tang]~
|
2019-08-29 21:44:37 +03:00
|
|
|
==
|
|
|
|
::
|
2019-11-08 03:30:45 +03:00
|
|
|
=. agent-moves
|
|
|
|
:(weld (flop new-moves) ack-moves agent-moves)
|
2019-08-29 21:44:37 +03:00
|
|
|
[maybe-tang ap-core]
|
|
|
|
:: +ap-handle-result: handle result.
|
|
|
|
::
|
|
|
|
++ ap-handle-result
|
|
|
|
~/ %ap-handle-result
|
2019-09-04 22:48:36 +03:00
|
|
|
|= result=(each step:agent tang)
|
2019-11-08 03:30:45 +03:00
|
|
|
^- [(list move) _ap-core]
|
2019-08-29 21:44:37 +03:00
|
|
|
?: ?=(%| -.result)
|
2019-09-04 22:48:36 +03:00
|
|
|
`ap-core
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2021-06-19 05:13:55 +03:00
|
|
|
=. agent.yoke &++.p.result
|
2023-03-16 19:24:25 +03:00
|
|
|
=^ fex ap-core (ap-handle-sky -.p.result)
|
|
|
|
=/ moves (zing (turn fex ap-from-internal))
|
2022-05-18 16:27:17 +03:00
|
|
|
=. bitt.yoke (ap-handle-kicks moves)
|
2019-11-08 03:30:45 +03:00
|
|
|
(ap-handle-peers moves)
|
2023-03-16 19:24:25 +03:00
|
|
|
:: +ap-handle-sky: apply effects to the agent's scry namespace
|
|
|
|
::
|
|
|
|
++ ap-handle-sky
|
|
|
|
=| fex=(list carp)
|
|
|
|
|= caz=(list card:agent)
|
|
|
|
^+ [fex ap-core]
|
|
|
|
?~ caz [(flop fex) ap-core]
|
|
|
|
?- i.caz
|
|
|
|
[%pass * %grow *] $(caz t.caz, ap-core (ap-grow +.q.i.caz))
|
|
|
|
[%pass * %tomb *] $(caz t.caz, ap-core (ap-tomb +.q.i.caz))
|
|
|
|
[%pass * %cull *] $(caz t.caz, ap-core (ap-cull +.q.i.caz))
|
|
|
|
[%pass * ?(%agent %arvo %pyre) *] $(caz t.caz, fex [i.caz fex])
|
|
|
|
[%give *] $(caz t.caz, fex [i.caz fex])
|
|
|
|
[%slip *] !!
|
|
|
|
==
|
2022-05-16 10:13:40 +03:00
|
|
|
:: +ap-handle-kicks: handle cancels of bitt.watches
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-11-08 03:30:45 +03:00
|
|
|
++ ap-handle-kicks
|
|
|
|
~/ %ap-handle-kicks
|
|
|
|
|= moves=(list move)
|
2019-08-29 21:44:37 +03:00
|
|
|
^- bitt
|
2019-09-12 05:55:31 +03:00
|
|
|
=/ quits=(list duct)
|
2019-11-08 03:30:45 +03:00
|
|
|
%+ murn moves
|
|
|
|
|= =move
|
|
|
|
^- (unit duct)
|
|
|
|
?. ?=([* %give %unto %kick *] move)
|
2019-08-29 21:44:37 +03:00
|
|
|
~
|
2019-11-08 03:30:45 +03:00
|
|
|
`duct.move
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
=/ quit-map=bitt
|
2019-09-12 05:55:31 +03:00
|
|
|
(malt (turn quits |=(=duct [duct *[ship path]])))
|
2022-05-18 16:27:17 +03:00
|
|
|
(~(dif by bitt.yoke) quit-map)
|
2022-05-16 10:13:40 +03:00
|
|
|
:: +ap-handle-peers: handle new boat.watches
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-10-01 06:53:02 +03:00
|
|
|
++ ap-handle-peers
|
|
|
|
~/ %ap-handle-peers
|
2019-11-08 03:30:45 +03:00
|
|
|
|= moves=(list move)
|
|
|
|
^- [(list move) _ap-core]
|
|
|
|
=| new-moves=(list move)
|
|
|
|
|- ^- [(list move) _ap-core]
|
2019-10-01 06:53:02 +03:00
|
|
|
?~ moves
|
2019-11-08 03:30:45 +03:00
|
|
|
[(flop new-moves) ap-core]
|
|
|
|
=/ =move i.moves
|
2019-11-19 07:36:21 +03:00
|
|
|
?: ?=([* %pass * %g %deal * * %leave *] move)
|
2019-11-08 03:30:45 +03:00
|
|
|
=/ =wire p.move.move
|
2019-11-08 05:25:19 +03:00
|
|
|
?> ?=([%use @ @ %out @ @ *] wire)
|
2022-04-01 10:37:45 +03:00
|
|
|
=/ =dock [q.p q]:q.move.move
|
|
|
|
=/ sys-wire=^wire (scag 6 `^wire`wire)
|
|
|
|
=/ sub-wire=^wire (slag 6 `^wire`wire)
|
|
|
|
::
|
2022-05-18 16:27:17 +03:00
|
|
|
?. (~(has by boat.yoke) sub-wire dock)
|
2022-05-15 18:16:18 +03:00
|
|
|
%. $(moves t.moves)
|
|
|
|
%^ trace odd.veb.bug.state
|
|
|
|
leaf/"gall: {<agent-name>} missing subscription, got %leave" ~
|
2022-05-18 16:27:17 +03:00
|
|
|
=/ nonce=@ (~(got by boar.yoke) sub-wire dock)
|
2022-04-01 10:37:45 +03:00
|
|
|
=. p.move.move
|
2022-05-17 15:29:13 +03:00
|
|
|
%+ weld sys-wire
|
2022-08-09 22:20:24 +03:00
|
|
|
(ap-nonce-wire sub-wire dock)
|
2022-05-18 16:27:17 +03:00
|
|
|
=: boat.yoke (~(del by boat.yoke) [sub-wire dock])
|
|
|
|
boar.yoke (~(del by boar.yoke) [sub-wire dock])
|
2022-05-16 10:13:40 +03:00
|
|
|
==
|
2022-05-17 16:37:33 +03:00
|
|
|
:: if nonce = 0, this was a pre-nonce subscription so later
|
|
|
|
:: subscriptions need to start subscribing on the next nonce
|
|
|
|
::
|
2022-07-06 15:44:20 +03:00
|
|
|
=? sub-nonce.yoke =(nonce 0) +(sub-nonce.yoke)
|
2019-11-08 03:30:45 +03:00
|
|
|
$(moves t.moves, new-moves [move new-moves])
|
2020-05-01 09:14:16 +03:00
|
|
|
?. ?=([* %pass * %g %deal * * ?(%watch %watch-as) *] move)
|
2019-11-08 03:30:45 +03:00
|
|
|
$(moves t.moves, new-moves [move new-moves])
|
|
|
|
=/ =wire p.move.move
|
2019-11-08 05:25:19 +03:00
|
|
|
?> ?=([%use @ @ %out @ @ *] wire)
|
2021-06-26 01:11:18 +03:00
|
|
|
=/ sys-wire=^wire (scag 6 `^wire`wire)
|
|
|
|
=/ sub-wire=^wire (slag 6 `^wire`wire)
|
2022-03-05 03:11:16 +03:00
|
|
|
=/ [=dock =deal] [[q.p q] r]:q.move.move
|
|
|
|
::
|
2022-05-18 16:27:17 +03:00
|
|
|
?: (~(has by boat.yoke) sub-wire dock)
|
2019-11-05 07:19:08 +03:00
|
|
|
=. ap-core
|
2019-10-01 06:53:02 +03:00
|
|
|
=/ =tang
|
2022-03-05 03:11:16 +03:00
|
|
|
~[leaf+"subscribe wire not unique" >agent-name< >sub-wire< >dock<]
|
2022-05-18 16:27:17 +03:00
|
|
|
=/ have (~(got by boat.yoke) sub-wire dock)
|
2020-05-04 00:21:30 +03:00
|
|
|
%- (slog >out=have< tang)
|
2020-05-01 09:14:16 +03:00
|
|
|
(ap-error %watch-not-unique tang) :: reentrant, maybe bad?
|
2019-10-01 06:53:02 +03:00
|
|
|
$(moves t.moves)
|
2021-06-26 01:11:18 +03:00
|
|
|
::
|
2022-08-09 22:36:08 +03:00
|
|
|
::NOTE 0-check guards against pre-release bug
|
2022-08-09 22:21:10 +03:00
|
|
|
=? p.move.move !=(0 sub-nonce.yoke)
|
2021-06-26 01:11:18 +03:00
|
|
|
(weld sys-wire [(scot %ud sub-nonce.yoke) sub-wire])
|
2021-07-07 18:50:21 +03:00
|
|
|
%_ $
|
2022-03-31 11:41:34 +03:00
|
|
|
moves t.moves
|
|
|
|
new-moves [move new-moves]
|
2022-07-06 15:44:20 +03:00
|
|
|
sub-nonce.yoke +(sub-nonce.yoke)
|
2022-03-31 11:41:34 +03:00
|
|
|
::
|
2022-05-18 16:27:17 +03:00
|
|
|
boat.yoke
|
|
|
|
%+ ~(put by boat.yoke) [sub-wire dock]
|
2022-05-16 10:13:40 +03:00
|
|
|
:- acked=|
|
|
|
|
path=?+(-.deal !! %watch path.deal, %watch-as path.deal)
|
|
|
|
::
|
2022-05-18 16:27:17 +03:00
|
|
|
boar.yoke
|
|
|
|
(~(put by boar.yoke) [sub-wire dock] sub-nonce.yoke)
|
2021-06-26 01:11:18 +03:00
|
|
|
==
|
2019-08-29 21:44:37 +03:00
|
|
|
--
|
|
|
|
--
|
|
|
|
:: +call: request
|
|
|
|
::
|
|
|
|
++ call
|
2019-11-19 07:36:21 +03:00
|
|
|
~% %gall-call +> ~
|
2020-12-08 03:47:06 +03:00
|
|
|
|= [=duct dud=(unit goof) hic=(hobo task)]
|
2019-11-19 07:36:21 +03:00
|
|
|
^- [(list move) _gall-payload]
|
2020-02-25 01:10:59 +03:00
|
|
|
?^ dud
|
|
|
|
~|(%gall-call-dud (mean tang.u.dud))
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2020-12-06 11:38:37 +03:00
|
|
|
~| [%gall-call-failed duct hic]
|
2020-12-08 03:47:06 +03:00
|
|
|
=/ =task ((harden task) hic)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2020-04-22 01:50:47 +03:00
|
|
|
=/ mo-core (mo-abed:mo duct)
|
2019-08-29 21:44:37 +03:00
|
|
|
?- -.task
|
2019-11-09 04:26:47 +03:00
|
|
|
%deal
|
2020-04-22 08:37:12 +03:00
|
|
|
=/ [=sock =term =deal] [p q r]:task
|
2019-08-29 21:44:37 +03:00
|
|
|
?. =(q.sock our)
|
|
|
|
?> =(p.sock our)
|
2020-04-22 01:50:47 +03:00
|
|
|
mo-abet:(mo-send-foreign-request:mo-core q.sock term deal)
|
|
|
|
mo-abet:(mo-handle-local:mo-core p.sock term deal)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2020-04-22 08:37:12 +03:00
|
|
|
%init [~ gall-payload(system-duct.state duct)]
|
2019-10-30 23:12:57 +03:00
|
|
|
%plea
|
|
|
|
=/ =ship ship.task
|
2019-11-01 22:06:09 +03:00
|
|
|
=/ =path path.plea.task
|
|
|
|
=/ =noun payload.plea.task
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-10-30 23:12:57 +03:00
|
|
|
~| [ship=ship plea-path=path]
|
|
|
|
?> ?=([%ge @ ~] path)
|
2019-08-29 21:44:37 +03:00
|
|
|
=/ agent-name i.t.path
|
|
|
|
::
|
2020-12-01 07:12:43 +03:00
|
|
|
=+ ;;(=ames-request-all noun)
|
|
|
|
?> ?=(%0 -.ames-request-all)
|
|
|
|
=> (mo-handle-ames-request:mo-core ship agent-name +.ames-request-all)
|
2019-08-29 21:44:37 +03:00
|
|
|
mo-abet
|
|
|
|
::
|
2020-04-22 08:37:12 +03:00
|
|
|
%sear mo-abet:(mo-filter-queue:mo-core ship.task)
|
2021-07-20 17:59:20 +03:00
|
|
|
%jolt mo-abet:(mo-jolt:mo-core dude.task our desk.task)
|
2021-07-15 09:51:03 +03:00
|
|
|
%idle mo-abet:(mo-idle:mo-core dude.task)
|
2022-07-06 10:51:11 +03:00
|
|
|
%load mo-abet:(mo-load:mo-core +.task)
|
2021-07-15 09:51:03 +03:00
|
|
|
%nuke mo-abet:(mo-nuke:mo-core dude.task)
|
2022-08-10 21:33:07 +03:00
|
|
|
%doff mo-abet:(mo-doff:mo-core +.task)
|
2022-08-18 20:34:42 +03:00
|
|
|
%rake mo-abet:(mo-rake:mo-core +.task)
|
2022-05-15 18:16:18 +03:00
|
|
|
%spew mo-abet:(mo-spew:mo-core veb.task)
|
|
|
|
%sift mo-abet:(mo-sift:mo-core dudes.task)
|
2020-04-22 08:37:12 +03:00
|
|
|
%trim [~ gall-payload]
|
|
|
|
%vega [~ gall-payload]
|
2019-08-29 21:44:37 +03:00
|
|
|
==
|
2020-05-14 14:24:44 +03:00
|
|
|
:: +load: recreate vane; note, only valid if called from pupa
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2022-07-06 10:51:11 +03:00
|
|
|
++ load
|
|
|
|
|^ |= old=spore-any
|
2022-09-02 06:03:17 +03:00
|
|
|
=? old ?=(%7 -.old) (spore-7-to-8 old)
|
|
|
|
=? old ?=(%8 -.old) (spore-8-to-9 old)
|
|
|
|
=? old ?=(%9 -.old) (spore-9-to-10 old)
|
2022-10-14 04:42:19 +03:00
|
|
|
=? old ?=(%10 -.old) (spore-10-to-11 old)
|
2023-03-12 03:35:55 +03:00
|
|
|
=? old ?=(%11 -.old) (spore-11-to-12 old)
|
|
|
|
?> ?=(%12 -.old)
|
2022-07-06 10:51:11 +03:00
|
|
|
gall-payload(state old)
|
|
|
|
::
|
2023-03-12 03:35:55 +03:00
|
|
|
+$ spore-any $%(spore spore-7 spore-8 spore-9 spore-10 spore-11)
|
|
|
|
+$ spore-11
|
|
|
|
$: %11
|
|
|
|
system-duct=duct
|
|
|
|
outstanding=(map [wire duct] (qeu remote-request))
|
|
|
|
contacts=(set ship)
|
|
|
|
eggs=(map term egg-11)
|
|
|
|
blocked=(map term (qeu blocked-move))
|
|
|
|
=bug
|
|
|
|
==
|
|
|
|
+$ egg-11
|
|
|
|
$: control-duct=duct
|
|
|
|
run-nonce=@t
|
|
|
|
sub-nonce=@
|
|
|
|
=stats
|
|
|
|
=bitt
|
|
|
|
=boat
|
|
|
|
=boar
|
|
|
|
code=~
|
|
|
|
old-state=[%| vase]
|
|
|
|
=beak
|
|
|
|
marks=(map duct mark)
|
|
|
|
==
|
2022-10-14 04:42:19 +03:00
|
|
|
+$ spore-10
|
|
|
|
$: %10
|
2022-09-02 06:03:17 +03:00
|
|
|
system-duct=duct
|
|
|
|
outstanding=(map [wire duct] (qeu remote-request))
|
|
|
|
contacts=(set ship)
|
2022-10-14 04:42:19 +03:00
|
|
|
eggs=(map term egg-10)
|
2022-09-02 06:03:17 +03:00
|
|
|
blocked=(map term (qeu blocked-move))
|
|
|
|
=bug
|
|
|
|
==
|
2022-10-14 04:42:19 +03:00
|
|
|
+$ egg-10
|
2022-09-02 06:03:17 +03:00
|
|
|
$: control-duct=duct
|
|
|
|
run-nonce=@t
|
|
|
|
sub-nonce=@
|
|
|
|
live=?
|
|
|
|
=stats
|
|
|
|
=bitt
|
|
|
|
=boat
|
|
|
|
=boar
|
|
|
|
old-state=(each vase vase)
|
|
|
|
=beak
|
|
|
|
marks=(map duct mark)
|
|
|
|
==
|
2022-10-14 04:42:19 +03:00
|
|
|
+$ spore-9
|
|
|
|
$: %9
|
|
|
|
system-duct=duct
|
|
|
|
outstanding=(map [wire duct] (qeu remote-request-9))
|
|
|
|
contacts=(set ship)
|
|
|
|
eggs=(map term egg-10)
|
|
|
|
blocked=(map term (qeu blocked-move))
|
|
|
|
=bug
|
|
|
|
==
|
|
|
|
::
|
|
|
|
+$ remote-request-9 ?(remote-request %cork)
|
|
|
|
::
|
2022-07-06 10:51:11 +03:00
|
|
|
+$ spore-8
|
|
|
|
$: %8
|
|
|
|
system-duct=duct
|
2022-10-14 04:42:19 +03:00
|
|
|
outstanding=(map [wire duct] (qeu remote-request-9))
|
2022-07-06 10:51:11 +03:00
|
|
|
contacts=(set ship)
|
|
|
|
eggs=(map term egg-8)
|
|
|
|
blocked=(map term (qeu blocked-move))
|
|
|
|
==
|
|
|
|
+$ egg-8
|
|
|
|
$: control-duct=duct
|
2022-09-02 06:03:17 +03:00
|
|
|
run-nonce=@t
|
2022-07-06 10:51:11 +03:00
|
|
|
live=?
|
|
|
|
=stats
|
2022-09-02 06:03:17 +03:00
|
|
|
watches=watches-8
|
2022-07-06 10:51:11 +03:00
|
|
|
old-state=(each vase vase)
|
|
|
|
=beak
|
|
|
|
marks=(map duct mark)
|
|
|
|
==
|
2022-09-02 06:03:17 +03:00
|
|
|
+$ watches-8 [inbound=bitt outbound=boat-8]
|
|
|
|
+$ boat-8 (map [wire ship term] [acked=? =path])
|
2022-07-06 10:51:11 +03:00
|
|
|
+$ spore-7
|
|
|
|
$: %7
|
|
|
|
wipe-eyre-subs=_| ::NOTE band-aid for #3196
|
|
|
|
system-duct=duct
|
2022-10-14 04:42:19 +03:00
|
|
|
outstanding=(map [wire duct] (qeu remote-request-9))
|
2022-07-06 10:51:11 +03:00
|
|
|
contacts=(set ship)
|
|
|
|
eggs=(map term egg-8)
|
|
|
|
blocked=(map term (qeu blocked-move))
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ spore-7-to-8
|
|
|
|
|= old=spore-7
|
|
|
|
^- spore-8
|
|
|
|
:- %8
|
|
|
|
=. eggs.old
|
|
|
|
%- ~(urn by eggs.old)
|
|
|
|
|= [a=term e=egg-8]
|
|
|
|
:: kiln will kick off appropriate app revival
|
|
|
|
::
|
|
|
|
e(old-state [%| p.old-state.e])
|
|
|
|
+>.old
|
|
|
|
::
|
2022-09-02 06:03:17 +03:00
|
|
|
++ spore-8-to-9
|
|
|
|
|= old=spore-8
|
|
|
|
^- spore-9
|
|
|
|
=- old(- %9, eggs -, blocked [blocked.old *bug])
|
|
|
|
%- ~(run by eggs.old)
|
|
|
|
|= =egg-8
|
2022-10-14 04:42:19 +03:00
|
|
|
^- egg-10
|
2022-09-02 06:03:17 +03:00
|
|
|
=/ [=bitt =boat =boar] (watches-8-to-9 watches.egg-8)
|
|
|
|
:* control-duct.egg-8
|
|
|
|
run-nonce.egg-8
|
|
|
|
sub-nonce=1
|
|
|
|
live.egg-8
|
|
|
|
stats.egg-8
|
|
|
|
bitt boat boar
|
|
|
|
[old-state beak marks]:egg-8
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ watches-8-to-9
|
|
|
|
|= watches-8
|
|
|
|
^- [bitt boat boar]
|
|
|
|
[inbound outbound (~(run by outbound) |=([acked=? =path] nonce=0))]
|
|
|
|
::
|
2022-10-14 04:42:19 +03:00
|
|
|
:: remove %cork
|
|
|
|
::
|
|
|
|
++ spore-9-to-10
|
|
|
|
|= old=spore-9
|
|
|
|
=- old(- %10, outstanding -)
|
|
|
|
%- ~(run by outstanding.old)
|
|
|
|
|= q=(qeu remote-request-9)
|
|
|
|
%- ~(gas to *(qeu remote-request))
|
|
|
|
%+ murn ~(tap to q)
|
|
|
|
|=(r=remote-request-9 ?:(?=(%cork r) ~ `r))
|
|
|
|
::
|
2023-03-12 03:35:55 +03:00
|
|
|
:: added sky
|
|
|
|
::
|
|
|
|
++ spore-11-to-12
|
|
|
|
|= old=spore-11
|
|
|
|
^- spore
|
|
|
|
%= old
|
|
|
|
- %12
|
|
|
|
eggs
|
|
|
|
%- ~(urn by eggs.old)
|
|
|
|
|= [a=term e=egg-11]
|
|
|
|
^- egg
|
2023-03-29 21:28:36 +03:00
|
|
|
live/e(marks [marks.e sky:*$>(%live egg)])
|
2023-03-12 03:35:55 +03:00
|
|
|
==
|
|
|
|
::
|
2022-07-06 10:51:11 +03:00
|
|
|
:: removed live
|
|
|
|
:: changed old-state from (each vase vase) to [%| vase]
|
2022-07-07 10:12:27 +03:00
|
|
|
:: added code
|
2022-07-06 10:51:11 +03:00
|
|
|
::
|
2022-10-14 04:42:19 +03:00
|
|
|
++ spore-10-to-11
|
|
|
|
|= old=spore-10
|
2023-03-12 03:35:55 +03:00
|
|
|
^- spore-11
|
2022-07-06 10:51:11 +03:00
|
|
|
%= old
|
2022-10-14 04:42:19 +03:00
|
|
|
- %11
|
2022-07-06 10:51:11 +03:00
|
|
|
eggs
|
|
|
|
%- ~(urn by eggs.old)
|
2022-10-14 04:42:19 +03:00
|
|
|
|= [a=term e=egg-10]
|
2023-03-12 03:35:55 +03:00
|
|
|
^- egg-11
|
2022-09-02 06:03:17 +03:00
|
|
|
e(|3 |4.e(|4 `|8.e(old-state [%| p.old-state.e])))
|
2022-07-06 10:51:11 +03:00
|
|
|
==
|
|
|
|
--
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +scry: standard scry
|
|
|
|
::
|
|
|
|
++ scry
|
2019-11-19 07:36:21 +03:00
|
|
|
~/ %gall-scry
|
2020-12-08 00:52:12 +03:00
|
|
|
^- roon
|
|
|
|
|= [lyc=gang care=term bem=beam]
|
2019-08-29 21:44:37 +03:00
|
|
|
^- (unit (unit cage))
|
2020-11-24 00:06:50 +03:00
|
|
|
=/ =shop &/p.bem
|
|
|
|
=* dap q.bem
|
|
|
|
=/ =coin $/r.bem
|
|
|
|
=* path s.bem
|
|
|
|
::
|
2023-03-12 03:35:55 +03:00
|
|
|
?: ?=(%a care)
|
|
|
|
?. =(p.bem our) ~
|
2023-03-29 21:28:36 +03:00
|
|
|
?~ yok=(~(get by yokes.state) q.bem) ~
|
|
|
|
?: ?=(%nuke -.u.yok) ~
|
2023-03-12 03:35:55 +03:00
|
|
|
=/ ski (~(get by sky.u.yok) s.bem)
|
|
|
|
?~ ski ~
|
2023-03-28 19:34:35 +03:00
|
|
|
=/ res=(unit (each noun @uvI))
|
|
|
|
?+ -.r.bem ~
|
|
|
|
%ud (get:on-path fan.u.ski p.r.bem)
|
2023-03-29 17:15:00 +03:00
|
|
|
%da ?.(=(p.r.bem now) ~ (bind (ram:on-path fan.u.ski) tail))
|
2023-03-28 19:34:35 +03:00
|
|
|
==
|
|
|
|
?. ?=([~ %& *] res) ~
|
|
|
|
``[%noun %noun p.u.res]
|
2023-03-12 03:35:55 +03:00
|
|
|
::
|
2019-08-29 21:44:37 +03:00
|
|
|
?. ?=(%.y -.shop)
|
|
|
|
~
|
|
|
|
=/ =ship p.shop
|
2023-03-30 14:41:40 +03:00
|
|
|
?: ?& =(%z care)
|
|
|
|
=(our ship)
|
|
|
|
==
|
|
|
|
=/ yok (~(get by yokes.state) q.bem)
|
|
|
|
?. ?=([~ %live *] yok) ~
|
|
|
|
?~ ski=(~(get by sky.u.yok) s.bem) ~
|
|
|
|
=/ res=(unit (each noun @uvI))
|
|
|
|
?+ -.r.bem ~
|
|
|
|
%ud (get:on-path fan.u.ski p.r.bem)
|
|
|
|
%da ?.(=(p.r.bem now) ~ (bind (ram:on-path fan.u.ski) tail))
|
|
|
|
==
|
|
|
|
?+ res ~
|
|
|
|
[~ %| *] ``noun/!>(p.u.res)
|
|
|
|
[~ %& *] ``noun/!>(`@uvI`(shax (jam p.u.res)))
|
|
|
|
==
|
|
|
|
::
|
2020-05-07 11:51:08 +03:00
|
|
|
?: &(=(care %$) =(path /whey))
|
|
|
|
=/ blocked
|
|
|
|
=/ queued (~(run by blocked.state) |=((qeu blocked-move) [%.y +<]))
|
|
|
|
(sort ~(tap by queued) aor)
|
|
|
|
::
|
|
|
|
=/ running
|
2022-02-22 21:07:01 +03:00
|
|
|
%+ turn (sort ~(tap by yokes.state) aor)
|
|
|
|
|= [dap=term =yoke]
|
|
|
|
^- mass
|
|
|
|
=/ met=(list mass)
|
2022-02-23 08:14:44 +03:00
|
|
|
=/ dat (mo-peek:mo | dap [~ ship] %x /whey/mass)
|
2022-02-22 21:07:01 +03:00
|
|
|
?: ?=(?(~ [~ ~]) dat) ~
|
|
|
|
(fall ((soft (list mass)) q.q.u.u.dat) ~)
|
|
|
|
?~ met
|
|
|
|
dap^&+yoke
|
|
|
|
dap^|+(welp met dot+&+yoke ~)
|
2020-05-07 11:51:08 +03:00
|
|
|
::
|
|
|
|
=/ maz=(list mass)
|
|
|
|
:~ [%foreign %.y contacts.state]
|
|
|
|
[%blocked %.n blocked]
|
|
|
|
[%active %.n running]
|
|
|
|
==
|
|
|
|
``mass+!>(maz)
|
|
|
|
::
|
2020-04-22 08:37:12 +03:00
|
|
|
?: ?& =(%u care)
|
2019-08-29 21:44:37 +03:00
|
|
|
=(~ path)
|
|
|
|
=([%$ %da now] coin)
|
|
|
|
=(our ship)
|
|
|
|
==
|
2021-09-27 23:22:52 +03:00
|
|
|
=; hav=?
|
|
|
|
[~ ~ noun+!>(hav)]
|
|
|
|
=/ yok=(unit yoke) (~(get by yokes.state) dap)
|
2023-03-29 21:28:36 +03:00
|
|
|
&(?=([~ %live *] yok) -.agent.u.yok)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2021-06-19 05:13:55 +03:00
|
|
|
?: ?& =(%d care)
|
|
|
|
=(~ path)
|
|
|
|
=([%$ %da now] coin)
|
|
|
|
=(our ship)
|
|
|
|
==
|
|
|
|
=/ yok=(unit yoke) (~(get by yokes.state) dap)
|
2023-03-29 21:28:36 +03:00
|
|
|
?. ?=([~ %live *] yok)
|
2021-06-19 05:13:55 +03:00
|
|
|
[~ ~]
|
|
|
|
[~ ~ desk+!>(q.beak.u.yok)]
|
|
|
|
::
|
2021-07-02 03:33:43 +03:00
|
|
|
?: ?& =(%e care)
|
|
|
|
=(~ path)
|
|
|
|
=([%$ %da now] coin)
|
|
|
|
=(our ship)
|
|
|
|
==
|
|
|
|
:+ ~ ~
|
2021-07-19 16:58:18 +03:00
|
|
|
:- %apps !> ^- (set [=dude live=?])
|
2021-07-02 03:33:43 +03:00
|
|
|
=* syd=desk dap
|
|
|
|
%+ roll ~(tap by yokes.state)
|
2021-07-19 16:58:18 +03:00
|
|
|
|= [[=dude =yoke] acc=(set [=dude live=?])]
|
2023-03-29 21:28:36 +03:00
|
|
|
?. ?& ?=(%live -.yoke)
|
|
|
|
=(syd q.beak.yoke)
|
|
|
|
==
|
2021-07-02 03:33:43 +03:00
|
|
|
acc
|
2021-07-19 16:58:18 +03:00
|
|
|
(~(put in acc) [dude -.agent.yoke])
|
2021-07-02 03:33:43 +03:00
|
|
|
::
|
2022-08-11 22:33:57 +03:00
|
|
|
?: ?& =(%f care)
|
|
|
|
=(~ path)
|
|
|
|
=([%$ %da now] coin)
|
|
|
|
=(our ship)
|
|
|
|
==
|
|
|
|
:+ ~ ~
|
|
|
|
:- %nonces !> ^- (map dude @)
|
2023-03-29 21:28:36 +03:00
|
|
|
%- malt %+ murn ~(tap by yokes.state)
|
|
|
|
|= [=dude =yoke]
|
|
|
|
?: ?=(%nuke -.yoke) ~ `[dude sub-nonce.yoke]
|
2022-08-11 22:33:57 +03:00
|
|
|
::
|
2022-05-16 11:27:36 +03:00
|
|
|
?: ?& =(%n care)
|
|
|
|
?=([@ @ ^] path)
|
|
|
|
=([%$ %da now] coin)
|
|
|
|
=(our ship)
|
|
|
|
==
|
2023-03-29 21:28:36 +03:00
|
|
|
=/ yok (~(get by yokes.state) dap)
|
|
|
|
?. ?=([~ %live *] yok)
|
2022-05-16 11:27:36 +03:00
|
|
|
[~ ~]
|
|
|
|
=/ [=^ship =term =wire]
|
|
|
|
[(slav %p i.path) i.t.path t.t.path]
|
2022-05-18 16:27:17 +03:00
|
|
|
?~ nonce=(~(get by boar.u.yok) [wire ship term])
|
2022-05-16 11:27:36 +03:00
|
|
|
[~ ~]
|
|
|
|
[~ ~ atom+!>(u.nonce)]
|
|
|
|
::
|
2023-03-29 18:18:43 +03:00
|
|
|
?: ?& =(%w care)
|
|
|
|
=([%$ %da now] coin)
|
|
|
|
=(our ship)
|
|
|
|
==
|
2023-03-29 21:28:36 +03:00
|
|
|
=/ yok (~(get by yokes.state) q.bem)
|
|
|
|
?. ?=([~ %live *] yok) [~ ~]
|
|
|
|
?~ ski=(~(get by sky.u.yok) s.bem) [~ ~]
|
|
|
|
?~ lat=(ram:on-path fan.u.ski) [~ ~]
|
2023-03-28 22:45:14 +03:00
|
|
|
``case/!>(ud/key.u.lat)
|
|
|
|
::
|
2019-08-29 21:44:37 +03:00
|
|
|
?. =(our ship)
|
|
|
|
~
|
|
|
|
?. =([%$ %da now] coin)
|
|
|
|
~
|
2020-04-22 08:37:12 +03:00
|
|
|
?. (~(has by yokes.state) dap)
|
|
|
|
[~ ~]
|
2019-08-29 21:44:37 +03:00
|
|
|
?. ?=(^ path)
|
|
|
|
~
|
|
|
|
=/ =routes [~ ship]
|
2022-02-23 08:15:37 +03:00
|
|
|
(mo-peek:mo & dap routes care path)
|
2021-07-15 09:51:03 +03:00
|
|
|
:: +stay: save without cache; suspend non-%base agents
|
|
|
|
::
|
|
|
|
:: TODO: superfluous? see +molt
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2020-05-14 14:24:44 +03:00
|
|
|
++ stay
|
|
|
|
^- spore
|
2021-09-22 23:34:20 +03:00
|
|
|
=; eggs=(map term egg) state(yokes eggs)
|
2020-05-14 14:24:44 +03:00
|
|
|
%- ~(run by yokes.state)
|
2020-11-19 07:12:29 +03:00
|
|
|
|= =yoke
|
2020-11-17 23:53:05 +03:00
|
|
|
^- egg
|
2023-03-29 21:28:36 +03:00
|
|
|
?: ?=(%nuke -.yoke) yoke
|
2020-11-17 23:53:05 +03:00
|
|
|
%= yoke
|
2022-07-07 10:12:27 +03:00
|
|
|
code ~
|
2020-11-17 23:53:05 +03:00
|
|
|
agent
|
2022-07-06 10:51:11 +03:00
|
|
|
:- %|
|
2021-07-15 09:51:03 +03:00
|
|
|
?: ?=(%| -.agent.yoke)
|
2022-07-06 10:51:11 +03:00
|
|
|
p.agent.yoke
|
|
|
|
on-save:p.agent.yoke
|
2020-11-17 23:53:05 +03:00
|
|
|
==
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +take: response
|
|
|
|
::
|
|
|
|
++ take
|
2019-11-19 07:36:21 +03:00
|
|
|
~/ %gall-take
|
2020-12-06 11:38:37 +03:00
|
|
|
|= [=wire =duct dud=(unit goof) syn=sign-arvo]
|
2019-11-19 07:36:21 +03:00
|
|
|
^- [(list move) _gall-payload]
|
2020-02-25 01:10:59 +03:00
|
|
|
?^ dud
|
2020-04-24 07:13:19 +03:00
|
|
|
~&(%gall-take-dud ((slog tang.u.dud) [~ gall-payload]))
|
2020-04-30 11:15:28 +03:00
|
|
|
?: =(/nowhere wire)
|
|
|
|
[~ gall-payload]
|
2021-07-21 11:55:21 +03:00
|
|
|
?: =(/clear-huck wire)
|
|
|
|
=/ =gift ?>(?=([%behn %heck %gall *] syn) +>+.syn)
|
|
|
|
[[duct %give gift]~ gall-payload]
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-11-19 07:36:21 +03:00
|
|
|
~| [%gall-take-failed wire]
|
2019-08-29 21:44:37 +03:00
|
|
|
?> ?=([?(%sys %use) *] wire)
|
2020-07-08 09:08:27 +03:00
|
|
|
=< mo-abet
|
2020-12-08 03:22:26 +03:00
|
|
|
%. [t.wire ?:(?=([%behn %heck *] syn) syn.syn syn)]
|
2020-07-08 09:08:27 +03:00
|
|
|
?- i.wire
|
|
|
|
%sys mo-handle-sys:(mo-abed:mo duct)
|
|
|
|
%use mo-handle-use:(mo-abed:mo duct)
|
|
|
|
==
|
2019-08-29 21:44:37 +03:00
|
|
|
--
|