mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-12 05:04:56 +03:00
lib/agentio: add helper library for constructing cards
This commit is contained in:
parent
ef289cf282
commit
30b551323b
103
pkg/arvo/lib/agentio.hoon
Normal file
103
pkg/arvo/lib/agentio.hoon
Normal file
@ -0,0 +1,103 @@
|
||||
=>
|
||||
|%
|
||||
++ card card:agent:gall
|
||||
--
|
||||
::
|
||||
|_ =bowl:gall
|
||||
++ scry
|
||||
|* [desk=@tas =path]
|
||||
?> ?=(^ path)
|
||||
?> ?=(^ t.path)
|
||||
%+ weld
|
||||
/(scot %p our.bowl)/[desk]/(scot %da now.bowl)
|
||||
t.t.path
|
||||
::
|
||||
++ pass
|
||||
|_ =wire
|
||||
++ poke
|
||||
|= [=dock =cage]
|
||||
[%pass wire %agent dock %poke cage]
|
||||
::
|
||||
++ poke-our
|
||||
|= [app=term =cage]
|
||||
^- card
|
||||
(poke [our.bowl app] cage)
|
||||
::
|
||||
++ arvo
|
||||
|= =note-arvo
|
||||
^- card
|
||||
[%pass wire %arvo note-arvo]
|
||||
::
|
||||
++ watch
|
||||
|= [=dock =path]
|
||||
[%pass (watch-wire path) %agent dock %watch path]
|
||||
::
|
||||
++ watch-our
|
||||
|= [app=term =path]
|
||||
(watch [our.bowl app] path)
|
||||
::
|
||||
++ watch-wire
|
||||
|= =path
|
||||
^+ wire
|
||||
?. ?=(~ wire)
|
||||
wire
|
||||
agentio-watch+path
|
||||
::
|
||||
++ leave
|
||||
|= =dock
|
||||
[%pass wire %agent dock %leave ~]
|
||||
::
|
||||
++ leave-our
|
||||
|= app=term
|
||||
(leave our.bowl app)
|
||||
::
|
||||
++ leave-path
|
||||
|= [=dock =path]
|
||||
=. wire
|
||||
(watch-wire path)
|
||||
(leave dock)
|
||||
::
|
||||
++ wait
|
||||
|= p=@da
|
||||
(arvo %b %wait p)
|
||||
::
|
||||
++ rest
|
||||
|= p=@da
|
||||
(arvo %b %wait p)
|
||||
::
|
||||
++ warp
|
||||
|= [wer=ship =riff:clay]
|
||||
(arvo %c %warp wer riff)
|
||||
::
|
||||
++ warp-our
|
||||
|= =riff:clay
|
||||
(warp our.bowl riff)
|
||||
::
|
||||
:: right here, right now
|
||||
++ warp-slim
|
||||
|= [genre=?(%sing %next) =care:clay =path]
|
||||
=/ =mood:clay
|
||||
[care r.byk.bowl path]
|
||||
=/ =rave:clay
|
||||
?:(?=(%sing genre) [genre mood] [genre mood])
|
||||
(warp-our q.byk.bowl `rave)
|
||||
--
|
||||
::
|
||||
++ fact-curry
|
||||
|* [=mark =mold]
|
||||
|= [paths=(list path) fac=mold]
|
||||
(fact mark^!>(fac) paths)
|
||||
::
|
||||
++ fact
|
||||
|= [=cage paths=(list path)]
|
||||
^- card
|
||||
[%give %fact paths cage]
|
||||
::
|
||||
++ kick
|
||||
|= paths=(list path)
|
||||
[%give %kick paths ~]
|
||||
::
|
||||
++ kick-only
|
||||
|= [=ship paths=(list path)]
|
||||
[%give %kick paths `ship]
|
||||
--
|
Loading…
Reference in New Issue
Block a user