mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-28 11:40:11 +03:00
Merge branch 'pr' into philip/agent-clay
This commit is contained in:
commit
21acf4fdb5
53
pkg/garden/ted/get-dudes.hoon
Normal file
53
pkg/garden/ted/get-dudes.hoon
Normal file
@ -0,0 +1,53 @@
|
||||
/- spider
|
||||
/+ *strandio
|
||||
::
|
||||
=, strand=strand:spider
|
||||
::
|
||||
:: send on /spider/garden/json/get-dudes/json
|
||||
::
|
||||
|%
|
||||
++ buds :: get agents currently running
|
||||
|= p=desk
|
||||
=/ m (strand ,(list dude:gall))
|
||||
^- form:m
|
||||
?. =(%$ p)
|
||||
;< q=(list dude:gall) bind:m (suds p)
|
||||
(pure:m q)
|
||||
;< q=(list desk) bind:m duds
|
||||
=| r=(list (list dude:gall))
|
||||
|- ^- form:m
|
||||
=* s $
|
||||
?~ q (pure:m (zing r))
|
||||
;< t=(list dude:gall) bind:m (suds i.q)
|
||||
s(q t.q, r [t r])
|
||||
::
|
||||
++ suds :: clean %ge scry
|
||||
|= p=desk
|
||||
=/ m (strand ,(list dude:gall))
|
||||
^- form:m
|
||||
;< q=(set [dude:gall ?]) bind:m
|
||||
(scry (set ,[dude:gall ?]) /ge/(scot %tas p))
|
||||
%- pure:m
|
||||
(murn ~(tap in q) |=([dude:gall ?] ?.(+.+< ~ `-.+<)))
|
||||
::
|
||||
++ duds :: get desks
|
||||
=/ m (strand ,(list desk))
|
||||
^- form:m
|
||||
;< p=(set desk) bind:m (scry (set ,desk) /cd/base)
|
||||
(pure:m ~(tap in p))
|
||||
--
|
||||
::
|
||||
^- thread:spider
|
||||
|= jon=vase
|
||||
=/ m (strand ,vase)
|
||||
^- form:m
|
||||
;< =bowl:spider bind:m get-bowl
|
||||
=, bowl
|
||||
?~ know=!<((unit json) jon)
|
||||
(pure:m !>(`json`[%s 'invalid-request']))
|
||||
?. ?=([%s @] u.know)
|
||||
(pure:m !>(`json`[%s 'invalid-request']))
|
||||
=, format
|
||||
;< breh=(list @tas) bind:m (buds (so:dejs u.know))
|
||||
%- pure:m
|
||||
!>(`json`(frond:enjs 'buds' a+(turn breh |=(@tas s+[+<]))))
|
Loading…
Reference in New Issue
Block a user