2019-09-04 22:48:36 +03:00
|
|
|
!: :: %mall, agent execution
|
2019-08-29 21:44:37 +03:00
|
|
|
!? 163
|
|
|
|
!:
|
|
|
|
::::
|
|
|
|
|= pit=vase
|
2019-09-04 22:48:36 +03:00
|
|
|
=, mall
|
2019-08-29 21:44:37 +03:00
|
|
|
=> =~
|
|
|
|
|%
|
|
|
|
:: +reverse-ames: reverse ames message
|
|
|
|
::
|
|
|
|
++ reverse-ames
|
|
|
|
$% :: diff
|
|
|
|
::
|
|
|
|
[%d p=mark q=*]
|
|
|
|
:: etc.
|
|
|
|
::
|
|
|
|
[%x ~]
|
|
|
|
==
|
|
|
|
:: +forward-ames: forward ames message
|
|
|
|
::
|
|
|
|
++ forward-ames
|
|
|
|
$% :: message
|
|
|
|
::
|
|
|
|
[%m =mark noun=*]
|
|
|
|
:: "peel" subscribe
|
|
|
|
::
|
|
|
|
[%l =mark =path]
|
|
|
|
:: subscribe
|
|
|
|
::
|
|
|
|
[%s =path]
|
|
|
|
:: cancel+unsubscribe
|
|
|
|
::
|
|
|
|
[%u ~]
|
|
|
|
==
|
|
|
|
:: +foreign-response: foreign response
|
|
|
|
::
|
|
|
|
++ foreign-response
|
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
|
2019-08-29 21:44:37 +03:00
|
|
|
==
|
|
|
|
--
|
|
|
|
|%
|
|
|
|
:: +move: Arvo-level move
|
|
|
|
::
|
|
|
|
++ move
|
|
|
|
$: =duct
|
|
|
|
move=(wind note-arvo gift-arvo)
|
|
|
|
==
|
|
|
|
--
|
|
|
|
|%
|
|
|
|
:: +state-old: upgrade path
|
|
|
|
::
|
|
|
|
++ state-old ?(state)
|
|
|
|
:: +state: all state
|
|
|
|
::
|
|
|
|
++ state
|
|
|
|
$: :: state version
|
|
|
|
::
|
2019-11-05 07:19:08 +03:00
|
|
|
%1
|
2019-08-29 21:44:37 +03:00
|
|
|
:: agents by ship
|
|
|
|
::
|
|
|
|
=agents
|
|
|
|
==
|
|
|
|
:: +subscribers: subscriber data
|
|
|
|
::
|
|
|
|
++ subscribers
|
|
|
|
$: :: incoming subscribers
|
|
|
|
::
|
|
|
|
incoming=bitt
|
|
|
|
:: outgoing subscribers
|
|
|
|
::
|
|
|
|
outgoing=boat
|
|
|
|
:: queue meter
|
|
|
|
::
|
2019-09-12 05:55:31 +03:00
|
|
|
meter=(map duct @ud)
|
2019-08-29 21:44:37 +03:00
|
|
|
==
|
|
|
|
:: +agents: ship state
|
|
|
|
::
|
|
|
|
++ agents
|
|
|
|
$: :: system duct
|
|
|
|
::
|
|
|
|
system-duct=duct
|
|
|
|
:: foreign contacts
|
|
|
|
::
|
|
|
|
contacts=(map ship foreign)
|
|
|
|
:: running agents
|
|
|
|
::
|
|
|
|
running=(map term running-agent)
|
|
|
|
:: waiting queue
|
|
|
|
::
|
|
|
|
blocked=(map term blocked)
|
|
|
|
==
|
|
|
|
:: +routes: new cuff
|
|
|
|
::
|
|
|
|
++ routes
|
|
|
|
$: :: disclosing to
|
|
|
|
::
|
|
|
|
disclosing=(unit (set ship))
|
|
|
|
:: attributed to
|
|
|
|
::
|
|
|
|
attributing=ship
|
|
|
|
==
|
|
|
|
:: +foreign: foreign connections
|
|
|
|
::
|
|
|
|
++ foreign
|
|
|
|
$: :: index
|
|
|
|
::
|
|
|
|
index=@ud
|
|
|
|
:: by duct
|
|
|
|
::
|
|
|
|
index-map=(map duct @ud)
|
|
|
|
:: by index
|
|
|
|
::
|
|
|
|
duct-map=(map @ud duct)
|
|
|
|
==
|
|
|
|
:: +running-agent: agent state
|
|
|
|
::
|
|
|
|
++ running-agent
|
|
|
|
$: :: cache
|
|
|
|
::
|
|
|
|
cache=worm
|
|
|
|
:: control duct
|
|
|
|
::
|
|
|
|
control-duct=duct
|
|
|
|
:: unstopped
|
|
|
|
::
|
|
|
|
live=?
|
|
|
|
:: statistics
|
|
|
|
::
|
|
|
|
=stats
|
|
|
|
:: subscribers
|
|
|
|
::
|
|
|
|
=subscribers
|
|
|
|
:: agent core
|
|
|
|
::
|
|
|
|
=agent
|
|
|
|
:: update control
|
|
|
|
::
|
|
|
|
=beak
|
|
|
|
:: req'd translations
|
|
|
|
::
|
2019-09-12 05:55:31 +03:00
|
|
|
marks=(map duct mark)
|
2019-08-29 21:44:37 +03:00
|
|
|
==
|
|
|
|
:: +blocked: blocked tasks
|
|
|
|
::
|
2019-11-09 04:26:47 +03:00
|
|
|
++ blocked (qeu (trel duct routes deal))
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +stats: statistics
|
|
|
|
::
|
|
|
|
++ stats
|
|
|
|
$: :: change number
|
|
|
|
::
|
|
|
|
change=@ud
|
|
|
|
:: entropy
|
|
|
|
::
|
|
|
|
eny=@uvJ
|
|
|
|
:: time
|
|
|
|
::
|
|
|
|
time=@da
|
|
|
|
==
|
|
|
|
--
|
|
|
|
. ==
|
|
|
|
=| =state
|
|
|
|
|= $: :: identity
|
|
|
|
::
|
|
|
|
our=ship
|
|
|
|
:: urban time
|
|
|
|
::
|
|
|
|
now=@da
|
|
|
|
:: entropy
|
|
|
|
::
|
|
|
|
eny=@uvJ
|
|
|
|
:: activate
|
|
|
|
::
|
|
|
|
ska=sley
|
|
|
|
==
|
2019-09-04 22:48:36 +03:00
|
|
|
~% %mall-top ..is ~
|
2019-08-29 21:44:37 +03:00
|
|
|
|%
|
2019-09-04 22:48:36 +03:00
|
|
|
:: +mall-payload: mall payload
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-09-04 22:48:36 +03:00
|
|
|
++ mall-payload +
|
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-09-04 22:48:36 +03:00
|
|
|
~% %mall-mo +> ~
|
2019-08-29 21:44:37 +03:00
|
|
|
|_
|
|
|
|
$: hen=duct
|
|
|
|
moves=(list move)
|
|
|
|
==
|
|
|
|
++ mo-core .
|
|
|
|
:: +mo-abed: initialise state with the provided duct.
|
|
|
|
::
|
|
|
|
++ mo-abed
|
|
|
|
|= =duct
|
|
|
|
^+ mo-core
|
|
|
|
::
|
|
|
|
mo-core(hen duct)
|
|
|
|
:: +mo-abet: resolve moves.
|
|
|
|
::
|
|
|
|
++ mo-abet
|
2019-09-04 22:48:36 +03:00
|
|
|
^- [(list move) _mall-payload]
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
=/ resolved (flop moves)
|
2019-09-04 22:48:36 +03:00
|
|
|
[resolved mall-payload]
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
:: +mo-boot: ask %ford to build us a core for the specified agent.
|
|
|
|
::
|
|
|
|
++ mo-boot
|
|
|
|
|= [=term =ship =desk]
|
|
|
|
^+ mo-core
|
|
|
|
::
|
|
|
|
=/ =case [%da now]
|
|
|
|
=/ =path
|
|
|
|
=/ ship (scot %p ship)
|
|
|
|
=/ case (scot case)
|
|
|
|
/sys/core/[term]/[ship]/[desk]/[case]
|
|
|
|
::
|
|
|
|
=/ =note-arvo
|
2019-09-04 22:48:36 +03:00
|
|
|
=/ =schematic:ford [%core [ship desk] /hoon/[term]/age]
|
2019-08-29 21:44:37 +03:00
|
|
|
[%f %build live=%.y schematic]
|
|
|
|
::
|
|
|
|
=/ pass [path note-arvo]
|
|
|
|
(mo-pass pass)
|
|
|
|
::
|
2019-11-10 03:47:41 +03:00
|
|
|
:: +mo-reboot: ask %ford to rebuild the specified agent
|
|
|
|
::
|
|
|
|
++ mo-reboot
|
|
|
|
|= [force=? =term =ship]
|
|
|
|
^+ mo-core
|
|
|
|
=/ gent (~(got by running.agents.state) term)
|
|
|
|
=. hen control-duct.gent
|
|
|
|
=* desk q.beak.gent
|
|
|
|
:: if we're forcing a reboot, we don't try to %kill the old build
|
|
|
|
::
|
|
|
|
?: force
|
|
|
|
(mo-boot term ship desk)
|
|
|
|
::
|
|
|
|
=/ =wire
|
|
|
|
=/ ship (scot %p ship)
|
|
|
|
=/ case (scot r.beak.gent)
|
|
|
|
/sys/core/[term]/[ship]/[desk]/[case]
|
|
|
|
%. [term ship desk]
|
|
|
|
=< mo-boot
|
|
|
|
=/ =note-arvo [%f %kill ~]
|
|
|
|
(mo-pass wire note-arvo)
|
|
|
|
::
|
|
|
|
::
|
|
|
|
:: +mo-goad: rebuild agent(s)
|
|
|
|
::
|
|
|
|
++ mo-goad
|
|
|
|
|= [force=? agent=(unit dude)]
|
|
|
|
^+ mo-core
|
|
|
|
?^ agent
|
|
|
|
~| goad-gone+u.agent
|
|
|
|
(mo-reboot force u.agent our)
|
|
|
|
::
|
|
|
|
=/ agents=(list term)
|
|
|
|
~(tap in ~(key by running.agents.state))
|
|
|
|
|- ^+ mo-core
|
|
|
|
?~ agents
|
|
|
|
mo-core
|
|
|
|
%= $
|
|
|
|
agents t.agents
|
|
|
|
..mo-core (mo-reboot force i.agents our)
|
|
|
|
==
|
|
|
|
::
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +mo-pass: prepend a standard %pass to the current list of moves.
|
|
|
|
::
|
|
|
|
++ mo-pass
|
|
|
|
|= pass=(pair path note-arvo)
|
|
|
|
^+ mo-core
|
|
|
|
::
|
|
|
|
=/ =move [hen [%pass pass]]
|
|
|
|
mo-core(moves [move moves])
|
|
|
|
:: +mo-give: prepend a standard %give to the current list of moves.
|
|
|
|
::
|
|
|
|
++ mo-give
|
|
|
|
|= =gift:able
|
|
|
|
^+ mo-core
|
|
|
|
::
|
|
|
|
=/ =move [hen [%give gift]]
|
|
|
|
mo-core(moves [move moves])
|
|
|
|
:: +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-09-04 22:48:36 +03:00
|
|
|
:: is already running. If so, we update its beak in %mall'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-09-04 22:48:36 +03:00
|
|
|
:: got from %ford, add it to the collection of agents %mall 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
|
|
|
|
|= [=term =beak =made-result:ford]
|
|
|
|
^+ mo-core
|
|
|
|
::
|
|
|
|
?: ?=([%incomplete *] made-result)
|
|
|
|
(mo-give %onto %.n tang.made-result)
|
|
|
|
::
|
|
|
|
=/ build-result build-result.made-result
|
|
|
|
::
|
|
|
|
?: ?=([%error *] build-result)
|
|
|
|
(mo-give %onto %.n message.build-result)
|
|
|
|
::
|
|
|
|
=/ =cage (result-to-cage:ford build-result)
|
|
|
|
=/ result-vase q.cage
|
|
|
|
=/ maybe-agent=(unit running-agent)
|
|
|
|
(~(get by running.agents.state) term)
|
|
|
|
::
|
|
|
|
?^ maybe-agent
|
|
|
|
=/ agent u.maybe-agent(beak beak)
|
|
|
|
=. running.agents.state
|
|
|
|
(~(put by running.agents.state) term agent)
|
|
|
|
=/ =routes [disclosing=~ attributing=our]
|
|
|
|
=/ app (ap-abed:ap term routes)
|
|
|
|
=. app (ap-reinstall:app result-vase)
|
|
|
|
ap-abet:app
|
|
|
|
::
|
2019-09-24 01:44:48 +03:00
|
|
|
=/ maybe-new-agent (mule |.(!<(agent result-vase)))
|
|
|
|
?: ?=(%| -.maybe-new-agent)
|
|
|
|
=/ err [[%leaf "{<term>}: not valid agent"] p.maybe-new-agent]
|
2019-08-29 21:44:37 +03:00
|
|
|
(mo-give %onto %.n err)
|
2019-09-24 01:44:48 +03:00
|
|
|
=. mo-core (mo-new-agent term beak p.maybe-new-agent)
|
2019-08-29 21:44:37 +03:00
|
|
|
=/ old mo-core
|
|
|
|
=/ wag
|
|
|
|
=/ =routes [disclosing=~ attributing=our]
|
|
|
|
=/ app (ap-abed:ap term routes)
|
2019-09-12 05:55:31 +03:00
|
|
|
(ap-upgrade-state:app ~)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
=/ maybe-tang -.wag
|
|
|
|
=/ app +.wag
|
|
|
|
?^ maybe-tang
|
|
|
|
=. mo-core old
|
|
|
|
(mo-give %onto %.n u.maybe-tang)
|
|
|
|
::
|
|
|
|
=. mo-core ap-abet:app
|
|
|
|
=. mo-core (mo-clear-queue term)
|
|
|
|
=/ =suss [term %boot now]
|
|
|
|
(mo-give %onto [%.y suss])
|
2019-09-04 22:48:36 +03:00
|
|
|
:: +mo-new-agent: create a new agent and add it to %mall's state.
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-09-04 22:48:36 +03:00
|
|
|
:: %mall maintains a collection of running agents. This arm creates a
|
2019-08-29 21:44:37 +03:00
|
|
|
:: new one with the provided name, beak, and state (held in a vase).
|
|
|
|
::
|
|
|
|
++ mo-new-agent
|
2019-08-29 22:57:33 +03:00
|
|
|
|= [=term =beak =agent]
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ mo-core
|
|
|
|
::
|
|
|
|
=/ running-agent
|
|
|
|
=/ default-agent *running-agent
|
|
|
|
%_ default-agent
|
|
|
|
control-duct hen
|
|
|
|
beak beak
|
2019-08-29 22:57:33 +03:00
|
|
|
agent agent
|
2019-08-29 21:44:37 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
%_ mo-core
|
2019-09-04 22:48:36 +03:00
|
|
|
running.agents.state (~(put by running.agents.state) term running-agent)
|
2019-08-29 21:44:37 +03:00
|
|
|
==
|
|
|
|
:: +mo-handle-foreign-request: handle a foreign request.
|
|
|
|
::
|
|
|
|
:: Handles tasks received on a +call that have come from another ship.
|
|
|
|
::
|
|
|
|
++ mo-handle-foreign-request
|
|
|
|
~/ %mo-handle-foreign-request
|
2019-11-09 04:26:47 +03:00
|
|
|
|= [=ship =term =deal]
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ mo-core
|
|
|
|
::
|
2019-11-09 04:26:47 +03:00
|
|
|
?: ?=(%pump -.deal)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-09-12 05:55:31 +03:00
|
|
|
:: you'd think this would send an ack for the diff that caused
|
|
|
|
:: this pump. it would, but we already sent it when we got the
|
|
|
|
:: diff in +mo-handle-sys. then we'd have to save the network
|
|
|
|
:: duct and connect it to this returning pump.
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
mo-core
|
|
|
|
::
|
|
|
|
=^ bone mo-core (mo-assign-bone ship)
|
|
|
|
=/ =forward-ames
|
2019-11-09 04:26:47 +03:00
|
|
|
?- -.deal
|
|
|
|
%poke [%m p.cage.deal q.q.cage.deal]
|
|
|
|
%leave [%u ~]
|
|
|
|
%raw-poke !!
|
|
|
|
%poke-as !!
|
|
|
|
%watch-as [%l deal]
|
|
|
|
%watch [%s path.deal]
|
2019-08-29 21:44:37 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
=/ sys-path
|
2019-11-09 04:26:47 +03:00
|
|
|
=/ action -.deal
|
2019-08-29 21:44:37 +03:00
|
|
|
/sys/way/[action]
|
|
|
|
::
|
|
|
|
=/ =note-arvo
|
2019-09-12 22:57:37 +03:00
|
|
|
=/ =path /m/ge/[term]
|
2019-08-29 21:44:37 +03:00
|
|
|
=/ =noun [bone forward-ames]
|
|
|
|
[%a %want ship path noun]
|
|
|
|
::
|
|
|
|
(mo-pass sys-path note-arvo)
|
|
|
|
:: +mo-handle-foreign-response: handle foreign response.
|
|
|
|
::
|
|
|
|
:: Handle a received %woot from %ames.
|
|
|
|
::
|
|
|
|
++ mo-handle-foreign-response
|
|
|
|
|= [=foreign-response art=(unit ares)]
|
|
|
|
^+ mo-core
|
|
|
|
::
|
|
|
|
=/ to-tang
|
|
|
|
|= =ares
|
|
|
|
^- tang
|
|
|
|
?~ ares
|
|
|
|
~
|
|
|
|
=/ tape (trip p.u.ares)
|
|
|
|
[[%leaf tape] q.u.ares]
|
|
|
|
::
|
|
|
|
=/ result (bind art to-tang)
|
|
|
|
?- foreign-response
|
2019-11-09 04:26:47 +03:00
|
|
|
%watch-as (mo-give %unto %watch-ack result)
|
|
|
|
%watch (mo-give %unto %watch-ack result)
|
|
|
|
%poke (mo-give %unto %poke-ack result)
|
|
|
|
%leave mo-core
|
2019-08-29 21:44:37 +03:00
|
|
|
==
|
|
|
|
:: +mo-assign-bone: assign an outbone to a ship.
|
|
|
|
::
|
|
|
|
:: If we know about the ship, we simply use its existing bone. Otherwise
|
|
|
|
:: we register a new entry for the ship, and use a default bone for it.
|
|
|
|
::
|
|
|
|
++ mo-assign-bone
|
|
|
|
|= =ship
|
|
|
|
^- [bone _mo-core]
|
|
|
|
::
|
2019-11-05 07:19:08 +03:00
|
|
|
=? mo-core !(~(has by contacts.agents.state) ship)
|
|
|
|
=/ =note-arvo [%j %public-keys (silt ship ~)]
|
|
|
|
=. moves [[system-duct.agents.state %pass /sys/jael note-arvo] moves]
|
|
|
|
=/ =foreign [1 ~ ~]
|
|
|
|
=. contacts.agents.state
|
|
|
|
(~(put by contacts.agents.state) ship foreign)
|
|
|
|
mo-core
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-11-05 07:19:08 +03:00
|
|
|
=/ =foreign (~(got by contacts.agents.state) ship)
|
2019-08-29 21:44:37 +03:00
|
|
|
=/ existing (~(get by index-map.foreign) hen)
|
|
|
|
?^ existing
|
|
|
|
[u.existing mo-core]
|
|
|
|
::
|
|
|
|
=/ index index.foreign
|
|
|
|
=/ contacts
|
|
|
|
=/ new-foreign
|
|
|
|
%_ foreign
|
|
|
|
index +(index)
|
|
|
|
index-map (~(put by index-map.foreign) hen index)
|
|
|
|
duct-map (~(put by duct-map.foreign) index hen)
|
|
|
|
==
|
|
|
|
(~(put by contacts.agents.state) ship new-foreign)
|
|
|
|
::
|
|
|
|
=/ next mo-core(contacts.agents.state contacts)
|
|
|
|
[index next]
|
|
|
|
:: +mo-retrieve-duct: retrieve a duct by index.
|
|
|
|
::
|
|
|
|
++ mo-retrieve-duct
|
|
|
|
|= [=ship index=@ud]
|
2019-11-05 07:19:08 +03:00
|
|
|
^- (unit duct)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-11-05 07:19:08 +03:00
|
|
|
=/ contact=(unit foreign) (~(get by contacts.agents.state) ship)
|
|
|
|
?~ contact
|
|
|
|
~
|
|
|
|
`(~(got by duct-map.u.contact) index)
|
|
|
|
:: +mo-cancel-jael: cancel jael subscription
|
|
|
|
::
|
|
|
|
++ mo-cancel-jael
|
|
|
|
|= =ship
|
|
|
|
^+ mo-core
|
|
|
|
=/ =note-arvo [%j %nuke (silt ship ~)]
|
|
|
|
=. moves
|
|
|
|
[[system-duct.agents.state %pass /sys/jael note-arvo] moves]
|
|
|
|
mo-core
|
|
|
|
:: +mo-breach: ship breached, so forget about them
|
|
|
|
::
|
|
|
|
++ mo-breach
|
|
|
|
|= =ship
|
|
|
|
^+ mo-core
|
|
|
|
=/ agents=(list [name=term =running-agent]) ~(tap by running.agents.state)
|
|
|
|
|- ^+ 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)
|
|
|
|
=. mo-core (mo-cancel-jael ship)
|
|
|
|
=. contacts.agents.state (~(del by contacts.agents.state) 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
|
|
|
|
|= [=path =sign-arvo]
|
|
|
|
^+ mo-core
|
|
|
|
::
|
|
|
|
?+ -.path !!
|
2019-11-05 07:19:08 +03:00
|
|
|
%jael (mo-handle-sys-jael path sign-arvo)
|
2019-08-29 21:44:37 +03:00
|
|
|
%core (mo-handle-sys-core path sign-arvo)
|
|
|
|
%pel (mo-handle-sys-pel path sign-arvo)
|
|
|
|
%red (mo-handle-sys-red path sign-arvo)
|
|
|
|
%rep (mo-handle-sys-rep path sign-arvo)
|
|
|
|
%req (mo-handle-sys-req path sign-arvo)
|
|
|
|
%val (mo-handle-sys-val path sign-arvo)
|
|
|
|
%way (mo-handle-sys-way path sign-arvo)
|
|
|
|
==
|
2019-11-05 07:19:08 +03:00
|
|
|
:: +mo-handle-sys-jael: receive update about contact
|
|
|
|
::
|
|
|
|
++ mo-handle-sys-jael
|
|
|
|
|= [=path =sign-arvo]
|
|
|
|
^+ mo-core
|
|
|
|
?> ?=([%j %public-keys *] sign-arvo)
|
|
|
|
?> ?=([%jael ~] path)
|
|
|
|
?. ?=(%breach -.public-keys-result.sign-arvo)
|
|
|
|
mo-core
|
|
|
|
(mo-breach who.public-keys-result.sign-arvo)
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +mo-handle-sys-core: receive a core from %ford.
|
|
|
|
::
|
|
|
|
++ mo-handle-sys-core
|
|
|
|
|= [=path =sign-arvo]
|
|
|
|
^+ mo-core
|
|
|
|
::
|
|
|
|
?> ?=([%f %made *] sign-arvo)
|
|
|
|
?> ?=([@ @ @ @ @ ~] path)
|
|
|
|
=/ beak-path t.t.path
|
|
|
|
=/ =beak
|
|
|
|
=/ =ship (slav %p i.beak-path)
|
|
|
|
=/ =desk i.t.beak-path
|
|
|
|
=/ =case [%da (slav %da i.t.t.beak-path)]
|
|
|
|
[ship desk case]
|
|
|
|
(mo-receive-core i.t.path beak result.sign-arvo)
|
|
|
|
:: +mo-handle-sys-pel: translated peer.
|
|
|
|
::
|
2019-09-12 05:55:31 +03:00
|
|
|
:: Validates a received %ford result and %gives an internal
|
2019-11-07 09:19:32 +03:00
|
|
|
:: %fact.
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
++ mo-handle-sys-pel
|
|
|
|
|= [=path =sign-arvo]
|
|
|
|
^+ mo-core
|
|
|
|
::
|
|
|
|
?> ?=([%f %made *] sign-arvo)
|
|
|
|
?> ?=([@ @ ~] path)
|
|
|
|
::
|
|
|
|
?: ?=([%incomplete *] result.sign-arvo)
|
|
|
|
=/ err (some tang.result.sign-arvo)
|
2019-09-12 05:55:31 +03:00
|
|
|
(mo-give %unto %poke-ack err)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
=/ build-result build-result.result.sign-arvo
|
|
|
|
::
|
|
|
|
?: ?=([%error *] build-result)
|
|
|
|
=/ err (some message.build-result)
|
2019-09-12 05:55:31 +03:00
|
|
|
(mo-give %unto %poke-ack err)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
=/ =cage (result-to-cage:ford build-result)
|
2019-11-09 04:26:47 +03:00
|
|
|
(mo-give %unto %fact cage)
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +mo-handle-sys-red: diff ack.
|
|
|
|
::
|
|
|
|
:: On receipt of a valid +sign from %ames, we simply pass a %pump
|
|
|
|
:: acknowledgement internally; otherwise we pass both an internal
|
2019-11-07 09:19:32 +03:00
|
|
|
:: unsubscribing %leave, plus a %want to %ames, before
|
2019-09-12 05:55:31 +03:00
|
|
|
:: complaining about a bad message acknowledgment.
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
++ mo-handle-sys-red
|
|
|
|
|= [=path =sign-arvo]
|
|
|
|
^+ mo-core
|
|
|
|
::
|
|
|
|
?> ?=([@ @ @ @ ~] path)
|
|
|
|
?. ?=([%a %woot *] sign-arvo)
|
|
|
|
~& [%red-want path]
|
|
|
|
mo-core
|
|
|
|
::
|
|
|
|
=/ him (slav %p i.t.path)
|
|
|
|
=/ dap i.t.t.path
|
|
|
|
=/ num (slav %ud i.t.t.t.path)
|
|
|
|
=/ =coop q.+>.sign-arvo
|
|
|
|
=/ sys-path
|
|
|
|
=/ pax [%req t.path]
|
|
|
|
[%sys pax]
|
|
|
|
::
|
|
|
|
?~ coop
|
|
|
|
=/ =note-arvo
|
|
|
|
=/ =sock [him our]
|
2019-11-09 04:26:47 +03:00
|
|
|
=/ =deal [%pump ~]
|
|
|
|
=/ =task:able [%deal sock dap deal]
|
2019-09-04 22:48:36 +03:00
|
|
|
[%m task]
|
2019-08-29 21:44:37 +03:00
|
|
|
(mo-pass sys-path note-arvo)
|
|
|
|
::
|
2019-09-04 22:48:36 +03:00
|
|
|
=/ mall-move=note-arvo
|
2019-08-29 21:44:37 +03:00
|
|
|
=/ =sock [him our]
|
2019-11-09 04:26:47 +03:00
|
|
|
=/ =deal [%leave ~]
|
|
|
|
=/ =task:able [%deal sock dap deal]
|
2019-09-04 22:48:36 +03:00
|
|
|
[%m task]
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
=/ ames-move=note-arvo
|
2019-09-04 22:48:36 +03:00
|
|
|
=/ path [%m %gh dap ~]
|
2019-08-29 21:44:37 +03:00
|
|
|
=/ =noun [num %x ~]
|
|
|
|
=/ =task:able:ames [%want him path noun]
|
|
|
|
[%a task]
|
|
|
|
::
|
2019-09-04 22:48:36 +03:00
|
|
|
=. mo-core (mo-pass sys-path mall-move)
|
2019-08-29 21:44:37 +03:00
|
|
|
=. mo-core (mo-pass sys-path ames-move)
|
|
|
|
::
|
|
|
|
?. ?=([~ ~ %mack *] coop)
|
|
|
|
~& [%diff-bad-ack coop]
|
|
|
|
mo-core
|
|
|
|
::
|
|
|
|
~& [%diff-bad-ack %mack]
|
|
|
|
=/ print (slog (flop q.,.+>.coop))
|
|
|
|
(print mo-core)
|
|
|
|
:: +mo-handle-sys-rep: reverse request.
|
|
|
|
::
|
2019-09-12 05:55:31 +03:00
|
|
|
:: On receipt of a valid +sign from %ford, sets state to the
|
2019-11-07 09:19:32 +03:00
|
|
|
:: appropriate duct and gives an internal %fact
|
2019-09-12 05:55:31 +03:00
|
|
|
:: containing the +sign payload.
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
++ mo-handle-sys-rep
|
|
|
|
|= [=path =sign-arvo]
|
|
|
|
^+ mo-core
|
|
|
|
::
|
|
|
|
?> ?=([@ @ @ @ ~] path)
|
|
|
|
?> ?=([%f %made *] sign-arvo)
|
|
|
|
=/ him (slav %p i.t.path)
|
|
|
|
=/ dap i.t.t.path
|
|
|
|
=/ num (slav %ud i.t.t.t.path)
|
|
|
|
::
|
|
|
|
?: ?=([%incomplete *] result.sign-arvo)
|
|
|
|
=/ err (some tang.result.sign-arvo)
|
|
|
|
(mo-give %mack err)
|
|
|
|
::
|
|
|
|
=/ build-result build-result.result.sign-arvo
|
|
|
|
?: ?=([%error *] build-result)
|
|
|
|
:: XX should crash
|
|
|
|
=/ err (some message.build-result)
|
|
|
|
(mo-give %mack err)
|
|
|
|
:: XX pump should ack
|
|
|
|
=. mo-core (mo-give %mack ~)
|
|
|
|
=/ duct (mo-retrieve-duct him num)
|
2019-11-05 07:19:08 +03:00
|
|
|
?~ duct
|
|
|
|
%- (slog leaf/"gall: sys-rep no index" ~)
|
|
|
|
mo-core
|
|
|
|
=. mo-core (mo-abed u.duct)
|
2019-08-29 21:44:37 +03:00
|
|
|
=/ =cage (result-to-cage:ford build-result)
|
2019-11-09 04:26:47 +03:00
|
|
|
=/ =gift:able [%unto %fact cage]
|
2019-09-12 05:55:31 +03:00
|
|
|
(mo-give gift)
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +mo-handle-sys-req: process an inbound request.
|
|
|
|
::
|
|
|
|
++ mo-handle-sys-req
|
|
|
|
|= [=path =sign-arvo]
|
|
|
|
^+ mo-core
|
|
|
|
::
|
|
|
|
?> ?=([@ @ @ @ ~] path)
|
|
|
|
=/ him (slav %p i.t.path)
|
|
|
|
=/ dap i.t.t.path
|
|
|
|
=/ num (slav %ud i.t.t.t.path)
|
|
|
|
::
|
|
|
|
?: ?=([%f %made *] sign-arvo)
|
|
|
|
?: ?=([%incomplete *] result.sign-arvo)
|
|
|
|
=/ err (some tang.result.sign-arvo)
|
|
|
|
(mo-give %mack err)
|
|
|
|
::
|
|
|
|
=/ build-result build-result.result.sign-arvo
|
|
|
|
?: ?=([%error *] build-result)
|
|
|
|
=/ err (some message.build-result)
|
|
|
|
(mo-give %mack err)
|
|
|
|
::
|
|
|
|
=/ sys-path [%sys path]
|
|
|
|
=/ =note-arvo
|
|
|
|
=/ =cage (result-to-cage:ford build-result)
|
2019-09-04 22:48:36 +03:00
|
|
|
[%m %deal [him our] i.t.t.path %poke cage]
|
2019-08-29 21:44:37 +03:00
|
|
|
(mo-pass sys-path note-arvo)
|
|
|
|
::
|
|
|
|
?: ?=([%a %woot *] sign-arvo)
|
|
|
|
mo-core
|
|
|
|
::
|
2019-09-04 22:48:36 +03:00
|
|
|
?> ?=([%m %unto *] sign-arvo)
|
2019-11-09 10:31:11 +03:00
|
|
|
=/ =sign:agent +>.sign-arvo
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-11-09 10:31:11 +03:00
|
|
|
?- -.sign
|
2019-09-12 05:55:31 +03:00
|
|
|
%poke-ack
|
2019-11-09 10:31:11 +03:00
|
|
|
(mo-give %mack p.sign)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-11-07 09:19:32 +03:00
|
|
|
%fact
|
2019-08-29 21:44:37 +03:00
|
|
|
=/ sys-path [%sys %red t.path]
|
|
|
|
=/ =note-arvo
|
2019-09-04 22:48:36 +03:00
|
|
|
=/ path [%m %gh dap ~]
|
2019-11-09 10:31:11 +03:00
|
|
|
=/ noun [num %d p.cage.sign q.q.cage.sign]
|
2019-08-29 21:44:37 +03:00
|
|
|
[%a %want him path noun]
|
|
|
|
(mo-pass sys-path note-arvo)
|
|
|
|
::
|
2019-11-07 09:19:32 +03:00
|
|
|
%kick
|
2019-08-29 21:44:37 +03:00
|
|
|
=/ sys-path [%sys path]
|
|
|
|
=/ =note-arvo
|
2019-09-04 22:48:36 +03:00
|
|
|
=/ path [%m %gh dap ~]
|
2019-08-29 21:44:37 +03:00
|
|
|
=/ noun [num %x ~]
|
|
|
|
[%a %want him path noun]
|
|
|
|
(mo-pass sys-path note-arvo)
|
|
|
|
::
|
2019-11-07 09:19:32 +03:00
|
|
|
%watch-ack
|
2019-11-09 10:31:11 +03:00
|
|
|
(mo-give %mack p.sign)
|
2019-08-29 21:44:37 +03:00
|
|
|
==
|
|
|
|
:: +mo-handle-sys-val: inbound validate.
|
|
|
|
::
|
|
|
|
:: Validates an incoming +sign from %ford and applies it to the specified
|
|
|
|
:: agent.
|
|
|
|
::
|
|
|
|
++ mo-handle-sys-val
|
|
|
|
|= [=path =sign-arvo]
|
|
|
|
^+ mo-core
|
|
|
|
::
|
|
|
|
?> ?=([%f %made *] sign-arvo)
|
|
|
|
?> ?=([@ @ @ ~] path)
|
|
|
|
=/ =ship (slav %p i.t.path)
|
|
|
|
=/ =term i.t.t.path
|
|
|
|
?: ?=([%incomplete *] result.sign-arvo)
|
|
|
|
=/ err (some tang.result.sign-arvo)
|
2019-09-12 05:55:31 +03:00
|
|
|
(mo-give %unto %poke-ack err)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
=/ build-result build-result.result.sign-arvo
|
|
|
|
?: ?=([%error *] build-result)
|
|
|
|
=/ err (some message.build-result)
|
2019-09-12 05:55:31 +03:00
|
|
|
(mo-give %unto %poke-ack err)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
=/ =routes [disclosing=~ attributing=ship]
|
|
|
|
=/ =cage (result-to-cage:ford build-result)
|
2019-11-09 04:26:47 +03:00
|
|
|
=/ =deal [%poke cage]
|
|
|
|
(mo-apply term routes deal)
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +mo-handle-sys-way: outbound request.
|
|
|
|
::
|
|
|
|
++ mo-handle-sys-way
|
|
|
|
|= [=path =sign-arvo]
|
|
|
|
^+ mo-core
|
|
|
|
::
|
|
|
|
?> ?=([%a %woot *] sign-arvo)
|
|
|
|
?> ?=([@ @ ~] path)
|
|
|
|
=/ =foreign-response (foreign-response i.t.path)
|
|
|
|
=/ maybe-ares +>+.sign-arvo
|
|
|
|
(mo-handle-foreign-response foreign-response maybe-ares)
|
|
|
|
:: +mo-handle-use: handle a typed +sign incoming on /use.
|
|
|
|
::
|
|
|
|
:: (Note that /use implies the +sign should be routed to an agent.)
|
|
|
|
::
|
|
|
|
:: Initialises the specified agent and then performs an agent-level +take
|
|
|
|
:: on the supplied +sign.
|
|
|
|
::
|
|
|
|
++ mo-handle-use
|
|
|
|
~/ %mo-handle-use
|
|
|
|
|= [=path hin=(hypo sign-arvo)]
|
|
|
|
^+ mo-core
|
|
|
|
::
|
2019-09-06 04:18:31 +03:00
|
|
|
?. ?=([@ @ *] path)
|
2019-08-29 21:44:37 +03:00
|
|
|
~& [%mo-handle-use-bad-path path]
|
|
|
|
!!
|
|
|
|
::
|
|
|
|
=/ =sign-arvo q.hin
|
2019-09-06 04:18:31 +03:00
|
|
|
?. ?=([%m %unto *] sign-arvo)
|
2019-11-08 01:46:06 +03:00
|
|
|
=/ app
|
|
|
|
=/ =term i.path
|
|
|
|
=/ =ship (slav %p i.t.path)
|
|
|
|
=/ =routes [disclosing=~ attributing=ship]
|
|
|
|
(ap-abed:ap term routes)
|
|
|
|
::
|
2019-09-12 05:55:31 +03:00
|
|
|
=. app (ap-generic-take:app t.t.path sign-arvo)
|
2019-08-29 21:44:37 +03:00
|
|
|
ap-abet:app
|
2019-11-09 10:31:11 +03:00
|
|
|
=/ =sign:agent +>.sign-arvo
|
2019-11-08 01:46:06 +03:00
|
|
|
=/ app
|
|
|
|
?> ?=([%out @ @ *] t.t.path)
|
|
|
|
=/ =term i.path
|
|
|
|
=/ =ship (slav %p i.t.t.t.path)
|
|
|
|
=/ =routes [disclosing=~ attributing=ship]
|
|
|
|
(ap-abed:ap term routes)
|
2019-09-06 04:18:31 +03:00
|
|
|
=. app
|
2019-11-09 10:31:11 +03:00
|
|
|
(ap-specific-take:app t.t.path sign)
|
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
|
|
|
|
|= =term
|
|
|
|
^+ mo-core
|
|
|
|
::
|
|
|
|
?. (~(has by running.agents.state) term)
|
|
|
|
mo-core
|
|
|
|
=/ maybe-blocked (~(get by blocked.agents.state) term)
|
|
|
|
?~ maybe-blocked
|
|
|
|
mo-core
|
|
|
|
::
|
|
|
|
=/ =blocked u.maybe-blocked
|
|
|
|
::
|
|
|
|
|- ^+ mo-core
|
|
|
|
?: =(~ blocked)
|
|
|
|
=/ blocked (~(del by blocked.agents.state) term)
|
|
|
|
%_ mo-core
|
|
|
|
blocked.agents.state blocked
|
|
|
|
==
|
|
|
|
=^ task blocked [p q]:~(get to blocked)
|
|
|
|
=/ =duct p.task
|
|
|
|
=/ =routes q.task
|
2019-11-09 04:26:47 +03:00
|
|
|
=/ =deal r.task
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
=/ move
|
|
|
|
=/ =sock [attributing.routes our]
|
2019-11-09 04:26:47 +03:00
|
|
|
=/ card [%slip %m %deal sock term deal]
|
2019-08-29 21:44:37 +03:00
|
|
|
[duct card]
|
|
|
|
$(moves [move moves])
|
|
|
|
:: +mo-beak: assemble a beak for the specified agent.
|
|
|
|
::
|
|
|
|
++ mo-beak
|
|
|
|
|= =term
|
|
|
|
^- beak
|
|
|
|
::
|
|
|
|
?~ running=(~(get by running.agents.state) term)
|
|
|
|
:: XX this fallback is necessary, as .term could be either the source
|
|
|
|
:: or the destination app. ie, it might not exist locally ...
|
|
|
|
::
|
|
|
|
[our %home %da now]
|
|
|
|
beak.u.running
|
|
|
|
:: +mo-peek: call to +ap-peek (which is not accessible outside of +mo).
|
|
|
|
::
|
|
|
|
++ mo-peek
|
|
|
|
~/ %mo-peek
|
|
|
|
|= [agent=term =routes =term =path]
|
|
|
|
^- (unit (unit cage))
|
|
|
|
::
|
|
|
|
=/ app (ap-abed:ap agent routes)
|
|
|
|
(ap-peek:app term path)
|
|
|
|
:: +mo-apply: apply the supplied action to the specified agent.
|
|
|
|
::
|
|
|
|
++ mo-apply
|
2019-11-09 04:26:47 +03:00
|
|
|
|= [=term =routes =deal]
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ mo-core
|
|
|
|
::
|
|
|
|
=/ =path
|
|
|
|
=/ ship (scot %p attributing.routes)
|
|
|
|
/sys/val/[ship]/[term]
|
|
|
|
::
|
|
|
|
=/ ship-desk
|
|
|
|
=/ =beak (mo-beak term)
|
|
|
|
[p q]:beak
|
|
|
|
::
|
2019-11-09 04:26:47 +03:00
|
|
|
?: ?=(%raw-poke -.deal)
|
|
|
|
=/ =schematic:ford [%vale ship-desk +.deal]
|
2019-08-29 21:44:37 +03:00
|
|
|
=/ =note-arvo [%f %build live=%.n schematic]
|
|
|
|
(mo-pass path note-arvo)
|
|
|
|
::
|
2019-11-09 04:26:47 +03:00
|
|
|
?: ?=(%poke-as -.deal)
|
|
|
|
=/ =schematic:ford [%cast ship-desk mark.deal [%$ cage.deal]]
|
2019-08-29 21:44:37 +03:00
|
|
|
=/ =note-arvo [%f %build live=%.n schematic]
|
|
|
|
(mo-pass path note-arvo)
|
|
|
|
::
|
|
|
|
=/ app (ap-abed:ap term 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.
|
|
|
|
::
|
2019-11-09 04:26:47 +03:00
|
|
|
:: If the agent is running or blocked, assign it the supplied +deal.
|
2019-08-29 21:44:37 +03:00
|
|
|
:: Otherwise simply apply the action to the agent.
|
|
|
|
::
|
|
|
|
++ mo-handle-local
|
2019-11-09 04:26:47 +03:00
|
|
|
|= [=ship =term =deal]
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ mo-core
|
|
|
|
::
|
|
|
|
=/ =routes [disclosing=~ attributing=ship]
|
|
|
|
=/ is-running (~(has by running.agents.state) term)
|
|
|
|
=/ is-blocked (~(has by blocked.agents.state) term)
|
|
|
|
::
|
|
|
|
?: |(!is-running is-blocked)
|
|
|
|
=/ =blocked
|
|
|
|
=/ waiting (~(get by blocked.agents.state) term)
|
2019-11-09 04:26:47 +03:00
|
|
|
=/ deals (fall waiting *blocked)
|
|
|
|
=/ deal [hen routes deal]
|
|
|
|
(~(put to deals) deal)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-11-10 03:47:41 +03:00
|
|
|
~& >> [%gall-not-running term -.deal]
|
2019-08-29 21:44:37 +03:00
|
|
|
%_ mo-core
|
|
|
|
blocked.agents.state (~(put by blocked.agents.state) term blocked)
|
|
|
|
==
|
2019-11-09 04:26:47 +03:00
|
|
|
(mo-apply term routes deal)
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +mo-handle-forward: handle forward %ames message.
|
|
|
|
::
|
|
|
|
++ mo-handle-forward
|
|
|
|
|= [=ship =term =bone =forward-ames]
|
|
|
|
^+ mo-core
|
|
|
|
::
|
|
|
|
=. mo-core
|
|
|
|
?. ?=(%u -.forward-ames)
|
|
|
|
mo-core
|
|
|
|
(mo-give %mack ~)
|
|
|
|
::
|
|
|
|
=/ =path
|
|
|
|
=/ him (scot %p ship)
|
|
|
|
=/ num (scot %ud bone)
|
|
|
|
/sys/req/[him]/[term]/[num]
|
|
|
|
::
|
|
|
|
=/ =sock [ship our]
|
|
|
|
=/ =note-arvo
|
|
|
|
?- -.forward-ames
|
|
|
|
%m
|
|
|
|
=/ =task:able
|
2019-11-09 04:26:47 +03:00
|
|
|
=/ =deal [%raw-poke [mark noun]:forward-ames]
|
|
|
|
[%deal sock term deal]
|
2019-09-04 22:48:36 +03:00
|
|
|
[%m task]
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
%l
|
|
|
|
=/ =task:able
|
2019-11-09 04:26:47 +03:00
|
|
|
=/ =deal [%watch-as [mark path]:forward-ames]
|
|
|
|
[%deal sock term deal]
|
2019-09-04 22:48:36 +03:00
|
|
|
[%m task]
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
%s
|
|
|
|
=/ =task:able
|
2019-11-09 04:26:47 +03:00
|
|
|
=/ =deal [%watch path.forward-ames]
|
|
|
|
[%deal sock term deal]
|
2019-09-04 22:48:36 +03:00
|
|
|
[%m task]
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
%u
|
|
|
|
=/ =task:able
|
2019-11-09 04:26:47 +03:00
|
|
|
=/ =deal [%leave ~]
|
|
|
|
[%deal sock term deal]
|
2019-09-04 22:48:36 +03:00
|
|
|
[%m task]
|
2019-08-29 21:44:37 +03:00
|
|
|
==
|
|
|
|
(mo-pass path note-arvo)
|
|
|
|
:: +mo-handle-backward: handle reverse %ames message.
|
|
|
|
::
|
|
|
|
++ mo-handle-backward
|
|
|
|
|= [=ship =term =bone =reverse-ames]
|
|
|
|
^+ mo-core
|
|
|
|
::
|
|
|
|
?- -.reverse-ames
|
|
|
|
%d
|
2019-11-08 01:46:06 +03:00
|
|
|
=/ =wire
|
2019-08-29 21:44:37 +03:00
|
|
|
=/ him (scot %p ship)
|
|
|
|
=/ num (scot %ud bone)
|
|
|
|
/sys/rep/[him]/[term]/[num]
|
|
|
|
::
|
|
|
|
=/ =note-arvo
|
|
|
|
=/ beak (mo-beak term)
|
|
|
|
=/ info [p q]:beak
|
|
|
|
=/ =schematic:ford [%vale info p.reverse-ames q.reverse-ames]
|
|
|
|
[%f %build live=%.n schematic]
|
|
|
|
::
|
2019-11-08 01:46:06 +03:00
|
|
|
(mo-pass wire note-arvo)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
%x
|
|
|
|
:: XX should crash
|
|
|
|
=. mo-core (mo-give %mack ~)
|
2019-11-05 07:19:08 +03:00
|
|
|
=/ out (mo-retrieve-duct ship bone)
|
|
|
|
?~ out
|
|
|
|
%- (slog leaf/"gall: x no index" ~)
|
|
|
|
mo-core
|
2019-08-29 21:44:37 +03:00
|
|
|
=/ initialised
|
2019-11-05 07:19:08 +03:00
|
|
|
(mo-abed u.out)
|
2019-11-09 04:26:47 +03:00
|
|
|
(mo-give:initialised %unto %kick ~)
|
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-09-04 22:48:36 +03:00
|
|
|
~% %mall-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))
|
|
|
|
current-agent=running-agent
|
|
|
|
==
|
|
|
|
++ ap-core .
|
|
|
|
:: +ap-abed: initialise state for an agent, with the supplied routes.
|
|
|
|
::
|
2019-09-04 22:48:36 +03:00
|
|
|
:: The agent must already be running in +mall -- here we simply update
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +ap's state to focus on it.
|
|
|
|
::
|
|
|
|
++ ap-abed
|
|
|
|
~/ %ap-abed
|
|
|
|
|= [=term =routes]
|
|
|
|
^+ ap-core
|
|
|
|
::
|
|
|
|
=/ =running-agent
|
|
|
|
=/ running (~(got by running.agents.state) term)
|
|
|
|
=/ =stats
|
|
|
|
:+ +(change.stats.running)
|
|
|
|
(shaz (mix (add term change.stats.running) eny))
|
|
|
|
now
|
|
|
|
running(stats stats)
|
|
|
|
::
|
|
|
|
=. agent-name term
|
|
|
|
=. agent-routes routes
|
|
|
|
=. current-agent running-agent
|
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
|
|
|
|
::
|
|
|
|
=> ap-track-queue
|
|
|
|
=/ running (~(put by running.agents.state) agent-name current-agent)
|
|
|
|
=/ moves
|
|
|
|
=/ giver |=(report=(each suss tang) [hen %give %onto report])
|
|
|
|
=/ from-suss (turn agent-config giver)
|
2019-11-08 03:30:45 +03:00
|
|
|
:(weld agent-moves from-suss moves)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
%_ mo-core
|
|
|
|
running.agents.state running
|
|
|
|
moves moves
|
|
|
|
==
|
|
|
|
:: +ap-track-queue: track queue.
|
|
|
|
::
|
|
|
|
++ ap-track-queue
|
|
|
|
^+ ap-core
|
|
|
|
::
|
2019-11-08 03:30:45 +03:00
|
|
|
=/ internal-moves agent-moves
|
2019-09-12 05:55:31 +03:00
|
|
|
=/ bad-ducts *(set duct)
|
2019-09-24 06:46:59 +03:00
|
|
|
=; core
|
|
|
|
core(agent-duct agent-duct)
|
2019-08-29 21:44:37 +03:00
|
|
|
|- ^+ ap-core
|
2019-11-08 03:30:45 +03:00
|
|
|
?^ internal-moves
|
|
|
|
=/ =move i.internal-moves
|
|
|
|
?. ?=([* %give %unto %fact *] move)
|
|
|
|
$(internal-moves t.internal-moves)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-11-08 03:30:45 +03:00
|
|
|
=^ filled ap-core ap-enqueue(agent-duct duct.move)
|
2019-09-12 05:55:31 +03:00
|
|
|
=. bad-ducts
|
2019-08-29 21:44:37 +03:00
|
|
|
?: filled
|
2019-09-12 05:55:31 +03:00
|
|
|
bad-ducts
|
2019-11-08 03:30:45 +03:00
|
|
|
(~(put in bad-ducts) duct.move)
|
|
|
|
$(internal-moves t.internal-moves)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-09-12 05:55:31 +03:00
|
|
|
=/ ducts ~(tap in bad-ducts)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
|- ^+ ap-core
|
2019-09-12 05:55:31 +03:00
|
|
|
?~ ducts
|
2019-08-29 21:44:37 +03:00
|
|
|
ap-core
|
|
|
|
::
|
2019-09-12 05:55:31 +03:00
|
|
|
=> $(ducts t.ducts, agent-duct i.ducts)
|
2019-08-29 21:44:37 +03:00
|
|
|
=/ incoming
|
2019-09-12 05:55:31 +03:00
|
|
|
(~(get by incoming.subscribers.current-agent) agent-duct)
|
2019-08-29 21:44:37 +03:00
|
|
|
?~ incoming
|
2019-09-12 05:55:31 +03:00
|
|
|
~& [%ap-track-queue-bad-duct agent-name agent-duct]
|
2019-08-29 21:44:37 +03:00
|
|
|
ap-core
|
|
|
|
::
|
|
|
|
=/ =ship p.u.incoming
|
2019-09-29 07:44:31 +03:00
|
|
|
ap-kill-up(attributing.agent-routes ship)
|
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
|
|
|
::
|
|
|
|
++ ap-from-internal
|
|
|
|
~/ %ap-from-internal
|
2019-11-09 04:26:47 +03:00
|
|
|
|= card=(wind neat gift:agent)
|
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)
|
|
|
|
=/ ducts=(list duct) (ap-ducts-from-path path.gift ship.gift)
|
|
|
|
%+ turn ducts
|
|
|
|
|= =duct
|
|
|
|
~? &(=(duct system-duct.agents.state) !=(agent-name %hood))
|
|
|
|
[%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-09-24 06:46:59 +03:00
|
|
|
=/ ducts=(list duct) (ap-ducts-from-path path.gift ~)
|
2019-09-12 05:55:31 +03:00
|
|
|
=/ =cage cage.gift
|
|
|
|
%+ turn ducts
|
|
|
|
|= =duct
|
2019-09-12 22:57:37 +03:00
|
|
|
~? &(=(duct system-duct.agents.state) !=(agent-name %hood))
|
2019-09-12 05:55:31 +03:00
|
|
|
[%agent-giving-on-system-duct agent-name -.gift]
|
|
|
|
^- move
|
|
|
|
=/ =mark
|
|
|
|
(~(gut by marks.current-agent) duct p.cage)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-09-12 05:55:31 +03:00
|
|
|
?: =(mark p.cage)
|
2019-11-09 04:26:47 +03:00
|
|
|
[duct %give %unto %fact cage.gift]
|
2019-09-12 05:55:31 +03:00
|
|
|
=/ =path /sys/pel/[agent-name]
|
|
|
|
=/ =note-arvo
|
|
|
|
=/ =schematic:ford
|
|
|
|
=/ =beak (mo-beak agent-name)
|
|
|
|
[%cast [p q]:beak mark [%$ cage]]
|
|
|
|
[%f %build live=%.n schematic]
|
|
|
|
::
|
|
|
|
[duct %pass path note-arvo]
|
|
|
|
::
|
|
|
|
%pass
|
|
|
|
=/ =duct system-duct.agents.state
|
2019-09-29 07:44:31 +03:00
|
|
|
=/ =wire p.card
|
2019-11-09 04:26:47 +03:00
|
|
|
=/ =neat:agent q.card
|
|
|
|
=? wire ?=(%agent -.neat)
|
|
|
|
[%out (scot %p ship.neat) name.neat wire]
|
2019-09-29 07:44:31 +03:00
|
|
|
=. wire
|
2019-09-12 05:55:31 +03:00
|
|
|
:: Is it bad that this includes attributing ship? May create
|
|
|
|
:: spurious duct mismatches
|
|
|
|
::
|
2019-09-29 07:44:31 +03:00
|
|
|
[%use agent-name (scot %p attributing.agent-routes) wire]
|
2019-09-12 05:55:31 +03:00
|
|
|
=/ =note-arvo
|
2019-11-09 04:26:47 +03:00
|
|
|
?- -.neat
|
|
|
|
%arvo note-arvo.neat
|
2019-09-12 05:55:31 +03:00
|
|
|
%agent
|
|
|
|
=/ =task:able
|
2019-11-09 04:26:47 +03:00
|
|
|
=/ =sock [our ship.neat]
|
|
|
|
[%deal sock [name deal]:neat]
|
2019-09-12 05:55:31 +03:00
|
|
|
[%m task]
|
|
|
|
==
|
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
|
|
|
|
=/ in=(list [=duct =^ship =path])
|
|
|
|
~(tap by incoming.subscribers.current-agent)
|
|
|
|
|- ^+ 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)
|
|
|
|
::
|
|
|
|
=/ out=(list [[=wire =^ship =term] =bean =path])
|
|
|
|
~(tap by outgoing.subscribers.current-agent)
|
|
|
|
|- ^+ ap-core
|
|
|
|
?~ out
|
|
|
|
ap-core
|
|
|
|
=? ap-core =(ship ship.i.out)
|
|
|
|
=/ core
|
|
|
|
=. agent-duct system-duct.agents.state
|
2019-11-09 04:26:47 +03:00
|
|
|
(ap-specific-take wire.i.out %kick ~)
|
2019-11-05 07:19:08 +03:00
|
|
|
core(agent-duct agent-duct)
|
|
|
|
$(out t.out)
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +ap-agent-core: agent core with current bowl and state
|
|
|
|
::
|
|
|
|
++ ap-agent-core
|
2019-09-05 00:20:47 +03:00
|
|
|
~(. agent.current-agent ap-construct-bowl)
|
2019-09-12 05:55:31 +03:00
|
|
|
:: +ap-ducts-from-path: get ducts subscribed to path
|
|
|
|
::
|
|
|
|
++ ap-ducts-from-path
|
2019-09-24 06:46:59 +03:00
|
|
|
|= [target-path=(unit path) target-ship=(unit ship)]
|
2019-09-12 05:55:31 +03:00
|
|
|
^- (list duct)
|
2019-09-24 06:46:59 +03:00
|
|
|
?: &(?=(~ target-path) ?=(~ target-ship))
|
2019-09-12 05:55:31 +03:00
|
|
|
~[agent-duct]
|
|
|
|
%+ murn ~(tap by incoming.subscribers.current-agent)
|
|
|
|
|= [=duct =ship =path]
|
|
|
|
^- (unit ^duct)
|
2019-09-24 06:46:59 +03:00
|
|
|
?~ target-ship
|
|
|
|
?: =(target-path `path)
|
|
|
|
`duct
|
|
|
|
~
|
|
|
|
?~ target-path
|
|
|
|
?: =(target-ship `ship)
|
|
|
|
`duct
|
|
|
|
~
|
|
|
|
?: &(=(target-path `path) =(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
|
|
|
|
%pump ap-dequeue
|
2019-08-29 21:44:37 +03:00
|
|
|
==
|
|
|
|
:: +ap-peek: peek.
|
|
|
|
::
|
|
|
|
++ ap-peek
|
|
|
|
~/ %ap-peek
|
|
|
|
|= [=term tyl=path]
|
|
|
|
^- (unit (unit cage))
|
|
|
|
::
|
2019-09-25 23:19:09 +03:00
|
|
|
=/ marked
|
|
|
|
?. ?=(%x term)
|
|
|
|
[mark=%$ tyl=tyl]
|
|
|
|
::
|
|
|
|
=/ =path (flop tyl)
|
|
|
|
?> ?=(^ path)
|
|
|
|
[mark=i.path tyl=(flop t.path)]
|
|
|
|
::
|
|
|
|
=/ =mark mark.marked
|
|
|
|
=/ tyl tyl.marked
|
|
|
|
::
|
2019-08-29 21:44:37 +03:00
|
|
|
=/ peek-result=(each (unit (unit cage)) tang)
|
2019-11-07 09:19:32 +03:00
|
|
|
(mule |.((on-peek:ap-agent-core [term tyl])))
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
?- -.peek-result
|
|
|
|
%& p.peek-result
|
|
|
|
%| ((slog leaf+"peek bad result" p.peek-result) [~ ~])
|
2019-09-04 22:48:36 +03:00
|
|
|
==
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +ap-update-subscription: update subscription.
|
|
|
|
::
|
|
|
|
++ ap-update-subscription
|
|
|
|
~/ %ap-update-subscription
|
2019-09-29 07:44:31 +03:00
|
|
|
|= [is-ok=? =other=ship other-agent=term =wire]
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ ap-core
|
|
|
|
::
|
2019-09-29 07:44:31 +03:00
|
|
|
:: XX pretty sure this shouldn't be used for pump
|
|
|
|
:: =/ way [(scot %p ship) %out wire]
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
?: is-ok
|
2019-11-09 04:26:47 +03:00
|
|
|
=/ =neat [%agent [other-ship other-agent] %pump ~]
|
|
|
|
(ap-pass wire neat)
|
2019-09-29 07:44:31 +03:00
|
|
|
(ap-kill-down wire [other-ship other-agent])
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +ap-dequeue: drop from queue.
|
|
|
|
::
|
2019-09-12 05:55:31 +03:00
|
|
|
:: Dequeues along the current duct, deleting the queue entirely if it
|
2019-08-29 21:44:37 +03:00
|
|
|
:: drops to zero.
|
|
|
|
::
|
|
|
|
++ ap-dequeue
|
|
|
|
^+ ap-core
|
|
|
|
::
|
2019-09-12 05:55:31 +03:00
|
|
|
?. (~(has by incoming.subscribers.current-agent) agent-duct)
|
2019-08-29 21:44:37 +03:00
|
|
|
ap-core
|
2019-09-12 05:55:31 +03:00
|
|
|
=/ level (~(get by meter.subscribers.current-agent) agent-duct)
|
2019-08-29 21:44:37 +03:00
|
|
|
?: |(?=(~ level) =(0 u.level))
|
|
|
|
ap-core
|
|
|
|
::
|
|
|
|
=. u.level (dec u.level)
|
|
|
|
?: =(0 u.level)
|
2019-09-12 05:55:31 +03:00
|
|
|
=/ deleted (~(del by meter.subscribers.current-agent) agent-duct)
|
2019-08-29 21:44:37 +03:00
|
|
|
ap-core(meter.subscribers.current-agent deleted)
|
|
|
|
::
|
|
|
|
=/ dequeued
|
2019-09-12 05:55:31 +03:00
|
|
|
(~(put by meter.subscribers.current-agent) agent-duct u.level)
|
2019-08-29 21:44:37 +03:00
|
|
|
ap-core(meter.subscribers.current-agent dequeued)
|
|
|
|
:: +ap-enqueue: add to queue.
|
|
|
|
::
|
|
|
|
:: Every agent has a 'meter', that tracks the number of incoming
|
2019-09-12 05:55:31 +03:00
|
|
|
:: subscribers by duct. We get both the meter and ship associated with
|
|
|
|
:: the current duct; if the meter has hit twenty for another ship, we
|
2019-08-29 21:44:37 +03:00
|
|
|
:: don't enqueue the subscriber. Otherwise we increment the meter for
|
2019-09-12 05:55:31 +03:00
|
|
|
:: the current duct and update the agent's state with it.
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
:: Returns a yes if the meter has been incremented, and no otherwise.
|
|
|
|
::
|
|
|
|
++ ap-enqueue
|
|
|
|
^- [? _ap-core]
|
|
|
|
::
|
2019-09-12 05:55:31 +03:00
|
|
|
=/ meter (~(gut by meter.subscribers.current-agent) agent-duct 0)
|
2019-08-29 21:44:37 +03:00
|
|
|
=/ subscriber=(unit (pair ship path))
|
2019-09-12 05:55:31 +03:00
|
|
|
(~(get by incoming.subscribers.current-agent) agent-duct)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
?: ?& =(20 meter)
|
|
|
|
?| ?=(~ subscriber)
|
|
|
|
!=(our p.u.subscriber)
|
|
|
|
==
|
|
|
|
==
|
2019-09-12 05:55:31 +03:00
|
|
|
=/ incoming (~(get by incoming.subscribers.current-agent) agent-duct)
|
|
|
|
~& [%mall-pulling-20 agent-duct incoming]
|
2019-08-29 21:44:37 +03:00
|
|
|
[%.n ap-core]
|
|
|
|
::
|
|
|
|
=/ next
|
|
|
|
=/ meter
|
2019-09-12 05:55:31 +03:00
|
|
|
(~(put by meter.subscribers.current-agent) agent-duct +(meter))
|
2019-08-29 21:44:37 +03:00
|
|
|
ap-core(meter.subscribers.current-agent meter)
|
|
|
|
::
|
|
|
|
[%.y next]
|
|
|
|
:: +ap-give: return result.
|
|
|
|
::
|
|
|
|
++ ap-give
|
2019-09-12 05:55:31 +03:00
|
|
|
|= =gift:agent
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ ap-core
|
|
|
|
::
|
2019-11-08 03:30:45 +03:00
|
|
|
=/ internal-moves
|
|
|
|
(weld (ap-from-internal %give gift) agent-moves)
|
|
|
|
ap-core(agent-moves internal-moves)
|
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
|
|
|
|
== ::
|
2019-10-01 06:53:02 +03:00
|
|
|
:* wex=outgoing.subscribers.current-agent :: outgoing
|
2019-08-29 21:44:37 +03:00
|
|
|
sup=incoming.subscribers.current-agent :: incoming
|
|
|
|
== ::
|
2019-09-12 05:55:31 +03:00
|
|
|
:* act=change.stats.current-agent :: tick
|
2019-08-29 21:44:37 +03:00
|
|
|
eny=eny.stats.current-agent :: nonce
|
|
|
|
now=time.stats.current-agent :: time
|
|
|
|
byk=beak.current-agent :: source
|
|
|
|
== ==
|
|
|
|
:: +ap-pass: request action.
|
|
|
|
::
|
|
|
|
++ ap-pass
|
2019-11-09 04:26:47 +03:00
|
|
|
|= [=path =neat]
|
2019-08-29 21:44:37 +03:00
|
|
|
^+ ap-core
|
|
|
|
::
|
2019-11-08 03:30:45 +03:00
|
|
|
=/ internal-moves
|
2019-11-09 04:26:47 +03:00
|
|
|
(ap-from-internal %pass path neat)
|
2019-11-08 03:30:45 +03:00
|
|
|
ap-core(agent-moves (weld internal-moves agent-moves))
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +ap-reinstall: reinstall.
|
|
|
|
::
|
|
|
|
++ ap-reinstall
|
|
|
|
~/ %ap-reinstall
|
|
|
|
|= =vase
|
|
|
|
^+ ap-core
|
|
|
|
::
|
2019-09-24 01:44:48 +03:00
|
|
|
=/ maybe-agent (mule |.(!<(agent vase)))
|
|
|
|
?: ?=(%| -.maybe-agent)
|
|
|
|
(ap-error %new-core-not-agent p.maybe-agent)
|
2019-08-29 22:57:33 +03:00
|
|
|
::
|
2019-08-29 21:44:37 +03:00
|
|
|
=/ prep
|
2019-09-24 01:44:48 +03:00
|
|
|
=/ =agent p.maybe-agent
|
2019-09-12 05:55:31 +03:00
|
|
|
=/ running
|
|
|
|
%- some
|
2019-11-07 09:19:32 +03:00
|
|
|
~(on-save agent.current-agent ap-construct-bowl)
|
2019-08-29 21:44:37 +03:00
|
|
|
=/ installed ap-install(agent.current-agent agent)
|
|
|
|
(installed running)
|
|
|
|
::
|
|
|
|
=^ maybe-tang ap-core prep
|
|
|
|
?~ maybe-tang
|
|
|
|
ap-core
|
2019-11-09 04:26:47 +03:00
|
|
|
(ap-error %load-failed u.maybe-tang)
|
|
|
|
:: +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
|
|
|
|
::
|
2019-09-12 05:55:31 +03:00
|
|
|
=. marks.current-agent (~(put by marks.current-agent) agent-duct mark)
|
|
|
|
(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
|
|
|
|
::
|
|
|
|
=/ incoming [attributing.agent-routes pax]
|
|
|
|
=. incoming.subscribers.current-agent
|
2019-09-12 05:55:31 +03:00
|
|
|
(~(put by incoming.subscribers.current-agent) 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
|
2019-11-09 04:26:47 +03:00
|
|
|
|= [=wire =sign:agent]
|
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
|
2019-10-01 06:53:02 +03:00
|
|
|
:: if subscription ack or close, handle before calling user code
|
|
|
|
::
|
2019-11-09 04:26:47 +03:00
|
|
|
=? outgoing.subscribers.current-agent ?=(%kick -.sign)
|
2019-10-01 06:53:02 +03:00
|
|
|
%- ~(del by outgoing.subscribers.current-agent)
|
2019-11-08 05:25:19 +03:00
|
|
|
[agent-wire dock]
|
2019-11-09 04:26:47 +03:00
|
|
|
?: ?& ?=(%watch-ack -.sign)
|
2019-11-06 06:55:51 +03:00
|
|
|
!(~(has by outgoing.subscribers.current-agent) [agent-wire dock])
|
|
|
|
==
|
|
|
|
%- %: slog
|
|
|
|
leaf+"{<agent-name>}: got ack for nonexistent subscription"
|
|
|
|
leaf+"{<dock>}: {<agent-wire>}"
|
2019-11-08 05:25:19 +03:00
|
|
|
>wire=wire<
|
|
|
|
>out=outgoing.subscribers.current-agent<
|
2019-11-06 06:55:51 +03:00
|
|
|
~
|
|
|
|
==
|
|
|
|
ap-core
|
|
|
|
::
|
2019-11-09 04:26:47 +03:00
|
|
|
=? outgoing.subscribers.current-agent ?=(%watch-ack -.sign)
|
|
|
|
?^ p.sign
|
2019-10-01 06:53:02 +03:00
|
|
|
%- ~(del by outgoing.subscribers.current-agent)
|
|
|
|
[wire dock]
|
|
|
|
%+ ~(jab by outgoing.subscribers.current-agent) [agent-wire dock]
|
|
|
|
|= [acked=? =path]
|
|
|
|
~| [%already-acked agent-name wire dock path]
|
|
|
|
?< acked
|
|
|
|
[& path]
|
|
|
|
::
|
2019-08-29 21:44:37 +03:00
|
|
|
=^ maybe-tang ap-core
|
|
|
|
%+ ap-ingest ~ |.
|
2019-11-09 04:26:47 +03:00
|
|
|
(on-agent:ap-agent-core agent-wire sign)
|
2019-10-01 06:53:02 +03:00
|
|
|
::
|
2019-11-09 04:26:47 +03:00
|
|
|
=? ap-core ?=(%fact -.sign)
|
2019-10-01 06:53:02 +03:00
|
|
|
(ap-update-subscription =(~ maybe-tang) p.dock q.dock agent-wire)
|
2019-08-29 21:44:37 +03:00
|
|
|
?^ maybe-tang
|
2019-11-09 04:26:47 +03:00
|
|
|
(ap-error -.sign leaf/"closing subscription" u.maybe-tang)
|
2019-08-29 21:44:37 +03:00
|
|
|
ap-core
|
|
|
|
:: +ap-install: install wrapper.
|
|
|
|
::
|
|
|
|
++ ap-install
|
|
|
|
|= maybe-vase=(unit vase)
|
|
|
|
^- [(unit tang) _ap-core]
|
|
|
|
::
|
2019-09-12 05:55:31 +03:00
|
|
|
=^ maybe-tang ap-core (ap-upgrade-state maybe-vase)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
=/ new-agent-config
|
|
|
|
=/ =term ?~(maybe-vase %boot %bump)
|
|
|
|
=/ possibly-suss
|
|
|
|
?~ maybe-tang
|
|
|
|
=/ =suss [agent-name term now]
|
|
|
|
[%.y suss]
|
|
|
|
[%.n u.maybe-tang]
|
|
|
|
[possibly-suss agent-config]
|
|
|
|
::
|
|
|
|
=/ next
|
2019-09-04 22:48:36 +03:00
|
|
|
ap-core(agent-config new-agent-config)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
[maybe-tang next]
|
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
|
|
|
|
::
|
2019-09-12 05:55:31 +03:00
|
|
|
?~ (~(get by incoming.subscribers.current-agent) agent-duct)
|
2019-08-29 21:44:37 +03:00
|
|
|
ap-core
|
|
|
|
::
|
2019-09-12 05:55:31 +03:00
|
|
|
=/ incoming (~(del by incoming.subscribers.current-agent) agent-duct)
|
|
|
|
=/ meter (~(del by meter.subscribers.current-agent) agent-duct)
|
2019-08-29 21:44:37 +03:00
|
|
|
%_ ap-core
|
|
|
|
incoming.subscribers.current-agent incoming
|
|
|
|
meter.subscribers.current-agent meter
|
|
|
|
==
|
|
|
|
:: +ap-load-delete: load delete.
|
|
|
|
::
|
|
|
|
++ ap-load-delete
|
|
|
|
^+ ap-core
|
|
|
|
::
|
|
|
|
=/ maybe-incoming
|
2019-09-12 05:55:31 +03:00
|
|
|
(~(get by incoming.subscribers.current-agent) agent-duct)
|
2019-08-29 21:44:37 +03:00
|
|
|
?~ maybe-incoming
|
|
|
|
ap-core
|
|
|
|
::
|
|
|
|
=/ incoming u.maybe-incoming
|
|
|
|
=. incoming.subscribers.current-agent
|
2019-09-12 05:55:31 +03:00
|
|
|
(~(del by incoming.subscribers.current-agent) agent-duct)
|
2019-08-29 21:44:37 +03:00
|
|
|
=. meter.subscribers.current-agent
|
2019-09-12 05:55:31 +03:00
|
|
|
(~(del by meter.subscribers.current-agent) 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 ~ ~)
|
2019-09-29 07:44:31 +03:00
|
|
|
:: +ap-kill-down: 2-sided kill from subscriber side
|
|
|
|
::
|
|
|
|
++ ap-kill-down
|
|
|
|
|= [=wire =dock]
|
|
|
|
^+ ap-core
|
|
|
|
::
|
|
|
|
=. ap-core
|
|
|
|
=/ way [%out (scot %p p.dock) q.dock wire]
|
2019-11-09 04:26:47 +03:00
|
|
|
(ap-specific-take way %kick ~)
|
2019-11-07 09:19:32 +03:00
|
|
|
(ap-pass wire %agent dock %leave ~)
|
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-09-04 22:48:36 +03:00
|
|
|
=/ result (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
|
|
|
|
^- (list card:agent)
|
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
|
|
|
::
|
2019-10-01 06:53:02 +03:00
|
|
|
=. agent.current-agent +.p.result
|
2019-11-08 03:30:45 +03:00
|
|
|
=/ moves (zing (turn -.p.result ap-from-internal))
|
2019-10-01 06:53:02 +03:00
|
|
|
=. incoming.subscribers.current-agent
|
2019-11-08 03:30:45 +03:00
|
|
|
(ap-handle-kicks moves)
|
|
|
|
(ap-handle-peers moves)
|
|
|
|
:: +ap-handle-kicks: handle cancels of incoming subscriptions
|
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]])))
|
2019-08-29 21:44:37 +03:00
|
|
|
(~(dif by incoming.subscribers.current-agent) quit-map)
|
2019-10-01 06:53:02 +03:00
|
|
|
:: +ap-handle-peers: handle new outgoing subscriptions
|
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
|
|
|
|
?: ?=([* %pass * %m %deal * * %leave *] move)
|
|
|
|
=/ =wire p.move.move
|
2019-11-08 05:25:19 +03:00
|
|
|
?> ?=([%use @ @ %out @ @ *] wire)
|
|
|
|
=/ short-wire t.t.t.t.t.t.wire
|
2019-11-08 03:30:45 +03:00
|
|
|
=/ =dock [q.p q]:q.move.move
|
2019-10-01 06:53:02 +03:00
|
|
|
=. outgoing.subscribers.current-agent
|
2019-11-08 05:25:19 +03:00
|
|
|
(~(del by outgoing.subscribers.current-agent) [short-wire dock])
|
2019-11-08 03:30:45 +03:00
|
|
|
$(moves t.moves, new-moves [move new-moves])
|
|
|
|
?. ?=([* %pass * %m %deal * * %watch *] move)
|
|
|
|
$(moves t.moves, new-moves [move new-moves])
|
|
|
|
=/ =wire p.move.move
|
2019-11-08 05:25:19 +03:00
|
|
|
?> ?=([%use @ @ %out @ @ *] wire)
|
|
|
|
=/ short-wire t.t.t.t.t.t.wire
|
2019-11-08 03:30:45 +03:00
|
|
|
=/ =dock [q.p q]:q.move.move
|
|
|
|
=/ =path path.r.q.move.move
|
2019-11-08 05:25:19 +03:00
|
|
|
?: (~(has by outgoing.subscribers.current-agent) short-wire dock)
|
2019-11-05 07:19:08 +03:00
|
|
|
=. ap-core
|
2019-11-08 05:25:19 +03:00
|
|
|
=/ way [%out (scot %p p.dock) q.dock short-wire]
|
2019-10-01 06:53:02 +03:00
|
|
|
=/ =tang
|
2019-11-08 05:25:19 +03:00
|
|
|
~[leaf+"subscribe wire not unique" >agent-name< >short-wire< >dock<]
|
|
|
|
%- (slog >out=outgoing.subscribers.current-agent< leaf/"XXX remove" tang)
|
2019-11-07 09:19:32 +03:00
|
|
|
(ap-specific-take way %watch-ack `tang)
|
2019-10-01 06:53:02 +03:00
|
|
|
$(moves t.moves)
|
|
|
|
=. outgoing.subscribers.current-agent
|
2019-11-08 05:25:19 +03:00
|
|
|
(~(put by outgoing.subscribers.current-agent) [short-wire dock] [| path])
|
2019-11-08 03:30:45 +03:00
|
|
|
$(moves t.moves, new-moves [move new-moves])
|
2019-08-29 21:44:37 +03:00
|
|
|
--
|
|
|
|
--
|
|
|
|
:: +call: request
|
|
|
|
::
|
|
|
|
++ call
|
2019-09-04 22:48:36 +03:00
|
|
|
~% %mall-call +> ~
|
2019-08-29 21:44:37 +03:00
|
|
|
|= [=duct hic=(hypo (hobo task:able))]
|
2019-09-04 22:48:36 +03:00
|
|
|
^- [(list move) _mall-payload]
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-09-04 22:48:36 +03:00
|
|
|
~| [%mall-call-failed duct q.hic]
|
2019-08-29 21:44:37 +03:00
|
|
|
:: make sure our task is hard
|
|
|
|
::
|
|
|
|
=/ =task:able
|
|
|
|
?. ?=(%soft -.q.hic)
|
|
|
|
q.hic
|
|
|
|
;; task:able p.q.hic
|
|
|
|
::
|
|
|
|
=/ initialised (mo-abed:mo duct)
|
|
|
|
?- -.task
|
2019-09-06 06:01:31 +03:00
|
|
|
?(%conf %conf-mall)
|
2019-08-29 21:44:37 +03:00
|
|
|
=/ =dock p.task
|
|
|
|
=/ =ship p.dock
|
|
|
|
?. =(our ship)
|
2019-09-04 22:48:36 +03:00
|
|
|
~& [%mall-not-ours ship]
|
|
|
|
[~ mall-payload]
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
=> (mo-boot:initialised q.dock q.task)
|
|
|
|
mo-abet
|
|
|
|
::
|
2019-11-09 04:26:47 +03:00
|
|
|
%deal
|
2019-08-29 21:44:37 +03:00
|
|
|
=/ =sock p.task
|
2019-09-12 05:55:31 +03:00
|
|
|
=/ =term q.task
|
2019-11-09 04:26:47 +03:00
|
|
|
=/ =deal r.task
|
2019-08-29 21:44:37 +03:00
|
|
|
?. =(q.sock our)
|
|
|
|
?> =(p.sock our)
|
2019-11-09 04:26:47 +03:00
|
|
|
=> (mo-handle-foreign-request:initialised q.sock term deal)
|
2019-08-29 21:44:37 +03:00
|
|
|
mo-abet
|
|
|
|
::
|
2019-11-09 04:26:47 +03:00
|
|
|
=> (mo-handle-local:initialised p.sock term deal)
|
2019-08-29 21:44:37 +03:00
|
|
|
mo-abet
|
2019-11-10 03:47:41 +03:00
|
|
|
::
|
|
|
|
%goad
|
|
|
|
mo-abet:(mo-goad:initialised force.task agent.task)
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
%init
|
2019-09-04 22:48:36 +03:00
|
|
|
=/ payload mall-payload(system-duct.agents.state duct)
|
2019-08-29 21:44:37 +03:00
|
|
|
[~ payload]
|
2019-11-05 07:19:08 +03:00
|
|
|
::
|
|
|
|
%trim
|
|
|
|
:: reuse %wash task to clear caches on memory-pressure
|
|
|
|
::
|
|
|
|
:: XX cancel subscriptions if =(0 trim-priority) ?
|
|
|
|
::
|
|
|
|
~> %slog.[0 leaf+"gall: trim: clearing caches"]
|
|
|
|
=/ =move [duct %pass / %m [%wash ~]]
|
|
|
|
[[move ~] mall-payload]
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
%vega
|
2019-09-04 22:48:36 +03:00
|
|
|
[~ mall-payload]
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
%west
|
|
|
|
=/ =ship p.task
|
|
|
|
=/ =path q.task
|
|
|
|
=/ =noun r.task
|
|
|
|
::
|
|
|
|
?> ?=([?(%ge %gh) @ ~] path)
|
|
|
|
=/ agent-name i.t.path
|
|
|
|
::
|
|
|
|
?: ?=(%ge i.path)
|
|
|
|
=/ mes ;;((pair @ud forward-ames) noun)
|
|
|
|
=> (mo-handle-forward:initialised ship agent-name mes)
|
|
|
|
mo-abet
|
|
|
|
::
|
|
|
|
=/ mes ;;((pair @ud reverse-ames) noun)
|
|
|
|
=> (mo-handle-backward:initialised ship agent-name mes)
|
|
|
|
mo-abet
|
|
|
|
::
|
|
|
|
%wash
|
|
|
|
=. running.agents.state
|
|
|
|
%- ~(run by running.agents.state)
|
|
|
|
|= =running-agent
|
|
|
|
running-agent(cache *worm)
|
2019-09-04 22:48:36 +03:00
|
|
|
[~ mall-payload]
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
|
|
|
%wegh
|
|
|
|
=/ blocked
|
|
|
|
=/ queued (~(run by blocked.agents.state) |=(blocked [%.y +<]))
|
|
|
|
(sort ~(tap by queued) aor)
|
|
|
|
::
|
|
|
|
=/ running
|
2019-09-04 22:48:36 +03:00
|
|
|
=/ active (~(run by running.agents.state) |=(running-agent [%.y +<]))
|
2019-08-29 21:44:37 +03:00
|
|
|
(sort ~(tap by active) aor)
|
|
|
|
::
|
|
|
|
=/ =mass
|
2019-09-04 22:48:36 +03:00
|
|
|
:+ %mall %.n
|
2019-08-29 21:44:37 +03:00
|
|
|
:~ [%foreign %.y contacts.agents.state]
|
|
|
|
[%blocked %.n blocked]
|
|
|
|
[%active %.n running]
|
|
|
|
[%dot %.y state]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
=/ moves
|
|
|
|
=/ =move [duct %give %mass mass]
|
|
|
|
[move ~]
|
|
|
|
::
|
2019-09-04 22:48:36 +03:00
|
|
|
[moves mall-payload]
|
2019-08-29 21:44:37 +03:00
|
|
|
==
|
|
|
|
:: +load: recreate vane
|
|
|
|
::
|
|
|
|
++ load
|
2019-09-10 06:00:56 +03:00
|
|
|
:: |= *
|
|
|
|
:: mall-payload
|
|
|
|
|= =state-old
|
|
|
|
^+ mall-payload
|
|
|
|
::
|
|
|
|
?- -.state-old
|
2019-11-05 07:19:08 +03:00
|
|
|
%1 mall-payload(state state-old)
|
2019-09-10 06:00:56 +03:00
|
|
|
==
|
2019-08-29 21:44:37 +03:00
|
|
|
:: +scry: standard scry
|
|
|
|
::
|
|
|
|
++ scry
|
2019-09-04 22:48:36 +03:00
|
|
|
~/ %mall-scry
|
2019-08-29 21:44:37 +03:00
|
|
|
|= [fur=(unit (set monk)) =term =shop =desk =coin =path]
|
|
|
|
^- (unit (unit cage))
|
|
|
|
?. ?=(%.y -.shop)
|
|
|
|
~
|
|
|
|
::
|
|
|
|
=/ =ship p.shop
|
|
|
|
?: ?& =(%u term)
|
|
|
|
=(~ path)
|
|
|
|
=([%$ %da now] coin)
|
|
|
|
=(our ship)
|
|
|
|
==
|
|
|
|
=/ =vase !>((~(has by running.agents.state) desk))
|
|
|
|
=/ =cage [%noun vase]
|
|
|
|
(some (some cage))
|
|
|
|
::
|
|
|
|
?. =(our ship)
|
|
|
|
~
|
|
|
|
::
|
|
|
|
?. =([%$ %da now] coin)
|
|
|
|
~
|
|
|
|
::
|
|
|
|
?. (~(has by running.agents.state) desk)
|
|
|
|
(some ~)
|
|
|
|
::
|
|
|
|
?. ?=(^ path)
|
|
|
|
~
|
|
|
|
::
|
|
|
|
=/ initialised mo-abed:mo
|
|
|
|
=/ =routes [~ ship]
|
|
|
|
(mo-peek:initialised desk routes term path)
|
|
|
|
:: +stay: save without cache
|
|
|
|
::
|
|
|
|
++ stay state
|
|
|
|
:: +take: response
|
|
|
|
::
|
|
|
|
++ take
|
2019-09-04 22:48:36 +03:00
|
|
|
~/ %mall-take
|
2019-08-29 21:44:37 +03:00
|
|
|
|= [=wire =duct hin=(hypo sign-arvo)]
|
2019-09-04 22:48:36 +03:00
|
|
|
^- [(list move) _mall-payload]
|
2019-08-29 21:44:37 +03:00
|
|
|
::
|
2019-09-04 22:48:36 +03:00
|
|
|
~| [%mall-take-failed wire]
|
2019-08-29 21:44:37 +03:00
|
|
|
?> ?=([?(%sys %use) *] wire)
|
|
|
|
=/ initialised (mo-abed:mo duct)
|
|
|
|
=/ =sign-arvo q.hin
|
2019-09-29 07:44:31 +03:00
|
|
|
=> ?- i.wire
|
|
|
|
%sys (mo-handle-sys:initialised t.wire sign-arvo)
|
|
|
|
%use (mo-handle-use:initialised t.wire hin)
|
|
|
|
==
|
2019-08-29 21:44:37 +03:00
|
|
|
mo-abet
|
|
|
|
--
|