mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-19 04:41:37 +03:00
66 lines
1.3 KiB
Plaintext
66 lines
1.3 KiB
Plaintext
:: %khan, thread runner
|
|
!:
|
|
!? 164
|
|
::
|
|
|= our=ship
|
|
=> |%
|
|
+$ move [p=duct q=(wite note gift:khan)]
|
|
+$ note :: out request $->
|
|
!!
|
|
+$ sign :: in response $<-
|
|
!!
|
|
+$ khan-state
|
|
$: %0
|
|
unix-duct=duct
|
|
==
|
|
--
|
|
=| khan-state
|
|
=* state -
|
|
|= [now=@da eny=@uvJ rof=roof]
|
|
=* khan-gate .
|
|
^?
|
|
|%
|
|
:: +call: handle a +task:khan request
|
|
::
|
|
++ call
|
|
|= $: hen=duct
|
|
dud=(unit goof)
|
|
wrapped-task=(hobo task:khan)
|
|
==
|
|
^- [(list move) _khan-gate]
|
|
::
|
|
=/ =task:khan ((harden task:khan) wrapped-task)
|
|
?- -.task
|
|
%vega
|
|
[~ khan-gate]
|
|
%trim
|
|
[~ khan-gate]
|
|
%born
|
|
[~ khan-gate(unix-duct hen)]
|
|
%fyrd
|
|
:: send to gall, sub for updates
|
|
!!
|
|
==
|
|
:: +load: migrate an old state to a new khan version
|
|
::
|
|
++ load
|
|
|= old=khan-state
|
|
^+ khan-gate
|
|
khan-gate(state old)
|
|
:: +scry: view khan state
|
|
::
|
|
++ scry
|
|
^- roon
|
|
|= [lyc=gang car=term bem=beam]
|
|
^- (unit (unit cage))
|
|
~
|
|
++ stay state
|
|
++ take
|
|
|= [tea=wire hen=duct dud=(unit goof) hin=sign]
|
|
^- [(list move) _khan-gate]
|
|
?^ dud
|
|
~|(%khan-take-dud (mean tang.u.dud))
|
|
:: switch on type of thing you get back, update state
|
|
[~ khan-gate]
|
|
--
|