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
oid sha256:2f46209c31bc7be965b6ba32db92fb0746be15d9613b1c3c8d09ce7fa0e5e157
size 8280141
oid sha256:ea8626444e4f0213e39c21ded20607145ee85a947afc592f182f46e7f598ef30
size 7748671

View File

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

View File

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

View File

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

View File

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

View File

@ -2,8 +2,8 @@
/+ drum=hood-drum, helm=hood-helm, kiln=hood-kiln
|%
+$ state
$~ [%23 *state:drum *state:helm *state:kiln]
$>(%23 any-state)
$~ [%24 *state:drum *state:helm *state:kiln]
$>(%24 any-state)
::
+$ 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]
[%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]
[%24 drum=state-4:drum helm=state-2:helm kiln=state-10:kiln]
==
+$ any-state-tuple
$: drum=any-state:drum

View File

@ -166,10 +166,10 @@
(on-load on-save)
=^ cards state
?+ mark (on-poke:def mark vase)
%spider-input (on-poke-input:sc !<(input vase))
%spider-start (handle-start-thread:sc !<(start-args:spider vase))
%spider-stop (handle-stop-thread:sc !<([tid ?] vase))
::
%spider-input (on-poke-input:sc !<(input vase))
%spider-start (handle-start-thread:sc !<(start-args:spider 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:sc !<([@ta =inbound-request:eyre] vase))
==
@ -303,12 +303,31 @@
++ handle-start-thread
~/ %handle-start-thread
|= [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)
=/ parent-yarn=yarn
?~ 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)
::
?: (~(has of running.state) yarn)
@ -321,16 +340,19 @@
=? serving.state !(~(has by serving.state) new-tid)
(~(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
@ -349,23 +371,25 @@
=/ maybe-thread (mule |.(!<(thread !<(vase q.r.u.riot))))
?: ?=(%| -.maybe-thread)
(thread-fail-not-running tid %thread-not-thread ~)
(start-thread yarn p.maybe-thread)
(slam-thread yarn p.maybe-thread)
::
++ start-thread
~/ %start-thread
++ slam-thread
~/ %slam-thread
|= [=yarn =thread]
^- (quip card ^state)
=/ =vase vase:(~(got by starting.state) yarn)
?< (~(has of running.state) yarn)
=/ m (strand ,^vase)
=/ res (mule |.((thread vase)))
?: ?=(%| -.res)
(thread-fail-not-running (yarn-to-tid yarn) %false-start p.res)
=/ =eval-form:eval:m
(from-form:eval:m p.res)
=: starting.state (~(del by starting.state) yarn)
running.state (~(put of running.state) yarn eval-form)
==
=. starting.state (~(del by starting.state) yarn)
(begin-shed yarn p.res)
::
++ 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 ~)
::
++ 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
|= $: [now=@da eny=@uvJ bec=beak]
~
force=_|
except=(set desk)
==
[%kiln-bump except force]
|= [[now=@da eny=@uvJ bec=beak] ~ ~]
[%kiln-bump ~]

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
:- desk
=+ .^(=cone:clay %cx /(scot %p p.bec)//(scot %da now)/domes)
%+ roll arg
=/ =rein:hood
=< rein.arak
.^(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))
|: [*[on=? =dude:gall] rein=ren:(~(got by cone) [p.bec desk])]
(~(put by rein) dude on)

View File

@ -15,4 +15,7 @@
?@ +.arg [q.bec -.arg]
?> ((sane %tas) +<.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
=+ .^(=rang %cx /(scot %p p.bec)//(scot %da now)/rang)
=+ .^(=cone %cx /(scot %p p.bec)//(scot %da now)/domes)
=/ domes=(list [[=ship =desk] =dome tom=(map tako norm) nor=norm])
~(tap by cone)
=/ domes=(list [[=ship =desk] foam]) ~(tap by cone)
=/ norms
|^
|- ^- (set [ship desk tako norm path])
@ -24,14 +23,14 @@
=/ =aeon 1
%- ~(uni in $(domes t.domes))
|- ^- (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)
(~(uni in paths) $(aeon +(aeon)))
::
++ draw-tako
|= [=ship =desk [dome tom=(map tako norm) nor=norm] =tako]
|= [=ship =desk foam =tako]
^- (set [^ship ^desk ^tako norm path])
~+
=/ =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
%- zing
%+ turn ~(tap by cone)
|= [[=ship =desk] dome tom=(map tako norm) nor=norm]
|= [[=ship =desk] foam]
:- leaf+"{<ship>}/{<desk>}:"
%+ turn ~(tap of nor)
|= [=path keep=?]

View File

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

View File

@ -3,6 +3,8 @@
::::
::
/- *story
/$ story-to-txt %story %txt
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[[~] =desk ~]
@ -15,9 +17,6 @@
tang+[leaf+"Error: desk {<desk>} does not exist." ~]
?: !.^(? %cu pax)
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-text (story-to-txt tale)
tang+tale-text
=/ tale-text (flop (story-to-txt tale))
tang+tale-text

View File

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

View File

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

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
++ grab
|%
++ noun bump
++ json
^- $-(^json bump)
=, dejs:format
%- ot
:~ except+(as so)
force+bo
==
++ noun ,~
++ json ul:dejs:format
--
++ 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 +.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
@ -773,7 +773,7 @@
::
~> %slog.[0 leaf+"1-c (compiling compiler, wait a few minutes)"]
=/ 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
:: able to generate matching reflection nouns even if the
@ -781,7 +781,7 @@
:: generate last-generation spans for `!>`, etc.
::
~> %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
:: of the compiler gate. we just compiled the compiler,
@ -791,18 +791,18 @@
::
~> %slog.[0 leaf+"1-e"]
=/ 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.
::
~> %slog.[0 leaf+"1-f"]
=/ 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.
::
~> %slog.[0 leaf+"1-g"]
[.*(+>:compiler-gate +:kernel-tool) epic.log]
[.*(+>.compiler-gate +.kernel-tool) epic.log]
--
::
:: |adapt
@ -1570,7 +1570,7 @@
::
%crud =? lag.zen ?& ?=(%exit mote.goof.buz)
?=(^ tang.goof.buz)
?=(%leaf -.i.tang.goof.buz) :: XX ?@
?=([%leaf *] i.tang.goof.buz)
?=(%wyrd (crip p.i.tang.goof.buz))
==
~&(%lagging &)

View File

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

View File

@ -1,9 +1,9 @@
:: /sys/lull
:: %lull: arvo structures
::
!:
=> ..part
|%
++ lull %329
++ lull %328
:: :: ::
:::: :: :: (1) models
:: :: ::
@ -755,6 +755,7 @@
[%note p=@tD q=tank] :: debug message
[%ogre p=@tas] :: delete mount point
[%rule red=dict wit=dict] :: node r+w permissions
[%tire p=(each rock:tire wave:tire)] :: app state
[%writ p=riot] :: response
[%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
[%perm des=desk pax=path rit=rite] :: change permissions
[%pork ~] :: resume commit
[%rein des=desk ren=rein] :: extra apps
[%stir arg=*] :: debug
[%tire p=(unit ~)] :: app state subscribe
[%tomb =clue] :: tombstone specific
$>(%trim vane-task) :: trim state
$>(%vega vane-task) :: report upgrade
[%warp wer=ship rif=riff] :: internal 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
== ::
:: ::
@ -822,9 +827,14 @@
[%worn =ship =desk =tako =norm] :: set commit norm
[%seek =ship =desk =cash] :: fetch source blobs
== ::
+$ cone :: domes
%+ map [ship desk] ::
[dome tom=(map tako norm) nor=norm] ::
+$ cone (map [ship desk] foam) :: domes
+$ foam ::
$: dome ::
tom=(map tako norm) ::
nor=norm ::
liv=zest ::
ren=(map dude:gall ?) ::
== ::
+$ crew (set ship) :: permissions group
+$ dict [src=path rul=real] :: effective permission
+$ dome :: project state
@ -894,6 +904,7 @@
who=(pair (set ship) (map @ta crew)) ::
== ::
+$ regs (map path rule) :: rules for paths
+$ rein (map dude:gall ?) :: extra apps
+$ riff [p=desk q=(unit rave)] :: request+desist
+$ riff-any ::
$% [%1 =riff] ::
@ -917,6 +928,9 @@
[%| p=(list a) q=(list a)] :: p -> q[chunk]
== ::
++ urge |*(a=mold (list (unce a))) :: list change
+$ waft :: kelvin range
$^ [[%1 ~] p=(set weft)] ::
weft ::
+$ whom (each ship @ta) :: ship or named crew
+$ yoki (each yuki yaki) :: commit
+$ yuki :: proto-commit
@ -929,11 +943,111 @@
r=tako :: self-reference
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 |=(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
@ -1658,6 +1772,7 @@
[%sear =ship] :: clear pending queues
[%jolt =desk =dude] :: (re)start agent
[%idle =dude] :: suspend agent
[%load =load] :: load agent
[%nuke =dude] :: delete agent
[%doff dude=(unit dude) ship=(unit ship)] :: kill subscriptions
[%rake dude=(unit dude) all=?] :: reclaim old subs
@ -1686,6 +1801,7 @@
== == ::
+$ dude term :: server identity
+$ gill (pair ship term) :: general contact
+$ load (list [=dude =beak =agent]) :: loadout
+$ scar :: opaque duct
$: p=@ud :: bone sequence
q=(map duct bone) :: by duct
@ -2126,10 +2242,11 @@
$~ [%vega ~] ::
$% $>(%born vane-task) :: new unix process
[%done ~] :: socket closed
:: XX mark ignored
::
:: TODO mark ignored ::
:: ::
[%fard p=(fyrd cage)] :: in-arvo thread
[%fyrd p=(fyrd cast)] :: external thread
[%lard =bear =shed] :: inline thread
$>(%trim vane-task) :: trim state
$>(%vega vane-task) :: report upgrade
== ::
@ -2138,8 +2255,200 @@
+$ bear $@(desk beak) :: partial $beak
+$ cast (pair mark page) :: output mark + input
++ fyrd |$ [a] [=bear name=term args=a] :: thread run request
:: ::
+$ shed _*form:(strand:rand ,vase) :: compute vase
-- ::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 <-$
$~ [%doze ~]
$% gift:ames

View File

@ -1280,9 +1280,11 @@
[%forward-lane ~]
::
:: 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
:: - indirect route to the peer: send to both that route and the
:: the peer's sponsoring galaxy
@ -1294,6 +1296,8 @@
==
~
=; zar=(trap (list lane))
?: (lth last-contact.qos.u.peer (sub now ~h1))
$:zar
?~ route.u.peer $:zar
=* rot u.route.u.peer
?:(direct.rot [lane.rot ~] [lane.rot $:zar])
@ -2229,6 +2233,10 @@
?: for
event-core
(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
%- (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
%perm :: change permissions
%warp :: wait for clay hack
%zest ::
== ::
task:clay ::
== ::
@ -52,10 +53,7 @@
task:dill ::
== ::
$: %g ::
$> $? %jolt ::
%deal ::
== ::
task:gall ::
$>(%deal task:gall) ::
== ::
$: %j ::
$> $? %dawn ::
@ -221,7 +219,7 @@
^+ .
=/ myt (flop (fall tem ~))
=. tem ~
=. ..mere (pass / %g %jolt %base ram)
=. ..mere (pass /zest %c %zest %base %live)
=. ..mere (show-desk %kids)
=. ..mere drum-watch
|- ^+ ..mere
@ -247,14 +245,6 @@
|= des=desk
(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
|= [tea=wire sih=sign]
^+ +>

View File

@ -551,6 +551,18 @@
(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
@ -602,6 +614,31 @@
[action [authenticated secure address request] ~ 0]
=. connections.state
(~(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,
:: whether the origin is approved or not,
:: and maybe add it to the "pending approval" set
@ -1228,7 +1265,7 @@
:: the request may include a 'Last-Event-Id' header
::
=/ 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)
:: flush events older than the passed in 'Last-Event-ID'
@ -2272,6 +2309,10 @@
::
%live
=. 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]
:: %rule: updates our http configuration
::
@ -2284,6 +2325,10 @@
?: =(secure.config cert.http-rule.task)
[~ http-server-gate]
=. secure.config cert.http-rule.task
=. redirect.config
?& ?=(^ secure.ports.server-state.ax)
?=(^ cert.http-rule.task)
==
:_ http-server-gate
=* out-duct outgoing-duct.server-state.ax
?~ out-duct ~
@ -2534,6 +2579,12 @@
++ load
|= 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)
:: +stay: produce current state
::

View File

@ -42,9 +42,9 @@
:: $move: Arvo-level move
::
+$ 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
::
:: system-duct: TODO document
@ -73,11 +73,11 @@
:: control-duct: TODO document
:: run-nonce: unique for each rebuild
:: sub-nonce: app-wide global %watch nonce
:: live: is this agent running? TODO document boarer
:: stats: TODO document
:: bitt: incoming subscriptions
:: boat: outgoing subscriptions
:: boar: and their nonces
:: code: most recently loaded code
:: agent: agent core
:: beak: compilation source
:: marks: mark conversion requests
@ -86,11 +86,11 @@
$: control-duct=duct
run-nonce=@t
sub-nonce=_1
live=?
=stats
=bitt
=boat
=boar
code=*
agent=(each agent vase)
=beak
marks=(map duct mark)
@ -149,7 +149,7 @@
:: $spore: structures for update, produced by +stay
::
+$ spore
$: %10
$: %11
system-duct=duct
outstanding=(map [wire duct] (qeu remote-request))
contacts=(set ship)
@ -163,223 +163,21 @@
$: control-duct=duct
run-nonce=@t
sub-nonce=@
live=?
=stats
=bitt
=boat
=boar
old-state=(each vase vase)
code=~
old-state=[%| vase]
=beak
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
::
=| state=state-10
=| state=state-11
|= [now=@da eny=@uvJ rof=roof]
=* gall-payload .
=< ~% %gall-wrap ..mo ~
|%
++ call ^call
++ load ^load
++ scry ^scry
++ stay ^stay
++ take ^take
--
~% %gall-top ..part ~
|%
:: +mo: Arvo-level move handling
@ -413,27 +211,14 @@
mo-core
=. mo-core (mo-pass i.list)
$(list t.list)
:: +mo-jolt: (re)start agent if not already started on this desk
:: +mo-jolt: (re)start agent
::
++ mo-jolt
|= [dap=term =ship =desk]
^+ mo-core
=/ yak (~(get by yokes.state) dap)
?~ yak
(mo-boot 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)
=/ =wire /sys/cor/[dap]/(scot %p ship)/[desk]
..mo-core
:: XX (mo-pass wire %c %jolt dap ship desk)
:: +mo-doff: kill all outgoing subscriptions
::
++ mo-doff
@ -476,17 +261,24 @@
^+ mo-core
::
=/ yak (~(get by yokes.state) dap)
=/ tex
?~ yak "installing"
?- -.agent.u.yak
%& "reloading"
%| "reviving"
=/ tex=(unit tape)
?~ yak `"installing"
?- -.agent.u.yak
%| `"reviving"
%&
?: =(code.u.yak agent)
~
`"reloading"
==
~> %slog.[0 leaf+"gall: {tex} {<dap>}"]
=+ ?~ tex ~
~> %slog.[0 leaf+"gall: {u.tex} {<dap>}"] ~
::
?^ yak
?: &(=(q.beak.u.yak q.bek) =(code.u.yak agent) =(-.agent.u.yak &))
mo-core
::
=. 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-reinstall:ap-core agent)
=. mo-core ap-abet:ap-core
@ -497,6 +289,7 @@
%* . *yoke
control-duct hen
beak bek
code agent
agent &+agent
run-nonce (scot %uw (end 5 (shas %yoke-nonce eny)))
==
@ -516,60 +309,6 @@
=. mo-core (mo-clear-queue dap)
=/ =suss [dap %boot now]
(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
@ -676,9 +415,9 @@
^+ mo-core
::
?+ -.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)
%cor (mo-handle-sys-cor wire sign-arvo)
%lag (mo-handle-sys-lag wire sign-arvo)
%req (mo-handle-sys-req wire sign-arvo)
%way (mo-handle-sys-way wire sign-arvo)
@ -693,60 +432,6 @@
?. ?=(%breach -.public-keys-result.sign-arvo)
mo-core
(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
@ -900,14 +585,6 @@
?. =(run-nonce.u.yoke i.t.wire)
%- (slog leaf+"gall: got old {<+<.sign-arvo>} for {<dap>}" ~)
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)
?: ?=(%| -.agent.u.yoke)
@ -1004,15 +681,36 @@
~> %slog.0^leaf/"gall: nuking {<dap>}"
=. mo-core ap-abet:ap-nuke:(ap-abed:ap dap `our)
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
~/ %mo-peek
|= [dap=term =routes care=term =path]
|= [veb=? dap=term =routes care=term =path]
^- (unit (unit cage))
::
=/ app (ap-abed:ap dap routes)
(ap-peek:app care path)
(ap-peek:app veb care path)
::
++ mo-apply
|= [dap=term =routes =deal]
@ -1089,12 +787,6 @@
::
?. |(!is-running is-blocked)
(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)
=/ waiting (~(get by blocked.state) agent)
@ -1186,19 +878,6 @@
|= [dap=term =routes]
^+ ap-core
(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
@ -1240,7 +919,7 @@
%+ turn ~(tap by bitt.yoke)
|= [=duct =ship =path]
path
=/ will=(list card:agent:gall)
=/ will=(list card:agent)
%+ welp
?: =(~ inbound-paths)
~
@ -1443,7 +1122,7 @@
::
++ ap-peek
~/ %ap-peek
|= [care=term tyl=path]
|= [veb=? care=term tyl=path]
^- (unit (unit cage))
:: take trailing mark off path for %x scrys
::
@ -1456,6 +1135,7 @@
=/ peek-result=(each (unit (unit cage)) tang)
(ap-mule-peek |.((on-peek:ap-agent-core [care tyl])))
?: ?=(%| -.peek-result)
?. veb [~ ~]
((slog leaf+"peek bad result" p.peek-result) [~ ~])
:: for non-%x scries, or failed %x scries, or %x results that already
:: have the requested mark, produce the result as-is
@ -2053,6 +1733,7 @@
%sear mo-abet:(mo-filter-queue:mo-core ship.task)
%jolt mo-abet:(mo-jolt:mo-core dude.task our desk.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)
%doff mo-abet:(mo-doff: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 !!
++ 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
@ -2085,8 +1900,16 @@
(sort ~(tap by queued) aor)
::
=/ running
=/ active (~(run by yokes.state) |=(yoke [%.y +<]))
(sort ~(tap by active) aor)
%+ turn (sort ~(tap by yokes.state) 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)
:~ [%foreign %.y contacts.state]
@ -2160,7 +1983,7 @@
?. ?=(^ path)
~
=/ =routes [~ ship]
(mo-peek:mo dap routes care path)
(mo-peek:mo & dap routes care path)
:: +stay: save without cache; suspend non-%base agents
::
:: TODO: superfluous? see +molt
@ -2172,12 +1995,12 @@
|= =yoke
^- egg
%= yoke
code ~
agent
:- %|
?: ?=(%| -.agent.yoke)
[%| p.agent.yoke]
?: =(%base q.beak.yoke)
[%& on-save:p.agent.yoke]
[%| on-save:p.agent.yoke]
p.agent.yoke
on-save:p.agent.yoke
==
:: +take: response
::

View File

@ -102,15 +102,15 @@
=/ =beam (need (de-beam t.wire))
?>(?=([@ ~] s.beam) beam(s i.s.beam))
::
++ start-spider
|= =vase
^- note
[%g %deal [our our] %spider %poke %spider-start vase]
++ poke-spider
|= [hen=duct =cage]
^- move
[hen %pass //g %g %deal [our our] %spider %poke cage]
::
++ watch-spider
|= =path
^- note
[%g %deal [our our] %spider %watch path]
|= [hen=duct =path]
^- move
[hen %pass //g %g %deal [our our] %spider %watch path]
--
=| khan-state
=* state -
@ -134,22 +134,8 @@
%born
[~ khan-gate(hey hen, tic 0)]
::
%fard
=/ tid=@ta
%^ 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]))
::
%fard (bard hen 'khan-fyrd--' bear.p.task %| [name args]:p.task)
%lard (bard hen 'khan-lard--' bear.task %& shed.task)
%fyrd
=* fyd p.task
=/ =beak (get-beak bear.fyd now)
@ -160,6 +146,23 @@
=- [[hen %pass wire -]~ khan-gate]
[%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
@ -195,7 +198,7 @@
?+ p.cag ~&(bad-fact+p.cag !!)
%thread-fail
=/ =tang !<(tang q.cag)
%- (slog 'khan-fact' tang)
:: %- (slog 'khan-fact' tang)
[hen %give %arow %| p.cag tang]~
::
%thread-done

View File

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

View File

@ -33,10 +33,6 @@
naive,
naive-tx=naive-transactions,
*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
=, jael
@ -103,7 +99,11 @@
;< =events bind:m (scry events /gx/azimuth/logs/noun)
=/ [naive-contract=address chain-id=@]
[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
%- flog-text %+ weld "naive-csv: processing {<net>} ethereum logs "

View File

@ -44,10 +44,6 @@
%+ turn ~(tap by paths-to-tests)
|= [=path test-arms=(list test-arm)]
^- (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
::
%+ turn test-arms
@ -108,7 +104,16 @@
|= arg=vase
=/ m (strand ,vase)
^- form:m
;< =bowl:strand bind:m get-bowl:strandio
=/ 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))
=/ bez=(list beam)
(turn paz |=(p=path ~|([%test-not-beam p] (need (de-beam p)))))

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -22,32 +22,6 @@
(gall-call gall-gate time *roof call-args expected-moves)
::
-.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

View File

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

View File

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

View File

@ -1,188 +1 @@
|%
+$ 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 ~]
==
==
--
--
--
::
rand

View File

@ -50,9 +50,11 @@
%& ~
%| ['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)
@ -61,7 +63,7 @@
:: +run-chain: run a sequence of tests, stopping at first failure
::
++ run-chain
|= seq=test-chain
|= seq=a-test-chain
^- tang
=/ res $:seq
?- -.res

View File

@ -1,18 +1,28 @@
=/ weft ,[lal=@tas num=@ud] :: TODO remove after merge
|_ kel=weft
|_ kal=waft:clay
++ grow
|%
++ mime `^mime`[/text/x-kelvin (as-octs:mimes:html hoon)]
++ noun kel
++ hoon (crip "{<[lal num]:kel>}\0a")
++ noun kal
++ 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)
--
++ grab
|%
++ noun weft
++ noun waft:clay
++ mime
|= [=mite len=@ud tex=@]
!<(weft (slap !>(~) (ream tex)))
(cord-to-waft:clay tex)
--
++ grad %noun
--

View File

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

View File

@ -1,147 +1,125 @@
=, clay
=* dude dude:gall
|%
:: $snap: kiln snapshot
::
+$ snap (map desk arak)
:: $diff: subscription update
::
+$ 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]
+$ pike
$: sync=(unit [=ship =desk])
hash=@uv
=zest
wic=(set weft)
==
:: $arak: foreign vat tracker
::
:: .rail: upstream tracking state, if any
:: .rein: configuration for agents
+$ pikes (map desk pike)
::
+$ 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 [=aeon =weft]
:: $rein: diff from desk manifest
::
:: .liv: suspended? if suspended, no agents should run
:: .add: agents not in manifest that should be running
:: .sub: agents in manifest that should not be running
+$ sync-state [nun=@ta kid=(unit desk) let=@ud]
+$ sink (unit [her=@p sud=desk kid=(unit desk) let=@ud])
:: +report-prep: get data required for reports
::
+$ rein
$: liv=_&
add=(set dude)
sub=(set dude)
++ report-prep
|= [our=@p now=@da]
=/ ego (scot %p our)
=/ 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
|= [our=@p now=@da]
^- tang
=+ .^ raz=(list vat)
%gx /(scot %p our)/hood/(scot %da now)/kiln/vats/noun
==
:- (report-kids our now)
(turn raz |=(v=vat (report-vat our now v)))
=/ desks .^((set desk) %cd /(scot %p our)/base/(scot %da now))
=/ prep (report-prep our now)
%+ turn ~(tap in desks)
|=(syd=desk (report-vat prep our now syd))
:: +report-vat: report on a single desk installation
::
++ 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
=/ ego (scot %p our)
=/ wen (scot %da now)
=+ .^(=cass %cw /[ego]/[syd]/[wen])
?: =(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
/(scot %p our)/[desk]/(scot %da now)/sys/kelvin
/[ego]/[syd]/[wen]/sys/kelvin
?. .^(? %cu kel-path)
leaf+"bad desk: {<desk>}"
=+ .^(=weft %cx kel-path)
:+ %rose ["" "{<desk>}" "::"]
leaf+"bad desk: {<syd>}"
=+ .^(=waft %cx kel-path)
:+ %rose ["" "{<syd>}" "::"]
^- tang
=/ meb (mergebase-hashes our desk now arak)
=/ poz
?~ rail.arak "local"
?:(paused.u.rail.arak "paused" "tracking")
=/ sat ?:(liv.rein.arak "running" "suspended")
=/ pen
?~ rail.arak "~"
<(turn next.u.rail.arak |=([@ lal=@tas num=@] [lal num]))>
:~ leaf/"/sys/kelvin: {<[lal num]:weft>}"
=/ hash .^(@uv %cz /[ego]/[syd]/[wen])
=/ =sink
?~ s=(~(get by sor) syd)
~
?~ z=(~(get by zyn) syd u.s)
~
`[-.u.s +.u.s +.u.z]
=/ meb=(list @uv)
?~ 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/"%cz hash: {<hash>}"
::
leaf/"app status: {sat}"
leaf/"force on: {?:(=(~ add.rein.arak) "~" <add.rein.arak>)}"
leaf/"force off: {?:(=(~ sub.rein.arak) "~" <sub.rein.arak>)}"
leaf/"force on: {?:(=(~ on) "~" <on>)}"
leaf/"force off: {?:(=(~ of) "~" <of>)}"
::
leaf/"publishing ship: {?~(rail.arak <~> <publisher.u.rail.arak>)}"
leaf/"updates: {poz}"
leaf/"source ship: {?~(rail.arak <~> <ship.u.rail.arak>)}"
leaf/"source desk: {?~(rail.arak <~> <desk.u.rail.arak>)}"
leaf/"source aeon: {?~(rail.arak <~> <aeon.u.rail.arak>)}"
leaf/"pending updates: {pen}"
leaf/"publishing ship: {?~(sink <~> <(get-publisher our syd now)>)}"
leaf/"updates: {?~(sink "local" "remote")}"
leaf/"source ship: {?~(sink <~> <her.u.sink>)}"
leaf/"source desk: {?~(sink <~> <sud.u.sink>)}"
leaf/"source aeon: {?~(sink <~> <let.u.sink>)}"
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
|= [our=ship now=@da]
^- tank
=/ dek %kids
=/ syd %kids
=/ ego (scot %p our)
=/ wen (scot %da now)
?. (~(has in .^((set desk) %cd /[ego]//[wen])) dek)
?. (~(has in .^((set desk) %cd /[ego]//[wen])) syd)
leaf/"no %kids desk"
=+ .^(hash=@uv %cz /[ego]/[dek]/[wen])
=+ .^(hash=@uv %cz /[ego]/[syd]/[wen])
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
@ -169,21 +147,6 @@
?. .^(? cu/pax)
*(list dude)
.^((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
|= [our=ship here=desk now=@da her=ship there=desk when=aeon]
@ -210,38 +173,18 @@
^- (list [=dude live=?])
%~ tap in
.^((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
|= [our=@p =desk now=@da =arak]
?~ rail.arak
~
=/ her (scot %p ship.u.rail.arak)
|= [our=@p syd=desk now=@da her=ship sud=desk]
=/ her (scot %p her)
=/ ego (scot %p our)
=/ wen (scot %da now)
%+ turn .^((list tako) %cs ~[ego desk wen %base her desk.u.rail.arak])
|=(=tako .^(@uv %cs ~[ego desk wen %hash (scot %uv tako)]))
%+ turn .^((list tako) %cs ~[ego syd wen %base her sud])
|=(=tako .^(@uv %cs ~[ego syd wen %hash (scot %uv tako)]))
::
++ enjs
=, enjs:format
|%
++ vats
|= v=(list ^vat)
^- json
%- pairs
%+ turn v
|= va=^vat
[desk.va (vat va)]
::
++ tim
|= t=@
^- json
@ -254,15 +197,6 @@
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
|= w=^weft
%- pairs
@ -276,30 +210,5 @@
:~ aeon+(numb aeon.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
=, strand=strand:libstrand
|%
+$ thread $-(vase _*form:(strand ,vase))
+$ thread $-(vase shed:khan)
+$ input [=tid =cage]
+$ tid tid:strand
+$ bowl bowl:strand
@ -18,4 +18,10 @@
file=term
=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
+$ app-state
$: %2
$: %3
:: local
charges=(map desk charge)
==
@ -42,7 +42,7 @@
++ on-init
^- (quip card _this)
:_ this
:~ (~(watch-our pass /kiln) %hood /kiln/vats)
:~ ~(tire pass /tire)
(~(connect pass /eyre) [~ /] %docket)
(~(wait pass /init) (add 1 now.bowl))
(~(connect pass /eyre) [~ /apps] %docket)
@ -54,20 +54,21 @@
|^
=+ !<(old=app-states vase)
=? old ?=(?(~ ^) -.old) [%1 old]
=^ cards old
=^ cards-1 old
?. ?=(%1 -.old) `old
=/ rein=cage kiln-rein+!>([%base %.y ~ ~])
=/ nuke=cage kiln-uninstall+!>(%hodl)
:_ old(- %2)
:~ [%pass /rein %agent [our.bowl %hood] %poke rein]
[%pass /nuke %agent [our.bowl %hood] %poke nuke]
==
?> ?=(%2 -.old)
`old(- %2)
=^ cards-2 old
?. ?=(%2 -.old) `old
:_ old(- %3) :_ ~
~(tire pass /tire)
?> ?=(%3 -.old)
=/ cards-tire [~(tire pass /tire) ~]
=. -.state old
:: inflate-cache needs to be called after the state is set
::
=. +.state inflate-cache
[cards this]
[:(weld cards-1 cards-2 cards-tire) this]
::
++ inflate-cache
^- cache
@ -81,9 +82,11 @@
$^ state-0-ket
$% state-0-sig
state-1
state-2
app-state
==
::
+$ state-2 [%2 (map desk charge)]
+$ state-1 [%1 (map desk charge)]
+$ state-0-sig
$: ~
@ -94,6 +97,7 @@
==
--
::
++ on-save !>(-.state)
++ on-poke
|= [=mark =vase]
@ -189,13 +193,21 @@
==
::
[%x %charges ~]
=/ tyr
.^(rock:tire:clay %cx /(scot %p our.bowl)//(scot %da now.bowl)/tire)
:- ~ :- ~
%- charge-update:cg
:- %initial
%- ~(gas by *(map desk charge))
%+ turn ~(tap by charges)
%+ murn ~(tap by charges)
|= [=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 ~]
?~ charge=(~(get by charges) i.t.t.path)
@ -212,114 +224,11 @@
~ `state
[%rein ~] ~&(%reined `state)
[%nuke ~] ~&(%nuked `state)
[%kiln ~] take-kiln
[%kiln ~] `state
[%charge @ *] (take-charge i.t.wire t.t.wire)
==
[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
|= [=desk =^wire]
^- (quip card _state)
@ -398,6 +307,7 @@
::
++ on-arvo
|= [=wire sign=sign-arvo]
|^
=^ cards state
?+ wire (on-arvo:def wire sign)
[%init ~]
@ -410,8 +320,117 @@
?: accepted.sign `state
~& [dap.bowl %failed-to-bind path.binding.sign]
`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]
::
++ 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-leave on-leave:def
@ -728,4 +747,3 @@
++ docket .^(^docket %cx (scry:io desk docket-loc))
--
--

View File

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

View File

@ -1,7 +1,7 @@
:~ title+'System'
info+'An app launcher for Urbit.'
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
base+'grid'
version+[1 1 6]

View File

@ -28,6 +28,7 @@
%tas s+(scot %tas p.c)
%ud (numb p.c)
==
::
++ foreign-desk
|= [s=^ship =desk]
^- 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",
"@tlon/sigil-js": "^1.4.4",
"@types/lodash": "^4.14.172",
"@urbit/api": "^2.1.1",
"@urbit/api": "^2.2.0",
"@urbit/http-api": "^2.1.0",
"big-integer": "^1.6.48",
"classnames": "^2.3.1",

View File

@ -86,9 +86,8 @@ const AppRoutes = () => {
fetchCharges();
fetchAllies();
const { fetchVats, fetchLag } = useKilnState.getState();
fetchVats();
fetchLag();
const { initializeKiln } = useKilnState.getState();
initializeKiln();
useContactState.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 React, { FC, useCallback, useState } from 'react';
import cn from 'classnames';
@ -6,7 +6,7 @@ import { Button, PillButton } from './Button';
import { Dialog, DialogClose, DialogContent, DialogTrigger } from './Dialog';
import { DocketHeader } from './DocketHeader';
import { Spinner } from './Spinner';
import { VatMeta } from './VatMeta';
import { PikeMeta } from './PikeMeta';
import useDocketState, { ChargeWithDesk, useTreaty } from '../state/docket';
import { getAppHref, getAppName } from '../state/util';
import { addRecentApp } from '../nav/search/Home';
@ -17,7 +17,7 @@ type InstallStatus = 'uninstalled' | 'installing' | 'installed';
type App = ChargeWithDesk | Treaty;
interface AppInfoProps {
docket: App;
vat?: Vat;
pike?: Pike;
className?: string;
}
@ -34,10 +34,9 @@ function getInstallStatus(docket: App): InstallStatus {
return 'uninstalled';
}
function getRemoteDesk(docket: App, vat?: Vat) {
if (vat && vat.arak.rail) {
const { ship, desk } = vat.arak.rail;
return [ship, desk];
function getRemoteDesk(docket: App, pike?: Pike) {
if (pike && pike.sync) {
return [pike.sync.ship, pike.sync.desk];
}
if ('chad' in docket) {
return ['', docket.desk];
@ -46,10 +45,10 @@ function getRemoteDesk(docket: App, vat?: Vat) {
return [ship, desk];
}
export const AppInfo: FC<AppInfoProps> = ({ docket, vat, className }) => {
export const AppInfo: FC<AppInfoProps> = ({ docket, pike, className }) => {
const installStatus = getInstallStatus(docket);
const [ship, desk] = getRemoteDesk(docket, vat);
const publisher = vat?.arak?.rail?.publisher ?? ship;
const [ship, desk] = getRemoteDesk(docket, pike);
const publisher = pike?.sync?.ship ?? ship;
const [copied, setCopied] = useState(false);
const treaty = useTreaty(ship, desk);
@ -136,10 +135,10 @@ export const AppInfo: FC<AppInfoProps> = ({ docket, vat, className }) => {
</div>
</DocketHeader>
<div className="space-y-6">
{vat ? (
{pike ? (
<>
<hr className="-mx-5 sm:-mx-8 border-gray-50" />
<VatMeta vat={vat} />
<PikeMeta pike={pike} />
</>
) : 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 = {
name: string;
truncate?: boolean;
} & HTMLAttributes<HTMLSpanElement>;
export const ShipName = ({ name, ...props }: ShipNameProps) => {
export const ShipName = ({ name, truncate = true, ...props }: ShipNameProps) => {
const separator = /([_^-])/;
const citedName = cite(name);
const citedName = truncate ? cite(name) : name;
if (!citedName) {
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 React, { HTMLAttributes, useCallback, useState } from 'react';
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 { useVat } from '../state/kiln';
import { usePike } from '../state/kiln';
import { disableDefault, handleDropdownLink } from '../state/util';
import { useMedia } from '../logic/useMedia';
import { Cross } from '../components/icons/Cross';
@ -17,15 +17,15 @@ type SystemMenuProps = HTMLAttributes<HTMLButtonElement> & {
shouldDim: boolean;
};
function getHash(vat: Vat): string {
const parts = vat.hash.split('.');
function getHash(pike: Pike): string {
const parts = pike.hash.split('.');
return parts[parts.length - 1];
}
export const SystemMenu = ({ className, open, subMenuOpen, shouldDim }: SystemMenuProps) => {
const { push } = useHistory();
const [copied, setCopied] = useState(false);
const garden = useVat(window.desk);
const garden = usePike(window.desk);
const hash = garden ? getHash(garden) : null;
const isMobile = useMedia('(max-width: 639px)');
const select = useLeapStore((s) => s.select);

View File

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

View File

@ -13,7 +13,7 @@ function renderNotification(notification: Notification, key: string, lid: HarkLi
return <RuntimeLagNotification key={key} />;
}
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') {
return <OnboardingNotification key={key} lid={lid} />;

View File

@ -1,15 +1,15 @@
import React from 'react';
import cn from 'classnames';
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 { useBrowserId, useCurrentTheme } from '../../state/local';
import { getDarkColor } from '../../state/util';
import useKilnState from '../../state/kiln';
import { usePikes } from '../../state/kiln';
import { useHarkStore } from '../../state/hark';
import { useProtocolHandling } from '../../state/settings';
const getCards = (vats: Vats, protocol: boolean): OnboardingCardProps[] => {
const getCards = (pikes: Pikes, protocol: boolean): OnboardingCardProps[] => {
const cards = [
{
title: 'Terminal',
@ -38,20 +38,6 @@ const getCards = (vats: Vats, protocol: boolean): OnboardingCardProps[] => {
ship: '~mister-dister-dozzod-dozzod',
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) {
cards.push({
@ -66,8 +52,8 @@ const getCards = (vats: Vats, protocol: boolean): OnboardingCardProps[] => {
}
return cards.filter((card) => {
return !Object.values(vats).find(
(vat) => getVatPublisher(vat) == card.ship && vat?.arak?.rail?.desk === card.desk
return !Object.values(pikes).find(
(pike) => getPikePublisher(pike) === card.ship && pike.sync?.desk === card.desk
);
});
};
@ -107,10 +93,10 @@ interface OnboardingNotificationProps {
export const OnboardingNotification = ({ unread = false, lid }: OnboardingNotificationProps) => {
const theme = useCurrentTheme();
const vats = useKilnState((s) => s.vats);
const pikes = usePikes();
const browserId = useBrowserId();
const protocolHandling = useProtocolHandling(browserId);
const cards = getCards(vats, protocolHandling);
const cards = getCards(pikes, protocolHandling);
if (cards.length === 0 && !('time' in lid)) {
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 { kilnBump } from '@urbit/api';
import { HarkBin, HarkLid, kilnBump, Pike } from '@urbit/api';
import { useHistory } from 'react-router-dom';
import { AppList } from '../../components/AppList';
import { Button } from '../../components/Button';
import { Dialog, DialogClose, DialogContent, DialogTrigger } from '../../components/Dialog';
import { Elbow } from '../../components/icons/Elbow';
import api from '../../state/api';
import { useCharges } from '../../state/docket';
import useKilnState, { useVat } from '../../state/kiln';
import useKilnState, { usePike } from '../../state/kiln';
import { NotificationButton } from './NotificationButton';
import { disableDefault } from '../../state/util';
import { Vat } from '@urbit/api';
import {useHistory} from 'react-router-dom';
import { useHarkStore } from '../../state/hark';
export const RuntimeLagNotification = () => (
<section
@ -38,28 +38,33 @@ export const RuntimeLagNotification = () => (
</section>
);
function vatIsBlocked(newKelvin: number, vat: Vat) {
return !(vat.arak?.rail?.next || []).find(({ aeon, weft }) => weft.kelvin === newKelvin);
function pikeIsBlocked(newKelvin: number, pike: Pike) {
return pike.zest === 'live' && !pike.wefts?.find(({ kelvin }) => kelvin === newKelvin);
}
export const BaseBlockedNotification = () => {
const base = useVat('base');
export const BaseBlockedNotification = ({ bin, lid }: { bin: HarkBin, lid: HarkLid }) => {
const basePike = usePike('base');
const { push } = useHistory();
// 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 [blocked, unblocked] = useKilnState((s) => {
const [b, u] = partition(Object.entries(s.vats), ([desk, vat]) => vatIsBlocked(newKelvin, vat));
const [blocked] = useKilnState((s) => {
const [b, u] = partition(Object.entries(s.pikes), ([, pike]) => pikeIsBlocked(newKelvin, pike));
return [b.map(([d]) => d), u.map(([d]) => d)] as const;
});
const { toggleInstall } = useKilnState();
const blockedCharges = Object.values(pick(charges, blocked));
const count = blockedCharges.length;
const handlePauseOTAs = useCallback(() => {}, []);
const handlePauseOTAs = useCallback(async () => {
await useHarkStore.getState().archiveNote(bin, lid);
}, []);
const handleArchiveApps = useCallback(async () => {
api.poke(kilnBump(true));
await api.poke(kilnBump());
await useHarkStore.getState().archiveNote(bin, lid);
push('/leap/upgrading');
}, []);
@ -81,12 +86,12 @@ export const BaseBlockedNotification = () => {
<AppList apps={blockedCharges} labelledBy="blocked-apps" size="xs" className="font-medium" />
<div className="space-y-6">
<p>
In order to proceed with the System Update, youll need to temporarily archive these apps,
which will render them unusable, but with data intact.
In order to proceed with the System Update, youll need to temporarily suspend these apps.
This will render them unusable, but with data intact.
</p>
<p>
Archived apps will automatically un-archive and resume operation when their developer
provides an app update.
Suspended apps will automatically resume operation when their developer
provides an update.
</p>
</div>
<div className="space-x-2">
@ -97,30 +102,24 @@ export const BaseBlockedNotification = () => {
className="space-y-6 text-base tracking-tight"
containerClass="w-full max-w-md"
>
<h2 className="h4">Skip System Update</h2>
<h2 className="h4">Delay System Update</h2>
<p>
Skipping the application fo an incoming System Update will grant you the ability to
continue using incompatible apps at the cost of an urbit that&apos;s not up to date.
</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>
Are you sure you want to remain on an old version of Urbit
until these apps have been updated?
</p>
<div className="flex space-x-6">
<DialogClose as={Button} variant="secondary">
Cancel
</DialogClose>
<DialogClose as={Button} variant="caution" onClick={handlePauseOTAs}>
Pause OTAs
Remain on Old Version
</DialogClose>
</div>
</DialogContent>
</Dialog>
<Dialog>
<DialogTrigger as={NotificationButton}>
Archive ({count}) apps and Apply System Update
Suspend ({count}) Apps and Apply Update
</DialogTrigger>
<DialogContent
showClose={false}
@ -128,10 +127,9 @@ export const BaseBlockedNotification = () => {
className="space-y-6 text-base tracking-tight"
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>
The following apps will be archived until their developer provides a compatible update
to your system.
The following apps will be suspended until their developer provides an update.
</p>
<AppList
apps={blockedCharges}
@ -144,7 +142,7 @@ export const BaseBlockedNotification = () => {
Cancel
</DialogClose>
<DialogClose as={Button} variant="caution" onClick={handleArchiveApps}>
Archive Apps
Suspend Apps and Upgrade
</DialogClose>
</div>
</DialogContent>

View File

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

View File

@ -1,88 +1,22 @@
import _ from 'lodash';
import React, { ChangeEvent, FormEvent, useCallback, useEffect, useState } from 'react';
import { Button } from '../../components/Button';
import { Setting } from '../../components/Setting';
import { ShipName } from '../../components/ShipName';
import { Spinner } from '../../components/Spinner';
import { useAsyncCall } from '../../logic/useAsyncCall';
import useKilnState, { useVat } from '../../state/kiln';
import React from 'react';
import SourceSetter from '../../components/SourceSetter';
import useKilnState, { usePike } from '../../state/kiln';
export const SystemUpdatePrefs = () => {
const { changeOTASource, toggleOTAs } = useKilnState((s) =>
_.pick(s, ['toggleOTAs', 'changeOTASource'])
);
const base = useVat('base');
const otasEnabled = base && !(base.arak?.rail?.paused ?? true);
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]
);
const desk = 'base';
const appName = 'your Urbit';
const pike = usePike(desk);
const srcShip = pike?.sync?.ship;
const { toggleInstall } = useKilnState();
return (
<>
<h2 className="h3 mb-7">System Updates</h2>
<div className="space-y-3">
<Setting on={!!otasEnabled} toggle={toggleBase} name="Enable Automatic Urbit OTAs">
<p>Automatically download and apply system updates to keep your Urbit up to date.</p>
{otaSource && (
<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>
</>
<SourceSetter
appName={appName}
toggleSrc={toggleInstall}
srcDesk={desk}
srcShip={srcShip}
title="System Updates"
/>
);
};

View File

@ -3,7 +3,7 @@ import { useParams } from 'react-router-dom';
import { AppInfo } from '../../components/AppInfo';
import { Spinner } from '../../components/Spinner';
import useDocketState, { useCharge, useTreaty } from '../../state/docket';
import { useVat } from '../../state/kiln';
import { usePike } from '../../state/kiln';
import { getAppName } from '../../state/util';
import { useLeapStore } from '../Nav';
@ -11,7 +11,7 @@ export const TreatyInfo = () => {
const select = useLeapStore((state) => state.select);
const { host, desk } = useParams<{ host: string; desk: string }>();
const treaty = useTreaty(host, desk);
const vat = useVat(desk);
const pike = usePike(desk);
const charge = useCharge(desk);
const name = getAppName(treaty);
@ -34,5 +34,5 @@ export const TreatyInfo = () => {
</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();
}
const start = performance.now();
await useKilnState.getState().fetchVats();
await useKilnState.getState().fetchVats();
await useKilnState.getState().fetchPikes();
await useKilnState.getState().fetchPikes();
if (performance.now() - start > 5000) {
attempt(count + 1);
} else {

View File

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

View File

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

View File

@ -1,6 +1,4 @@
import {
Vat,
Vats,
Allies,
Charges,
DocketHrefGlob,
@ -13,7 +11,8 @@ import {
Contact,
Contacts,
Timebox,
harkBinToId
harkBinToId,
Pikes
} from '@urbit/api';
import _ from 'lodash';
import systemUrl from '../assets/system.png';
@ -341,37 +340,35 @@ export const mockContacts: Contacts = {
}
};
export const mockVat = (desk: string, blockers?: boolean): Vat => ({
cass: {
da: '~2021.9.13..05.41.04..ae65',
ud: 1
export const mockPikes: Pikes = {
kids: {
sync: null,
zest: 'dead',
wefts: [],
hash: '0v19.q7u27.omps3.fbhf4.53rai.co157.pben7.pu94n.63v4p.3kcb7.iafj0'
},
desk,
arak: {
rein: {
sub: [],
add: []
garden: {
sync: {
desk: 'garden',
ship: '~mister-dister-dozzod-dozzod'
},
rail:
desk === 'uniswap'
? null
: {
aeon: 3,
desk,
publisher: '~zod',
next: blockers ? [{ aeon: 3, weft: { name: 'zuse', kelvin: 419 } }] : [],
ship: '~zod',
paused: desk === 'groups'
}
zest: 'live',
wefts: [],
hash: '0v18.hbbs6.onu15.skjkv.qrfgl.vf4oo.0igo5.2q0d3.6r3r8.2dkmo.oa04m'
},
hash: '0vh.lhfn6.julg1.fs52d.g2lqj.q5kp0.2o7j3.2bljl.jdm34.hd46v.9uv5v'
});
const badVats = ['inbox', 'system', 'terminal', 'base'];
export const mockVats = _.reduce(
mockCharges,
(vats, charge, desk) => {
return { ...vats, [desk]: mockVat(desk, !badVats.includes(desk)) };
landscape: {
sync: {
desk: 'landscape',
ship: '~lander-dister-dozzod-dozzod'
},
zest: 'live',
wefts: [],
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 { ChargeWithDesk } from '../state/docket';
import { useTileColor } from './useTileColor';
import { useVat } from '../state/kiln';
import { usePike } from '../state/kiln';
import { Bullet } from '../components/icons/Bullet';
import { dragTypes } from './TileGrid';
@ -21,11 +21,12 @@ type TileProps = {
export const Tile: FunctionComponent<TileProps> = ({ charge, desk, disabled = false }) => {
const addRecentApp = useRecentsStore((state) => state.addRecentApp);
const { title, image, color, chad, href } = charge;
const vat = useVat(desk);
const pike = usePike(desk);
const { lightText, tileColor, menuColor, suspendColor, suspendMenuColor } = useTileColor(color);
const loading = !disabled && 'install' in chad;
const suspended = disabled || 'suspend' in chad;
const hung = 'hung' in chad;
// TODO should held zest be considered inactive? suspended? also, null sync?
const active = !disabled && chadIsRunning(chad);
const link = getAppHref(href);
const backgroundColor = suspended ? suspendColor : active ? tileColor || 'purple' : suspendColor;
@ -56,6 +57,9 @@ export const Tile: FunctionComponent<TileProps> = ({ charge, desk, disabled = fa
>
<div>
<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 && (
<>
{loading && <Spinner className="h-6 w-6 mr-2" />}
@ -65,9 +69,6 @@ export const Tile: FunctionComponent<TileProps> = ({ charge, desk, disabled = fa
</>
)}
</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
desk={desk}
chad={chad}

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -123,7 +123,15 @@
:: ensure difference
=/ old=(unit contact:store) (~(get by rolodex) ship)
?. ?| ?=(~ 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]
~| "cannot add a data url to cover!"

View File

@ -54,12 +54,7 @@
++ on-pull-nack
|= [=resource =tang]
^- (quip card _this)
%- (slog leaf+"nacked {<resource>}" tang)
:_ 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]]
`this
::
++ on-pull-kick
|= =resource

View File

@ -11,16 +11,17 @@
[%3 network:one:store]
[%4 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-log orm-log:store
++ mar %graph-update-3
--
::
=| state-6
=| state-7
=* state -
::
%- agent:dbug
@ -96,7 +97,43 @@
(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
@ -129,9 +166,21 @@
?+ mark (on-poke:def mark vase)
%graph-update-3 (graph-update !<(update:store vase))
%import (poke-import q.vase)
%migrated (poke-migrated !<(resource:store vase))
==
[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
|= =update:store
^- (quip card _state)
@ -644,6 +693,16 @@
|= =path
^- (unit (unit cage))
?+ 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 %keys ~]

View File

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

View File

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

View File

@ -321,15 +321,7 @@
++ on-pull-nack
|= [=resource =tang]
^- (quip card _this)
=/ =associations:metadata
(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]
`this
::
++ on-pull-kick
|= =resource

View File

@ -29,7 +29,6 @@
%metadata-hook
%metadata-pull-hook
%metadata-push-hook
%notify
%observe-hook
%sane
%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
|%
++ 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
::
@ -758,9 +833,9 @@
--
++ import
|= [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
%+ turn ~(tap by graphs.sty)
|= [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