Merge branch 'master' into jb/release/vere

This commit is contained in:
Joe Bryan 2022-12-16 23:07:10 -05:00 committed by GitHub
commit 9a16d670e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
111 changed files with 65060 additions and 94984 deletions

3
.husky/post-checkout Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-checkout.\n"; exit 2; }
git lfs post-checkout "$@"

3
.husky/post-commit Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-commit.\n"; exit 2; }
git lfs post-commit "$@"

3
.husky/post-merge Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-merge.\n"; exit 2; }
git lfs post-merge "$@"

3
.husky/pre-push Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/pre-push.\n"; exit 2; }
git lfs pre-push "$@"

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:2f46209c31bc7be965b6ba32db92fb0746be15d9613b1c3c8d09ce7fa0e5e157 oid sha256:ea8626444e4f0213e39c21ded20607145ee85a947afc592f182f46e7f598ef30
size 8280141 size 7748671

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:d737f88463f683173b5f6cbf41fc38705d4d3d67263c675d7e99841cd8485d81 oid sha256:40bc203b8a2d2ebad81723da6fc946ee32d2f8a204884f50f9710177ae257d08
size 6026086 size 5712264

View File

@ -7,6 +7,7 @@
:: OR :: OR
:: :aqua &pill +solid :: :aqua &pill +solid
:: ::
:: XX: update these examples
:: Then try stuff: :: Then try stuff:
:: :aqua [%init ~[~bud ~dev]] :: :aqua [%init ~[~bud ~dev]]
:: :aqua [%dojo ~[~bud ~dev] "[our eny (add 3 5)]"] :: :aqua [%dojo ~[~bud ~dev] "[our eny (add 3 5)]"]
@ -480,14 +481,15 @@
=^ ms state (poke-pill pil) =^ ms state (poke-pill pil)
(emit-cards ms) (emit-cards ms)
:: ::
[%swap-files ~] [%swap-files @tas]
=/ =desk +.val
=. userspace-ova.pil =. userspace-ova.pil
=/ slim-dirs=(list path) :: take all files from a userspace desk
~[/app /ted /gen /lib /mar /sur /hoon/sys /arvo/sys /zuse/sys] =/ all-dirs=(list path) ~[/]
:_ ~ :_ ~
%- unix-event:pill-lib %- unix-event:pill-lib
%- %*(. file-ovum:pill-lib directories slim-dirs) %+ %*(. file-ovum:pill-lib directories all-dirs)
/(scot %p our.hid)/work/(scot %da now.hid) desk /(scot %p our.hid)/[desk]/(scot %da now.hid)
=^ ms state (poke-pill pil) =^ ms state (poke-pill pil)
(emit-cards ms) (emit-cards ms)
:: ::

View File

@ -281,7 +281,7 @@
:: restart %eth-watcher :: restart %eth-watcher
:: ::
~& >> %starting-eth-watcher ~& >> %starting-eth-watcher
=/ rein=[desk rein] [%base %.y [%eth-watcher ~ ~] ~] =/ rein=[desk rein] [%base [%eth-watcher %&] ~ ~]
:_ cards :_ cards
[%pass /rein %agent [our.bowl %hood] %poke kiln-rein+!>(rein)] [%pass /rein %agent [our.bowl %hood] %poke kiln-rein+!>(rein)]
=. cards =. cards

View File

@ -174,8 +174,10 @@
:: ::
;~ pfix fas ;~ pfix fas
;~ pose ;~ pose
(parse-variable (cold %sur hep) ;~(pfix gap parse-cables)) (parse-variable (cold %sur hep) ;~(pfix gap (parse-cables %sur)))
(parse-variable (cold %lib lus) ;~(pfix gap parse-cables)) (parse-variable (cold %lib lus) ;~(pfix gap (parse-cables %lib)))
;~(pfix tis gap (parse-variable sym ;~(pfix gap parse-path)))
;~(pfix cen gap (parse-variable sym ;~(pfix gap parse-mark)))
== ==
== ==
:: ::
@ -194,22 +196,17 @@
== ==
:: ::
++ parse-cables ++ parse-cables
%+ cook |= base-path=@ta
|= cables=(list cable:clay) %- cook :_ (most ;~(plug com gaw) parse-cable)
:+ 0 %ex |= cables=(list cable:clay)
^- hoon :+ 0 %tu
:: ::
:- %clsg %+ turn cables
%+ turn cables |= cable=cable:clay
|= cable=cable:clay ^- dojo-source
^- hoon =+ add-face=?~(face.cable "|*(n=* n)" ;:(weld "|*(n=* ^=(" (trip u.face.cable) " n))"))
:: :^ 0 %do (scan add-face parse-hoon)
:+ %clhp :+ 0 %dv [-.dir `path`[base-path file-path.cable ~]]
?~ face.cable
[%rock %n ~]
[%clhp [%rock %n ~] [%sand %tas u.face.cable]]
[%sand %tas file-path.cable]
(most ;~(plug com gaw) parse-cable)
:: ::
++ parse-cable ++ parse-cable
%+ cook |=(a=cable:clay a) %+ cook |=(a=cable:clay a)
@ -218,6 +215,16 @@
(cook |=([face=term tis=@ file=term] [`face file]) ;~(plug sym tis sym)) (cook |=([face=term tis=@ file=term] [`face file]) ;~(plug sym tis sym))
(cook |=(a=term [`a a]) sym) (cook |=(a=term [`a a]) sym)
== ==
::
++ parse-mark
%- cook :_ ;~(pfix cen sym)
|= mark=@tas
[0 %dv -.dir `path`[~.mar mark ~]]
::
++ parse-path
%+ cook |=(=path [0 %dv -.dir path])
;~(pfix fas (more fas sym))
::
++ parse-source (stag 0 parse-build) ++ parse-source (stag 0 parse-build)
++ parse-build ++ parse-build
%+ knee *dojo-build |. ~+ %+ knee *dojo-build |. ~+
@ -537,8 +544,6 @@
=. var (~(del by var) p.mad) =. var (~(del by var) p.mad)
=< dy-amok =< dy-amok
?+ p.mad . ?+ p.mad .
%lib .(lib ~)
%sur .(sur ~)
%dir .(dir [[our.hid %base ud+0] /]) %dir .(dir [[our.hid %base ud+0] /])
== ==
=+ cay=(~(got by rez) p.q.mad) =+ cay=(~(got by rez) p.q.mad)
@ -550,29 +555,19 @@
~| bad-set+[p.p.mad p.q.cay] ~| bad-set+[p.p.mad p.q.cay]
=< dy-amok =< dy-amok
?+ p.p.mad . ?+ p.p.mad .
%lib %dir
%_ . =/ bem=beam
lib %- need %- de-beam
((dy-cast (list cable:clay) !>(*(list cable:clay))) q.cay) =+ pax=((dy-cast path !>(*path)) q.cay)
== ?: ?=(~ pax) ~[(scot %p our.hid) %base '0']
:: ?: ?=([@ ~] pax) ~[i.pax %base '0']
%sur ?: ?=([@ @ ~] pax) ~[i.pax i.t.pax '0']
%_ . pax
sur ?: =(~ .^((list path) %ct (en-beam he-beam(dir bem))))
((dy-cast (list cable:clay) !>(*(list cable:clay))) q.cay) +(..dy (he-diff %tan 'dojo: dir does not exist' ~))
== =. dir bem
:: =- +>(..dy (he-diff %tan - ~))
%dir =+ ^= pax ^- path rose+[" " `~]^~[leaf+"=%" (smyt (en-beam he-beak s.dir))]
=+ pax=((dy-cast path !>(*path)) q.cay)
?: ?=(~ pax) ~[(scot %p our.hid) %base '0']
?: ?=([@ ~] pax) ~[i.pax %base '0']
?: ?=([@ @ ~] pax) ~[i.pax i.t.pax '0']
pax
?: =(~ .^((list path) %ct pax))
+(..dy (he-diff %tan 'dojo: dir does not exist' ~))
=. dir (need (de-beam pax))
=- +>(..dy (he-diff %tan - ~))
rose+[" " `~]^~[leaf+"=%" (smyt (en-beam he-beak s.dir))]
== ==
:: ::
%poke %poke

View File

@ -2,8 +2,8 @@
/+ drum=hood-drum, helm=hood-helm, kiln=hood-kiln /+ drum=hood-drum, helm=hood-helm, kiln=hood-kiln
|% |%
+$ state +$ state
$~ [%23 *state:drum *state:helm *state:kiln] $~ [%24 *state:drum *state:helm *state:kiln]
$>(%23 any-state) $>(%24 any-state)
:: ::
+$ any-state +$ any-state
$% [ver=?(%1 %2 %3 %4 %5 %6) lac=(map @tas fin-any-state)] $% [ver=?(%1 %2 %3 %4 %5 %6) lac=(map @tas fin-any-state)]
@ -24,6 +24,7 @@
[%21 drum=state-4:drum helm=state-1:helm kiln=state-8:kiln] [%21 drum=state-4:drum helm=state-1:helm kiln=state-8:kiln]
[%22 drum=state-4:drum helm=state-1:helm kiln=state-9:kiln] [%22 drum=state-4:drum helm=state-1:helm kiln=state-9:kiln]
[%23 drum=state-4:drum helm=state-2:helm kiln=state-9:kiln] [%23 drum=state-4:drum helm=state-2:helm kiln=state-9:kiln]
[%24 drum=state-4:drum helm=state-2:helm kiln=state-10:kiln]
== ==
+$ any-state-tuple +$ any-state-tuple
$: drum=any-state:drum $: drum=any-state:drum

View File

@ -166,10 +166,10 @@
(on-load on-save) (on-load on-save)
=^ cards state =^ cards state
?+ mark (on-poke:def mark vase) ?+ mark (on-poke:def mark vase)
%spider-input (on-poke-input:sc !<(input vase)) %spider-input (on-poke-input:sc !<(input vase))
%spider-start (handle-start-thread:sc !<(start-args:spider vase)) %spider-start (handle-start-thread:sc !<(start-args:spider vase))
%spider-stop (handle-stop-thread:sc !<([tid ?] vase)) %spider-inline (handle-inline-thread:sc !<(inline-args:spider vase))
:: %spider-stop (handle-stop-thread:sc !<([tid ?] vase))
%handle-http-request %handle-http-request
(handle-http-request:sc !<([@ta =inbound-request:eyre] vase)) (handle-http-request:sc !<([@ta =inbound-request:eyre] vase))
== ==
@ -303,12 +303,31 @@
++ handle-start-thread ++ handle-start-thread
~/ %handle-start-thread ~/ %handle-start-thread
|= [parent-tid=(unit tid) use=(unit tid) =beak file=term =vase] |= [parent-tid=(unit tid) use=(unit tid) =beak file=term =vase]
(prep-thread parent-tid use beak %| file vase)
::
++ handle-inline-thread
~/ %handle-inline-thread
|= [parent-tid=(unit tid) use=(unit tid) =beak =shed:khan]
(prep-thread parent-tid use beak %& shed)
::
++ prep-thread
|= $: parent-tid=(unit tid) use=(unit tid) =beak
source=(each shed:khan [file=term =vase])
==
^- (quip card ^state) ^- (quip card ^state)
=/ parent-yarn=yarn =/ parent-yarn=yarn
?~ parent-tid ?~ parent-tid
/ /
(~(got by tid.state) u.parent-tid) (~(got by tid.state) u.parent-tid)
=/ new-tid (fall use (new-thread-id file)) =/ new-tid
?^ use
u.use
%- new-thread-id
?- -.source
%& (cat 3 'inline-' q.beak)
%| file.p.source
==
::
=/ =yarn (snoc parent-yarn new-tid) =/ =yarn (snoc parent-yarn new-tid)
:: ::
?: (~(has of running.state) yarn) ?: (~(has of running.state) yarn)
@ -321,16 +340,19 @@
=? serving.state !(~(has by serving.state) new-tid) =? serving.state !(~(has by serving.state) new-tid)
(~(put by serving.state) new-tid [~ %noun q.beak]) (~(put by serving.state) new-tid [~ %noun q.beak])
:: ::
=: starting.state (~(put by starting.state) yarn [%build vase]) =. tid.state (~(put by tid.state) new-tid yarn)
tid.state (~(put by tid.state) new-tid yarn) ?- -.source
%& (begin-shed yarn p.source)
%|
=. starting.state (~(put by starting.state) yarn [%build vase.p.source])
=/ pax=path
~| no-file-for-thread+file.p.source
(need (get-fit:clay beak %ted file.p.source))
:_ state
:_ ~
:+ %pass /build/[new-tid]
[%arvo %c %warp p.beak q.beak ~ %sing %a r.beak pax]
== ==
=/ pax=path
~| no-file-for-thread+file
(need (get-fit:clay beak %ted file))
:_ state
:_ ~
:+ %pass /build/[new-tid]
[%arvo %c %warp p.beak q.beak ~ %sing %a r.beak pax]
:: ::
++ handle-build ++ handle-build
~/ %handle-build ~/ %handle-build
@ -349,23 +371,25 @@
=/ maybe-thread (mule |.(!<(thread !<(vase q.r.u.riot)))) =/ maybe-thread (mule |.(!<(thread !<(vase q.r.u.riot))))
?: ?=(%| -.maybe-thread) ?: ?=(%| -.maybe-thread)
(thread-fail-not-running tid %thread-not-thread ~) (thread-fail-not-running tid %thread-not-thread ~)
(start-thread yarn p.maybe-thread) (slam-thread yarn p.maybe-thread)
:: ::
++ start-thread ++ slam-thread
~/ %start-thread ~/ %slam-thread
|= [=yarn =thread] |= [=yarn =thread]
^- (quip card ^state) ^- (quip card ^state)
=/ =vase vase:(~(got by starting.state) yarn) =/ =vase vase:(~(got by starting.state) yarn)
?< (~(has of running.state) yarn)
=/ m (strand ,^vase)
=/ res (mule |.((thread vase))) =/ res (mule |.((thread vase)))
?: ?=(%| -.res) ?: ?=(%| -.res)
(thread-fail-not-running (yarn-to-tid yarn) %false-start p.res) (thread-fail-not-running (yarn-to-tid yarn) %false-start p.res)
=/ =eval-form:eval:m =. starting.state (~(del by starting.state) yarn)
(from-form:eval:m p.res) (begin-shed yarn p.res)
=: starting.state (~(del by starting.state) yarn) ::
running.state (~(put of running.state) yarn eval-form) ++ begin-shed
== |= [=yarn =shed:khan]
?< (~(has of running.state) yarn)
=/ m (strand ,vase)
=/ =eval-form:eval:m (from-form:eval:m shed)
=. running.state (~(put of running.state) yarn eval-form)
(take-input yarn ~) (take-input yarn ~)
:: ::
++ handle-stop-thread ++ handle-stop-thread

View File

@ -1,14 +0,0 @@
:: Helm: Reload vane/s from /=base=
::
:::: /hoon/breload/hood/gen
::
/? 310
::
::::
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[arg=(list term) ~]
==
:+ %helm-reload-desk %base
arg

View File

@ -1,7 +1,3 @@
:- %say :- %say
|= $: [now=@da eny=@uvJ bec=beak] |= [[now=@da eny=@uvJ bec=beak] ~ ~]
~ [%kiln-bump ~]
force=_|
except=(set desk)
==
[%kiln-bump except force]

View File

@ -0,0 +1,50 @@
:: |new-desk: creates a minimal desk
::
/+ *generators
::
:- %ask
|= $: [now=@da eny=@uvJ bek=beak]
[=desk ~]
[from=$~(%base desk) hard=_|]
==
::
=; make-new-desk
?. ?& !hard
(~(has in .^((set ^desk) %cd (en-beam bek(q %$) /))) desk)
==
(make-new-desk)
%+ print (rap 3 'the desk %' desk ' already exists. overwrite it?' ~)
%+ prompt [%& %prompt "overwrite? (y/N) "]
|= in=tape
?. |(=("y" in) =("Y" in) =("yes" in))
no-product
(make-new-desk)
::
|. %- produce
:- %helm-pass
%^ new-desk:cloy desk
~
%- ~(gas by *(map path page:clay))
|^ =- (turn - mage)
^- (list path)
:~ /mar/noun/hoon
/mar/hoon/hoon
/mar/txt/hoon
/mar/kelvin/hoon
/sys/kelvin
==
::
++ mage
|= =path
:- path
^- page:clay
:- (rear path)
~| [%missing-source-file from path]
.^ *
%cx
(scot %p p.bek)
from
(scot %da now)
path
==
--

View File

@ -8,11 +8,7 @@
== ==
:- %kiln-rein :- %kiln-rein
:- desk :- desk
=+ .^(=cone:clay %cx /(scot %p p.bec)//(scot %da now)/domes)
%+ roll arg %+ roll arg
=/ =rein:hood |: [*[on=? =dude:gall] rein=ren:(~(got by cone) [p.bec desk])]
=< rein.arak (~(put by rein) dude on)
.^(vat:hood %gx /(scot %p p.bec)/hood/(scot %da now)/kiln/vat/[desk]/noun)
|: [*[on=? =dude:gall] rein=rein(liv liv)]
?: on
rein(add (~(put in add.rein) dude))
rein(sub (~(put in sub.rein) dude))

View File

@ -15,4 +15,7 @@
?@ +.arg [q.bec -.arg] ?@ +.arg [q.bec -.arg]
?> ((sane %tas) +<.arg) ?> ((sane %tas) +<.arg)
[-.arg +<.arg] [-.arg +<.arg]
[%kiln-rein des & [dap ~ ~] ~] =+ .^(=cone:clay %cx /(scot %p p.bec)//(scot %da now)/domes)
=/ =foam:clay (~(gut by cone) [p.bec des] *foam:clay)
=+ ((slog ?:(=(%live liv.foam) ~ ['kiln: desk not live' ~])) ~)
[%kiln-rein des (~(put by ren.foam) dap &)]

View File

@ -13,8 +13,7 @@
=/ =lobe u.fil.arch =/ =lobe u.fil.arch
=+ .^(=rang %cx /(scot %p p.bec)//(scot %da now)/rang) =+ .^(=rang %cx /(scot %p p.bec)//(scot %da now)/rang)
=+ .^(=cone %cx /(scot %p p.bec)//(scot %da now)/domes) =+ .^(=cone %cx /(scot %p p.bec)//(scot %da now)/domes)
=/ domes=(list [[=ship =desk] =dome tom=(map tako norm) nor=norm]) =/ domes=(list [[=ship =desk] foam]) ~(tap by cone)
~(tap by cone)
=/ norms =/ norms
|^ |^
|- ^- (set [ship desk tako norm path]) |- ^- (set [ship desk tako norm path])
@ -24,14 +23,14 @@
=/ =aeon 1 =/ =aeon 1
%- ~(uni in $(domes t.domes)) %- ~(uni in $(domes t.domes))
|- ^- (set [ship desk tako norm path]) |- ^- (set [ship desk tako norm path])
?: (lth let.dome.i.domes aeon) ?: (lth let.i.domes aeon)
~ ~
=/ =tako (~(got by hit.dome.i.domes) aeon) =/ =tako (~(got by hit.i.domes) aeon)
=/ paths (draw-tako ship.i.domes desk.i.domes +.i.domes tako) =/ paths (draw-tako ship.i.domes desk.i.domes +.i.domes tako)
(~(uni in paths) $(aeon +(aeon))) (~(uni in paths) $(aeon +(aeon)))
:: ::
++ draw-tako ++ draw-tako
|= [=ship =desk [dome tom=(map tako norm) nor=norm] =tako] |= [=ship =desk foam =tako]
^- (set [^ship ^desk ^tako norm path]) ^- (set [^ship ^desk ^tako norm path])
~+ ~+
=/ =yaki (~(got by hut.rang) tako) =/ =yaki (~(got by hut.rang) tako)

View File

@ -1,14 +0,0 @@
:: Kiln: merge each version of remote desk? XX clarify
::
:::: /hoon/track/hood/gen
::
/? 310
::
::::
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[arg=[syd=@tas her=@p sud=@tas ~] ~]
==
:- %kiln-track
[syd her sud]:arg

View File

@ -8,7 +8,7 @@
%- flop ^- tang %- flop ^- tang
%- zing %- zing
%+ turn ~(tap by cone) %+ turn ~(tap by cone)
|= [[=ship =desk] dome tom=(map tako norm) nor=norm] |= [[=ship =desk] foam]
:- leaf+"{<ship>}/{<desk>}:" :- leaf+"{<ship>}/{<desk>}:"
%+ turn ~(tap of nor) %+ turn ~(tap of nor)
|= [=path keep=?] |= [=path keep=?]

View File

@ -77,10 +77,8 @@
~& %solid-double-loaded ~& %solid-double-loaded
=/ whole-formula =/ whole-formula
=< + =< +
.* 0 .* [%noun whole-src]
:+ %7 [%8 compiler-formula [%9 2 %10 [6 %0 3] [%0 2]]]
compiler-formula
[%9 2 %10 [6 %1 %noun whole-src] [%0 1]]
~& %solid-double-compiled ~& %solid-double-compiled
whole-formula whole-formula
:: ::
@ -100,24 +98,19 @@
|= [ovo=ovum ken=*] |= [ovo=ovum ken=*]
[~ (slum ken [now ovo])] [~ (slum ken [now ovo])]
:: ::
:: kernel-formula :: boot-two: startup formula
:: ::
:: We evaluate :arvo-formula (for jet registration), :: We evaluate :arvo-formula (for jet registration),
:: then ignore the result and produce .installed :: then ignore the result and produce .installed
:: ::
=/ kernel-formula
[%7 arvo-formula %1 installed]
::
:: boot-two: startup formula
::
=/ boot-two =/ boot-two
=> [kernel-formula=** main-sequence=**] => *[arvo-formula=^ installed=^ tale=*]
!= [.*(0 kernel-formula) main-sequence] != =+(.*(0 arvo-formula) [installed tale])
:: ::
:: boot-ova :: boot-ova
:: ::
=/ boot-ova=(list) =/ boot-ova=(list)
[aeon:eden:part boot-two kernel-formula ~] [aeon:eden:part boot-two arvo-formula installed ~]
:: ::
:: a pill is a 3-tuple of event-lists: [boot kernel userspace] :: a pill is a 3-tuple of event-lists: [boot kernel userspace]
:: ::

View File

@ -3,6 +3,8 @@
:::: ::::
:: ::
/- *story /- *story
/$ story-to-txt %story %txt
::
:- %say :- %say
|= $: [now=@da eny=@uvJ bec=beak] |= $: [now=@da eny=@uvJ bec=beak]
[[~] =desk ~] [[~] =desk ~]
@ -15,9 +17,6 @@
tang+[leaf+"Error: desk {<desk>} does not exist." ~] tang+[leaf+"Error: desk {<desk>} does not exist." ~]
?: !.^(? %cu pax) ?: !.^(? %cu pax)
tang+['Error: No story file found. Please use |story-init to create one.' ~] tang+['Error: No story file found. Please use |story-init to create one.' ~]
=/ story-to-txt
.^($-(story wain) %cf /(scot %p our)/[desk]/(scot cas)/story/txt)
::
=/ tale .^(story %cx pax) =/ tale .^(story %cx pax)
=/ tale-text (story-to-txt tale) =/ tale-text (flop (story-to-txt tale))
tang+tale-text tang+tale-text

View File

@ -48,7 +48,7 @@
?- reverse-ancestors ?- reverse-ancestors
~ ~
:: stop here and return the current message :: stop here and return the current message
=/ msg=(list cord) (msg-from-commit this-commit tale) =/ msg=wain (msg-from-commit this-commit tale)
[(weld msg result.state) mergebase=~] [(weld msg result.state) mergebase=~]
:: ::
[tako:clay ~] [tako:clay ~]
@ -103,8 +103,7 @@
=/ mainline-commit =/ mainline-commit
.^(yaki:clay %cs /(scot %p our)/[syd]/(scot cas)/yaki/(scot %uv mainline)) .^(yaki:clay %cs /(scot %p our)/[syd]/(scot cas)/yaki/(scot %uv mainline))
:: ::
=/ msg=(list cord) =/ msg=wain (msg-from-commit this-commit tale)
(msg-from-commit this-commit tale)
:: ::
:: 1 - process current commit :: 1 - process current commit
:: 2 - recur and queue processing on all commits on the sideline :: 2 - recur and queue processing on all commits on the sideline
@ -141,14 +140,9 @@
:: ::
++ msg-from-commit ++ msg-from-commit
|= [commit=yaki:clay tale=story] |= [commit=yaki:clay tale=story]
^- (list cord) ^- wain
=/ proses (~(get by tale) r.commit) =/ proses (~(get ju tale) r.commit)
?~ proses ~ ?~ proses ~
%- flop :: fixes formatting reversal in dojo %- flop :: fixes formatting reversal in dojo
%- to-wain:format (chapter-to-text:lib r.commit proses)
%- crip
;: welp
(tako-to-text:lib r.commit)
(proses-to-text:lib u.proses)
==
-- --

View File

@ -3,8 +3,4 @@
|= $: [now=@da eny=@uvJ bec=beak] |= $: [now=@da eny=@uvJ bec=beak]
[[=desk ~] ~] [[=desk ~] ~]
== ==
?: =(desk %kids) [%tang ~[(report-kids p.bec now)]] [%tang ~[(report-vat (report-prep p.bec now) p.bec now desk)]]
=+ .^ =vat %gx
/(scot %p p.bec)/hood/(scot %da now)/kiln/vat/[desk]/noun
==
[%tang ~[(report-vat p.bec now vat)]]

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +1,13 @@
|% |_ ~
+$ bump [except=(set desk) force=_|]
--
|_ b=bump
++ grad %noun ++ grad %noun
++ grab ++ grab
|% |%
++ noun bump ++ noun ,~
++ json ++ json ul:dejs:format
^- $-(^json bump)
=, dejs:format
%- ot
:~ except+(as so)
force+bo
==
-- --
++ grow ++ grow
|% |%
++ noun b ++ noun ~
++ json ~
-- --
-- --

View File

@ -0,0 +1,24 @@
/- h=hood
|_ =pikes:h
++ grad %noun
++ grow
|%
++ noun pikes
++ json
=, enjs:format
%- pairs
%+ turn ~(tap by pikes)
|= [=desk =pike:h]
:- desk
%- pairs
:~ sync/?~(sync.pike ~ =,(u.sync.pike (pairs ship/s/(scot %p ship) desk/s/desk ~)))
hash/s/(scot %uv hash.pike)
zest/s/zest.pike
wefts/a/(turn ~(tap in wic.pike) weft:enjs:h)
==
--
++ grab
|%
++ noun pikes:h
--
--

View File

@ -0,0 +1,29 @@
|%
+$ sync
[local=term =ship =desk]
--
|_ s=sync
++ grad %noun
++ grow
|%
++ noun s
++ json
%- pairs:enjs:format
:~ local+s+local.s
desk+s+desk.s
ship+s+(scot %p ship.s)
==
--
++ grab
|%
++ noun sync
++ json
^- $-(^json sync)
=, dejs:format
%- ot
:~ local+so
ship+(su ;~(pfix sig fed:ag))
desk+so
==
--
--

View File

@ -0,0 +1,29 @@
|%
+$ unsync
[local=term =ship =desk]
--
|_ usyc=unsync
++ grad %noun
++ grow
|%
++ noun usyc
++ json
%- pairs:enjs:format
:~ local+s+local.usyc
desk+s+desk.usyc
ship+s+(scot %p ship.usyc)
==
--
++ grab
|%
++ noun unsync
++ json
^- $-(^json unsync)
=, dejs:format
%- ot
:~ local+so
ship+(su ;~(pfix sig fed:ag))
desk+so
==
--
--

View File

@ -1,54 +0,0 @@
/- hood
|_ =diff:hood
++ grad %noun
++ grow
|%
++ noun diff
++ json
=, enjs:format
|^
%+ frond -.diff
?- -.diff
%block (block +.diff)
?(%merge-sunk %merge-fail) (desk-arak-err +.diff)
?(%reset %commit %suspend %revive) (desk-arak +.diff)
==
::
++ block
|= [=desk =arak:hood =weft:hood blockers=(set desk)]
%+ merge (desk-arak desk arak)
%- pairs
:~ weft+(weft:enjs:hood weft)
blockers+a+(turn ~(tap in blockers) (lead %s))
==
::
++ desk-arak
|= [=desk =arak:hood]
%- pairs
:~ desk+s+desk
arak+(arak:enjs:hood arak)
==
::
++ desk-arak-err
|= [=desk =arak:hood =tang]
%+ merge (desk-arak desk arak)
%+ frond %tang
a+(turn tang tank)
::
++ merge
|= [a=^json b=^json]
^- ^json
?> &(?=(%o -.a) ?=(%o -.b))
o+(~(uni by p.a) p.b)
--
--
++ grab
|%
++ noun diff:hood
--
--

View File

@ -1,20 +0,0 @@
/- hood
!:
|_ ark=(map desk arak:hood)
++ grad %noun
++ grow
|%
++ noun ark
++ json
=, enjs:format
%- pairs
%+ turn ~(tap by ark)
|= [=desk =arak:hood]
[desk (arak:enjs:hood arak)]
--
::
++ grab
|%
++ noun (map desk arak:hood)
--
--

View File

@ -1,21 +0,0 @@
/- *hood
|_ vats=(list vat)
++ grad %noun
++ grow
|%
++ noun vats
++ json (vats:enjs vats)
--
++ grab
|%
++ noun (list vat)
--
--

View File

@ -1 +1 @@
[%zuse 418] [%zuse 417]

View File

@ -738,7 +738,7 @@
?@ epic arvo ?@ epic arvo
%= $ %= $
epic +.epic epic +.epic
arvo .*(arvo [%9 2 %10 [6 %1 -.epic] %0 1]) arvo .*([arvo -.epic] [%9 2 %10 [6 %0 3] %0 2])
== ==
:: ::
:: +boot: event 2: bootstrap a kernel from source :: +boot: event 2: bootstrap a kernel from source
@ -773,7 +773,7 @@
:: ::
~> %slog.[0 leaf+"1-c (compiling compiler, wait a few minutes)"] ~> %slog.[0 leaf+"1-c (compiling compiler, wait a few minutes)"]
=/ compiler-tool =/ compiler-tool
.*(compiler-gate [%9 2 %10 [6 %1 noun/hoon.log] %0 1]) .*([compiler-gate noun/hoon.log] [%9 2 %10 [6 %0 3] %0 2])
:: ::
:: switch to the second-generation compiler. we want to be :: switch to the second-generation compiler. we want to be
:: able to generate matching reflection nouns even if the :: able to generate matching reflection nouns even if the
@ -781,7 +781,7 @@
:: generate last-generation spans for `!>`, etc. :: generate last-generation spans for `!>`, etc.
:: ::
~> %slog.[0 leaf+"1-d"] ~> %slog.[0 leaf+"1-d"]
=. compiler-gate .*(0 +:compiler-tool) =. compiler-gate .*(0 +.compiler-tool)
:: ::
:: get the span (type) of the kernel core, which is the context :: get the span (type) of the kernel core, which is the context
:: of the compiler gate. we just compiled the compiler, :: of the compiler gate. we just compiled the compiler,
@ -791,18 +791,18 @@
:: ::
~> %slog.[0 leaf+"1-e"] ~> %slog.[0 leaf+"1-e"]
=/ kernel-span =/ kernel-span
-:.*(compiler-gate [%9 2 %10 [6 %1 [-.compiler-tool '+>']] %0 1]) -:.*([compiler-gate -.compiler-tool '+>'] [%9 2 %10 [6 %0 3] %0 2])
:: ::
:: compile the arvo source against the kernel core. :: compile the arvo source against the kernel core.
:: ::
~> %slog.[0 leaf+"1-f"] ~> %slog.[0 leaf+"1-f"]
=/ kernel-tool =/ kernel-tool
.*(compiler-gate [%9 2 %10 [6 %1 [kernel-span arvo.log]] %0 1]) .*([compiler-gate kernel-span arvo.log] [%9 2 %10 [6 %0 3] %0 2])
:: ::
:: create the arvo kernel, whose subject is the kernel core. :: create the arvo kernel, whose subject is the kernel core.
:: ::
~> %slog.[0 leaf+"1-g"] ~> %slog.[0 leaf+"1-g"]
[.*(+>:compiler-gate +:kernel-tool) epic.log] [.*(+>.compiler-gate +.kernel-tool) epic.log]
-- --
:: ::
:: |adapt :: |adapt
@ -1570,7 +1570,7 @@
:: ::
%crud =? lag.zen ?& ?=(%exit mote.goof.buz) %crud =? lag.zen ?& ?=(%exit mote.goof.buz)
?=(^ tang.goof.buz) ?=(^ tang.goof.buz)
?=(%leaf -.i.tang.goof.buz) :: XX ?@ ?=([%leaf *] i.tang.goof.buz)
?=(%wyrd (crip p.i.tang.goof.buz)) ?=(%wyrd (crip p.i.tang.goof.buz))
== ==
~&(%lagging &) ~&(%lagging &)

View File

@ -6245,14 +6245,14 @@
++ mure ++ mure
|= tap=(trap) |= tap=(trap)
^- (unit) ^- (unit)
=/ ton (mink [tap %9 2 %0 1] |=((pair) ``.*(~ [%12 1+p 1+q]))) =/ ton (mink [tap %9 2 %0 1] |=(a=^ ``.*(a [%12 [%0 2] %0 3])))
?.(?=(%0 -.ton) ~ `product.ton) ?.(?=(%0 -.ton) ~ `product.ton)
:: +mute: untyped virtual :: +mute: untyped virtual
:: ::
++ mute ++ mute
|= tap=(trap) |= tap=(trap)
^- (each * (list tank)) ^- (each * (list tank))
=/ ton (mock [tap %9 2 %0 1] |=((pair) ``.*(~ [%12 1+p 1+q]))) =/ ton (mock [tap %9 2 %0 1] |=(a=^ ``.*(a [%12 [%0 2] %0 3])))
?- -.ton ?- -.ton
%0 [%& p.ton] %0 [%& p.ton]
:: ::
@ -6265,9 +6265,8 @@
:: ::
++ slum ++ slum
~/ %slum ~/ %slum
|= [gat=* sam=*] |= sub=[gat=* sam=*]
^- * .*(sub [%9 2 %10 [6 %0 3] %0 2])
.*(gat [%9 2 %10 [6 %1 sam] %0 1])
:: +soft: virtual clam :: +soft: virtual clam
:: ::
++ soft ++ soft
@ -11411,13 +11410,12 @@
== ==
:: ::
++ slew :: get axis in vase ++ slew :: get axis in vase
|= [axe=@ vax=vase] ^- (unit vase) |= [axe=@ vax=vase]
?. |- ^- ? =/ typ |. (~(peek ut p.vax) %free axe)
?: =(1 axe) & |- ^- (unit vase)
?. ?=(^ q.vax) | ?: =(1 axe) `[$:typ q.vax]
$(axe (mas axe), q.vax .*(q.vax [0 (cap axe)])) ?@ q.vax ~
~ $(axe (mas axe), q.vax ?-((cap axe) %2 -.q.vax, %3 +.q.vax))
`[(~(peek ut p.vax) %free axe) .*(q.vax [0 axe])]
:: ::
++ slim :: identical to seer? ++ slim :: identical to seer?
|= old=vise ^- vase |= old=vise ^- vase

View File

@ -1,9 +1,9 @@
:: /sys/lull :: /sys/lull
:: %lull: arvo structures :: %lull: arvo structures
:: !:
=> ..part => ..part
|% |%
++ lull %329 ++ lull %328
:: :: :: :: :: ::
:::: :: :: (1) models :::: :: :: (1) models
:: :: :: :: :: ::
@ -755,6 +755,7 @@
[%note p=@tD q=tank] :: debug message [%note p=@tD q=tank] :: debug message
[%ogre p=@tas] :: delete mount point [%ogre p=@tas] :: delete mount point
[%rule red=dict wit=dict] :: node r+w permissions [%rule red=dict wit=dict] :: node r+w permissions
[%tire p=(each rock:tire wave:tire)] :: app state
[%writ p=riot] :: response [%writ p=riot] :: response
[%wris p=[%da p=@da] q=(set (pair care path))] :: many changes [%wris p=[%da p=@da] q=(set (pair care path))] :: many changes
== :: == ::
@ -784,12 +785,16 @@
[%park des=desk yok=yoki ran=rang] :: synchronous commit [%park des=desk yok=yoki ran=rang] :: synchronous commit
[%perm des=desk pax=path rit=rite] :: change permissions [%perm des=desk pax=path rit=rite] :: change permissions
[%pork ~] :: resume commit [%pork ~] :: resume commit
[%rein des=desk ren=rein] :: extra apps
[%stir arg=*] :: debug [%stir arg=*] :: debug
[%tire p=(unit ~)] :: app state subscribe
[%tomb =clue] :: tombstone specific [%tomb =clue] :: tombstone specific
$>(%trim vane-task) :: trim state $>(%trim vane-task) :: trim state
$>(%vega vane-task) :: report upgrade $>(%vega vane-task) :: report upgrade
[%warp wer=ship rif=riff] :: internal file req [%warp wer=ship rif=riff] :: internal file req
[%werp who=ship wer=ship rif=riff-any] :: external file req [%werp who=ship wer=ship rif=riff-any] :: external file req
[%wick ~] :: try upgrade
[%zest des=desk liv=zest] :: live
$>(%plea vane-task) :: ames request $>(%plea vane-task) :: ames request
== :: == ::
:: :: :: ::
@ -822,9 +827,14 @@
[%worn =ship =desk =tako =norm] :: set commit norm [%worn =ship =desk =tako =norm] :: set commit norm
[%seek =ship =desk =cash] :: fetch source blobs [%seek =ship =desk =cash] :: fetch source blobs
== :: == ::
+$ cone :: domes +$ cone (map [ship desk] foam) :: domes
%+ map [ship desk] :: +$ foam ::
[dome tom=(map tako norm) nor=norm] :: $: dome ::
tom=(map tako norm) ::
nor=norm ::
liv=zest ::
ren=(map dude:gall ?) ::
== ::
+$ crew (set ship) :: permissions group +$ crew (set ship) :: permissions group
+$ dict [src=path rul=real] :: effective permission +$ dict [src=path rul=real] :: effective permission
+$ dome :: project state +$ dome :: project state
@ -894,6 +904,7 @@
who=(pair (set ship) (map @ta crew)) :: who=(pair (set ship) (map @ta crew)) ::
== :: == ::
+$ regs (map path rule) :: rules for paths +$ regs (map path rule) :: rules for paths
+$ rein (map dude:gall ?) :: extra apps
+$ riff [p=desk q=(unit rave)] :: request+desist +$ riff [p=desk q=(unit rave)] :: request+desist
+$ riff-any :: +$ riff-any ::
$% [%1 =riff] :: $% [%1 =riff] ::
@ -917,6 +928,9 @@
[%| p=(list a) q=(list a)] :: p -> q[chunk] [%| p=(list a) q=(list a)] :: p -> q[chunk]
== :: == ::
++ urge |*(a=mold (list (unce a))) :: list change ++ urge |*(a=mold (list (unce a))) :: list change
+$ waft :: kelvin range
$^ [[%1 ~] p=(set weft)] ::
weft ::
+$ whom (each ship @ta) :: ship or named crew +$ whom (each ship @ta) :: ship or named crew
+$ yoki (each yuki yaki) :: commit +$ yoki (each yuki yaki) :: commit
+$ yuki :: proto-commit +$ yuki :: proto-commit
@ -929,11 +943,111 @@
r=tako :: self-reference r=tako :: self-reference
t=@da :: date t=@da :: date
== :: == ::
+$ zest $~(%dead ?(%dead %live %held)) :: how live
:: ::
++ tire :: app state
|% ::
+$ rock (map desk [=zest wic=(set weft)]) ::
+$ wave ::
$% [%wait =desk =weft] :: blocked
[%warp =desk =weft] :: unblocked
[%zest =desk =zest] :: running
== ::
::
++ wash :: patch
|= [=rock =wave]
^+ rock
?- -.wave
%wait
=/ got=[=zest wic=(set weft)]
(~(gut by rock) desk.wave *zest ~)
(~(put by rock) desk.wave got(wic (~(put in wic.got) weft.wave)))
::
%warp
%- ~(run by rock)
|= [=zest wic=(set weft)]
[zest (~(del in wic) weft.wave)]
::
%zest
?: ?=(%dead zest.wave)
(~(del by rock) desk.wave)
=/ got=[=zest wic=(set weft)]
(~(gut by rock) desk.wave *zest ~)
(~(put by rock) desk.wave got(zest zest.wave))
==
::
++ walk :: diff
|= [a=rock b=rock]
^- (list wave)
=/ adds (~(dif by b) a)
=/ dels (~(dif by a) b)
=/ bots (~(int by a) b)
;: welp
^- (list wave)
%- zing
%+ turn ~(tap by adds)
|= [=desk =zest wic=(set weft)]
^- (list wave)
:- [%zest desk zest]
%+ turn ~(tap in wic)
|= =weft
[%wait desk weft]
::
^- (list wave)
%+ turn ~(tap by dels)
|= [=desk =zest wic=(set weft)]
^- wave
[%zest desk %dead]
::
^- (list wave)
%- zing
%+ turn ~(tap by bots)
|= [=desk * *]
^- (list wave)
=/ aa (~(got by a) desk)
=/ bb (~(got by b) desk)
=/ wadds (~(dif in wic.bb) wic.aa)
=/ wdels (~(dif in wic.aa) wic.bb)
;: welp
?: =(zest.aa zest.bb)
~
[%zest desk zest.bb]~
::
%+ turn ~(tap by wadds)
|= =weft
^- wave
[%wait desk weft]
::
%+ turn ~(tap by wdels)
|= =weft
^- wave
[%warp desk weft]
==
==
--
:: ::
:: +page-to-lobe: hash a page to get a lobe. :: +page-to-lobe: hash a page to get a lobe.
:: ::
++ page-to-lobe |=(page (shax (jam +<))) ++ page-to-lobe |=(page (shax (jam +<)))
:: ::
++ cord-to-waft
|= =cord
^- waft
=/ wefts=(list weft)
%+ turn (rash cord (star (ifix [gay gay] tall:vast)))
|= =hoon
!<(weft (slap !>(~) hoon))
?: ?=([* ~] wefts)
i.wefts
[[%1 ~] (sy wefts)]
::
++ waft-to-wefts
|= kal=waft
^- (set weft)
?^ -.kal
p.kal
[kal ~ ~]
::
:: +make-yaki: make commit out of a list of parents, content, and date. :: +make-yaki: make commit out of a list of parents, content, and date.
:: ::
++ make-yaki ++ make-yaki
@ -1658,6 +1772,7 @@
[%sear =ship] :: clear pending queues [%sear =ship] :: clear pending queues
[%jolt =desk =dude] :: (re)start agent [%jolt =desk =dude] :: (re)start agent
[%idle =dude] :: suspend agent [%idle =dude] :: suspend agent
[%load =load] :: load agent
[%nuke =dude] :: delete agent [%nuke =dude] :: delete agent
[%doff dude=(unit dude) ship=(unit ship)] :: kill subscriptions [%doff dude=(unit dude) ship=(unit ship)] :: kill subscriptions
[%rake dude=(unit dude) all=?] :: reclaim old subs [%rake dude=(unit dude) all=?] :: reclaim old subs
@ -1686,6 +1801,7 @@
== == :: == == ::
+$ dude term :: server identity +$ dude term :: server identity
+$ gill (pair ship term) :: general contact +$ gill (pair ship term) :: general contact
+$ load (list [=dude =beak =agent]) :: loadout
+$ scar :: opaque duct +$ scar :: opaque duct
$: p=@ud :: bone sequence $: p=@ud :: bone sequence
q=(map duct bone) :: by duct q=(map duct bone) :: by duct
@ -2126,10 +2242,11 @@
$~ [%vega ~] :: $~ [%vega ~] ::
$% $>(%born vane-task) :: new unix process $% $>(%born vane-task) :: new unix process
[%done ~] :: socket closed [%done ~] :: socket closed
:: XX mark ignored :: TODO mark ignored ::
:: :: ::
[%fard p=(fyrd cage)] :: in-arvo thread [%fard p=(fyrd cage)] :: in-arvo thread
[%fyrd p=(fyrd cast)] :: external thread [%fyrd p=(fyrd cast)] :: external thread
[%lard =bear =shed] :: inline thread
$>(%trim vane-task) :: trim state $>(%trim vane-task) :: trim state
$>(%vega vane-task) :: report upgrade $>(%vega vane-task) :: report upgrade
== :: == ::
@ -2138,8 +2255,200 @@
+$ bear $@(desk beak) :: partial $beak +$ bear $@(desk beak) :: partial $beak
+$ cast (pair mark page) :: output mark + input +$ cast (pair mark page) :: output mark + input
++ fyrd |$ [a] [=bear name=term args=a] :: thread run request ++ fyrd |$ [a] [=bear name=term args=a] :: thread run request
:: ::
+$ shed _*form:(strand:rand ,vase) :: compute vase
-- ::khan -- ::khan
:: ::
++ rand :: computation
|%
+$ card card:agent:gall
+$ input
$% [%poke =cage]
[%sign =wire =sign-arvo]
[%agent =wire =sign:agent:gall]
[%watch =path]
==
+$ strand-input [=bowl in=(unit input)]
+$ tid @tatid
+$ bowl
$: our=ship
src=ship
tid=tid
mom=(unit tid)
wex=boat:gall
sup=bitt:gall
eny=@uvJ
now=@da
byk=beak
==
::
:: cards: cards to send immediately. These will go out even if a
:: later stage of the computation fails, so they shouldn't have
:: any semantic effect on the rest of the system.
:: Alternately, they may record an entry in contracts with
:: enough information to undo the effect if the computation
:: fails.
:: wait: don't move on, stay here. The next sign should come back
:: to this same callback.
:: skip: didn't expect this input; drop it down to be handled
:: elsewhere
:: cont: continue computation with new callback.
:: fail: abort computation; don't send effects
:: done: finish computation; send effects
::
++ strand-output-raw
|* a=mold
$~ [~ %done *a]
$: cards=(list card)
$= next
$% [%wait ~]
[%skip ~]
[%cont self=(strand-form-raw a)]
[%fail err=(pair term tang)]
[%done value=a]
==
==
::
++ strand-form-raw
|* a=mold
$-(strand-input (strand-output-raw a))
::
:: Abort strand computation with error message
::
++ strand-fail
|= err=(pair term tang)
|= strand-input
[~ %fail err]
::
:: Asynchronous transcaction monad.
::
:: Combo of four monads:
:: - Reader on input
:: - Writer on card
:: - Continuation
:: - Exception
::
++ strand
|* a=mold
|%
++ output (strand-output-raw a)
::
:: Type of an strand computation.
::
++ form (strand-form-raw a)
::
:: Monadic pure. Identity computation for bind.
::
++ pure
|= arg=a
^- form
|= strand-input
[~ %done arg]
::
:: Monadic bind. Combines two computations, associatively.
::
++ bind
|* b=mold
|= [m-b=(strand-form-raw b) fun=$-(b form)]
^- form
|= input=strand-input
=/ b-res=(strand-output-raw b)
(m-b input)
^- output
:- cards.b-res
?- -.next.b-res
%wait [%wait ~]
%skip [%skip ~]
%cont [%cont ..$(m-b self.next.b-res)]
%fail [%fail err.next.b-res]
%done [%cont (fun value.next.b-res)]
==
::
:: The strand monad must be evaluted in a particular way to maintain
:: its monadic character. +take:eval implements this.
::
++ eval
|%
:: Indelible state of a strand
::
+$ eval-form
$: =form
==
::
:: Convert initial form to eval-form
::
++ from-form
|= =form
^- eval-form
form
::
:: The cases of results of +take
::
+$ eval-result
$% [%next ~]
[%fail err=(pair term tang)]
[%done value=a]
==
::
++ validate-mark
|= [in=* =mark =bowl]
^- cage
=+ .^ =dais:clay %cb
/(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/[mark]
==
=/ res (mule |.((vale.dais in)))
?: ?=(%| -.res)
~| %spider-mark-fail
(mean leaf+"spider: ames vale fail {<mark>}" p.res)
[mark p.res]
::
:: Take a new sign and run the strand against it
::
++ take
:: cards: accumulate throughout recursion the cards to be
:: produced now
=| cards=(list card)
|= [=eval-form =strand-input]
^- [[(list card) =eval-result] _eval-form]
=* take-loop $
=. in.strand-input
?~ in.strand-input ~
=/ in u.in.strand-input
?. ?=(%agent -.in) `in
?. ?=(%fact -.sign.in) `in
::
:- ~
:^ %agent wire.in %fact
(validate-mark q.q.cage.sign.in p.cage.sign.in bowl.strand-input)
:: run the strand callback
::
=/ =output (form.eval-form strand-input)
:: add cards to cards
::
=. cards
%+ welp
cards
:: XX add tag to wires?
cards.output
:: case-wise handle next steps
::
?- -.next.output
%wait [[cards %next ~] eval-form]
%skip [[cards %next ~] eval-form]
%fail [[cards %fail err.next.output] eval-form]
%done [[cards %done value.next.output] eval-form]
%cont
:: recurse to run continuation with initialization input
::
%_ take-loop
form.eval-form self.next.output
strand-input [bowl.strand-input ~]
==
==
--
--
-- ::strand
::
+$ gift-arvo :: out result <-$ +$ gift-arvo :: out result <-$
$~ [%doze ~] $~ [%doze ~]
$% gift:ames $% gift:ames

View File

@ -1280,9 +1280,11 @@
[%forward-lane ~] [%forward-lane ~]
:: ::
:: this duplicates the routing hack from +send-blob:event-core :: this duplicates the routing hack from +send-blob:event-core
:: so long as neither the peer nor the peer's sponsoring galaxy is us: :: so long as neither the peer nor the peer's sponsoring galaxy is us,
:: and the peer has been reached recently:
:: ::
:: - no route to the peer: send to the peer's sponsoring galaxy :: - no route to the peer, or peer has not been contacted recently:
:: send to the peer's sponsoring galaxy
:: - direct route to the peer: use that :: - direct route to the peer: use that
:: - indirect route to the peer: send to both that route and the :: - indirect route to the peer: send to both that route and the
:: the peer's sponsoring galaxy :: the peer's sponsoring galaxy
@ -1294,6 +1296,8 @@
== ==
~ ~
=; zar=(trap (list lane)) =; zar=(trap (list lane))
?: (lth last-contact.qos.u.peer (sub now ~h1))
$:zar
?~ route.u.peer $:zar ?~ route.u.peer $:zar
=* rot u.route.u.peer =* rot u.route.u.peer
?:(direct.rot [lane.rot ~] [lane.rot $:zar]) ?:(direct.rot [lane.rot ~] [lane.rot $:zar])
@ -2229,6 +2233,10 @@
?: for ?: for
event-core event-core
(try-next-sponsor sponsor.peer-state) (try-next-sponsor sponsor.peer-state)
:: if forwarding, route must not be stale
::
?: &(for (lth last-contact.qos.peer-state (sub now ~h1)))
(try-next-sponsor sponsor.peer-state)
:: ::
?~ route=route.peer-state ?~ route=route.peer-state
%- (trace rot.veb final-ship |.("no route to: {<ship>}")) %- (trace rot.veb final-ship |.("no route to: {<ship>}"))

File diff suppressed because it is too large Load Diff

View File

@ -40,6 +40,7 @@
$> $? %merg :: merge desks $> $? %merg :: merge desks
%perm :: change permissions %perm :: change permissions
%warp :: wait for clay hack %warp :: wait for clay hack
%zest ::
== :: == ::
task:clay :: task:clay ::
== :: == ::
@ -52,10 +53,7 @@
task:dill :: task:dill ::
== :: == ::
$: %g :: $: %g ::
$> $? %jolt :: $>(%deal task:gall) ::
%deal ::
== ::
task:gall ::
== :: == ::
$: %j :: $: %j ::
$> $? %dawn :: $> $? %dawn ::
@ -221,7 +219,7 @@
^+ . ^+ .
=/ myt (flop (fall tem ~)) =/ myt (flop (fall tem ~))
=. tem ~ =. tem ~
=. ..mere (pass / %g %jolt %base ram) =. ..mere (pass /zest %c %zest %base %live)
=. ..mere (show-desk %kids) =. ..mere (show-desk %kids)
=. ..mere drum-watch =. ..mere drum-watch
|- ^+ ..mere |- ^+ ..mere
@ -247,14 +245,6 @@
|= des=desk |= des=desk
(pass /show [%c %perm des / r+`[%black ~]]) (pass /show [%c %perm des / r+`[%black ~]])
:: ::
++ kiln-install
|= [loc=desk =ship rem=desk]
(deal /install %poke %kiln-install !>([loc ship rem]))
::
++ kiln-sync
|= [loc=desk =ship rem=desk]
(deal /sync %poke %kiln-sync !>([loc ship rem]))
::
++ take :: receive ++ take :: receive
|= [tea=wire sih=sign] |= [tea=wire sih=sign]
^+ +> ^+ +>

View File

@ -551,6 +551,18 @@
(easy ~) (easy ~)
== ==
== ==
:: +host-sans-port: strip the :<port> from a host string
::
++ host-sans-port
;~ sfix
%+ cook crip
%- star
;~ less
;~(plug col (punt dem) ;~(less next (easy ~)))
next
==
(star next)
==
:: +per-server-event: per-event server core :: +per-server-event: per-event server core
:: ::
++ per-server-event ++ per-server-event
@ -602,6 +614,31 @@
[action [authenticated secure address request] ~ 0] [action [authenticated secure address request] ~ 0]
=. connections.state =. connections.state
(~(put by connections.state) duct connection) (~(put by connections.state) duct connection)
:: redirect to https if insecure, redirects enabled
:: and secure port live
::
?: ?& !secure
redirect.http-config.state
?=(^ secure.ports.state)
==
=/ location=@t
%+ rap 3
:~ 'https://'
(rash (fall host '') host-sans-port)
?: =(443 u.secure.ports.state)
''
(crip ":{(a-co:co u.secure.ports.state)}")
?: ?=([[~ ~] ~] (parse-request-line url.request))
'/'
url.request
==
%- handle-response
:* %start
:- status-code=301
headers=['location' location]~
data=~
complete=%.y
==
:: figure out whether this is a cors request, :: figure out whether this is a cors request,
:: whether the origin is approved or not, :: whether the origin is approved or not,
:: and maybe add it to the "pending approval" set :: and maybe add it to the "pending approval" set
@ -1228,7 +1265,7 @@
:: the request may include a 'Last-Event-Id' header :: the request may include a 'Last-Event-Id' header
:: ::
=/ maybe-last-event-id=(unit @ud) =/ maybe-last-event-id=(unit @ud)
?~ maybe-raw-header=(get-header:http 'Last-Event-ID' header-list.request) ?~ maybe-raw-header=(get-header:http 'last-event-id' header-list.request)
~ ~
(rush u.maybe-raw-header dum:ag) (rush u.maybe-raw-header dum:ag)
:: flush events older than the passed in 'Last-Event-ID' :: flush events older than the passed in 'Last-Event-ID'
@ -2272,6 +2309,10 @@
:: ::
%live %live
=. ports.server-state.ax +.task =. ports.server-state.ax +.task
:: enable http redirects if https port live and cert set
::
=. redirect.http-config.server-state.ax
&(?=(^ secure.task) ?=(^ secure.http-config.server-state.ax))
[~ http-server-gate] [~ http-server-gate]
:: %rule: updates our http configuration :: %rule: updates our http configuration
:: ::
@ -2284,6 +2325,10 @@
?: =(secure.config cert.http-rule.task) ?: =(secure.config cert.http-rule.task)
[~ http-server-gate] [~ http-server-gate]
=. secure.config cert.http-rule.task =. secure.config cert.http-rule.task
=. redirect.config
?& ?=(^ secure.ports.server-state.ax)
?=(^ cert.http-rule.task)
==
:_ http-server-gate :_ http-server-gate
=* out-duct outgoing-duct.server-state.ax =* out-duct outgoing-duct.server-state.ax
?~ out-duct ~ ?~ out-duct ~
@ -2534,6 +2579,12 @@
++ load ++ load
|= old=axle |= old=axle
^+ ..^$ ^+ ..^$
:: enable https redirects if certificate configured
::
=. redirect.http-config.server-state.old
?& ?=(^ secure.ports.server-state.old)
?=(^ secure.http-config.server-state.old)
==
..^$(ax old) ..^$(ax old)
:: +stay: produce current state :: +stay: produce current state
:: ::

View File

@ -42,9 +42,9 @@
:: $move: Arvo-level move :: $move: Arvo-level move
:: ::
+$ move [=duct move=(wind note-arvo gift-arvo)] +$ move [=duct move=(wind note-arvo gift-arvo)]
:: $state-10: overall gall state, versioned :: $state-11: overall gall state, versioned
:: ::
+$ state-10 [%10 state] +$ state-11 [%11 state]
:: $state: overall gall state :: $state: overall gall state
:: ::
:: system-duct: TODO document :: system-duct: TODO document
@ -73,11 +73,11 @@
:: control-duct: TODO document :: control-duct: TODO document
:: run-nonce: unique for each rebuild :: run-nonce: unique for each rebuild
:: sub-nonce: app-wide global %watch nonce :: sub-nonce: app-wide global %watch nonce
:: live: is this agent running? TODO document boarer
:: stats: TODO document :: stats: TODO document
:: bitt: incoming subscriptions :: bitt: incoming subscriptions
:: boat: outgoing subscriptions :: boat: outgoing subscriptions
:: boar: and their nonces :: boar: and their nonces
:: code: most recently loaded code
:: agent: agent core :: agent: agent core
:: beak: compilation source :: beak: compilation source
:: marks: mark conversion requests :: marks: mark conversion requests
@ -86,11 +86,11 @@
$: control-duct=duct $: control-duct=duct
run-nonce=@t run-nonce=@t
sub-nonce=_1 sub-nonce=_1
live=?
=stats =stats
=bitt =bitt
=boat =boat
=boar =boar
code=*
agent=(each agent vase) agent=(each agent vase)
=beak =beak
marks=(map duct mark) marks=(map duct mark)
@ -149,7 +149,7 @@
:: $spore: structures for update, produced by +stay :: $spore: structures for update, produced by +stay
:: ::
+$ spore +$ spore
$: %10 $: %11
system-duct=duct system-duct=duct
outstanding=(map [wire duct] (qeu remote-request)) outstanding=(map [wire duct] (qeu remote-request))
contacts=(set ship) contacts=(set ship)
@ -163,223 +163,21 @@
$: control-duct=duct $: control-duct=duct
run-nonce=@t run-nonce=@t
sub-nonce=@ sub-nonce=@
live=?
=stats =stats
=bitt =bitt
=boat =boat
=boar =boar
old-state=(each vase vase) code=~
old-state=[%| vase]
=beak =beak
marks=(map duct mark) marks=(map duct mark)
== ==
-- --
:: pupal gall core, on upgrade
::
=< =* adult-gate .
=| spore-tag=@ud
=| =spore
|= [now=@da eny=@uvJ rof=roof]
=* pupal-gate .
=* adult-core (adult-gate +<)
=< |%
++ call ^call
++ load ^load
++ scry ^scry
++ stay ^stay
++ take ^take
--
|%
++ molt
|= [=duct fec=(unit move)]
^- [(list move) _adult-gate]
~> %slog.[0 leaf+"gall: molting"]
~< %slog.[0 leaf+"gall: molted"]
:: +molt should never notify its client about agent changes
::
=- :_ ->
%+ welp
(skip -< |=(move ?=([* %give %onto *] +<)))
[^duct %pass /whiz/gall %$ %whiz ~]~
=/ adult adult-core
=. state.adult
[%10 system-duct outstanding contacts yokes=~ blocked bug]:spore
=/ mo-core (mo-abed:mo:adult system-duct.state.adult)
=/ apps=(list [dap=term =egg]) ~(tap by eggs.spore)
:: upgrade %base apps and suspend others
::
=. mo-core
|- ^+ mo-core
?~ apps mo-core
?. =(%base q.beak.egg.i.apps)
~> %slog.[0 leaf+"gall: suspending {<dap.i.apps>}"]
=. old-state.egg.i.apps
=/ old old-state.egg.i.apps
|/?-(-.old %| p.old, %& p.old)
=/ ap-core (ap-abut:ap:mo-core i.apps)
$(apps t.apps, mo-core ap-abet:ap-core)
~> %slog.[0 leaf+"gall: upgrading {<dap.i.apps>}"]
=/ ap-core (ap-abut:ap:mo-core i.apps)
=? ap-core ?=(%& -.old-state.egg.i.apps)
=^ tan ap-core (ap-install:ap-core `p.old-state.egg.i.apps)
?^ tan
(mean u.tan)
ap-core
$(apps t.apps, mo-core ap-abet:ap-core)
=. mo-core (mo-subscribe-to-agent-builds:mo-core now)
=^ moves adult-gate mo-abet:mo-core
=? moves ?=(^ fec) (weld moves [u.fec]~)
[moves adult-gate]
::
++ call
|= [=duct dud=(unit goof) wrapped-task=(hobo task)]
=* call-args +<
?: =(~ eggs.spore)
~> %slog.[0 leaf+"gall: direct morphogenesis"]
=. state.adult-gate spore(eggs *(map term yoke))
(call:adult-core call-args)
?^ dud
~> %slog.[0 leaf+"gall: pupa call dud"]
(mean >mote.u.dud< tang.u.dud)
=/ task ((harden task:gall) wrapped-task)
?: ?=(%vega -.task)
[~ pupal-gate]
(molt duct `[duct %slip %g task])
::
++ scry scry:adult-core
++ stay spore
++ take
|= [=wire =duct dud=(unit goof) sign=sign-arvo]
=* take-args +<
?: =(~ eggs.spore)
~> %slog.[0 leaf+"gall: direct morphogenesis"]
=. state.adult-gate spore(eggs *(map term yoke))
(take:adult-core take-args)
?^ dud
~> %slog.[0 leaf+"gall: pupa take dud"]
(mean >mote.u.dud< tang.u.dud)
?: =(/sys/lyv wire)
(molt duct ~)
(molt duct `[duct %pass wire %b %huck sign])
::
++ load
|^ |= old=spore-any
=. spore-tag `@ud`-.old
=? old ?=(%7 -.old) (spore-7-to-8 old)
=? old ?=(%8 -.old) (spore-8-to-9 old)
=? old ?=(%9 -.old) (spore-9-to-10 old)
?> ?=(%10 -.old)
=. spore old
?. =(~ eggs.spore)
pupal-gate
~> %slog.[0 leaf+"gall: direct morphogenesis"]
%_ adult-gate
state spore(eggs *(map term yoke))
==
::
+$ spore-any $%(^spore spore-9 spore-8 spore-7)
+$ spore-7
$: %7
wipe-eyre-subs=_| ::NOTE band-aid for #3196
system-duct=duct
outstanding=(map [wire duct] (qeu remote-request-9))
contacts=(set ship)
eggs=(map term egg-7)
blocked=(map term (qeu blocked-move))
==
::
+$ spore-8
$: %8
system-duct=duct
outstanding=(map [wire duct] (qeu remote-request-9))
contacts=(set ship)
eggs=(map term egg-8)
blocked=(map term (qeu blocked-move))
==
::
+$ egg-7 egg-8
+$ egg-8
$: control-duct=duct
run-nonce=@t
live=?
=stats
watches=watches-8
old-state=(each vase vase)
=beak
marks=(map duct mark)
==
::
+$ watches-8 [inbound=bitt outbound=boat-8]
+$ boat-8 (map [wire ship term] [acked=? =path])
::
+$ spore-9
$: %9
system-duct=duct
outstanding=(map [wire duct] (qeu remote-request-9))
contacts=(set ship)
eggs=(map term egg)
blocked=(map term (qeu blocked-move))
=bug
==
::
+$ remote-request-9
?(remote-request %cork)
::
++ spore-7-to-8
|= old=spore-7
^- spore-8
:- %8
=. eggs.old
%- ~(urn by eggs.old)
|= [a=term e=egg-7]
::NOTE kiln will kick off appropriate app revival
e(old-state [%| p.old-state.e])
+>.old
::
++ spore-8-to-9
|= old=spore-8
^- spore-9
=- old(- %9, eggs -, blocked [blocked.old *bug])
%- ~(run by eggs.old)
|= =egg-8
^- egg
=/ [=bitt =boat =boar] (watches-8-to-9 watches.egg-8)
:* control-duct.egg-8
run-nonce.egg-8
sub-nonce=1
live.egg-8
stats.egg-8
bitt boat boar
[old-state beak marks]:egg-8
==
::
++ watches-8-to-9
|= watches-8
^- [bitt boat boar]
[inbound outbound (~(run by outbound) |=([acked=? =path] nonce=0))]
::
++ spore-9-to-10
|= old=spore-9
=- old(- %10, outstanding -)
%- ~(run by outstanding.old)
|= q=(qeu remote-request-9)
%- ~(gas to *(qeu remote-request))
%+ murn ~(tap to q)
|=(r=remote-request-9 ?:(?=(%cork r) ~ `r))
--
--
:: adult gall vane interface, for type compatibility with pupa :: adult gall vane interface, for type compatibility with pupa
:: ::
=| state=state-10 =| state=state-11
|= [now=@da eny=@uvJ rof=roof] |= [now=@da eny=@uvJ rof=roof]
=* gall-payload . =* gall-payload .
=< ~% %gall-wrap ..mo ~
|%
++ call ^call
++ load ^load
++ scry ^scry
++ stay ^stay
++ take ^take
--
~% %gall-top ..part ~ ~% %gall-top ..part ~
|% |%
:: +mo: Arvo-level move handling :: +mo: Arvo-level move handling
@ -413,27 +211,14 @@
mo-core mo-core
=. mo-core (mo-pass i.list) =. mo-core (mo-pass i.list)
$(list t.list) $(list t.list)
:: +mo-jolt: (re)start agent if not already started on this desk :: +mo-jolt: (re)start agent
:: ::
++ mo-jolt ++ mo-jolt
|= [dap=term =ship =desk] |= [dap=term =ship =desk]
^+ mo-core ^+ mo-core
=/ yak (~(get by yokes.state) dap) =/ =wire /sys/cor/[dap]/(scot %p ship)/[desk]
?~ yak ..mo-core
(mo-boot dap ship desk) :: XX (mo-pass wire %c %jolt dap ship desk)
?. -.agent.u.yak
(mo-boot dap ship desk)
?. =(desk q.beak.u.yak)
(mo-boot dap ship desk)
mo-core
:: +mo-boot: ask %ford to build us a core for the specified agent.
::
++ mo-boot
|= [dap=term =ship =desk]
^+ mo-core
=/ =case [%da now]
=/ =wire /sys/cor/[dap]/(scot %p ship)/[desk]/(scot case)
(mo-pass wire %c %warp ship desk ~ %sing %a case /app/[dap]/hoon)
:: +mo-doff: kill all outgoing subscriptions :: +mo-doff: kill all outgoing subscriptions
:: ::
++ mo-doff ++ mo-doff
@ -476,17 +261,24 @@
^+ mo-core ^+ mo-core
:: ::
=/ yak (~(get by yokes.state) dap) =/ yak (~(get by yokes.state) dap)
=/ tex =/ tex=(unit tape)
?~ yak "installing" ?~ yak `"installing"
?- -.agent.u.yak ?- -.agent.u.yak
%& "reloading" %| `"reviving"
%| "reviving" %&
?: =(code.u.yak agent)
~
`"reloading"
== ==
~> %slog.[0 leaf+"gall: {tex} {<dap>}"] =+ ?~ tex ~
~> %slog.[0 leaf+"gall: {u.tex} {<dap>}"] ~
:: ::
?^ yak ?^ yak
?: &(=(q.beak.u.yak q.bek) =(code.u.yak agent) =(-.agent.u.yak &))
mo-core
::
=. yokes.state =. yokes.state
(~(put by yokes.state) dap u.yak(beak bek)) (~(put by yokes.state) dap u.yak(beak bek, code agent))
=/ ap-core (ap-abed:ap dap `our) =/ ap-core (ap-abed:ap dap `our)
=. ap-core (ap-reinstall:ap-core agent) =. ap-core (ap-reinstall:ap-core agent)
=. mo-core ap-abet:ap-core =. mo-core ap-abet:ap-core
@ -497,6 +289,7 @@
%* . *yoke %* . *yoke
control-duct hen control-duct hen
beak bek beak bek
code agent
agent &+agent agent &+agent
run-nonce (scot %uw (end 5 (shas %yoke-nonce eny))) run-nonce (scot %uw (end 5 (shas %yoke-nonce eny)))
== ==
@ -516,60 +309,6 @@
=. mo-core (mo-clear-queue dap) =. mo-core (mo-clear-queue dap)
=/ =suss [dap %boot now] =/ =suss [dap %boot now]
(mo-give %onto [%.y suss]) (mo-give %onto [%.y suss])
:: +mo-subscribe-to-agent-builds: request agent update notices
::
:: Also subscribe to our own source path, in case we get reloaded
:: but none of the agents do. This way, Clay will still notify us,
:: and we'll be able to exit the chrysalis.
::
++ mo-subscribe-to-agent-builds
|= date=@da
^+ mo-core
=. mo-core (mo-abed system-duct.state)
::
=/ sources=(jug desk [care:clay path])
%+ ~(put by *(jug desk [care:clay path])) %base
%- sy
:~ [%z /sys/hoon/hoon]
[%z /sys/arvo/hoon]
[%z /sys/lull/hoon]
[%z /sys/zuse/hoon]
[%z /sys/vane/gall/hoon]
[%z /sys/kelvin]
==
::
=. sources
=/ apps=(list [dap=term =yoke]) ~(tap by yokes.state)
|- ^+ sources
?~ apps
sources
=? sources ?=(%& -.agent.yoke.i.apps)
(~(put ju sources) q.beak.yoke.i.apps %a /app/[dap.i.apps]/hoon)
$(apps t.apps)
::
%- mo-past
%- zing
%+ turn ~(tap by sources)
|= [=desk paths=(set [care:clay path])]
:~ [/sys/lyv %c %warp our desk ~]
[/sys/lyv %c %warp our desk ~ %mult da+date paths]
==
:: +mo-scry-agent-cage: read $agent core from clay
::
++ mo-scry-agent-cage
|= [dap=term =desk =case:clay]
^- (each agent tang)
=/ bek=beak [our desk case]
=/ sky (rof ~ %ca bek /app/[dap]/hoon)
?~ sky |+[leaf+"gall: {<dap>} scry blocked"]~
?~ u.sky |+[leaf+"gall: {<dap>} scry failed"]~
=/ =cage u.u.sky
?. =(%vase p.cage)
|+[leaf+"gall: bad mark {<p.cage>} for agent {<dap>}"]~
=/ res (mule |.(!<(agent !<(vase q.cage))))
?: ?=(%& -.res)
&+p.res
|+[[leaf+"gall: {<dap>} not valid agent"] p.res]
:: +mo-send-foreign-request: handle local request to .ship :: +mo-send-foreign-request: handle local request to .ship
:: ::
++ mo-send-foreign-request ++ mo-send-foreign-request
@ -676,9 +415,9 @@
^+ mo-core ^+ mo-core
:: ::
?+ -.wire !! ?+ -.wire !!
%lyv (mo-handle-sys-lyv wire sign-arvo) %lyv ..mo-core :: vestigial
%cor ..mo-core :: vestigial
%era (mo-handle-sys-era wire sign-arvo) %era (mo-handle-sys-era wire sign-arvo)
%cor (mo-handle-sys-cor wire sign-arvo)
%lag (mo-handle-sys-lag wire sign-arvo) %lag (mo-handle-sys-lag wire sign-arvo)
%req (mo-handle-sys-req wire sign-arvo) %req (mo-handle-sys-req wire sign-arvo)
%way (mo-handle-sys-way wire sign-arvo) %way (mo-handle-sys-way wire sign-arvo)
@ -693,60 +432,6 @@
?. ?=(%breach -.public-keys-result.sign-arvo) ?. ?=(%breach -.public-keys-result.sign-arvo)
mo-core mo-core
(mo-breach who.public-keys-result.sign-arvo) (mo-breach who.public-keys-result.sign-arvo)
:: +mo-handle-sys-cor: receive a built agent from %clay
::
++ mo-handle-sys-cor
|= [=wire =sign-arvo]
^+ mo-core
::
?> ?=([%cor @ @ @ @ ~] wire)
=/ [dap=term her=@ta desk=@ta dat=@ta ~] t.wire
=/ =beak [(slav %p her) desk da+now]
?> ?=([?(%behn %clay) %writ *] sign-arvo)
?~ p.sign-arvo
(mean leaf+"gall: failed to build agent {<dap>}" ~)
=/ cag=cage r.u.p.sign-arvo
?. =(%vase p.cag)
(mean leaf+"gall: bad %writ {<p.cag>} for {<dap>}" ~)
=/ res (mule |.(!<(agent !<(vase q.cag))))
?: ?=(%| -.res)
(mean leaf+["gall: bad agent {<dap>}"] p.res)
=. mo-core (mo-receive-core dap beak p.res)
(mo-subscribe-to-agent-builds now)
:: +mo-handle-sys-lyv: handle notice that agents have been rebuilt
::
++ mo-handle-sys-lyv
|= [=wire =sign-arvo]
^+ mo-core
?> ?=([%lyv ~] wire)
?> ?=([?(%behn %clay) %wris *] sign-arvo)
=/ nex=(list [=care:clay =path]) ~(tap in q.sign-arvo)
~> %slog.[0 leaf+"gall: reloading agents"]
~< %slog.[0 leaf+"gall: reloaded agents"]
=; cor (mo-subscribe-to-agent-builds:cor now)
%+ roll nex
|= [[=care:clay =path] cor=_mo-core]
^+ cor
:: We throw away %z results because we only have them to guarantee
:: molting. Clay will tell us if e.g. changing hoon.hoon affects
:: the result of a particular app (usually it will).
::
?. =(%a care)
cor
~| path=path
=/ dap dap:;;([%app dap=@tas %hoon ~] path)
=/ yok=(unit yoke) (~(get by yokes.state) dap)
?~ yok
~> %slog.[0 leaf+"gall: no agent to reload: {<dap>}"]
cor
?: ?=(%| -.agent.u.yok)
~> %slog.[0 leaf+"gall: dead agent reload: {<dap>}"]
cor
=/ bek=beak [our q.beak.u.yok da+now]
=/ rag (mo-scry-agent-cage dap q.bek da+now)
?: ?=(%| -.rag)
(mean p.rag)
(mo-receive-core:cor dap bek p.rag)
:: +mo-handle-sys-lag: handle an ames %clog notification :: +mo-handle-sys-lag: handle an ames %clog notification
:: ::
++ mo-handle-sys-lag ++ mo-handle-sys-lag
@ -900,14 +585,6 @@
?. =(run-nonce.u.yoke i.t.wire) ?. =(run-nonce.u.yoke i.t.wire)
%- (slog leaf+"gall: got old {<+<.sign-arvo>} for {<dap>}" ~) %- (slog leaf+"gall: got old {<+<.sign-arvo>} for {<dap>}" ~)
mo-core mo-core
:: if agent must be running, revive all needed agents then apply
::
?: ?& ?=(%| -.agent.u.yoke)
?=(?(%dojo %hood) dap)
==
=. mo-core (mo-pass /nowhere %g %jolt %base %hood)
=. mo-core (mo-pass /nowhere %g %jolt %base %dojo)
(mo-pass use+wire %b %huck sign-arvo)
:: ::
?. ?=([?(%gall %behn) %unto *] sign-arvo) ?. ?=([?(%gall %behn) %unto *] sign-arvo)
?: ?=(%| -.agent.u.yoke) ?: ?=(%| -.agent.u.yoke)
@ -1004,15 +681,36 @@
~> %slog.0^leaf/"gall: nuking {<dap>}" ~> %slog.0^leaf/"gall: nuking {<dap>}"
=. mo-core ap-abet:ap-nuke:(ap-abed:ap dap `our) =. mo-core ap-abet:ap-nuke:(ap-abed:ap dap `our)
mo-core(yokes.state (~(del by yokes.state) dap)) mo-core(yokes.state (~(del by yokes.state) dap))
:: +mo-load: install agents
::
++ mo-load
|= agents=(list [=dude =beak =agent])
=. mo-core
|- ^+ mo-core
?~ agents mo-core
=/ [=dude =desk] [dude q.beak]:i.agents
:: ~> %slog.0^leaf/"gall: starting {<dude>} on {<desk>}"
$(agents t.agents, mo-core (mo-receive-core i.agents))
::
=/ kil
=/ lol (skim ~(tap by yokes.state) |=([term yoke] -.agent))
=/ mol (~(gas by *(map term yoke)) lol)
=/ sol ~(key by mol)
=/ new (silt (turn agents head))
~(tap in (~(dif in sol) new))
|- ^+ mo-core
?~ kil mo-core
~> %slog.0^leaf/"gall: stopping {<i.kil>}"
$(kil t.kil, mo-core (mo-idle i.kil))
:: +mo-peek: call to +ap-peek (which is not accessible outside of +mo). :: +mo-peek: call to +ap-peek (which is not accessible outside of +mo).
:: ::
++ mo-peek ++ mo-peek
~/ %mo-peek ~/ %mo-peek
|= [dap=term =routes care=term =path] |= [veb=? dap=term =routes care=term =path]
^- (unit (unit cage)) ^- (unit (unit cage))
:: ::
=/ app (ap-abed:ap dap routes) =/ app (ap-abed:ap dap routes)
(ap-peek:app care path) (ap-peek:app veb care path)
:: ::
++ mo-apply ++ mo-apply
|= [dap=term =routes =deal] |= [dap=term =routes =deal]
@ -1089,12 +787,6 @@
:: ::
?. |(!is-running is-blocked) ?. |(!is-running is-blocked)
(mo-apply agent routes deal) (mo-apply agent routes deal)
:: if agent must be running, revive all needed agents then apply
::
?: ?=(?(%hood %dojo) agent)
=. mo-core (mo-pass /nowhere %g %jolt %base %hood)
=. mo-core (mo-pass /nowhere %g %jolt %base %dojo)
(mo-slip %g %deal [ship our] agent deal)
:: ::
=/ blocked=(qeu blocked-move) =/ blocked=(qeu blocked-move)
=/ waiting (~(get by blocked.state) agent) =/ waiting (~(get by blocked.state) agent)
@ -1186,19 +878,6 @@
|= [dap=term =routes] |= [dap=term =routes]
^+ ap-core ^+ ap-core
(ap-yoke dap routes (~(got by yokes.state) dap)) (ap-yoke dap routes (~(got by yokes.state) dap))
:: +ap-hatch: initialize agent state from $egg, after upgrade
::
++ ap-abut
|= [dap=term =egg]
^+ ap-core
=/ yak=^yoke
?: ?=(%| -.old-state.egg)
egg
=/ res (mo-scry-agent-cage dap q.beak.egg da+now)
?: ?=(%| -.res)
(mean p.res)
egg(p.old-state `agent`p.res)
(ap-yoke dap `our yak)
:: +ap-yoke: initialize agent state, starting from a $yoke :: +ap-yoke: initialize agent state, starting from a $yoke
:: ::
++ ap-yoke ++ ap-yoke
@ -1240,7 +919,7 @@
%+ turn ~(tap by bitt.yoke) %+ turn ~(tap by bitt.yoke)
|= [=duct =ship =path] |= [=duct =ship =path]
path path
=/ will=(list card:agent:gall) =/ will=(list card:agent)
%+ welp %+ welp
?: =(~ inbound-paths) ?: =(~ inbound-paths)
~ ~
@ -1443,7 +1122,7 @@
:: ::
++ ap-peek ++ ap-peek
~/ %ap-peek ~/ %ap-peek
|= [care=term tyl=path] |= [veb=? care=term tyl=path]
^- (unit (unit cage)) ^- (unit (unit cage))
:: take trailing mark off path for %x scrys :: take trailing mark off path for %x scrys
:: ::
@ -1456,6 +1135,7 @@
=/ peek-result=(each (unit (unit cage)) tang) =/ peek-result=(each (unit (unit cage)) tang)
(ap-mule-peek |.((on-peek:ap-agent-core [care tyl]))) (ap-mule-peek |.((on-peek:ap-agent-core [care tyl])))
?: ?=(%| -.peek-result) ?: ?=(%| -.peek-result)
?. veb [~ ~]
((slog leaf+"peek bad result" p.peek-result) [~ ~]) ((slog leaf+"peek bad result" p.peek-result) [~ ~])
:: for non-%x scries, or failed %x scries, or %x results that already :: for non-%x scries, or failed %x scries, or %x results that already
:: have the requested mark, produce the result as-is :: have the requested mark, produce the result as-is
@ -2053,6 +1733,7 @@
%sear mo-abet:(mo-filter-queue:mo-core ship.task) %sear mo-abet:(mo-filter-queue:mo-core ship.task)
%jolt mo-abet:(mo-jolt:mo-core dude.task our desk.task) %jolt mo-abet:(mo-jolt:mo-core dude.task our desk.task)
%idle mo-abet:(mo-idle:mo-core dude.task) %idle mo-abet:(mo-idle:mo-core dude.task)
%load mo-abet:(mo-load:mo-core +.task)
%nuke mo-abet:(mo-nuke:mo-core dude.task) %nuke mo-abet:(mo-nuke:mo-core dude.task)
%doff mo-abet:(mo-doff:mo-core +.task) %doff mo-abet:(mo-doff:mo-core +.task)
%rake mo-abet:(mo-rake:mo-core +.task) %rake mo-abet:(mo-rake:mo-core +.task)
@ -2063,7 +1744,141 @@
== ==
:: +load: recreate vane; note, only valid if called from pupa :: +load: recreate vane; note, only valid if called from pupa
:: ::
++ load !! ++ load
|^ |= old=spore-any
=? old ?=(%7 -.old) (spore-7-to-8 old)
=? old ?=(%8 -.old) (spore-8-to-9 old)
=? old ?=(%9 -.old) (spore-9-to-10 old)
=? old ?=(%10 -.old) (spore-10-to-11 old)
?> ?=(%11 -.old)
gall-payload(state old)
::
+$ spore-any $%(spore spore-7 spore-8 spore-9 spore-10)
+$ spore-10
$: %10
system-duct=duct
outstanding=(map [wire duct] (qeu remote-request))
contacts=(set ship)
eggs=(map term egg-10)
blocked=(map term (qeu blocked-move))
=bug
==
+$ egg-10
$: control-duct=duct
run-nonce=@t
sub-nonce=@
live=?
=stats
=bitt
=boat
=boar
old-state=(each vase vase)
=beak
marks=(map duct mark)
==
+$ spore-9
$: %9
system-duct=duct
outstanding=(map [wire duct] (qeu remote-request-9))
contacts=(set ship)
eggs=(map term egg-10)
blocked=(map term (qeu blocked-move))
=bug
==
::
+$ remote-request-9 ?(remote-request %cork)
::
+$ spore-8
$: %8
system-duct=duct
outstanding=(map [wire duct] (qeu remote-request-9))
contacts=(set ship)
eggs=(map term egg-8)
blocked=(map term (qeu blocked-move))
==
+$ egg-8
$: control-duct=duct
run-nonce=@t
live=?
=stats
watches=watches-8
old-state=(each vase vase)
=beak
marks=(map duct mark)
==
+$ watches-8 [inbound=bitt outbound=boat-8]
+$ boat-8 (map [wire ship term] [acked=? =path])
+$ spore-7
$: %7
wipe-eyre-subs=_| ::NOTE band-aid for #3196
system-duct=duct
outstanding=(map [wire duct] (qeu remote-request-9))
contacts=(set ship)
eggs=(map term egg-8)
blocked=(map term (qeu blocked-move))
==
::
++ spore-7-to-8
|= old=spore-7
^- spore-8
:- %8
=. eggs.old
%- ~(urn by eggs.old)
|= [a=term e=egg-8]
:: kiln will kick off appropriate app revival
::
e(old-state [%| p.old-state.e])
+>.old
::
++ spore-8-to-9
|= old=spore-8
^- spore-9
=- old(- %9, eggs -, blocked [blocked.old *bug])
%- ~(run by eggs.old)
|= =egg-8
^- egg-10
=/ [=bitt =boat =boar] (watches-8-to-9 watches.egg-8)
:* control-duct.egg-8
run-nonce.egg-8
sub-nonce=1
live.egg-8
stats.egg-8
bitt boat boar
[old-state beak marks]:egg-8
==
::
++ watches-8-to-9
|= watches-8
^- [bitt boat boar]
[inbound outbound (~(run by outbound) |=([acked=? =path] nonce=0))]
::
:: remove %cork
::
++ spore-9-to-10
|= old=spore-9
=- old(- %10, outstanding -)
%- ~(run by outstanding.old)
|= q=(qeu remote-request-9)
%- ~(gas to *(qeu remote-request))
%+ murn ~(tap to q)
|=(r=remote-request-9 ?:(?=(%cork r) ~ `r))
::
:: removed live
:: changed old-state from (each vase vase) to [%| vase]
:: added code
::
++ spore-10-to-11
|= old=spore-10
^- spore
%= old
- %11
eggs
%- ~(urn by eggs.old)
|= [a=term e=egg-10]
^- egg
e(|3 |4.e(|4 `|8.e(old-state [%| p.old-state.e])))
==
--
:: +scry: standard scry :: +scry: standard scry
:: ::
++ scry ++ scry
@ -2085,8 +1900,16 @@
(sort ~(tap by queued) aor) (sort ~(tap by queued) aor)
:: ::
=/ running =/ running
=/ active (~(run by yokes.state) |=(yoke [%.y +<])) %+ turn (sort ~(tap by yokes.state) aor)
(sort ~(tap by active) aor) |= [dap=term =yoke]
^- mass
=/ met=(list mass)
=/ dat (mo-peek:mo | dap [~ ship] %x /whey/mass)
?: ?=(?(~ [~ ~]) dat) ~
(fall ((soft (list mass)) q.q.u.u.dat) ~)
?~ met
dap^&+yoke
dap^|+(welp met dot+&+yoke ~)
:: ::
=/ maz=(list mass) =/ maz=(list mass)
:~ [%foreign %.y contacts.state] :~ [%foreign %.y contacts.state]
@ -2160,7 +1983,7 @@
?. ?=(^ path) ?. ?=(^ path)
~ ~
=/ =routes [~ ship] =/ =routes [~ ship]
(mo-peek:mo dap routes care path) (mo-peek:mo & dap routes care path)
:: +stay: save without cache; suspend non-%base agents :: +stay: save without cache; suspend non-%base agents
:: ::
:: TODO: superfluous? see +molt :: TODO: superfluous? see +molt
@ -2172,12 +1995,12 @@
|= =yoke |= =yoke
^- egg ^- egg
%= yoke %= yoke
code ~
agent agent
:- %|
?: ?=(%| -.agent.yoke) ?: ?=(%| -.agent.yoke)
[%| p.agent.yoke] p.agent.yoke
?: =(%base q.beak.yoke) on-save:p.agent.yoke
[%& on-save:p.agent.yoke]
[%| on-save:p.agent.yoke]
== ==
:: +take: response :: +take: response
:: ::

View File

@ -102,15 +102,15 @@
=/ =beam (need (de-beam t.wire)) =/ =beam (need (de-beam t.wire))
?>(?=([@ ~] s.beam) beam(s i.s.beam)) ?>(?=([@ ~] s.beam) beam(s i.s.beam))
:: ::
++ start-spider ++ poke-spider
|= =vase |= [hen=duct =cage]
^- note ^- move
[%g %deal [our our] %spider %poke %spider-start vase] [hen %pass //g %g %deal [our our] %spider %poke cage]
:: ::
++ watch-spider ++ watch-spider
|= =path |= [hen=duct =path]
^- note ^- move
[%g %deal [our our] %spider %watch path] [hen %pass //g %g %deal [our our] %spider %watch path]
-- --
=| khan-state =| khan-state
=* state - =* state -
@ -134,22 +134,8 @@
%born %born
[~ khan-gate(hey hen, tic 0)] [~ khan-gate(hey hen, tic 0)]
:: ::
%fard %fard (bard hen 'khan-fyrd--' bear.p.task %| [name args]:p.task)
=/ tid=@ta %lard (bard hen 'khan-lard--' bear.task %& shed.task)
%^ cat 3
'khan-fyrd--'
(scot %uv (sham (mix tic eny)))
=. tic +(tic)
=* fyd p.task
=/ =beak (get-beak bear.fyd now)
=/ args [~ `tid beak name.fyd q.args.fyd]
:_ khan-gate
%+ turn
:~ (watch-spider /thread-result/[tid])
(start-spider !>(args))
==
|=(=note ^-(move [hen %pass //g note]))
::
%fyrd %fyrd
=* fyd p.task =* fyd p.task
=/ =beak (get-beak bear.fyd now) =/ =beak (get-beak bear.fyd now)
@ -160,6 +146,23 @@
=- [[hen %pass wire -]~ khan-gate] =- [[hen %pass wire -]~ khan-gate]
[%k %fard bear.fyd name.fyd p.q.args.fyd vase] [%k %fard bear.fyd name.fyd p.q.args.fyd vase]
== ==
::
++ bard
|= [hen=duct prefix=@ta =bear payload=(each shed [name=term args=cage])]
^- [(list move) _khan-gate]
=/ =tid:rand (cat 3 prefix (scot %uv (sham (mix tic eny))))
=/ =beak (get-beak bear now)
=/ =cage
?- -.payload
%& [%spider-inline !>([~ `tid beak p.payload])]
%| [%spider-start !>([~ `tid beak [name q.args]:p.payload])]
==
=. tic +(tic)
:_ khan-gate
:~ (watch-spider hen /thread-result/[tid])
(poke-spider hen cage)
==
::
:: +load: migrate an old state to a new khan version :: +load: migrate an old state to a new khan version
:: ::
++ load ++ load
@ -195,7 +198,7 @@
?+ p.cag ~&(bad-fact+p.cag !!) ?+ p.cag ~&(bad-fact+p.cag !!)
%thread-fail %thread-fail
=/ =tang !<(tang q.cag) =/ =tang !<(tang q.cag)
%- (slog 'khan-fact' tang) :: %- (slog 'khan-fact' tang)
[hen %give %arow %| p.cag tang]~ [hen %give %arow %| p.cag tang]~
:: ::
%thread-done %thread-done

View File

@ -4,7 +4,7 @@
=> ..lull => ..lull
~% %zuse ..part ~ ~% %zuse ..part ~
|% |%
++ zuse %418 ++ zuse %417
:: :: :: :: :: ::
:::: :: :: (2) engines :::: :: :: (2) engines
:: :: :: :: :: ::

View File

@ -33,10 +33,6 @@
naive, naive,
naive-tx=naive-transactions, naive-tx=naive-transactions,
*strandio *strandio
:: starting snapshot. this may not be the right starting point once we have
:: clay tombstoning and the snapshot may be updated
::
/* snap %azimuth-snapshot /app/azimuth/version-0/azimuth-snapshot
:: ::
=, strand=strand:spider =, strand=strand:spider
=, jael =, jael
@ -103,7 +99,11 @@
;< =events bind:m (scry events /gx/azimuth/logs/noun) ;< =events bind:m (scry events /gx/azimuth/logs/noun)
=/ [naive-contract=address chain-id=@] =/ [naive-contract=address chain-id=@]
[naive chain-id]:(get-network:dice net) [naive chain-id]:(get-network:dice net)
=/ snap=snap-state:dice snap ;< =bowl:spider bind:m get-bowl
=/ snap=snap-state:dice
.^ snap-state:dice %gx
/(scot %p our.bowl)/azimuth/(scot %da now.bowl)/last-snap/noun
==
:: ::
;< ~ bind:m ;< ~ bind:m
%- flog-text %+ weld "naive-csv: processing {<net>} ethereum logs " %- flog-text %+ weld "naive-csv: processing {<net>} ethereum logs "

View File

@ -44,10 +44,6 @@
%+ turn ~(tap by paths-to-tests) %+ turn ~(tap by paths-to-tests)
|= [=path test-arms=(list test-arm)] |= [=path test-arms=(list test-arm)]
^- (list test) ^- (list test)
:: strip off leading 'tests' from :path
::
?. ?=([%tests *] path) ~
=/ path t.path ::NOTE TMI
:: for each test, add the test's name to :path :: for each test, add the test's name to :path
:: ::
%+ turn test-arms %+ turn test-arms
@ -108,7 +104,16 @@
|= arg=vase |= arg=vase
=/ m (strand ,vase) =/ m (strand ,vase)
^- form:m ^- form:m
;< =bowl:strand bind:m get-bowl:strandio
=/ paz=(list path) =/ paz=(list path)
:: if no args, test everything under /=base=/tests
::
?~ q.arg
~[/(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/tests]
:: else cast path to ~[path] if needed
::
?@ +<.q.arg
[(tail !<([~ path] arg)) ~]
(tail !<([~ (list path)] arg)) (tail !<([~ (list path)] arg))
=/ bez=(list beam) =/ bez=(list beam)
(turn paz |=(p=path ~|([%test-not-beam p] (need (de-beam p))))) (turn paz |=(p=path ~|([%test-not-beam p] (need (de-beam p)))))

View File

@ -739,19 +739,19 @@
++ gen-rut-jar ++ gen-rut-jar
^~ ^- (jar @p event) ^~ ^- (jar @p event)
=/ filter ;: cork =/ filter ;: cork
(cury filter-owner %.y) ::(cury filter-owner %.y)
::(cury filter-proxy %spawn) ::(cury filter-proxy %spawn)
(cury filter-nonce %.y) ::(cury filter-nonce %.y)
::(cury filter-rank %galaxy) ::(cury filter-rank %galaxy)
::(cury filter-dominion %l1) ::(cury filter-dominion %l1)
%- cury %- cury
:- filter-tx-type :- filter-tx-type
:* ::%spawn :* %spawn
::%transfer-point %transfer-point
%configure-keys %configure-keys
::%set-management-proxy %set-management-proxy
::%set-spawn-proxy %set-spawn-proxy
::%set-transfer-proxy %set-transfer-proxy
~ ~
== ==
== ==

File diff suppressed because it is too large Load Diff

View File

@ -251,17 +251,19 @@
!> shut-packet !> shut-packet
!> decoded !> decoded
:: ::
++ disabled-test-shut-packet-associated-data ^- tang :: Crypto failures are now non-deterministic
:: ::
=/ =shut-packet:ames :: ++ test-shut-packet-associated-data ^- tang
:+ bone=17 message-num=18 :: ::
[%& num-fragments=1 fragment-num=1 fragment=`@`0xdead.beef] :: =/ =shut-packet:ames
:: :: :+ bone=17 message-num=18
=/ =packet:ames :: [%& num-fragments=1 fragment-num=1 fragment=`@`0xdead.beef]
(encode-shut-packet:ames shut-packet nec-sym ~marnec ~marbud-marbud 3 1) :: ::
:: :: =/ =packet:ames
%- expect-fail :: (encode-shut-packet:ames shut-packet nec-sym ~marnec ~marbud-marbud 3 1)
|.((decode-shut-packet:ames packet nec-sym 3 17)) :: ::
:: %- expect-fail
:: |.((decode-shut-packet:ames packet nec-sym 3 17))
:: ::
++ test-alien-encounter ^- tang ++ test-alien-encounter ^- tang
:: ::

View File

@ -22,32 +22,6 @@
(gall-call gall-gate time *roof call-args expected-moves) (gall-call gall-gate time *roof call-args expected-moves)
:: ::
-.res -.res
:: +test-jolt: test %jolt; TODO: test clay response
::
++ test-jolt
^- tang
::
=/ =duct ~[/init]
=/ time (add ~1111.1.1 ~s1)
=/ dap=term %my-agent
=/ ship ~nec
::
=/ call-args
=/ =task:gall [%jolt %base dap]
[duct task]
::
=/ =move:gall-gate
=/ =wire /sys/cor/[dap]/(scot %p ship)/base/(scot %da time)
=/ =note-arvo
[%c %warp ship %base ~ %sing %a da+time /app/[dap]/hoon]
[duct %pass wire note-arvo]
::
=/ expected-moves=(list move:gall-gate) ~[move]
::
=/ res
(gall-call gall-gate time *roof call-args expected-moves)
::
-.res
:: +gall-call: have %gall run a +task and assert it produces expected-moves :: +gall-call: have %gall run a +task and assert it produces expected-moves
:: ::
++ gall-call ++ gall-call

View File

@ -85,6 +85,9 @@
?:(?=(%sing genre) [genre mood] [genre mood]) ?:(?=(%sing genre) [genre mood] [genre mood])
(warp-our q.byk.bowl `rave) (warp-our q.byk.bowl `rave)
:: ::
++ tire
(arvo %c %tire `~)
::
++ connect ++ connect
|= [=binding:eyre app=term] |= [=binding:eyre app=term]
(arvo %e %connect binding app) (arvo %e %connect binding app)

View File

@ -38,41 +38,17 @@
:: ::
:: Canonical textual representation :: Canonical textual representation
:: ::
++ tako-to-text ++ chapter-to-text
|= [=tako:clay] |= [=tako:clay =proses]
^- tape ^- wain
"commit: {<`@uv`tako>}\0a" :- (crip "commit: {<`@uv`tako>}")
:: %- zing
++ proses-to-text %+ join `wain`~['|||']
|= [=proses] %+ turn ~(tap in proses)
^- tape |= prose
=/ proses-list=(list prose) ~(tap in proses) ^- wain
?: ?=(~ proses-list) "" %- to-wain:format
?: ?=([prose ~] proses-list) (rap 3 title '\0a\0a' body ~)
(prose-to-text i.proses-list)
%- tail
%^ spin `(list prose)`t.proses-list
(prose-to-text i.proses-list)
|= [prz=prose state=tape]
^- [prose tape]
:- prz
;: welp
state
"|||"
"\0a"
(prose-to-text prz)
==
::
++ prose-to-text
|= prz=prose
=/ [title=@t body=@t] prz
^- tape
;: welp
"{(trip title)}"
"\0a\0a"
"{(trip body)}"
"\0a"
==
:: ::
:: Parsers :: Parsers
:: ::

View File

@ -1,188 +1 @@
|% rand
+$ card card:agent:gall
+$ input
$% [%poke =cage]
[%sign =wire =sign-arvo]
[%agent =wire =sign:agent:gall]
[%watch =path]
==
+$ strand-input [=bowl in=(unit input)]
+$ tid @tatid
+$ bowl
$: our=ship
src=ship
tid=tid
mom=(unit tid)
wex=boat:gall
sup=bitt:gall
eny=@uvJ
now=@da
byk=beak
==
::
:: cards: cards to send immediately. These will go out even if a
:: later stage of the computation fails, so they shouldn't have
:: any semantic effect on the rest of the system.
:: Alternately, they may record an entry in contracts with
:: enough information to undo the effect if the computation
:: fails.
:: wait: don't move on, stay here. The next sign should come back
:: to this same callback.
:: skip: didn't expect this input; drop it down to be handled
:: elsewhere
:: cont: continue computation with new callback.
:: fail: abort computation; don't send effects
:: done: finish computation; send effects
::
++ strand-output-raw
|* a=mold
$~ [~ %done *a]
$: cards=(list card)
$= next
$% [%wait ~]
[%skip ~]
[%cont self=(strand-form-raw a)]
[%fail err=(pair term tang)]
[%done value=a]
==
==
::
++ strand-form-raw
|* a=mold
$-(strand-input (strand-output-raw a))
::
:: Abort strand computation with error message
::
++ strand-fail
|= err=(pair term tang)
|= strand-input
[~ %fail err]
::
:: Asynchronous transcaction monad.
::
:: Combo of four monads:
:: - Reader on input
:: - Writer on card
:: - Continuation
:: - Exception
::
++ strand
|* a=mold
|%
++ output (strand-output-raw a)
::
:: Type of an strand computation.
::
++ form (strand-form-raw a)
::
:: Monadic pure. Identity computation for bind.
::
++ pure
|= arg=a
^- form
|= strand-input
[~ %done arg]
::
:: Monadic bind. Combines two computations, associatively.
::
++ bind
|* b=mold
|= [m-b=(strand-form-raw b) fun=$-(b form)]
^- form
|= input=strand-input
=/ b-res=(strand-output-raw b)
(m-b input)
^- output
:- cards.b-res
?- -.next.b-res
%wait [%wait ~]
%skip [%skip ~]
%cont [%cont ..$(m-b self.next.b-res)]
%fail [%fail err.next.b-res]
%done [%cont (fun value.next.b-res)]
==
::
:: The strand monad must be evaluted in a particular way to maintain
:: its monadic character. +take:eval implements this.
::
++ eval
|%
:: Indelible state of a strand
::
+$ eval-form
$: =form
==
::
:: Convert initial form to eval-form
::
++ from-form
|= =form
^- eval-form
form
::
:: The cases of results of +take
::
+$ eval-result
$% [%next ~]
[%fail err=(pair term tang)]
[%done value=a]
==
::
++ validate-mark
|= [in=* =mark =bowl]
^- cage
=+ .^ =dais:clay %cb
/(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/[mark]
==
=/ res (mule |.((vale.dais in)))
?: ?=(%| -.res)
~|(%spider-mark-fail (mean leaf+"spider: ames vale fail {<mark>}" p.res))
[mark p.res]
::
:: Take a new sign and run the strand against it
::
++ take
:: cards: accumulate throughout recursion the cards to be
:: produced now
=| cards=(list card)
|= [=eval-form =strand-input]
^- [[(list card) =eval-result] _eval-form]
=* take-loop $
=. in.strand-input
?~ in.strand-input ~
=/ in u.in.strand-input
?. ?=(%agent -.in) `in
?. ?=(%fact -.sign.in) `in
::
:- ~
:+ %agent wire.in
[%fact (validate-mark q.q.cage.sign.in p.cage.sign.in bowl.strand-input)]
:: run the strand callback
::
=/ =output (form.eval-form strand-input)
:: add cards to cards
::
=. cards
%+ welp
cards
:: XX add tag to wires?
cards.output
:: case-wise handle next steps
::
?- -.next.output
%wait [[cards %next ~] eval-form]
%skip [[cards %next ~] eval-form]
%fail [[cards %fail err.next.output] eval-form]
%done [[cards %done value.next.output] eval-form]
%cont
:: recurse to run continuation with initialization input
::
%_ take-loop
form.eval-form self.next.output
strand-input [bowl.strand-input ~]
==
==
--
--
--
::

View File

@ -50,9 +50,11 @@
%& ~ %& ~
%| ['expected success - failed' p.b] %| ['expected success - failed' p.b]
== ==
:: $test-chain: a sequence of tests to be run :: $a-test-chain: a sequence of tests to be run
:: ::
+$ test-chain :: NB: arms shouldn't start with `test-` so that `-test % ~` runs
::
+$ a-test-chain
$_ $_
|? |?
?: =(0 0) ?: =(0 0)
@ -61,7 +63,7 @@
:: +run-chain: run a sequence of tests, stopping at first failure :: +run-chain: run a sequence of tests, stopping at first failure
:: ::
++ run-chain ++ run-chain
|= seq=test-chain |= seq=a-test-chain
^- tang ^- tang
=/ res $:seq =/ res $:seq
?- -.res ?- -.res

View File

@ -1,18 +1,28 @@
=/ weft ,[lal=@tas num=@ud] :: TODO remove after merge |_ kal=waft:clay
|_ kel=weft
++ grow ++ grow
|% |%
++ mime `^mime`[/text/x-kelvin (as-octs:mimes:html hoon)] ++ mime `^mime`[/text/x-kelvin (as-octs:mimes:html hoon)]
++ noun kel ++ noun kal
++ hoon (crip "{<[lal num]:kel>}\0a") ++ hoon
%+ rap 3
%+ turn
%+ sort
~(tap in (waft-to-wefts:clay kal))
|= [a=weft b=weft]
?: =(lal.a lal.b)
(gte num.a num.b)
(gte lal.a lal.b)
|= =weft
(rap 3 '[%' (scot %tas lal.weft) ' ' (scot %ud num.weft) ']\0a' ~)
::
++ txt (to-wain:format hoon) ++ txt (to-wain:format hoon)
-- --
++ grab ++ grab
|% |%
++ noun weft ++ noun waft:clay
++ mime ++ mime
|= [=mite len=@ud tex=@] |= [=mite len=@ud tex=@]
!<(weft (slap !>(~) (ream tex))) (cord-to-waft:clay tex)
-- --
++ grad %noun ++ grad %noun
-- --

View File

@ -46,18 +46,13 @@
[/text/x-urb-story (as-octs:mimes:html (of-wain:format txt))] [/text/x-urb-story (as-octs:mimes:html (of-wain:format txt))]
++ txt ++ txt
^- wain ^- wain
%- snoc :_ '' :: ensures terminating newline is present %- zing
%+ join `wain`~['---']
%+ murn ~(tap by tale) %+ murn ~(tap by tale)
|= [[=tako:clay =proses]] |= [=tako:clay =proses]
^- (unit cord) ^- (unit wain)
?~ proses ~ ?~ proses ~
%- some (some (chapter-to-text tako proses))
%- crip
;: welp
(tako-to-text tako)
(proses-to-text proses)
"---"
==
-- --
++ grab ++ grab
|% :: convert from |% :: convert from

View File

@ -1,147 +1,125 @@
=, clay =, clay
=* dude dude:gall =* dude dude:gall
|% |%
:: $snap: kiln snapshot +$ pike
:: $: sync=(unit [=ship =desk])
+$ snap (map desk arak) hash=@uv
:: $diff: subscription update =zest
:: wic=(set weft)
+$ diff
$% [%block =desk =arak =weft blockers=(set desk)]
[%reset =desk =arak]
[%commit =desk =arak]
[%merge-sunk =desk =arak =tang]
[%merge-fail =desk =arak =tang]
[%suspend =desk =arak]
[%revive =desk =arak]
== ==
:: $arak: foreign vat tracker
:: ::
:: .rail: upstream tracking state, if any +$ pikes (map desk pike)
:: .rein: configuration for agents
:: ::
+$ arak
$: rail=(unit rail)
=rein
==
:: $rail: upstream tracking state
::
:: .publisher: Ship that originally published desk, if available
:: .paused: is tracking paused? or live
:: .ship: upstream ship (could be .our)
:: .desk: name of upstream desk
:: .aeon: next aeon to pull from upstream
:: .next: list of pending commits with future kelvins
::
+$ rail
$: publisher=(unit ship)
paused=?
=ship
=desk
=aeon
next=(list rung)
==
:: $rung: reference to upstream commit :: $rung: reference to upstream commit
:: ::
+$ rung [=aeon =weft] +$ rung [=aeon =weft]
:: $rein: diff from desk manifest
:: ::
:: .liv: suspended? if suspended, no agents should run +$ sync-state [nun=@ta kid=(unit desk) let=@ud]
:: .add: agents not in manifest that should be running +$ sink (unit [her=@p sud=desk kid=(unit desk) let=@ud])
:: .sub: agents in manifest that should not be running :: +report-prep: get data required for reports
:: ::
+$ rein ++ report-prep
$: liv=_& |= [our=@p now=@da]
add=(set dude) =/ ego (scot %p our)
sub=(set dude) =/ wen (scot %da now)
:* .^(rock:tire %cx /(scot %p our)//(scot %da now)/tire)
.^(=cone %cx /(scot %p our)//(scot %da now)/domes)
.^((map desk [ship desk]) %gx /[ego]/hood/[wen]/kiln/sources/noun)
.^ (map [desk ship desk] sync-state) %gx
/[ego]/hood/[wen]/kiln/syncs/noun
==
== ==
::
+$ vat [=desk hash=@uv =cass =arak]
:: +report-vats: report on all desk installations :: +report-vats: report on all desk installations
:: ::
++ report-vats ++ report-vats
|= [our=@p now=@da] |= [our=@p now=@da]
^- tang ^- tang
=+ .^ raz=(list vat) =/ desks .^((set desk) %cd /(scot %p our)/base/(scot %da now))
%gx /(scot %p our)/hood/(scot %da now)/kiln/vats/noun =/ prep (report-prep our now)
== %+ turn ~(tap in desks)
:- (report-kids our now) |=(syd=desk (report-vat prep our now syd))
(turn raz |=(v=vat (report-vat our now v)))
:: +report-vat: report on a single desk installation :: +report-vat: report on a single desk installation
:: ::
++ report-vat ++ report-vat
|= [our=ship now=@da vat] |= $: $: tyr=rock:tire =cone sor=(map desk [ship desk])
zyn=(map [desk ship desk] sync-state)
==
our=ship now=@da syd=desk
==
^- tank ^- tank
=/ ego (scot %p our)
=/ wen (scot %da now)
=+ .^(=cass %cw /[ego]/[syd]/[wen])
?: =(ud.cass 0) ?: =(ud.cass 0)
leaf+"desk does not yet exist: {<desk>}" leaf+"desk does not yet exist: {<syd>}"
?: =(%kids syd)
=+ .^(hash=@uv %cz /[ego]/[syd]/[wen])
leaf+"%kids %cz hash: {<hash>}"
=/ kel-path =/ kel-path
/(scot %p our)/[desk]/(scot %da now)/sys/kelvin /[ego]/[syd]/[wen]/sys/kelvin
?. .^(? %cu kel-path) ?. .^(? %cu kel-path)
leaf+"bad desk: {<desk>}" leaf+"bad desk: {<syd>}"
=+ .^(=weft %cx kel-path) =+ .^(=waft %cx kel-path)
:+ %rose ["" "{<desk>}" "::"] :+ %rose ["" "{<syd>}" "::"]
^- tang ^- tang
=/ meb (mergebase-hashes our desk now arak) =/ hash .^(@uv %cz /[ego]/[syd]/[wen])
=/ poz =/ =sink
?~ rail.arak "local" ?~ s=(~(get by sor) syd)
?:(paused.u.rail.arak "paused" "tracking") ~
=/ sat ?:(liv.rein.arak "running" "suspended") ?~ z=(~(get by zyn) syd u.s)
=/ pen ~
?~ rail.arak "~" `[-.u.s +.u.s +.u.z]
<(turn next.u.rail.arak |=([@ lal=@tas num=@] [lal num]))> =/ meb=(list @uv)
:~ leaf/"/sys/kelvin: {<[lal num]:weft>}" ?~ sink [hash]~
(mergebase-hashes our syd now her.u.sink sud.u.sink)
=/ dek (~(got by tyr) syd)
=/ =foam (~(got by cone) our syd)
=/ [on=(list [@tas ?]) of=(list [@tas ?])]
(skid ~(tap by ren.foam) |=([* ?] +<+))
=/ sat
?- zest.dek
%live "running"
%dead "suspended"
%held "suspended until next update"
==
=/ kul=tape
%+ roll
%+ sort
~(tap in (waft-to-wefts:clay waft))
|= [a=weft b=weft]
?: =(lal.a lal.b)
(lte num.a num.b)
(lte lal.a lal.b)
|= [=weft =tape]
(welp " {<[lal num]:weft>}" tape)
:~ leaf/"/sys/kelvin: {kul}"
leaf/"base hash: {?.(=(1 (lent meb)) <meb> <(head meb)>)}" leaf/"base hash: {?.(=(1 (lent meb)) <meb> <(head meb)>)}"
leaf/"%cz hash: {<hash>}" leaf/"%cz hash: {<hash>}"
:: ::
leaf/"app status: {sat}" leaf/"app status: {sat}"
leaf/"force on: {?:(=(~ add.rein.arak) "~" <add.rein.arak>)}" leaf/"force on: {?:(=(~ on) "~" <on>)}"
leaf/"force off: {?:(=(~ sub.rein.arak) "~" <sub.rein.arak>)}" leaf/"force off: {?:(=(~ of) "~" <of>)}"
:: ::
leaf/"publishing ship: {?~(rail.arak <~> <publisher.u.rail.arak>)}" leaf/"publishing ship: {?~(sink <~> <(get-publisher our syd now)>)}"
leaf/"updates: {poz}" leaf/"updates: {?~(sink "local" "remote")}"
leaf/"source ship: {?~(rail.arak <~> <ship.u.rail.arak>)}" leaf/"source ship: {?~(sink <~> <her.u.sink>)}"
leaf/"source desk: {?~(rail.arak <~> <desk.u.rail.arak>)}" leaf/"source desk: {?~(sink <~> <sud.u.sink>)}"
leaf/"source aeon: {?~(rail.arak <~> <aeon.u.rail.arak>)}" leaf/"source aeon: {?~(sink <~> <let.u.sink>)}"
leaf/"pending updates: {pen}" leaf/"kids desk: {?~(sink <~> ?~(kid.u.sink <~> <u.kid.u.sink>))}"
leaf/"pending updates: {<`(list [@tas @ud])`~(tap in wic.dek)>}"
== ==
:: +report-kids: non-vat cz hash report for kids desk :: +report-kids: non-vat cz hash report for kids desk
:: ::
++ report-kids ++ report-kids
|= [our=ship now=@da] |= [our=ship now=@da]
^- tank ^- tank
=/ dek %kids =/ syd %kids
=/ ego (scot %p our) =/ ego (scot %p our)
=/ wen (scot %da now) =/ wen (scot %da now)
?. (~(has in .^((set desk) %cd /[ego]//[wen])) dek) ?. (~(has in .^((set desk) %cd /[ego]//[wen])) syd)
leaf/"no %kids desk" leaf/"no %kids desk"
=+ .^(hash=@uv %cz /[ego]/[dek]/[wen]) =+ .^(hash=@uv %cz /[ego]/[syd]/[wen])
leaf/"%kids %cz hash: {<hash>}" leaf/"%kids %cz hash: {<hash>}"
:: +read-kelvin-foreign: read /sys/kelvin from a foreign desk
::
++ read-kelvin-foreign
|= [=ship =desk =aeon]
^- weft
~| read-foreign-kelvin/+<
=/ her (scot %p ship)
=/ syd (scot %tas desk)
=/ yon (scot %ud aeon)
::
=/ dom .^(dome cv/~[her syd yon])
=/ tak (scot %uv (~(got by hit.dom) let.dom))
=/ yak .^(yaki cs/~[her syd yon %yaki tak])
=/ lob (scot %uv (~(got by q.yak) /sys/kelvin))
=/ peg .^(page cs/~[her syd yon %blob lob])
;;(weft q.peg)
:: +read-kelvin-local: read /sys/kelvin from a local desk
::
++ read-kelvin-local
|= [our=ship =desk now=@da]
^- (unit weft)
~| read-kelvin-local+desk
=/ pax (en-beam [our desk da+now] /sys/kelvin)
?. .^(? cu/pax)
~
[~ .^(weft cx/pax)]
:: +read-bill-foreign: read /desk/bill from a foreign desk :: +read-bill-foreign: read /desk/bill from a foreign desk
:: ::
++ read-bill-foreign ++ read-bill-foreign
@ -169,21 +147,6 @@
?. .^(? cu/pax) ?. .^(? cu/pax)
*(list dude) *(list dude)
.^((list dude) cx/pax) .^((list dude) cx/pax)
:: +adjust-dudes: which agents should be started and stopped
::
:: Will ask Gall to start agents that it's already running
:: but that should be ok, and might be safer in case other
:: unprocessed moves would have turned them off.
::
++ adjust-dudes
|= $: local=[our=ship =desk now=@da]
=rein
==
^- [jolt=(list dude) idle=(list dude)]
=/ all=(list dude) (read-bill local)
=/ want (get-apps-want local all rein)
=/ have (get-apps-live local)
[want (skip have ~(has in (sy want)))]
:: ::
++ get-remote-diff ++ get-remote-diff
|= [our=ship here=desk now=@da her=ship there=desk when=aeon] |= [our=ship here=desk now=@da her=ship there=desk when=aeon]
@ -210,38 +173,18 @@
^- (list [=dude live=?]) ^- (list [=dude live=?])
%~ tap in %~ tap in
.^((set [=dude live=?]) ge+/(scot %p our)/[desk]/(scot %da now)) .^((set [=dude live=?]) ge+/(scot %p our)/[desk]/(scot %da now))
:: +get-apps-want: find which apps should be running on a desk
::
++ get-apps-want
|= [local=[our=ship =desk now=@da] duz=(list dude) =rein]
^- (list dude)
?. liv.rein ~
?. |(=(`zuse+zuse (read-kelvin-local local)) =(%base desk.local)) ~
=. duz (skip duz ~(has in sub.rein))
=. duz (weld duz (skip ~(tap in add.rein) ~(has in (sy duz))))
duz
:: ::
++ mergebase-hashes ++ mergebase-hashes
|= [our=@p =desk now=@da =arak] |= [our=@p syd=desk now=@da her=ship sud=desk]
?~ rail.arak =/ her (scot %p her)
~
=/ her (scot %p ship.u.rail.arak)
=/ ego (scot %p our) =/ ego (scot %p our)
=/ wen (scot %da now) =/ wen (scot %da now)
%+ turn .^((list tako) %cs ~[ego desk wen %base her desk.u.rail.arak]) %+ turn .^((list tako) %cs ~[ego syd wen %base her sud])
|=(=tako .^(@uv %cs ~[ego desk wen %hash (scot %uv tako)])) |=(=tako .^(@uv %cs ~[ego syd wen %hash (scot %uv tako)]))
:: ::
++ enjs ++ enjs
=, enjs:format =, enjs:format
|% |%
++ vats
|= v=(list ^vat)
^- json
%- pairs
%+ turn v
|= va=^vat
[desk.va (vat va)]
::
++ tim ++ tim
|= t=@ |= t=@
^- json ^- json
@ -254,15 +197,6 @@
da+(tim da.c) da+(tim da.c)
== ==
:: ::
++ vat
|= v=^vat
%- pairs
:~ desk+s+desk.v
hash+s+(scot %uv hash.v)
cass+(cass cass.v)
arak+(arak arak.v)
==
::
++ weft ++ weft
|= w=^weft |= w=^weft
%- pairs %- pairs
@ -276,30 +210,5 @@
:~ aeon+(numb aeon.r) :~ aeon+(numb aeon.r)
weft+(weft weft.r) weft+(weft weft.r)
== ==
::
++ rein
|= r=^rein
%- pairs
:~ add+a+(turn ~(tap in add.r) (lead %s))
sub+a+(turn ~(tap in sub.r) (lead %s))
==
::
++ arak
|= a=^arak
%- pairs
:~ rail+?~(rail.a ~ (rail u.rail.a))
rein+(rein rein.a)
==
::
++ rail
|= r=^rail
%- pairs
:~ ship+s+(scot %p ship.r)
publisher+?~(publisher.r ~ s+(scot %p u.publisher.r))
desk+s+desk.r
paused+b+paused.r
aeon+(numb aeon.r)
next+a+(turn next.r rung)
==
-- --
-- --

View File

@ -1,7 +1,7 @@
/+ libstrand=strand /+ libstrand=strand
=, strand=strand:libstrand =, strand=strand:libstrand
|% |%
+$ thread $-(vase _*form:(strand ,vase)) +$ thread $-(vase shed:khan)
+$ input [=tid =cage] +$ input [=tid =cage]
+$ tid tid:strand +$ tid tid:strand
+$ bowl bowl:strand +$ bowl bowl:strand
@ -18,4 +18,10 @@
file=term file=term
=vase =vase
== ==
+$ inline-args
$: parent=(unit tid)
use=(unit tid)
=beak
=shed:khan
==
-- --

View File

@ -1 +1 @@
[%zuse 418] [%zuse 417]

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
|% |%
+$ card card:agent:gall +$ card card:agent:gall
+$ app-state +$ app-state
$: %2 $: %3
:: local :: local
charges=(map desk charge) charges=(map desk charge)
== ==
@ -42,7 +42,7 @@
++ on-init ++ on-init
^- (quip card _this) ^- (quip card _this)
:_ this :_ this
:~ (~(watch-our pass /kiln) %hood /kiln/vats) :~ ~(tire pass /tire)
(~(connect pass /eyre) [~ /] %docket) (~(connect pass /eyre) [~ /] %docket)
(~(wait pass /init) (add 1 now.bowl)) (~(wait pass /init) (add 1 now.bowl))
(~(connect pass /eyre) [~ /apps] %docket) (~(connect pass /eyre) [~ /apps] %docket)
@ -54,20 +54,21 @@
|^ |^
=+ !<(old=app-states vase) =+ !<(old=app-states vase)
=? old ?=(?(~ ^) -.old) [%1 old] =? old ?=(?(~ ^) -.old) [%1 old]
=^ cards old =^ cards-1 old
?. ?=(%1 -.old) `old ?. ?=(%1 -.old) `old
=/ rein=cage kiln-rein+!>([%base %.y ~ ~]) `old(- %2)
=/ nuke=cage kiln-uninstall+!>(%hodl) =^ cards-2 old
:_ old(- %2) ?. ?=(%2 -.old) `old
:~ [%pass /rein %agent [our.bowl %hood] %poke rein] :_ old(- %3) :_ ~
[%pass /nuke %agent [our.bowl %hood] %poke nuke] ~(tire pass /tire)
== ?> ?=(%3 -.old)
?> ?=(%2 -.old) =/ cards-tire [~(tire pass /tire) ~]
=. -.state old =. -.state old
:: inflate-cache needs to be called after the state is set :: inflate-cache needs to be called after the state is set
:: ::
=. +.state inflate-cache =. +.state inflate-cache
[cards this] [:(weld cards-1 cards-2 cards-tire) this]
:: ::
++ inflate-cache ++ inflate-cache
^- cache ^- cache
@ -81,9 +82,11 @@
$^ state-0-ket $^ state-0-ket
$% state-0-sig $% state-0-sig
state-1 state-1
state-2
app-state app-state
== ==
:: ::
+$ state-2 [%2 (map desk charge)]
+$ state-1 [%1 (map desk charge)] +$ state-1 [%1 (map desk charge)]
+$ state-0-sig +$ state-0-sig
$: ~ $: ~
@ -94,6 +97,7 @@
== ==
-- --
:: ::
++ on-save !>(-.state) ++ on-save !>(-.state)
++ on-poke ++ on-poke
|= [=mark =vase] |= [=mark =vase]
@ -189,13 +193,21 @@
== ==
:: ::
[%x %charges ~] [%x %charges ~]
=/ tyr
.^(rock:tire:clay %cx /(scot %p our.bowl)//(scot %da now.bowl)/tire)
:- ~ :- ~ :- ~ :- ~
%- charge-update:cg %- charge-update:cg
:- %initial :- %initial
%- ~(gas by *(map desk charge)) %- ~(gas by *(map desk charge))
%+ turn ~(tap by charges) %+ murn ~(tap by charges)
|= [=desk =charge] |= [=desk =charge]
[desk (get-light-charge charge)] ?~ got=(~(get by tyr) desk)
~
?: ?& ?=(%dead zest.u.got)
?=(~ (get-apps-have:hood our.bowl desk now.bowl))
==
~
`u=[desk (get-light-charge charge)]
:: ::
[%x %charges @ %version ~] [%x %charges @ %version ~]
?~ charge=(~(get by charges) i.t.t.path) ?~ charge=(~(get by charges) i.t.t.path)
@ -212,114 +224,11 @@
~ `state ~ `state
[%rein ~] ~&(%reined `state) [%rein ~] ~&(%reined `state)
[%nuke ~] ~&(%nuked `state) [%nuke ~] ~&(%nuked `state)
[%kiln ~] take-kiln [%kiln ~] `state
[%charge @ *] (take-charge i.t.wire t.t.wire) [%charge @ *] (take-charge i.t.wire t.t.wire)
== ==
[cards this] [cards this]
:: ::
++ take-kiln
^- (quip card _state)
?+ -.sign (on-agent:def:cc wire sign)
%kick [(~(watch-our pass /kiln) %hood /kiln/vats)^~ state]
%fact
|^ ^- (quip card _state)
?+ p.cage.sign ~|(take-kiln-mark/p.cage.sign !!)
%kiln-vats-snap-0 (on-snap !<(snap:hood q.cage.sign))
%kiln-vats-diff-0 (on-diff !<(diff:hood q.cage.sign))
==
::
++ on-snap
|= =snap:hood
^- (quip card _state)
=| fex=(list card)
=/ ark ~(tap by snap)
|- ^- (quip card _state)
?~ ark [(flop fex) state]
=^ caz state (on-commit i.ark)
$(ark t.ark, fex (weld (flop caz) fex))
::
++ on-diff
|= =diff:hood
=+ !<(=diff:hood q.cage.sign)
?- -.diff
%commit (on-commit [desk arak]:diff)
%suspend (on-suspend [desk arak]:diff)
%revive (on-revive [desk arak]:diff)
?(%block %reset %merge-sunk %merge-fail)
`state
==
::
++ on-commit
|= [=desk =arak:hood]
^- (quip card _state)
=* cha ~(. ch desk)
?. docket-exists:cha
~? ?& !=(%base desk)
!=(%kids desk)
==
[dap.bowl %no-docket-file-for desk]
`state
:: always update the docket in state to match clay's
::
=/ =docket docket:cha
=/ pre=(unit charge) (~(get by charges) desk)
=. charges (new-docket:cha docket)
:: if the new chad is a site, we're instantly done
::
?: ?=(%site -.href.docket)
=. charges (new-chad:cha %site ~)
:- ~[add-fact:cha]
state
::
=. by-base (~(put by by-base) base.href.docket desk)
:: if the glob specification is unchanged, keep it
::
?: &(?=(^ pre) =(href.docket.u.pre href.docket) ?=(%glob -.chad.u.pre))
[~[add-fact:cha] state]
:: if the glob spec changed, but we already host it, keep it
:: (this is the "just locally uploaded" case)
::
?: ?& ?=(^ pre)
?=(%glob -.chad.u.pre)
::
.= [(sham glob.chad.u.pre) %ames our.bowl]
glob-reference.href.docket
==
[~[add-fact:cha] state]
:: if the glob changed, forget the old and fetch the new
::
=. charges (new-chad:cha %install ~)
[[add-fact:cha fetch-glob:cha] state]
::
++ on-suspend
|= [=desk =arak:hood]
^- (quip card _state)
=* cha ~(. ch desk)
?. (~(has by charges) desk) `state
=/ glob=(unit glob)
=/ =chad
chad:(~(got by charges) desk)
?:(?=(%glob -.chad) `glob.chad ~)
=. charges (new-chad:cha %suspend glob)
:_(state ~[add-fact:cha])
::
++ on-revive
|= [=desk =arak:hood]
^- (quip card _state)
=* cha ~(. ch desk)
?. (~(has by charges) desk) `state
=/ =charge (~(got by charges) desk)
?. ?=(%glob -.href.docket.charge)
=. charges (new-chad:cha %site ~)
:_(state ~[add-fact:cha])
=. charges
%- new-chad:cha
?. ?=([%suspend ~ *] chad.charge)
[%install ~]
[%glob u.glob.chad.charge]
:_(state [add-fact fetch-glob]:cha)
--
==
++ take-charge ++ take-charge
|= [=desk =^wire] |= [=desk =^wire]
^- (quip card _state) ^- (quip card _state)
@ -398,6 +307,7 @@
:: ::
++ on-arvo ++ on-arvo
|= [=wire sign=sign-arvo] |= [=wire sign=sign-arvo]
|^
=^ cards state =^ cards state
?+ wire (on-arvo:def wire sign) ?+ wire (on-arvo:def wire sign)
[%init ~] [%init ~]
@ -410,8 +320,117 @@
?: accepted.sign `state ?: accepted.sign `state
~& [dap.bowl %failed-to-bind path.binding.sign] ~& [dap.bowl %failed-to-bind path.binding.sign]
`state `state
::
[%tire ~]
?> ?=([%clay %tire *] sign)
?- -.p.sign
%& (on-rock p.p.sign)
%| (on-wave p.p.sign)
==
::
[%warp * ~]
?> ?=(%writ +<.sign)
(on-writ i.t.wire p.sign)
== ==
[cards this] [cards this]
::
++ on-rock
|= tyr=rock:tire:clay
^- (quip card _state)
=| fex=(list card)
=/ ark ~(tap by tyr)
|- ^- (quip card _state)
?~ ark [(flop fex) state]
=^ caz state (on-zest [p zest.q]:i.ark)
$(ark t.ark, fex (weld (flop caz) fex))
::
++ on-wave
|= =wave:tire:clay
^- (quip card _state)
?- -.wave
%wait `state
%warp `state
%zest (on-zest +.wave)
==
::
++ on-zest
|= [=desk =zest:clay]
^- (quip card _state)
=* cha ~(. ch desk)
=/ card-1
(~(warp-our pass /warp/[desk]) desk ~ %sing %z da+now.bowl /desk/docket-0)
=^ cards-2 state
?. (~(has by charges) desk)
`state
=/ =charge (~(got by charges) desk)
?- zest
%live
?. ?=(%glob -.href.docket.charge)
=. charges (new-chad:cha %site ~)
:_(state ~[add-fact:cha])
:_(state ~[add-fact:cha])
::
?(%held %dead)
=/ glob=(unit glob)
?:(?=(%glob -.chad.charge) `glob.chad.charge ~)
=. charges (new-chad:cha %suspend glob)
:_(state ~[add-fact:cha])
==
[[card-1 cards-2] state]
::
++ on-writ
|= [=desk =riot:clay]
^- (quip card _state)
=/ card-1
(~(warp-our pass /warp/[desk]) desk ~ %next %z da+now.bowl /desk/docket-0)
=^ cards-2 state
=* cha ~(. ch desk)
=/ tyr
.^(rock:tire:clay %cx /(scot %p our.bowl)//(scot %da now.bowl)/tire)
?. =(%live zest:(~(got by tyr) desk))
`state
?. docket-exists:cha
:: ~? ?& !=(%base desk)
:: !=(%kids desk)
:: ==
:: [dap.bowl %no-docket-file-for desk]
?. (~(has by charges) desk)
`state
:- ~[del-fact:cha]
state(charges (~(del by charges) desk))
:: always update the docket in state to match clay's
::
=/ =docket docket:cha
=/ pre=(unit charge) (~(get by charges) desk)
=. charges (new-docket:cha docket)
:: if the new chad is a site, we're instantly done
::
?: ?=(%site -.href.docket)
=. charges (new-chad:cha %site ~)
:- ~[add-fact:cha]
state
::
=. by-base (~(put by by-base) base.href.docket desk)
:: if the glob specification is unchanged, keep it
::
?: &(?=(^ pre) =(href.docket.u.pre href.docket) ?=(%glob -.chad.u.pre))
[~[add-fact:cha] state]
:: if the glob spec changed, but we already host it, keep it
:: (this is the "just locally uploaded" case)
::
?: ?& ?=(^ pre)
?=(%glob -.chad.u.pre)
::
.= [(sham glob.chad.u.pre) %ames our.bowl]
glob-reference.href.docket
==
[~[add-fact:cha] state]
:: if the glob changed, forget the old and fetch the new
::
=. charges (new-chad:cha %install ~)
[[add-fact:cha fetch-glob:cha] state]
[[card-1 cards-2] state]
--
:: ::
++ on-fail on-fail:def ++ on-fail on-fail:def
++ on-leave on-leave:def ++ on-leave on-leave:def
@ -728,4 +747,3 @@
++ docket .^(^docket %cx (scry:io desk docket-loc)) ++ docket .^(^docket %cx (scry:io desk docket-loc))
-- --
-- --

View File

@ -2,16 +2,16 @@
/+ verb, dbug, default-agent, agentio /+ verb, dbug, default-agent, agentio
|% |%
+$ card card:agent:gall +$ card card:agent:gall
+$ state-0 [%0 lagging=_|] +$ state-1 [%1 lagging=_|]
:: ::
++ lag-interval ~m10 ++ lag-interval ~m10
-- --
%+ verb | %+ verb |
%- agent:dbug %- agent:dbug
^- agent:gall ^- agent:gall
=| state-0 =| state-1
=* state - =* state -
=< =<
|_ =bowl:gall |_ =bowl:gall
+* this . +* this .
def ~(. (default-agent this %|) bowl) def ~(. (default-agent this %|) bowl)
@ -21,12 +21,23 @@
++ on-init ++ on-init
^- (quip card _this) ^- (quip card _this)
:_ this :_ this
[onboard watch:kiln check:lag ~]:cc [onboard tire:cy check:lag ~]:cc
:: ::
++ on-load ++ on-load
|= =vase |= =vase
=+ !<(old=state-0 vase) ^- (quip card _this)
`this(state old) |^
=+ !<(old=app-states vase)
=^ cards-1 old
?. ?=(%0 -.old) `old
[[tire:cy:cc]~ old(- %1)]
?> ?=(%1 -.old)
=/ cards-tire [tire:cy:cc ~]
[(weld cards-1 cards-tire) this(state old)]
::
+$ app-states $%(state-0 state-1)
+$ state-0 [%0 lagging=_|]
--
:: ::
++ on-save !>(state) ++ on-save !>(state)
++ on-poke on-poke:def ++ on-poke on-poke:def
@ -34,45 +45,57 @@
++ on-watch on-watch:def ++ on-watch on-watch:def
++ on-agent ++ on-agent
|= [=wire =sign:agent:gall] |= [=wire =sign:agent:gall]
|^ ^- (quip card _this)
?+ wire (on-agent:def wire sign) ?+ wire (on-agent:def wire sign)
[%kiln %vats ~] take-kiln-vats [%kiln %vats ~] `this
== ==
++ take-kiln-vats ::
?- -.sign ++ on-arvo
?(%poke-ack %watch-ack) (on-agent:def wire sign) |= [=wire sign=sign-arvo]
%kick :_(this (drop safe-watch:kiln:cc)) ^- (quip card _this)
:: |^
%fact ?+ wire (on-arvo:def wire sign)
?. ?=(%kiln-vats-diff-0 p.cage.sign) `this [%clay %tire ~] take-clay-tire
=+ !<(=diff:hood q.cage.sign) [%clay %warp * ~] (take-clay-warp i.t.t.wire)
?+ -.diff `this [%check-lag ~] take-check-lag
:: ==
%commit ::
?. |(=(desk.diff %base) ~(has-docket de:cc desk.diff)) `this ++ take-check-lag
=/ =action:hark ~(commit de:cc desk.diff) ^- (quip card _this)
?> ?=([%behn %wake *] sign)
=+ .^(lag=? %$ (scry:io %$ /zen/lag))
?: =(lagging lag) :_(this ~[check:lag:cc])
:_ this(lagging lag)
:_ ~[check:lag:cc]
?:(lagging start:lag:cc stop:lag:cc)
::
++ take-clay-tire
^- (quip card _this)
?> ?=(%tire +<.sign)
?- -.p.sign
%& [(turn ~(tap in ~(key by p.p.sign)) warp:cy:cc) this]
%|
?- -.p.p.sign
%zest `this
%warp `this
%wait
=/ =action:hark (~(blocked de:cc desk.p.p.sign) weft.p.p.sign)
:_ this :_ this
~[(poke:ha:cc action)] ~[(poke:ha:cc action)]
::
%block
=/ =action:hark (~(blocked de:cc desk.diff) blockers.diff)
:_ this
~[(poke:ha:cc action)]
== ==
== ==
::
++ take-clay-warp
|= =desk
^- (quip card _this)
?> ?=(%writ +<.sign)
=/ cards
?. |(=(desk %base) ~(has-docket de:cc desk)) ~
=/ =action:hark ~(commit de:cc desk)
~[(poke:ha:cc action)]
[[(warp:cy:cc desk) cards] this]
-- --
:: ::
++ on-arvo
|= [=wire sign=sign-arvo]
^- (quip card _this)
?. ?=([%check-lag ~] wire) (on-arvo:def wire sign)
?> ?=([%behn %wake *] sign)
=+ .^(lag=? %$ (scry:io %$ /zen/lag))
?: =(lagging lag) :_(this ~[check:lag:cc])
:_ this(lagging lag)
:_ ~[check:lag:cc]
?:(lagging start:lag:cc stop:lag:cc)
::
++ on-fail on-fail:def ++ on-fail on-fail:def
++ on-leave on-leave:def ++ on-leave on-leave:def
-- --
@ -89,7 +112,7 @@
[~[text+'Welcome to urbit'] ~ now.bowl / /] [~[text+'Welcome to urbit'] ~ now.bowl / /]
:: ::
++ lag ++ lag
|% |%
++ check (~(wait pass /check-lag) (add now.bowl lag-interval)) ++ check (~(wait pass /check-lag) (add now.bowl lag-interval))
++ place [q.byk.bowl /lag] ++ place [q.byk.bowl /lag]
++ body `body:hark`[~[text/'Runtime lagging'] ~ now.bowl / /] ++ body `body:hark`[~[text/'Runtime lagging'] ~ now.bowl / /]
@ -102,24 +125,23 @@
++ poke ++ poke
|=(=action:hark (poke-our:pass %hark-store hark-action+!>(action))) |=(=action:hark (poke-our:pass %hark-store hark-action+!>(action)))
-- --
++ kiln ::
++ cy
|% |%
++ path /kiln/vats ++ tire ~(tire pass /clay/tire)
++ pass ~(. ^pass path) ++ warp
++ watch (watch-our:pass %hood path) |= =desk
++ watching (~(has by wex.bowl) [path our.bowl %hood]) (~(warp-our pass /clay/warp/[desk]) desk ~ %next %z da+now.bowl /)
++ safe-watch `(unit card)`?:(watching ~ `watch)
-- --
:: ::
++ de ++ de
|_ =desk |_ =desk
++ scry-path (scry:io desk /desk/docket-0) ++ scry-path (scry:io desk /desk/docket-0)
++ has-docket .^(? %cu scry-path) ++ has-docket .^(? %cu scry-path)
++ docket .^(docket:^docket %cx scry-path) ++ docket .^(docket:^docket %cx scry-path)
++ hash .^(@uv %cz (scry:io desk ~)) ++ hash .^(@uv %cz (scry:io desk ~))
++ place `place:hark`[q.byk.bowl /desk/[desk]] ++ place `place:hark`[q.byk.bowl /desk/[desk]]
++ vat ++ version ud:.^(cass:clay %cw (scry:io desk /))
.^(vat:hood %gx (scry:io %hood /kiln/vat/[desk]/noun))
++ body ++ body
|= [=path title=cord content=(unit cord)] |= [=path title=cord content=(unit cord)]
^- body:hark ^- body:hark
@ -131,7 +153,7 @@
%+ rap 3 %+ rap 3
?: =(desk %base) ?: =(desk %base)
['System software' cord ~] ['System software' cord ~]
?: has-docket ?: has-docket
['App: "' title:docket '"' cord ~] ['App: "' title:docket '"' cord ~]
['Desk: ' desk cord ~] ['Desk: ' desk cord ~]
:: ::
@ -142,7 +164,7 @@
:: ::
++ commit ++ commit
^- action:hark ^- action:hark
?:(=(1 ud.cass:vat) created updated) ?:(=(1 version) created updated)
:: ::
++ created ++ created
^- action:hark ^- action:hark
@ -155,11 +177,11 @@
(body /desk/[desk] (title-prefix (rap 3 ' has been updated to ' get-version ~)) ~) (body /desk/[desk] (title-prefix (rap 3 ' has been updated to ' get-version ~)) ~)
:: ::
++ blocked ++ blocked
|= blockers=(set ^desk) |= =weft
^- action:hark ^- action:hark
:+ %add-note [/blocked place] :+ %add-note [/blocked place]
%^ body /blocked (title-prefix ' is blocked from upgrading') %^ body /blocked (title-prefix ' is blocked from upgrading')
`(rap 3 'Blocking desks: ' (join ', ' ~(tap in blockers))) `(rap 3 'Blocked waiting for system version: ' (scot %ud num.weft) 'K' ~)
:: ::
++ ver ++ ver
|= =version:^docket |= =version:^docket
@ -172,7 +194,7 @@
-- --
++ note ++ note
|% |%
++ merge ++ merge
|= [=desk hash=@uv] |= [=desk hash=@uv]
^- (list body:hark) ^- (list body:hark)
:_ ~ :_ ~

View File

@ -1,7 +1,7 @@
:~ title+'System' :~ title+'System'
info+'An app launcher for Urbit.' info+'An app launcher for Urbit.'
color+0xee.5432 color+0xee.5432
glob-http+['https://bootstrap.urbit.org/glob-0v5.kgrq2.gp725.bo5bk.dmr7d.h41qk.glob' 0v5.kgrq2.gp725.bo5bk.dmr7d.h41qk] glob-http+['https://bootstrap.urbit.org/glob-0vm65f9.defur.eqhgj.62ls6.9v9lf.glob' 0vm65f9.defur.eqhgj.62ls6.9v9lf]
::glob-ames+~zod^0v0 ::glob-ames+~zod^0v0
base+'grid' base+'grid'
version+[1 1 6] version+[1 1 6]

View File

@ -28,6 +28,7 @@
%tas s+(scot %tas p.c) %tas s+(scot %tas p.c)
%ud (numb p.c) %ud (numb p.c)
== ==
::
++ foreign-desk ++ foreign-desk
|= [s=^ship =desk] |= [s=^ship =desk]
^- cord ^- cord

View File

@ -1 +1 @@
[%zuse 418] [%zuse 417]

View 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+[+<]))))

23744
pkg/grid/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,7 @@
"@radix-ui/react-toggle": "^0.0.10", "@radix-ui/react-toggle": "^0.0.10",
"@tlon/sigil-js": "^1.4.4", "@tlon/sigil-js": "^1.4.4",
"@types/lodash": "^4.14.172", "@types/lodash": "^4.14.172",
"@urbit/api": "^2.1.1", "@urbit/api": "^2.2.0",
"@urbit/http-api": "^2.1.0", "@urbit/http-api": "^2.1.0",
"big-integer": "^1.6.48", "big-integer": "^1.6.48",
"classnames": "^2.3.1", "classnames": "^2.3.1",

View File

@ -86,9 +86,8 @@ const AppRoutes = () => {
fetchCharges(); fetchCharges();
fetchAllies(); fetchAllies();
const { fetchVats, fetchLag } = useKilnState.getState(); const { initializeKiln } = useKilnState.getState();
fetchVats(); initializeKiln();
fetchLag();
useContactState.getState().initialize(api); useContactState.getState().initialize(api);
useHarkStore.getState().initialize(api); useHarkStore.getState().initialize(api);

View File

@ -1,4 +1,4 @@
import { chadIsRunning, Treaty, Vat } from '@urbit/api'; import { chadIsRunning, Pike, Treaty } from '@urbit/api';
import clipboardCopy from 'clipboard-copy'; import clipboardCopy from 'clipboard-copy';
import React, { FC, useCallback, useState } from 'react'; import React, { FC, useCallback, useState } from 'react';
import cn from 'classnames'; import cn from 'classnames';
@ -6,7 +6,7 @@ import { Button, PillButton } from './Button';
import { Dialog, DialogClose, DialogContent, DialogTrigger } from './Dialog'; import { Dialog, DialogClose, DialogContent, DialogTrigger } from './Dialog';
import { DocketHeader } from './DocketHeader'; import { DocketHeader } from './DocketHeader';
import { Spinner } from './Spinner'; import { Spinner } from './Spinner';
import { VatMeta } from './VatMeta'; import { PikeMeta } from './PikeMeta';
import useDocketState, { ChargeWithDesk, useTreaty } from '../state/docket'; import useDocketState, { ChargeWithDesk, useTreaty } from '../state/docket';
import { getAppHref, getAppName } from '../state/util'; import { getAppHref, getAppName } from '../state/util';
import { addRecentApp } from '../nav/search/Home'; import { addRecentApp } from '../nav/search/Home';
@ -17,7 +17,7 @@ type InstallStatus = 'uninstalled' | 'installing' | 'installed';
type App = ChargeWithDesk | Treaty; type App = ChargeWithDesk | Treaty;
interface AppInfoProps { interface AppInfoProps {
docket: App; docket: App;
vat?: Vat; pike?: Pike;
className?: string; className?: string;
} }
@ -34,10 +34,9 @@ function getInstallStatus(docket: App): InstallStatus {
return 'uninstalled'; return 'uninstalled';
} }
function getRemoteDesk(docket: App, vat?: Vat) { function getRemoteDesk(docket: App, pike?: Pike) {
if (vat && vat.arak.rail) { if (pike && pike.sync) {
const { ship, desk } = vat.arak.rail; return [pike.sync.ship, pike.sync.desk];
return [ship, desk];
} }
if ('chad' in docket) { if ('chad' in docket) {
return ['', docket.desk]; return ['', docket.desk];
@ -46,10 +45,10 @@ function getRemoteDesk(docket: App, vat?: Vat) {
return [ship, desk]; return [ship, desk];
} }
export const AppInfo: FC<AppInfoProps> = ({ docket, vat, className }) => { export const AppInfo: FC<AppInfoProps> = ({ docket, pike, className }) => {
const installStatus = getInstallStatus(docket); const installStatus = getInstallStatus(docket);
const [ship, desk] = getRemoteDesk(docket, vat); const [ship, desk] = getRemoteDesk(docket, pike);
const publisher = vat?.arak?.rail?.publisher ?? ship; const publisher = pike?.sync?.ship ?? ship;
const [copied, setCopied] = useState(false); const [copied, setCopied] = useState(false);
const treaty = useTreaty(ship, desk); const treaty = useTreaty(ship, desk);
@ -136,10 +135,10 @@ export const AppInfo: FC<AppInfoProps> = ({ docket, vat, className }) => {
</div> </div>
</DocketHeader> </DocketHeader>
<div className="space-y-6"> <div className="space-y-6">
{vat ? ( {pike ? (
<> <>
<hr className="-mx-5 sm:-mx-8 border-gray-50" /> <hr className="-mx-5 sm:-mx-8 border-gray-50" />
<VatMeta vat={vat} /> <PikeMeta pike={pike} />
</> </>
) : null} ) : null}
{!treaty ? null : ( {!treaty ? null : (

View File

@ -0,0 +1,25 @@
import React from 'react';
import { Pike } from '@urbit/api';
import { Attribute } from './Attribute';
export function PikeMeta(props: { pike: Pike }) {
const { pike } = props;
const pluralUpdates = pike.wefts?.length !== 1;
return (
<div className="mt-5 sm:mt-8 space-y-5 sm:space-y-8">
<Attribute title="Desk Hash" attr="hash">
{pike.hash}
</Attribute>
<Attribute title="Installed into" attr="local-desk">
%{pike.sync?.desk}
</Attribute>
{pike.wefts && pike.wefts.length > 0 ? (
<Attribute attr="next" title="Pending Updates">
{pike.wefts.length} update{pluralUpdates ? 's are' : ' is'} pending a System Update
</Attribute>
) : null}
</div>
);
}

View File

@ -3,11 +3,12 @@ import React, { HTMLAttributes } from 'react';
type ShipNameProps = { type ShipNameProps = {
name: string; name: string;
truncate?: boolean;
} & HTMLAttributes<HTMLSpanElement>; } & HTMLAttributes<HTMLSpanElement>;
export const ShipName = ({ name, ...props }: ShipNameProps) => { export const ShipName = ({ name, truncate = true, ...props }: ShipNameProps) => {
const separator = /([_^-])/; const separator = /([_^-])/;
const citedName = cite(name); const citedName = truncate ? cite(name) : name;
if (!citedName) { if (!citedName) {
return null; return null;

View File

@ -0,0 +1,103 @@
import React, { useCallback, useState } from 'react';
import { useAsyncCall } from '../logic/useAsyncCall';
import { Button } from './Button';
import { ShipName } from './ShipName';
import { Spinner } from './Spinner';
interface SourceSetterProps {
appName: string;
srcDesk: string;
srcShip?: string;
title: string;
toggleSrc: (desk: string, ship: string) => Promise<void>;
}
export default function SourceSetter({
appName,
srcDesk,
srcShip,
title,
toggleSrc
}: SourceSetterProps) {
const [newSyncShip, setNewSyncShip] = useState(srcShip ?? '');
const { status: requestStatus, call: handleSubmit } = useAsyncCall(toggleSrc);
const syncDirty = newSyncShip !== srcShip;
const onUnset = useCallback(() => {
if (!srcShip) {
return;
}
if (
// eslint-disable-next-line no-alert, no-restricted-globals
confirm(`Are you sure you want to unsync ${appName}? You will no longer receive updates.`)
) {
toggleSrc(srcDesk, srcShip);
}
}, [srcShip, srcDesk]);
const handleSourceChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {
const { target } = e;
const value = target.value.trim();
setNewSyncShip(value.startsWith('~') ? value : `~${value}`);
}, []);
const onSubmit = useCallback(
async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
await handleSubmit(srcDesk, newSyncShip);
},
[srcDesk, newSyncShip]
);
return (
<>
<h2 className="h3 mb-7">{title}</h2>
<div className="space-y-3">
{srcShip ? (
<>
<h3 className="flex items-center h4 mb-2">Automatic Updates</h3>
<p>Automatically download and apply updates to keep {appName} up to date.</p>
<div className="flex-1 flex flex-col justify-center space-y-6">
<p>
OTA Source:{' '}
<ShipName name={srcShip} truncate={false} className="font-semibold font-mono" />
</p>
</div>
<div className="flex space-x-2">
<Button onClick={onUnset} variant="destructive">
Unsync Updates for {appName}...
</Button>
</div>
</>
) : (
<form className="inner-section relative" onSubmit={onSubmit}>
<label htmlFor="ota-source" className="h4 mb-3">
Set Update Source
</label>
<p className="mb-2">Enter a valid urbit name to receive updates for {appName}.</p>
<div className="relative">
<input
id="ota-source"
type="text"
value={newSyncShip}
onChange={handleSourceChange}
className="input font-semibold default-ring"
/>
{syncDirty && (
<Button type="submit" className="absolute top-1 right-1 py-1 px-3 text-sm">
{requestStatus !== 'loading' && 'Save'}
{requestStatus === 'loading' && (
<>
<span className="sr-only">Saving...</span>
<Spinner className="w-5 h-5" />
</>
)}
</Button>
)}
</div>
</form>
)}
</div>
</>
);
}

View File

@ -1,27 +0,0 @@
import React from 'react';
import { Vat } from '@urbit/api';
import { Attribute } from './Attribute';
export function VatMeta(props: { vat: Vat }) {
const { vat } = props;
const { desk, arak, cass, hash } = vat;
const { desk: foreignDesk, ship, next } = arak.rail || {};
const pluralUpdates = next?.length !== 1;
return (
<div className="mt-5 sm:mt-8 space-y-5 sm:space-y-8">
<Attribute title="Desk Hash" attr="hash">
{hash}
</Attribute>
<Attribute title="Installed into" attr="local-desk">
%{desk}
</Attribute>
{next && next.length > 0 ? (
<Attribute attr="next" title="Pending Updates">
{next.length} update{pluralUpdates ? 's are' : ' is'} pending a System Update
</Attribute>
) : null}
</div>
);
}

View File

@ -3,9 +3,9 @@ import classNames from 'classnames';
import clipboardCopy from 'clipboard-copy'; import clipboardCopy from 'clipboard-copy';
import React, { HTMLAttributes, useCallback, useState } from 'react'; import React, { HTMLAttributes, useCallback, useState } from 'react';
import { Link, Route, useHistory } from 'react-router-dom'; import { Link, Route, useHistory } from 'react-router-dom';
import { Vat } from '@urbit/api'; import { Pike } from '@urbit/api';
import { Adjust } from '../components/icons/Adjust'; import { Adjust } from '../components/icons/Adjust';
import { useVat } from '../state/kiln'; import { usePike } from '../state/kiln';
import { disableDefault, handleDropdownLink } from '../state/util'; import { disableDefault, handleDropdownLink } from '../state/util';
import { useMedia } from '../logic/useMedia'; import { useMedia } from '../logic/useMedia';
import { Cross } from '../components/icons/Cross'; import { Cross } from '../components/icons/Cross';
@ -17,15 +17,15 @@ type SystemMenuProps = HTMLAttributes<HTMLButtonElement> & {
shouldDim: boolean; shouldDim: boolean;
}; };
function getHash(vat: Vat): string { function getHash(pike: Pike): string {
const parts = vat.hash.split('.'); const parts = pike.hash.split('.');
return parts[parts.length - 1]; return parts[parts.length - 1];
} }
export const SystemMenu = ({ className, open, subMenuOpen, shouldDim }: SystemMenuProps) => { export const SystemMenu = ({ className, open, subMenuOpen, shouldDim }: SystemMenuProps) => {
const { push } = useHistory(); const { push } = useHistory();
const [copied, setCopied] = useState(false); const [copied, setCopied] = useState(false);
const garden = useVat(window.desk); const garden = usePike(window.desk);
const hash = garden ? getHash(garden) : null; const hash = garden ? getHash(garden) : null;
const isMobile = useMedia('(max-width: 639px)'); const isMobile = useMedia('(max-width: 639px)');
const select = useLeapStore((s) => s.select); const select = useLeapStore((s) => s.select);

View File

@ -88,8 +88,8 @@ export const BasicNotification = ({ notification, lid }: BasicNotificationProps)
</header> </header>
{contents.length > 0 ? ( {contents.length > 0 ? (
<div className="leading-tight note-grid-body sm:leading-normal space-y-2"> <div className="leading-tight note-grid-body sm:leading-normal space-y-2">
{take(contents, MAX_CONTENTS).map((content) => ( {take(contents, MAX_CONTENTS).map((content, i) => (
<p className=""> <p className="" key={i}>
<NotificationText contents={content} /> <NotificationText contents={content} />
</p> </p>
))} ))}

View File

@ -13,7 +13,7 @@ function renderNotification(notification: Notification, key: string, lid: HarkLi
return <RuntimeLagNotification key={key} />; return <RuntimeLagNotification key={key} />;
} }
if (notification.bin.path === '/blocked' && notification.bin.place.path === '/desk/base') { if (notification.bin.path === '/blocked' && notification.bin.place.path === '/desk/base') {
return <BaseBlockedNotification key={key} />; return <BaseBlockedNotification key={key} bin={notification.bin} lid={lid} />;
} }
if (notification.bin.place.path === '/onboard') { if (notification.bin.place.path === '/onboard') {
return <OnboardingNotification key={key} lid={lid} />; return <OnboardingNotification key={key} lid={lid} />;

View File

@ -1,15 +1,15 @@
import React from 'react'; import React from 'react';
import cn from 'classnames'; import cn from 'classnames';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { HarkLid, Vats, getVatPublisher } from '@urbit/api'; import { HarkLid, Pikes, getPikePublisher } from '@urbit/api';
import { Button } from '../../components/Button'; import { Button } from '../../components/Button';
import { useBrowserId, useCurrentTheme } from '../../state/local'; import { useBrowserId, useCurrentTheme } from '../../state/local';
import { getDarkColor } from '../../state/util'; import { getDarkColor } from '../../state/util';
import useKilnState from '../../state/kiln'; import { usePikes } from '../../state/kiln';
import { useHarkStore } from '../../state/hark'; import { useHarkStore } from '../../state/hark';
import { useProtocolHandling } from '../../state/settings'; import { useProtocolHandling } from '../../state/settings';
const getCards = (vats: Vats, protocol: boolean): OnboardingCardProps[] => { const getCards = (pikes: Pikes, protocol: boolean): OnboardingCardProps[] => {
const cards = [ const cards = [
{ {
title: 'Terminal', title: 'Terminal',
@ -38,20 +38,6 @@ const getCards = (vats: Vats, protocol: boolean): OnboardingCardProps[] => {
ship: '~mister-dister-dozzod-dozzod', ship: '~mister-dister-dozzod-dozzod',
desk: 'bitcoin' desk: 'bitcoin'
} }
// Commenting out until we have something real
// {
// title: 'Debug',
// body: "Install a debugger. You can inspect your ship's internals using this interface",
// button: 'Install',
// color: '#E5E5E5',
// href: '/leap/search/direct/apps/~zod/debug'
// }
// {
// title: 'Build an app',
// body: 'You can instantly get started building new things on Urbit. Just right click your Landscape and select “New App”',
// button: 'Learn more',
// color: '#82A6CA'
// }
]; ];
if ('registerProtocolHandler' in window.navigator && !protocol) { if ('registerProtocolHandler' in window.navigator && !protocol) {
cards.push({ cards.push({
@ -66,8 +52,8 @@ const getCards = (vats: Vats, protocol: boolean): OnboardingCardProps[] => {
} }
return cards.filter((card) => { return cards.filter((card) => {
return !Object.values(vats).find( return !Object.values(pikes).find(
(vat) => getVatPublisher(vat) == card.ship && vat?.arak?.rail?.desk === card.desk (pike) => getPikePublisher(pike) === card.ship && pike.sync?.desk === card.desk
); );
}); });
}; };
@ -107,10 +93,10 @@ interface OnboardingNotificationProps {
export const OnboardingNotification = ({ unread = false, lid }: OnboardingNotificationProps) => { export const OnboardingNotification = ({ unread = false, lid }: OnboardingNotificationProps) => {
const theme = useCurrentTheme(); const theme = useCurrentTheme();
const vats = useKilnState((s) => s.vats); const pikes = usePikes();
const browserId = useBrowserId(); const browserId = useBrowserId();
const protocolHandling = useProtocolHandling(browserId); const protocolHandling = useProtocolHandling(browserId);
const cards = getCards(vats, protocolHandling); const cards = getCards(pikes, protocolHandling);
if (cards.length === 0 && !('time' in lid)) { if (cards.length === 0 && !('time' in lid)) {
useHarkStore.getState().archiveNote( useHarkStore.getState().archiveNote(

View File

@ -1,18 +1,18 @@
import { pick, pickBy, partition } from 'lodash'; import { pick, partition } from 'lodash';
import React, { useCallback } from 'react'; import React, { useCallback } from 'react';
import { kilnBump } from '@urbit/api'; import { HarkBin, HarkLid, kilnBump, Pike } from '@urbit/api';
import { useHistory } from 'react-router-dom';
import { AppList } from '../../components/AppList'; import { AppList } from '../../components/AppList';
import { Button } from '../../components/Button'; import { Button } from '../../components/Button';
import { Dialog, DialogClose, DialogContent, DialogTrigger } from '../../components/Dialog'; import { Dialog, DialogClose, DialogContent, DialogTrigger } from '../../components/Dialog';
import { Elbow } from '../../components/icons/Elbow'; import { Elbow } from '../../components/icons/Elbow';
import api from '../../state/api'; import api from '../../state/api';
import { useCharges } from '../../state/docket'; import { useCharges } from '../../state/docket';
import useKilnState, { useVat } from '../../state/kiln'; import useKilnState, { usePike } from '../../state/kiln';
import { NotificationButton } from './NotificationButton'; import { NotificationButton } from './NotificationButton';
import { disableDefault } from '../../state/util'; import { disableDefault } from '../../state/util';
import { Vat } from '@urbit/api'; import { useHarkStore } from '../../state/hark';
import {useHistory} from 'react-router-dom';
export const RuntimeLagNotification = () => ( export const RuntimeLagNotification = () => (
<section <section
@ -38,28 +38,33 @@ export const RuntimeLagNotification = () => (
</section> </section>
); );
function vatIsBlocked(newKelvin: number, vat: Vat) { function pikeIsBlocked(newKelvin: number, pike: Pike) {
return !(vat.arak?.rail?.next || []).find(({ aeon, weft }) => weft.kelvin === newKelvin); return pike.zest === 'live' && !pike.wefts?.find(({ kelvin }) => kelvin === newKelvin);
} }
export const BaseBlockedNotification = () => { export const BaseBlockedNotification = ({ bin, lid }: { bin: HarkBin, lid: HarkLid }) => {
const base = useVat('base'); const basePike = usePike('base');
const { push } = useHistory(); const { push } = useHistory();
// TODO: assert weft.name === 'zuse'?? // TODO: assert weft.name === 'zuse'??
const newKelvin = base?.arak?.rail?.next?.[0]?.weft?.kelvin || 420; const newKelvin = basePike?.wefts[0]?.kelvin ?? 417;
const charges = useCharges(); const charges = useCharges();
const [blocked, unblocked] = useKilnState((s) => { const [blocked] = useKilnState((s) => {
const [b, u] = partition(Object.entries(s.vats), ([desk, vat]) => vatIsBlocked(newKelvin, vat)); const [b, u] = partition(Object.entries(s.pikes), ([, pike]) => pikeIsBlocked(newKelvin, pike));
return [b.map(([d]) => d), u.map(([d]) => d)] as const; return [b.map(([d]) => d), u.map(([d]) => d)] as const;
}); });
const { toggleInstall } = useKilnState();
const blockedCharges = Object.values(pick(charges, blocked)); const blockedCharges = Object.values(pick(charges, blocked));
const count = blockedCharges.length; const count = blockedCharges.length;
const handlePauseOTAs = useCallback(() => {}, []); const handlePauseOTAs = useCallback(async () => {
await useHarkStore.getState().archiveNote(bin, lid);
}, []);
const handleArchiveApps = useCallback(async () => { const handleArchiveApps = useCallback(async () => {
api.poke(kilnBump(true)); await api.poke(kilnBump());
await useHarkStore.getState().archiveNote(bin, lid);
push('/leap/upgrading'); push('/leap/upgrading');
}, []); }, []);
@ -81,12 +86,12 @@ export const BaseBlockedNotification = () => {
<AppList apps={blockedCharges} labelledBy="blocked-apps" size="xs" className="font-medium" /> <AppList apps={blockedCharges} labelledBy="blocked-apps" size="xs" className="font-medium" />
<div className="space-y-6"> <div className="space-y-6">
<p> <p>
In order to proceed with the System Update, youll need to temporarily archive these apps, In order to proceed with the System Update, youll need to temporarily suspend these apps.
which will render them unusable, but with data intact. This will render them unusable, but with data intact.
</p> </p>
<p> <p>
Archived apps will automatically un-archive and resume operation when their developer Suspended apps will automatically resume operation when their developer
provides an app update. provides an update.
</p> </p>
</div> </div>
<div className="space-x-2"> <div className="space-x-2">
@ -97,30 +102,24 @@ export const BaseBlockedNotification = () => {
className="space-y-6 text-base tracking-tight" className="space-y-6 text-base tracking-tight"
containerClass="w-full max-w-md" containerClass="w-full max-w-md"
> >
<h2 className="h4">Skip System Update</h2> <h2 className="h4">Delay System Update</h2>
<p> <p>
Skipping the application fo an incoming System Update will grant you the ability to Are you sure you want to remain on an old version of Urbit
continue using incompatible apps at the cost of an urbit that&apos;s not up to date. until these apps have been updated?
</p>
<p>
You can choose to apply System Updates from System Preferences any time.{' '}
<a href="https://tlon.io" target="_blank" rel="noreferrer">
Learn More
</a>
</p> </p>
<div className="flex space-x-6"> <div className="flex space-x-6">
<DialogClose as={Button} variant="secondary"> <DialogClose as={Button} variant="secondary">
Cancel Cancel
</DialogClose> </DialogClose>
<DialogClose as={Button} variant="caution" onClick={handlePauseOTAs}> <DialogClose as={Button} variant="caution" onClick={handlePauseOTAs}>
Pause OTAs Remain on Old Version
</DialogClose> </DialogClose>
</div> </div>
</DialogContent> </DialogContent>
</Dialog> </Dialog>
<Dialog> <Dialog>
<DialogTrigger as={NotificationButton}> <DialogTrigger as={NotificationButton}>
Archive ({count}) apps and Apply System Update Suspend ({count}) Apps and Apply Update
</DialogTrigger> </DialogTrigger>
<DialogContent <DialogContent
showClose={false} showClose={false}
@ -128,10 +127,9 @@ export const BaseBlockedNotification = () => {
className="space-y-6 text-base tracking-tight" className="space-y-6 text-base tracking-tight"
containerClass="w-full max-w-md" containerClass="w-full max-w-md"
> >
<h2 className="h4">Archive ({count}) Apps and Apply System Update</h2> <h2 className="h4">Suspend ({count}) Apps and Apply System Update</h2>
<p> <p>
The following apps will be archived until their developer provides a compatible update The following apps will be suspended until their developer provides an update.
to your system.
</p> </p>
<AppList <AppList
apps={blockedCharges} apps={blockedCharges}
@ -144,7 +142,7 @@ export const BaseBlockedNotification = () => {
Cancel Cancel
</DialogClose> </DialogClose>
<DialogClose as={Button} variant="caution" onClick={handleArchiveApps}> <DialogClose as={Button} variant="caution" onClick={handleArchiveApps}>
Archive Apps Suspend Apps and Upgrade
</DialogClose> </DialogClose>
</div> </div>
</DialogContent> </DialogContent>

View File

@ -1,39 +1,25 @@
import React, { useCallback } from 'react'; import React from 'react';
import { RouteComponentProps } from 'react-router-dom'; import { RouteComponentProps } from 'react-router-dom';
import { Setting } from '../../components/Setting'; import SourceSetter from '../../components/SourceSetter';
import { ShipName } from '../../components/ShipName';
import { useCharge } from '../../state/docket'; import { useCharge } from '../../state/docket';
import useKilnState, { useVat } from '../../state/kiln'; import useKilnState, { usePike } from '../../state/kiln';
import { getAppName } from '../../state/util'; import { getAppName } from '../../state/util';
export const AppPrefs = ({ match }: RouteComponentProps<{ desk: string }>) => { export const AppPrefs = ({ match }: RouteComponentProps<{ desk: string }>) => {
const { desk } = match.params; const { desk } = match.params;
const charge = useCharge(desk); const charge = useCharge(desk);
const vat = useVat(desk); const appName = getAppName(charge);
const tracking = !!vat?.arak.rail; const pike = usePike(desk);
const otasEnabled = !vat?.arak.rail?.paused; const srcShip = pike?.sync?.ship;
const otaSource = vat?.arak.rail?.ship; const { toggleSync } = useKilnState();
const toggleOTAs = useKilnState((s) => s.toggleOTAs);
const toggleUpdates = useCallback((on: boolean) => toggleOTAs(desk, on), [desk, toggleOTAs]);
return ( return (
<> <SourceSetter
<h2 className="h3 mb-7">{getAppName(charge)} Settings</h2> appName={appName}
<div className="space-y-3"> toggleSrc={toggleSync}
{tracking ? ( srcDesk={desk}
<Setting on={otasEnabled} toggle={toggleUpdates} name="Automatic Updates"> srcShip={srcShip}
<p>Automatically download and apply updates to keep {getAppName(charge)} up to date.</p> title={`${appName} Settings`}
{otaSource && ( />
<p>
OTA Source: <ShipName name={otaSource} className="font-semibold font-mono" />
</p>
)}
</Setting>
) : (
<h4 className="text-gray-500">No settings</h4>
)}
</div>
</>
); );
}; };

View File

@ -1,88 +1,22 @@
import _ from 'lodash'; import _ from 'lodash';
import React, { ChangeEvent, FormEvent, useCallback, useEffect, useState } from 'react'; import React from 'react';
import { Button } from '../../components/Button'; import SourceSetter from '../../components/SourceSetter';
import { Setting } from '../../components/Setting'; import useKilnState, { usePike } from '../../state/kiln';
import { ShipName } from '../../components/ShipName';
import { Spinner } from '../../components/Spinner';
import { useAsyncCall } from '../../logic/useAsyncCall';
import useKilnState, { useVat } from '../../state/kiln';
export const SystemUpdatePrefs = () => { export const SystemUpdatePrefs = () => {
const { changeOTASource, toggleOTAs } = useKilnState((s) => const desk = 'base';
_.pick(s, ['toggleOTAs', 'changeOTASource']) const appName = 'your Urbit';
); const pike = usePike(desk);
const base = useVat('base'); const srcShip = pike?.sync?.ship;
const otasEnabled = base && !(base.arak?.rail?.paused ?? true); const { toggleInstall } = useKilnState();
const otaSource = base && base.arak.rail?.ship;
const toggleBase = useCallback((on: boolean) => toggleOTAs('base', on), [toggleOTAs]);
const [source, setSource] = useState('');
const sourceDirty = source !== otaSource;
const { status: sourceStatus, call: setOTA } = useAsyncCall(changeOTASource);
useEffect(() => {
if (otaSource) {
setSource(otaSource);
}
}, [otaSource]);
const handleSourceChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {
const { target } = e;
const value = target.value.trim();
setSource(value.startsWith('~') ? value : `~${value}`);
}, []);
const onSubmit = useCallback(
(e: FormEvent<HTMLFormElement>) => {
e.preventDefault();
setOTA(source);
},
[source]
);
return ( return (
<> <SourceSetter
<h2 className="h3 mb-7">System Updates</h2> appName={appName}
<div className="space-y-3"> toggleSrc={toggleInstall}
<Setting on={!!otasEnabled} toggle={toggleBase} name="Enable Automatic Urbit OTAs"> srcDesk={desk}
<p>Automatically download and apply system updates to keep your Urbit up to date.</p> srcShip={srcShip}
{otaSource && ( title="System Updates"
<p> />
OTA Source: <ShipName name={otaSource} className="font-semibold font-mono" />
</p>
)}
</Setting>
<form className="inner-section relative" onSubmit={onSubmit}>
<label htmlFor="ota-source" className="h4 mb-3">
Switch OTA Source
</label>
<p className="mb-2">
Enter a valid urbit name into this form to change who you receive OTA updates from. Be
sure to select a reliable urbit!
</p>
<div className="relative">
<input
id="ota-source"
type="text"
value={source}
onChange={handleSourceChange}
className="input font-semibold default-ring"
/>
{sourceDirty && (
<Button type="submit" className="absolute top-1 right-1 py-1 px-3 text-sm">
{sourceStatus !== 'loading' && 'Save'}
{sourceStatus === 'loading' && (
<>
<span className="sr-only">Saving...</span>
<Spinner className="w-5 h-5" />
</>
)}
</Button>
)}
</div>
</form>
</div>
</>
); );
}; };

View File

@ -3,7 +3,7 @@ import { useParams } from 'react-router-dom';
import { AppInfo } from '../../components/AppInfo'; import { AppInfo } from '../../components/AppInfo';
import { Spinner } from '../../components/Spinner'; import { Spinner } from '../../components/Spinner';
import useDocketState, { useCharge, useTreaty } from '../../state/docket'; import useDocketState, { useCharge, useTreaty } from '../../state/docket';
import { useVat } from '../../state/kiln'; import { usePike } from '../../state/kiln';
import { getAppName } from '../../state/util'; import { getAppName } from '../../state/util';
import { useLeapStore } from '../Nav'; import { useLeapStore } from '../Nav';
@ -11,7 +11,7 @@ export const TreatyInfo = () => {
const select = useLeapStore((state) => state.select); const select = useLeapStore((state) => state.select);
const { host, desk } = useParams<{ host: string; desk: string }>(); const { host, desk } = useParams<{ host: string; desk: string }>();
const treaty = useTreaty(host, desk); const treaty = useTreaty(host, desk);
const vat = useVat(desk); const pike = usePike(desk);
const charge = useCharge(desk); const charge = useCharge(desk);
const name = getAppName(treaty); const name = getAppName(treaty);
@ -34,5 +34,5 @@ export const TreatyInfo = () => {
</div> </div>
); );
} }
return <AppInfo className="dialog-inner-container" docket={charge || treaty} vat={vat} />; return <AppInfo className="dialog-inner-container" docket={charge || treaty} pike={pike} />;
}; };

View File

@ -26,8 +26,8 @@ export const Grid: FunctionComponent = () => {
window.location.reload(); window.location.reload();
} }
const start = performance.now(); const start = performance.now();
await useKilnState.getState().fetchVats(); await useKilnState.getState().fetchPikes();
await useKilnState.getState().fetchVats(); await useKilnState.getState().fetchPikes();
if (performance.now() - start > 5000) { if (performance.now() - start > 5000) {
attempt(count + 1); attempt(count + 1);
} else { } else {

View File

@ -1,15 +1,15 @@
import { Pikes } from '@urbit/api';
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import { Switch, Route, Redirect, RouteComponentProps } from 'react-router-dom'; import { Switch, Route, Redirect, RouteComponentProps } from 'react-router-dom';
import { Spinner } from '../components/Spinner'; import { Spinner } from '../components/Spinner';
import { useQuery } from '../logic/useQuery'; import { useQuery } from '../logic/useQuery';
import { useCharge } from '../state/docket'; import { useCharge } from '../state/docket';
import useKilnState, { useKilnLoaded } from '../state/kiln'; import { useKilnLoaded, usePikes } from '../state/kiln';
import { getAppHref } from '../state/util'; import { getAppHref } from '../state/util';
function getDeskByForeignRef(ship: string, desk: string): string | undefined { function getDeskByForeignRef(pikes: Pikes, ship: string, desk: string): string | undefined {
const { vats } = useKilnState.getState(); const found = Object.entries(pikes).find(
const found = Object.entries(vats).find( ([, pike]) => pike.sync?.ship === ship && pike.sync?.desk === desk
([, vat]) => vat.arak.rail?.ship === ship && vat.arak.rail?.desk === desk
); );
return found ? found[0] : undefined; return found ? found[0] : undefined;
} }
@ -22,8 +22,8 @@ type AppLinkProps = RouteComponentProps<{
function AppLink({ match, history, location }: AppLinkProps) { function AppLink({ match, history, location }: AppLinkProps) {
const { ship, desk, link = '' } = match.params; const { ship, desk, link = '' } = match.params;
const ourDesk = getDeskByForeignRef(ship, desk); const pikes = usePikes();
console.log(ourDesk); const ourDesk = getDeskByForeignRef(pikes, ship, desk);
if (ourDesk) { if (ourDesk) {
return <AppLinkRedirect desk={ourDesk} link={link} />; return <AppLinkRedirect desk={ourDesk} link={link} />;

View File

@ -1,99 +1,76 @@
import { import {
getVats,
Vats,
scryLag, scryLag,
getBlockers, getPikes,
Vat, Pikes,
kilnInstall, Pike,
kilnPause, kilnUnsync,
kilnResume kilnSync,
kilnUninstall,
kilnInstall
} from '@urbit/api'; } from '@urbit/api';
import create from 'zustand'; import create from 'zustand';
import produce from 'immer'; import produce from 'immer';
import { useCallback } from 'react'; import { useCallback } from 'react';
import api from './api'; import api from './api';
import { fakeRequest, useMockData } from './util'; import { fakeRequest, useMockData } from './util';
import { mockVats } from './mock-data'; import { mockPikes } from './mock-data';
interface KilnState { interface KilnState {
vats: Vats; pikes: Pikes;
loaded: boolean; loaded: boolean;
fetchVats: () => Promise<void>;
lag: boolean; lag: boolean;
fetchLag: () => Promise<void>; fetchLag: () => Promise<void>;
changeOTASource: (ship: string) => Promise<void>; fetchPikes: () => Promise<void>;
toggleOTAs: (desk: string, on: boolean) => Promise<void>; toggleInstall: (desk: string, ship: string) => Promise<void>;
toggleSync: (desk: string, ship: string) => Promise<void>;
set: (s: KilnState) => void; set: (s: KilnState) => void;
initializeKiln: () => Promise<void>;
} }
const useKilnState = create<KilnState>((set, get) => ({ const useKilnState = create<KilnState>((set, get) => ({
vats: useMockData ? mockVats : {}, pikes: useMockData ? mockPikes : {},
lag: !!useMockData, lag: !!useMockData,
loaded: false, loaded: false,
fetchVats: async () => { fetchPikes: async () => {
if (useMockData) { if (useMockData) {
await fakeRequest({}, 500); await fakeRequest({}, 500);
set({ loaded: true }); set({ loaded: true });
return; return;
} }
const vats = await api.scry<Vats>(getVats); const pikes = await api.scry<Pikes>(getPikes);
set({ vats, loaded: true }); set({ pikes, loaded: true });
}, },
fetchLag: async () => { fetchLag: async () => {
const lag = await api.scry<boolean>(scryLag); const lag = await api.scry<boolean>(scryLag);
set({ lag }); set({ lag });
}, },
changeOTASource: async (ship: string) => { toggleInstall: async (desk: string, ship: string) => {
if (useMockData) { const synced = !!get().pikes[desk].sync;
await fakeRequest(''); await (useMockData
set( ? fakeRequest('')
produce((draft: KilnState) => { : api.poke(synced ? kilnUninstall(desk) : kilnInstall(ship, 'kids', desk)));
if (!draft.vats.base.arak.rail) { await get().fetchPikes();
return;
}
draft.vats.base.arak.rail.ship = ship;
})
);
return;
}
await api.poke(kilnInstall(ship, 'kids', 'base'));
}, },
toggleOTAs: async (desk: string, on: boolean) => { toggleSync: async (desk: string, ship: string) => {
set( const synced = !!get().pikes[desk].sync;
produce((draft: KilnState) => { await (useMockData
const { arak } = draft.vats[desk]; ? fakeRequest('')
if (!arak.rail) { : api.poke(synced ? kilnUnsync(ship, desk) : kilnSync(ship, desk)));
return; await get().fetchPikes();
}
if (on) {
arak.rail.paused = false;
} else {
arak.rail.paused = true;
}
})
);
await (useMockData ? fakeRequest('') : api.poke(on ? kilnResume(desk) : kilnPause(desk)));
await get().fetchVats(); // refresh vat state
}, },
set: produce(set) set: produce(set),
initializeKiln: async () => {
await get().fetchLag();
await get().fetchPikes();
}
})); }));
api.subscribe({ const selPikes = (s: KilnState) => s.pikes;
app: 'hood', export function usePikes(): Pikes {
path: '/kiln/vats', return useKilnState(selPikes);
event: () => {
useKilnState.getState().fetchVats();
}
});
const selBlockers = (s: KilnState) => getBlockers(s.vats);
export function useBlockers() {
return useKilnState(selBlockers);
} }
export function useVat(desk: string): Vat | undefined { export function usePike(desk: string): Pike | undefined {
return useKilnState(useCallback((s) => s.vats[desk], [desk])); return useKilnState(useCallback((s) => s.pikes[desk], [desk]));
} }
const selLag = (s: KilnState) => s.lag; const selLag = (s: KilnState) => s.lag;

View File

@ -1,6 +1,4 @@
import { import {
Vat,
Vats,
Allies, Allies,
Charges, Charges,
DocketHrefGlob, DocketHrefGlob,
@ -13,7 +11,8 @@ import {
Contact, Contact,
Contacts, Contacts,
Timebox, Timebox,
harkBinToId harkBinToId,
Pikes
} from '@urbit/api'; } from '@urbit/api';
import _ from 'lodash'; import _ from 'lodash';
import systemUrl from '../assets/system.png'; import systemUrl from '../assets/system.png';
@ -341,37 +340,35 @@ export const mockContacts: Contacts = {
} }
}; };
export const mockVat = (desk: string, blockers?: boolean): Vat => ({ export const mockPikes: Pikes = {
cass: { kids: {
da: '~2021.9.13..05.41.04..ae65', sync: null,
ud: 1 zest: 'dead',
wefts: [],
hash: '0v19.q7u27.omps3.fbhf4.53rai.co157.pben7.pu94n.63v4p.3kcb7.iafj0'
}, },
desk, garden: {
arak: { sync: {
rein: { desk: 'garden',
sub: [], ship: '~mister-dister-dozzod-dozzod'
add: []
}, },
rail: zest: 'live',
desk === 'uniswap' wefts: [],
? null hash: '0v18.hbbs6.onu15.skjkv.qrfgl.vf4oo.0igo5.2q0d3.6r3r8.2dkmo.oa04m'
: {
aeon: 3,
desk,
publisher: '~zod',
next: blockers ? [{ aeon: 3, weft: { name: 'zuse', kelvin: 419 } }] : [],
ship: '~zod',
paused: desk === 'groups'
}
}, },
hash: '0vh.lhfn6.julg1.fs52d.g2lqj.q5kp0.2o7j3.2bljl.jdm34.hd46v.9uv5v' landscape: {
}); sync: {
desk: 'landscape',
const badVats = ['inbox', 'system', 'terminal', 'base']; ship: '~lander-dister-dozzod-dozzod'
export const mockVats = _.reduce( },
mockCharges, zest: 'live',
(vats, charge, desk) => { wefts: [],
return { ...vats, [desk]: mockVat(desk, !badVats.includes(desk)) }; hash: '0v1t.qln8k.cskmt.cn6lv.gu335.jfba6.kte90.iqqn3.aj67b.t389a.8imuo'
}, },
{ base: mockVat('base', true) } as Vats base: {
); sync: null,
zest: 'live',
wefts: [],
hash: '0v1e.b5auh.6u82i.hqk1r.22kli.4ubef.a1cbo.3g532.6l49k.g0i8e.t6eid'
}
};

View File

@ -8,7 +8,7 @@ import { getAppHref } from '../state/util';
import { useRecentsStore } from '../nav/search/Home'; import { useRecentsStore } from '../nav/search/Home';
import { ChargeWithDesk } from '../state/docket'; import { ChargeWithDesk } from '../state/docket';
import { useTileColor } from './useTileColor'; import { useTileColor } from './useTileColor';
import { useVat } from '../state/kiln'; import { usePike } from '../state/kiln';
import { Bullet } from '../components/icons/Bullet'; import { Bullet } from '../components/icons/Bullet';
import { dragTypes } from './TileGrid'; import { dragTypes } from './TileGrid';
@ -21,11 +21,12 @@ type TileProps = {
export const Tile: FunctionComponent<TileProps> = ({ charge, desk, disabled = false }) => { export const Tile: FunctionComponent<TileProps> = ({ charge, desk, disabled = false }) => {
const addRecentApp = useRecentsStore((state) => state.addRecentApp); const addRecentApp = useRecentsStore((state) => state.addRecentApp);
const { title, image, color, chad, href } = charge; const { title, image, color, chad, href } = charge;
const vat = useVat(desk); const pike = usePike(desk);
const { lightText, tileColor, menuColor, suspendColor, suspendMenuColor } = useTileColor(color); const { lightText, tileColor, menuColor, suspendColor, suspendMenuColor } = useTileColor(color);
const loading = !disabled && 'install' in chad; const loading = !disabled && 'install' in chad;
const suspended = disabled || 'suspend' in chad; const suspended = disabled || 'suspend' in chad;
const hung = 'hung' in chad; const hung = 'hung' in chad;
// TODO should held zest be considered inactive? suspended? also, null sync?
const active = !disabled && chadIsRunning(chad); const active = !disabled && chadIsRunning(chad);
const link = getAppHref(href); const link = getAppHref(href);
const backgroundColor = suspended ? suspendColor : active ? tileColor || 'purple' : suspendColor; const backgroundColor = suspended ? suspendColor : active ? tileColor || 'purple' : suspendColor;
@ -56,6 +57,9 @@ export const Tile: FunctionComponent<TileProps> = ({ charge, desk, disabled = fa
> >
<div> <div>
<div className="absolute z-10 top-4 left-4 sm:top-6 sm:left-6 flex items-center"> <div className="absolute z-10 top-4 left-4 sm:top-6 sm:left-6 flex items-center">
{pike?.zest === 'held' && !disabled && (
<Bullet className="w-4 h-4 text-orange-500 dark:text-black" />
)}
{!active && ( {!active && (
<> <>
{loading && <Spinner className="h-6 w-6 mr-2" />} {loading && <Spinner className="h-6 w-6 mr-2" />}
@ -65,9 +69,6 @@ export const Tile: FunctionComponent<TileProps> = ({ charge, desk, disabled = fa
</> </>
)} )}
</div> </div>
{vat?.arak.rail?.paused && !disabled && (
<Bullet className="absolute z-10 top-5 left-5 sm:top-7 sm:left-7 w-4 h-4 text-orange-500 dark:text-black" />
)}
<TileMenu <TileMenu
desk={desk} desk={desk}
chad={chad} chad={chad}

View File

@ -3,13 +3,13 @@ import { useHistory, useParams } from 'react-router-dom';
import { Dialog, DialogContent } from '../components/Dialog'; import { Dialog, DialogContent } from '../components/Dialog';
import { AppInfo } from '../components/AppInfo'; import { AppInfo } from '../components/AppInfo';
import { useCharge } from '../state/docket'; import { useCharge } from '../state/docket';
import { useVat } from '../state/kiln'; import { usePike } from '../state/kiln';
export const TileInfo = () => { export const TileInfo = () => {
const { desk } = useParams<{ desk: string }>(); const { desk } = useParams<{ desk: string }>();
const { push } = useHistory(); const { push } = useHistory();
const charge = useCharge(desk); const charge = useCharge(desk);
const vat = useVat(desk); const pike = usePike(desk);
if (!charge) { if (!charge) {
return null; return null;
@ -18,7 +18,7 @@ export const TileInfo = () => {
return ( return (
<Dialog open onOpenChange={(open) => !open && push('/')}> <Dialog open onOpenChange={(open) => !open && push('/')}>
<DialogContent> <DialogContent>
<AppInfo vat={vat} docket={charge} /> <AppInfo pike={pike} docket={charge} />
</DialogContent> </DialogContent>
</Dialog> </Dialog>
); );

File diff suppressed because it is too large Load Diff

View File

@ -26,6 +26,7 @@ interface NoteProps {
} }
export function NoteContent({ post }) { export function NoteContent({ post }) {
console.log(post.contents);
return ( return (
<Box color="black" className="md" style={{ overflowWrap: 'break-word', overflow: 'hidden' }}> <Box color="black" className="md" style={{ overflowWrap: 'break-word', overflow: 'hidden' }}>
<GraphContent tall={true} contents={post.contents.slice(1)} showOurContact /> <GraphContent tall={true} contents={post.contents.slice(1)} showOurContact />

View File

@ -123,7 +123,15 @@
:: ensure difference :: ensure difference
=/ old=(unit contact:store) (~(get by rolodex) ship) =/ old=(unit contact:store) (~(get by rolodex) ship)
?. ?| ?=(~ old) ?. ?| ?=(~ old)
!=(contact(last-updated *@da) u.old(last-updated *@da)) :: if new contact is before existing contact, no-op
::
:: NB: last-updated.contact is often *@da, so this
:: effectively stops add from applying if we already have
:: a contact for them
::
?& (gth last-updated.contact last-updated.u.old)
!=(contact(last-updated *@da) u.old(last-updated *@da))
==
== ==
[~ state] [~ state]
~| "cannot add a data url to cover!" ~| "cannot add a data url to cover!"

View File

@ -54,12 +54,7 @@
++ on-pull-nack ++ on-pull-nack
|= [=resource =tang] |= [=resource =tang]
^- (quip card _this) ^- (quip card _this)
%- (slog leaf+"nacked {<resource>}" tang) `this
:_ this
?. (~(has in get-keys:gra) resource) ~
=- [%pass /pull-nack %agent [our.bowl %graph-store] %poke %graph-update-3 -]~
!> ^- update:store
[now.bowl [%archive-graph resource]]
:: ::
++ on-pull-kick ++ on-pull-kick
|= =resource |= =resource

View File

@ -11,16 +11,17 @@
[%3 network:one:store] [%3 network:one:store]
[%4 network:store] [%4 network:store]
[%5 network:store] [%5 network:store]
state-6 [%6 network:store]
state-7
== ==
::- ::-
+$ state-6 [%6 network:store] +$ state-7 [%7 network:store]
++ orm orm:store ++ orm orm:store
++ orm-log orm-log:store ++ orm-log orm-log:store
++ mar %graph-update-3 ++ mar %graph-update-3
-- --
:: ::
=| state-6 =| state-7
=* state - =* state -
:: ::
%- agent:dbug %- agent:dbug
@ -96,7 +97,43 @@
(scag 2 (tap:orm-log update-log)) (scag 2 (tap:orm-log update-log))
== ==
:: ::
%6 [cards this(state old)] %6
=/ old-dms
%- ~(gas by *(map resource:store marked-graph:store))
%+ skim ~(tap by graphs.old)
|=([r=resource:store *] (is-old-dm:upgrade:store r))
=/ backup (backup:upgrade:store bowl)
%_ $
-.old %7
archive.old ~
update-logs.old
%- ~(gas by *(map resource:store update-log:store))
%+ murn ~(tap by update-logs.old)
|= [r=resource:store =update-log:store]
?: (is-old-dm:upgrade:store r)
~
`[r (strip-sigs-log:upgrade:store update-log)]
::
graphs.old
%- ~(gas by *(map resource:store marked-graph:store))
%+ murn ~(tap by graphs.old)
|= [r=resource:store =graph:store mar=(unit mark)]
?: (is-old-dm:upgrade:store r)
~
`[r (strip-sigs-graph:upgrade:store graph) mar]
::
cards
;: welp
cards
::
(nuke-groups:upgrade:store bowl)
::
(turn ~(tap by archive.old) backup)
(turn ~(tap by old-dms) backup)
==
==
::
%7 [cards this(state old)]
== ==
:: ::
++ on-watch ++ on-watch
@ -129,9 +166,21 @@
?+ mark (on-poke:def mark vase) ?+ mark (on-poke:def mark vase)
%graph-update-3 (graph-update !<(update:store vase)) %graph-update-3 (graph-update !<(update:store vase))
%import (poke-import q.vase) %import (poke-import q.vase)
%migrated (poke-migrated !<(resource:store vase))
== ==
[cards this] [cards this]
:: ::
++ poke-migrated
|= r=resource:res
^- (quip card _state)
=/ =path /(rap 3 'backup-' (scot %p entity.r) '-' name.r ~)/noun
=/ graph (~(got by graphs) r)
:- [%pass /migrate %agent [our.bowl %hood] %poke drum-put+!>([path (jam r graph)])]~
%_ state
graphs (~(del by graphs) r)
update-logs (~(del by update-logs) r)
==
::
++ graph-update ++ graph-update
|= =update:store |= =update:store
^- (quip card _state) ^- (quip card _state)
@ -644,6 +693,16 @@
|= =path |= =path
^- (unit (unit cage)) ^- (unit (unit cage))
?+ path (on-peek:def path) ?+ path (on-peek:def path)
[%x %whey ~]
=/ liv=(list mass)
(sort (turn ~(tap by graphs) |=([[* n=term] g=*] n^&+g)) aor)
=/ log=(list mass)
(sort (turn ~(tap by update-logs) |=([[* n=term] l=*] n^&+l)) aor)
=/ sil=(list mass)
(sort (turn ~(tap by archive) |=([[* n=term] g=*] n^&+g)) aor)
:^ ~ ~ %mass
!>(`(list mass)`[live+|+liv logs+|+log ?~(sil ~ [silo+|+sil ~])])
::
[%x %export ~] ``noun+!>(state) [%x %export ~] ``noun+!>(state)
:: ::
[%x %keys ~] [%x %keys ~]

View File

@ -45,10 +45,7 @@
++ on-pull-nack ++ on-pull-nack
|= [=resource =tang] |= [=resource =tang]
^- (quip card _this) ^- (quip card _this)
%- (slog tang) `this
:_ this
=- [%pass / %agent [our.bowl %group-store] %poke -]~
group-update-0+!>([%remove-group resource ~])
:: ::
++ on-pull-kick ++ on-pull-kick
|= =resource |= =resource

View File

@ -31,13 +31,16 @@
:: ::
/- *group /- *group
/+ store=group-store, default-agent, verb, dbug, resource, *migrate, agentio /+ store=group-store, default-agent, verb, dbug, resource, *migrate, agentio
/+ gladio
|% |%
+$ card card:agent:gall +$ card card:agent:gall
++ ota-host ~sogryp-dister-dozzod-dozzod
:: ::
+$ versioned-state +$ versioned-state
$% state-zero $% state-zero
state-one state-one
state-two state-two
state-three
== ==
:: ::
+$ state-zero +$ state-zero
@ -52,13 +55,19 @@
$: %2 $: %2
=groups =groups
== ==
::
+$ state-three
$: %3
=groups
wait=(set ship)
==
-- --
:: ::
=| state-two =| state-three
=* state - =* state -
:: ::
%- agent:dbug %- agent:dbug
%+ verb | %+ verb &
^- agent:gall ^- agent:gall
=< =<
|_ =bowl:gall |_ =bowl:gall
@ -72,10 +81,24 @@
++ on-load ++ on-load
|= =old=vase |= =old=vase
=/ old !<(versioned-state old-vase) =/ old !<(versioned-state old-vase)
=| cards=(list card)
|^ |^
?- -.old ?- -.old
%2 `this(state old) %3 [(flop cards) this(state old)]
:: ::
%2
%_ $
old [%3 groups.old ~]
cards
%- welp
:_ cards
:~ [%pass /pyre/export %agent [our dap]:bowl %poke noun+!>(%export)]
[%pass /pyre/migrate %agent [our dap]:bowl %poke noun+!>(%migrate)]
[%pass / %agent [our %hood]:bowl %poke %kiln-install !>([%groups ota-host %groups])]
[%pass / %agent [our %hood]:bowl %poke %kiln-install !>([%talk ota-host %talk])]
==
==
::
%1 %1
%_ $ %_ $
-.old %2 -.old %2
@ -112,6 +135,12 @@
=^ cards state =^ cards state
?+ mark (on-poke:def mark vase) ?+ mark (on-poke:def mark vase)
%sane (poke-sane:gc !<(?(%check %fix) vase)) %sane (poke-sane:gc !<(?(%check %fix) vase))
::
%noun
?+ q.vase !!
%migrate poke-migrate:gc
%export poke-export:gc
==
:: ::
?(%group-update-0 %group-action) ?(%group-update-0 %group-action)
(poke-group-update:gc !<(update:store vase)) (poke-group-update:gc !<(update:store vase))
@ -125,6 +154,8 @@
|= =path |= =path
^- (quip card _this) ^- (quip card _this)
?> (team:title our.bowl src.bowl) ?> (team:title our.bowl src.bowl)
?: ?=([%wait ~] path)
`this
?> ?=([%groups ~] path) ?> ?=([%groups ~] path)
:_ this :_ this
[%give %fact ~ %group-update-0 !>([%initial groups])]~ [%give %fact ~ %group-update-0 !>([%initial groups])]~
@ -135,6 +166,8 @@
|= =path |= =path
^- (unit (unit cage)) ^- (unit (unit cage))
?+ path (on-peek:def path) ?+ path (on-peek:def path)
[%x %wait ~]
``ships+!>(~(tap in wait))
[%y %groups ~] [%y %groups ~]
``noun+!>(`(set resource)`~(key by groups)) ``noun+!>(`(set resource)`~(key by groups))
:: ::
@ -159,28 +192,38 @@
++ on-agent ++ on-agent
|= [=wire =sign:agent:gall] |= [=wire =sign:agent:gall]
^- (quip card _this) ^- (quip card _this)
?. ?=([%try-rejoin @ *] wire) =^ cards state
(on-agent:def wire sign) ?+ wire [- state]:(on-agent:def wire sign)
?> ?=(%poke-ack -.sign) [%pyre *] (take-pyre:gc t.wire sign)
=/ rid=resource (de-path:resource t.t.wire) [%gladio @ ~] (take-migrate:gc sign)
?~ p.sign ::
=/ =cage [%try-rejoin @ *]
[%pull-hook-action !>([%add entity.rid rid])] ?> ?=(%poke-ack -.sign)
:_ this =/ rid=resource (de-path:resource t.t.wire)
[%pass / %agent [our.bowl %group-pull-hook] %poke cage]~ ?~ p.sign
=/ nack-count=@ud (slav %ud i.t.wire) =/ =cage
=/ wakeup=@da [%pull-hook-action !>([%add entity.rid rid])]
(add now.bowl (mul ~s1 (bex (min 19 nack-count)))) :_ state
:_ this [%pass / %agent [our.bowl %group-pull-hook] %poke cage]~
[%pass wire %arvo %b %wait wakeup]~ =/ nack-count=@ud (slav %ud i.t.wire)
=/ wakeup=@da
(add now.bowl (mul ~s1 (bex (min 19 nack-count))))
:_ state
[%pass wire %arvo %b %wait wakeup]~
==
[cards this]
:: ::
++ on-arvo ++ on-arvo
|= [=wire =sign-arvo] |= [=(pole knot) =sign-arvo]
^- (quip card _this) ^- (quip card _this)
?. ?=([%try-rejoin @ *] wire) ?: ?=([%gladio %backoff ship=@ ~] pole)
(on-arvo:def wire sign-arvo) =^ cards state
=/ =resource (de-path:resource t.t.wire) (take-backoff:gc (slav %p ship.pole) sign-arvo)
=/ nack-count=@ud (slav %ud i.t.wire) [cards this]
?. ?=([%try-rejoin count=@ res=*] pole)
(on-arvo:def pole sign-arvo)
=/ =resource (de-path:resource res.pole)
=/ nack-count=@ud (slav %ud count.pole)
?> ?=([%behn %wake *] sign-arvo) ?> ?=([%behn %wake *] sign-arvo)
~? ?=(^ error.sign-arvo) ~? ?=(^ error.sign-arvo)
"behn errored in backoff timers, continuing anyway" "behn errored in backoff timers, continuing anyway"
@ -192,6 +235,71 @@
:: ::
|_ bol=bowl:gall |_ bol=bowl:gall
+* io ~(. agentio bol) +* io ~(. agentio bol)
++ poke-export
^- (quip card _state)
:_ state
=; =cage
[%pass /export %agent [our.bol %hood] %poke cage]~
drum-put+!>([/groups/jam ~(export gladio bol)])
::
++ poke-migrate
^- (quip card _state)
=^ cards-1=(list card) wait
(~(migrate-start gladio bol) wait)
=/ cards-2=(list card)
(turn ~(tap in wait) watch-init-migrate)
=/ cards (welp cards-1 cards-2)
[cards state(wait wait)]
::
++ watch-init-migrate
|= =ship
^- card
[%pass /gladio/(scot %p ship) %agent [ship %groups] %watch /init]
::
++ backoff-migrate
|= =ship
^- card
[%pass /gladio/backoff/(scot %p ship) %arvo %b %wait (add ~h1 now.bol)]
::
++ take-pyre
|= [=wire =sign:agent:gall]
^- (quip card _state)
:_ state
?> ?=(%poke-ack -.sign)
?~ p.sign
~
[%pass / %pyre leaf/"{<wire>} failed" u.p.sign]~
::
++ take-backoff
|= [=ship sign=sign-arvo]
^- (quip card _state)
?> ?=([%behn %wake *] sign)
?: ?=(^ error.sign)
`state
:_ state
~[(watch-init-migrate ship)]
::
++ take-migrate
|= =sign:agent:gall
^- (quip card _state)
?. (~(has in wait) src.bol)
:: already succeeded
`state
?- -.sign
?(%poke-ack %fact) `state
%kick :_(state (watch-init-migrate src.bol)^~)
%watch-ack
?~ p.sign
:: they have public release
~& migrating/src.bol
=. wait (~(del in wait) src.bol)
:_ state
:- [%give %fact ~[/wait] ships+!>(~(tap in wait))]
(~(migrate-ship gladio bol) src.bol)
:_ state
~[(backoff-migrate src.bol)]
==
::
++ peek-group ++ peek-group
|= rid=resource |= rid=resource
^- (unit group) ^- (unit group)
@ -243,8 +351,8 @@
|= arc=* |= arc=*
^- (quip card _state) ^- (quip card _state)
|^ |^
=/ sty=state-two =/ sty=state-three
[%2 (remake-groups ;;((tree [resource tree-group]) +.arc))] [%3 (remake-groups ;;((tree [resource tree-group]) +.arc)) ~]
:_ sty :_ sty
%+ roll ~(tap by groups.sty) %+ roll ~(tap by groups.sty)
|= [[rid=resource grp=group] out=(list card)] |= [[rid=resource grp=group] out=(list card)]

View File

@ -321,15 +321,7 @@
++ on-pull-nack ++ on-pull-nack
|= [=resource =tang] |= [=resource =tang]
^- (quip card _this) ^- (quip card _this)
=/ =associations:metadata `this
(metadata-for-group:met resource)
:_ this
%+ turn ~(tap by associations)
|= [=md-resource:metadata =association:metadata]
%+ poke-our:pass:io:hc %metadata-store
:- %metadata-update-2
!> ^- update:metadata
[%remove resource md-resource]
:: ::
++ on-pull-kick ++ on-pull-kick
|= =resource |= =resource

View File

@ -29,7 +29,6 @@
%metadata-hook %metadata-hook
%metadata-pull-hook %metadata-pull-hook
%metadata-push-hook %metadata-push-hook
%notify
%observe-hook %observe-hook
%sane %sane
%weather %weather

View File

@ -1,10 +0,0 @@
:~ title+'Groups'
info+'A suite of applications to communicate on Urbit'
color+0xee.5432
glob-http+['https://bootstrap.urbit.org/glob-0v7.2rpmd.966js.dt2sj.ggv4a.n15nq.glob' 0v7.2rpmd.966js.dt2sj.ggv4a.n15nq]
base+'landscape'
version+[1 1 0]
website+'https://tlon.io'
license+'MIT'
==

View File

@ -0,0 +1,193 @@
:: Migrate scripts
/- gra=graph-store
/- met=metadata-store
/- grp=group-store
/- i=migrate
/- *group
|_ =bowl:gall
+$ card card:agent:gall
:: if false, indicates that OTA should be done in one go, in order to
:: allow for testing on partial testnets
++ split-ota &
++ import-club
|= [=^groups =associations:met =network:gra]
%- ~(gas by *imports:club:i)
%+ murn ~(tap by graphs.network)
|= [=flag:i graph=graph:gra mar=(unit mark)]
^- (unit [flag:i import:club:i])
?. =(mar `%graph-validator-chat)
~
?~ assoc=(~(get by associations) [%graph flag])
~& missing-assoc-club/flag
~
?~ group=(~(get by groups) group.u.assoc)
~& missing-group/[flag group.u.assoc]
~
?. hidden.u.group
~
`[flag members.u.group u.assoc graph]
::
++ import-flags
|= [our=ship =^groups =associations:met =network:gra]
|= =mark
^- (set flag:i)
%- ~(gas in *(set flag:i))
%+ skim
~(tap in ~(key by ((import-for-mark ~ groups associations network) mark)))
|= =flag:i
!=(our p.flag)
::
++ import-for-mark
|= [her=(unit ship) =^groups =associations:met =network:gra]
|= =mark
^- imports:graph:i
%- ~(gas by *imports:graph:i)
%+ murn ~(tap by graphs.network)
|= [=flag:i graph=graph:gra mar=(unit ^mark)]
?. |(=(`p.flag her) =(her ~))
~
?. =(mar `mark) :: XX: correct detection?
~
?~ assoc=(~(get by associations) [%graph flag])
~& missing-assoc/flag^mark
~
?~ group=(~(get by groups) group.u.assoc)
~& missing-group/[flag group.u.assoc]
~
?: hidden.u.group
~
=/ writers=(set ship)
(~(get ju tags.u.group) %graph flag %writers)
?~ log=(~(get by update-logs.network) flag)
~& missing-log/flag :: XX: doesn't need to fail, but suspect case
~
`[flag writers u.assoc u.log graph]
++ scry
|= [=dude:gall =path]
%- welp
:_ path
/gx/(scot %p our.bowl)/[dude]/(scot %da now.bowl)
++ groups
~+ .^([@ =^groups *] (scry %group-store /export/noun))
++ groups-raw
.^(* (scry %group-store /export/noun))
++ network
~+ .^([@ =network:gra] (scry %graph-store /export/noun))
++ network-raw
.^(* (scry %graph-store /export/noun))
++ associations
~+ .^([@ =associations:met ~] (scry %metadata-store /export/noun))
++ associations-raw
.^(* (scry %metadata-store /export/noun))
++ export
%- jam
^- *
:~ [%group-store groups-raw]
[%metadata-store associations-raw]
==
++ peers
|= =network:gra
=- (~(del in -) our.bowl)
%- ~(gas in *(set ship))
(turn ~(tap in ~(key by graphs.network)) head)
++ poke-our
|= [=dude:gall =cage]
[%pass /gladio %agent [our.bowl dude] %poke cage]
++ migrate-start
|= wait=(set ship)
^- (quip card (set ship))
=+ network
=+ associations
=+ groups
=/ ships (peers network)
=/ dms (~(get by graphs:network) [our.bowl %dm-inbox])
=/ import (import-for-mark `our.bowl groups associations network)
=/ clubs (import-club groups associations network)
=/ chats=imports:graph:i
(import %graph-validator-chat)
=/ diarys=imports:graph:i
(import %graph-validator-publish)
=/ links=imports:graph:i
(import %graph-validator-link)
=/ =imports:groups:i
%- ~(gas by *imports:groups:i)
%+ murn ~(tap by groups)
|= [=flag:i =group]
^- (unit [_flag import:groups:i])
?: hidden.group
~
?~ assoc=(~(get by associations) [%groups flag])
~& missing-group-assoc/flag
~
=/ chans=(map flag:i association:met)
%- ~(gas by *(map flag:i association:met))
%+ murn ~(tap by associations)
|= [res=md-resource:met ass=association:met]
^- (unit [flag:i association:met])
?. =(group.ass flag) ~
`[resource.res ass]
=/ roles=(set flag:i)
%- ~(gas in *(set flag:i))
%+ murn ~(tap by chans)
|= [=flag:i =association:met]
^- (unit flag:i)
?^ link=(~(get by links) flag)
?: =(writers.u.link ~) ~
`flag
?^ diary=(~(get by diarys) flag)
?: =(writers.u.diary ~) ~
`flag
?^ chat=(~(get by chats) flag)
?: =(writers.u.chat ~) ~
`flag
~
`[flag u.assoc chans roles group]
=/ dms (~(get by graphs:network) [our.bowl %dm-inbox])
=/ flag-importer (import-flags our.bowl groups associations network)
=+ :* chat-flags=(flag-importer %graph-validator-chat)
heap-flags=(flag-importer %graph-validator-link)
diary-flags=(flag-importer %graph-validator-publish)
==
=/ setup=(list card)
%+ welp (migrate-ship our.bowl)
:* (poke-our %groups group-import+!>(imports))
(poke-our %chat import-flags+!>(chat-flags))
(poke-our %heap import-flags+!>(heap-flags))
(poke-our %diary import-flags+!>(diary-flags))
(poke-our %chat club-imports+!>(clubs))
?~ dms ~
(poke-our %chat dm-imports+!>(p.u.dms))^~
==
?. split-ota
:_ ~
(welp setup (zing (turn ~(tap in (~(del in ships) our.bowl)) migrate-ship)))
[setup (~(uni in ships) wait)]
::
++ migrate-ship
|= her=ship
^- (list card)
=+ groups
=+ network
=+ associations
=/ import (import-for-mark `her groups associations network)
=/ chats=imports:graph:i
(import %graph-validator-chat)
=/ diarys=imports:graph:i
(import %graph-validator-publish)
=/ links=imports:graph:i
(import %graph-validator-link)
=/ graph-flags
%. ~(key by links)
=- ~(uni in -)
(~(uni in ~(key by chats)) ~(key by diarys))
%+ welp
%+ turn ~(tap in graph-flags)
|= =flag:i
^- card
(poke-our %graph-store migrated+!>(flag))
:~ (poke-our %chat graph-imports+!>(chats))
(poke-our %diary graph-imports+!>(diarys))
(poke-our %heap graph-imports+!>(links))
==
--

View File

@ -528,6 +528,81 @@
:: ::
++ upgrade ++ upgrade
|% |%
++ is-old-dm |=(r=resource =('dm--' (end [3 4] name.r)))
++ backup
|= =bowl:gall
|= [r=resource m=marked-graph]
^- card:agent:gall
=/ pax /(rap 3 'archive-' (scot %p entity.r) '-' name.r ~)/noun
=/ =cage drum-put+!>([pax (jam r m)])
[%pass /archive %agent [our.bowl %hood] %poke cage]
++ strip-sigs-graph
|= g=graph
^+ g
=* loop $
%+ gas:orm *graph
%+ turn (tap:orm g)
|= [key=@ val=node] :: optional: also strip out deleted messages?
=? children.val ?=(%graph -.children.val)
[%graph loop(g p.children.val)]
:- key
?. ?=(%& -.post.val)
val
val(signatures.p.post ~)
++ strip-sigs-log
|= u=update-log
%+ gas:orm-log *update-log
%+ turn (tap:orm-log u)
|= [key=@ upd=logged-update]
:- key
:- p.upd
?+ -.q.upd q.upd
%add-graph
q.upd(graph (strip-sigs-graph graph.q.upd))
::
%add-signatures
q.upd(signatures ~)
::
%remove-signatures
q.upd(signatures ~)
::
%add-nodes
%= q.upd
nodes
%- ~(run by nodes.q.upd)
|= =node
^+ node
%= node
children
?. ?=(%graph -.children.node)
children.node
[%graph (strip-sigs-graph p.children.node)]
::
post
?. ?=(%& -.post.node)
post.node
=. signatures.p.post.node ~
post.node
==
==
==
::
++ nuke-groups
|= =bowl:gall
|^ ^- (list card:agent:gall)
?. .^(? (gall-scry %u %groups))
~
=+ .^(=desk (gall-scry %d %groups))
:~ [%pass /nuke %agent [our.bowl %hood] %poke kiln-nuke+!>([desk &])]
[%pass /nuke %agent [our.bowl %docket] %poke docket-uninstall+!>(desk)]
[%pass /nuke %agent [our.bowl %docket] %poke docket-uninstall+!>(%talk)]
==
::
++ gall-scry
|= [=care:clay dap=dude:gall]
^- path
/(cat 3 %g care)/(scot %p our.bowl)/[dap]/(scot %da now.bowl)
--
:: ::
:: +two :: +two
:: ::
@ -758,9 +833,9 @@
-- --
++ import ++ import
|= [arc=* our=ship] |= [arc=* our=ship]
^- (quip card:agent:gall [%6 network]) ^- (quip card:agent:gall [%7 network])
|^ |^
=/ sty [%6 (remake-network ;;(tree-network +.arc))] =/ sty [%7 (remake-network ;;(tree-network +.arc))]
:_ sty :_ sty
%+ turn ~(tap by graphs.sty) %+ turn ~(tap by graphs.sty)
|= [rid=resource =marked-graph] |= [rid=resource =marked-graph]

View File

@ -0,0 +1,23 @@
/- met=metadata-store, gra=graph-store
/- *group
|%
+$ flag (pair ship term)
++ graph
|%
+$ import
[writers=(set ship) =association:met =update-log:gra =graph:gra]
+$ imports (map flag import)
--
::
++ groups
|%
+$ import [=association:met chans=(map flag =association:met) roles=(set flag) =group]
+$ imports (map flag import)
--
++ club
|%
+$ import [ships=(set ship) =association:met =graph:gra]
+$ imports (map flag import)
--
--

View File

@ -1 +1 @@
[%zuse 418] [%zuse 417]

Some files were not shown because too many files have changed in this diff Show More