hood: WIP compiles but +on-load crashes

This commit is contained in:
Ted Blackman 2020-06-17 03:54:27 -04:00
parent bcf79e38a1
commit d395c2711d
4 changed files with 55 additions and 44 deletions

View File

@ -27,7 +27,7 @@
=| =state
|_ =bowl:gall
+* this .
def ~(. (default-agent this %|) bol)
def ~(. (default-agent this %|) bowl)
drum-core (drum bowl drum.state)
helm-core (helm bowl helm.state)
kiln-core (kiln bowl kiln.state)
@ -37,6 +37,7 @@
^- step:agent:gall
=^ d drum.state on-init:drum-core
[d this]
::
++ on-leave on-leave:def
++ on-peek on-peek:def
++ on-save !>(state)
@ -52,11 +53,11 @@
=-(?>(?=(%kiln -<) ->) (~(got by lac.old) %kiln))
==
==
=/ ver -:*state
=/ ver -.state
=^ d drum.state (on-load:drum-core ver drum.tup)
=^ h helm.state (on-load:helm-core ver helm.tup)
=^ k kiln.state (on-load:kiln-core ver kiln.tup)
[(weld d h k) this]
[:(weld d h k) this]
::
++ on-poke
|= [=mark =vase]
@ -74,9 +75,9 @@
%hood-sync poke-kiln(mark %kiln-sync)
%write-sec-atom poke-helm(mark %helm-write-sec-atom)
==
++ poke-drum =^(c drum.state (poke:drum-core mark vase) [c this]))
++ poke-helm =^(c helm.state (poke:helm-core mark vase) [c this]))
++ poke-kiln =^(c kiln.state (poke:kiln-core mark vase) [c this]))
++ poke-drum =^(c drum.state (poke:drum-core mark vase) [c this])
++ poke-helm =^(c helm.state (poke:helm-core mark vase) [c this])
++ poke-kiln =^(c kiln.state (poke:kiln-core mark vase) [c this])
--
::
++ on-watch
@ -90,17 +91,17 @@
|= [=wire =sign:agent:gall]
^- step:agent:gall
?+ wire ~|([%hood-bad-wire wire] !!)
[%drum *] =^(c drum.state (take-agent:drum-core +<) [c this]))
[%helm *] =^(c helm.state (take-agent:helm-core +<) [c this]))
[%kiln *] =^(c kiln.state (take-agent:kiln-core +<) [c this]))
[%drum *] =^(c drum.state (take-agent:drum-core +<) [c this])
[%helm *] =^(c helm.state (take-agent:helm-core +<) [c this])
[%kiln *] =^(c kiln.state (take-agent:kiln-core +<) [c this])
==
::
++ on-arvo
|= [=wire =sign-arvo]
^- step:agent:gall
?+ wire ~|([%hood-bad-wire wire] !!)
[%drum *] =^(c drum.state (take-arvo:drum-core +<) [c this]))
[%helm *] =^(c helm.state (take-arvo:helm-core +<) [c this]))
[%kiln *] =^(c kiln.state (take-arvo:kiln-core +<) [c this]))
[%drum *] =^(c drum.state (take-arvo:drum-core +<) [c this])
[%helm *] =^(c helm.state (take-arvo:helm-core +<) [c this])
[%kiln *] =^(c kiln.state (take-arvo:kiln-core +<) [c this])
==
--

View File

@ -63,7 +63,7 @@
:: :: ::
|%
++ deft-apes :: default servers
|= [our/ship lit/?]
|= [our=ship lit=?]
%- ~(gas in *(set well:gall))
^- (list well:gall)
:: boot all default apps off the home desk
@ -130,11 +130,17 @@
:: TODO: remove .ost
::
|= [hid=bowl:gall state]
=* sat +<+
=/ ost 0
=+ (~(gut by bin) ost *source)
=* dev -
|_ {moz/(list card:agent:gall) biz/(list dill-blit:dill)}
++ on-init se-abet:se-view:this(eel (deft-fish our.hid))
=| moz=(list card:agent:gall)
=| biz=(list dill-blit:dill)
|%
++ this .
+$ state ^state :: proxy
+$ any-state ^any-state :: proxy
++ on-init se-abet:this(eel (deft-fish our.hid))
++ diff-sole-effect-phat :: app event
|= {way/wire fec/sole-effect}
=< se-abet =< se-view
@ -150,14 +156,15 @@
(se-text "[{<src.hid>}, driving {<our.hid>}]")
::
++ poke-set-boot-apps ::
|= lit/?
^- (quip card:agent:gall part)
|= lit=?
^- (quip card:agent:gall ^state)
:: We do not run se-abet:se-view here because that starts the apps,
:: and some apps are not ready to start (eg Talk crashes because the
:: terminal has width 0). It appears the first message to drum must
:: be the peer.
::
[~ +<+.^$(ray (deft-apes our.hid lit))]
=. ray (deft-apes our.hid lit)
[~ sat]
::
++ poke-dill-belt :: terminal event
|= bet/dill-belt:dill
@ -234,7 +241,7 @@
::
(se-drop & gyl)
::
++ take ::
++ take-arvo
|= [=wire =sign-arvo]
%+ take-onto wire
?> ?=(%onto +<.sign-arvo)
@ -288,10 +295,9 @@
:::: :: ::
:: :: ::
++ se-abet :: resolve
^- (quip card:agent:gall part)
=* pith +<+.$
^- (quip card:agent:gall state)
=. . se-subze:se-adze:se-adit
:_ pith(bin (~(put by bin) ost dev))
:_ sat(bin (~(put by bin) ost dev))
^- (list card:agent:gall)
?~ biz (flop moz)
:_ (flop moz)

View File

@ -1,14 +1,14 @@
/+ pill
=* card card:agent:gall
|%
+$ any-state $%(state state-old)
+$ any-state $%(state state-0)
+$ state
$: %1
mass-timer=[way=wire nex=@da tim=@dr]
==
+$ state-old
$% %0
say=*
+$ state-0 [%0 hoc=(map bone session-0)]
+$ session-0
$: say=*
mud=*
mass-timer=[way=wire nex=@da tim=@dr]
==
@ -16,13 +16,15 @@
++ state-0-to-1
|= s=state-0
^- state
[%1 mass-timer.s]
[%1 mass-timer:(~(got by hoc.s) 0)]
--
|= [=bowl:gall =state]
|= [=bowl:gall sat=state]
=| moz=(list card)
|%
+* this .
++ abet [(flop moz) state]
++ this .
+$ state ^state :: proxy
+$ any-state ^any-state :: proxy
++ abet [(flop moz) sat]
++ flog |=(=flog:dill (emit %pass /di %arvo %d %flog flog))
++ emit |=(card this(moz [+< moz]))
:: +emil: emit multiple cards
@ -37,7 +39,7 @@
=< abet
=? old ?=(%0 -.old) (state-0-to-1 old)
?> ?=(%1 -.old)
this(state old)
this(sat old)
::
++ poke-rekey :: rotate private keys
|= des=@t
@ -49,7 +51,7 @@
?~ sed
~& %invalid-private-key
this
?. =(our who.u.sed)
?. =(our.bowl who.u.sed)
~& [%wrong-private-key-ship who.u.sed]
this
(emit %pass / %arvo %j %rekey lyf.u.sed key.u.sed)
@ -68,7 +70,7 @@
=/ byk=path (en-beam:format byk.bowl(r da+now.bowl) ~)
=+ .^(=tube:clay cc+(welp byk /mime/atom))
=/ =cage atom+(tube !>([/ (as-octs:mimes:html dat)]))
(foal:space:userlib :(welp byk sec+p.hot /atom) cag)
(foal:space:userlib :(welp byk sec+p.hot /atom) cage)
::
++ poke-moon :: rotate moon keys
|= sed=(unit [=ship =udiff:point:able:jael])
@ -83,13 +85,13 @@
::
++ poke-automass
|= recur=@dr
=. mass-timer.state
[/helm/automass (add now recur) recur]
abet:(emit %pass way.mass-timer.state %arvo %b %wait nex.mass-timer.state)
=. mass-timer.sat
[/helm/automass (add now.bowl recur) recur]
abet:(emit %pass way.mass-timer.sat %arvo %b %wait nex.mass-timer.sat)
::
++ poke-cancel-automass
|= ~
abet:(emit %pass way.mass-timer.state %arvo %b %rest nex.mass-timer.state)
abet:(emit %pass way.mass-timer.sat %arvo %b %rest nex.mass-timer.sat)
::
++ poke-pack
|= ~ =< abet
@ -101,11 +103,11 @@
%- (slog u.error)
~& %helm-wake-automass-fail
abet
=. nex.mass-timer.state (add now tim.mass-timer.state)
=. nex.mass-timer.sat (add now.bowl tim.mass-timer.sat)
=< abet
%- emil
:~ [%pass /heft %arvo %d %flog %crud %hax-heft ~]
[%pass way.mass-timer.state %arvo %b %wait nex.mass-timer.state]
[%pass way.mass-timer.sat %arvo %b %wait nex.mass-timer.sat]
==
::
++ poke-send-hi
@ -123,14 +125,14 @@
?: =(%fail mes)
~& %poke-hi-fail
!!
abet:(flog %text "< {<src>}: {(trip mes)}")
abet:(flog %text "< {<src.bowl>}: {(trip mes)}")
::
++ poke-atom
|= ato/@
=+ len=(scow %ud (met 3 ato))
=+ gum=(scow %p (mug ato))
=< abet
(flog %text "< {<src>}: atom: {len} bytes, mug {gum}")
(flog %text "< {<src.bowl>}: atom: {len} bytes, mug {gum}")
::
++ coup-hi
|= {pax/path cop/(unit tang)} =< abet
@ -142,7 +144,7 @@
|: $:{syd/desk all/(list term)} =< abet
%- emil
%+ turn all
=+ top=`path`/(scot %p our)/[syd]/(scot %da now)
=+ top=`path`/(scot %p our.bowl)/[syd]/(scot %da now.bowl)
=/ van/(list {term ~})
:- zus=[%zuse ~]
~(tap by dir:.^(arch %cy (welp top /sys/vane)))
@ -169,7 +171,7 @@
=< abet
%- emil
^- (list card:agent:gall)
=/ top=path /(scot %p our)/home/(scot %da now)/sys
=/ top=path /(scot %p our.bowl)/home/(scot %da now.bowl)/sys
=/ hun .^(@t %cx (welp top /hoon/hoon))
=/ arv .^(@t %cx (welp top /arvo/hoon))
~! *task:able:dill

View File

@ -57,6 +57,8 @@
|= [bowl:gall state]
?> =(src our)
|_ moz=(list card:agent:gall)
+$ state ^state :: proxy
+$ any-state ^any-state :: proxy
++ abet :: resolve
[(flop moz) `state`+<+.$]
::
@ -75,7 +77,7 @@
~[leaf+"from {<sud>}" leaf+"on {<who>}" leaf+"to {<syd>}"]
::
++ on-load
|= old=any-state
|= [hood-version=?(%7) old=any-state]
=< abet
=? . ?=(%0 -.old)
=/ recognized-ota=(unit [syd=desk her=ship sud=desk])