mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-29 04:04:02 +03:00
Merge remote-tracking branch 'origin/master' into lf/migration-prep
This commit is contained in:
commit
d9a895c214
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2f46209c31bc7be965b6ba32db92fb0746be15d9613b1c3c8d09ce7fa0e5e157
|
||||
size 8280141
|
||||
oid sha256:3306a5b916caa838c67cb079410c6e5bb158054520129ffb9f9bdb144ab1b691
|
||||
size 7418493
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d737f88463f683173b5f6cbf41fc38705d4d3d67263c675d7e99841cd8485d81
|
||||
size 6026086
|
||||
oid sha256:40bc203b8a2d2ebad81723da6fc946ee32d2f8a204884f50f9710177ae257d08
|
||||
size 5712264
|
||||
|
@ -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)
|
||||
::
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
@ -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 ~]
|
||||
|
50
pkg/arvo/gen/hood/new-desk.hoon
Normal file
50
pkg/arvo/gen/hood/new-desk.hoon
Normal 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
|
||||
==
|
||||
--
|
@ -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)
|
||||
|
@ -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 &)]
|
||||
|
@ -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)
|
||||
|
@ -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
|
@ -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=?]
|
||||
|
@ -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]
|
||||
::
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
--
|
||||
|
@ -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
@ -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 ~
|
||||
--
|
||||
--
|
||||
|
||||
|
||||
--
|
24
pkg/arvo/mar/kiln/pikes.hoon
Normal file
24
pkg/arvo/mar/kiln/pikes.hoon
Normal 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
|
||||
--
|
||||
--
|
29
pkg/arvo/mar/kiln/sync.hoon
Normal file
29
pkg/arvo/mar/kiln/sync.hoon
Normal 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
|
||||
==
|
||||
--
|
||||
--
|
29
pkg/arvo/mar/kiln/unsync.hoon
Normal file
29
pkg/arvo/mar/kiln/unsync.hoon
Normal 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
|
||||
==
|
||||
--
|
||||
--
|
@ -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
|
||||
--
|
||||
--
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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)
|
||||
--
|
||||
--
|
@ -1,21 +0,0 @@
|
||||
/- *hood
|
||||
|_ vats=(list vat)
|
||||
++ grad %noun
|
||||
++ grow
|
||||
|%
|
||||
++ noun vats
|
||||
++ json (vats:enjs vats)
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
++ noun (list vat)
|
||||
--
|
||||
--
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1 +1 @@
|
||||
[%zuse 418]
|
||||
[%zuse 417]
|
||||
|
@ -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 &)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
@ -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]
|
||||
^+ +>
|
||||
|
@ -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
|
||||
::
|
||||
|
@ -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
|
||||
::
|
||||
|
@ -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
|
||||
|
@ -4,7 +4,7 @@
|
||||
=> ..lull
|
||||
~% %zuse ..part ~
|
||||
|%
|
||||
++ zuse %418
|
||||
++ zuse %417
|
||||
:: :: ::
|
||||
:::: :: :: (2) engines
|
||||
:: :: ::
|
||||
|
@ -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 "
|
||||
|
@ -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)))))
|
||||
|
@ -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
|
||||
~
|
||||
==
|
||||
==
|
||||
|
@ -1,21 +1,33 @@
|
||||
:: Test that these hints do not crash the runtime
|
||||
:: there is no need to include the hints for dynamic %bout
|
||||
:: there is no need to include a test for dynamic %bout
|
||||
:: since all hoon tests exersize dynamic %bout
|
||||
|%
|
||||
:: these test that the hilt-trace hints
|
||||
:: test that these trace hints
|
||||
:: are safe to run or ignore
|
||||
++ test-hela-hilt
|
||||
++ test-hilt-hela
|
||||
~> %hela
|
||||
~
|
||||
++ test-nara-hilt
|
||||
++ test-hint-hela
|
||||
~> %hela.[1 leaf+"test-hint-hela ~"]
|
||||
~
|
||||
++ test-hilt-nara
|
||||
~> %nara
|
||||
~
|
||||
:: these test that the hint-trace hints
|
||||
:: are safe to run or ignore
|
||||
++ test-hela-hint
|
||||
~> %hela.[1 leaf+"test-hela-trace-hint"]
|
||||
++ test-hint-nara
|
||||
~> %nara.[1 leaf+"test-hint-nara ~"]
|
||||
~
|
||||
++ test-nara-hint
|
||||
~> %nara.[1 leaf+"test-nara-trace-hint"]
|
||||
:: test that theses bytecode-report hints
|
||||
:: are safe to run or ignore
|
||||
++ test-hilt-xray
|
||||
~> %xray
|
||||
~
|
||||
++ test-hint-xray
|
||||
~> %xray.[1 leaf+"test-hint-xray ~"]
|
||||
~
|
||||
:: test that the hilt bout hint
|
||||
:: is safe to run or ignore
|
||||
++ test-hilt-bout
|
||||
~> %bout
|
||||
~
|
||||
--
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -251,17 +251,19 @@
|
||||
!> shut-packet
|
||||
!> decoded
|
||||
::
|
||||
++ 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
|
||||
::
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
::
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
--
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
==
|
||||
--
|
||||
--
|
||||
|
@ -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
|
||||
==
|
||||
--
|
||||
|
@ -1 +1 @@
|
||||
[%zuse 418]
|
||||
[%zuse 417]
|
||||
|
15234
pkg/btc-wallet/package-lock.json
generated
15234
pkg/btc-wallet/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -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,114 @@
|
||||
?: 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]
|
||||
`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]
|
||||
[[card-1 cards-2] state]
|
||||
--
|
||||
::
|
||||
++ on-fail on-fail:def
|
||||
++ on-leave on-leave:def
|
||||
@ -728,4 +744,3 @@
|
||||
++ docket .^(^docket %cx (scry:io desk docket-loc))
|
||||
--
|
||||
--
|
||||
|
||||
|
@ -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)
|
||||
:_ ~
|
||||
|
@ -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]
|
||||
|
@ -28,6 +28,7 @@
|
||||
%tas s+(scot %tas p.c)
|
||||
%ud (numb p.c)
|
||||
==
|
||||
::
|
||||
++ foreign-desk
|
||||
|= [s=^ship =desk]
|
||||
^- cord
|
||||
|
@ -1 +1 @@
|
||||
[%zuse 418]
|
||||
[%zuse 417]
|
||||
|
53
pkg/garden/ted/get-dudes.hoon
Normal file
53
pkg/garden/ted/get-dudes.hoon
Normal 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
23744
pkg/grid/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -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",
|
||||
|
@ -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);
|
||||
|
@ -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 : (
|
||||
|
25
pkg/grid/src/components/PikeMeta.tsx
Normal file
25
pkg/grid/src/components/PikeMeta.tsx
Normal 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>
|
||||
);
|
||||
}
|
@ -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;
|
||||
|
103
pkg/grid/src/components/SourceSetter.tsx
Normal file
103
pkg/grid/src/components/SourceSetter.tsx
Normal 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>
|
||||
</>
|
||||
);
|
||||
}
|
@ -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>
|
||||
);
|
||||
}
|
@ -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);
|
||||
|
@ -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>
|
||||
))}
|
||||
|
@ -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} />;
|
||||
|
@ -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(
|
||||
|
@ -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, you’ll need to temporarily archive these apps,
|
||||
which will render them unusable, but with data intact.
|
||||
In order to proceed with the System Update, you’ll 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'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>
|
||||
|
@ -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`}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
@ -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"
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
@ -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} />;
|
||||
};
|
||||
|
@ -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 {
|
||||
|
@ -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} />;
|
||||
|
@ -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;
|
||||
|
@ -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'
|
||||
}
|
||||
};
|
||||
|
@ -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}
|
||||
|
@ -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>
|
||||
);
|
||||
|
96571
pkg/interface/package-lock.json
generated
96571
pkg/interface/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -681,6 +681,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 ~]
|
||||
|
@ -29,7 +29,6 @@
|
||||
%metadata-hook
|
||||
%metadata-pull-hook
|
||||
%metadata-push-hook
|
||||
%notify
|
||||
%observe-hook
|
||||
%sane
|
||||
%weather
|
||||
|
@ -1 +1 @@
|
||||
[%zuse 418]
|
||||
[%zuse 417]
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { Poke, Scry } from '../lib';
|
||||
import { Vats, Vat } from './types';
|
||||
import { Pike } from './types';
|
||||
|
||||
export const getVats: Scry = {
|
||||
export const getPikes: Scry = {
|
||||
app: 'hood',
|
||||
path: '/kiln/vats'
|
||||
path: '/kiln/pikes'
|
||||
};
|
||||
|
||||
/**
|
||||
@ -25,6 +25,44 @@ export function kilnInstall(
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Sync with a foreign desk
|
||||
*/
|
||||
export function kilnSync(
|
||||
ship: string,
|
||||
desk: string,
|
||||
local?: string
|
||||
): Poke<any> {
|
||||
return {
|
||||
app: 'hood',
|
||||
mark: 'kiln-sync',
|
||||
json: {
|
||||
ship,
|
||||
desk,
|
||||
local: local || desk
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsync with a foreign desk
|
||||
*/
|
||||
export function kilnUnsync(
|
||||
ship: string,
|
||||
desk: string,
|
||||
local?: string
|
||||
): Poke<any> {
|
||||
return {
|
||||
app: 'hood',
|
||||
mark: 'kiln-unsync',
|
||||
json: {
|
||||
ship,
|
||||
desk,
|
||||
local: local || desk
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstall a desk
|
||||
*/
|
||||
@ -58,14 +96,11 @@ export function kilnRevive(
|
||||
};
|
||||
}
|
||||
|
||||
export function kilnBump(force = false, except = [] as string[]) {
|
||||
export function kilnBump(): Poke<any> {
|
||||
return {
|
||||
app: 'hood',
|
||||
mark: 'kiln-bump',
|
||||
json: {
|
||||
force,
|
||||
except
|
||||
}
|
||||
json: null,
|
||||
};
|
||||
}
|
||||
|
||||
@ -87,35 +122,6 @@ export function kilnResume(desk: string) {
|
||||
|
||||
export const scryLag: Scry = ({ app: 'hood', path: '/kiln/lag' });
|
||||
|
||||
export function getBlockers(vats: Vats): string[] {
|
||||
const blockers: string[] = [];
|
||||
const base = vats?.base;
|
||||
if(!base) {
|
||||
return blockers;
|
||||
}
|
||||
const blockedOn = base.arak.rail?.next?.[0]?.weft?.kelvin;
|
||||
if(!blockedOn) {
|
||||
return blockers;
|
||||
}
|
||||
|
||||
Object.entries(vats)
|
||||
.filter(([desk]) => desk !== 'base')
|
||||
.forEach(([desk, vat]) => {
|
||||
// assuming only %zuse
|
||||
const woofs = vat.arak.rail?.next || [];
|
||||
const kelvins = woofs.map(n => n.weft.kelvin);
|
||||
if(!(kelvins.includes(blockedOn))) {
|
||||
blockers.push(desk);
|
||||
}
|
||||
});
|
||||
|
||||
return blockers;
|
||||
}
|
||||
|
||||
export function getVatPublisher(vat: Vat): string | undefined {
|
||||
if (vat.arak.rail) {
|
||||
const { rail } = vat.arak;
|
||||
return (rail?.publisher || rail?.ship || undefined);
|
||||
}
|
||||
return undefined;
|
||||
export function getPikePublisher(pike: Pike) {
|
||||
return pike.sync?.ship;
|
||||
}
|
||||
|
@ -161,3 +161,48 @@ export interface Vat {
|
||||
export interface Vats {
|
||||
[desk: string]: Vat;
|
||||
}
|
||||
/**
|
||||
* TODO: crisp one-liner describing a Pike
|
||||
*/
|
||||
export interface Pike {
|
||||
/**
|
||||
* Hash of the desk, rendered as `@uv`
|
||||
*
|
||||
* @remarks
|
||||
* Equivalent to
|
||||
* ```hoon
|
||||
* .^(@uv %cz /=desk=)
|
||||
* ```
|
||||
*/
|
||||
hash: string;
|
||||
sync: {
|
||||
/**
|
||||
* Source desk for this Pike
|
||||
*/
|
||||
desk: string;
|
||||
/**
|
||||
* Source ship for this Pike
|
||||
*/
|
||||
ship: string;
|
||||
} | null;
|
||||
/**
|
||||
* {@link Weft}s associated with this Pike
|
||||
*/
|
||||
wefts: Weft[];
|
||||
/**
|
||||
* how live is this pike?
|
||||
*
|
||||
* live - app is running
|
||||
* held - app is not running, but is trying to run. this state can be entered
|
||||
* in two main ways:
|
||||
* - when installing an app but it hasn't finished downloading (or it did
|
||||
* but failed to install for some reason)
|
||||
* - when user forced a kelvin upgrade by suspending desks.
|
||||
* dead - app is not running
|
||||
*/
|
||||
zest: "live" | "dead" | "held";
|
||||
}
|
||||
|
||||
export interface Pikes {
|
||||
[desk: string]: Pike;
|
||||
}
|
||||
|
6576
pkg/npm/api/package-lock.json
generated
6576
pkg/npm/api/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@urbit/api",
|
||||
"version": "2.1.1",
|
||||
"version": "2.2.0",
|
||||
"description": "A library that provides bindings and types for Urbit's various userspace desks",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
10524
pkg/npm/http-api/package-lock.json
generated
10524
pkg/npm/http-api/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -7,8 +7,9 @@
|
||||
static void
|
||||
_setup(void)
|
||||
{
|
||||
u3m_init();
|
||||
u3m_init(1 << 24);
|
||||
u3m_pave(c3y);
|
||||
u3e_init();
|
||||
}
|
||||
|
||||
/* _ames_writ_ex(): |hi packet from fake ~zod to fake ~nec
|
||||
|
@ -4,6 +4,8 @@
|
||||
#define U3_GLOBAL
|
||||
#define C3_GLOBAL
|
||||
#include "all.h"
|
||||
#include "vere/ivory.h"
|
||||
#include "ur/ur.h"
|
||||
#include "rsignal.h"
|
||||
#include <vere/serf.h>
|
||||
#include "vere/vere.h"
|
||||
@ -164,6 +166,9 @@ _main_init(void)
|
||||
u3_Host.ops_u.puf_c = "jam";
|
||||
u3_Host.ops_u.hap_w = 50000;
|
||||
u3_Host.ops_u.kno_w = DefaultKernel;
|
||||
|
||||
u3_Host.ops_u.lut_y = u3a_bits + 1;
|
||||
u3_Host.ops_u.lom_y = u3a_bits + 1;
|
||||
}
|
||||
|
||||
/* _main_pier_run(): get pier from binary path (argv[0]), if appropriate
|
||||
@ -216,6 +221,7 @@ _main_getopt(c3_i argc, c3_c** argv)
|
||||
{ "json-trace", no_argument, NULL, 'j' },
|
||||
{ "kernel-stage", required_argument, NULL, 'K' },
|
||||
{ "key-file", required_argument, NULL, 'k' },
|
||||
{ "loom", required_argument, NULL, c3__loom },
|
||||
{ "local", no_argument, NULL, 'L' },
|
||||
{ "lite-boot", no_argument, NULL, 'l' },
|
||||
{ "replay-to", required_argument, NULL, 'n' },
|
||||
@ -238,6 +244,9 @@ _main_getopt(c3_i argc, c3_c** argv)
|
||||
{ "exit", no_argument, NULL, 'x' },
|
||||
{ "scry-into", required_argument, NULL, 'Y' },
|
||||
{ "scry-format", required_argument, NULL, 'Z' },
|
||||
//
|
||||
{ "urth-loom", required_argument, NULL, 5 },
|
||||
//
|
||||
{ NULL, 0, NULL, 0 },
|
||||
};
|
||||
|
||||
@ -246,6 +255,17 @@ _main_getopt(c3_i argc, c3_c** argv)
|
||||
lop_u, &lid_i)) )
|
||||
{
|
||||
switch ( ch_i ) {
|
||||
case 5: { // urth-loom
|
||||
c3_w lut_w;
|
||||
c3_o res_o = _main_readw(optarg, u3a_bits + 3, &lut_w);
|
||||
if ( (c3n == res_o) || (lut_w < 20) ) {
|
||||
fprintf(stderr, "error: --urth-loom must be >= 20 and <= %u\r\n", u3a_bits + 2);
|
||||
return c3n;
|
||||
}
|
||||
|
||||
u3_Host.ops_u.lut_y = lut_w;
|
||||
break;
|
||||
}
|
||||
case 'X': {
|
||||
u3_Host.ops_u.pek_c = strdup(optarg);
|
||||
break;
|
||||
@ -346,6 +366,16 @@ _main_getopt(c3_i argc, c3_c** argv)
|
||||
} else u3_Host.ops_u.pes_s = arg_w;
|
||||
break;
|
||||
}
|
||||
case c3__loom: {
|
||||
c3_w lom_w;
|
||||
c3_o res_o = _main_readw(optarg, u3a_bits + 3, &lom_w);
|
||||
if ( (c3n == res_o) || (lom_w < 20) ) {
|
||||
fprintf(stderr, "error: --loom must be >= 20 and <= %u\r\n", u3a_bits + 2);
|
||||
return c3n;
|
||||
}
|
||||
u3_Host.ops_u.lom_y = lom_w;
|
||||
break;
|
||||
}
|
||||
case c3__noco: {
|
||||
u3_Host.ops_u.con = c3n;
|
||||
break;
|
||||
@ -660,6 +690,7 @@ u3_ve_usage(c3_i argc, c3_c** argv)
|
||||
"-K, --kernel-stage STAGE Start at Hoon kernel version stage\n",
|
||||
"-k, --key-file KEYS Private key file (see also -G)\n",
|
||||
"-L, --local Local networking only\n",
|
||||
" --loom Set loom to binary exponent (31 == 2GB)\n"
|
||||
"-l, --lite-boot Most-minimal startup\n",
|
||||
"-n, --replay-to NUMBER Replay up to event\n",
|
||||
"-P, --profile Profiling\n",
|
||||
@ -997,9 +1028,9 @@ static void
|
||||
_cw_serf_commence(c3_i argc, c3_c* argv[])
|
||||
{
|
||||
#ifdef U3_OS_mingw
|
||||
if ( 8 > argc ) {
|
||||
if ( 9 > argc ) {
|
||||
#else
|
||||
if ( 7 > argc ) {
|
||||
if ( 8 > argc ) {
|
||||
#endif
|
||||
fprintf(stderr, "serf: missing args\n");
|
||||
exit(1);
|
||||
@ -1011,9 +1042,11 @@ _cw_serf_commence(c3_i argc, c3_c* argv[])
|
||||
c3_c* key_c = argv[3]; // XX use passkey
|
||||
c3_c* wag_c = argv[4];
|
||||
c3_c* hap_c = argv[5];
|
||||
c3_c* eve_c = argv[6];
|
||||
c3_c* lom_c = argv[6];
|
||||
c3_w lom_w;
|
||||
c3_c* eve_c = argv[7];
|
||||
#ifdef U3_OS_mingw
|
||||
c3_c* han_c = argv[7];
|
||||
c3_c* han_c = argv[8];
|
||||
_cw_intr_win(han_c);
|
||||
#endif
|
||||
|
||||
@ -1039,6 +1072,7 @@ _cw_serf_commence(c3_i argc, c3_c* argv[])
|
||||
{
|
||||
sscanf(wag_c, "%" SCNu32, &u3C.wag_w);
|
||||
sscanf(hap_c, "%" SCNu32, &u3_Host.ops_u.hap_w);
|
||||
sscanf(lom_c, "%" SCNu32, &lom_w);
|
||||
|
||||
if ( 1 != sscanf(eve_c, "%" PRIu64, &eve_d) ) {
|
||||
fprintf(stderr, "serf: rock: invalid number '%s'\r\n", argv[4]);
|
||||
@ -1062,7 +1096,7 @@ _cw_serf_commence(c3_i argc, c3_c* argv[])
|
||||
//
|
||||
{
|
||||
u3V.dir_c = strdup(dir_c);
|
||||
u3V.sen_d = u3V.dun_d = u3m_boot(dir_c);
|
||||
u3V.sen_d = u3V.dun_d = u3m_boot(dir_c, (size_t)1 << lom_w);
|
||||
|
||||
if ( eve_d ) {
|
||||
// XX need not be fatal, need a u3m_reboot equivalent
|
||||
@ -1152,6 +1186,117 @@ _cw_dock(c3_i argc, c3_c* argv[])
|
||||
u3_king_dock(U3_VERE_PACE);
|
||||
}
|
||||
|
||||
/* _cw_eval_get_input(): read file til EOF and return a malloc'd string
|
||||
*/
|
||||
c3_c*
|
||||
_cw_eval_get_input(FILE* fil_u, size_t siz_i)
|
||||
{
|
||||
c3_i car_i;
|
||||
size_t len_i = 0;
|
||||
c3_c* str_c = c3_realloc(NULL, siz_i);//size is start size
|
||||
|
||||
while( EOF != (car_i = fgetc(fil_u)) ){
|
||||
str_c[len_i++] = car_i;
|
||||
if( len_i == siz_i ){
|
||||
siz_i += 16;
|
||||
str_c = c3_realloc(str_c, siz_i);
|
||||
}
|
||||
}
|
||||
|
||||
str_c[len_i++]='\0';
|
||||
|
||||
return c3_realloc(str_c, len_i);
|
||||
}
|
||||
|
||||
/* _cw_eval(): initialize and run the hoon evaluator
|
||||
*/
|
||||
static void
|
||||
_cw_eval(c3_i argc, c3_c* argv[])
|
||||
{
|
||||
c3_i ch_i, lid_i;
|
||||
c3_w arg_w;
|
||||
|
||||
static struct option lop_u[] = {
|
||||
{ "loom", required_argument, NULL, c3__loom },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
while ( -1 != (ch_i=getopt_long(argc, argv, "", lop_u, &lid_i)) ) {
|
||||
switch ( ch_i ) {
|
||||
case c3__loom: {
|
||||
c3_w lom_w;
|
||||
c3_o res_o = _main_readw(optarg, u3a_bits + 3, &lom_w);
|
||||
if ( (c3n == res_o) || (lom_w < 20) ) {
|
||||
fprintf(stderr, "error: --loom must be >= 20 and <= %u\r\n", u3a_bits + 2);
|
||||
exit(1);
|
||||
}
|
||||
u3_Host.ops_u.lom_y = lom_w;
|
||||
} break;
|
||||
|
||||
case '?': {
|
||||
fprintf(stderr, "invalid argument\r\n");
|
||||
exit(1);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
// argv[optind] is always "eval"
|
||||
//
|
||||
|
||||
if ( optind + 1 != argc ) {
|
||||
fprintf(stderr, "invalid command\r\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
c3_c* evl_c = _cw_eval_get_input(stdin, 10);
|
||||
|
||||
// initialize the Loom and load the Ivory Pill
|
||||
//
|
||||
{
|
||||
c3_d len_d = u3_Ivory_pill_len;
|
||||
c3_y* byt_y = u3_Ivory_pill;
|
||||
u3_cue_xeno* sil_u;
|
||||
u3_weak pil;
|
||||
|
||||
u3C.wag_w |= u3o_hashless;
|
||||
u3m_boot_lite((size_t)1 << u3_Host.ops_u.lom_y);
|
||||
sil_u = u3s_cue_xeno_init_with(ur_fib27, ur_fib28);
|
||||
if ( u3_none == (pil = u3s_cue_xeno_with(sil_u, len_d, byt_y)) ) {
|
||||
printf("lite: unable to cue ivory pill\r\n");
|
||||
exit(1);
|
||||
}
|
||||
u3s_cue_xeno_done(sil_u);
|
||||
if ( c3n == u3v_boot_lite(pil) ) {
|
||||
u3l_log("lite: boot failed\r\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
printf("eval:\n");
|
||||
|
||||
// +wish for an eval gate (virtualized twice for pretty-printing)
|
||||
//
|
||||
u3_noun gat = u3v_wish("|=(a=@t (sell (slap !>(+>.$) (rain /eval a))))");
|
||||
u3_noun res;
|
||||
{
|
||||
u3_noun sam = u3i_string(evl_c);
|
||||
u3_noun cor = u3nc(u3k(u3h(gat)), u3nc(sam, u3k(u3t(u3t(gat)))));
|
||||
res = u3m_soft(0, u3n_kick_on, cor);
|
||||
}
|
||||
|
||||
|
||||
if ( 0 == u3h(res) ) { // successful execution, print output
|
||||
u3_pier_tank(0, 0, u3k(u3t(res)));
|
||||
}
|
||||
else { // error, print stack trace
|
||||
u3_pier_punt_goof("eval", u3k(res));
|
||||
}
|
||||
|
||||
u3z(res);
|
||||
u3z(gat);
|
||||
free(evl_c);
|
||||
}
|
||||
|
||||
/* _cw_info(): print pier info
|
||||
*/
|
||||
static void
|
||||
@ -1175,7 +1320,7 @@ _cw_info(c3_i argc, c3_c* argv[])
|
||||
} break;
|
||||
}
|
||||
|
||||
c3_d eve_d = u3m_boot(u3_Host.dir_c);
|
||||
c3_d eve_d = u3m_boot(u3_Host.dir_c, u3a_bytes);
|
||||
u3_disk* log_u = _cw_disk_init(u3_Host.dir_c);
|
||||
|
||||
fprintf(stderr, "\r\nurbit: %s at event %" PRIu64 "\r\n",
|
||||
@ -1212,7 +1357,7 @@ _cw_grab(c3_i argc, c3_c* argv[])
|
||||
} break;
|
||||
}
|
||||
|
||||
u3m_boot(u3_Host.dir_c);
|
||||
u3m_boot(u3_Host.dir_c, u3a_bytes);
|
||||
u3C.wag_w |= u3o_hashless;
|
||||
u3_serf_grab();
|
||||
u3m_stop();
|
||||
@ -1223,25 +1368,56 @@ _cw_grab(c3_i argc, c3_c* argv[])
|
||||
static void
|
||||
_cw_cram(c3_i argc, c3_c* argv[])
|
||||
{
|
||||
switch ( argc ) {
|
||||
case 2: {
|
||||
if ( !(u3_Host.dir_c = _main_pier_run(argv[0])) ) {
|
||||
fprintf(stderr, "unable to find pier\r\n");
|
||||
exit (1);
|
||||
}
|
||||
} break;
|
||||
c3_i ch_i, lid_i;
|
||||
c3_w arg_w;
|
||||
|
||||
case 3: {
|
||||
u3_Host.dir_c = argv[2];
|
||||
} break;
|
||||
static struct option lop_u[] = {
|
||||
{ "loom", required_argument, NULL, c3__loom },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
default: {
|
||||
fprintf(stderr, "invalid command\r\n");
|
||||
exit(1);
|
||||
} break;
|
||||
u3_Host.dir_c = _main_pier_run(argv[0]);
|
||||
|
||||
while ( -1 != (ch_i=getopt_long(argc, argv, "", lop_u, &lid_i)) ) {
|
||||
switch ( ch_i ) {
|
||||
case c3__loom: {
|
||||
c3_w lom_w;
|
||||
c3_o res_o = _main_readw(optarg, u3a_bits + 3, &lom_w);
|
||||
if ( (c3n == res_o) || (lom_w < 20) ) {
|
||||
fprintf(stderr, "error: --loom must be >= 20 and <= %u\r\n", u3a_bits + 2);
|
||||
exit(1);
|
||||
}
|
||||
u3_Host.ops_u.lom_y = lom_w;
|
||||
} break;
|
||||
|
||||
case '?': {
|
||||
fprintf(stderr, "invalid argument\r\n");
|
||||
exit(1);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
c3_d eve_d = u3m_boot(u3_Host.dir_c);
|
||||
// argv[optind] is always "cram"
|
||||
//
|
||||
|
||||
if ( !u3_Host.dir_c ) {
|
||||
if ( optind + 1 < argc ) {
|
||||
u3_Host.dir_c = argv[optind + 1];
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "invalid command, pier required\r\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
optind++;
|
||||
}
|
||||
|
||||
if ( optind + 1 != argc ) {
|
||||
fprintf(stderr, "invalid command\r\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
c3_d eve_d = u3m_boot(u3_Host.dir_c, (size_t)1 << u3_Host.ops_u.lom_y);
|
||||
u3_disk* log_u = _cw_disk_init(u3_Host.dir_c); // XX s/b try_aquire lock
|
||||
c3_o ret_o;
|
||||
|
||||
@ -1271,29 +1447,58 @@ _cw_cram(c3_i argc, c3_c* argv[])
|
||||
static void
|
||||
_cw_queu(c3_i argc, c3_c* argv[])
|
||||
{
|
||||
c3_i ch_i, lid_i;
|
||||
c3_w arg_w;
|
||||
|
||||
static struct option lop_u[] = {
|
||||
{ "loom", required_argument, NULL, c3__loom },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
u3_Host.dir_c = _main_pier_run(argv[0]);
|
||||
|
||||
while ( -1 != (ch_i=getopt_long(argc, argv, "", lop_u, &lid_i)) ) {
|
||||
switch ( ch_i ) {
|
||||
case c3__loom: {
|
||||
c3_w lom_w;
|
||||
c3_o res_o = _main_readw(optarg, u3a_bits + 3, &lom_w);
|
||||
if ( (c3n == res_o) || (lom_w < 20) ) {
|
||||
fprintf(stderr, "error: --loom must be >= 20 and <= %u\r\n", u3a_bits + 2);
|
||||
exit(1);
|
||||
}
|
||||
u3_Host.ops_u.lom_y = lom_w;
|
||||
} break;
|
||||
|
||||
case '?': {
|
||||
fprintf(stderr, "invalid argument\r\n");
|
||||
exit(1);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
// argv[optind] is always "queu"
|
||||
//
|
||||
|
||||
if ( !u3_Host.dir_c ) {
|
||||
if ( optind + 1 < argc ) {
|
||||
u3_Host.dir_c = argv[optind + 1];
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "invalid command, pier required\r\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
optind++;
|
||||
}
|
||||
|
||||
if ( optind + 1 != argc ) {
|
||||
fprintf(stderr, "invalid command\r\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
c3_c* eve_c;
|
||||
c3_d eve_d;
|
||||
|
||||
switch ( argc ) {
|
||||
case 3: {
|
||||
if ( !(u3_Host.dir_c = _main_pier_run(argv[0])) ) {
|
||||
fprintf(stderr, "unable to find pier\r\n");
|
||||
exit (1);
|
||||
}
|
||||
eve_c = argv[2];
|
||||
} break;
|
||||
|
||||
case 4: {
|
||||
u3_Host.dir_c = argv[2];
|
||||
eve_c = argv[3];
|
||||
} break;
|
||||
|
||||
default: {
|
||||
fprintf(stderr, "invalid command\r\n");
|
||||
exit(1);
|
||||
} break;
|
||||
}
|
||||
|
||||
if ( 1 != sscanf(eve_c, "%" PRIu64 "", &eve_d) ) {
|
||||
fprintf(stderr, "urbit: queu: invalid number '%s'\r\n", eve_c);
|
||||
exit(1);
|
||||
@ -1303,7 +1508,7 @@ _cw_queu(c3_i argc, c3_c* argv[])
|
||||
|
||||
fprintf(stderr, "urbit: queu: preparing\r\n");
|
||||
|
||||
u3m_boot(u3_Host.dir_c);
|
||||
u3m_boot(u3_Host.dir_c, (size_t)1 << u3_Host.ops_u.lom_y);
|
||||
|
||||
// XX can spuriously fail do to corrupt memory-image checkpoint,
|
||||
// need a u3m_half_boot equivalent
|
||||
@ -1327,29 +1532,60 @@ _cw_queu(c3_i argc, c3_c* argv[])
|
||||
static void
|
||||
_cw_meld(c3_i argc, c3_c* argv[])
|
||||
{
|
||||
switch ( argc ) {
|
||||
case 2: {
|
||||
if ( !(u3_Host.dir_c = _main_pier_run(argv[0])) ) {
|
||||
fprintf(stderr, "unable to find pier\r\n");
|
||||
exit (1);
|
||||
}
|
||||
} break;
|
||||
c3_i ch_i, lid_i;
|
||||
c3_w arg_w;
|
||||
|
||||
case 3: {
|
||||
u3_Host.dir_c = argv[2];
|
||||
} break;
|
||||
static struct option lop_u[] = {
|
||||
{ "loom", required_argument, NULL, c3__loom },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
default: {
|
||||
fprintf(stderr, "invalid command\r\n");
|
||||
u3_Host.dir_c = _main_pier_run(argv[0]);
|
||||
|
||||
while ( -1 != (ch_i=getopt_long(argc, argv, "", lop_u, &lid_i)) ) {
|
||||
switch ( ch_i ) {
|
||||
case c3__loom: {
|
||||
c3_w lom_w;
|
||||
c3_o res_o = _main_readw(optarg, u3a_bits + 3, &lom_w);
|
||||
if ( (c3n == res_o) || (lom_w < 20) ) {
|
||||
fprintf(stderr, "error: --loom must be >= 20 and <= %u\r\n", u3a_bits + 2);
|
||||
exit(1);
|
||||
}
|
||||
u3_Host.ops_u.lom_y = lom_w;
|
||||
} break;
|
||||
|
||||
case '?': {
|
||||
fprintf(stderr, "invalid argument\r\n");
|
||||
exit(1);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
// argv[optind] is always "meld"
|
||||
//
|
||||
|
||||
if ( !u3_Host.dir_c ) {
|
||||
if ( optind + 1 < argc ) {
|
||||
u3_Host.dir_c = argv[optind + 1];
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "invalid command, pier required\r\n");
|
||||
exit(1);
|
||||
} break;
|
||||
}
|
||||
|
||||
optind++;
|
||||
}
|
||||
|
||||
if ( optind + 1 != argc ) {
|
||||
fprintf(stderr, "invalid command\r\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
u3_disk* log_u = _cw_disk_init(u3_Host.dir_c); // XX s/b try_aquire lock
|
||||
c3_w pre_w;
|
||||
|
||||
u3C.wag_w |= u3o_hashless;
|
||||
u3m_boot(u3_Host.dir_c);
|
||||
u3m_boot(u3_Host.dir_c, (size_t)1 << u3_Host.ops_u.lom_y);
|
||||
|
||||
pre_w = u3a_open(u3R);
|
||||
u3u_meld();
|
||||
@ -1369,7 +1605,8 @@ _cw_next(c3_i argc, c3_c* argv[])
|
||||
c3_w arg_w;
|
||||
|
||||
static struct option lop_u[] = {
|
||||
{ "arch", required_argument, NULL, 'a' },
|
||||
{ "arch", required_argument, NULL, 'a' },
|
||||
{ "loom", required_argument, NULL, c3__loom },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
@ -1381,7 +1618,18 @@ _cw_next(c3_i argc, c3_c* argv[])
|
||||
u3_Host.arc_c = strdup(optarg);
|
||||
} break;
|
||||
|
||||
case c3__loom: {
|
||||
c3_w lom_w;
|
||||
c3_o res_o = _main_readw(optarg, u3a_bits + 3, &lom_w);
|
||||
if ( (c3n == res_o) || (lom_w < 20) ) {
|
||||
fprintf(stderr, "error: --loom must be >= 20 and <= %u\r\n", u3a_bits + 2);
|
||||
exit(1);
|
||||
}
|
||||
u3_Host.ops_u.lom_y = lom_w;
|
||||
} break;
|
||||
|
||||
case '?': {
|
||||
fprintf(stderr, "invalid argument\r\n");
|
||||
exit(1);
|
||||
} break;
|
||||
}
|
||||
@ -1409,6 +1657,7 @@ _cw_next(c3_i argc, c3_c* argv[])
|
||||
|
||||
u3_Host.pep_o = c3y;
|
||||
u3_Host.nex_o = c3y;
|
||||
u3_Host.ops_u.tem = c3y;
|
||||
}
|
||||
|
||||
/* _cw_pack(): compact memory, save, and exit.
|
||||
@ -1416,27 +1665,58 @@ _cw_next(c3_i argc, c3_c* argv[])
|
||||
static void
|
||||
_cw_pack(c3_i argc, c3_c* argv[])
|
||||
{
|
||||
switch ( argc ) {
|
||||
case 2: {
|
||||
if ( !(u3_Host.dir_c = _main_pier_run(argv[0])) ) {
|
||||
fprintf(stderr, "unable to find pier\r\n");
|
||||
exit (1);
|
||||
}
|
||||
} break;
|
||||
c3_i ch_i, lid_i;
|
||||
c3_w arg_w;
|
||||
|
||||
case 3: {
|
||||
u3_Host.dir_c = argv[2];
|
||||
} break;
|
||||
static struct option lop_u[] = {
|
||||
{ "loom", required_argument, NULL, c3__loom },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
default: {
|
||||
fprintf(stderr, "invalid command\r\n");
|
||||
u3_Host.dir_c = _main_pier_run(argv[0]);
|
||||
|
||||
while ( -1 != (ch_i=getopt_long(argc, argv, "", lop_u, &lid_i)) ) {
|
||||
switch ( ch_i ) {
|
||||
case c3__loom: {
|
||||
c3_w lom_w;
|
||||
c3_o res_o = _main_readw(optarg, u3a_bits + 3, &lom_w);
|
||||
if ( (c3n == res_o) || (lom_w < 20) ) {
|
||||
fprintf(stderr, "error: --loom must be >= 20 and <= %u\r\n", u3a_bits + 2);
|
||||
exit(1);
|
||||
}
|
||||
u3_Host.ops_u.lom_y = lom_w;
|
||||
} break;
|
||||
|
||||
case '?': {
|
||||
fprintf(stderr, "invalid argument\r\n");
|
||||
exit(1);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
// argv[optind] is always "pack"
|
||||
//
|
||||
|
||||
if ( !u3_Host.dir_c ) {
|
||||
if ( optind + 1 < argc ) {
|
||||
u3_Host.dir_c = argv[optind + 1];
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "invalid command, pier required\r\n");
|
||||
exit(1);
|
||||
} break;
|
||||
}
|
||||
|
||||
optind++;
|
||||
}
|
||||
|
||||
if ( optind + 1 != argc ) {
|
||||
fprintf(stderr, "invalid command\r\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
u3_disk* log_u = _cw_disk_init(u3_Host.dir_c); // XX s/b try_aquire lock
|
||||
|
||||
u3m_boot(u3_Host.dir_c);
|
||||
u3m_boot(u3_Host.dir_c, (size_t)1 << u3_Host.ops_u.lom_y);
|
||||
u3a_print_memory(stderr, "urbit: pack: gained", u3m_pack());
|
||||
|
||||
u3e_save();
|
||||
@ -1449,25 +1729,57 @@ _cw_pack(c3_i argc, c3_c* argv[])
|
||||
static void
|
||||
_cw_prep(c3_i argc, c3_c* argv[])
|
||||
{
|
||||
switch ( argc ) {
|
||||
case 2: {
|
||||
if ( !(u3_Host.dir_c = _main_pier_run(argv[0])) ) {
|
||||
fprintf(stderr, "unable to find pier\r\n");
|
||||
exit (1);
|
||||
}
|
||||
} break;
|
||||
c3_i ch_i, lid_i;
|
||||
c3_w arg_w;
|
||||
|
||||
case 3: {
|
||||
u3_Host.dir_c = argv[2];
|
||||
} break;
|
||||
static struct option lop_u[] = {
|
||||
{ "loom", required_argument, NULL, c3__loom },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
default: {
|
||||
fprintf(stderr, "invalid command\r\n");
|
||||
u3_Host.dir_c = _main_pier_run(argv[0]);
|
||||
|
||||
while ( -1 != (ch_i=getopt_long(argc, argv, "", lop_u, &lid_i)) ) {
|
||||
switch ( ch_i ) {
|
||||
case c3__loom: {
|
||||
c3_w lom_w;
|
||||
c3_o res_o = _main_readw(optarg, u3a_bits + 3, &lom_w);
|
||||
if ( (c3n == res_o) || (lom_w < 20) ) {
|
||||
fprintf(stderr, "error: --loom must be >= 20 and <= %u\r\n", u3a_bits + 2);
|
||||
exit(1);
|
||||
}
|
||||
u3_Host.ops_u.lom_y = lom_w;
|
||||
} break;
|
||||
|
||||
case '?': {
|
||||
fprintf(stderr, "invalid argument\r\n");
|
||||
exit(1);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
// argv[optind] is always "prep"
|
||||
//
|
||||
|
||||
if ( !u3_Host.dir_c ) {
|
||||
if ( optind + 1 < argc ) {
|
||||
u3_Host.dir_c = argv[optind + 1];
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "invalid command, pier required\r\n");
|
||||
exit(1);
|
||||
} break;
|
||||
}
|
||||
|
||||
optind++;
|
||||
}
|
||||
|
||||
if ( optind + 1 != argc ) {
|
||||
fprintf(stderr, "invalid command\r\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
u3_Host.pep_o = c3y;
|
||||
u3_Host.ops_u.tem = c3y;
|
||||
}
|
||||
|
||||
/* _cw_vere(): download vere
|
||||
@ -1484,9 +1796,9 @@ _cw_vere(c3_i argc, c3_c* argv[])
|
||||
c3_w arg_w;
|
||||
|
||||
static struct option lop_u[] = {
|
||||
{ "arch", required_argument, NULL, 'a' },
|
||||
{ "pace", required_argument, NULL, 'p' },
|
||||
{ "version", required_argument, NULL, 'v' },
|
||||
{ "arch", required_argument, NULL, 'a' },
|
||||
{ "pace", required_argument, NULL, 'p' },
|
||||
{ "version", required_argument, NULL, 'v' },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
@ -1583,6 +1895,100 @@ _cw_vere(c3_i argc, c3_c* argv[])
|
||||
u3l_log("vere: download succeeded\r\n");
|
||||
}
|
||||
|
||||
/* _cw_vile(): generatoe/print keyfile
|
||||
*/
|
||||
static void
|
||||
_cw_vile(c3_i argc, c3_c* argv[])
|
||||
{
|
||||
c3_i ch_i, lid_i;
|
||||
c3_w arg_w;
|
||||
|
||||
static struct option lop_u[] = {
|
||||
{ "loom", required_argument, NULL, c3__loom },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
u3_Host.dir_c = _main_pier_run(argv[0]);
|
||||
|
||||
while ( -1 != (ch_i=getopt_long(argc, argv, "", lop_u, &lid_i)) ) {
|
||||
switch ( ch_i ) {
|
||||
case c3__loom: {
|
||||
c3_w lom_w;
|
||||
c3_o res_o = _main_readw(optarg, u3a_bits + 3, &lom_w);
|
||||
if ( (c3n == res_o) || (lom_w < 20) ) {
|
||||
fprintf(stderr, "error: --loom must be >= 20 and <= %u\r\n", u3a_bits + 2);
|
||||
exit(1);
|
||||
}
|
||||
u3_Host.ops_u.lom_y = lom_w;
|
||||
} break;
|
||||
|
||||
case '?': {
|
||||
fprintf(stderr, "invalid argument\r\n");
|
||||
exit(1);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
// argv[optind] is always "vile"
|
||||
//
|
||||
|
||||
if ( !u3_Host.dir_c ) {
|
||||
if ( optind + 1 < argc ) {
|
||||
u3_Host.dir_c = argv[optind + 1];
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "invalid command, pier required\r\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
optind++;
|
||||
}
|
||||
|
||||
if ( optind + 1 != argc ) {
|
||||
fprintf(stderr, "invalid command\r\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// XX check if snapshot is stale?
|
||||
//
|
||||
c3_d eve_d = u3m_boot(u3_Host.dir_c, (size_t)1 << u3_Host.ops_u.lom_y);
|
||||
u3_noun sam = u3nc(u3nc(u3_nul, u3_nul),
|
||||
u3nc(c3n, u3nq(c3__once, 'j', c3__vile, u3_nul)));
|
||||
u3_noun res = u3v_soft_peek(0, sam);
|
||||
|
||||
|
||||
switch ( u3h(res) ) {
|
||||
default: c3_assert(0);
|
||||
|
||||
case c3n: {
|
||||
fprintf(stderr, "vile: unable to retrieve key file\r\n");
|
||||
u3_pier_punt_goof("foo", u3k(u3t(res)));
|
||||
}
|
||||
case c3y: {
|
||||
u3_noun dat, vil, out;
|
||||
c3_c* out_c;
|
||||
|
||||
if ( (u3_nul != u3h(u3t(res)))
|
||||
|| (c3n == u3r_pq(u3t(u3t(res)), c3__omen, 0, &dat))
|
||||
|| (c3n == u3r_p(dat, c3__atom, &vil))
|
||||
|| (c3n == u3a_is_atom(vil)) )
|
||||
{
|
||||
fprintf(stderr, "vile: unable to extract key file\r\n");
|
||||
u3m_p("vil", res);
|
||||
}
|
||||
else {
|
||||
out = u3dc("scot", c3__uw, u3k(vil));
|
||||
out_c = u3r_string(out);
|
||||
puts(out_c);
|
||||
c3_free(out_c);
|
||||
u3z(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u3z(res);
|
||||
}
|
||||
|
||||
/* _cw_utils(): "worker" utilities and "serf" entrypoint
|
||||
*/
|
||||
static c3_i
|
||||
@ -1601,9 +2007,12 @@ _cw_utils(c3_i argc, c3_c* argv[])
|
||||
// [%prep dir=@t] :: prep upgrade
|
||||
// [%queu dir=@t eve=@ud] :: cue state
|
||||
// [?(%vere %fetch-vere) dir=@t] :: download vere
|
||||
// [%vile dir=@t] :: extract keys
|
||||
// :: :: ipc:
|
||||
// [%serf dir=@t key=@t wag=@t hap=@ud eve=@ud] :: compute
|
||||
// ==
|
||||
// $: %serf :: compute
|
||||
// dir=@t key=@t wag=@t hap=@ud ::
|
||||
// lom=@ud eve=@ud ::
|
||||
// == == ::
|
||||
//
|
||||
// NB: don't print to anything other than stderr;
|
||||
// other streams may be used for ipc.
|
||||
@ -1626,6 +2035,7 @@ _cw_utils(c3_i argc, c3_c* argv[])
|
||||
switch ( mot_m ) {
|
||||
case c3__cram: _cw_cram(argc, argv); return 1;
|
||||
case c3__dock: _cw_dock(argc, argv); return 1;
|
||||
case c3__eval: _cw_eval(argc, argv); return 1;
|
||||
|
||||
case c3__mass:
|
||||
case c3__grab: _cw_grab(argc, argv); return 1;
|
||||
@ -1637,6 +2047,7 @@ _cw_utils(c3_i argc, c3_c* argv[])
|
||||
case c3__prep: _cw_prep(argc, argv); return 2; // continue on
|
||||
case c3__queu: _cw_queu(argc, argv); return 1;
|
||||
case c3__vere: _cw_vere(argc, argv); return 1;
|
||||
case c3__vile: _cw_vile(argc, argv); return 1;
|
||||
|
||||
case c3__serf: _cw_serf_commence(argc, argv); return 1;
|
||||
}
|
||||
@ -1828,7 +2239,7 @@ main(c3_i argc,
|
||||
// starting u3m configures OpenSSL memory functions, so we must do it
|
||||
// before any OpenSSL allocations
|
||||
//
|
||||
u3m_boot_lite();
|
||||
u3m_boot_lite((size_t)1 << u3_Host.ops_u.lut_y);
|
||||
|
||||
// Initialize OpenSSL for client and server
|
||||
//
|
||||
|
@ -387,6 +387,7 @@
|
||||
# define c3__ergo c3_s4('e','r','g','o')
|
||||
# define c3__esh c3_s3('e','s','h')
|
||||
# define c3__etch c3_s4('e','t','c','h')
|
||||
# define c3__eval c3_s4('e','v','a','l')
|
||||
# define c3__evil c3_s4('e','v','i','l')
|
||||
# define c3__ex c3_s2('e','x')
|
||||
# define c3__exit c3_s4('e','x','i','t')
|
||||
@ -698,6 +699,7 @@
|
||||
# define c3__lond c3_s4('l','o','n','d')
|
||||
# define c3__lonk c3_s4('l','o','n','k')
|
||||
# define c3__look c3_s4('l','o','o','k')
|
||||
# define c3__loom c3_s4('l','o','o','m')
|
||||
# define c3__loop c3_s4('l','o','o','p')
|
||||
# define c3__lorb c3_s4('l','o','r','b')
|
||||
# define c3__lord c3_s4('l','o','r','d')
|
||||
@ -1239,6 +1241,7 @@
|
||||
# define c3__vern c3_s4('v','e','r','n')
|
||||
# define c3__very c3_s4('v','e','r','y')
|
||||
# define c3__view c3_s4('v','i','e','w')
|
||||
# define c3__vile c3_s4('v','i','l', 'e')
|
||||
# define c3__vint c3_s4('v','i','n','t')
|
||||
# define c3__void c3_s4('v','o','i','d')
|
||||
# define c3__vorp c3_s4('v','o','r','p')
|
||||
@ -1296,6 +1299,7 @@
|
||||
# define c3__wtts c3_s4('w','t','t','s')
|
||||
# define c3__wtzp c3_s4('w','t','z','p')
|
||||
# define c3__wyrd c3_s4('w','y','r','d')
|
||||
# define c3__xray c3_s4('x','r','a','y')
|
||||
# define c3__yell c3_s4('y','e','l','l')
|
||||
# define c3__yelp c3_s4('y','e','l','p')
|
||||
# define c3__z c3_s1('z')
|
||||
|
@ -157,24 +157,24 @@
|
||||
# else
|
||||
# define U3_OS_LoomBase 0x36000000
|
||||
# endif
|
||||
# define U3_OS_LoomBits 29
|
||||
# define U3_OS_LoomBits 30
|
||||
# elif defined(U3_OS_mingw)
|
||||
# define U3_OS_LoomBase 0x28000000000
|
||||
# define U3_OS_LoomBits 29
|
||||
# define U3_OS_LoomBits 30
|
||||
# elif defined(U3_OS_osx)
|
||||
# ifdef __LP64__
|
||||
# define U3_OS_LoomBase 0x28000000000
|
||||
# else
|
||||
# define U3_OS_LoomBase 0x4000000
|
||||
# endif
|
||||
# define U3_OS_LoomBits 29
|
||||
# define U3_OS_LoomBits 30
|
||||
# elif defined(U3_OS_bsd)
|
||||
# ifdef __LP64__
|
||||
# define U3_OS_LoomBase 0x200000000
|
||||
# else
|
||||
# define U3_OS_LoomBase 0x4000000
|
||||
# endif
|
||||
# define U3_OS_LoomBits 29
|
||||
# define U3_OS_LoomBits 30
|
||||
# else
|
||||
# error "port: LoomBase"
|
||||
# endif
|
||||
|
@ -1,8 +1,6 @@
|
||||
#ifndef U3_ALLOCATE_H
|
||||
#define U3_ALLOCATE_H
|
||||
|
||||
#include <openssl/opensslv.h>
|
||||
|
||||
#include "manage.h"
|
||||
|
||||
/** Constants.
|
||||
@ -15,15 +13,15 @@
|
||||
*/
|
||||
# define u3a_page 12
|
||||
|
||||
/* u3a_pages: number of pages in memory.
|
||||
/* u3a_pages: maximum number of pages in memory.
|
||||
*/
|
||||
# define u3a_pages (1 << (u3a_bits - u3a_page))
|
||||
|
||||
/* u3a_words: number of words in memory.
|
||||
/* u3a_words: maximum number of words in memory.
|
||||
*/
|
||||
# define u3a_words (1 << u3a_bits)
|
||||
|
||||
/* u3a_bytes: number of bytes in memory.
|
||||
/* u3a_bytes: maximum number of bytes in memory.
|
||||
*/
|
||||
# define u3a_bytes (sizeof(c3_w) * u3a_words)
|
||||
|
||||
@ -477,15 +475,6 @@
|
||||
void*
|
||||
u3a_malloc(size_t len_i);
|
||||
|
||||
/* u3a_malloc_ssl(): openssl-shaped malloc
|
||||
*/
|
||||
void*
|
||||
u3a_malloc_ssl(size_t len_i
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
||||
, const char* file, int line
|
||||
#endif
|
||||
);
|
||||
|
||||
/* u3a_calloc(): aligned storage measured in bytes.
|
||||
*/
|
||||
void*
|
||||
@ -496,39 +485,11 @@
|
||||
void*
|
||||
u3a_realloc(void* lag_v, size_t len_i);
|
||||
|
||||
/* u3a_realloc2(): gmp-shaped realloc.
|
||||
*/
|
||||
void*
|
||||
u3a_realloc2(void* lag_v, size_t old_i, size_t new_i);
|
||||
|
||||
/* u3a_realloc_ssl(): openssl-shaped realloc.
|
||||
*/
|
||||
void*
|
||||
u3a_realloc_ssl(void* lag_v, size_t len_i
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
||||
, const char* file, int line
|
||||
#endif
|
||||
);
|
||||
|
||||
/* u3a_free(): free for aligned malloc.
|
||||
*/
|
||||
void
|
||||
u3a_free(void* tox_v);
|
||||
|
||||
/* u3a_free2(): gmp-shaped free.
|
||||
*/
|
||||
void
|
||||
u3a_free2(void* tox_v, size_t siz_i);
|
||||
|
||||
/* u3a_free_ssl(): openssl-shaped free.
|
||||
*/
|
||||
void
|
||||
u3a_free_ssl(void* tox_v
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
||||
, const char* file, int line
|
||||
#endif
|
||||
);
|
||||
|
||||
/* Reference and arena control.
|
||||
*/
|
||||
/* u3a_gain(): gain a reference count in normal space.
|
||||
|
@ -41,6 +41,7 @@
|
||||
typedef struct _u3e_pool {
|
||||
c3_c* dir_c; // path to
|
||||
c3_w dit_w[u3a_pages >> 5]; // touched since last save
|
||||
c3_w pag_w; // number of pages (<= u3a_pages)
|
||||
u3e_image nor_u; // north segment
|
||||
u3e_image sou_u; // south segment
|
||||
} u3e_pool;
|
||||
|
@ -6,12 +6,12 @@
|
||||
/* u3m_boot(): start the u3 system. return next event, starting from 1.
|
||||
*/
|
||||
c3_d
|
||||
u3m_boot(c3_c* dir_c);
|
||||
u3m_boot(c3_c* dir_c, size_t len_i);
|
||||
|
||||
/* u3m_boot_lite(): start without checkpointing.
|
||||
*/
|
||||
c3_d
|
||||
u3m_boot_lite(void);
|
||||
u3m_boot_lite(size_t len_i);
|
||||
|
||||
/* u3m_stop(): graceful shutdown cleanup. */
|
||||
void
|
||||
@ -37,7 +37,7 @@
|
||||
/* u3m_init(): start the environment.
|
||||
*/
|
||||
void
|
||||
u3m_init();
|
||||
u3m_init(size_t len_i);
|
||||
|
||||
/* u3m_pave(): instantiate or activate image.
|
||||
*/
|
||||
|
@ -9,6 +9,7 @@
|
||||
u3_noun who; // single identity
|
||||
c3_c* dir_c; // execution directory (pier)
|
||||
c3_w wag_w; // flags (both ways)
|
||||
size_t wor_i; // loom word-length (<= u3a_words)
|
||||
void (*stderr_log_f)(c3_c*); // errors from c code
|
||||
void (*slog_f)(u3_noun); // function pointer for slog
|
||||
void (*sign_hold_f)(void); // suspend system signal regime
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user