urbit/lib/helm.hoon

230 lines
8.9 KiB
Plaintext
Raw Normal View History

2015-05-11 20:53:47 +03:00
:: :: ::
2015-12-20 14:48:17 +03:00
:::: /hoon/helm/lib :: ::
2015-05-11 20:53:47 +03:00
:: :: ::
/? 310 :: version
2015-09-02 01:20:17 +03:00
/- sole
/+ talk
[. sole]
2015-05-11 20:53:47 +03:00
:: :: ::
:::: :: ::
:: :: ::
|% :: ::
2015-12-09 04:54:26 +03:00
++ helm-part {$helm $0 helm-pith} :: helm state
++ helm-pith :: helm content
2015-12-20 23:50:45 +03:00
$: bur/(unit (pair ship mace)) :: requesting ticket
hoc/(map bone helm-session) :: consoles
2015-05-11 20:53:47 +03:00
== ::
++ helm-session ::
2015-12-20 23:50:45 +03:00
$: say/sole-share :: console state
mud/(unit (sole-dialog @ud)) :: console dialog
2015-05-11 20:53:47 +03:00
== ::
:: :: ::
:::: :: ::
:: :: ::
2015-05-12 03:31:37 +03:00
++ hood-begin :: begin command
2015-12-20 23:50:45 +03:00
$: his/@p :: identity
tic/@p :: ticket
eny/@t :: entropy
ges/gens :: description
2015-05-11 20:53:47 +03:00
== ::
2015-05-12 03:31:37 +03:00
++ hood-init :: report init
2015-12-20 23:50:45 +03:00
$: him/ship ::
2015-05-11 20:53:47 +03:00
== ::
2015-05-12 03:31:37 +03:00
++ hood-reset :: reset command
2015-12-09 04:54:26 +03:00
$~ ::
2015-12-08 03:57:54 +03:00
++ hood-deset :: reset command
2015-12-09 04:54:26 +03:00
$~ ::
2016-01-04 17:27:35 +03:00
++ hood-deone :: reset command
$~ ::
++ hood-detwo :: reset command
$~ ::
2015-05-11 20:53:47 +03:00
++ helm-verb :: reset command
2015-12-09 04:54:26 +03:00
$~ ::
2015-05-12 03:31:37 +03:00
++ hood-reload :: reload command
2015-05-11 20:53:47 +03:00
(list term) ::
-- ::
:: :: ::
:::: :: ::
!: :: ::
2015-12-09 04:54:26 +03:00
|= {bowl helm-part} :: main helm work
2015-09-02 01:20:17 +03:00
=+ sez=(fall (~(get by hoc) ost) *helm-session)
=> |% :: arvo structures
++ card ::
2015-12-20 23:50:45 +03:00
$% {$cash wire p/@p q/buck} ::
2015-12-09 04:54:26 +03:00
{$conf wire dock $load ship term} ::
{$flog wire flog} ::
2016-04-11 05:23:29 +03:00
{$funk wire @p @p @} ::
{$serv wire ?(desk beam)} ::
2015-12-09 04:54:26 +03:00
{$poke wire dock pear} ::
{$wont wire sock path *} :: send message
2015-09-02 01:20:17 +03:00
== ::
++ move (pair bone card) :: user-level move
++ pear :: poke fruit
2015-12-14 10:58:14 +03:00
$% {$hood-unsync desk ship desk} ::
2015-12-09 04:54:26 +03:00
{$talk-command command:talk} ::
{$ask-mail cord} ::
{$helm-hi cord} ::
2015-09-02 01:20:17 +03:00
== ::
--
2015-12-20 23:50:45 +03:00
|_ moz/(list move)
2015-09-02 01:20:17 +03:00
++ abet :: resolve
[(flop moz) %_(+>+>+<+ hoc (~(put by hoc) ost sez))]
::
++ emit |=(card %_(+> moz [[ost +<] moz])) :: return card
++ emil :: return cards
|= (list card)
^+ +>
?~(+< +> $(+< t.+<, +> (emit i.+<)))
::
++ poke-begin :: make/send keypair
|= hood-begin =< abet
2015-12-09 04:54:26 +03:00
?> ?=($~ bur)
=+ buz=(shaz :(mix (jam ges) eny))
=+ loy=(pit:nu:crub:crypto 512 buz)
2015-09-02 01:20:17 +03:00
%- emit(bur `[his [0 sec:ex:loy]~])
[%wont /helm/ticket [our (sein his)] /a/ta his tic ges pub:ex:loy]
::
2016-04-11 05:23:29 +03:00
++ poke-spawn
|= {him/ship key/@pG} =< abet
%- emit
[%funk ~ our him (shax key)]
::
2015-09-02 01:20:17 +03:00
++ poke-init :: initialize
2015-12-20 23:50:45 +03:00
|= him/ship =< abet
2015-12-21 00:16:39 +03:00
(emit %flog /helm %crud %hax-init leaf+(scow %p him) ~)
2015-09-02 01:20:17 +03:00
::
++ poke-mass
2015-12-09 04:54:26 +03:00
|= $~ =< abet
2015-09-02 01:20:17 +03:00
(emit %flog /heft %crud %hax-heft ~)
::
++ poke-send-hi
2015-12-20 23:50:45 +03:00
|= {her/ship mes/(unit tape)} =< abet
2015-09-02 01:20:17 +03:00
%^ emit %poke /helm/hi/(scot %p her)
[[her %hood] %helm-hi ?~(mes '' (crip u.mes))]
::
++ poke-send-ask
2015-12-20 23:50:45 +03:00
|= mel/cord =< abet
%^ emit %poke /helm/ask/(scot %p ~marzod)
[[~marzod %ask] %ask-mail mel]
::
++ poke-serve
|= top/?(desk beam) =< abet
(emit %serv /helm/serv top)
::
2015-12-20 23:50:45 +03:00
++ poke-hi |=(mes/@t abet:(emit %flog /di %text "< {<src>}: {(trip mes)}"))
2015-09-02 01:20:17 +03:00
++ coup-hi
2015-12-20 23:50:45 +03:00
|= {pax/path cop/(unit tang)} =< abet
2015-12-09 04:54:26 +03:00
?> ?=({@t $~} pax)
2016-06-13 18:38:02 +03:00
(emit %flog ~ %text "hi {(trip i.pax)} {?~(cop "" "un")}successful")
2015-09-02 01:20:17 +03:00
::
2016-08-20 00:07:34 +03:00
++ coup-ask
|= {pax/path cop/(unit tang)} =< abet
?> ?=({@t $~} pax)
(emit %flog ~ %text "ask {<src>} {?~(cop "" "un")}successful")
2016-08-20 00:07:34 +03:00
::
2015-12-20 23:50:45 +03:00
++ poke-reload |=(all/(list term) (poke-reload-desk %home all))
2015-09-02 01:20:17 +03:00
++ poke-reload-desk :: reload vanes
2015-12-20 23:50:45 +03:00
|= {syd/desk all/(list term)} =< abet
2015-09-02 01:20:17 +03:00
%- emil
%- flop
%+ turn all
=+ top=`path`/(scot %p our)/[syd]/(scot %da now)/arvo
2016-01-26 03:47:58 +03:00
=+ ark=.^(arch %cy top)
2015-09-06 04:14:00 +03:00
=+ van=(~(tap by dir.ark))
2015-12-20 23:50:45 +03:00
|= nam/@tas
2015-09-02 01:20:17 +03:00
=. nam
?. =(1 (met 3 nam))
nam
=+ ^- zaz/(list {p/knot $~})
2015-12-20 23:50:45 +03:00
(skim van |=({a/term $~} =(nam (end 3 1 a))))
2015-12-10 12:17:19 +03:00
?> ?=({{@ $~} $~} zaz)
2015-09-02 01:20:17 +03:00
`term`p.i.zaz
=+ tip=(end 3 1 nam)
=+ way=(welp top /[nam])
2016-01-26 03:47:58 +03:00
=+ fil=.^(@ %cx (welp way /hoon))
2015-09-02 01:20:17 +03:00
[%flog /reload [%veer ?:(=('z' tip) %$ tip) way fil]]
::
++ poke-invite :: send invite; fake
2015-12-20 23:50:45 +03:00
|= {who/@p myl/@t} =< abet
2015-09-02 01:20:17 +03:00
%^ emit %poke /helm/invite
:- [our %talk]
(said:talk our %helm now eny [%leaf "invited: {<who>} at {(trip myl)}"]~)
::
++ poke-reset :: reset system
|= hood-reset =< abet
%- emil
%- flop ^- (list card)
=+ top=`path`/(scot %p our)/home/(scot %da now)/arvo
:- [%flog /reset %vega (weld top `path`/hoon)]
%+ turn
2015-12-20 23:50:45 +03:00
^- (list {p/@tas q/@tas})
2015-09-02 01:20:17 +03:00
:~ [%$ %zuse]
[%a %ames]
[%b %behn]
[%c %clay]
[%d %dill]
[%e %eyre]
[%f %ford]
[%g %gall]
2015-05-11 20:53:47 +03:00
==
2015-12-20 23:50:45 +03:00
|= {p/@tas q/@tas}
2015-09-02 01:20:17 +03:00
=+ way=`path`(welp top /[q])
2016-01-26 03:47:58 +03:00
=+ txt=.^(@ %cx (welp way /hoon))
2015-09-02 01:20:17 +03:00
[%flog /reset %veer p way txt]
::
2015-12-08 03:57:54 +03:00
++ poke-deset :: deset system
|= hood-deset =< abet
%- emil
%- flop ^- (list card)
=+ top=`path`/(scot %p our)/home/(scot %da now)/arvo
:- [%flog /deset %vega (weld top `path`/hoon)]
~
::
2016-01-04 17:27:35 +03:00
++ poke-deone :: deset system
|= hood-deone =< abet
%- emil
%- flop ^- (list card)
=+ top=`path`/(scot %p our)/home/(scot %da now)/arvo
2016-01-04 18:13:22 +03:00
:~ [%flog /deset %vega (weld top `path`/one)]
[%flog /deset %vega (weld top `path`/two)]
==
2016-01-04 17:27:35 +03:00
::
++ poke-detwo :: deset system
|= hood-detwo =< abet
%- emil
%- flop ^- (list card)
=+ top=`path`/(scot %p our)/home/(scot %da now)/arvo
:- [%flog /deset %vega (weld top `path`/two)]
~
::
2015-09-02 01:20:17 +03:00
++ poke-will :: hear certificate
2015-12-20 23:50:45 +03:00
|= wil/(unit will)
2015-09-02 01:20:17 +03:00
?> ?=(^ bur)
?> ?=(^ wil)
=< abet
%- emil(bur ~)
:~ [%cash /helm p.u.bur q.u.bur u.wil]
[%poke /helm [our %hood] %hood-unsync %base (sein our) %kids]
==
::
++ poke-verb :: toggle verbose
2015-12-09 04:54:26 +03:00
|= $~ =< abet
2015-09-02 01:20:17 +03:00
(emit %flog /helm %verb ~)
::
++ take-onto :: result of %conf
|= saw/(each suss:gall tang) =< abet
2015-09-02 01:20:17 +03:00
%- emit
?- -.saw
$| [%flog ~ %crud %onto `tang`p.saw]
$& [%flog ~ %text "<{<p.saw>}>"]
2015-09-02 01:20:17 +03:00
==
::
++ take-note :: result of %init
2015-12-20 23:50:45 +03:00
|= {way/wire chr/@tD tan/tank} =< abet
2015-09-02 01:20:17 +03:00
(emit %flog ~ %text chr ' ' ~(ram re tan))
::
++ take-woot :: result of %wont
2015-12-20 23:50:45 +03:00
|= {way/wire her/ship cop/coop} =< abet
2015-09-02 01:20:17 +03:00
(emit %flog ~ %text "woot: {<[way cop]>}")
2015-05-11 20:53:47 +03:00
--