From 317a8f66f3bf4396790217c0dbb39098a61dc3ee Mon Sep 17 00:00:00 2001 From: fang Date: Thu, 23 Jun 2022 01:09:42 +0200 Subject: [PATCH 001/252] hoon: make +chip produce correct type for %wthx Previously, this would replace the entire subject's type with the type of the wing. Now we use +take to descend into the subject and replace only the type of the affected wing. We also lightly refactor the implementation, to resemble +cool more closely. Co-authored-by: joemfb --- pkg/arvo/sys/hoon.hoon | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 43fee2f55c..3c86cac6b1 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -9713,14 +9713,13 @@ ?: ?=([%wtts *] gen) (cool how q.gen (play ~(example ax p.gen))) ?: ?=([%wthx *] gen) - =+ (play %wing q.gen) - ~> %slog.[0 [%leaf "chipping"]] - ?: how - =- ~> %slog.[0 (dunk(sut +<) 'chip: gain: ref')] - ~> %slog.[0 (dunk(sut -) 'chip: gain: gain')] - - - ~(gain ar - p.gen) - ~(lose ar - p.gen) + =+ fid=(find %both q.gen) + ?- -.fid + %| sut + %& =< q + %+ take p.p.fid + |=(a=type ?:(how ~(gain ar a p.gen) ~(lose ar a p.gen))) + == ?: ?&(how ?=([%wtpm *] gen)) |-(?~(p.gen sut $(p.gen t.p.gen, sut ^$(gen i.p.gen)))) ?: ?&(!how ?=([%wtbr *] gen)) From bf9d3752e07202f7be6b333bca0f4c11a1eee106 Mon Sep 17 00:00:00 2001 From: fang Date: Fri, 1 Jul 2022 14:48:40 +0200 Subject: [PATCH 002/252] hoon: compile +bool to constant And use hoon-style boolean syntax instead of numberic literals. Co-authored-by: joemfb --- pkg/arvo/sys/hoon.hoon | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 3c86cac6b1..4213442b41 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -7181,7 +7181,10 @@ :: :::: 5a: compiler utilities :: -++ bool `type`(fork [%atom %f `0] [%atom %f `1] ~) :: make loobean +++ bool :: make loobean + ^~ ^- type + (fork [%atom %f `%.y] [%atom %f `%.n] ~) +:: ++ cell :: make %cell type ~/ %cell |= [hed=type tal=type] From e35fa977a2953261141d71b972f8018fa94412fb Mon Sep 17 00:00:00 2001 From: fang Date: Fri, 1 Jul 2022 14:51:55 +0200 Subject: [PATCH 003/252] hoon: refine +fish:ar and +lose:ar They were not handling the %over and %spec cases correctly. We update the %over cases to recurse as they should, and the %spec cases to +mint and +crop respectively. Co-authored-by: joemfb --- pkg/arvo/sys/hoon.hoon | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 4213442b41..626a068769 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -8846,9 +8846,14 @@ %dbug $(skin skin.skin) %help $(skin skin.skin) %name $(skin skin.skin) - %over $(skin skin.skin) - %spec $(skin skin.skin) - %wash [%1 1] + %over ::TODO (find -> tend should just be a function) + ::NOTE might need to guard with +feel, crashing is too strict + ~| %oops-guess-you-needed-feel-after-all + =+ fid=(find %read wing.skin) + ?> &(?=(%& -.fid) ?=(%& -.q.p.fid)) + [%7 [%0 (tend p.p.fid)] $(skin skin.skin, sut p.q.p.fid)] + %spec q:(~(mint ut ref) %noun [%fits ~(example ax spec.skin) [&+1 ~]]) + %wash [%1 1] ::TODO shouldn't this always _match_? == :: :: -gain: make a $type by restricting .ref to .skin @@ -9019,8 +9024,12 @@ %dbug $(skin skin.skin) %help $(skin skin.skin) %name $(skin skin.skin) - %over $(skin skin.skin) - %spec $(skin skin.skin) + %over ::TODO if we guard in +fish (+feel), we have to guard again here + $(skin skin.skin, sut (~(play ut sut) %wing wing.skin)) + %spec =/ yon $(skin skin.skin) + =/ hit (~(play ut sut) ~(example ax spec.skin)) + ?< (~(nest ut hit) | yon) + (~(crop ut yon) hit) %wash ref == -- From ce3eb011adf5e57754c5f5ef0bd23c648c1b099f Mon Sep 17 00:00:00 2001 From: fang Date: Fri, 1 Jul 2022 14:56:37 +0200 Subject: [PATCH 004/252] hoon: drop faces during +ar Since this is the ?# codepath, we want to drop any faces that might already exist, since we'll bring our own (through %name in +gain:ar). Co-authored-by: joemfb --- pkg/arvo/sys/hoon.hoon | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 626a068769..8ab4ef4eb4 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -8883,7 +8883,7 @@ q.ref [%cell *] %void [%core *] %void - [%face *] (face p.ref $(ref q.ref)) + [%face *] $(ref q.ref) [%fork *] (fork (turn ~(tap in p.ref) |=(=type ^$(ref type)))) [%hint *] (hint p.ref $(ref q.ref)) [%hold *] ?: (~(has in gil) ref) %void @@ -8906,7 +8906,7 @@ ?. =(%noun ^skin.skin) (cell - ^$(skin ^skin.skin, ref %noun)) [%core - q.ref] - [%face *] (face p.ref $(ref q.ref)) + [%face *] $(ref q.ref) [%fork *] (fork (turn ~(tap in p.ref) |=(=type ^$(ref type)))) [%hint *] (hint p.ref $(ref q.ref)) [%hold *] ?: (~(has in gil) ref) %void @@ -8928,7 +8928,7 @@ `atom.skin [%cell *] %void [%core *] %void - [%face *] (face p.ref $(ref q.ref)) + [%face *] $(ref q.ref) [%fork *] (fork (turn ~(tap in p.ref) |=(=type ^$(ref type)))) [%hint *] (hint p.ref $(ref q.ref)) [%hold *] ?: (~(has in gil) ref) %void @@ -8996,7 +8996,7 @@ ?. =(%noun ^skin.skin) (cell - ^$(skin ^skin.skin, ref %noun)) [%core - q.ref] - [%face *] (face p.ref $(ref q.ref)) + [%face *] $(ref q.ref) [%fork *] (fork (turn ~(tap in p.ref) |=(=type ^$(ref type)))) [%hint *] (hint p.ref $(ref q.ref)) [%hold *] ?: (~(has in gil) ref) %void From 6cbeef72b99e3b98cac6046c02bdbf555c29e901 Mon Sep 17 00:00:00 2001 From: fang Date: Fri, 1 Jul 2022 14:59:46 +0200 Subject: [PATCH 005/252] hoon: remove stale commented code Co-authored-by: joemfb --- pkg/arvo/sys/hoon.hoon | 3 --- 1 file changed, 3 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 8ab4ef4eb4..e99806e4c3 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -8336,9 +8336,6 @@ :: [%limb @] `p.gen - :: - :: [%rock *] - :: [%spec %leaf q.gen q.gen] :: [%note [%help *] *] (bind $(gen q.gen) |=(=skin [%help p.p.gen skin])) From 1977f3c1c6d8969417fe005eaa08000fe0fff970 Mon Sep 17 00:00:00 2001 From: fang Date: Fri, 1 Jul 2022 15:07:34 +0200 Subject: [PATCH 006/252] hoon: handle term skins in +ar as %like Co-authored-by: joemfb --- pkg/arvo/sys/hoon.hoon | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index e99806e4c3..96d41d7d2d 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -8802,7 +8802,7 @@ ++ fish |= =axis ^- nock - ?@ skin [%1 &] + ?@ skin $(skin spec+[[%like [skin]~ ~] [%base %noun]]) ?- -.skin :: %base @@ -8857,7 +8857,7 @@ :: ++ gain |- ^- type - ?@ skin [%face skin ref] + ?@ skin $(skin spec+[[%like [skin]~ ~] [%base %noun]]) ?- -.skin :: %base @@ -8951,7 +8951,7 @@ :: ++ lose |- ^- type - ?@ skin [%face skin ref] + ?@ skin $(skin spec+[[%like [skin]~ ~] [%base %noun]]) ?- -.skin :: %base From 5becd6d31bce22878f0de99937a0ae9b3d9301b1 Mon Sep 17 00:00:00 2001 From: fang Date: Fri, 1 Jul 2022 15:08:59 +0200 Subject: [PATCH 007/252] hoon: in +lose:ar, subtract flags more precisely Co-authored-by: joemfb --- pkg/arvo/sys/hoon.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 96d41d7d2d..b299f2b2c2 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -8957,7 +8957,7 @@ %base ?- base.skin %cell $(skin [%cell [%base %noun] [%base %noun]]) - %flag $(skin [%base %atom %f]) + %flag $(ref $(skin [%leaf %f &]), skin [%leaf %f |]) %null $(skin [%leaf %n ~]) %void ref %noun %void From 3dfd8189bbfb03fc269c54ee6f9aedfc064b5147 Mon Sep 17 00:00:00 2001 From: fang Date: Fri, 1 Jul 2022 15:09:53 +0200 Subject: [PATCH 008/252] hoon: in +lose:ar subtract cell from noun properly The result is only guaranteed to be an atom if both parts of the cell are nouns. Otherwise, it could still be a specific kind of cell. Co-authored-by: joemfb --- pkg/arvo/sys/hoon.hoon | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index b299f2b2c2..5158e5a476 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -8983,7 +8983,9 @@ |- ^- type ?- ref %void %void - %noun [%atom %$ ~] + %noun ?. =([%cell [%base %noun] [%base %noun]] skin) + ref + [%atom %$ ~] [%atom *] ref [%cell *] =+ ^$(skin skin.skin, ref p.ref) ?: =(%void -) %void From 6edaaec0b416efb91bd54ea4b0369a86729a708c Mon Sep 17 00:00:00 2001 From: fang Date: Fri, 1 Jul 2022 18:09:10 +0200 Subject: [PATCH 009/252] hoon: keep +fish:ar axis updated on recursion When we recur into a %cell or %over, we need to update the axis appropriately. Co-authored-by: joemfb --- pkg/arvo/sys/hoon.hoon | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 5158e5a476..97b74286be 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -8832,8 +8832,8 @@ [%1 &] [%3 %0 axis] %+ flan - $(ref (peek(sut ref) %free 2), skin skin.skin) - $(ref (peek(sut ref) %free 3), skin ^skin.skin) + $(ref (peek(sut ref) %free 2), axis (peg axis 2), skin skin.skin) + $(ref (peek(sut ref) %free 3), axis (peg axis 3), skin ^skin.skin) :: %leaf ?: (~(nest ut [%atom %$ `atom.skin]) | ref) @@ -8848,7 +8848,7 @@ ~| %oops-guess-you-needed-feel-after-all =+ fid=(find %read wing.skin) ?> &(?=(%& -.fid) ?=(%& -.q.p.fid)) - [%7 [%0 (tend p.p.fid)] $(skin skin.skin, sut p.q.p.fid)] + $(sut p.q.p.fid, axis (peg axis (tend p.p.fid)), skin skin.skin) %spec q:(~(mint ut ref) %noun [%fits ~(example ax spec.skin) [&+1 ~]]) %wash [%1 1] ::TODO shouldn't this always _match_? == From fa36819a27cd9373cbe0232574d89e3a2711283d Mon Sep 17 00:00:00 2001 From: fang Date: Fri, 1 Jul 2022 18:20:24 +0200 Subject: [PATCH 010/252] hoon: handle %specs correctly in +ar Co-authored-by: joemfb --- pkg/arvo/sys/hoon.hoon | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 97b74286be..aac99897c8 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -8849,7 +8849,9 @@ =+ fid=(find %read wing.skin) ?> &(?=(%& -.fid) ?=(%& -.q.p.fid)) $(sut p.q.p.fid, axis (peg axis (tend p.p.fid)), skin skin.skin) - %spec q:(~(mint ut ref) %noun [%fits ~(example ax spec.skin) [&+1 ~]]) + %spec =/ hit (~(play ut sut) ~(example ax spec.skin)) + ?> (~(nest ut hit) & ref) + $(skin skin.skin) %wash [%1 1] ::TODO shouldn't this always _match_? == :: @@ -8936,10 +8938,9 @@ %help (hint [sut %help help.skin] $(skin skin.skin)) %name (face term.skin $(skin skin.skin)) %over $(skin skin.skin, sut (~(play ut sut) %wing wing.skin)) - %spec =/ yon $(skin skin.skin) - =/ hit (~(play ut sut) ~(example ax spec.skin)) - ?> (~(nest ut hit) & yon) - hit + %spec =/ hit (~(play ut sut) ~(example ax spec.skin)) + ?> (~(nest ut hit) & $(skin skin.skin)) + (~(fuse ut ref) hit) %wash =- $(ref (~(play ut ref) -)) :- %wing |- ^- wing @@ -9025,10 +9026,9 @@ %name $(skin skin.skin) %over ::TODO if we guard in +fish (+feel), we have to guard again here $(skin skin.skin, sut (~(play ut sut) %wing wing.skin)) - %spec =/ yon $(skin skin.skin) - =/ hit (~(play ut sut) ~(example ax spec.skin)) - ?< (~(nest ut hit) | yon) - (~(crop ut yon) hit) + %spec =/ hit (~(play ut sut) ~(example ax spec.skin)) + ?> (~(nest ut hit) & $(skin skin.skin)) + (~(crop ut ref) hit) %wash ref == -- From 7370343abf5160604e0bbab8689556df2d655e8a Mon Sep 17 00:00:00 2001 From: fang Date: Fri, 1 Jul 2022 18:28:31 +0200 Subject: [PATCH 011/252] hoon: when +gain:ar a cell, make sure to recurse Into the head and tail for more complete gains. Co-authored-by: joemfb --- pkg/arvo/sys/hoon.hoon | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index aac99897c8..3905d26f2b 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -8895,7 +8895,9 @@ |- ^- type ?- ref %void %void - %noun [%cell %noun %noun] + %noun =+ ^$(skin skin.skin) + ?: =(%void -) %void + (cell - ^$(skin ^skin.skin)) [%atom *] %void [%cell *] =+ ^$(skin skin.skin, ref p.ref) ?: =(%void -) %void From 9201e9663a0dada56bf4993965fae2812c0220fb Mon Sep 17 00:00:00 2001 From: fang Date: Thu, 7 Jul 2022 13:36:53 +0200 Subject: [PATCH 012/252] hoon: refactor find->tend calls into +fend We are commonly looking for both the type and axis of a specific wing. +fend gives you both. --- pkg/arvo/sys/hoon.hoon | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 3905d26f2b..087d7d054a 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -8843,12 +8843,10 @@ %dbug $(skin skin.skin) %help $(skin skin.skin) %name $(skin skin.skin) - %over ::TODO (find -> tend should just be a function) - ::NOTE might need to guard with +feel, crashing is too strict - ~| %oops-guess-you-needed-feel-after-all - =+ fid=(find %read wing.skin) - ?> &(?=(%& -.fid) ?=(%& -.q.p.fid)) - $(sut p.q.p.fid, axis (peg axis (tend p.p.fid)), skin skin.skin) + %over ::NOTE might need to guard with +feel, crashing is too strict + =+ ~| %oops-guess-you-needed-feel-after-all + fid=(fend %read wing.skin) + $(sut p.fid, axis (peg axis q.fid), skin skin.skin) %spec =/ hit (~(play ut sut) ~(example ax spec.skin)) ?> (~(nest ut hit) & ref) $(skin skin.skin) @@ -9508,6 +9506,14 @@ == == (fond way hyp) :: + ++ fend + |= [way=vial hyp=wing] + ^- (pair type axis) + =+ fid=(find way hyp) + ~> %mean.'fend-fragment' + ?> &(?=(%& -.fid) ?=(%& -.q.p.fid)) + [p.q.p.fid (tend p.p.fid)] + :: ++ fund ~/ %fund |= [way=vial gen=hoon] @@ -10018,10 +10024,8 @@ :: [%wthx *] :- (nice bool) - =+ fid=(find %read [[%& 1] q.gen]) - ~> %mean.'mint-fragment' - ?> &(?=(%& -.fid) ?=(%& -.q.p.fid)) - (~(fish ar `type`p.q.p.fid `skin`p.gen) (tend p.p.fid)) + =+ fid=(fend %read [[%& 1] q.gen]) + (~(fish ar `type`p.fid `skin`p.gen) q.fid) :: [%fits *] :- (nice bool) @@ -10208,12 +10212,8 @@ :: [%wthx *] ~> %mean.'mull-bonk-x' - =+ :- =+ (find %read [[%& 1] q.gen]) - ?> &(?=(%& -.-) ?=(%& -.q.p.-)) - new=[type=p.q.p.- axis=(tend p.p.-)] - =+ (find(sut dox) %read [%& 1] q.gen) - ?> &(?=(%& -.-) ?=(%& -.q.p.-)) - old=[type=p.q.p.- axis=(tend p.p.-)] + =+ :- new=[type=p axis=q]:(fend %read [[%& 1] q.gen]) + old=[type=p axis=q]:(fend(sut dox) %read [[%& 1] q.gen]) ?> =(axis.old axis.new) ?> (nest(sut type.old) & type.new) (beth bool) From 0340af443511f0a48db122f075cec063e474d78e Mon Sep 17 00:00:00 2001 From: fang Date: Thu, 7 Jul 2022 14:15:19 +0200 Subject: [PATCH 013/252] hoon: in +fish:ar always match on %wash --- pkg/arvo/sys/hoon.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 087d7d054a..6c078c2ee8 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -8850,7 +8850,7 @@ %spec =/ hit (~(play ut sut) ~(example ax spec.skin)) ?> (~(nest ut hit) & ref) $(skin skin.skin) - %wash [%1 1] ::TODO shouldn't this always _match_? + %wash [%1 &] == :: :: -gain: make a $type by restricting .ref to .skin From 0d779fb12c709c66ac79afc6a7cd789689d64265 Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Mon, 27 Mar 2023 00:35:44 -0400 Subject: [PATCH 014/252] hoon: add +tap and +uni to jar engine --- pkg/arvo/sys/hoon.hoon | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index b20922a263..995b136839 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -1687,6 +1687,33 @@ |* [b=* c=*] =+ d=(get b) (~(put by a) b [c d]) + :: + ++ tap :: listify jar + ~/ %tap + => .(a ~(tap by a)) + ^- (list _?>(?=(^ a) [p.i.a ?>(?=(^ q.i.a) i.q.i.a)])) + |- + ?~ a ~ + |- + ?~ q.i.a ^$(a t.a) + [i=[p.i.a i.q.i.a] t=$(q.i.a t.q.i.a)] + :: + ++ uni :: unify jars, removing + ~/ %uni :: duplicate list items + |* b=_a + |- ^+ a + ?~ b a + ?~ a b + ?: =(p.n.b p.n.a) + :_ [l=$(a l.a, b l.b) r=$(a r.a, b r.b)] + n=[p.n.a ~(tap in (silt (weld q.n.a q.n.b)))] + ?: (mor p.n.a p.n.b) + ?: (gor p.n.b p.n.a) + $(l.a $(a l.a, r.b ~), b r.b) + $(r.a $(a r.a, l.b ~), b l.b) + ?: (gor p.n.a p.n.b) + $(l.b $(b l.b, r.a ~), a r.a) + $(r.b $(b r.b, l.a ~), a l.a) -- ++ ju :: jug engine =| a=(tree (pair * (tree))) :: (jug) From e30a97cc75f32ddc56cbfdabda0d42e499b40f2d Mon Sep 17 00:00:00 2001 From: ~wicrum-wicrun <99811688+wicrum-wicrun@users.noreply.github.com> Date: Sun, 9 Apr 2023 02:17:45 +0200 Subject: [PATCH 015/252] hoon: allow `%.` in spec mode --- pkg/arvo/sys/hoon.hoon | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index b20922a263..c4bde28e58 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -13102,6 +13102,12 @@ |= [%cnhp a=hoon b=spec] [%make a b ~] (rune hep %cnhp exqd) + :: + :- '.' + %+ cook + |= [%cndt a=spec b=hoon] + [%make b a ~] + (rune dot %cndt exqc) :: :- ':' %+ cook From 3d89342154426f6b0daf81fb61ebd2078ee5dc98 Mon Sep 17 00:00:00 2001 From: ~wicrum-wicrun <99811688+wicrum-wicrun@users.noreply.github.com> Date: Sun, 9 Apr 2023 02:18:38 +0200 Subject: [PATCH 016/252] hoon: bump kelvin --- pkg/arvo/sys/hoon.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index c4bde28e58..cfe915a803 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -2,11 +2,11 @@ :::: /sys/hoon :: :: :: =< ride -=> %139 => +=> %138 => :: :: :::: 0: version stub :: :: :: -~% %k.139 ~ ~ :: +~% %k.138 ~ ~ :: |% ++ hoon-version + -- => From 7a645a85647df353d52a871319e3b9ad9786f55a Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Fri, 28 Apr 2023 13:58:14 +0200 Subject: [PATCH 017/252] aqua: wip fix ph tests for %413 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes the issues that disallowed running any tests, but some tests are very slow, or just «behn» (e.g. -ph-keen) --- pkg/arvo/ted/aqua/ames.hoon | 7 ++++--- pkg/arvo/ted/aqua/dill.hoon | 32 ++++++++++++++++++-------------- pkg/arvo/ted/ph/keen.hoon | 4 ++-- pkg/base-dev/lib/ph/util.hoon | 23 +++++++++++++++++------ pkg/base-dev/sur/aquarium.hoon | 5 +++++ 5 files changed, 46 insertions(+), 25 deletions(-) diff --git a/pkg/arvo/ted/aqua/ames.hoon b/pkg/arvo/ted/aqua/ames.hoon index e6286aae4d..b97cb4c0a7 100644 --- a/pkg/arvo/ted/aqua/ames.hoon +++ b/pkg/arvo/ted/aqua/ames.hoon @@ -26,9 +26,10 @@ ^- (list card:agent:gall) =/ rcvr=ship (lane-to-ship lan) =/ hear-lane (ship-to-lane sndr) - =/ [ames=? =packet] (decode-packet pac) - ?: &(!ames !resp==(& (cut 0 [2 1] pac))) - =/ [=peep =purr] (decode-request-info `@ux`(rsh 3^64 content.packet)) + =/ =shot (sift-shot pac) + ?: &(!sam.shot req.shot) :: is fine request + =/ [=peep =meow] (sift-purr `@ux`content.shot) + ~& fine-request+peep %+ emit-aqua-events our [%read [rcvr path.peep] [hear-lane num.peep]]~ %+ emit-aqua-events our diff --git a/pkg/arvo/ted/aqua/dill.hoon b/pkg/arvo/ted/aqua/dill.hoon index e7cb190174..1cca22392c 100644 --- a/pkg/arvo/ted/aqua/dill.hoon +++ b/pkg/arvo/ted/aqua/dill.hoon @@ -14,20 +14,24 @@ |= [who=@p way=wire %blit blits=(list blit:dill)] ^- (list card:agent:gall) =/ last-line - %+ roll blits - |= [b=blit:dill line=tape] - ?- -.b - %put (tape p.b) - %klr (tape (zing (turn p.b tail))) - %nel ~& "{}: {line}" "" - %hop line - %bel line - %clr "" - %sag ~& [%save-jamfile-to p.b] line - %sav ~& [%save-file-to p.b] line - %url ~& [%activate-url p.b] line - %wyp "" - == + |^ (roll blits ha-blit) + :: + ++ ha-blit + |= [b=blit:dill line=tape] + ?- -.b + %put (tape p.b) + %klr (tape (zing (turn p.b tail))) + %mor `tape`(roll p.b ha-blit) + %nel ~& "{}: {line}" "" + %hop line + %bel line + %clr "" + %sag ~& [%save-jamfile-to p.b] line + %sav ~& [%save-file-to p.b] line + %url ~& [%activate-url p.b] line + %wyp "" + == + -- ~? !=(~ last-line) last-line ~ -- diff --git a/pkg/arvo/ted/ph/keen.hoon b/pkg/arvo/ted/ph/keen.hoon index dead5bf603..530abf726b 100644 --- a/pkg/arvo/ted/ph/keen.hoon +++ b/pkg/arvo/ted/ph/keen.hoon @@ -7,7 +7,7 @@ ;< ~ bind:m start-simple ;< ~ bind:m (init-ship ~bud &) ;< ~ bind:m (init-ship ~dev &) -;< ~ bind:m (dojo ~bud "-keen /cx/~dev/kids/1/desk/bill") -;< ~ bind:m (wait-for-output ~bud "[ ~") +;< ~ bind:m (dojo ~bud "-keen ~dev /c/x/1/kids/sys/kelvin") +;< ~ bind:m (wait-for-output ~bud "kal=[lal=%zuse num={(scow %ud zuse)}]") ;< ~ bind:m end (pure:m *vase) diff --git a/pkg/base-dev/lib/ph/util.hoon b/pkg/base-dev/lib/ph/util.hoon index f4b53ceb67..33afb948e6 100644 --- a/pkg/base-dev/lib/ph/util.hoon +++ b/pkg/base-dev/lib/ph/util.hoon @@ -62,15 +62,26 @@ ::TODO should be rename -dill-output ++ is-dojo-output |= [who=ship her=ship uf=unix-effect what=tape] + |^ ?& =(who her) ?=(%blit -.q.uf) - :: - %+ lien p.q.uf - |= =blit:dill - ?. ?=(%put -.blit) - | - !=(~ (find what p.blit)) + (lien p.q.uf handle-blit) == + :: + ++ handle-blit + |= =blit:dill + ^- ? + ?: ?=(%mor -.blit) + (lien p.blit handle-blit) + ?+ -.blit | + %put !=(~ (find what p.blit)) + :: + %klr + %+ lien p.blit + |= [* q=(list @c)] + !=(~ (find what q)) + == + -- :: :: Test is successful if +is-dojo-output :: diff --git a/pkg/base-dev/sur/aquarium.hoon b/pkg/base-dev/sur/aquarium.hoon index 60ca5fd29f..324ad92a8b 100644 --- a/pkg/base-dev/sur/aquarium.hoon +++ b/pkg/base-dev/sur/aquarium.hoon @@ -82,5 +82,10 @@ [%kill ~] [%init ~] [%request id=@ud request=request:http] + [%turf p=(list turf)] + :: XX effects seen after running :aqua [%swap-files ~] + [%vega ~] + [%set-config =http-config:eyre] + [%sessions p=(set @t)] == -- From bd4ac8ec3ba6e86cfb55215654ae5540db27fd89 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Fri, 28 Apr 2023 14:05:02 +0200 Subject: [PATCH 018/252] aqua: remove /ted/ph/lib-hooks --- pkg/arvo/ted/ph/lib-hooks.hoon | 66 ---------------------------------- 1 file changed, 66 deletions(-) delete mode 100644 pkg/arvo/ted/ph/lib-hooks.hoon diff --git a/pkg/arvo/ted/ph/lib-hooks.hoon b/pkg/arvo/ted/ph/lib-hooks.hoon deleted file mode 100644 index 77d357a799..0000000000 --- a/pkg/arvo/ted/ph/lib-hooks.hoon +++ /dev/null @@ -1,66 +0,0 @@ -/- spider -/+ io=ph-io, *strandio -=> -=, io -|% -++ strand strand:spider -++ start-agents - |= =ship - =/ m (strand ,~) - ;< ~ bind:m (dojo ship "|start %graph-store") - ;< ~ bind:m (dojo ship "|start %graph-push-hook") - ;< ~ bind:m (dojo ship "|start %graph-pull-hook") - ;< ~ bind:m (dojo ship "|start %group-store") - ;< ~ bind:m (dojo ship "|start %group-push-hook") - ;< ~ bind:m (dojo ship "|start %group-pull-hook") - ;< ~ bind:m (dojo ship "|start %metadata-store") - ;< ~ bind:m (dojo ship "|start %metadata-hook") - ;< ~ bind:m (sleep `@dr`300) - (pure:m ~) -:: -++ make-link - |= [title=@t url=@t] - =/ m (strand ,~) - ;< ~ bind:m (dojo ~bud ":graph-store|add-post [~bud %test] ~[[%text '{(trip title)}'] [%url '{(trip url)}']]") - (pure:m ~) --- - -^- thread:spider -|= vase -=/ m (strand ,vase) -;< ~ bind:m start-azimuth -;< ~ bind:m (spawn ~bud) -;< ~ bind:m (spawn ~dev) -;< ~ bind:m (init-ship ~bud |) -;< ~ bind:m (init-ship ~dev |) -;< ~ bind:m (start-agents ~bud) -;< ~ bind:m (start-agents ~dev) -;< ~ bind:m (send-hi ~bud ~dev) -;< ~ bind:m (dojo ~bud "-graph-create [%create [~bud %test] 'test' '' `%graph-validator-link [%policy [%open ~ ~]] 'link']") -;< ~ bind:m (sleep ~s5) -;< ~ bind:m (dojo ~dev "-graph-join [%join [~bud %test] ~bud]") -;< ~ bind:m (sleep ~s5) -;< ~ bind:m (send-hi ~bud ~dev) -;< ~ bind:m (poke-our %aqua noun+!>([%pause-events ~[~dev]])) -;< ~ bind:m (make-link 'one' 'one') -;< ~ bind:m (make-link 'two' 'one') -;< ~ bind:m (make-link 'thre' 'one') -;< ~ bind:m (make-link 'four' 'one') -;< ~ bind:m (make-link 'five' 'one') -;< ~ bind:m (make-link 'six' 'one') -;< ~ bind:m (make-link 'seven' 'one') -;< ~ bind:m (sleep ~s40) -:: five unacked events is sufficent to cause a clog, and by extension a -:: %kick -;< ~ bind:m (poke-our %aqua noun+!>([%unpause-events ~[~dev]])) -;< ~ bind:m (sleep ~s10) -;< ~ bind:m (make-link 'eight' 'one') -;< ~ bind:m (make-link 'nine' 'one') -;< ~ bind:m (sleep ~s10) -;< ~ bind:m (dojo ~dev ":graph-pull-hook +dbug %bowl") -;< ~ bind:m (dojo ~dev ":graph-store +dbug") -;< ~ bind:m (dojo ~bud ":graph-push-hook +dbug %bowl") -;< ~ bind:m (dojo ~bud ":graph-store +dbug") -;< ~ bind:m end -(pure:m *vase) -::(pure:m *vase) From cf7bbf79c72d0559ae1a3b654d67d76e28fe7571 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Fri, 28 Apr 2023 14:07:55 +0200 Subject: [PATCH 019/252] aqua: remove /ted/ph/group-rejoin --- pkg/arvo/ted/ph/group-rejoin.hoon | 67 ------------------------------- 1 file changed, 67 deletions(-) delete mode 100644 pkg/arvo/ted/ph/group-rejoin.hoon diff --git a/pkg/arvo/ted/ph/group-rejoin.hoon b/pkg/arvo/ted/ph/group-rejoin.hoon deleted file mode 100644 index 4a6ab5772f..0000000000 --- a/pkg/arvo/ted/ph/group-rejoin.hoon +++ /dev/null @@ -1,67 +0,0 @@ -/- spider -/+ *ph-io -=> -|% -++ wait-for-agent-start - |= [=ship agent=term] - =/ m (strand:spider ,~) - ^- form:m - =* loop $ - ;< [her=^ship =unix-effect] bind:m take-unix-effect - ?: (is-dojo-output:util ship her unix-effect "activated app base/{(trip agent)}") - (pure:m ~) - loop -:: -++ start-agent - |= [=ship agent=term] - =/ m (strand:spider ,~) - ^- form:m - =* loop $ - ;< ~ bind:m (dojo ship "|start {}") - ;< ~ bind:m (wait-for-agent-start ship agent) - (pure:m ~) -:: -++ wait-for-goad - |= =ship - =/ m (strand:spider ,~) - ^- form:m - =* loop $ - ;< [her=^ship =unix-effect] bind:m take-unix-effect - ?: (is-dojo-output:util ship her unix-effect "p=%hood q=%bump") - (pure:m ~) - loop -:: -++ start-group-agents - |= =ship - =/ m (strand:spider ,~) - ^- form:m - ;< ~ bind:m (start-agent ship %group-store) - (pure:m ~) --- -=, strand=strand:spider -^- thread:spider -|= args=vase -=/ m (strand ,vase) -;< ~ bind:m start-azimuth -;< ~ bind:m (spawn ~bud) -;< ~ bind:m (spawn ~marbud) -;< ~ bind:m (spawn ~zod) -;< ~ bind:m (spawn ~marzod) -;< ~ bind:m (init-ship ~bud |) -;< ~ bind:m (init-ship ~marbud |) -;< ~ bind:m (wait-for-goad ~marbud) -;< ~ bind:m (init-ship ~zod |) -;< ~ bind:m (init-ship ~marzod |) -;< ~ bind:m (wait-for-goad ~marzod) -;< ~ bind:m (start-group-agents ~marbud) -;< ~ bind:m (start-group-agents ~marzod) -;< ~ bind:m (dojo ~marbud ":group-store|create 'test-group'") -;< ~ bind:m (wait-for-output ~marbud ">=") -;< ~ bind:m (sleep ~s1) -;< ~ bind:m (breach-and-hear ~marzod ~marbud) -;< ~ bind:m (init-ship ~marzod |) -;< ~ bind:m (wait-for-goad ~marzod) -;< ~ bind:m (start-group-agents ~marzod) -;< ~ bind:m (sleep ~s3) -;< ~ bind:m end -(pure:m *vase) From a2c227c3fc08c3b91104ba5784d6ea22177a8b76 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Thu, 4 May 2023 14:25:29 +0200 Subject: [PATCH 020/252] aqua: fix %fine request/response handling --- pkg/arvo/app/aqua.hoon | 55 +++++++++++++++++++++++----------- pkg/arvo/ted/aqua/ames.hoon | 9 +++--- pkg/base-dev/sur/aquarium.hoon | 2 +- 3 files changed, 44 insertions(+), 22 deletions(-) diff --git a/pkg/arvo/app/aqua.hoon b/pkg/arvo/app/aqua.hoon index efe256f0e7..210a1f3f82 100644 --- a/pkg/arvo/app/aqua.hoon +++ b/pkg/arvo/app/aqua.hoon @@ -84,7 +84,7 @@ =^ cards state ?+ mark ~|([%aqua-bad-mark mark] !!) %aqua-events (poke-aqua-events:ac !<((list aqua-event) vase)) - %pill (poke-pill:ac !<(pill vase)) + %pill (poke-pill:ac !<(pill vase)) %noun (poke-noun:ac !<(* vase)) %azimuth-action (poke-azimuth-action:ac !<(azimuth-action vase)) == @@ -662,34 +662,55 @@ (pe ~bud) :: XX why ~bud? need an example :: %read - ?~ pier=(~(get by ships.piers) from.ae) - (pe from.ae) + ?~ pier=(~(get by ships.piers) ship.from.ae) + (pe ship.from.ae) =/ cash (~(get by namespace.u.pier) path.ae) |- ?^ cash ?: (gth num.ae (lent u.cash)) - (pe from.ae) + (pe ship.from.ae) ::TODO depends on /ted/aqua/ames behavior in a weird indirect way - =/ for=@p `@`(tail for.ae) ::NOTE moons & comets not supported - =; task=task-arvo - ^$(ae [%event for /a/aqua/fine-response task], thus this) - :+ %hear `lane:ames`[%| `@`from.ae] + =/ for=@p `@`(tail lane.for.ae) ::NOTE moons & comets not supported + %- push-events:(pe for) + %- flop =< events + %+ roll u.cash + |= [=yowl:ames i=@ud events=(list unix-event)] + :- +(i) + :_ events + :- /a/aqua/fine-response/[(scot %ud i)] + ^- task-arvo + :+ %hear `lane:ames`[%| `@`ship.from.ae] ^- blob:ames - =/ =shot:ames - ::NOTE dec is important! so dumb!! - (sift-shot:ames `@`(snag (dec num.ae) u.cash)) - ::TODO runtime needs to update rcvr field also - ::NOTE rcvr life is allowed to be wrong - (etch-shot:ames shot(sndr from.ae, rcvr for)) + %- etch-shot:ames + :* [sndr=ship.from.ae rcvr=for] + req=| sam=| + sndr-tick=life.from.ae + rcvr-tick=life.for.ae + origin=~ + content=`@ux`yowl + == + :: =/ pacs=(unit (list yowl:ames)) + =/ =path [%fine %hunk (scot %ud num.ae) '512' path.ae] %+ biff - (peek-once:(pe from.ae) %ax %$ [%fine %message path.ae]) + (peek-once:(pe ship.from.ae) %ax %$ path) (soft (list yowl:ames)) - ?~ pacs (pe from.ae) + ?~ pacs (pe ship.from.ae) + =. u.pacs + :: add request to each response packet payload + :: + =+ pat=(spat path.ae) + =+ wid=(met 3 pat) + %- flop =< blobs + %+ roll u.pacs + |= [=yowl:ames num=_1 blobs=(list @ux)] + :- +(num) + :_ blobs + (can 3 4^num 2^wid wid^`@`pat (met 3 yowl)^yowl ~) =. namespace.u.pier (~(put by namespace.u.pier) path.ae u.pacs) =. ships.piers - (~(put by ships.piers) from.ae u.pier) + (~(put by ships.piers) ship.from.ae u.pier) $(cash pacs, thus this) :: %event diff --git a/pkg/arvo/ted/aqua/ames.hoon b/pkg/arvo/ted/aqua/ames.hoon index b97cb4c0a7..8315eba2ee 100644 --- a/pkg/arvo/ted/aqua/ames.hoon +++ b/pkg/arvo/ted/aqua/ames.hoon @@ -26,12 +26,13 @@ ^- (list card:agent:gall) =/ rcvr=ship (lane-to-ship lan) =/ hear-lane (ship-to-lane sndr) - =/ =shot (sift-shot pac) + =/ =shot (sift-shot pac) ?: &(!sam.shot req.shot) :: is fine request - =/ [=peep =meow] (sift-purr `@ux`content.shot) - ~& fine-request+peep + =/ [%0 =peep] (sift-wail `@ux`content.shot) %+ emit-aqua-events our - [%read [rcvr path.peep] [hear-lane num.peep]]~ + :_ ~ + :- %read + [[[rcvr rcvr-tick.shot] path.peep] [hear-lane sndr-tick.shot] num.peep] %+ emit-aqua-events our [%event rcvr /a/newt/0v1n.2m9vh %hear hear-lane pac]~ :: +lane-to-ship: decode a ship from an aqua lane diff --git a/pkg/base-dev/sur/aquarium.hoon b/pkg/base-dev/sur/aquarium.hoon index 324ad92a8b..27b022b456 100644 --- a/pkg/base-dev/sur/aquarium.hoon +++ b/pkg/base-dev/sur/aquarium.hoon @@ -41,7 +41,7 @@ [%pause-events who=ship] [%snap-ships lab=term hers=(list ship)] [%restore-snap lab=term] - [%read [from=ship =path] [for=lane:ames num=@ud]] + [%read [from=[=ship life=@ubC] =path] for=[=lane:ames life=@ubC] num=@ud] [%event who=ship ue=unix-event] == :: From cce2b5c9ed3a0b1625e95d9216e272ab44485de0 Mon Sep 17 00:00:00 2001 From: Edward Amsden Date: Tue, 16 May 2023 18:09:09 -0500 Subject: [PATCH 021/252] hoon: add pin and awl arms to test and trim subaxes --- pkg/arvo/sys/hoon.hoon | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index c99289c90b..c28db59392 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -226,6 +226,33 @@ * (add (mod b 2) (mul $(b (div b 2)) 2)) == :: +++ pin + ~/ %pin + :: sub axis test + :: + :: checks whether {b} addresses a subtree of the tree addressed by {a}. + |= [a=@ b=@] + ?< =(0 a) + ?< =(0 b) + |- ^- ? + ?: =(a 1) %& + ?: =((cap a) (cap b)) + $(a (mas a), b (mas b)) + %| +++ awl + ~/ %awl + :: axis after axis + :: computes the remainder of axis {b} when navigating to {a}. + :: (crashes if not `(pin a b)`) + |= [a=@ b=@] + ?< =(0 a) + ?< =(0 b) + |- ^- @ + ?: =(a 1) b + ?: =((cap a) (cap b)) + $(a (mas a), b (mas b)) + !! +:: :: # %containers :: :: the most basic of data types From e020d06cd499a1ff12d9f0091a8a76f92eb73369 Mon Sep 17 00:00:00 2001 From: Edward Amsden Date: Tue, 16 May 2023 18:51:07 -0500 Subject: [PATCH 022/252] hoon: address review comments for pin and awl --- pkg/arvo/sys/hoon.hoon | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index c28db59392..89df6ebb41 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -236,12 +236,13 @@ ?< =(0 b) |- ^- ? ?: =(a 1) %& - ?: =((cap a) (cap b)) - $(a (mas a), b (mas b)) - %| + ?. =((cap a) (cap b)) %| + $(a (mas a), b (mas b)) +:: ++ awl ~/ %awl :: axis after axis + :: :: computes the remainder of axis {b} when navigating to {a}. :: (crashes if not `(pin a b)`) |= [a=@ b=@] @@ -249,9 +250,8 @@ ?< =(0 b) |- ^- @ ?: =(a 1) b - ?: =((cap a) (cap b)) - $(a (mas a), b (mas b)) - !! + ?> =((cap a) (cap b)) + $(a (mas a), b (mas b)) :: :: # %containers :: From a19a41198ad4258abf4a25bd413e518587379624 Mon Sep 17 00:00:00 2001 From: Edward Amsden Date: Tue, 16 May 2023 19:07:36 -0500 Subject: [PATCH 023/252] hoon: +awl -> +hub --- pkg/arvo/sys/hoon.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 89df6ebb41..81e64f377e 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -239,8 +239,8 @@ ?. =((cap a) (cap b)) %| $(a (mas a), b (mas b)) :: -++ awl - ~/ %awl +++ hub + ~/ %hub :: axis after axis :: :: computes the remainder of axis {b} when navigating to {a}. From 5606bb32f194139b8dd8486aa65aff49b1fd30f3 Mon Sep 17 00:00:00 2001 From: Edward Amsden Date: Tue, 16 May 2023 19:32:09 -0500 Subject: [PATCH 024/252] hoon: make +pin total over non-zero atoms --- pkg/arvo/sys/hoon.hoon | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 81e64f377e..ae4f71948d 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -235,8 +235,9 @@ ?< =(0 a) ?< =(0 b) |- ^- ? - ?: =(a 1) %& - ?. =((cap a) (cap b)) %| + ?: =(a 1) & + ?: =(b 1) | + ?. =((cap a) (cap b)) | $(a (mas a), b (mas b)) :: ++ hub From 00775beba4049639ddfae484564010f2fe436ba8 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 24 May 2023 11:34:11 -0400 Subject: [PATCH 025/252] hoon: 138k --- pkg/arvo/sys/hoon.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index c99289c90b..2513cf46cb 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -2,11 +2,11 @@ :::: /sys/hoon :: :: :: =< ride -=> %139 => +=> %138 => :: :: :::: 0: version stub :: :: :: -~% %k.139 ~ ~ :: +~% %k.138 ~ ~ :: |% ++ hoon-version + -- => From 4a2380906312c83d0bdfceb8186d947f26dbe79f Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Wed, 31 Aug 2022 14:04:30 -0400 Subject: [PATCH 026/252] hoon: embrace the combinatorial explosion --- pkg/arvo/sys/hoon.hoon | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index fce52dee91..283691e8ef 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -8987,9 +8987,9 @@ ref [%atom %$ ~] [%atom *] ref - [%cell *] =+ ^$(skin skin.skin, ref p.ref) - ?: =(%void -) %void - (cell - ^$(skin ^skin.skin, ref q.ref)) + [%cell *] =/ lef ^$(skin skin.skin, ref p.ref) + =/ rig ^$(skin ^skin.skin, ref q.ref) + (fork (cell lef rig) (cell lef q.ref) (cell p.ref rig) ~) [%core *] =+ ^$(skin skin.skin, ref p.ref) ?: =(%void -) %void ?. =(%noun ^skin.skin) From b031f9e78d317faea572b7d28b9d691511e38224 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Paraniak?= Date: Wed, 7 Jun 2023 18:24:20 +0800 Subject: [PATCH 027/252] hoon: fixes a serious bug in +fitz +fitz is badly broken due to a typo. This has so far been masked by a functioning jet. --- pkg/arvo/sys/hoon.hoon | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index c99289c90b..31b14dd42a 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -7254,10 +7254,10 @@ =(0 p.wux) &(!=(0 p.wux) (lte p.wux p.yoz)) == - |- ?| =(%$ p.yoz) - =(%$ p.wux) - ?& =((end 3 p.yoz) (end 3 p.wux)) - $(p.yoz (rsh 3 p.yoz), p.wux (rsh 3 p.wux)) + |- ?| =(%$ q.yoz) + =(%$ q.wux) + ?& =((end 3 q.yoz) (end 3 q.wux)) + $(q.yoz (rsh 3 q.yoz), q.wux (rsh 3 q.wux)) == == == From e5ed5135beda3b2a2a916910ff7aa7c4916d1e94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Paraniak?= Date: Thu, 8 Jun 2023 10:40:32 +0800 Subject: [PATCH 028/252] tests: adds +fitz aura compatibility tests --- tests/sys/hoon/nest.hoon | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/sys/hoon/nest.hoon diff --git a/tests/sys/hoon/nest.hoon b/tests/sys/hoon/nest.hoon new file mode 100644 index 0000000000..bc0bc09fc5 --- /dev/null +++ b/tests/sys/hoon/nest.hoon @@ -0,0 +1,41 @@ +/+ *test +|% +++ test-fitz + ;: weld + %+ expect-eq + !> %.y + !> (fitz ~. ~.tas) + :: + %+ expect-eq + !> %.y + !> (fitz ~.ud ~.) + :: + %+ expect-eq + !> %.n + !> (fitz ~.p ~.q) + :: + %+ expect-eq + !> %.n + !> (fitz ~.ux ~.ud) + :: + %+ expect-eq + !> %.y + !> (fitz ~.tas ~.ta) + :: + %+ expect-eq + !> %.n + !> (fitz 'uvD' 'uvE') + :: + %+ expect-eq + !> %.y + !> (fitz 'uvE' 'uvD') + :: + %+ expect-eq + !> %.n + !> (fitz 'AD' 'CB') + :: + %+ expect-eq + !> %.n + !> (fitz 'AC' 'CB') + == +-- From e1786c7009eaee70c7874182518d9457448caa8c Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Fri, 9 Jun 2023 11:30:14 -0400 Subject: [PATCH 029/252] hoon: remove +uni from +ja, keep +tap --- pkg/arvo/sys/hoon.hoon | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 1ce9a86f39..1ddb8c8c5e 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -1697,23 +1697,6 @@ |- ?~ q.i.a ^$(a t.a) [i=[p.i.a i.q.i.a] t=$(q.i.a t.q.i.a)] - :: - ++ uni :: unify jars, removing - ~/ %uni :: duplicate list items - |* b=_a - |- ^+ a - ?~ b a - ?~ a b - ?: =(p.n.b p.n.a) - :_ [l=$(a l.a, b l.b) r=$(a r.a, b r.b)] - n=[p.n.a ~(tap in (silt (weld q.n.a q.n.b)))] - ?: (mor p.n.a p.n.b) - ?: (gor p.n.b p.n.a) - $(l.a $(a l.a, r.b ~), b r.b) - $(r.a $(a r.a, l.b ~), b l.b) - ?: (gor p.n.a p.n.b) - $(l.b $(b l.b, r.a ~), a r.a) - $(r.b $(b r.b, l.a ~), a l.a) -- ++ ju :: jug engine =| a=(tree (pair * (tree))) :: (jug) From 46ec863734f59ae71d948c75001704013904ff95 Mon Sep 17 00:00:00 2001 From: Quodss Date: Mon, 12 Jun 2023 11:19:27 +0200 Subject: [PATCH 030/252] fix ++curr Fixes sample of a wet gate produced by ++curr --- pkg/arvo/sys/hoon.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 33724ce6bf..f6d12f9cd7 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -1915,7 +1915,7 @@ :: ++ curr :: curry right |* [a=$-(^ *) c=*] - |* b=_+<+.a + |* b=_+<-.a (a b c) :: ++ fore |*(a=$-(* *) |*(b=$-(* *) (pair a b))) :: pair before From be0e8c0a50c6aaf29d7653572afcd5a06cbc2961 Mon Sep 17 00:00:00 2001 From: Quodss Date: Mon, 12 Jun 2023 19:24:39 +0200 Subject: [PATCH 031/252] strip faces of subjects in ++curr, ++cury, ++corl --- pkg/arvo/sys/hoon.hoon | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index f6d12f9cd7..b61f2165b1 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -1905,17 +1905,17 @@ ++ corl :: compose backwards |* [a=$-(* *) b=$-(* *)] =< +:|.((a (b))) :: type check - |* c=_+<.b + |* c=_,.+<.b (a (b c)) :: ++ cury :: curry left |* [a=$-(^ *) b=*] - |* c=_+<+.a + |* c=_,.+<+.a (a b c) :: ++ curr :: curry right |* [a=$-(^ *) c=*] - |* b=_+<-.a + |* b=_,.+<-.a (a b c) :: ++ fore |*(a=$-(* *) |*(b=$-(* *) (pair a b))) :: pair before From e9c6273757190d4bf9e1b765b66cff5f7124c88e Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Mon, 12 Jun 2023 19:33:11 -0400 Subject: [PATCH 032/252] jar: tap -> zip --- pkg/arvo/sys/hoon.hoon | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 1ddb8c8c5e..630593c9a5 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -1688,15 +1688,18 @@ =+ d=(get b) (~(put by a) b [c d]) :: - ++ tap :: listify jar - ~/ %tap - => .(a ~(tap by a)) - ^- (list _?>(?=(^ a) [p.i.a ?>(?=(^ q.i.a) i.q.i.a)])) - |- - ?~ a ~ - |- - ?~ q.i.a ^$(a t.a) - [i=[p.i.a i.q.i.a] t=$(q.i.a t.q.i.a)] + ++ zip :: listify jar + =< $ + ~/ %zip + =+ b=`(list _?>(?=([[* ^] *] a) [p=p q=i.q]:n.a))`~ + |. ^+ b + ?~ a b + %= $ + a r.a + b |- ^+ b + ?~ q.n.a ^$(a l.a) + [[p i.q]:n.a $(q.n.a t.q.n.a)] + == -- ++ ju :: jug engine =| a=(tree (pair * (tree))) :: (jug) From 3581667798c081a92c12a3e20934337fbb12133c Mon Sep 17 00:00:00 2001 From: Quodss Date: Tue, 13 Jun 2023 18:53:27 +0200 Subject: [PATCH 033/252] Add regression tests Added regression tests as asked by @joemfb to test that currying and composition gates strip faces and that the subject of a gate returned by ++curr nests under the head of curried gate's subject. --- tests/sys/hoon/func.hoon | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/sys/hoon/func.hoon diff --git a/tests/sys/hoon/func.hoon b/tests/sys/hoon/func.hoon new file mode 100644 index 0000000000..10ededbdb7 --- /dev/null +++ b/tests/sys/hoon/func.hoon @@ -0,0 +1,23 @@ +:: Tests for currying gates and ++corl +:: +/+ *test +|% +++ test-func + ;: weld + %+ expect-eq + !> `(list)`~[0 1 2] + !> ((curr oust `(list)`~[0 1 2])) + %+ expect-eq + !> `@`6 + !> ((curr roll add) (gulf 1 3)) + %+ expect-eq + !> `@`6 + !> ((cury roll (gulf 1 3)) add) + :: check that ++corl strips face from b's subject + :: + %+ expect-eq + !> `@`15 + !> ((corl same (cury roll (gulf 1 5))) add) + == +:: +-- From fe34f55a04434e43393116dea4001ffc7646ece5 Mon Sep 17 00:00:00 2001 From: Alex Shelkovnykov Date: Sun, 4 Jun 2023 04:32:36 +0000 Subject: [PATCH 034/252] hoon: refactor unnecessary parameter to bif:by --- pkg/arvo/sys/hoon.hoon | 18 +++++++----------- tests/sys/hoon/map.hoon | 6 +++--- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 33724ce6bf..39fd9500fe 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -1422,23 +1422,19 @@ :: ++ bif :: splits a by b ~/ %bif - |* [b=* c=*] - ^+ [l=a r=a] - =< + - |- ^+ a + |* b=* + |- ^+ [l=a r=a] ?~ a - [[b c] ~ ~] + [~ ~] ?: =(b p.n.a) - ?: =(c q.n.a) - a - a(n [b c]) + +.a ?: (gor b p.n.a) =+ d=$(a l.a) ?> ?=(^ d) - d(r a(l r.d)) + [l.d a(l r.d)] =+ d=$(a r.a) ?> ?=(^ d) - d(l a(r l.d)) + [a(r l.d) r.d] :: ++ del :: delete at key b ~/ %del @@ -1463,7 +1459,7 @@ |- ^+ a ?~ b a - =+ c=(bif p.n.b q.n.b) + =+ c=(bif p.n.b) ?> ?=(^ c) =+ d=$(a l.c, b l.b) =+ e=$(a r.c, b r.b) diff --git a/tests/sys/hoon/map.hoon b/tests/sys/hoon/map.hoon index 5957e458cf..6099609147 100644 --- a/tests/sys/hoon/map.hoon +++ b/tests/sys/hoon/map.hoon @@ -177,14 +177,14 @@ :: in both maps are the same as before, and that both returned :: maps are correct :: - =/ splits-a=[(map) (map)] (~(bif by m-des) [99 99]) - =/ splits-b=[(map) (map)] (~(bif by m-des) [6 12]) + =/ splits-a=[(map) (map)] (~(bif by m-des) 99) + =/ splits-b=[(map) (map)] (~(bif by m-des) 6) ;: weld :: Checks with empty map :: %+ expect-eq !> [~ ~] - !> (~(bif by m-nul) [1 2]) + !> (~(bif by m-nul) 1) :: Checks bifurcating by non-existing element :: %+ expect-eq From 9509254a2d0864b3fcab46b9bc0d751a3ecbcc73 Mon Sep 17 00:00:00 2001 From: Alex Shelkovnykov Date: Sun, 4 Jun 2023 14:50:47 +0000 Subject: [PATCH 035/252] hoon: remove rut:by, duplicate of urn:by --- pkg/arvo/lib/hood/kiln.hoon | 2 +- pkg/arvo/sys/hoon.hoon | 6 ------ pkg/arvo/sys/vane/ames.hoon | 2 +- pkg/landscape/app/graph-store.hoon | 2 +- tests/sys/hoon/map.hoon | 4 ++-- 5 files changed, 5 insertions(+), 11 deletions(-) diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index 6418acb415..0490fcb113 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -505,7 +505,7 @@ =+ .^(=rock:tire %cx /(scot %p our)//(scot %da now)/tire) :^ ~ ~ %kiln-pikes !> ^- pikes - %- ~(rut by rock) + %- ~(urn by rock) |= [=desk =zest wic=(set weft)] ^- pike =+ .^(hash=@uv %cz /(scot %p our)/[desk]/(scot %da now)) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 33724ce6bf..70bb9a498f 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -1620,12 +1620,6 @@ ?~ a a [n=[p=p.n.a q=(b q.n.a)] l=$(a l.a) r=$(a r.a)] :: - ++ rut :: apply gate to nodes - |* b=gate - |- - ?~ a a - [n=[p=p.n.a q=(b p.n.a q.n.a)] l=$(a l.a) r=$(a r.a)] - :: ++ tap :: listify pairs =< $ ~/ %tap diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 4e146cb28b..559715c21a 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -4639,7 +4639,7 @@ |= ames-state=ames-state-5 ^- ames-state-6 :_ +.ames-state - %- ~(rut by peers.ames-state) + %- ~(urn by peers.ames-state) |= [=ship ship-state=ship-state-5] ^- ship-state-6 ?. ?=(%known -.ship-state) diff --git a/pkg/landscape/app/graph-store.hoon b/pkg/landscape/app/graph-store.hoon index 3170ead6e1..1c7e3ce447 100644 --- a/pkg/landscape/app/graph-store.hoon +++ b/pkg/landscape/app/graph-store.hoon @@ -88,7 +88,7 @@ -.old %6 :: update-logs.old - %- ~(rut by update-logs.old) + %- ~(urn by update-logs.old) |= [=resource:store =update-log:store] ^- update-log:store ?: =(our.bowl entity.resource) diff --git a/tests/sys/hoon/map.hoon b/tests/sys/hoon/map.hoon index 5957e458cf..88aabcc9ea 100644 --- a/tests/sys/hoon/map.hoon +++ b/tests/sys/hoon/map.hoon @@ -594,12 +594,12 @@ :: %+ expect-eq !> ~ - !> (~(rut by m-nul) add) + !> (~(urn by m-nul) add) :: Checks success :: %+ expect-eq !> (my ~[[1 3] [2 6] [3 9] [4 12] [5 15] [6 18] [7 21]]) - !> (~(rut by m-asc) add) + !> (~(urn by m-asc) add) == :: :: Test listify pairs From f1c1205fe2e6351392d1a865de15c920c88cfd47 Mon Sep 17 00:00:00 2001 From: Tinnus Napbus Date: Thu, 27 Jul 2023 18:01:30 +1200 Subject: [PATCH 036/252] kiln: let publishers tell subs to switch source This adds a %kiln-change-source poke that changes the sync source for all syncs from the given remote ship/desk to a new ship/source. This poke works remotely iff it comes from the publisher, allowing publishers to migrate app distribution. A %kiln-change-publisher poke is also added to kiln which sends this out to all desk subscribers with the let+1 %w %sing that %kiln uses. --- pkg/arvo/lib/hood/kiln.hoon | 52 +++++++++++++++++++++++++++- pkg/arvo/mar/kiln/change-source.hoon | 16 +++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 pkg/arvo/mar/kiln/change-source.hoon diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index 6418acb415..82649c42f4 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -285,7 +285,6 @@ +$ kiln-fuse-list (unit desk) -- |= [bowl:gall state] -?> =(src our) =| moz=(list card:agent:gall) |% ++ kiln . @@ -528,6 +527,7 @@ :: ++ poke |= [=mark =vase] + ?> |(=(src our) =(%kiln-change-source mark)) ?+ mark ~|([%poke-kiln-bad-mark mark] !!) %kiln-autocommit =;(f (f !<(_+<.f vase)) poke-autocommit) %kiln-bump =;(f (f !<(_+<.f vase)) poke-bump) @@ -543,6 +543,8 @@ %kiln-label =;(f (f !<(_+<.f vase)) poke-label) %kiln-merge =;(f (f !<(_+<.f vase)) poke-merge) %kiln-mount =;(f (f !<(_+<.f vase)) poke-mount) + %kiln-change-source =;(f (f !<(_+<.f vase)) poke-change-source) + %kiln-change-publisher =;(f (f !<(_+<.f vase)) poke-change-publisher) %kiln-nuke =;(f (f !<(_+<.f vase)) poke-nuke) %kiln-pause =;(f (f !<(_+<.f vase)) poke-pause) %kiln-permission =;(f (f !<(_+<.f vase)) poke-permission) @@ -731,6 +733,52 @@ abet:(spam leaf+- ~) abet:(emit %pass /mount %arvo %c [%mont pot u.bem]) :: +++ poke-change-publisher + |= [syd=desk her=ship sud=desk] + ?: =([our syd] [her sud]) + abet + =/ let=@ud ud:.^(cass:clay %cw /(scot %p our)/[syd]/(scot %da now)) + =/ subs=(set [@p rave:clay]) + .^((set [@p rave:clay]) %cx /(scot %p our)//(scot %da now)/cult/[syd]) + =/ ships=(set @p) + %+ roll ~(tap in subs) + |= [[=ship =rave:clay] ships=(set @p)] + ?: =(our ship) ships + ?. ?=([%sing %w [%ud @] ~] rave) ships + ?. =(+(let) p.case.mood.rave) ships + (~(put in ships) ship) + =< abet + %- emil + %+ turn ~(tap in ships) + |= =ship + :* %pass /kiln/change-publisher %agent [ship %hood] + %poke %kiln-change-source !>([[our syd] [her sud]]) + == +:: +++ poke-change-source + |= [old=dock new=dock] + ?> |(=(src p.old) =(src our)) + ?: =(old new) abet + =/ old-sources=(list kiln-sync) + (skim ~(tap by sources) |=(kiln-sync =(old [her sud]))) + =/ new-sources=(list kiln-sync) + (turn old-sources |=(kiln-sync [syd new])) + =. zyn + |- + ?~ old-sources zyn + $(old-sources t.old-sources, zyn (~(del by zyn) i.old-sources)) + =< abet + |- ^+ ..abet + ?~ new-sources ..abet + %= $ + new-sources t.new-sources + ..abet =/ sun (sync i.new-sources) + =< abet:init + ?: =(%base syd.i.new-sources) + (apex:sun `%kids) + sun + == +:: ++ poke-nuke |= [=term desk=?] =< abet @@ -865,6 +913,8 @@ ~? ?=(^ p.sign) [%kiln-poke-nack u.p.sign] abet ~|([%kiln-bad-take-agent wire -.sign] !!) + :: + [%change-publisher ~] abet :: [%fancy *] ?> ?=(%poke-ack -.sign) diff --git a/pkg/arvo/mar/kiln/change-source.hoon b/pkg/arvo/mar/kiln/change-source.hoon new file mode 100644 index 0000000000..e8fda84477 --- /dev/null +++ b/pkg/arvo/mar/kiln/change-source.hoon @@ -0,0 +1,16 @@ +:: +:::: /hoon/change-source/kiln/mar + :: +/? 310 +|_ req=[old=dock new=dock] +:: +++ grow + |% + ++ noun req + -- +++ grab + |% + ++ noun ,[dock dock] + -- +++ grad %noun +-- From c4b612dac50cf13d68dea9912c47f8b8f3fd9ca3 Mon Sep 17 00:00:00 2001 From: Tinnus Napbus Date: Fri, 28 Jul 2023 23:43:17 +1200 Subject: [PATCH 037/252] gen/hood: add +change-publisher generator --- pkg/arvo/gen/hood/change-publisher.hoon | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 pkg/arvo/gen/hood/change-publisher.hoon diff --git a/pkg/arvo/gen/hood/change-publisher.hoon b/pkg/arvo/gen/hood/change-publisher.hoon new file mode 100644 index 0000000000..729733f6db --- /dev/null +++ b/pkg/arvo/gen/hood/change-publisher.hoon @@ -0,0 +1,23 @@ +/+ *generators +:- %ask +|= $: [now=@da eny=@uvJ bec=beak] + [syd=desk her=ship sud=desk ~] + hard=_| + == +?: hard (produce %kiln-change-publisher syd her sud) +=/ m1 + 'This will tell desk subscribers to switch update source.' +=/ m2 + 'If you enter the wrong ship/desk, you will not be \ + /able to correct it.' +=/ m3 + leaf+"Are you sure you want to tell subscribers to get ". + "updates for {} from {}/{(trip sud)}?" +%+ print m3 +%+ print m2 +%+ print m1 +%+ prompt [%& %prompt "(y/N) "] +|= in=tape +?. |(=("y" in) =("Y" in) =("yes" in)) + no-product +(produce %kiln-change-publisher syd her sud) From 4440eaced6573ab2af6bf094c74ecb3765b034d6 Mon Sep 17 00:00:00 2001 From: Tinnus Napbus Date: Mon, 7 Aug 2023 21:24:52 +1200 Subject: [PATCH 038/252] kiln: make publisher change requests require approval --- pkg/arvo/app/hood.hoon | 5 +- pkg/arvo/gen/hood/jump/approve.hoon | 6 ++ .../propose.hoon} | 15 +--- pkg/arvo/gen/hood/jump/reject.hoon | 6 ++ pkg/arvo/gen/jumps.hoon | 16 ++++ pkg/arvo/lib/hood/kiln.hoon | 79 ++++++++++++++++--- .../{change-source.hoon => jump-ask.hoon} | 2 +- pkg/arvo/mar/kiln/jump-opt.hoon | 22 ++++++ pkg/arvo/mar/kiln/jump.hoon | 43 ++++++++++ pkg/base-dev/sur/hood.hoon | 9 ++- 10 files changed, 176 insertions(+), 27 deletions(-) create mode 100644 pkg/arvo/gen/hood/jump/approve.hoon rename pkg/arvo/gen/hood/{change-publisher.hoon => jump/propose.hoon} (52%) create mode 100644 pkg/arvo/gen/hood/jump/reject.hoon create mode 100644 pkg/arvo/gen/jumps.hoon rename pkg/arvo/mar/kiln/{change-source.hoon => jump-ask.hoon} (80%) create mode 100644 pkg/arvo/mar/kiln/jump-opt.hoon create mode 100644 pkg/arvo/mar/kiln/jump.hoon diff --git a/pkg/arvo/app/hood.hoon b/pkg/arvo/app/hood.hoon index 91b2ec4b82..57727514ca 100644 --- a/pkg/arvo/app/hood.hoon +++ b/pkg/arvo/app/hood.hoon @@ -2,8 +2,8 @@ /+ drum=hood-drum, helm=hood-helm, kiln=hood-kiln |% +$ state - $~ [%26 *state:drum *state:helm *state:kiln] - $>(%26 any-state) + $~ [%27 *state:drum *state:helm *state:kiln] + $>(%27 any-state) :: +$ any-state $% [ver=?(%1 %2 %3 %4 %5 %6) lac=(map @tas fin-any-state)] @@ -27,6 +27,7 @@ [%24 drum=state-4:drum helm=state-2:helm kiln=state-10:kiln] [%25 drum=state-5:drum helm=state-2:helm kiln=state-10:kiln] [%26 drum=state-6:drum helm=state-2:helm kiln=state-10:kiln] + [%27 drum=state-6:drum helm=state-2:helm kiln=state-11:kiln] == +$ any-state-tuple $: drum=any-state:drum diff --git a/pkg/arvo/gen/hood/jump/approve.hoon b/pkg/arvo/gen/hood/jump/approve.hoon new file mode 100644 index 0000000000..ce3a3b0182 --- /dev/null +++ b/pkg/arvo/gen/hood/jump/approve.hoon @@ -0,0 +1,6 @@ +:- %say +|= $: [now=@da eny=@uvJ bec=beak] + [old=dock new=dock ~] + ~ + == +kiln-jump-opt+[old new &] diff --git a/pkg/arvo/gen/hood/change-publisher.hoon b/pkg/arvo/gen/hood/jump/propose.hoon similarity index 52% rename from pkg/arvo/gen/hood/change-publisher.hoon rename to pkg/arvo/gen/hood/jump/propose.hoon index 729733f6db..75ba21a2db 100644 --- a/pkg/arvo/gen/hood/change-publisher.hoon +++ b/pkg/arvo/gen/hood/jump/propose.hoon @@ -4,20 +4,13 @@ [syd=desk her=ship sud=desk ~] hard=_| == -?: hard (produce %kiln-change-publisher syd her sud) -=/ m1 - 'This will tell desk subscribers to switch update source.' -=/ m2 - 'If you enter the wrong ship/desk, you will not be \ - /able to correct it.' -=/ m3 +?: hard (produce %kiln-jump-propose syd her sud) +=/ msg leaf+"Are you sure you want to tell subscribers to get ". "updates for {} from {}/{(trip sud)}?" -%+ print m3 -%+ print m2 -%+ print m1 +%+ print msg %+ prompt [%& %prompt "(y/N) "] |= in=tape ?. |(=("y" in) =("Y" in) =("yes" in)) no-product -(produce %kiln-change-publisher syd her sud) +(produce %kiln-jump-propose syd her sud) diff --git a/pkg/arvo/gen/hood/jump/reject.hoon b/pkg/arvo/gen/hood/jump/reject.hoon new file mode 100644 index 0000000000..b1a885c5f4 --- /dev/null +++ b/pkg/arvo/gen/hood/jump/reject.hoon @@ -0,0 +1,6 @@ +:- %say +|= $: [now=@da eny=@uvJ bec=beak] + [old=dock new=dock ~] + ~ + == +kiln-jump-opt+[old new |] diff --git a/pkg/arvo/gen/jumps.hoon b/pkg/arvo/gen/jumps.hoon new file mode 100644 index 0000000000..78c7ac5aad --- /dev/null +++ b/pkg/arvo/gen/jumps.hoon @@ -0,0 +1,16 @@ +/- h=hood +:- %say +|= [[now=@da eny=@uvJ bec=beak] ~ ~] +:- %tang +^- tang +=+ .^ hop=jump:h + %gx + (scot %p p.bec) + %hood + (scot %da now) + /kiln/jumps/noun + == +?> ?=(%all -.hop) +%+ turn ~(tap by all.hop) +|= [old=dock new=dock] +leaf+"{}/{(trip q.old)} -> {}/{(trip q.new)}" diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index 82649c42f4..d1d7a7f13b 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -5,7 +5,8 @@ =, format =* dude dude:gall |% -+$ state state-10 ++$ state state-11 ++$ state-11 [%11 pith-11] +$ state-10 [%10 pith-10] +$ state-9 [%9 pith-9] +$ state-8 [%8 pith-9] @@ -19,7 +20,8 @@ +$ state-0 [%0 pith-0] +$ any-state $~ *state - $% state-10 + $% state-11 + state-10 state-9 state-8 state-7 @@ -32,6 +34,24 @@ state-0 == :: ++$ pith-11 + $: rem=(map desk per-desk) + nyz=@ud + zyn=(map kiln-sync sync-state) + :: requests from publishers to switch sync source + hop=(map dock dock) + commit-timer=[way=wire nex=@da tim=@dr mon=term] + :: map desk to the currently ongoing fuse request + :: and the latest version numbers for beaks to + fus=(map desk per-fuse) + :: used for fuses - every time we get a fuse we + :: bump this. used when calculating hashes to + :: ensure they're unique even when the same + :: request is made multiple times. + hxs=(map desk @ud) + == +:: +:: +$ pith-10 $: rem=(map desk per-desk) nyz=@ud @@ -482,7 +502,10 @@ $(ks t.ks) == :: - ?> ?=(%10 -.old) + =? old ?=(%10 -.old) + old(- %11, |4 [hop=~ |4.old]) + :: + ?> ?=(%11 -.old) =. state old abet:(emil cards-9) :: @@ -498,6 +521,7 @@ =/ ver (mergebase-hashes our %base now (~(got by sources) %base)) ``noun+!>(?~(ver 0v0 i.ver)) :: + [%x %kiln %jumps ~] ``kiln-jump+!>([%all hop]) [%x %kiln %syncs ~] ``noun+!>(zyn) [%x %kiln %sources ~] ``noun+!>(sources) [%x %kiln %pikes ~] @@ -527,7 +551,7 @@ :: ++ poke |= [=mark =vase] - ?> |(=(src our) =(%kiln-change-source mark)) + ?> |(=(src our) =(%kiln-jump-ask mark)) ?+ mark ~|([%poke-kiln-bad-mark mark] !!) %kiln-autocommit =;(f (f !<(_+<.f vase)) poke-autocommit) %kiln-bump =;(f (f !<(_+<.f vase)) poke-bump) @@ -543,8 +567,9 @@ %kiln-label =;(f (f !<(_+<.f vase)) poke-label) %kiln-merge =;(f (f !<(_+<.f vase)) poke-merge) %kiln-mount =;(f (f !<(_+<.f vase)) poke-mount) - %kiln-change-source =;(f (f !<(_+<.f vase)) poke-change-source) - %kiln-change-publisher =;(f (f !<(_+<.f vase)) poke-change-publisher) + %kiln-jump-ask =;(f (f !<(_+<.f vase)) poke-jump-ask) + %kiln-jump-opt =;(f (f !<(_+<.f vase)) poke-jump-opt) + %kiln-jump-propose =;(f (f !<(_+<.f vase)) poke-jump-propose) %kiln-nuke =;(f (f !<(_+<.f vase)) poke-nuke) %kiln-pause =;(f (f !<(_+<.f vase)) poke-pause) %kiln-permission =;(f (f !<(_+<.f vase)) poke-permission) @@ -733,7 +758,7 @@ abet:(spam leaf+- ~) abet:(emit %pass /mount %arvo %c [%mont pot u.bem]) :: -++ poke-change-publisher +++ poke-jump-propose |= [syd=desk her=ship sud=desk] ?: =([our syd] [her sud]) abet @@ -751,14 +776,40 @@ %- emil %+ turn ~(tap in ships) |= =ship - :* %pass /kiln/change-publisher %agent [ship %hood] - %poke %kiln-change-source !>([[our syd] [her sud]]) + :* %pass /kiln/jump-propose %agent [ship %hood] + %poke %kiln-jump-ask !>([[our syd] [her sud]]) == :: -++ poke-change-source +++ poke-jump-ask |= [old=dock new=dock] ?> |(=(src p.old) =(src our)) - ?: =(old new) abet + ?: =(old new) + ?~ had=(~(get by hop) old) + abet + =. hop (~(del by hop) old) + abet:(emit %give %fact ~[/jumps] %kiln-jump !>([%nay old u.had])) + ?~ (skim ~(tap by sources) |=(kiln-sync =(old [her sud]))) + ~> %slog.(fmt "no syncs from {}/{(trip q.old)}") + abet + =. hop (~(put by hop) old new) + abet:(emit %give %fact ~[/jumps] %kiln-jump !>([%add old new])) +:: +++ poke-jump-opt + |= [old=dock new=dock yea=?] + ?~ got=(~(get by hop) old) + ~> %slog.(fmt "no jump request for {}/{(trip q.old)}") + abet + ?. =(new u.got) + =/ txt-old "{}/{(trip q.old)}" + =/ txt-new "{}/{(trip q.new)}" + ~> %slog.(fmt "no jump request from {txt-old} to {txt-new}") + abet + ?. yea + =/ txt-old "{}/{(trip q.old)}" + =/ txt-new "{}/{(trip q.new)}" + ~> %slog.(fmt "denied jump from {txt-old} to {txt-new}") + =. hop (~(del by hop) old) + abet:(emit %give %fact ~[/jumps] %kiln-jump !>([%nay old new])) =/ old-sources=(list kiln-sync) (skim ~(tap by sources) |=(kiln-sync =(old [her sud]))) =/ new-sources=(list kiln-sync) @@ -767,6 +818,8 @@ |- ?~ old-sources zyn $(old-sources t.old-sources, zyn (~(del by zyn) i.old-sources)) + =. hop (~(del by hop) old) + =. ..abet (emit %give %fact ~[/jumps] %kiln-jump !>([%yea old new])) =< abet |- ^+ ..abet ?~ new-sources ..abet @@ -900,10 +953,12 @@ ++ peer |= =path ?> (team:title our src) - ?: =(0 1) abet :: avoid mint-vain ?+ path ~|(kiln-path/path !!) [%vats ~] (mean leaf+"kiln: old subscription to /kiln/vats failed" ~) + :: + [%jumps ~] + abet:(emit %give %fact ~ %kiln-jump !>([%all hop])) == :: ++ take-agent diff --git a/pkg/arvo/mar/kiln/change-source.hoon b/pkg/arvo/mar/kiln/jump-ask.hoon similarity index 80% rename from pkg/arvo/mar/kiln/change-source.hoon rename to pkg/arvo/mar/kiln/jump-ask.hoon index e8fda84477..0e6ce52be7 100644 --- a/pkg/arvo/mar/kiln/change-source.hoon +++ b/pkg/arvo/mar/kiln/jump-ask.hoon @@ -1,5 +1,5 @@ :: -:::: /hoon/change-source/kiln/mar +:::: /hoon/jump-ask/kiln/mar :: /? 310 |_ req=[old=dock new=dock] diff --git a/pkg/arvo/mar/kiln/jump-opt.hoon b/pkg/arvo/mar/kiln/jump-opt.hoon new file mode 100644 index 0000000000..f03d2d2b03 --- /dev/null +++ b/pkg/arvo/mar/kiln/jump-opt.hoon @@ -0,0 +1,22 @@ +:: +:::: /hoon/jump-opt/kiln/mar + :: +|_ req=[old=dock new=dock yea=?] +:: +++ grow + |% + ++ noun req + -- +++ grab + |% + ++ noun ,[dock dock ?] + ++ json + =, dejs:format + %- ot + :~ [%old (ot ship+(se %p) desk+so ~)] + [%new (ot ship+(se %p) desk+so ~)] + [%yea bo] + == + -- +++ grad %noun +-- diff --git a/pkg/arvo/mar/kiln/jump.hoon b/pkg/arvo/mar/kiln/jump.hoon new file mode 100644 index 0000000000..540f35a893 --- /dev/null +++ b/pkg/arvo/mar/kiln/jump.hoon @@ -0,0 +1,43 @@ +:: +:::: /hoon/jump/kiln/mar + :: +/- h=hood +|_ jum=jump:h +:: +++ grow + |% + ++ noun jum + ++ json + =, enjs:format + |^ ^- ^json + ?- -.jum + %add + %+ frond 'add' + (pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~) + :: + %yea + %+ frond 'yea' + (pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~) + :: + %nay + %+ frond 'nay' + (pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~) + :: + %all + %+ frond 'all' + :- %a + %+ turn ~(tap by all.jum) + |= [old=dock new=dock] + (pairs ['old' (en-dock old)] ['new' (en-dock new)] ~) + == + ++ en-dock + |= =dock + (pairs ['ship' s+(scot %p p.dock)] ['desk' s+q.dock] ~) + -- + -- +++ grab + |% + ++ noun jump:h + -- +++ grad %noun +-- diff --git a/pkg/base-dev/sur/hood.hoon b/pkg/base-dev/sur/hood.hoon index 5c736f2714..3c0430f990 100644 --- a/pkg/base-dev/sur/hood.hoon +++ b/pkg/base-dev/sur/hood.hoon @@ -10,7 +10,14 @@ == :: +$ pikes (map desk pike) -:: +:: $jump: changes to update source change requests +:: ++$ jump + $% [%all all=(map dock dock)] :: pending requests + [%add old=dock new=dock] :: new request + [%yea old=dock new=dock] :: approved + [%nay old=dock new=dock] :: denied + == :: $rung: reference to upstream commit :: +$ rung [=aeon =weft] From c90e80aaf1e51382f4cc83f0fd05ee7d60656636 Mon Sep 17 00:00:00 2001 From: Alex Shelkovnykov Date: Mon, 14 Aug 2023 15:34:39 -0400 Subject: [PATCH 039/252] hoon, lull: add pretty-printer type shadows --- pkg/arvo/sys/hoon.hoon | 6 +++++- pkg/arvo/sys/lull.hoon | 9 ++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index db93638941..b80cedf359 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -2043,6 +2043,7 @@ +$ tang (list tank) :: bottom-first error :: :: +$ iota :: typed path segment + $+ iota $~ [%n ~] $@ @tas $% [%ub @ub] [%uc @uc] [%ud @ud] [%ui @ui] @@ -2067,6 +2068,7 @@ :: flat-mid, open, close :: +$ tank + $+ tank $~ leaf/~ $@ cord $% [%leaf p=tape] @@ -6381,6 +6383,7 @@ == -- :: +$ hoon :: hoon AST + $+ hoon $~ [%zpzp ~] :: $^ [p=hoon q=hoon] :: $% :: @@ -6534,7 +6537,8 @@ [%know p=stud] :: global standard [%made p=term q=(unit (list wing))] :: structure == :: -+$ type $~ %noun :: ++$ type $+ type + $~ %noun :: $@ $? %noun :: any nouns %void :: no noun == :: diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index 03d20921a6..4ab0990004 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -2598,6 +2598,7 @@ +$ boat (map [=wire =ship =term] [acked=? =path]) :: outgoing subs +$ boar (map [=wire =ship =term] nonce=@) :: and their nonces +$ bowl :: standard app state + $+ gall-agent-bowl :: $: $: our=ship :: host src=ship :: guest dap=term :: agent @@ -2641,8 +2642,11 @@ =< form |% +$ step (quip card form) - +$ card (wind note gift) + +$ card + $+ gall-agent-card + (wind note gift) +$ note + $+ gall-agent-note $% [%agent [=ship name=term] =task] [%arvo note-arvo] [%pyre =tang] @@ -2652,6 +2656,7 @@ [%cull =case =spur] == +$ task + $+ gall-agent-task $% [%watch =path] [%watch-as =mark =path] [%leave ~] @@ -2659,12 +2664,14 @@ [%poke-as =mark =cage] == +$ gift + $+ gall-agent-gift $% [%fact paths=(list path) =cage] [%kick paths=(list path) ship=(unit ship)] [%watch-ack p=(unit tang)] [%poke-ack p=(unit tang)] == +$ sign + $+ gall-agent-sign $% [%poke-ack p=(unit tang)] [%watch-ack p=(unit tang)] [%fact =cage] From 508c5bd53cba63e54175830c2238fe2154e933a4 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Thu, 10 Aug 2023 22:43:59 -0400 Subject: [PATCH 040/252] hoon: fix gol type enforcement for trivial %cnts --- pkg/arvo/sys/hoon.hoon | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index db93638941..d66dc06741 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -9238,21 +9238,21 @@ :: ++ mint |= gol=type + =- ?>(?|(!vet (nest(sut gol) & p.-)) -) ^- (pair type nock) =+ lug=(find %read hyp) ?: ?=(%| -.lug) ~>(%mean.'hoon' ?>(?=(~ rig) p.lug)) - =- ?>(?|(!vet (nest(sut gol) & p.-)) -) (ergo p.lug rig) :: ++ mull |= [gol=type dox=type] - ^- [type type] + =- ?>(?|(!vet (nest(sut gol) & p.-)) -) + ^- (pair type type) =+ lug=[p=(find %read hyp) q=(find(sut dox) %read hyp)] ?: ?=(%| -.p.lug) ?> &(?=(%| -.q.lug) ?=(~ rig)) [p.p.p.lug p.p.q.lug] ?> ?=(%& -.q.lug) - =- ?>(?|(!vet (nest(sut gol) & p.-)) -) (endo [p.p.lug p.q.lug] dox rig) -- :: From 7f91bcdca63cf335674d0a52d14bf9111fcbd594 Mon Sep 17 00:00:00 2001 From: Matthew LeVan Date: Tue, 22 Aug 2023 15:31:58 -0400 Subject: [PATCH 041/252] ames: persistently cache `++jim` and remove `++dedup-message` --- pkg/arvo/sys/vane/ames.hoon | 36 ++---------------------------------- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index aa80b20211..11b545a914 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -172,7 +172,7 @@ (cue (rep packet-size (flop sorted))) :: +jim: caching +jam :: -++ jim |=(n=* ~+((jam n))) +++ jim |=(n=* ~>(%memo./ames/jam (jam n))) ++ spit |= =path ^- [pat=@t wid=@ud] @@ -3185,7 +3185,7 @@ ~> %slog.0^leaf/"ames: ignoring message on corked bone {}" peer-core :: - =/ =message-blob (dedup-message (jim payload)) + =/ =message-blob (jim payload) =. peer-core abet:(call:(abed:mu bone) %memo message-blob) :: ?: ?& =(%boon valence) @@ -3307,38 +3307,6 @@ recork-one :: +| %implementation - :: +dedup-message: replace with any existing copy of this message - :: - ++ dedup-message - |= =message-blob - ^+ message-blob - ?: (lte (met 13 message-blob) 1) - message-blob - =/ peers-l=(list [=ship =ship-state]) ~(tap by peers.ames-state) - |- ^+ message-blob - =* peer-loop $ - ?~ peers-l - message-blob - ?. ?=(%known -.ship-state.i.peers-l) - peer-loop(peers-l t.peers-l) - =/ snd-l=(list [=bone =message-pump-state]) - ~(tap by snd.ship-state.i.peers-l) - |- ^+ message-blob - =* bone-loop $ - ?~ snd-l peer-loop(peers-l t.peers-l) - =* unsent-fragments unsent-fragments.message-pump-state.i.snd-l - =/ blob-l=(list ^message-blob) - ~(tap to unsent-messages.message-pump-state.i.snd-l) - |- ^+ message-blob - =* blob-loop $ - ?^ blob-l - ?: =(i.blob-l message-blob) - i.blob-l - blob-loop(blob-l t.blob-l) - ?~ unsent-fragments bone-loop(snd-l t.snd-l) - ?: =(message-blob fragment.i.unsent-fragments) - `@`fragment.i.unsent-fragments - bone-loop(snd-l t.snd-l) :: +check-clog: notify clients if peer has stopped responding :: ++ check-clog From 355985fb0e97124d51912b53015272d205e37f48 Mon Sep 17 00:00:00 2001 From: Matthew LeVan Date: Wed, 23 Aug 2023 11:32:14 -0400 Subject: [PATCH 042/252] arvo: persistently cache scry type checks --- pkg/arvo/sys/arvo.hoon | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index da000eba1b..2a73de5afd 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -352,7 +352,9 @@ ?~ dat=(rof lyc pov u.mon) ~ ?~ u.dat [~ ~] =* vax q.u.u.dat - ?. ?& ?=(^ ref) + ?. => [ref=ref vax=p=p.vax hoon-version=hoon-version wa=wa worm=worm] + ~> %memo./arvo/look :: with memoization + ?& ?=(^ ref) =(hoon-version -.ref) -:(~(nets wa *worm) +.ref p.vax) == From c8379b245ac484e96765f6b5ff593b37311e1294 Mon Sep 17 00:00:00 2001 From: pkova Date: Wed, 23 Aug 2023 21:22:50 +0300 Subject: [PATCH 043/252] zuse: decrement kelvin from 412 to 411 --- pkg/arvo/sys/zuse.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 8eb35862eb..1c3c194e39 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -4,7 +4,7 @@ => ..lull ~% %zuse ..part ~ |% -++ zuse %412 +++ zuse %411 :: :: :: :::: :: :: (2) engines :: :: :: From 9d2f40d6544dd75d64ed806196874e836e4ccebe Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 23 Aug 2023 16:39:28 -0400 Subject: [PATCH 044/252] sys.kelvin: zuse 411 --- pkg/arvo/sys.kelvin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys.kelvin b/pkg/arvo/sys.kelvin index 5d8a35da3e..14d80f11f3 100644 --- a/pkg/arvo/sys.kelvin +++ b/pkg/arvo/sys.kelvin @@ -1 +1 @@ -[%zuse 412] +[%zuse 411] From 0c6f3030f3f857932930eeeeaf53c2f2fa1323a9 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 1 Sep 2023 11:17:35 -0400 Subject: [PATCH 045/252] lull,ames: emit %saxo gift on %born --- pkg/arvo/sys/lull.hoon | 2 ++ pkg/arvo/sys/vane/ames.hoon | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index 158d432f97..c1d41f24e3 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -834,6 +834,7 @@ :: System and Lifecycle Gifts :: :: %turf: domain report, relayed from jael + :: %saxo: our sponsor list report :: +$ gift $% [%boon payload=*] @@ -845,6 +846,7 @@ [%tune spar roar=(unit roar)] :: [%turf turfs=(list turf)] + [%saxo sponsors=(list ship)] == :: :::: :: (1a2) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index aa80b20211..c7578d4dda 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -2845,11 +2845,17 @@ :- flow/`[~[/ames] /dead-flow `@da`(add now ~m2)] cork/`[~[/ames] /recork `@da`(add now ~d1)] :: + =/ sponsors + ;; (list ship) + =< q.q %- need %- need + (rof ~ /ames %j /(scot %p our)/saxo/(scot %da now)/(scot %p our)) + :: %- emil %+ weld dead-moves ^- (list move) :~ [duct %give %turf turfs] + [duct %give %saxo sponsors] [duct %pass /ping %g %deal [our our /ames] %ping %poke %noun !>(%kick)] == :: +on-vega: handle kernel reload From f077e48112034da74fc7db52c0e290a2d994d3cd Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 1 Sep 2023 11:28:31 -0400 Subject: [PATCH 046/252] ames: fix saxo scry; emit on sponsor change too --- pkg/arvo/sys/vane/ames.hoon | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index c7578d4dda..271ba4b796 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -1856,6 +1856,11 @@ *peer-state +.u.ship-state :: + ++ get-sponsors + ;; (list ship) + =< q.q %- need %- need + (rof ~ /ames %j `beam`[[our %saxo %da now] /(scot %p our)]) + :: +| %tasks :: +on-take-flub: vane not ready to process message, pretend it :: was never delivered @@ -2677,7 +2682,7 @@ ^+ event-core :: ?: =(our ship) - event-core + (emit unix-duct.ames-state %give %saxo get-sponsors) :: ?~ sponsor %- (slog leaf+"ames: {(scow %p ship)} lost sponsor, ignoring" ~) @@ -2704,6 +2709,7 @@ :: ?: =(our ship) =. rift.ames-state rift.point + =. event-core (emit unix-duct.ames-state %give %saxo get-sponsors) $(points t.points) :: ?. (~(has by keys.point) life.point) @@ -2845,17 +2851,12 @@ :- flow/`[~[/ames] /dead-flow `@da`(add now ~m2)] cork/`[~[/ames] /recork `@da`(add now ~d1)] :: - =/ sponsors - ;; (list ship) - =< q.q %- need %- need - (rof ~ /ames %j /(scot %p our)/saxo/(scot %da now)/(scot %p our)) - :: %- emil %+ weld dead-moves ^- (list move) :~ [duct %give %turf turfs] - [duct %give %saxo sponsors] + [duct %give %saxo get-sponsors] [duct %pass /ping %g %deal [our our /ames] %ping %poke %noun !>(%kick)] == :: +on-vega: handle kernel reload From 58f2d427ce76f461732f53b0810afdedddd9b7e7 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Thu, 14 Sep 2023 04:22:45 +0100 Subject: [PATCH 047/252] gall: security primitives for encrypted scry This commit adds `%tend` `%germ` and `%snip` to the notes that gall can pass. `%tend` is analogous to `%grow`, except with a security group defined by .coop. ### The coop system A `$coop` is a path, which defines a security context for the portion of the namespace that it prefixes. Each `$coop` receives a symmetric key, which is used to encrypt requests and responses for any key-value pair belonging to a coop. ### Network overview This design requires a single handshake over ames to inform clients what key is to be used. However, this handshake can be made less frequent by including all paths underneath the `%coop` in the response, such that if the user is requesting sibling paths under the same `%coop`, only one handshake is required. ### Naming I am utterly detached to all new names introduced, just trying to get something down ### API Design The most contentious part of this proposal will likely be the split between `%grow` and `%tend`. I assert (rather weakly mind you) that this is more ergonomic for the end user, although there's a strong argument to be made that `%grow` should just take a `(unit coop)`. If this were the case, however, it would muddy the semantics. If the value is encrypted, then the ship,desk,case will be in the coop, else it will be specified in the path. Worth noting that specifying the `%coop` and the rest of the path seperately seems like it could be unintuitive because the path that it will be bound to is actually `(welp coop path)` The lifecycles for coops seem straightforward, although worth revisiting the invariants it maintains, and how it handles those invariants. A list of such: - No nesting (obviously good) - Crashing on binding publically into a private coop (crashing is bad, do we want to deliver a notification? (See footnote 1)) - Crashing on binding into a coop that doesn't exist (same notes as above) ### Key generation Current implementation is obviously stupid, how should i do it? ### Footnotes 1. Why are the remote scry datastructures notes and not gifts? Forgive me being out of the loop, but we don't actually use the wire for anything anywhere, and remote scry is giving gift anyway. 2. It's so good to be back --- pkg/arvo/sys/lull.hoon | 5 ++ pkg/arvo/sys/vane/gall.hoon | 105 ++++++++++++++++++++++++++++++++---- 2 files changed, 100 insertions(+), 10 deletions(-) diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index 158d432f97..62d103276e 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -2763,6 +2763,7 @@ :: TODO: add more flags? :: +$ verb ?(%odd) + +$ coop spur :: :: +agent: app core :: @@ -2779,6 +2780,10 @@ [%grow =spur =page] [%tomb =case =spur] [%cull =case =spur] + :: + [%tend =coop =path =page] + [%germ =coop =crew:clay] + [%snip =coop] == +$ task $% [%watch =path] diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 5ec8d6cfdc..bd131d421a 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -42,9 +42,9 @@ :: $move: Arvo-level move :: +$ move [=duct move=(wind note-arvo gift-arvo)] -:: $state-13: overall gall state, versioned +:: $state-15: overall gall state, versioned :: -+$ state-14 [%14 state] ++$ state-15 [%15 state] :: $state: overall gall state :: :: system-duct: TODO document @@ -68,6 +68,9 @@ $: disclosing=(unit (set ship)) attributing=[=ship =path] == ++$ lock [rev=@ud key=@uvJ] :: TODO: key width? ++$ hutch + [=lock =crew:clay chicks=(map path page)] :: $yoke: agent runner state :: :: control-duct: TODO document @@ -100,6 +103,7 @@ marks=(map duct mark) sky=(map spur path-state) ken=(jug spar:ames wire) + cop=(map coop hutch) == == :: +$ path-state @@ -162,7 +166,7 @@ :: $spore: structures for update, produced by +stay :: +$ spore - $: %14 + $: %15 system-duct=duct outstanding=(map [wire duct] (qeu remote-request)) contacts=(set ship) @@ -188,11 +192,12 @@ marks=(map duct mark) sky=(map spur path-state) ken=(jug spar:ames wire) + cop=(map coop hutch) == == -- :: adult gall vane interface, for type compatibility with pupa :: -=| state=state-14 +=| state=state-15 |= [now=@da eny=@uvJ rof=roof] =* gall-payload . ~% %gall-top ..part ~ @@ -1011,11 +1016,46 @@ == =^ maybe-tang ap-core (ap-ingest ~ |.([will *agent])) ap-core + ++ ap-match-coop + |= =path + ?: (~(has by cop.yoke) path) + & + ?: =(~ path) + | + =. path (flop path) + ?> ?=(^ path) + $(path (flop t.path)) + :: + :: +ap-tend: bind path in namespace, encrypted + ++ ap-tend + |= [=coop =path =page] + ?. (~(has by cop.yoke) coop) + ~| no-such-coop/coop !! :: XX: error handling + =/ =hutch (~(got by cop.yoke) coop) + =. chicks.hutch (~(put by chicks.hutch) path page) + =. cop.yoke (~(put by cop.yoke) coop hutch) + ap-core + ++ ap-germ + |= [=coop =crew:clay] + =/ key=@uvJ (shax eny) :: TODO: review key generation + =/ =hutch + ?~ hut=(~(get by cop.yoke) coop) + [[1 (shax eny)] crew ~] + =. lock.u.hut [.+(rev.lock.u.hut) (shax eny)] + =. crew.u.hut crew + u.hut + =. cop.yoke (~(put by cop.yoke) coop hutch) + ap-core + :: + ++ ap-snip + |= =coop + ap-core(cop.yoke (~(del by cop.yoke) coop)) :: TODO: assert existence? :: +ap-grow: bind a path in the agent's scry namespace :: ++ ap-grow |= [=spur =page] ^+ ap-core + ?< (ap-match-coop spur) :: enforce binding public seperately =- ap-core(sky.yoke -) %+ ~(put by sky.yoke) spur =/ ski (~(gut by sky.yoke) spur *path-state) @@ -1078,7 +1118,7 @@ :: +$ carp $+ carp (wind neet gift:agent) +$ neet $+ neet - $< ?(%grow %tomb %cull) + $< ?(%grow %tomb %cull %tend %germ %snip) $% note:agent [%agent [=ship name=term] task=[%raw-poke =mark =noun]] [%huck [=ship name=term] =note-arvo] @@ -1790,6 +1830,9 @@ [%pass * %grow *] $(caz t.caz, ap-core (ap-grow +.q.i.caz)) [%pass * %tomb *] $(caz t.caz, ap-core (ap-tomb +.q.i.caz)) [%pass * %cull *] $(caz t.caz, ap-core (ap-cull +.q.i.caz)) + [%pass * %tend *] $(caz t.caz, ap-core (ap-tend +.q.i.caz)) + [%pass * %germ *] $(caz t.caz, ap-core (ap-germ +.q.i.caz)) + [%pass * %snip *] $(caz t.caz, ap-core (ap-snip +.q.i.caz)) [%pass * ?(%agent %arvo %pyre) *] $(caz t.caz, fex [i.caz fex]) [%give *] $(caz t.caz, fex [i.caz fex]) [%slip *] !! @@ -1962,17 +2005,45 @@ =? old ?=(%11 -.old) (spore-11-to-12 old) =? old ?=(%12 -.old) (spore-12-to-13 old) =? old ?=(%13 -.old) (spore-13-to-14 old) - ?> ?=(%14 -.old) + =? old ?=(%14 -.old) (spore-14-to-15 old) + ?> ?=(%15 -.old) gall-payload(state old) :: +$ spore-any - $%(spore spore-7 spore-8 spore-9 spore-10 spore-11 spore-12 spore-13) + $%(spore spore-7 spore-8 spore-9 spore-10 spore-11 spore-12 spore-13 spore-14) + +$ spore-14 + $: %14 + system-duct=duct + outstanding=(map [wire duct] (qeu remote-request)) + contacts=(set ship) + eggs=(map term egg-13) + blocked=(map term (qeu blocked-move)) + =bug + == + +$ egg-13 + $% [%nuke sky=(map spur @ud)] + $: %live + control-duct=duct + run-nonce=@t + sub-nonce=@ + =stats + =bitt + =boat + =boar + code=~ + old-state=[%| vase] + =beak + marks=(map duct mark) + sky=(map spur path-state) + ken=(jug spar:ames wire) + == == + :: +$ spore-13 $: %13 system-duct=duct outstanding=(map [wire duct] (qeu remote-request)) contacts=(set ship) - eggs=(map term egg) + eggs=(map term egg-13) blocked=(map term (qeu blocked-move-13)) =bug == @@ -2177,15 +2248,29 @@ eggs %- ~(urn by eggs.old) |= [a=term e=egg-12] - ^- egg + ^- egg-13 ?: ?=(%nuke -.e) e e(sky [sky.e ken:*$>(%live egg)]) == :: added provenance path to routes + ++ spore-14-to-15 + |= old=spore-14 + ^- spore + %= old + - %15 + :: + eggs + %- ~(run by eggs.old) + |= egg=egg-13 + ?: ?=(%nuke -.egg) + egg + egg(ken [ken.egg ~]) + == + :: ++ spore-13-to-14 |= old=spore-13 - ^- spore + ^- spore-14 %= old - %14 blocked From b59525a203c24194aa2e7dd23e337c1abe58486d Mon Sep 17 00:00:00 2001 From: Tinnus Napbus Date: Fri, 8 Sep 2023 03:13:47 +1200 Subject: [PATCH 048/252] kiln: OTA merge control - let users disable automatic OTA merging for a sync or globally - a sync can be set to manual, automatic or global default - unapproved non-auto updates must be approved by the user --- pkg/arvo/gen/hood/approve-merge.hoon | 6 + pkg/arvo/gen/hood/global-automerge.hoon | 6 + pkg/arvo/gen/hood/sync-automerge.hoon | 6 + pkg/arvo/gen/updates.hoon | 16 ++ pkg/arvo/lib/hood/kiln.hoon | 221 +++++++++++++++++------ pkg/arvo/mar/kiln/approve-merge.hoon | 1 + pkg/arvo/mar/kiln/jump-ask.hoon | 17 +- pkg/arvo/mar/kiln/jump-opt.hoon | 23 +-- pkg/arvo/mar/kiln/jump.hoon | 44 +---- pkg/arvo/mar/kiln/sync-update.hoon | 1 + pkg/base-dev/mar/kiln/approve-merge.hoon | 22 +++ pkg/base-dev/mar/kiln/jump-ask.hoon | 16 ++ pkg/base-dev/mar/kiln/jump-opt.hoon | 22 +++ pkg/base-dev/mar/kiln/jump.hoon | 43 +++++ pkg/base-dev/mar/kiln/sync-update.hoon | 50 +++++ pkg/base-dev/sur/hood.hoon | 28 ++- 16 files changed, 381 insertions(+), 141 deletions(-) create mode 100644 pkg/arvo/gen/hood/approve-merge.hoon create mode 100644 pkg/arvo/gen/hood/global-automerge.hoon create mode 100644 pkg/arvo/gen/hood/sync-automerge.hoon create mode 100644 pkg/arvo/gen/updates.hoon create mode 120000 pkg/arvo/mar/kiln/approve-merge.hoon mode change 100644 => 120000 pkg/arvo/mar/kiln/jump-ask.hoon mode change 100644 => 120000 pkg/arvo/mar/kiln/jump-opt.hoon mode change 100644 => 120000 pkg/arvo/mar/kiln/jump.hoon create mode 120000 pkg/arvo/mar/kiln/sync-update.hoon create mode 100644 pkg/base-dev/mar/kiln/approve-merge.hoon create mode 100644 pkg/base-dev/mar/kiln/jump-ask.hoon create mode 100644 pkg/base-dev/mar/kiln/jump-opt.hoon create mode 100644 pkg/base-dev/mar/kiln/jump.hoon create mode 100644 pkg/base-dev/mar/kiln/sync-update.hoon diff --git a/pkg/arvo/gen/hood/approve-merge.hoon b/pkg/arvo/gen/hood/approve-merge.hoon new file mode 100644 index 0000000000..58a49cc5a2 --- /dev/null +++ b/pkg/arvo/gen/hood/approve-merge.hoon @@ -0,0 +1,6 @@ +:- %say +|= $: [now=@da eny=@uvJ bec=beak] + [syd=desk her=ship sud=desk approve=? ~] + ~ + == +kiln-approve-merge+[[syd her sud] approve] diff --git a/pkg/arvo/gen/hood/global-automerge.hoon b/pkg/arvo/gen/hood/global-automerge.hoon new file mode 100644 index 0000000000..d8992f54e2 --- /dev/null +++ b/pkg/arvo/gen/hood/global-automerge.hoon @@ -0,0 +1,6 @@ +:- %say +|= $: [now=@da eny=@uvJ bec=beak] + [auto=? ~] + ~ + == +kiln-global-automerge+auto diff --git a/pkg/arvo/gen/hood/sync-automerge.hoon b/pkg/arvo/gen/hood/sync-automerge.hoon new file mode 100644 index 0000000000..7daf36fcab --- /dev/null +++ b/pkg/arvo/gen/hood/sync-automerge.hoon @@ -0,0 +1,6 @@ +:- %say +|= $: [now=@da eny=@uvJ bec=beak] + [syd=desk her=ship sud=desk auto=(unit ?) ~] + ~ + == +kiln-sync-automerge+[[syd her sud] auto] diff --git a/pkg/arvo/gen/updates.hoon b/pkg/arvo/gen/updates.hoon new file mode 100644 index 0000000000..94bbe88c51 --- /dev/null +++ b/pkg/arvo/gen/updates.hoon @@ -0,0 +1,16 @@ +/- h=hood +:- %say +|= [[now=@da eny=@uvJ bec=beak] ~ ~] +:- %tang +^- tang +=+ .^ upd=sync-update:h + %gx + (scot %p p.bec) + %hood + (scot %da now) + /kiln/pending/noun + == +?> ?=(%pending -.upd) +%+ turn ~(tap in pending.upd) +|= [sync-record:h rev=@ud] +leaf+"{} <- {}/{(trip sud)}/{}" diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index a55c580ef6..28fcbda692 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -37,9 +37,12 @@ +$ pith-11 $: rem=(map desk per-desk) nyz=@ud - zyn=(map kiln-sync sync-state) + zyn=(map sync-record sync-state) :: requests from publishers to switch sync source hop=(map dock dock) + :: toggle global update auto-merge + mer=? + :: commit-timer=[way=wire nex=@da tim=@dr mon=term] :: map desk to the currently ongoing fuse request :: and the latest version numbers for beaks to @@ -51,11 +54,12 @@ hxs=(map desk @ud) == :: ++$ sync-state-10 [nun=@ta kid=(unit desk) let=@ud] :: +$ pith-10 $: rem=(map desk per-desk) nyz=@ud - zyn=(map kiln-sync sync-state) + zyn=(map sync-record sync-state-10) commit-timer=[way=wire nex=@da tim=@dr mon=term] :: map desk to the currently ongoing fuse request :: and the latest version numbers for beaks to @@ -70,7 +74,7 @@ +$ pith-9 $: wef=(unit weft) rem=(map desk per-desk) - syn=(map kiln-sync let=@ud) + syn=(map sync-record let=@ud) ark=(map desk arak-9) commit-timer=[way=wire nex=@da tim=@dr mon=term] :: map desk to the currently ongoing fuse request @@ -98,7 +102,7 @@ +$ pith-7 $: wef=(unit weft) rem=(map desk per-desk) - syn=(map kiln-sync let=@ud) + syn=(map sync-record let=@ud) ark=(map desk arak-7) commit-timer=[way=wire nex=@da tim=@dr mon=term] :: map desk to the currently ongoing fuse request @@ -141,7 +145,7 @@ +$ pith-6 $: wef=(unit weft) rem=(map desk per-desk) :: - syn=(map kiln-sync let=@ud) :: + syn=(map sync-record let=@ud) :: ark=(map desk arak-6) :: commit-timer=[way=wire nex=@da tim=@dr mon=term] :: :: map desk to the currently ongoing fuse request @@ -159,7 +163,7 @@ :: +$ pith-5 $: rem=(map desk per-desk) :: - syn=(map kiln-sync let=@ud) :: + syn=(map sync-record let=@ud) :: ark=(map desk arak-6) :: commit-timer=[way=wire nex=@da tim=@dr mon=term] :: :: map desk to the currently ongoing fuse request @@ -174,7 +178,7 @@ :: +$ pith-4 :: $: rem=(map desk per-desk) :: - syn=(map kiln-sync let=@ud) :: + syn=(map sync-record let=@ud) :: ark=(map desk arak-4) :: commit-timer=[way=wire nex=@da tim=@dr mon=term] :: :: map desk to the currently ongoing fuse request @@ -195,7 +199,7 @@ == +$ pith-3 :: $: rem=(map desk per-desk) :: - syn=(map kiln-sync let=@ud) :: + syn=(map sync-record let=@ud) :: ark=(map desk arak-3) :: commit-timer=[way=wire nex=@da tim=@dr mon=term] :: :: map desk to the currently ongoing fuse request @@ -221,7 +225,7 @@ :: +$ pith-2 :: $: rem=(map desk per-desk) :: - syn=(map kiln-sync let=@ud) :: + syn=(map sync-record let=@ud) :: ota=(unit [=ship =desk =aeon]) :: commit-timer=[way=wire nex=@da tim=@dr mon=term] :: fus=(map desk per-fuse) @@ -229,13 +233,13 @@ == :: +$ pith-1 :: $: rem=(map desk per-desk) :: - syn=(map kiln-sync let=@ud) :: + syn=(map sync-record let=@ud) :: ota=(unit [=ship =desk =aeon]) :: commit-timer=[way=wire nex=@da tim=@dr mon=term] :: == :: +$ pith-0 :: $: rem=(map desk per-desk) :: - syn=(map kiln-sync let=@ud) :: + syn=(map sync-record let=@ud) :: autoload-on=? :: cur-hoon=@uvI :: cur-arvo=@uvI :: @@ -265,16 +269,6 @@ pot=term :: == +$ kiln-unmount $@(term [knot path]) :: -+$ kiln-sync :: - $: syd=desk :: local desk - her=ship :: foreign ship - sud=desk :: foreign desk - == -+$ kiln-unsync :: - $: syd=desk :: local desk - her=ship :: foreign ship - sud=desk :: foreign desk - == +$ kiln-merge :: $@ ~ $: syd=desk :: @@ -459,7 +453,7 @@ =^ cards-9=(list card:agent:gall) old ?. ?=(%9 -.old) `old - =/ syn=(set kiln-sync) + =/ syn=(set sync-record) %- ~(gas in ~(key by syn.old)) %+ murn ~(tap by ark.old) |= [=desk =arak-9] @@ -487,8 +481,8 @@ [%pass /kiln/load-zest %arvo %c %zest desk zest] :: %+ turn ~(tap in syn) - |= k=kiln-sync - [%pass /kiln/load-sync %agent [our %hood] %poke %kiln-sync !>(k)] + |= r=sync-record + [%pass /kiln/load-sync %agent [our %hood] %poke %kiln-sync !>(r)] :: =/ ks ~(tap in syn) |- ^- (list card:agent:gall) @@ -503,7 +497,14 @@ == :: =? old ?=(%10 -.old) - old(- %11, |4 [hop=~ |4.old]) + %= old + - %11 + |4 [hop=~ mer=& |4.old] + zyn %- ~(run by zyn.old) + |= sync-state-10 + ^- sync-state + [nun kid let ~ ~ |] + == :: ?> ?=(%11 -.old) =. state old @@ -521,9 +522,10 @@ =/ ver (mergebase-hashes our %base now (~(got by sources) %base)) ``noun+!>(?~(ver 0v0 i.ver)) :: - [%x %kiln %jumps ~] ``kiln-jump+!>([%all hop]) - [%x %kiln %syncs ~] ``noun+!>(zyn) - [%x %kiln %sources ~] ``noun+!>(sources) + [%x %kiln %jumps ~] ``kiln-jump+!>([%all hop]) + [%x %kiln %syncs ~] ``noun+!>(zyn) + [%x %kiln %sources ~] ``noun+!>(sources) + [%x %kiln %automerge ~] ``loob+!>(mer) [%x %kiln %pikes ~] =+ .^(=rock:tire %cx /(scot %p our)//(scot %da now)/tire) :^ ~ ~ %kiln-pikes @@ -534,6 +536,17 @@ =+ .^(hash=@uv %cz /(scot %p our)/[desk]/(scot %da now)) =/ sync (~(get by sources) desk) [sync hash zest wic] + :: + [%x %kiln %pending ~] + :^ ~ ~ %kiln-sync-update + !> ^- sync-update + :- %pending + %- ~(gas by *(set [sync-record @ud])) + ^- (list [sync-record @ud]) + %+ murn ~(tap by zyn) + |= [sync-record sync-state] + ?~ hav ~ + (some [syd her sud] u.hav) == :: :: +get-germ: select merge strategy into local desk @@ -553,11 +566,13 @@ |= [=mark =vase] ?> |(=(src our) =(%kiln-jump-ask mark)) ?+ mark ~|([%poke-kiln-bad-mark mark] !!) + %kiln-approve-merge =;(f (f !<(_+<.f vase)) poke-approve-merge) %kiln-autocommit =;(f (f !<(_+<.f vase)) poke-autocommit) %kiln-bump =;(f (f !<(_+<.f vase)) poke-bump) %kiln-cancel =;(f (f !<(_+<.f vase)) poke-cancel) %kiln-cancel-autocommit =;(f (f !<(_+<.f vase)) poke-cancel-autocommit) %kiln-commit =;(f (f !<(_+<.f vase)) poke-commit) + %kiln-sync-automerge =;(f (f !<(_+<.f vase)) poke-sync-automerge) %kiln-fuse =;(f (f !<(_+<.f vase)) poke-fuse) %kiln-fuse-list =;(f (f !<(_+<.f vase)) poke-fuse-list) %kiln-gall-sear =;(f (f !<(_+<.f vase)) poke-gall-sear) @@ -576,6 +591,7 @@ %kiln-revive =;(f (f !<(_+<.f vase)) poke-revive) %kiln-rein =;(f (f !<(_+<.f vase)) poke-rein) %kiln-rm =;(f (f !<(_+<.f vase)) poke-rm) + %kiln-global-automerge =;(f (f !<(_+<.f vase)) poke-global-automerge) %kiln-schedule =;(f (f !<(_+<.f vase)) poke-schedule) %kiln-suspend =;(f (f !<(_+<.f vase)) poke-suspend) %kiln-suspend-many =;(f (f !<(_+<.f vase)) poke-suspend-many) @@ -586,6 +602,19 @@ %kiln-unsync =;(f (f !<(_+<.f vase)) poke-unsync) == :: +++ poke-approve-merge + |= [sync-record approve=?] + ?~ got=(~(get by zyn) syd her sud) + =+ msg="kiln: no syncs from {(scow %p her)}/{(trip sud)} to {}" + ((slog leaf+msg ~) abet) + ?~ hav.u.got + =+ msg="kiln: no updates from {(scow %p her)}/{(trip sud)} for {}" + ((slog leaf+msg ~) abet) + =< abet + ?. approve + abet:drop:(sync syd her sud) + abet:(merg /main syd):(sync syd her sud) +:: ++ poke-autocommit |= [mon=kiln-commit auto=?] =< abet @@ -706,6 +735,23 @@ |= =ship abet:(emit %pass /kiln %arvo %g %sear ship) :: +++ poke-global-automerge + |= auto=? + =. mer auto + ?. mer abet + =/ zyns=(list [sync-record sync-state]) ~(tap by zyn) + =< abet + |- + ?~ zyns ..abet + ?. ?& ?=(^ hav.i.zyns) + !?=([~ %.n] nit.i.zyns) + == + $(zyns t.zyns) + %= $ + zyns t.zyns + ..abet abet:(merg /main syd):(sync -.i.zyns) + == +:: ++ poke-info |= [mez=tape tor=(unit toro)] ?~ tor @@ -719,17 +765,20 @@ ?~ got=(~(get by rock) loc) %dead zest.u.got - =. zyn + =. ..abet ?~ got=(~(get by sources) loc) - zyn - (~(del by zyn) loc u.got) + ..abet + ?: =([her rem] u.got) + ..abet + =. ..abet abet:drop:(sync loc u.got) + ..abet(zyn (~(del by zyn) loc u.got)) =? ..abet ?=(%dead zest) (emit %pass /kiln/install %arvo %c %zest loc ?:(=(our her) %live %held)) ?: (~(has by zyn) loc her rem) abet:(spam (render "already syncing" loc her rem ~) ~) ?: =([our loc] [her rem]) abet - =/ sun (sync loc her rem) + =/ sun okay:(sync loc her rem) ~> %slog.(fmt "beginning install into {here:sun}") =< abet:abet:init ?: =(%base loc) @@ -737,7 +786,7 @@ sun :: ++ poke-kids - |= [hos=kiln-sync nex=(unit desk)] + |= [hos=sync-record nex=(unit desk)] abet:abet:(apex:(sync hos) nex) :: ++ poke-label @@ -788,7 +837,7 @@ abet =. hop (~(del by hop) old) abet:(emit %give %fact ~[/jumps] %kiln-jump !>([%nay old u.had])) - ?~ (skim ~(tap by sources) |=(kiln-sync =(old [her sud]))) + ?~ (skim ~(tap by sources) |=(sync-record =(old [her sud]))) ~> %slog.(fmt "no syncs from {}/{(trip q.old)}") abet =. hop (~(put by hop) old new) @@ -810,16 +859,20 @@ ~> %slog.(fmt "denied jump from {txt-old} to {txt-new}") =. hop (~(del by hop) old) abet:(emit %give %fact ~[/jumps] %kiln-jump !>([%nay old new])) - =/ old-sources=(list kiln-sync) - (skim ~(tap by sources) |=(kiln-sync =(old [her sud]))) - =/ new-sources=(list kiln-sync) - (turn old-sources |=(kiln-sync [syd new])) - =. zyn + =/ old-sources=(list sync-record) + (skim ~(tap by sources) |=(sync-record =(old [her sud]))) + =/ new-sources=(list sync-record) + (turn old-sources |=(sync-record [syd new])) + =. ..abet + (emit %give %fact ~[/jumps] %kiln-jump !>([%yea old new])) + =. ..abet |- - ?~ old-sources zyn - $(old-sources t.old-sources, zyn (~(del by zyn) i.old-sources)) + ?~ old-sources + ..abet + =. ..abet abet:drop:(sync i.old-sources) + =. zyn (~(del by zyn) i.old-sources) + $(old-sources t.old-sources, ..abet ..abet) =. hop (~(del by hop) old) - =. ..abet (emit %give %fact ~[/jumps] %kiln-jump !>([%yea old new])) =< abet |- ^+ ..abet ?~ new-sources ..abet @@ -902,11 +955,28 @@ |=(=desk [%pass /kiln/suspend %arvo %c %zest desk %dead]) :: ++ poke-sync - |= hos=kiln-sync - ?: (~(has by zyn) hos) - abet:(spam (render "already syncing" [sud her syd ~]:hos) ~) - ~> %slog.(fmt "beginning sync into {} from {}/{}") - abet:abet:init:(sync hos) + |= sync-record + ?: (~(has by zyn) sud her syd) + abet:(spam (render "already syncing" [sud her syd ~]) ~) + =. ..abet + ?~ got=(~(get by sources) syd) + ..abet + =. ..abet abet:drop:(sync syd u.got) + ..abet(zyn (~(del by zyn) syd u.got)) + ~> %slog.(fmt "beginning sync into {} from {}/{}") + abet:abet:init:(sync syd her sud) +:: +++ poke-sync-automerge + |= [sync-record auto=(unit ?)] + ?~ got=(~(get by zyn) syd her sud) + =+ msg="kiln: no syncs from {(scow %p her)}/{(trip sud)} to {}" + ((slog leaf+msg ~) abet) + =. zyn (~(put by zyn) [syd her sud] u.got(nit auto)) + ?~ hav.u.got + abet + ?. |(?=([~ %.y] auto) &(mer ?=(~ auto))) + abet + abet:abet:(merg /main syd):(sync [syd her sud]) :: ++ poke-syncs :: print sync config |= ~ @@ -914,7 +984,7 @@ ?: =(0 ~(wyt by zyn)) [%leaf "no syncs configured"]~ %+ turn ~(tap by zyn) - |= [kiln-sync sync-state] + |= [sync-record sync-state] (render "sync configured" sud her syd kid) :: ++ poke-uninstall @@ -942,9 +1012,10 @@ :: Don't need to cancel anything because new syncs will get a new nonce :: ++ poke-unsync - |= hus=kiln-unsync + |= hus=sync-record ?~ got=(~(get by zyn) hus) abet:(spam (render "not syncing" [sud her syd ~]:hus) ~) + =. ..abet abet:drop:(sync hus) =. zyn (~(del by zyn) hus) abet:(spam (render "cancelling sync" sud.hus her.hus syd.hus kid.u.got) ~) :: +peer: handle %watch @@ -958,6 +1029,20 @@ :: [%jumps ~] abet:(emit %give %fact ~ %kiln-jump !>([%all hop])) + :: + [%updates ~] + =< abet + %- emit + :^ %give %fact ~ + :- %kiln-sync-update + !> ^- sync-update + :- %pending + %- ~(gas by *(set [sync-record @ud])) + ^- (list [sync-record @ud]) + %+ murn ~(tap by zyn) + |= [sync-record sync-state] + ?~ hav ~ + (some [syd her sud] u.hav) == :: ++ take-agent @@ -1183,15 +1268,30 @@ abet:abet:(take:(sync syd her sud) t.t.t.wire sign-arvo) :: ++ sync - |= kiln-sync + |= sync-record =/ got (~(get by zyn) syd her sud) - =+ `sync-state`(fall got [(scot %uv nyz) ~ *@ud]) + =+ `sync-state`(fall got [(scot %uv nyz) ~ *@ud ~ ~ |]) =? nyz ?=(~ got) +(nyz) |% - ++ abet ..sync(zyn (~(put by zyn) [syd her sud] nun kid let)) + ++ abet ..sync(zyn (~(put by zyn) [syd her sud] nun kid let nit hav yea)) ++ apex |=(nex=(unit desk) ..abet(kid nex)) ++ emit |=(card:agent:gall ..abet(kiln (^emit +<))) ++ emil |=((list card:agent:gall) ..abet(kiln (^emil +<))) + ++ okay ..abet(yea &) + ++ gain + =. hav `(dec let) + =/ upd=sync-update [%new [syd her sud] (dec let)] + (emit %give %fact ~[/update] %kiln-sync-update !>(upd)) + ++ drop + =? ..abet ?=(^ hav) + =/ upd=sync-update [%drop [syd her sud] u.hav] + (emit %give %fact ~[/updates] %kiln-sync-update !>(upd)) + ..abet(hav ~, yea |) + ++ tada + =? ..abet ?=(^ hav) + =/ upd=sync-update [%done [syd her sud] u.hav] + (emit %give %fact ~[/updates] %kiln-sync-update !>(upd)) + ..abet(hav ~, yea |) ++ here "{} from {}/{}" ++ ware |= =wire @@ -1206,7 +1306,6 @@ %merg desk her sud ud+(dec let) (get-germ desk) == - :: :: (re)Start a sync from scratch by finding what version the source :: desk is at :: @@ -1234,8 +1333,8 @@ ?> ?=(^ riot) :: The syncs may have changed, so get the latest :: - ;< zyx=(map kiln-sync sync-state) bind:m - (scry:strandio (map kiln-sync sync-state) /gx/hood/kiln/syncs/noun) + ;< zyx=(map sync-record sync-state) bind:m + (scry:strandio (map sync-record sync-state) /gx/hood/kiln/syncs/noun) ?. (~(has by zyx) syd her sud) (pure:m !>(%done)) ~> %slog.(fmt "downloading update for {here}") @@ -1280,6 +1379,7 @@ ?: ?=(%| -.p.sign-arvo) :: ~> %slog.(fmt "download failed into {here}; retrying sync") :: %- (slog p.p.sign-arvo) + =. ..abet drop init :: ~> %slog.(fmt "finished downloading update for {here}") @@ -1287,7 +1387,7 @@ :: If nothing changed, just ensure %kids is up-to-date and advance :: ?. (get-remote-diff our syd now [her sud (dec let)]) - =< next + =< next:drop ?~ kid ~> %slog.(fmt "remote is identical to {here}, skipping") ..abet @@ -1296,15 +1396,22 @@ ..abet ~> %slog.(fmt "remote is identical to {here}, merging into {}") (merg /kids u.kid) + :: wait for approval if can't automerge & signal available update + :: + ?. |(=(our her) yea =([~ &] nit) &(=(~ nit) mer)) + =. ..abet gain + next :: Else start merging, but also immediately start listening to :: the next revision. Now, all errors should no-op -- we're :: already waiting for the next revision. :: + =. yea | =. ..abet (merg /main syd) next :: - %main + %main ?> ?=(%mere +<.sign-arvo) + =< tada ?: ?=(%| -.p.sign-arvo) =+ "kiln: merge into {here} failed, waiting for next revision" %- (slog leaf/- p.p.sign-arvo) diff --git a/pkg/arvo/mar/kiln/approve-merge.hoon b/pkg/arvo/mar/kiln/approve-merge.hoon new file mode 120000 index 0000000000..cceb68cc1b --- /dev/null +++ b/pkg/arvo/mar/kiln/approve-merge.hoon @@ -0,0 +1 @@ +../../../base-dev/mar/kiln/approve-merge.hoon \ No newline at end of file diff --git a/pkg/arvo/mar/kiln/jump-ask.hoon b/pkg/arvo/mar/kiln/jump-ask.hoon deleted file mode 100644 index 0e6ce52be7..0000000000 --- a/pkg/arvo/mar/kiln/jump-ask.hoon +++ /dev/null @@ -1,16 +0,0 @@ -:: -:::: /hoon/jump-ask/kiln/mar - :: -/? 310 -|_ req=[old=dock new=dock] -:: -++ grow - |% - ++ noun req - -- -++ grab - |% - ++ noun ,[dock dock] - -- -++ grad %noun --- diff --git a/pkg/arvo/mar/kiln/jump-ask.hoon b/pkg/arvo/mar/kiln/jump-ask.hoon new file mode 120000 index 0000000000..c13477815d --- /dev/null +++ b/pkg/arvo/mar/kiln/jump-ask.hoon @@ -0,0 +1 @@ +../../../base-dev/mar/kiln/jump-ask.hoon \ No newline at end of file diff --git a/pkg/arvo/mar/kiln/jump-opt.hoon b/pkg/arvo/mar/kiln/jump-opt.hoon deleted file mode 100644 index f03d2d2b03..0000000000 --- a/pkg/arvo/mar/kiln/jump-opt.hoon +++ /dev/null @@ -1,22 +0,0 @@ -:: -:::: /hoon/jump-opt/kiln/mar - :: -|_ req=[old=dock new=dock yea=?] -:: -++ grow - |% - ++ noun req - -- -++ grab - |% - ++ noun ,[dock dock ?] - ++ json - =, dejs:format - %- ot - :~ [%old (ot ship+(se %p) desk+so ~)] - [%new (ot ship+(se %p) desk+so ~)] - [%yea bo] - == - -- -++ grad %noun --- diff --git a/pkg/arvo/mar/kiln/jump-opt.hoon b/pkg/arvo/mar/kiln/jump-opt.hoon new file mode 120000 index 0000000000..2b49747d07 --- /dev/null +++ b/pkg/arvo/mar/kiln/jump-opt.hoon @@ -0,0 +1 @@ +../../../base-dev/mar/kiln/jump-opt.hoon \ No newline at end of file diff --git a/pkg/arvo/mar/kiln/jump.hoon b/pkg/arvo/mar/kiln/jump.hoon deleted file mode 100644 index 540f35a893..0000000000 --- a/pkg/arvo/mar/kiln/jump.hoon +++ /dev/null @@ -1,43 +0,0 @@ -:: -:::: /hoon/jump/kiln/mar - :: -/- h=hood -|_ jum=jump:h -:: -++ grow - |% - ++ noun jum - ++ json - =, enjs:format - |^ ^- ^json - ?- -.jum - %add - %+ frond 'add' - (pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~) - :: - %yea - %+ frond 'yea' - (pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~) - :: - %nay - %+ frond 'nay' - (pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~) - :: - %all - %+ frond 'all' - :- %a - %+ turn ~(tap by all.jum) - |= [old=dock new=dock] - (pairs ['old' (en-dock old)] ['new' (en-dock new)] ~) - == - ++ en-dock - |= =dock - (pairs ['ship' s+(scot %p p.dock)] ['desk' s+q.dock] ~) - -- - -- -++ grab - |% - ++ noun jump:h - -- -++ grad %noun --- diff --git a/pkg/arvo/mar/kiln/jump.hoon b/pkg/arvo/mar/kiln/jump.hoon new file mode 120000 index 0000000000..c8e8202368 --- /dev/null +++ b/pkg/arvo/mar/kiln/jump.hoon @@ -0,0 +1 @@ +../../../base-dev/mar/kiln/jump.hoon \ No newline at end of file diff --git a/pkg/arvo/mar/kiln/sync-update.hoon b/pkg/arvo/mar/kiln/sync-update.hoon new file mode 120000 index 0000000000..93eaa91d50 --- /dev/null +++ b/pkg/arvo/mar/kiln/sync-update.hoon @@ -0,0 +1 @@ +../../../base-dev/mar/kiln/sync-update.hoon \ No newline at end of file diff --git a/pkg/base-dev/mar/kiln/approve-merge.hoon b/pkg/base-dev/mar/kiln/approve-merge.hoon new file mode 100644 index 0000000000..b1b25fa64f --- /dev/null +++ b/pkg/base-dev/mar/kiln/approve-merge.hoon @@ -0,0 +1,22 @@ +:: +:::: /hoon/approve-merge/kiln/mar + :: +/- h=hood +|_ req=[sync-record:h approve=?] +:: +++ grow + |% + ++ noun req + -- +++ grab + |% + ++ noun ,[sync-record:h approve=?] + ++ json + =, dejs:format + %- ot + :~ [%sync (ot syd+so her+(se %p) sud+so ~)] + [%approve bo] + == + -- +++ grad %noun +-- diff --git a/pkg/base-dev/mar/kiln/jump-ask.hoon b/pkg/base-dev/mar/kiln/jump-ask.hoon new file mode 100644 index 0000000000..0e6ce52be7 --- /dev/null +++ b/pkg/base-dev/mar/kiln/jump-ask.hoon @@ -0,0 +1,16 @@ +:: +:::: /hoon/jump-ask/kiln/mar + :: +/? 310 +|_ req=[old=dock new=dock] +:: +++ grow + |% + ++ noun req + -- +++ grab + |% + ++ noun ,[dock dock] + -- +++ grad %noun +-- diff --git a/pkg/base-dev/mar/kiln/jump-opt.hoon b/pkg/base-dev/mar/kiln/jump-opt.hoon new file mode 100644 index 0000000000..f03d2d2b03 --- /dev/null +++ b/pkg/base-dev/mar/kiln/jump-opt.hoon @@ -0,0 +1,22 @@ +:: +:::: /hoon/jump-opt/kiln/mar + :: +|_ req=[old=dock new=dock yea=?] +:: +++ grow + |% + ++ noun req + -- +++ grab + |% + ++ noun ,[dock dock ?] + ++ json + =, dejs:format + %- ot + :~ [%old (ot ship+(se %p) desk+so ~)] + [%new (ot ship+(se %p) desk+so ~)] + [%yea bo] + == + -- +++ grad %noun +-- diff --git a/pkg/base-dev/mar/kiln/jump.hoon b/pkg/base-dev/mar/kiln/jump.hoon new file mode 100644 index 0000000000..540f35a893 --- /dev/null +++ b/pkg/base-dev/mar/kiln/jump.hoon @@ -0,0 +1,43 @@ +:: +:::: /hoon/jump/kiln/mar + :: +/- h=hood +|_ jum=jump:h +:: +++ grow + |% + ++ noun jum + ++ json + =, enjs:format + |^ ^- ^json + ?- -.jum + %add + %+ frond 'add' + (pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~) + :: + %yea + %+ frond 'yea' + (pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~) + :: + %nay + %+ frond 'nay' + (pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~) + :: + %all + %+ frond 'all' + :- %a + %+ turn ~(tap by all.jum) + |= [old=dock new=dock] + (pairs ['old' (en-dock old)] ['new' (en-dock new)] ~) + == + ++ en-dock + |= =dock + (pairs ['ship' s+(scot %p p.dock)] ['desk' s+q.dock] ~) + -- + -- +++ grab + |% + ++ noun jump:h + -- +++ grad %noun +-- diff --git a/pkg/base-dev/mar/kiln/sync-update.hoon b/pkg/base-dev/mar/kiln/sync-update.hoon new file mode 100644 index 0000000000..20a3166558 --- /dev/null +++ b/pkg/base-dev/mar/kiln/sync-update.hoon @@ -0,0 +1,50 @@ +:: +:::: /hoon/sync-update/kiln/mar + :: +/- h=hood +|_ upd=sync-update:h +:: +++ grow + |% + ++ noun upd + ++ json + =, enjs:format + |^ ^- ^json + ?- -.upd + %new + %+ frond 'new' + (pairs ['for' (en-sync-record for.upd)] ['rev' (numb rev.upd)] ~) + :: + %done + %+ frond 'done' + (pairs ['for' (en-sync-record for.upd)] ['rev' (numb rev.upd)] ~) + :: + %drop + %+ frond 'drop' + (pairs ['for' (en-sync-record for.upd)] ['rev' (numb rev.upd)] ~) + :: + %pending + %+ frond 'pending' + :- %a + %+ turn ~(tap by pending.upd) + |= [for=sync-record:h rev=@ud] + %- pairs + :~ ['for' (en-sync-record for)] + ['rev' (numb rev)] + == + == + ++ en-sync-record + |= sync-record:h + %- pairs + :~ ['syd' s+syd] + ['her' s+(scot %p her)] + ['sud' s+sud] + == + -- + -- +++ grab + |% + ++ noun sync-update:h + -- +++ grad %noun +-- diff --git a/pkg/base-dev/sur/hood.hoon b/pkg/base-dev/sur/hood.hoon index 3c0430f990..1b5e58ca44 100644 --- a/pkg/base-dev/sur/hood.hoon +++ b/pkg/base-dev/sur/hood.hoon @@ -21,8 +21,30 @@ :: $rung: reference to upstream commit :: +$ rung [=aeon =weft] +:: #sync-record: source and destination of a kiln sync +:: ++$ sync-record :: + $: syd=desk :: local desk + her=ship :: foreign ship + sud=desk :: foreign desk + == +:: ++$ sync-state :: + $: nun=@ta :: nonce + kid=(unit desk) :: has kids desk too? + let=@ud :: next revision + nit=(unit ?) :: automerge or default + hav=(unit @ud) :: update available + yea=? :: update approved + == +:: ++$ sync-update + $% [%new for=sync-record rev=@ud] + [%done for=sync-record rev=@ud] + [%drop for=sync-record rev=@ud] + [%pending pending=(set [for=sync-record rev=@ud])] + == :: -+$ sync-state [nun=@ta kid=(unit desk) let=@ud] +$ sink (unit [her=@p sud=desk kid=(unit desk) let=@ud]) :: +truncate-hash: get last 5 digits of hash and convert to tape :: @@ -108,7 +130,7 @@ :: +report-vat: report on a single desk installation :: ++ report-vat - |= $: $: tyr=rock:tire =cone sor=(map desk [ship desk]) + |= $: $: tyr=rock:tire =cone sor=(map desk (pair ship desk)) zyn=(map [desk ship desk] sync-state) == our=ship now=@da syd=desk verb=? @@ -144,7 +166,7 @@ ~ ?~ z=(~(get by zyn) syd u.s) ~ - `[-.u.s +.u.s +.u.z] + `[p.u.s q.u.s [kid let]:u.z] =/ meb=(list @uv) ?~ sink [hash]~ (mergebase-hashes our syd now her.u.sink sud.u.sink) From b2a3350afda56123c853ed28e753f766aac5337d Mon Sep 17 00:00:00 2001 From: Tinnus Napbus Date: Sat, 16 Sep 2023 01:31:17 +1200 Subject: [PATCH 049/252] kiln: %jump-ask mark noun:grab structure mode --- pkg/arvo/mar/kiln/jump-ask.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/mar/kiln/jump-ask.hoon b/pkg/arvo/mar/kiln/jump-ask.hoon index 0e6ce52be7..f75f570aa1 100644 --- a/pkg/arvo/mar/kiln/jump-ask.hoon +++ b/pkg/arvo/mar/kiln/jump-ask.hoon @@ -10,7 +10,7 @@ -- ++ grab |% - ++ noun ,[dock dock] + +$ noun [dock dock] -- ++ grad %noun -- From 00bc41261949953ef129304e2daf7be9c147b0fd Mon Sep 17 00:00:00 2001 From: Tinnus Napbus Date: Sat, 16 Sep 2023 01:34:01 +1200 Subject: [PATCH 050/252] kiln: simplify ++frond call in %kiln-jump mark --- pkg/arvo/mar/kiln/jump.hoon | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/pkg/arvo/mar/kiln/jump.hoon b/pkg/arvo/mar/kiln/jump.hoon index 540f35a893..d0ca575110 100644 --- a/pkg/arvo/mar/kiln/jump.hoon +++ b/pkg/arvo/mar/kiln/jump.hoon @@ -10,21 +10,12 @@ ++ json =, enjs:format |^ ^- ^json + %+ frond -.jum ?- -.jum - %add - %+ frond 'add' - (pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~) - :: - %yea - %+ frond 'yea' - (pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~) - :: - %nay - %+ frond 'nay' - (pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~) - :: + %add (pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~) + %yea (pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~) + %nay (pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~) %all - %+ frond 'all' :- %a %+ turn ~(tap by all.jum) |= [old=dock new=dock] From e9a618e1847e724eae9486bfe4d8f21f0f6cad92 Mon Sep 17 00:00:00 2001 From: Tinnus Napbus Date: Sat, 16 Sep 2023 02:53:41 +1200 Subject: [PATCH 051/252] kiln: change jump-related @p printing to scow's --- pkg/arvo/lib/hood/kiln.hoon | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index a55c580ef6..394b76321c 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -789,7 +789,7 @@ =. hop (~(del by hop) old) abet:(emit %give %fact ~[/jumps] %kiln-jump !>([%nay old u.had])) ?~ (skim ~(tap by sources) |=(kiln-sync =(old [her sud]))) - ~> %slog.(fmt "no syncs from {}/{(trip q.old)}") + ~> %slog.(fmt "no syncs from {(scow %p p.old)}/{(trip q.old)}") abet =. hop (~(put by hop) old new) abet:(emit %give %fact ~[/jumps] %kiln-jump !>([%add old new])) @@ -797,16 +797,16 @@ ++ poke-jump-opt |= [old=dock new=dock yea=?] ?~ got=(~(get by hop) old) - ~> %slog.(fmt "no jump request for {}/{(trip q.old)}") + ~> %slog.(fmt "no jump request for {(scow %p p.old)}/{(trip q.old)}") abet ?. =(new u.got) - =/ txt-old "{}/{(trip q.old)}" - =/ txt-new "{}/{(trip q.new)}" + =/ txt-old "{(scow %p p.old)}/{(trip q.old)}" + =/ txt-new "{(scow %p p.new)}/{(trip q.new)}" ~> %slog.(fmt "no jump request from {txt-old} to {txt-new}") abet ?. yea - =/ txt-old "{}/{(trip q.old)}" - =/ txt-new "{}/{(trip q.new)}" + =/ txt-old "{(scow %p p.old)}/{(trip q.old)}" + =/ txt-new "{(scow %p p.new)}/{(trip q.new)}" ~> %slog.(fmt "denied jump from {txt-old} to {txt-new}") =. hop (~(del by hop) old) abet:(emit %give %fact ~[/jumps] %kiln-jump !>([%nay old new])) From 12c9e6429709ce3ddda76152144a2e47c3ce1cdd Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Sun, 17 Sep 2023 15:54:43 +0100 Subject: [PATCH 052/252] temp commit --- pkg/arvo/sys/lull.hoon | 2 +- tests/sys/vane/gall.hoon | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index 62d103276e..fad4a62fb9 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -2782,7 +2782,7 @@ [%cull =case =spur] :: [%tend =coop =path =page] - [%germ =coop =crew:clay] + [%germ =coop] [%snip =coop] == +$ task diff --git a/tests/sys/vane/gall.hoon b/tests/sys/vane/gall.hoon index 73469503dc..15a32e84e2 100644 --- a/tests/sys/vane/gall.hoon +++ b/tests/sys/vane/gall.hoon @@ -43,4 +43,5 @@ !> -.res :: [output +.res] +++ test- -- From df68e629172198c1007554b6203b0db2caacc752 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Tue, 19 Sep 2023 15:09:54 +0100 Subject: [PATCH 053/252] gall: wip coop --- pkg/arvo/sys/vane/gall.hoon | 61 +++++++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 13 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index bd131d421a..7addcb05fe 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -68,9 +68,11 @@ $: disclosing=(unit (set ship)) attributing=[=ship =path] == -+$ lock [rev=@ud key=@uvJ] :: TODO: key width? ++$ lock [rev=@ud key=@ud] +$ hutch - [=lock =crew:clay chicks=(map path page)] + [=lock chicks=(map path page)] ++$ nest + [=coop =lock chicks=(set path)] :: $yoke: agent runner state :: :: control-duct: TODO document @@ -131,6 +133,7 @@ $% [%d =mark noun=*] [%x ~] == +:: :: $ames-request: network request (%plea) :: :: %m: poke @@ -139,14 +142,20 @@ :: %u: leave :: +$ ames-request-all - $% [%0 ames-request] + $% [%0 ames-request-0] + [%1 ames-request] == -+$ ames-request ++$ ames-request-0 $% [%m =mark noun=*] [%l =mark =path] [%s =path] [%u ~] == +:: ++$ ames-request + $% ames-request-0 + [%c =path] + == :: $remote-request: kinds of agent actions that can cross the network :: :: Used in wires to identify the kind of remote request we made. @@ -357,7 +366,7 @@ =. mo-core (mo-track-ship ship) ?< ?=(?(%raw-poke %poke-as) -.deal) =/ =ames-request-all - :- %0 + :- %1 ?- -.deal %poke [%m p.cage.deal q.q.cage.deal] %leave [%u ~] @@ -877,7 +886,11 @@ (mo-give %flub ~) ?: ?=(%.n -.agent.u.yok) (mo-give %flub ~) - :: + ?: ?=(%c -.ames-request) + =/ ap-core (ap-abed:ap agent-name [~ ship /]) + =< ap-abet + (ap-coop-request:ap-core ship +.ames-request) + :: =/ =wire /sys/req/(scot %p ship)/[agent-name] :: =/ =deal @@ -888,6 +901,7 @@ %u [%leave ~] == (mo-pass wire %g %deal [ship our /] agent-name deal) + :: +mo-spew: handle request to set verbosity toggles on debug output :: ++ mo-spew @@ -980,6 +994,27 @@ moves moves == :: + ++ ap-coop-request + |= [=ship =path] + ?~ cop=(ap-match-coop path) + :: TODO: behaviour on missing + ap-core + =/ cag=(unit (unit cage)) + (ap-peek %| %c (snoc u.cop (scot %p ship))) + =/ has-perms=? + ?. ?=([~ ~ ^] cag) + | + ;;(? q.u.u.cag) + =/ =hutch (~(got by cop.yoke) u.cop) + ?: has-perms + =/ =nest + =,(hutch [u.cop lock ~(key by chicks)]) + =/ =ames-response + [%d %gall-nest nest] + (ap-move [agent-duct %give %boon ames-response]~) + ap-core + + :: ++ ap-yawn-all ^- (list card:agent) %- zing @@ -1018,10 +1053,11 @@ ap-core ++ ap-match-coop |= =path + ^- (unit coop) ?: (~(has by cop.yoke) path) - & + `path ?: =(~ path) - | + ~ =. path (flop path) ?> ?=(^ path) $(path (flop t.path)) @@ -1036,13 +1072,12 @@ =. cop.yoke (~(put by cop.yoke) coop hutch) ap-core ++ ap-germ - |= [=coop =crew:clay] + |= =coop =/ key=@uvJ (shax eny) :: TODO: review key generation =/ =hutch ?~ hut=(~(get by cop.yoke) coop) - [[1 (shax eny)] crew ~] - =. lock.u.hut [.+(rev.lock.u.hut) (shax eny)] - =. crew.u.hut crew + *hutch :: TODO: fix + =. lock.u.hut *lock u.hut =. cop.yoke (~(put by cop.yoke) coop hutch) ap-core @@ -1055,7 +1090,7 @@ ++ ap-grow |= [=spur =page] ^+ ap-core - ?< (ap-match-coop spur) :: enforce binding public seperately + ?> =(~ (ap-match-coop spur)) :: enforce binding public seperately =- ap-core(sky.yoke -) %+ ~(put by sky.yoke) spur =/ ski (~(gut by sky.yoke) spur *path-state) From 5ff263e78d49fc05475a816687a6b9c5529583db Mon Sep 17 00:00:00 2001 From: lukechampine Date: Wed, 12 Jul 2023 23:13:01 -0400 Subject: [PATCH 054/252] eyre: add HTTP scrying --- pkg/arvo/sys/vane/eyre.hoon | 116 ++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index e52da9ecfb..b10bfa3865 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -898,6 +898,15 @@ =- (fall - '*') (get-header:http 'access-control-request-headers' headers) == + :: handle HTTP scries + :: + :: TODO: ideally this would look more like: + :: + :: ?^ p=(parse-http-scry url.request) + :: (handle-http-scry authenticated p request) + :: + ?: =('/_~_/' (end [3 5] url.request)) + (handle-http-scry authenticated request) :: handle requests to the cache :: =/ entry (~(get by cache.state) url.request) @@ -1003,6 +1012,44 @@ =/ nom=@p ?+(-.identity who.identity %ours our) (as-octs:mimes:html (scot %p nom)) + :: +handle-http-scry: respond with scry result + :: + ++ handle-http-scry + |= [authenticated=? =request:http] + |^ ^- (quip move server-state) + ?. authenticated (error-response 403 ~) + ?. =(%'GET' method.request) + (error-response 405 "may only GET scries") + =/ req (parse-request-line url.request) + =/ fqp (fully-qualified site.req) + =/ mym (scry-mime now rof ext.req site.req) + ?: ?=(%| -.mym) (error-response 500 p.mym) + =* mime p.mym + %- handle-response + :* %start + :- status-code=200 + ^= headers + :~ ['content-type' (rsh 3 (spat p.mime))] + ['content-length' (crip (format-ud-as-integer p.q.mime))] + ['cache-control' ?:(fqp 'max-age=31536000' 'no-cache')] + == + data=[~ q.mime] + complete=%.y + == + :: + ++ fully-qualified + |= a=path + ^- ? + ?. ?=([%'_~_' @ @ @ *] a) %.n + =/ vez (vang | (en-beam [our %base da+now] ~)) + ?= [~ [^ ^ ^ *]] (rush (spat t.t.a) ;~(pfix fas gash:vez)) + :: + ++ error-response + |= [status=@ud =tape] + ^- (quip move server-state) + %^ return-static-data-on-duct status 'text/html' + (error-page status authenticated url.request tape) + -- :: +handle-cache-req: respond with cached value, 404 or 500 :: ++ handle-cache-req @@ -3050,6 +3097,7 @@ :: ?: ?| ?=([%'~' *] path.binding) :: eyre ?=([%'~_~' *] path.binding) :: runtime + ?=([%'_~_' *] path.binding) :: scries == [| bindings.state] [& (insert-binding [binding duct action] bindings.state)] @@ -3250,6 +3298,69 @@ :: need to issue a %leave after we've forgotten the identity with :: which the subscription was opened. /(scot %p ship)/[app]/(scot %p from) +:: +++ scry-mime + |= [now=@da rof=roof ext=(unit @ta) pax=path] + |^ ^- (each mime tape) + :: parse + :: + =/ u=(unit [view=term bem=beam]) + ?. ?=([@ @ @ @ *] pax) ~ + ?~ view=(slaw %tas i.t.pax) ~ + ?~ path=(expand-path t.t.pax) ~ + ?~ beam=(de-beam u.path) ~ + `[u.view u.beam] + ?~ u [%| "invalid scry path"] + :: perform scry + :: + ?~ res=(rof ~ u.u) [%| "failed scry"] + ?~ u.res [%| "no scry result"] + =* mark p.u.u.res + =* vase q.u.u.res + :: convert to mime via ext + :: + =/ dysk (conversion-desk u.u) + ?: ?=(%| -.dysk) [%| p.dysk] + =/ ext (fall ext %mime) + =/ mym (convert vase mark ext p.dysk) + ?: ?=(%| -.mym) [%| p.mym] + =/ mym (convert p.mym ext %mime p.dysk) + ?: ?=(%| -.mym) [%| p.mym] + [%& !<(mime p.mym)] + :: + ++ expand-path + |= a=path + ^- (unit path) + =/ vez (vang | (en-beam [our %base da+now] ~)) + (rush (spat a) (sear plex:vez (stag %clsg ;~(pfix fas poor:vez)))) + :: + ++ conversion-desk + |= [view=term =beam] + ^- (each desk tape) + ?: =(%$ q.beam) [%& %base] + ?+ (end 3 view) [%& %base] + %c + [%& q.beam] + %g + =/ res (rof ~ %gd [our q.beam da+now] /$) + ?. ?=([~ ~ *] res) + [%| "no desk for app {}"] + [%& !<(=desk q.u.u.res)] + == + :: + ++ convert + |= [=vase from=mark to=mark =desk] + ^- (each ^vase tape) + ?: =(from to) [%& vase] + =/ tub (rof ~ %cc [our desk da+now] /[from]/[to]) + ?. ?=([~ ~ %tube *] tub) + [%| "no tube from {(trip from)} to {(trip to)}"] + =/ tube !<(tube:clay q.u.u.tub) + =/ res (mule |.((tube vase))) + ?: ?=(%| -.res) + [%| "failed tube from {(trip from)} to {(trip to)}"] + [%& +.res] + -- -- :: end the =~ :: @@ -4074,6 +4185,11 @@ ?. =(u.aeon aeon.u.entry) [~ ~] ?~ val=val.u.entry [~ ~] ``noun+!>(u.val) + :: + [%'_~_' *] + =/ mym (scry-mime now rof (deft:de-purl:html tyl)) + ?: ?=(%| -.mym) [~ ~] + ``noun+!>(p.mym) == ?. ?=(%$ ren) [~ ~] From 417906051d63d273f0e44d6e4838c03f00cbdd19 Mon Sep 17 00:00:00 2001 From: Pyry Kovanen Date: Tue, 19 Sep 2023 15:02:24 +0300 Subject: [PATCH 055/252] eyre: add missing wire to rof calls in http-scry codepath --- pkg/arvo/sys/vane/eyre.hoon | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index b10bfa3865..d9727ff438 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -1,7 +1,7 @@ !: :: lighter than eyre :: -|= our=ship +|= our=ships =, eyre :: internal data structures :: @@ -3313,8 +3313,8 @@ ?~ u [%| "invalid scry path"] :: perform scry :: - ?~ res=(rof ~ u.u) [%| "failed scry"] - ?~ u.res [%| "no scry result"] + ?~ res=(rof ~ /eyre u.u) [%| "failed scry"] + ?~ u.res [%| "no scry result"] =* mark p.u.u.res =* vase q.u.u.res :: convert to mime via ext @@ -3342,7 +3342,7 @@ %c [%& q.beam] %g - =/ res (rof ~ %gd [our q.beam da+now] /$) + =/ res (rof ~ /eyre %gd [our q.beam da+now] /$) ?. ?=([~ ~ *] res) [%| "no desk for app {}"] [%& !<(=desk q.u.u.res)] @@ -3352,7 +3352,7 @@ |= [=vase from=mark to=mark =desk] ^- (each ^vase tape) ?: =(from to) [%& vase] - =/ tub (rof ~ %cc [our desk da+now] /[from]/[to]) + =/ tub (rof ~ /eyre %cc [our desk da+now] /[from]/[to]) ?. ?=([~ ~ %tube *] tub) [%| "no tube from {(trip from)} to {(trip to)}"] =/ tube !<(tube:clay q.u.u.tub) From fbab1a2e825542e59158ebb18eaaa16bd377b181 Mon Sep 17 00:00:00 2001 From: Pyry Kovanen Date: Tue, 19 Sep 2023 15:06:50 +0300 Subject: [PATCH 056/252] eyre: revert strange typo in previous commit --- pkg/arvo/sys/vane/eyre.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index d9727ff438..455d4e74af 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -1,7 +1,7 @@ !: :: lighter than eyre :: -|= our=ships +|= our=ship =, eyre :: internal data structures :: From 3e0e45e775f040eb089cbc9f4331601e361244ab Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Tue, 19 Sep 2023 17:48:15 +0100 Subject: [PATCH 057/252] ames: add symmetric keychain functionality --- pkg/arvo/sys/lull.hoon | 1 + pkg/arvo/sys/vane/ames.hoon | 108 ++++++++++++++++++++++++++++++++---- 2 files changed, 97 insertions(+), 12 deletions(-) diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index fad4a62fb9..3f52616254 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -801,6 +801,7 @@ [%kroc bones=(list [ship bone])] $>(%plea vane-task) [%deep =deep] + [%lock ~] :: [%keen spar] [%yawn spar] diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index aa80b20211..257b901375 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -107,8 +107,15 @@ ~% %ames ..part ~ |% +| %helpers -:: +trace: print if .verb is set and we're tracking .ship :: +++ chain + =< mop + |% + ++ on ((^on ,@ ,@) lte) + +$ mop ((^mop ,@ ,@) lte) + -- +:: +:: +trace: print if .verb is set and we're tracking .ship ++ trace |= [mode=?(%ames %fine) verb=? =ship ships=(set ship) print=(trap tape)] ^+ same @@ -560,6 +567,25 @@ :: +$ ames-state $+ ames-state + $: peers=(map ship ship-state) + =unix=duct + =life + =rift + crypto-core=acru:ames + =bug + snub=[form=?(%allow %deny) ships=(set ship)] + cong=[msg=_5 mem=_100.000] + :: + $= dead + $: flow=[%flow (unit dead-timer)] + cork=[%cork (unit dead-timer)] + == + :: + =chain + == +:: ++$ ames-state-17 + $+ ames-state-17 $: peers=(map ship ship-state) =unix=duct =life @@ -1337,7 +1363,8 @@ [%14 ames-state-14] [%15 ames-state-15] [%16 ames-state-16] - [%17 ^ames-state] + [%17 ames-state-17] + [%18 ^ames-state] == :: |= [now=@da eny=@ rof=roof] @@ -1460,7 +1487,7 @@ :: lifecycle arms; mostly pass-throughs to the contained adult ames :: ++ scry scry:adult-core - ++ stay [%17 %larva queued-events ames-state.adult-gate] + ++ stay [%18 %larva queued-events ames-state.adult-gate] ++ load |= $= old $% $: %4 @@ -1555,12 +1582,20 @@ [%adult state=ames-state-16] == == $: %17 + $% $: %larva + events=(qeu queued-event) + state=ames-state-17 + == + [%adult state=ames-state-17] + == == + $: %18 $% $: %larva events=(qeu queued-event) state=_ames-state.adult-gate == [%adult state=_ames-state.adult-gate] == == == + |^ ?- old [%4 %adult *] $(old [%5 %adult (state-4-to-5:load:adult-core state.old)]) @@ -1701,12 +1736,24 @@ =. queued-events (event-16-to-17 events.old) larval-gate :: - [%17 %adult *] (load:adult-core %17 state.old) + [%17 %adult *] + =. cached-state `[%17 state.old] + ~> %slog.0^leaf/"ames: larva reload" + larval-gate :: [%17 %larva *] ~> %slog.1^leaf/"ames: larva: load" + =. cached-state `[%17 state.old] =. queued-events events.old - =. adult-gate (load:adult-core %17 state.old) + larval-gate + + :: + [%18 %adult *] (load:adult-core %18 state.old) + :: + [%18 %larva *] + ~> %slog.1^leaf/"ames: larva: load" + =. queued-events events.old + =. adult-gate (load:adult-core %18 state.old) larval-gate == :: @@ -1783,9 +1830,11 @@ 15+(state-14-to-15:load:adult-core +.u.cached-state) =? u.cached-state ?=(%15 -.u.cached-state) 16+(state-15-to-16:load:adult-core +.u.cached-state) + =? u.cached-state ?=(%16 -.u.cached-state) + 17+(state-16-to-17:load:adult-core +.u.cached-state) =^ moz u.cached-state - ?. ?=(%16 -.u.cached-state) [~ u.cached-state] - :_ 17+(state-16-to-17:load:adult-core +.u.cached-state) + ?. ?=(%17 -.u.cached-state) [~ u.cached-state] + :_ 18+(state-17-to-18:load:adult-core +.u.cached-state) ~> %slog.0^leaf/"ames: init dead flow consolidation timer" :- [[/ames]~ %pass /dead-flow %b %wait `@da`(add now ~m2)] ?^ moz moz :: if we have just added the timer in state-7-to-8, skip @@ -1799,7 +1848,11 @@ (rof ~ /ames %bx [[our %$ da+now] /debug/timers]) |=([@da =duct] ?=([[%ames %recork *] *] duct)) :: - ?> ?=(%17 -.u.cached-state) + ?> ?=(%18 -.u.cached-state) + =? chain.u.cached-state =(~ chain.u.cached-state) + ~& init-first-keypair/(shaz eny) + (put:on:chain chain.u.cached-state 1 (shaz eny)) + :: TODO: review keygen =. ames-state.adult-gate +.u.cached-state [moz larval-core(cached-state ~)] -- @@ -2855,6 +2908,15 @@ :: +on-vega: handle kernel reload :: ++ on-vega event-core + :: +on-lock: handle key reservation + ++ on-lock + ^+ event-core + =/ key (shaz eny) + ~& chain/chain.ames-state + =/ idx .+(-:(need (ram:on:chain chain.ames-state))) + =. chain.ames-state + (put:on:chain chain.ames-state idx key) + event-core :: +on-trim: handle request to free memory :: :: %ruin comets not seen for six months @@ -4919,6 +4981,9 @@ ^- [(list move) _ames-gate] :: =/ =task ((harden task) wrapped-task) + =? chain.ames-state =(~ chain.ames-state) + ~& init-first-keypair/(shaz eny) + (put:on:chain chain.ames-state 1 (shaz eny)) =/ event-core (ev [now eny rof] duct ames-state) :: =^ moves ames-state @@ -4950,6 +5015,7 @@ %tame (on-tame:event-core ship.task) %kroc (on-kroc:event-core bones.task) %deep (on-deep:event-core deep.task) + %lock on-lock:event-core :: %keen (on-keen:event-core +.task) %yawn (on-cancel-scry:event-core | +.task) @@ -4988,15 +5054,15 @@ [moves ames-gate] :: +stay: extract state before reload :: -++ stay [%17 %adult ames-state] +++ stay [%18 %adult ames-state] :: +load: load in old state after reload :: ++ load =< |= $= old-state - $% [%17 ^ames-state] + $% [%18 ^ames-state] == ^+ ames-gate - ?> ?=(%17 -.old-state) + ?> ?=(%18 -.old-state) ames-gate(ames-state +.old-state) :: all state transitions are called from larval ames :: @@ -5169,7 +5235,7 @@ :: ++ state-16-to-17 |= old=ames-state-16 - ^- ^ames-state + ^- ames-state-17 %= old cong :+ cong.old @@ -5227,6 +5293,12 @@ == -- == + ++ state-17-to-18 + |= old=ames-state-17 + ^- ^ames-state + %= old + dead [dead.old ~] + == -- :: +scry: dereference namespace :: @@ -5251,6 +5323,8 @@ ~ :: /ax//whey (list mass) :: /ax/protocol/version @ + :: /ax/chain/[idx] [idx=@ud key=@uvJ] + :: /ax/chain/latest [idx=@ud key=@uvJ] :: /ax/peers (map ship ?(%alien %known)) :: /ax/peers/[ship] ship-state :: /ax/peers/[ship]/last-contact (unit @da) @@ -5274,6 +5348,16 @@ :: [%protocol %version ~] ``noun+!>(protocol-version) + :: + [%chain %latest ~] + ``noun+!>(`[idx=@ key=@]`(need (ram:on:chain chain.ames-state))) + :: + [%chain idx=@ ~] + ?~ idx=(slaw %ud idx.tyl) + [~ ~] + ?~ key=(get:on:chain chain.ames-state u.idx) + [~ ~] + ``noun+!>(`[idx=@ key=@]`[u.idx u.key]) :: [%peers ~] :^ ~ ~ %noun From 13964e27e9aa8601f62e1b05d931650bc80e3dff Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Wed, 20 Sep 2023 16:30:28 +0100 Subject: [PATCH 058/252] ames: add encrypted remote scry support --- pkg/arvo/sys/vane/ames.hoon | 49 +++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 257b901375..4d11b222d3 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -342,14 +342,18 @@ :: +| %serialization :: - ++ etch + ++ etch-data + |= [=path data=$@(~ (cask))] + =/ sig=@ (full path data) + ?~ data sig + (mix sig (lsh 9 (jam data))) + ++ etch-open |= [=path =hunk data=$@(~ (cask))] + (etch path hunk (etch-data path data)) + :: + ++ etch + |= [=path =hunk mes=@] ^- (list yowl) - =/ mes=@ - =/ sig=@ (full path data) - ?~ data sig - (mix sig (lsh 9 (jam data))) - ::(cat 9 sig (jam data)) :: =/ las (met 13 mes) =/ tip (dec (add [lop len]:hunk)) @@ -5483,11 +5487,40 @@ :: %g =/ kyr ?@(vis.nom (rsh 3 vis.nom) car.vis.nom) + ?: =(%$ q.bem.nom) :: encrypted case + ?. ?=(%ud -.r.bem.nom) :: XX: check? + [~ ~] + ?. ?=([@ ~] s.bem.nom) + [~ ~] + =/ key + (~(got by chain.ames-state) p.r.bem.nom) + =/ aes ~(. cbcc:aes:crypto [key 0]) + ?~ new=(de-path-soft:balk (stab `@t`(de:aes (slav %uv i.s.bem.nom)))) + [~ ~] + :: XX: assert %gx case?? + :: TODO: enforce permissions w/ scry + (en-hunk-shut (en-path:balk u.new) key (rof ~ /ames (as-omen:balk u.new))) %- en-hunk ?+ kyr ~ %x (rof ~ /ames nom) == == + ++ en-hunk-shut + |= [=path key=@ res=(unit (unit cage))] + ^- (unit (unit cage)) + =/ etch-core (etch-hunk our [life crypto-core]:ames-state) + =/ dat + %- ~(en cbcc:aes:crypto [key 0]) + %+ etch-data:etch-core path + ?- res + ~ ~ + [~ ~] ~ + [~ ~ ^] [p q.q]:u.u.res + == + =/ =hunk [(slav %ud lop.tyl) (slav %ud len.tyl)] + =- ``noun+!>(-) + %- etch:etch-core + [path hunk dat] :: ++ en-hunk |= res=(unit (unit cage)) @@ -5497,8 +5530,8 @@ :: =/ hu-co (etch-hunk our [life crypto-core]:ames-state) ?- res - [~ ~] ``noun+!>((etch:hu-co pax.tyl hunk ~)) - [~ ~ *] ``noun+!>((etch:hu-co pax.tyl hunk [p q.q]:u.u.res)) + [~ ~] ``noun+!>((etch-open:hu-co pax.tyl hunk ~)) + [~ ~ *] ``noun+!>((etch-open:hu-co pax.tyl hunk [p q.q]:u.u.res)) == -- :: From bca8e4689556d83233960a93089896e4330d985c Mon Sep 17 00:00:00 2001 From: Pyry Kovanen Date: Thu, 21 Sep 2023 13:39:23 +0300 Subject: [PATCH 059/252] Revert "kiln: OTA merge approval (UIP 114)" --- pkg/arvo/app/hood.hoon | 5 +- pkg/arvo/gen/hood/approve-merge.hoon | 6 - pkg/arvo/gen/hood/global-automerge.hoon | 6 - pkg/arvo/gen/hood/jump/approve.hoon | 6 - pkg/arvo/gen/hood/jump/propose.hoon | 16 -- pkg/arvo/gen/hood/jump/reject.hoon | 6 - pkg/arvo/gen/hood/sync-automerge.hoon | 6 - pkg/arvo/gen/jumps.hoon | 16 -- pkg/arvo/gen/updates.hoon | 16 -- pkg/arvo/lib/hood/kiln.hoon | 312 ++++------------------- pkg/arvo/mar/kiln/approve-merge.hoon | 1 - pkg/arvo/mar/kiln/jump-ask.hoon | 1 - pkg/arvo/mar/kiln/jump-opt.hoon | 1 - pkg/arvo/mar/kiln/jump.hoon | 1 - pkg/arvo/mar/kiln/sync-update.hoon | 1 - pkg/base-dev/mar/kiln/approve-merge.hoon | 22 -- pkg/base-dev/mar/kiln/jump-ask.hoon | 16 -- pkg/base-dev/mar/kiln/jump-opt.hoon | 22 -- pkg/base-dev/mar/kiln/jump.hoon | 43 ---- pkg/base-dev/mar/kiln/sync-update.hoon | 50 ---- pkg/base-dev/sur/hood.hoon | 37 +-- 21 files changed, 56 insertions(+), 534 deletions(-) delete mode 100644 pkg/arvo/gen/hood/approve-merge.hoon delete mode 100644 pkg/arvo/gen/hood/global-automerge.hoon delete mode 100644 pkg/arvo/gen/hood/jump/approve.hoon delete mode 100644 pkg/arvo/gen/hood/jump/propose.hoon delete mode 100644 pkg/arvo/gen/hood/jump/reject.hoon delete mode 100644 pkg/arvo/gen/hood/sync-automerge.hoon delete mode 100644 pkg/arvo/gen/jumps.hoon delete mode 100644 pkg/arvo/gen/updates.hoon delete mode 120000 pkg/arvo/mar/kiln/approve-merge.hoon delete mode 120000 pkg/arvo/mar/kiln/jump-ask.hoon delete mode 120000 pkg/arvo/mar/kiln/jump-opt.hoon delete mode 120000 pkg/arvo/mar/kiln/jump.hoon delete mode 120000 pkg/arvo/mar/kiln/sync-update.hoon delete mode 100644 pkg/base-dev/mar/kiln/approve-merge.hoon delete mode 100644 pkg/base-dev/mar/kiln/jump-ask.hoon delete mode 100644 pkg/base-dev/mar/kiln/jump-opt.hoon delete mode 100644 pkg/base-dev/mar/kiln/jump.hoon delete mode 100644 pkg/base-dev/mar/kiln/sync-update.hoon diff --git a/pkg/arvo/app/hood.hoon b/pkg/arvo/app/hood.hoon index 57727514ca..91b2ec4b82 100644 --- a/pkg/arvo/app/hood.hoon +++ b/pkg/arvo/app/hood.hoon @@ -2,8 +2,8 @@ /+ drum=hood-drum, helm=hood-helm, kiln=hood-kiln |% +$ state - $~ [%27 *state:drum *state:helm *state:kiln] - $>(%27 any-state) + $~ [%26 *state:drum *state:helm *state:kiln] + $>(%26 any-state) :: +$ any-state $% [ver=?(%1 %2 %3 %4 %5 %6) lac=(map @tas fin-any-state)] @@ -27,7 +27,6 @@ [%24 drum=state-4:drum helm=state-2:helm kiln=state-10:kiln] [%25 drum=state-5:drum helm=state-2:helm kiln=state-10:kiln] [%26 drum=state-6:drum helm=state-2:helm kiln=state-10:kiln] - [%27 drum=state-6:drum helm=state-2:helm kiln=state-11:kiln] == +$ any-state-tuple $: drum=any-state:drum diff --git a/pkg/arvo/gen/hood/approve-merge.hoon b/pkg/arvo/gen/hood/approve-merge.hoon deleted file mode 100644 index 58a49cc5a2..0000000000 --- a/pkg/arvo/gen/hood/approve-merge.hoon +++ /dev/null @@ -1,6 +0,0 @@ -:- %say -|= $: [now=@da eny=@uvJ bec=beak] - [syd=desk her=ship sud=desk approve=? ~] - ~ - == -kiln-approve-merge+[[syd her sud] approve] diff --git a/pkg/arvo/gen/hood/global-automerge.hoon b/pkg/arvo/gen/hood/global-automerge.hoon deleted file mode 100644 index d8992f54e2..0000000000 --- a/pkg/arvo/gen/hood/global-automerge.hoon +++ /dev/null @@ -1,6 +0,0 @@ -:- %say -|= $: [now=@da eny=@uvJ bec=beak] - [auto=? ~] - ~ - == -kiln-global-automerge+auto diff --git a/pkg/arvo/gen/hood/jump/approve.hoon b/pkg/arvo/gen/hood/jump/approve.hoon deleted file mode 100644 index ce3a3b0182..0000000000 --- a/pkg/arvo/gen/hood/jump/approve.hoon +++ /dev/null @@ -1,6 +0,0 @@ -:- %say -|= $: [now=@da eny=@uvJ bec=beak] - [old=dock new=dock ~] - ~ - == -kiln-jump-opt+[old new &] diff --git a/pkg/arvo/gen/hood/jump/propose.hoon b/pkg/arvo/gen/hood/jump/propose.hoon deleted file mode 100644 index 75ba21a2db..0000000000 --- a/pkg/arvo/gen/hood/jump/propose.hoon +++ /dev/null @@ -1,16 +0,0 @@ -/+ *generators -:- %ask -|= $: [now=@da eny=@uvJ bec=beak] - [syd=desk her=ship sud=desk ~] - hard=_| - == -?: hard (produce %kiln-jump-propose syd her sud) -=/ msg - leaf+"Are you sure you want to tell subscribers to get ". - "updates for {} from {}/{(trip sud)}?" -%+ print msg -%+ prompt [%& %prompt "(y/N) "] -|= in=tape -?. |(=("y" in) =("Y" in) =("yes" in)) - no-product -(produce %kiln-jump-propose syd her sud) diff --git a/pkg/arvo/gen/hood/jump/reject.hoon b/pkg/arvo/gen/hood/jump/reject.hoon deleted file mode 100644 index b1a885c5f4..0000000000 --- a/pkg/arvo/gen/hood/jump/reject.hoon +++ /dev/null @@ -1,6 +0,0 @@ -:- %say -|= $: [now=@da eny=@uvJ bec=beak] - [old=dock new=dock ~] - ~ - == -kiln-jump-opt+[old new |] diff --git a/pkg/arvo/gen/hood/sync-automerge.hoon b/pkg/arvo/gen/hood/sync-automerge.hoon deleted file mode 100644 index 7daf36fcab..0000000000 --- a/pkg/arvo/gen/hood/sync-automerge.hoon +++ /dev/null @@ -1,6 +0,0 @@ -:- %say -|= $: [now=@da eny=@uvJ bec=beak] - [syd=desk her=ship sud=desk auto=(unit ?) ~] - ~ - == -kiln-sync-automerge+[[syd her sud] auto] diff --git a/pkg/arvo/gen/jumps.hoon b/pkg/arvo/gen/jumps.hoon deleted file mode 100644 index 78c7ac5aad..0000000000 --- a/pkg/arvo/gen/jumps.hoon +++ /dev/null @@ -1,16 +0,0 @@ -/- h=hood -:- %say -|= [[now=@da eny=@uvJ bec=beak] ~ ~] -:- %tang -^- tang -=+ .^ hop=jump:h - %gx - (scot %p p.bec) - %hood - (scot %da now) - /kiln/jumps/noun - == -?> ?=(%all -.hop) -%+ turn ~(tap by all.hop) -|= [old=dock new=dock] -leaf+"{}/{(trip q.old)} -> {}/{(trip q.new)}" diff --git a/pkg/arvo/gen/updates.hoon b/pkg/arvo/gen/updates.hoon deleted file mode 100644 index 94bbe88c51..0000000000 --- a/pkg/arvo/gen/updates.hoon +++ /dev/null @@ -1,16 +0,0 @@ -/- h=hood -:- %say -|= [[now=@da eny=@uvJ bec=beak] ~ ~] -:- %tang -^- tang -=+ .^ upd=sync-update:h - %gx - (scot %p p.bec) - %hood - (scot %da now) - /kiln/pending/noun - == -?> ?=(%pending -.upd) -%+ turn ~(tap in pending.upd) -|= [sync-record:h rev=@ud] -leaf+"{} <- {}/{(trip sud)}/{}" diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index 28fcbda692..2f36bce8ed 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -5,8 +5,7 @@ =, format =* dude dude:gall |% -+$ state state-11 -+$ state-11 [%11 pith-11] ++$ state state-10 +$ state-10 [%10 pith-10] +$ state-9 [%9 pith-9] +$ state-8 [%8 pith-9] @@ -20,8 +19,7 @@ +$ state-0 [%0 pith-0] +$ any-state $~ *state - $% state-11 - state-10 + $% state-10 state-9 state-8 state-7 @@ -34,32 +32,10 @@ state-0 == :: -+$ pith-11 - $: rem=(map desk per-desk) - nyz=@ud - zyn=(map sync-record sync-state) - :: requests from publishers to switch sync source - hop=(map dock dock) - :: toggle global update auto-merge - mer=? - :: - commit-timer=[way=wire nex=@da tim=@dr mon=term] - :: map desk to the currently ongoing fuse request - :: and the latest version numbers for beaks to - fus=(map desk per-fuse) - :: used for fuses - every time we get a fuse we - :: bump this. used when calculating hashes to - :: ensure they're unique even when the same - :: request is made multiple times. - hxs=(map desk @ud) - == -:: -+$ sync-state-10 [nun=@ta kid=(unit desk) let=@ud] -:: +$ pith-10 $: rem=(map desk per-desk) nyz=@ud - zyn=(map sync-record sync-state-10) + zyn=(map kiln-sync sync-state) commit-timer=[way=wire nex=@da tim=@dr mon=term] :: map desk to the currently ongoing fuse request :: and the latest version numbers for beaks to @@ -74,7 +50,7 @@ +$ pith-9 $: wef=(unit weft) rem=(map desk per-desk) - syn=(map sync-record let=@ud) + syn=(map kiln-sync let=@ud) ark=(map desk arak-9) commit-timer=[way=wire nex=@da tim=@dr mon=term] :: map desk to the currently ongoing fuse request @@ -102,7 +78,7 @@ +$ pith-7 $: wef=(unit weft) rem=(map desk per-desk) - syn=(map sync-record let=@ud) + syn=(map kiln-sync let=@ud) ark=(map desk arak-7) commit-timer=[way=wire nex=@da tim=@dr mon=term] :: map desk to the currently ongoing fuse request @@ -145,7 +121,7 @@ +$ pith-6 $: wef=(unit weft) rem=(map desk per-desk) :: - syn=(map sync-record let=@ud) :: + syn=(map kiln-sync let=@ud) :: ark=(map desk arak-6) :: commit-timer=[way=wire nex=@da tim=@dr mon=term] :: :: map desk to the currently ongoing fuse request @@ -163,7 +139,7 @@ :: +$ pith-5 $: rem=(map desk per-desk) :: - syn=(map sync-record let=@ud) :: + syn=(map kiln-sync let=@ud) :: ark=(map desk arak-6) :: commit-timer=[way=wire nex=@da tim=@dr mon=term] :: :: map desk to the currently ongoing fuse request @@ -178,7 +154,7 @@ :: +$ pith-4 :: $: rem=(map desk per-desk) :: - syn=(map sync-record let=@ud) :: + syn=(map kiln-sync let=@ud) :: ark=(map desk arak-4) :: commit-timer=[way=wire nex=@da tim=@dr mon=term] :: :: map desk to the currently ongoing fuse request @@ -199,7 +175,7 @@ == +$ pith-3 :: $: rem=(map desk per-desk) :: - syn=(map sync-record let=@ud) :: + syn=(map kiln-sync let=@ud) :: ark=(map desk arak-3) :: commit-timer=[way=wire nex=@da tim=@dr mon=term] :: :: map desk to the currently ongoing fuse request @@ -225,7 +201,7 @@ :: +$ pith-2 :: $: rem=(map desk per-desk) :: - syn=(map sync-record let=@ud) :: + syn=(map kiln-sync let=@ud) :: ota=(unit [=ship =desk =aeon]) :: commit-timer=[way=wire nex=@da tim=@dr mon=term] :: fus=(map desk per-fuse) @@ -233,13 +209,13 @@ == :: +$ pith-1 :: $: rem=(map desk per-desk) :: - syn=(map sync-record let=@ud) :: + syn=(map kiln-sync let=@ud) :: ota=(unit [=ship =desk =aeon]) :: commit-timer=[way=wire nex=@da tim=@dr mon=term] :: == :: +$ pith-0 :: $: rem=(map desk per-desk) :: - syn=(map sync-record let=@ud) :: + syn=(map kiln-sync let=@ud) :: autoload-on=? :: cur-hoon=@uvI :: cur-arvo=@uvI :: @@ -269,6 +245,16 @@ pot=term :: == +$ kiln-unmount $@(term [knot path]) :: ++$ kiln-sync :: + $: syd=desk :: local desk + her=ship :: foreign ship + sud=desk :: foreign desk + == ++$ kiln-unsync :: + $: syd=desk :: local desk + her=ship :: foreign ship + sud=desk :: foreign desk + == +$ kiln-merge :: $@ ~ $: syd=desk :: @@ -299,6 +285,7 @@ +$ kiln-fuse-list (unit desk) -- |= [bowl:gall state] +?> =(src our) =| moz=(list card:agent:gall) |% ++ kiln . @@ -453,7 +440,7 @@ =^ cards-9=(list card:agent:gall) old ?. ?=(%9 -.old) `old - =/ syn=(set sync-record) + =/ syn=(set kiln-sync) %- ~(gas in ~(key by syn.old)) %+ murn ~(tap by ark.old) |= [=desk =arak-9] @@ -481,8 +468,8 @@ [%pass /kiln/load-zest %arvo %c %zest desk zest] :: %+ turn ~(tap in syn) - |= r=sync-record - [%pass /kiln/load-sync %agent [our %hood] %poke %kiln-sync !>(r)] + |= k=kiln-sync + [%pass /kiln/load-sync %agent [our %hood] %poke %kiln-sync !>(k)] :: =/ ks ~(tap in syn) |- ^- (list card:agent:gall) @@ -496,17 +483,7 @@ $(ks t.ks) == :: - =? old ?=(%10 -.old) - %= old - - %11 - |4 [hop=~ mer=& |4.old] - zyn %- ~(run by zyn.old) - |= sync-state-10 - ^- sync-state - [nun kid let ~ ~ |] - == - :: - ?> ?=(%11 -.old) + ?> ?=(%10 -.old) =. state old abet:(emil cards-9) :: @@ -522,10 +499,8 @@ =/ ver (mergebase-hashes our %base now (~(got by sources) %base)) ``noun+!>(?~(ver 0v0 i.ver)) :: - [%x %kiln %jumps ~] ``kiln-jump+!>([%all hop]) - [%x %kiln %syncs ~] ``noun+!>(zyn) - [%x %kiln %sources ~] ``noun+!>(sources) - [%x %kiln %automerge ~] ``loob+!>(mer) + [%x %kiln %syncs ~] ``noun+!>(zyn) + [%x %kiln %sources ~] ``noun+!>(sources) [%x %kiln %pikes ~] =+ .^(=rock:tire %cx /(scot %p our)//(scot %da now)/tire) :^ ~ ~ %kiln-pikes @@ -536,17 +511,6 @@ =+ .^(hash=@uv %cz /(scot %p our)/[desk]/(scot %da now)) =/ sync (~(get by sources) desk) [sync hash zest wic] - :: - [%x %kiln %pending ~] - :^ ~ ~ %kiln-sync-update - !> ^- sync-update - :- %pending - %- ~(gas by *(set [sync-record @ud])) - ^- (list [sync-record @ud]) - %+ murn ~(tap by zyn) - |= [sync-record sync-state] - ?~ hav ~ - (some [syd her sud] u.hav) == :: :: +get-germ: select merge strategy into local desk @@ -564,15 +528,12 @@ :: ++ poke |= [=mark =vase] - ?> |(=(src our) =(%kiln-jump-ask mark)) ?+ mark ~|([%poke-kiln-bad-mark mark] !!) - %kiln-approve-merge =;(f (f !<(_+<.f vase)) poke-approve-merge) %kiln-autocommit =;(f (f !<(_+<.f vase)) poke-autocommit) %kiln-bump =;(f (f !<(_+<.f vase)) poke-bump) %kiln-cancel =;(f (f !<(_+<.f vase)) poke-cancel) %kiln-cancel-autocommit =;(f (f !<(_+<.f vase)) poke-cancel-autocommit) %kiln-commit =;(f (f !<(_+<.f vase)) poke-commit) - %kiln-sync-automerge =;(f (f !<(_+<.f vase)) poke-sync-automerge) %kiln-fuse =;(f (f !<(_+<.f vase)) poke-fuse) %kiln-fuse-list =;(f (f !<(_+<.f vase)) poke-fuse-list) %kiln-gall-sear =;(f (f !<(_+<.f vase)) poke-gall-sear) @@ -582,16 +543,12 @@ %kiln-label =;(f (f !<(_+<.f vase)) poke-label) %kiln-merge =;(f (f !<(_+<.f vase)) poke-merge) %kiln-mount =;(f (f !<(_+<.f vase)) poke-mount) - %kiln-jump-ask =;(f (f !<(_+<.f vase)) poke-jump-ask) - %kiln-jump-opt =;(f (f !<(_+<.f vase)) poke-jump-opt) - %kiln-jump-propose =;(f (f !<(_+<.f vase)) poke-jump-propose) %kiln-nuke =;(f (f !<(_+<.f vase)) poke-nuke) %kiln-pause =;(f (f !<(_+<.f vase)) poke-pause) %kiln-permission =;(f (f !<(_+<.f vase)) poke-permission) %kiln-revive =;(f (f !<(_+<.f vase)) poke-revive) %kiln-rein =;(f (f !<(_+<.f vase)) poke-rein) %kiln-rm =;(f (f !<(_+<.f vase)) poke-rm) - %kiln-global-automerge =;(f (f !<(_+<.f vase)) poke-global-automerge) %kiln-schedule =;(f (f !<(_+<.f vase)) poke-schedule) %kiln-suspend =;(f (f !<(_+<.f vase)) poke-suspend) %kiln-suspend-many =;(f (f !<(_+<.f vase)) poke-suspend-many) @@ -602,19 +559,6 @@ %kiln-unsync =;(f (f !<(_+<.f vase)) poke-unsync) == :: -++ poke-approve-merge - |= [sync-record approve=?] - ?~ got=(~(get by zyn) syd her sud) - =+ msg="kiln: no syncs from {(scow %p her)}/{(trip sud)} to {}" - ((slog leaf+msg ~) abet) - ?~ hav.u.got - =+ msg="kiln: no updates from {(scow %p her)}/{(trip sud)} for {}" - ((slog leaf+msg ~) abet) - =< abet - ?. approve - abet:drop:(sync syd her sud) - abet:(merg /main syd):(sync syd her sud) -:: ++ poke-autocommit |= [mon=kiln-commit auto=?] =< abet @@ -735,23 +679,6 @@ |= =ship abet:(emit %pass /kiln %arvo %g %sear ship) :: -++ poke-global-automerge - |= auto=? - =. mer auto - ?. mer abet - =/ zyns=(list [sync-record sync-state]) ~(tap by zyn) - =< abet - |- - ?~ zyns ..abet - ?. ?& ?=(^ hav.i.zyns) - !?=([~ %.n] nit.i.zyns) - == - $(zyns t.zyns) - %= $ - zyns t.zyns - ..abet abet:(merg /main syd):(sync -.i.zyns) - == -:: ++ poke-info |= [mez=tape tor=(unit toro)] ?~ tor @@ -765,20 +692,17 @@ ?~ got=(~(get by rock) loc) %dead zest.u.got - =. ..abet + =. zyn ?~ got=(~(get by sources) loc) - ..abet - ?: =([her rem] u.got) - ..abet - =. ..abet abet:drop:(sync loc u.got) - ..abet(zyn (~(del by zyn) loc u.got)) + zyn + (~(del by zyn) loc u.got) =? ..abet ?=(%dead zest) (emit %pass /kiln/install %arvo %c %zest loc ?:(=(our her) %live %held)) ?: (~(has by zyn) loc her rem) abet:(spam (render "already syncing" loc her rem ~) ~) ?: =([our loc] [her rem]) abet - =/ sun okay:(sync loc her rem) + =/ sun (sync loc her rem) ~> %slog.(fmt "beginning install into {here:sun}") =< abet:abet:init ?: =(%base loc) @@ -786,7 +710,7 @@ sun :: ++ poke-kids - |= [hos=sync-record nex=(unit desk)] + |= [hos=kiln-sync nex=(unit desk)] abet:abet:(apex:(sync hos) nex) :: ++ poke-label @@ -807,84 +731,6 @@ abet:(spam leaf+- ~) abet:(emit %pass /mount %arvo %c [%mont pot u.bem]) :: -++ poke-jump-propose - |= [syd=desk her=ship sud=desk] - ?: =([our syd] [her sud]) - abet - =/ let=@ud ud:.^(cass:clay %cw /(scot %p our)/[syd]/(scot %da now)) - =/ subs=(set [@p rave:clay]) - .^((set [@p rave:clay]) %cx /(scot %p our)//(scot %da now)/cult/[syd]) - =/ ships=(set @p) - %+ roll ~(tap in subs) - |= [[=ship =rave:clay] ships=(set @p)] - ?: =(our ship) ships - ?. ?=([%sing %w [%ud @] ~] rave) ships - ?. =(+(let) p.case.mood.rave) ships - (~(put in ships) ship) - =< abet - %- emil - %+ turn ~(tap in ships) - |= =ship - :* %pass /kiln/jump-propose %agent [ship %hood] - %poke %kiln-jump-ask !>([[our syd] [her sud]]) - == -:: -++ poke-jump-ask - |= [old=dock new=dock] - ?> |(=(src p.old) =(src our)) - ?: =(old new) - ?~ had=(~(get by hop) old) - abet - =. hop (~(del by hop) old) - abet:(emit %give %fact ~[/jumps] %kiln-jump !>([%nay old u.had])) - ?~ (skim ~(tap by sources) |=(sync-record =(old [her sud]))) - ~> %slog.(fmt "no syncs from {}/{(trip q.old)}") - abet - =. hop (~(put by hop) old new) - abet:(emit %give %fact ~[/jumps] %kiln-jump !>([%add old new])) -:: -++ poke-jump-opt - |= [old=dock new=dock yea=?] - ?~ got=(~(get by hop) old) - ~> %slog.(fmt "no jump request for {}/{(trip q.old)}") - abet - ?. =(new u.got) - =/ txt-old "{}/{(trip q.old)}" - =/ txt-new "{}/{(trip q.new)}" - ~> %slog.(fmt "no jump request from {txt-old} to {txt-new}") - abet - ?. yea - =/ txt-old "{}/{(trip q.old)}" - =/ txt-new "{}/{(trip q.new)}" - ~> %slog.(fmt "denied jump from {txt-old} to {txt-new}") - =. hop (~(del by hop) old) - abet:(emit %give %fact ~[/jumps] %kiln-jump !>([%nay old new])) - =/ old-sources=(list sync-record) - (skim ~(tap by sources) |=(sync-record =(old [her sud]))) - =/ new-sources=(list sync-record) - (turn old-sources |=(sync-record [syd new])) - =. ..abet - (emit %give %fact ~[/jumps] %kiln-jump !>([%yea old new])) - =. ..abet - |- - ?~ old-sources - ..abet - =. ..abet abet:drop:(sync i.old-sources) - =. zyn (~(del by zyn) i.old-sources) - $(old-sources t.old-sources, ..abet ..abet) - =. hop (~(del by hop) old) - =< abet - |- ^+ ..abet - ?~ new-sources ..abet - %= $ - new-sources t.new-sources - ..abet =/ sun (sync i.new-sources) - =< abet:init - ?: =(%base syd.i.new-sources) - (apex:sun `%kids) - sun - == -:: ++ poke-nuke |= [=term desk=?] =< abet @@ -955,28 +801,11 @@ |=(=desk [%pass /kiln/suspend %arvo %c %zest desk %dead]) :: ++ poke-sync - |= sync-record - ?: (~(has by zyn) sud her syd) - abet:(spam (render "already syncing" [sud her syd ~]) ~) - =. ..abet - ?~ got=(~(get by sources) syd) - ..abet - =. ..abet abet:drop:(sync syd u.got) - ..abet(zyn (~(del by zyn) syd u.got)) - ~> %slog.(fmt "beginning sync into {} from {}/{}") - abet:abet:init:(sync syd her sud) -:: -++ poke-sync-automerge - |= [sync-record auto=(unit ?)] - ?~ got=(~(get by zyn) syd her sud) - =+ msg="kiln: no syncs from {(scow %p her)}/{(trip sud)} to {}" - ((slog leaf+msg ~) abet) - =. zyn (~(put by zyn) [syd her sud] u.got(nit auto)) - ?~ hav.u.got - abet - ?. |(?=([~ %.y] auto) &(mer ?=(~ auto))) - abet - abet:abet:(merg /main syd):(sync [syd her sud]) + |= hos=kiln-sync + ?: (~(has by zyn) hos) + abet:(spam (render "already syncing" [sud her syd ~]:hos) ~) + ~> %slog.(fmt "beginning sync into {} from {}/{}") + abet:abet:init:(sync hos) :: ++ poke-syncs :: print sync config |= ~ @@ -984,7 +813,7 @@ ?: =(0 ~(wyt by zyn)) [%leaf "no syncs configured"]~ %+ turn ~(tap by zyn) - |= [sync-record sync-state] + |= [kiln-sync sync-state] (render "sync configured" sud her syd kid) :: ++ poke-uninstall @@ -1012,10 +841,9 @@ :: Don't need to cancel anything because new syncs will get a new nonce :: ++ poke-unsync - |= hus=sync-record + |= hus=kiln-unsync ?~ got=(~(get by zyn) hus) abet:(spam (render "not syncing" [sud her syd ~]:hus) ~) - =. ..abet abet:drop:(sync hus) =. zyn (~(del by zyn) hus) abet:(spam (render "cancelling sync" sud.hus her.hus syd.hus kid.u.got) ~) :: +peer: handle %watch @@ -1023,26 +851,10 @@ ++ peer |= =path ?> (team:title our src) + ?: =(0 1) abet :: avoid mint-vain ?+ path ~|(kiln-path/path !!) [%vats ~] (mean leaf+"kiln: old subscription to /kiln/vats failed" ~) - :: - [%jumps ~] - abet:(emit %give %fact ~ %kiln-jump !>([%all hop])) - :: - [%updates ~] - =< abet - %- emit - :^ %give %fact ~ - :- %kiln-sync-update - !> ^- sync-update - :- %pending - %- ~(gas by *(set [sync-record @ud])) - ^- (list [sync-record @ud]) - %+ murn ~(tap by zyn) - |= [sync-record sync-state] - ?~ hav ~ - (some [syd her sud] u.hav) == :: ++ take-agent @@ -1052,8 +864,6 @@ ~? ?=(^ p.sign) [%kiln-poke-nack u.p.sign] abet ~|([%kiln-bad-take-agent wire -.sign] !!) - :: - [%change-publisher ~] abet :: [%fancy *] ?> ?=(%poke-ack -.sign) @@ -1268,30 +1078,15 @@ abet:abet:(take:(sync syd her sud) t.t.t.wire sign-arvo) :: ++ sync - |= sync-record + |= kiln-sync =/ got (~(get by zyn) syd her sud) - =+ `sync-state`(fall got [(scot %uv nyz) ~ *@ud ~ ~ |]) + =+ `sync-state`(fall got [(scot %uv nyz) ~ *@ud]) =? nyz ?=(~ got) +(nyz) |% - ++ abet ..sync(zyn (~(put by zyn) [syd her sud] nun kid let nit hav yea)) + ++ abet ..sync(zyn (~(put by zyn) [syd her sud] nun kid let)) ++ apex |=(nex=(unit desk) ..abet(kid nex)) ++ emit |=(card:agent:gall ..abet(kiln (^emit +<))) ++ emil |=((list card:agent:gall) ..abet(kiln (^emil +<))) - ++ okay ..abet(yea &) - ++ gain - =. hav `(dec let) - =/ upd=sync-update [%new [syd her sud] (dec let)] - (emit %give %fact ~[/update] %kiln-sync-update !>(upd)) - ++ drop - =? ..abet ?=(^ hav) - =/ upd=sync-update [%drop [syd her sud] u.hav] - (emit %give %fact ~[/updates] %kiln-sync-update !>(upd)) - ..abet(hav ~, yea |) - ++ tada - =? ..abet ?=(^ hav) - =/ upd=sync-update [%done [syd her sud] u.hav] - (emit %give %fact ~[/updates] %kiln-sync-update !>(upd)) - ..abet(hav ~, yea |) ++ here "{} from {}/{}" ++ ware |= =wire @@ -1306,6 +1101,7 @@ %merg desk her sud ud+(dec let) (get-germ desk) == + :: :: (re)Start a sync from scratch by finding what version the source :: desk is at :: @@ -1333,8 +1129,8 @@ ?> ?=(^ riot) :: The syncs may have changed, so get the latest :: - ;< zyx=(map sync-record sync-state) bind:m - (scry:strandio (map sync-record sync-state) /gx/hood/kiln/syncs/noun) + ;< zyx=(map kiln-sync sync-state) bind:m + (scry:strandio (map kiln-sync sync-state) /gx/hood/kiln/syncs/noun) ?. (~(has by zyx) syd her sud) (pure:m !>(%done)) ~> %slog.(fmt "downloading update for {here}") @@ -1379,7 +1175,6 @@ ?: ?=(%| -.p.sign-arvo) :: ~> %slog.(fmt "download failed into {here}; retrying sync") :: %- (slog p.p.sign-arvo) - =. ..abet drop init :: ~> %slog.(fmt "finished downloading update for {here}") @@ -1387,7 +1182,7 @@ :: If nothing changed, just ensure %kids is up-to-date and advance :: ?. (get-remote-diff our syd now [her sud (dec let)]) - =< next:drop + =< next ?~ kid ~> %slog.(fmt "remote is identical to {here}, skipping") ..abet @@ -1396,22 +1191,15 @@ ..abet ~> %slog.(fmt "remote is identical to {here}, merging into {}") (merg /kids u.kid) - :: wait for approval if can't automerge & signal available update - :: - ?. |(=(our her) yea =([~ &] nit) &(=(~ nit) mer)) - =. ..abet gain - next :: Else start merging, but also immediately start listening to :: the next revision. Now, all errors should no-op -- we're :: already waiting for the next revision. :: - =. yea | =. ..abet (merg /main syd) next :: - %main + %main ?> ?=(%mere +<.sign-arvo) - =< tada ?: ?=(%| -.p.sign-arvo) =+ "kiln: merge into {here} failed, waiting for next revision" %- (slog leaf/- p.p.sign-arvo) diff --git a/pkg/arvo/mar/kiln/approve-merge.hoon b/pkg/arvo/mar/kiln/approve-merge.hoon deleted file mode 120000 index cceb68cc1b..0000000000 --- a/pkg/arvo/mar/kiln/approve-merge.hoon +++ /dev/null @@ -1 +0,0 @@ -../../../base-dev/mar/kiln/approve-merge.hoon \ No newline at end of file diff --git a/pkg/arvo/mar/kiln/jump-ask.hoon b/pkg/arvo/mar/kiln/jump-ask.hoon deleted file mode 120000 index c13477815d..0000000000 --- a/pkg/arvo/mar/kiln/jump-ask.hoon +++ /dev/null @@ -1 +0,0 @@ -../../../base-dev/mar/kiln/jump-ask.hoon \ No newline at end of file diff --git a/pkg/arvo/mar/kiln/jump-opt.hoon b/pkg/arvo/mar/kiln/jump-opt.hoon deleted file mode 120000 index 2b49747d07..0000000000 --- a/pkg/arvo/mar/kiln/jump-opt.hoon +++ /dev/null @@ -1 +0,0 @@ -../../../base-dev/mar/kiln/jump-opt.hoon \ No newline at end of file diff --git a/pkg/arvo/mar/kiln/jump.hoon b/pkg/arvo/mar/kiln/jump.hoon deleted file mode 120000 index c8e8202368..0000000000 --- a/pkg/arvo/mar/kiln/jump.hoon +++ /dev/null @@ -1 +0,0 @@ -../../../base-dev/mar/kiln/jump.hoon \ No newline at end of file diff --git a/pkg/arvo/mar/kiln/sync-update.hoon b/pkg/arvo/mar/kiln/sync-update.hoon deleted file mode 120000 index 93eaa91d50..0000000000 --- a/pkg/arvo/mar/kiln/sync-update.hoon +++ /dev/null @@ -1 +0,0 @@ -../../../base-dev/mar/kiln/sync-update.hoon \ No newline at end of file diff --git a/pkg/base-dev/mar/kiln/approve-merge.hoon b/pkg/base-dev/mar/kiln/approve-merge.hoon deleted file mode 100644 index b1b25fa64f..0000000000 --- a/pkg/base-dev/mar/kiln/approve-merge.hoon +++ /dev/null @@ -1,22 +0,0 @@ -:: -:::: /hoon/approve-merge/kiln/mar - :: -/- h=hood -|_ req=[sync-record:h approve=?] -:: -++ grow - |% - ++ noun req - -- -++ grab - |% - ++ noun ,[sync-record:h approve=?] - ++ json - =, dejs:format - %- ot - :~ [%sync (ot syd+so her+(se %p) sud+so ~)] - [%approve bo] - == - -- -++ grad %noun --- diff --git a/pkg/base-dev/mar/kiln/jump-ask.hoon b/pkg/base-dev/mar/kiln/jump-ask.hoon deleted file mode 100644 index 0e6ce52be7..0000000000 --- a/pkg/base-dev/mar/kiln/jump-ask.hoon +++ /dev/null @@ -1,16 +0,0 @@ -:: -:::: /hoon/jump-ask/kiln/mar - :: -/? 310 -|_ req=[old=dock new=dock] -:: -++ grow - |% - ++ noun req - -- -++ grab - |% - ++ noun ,[dock dock] - -- -++ grad %noun --- diff --git a/pkg/base-dev/mar/kiln/jump-opt.hoon b/pkg/base-dev/mar/kiln/jump-opt.hoon deleted file mode 100644 index f03d2d2b03..0000000000 --- a/pkg/base-dev/mar/kiln/jump-opt.hoon +++ /dev/null @@ -1,22 +0,0 @@ -:: -:::: /hoon/jump-opt/kiln/mar - :: -|_ req=[old=dock new=dock yea=?] -:: -++ grow - |% - ++ noun req - -- -++ grab - |% - ++ noun ,[dock dock ?] - ++ json - =, dejs:format - %- ot - :~ [%old (ot ship+(se %p) desk+so ~)] - [%new (ot ship+(se %p) desk+so ~)] - [%yea bo] - == - -- -++ grad %noun --- diff --git a/pkg/base-dev/mar/kiln/jump.hoon b/pkg/base-dev/mar/kiln/jump.hoon deleted file mode 100644 index 540f35a893..0000000000 --- a/pkg/base-dev/mar/kiln/jump.hoon +++ /dev/null @@ -1,43 +0,0 @@ -:: -:::: /hoon/jump/kiln/mar - :: -/- h=hood -|_ jum=jump:h -:: -++ grow - |% - ++ noun jum - ++ json - =, enjs:format - |^ ^- ^json - ?- -.jum - %add - %+ frond 'add' - (pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~) - :: - %yea - %+ frond 'yea' - (pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~) - :: - %nay - %+ frond 'nay' - (pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~) - :: - %all - %+ frond 'all' - :- %a - %+ turn ~(tap by all.jum) - |= [old=dock new=dock] - (pairs ['old' (en-dock old)] ['new' (en-dock new)] ~) - == - ++ en-dock - |= =dock - (pairs ['ship' s+(scot %p p.dock)] ['desk' s+q.dock] ~) - -- - -- -++ grab - |% - ++ noun jump:h - -- -++ grad %noun --- diff --git a/pkg/base-dev/mar/kiln/sync-update.hoon b/pkg/base-dev/mar/kiln/sync-update.hoon deleted file mode 100644 index 20a3166558..0000000000 --- a/pkg/base-dev/mar/kiln/sync-update.hoon +++ /dev/null @@ -1,50 +0,0 @@ -:: -:::: /hoon/sync-update/kiln/mar - :: -/- h=hood -|_ upd=sync-update:h -:: -++ grow - |% - ++ noun upd - ++ json - =, enjs:format - |^ ^- ^json - ?- -.upd - %new - %+ frond 'new' - (pairs ['for' (en-sync-record for.upd)] ['rev' (numb rev.upd)] ~) - :: - %done - %+ frond 'done' - (pairs ['for' (en-sync-record for.upd)] ['rev' (numb rev.upd)] ~) - :: - %drop - %+ frond 'drop' - (pairs ['for' (en-sync-record for.upd)] ['rev' (numb rev.upd)] ~) - :: - %pending - %+ frond 'pending' - :- %a - %+ turn ~(tap by pending.upd) - |= [for=sync-record:h rev=@ud] - %- pairs - :~ ['for' (en-sync-record for)] - ['rev' (numb rev)] - == - == - ++ en-sync-record - |= sync-record:h - %- pairs - :~ ['syd' s+syd] - ['her' s+(scot %p her)] - ['sud' s+sud] - == - -- - -- -++ grab - |% - ++ noun sync-update:h - -- -++ grad %noun --- diff --git a/pkg/base-dev/sur/hood.hoon b/pkg/base-dev/sur/hood.hoon index 1b5e58ca44..5c736f2714 100644 --- a/pkg/base-dev/sur/hood.hoon +++ b/pkg/base-dev/sur/hood.hoon @@ -10,41 +10,12 @@ == :: +$ pikes (map desk pike) -:: $jump: changes to update source change requests -:: -+$ jump - $% [%all all=(map dock dock)] :: pending requests - [%add old=dock new=dock] :: new request - [%yea old=dock new=dock] :: approved - [%nay old=dock new=dock] :: denied - == +:: :: $rung: reference to upstream commit :: +$ rung [=aeon =weft] -:: #sync-record: source and destination of a kiln sync -:: -+$ sync-record :: - $: syd=desk :: local desk - her=ship :: foreign ship - sud=desk :: foreign desk - == -:: -+$ sync-state :: - $: nun=@ta :: nonce - kid=(unit desk) :: has kids desk too? - let=@ud :: next revision - nit=(unit ?) :: automerge or default - hav=(unit @ud) :: update available - yea=? :: update approved - == -:: -+$ sync-update - $% [%new for=sync-record rev=@ud] - [%done for=sync-record rev=@ud] - [%drop for=sync-record rev=@ud] - [%pending pending=(set [for=sync-record rev=@ud])] - == :: ++$ sync-state [nun=@ta kid=(unit desk) let=@ud] +$ sink (unit [her=@p sud=desk kid=(unit desk) let=@ud]) :: +truncate-hash: get last 5 digits of hash and convert to tape :: @@ -130,7 +101,7 @@ :: +report-vat: report on a single desk installation :: ++ report-vat - |= $: $: tyr=rock:tire =cone sor=(map desk (pair ship desk)) + |= $: $: tyr=rock:tire =cone sor=(map desk [ship desk]) zyn=(map [desk ship desk] sync-state) == our=ship now=@da syd=desk verb=? @@ -166,7 +137,7 @@ ~ ?~ z=(~(get by zyn) syd u.s) ~ - `[p.u.s q.u.s [kid let]:u.z] + `[-.u.s +.u.s +.u.z] =/ meb=(list @uv) ?~ sink [hash]~ (mergebase-hashes our syd now her.u.sink sud.u.sink) From 6b94db25be29746776c8d5dd4af1c5abb0bb7139 Mon Sep 17 00:00:00 2001 From: Pyry Kovanen Date: Thu, 21 Sep 2023 13:55:55 +0300 Subject: [PATCH 060/252] Revert "Revert "kiln: OTA merge approval (UIP 114)"" --- pkg/arvo/app/hood.hoon | 5 +- pkg/arvo/gen/hood/approve-merge.hoon | 6 + pkg/arvo/gen/hood/global-automerge.hoon | 6 + pkg/arvo/gen/hood/jump/approve.hoon | 6 + pkg/arvo/gen/hood/jump/propose.hoon | 16 ++ pkg/arvo/gen/hood/jump/reject.hoon | 6 + pkg/arvo/gen/hood/sync-automerge.hoon | 6 + pkg/arvo/gen/jumps.hoon | 16 ++ pkg/arvo/gen/updates.hoon | 16 ++ pkg/arvo/lib/hood/kiln.hoon | 312 +++++++++++++++++++---- pkg/arvo/mar/kiln/approve-merge.hoon | 1 + pkg/arvo/mar/kiln/jump-ask.hoon | 1 + pkg/arvo/mar/kiln/jump-opt.hoon | 1 + pkg/arvo/mar/kiln/jump.hoon | 1 + pkg/arvo/mar/kiln/sync-update.hoon | 1 + pkg/base-dev/mar/kiln/approve-merge.hoon | 22 ++ pkg/base-dev/mar/kiln/jump-ask.hoon | 16 ++ pkg/base-dev/mar/kiln/jump-opt.hoon | 22 ++ pkg/base-dev/mar/kiln/jump.hoon | 43 ++++ pkg/base-dev/mar/kiln/sync-update.hoon | 50 ++++ pkg/base-dev/sur/hood.hoon | 37 ++- 21 files changed, 534 insertions(+), 56 deletions(-) create mode 100644 pkg/arvo/gen/hood/approve-merge.hoon create mode 100644 pkg/arvo/gen/hood/global-automerge.hoon create mode 100644 pkg/arvo/gen/hood/jump/approve.hoon create mode 100644 pkg/arvo/gen/hood/jump/propose.hoon create mode 100644 pkg/arvo/gen/hood/jump/reject.hoon create mode 100644 pkg/arvo/gen/hood/sync-automerge.hoon create mode 100644 pkg/arvo/gen/jumps.hoon create mode 100644 pkg/arvo/gen/updates.hoon create mode 120000 pkg/arvo/mar/kiln/approve-merge.hoon create mode 120000 pkg/arvo/mar/kiln/jump-ask.hoon create mode 120000 pkg/arvo/mar/kiln/jump-opt.hoon create mode 120000 pkg/arvo/mar/kiln/jump.hoon create mode 120000 pkg/arvo/mar/kiln/sync-update.hoon create mode 100644 pkg/base-dev/mar/kiln/approve-merge.hoon create mode 100644 pkg/base-dev/mar/kiln/jump-ask.hoon create mode 100644 pkg/base-dev/mar/kiln/jump-opt.hoon create mode 100644 pkg/base-dev/mar/kiln/jump.hoon create mode 100644 pkg/base-dev/mar/kiln/sync-update.hoon diff --git a/pkg/arvo/app/hood.hoon b/pkg/arvo/app/hood.hoon index 91b2ec4b82..57727514ca 100644 --- a/pkg/arvo/app/hood.hoon +++ b/pkg/arvo/app/hood.hoon @@ -2,8 +2,8 @@ /+ drum=hood-drum, helm=hood-helm, kiln=hood-kiln |% +$ state - $~ [%26 *state:drum *state:helm *state:kiln] - $>(%26 any-state) + $~ [%27 *state:drum *state:helm *state:kiln] + $>(%27 any-state) :: +$ any-state $% [ver=?(%1 %2 %3 %4 %5 %6) lac=(map @tas fin-any-state)] @@ -27,6 +27,7 @@ [%24 drum=state-4:drum helm=state-2:helm kiln=state-10:kiln] [%25 drum=state-5:drum helm=state-2:helm kiln=state-10:kiln] [%26 drum=state-6:drum helm=state-2:helm kiln=state-10:kiln] + [%27 drum=state-6:drum helm=state-2:helm kiln=state-11:kiln] == +$ any-state-tuple $: drum=any-state:drum diff --git a/pkg/arvo/gen/hood/approve-merge.hoon b/pkg/arvo/gen/hood/approve-merge.hoon new file mode 100644 index 0000000000..58a49cc5a2 --- /dev/null +++ b/pkg/arvo/gen/hood/approve-merge.hoon @@ -0,0 +1,6 @@ +:- %say +|= $: [now=@da eny=@uvJ bec=beak] + [syd=desk her=ship sud=desk approve=? ~] + ~ + == +kiln-approve-merge+[[syd her sud] approve] diff --git a/pkg/arvo/gen/hood/global-automerge.hoon b/pkg/arvo/gen/hood/global-automerge.hoon new file mode 100644 index 0000000000..d8992f54e2 --- /dev/null +++ b/pkg/arvo/gen/hood/global-automerge.hoon @@ -0,0 +1,6 @@ +:- %say +|= $: [now=@da eny=@uvJ bec=beak] + [auto=? ~] + ~ + == +kiln-global-automerge+auto diff --git a/pkg/arvo/gen/hood/jump/approve.hoon b/pkg/arvo/gen/hood/jump/approve.hoon new file mode 100644 index 0000000000..ce3a3b0182 --- /dev/null +++ b/pkg/arvo/gen/hood/jump/approve.hoon @@ -0,0 +1,6 @@ +:- %say +|= $: [now=@da eny=@uvJ bec=beak] + [old=dock new=dock ~] + ~ + == +kiln-jump-opt+[old new &] diff --git a/pkg/arvo/gen/hood/jump/propose.hoon b/pkg/arvo/gen/hood/jump/propose.hoon new file mode 100644 index 0000000000..75ba21a2db --- /dev/null +++ b/pkg/arvo/gen/hood/jump/propose.hoon @@ -0,0 +1,16 @@ +/+ *generators +:- %ask +|= $: [now=@da eny=@uvJ bec=beak] + [syd=desk her=ship sud=desk ~] + hard=_| + == +?: hard (produce %kiln-jump-propose syd her sud) +=/ msg + leaf+"Are you sure you want to tell subscribers to get ". + "updates for {} from {}/{(trip sud)}?" +%+ print msg +%+ prompt [%& %prompt "(y/N) "] +|= in=tape +?. |(=("y" in) =("Y" in) =("yes" in)) + no-product +(produce %kiln-jump-propose syd her sud) diff --git a/pkg/arvo/gen/hood/jump/reject.hoon b/pkg/arvo/gen/hood/jump/reject.hoon new file mode 100644 index 0000000000..b1a885c5f4 --- /dev/null +++ b/pkg/arvo/gen/hood/jump/reject.hoon @@ -0,0 +1,6 @@ +:- %say +|= $: [now=@da eny=@uvJ bec=beak] + [old=dock new=dock ~] + ~ + == +kiln-jump-opt+[old new |] diff --git a/pkg/arvo/gen/hood/sync-automerge.hoon b/pkg/arvo/gen/hood/sync-automerge.hoon new file mode 100644 index 0000000000..7daf36fcab --- /dev/null +++ b/pkg/arvo/gen/hood/sync-automerge.hoon @@ -0,0 +1,6 @@ +:- %say +|= $: [now=@da eny=@uvJ bec=beak] + [syd=desk her=ship sud=desk auto=(unit ?) ~] + ~ + == +kiln-sync-automerge+[[syd her sud] auto] diff --git a/pkg/arvo/gen/jumps.hoon b/pkg/arvo/gen/jumps.hoon new file mode 100644 index 0000000000..78c7ac5aad --- /dev/null +++ b/pkg/arvo/gen/jumps.hoon @@ -0,0 +1,16 @@ +/- h=hood +:- %say +|= [[now=@da eny=@uvJ bec=beak] ~ ~] +:- %tang +^- tang +=+ .^ hop=jump:h + %gx + (scot %p p.bec) + %hood + (scot %da now) + /kiln/jumps/noun + == +?> ?=(%all -.hop) +%+ turn ~(tap by all.hop) +|= [old=dock new=dock] +leaf+"{}/{(trip q.old)} -> {}/{(trip q.new)}" diff --git a/pkg/arvo/gen/updates.hoon b/pkg/arvo/gen/updates.hoon new file mode 100644 index 0000000000..94bbe88c51 --- /dev/null +++ b/pkg/arvo/gen/updates.hoon @@ -0,0 +1,16 @@ +/- h=hood +:- %say +|= [[now=@da eny=@uvJ bec=beak] ~ ~] +:- %tang +^- tang +=+ .^ upd=sync-update:h + %gx + (scot %p p.bec) + %hood + (scot %da now) + /kiln/pending/noun + == +?> ?=(%pending -.upd) +%+ turn ~(tap in pending.upd) +|= [sync-record:h rev=@ud] +leaf+"{} <- {}/{(trip sud)}/{}" diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index 2f36bce8ed..28fcbda692 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -5,7 +5,8 @@ =, format =* dude dude:gall |% -+$ state state-10 ++$ state state-11 ++$ state-11 [%11 pith-11] +$ state-10 [%10 pith-10] +$ state-9 [%9 pith-9] +$ state-8 [%8 pith-9] @@ -19,7 +20,8 @@ +$ state-0 [%0 pith-0] +$ any-state $~ *state - $% state-10 + $% state-11 + state-10 state-9 state-8 state-7 @@ -32,10 +34,32 @@ state-0 == :: ++$ pith-11 + $: rem=(map desk per-desk) + nyz=@ud + zyn=(map sync-record sync-state) + :: requests from publishers to switch sync source + hop=(map dock dock) + :: toggle global update auto-merge + mer=? + :: + commit-timer=[way=wire nex=@da tim=@dr mon=term] + :: map desk to the currently ongoing fuse request + :: and the latest version numbers for beaks to + fus=(map desk per-fuse) + :: used for fuses - every time we get a fuse we + :: bump this. used when calculating hashes to + :: ensure they're unique even when the same + :: request is made multiple times. + hxs=(map desk @ud) + == +:: ++$ sync-state-10 [nun=@ta kid=(unit desk) let=@ud] +:: +$ pith-10 $: rem=(map desk per-desk) nyz=@ud - zyn=(map kiln-sync sync-state) + zyn=(map sync-record sync-state-10) commit-timer=[way=wire nex=@da tim=@dr mon=term] :: map desk to the currently ongoing fuse request :: and the latest version numbers for beaks to @@ -50,7 +74,7 @@ +$ pith-9 $: wef=(unit weft) rem=(map desk per-desk) - syn=(map kiln-sync let=@ud) + syn=(map sync-record let=@ud) ark=(map desk arak-9) commit-timer=[way=wire nex=@da tim=@dr mon=term] :: map desk to the currently ongoing fuse request @@ -78,7 +102,7 @@ +$ pith-7 $: wef=(unit weft) rem=(map desk per-desk) - syn=(map kiln-sync let=@ud) + syn=(map sync-record let=@ud) ark=(map desk arak-7) commit-timer=[way=wire nex=@da tim=@dr mon=term] :: map desk to the currently ongoing fuse request @@ -121,7 +145,7 @@ +$ pith-6 $: wef=(unit weft) rem=(map desk per-desk) :: - syn=(map kiln-sync let=@ud) :: + syn=(map sync-record let=@ud) :: ark=(map desk arak-6) :: commit-timer=[way=wire nex=@da tim=@dr mon=term] :: :: map desk to the currently ongoing fuse request @@ -139,7 +163,7 @@ :: +$ pith-5 $: rem=(map desk per-desk) :: - syn=(map kiln-sync let=@ud) :: + syn=(map sync-record let=@ud) :: ark=(map desk arak-6) :: commit-timer=[way=wire nex=@da tim=@dr mon=term] :: :: map desk to the currently ongoing fuse request @@ -154,7 +178,7 @@ :: +$ pith-4 :: $: rem=(map desk per-desk) :: - syn=(map kiln-sync let=@ud) :: + syn=(map sync-record let=@ud) :: ark=(map desk arak-4) :: commit-timer=[way=wire nex=@da tim=@dr mon=term] :: :: map desk to the currently ongoing fuse request @@ -175,7 +199,7 @@ == +$ pith-3 :: $: rem=(map desk per-desk) :: - syn=(map kiln-sync let=@ud) :: + syn=(map sync-record let=@ud) :: ark=(map desk arak-3) :: commit-timer=[way=wire nex=@da tim=@dr mon=term] :: :: map desk to the currently ongoing fuse request @@ -201,7 +225,7 @@ :: +$ pith-2 :: $: rem=(map desk per-desk) :: - syn=(map kiln-sync let=@ud) :: + syn=(map sync-record let=@ud) :: ota=(unit [=ship =desk =aeon]) :: commit-timer=[way=wire nex=@da tim=@dr mon=term] :: fus=(map desk per-fuse) @@ -209,13 +233,13 @@ == :: +$ pith-1 :: $: rem=(map desk per-desk) :: - syn=(map kiln-sync let=@ud) :: + syn=(map sync-record let=@ud) :: ota=(unit [=ship =desk =aeon]) :: commit-timer=[way=wire nex=@da tim=@dr mon=term] :: == :: +$ pith-0 :: $: rem=(map desk per-desk) :: - syn=(map kiln-sync let=@ud) :: + syn=(map sync-record let=@ud) :: autoload-on=? :: cur-hoon=@uvI :: cur-arvo=@uvI :: @@ -245,16 +269,6 @@ pot=term :: == +$ kiln-unmount $@(term [knot path]) :: -+$ kiln-sync :: - $: syd=desk :: local desk - her=ship :: foreign ship - sud=desk :: foreign desk - == -+$ kiln-unsync :: - $: syd=desk :: local desk - her=ship :: foreign ship - sud=desk :: foreign desk - == +$ kiln-merge :: $@ ~ $: syd=desk :: @@ -285,7 +299,6 @@ +$ kiln-fuse-list (unit desk) -- |= [bowl:gall state] -?> =(src our) =| moz=(list card:agent:gall) |% ++ kiln . @@ -440,7 +453,7 @@ =^ cards-9=(list card:agent:gall) old ?. ?=(%9 -.old) `old - =/ syn=(set kiln-sync) + =/ syn=(set sync-record) %- ~(gas in ~(key by syn.old)) %+ murn ~(tap by ark.old) |= [=desk =arak-9] @@ -468,8 +481,8 @@ [%pass /kiln/load-zest %arvo %c %zest desk zest] :: %+ turn ~(tap in syn) - |= k=kiln-sync - [%pass /kiln/load-sync %agent [our %hood] %poke %kiln-sync !>(k)] + |= r=sync-record + [%pass /kiln/load-sync %agent [our %hood] %poke %kiln-sync !>(r)] :: =/ ks ~(tap in syn) |- ^- (list card:agent:gall) @@ -483,7 +496,17 @@ $(ks t.ks) == :: - ?> ?=(%10 -.old) + =? old ?=(%10 -.old) + %= old + - %11 + |4 [hop=~ mer=& |4.old] + zyn %- ~(run by zyn.old) + |= sync-state-10 + ^- sync-state + [nun kid let ~ ~ |] + == + :: + ?> ?=(%11 -.old) =. state old abet:(emil cards-9) :: @@ -499,8 +522,10 @@ =/ ver (mergebase-hashes our %base now (~(got by sources) %base)) ``noun+!>(?~(ver 0v0 i.ver)) :: - [%x %kiln %syncs ~] ``noun+!>(zyn) - [%x %kiln %sources ~] ``noun+!>(sources) + [%x %kiln %jumps ~] ``kiln-jump+!>([%all hop]) + [%x %kiln %syncs ~] ``noun+!>(zyn) + [%x %kiln %sources ~] ``noun+!>(sources) + [%x %kiln %automerge ~] ``loob+!>(mer) [%x %kiln %pikes ~] =+ .^(=rock:tire %cx /(scot %p our)//(scot %da now)/tire) :^ ~ ~ %kiln-pikes @@ -511,6 +536,17 @@ =+ .^(hash=@uv %cz /(scot %p our)/[desk]/(scot %da now)) =/ sync (~(get by sources) desk) [sync hash zest wic] + :: + [%x %kiln %pending ~] + :^ ~ ~ %kiln-sync-update + !> ^- sync-update + :- %pending + %- ~(gas by *(set [sync-record @ud])) + ^- (list [sync-record @ud]) + %+ murn ~(tap by zyn) + |= [sync-record sync-state] + ?~ hav ~ + (some [syd her sud] u.hav) == :: :: +get-germ: select merge strategy into local desk @@ -528,12 +564,15 @@ :: ++ poke |= [=mark =vase] + ?> |(=(src our) =(%kiln-jump-ask mark)) ?+ mark ~|([%poke-kiln-bad-mark mark] !!) + %kiln-approve-merge =;(f (f !<(_+<.f vase)) poke-approve-merge) %kiln-autocommit =;(f (f !<(_+<.f vase)) poke-autocommit) %kiln-bump =;(f (f !<(_+<.f vase)) poke-bump) %kiln-cancel =;(f (f !<(_+<.f vase)) poke-cancel) %kiln-cancel-autocommit =;(f (f !<(_+<.f vase)) poke-cancel-autocommit) %kiln-commit =;(f (f !<(_+<.f vase)) poke-commit) + %kiln-sync-automerge =;(f (f !<(_+<.f vase)) poke-sync-automerge) %kiln-fuse =;(f (f !<(_+<.f vase)) poke-fuse) %kiln-fuse-list =;(f (f !<(_+<.f vase)) poke-fuse-list) %kiln-gall-sear =;(f (f !<(_+<.f vase)) poke-gall-sear) @@ -543,12 +582,16 @@ %kiln-label =;(f (f !<(_+<.f vase)) poke-label) %kiln-merge =;(f (f !<(_+<.f vase)) poke-merge) %kiln-mount =;(f (f !<(_+<.f vase)) poke-mount) + %kiln-jump-ask =;(f (f !<(_+<.f vase)) poke-jump-ask) + %kiln-jump-opt =;(f (f !<(_+<.f vase)) poke-jump-opt) + %kiln-jump-propose =;(f (f !<(_+<.f vase)) poke-jump-propose) %kiln-nuke =;(f (f !<(_+<.f vase)) poke-nuke) %kiln-pause =;(f (f !<(_+<.f vase)) poke-pause) %kiln-permission =;(f (f !<(_+<.f vase)) poke-permission) %kiln-revive =;(f (f !<(_+<.f vase)) poke-revive) %kiln-rein =;(f (f !<(_+<.f vase)) poke-rein) %kiln-rm =;(f (f !<(_+<.f vase)) poke-rm) + %kiln-global-automerge =;(f (f !<(_+<.f vase)) poke-global-automerge) %kiln-schedule =;(f (f !<(_+<.f vase)) poke-schedule) %kiln-suspend =;(f (f !<(_+<.f vase)) poke-suspend) %kiln-suspend-many =;(f (f !<(_+<.f vase)) poke-suspend-many) @@ -559,6 +602,19 @@ %kiln-unsync =;(f (f !<(_+<.f vase)) poke-unsync) == :: +++ poke-approve-merge + |= [sync-record approve=?] + ?~ got=(~(get by zyn) syd her sud) + =+ msg="kiln: no syncs from {(scow %p her)}/{(trip sud)} to {}" + ((slog leaf+msg ~) abet) + ?~ hav.u.got + =+ msg="kiln: no updates from {(scow %p her)}/{(trip sud)} for {}" + ((slog leaf+msg ~) abet) + =< abet + ?. approve + abet:drop:(sync syd her sud) + abet:(merg /main syd):(sync syd her sud) +:: ++ poke-autocommit |= [mon=kiln-commit auto=?] =< abet @@ -679,6 +735,23 @@ |= =ship abet:(emit %pass /kiln %arvo %g %sear ship) :: +++ poke-global-automerge + |= auto=? + =. mer auto + ?. mer abet + =/ zyns=(list [sync-record sync-state]) ~(tap by zyn) + =< abet + |- + ?~ zyns ..abet + ?. ?& ?=(^ hav.i.zyns) + !?=([~ %.n] nit.i.zyns) + == + $(zyns t.zyns) + %= $ + zyns t.zyns + ..abet abet:(merg /main syd):(sync -.i.zyns) + == +:: ++ poke-info |= [mez=tape tor=(unit toro)] ?~ tor @@ -692,17 +765,20 @@ ?~ got=(~(get by rock) loc) %dead zest.u.got - =. zyn + =. ..abet ?~ got=(~(get by sources) loc) - zyn - (~(del by zyn) loc u.got) + ..abet + ?: =([her rem] u.got) + ..abet + =. ..abet abet:drop:(sync loc u.got) + ..abet(zyn (~(del by zyn) loc u.got)) =? ..abet ?=(%dead zest) (emit %pass /kiln/install %arvo %c %zest loc ?:(=(our her) %live %held)) ?: (~(has by zyn) loc her rem) abet:(spam (render "already syncing" loc her rem ~) ~) ?: =([our loc] [her rem]) abet - =/ sun (sync loc her rem) + =/ sun okay:(sync loc her rem) ~> %slog.(fmt "beginning install into {here:sun}") =< abet:abet:init ?: =(%base loc) @@ -710,7 +786,7 @@ sun :: ++ poke-kids - |= [hos=kiln-sync nex=(unit desk)] + |= [hos=sync-record nex=(unit desk)] abet:abet:(apex:(sync hos) nex) :: ++ poke-label @@ -731,6 +807,84 @@ abet:(spam leaf+- ~) abet:(emit %pass /mount %arvo %c [%mont pot u.bem]) :: +++ poke-jump-propose + |= [syd=desk her=ship sud=desk] + ?: =([our syd] [her sud]) + abet + =/ let=@ud ud:.^(cass:clay %cw /(scot %p our)/[syd]/(scot %da now)) + =/ subs=(set [@p rave:clay]) + .^((set [@p rave:clay]) %cx /(scot %p our)//(scot %da now)/cult/[syd]) + =/ ships=(set @p) + %+ roll ~(tap in subs) + |= [[=ship =rave:clay] ships=(set @p)] + ?: =(our ship) ships + ?. ?=([%sing %w [%ud @] ~] rave) ships + ?. =(+(let) p.case.mood.rave) ships + (~(put in ships) ship) + =< abet + %- emil + %+ turn ~(tap in ships) + |= =ship + :* %pass /kiln/jump-propose %agent [ship %hood] + %poke %kiln-jump-ask !>([[our syd] [her sud]]) + == +:: +++ poke-jump-ask + |= [old=dock new=dock] + ?> |(=(src p.old) =(src our)) + ?: =(old new) + ?~ had=(~(get by hop) old) + abet + =. hop (~(del by hop) old) + abet:(emit %give %fact ~[/jumps] %kiln-jump !>([%nay old u.had])) + ?~ (skim ~(tap by sources) |=(sync-record =(old [her sud]))) + ~> %slog.(fmt "no syncs from {}/{(trip q.old)}") + abet + =. hop (~(put by hop) old new) + abet:(emit %give %fact ~[/jumps] %kiln-jump !>([%add old new])) +:: +++ poke-jump-opt + |= [old=dock new=dock yea=?] + ?~ got=(~(get by hop) old) + ~> %slog.(fmt "no jump request for {}/{(trip q.old)}") + abet + ?. =(new u.got) + =/ txt-old "{}/{(trip q.old)}" + =/ txt-new "{}/{(trip q.new)}" + ~> %slog.(fmt "no jump request from {txt-old} to {txt-new}") + abet + ?. yea + =/ txt-old "{}/{(trip q.old)}" + =/ txt-new "{}/{(trip q.new)}" + ~> %slog.(fmt "denied jump from {txt-old} to {txt-new}") + =. hop (~(del by hop) old) + abet:(emit %give %fact ~[/jumps] %kiln-jump !>([%nay old new])) + =/ old-sources=(list sync-record) + (skim ~(tap by sources) |=(sync-record =(old [her sud]))) + =/ new-sources=(list sync-record) + (turn old-sources |=(sync-record [syd new])) + =. ..abet + (emit %give %fact ~[/jumps] %kiln-jump !>([%yea old new])) + =. ..abet + |- + ?~ old-sources + ..abet + =. ..abet abet:drop:(sync i.old-sources) + =. zyn (~(del by zyn) i.old-sources) + $(old-sources t.old-sources, ..abet ..abet) + =. hop (~(del by hop) old) + =< abet + |- ^+ ..abet + ?~ new-sources ..abet + %= $ + new-sources t.new-sources + ..abet =/ sun (sync i.new-sources) + =< abet:init + ?: =(%base syd.i.new-sources) + (apex:sun `%kids) + sun + == +:: ++ poke-nuke |= [=term desk=?] =< abet @@ -801,11 +955,28 @@ |=(=desk [%pass /kiln/suspend %arvo %c %zest desk %dead]) :: ++ poke-sync - |= hos=kiln-sync - ?: (~(has by zyn) hos) - abet:(spam (render "already syncing" [sud her syd ~]:hos) ~) - ~> %slog.(fmt "beginning sync into {} from {}/{}") - abet:abet:init:(sync hos) + |= sync-record + ?: (~(has by zyn) sud her syd) + abet:(spam (render "already syncing" [sud her syd ~]) ~) + =. ..abet + ?~ got=(~(get by sources) syd) + ..abet + =. ..abet abet:drop:(sync syd u.got) + ..abet(zyn (~(del by zyn) syd u.got)) + ~> %slog.(fmt "beginning sync into {} from {}/{}") + abet:abet:init:(sync syd her sud) +:: +++ poke-sync-automerge + |= [sync-record auto=(unit ?)] + ?~ got=(~(get by zyn) syd her sud) + =+ msg="kiln: no syncs from {(scow %p her)}/{(trip sud)} to {}" + ((slog leaf+msg ~) abet) + =. zyn (~(put by zyn) [syd her sud] u.got(nit auto)) + ?~ hav.u.got + abet + ?. |(?=([~ %.y] auto) &(mer ?=(~ auto))) + abet + abet:abet:(merg /main syd):(sync [syd her sud]) :: ++ poke-syncs :: print sync config |= ~ @@ -813,7 +984,7 @@ ?: =(0 ~(wyt by zyn)) [%leaf "no syncs configured"]~ %+ turn ~(tap by zyn) - |= [kiln-sync sync-state] + |= [sync-record sync-state] (render "sync configured" sud her syd kid) :: ++ poke-uninstall @@ -841,9 +1012,10 @@ :: Don't need to cancel anything because new syncs will get a new nonce :: ++ poke-unsync - |= hus=kiln-unsync + |= hus=sync-record ?~ got=(~(get by zyn) hus) abet:(spam (render "not syncing" [sud her syd ~]:hus) ~) + =. ..abet abet:drop:(sync hus) =. zyn (~(del by zyn) hus) abet:(spam (render "cancelling sync" sud.hus her.hus syd.hus kid.u.got) ~) :: +peer: handle %watch @@ -851,10 +1023,26 @@ ++ peer |= =path ?> (team:title our src) - ?: =(0 1) abet :: avoid mint-vain ?+ path ~|(kiln-path/path !!) [%vats ~] (mean leaf+"kiln: old subscription to /kiln/vats failed" ~) + :: + [%jumps ~] + abet:(emit %give %fact ~ %kiln-jump !>([%all hop])) + :: + [%updates ~] + =< abet + %- emit + :^ %give %fact ~ + :- %kiln-sync-update + !> ^- sync-update + :- %pending + %- ~(gas by *(set [sync-record @ud])) + ^- (list [sync-record @ud]) + %+ murn ~(tap by zyn) + |= [sync-record sync-state] + ?~ hav ~ + (some [syd her sud] u.hav) == :: ++ take-agent @@ -864,6 +1052,8 @@ ~? ?=(^ p.sign) [%kiln-poke-nack u.p.sign] abet ~|([%kiln-bad-take-agent wire -.sign] !!) + :: + [%change-publisher ~] abet :: [%fancy *] ?> ?=(%poke-ack -.sign) @@ -1078,15 +1268,30 @@ abet:abet:(take:(sync syd her sud) t.t.t.wire sign-arvo) :: ++ sync - |= kiln-sync + |= sync-record =/ got (~(get by zyn) syd her sud) - =+ `sync-state`(fall got [(scot %uv nyz) ~ *@ud]) + =+ `sync-state`(fall got [(scot %uv nyz) ~ *@ud ~ ~ |]) =? nyz ?=(~ got) +(nyz) |% - ++ abet ..sync(zyn (~(put by zyn) [syd her sud] nun kid let)) + ++ abet ..sync(zyn (~(put by zyn) [syd her sud] nun kid let nit hav yea)) ++ apex |=(nex=(unit desk) ..abet(kid nex)) ++ emit |=(card:agent:gall ..abet(kiln (^emit +<))) ++ emil |=((list card:agent:gall) ..abet(kiln (^emil +<))) + ++ okay ..abet(yea &) + ++ gain + =. hav `(dec let) + =/ upd=sync-update [%new [syd her sud] (dec let)] + (emit %give %fact ~[/update] %kiln-sync-update !>(upd)) + ++ drop + =? ..abet ?=(^ hav) + =/ upd=sync-update [%drop [syd her sud] u.hav] + (emit %give %fact ~[/updates] %kiln-sync-update !>(upd)) + ..abet(hav ~, yea |) + ++ tada + =? ..abet ?=(^ hav) + =/ upd=sync-update [%done [syd her sud] u.hav] + (emit %give %fact ~[/updates] %kiln-sync-update !>(upd)) + ..abet(hav ~, yea |) ++ here "{} from {}/{}" ++ ware |= =wire @@ -1101,7 +1306,6 @@ %merg desk her sud ud+(dec let) (get-germ desk) == - :: :: (re)Start a sync from scratch by finding what version the source :: desk is at :: @@ -1129,8 +1333,8 @@ ?> ?=(^ riot) :: The syncs may have changed, so get the latest :: - ;< zyx=(map kiln-sync sync-state) bind:m - (scry:strandio (map kiln-sync sync-state) /gx/hood/kiln/syncs/noun) + ;< zyx=(map sync-record sync-state) bind:m + (scry:strandio (map sync-record sync-state) /gx/hood/kiln/syncs/noun) ?. (~(has by zyx) syd her sud) (pure:m !>(%done)) ~> %slog.(fmt "downloading update for {here}") @@ -1175,6 +1379,7 @@ ?: ?=(%| -.p.sign-arvo) :: ~> %slog.(fmt "download failed into {here}; retrying sync") :: %- (slog p.p.sign-arvo) + =. ..abet drop init :: ~> %slog.(fmt "finished downloading update for {here}") @@ -1182,7 +1387,7 @@ :: If nothing changed, just ensure %kids is up-to-date and advance :: ?. (get-remote-diff our syd now [her sud (dec let)]) - =< next + =< next:drop ?~ kid ~> %slog.(fmt "remote is identical to {here}, skipping") ..abet @@ -1191,15 +1396,22 @@ ..abet ~> %slog.(fmt "remote is identical to {here}, merging into {}") (merg /kids u.kid) + :: wait for approval if can't automerge & signal available update + :: + ?. |(=(our her) yea =([~ &] nit) &(=(~ nit) mer)) + =. ..abet gain + next :: Else start merging, but also immediately start listening to :: the next revision. Now, all errors should no-op -- we're :: already waiting for the next revision. :: + =. yea | =. ..abet (merg /main syd) next :: - %main + %main ?> ?=(%mere +<.sign-arvo) + =< tada ?: ?=(%| -.p.sign-arvo) =+ "kiln: merge into {here} failed, waiting for next revision" %- (slog leaf/- p.p.sign-arvo) diff --git a/pkg/arvo/mar/kiln/approve-merge.hoon b/pkg/arvo/mar/kiln/approve-merge.hoon new file mode 120000 index 0000000000..cceb68cc1b --- /dev/null +++ b/pkg/arvo/mar/kiln/approve-merge.hoon @@ -0,0 +1 @@ +../../../base-dev/mar/kiln/approve-merge.hoon \ No newline at end of file diff --git a/pkg/arvo/mar/kiln/jump-ask.hoon b/pkg/arvo/mar/kiln/jump-ask.hoon new file mode 120000 index 0000000000..c13477815d --- /dev/null +++ b/pkg/arvo/mar/kiln/jump-ask.hoon @@ -0,0 +1 @@ +../../../base-dev/mar/kiln/jump-ask.hoon \ No newline at end of file diff --git a/pkg/arvo/mar/kiln/jump-opt.hoon b/pkg/arvo/mar/kiln/jump-opt.hoon new file mode 120000 index 0000000000..2b49747d07 --- /dev/null +++ b/pkg/arvo/mar/kiln/jump-opt.hoon @@ -0,0 +1 @@ +../../../base-dev/mar/kiln/jump-opt.hoon \ No newline at end of file diff --git a/pkg/arvo/mar/kiln/jump.hoon b/pkg/arvo/mar/kiln/jump.hoon new file mode 120000 index 0000000000..c8e8202368 --- /dev/null +++ b/pkg/arvo/mar/kiln/jump.hoon @@ -0,0 +1 @@ +../../../base-dev/mar/kiln/jump.hoon \ No newline at end of file diff --git a/pkg/arvo/mar/kiln/sync-update.hoon b/pkg/arvo/mar/kiln/sync-update.hoon new file mode 120000 index 0000000000..93eaa91d50 --- /dev/null +++ b/pkg/arvo/mar/kiln/sync-update.hoon @@ -0,0 +1 @@ +../../../base-dev/mar/kiln/sync-update.hoon \ No newline at end of file diff --git a/pkg/base-dev/mar/kiln/approve-merge.hoon b/pkg/base-dev/mar/kiln/approve-merge.hoon new file mode 100644 index 0000000000..b1b25fa64f --- /dev/null +++ b/pkg/base-dev/mar/kiln/approve-merge.hoon @@ -0,0 +1,22 @@ +:: +:::: /hoon/approve-merge/kiln/mar + :: +/- h=hood +|_ req=[sync-record:h approve=?] +:: +++ grow + |% + ++ noun req + -- +++ grab + |% + ++ noun ,[sync-record:h approve=?] + ++ json + =, dejs:format + %- ot + :~ [%sync (ot syd+so her+(se %p) sud+so ~)] + [%approve bo] + == + -- +++ grad %noun +-- diff --git a/pkg/base-dev/mar/kiln/jump-ask.hoon b/pkg/base-dev/mar/kiln/jump-ask.hoon new file mode 100644 index 0000000000..0e6ce52be7 --- /dev/null +++ b/pkg/base-dev/mar/kiln/jump-ask.hoon @@ -0,0 +1,16 @@ +:: +:::: /hoon/jump-ask/kiln/mar + :: +/? 310 +|_ req=[old=dock new=dock] +:: +++ grow + |% + ++ noun req + -- +++ grab + |% + ++ noun ,[dock dock] + -- +++ grad %noun +-- diff --git a/pkg/base-dev/mar/kiln/jump-opt.hoon b/pkg/base-dev/mar/kiln/jump-opt.hoon new file mode 100644 index 0000000000..f03d2d2b03 --- /dev/null +++ b/pkg/base-dev/mar/kiln/jump-opt.hoon @@ -0,0 +1,22 @@ +:: +:::: /hoon/jump-opt/kiln/mar + :: +|_ req=[old=dock new=dock yea=?] +:: +++ grow + |% + ++ noun req + -- +++ grab + |% + ++ noun ,[dock dock ?] + ++ json + =, dejs:format + %- ot + :~ [%old (ot ship+(se %p) desk+so ~)] + [%new (ot ship+(se %p) desk+so ~)] + [%yea bo] + == + -- +++ grad %noun +-- diff --git a/pkg/base-dev/mar/kiln/jump.hoon b/pkg/base-dev/mar/kiln/jump.hoon new file mode 100644 index 0000000000..540f35a893 --- /dev/null +++ b/pkg/base-dev/mar/kiln/jump.hoon @@ -0,0 +1,43 @@ +:: +:::: /hoon/jump/kiln/mar + :: +/- h=hood +|_ jum=jump:h +:: +++ grow + |% + ++ noun jum + ++ json + =, enjs:format + |^ ^- ^json + ?- -.jum + %add + %+ frond 'add' + (pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~) + :: + %yea + %+ frond 'yea' + (pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~) + :: + %nay + %+ frond 'nay' + (pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~) + :: + %all + %+ frond 'all' + :- %a + %+ turn ~(tap by all.jum) + |= [old=dock new=dock] + (pairs ['old' (en-dock old)] ['new' (en-dock new)] ~) + == + ++ en-dock + |= =dock + (pairs ['ship' s+(scot %p p.dock)] ['desk' s+q.dock] ~) + -- + -- +++ grab + |% + ++ noun jump:h + -- +++ grad %noun +-- diff --git a/pkg/base-dev/mar/kiln/sync-update.hoon b/pkg/base-dev/mar/kiln/sync-update.hoon new file mode 100644 index 0000000000..20a3166558 --- /dev/null +++ b/pkg/base-dev/mar/kiln/sync-update.hoon @@ -0,0 +1,50 @@ +:: +:::: /hoon/sync-update/kiln/mar + :: +/- h=hood +|_ upd=sync-update:h +:: +++ grow + |% + ++ noun upd + ++ json + =, enjs:format + |^ ^- ^json + ?- -.upd + %new + %+ frond 'new' + (pairs ['for' (en-sync-record for.upd)] ['rev' (numb rev.upd)] ~) + :: + %done + %+ frond 'done' + (pairs ['for' (en-sync-record for.upd)] ['rev' (numb rev.upd)] ~) + :: + %drop + %+ frond 'drop' + (pairs ['for' (en-sync-record for.upd)] ['rev' (numb rev.upd)] ~) + :: + %pending + %+ frond 'pending' + :- %a + %+ turn ~(tap by pending.upd) + |= [for=sync-record:h rev=@ud] + %- pairs + :~ ['for' (en-sync-record for)] + ['rev' (numb rev)] + == + == + ++ en-sync-record + |= sync-record:h + %- pairs + :~ ['syd' s+syd] + ['her' s+(scot %p her)] + ['sud' s+sud] + == + -- + -- +++ grab + |% + ++ noun sync-update:h + -- +++ grad %noun +-- diff --git a/pkg/base-dev/sur/hood.hoon b/pkg/base-dev/sur/hood.hoon index 5c736f2714..1b5e58ca44 100644 --- a/pkg/base-dev/sur/hood.hoon +++ b/pkg/base-dev/sur/hood.hoon @@ -10,12 +10,41 @@ == :: +$ pikes (map desk pike) -:: +:: $jump: changes to update source change requests +:: ++$ jump + $% [%all all=(map dock dock)] :: pending requests + [%add old=dock new=dock] :: new request + [%yea old=dock new=dock] :: approved + [%nay old=dock new=dock] :: denied + == :: $rung: reference to upstream commit :: +$ rung [=aeon =weft] +:: #sync-record: source and destination of a kiln sync +:: ++$ sync-record :: + $: syd=desk :: local desk + her=ship :: foreign ship + sud=desk :: foreign desk + == +:: ++$ sync-state :: + $: nun=@ta :: nonce + kid=(unit desk) :: has kids desk too? + let=@ud :: next revision + nit=(unit ?) :: automerge or default + hav=(unit @ud) :: update available + yea=? :: update approved + == +:: ++$ sync-update + $% [%new for=sync-record rev=@ud] + [%done for=sync-record rev=@ud] + [%drop for=sync-record rev=@ud] + [%pending pending=(set [for=sync-record rev=@ud])] + == :: -+$ sync-state [nun=@ta kid=(unit desk) let=@ud] +$ sink (unit [her=@p sud=desk kid=(unit desk) let=@ud]) :: +truncate-hash: get last 5 digits of hash and convert to tape :: @@ -101,7 +130,7 @@ :: +report-vat: report on a single desk installation :: ++ report-vat - |= $: $: tyr=rock:tire =cone sor=(map desk [ship desk]) + |= $: $: tyr=rock:tire =cone sor=(map desk (pair ship desk)) zyn=(map [desk ship desk] sync-state) == our=ship now=@da syd=desk verb=? @@ -137,7 +166,7 @@ ~ ?~ z=(~(get by zyn) syd u.s) ~ - `[-.u.s +.u.s +.u.z] + `[p.u.s q.u.s [kid let]:u.z] =/ meb=(list @uv) ?~ sink [hash]~ (mergebase-hashes our syd now her.u.sink sud.u.sink) From 39105cfeed56726a74480cb1ebd96b9683daecc5 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Thu, 21 Sep 2023 16:24:23 +0100 Subject: [PATCH 061/252] ames: make key acquisition asynchronous --- bin/solid.pill | 4 +- pkg/arvo/app/spider.hoon | 3 +- pkg/arvo/sys/lull.hoon | 5 ++- pkg/arvo/sys/vane/ames.hoon | 82 ++++++++++++++++++++++++---------- pkg/arvo/sys/vane/gall.hoon | 57 ++++++++++++++++++----- pkg/base-dev/lib/strandio.hoon | 2 +- 6 files changed, 112 insertions(+), 41 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 13883ce068..87803c7695 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:feaae0eece54db3e92122263706c283674af581d14ffde8a29fb24e1873a35b1 -size 6453015 +oid sha256:38f5a8c55b699c99a8fa2e0315ed0a63ba80e4c1c18dcbb85b3af3c4bf1e36f0 +size 6786502 diff --git a/pkg/arvo/app/spider.hoon b/pkg/arvo/app/spider.hoon index 09123c34b3..35e4363e16 100644 --- a/pkg/arvo/app/spider.hoon +++ b/pkg/arvo/app/spider.hoon @@ -490,7 +490,8 @@ %+ roll cards.r |= [=card cards=(list card) s=_state] :_ =? scrying.s ?=([%pass ^ %arvo %a %keen @ *] card) - (~(put ju scrying.s) tid [&2 &6 |6]:card) + :: wire ship path + scrying.s :: (~(put ju scrying.s) tid [&2 +>+>+>]:card) s :_ cards ^- ^card diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index 3f52616254..801b2c1035 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -801,11 +801,11 @@ [%kroc bones=(list [ship bone])] $>(%plea vane-task) [%deep =deep] - [%lock ~] :: - [%keen spar] + [%keen secret=? spar] [%yawn spar] [%wham spar] + [%plug ~] :: $>(%born vane-task) $>(%init vane-task) @@ -843,6 +843,7 @@ [%lost ~] [%send =lane =blob] :: + [%stub num=@ud key=@] [%tune spar roar=(unit roar)] :: [%turf turfs=(list turf)] diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 4d11b222d3..2f7658e4cf 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -1205,8 +1205,9 @@ +$ task-11-and-16 $+ task-11-and-16 $% [%kroc dry=?] + [%keen spar] [%snub ships=(list ship)] - $<(?(%snub %kroc) task) + $<(?(%snub %kroc %keen) task) == :: +$ queued-event-16 @@ -1218,7 +1219,20 @@ +$ task-16 $+ task-16 $% [%kroc dry=?] - $<(%kroc task) + [%keen spar] + $<(?(%kroc %keen) task) + == +:: ++$ queued-event-17 + $+ queued-event-17 + $% [%call =duct wrapped-task=(hobo task-17)] + [%take =wire =duct =sign] + == +:: ++$ task-17 + $+ task-17 + $% [%keen spar] + $<(%keen task) == :: $bug: debug printing configuration :: @@ -1587,7 +1601,7 @@ == == $: %17 $% $: %larva - events=(qeu queued-event) + events=(qeu queued-event-17) state=ames-state-17 == [%adult state=ames-state-17] @@ -1671,7 +1685,7 @@ [%10 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%10 state.old] - =. queued-events (event-11-to-17 events.old) + =. queued-events (event-11-to-18 events.old) larval-gate :: [%11 %adult *] @@ -1682,7 +1696,7 @@ [%11 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%11 state.old] - =. queued-events (event-11-to-17 events.old) + =. queued-events (event-11-to-18 events.old) larval-gate :: [%12 %adult *] @@ -1693,7 +1707,7 @@ [%12 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%12 state.old] - =. queued-events (event-16-to-17 events.old) + =. queued-events (event-16-to-18 events.old) larval-gate :: [%13 %adult *] @@ -1704,7 +1718,7 @@ [%13 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%13 state.old] - =. queued-events (event-16-to-17 events.old) + =. queued-events (event-16-to-18 events.old) larval-gate :: [%14 %adult *] @@ -1715,7 +1729,7 @@ [%14 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%14 state.old] - =. queued-events (event-16-to-17 events.old) + =. queued-events (event-16-to-18 events.old) larval-gate :: [%15 %adult *] @@ -1726,7 +1740,7 @@ [%15 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%15 state.old] - =. queued-events (event-16-to-17 events.old) + =. queued-events (event-16-to-18 events.old) larval-gate :: [%16 %adult *] @@ -1737,7 +1751,7 @@ [%16 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%16 state.old] - =. queued-events (event-16-to-17 events.old) + =. queued-events (event-16-to-18 events.old) larval-gate :: [%17 %adult *] @@ -1748,7 +1762,7 @@ [%17 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%17 state.old] - =. queued-events events.old + =. queued-events (event-17-to-18 events.old) larval-gate :: @@ -1775,7 +1789,7 @@ wrapped-task ?.(?=(%snub -.task) task [%snub %deny ships.task]) == :: - ++ event-11-to-17 + ++ event-11-to-18 |= events=(qeu queued-event-11-and-16) ^- (qeu queued-event) %- ~(rep in events) @@ -1788,10 +1802,11 @@ ?+ -.task task %snub [%snub %deny ships.task] %kroc [%kroc ~] + %keen [%keen | +.task] == == :: - ++ event-16-to-17 + ++ event-16-to-18 |= events=(qeu queued-event-16) ^- (qeu queued-event) %- ~(rep in events) @@ -1799,8 +1814,25 @@ %- ~(put to q) ^- queued-event ?. ?=(%call -.e) e =/ task=task-16 ((harden task-16) wrapped-task.e) - %= e - wrapped-task ?.(?=(%kroc -.task) task [%kroc ~]) + %= e + wrapped-task + ^- ^task + ?+ -.task task + %kroc [%kroc ~] + %keen [%keen | +.task] + == + == + :: + ++ event-17-to-18 + |= events=(qeu queued-event-17) + ^- (qeu queued-event) + %- ~(rep in events) + |= [e=queued-event-17 q=(qeu queued-event)] + %- ~(put to q) ^- queued-event + ?. ?=(%call -.e) e + =/ task=task-17 ((harden task-17) wrapped-task.e) + %= e + wrapped-task ?.(?=(%keen -.task) task [%keen | +.task]) == -- :: +molt: re-evolve to adult-ames @@ -2912,15 +2944,17 @@ :: +on-vega: handle kernel reload :: ++ on-vega event-core - :: +on-lock: handle key reservation - ++ on-lock + :: +on-plug: handle key reservation + ++ on-plug ^+ event-core - =/ key (shaz eny) - ~& chain/chain.ames-state - =/ idx .+(-:(need (ram:on:chain chain.ames-state))) + =/ key=@ (shaz eny) :: TODO: check key width + =/ num=@ud + ?~ latest=(ram:on:chain chain.ames-state) + 0 + key.u.latest =. chain.ames-state - (put:on:chain chain.ames-state idx key) - event-core + (put:on:chain chain.ames-state num key) + (emit duct %give %stub num key) :: +on-trim: handle request to free memory :: :: %ruin comets not seen for six months @@ -2944,7 +2978,7 @@ +| %fine-entry-points :: ++ on-keen - |= spar + |= [secret=? spar] ^+ event-core =+ ~:(spit path) :: assert length =/ ship-state (~(get by peers.ames-state) ship) @@ -5019,7 +5053,7 @@ %tame (on-tame:event-core ship.task) %kroc (on-kroc:event-core bones.task) %deep (on-deep:event-core deep.task) - %lock on-lock:event-core + %plug on-plug:event-core :: %keen (on-keen:event-core +.task) %yawn (on-cancel-scry:event-core | +.task) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 7addcb05fe..2bb8be605d 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -106,6 +106,7 @@ sky=(map spur path-state) ken=(jug spar:ames wire) cop=(map coop hutch) + hat=(jug coop [path page]) == == :: +$ path-state @@ -202,6 +203,7 @@ sky=(map spur path-state) ken=(jug spar:ames wire) cop=(map coop hutch) + hat=(jug coop [path page]) == == -- :: adult gall vane interface, for type compatibility with pupa @@ -613,6 +615,23 @@ =. mo-core (mo-give %unto %kick ~) mo-core == + ++ mo-handle-key + ~/ %mo-handle-stub + |= [=(pole knot) num=@ud key=@] + ?. ?=([agent=@ nonce=@ rest=*] pole) + ~& [%mo-handle-key-bad-wire wire] + !! + =* dap agent.pole + =/ yoke (~(get by yokes.state) dap) + ?. ?=([~ %live *] yoke) + %- (slog leaf+"gall: {} dead, got %stub" ~) + mo-core + ?. =(run-nonce.u.yoke nonce.pole) + %- (slog leaf+"gall: got old stub for {}" ~) + mo-core + =/ =routes [disclosing=~ attributing=[our /]] + =/ ap-core (ap-abed:ap dap routes) + ap-abet:(ap-stub:ap-core rest.pole num key) :: +mo-handle-use: handle a typed +sign incoming on /use. :: :: (Note that /use implies the +sign should be routed to an agent.) @@ -1066,7 +1085,10 @@ ++ ap-tend |= [=coop =path =page] ?. (~(has by cop.yoke) coop) - ~| no-such-coop/coop !! :: XX: error handling + ?. (~(has by hat.yoke) coop) + ~| no-such-coop/coop !! :: XX: error handling + =. hat.yoke (~(put ju hat.yoke) coop path page) + ap-core =/ =hutch (~(got by cop.yoke) coop) =. chicks.hutch (~(put by chicks.hutch) path page) =. cop.yoke (~(put by cop.yoke) coop hutch) @@ -1074,13 +1096,23 @@ ++ ap-germ |= =coop =/ key=@uvJ (shax eny) :: TODO: review key generation - =/ =hutch - ?~ hut=(~(get by cop.yoke) coop) - *hutch :: TODO: fix - =. lock.u.hut *lock - u.hut + =/ hut (~(get by cop.yoke) coop) + =? hat.yoke ?=(~ hut) + (~(put by hat.yoke) coop ~) + =/ =wire (welp /key/[agent-name]/[run-nonce.yoke] coop) + (ap-move [hen %pass wire %a %plug ~]~) + :: + ++ ap-stub + |= [=coop num=@ud key=@] + ^+ ap-core + =/ =hutch + (~(gut by cop.yoke) coop *hutch) + =. lock.hutch [.+(rev.lock.hutch) num] =. cop.yoke (~(put by cop.yoke) coop hutch) - ap-core + =/ hat ~(tap in (~(get ju hat.yoke) coop)) + |- ^+ ap-core + ?~ hat ap-core + $(hat t.hat, ap-core (ap-tend coop i.hat)) :: ++ ap-snip |= =coop @@ -1433,7 +1465,7 @@ %- zing %+ turn ~(tap by `(jug spar:ames wire)`ken.yoke) |= [=spar:ames wyz=(set wire)] - (turn ~(tap in wyz) |=(=wire [%pass wire %arvo %a %keen spar])) + (turn ~(tap in wyz) |=(=wire [%pass wire %arvo %a %keen | spar])) =^ error ap-core (ap-install(agent.yoke &+agent) `old-state) ?~ error @@ -1880,7 +1912,7 @@ %+ roll fex |= [=carp ken=_ken.yoke] ?+ carp ken - [%pass * %arvo %a %keen spar=*] (~(put ju ken) [spar.q p]:carp) + [%pass * %arvo %a %keen @ spar=*] (~(put ju ken) [spar.q p]:carp) [%pass * %arvo %a %yawn spar=*] (~(del ju ken) [spar.q p]:carp) == :: +ap-handle-kicks: handle cancels of bitt.watches @@ -2299,9 +2331,8 @@ |= egg=egg-13 ?: ?=(%nuke -.egg) egg - egg(ken [ken.egg ~]) + egg(ken [ken.egg ~ ~]) == - :: ++ spore-13-to-14 |= old=spore-13 @@ -2531,6 +2562,10 @@ ?: =(/clear-huck wire) =/ =gift ?>(?=([%behn %heck %gall *] syn) +>+.syn) [[duct %give gift]~ gall-payload] + ?: ?=([%key *] wire) + ~| [%gall-take-key-failed wire] + ?> ?=([%ames %stub *] syn) + mo-abet:(mo-handle-key:(mo-abed:mo duct) t.wire [num key]:syn) :: ~| [%gall-take-failed wire] ?> ?=([?(%sys %use) *] wire) diff --git a/pkg/base-dev/lib/strandio.hoon b/pkg/base-dev/lib/strandio.hoon index c2f2137194..a7ab469761 100644 --- a/pkg/base-dev/lib/strandio.hoon +++ b/pkg/base-dev/lib/strandio.hoon @@ -335,7 +335,7 @@ |= [=wire =spar:ames] =/ m (strand ,~) ^- form:m - (send-raw-card %pass wire %arvo %a %keen spar) + (send-raw-card %pass wire %arvo %a %keen | spar) :: ++ sleep |= for=@dr From 6baed5cfcb9f89e04b00426e96b5eac81120ca00 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Fri, 22 Sep 2023 14:14:25 -0400 Subject: [PATCH 062/252] chum: initial (two-party encrypted remote scry) --- pkg/arvo/sys/lull.hoon | 2 + pkg/arvo/sys/vane/ames.hoon | 89 +++++++++++++++++++++++++++++++++++-- 2 files changed, 87 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index 464bf1d026..0149ef66ae 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -805,6 +805,7 @@ [%deep =deep] :: [%keen spar] + [%chum spar] [%yawn spar] [%wham spar] :: @@ -845,6 +846,7 @@ [%send =lane =blob] :: [%tune spar roar=(unit roar)] + [%near spar dat=(unit page)] :: [%turf turfs=(list turf)] == diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index f2c19b28ca..1b6e9d7a4a 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -1226,7 +1226,7 @@ +$ note $~ [%b %wait *@da] $% $: %a - $>(%deep task:ames) + $>(?(%deep %keen) task:ames) == $: %b $>(?(%wait %rest) task:behn) @@ -1255,7 +1255,10 @@ :: +$ sign $~ [%behn %wake ~] - $% $: %behn + $% $: %ames + $>(%tune gift:ames) + == + $: %behn $>(%wake gift:behn) == $: %gall @@ -2402,6 +2405,29 @@ %- (slog leaf+"ames: no peer-state for {(scow %p ship)}, ignoring" ~) event-core abet:on-tame:(abed-peer:pe ship u.peer-state) + :: + :: + ++ on-tune + |= [=wire s=[=ship path=(pole knot)] roar=(unit roar)] + ^+ event-core + ?> ?=([%chum *] wire) + :: XX save or decrypt path? + :: + =/ per (~(get by peers.ames-state) ship.s) + ?> ?=([~ %known *] per) + ?> ?=([%a %x %~.1 %$ %chum her=@ lyf=@ cyf=@ ~] path.s) + =/ pax + =- (,path (cue -)) + (dy:crub:crypto symmetric-key.u.per (slav %uv cyf.path.s)) + =/ dat=(unit page) + ?: ?| ?=(~ roar) + ?=(~ q.dat.u.roar) + == + ~ :: XX wrong + ?> ?=([%atom @] u.q.dat.u.roar) + =- ?~(- ~ `(,page (cue -))) + (dy:crub:crypto symmetric-key.u.per q.u.q.dat.u.roar) + (emit duct [%give %near [ship.s pax] dat]) :: +on-cork: handle request to kill a flow :: ++ on-cork @@ -2948,6 +2974,22 @@ |= todos=alien-agenda todos(keens (~(put ju keens.todos) path duct)) :: + ++ on-chum + |= spar + ^+ event-core + =+ ~:(spit path) :: assert length + =/ ship-state (~(get by peers.ames-state) ship) + ?: ?=([~ %known *] ship-state) + =/ cyf (scot %uv (en:crub:crypto symmetric-key.u.ship-state (jam path))) + =/ lav /a/x/1//chum/(scot %p our)/(scot %ud life.ames-state)/[cyf] + (emit duct [%pass /chum %a %keen ship lav]) + :: XX add state for queued chum + :: + :: %^ enqueue-alien-todo ship ship-state + :: |= todos=alien-agenda + :: todos(keens (~(put ju keens.todos) path duct)) + !! + :: ++ on-cancel-scry |= [all=? spar] ^+ event-core @@ -5018,6 +5060,7 @@ %deep (on-deep:event-core deep.task) :: %keen (on-keen:event-core +.task) + %chum (on-chum:event-core +.task) %yawn (on-cancel-scry:event-core | +.task) %wham (on-cancel-scry:event-core & +.task) == @@ -5041,6 +5084,8 @@ ?- sign [@ %done *] (on-take-done:event-core wire error.sign) [@ %boon *] (on-take-boon:event-core wire payload.sign) + :: + [%ames %tune *] (on-tune:event-core wire [[ship path] roar]:sign) :: [%behn %wake *] (on-take-wake:event-core wire error.sign) :: @@ -5306,6 +5351,37 @@ =* lot=coin $/r.bem =* tyl s.bem :: + ?: ?& =(&+our why) + =([%$ %ud 1] lot) + =(%$ syd) + =(%x ren) + == + => .(tyl `(pole knot)`tyl) + ?+ tyl ~ + [%chum her=@ lyf=@ cyf=@ ~] + ?~ who=(slaw %p her.tyl) + [~ ~] + =/ per (~(get by peers.ames-state) u.who) + ?. ?=([~ %known *] per) + [~ ~] + ?~ lyf=(slaw %ud lyf.tyl) + [~ ~] + ?. =(life.u.per u.lyf) + [~ ~] + ?~ cyf=(slaw %uv cyf.tyl) + [~ ~] + =/ pax + =- (,path (cue -)) + (dy:crub:crypto symmetric-key.u.per u.cyf) + ?~ blk=(de-part:balk our 0 0 pax) + [~ ~] + ?~ res=(rof `[u.who ~ ~] /ames (as-omen:balk u.blk)) + ~ + =- ``atom+!>(`@ux`-) + %+ en:crub:crypto symmetric-key.u.per + ?~(u.res ~ (jam [p q.q]:u.u.res)) + == + :: :: only respond for the local identity, %$ desk, current timestamp :: ?. ?& =(&+our why) @@ -5446,7 +5522,14 @@ ~| nom |^ =/ van ?@(vis.nom (end 3 vis.nom) way.vis.nom) + =/ kyr ?@(vis.nom (rsh 3 vis.nom) car.vis.nom) ?+ van ~ + %a + %- en-hunk + ?+ kyr ~ + %x (rof ~ /ames nom) + == + :: %c =+ pem=(rof lyc /ames nom(vis %cp)) ?. ?=(^ pem) ~ @@ -5457,14 +5540,12 @@ (en-hunk (rof ~ /ames nom)) :: %e - =/ kyr ?@(vis.nom (rsh 3 vis.nom) car.vis.nom) %- en-hunk ?+ kyr ~ %x (rof ~ /ames nom) == :: %g - =/ kyr ?@(vis.nom (rsh 3 vis.nom) car.vis.nom) %- en-hunk ?+ kyr ~ %x (rof ~ /ames nom) From 754215f9ae96e02b8b4322ff6dbcbf1d0dd4b51f Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Mon, 25 Sep 2023 18:39:39 +0100 Subject: [PATCH 063/252] ames, gall: encrypted remote scry works end to end --- pkg/arvo/sys/lull.hoon | 8 +- pkg/arvo/sys/vane/ames.hoon | 131 +++++++--- pkg/arvo/sys/vane/clay.hoon | 2 +- pkg/arvo/sys/vane/eyre.hoon | 2 +- pkg/arvo/sys/vane/gall.hoon | 441 +++++++++++++++++++++++++-------- pkg/base-dev/lib/strandio.hoon | 2 +- 6 files changed, 445 insertions(+), 141 deletions(-) diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index 801b2c1035..36f2e92822 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -802,10 +802,10 @@ $>(%plea vane-task) [%deep =deep] :: - [%keen secret=? spar] + [%keen sec=(unit [idx=@ key=@]) spar] [%yawn spar] [%wham spar] - [%plug ~] + [%plug vane=term =path] :: $>(%born vane-task) $>(%init vane-task) @@ -932,10 +932,12 @@ :: $hoot: request packet payload :: $yowl: serialized response packet payload :: $hunk: a slice of $yowl fragments + :: $lock: keys for remote scry :: +$ hoot @uxhoot +$ yowl @uxyowl +$ hunk [lop=@ len=@] + +$ lock [idx=@ key=@] :: :: +| %kinetics :: $dyad: pair of sender and receiver ships @@ -2786,6 +2788,8 @@ [%tend =coop =path =page] [%germ =coop] [%snip =coop] + :: + [%keen secret=? spar:ames] == +$ task $% [%watch =path] diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 2f7658e4cf..417d7ec07e 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -111,8 +111,8 @@ ++ chain =< mop |% - ++ on ((^on ,@ ,@) lte) - +$ mop ((^mop ,@ ,@) lte) + ++ on ((^on ,@ ,[key=@ =path]) lte) + +$ mop ((^mop ,@ ,[key=@ =path]) lte) -- :: :: +trace: print if .verb is set and we're tracking .ship @@ -586,6 +586,7 @@ == :: =chain + atlas=(map path @ud) == :: +$ ames-state-17 @@ -1802,7 +1803,7 @@ ?+ -.task task %snub [%snub %deny ships.task] %kroc [%kroc ~] - %keen [%keen | +.task] + %keen [%keen ~ +.task] == == :: @@ -1819,7 +1820,7 @@ ^- ^task ?+ -.task task %kroc [%kroc ~] - %keen [%keen | +.task] + %keen [%keen ~ +.task] == == :: @@ -1832,7 +1833,7 @@ ?. ?=(%call -.e) e =/ task=task-17 ((harden task-17) wrapped-task.e) %= e - wrapped-task ?.(?=(%keen -.task) task [%keen | +.task]) + wrapped-task ?.(?=(%keen -.task) task [%keen ~ +.task]) == -- :: +molt: re-evolve to adult-ames @@ -1885,9 +1886,6 @@ |=([@da =duct] ?=([[%ames %recork *] *] duct)) :: ?> ?=(%18 -.u.cached-state) - =? chain.u.cached-state =(~ chain.u.cached-state) - ~& init-first-keypair/(shaz eny) - (put:on:chain chain.u.cached-state 1 (shaz eny)) :: TODO: review keygen =. ames-state.adult-gate +.u.cached-state [moz larval-core(cached-state ~)] @@ -2946,14 +2944,17 @@ ++ on-vega event-core :: +on-plug: handle key reservation ++ on-plug + |= [vane=term =path] ^+ event-core + ~& plug/[vane path] =/ key=@ (shaz eny) :: TODO: check key width =/ num=@ud - ?~ latest=(ram:on:chain chain.ames-state) + ?~ latest=(pry:on:chain chain.ames-state) 0 - key.u.latest + .+(key.u.latest) =. chain.ames-state - (put:on:chain chain.ames-state num key) + (put:on:chain chain.ames-state num [key path]) + =. atlas.ames-state (~(put by atlas.ames-state) [vane path] num) (emit duct %give %stub num key) :: +on-trim: handle request to free memory :: @@ -2978,8 +2979,13 @@ +| %fine-entry-points :: ++ on-keen - |= [secret=? spar] + |= [sec=(unit [idx=@ key=@]) spar] ^+ event-core + ~& path/path + =? path ?=(^ sec) + =- ~&(new-path/- -) + =/ enc (scot %uv (~(en cbcc:aes:crypto [key.u.sec 0]) (spat path))) + /a/e/(scot %ud idx.u.sec)/[enc] =+ ~:(spit path) :: assert length =/ ship-state (~(get by peers.ames-state) ship) ?: ?=([~ %known *] ship-state) @@ -5019,9 +5025,6 @@ ^- [(list move) _ames-gate] :: =/ =task ((harden task) wrapped-task) - =? chain.ames-state =(~ chain.ames-state) - ~& init-first-keypair/(shaz eny) - (put:on:chain chain.ames-state 1 (shaz eny)) =/ event-core (ev [now eny rof] duct ames-state) :: =^ moves ames-state @@ -5053,7 +5056,7 @@ %tame (on-tame:event-core ship.task) %kroc (on-kroc:event-core bones.task) %deep (on-deep:event-core deep.task) - %plug on-plug:event-core + %plug (on-plug:event-core [vane path]:task) :: %keen (on-keen:event-core +.task) %yawn (on-cancel-scry:event-core | +.task) @@ -5335,7 +5338,7 @@ |= old=ames-state-17 ^- ^ames-state %= old - dead [dead.old ~] + dead [dead.old ~ ~] == -- :: +scry: dereference namespace @@ -5388,14 +5391,14 @@ ``noun+!>(protocol-version) :: [%chain %latest ~] - ``noun+!>(`[idx=@ key=@]`(need (ram:on:chain chain.ames-state))) + ``noun+!>(`[idx=@ key=@ =path]`(need (ram:on:chain chain.ames-state))) :: [%chain idx=@ ~] ?~ idx=(slaw %ud idx.tyl) [~ ~] ?~ key=(get:on:chain chain.ames-state u.idx) [~ ~] - ``noun+!>(`[idx=@ key=@]`[u.idx u.key]) + ``noun+!>(`[idx=@ key=@]`[u.idx key.u.key]) :: [%peers ~] :^ ~ ~ %noun @@ -5491,6 +5494,14 @@ :: so we need to give it the right shape :: ?~ blk=(de-path-soft:balk pax.tyl) ~ + ~& blk/blk + =- ~& :- %result + ?- - + ~ ~ + [~ ~] [~ ~] + [~ ~ ^] (scag 500 (text q.u.u.-)) + == + - :: ?. ?& =(our her.u.blk) =(rift.ames-state rif.u.blk) @@ -5518,27 +5529,83 @@ ?+ kyr ~ %x (rof ~ /ames nom) == + :: + %a + =/ kyr ?@(vis.nom (rsh 3 vis.nom) car.vis.nom) + ~& kyr/kyr + ?. =(kyr %e) + ~ + ~& nom + ?. ?=(%ud -.r.bem.nom) + [~ ~] + =/ key + (got:on:chain chain.ames-state p.r.bem.nom) + ~& key/key + ?~ new=(shutter key.key) + [~ ~] + ~& new/(as-omen:balk u.new) + =/ res (rof ~ /ames (as-omen:balk u.new)) + ~& res/res + %- en-hunk + (handle-shut spr.u.new p.r.bem.nom res) :: %g =/ kyr ?@(vis.nom (rsh 3 vis.nom) car.vis.nom) - ?: =(%$ q.bem.nom) :: encrypted case - ?. ?=(%ud -.r.bem.nom) :: XX: check? - [~ ~] - ?. ?=([@ ~] s.bem.nom) - [~ ~] - =/ key - (~(got by chain.ames-state) p.r.bem.nom) - =/ aes ~(. cbcc:aes:crypto [key 0]) - ?~ new=(de-path-soft:balk (stab `@t`(de:aes (slav %uv i.s.bem.nom)))) - [~ ~] - :: XX: assert %gx case?? - :: TODO: enforce permissions w/ scry - (en-hunk-shut (en-path:balk u.new) key (rof ~ /ames (as-omen:balk u.new))) %- en-hunk ?+ kyr ~ %x (rof ~ /ames nom) == == + ++ aes |=(key=@ ~(. cbcc:aes:crypto [key 0])) + ++ shutter + |= key=@ + ^- (unit balk) + ?~ raw=(slaw %uv q.bem.nom) + ~ + =/ txt `@t`(de:(aes key) `@t`u.raw) + ~& txt/txt + ?~ pat=`(unit path)`(rush txt stap) + ~ + (de-path-soft:balk (welp /(scot %p our)/(scot %ud 0)/(scot %ud 1) u.pat)) + ++ close + |= [key-idx=@ value=(unit (unit cage))] + ^- (unit (unit cage)) + ?. ?=([~ ~ *] value) + ~& %bailing-close + value + ~& close/[key-idx chain.ames-state] + ?~ key=(get:on:chain chain.ames-state key-idx) + ~ + ``noun+!>((en:(aes key.u.key) (jam [p q.q]:u.u.value))) + :: + ++ check-key + |= [=path key-idx=@] + ^- ? + ~& check-key/path + =. path + => .(path `(pole knot)`path) + ?. ?=([van=@ car=@ cas=@ app=@ sig=@ rest=*] path) + path + rest.path + ?~ link=(get:on:chain chain.ames-state key-idx) + | + =/ gol path.u.link + |- ^- ? + ~& comparing/[path gol] + ?~ gol & + ?~ path | + ?. =(i.path i.gol) + | + $(path t.path, gol t.gol) + :: + ++ handle-shut + |= [=path key-idx=@ value=(unit (unit cage))] + ^- (unit (unit cage)) +:: ?. (check-key path key-idx) +:: ~& key-validation-failed/[path key-idx ~(key by chain.ames-state)] +:: ~ + (close key-idx value) + :: ++ en-hunk-shut |= [=path key=@ res=(unit (unit cage))] ^- (unit (unit cage)) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 7820f11e1e..7da609a6c5 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -1518,7 +1518,7 @@ [%c care (scot case) desk path] :- [time path] %- emil - :~ [hen %pass wire %a %keen ship path] + :~ [hen %pass wire %a %keen ~ ship path] [hen %pass wire %b %wait time] == :: diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index a9af7d9f07..463ea236ed 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -1716,7 +1716,7 @@ =/ =wire /eauth/keen/(scot %p ship)/(scot %uv nonce) =. time (sub time (mod time ~h1)) =/ =spar:ames [ship /e/x/(scot %da time)//eauth/url] - [duct %pass wire %a ?-(kind %keen keen+spar, %yawn yawn+spar)] + [duct %pass wire %a ?-(kind %keen keen+[~ spar], %yawn yawn+spar)] :: ++ send-boon |= boon=eauth-boon diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 2bb8be605d..108e977369 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -36,12 +36,24 @@ $: veb=_veb-all-off dudes=(set dude) == +++ match-coop + |= [paths=(set path) =path] + ^- (unit coop) + ?: (~(has in paths) path) + `path + ?: =(~ path) + ~ + =. path (flop path) + ?> ?=(^ path) + $(path (flop t.path)) :: +| %main :: :: $move: Arvo-level move :: -+$ move [=duct move=(wind note-arvo gift-arvo)] ++$ move + $+ move + [=duct move=(wind note-arvo gift-arvo)] :: $state-15: overall gall state, versioned :: +$ state-15 [%15 state] @@ -55,6 +67,7 @@ :: bug: debug printing configuration :: +$ state + $+ state $: system-duct=duct outstanding=(map [wire duct] (qeu remote-request)) contacts=(set ship) @@ -68,10 +81,10 @@ $: disclosing=(unit (set ship)) attributing=[=ship =path] == -+$ lock [rev=@ud key=@ud] ++$ lock [rev=@ud idx=@ud key=@] +$ hutch [=lock chicks=(map path page)] -+$ nest ++$ brood [=coop =lock chicks=(set path)] :: $yoke: agent runner state :: @@ -103,17 +116,174 @@ agent=(each agent vase) =beak marks=(map duct mark) - sky=(map spur path-state) + sky=farm ken=(jug spar:ames wire) - cop=(map coop hutch) - hat=(jug coop [path page]) + pen=(map spar:ames wire) == == :: -+$ path-state ++$ plot $: bob=(unit @ud) fan=((mop @ud (pair @da (each page @uvI))) lte) == :: +++ farm + =< farm + |% + +$ farm + $~ [%plot ~ ~] + $% [%coop p=hutch q=(map path plot)] + [%plot p=(unit plot) q=(map @ta farm)] + == + :: + ++ of + |_ =farm + ++ migrate + |= from=(map spur plot) + =/ from ~(tap by from) + |- ^+ farm + ?~ from farm + =. farm (need (put i.from)) + $(from t.from) + :: + ++ match-coop + =| wer=path + |= =path + ^- (unit coop) + ?: ?=(%coop -.farm) + `(flop wer) + ?~ path + ~ + ?~ nex=(~(get by q.farm) i.path) + ~ + $(wer [i.path wer], path t.path, farm u.nex) + ++ put + |= [=path =plot] + ^- (unit _farm) + ?: ?=(%coop -.farm) + `farm(q (~(put by q.farm) path plot)) + ?~ path + `farm(p `plot) + ?~ nex=(~(get by q.farm) i.path) + ~ + =/ res + $(path t.path, farm u.nex) + ?~ res ~ + `farm(q (~(put by q.farm) i.path u.res)) + :: + ++ grow + |= [=spur now=@da =page] + =/ ski (gut spur) + %+ put spur + =- ski(fan (put:on-path fan.ski -< -> &/page)) + ?~ las=(ram:on-path fan.ski) + [(fall bob.ski 0) now] + :_ (max now +(p.val.u.las)) + ?~(bob.ski +(key.u.las) +((max key.u.las u.bob.ski))) + :: + ++ germ + |= [=coop =hutch] + ^- (unit _farm) + ?~ coop + ?. |(=(%coop -.farm) =([%page ~ ~] farm)) + ~ + `[%coop hutch ~] + ?: ?=(%coop -.farm) + ~ + ?~ nex=(~(get by q.farm) i.coop) + ~ + $(coop t.coop, farm u.nex) + :: + ++ tend + |= [=coop =path =plot] + ^- (unit _farm) + ?~ coop + ?. ?=(%coop -.farm) + ~ + `farm(q (~(put by q.farm) path plot)) + ?. ?=(%plot -.farm) + ~ + ?~ nex=(~(get by q.farm) i.coop) + ~ + $(coop t.coop, farm u.nex) + :: + ++ del + |= =path + ^+ farm + ?: ?=(%coop -.farm) + farm(q (~(del by q.farm) path)) + ?~ path + farm(p ~) + ?~ nex=(~(get by q.farm) i.path) + farm + $(path t.path, farm u.nex) + :: + ++ gut + |= =path + ^- plot + (fall (get path) *plot) + :: + ++ put-hutch + |= [=path =hutch] + ^- (unit _farm) + ?~ path + ?: ?=(%coop -.farm) + `farm(p hutch) + ?. =([%plot ~ ~] farm) + ~ + `[%coop hutch ~] + ?: ?=(%coop -.farm) + ~ + =/ nex (~(gut by q.farm) i.path *^farm) + =/ res $(path t.path, farm nex) + ?~ res ~ + `farm(q (~(put by q.farm) i.path u.res)) + :: + ++ get-hutch + |= =path + ^- (unit hutch) + ?~ path + ?. ?=(%coop -.farm) + ~ + `p.farm + ?: ?=(%coop -.farm) + ~ + ?~ nex=(~(get by q.farm) i.path) + ~ + $(path t.path, farm u.nex) + :: + ++ get + |= =path + ^- (unit plot) + ?: ?=(%coop -.farm) + (~(get by q.farm) path) + ?~ path + p.farm + ?~ nex=(~(get by q.farm) i.path) + ~ + $(path t.path, farm u.nex) + ++ tap-plot + =| wer=path + |- ^- (list [path plot]) + =* tap-plot $ + ?: ?=(%coop -.farm) + %+ turn ~(tap by q.farm) + |= [=path =plot] + [(welp wer path) plot] + %+ welp ?~(p.farm ~ [wer u.p.farm]~) + %- zing + %+ turn ~(tap by q.farm) + |= [seg=@ta f=^farm] + ^- (list [path plot]) + tap-plot(wer (snoc wer seg), farm f) + ++ run-plot + |* fun=gate + %- ~(gas by *(map path _(fun))) + %+ turn tap-plot + |= [=path =plot] + [path (fun plot)] + -- + -- +:: ++ on-path ((on @ud (pair @da (each page @uvI))) lte) :: $blocked-move: enqueued move to an agent :: @@ -143,20 +313,14 @@ :: %u: leave :: +$ ames-request-all - $% [%0 ames-request-0] - [%1 ames-request] + $% [%0 ames-request] == -+$ ames-request-0 ++$ ames-request $% [%m =mark noun=*] [%l =mark =path] [%s =path] [%u ~] == -:: -+$ ames-request - $% ames-request-0 - [%c =path] - == :: $remote-request: kinds of agent actions that can cross the network :: :: Used in wires to identify the kind of remote request we made. @@ -200,10 +364,9 @@ old-state=[%| vase] =beak marks=(map duct mark) - sky=(map spur path-state) + sky=farm ken=(jug spar:ames wire) - cop=(map coop hutch) - hat=(jug coop [path page]) + pen=(map spar:ames wire) == == -- :: adult gall vane interface, for type compatibility with pupa @@ -338,9 +501,9 @@ code agent agent &+agent run-nonce (scot %uw (end 5 (shas %yoke-nonce eny))) - sky - ?~ yak ~ - (~(run by sky.u.yak) (corl (late ~) (lead ~))) + sky *farm + :: ?~ yak ~ + :: ~ :: TODO: revive (~(run by sky.u.yak) (corl (late ~) (lead ~))) == :: =/ old mo-core @@ -368,7 +531,7 @@ =. mo-core (mo-track-ship ship) ?< ?=(?(%raw-poke %poke-as) -.deal) =/ =ames-request-all - :- %1 + :- %0 ?- -.deal %poke [%m p.cage.deal q.q.cage.deal] %leave [%u ~] @@ -617,12 +780,13 @@ == ++ mo-handle-key ~/ %mo-handle-stub - |= [=(pole knot) num=@ud key=@] + |= [=(pole knot) syn=sign-arvo] + ~& mo-handle-key/pole ?. ?=([agent=@ nonce=@ rest=*] pole) ~& [%mo-handle-key-bad-wire wire] !! =* dap agent.pole - =/ yoke (~(get by yokes.state) dap) + =/ yoke (~(get by yokes.state) agent.pole) ?. ?=([~ %live *] yoke) %- (slog leaf+"gall: {} dead, got %stub" ~) mo-core @@ -630,8 +794,15 @@ %- (slog leaf+"gall: got old stub for {}" ~) mo-core =/ =routes [disclosing=~ attributing=[our /]] - =/ ap-core (ap-abed:ap dap routes) - ap-abet:(ap-stub:ap-core rest.pole num key) + =/ ap-core (ap-abed:ap agent.pole routes) + ?+ rest.pole ~|(mo-handle-key-bad-wire/wire !!) + [%pug rest=*] + ?> ?=([%ames %stub *] syn) + ap-abet:(ap-stub:ap-core rest.rest.pole [num key]:syn) + :: + [%bod rest=*] + ap-abet:(ap-take-brood:ap-core rest.rest.pole syn) + == :: +mo-handle-use: handle a typed +sign incoming on /use. :: :: (Note that /use implies the +sign should be routed to an agent.) @@ -760,8 +931,8 @@ |= =^yoke ?: ?=(%nuke -.yoke) yoke :- %nuke - %- ~(run by sky.yoke) - |= path-state + %- ~(run-plot of:farm sky.yoke) + |= plot (fall (clap bob (bind (ram:on-path fan) head) max) 0) :: +mo-load: install agents :: @@ -888,6 +1059,21 @@ %_ mo-core blocked.state (~(put by blocked.state) agent blocked) == + :: +mo-handle-key-request: handle request for keys + ++ mo-handle-key-request + |= [=ship agent-name=term =path] + ^+ mo-core + ~& key-req/[ship agent-name path] + =/ yok=(unit yoke) (~(get by yokes.state) agent-name) + ?. ?=([~ %live *] yok) + (mo-give %done ~) + =/ ap-core (ap-abed:ap agent-name [~ our /gall]) + =^ bod=(unit brood) mo-core + (ap-serve-brood:ap-core ship path) + ?~ bod + (mo-give %done ~) + =. mo-core (mo-give %boon u.bod) + (mo-give %done ~) :: +mo-handle-ames-request: handle %ames request message. :: ++ mo-handle-ames-request @@ -905,10 +1091,6 @@ (mo-give %flub ~) ?: ?=(%.n -.agent.u.yok) (mo-give %flub ~) - ?: ?=(%c -.ames-request) - =/ ap-core (ap-abed:ap agent-name [~ ship /]) - =< ap-abet - (ap-coop-request:ap-core ship +.ames-request) :: =/ =wire /sys/req/(scot %p ship)/[agent-name] :: @@ -1012,27 +1194,64 @@ yokes.state running moves moves == - :: - ++ ap-coop-request - |= [=ship =path] - ?~ cop=(ap-match-coop path) - :: TODO: behaviour on missing + ++ ap-request-brood + |= [=wire =ship =(pole knot)] + ^+ ap-core + ?. ?=([%g %x cas=@ app=@ rest=*] pole) + ~& malformed-path/pole ap-core + ~& pole/pole + =. pen.yoke (~(put by pen.yoke) [ship pole] wire) + =/ =plea:ames [%g /gk/[app.pole] rest.pole] + =/ out=^wire (welp /key/[agent-name]/[run-nonce.yoke]/bod/(scot %p ship) pole) + :: =/ =wire (welp /key/pug/[agent-name]/[run-nonce.yoke] coop) + :: TODO: add to state? + (ap-move [hen %pass out %a %plea ship plea]~) + :: + ++ ap-take-brood + |= [=wire syn=sign-arvo] + ^+ ap-core + ~| ap-take-brood/wire + ?> ?=([@ *] wire) :: TODO: strip crash semantics + =/ =ship (slav %p i.wire) + ?+ syn ~|(weird-sign-ap-take-brood/-.syn !!) + [%ames %boon *] + ~& boon/wire + =+ bod=((soft ,brood) payload.syn) + ?~ bod :: TODO: what happens + ~& weird-take-brood/payload.syn !! + =/ key key.lock.u.bod + =/ out=^wire (~(got by pen.yoke) [ship t.wire]) + ~& sending-keen/[out t.wire] + (ap-pass out %arvo %a %keen `[idx key]:lock.u.bod ship t.wire) + :: + [%ames %done *] + ~& acked-brood/[t.wire syn] + ap-core + == + :: + ++ ap-serve-brood + |= [=ship =(pole knot)] + ^- [(unit brood) _mo-core] + ~& serve-pole/pole + ?. ?=([%$ rest=*] pole) + `ap-abet + ?~ cop=(ap-match-coop rest.pole) + `ap-abet =/ cag=(unit (unit cage)) (ap-peek %| %c (snoc u.cop (scot %p ship))) =/ has-perms=? ?. ?=([~ ~ ^] cag) | - ;;(? q.u.u.cag) - =/ =hutch (~(got by cop.yoke) u.cop) - ?: has-perms - =/ =nest - =,(hutch [u.cop lock ~(key by chicks)]) - =/ =ames-response - [%d %gall-nest nest] - (ap-move [agent-duct %give %boon ames-response]~) - ap-core - + ?~ res=((soft ,?) q.q.u.u.cag) + | + u.res + =/ =hutch (need (~(get-hutch of:farm sky.yoke) u.cop)) + ?. has-perms + `ap-abet + =/ =brood + =,(hutch [u.cop lock ~(key by chicks)]) + [`brood ap-abet] :: ++ ap-yawn-all ^- (list card:agent) @@ -1073,50 +1292,59 @@ ++ ap-match-coop |= =path ^- (unit coop) - ?: (~(has by cop.yoke) path) - `path - ?: =(~ path) - ~ - =. path (flop path) - ?> ?=(^ path) - $(path (flop t.path)) + (~(match-coop of:farm sky.yoke) path) + :: + ++ ap-keen + |= [=wire secret=? =spar:ames] + ^+ ap-core + ?: secret + (ap-request-brood wire spar) + =. ken.yoke (~(put ju ken.yoke) spar wire) + (ap-pass wire %arvo %a %keen ~ spar) + :: :: :: +ap-tend: bind path in namespace, encrypted ++ ap-tend |= [=coop =path =page] - ?. (~(has by cop.yoke) coop) - ?. (~(has by hat.yoke) coop) + + ?~ cop=(~(get-hutch of:farm sky.yoke) coop) + :: ?. (~(has by hat.yoke) coop) ~| no-such-coop/coop !! :: XX: error handling - =. hat.yoke (~(put ju hat.yoke) coop path page) - ap-core - =/ =hutch (~(got by cop.yoke) coop) - =. chicks.hutch (~(put by chicks.hutch) path page) - =. cop.yoke (~(put by cop.yoke) coop hutch) + ::=. hat.yoke (~(put ju hat.yoke) coop path page) + :: ap-core TODO: revivie + =. sky.yoke (need (~(grow of:farm sky.yoke) (welp coop path) now page)) ap-core + :: ++ ap-germ |= =coop - =/ key=@uvJ (shax eny) :: TODO: review key generation - =/ hut (~(get by cop.yoke) coop) - =? hat.yoke ?=(~ hut) - (~(put by hat.yoke) coop ~) - =/ =wire (welp /key/[agent-name]/[run-nonce.yoke] coop) - (ap-move [hen %pass wire %a %plug ~]~) + ::=/ hut (~(get by cop.yoke) coop) + :: =? hat.yoke ?=(~ hut) TODO: revive + :: (~(put by hat.yoke) coop ~) + =/ =wire (welp /key/[agent-name]/[run-nonce.yoke]/pug coop) + (ap-move [hen %pass wire %a %plug %g [agent-name %$ coop]]~) :: ++ ap-stub |= [=coop num=@ud key=@] ^+ ap-core =/ =hutch - (~(gut by cop.yoke) coop *hutch) - =. lock.hutch [.+(rev.lock.hutch) num] - =. cop.yoke (~(put by cop.yoke) coop hutch) - =/ hat ~(tap in (~(get ju hat.yoke) coop)) - |- ^+ ap-core - ?~ hat ap-core - $(hat t.hat, ap-core (ap-tend coop i.hat)) + ?^ h=(~(get-hutch of:farm sky.yoke) coop) + u.h + *hutch + =. lock.hutch [.+(rev.lock.hutch) num key] + =. sky.yoke + ?^ new-sky=(~(put-hutch of:farm sky.yoke) coop hutch) + u.new-sky + sky.yoke + ap-core + :: =/ hat ~(tap in (~(get ju hat.yoke) coop)) + :: |- ^+ ap-core + :: ?~ hat ap-core + :: $(hat t.hat, ap-core (ap-tend coop i.hat)) :: ++ ap-snip |= =coop - ap-core(cop.yoke (~(del by cop.yoke) coop)) :: TODO: assert existence? + ap-core + :: ap-core(cop.yoke (~(del by cop.yoke) coop)) :: TODO: fix :: +ap-grow: bind a path in the agent's scry namespace :: ++ ap-grow @@ -1124,13 +1352,7 @@ ^+ ap-core ?> =(~ (ap-match-coop spur)) :: enforce binding public seperately =- ap-core(sky.yoke -) - %+ ~(put by sky.yoke) spur - =/ ski (~(gut by sky.yoke) spur *path-state) - =- ski(fan (put:on-path fan.ski -< -> &/page)) - ?~ las=(ram:on-path fan.ski) - [(fall bob.ski 0) now] - :_ (max now +(p.val.u.las)) - ?~(bob.ski +(key.u.las) +((max key.u.las u.bob.ski))) + (need (~(grow of:farm sky.yoke) spur now page)) :: +ap-tomb: tombstone -- replace bound value with hash :: ++ ap-tomb @@ -1138,7 +1360,7 @@ ^+ ap-core =- ap-core(sky.yoke -) =/ yon ?>(?=(%ud -.case) p.case) - =/ old (~(get by sky.yoke) spur) + =/ old (~(get of:farm sky.yoke) spur) ?~ old :: no-op if nonexistent %. sky.yoke %+ trace odd.veb.bug.state @@ -1155,7 +1377,8 @@ [leaf+"gall: {}: tomb {<[case spur]>} no-op"]~ :: %& :: replace with hash - %+ ~(put by sky.yoke) spur + %- need + %+ ~(put of:farm sky.yoke) spur u.old(fan (put:on-path fan.u.old yon u.val(q |/(shax (jam p.q.u.val))))) == :: +ap-cull: delete all bindings up to and including .case @@ -1168,12 +1391,13 @@ ^+ ap-core =- ap-core(sky.yoke -) =/ yon ?>(?=(%ud -.case) p.case) - =/ old (~(get by sky.yoke) spur) + =/ old (~(get of:farm sky.yoke) spur) ?~ old :: no-op if nonexistent %. sky.yoke %+ trace odd.veb.bug.state [leaf+"gall: {}: cull {<[case spur]>} no-op"]~ - %+ ~(put by sky.yoke) spur :: delete all older paths + %- need + %+ ~(put of:farm sky.yoke) spur :: delete all older paths [`yon (lot:on-path fan.u.old `+(yon) ~)] :: +ap-from-internal: internal move to move. :: @@ -1185,7 +1409,7 @@ :: +$ carp $+ carp (wind neet gift:agent) +$ neet $+ neet - $< ?(%grow %tomb %cull %tend %germ %snip) + $< ?(%grow %tomb %cull %tend %germ %snip %keen) $% note:agent [%agent [=ship name=term] task=[%raw-poke =mark =noun]] [%huck [=ship name=term] =note-arvo] @@ -1443,7 +1667,9 @@ == :: :* wex=boat.yoke :: outgoing sup=bitt.yoke :: incoming - sky=(~(run by sky.yoke) tail) :: bindings + ^= sky :: bindings + %- ~(run-plot of:farm sky.yoke) + (bake tail ,plot) == :: :* act=change.stats.yoke :: tick eny=eny.stats.yoke :: nonce @@ -1465,7 +1691,7 @@ %- zing %+ turn ~(tap by `(jug spar:ames wire)`ken.yoke) |= [=spar:ames wyz=(set wire)] - (turn ~(tap in wyz) |=(=wire [%pass wire %arvo %a %keen | spar])) + (turn ~(tap in wyz) |=(=wire [%pass wire %arvo %a %keen ~ spar])) =^ error ap-core (ap-install(agent.yoke &+agent) `old-state) ?~ error @@ -1900,6 +2126,7 @@ [%pass * %tend *] $(caz t.caz, ap-core (ap-tend +.q.i.caz)) [%pass * %germ *] $(caz t.caz, ap-core (ap-germ +.q.i.caz)) [%pass * %snip *] $(caz t.caz, ap-core (ap-snip +.q.i.caz)) + [%pass * %keen *] $(caz t.caz, ap-core (ap-keen p.i.caz +.q.i.caz)) [%pass * ?(%agent %arvo %pyre) *] $(caz t.caz, fex [i.caz fex]) [%give *] $(caz t.caz, fex [i.caz fex]) [%slip *] !! @@ -2040,7 +2267,11 @@ =/ =path path.plea.task =/ =noun payload.plea.task :: - ~| [ship=ship plea-path=path] + ~& plea/[ship=ship plea-path=path] + ?: ?=([%gk @ ~] path) + =/ agent-name i.t.path + =< mo-abet + (mo-handle-key-request:mo-core ship agent-name ;;(^path noun)) ?> ?=([%ge @ ~] path) =/ agent-name i.t.path :: @@ -2101,7 +2332,7 @@ old-state=[%| vase] =beak marks=(map duct mark) - sky=(map spur path-state) + sky=(map spur plot) ken=(jug spar:ames wire) == == :: @@ -2142,7 +2373,7 @@ old-state=[%| vase] =beak marks=(map duct mark) - sky=(map spur path-state) + sky=(map spur farm) == == +$ spore-11 $: %11 @@ -2302,7 +2533,7 @@ %- ~(urn by eggs.old) |= [a=term e=egg-11] ^- egg-12 - live/e(marks [marks.e sky:*$>(%live egg)]) + live/e(marks [marks.e sky:*$>(%live egg-12)]) == :: :: added ken @@ -2317,7 +2548,7 @@ |= [a=term e=egg-12] ^- egg-13 ?: ?=(%nuke -.e) e - e(sky [sky.e ken:*$>(%live egg)]) + !! :: e(sky [sky.e ken:*$>(%live egg-13)]) == :: added provenance path to routes ++ spore-14-to-15 @@ -2331,7 +2562,7 @@ |= egg=egg-13 ?: ?=(%nuke -.egg) egg - egg(ken [ken.egg ~ ~]) + egg(sky (migrate:of:farm sky.egg), ken [ken.egg ~]) == :: ++ spore-13-to-14 @@ -2447,11 +2678,12 @@ == =/ yok (~(get by yokes.state) q.bem) ?. ?=([~ %live *] yok) [~ ~] - ?~ ski=(~(get by sky.u.yok) path) [~ ~] + ?~ ski=(~(get of:farm sky.u.yok) path) [~ ~] ?~ las=(ram:on-path fan.u.ski) [~ ~] ``case/!>(ud/key.u.las) :: ?: ?=(%x care) + ~& bem/bem ?. =(p.bem our) ~ :: ?: ?=(%$ q.bem) :: app %$ reserved @@ -2483,8 +2715,9 @@ :: ?~ yok=(~(get by yokes.state) q.bem) ~ ?: ?=(%nuke -.u.yok) ~ - =/ ski (~(get by sky.u.yok) path) - ?~ ski ~ + ~& path/path + ?~ ski=(~(get of:farm sky.u.yok) path) + ~ =/ res=(unit (each page @uvI)) ?+ -.r.bem ~ %ud (bind (get:on-path fan.u.ski p.r.bem) tail) @@ -2508,7 +2741,7 @@ =/ yok (~(get by yokes.state) q.bem) ?. ?=([~ %live *] yok) ~ :^ ~ ~ %file-list !> ^- (list ^path) - %+ skim ~(tap in ~(key by sky.u.yok)) + %+ skim (turn ~(tap-plot of:farm sky.u.yok) head) |= =spur ?& =(path (scag (lent path) spur)) !=(path spur) @@ -2519,7 +2752,7 @@ == =/ yok (~(get by yokes.state) q.bem) ?. ?=([~ %live *] yok) ~ - ?~ ski=(~(get by sky.u.yok) path) ~ + ?~ ski=(~(get of:farm sky.u.yok) path) ~ =/ res=(unit (pair @da (each noun @uvI))) ?+ -.r.bem ~ %ud (get:on-path fan.u.ski p.r.bem) @@ -2562,17 +2795,17 @@ ?: =(/clear-huck wire) =/ =gift ?>(?=([%behn %heck %gall *] syn) +>+.syn) [[duct %give gift]~ gall-payload] + =/ mo-core (mo-abed:mo duct) ?: ?=([%key *] wire) ~| [%gall-take-key-failed wire] - ?> ?=([%ames %stub *] syn) - mo-abet:(mo-handle-key:(mo-abed:mo duct) t.wire [num key]:syn) + mo-abet:(mo-handle-key:mo-core t.wire syn) :: ~| [%gall-take-failed wire] ?> ?=([?(%sys %use) *] wire) =< mo-abet %. [t.wire ?:(?=([%behn %heck *] syn) syn.syn syn)] ?- i.wire - %sys mo-handle-sys:(mo-abed:mo duct) - %use mo-handle-use:(mo-abed:mo duct) + %sys mo-handle-sys:mo-core + %use mo-handle-use:mo-core == -- diff --git a/pkg/base-dev/lib/strandio.hoon b/pkg/base-dev/lib/strandio.hoon index a7ab469761..cd7c6d4366 100644 --- a/pkg/base-dev/lib/strandio.hoon +++ b/pkg/base-dev/lib/strandio.hoon @@ -335,7 +335,7 @@ |= [=wire =spar:ames] =/ m (strand ,~) ^- form:m - (send-raw-card %pass wire %arvo %a %keen | spar) + (send-raw-card %pass wire %arvo %a %keen ~ spar) :: ++ sleep |= for=@dr From 949ac9d006531742327f0ec3c4ceee949579e3bf Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Mon, 25 Sep 2023 18:31:27 -0400 Subject: [PATCH 064/252] chum: refactors, corrects interface for blocking --- pkg/arvo/sys/lull.hoon | 4 +-- pkg/arvo/sys/vane/ames.hoon | 56 ++++++++++++++++++------------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index 0149ef66ae..b0c13291a4 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -804,8 +804,8 @@ $>(%plea vane-task) [%deep =deep] :: - [%keen spar] [%chum spar] + [%keen spar] [%yawn spar] [%wham spar] :: @@ -845,8 +845,8 @@ [%lost ~] [%send =lane =blob] :: + [%near spar dat=(unit (unit page))] [%tune spar roar=(unit roar)] - [%near spar dat=(unit page)] :: [%turf turfs=(list turf)] == diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 1b6e9d7a4a..854a9d96ec 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -2412,6 +2412,7 @@ ^+ event-core ?> ?=([%chum *] wire) :: XX save or decrypt path? + :: XX crash in decryption/cue indicates misbehaving peer :: =/ per (~(get by peers.ames-state) ship.s) ?> ?=([~ %known *] per) @@ -2419,13 +2420,13 @@ =/ pax =- (,path (cue -)) (dy:crub:crypto symmetric-key.u.per (slav %uv cyf.path.s)) - =/ dat=(unit page) + =/ dat=(unit (unit page)) ?: ?| ?=(~ roar) ?=(~ q.dat.u.roar) == - ~ :: XX wrong + ~ :: XX weird ?> ?=([%atom @] u.q.dat.u.roar) - =- ?~(- ~ `(,page (cue -))) + =- `?~(- ~ `(,page (cue -))) (dy:crub:crypto symmetric-key.u.per q.u.q.dat.u.roar) (emit duct [%give %near [ship.s pax] dat]) :: +on-cork: handle request to kill a flow @@ -2977,18 +2978,19 @@ ++ on-chum |= spar ^+ event-core - =+ ~:(spit path) :: assert length =/ ship-state (~(get by peers.ames-state) ship) - ?: ?=([~ %known *] ship-state) - =/ cyf (scot %uv (en:crub:crypto symmetric-key.u.ship-state (jam path))) - =/ lav /a/x/1//chum/(scot %p our)/(scot %ud life.ames-state)/[cyf] - (emit duct [%pass /chum %a %keen ship lav]) - :: XX add state for queued chum - :: - :: %^ enqueue-alien-todo ship ship-state - :: |= todos=alien-agenda - :: todos(keens (~(put ju keens.todos) path duct)) - !! + ?. ?=([~ %known *] ship-state) + :: XX add state for queued chum + :: + :: %^ enqueue-alien-todo ship ship-state + :: |= todos=alien-agenda + :: todos(keens (~(put ju keens.todos) path duct)) + !! + =/ cyf + (scot %uv (en:crub:crypto symmetric-key.u.ship-state (jam path))) + =/ lav + /a/x/1//chum/(scot %p our)/(scot %ud life.ames-state)/[cyf] + (emit duct [%pass /chum %a %keen ship lav]) :: ++ on-cancel-scry |= [all=? spar] @@ -5359,23 +5361,21 @@ => .(tyl `(pole knot)`tyl) ?+ tyl ~ [%chum her=@ lyf=@ cyf=@ ~] - ?~ who=(slaw %p her.tyl) + =/ who (slaw %p her.tyl) + =/ lyf (slaw %ud lyf.tyl) + =/ cyf (slaw %uv cyf.tyl) + ?: |(?=(~ who) ?=(~ lyf) ?=(~ cyf)) [~ ~] =/ per (~(get by peers.ames-state) u.who) - ?. ?=([~ %known *] per) + ?. &(?=([~ %known *] per) =(life.u.per u.lyf)) + ~ + =/ bal=(unit balk) + ?~ tex=(de:crub:crypto symmetric-key.u.per u.cyf) ~ + ?~ pax=(mole |.((,path (cue u.tex)))) ~ + (de-part:balk our 0 0 u.pax) + ?~ bal [~ ~] - ?~ lyf=(slaw %ud lyf.tyl) - [~ ~] - ?. =(life.u.per u.lyf) - [~ ~] - ?~ cyf=(slaw %uv cyf.tyl) - [~ ~] - =/ pax - =- (,path (cue -)) - (dy:crub:crypto symmetric-key.u.per u.cyf) - ?~ blk=(de-part:balk our 0 0 pax) - [~ ~] - ?~ res=(rof `[u.who ~ ~] /ames (as-omen:balk u.blk)) + ?~ res=(rof `[u.who ~ ~] /ames (as-omen:balk u.bal)) ~ =- ``atom+!>(`@ux`-) %+ en:crub:crypto symmetric-key.u.per From 9a3daeb64642ecd4f2ca391c0d4fc05dbd66b465 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Tue, 26 Sep 2023 09:50:53 +0100 Subject: [PATCH 065/252] ames, gall: strip sigpams, re-enable key checking --- pkg/arvo/sys/vane/ames.hoon | 26 +++----------------------- pkg/arvo/sys/vane/gall.hoon | 11 +---------- 2 files changed, 4 insertions(+), 33 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 417d7ec07e..f928160a50 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -2946,7 +2946,6 @@ ++ on-plug |= [vane=term =path] ^+ event-core - ~& plug/[vane path] =/ key=@ (shaz eny) :: TODO: check key width =/ num=@ud ?~ latest=(pry:on:chain chain.ames-state) @@ -2981,9 +2980,7 @@ ++ on-keen |= [sec=(unit [idx=@ key=@]) spar] ^+ event-core - ~& path/path =? path ?=(^ sec) - =- ~&(new-path/- -) =/ enc (scot %uv (~(en cbcc:aes:crypto [key.u.sec 0]) (spat path))) /a/e/(scot %ud idx.u.sec)/[enc] =+ ~:(spit path) :: assert length @@ -5494,14 +5491,6 @@ :: so we need to give it the right shape :: ?~ blk=(de-path-soft:balk pax.tyl) ~ - ~& blk/blk - =- ~& :- %result - ?- - - ~ ~ - [~ ~] [~ ~] - [~ ~ ^] (scag 500 (text q.u.u.-)) - == - - :: ?. ?& =(our her.u.blk) =(rift.ames-state rif.u.blk) @@ -5532,20 +5521,15 @@ :: %a =/ kyr ?@(vis.nom (rsh 3 vis.nom) car.vis.nom) - ~& kyr/kyr ?. =(kyr %e) ~ - ~& nom ?. ?=(%ud -.r.bem.nom) [~ ~] =/ key (got:on:chain chain.ames-state p.r.bem.nom) - ~& key/key ?~ new=(shutter key.key) [~ ~] - ~& new/(as-omen:balk u.new) =/ res (rof ~ /ames (as-omen:balk u.new)) - ~& res/res %- en-hunk (handle-shut spr.u.new p.r.bem.nom res) :: @@ -5563,7 +5547,6 @@ ?~ raw=(slaw %uv q.bem.nom) ~ =/ txt `@t`(de:(aes key) `@t`u.raw) - ~& txt/txt ?~ pat=`(unit path)`(rush txt stap) ~ (de-path-soft:balk (welp /(scot %p our)/(scot %ud 0)/(scot %ud 1) u.pat)) @@ -5573,7 +5556,6 @@ ?. ?=([~ ~ *] value) ~& %bailing-close value - ~& close/[key-idx chain.ames-state] ?~ key=(get:on:chain chain.ames-state key-idx) ~ ``noun+!>((en:(aes key.u.key) (jam [p q.q]:u.u.value))) @@ -5581,7 +5563,6 @@ ++ check-key |= [=path key-idx=@] ^- ? - ~& check-key/path =. path => .(path `(pole knot)`path) ?. ?=([van=@ car=@ cas=@ app=@ sig=@ rest=*] path) @@ -5591,7 +5572,6 @@ | =/ gol path.u.link |- ^- ? - ~& comparing/[path gol] ?~ gol & ?~ path | ?. =(i.path i.gol) @@ -5601,9 +5581,9 @@ ++ handle-shut |= [=path key-idx=@ value=(unit (unit cage))] ^- (unit (unit cage)) -:: ?. (check-key path key-idx) -:: ~& key-validation-failed/[path key-idx ~(key by chain.ames-state)] -:: ~ + ?. (check-key path key-idx) + ~& key-validation-failed/[path key-idx ~(key by chain.ames-state)] + ~ (close key-idx value) :: ++ en-hunk-shut diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 108e977369..0031700136 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -275,6 +275,7 @@ |= [seg=@ta f=^farm] ^- (list [path plot]) tap-plot(wer (snoc wer seg), farm f) + :: ++ run-plot |* fun=gate %- ~(gas by *(map path _(fun))) @@ -781,7 +782,6 @@ ++ mo-handle-key ~/ %mo-handle-stub |= [=(pole knot) syn=sign-arvo] - ~& mo-handle-key/pole ?. ?=([agent=@ nonce=@ rest=*] pole) ~& [%mo-handle-key-bad-wire wire] !! @@ -1063,7 +1063,6 @@ ++ mo-handle-key-request |= [=ship agent-name=term =path] ^+ mo-core - ~& key-req/[ship agent-name path] =/ yok=(unit yoke) (~(get by yokes.state) agent-name) ?. ?=([~ %live *] yok) (mo-give %done ~) @@ -1200,7 +1199,6 @@ ?. ?=([%g %x cas=@ app=@ rest=*] pole) ~& malformed-path/pole ap-core - ~& pole/pole =. pen.yoke (~(put by pen.yoke) [ship pole] wire) =/ =plea:ames [%g /gk/[app.pole] rest.pole] =/ out=^wire (welp /key/[agent-name]/[run-nonce.yoke]/bod/(scot %p ship) pole) @@ -1216,24 +1214,20 @@ =/ =ship (slav %p i.wire) ?+ syn ~|(weird-sign-ap-take-brood/-.syn !!) [%ames %boon *] - ~& boon/wire =+ bod=((soft ,brood) payload.syn) ?~ bod :: TODO: what happens ~& weird-take-brood/payload.syn !! =/ key key.lock.u.bod =/ out=^wire (~(got by pen.yoke) [ship t.wire]) - ~& sending-keen/[out t.wire] (ap-pass out %arvo %a %keen `[idx key]:lock.u.bod ship t.wire) :: [%ames %done *] - ~& acked-brood/[t.wire syn] ap-core == :: ++ ap-serve-brood |= [=ship =(pole knot)] ^- [(unit brood) _mo-core] - ~& serve-pole/pole ?. ?=([%$ rest=*] pole) `ap-abet ?~ cop=(ap-match-coop rest.pole) @@ -2267,7 +2261,6 @@ =/ =path path.plea.task =/ =noun payload.plea.task :: - ~& plea/[ship=ship plea-path=path] ?: ?=([%gk @ ~] path) =/ agent-name i.t.path =< mo-abet @@ -2683,7 +2676,6 @@ ``case/!>(ud/key.u.las) :: ?: ?=(%x care) - ~& bem/bem ?. =(p.bem our) ~ :: ?: ?=(%$ q.bem) :: app %$ reserved @@ -2715,7 +2707,6 @@ :: ?~ yok=(~(get by yokes.state) q.bem) ~ ?: ?=(%nuke -.u.yok) ~ - ~& path/path ?~ ski=(~(get of:farm sky.u.yok) path) ~ =/ res=(unit (each page @uvI)) From f382624c3552b0979f54e8c7bc7a53bf598cf45b Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Tue, 26 Sep 2023 11:42:05 +0100 Subject: [PATCH 066/252] ames: make encrypted scry namespace properly recursive --- pkg/arvo/sys/vane/ames.hoon | 163 +++++++++++++++++------------------- 1 file changed, 76 insertions(+), 87 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 22f3880613..a0cb7b34d3 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -461,6 +461,66 @@ %- some ;; shut-packet %- cue %- need (~(de sivc:aes:crypto (shaz symmetric-key) vec) siv len cyf) :: +++ is-our-bulk + |= [our=ship =ames-state =balk] + ^- ? + =- ~? =(| -) + [%fine-mismatch our=[rift life]:ames-state her=[her rif lyf]:balk] + - + ?& =(our her.balk) + =(rift.ames-state rif.balk) + =(life.ames-state lyf.balk) + == +:: +++ fine-close + =< close + |% + ++ aes |=(key=@ ~(. cbcc:aes:crypto [key 0])) + ++ close + |= [=ames-state =path key-idx=@ value=(unit (unit cage))] + ?. (check-key ames-state path key-idx) + ~& key-validation-failed/[path key-idx ~(key by chain.ames-state)] + ~ + ?~ value + ~& %bailing-close + ~ + ?~ u.value + ``atom+!>(~) + ?~ key=(get:on:chain chain.ames-state key-idx) + ~ + ``atom+!>((en:(aes key.u.key) (jam [p q.q]:u.u.value))) + :: + ++ shutter + |= [our=ship =ames-state enc=@t key=@] + ^- (unit balk) + ?~ raw=(slaw %uv enc) + ~ + =/ txt `@t`(de:(aes key) `@t`u.raw) + ?~ pat=`(unit path)`(rush txt stap) + ~ + =/ here + /(scot %p our)/(scot %ud rift.ames-state)/(scot %ud life.ames-state) + (de-path-soft:balk (welp here u.pat)) + :: + ++ check-key + |= [=ames-state =path key-idx=@] + ^- ? + =. path + => .(path `(pole knot)`path) + ?. ?=([van=@ car=@ cas=@ app=@ sig=@ rest=*] path) + path + rest.path + ?~ link=(get:on:chain chain.ames-state key-idx) + | + =/ gol path.u.link + |- ^- ? + ?~ gol & + ?~ path | + ?. =(i.path i.gol) + | + $(path t.path, gol t.gol) + -- +:: ++ is-peer-dead |= [now=@da =peer-state] ^+ peer-state @@ -3069,12 +3129,13 @@ ++ on-keen |= [sec=(unit [idx=@ key=@]) spar] ^+ event-core - =? path ?=(^ sec) - =/ enc (scot %uv (~(en cbcc:aes:crypto [key.u.sec 0]) (spat path))) - /a/e/(scot %ud idx.u.sec)/[enc] =+ ~:(spit path) :: assert length =/ ship-state (~(get by peers.ames-state) ship) ?: ?=([~ %known *] ship-state) + =? path ?=(^ sec) + =/ enc (scot %uv (~(en cbcc:aes:crypto [key.u.sec 0]) (spat path))) + /a/x/(scot %ud idx.u.sec)//fine/shut/[enc] + abet:(on-keen:(abed-peer:pe ship +.u.ship-state) path duct) %^ enqueue-alien-todo ship ship-state |= todos=alien-agenda @@ -5466,12 +5527,20 @@ =* tyl s.bem :: ?: ?& =(&+our why) - =([%$ %ud 1] lot) + ?=([%ud *] r.bem) =(%$ syd) =(%x ren) == => .(tyl `(pole knot)`tyl) ?+ tyl ~ + :: + [%fine %shut enc=@ ~] + =/ key (got:on:chain chain.ames-state p.r.bem) + ?~ new=(shutter:fine-close our ames-state enc.tyl key.key) + ~ + =/ res (rof ~ /ames (as-omen:balk u.new)) + (fine-close ames-state spr.u.new p.r.bem res) + [%chum her=@ lyf=@ cyf=@ ~] =/ who (slaw %p her.tyl) =/ lyf (slaw %ud lyf.tyl) @@ -5516,6 +5585,7 @@ :: /ax/snubbed (?(%allow %deny) (list ship)) :: /ax/fine/hunk/[path/...] (list @ux) scry response fragments :: /ax/fine/ducts/[path/] (list duct) + :: /ax/fine/shut/[path/] @ux encrypted response :: ?. ?=(%x ren) ~ => .(tyl `(pole knot)`tyl) @@ -5636,11 +5706,7 @@ :: ?~ blk=(de-path-soft:balk pax.tyl) ~ :: - ?. ?& =(our her.u.blk) - =(rift.ames-state rif.u.blk) - =(life.ames-state lyf.u.blk) - == - ~& [%fine-mismatch our=[rift life]:ames-state her=[her rif lyf]:u.blk] + ?. (is-our-bulk our ames-state u.blk) ~ =+ nom=(as-omen:balk u.blk) ~| nom @@ -5649,9 +5715,8 @@ =/ kyr ?@(vis.nom (rsh 3 vis.nom) car.vis.nom) ?+ van ~ %a - %- en-hunk ?+ kyr ~ - %x (rof ~ /ames nom) + %x (en-hunk (rof ~ /ames nom)) == :: %c @@ -5668,20 +5733,6 @@ ?+ kyr ~ %x (rof ~ /ames nom) == - :: - %a - =/ kyr ?@(vis.nom (rsh 3 vis.nom) car.vis.nom) - ?. =(kyr %e) - ~ - ?. ?=(%ud -.r.bem.nom) - [~ ~] - =/ key - (got:on:chain chain.ames-state p.r.bem.nom) - ?~ new=(shutter key.key) - [~ ~] - =/ res (rof ~ /ames (as-omen:balk u.new)) - %- en-hunk - (handle-shut spr.u.new p.r.bem.nom res) :: %g %- en-hunk @@ -5689,68 +5740,6 @@ %x (rof ~ /ames nom) == == - ++ aes |=(key=@ ~(. cbcc:aes:crypto [key 0])) - ++ shutter - |= key=@ - ^- (unit balk) - ?~ raw=(slaw %uv q.bem.nom) - ~ - =/ txt `@t`(de:(aes key) `@t`u.raw) - ?~ pat=`(unit path)`(rush txt stap) - ~ - (de-path-soft:balk (welp /(scot %p our)/(scot %ud 0)/(scot %ud 1) u.pat)) - ++ close - |= [key-idx=@ value=(unit (unit cage))] - ^- (unit (unit cage)) - ?. ?=([~ ~ *] value) - ~& %bailing-close - value - ?~ key=(get:on:chain chain.ames-state key-idx) - ~ - ``noun+!>((en:(aes key.u.key) (jam [p q.q]:u.u.value))) - :: - ++ check-key - |= [=path key-idx=@] - ^- ? - =. path - => .(path `(pole knot)`path) - ?. ?=([van=@ car=@ cas=@ app=@ sig=@ rest=*] path) - path - rest.path - ?~ link=(get:on:chain chain.ames-state key-idx) - | - =/ gol path.u.link - |- ^- ? - ?~ gol & - ?~ path | - ?. =(i.path i.gol) - | - $(path t.path, gol t.gol) - :: - ++ handle-shut - |= [=path key-idx=@ value=(unit (unit cage))] - ^- (unit (unit cage)) - ?. (check-key path key-idx) - ~& key-validation-failed/[path key-idx ~(key by chain.ames-state)] - ~ - (close key-idx value) - :: - ++ en-hunk-shut - |= [=path key=@ res=(unit (unit cage))] - ^- (unit (unit cage)) - =/ etch-core (etch-hunk our [life crypto-core]:ames-state) - =/ dat - %- ~(en cbcc:aes:crypto [key 0]) - %+ etch-data:etch-core path - ?- res - ~ ~ - [~ ~] ~ - [~ ~ ^] [p q.q]:u.u.res - == - =/ =hunk [(slav %ud lop.tyl) (slav %ud len.tyl)] - =- ``noun+!>(-) - %- etch:etch-core - [path hunk dat] :: ++ en-hunk |= res=(unit (unit cage)) From 23e09ed5a0943c218f48de255c82710d58c4a4a7 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Tue, 26 Sep 2023 13:04:34 +0100 Subject: [PATCH 067/252] ames: add foreign fine key state & add pending chums to $alien-agenda --- pkg/arvo/sys/lull.hoon | 3 + pkg/arvo/sys/vane/ames.hoon | 108 +++++++++++++++++++++++++++++------- 2 files changed, 90 insertions(+), 21 deletions(-) diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index 0cf864ac94..0decdc150b 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -999,7 +999,9 @@ packets=(set =blob) heeds=(set duct) keens=(jug path duct) + chums=(jug path duct) == + +$ chain ((mop ,@ ,[key=@ =path]) lte) :: $peer-state: state for a peer with known life and keys :: :: route: transport-layer destination for packets to peer @@ -1039,6 +1041,7 @@ closing=(set bone) corked=(set bone) keens=(map path keen-state) + =chain == +$ keen-state $+ keen-state diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index a0cb7b34d3..b5d58c41ef 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -111,8 +111,8 @@ ++ chain =< mop |% - ++ on ((^on ,@ ,[key=@ =path]) lte) - +$ mop ((^mop ,@ ,[key=@ =path]) lte) + ++ on ((^on ,@ ,[key=@ =path]) lte) + +$ mop ^chain -- :: :: +trace: print if .verb is set and we're tracking .ship @@ -651,7 +651,7 @@ :: +$ ames-state-17 $+ ames-state-17 - $: peers=(map ship ship-state) + $: peers=(map ship ship-state-17) =unix=duct =life =rift @@ -897,7 +897,7 @@ :: +$ ship-state-13 $+ ship-state-13 - $% [%alien alien-agenda] + $% [%alien alien-agenda-17] [%known peer-state-13] == :: @@ -1195,9 +1195,42 @@ snub=[form=?(%allow %deny) ships=(set ship)] cong=[msg=@ud mem=@ud] == ++$ ship-state-17 + $% [%alien alien-agenda-17] + [%known peer-state-17] + == +:: ++$ peer-state-17 + $+ peer-state + $: $: =symmetric-key + =life + =rift + =public-key + sponsor=ship + == + route=(unit [direct=? =lane]) + =qos + =ossuary + snd=(map bone message-pump-state) + rcv=(map bone message-sink-state) + nax=(set [=bone =message-num]) + heeds=(set duct) + closing=(set bone) + corked=(set bone) + keens=(map path keen-state) + == + :: + +$ alien-agenda-17 + $+ alien-agenda + $: messages=(list [=duct =plea]) + packets=(set =blob) + heeds=(set duct) + keens=(jug path duct) + == +:: +$ ship-state-16 $+ ship-state-16 - $% [%alien alien-agenda] + $% [%alien alien-agenda-17] [%known peer-state-16] == :: @@ -2559,16 +2592,37 @@ ++ on-tune |= [=wire s=[=ship path=(pole knot)] roar=(unit roar)] ^+ event-core - ?> ?=([%chum *] wire) :: XX save or decrypt path? :: XX crash in decryption/cue indicates misbehaving peer :: =/ per (~(get by peers.ames-state) ship.s) ?> ?=([~ %known *] per) - ?> ?=([%a %x %~.1 %$ %chum her=@ lyf=@ cyf=@ ~] path.s) + ?> ?=([%a %x @ %$ rest=*] path.s) + ?. ?=([%chum her=@ lyf=@ cyf=@ ~] rest.path.s) + => .(wire `(pole knot)`wire) + ~| bad-wire/wire + ?> ?=([%fine %shut idx=@ ~] wire) + ~| bad-path/rest.path.s + ?> ?=([%fine %shut cyf=@ ~] rest.path.s) + =/ [key=@ ,path] (~(got by chain.u.per) (slav %ud idx.wire)) + =/ de de:(aes:fine-close key) + =/ pax=path + %+ welp + /(scot %p ship.s)/(scot %ud rift.u.per)/(scot %ud life.u.per) + (stab `@t`(de (slav %uv cyf.rest.path.s))) + =; dat=(unit (unit page)) + (emit duct [%give %near [ship.s pax] dat]) + ?: ?| ?=(~ roar) + ?=(~ q.dat.u.roar) + == + ~ :: XX weird + ?> ?=([%atom @] u.q.dat.u.roar) + =- `?~(- ~ `(,page (cue -))) + (de:(aes:fine-close key) q.u.q.dat.u.roar) + ?> ?=([%chum *] wire) =/ pax =- (,path (cue -)) - (dy:crub:crypto symmetric-key.u.per (slav %uv cyf.path.s)) + (dy:crub:crypto symmetric-key.u.per (slav %uv cyf.rest.path.s)) =/ dat=(unit (unit page)) ?: ?| ?=(~ roar) ?=(~ q.dat.u.roar) @@ -3132,11 +3186,14 @@ =+ ~:(spit path) :: assert length =/ ship-state (~(get by peers.ames-state) ship) ?: ?=([~ %known *] ship-state) - =? path ?=(^ sec) + ?~ sec + abet:(on-keen:(abed-peer:pe ship +.u.ship-state) path duct) + =. chain.u.ship-state (put:on:chain chain.u.ship-state [idx key /]:u.sec) + =. peers.ames-state (~(put by peers.ames-state) ship u.ship-state) =/ enc (scot %uv (~(en cbcc:aes:crypto [key.u.sec 0]) (spat path))) - /a/x/(scot %ud idx.u.sec)//fine/shut/[enc] - - abet:(on-keen:(abed-peer:pe ship +.u.ship-state) path duct) + =/ lav /a/x/(scot %ud idx.u.sec)//fine/shut/[enc] + =/ wir /fine/shut/(scot %ud idx.u.sec) + (emit duct %pass wir %a %keen ~ ship lav) %^ enqueue-alien-todo ship ship-state |= todos=alien-agenda todos(keens (~(put ju keens.todos) path duct)) @@ -3146,12 +3203,9 @@ ^+ event-core =/ ship-state (~(get by peers.ames-state) ship) ?. ?=([~ %known *] ship-state) - :: XX add state for queued chum - :: - :: %^ enqueue-alien-todo ship ship-state - :: |= todos=alien-agenda - :: todos(keens (~(put ju keens.todos) path duct)) - !! + %^ enqueue-alien-todo ship ship-state + |= todos=alien-agenda + todos(chums (~(put ju chums.todos) path duct)) =/ cyf (scot %uv (en:crub:crypto symmetric-key.u.ship-state (jam path))) =/ lav @@ -5459,7 +5513,7 @@ peers %- ~(run by peers.old) |= ship-state=ship-state-16 - ^- ^ship-state + ^- ship-state-17 ?. ?=(%known -.ship-state) ship-state |^ @@ -5510,8 +5564,20 @@ ++ state-17-to-18 |= old=ames-state-17 ^- ^ames-state - %= old - dead [dead.old ~ ~] + %= old + dead [dead.old ~ ~] + :: + peers + %- ~(run by peers.old) + |= ship-state=ship-state-17 + ^- ^ship-state + ?. ?=(%known -.ship-state) + %= ship-state + keens [keens.ship-state ~] + == + %= ship-state + keens [keens.ship-state ~] + == == -- :: +scry: dereference namespace From 792d42d9cc429101e94a08ee711cab38152c1436 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Tue, 26 Sep 2023 14:19:07 +0100 Subject: [PATCH 068/252] pill: update solid --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/ames.hoon | 7 ++++--- tests/sys/vane/gall.hoon | 1 - 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 87803c7695..ff0f5b5f64 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:38f5a8c55b699c99a8fa2e0315ed0a63ba80e4c1c18dcbb85b3af3c4bf1e36f0 -size 6786502 +oid sha256:5b00a1700d3d4abd17239ec6c1117a22ddce7e901d68a85345b8f14be8531bf8 +size 6886260 diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index b5d58c41ef..4c06e96a22 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -1982,7 +1982,6 @@ |=([@da =duct] ?=([[%ames %recork *] *] duct)) :: ?> ?=(%18 -.u.cached-state) - :: TODO: review keygen =. ames-state.adult-gate +.u.cached-state [moz larval-core(cached-state ~)] -- @@ -3152,11 +3151,10 @@ =/ key=@ (shaz eny) :: TODO: check key width =/ num=@ud ?~ latest=(pry:on:chain chain.ames-state) - 0 + 1 .+(key.u.latest) =. chain.ames-state (put:on:chain chain.ames-state num [key path]) - =. atlas.ames-state (~(put by atlas.ames-state) [vane path] num) (emit duct %give %stub num key) :: +on-trim: handle request to free memory :: @@ -3194,6 +3192,9 @@ =/ lav /a/x/(scot %ud idx.u.sec)//fine/shut/[enc] =/ wir /fine/shut/(scot %ud idx.u.sec) (emit duct %pass wir %a %keen ~ ship lav) + :: XX: key exchange over ames forces all encrypted scries to be + :: to a known peer + ?> ?=(~ sec) %^ enqueue-alien-todo ship ship-state |= todos=alien-agenda todos(keens (~(put ju keens.todos) path duct)) diff --git a/tests/sys/vane/gall.hoon b/tests/sys/vane/gall.hoon index 15a32e84e2..73469503dc 100644 --- a/tests/sys/vane/gall.hoon +++ b/tests/sys/vane/gall.hoon @@ -43,5 +43,4 @@ !> -.res :: [output +.res] -++ test- -- From f0711aaaa92bd6a80abb9c8fe593cd53026d1a86 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Wed, 27 Sep 2023 15:34:05 +0100 Subject: [PATCH 069/252] arvo: make tests compile --- pkg/arvo/gen/tx.hoon | 6 +++--- pkg/arvo/ted/aqua/ames.hoon | 15 ++++++++------- pkg/arvo/ted/aqua/dill.hoon | 1 + 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/pkg/arvo/gen/tx.hoon b/pkg/arvo/gen/tx.hoon index 64f3393cfc..4b13eae06a 100644 --- a/pkg/arvo/gen/tx.hoon +++ b/pkg/arvo/gen/tx.hoon @@ -2,7 +2,7 @@ :: ethereum.request({method: 'eth_sendTransaction', params: [{from: count, gasPrice: '0x2540be400', to: '0xb58101cd3bbbcc6fa40bcdb04bb71623b5c7d39b', gas: '0x10000', data: 'batch', chainId: '0x3'}]}).then(console.log) :: /+ eth=ethereum -/= tt /tests/lib/naive +:: /= tt /tests/lib/naive |% :: Generated by running these commands after modifying eth-sig-util :: such that TypedDataUtils.sign returns the domain separator instead @@ -42,8 +42,8 @@ ^- @t =/ account (hex-to-num:eth '0xb026b0AA6e686F2386051b31A03E5fB95513e1c0') =/ tx=octs - (gen-tx-octs:tt [~ravmun-mitbus %own] %set-spawn-proxy account) -=/ prepped=octs (prepare-for-sig:tt 3 0 tx) + *octs :: XX: (gen-tx-octs:tt [~ravmun-mitbus %own] %set-spawn-proxy account) +=/ prepped=octs *octs :: XX: (prepare-for-sig:tt 3 0 tx) ?~ sig (cat 3 'sign: ' (print-for-web3 prepped)) =/ batch=@t diff --git a/pkg/arvo/ted/aqua/ames.hoon b/pkg/arvo/ted/aqua/ames.hoon index e6286aae4d..dfdf66e4ba 100644 --- a/pkg/arvo/ted/aqua/ames.hoon +++ b/pkg/arvo/ted/aqua/ames.hoon @@ -26,13 +26,14 @@ ^- (list card:agent:gall) =/ rcvr=ship (lane-to-ship lan) =/ hear-lane (ship-to-lane sndr) - =/ [ames=? =packet] (decode-packet pac) - ?: &(!ames !resp==(& (cut 0 [2 1] pac))) - =/ [=peep =purr] (decode-request-info `@ux`(rsh 3^64 content.packet)) - %+ emit-aqua-events our - [%read [rcvr path.peep] [hear-lane num.peep]]~ - %+ emit-aqua-events our - [%event rcvr /a/newt/0v1n.2m9vh %hear hear-lane pac]~ + ~ + :: =/ [ames=? =packet] (decode-packet pac) + ::?: &(!ames !resp==(& (cut 0 [2 1] pac))) + :: =/ [=peep =purr] (decode-request-info `@ux`(rsh 3^64 content.packet)) + :: %+ emit-aqua-events our + :: [%read [rcvr path.peep] [hear-lane num.peep]]~ + :: %+ emit-aqua-events our + :: [%event rcvr /a/newt/0v1n.2m9vh %hear hear-lane pac]~ :: +lane-to-ship: decode a ship from an aqua lane :: :: Special-case one comet, since its address doesn't fit into a lane. diff --git a/pkg/arvo/ted/aqua/dill.hoon b/pkg/arvo/ted/aqua/dill.hoon index e7cb190174..4d282957ad 100644 --- a/pkg/arvo/ted/aqua/dill.hoon +++ b/pkg/arvo/ted/aqua/dill.hoon @@ -17,6 +17,7 @@ %+ roll blits |= [b=blit:dill line=tape] ?- -.b + %mor line :: XX: fix? %put (tape p.b) %klr (tape (zing (turn p.b tail))) %nel ~& "{}: {line}" "" From 352130a545a239b579e96c6f1f046b3e0bdfe593 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Fri, 29 Sep 2023 15:50:15 +0100 Subject: [PATCH 070/252] ames: update tests to cover encrypted remote scry --- tests/sys/vane/ames.hoon | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tests/sys/vane/ames.hoon b/tests/sys/vane/ames.hoon index a921b3ab35..a7f11c74e3 100644 --- a/tests/sys/vane/ames.hoon +++ b/tests/sys/vane/ames.hoon @@ -539,7 +539,7 @@ ++ test-fine-request ^- tang =/ want=path /c/z/1/kids/sys - =^ moves1 nec (call nec ~[/g/talk] %keen ~bud want) + =^ moves1 nec (call nec ~[/g/talk] %keen ~ ~bud want) =/ req=hoot:ames %+ snag 0 %+ murn ;;((list move:ames) moves1) @@ -697,4 +697,24 @@ !> [~[/g/talk] %give %boon [%post '¡hola!']] !> (snag 0 `(list move:ames)`moves7) == +:: +++ test-plug ^- tang + =^ moves nec + (call nec ~[/g/talk] %plug %g /foo) + =/ expected-key + 3.782.450.905.364.316.746.465.724.430.826.633.339.627.682.402.565.789.971.442.035.627.125.517.743.962.901.817.756.764.395.497.041.697.150.935.487.420.935.470.530.023.121.462.879.251.503.082.973.208.842.762 + %- zing + :- + %+ expect-eq !>(moves) + !> ^- (list move:ames) + :~ [~[/g/talk] %give %stub 1 expected-key] + == + =^ moves2 bud + (call bud ~[/g/talk] %keen `[1 expected-key] ~nec /foo/bar) + :_ ~ + %+ expect-eq !>(moves2) + !> ^- (list move:ames) + :~ [~[/g/talk] [%pass /fine/shut/1 [%a [%keen sec=~ ship=~nec path=/a/x/1//fine/shut/0v7.vdpsi.f9s0b.1b9k6.u3aho.mtquj]]]] + == +:: -- From 6c90331fc745f6349e87d5c4a6167a2fd26f6d1e Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Fri, 29 Sep 2023 16:27:07 +0100 Subject: [PATCH 071/252] tests: update for less slog noise --- pkg/arvo/ted/test.hoon | 23 ++++++++++---- tests/sys/fine.hoon | 39 ++++++++++++----------- tests/sys/grq.hoon | 69 ++++++++++++++++++++-------------------- tests/sys/vane/eyre.hoon | 2 +- tests/sys/vane/gall.hoon | 13 ++++---- 5 files changed, 80 insertions(+), 66 deletions(-) diff --git a/pkg/arvo/ted/test.hoon b/pkg/arvo/ted/test.hoon index d483fb1ff7..7ea500ec7d 100644 --- a/pkg/arvo/ted/test.hoon +++ b/pkg/arvo/ted/test.hoon @@ -10,9 +10,22 @@ +$ test [=path func=test-func] +$ test-arm [name=term func=test-func] +$ test-func (trap tang) ++$ args quiet=_& -- => -|% +|_ =args +++ build-file + |= =beam + =/ m (strand ,(unit vase)) + ^- form:m + ;< res=(unit vase) bind:m + (build-file:strandio beam) + %. (pure:m res) + ?: =(res ~) + ~>(%slog.0^leaf+"FAILED {(spud s.beam)} (build)" same) + ?: quiet.args + same + ~>(%slog.0^leaf+"built {(spud s.beam)}" same) :: +run-test: execute an individual test :: ++ run-test @@ -23,7 +36,7 @@ ?- -.run %| |+(welp p.run leaf+"CRASHED {name}" ~) %& ?: =(~ p.run) - &+[leaf+"OK {name}"]~ + &+?:(quiet.args ~ [leaf+"OK {name}"]~) |+(flop `tang`[leaf+"FAILED {name}" p.run]) == :: +resolve-test-paths: add test names to file paths to form full identifiers @@ -55,7 +68,7 @@ =/ fire-arm=nock ~| [%failed-to-compile-test-arm name] q:(~(mint ut typ) p:!>(*tang) [%limb name]) - [name |.(;;(tang ~>(%bout.[1 name] .*(cor fire-arm))))] + [name |.(;;(tang ?:(quiet.args .*(cor fire-arm) ~>(%bout.[1 name] .*(cor fire-arm)))))] :: +has-test-prefix: does the arm define a test we should run? :: ++ has-test-prefix @@ -117,11 +130,9 @@ |- ^- form:m =* gather-tests $ ?^ fiz - ;< cor=(unit vase) bind:m (build-file:strandio beam.i.fiz) + ;< cor=(unit vase) bind:m (build-file beam.i.fiz) ?~ cor - ~> %slog.0^leaf+"FAILED {(spud s.beam.i.fiz)} (build)" gather-tests(fiz t.fiz, build-ok |) - ~> %slog.0^leaf+"built {(spud s.beam.i.fiz)}" =/ arms=(list test-arm) (get-test-arms u.cor) :: if test path specified an arm prefix, filter arms to match =? arms ?=(^ test.i.fiz) diff --git a/tests/sys/fine.hoon b/tests/sys/fine.hoon index e9a0442997..15406bd58a 100644 --- a/tests/sys/fine.hoon +++ b/tests/sys/fine.hoon @@ -3,6 +3,7 @@ /+ *test, v=test-ames-gall /* kelvin %hoon /sys/kelvin => |% + ++ dbug `?`| ++ kelvin-roof ^- roof :: @@ -55,7 +56,7 @@ =/ fine-behn-wire=wire (weld /fine/behn/wake/~bud scry-path) =/ future-path=path /c/x/5/kids/sys/kelvin =/ future-behn=wire (weld /fine/behn/wake/~bud future-path) - =/ =task:ames [%keen ~bud scry-path] + =/ =task:ames [%keen ~ ~bud scry-path] :: =/ request=shot:ames :* [sndr=~nec rcvr=~bud] @@ -65,7 +66,7 @@ origin=~ content=(etch-request-content ~nec (weld /~bud/1/1 scry-path) 1) == - ~& > 'poke requester %ames with a %keen task' + ~? > dbug 'poke requester %ames with a %keen task' =^ t1 ames.nec %: ames-check-call:v ames.nec [~1111.1.1 0xdead.beef *roof] @@ -76,7 +77,7 @@ == == :: - ~& > 'poke requester %ames with a second %keen task' + ~? > dbug 'poke requester %ames with a second %keen task' :- t1 |. :- %| =^ t2 ames.nec %: ames-check-call:v ames.nec @@ -92,14 +93,14 @@ ?~ keen=(~(get by keens.peer) scry-path) ~ listeners:u.keen - ~& > 'checks two listeners for the requested scry path' + ~? > dbug 'checks two listeners for the requested scry path' =/ t3=tang %+ expect-eq !>((sy ~[~[/keen-duct-1] ~[/keen-duct-2]])) !>(listeners) :: :- t3 |. :- %| - ~& > 'gives a remote scry response to listeners' + ~? > dbug 'gives a remote scry response to listeners' =/ [sig=@ux meows=(list @ux)] %: ames-scry-hunk:v ames.bud [~1111.1.2 0xbeef.dead kelvin-roof] @@ -143,18 +144,18 @@ origin=~ content=(etch-request-content ~nec (weld /~bud/1/1 future-path) 1) == - ~& > 'poke requester %ames with a %keen task for a future case' + ~? > dbug 'poke requester %ames with a %keen task for a future case' =^ t5 ames.nec %: ames-check-call:v ames.nec [~1111.1.1 0xdead.beef *roof] - [~[/keen-duct-3] %keen ~bud future-path] + [~[/keen-duct-3] %keen ~ ~bud future-path] :~ [~[//unix] [%give %send [%& ~bud] (etch-shot:ames request)]] [~[//unix] %pass future-behn %b %wait ~1111.1.1..00.00.01] == == :: :- t5 |. :- %| - ~& > 'cancel %keen task, from requester' + ~? > dbug 'cancel %keen task, from requester' =^ t6 ames.nec %: ames-check-call:v ames.nec [~1111.1.1 0xdead.beef *roof] @@ -163,26 +164,26 @@ == :: :- t6 |. :- %| - ~& > 'poke requester %ames with a new %keen task for a future case' + ~? > dbug 'poke requester %ames with a new %keen task for a future case' =^ t7 ames.nec %: ames-check-call:v ames.nec [~1111.1.1 0xdead.beef *roof] - [~[/keen-duct-4] %keen ~bud future-path] + [~[/keen-duct-4] %keen ~ ~bud future-path] :~ [~[//unix] [%give %send [%& ~bud] (etch-shot:ames request)]] [~[//unix] %pass future-behn %b %wait ~1111.1.1..00.00.01] == == :: :- t7 |. :- %| - ~& > 'poke requester %ames with a second %keen task for a future case' + ~? > dbug 'poke requester %ames with a second %keen task for a future case' =^ t8 ames.nec %: ames-check-call:v ames.nec [~1111.1.1 0xdead.beef *roof] - [~[/keen-duct-5] %keen ~bud future-path] + [~[/keen-duct-5] %keen ~ ~bud future-path] ~ == :- t8 |. :- %| - ~& > 'cancel scry for all listeners (%wham)' + ~? > dbug 'cancel scry for all listeners (%wham)' =^ t9 ames.nec %: ames-check-call:v ames.nec [~1111.1.1 0xdead.beef *roof] @@ -199,7 +200,7 @@ ?~ keen=(~(get by keens.peer) scry-path) ~ listeners:u.keen - ~& > 'checks no more listeners' + ~? > dbug 'checks no more listeners' (expect-eq !>(~) !>(listeners)) :: ++ test-fine-misordered @@ -213,7 +214,7 @@ :: (ames-call:v ames.bud ~[/none] [%spew ~[%msg %snd %rcv %odd]] *roof) =/ scry-path=path /g/x/0/dap//some/data/atom =/ fine-behn-wire=wire (weld /fine/behn/wake/~bud scry-path) - =/ =task:ames [%keen ~bud scry-path] + =/ =task:ames [%keen ~ ~bud scry-path] :: =/ requests=(list shot:ames) %+ turn (gulf 1 3) @@ -229,7 +230,7 @@ =+ ^= [req1 req2 req3] ?> ?=([^ ^ ^ *] requests) [i i.t i.t.t]:requests - ~& > 'poke requester %ames with a %keen task' + ~? > dbug 'poke requester %ames with a %keen task' =^ t1 ames.nec %: ames-check-call:v ames.nec [~1111.1.1 0xdead.beef *roof] @@ -265,7 +266,7 @@ [[~bud [1 sig]] ~ ~] :: :- t1 |. :- %| - ~& > 'hear first response fragment' + ~? > dbug 'hear first response fragment' =^ t2 ames.nec %: ames-check-call:v ames.nec [~1111.1.2 0xbeef.dead *roof] @@ -282,7 +283,7 @@ == :: :- t2 |. :- %| - ~& > 'hear third response fragment' + ~? > dbug 'hear third response fragment' =^ t3 ames.nec %: ames-check-call:v ames.nec [~1111.1.2 0xbeef.dead *roof] @@ -294,7 +295,7 @@ ~ == :- t3 |. :- %& - ~& > 'hear second response fragment' + ~? > dbug 'hear second response fragment' =^ t4 ames.nec %: ames-check-call:v ames.nec [~1111.1.3 0xbeef.dead *roof] diff --git a/tests/sys/grq.hoon b/tests/sys/grq.hoon index fc03ddc1eb..6829d38fbf 100644 --- a/tests/sys/grq.hoon +++ b/tests/sys/grq.hoon @@ -2,6 +2,7 @@ :: /+ *test, v=test-ames-gall |% +++ dbug `?`| ++ test-watch %- run-chain |. :- %| @@ -12,7 +13,7 @@ ::=^ * ames.bud :: (ames-call:v ames.bud ~[/none] [%spew ~[%msg %snd %rcv %odd]] *roof) :: poke %sub to tell it to subscribe - ~& > 'poke %sub to tell it to subscribe' + ~? > dbug 'poke %sub to tell it to subscribe' =/ =task:gall [%deal [~nec ~nec /] %sub %poke watch+!>(~bud)] =^ t1 gall.nec %: gall-check-call:v gall.nec @@ -26,7 +27,7 @@ == :- t1 |. :- %| :: handle gall passing the %watch to itself, which passes to ames - ~& > 'handle gall passing the %watch to itself, which passes to ames' + ~? > dbug 'handle gall passing the %watch to itself, which passes to ames' =^ t2 gall.nec %: gall-check-call:v gall.nec [~1111.1.1 0xdead.beef *roof] @@ -40,7 +41,7 @@ == :- t2 |. :- %| :: subscriber ames handles %plea from gall, gives a packet to vere - ~& > 'subscriber ames handles %plea from gall, gives a packet to vere' + ~? > dbug 'subscriber ames handles %plea from gall, gives a packet to vere' =^ t3 ames.nec %: ames-check-call:v ames.nec [~1111.1.1 0xdead.beef *roof] @@ -60,7 +61,7 @@ == :- t3 |. :- %| :: publisher ames hears %watch, passes to gall - ~& > 'publisher ames hears %watch, passes to gall' + ~? > dbug 'publisher ames hears %watch, passes to gall' =^ t4 ames.bud %: ames-check-call:v ames.bud [~1111.1.2 0xbeef.dead *roof] @@ -77,7 +78,7 @@ == :- t4 |. :- %| :: publisher gall hears %watch from ames, passes to itself - ~& > 'publisher gall hears %watch from ames, passes to itself' + ~? > dbug 'publisher gall hears %watch from ames, passes to itself' =^ t5 gall.bud %: gall-check-call:v gall.bud [~1111.1.2 0xbeef.dead *roof] @@ -91,7 +92,7 @@ == :- t5 |. :- %| :: publisher gall runs %pub with %watch, gives ack to itself - ~& > 'publisher gall runs %pub with %watch, gives ack to itself' + ~? > dbug 'publisher gall runs %pub with %watch, gives ack to itself' =^ t6 gall.bud %: gall-check-call:v gall.bud [~1111.1.2 0xbeef.dead *roof] @@ -103,7 +104,7 @@ == :- t6 |. :- %| :: gall gives ack to ames - ~& > 'gall gives ack to ames' + ~? > dbug 'gall gives ack to ames' =^ t7 gall.bud %: gall-check-take:v gall.bud [~1111.1.2 0xbeef.dead *roof] @@ -114,7 +115,7 @@ == :- t7 |. :- %| :: publisher ames hears ack from gall, sends over the network - ~& > 'publisher ames hears ack from gall, sends over the network' + ~? > dbug 'publisher ames hears ack from gall, sends over the network' =^ t8 ames.bud %: ames-check-take:v ames.bud [~1111.1.2 0xbeef.dead *roof] @@ -128,7 +129,7 @@ == :- t8 |. :- %| :: subscriber ames hears watch-ack packet, gives to gall - ~& > 'subscriber ames hears watch-ack packet, gives to gall' + ~? > dbug 'subscriber ames hears watch-ack packet, gives to gall' =^ t9 ames.nec %: ames-check-call:v ames.nec [~1111.1.3 0xdead.beef *roof] @@ -148,7 +149,7 @@ == :- t9 |. :- %| :: gall gives %done to itself - ~& > 'gall gives %done to itself' + ~? > dbug 'gall gives %done to itself' =^ t10 gall.nec %: gall-check-take:v gall.nec [~1111.1.3 0xdead.beef *roof] @@ -161,7 +162,7 @@ == :- t10 |. :- %| :: gall gives watch-ack to itself - ~& > 'gall gives watch-ack to itself' + ~? > dbug 'gall gives watch-ack to itself' =^ t11 gall.nec %: gall-check-take:v gall.nec [~1111.1.3 0xdead.beef *roof] @@ -172,7 +173,7 @@ == :- t11 |. :- %| :: start the clog and kick process; give clog to publisher gall - ~& > 'start the clog and kick process; give clog to publisher gall' + ~? > dbug 'start the clog and kick process; give clog to publisher gall' =^ t12 gall.bud %: gall-check-take:v gall.bud [~1111.1.4 0xbeef.dead *roof] @@ -184,7 +185,7 @@ == :- t12 |. :- %| :: gall gives %kick %boon to ames - ~& > 'gall gives %kick %boon to ames' + ~? > dbug 'gall gives %kick %boon to ames' =^ t13 gall.bud %: gall-check-take:v gall.bud [~1111.1.4 0xbeef.dead *roof] @@ -195,7 +196,7 @@ == :- t13 |. :- %| :: ames gives kick over the network - ~& > 'ames gives kick over the network' + ~? > dbug 'ames gives kick over the network' =^ t14 ames.bud %: ames-check-take:v ames.bud [~1111.1.4 0xbeef.dead *roof] @@ -211,7 +212,7 @@ == :- t14 |. :- %| :: subscriber ames receives kick, gives to gall and gives ack to unix - ~& > 'subscriber ames receives kick, gives to gall and gives ack to unix' + ~? > dbug 'subscriber ames receives kick, gives to gall and gives ack to unix' =^ t15 ames.nec %: ames-check-call:v ames.nec [~1111.1.5 0xdead.beef *roof] @@ -233,7 +234,7 @@ == :- t15 |. :- %| :: subscriber gall receives kick %boon from ames, gives to self - ~& > 'subscriber gall receives kick %boon from ames, gives to self' + ~? > dbug 'subscriber gall receives kick %boon from ames, gives to self' =^ t16 gall.nec %: gall-check-take:v gall.nec [~1111.1.5 0xdead.beef *roof] @@ -247,7 +248,7 @@ == == :: subscriber gall receives %kick from itself - ~& > 'subscriber gall receives %kick from itself' + ~? > dbug 'subscriber gall receives %kick from itself' =^ t17 gall.nec %: gall-check-take:v gall.nec [~1111.1.5 0xdead.beef *roof] @@ -261,7 +262,7 @@ == :- t17 |. :- %| :: gall receives %deal %watch from itself, passes to ames - ~& > 'gall receives %deal %watch from itself, passes to ames' + ~? > dbug 'gall receives %deal %watch from itself, passes to ames' =^ t18 gall.nec %: gall-check-call:v gall.nec [~1111.1.5 0xdead.beef *roof] @@ -273,7 +274,7 @@ == :- t18 |. :- %| :: subscriber ames sends new %watch - ~& > 'subscriber ames sends new %watch' + ~? > dbug 'subscriber ames sends new %watch' =^ t19 ames.nec %: ames-check-call:v ames.nec [~1111.1.5 0xdead.beef *roof] @@ -292,7 +293,7 @@ == :- t19 |. :- %| :: subscriber ames sends %cork - ~& > 'subscriber ames sends %cork' + ~? > dbug 'subscriber ames sends %cork' =^ t20 ames.nec %: ames-check-call:v ames.nec [~1111.1.5 0xdead.beef *roof] @@ -310,7 +311,7 @@ == == :: publisher ames hears %kick ack - ~& > 'publisher ames hears %kick ack' + ~? > dbug 'publisher ames hears %kick ack' :- t20 |. :- %| =^ t21 ames.bud %: ames-check-call:v ames.bud @@ -324,7 +325,7 @@ == == :: publisher ames hears new %watch - ~& > 'publisher ames hears new %watch' + ~? > dbug 'publisher ames hears new %watch' :- t21 |. :- %| =^ t22 ames.bud %: ames-check-call:v ames.bud @@ -339,7 +340,7 @@ == == :: publisher gall hears new %watch, passes to self - ~& > 'publisher gall hears new %watch, passes to self' + ~? > dbug 'publisher gall hears new %watch, passes to self' :- t22 |. :- %| =^ t23 gall.bud %: gall-check-call:v gall.bud @@ -351,7 +352,7 @@ == == :: publisher gall runs :pub's +on-watch, gives ack to self - ~& > 'publisher gall runs :pub\'s +on-watch, gives ack to self' + ~? > dbug 'publisher gall runs :pub\'s +on-watch, gives ack to self' :- t23 |. :- %| =^ t24 gall.bud %: gall-check-call:v gall.bud @@ -363,7 +364,7 @@ == == :: publisher gall hears %watch-ack, gives to ames - ~& > 'publisher gall hears %watch-ack, gives to ames' + ~? > dbug 'publisher gall hears %watch-ack, gives to ames' :- t24 |. :- %| =^ t25 gall.bud %: gall-check-take:v gall.bud @@ -374,7 +375,7 @@ == == :: publisher ames hears done from gall, sends over the network - ~& > 'publisher ames hears done from gall, sends over the network' + ~? > dbug 'publisher ames hears done from gall, sends over the network' :- t25 |. :- %| =^ t26 ames.bud %: ames-check-take:v ames.bud @@ -388,7 +389,7 @@ == == == :: publisher ames hears %cork, passes to itself - ~& > 'publisher ames hears %cork, passes to itself' + ~? > dbug 'publisher ames hears %cork, passes to itself' :- t26 |. :- %| =^ t27 ames.bud %: ames-check-call:v ames.bud @@ -403,7 +404,7 @@ == :- t27 |. :- %| :: publisher ames hear cork plea from self, give %done to self - ~& > 'publisher ames hear cork plea from self, give %done to self' + ~? > dbug 'publisher ames hear cork plea from self, give %done to self' =^ t28 ames.bud %: ames-check-call:v ames.bud [~1111.1.8 0xbeef.dead *roof] @@ -413,7 +414,7 @@ == == :: publisher ames hears cork done from self, sends ack and $cork to self - ~& > 'publisher ames hears cork done from self, sends ack and $cork to self' + ~? > dbug 'publisher ames hears cork done from self, sends ack and $cork to self' :- t28 |. :- %| =^ t29 ames.bud %: ames-check-take:v ames.bud @@ -428,7 +429,7 @@ == == == :: subscriber ames hears %watch-ack, gives to gall - ~& > 'subscriber ames hears %watch-ack, gives to gall' + ~? > dbug 'subscriber ames hears %watch-ack, gives to gall' :- t29 |. :- %| =^ t30 ames.nec %: ames-check-call:v ames.nec @@ -447,7 +448,7 @@ == == :: subscriber gall hears new %watch-ack from ames, gives to self - ~& > 'subscriber gall hears new %watch-ack from ames, gives to self' + ~? > dbug 'subscriber gall hears new %watch-ack from ames, gives to self' :- t30 |. :- %| =^ t31 gall.nec %: gall-check-take:v gall.nec @@ -464,7 +465,7 @@ == == :: subscriber gall hears new %watch-ack from self, tells :sub - ~& > 'subscriber gall hears new %watch-ack from self, tells :sub' + ~? > dbug 'subscriber gall hears new %watch-ack from self, tells :sub' :- t31 |. :- %| =^ t32 gall.nec %: gall-check-take:v gall.nec @@ -475,7 +476,7 @@ ~ == :: subscriber ames hears %cork ack, sends $kill to self - ~& > 'subscriber ames hears %cork ack, sends $kill to self' + ~? > dbug 'subscriber ames hears %cork ack, sends $kill to self' :- t32 |. :- %| =^ t33 ames.nec %: ames-check-call:v ames.nec @@ -493,7 +494,7 @@ == == :: subscriber ames hears $kill from self, deletes the flow - ~& > 'subscriber ames hears $kill from self, deletes the flow' + ~? > dbug 'subscriber ames hears $kill from self, deletes the flow' :- t33 |. :- %| =^ t34 ames.nec %: ames-check-call:v ames.nec diff --git a/tests/sys/vane/eyre.hoon b/tests/sys/vane/eyre.hoon index db6e35a989..7aae1175ee 100644 --- a/tests/sys/vane/eyre.hoon +++ b/tests/sys/vane/eyre.hoon @@ -1314,7 +1314,7 @@ |= =time %+ ex ~[/http-blah] =. time (sub time (mod time ~h1)) - [%pass wire %a %keen ~sampel /e/x/(scot %da time)//eauth/url] + [%pass wire %a %keen ~ ~sampel /e/x/(scot %da time)//eauth/url] :: ++ ex-yawn |= =time diff --git a/tests/sys/vane/gall.hoon b/tests/sys/vane/gall.hoon index 73469503dc..a9ffc97d87 100644 --- a/tests/sys/vane/gall.hoon +++ b/tests/sys/vane/gall.hoon @@ -1,7 +1,7 @@ /+ *test /= gall-raw /sys/vane/gall :: -=/ gall-gate (gall-raw ~nec) +=/ nec (gall-raw ~nec) :: |% :: +test-init: test %init @@ -16,22 +16,22 @@ =/ =task:gall [%init ~] [duct task] :: - =/ expected-moves=(list move:gall-gate) ~ + =/ expected-moves=(list move:nec) ~ :: =/ res - (gall-call gall-gate time *roof call-args expected-moves) + (gall-call nec time *roof call-args expected-moves) :: -.res :: +gall-call: have %gall run a +task and assert it produces expected-moves :: ++ gall-call - |= $: gall-gate=_gall-gate + |= $: nec=_nec now=@da scry=roof call-args=[=duct wrapped-task=(hobo task:gall)] - expected-moves=(list move:gall-gate) + expected-moves=(list move:nec) == - =/ gall-core (gall-gate now=now eny=`@`0xdead.beef scry=scry) + =/ gall-core (nec now=now eny=`@`0xdead.beef scry=scry) :: =/ res =/ =type -:!>(*task:gall) @@ -43,4 +43,5 @@ !> -.res :: [output +.res] +:: -- From 21fe99ac472be860867d55075ed17feb88c08578 Mon Sep 17 00:00:00 2001 From: Tinnus Napbus Date: Sat, 30 Sep 2023 13:09:19 +1300 Subject: [PATCH 072/252] kiln: tweak jump mark structures --- pkg/arvo/mar/kiln/jump-ask.hoon | 17 +--------------- pkg/arvo/mar/kiln/jump.hoon | 35 +-------------------------------- 2 files changed, 2 insertions(+), 50 deletions(-) mode change 100644 => 120000 pkg/arvo/mar/kiln/jump-ask.hoon mode change 100644 => 120000 pkg/arvo/mar/kiln/jump.hoon diff --git a/pkg/arvo/mar/kiln/jump-ask.hoon b/pkg/arvo/mar/kiln/jump-ask.hoon deleted file mode 100644 index f75f570aa1..0000000000 --- a/pkg/arvo/mar/kiln/jump-ask.hoon +++ /dev/null @@ -1,16 +0,0 @@ -:: -:::: /hoon/jump-ask/kiln/mar - :: -/? 310 -|_ req=[old=dock new=dock] -:: -++ grow - |% - ++ noun req - -- -++ grab - |% - +$ noun [dock dock] - -- -++ grad %noun --- diff --git a/pkg/arvo/mar/kiln/jump-ask.hoon b/pkg/arvo/mar/kiln/jump-ask.hoon new file mode 120000 index 0000000000..c13477815d --- /dev/null +++ b/pkg/arvo/mar/kiln/jump-ask.hoon @@ -0,0 +1 @@ +../../../base-dev/mar/kiln/jump-ask.hoon \ No newline at end of file diff --git a/pkg/arvo/mar/kiln/jump.hoon b/pkg/arvo/mar/kiln/jump.hoon deleted file mode 100644 index d0ca575110..0000000000 --- a/pkg/arvo/mar/kiln/jump.hoon +++ /dev/null @@ -1,34 +0,0 @@ -:: -:::: /hoon/jump/kiln/mar - :: -/- h=hood -|_ jum=jump:h -:: -++ grow - |% - ++ noun jum - ++ json - =, enjs:format - |^ ^- ^json - %+ frond -.jum - ?- -.jum - %add (pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~) - %yea (pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~) - %nay (pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~) - %all - :- %a - %+ turn ~(tap by all.jum) - |= [old=dock new=dock] - (pairs ['old' (en-dock old)] ['new' (en-dock new)] ~) - == - ++ en-dock - |= =dock - (pairs ['ship' s+(scot %p p.dock)] ['desk' s+q.dock] ~) - -- - -- -++ grab - |% - ++ noun jump:h - -- -++ grad %noun --- diff --git a/pkg/arvo/mar/kiln/jump.hoon b/pkg/arvo/mar/kiln/jump.hoon new file mode 120000 index 0000000000..c8e8202368 --- /dev/null +++ b/pkg/arvo/mar/kiln/jump.hoon @@ -0,0 +1 @@ +../../../base-dev/mar/kiln/jump.hoon \ No newline at end of file From 09716dbd18c7bf0899a95f0c968380d226c37171 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Wed, 4 Oct 2023 22:15:06 -0400 Subject: [PATCH 073/252] ames: replace +rut:by (removed) with +urn:by --- pkg/arvo/sys/vane/ames.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index b9fad5e873..1abab1f8b0 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -5252,7 +5252,7 @@ %= ship-state snd (~(run by snd.ship-state) message-pump-16-to-17) keens (~(run by keens.ship-state) keen-state-16-to-17) - rcv (~(rut by rcv.ship-state) remove-outbound-naxplanations) + rcv (~(urn by rcv.ship-state) remove-outbound-naxplanations) == :: ++ message-pump-16-to-17 From b3389ef7790e59a4b92e8259419537e67b122bf1 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Wed, 4 Oct 2023 22:15:26 -0400 Subject: [PATCH 074/252] hoon: remove ^~ from +bool, misses jet on initial compilation --- pkg/arvo/sys/hoon.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index b48906f05a..9c25095804 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -7176,7 +7176,7 @@ +| %compiler-utilities :: ++ bool :: make loobean - ^~ ^- type + ^- type (fork [%atom %f `%.y] [%atom %f `%.n] ~) :: ++ cell :: make %cell type From 409b1d6a30c1f28311cb3e1480966856f0c70175 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Fri, 17 Jun 2022 13:11:18 -0400 Subject: [PATCH 075/252] test: adds (failing) unit tests for +shas --- tests/sys/hoon/hashes.hoon | 76 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/tests/sys/hoon/hashes.hoon b/tests/sys/hoon/hashes.hoon index ef9ec855e7..302fbb28c7 100644 --- a/tests/sys/hoon/hashes.hoon +++ b/tests/sys/hoon/hashes.hoon @@ -211,6 +211,82 @@ :: == :: +:: input chosen as follows: +:: +:: > =|(i=@ud |-(?.(=(32 (met 3 (shax i))) i $(i +(i))))) +:: 507 +:: > =/(i=@ud 508 |-(?.(=(32 (met 3 (shax i))) i $(i +(i))))) +:: 653 +:: +++ test-shas-smol + ^- tang + ;: weld + %+ expect-eq + !> 0x5e64.27b4.df50.8044.0556.ea06.d5b7.cc22.35db.d62a.ebeb.6bc5.cfb8. + 26de.2e31.6920 + !> `@ux`(shas %foo 0) + :: + %+ expect-eq + !> 0xecb1.6c06.c8e6.9572.7202.a8f6.cbd8.7b3c.a1ab.4670.2b31.2b36.dabd. + 4bcb.ebf2.bc4f + !> `@ux`(shas %foo 1) + :: + %+ expect-eq + !> 0x9a02.666a.9860.0575.8996.2929.cbf5.863b.392e.7692.f95b.d591.6508. + 0e76.5cca.149f + !> `@ux`(shas %foo 506) + :: + %+ expect-eq + !> 0xa2e1.2341.2435.35cc.025b.68e6.24ef.f948.13e4.a80b.99ab.b42e.893f. + 032c.8ab2.5606 + !> `@ux`(shas %foo 507) + :: + %+ expect-eq + !> 0xf184.dab8.34ff.dd4c.6a57.7f49.ac3f.c6d5.4e41.e9e7.30cd.c665.8c51. + d2ae.3989.439a + !> `@ux`(shas %foo 652) + :: + %+ expect-eq + !> 0x90db.3e6b.73db.f5f4.fae2.2801.7ace.c347.ae7b.eae0.9f5c.95d3.fd90. + eec5.8ae1.115e + !> `@ux`(shas %foo 653) + == +:: +++ test-shas-long + ^- tang + ;: weld + :: + %+ expect-eq + !> 0x1f88.2572.f898.a8b6.75c6.c660.6315.19a6.dacc.2934.0caa.ee11.b338. + 1588.1a5d.aee8 + !> `@ux`(shas %foobarbazbud-abcdefghijklmnopqrstuvwxyz 0) + :: + %+ expect-eq + !> 0x3f91.8587.1fe4.480a.1cad.0a4f.6feb.e73f.3313.bf21.4dc6.e059.3b72. + 1227.47ea.70f5 + !> `@ux`(shas %foobarbazbud-abcdefghijklmnopqrstuvwxyz 1) + :: + %+ expect-eq + !> 0xfe84.9453.f7f7.2637.25da.8327.e71f.c4c1.baaf.dec5.e790.0d06.83aa. + 61b2.5e52.5330 + !> `@ux`(shas %foobarbazbud-abcdefghijklmnopqrstuvwxyz 506) + :: + %+ expect-eq + !> 0xacd3.eaec.97cc.b5db.4b4f.b055.ad97.7e29.b767.2434.b7de.6193.6616. + 6852.174a.cb4e + !> `@ux`(shas %foobarbazbud-abcdefghijklmnopqrstuvwxyz 507) + :: + %+ expect-eq + !> 0x911e.59e5.065a.6693.63de.e265.abab.514a.ca11.519b.236c.ebf8.d162. + 7d16.02e7.0782 + !> `@ux`(shas %foobarbazbud-abcdefghijklmnopqrstuvwxyz 652) + :: + %+ expect-eq + !> 0x3912.6b8d.98e1.528a.c9f6.a6ae.1dbe.d496.448e.d5fd.5dda.daaa.e7e8. + f01f.06ba.09db + !> `@ux`(shas %foobarbazbud-abcdefghijklmnopqrstuvwxyz 653) + == +:: ++ test-shax =/ a '' =/ b 'abc' From eddaa489bca76e1d40517172ef3ab27839695a6e Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Thu, 5 Oct 2023 18:32:11 -0400 Subject: [PATCH 076/252] test: fixes failing test by accepting +shas jet as the spec --- tests/sys/hoon/hashes.hoon | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/sys/hoon/hashes.hoon b/tests/sys/hoon/hashes.hoon index 302fbb28c7..f0a16034b1 100644 --- a/tests/sys/hoon/hashes.hoon +++ b/tests/sys/hoon/hashes.hoon @@ -237,8 +237,8 @@ !> `@ux`(shas %foo 506) :: %+ expect-eq - !> 0xa2e1.2341.2435.35cc.025b.68e6.24ef.f948.13e4.a80b.99ab.b42e.893f. - 032c.8ab2.5606 + !> 0xe0d6.a881.1621.f8fc.deb5.8794.e059.6937.8b74.03d3.d6c7.d140.ced4. + 3ec2.d935.bbc4 !> `@ux`(shas %foo 507) :: %+ expect-eq @@ -247,8 +247,8 @@ !> `@ux`(shas %foo 652) :: %+ expect-eq - !> 0x90db.3e6b.73db.f5f4.fae2.2801.7ace.c347.ae7b.eae0.9f5c.95d3.fd90. - eec5.8ae1.115e + !> 0xd7ed.4f04.146d.db1a.604b.6b8e.61a2.83a5.d4dc.7efc.c9e1.5bc6.45ba. + 7363.b297.0691 !> `@ux`(shas %foo 653) == :: From cddc013ae0e2766f23701595583cf63bc268c0b5 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Thu, 5 Oct 2023 18:37:34 -0400 Subject: [PATCH 077/252] hoon: redefine +shas to match urcrypt jet --- pkg/arvo/sys/hoon.hoon | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 9c25095804..bc59247f02 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -3283,7 +3283,8 @@ ++ shas :: salted hash ~/ %shas |= [sal=@ ruz=@] - (shax (mix sal (shax ruz))) + =/ len (max 32 (met 3 sal)) + (shay len (mix sal (shax ruz))) :: ++ shax :: sha-256 ~/ %shax From f2495aafdcefc1538f6a084d52a6fd9215bc3c99 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Fri, 6 Oct 2023 12:31:22 -0400 Subject: [PATCH 078/252] Revert "hoon: add pin and awl arms to test and trim subaxes" --- pkg/arvo/sys/hoon.hoon | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index bc59247f02..d3cc88e8fb 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -226,34 +226,6 @@ * (add (mod b 2) (mul $(b (div b 2)) 2)) == :: -++ pin - ~/ %pin - :: sub axis test - :: - :: checks whether {b} addresses a subtree of the tree addressed by {a}. - |= [a=@ b=@] - ?< =(0 a) - ?< =(0 b) - |- ^- ? - ?: =(a 1) & - ?: =(b 1) | - ?. =((cap a) (cap b)) | - $(a (mas a), b (mas b)) -:: -++ hub - ~/ %hub - :: axis after axis - :: - :: computes the remainder of axis {b} when navigating to {a}. - :: (crashes if not `(pin a b)`) - |= [a=@ b=@] - ?< =(0 a) - ?< =(0 b) - |- ^- @ - ?: =(a 1) b - ?> =((cap a) (cap b)) - $(a (mas a), b (mas b)) -:: :: # %containers :: :: the most basic of data types From c5a14ef1c45f2f9fb073b9bcc892da62b2cdf68d Mon Sep 17 00:00:00 2001 From: pkova Date: Thu, 12 Oct 2023 16:02:59 +0300 Subject: [PATCH 079/252] lull, ames: add %nail gift to send lanes to unix --- pkg/arvo/sys/lull.hoon | 2 + pkg/arvo/sys/vane/ames.hoon | 125 ++++++++++++++++++++++++++++-------- 2 files changed, 101 insertions(+), 26 deletions(-) diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index f537082687..206c651f50 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -828,6 +828,7 @@ :: %done: notify vane that peer (n)acked our message :: %lost: notify vane that we crashed on %boon :: %send: packet to unix + :: %nail: lanes to unix :: :: Remote Scry Gifts :: @@ -843,6 +844,7 @@ [%done error=(unit error)] [%lost ~] [%send =lane =blob] + [%nail =ship lanes=(list lane)] :: [%tune spar roar=(unit roar)] :: diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index b8602af5da..28ca42da87 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -107,6 +107,25 @@ ~% %ames ..part ~ |% +| %helpers +:: +get-forward-lanes: get all lanes to send to when forwarding to peer +:: +++ get-forward-lanes + |= [our=@p peer=peer-state peers=(map ship ship-state)] + ^- (list lane) + =; zar=(trap (list lane)) + ?~ route.peer $:zar + =* rot u.route.peer + ?:(direct.rot [lane.rot ~] [lane.rot $:zar]) + :: + |. ^- (list lane) + ?: ?=(%czar (clan:title sponsor.peer)) + ?: =(our sponsor.peer) + ~ + [%& sponsor.peer]~ + =/ next (~(get by peers) sponsor.peer) + ?. ?=([~ %known *] next) + ~ + $(peer +.u.next) :: +trace: print if .verb is set and we're tracking .ship :: ++ trace @@ -2259,11 +2278,20 @@ (on-publ / [%full (my [sndr.shot point]~)]) :: manually add the lane to the peer state :: + =/ =peer-state (gut-peer-state sndr.shot) + =. route.peer-state `[direct=%.n lane] =. peers.ames-state - =/ =peer-state (gut-peer-state sndr.shot) - =. route.peer-state `[direct=%.n lane] (~(put by peers.ames-state) sndr.shot %known peer-state) :: + =. event-core + %- emit + :* unix-duct.ames-state + %give + %nail + sndr.shot + (get-forward-lanes our peer-state peers.ames-state) + == + :: event-core :: +on-hear-shut: handle receipt of encrypted packet :: @@ -2304,6 +2332,7 @@ (sift-shut-packet shot [symmetric-key her-life our-life]:channel) ?~ shut-packet event-core + =/ old-route route.peer-state :: non-galaxy: update route with heard lane or forwarded lane :: =? route.peer-state !=(%czar (clan:title her.channel)) @@ -2333,10 +2362,21 @@ route.peer-state `[direct=%.n |+u.origin.shot] `[direct=%.n |+u.origin.shot] + :: + =? event-core !=(old-route route.peer-state) + %- emit + :* unix-duct.ames-state + %give + %nail + sndr.shot + (get-forward-lanes our peer-state peers.ames-state) + == :: perform peer-specific handling of packet :: =< abet (~(on-hear-shut-packet pe peer-state channel) [lane u.shut-packet dud]) + :: + :: :: +on-take-boon: receive request to give message to peer :: ++ on-take-boon @@ -2694,6 +2734,15 @@ =. peers.ames-state (~(put by peers.ames-state) ship [%known peer-state]) :: + =. event-core + %- emit + :* unix-duct.ames-state + %give + %nail + ship + (get-forward-lanes our peer-state peers.ames-state) + == + :: event-core :: +on-publ-rekey: handle new key for peer :: @@ -2750,6 +2799,15 @@ event-core =. sponsor.u.state u.sponsor =. peers.ames-state (~(put by peers.ames-state) ship %known u.state) + =. event-core + %- emit + :* unix-duct.ames-state + %give + %nail + ship + (get-forward-lanes our u.state peers.ames-state) + == + :: event-core :: +on-publ-full: handle new pki data for peer(s) :: @@ -2875,6 +2933,14 @@ =. peers.ames-state (~(put by peers.ames-state) ship %known peer-state) :: + =? event-core ?=(%czar (clan:title ship)) + %- emit + :* unix-duct.ames-state + %give + %nail + ship + (get-forward-lanes our peer-state peers.ames-state) + == event-core -- :: +on-take-turf: relay %turf move from jael to unix @@ -3284,7 +3350,16 @@ =. peer-core (update-qos %ames qos:(is-peer-dead now peer-state)) :: expire direct route if the peer is not responding :: + =/ old-route route.peer-state =. peer-state (update-peer-route her peer-state) + =? peer-core !=(old-route route.peer-state) + %- pe-emit + :* unix-duct.ames-state + %give + %nail + her + (get-forward-lanes our peer-state peers.ames-state) + == :: resend comet attestation packet if first message times out :: :: The attestation packet doesn't get acked, so if we tried to @@ -3336,11 +3411,13 @@ ++ on-dear |= =lane ^+ peer-core - peer-core(route.peer-state `[%.y lane]) + %- pe-emit:peer-core(route.peer-state `[%.y lane]) + [unix-duct.ames-state %give %nail her ~[lane]] :: ++ on-tame ^+ peer-core - peer-core(route.peer-state ~) + %- pe-emit:peer-core(route.peer-state ~) + [unix-duct.ames-state %give %nail her ~] :: +on-cork-flow: mark .bone as closing :: ++ on-cork-flow @@ -4817,7 +4894,16 @@ =. peer-core (update-qos %fine qos:(is-peer-dead now peer-state)) :: has the direct route expired? :: - =. peer-state (update-peer-route her peer-state) + =/ old-route route.peer-state + =. peer-state (update-peer-route her peer-state) + =? peer-core !=(old-route route.peer-state) + %- pe-emit + :* unix-duct.ames-state + %give + %nail + her + (get-forward-lanes our peer-state peers.ames-state) + == =. metrics.keen on-timeout:fi-gauge =^ want=(unit want) wan.keen ?~ res=(pry:fi-mop wan.keen) `wan.keen @@ -5382,28 +5468,15 @@ !> ^- (list lane) ?: =(our u.who) ~ - ?. ?=([~ %known *] peer) - =/ sax (rof ~ /ames %j `beam`[[our %saxo %da now] /(scot %p u.who)]) - ?. ?=([~ ~ *] sax) - ~ - =/ gal (rear ;;((list ship) q.q.u.u.sax)) - ?: =(our gal) - ~ - [%& gal]~ - =; zar=(trap (list lane)) - ?~ route.u.peer $:zar - =* rot u.route.u.peer - ?:(direct.rot [lane.rot ~] [lane.rot $:zar]) - :: - |. ^- (list lane) - ?: ?=(%czar (clan:title sponsor.u.peer)) - ?: =(our sponsor.u.peer) - ~ - [%& sponsor.u.peer]~ - =/ next (~(get by peers.ames-state) sponsor.u.peer) - ?. ?=([~ %known *] next) + ?: ?=([~ %known *] peer) + (get-forward-lanes our +.u.peer peers.ames-state) + =/ sax (rof ~ /ames %j `beam`[[our %saxo %da now] /(scot %p u.who)]) + ?. ?=([~ ~ *] sax) ~ - $(peer next) + =/ gal (rear ;;((list ship) q.q.u.u.sax)) + ?: =(our gal) + ~ + [%& gal]~ == :: [%bones her=@ ~] From d92abaab4b4fc37e67d51ba058fde82a905a5fcd Mon Sep 17 00:00:00 2001 From: pkova Date: Fri, 13 Oct 2023 14:55:55 +0300 Subject: [PATCH 080/252] tests: fix test broken by %nail --- tests/sys/vane/ames.hoon | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/sys/vane/ames.hoon b/tests/sys/vane/ames.hoon index a921b3ab35..0ae77b007d 100644 --- a/tests/sys/vane/ames.hoon +++ b/tests/sys/vane/ames.hoon @@ -442,7 +442,7 @@ %+ expect-eq !> =- [~[//unix] %pass /qos %d %flog %text -] "; {} is your neighbor" - !> (snag 0 `(list move:ames)`moves7) + !> (snag 1 `(list move:ames)`moves7) :: %+ expect-eq !> [~[/g/talk] %give %boon post] @@ -473,11 +473,11 @@ ;: weld %+ expect-eq !> [~[//unix] %pass /qos %d %flog %text "; {} is your neighbor"] - !> (snag 0 `(list move:ames)`moves4) + !> (snag 1 `(list move:ames)`moves4) :: %+ expect-eq !> [~[//unix] %pass /qos %d %flog %text "; {} is your neighbor"] - !> (snag 0 `(list move:ames)`moves7) + !> (snag 1 `(list move:ames)`moves7) :: %+ expect-eq !> [~[/g/talk] %give %boon [%post 'first1!!']] From 49be10babd398fe93007662fb4f94c47814afffb Mon Sep 17 00:00:00 2001 From: pkova Date: Mon, 16 Oct 2023 14:20:15 +0300 Subject: [PATCH 081/252] ames: make giving %nail look better --- pkg/arvo/sys/vane/ames.hoon | 37 +++++++------------------------------ 1 file changed, 7 insertions(+), 30 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 28ca42da87..e471935660 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -2285,10 +2285,7 @@ :: =. event-core %- emit - :* unix-duct.ames-state - %give - %nail - sndr.shot + :* unix-duct.ames-state %give %nail sndr.shot (get-forward-lanes our peer-state peers.ames-state) == :: @@ -2365,18 +2362,13 @@ :: =? event-core !=(old-route route.peer-state) %- emit - :* unix-duct.ames-state - %give - %nail - sndr.shot + :* unix-duct.ames-state %give %nail sndr.shot (get-forward-lanes our peer-state peers.ames-state) == :: perform peer-specific handling of packet :: =< abet (~(on-hear-shut-packet pe peer-state channel) [lane u.shut-packet dud]) - :: - :: :: +on-take-boon: receive request to give message to peer :: ++ on-take-boon @@ -2736,10 +2728,7 @@ :: =. event-core %- emit - :* unix-duct.ames-state - %give - %nail - ship + :* unix-duct.ames-state %give %nail ship (get-forward-lanes our peer-state peers.ames-state) == :: @@ -2801,10 +2790,7 @@ =. peers.ames-state (~(put by peers.ames-state) ship %known u.state) =. event-core %- emit - :* unix-duct.ames-state - %give - %nail - ship + :* unix-duct.ames-state %give %nail ship (get-forward-lanes our u.state peers.ames-state) == :: @@ -2935,10 +2921,7 @@ :: =? event-core ?=(%czar (clan:title ship)) %- emit - :* unix-duct.ames-state - %give - %nail - ship + :* unix-duct.ames-state %give %nail ship (get-forward-lanes our peer-state peers.ames-state) == event-core @@ -3354,10 +3337,7 @@ =. peer-state (update-peer-route her peer-state) =? peer-core !=(old-route route.peer-state) %- pe-emit - :* unix-duct.ames-state - %give - %nail - her + :* unix-duct.ames-state %give %nail her (get-forward-lanes our peer-state peers.ames-state) == :: resend comet attestation packet if first message times out @@ -4898,10 +4878,7 @@ =. peer-state (update-peer-route her peer-state) =? peer-core !=(old-route route.peer-state) %- pe-emit - :* unix-duct.ames-state - %give - %nail - her + :* unix-duct.ames-state %give %nail her (get-forward-lanes our peer-state peers.ames-state) == =. metrics.keen on-timeout:fi-gauge From fd0e0f4d378c9c920d62e6a545fca65b019c8ab8 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Tue, 17 Oct 2023 13:10:04 +0100 Subject: [PATCH 082/252] gall: tests, fix key handling --- bin/solid.pill | 4 +- pkg/arvo/sys/vane/ames.hoon | 7 +-- pkg/arvo/sys/vane/gall.hoon | 89 ++++++++++++++++++++-------------- pkg/arvo/ted/keen-shut.hoon | 27 +++++++++++ pkg/arvo/ted/ph/tend.hoon | 70 ++++++++++++++++++++++++++ pkg/arvo/ted/test.hoon | 71 ++++++++++++++++----------- pkg/base-dev/lib/ph/io.hoon | 8 +++ pkg/base-dev/lib/strandio.hoon | 20 ++++++++ tests/app/tend.hoon | 74 ++++++++++++++++++++++++++++ tests/sys/vane/gall.hoon | 24 ++------- tests/tend.hoon | 71 +++++++++++++++++++++++++++ 11 files changed, 372 insertions(+), 93 deletions(-) create mode 100644 pkg/arvo/ted/keen-shut.hoon create mode 100644 pkg/arvo/ted/ph/tend.hoon create mode 100644 tests/app/tend.hoon create mode 100644 tests/tend.hoon diff --git a/bin/solid.pill b/bin/solid.pill index ff0f5b5f64..d832827b65 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5b00a1700d3d4abd17239ec6c1117a22ddce7e901d68a85345b8f14be8531bf8 -size 6886260 +oid sha256:3b46fc86dd5e30bac8a036832cda1714914271403b0cbabc25ee6736b566b618 +size 7512442 diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 4c06e96a22..c8687ded09 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -479,7 +479,7 @@ ++ close |= [=ames-state =path key-idx=@ value=(unit (unit cage))] ?. (check-key ames-state path key-idx) - ~& key-validation-failed/[path key-idx ~(key by chain.ames-state)] + ~& key-validation-failed/[path key-idx chain.ames-state] ~ ?~ value ~& %bailing-close @@ -505,11 +505,6 @@ ++ check-key |= [=ames-state =path key-idx=@] ^- ? - =. path - => .(path `(pole knot)`path) - ?. ?=([van=@ car=@ cas=@ app=@ sig=@ rest=*] path) - path - rest.path ?~ link=(get:on:chain chain.ames-state key-idx) | =/ gol path.u.link diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 0031700136..466f103858 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -81,11 +81,8 @@ $: disclosing=(unit (set ship)) attributing=[=ship =path] == -+$ lock [rev=@ud idx=@ud key=@] -+$ hutch - [=lock chicks=(map path page)] -+$ brood - [=coop =lock chicks=(set path)] ++$ hutch [rev=@ud idx=@ud key=@] ++$ brood [=coop =hutch] :: $yoke: agent runner state :: :: control-duct: TODO document @@ -118,7 +115,8 @@ marks=(map duct mark) sky=farm ken=(jug spar:ames wire) - pen=(map spar:ames wire) + pen=(jug spar:ames wire) + gem=(jug coop [path page]) == == :: +$ plot @@ -137,6 +135,18 @@ :: ++ of |_ =farm + ++ key-coops + =| pos=path + %- ~(gas in *(set coop)) + |- ^- (list coop) + ?: ?=(%coop -.farm) + ~[pos] + %- zing + %+ turn ~(tap by q.farm) + |= [seg=@ta f=^farm] + ^- (list coop) + ^$(pos (snoc pos seg), farm f) + :: ++ migrate |= from=(map spur plot) =/ from ~(tap by from) @@ -367,7 +377,8 @@ marks=(map duct mark) sky=farm ken=(jug spar:ames wire) - pen=(map spar:ames wire) + pen=(jug spar:ames wire) + gem=(jug coop [path page]) == == -- :: adult gall vane interface, for type compatibility with pupa @@ -788,7 +799,7 @@ =* dap agent.pole =/ yoke (~(get by yokes.state) agent.pole) ?. ?=([~ %live *] yoke) - %- (slog leaf+"gall: {} dead, got %stub" ~) + %- (slog leaf+"gall: {<`@t`dap>} dead, got %stub" ~) mo-core ?. =(run-nonce.u.yoke nonce.pole) %- (slog leaf+"gall: got old stub for {}" ~) @@ -1067,7 +1078,7 @@ ?. ?=([~ %live *] yok) (mo-give %done ~) =/ ap-core (ap-abed:ap agent-name [~ our /gall]) - =^ bod=(unit brood) mo-core + =^ bod=(unit (unit brood)) mo-core (ap-serve-brood:ap-core ship path) ?~ bod (mo-give %done ~) @@ -1199,11 +1210,9 @@ ?. ?=([%g %x cas=@ app=@ rest=*] pole) ~& malformed-path/pole ap-core - =. pen.yoke (~(put by pen.yoke) [ship pole] wire) + =. pen.yoke (~(put ju pen.yoke) [ship pole] wire) =/ =plea:ames [%g /gk/[app.pole] rest.pole] - =/ out=^wire (welp /key/[agent-name]/[run-nonce.yoke]/bod/(scot %p ship) pole) - :: =/ =wire (welp /key/pug/[agent-name]/[run-nonce.yoke] coop) - :: TODO: add to state? + =/ out=^wire (welp /key/[agent-name]/[run-nonce.yoke]/bod/(scot %p ship) pole) (ap-move [hen %pass out %a %plea ship plea]~) :: ++ ap-take-brood @@ -1214,12 +1223,17 @@ =/ =ship (slav %p i.wire) ?+ syn ~|(weird-sign-ap-take-brood/-.syn !!) [%ames %boon *] - =+ bod=((soft ,brood) payload.syn) + =+ bod=((soft ,(unit brood)) payload.syn) ?~ bod :: TODO: what happens ~& weird-take-brood/payload.syn !! - =/ key key.lock.u.bod - =/ out=^wire (~(got by pen.yoke) [ship t.wire]) - (ap-pass out %arvo %a %keen `[idx key]:lock.u.bod ship t.wire) + =/ wis=(list ^wire) ~(tap in (~(get ju pen.yoke) [ship t.wire])) + |- + ?~ wis ap-core + ?~ u.bod + =. ap-core (ap-generic-take i.wis %ames %near [ship t.wire] ~) + $(wis t.wis) + =. ap-core (ap-pass i.wis %arvo %a %keen `[idx key]:hutch.u.u.bod ship t.wire) + $(wis t.wis) :: [%ames %done *] ap-core @@ -1227,11 +1241,12 @@ :: ++ ap-serve-brood |= [=ship =(pole knot)] - ^- [(unit brood) _mo-core] + ^- [(unit (unit brood)) _mo-core] ?. ?=([%$ rest=*] pole) `ap-abet ?~ cop=(ap-match-coop rest.pole) - `ap-abet + ~& no-match-coop/rest.pole + [~^~ ap-abet] =/ cag=(unit (unit cage)) (ap-peek %| %c (snoc u.cop (scot %p ship))) =/ has-perms=? @@ -1242,10 +1257,10 @@ u.res =/ =hutch (need (~(get-hutch of:farm sky.yoke) u.cop)) ?. has-perms - `ap-abet - =/ =brood - =,(hutch [u.cop lock ~(key by chicks)]) - [`brood ap-abet] + ~& no-perms/[ship pole] + [~^~ ap-abet] + =/ =brood [u.cop hutch] + [``brood ap-abet] :: ++ ap-yawn-all ^- (list card:agent) @@ -1300,20 +1315,21 @@ :: +ap-tend: bind path in namespace, encrypted ++ ap-tend |= [=coop =path =page] - ?~ cop=(~(get-hutch of:farm sky.yoke) coop) - :: ?. (~(has by hat.yoke) coop) + ?. (~(has by gem.yoke) coop) + ~| ~(key-coops of:farm sky.yoke) ~| no-such-coop/coop !! :: XX: error handling - ::=. hat.yoke (~(put ju hat.yoke) coop path page) - :: ap-core TODO: revivie + =. gem.yoke (~(put ju gem.yoke) coop path page) + ap-core =. sky.yoke (need (~(grow of:farm sky.yoke) (welp coop path) now page)) ap-core :: ++ ap-germ |= =coop - ::=/ hut (~(get by cop.yoke) coop) - :: =? hat.yoke ?=(~ hut) TODO: revive - :: (~(put by hat.yoke) coop ~) + =/ pen (~(get by gem.yoke) coop) + =/ exists !=(~ (~(get of:farm sky.yoke) coop)) + =? gem.yoke &(!exists ?=(~ pen)) + (~(put by gem.yoke) coop ~) =/ =wire (welp /key/[agent-name]/[run-nonce.yoke]/pug coop) (ap-move [hen %pass wire %a %plug %g [agent-name %$ coop]]~) :: @@ -1324,16 +1340,15 @@ ?^ h=(~(get-hutch of:farm sky.yoke) coop) u.h *hutch - =. lock.hutch [.+(rev.lock.hutch) num key] + =. hutch [.+(rev.hutch) num key] =. sky.yoke ?^ new-sky=(~(put-hutch of:farm sky.yoke) coop hutch) u.new-sky sky.yoke - ap-core - :: =/ hat ~(tap in (~(get ju hat.yoke) coop)) - :: |- ^+ ap-core - :: ?~ hat ap-core - :: $(hat t.hat, ap-core (ap-tend coop i.hat)) + =/ gem ~(tap in (~(get ju gem.yoke) coop)) + |- ^+ ap-core + ?~ gem ap-core + $(gem t.gem, ap-core (ap-tend coop i.gem)) :: ++ ap-snip |= =coop @@ -2555,7 +2570,7 @@ |= egg=egg-13 ?: ?=(%nuke -.egg) egg - egg(sky (migrate:of:farm sky.egg), ken [ken.egg ~]) + egg(sky (migrate:of:farm sky.egg), ken [ken.egg ~ ~]) == :: ++ spore-13-to-14 diff --git a/pkg/arvo/ted/keen-shut.hoon b/pkg/arvo/ted/keen-shut.hoon new file mode 100644 index 0000000000..76e6f91ebc --- /dev/null +++ b/pkg/arvo/ted/keen-shut.hoon @@ -0,0 +1,27 @@ +/- spider +/+ strandio +=, strand=strand:spider +^- thread:spider +|= arg=vase +=/ m (strand ,vase) +^- form:m +=+ !<([~ =spar:ames] arg) +;< ~ bind:m + (keen-shut:strandio /keen spar) +;< [* dat=(unit (unit page))] bind:m + (take-near:strandio /keen) +?~ dat + ~& mysterious/~ + (pure:m !>(~)) +?~ u.dat + ~& non-existent/~ + (pure:m !>(~)) +:: +;< =bowl:spider bind:m get-bowl:strandio +=+ .^ =dais:clay %cb + /(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/[p.u.u.dat] + == +=/ res (mule |.((vale.dais q.u.u.dat))) +?. ?=(%| -.res) + (pure:m p.res) +~|(%keen-mark-fail (mean leaf+"-keen: ames vale fail {}" p.res)) diff --git a/pkg/arvo/ted/ph/tend.hoon b/pkg/arvo/ted/ph/tend.hoon new file mode 100644 index 0000000000..f8a67f7524 --- /dev/null +++ b/pkg/arvo/ted/ph/tend.hoon @@ -0,0 +1,70 @@ +/- spider +/+ *ph-io, strandio +/* tend-agent %hoon /tests/app/tend/hoon +=, strand=strand:spider +=< all +|% +++ tend + |= zuse=@ud + =/ m (strand ,~) + ;< ~ bind:m (dojo ~bud ":tend [%tend /foo /baz %kelvin %zuse {(scow %ud zuse)}]") + ;< ~ bind:m (sleep:strandio ~s2) + ;< ~ bind:m (dojo ~bud ":tend +dbug %bowl") + (pure:m ~) +:: +++ keen-wait-for-result + |= [cas=@ud zuse=@ud] + =/ m (strand ,~) + ;< ~ bind:m (dojo ~dev ":tend [%keen ~bud {(scow %ud cas)} /tend//foo/baz]") + ;< ~ bind:m (wait-for-output ~dev "kal=[lal=%zuse num={(scow %ud zuse)}]") + (pure:m ~) +:: +++ setup + =/ m (strand ,~) + ;< ~ bind:m start-simple + :: testing usual case + ;< ~ bind:m (init-ship ~bud &) + ;< ~ bind:m (init-ship ~dev &) + ;< ~ bind:m (dojo ~bud "|mount %base") + ;< ~ bind:m (dojo ~dev "|mount %base") + ;< ~ bind:m (copy-file ~bud /app/tend/hoon tend-agent) + ;< ~ bind:m (copy-file ~dev /app/tend/hoon tend-agent) + ;< ~ bind:m (dojo ~bud "|start %tend") + ;< ~ bind:m (dojo ~dev "|start %tend") + (pure:m ~) +:: +++ all + ^- thread:spider + |= vase + =/ m (strand ,vase) + ;< ~ bind:m test-normal + ;< ~ bind:m test-larval-ames + (pure:m *vase) +:: +++ test-larval-ames + =/ m (strand ,~) + ;< ~ bind:m setup + ;< ~ bind:m (dojo ~bud ":tend [%germ /foo]") + ;< ~ bind:m (sleep:strandio ~s2) + ;< ~ bind:m (tend zuse) + ;< ~ bind:m (keen-wait-for-result 0 zuse) + =/ zuse (dec zuse) + ;< ~ bind:m (tend zuse) + ;< ~ bind:m (keen-wait-for-result 1 zuse) + ;< ~ bind:m end + (pure:m ~) +:: +++ test-normal + =/ m (strand ,~) + ;< ~ bind:m setup + ;< ~ bind:m (send-hi ~bud ~dev) :: make sure both ames have metamorphosed + ;< ~ bind:m (dojo ~bud ":tend [%germ /foo]") + ;< ~ bind:m (sleep:strandio ~s2) + ;< ~ bind:m (tend zuse) + ;< ~ bind:m (keen-wait-for-result 0 zuse) + =/ zuse (dec zuse) + ;< ~ bind:m (tend zuse) + ;< ~ bind:m (keen-wait-for-result 1 zuse) + ;< ~ bind:m end + (pure:m ~) +-- diff --git a/pkg/arvo/ted/test.hoon b/pkg/arvo/ted/test.hoon index 7ea500ec7d..be97bd6586 100644 --- a/pkg/arvo/ted/test.hoon +++ b/pkg/arvo/ted/test.hoon @@ -7,7 +7,7 @@ :: $test-arm: test with name (derived from its arm name in a test core) :: $test-func: single test, as gate; sample is entropy, produces failures :: -+$ test [=path func=test-func] ++$ test [=beam func=test-func] +$ test-arm [name=term func=test-func] +$ test-func (trap tang) +$ args quiet=_& @@ -16,46 +16,43 @@ |_ =args ++ build-file |= =beam - =/ m (strand ,(unit vase)) + =/ m (strand ,[(unit vase) tang]) ^- form:m ;< res=(unit vase) bind:m (build-file:strandio beam) - %. (pure:m res) - ?: =(res ~) - ~>(%slog.0^leaf+"FAILED {(spud s.beam)} (build)" same) - ?: quiet.args - same - ~>(%slog.0^leaf+"built {(spud s.beam)}" same) -:: +run-test: execute an individual test + %+ pure:m res + ?. =(res ~) + ~ + ~[leaf+"FAILED"] + :: +run-test: execute an individual test :: ++ run-test - |= [pax=path test=test-func] + |= [bem=beam test=test-func] ^- [ok=? =tang] - =+ name=(spud pax) =+ run=(mule test) ?- -.run - %| |+(welp p.run leaf+"CRASHED {name}" ~) + %| |+p.run %& ?: =(~ p.run) - &+?:(quiet.args ~ [leaf+"OK {name}"]~) - |+(flop `tang`[leaf+"FAILED {name}" p.run]) + &+~ + |+(flop `tang`[leaf+"FAILED" p.run]) == :: +resolve-test-paths: add test names to file paths to form full identifiers :: ++ resolve-test-paths - |= paths-to-tests=(map path (list test-arm)) + |= paths-to-tests=(map beam (list test-arm)) ^- (list test) - %- sort :_ |=([a=test b=test] !(aor path.a path.b)) + %- sort :_ |=([a=test b=test] !(aor s.beam.a s.beam.b)) ^- (list test) %- zing %+ turn ~(tap by paths-to-tests) - |= [=path test-arms=(list test-arm)] + |= [=beam test-arms=(list test-arm)] ^- (list test) :: for each test, add the test's name to :path :: %+ turn test-arms |= =test-arm ^- test - [(weld path /[name.test-arm]) func.test-arm] + [beam(s (weld s.beam /[name.test-arm])) func.test-arm] :: +get-test-arms: convert test arms to functions and produce them :: ++ get-test-arms @@ -105,6 +102,15 @@ ?. hov ~|(no-tests-at-path+i.bez !!) loop(bez t.bez, fiz (~(put in fiz) [[-.i.bez (snoc xup %hoon)] `tex])) +++ print-failures + |= ls=(list [=beam =tang]) + ^+ same + ?~ ls + same + =/ =tank + [%rose ["\0a" "/={(trip q.beam.i.ls)}={(spud s.beam.i.ls)}:\0a" ""] tang.i.ls] + ~> %slog.[3 tank] + $(ls t.ls) -- ^- thread:spider |= arg=vase @@ -125,26 +131,33 @@ (turn paz |=(p=path ~|([%test-not-beam p] (need (de-beam p))))) ;< fiz=(set [=beam test=(unit term)]) bind:m (find-test-files bez) => .(fiz (sort ~(tap in fiz) aor)) -=| test-arms=(map path (list test-arm)) -=| build-ok=? +=| test-arms=(map beam (list test-arm)) +=| build-failed=(list [beam tang]) |- ^- form:m =* gather-tests $ ?^ fiz - ;< cor=(unit vase) bind:m (build-file beam.i.fiz) + ;< [cor=(unit vase) =tang] bind:m (build-file beam.i.fiz) ?~ cor - gather-tests(fiz t.fiz, build-ok |) + gather-tests(fiz t.fiz, build-failed [[beam.i.fiz tang] build-failed]) =/ arms=(list test-arm) (get-test-arms u.cor) :: if test path specified an arm prefix, filter arms to match =? arms ?=(^ test.i.fiz) %+ skim arms |= test-arm =((end [3 (met 3 u.test.i.fiz)] name) u.test.i.fiz) - =. test-arms (~(put by test-arms) (snip s.beam.i.fiz) arms) + =. test-arms (~(put by test-arms) beam.i.fiz(s (snip s.beam.i.fiz)) arms) gather-tests(fiz t.fiz) -%- pure:m !> ^= ok +=; res=_build-failed + %- (print-failures res) + %- pure:m !> ^= failed + %+ turn res + |= [=beam *] + beam %+ roll (resolve-test-paths test-arms) -|= [[=path =test-func] ok=_build-ok] -^+ ok -=/ res (run-test path test-func) -%- (slog (flop tang.res)) -&(ok ok.res) +|= [[=beam =test-func] failed=_build-failed] +^+ failed +=/ res (run-test beam test-func) +?: -.res + failed +:_ failed +[beam +.res] diff --git a/pkg/base-dev/lib/ph/io.hoon b/pkg/base-dev/lib/ph/io.hoon index a34c00c32d..cd94b30c39 100644 --- a/pkg/base-dev/lib/ph/io.hoon +++ b/pkg/base-dev/lib/ph/io.hoon @@ -256,6 +256,14 @@ ;< ~ bind:m (send-events (insert-files:util her desk [pax warped] ~)) (pure:m warped) :: +++ copy-file + =/ m (strand ,~) + |= [her=ship pax=path file=@t] + ^- form:m + ;< ~ bind:m + (send-events (insert-files:util her %base [pax file] ~)) + (sleep ~s1) +:: :: Check /sur/aquarium/hoon on the given has the given contents. :: ++ check-file-touched diff --git a/pkg/base-dev/lib/strandio.hoon b/pkg/base-dev/lib/strandio.hoon index cd7c6d4366..7660e22636 100644 --- a/pkg/base-dev/lib/strandio.hoon +++ b/pkg/base-dev/lib/strandio.hoon @@ -197,6 +197,20 @@ `[%done +>.sign-arvo.u.in.tin] == :: +++ take-near + |= =wire + =/ m (strand ,[spar:ames (unit (unit page))]) + ^- form:m + |= tin=strand-input:strand + ?+ in.tin `[%skip ~] + ~ `[%wait ~] + :: + [~ %sign * %ames %near ^ *] + ?. =(wire wire.u.in.tin) + `[%skip ~] + `[%done +>.sign-arvo.u.in.tin] + == +:: ++ take-poke-ack |= =wire =/ m (strand ,~) @@ -337,6 +351,12 @@ ^- form:m (send-raw-card %pass wire %arvo %a %keen ~ spar) :: +++ keen-shut + |= [=wire =spar:ames] + =/ m (strand ,~) + ^- form:m + (send-raw-card %pass wire %keen & spar) +:: ++ sleep |= for=@dr =/ m (strand ,~) diff --git a/tests/app/tend.hoon b/tests/app/tend.hoon new file mode 100644 index 0000000000..661f6dd262 --- /dev/null +++ b/tests/app/tend.hoon @@ -0,0 +1,74 @@ +/+ verb, default-agent, dbug +|% ++$ state-0 [%0 ~] ++$ card card:agent:gall ++$ coop coop:gall ++$ action + $% [%tend =coop =path =page] + [%germ =coop] + [%snip =coop] + [%keen =ship case=@ud =path] + == +-- +:: +=| state-0 +=* state - +%+ verb | +%- agent:dbug +^- agent:gall +|_ =bowl:gall ++* this . + def ~(. (default-agent this %|) bowl) +:: +++ on-init + ^- (quip card:agent:gall _this) + [~ this] +:: +++ on-save !>([%0 ~]) +++ on-load + |= old=vase + ^- (quip card:agent:gall _this) + [~ this(state [%0 ~])] +:: +++ on-poke + |= [=mark =vase] + ~| mark/mark + ?> =(%noun mark) + =+ ;;(=action q.vase) + :_ this + ?: ?=(%keen -.action) + =/ =path + %+ welp /g/x/(scot %ud case.action) + path.action + [%pass /keen %keen & ship.action path]~ + [%pass /foo action]~ +++ on-peek + |= =path + ^- (unit (unit cage)) + ~& peek-path/path + ~& eny/eny.bowl + ?. ?=([%c *] path) + [~ ~] + ``noun+!>(&) +++ on-watch on-watch:def +++ on-arvo + |= [=wire syn=sign-arvo] + ^- (quip card _this) + ?: =(/keen wire) + ?: ?=([%ames %near *] syn) + ?. ?=([~ ~ *] dat.syn) + ~& no-item/dat.syn + `this + =/ =path /(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/[p.u.u.dat.syn] + =+ .^ =dais:clay %cb + path + == + :_ this + [%pass /flog %arvo %d %flog %text (noah ;;(vale.dais q.u.u.dat.syn))]~ + `this + `this +:: +++ on-leave on-leave:def +++ on-agent on-agent:def +++ on-fail on-fail:def +-- diff --git a/tests/sys/vane/gall.hoon b/tests/sys/vane/gall.hoon index a9ffc97d87..f30082e99e 100644 --- a/tests/sys/vane/gall.hoon +++ b/tests/sys/vane/gall.hoon @@ -4,24 +4,22 @@ =/ nec (gall-raw ~nec) :: |% +++ time ~1111.1.1 :: +test-init: test %init :: ++ test-init ^- tang :: - =/ time ~1111.1.1 :: =/ call-args =/ =duct ~[/init] =/ =task:gall [%init ~] [duct task] :: - =/ expected-moves=(list move:nec) ~ :: - =/ res - (gall-call nec time *roof call-args expected-moves) - :: - -.res + =^ moves nec + (gall-call nec time *roof call-args) + (expect-eq !>(moves) !>(*(list move:nec))) :: +gall-call: have %gall run a +task and assert it produces expected-moves :: ++ gall-call @@ -29,19 +27,7 @@ now=@da scry=roof call-args=[=duct wrapped-task=(hobo task:gall)] - expected-moves=(list move:nec) == =/ gall-core (nec now=now eny=`@`0xdead.beef scry=scry) - :: - =/ res - =/ =type -:!>(*task:gall) - (call:gall-core duct.call-args dud=~ wrapped-task.call-args) - :: - =/ output=tang - %+ expect-eq - !> expected-moves - !> -.res - :: - [output +.res] -:: + (call:gall-core duct.call-args dud=~ wrapped-task.call-args) -- diff --git a/tests/tend.hoon b/tests/tend.hoon new file mode 100644 index 0000000000..f0c746beb0 --- /dev/null +++ b/tests/tend.hoon @@ -0,0 +1,71 @@ +/+ verb, default-agent, dbug +|% ++$ state-0 [%0 ~] ++$ card card:agent:gall ++$ coop coop:gall ++$ action + $% [%tend =coop =path =page] + [%germ =coop] + [%snip =coop] + [%keen case=@ud =path] + == +-- +:: +=| state-0 +=* state - +%+ verb | +%- agent:dbug +^- agent:gall +|_ =bowl:gall ++* this . + def ~(. (default-agent this %|) bowl) +:: +++ on-init + ^- (quip card:agent:gall _this) + [~ this] +:: +++ on-save !>([%0 ~]) +++ on-load + |= old=vase + ^- (quip card:agent:gall _this) + [~ this(state [%0 ~])] +:: +++ on-poke + |= [=mark =vase] + ~| mark/mark + ?> =(%noun mark) + =+ ;;(=action q.vase) + :_ this + ?: ?=(%keen -.action) + =/ =path + %+ welp /g/x/(scot %ud case.action) + path.action + [%pass /keen %keen & ?:(=(our.bowl ~met) ~hex ~met) path]~ + [%pass /foo action]~ +++ on-peek + |= =path + ^- (unit (unit cage)) + ~& peek-path/path + ~& eny/eny.bowl + ?. ?=([%c *] path) + [~ ~] + ``noun+!>(&) +++ on-watch on-watch:def +++ on-arvo + |= [=wire syn=sign-arvo] + ^- (quip card _this) + ~& syn + ?: =(/keen wire) + ?: ?=([%ames %near *] syn) + ?. ?=([~ ~ *] dat.syn) + ~& no-item/dat.syn + `this + ~& ;;([@tas @tas] q.u.u.dat.syn) + `this + `this + `this +:: +++ on-leave on-leave:def +++ on-agent on-agent:def +++ on-fail on-fail:def +-- From cd46d8ae7e29076e05802df4335aa1212f1d8dce Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Tue, 17 Oct 2023 16:17:15 +0100 Subject: [PATCH 083/252] ames: change encrypted fine to use siv --- pkg/arvo/sys/vane/ames.hoon | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index c8687ded09..6e34afaad1 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -475,7 +475,7 @@ ++ fine-close =< close |% - ++ aes |=(key=@ ~(. cbcc:aes:crypto [key 0])) + ++ aes |=(key=@ ~(. sivc:aes:crypto [key ~])) ++ close |= [=ames-state =path key-idx=@ value=(unit (unit cage))] ?. (check-key ames-state path key-idx) @@ -488,15 +488,19 @@ ``atom+!>(~) ?~ key=(get:on:chain chain.ames-state key-idx) ~ - ``atom+!>((en:(aes key.u.key) (jam [p q.q]:u.u.value))) + ``atom+!>((jam (en:(aes -.u.key) (jam [p q.q]:u.u.value)))) :: ++ shutter - |= [our=ship =ames-state enc=@t key=@] + |= [our=ship =ames-state seg=@t key=@] ^- (unit balk) - ?~ raw=(slaw %uv enc) + ~| seg/seg + ?~ raw=(slaw %uv seg) ~ - =/ txt `@t`(de:(aes key) `@t`u.raw) - ?~ pat=`(unit path)`(rush txt stap) + =+ ;;([iv=@ len=@ enc=@] (cue u.raw)) + ?~ txt=(de:(aes key) iv len enc) + ~ + ~| txt/txt + ?~ pat=`(unit path)`(rush `@t`u.txt stap) ~ =/ here /(scot %p our)/(scot %ud rift.ames-state)/(scot %ud life.ames-state) @@ -2599,11 +2603,12 @@ ~| bad-path/rest.path.s ?> ?=([%fine %shut cyf=@ ~] rest.path.s) =/ [key=@ ,path] (~(got by chain.u.per) (slav %ud idx.wire)) - =/ de de:(aes:fine-close key) + =+ ;;([iv=@ len=@ enc=@] (cue (slav %uv cyf.rest.path.s))) + =/ raw `@t`(need (de:(aes:fine-close key) iv len enc)) =/ pax=path %+ welp /(scot %p ship.s)/(scot %ud rift.u.per)/(scot %ud life.u.per) - (stab `@t`(de (slav %uv cyf.rest.path.s))) + (stab raw) =; dat=(unit (unit page)) (emit duct [%give %near [ship.s pax] dat]) ?: ?| ?=(~ roar) @@ -2611,8 +2616,9 @@ == ~ :: XX weird ?> ?=([%atom @] u.q.dat.u.roar) - =- `?~(- ~ `(,page (cue -))) - (de:(aes:fine-close key) q.u.q.dat.u.roar) + =- `?~(- ~ `(,page (cue u.-))) + %- de:(aes:fine-close key) + ;;([iv=@ len=@ cyf=@] (cue q.u.q.dat.u.roar)) ?> ?=([%chum *] wire) =/ pax =- (,path (cue -)) @@ -3183,7 +3189,9 @@ abet:(on-keen:(abed-peer:pe ship +.u.ship-state) path duct) =. chain.u.ship-state (put:on:chain chain.u.ship-state [idx key /]:u.sec) =. peers.ames-state (~(put by peers.ames-state) ship u.ship-state) - =/ enc (scot %uv (~(en cbcc:aes:crypto [key.u.sec 0]) (spat path))) + =/ enc + %+ scot %uv + (jam (en:(aes:fine-close key.u.sec) (spat path))) =/ lav /a/x/(scot %ud idx.u.sec)//fine/shut/[enc] =/ wir /fine/shut/(scot %ud idx.u.sec) (emit duct %pass wir %a %keen ~ ship lav) From 833d4c871c5b282748db96cdddaaf93f98dad4d8 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Fri, 20 Oct 2023 15:01:43 +0100 Subject: [PATCH 084/252] ames: fix tests for new path schema --- tests/sys/vane/ames.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sys/vane/ames.hoon b/tests/sys/vane/ames.hoon index 9cc6b28fb3..a91ca4cbf1 100644 --- a/tests/sys/vane/ames.hoon +++ b/tests/sys/vane/ames.hoon @@ -714,7 +714,7 @@ :_ ~ %+ expect-eq !>(moves2) !> ^- (list move:ames) - :~ [~[/g/talk] [%pass /fine/shut/1 [%a [%keen sec=~ ship=~nec path=/a/x/1//fine/shut/0v7.vdpsi.f9s0b.1b9k6.u3aho.mtquj]]]] + :~ [~[/g/talk] [%pass /fine/shut/1 [%a [%keen sec=~ ship=~nec path=/a/x/1//fine/shut/0v27.7rg3m.vv773.kfo10.gemn6.dnutr.qqaq7.m0rgf.2ogtk.23t01]]]] == :: -- From 3e7b487a9382155ca1ba456754989c7d2a4d6904 Mon Sep 17 00:00:00 2001 From: Edward Amsden Date: Fri, 20 Oct 2023 21:55:42 -0500 Subject: [PATCH 085/252] hoon: peg crash if b is 0 --- pkg/arvo/sys/hoon.hoon | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index db93638941..1ca16b1842 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -217,6 +217,7 @@ :: computes the axis of {b} within axis {a}. |= [a=@ b=@] ?< =(0 a) + ?< =(0 b) :: a composed axis ^- @ ?- b From f4a0c1d1f65a8b117c995a32d099703fec2c2fb8 Mon Sep 17 00:00:00 2001 From: pkova Date: Sat, 21 Oct 2023 18:46:21 +0300 Subject: [PATCH 086/252] lull, ames: do not store jammed messages in unsent-messages --- pkg/arvo/app/dbug.hoon | 1 + pkg/arvo/sys/lull.hoon | 10 +- pkg/arvo/sys/vane/ames.hoon | 232 ++++++++++++++++++++++++++++-------- 3 files changed, 193 insertions(+), 50 deletions(-) diff --git a/pkg/arvo/app/dbug.hoon b/pkg/arvo/app/dbug.hoon index cc993c9074..9d9723e9a4 100644 --- a/pkg/arvo/app/dbug.hoon +++ b/pkg/arvo/app/dbug.hoon @@ -774,6 +774,7 @@ :: :- 'unsent-messages' :: as byte sizes (set-array unsent-messages (cork (cury met 3) numb)) + (set-array unsent-messages (cork jam (cork (cury met 3) numb))) :: 'unsent-fragments'^(numb (lent unsent-fragments)) :: as lent :: diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index f537082687..9880f4849f 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -904,6 +904,12 @@ :: payload: semantic message contents :: +$ plea [vane=@tas =path payload=*] + :: + +$ message + $% [%plea plea] + [%boon payload=*] + [%naxplanation =message-num =error] + == :: $spar: pair of $ship and $path :: :: Instead of fully qualifying a scry path, ames infers rift and @@ -913,7 +919,7 @@ :: $deep: deferred %ames call, from self, to keep +abet cores pure :: +$ deep - $% [%nack =ship =nack=bone =message-blob] + $% [%nack =ship =nack=bone =message] [%sink =ship =target=bone naxplanation=[=message-num =error]] [%drop =ship =nack=bone =message-num] [%cork =ship =bone] @@ -1157,7 +1163,7 @@ $+ message-pump-state $: current=_`message-num`1 next=_`message-num`1 - unsent-messages=(qeu message-blob) + unsent-messages=(qeu message) unsent-fragments=(list static-fragment) queued-message-acks=(map message-num ack) =packet-pump-state diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index e48623294b..6a5e7941d4 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -1091,6 +1091,55 @@ -- -- :: + ++$ ames-state-17 + $+ ames-state-17 + $: peers=(map ship ship-state-17) + =unix=duct + =life + =rift + crypto-core=acru:ames + =bug + snub=[form=?(%allow %deny) ships=(set ship)] + cong=[msg=_5 mem=_100.000] + :: + $= dead + $: flow=[%flow (unit dead-timer)] + cork=[%cork (unit dead-timer)] + == == ++$ ship-state-17 + $+ ship-state-17 + $% [%alien alien-agenda] + [%known peer-state-17] + == ++$ peer-state-17 + $+ peer-state-17 + $: $: =symmetric-key + =life + =rift + =public-key + sponsor=ship + == + route=(unit [direct=? =lane]) + =qos + =ossuary + snd=(map bone message-pump-state-17) + rcv=(map bone message-sink-state) + nax=(set [=bone =message-num]) + heeds=(set duct) + closing=(set bone) + corked=(set bone) + keens=(map path keen-state) + == ++$ message-pump-state-17 + $+ message-pump-state-17 + $: current=_`message-num`1 + next=_`message-num`1 + unsent-messages=(qeu message-blob) + unsent-fragments=(list static-fragment) + queued-message-acks=(map message-num ack) + =packet-pump-state + == +$ ames-state-14 ames-state-16 +$ ames-state-15 ames-state-16 +$ ames-state-16 @@ -1176,7 +1225,26 @@ $+ task-11-and-16 $% [%kroc dry=?] [%snub ships=(list ship)] - $<(?(%snub %kroc) task) + $<(?(%snub %kroc) task-17) + == +:: ++$ task-17 + $+ task-17 + $% $<(%deep task) + $: %deep + $% [%nack =ship =nack=bone =message-blob] + [%sink =ship =target=bone naxplanation=[=message-num =error]] + [%drop =ship =nack=bone =message-num] + [%cork =ship =bone] + [%kill =ship =bone] + == + == + == +:: ++$ queued-event-17 + $+ queued-event-17 + $% [%call =duct wrapped-task=(hobo task-17)] + [%take =wire =duct =sign] == :: +$ queued-event-16 @@ -1188,7 +1256,7 @@ +$ task-16 $+ task-16 $% [%kroc dry=?] - $<(%kroc task) + $<(%kroc task-17) == :: $bug: debug printing configuration :: @@ -1281,7 +1349,7 @@ :: %wake: handle timer firing :: +$ message-pump-task - $% [%memo =message-blob] + $% [%memo =message] [%hear =message-num =ack-meat] [%near =naxplanation] [%prod ~] @@ -1337,7 +1405,8 @@ [%14 ames-state-14] [%15 ames-state-15] [%16 ames-state-16] - [%17 ^ames-state] + [%17 ames-state-17] + [%18 ^ames-state] == :: |= [now=@da eny=@ rof=roof] @@ -1460,7 +1529,7 @@ :: lifecycle arms; mostly pass-throughs to the contained adult ames :: ++ scry scry:adult-core - ++ stay [%17 %larva queued-events ames-state.adult-gate] + ++ stay [%18 %larva queued-events ames-state.adult-gate] ++ load |= $= old $% $: %4 @@ -1555,6 +1624,13 @@ [%adult state=ames-state-16] == == $: %17 + $% $: %larva + events=(qeu queued-event-17) + state=ames-state-17 + == + [%adult state=ames-state-17] + == == + $: %18 $% $: %larva events=(qeu queued-event) state=_ames-state.adult-gate @@ -1632,7 +1708,7 @@ [%10 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%10 state.old] - =. queued-events (event-11-to-17 events.old) + =. queued-events (event-17-to-18 (event-11-to-17 events.old)) larval-gate :: [%11 %adult *] @@ -1643,7 +1719,7 @@ [%11 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%11 state.old] - =. queued-events (event-11-to-17 events.old) + =. queued-events (event-17-to-18 (event-11-to-17 events.old)) larval-gate :: [%12 %adult *] @@ -1654,7 +1730,7 @@ [%12 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%12 state.old] - =. queued-events (event-16-to-17 events.old) + =. queued-events (event-17-to-18 (event-16-to-17 events.old)) larval-gate :: [%13 %adult *] @@ -1665,7 +1741,7 @@ [%13 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%13 state.old] - =. queued-events (event-16-to-17 events.old) + =. queued-events (event-17-to-18 (event-16-to-17 events.old)) larval-gate :: [%14 %adult *] @@ -1676,7 +1752,7 @@ [%14 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%14 state.old] - =. queued-events (event-16-to-17 events.old) + =. queued-events (event-17-to-18 (event-16-to-17 events.old)) larval-gate :: [%15 %adult *] @@ -1687,7 +1763,7 @@ [%15 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%15 state.old] - =. queued-events (event-16-to-17 events.old) + =. queued-events (event-17-to-18 (event-16-to-17 events.old)) larval-gate :: [%16 %adult *] @@ -1698,15 +1774,27 @@ [%16 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%16 state.old] - =. queued-events (event-16-to-17 events.old) + =. queued-events (event-17-to-18 (event-16-to-17 events.old)) larval-gate :: - [%17 %adult *] (load:adult-core %17 state.old) + [%17 %adult *] + =. cached-state `[%17 state.old] + ~> %slog.0^leaf/"ames: larva reload" + larval-gate :: [%17 %larva *] ~> %slog.1^leaf/"ames: larva: load" + =. cached-state `[%17 state.old] + =. queued-events (event-17-to-18 events.old) + larval-gate + + :: + [%18 %adult *] (load:adult-core %18 state.old) + :: + [%18 %larva *] + ~> %slog.1^leaf/"ames: larva: load" =. queued-events events.old - =. adult-gate (load:adult-core %17 state.old) + =. adult-gate (load:adult-core %18 state.old) larval-gate == :: @@ -1726,10 +1814,10 @@ :: ++ event-11-to-17 |= events=(qeu queued-event-11-and-16) - ^- (qeu queued-event) + ^- (qeu queued-event-17) %- ~(rep in events) - |= [e=queued-event-11-and-16 q=(qeu queued-event)] - %- ~(put to q) ^- queued-event + |= [e=queued-event-11-and-16 q=(qeu queued-event-17)] + %- ~(put to q) ^- queued-event-17 ?. ?=(%call -.e) e =/ task=task-11-and-16 ((harden task-11-and-16) wrapped-task.e) %= e @@ -1742,15 +1830,33 @@ :: ++ event-16-to-17 |= events=(qeu queued-event-16) - ^- (qeu queued-event) + ^- (qeu queued-event-17) %- ~(rep in events) - |= [e=queued-event-16 q=(qeu queued-event)] - %- ~(put to q) ^- queued-event + |= [e=queued-event-16 q=(qeu queued-event-17)] + %- ~(put to q) ^- queued-event-17 ?. ?=(%call -.e) e =/ task=task-16 ((harden task-16) wrapped-task.e) %= e wrapped-task ?.(?=(%kroc -.task) task [%kroc ~]) == + ++ event-17-to-18 + |= events=(qeu queued-event-17) + ^- (qeu queued-event) + %- ~(rep in events) + |= [e=queued-event-17 q=(qeu queued-event)] + %- ~(put to q) ^- queued-event + ?. ?=(%call -.e) e + =/ task=task-17 ((harden task-17) wrapped-task.e) + %= e + wrapped-task + ?. ?=([%deep %nack *] task) task + =/ msg (cue message-blob.task) + =/ hed + ?: =(1 (end 0 nack-bone.task)) %plea + ?: =(0 (end 0 (rsh 0 nack-bone.task))) %boon + %nack + [%deep %nack ship.task nack-bone.task ;;(message [hed msg])] + == -- :: +molt: re-evolve to adult-ames :: @@ -1797,7 +1903,9 @@ (rof ~ /ames %bx [[our %$ da+now] /debug/timers]) |=([@da =duct] ?=([[%ames %recork *] *] duct)) :: - ?> ?=(%17 -.u.cached-state) + =? u.cached-state ?=(%17 -.u.cached-state) + 18+(state-17-to-18:load:adult-core +.u.cached-state) + ?> ?=(%18 -.u.cached-state) =. ames-state.adult-gate +.u.cached-state [moz larval-core(cached-state ~)] -- @@ -1932,12 +2040,11 @@ :: =/ failed=message-num last-acked:(~(got by rcv.peer-state.peer-core) bone) - =/ =naxplanation [failed error] - =/ =message-blob (jam naxplanation) + =/ =message [%naxplanation failed error] :: send nack-trace message on associated .nack-bone :: =/ nack-bone=^bone (mix 0b10 bone) - abet:(call:(abed:mu:peer-core nack-bone) %memo message-blob) + abet:(call:(abed:mu:peer-core nack-bone) %memo message) -- :: +on-sift: handle request to filter debug output by ship :: @@ -2364,7 +2471,7 @@ %- %^ ev-trace odd.veb her |.("parsing old wire: {(spud wire)}") peer-core - abet:(on-memo:peer-core bone payload %boon) + abet:(on-memo:peer-core bone [%boon payload] %boon) :: +on-plea: handle request to send message :: ++ on-plea @@ -2386,7 +2493,7 @@ =/ sndr [our our-life.channel.peer-core] =/ rcvr [ship her-life.channel.peer-core] "plea {}" - abet:(on-memo:peer-core bone plea %plea) + abet:(on-memo:peer-core bone [%plea plea] %plea) :: +on-tame: handle request to delete a route :: ++ on-tame @@ -2429,7 +2536,7 @@ =/ sndr [our our-life.channel.peer-core] =/ rcvr [ship her-life.channel.peer-core] "cork plea {}" - abet:(on-memo:(on-cork-flow:peer-core bone) bone plea %plea) + abet:(on-memo:(on-cork-flow:peer-core bone) bone [%plea plea] %plea) :: +on-kroc: cork all stale flows from failed subscriptions :: ++ on-kroc @@ -2451,7 +2558,7 @@ ?> ?=([~ %known *] ship-state) =+ peer-core=(abed-peer:pe ship.deep +.u.ship-state) |^ ?- -.deep - %nack abet:(send-nack-trace [nack-bone message-blob]:deep) + %nack abet:(send-nack-trace [nack-bone message]:deep) %sink abet:(sink-naxplanation [target-bone naxplanation]:deep) %drop abet:(clear-nack [nack-bone message-num]:deep) %cork =~((cork-bone bone.deep) (emit duct %give %done ~)) @@ -2459,8 +2566,8 @@ == :: ++ send-nack-trace - |= [=nack=bone =message-blob] - abet:(call:(abed:mu:peer-core nack-bone) %memo message-blob) + |= [=nack=bone =message] + abet:(call:(abed:mu:peer-core nack-bone) %memo message) :: ++ sink-naxplanation |= [=target=bone =naxplanation] @@ -3245,8 +3352,8 @@ ~> %slog.0^leaf/"ames: ignoring message on corked bone {}" peer-core :: - =/ =message-blob (jim payload) - =. peer-core abet:(call:(abed:mu bone) %memo message-blob) + =/ =message ;;(message payload) + =. peer-core abet:(call:(abed:mu bone) %memo message) :: ?: ?& =(%boon valence) (gte now (add ~s30 last-contact.qos.peer-state)) @@ -3414,7 +3521,7 @@ =. mem %+ add %- ~(rep in unsent-messages.i.pumps) - |=([a=@ b=_mem] (add b (met 3 a))) + |=([m=message b=_mem] (add b (met 3 (jim m)))) ?~ unsent-fragments.i.pumps 0 (met 3 fragment.i.unsent-fragments.i.pumps) ?: (gte mem mem.cong.ames-state) @@ -3467,8 +3574,9 @@ :: :: TODO use +trace ~> %slog.0^leaf/"ames: recork {}" - =/ =plea [%$ /flow [%cork ~]] - (on-memo i.boz plea %plea) + =/ =plea [%$ /flow [%cork ~]] + =/ =message [%plea plea] + (on-memo i.boz message %plea) :: +handle-cork: handle flow kill after server ames has taken %done :: ++ handle-cork @@ -3566,7 +3674,7 @@ ^+ pump :: ?- -.task - %memo (on-memo message-blob.task) + %memo (on-memo message.task) %prod abet:(call:packet-pump %prod ~) %wake abet:(call:packet-pump %wake current.state) %near %- on-done @@ -3601,8 +3709,8 @@ :: +on-memo: handle request to send a message :: ++ on-memo - |= blob=message-blob - pump(unsent-messages.state (~(put to unsent-messages.state) blob)) + |= =message + pump(unsent-messages.state (~(put to unsent-messages.state) message)) :: +on-hear: handle packet acknowledgment :: ++ on-hear @@ -3727,11 +3835,11 @@ ?~(unsent feed-packets pump) :: .unsent-messages is nonempty; pop a message off and feed it :: - =^ =message-blob unsent-messages.state + =^ =message unsent-messages.state ~(get to unsent-messages.state) :: break .message into .chunks and set as .unsent-fragments :: - =. unsent-fragments.state (split-message next.state message-blob) + =. unsent-fragments.state (split-message next.state (jim +.message)) :: try to feed packets from the next message :: =. next.state +(next.state) @@ -4380,13 +4488,13 @@ |.("sink plea {}") ?. ok =/ nack-bone=^bone (mix 0b10 bone) - =/ =message-blob (jam [message-num *error]) + =/ =^message [%naxplanation message-num *error] =/ =wire (make-bone-wire her her-rift.channel nack-bone) :: send nack-trace with blank .error for security :: =. peer-core %+ pe-emit duct - [%pass wire %a %deep %nack her nack-bone message-blob] + [%pass wire %a %deep %nack her nack-bone message] :: (done ok=%.n) :: @@ -5022,15 +5130,15 @@ [moves ames-gate] :: +stay: extract state before reload :: -++ stay [%17 %adult ames-state] +++ stay [%18 %adult ames-state] :: +load: load in old state after reload :: ++ load =< |= $= old-state - $% [%17 ^ames-state] + $% [%18 ^ames-state] == ^+ ames-gate - ?> ?=(%17 -.old-state) + ?> ?=(%18 -.old-state) ames-gate(ames-state +.old-state) :: all state transitions are called from larval ames :: @@ -5203,7 +5311,7 @@ :: ++ state-16-to-17 |= old=ames-state-16 - ^- ^ames-state + ^- ames-state-17 %= old cong :+ cong.old @@ -5213,7 +5321,7 @@ peers %- ~(run by peers.old) |= ship-state=ship-state-16 - ^- ^ship-state + ^- ship-state-17 ?. ?=(%known -.ship-state) ship-state |^ @@ -5225,7 +5333,7 @@ :: ++ message-pump-16-to-17 |= pump=message-pump-state-16 - ^- message-pump-state + ^- message-pump-state-17 %= pump metrics.packet-pump-state [rto rtt rttvar ssthresh cwnd counter]:metrics.packet-pump-state.pump @@ -5261,6 +5369,34 @@ == -- == + ++ state-17-to-18 + |= old=ames-state-17 + ^- ^ames-state + %= old + peers + %- ~(run by peers.old) + |= s=ship-state-17 + ?: ?=(%alien -.s) s + %= s + snd.+ + %- malt + %+ turn + ~(tap by snd.+.s) + |= [=bone m=message-pump-state-17] + :- bone + %= m + unsent-messages + %- ~(gas to *(qeu message)) + %+ turn + ~(tap to unsent-messages.m) + |= b=message-blob + ^- message + =/ hed + ?: =(1 (end 0 bone)) %plea + ?: =(0 (end 0 (rsh 0 bone))) %boon + %nack + ;;(message [hed (cue b)]) + == == == -- :: +scry: dereference namespace :: From 887915d99d0a65a578a31aa7bf58472effb469cb Mon Sep 17 00:00:00 2001 From: pkova Date: Sat, 21 Oct 2023 19:13:20 +0300 Subject: [PATCH 087/252] ames: use actual types in +on-memo:peer-core --- pkg/arvo/sys/vane/ames.hoon | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 6a5e7941d4..d6e44dbd3b 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -2471,7 +2471,7 @@ %- %^ ev-trace odd.veb her |.("parsing old wire: {(spud wire)}") peer-core - abet:(on-memo:peer-core bone [%boon payload] %boon) + abet:(on-memo:peer-core bone [%boon payload]) :: +on-plea: handle request to send message :: ++ on-plea @@ -2493,7 +2493,7 @@ =/ sndr [our our-life.channel.peer-core] =/ rcvr [ship her-life.channel.peer-core] "plea {}" - abet:(on-memo:peer-core bone [%plea plea] %plea) + abet:(on-memo:peer-core bone [%plea plea]) :: +on-tame: handle request to delete a route :: ++ on-tame @@ -2536,7 +2536,7 @@ =/ sndr [our our-life.channel.peer-core] =/ rcvr [ship her-life.channel.peer-core] "cork plea {}" - abet:(on-memo:(on-cork-flow:peer-core bone) bone [%plea plea] %plea) + abet:(on-memo:(on-cork-flow:peer-core bone) bone [%plea plea]) :: +on-kroc: cork all stale flows from failed subscriptions :: ++ on-kroc @@ -3341,10 +3341,10 @@ :: +on-memo: handle request to send message :: ++ on-memo - |= [=bone payload=* valence=?(%plea %boon)] + |= [=bone =message] ^+ peer-core ?: ?& (~(has in closing.peer-state) bone) - !=(payload [%$ /flow %cork ~]) + !=(message [%plea %$ /flow %cork ~]) == ~> %slog.0^leaf/"ames: ignoring message on closing bone {}" peer-core @@ -3352,10 +3352,9 @@ ~> %slog.0^leaf/"ames: ignoring message on corked bone {}" peer-core :: - =/ =message ;;(message payload) =. peer-core abet:(call:(abed:mu bone) %memo message) :: - ?: ?& =(%boon valence) + ?: ?& ?=(%boon -.message) (gte now (add ~s30 last-contact.qos.peer-state)) == check-clog @@ -3576,7 +3575,7 @@ ~> %slog.0^leaf/"ames: recork {}" =/ =plea [%$ /flow [%cork ~]] =/ =message [%plea plea] - (on-memo i.boz message %plea) + (on-memo i.boz message) :: +handle-cork: handle flow kill after server ames has taken %done :: ++ handle-cork From 840f7e673f658b0c74095272aaaae08ebcd43aeb Mon Sep 17 00:00:00 2001 From: pkova Date: Sat, 21 Oct 2023 19:20:53 +0300 Subject: [PATCH 088/252] dbug: fix git goof --- pkg/arvo/app/dbug.hoon | 1 - pkg/arvo/sys/vane/ames.hoon | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/app/dbug.hoon b/pkg/arvo/app/dbug.hoon index 9d9723e9a4..971e956f10 100644 --- a/pkg/arvo/app/dbug.hoon +++ b/pkg/arvo/app/dbug.hoon @@ -773,7 +773,6 @@ 'next'^(numb next) :: :- 'unsent-messages' :: as byte sizes - (set-array unsent-messages (cork (cury met 3) numb)) (set-array unsent-messages (cork jam (cork (cury met 3) numb))) :: 'unsent-fragments'^(numb (lent unsent-fragments)) :: as lent diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index d6e44dbd3b..19eb677c9d 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -1854,7 +1854,7 @@ =/ hed ?: =(1 (end 0 nack-bone.task)) %plea ?: =(0 (end 0 (rsh 0 nack-bone.task))) %boon - %nack + %naxplanation [%deep %nack ship.task nack-bone.task ;;(message [hed msg])] == -- @@ -5393,7 +5393,7 @@ =/ hed ?: =(1 (end 0 bone)) %plea ?: =(0 (end 0 (rsh 0 bone))) %boon - %nack + %naxplanation ;;(message [hed (cue b)]) == == == -- From bc4edb3054f2d67920a6081e3f0b259100458c70 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Mon, 23 Oct 2023 12:28:35 +0200 Subject: [PATCH 089/252] ames: wip %stun task for handling STUN responses --- pkg/arvo/sys/lull.hoon | 2 ++ pkg/arvo/sys/vane/ames.hoon | 21 ++++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index 0d575b0d52..bfb11b7f3b 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -772,6 +772,7 @@ :: %kroc: request to delete specific message flows, from their bones :: %plea: request to send message :: %deep: deferred calls to %ames, from itself + :: %stun: STUN response (or failure), from unix :: :: Remote Scry Tasks :: @@ -803,6 +804,7 @@ [%kroc bones=(list [ship bone])] $>(%plea vane-task) [%deep =deep] + [%stun fail=?] :: [%keen spar] [%yawn spar] diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index a3a8b895a3..3dc218dff0 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -496,6 +496,11 @@ peer-state peer-state(direct.u.route %.n) :: +++ poke-ping-app + |= [=duct our=ship poke=?(%stop %kick)] + ^- move + [duct %pass /ping %g %deal [our our /ames] %ping %poke noun+!>(poke)] +:: +| %atomics :: +$ private-key @uwprivatekey @@ -2288,7 +2293,7 @@ =. peers.ames-state (~(put by peers.ames-state) sndr.shot %known peer-state) :: - =. event-core + =. event-core %- emit :* unix-duct.ames-state %give %nail sndr.shot (get-forward-lanes our peer-state peers.ames-state) @@ -2518,13 +2523,19 @@ ++ cork-bone |=(=bone abet:(on-cork-flow:peer-core bone)) ++ kill-bone |=(=bone abet:(on-kill-flow:peer-core bone)) -- + :: +on-stun: stop %ping app when hearing a succesful STUN response + :: + ++ on-stun + |= fail=? + ^+ event-core + (emit (poke-ping-app unix-duct.ames-state our ?:(fail %kick %stop))) :: +set-dead-flow-timer: set dead flow timer and corresponding ames state :: ++ set-dead-flow-timer ^+ event-core =. flow.dead.ames-state.event-core flow/`[~[/ames] /dead-flow `@da`(add now ~m2)] - (emit:event-core ~[/ames] %pass /dead-flow %b %wait `@da`(add now ~m2)) + (emit ~[/ames] %pass /dead-flow %b %wait `@da`(add now ~m2)) :: +wake-dead-flows: call on-wake on all dead flows, discarding any :: ames-state changes :: @@ -2965,7 +2976,10 @@ ^- (list move) :~ [duct %give %turf turfs] [duct %give %saxo get-sponsors] - [duct %pass /ping %g %deal [our our /ames] %ping %poke %noun !>(%kick)] + :: always start pinging on every restart; any STUN response + :: (coming from unix as a %stun task) will turn off the %ping app + :: + (poke-ping-app duct our %kick) == :: +on-vega: handle kernel reload :: @@ -5086,6 +5100,7 @@ %tame (on-tame:event-core ship.task) %kroc (on-kroc:event-core bones.task) %deep (on-deep:event-core deep.task) + %stun (on-stun:event-core fail.task) :: %keen (on-keen:event-core +.task) %yawn (on-cancel-scry:event-core | +.task) From 617896d00a04f8d1922428db1fb3e1e62951676c Mon Sep 17 00:00:00 2001 From: pkova Date: Tue, 24 Oct 2023 13:58:38 +0300 Subject: [PATCH 090/252] ames: siglus cache the cues in state migration from 17 to 18 --- pkg/arvo/sys/vane/ames.hoon | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 19eb677c9d..0e64e5566f 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -1850,7 +1850,7 @@ %= e wrapped-task ?. ?=([%deep %nack *] task) task - =/ msg (cue message-blob.task) + =/ msg =>([cue=cue arg=message-blob.task] ~+((cue arg))) =/ hed ?: =(1 (end 0 nack-bone.task)) %plea ?: =(0 (end 0 (rsh 0 nack-bone.task))) %boon @@ -5394,7 +5394,8 @@ ?: =(1 (end 0 bone)) %plea ?: =(0 (end 0 (rsh 0 bone))) %boon %naxplanation - ;;(message [hed (cue b)]) + =/ msg =>([cue=cue arg=b] ~+((cue arg))) + ;;(message [hed msg]) == == == -- :: +scry: dereference namespace From b802dce0fb9f24ec3e943828a20be4be2419c921 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Wed, 25 Oct 2023 09:12:23 +0200 Subject: [PATCH 091/252] ping: add %stop %task to turn %off %ping app --- pkg/arvo/app/ping.hoon | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index 695adab012..e06effac4f 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -36,21 +36,22 @@ [%http until=@da] [%waiting until=@da] == -+$ state-1 - $: %1 ++$ state-2 + $: %2 ships=(set ship) nonce=@ud $= plan $~ [%nat ~] $% [%nat ~] [%pub ip=(unit @t)] + [%off ~] == == -- :: %- agent:dbug :: -=| state=state-1 +=| state=state-2 => |% :: Bind for the the writer monad on (quip effect state) :: @@ -127,6 +128,9 @@ ships.state ships == :: + ?: ?=(%off -.plan.state) + ~& >> "stopping %ping app" + `state ?: ?=(%nat -.plan.state) (kick:nat our) (kick:pub our now) @@ -291,18 +295,34 @@ |^ =/ old !<(state-any old-vase) =? old ?=(%0 -.old) (state-0-to-1 old) - ?> ?=(%1 -.old) + =? old ?=(%1 -.old) (state-1-to-2 old) + ?> ?=(%2 -.old) =. state old =^ cards state (kick:ships our.bowl now.bowl) [cards this] :: - +$ state-any $%(state-0 state-1) - +$ state-0 [%0 ships=(map ship [=rift =ship-state])] + +$ state-any $%(state-0 state-1 state-2) + +$ state-0 [%0 ships=(map ship [=rift =ship-state])] + +$ state-1 + $: %1 + ships=(set ship) + nonce=@ud + $= plan + $~ [%nat ~] + $% [%nat ~] + [%pub ip=(unit @t)] + [%off ~] + == == :: ++ state-0-to-1 |= old=state-0 ^- state-1 [%1 ~ 0 %nat ~] + :: + ++ state-1-to-2 + |= old=state-1 + ^- state-2 + old(- %2) -- :: +on-poke: positively acknowledge pokes :: @@ -311,9 +331,13 @@ ?. =(our src):bowl :: don't crash, this is where pings are handled `this :: + ~& mark^vase =^ cards state ?: =(q.vase %kick) :: NB: ames calls this on %born (kick:ships our.bowl now.bowl) + ?: =(q.vase %stop) :: NB: ames calls this on %stun + =. plan.state [%off ~] + (kick:ships our.bowl now.bowl) ?: =(q.vase %nat) =. plan.state [%nat ~] (kick:ships our.bowl now.bowl) From b5245bc055307cdc72765af7c9d37eb50675ea1d Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Sun, 5 Nov 2023 13:35:26 +0100 Subject: [PATCH 092/252] ping: add support for %once --- pkg/arvo/app/ping.hoon | 71 +++++++++++++++++++++++++++++++------ pkg/arvo/sys/lull.hoon | 9 ++++- pkg/arvo/sys/vane/ames.hoon | 15 ++++---- 3 files changed, 77 insertions(+), 18 deletions(-) diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index e06effac4f..fe7c11c693 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -45,6 +45,7 @@ $% [%nat ~] [%pub ip=(unit @t)] [%off ~] + [%one ~] == == -- @@ -89,8 +90,8 @@ :: behavior here. :: =/ new-ships (~(gas in *(set ship)) (saxo:title our now our)) - =/ removed (~(dif in ships.state) new-ships) - =/ added (~(dif in new-ships) ships.state) + =/ removed (~(dif in ships.state) new-ships) + =/ added (~(dif in new-ships) ships.state) ;< new-state=_state rind ?~ removed `state [[%pass /jael %arvo %j %nuke removed]~ state] @@ -128,15 +129,15 @@ ships.state ships == :: - ?: ?=(%off -.plan.state) - ~& >> "stopping %ping app" - `state - ?: ?=(%nat -.plan.state) - (kick:nat our) - (kick:pub our now) + ?- -.plan.state + %off ~& >> "stopping %ping app" `state + %nat (kick:nat our) + %one (kick:one our) + %pub (kick:pub our now) + == :: :: Subsystem for pinging our sponsors when we might be behind a NAT - :: + :: XX no longer true if using STUN-enabled vere 2.XX :: Ping each ship every 25 seconds to keep the pinhole open. :: This is expensive, but if you don't do it and you are behind a :: NAT, you will stop receiving packets from other ships except @@ -274,6 +275,26 @@ :: (set-timer now) -- + :: Subsystem for formally acknowledge a change in our IP:PORT + :: + :: If our sponsor sends a STUN response, with an IP different than what + :: we had previously cached, we formally acknowledge this change by + :: sending one %poke to every ship in the sponsorship chain. + :: + ++ one + ?> ?=(%one -.plan.state) + |% + ++ kick + |= our=@p + ^- (quip card _state) + :_ state + %- ~(rep in ships.state) + |= [=ship cards=(list card)] + ?: =(our ship) cards + =/ wire /one/(scot %uw nonce.state)/ping/(scot %p ship) + :_ cards ^- card + [%pass wire %agent [ship %ping] %poke %noun !>(~)] + -- -- %+ verb | ^- agent:gall @@ -333,11 +354,33 @@ :: ~& mark^vase =^ cards state - ?: =(q.vase %kick) :: NB: ames calls this on %born + ?: ?=([%kick ?] q.vase) + :: NB: ames calls this on %born (with fail=%.n) and after not hearing STUN + :: responses for more than ~s5 (with fail=%.y) + :: + :: if %ping was turned off (due to a succesfull STUN) but we failed + :: to get a STUN response in time switch to %nat and start a ~s25 timer + :: + :: if the %kick has fail=%.n (e.g. for every %born), the plan will remain + :: unchanged, but we will innitiate a new round of %poke pings with + :: increasing nonce. + :: + :: if we get repeated [%stun fail=&], but we are already in either %nat + :: or %pub, do nothing, since there are already timers in place to %ping + :: repeatedly. + :: + =/ stun-failed=? &(?=(%off -.plan) =(+.q.vase %.y)) + =? plan.state stun-failed + [%nat ~] + ?. &(stun-failed =(+.q.vase %.n)) `state (kick:ships our.bowl now.bowl) - ?: =(q.vase %stop) :: NB: ames calls this on %stun + ?: =(q.vase %stop) :: NB: ames calls this on [%stun fail=%.n] =. plan.state [%off ~] (kick:ships our.bowl now.bowl) + :: XX FIXME won't compile + :: ?: &(=(q.vase %once) ?=(%off -.plan)) :: NB: ames calls this on %once + :: =. plan.state [%one ~] + :: (kick:ships our.bowl now.bowl) ?: =(q.vase %nat) =. plan.state [%nat ~] (kick:ships our.bowl now.bowl) @@ -369,6 +412,12 @@ ?. ?=(%pub -.plan.state) `state ?. ?=(%poke-ack -.sign) `state (take-pings:pub wire p.sign) + :: + [%one *] + ?. ?=(%one -.plan.state) `state + ?: ?=(%poke-ack -.sign) `state + ~& >>> '%once %ping failed' + `state == [cards this] :: +on-arvo: handle timer firing diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index bfb11b7f3b..af68747a61 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -804,7 +804,7 @@ [%kroc bones=(list [ship bone])] $>(%plea vane-task) [%deep =deep] - [%stun fail=?] + [%stun =stun] :: [%keen spar] [%yawn spar] @@ -925,6 +925,13 @@ [%cork =ship =bone] [%kill =ship =bone] == + :: $stun: STUN notifications, from unix + :: + +$ stun + $% [%stop ~] :: succesful STUN response, stop %ping app + [%fail ~] :: failure to STUN, re-enable %ping app + [%once ~] :: new ip discovered, notify ping %app + == :: +| %atomics :: +$ bone @udbone diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 3dc218dff0..8320f1b024 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -497,7 +497,7 @@ peer-state(direct.u.route %.n) :: ++ poke-ping-app - |= [=duct our=ship poke=?(%stop %kick)] + |= [=duct our=ship poke=?(%stop %once [%kick fail=?])] ^- move [duct %pass /ping %g %deal [our our /ames] %ping %poke noun+!>(poke)] :: @@ -2523,12 +2523,15 @@ ++ cork-bone |=(=bone abet:(on-cork-flow:peer-core bone)) ++ kill-bone |=(=bone abet:(on-kill-flow:peer-core bone)) -- - :: +on-stun: stop %ping app when hearing a succesful STUN response + :: +on-stun: poke %ping app when hearing a STUN response :: ++ on-stun - |= fail=? + |= =stun ^+ event-core - (emit (poke-ping-app unix-duct.ames-state our ?:(fail %kick %stop))) + %- emit + %^ poke-ping-app unix-duct.ames-state our + ?. ?=(%fail -.stun) -.stun + [%kick fail=%.y] :: +set-dead-flow-timer: set dead flow timer and corresponding ames state :: ++ set-dead-flow-timer @@ -2979,7 +2982,7 @@ :: always start pinging on every restart; any STUN response :: (coming from unix as a %stun task) will turn off the %ping app :: - (poke-ping-app duct our %kick) + (poke-ping-app duct our %kick fail=%.n) == :: +on-vega: handle kernel reload :: @@ -5100,7 +5103,7 @@ %tame (on-tame:event-core ship.task) %kroc (on-kroc:event-core bones.task) %deep (on-deep:event-core deep.task) - %stun (on-stun:event-core fail.task) + %stun (on-stun:event-core stun.task) :: %keen (on-keen:event-core +.task) %yawn (on-cancel-scry:event-core | +.task) From 95c0bba693bf4e3877f2a4473dab785e0e8ab6be Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Sun, 5 Nov 2023 14:24:30 +0100 Subject: [PATCH 093/252] ping: fix compilation error --- pkg/arvo/app/ping.hoon | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index fe7c11c693..beef0a5e26 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -358,7 +358,7 @@ :: NB: ames calls this on %born (with fail=%.n) and after not hearing STUN :: responses for more than ~s5 (with fail=%.y) :: - :: if %ping was turned off (due to a succesfull STUN) but we failed + :: if %ping was turned off (due to a successfull STUN) but we failed :: to get a STUN response in time switch to %nat and start a ~s25 timer :: :: if the %kick has fail=%.n (e.g. for every %born), the plan will remain @@ -369,7 +369,7 @@ :: or %pub, do nothing, since there are already timers in place to %ping :: repeatedly. :: - =/ stun-failed=? &(?=(%off -.plan) =(+.q.vase %.y)) + =/ stun-failed=? &(?=([%off ~] plan.state) =(+.q.vase %.y)) =? plan.state stun-failed [%nat ~] ?. &(stun-failed =(+.q.vase %.n)) `state @@ -377,10 +377,9 @@ ?: =(q.vase %stop) :: NB: ames calls this on [%stun fail=%.n] =. plan.state [%off ~] (kick:ships our.bowl now.bowl) - :: XX FIXME won't compile - :: ?: &(=(q.vase %once) ?=(%off -.plan)) :: NB: ames calls this on %once - :: =. plan.state [%one ~] - :: (kick:ships our.bowl now.bowl) + ?: &(=(q.vase %once) =(%off -.plan.state)) :: NB: ames calls this on %once + =. plan.state [%one ~] + (kick:ships our.bowl now.bowl) ?: =(q.vase %nat) =. plan.state [%nat ~] (kick:ships our.bowl now.bowl) From 06ec466c1b79d139d87eb32a78c00eeb90ed8d57 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Wed, 8 Nov 2023 12:30:17 +0100 Subject: [PATCH 094/252] ping: better handling of restarts and stun errors --- pkg/arvo/app/ping.hoon | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index beef0a5e26..00fb5d795e 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -275,7 +275,7 @@ :: (set-timer now) -- - :: Subsystem for formally acknowledge a change in our IP:PORT + :: Subsystem for formally acknowledging a change in our IP:PORT :: :: If our sponsor sends a STUN response, with an IP different than what :: we had previously cached, we formally acknowledge this change by @@ -370,9 +370,15 @@ :: repeatedly. :: =/ stun-failed=? &(?=([%off ~] plan.state) =(+.q.vase %.y)) - =? plan.state stun-failed + ?: &(?=([%off ~] plan.state) =(+.q.vase %.n)) + :: ignore restarts if we were already STUNning, if ip:port changed + :: %once will trigger one formal %ping + :: + `state + =? plan.state |(restart stun-failed) [%nat ~] - ?. &(stun-failed =(+.q.vase %.n)) `state + ?: &(!stun-failed =(+.q.vase %.y)) + `state (kick:ships our.bowl now.bowl) ?: =(q.vase %stop) :: NB: ames calls this on [%stun fail=%.n] =. plan.state [%off ~] @@ -415,7 +421,7 @@ [%one *] ?. ?=(%one -.plan.state) `state ?: ?=(%poke-ack -.sign) `state - ~& >>> '%once %ping failed' + :: XX handle error? `state == [cards this] From e2cf4092e7d084adc9f6bd1eaa0f5fc97b25927c Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Wed, 8 Nov 2023 12:53:33 +0100 Subject: [PATCH 095/252] ping: fix errors --- pkg/arvo/app/ping.hoon | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index 00fb5d795e..116cde4911 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -130,7 +130,7 @@ == :: ?- -.plan.state - %off ~& >> "stopping %ping app" `state + %off `state %nat (kick:nat our) %one (kick:one our) %pub (kick:pub our now) @@ -332,7 +332,6 @@ $~ [%nat ~] $% [%nat ~] [%pub ip=(unit @t)] - [%off ~] == == :: ++ state-0-to-1 @@ -375,7 +374,7 @@ :: %once will trigger one formal %ping :: `state - =? plan.state |(restart stun-failed) + =? plan.state stun-failed [%nat ~] ?: &(!stun-failed =(+.q.vase %.y)) `state From e84ed19ae768fdd7cf1412d29299bd9734496365 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Wed, 8 Nov 2023 20:41:18 +0100 Subject: [PATCH 096/252] ames: emit %saxo on breached sponsor --- pkg/arvo/sys/vane/ames.hoon | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 8320f1b024..5cf2811229 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -2750,6 +2750,11 @@ :* unix-duct.ames-state %give %nail ship (get-forward-lanes our peer-state peers.ames-state) == + :: if one of our sponsors breached, give the updated list to vere + :: + =/ sponsors (~(gas in *(set ship)) get-sponsors) + =? event-core (~(has in sponsors) ship) + (emit [unix. %give %saxo ~(tap in sponsors)]) :: event-core :: +on-publ-rekey: handle new key for peer @@ -2828,7 +2833,9 @@ :: ?: =(our ship) =. rift.ames-state rift.point - =. event-core (emit unix-duct.ames-state %give %saxo get-sponsors) + :: XX not needed? + :: =. event-core + :: (emit unix-duct.ames-state %give %saxo get-sponsors) $(points t.points) :: ?. (~(has by keys.point) life.point) @@ -2979,9 +2986,6 @@ ^- (list move) :~ [duct %give %turf turfs] [duct %give %saxo get-sponsors] - :: always start pinging on every restart; any STUN response - :: (coming from unix as a %stun task) will turn off the %ping app - :: (poke-ping-app duct our %kick fail=%.n) == :: +on-vega: handle kernel reload From 56195129913a8cc95907ca3e75b1da682cc9be82 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Wed, 8 Nov 2023 20:46:55 +0100 Subject: [PATCH 097/252] ping: force pinging sponsors on %jael gifts --- pkg/arvo/app/ping.hoon | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index 116cde4911..42305d398d 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -75,6 +75,7 @@ :: and sponsorship changes :: ++ ships + =| force=_| |% ++ rind (^rind card state) ++ kick @@ -104,7 +105,7 @@ :: :: Kick even if ships weren't added or removed :: - (kick-pings our now new-ships) + (kick-pings our now new-ships force) :: :: Kick whenever we get a response. We really care about :: breaches and sponsorship changes. @@ -117,18 +118,19 @@ ^- (quip card _state) [[%pass /jael/delay %arvo %b %wait now]~ state] :: - ++ take-delay kick + ++ take-delay %*(kick ships force %.y) -- :: :: Starts pinging a new set of `ships`. :: ++ kick-pings - |= [our=@p now=@da ships=(set ship)] + |= [our=@p now=@da ships=(set ship) force=?] ^- (quip card _state) =: nonce.state +(nonce.state) ships.state ships == :: + ?: force (kick:nat our) ?- -.plan.state %off `state %nat (kick:nat our) From cc9839f01c99b8b4845c7f9ba26afcace1553ca3 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Wed, 8 Nov 2023 21:10:49 +0100 Subject: [PATCH 098/252] ames: fix error --- pkg/arvo/sys/vane/ames.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 5cf2811229..f95d0f5419 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -2752,9 +2752,9 @@ == :: if one of our sponsors breached, give the updated list to vere :: - =/ sponsors (~(gas in *(set ship)) get-sponsors) + =/ sponsors (~(gas in *(set ^ship)) get-sponsors) =? event-core (~(has in sponsors) ship) - (emit [unix. %give %saxo ~(tap in sponsors)]) + (emit unix-duct.ames-state %give %saxo ~(tap in sponsors)) :: event-core :: +on-publ-rekey: handle new key for peer From fa3722a38f69e4e2e722fbbcb24729a632db8812 Mon Sep 17 00:00:00 2001 From: fang Date: Sat, 4 Nov 2023 10:04:33 +0000 Subject: [PATCH 099/252] eyre: simplify the login page ux a little bit We remove the local<->eauth switching tabs entirely. The only way to see the eauth login page is if the url contains an "eauth" query parameter. (Entering the local ship name into the eauth form still brings you to the normal login screen.) The "proceed as guest" blurp no longer shows the guest identity, and we clarify the language to indicate that it is not guaranteed to result in access to content. Both of those changes help simplify the look and feel of the login page. Various users had complained that it was confusing, given that logging into your own ship is still the common case, and not everyone knows what "euauth" is. For applications redirecting to the login page, it is still recommended to add the ?eauth GET parameter if non-local sessions are supported. For applications that don't it should now be more obvious that logging in through eauth won't do anything (since it's not presented as an option). We also remove some debugging prints that somehow remained in the javascript. --- pkg/arvo/sys/vane/eyre.hoon | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index eb2234eee9..f999d0eabb 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -459,8 +459,6 @@ name.focus(); } function doEauth() { - console.log('mb get value from event', event); - console.log('compare', name.value, our); if (name.value == our) { event.preventDefault(); goLocal(); @@ -471,10 +469,6 @@ ;body =class "{?:(=(`& eauth) "eauth" "local")}" =onload "setup({?:(=(`& eauth) "true" "false")})" - ;nav - ;div.local(onclick "goLocal()"):"Local" - ;div.eauth(onclick "goEauth()"):"EAuth" - == ;div#local ;p:"Urbit ID" ;input(value "{(scow %p our)}", disabled "true", class "mono"); @@ -528,16 +522,11 @@ == == ;* ?: ?=(%ours -.identity) ~ - =+ id=(trim 29 (scow %p who.identity)) =+ as="proceed as{?:(?=(%fake -.identity) " guest" "")}" ;+ ;span.guest.mono - ; Or + ; Or try to ;a/"{(trip (fall redirect-url '/'))}":"{as}" - ; : - ;br; - ; {p.id} - ;br; - ; {q.id} + ; . == == ;script:''' From 2fd30ba06f61892dae281944f28b5e44211afdb9 Mon Sep 17 00:00:00 2001 From: pkova Date: Tue, 3 Oct 2023 16:51:14 +0300 Subject: [PATCH 100/252] base: check for team:title in all places --- pkg/arvo/app/acme.hoon | 1 + pkg/arvo/app/aqua.hoon | 1 + pkg/arvo/app/azimuth-rpc.hoon | 2 +- pkg/arvo/app/azimuth-tracker.hoon | 1 + pkg/arvo/app/azimuth.hoon | 1 + pkg/arvo/app/claz.hoon | 1 + pkg/arvo/app/dojo.hoon | 1 + pkg/arvo/app/eth-sender.hoon | 1 + pkg/arvo/app/eth-watcher.hoon | 1 + pkg/arvo/app/herm.hoon | 1 + pkg/arvo/app/language-server.hoon | 1 + pkg/arvo/app/lens.hoon | 1 + pkg/arvo/app/spider.hoon | 1 + pkg/arvo/app/test.hoon | 1 + pkg/arvo/app/time.hoon | 1 + 15 files changed, 15 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/app/acme.hoon b/pkg/arvo/app/acme.hoon index eea66b1456..93807b4295 100644 --- a/pkg/arvo/app/acme.hoon +++ b/pkg/arvo/app/acme.hoon @@ -346,6 +346,7 @@ ++ on-poke |= [=mark =vase] ^- (quip card _this) + ?> (team:title [our src]:bowl) =^ cards state ?+ mark (on-poke:def mark vase) %acme-order (poke-acme-order:ac !<((set turf) vase)) diff --git a/pkg/arvo/app/aqua.hoon b/pkg/arvo/app/aqua.hoon index 5aac4fa42b..9022afc4e4 100644 --- a/pkg/arvo/app/aqua.hoon +++ b/pkg/arvo/app/aqua.hoon @@ -80,6 +80,7 @@ :: ++ on-poke |= [=mark =vase] + ?> (team:title [our src]:bowl) ^- step:agent:gall =^ cards state ?+ mark ~|([%aqua-bad-mark mark] !!) diff --git a/pkg/arvo/app/azimuth-rpc.hoon b/pkg/arvo/app/azimuth-rpc.hoon index 9d69d49baa..0a94ef5c61 100644 --- a/pkg/arvo/app/azimuth-rpc.hoon +++ b/pkg/arvo/app/azimuth-rpc.hoon @@ -52,7 +52,7 @@ (handle-http-request id req) :: %azimuth-action - ?> (team:title our.bowl src.bowl) + ?> (team:title [our src]:bowl) =+ !<([%disconnect bind=binding:eyre] vase) ~& >>> "disconnecting at {}" :_ this diff --git a/pkg/arvo/app/azimuth-tracker.hoon b/pkg/arvo/app/azimuth-tracker.hoon index 5e904b80d4..9287c4a2a4 100644 --- a/pkg/arvo/app/azimuth-tracker.hoon +++ b/pkg/arvo/app/azimuth-tracker.hoon @@ -121,6 +121,7 @@ :: ++ on-poke |= [=mark =vase] + ?> (our.bowl src.bowl) ?. ?=(%azimuth-tracker-poke mark) (on-poke:def mark vase) =+ !<(poke=poke-data vase) diff --git a/pkg/arvo/app/azimuth.hoon b/pkg/arvo/app/azimuth.hoon index 10a554f989..290bf7f001 100644 --- a/pkg/arvo/app/azimuth.hoon +++ b/pkg/arvo/app/azimuth.hoon @@ -208,6 +208,7 @@ ++ on-poke |= [=mark =vase] ^- (quip card _this) + ?> (team:title [our src]:bowl) ?: =(%noun mark) ?+ q.vase !! [%refresh-rate @] diff --git a/pkg/arvo/app/claz.hoon b/pkg/arvo/app/claz.hoon index 3564077026..ba04b239da 100644 --- a/pkg/arvo/app/claz.hoon +++ b/pkg/arvo/app/claz.hoon @@ -31,6 +31,7 @@ ++ on-poke |= [=mark =vase] ^- (quip card _this) + ?> (team:title [our src]:bowl) ?. ?=(%noun mark) [~ this] ?^ in-progress ~& %still-running-please-try-again-later diff --git a/pkg/arvo/app/dojo.hoon b/pkg/arvo/app/dojo.hoon index eafdfbccfa..c9e139192f 100644 --- a/pkg/arvo/app/dojo.hoon +++ b/pkg/arvo/app/dojo.hoon @@ -1748,6 +1748,7 @@ ++ on-poke |= [=mark =vase] ^- (quip card:agent:gall _..on-init) + ?> (team:title [our src]:hid) =^ moves state ^- (quip card:agent:gall house) ?+ mark ~|([%dojo-poke-bad-mark mark] !!) diff --git a/pkg/arvo/app/eth-sender.hoon b/pkg/arvo/app/eth-sender.hoon index 5c4a5d34a5..9e91105cce 100644 --- a/pkg/arvo/app/eth-sender.hoon +++ b/pkg/arvo/app/eth-sender.hoon @@ -58,6 +58,7 @@ ++ on-poke |= [=mark =vase] ^- (quip card _this) + ?> (team:title [our src]:bowl) ?. ?=(%noun mark) [~ this] =/ =command !<(command vase) ?- -.command diff --git a/pkg/arvo/app/eth-watcher.hoon b/pkg/arvo/app/eth-watcher.hoon index 04584f595f..8d894a5803 100644 --- a/pkg/arvo/app/eth-watcher.hoon +++ b/pkg/arvo/app/eth-watcher.hoon @@ -327,6 +327,7 @@ :: ++ on-poke |= [=mark =vase] + ?> (team:title [our src]:bowl) ?: ?=(%noun mark) ~& state `this diff --git a/pkg/arvo/app/herm.hoon b/pkg/arvo/app/herm.hoon index aefe6c8df7..f20bf2b2d8 100644 --- a/pkg/arvo/app/herm.hoon +++ b/pkg/arvo/app/herm.hoon @@ -81,6 +81,7 @@ ++ on-poke |= [=mark =vase] ^- (quip card:agent:gall _this) + ?> (team:title [our src]:bowl) :_ this :_ ~ ?+ mark ~|([%unexpected-mark mark] !!) diff --git a/pkg/arvo/app/language-server.hoon b/pkg/arvo/app/language-server.hoon index c4aefac8e9..ec59930253 100644 --- a/pkg/arvo/app/language-server.hoon +++ b/pkg/arvo/app/language-server.hoon @@ -77,6 +77,7 @@ ^+ on-poke:*agent:gall |= [=mark =vase] ^- (quip card _this) + ?> (team:title [our src]:bowl) =^ cards state ?+ mark (on-poke:def mark vase) %language-server-rpc-notification diff --git a/pkg/arvo/app/lens.hoon b/pkg/arvo/app/lens.hoon index 36585793ea..d0c9b187e4 100644 --- a/pkg/arvo/app/lens.hoon +++ b/pkg/arvo/app/lens.hoon @@ -50,6 +50,7 @@ ^- (quip card:agent:gall _this) :: ?: &(?=(%noun mark) ?=(%cancel q.vase)) + ?> (team:title [our src]:bowl) ~& %lens-cancel [~ this(job.state ~)] :: diff --git a/pkg/arvo/app/spider.hoon b/pkg/arvo/app/spider.hoon index 09123c34b3..49e547a510 100644 --- a/pkg/arvo/app/spider.hoon +++ b/pkg/arvo/app/spider.hoon @@ -214,6 +214,7 @@ ~/ %on-poke |= [=mark =vase] ^- (quip card _this) + ?> (team:title [our src]:bowl) ?: ?=(%spider-kill mark) (on-load on-save) =^ cards state diff --git a/pkg/arvo/app/test.hoon b/pkg/arvo/app/test.hoon index 3a31d642aa..6b8a7aaa91 100644 --- a/pkg/arvo/app/test.hoon +++ b/pkg/arvo/app/test.hoon @@ -25,6 +25,7 @@ ++ on-poke |= [=mark =vase] ^- [(list card) _this] + ?> (team:title [our src]:bowl) |^ =+ !<(=test vase) ?- test diff --git a/pkg/arvo/app/time.hoon b/pkg/arvo/app/time.hoon index cfc4e0e184..6ff09d2910 100644 --- a/pkg/arvo/app/time.hoon +++ b/pkg/arvo/app/time.hoon @@ -15,6 +15,7 @@ ++ on-load _on-init ++ on-poke |= [=mark =vase] + ?> (team:title [our src]:bowl) ?+ mark !! %noun :_ this [%pass /(scot %da now.bowl) %arvo %b %wait `@da`+(now.bowl)]~ From ffd3a56ac91a9273e37217a7abeecccbe064f717 Mon Sep 17 00:00:00 2001 From: Pyry Kovanen Date: Thu, 21 Sep 2023 00:03:32 +0300 Subject: [PATCH 101/252] eyre: allow header-list to contain multiple cookies --- pkg/arvo/app/azimuth-tracker.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/app/azimuth-tracker.hoon b/pkg/arvo/app/azimuth-tracker.hoon index 9287c4a2a4..4f1c11560c 100644 --- a/pkg/arvo/app/azimuth-tracker.hoon +++ b/pkg/arvo/app/azimuth-tracker.hoon @@ -121,7 +121,7 @@ :: ++ on-poke |= [=mark =vase] - ?> (our.bowl src.bowl) + ?> (team:title [our src]:bowl) ?. ?=(%azimuth-tracker-poke mark) (on-poke:def mark vase) =+ !<(poke=poke-data vase) From 0220c09affd21e0ee4769e344c538f7e72889bc5 Mon Sep 17 00:00:00 2001 From: pkova Date: Tue, 24 Oct 2023 23:24:43 +0300 Subject: [PATCH 102/252] ames: do not ignore our peer-state --- pkg/arvo/sys/vane/ames.hoon | 41 ++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 84ad288eb7..0d2a608162 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -583,7 +583,7 @@ :: dead: dead flow consolidation timer and recork timer, if set :: +$ ames-state - $+ ames-state + $+ ames-state-17 $: peers=(map ship ship-state) =unix=duct =life @@ -1255,7 +1255,7 @@ +$ task-17 $+ task-17 $% $<(%deep task) - $: %deep + $: %deep $% [%nack =ship =nack=bone =message-blob] [%sink =ship =target=bone naxplanation=[=message-num =error]] [%drop =ship =nack=bone =message-num] @@ -1429,7 +1429,7 @@ [%14 ames-state-14] [%15 ames-state-15] [%16 ames-state-16] - [%17 ames-state-17] + [%17 ^ames-state] [%18 ^ames-state] == :: @@ -1660,6 +1660,13 @@ state=_ames-state.adult-gate == [%adult state=_ames-state.adult-gate] + == == + $: %18 + $% $: %larva + events=(qeu queued-event) + state=_ames-state.adult-gate + == + [%adult state=_ames-state.adult-gate] == == == |^ ?- old [%4 %adult *] @@ -1809,9 +1816,8 @@ [%17 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%17 state.old] - =. queued-events (event-17-to-18 events.old) + =. queued-events events.old larval-gate - :: [%18 %adult *] (load:adult-core %18 state.old) :: @@ -1927,8 +1933,13 @@ (rof ~ /ames %bx [[our %$ da+now] /debug/timers]) |=([@da =duct] ?=([[%ames %recork *] *] duct)) :: - =? u.cached-state ?=(%17 -.u.cached-state) - 18+(state-17-to-18:load:adult-core +.u.cached-state) + =^ moz u.cached-state + ?. ?=(%17 -.u.cached-state) [~ u.cached-state] + :_ [%18 +.u.cached-state] + ~> %slog.0^leaf/"ames: fetching our public keys" + ^- (list move) + [[[/ames]~ %pass /public-keys %j %public-keys [n=our ~ ~]] moz] + :: ?> ?=(%18 -.u.cached-state) =. ames-state.adult-gate +.u.cached-state [moz larval-core(cached-state ~)] @@ -2938,13 +2949,12 @@ :: =+ ^- [=ship =point] i.points :: - ?: =(our ship) - =. rift.ames-state rift.point - :: XX not needed? - :: =. event-core - :: (emit unix-duct.ames-state %give %saxo get-sponsors) - $(points t.points) + =? rift.ames-state =(our ship) + rift.point :: + :: XX not needed? + :: =? event-core =(our ship) + :: (emit unix-duct.ames-state %give %saxo get-sponsors) ?. (~(has by keys.point) life.point) $(points t.points) :: @@ -3009,9 +3019,8 @@ ++ on-publ-rift |= [=ship =rift] ^+ event-core - ?: =(our ship) - =. rift.ames-state rift - event-core + =? rift.ames-state =(our ship) + rift ?~ ship-state=(~(get by peers.ames-state) ship) :: print error here? %rift was probably called before %keys :: From 4bef3e15bd54f656c2c56f14621c994f4ee71a7e Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Thu, 16 Nov 2023 09:48:42 +0100 Subject: [PATCH 103/252] Merge branch 'next/kelvin/411' into yu/stun-response --- pkg/arvo/sys/vane/ames.hoon | 66 ++++++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 26 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 0d2a608162..5e00b1779f 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -583,7 +583,7 @@ :: dead: dead flow consolidation timer and recork timer, if set :: +$ ames-state - $+ ames-state-17 + $+ ames-state-19 $: peers=(map ship ship-state) =unix=duct =life @@ -1115,7 +1115,7 @@ -- -- :: - ++$ ames-state-18 ames-state-17 +$ ames-state-17 $+ ames-state-17 $: peers=(map ship ship-state-17) @@ -1429,8 +1429,9 @@ [%14 ames-state-14] [%15 ames-state-15] [%16 ames-state-16] - [%17 ^ames-state] - [%18 ^ames-state] + [%17 ames-state-17] + [%18 ames-state-17] + [%19 ^ames-state] == :: |= [now=@da eny=@ rof=roof] @@ -1553,7 +1554,7 @@ :: lifecycle arms; mostly pass-throughs to the contained adult ames :: ++ scry scry:adult-core - ++ stay [%18 %larva queued-events ames-state.adult-gate] + ++ stay [%19 %larva queued-events ames-state.adult-gate] ++ load |= $= old $% $: %4 @@ -1656,12 +1657,12 @@ == == $: %18 $% $: %larva - events=(qeu queued-event) - state=_ames-state.adult-gate + events=(qeu queued-event-17) + state=ames-state-18 == - [%adult state=_ames-state.adult-gate] + [%adult state=ames-state-18] == == - $: %18 + $: %19 $% $: %larva events=(qeu queued-event) state=_ames-state.adult-gate @@ -1739,7 +1740,7 @@ [%10 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%10 state.old] - =. queued-events (event-17-to-18 (event-11-to-17 events.old)) + =. queued-events (event-17-to-19 (event-11-to-17 events.old)) larval-gate :: [%11 %adult *] @@ -1750,7 +1751,7 @@ [%11 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%11 state.old] - =. queued-events (event-17-to-18 (event-11-to-17 events.old)) + =. queued-events (event-17-to-19 (event-11-to-17 events.old)) larval-gate :: [%12 %adult *] @@ -1761,7 +1762,7 @@ [%12 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%12 state.old] - =. queued-events (event-17-to-18 (event-16-to-17 events.old)) + =. queued-events (event-17-to-19 (event-16-to-17 events.old)) larval-gate :: [%13 %adult *] @@ -1772,7 +1773,7 @@ [%13 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%13 state.old] - =. queued-events (event-17-to-18 (event-16-to-17 events.old)) + =. queued-events (event-17-to-19 (event-16-to-17 events.old)) larval-gate :: [%14 %adult *] @@ -1783,7 +1784,7 @@ [%14 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%14 state.old] - =. queued-events (event-17-to-18 (event-16-to-17 events.old)) + =. queued-events (event-17-to-19 (event-16-to-17 events.old)) larval-gate :: [%15 %adult *] @@ -1794,7 +1795,7 @@ [%15 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%15 state.old] - =. queued-events (event-17-to-18 (event-16-to-17 events.old)) + =. queued-events (event-17-to-19 (event-16-to-17 events.old)) larval-gate :: [%16 %adult *] @@ -1805,7 +1806,7 @@ [%16 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%16 state.old] - =. queued-events (event-17-to-18 (event-16-to-17 events.old)) + =. queued-events (event-17-to-19 (event-16-to-17 events.old)) larval-gate :: [%17 %adult *] @@ -1816,15 +1817,26 @@ [%17 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%17 state.old] - =. queued-events events.old + =. queued-events (event-17-to-19 events.old) larval-gate :: - [%18 %adult *] (load:adult-core %18 state.old) + [%18 %adult *] + =. cached-state `[%18 state.old] + ~> %slog.0^leaf/"ames: larva reload" + larval-gate :: [%18 %larva *] ~> %slog.1^leaf/"ames: larva: load" + =. cached-state `[%18 state.old] + =. queued-events (event-17-to-19 events.old) + larval-gate + :: + [%19 %adult *] (load:adult-core %19 state.old) + :: + [%19 %larva *] + ~> %slog.1^leaf/"ames: larva: load" =. queued-events events.old - =. adult-gate (load:adult-core %18 state.old) + =. adult-gate (load:adult-core %19 state.old) larval-gate == :: @@ -1869,7 +1881,7 @@ %= e wrapped-task ?.(?=(%kroc -.task) task [%kroc ~]) == - ++ event-17-to-18 + ++ event-17-to-19 |= events=(qeu queued-event-17) ^- (qeu queued-event) %- ~(rep in events) @@ -1940,7 +1952,9 @@ ^- (list move) [[[/ames]~ %pass /public-keys %j %public-keys [n=our ~ ~]] moz] :: - ?> ?=(%18 -.u.cached-state) + =? u.cached-state ?=(%18 -.u.cached-state) + 19+(state-18-to-19:load:adult-core +.u.cached-state) + ?> ?=(%19 -.u.cached-state) =. ames-state.adult-gate +.u.cached-state [moz larval-core(cached-state ~)] -- @@ -5230,15 +5244,15 @@ [moves ames-gate] :: +stay: extract state before reload :: -++ stay [%18 %adult ames-state] +++ stay [%19 %adult ames-state] :: +load: load in old state after reload :: ++ load =< |= $= old-state - $% [%18 ^ames-state] + $% [%19 ^ames-state] == ^+ ames-gate - ?> ?=(%18 -.old-state) + ?> ?=(%19 -.old-state) ames-gate(ames-state +.old-state) :: all state transitions are called from larval ames :: @@ -5469,8 +5483,8 @@ == -- == - ++ state-17-to-18 - |= old=ames-state-17 + ++ state-18-to-19 + |= old=ames-state-18 ^- ^ames-state %= old peers From 0b08f07aa721b27a7e4ae750716d5d7b5ff64f9f Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Tue, 21 Nov 2023 10:30:33 +0100 Subject: [PATCH 104/252] lull, ames: add ship and lane to %stun task --- pkg/arvo/sys/lull.hoon | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index 0fb895b061..e95a6f947d 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -933,10 +933,12 @@ == :: $stun: STUN notifications, from unix :: + :: .lane is the latest cached lane in vere, from the point of view of .ship + :: +$ stun - $% [%stop ~] :: succesful STUN response, stop %ping app - [%fail ~] :: failure to STUN, re-enable %ping app - [%once ~] :: new ip discovered, notify ping %app + $% [%stop =ship =lane] :: succesful STUN response, stop %ping app + [%fail =ship =lane] :: failure to STUN, re-enable %ping app + [%once =ship =lane] :: new lane discovered, notify ping %app == :: +| %atomics :: From b0bdfcce61558ca9e2d480b77d99edf04cff2f5b Mon Sep 17 00:00:00 2001 From: pkova Date: Tue, 21 Nov 2023 18:44:52 +0200 Subject: [PATCH 105/252] gall: migrate sky to versioned path --- pkg/arvo/sys/lull.hoon | 2 +- pkg/arvo/sys/vane/gall.hoon | 139 ++++++++++++++++++++++-------------- 2 files changed, 85 insertions(+), 56 deletions(-) diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index c12cea0709..fc04b99602 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -2762,7 +2762,7 @@ sky=(map spur path-state) ken=(jug spar:ames wire) == == - +$ egg-any $%([%15 egg]) + +$ egg-any $%([%15 egg %16 egg]) +$ bowl :: standard app state $: $: our=ship :: host src=ship :: guest diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 8c0ce77531..74f14527df 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -42,9 +42,9 @@ :: $move: Arvo-level move :: +$ move [=duct move=(wind note-arvo gift-arvo)] -:: $state-15: overall gall state, versioned +:: $state-16: overall gall state, versioned :: -+$ state-15 [%15 state] ++$ state-16 [%16 state] :: $state: overall gall state :: :: system-duct: TODO document @@ -150,8 +150,7 @@ :: remember to duplicate version tag changes here to $egg-any:gall in lull :: +$ spore - $: %15 - system-duct=duct + $: system-duct=duct outstanding=(map [wire duct] (qeu remote-request)) contacts=(set ship) eggs=(map term egg) @@ -159,10 +158,11 @@ =bug leaves=(unit [=duct =wire date=@da]) == ++$ spore-16 [%16 spore] -- :: adult gall vane interface, for type compatibility with pupa :: -=| state=state-15 +=| state=state-16 |= [now=@da eny=@uvJ rof=roof] =* gall-payload . ~% %gall-top ..part ~ @@ -1062,7 +1062,7 @@ %+ trace & [leaf+"gall: {}: cull {<[case spur]>} no paths"]~ =/ fis (need (pry:on-path fan.u.old)) - ?. &((gth yon key.fis) (lte yon key.u.las)) + ?. &((gte yon key.fis) (lte yon key.u.las)) %. sky.yoke %+ trace & :_ ~ @@ -1791,12 +1791,16 @@ ^+ [fex ap-core] ?~ caz [(flop fex) ap-core] ?- i.caz - [%pass * %grow *] $(caz t.caz, ap-core (ap-grow +.q.i.caz)) - [%pass * %tomb *] $(caz t.caz, ap-core (ap-tomb +.q.i.caz)) - [%pass * %cull *] $(caz t.caz, ap-core (ap-cull +.q.i.caz)) [%pass * ?(%agent %arvo %pyre) *] $(caz t.caz, fex [i.caz fex]) [%give *] $(caz t.caz, fex [i.caz fex]) [%slip *] !! + :: + [%pass * %grow *] + $(caz t.caz, ap-core (ap-grow ['1' +<.q.i.caz] +>.q.i.caz)) + [%pass * %tomb *] + $(caz t.caz, ap-core (ap-tomb +<.q.i.caz ['1' +>.q.i.caz])) + [%pass * %cull *] + $(caz t.caz, ap-core (ap-cull +<.q.i.caz ['1' +>.q.i.caz])) == :: +ap-handle-ken :: @@ -1959,31 +1963,33 @@ :: ++ 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) - =? old ?=(%11 -.old) (spore-11-to-12 old) - =? old ?=(%12 -.old) (spore-12-to-13 old) - =? old ?=(%13 -.old) (spore-13-to-14 old) - =? old ?=(%14 -.old) (spore-14-to-15 old) - ?> ?=(%15 -.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) + =? old ?=(%10 -.old) (spore-10-to-11 +.old) + =? old ?=(%11 -.old) (spore-11-to-12 +.old) + =? old ?=(%12 -.old) (spore-12-to-13 +.old) + =? old ?=(%13 -.old) (spore-13-to-14 +.old) + =? old ?=(%14 -.old) (spore-14-to-15 +.old) + =? old ?=(%15 -.old) (spore-15-to-16 +.old) + ?> ?=(%16 -.old) gall-payload(state old) :: +$ spore-any - $% spore - spore-7 - spore-8 - spore-9 - spore-10 - spore-11 - spore-12 - spore-13 - spore-14 + $% [%16 spore] + [%7 spore-7] + [%8 spore-8] + [%9 spore-9] + [%10 spore-10] + [%11 spore-11] + [%12 spore-12] + [%13 spore-13] + [%14 spore-14] + [%15 spore-15] == + +$ spore-15 spore +$ spore-14 - $: %14 - system-duct=duct + $: system-duct=duct outstanding=(map [wire duct] (qeu remote-request)) contacts=(set ship) eggs=(map term egg) @@ -1991,8 +1997,7 @@ =bug == +$ spore-13 - $: %13 - system-duct=duct + $: system-duct=duct outstanding=(map [wire duct] (qeu remote-request)) contacts=(set ship) eggs=(map term egg) @@ -2005,8 +2010,7 @@ attributing=ship == +$ spore-12 - $: %12 - system-duct=duct + $: system-duct=duct outstanding=(map [wire duct] (qeu remote-request)) contacts=(set ship) eggs=(map term egg-12) @@ -2030,8 +2034,7 @@ sky=(map spur path-state) == == +$ spore-11 - $: %11 - system-duct=duct + $: system-duct=duct outstanding=(map [wire duct] (qeu remote-request)) contacts=(set ship) eggs=(map term egg-11) @@ -2052,8 +2055,7 @@ marks=(map duct mark) == +$ spore-10 - $: %10 - system-duct=duct + $: system-duct=duct outstanding=(map [wire duct] (qeu remote-request)) contacts=(set ship) eggs=(map term egg-10) @@ -2074,8 +2076,7 @@ marks=(map duct mark) == +$ spore-9 - $: %9 - system-duct=duct + $: system-duct=duct outstanding=(map [wire duct] (qeu remote-request-9)) contacts=(set ship) eggs=(map term egg-10) @@ -2086,8 +2087,7 @@ +$ remote-request-9 ?(remote-request %cork) :: +$ spore-8 - $: %8 - system-duct=duct + $: system-duct=duct outstanding=(map [wire duct] (qeu remote-request-9)) contacts=(set ship) eggs=(map term egg-8) @@ -2106,8 +2106,7 @@ +$ 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 + $: wipe-eyre-subs=_| ::NOTE band-aid for #3196 system-duct=duct outstanding=(map [wire duct] (qeu remote-request-9)) contacts=(set ship) @@ -2117,20 +2116,22 @@ :: ++ spore-7-to-8 |= old=spore-7 - ^- spore-8 + ^- spore-any :- %8 + ^- spore-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 + +.old :: ++ spore-8-to-9 |= old=spore-8 + :- %9 ^- spore-9 - =- old(- %9, eggs -, blocked [blocked.old *bug]) + =- old(eggs -, blocked [blocked.old *bug]) %- ~(run by eggs.old) |= =egg-8 ^- egg-10 @@ -2153,7 +2154,9 @@ :: ++ spore-9-to-10 |= old=spore-9 - =- old(- %10, outstanding -) + :- %10 + ^- spore-10 + =- old(outstanding -) %- ~(run by outstanding.old) |= q=(qeu remote-request-9) %- ~(gas to *(qeu remote-request)) @@ -2166,9 +2169,9 @@ :: ++ spore-10-to-11 |= old=spore-10 + :- %11 ^- spore-11 %= old - - %11 eggs %- ~(urn by eggs.old) |= [a=term e=egg-10] @@ -2180,9 +2183,9 @@ :: ++ spore-11-to-12 |= old=spore-11 + :- %12 ^- spore-12 %= old - - %12 eggs %- ~(urn by eggs.old) |= [a=term e=egg-11] @@ -2194,9 +2197,9 @@ :: ++ spore-12-to-13 |= old=spore-12 + :- %13 ^- spore-13 %= old - - %13 eggs %- ~(urn by eggs.old) |= [a=term e=egg-12] @@ -2208,10 +2211,9 @@ :: ++ spore-13-to-14 |= old=spore-13 + :- %14 ^- spore-14 %= old - - %14 - :: blocked ^- (map term (qeu blocked-move)) %- ~(run by blocked.old) @@ -2228,8 +2230,35 @@ :: ++ spore-14-to-15 |= old=spore-14 - ^- spore - old(- %15, bug [bug.old ~]) + :- %15 + ^- spore-15 + old(bug [bug.old ~]) + :: convert to versioned sky + :: + ++ spore-15-to-16 + |= old=spore-15 + ^- spore-16 + :- %16 + %= old + eggs + %- ~(urn by eggs.old) + |= [=term e=egg] + ^- egg + ?: ?=(%nuke -.e) e(sky *(map spur @ud)) + %= e + sky + %- molt + %+ turn ~(tap by sky.e) + |= [=spur p=path-state] + :- ['1' spur] + :- ~ + =/ m ~(val by fan.p) + %+ gas:on-path *_fan.p + %+ turn (gulf 1 ~(wyt by fan.p)) + |= a=@ud + [a (snag (dec a) m)] + == + == -- :: +scry: standard scry :: @@ -2432,7 +2461,7 @@ :: TODO: superfluous? see +molt :: ++ stay - ^- spore + ^- spore-16 =; eggs=(map term egg) state(yokes eggs) %- ~(run by yokes.state) |= =yoke From 44f731d15e2eeceb42928ce25e937a6ae4cf7e00 Mon Sep 17 00:00:00 2001 From: pkova Date: Thu, 23 Nov 2023 14:05:23 +0200 Subject: [PATCH 106/252] gall: check for properly versioned sky only at scry entry points --- pkg/arvo/sys/vane/gall.hoon | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 74f14527df..48b3eb463f 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -1791,16 +1791,12 @@ ^+ [fex ap-core] ?~ caz [(flop fex) ap-core] ?- i.caz + [%pass * %grow *] $(caz t.caz, ap-core (ap-grow +.q.i.caz)) + [%pass * %tomb *] $(caz t.caz, ap-core (ap-tomb +.q.i.caz)) + [%pass * %cull *] $(caz t.caz, ap-core (ap-cull +.q.i.caz)) [%pass * ?(%agent %arvo %pyre) *] $(caz t.caz, fex [i.caz fex]) [%give *] $(caz t.caz, fex [i.caz fex]) [%slip *] !! - :: - [%pass * %grow *] - $(caz t.caz, ap-core (ap-grow ['1' +<.q.i.caz] +>.q.i.caz)) - [%pass * %tomb *] - $(caz t.caz, ap-core (ap-tomb +<.q.i.caz ['1' +>.q.i.caz])) - [%pass * %cull *] - $(caz t.caz, ap-core (ap-cull +<.q.i.caz ['1' +>.q.i.caz])) == :: +ap-handle-ken :: @@ -2250,7 +2246,7 @@ %- molt %+ turn ~(tap by sky.e) |= [=spur p=path-state] - :- ['1' spur] + :- spur :- ~ =/ m ~(val by fan.p) %+ gas:on-path *_fan.p @@ -2370,14 +2366,17 @@ ?: ?& =(%w care) =([%$ %da now] coin) =(our ship) + ?=([%'1' *] path) == + => .(path t.path) =/ yok (~(get by yokes.state) q.bem) ?. ?=([~ %live *] yok) [~ ~] ?~ ski=(~(get by sky.u.yok) path) [~ ~] ?~ las=(ram:on-path fan.u.ski) [~ ~] ``case/!>(ud/key.u.las) :: - ?: ?=(%x care) + ?: &(?=(%x care) ?=([%'1' *] path)) + => .(path t.path) ?. =(p.bem our) ~ :: ?: ?=(%$ q.bem) :: app %$ reserved @@ -2430,7 +2429,9 @@ ?: ?& =(%t care) =([%$ %da now] coin) =(our ship) + ?=([%'1' *] path) == + => .(path t.path) =/ yok (~(get by yokes.state) q.bem) ?. ?=([~ %live *] yok) ~ :^ ~ ~ %file-list !> ^- (list ^path) @@ -2442,7 +2443,9 @@ :: ?: ?& =(%z care) =(our ship) + ?=([%'1' *] path) == + => .(path t.path) =/ yok (~(get by yokes.state) q.bem) ?. ?=([~ %live *] yok) ~ ?~ ski=(~(get by sky.u.yok) path) ~ From f4706de23fb2ce27f896b152d50dbd73dc4eaff5 Mon Sep 17 00:00:00 2001 From: pkova Date: Thu, 23 Nov 2023 14:06:36 +0200 Subject: [PATCH 107/252] lull: fix wrong $egg-any --- pkg/arvo/sys/lull.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index fc04b99602..6aac4eb4ea 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -2762,7 +2762,7 @@ sky=(map spur path-state) ken=(jug spar:ames wire) == == - +$ egg-any $%([%15 egg %16 egg]) + +$ egg-any $%([%15 egg] [%16 egg]) +$ bowl :: standard app state $: $: our=ship :: host src=ship :: guest From f71bbfe4f17dd9812a66b78119c61b06ba86685d Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Tue, 28 Nov 2023 22:27:28 -0500 Subject: [PATCH 108/252] tests: adds ?: miscompilation test case --- tests/bug/wtcl-crash.hoon | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 tests/bug/wtcl-crash.hoon diff --git a/tests/bug/wtcl-crash.hoon b/tests/bug/wtcl-crash.hoon new file mode 100644 index 0000000000..4c8f3edb3d --- /dev/null +++ b/tests/bug/wtcl-crash.hoon @@ -0,0 +1,13 @@ +:: miscompilation: crashing conditional expression compiled out +:: +/+ *test +|% +:: +++ test-wtcl-cond-crash + %- expect-fail + |. %. %foo + |= sam=$@(?(%foo %bar) [%baz @]) + ^- [%baz @] + ?> ?=(%baz -.sam) + sam +-- From 09286022f5463d3ee0953119e92fa0067aa443ce Mon Sep 17 00:00:00 2001 From: Pyry Kovanen Date: Thu, 30 Nov 2023 13:50:40 +0200 Subject: [PATCH 109/252] gall: fix egg-any cast --- pkg/arvo/sys/vane/gall.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 4db3d2fec2..d7668711e4 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -2336,7 +2336,7 @@ p.agent.u.yok on-save:p.agent.u.yok == - ``noun+!>(`egg-any`[-:*spore egg]) + ``noun+!>(`egg-any`[-:*spore-16 egg]) :: ?: ?& =(%w care) =([%$ %da now] coin) From d985b5db2459884a69b3a4c66fb43ae5bb6c2a6a Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Tue, 28 Nov 2023 22:08:37 -0500 Subject: [PATCH 110/252] hoon: make loobean compiler helpers correct and consistent --- pkg/arvo/sys/hoon.hoon | 64 +++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 71a952ec69..5ce87de5a6 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -7224,11 +7224,10 @@ ~/ %cond |= [pex=nock yom=nock woq=nock] ^- nock - ?- pex - [%1 %0] yom - [%1 %1] woq - * [%6 pex yom woq] - == + ?: =([%1 &] pex) yom + ?: =([%1 |] pex) woq + ?: =([%0 0] pex) pex + [%6 pex yom woq] :: ++ cons :: make formula cell ~/ %cons @@ -7273,43 +7272,44 @@ ~/ %flan |= [bos=nock nif=nock] ^- nock - ?: =(bos nif) bos - ?: =([%0 0] bos) nif - ?: =([%0 0] nif) bos - ?- bos - [%1 %1] bos - [%1 %0] nif - * - ?- nif - [%1 %1] nif - [%1 %0] bos - * [%6 bos nif [%1 1]] - == - == + ?: ?| =(bos nif) + =([%1 |] bos) + =([%1 &] nif) + =([%0 0] bos) + == + bos + ?: ?| =([%1 &] bos) + =([%1 |] nif) + =([%0 0] nif) + == + nif + [%6 bos nif [%1 |]] :: ++ flip :: loobean negation ~/ %flip |= dyr=nock + ^- nock + ?: =([%1 &] dyr) [%1 |] + ?: =([%1 |] dyr) [%1 &] ?: =([%0 0] dyr) dyr - [%6 dyr [%1 1] [%1 0]] + [%6 dyr [%1 |] %1 &] :: ++ flor :: loobean | ~/ %flor |= [bos=nock nif=nock] ^- nock - ?: =(bos nif) bos - ?: =([%0 0] bos) nif - ?: =([%0 0] nif) bos - ?- bos - [%1 %1] nif - [%1 %0] bos - * - ?- nif - [%1 %1] bos - [%1 %0] nif - * [%6 bos [%1 0] nif] - == - == + ?: ?| =(bos nif) + =([%1 &] bos) + =([%1 |] nif) + =([%0 0] bos) + == + bos + ?: ?| =([%1 |] bos) + =([%1 &] nif) + =([%0 0] nif) + == + nif + [%6 bos [%1 &] nif] :: ++ hike ~/ %hike From f6d40079ecc1e17d09b6ce7ee0caf2dbb5f67e60 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Tue, 28 Nov 2023 22:15:45 -0500 Subject: [PATCH 111/252] hoon: correct miscompilation of %wtcl --- pkg/arvo/sys/hoon.hoon | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 5ce87de5a6..94115d9622 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -9994,15 +9994,22 @@ :: [%wtcl *] =+ nor=$(gen p.gen, gol bool) - =+ fex=(gain p.gen) - =+ wux=(lose p.gen) - =+ ^= duy - ?: =(%void fex) - ?:(=(%void wux) [%0 0] [%1 1]) - ?:(=(%void wux) [%1 0] q.nor) + =+ [fex=(gain p.gen) wux=(lose p.gen)] + :: + :: if either branch is impossible, eliminate it + :: (placing the conditional in a dynamic hint to preserve crashes) + :: + =+ ^= [ned duy] + ?- - + [%void %void] |+[%0 0] + [%void *] &+[%1 |] + [* %void] &+[%1 &] + * |+q.nor + == =+ hiq=$(sut fex, gen q.gen) =+ ran=$(sut wux, gen r.gen) - [(fork p.hiq p.ran ~) (cond duy q.hiq q.ran)] + =+ fol=(cond duy q.hiq q.ran) + [(fork p.hiq p.ran ~) ?.(ned fol [%11 [%toss q.nor] fol])] :: [%wthx *] :- (nice bool) From ee82d507e30b447ff2474a31d50d700b34b22747 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Thu, 7 Dec 2023 16:56:13 +0100 Subject: [PATCH 112/252] ping: remove print --- pkg/arvo/app/ping.hoon | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index 42305d398d..665efe5272 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -353,7 +353,6 @@ ?. =(our src):bowl :: don't crash, this is where pings are handled `this :: - ~& mark^vase =^ cards state ?: ?=([%kick ?] q.vase) :: NB: ames calls this on %born (with fail=%.n) and after not hearing STUN From 208c501dfa1c2a23649f4e6c25bb595b93b90a0e Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Thu, 7 Dec 2023 12:21:14 -0500 Subject: [PATCH 113/252] ames: address review comments Unifies single and multiparty encrypted remote scry to universally use spat/stab for establishing an atom <-> path bijection, use crub:crypto and fixes case handling for multiparty remote scry. Moves key identifier into the spur, retains the case as the version tag, in keeping with the singleparty encrypted remote scry. Also fixes path handling with prepending ship/life/rift to the spur in the correct location. --- pkg/arvo/sys/vane/ames.hoon | 115 +++++++++++++++--------------------- 1 file changed, 49 insertions(+), 66 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 56ea9b3e3d..d4a30be189 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -491,53 +491,19 @@ =(life.ames-state lyf.balk) == :: -++ fine-close - =< close - |% - ++ aes |=(key=@ ~(. sivc:aes:crypto [key ~])) - ++ close - |= [=ames-state =path key-idx=@ value=(unit (unit cage))] - ?. (check-key ames-state path key-idx) - ~& key-validation-failed/[path key-idx chain.ames-state] - ~ - ?~ value - ~& %bailing-close - ~ - ?~ u.value - ``atom+!>(~) - ?~ key=(get:on:chain chain.ames-state key-idx) - ~ - ``atom+!>((jam (en:(aes -.u.key) (jam [p q.q]:u.u.value)))) - :: - ++ shutter - |= [our=ship =ames-state seg=@t key=@] - ^- (unit balk) - ~| seg/seg - ?~ raw=(slaw %uv seg) - ~ - =+ ;;([iv=@ len=@ enc=@] (cue u.raw)) - ?~ txt=(de:(aes key) iv len enc) - ~ - ~| txt/txt - ?~ pat=`(unit path)`(rush `@t`u.txt stap) - ~ - =/ here - /(scot %p our)/(scot %ud rift.ames-state)/(scot %ud life.ames-state) - (de-path-soft:balk (welp here u.pat)) - :: - ++ check-key - |= [=ames-state =path key-idx=@] - ^- ? - ?~ link=(get:on:chain chain.ames-state key-idx) - | - =/ gol path.u.link - |- ^- ? - ?~ gol & - ?~ path | - ?. =(i.path i.gol) - | - $(path t.path, gol t.gol) - -- +++ check-fine-key + |= [=ames-state =balk key-idx=@] + ^- ? + ?~ link=(get:on:chain chain.ames-state key-idx) + | + =/ gol path.u.link + =/ =path [van.balk car.balk spr.balk] + |- ^- ? + ?~ gol & + ?~ path | + ?. =(i.path i.gol) + | + $(path t.path, gol t.gol) :: ++ is-peer-dead |= [now=@da =peer-state] @@ -2633,13 +2599,11 @@ ~| bad-wire/wire ?> ?=([%fine %shut idx=@ ~] wire) ~| bad-path/rest.path.s - ?> ?=([%fine %shut cyf=@ ~] rest.path.s) + ?> ?=([%fine %shut kef=@ cyf=@ ~] rest.path.s) =/ [key=@ ,path] (~(got by chain.u.per) (slav %ud idx.wire)) - =+ ;;([iv=@ len=@ enc=@] (cue (slav %uv cyf.rest.path.s))) - =/ raw `@t`(need (de:(aes:fine-close key) iv len enc)) + =/ raw=@t + (dy:crub:crypto key (slav %uv cyf.rest.path.s)) =/ pax=path - %+ welp - /(scot %p ship.s)/(scot %ud rift.u.per)/(scot %ud life.u.per) (stab raw) =; dat=(unit (unit page)) (emit duct [%give %near [ship.s pax] dat]) @@ -2648,12 +2612,11 @@ == ~ :: XX weird ?> ?=([%atom @] u.q.dat.u.roar) - =- `?~(- ~ `(,page (cue u.-))) - %- de:(aes:fine-close key) - ;;([iv=@ len=@ cyf=@] (cue q.u.q.dat.u.roar)) + =- ``;;(page (cue -)) + (dy:crub:crypto key q.u.q.dat.u.roar) ?> ?=([%chum *] wire) =/ pax - =- (,path (cue -)) + %- stab (dy:crub:crypto symmetric-key.u.per (slav %uv cyf.rest.path.s)) =/ dat=(unit (unit page)) ?: ?| ?=(~ roar) @@ -3239,8 +3202,12 @@ =. peers.ames-state (~(put by peers.ames-state) ship u.ship-state) =/ enc %+ scot %uv - (jam (en:(aes:fine-close key.u.sec) (spat path))) - =/ lav /a/x/(scot %ud idx.u.sec)//fine/shut/[enc] + %+ en:crub:crypto key.u.sec + %- spat + %- welp + :_ path + /(scot %p ship)/(scot %ud rift.u.ship-state)/(scot %ud life.u.ship-state) + =/ lav /a/x/1//fine/shut/(scot %ud idx.u.sec)/[enc] =/ wir /fine/shut/(scot %ud idx.u.sec) (emit duct %pass wir %a %keen ~ ship lav) :: XX: key exchange over ames forces all encrypted scries to be @@ -3259,7 +3226,7 @@ |= todos=alien-agenda todos(chums (~(put ju chums.todos) path duct)) =/ cyf - (scot %uv (en:crub:crypto symmetric-key.u.ship-state (jam path))) + (scot %uv (en:crub:crypto symmetric-key.u.ship-state (spat path))) =/ lav /a/x/1//chum/(scot %p our)/(scot %ud life.ames-state)/[cyf] (emit duct [%pass /chum %a %keen ~ ship lav]) @@ -5660,20 +5627,36 @@ =* tyl s.bem :: ?: ?& =(&+our why) - ?=([%ud *] r.bem) + =([%ud 1] r.bem) =(%$ syd) =(%x ren) == => .(tyl `(pole knot)`tyl) ?+ tyl ~ :: - [%fine %shut enc=@ ~] - =/ key (got:on:chain chain.ames-state p.r.bem) - ?~ new=(shutter:fine-close our ames-state enc.tyl key.key) + [%fine %shut kef=@ enc=@ ~] + =/ key-idx (slav %ud kef.tyl) + =/ key (got:on:chain chain.ames-state (slav %ud kef.tyl)) + =/ pat=(unit path) + (rush `@t`(dy:crub:crypto key.key (slav %uv enc.tyl)) stap) + ?~ pat + [~ ~] + ?~ blk=(de-path-soft:balk u.pat) + [~ ~] + =/ res (rof ~ /ames (as-omen:balk u.blk)) + ?. (check-fine-key ames-state u.blk key-idx) + ~& key-validation-failed/[u.pat key-idx chain.ames-state] + [~ ~] + ?~ res + ~& %bailing-close + [~ ~] + ?~ u.res + ``atom+!>(~) + ?~ key=(get:on:chain chain.ames-state key-idx) ~ - =/ res (rof ~ /ames (as-omen:balk u.new)) - (fine-close ames-state spr.u.new p.r.bem res) - + =- ``atom+!>(-) + `@uv`(en:crub:crypto -.u.key (jam [p q.q]:u.u.res)) + :: [%chum her=@ lyf=@ cyf=@ ~] =/ who (slaw %p her.tyl) =/ lyf (slaw %ud lyf.tyl) From 6179d6ea525ca89fbc2f5af7113bad8ac83085e2 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Thu, 7 Dec 2023 12:43:33 -0500 Subject: [PATCH 114/252] gall: version key exchange req/res Versions the key exchange %plea and %boon. Also fixes a bug in key generation where the vane and care were not added to the ames key generation request. --- pkg/arvo/sys/vane/gall.hoon | 30 ++++++++++++++++++++++-------- tests/app/tend.hoon | 2 +- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index e66e024b27..49e1272a55 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -289,6 +289,16 @@ :: +$ blocked-move [=duct =routes move=(each deal unto)] :: +:: $fine-request: key exchange request for $coop +:: ++$ fine-request + [%0 =path] +:: +:: $fine-response: key exchange response for $coop +:: ++$ fine-response + [%0 bod=(unit brood)] +:: +$ ames-response $% [%d =mark noun=*] [%x ~] @@ -1056,7 +1066,8 @@ (ap-serve-brood:ap-core ship path) ?~ bod (mo-give %done ~) - =. mo-core (mo-give %boon u.bod) + =/ =fine-response [%0 u.bod] + =. mo-core (mo-give %boon fine-response) (mo-give %done ~) :: +mo-handle-ames-request: handle %ames request message. :: @@ -1192,7 +1203,8 @@ ~& malformed-path/pole ap-core =. pen.yoke (~(put ju pen.yoke) [ship pole] wire) - =/ =plea:ames [%g /gk/[app.pole] rest.pole] + =/ =fine-request [%0 rest.pole] + =/ =plea:ames [%g /gk/[app.pole] fine-request] =/ out=^wire (welp /key/[agent-name]/[run-nonce.yoke]/bod/(scot %p ship) pole) (ap-move [hen %pass out %a %plea ship plea]~) :: @@ -1204,16 +1216,17 @@ =/ =ship (slav %p i.wire) ?+ syn ~|(weird-sign-ap-take-brood/-.syn !!) [%ames %boon *] - =+ bod=((soft ,(unit brood)) payload.syn) - ?~ bod :: TODO: what happens + =+ bud=((soft fine-response) payload.syn) + ?~ bud :: TODO: what happens ~& weird-take-brood/payload.syn !! + =/ bod bod.u.bud =/ wis=(list ^wire) ~(tap in (~(get ju pen.yoke) [ship t.wire])) |- ?~ wis ap-core - ?~ u.bod + ?~ bod =. ap-core (ap-generic-take i.wis %ames %near [ship t.wire] ~) $(wis t.wis) - =. ap-core (ap-pass i.wis %arvo %a %keen `[idx key]:hutch.u.u.bod ship t.wire) + =. ap-core (ap-pass i.wis %arvo %a %keen `[idx key]:hutch.u.bod ship t.wire) $(wis t.wis) :: [%ames %done *] @@ -1312,7 +1325,7 @@ =? gem.yoke &(!exists ?=(~ pen)) (~(put by gem.yoke) coop ~) =/ =wire (welp /key/[agent-name]/[run-nonce.yoke]/pug coop) - (ap-move [hen %pass wire %a %plug %g [agent-name %$ coop]]~) + (ap-move [hen %pass wire %a %plug %g [%g %x agent-name %$ coop]]~) :: ++ ap-stub |= [=coop num=@ud key=@] @@ -2259,8 +2272,9 @@ :: ?: ?=([%gk @ ~] path) =/ agent-name i.t.path + =+ ;;(=fine-request noun) =< mo-abet - (mo-handle-key-request:mo-core ship agent-name ;;(^path noun)) + (mo-handle-key-request:mo-core ship agent-name path.fine-request) ?> ?=([%ge @ ~] path) =/ agent-name i.t.path :: diff --git a/tests/app/tend.hoon b/tests/app/tend.hoon index 661f6dd262..882d82766d 100644 --- a/tests/app/tend.hoon +++ b/tests/app/tend.hoon @@ -38,7 +38,7 @@ :_ this ?: ?=(%keen -.action) =/ =path - %+ welp /g/x/(scot %ud case.action) + %+ welp /g/x/(scot %ud case.action)/[dap.bowl] path.action [%pass /keen %keen & ship.action path]~ [%pass /foo action]~ From aaadee85ba76504e204f1caed23a00ec9f75afd4 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Fri, 8 Dec 2023 13:48:38 -0500 Subject: [PATCH 115/252] ames: fix gang handling in namespace overlays --- pkg/arvo/sys/vane/ames.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 6ba62db2f5..ee6e17170a 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -5706,7 +5706,7 @@ [~ ~] ?~ blk=(de-path-soft:balk u.pat) [~ ~] - =/ res (rof ~ /ames (as-omen:balk u.blk)) + =/ res (rof [~ ~] /ames (as-omen:balk u.blk)) ?. (check-fine-key ames-state u.blk key-idx) ~& key-validation-failed/[u.pat key-idx chain.ames-state] [~ ~] @@ -5885,7 +5885,7 @@ ?+ van ~ %a ?+ kyr ~ - %x (en-hunk (rof ~ /ames nom)) + %x (en-hunk (rof lyc /ames nom)) == :: %c From bb92924de12af41f5197b76eb3677dd05aa9ff1a Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Fri, 8 Dec 2023 14:05:47 -0500 Subject: [PATCH 116/252] ames: fix failing tests --- tests/sys/vane/ames.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/sys/vane/ames.hoon b/tests/sys/vane/ames.hoon index a91ca4cbf1..345a4f7da7 100644 --- a/tests/sys/vane/ames.hoon +++ b/tests/sys/vane/ames.hoon @@ -700,7 +700,7 @@ :: ++ test-plug ^- tang =^ moves nec - (call nec ~[/g/talk] %plug %g /foo) + (call nec ~[/g/talk] %plug /foo) =/ expected-key 3.782.450.905.364.316.746.465.724.430.826.633.339.627.682.402.565.789.971.442.035.627.125.517.743.962.901.817.756.764.395.497.041.697.150.935.487.420.935.470.530.023.121.462.879.251.503.082.973.208.842.762 %- zing @@ -714,7 +714,7 @@ :_ ~ %+ expect-eq !>(moves2) !> ^- (list move:ames) - :~ [~[/g/talk] [%pass /fine/shut/1 [%a [%keen sec=~ ship=~nec path=/a/x/1//fine/shut/0v27.7rg3m.vv773.kfo10.gemn6.dnutr.qqaq7.m0rgf.2ogtk.23t01]]]] + :~ [~[/g/talk] [%pass /fine/shut/1 [%a [%keen sec=~ ship=~nec path=/a/x/1//fine/shut/1/0v2f.7puc8.obvvn.b9ocp.4mhbm.q6v22.8d012.o68bo.mt35s.snb4m.hnnul.e6o8g.ebr01]]]] == :: -- From b33d59814ba43305ae191f571f84fdf687377ba9 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Mon, 11 Dec 2023 14:49:08 -0500 Subject: [PATCH 117/252] gall: fix high water marks for nuked agents --- bin/solid.pill | 4 +-- pkg/arvo/sys/lull.hoon | 3 ++- pkg/arvo/sys/vane/gall.hoon | 51 +++++++++++++++++++++++++++++-------- 3 files changed, 45 insertions(+), 13 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index a10d1b5b97..3945f71608 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aec86e0302887b93c51695a08d1383257c5d54e87961a2e859b977fed2f6cdfa -size 9965085 +oid sha256:c2ab6607450382e0ec80c7264dad2c72d69672eaf861eb1c24cde5a76921c6a3 +size 9972490 diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index 03628b1c29..5d669d7f9c 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -2770,6 +2770,7 @@ +$ hutch [rev=@ud idx=@ud key=@] :: +$ farm + $+ farm $~ [%plot ~ ~] $% [%coop p=hutch q=(map path plot)] [%plot p=(unit plot) q=(map @ta farm)] @@ -2777,7 +2778,7 @@ :: +$ egg :: migratory agent state - $% [%nuke sky=(map spur @ud)] :: see /sys/gall $yoke + $% [%nuke sky=(map spur @ud) cop=(map coop hutch)] :: see /sys/gall $yoke $: %live control-duct=duct run-nonce=@t diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 306efdb923..2daf230574 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -99,7 +99,7 @@ :: ken: open keen requests :: +$ yoke - $% [%nuke sky=(map spur @ud)] + $% [%nuke sky=(map spur @ud) cop=(map coop hutch)] $: %live control-duct=duct run-nonce=@t @@ -282,6 +282,29 @@ %+ turn tap-plot |= [=path =plot] [path (fun plot)] + :: + ++ gas-hutch + |= =(list [=coop =hutch]) + ^- (unit _farm) + ?~ list + `farm + =/ nex + (put-hutch i.list) + ?~ nex ~ + $(farm u.nex, list t.list) + :: + ++ tap-hutch + =| wer=path + %- ~(gas in *(set [=coop =hutch])) + |- ^- (list [=coop =hutch]) + =* loop $ + ?: ?=(%coop -.farm) + [wer p.farm]~ + %- zing + %+ turn ~(tap by q.farm) + |= [seg=@ta f=^farm] + ^- (list [=coop =hutch]) + loop(wer (snoc wer seg), farm f) -- :: ++ on-path ((on @ud (pair @da (each page @uvI))) lte) @@ -484,10 +507,17 @@ code agent agent &+agent run-nonce (scot %uw (end 5 (shas %yoke-nonce eny))) - sky *farm - :: ?~ yak ~ - :: ~ :: TODO: revive (~(run by sky.u.yak) (corl (late ~) (lead ~))) - == + :: + sky + ?~ yak *farm + =| =farm + =. farm (need (~(gas-hutch of-farm farm) ~(tap by cop.u.yak))) + =/ sky=(list [=spur bob=@ud]) ~(tap by sky.u.yak) + |- + ?~ sky farm + =. farm (need (~(put of-farm farm) spur.i.sky [`bob.i.sky ~])) + $(sky t.sky) + == :: =/ old mo-core =/ wag @@ -925,10 +955,11 @@ %+ ~(jab by yokes.state) dap |= =^yoke ?: ?=(%nuke -.yoke) yoke - :- %nuke - %- ~(run-plot of-farm sky.yoke) - |= plot - (fall (clap bob (bind (ram:on-path fan) head) max) 0) + :+ %nuke + %- ~(run-plot of-farm sky.yoke) + |= plot + (fall (clap bob (bind (ram:on-path fan) head) max) 0) + ~(tap-hutch of-farm sky.yoke) :: +mo-load: install agents :: ++ mo-load @@ -2611,7 +2642,7 @@ %- ~(urn by eggs.old) |= [=term e=egg-15] ^- egg - ?: ?=(%nuke -.e) e(sky *(map spur @ud)) + ?: ?=(%nuke -.e) [%nuke ~ ~] %= e ken [ken.e ~ ~] :: From 3e87e77ee4ab63a44599944e6562e37c75896657 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Mon, 11 Dec 2023 15:17:46 -0500 Subject: [PATCH 118/252] gall: address joe review --- pkg/arvo/sys/vane/gall.hoon | 56 +++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 2daf230574..6d731a4bd5 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -1231,8 +1231,9 @@ |= [=wire =ship =(pole knot)] ^+ ap-core ?. ?=([%g %x cas=@ app=@ rest=*] pole) - ~& malformed-path/pole - ap-core + %. ap-core + %+ trace odd.veb.bug.state + [leaf+"gall: {}: brood request {} invalid, dropping"]~ =. pen.yoke (~(put ju pen.yoke) [ship pole] wire) =/ =fine-request [%0 rest.pole] =/ =plea:ames [%g /gk/[app.pole] fine-request] @@ -1245,13 +1246,15 @@ ~| ap-take-brood/wire ?> ?=([@ *] wire) :: TODO: strip crash semantics =/ =ship (slav %p i.wire) + =/ wis=(list ^wire) ~(tap in (~(get ju pen.yoke) [ship t.wire])) ?+ syn ~|(weird-sign-ap-take-brood/-.syn !!) [%ames %boon *] =+ bud=((soft fine-response) payload.syn) ?~ bud :: TODO: what happens - ~& weird-take-brood/payload.syn !! + %. ap-core + %+ trace odd.veb.bug.state + [leaf/"gall: {} malformed brood res {} {}"]~ =/ bod bod.u.bud - =/ wis=(list ^wire) ~(tap in (~(get ju pen.yoke) [ship t.wire])) |- ?~ wis ap-core ?~ bod @@ -1261,22 +1264,33 @@ $(wis t.wis) :: [%ames %done *] - ap-core + |- + ?~ wis + =. pen.yoke (~(del by pen.yoke) [ship t.wire]) + ap-core + =. ap-core + %. (ap-generic-take i.wis %ames %near [ship t.wire] ~) + %+ trace odd.veb.bug.state + [leaf/"gall: {} bad brood res {} {}"]~ + $(wis t.wis) == :: ++ ap-serve-brood |= [=ship =(pole knot)] ^- [(unit (unit brood)) _mo-core] - ~& pole/pole ?. ?=([%$ ver=@ rest=*] pole) - ~& bad-pole/pole - `ap-abet - ?. =(1 (slav %ud ver.pole)) - ~& bad-version/pole - `ap-abet + %. `ap-abet + %+ trace odd.veb.bug.state + [leaf/"gall: {} bad brood req {} {}"]~ + =/ ver (slav %ud ver.pole) + ?. =(1 ver) + %. `ap-abet + %+ trace odd.veb.bug.state + [leaf/"gall: {} bad brood ver {} {} {}"]~ ?~ cop=(ap-match-coop rest.pole) - ~& no-match-coop/rest.pole - [~^~ ap-abet] + %. [~^~ ap-abet] + %+ trace odd.veb.bug.state + [leaf/"gall: {} no coop match {} {}"]~ =/ cag=(unit (unit cage)) (ap-peek %| %c (snoc u.cop (scot %p ship))) =/ has-perms=? @@ -1287,8 +1301,9 @@ u.res =/ =hutch (need (~(get-hutch of-farm sky.yoke) u.cop)) ?. has-perms - ~& no-perms/[ship pole] - [~^~ ap-abet] + %. [~^~ ap-abet] + %+ trace odd.veb.bug.state + [leaf/"gall: {} no perms for {} {} {}"]~ =/ =brood [u.cop hutch] [``brood ap-abet] :: @@ -1347,8 +1362,9 @@ |= [=coop =path =page] ?~ cop=(~(get-hutch of-farm sky.yoke) coop) ?. (~(has by gem.yoke) coop) - ~| ~(key-coops of-farm sky.yoke) - ~| no-such-coop/coop !! :: XX: error handling + %. ap-core + %+ trace & + [leaf+"gall: {} no such coop {}, dropping %grow at {}"]~ =. gem.yoke (~(put ju gem.yoke) coop path page) ap-core =. sky.yoke (need (~(grow of-farm sky.yoke) (welp coop path) now page)) @@ -1389,7 +1405,11 @@ ++ ap-grow |= [=spur =page] ^+ ap-core - ?> =(~ (ap-match-coop spur)) :: enforce binding public seperately + :: check here, and no-op, so that +need below does not crash + ?: =(~ (ap-match-coop spur)) + %. ap-core + %+ trace & + [leaf+"gall: {}: grow {} has coop, dropping"]~ =- ap-core(sky.yoke -) (need (~(grow of-farm sky.yoke) spur now page)) :: +ap-tomb: tombstone -- replace bound value with hash From d326cb6cd595d8f768bed98c473b83204816f6c6 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Mon, 11 Dec 2023 15:40:28 -0500 Subject: [PATCH 119/252] ames: address review comments --- pkg/arvo/sys/vane/ames.hoon | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index ee6e17170a..cc0a190317 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -3274,12 +3274,7 @@ =. chain.u.ship-state (put:on:chain chain.u.ship-state [idx key /]:u.sec) =. peers.ames-state (~(put by peers.ames-state) ship u.ship-state) =/ enc - %+ scot %uv - %+ en:crub:crypto key.u.sec - %- spat - %- welp - :_ path - /(scot %p ship)/(scot %ud rift.u.ship-state)/(scot %ud life.u.ship-state) + (scot %uv (en:crub:crypto key.u.sec (spat path))) =/ lav /a/x/1//fine/shut/(scot %ud idx.u.sec)/[enc] =/ wir /fine/shut/(scot %ud idx.u.sec) (emit duct %pass wir %a %keen ~ ship lav) @@ -5704,12 +5699,12 @@ (rush `@t`(dy:crub:crypto key.key (slav %uv enc.tyl)) stap) ?~ pat [~ ~] - ?~ blk=(de-path-soft:balk u.pat) + ?~ blk=(de-part:balk our rift.ames-state life.ames-state u.pat) [~ ~] - =/ res (rof [~ ~] /ames (as-omen:balk u.blk)) ?. (check-fine-key ames-state u.blk key-idx) ~& key-validation-failed/[u.pat key-idx chain.ames-state] [~ ~] + =/ res (rof [~ ~] /ames (as-omen:balk u.blk)) ?~ res ~& %bailing-close [~ ~] @@ -5784,9 +5779,13 @@ ``noun+!>(protocol-version) :: [%chain %latest ~] + ?: ?=(?(~ [~ ~]) lyc) + [~ ~] ``noun+!>(`[idx=@ key=@ =path]`(need (ram:on:chain chain.ames-state))) :: [%chain idx=@ ~] + ?: ?=(?(~ [~ ~]) lyc) + [~ ~] ?~ idx=(slaw %ud idx.tyl) [~ ~] ?~ key=(get:on:chain chain.ames-state u.idx) From 1d839672fc47f1afe264a7d98b73878aa65025dd Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Mon, 11 Dec 2023 16:00:03 -0500 Subject: [PATCH 120/252] ames: disable %chum --- pkg/arvo/gen/tx.hoon | 6 +++--- pkg/arvo/sys/vane/ames.hoon | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/gen/tx.hoon b/pkg/arvo/gen/tx.hoon index 4b13eae06a..64f3393cfc 100644 --- a/pkg/arvo/gen/tx.hoon +++ b/pkg/arvo/gen/tx.hoon @@ -2,7 +2,7 @@ :: ethereum.request({method: 'eth_sendTransaction', params: [{from: count, gasPrice: '0x2540be400', to: '0xb58101cd3bbbcc6fa40bcdb04bb71623b5c7d39b', gas: '0x10000', data: 'batch', chainId: '0x3'}]}).then(console.log) :: /+ eth=ethereum -:: /= tt /tests/lib/naive +/= tt /tests/lib/naive |% :: Generated by running these commands after modifying eth-sig-util :: such that TypedDataUtils.sign returns the domain separator instead @@ -42,8 +42,8 @@ ^- @t =/ account (hex-to-num:eth '0xb026b0AA6e686F2386051b31A03E5fB95513e1c0') =/ tx=octs - *octs :: XX: (gen-tx-octs:tt [~ravmun-mitbus %own] %set-spawn-proxy account) -=/ prepped=octs *octs :: XX: (prepare-for-sig:tt 3 0 tx) + (gen-tx-octs:tt [~ravmun-mitbus %own] %set-spawn-proxy account) +=/ prepped=octs (prepare-for-sig:tt 3 0 tx) ?~ sig (cat 3 'sign: ' (print-for-web3 prepped)) =/ batch=@t diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index cc0a190317..ac4a6edd86 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -3288,6 +3288,9 @@ ++ on-chum |= spar ^+ event-core + ?: =(0 0) + ~> %slog.0^leaf/"ames: %chum is disabled, do not use" + event-core =/ ship-state (~(get by peers.ames-state) ship) ?. ?=([~ %known *] ship-state) %^ enqueue-alien-todo ship ship-state @@ -5716,6 +5719,8 @@ `@uv`(en:crub:crypto -.u.key (jam [p q.q]:u.u.res)) :: [%chum her=@ lyf=@ cyf=@ ~] + ?: =(1 1) :: stubbed until gang used properly + ~ =/ who (slaw %p her.tyl) =/ lyf (slaw %ud lyf.tyl) =/ cyf (slaw %uv cyf.tyl) From 11d28f2e533cebfd4e74670b87a8bb99887806e3 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Wed, 13 Dec 2023 09:51:37 -0500 Subject: [PATCH 121/252] ames: fix tests --- tests/sys/vane/ames.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sys/vane/ames.hoon b/tests/sys/vane/ames.hoon index 345a4f7da7..9a982cef44 100644 --- a/tests/sys/vane/ames.hoon +++ b/tests/sys/vane/ames.hoon @@ -714,7 +714,7 @@ :_ ~ %+ expect-eq !>(moves2) !> ^- (list move:ames) - :~ [~[/g/talk] [%pass /fine/shut/1 [%a [%keen sec=~ ship=~nec path=/a/x/1//fine/shut/1/0v2f.7puc8.obvvn.b9ocp.4mhbm.q6v22.8d012.o68bo.mt35s.snb4m.hnnul.e6o8g.ebr01]]]] + :~ [~[/g/talk] [%pass /fine/shut/1 [%a [%keen sec=~ ship=~nec path=/a/x/1//fine/shut/1/0v1.vvaek.7boon.0tp04.21q1h.be1i0.494an.qimof.e2fku.ern01]]]] == :: -- From 0971af36f470a27f92b580c8f4f8508d71c7c86c Mon Sep 17 00:00:00 2001 From: pkova Date: Wed, 13 Dec 2023 19:49:36 +0200 Subject: [PATCH 122/252] all: enforce the gang when scrying --- pkg/arvo/sys/vane/ames.hoon | 302 +++++++++++++++++------------------- pkg/arvo/sys/vane/behn.hoon | 3 +- pkg/arvo/sys/vane/clay.hoon | 1 + pkg/arvo/sys/vane/dill.hoon | 3 +- pkg/arvo/sys/vane/eyre.hoon | 199 ++++++++++++------------ pkg/arvo/sys/vane/gall.hoon | 83 ++++++++-- pkg/arvo/sys/vane/iris.hoon | 2 +- pkg/arvo/sys/vane/jael.hoon | 2 +- pkg/arvo/sys/vane/khan.hoon | 4 +- pkg/arvo/sys/vane/lick.hoon | 3 +- pkg/arvo/sys/zuse.hoon | 2 +- 11 files changed, 331 insertions(+), 273 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index ac4a6edd86..e3ee9745d1 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -2006,7 +2006,7 @@ %+ skim ;; (list [@da duct]) =< q.q %- need %- need - (rof ~ /ames %bx [[our %$ da+now] /debug/timers]) + (rof [~ ~] /ames %bx [[our %$ da+now] /debug/timers]) |=([@da =duct] ?=([[%ames %recork *] *] duct)) :: =^ moz u.cached-state @@ -2078,7 +2078,7 @@ ++ get-sponsors ;; (list ship) =< q.q %- need %- need - (rof ~ /ames %j `beam`[[our %saxo %da now] /(scot %p our)]) + (rof [~ ~] /ames %j `beam`[[our %saxo %da now] /(scot %p our)]) :: +| %tasks :: +on-take-flub: vane not ready to process message, pretend it @@ -2273,7 +2273,7 @@ ++ do-rift =/ =rift =- ~|(%no-rift (,@ q.q:(need (need -)))) - (rof ~ /ames %j `beam`[[our %rift %da now] /(scot %p our)]) + (rof [~ ~] /ames %j `beam`[[our %rift %da now] /(scot %p our)]) ?: =(rift rift.ames-state) event-core ~& "ames: fixing rift from {} to {}" @@ -2298,7 +2298,7 @@ =/ tim ;; (list [@da ^duct]) =< q.q %- need %- need - (rof ~ /ames %bx [[our %$ da+now] /debug/timers]) + (rof [~ ~] /ames %bx [[our %$ da+now] /debug/timers]) (skim tim |=([@da hen=^duct] ?=([[%ames ?(%pump %recork) *] *] hen))) :: :: set timers for flows that should have one set but don't @@ -3208,7 +3208,7 @@ =/ turfs ;; (list turf) =< q.q %- need %- need - (rof ~ /ames %j `beam`[[our %turf %da now] /]) + (rof [~ ~] /ames %j `beam`[[our %turf %da now] /]) :: =* duct unix-duct.ames-state :: @@ -5443,7 +5443,7 @@ ?: ?=(%pawn (clan:title ship)) 0 ;; @ud =< q.q %- need %- need - (rof ~ /ames %j `beam`[[our %rift %da now] /(scot %p ship)]) + (rof [~ ~] /ames %j `beam`[[our %rift %da now] /(scot %p ship)]) :- -.ship-state :_ +.peer-state =, -.peer-state @@ -5524,7 +5524,7 @@ ++ state-12-to-13 |= old=ames-state-12 ^- ames-state-13 - =+ !<(=rift q:(need (need (rof ~ /ames %j our-beam)))) + =+ !<(=rift q:(need (need (rof [~ ~] /ames %j our-beam)))) =+ pk=sec:ex:crypto-core.old :* peers=(~(run by peers.old) ship-state-12-to-13) unix-duct.old @@ -5566,7 +5566,7 @@ ++ state-14-to-15 |= old=ames-state-14 ^- ames-state-15 - old(rift !<(=rift q:(need (need (rof ~ /ames %j our-beam))))) + old(rift !<(=rift q:(need (need (rof [~ ~] /ames %j our-beam))))) :: ++ state-15-to-16 |= old=ames-state-15 @@ -5771,107 +5771,136 @@ :: ?. ?=(%x ren) ~ => .(tyl `(pole knot)`tyl) - ?+ tyl ~ - [%$ %whey ~] - =/ maz=(list mass) - =+ [known alien]=(skid ~(val by peers.ames-state) |=(^ =(%known +<-))) - :~ peers-known+&+known - peers-alien+&+alien - == - ``mass+!>(maz) - :: - [%protocol %version ~] - ``noun+!>(protocol-version) - :: - [%chain %latest ~] - ?: ?=(?(~ [~ ~]) lyc) - [~ ~] - ``noun+!>(`[idx=@ key=@ =path]`(need (ram:on:chain chain.ames-state))) - :: - [%chain idx=@ ~] - ?: ?=(?(~ [~ ~]) lyc) - [~ ~] - ?~ idx=(slaw %ud idx.tyl) - [~ ~] - ?~ key=(get:on:chain chain.ames-state u.idx) - [~ ~] - ``noun+!>(`[idx=@ key=@]`[u.idx key.u.key]) - :: - [%peers ~] - :^ ~ ~ %noun - !> ^- (map ship ?(%alien %known)) - (~(run by peers.ames-state) head) - :: - [%peers her=@ req=*] - =/ who (slaw %p her.tyl) - ?~ who [~ ~] - =/ peer (~(get by peers.ames-state) u.who) - ?+ req.tyl [~ ~] - ~ - ?~ peer + ?: =([~ ~] lyc) + ?+ tyl ~ + [%$ %whey ~] + =/ maz=(list mass) + =+ [known alien]=(skid ~(val by peers.ames-state) |=(^ =(%known +<-))) + :~ peers-known+&+known + peers-alien+&+alien + == + ``mass+!>(maz) + :: + [%chain %latest ~] + ``noun+!>(`[idx=@ key=@ =path]`(need (ram:on:chain chain.ames-state))) + :: + [%chain idx=@ ~] + ?~ idx=(slaw %ud idx.tyl) [~ ~] - ``noun+!>(u.peer) - :: - [%last-contact ~] + ?~ key=(get:on:chain chain.ames-state u.idx) + [~ ~] + ``noun+!>(`[idx=@ key=@]`[u.idx key.u.key]) + :: + [%peers ~] :^ ~ ~ %noun - !> ^- (unit @da) + !> ^- (map ship ?(%alien %known)) + (~(run by peers.ames-state) head) + :: + [%peers her=@ req=*] + =/ who (slaw %p her.tyl) + ?~ who [~ ~] + =/ peer (~(get by peers.ames-state) u.who) + ?+ req.tyl [~ ~] + ~ + ?~ peer + [~ ~] + ``noun+!>(u.peer) + :: + [%last-contact ~] + :^ ~ ~ %noun + !> ^- (unit @da) + ?. ?=([~ %known *] peer) + ~ + `last-contact.qos.u.peer + :: + [%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, + :: and the peer has been reached recently: + :: + :: - 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 + :: + :^ ~ ~ %noun + !> ^- (list lane) + ?: =(our u.who) + ~ + ?: ?=([~ %known *] peer) + (get-forward-lanes our +.u.peer peers.ames-state) + =/ sax (rof ~ /ames %j `beam`[[our %saxo %da now] /(scot %p u.who)]) + ?. ?=([~ ~ *] sax) + ~ + =/ gal (rear ;;((list ship) q.q.u.u.sax)) + ?: =(our gal) + ~ + [%& gal]~ + == + :: + [%bones her=@ ~] + =/ who (slaw %p her.tyl) + ?~ who [~ ~] + =/ per (~(get by peers.ames-state) u.who) + ?. ?=([~ %known *] per) [~ ~] + =/ res + =, u.per + [snd=~(key by snd) rcv=~(key by rcv)] + ``noun+!>(res) + :: + [%snd-bones her=@ bon=@ ~] + =/ who (slaw %p her.tyl) + ?~ who [~ ~] + =/ ost (slaw %ud bon.tyl) + ?~ ost [~ ~] + =/ per (~(get by peers.ames-state) u.who) + ?. ?=([~ %known *] per) [~ ~] + =/ mps (~(get by snd.u.per) u.ost) + ?~ mps [~ ~] + =/ res + u.mps + ``noun+!>(!>(res)) + :: + [%snubbed ~] + ``noun+!>([form.snub.ames-state ~(tap in ships.snub.ames-state)]) + :: + [%fine %ducts pax=^] + ?~ bulk=(de-path-soft:balk pax.tyl) ~ + ?~ peer=(~(get by peers.ames-state) her.u.bulk) + [~ ~] ?. ?=([~ %known *] peer) - ~ - `last-contact.qos.u.peer + [~ ~] :: TODO handle aliens + ?~ spr.u.bulk [~ ~] + =/ =path =,(u.bulk [van car (scot cas) spr]) + ?~ keen=(~(get by keens.u.peer) path) + [~ ~] + ``noun+!>(listeners:u.keen) + :: + [%rift ~] + ``noun+!>(rift.ames-state) + :: + [%corked her=@ ~] + =/ who (slaw %p her.tyl) + ?~ who [~ ~] + =/ per (~(get by peers.ames-state) u.who) + ?. ?=([~ %known *] per) [~ ~] + ``noun+!>(corked.u.per) + :: + [%closing her=@ ~] + =/ who (slaw %p her.tyl) + ?~ who [~ ~] + =/ per (~(get by peers.ames-state) u.who) + ?. ?=([~ %known *] per) [~ ~] + ``noun+!>(closing.u.per) + :: + [%protocol %version ~] + ``noun+!>(protocol-version) :: - [%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, - :: and the peer has been reached recently: - :: - :: - 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 - :: - :^ ~ ~ %noun - !> ^- (list lane) - ?: =(our u.who) - ~ - ?: ?=([~ %known *] peer) - (get-forward-lanes our +.u.peer peers.ames-state) - =/ sax (rof ~ /ames %j `beam`[[our %saxo %da now] /(scot %p u.who)]) - ?. ?=([~ ~ *] sax) - ~ - =/ gal (rear ;;((list ship) q.q.u.u.sax)) - ?: =(our gal) - ~ - [%& gal]~ == - :: - [%bones her=@ ~] - =/ who (slaw %p her.tyl) - ?~ who [~ ~] - =/ per (~(get by peers.ames-state) u.who) - ?. ?=([~ %known *] per) [~ ~] - =/ res - =, u.per - [snd=~(key by snd) rcv=~(key by rcv)] - ``noun+!>(res) - :: - [%snd-bones her=@ bon=@ ~] - =/ who (slaw %p her.tyl) - ?~ who [~ ~] - =/ ost (slaw %ud bon.tyl) - ?~ ost [~ ~] - =/ per (~(get by peers.ames-state) u.who) - ?. ?=([~ %known *] per) [~ ~] - =/ mps (~(get by snd.u.per) u.ost) - ?~ mps [~ ~] - =/ res - u.mps - ``noun+!>(!>(res)) - :: - [%snubbed ~] - ``noun+!>([form.snub.ames-state ~(tap in ships.snub.ames-state)]) - :: + + ?+ tyl ~ [%fine %hunk lop=@t len=@t pax=^] ::TODO separate endpoint for the full message (instead of packet list) :: .pax is expected to be a scry path of the shape /vc/desk/rev/etc, @@ -5886,33 +5915,15 @@ |^ =/ van ?@(vis.nom (end 3 vis.nom) way.vis.nom) =/ kyr ?@(vis.nom (rsh 3 vis.nom) car.vis.nom) - ?+ van ~ - %a - ?+ kyr ~ - %x (en-hunk (rof lyc /ames nom)) - == - :: - %c - =+ pem=(rof lyc /ames nom(vis %cp)) - ?. ?=(^ pem) ~ - ?. ?=(^ u.pem) ~ - ~| u.u.pem - =+ per=!<([r=dict:clay w=dict:clay] q.u.u.pem) - ?. =([%black ~ ~] rul.r.per) ~ + ?. =(%c van) (en-hunk (rof ~ /ames nom)) - :: - %e - %- en-hunk - ?+ kyr ~ - %x (rof ~ /ames nom) - == - :: - %g - %- en-hunk - ?+ kyr ~ - %x (rof ~ /ames nom) - == - == + =+ pem=(rof [~ ~] /ames nom(vis %cp)) + ?. ?=(^ pem) ~ + ?. ?=(^ u.pem) ~ + ~| u.u.pem + =+ per=!<([r=dict:clay w=dict:clay] q.u.u.pem) + ?. =([%black ~ ~] rul.r.per) ~ + (en-hunk (rof [~ ~] /ames nom)) :: ++ en-hunk |= res=(unit (unit cage)) @@ -5926,34 +5937,7 @@ [~ ~ *] ``noun+!>((etch-open:hu-co pax.tyl hunk [p q.q]:u.u.res)) == -- + == :: - [%fine %ducts pax=^] - ?~ bulk=(de-path-soft:balk pax.tyl) ~ - ?~ peer=(~(get by peers.ames-state) her.u.bulk) - [~ ~] - ?. ?=([~ %known *] peer) - [~ ~] :: TODO handle aliens - ?~ spr.u.bulk [~ ~] - =/ =path =,(u.bulk [van car (scot cas) spr]) - ?~ keen=(~(get by keens.u.peer) path) - [~ ~] - ``noun+!>(listeners:u.keen) - :: - [%rift ~] - ``noun+!>(rift.ames-state) - :: - [%corked her=@ ~] - =/ who (slaw %p her.tyl) - ?~ who [~ ~] - =/ per (~(get by peers.ames-state) u.who) - ?. ?=([~ %known *] per) [~ ~] - ``noun+!>(corked.u.per) - :: - [%closing her=@ ~] - =/ who (slaw %p her.tyl) - ?~ who [~ ~] - =/ per (~(get by peers.ames-state) u.who) - ?. ?=([~ %known *] per) [~ ~] - ``noun+!>(closing.u.per) - == + -- diff --git a/pkg/arvo/sys/vane/behn.hoon b/pkg/arvo/sys/vane/behn.hoon index 23d2dcb1b0..ba04115e49 100644 --- a/pkg/arvo/sys/vane/behn.hoon +++ b/pkg/arvo/sys/vane/behn.hoon @@ -243,11 +243,12 @@ =* lot=coin $/r.bem =* tyl s.bem :: - :: only respond for the local identity, %$ desk, current timestamp + :: only respond for the local identity, %$ desk, current timestamp, root gang :: ?. ?& =(&+our why) =([%$ %da now] lot) =(%$ syd) + =([~ ~] lyc) == ~ :: /bx//whey (list mass) memory usage labels diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index fd242dc301..9f93f4894b 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -5934,6 +5934,7 @@ :: =/ for=(unit ship) ?~(lyc ~ ?~(u.lyc ~ `n.u.lyc)) ?: &(=(our his) ?=(?(%d %x) ren) =(%$ syd) =([%da now] u.luk)) + ?. =([~ ~] lyc) ~ ?- ren %d (read-buc-d tyl) %x (read-buc-x tyl) diff --git a/pkg/arvo/sys/vane/dill.hoon b/pkg/arvo/sys/vane/dill.hoon index 1c2b0641e9..b5400d1aa4 100644 --- a/pkg/arvo/sys/vane/dill.hoon +++ b/pkg/arvo/sys/vane/dill.hoon @@ -490,11 +490,12 @@ ?. ?=(%& -.why) ~ =* his p.why :: - :: only respond for the local identity, %$ desk, current timestamp + :: only respond for the local identity, %$ desk, current timestamp, root gang :: ?. ?& =(&+our why) =([%$ %da now] lot) =(%$ syd) + =(~ lyc) == ~ :: /%x//whey (list mass) memory usage labels diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index b180575828..c3a2a0ffb3 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -917,12 +917,12 @@ %gen =/ bek=beak [our desk.generator.action da+now] =/ sup=spur path.generator.action - =/ ski (rof ~ /eyre %ca bek sup) + =/ ski (rof [~ ~] /eyre %ca bek sup) =/ cag=cage (need (need ski)) ?> =(%vase p.cag) =/ gat=vase !<(vase q.cag) =/ res=toon - %- mock :_ (look rof ~ /eyre) + %- mock :_ (look rof ?.(authenticated ~ [~ ~]) /eyre) :_ [%9 2 %0 1] |. %+ slam %+ slam gat @@ -1137,7 +1137,7 @@ ++ do-scry |= [care=term =desk =path] ^- (unit (unit cage)) - (rof ~ /eyre care [our desk da+now] path) + (rof [~ ~] /eyre care [our desk da+now] path) :: ++ error-response |= [status=@ud =tape] @@ -1152,7 +1152,7 @@ ^- (quip move server-state) :: if the agent isn't running, we synchronously serve a 503 :: - ?. !<(? q:(need (need (rof ~ /eyre %gu [our app da+now] /$)))) + ?. !<(? q:(need (need (rof [~ ~] /eyre %gu [our app da+now] /$)))) %^ return-static-data-on-duct 503 'text/html' %: error-page 503 @@ -1545,7 +1545,7 @@ ++ code ^- @ta =/ res=(unit (unit cage)) - (rof ~ /eyre %j [our %code da+now] /(scot %p our)) + (rof [~ ~] /eyre %j [our %code da+now] /(scot %p our)) (rsh 3 (scot %p ;;(@ q.q:(need (need res))))) :: +session-cookie-string: compose session cookie :: @@ -2746,7 +2746,7 @@ ?~ sub ((trace 0 |.("no subscription for request-id {(scow %ud request-id)}")) ~) =/ des=(unit (unit cage)) - (rof ~ /eyre %gd [our app.u.sub da+now] /$) + (rof [~ ~] /eyre %gd [our app.u.sub da+now] /$) ?. ?=([~ ~ *] des) ((trace 0 |.("no desk for app {}")) ~) `!<(=desk q.u.u.des) @@ -2782,7 +2782,7 @@ =* have=mark mark.event =/ convert=(unit vase) =/ cag=(unit (unit cage)) - (rof ~ /eyre %cf [our desk.event da+now] /[have]/json) + (rof [~ ~] /eyre %cf [our desk.event da+now] /[have]/json) ?. ?=([~ ~ *] cag) ~ `q.u.u.cag ?~ convert @@ -3302,7 +3302,7 @@ ?~ u [%| "invalid scry path"] :: perform scry :: - ?~ res=(rof ~ /eyre u.u) [%| "failed scry"] + ?~ res=(rof [~ ~] /eyre u.u) [%| "failed scry"] ?~ u.res [%| "no scry result"] =* mark p.u.u.res =* vase q.u.u.res @@ -3331,7 +3331,7 @@ %c [%& q.beam] %g - =/ res (rof ~ /eyre %gd [our q.beam da+now] /$) + =/ res (rof [~ ~] /eyre %gd [our q.beam da+now] /$) ?. ?=([~ ~ *] res) [%| "no desk for app {}"] [%& !<(=desk q.u.u.res)] @@ -3341,7 +3341,7 @@ |= [=vase from=mark to=mark =desk] ^- (each ^vase tape) ?: =(from to) [%& vase] - =/ tub (rof ~ /eyre %cc [our desk da+now] /[from]/[to]) + =/ tub (rof [~ ~] /eyre %cc [our desk da+now] /[from]/[to]) ?. ?=([~ ~ %tube *] tub) [%| "no tube from {(trip from)} to {(trip to)}"] =/ tube !<(tube:clay q.u.u.tub) @@ -4116,97 +4116,104 @@ [~ ~] ?. =(our who) ?. =([%da now] p.lot) - [~ ~] + ~ ~& [%r %scry-foreign-host who] ~ - ?: &(?=(%x ren) ?=(%$ syd)) - =, server-state.ax - ?+ tyl [~ ~] - [%$ %whey ~] =- ``mass+!>(`(list mass)`-) - :~ bindings+&+bindings.server-state.ax - auth+&+auth.server-state.ax - connections+&+connections.server-state.ax - channels+&+channel-state.server-state.ax - axle+&+ax - == - :: - [%cors ~] ``noun+!>(cors-registry) - [%cors %requests ~] ``noun+!>(requests.cors-registry) - [%cors %approved ~] ``noun+!>(approved.cors-registry) - [%cors %rejected ~] ``noun+!>(rejected.cors-registry) - :: - [%cors ?(%approved %rejected) @ ~] - =* kind i.t.tyl - =* orig i.t.t.tyl - ?~ origin=(slaw %t orig) [~ ~] - ?- kind - %approved ``noun+!>((~(has in approved.cors-registry) u.origin)) - %rejected ``noun+!>((~(has in rejected.cors-registry) u.origin)) - == - :: - [%eauth %url ~] - =* endpoint endpoint.auth.server-state.ax - ?. ?=(%da -.p.lot) [~ ~] - :: we cannot answer for something prior to the last set time, - :: or something beyond the present moment. + :: private endpoints + ?: ?=([~ ~] lyc) + ?: &(?=(%x ren) ?=(%$ syd)) + =, server-state.ax + ?+ tyl ~ + [%$ %whey ~] =- ``mass+!>(`(list mass)`-) + :~ bindings+&+bindings.server-state.ax + auth+&+auth.server-state.ax + connections+&+connections.server-state.ax + channels+&+channel-state.server-state.ax + axle+&+ax + == :: - ?: ?| (lth q.p.lot time.endpoint) - (gth q.p.lot now) - == - ~ - :^ ~ ~ %noun - !> ^- (unit @t) - =< eauth-url:eauth:authentication - (per-server-event [eny *duct now rof] server-state.ax) - :: - [%authenticated %cookie @ ~] - ?~ cookies=(slaw %t i.t.t.tyl) [~ ~] - :^ ~ ~ %noun - !> ^- ? - %- =< request-is-authenticated:authentication - (per-server-event [eny *duct now rof] server-state.ax) - %*(. *request:http header-list ['cookie' u.cookies]~) - :: - [%cache @ @ ~] - ?~ aeon=(slaw %ud i.t.tyl) [~ ~] - ?~ url=(slaw %t i.t.t.tyl) [~ ~] - ?~ entry=(~(get by cache) u.url) [~ ~] - ?. =(u.aeon aeon.u.entry) [~ ~] - ?~ val=val.u.entry [~ ~] - ``noun+!>(u.val) - :: - [%'_~_' *] - =/ mym (scry-mime now rof (deft:de-purl:html tyl)) - ?: ?=(%| -.mym) [~ ~] - ``noun+!>(p.mym) + [%cors ~] ``noun+!>(cors-registry) + [%cors %requests ~] ``noun+!>(requests.cors-registry) + [%cors %approved ~] ``noun+!>(approved.cors-registry) + [%cors %rejected ~] ``noun+!>(rejected.cors-registry) + :: + [%cors ?(%approved %rejected) @ ~] + =* kind i.t.tyl + =* orig i.t.t.tyl + ?~ origin=(slaw %t orig) [~ ~] + ?- kind + %approved ``noun+!>((~(has in approved.cors-registry) u.origin)) + %rejected ``noun+!>((~(has in rejected.cors-registry) u.origin)) + == + :: + [%authenticated %cookie @ ~] + ?~ cookies=(slaw %t i.t.t.tyl) [~ ~] + :^ ~ ~ %noun + !> ^- ? + %- =< request-is-authenticated:authentication + (per-server-event [eny *duct now rof] server-state.ax) + %*(. *request:http header-list ['cookie' u.cookies]~) + :: + [%'_~_' *] + =/ mym (scry-mime now rof (deft:de-purl:html tyl)) + ?: ?=(%| -.mym) [~ ~] + ``noun+!>(p.mym) + == + ?. ?=(%$ ren) ~ + ?+ syd ~ + %bindings ``noun+!>(bindings.server-state.ax) + %connections ``noun+!>(connections.server-state.ax) + %authentication-state ``noun+!>(auth.server-state.ax) + %channel-state ``noun+!>(channel-state.server-state.ax) + :: + %host + %- (lift (lift |=(a=hart:eyre [%hart !>(a)]))) + ^- (unit (unit hart:eyre)) + =. p.lot ?.(=([%da now] p.lot) p.lot [%tas %real]) + ?+ p.lot + [~ ~] + :: + [%tas %fake] + ``[& [~ 8.443] %& /localhost] + :: + [%tas %real] + =* domains domains.server-state.ax + =* ports ports.server-state.ax + =/ =host:eyre [%& ?^(domains n.domains /localhost)] + =/ port=(unit @ud) + ?. ?=(^ secure.ports) + ?:(=(80 insecure.ports) ~ `insecure.ports) + ?:(=(443 u.secure.ports) ~ secure.ports) + ``[?=(^ secure.ports) port host] + == == - ?. ?=(%$ ren) - [~ ~] - ?+ syd [~ ~] - %bindings ``noun+!>(bindings.server-state.ax) - %connections ``noun+!>(connections.server-state.ax) - %authentication-state ``noun+!>(auth.server-state.ax) - %channel-state ``noun+!>(channel-state.server-state.ax) - :: - %host - %- (lift (lift |=(a=hart:eyre [%hart !>(a)]))) - ^- (unit (unit hart:eyre)) - =. p.lot ?.(=([%da now] p.lot) p.lot [%tas %real]) - ?+ p.lot - [~ ~] + :: public endpoints + ?+ tyl ~ + [%eauth %url ~] + =* endpoint endpoint.auth.server-state.ax + ?. ?=(%da -.p.lot) [~ ~] + :: we cannot answer for something prior to the last set time, + :: or something beyond the present moment. :: - [%tas %fake] - ``[& [~ 8.443] %& /localhost] + ?: ?| (lth q.p.lot time.endpoint) + (gth q.p.lot now) + == + ~ + :^ ~ ~ %noun + !> ^- (unit @t) + =< eauth-url:eauth:authentication + (per-server-event [eny *duct now rof] server-state.ax) + :: + [%cache @ @ ~] + =, server-state.ax + ?~ aeon=(slaw %ud i.t.tyl) [~ ~] + ?~ url=(slaw %t i.t.t.tyl) [~ ~] + ?~ entry=(~(get by cache) u.url) [~ ~] + ?. =(u.aeon aeon.u.entry) [~ ~] + ?~ val=val.u.entry [~ ~] + ?: &(auth.u.val !=([~ ~] lyc)) ~ + ``noun+!>(u.val) :: - [%tas %real] - =* domains domains.server-state.ax - =* ports ports.server-state.ax - =/ =host:eyre [%& ?^(domains n.domains /localhost)] - =/ port=(unit @ud) - ?. ?=(^ secure.ports) - ?:(=(80 insecure.ports) ~ `insecure.ports) - ?:(=(443 u.secure.ports) ~ secure.ports) - ``[?=(^ secure.ports) port host] - == == + -- diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 6d731a4bd5..7ede8d1f9a 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -126,9 +126,12 @@ ++ of-farm |_ =farm ++ key-coops - =| pos=path - %- ~(gas in *(set coop)) - |- ^- (list coop) + |= pos=path + ^- (list coop) + =/ frm (get-farm pos) + ?~ frm ~ + =. farm u.frm + |- ?: ?=(%coop -.farm) ~[pos] %- zing @@ -156,6 +159,7 @@ ?~ nex=(~(get by q.farm) i.path) ~ $(wer [i.path wer], path t.path, farm u.nex) + :: ++ put |= [=path =plot] ^- (unit _farm) @@ -251,6 +255,18 @@ ~ $(path t.path, farm u.nex) :: + ++ get-farm + |= =path + ^- (unit ^farm) + ?: ?=(%coop -.farm) + ?~ (~(get by q.farm) path) + ~ + `farm + ?~ path ~ + ?~ nex=(~(get by q.farm) i.path) + ~ + $(path t.path, farm u.nex) + :: ++ get |= =path ^- (unit plot) @@ -982,6 +998,29 @@ ?~ kil mo-core ~> %slog.0^leaf/"gall: stopping {}" $(kil t.kil, mo-core (mo-idle prov i.kil)) + :: + ++ mo-authorized-coop + |= [lyc=(set ship) =farm dap=term =path =coop] + %- ~(all in lyc) + |= =ship + =/ cag (mo-peek | dap [~ ship path] %c (snoc coop (scot %p ship))) + ?. ?=([~ ~ ^] cag) + %.n + ?~ res=((soft ,?) q.q.u.u.cag) + %.n + u.res + :: + ++ mo-authorized + |= [lyc=gang =farm dap=term =path] + ^- ? + ?: =([~ ~] lyc) + %.y + ?~ (~(get-hutch of-farm farm) path) + %.y + ?~ coop=(~(match-coop of-farm farm) path) + %.n + ?< ?=(~ lyc) + (mo-authorized-coop u.lyc farm dap path u.coop) :: +mo-peek: call to +ap-peek (which is not accessible outside of +mo). :: ++ mo-peek @@ -1008,7 +1047,7 @@ =/ =case da+now =/ yok (~(got by yokes.state) dap) =/ =desk q.beak:?>(?=(%live -.yok) yok) ::TODO acceptable assertion? - =/ sky (rof ~ /gall %cb [our desk case] /[mark.deal]) + =/ sky (rof [~ ~] /gall %cb [our desk case] /[mark.deal]) ?- sky ?(~ [~ ~]) =/ ror "gall: raw-poke fail :{(trip dap)} {}" @@ -1032,7 +1071,7 @@ =/ mars-path /[a.mars]/[b.mars] =/ yok (~(got by yokes.state) dap) =/ =desk q.beak:?>(?=(%live -.yok) yok) ::TODO acceptable assertion? - =/ sky (rof ~ /gall %cc [our desk case] mars-path) + =/ sky (rof [~ ~] /gall %cc [our desk case] mars-path) ?- sky ?(~ [~ ~]) =/ ror "gall: poke cast fail :{(trip dap)} {}" @@ -1528,7 +1567,7 @@ =/ =case da+now =/ bek=beak [our q.beak.yoke case] =/ mars-path /[a.mars]/[b.mars] - =/ sky (rof ~ /gall %cc bek mars-path) + =/ sky (rof [~ ~] /gall %cc bek mars-path) ?- sky ?(~ [~ ~]) %- (slog leaf+"watch-as fact conversion find-fail" >sky< ~) @@ -1708,7 +1747,7 @@ =/ tub=(unit tube:clay) ?: =(have want) `(bake same ^vase) =/ tuc=(unit (unit cage)) - (rof ~ /gall %cc [our q.beak.yoke da+now] /[have]/[want]) + (rof [~ ~] /gall %cc [our q.beak.yoke da+now] /[have]/[want]) ?. ?=([~ ~ *] tuc) ~ `!<(tube:clay q.u.u.tuc) ?~ tub @@ -1857,7 +1896,7 @@ ?: ?=(%spider agent-name) :- [%fact mark.unto !>(noun.unto)] ap-core - =/ sky (rof ~ /gall %cb [our q.beak.yoke case] /[mark.unto]) + =/ sky (rof [~ ~] /gall %cb [our q.beak.yoke case] /[mark.unto]) ?. ?=([~ ~ *] sky) (mean leaf+"gall: ames mark fail {}" ~) :: @@ -2129,7 +2168,7 @@ ++ ap-mule |= run=_^?(|.(*step:agent)) ^- (each step:agent tang) - =/ res (mock [run %9 2 %0 1] (look rof ~ /gall/[agent-name])) + =/ res (mock [run %9 2 %0 1] (look rof [~ ~] /gall/[agent-name])) ?- -.res %0 [%& !<(step:agent [-:!>(*step:agent) p.res])] %1 [%| (smyt ;;(path p.res)) ~] @@ -2140,7 +2179,7 @@ ++ ap-mule-peek |= run=_^?(|.(*(unit (unit cage)))) ^- (each (unit (unit cage)) tang) - =/ res (mock [run %9 2 %0 1] (look rof ~ /gall/[agent-name])) + =/ res (mock [run %9 2 %0 1] (look rof [~ ~] /gall/[agent-name])) ?- -.res %0 [%& !<((unit (unit cage)) [-:!>(*(unit (unit cage))) p.res])] %1 [%| (smyt ;;(path p.res)) ~] @@ -2708,6 +2747,7 @@ ?. ?=([%$ *] path) :: [%$ *] is for the vane, all else is for the agent ?. ?& =(our ship) =([%$ %da now] coin) + =([~ ~] lyc) == ~ ?. (~(has by yokes.state) dap) [~ ~] ?. ?=(^ path) ~ @@ -2720,6 +2760,7 @@ =(~ path) =([%$ %da now] coin) =(our ship) + =([~ ~] lyc) == =; hav=? [~ ~ noun+!>(hav)] @@ -2730,6 +2771,7 @@ =(~ path) =([%$ %da now] coin) =(our ship) + =([~ ~] lyc) == =/ yok=(unit yoke) (~(get by yokes.state) dap) ?. ?=([~ %live *] yok) @@ -2740,6 +2782,7 @@ =(~ path) =([%$ %da now] coin) =(our ship) + =([~ ~] lyc) == :+ ~ ~ :- %apps !> ^- (set [=dude live=?]) @@ -2756,6 +2799,7 @@ =(~ path) =([%$ %da now] coin) =(our ship) + =([~ ~] lyc) == :+ ~ ~ :- %nonces !> ^- (map dude @) @@ -2767,6 +2811,7 @@ ?=([@ @ ^] path) =([%$ %da now] coin) =(our ship) + =([~ ~] lyc) == =/ yok (~(get by yokes.state) dap) ?. ?=([~ %live *] yok) @@ -2780,6 +2825,7 @@ ?: ?& =(%v care) =([%$ %da now] coin) =(our ship) + =([~ ~] lyc) == =/ yok (~(get by yokes.state) dap) ?. ?=([~ %live *] yok) @@ -2805,6 +2851,8 @@ ?. ?=([~ %live *] yok) [~ ~] ?~ ski=(~(get of-farm sky.u.yok) path) [~ ~] ?~ las=(ram:on-path fan.u.ski) [~ ~] + ?. (mo-authorized:mo lyc sky.u.yok q.bem path) + ~ ``case/!>(ud/key.u.las) :: ?: &(?=(%x care) ?=([%'1' *] path)) @@ -2814,6 +2862,7 @@ ?: ?=(%$ q.bem) :: app %$ reserved ?+ path ~ [%whey ~] + ?. ?=([~ ~] lyc) ~ =/ blocked =/ queued (~(run by blocked.state) |=((qeu blocked-move) [%.y +<])) (sort ~(tap by queued) aor) @@ -2842,6 +2891,8 @@ ?: ?=(%nuke -.u.yok) ~ ?~ ski=(~(get of-farm sky.u.yok) path) ~ + ?. (mo-authorized:mo lyc sky.u.yok q.bem path) + ~ =/ res=(unit (each page @uvI)) ?+ -.r.bem ~ %ud (bind (get:on-path fan.u.ski p.r.bem) tail) @@ -2866,6 +2917,16 @@ => .(path t.path) =/ yok (~(get by yokes.state) q.bem) ?. ?=([~ %live *] yok) ~ + =/ keys=(list coop) (~(key-coops of-farm sky.u.yok) path) + =/ authorized=? + ?: =([~ ~] lyc) %.y + |- + ?~ keys %.y + ?< ?=(~ lyc) + ?. (mo-authorized-coop:mo u.lyc sky.u.yok q.bem path i.keys) + %.n + $(keys t.keys) + ?. authorized ~ :^ ~ ~ %file-list !> ^- (list ^path) %+ skim (turn ~(tap-plot of-farm sky.u.yok) head) |= =spur @@ -2881,6 +2942,8 @@ =/ yok (~(get by yokes.state) q.bem) ?. ?=([~ %live *] yok) ~ ?~ ski=(~(get of-farm sky.u.yok) path) ~ + ?. (mo-authorized:mo lyc sky.u.yok q.bem path) + ~ =/ res=(unit (pair @da (each noun @uvI))) ?+ -.r.bem ~ %ud (get:on-path fan.u.ski p.r.bem) diff --git a/pkg/arvo/sys/vane/iris.hoon b/pkg/arvo/sys/vane/iris.hoon index 58ffa325dc..046f51e855 100644 --- a/pkg/arvo/sys/vane/iris.hoon +++ b/pkg/arvo/sys/vane/iris.hoon @@ -395,7 +395,7 @@ :: ?. ?=(%& -.why) ~ =* his p.why - ?: &(?=(%x ren) =(tyl //whey)) + ?: &(?=(%x ren) =(tyl //whey) =([~ ~] lyc)) =/ maz=(list mass) :~ nex+&+next-id.state.ax outbound+&+outbound-duct.state.ax diff --git a/pkg/arvo/sys/vane/jael.hoon b/pkg/arvo/sys/vane/jael.hoon index 3e15ed128d..7e707f1ce1 100644 --- a/pkg/arvo/sys/vane/jael.hoon +++ b/pkg/arvo/sys/vane/jael.hoon @@ -1065,7 +1065,7 @@ :: :: XX review for security, stability, cases other than now :: - ?. =(lot [%$ %da now]) ~ + ?. &(=(lot [%$ %da now]) =([~ ~] lyc)) ~ :: ?: &(?=(%x ren) =(tyl //whey)) =/ maz=(list mass) diff --git a/pkg/arvo/sys/vane/khan.hoon b/pkg/arvo/sys/vane/khan.hoon index 5f8e2ef78f..a6dcb8ef83 100644 --- a/pkg/arvo/sys/vane/khan.hoon +++ b/pkg/arvo/sys/vane/khan.hoon @@ -72,7 +72,7 @@ ++ get-dais |= [=beak =mark rof=roof] ^- dais:clay - ?~ ret=(rof ~ /khan %cb beak /[mark]) + ?~ ret=(rof [~ ~] /khan %cb beak /[mark]) ~|(mark-unknown+mark !!) ?~ u.ret ~|(mark-invalid+mark !!) @@ -82,7 +82,7 @@ ++ get-tube |= [=beak =mark =out=mark rof=roof] ^- tube:clay - ?~ ret=(rof ~ /khan %cc beak /[mark]/[out-mark]) + ?~ ret=(rof [~ ~] /khan %cc beak /[mark]/[out-mark]) ~|(tube-unknown+[mark out-mark] !!) ?~ u.ret ~|(tube-invalid+[mark out-mark] !!) diff --git a/pkg/arvo/sys/vane/lick.hoon b/pkg/arvo/sys/vane/lick.hoon index 2b43da200a..edce14b5e8 100644 --- a/pkg/arvo/sys/vane/lick.hoon +++ b/pkg/arvo/sys/vane/lick.hoon @@ -88,11 +88,12 @@ |= [lyc=gang pov=path car=term bem=beam] ^- (unit (unit cage)) |^ - :: only respond for the local identity, current timestamp + :: only respond for the local identity, current timestamp, root gang :: ?. ?& =(our p.bem) =(%$ q.bem) =([%da now] r.bem) + =([~ ~] lyc) == ~ ?+ car ~ diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 46affabb66..5d1338cf97 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -5256,7 +5256,7 @@ |= [rof=roof pov=path our=ship now=@da who=ship] ;; ship =< q.q %- need %- need - (rof ~ pov %j `beam`[[our %sein %da now] /(scot %p who)]) + (rof [~ ~] pov %j `beam`[[our %sein %da now] /(scot %p who)]) -- :: middle core: stateless queries for default numeric sponsorship :: From e63de85663e536f6bdb563ab3c0fc9408f21e3dc Mon Sep 17 00:00:00 2001 From: pkova Date: Thu, 14 Dec 2023 14:02:10 +0200 Subject: [PATCH 123/252] dill: gang fixes --- pkg/arvo/sys/vane/dill.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/dill.hoon b/pkg/arvo/sys/vane/dill.hoon index b5400d1aa4..b9722415d6 100644 --- a/pkg/arvo/sys/vane/dill.hoon +++ b/pkg/arvo/sys/vane/dill.hoon @@ -146,7 +146,7 @@ ++ sponsor ^- ship =/ dat=(unit (unit cage)) - (rof `[our ~ ~] /dill j/[[our sein/da/now] /(scot %p our)]) + (rof [~ ~] /dill j/[[our sein/da/now] /(scot %p our)]) ;;(ship q.q:(need (need dat))) :: ++ init :: initialize @@ -495,7 +495,7 @@ ?. ?& =(&+our why) =([%$ %da now] lot) =(%$ syd) - =(~ lyc) + =([~ ~] lyc) == ~ :: /%x//whey (list mass) memory usage labels From 6599fddc9a63d9d7ceb47f1a06fdca5434b19c39 Mon Sep 17 00:00:00 2001 From: pkova Date: Thu, 14 Dec 2023 16:18:06 +0200 Subject: [PATCH 124/252] eyre: gang fixes --- pkg/arvo/sys/vane/eyre.hoon | 58 ++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index c3a2a0ffb3..2c562575db 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -4119,8 +4119,35 @@ ~ ~& [%r %scry-foreign-host who] ~ + :: + ?: ?=([%eauth %url ~] tyl) + ?. &(?=(%x ren) ?=(%$ syd)) ~ + =* endpoint endpoint.auth.server-state.ax + ?. ?=(%da -.p.lot) [~ ~] + :: we cannot answer for something prior to the last set time, + :: or something beyond the present moment. + :: + ?: ?| (lth q.p.lot time.endpoint) + (gth q.p.lot now) + == + ~ + :^ ~ ~ %noun + !> ^- (unit @t) + =< eauth-url:eauth:authentication + (per-server-event [eny *duct now rof] server-state.ax) + :: + ?: ?=([%cache @ @ ~] tyl) + ?. &(?=(%x ren) ?=(%$ syd)) ~ + =, server-state.ax + ?~ aeon=(slaw %ud i.t.tyl) [~ ~] + ?~ url=(slaw %t i.t.t.tyl) [~ ~] + ?~ entry=(~(get by cache) u.url) ~ + ?. =(u.aeon aeon.u.entry) ~ + ?~ val=val.u.entry ~ + ?: &(auth.u.val !=([~ ~] lyc)) ~ + ``noun+!>(u.val) :: private endpoints - ?: ?=([~ ~] lyc) + ?. ?=([~ ~] lyc) ~ ?: &(?=(%x ren) ?=(%$ syd)) =, server-state.ax ?+ tyl ~ @@ -4187,33 +4214,4 @@ ``[?=(^ secure.ports) port host] == == - :: public endpoints - ?+ tyl ~ - [%eauth %url ~] - =* endpoint endpoint.auth.server-state.ax - ?. ?=(%da -.p.lot) [~ ~] - :: we cannot answer for something prior to the last set time, - :: or something beyond the present moment. - :: - ?: ?| (lth q.p.lot time.endpoint) - (gth q.p.lot now) - == - ~ - :^ ~ ~ %noun - !> ^- (unit @t) - =< eauth-url:eauth:authentication - (per-server-event [eny *duct now rof] server-state.ax) - :: - [%cache @ @ ~] - =, server-state.ax - ?~ aeon=(slaw %ud i.t.tyl) [~ ~] - ?~ url=(slaw %t i.t.t.tyl) [~ ~] - ?~ entry=(~(get by cache) u.url) [~ ~] - ?. =(u.aeon aeon.u.entry) [~ ~] - ?~ val=val.u.entry [~ ~] - ?: &(auth.u.val !=([~ ~] lyc)) ~ - ``noun+!>(u.val) - :: - == - -- From 6c33b2f5d8443081477ccfb4639967bb2debf86c Mon Sep 17 00:00:00 2001 From: pkova Date: Thu, 14 Dec 2023 16:18:23 +0200 Subject: [PATCH 125/252] ames: gang fixes --- pkg/arvo/sys/vane/ames.hoon | 79 ++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 40 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index e3ee9745d1..81b24200e8 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -5771,7 +5771,45 @@ :: ?. ?=(%x ren) ~ => .(tyl `(pole knot)`tyl) - ?: =([~ ~] lyc) + :: public endpoints + ?: ?=([%fine %hunk lop=@t len=@t pax=^] tyl) + ::TODO separate endpoint for the full message (instead of packet list) + :: .pax is expected to be a scry path of the shape /vc/desk/rev/etc, + :: so we need to give it the right shape + :: + ?~ blk=(de-path-soft:balk pax.tyl) ~ + :: + ?. (is-our-bulk our ames-state u.blk) + ~ + =+ nom=(as-omen:balk u.blk) + ~| nom + |^ + =/ van ?@(vis.nom (end 3 vis.nom) way.vis.nom) + =/ kyr ?@(vis.nom (rsh 3 vis.nom) car.vis.nom) + ?. =(%c van) + (en-hunk (rof ~ /ames nom)) + =+ pem=(rof [~ ~] /ames nom(vis %cp)) + ?. ?=(^ pem) ~ + ?. ?=(^ u.pem) ~ + ~| u.u.pem + =+ per=!<([r=dict:clay w=dict:clay] q.u.u.pem) + ?. =([%black ~ ~] rul.r.per) ~ + (en-hunk (rof [~ ~] /ames nom)) + :: + ++ en-hunk + |= res=(unit (unit cage)) + ^+ res + ?~ res ~ + =/ =hunk [(slav %ud lop.tyl) (slav %ud len.tyl)] + :: + =/ hu-co (etch-hunk our [life crypto-core]:ames-state) + ?- res + [~ ~] ``noun+!>((etch-open:hu-co pax.tyl hunk ~)) + [~ ~ *] ``noun+!>((etch-open:hu-co pax.tyl hunk [p q.q]:u.u.res)) + == + -- + :: private endpoints + ?. =([~ ~] lyc) ~ ?+ tyl ~ [%$ %whey ~] =/ maz=(list mass) @@ -5899,45 +5937,6 @@ ``noun+!>(protocol-version) :: == - - ?+ tyl ~ - [%fine %hunk lop=@t len=@t pax=^] - ::TODO separate endpoint for the full message (instead of packet list) - :: .pax is expected to be a scry path of the shape /vc/desk/rev/etc, - :: so we need to give it the right shape - :: - ?~ blk=(de-path-soft:balk pax.tyl) ~ - :: - ?. (is-our-bulk our ames-state u.blk) - ~ - =+ nom=(as-omen:balk u.blk) - ~| nom - |^ - =/ van ?@(vis.nom (end 3 vis.nom) way.vis.nom) - =/ kyr ?@(vis.nom (rsh 3 vis.nom) car.vis.nom) - ?. =(%c van) - (en-hunk (rof ~ /ames nom)) - =+ pem=(rof [~ ~] /ames nom(vis %cp)) - ?. ?=(^ pem) ~ - ?. ?=(^ u.pem) ~ - ~| u.u.pem - =+ per=!<([r=dict:clay w=dict:clay] q.u.u.pem) - ?. =([%black ~ ~] rul.r.per) ~ - (en-hunk (rof [~ ~] /ames nom)) - :: - ++ en-hunk - |= res=(unit (unit cage)) - ^+ res - ?~ res ~ - =/ =hunk [(slav %ud lop.tyl) (slav %ud len.tyl)] - :: - =/ hu-co (etch-hunk our [life crypto-core]:ames-state) - ?- res - [~ ~] ``noun+!>((etch-open:hu-co pax.tyl hunk ~)) - [~ ~ *] ``noun+!>((etch-open:hu-co pax.tyl hunk [p q.q]:u.u.res)) - == - -- - == :: -- From 9c8e20cfde9c42987e26bb0f60cfaca8003a3b55 Mon Sep 17 00:00:00 2001 From: pkova Date: Fri, 15 Dec 2023 13:29:37 +0200 Subject: [PATCH 126/252] eyre: fix indentation for private scry endpoints --- pkg/arvo/sys/vane/eyre.hoon | 128 ++++++++++++++++++------------------ 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index 2c562575db..9485f7f2a6 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -4148,70 +4148,70 @@ ``noun+!>(u.val) :: private endpoints ?. ?=([~ ~] lyc) ~ - ?: &(?=(%x ren) ?=(%$ syd)) - =, server-state.ax - ?+ tyl ~ - [%$ %whey ~] =- ``mass+!>(`(list mass)`-) - :~ bindings+&+bindings.server-state.ax - auth+&+auth.server-state.ax - connections+&+connections.server-state.ax - channels+&+channel-state.server-state.ax - axle+&+ax - == - :: - [%cors ~] ``noun+!>(cors-registry) - [%cors %requests ~] ``noun+!>(requests.cors-registry) - [%cors %approved ~] ``noun+!>(approved.cors-registry) - [%cors %rejected ~] ``noun+!>(rejected.cors-registry) - :: - [%cors ?(%approved %rejected) @ ~] - =* kind i.t.tyl - =* orig i.t.t.tyl - ?~ origin=(slaw %t orig) [~ ~] - ?- kind - %approved ``noun+!>((~(has in approved.cors-registry) u.origin)) - %rejected ``noun+!>((~(has in rejected.cors-registry) u.origin)) - == - :: - [%authenticated %cookie @ ~] - ?~ cookies=(slaw %t i.t.t.tyl) [~ ~] - :^ ~ ~ %noun - !> ^- ? - %- =< request-is-authenticated:authentication - (per-server-event [eny *duct now rof] server-state.ax) - %*(. *request:http header-list ['cookie' u.cookies]~) - :: - [%'_~_' *] - =/ mym (scry-mime now rof (deft:de-purl:html tyl)) - ?: ?=(%| -.mym) [~ ~] - ``noun+!>(p.mym) - == - ?. ?=(%$ ren) ~ - ?+ syd ~ - %bindings ``noun+!>(bindings.server-state.ax) - %connections ``noun+!>(connections.server-state.ax) - %authentication-state ``noun+!>(auth.server-state.ax) - %channel-state ``noun+!>(channel-state.server-state.ax) - :: - %host - %- (lift (lift |=(a=hart:eyre [%hart !>(a)]))) - ^- (unit (unit hart:eyre)) - =. p.lot ?.(=([%da now] p.lot) p.lot [%tas %real]) - ?+ p.lot - [~ ~] - :: - [%tas %fake] - ``[& [~ 8.443] %& /localhost] - :: - [%tas %real] - =* domains domains.server-state.ax - =* ports ports.server-state.ax - =/ =host:eyre [%& ?^(domains n.domains /localhost)] - =/ port=(unit @ud) - ?. ?=(^ secure.ports) - ?:(=(80 insecure.ports) ~ `insecure.ports) - ?:(=(443 u.secure.ports) ~ secure.ports) - ``[?=(^ secure.ports) port host] + ?: &(?=(%x ren) ?=(%$ syd)) + =, server-state.ax + ?+ tyl ~ + [%$ %whey ~] =- ``mass+!>(`(list mass)`-) + :~ bindings+&+bindings.server-state.ax + auth+&+auth.server-state.ax + connections+&+connections.server-state.ax + channels+&+channel-state.server-state.ax + axle+&+ax + == + :: + [%cors ~] ``noun+!>(cors-registry) + [%cors %requests ~] ``noun+!>(requests.cors-registry) + [%cors %approved ~] ``noun+!>(approved.cors-registry) + [%cors %rejected ~] ``noun+!>(rejected.cors-registry) + :: + [%cors ?(%approved %rejected) @ ~] + =* kind i.t.tyl + =* orig i.t.t.tyl + ?~ origin=(slaw %t orig) [~ ~] + ?- kind + %approved ``noun+!>((~(has in approved.cors-registry) u.origin)) + %rejected ``noun+!>((~(has in rejected.cors-registry) u.origin)) == + :: + [%authenticated %cookie @ ~] + ?~ cookies=(slaw %t i.t.t.tyl) [~ ~] + :^ ~ ~ %noun + !> ^- ? + %- =< request-is-authenticated:authentication + (per-server-event [eny *duct now rof] server-state.ax) + %*(. *request:http header-list ['cookie' u.cookies]~) + :: + [%'_~_' *] + =/ mym (scry-mime now rof (deft:de-purl:html tyl)) + ?: ?=(%| -.mym) [~ ~] + ``noun+!>(p.mym) == + ?. ?=(%$ ren) ~ + ?+ syd ~ + %bindings ``noun+!>(bindings.server-state.ax) + %connections ``noun+!>(connections.server-state.ax) + %authentication-state ``noun+!>(auth.server-state.ax) + %channel-state ``noun+!>(channel-state.server-state.ax) + :: + %host + %- (lift (lift |=(a=hart:eyre [%hart !>(a)]))) + ^- (unit (unit hart:eyre)) + =. p.lot ?.(=([%da now] p.lot) p.lot [%tas %real]) + ?+ p.lot + [~ ~] + :: + [%tas %fake] + ``[& [~ 8.443] %& /localhost] + :: + [%tas %real] + =* domains domains.server-state.ax + =* ports ports.server-state.ax + =/ =host:eyre [%& ?^(domains n.domains /localhost)] + =/ port=(unit @ud) + ?. ?=(^ secure.ports) + ?:(=(80 insecure.ports) ~ `insecure.ports) + ?:(=(443 u.secure.ports) ~ secure.ports) + ``[?=(^ secure.ports) port host] + == + == -- From 404a7fc44bd42dd7fc0ea590436752f39a7ca6c2 Mon Sep 17 00:00:00 2001 From: pkova Date: Fri, 15 Dec 2023 19:13:21 +0200 Subject: [PATCH 127/252] tests: fix some tests --- pkg/arvo/lib/test/ames-gall.hoon | 4 ++-- tests/sys/vane/ames.hoon | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/lib/test/ames-gall.hoon b/pkg/arvo/lib/test/ames-gall.hoon index fb5661a1e8..282b849c8a 100644 --- a/pkg/arvo/lib/test/ames-gall.hoon +++ b/pkg/arvo/lib/test/ames-gall.hoon @@ -213,7 +213,7 @@ =< q %- need %- need %- scry:(ames-gate now eny roof) - [~ / %x [[our %$ da+now] /peers/(scot %p her)]] + [[~ ~] / %x [[our %$ da+now] /peers/(scot %p her)]] :: ++ gall-scry-nonce |= $: =gall-gate @@ -227,7 +227,7 @@ =< q %- need %- need %- scry:(gall-gate now eny roof) - [~ / %n [[our dude da+now] [%$ (scot %p ship.sub) [term wire]:sub]]] + [[~ ~] / %n [[our dude da+now] [%$ (scot %p ship.sub) [term wire]:sub]]] :: ++ load-agent |= [=ship =gall-gate =dude:gall =agent:gall] diff --git a/tests/sys/vane/ames.hoon b/tests/sys/vane/ames.hoon index 345a4f7da7..9a982cef44 100644 --- a/tests/sys/vane/ames.hoon +++ b/tests/sys/vane/ames.hoon @@ -714,7 +714,7 @@ :_ ~ %+ expect-eq !>(moves2) !> ^- (list move:ames) - :~ [~[/g/talk] [%pass /fine/shut/1 [%a [%keen sec=~ ship=~nec path=/a/x/1//fine/shut/1/0v2f.7puc8.obvvn.b9ocp.4mhbm.q6v22.8d012.o68bo.mt35s.snb4m.hnnul.e6o8g.ebr01]]]] + :~ [~[/g/talk] [%pass /fine/shut/1 [%a [%keen sec=~ ship=~nec path=/a/x/1//fine/shut/1/0v1.vvaek.7boon.0tp04.21q1h.be1i0.494an.qimof.e2fku.ern01]]]] == :: -- From 01890228b5777f0bf7a425fadca187812a2dbc3f Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Fri, 15 Dec 2023 12:21:47 -0500 Subject: [PATCH 128/252] gall: fix %done handling in key exchange --- pkg/arvo/sys/vane/gall.hoon | 43 +++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 6d731a4bd5..58498c7f28 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -1093,11 +1093,11 @@ ?. ?=([~ %live *] yok) (mo-give %done ~) =/ ap-core (ap-abed:ap agent-name [~ our /gall]) - =^ bod=(unit (unit brood)) mo-core + =^ bod=(each (unit brood) tang) mo-core (ap-serve-brood:ap-core ship path) - ?~ bod - (mo-give %done ~) - =/ =fine-response [%0 u.bod] + ?: ?=(%| -.bod) + (mo-give %done `keys/p.bod) + =/ =fine-response [%0 p.bod] =. mo-core (mo-give %boon fine-response) (mo-give %done ~) :: +mo-handle-ames-request: handle %ames request message. @@ -1249,21 +1249,20 @@ =/ wis=(list ^wire) ~(tap in (~(get ju pen.yoke) [ship t.wire])) ?+ syn ~|(weird-sign-ap-take-brood/-.syn !!) [%ames %boon *] - =+ bud=((soft fine-response) payload.syn) - ?~ bud :: TODO: what happens - %. ap-core - %+ trace odd.veb.bug.state - [leaf/"gall: {} malformed brood res {} {}"]~ - =/ bod bod.u.bud + =/ bud (fall ((soft fine-response) payload.syn) *fine-response) |- - ?~ wis ap-core - ?~ bod + ?~ wis + =. pen.yoke (~(del by pen.yoke) [ship t.wire]) + ap-core + ?~ bod.bud =. ap-core (ap-generic-take i.wis %ames %near [ship t.wire] ~) $(wis t.wis) - =. ap-core (ap-pass i.wis %arvo %a %keen `[idx key]:hutch.u.bod ship t.wire) + =. ap-core (ap-pass i.wis %arvo %a %keen `[idx key]:hutch.u.bod.bud ship t.wire) $(wis t.wis) :: [%ames %done *] + ?~ error.syn + ap-core |- ?~ wis =. pen.yoke (~(del by pen.yoke) [ship t.wire]) @@ -1277,18 +1276,16 @@ :: ++ ap-serve-brood |= [=ship =(pole knot)] - ^- [(unit (unit brood)) _mo-core] + ^- [(each (unit brood) tang) _mo-core] ?. ?=([%$ ver=@ rest=*] pole) - %. `ap-abet - %+ trace odd.veb.bug.state - [leaf/"gall: {} bad brood req {} {}"]~ + :_ ap-abet + |+[leaf/"gall: {} bad brood req {} {}"]~ =/ ver (slav %ud ver.pole) ?. =(1 ver) - %. `ap-abet - %+ trace odd.veb.bug.state - [leaf/"gall: {} bad brood ver {} {} {}"]~ + :_ ap-abet + |+[leaf/"gall: {} bad brood ver {} {} {}"]~ ?~ cop=(ap-match-coop rest.pole) - %. [~^~ ap-abet] + %. [&+~ ap-abet] %+ trace odd.veb.bug.state [leaf/"gall: {} no coop match {} {}"]~ =/ cag=(unit (unit cage)) @@ -1301,11 +1298,11 @@ u.res =/ =hutch (need (~(get-hutch of-farm sky.yoke) u.cop)) ?. has-perms - %. [~^~ ap-abet] + %. [[%.y ~] ap-abet] %+ trace odd.veb.bug.state [leaf/"gall: {} no perms for {} {} {}"]~ =/ =brood [u.cop hutch] - [``brood ap-abet] + [[%.y `brood] ap-abet] :: ++ ap-yawn-all ^- (list card:agent) From ab5cc444195334036b9276c8b9a333ccc749505b Mon Sep 17 00:00:00 2001 From: pkova Date: Mon, 18 Dec 2023 19:03:13 +0200 Subject: [PATCH 129/252] ames: enable %chum --- pkg/arvo/sys/vane/ames.hoon | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 81b24200e8..5ecdb9f963 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -3288,9 +3288,6 @@ ++ on-chum |= spar ^+ event-core - ?: =(0 0) - ~> %slog.0^leaf/"ames: %chum is disabled, do not use" - event-core =/ ship-state (~(get by peers.ames-state) ship) ?. ?=([~ %known *] ship-state) %^ enqueue-alien-todo ship ship-state @@ -5719,8 +5716,6 @@ `@uv`(en:crub:crypto -.u.key (jam [p q.q]:u.u.res)) :: [%chum her=@ lyf=@ cyf=@ ~] - ?: =(1 1) :: stubbed until gang used properly - ~ =/ who (slaw %p her.tyl) =/ lyf (slaw %ud lyf.tyl) =/ cyf (slaw %uv cyf.tyl) From 9c1982856e254d1e7b51afb5e36984a50a74dc95 Mon Sep 17 00:00:00 2001 From: pkova Date: Mon, 18 Dec 2023 19:03:49 +0200 Subject: [PATCH 130/252] ames: parse %chum properly --- pkg/arvo/sys/vane/ames.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 5ecdb9f963..dee54e18c4 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -5726,7 +5726,7 @@ ~ =/ bal=(unit balk) ?~ tex=(de:crub:crypto symmetric-key.u.per u.cyf) ~ - ?~ pax=(mole |.((,path (cue u.tex)))) ~ + ?~ pax=(rush u.tex stap) ~ (de-part:balk our 0 0 u.pax) ?~ bal [~ ~] From 20bda27aaff893cde45da97069a33207d7babfb0 Mon Sep 17 00:00:00 2001 From: pkova Date: Mon, 18 Dec 2023 19:05:02 +0200 Subject: [PATCH 131/252] gall: delete unused match-coop --- pkg/arvo/sys/vane/gall.hoon | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index e71c60ce2a..b20d00d3a6 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -36,16 +36,6 @@ $: veb=_veb-all-off dudes=(set dude) == -++ match-coop - |= [paths=(set path) =path] - ^- (unit coop) - ?: (~(has in paths) path) - `path - ?: =(~ path) - ~ - =. path (flop path) - ?> ?=(^ path) - $(path (flop t.path)) :: +| %main :: From 1effda7a77f43679c76dcf508fc95a15cac9f855 Mon Sep 17 00:00:00 2001 From: pkova Date: Mon, 18 Dec 2023 19:05:59 +0200 Subject: [PATCH 132/252] gall: fix bug in put:of-farm --- pkg/arvo/sys/vane/gall.hoon | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index b20d00d3a6..9c9a5cfd76 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -157,10 +157,9 @@ `farm(q (~(put by q.farm) path plot)) ?~ path `farm(p `plot) - ?~ nex=(~(get by q.farm) i.path) - ~ + =/ nex (~(get by q.farm) i.path) =/ res - $(path t.path, farm u.nex) + $(path t.path, farm ?~(nex *^farm u.nex)) ?~ res ~ `farm(q (~(put by q.farm) i.path u.res)) :: From e7787296e8575ea228c4fab171a74ea75fc87386 Mon Sep 17 00:00:00 2001 From: pkova Date: Mon, 18 Dec 2023 19:06:39 +0200 Subject: [PATCH 133/252] gall: default sky revision at 1 instead of 0 --- pkg/arvo/sys/vane/gall.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 9c9a5cfd76..9774d57e4d 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -169,7 +169,7 @@ %+ put spur =- ski(fan (put:on-path fan.ski -< -> &/page)) ?~ las=(ram:on-path fan.ski) - [(fall bob.ski 0) now] + [(fall bob.ski 1) now] :_ (max now +(p.val.u.las)) ?~(bob.ski +(key.u.las) +((max key.u.las u.bob.ski))) :: From 2cbeb782aa211d4fa185354d8a695aac48cba1e7 Mon Sep 17 00:00:00 2001 From: pkova Date: Mon, 18 Dec 2023 19:12:56 +0200 Subject: [PATCH 134/252] gall: better mo-authorized logic --- pkg/arvo/sys/vane/gall.hoon | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 9774d57e4d..a53373c0d2 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -1006,9 +1006,10 @@ %.y ?~ (~(get-hutch of-farm farm) path) %.y + ?: ?=(~ lyc) + %.n ?~ coop=(~(match-coop of-farm farm) path) %.n - ?< ?=(~ lyc) (mo-authorized-coop u.lyc farm dap path u.coop) :: +mo-peek: call to +ap-peek (which is not accessible outside of +mo). :: From 6ce270ffa4ace7748097dc156e5f351b0f88c868 Mon Sep 17 00:00:00 2001 From: silnem2 <126880409+silnem2@users.noreply.github.com> Date: Tue, 9 Jan 2024 06:53:38 -0800 Subject: [PATCH 135/252] drum: fix off-by-one error in wrd:offset --- pkg/arvo/lib/hood/drum.hoon | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/lib/hood/drum.hoon b/pkg/arvo/lib/hood/drum.hoon index bec10edf07..532205c505 100644 --- a/pkg/arvo/lib/hood/drum.hoon +++ b/pkg/arvo/lib/hood/drum.hoon @@ -1070,8 +1070,9 @@ ++ wrd :: next or current word |= a=(list @) =| i=@ud + ?~ a i |- ^- @ud - ?: |(?=(~ a) (alnm i.a)) i + ?: |(?=(~ t.a) (alnm i.a)) i $(i +(i), a t.a) -- -- From 350e883ad66906498c537474e50cc050a943c1e7 Mon Sep 17 00:00:00 2001 From: pkova Date: Wed, 17 Jan 2024 17:59:32 +0200 Subject: [PATCH 136/252] gall: delete unused migrate:of-grow --- pkg/arvo/sys/vane/gall.hoon | 8 -------- 1 file changed, 8 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index a53373c0d2..04a0be4077 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -130,14 +130,6 @@ ^- (list coop) ^$(pos (snoc pos seg), farm f) :: - ++ migrate - |= from=(map spur plot) - =/ from ~(tap by from) - |- ^+ farm - ?~ from farm - =. farm (need (put i.from)) - $(from t.from) - :: ++ match-coop =| wer=path |= =path From 9236909cec563a1540e2ac3b761cb996b980abaf Mon Sep 17 00:00:00 2001 From: pkova Date: Wed, 17 Jan 2024 17:59:47 +0200 Subject: [PATCH 137/252] gall: separate put:of-grow to put-tend and put-grow --- pkg/arvo/sys/vane/gall.hoon | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 04a0be4077..b899beab19 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -142,7 +142,7 @@ ~ $(wer [i.path wer], path t.path, farm u.nex) :: - ++ put + ++ put-grow |= [=path =plot] ^- (unit _farm) ?: ?=(%coop -.farm) @@ -155,10 +155,24 @@ ?~ res ~ `farm(q (~(put by q.farm) i.path u.res)) :: + ++ put-tend + |= [=path =plot] + ^- (unit _farm) + ?: ?=(%coop -.farm) + `farm(q (~(put by q.farm) path plot)) + ?~ path + `farm(p `plot) + ?~ nex=(~(get by q.farm) i.path) + ~ + =/ res + $(path t.path, farm u.nex) + ?~ res ~ + `farm(q (~(put by q.farm) i.path u.res)) + :: ++ grow |= [=spur now=@da =page] =/ ski (gut spur) - %+ put spur + %+ put-grow spur =- ski(fan (put:on-path fan.ski -< -> &/page)) ?~ las=(ram:on-path fan.ski) [(fall bob.ski 1) now] @@ -258,6 +272,7 @@ ?~ nex=(~(get by q.farm) i.path) ~ $(path t.path, farm u.nex) + :: ++ tap-plot =| wer=path |- ^- (list [path plot]) @@ -512,7 +527,7 @@ =/ sky=(list [=spur bob=@ud]) ~(tap by sky.u.yak) |- ?~ sky farm - =. farm (need (~(put of-farm farm) spur.i.sky [`bob.i.sky ~])) + =. farm (need (~(put-tend of-farm farm) spur.i.sky [`bob.i.sky ~])) $(sky t.sky) == :: @@ -1424,7 +1439,7 @@ |= [=spur =page] ^+ ap-core :: check here, and no-op, so that +need below does not crash - ?: =(~ (ap-match-coop spur)) + ?: =(^ (ap-match-coop spur)) %. ap-core %+ trace & [leaf+"gall: {}: grow {} has coop, dropping"]~ @@ -1455,7 +1470,7 @@ :: %& :: replace with hash %- need - %+ ~(put of-farm sky.yoke) spur + %+ ~(put-grow of-farm sky.yoke) spur u.old(fan (put:on-path fan.u.old yon u.val(q |/(shax (jam p.q.u.val))))) == :: +ap-cull: delete all bindings up to and including .case @@ -1491,7 +1506,7 @@ %. sky.yoke %+ trace & [leaf+"gall: {}: cull {<[case spur]>} invalid path structure"]~ - %+ ~(put of-farm sky.yoke) spur :: delete all older paths + %+ ~(put-grow of-farm sky.yoke) spur :: delete all older paths [`yon (lot:on-path fan.u.old `yon ~)] :: +ap-from-internal: internal move to move. :: @@ -2692,7 +2707,7 @@ farm =/ [=spur p=plot] i.ski =; new - ?~ nex=(~(put of-farm farm) spur new) + ?~ nex=(~(put-tend of-farm farm) spur new) ~& %weird !! :: shouldn't continue else loss of ref integrity :: $(ski t.ski) From f44c3b91743ac37e0ca329660c13245d3bbed832 Mon Sep 17 00:00:00 2001 From: pkova Date: Thu, 18 Jan 2024 15:22:12 +0200 Subject: [PATCH 138/252] gall: make put-grow:of-farm fail when encountering a %coop --- pkg/arvo/sys/vane/gall.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index b899beab19..e2478fb083 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -146,7 +146,7 @@ |= [=path =plot] ^- (unit _farm) ?: ?=(%coop -.farm) - `farm(q (~(put by q.farm) path plot)) + ~ ?~ path `farm(p `plot) =/ nex (~(get by q.farm) i.path) From 315ff3fe408822b57fb283cd3c7462aa398981f5 Mon Sep 17 00:00:00 2001 From: pkova Date: Mon, 22 Jan 2024 17:51:00 +0200 Subject: [PATCH 139/252] gall: fix miscellaneous bugs with encrypted remote scry --- pkg/arvo/sys/vane/gall.hoon | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index e2478fb083..83b8f5da3a 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -142,6 +142,17 @@ ~ $(wer [i.path wer], path t.path, farm u.nex) :: + ++ put + |= [=path =plot] + ^- _farm + ?: ?=(%coop -.farm) + farm(q (~(put by q.farm) path plot)) + ?~ path + farm(p `plot) + =/ nex (~(get by q.farm) i.path) + =/ res $(path t.path, farm ?~(nex *^farm u.nex)) + farm(q (~(put by q.farm) i.path res)) + :: ++ put-grow |= [=path =plot] ^- (unit _farm) @@ -172,7 +183,7 @@ ++ grow |= [=spur now=@da =page] =/ ski (gut spur) - %+ put-grow spur + %+ put spur =- ski(fan (put:on-path fan.ski -< -> &/page)) ?~ las=(ram:on-path fan.ski) [(fall bob.ski 1) now] @@ -527,7 +538,7 @@ =/ sky=(list [=spur bob=@ud]) ~(tap by sky.u.yak) |- ?~ sky farm - =. farm (need (~(put-tend of-farm farm) spur.i.sky [`bob.i.sky ~])) + =. farm (need (~(put-grow of-farm farm) spur.i.sky [`bob.i.sky ~])) $(sky t.sky) == :: @@ -1397,10 +1408,10 @@ ?. (~(has by gem.yoke) coop) %. ap-core %+ trace & - [leaf+"gall: {} no such coop {}, dropping %grow at {}"]~ + [leaf+"gall: {} no such coop {}, dropping %tend at {}"]~ =. gem.yoke (~(put ju gem.yoke) coop path page) ap-core - =. sky.yoke (need (~(grow of-farm sky.yoke) (welp coop path) now page)) + =. sky.yoke (~(grow of-farm sky.yoke) (welp coop path) now page) ap-core :: ++ ap-germ @@ -1439,12 +1450,12 @@ |= [=spur =page] ^+ ap-core :: check here, and no-op, so that +need below does not crash - ?: =(^ (ap-match-coop spur)) + ?: ?=(^ (ap-match-coop spur)) %. ap-core %+ trace & [leaf+"gall: {}: grow {} has coop, dropping"]~ =- ap-core(sky.yoke -) - (need (~(grow of-farm sky.yoke) spur now page)) + (~(grow of-farm sky.yoke) spur now page) :: +ap-tomb: tombstone -- replace bound value with hash :: ++ ap-tomb @@ -1469,8 +1480,7 @@ [leaf+"gall: {}: tomb {<[case spur]>} no-op"]~ :: %& :: replace with hash - %- need - %+ ~(put-grow of-farm sky.yoke) spur + %+ ~(put of-farm sky.yoke) spur u.old(fan (put:on-path fan.u.old yon u.val(q |/(shax (jam p.q.u.val))))) == :: +ap-cull: delete all bindings up to and including .case @@ -1501,12 +1511,7 @@ %+ weld "gall: {}: cull {<[case spur]>} out of range, " "min: {}, max: {}" - =; nex=(unit farm) - ?^ nex u.nex - %. sky.yoke - %+ trace & - [leaf+"gall: {}: cull {<[case spur]>} invalid path structure"]~ - %+ ~(put-grow of-farm sky.yoke) spur :: delete all older paths + %+ ~(put of-farm sky.yoke) spur :: delete all older paths [`yon (lot:on-path fan.u.old `yon ~)] :: +ap-from-internal: internal move to move. :: @@ -2707,7 +2712,7 @@ farm =/ [=spur p=plot] i.ski =; new - ?~ nex=(~(put-tend of-farm farm) spur new) + ?~ nex=(~(put-grow of-farm farm) spur new) ~& %weird !! :: shouldn't continue else loss of ref integrity :: $(ski t.ski) From 9a18a062e56a8489a9450a05e8d81926966f67b3 Mon Sep 17 00:00:00 2001 From: midden-fabler Date: Mon, 22 Jan 2024 12:34:25 -0500 Subject: [PATCH 140/252] lull, gall: cleanup plot, sky.bowl --- pkg/arvo/sys/lull.hoon | 8 +++----- pkg/arvo/sys/vane/gall.hoon | 5 ----- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index 5d669d7f9c..a7970a83bd 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -2758,9 +2758,10 @@ +$ boat (map [=wire =ship =term] [acked=? =path]) :: outgoing subs +$ boar (map [=wire =ship =term] nonce=@) :: and their nonces :: + +$ fans ((mop @ud (pair @da (each page @uvI))) lte) +$ plot $: bob=(unit @ud) - fan=((mop @ud (pair @da (each page @uvI))) lte) + fan=fans == +$ stats :: statistics $: change=@ud :: processed move count @@ -2776,7 +2777,6 @@ [%plot p=(unit plot) q=(map @ta farm)] == :: - +$ egg :: migratory agent state $% [%nuke sky=(map spur @ud) cop=(map coop hutch)] :: see /sys/gall $yoke $: %live @@ -2823,9 +2823,7 @@ == :: $: wex=boat :: outgoing subs sup=bitt :: incoming subs - $= sky :: scry bindings - %+ map path :: - ((mop @ud (pair @da (each page @uvI))) lte) :: + sky=(map path fans) :: scry bindings == :: $: act=@ud :: change number eny=@uvJ :: entropy diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 83b8f5da3a..b840bf4e2d 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -108,11 +108,6 @@ gem=(jug coop [path page]) == == :: -+$ plot - $: bob=(unit @ud) - fan=((mop @ud (pair @da (each page @uvI))) lte) - == -:: ++ of-farm |_ =farm ++ key-coops From 19142cf6f1dd6bf90acf3b771c108610e6eaff2a Mon Sep 17 00:00:00 2001 From: pkova Date: Tue, 23 Jan 2024 19:24:32 +0200 Subject: [PATCH 141/252] gall: fix off-by-one in growing after culling --- pkg/arvo/sys/vane/gall.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index b840bf4e2d..d7a56e6e16 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -181,7 +181,7 @@ %+ put spur =- ski(fan (put:on-path fan.ski -< -> &/page)) ?~ las=(ram:on-path fan.ski) - [(fall bob.ski 1) now] + [?~(bob.ski 1 +(u.bob.ski)) now] :_ (max now +(p.val.u.las)) ?~(bob.ski +(key.u.las) +((max key.u.las u.bob.ski))) :: From db3cf2a65317a4c448f6f064293d3d0924c031ef Mon Sep 17 00:00:00 2001 From: wispem-wantex Date: Tue, 23 Jan 2024 20:15:39 -0800 Subject: [PATCH 142/252] test thread: now prints errors/failures in red instead of gray --- pkg/arvo/sys/vane/clay.hoon | 2 +- pkg/arvo/ted/test.hoon | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 65230a0cde..1acf9716e0 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -4552,7 +4552,7 @@ |^ =/ res (mule |.(read)) ?: ?=(%& -.res) p.res %. [[~ ~] ..park] - (slog leaf+"clay: read-at-tako fail {<[desk=syd mun]>}" p.res) + (%*(. slog1 pri 3) leaf+"clay: read-at-tako fail {<[desk=syd mun]>}" p.res) :: ++ read ^- [(unit (unit cage)) _..park] diff --git a/pkg/arvo/ted/test.hoon b/pkg/arvo/ted/test.hoon index d483fb1ff7..927325e94f 100644 --- a/pkg/arvo/ted/test.hoon +++ b/pkg/arvo/ted/test.hoon @@ -17,14 +17,14 @@ :: ++ run-test |= [pax=path test=test-func] - ^- [ok=? =tang] + ^- [ok=? output=tang result=tang] =+ name=(spud pax) =+ run=(mule test) ?- -.run - %| |+(welp p.run leaf+"CRASHED {name}" ~) + %| |+[p.run [leaf+"CRASHED {name}" ~]] %& ?: =(~ p.run) - &+[leaf+"OK {name}"]~ - |+(flop `tang`[leaf+"FAILED {name}" p.run]) + &+[p.run [leaf+"OK {name}" ~]] + |+[p.run [leaf+"FAILED {name}" ~]] == :: +resolve-test-paths: add test names to file paths to form full identifiers :: @@ -119,7 +119,7 @@ ?^ fiz ;< cor=(unit vase) bind:m (build-file:strandio beam.i.fiz) ?~ cor - ~> %slog.0^leaf+"FAILED {(spud s.beam.i.fiz)} (build)" + ~> %slog.3^leaf+"FAILED {(spud s.beam.i.fiz)} (build)" gather-tests(fiz t.fiz, build-ok |) ~> %slog.0^leaf+"built {(spud s.beam.i.fiz)}" =/ arms=(list test-arm) (get-test-arms u.cor) @@ -135,5 +135,6 @@ |= [[=path =test-func] ok=_build-ok] ^+ ok =/ res (run-test path test-func) -%- (slog (flop tang.res)) +%- (%*(. slog pri ?:(ok.res 0 3)) output.res) +%- (%*(. slog pri ?:(ok.res 0 3)) result.res) &(ok ok.res) From f6097522311d571a73d50bf755d7a91b00e20e33 Mon Sep 17 00:00:00 2001 From: Alessio Date: Thu, 25 Jan 2024 15:04:24 -0800 Subject: [PATCH 143/252] Fix a typo --- pkg/arvo/sys/vane/clay.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 1acf9716e0..0d172ef0b5 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -4552,7 +4552,7 @@ |^ =/ res (mule |.(read)) ?: ?=(%& -.res) p.res %. [[~ ~] ..park] - (%*(. slog1 pri 3) leaf+"clay: read-at-tako fail {<[desk=syd mun]>}" p.res) + (%*(. slog pri 3) leaf+"clay: read-at-tako fail {<[desk=syd mun]>}" p.res) :: ++ read ^- [(unit (unit cage)) _..park] From c5d3be7be2a19963425ee3d481393c4189ff4acd Mon Sep 17 00:00:00 2001 From: pkova Date: Fri, 26 Jan 2024 01:31:21 +0200 Subject: [PATCH 144/252] clay: do not return false conversion gate from build-cast --- pkg/arvo/app/herm.hoon | 1 - pkg/arvo/sys/vane/clay.hoon | 32 +++++++------------------------- 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/pkg/arvo/app/herm.hoon b/pkg/arvo/app/herm.hoon index f20bf2b2d8..8c2b77f06a 100644 --- a/pkg/arvo/app/herm.hoon +++ b/pkg/arvo/app/herm.hoon @@ -5,7 +5,6 @@ :: keep relevant mark conversions in cache for performance :: /$ blit-to-json %blit %json -/$ json-to-blit %json %blit /$ json-to-task %json %herm-task :: =, jael diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 65230a0cde..9d8d1a7deb 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -749,24 +749,19 @@ :: try direct +grab :: =^ new=vase nub (build-fit %mar b) + =/ rib (mule |.((slap new !,(*hoon grab)))) + =/ arm=? + ?: ?=(%| -.rib) %.n + =/ lab (mule |.((slob a p.p.rib))) + ?: ?=(%| -.lab) %.n + p.lab =/ rab (mule |.((slap new tsgl/[limb/a limb/%grab]))) - ?: &(?=(%& -.rab) ?=(^ q.p.rab)) + ?: &(arm ?=(%& -.rab) ?=(^ q.p.rab)) %+ gain-leak cast+a^b |= nob=state %- (trace 4 |.("{} -> {}: +{(trip a)}:grab:{(trip b)}")) =. nub nob :_(nub vase+p.rab) - :: try +jump - :: - =/ jum (mule |.((slap old tsgl/[limb/b limb/%jump]))) - ?: ?=(%& -.jum) - =/ via !<(mark p.jum) - %- (trace 4 |.("{} -> {}: via {} per +jump:{(trip a)}")) - (compose-casts a via b) - ?: ?=(%& -.rab) - =/ via !<(mark p.rab) - %- (trace 4 |.("{} -> {}: via {} per +grab:{(trip b)}")) - (compose-casts a via b) ?: ?=(%noun b) %+ gain-leak cast+a^b |= nob=state @@ -774,19 +769,6 @@ =. nub nob :_(nub vase+same.bud) ~|(no-cast-from+[a b] !!) - :: - ++ compose-casts - |= [x=mark y=mark z=mark] - ^- [soak state] - =^ uno=vase nub (build-cast x y) - =^ dos=vase nub (build-cast y z) - %+ gain-leak cast+x^z - |= nob=state - =. nub nob - :_ nub :- %vase - %+ slap - (with-faces uno+uno dos+dos ~) - !,(*hoon |=(_+<.uno (dos (uno +<)))) :: +build-tube: produce a $tube mark conversion gate from .a to .b :: ++ build-tube From 8dc62a6cbe55567042b174800c9363cb39ff1b15 Mon Sep 17 00:00:00 2001 From: pkova Date: Fri, 26 Jan 2024 19:15:25 +0200 Subject: [PATCH 145/252] clay: restore +jump --- pkg/arvo/sys/vane/clay.hoon | 46 ++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 9d8d1a7deb..d1cc404632 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -729,11 +729,7 @@ :: %- (trace 1 |.("make cast {} -> {}")) =^ old=vase nub (build-fit %mar a) - ?: =/ ram (mule |.((slap old !,(*hoon grow)))) - ?: ?=(%| -.ram) %.n - =/ lab (mule |.((slob b p.p.ram))) - ?: ?=(%| -.lab) %.n - p.lab + ?: (has-arm %grow b old) :: +grow core has .b arm; use that :: %+ gain-leak cast+a^b @@ -749,12 +745,7 @@ :: try direct +grab :: =^ new=vase nub (build-fit %mar b) - =/ rib (mule |.((slap new !,(*hoon grab)))) - =/ arm=? - ?: ?=(%| -.rib) %.n - =/ lab (mule |.((slob a p.p.rib))) - ?: ?=(%| -.lab) %.n - p.lab + =/ arm=? (has-arm %grab a new) =/ rab (mule |.((slap new tsgl/[limb/a limb/%grab]))) ?: &(arm ?=(%& -.rab) ?=(^ q.p.rab)) %+ gain-leak cast+a^b @@ -762,6 +753,17 @@ %- (trace 4 |.("{} -> {}: +{(trip a)}:grab:{(trip b)}")) =. nub nob :_(nub vase+p.rab) + :: try +jump + :: + =/ jum (mule |.((slap old tsgl/[limb/b limb/%jump]))) + ?: &((has-arm %jump a old) ?=(%& -.jum)) + =/ via !<(mark p.jum) + %- (trace 4 |.("{} -> {}: via {} per +jump:{(trip a)}")) + (compose-casts a via b) + ?: &(arm ?=(%& -.rab)) + =/ via !<(mark p.rab) + %- (trace 4 |.("{} -> {}: via {} per +grab:{(trip b)}")) + (compose-casts a via b) ?: ?=(%noun b) %+ gain-leak cast+a^b |= nob=state @@ -769,6 +771,28 @@ =. nub nob :_(nub vase+same.bud) ~|(no-cast-from+[a b] !!) + :: + ++ compose-casts + |= [x=mark y=mark z=mark] + ^- [soak state] + =^ uno=vase nub (build-cast x y) + =^ dos=vase nub (build-cast y z) + %+ gain-leak cast+x^z + |= nob=state + =. nub nob + :_ nub :- %vase + %+ slap + (with-faces uno+uno dos+dos ~) + !,(*hoon |=(_+<.uno (dos (uno +<)))) + :: + ++ has-arm + |= [arm=@tas =mark core=vase] + ^- ? + =/ rib (mule |.((slap core [%wing ~[arm]]))) + ?: ?=(%| -.rib) %.n + =/ lab (mule |.((slob mark p.p.rib))) + ?: ?=(%| -.lab) %.n + p.lab :: +build-tube: produce a $tube mark conversion gate from .a to .b :: ++ build-tube From ab021294d2b3771823c9ba40a9c8446e1e54eacf Mon Sep 17 00:00:00 2001 From: Alessio Date: Tue, 30 Jan 2024 23:08:24 -0800 Subject: [PATCH 146/252] Undo the clay change for now --- pkg/arvo/sys/vane/clay.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 0d172ef0b5..65230a0cde 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -4552,7 +4552,7 @@ |^ =/ res (mule |.(read)) ?: ?=(%& -.res) p.res %. [[~ ~] ..park] - (%*(. slog pri 3) leaf+"clay: read-at-tako fail {<[desk=syd mun]>}" p.res) + (slog leaf+"clay: read-at-tako fail {<[desk=syd mun]>}" p.res) :: ++ read ^- [(unit (unit cage)) _..park] From 235decccd49987aed4698c4f25ac7ddb0c88803d Mon Sep 17 00:00:00 2001 From: Pyry Kovanen Date: Wed, 31 Jan 2024 14:47:30 +0200 Subject: [PATCH 147/252] ames: fix message-blob migration --- pkg/arvo/sys/vane/ames.hoon | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index dee54e18c4..6f5db03596 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -1954,9 +1954,11 @@ ?. ?=([%deep %nack *] task) task =/ msg =>([cue=cue arg=message-blob.task] ~+((cue arg))) =/ hed - ?: =(1 (end 0 nack-bone.task)) %plea - ?: =(0 (end 0 (rsh 0 nack-bone.task))) %boon - %naxplanation + ?: =(1 (end 0 nack-bone.task)) + ?: =(0 (end 0 (rsh 0 nack-bone.task))) + %boon + %naxplanation + %plea [%deep %nack ship.task nack-bone.task ;;(message [hed msg])] == -- @@ -5665,9 +5667,11 @@ |= b=message-blob ^- message =/ hed - ?: =(1 (end 0 bone)) %plea - ?: =(0 (end 0 (rsh 0 bone))) %boon - %naxplanation + ?: =(1 (end 0 bone)) + ?: =(0 (end 0 (rsh 0 bone))) + %boon + %naxplanation + %plea =/ msg =>([cue=cue arg=b] ~+((cue arg))) ;;(message [hed msg]) == == == From e7bb1e3fa5b25baaf93c1704035c9dfb0e760ec7 Mon Sep 17 00:00:00 2001 From: Pyry Kovanen Date: Thu, 1 Feb 2024 14:38:45 +0200 Subject: [PATCH 148/252] gall: fix migration when sky contains empty mop --- pkg/arvo/sys/vane/gall.hoon | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index d7a56e6e16..9804203a9b 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -2715,7 +2715,11 @@ :- ~ =/ m ~(val by fan.p) %+ gas:on-path *_fan.p - %+ turn (gulf 1 ~(wyt by fan.p)) + %+ turn + ^- (list @) + =/ wit ~(wyt by fan.p) + ?: =(0 wit) ~ + (gulf 1 wit) |= a=@ud [a (snag (dec a) m)] == From 52d73f2383973a12bee6525f27dce3785c9f93fa Mon Sep 17 00:00:00 2001 From: silnem2 <126880409+silnem2@users.noreply.github.com> Date: Thu, 1 Feb 2024 16:28:35 -0800 Subject: [PATCH 149/252] dojo: fix special casing of =dir --- pkg/arvo/app/dojo.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/app/dojo.hoon b/pkg/arvo/app/dojo.hoon index f2b8e4f99d..04695032f8 100644 --- a/pkg/arvo/app/dojo.hoon +++ b/pkg/arvo/app/dojo.hoon @@ -168,7 +168,7 @@ :: ;~ pfix tis ;~ pose - (parse-variable (jest %dir) ;~(pfix ace :(stag 0 %ex parse-rood))) + (parse-variable (cold %dir (jest 'dir ')) :(stag 0 %ex parse-rood)) (parse-variable sym ;~(pfix ace parse-source)) == == From a2645c2f12dfad65a512eaf43b167321aafff5e3 Mon Sep 17 00:00:00 2001 From: midden-fabler Date: Fri, 2 Feb 2024 11:36:14 -0500 Subject: [PATCH 150/252] ames, hoon: add run:to, speed up ames migration --- pkg/arvo/sys/hoon.hoon | 6 ++++++ pkg/arvo/sys/vane/ames.hoon | 31 +++++++++++++++---------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 94115d9622..05c723fcd2 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -1795,6 +1795,12 @@ [b ~ ~] bal(l.a $(a l.a)) :: + ++ run :: apply gate to values + |* b=gate + |- + ?~ a a + [n=(b n.a) l=$(a l.a) r=$(a r.a)] + :: ++ tap :: adds list to end =+ b=`(list _?>(?=(^ a) n.a))`~ |- ^+ b diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 6f5db03596..a7c977eb94 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -5654,27 +5654,26 @@ keens [keens.s ~] :: snd.+ - %- malt - %+ turn - ~(tap by snd.+.s) + %- ~(urn by snd.+.s) |= [=bone m=message-pump-state-17] - :- bone + =/ hed + ?: =(1 (end 0 bone)) + ?: =(0 (end 0 (rsh 0 bone))) + %boon + %naxplanation + %plea %= m unsent-messages - %- ~(gas to *(qeu message)) - %+ turn - ~(tap to unsent-messages.m) + =* um unsent-messages.m + => [..message hed=hed um=um ..cue] + ~+ %- ~(run to um) |= b=message-blob ^- message - =/ hed - ?: =(1 (end 0 bone)) - ?: =(0 (end 0 (rsh 0 bone))) - %boon - %naxplanation - %plea - =/ msg =>([cue=cue arg=b] ~+((cue arg))) - ;;(message [hed msg]) - == == == + => [..message hed=hed ..cue arg=b] + ~+ ;;(message [hed (cue arg)]) + == + == + == -- :: +scry: dereference namespace :: From 8e4262a531e582bc6c531513caf4aad921e050e6 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Mon, 5 Feb 2024 10:18:36 +0100 Subject: [PATCH 151/252] ames,gall: fix old state migrations TODO: %ames migrates all the queued events directly to the latest task in %lull -- do it one at a time --- pkg/arvo/sys/vane/ames.hoon | 264 +++++++++++++++++++++--------------- pkg/arvo/sys/vane/gall.hoon | 39 +++--- 2 files changed, 177 insertions(+), 126 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 6f5db03596..e286a0b287 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -483,7 +483,7 @@ ++ is-our-bulk |= [our=ship =ames-state =balk] ^- ? - =- ~? =(| -) + =- ~? =(| -) [%fine-mismatch our=[rift life]:ames-state her=[her rif lyf]:balk] - ?& =(our her.balk) @@ -776,15 +776,15 @@ cong=[msg=@ud mem=@ud] == :: -+$ queued-event-11 - $+ queued-event-11 - $% [%call =duct wrapped-task=(hobo task-11)] ++$ queued-event-9 + $+ queued-event-9 + $% [%call =duct wrapped-task=(hobo task-9)] [%take =wire =duct =sign] == :: -+$ task-11 - $+ task-11 - $% [%snub ships=(list ship)] ++$ task-9 + $+ task-9 + $% [%snub ships=(list ship)] :: introduced in ames-state %9, modified in %14 $<(%snub task) == :: @@ -1170,11 +1170,13 @@ $: flow=[%flow (unit dead-timer)] cork=[%cork (unit dead-timer)] == == +:: +$ ship-state-17 $+ ship-state-17 $% [%alien alien-agenda-17] [%known peer-state-17] == +:: +$ peer-state-17 $+ peer-state-17 $: $: =symmetric-key @@ -1194,6 +1196,7 @@ corked=(set bone) keens=(map path keen-state) == +:: +$ message-pump-state-17 $+ message-pump-state-17 $: current=_`message-num`1 @@ -1203,6 +1206,7 @@ queued-message-acks=(map message-num ack) =packet-pump-state == +:: +$ ames-state-14 ames-state-16 +$ ames-state-15 ames-state-16 +$ ames-state-16 @@ -1216,14 +1220,14 @@ snub=[form=?(%allow %deny) ships=(set ship)] cong=[msg=@ud mem=@ud] == - :: - +$ alien-agenda-17 - $+ alien-agenda - $: messages=(list [=duct =plea]) - packets=(set =blob) - heeds=(set duct) - keens=(jug path duct) - == +:: ++$ alien-agenda-17 + $+ alien-agenda + $: messages=(list [=duct =plea]) + packets=(set =blob) + heeds=(set duct) + keens=(jug path duct) + == :: +$ ship-state-16 $+ ship-state-16 @@ -1287,49 +1291,66 @@ counter=@ud == :: -+$ queued-event-11-and-16 - $+ queued-event-11-and-16 - $% [%call =duct wrapped-task=(hobo task-11-and-16)] ++$ queued-event-10-to-13 + $+ queued-event-10-to-13 + $% [%call =duct wrapped-task=(hobo task-10-to-13)] [%take =wire =duct =sign] == :: -+$ task-11-and-16 - $+ task-11-and-16 - $% [%kroc dry=?] - [%keen spar] - [%snub ships=(list ship)] - $<(?(%snub %kroc) task-17) ++$ task-10-to-13 + $+ task-10-to-13 + $% [%kroc dry=?] :: introduced in state %10, modified in %15 + [%snub ships=(list ship)] :: introduced in state %9, modified in %13 + $<(?(%snub %kroc) task) == :: -+$ task-17 - $+ task-17 - $% $<(?(%deep %keen) task) - [%keen spar] - $: %deep ++$ queued-event-13 + $+ queued-event-13 + $% [%call =duct wrapped-task=(hobo task-13)] + [%take =wire =duct =sign] + == +:: ++$ task-13 + $+ task-13 + $% [%kroc dry=?] :: introduced in state %10, modified in %15 + [%keen spar] :: introduced in state %13, modified in %19 + $<(?(%keen %kroc) task) + == +:: ++$ queued-event-14 + $+ queued-event-14 + $% [%call =duct wrapped-task=(hobo task-14)] + [%take =wire =duct =sign] + == +:: ++$ task-14 + $+ task-14 + $% [%kroc dry=?] :: introduced in state %10, modified in %15 + [%keen spar] :: introduced in state %13, modified in %19 + deep-task-14 :: introduced in state %14, modified in %19 + $<(?(%keen %kroc %deep) task) + == +:: ++$ deep-task-14 + $: %deep $% [%nack =ship =nack=bone =message-blob] [%sink =ship =target=bone naxplanation=[=message-num =error]] [%drop =ship =nack=bone =message-num] [%cork =ship =bone] [%kill =ship =bone] - == == - == + == == :: -+$ queued-event-17 - $+ queued-event-17 - $% [%call =duct wrapped-task=(hobo task-17)] ++$ queued-event-15-to-18 + $+ queued-event-15-to-18 + $% [%call =duct wrapped-task=(hobo task-15-to-18)] [%take =wire =duct =sign] == :: -+$ queued-event-16 - $+ queued-event-16 - $% [%call =duct wrapped-task=(hobo task-16)] - [%take =wire =duct =sign] - == -:: -+$ task-16 - $+ task-16 - $% [%kroc dry=?] - $<(%kroc task-17) ++$ task-15-to-18 + $+ task-15-to-18 + $% [%keen spar] :: introduced in state %13, modified in %19 + deep-task-14 :: introduced in state %14, modified in %19 + $<(?(%keen %deep) task) == :: $bug: debug printing configuration :: @@ -1644,77 +1665,77 @@ == [%adult state=ames-state-8] == == - $: %9 + $: %9 :: %snub introduced $% $: %larva - events=(qeu queued-event-11) + events=(qeu queued-event-9) state=ames-state-9 == [%adult state=ames-state-9] == == - $: %10 + $: %10 :: %kroc introduced $% $: %larva - events=(qeu queued-event-11-and-16) + events=(qeu queued-event-10-to-13) state=ames-state-10 == [%adult state=ames-state-10] == == $: %11 $% $: %larva - events=(qeu queued-event-11-and-16) + events=(qeu queued-event-10-to-13) state=ames-state-11 == [%adult state=ames-state-11] == == $: %12 $% $: %larva - events=(qeu queued-event-16) + events=(qeu queued-event-10-to-13) state=ames-state-12 == [%adult state=ames-state-12] == == - $: %13 - $% $: %larva - events=(qeu queued-event-16) + $: %13 :: %snub modified + $% $: %larva :: %keen introduced + events=(qeu queued-event-13) state=ames-state-13 == [%adult state=ames-state-13] == == - $: %14 + $: %14 :: %deep introduced $% $: %larva - events=(qeu queued-event-16) + events=(qeu queued-event-14) state=ames-state-14 == [%adult state=ames-state-14] == == - $: %15 + $: %15 :: %kroc modified $% $: %larva - events=(qeu queued-event-16) + events=(qeu queued-event-15-to-18) state=ames-state-15 == [%adult state=ames-state-15] == == $: %16 $% $: %larva - events=(qeu queued-event-16) + events=(qeu queued-event-15-to-18) state=ames-state-16 == [%adult state=ames-state-16] == == $: %17 $% $: %larva - events=(qeu queued-event-17) + events=(qeu queued-event-15-to-18) state=ames-state-17 == [%adult state=ames-state-17] == == $: %18 $% $: %larva - events=(qeu queued-event-17) + events=(qeu queued-event-15-to-18) state=ames-state-18 == [%adult state=ames-state-18] == == - $: %19 + $: %19 :: %keen & %deep modified $% $: %larva events=(qeu queued-event) state=_ames-state.adult-gate @@ -1782,7 +1803,7 @@ [%9 %larva *] ~> %slog.0^leaf/"ames: larva: load" =. cached-state `[%9 state.old] - =. queued-events (event-11-to-12 events.old) + =. queued-events (event-9-to-last events.old) larval-gate :: [%10 %adult *] @@ -1793,7 +1814,7 @@ [%10 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%10 state.old] - =. queued-events (event-17-to-19 (event-11-to-17 events.old)) + =. queued-events (event-10-til-13-to-last events.old) larval-gate :: [%11 %adult *] @@ -1804,7 +1825,7 @@ [%11 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%11 state.old] - =. queued-events (event-17-to-19 (event-11-to-17 events.old)) + =. queued-events (event-10-til-13-to-last events.old) larval-gate :: [%12 %adult *] @@ -1815,7 +1836,7 @@ [%12 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%12 state.old] - =. queued-events (event-17-to-19 (event-16-to-17 events.old)) + =. queued-events (event-10-til-13-to-last events.old) larval-gate :: [%13 %adult *] @@ -1826,7 +1847,7 @@ [%13 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%13 state.old] - =. queued-events (event-17-to-19 (event-16-to-17 events.old)) + =. queued-events (event-13-to-last events.old) larval-gate :: [%14 %adult *] @@ -1837,7 +1858,7 @@ [%14 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%14 state.old] - =. queued-events (event-17-to-19 (event-16-to-17 events.old)) + =. queued-events (event-14-to-last events.old) larval-gate :: [%15 %adult *] @@ -1848,7 +1869,7 @@ [%15 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%15 state.old] - =. queued-events (event-17-to-19 (event-16-to-17 events.old)) + =. queued-events (event-15-til-18-to-last events.old) larval-gate :: [%16 %adult *] @@ -1859,7 +1880,7 @@ [%16 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%16 state.old] - =. queued-events (event-17-to-19 (event-16-to-17 events.old)) + =. queued-events (event-15-til-18-to-last events.old) larval-gate :: [%17 %adult *] @@ -1870,7 +1891,7 @@ [%17 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%17 state.old] - =. queued-events (event-17-to-19 events.old) + =. queued-events (event-15-til-18-to-last events.old) larval-gate :: [%18 %adult *] @@ -1881,7 +1902,7 @@ [%18 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%18 state.old] - =. queued-events (event-17-to-19 events.old) + =. queued-events (event-15-til-18-to-last events.old) larval-gate :: [%19 %adult *] (load:adult-core %19 state.old) @@ -1893,28 +1914,28 @@ larval-gate == :: - ++ event-11-to-12 - |= events=(qeu queued-event-11) + ++ event-9-to-last + |= events=(qeu queued-event-9) ^- (qeu queued-event) :: "+rep:in on a +qeu looks strange, but works fine." :: %- ~(rep in events) - |= [e=queued-event-11 q=(qeu queued-event)] + |= [e=queued-event-9 q=(qeu queued-event)] %- ~(put to q) ^- queued-event ?. ?=(%call -.e) e - =/ task=task-11 ((harden task-11) wrapped-task.e) + =/ task=task-9 ((harden task-9) wrapped-task.e) %= e wrapped-task ?.(?=(%snub -.task) task [%snub %deny ships.task]) == :: - ++ event-11-to-17 - |= events=(qeu queued-event-11-and-16) - ^- (qeu queued-event-17) + ++ event-10-til-13-to-last + |= events=(qeu queued-event-10-to-13) + ^- (qeu queued-event) %- ~(rep in events) - |= [e=queued-event-11-and-16 q=(qeu queued-event-17)] - %- ~(put to q) ^- queued-event-17 + |= [e=queued-event-10-to-13 q=(qeu queued-event)] + %- ~(put to q) ^- queued-event ?. ?=(%call -.e) e - =/ task=task-11-and-16 ((harden task-11-and-16) wrapped-task.e) + =/ task=task-10-to-13 ((harden task-10-to-13) wrapped-task.e) %= e wrapped-task ?+ -.task task @@ -1923,38 +1944,66 @@ == == :: - ++ event-16-to-17 - |= events=(qeu queued-event-16) - ^- (qeu queued-event-17) + ++ event-13-to-last + |= events=(qeu queued-event-13) + ^- (qeu queued-event) %- ~(rep in events) - |= [e=queued-event-16 q=(qeu queued-event-17)] - %- ~(put to q) ^- queued-event-17 + |= [e=queued-event-13 q=(qeu queued-event)] + %- ~(put to q) ^- queued-event ?. ?=(%call -.e) e - =/ task=task-16 ((harden task-16) wrapped-task.e) + =/ task=task-13 ((harden task-13) wrapped-task.e) %= e wrapped-task - ^- task-17 + ^- ^task ?+ -.task task %kroc [%kroc ~] + %keen [%keen ~ +.task] == == :: - ++ event-17-to-19 - |= events=(qeu queued-event-17) + ++ event-14-to-last + |= events=(qeu queued-event-14) ^- (qeu queued-event) %- ~(rep in events) - |= [e=queued-event-17 q=(qeu queued-event)] + |= [e=queued-event-14 q=(qeu queued-event)] %- ~(put to q) ^- queued-event ?. ?=(%call -.e) e - =/ task=task-17 ((harden task-17) wrapped-task.e) - %= e - wrapped-task - ?: ?=(%keen -.task) + =/ task=task-14 ((harden task-14) wrapped-task.e) + %= e + wrapped-task + ^- ^task + ?: ?=(%kroc -.task) + [%kroc ~] + ?: ?=(%keen -.task) [%keen ~ +.task] ?. ?=([%deep %nack *] task) task =/ msg =>([cue=cue arg=message-blob.task] ~+((cue arg))) =/ hed - ?: =(1 (end 0 nack-bone.task)) + ?. =(1 (end 0 nack-bone.task)) + %plea + ?: =(0 (end 0 (rsh 0 nack-bone.task))) + %boon + %naxplanation + [%deep %nack ship.task nack-bone.task ;;(message [hed msg])] + == + :: + ++ event-15-til-18-to-last + |= events=(qeu queued-event-15-to-18) + ^- (qeu queued-event) + %- ~(rep in events) + |= [e=queued-event-15-to-18 q=(qeu queued-event)] + %- ~(put to q) ^- queued-event + ?. ?=(%call -.e) e + =/ task=task-15-to-18 ((harden task-15-to-18) wrapped-task.e) + %= e + wrapped-task + ^- ^task + ?: ?=(%keen -.task) + [%keen ~ +.task] + ?. ?=([%deep %nack *] task) task + =/ msg =>([cue=cue arg=message-blob.task] ~+((cue arg))) + =/ hed + ?: =(1 (end 0 nack-bone.task)) ?: =(0 (end 0 (rsh 0 nack-bone.task))) %boon %naxplanation @@ -2662,7 +2711,7 @@ =/ [key=@ ,path] (~(got by chain.u.per) (slav %ud idx.wire)) =/ raw=@t (dy:crub:crypto key (slav %uv cyf.rest.path.s)) - =/ pax=path + =/ pax=path (stab raw) =; dat=(unit (unit page)) (emit duct [%give %near [ship.s pax] dat]) @@ -3236,7 +3285,7 @@ |= =path ^+ event-core =/ key=@ (shaz eny) :: TODO: check key width - =/ num=@ud + =/ num=@ud ?~ latest=(pry:on:chain chain.ames-state) 1 .+(key.u.latest) @@ -3282,7 +3331,7 @@ (emit duct %pass wir %a %keen ~ ship lav) :: XX: key exchange over ames forces all encrypted scries to be :: to a known peer - ?> ?=(~ sec) + ?> ?=(~ sec) %^ enqueue-alien-todo ship ship-state |= todos=alien-agenda todos(keens (~(put ju keens.todos) path duct)) @@ -5634,6 +5683,7 @@ == -- == + :: ++ state-18-to-19 |= old=ames-state-18 ^- ^ames-state @@ -5645,7 +5695,7 @@ %- ~(run by peers.old) |= s=ship-state-17 ^- ship-state - ?: ?=(%alien -.s) + ?: ?=(%alien -.s) %= s keens [keens.s ~] == @@ -5667,11 +5717,11 @@ |= b=message-blob ^- message =/ hed - ?: =(1 (end 0 bone)) - ?: =(0 (end 0 (rsh 0 bone))) - %boon - %naxplanation - %plea + ?. =(1 (end 0 bone)) + %plea + ?: =(0 (end 0 (rsh 0 bone))) + %boon + %naxplanation =/ msg =>([cue=cue arg=b] ~+((cue arg))) ;;(message [hed msg]) == == == @@ -5699,7 +5749,7 @@ [%fine %shut kef=@ enc=@ ~] =/ key-idx (slav %ud kef.tyl) =/ key (got:on:chain chain.ames-state (slav %ud kef.tyl)) - =/ pat=(unit path) + =/ pat=(unit path) (rush `@t`(dy:crub:crypto key.key (slav %uv enc.tyl)) stap) ?~ pat [~ ~] @@ -5709,7 +5759,7 @@ ~& key-validation-failed/[u.pat key-idx chain.ames-state] [~ ~] =/ res (rof [~ ~] /ames (as-omen:balk u.blk)) - ?~ res + ?~ res ~& %bailing-close [~ ~] ?~ u.res diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 9804203a9b..4ae9783a46 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -95,9 +95,9 @@ run-nonce=@t sub-nonce=_1 =stats - =bitt - =boat - =boar + $+(bitt =bitt) + $+(boat =boat) + $+(boar =boar) code=* agent=(each agent vase) =beak @@ -116,7 +116,7 @@ =/ frm (get-farm pos) ?~ frm ~ =. farm u.frm - |- + |- ?: ?=(%coop -.farm) ~[pos] %- zing @@ -285,7 +285,7 @@ =* tap-plot $ ?: ?=(%coop -.farm) %+ turn ~(tap by q.farm) - |= [=path =plot] + |= [=path =plot] [(welp wer path) plot] %+ welp ?~(p.farm ~ [wer u.p.farm]~) %- zing @@ -526,7 +526,7 @@ agent &+agent run-nonce (scot %uw (end 5 (shas %yoke-nonce eny))) :: - sky + sky ?~ yak *farm =| =farm =. farm (need (~(gas-hutch of-farm farm) ~(tap by cop.u.yak))) @@ -535,7 +535,7 @@ ?~ sky farm =. farm (need (~(put-grow of-farm farm) spur.i.sky [`bob.i.sky ~])) $(sky t.sky) - == + == :: =/ old mo-core =/ wag @@ -839,7 +839,7 @@ =/ =routes [disclosing=~ attributing=[our /]] =/ ap-core (ap-abed:ap agent.pole routes) ?+ rest.pole ~|(mo-handle-key-bad-wire/wire !!) - [%pug rest=*] + [%pug rest=*] ?> ?=([%ames %stub *] syn) ap-abet:(ap-stub:ap-core rest.rest.pole [num key]:syn) :: @@ -1170,7 +1170,7 @@ %u [%leave ~] == (mo-pass wire %g %deal [ship our /] agent-name deal) - + :: +mo-spew: handle request to set verbosity toggles on debug output :: ++ mo-spew @@ -1292,8 +1292,8 @@ ?+ syn ~|(weird-sign-ap-take-brood/-.syn !!) [%ames %boon *] =/ bud (fall ((soft fine-response) payload.syn) *fine-response) - |- - ?~ wis + |- + ?~ wis =. pen.yoke (~(del by pen.yoke) [ship t.wire]) ap-core ?~ bod.bud @@ -1426,7 +1426,7 @@ u.h *hutch =. hutch [.+(rev.hutch) num key] - =. sky.yoke + =. sky.yoke ?^ new-sky=(~(put-hutch of-farm sky.yoke) coop hutch) u.new-sky sky.yoke @@ -2429,7 +2429,7 @@ [%14 spore-14] [%15 spore-15] == - +$ spore-15 + +$ spore-15 $+ spore-15 $: system-duct=duct outstanding=(map [wire duct] (qeu remote-request)) @@ -2483,7 +2483,7 @@ old-state=[%| vase] =beak marks=(map duct mark) - sky=(map spur farm) + sky=(map spur plot) == == +$ spore-11 $: system-duct=duct @@ -2657,7 +2657,8 @@ |= [a=term e=egg-12] ^- egg-15 ?: ?=(%nuke -.e) e - !! :: e(sky [sky.e ken:*$>(%live egg-13)]) + ::!! + e(sky [sky.e ken:*$>(%live egg-15)]) == :: ++ spore-13-to-14 @@ -2715,10 +2716,10 @@ :- ~ =/ m ~(val by fan.p) %+ gas:on-path *_fan.p - %+ turn - ^- (list @) - =/ wit ~(wyt by fan.p) - ?: =(0 wit) ~ + %+ turn + ^- (list @) + =/ wit ~(wyt by fan.p) + ?: =(0 wit) ~ (gulf 1 wit) |= a=@ud [a (snag (dec a) m)] From d4eb4bd02260cf2e0ed86aef4f6c3eb32a15a0d7 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Mon, 5 Feb 2024 11:55:56 +0100 Subject: [PATCH 152/252] ames: step-by-step queued event migration --- pkg/arvo/sys/vane/ames.hoon | 156 ++++++++++++------------------------ 1 file changed, 52 insertions(+), 104 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index e286a0b287..0056b2c31e 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -776,18 +776,6 @@ cong=[msg=@ud mem=@ud] == :: -+$ queued-event-9 - $+ queued-event-9 - $% [%call =duct wrapped-task=(hobo task-9)] - [%take =wire =duct =sign] - == -:: -+$ task-9 - $+ task-9 - $% [%snub ships=(list ship)] :: introduced in ames-state %9, modified in %14 - $<(%snub task) - == -:: +$ ames-state-12 $+ ames-state-12 $: peers=(map ship ship-state-12) @@ -1291,30 +1279,17 @@ counter=@ud == :: -+$ queued-event-10-to-13 - $+ queued-event-10-to-13 - $% [%call =duct wrapped-task=(hobo task-10-to-13)] ++$ queued-event-9-til-13 + $+ queued-event-9-til-13 + $% [%call =duct wrapped-task=(hobo task-9-til-13)] [%take =wire =duct =sign] == :: -+$ task-10-to-13 - $+ task-10-to-13 ++$ task-9-til-13 + $+ task-9-til-13 $% [%kroc dry=?] :: introduced in state %10, modified in %15 [%snub ships=(list ship)] :: introduced in state %9, modified in %13 - $<(?(%snub %kroc) task) - == -:: -+$ queued-event-13 - $+ queued-event-13 - $% [%call =duct wrapped-task=(hobo task-13)] - [%take =wire =duct =sign] - == -:: -+$ task-13 - $+ task-13 - $% [%kroc dry=?] :: introduced in state %10, modified in %15 - [%keen spar] :: introduced in state %13, modified in %19 - $<(?(%keen %kroc) task) + $<(?(%snub %kroc %deep %keen) task) :: %deep/%keen introduced later == :: +$ queued-event-14 @@ -1328,7 +1303,7 @@ $% [%kroc dry=?] :: introduced in state %10, modified in %15 [%keen spar] :: introduced in state %13, modified in %19 deep-task-14 :: introduced in state %14, modified in %19 - $<(?(%keen %kroc %deep) task) + $<(?(%kroc %keen %deep) task) == :: +$ deep-task-14 @@ -1667,35 +1642,35 @@ == == $: %9 :: %snub introduced $% $: %larva - events=(qeu queued-event-9) + events=(qeu queued-event-9-til-13) state=ames-state-9 == [%adult state=ames-state-9] == == $: %10 :: %kroc introduced $% $: %larva - events=(qeu queued-event-10-to-13) + events=(qeu queued-event-9-til-13) state=ames-state-10 == [%adult state=ames-state-10] == == $: %11 $% $: %larva - events=(qeu queued-event-10-to-13) + events=(qeu queued-event-9-til-13) state=ames-state-11 == [%adult state=ames-state-11] == == $: %12 $% $: %larva - events=(qeu queued-event-10-to-13) + events=(qeu queued-event-9-til-13) state=ames-state-12 == [%adult state=ames-state-12] == == $: %13 :: %snub modified $% $: %larva :: %keen introduced - events=(qeu queued-event-13) + events=(qeu queued-event-9-til-13) state=ames-state-13 == [%adult state=ames-state-13] @@ -1803,7 +1778,10 @@ [%9 %larva *] ~> %slog.0^leaf/"ames: larva: load" =. cached-state `[%9 state.old] - =. queued-events (event-9-to-last events.old) + =. queued-events %- event-15-til-18-to-last + %- event-14-to-15 + %- event-9-til-13-to-14 + events.old larval-gate :: [%10 %adult *] @@ -1814,7 +1792,10 @@ [%10 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%10 state.old] - =. queued-events (event-10-til-13-to-last events.old) + =. queued-events %- event-15-til-18-to-last + %- event-14-to-15 + %- event-9-til-13-to-14 + events.old larval-gate :: [%11 %adult *] @@ -1825,7 +1806,10 @@ [%11 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%11 state.old] - =. queued-events (event-10-til-13-to-last events.old) + =. queued-events %- event-15-til-18-to-last + %- event-14-to-15 + %- event-9-til-13-to-14 + events.old larval-gate :: [%12 %adult *] @@ -1836,7 +1820,10 @@ [%12 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%12 state.old] - =. queued-events (event-10-til-13-to-last events.old) + =. queued-events %- event-15-til-18-to-last + %- event-14-to-15 + %- event-9-til-13-to-14 + events.old larval-gate :: [%13 %adult *] @@ -1847,7 +1834,10 @@ [%13 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%13 state.old] - =. queued-events (event-13-to-last events.old) + =. queued-events %- event-15-til-18-to-last + %- event-14-to-15 + %- event-9-til-13-to-14 + events.old larval-gate :: [%14 %adult *] @@ -1858,7 +1848,7 @@ [%14 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%14 state.old] - =. queued-events (event-14-to-last events.old) + =. queued-events (event-15-til-18-to-last (event-14-to-15 events.old)) larval-gate :: [%15 %adult *] @@ -1914,77 +1904,35 @@ larval-gate == :: - ++ event-9-to-last - |= events=(qeu queued-event-9) - ^- (qeu queued-event) - :: "+rep:in on a +qeu looks strange, but works fine." - :: + ++ event-9-til-13-to-14 + |= events=(qeu queued-event-9-til-13) + ^- (qeu queued-event-14) %- ~(rep in events) - |= [e=queued-event-9 q=(qeu queued-event)] - %- ~(put to q) ^- queued-event + |= [e=queued-event-9-til-13 q=(qeu queued-event-14)] + %- ~(put to q) ^- queued-event-14 ?. ?=(%call -.e) e - =/ task=task-9 ((harden task-9) wrapped-task.e) - %= e - wrapped-task ?.(?=(%snub -.task) task [%snub %deny ships.task]) - == - :: - ++ event-10-til-13-to-last - |= events=(qeu queued-event-10-to-13) - ^- (qeu queued-event) - %- ~(rep in events) - |= [e=queued-event-10-to-13 q=(qeu queued-event)] - %- ~(put to q) ^- queued-event - ?. ?=(%call -.e) e - =/ task=task-10-to-13 ((harden task-10-to-13) wrapped-task.e) + =/ task=task-9-til-13 ((harden task-9-til-13) wrapped-task.e) %= e wrapped-task + ^- task-14 ?+ -.task task %snub [%snub %deny ships.task] - %kroc [%kroc ~] == == :: - ++ event-13-to-last - |= events=(qeu queued-event-13) - ^- (qeu queued-event) - %- ~(rep in events) - |= [e=queued-event-13 q=(qeu queued-event)] - %- ~(put to q) ^- queued-event - ?. ?=(%call -.e) e - =/ task=task-13 ((harden task-13) wrapped-task.e) - %= e - wrapped-task - ^- ^task - ?+ -.task task - %kroc [%kroc ~] - %keen [%keen ~ +.task] - == - == - :: - ++ event-14-to-last + ++ event-14-to-15 |= events=(qeu queued-event-14) - ^- (qeu queued-event) + ^- (qeu queued-event-15-to-18) %- ~(rep in events) - |= [e=queued-event-14 q=(qeu queued-event)] - %- ~(put to q) ^- queued-event + |= [e=queued-event-14 q=(qeu queued-event-15-to-18)] + %- ~(put to q) ^- queued-event-15-to-18 ?. ?=(%call -.e) e =/ task=task-14 ((harden task-14) wrapped-task.e) %= e wrapped-task - ^- ^task - ?: ?=(%kroc -.task) - [%kroc ~] - ?: ?=(%keen -.task) - [%keen ~ +.task] - ?. ?=([%deep %nack *] task) task - =/ msg =>([cue=cue arg=message-blob.task] ~+((cue arg))) - =/ hed - ?. =(1 (end 0 nack-bone.task)) - %plea - ?: =(0 (end 0 (rsh 0 nack-bone.task))) - %boon - %naxplanation - [%deep %nack ship.task nack-bone.task ;;(message [hed msg])] + ^- task-15-to-18 + ?. ?=(%kroc -.task) task + [%kroc ~] == :: ++ event-15-til-18-to-last @@ -2003,11 +1951,11 @@ ?. ?=([%deep %nack *] task) task =/ msg =>([cue=cue arg=message-blob.task] ~+((cue arg))) =/ hed - ?: =(1 (end 0 nack-bone.task)) - ?: =(0 (end 0 (rsh 0 nack-bone.task))) - %boon - %naxplanation - %plea + ?. =(1 (end 0 nack-bone.task)) + %plea + ?: =(0 (end 0 (rsh 0 nack-bone.task))) + %boon + %naxplanation [%deep %nack ship.task nack-bone.task ;;(message [hed msg])] == -- From 07ecef345b1db101ab1377c9ee28422263256d82 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Mon, 5 Feb 2024 15:05:55 +0100 Subject: [PATCH 153/252] ames: fix emitting moves on +molt --- pkg/arvo/sys/vane/ames.hoon | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index a3eeaccb37..de302202fe 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -1990,13 +1990,9 @@ 15+(state-14-to-15:load:adult-core +.u.cached-state) =? u.cached-state ?=(%15 -.u.cached-state) 16+(state-15-to-16:load:adult-core +.u.cached-state) - =? u.cached-state ?=(%16 -.u.cached-state) - 17+(state-16-to-17:load:adult-core +.u.cached-state) =^ moz u.cached-state - ?. ?=(%17 -.u.cached-state) [~ u.cached-state] - :_ [%18 +.u.cached-state] - ~> %slog.0^leaf/"ames: init dead flow consolidation timer" - :- [[/ames]~ %pass /dead-flow %b %wait `@da`(add now ~m2)] + ?. ?=(%16 -.u.cached-state) [~ u.cached-state] + :_ 17+(state-16-to-17:load:adult-core +.u.cached-state) ?^ moz moz :: if we have just added the timer in state-7-to-8, skip =; recork-timer=(list [@da duct]) ?^ recork-timer ~ @@ -2005,7 +2001,7 @@ %+ skim ;; (list [@da duct]) =< q.q %- need %- need - (rof [~ ~] /ames %bx [[our %$ da+now] /debug/timers]) + (rof ~ /ames %bx [[our %$ da+now] /debug/timers]) |=([@da =duct] ?=([[%ames %recork *] *] duct)) :: =^ moz u.cached-state From 64eacd50dece50e673fd5ad8ea193f613f81da60 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Mon, 5 Feb 2024 15:40:17 +0100 Subject: [PATCH 154/252] ames: fix check fro %kroc task modification --- pkg/arvo/sys/vane/ames.hoon | 104 +++++++++++++++++++----------------- 1 file changed, 54 insertions(+), 50 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index de302202fe..7c75bf9f0d 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -1287,20 +1287,20 @@ :: +$ task-9-til-13 $+ task-9-til-13 - $% [%kroc dry=?] :: introduced in state %10, modified in %15 + $% [%kroc dry=?] :: introduced in state %10, modified in %16 [%snub ships=(list ship)] :: introduced in state %9, modified in %13 $<(?(%snub %kroc %deep %keen) task) :: %deep/%keen introduced later == :: -+$ queued-event-14 - $+ queued-event-14 - $% [%call =duct wrapped-task=(hobo task-14)] ++$ queued-event-14-and-15 + $+ queued-event-14-and-15 + $% [%call =duct wrapped-task=(hobo task-14-and-15)] [%take =wire =duct =sign] == :: -+$ task-14 - $+ task-14 - $% [%kroc dry=?] :: introduced in state %10, modified in %15 ++$ task-14-and-15 + $+ task-14-and-15 + $% [%kroc dry=?] :: introduced in state %10, modified in %16 [%keen spar] :: introduced in state %13, modified in %19 deep-task-14 :: introduced in state %14, modified in %19 $<(?(%kroc %keen %deep) task) @@ -1315,14 +1315,14 @@ [%kill =ship =bone] == == :: -+$ queued-event-15-to-18 - $+ queued-event-15-to-18 - $% [%call =duct wrapped-task=(hobo task-15-to-18)] ++$ queued-event-16-to-18 + $+ queued-event-16-to-18 + $% [%call =duct wrapped-task=(hobo task-16-to-18)] [%take =wire =duct =sign] == :: -+$ task-15-to-18 - $+ task-15-to-18 ++$ task-16-to-18 + $+ task-16-to-18 $% [%keen spar] :: introduced in state %13, modified in %19 deep-task-14 :: introduced in state %14, modified in %19 $<(?(%keen %deep) task) @@ -1677,35 +1677,35 @@ == == $: %14 :: %deep introduced $% $: %larva - events=(qeu queued-event-14) + events=(qeu queued-event-14-and-15) state=ames-state-14 == [%adult state=ames-state-14] == == - $: %15 :: %kroc modified + $: %15 $% $: %larva - events=(qeu queued-event-15-to-18) + events=(qeu queued-event-14-and-15) state=ames-state-15 == [%adult state=ames-state-15] == == - $: %16 + $: %16 :: %kroc modified $% $: %larva - events=(qeu queued-event-15-to-18) + events=(qeu queued-event-16-to-18) state=ames-state-16 == [%adult state=ames-state-16] == == $: %17 $% $: %larva - events=(qeu queued-event-15-to-18) + events=(qeu queued-event-16-to-18) state=ames-state-17 == [%adult state=ames-state-17] == == $: %18 $% $: %larva - events=(qeu queued-event-15-to-18) + events=(qeu queued-event-16-to-18) state=ames-state-18 == [%adult state=ames-state-18] @@ -1778,8 +1778,8 @@ [%9 %larva *] ~> %slog.0^leaf/"ames: larva: load" =. cached-state `[%9 state.old] - =. queued-events %- event-15-til-18-to-last - %- event-14-to-15 + =. queued-events %- event-16-til-18-to-last + %- event-14-and-15-to-16 %- event-9-til-13-to-14 events.old larval-gate @@ -1792,8 +1792,8 @@ [%10 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%10 state.old] - =. queued-events %- event-15-til-18-to-last - %- event-14-to-15 + =. queued-events %- event-16-til-18-to-last + %- event-14-and-15-to-16 %- event-9-til-13-to-14 events.old larval-gate @@ -1806,8 +1806,8 @@ [%11 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%11 state.old] - =. queued-events %- event-15-til-18-to-last - %- event-14-to-15 + =. queued-events %- event-16-til-18-to-last + %- event-14-and-15-to-16 %- event-9-til-13-to-14 events.old larval-gate @@ -1820,8 +1820,8 @@ [%12 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%12 state.old] - =. queued-events %- event-15-til-18-to-last - %- event-14-to-15 + =. queued-events %- event-16-til-18-to-last + %- event-14-and-15-to-16 %- event-9-til-13-to-14 events.old larval-gate @@ -1834,8 +1834,8 @@ [%13 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%13 state.old] - =. queued-events %- event-15-til-18-to-last - %- event-14-to-15 + =. queued-events %- event-16-til-18-to-last + %- event-14-and-15-to-16 %- event-9-til-13-to-14 events.old larval-gate @@ -1848,7 +1848,9 @@ [%14 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%14 state.old] - =. queued-events (event-15-til-18-to-last (event-14-to-15 events.old)) + =. queued-events %- event-16-til-18-to-last + %- event-14-and-15-to-16 + events.old larval-gate :: [%15 %adult *] @@ -1859,7 +1861,9 @@ [%15 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%15 state.old] - =. queued-events (event-15-til-18-to-last events.old) + =. queued-events %- event-16-til-18-to-last + %- event-14-and-15-to-16 + events.old larval-gate :: [%16 %adult *] @@ -1870,7 +1874,7 @@ [%16 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%16 state.old] - =. queued-events (event-15-til-18-to-last events.old) + =. queued-events (event-16-til-18-to-last events.old) larval-gate :: [%17 %adult *] @@ -1881,7 +1885,7 @@ [%17 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%17 state.old] - =. queued-events (event-15-til-18-to-last events.old) + =. queued-events (event-16-til-18-to-last events.old) larval-gate :: [%18 %adult *] @@ -1892,7 +1896,7 @@ [%18 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. cached-state `[%18 state.old] - =. queued-events (event-15-til-18-to-last events.old) + =. queued-events (event-16-til-18-to-last events.old) larval-gate :: [%19 %adult *] (load:adult-core %19 state.old) @@ -1906,43 +1910,43 @@ :: ++ event-9-til-13-to-14 |= events=(qeu queued-event-9-til-13) - ^- (qeu queued-event-14) + ^- (qeu queued-event-14-and-15) %- ~(rep in events) - |= [e=queued-event-9-til-13 q=(qeu queued-event-14)] - %- ~(put to q) ^- queued-event-14 + |= [e=queued-event-9-til-13 q=(qeu queued-event-14-and-15)] + %- ~(put to q) ^- queued-event-14-and-15 ?. ?=(%call -.e) e =/ task=task-9-til-13 ((harden task-9-til-13) wrapped-task.e) %= e wrapped-task - ^- task-14 + ^- task-14-and-15 ?+ -.task task %snub [%snub %deny ships.task] == == :: - ++ event-14-to-15 - |= events=(qeu queued-event-14) - ^- (qeu queued-event-15-to-18) + ++ event-14-and-15-to-16 + |= events=(qeu queued-event-14-and-15) + ^- (qeu queued-event-16-to-18) %- ~(rep in events) - |= [e=queued-event-14 q=(qeu queued-event-15-to-18)] - %- ~(put to q) ^- queued-event-15-to-18 + |= [e=queued-event-14-and-15 q=(qeu queued-event-16-to-18)] + %- ~(put to q) ^- queued-event-16-to-18 ?. ?=(%call -.e) e - =/ task=task-14 ((harden task-14) wrapped-task.e) + =/ task=task-14-and-15 ((harden task-14-and-15) wrapped-task.e) %= e wrapped-task - ^- task-15-to-18 + ^- task-16-to-18 ?. ?=(%kroc -.task) task [%kroc ~] == :: - ++ event-15-til-18-to-last - |= events=(qeu queued-event-15-to-18) + ++ event-16-til-18-to-last + |= events=(qeu queued-event-16-to-18) ^- (qeu queued-event) %- ~(rep in events) - |= [e=queued-event-15-to-18 q=(qeu queued-event)] + |= [e=queued-event-16-to-18 q=(qeu queued-event)] %- ~(put to q) ^- queued-event ?. ?=(%call -.e) e - =/ task=task-15-to-18 ((harden task-15-to-18) wrapped-task.e) + =/ task=task-16-to-18 ((harden task-16-to-18) wrapped-task.e) %= e wrapped-task ^- ^task @@ -2001,7 +2005,7 @@ %+ skim ;; (list [@da duct]) =< q.q %- need %- need - (rof ~ /ames %bx [[our %$ da+now] /debug/timers]) + (rof [~ ~] /ames %bx [[our %$ da+now] /debug/timers]) |=([@da =duct] ?=([[%ames %recork *] *] duct)) :: =^ moz u.cached-state From 5eab2285e9991457df5c2db3661449235e5f8a50 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Tue, 6 Feb 2024 10:58:43 +0100 Subject: [PATCH 155/252] ames: correct check for %snub task update --- pkg/arvo/sys/vane/ames.hoon | 202 ++++++++++++++++++------------------ pkg/arvo/sys/vane/gall.hoon | 6 +- 2 files changed, 104 insertions(+), 104 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 7c75bf9f0d..584b4fa41c 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -1279,28 +1279,28 @@ counter=@ud == :: -+$ queued-event-9-til-13 - $+ queued-event-9-til-13 - $% [%call =duct wrapped-task=(hobo task-9-til-13)] ++$ queued-event-9-til-11 + $+ queued-event-9-til-11 + $% [%call =duct wrapped-task=(hobo task-9-til-11)] [%take =wire =duct =sign] == :: -+$ task-9-til-13 - $+ task-9-til-13 - $% [%kroc dry=?] :: introduced in state %10, modified in %16 - [%snub ships=(list ship)] :: introduced in state %9, modified in %13 ++$ task-9-til-11 + $+ task-9-til-11 + $% [%kroc dry=?] :: introduced in state %10, modified in %17 + [%snub ships=(list ship)] :: introduced in state %9, modified in %11 $<(?(%snub %kroc %deep %keen) task) :: %deep/%keen introduced later == :: -+$ queued-event-14-and-15 - $+ queued-event-14-and-15 - $% [%call =duct wrapped-task=(hobo task-14-and-15)] ++$ queued-event-12-til-16 + $+ queued-event-12-til-16 + $% [%call =duct wrapped-task=(hobo task-12-til-16)] [%take =wire =duct =sign] == :: -+$ task-14-and-15 - $+ task-14-and-15 - $% [%kroc dry=?] :: introduced in state %10, modified in %16 ++$ task-12-til-16 + $+ task-12-til-16 + $% [%kroc dry=?] :: introduced in state %10, modified in %17 [%keen spar] :: introduced in state %13, modified in %19 deep-task-14 :: introduced in state %14, modified in %19 $<(?(%kroc %keen %deep) task) @@ -1315,14 +1315,14 @@ [%kill =ship =bone] == == :: -+$ queued-event-16-to-18 - $+ queued-event-16-to-18 - $% [%call =duct wrapped-task=(hobo task-16-to-18)] ++$ queued-event-17-and-18 + $+ queued-event-17-and-18 + $% [%call =duct wrapped-task=(hobo task-16-and-18)] [%take =wire =duct =sign] == :: -+$ task-16-to-18 - $+ task-16-to-18 ++$ task-16-and-18 + $+ task-16-and-18 $% [%keen spar] :: introduced in state %13, modified in %19 deep-task-14 :: introduced in state %14, modified in %19 $<(?(%keen %deep) task) @@ -1642,70 +1642,70 @@ == == $: %9 :: %snub introduced $% $: %larva - events=(qeu queued-event-9-til-13) + events=(qeu queued-event-9-til-11) state=ames-state-9 == [%adult state=ames-state-9] == == $: %10 :: %kroc introduced $% $: %larva - events=(qeu queued-event-9-til-13) + events=(qeu queued-event-9-til-11) state=ames-state-10 == [%adult state=ames-state-10] == == $: %11 $% $: %larva - events=(qeu queued-event-9-til-13) + events=(qeu queued-event-9-til-11) state=ames-state-11 == [%adult state=ames-state-11] == == - $: %12 + $: %12 :: %snub modified $% $: %larva - events=(qeu queued-event-9-til-13) + events=(qeu queued-event-12-til-16) state=ames-state-12 == [%adult state=ames-state-12] == == - $: %13 :: %snub modified + $: %13 $% $: %larva :: %keen introduced - events=(qeu queued-event-9-til-13) + events=(qeu queued-event-12-til-16) state=ames-state-13 == [%adult state=ames-state-13] == == $: %14 :: %deep introduced $% $: %larva - events=(qeu queued-event-14-and-15) + events=(qeu queued-event-12-til-16) state=ames-state-14 == [%adult state=ames-state-14] == == $: %15 $% $: %larva - events=(qeu queued-event-14-and-15) + events=(qeu queued-event-12-til-16) state=ames-state-15 == [%adult state=ames-state-15] == == - $: %16 :: %kroc modified + $: %16 $% $: %larva - events=(qeu queued-event-16-to-18) + events=(qeu queued-event-12-til-16) state=ames-state-16 == [%adult state=ames-state-16] == == - $: %17 + $: %17 :: %kroc modified $% $: %larva - events=(qeu queued-event-16-to-18) + events=(qeu queued-event-17-and-18) state=ames-state-17 == [%adult state=ames-state-17] == == $: %18 $% $: %larva - events=(qeu queued-event-16-to-18) + events=(qeu queued-event-17-and-18) state=ames-state-18 == [%adult state=ames-state-18] @@ -1728,225 +1728,225 @@ :: [%5 %adult *] =. cached-state `[%5 state.old] - ~> %slog.0^leaf/"ames: larva reload" + ~> %slog.0^leaf/"ames: larva %5 reload" larval-gate :: [%5 %larva *] - ~> %slog.0^leaf/"ames: larva: load" + ~> %slog.0^leaf/"ames: larva %5 load" =. cached-state `[%5 state.old] =. queued-events events.old larval-gate :: [%6 %adult *] =. cached-state `[%6 state.old] - ~> %slog.0^leaf/"ames: larva reload" + ~> %slog.0^leaf/"ames: larva %6 reload" larval-gate :: [%6 %larva *] - ~> %slog.0^leaf/"ames: larva: load" + ~> %slog.0^leaf/"ames: larva %6 load" =. cached-state `[%6 state.old] =. queued-events events.old larval-gate :: [%7 %adult *] =. cached-state `[%7 state.old] - ~> %slog.0^leaf/"ames: larva reload" + ~> %slog.0^leaf/"ames: larva %7 reload" larval-gate :: [%7 %larva *] - ~> %slog.0^leaf/"ames: larva: load" + ~> %slog.0^leaf/"ames: larva %7 load" =. queued-events events.old =. cached-state `[%7 state.old] larval-gate :: [%8 %adult *] =. cached-state `[%8 state.old] - ~> %slog.0^leaf/"ames: larva reload" + ~> %slog.0^leaf/"ames: larva %8 reload" larval-gate :: [%8 %larva *] - ~> %slog.0^leaf/"ames: larva: load" + ~> %slog.0^leaf/"ames: larva %8 load" =. cached-state `[%8 state.old] =. queued-events events.old larval-gate :: [%9 %adult *] =. cached-state `[%9 state.old] - ~> %slog.0^leaf/"ames: larva reload" + ~> %slog.0^leaf/"ames: larva %9 reload" larval-gate :: [%9 %larva *] - ~> %slog.0^leaf/"ames: larva: load" + ~> %slog.0^leaf/"ames: larva %9 load" =. cached-state `[%9 state.old] - =. queued-events %- event-16-til-18-to-last - %- event-14-and-15-to-16 - %- event-9-til-13-to-14 + =. queued-events %- event-17-and-18-to-last + %- event-12-til-16-to-17 + %- event-9-til-11-to-12 events.old larval-gate :: [%10 %adult *] =. cached-state `[%10 state.old] - ~> %slog.0^leaf/"ames: larva reload" + ~> %slog.0^leaf/"ames: larva %10 reload" larval-gate :: [%10 %larva *] - ~> %slog.1^leaf/"ames: larva: load" + ~> %slog.1^leaf/"ames: larva %10 load" =. cached-state `[%10 state.old] - =. queued-events %- event-16-til-18-to-last - %- event-14-and-15-to-16 - %- event-9-til-13-to-14 + =. queued-events %- event-17-and-18-to-last + %- event-12-til-16-to-17 + %- event-9-til-11-to-12 events.old larval-gate :: [%11 %adult *] =. cached-state `[%11 state.old] - ~> %slog.0^leaf/"ames: larva reload" + ~> %slog.0^leaf/"ames: larva %11 reload" larval-gate :: [%11 %larva *] - ~> %slog.1^leaf/"ames: larva: load" + ~> %slog.1^leaf/"ames: larva %11 load" =. cached-state `[%11 state.old] - =. queued-events %- event-16-til-18-to-last - %- event-14-and-15-to-16 - %- event-9-til-13-to-14 + =. queued-events %- event-17-and-18-to-last + %- event-12-til-16-to-17 + %- event-9-til-11-to-12 events.old larval-gate :: [%12 %adult *] =. cached-state `[%12 state.old] - ~> %slog.0^leaf/"ames: larva reload" + ~> %slog.0^leaf/"ames: larva %12 reload" larval-gate :: [%12 %larva *] - ~> %slog.1^leaf/"ames: larva: load" + ~> %slog.1^leaf/"ames: larva %12 load" =. cached-state `[%12 state.old] - =. queued-events %- event-16-til-18-to-last - %- event-14-and-15-to-16 - %- event-9-til-13-to-14 + =. queued-events %- event-17-and-18-to-last + %- event-12-til-16-to-17 events.old larval-gate :: [%13 %adult *] =. cached-state `[%13 state.old] - ~> %slog.0^leaf/"ames: larva reload" + ~> %slog.0^leaf/"ames: larva %13 reload" larval-gate :: [%13 %larva *] - ~> %slog.1^leaf/"ames: larva: load" + ~> %slog.1^leaf/"ames: larva %13 load" =. cached-state `[%13 state.old] - =. queued-events %- event-16-til-18-to-last - %- event-14-and-15-to-16 - %- event-9-til-13-to-14 + =. queued-events %- event-17-and-18-to-last + %- event-12-til-16-to-17 events.old larval-gate :: [%14 %adult *] =. cached-state `[%14 state.old] - ~> %slog.0^leaf/"ames: larva reload" + ~> %slog.0^leaf/"ames: larva %14 reload" larval-gate :: [%14 %larva *] - ~> %slog.1^leaf/"ames: larva: load" + ~> %slog.1^leaf/"ames: larva %14 load" =. cached-state `[%14 state.old] - =. queued-events %- event-16-til-18-to-last - %- event-14-and-15-to-16 + =. queued-events %- event-17-and-18-to-last + %- event-12-til-16-to-17 events.old larval-gate :: [%15 %adult *] =. cached-state `[%15 state.old] - ~> %slog.0^leaf/"ames: larva reload" + ~> %slog.0^leaf/"ames: larva %15 reload" larval-gate :: [%15 %larva *] - ~> %slog.1^leaf/"ames: larva: load" + ~> %slog.1^leaf/"ames: larva %15 load" =. cached-state `[%15 state.old] - =. queued-events %- event-16-til-18-to-last - %- event-14-and-15-to-16 + =. queued-events %- event-17-and-18-to-last + %- event-12-til-16-to-17 events.old larval-gate :: [%16 %adult *] =. cached-state `[%16 state.old] - ~> %slog.0^leaf/"ames: larva reload" + ~> %slog.0^leaf/"ames: larva %16 reload" larval-gate :: [%16 %larva *] - ~> %slog.1^leaf/"ames: larva: load" + ~> %slog.1^leaf/"ames: larva %16 load" =. cached-state `[%16 state.old] - =. queued-events (event-16-til-18-to-last events.old) + =. queued-events %- event-17-and-18-to-last + %- event-12-til-16-to-17 + events.old larval-gate :: [%17 %adult *] =. cached-state `[%17 state.old] - ~> %slog.0^leaf/"ames: larva reload" + ~> %slog.0^leaf/"ames: larva %17 reload" larval-gate :: [%17 %larva *] - ~> %slog.1^leaf/"ames: larva: load" + ~> %slog.1^leaf/"ames: larva %17 load" =. cached-state `[%17 state.old] - =. queued-events (event-16-til-18-to-last events.old) + =. queued-events (event-17-and-18-to-last events.old) larval-gate :: [%18 %adult *] =. cached-state `[%18 state.old] - ~> %slog.0^leaf/"ames: larva reload" + ~> %slog.0^leaf/"ames: larva %18 reload" larval-gate :: [%18 %larva *] - ~> %slog.1^leaf/"ames: larva: load" + ~> %slog.1^leaf/"ames: larva %18 load" =. cached-state `[%18 state.old] - =. queued-events (event-16-til-18-to-last events.old) + =. queued-events (event-17-and-18-to-last events.old) larval-gate :: [%19 %adult *] (load:adult-core %19 state.old) :: [%19 %larva *] - ~> %slog.1^leaf/"ames: larva: load" + ~> %slog.1^leaf/"ames: larva %19 load" =. queued-events events.old =. adult-gate (load:adult-core %19 state.old) larval-gate == :: - ++ event-9-til-13-to-14 - |= events=(qeu queued-event-9-til-13) - ^- (qeu queued-event-14-and-15) + ++ event-9-til-11-to-12 + |= events=(qeu queued-event-9-til-11) + ^- (qeu queued-event-12-til-16) %- ~(rep in events) - |= [e=queued-event-9-til-13 q=(qeu queued-event-14-and-15)] - %- ~(put to q) ^- queued-event-14-and-15 + |= [e=queued-event-9-til-11 q=(qeu queued-event-12-til-16)] + %- ~(put to q) ^- queued-event-12-til-16 ?. ?=(%call -.e) e - =/ task=task-9-til-13 ((harden task-9-til-13) wrapped-task.e) + =/ task=task-9-til-11 ((harden task-9-til-11) wrapped-task.e) %= e wrapped-task - ^- task-14-and-15 + ^- task-12-til-16 ?+ -.task task %snub [%snub %deny ships.task] == == :: - ++ event-14-and-15-to-16 - |= events=(qeu queued-event-14-and-15) - ^- (qeu queued-event-16-to-18) + ++ event-12-til-16-to-17 + |= events=(qeu queued-event-12-til-16) + ^- (qeu queued-event-17-and-18) %- ~(rep in events) - |= [e=queued-event-14-and-15 q=(qeu queued-event-16-to-18)] - %- ~(put to q) ^- queued-event-16-to-18 + |= [e=queued-event-12-til-16 q=(qeu queued-event-17-and-18)] + %- ~(put to q) ^- queued-event-17-and-18 ?. ?=(%call -.e) e - =/ task=task-14-and-15 ((harden task-14-and-15) wrapped-task.e) + =/ task=task-12-til-16 ((harden task-12-til-16) wrapped-task.e) %= e wrapped-task - ^- task-16-to-18 + ^- task-16-and-18 ?. ?=(%kroc -.task) task [%kroc ~] == :: - ++ event-16-til-18-to-last - |= events=(qeu queued-event-16-to-18) + ++ event-17-and-18-to-last + |= events=(qeu queued-event-17-and-18) ^- (qeu queued-event) %- ~(rep in events) - |= [e=queued-event-16-to-18 q=(qeu queued-event)] + |= [e=queued-event-17-and-18 q=(qeu queued-event)] %- ~(put to q) ^- queued-event ?. ?=(%call -.e) e - =/ task=task-16-to-18 ((harden task-16-to-18) wrapped-task.e) + =/ task=task-16-and-18 ((harden task-16-and-18) wrapped-task.e) %= e wrapped-task ^- ^task diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 4ae9783a46..e22dd2a919 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -95,9 +95,9 @@ run-nonce=@t sub-nonce=_1 =stats - $+(bitt =bitt) - $+(boat =boat) - $+(boar =boar) + =bitt + =boat + =boar code=* agent=(each agent vase) =beak From cc8810f799f7e03629d856d7e78f0cd02f1b3e65 Mon Sep 17 00:00:00 2001 From: youfoundron Date: Tue, 6 Feb 2024 16:06:16 -0800 Subject: [PATCH 156/252] replace %garden with %landscape within +vats hint --- pkg/arvo/gen/vat.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/gen/vat.hoon b/pkg/arvo/gen/vat.hoon index bae590e368..4a5341ec5b 100644 --- a/pkg/arvo/gen/vat.hoon +++ b/pkg/arvo/gen/vat.hoon @@ -2,6 +2,6 @@ :- %say |= [[now=@da eny=@uvJ bec=beak] [syd=desk ~] verb=_&] :* %tang - leaf+"Notice: +vat is deprecated. use +vats which now takes one or more desks as arguments. e.g. '+vats %base %garden'" + leaf+"Notice: +vat is deprecated. use +vats which now takes one or more desks as arguments. e.g. '+vats %base %landscape'" (report-vat (report-prep p.bec now) p.bec now syd verb) == From e0a26622919bf8e22af360c9b53e2ec291682631 Mon Sep 17 00:00:00 2001 From: fang Date: Thu, 8 Feb 2024 12:38:27 +0100 Subject: [PATCH 157/252] eyre: dynamic responses for empty cache entries If the cache entry for any given url was cleared, eyre would recognize that an entry was bound at some point in the past, and serve a 404, instead of falling back to the normal, cacheless, dynamic response. Here, we make eyre serve from the cache only if there is a full cache entry for the url, and have it proceed into normal request handling logic otherwise. This way, setting a cached response for some url no longer means giving up dynamic responses on that url for the rest of time. Recent versions of vere exhibit the same behavior. As such, in practice, this code won't get hit without a similarly-patched version of the runtime. --- pkg/arvo/sys/vane/eyre.hoon | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index 9485f7f2a6..9fe28a34c7 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -907,11 +907,12 @@ :: ?: =('/_~_/' (end [3 5] url.request)) (handle-http-scry authenticated request) - :: handle requests to the cache + :: handle requests to the cache, if a non-empty entry exists :: - =/ entry (~(get by cache.state) url.request) - ?: &(?=(^ entry) ?=(%'GET' method.request)) - (handle-cache-req authenticated request val.u.entry) + =/ cached=(unit [aeon=@ud val=(unit cache-entry)]) + (~(get by cache.state) url.request) + ?: &(?=([~ @ ^] cached) ?=(%'GET' method.request)) + (handle-cache-req authenticated request u.val.u.cached) :: ?- -.action %gen @@ -1053,13 +1054,11 @@ :: +handle-cache-req: respond with cached value, 404 or 500 :: ++ handle-cache-req - |= [authenticated=? =request:http entry=(unit cache-entry)] + |= [authenticated=? =request:http entry=cache-entry] |^ ^- (quip move server-state) - ?~ entry - (error-response 404 "cache entry for that binding was deleted") - ?: &(auth.u.entry !authenticated) + ?: &(auth.entry !authenticated) (error-response 403 ~) - =* body body.u.entry + =* body body.entry ?- -.body %payload %- handle-response @@ -4144,7 +4143,7 @@ ?~ entry=(~(get by cache) u.url) ~ ?. =(u.aeon aeon.u.entry) ~ ?~ val=val.u.entry ~ - ?: &(auth.u.val !=([~ ~] lyc)) ~ + ?: &(auth.u.val !=([~ ~] lyc)) ~ ``noun+!>(u.val) :: private endpoints ?. ?=([~ ~] lyc) ~ From 3a4c1e93aa38d291e9d546528617e07fd7549d2c Mon Sep 17 00:00:00 2001 From: fang Date: Thu, 15 Feb 2024 10:44:01 +0100 Subject: [PATCH 158/252] gall: respond to /whey scries (for |mass) The restructuring in #6852 put everything under versioned scry paths. Arvo remains none the wiser and still happily scries for /whey, without a leading version number, resulting in loss of detail for gall's section in |mass output. Here, we simply slap the current version number in front of the /whey scry path, to get it to resolve. --- pkg/arvo/sys/vane/gall.hoon | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index e22dd2a919..2c91a92324 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -2854,6 +2854,7 @@ ~ ``case/!>(ud/key.u.las) :: + =? path =(/whey path) /1/whey ?: &(?=(%x care) ?=([%'1' *] path)) => .(path t.path) ?. =(p.bem our) ~ From 7733e13700fa23908f30d9370b5df09462e3a40e Mon Sep 17 00:00:00 2001 From: fang Date: Thu, 15 Feb 2024 12:27:50 +0100 Subject: [PATCH 159/252] eyre: improve cache visibility Include the cached responses in their own named mass section, and add a scry endpoint that produces the entire current cache. A follow-up commit will leverage this for showing it in the debug dashboard. --- pkg/arvo/sys/vane/eyre.hoon | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index 9485f7f2a6..78b5b2f1ad 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -4144,7 +4144,7 @@ ?~ entry=(~(get by cache) u.url) ~ ?. =(u.aeon aeon.u.entry) ~ ?~ val=val.u.entry ~ - ?: &(auth.u.val !=([~ ~] lyc)) ~ + ?: &(auth.u.val !=([~ ~] lyc)) ~ ``noun+!>(u.val) :: private endpoints ?. ?=([~ ~] lyc) ~ @@ -4153,6 +4153,7 @@ ?+ tyl ~ [%$ %whey ~] =- ``mass+!>(`(list mass)`-) :~ bindings+&+bindings.server-state.ax + cache+&+cache.server-state.ax auth+&+auth.server-state.ax connections+&+connections.server-state.ax channels+&+channel-state.server-state.ax @@ -4189,6 +4190,7 @@ ?. ?=(%$ ren) ~ ?+ syd ~ %bindings ``noun+!>(bindings.server-state.ax) + %cache ``noun+!>(cache.server-state.ax) %connections ``noun+!>(connections.server-state.ax) %authentication-state ``noun+!>(auth.server-state.ax) %channel-state ``noun+!>(channel-state.server-state.ax) From 3ff4782d3b216d67e6e411c80ed6529146403568 Mon Sep 17 00:00:00 2001 From: fang Date: Thu, 15 Feb 2024 12:38:29 +0100 Subject: [PATCH 160/252] dbug: support the eyre response cache Now support scrying into eyre to retrieve & display its known cache entries. Also adds a little extra logic that lets the dbug agent send cache clear commands on the user's behalf. To avoid needlessly long scrolling, we add an "open" property to the debug dashboard's SearchableList, which can be set to false to collapse the list by default. This is useful for eyre's debug page, which commonly contains very long lists. --- pkg/arvo/app/dbug.hoon | 46 ++- pkg/arvo/app/debug/js/index.js | 320 +++++++++++------- pkg/interface/dbug/src/js/api.js | 12 + pkg/interface/dbug/src/js/components/root.js | 1 + .../dbug/src/js/components/searchable-list.js | 5 +- pkg/interface/dbug/src/js/reducers/local.js | 8 + pkg/interface/dbug/src/js/store.js | 1 + pkg/interface/dbug/src/js/views/eyre.js | 50 ++- 8 files changed, 313 insertions(+), 130 deletions(-) diff --git a/pkg/arvo/app/dbug.hoon b/pkg/arvo/app/dbug.hoon index 971e956f10..5f76684b27 100644 --- a/pkg/arvo/app/dbug.hoon +++ b/pkg/arvo/app/dbug.hoon @@ -42,8 +42,8 @@ ++ on-poke |= [=mark =vase] ^- (quip card _this) + ?> =(our src):bowl ?: ?=(%noun mark) - ?> (team:title [our src]:bowl) =/ code !<((unit @t) vase) =/ msg=tape ?~ code @@ -55,6 +55,13 @@ """ %- (slog leaf+msg ~) [~ this(passcode code)] + ?: ?=(%json mark) + =/ jon=json !<(json vase) + =, dejs:format + =/ cmd + ((of clear-eyre-cache+(ot url+so ~) ~) jon) + ?> ?=(%clear-eyre-cache -.cmd) + [[%pass /cmd %arvo %e %set-response +.cmd ~]~ this] ?. ?=(%handle-http-request mark) (on-poke:def mark vase) =+ !<([eyre-id=@ta =inbound-request:eyre] vase) @@ -315,6 +322,19 @@ :~ 'location'^s+(cat 3 (fall site '*') (spat path)) 'action'^(render-action:v-eyre action) == + :: + :: /eyre/cache.json + :: + [%eyre %cache ~] + %- some + :- %a + %+ turn (sort ~(tap by cache:v-eyre) aor) + |= [url=@t aeon=@ud val=(unit cache-entry:eyre)] + %- pairs + :~ 'url'^s+url + 'aeon'^(numb aeon) + 'val'^?~(val ~ (render-cache-entry:v-eyre u.val)) + == :: :: /eyre/connections.json :: @@ -1038,6 +1058,9 @@ ++ bindings (scry ,(list [=binding =duct =action]) %e %bindings ~) :: + ++ cache + (scry ,(map url=@t [aeon=@ud (unit cache-entry)]) %e %cache ~) + :: ++ connections (scry ,(map duct outstanding-connection) %e %connections ~) :: @@ -1065,6 +1088,27 @@ %gen :((cury cat 3) '+' (spat [desk path]:generator.action)) %app (cat 3 ':' app.action) == + :: + ++ render-cache-entry + |= cache-entry + ^- json + %- pairs:enjs:format + :~ 'auth'^b+auth + 'payload'^(render-simple-payload simple-payload.body) + == + :: + ++ render-simple-payload + |= simple-payload:http + ^- json + =, enjs:format + %- pairs + :~ 'status'^(numb status-code.response-header) + 'data'^?~(data ~ (numb p.u.data)) + :: + :+ 'headers' %a + %+ turn headers.response-header + |=([k=@t v=@t] (pairs 'key'^s+k 'value'^s+v ~)) + == -- :: :: helpers diff --git a/pkg/arvo/app/debug/js/index.js b/pkg/arvo/app/debug/js/index.js index 31a52007e7..1ca01870b8 100644 --- a/pkg/arvo/app/debug/js/index.js +++ b/pkg/arvo/app/debug/js/index.js @@ -31750,7 +31750,6 @@ global$2[key] = "esm"; } } - //# sourceMappingURL=react-router.js.map /** * The public API for a that uses HTML5 history. @@ -32055,7 +32054,6 @@ style: propTypes.object }); } - //# sourceMappingURL=react-router-dom.js.map var classnames = createCommonjsModule(function (module) { /*! @@ -49271,6 +49269,7 @@ this.clayCommits(data, state); // this.eyreBindings(data, state); + this.eyreCache(data, state); this.eyreConnections(data, state); this.eyreAuthentication(data, state); this.eyreChannels(data, state); @@ -49404,6 +49403,13 @@ } } + eyreCache(obj, state) { + const data = lodash.get(obj, 'eyreCache', false); + if (data) { + state.cache = data; + } + } + eyreConnections(obj, state) { const data = lodash.get(obj, 'eyreConnections', false); if (data) { @@ -49436,6 +49442,7 @@ timers: [], commits: [], bindings: [], + cache: [], connections: [], authentication: { sessions: [], @@ -55399,6 +55406,13 @@ ); } + getCache() { + this.getJson('/eyre/cache', + this.wrapLocal('eyreCache'), + this.showStatus('error fetching eyre cache') + ); + } + getConnections() { this.getJson('/eyre/connections', this.wrapLocal('eyreConnections'), @@ -55420,6 +55434,11 @@ ); } + clearCache(url) { + return this.action("dbug", "json", { 'clear-eyre-cache': { url: url } }) + .then(this.getCache.bind(this)); + } + // local sidebarToggle() { @@ -55468,7 +55487,7 @@ let subscription = new Subscription(); - const _jsxFileName = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/js/components/skeleton.js"; + const _jsxFileName = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/js/components/skeleton.js"; class SidebarItem extends react_1 { render() { const { props } = this; @@ -55544,7 +55563,7 @@ } } - const _jsxFileName$1 = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/js/components/message-screen.js"; + const _jsxFileName$1 = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/js/components/message-screen.js"; class MessageScreen extends react_1 { render() { return ( @@ -64082,7 +64101,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ ob ); - const _jsxFileName$2 = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/js/components/searchable-list.js"; + const _jsxFileName$2 = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/js/components/searchable-list.js"; class SearchableList extends react_1 { // expected props: // items: [{key: 'some key', jsx: }, ...] @@ -64126,12 +64145,15 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ return (react.createElement('div', { style: {position: 'relative', border: '1px solid grey', padding: '4px'}, __self: this, __source: {fileName: _jsxFileName$2, lineNumber: 43}} , props.children , react.createElement('div', {__self: this, __source: {fileName: _jsxFileName$2, lineNumber: 45}}, searchBar, " (" , items.length, ")") - , react.createElement('div', {__self: this, __source: {fileName: _jsxFileName$2, lineNumber: 46}}, items.length === 0 ? 'none' : items) + , react.createElement('details', { open: (props.open === undefined) ? true : props.open, __self: this, __source: {fileName: _jsxFileName$2, lineNumber: 46}} + , react.createElement('summary', {__self: this, __source: {fileName: _jsxFileName$2, lineNumber: 47}}, items.length, " items" ) + , react.createElement('div', {__self: this, __source: {fileName: _jsxFileName$2, lineNumber: 48}}, items.length === 0 ? 'none' : items) + ) )); } } - const _jsxFileName$3 = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/js/components/subscriptions.js"; + const _jsxFileName$3 = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/js/components/subscriptions.js"; class Subscriptions extends react_1 { constructor(props) { super(props); @@ -64195,7 +64217,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ } } - const _jsxFileName$4 = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/js/components/summary.js"; + const _jsxFileName$4 = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/js/components/summary.js"; class Summary extends react_1 { // expected props: // id: 'id' @@ -64231,7 +64253,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ } } - const _jsxFileName$5 = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/js/views/apps.js"; + const _jsxFileName$5 = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/js/views/apps.js"; class Apps extends react_1 { constructor(props) { @@ -64351,7 +64373,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ } } - const _jsxFileName$6 = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/js/views/spider.js"; + const _jsxFileName$6 = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/js/views/spider.js"; class Spider extends react_1 { constructor(props) { @@ -64406,7 +64428,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ } } - const _jsxFileName$7 = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/js/views/ames.js"; + const _jsxFileName$7 = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/js/views/ames.js"; class Ames extends react_1 { constructor(props) { @@ -64833,7 +64855,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ } } - const _jsxFileName$8 = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/js/views/behn.js"; + const _jsxFileName$8 = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/js/views/behn.js"; class Behn extends react_1 { constructor(props) { @@ -64896,7 +64918,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ Orientation["Horizontal"] = "horizontal"; Orientation["HorizontalReverse"] = "horizontal-reverse"; })(Orientation = exports.Orientation || (exports.Orientation = {})); - //# sourceMappingURL=orientation.js.map + }); unwrapExports(orientation); @@ -65048,7 +65070,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ } return Math.atan2(alphaY, alphaX); } - //# sourceMappingURL=utils.js.map + }); unwrapExports(utils); @@ -65235,7 +65257,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ return template; } exports.getTemplate = getTemplate; - //# sourceMappingURL=template.js.map + }); unwrapExports(template); @@ -65274,7 +65296,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ } } exports.Tag = Tag; - //# sourceMappingURL=tag.js.map + }); unwrapExports(tag); @@ -65428,7 +65450,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ } } exports.Commit = Commit; - //# sourceMappingURL=commit.js.map + }); unwrapExports(commit); @@ -65580,7 +65602,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ function isBranchMergeOptions(options) { return typeof options === "object" && !(options instanceof BranchUserApi); } - //# sourceMappingURL=branch-user-api.js.map + }); unwrapExports(branchUserApi); @@ -65624,7 +65646,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ }); } exports.createDeletedBranch = createDeletedBranch; - //# sourceMappingURL=branch.js.map + }); unwrapExports(branch); @@ -65639,7 +65661,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ Mode["Compact"] = "compact"; })(Mode || (Mode = {})); exports.Mode = Mode; - //# sourceMappingURL=mode.js.map + }); unwrapExports(mode); @@ -65685,7 +65707,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ array.forEach((value) => set.add(value)); return Array.from(set); } - //# sourceMappingURL=regular.js.map + }); unwrapExports(regular); @@ -65717,7 +65739,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ } } exports.CompactGraphRows = CompactGraphRows; - //# sourceMappingURL=compact.js.map + }); unwrapExports(compact); @@ -65735,7 +65757,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ : new regular.RegularGraphRows(commits); } exports.createGraphRows = createGraphRows; - //# sourceMappingURL=index.js.map + }); unwrapExports(graphRows); @@ -65771,7 +65793,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ } } exports.BranchesOrder = BranchesOrder; - //# sourceMappingURL=branches-order.js.map + }); unwrapExports(branchesOrder); @@ -65850,7 +65872,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ } } exports.Refs = Refs; - //# sourceMappingURL=refs.js.map + }); unwrapExports(refs); @@ -66081,7 +66103,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ .join(" "); } exports.toSvgPath = toSvgPath; - //# sourceMappingURL=branches-paths.js.map + }); unwrapExports(branchesPaths); @@ -66259,7 +66281,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ } } exports.GitgraphUserApi = GitgraphUserApi; - //# sourceMappingURL=gitgraph-user-api.js.map + }); unwrapExports(gitgraphUserApi); @@ -66531,7 +66553,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ } } exports.GitgraphCore = GitgraphCore; - //# sourceMappingURL=gitgraph.js.map + }); unwrapExports(gitgraph); @@ -66565,7 +66587,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ exports.toSvgPath = branchesPaths.toSvgPath; exports.arrowSvgPath = utils.arrowSvgPath; - //# sourceMappingURL=index.js.map + }); unwrapExports(lib); @@ -66621,7 +66643,6 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ BranchLabel.paddingY = 5; return BranchLabel; }(react_1)); - //# sourceMappingURL=BranchLabel.js.map var __extends$1 = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { @@ -66675,7 +66696,6 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ Tooltip.padding = 10; return Tooltip; }(react_1)); - //# sourceMappingURL=Tooltip.js.map var Dot = function (_a) { var commit = _a.commit, onMouseOver = _a.onMouseOver, onMouseOut = _a.onMouseOut; @@ -66709,7 +66729,6 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ react_3("use", { xlinkHref: "#" + commit.hash, clipPath: "url(#clip-" + commit.hash + ")", stroke: commit.style.dot.strokeColor, strokeWidth: commit.style.dot.strokeWidth && commit.style.dot.strokeWidth * 2 }), commit.dotText && (react_3("text", { alignmentBaseline: "central", textAnchor: "middle", x: commit.style.dot.size, y: commit.style.dot.size, style: { font: commit.style.dot.font } }, commit.dotText))))); }; - //# sourceMappingURL=Dot.js.map var TAG_PADDING_X = 10; var TAG_PADDING_Y = 5; @@ -66743,7 +66762,6 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ react_3("path", { d: path, fill: tag.style.bgColor, stroke: tag.style.strokeColor }), react_3("text", { ref: $text, fill: tag.style.color, style: { font: tag.style.font }, alignmentBaseline: "middle", dominantBaseline: "middle", x: offset + TAG_PADDING_X, y: 0 }, tag.name))); } - //# sourceMappingURL=Tag.js.map var __extends$2 = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { @@ -67064,9 +67082,8 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ var transform = target.getAttribute("transform") || "translate(0, 0)"; target.setAttribute("transform", transform.replace(/translate\(([\d\.]+),/, "translate(" + x + ",")); } - //# sourceMappingURL=Gitgraph.js.map - const _jsxFileName$9 = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/js/views/clay.js"; + const _jsxFileName$9 = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/js/views/clay.js"; class Clay extends react_1 { constructor(props) { super(props); @@ -67206,7 +67223,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ } } - const _jsxFileName$a = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/js/views/eyre.js"; + const _jsxFileName$a = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/js/views/eyre.js"; class Eyre extends react_1 { constructor(props) { @@ -67214,6 +67231,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ this.state = {}; this.loadBindings = this.loadBindings.bind(this); + this.loadCache = this.loadCache.bind(this); this.loadConnections = this.loadConnections.bind(this); this.loadAuthenticationState = this.loadAuthenticationState.bind(this); this.loadChannels = this.loadChannels.bind(this); @@ -67222,6 +67240,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ componentDidMount() { const { props } = this; if (props.bindings.length === 0) this.loadBindings(); + if (props.cache.length === 0) this.loadCache(); if (props.connections.length == 0) this.loadConnections(); if (props.authentication.sessions.length == 0) this.loadAuthenticationState(); if (props.channels.length == 0) this.loadChannels(); @@ -67235,6 +67254,14 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ api.getBindings(); } + loadCache() { + api.getCache(); + } + + clearCache(url) { + api.clearCache(url); + } + loadConnections() { api.getConnections(); } @@ -67252,41 +67279,71 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ const { props, state } = this; const bindingItems = props.bindings.map(binding => { - return {key: binding.location + ' ' + binding.action, jsx: (react.createElement('div', { class: "flex", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 54}} - , react.createElement('div', { class: "flex-auto", style: {maxWidth: '50%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 55}} + return {key: binding.location + ' ' + binding.action, jsx: (react.createElement('div', { class: "flex", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 64}} + , react.createElement('div', { class: "flex-auto", style: {maxWidth: '50%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 65}} , binding.location ) - , react.createElement('div', { class: "flex-auto", style: {maxWidth: '50%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 58}} + , react.createElement('div', { class: "flex-auto", style: {maxWidth: '50%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 68}} , binding.action ) ))}; }); + const cacheItems = props.cache.map(entry => { + return {key: entry.url + ' ' + (entry.val ? 'LIVE' : 'CLEARED'), jsx: (react.createElement('div', { class: "flex", style: { marginBottom: '3px' }, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 75}} + , react.createElement('div', { style: { width: '45%' }, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 76}} + , entry.url + ) + , react.createElement('div', { style: { width: '5%' }, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 79}}, "(v" + , entry.aeon, ")" + ) + , !entry.val ? 'cleared' : + react.createElement('div', { style: { width: '50%', position: 'relative' }, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 83}} + , react.createElement('div', { style: { display: 'inline-block', width: '10%' }, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 84}} + , entry.val.auth ? 'auth' : 'free' + ) + , react.createElement('div', { style: { display: 'inline-block', width: '10%' }, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 87}} + , entry.val.payload.status + ) + , react.createElement('div', { style: { display: 'inline-block', width: '50%' }, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 90}} + , entry.val.payload.headers.reduce((o, h) => (o ? o+'; ': '') + h.key + '=' + h.value, '') + ) + , react.createElement('div', { style: { display: 'inline-block', width: '25%' }, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 93}} + , entry.val.payload.data ? entry.val.payload.data.toLocaleString('de-DE')+' bytes' : 'no data' + ) + , react.createElement('div', { style: { display: 'inline-block', width: '5%' }, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 96}} + , react.createElement('button', { onClick: () => { this.clearCache(entry.url); }, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 97}}, "clear") + ) + ) + + ))}; + }); + const connectionItems = props.connections.map(c => { return {key: c.duct + ' ' + c.action, jsx: ( - react.createElement('table', { style: {borderBottom: '1px solid black'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 66}}, react.createElement('tbody', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 66}} - , react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 67}} - , react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 68}}, "duct") - , react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 69}}, c.duct) + react.createElement('table', { style: {borderBottom: '1px solid black'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 106}}, react.createElement('tbody', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 106}} + , react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 107}} + , react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 108}}, "duct") + , react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 109}}, c.duct) ) - , react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 71}} - , react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 72}}, "binding") - , react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 73}}, c.action) + , react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 111}} + , react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 112}}, "binding") + , react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 113}}, c.action) ) - , react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 75}} - , react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 76}}, "request") - , react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 77}}, "from " + , react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 115}} + , react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 116}}, "request") + , react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 117}}, "from " , c.request.source, "," , c.request.authenticated ? ' ' : ' un', "authenticated and" , c.request.secure ? ' ' : ' in', "secure" ) ) - , react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 83}} - , react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 84}}, "response") - , react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 85}}, "sent " - , c.response.sent, " bytes." , react.createElement('br', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 86}}) + , react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 123}} + , react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 124}}, "response") + , react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 125}}, "sent " + , c.response.sent, " bytes." , react.createElement('br', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 126}}) , !c.response.header ? null : react.createElement(react.Fragment, null, "status " - , c.response.header['status-code'], react.createElement('br', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 88}}) + , c.response.header['status-code'], react.createElement('br', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 128}}) , c.response.header.headers.reduce((a, b) => a + b + ', ', '') ) ) @@ -67298,49 +67355,49 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ const channelItems = props.channels.map(c => { const summary = (react.createElement(react.Fragment, null , c.session - , react.createElement('table', { style: {borderBottom: '1px solid black'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 100}}, react.createElement('tbody', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 100}} - , react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 101}} - , react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 102}}, "identity") - , react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 103}}, c['identity']) + , react.createElement('table', { style: {borderBottom: '1px solid black'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 140}}, react.createElement('tbody', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 140}} + , react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 141}} + , react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 142}}, "identity") + , react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 143}}, c['identity']) ) - , react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 105}} - , react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 106}}, "connected?") - , react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 107}}, c.connected + , react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 145}} + , react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 146}}, "connected?") + , react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 147}}, c.connected ? 'connected' : 'disconnected, expires ' + msToDa(c.expiry) ) ) - , react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 112}} - , react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 113}}, "next-id") - , react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 114}}, c['next-id']) + , react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 152}} + , react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 153}}, "next-id") + , react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 154}}, c['next-id']) ) - , react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 116}} - , react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 117}}, "last-ack") - , react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 118}}, msToDa(c['last-ack'])) + , react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 156}} + , react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 157}}, "last-ack") + , react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 158}}, msToDa(c['last-ack'])) ) - , react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 120}} - , react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 121}}, "unacked") - , react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 122}}, c.unacked.reduce((a, b) => a + b + ', ', '')) + , react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 160}} + , react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 161}}, "unacked") + , react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 162}}, c.unacked.reduce((a, b) => a + b + ', ', '')) ) )) )); const subscriptionItems = c.subscriptions.map(s => { //NOTE jsx sorta copied from /components/subscriptions return {key: `${s.id} ${s.ship} ${s.app} ${s.path}`, jsx: ( - react.createElement('div', { class: "flex", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 129}} - , react.createElement('div', { class: "flex-auto", style: {maxWidth: '15%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 130}} + react.createElement('div', { class: "flex", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 169}} + , react.createElement('div', { class: "flex-auto", style: {maxWidth: '15%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 170}} , s.id ) - , react.createElement('div', { class: "flex-auto", style: {maxWidth: '15%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 133}}, "~" + , react.createElement('div', { class: "flex-auto", style: {maxWidth: '15%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 173}}, "~" , s.ship ) - , react.createElement('div', { class: "flex-auto", style: {maxWidth: '20%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 136}} + , react.createElement('div', { class: "flex-auto", style: {maxWidth: '20%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 176}} , s.app ) - , react.createElement('div', { class: "flex-auto", style: {maxWidth: '35%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 139}} + , react.createElement('div', { class: "flex-auto", style: {maxWidth: '35%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 179}} , s.path ) - , react.createElement('div', { class: "flex-auto", style: {maxWidth: '15%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 142}} + , react.createElement('div', { class: "flex-auto", style: {maxWidth: '15%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 182}} , s.unacked ) ) @@ -67350,51 +67407,51 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ react.createElement(Summary, { summary: summary, details: ( react.createElement(SearchableList, { placeholder: "id, ship, app, path" , - items: subscriptionItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 150}} + items: subscriptionItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 190}} ) - ), __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 149}} ) + ), __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 189}} ) )}; }); //TODO also make sure column headings get rendered const sessionItems = props.authentication.sessions.map(s => { - return ({key: s.identity, jsx: (react.createElement('div', { class: "flex", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 160}} - , react.createElement('div', { class: "flex-auto", style: {maxWidth: '5em'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 161}} + return ({key: s.identity, jsx: (react.createElement('div', { class: "flex", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 200}} + , react.createElement('div', { class: "flex-auto", style: {maxWidth: '5em'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 201}} , s.cookie.slice(0,6), "…" ) - , react.createElement('div', { class: "flex-auto", style: {width: '40%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 164}}, "~" + , react.createElement('div', { class: "flex-auto", style: {width: '40%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 204}}, "~" , s.identity ) - , react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 167}} + , react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 207}} , msToDa(s.expiry) ) - , react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 170}} + , react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 210}} , s.channels, " channel(s)" ) - , react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 173}} - , react.createElement('form', { method: "post", action: "/~/logout?redirect=/~debug/eyre", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 174}} - , react.createElement('input', { type: "hidden", name: "sid", value: s.cookie, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 175}} ) - , react.createElement('button', { type: "submit", name: "all", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 176}}, "kick") + , react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 213}} + , react.createElement('form', { method: "post", action: "/~/logout?redirect=/~debug/eyre", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 214}} + , react.createElement('input', { type: "hidden", name: "sid", value: s.cookie, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 215}} ) + , react.createElement('button', { type: "submit", name: "all", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 216}}, "kick") ) ) ))}); }); const visitingItems = props.authentication.visiting.map(v => { - return ({key: '~'+v.who+':'+v.nonce, jsx: (react.createElement('div', { class: "flex", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 183}} - , react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 184}}, "~" + return ({key: '~'+v.who+':'+v.nonce, jsx: (react.createElement('div', { class: "flex", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 223}} + , react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 224}}, "~" , v.who ) - , react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 187}} + , react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 227}} , v.nonce ) - , react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 190}} + , react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 230}} , v.goal ? 'pending, will return to '+v.goal : - react.createElement('form', { method: "post", action: "/~/logout?redirect=/~debug/eyre", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 192}}, "logged in since " + react.createElement('form', { method: "post", action: "/~/logout?redirect=/~debug/eyre", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 232}}, "logged in since " , msToDa(v.made) - , react.createElement('input', { type: "hidden", name: "host", value: '~'+v.who, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 194}} ) - , react.createElement('input', { type: "hidden", name: "sid", value: v.nonce, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 195}} ) - , react.createElement('button', { type: "submit", name: "eauth", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 196}}, "log out" ) + , react.createElement('input', { type: "hidden", name: "host", value: '~'+v.who, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 234}} ) + , react.createElement('input', { type: "hidden", name: "sid", value: v.nonce, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 235}} ) + , react.createElement('button', { type: "submit", name: "eauth", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 236}}, "log out" ) ) ) @@ -67402,25 +67459,25 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ }); const visitorsItems = props.authentication.visitors.map(v => { - return ({key: v.nonce+':~'+v.ship, jsx: (react.createElement('div', { class: "flex", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 204}} - , react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 205}} + return ({key: v.nonce+':~'+v.ship, jsx: (react.createElement('div', { class: "flex", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 244}} + , react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 245}} , v.nonce ) - , react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 208}} + , react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 248}} , v.duct ) - , v.sesh ? react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 211}}, "session: " , v.sesh.slice(0,6), "…") : + , v.sesh ? react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 251}}, "session: " , v.sesh.slice(0,6), "…") : react.createElement(react.Fragment, null - , react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 213}} + , react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 253}} , v.pend ? 'request pending' : 'no pending request' ) - , react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 216}} + , react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 256}} , v.ship ) - , react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 219}}, "redirect: " + , react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 259}}, "redirect: " , v.last ) - , react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 222}} + , react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 262}} , v.toke ? 'token received' : 'no token yet' ) ) @@ -67428,44 +67485,52 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ }); return (react.createElement(react.Fragment, null - , react.createElement('h4', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 230}}, "Bindings") - , react.createElement(SearchableList, { placeholder: "binding", items: bindingItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 231}} - , react.createElement('button', { onClick: this.loadBindings, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 232}}, "refresh") + , react.createElement('h4', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 270}}, "Bindings") + , react.createElement(SearchableList, { placeholder: "binding", items: bindingItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 271}} + , react.createElement('button', { onClick: this.loadBindings, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 272}}, "refresh") ) - , react.createElement('h4', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 235}}, "Connections") - , react.createElement(SearchableList, { placeholder: "duct, binding" , items: connectionItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 236}} - , react.createElement('button', { onClick: this.loadConnections, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 237}}, "refresh") + , react.createElement('h4', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 275}}, "Cache") + , props.cache.reduce((sum, entry) => { + return sum + (entry.val && entry.val.payload.data || 0); + }, 0).toLocaleString('de-DE'), " bytes in cache" + , react.createElement(SearchableList, { placeholder: "cache url, LIVE vs CLEARED" , items: cacheItems, open: false, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 279}} + , react.createElement('button', { onClick: this.loadCache, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 280}}, "refresh") ) - , react.createElement('h4', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 240}}, "Channels") - , react.createElement(SearchableList, { placeholder: "session id" , items: channelItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 241}} - , react.createElement('button', { onClick: this.loadChannels, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 242}}, "refresh") + , react.createElement('h4', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 283}}, "Connections") + , react.createElement(SearchableList, { placeholder: "duct, binding" , items: connectionItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 284}} + , react.createElement('button', { onClick: this.loadConnections, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 285}}, "refresh") ) - , react.createElement('h4', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 245}}, "Authentication") - , react.createElement('form', { method: "post", action: "/~/logout", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 246}} - , react.createElement('button', { type: "submit", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 247}}, "logout self" ) + , react.createElement('h4', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 288}}, "Channels") + , react.createElement(SearchableList, { placeholder: "session id" , items: channelItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 289}} + , react.createElement('button', { onClick: this.loadChannels, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 290}}, "refresh") ) - , react.createElement('form', { method: "post", action: "/~/logout", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 249}} - , react.createElement('button', { type: "submit", name: "all", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 250}}, "logout all selves" ) + + , react.createElement('h4', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 293}}, "Authentication") + , react.createElement('form', { method: "post", action: "/~/logout", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 294}} + , react.createElement('button', { type: "submit", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 295}}, "logout self" ) ) - , react.createElement('br', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 252}}) - , react.createElement('button', { onClick: this.loadAuthenticationState, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 253}}, "refresh") - , react.createElement('h3', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 254}}, "Sessions") - , react.createElement(SearchableList, { placeholder: "identity", items: sessionItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 255}} + , react.createElement('form', { method: "post", action: "/~/logout", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 297}} + , react.createElement('button', { type: "submit", name: "all", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 298}}, "logout all selves" ) ) - , react.createElement('h3', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 257}}, "Outgoing eauth" ) - , react.createElement(SearchableList, { placeholder: "host", items: visitingItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 258}} + , react.createElement('br', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 300}}) + , react.createElement('button', { onClick: this.loadAuthenticationState, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 301}}, "refresh") + , react.createElement('h3', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 302}}, "Sessions") + , react.createElement(SearchableList, { placeholder: "identity", items: sessionItems, open: false, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 303}} ) - , react.createElement('h3', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 260}}, "Incoming eauth" ) - , react.createElement(SearchableList, { placeholder: "visitor", items: visitorsItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 261}} + , react.createElement('h3', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 305}}, "Outgoing eauth" ) + , react.createElement(SearchableList, { placeholder: "host", items: visitingItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 306}} + ) + , react.createElement('h3', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 308}}, "Incoming eauth" ) + , react.createElement(SearchableList, { placeholder: "visitor", items: visitorsItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 309}} ) )); } } - const _jsxFileName$b = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/js/components/root.js"; + const _jsxFileName$b = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/js/components/root.js"; class Root extends react_1 { constructor(props) { super(props); @@ -67550,6 +67615,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ react.createElement(Skeleton, { status: state.status, selected: "eyre", __self: this, __source: {fileName: _jsxFileName$b, lineNumber: 100}} , react.createElement(Eyre, { bindings: state.bindings, + cache: state.cache, connections: state.connections, authentication: state.authentication, channels: state.channels, @@ -67565,7 +67631,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ } } - const _jsxFileName$c = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/index.js"; + const _jsxFileName$c = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/index.js"; api$1.setAuthTokens({ ship: window.ship }); diff --git a/pkg/interface/dbug/src/js/api.js b/pkg/interface/dbug/src/js/api.js index 2f62d755ac..617cc46add 100644 --- a/pkg/interface/dbug/src/js/api.js +++ b/pkg/interface/dbug/src/js/api.js @@ -201,6 +201,13 @@ class UrbitApi { ); } + getCache() { + this.getJson('/eyre/cache', + this.wrapLocal('eyreCache'), + this.showStatus('error fetching eyre cache') + ); + } + getConnections() { this.getJson('/eyre/connections', this.wrapLocal('eyreConnections'), @@ -222,6 +229,11 @@ class UrbitApi { ); } + clearCache(url) { + return this.action("dbug", "json", { 'clear-eyre-cache': { url: url } }) + .then(this.getCache.bind(this)); + } + // local sidebarToggle() { diff --git a/pkg/interface/dbug/src/js/components/root.js b/pkg/interface/dbug/src/js/components/root.js index f9975f603f..e2e8bf3100 100644 --- a/pkg/interface/dbug/src/js/components/root.js +++ b/pkg/interface/dbug/src/js/components/root.js @@ -100,6 +100,7 @@ export class Root extends Component { {props.children}
{searchBar} ({items.length})
-
{items.length === 0 ? 'none' : items}
+
+ {items.length} items +
{items.length === 0 ? 'none' : items}
+
); } } diff --git a/pkg/interface/dbug/src/js/reducers/local.js b/pkg/interface/dbug/src/js/reducers/local.js index 94121e7360..d785026c06 100644 --- a/pkg/interface/dbug/src/js/reducers/local.js +++ b/pkg/interface/dbug/src/js/reducers/local.js @@ -23,6 +23,7 @@ export class LocalReducer { this.clayCommits(data, state); // this.eyreBindings(data, state); + this.eyreCache(data, state); this.eyreConnections(data, state); this.eyreAuthentication(data, state); this.eyreChannels(data, state); @@ -156,6 +157,13 @@ export class LocalReducer { } } + eyreCache(obj, state) { + const data = _.get(obj, 'eyreCache', false); + if (data) { + state.cache = data; + } + } + eyreConnections(obj, state) { const data = _.get(obj, 'eyreConnections', false); if (data) { diff --git a/pkg/interface/dbug/src/js/store.js b/pkg/interface/dbug/src/js/store.js index 3627c9d880..91eb60cd32 100644 --- a/pkg/interface/dbug/src/js/store.js +++ b/pkg/interface/dbug/src/js/store.js @@ -11,6 +11,7 @@ class Store { timers: [], commits: [], bindings: [], + cache: [], connections: [], authentication: { sessions: [], diff --git a/pkg/interface/dbug/src/js/views/eyre.js b/pkg/interface/dbug/src/js/views/eyre.js index d6d928bd2a..76e2302f95 100644 --- a/pkg/interface/dbug/src/js/views/eyre.js +++ b/pkg/interface/dbug/src/js/views/eyre.js @@ -12,6 +12,7 @@ export class Eyre extends Component { this.state = {}; this.loadBindings = this.loadBindings.bind(this); + this.loadCache = this.loadCache.bind(this); this.loadConnections = this.loadConnections.bind(this); this.loadAuthenticationState = this.loadAuthenticationState.bind(this); this.loadChannels = this.loadChannels.bind(this); @@ -20,6 +21,7 @@ export class Eyre extends Component { componentDidMount() { const { props } = this; if (props.bindings.length === 0) this.loadBindings(); + if (props.cache.length === 0) this.loadCache(); if (props.connections.length == 0) this.loadConnections(); if (props.authentication.sessions.length == 0) this.loadAuthenticationState(); if (props.channels.length == 0) this.loadChannels(); @@ -34,6 +36,14 @@ export class Eyre extends Component { api.getBindings(); } + loadCache() { + api.getCache(); + } + + clearCache(url) { + api.clearCache(url); + } + loadConnections() { api.getConnections(); } @@ -61,6 +71,36 @@ export class Eyre extends Component { )}; }); + const cacheItems = props.cache.map(entry => { + return {key: entry.url + ' ' + (entry.val ? 'LIVE' : 'CLEARED'), jsx: (
+
+ {entry.url} +
+
+ (v{entry.aeon}) +
+ { !entry.val ? 'cleared' : +
+
+ {entry.val.auth ? 'auth' : 'free'} +
+
+ {entry.val.payload.status} +
+
+ {entry.val.payload.headers.reduce((o, h) => (o ? o+'; ': '') + h.key + '=' + h.value, '')} +
+
+ {entry.val.payload.data ? entry.val.payload.data.toLocaleString('de-DE')+' bytes' : 'no data'} +
+
+ +
+
+ } +
)}; + }) + const connectionItems = props.connections.map(c => { return {key: c.duct + ' ' + c.action, jsx: ( @@ -232,6 +272,14 @@ export class Eyre extends Component { +

Cache

+ {props.cache.reduce((sum, entry) => { + return sum + (entry.val && entry.val.payload.data || 0); + }, 0).toLocaleString('de-DE')} bytes in cache + + + +

Connections

@@ -252,7 +300,7 @@ export class Eyre extends Component {

Sessions

- +

Outgoing eauth

From f3ce73447cec0941a3bded1384f45c1ee011ff95 Mon Sep 17 00:00:00 2001 From: fang Date: Fri, 16 Feb 2024 20:20:57 +0100 Subject: [PATCH 161/252] eyre: respect host from Forwarded header, if set Eyre already looks at the Forwarded header for the original requester's IP address, and the security level of the connection. Some proxies may modify the original Host header, but still provide the original in the Forwarded header. So, if present, we respect that. --- pkg/arvo/sys/vane/eyre.hoon | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index 60d24c3a90..172c1ffc7e 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -798,14 +798,15 @@ =* headers header-list.request :: for requests from localhost, respect the "forwarded" header :: - =/ [secure=? =^address] - =* same [secure address] + =/ [secure=? host=(unit @t) =^address] + =/ host=(unit @t) (get-header:http 'host' headers) + =* same [secure host address] ?. =([%ipv4 .127.0.0.1] address) same ?~ forwards=(forwarded-params headers) same - :- (fall (forwarded-secure u.forwards) secure) + :+ (fall (forwarded-secure u.forwards) secure) + (clap (forwarded-host u.forwards) host head) (fall (forwarded-for u.forwards) address) :: - =/ host (get-header:http 'host' headers) =/ [=action suburl=@t] (get-action-for-binding host url.request) :: @@ -3241,6 +3242,12 @@ %https `& == :: +++ forwarded-host + |= forwards=(list (map @t @t)) + ^- (unit @t) + ?. ?=(^ forwards) ~ + (~(get by i.forwards) 'host') +:: ++ parse-request-line |= url=@t ^- [[ext=(unit @ta) site=(list @t)] args=(list [key=@t value=@t])] From 1c622f550ea104f9490f5497fb2d7362b1b972bd Mon Sep 17 00:00:00 2001 From: fang Date: Fri, 16 Feb 2024 20:57:00 +0100 Subject: [PATCH 162/252] eyre: update eauth endpoint timestamp less eagerly We always update the eauth endpoint based on new logins from the local identity. We also let the user configure a hardcoded endpoint url. In both cases, we update a recency timestamp for the endpoint, to help us keep our scry namespace responses immutable. However, we even updated this timestamp if the visible endpoint didn't change. That is, if the new value was identical, or if the auto-detected endpoint changed, but it was actively being overridden by a user-configured url. Here, we update the stored timestamp only if the visible url actually changed. This should help us respond to (remote) scry requests more consistently. (See also the note in +send-keen.) --- pkg/arvo/sys/vane/eyre.hoon | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index 60d24c3a90..f841c6b456 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -1307,9 +1307,15 @@ :: =? endpoint.auth.state ?=(^ host) %- (trace 2 |.("eauth: storing endpoint at {(trip u.host)}")) - :+ user.endpoint.auth.state + =/ new-auth=(unit @t) `(cat 3 ?:(secure 'https://' 'http://') u.host) - now + =, endpoint.auth.state + :+ user new-auth + :: only update the timestamp if the derived endpoint visibly changed. + :: that is, it's not hidden behind a user-provided hardcoded url, + :: and the new value is different from the old.) + :: + ?:(|(?=(^ user) =(new-auth auth)) time now) :: =; out=[moves=(list move) server-state] out(moves [give-session-tokens :(weld moz moves.fex moves.out)]) @@ -3506,6 +3512,8 @@ $(moves [mov moves], siz t.siz) :: ?: ?=(%eauth-host -.task) + ?: =(user.endpoint.auth.server-state.ax host.task) + [~ http-server-gate] =. user.endpoint.auth.server-state.ax host.task =. time.endpoint.auth.server-state.ax now [~ http-server-gate] From 111a21eea7464b9ee86bde3d79fe47b6fd7fdb7e Mon Sep 17 00:00:00 2001 From: fang Date: Mon, 19 Feb 2024 20:55:38 +0100 Subject: [PATCH 163/252] tests: make /ted/test compile again It appears that bb8ba24 merged changes to /ted/test from #6790 and #6896 incorrectly, as the thread no longer compiled. Because the former PR included the change made to the latter (printing with slog priority 3 in case of failure), the minimum viable fix is taking the contents of /ted/test from #6790 and using those as-is. However, that had hidden success prints behind a "quiet" flag, and provided no way of configuring that from outside the thread. So additionally, we expand the ""vase parsing"" performed on the thread's argument, such that an optional _first_ parameter of a quiet=? may be passed. --- pkg/arvo/ted/test.hoon | 52 ++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/pkg/arvo/ted/test.hoon b/pkg/arvo/ted/test.hoon index 2f5ec55db3..16089e0914 100644 --- a/pkg/arvo/ted/test.hoon +++ b/pkg/arvo/ted/test.hoon @@ -10,7 +10,7 @@ +$ test [=beam func=test-func] +$ test-arm [name=term func=test-func] +$ test-func (trap tang) -+$ args quiet=_& ++$ args quiet=? -- => |_ =args @@ -18,7 +18,7 @@ |= =beam =/ m (strand ,[(unit vase) tang]) ^- form:m - ;< res=(unit vase) bind:m + ;< res=(unit vase) bind:m (build-file:strandio beam) %+ pure:m res ?. =(res ~) @@ -27,15 +27,14 @@ :: +run-test: execute an individual test :: ++ run-test - |= [pax=path test=test-func] - ^- [ok=? output=tang result=tang] - =+ name=(spud pax) + |= [bem=beam test=test-func] + ^- [ok=? =tang] =+ run=(mule test) ?- -.run - %| |+[p.run [leaf+"CRASHED {name}" ~]] + %| |+p.run %& ?: =(~ p.run) - &+[p.run [leaf+"OK {name}" ~]] - |+[p.run [leaf+"FAILED {name}" ~]] + &+~ + |+(flop `tang`[leaf+"FAILED" p.run]) == :: +resolve-test-paths: add test names to file paths to form full identifiers :: @@ -118,16 +117,20 @@ =/ m (strand ,vase) ^- form:m ;< =bowl:strand bind:m get-bowl:strandio -=/ paz=(list path) - :: if no args, test everything under /=base=/tests +=/ [quiet=? paz=(list path)] + :: if no args, test everything under /=base=/tests :: - ?~ q.arg + =* default-tests ~[/(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)) + ?+ q.arg !! + ~ [& default-tests] + [~ ?] =+ !<([~ quiet=?] arg) [quiet default-tests] + [~ ? ^ *] =+ !<([~ quiet=? paz=(list path)] arg) [quiet paz] + [~ ? ^] =+ !<([~ quiet=? pax=path] arg) [quiet pax ~] + [~ ^ *] =+ !<([~ paz=(list path)] arg) [& paz] + [~ *] =+ !<([~ pax=path] arg) [& pax ~] + == +=. quiet.args quiet =/ bez=(list beam) (turn paz |=(p=path ~|([%test-not-beam p] (need (de-beam p))))) ;< fiz=(set [=beam test=(unit term)]) bind:m (find-test-files bez) @@ -139,9 +142,7 @@ ?^ fiz ;< [cor=(unit vase) =tang] bind:m (build-file beam.i.fiz) ?~ cor - ~> %slog.3^leaf+"FAILED {(spud s.beam.i.fiz)} (build)" - gather-tests(fiz t.fiz, build-ok |) - ~> %slog.0^leaf+"built {(spud s.beam.i.fiz)}" + gather-tests(fiz t.fiz, build-failed [[beam.i.fiz tang] build-failed]) =/ arms=(list test-arm) (get-test-arms u.cor) :: if test path specified an arm prefix, filter arms to match =? arms ?=(^ test.i.fiz) @@ -157,9 +158,10 @@ |= [=beam *] beam %+ roll (resolve-test-paths test-arms) -|= [[=path =test-func] ok=_build-ok] -^+ ok -=/ res (run-test path test-func) -%- (%*(. slog pri ?:(ok.res 0 3)) output.res) -%- (%*(. slog pri ?:(ok.res 0 3)) result.res) -&(ok ok.res) \ No newline at end of file +|= [[=beam =test-func] failed=_build-failed] +^+ failed +=/ res (run-test beam test-func) +?: -.res + failed +:_ failed +[beam +.res] From b8d7acc45c030fbdf3e27ec520c02e3cfbf4a527 Mon Sep 17 00:00:00 2001 From: Pyry Kovanen Date: Tue, 20 Feb 2024 11:25:41 +0200 Subject: [PATCH 164/252] ci: red checkmark if something fails to build --- nix/test-fake-ship.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/test-fake-ship.nix b/nix/test-fake-ship.nix index 3a9a92a880..4248d45eee 100644 --- a/nix/test-fake-ship.nix +++ b/nix/test-fake-ship.nix @@ -112,7 +112,7 @@ in pkgs.stdenvNoCC.mkDerivation { ''; checkPhase = '' - if egrep "((FAILED|CRASHED|Failed)|warn:)" $out >/dev/null; then + if egrep "((FAILED|CRASHED|Failed|error-building /ted)|warn:)" $out >/dev/null; then exit 1 fi ''; From 6f3a2bfeaf16298630f7ed9e9399a7e4a0b73ee8 Mon Sep 17 00:00:00 2001 From: pkova Date: Tue, 20 Feb 2024 14:48:20 +0200 Subject: [PATCH 165/252] ci: build all threads in ci --- pkg/arvo/app/test.hoon | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/app/test.hoon b/pkg/arvo/app/test.hoon index 6b8a7aaa91..cbfdce71ec 100644 --- a/pkg/arvo/app/test.hoon +++ b/pkg/arvo/app/test.hoon @@ -2,7 +2,7 @@ !: |% +$ card card:agent:gall -+$ test ?(%agents %marks %generators) ++$ test ?(%agents %marks %generators %threads) +$ state $: app=(set path) app-ok=? @@ -10,6 +10,8 @@ mar-ok=? gen=(set path) gen-ok=? + ted=(set path) + ted-ok=? == -- =, format @@ -29,9 +31,10 @@ |^ =+ !<(=test vase) ?- test - %marks test-marks - %agents test-agents + %marks test-marks + %agents test-agents %generators test-generators + %threads test-threads == :: ++ test-marks @@ -100,6 +103,25 @@ gen.state (~(put in gen.state) i.paz) == :: + ++ test-threads + =| fex=(list card) + ^+ [fex this] + ?> =(~ ted.state) + =. ted-ok.state %.y + =+ .^(paz=(list path) ct+(en-beam now-beak /ted)) + |- ^+ [fex this] + ?~ paz [(flop fex) this] + =/ xap=path (flop i.paz) + ?. ?=([%hoon *] xap) + $(paz t.paz) + =/ sing=card + :+ %pass build+i.paz + [%arvo %c %warp our.bowl q.byk.bowl ~ %sing %a da+now.bowl i.paz] + %_ $ + paz t.paz + fex [sing fex] + ted.state (~(put in ted.state) i.paz) + == ++ now-beak %_(byk.bowl r [%da now.bowl]) -- ++ on-watch on-watch:def @@ -150,6 +172,15 @@ ~? =(~ gen.state) ?:(gen-ok.state %all-generators-built %some-generators-failed) [~ this] + :: + [%ted *] + =/ ok ?=(^ p.sign-arvo) + %- (report path ok) + =? ted-ok.state !ok %.n + =. ted.state (~(del in ted.state) path) + ~? =(~ ted.state) + ?:(ted-ok.state %all-threads-built %some-threads-failed) + [~ this] == ++ on-fail on-fail:def -- From a92ff5da1d8c04f583196d2927362848bc410fe5 Mon Sep 17 00:00:00 2001 From: pkova Date: Tue, 20 Feb 2024 14:49:16 +0200 Subject: [PATCH 166/252] Revert "ci: red checkmark if something fails to build" This reverts commit b8d7acc45c030fbdf3e27ec520c02e3cfbf4a527. --- nix/test-fake-ship.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/test-fake-ship.nix b/nix/test-fake-ship.nix index 4248d45eee..3a9a92a880 100644 --- a/nix/test-fake-ship.nix +++ b/nix/test-fake-ship.nix @@ -112,7 +112,7 @@ in pkgs.stdenvNoCC.mkDerivation { ''; checkPhase = '' - if egrep "((FAILED|CRASHED|Failed|error-building /ted)|warn:)" $out >/dev/null; then + if egrep "((FAILED|CRASHED|Failed)|warn:)" $out >/dev/null; then exit 1 fi ''; From 5e32da9578097a78f66bac37e0ecd0af7421a1be Mon Sep 17 00:00:00 2001 From: pkova Date: Tue, 20 Feb 2024 14:50:33 +0200 Subject: [PATCH 167/252] ci: actually build threads in ci --- nix/test-fake-ship.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/test-fake-ship.nix b/nix/test-fake-ship.nix index 3a9a92a880..eeb3b9bd4f 100644 --- a/nix/test-fake-ship.nix +++ b/nix/test-fake-ship.nix @@ -92,6 +92,7 @@ in pkgs.stdenvNoCC.mkDerivation { ${click} -k -p -i ${pokeApp "%agents" "noun" "test"} ./pier ${click} -k -p -i ${pokeApp "%generators" "noun" "test"} ./pier ${click} -k -p -i ${pokeApp "%marks" "noun" "test"} ./pier + ${click} -k -p -i ${pokeApp "%threads" "noun" "test"} ./pier ${click} -k -p -i ${appThread "mass" "hood"} ./pier sleep 2 From 721f9617b1d39f990df29a5684a0351d1e4c1ee8 Mon Sep 17 00:00:00 2001 From: Pyry Kovanen Date: Thu, 22 Feb 2024 16:33:18 +0200 Subject: [PATCH 168/252] jael: do not sort remote gifts --- pkg/arvo/sys/vane/jael.hoon | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/jael.hoon b/pkg/arvo/sys/vane/jael.hoon index 7e707f1ce1..bbd670eeba 100644 --- a/pkg/arvo/sys/vane/jael.hoon +++ b/pkg/arvo/sys/vane/jael.hoon @@ -654,7 +654,10 @@ ++ public-keys-give |= [yen=(set duct) =public-keys-result] |^ - =+ yez=(sort ~(tap in yen) sorter) + =/ yaz %+ skid ~(tap in yen) + |= d=duct + &(?=([[%ames @ @ *] *] d) !=(%public-keys i.t.i.d)) + =/ yez (weld p.yaz (sort q.yaz sorter)) |- ^+ this-su ?~ yez this-su =* d i.yez From 2af43c2219c715b24e848db30523a726edf97371 Mon Sep 17 00:00:00 2001 From: Pyry Kovanen Date: Tue, 20 Feb 2024 15:14:31 +0200 Subject: [PATCH 169/252] Merge pull request #6918 from urbit/pkova/error-building ci: red checkmark if any thread fails to build --- nix/test-fake-ship.nix | 1 + pkg/arvo/app/test.hoon | 37 ++++++++++++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/nix/test-fake-ship.nix b/nix/test-fake-ship.nix index 3a9a92a880..eeb3b9bd4f 100644 --- a/nix/test-fake-ship.nix +++ b/nix/test-fake-ship.nix @@ -92,6 +92,7 @@ in pkgs.stdenvNoCC.mkDerivation { ${click} -k -p -i ${pokeApp "%agents" "noun" "test"} ./pier ${click} -k -p -i ${pokeApp "%generators" "noun" "test"} ./pier ${click} -k -p -i ${pokeApp "%marks" "noun" "test"} ./pier + ${click} -k -p -i ${pokeApp "%threads" "noun" "test"} ./pier ${click} -k -p -i ${appThread "mass" "hood"} ./pier sleep 2 diff --git a/pkg/arvo/app/test.hoon b/pkg/arvo/app/test.hoon index 6b8a7aaa91..cbfdce71ec 100644 --- a/pkg/arvo/app/test.hoon +++ b/pkg/arvo/app/test.hoon @@ -2,7 +2,7 @@ !: |% +$ card card:agent:gall -+$ test ?(%agents %marks %generators) ++$ test ?(%agents %marks %generators %threads) +$ state $: app=(set path) app-ok=? @@ -10,6 +10,8 @@ mar-ok=? gen=(set path) gen-ok=? + ted=(set path) + ted-ok=? == -- =, format @@ -29,9 +31,10 @@ |^ =+ !<(=test vase) ?- test - %marks test-marks - %agents test-agents + %marks test-marks + %agents test-agents %generators test-generators + %threads test-threads == :: ++ test-marks @@ -100,6 +103,25 @@ gen.state (~(put in gen.state) i.paz) == :: + ++ test-threads + =| fex=(list card) + ^+ [fex this] + ?> =(~ ted.state) + =. ted-ok.state %.y + =+ .^(paz=(list path) ct+(en-beam now-beak /ted)) + |- ^+ [fex this] + ?~ paz [(flop fex) this] + =/ xap=path (flop i.paz) + ?. ?=([%hoon *] xap) + $(paz t.paz) + =/ sing=card + :+ %pass build+i.paz + [%arvo %c %warp our.bowl q.byk.bowl ~ %sing %a da+now.bowl i.paz] + %_ $ + paz t.paz + fex [sing fex] + ted.state (~(put in ted.state) i.paz) + == ++ now-beak %_(byk.bowl r [%da now.bowl]) -- ++ on-watch on-watch:def @@ -150,6 +172,15 @@ ~? =(~ gen.state) ?:(gen-ok.state %all-generators-built %some-generators-failed) [~ this] + :: + [%ted *] + =/ ok ?=(^ p.sign-arvo) + %- (report path ok) + =? ted-ok.state !ok %.n + =. ted.state (~(del in ted.state) path) + ~? =(~ ted.state) + ?:(ted-ok.state %all-threads-built %some-threads-failed) + [~ this] == ++ on-fail on-fail:def -- From 51ec49f980f407daf1cbfdd13fa7f71e3e997e0c Mon Sep 17 00:00:00 2001 From: fang Date: Mon, 19 Feb 2024 20:55:38 +0100 Subject: [PATCH 170/252] tests: make /ted/test compile again It appears that bb8ba24 merged changes to /ted/test from #6790 and #6896 incorrectly, as the thread no longer compiled. Because the former PR included the change made to the latter (printing with slog priority 3 in case of failure), the minimum viable fix is taking the contents of /ted/test from #6790 and using those as-is. However, that had hidden success prints behind a "quiet" flag, and provided no way of configuring that from outside the thread. So additionally, we expand the ""vase parsing"" performed on the thread's argument, such that an optional _first_ parameter of a quiet=? may be passed. --- pkg/arvo/ted/test.hoon | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/pkg/arvo/ted/test.hoon b/pkg/arvo/ted/test.hoon index be97bd6586..16089e0914 100644 --- a/pkg/arvo/ted/test.hoon +++ b/pkg/arvo/ted/test.hoon @@ -10,7 +10,7 @@ +$ test [=beam func=test-func] +$ test-arm [name=term func=test-func] +$ test-func (trap tang) -+$ args quiet=_& ++$ args quiet=? -- => |_ =args @@ -18,7 +18,7 @@ |= =beam =/ m (strand ,[(unit vase) tang]) ^- form:m - ;< res=(unit vase) bind:m + ;< res=(unit vase) bind:m (build-file:strandio beam) %+ pure:m res ?. =(res ~) @@ -117,16 +117,20 @@ =/ m (strand ,vase) ^- form:m ;< =bowl:strand bind:m get-bowl:strandio -=/ paz=(list path) - :: if no args, test everything under /=base=/tests +=/ [quiet=? paz=(list path)] + :: if no args, test everything under /=base=/tests :: - ?~ q.arg + =* default-tests ~[/(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)) + ?+ q.arg !! + ~ [& default-tests] + [~ ?] =+ !<([~ quiet=?] arg) [quiet default-tests] + [~ ? ^ *] =+ !<([~ quiet=? paz=(list path)] arg) [quiet paz] + [~ ? ^] =+ !<([~ quiet=? pax=path] arg) [quiet pax ~] + [~ ^ *] =+ !<([~ paz=(list path)] arg) [& paz] + [~ *] =+ !<([~ pax=path] arg) [& pax ~] + == +=. quiet.args quiet =/ bez=(list beam) (turn paz |=(p=path ~|([%test-not-beam p] (need (de-beam p))))) ;< fiz=(set [=beam test=(unit term)]) bind:m (find-test-files bez) From ab0b0d57c0189d9d25c286b22374982366b65237 Mon Sep 17 00:00:00 2001 From: pkova Date: Thu, 22 Feb 2024 17:41:54 +0200 Subject: [PATCH 171/252] ci: make tests actually run in ci --- flake.nix | 2 +- nix/test-fake-ship.nix | 13 +----- pkg/arvo/ted/test.hoon | 101 ++++++++++++++++------------------------- 3 files changed, 40 insertions(+), 76 deletions(-) diff --git a/flake.nix b/flake.nix index 5f11eca88f..c1b65efed6 100644 --- a/flake.nix +++ b/flake.nix @@ -3,7 +3,7 @@ flake-utils.url = "github:numtide/flake-utils"; tools = { flake = false; - url = "github:urbit/tools"; + url = "github:urbit/tools/d454e2482c3d4820d37db6d5625a6d40db975864"; }; }; diff --git a/nix/test-fake-ship.nix b/nix/test-fake-ship.nix index eeb3b9bd4f..b593ea0a38 100644 --- a/nix/test-fake-ship.nix +++ b/nix/test-fake-ship.nix @@ -28,17 +28,6 @@ let -- ''; - testThread = dojoCommand: - pkgs.writeTextFile { - name = "${dojoCommand}.hoon"; - text = '' - ${poke} - =/ m (strand ,vase) - ;< [=ship =desk =case] bind:m get-beak - ;< ok=? bind:m (poke [ship %dojo] %lens-command !>([%$ [%dojo '${dojoCommand}'] [%stdout ~]])) - (pure:m !>(ok)) - ''; - }; appThread = generator: app: pkgs.writeTextFile { name = ":${app}|${generator}.hoon"; @@ -87,7 +76,7 @@ in pkgs.stdenvNoCC.mkDerivation { sleep 2 - ${click} -k -p -i ${testThread "-test %/tests ~"} ./pier + ${click} -c ./pier "[0 %fyrd [%base %test %noun %noun 0]]" ${click} -k -p -i ${pokeApp "%agents" "noun" "test"} ./pier ${click} -k -p -i ${pokeApp "%generators" "noun" "test"} ./pier diff --git a/pkg/arvo/ted/test.hoon b/pkg/arvo/ted/test.hoon index 16089e0914..e6dffabd94 100644 --- a/pkg/arvo/ted/test.hoon +++ b/pkg/arvo/ted/test.hoon @@ -7,52 +7,42 @@ :: $test-arm: test with name (derived from its arm name in a test core) :: $test-func: single test, as gate; sample is entropy, produces failures :: -+$ test [=beam func=test-func] ++$ test [=path func=test-func] +$ test-arm [name=term func=test-func] +$ test-func (trap tang) -+$ args quiet=? -- => -|_ =args -++ build-file - |= =beam - =/ m (strand ,[(unit vase) tang]) - ^- form:m - ;< res=(unit vase) bind:m - (build-file:strandio beam) - %+ pure:m res - ?. =(res ~) - ~ - ~[leaf+"FAILED"] - :: +run-test: execute an individual test +|% +:: +run-test: execute an individual test :: ++ run-test - |= [bem=beam test=test-func] - ^- [ok=? =tang] + |= [pax=path test=test-func] + ^- [ok=? output=tang result=tang] + =+ name=(spud pax) =+ run=(mule test) ?- -.run - %| |+p.run + %| |+[p.run [leaf+"CRASHED {name}" ~]] %& ?: =(~ p.run) - &+~ - |+(flop `tang`[leaf+"FAILED" p.run]) + &+[p.run [leaf+"OK {name}" ~]] + |+[p.run [leaf+"FAILED {name}" ~]] == :: +resolve-test-paths: add test names to file paths to form full identifiers :: ++ resolve-test-paths - |= paths-to-tests=(map beam (list test-arm)) + |= paths-to-tests=(map path (list test-arm)) ^- (list test) - %- sort :_ |=([a=test b=test] !(aor s.beam.a s.beam.b)) + %- sort :_ |=([a=test b=test] !(aor path.a path.b)) ^- (list test) %- zing %+ turn ~(tap by paths-to-tests) - |= [=beam test-arms=(list test-arm)] + |= [=path test-arms=(list test-arm)] ^- (list test) :: for each test, add the test's name to :path :: %+ turn test-arms |= =test-arm ^- test - [beam(s (weld s.beam /[name.test-arm])) func.test-arm] + [(weld path /[name.test-arm]) func.test-arm] :: +get-test-arms: convert test arms to functions and produce them :: ++ get-test-arms @@ -65,7 +55,7 @@ =/ fire-arm=nock ~| [%failed-to-compile-test-arm name] q:(~(mint ut typ) p:!>(*tang) [%limb name]) - [name |.(;;(tang ?:(quiet.args .*(cor fire-arm) ~>(%bout.[1 name] .*(cor fire-arm)))))] + [name |.(;;(tang ~>(%bout.[1 name] .*(cor fire-arm))))] :: +has-test-prefix: does the arm define a test we should run? :: ++ has-test-prefix @@ -102,66 +92,51 @@ ?. hov ~|(no-tests-at-path+i.bez !!) loop(bez t.bez, fiz (~(put in fiz) [[-.i.bez (snoc xup %hoon)] `tex])) -++ print-failures - |= ls=(list [=beam =tang]) - ^+ same - ?~ ls - same - =/ =tank - [%rose ["\0a" "/={(trip q.beam.i.ls)}={(spud s.beam.i.ls)}:\0a" ""] tang.i.ls] - ~> %slog.[3 tank] - $(ls t.ls) -- ^- thread:spider |= arg=vase =/ m (strand ,vase) ^- form:m ;< =bowl:strand bind:m get-bowl:strandio -=/ [quiet=? paz=(list path)] - :: if no args, test everything under /=base=/tests +=/ paz=(list path) + :: if no args, test everything under /=base=/tests :: - =* default-tests + ?~ q.arg ~[/(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/tests] - ?+ q.arg !! - ~ [& default-tests] - [~ ?] =+ !<([~ quiet=?] arg) [quiet default-tests] - [~ ? ^ *] =+ !<([~ quiet=? paz=(list path)] arg) [quiet paz] - [~ ? ^] =+ !<([~ quiet=? pax=path] arg) [quiet pax ~] - [~ ^ *] =+ !<([~ paz=(list path)] arg) [& paz] - [~ *] =+ !<([~ pax=path] arg) [& pax ~] - == -=. quiet.args quiet + :: else cast path to ~[path] if needed + :: + ?~ +.q.arg + ~[/(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/tests] + ?@ +<.q.arg + [(tail !<([~ path] arg)) ~] + (tail !<([~ (list path)] arg)) =/ bez=(list beam) (turn paz |=(p=path ~|([%test-not-beam p] (need (de-beam p))))) ;< fiz=(set [=beam test=(unit term)]) bind:m (find-test-files bez) => .(fiz (sort ~(tap in fiz) aor)) -=| test-arms=(map beam (list test-arm)) -=| build-failed=(list [beam tang]) +=| test-arms=(map path (list test-arm)) +=| build-ok=? |- ^- form:m =* gather-tests $ ?^ fiz - ;< [cor=(unit vase) =tang] bind:m (build-file beam.i.fiz) + ;< cor=(unit vase) bind:m (build-file:strandio beam.i.fiz) ?~ cor - gather-tests(fiz t.fiz, build-failed [[beam.i.fiz tang] build-failed]) + ~> %slog.3^leaf+"FAILED {(spud s.beam.i.fiz)} (build)" + gather-tests(fiz t.fiz, build-ok |) + ~> %slog.0^leaf+"built {(spud s.beam.i.fiz)}" =/ arms=(list test-arm) (get-test-arms u.cor) :: if test path specified an arm prefix, filter arms to match =? arms ?=(^ test.i.fiz) %+ skim arms |= test-arm =((end [3 (met 3 u.test.i.fiz)] name) u.test.i.fiz) - =. test-arms (~(put by test-arms) beam.i.fiz(s (snip s.beam.i.fiz)) arms) + =. test-arms (~(put by test-arms) (snip s.beam.i.fiz) arms) gather-tests(fiz t.fiz) -=; res=_build-failed - %- (print-failures res) - %- pure:m !> ^= failed - %+ turn res - |= [=beam *] - beam +%- pure:m !> ^= ok %+ roll (resolve-test-paths test-arms) -|= [[=beam =test-func] failed=_build-failed] -^+ failed -=/ res (run-test beam test-func) -?: -.res - failed -:_ failed -[beam +.res] +|= [[=path =test-func] ok=_build-ok] +^+ ok +=/ res (run-test path test-func) +%- (%*(. slog pri ?:(ok.res 0 3)) output.res) +%- (%*(. slog pri ?:(ok.res 0 3)) result.res) +&(ok ok.res) \ No newline at end of file From 630d5d01eabbd71dfaff4f683b3d01eb96add4c0 Mon Sep 17 00:00:00 2001 From: Pyry Kovanen Date: Tue, 5 Mar 2024 18:29:04 +0200 Subject: [PATCH 172/252] eyre: do not store localhost as eauth-url --- pkg/arvo/sys/vane/eyre.hoon | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index 4ef00859ee..190a419588 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -1306,7 +1306,8 @@ o(session-id session.fex) :: store the hostname used for this login, later reuse it for eauth :: - =? endpoint.auth.state ?=(^ host) + =? endpoint.auth.state + &(?=(^ host) !=('localhost' (fall (rush u.host host-sans-port) ''))) %- (trace 2 |.("eauth: storing endpoint at {(trip u.host)}")) =/ new-auth=(unit @t) `(cat 3 ?:(secure 'https://' 'http://') u.host) From 26dc9c4bca414befab6f8d0823ed44c22e7c1b79 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Mon, 11 Mar 2024 13:30:13 +0100 Subject: [PATCH 173/252] spider: track remote scry requests --- pkg/arvo/app/spider.hoon | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/app/spider.hoon b/pkg/arvo/app/spider.hoon index 98d6e0e172..ca65eb4466 100644 --- a/pkg/arvo/app/spider.hoon +++ b/pkg/arvo/app/spider.hoon @@ -490,9 +490,9 @@ ^- [(list card) _state] %+ roll cards.r |= [=card cards=(list card) s=_state] - :_ =? scrying.s ?=([%pass ^ %arvo %a %keen @ *] card) - :: wire ship path - scrying.s :: (~(put ju scrying.s) tid [&2 +>+>+>]:card) + :_ =? scrying.s ?=([%pass ^ %arvo %a %keen ?(~ ^) @ *] card) + :: &2=wire &7=ship 7|=path + (~(put ju scrying.s) tid [&2 &7 |7]:card) s :_ cards ^- ^card From 4dbdc799b936fd7b781d9e5a62009824f33ac78b Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Wed, 13 Mar 2024 14:03:01 -0400 Subject: [PATCH 174/252] clay: respect %rein for desks without a bill --- pkg/arvo/sys/vane/clay.hoon | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index df4457570a..d878d82d90 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -4648,10 +4648,12 @@ $(desks t.desks) =^ res den (aver:den ~ %x da+now /desk/bill) =. ruf +:abet:den - ?. ?=([~ ~ *] res) + =/ bill + ?. ?=([~ ~ *] res) *bill + ~|([%building-bill i.desks] !<(bill q.u.u.res)) + ?~ rid=(override bill ren.dom.den) + %- (trace 2 |.("{} has no dudes")) $(desks t.desks) - =/ bill ~| [%building-bill i.desks] !<(bill q.u.u.res) - =/ rid (override bill ren.dom.den) %- %+ trace 2 |. "{} has bill {} and rein {}, so {}" =^ sats ..abet $(desks t.desks) @@ -4674,22 +4676,9 @@ :: +override: apply rein to bill :: ++ override - |= [duz=bill ren=(map dude:gall ?)] - ^- bill - =. duz - %+ skip duz - |= =dude:gall - =(`| (~(get by ren) dude)) - :: - =/ dus (sy duz) - =. duz - %+ weld duz - %+ murn ~(tap by ren) - |= [=dude:gall on=?] - ?: &(?=(%& on) !(~(has in dus) dude)) - `u=dude - ~ - duz + |= [duz=bill ren=(map dude:gall ?)] ^- bill + =/ out=bill (skip duz ~(has by ren)) + (~(rep by ren) |=([[d=dude:gall r=?] =_out] ?.(r out [d out]))) :: +apply-precedence: resolve conflicts between $bill's :: :: policy is to crash if multiple desks are trying to run the same From 6cb77022673433a950211b0c5d1d57f3d2ac2d59 Mon Sep 17 00:00:00 2001 From: midden-fabler Date: Thu, 14 Mar 2024 14:48:33 -0400 Subject: [PATCH 175/252] gen: |cp add recursive copy --- pkg/arvo/gen/hood/cp.hoon | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/pkg/arvo/gen/hood/cp.hoon b/pkg/arvo/gen/hood/cp.hoon index d4a0444a84..430cdb4972 100644 --- a/pkg/arvo/gen/hood/cp.hoon +++ b/pkg/arvo/gen/hood/cp.hoon @@ -2,16 +2,36 @@ :: :::: /hoon/cp/hood/gen :: +:: XX clay discards the type, so %noun is used +:: copy by lobe should be used, if implemented +:: /? 310 :- %say =, space:userlib -|= [^ [input=path output=path ~] ~] +|= [^ [input=path output=path ~] r=_|] :- %kiln-info -?. =(-:(flop input) -:(flop output)) - ["Can't move to a different mark" ~] -=+ dir=.^(arch %cy input) -?~ fil.dir - ~& "No such file:" - [ ~] -:- "copied" -`(foal output -:(flop input) [%atom %t ~] .^(* %cx input)) :: XX type +^- [mez=tape tor=(unit toro:clay)] +?. r + ?. =(-:(flop input) -:(flop output)) + ["Can't move to a different mark" ~] + ?~ =<(fil .^(arch %cy input)) + ~& "No such file:" + [ ~] + :- "copied" + `(foal output -:(flop input) [%noun .^(* %cx input)]) +?~ in-beam=(de-beam input) ["bad input path" ~] +?~ =<(dir .^(arch %cy input)) ["input path isn't a directory" ~] +?~ out-beam=(de-beam output) ["bad output path" ~] +=/ in-beak=beak [p q r]:u.in-beam +=/ out-beak=beak [p q r]:u.out-beam +=/ =soba:clay + %+ murn .^((list path) %ct input) + |= pax=path + ?: =(1 (sub (lent pax) (lent s.u.in-beam))) ~ + =/ =cage + :- -:(flop pax) + [%noun .^(* %cx (en-beam in-beak pax))] + =/ =spur (weld s.u.out-beam (slag (lent s.u.in-beam) pax)) + `[spur (feel (en-beam out-beak spur) cage)] +?~ soba ["nothing to copy" ~] +["copied" `[q.out-beak [%& soba]]] From 07a952bb5a874983a0b9016cc29c9e7e82d29b95 Mon Sep 17 00:00:00 2001 From: pkova Date: Fri, 15 Mar 2024 19:34:19 +0200 Subject: [PATCH 176/252] ping: only ping galaxy --- pkg/arvo/app/ping.hoon | 419 +++++++---------------------------------- 1 file changed, 69 insertions(+), 350 deletions(-) diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index 665efe5272..52bcf93fc1 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -20,22 +20,8 @@ :: ++ nat-timeout ~s25 :: -:: How often to check our IP when we know we're not behind a NAT. -:: -++ ip-timeout ~m5 -:: -:: Chosen because it's run by Cloudflare, and others I tried were -:: inconsistently slow. -:: -++ ip-reflector 'https://icanhazip.com' -:: +$ card card:agent:gall -+$ ship-state - $% [%idle ~] - [%poking ~] - [%http until=@da] - [%waiting until=@da] - == +:: +$ state-2 $: %2 ships=(set ship) @@ -48,256 +34,39 @@ [%one ~] == == ++$ state-3 + $: %3 + mode=?(%formal %informal) + sent=? + galaxy=@p + == -- :: %- agent:dbug :: -=| state=state-2 +=| state=state-3 => |% - :: Bind for the the writer monad on (quip effect state) - :: - ++ rind - |* [effect=mold state=*] - |* state-type=mold - |= $: m-b=(quip effect state-type) - fun=$-(state-type (quip effect state-type)) - == - ^- (quip effect state-type) - =^ effects-1=(list effect) state m-b - =^ effects-2=(list effect) state (fun state) - [(weld effects-1 effects-2) state] - :: - ++ once - |= =cord - =(cord (scot %uw nonce.state)) - :: - :: Subsystem to keep track of which ships to ping across breaches - :: and sponsorship changes - :: - ++ ships - =| force=_| - |% - ++ rind (^rind card state) - ++ kick - |= [our=@p now=@da] - ^- (quip card _state) - :: ?: =(%czar (clan:title our)) - :: `state - :: - :: NB: !! This includes our own ship, and for moons, this is - :: what has caused Jael to fetch our own rift from our parent. - :: This role may be taken by Ames's subscription to - :: %public-keys, but this must be tested before changing the - :: behavior here. - :: - =/ new-ships (~(gas in *(set ship)) (saxo:title our now our)) - =/ removed (~(dif in ships.state) new-ships) - =/ added (~(dif in new-ships) ships.state) - ;< new-state=_state rind - ?~ removed `state - [[%pass /jael %arvo %j %nuke removed]~ state] - =. state new-state - :: - ;< new-state=_state rind - ?~ added `state - [[%pass /jael %arvo %j %public-keys added]~ state] - =. state new-state - :: - :: Kick even if ships weren't added or removed - :: - (kick-pings our now new-ships force) - :: - :: Kick whenever we get a response. We really care about - :: breaches and sponsorship changes. - :: - :: Delay until next event in case of breach, so that ames can - :: clear its state. - :: - ++ take-jael - |= now=@da - ^- (quip card _state) - [[%pass /jael/delay %arvo %b %wait now]~ state] - :: - ++ take-delay %*(kick ships force %.y) - -- - :: - :: Starts pinging a new set of `ships`. - :: - ++ kick-pings - |= [our=@p now=@da ships=(set ship) force=?] - ^- (quip card _state) - =: nonce.state +(nonce.state) - ships.state ships - == - :: - ?: force (kick:nat our) - ?- -.plan.state - %off `state - %nat (kick:nat our) - %one (kick:one our) - %pub (kick:pub our now) - == - :: - :: Subsystem for pinging our sponsors when we might be behind a NAT - :: XX no longer true if using STUN-enabled vere 2.XX - :: Ping each ship every 25 seconds to keep the pinhole open. - :: This is expensive, but if you don't do it and you are behind a - :: NAT, you will stop receiving packets from other ships except - :: during the 30 seconds following each packet you send. - :: - ++ nat - ?> ?=(%nat -.plan.state) - |% - ++ rind (^rind card state) - ++ kick - |= our=@p - ^- (quip card _state) - =/ ships ~(tap in ships.state) - |- ^- (quip card _state) - ?~ ships `state - ?: =(our i.ships) $(ships t.ships) - ;< new-state=_state rind (send-ping i.ships) - =. state new-state - $(ships t.ships) - :: - ++ send-ping - |= =ship - ^- (quip card _state) - :_ state - =/ wire /nat/(scot %uw nonce.state)/ping/(scot %p ship) - [%pass wire %agent [ship %ping] %poke %noun !>(~)]~ - :: - ++ take-ping - |= [now=@da =wire error=(unit tang)] - ^- (quip card _state) - ?. ?=([%nat @ %ping @ ~] wire) `state - ?. (once i.t.wire) `state - =/ ship (slav %p i.t.t.t.wire) - %- (slog ?~(error ~ ['ping: got nack' >ship< u.error])) - :_ state - =/ wire /nat/(scot %uw nonce.state)/wait/(scot %p ship) - [%pass wire %arvo %b %wait (add nat-timeout now)]~ - :: - ++ take-wait - |= =wire - ^- (quip card _state) - ?. ?=([%nat @ %wait @ ~] wire) `state - ?. (once i.t.wire) `state - =/ ship (slav %p i.t.t.t.wire) - (send-ping ship) - -- - :: - :: Subsystem for pinging our sponsors when we know we're not behind a NAT - :: - :: Check our IP address every minute, and only if it changes, - :: ping all our sponsors. - :: - ++ pub - ?> ?=(%pub -.plan.state) - |% - ++ rind (^rind card state) - ++ kick - |= [our=@p now=@da] - ^- (quip card _state) - ;< new-state=_state rind (send-pings our) - =. state new-state - :: - ;< new-state=_state rind check-ip - =. state new-state - :: - (set-timer now) - :: - ++ send-pings - |= our=@p - ^- (quip card _state) - :_ state - %+ murn ~(tap in ships.state) - |= =ship - ?: =(our ship) - ~ - =/ wire /pub/(scot %uw nonce.state)/ping/(scot %p ship) - `u=[%pass wire %agent [ship %ping] %poke %noun !>(~)] - :: - ++ take-pings - |= [=wire error=(unit tang)] - ^- (quip card _state) - ?. ?=([%pub @ %ping @ ~] wire) `state - ?. (once i.t.wire) `state - =/ ship (slav %p i.t.t.t.wire) - %- (slog ?~(error ~ ['ping: got nack' >ship< u.error])) - `state - :: - ++ check-ip - ^- (quip card _state) - :_ state - =/ wire /pub/(scot %uw nonce.state)/ip - =/ =request:http [%'GET' ip-reflector ~ ~] - [%pass wire %arvo %i %request request *outbound-config:iris]~ - :: - ++ take-ip - |= [our=@p =wire resp=client-response:iris] - ^- (quip card _state) - ?. ?=([%pub @ %ip ~] wire) `state - ?. (once i.t.wire) `state - :: - ?. ?=(%finished -.resp) `state :: will retry in a minute - ?. ?=(%200 status-code.response-header.resp) - =* s status-code.response-header.resp - %- (slog leaf+"ping: ip check failed: {}" ~) - `state - :: - ?~ full-file.resp - %- (slog 'ping: ip check body empty' ~) - `state - :: - =* body q.data.u.full-file.resp - ?~ body - %- (slog 'ping: ip check body empty' ~) - `state - :: - =/ ip (end [3 (dec (met 3 body))] body) - ?: =(ip.plan.state `ip) `state - :: - =. ip.plan.state `ip - (send-pings our) - :: - ++ set-timer - |= now=@da - ^- (quip card _state) - =/ =wire /pub/(scot %uw nonce.state)/wait - [[%pass wire %arvo %b %wait (add ip-timeout now)]~ state] - :: - ++ take-wait - |= [our=@p now=@da =wire] - ^- (quip card _state) - ?. ?=([%pub @ %wait ~] wire) `state - ?. (once i.t.wire) `state - ;< new-state=_state rind check-ip - =. state new-state - :: - (set-timer now) - -- - :: Subsystem for formally acknowledging a change in our IP:PORT - :: - :: If our sponsor sends a STUN response, with an IP different than what - :: we had previously cached, we formally acknowledge this change by - :: sending one %poke to every ship in the sponsorship chain. - :: - ++ one - ?> ?=(%one -.plan.state) - |% - ++ kick - |= our=@p - ^- (quip card _state) - :_ state - %- ~(rep in ships.state) - |= [=ship cards=(list card)] - ?: =(our ship) cards - =/ wire /one/(scot %uw nonce.state)/ping/(scot %p ship) - :_ cards ^- card - [%pass wire %agent [ship %ping] %poke %noun !>(~)] - -- - -- + ++ galaxy-for + |= [=ship =bowl:gall] + ^- @p + =/ next (sein:title [our now our]:bowl) + ?: ?=(%czar (clan:title next)) + next + $(ship next) + :: + ++ wait-card + |= now=@da + ^- card + [%pass /wait %arvo %b %wait (add nat-timeout now)] + :: + ++ ping + |= =ship + ^- (quip card _state) + ?: &(sent.state =(ship galaxy.state)) + [~ state] + :_ state(sent %.y, galaxy ship) + [%pass /ping/(scot %p ship) %agent [ship %ping] %poke %noun !>(~)]~ +-- %+ verb | ^- agent:gall |_ =bowl:gall @@ -308,23 +77,29 @@ :: ++ on-init ^- [(list card) _this] - =. plan.state [%nat ~] - =^ cards state (kick:ships our.bowl now.bowl) - [cards this] + =. mode.state %formal + =. sent.state %.n + =. galaxy.state (galaxy-for our.bowl bowl) + [~ this] :: -++ on-save !>(state) ++ on-load |= old-vase=vase |^ =/ old !<(state-any old-vase) =? old ?=(%0 -.old) (state-0-to-1 old) =? old ?=(%1 -.old) (state-1-to-2 old) - ?> ?=(%2 -.old) + =? old ?=(%2 -.old) (state-2-to-3 old) + ?> ?=(%3 -.old) =. state old - =^ cards state (kick:ships our.bowl now.bowl) - [cards this] + [~ this] :: - +$ state-any $%(state-0 state-1 state-2) + +$ ship-state + $% [%idle ~] + [%poking ~] + [%http until=@da] + [%waiting until=@da] + == + +$ state-any $%(state-0 state-1 state-2 state-3) +$ state-0 [%0 ships=(map ship [=rift =ship-state])] +$ state-1 $: %1 @@ -345,6 +120,11 @@ |= old=state-1 ^- state-2 old(- %2) + :: + ++ state-2-to-3 + |= old=state-2 + ^- state-3 + [%3 %formal %.n (galaxy-for our.bowl bowl)] -- :: +on-poke: positively acknowledge pokes :: @@ -355,48 +135,16 @@ :: =^ cards state ?: ?=([%kick ?] q.vase) - :: NB: ames calls this on %born (with fail=%.n) and after not hearing STUN - :: responses for more than ~s5 (with fail=%.y) - :: - :: if %ping was turned off (due to a successfull STUN) but we failed - :: to get a STUN response in time switch to %nat and start a ~s25 timer - :: - :: if the %kick has fail=%.n (e.g. for every %born), the plan will remain - :: unchanged, but we will innitiate a new round of %poke pings with - :: increasing nonce. - :: - :: if we get repeated [%stun fail=&], but we are already in either %nat - :: or %pub, do nothing, since there are already timers in place to %ping - :: repeatedly. - :: - =/ stun-failed=? &(?=([%off ~] plan.state) =(+.q.vase %.y)) - ?: &(?=([%off ~] plan.state) =(+.q.vase %.n)) - :: ignore restarts if we were already STUNning, if ip:port changed - :: %once will trigger one formal %ping - :: - `state - =? plan.state stun-failed - [%nat ~] - ?: &(!stun-failed =(+.q.vase %.y)) - `state - (kick:ships our.bowl now.bowl) - ?: =(q.vase %stop) :: NB: ames calls this on [%stun fail=%.n] - =. plan.state [%off ~] - (kick:ships our.bowl now.bowl) - ?: &(=(q.vase %once) =(%off -.plan.state)) :: NB: ames calls this on %once - =. plan.state [%one ~] - (kick:ships our.bowl now.bowl) - ?: =(q.vase %nat) - =. plan.state [%nat ~] - (kick:ships our.bowl now.bowl) - ?: =(q.vase %no-nat) - =. plan.state [%pub ~] - (kick:ships our.bowl now.bowl) + =? mode.state =(+.q.vase %.y) + %formal + (ping (galaxy-for our.bowl bowl)) + :: + ?: |(=(q.vase %once) =(q.vase %stop)) :: NB: ames calls this on %once + =. mode.state %informal + (ping (galaxy-for our.bowl bowl)) `state [cards this] :: -++ on-watch on-watch:def -++ on-leave on-leave:def ++ on-peek |= =path ^- (unit (unit cage)) @@ -406,25 +154,13 @@ ++ on-agent |= [=wire =sign:agent:gall] ^- [(list card) _this] - =^ cards state - ?+ wire `state - [%nat *] - ?. ?=(%nat -.plan.state) `state - ?. ?=(%poke-ack -.sign) `state - (take-ping:nat now.bowl wire p.sign) - :: - [%pub *] - ?. ?=(%pub -.plan.state) `state - ?. ?=(%poke-ack -.sign) `state - (take-pings:pub wire p.sign) - :: - [%one *] - ?. ?=(%one -.plan.state) `state - ?: ?=(%poke-ack -.sign) `state - :: XX handle error? - `state - == - [cards this] + ?. ?=([%ping s=@ *] wire) + `this + ?. =(galaxy.state (slav %p i.t.wire)) + `this + =. sent.state %.n + ?. ?=(%formal mode.state) `this + [[(wait-card now.bowl)]~ this] :: +on-arvo: handle timer firing :: ++ on-arvo @@ -432,36 +168,19 @@ ^- [(list card) _this] =^ cards state ?+ wire `state - [%jael %delay ~] + [%wait *] + ?. ?=(%formal mode.state) `state ?> ?=(%wake +<.sign-arvo) ?^ error.sign-arvo - %- (slog 'ping: strange jael wake fail!' u.error.sign-arvo) + %- (slog 'ping: strange wake fail!' u.error.sign-arvo) `state - (take-delay:ships our.bowl now.bowl) + (ping (galaxy-for our.bowl bowl)) :: - [%jael ~] - ?> ?=(%public-keys +<.sign-arvo) - (take-jael:ships now.bowl) - :: - [%nat *] - ?. ?=(%nat -.plan.state) `state - ?> ?=(%wake +<.sign-arvo) - ?^ error.sign-arvo - %- (slog 'ping: strange nat wake fail!' u.error.sign-arvo) - `state - (take-wait:nat wire) - :: - [%pub @ %ip *] - ?. ?=(%pub -.plan.state) `state - ?> ?=(%http-response +<.sign-arvo) - (take-ip:pub our.bowl wire client-response.sign-arvo) - :: - [%pub @ %wait *] - ?. ?=(%pub -.plan.state) `state - ?> ?=(%wake +<.sign-arvo) - (take-wait:pub our.bowl now.bowl wire) == [cards this] :: +++ on-save !>(state) ++ on-fail on-fail:def +++ on-watch on-watch:def +++ on-leave on-leave:def -- From d3ad83da0550b4deb9204d6a0c6a11b3956a24ff Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Sat, 16 Mar 2024 07:57:10 +0100 Subject: [PATCH 177/252] ames: emit %saxo on molt --- pkg/arvo/sys/vane/ames.hoon | 54 ++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 584b4fa41c..bf7f1a3197 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -619,7 +619,7 @@ :: dead: dead flow consolidation timer and recork timer, if set :: +$ ames-state - $+ ames-state-19 + $+ ames-state-20 $: peers=(map ship ship-state) =unix=duct =life @@ -1327,6 +1327,8 @@ deep-task-14 :: introduced in state %14, modified in %19 $<(?(%keen %deep) task) == +:: ++$ ames-state-19 ames-state :: $bug: debug printing configuration :: :: veb: verbosity toggles @@ -1479,7 +1481,8 @@ [%16 ames-state-16] [%17 ames-state-17] [%18 ames-state-17] - [%19 ^ames-state] + [%19 ames-state-19] + [%20 ^ames-state] == :: |= [now=@da eny=@ rof=roof] @@ -1602,7 +1605,7 @@ :: lifecycle arms; mostly pass-throughs to the contained adult ames :: ++ scry scry:adult-core - ++ stay [%19 %larva queued-events ames-state.adult-gate] + ++ stay [%20 %larva queued-events ames-state.adult-gate] ++ load |= $= old $% $: %4 @@ -1711,6 +1714,13 @@ [%adult state=ames-state-18] == == $: %19 :: %keen & %deep modified + $% $: %larva + events=(qeu queued-event) + state=ames-state-19 + == + [%adult state=ames-state-19] + == == + $: %20 :: start informal %ping $% $: %larva events=(qeu queued-event) state=_ames-state.adult-gate @@ -1899,12 +1909,23 @@ =. queued-events (event-17-and-18-to-last events.old) larval-gate :: - [%19 %adult *] (load:adult-core %19 state.old) + [%19 %adult *] + =. cached-state `[%19 state.old] + ~> %slog.0^leaf/"ames: larva %19 reload" + larval-gate :: [%19 %larva *] ~> %slog.1^leaf/"ames: larva %19 load" + =. cached-state `[%19 state.old] =. queued-events events.old - =. adult-gate (load:adult-core %19 state.old) + larval-gate + :: + [%20 %adult *] (load:adult-core %20 state.old) + :: + [%20 %larva *] + ~> %slog.1^leaf/"ames: larva %20 load" + =. queued-events events.old + =. adult-gate (load:adult-core %20 state.old) larval-gate == :: @@ -2017,7 +2038,22 @@ :: =? u.cached-state ?=(%18 -.u.cached-state) 19+(state-18-to-19:load:adult-core +.u.cached-state) - ?> ?=(%19 -.u.cached-state) + =^ moz u.cached-state + ?. ?=(%19 -.u.cached-state) [~ u.cached-state] + :_ [%20 +.u.cached-state] + :: if we didn't have a unix-duct, the larval stage will be expecting + :: a %born task from unix, which will in turn emit the %saxo that will + :: start sending informal pings to the sponsorship chain + :: + ?~ unix-duct.+.u.cached-state + ~ + ~> %slog.0^leaf/"ames: retrieving sponsorship chain" + ^- (list move) + :_ moz + =+ ev-core=(ev [now eny rof] [/saxo]~ ames-state.adult-gate) + [unix-duct.+.u.cached-state %give %saxo get-sponsors:ev-core] + :: + ?> ?=(%20 -.u.cached-state) =. ames-state.adult-gate +.u.cached-state [moz larval-core(cached-state ~)] -- @@ -5392,15 +5428,15 @@ [moves ames-gate] :: +stay: extract state before reload :: -++ stay [%19 %adult ames-state] +++ stay [%20 %adult ames-state] :: +load: load in old state after reload :: ++ load =< |= $= old-state - $% [%19 ^ames-state] + $% [%20 ^ames-state] == ^+ ames-gate - ?> ?=(%19 -.old-state) + ?> ?=(%20 -.old-state) ames-gate(ames-state +.old-state) :: all state transitions are called from larval ames :: From b758ed6683561d2bc3b51a78851d21804679edcb Mon Sep 17 00:00:00 2001 From: Tinnus Napbus Date: Sun, 17 Mar 2024 04:44:33 +1300 Subject: [PATCH 178/252] vats: fix vats and make faster --- pkg/arvo/gen/vats.hoon | 10 +- pkg/base-dev/sur/hood.hoon | 259 +++++++++++++++++++++++-------------- 2 files changed, 166 insertions(+), 103 deletions(-) diff --git a/pkg/arvo/gen/vats.hoon b/pkg/arvo/gen/vats.hoon index 9070109786..469bae55e6 100644 --- a/pkg/arvo/gen/vats.hoon +++ b/pkg/arvo/gen/vats.hoon @@ -17,12 +17,4 @@ [filt=@tas verb=_|] == :- %tang ^- tang -?. &(=(~ deks) =(%$ filt)) - (report-vats p.bec now deks filt verb) -%- zing -%+ turn - %+ sort - =/ sed .^((set desk) %cd /(scot %p p.bec)//(scot %da now)) - (sort ~(tap in sed) |=([a=@ b=@] !(aor a b))) - |=([a=desk b=desk] ?|(=(a %kids) =(b %base))) -|=(syd=desk (report-vat (report-prep p.bec now) p.bec now syd verb)) +(report-vats p.bec now deks filt verb) diff --git a/pkg/base-dev/sur/hood.hoon b/pkg/base-dev/sur/hood.hoon index 89a4d0a1d2..1a87b0765e 100644 --- a/pkg/base-dev/sur/hood.hoon +++ b/pkg/base-dev/sur/hood.hoon @@ -59,7 +59,7 @@ =/ ego (scot %p our) =/ wen (scot %da now) :* .^(rock:tire %cx /[ego]//[wen]/tire) - .^(=cone %cx /[ego]//[wen]/domes) + .^(cone %cx /[ego]//[wen]/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 @@ -72,44 +72,73 @@ ^- tang =/ ego (scot %p our) =/ wen (scot %da now) - =/ prep (report-prep our now) - ?~ filt + =+ prep=[tyr cone sor zyn]=(report-prep our now) + ?: =(%$ filt) %- zing - %+ turn (flop desks) + %+ turn + ?^ desks + `(list desk)`desks + %+ sort ~(tap in ~(key by tyr.prep)) + |= [a=desk b=desk] + ?: |(=(a %kids) =(b %base)) & + ?: |(=(a %base) =(b %kids)) | + (aor b a) |=(syd=@tas (report-vat prep our now syd verb)) - =/ deks + =/ deks=(list [=desk =zest wic=(set weft)]) ?~ desks - %+ sort - (sort ~(tap by -.prep) |=([[a=@ *] b=@ *] !(aor a b))) - |=([[a=@ *] [b=@ *]] ?|(=(a %kids) =(b %base))) - %+ skip ~(tap by -.prep) - |=([syd=@tas *] =(~ (find ~[syd] desks))) - =. deks (skim deks |=([=desk *] ((sane %tas) desk))) + %+ sort ~(tap by tyr.prep) + |= [[a=desk *] [b=desk *]] + ?: |(=(a %kids) =(b %base)) & + ?: |(=(a %base) =(b %kids)) | + (aor b a) + %+ murn `(list desk)`desks + |= des=desk + ^- (unit [=desk =zest wic=(set weft)]) + ?~ got=(~(get by tyr.prep) des) + ~ + `[des u.got] ?: =(filt %blocking) - =/ base-wic - %+ sort ~(tap by wic:(~(got by -.prep) %base)) - |=([[* a=@ud] [* b=@ud]] (gth a b)) - ?~ base-wic ~[leaf+"%base already up-to-date"] + =/ base-weft=(unit weft) + %- ~(rep in wic:(~(got by tyr.prep) %base)) + |= [=weft out=(unit weft)] + ?~ out + `weft + ?: (lth num.weft num.u.out) + out + `weft + ?~ base-weft ~['%base already up-to-date'] =/ blockers=(list desk) - %+ turn - %+ skip ~(tap in -.prep) - |= [* [zest=@tas wic=(set weft)]] - ?. =(zest %live) & - (~(has in wic) i.base-wic) - |=([syd=desk *] syd) - ?~ blockers ~[leaf+"No desks blocking upgrade, run |bump to apply"] - :- [%rose [" %" "To unblock upgrade run |suspend %" ""] blockers] + %+ sort + ^- (list desk) + %+ murn deks + |= [=desk =zest wic=(set weft)] + ^- (unit ^desk) + ?. =(%live zest) + ~ + ?: (~(has in wic) u.base-weft) + ~ + `desk + aor + ?~ blockers ~['No desks blocking upgrade'] %- zing - %+ turn (flop blockers) + ^- (list tang) + :- :~ %+ rap 3 + :~ 'These desks are blocking upgrade to [%zuse ' + (scot %ud num.u.base-weft) + ']:' + == == + %+ turn blockers |=(syd=desk (report-vat prep our now syd verb)) :: %- zing %+ turn ?+ filt !! - :: %exists %+ skip deks - |=([syd=desk *] =(ud:.^(cass %cw /[ego]/[syd]/[wen]) 0)) + |= [syd=desk *] + ?~ got=(~(get by cone.prep) our syd) + & + =(0 let.u.got) :: %running %+ skim deks @@ -120,12 +149,17 @@ |= [syd=@tas [zest=@tas *]] ?| =(syd %kids) =(zest %live) - =(ud:.^(cass %cw /[ego]/[syd]/[wen]) 0) + ?~ got=(~(get by cone.prep) our syd) + & + =(0 let.u.got) == :: %exists-not %+ skim deks - |=([syd=desk *] =(ud:.^(cass %cw /[ego]/[syd]/[wen]) 0)) + |= [syd=desk *] + ?~ got=(~(get by cone.prep) our syd) + | + =(0 let.u.got) == |=([syd=desk *] (report-vat prep our now syd verb)) :: +report-vat: report on a single desk installation @@ -136,34 +170,21 @@ == our=ship now=@da syd=desk verb=? == - ^- tang - =- :: hack to force wrapped rendering - :: - :: edg=6 empirically prevents dedent - :: - %+ roll - (~(win re -) [0 6]) - |=([a=tape b=(list @t)] [(crip a) b]) - :: - ^- tank + |^ ^- tang =/ ego (scot %p our) =/ wen (scot %da now) ?. ((sane %tas) syd) - leaf+"insane desk: {}" - =+ .^(=cass %cw /[ego]/[syd]/[wen]) - ?: =(ud.cass 0) - leaf+"desk does not yet exist: {}" - ?: =(%kids syd) - =+ .^(hash=@uv %cz /[ego]/[syd]/[wen]) - leaf+"%kids %cz hash: {}" - =/ kel-path - /[ego]/[syd]/[wen]/sys/kelvin - ?. .^(? %cu kel-path) - leaf+"bad desk: {}" - =+ .^(=waft %cx kel-path) - :+ %rose ["" "{}" "::"] - ^- tang + ~[(cat 3 'insane desk: %' syd)] + ?. (~(has by cone) our syd) + ~[(cat 3 'desk does not yet exist: %' syd)] =/ hash .^(@uv %cz /[ego]/[syd]/[wen]) + ?: =(%kids syd) + ~[(cat 3 '%kids %cz hash: ' (scot %uv hash))] + =/ kel-path /[ego]/[syd]/[wen]/sys/kelvin + ?. .^(? %cu kel-path) + ~[(cat 3 'bad desk: %' syd)] + =+ .^(=waft %cx kel-path) + ^- tang =/ =sink ?~ s=(~(get by sor) syd) ~ @@ -171,52 +192,102 @@ ~ `[p.u.s q.u.s [kid let]:u.z] =/ meb=(list @uv) - ?~ sink [hash]~ - (mergebase-hashes our syd now her.u.sink sud.u.sink) + ?~ sink ~[hash] + %+ turn + .^ (list tako) %cs + /[ego]/[syd]/[wen]/base/(scot %p her.u.sink)/[sud.u.sink] + == + |=(=tako .^(@uv %cs /[ego]/[syd]/[wen]/hash/(scot %uv tako))) =/ dek (~(got by tyr) syd) =/ sat ?- zest.dek - %live "running" - %dead "suspended" - %held "suspended until next update" + %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) + =/ kul=cord (print-wefts (waft-to-wefts waft)) ?. verb - :~ leaf/"/sys/kelvin: {kul}" - leaf/"%cz hash ends in: {(truncate-hash hash)}" - leaf/"app status: {sat}" - leaf/"source ship: {?~(sink <~> )}" - leaf/"pending updates: {<`(list [@tas @ud])`~(tap in wic.dek)>}" + :~ '::' + (cat 3 ' pending updates: ' (print-wefts wic.dek)) + (cat 3 ' source ship: ' ?~(sink '~' (scot %p her.u.sink))) + (cat 3 ' app status: ' sat) + (cat 3 ' %cz hash ends in: ' (print-shorthash hash)) + (cat 3 ' /sys/kelvin: ' (print-wefts (waft-to-wefts waft))) + (cat 3 '%' syd) == :: - =/ [on=(list [@tas ?]) of=(list [@tas ?])] - =/ =dome (~(got by cone) our syd) - (skid ~(tap by ren.dome) |=([* ?] +<+)) - :~ leaf/"/sys/kelvin: {kul}" - leaf/"base hash: {?.(=(1 (lent meb)) <(head meb)>)}" - leaf/"%cz hash: {}" - :: - leaf/"app status: {sat}" - leaf/"force on: {<(sort (turn on head) aor)>}" - leaf/"force off: {<(sort (turn of head) aor)>}" - :: - leaf/"publishing ship: {?~(sink <~> <(get-publisher our syd now)>)}" - leaf/"updates: {?~(sink "local" "remote")}" - leaf/"source ship: {?~(sink <~> )}" - leaf/"source desk: {?~(sink <~> )}" - leaf/"source aeon: {?~(sink <~> )}" - leaf/"kids desk: {?~(sink <~> ?~(kid.u.sink <~> ))}" - leaf/"pending updates: {<`(list [@tas @ud])`~(tap in wic.dek)>}" + =/ [on=(list @tas) of=(list @tas)] + =/ [on=(list @tas) of=(list @tas)] + %- ~(rep by ren:(~(got by cone) our syd)) + |= [[=dude:gall is-on=?] on=(list @tas) of=(list @tas)] + ?: is-on + [[dude on] of] + [on [dude of]] + [(sort on aor) (sort of aor)] + :~ '::' + (cat 3 ' pending updates: ' (print-wefts wic.dek)) + %^ cat 3 ' kids desk: ' ?~ sink '~' + ?~ kid.u.sink '~' + (cat 3 '%' u.kid.u.sink) + (cat 3 ' source aeon: ' ?~(sink '~' (scot %ud let.u.sink))) + (cat 3 ' source desk: ' ?~(sink '~' (cat 3 '%' sud.u.sink))) + (cat 3 ' source ship: ' ?~(sink '~' (scot %p her.u.sink))) + (cat 3 ' updates: ' ?~(sink 'local' 'remote')) + %^ cat 3 ' publishing ship: ' ?~ got=(get-publisher our syd now) + '~' + (scot %p u.got) + :: + (cat 3 ' force off: ' (print-agents of)) + (cat 3 ' force on: ' (print-agents on)) + (cat 3 ' app status: ' sat) + :: + (cat 3 ' %cz hash: ' (scot %uv hash)) + (cat 3 ' base hash: ' (print-mergebases meb)) + (cat 3 ' /sys/kelvin: ' (print-wefts (waft-to-wefts waft))) + (cat 3 '%' syd) == + ++ print-wefts + |= wefts=(set weft) + ^- @t + ?: =(~ wefts) + '~' + %+ rap 3 + %+ join ' ' + %+ turn + (sort ~(tap in wefts) aor) + |= =weft + ^- @t + (rap 3 '[%' lal.weft ' ' (scot %ud num.weft) ']' ~) + :: + ++ print-shorthash + |= hash=@uv + ^- @t + (crip ((v-co:co 5) (end [0 25] hash))) + :: + ++ print-mergebases + |= hashes=(list @uv) + ^- @t + ?~ hashes + '~' + ?~ t.hashes + (scot %uv i.hashes) + %+ roll `(list @uv)`hashes + |= [hash=@uv out=@t] + ?: =('' out) + (print-shorthash hash) + (rap 3 out ' ' (print-shorthash hash) ~) + :: + ++ print-agents + |= agents=(list @tas) + ^- @t + ?~ agents + '~' + %+ roll `(list @tas)`agents + |= [agent=@tas out=@tas] + ?: =('' out) + (cat 3 '%' agent) + (rap 3 out ' %' agent ~) + -- :: +report-kids: non-vat cz hash report for kids desk :: ++ report-kids @@ -226,9 +297,9 @@ =/ ego (scot %p our) =/ wen (scot %da now) ?. (~(has in .^((set desk) %cd /[ego]//[wen])) syd) - leaf/"no %kids desk" + 'no %kids desk' =+ .^(hash=@uv %cz /[ego]/[syd]/[wen]) - leaf/"%kids %cz hash: {}" + (cat 3 '%kids %cz hash: ' (scot %uv hash)) :: +read-bill-foreign: read /desk/bill from a foreign desk :: ++ read-bill-foreign @@ -288,8 +359,8 @@ =/ her (scot %p her) =/ ego (scot %p our) =/ wen (scot %da now) - %+ turn .^((list tako) %cs ~[ego syd wen %base her sud]) - |=(=tako .^(@uv %cs ~[ego syd 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 From 93b51070bcb15ec9273e5a40cdc1af14834ddc86 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Sat, 16 Mar 2024 19:54:52 +0100 Subject: [PATCH 179/252] ames: keep previous moves if no unix-duct --- pkg/arvo/sys/vane/ames.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index bf7f1a3197..868a549d3f 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -2046,7 +2046,7 @@ :: start sending informal pings to the sponsorship chain :: ?~ unix-duct.+.u.cached-state - ~ + moz ~> %slog.0^leaf/"ames: retrieving sponsorship chain" ^- (list move) :_ moz From a52492057c4b30dfdd68debceecd0c329047f2a5 Mon Sep 17 00:00:00 2001 From: Tinnus Napbus Date: Sun, 17 Mar 2024 16:47:11 +1300 Subject: [PATCH 180/252] vats: fix weft print order --- pkg/base-dev/sur/hood.hoon | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pkg/base-dev/sur/hood.hoon b/pkg/base-dev/sur/hood.hoon index 1a87b0765e..05400c323a 100644 --- a/pkg/base-dev/sur/hood.hoon +++ b/pkg/base-dev/sur/hood.hoon @@ -251,13 +251,11 @@ ^- @t ?: =(~ wefts) '~' - %+ rap 3 - %+ join ' ' - %+ turn - (sort ~(tap in wefts) aor) - |= =weft - ^- @t - (rap 3 '[%' lal.weft ' ' (scot %ud num.weft) ']' ~) + %+ roll (sort ~(tap in wefts) aor) + |= [=weft out=@t] + ?: =('' out) + (rap 3 '[%' lal.weft ' ' (scot %ud num.weft) ']' ~) + (rap 3 out ' [%' lal.weft ' ' (scot %ud num.weft) ']' ~) :: ++ print-shorthash |= hash=@uv From 10ae72075616b573091795c6ef8e1a9bf1bf3f00 Mon Sep 17 00:00:00 2001 From: pkova Date: Mon, 18 Mar 2024 14:03:59 +0200 Subject: [PATCH 181/252] ping: fix bug in +galaxy-for --- pkg/arvo/app/ping.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index 52bcf93fc1..345c1caef0 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -49,7 +49,7 @@ ++ galaxy-for |= [=ship =bowl:gall] ^- @p - =/ next (sein:title [our now our]:bowl) + =/ next (sein:title our.bowl now.bowl ship) ?: ?=(%czar (clan:title next)) next $(ship next) From f0a5faf29535529df83dcb80815aedc5b0e9564a Mon Sep 17 00:00:00 2001 From: pkova Date: Mon, 18 Mar 2024 17:02:16 +0200 Subject: [PATCH 182/252] ping: track number of outstanding pokes and retry timer --- pkg/arvo/app/ping.hoon | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index 345c1caef0..012ef918f6 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -37,7 +37,8 @@ +$ state-3 $: %3 mode=?(%formal %informal) - sent=? + pokes=@ud + timer=(unit [=wire date=@da]) galaxy=@p == -- @@ -55,16 +56,16 @@ $(ship next) :: ++ wait-card - |= now=@da + |= [=wire now=@da] ^- card - [%pass /wait %arvo %b %wait (add nat-timeout now)] + [%pass wire %arvo %b %wait (add nat-timeout now)] :: ++ ping - |= =ship + |= [=ship force=?] ^- (quip card _state) - ?: &(sent.state =(ship galaxy.state)) + ?: &(!force (gth pokes.state 0) =(ship galaxy.state)) [~ state] - :_ state(sent %.y, galaxy ship) + :_ state(pokes +(pokes.state), galaxy ship) [%pass /ping/(scot %p ship) %agent [ship %ping] %poke %noun !>(~)]~ -- %+ verb | @@ -78,7 +79,7 @@ ++ on-init ^- [(list card) _this] =. mode.state %formal - =. sent.state %.n + =. pokes.state 0 =. galaxy.state (galaxy-for our.bowl bowl) [~ this] :: @@ -124,7 +125,7 @@ ++ state-2-to-3 |= old=state-2 ^- state-3 - [%3 %formal %.n (galaxy-for our.bowl bowl)] + [%3 %formal 0 ~ (galaxy-for our.bowl bowl)] -- :: +on-poke: positively acknowledge pokes :: @@ -137,11 +138,11 @@ ?: ?=([%kick ?] q.vase) =? mode.state =(+.q.vase %.y) %formal - (ping (galaxy-for our.bowl bowl)) + (ping (galaxy-for our.bowl bowl) %.n) :: ?: |(=(q.vase %once) =(q.vase %stop)) :: NB: ames calls this on %once =. mode.state %informal - (ping (galaxy-for our.bowl bowl)) + (ping (galaxy-for our.bowl bowl) %.y) `state [cards this] :: @@ -158,9 +159,16 @@ `this ?. =(galaxy.state (slav %p i.t.wire)) `this - =. sent.state %.n - ?. ?=(%formal mode.state) `this - [[(wait-card now.bowl)]~ this] + ?. ?=(%poke-ack -.sign) + `this + =. pokes.state (dec pokes.state) + ?. |(?=(%formal mode.state) ?=(^ p.sign)) + `this + ?. =(pokes.state 0) + `this + =/ wir /wait + =. timer.state `[wire now.bowl] + [[(wait-card wir now.bowl)]~ this] :: +on-arvo: handle timer firing :: ++ on-arvo @@ -174,7 +182,8 @@ ?^ error.sign-arvo %- (slog 'ping: strange wake fail!' u.error.sign-arvo) `state - (ping (galaxy-for our.bowl bowl)) + =. timer.state ~ + (ping (galaxy-for our.bowl bowl) %.n) :: == [cards this] From 9050c5ad35bd024030725f210e1d0ae363c2f798 Mon Sep 17 00:00:00 2001 From: pkova Date: Mon, 18 Mar 2024 19:00:18 +0200 Subject: [PATCH 183/252] ping: do not scry in migration and other miscellaneous fine tuning --- pkg/arvo/app/ping.hoon | 45 +++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index 012ef918f6..221582666e 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -22,18 +22,6 @@ :: +$ card card:agent:gall :: -+$ state-2 - $: %2 - ships=(set ship) - nonce=@ud - $= plan - $~ [%nat ~] - $% [%nat ~] - [%pub ip=(unit @t)] - [%off ~] - [%one ~] - == - == +$ state-3 $: %3 mode=?(%formal %informal) @@ -66,7 +54,7 @@ ?: &(!force (gth pokes.state 0) =(ship galaxy.state)) [~ state] :_ state(pokes +(pokes.state), galaxy ship) - [%pass /ping/(scot %p ship) %agent [ship %ping] %poke %noun !>(~)]~ + [%pass /ping %agent [ship %ping] %poke %noun !>(~)]~ -- %+ verb | ^- agent:gall @@ -111,6 +99,18 @@ $% [%nat ~] [%pub ip=(unit @t)] == == + +$ state-2 + $: %2 + ships=(set ship) + nonce=@ud + $= plan + $~ [%nat ~] + $% [%nat ~] + [%pub ip=(unit @t)] + [%off ~] + [%one ~] + == + == :: ++ state-0-to-1 |= old=state-0 @@ -125,7 +125,14 @@ ++ state-2-to-3 |= old=state-2 ^- state-3 - [%3 %formal 0 ~ (galaxy-for our.bowl bowl)] + :* %3 %formal 0 ~ + =/ galaxy=(list @p) + %+ skim ~(tap in ships.old) + |=(p=@p ?=(%czar (clan:title p))) + ?: =(1 (lent galaxy)) + -.galaxy + (head (flop (^saxo:title our.bowl))) + == -- :: +on-poke: positively acknowledge pokes :: @@ -155,19 +162,17 @@ ++ on-agent |= [=wire =sign:agent:gall] ^- [(list card) _this] - ?. ?=([%ping s=@ *] wire) - `this - ?. =(galaxy.state (slav %p i.t.wire)) + ?. ?=([%ping *] wire) `this ?. ?=(%poke-ack -.sign) `this =. pokes.state (dec pokes.state) - ?. |(?=(%formal mode.state) ?=(^ p.sign)) - `this ?. =(pokes.state 0) `this + ?. |(?=(%formal mode.state) ?=(^ p.sign)) + `this =/ wir /wait - =. timer.state `[wire now.bowl] + =. timer.state `[wir now.bowl] [[(wait-card wir now.bowl)]~ this] :: +on-arvo: handle timer firing :: From 24e3f434a7ce9b228da3e2edb2ae643c3dbcf3a7 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Tue, 19 Mar 2024 09:42:20 +0100 Subject: [PATCH 184/252] ames: add %stun verbosity log --- pkg/arvo/sys/lull.hoon | 2 +- pkg/arvo/sys/vane/ames.hoon | 55 +++++++++++++++++++++++++++++++++---- 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index a7970a83bd..7b8aeba89a 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -894,7 +894,7 @@ +$ address @uxaddress :: $verb: verbosity flag for ames :: - +$ verb ?(%snd %rcv %odd %msg %ges %for %rot %kay %fin) + +$ verb ?(%snd %rcv %odd %msg %ges %for %rot %kay %fin %sun) :: $blob: raw atom to or from unix, representing a packet :: +$ blob @uxblob diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 868a549d3f..18337eb83c 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -101,6 +101,7 @@ rot=`?`%.n :: routing attempts kay=`?`%.n :: is ok/not responding fin=`?`%.n :: remote-scry + sun=`?`%.n :: STUN == =/ packet-size 13 => @@ -850,7 +851,7 @@ =life =rift crypto-core=acru:ames - =bug + bug=bug-19 snub=[form=?(%allow %deny) ships=(set ship)] cong=[msg=@ud mem=@ud] == @@ -1150,7 +1151,7 @@ =life =rift crypto-core=acru:ames - =bug + bug=bug-19 snub=[form=?(%allow %deny) ships=(set ship)] cong=[msg=_5 mem=_100.000] :: @@ -1204,7 +1205,7 @@ =life =rift crypto-core=acru:ames - =bug + bug=bug-19 snub=[form=?(%allow %deny) ships=(set ship)] cong=[msg=@ud mem=@ud] == @@ -1328,7 +1329,28 @@ $<(?(%keen %deep) task) == :: -+$ ames-state-19 ames-state ++$ bug-19 + $: veb=_[`?`%.n `?`%.n `?`%.n `?`%.n `?`%.n `?`%.n `?`%.n `?`%.n `?`%.n] + ships=(set ship) + == +:: ++$ ames-state-19 + $+ ames-state-19 + $: peers=(map ship ship-state) + =unix=duct + =life + =rift + crypto-core=acru:ames + bug=bug-19 + snub=[form=?(%allow %deny) ships=(set ship)] + cong=[msg=@ud mem=@ud] + $= dead + $: flow=[%flow (unit dead-timer)] + cork=[%cork (unit dead-timer)] + == + :: + =chain + == :: $bug: debug printing configuration :: :: veb: verbosity toggles @@ -2040,7 +2062,7 @@ 19+(state-18-to-19:load:adult-core +.u.cached-state) =^ moz u.cached-state ?. ?=(%19 -.u.cached-state) [~ u.cached-state] - :_ [%20 +.u.cached-state] + :_ 20+(state-19-to-20:load:adult-core +.u.cached-state) :: if we didn't have a unix-duct, the larval stage will be expecting :: a %born task from unix, which will in turn emit the %saxo that will :: start sending informal pings to the sponsorship chain @@ -2234,6 +2256,7 @@ %rot acc(rot %.y) %kay acc(kay %.y) %fin acc(fin %.y) + %sun acc(sun %.y) == event-core :: +on-prod: re-send a packet per flow to each of .ships @@ -2803,6 +2826,19 @@ ++ on-stun |= =stun ^+ event-core + %- %^ ev-trace sun.veb ship.stun + =/ lane=tape + ?: & + :: turn off until correct parsing ip/port in ames.c + :: (see https://github.com/urbit/vere/pull/623) + "" + ?: ?=(%& -.lane.stun) + "from {}" + =, lane.stun + =/ ip=@if (end [0 32] p) + =/ pt=@ud (cut 0 [32 16] p) + "lane {(scow %if ip)}:{((d-co:co 1) pt)} ({(scow %ux p)})" + |.("inject %stun {<-.stun>} {lane}") %- emit %^ poke-ping-app unix-duct.ames-state our ?. ?=(%fail -.stun) -.stun @@ -5670,7 +5706,7 @@ :: ++ state-18-to-19 |= old=ames-state-18 - ^- ^ames-state + ^- ames-state-19 %= old :: dead [dead.old ~] @@ -5708,6 +5744,13 @@ == == == + :: + ++ state-19-to-20 + |= old=ames-state-19 + ^- ^ames-state + %= old + veb.bug [&1 &2 &3 &4 &5 &6 &7 &8 |8 %.n]:veb.bug.old + == -- :: +scry: dereference namespace :: From 4b3058d2eff70d3b3b498d7893c9daa883aea07c Mon Sep 17 00:00:00 2001 From: fang Date: Wed, 20 Mar 2024 14:52:30 +0100 Subject: [PATCH 185/252] spider: support speaking raw (uw-encoded) nouns in the thread-calling http interface. Specifying a content-type header of application/x-urb-jam will make the request body be interpreted as a uw-encoded jammed noun, rather than json. Specifying an accept header of application/x-urb-jam will make the thread result in the response body be rendered as a uw-encoded jammed noun, rather than json. For the latter, the output mark becomes unused, since we can just "render" the resulting noun directly, without needing to explicitly convert it. (This assumes that converting any mark to %noun will always result in the same noun, which isn't guaranteed in theory, but is always the case in practice.) This prepares spider for use in a nouns-based version of js-http-api. --- pkg/arvo/app/spider.hoon | 124 ++++++++++++++++++++++++++++----------- 1 file changed, 91 insertions(+), 33 deletions(-) diff --git a/pkg/arvo/app/spider.hoon b/pkg/arvo/app/spider.hoon index ca65eb4466..5a2ee2eddd 100644 --- a/pkg/arvo/app/spider.hoon +++ b/pkg/arvo/app/spider.hoon @@ -14,7 +14,7 @@ $: starting=(map yarn [=trying =vase]) running=(axal thread-form) tid=(map tid yarn) - serving=(map tid [(unit @ta) =mark =desk]) + serving=(map tid [(unit [rid=@ta take=?(%json %noun)]) =mark =desk]) scrying=(jug tid [=wire =ship =path]) == :: @@ -26,10 +26,20 @@ clean-slate-3 clean-slate-4 clean-slate-5 + clean-slate-6 clean-slate == :: +$ clean-slate + $: %7 + starting=(map yarn [=trying =vase]) + running=(list yarn) + tid=(map tid yarn) + serving=(map tid [(unit [rid=@ta take=?(%json %noun)]) =mark =desk]) + scrying=(jug tid [wire ship path]) + == +:: ++$ clean-slate-6 $: %6 starting=(map yarn [=trying =vase]) running=(list yarn) @@ -121,7 +131,8 @@ =. any (old-to-4 any) =. any (old-to-5 any) =. any (old-to-6 any) - ?> ?=(%6 -.any) + =. any (old-to-7 any) + ?> ?=(%7 -.any) :: =. tid.state tid.any =/ yarns=(list yarn) @@ -148,8 +159,8 @@ ++ old-to-2 |= old=clean-slate-any ^- (quip card clean-slate-any) - ?> ?=(?(%1 %2 %3 %4 %5 %6) -.old) - ?: ?=(?(%2 %3 %4 %5 %6) -.old) + ?> ?=(?(%1 %2 %3 %4 %5 %6 %7) -.old) + ?: ?=(?(%2 %3 %4 %5 %6 %7) -.old) `old :- ~[bind-eyre:sc] :* %2 @@ -162,8 +173,8 @@ ++ old-to-3 |= old=clean-slate-any ^- clean-slate-any - ?> ?=(?(%2 %3 %4 %5 %6) -.old) - ?: ?=(?(%3 %4 %5 %6) -.old) + ?> ?=(?(%2 %3 %4 %5 %6 %7) -.old) + ?: ?=(?(%3 %4 %5 %6 %7) -.old) old :* %3 starting.old @@ -175,8 +186,8 @@ ++ old-to-4 |= old=clean-slate-any ^- clean-slate-any - ?> ?=(?(%3 %4 %5 %6) -.old) - ?: ?=(?(%4 %5 %6) -.old) + ?> ?=(?(%3 %4 %5 %6 %7) -.old) + ?: ?=(?(%4 %5 %6 %7) -.old) old :* %4 starting.old @@ -188,15 +199,15 @@ ++ old-to-5 |= old=clean-slate-any ^- clean-slate-any - ?> ?=(?(%4 %5 %6) -.old) - ?: ?=(?(%5 %6) -.old) old + ?> ?=(?(%4 %5 %6 %7) -.old) + ?: ?=(?(%5 %6 %7) -.old) old [%5 +.old(serving [serving.old ~])] :: ++ old-to-6 |= old=clean-slate-any - ^- clean-slate - ?> ?=(?(%5 %6) -.old) - ?: ?=(%6 -.old) old + ^- clean-slate-any + ?> ?=(?(%5 %6 %7) -.old) + ?: ?=(?(%6 %7) -.old) old :- %6 %= +.old scrying @@ -208,6 +219,16 @@ :: [/keen ship path]~ == + :: + ++ old-to-7 + |= old=clean-slate-any + ^- clean-slate-any + ?> ?=(?(%6 %7) -.old) + ?: ?=(%7 -.old) old + =- old(- %7, serving -) + %- ~(run by serving.old) + |= [request=(unit @ta) =mark =desk] + [(bind request (late %json)) mark desk] -- :: ++ on-poke @@ -309,15 +330,36 @@ =* input-mark i.t.t.site.url =* thread i.t.t.t.site.url =* output-mark i.t.t.t.t.site.url - =/ =tid (new-thread-id thread) - =. serving.state - (~(put by serving.state) tid [`eyre-id output-mark desk]) :: TODO: speed this up somehow. we spend about 15ms in this arm alone :: - =/ tube (convert-tube %json input-mark desk bowl) ?> ?=(^ body.request.inbound-request) - =/ body=json (need (de:json:html q.u.body.request.inbound-request)) - =/ input=vase (slop !>(~) (tube !>(body))) + =/ test=$-(@t ?(%json %noun)) + |= head=@t + =; type=(unit @t) + ?:(=(`'application/x-urb-jam' type) %noun %json) + %+ bind + (get-header:http head header-list.request.inbound-request) + :(cork trip cass crip) + =/ give (test 'content-type') + =/ take (test 'accept') + :: + =/ =tid (new-thread-id thread) + =. serving.state + (~(put by serving.state) tid [`[eyre-id take] output-mark desk]) + :: + =/ input=vase + %+ slop !>(~) + ?- give + %json + =/ tube (convert-tube %json input-mark desk bowl) + =/ body=json (need (de:json:html q.u.body.request.inbound-request)) + (tube !>(body)) + :: + %noun + =/ tube (convert-tube %noun input-mark desk bowl) + =/ body=noun (cue (slav %uw q.u.body.request.inbound-request)) + (tube !>(body)) + == =/ boc bec =/ =start-args:spider [~ `tid boc(q desk, r da+now.bowl) thread input] (handle-start-thread start-args) @@ -550,18 +592,25 @@ =- (fall - `state) %+ bind (~(get by serving.state) tid) - |= [eyre-id=(unit @ta) output=mark =desk] + |= [request=(unit [rid=@ta take=?(%json %noun)]) output=mark =desk] :_ state(serving (~(del by serving.state) tid)) - ?~ eyre-id + ?~ request ~ - %+ give-simple-payload:app:server u.eyre-id + %+ give-simple-payload:app:server rid.u.request ^- simple-payload:http ?. ?=(http-error:spider term) %- (slog tang) - =/ tube (convert-tube %tang %json desk bowl) - :- [500 [['content-type' 'application/json'] ~]] - =- `(as-octs:mimes:html (en:json:html -)) - o/(malt `(list [key=@t json])`[term+s/term tang+!<(json (tube !>(tang))) ~]) + ?- take.u.request + %json + =/ tube (convert-tube %tang %json desk bowl) + :- [500 [['content-type' 'application/json'] ~]] + =- `(as-octs:mimes:html (en:json:html -)) + o/(malt `(list [key=@t json])`[term+s/term tang+!<(json (tube !>(tang))) ~]) + :: + %noun + :- [500 [['content-type' 'application/x-urb-jam'] ~]] + `(as-octs:mimes:html (scot %uw (jam [term tang]))) + == :_ ~ :_ ~ ?- term %bad-request 400 @@ -588,13 +637,22 @@ =- (fall - `state) %+ bind (~(get by serving.state) tid) - |= [eyre-id=(unit @ta) output=mark =desk] - ?~ eyre-id + |= [request=(unit [rid=@ta take=?(%json %noun)]) output=mark =desk] + ?~ request `state - =/ tube (convert-tube output %json desk bowl) - :_ state(serving (~(del by serving.state) tid)) - %+ give-simple-payload:app:server u.eyre-id - (json-response:gen:server !<(json (tube vase))) + ?- take.u.request + %json + =/ tube (convert-tube output %json desk bowl) + :_ state(serving (~(del by serving.state) tid)) + %+ give-simple-payload:app:server rid.u.request + (json-response:gen:server !<(json (tube vase))) + :: + %noun + :_ state(serving (~(del by serving.state) tid)) + %+ give-simple-payload:app:server rid.u.request + :- [200 ['content-type' 'application/x-urb-jam']~] + `(as-octs:mimes:html (scot %uw (jam q.vase))) + == :: ++ thread-done |= [=yarn =vase silent=?] @@ -681,7 +739,7 @@ :: ++ clean-state !> ^- clean-slate - 6+state(running (turn ~(tap of running.state) head)) + 7+state(running (turn ~(tap of running.state) head)) :: ++ convert-tube |= [from=mark to=mark =desk =bowl:gall] From 5ecef371b747c69db021045c8fac7ec176240d7b Mon Sep 17 00:00:00 2001 From: Pyry Kovanen Date: Thu, 21 Mar 2024 13:39:30 +0200 Subject: [PATCH 186/252] eyre: do not overwrite public eauth domains with localhost Co-authored-by: fang --- pkg/arvo/sys/vane/eyre.hoon | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index 190a419588..68ce5eab80 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -1306,8 +1306,13 @@ o(session-id session.fex) :: store the hostname used for this login, later reuse it for eauth :: - =? endpoint.auth.state - &(?=(^ host) !=('localhost' (fall (rush u.host host-sans-port) ''))) + =? endpoint.auth.state + :: avoid overwriting public domains with localhost + :: + ?& ?=(^ host) + ?| ?=(~ auth.endpoint.auth.state) + !=('localhost' (fall (rush u.host host-sans-port) ''))) + == == %- (trace 2 |.("eauth: storing endpoint at {(trip u.host)}")) =/ new-auth=(unit @t) `(cat 3 ?:(secure 'https://' 'http://') u.host) From 05a71c690a5f491ac480684c5394cd775aa2c824 Mon Sep 17 00:00:00 2001 From: pkova Date: Thu, 21 Mar 2024 16:03:37 +0200 Subject: [PATCH 187/252] ames: fix chain mop order --- pkg/arvo/sys/vane/ames.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 18337eb83c..43007fbbdd 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -3306,7 +3306,7 @@ ^+ event-core =/ key=@ (shaz eny) :: TODO: check key width =/ num=@ud - ?~ latest=(pry:on:chain chain.ames-state) + ?~ latest=(ram:on:chain chain.ames-state) 1 .+(key.u.latest) =. chain.ames-state From 5f45cda7d40a67f46a9b4b8a3792d1189d6c9566 Mon Sep 17 00:00:00 2001 From: Tinnus Napbus Date: Sat, 23 Mar 2024 22:27:05 +1300 Subject: [PATCH 188/252] vats: fix desk order --- pkg/base-dev/sur/hood.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/base-dev/sur/hood.hoon b/pkg/base-dev/sur/hood.hoon index 05400c323a..3cde86c30c 100644 --- a/pkg/base-dev/sur/hood.hoon +++ b/pkg/base-dev/sur/hood.hoon @@ -77,7 +77,7 @@ %- zing %+ turn ?^ desks - `(list desk)`desks + (flop desks) %+ sort ~(tap in ~(key by tyr.prep)) |= [a=desk b=desk] ?: |(=(a %kids) =(b %base)) & @@ -91,7 +91,7 @@ ?: |(=(a %kids) =(b %base)) & ?: |(=(a %base) =(b %kids)) | (aor b a) - %+ murn `(list desk)`desks + %+ murn (flop desks) |= des=desk ^- (unit [=desk =zest wic=(set weft)]) ?~ got=(~(get by tyr.prep) des) From d54afc1cf224f4cc9ed53d19b36caf06dee273e7 Mon Sep 17 00:00:00 2001 From: Pyry Kovanen Date: Mon, 25 Mar 2024 15:19:23 +0200 Subject: [PATCH 189/252] eyre: scry with root gang in http generators --- pkg/arvo/sys/vane/eyre.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index 9485f7f2a6..a83751fca6 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -922,7 +922,7 @@ ?> =(%vase p.cag) =/ gat=vase !<(vase q.cag) =/ res=toon - %- mock :_ (look rof ?.(authenticated ~ [~ ~]) /eyre) + %- mock :_ (look rof [~ ~] /eyre) :_ [%9 2 %0 1] |. %+ slam %+ slam gat From 2ff03c8a904031e201b759a43a63821b704443b0 Mon Sep 17 00:00:00 2001 From: fang Date: Mon, 25 Mar 2024 19:39:46 +0100 Subject: [PATCH 190/252] verb: deeper event verbosity at /verb/events-plus Adds a new endpoint to the verb wrapper library that gives more detail about events happening to agents. This includes sequence numbers, timestamps, source ship, mug hashes for incoming data, and a summary of the resulting effects. --- pkg/base-dev/lib/verb.hoon | 92 +++++++++++++++++++++++++++++++++----- pkg/base-dev/sur/verb.hoon | 30 ++++++++++++- 2 files changed, 110 insertions(+), 12 deletions(-) diff --git a/pkg/base-dev/lib/verb.hoon b/pkg/base-dev/lib/verb.hoon index 2737addfcb..022f8e039d 100644 --- a/pkg/base-dev/lib/verb.hoon +++ b/pkg/base-dev/lib/verb.hoon @@ -1,6 +1,6 @@ :: Print what your agent is doing. :: -/- verb +/- *verb :: |= [loud=? =agent:gall] =| bowl-print=_| @@ -14,7 +14,10 @@ ^- (quip card:agent:gall agent:gall) %- (print bowl |.("{}: on-init")) =^ cards agent on-init:ag - [[(emit-event %on-init ~) cards] this] + :_ this + :_ :_ cards + (emit-event %on-init ~) + (emit-event-plus bowl [%on-init ~] cards) :: ++ on-save ^- vase @@ -26,7 +29,10 @@ ^- (quip card:agent:gall agent:gall) %- (print bowl |.("{}: on-load")) =^ cards agent (on-load:ag old-state) - [[(emit-event %on-load ~) cards] this] + :_ this + :_ :_ cards + (emit-event %on-load ~) + (emit-event-plus bowl [%on-load ~] cards) :: ++ on-poke |= [=mark =vase] @@ -38,17 +44,23 @@ %bowl `this(bowl-print !bowl-print) == =^ cards agent (on-poke:ag mark vase) - [[(emit-event %on-poke mark) cards] this] + :_ this + :_ :_ cards + (emit-event %on-poke mark) + (emit-event-plus bowl [%on-poke mark] cards) :: ++ on-watch |= =path ^- (quip card:agent:gall agent:gall) %- (print bowl |.("{}: on-watch on path {}")) =^ cards agent - ?: ?=([%verb %events ~] path) + ?: ?=([%verb ?(%events %events-plus) ~] path) [~ agent] (on-watch:ag path) - [[(emit-event %on-watch path) cards] this] + :_ this + :_ :_ cards + (emit-event %on-watch path) + (emit-event-plus bowl [%on-watch path] cards) :: ++ on-leave |= =path @@ -57,7 +69,10 @@ ?: ?=([%verb %event ~] path) [~ this] =^ cards agent (on-leave:ag path) - [[(emit-event %on-leave path) cards] this] + :_ this + :_ :_ cards + (emit-event %on-leave path) + (emit-event-plus bowl [%on-leave path] cards) :: ++ on-peek |= =path @@ -70,7 +85,10 @@ ^- (quip card:agent:gall agent:gall) %- (print bowl |.("{}: on-agent on wire {}, {<-.sign>}")) =^ cards agent (on-agent:ag wire sign) - [[(emit-event %on-agent wire -.sign) cards] this] + :_ this + :_ :_ cards + (emit-event %on-agent wire -.sign) + (emit-event-plus bowl [%on-agent wire -.sign (mug +.sign)] cards) :: ++ on-arvo |= [=wire =sign-arvo] @@ -78,14 +96,20 @@ %- %+ print bowl |. "{}: on-arvo on wire {}, {<[- +<]:sign-arvo>}" =^ cards agent (on-arvo:ag wire sign-arvo) - [[(emit-event %on-arvo wire [- +<]:sign-arvo) cards] this] + :_ this + :_ :_ cards + (emit-event %on-arvo wire [- +<]:sign-arvo) + (emit-event-plus bowl [%on-arvo wire [- +<]:sign-arvo] cards) :: ++ on-fail |= [=term =tang] ^- (quip card:agent:gall agent:gall) %- (print bowl |.("{}: on-fail with term {}")) =^ cards agent (on-fail:ag term tang) - [[(emit-event %on-fail term) cards] this] + :_ this + :_ :_ cards + (emit-event %on-fail term) + (emit-event-plus bowl [%on-fail term] cards) -- :: ++ print @@ -99,7 +123,53 @@ same :: ++ emit-event - |= =event:verb + |= =event ^- card:agent:gall [%give %fact ~[/verb/events] %verb-event !>(event)] +:: +++ emit-event-plus + |= [=bowl:gall =cause cards=(list card:agent:gall)] + ^- card:agent:gall + =; event=event-plus + [%give %fact ~[/verb/events-plus] %verb-event-plus !>(event)] + =- [act.bowl now.bowl src.bowl cause -] + %+ turn cards + |= =card:agent:gall + ^- effect + ::TODO for %fact, %kick, could calculate how many ships affected + ?- card + [%pass * %agent * ?(%poke %poke-as) *] + =, q.card + =/ =cage ?-(-.task.q.card %poke cage.task, %poke-as [mark.task q.cage.task]) + [%poke p.card [ship name] p.cage `@`(mug q.q.cage)] + :: + [%pass * %agent * ?(%watch %watch-as) *] + =, q.card + =/ =path ?-(-.task.q.card %watch path.task, %watch-as path.task) + [%watch p.card [ship name] path] + :: + [%pass * %agent * %leave *] + =, q.card + [%leave p.card [ship name]] + :: + [%give %fact *] + =, p.card + [%fact paths p.cage (mug q.q.cage)] + :: + [%give %kick *] + [%kick paths.p.card] + :: + [%give ?(%poke-ack %watch-ack) *] + ~| %explicit-ack + !! :: shouldn't be given explicitly + :: + [%pass * %arvo *] + [%arvo p.card -.q.card +<.q.card] + :: + [%pass *] + [%arvo p.card %$ -.q.card] + :: + [%slip *] + $(card [%pass //slip p.card]) + == -- diff --git a/pkg/base-dev/sur/verb.hoon b/pkg/base-dev/sur/verb.hoon index f7d19f658a..3508dc669a 100644 --- a/pkg/base-dev/sur/verb.hoon +++ b/pkg/base-dev/sur/verb.hoon @@ -9,4 +9,32 @@ [%on-arvo =wire vane=term sign=term] [%on-fail =term] == --- \ No newline at end of file +:: ++$ event-plus + $: act=@ud + now=@da + src=@p + =cause + effects=(list effect) + == +:: ++$ cause + $% [%on-init ~] + [%on-load ~] + [%on-poke =mark] + [%on-watch =path] + [%on-leave =path] + [%on-agent =wire sign=term mug=@ux] ::TODO %fact should show mark? + [%on-arvo =wire vane=term sign=term] + [%on-fail =term] + == +:: ++$ effect + $% [%poke =wire =gill:gall =mark mug=@ux] + [%watch =wire =gill:gall =path] + [%leave =wire =gill:gall] + [%fact paths=(list path) =mark mug=@ux] + [%kick paths=(list path)] + [%arvo =wire vane=term task=term] + == +-- From 17ed42f24f08211b1219987fc5196d6730b4ba6b Mon Sep 17 00:00:00 2001 From: fang Date: Mon, 25 Mar 2024 19:44:50 +0100 Subject: [PATCH 191/252] verb-logger: log & save verb-plus events to disk A utility agent that can be told to watch agents. Doing so will make it subscribe to that agent's "verb plus" events. Verb-logger buffers those, and flushes them to unix disk in a json format periodically. Tools for viewing these logs still in development... --- pkg/arvo/app/verb-logger.hoon | 198 ++++++++++++++++++++++++++++++++++ 1 file changed, 198 insertions(+) create mode 100644 pkg/arvo/app/verb-logger.hoon diff --git a/pkg/arvo/app/verb-logger.hoon b/pkg/arvo/app/verb-logger.hoon new file mode 100644 index 0000000000..6b92a9c8ee --- /dev/null +++ b/pkg/arvo/app/verb-logger.hoon @@ -0,0 +1,198 @@ +:: verb-logger: serializes verb-plus events to unix-side json +:: +:: watches specified agents for "verb plus" events, buffers those, and +:: periodically (+write-interval) flushes them out to unix, under the +:: .urb/put/verb-logger/[agent] directory of the pier. +:: +/+ verb, dbug +:: +|% ++$ state-0 + $: %0 + events=(jar dude:gall event-plus:verb) + == +:: ++$ card card:agent:gall +:: +++ write-interval ~d1 +:: +++ write-events + |= [our=ship =dude:gall events=(list event-plus:verb)] + ^- (list card) + ?: =(~ events) ~ ::NOTE tmi + =/ pax=path + =; period=time + ::NOTE may overwrite if you write multiple times within a single + :: write-interval. perhaps we should just use the full date? + /verb-logger/[dude]/(scot %da period)/json + ?> ?=(^ events) + (sub now.i.events (mod now.i.events write-interval)) + =/ vex=@ + %- en:json:html + :- %a + %+ roll events ::NOTE we +roll to +turn & +flop simultaneously + |= [event=event-plus:verb out=(list json)] + [(event:enjs event) out] + [%pass /write/[dude] %agent [our %hood] %poke %drum-put !>([pax vex])]~ +:: +++ ingest-event + |= $: our=ship + events=(jar dude:gall event-plus:verb) + [=dude:gall event=event-plus:verb] + == + ^- (quip card _events) + ?~ ves=(~(get ja events) dude) + :- ~ + (~(put by events) dude [event ~]) + ?: .= (sub now.i.ves (mod now.i.ves write-interval)) + (sub now.event (mod now.event write-interval)) + :- ~ + (~(put by events) dude [event ves]) + :- (write-events our dude ves) + (~(put by events) dude [event ~]) +:: +++ enjs + =, enjs:format + |% + ++ event + |= event-plus:verb + %- pairs + :~ 'act'^(numb act) + 'now'^(time now) :: ms timestamp, lossy-ness is fine here + 'src'^s+(scot %p src) + 'cause'^(^cause cause) + 'effects'^a+(turn effects effect) + == + :: + ++ cause + |= =cause:verb + %+ frond -.cause + ?- -.cause + %on-init b+& + %on-load b+& + %on-poke s+mark.cause + %on-watch (path path.cause) + %on-leave (path path.cause) + %on-agent %- pairs + :~ 'wire'^(path wire.cause) + 'sign'^s+sign.cause + 'mug'^(mug mug.cause) + == + %on-arvo %- pairs + :~ 'wire'^(path wire.cause) + 'vane'^s+vane.cause + 'sign'^s+sign.cause + == + %on-fail s+term.cause + == + :: + ++ effect + |= effect:verb + ^- json + %+ frond +<- + %- pairs + ^- (list [@t json]) + ?- +<- + %poke :~ 'wire'^(path wire) + 'gill'^(^gill gill) + 'mark'^s+mark + 'mug'^(^mug mug) + == + %watch ~['wire'^(^path wire) 'gill'^(^gill gill) 'path'^(^path path)] + %leave ~['wire'^(path wire) 'gill'^(^gill gill)] + %fact ~['paths'^a+(turn paths path) 'mark'^s+mark 'mug'^(^mug mug)] + %kick ~['paths'^a+(turn paths path)] + %arvo ~['wire'^(path wire) 'vane'^s+vane 'task'^s+task] + == + :: + ++ gill |=(=gill:gall `json`s+(rap 3 (scot %p p.gill) '/' q.gill ~)) + ++ mug |=(mug=@ux `json`s+(crip ((x-co:co 8) mug))) + -- +-- +:: +=| state-0 +=* state - +:: +%+ verb | +%- agent:dbug +|_ =bowl:gall ++* this . +:: +++ on-init + ^- (quip card _this) + [~ this] +:: +++ on-save + !>(state) +:: +++ on-load + |= ole=vase + ^- (quip card _this) + [~ this(state !<(state-0 ole))] +:: +++ on-poke + |= [=mark =vase] + ^- (quip card _this) + ?> =(%noun mark) + ?+ q.vase !! + [%watch =dude:gall] + =* dude dude.q.vase + :_ this + [%pass /log/[dude] %agent [our.bowl dude] %watch /verb/events-plus]~ + :: + [%leave =dude:gall] + =* dude dude.q.vase + :- :- [%pass /log/[dude] %agent [our.bowl dude] %leave ~] + (write-events our.bowl dude (~(get ja events) dude)) + this(events (~(del by events) dude)) + :: + [%flush =dude:gall] + =* dude dude.q.vase + :- (write-events our.bowl dude (~(get ja events) dude)) + this(events (~(del by events) dude)) + == +:: +++ on-agent + |= [=wire =sign:agent:gall] + ^- (quip card _this) + ~| wire + ?+ wire !! + [%write @ ~] + =* dude i.t.wire + ?> ?=(%poke-ack -.sign) + ?~ p.sign [~ this] + %. [~ this] + %- %*(. slog pri 3) + [(cat 3 'verb-logger: lost export for %' dude) u.p.sign] + :: + [%log @ ~] + =* dude i.t.wire + ?- -.sign + %poke-ack !! + %kick =- [[-]~ this] + [%pass /log/[dude] %agent [our.bowl dude] %watch /verb/events-plus] + %watch-ack ?~ p.sign [~ this] + %. [~ this] + %- %*(. slog pri 2) + [(cat 3 'verb-logger: failed verb watch for %' dude) u.p.sign] + %fact ?> =(%verb-event-plus p.cage.sign) + =^ caz events + %- ingest-event + [our.bowl events dude !<(event-plus:verb q.cage.sign)] + [caz this] + == + == +:: +++ on-fail + |= [=term =tang] + ^- (quip card _this) + %. [~ this] + %- %*(. slog pri 3) + :_ tang + (cat 3 'verb-logger: dropping the ball: ' term) +:: +++ on-watch |=(* !!) +++ on-leave |=(* !!) +++ on-arvo |=(* !!) +++ on-peek |=(* ~) +-- From 52648a96de8b39406b0da3fc0794f25d12a62e42 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Tue, 26 Mar 2024 07:29:56 +0100 Subject: [PATCH 192/252] ames: on flub, check if pending-vane-ack queue is not empty --- pkg/arvo/sys/vane/ames.hoon | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 43007fbbdd..e110e75f6b 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -4585,10 +4585,12 @@ %drop sink(nax.state (~(del in nax.state) message-num.task)) %done (done ok.task) %flub - %= sink - last-heard.state (dec last-heard.state) - pending-vane-ack.state ~(nap to pending-vane-ack.state) - == + =? pending-vane-ack.state ?=(^ pending-vane-ack.state) + :: a %leave gets acked in %gall before sending the %flub, + :: so %ames has already removed the pending ack from its queue + :: + ~(nap to pending-vane-ack.state) + sink(last-heard.state (dec last-heard.state)) :: %hear |^ ?: ?| corked From 198fa38f6ebbe12801320914f36b1d7a7c6f9a85 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Tue, 26 Mar 2024 07:37:51 +0100 Subject: [PATCH 193/252] ames: log with trace when ignoring messages --- pkg/arvo/sys/vane/ames.hoon | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 43007fbbdd..cf2c87ef12 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -3662,10 +3662,12 @@ ?: ?& (~(has in closing.peer-state) bone) !=(message [%plea %$ /flow %cork ~]) == - ~> %slog.0^leaf/"ames: ignoring message on closing bone {}" + %- %+ pe-trace odd.veb + |.("ignoring message on closing bone {}") peer-core ?: (~(has in corked.peer-state) bone) - ~> %slog.0^leaf/"ames: ignoring message on corked bone {}" + %- %+ pe-trace odd.veb + |.("ignoring message on corked bone {}") peer-core :: =. peer-core abet:(call:(abed:mu bone) %memo message) From 216ce199b627599bdd54587c27b00896ee46a688 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Tue, 26 Mar 2024 10:38:20 +0100 Subject: [PATCH 194/252] gall: check if a %leave got %nacked before resending --- pkg/arvo/sys/vane/gall.hoon | 43 ++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 2c91a92324..c74e67eb76 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -754,13 +754,17 @@ ~| [full-wire=full-wire hen=hen stand=stand] =^ rr stand ~(get to stand) :- rr - ?: =(~ stand) - :: outstanding leaves are only deleted when acked - :: - ?: &(?=(^ err) ?=(%leave rr)) - outstanding.state + ?. =(~ stand) + (~(put by outstanding.state) [full-wire hen] stand) + :: outstanding leaves are only deleted when acked; + :: a nacked %leave is flagged with a %missing request + :: we add to the outstanding queue that is only checked + :: in the nacked-leaves timer to skip dead-flow %leave(s) + :: + ?. &(?=(^ err) ?=(%leave rr)) (~(del by outstanding.state) [full-wire hen]) - (~(put by outstanding.state) [full-wire hen] stand) + %- ~(put by outstanding.state) + [[full-wire hen] (~(put to stand) %missing)] :: non-null case of wire is old, remove on next breach after :: 2019/12 :: @@ -2999,14 +3003,29 @@ %- ~(rep by outstanding.state) |= [[[=^wire =^duct] stand=(qeu remote-request)] core=_mo-core:mo] ?: =(~ stand) core - =^ rr stand ~(get to stand) + =^ rr stand ~(get to stand) :: sanity check in the outstanding queue: - :: if there's a %leave, that should be the only request + :: if there's a %leave that was nacked, there should be a %missing request + :: otherwise %leave is the only request in the queue, and we haven't heard + :: anc %ack or a %nack, so %ames is still trying to send it. :: - ~? >>> &(?=(%leave rr) =(^ stand)) - "outstanding queue not empty [{} {} {}]" - =? core &(?=(%leave rr) =(~ stand)) - (mo-handle-nacked-leaves:(mo-abed:core duct) wire) + ~? >>> ?& ?=(%leave rr) + =(^ stand) + =^(rr stand ~(get to stand) !=(%missing rr)) + == + "extraneous request outstanding [{} {} {} {}]" + =? core ?& ?=(%leave rr) + =(^ stand) + =^(rr stand ~(get to stand) &(=(%missing rr) =(~ stand))) + == + =+ core=(mo-handle-nacked-leaves:(mo-abed:core duct) wire) + :: make sure that only the %leave remains in the queue + :: + %_ core + outstanding.state + %+ ~(put by outstanding.state) [wire duct] + (~(put to *(qeu remote-request)) %leave) + == core :: ~| [%gall-take-failed wire] From a90eb4c9fec0c1b35658f034869b97fb7db571ba Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Tue, 26 Mar 2024 14:27:20 +0100 Subject: [PATCH 195/252] gall: don't ack %leave for non-running agents --- pkg/arvo/sys/vane/ames.hoon | 10 ++++------ pkg/arvo/sys/vane/gall.hoon | 6 ++++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index e110e75f6b..43007fbbdd 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -4585,12 +4585,10 @@ %drop sink(nax.state (~(del in nax.state) message-num.task)) %done (done ok.task) %flub - =? pending-vane-ack.state ?=(^ pending-vane-ack.state) - :: a %leave gets acked in %gall before sending the %flub, - :: so %ames has already removed the pending ack from its queue - :: - ~(nap to pending-vane-ack.state) - sink(last-heard.state (dec last-heard.state)) + %= sink + last-heard.state (dec last-heard.state) + pending-vane-ack.state ~(nap to pending-vane-ack.state) + == :: %hear |^ ?: ?| corked diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 2c91a92324..781480a829 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -1147,10 +1147,8 @@ ++ mo-handle-ames-request |= [=ship agent-name=term =ames-request] ^+ mo-core - :: %u/%leave gets automatically acked :: =. mo-core (mo-track-ship ship) - =? mo-core ?=(%u -.ames-request) (mo-give %done ~) :: =/ yok=(unit yoke) (~(get by yokes.state) agent-name) ?~ yok @@ -1160,6 +1158,10 @@ ?: ?=(%.n -.agent.u.yok) (mo-give %flub ~) :: + :: %u/%leave gets automatically acked + :: + =? mo-core ?=(%u -.ames-request) + (mo-give %done ~) =/ =wire /sys/req/(scot %p ship)/[agent-name] :: =/ =deal From 9e87a2fbca5556ffa14aff8e02f49428b79e4cc0 Mon Sep 17 00:00:00 2001 From: fang Date: Tue, 26 Mar 2024 22:26:30 +0100 Subject: [PATCH 196/252] spider: speak raw jam bytes, not uw-encoded This brings it in line with the serialization found in /mar/noun. The `@uw`-encoding was carried over from Eyre, who uses it for channels. In that context, outgoing jam bytes must be encoded, because newline characters (`0a` bytes) would break up the SSE data field. Because they're essentially part of the same protocol, Eyre mirrors this for incoming nouns. Even though PUT requests can carry arbitrary bytes just fine, the symmetry and protocol-wide consistency seems important. Here, we are dealing strictly with plain HTTP requests, and strictly with requests that have indicated support for the `application/x-urb-jam` mime type to boot. We should have no qualms about raw jam bytes. They're more compact/efficient, too. --- pkg/arvo/app/spider.hoon | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/app/spider.hoon b/pkg/arvo/app/spider.hoon index 5a2ee2eddd..f98d7929ec 100644 --- a/pkg/arvo/app/spider.hoon +++ b/pkg/arvo/app/spider.hoon @@ -357,7 +357,7 @@ :: %noun =/ tube (convert-tube %noun input-mark desk bowl) - =/ body=noun (cue (slav %uw q.u.body.request.inbound-request)) + =/ body=noun (cue q.u.body.request.inbound-request) (tube !>(body)) == =/ boc bec @@ -609,7 +609,7 @@ :: %noun :- [500 [['content-type' 'application/x-urb-jam'] ~]] - `(as-octs:mimes:html (scot %uw (jam [term tang]))) + `(as-octs:mimes:html (jam [term tang])) == :_ ~ :_ ~ ?- term @@ -651,7 +651,7 @@ :_ state(serving (~(del by serving.state) tid)) %+ give-simple-payload:app:server rid.u.request :- [200 ['content-type' 'application/x-urb-jam']~] - `(as-octs:mimes:html (scot %uw (jam q.vase))) + `(as-octs:mimes:html (jam q.vase)) == :: ++ thread-done From 551507cd3682cbf6b85a3a9eda5c0c4cf8e6a906 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Wed, 27 Mar 2024 06:27:23 +0100 Subject: [PATCH 197/252] gall: keep %leave in the queue --- pkg/arvo/sys/vane/gall.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index c74e67eb76..125c1eb230 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -764,7 +764,7 @@ ?. &(?=(^ err) ?=(%leave rr)) (~(del by outstanding.state) [full-wire hen]) %- ~(put by outstanding.state) - [[full-wire hen] (~(put to stand) %missing)] + [[full-wire hen] (~(gas to stand) ~[%leave %missing])] :: non-null case of wire is old, remove on next breach after :: 2019/12 :: From bf863b5ac727ca7de51300fe3441649701f5de3e Mon Sep 17 00:00:00 2001 From: fang Date: Thu, 28 Mar 2024 21:48:48 +0100 Subject: [PATCH 198/252] verb: tweak $event-plus type Include the mug for poke data, mark for facts, separate out the on-agent sign explicitly. --- pkg/arvo/app/verb-logger.hoon | 58 +++++++++++++++++++++++++---------- pkg/base-dev/lib/verb.hoon | 11 +++++-- pkg/base-dev/sur/verb.hoon | 11 +++++-- 3 files changed, 59 insertions(+), 21 deletions(-) diff --git a/pkg/arvo/app/verb-logger.hoon b/pkg/arvo/app/verb-logger.hoon index 6b92a9c8ee..b23e5b2256 100644 --- a/pkg/arvo/app/verb-logger.hoon +++ b/pkg/arvo/app/verb-logger.hoon @@ -28,11 +28,7 @@ ?> ?=(^ events) (sub now.i.events (mod now.i.events write-interval)) =/ vex=@ - %- en:json:html - :- %a - %+ roll events ::NOTE we +roll to +turn & +flop simultaneously - |= [event=event-plus:verb out=(list json)] - [(event:enjs event) out] + (en:json:html (events:enjs our dude events)) [%pass /write/[dude] %agent [our %hood] %poke %drum-put !>([pax vex])]~ :: ++ ingest-event @@ -54,42 +50,70 @@ ++ enjs =, enjs:format |% + ++ events + |= [our=@p =dude:gall events=(list event-plus:verb)] :: latest-first + =/ first=event-plus:verb (rear events) + %- pairs + :~ 'ship'^s+(scot %p our) + 'dude'^s+dude + 'from'^(time now.first) + :: + :- 'events' + :- %a + %+ roll events ::NOTE we +roll to +turn & +flop simultaneously + |= [event=event-plus:verb out=(list json)] + [(event:enjs event) out] + == ++ event |= event-plus:verb %- pairs :~ 'act'^(numb act) 'now'^(time now) :: ms timestamp, lossy-ness is fine here 'src'^s+(scot %p src) - 'cause'^(^cause cause) + 'kind'^s+-.cause + 'deets'^(^cause cause) 'effects'^a+(turn effects effect) == :: ++ cause |= =cause:verb - %+ frond -.cause + ^- json ?- -.cause %on-init b+& %on-load b+& - %on-poke s+mark.cause + %on-poke (pairs 'mark'^s+mark.cause 'mug'^(mug mug.cause) ~) %on-watch (path path.cause) %on-leave (path path.cause) %on-agent %- pairs - :~ 'wire'^(path wire.cause) - 'sign'^s+sign.cause - 'mug'^(mug mug.cause) - == + :~ 'wire'^(path wire.cause) + 'sign'^s+-.sign.cause + :: + :- 'deets' + ?- -.sign.cause + %poke-ack b+ack.sign.cause + %watch-ack b+ack.sign.cause + %kick ~ + %fact %- pairs + :~ 'mark'^s+mark.sign.cause + 'mug'^(mug mug.sign.cause) + == + == + == %on-arvo %- pairs - :~ 'wire'^(path wire.cause) - 'vane'^s+vane.cause - 'sign'^s+sign.cause - == + :~ 'wire'^(path wire.cause) + 'vane'^s+vane.cause + 'sign'^s+sign.cause + == %on-fail s+term.cause == :: ++ effect |= effect:verb ^- json - %+ frond +<- + %- pairs + :- 'kind'^s++<- + :_ ~ + :- 'deets' %- pairs ^- (list [@t json]) ?- +<- diff --git a/pkg/base-dev/lib/verb.hoon b/pkg/base-dev/lib/verb.hoon index 022f8e039d..4778699aa7 100644 --- a/pkg/base-dev/lib/verb.hoon +++ b/pkg/base-dev/lib/verb.hoon @@ -47,7 +47,7 @@ :_ this :_ :_ cards (emit-event %on-poke mark) - (emit-event-plus bowl [%on-poke mark] cards) + (emit-event-plus bowl [%on-poke mark (mug q.vase)] cards) :: ++ on-watch |= =path @@ -88,7 +88,14 @@ :_ this :_ :_ cards (emit-event %on-agent wire -.sign) - (emit-event-plus bowl [%on-agent wire -.sign (mug +.sign)] cards) + =; =^sign + (emit-event-plus bowl [%on-agent wire sign] cards) + ?- -.sign + %poke-ack [%poke-ack ?=(~ p.sign)] + %watch-ack [%watch-ack ?=(~ p.sign)] + %kick [%kick ~] + %fact [%fact p.cage.sign (mug q.q.cage.sign)] + == :: ++ on-arvo |= [=wire =sign-arvo] diff --git a/pkg/base-dev/sur/verb.hoon b/pkg/base-dev/sur/verb.hoon index 3508dc669a..6ef5b6e0b3 100644 --- a/pkg/base-dev/sur/verb.hoon +++ b/pkg/base-dev/sur/verb.hoon @@ -21,14 +21,21 @@ +$ cause $% [%on-init ~] [%on-load ~] - [%on-poke =mark] + [%on-poke =mark mug=@ux] [%on-watch =path] [%on-leave =path] - [%on-agent =wire sign=term mug=@ux] ::TODO %fact should show mark? + [%on-agent =wire =sign] [%on-arvo =wire vane=term sign=term] [%on-fail =term] == :: ++$ sign + $% [%poke-ack ack=?] + [%watch-ack ack=?] + [%kick ~] + [%fact =mark mug=@ux] + == +:: +$ effect $% [%poke =wire =gill:gall =mark mug=@ux] [%watch =wire =gill:gall =path] From e221b89599f10376d53c1787ca58af6b1020b50c Mon Sep 17 00:00:00 2001 From: fang Date: Thu, 28 Mar 2024 22:09:31 +0100 Subject: [PATCH 199/252] verb-logger: write more often, to unique filenames Using the timestamp of the first event, instead of the start of the time block. Also narrow the time block down from a day to an hour, for faster log writes. Further experimentation needed here. --- pkg/arvo/app/verb-logger.hoon | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pkg/arvo/app/verb-logger.hoon b/pkg/arvo/app/verb-logger.hoon index b23e5b2256..5d78e058b2 100644 --- a/pkg/arvo/app/verb-logger.hoon +++ b/pkg/arvo/app/verb-logger.hoon @@ -14,19 +14,16 @@ :: +$ card card:agent:gall :: -++ write-interval ~d1 +++ write-interval ~h1 :: ++ write-events |= [our=ship =dude:gall events=(list event-plus:verb)] ^- (list card) ?: =(~ events) ~ ::NOTE tmi + =/ first=event-plus:verb + (rear events) =/ pax=path - =; period=time - ::NOTE may overwrite if you write multiple times within a single - :: write-interval. perhaps we should just use the full date? - /verb-logger/[dude]/(scot %da period)/json - ?> ?=(^ events) - (sub now.i.events (mod now.i.events write-interval)) + /verb-logger/[dude]/(crip (a-co:co (unm:chrono:userlib now.first)))/json =/ vex=@ (en:json:html (events:enjs our dude events)) [%pass /write/[dude] %agent [our %hood] %poke %drum-put !>([pax vex])]~ From 9f906119373fecbbbfa01350fe3d683d367f00ab Mon Sep 17 00:00:00 2001 From: midden-fabler Date: Sat, 30 Mar 2024 12:08:44 -0400 Subject: [PATCH 200/252] base: %test - add desk to argument --- pkg/arvo/app/test.hoon | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/arvo/app/test.hoon b/pkg/arvo/app/test.hoon index cbfdce71ec..e32934769f 100644 --- a/pkg/arvo/app/test.hoon +++ b/pkg/arvo/app/test.hoon @@ -2,6 +2,7 @@ !: |% +$ card card:agent:gall ++$ command [=desk =test] +$ test ?(%agents %marks %generators %threads) +$ state $: app=(set path) @@ -14,7 +15,6 @@ ted-ok=? == -- -=, format ^- agent:gall =| =state |_ =bowl:gall @@ -28,9 +28,9 @@ |= [=mark =vase] ^- [(list card) _this] ?> (team:title [our src]:bowl) + =+ !<(cmd=command vase) |^ - =+ !<(=test vase) - ?- test + ?- test.cmd %marks test-marks %agents test-agents %generators test-generators @@ -54,7 +54,7 @@ |=(c=@tD `@tD`?:(=('/' c) '-' c)) =/ sing=card :+ %pass /build/mar/[mak] - [%arvo %c %warp our.bowl q.byk.bowl ~ %sing %b da+now.bowl /[mak]] + [%arvo %c %warp our.bowl desk.cmd ~ %sing %b da+now.bowl /[mak]] %_ $ paz t.paz fex [sing fex] @@ -76,7 +76,7 @@ $(daz t.daz) =/ sing=card :+ %pass /build/app/[i.daz] - [%arvo %c %warp our.bowl q.byk.bowl ~ %sing %a da+now.bowl dap-pax] + [%arvo %c %warp our.bowl desk.cmd ~ %sing %a da+now.bowl dap-pax] %_ $ daz t.daz fex [sing fex] @@ -96,7 +96,7 @@ $(paz t.paz) =/ sing=card :+ %pass build+i.paz - [%arvo %c %warp our.bowl q.byk.bowl ~ %sing %a da+now.bowl i.paz] + [%arvo %c %warp our.bowl desk.cmd ~ %sing %a da+now.bowl i.paz] %_ $ paz t.paz fex [sing fex] @@ -116,13 +116,13 @@ $(paz t.paz) =/ sing=card :+ %pass build+i.paz - [%arvo %c %warp our.bowl q.byk.bowl ~ %sing %a da+now.bowl i.paz] + [%arvo %c %warp our.bowl desk.cmd ~ %sing %a da+now.bowl i.paz] %_ $ paz t.paz fex [sing fex] ted.state (~(put in ted.state) i.paz) == - ++ now-beak %_(byk.bowl r [%da now.bowl]) + ++ now-beak [our.bowl desk.cmd da+now.bowl] -- ++ on-watch on-watch:def ++ on-leave on-leave:def From 7773f673426ff296cf5ead1728dbc18f68a98e76 Mon Sep 17 00:00:00 2001 From: pkova Date: Sat, 30 Mar 2024 19:56:55 +0200 Subject: [PATCH 201/252] ames: fix bug in dead flow consolidation toggle --- pkg/arvo/sys/vane/ames.hoon | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 43007fbbdd..207498141b 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -2306,6 +2306,7 @@ %- (slog leaf+"ames: turning off dead flow consolidation" ~) =. event-core (emit:event-core duct.u.ded %pass wire.u.ded %b %rest date.u.ded) + =. flow.dead.ames-state.event-core [%flow ~] (wake-dead-flows:event-core ~) :: %- (slog leaf+"ames: switching to dead flow consolidation" ~) @@ -2854,7 +2855,7 @@ :: ames-state changes :: ++ wake-dead-flows - |= [error=(unit tang)] + |= error=(unit tang) ^+ event-core %- ~(rep by peers.ames-state:event-core) |= [[=ship =ship-state] core=_event-core] From c010629c8b56108757a0d2fe7744c751086bf14d Mon Sep 17 00:00:00 2001 From: fang Date: Mon, 1 Apr 2024 14:44:05 +0200 Subject: [PATCH 202/252] verb-logger: support flushing across all agents --- pkg/arvo/app/verb-logger.hoon | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/app/verb-logger.hoon b/pkg/arvo/app/verb-logger.hoon index 5d78e058b2..177193e57b 100644 --- a/pkg/arvo/app/verb-logger.hoon +++ b/pkg/arvo/app/verb-logger.hoon @@ -168,9 +168,18 @@ this(events (~(del by events) dude)) :: [%flush =dude:gall] + |- =* dude dude.q.vase - :- (write-events our.bowl dude (~(get ja events) dude)) - this(events (~(del by events) dude)) + ?. =(%$ dude) + :- (write-events our.bowl dude (~(get ja events) dude)) + this(events (~(del by events) dude)) + =| cards=(list card) + =/ dudes=(list dude:gall) ~(tap in ~(key by events)) + |- ^- (quip card _this) + ?~ dudes [cards this] + =^ caz this ^$(dude.q.vase i.dudes) + =. cards (weld cards caz) + $(dudes t.dudes) == :: ++ on-agent From a19daa88edd34030946df1e96a13158097231ba4 Mon Sep 17 00:00:00 2001 From: fang Date: Mon, 1 Apr 2024 15:11:35 +0200 Subject: [PATCH 203/252] log-viewer: mvp Needs usability improvements for event details, range selection, among other things. --- pkg/log-viewer/index.html | 279 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 279 insertions(+) create mode 100644 pkg/log-viewer/index.html diff --git a/pkg/log-viewer/index.html b/pkg/log-viewer/index.html new file mode 100644 index 0000000000..258d59e1bc --- /dev/null +++ b/pkg/log-viewer/index.html @@ -0,0 +1,279 @@ + + + + + + /app/verb-logger log viewer + + + + + + +
+ Showing logs from never until never. +
+
+ + + + +
+
+
+

+
+
on-init
+
xx
blah blah blah
+
+
+
+
+
+ + \ No newline at end of file From f370a46c806e1dbf4f1da028f183cbc4a8f8e7e6 Mon Sep 17 00:00:00 2001 From: fang Date: Mon, 1 Apr 2024 21:15:11 +0200 Subject: [PATCH 204/252] log-viewer: actually render event details And lets you click events to make their details sticky. Also improves date rendering in some places. --- pkg/log-viewer/index.html | 103 ++++++++++++++++++++++++++++++-------- 1 file changed, 83 insertions(+), 20 deletions(-) diff --git a/pkg/log-viewer/index.html b/pkg/log-viewer/index.html index 258d59e1bc..a87524eebe 100644 --- a/pkg/log-viewer/index.html +++ b/pkg/log-viewer/index.html @@ -21,6 +21,7 @@ let oldestText = null; let newestView = null; let newestText = null; + let clicked = null; function setup() { viewport = document.getElementById('viewport'); @@ -57,7 +58,6 @@ function addLogs(dude, start, newLogs) { let agent = agents[dude]; - console.log('addlogs', dude, start, newLogs); if (!agent) { agent = { @@ -89,7 +89,18 @@ newestView.min = dataRange.oldest; newestView.max = dataRange.newest; newestView.value = Math.min(Math.max(newestView.min, newestView.value), newestView.max); - console.log('oldest', dataRange.oldest, oldestView.value); + } + + function clickEvent(e) { + if (clicked !== null) { + clicked.className = clicked.className.replace('focus', ''); + } + if (clicked === e.target) { + clicked = null; + } else { + clicked = e.target; + clicked.className= clicked.className + ' focus'; + } } function render() { @@ -97,10 +108,11 @@ // let oldest = oldestView.value || dataRange.oldest; let newest = newestView.value || dataRange.newest; - console.log('oldest/newest', oldestView, newestView, oldest, newest); - oldestText.innerText = oldest; //(new Date(oldest)).toLocaleString('en-GB'); //'yyyy.MM.dd..hh.mm.SS'); - newestText.innerText = newest; //(new Date(newest)).toLocaleString('en-GB'); //'yyyy.MM.dd..hh.mm.SS'); + //TODO figure out why we need the parseInt here... + //TODO nicer formatting + oldestText.innerText = (new Date(Number.parseInt(oldest))); + newestText.innerText = (new Date(Number.parseInt(newest))); // if (viewRange.oldest === null || viewRange.newest === null) { // for (const [dude, agent] of Object.entries(agents)) { @@ -139,6 +151,7 @@ const top = (cause.events.length % 18) * 5; const vent = document.createElement('div'); + vent.onclick = clickEvent; vent.className = 'event'; if (left > 50) { vent.className = 'event right' @@ -163,10 +176,53 @@ } const deet = document.createElement('div'); - deet.className = 'details'; - deet.innerText = JSON.stringify(event); - vent.appendChild(deet); + deet.className = 'details' + ((event.effects.length > 0) ? ' effects' : ''); + let deets = + ` + act: ${event.act}
+ now: ${(new Date(event.now))}
+ src: ${event.src}
+ `; + switch (kind) { + case 'on-poke': + deets = deets + + ` + mark: ${event.deets.mark}
+ mug: ${event.deets.mug} + `; + break; + // + case 'on-watch': + case 'on-leave': + deets = deets + `path: ${event.deets}`; + break; + // + case 'on-agent': + deets = deets + + ` + wire: ${event.deets.wire}
+ ${event.deets.sign}
+ `; + switch (event.deets.sign) { + case 'poke-ack': + case 'watch-ack': + deets = deets + (event.deets.deets ? 'ack' : 'nack'); + break; + // + case 'fact': + deets = deets + + ` + mark: ${event.deets.deets.mark}
+ mug: ${event.deets.deets.mug} + `; + break; + } + break; + } + deet.innerHTML = deets; + + vent.appendChild(deet); cause.events.push(vent); causes[kind] = cause; } @@ -198,6 +254,7 @@ html { background-color: white; padding-bottom: 10%; + font-family: monospace; } #viewport { position: relative; @@ -233,36 +290,42 @@ height: 1em; border-radius: 50%; background-color: rgba(0, 0, 0, 0.2); - border: 1px solid rgba(0,0,0,0); + border: 1px dotted rgba(0,0,0,0); + } + .event.effects { + border-style: solid; } .details { - position: relative; - top: 0.5em; - left: 0.5em; + display: none; + position: absolute; + top: 0.75em; + left: 0.75em; + z-index: 2; + min-width: 20em; display: none; overflow: visible; + border: 1px solid black; + background-color: white; } .event.right .details { left: initial; - right: 0.5em; + right: 0.75em; } - .event:hover .details, .event:focus .details { + .event:hover .details, .event.focus .details { display: block; - position: absolute; - border: 1px solid black; - background-color: white; + } + .event:hover, .event.focus { + box-shadow: 0 0 10px 0 #f30; }
- Showing logs from never until never. + Showing logs from until .
- -
From 00d6748561cb07fbcc4dabaa4e0089322f2d23f3 Mon Sep 17 00:00:00 2001 From: fang Date: Mon, 1 Apr 2024 22:15:27 +0200 Subject: [PATCH 205/252] log-viewer: display event effects in detail Also prefixes marks with %, mugs with 0x, always. --- pkg/log-viewer/index.html | 75 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 71 insertions(+), 4 deletions(-) diff --git a/pkg/log-viewer/index.html b/pkg/log-viewer/index.html index a87524eebe..a670aacaa6 100644 --- a/pkg/log-viewer/index.html +++ b/pkg/log-viewer/index.html @@ -178,6 +178,9 @@ const deet = document.createElement('div'); deet.className = 'details' + ((event.effects.length > 0) ? ' effects' : ''); + // prevents toggling summaries from un/focussing an event + deet.onclick = (e) => e.stopPropagation(); + let deets = ` act: ${event.act}
@@ -188,8 +191,8 @@ case 'on-poke': deets = deets + ` - mark: ${event.deets.mark}
- mug: ${event.deets.mug} + mark: %${event.deets.mark}
+ mug: 0x${event.deets.mug} `; break; // @@ -213,13 +216,77 @@ case 'fact': deets = deets + ` - mark: ${event.deets.deets.mark}
- mug: ${event.deets.deets.mug} + mark: %${event.deets.deets.mark}
+ mug: 0x${event.deets.deets.mug} `; break; } break; } + + deets = deets + `
${event.effects.length} effects`; + if (event.effects.length > 0) { + deets = deets + ':'; + for (effect of event.effects) { + deets = deets + + ` +
+ ${effect.kind}, ${effect.deets.wire || effect.deets.mark || ''} + + `; + switch (effect.kind) { + case 'poke': + deets = deets + + ` + wire: ${effect.deets.wire}
+ gill: ${effect.deets.gill}
+ mark: %${effect.deets.mark}
+ mug: 0x${effect.deets.mug} + `; + break; + // + case 'watch': + deets = deets + + ` + wire: ${effect.deets.wire}
+ gill: ${effect.deets.gill}
+ path: ${effect.deets.path} + `; + break; + // + case 'leave': + deets = deets + + ` + wire: ${effect.deets.wire}
+ gill: ${effect.deets.gill} + `; + break; + // + case 'fact': + deets = deets + + ` + paths: ${effect.deets.paths.join(', ')}
+ mark: %${effect.deets.mark}
+ mug: 0x${effect.deets.mug} + `; + break; + // + case 'kick': + deets = deets + `paths: ${effect.deets.paths.join(', ')}`; + break; + // + case 'arvo': + deets = deets + + ` + wire: ${effect.deets.wire}
+ task: %${effect.deets.vane} %${effects.deets.task} + `; + break; + } + deets = deets + '
'; + } + } + deet.innerHTML = deets; vent.appendChild(deet); From 74fff24b0f194f5cb1f536ad63586451d59ebad9 Mon Sep 17 00:00:00 2001 From: fang Date: Thu, 4 Apr 2024 16:34:53 +0200 Subject: [PATCH 206/252] gen: prevent re-creating existing moons in |moon Apparently the operation triggered by this generator may cause the rift for the specified moon to be inaccurate if |moon-breach was run previously. Here, detect if the moon has been created before, and recommend the other generators if that is the case. --- pkg/arvo/gen/hood/moon.hoon | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/arvo/gen/hood/moon.hoon b/pkg/arvo/gen/hood/moon.hoon index 84ec5cfe2a..f2555a0604 100644 --- a/pkg/arvo/gen/hood/moon.hoon +++ b/pkg/arvo/gen/hood/moon.hoon @@ -24,6 +24,14 @@ ?^ arg mon.arg (add our (lsh 5 (end 5 (shaz eny)))) +=/ ryf=(unit rift) + .^((unit rift) %j /(scot %p p.bec)/ryft/(scot %da now)/(scot %p mon)) +?^ ryf + %. ~ + %- slog + :~ leaf+"can't create {(scow %p mon)}, it already exists." + 'use |moon-breach and/or |moon-cycle-keys instead.' + == =/ seg=ship (sein:title our now mon) ?. =(our seg) %- %- slog :_ ~ From 4066329d59e1f55768ac784b5ca614bbf34627b4 Mon Sep 17 00:00:00 2001 From: pkova Date: Thu, 4 Apr 2024 19:08:27 +0300 Subject: [PATCH 207/252] ames: do not wake flows when switching to dead flow consolidation --- pkg/arvo/sys/vane/ames.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 207498141b..ed9740bdc8 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -2311,7 +2311,7 @@ :: %- (slog leaf+"ames: switching to dead flow consolidation" ~) =; cor=event-core - set-dead-flow-timer:(wake-dead-flows:cor ~) + set-dead-flow-timer:cor %- ~(rep by peers.ames-state:event-core) |= [[=ship =ship-state] core=_event-core] ^+ event-core From 362e67092ce22ed40b7318e6650c46f317099dc3 Mon Sep 17 00:00:00 2001 From: fang Date: Thu, 4 Apr 2024 19:55:54 +0200 Subject: [PATCH 208/252] log-viewer: make sure to ingest files in order --- pkg/log-viewer/index.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/log-viewer/index.html b/pkg/log-viewer/index.html index a670aacaa6..57f384d235 100644 --- a/pkg/log-viewer/index.html +++ b/pkg/log-viewer/index.html @@ -41,10 +41,15 @@ if (logs.kind !== 'directory') continue; if (dude === '.DS_Store') continue; + let files = []; for await (const [key, log] of logs.entries()) { - if (log.kind !== 'file') continue; + if (log.kind !== 'file') continue; if (key.slice(-5) !== '.json') continue; + files.push({key, log}); + } + files = files.sort((a, b) => a.key < b.key); + for (const {key, log} of files) { const start = parseInt(key.slice(0, -5)); const contents = JSON.parse(await (await log.getFile()).text()); const dudekey = contents.ship + '/' + contents.dude; From 614fcdf537ab14d51b78c42df9b14537c20a3fdd Mon Sep 17 00:00:00 2001 From: fang Date: Fri, 5 Apr 2024 21:03:18 +0200 Subject: [PATCH 209/252] debug: build using vite, remove gulp Forget flavor-of-the-month, gulp expired _years_ ago. --- pkg/arvo/app/debug/{js => }/channel.js | 0 pkg/arvo/app/debug/css/index.css | Bin 85415 -> 0 bytes pkg/arvo/app/debug/index.css | Bin 0 -> 85167 bytes pkg/arvo/app/debug/index.html | 32 +- pkg/arvo/app/debug/index.js | 89 + pkg/arvo/app/debug/js/index.js | 67646 ---------------- pkg/arvo/app/debug/js/tile.js | 19366 ----- pkg/interface/dbug/gulpfile.js | 183 - pkg/interface/dbug/index.html | 15 + pkg/interface/dbug/package-lock.json | Bin 496584 -> 117991 bytes pkg/interface/dbug/package.json | 60 +- pkg/interface/dbug/public/channel.js | 292 + pkg/interface/dbug/src/css/indigo-static.css | 2 +- pkg/interface/dbug/src/index.css | 1 - pkg/interface/dbug/src/index.js | 17 - pkg/interface/dbug/src/js/api.js | 2 +- .../js/components/{loading.js => loading.jsx} | 0 .../{message-screen.js => message-screen.jsx} | 0 .../src/js/components/{root.js => root.jsx} | 22 +- ...searchable-list.js => searchable-list.jsx} | 0 .../components/{skeleton.js => skeleton.jsx} | 1 + .../{subscriptions.js => subscriptions.jsx} | 4 +- .../js/components/{summary.js => summary.jsx} | 0 pkg/interface/dbug/src/js/store.js | 2 +- pkg/interface/dbug/src/js/subscription.js | 4 +- .../dbug/src/js/views/{ames.js => ames.jsx} | 0 .../dbug/src/js/views/{apps.js => apps.jsx} | 0 .../dbug/src/js/views/{behn.js => behn.jsx} | 0 .../dbug/src/js/views/{clay.js => clay.jsx} | 0 .../dbug/src/js/views/{eyre.js => eyre.jsx} | 0 .../src/js/views/{spider.js => spider.jsx} | 0 pkg/interface/dbug/src/main.tsx | 35 + pkg/interface/dbug/tile/tile.js | 11 - pkg/interface/dbug/tsconfig.json | 25 + pkg/interface/dbug/tsconfig.node.json | 11 + pkg/interface/dbug/vite.config.ts | 18 + 36 files changed, 542 insertions(+), 87296 deletions(-) rename pkg/arvo/app/debug/{js => }/channel.js (100%) delete mode 100644 pkg/arvo/app/debug/css/index.css create mode 100644 pkg/arvo/app/debug/index.css create mode 100644 pkg/arvo/app/debug/index.js delete mode 100644 pkg/arvo/app/debug/js/index.js delete mode 100644 pkg/arvo/app/debug/js/tile.js delete mode 100644 pkg/interface/dbug/gulpfile.js create mode 100644 pkg/interface/dbug/index.html create mode 100644 pkg/interface/dbug/public/channel.js delete mode 100644 pkg/interface/dbug/src/index.js rename pkg/interface/dbug/src/js/components/{loading.js => loading.jsx} (100%) rename pkg/interface/dbug/src/js/components/{message-screen.js => message-screen.jsx} (100%) rename pkg/interface/dbug/src/js/components/{root.js => root.jsx} (86%) rename pkg/interface/dbug/src/js/components/{searchable-list.js => searchable-list.jsx} (100%) rename pkg/interface/dbug/src/js/components/{skeleton.js => skeleton.jsx} (99%) rename pkg/interface/dbug/src/js/components/{subscriptions.js => subscriptions.jsx} (95%) rename pkg/interface/dbug/src/js/components/{summary.js => summary.jsx} (100%) rename pkg/interface/dbug/src/js/views/{ames.js => ames.jsx} (100%) rename pkg/interface/dbug/src/js/views/{apps.js => apps.jsx} (100%) rename pkg/interface/dbug/src/js/views/{behn.js => behn.jsx} (100%) rename pkg/interface/dbug/src/js/views/{clay.js => clay.jsx} (100%) rename pkg/interface/dbug/src/js/views/{eyre.js => eyre.jsx} (100%) rename pkg/interface/dbug/src/js/views/{spider.js => spider.jsx} (100%) create mode 100644 pkg/interface/dbug/src/main.tsx delete mode 100644 pkg/interface/dbug/tile/tile.js create mode 100644 pkg/interface/dbug/tsconfig.json create mode 100644 pkg/interface/dbug/tsconfig.node.json create mode 100644 pkg/interface/dbug/vite.config.ts diff --git a/pkg/arvo/app/debug/js/channel.js b/pkg/arvo/app/debug/channel.js similarity index 100% rename from pkg/arvo/app/debug/js/channel.js rename to pkg/arvo/app/debug/channel.js diff --git a/pkg/arvo/app/debug/css/index.css b/pkg/arvo/app/debug/css/index.css deleted file mode 100644 index 1121ba3f857318fbfc4b753b34c16cc54f0b967c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 85415 zcmdVD36CVXbuIi?$|DGvu`_FG>#FW781QVe2a+X?Wa)jDAsD$c78p z_e(Oex?8pdd>Uw`@-By$3F|CdAK<}J3Tx3zbF6t z-YkdvuS>tb|9XB{Ek7(5>uG;JUEIwNgY(n# zSGWDuzJHiL9r}Be&>v3za=(Y>?Cj^a{m1F(?c&g_eI9Kl?>?-CySv4DaP~ah9Twx| zv^U%@Cez+*vpGz6z4>%F!GG4nhu(fVJ}frt50k}yyBxk7jFy}6+voZDhuLN=MGr2f zt6Rl8y}p^QPR^cZi@Wh~OO8GKdB2MUNA{qU6ZZ{9p-E6se96T)ci_voWyxmPDpxJP>SiT#qHtWrPI~=22`|CCWMp4hh z52NAu?cHv3zn=8b?3>--up6%7v_o-a6Hd@CyCK!4zkj>f4mP8|pjGzI!_jE>ABV+Z zIsG$2-l545=Hake4c43W^p-m(dU-EQ^^YWTr!x;Dp&vLyIqhc{syJ((|Ksp(JN?JqbU!`(xhFr+w5tVvsWS~nC!!I_pFh}$Gu&>c zLtIAV=|EHpr*?xuf3j^64W1^2WPkM>j1#g4&VTeHyWAan~aWOf}<*r~woZUXo7l&z|$4B%z-J>vo zZtl?Md(ZcLX&k-gJZU}Ehxdn#w(od89lu4?mPNZEEcN z8D|S(Uab4l(ArUrAsQUxa5DU$S8WPyk0c$>JJXh`#JzH>J=fpNX6T_o{{r_Wy&l9p zf)l*{m=b?k#-~L!wsBwRx_Edv37^?wIqlzXmz&{4(Yu_aU3jDzXhu9wribBTx$mu} z>wE888SnP@D-0U%T)JHB4}B!Y>KXNT7}>RV|m?LUSFSHH+EM~ZG^9I!>j82`sr0&@b$%M8{n&_*R|dGbqjaX!rh#o zUR^ZhzIwW8@UB|C^QZI147Z-T7VaF?gb~&9L zAWs96J=D^D?LBS_lj#$USkHJS#?3xITkt~yOaE@M+HQ7-;rc*kYb5!)!;t0KbadCp zb2kQvZ0wpF>{q2B3voC)=ci1=_d|A&;kWt)%p4Qn!T8B$)tUJpT zhfYvYF)X!pwyB|R(=)IKg@zyD=~$j;<>>}Jx|pB~`4Lxp4x{1e2R=U}2#(sCZ;k&a+cX@f~y7NkRHKBi8eNm}zX7rD%FDv!vd~`7i@T*Eay{3QM z`&Ff$y`g_tJzCyR>#(Qe*|pY+)OF;ev++$**O6acUY^ay4qiuo{^o3QGh+2_I;o4E zy_sB(r>3n-p3R15H&Sc()&)=Qux=UUkrygH`1o;UzdOJ`g;266-W1Oy2Q(E9l&fhosF|W9l>lid2=K66NEa1 z*?4?)B~=uII)>@=^_vT6`}8tgCPz{r*quj7k9YTbJY7TRk*VK)X5X!C^9+5(ML}akwu0)dWNXR66DbnL=~DJkDebQ z*YtSwK~2OLk~N3E=Sk8Xqd>>{wLPmhM65 z^#5)T%^leHhP`rjk>5N1>mE~#J(`5<@nqCw(wi(EdXr^ua=>Jvybsf?VKsrMQE@L1Y@5mS$HRdaY6x%~s$#*Y1WM<@E!s$%J+V&fL5?>g1tRbXlbh@R>lzrK6zMMb52ODJP^qYuPUsy z)NHJx(so_hR)L6d#4)_EI0mPdcNbciN!BouvS{*Kv(EiA>(qH^riFN2i5&(HaMlc3 z4aI??te(i%wcL>ofy5oFI1npNlCDdsV~hgBGC^UWQJ7M(ZWIpo5MW-k_iu@^f^8k; zZFhO4r4&|~dIa-`K+=XP;~|vo4O=ZRnX06)TvwK52$o*bY}=vFm<=!qt;5=-mgJ%} z%%mvfmzr&t?y8w&{!kQ=s(f9^18EmXS`&kUrmUi2)rtT+1Q_?KK|!uiS-dXA0W%61 zO9exMN|7qfy3qvQL*PaE-qjV*3f4`qw?_&sZMDS8IO3Q`9Fj*|D-Wbc~LJ# zsl^6!2pH;51%XsSLbxu41~3W$?R~|7LNN;Yx{({wLm*kH-k$};3YJxPx1B|mc3e(n zXl2i%Y|ap>gBM=3FD$jJFjPUdTUT~P;hIF!P}`wTr(=PHKa;)EVnVitp_DY}yWw`} z-kM7e0ZkF9Db|%Df$aiJD`QS8sLE=ZW?gF%-XZX~OU-8mg`ySmbtz9sqd>A;a4_f; ztX8cXRf2p7$P|S4dX2S$eH-)bv64$`E4DH>Fy{%A?D^wP*OL4%A0>%?Wk)TqfO0#Y>f%g!2QNDM21+;>76YTAgLQ7jM zu`-T0<`IYH6V=KCsoEdbT52{{QE9ubY^y*#^P~~CL;uD%keRO)Bm%60bqM-mvR%59 zq?~#}oTC)!x{?~kE-)k}1%bS%m!i~SgE<5Y^{0YBsvsd;mqG&=1%URxVnCr7g?!z} z4e23}tW@vM0%8TrD!kjyqDnh1r!us%=TSCi2-U$0FWMKDT2>gUAlt1gyP|MSB5A1Y z&_6p5F7-{|wU(iRHB6+8L0?R^OLvkKQcs9;bRu0>Qp4Bshk&7e zQxHfMB!ufyXaJ)C(0*17C={cRuN%1`Jp_`K>b+P%tYBG%ciUN1X~*SMhF11G%I3_V zI(Xql`@&Mo3PTlSyLDw(6s{>G4YeKmqK?6prqCNLLj`M?NEw5^m~5BsBq^kx5a;Mb zx~`;#u?q}|NI@VkYNRN&*kBF;L;a>8kSa(B*QL+^MggGxtQb%zMj>A}azlCuBrDZ> zv4B{?vI_6Ev#8RJ%c%^l?0J;UnL%~%!i)BWrIrZQMaX~6+chKbFxrP zy!@iA$y7nYQU%!%Q>mq4QNHGtG#K*ACv>se$P&w@ZB2yCauL2avl&v$T_v^5pASdGHL4hf8U$)HHCP)UpwE5r^nN-&xQhD0hwDmBQmTH|;R z3D3*-elBs4XpR%M-9=WWQr>N8>p{#@5S&6>C6A(Pdoos>WUG?G6bVSDv6PDh1g+63C0pakw~RTr3NWiYaH((;d%Mq*(DBA&T+!FyU5B^%DXLXJ&1V< zLehw;l3J2_(sbr{1g)iq#<|#1Mi!Fhzf^* zW57@HKWBfLV-tvTg%Fvd&_V}B5h(+m3y??%>w>Z5{X(!V6iZ}^MT;O9OQei-Ay^_I zEDcO&9t90Dshvs{k5^$ZpvoB$Qm&`U7*hh&w=c!C5LIfJ9;C_zQ^Qo5Er#v)v4ndm z9dRoWp51C4ZAmN^vd#v>8STHKzeZCmb(nt8{ZE50PQJJ;miLGG2khS(?goIHlkmge zzu#aB(mDQKs)|Cx&z=6{0PuTMdam`SEZdpHb}bbwe5to=4tPGDj9esZ%1L^$Dw`1OuDnuw!7rqO`jC`E<6NK6yy=<+2d}AJz9iB ze+}qg>bBlgIuWRrbXX>hCER;#&MW*)td`oag>4;a<$~}`(h<3-(9+nZfGt$mT6Orq z8^(Bt!+yZ=u-I&9k4<9%q3Lzqcs3D{8Q4y=0>y-8gxz}6!+2iUs0>TMrps9oD+!8F z*&-qhJqOC#B2G52Fj;K@X#{LwGLIm~$QB+VZ8BZV-f5Kf%Lb|3s-~l8?eD^lLw1d< z%J-kL>vLeCn|w4qJYsEa1IT-s`l@|CHS-~F?>u5HN(_U#!!##J5vZn#*+uggR$Lvk zDLTQ-tTJX~m64P(tEwtytX1iECU~ua*CxOQ=!42=#V%G%b5>zwf5d}{ z|4o7W58TQ9Z@TgEkNq6``QDn3{Bkcu~&g{`m`JVQ=^_T`zVgYpgZY zzp=1!`7osouaMqP<7e-FbiY2__jViH_cuLkTisyA;oW9>a=*Z`%f)bsExxvUlrC&+ zA}xZsn{KcLeAqiIR?|IPp@$jA(htwVCB$Lb;3^WY?WBJd2;XhiSTH=qezeVcINrqW zY`P5ZcMELH;f=1kjr%*1o&1^_L=Cc!H%{T@(z?lV{L<8gUq|Z~9tQwpTU-usD6*b4 zrdD2m7N(U6H+x}FbOhGNZq|!J|1FD7{`KFiv#<#oTlVmXfYj+*i-{~*-C;j2T6VI&?5`v@Qw>VihU*^i)7c)+9<-5EO0gX@ytVW+YjijI6>aYtiLr`q zNHoK`aITIDc^lXaOTx48LM$%};iU+#3LzIW!%Fb%{z@#b3*og0ZwjG?^tuqf7Rxt< z@C^xhV>cc>Xg{xQTTL6HX=ngx1NJ{xLbL?$2o_iD`mFazXXI9mcO_b_AB$OOki%w` z`@56BFSZ}^QvH)V5CN!O_A7N-VgEjc14fY@Pu*6uwO_67b_;AAa88BHrf`C_(qB%7 zhv8tc8s1I6-mdSk^K3u8zUnRh`0a0g_jvZpf49etKmP9OoB#9MZ@znT^Yxpjv*~yHZ+`gg-QzcZ{MCLw+5YhB zAD_l#`pxhE@WoKS|Kv%wB)}W=@iS zeQQDg=I*;+z5jZ2Hr;+Ry#B*K-+%j?|N7})e)H46{OS*Pzxd(%^*5vOw|~0&!#_WM z|C_gq@78aBoKNn4efR4pG{WNFm*4-x>-`V+o7Y^(CsposUw3Row@}B{{c#6=0qu|9 zoh|?QH{Va@-+lAVkKg?E2Nd=FG7ZM|Mb(t-EcbkdigZ^ z=Eq-t^ZMP{H@|uO$CujsuZ{`P{8YsB^#8r%xZX)jtVc{g{^{Lse>r~p@8AFQi~Z>O zPyhA(>sNpI)5Sl0`}T41yI=frI-md7Pv8A?_x-<&?;d~n_NQ-d%G{v4vJfN07Hwfh zI3-n&|2-Ij73E>7KbX%z|DMyref>Mx6aNATJwEX6DPgq0ThC^90w$OJ$rKj@Hoju| z1tkm^uDEh#htA3Pen;da-;pEP;z5ZwZS!#3C*B4P6f25tQ!URjVg;!Fmgy5L&C}oV zkp*k4^tVhKVU>&d%WV0)f8iqDlRfXhIx`#IHaqX%xCL*ro?|N1O=P1hzp=77y}OF) zp)BD6GZ_%&GE|gHQBheA2?-wVq$o=wB@wSvqF0GV!>w>sJWd2H~Z?Vj9M17^xc>cdg;Cg6GAWjTz6jbwo9v@?ze=@>tnktd5fhLt$QmWb3EHosoNS5ZRN!>7Mwz^Z&wn?hk_D701MJu}^ZA+wC>t0CP2&rP<0eNQ|eSPRu zmLN$2Yz^1VzKvcs{N7=nh&TK;dfD_VdQ6%&dP^4+K@gZ`Y)mY9)C7CL8WT$;HNlpz z#>5g!O|ZwSG4V8`=HQLMjfp3nm~_?1Q&3F0YUBwiCS5hM^hCJGGVJ1OLh;SPY|#~o zrLJIf1>&288KWx>OKWa6*(lsZ;+uu34`I_4i>18bbVXwqfZ24#;~R(X`gTQhG>vT@ zHlwbHd;_r=b%o@ch|Q=grgRyl{laaRB_#%Cx^>EBC-=Z!A!4u^3O9PGLcpNrP#qV%x~Ieac#pUcw6uI%u+YJILsAG_4U z=T+so48o^sH|7f{%dycRe5!UMpQ_z#xCo!B-N>hEHyc01 zhlY@{IxJzO)yBpX_oylZk17Xjd~uJeD)6XkV&jc_R26|oRSz3~#Dj;IswOI91FMUT zNXe_JjSN&}-(2WzIeAqzVy~)BHfklWs#fe()yu{)@zSBJ>>?AgiPg;R``NFmn)o$+ zB@YJKud1B*RkgDLF#A>26Thl{HYSQ6Ms$9(EGy_zHfqO9dH8UIj-d|-dGzbL6X3<( z5jw^~zSrQ=El4#W3rO2Ld01{isu5a1+TO|I zbPG}r*{D56!?sCSc)VGKFoyMgfoK~95H>orQIvzaK(x&P2pcF`h;oz{h_*2RVPi%M zQ4afn&{19|AH04lKGq)PeZXMa7Gape1!;^%%iQq zNfR=eOIv}DCS)?7w!$Zfke%z2-ACH|V-%g2hDh5uOn7DPv@qX<*H#WKwKm}!!<023 zp^y)fD-hApWSHB_tlN5uFOfulynWYCEqDSBlhb3m?Qsy2H8)+Xgxe&rkQZml>E>;bOos` z2#rsO)L1E$&OpUjCd;jT0@sCJ>WA)pyFVG)v-st!o9P6!)x@NIe3rZPwZW&7%CMu; za&NB3i->Ul^yS%CQrly4xgr{f z6Wq-78xV3NH<*|5*(SY@lp@V#ZB0$5IoSAtUJA|j6R{+^= z7R0tIQS^)xPcCJA&D`VE1vSBnA|cEZrL)mG?|&Mzag@NxDK44u{b(`9s=xPGH}vJ{ z`896muW`%2y6T+=p`HvXysjE|DLzbM@WmHceC>R8#L9Pm4MMw?mJen^S1S~f#RtI1%lS6_*GWL@{`xmbKq~|L z*GWKY2kA?&W8n6?>0c!Qtv~EvCIPKb>|Z1Stzkr9fx&^DVZEXScE+e@_{<$5dfeM! z0ij9oXtmoM&~E*!SH8l>$7r1TK)NrlUQMQV`Kl`94uMu_FDNy|huBUCkvqisLnCqbN{z$D)crK_(nWxj7Qcg(w{5^8AHZpzMxC73gv~ zvY}Xkp){we>T{>dQ8BIANzytRrI8*5fi!YAA0}vMenFS~(?YNML;;CQ70jnkw45`dTnW36!o@D(+Doxg4xZqtI z(Yua_-Zc@~16-;dR;pJKy>q_IRAA9UpxBg%u<#ozZ-d%iek0BFESk`m1myTie;+!N zV09yJ7x7yg|D=Vl%jIy3Jra7avEQ^sgB5lYvMChg57y%^ws>>LTRSFDz#)o7!n?ux zfLRTC_WyD-nS9mp^)1MW@!%CAx7^vyvScypdWTwrpwI_<1Dm&1&6<6sqTTmG@4n*oeI>t zymI$F`sQGzh8l0A)7=ZQEHac8g`Ao7aWl@^x(qTS1LMF~;x^S39!c#HRWy36ziMW|A z8fKAkGR<_+unLXUe5T8WMa;8>GhH;yqSM#PayQde!y+~QK&<||$4 zB((h0322%VHVK_W@<@-&3a7u#gV%gM(lfT`FGYW851OEdrU}e(YoRXE#w9 zAL@he0_=Kt+=z0oS~|%G|D#ic9wmDONiym^p5N@P4fo&o*l}b(@hb5i8=LJXUNzqL zFa0N8Mc((X{3q^b@B6R(Ctfh#_p!;z1-#*jMTHEnP4D}-$ldPZ{OacF_2u;yUYDq3 zKJd@AzIv5Zn03Ow3=7YybC1&}4=&|j&;PWVP8P!xT!C1!b~0Q~PQF}Wl0n+x^6K=G zjwSm_75*vV>YBzkC_a?u8?9_DZF);i&q?W=C^`PAzw!xl-5GuS0I1gX_z_U8ZTBHi zt=;ispjz8w2SK%#=iNs^wT8zIgK90090%1J9z77MH9hBRc35`P(|Ly>9<;g-g(6!! zztIL%ogb0W`V5b@!aQ*MX%i;6tm%Q7)(Nii^DW;{j~xuvX?pxba=5m`>ex9%z2-ewucx}Bkj(@E*~aC7gRaP7)PP(E?T9XhO)bCbwd3( z+Fdm&W$M_`PWTm9B)Q^nozSK$4>~(uhxNr&{zneKk@hG&K6b=TS;nUxveWI=eQ1u>Mq1Zn zd-~3kRhoT%nOIbgjZI8`m0m~*eHW(CpsQ0 zHNZ*-0)QF_c7B7hHwV-5vr0CjO%dPS&qM7GtICG?652xxEw%4+=xr$0_ zFoH!xuyqwq-F-tE18v}NR&o*wemX`bWPRr)Pu`k^a@$xf1ENsiFd4@Yg@f@UPC3$8 zK&&b&Eal)xnSispiE4Yu!ErxoY^+eUB*(!rfkkqUY?P5K^%RVC3RbFcyiDMEQfhDy z8PbFB94L`+#7rQCad)Y;t<<7PM~!2iU zs(?JCI@0T+S82r>1Ec<&GuS$Hdj$;jYDZ7c1=)0FU+IGhx8DV-n=rwLa{PW5L+j#%V4pvFOTloZ95U+BuTR4CRIp(|Fau&@p}Eb2am zV!1+v7>CtFP$V{(QHIe@R3ug@QlY_-H34QFFHYNsjA!M0pBFGVwkBZQw6nn4lB2JO zMU7ydBjDU1g@+)Cq*Y{FEip`0kS%e1O~fh*$Eby=wds(a|2^6K(S*g~fK|Kt_J%`j z9JoBjCNMPX%w@F{C^Bj{Tpy)iPsxMaTp#c;QDy!^q&`s1q^HxhJ94u7401mI=5!tIx4=fdzeB6zL z7YE)1faRy6ED5`eUNkuLrqUoHQEhiAAkSL`WL;4cb6dBnfIMVK=~@M3jRIx`4#0^3 zNfBV94CYCsc&t>sN{3@`0y6SdYyFT>BN9)H3Jgc#1XwaZQgm&twP`a|qnYPuH19~| z;aJ{jwb@?F&gLpAt#Kqy#BNE-=!JQ-`0xhymZCCqg=29XBM!z1krMghXq<4Bl6sPS&#io_~KDl|A+C%`P(#A*AG@vMCB z=>i7F>jaFOb{1G$7N^`)5zKQ0oEH?Dhaf4WRb*Q&F-%pEEpg0F#45?gsD-Ju>F^C~ zE!lK~Aj`x$4%>0ablgt3O0uc{k}z|mBFB+CmE4Yr*`**f*%XR3Mc|6nDh%w9!KkYg ziscFwVjRB{L6O*CMj1xCO_5loNQDN6@C2B3wK#1bGM<(1Jzc=yAfAA6)6N2G%i=to zDuQ{Afb)Vv^AIG3w2Ex2C5EXAvLz1WiC87s7_~69HpOW>Ft%*dou?uc`*bXiqYmuc z7o4;c-jZ+%A(|YnDClq=$I+XqXtp?QCxJS2~R3!fTAnvp(=c2Nr>X*kT{F6iGLV(qk$6M9j71WUZ3In2rOAxHUN$yRf#lM#Xqd1yvAV?HP&%0t%7Dt_v?@ zaUSS0_*fv6!v(;KaOk4ohC)pYiewreOBId8*4`{qny2TbWk6J1a^23{{EEXgUqEo255%T(h)-VCFcuKpjdpla{<>C5?XCn z96>}&;zS_JmL?=H{sA?S#h3^SmEfHE*m~kMl58{ zOJ!vHzQlw!Tyck&rJ1-ofT)7<^L_Y?AU^QME%*Q+ZeBeIhi!7qVZkA@zKWPlEMPXU zz{+w=iUodh7!n_4Q`&g2cFd2(Yrk!qe-7Go61V*-EID}BU~d$!GIxP;2UsOcuBZ4Q zM3We3b&`*%<+z@s_U&mtIJ?Rlz_4@GRMyX3QrL0D%&O`bGqh@%SyW4M*X*iFnYmZ0 z%et*n*{hCyU^#Y(G3f%m5At91q#`1EVh|B+;AbnkbBZVqDsoXARpcTf3t&h3z$K2f z&7Vc|IYC5mV3CXB$RZaNhZeb%R!o=27D2@w#yl&ijQ`+g3jfs{U1WYo4lkjR(?Smh7c~z83 zUf=iO5_EGzrY%f%mC3L2`JK_USZ!29g+|tKZ+qlaTr6$WJ?L{?czfc zpy0o!w8H|k478tz4`c|Bi&uKsLRp#$Z&Fk@W+__@tO93e<-rV1nQ=5jlq#Fm{BVX) z_y#v@OD2{)4YpSJ?oBT^#x+O=FR~3b1{hzIZ?I7%#zE*}8?UZ2;Y%Q- zl00A?ENpeImly4att1hc2MgQa9xTMcK3Ir@f3Oe-17RU9IS31tJR=GVVWE&@W6~JN zjcA40S>EvYZ~QDu9FvSrl{zMilsqPjls+blnAYX0fTz0xwzp<0C6UP@rIE=Z4)u)h zB^Ihv$z(e)%TN)y1l$OmP6nn&c~3r>Q066&Pp6c53FUK0WnRSj3|g6&a6X4v=0%*( zpq69BNe zlalGA!&2@A2YNp2U^^+L`doUTd7ETxFDr+?lyZH=V$KuO1aV2ldeRz{yeF-`WIk#2 zIuk-KDe};~ct0Hk6G+CV^`_bzF9^lN1IuKZzB5oS_63-1VQ$Q3A)zpCL0vpUhH1 zoE|{%>+f&M71D%mFIGA`*4B%5?a>vSHOd%5(#7O3*OlJ3g?-~9Bo`{7q}8J6WrY|-TyiNkmvjk;jkAb^#CSwpawT5;8X{iK zCE_;MVsjH^-KZquaYhmMa!wJK1gnUPS;X}Xw}@-_KJ+s2hVyIG#2eS3 z`l(4bmiBV^siYghQmvmnULf6QY+oSVXl##=ZZvi;kZv@#M@cst%VVS)jp0$!jmGjA z=|*FCoOGixJx03G8uCke$RNH?V94v)^V^=n@@v?w_O{`OZ`)o?G6Zop4w zEjw5$bgWj=4Y#B(mL1k4&K^7Dka1Fc4(Wz_Y5hBjQcW&x8KrT1ba=5m`>ex9%<0kV zwu^MbW6DGn=i#p6AWXpK(%Q$iU5v2NuhGfEbt2uURWgSI+6$TqYm|He8|g-^r5WUk zbi+-kx41#9Mpkc9NQRmQNv5P5?yVirWvAI4q#LzUQL1436(OnE#3okk=xA-6R)b@~ zIq8ODNUyh~8?`}Ax>4yX(v3k{ckt!+ZllR`Al^K2EyfH)H0j0NVy`4n(@K#Cy>0Zm}jYk#4x1EXRVBNH@rs zm3e&+d4N_UJh;mkpTuxsZLy?>d_b%bKF9#}AR#pUt>sqv717{B zTtvf}BL#anRll&kmYvO2R9X}1hBpLTSK-v%2ht6X#t1f6EEIf`t+ULj62PG0-kODS z+aS`7G7jDTNTeI3!om0vN0;yGK8-}W;Z9m%DThcmDvjfTLnDIYe$?1lq0N`%M7rTv zBzGjRX9SX^o`SJX!Acd8ZaAJNrMPWDjS-L@gy%qsM5G&z6vo}9*0xfMCLJ{nd<2d- zB)v%EffTL1Vrwln8LOnQCDIL#Su>H53uA9$&}(=cK}Nw+ad6=}3xg5?{230Qsc7?s ztSX{b4UultF{*0I57kvR8X)V6dSucKN3?6rAi=ODxA9eK(OJ_7(E5c1U`{&SP)oC&J)~3y5X*poT6B zva+nW>45hRR+Z6o;%;d@f_7?K(OJ_7(E5c z1U`{&7_8G$fJ4JwB{^m0YsHEjvB-&Z!$8Ddx6=^mMj%Oq3dNeDri#@n3=Aw90Y=@Y zP%Kxd5EJQ!2Ss9o0e?ooXoe^fs}!lw5b1`4SsIEHk!}Q@mG6CCz!2$%!?m;Livc?KVYXl_C`yBHeH>>uPZ#(v85g^1Y`E7$V(p7&q-Ku(tdN=|)7rc|oCh z2t~VtO2Z=v)2@zaEQ=5X)Y=pT8yFjDD7IkG2qcM5p;%MYQL$QuF*|@oBfzMu6pG~v6=EXY@SsR+FyPM!7|jJmVwEBl z8Y10rFiSRZBGQe(v+}*C3m78Za2Pl3EU>ox2w=EJDy^ z(>5S}4G+OsDMTpHnRLU-cQy)Q&~R@_AX&(R>21Z))Z8p9(FjliQ$Q#4U1TF9An!$TvvArX5Km&DLF5<_g!ht1QS^ZrYoTGQf^5p98y*Ck7Ex#hY7oSv z;XybVg-8Y5giN|&xOn(Zq#F((NvJAhVLhF$8YbN^C>{9>kJvK;Pl7c-(G_(z#155* zNDLYQNj+$QqEW!4VA2f_kQ5F^+!+C;nPPaNRJ>Bhq#F)t`KXRex)G=ziRVIz#iSdK z71rGa6X`}_EOn`~(n29(j0lDEhgBX+*(YMIB`0f@6vj-t;h{)s3U*=bZB0xX9*Xg6 zFzJSYn2<>~Txi4yOuFF!nw+|ahNv~nq0lhtMyYW;V$TRXt(yXhuBb>R-Ec(la!6v( z2uSWr1r&_}CIypjI2*(YMI=*e0og)x(Ec-)$tj9pk;TccvUrh+Pnul5YZ z0s)0cnnf30RHPfrigW{qgwn8tniv#agc=`96^+E!-Ylm;vEx($1%YCtb|Or9kCgC8 zCYT~sOcE=m$QhHQ+zKKiOfH8&b?#bFSt_t9S6o&ouxc1N!c{3_Tfq9(r`Qp)$_+aO zts24huvKasC6shS8s%lujb$R;SbiGmhPsrL88ftCCf!)pq#GvSx-#j8Nl;6iK|7`; zaTV#t(#bSrCDUX98{^kVq#Gf0VvSK_*>~Nc)j7dNQn_qg3ro_CC|y`CTGEXUiAM$5^0+jgMQ&ysW_bVo=xmVX85 zhWhAM6XNesq6$$YN)2lOj+3}48jFf_L-kCnkw`UU--LOy_BiQAjS++x97aj1VVIvm zy3tjKC_|Vqgbrf)38WhxHq4b!kZzPlw)LnY-6)NM#lj*I!h_Pvc`TIbf_NUxg84GI z$!gM#)`CN34CQtxOe|nFu)xZ4Oj?m{6fhpF(O6h3+ixRr$U&Qqm?@SGKL%TJ@Mh=n zyWk_F8!c$XPhmjHPjSq?WvIxV(N#4gzL2VwtQS!+v+|0ShSoP`W~3X|@>XzFDKqy< zm8fFfR;kQE$39e~8%w3Yz+;Il>ZKH?oRpGcb+{$p$}zNe<6QGtH+<`pJlOK8C}Yat$6sECq7s=@<8=Zm zk+%l^0&AQVGVj5p8xGDVVKeE5i-L5+MTvC7WwNCtNH_5QKm;5u>4tk`(hV2BVj>OD zbAWWig$3z`OHpD)x>1*zNH^T8Cf#sFL%Kl^{Rd)6q7i4Yz8jpL(@TkQavXT?NMqDV zy3ttS%X&e&0fU!GH)?}Kx>2h#=?1;UJ=yLTPLma10wI-m8Y11uwvs?AUbG*!l0-zh zk!=&{MiwX1jVw;28(Ex4H?p`Q-N-5#O_X#aDUq>Mo3PLbR&t3bR&t3 zbR&t3bR&t3bR&t3bR&t3bR&t3bR&t3bR&s^bR!FmbR%RK!%CFX4O+>Bb87*M-gZl%GBZH5SZgdzPBi#s7dSI$aH=z9} z=|-|?h$NJBBbhWL5;R_8xbbo-YKtc)012CyNjD0+CL$-@D9oCulysvosv-;0jb!yA z=|*AKMCPO$g;^8XJ0aaDj3hFl*g#wQR#A~)$e1pNhs6VC143uA=To0IN?MZ{=|)nO zq#KxLm_8l)pFq0NS{@_aXf5Sl0MZRr@f*W{rorfbT}t)26r>x4vAwK-bfb{#E0&OM zsOC87Mq^NsZZ!IebfeMhObETC1hYjV-6+I-g9qtG7RrJKkZxq5-1I@Zk%hKs4x}5U zIFW7?3Mr1(9z<+{A;r2iM%Cze%DT%RTu)`MkFKKj7|NrW?Q1zg)|9=HiiakzTXTrid z^n!GwR>}++k#3Y4Bi(?sB;7E9q!vF;iiJE%@{^4r&LJo%f@r;=;H!*&qpw~ZIrHCp2r z=rvm7Bm5ez;R^&Ct?^NYjn?!S#YSs+lw+ecJw~$8S{`TFXl;+tY;;)iRDUPW1{wda z5p4i`1ZGR30>|9x%S;=cwl7d^l=fbSifiKuQ&>u)Q99HV75I87Y#XJS z!$}m`ZPX7pZG{d$)nvzIa^zO&aASFPS|=y5r{}NRF6NC0E7MV&Cx9;QjmFEiUl935 ztCTh7#JN##1tC-cF6w*VcLCz@yN4RTWbQy|_ zlmD1oQLw<9m*r*?pO~>{gwY0T)i@TQ({Kcc3eRJ;N;3)%X0=A1>6nlsRMfx`BQbJ>PP#0#M9C4_;%cP| z5+_Hf(^UzjlX9@Z=dp6ME+3`kC|y38m!sS5Bg7n~)5n=PV6V?x%xVEn4!V?xn*$nI znnMaA=Ll0-(FHNFbFjUr^HLyk0s}{K;tu3eSdLOeUn~G3H_&h-H{=96u@p|CRVP&v zOGk2%WMD5=z)K9&EA&LvksKM$S389nF?Db~#XJ{Yt)-&)LBEkODfNz#bugxwE2diO zFK;rU>j=!?u@JFXyOan!V64($cL4cDU`QX@t%4{!+@(|zXGf(9NU(1tND0?5MOjqE zbVS<`pyC&(AmK=;)G6ji#2w+6HN@OeY61@o90^am)geWzVOB~a?+8>?1~B+F5^#i5 zr;wK=4q8^SKT>*Qu0>Z#7Xg7{BL&3CBxQRGeUR}s}+32KfA z$Ot=##KU1sNGu*9bn*poas+^8rrd9c$HN^84H0=%8pi`EN5a$UDWK@env06KJOa@w zDY`AVIT9rIssf5e0h5C0JOYjs9v_G~5}2i<;)zo6N*ytJ1f*xGh6v(~gzAxaR+L!8 z=@D3A-Cb~FEOlveR71g6<`jyg9H~5(vQNZZOHS4*DU6BNBjVQdWbDG)+Zt>g5sH&| ztVAp>E+uLY$4*=qpy>z<%|e@(6kQR!s)*gg(Znn0Gvu+|ra`oZhAGOTKAGSnKrKnt zaSOVR6exG9VTwvIvxYc60+BQkCAc~go+Xe$idG>jCDD8Ys;8<23MP&O9N~C^RB%M} z5pc==Na>Av#jViBRWq=2=0MAC*Ga7H{P>vdmRQ6ID@V(X2Z(h6f&x6dZM?qKQJ$ zLQcdV5gN%22_zl~Njp`+M5kbdinu=l&r(6$i2Nf#S`eNE1rV`+1d!Wymf4tc9qIv8 zgTM-$6a;4%X*>!^7OkilYoTGQf^13*AQ3N{7Ex#pY7k)ch#-RPgE&AOB*a7l5@PJd z*Oy6R0SOq*I8zc0h&xp};sL322^D-E2~{iUu%aznz?4J<61Y}n(-Id*0_Hw79g%^A zXQ3iCkW!Um1*b=XvvQiRDNT5a%i!0HDB;W|gQ>B6nh6tsEL>J=7&Zq(UkMNeXl$kjq3~}?U zAjXhNp__q-G9-aXpo%7{qROIKcW4X`G$09&I#ba^p=co|-jE25Jo$U_3iZ9B_sOt}tqK57sk`ba@=x{$`BDEdH*wa~Ct zK{h1SzodeO^#O-L?hxj;$i#} zAO%TaQYA$bRZ#(j>(Ce;xIq#gb)2G!LeWA_WFiq7$qfm_APGscL%~F+V1Y4lM;)hVqENJu6T?V^Msh;}TS!9E>`*Y#DOjN*l99l(3=}tF8A*^9g!g>` zL^LA-DpK~fN$RTQ2_QS^ZrYoTGQf^52OO^YZr1GOcHRwSY@HV%~v zdS)B(hHxGZA{7Y$$thXG#C#*}kTpy=QfZ9WgUCY?o>ssP{A8|@!kU>%B6iJKMlZ~*(NQ^BYC^Td=YIwhiQqye ztz#=vDz*}o#f89*u=rx+7DI&$j)fW~ixrXO*7mF*D8Z0=vXF4O$p}|o9VJW_3a*G1 zm*t8p3dUtI%^GzzXNMo(d@nDISuecx346uK%5KL@WW!H@7& zY)j&mz63o%4fHa9$x|jU!H>~&w%JWT*yivrPQJJ`!Vu;27|)Qc!g^9un4rYWVS=AR zNJ8;~p=3vCE)uRavzWLD^%WWum&ls02`@RcAXK&>D3c{7lO%Pz5?&x#+GZ}3K9eq!L_ne>8I6?@dQ1++`9aHrw;l0pmiMc5LR3lQbr$J4yetJeq-j z)+8b7O~fYZoVZUaW)m|wLTys0k8_(8W&{<)BRSyR6g&R*UZoUO$$pY5aNLEer&{#G zVY=F5DKT+VAQ)kNVBvrRV2zm(F-4aV6K)8SvQku5w$Dp!j2ooJGPxC}{2;ZN(}pCD z6EE*L$w`L^$DLVDN*jy1q&X>VB4&+77%@sCkJzX~yuD3egJW)U(`l>Q&%%^z;F{^0 zcFv=0mwbflq{Fo01u-P$1v%=_QiBv3RRpa$rLw-(uOuAdhTz(nS)Ex1X}x52MtI^~ zV1`xA%sy&XM({G_NsE4{I8R_93?~?rjP%51iS@)~iT1>0iTA{1iTK22iTT83iTcE4 ziTlK5CHaYqX}NmEegYl$OBek~p=bc%1k`nWB#ZU_o&Rxe4$+{zV=Xa==BSn=2|J6jPQ=D3#QyP%1gLqaaEU zK~!=lL#gD>hEmC$4yBSiA4(;6LX=AGj3|}dDN!o9aiTzM1S9` zN~6nEDNqK}i7v^JOC-dSQ$&_hSW8|JTS_68+#Ug+a98lu> zDOp4iVNtQHv=9}|N^77qGdxEdY$l0l1ujX>kDFjxDWtN>0#qx7RGt~YwNglJ86wD5 zDtTgCDK%0iFX4ztGT%yJZW|3&O1J`LJjZk}u9W&N%9X;R;asu8Um#t938(Alv#!AN zagG@qrsA6p{ui6dxOTogPk zF1l9Qm1K3JBEH0=NHTiBIABia z?rTEWf6Zw9-%aoCm&4uZ<7PIy`051TJXXWQmtXMDFTVQZNO;g4|Faeh zCc%`!XEn*Uo8{!c8%9Ta{54_xRc-S7&HZjXJ^5}knV$T1w`uCWKWuixyXooOW^=ck z;)c0D9dA}gvSdHr_QA@wqr3S0z|Hbi(akgwbR=K@#{)SQ15G;ptzy`v3#M!dn&SFf zMM0PJ{i>roXg=+46~unJT8!*sDcgdk@BUU{90`GD3P+pCyWae;@<}NgvTyZPMt|D7 zwhXGP4L-dReJ>c+7RdPFemc3e*PVgB4-9*wdwl9&_vYul`9*Jj*_&VW=C6A5>)v9$ zy+8D}J$iH*?xsULM(ytK&5ysp(iell{dzw=+!kW~uAmAF#|-!zbhmCe!_7cddb^05 zL~lP_y6~}y+N&(>G_Hww|_Alc-Qd;u1<2j8B@fM#hL1edI?7f?KLXY7F7cLxa zp8A{J0-uovcqhi|)o^KLuBQ7vhPw1P3+4Dr%7T;r$>lZJ@%kt7d=36PiF0^349D{o z;38mo#Y4Y61x+=UrNmRRJPIu5{qyT`))7U3Ph+#*6m3+Ej6E{oFE`Jp%f%k^`18fK zz_~cZ>=j6%9;Zu;)l+=Yo=(@97)v{9I-Xt6U^)hk=4^PsJXkO5PsDO&X*oFKuhI}L zo{*ySL2I&@%`oe0KUcVg3`jQJP1j?*Qq4Bw`+a}ZhdDU82K>{wb|O`tPp7L9-bU$L z)euv#yLga5Zh^o6%oDhZu3#i}S54 z4B@peXL(?-34UY>h-J38h=*h1J^e6TFYtu4*sKR6J-OJQEY`Ed8gCrW|MYhHj?3Sl zknY3T&p*U_r_KbP(L~@gz7Vu3ncjQGgKVoim#MaAJgm0L3z_wLK5Sau`Qd)I{_2_5 zAl>0^Z_8Em3+oqOSVx?LzsBlMe+K8;;AgWLMv+c}H?rimV;A{esDw{)MM$ZqoWn4&?SErXZn8^R?!ztFg?0spAzI4+uFZg)9*kfVgS$~i3Y9X23 zFPHEL36_ac@8P0^?W%tT2m3gYhk>iJ?GvtkPH9-AJdXH$;YN;c)L%z{y2>U>?_Zvg zJ_Liyvxmnb9H=$V+IYNdyvyPG+tW&y4G8AZlq+16!`<7jaOF+jbqoTRmzTF%3v?Zi z8&bJRhcSkBFn{tJ^Tg`TUU$3UyYs%wt|s))^C^ihLVPo$e?)v4;?eo&VuVR}vc3xO z^qT(Rh)8n=O(dGsaPTvP?-mq5YhkfqAaWQE_*coV4d=dFFGBcRp!OWLm|LxzLtT(&WaJl$tdOF_kPabYg&rZ)y{_n{@ z{qQd*zg~=|>-`j;?iPpn{pfVOS$(~pjyKEU{_C>b-+nzmtd<{^i}kcWpDym^hr#*j z`K#OhYTrLhpAP*!YUmFqf4<+ta(4Ff+y3Kp^lowJwmy$GllLE1!`kpH~e!CpLAB>ip@w?~w`G?tNEmaRL zrmI`!JH5V{u1?OLXN$Y>a7zVy`15`@?X8B3nnWxX$~g*Noo%0<=erN1%@eh1vA!FO zQOy)J0lL-JpWSXArn}j4^Eh}|>=&cu^m)6RNa-=6*ftquV#T!C^OCqtFi3m0dW&xa@}1n*RRXVmsK3{)}GPKMzNv-M=3e zhvoE72ziGtLzsudW;IxE*3(-aoG3d$P179><1zN|IGKQFIyp|E4$q_B{;=Du@1*sQ zk{*loe7aj4q{WJjHcQn0Jl2}Bc)y$u76;_^_!%SruI$9If@9z=)y+%PvJh*xF^V^)~XSdtUenA~S*iDxh zfrsfWh8`I^T=r4>-Fh$@?x$3Q*f0p(`~B04R~TaAK5Vvw{waML-cJ^r-UG6HcK8~7^}(}rzL-p= z>*vuuqFeVC>+Suax7i*j`L_6iEs;z;N*1Kvuo#m)60*O?Sk7)!_R?28_Y%(r{)Nu9 zLjcnl*q9yAZdAc64sH!^wnZl(Q

BnDF*(fTs$f-|-9FA2hiRYZM~pdL zqcDMP?l9(i&-eV*IQpIQr1exE-XAvFzvKCI{0>oD7VU=k0@6g;)ea9%3$O22qv`HX z7+AfQake1l#kwyYtpn9KqQfx{C&v%^txcirk)-2!XWCMecvNn6`$1mR=6QJOuanEd^+53 zF`f1Ka%nx^F^xYLj{W}m_0t>s64*ub)ivhvpVyvmp3bjp&-0s`)0>;d_3G)e_QVyY zCcJ#Qs=dxHFHbKo8_(<3^ZNSqy79YuY9oAw3trXc*H5qNimxwD+W=oZy{`SvuUopC zmhR^K^y;Fi_tn!)!*|v4oj;v7Zn*T+t&p3c4}PH@j`o`+zJs@P={>vM@eS+QtzMeX zZkN;90eG62?538kYd_(#FquBljP;CrVqEO=y#?PSF#0!()poNx4A%#8TO-NW9gd7= z*U?=c_uZHvva^TIW8^NqQ~ZfWWY^sk*S7;E&A$Bg+~MPND9d*4g3RI`bhpkf(mPyZ z2% zB{=)jtv!=)E4xaFA(x@sx^!>dRY;m#)U>ox)CXN<7|-<}fux?eqq|i^+^A#v{m~N7 z4d$BeaLL9O*2*@U&A8m%ZutJJvRz(Yy6wEOT}|j;H(yldn;HG<=F7@FIv-t(g8Zs7 zPp|1;Fa4@A&)(3#Y#uG|r*+uV@$6b#Mdmv4(b@PWnd``}E-%k!V<)d8KYw#Jxf!u} zH=Wc~&)!U~$5XS`HP2?lvm0qO%GMQ6r?0LqFRW}`@A&*|aw$WMJE7^iu6Z<>j>Zx; z+v~b7rjzqG)}<(4*M2b^-rPu^a{0Rci`UoFSFbp__tPaFZtDPMv*~P{9qI^Xv&owq zX`e9EAG{R09d0aO z@|euz77xZOR>YH64d+VL$Mk8jnMo$pU4Og4}oZeZWs83kg|7c9&L&dU7S+B*d^I>TOLBB8W6^ub< zI>E#|+|Q@nLvMcG zn_u+im%aH_Z~m$`zqS{U^rk`Hm&k+H6mJoif69nH{$*%8-0vTez=hvoT9%{7yu#sr z2M2l7?kyMmx{}|2ZkD}m53d*PMQD$ot$T-wzp?2Z=DowNcTe*TdQx6nMz=km(#uJE zK<+;c=sDEiVD{e+N=66ZSojFL3o$csmMD`Es!Hh@4?k=df%a!k;N_ zEvoQYJy2;l=BjR6s(Db+cMne$#^nuJ&4~(*T3Y?|le=w){;V^=LnluaD`4X1&^jP` z$H;Emr5BaXHp2>rT&v;h3J)e+H_HZCkrgaO$YxmAh9Elx8TGT3SOHh646jQ#XhuP! z1LRCFDN|)xH&+HBF+)V@WSF4oLb&pXk~`1;Usm@yKK!mFQ-|jg_q`9!0QTj8r+XrH)u1I z2ZpkFg0E}bnGV6k1FJlMl_#O=5_OJIa9AcN4J=Ai8rF@$$sU5ttM>6NSyu3^qrB~| zuk@74Dp!wS9uY{|P-8rVvcKW06((0j3eR=rS%zTgCEd0i`U|iD-YM&}cBwTvw1%5h zh5S;t?b3^CCRuqHibxe-S9mb(f=OFqRIrpyG_KkZWQQQ*Q8g;yN|oVt2?xz6Xe)E9Zz~9&tz>ajQI#s{i4wwPt69O5b(m zTLofyr=7SR`a9Ku+>ft-2(bd|0Q%yxU3wu&IV}k|M=9vKLXBe=91@d~05965EH!L2 zhoGVHR1%;{65zT7jbIc6I{L~1gK`x3y1|X*=Kdz^8w7Ta} zH)ja7!7DHN7oJ*II4Y3+)|FpTxh9cx)OP4^$FbhQ@5x?iHG!?+C^ZfG?zmlgY0V|4 zfTf7k4C~5}$aX=djj=*2n963FWnEhm-y!&TNUh8Y24ySob%`gYQ7~C9I2mk8R-4w1 zDN#NIWeUPaz2;iMzm56!Sk0xkRa?0mj0cfVJ4^t=U*=Kdz^8w7Ta}H)ja7!7DHN7oJ*II4Y3+)|FpTxh9cx)OP5z=3YV}bpC|2;S!n^IPs`TS}Do3k(9(8kOP#e7RqJQD3 zb%mn>*>7F>6_slWNk?smzD8qkr784A>rh|~7pY^=7nkkQ3rPxTNx(TeLDv;(9J}C< zh?E3)(IRE3VWT+&4UL1hyvpsYY7|8F40I}%0q^tWlGfG#&k$bG=j=Qu<`_ox2pwe9HYdc zgRV4WQJTVlSF5$b$Q}}zRqdl%kl?kdlelMRZIvTebz6E`_48CcCkwU2>o5A6T$Lm| z708Zwm0CI$^=n>9has>0g)SBkSz_61TZ52U4&moxc0+1;QAsT;Plg<);z+I%ccxup zlJJa*EJX{At1&p)A(7E285QA5m0+Y;0Xxko(P$PJ6Pc8$v>?lBi}O7sKCj=$x#U5j zIZya@S6R7AeYd5r2Qg1Ua0+pgJc_dK$ys@luOfvj60USDqtJ}g?nBD?``y9$YfCwM zk82Q8&Y`}#A?3WNrks{1LlLXsNVyVsrd?vvwkQ=@%0?SX6lLF& zv+^WgMG9A>TK%q7nk!gZlsf+-g*ZeT7!nd?Hh1R*XBOy4{T8!%~| zqRPjMDwt4lW(3OZRE#+#Kz;gBP76^{ByB0Rg*HrfhT ztV^8@hBMkuMSqQ^Sn4qSpxc=SUz~h#TddX(_Yc^PHQWtAHwU=Xj}#6*?(`#9iqE6c zd#xX3<;^5^Tq&^d)!MSY|M_$>a!8hipH3D5qT^!t5ExZ~6mM}Onc3+0D@Rn9J zOt3b5^H`aHn5ECVVp_Z4?1e>__p4}{vNM?MokUVJabX~zu;58Ju)ht9{s#=D12Kdt#I^K!6&06|A)`NO ze;T!z|DG&%vLz2&;|SH7s8cID_bOwLyCJq&5flA2p#NyG^`^23pjNVBr88Dx@3FtG zC~vTOYR4A7b);1hgl9-cL$^gBt@W_CgvC2UwCnI%%>OxbF;>nlQl+C%Dk$kn6oye%eQSv z9zW-m%zHkS<(X$6`2Xo%K!9@v&JDOw0E>df<5B@EJQUzcfhz-EDS(B>;&H72mNpA; zqri;;uN8Q00QN8+6r)AASoF+Ug_->kHzWQx1@0ek_4dC9XaIlM&#@)%ot2SKUP_Hx zPK{g=OdIUdkW1!l**l%>KKzGWZDo>11v_=qODSz`LyUq0Eeu1Tyi{TQxbZrADeX+3*vZW6s%{Rsg2iw}20lpT`HwE~HK;D~;TMycjYdcTVo@SaFpu2!A%oT{9 z;7z?!6dO0|ZO)mwHRJh+7Tm`IR+{9n-{k)8_hlk3}m{=>ii_V>Sf_3gj?@WbDKbt2o> zu!g>f7<)(m8-xCa>-|xJemi^p^_w{%|Mbp+{_Wkjzy9g#(b;tSc6j}VU*3Q7+yDIW zAAkGfKmPg;cfa`lyY<`A_?tgo{o$97-~IO8;@kDRALf(0-`xG?37xR`x8-+#_j>>R z{pK}S@=1+*-PcVQF)TE&^?2MtB0$IE_h-vr{`R}c{M)y0e|Y=5?@`rvk6%B2_w+UW z^N5e%(tq%OWXJz~_s1U}?uOIR*UP8T+aG@Q_VxR-x4(V-`$x9@)Z#eQ`C$N&89^{YSs@#62kdH1;Z{V#qsozMUC$8UeU z`|cmdcaPtH^W)o_GB@a|EZPRK%UZ+@PRZ2c{|<%_HhGxp2bLtzzvr}AU;j@2B%uIJ zjt{&6N<=B})U(;0K#XO7GR2nxdsp$w1vLzquK4E4CYzJ-{f_iSzNLcXiyI~0cg@pn zpQINwP^==heX;yz5vxA+v%E6Fayd|eyno>kZ>yg7U!9o` z?|hy2Z`_0TNzd{6(_Lh*DnGF@oSt39^ibCDfVUTbavcigS`;elA&}@%oD5}6WSq-` zwKkA9_5;&B@75;U0*^g9v}2RUYQSP7r?O8|5uPSxccvn|Et8OQD`lH83A`}SwqO!? zX`pSqB=E{W+ipqVD+7I#CGW7*s(ouE@2gbMH&g=j+I<@(K(GB=H&61;No${OnFQwT zv5k_vOVX;=?UBHo&o)Ksj!26~w?gVZNJTGn10|&i3m1)Tu&0k_6b@t^0KwyX@J$!+Rp$v)kBZ->%s4qO`GF zx}XZ8z^lc^#ga!|u(7Lgu~bqQZ0KrSEV0xDo4FbnPc!Nc-pkv#c+!bWSBpFa#igr7 zo{-|w)gntzgo`Z0M!Y5z-`~p~U6EMo3P)EUzR#CAy5g|3=5CX{zD*>)-oS2vii{Z>1FAFJ@UlprQbOO{2hhTi|?96tM4Yl(}fj zT$E+(iyUPx+cKAB8T)2OnX9(URawTq>QUxZTjo_+#=iSfhQI!08G+br!(x*`l&SiS zxBQp&*z6Exs(zy~RlnJE5oM}=qcT;$+5918XbLHt!w4I#H8!7kiK;OuQRRTmFJ7W* z3QANhvH8YJR1HCisvS1}NC}=^s+K6m4%QZ%ky5FuH8N3^V{@UG|!mm>wYd*HBHJjV-YMzv<+Glg3 zl*5e9x0YoC9c8C>zLc8}XXu#vz>sIZt}6i^?46-wF63(sZe27JT81<;s&CcZjvi}8 zIaR8A)%T7bBPr)jb*~1((PJd#WUB7feCp^il5%!c_iBQ5^cYDs-O7DX^~DBBo^;!x zspemCZ$~H3!YxTPAqz=6I(b@dNvauINZQfK^K?s6PT6QZX2Z5i7(CvsqWQx1zEHFs z0t%ZQ+9=9NT`1b_0EJByEk!xY3q{)*ps+ckr6{L;Q0OeLFCV;p3Loo_@;YENZI3X` z@jkgIE(}J~_6pM+@0apQVKi;eFwOD4DK8zMu?t1rIfftWo$^}ZL~Zv7(eeJVTWKE_ zDbRM1;YTCV=hTX*?IIyM-bc;lC*6BD7oluB5?OL#MblC+63c~lcq+mhujLeCw4|vx z9Fu_NDe32$v40?ex7wwDdPbV7?zEcT4Qn54sv?)=T;C?*#aR+K#ubV$QZTc^Zl!;W zpC@4%Z?^9%!!`ed_eb~{BDF_W=iyg~z~nvJ3bHbR$-A@_BxM4V_h~Eq1QFP|F4KLa z4L_!`d1;Kab;H0bD^82?4ZOB`XnD1PZ;VscfP_JQkX%7ahF*rbzr1x@Pw`76DHw0x z_frp^K)2-dm~DI91QnCSLOa@?jfO;_*_IqmAl>q^{o*6`%a7QvK4O3M5&L!3o{MM@ zzj)=}dU9_i6rEw>2)wfF>^86I!$L1o%xvD==3XZ;!}Z~0`*%t;s=t1MnJ8U+4H*UaSs#KD~oBTaW*1Q4#W~VX?1X z(^5GL3~h!U(6m3EFP4*&Q~o~>@9gF1=+}oRtZh>cyoYgG3A@X{U0c_B{_$E}*}TsT z)-N@zBS&9^^uvsMp=)UsTc3VA-Rz$r6HN;9D`;uY>9Rx5IeYwI9`fmQhc$!9d!N;< z7fVVSRa1JwWWVcj2C?on|3zB1fBf?7D{1X9T)q(v#R)EE`Wp~(BzKtC^4TuEkJKXF zWqnOur#aY^gQOI??aOmqlymbEs$BYYI7V>#rY#Ok3ip>dQegW3`{?0Ur%xEb&+&S3 z7=;BD(vObnMLR0cK`4gBCc5Jz+mRWkZ(f09yIGK6u0+u@y*l|Sjcnpzy3`EXhC5AIsvp~kbVGm4qSCN{i_7fvcvvm z0%&1k{~`gjbP<6C2M2bBWr`Nq8MB_@*X@AlE^mW%gNERaYPUI{-}+atd|{7I%{Z@t zY+qiznoRHVm#M&=0=?3HkJJ^vzjjgx?iA;jFN6VOH;Ed81;cSPlJnO`LQ#XWT%hNU zvcT9KiyDFjnQ)xt=143TVsMtr^A}=)u{#zuV94dLg<|1_3Y4m;&x0<9ytHm7$?9yB zMtXy!b3hM4v~5c2a|sEN_hW(ePZRvRQgHod$8WmJfJRV z2Yo~oPyH$mcr}q=CS}>lOw~m5B+D*RZL;*jf%k1h?>i!T-$Z2hZK-uwpk77v-lZ{9 zg+&iRO;aMmdT%Va4N-dej5O0zWWr(yWbIYBK5T|yQ6ujX@hcjCr1h@L<#3Cw5qhn$ z&$Kgx4R#T-Hz&v+EW=-H@xYFUb-Xu$TqxEC?*{7wUS`lO|CgJ|AgR#%nMo%F{`PN&e>_L6JtNz$JsJ{s)oivG32($bIDho5)x&$+j=Kf%dD zA1{WVk@1fedpB(se(~#y!yNkv?yz*opEeplx8R9-)Avt}pS+GaVEY$6$na`@U21;V zWlYzVAI2H94FrcjXH+*k;C-2S$F&K%xx7U8Cyd6yY7H|UJ*T@d7N3#zUP!}wkMnrk zx~{F#l7~Jm9Q=SZ>^xWL^r64Pve3#5Xo7RMV8mThZ3IM?(P33vWRD!aPx<_?E0su^ z=^9}^hu!^pjQg4o{A;40_d}byZfyp&=Vi`i2eDIcvE48BX*#C+ zZXB|K)&1s$$=0qAx>qK@9g}%j487CUPA(nlAzLQJWrdTxXqQ|^VFVGAG0(YimdEXX z_-t&`bTW=n6i0@Q4`0%`OX+`K-4>=EO!hxKZ#?=M__E7v5j^jeD@_F9AqhE=aeM~b zxxI_yG{ehhd8m-2#d~M@D4C8|&hk;-7vpWSeAGA1^zzpbIy2;vZjzNwKU)c2-1$g% z)ndOC`=!;#2iw4I6<%I3A8yOV|4RIE-!7kdZRjK2*vsc@vEzPEKHunPtDl#SKGLIt z*y*S@#EZLT`TRyc)5~lDv>c8@jc%=BLkKIfT z@XjWN3JecQKlSk?cfX7CtDCFWm)BQ#K%$!Ya6Y&CGF39+^%6E*Pw>=*}tf}=qeq2-Q+kIeD>v#Ofrq=h^p-rvldH1nRt>dwSn_AB! zM>n;OM-OjmUC;SDJ1mFk>Ab@c?=ZR#a3WtjYtbfDeIp{X^%-tvMONVU(_WF_YfZPv zv>MyAj-#lzQ-9b9HSwXlQ(0s!;2q}?Kwr~V>#L> zJgHAQya~=Fc%1dEn>^g`IiW=j(iOSXDC*JncT}a8Ty7cVxIa2dF`mn;ql~!ohA!<7 zaimV#orPaM_=UbuvNL*LO-dPlpnyw#s7_j=c#(F+<1wQLgw#Qc)a)6V~+2gH2y; zOUsLQ_T5LLB6jKesVi9m+Sl%H{!ix(&@kmjl^!MDqN5~mZgt!RRo zaHvZ#N~xecWJ($ZD}{qyqEt3OrmHjr*(j6gAUYo#HNeUSv96$0Td+Q4)`+Ce7O#l? zwW8#Hr0UvR>#g!DqM7GtICG?852qRz_Sd?zyF#Tm)Vrc1*t-g+9=;*XZ8mYZf;fS~ zpN@P9tnV7)skCOHTm@FkpePJD_{Dj|;ADKqQqD9M5Sz*dOFcOLCFrbeV%i>Za6FD0 z8yl1@;Wz{)xCr;iMw!V{Ps!M(WTgp5!33Wtr3UwqDLn|!fszTw!30w{ch_3`N-LUl z)Hvoj4oNSvcp#cy+F171YLl}fg)feUiI_DLnYnQGE*{eTgy*5X-DFe>HY#6b!=W)j=~<}-w-1>$BJp&n$Z&8>kR|scRoC9tnJrB;^Bj%j8wcv) zXvSHy*qTy32#+52y94r$-5o|Q0OrwLSOl(r7 z!h+*vg3Jb93T+=UpVjYUUeMr(nV@mk&I)T!j=r82HG+ALfOCTk9)cv2Hj#a`#&A_2 zd*Y~>h*c7fSqoR|(;?mTd$Reh3BytVt8MjR3JKqM$b13gYmY+J*xrH2&=&v+^jK2?x+bxx#`YXi7`s8)ZJr7pG*a zc6x2ZK{UbYX=z2b51BZHdd=!`0c?JhG(gOrLb zMd-@a8Z4|sCZpj~D#n#6U>s``K@n^;qfDb2qD*X3row{5ZGz0wPzr4yGN0A&V_wkU zfSaIk*Uk!SPmaD$J&j1I!N?AojD||77+0!* zaR5#PMX=F~GL7bfGO!8lHtj>d_il5ARj zNt`)S!EroJh1-!XyA*^bn^Li*2wb^ZgOMFF84Z4FA_<^+wqc2-z>7H8K~5zKQ0oEH?Dhaf4WO=MrKFKCpQs3@bC^$4HHIVa%O&&`*CgQF&CvQaxXF8B4 z;+E7D?!w#q8fWc9D0TwRN>C|bARWu&%or?Lc1Z{G1c9cY?%)?w5w}?Aa2}`9InwxW z)=uKnwke_5iiT)0Bxho@Q18Mu~b5_C}A?tK|K*58N9tXbtjQo(kP!8m9MnX zaXmrl$*CdYV4cM3k$6IsTy$hlaD{hw#f@`$U``zhj@L<{NV-v!9!ohU;;uC(Z$%1c zI=Uy~*5qXF!rS^94dW#e)Ij`d&r}QuDIkem*HOq?JIGw{5k9DgD}WdA(3gTc3N0}z z!Zbccm5pHQZ^oIBP$rbOs>DfcAx?RUlkf-=PC=EEVC58?ISFM>!HClX)%UEz%BavP zuDoneVzn?c<4mn6b6ddr)Ti7Lvf{>_f>w)gd)SKF>PI=`M?2;0rDJ~j5E8J1e(?9F z9Q9*G%Hw-zMVFlZL!n{yQFjkzrBVIVei9F#=EFzR zxCbBA!`-V#*04{GIXpOIwpS6eiv`RM7Fb!2p;)0O#}@ISGo_CQYX|aJy!P2P>qd zr10a0nO8M1=4j0_w`i8+uK87sGIwuOmv`Hwa#WrBz&N&eu}%U#0rFpTZz2%gBM3x$ z?%9j3l>)_)LJq~DLJraXelAEqX-Prana>dYfFMvDE#y!fF62;gypW@`FZ|L?k2IzVNDeRR z0yYkqUsM^eF(qw4*kT{9t}NlNK%kO5&<8Ah_3bXNx({DTB4`8_zM&FWz@ZaZz@Zda zz@Zgbz@=JXVUl}9(F-gLl5DK=0^GDwSWx8+&;KT=qFOJ>=~UHTGNgJh8B)cU46zc+ zRY6Zz1?*4FUaI?&Ayt0K5Qlok*AffW)nBq7#9*k3Tmvoyt^fnqqf#ZGtO4^9$)~Hp zyu|W3IxsKte1;OtOFW;W1@j`$XQ;uv#Pi8|Fd#7n7upJbToI~h4V z{L%DJ$f{6>{)wosWS>TlMRwL_7u#!Zy!I$*pO31;B$5~PVM@OyBJ77@J(kj~iOL^w zEiTk4R~83cB_>n7q!Uy6HIbQ8OzGA{_P*}1N-YM(eXC@x7n5yiU$iR5WUIYB!tEhx z#$=PK#*n1SJK8kHnhQw?@rY1Kho_5^lu{)fo^mZX(EVYDTuF)Qed&ST+azauSULQ; z#Pt!2MN7;Q$|IF*N$XGwm$dd$x}>%1n-F?Pk(=hlPt!q2iIgzk8P4cR9=@_DU`C5X z1C)#Yj4m+&+WNE^J+fptL`6!2R7YzF!aE6zl(?;?Rtb@OW73L?plIB6Tz1Hd6b`k( zh*f-CVgw#M^q(ycaSg4WS~X*74~L(snh|=^`Xk2+su_*%3#u87?-A9E z#_t8yjK=qCnH8!I^Ltdy4-~Tby zjAhn=cv&^0%k>4-jKbX;P^o4tT{WX{ucapNv!!Tj6kbk>U+UOHex2*~k?(n^W=PE) zB|7WY-}kzy#mEuxuYHAAP4|Lo2Fl4>%MO_dovT$f!#(LY$_{UWbBP^t$V4SRM>WGs zY5O~>QcJFF8MSeLbd+K|msv*{ai?3a+b-1%k0~ojoJVnmL-7FHN$WDU(PD(HeT_|) zs*`F)ZIX95(5;|1VU3Z$z^0l}Tj>pQrJCU`G+Nvt)*@>+86-o^f+SPb3@@z%(B-Gu z9jY01p`upd_HTrwViTKqaY1Km2zOnTMH2{jUzI`b+gLTjE!3+K-L9X4mO%<5sb+Y& z;u}c~Bh?JIrf(i>u9`u1SEC@M>tm`JjpH%ZjKc9_su`WmU8)&{;}O*izqYdA1mrR> z*OO|-5|1^zyTzJdQq6EbSx*I&R5Qq#jd_6%m4Gfrl;9Cyeu7bit;L!gDg$MVD1!mz z5(J_I+q8t5NHrt;Wgxi-;V8mpEfQ8z&4^M=* z5wf##sIPwVP9oI|Ck!3#n$5mf(Z@Mes?S zPRO>R31%YI3}=*5K?wPvv0_m84O?f-wGJSG;iWYTl1BV}o{I!bvs5xd?YA$X^7LrJj|O zno&XmBSPe1G(xs0VK$IzhSQND+6(cEAhUEaJ~k>}Wh2!Lr}V6}5TR=ktPzQ)Lq$fa z8BUhmk5pZIe}Za8L?ijefqFQaan@`sNAPH}d-qT^-c>mD@IfKNqcMF6#)LkpW>^qd z49@SXNj1ZZN^*)}#Rd(JBNm)gGmJ$1jftPn%CuA}wiGQ@uGU~=kim$sX!w+hait2F zR5Ls%f{g|O7(t^MqD*X3rouw18BS(tD1}HhBlxU-AM=8SR5P5$T{|nRJvsV%TGR-z ziX|fOaq$o&Gqj29t2KtJ0@;&PGdx!IEJDz9(+D7h;Sq#B#)@I#4wO_gj2MGr_c2?@ zUpR+mo!Lk=!-`ZUQq3q$i4x)$L8*;%PBxYeHyf#DIH|SNjHH?otUQWlBGn8pS6E0j zqp+kXA$<{imM>1pRt>W@l4^#tdRkghQq2hB6pm*`%}1&k&X)@utH1WQRyB$0F=2gG z#3TtQHV>*ECoZ7@6a|iqUE^N|)eI=~F+3(0$XGEdbvU@rAb9n*1OgaNVEHMg6`RWF z#X_nX-q-s5GCs&(1fTVX60)sox-zz=2oVw(K`BG4gltj5Y#`MP50DH&2Jwp^^CVI} zHY#6bBh?J2jC_@XTj*K@YeeFSQIU~qhLa`tBURVl+L|^~H5%wzL^PUrWb$yTabbV0 zJG(1XdXs8~$DRk@!tor{XrPec(U`sjV?v))GmO@CB_M*~MI|}qMb?T9Iby*{HN!~6 zU-!e1YDO?ggi6JhqNU2!8jK7w7(qtEr&Nq9Rlua0;Xx5>G!VcD8qE-8Vv{lz7E;Y{ zGD|}#M5-CVXZ8D-7c``r;WX~rSz+zT(c4&85kTJ}BH-Mh&^&~q-`Q7d3|9rRC#hz5 ztdeldTDV%DLLtK=FntNe#5<{G7^Uki3Z@Xh=1~Y23B5!rJpAsu>Xh=LLo4Ar$=%Eeww!T)PIM@hn0RQtMMFWOxLoFTt1) zC)EtA+;t@&g5gCad2~@O8#FMERB%$wFcM8RF>E1$5lj-FQn96IqjI$dlV*SnMv&1^ zDHY>N6)>r0cu)iz4FoWPMsq=#*rZH_g;X<~%#uwCk!nWpS^YlJ1r4cYIE}k@R#bT~2}|Fub%RkgUtW z>us`VbR4c2ST&^@UY~Aa#of!bi!Y zD8@jXwbJlaAiJ_^h6ll}MHHHW8U#sUco428A*hfW$f_B}i<|GHn&AYJgla+-*00mm z!m1fYr8A%Lk^DvQNw7vJwxZ3(*kSSzNdhA%X#|Z>EJ~ORteW8glEKMH{36ISQ;biH z%2(Q0HNz<_AGIK>W(2E8;<-?Av1*2Mg?D$wq?%DUOIzx!v`|RdB0}N(VUx#Fj)}Ny z&BW((3Ja@d zlosbB`HSGwwke_5iiTv>3}=*5PDv6NLCIsOgkn*`WMI_{rz3-tk@!WBS<)z<7?rQI zv1*1>dU8rZBxh#zNIW4*E>_KOuJG=zSh!Oor7cZzYAB>^5e<}dBa_Ecj)}M{d-7JK zaAwsEk6V+IxeIUWYc!0PNKgaut36XOAf$k#TXY>orJAvri~|E#3dS!N;O06tc#IUF=XR| zm1gU4)r^`W6fHQ6QWe8EKSMR6s|`_yNLh%U!}1eUGdg@&?4VH1D4lHYP^FqtI)w~{ zMI?#^rI!m)s8$6DHJAqrUT~Mysu`^Zhs+!*&QQ2m!0cdwmGu}}sb&;39<1q5STEaW zQ(?$Kn~kI;mW{v#dvfsR=kYu65!H;Av=W#wA{Cf8=HE(8FY322?W~EL1ZbMU9neMqOu8&G1sSYK9vc)eO4LKak83%{Yto z-Qe_`9z#r2(Ag899kswpeNRX*!B*;`V5@f0w2{P4;1et0^f=o3dL8h9Kpis@ops8jAhB+=& zGnW4ysu?eke1>Yq3oM_dn(-3P=cs19!1GzE887jCj%vmWJfE(bfi$>3&^$8uh-yZM z<1y8YaHSijS~UaKkE&)QpGFBn6)KWTqXI$mHKrS{r_!c)as`j@d0921@M|J+)r`We ziAq&73a2WvP|ZkQFREq~eobVqno+nlk-ZnyjKWDG6O9b?rSJ6=1XIRzIXo;L@HQZ9 zhT-&iQ_V6V(e=7S^}ZCU z8HKYwtUxuR!1WPJR5R3aTs5O{s8ll=d!?Gu*!4{aJ*0#*MN-WuV7|aZH6w$vgaN7< z8I+4YR5LPY%jBS%QNl?zqcBKywAvs-%c>a#ZmX$PH6vfJJ5)0YbC+sHc4$;HwBi?3 zGqj&SUo~S{Xh{4esu}fH=E zO!mL8penJ)ndhuHSchJyX4FP`Lq@6@rNvY;fR?Hm21si0?WB0ftt8(`3Ltlpd=sf0 z@+88l8Afw1niNpYFeFqn9C6hQLoTHhR5Kj86lD#{f2r-#RWl5^l2TC3FeFqn47nB` zsAd>)qX>P8ggI0*3<=c?Ly~HSL2|!psu_kJQ_V1YtD0dJp6y>&&FB)xc=9KqPgTc2 z3EMNEzh=B3kI_26ppVfy9}&oC9bZt$Xq}HrWVEiwG%{Mxqaqot>oJv#*7LYbM(cY_ zC!@oYU-fqiWsvj#m{JDFN06o@EpNO#eOW4_)At3fjMCrRP>E$c;T4wZV3Y-FjS2i- zDRLR5oAcr~I(CuY<&HSXS3CqWwDztto%QRFdq>#C%2DudeWhDX_=0E#75qfijBuqN zDLYgt2-fLcwHl&`w7a8_7;>>uKZ)$B>5K>~ z>q(p^f-dolrj%{CAoYyaD67gzKBKY8Ye3b{Xs!IkHUW*sOmCAb1bk>j4RhFSZ` zAR}ZJ01e-t7@>rC&_BGp2u`GO3#l8Yjk^eDQlFTN2E32 zq_x5w5Z%3oyxRu)mn|S{^C{35`^U$AfEO9JPqOSiwWZ zpretBVTid9qbMX+Eu==0*+@lXY`GL0P)Z!MRM<&rBNb#iU#=8xB(=fq6!%Y%lsBSWwvhBjX$d|^Xe2%zR;LuJ zhFKX&eIr=a7{n0BNW>9NokCuh6wtbo|B>1ocdfcgx(Emw87Ux6CaK#as>VnPX!Y4& zq0*f+IHEh)y^5$FN@#0DK&H4sDjZH@Ajxn9=;{d&)d&L3Ou2lJ5Qi5iETqIyS)325 z8i`Mvr-WiFTP`LN;|NA;q}a9)*GQB+s!AvpB}@j=;|Mx3czjUSNMx3d$|pwUD{Umn z5tN>(8X}Z4601kzSy6J4C`WLGcX!2&v$UnjQ4Iw@8mCYs<;di*lw%_9T66MNq;Mu- zj)+^+ler6T?`z0yL@2Jpu@YE{I7-?a&Yi?6ptBJinuYe7QEWx*Y9e_KXOmK)e<63_ z_Etk%Xq;j!+LIMJg4B{!3vQvekpksGHBK=pXSR??M=+8lqJ-E+;|uA3w~+&vpev!gQT;^3`36_&ZGY+@>! zES7bL#rPn^k%FVaR5mdvTi~SJ5up)oOiBvx&t(~7n10W*@8 zNAOyc%}Qb(iI~UKY^3H9B?}YDd6cFUD?~XGrDc$_in&S}vy!4m5PPngnIt_DcZ$h# zrKwMfXnncFu@IU9*0v^lJuIyMN?}P-iqYe$$4rW73`GgWssih_Kpj^zxKQheuw2B0 zls&wU9VKaxKtZkdHjwEE4$E1wk+_E!DNUsAQJI1gIvt79+NqpktolG~>keD6LarmR z%0Mfpn3OYHNaG{IBunr?t0VDwS}CPim9jFD%tx?B5=&9i`AEbOj;BgRM?xP#m;8^^ z-neU<+Vs_cAjXjb(p)5)M^ufG6wvCkze1%uiG4);>|RCWiK_uY*&_lnVGIGKhNSo5 z%r1!m{f;OtX(=z-Nb$qnvwAIiqA^Q?kND+8@DZxhcg+{3B6X5S|4E5vhL!k^6Sm*|>5W>U`87 zpwy9q;B+C2M^TJ{IBTWht3Y-o1(1kWvXFTTU+Y}ReMAtZmLZ_{ClL^5b)5`|dPHeS zG+8dP5=)L(45S0%JW|30BB1J#$fQZiCZ?hRO4ngAK8SlHJ{mY>6N9n^PHG?#8sWwS zWsk(9*`Z`&Q?kNDf*`?X87Rd_5hPJs5I*(=5lMmsk^6Sm*|>5W>I~E%Am5RK;8Y=t zM^TJ{IBTWht3Y;Lx2{DL;%l7?4Uh=JBs2sR?xYOjz2M>*Q2L0{l25wySS&eSF_1Wj z^JoT&h15Y3nS`lqVk#P|bR8B`_JHC?;-i66HZdq$;3N?ep%HFOko!nXnjK0eHYF=e zq!JQ*mVr`?WI__91>s{~5Rpzu5V>z>osDZD(@_NhO^*}=XBCC#Q50h!&RS{sDv({* zt!oj5W}x;2>4HQQCa0mOuxGgt?+6#tAXShckerewNh}!R1+s+|Ln@02bCCK+;*)5V zP;Et{#f10rT&yq|C5eM1N*Y2XREw4h1M7xFfMhT-5(i0SI;P5}M&&DPEFBV*mJ3pl zwL=oCMdGkVfGvM&pWL>%l} z1fprF{XtqG5r<1_C@lPjvWAFLsc9d+aC=zVp-d(q{r?yIq>I=9h!-hLtSwTRoRS1Y5~a3LIn`J+ zD9eiksb#Db+>(k&V&#!lPBkfKvarHPFp|ZiBo&dwXKAFAYE{b8$RZ=b>KUtnk`hQF z_HaB!N;Z}m3AS+Wu3OntTct%!#%eUA9Fn4u6eOF6Q;v`ND}QoVr0`~`k%(P0me~t; z>vS|uR*q0B@$)~E2_n3}q<3tANhLRey0{Yf5f^_MxyR5TqhnCRWLOy)x4vfsQ3;2% zlR@I;E+bxfbd)d|6kdUqmvQA41M@P>yaEz$1gvk~g;`*sR)cbjMak8~>?v%8ncoA~ z=S}5Lp{v38bMR^s{s>=TTj8$yBNz$lpqB+mp0WZ7K8&Wb&2IX^_IiJD^2M#`f2cgi zc!q2h*^*j=1T|J7B#v-1S%t(QG*Dzn9Fa9!6J9cCwJNrtuZUqui6o&eH^K`XOW&+T zl8UIzh6|76N*o+FXemdM_(TAt)g$S0Ndh7&a?yC1AjjljnjN&fciR!qW_iC_Cq|Vd z0i%TUvL;EYn0Bg{q9n<9M3n>{RBUj5a(+T9cslG?; z=CU72qr~ewE>hCr!f|JnlG4YbE@etepNLtb5k-sA$s;!D5ASaSY&Oh&ZZ_?8`&hVg z3*0hY)6RF)?Z`*8N;+ICT@PbYU5}#$T4|3Wql%z4rxfdJ`%1wO?g(z3xz(9vlr~D{ zXM!a@1m;+^%>1KeWdtuvmbC1LO0xtWqELcK$wW&WOR6P~CD{_kl5UA(Nw~zZq+H@y zk}h#9X_q)wikCP{%grnG64-cLy5vg=TcclMRuMFz+dj#3)-#d&m;|VT2^ZQ754tCG zM!N%8!vu!^D6hWYLyVp%bNt6^-TgT z1Wp1*wUxpNY-Pns;v~w+e(!l-B~2(zv~L=b6PP|h<)roMlsReLu(+VmIU$dig-#le zq;%5QveXHTp;V%4aO5izu;dhpofO`ZSEP1Qz>-@ecT&Jf@1($!;7Nfe#ghV0k|zaT zX`U1|nR`_9q_9Yeis}grwd_fPT=yhnCVY}HQ$EREf~l$VG;O9$meqR$aRd5P%Ll~BO)iBc$Cp2xIMk}ute)nX`Q{-_#Cc4{O( zR1PKkH2NMix6^#&Rmo&;ANwJQlAK;vL@6Dcs9X}I^lKthO_b8BiY`P^vfGQQD5YZ) zoy($>eob`mMHi*?lIZXdaaiz+6W`S<5as|=MnO3@8knR}vf18j;TCQ2H08%!FItMD zpwy?Tqjb0)lSk=rmCFY7QOs5eq?EAU^Fkq|#O?725-FuYpX@{<#Y{1;j)&XD0X6$~^CV+gY$u!4w$dKBhx4rL=cRrW78HW{Oq*f@lg{I9)$qH3cOf z=XhhoQhL+DUm}|Vit<~Oq*4B7byJ$)3*nT;8pC<|tKs3xFZkmZUwv{UJn4@AOOgCQ^Y-|^8c0W% z;FZB=b;&oI<>bE_Mn`}AC1LzUee%zn``vhY^6h3aJ^9^k)3kkm*zAUP)6=`n=59H~ z1#^Eo-mH#f$$q@;Lse}@SMm9QyXC85nCV5(k$nAc59C-3^wR0C6~iulValGMS6qLs zDCjGFzv>tcdY|^!3SvK9Ek^cbDf@z6-~F}1I1&QADV!fx%id@+d2cVJXv)6TOBwxX z&)PDnt~U7TmE?D!khVa^5BJl_tv&7x^m$<0o1gdQ7rpsqZ+_LAzv|7ed&Ayhy}dv5 z=$>V`n+|)Ud;I*r#%JvTKV0MYvFUCxv&9m4do4lr_V+9BzyC14-|aWM!FIEt>&o-|;sf)n2PWx+}R)JbSAziO=eTg7;?nC*tEX|Jy7WHb6RbPHRY z%SRmc;Cw49L3pvtS)Lf|1wS$c!Z2HWiHBp-E&VWDFK~yn*sKSHo?Prt7VFt!jVF%h ze|R^2&tdIP$oApv=O5y^Q{M!hef5l=2U=X-?LFfzwzZwhd$woXskX)odFAzd*tE9G z>oa=q_)JTV?r^QQ)hYV>>K9+wFq}h=##&E*hGN>_XR{gRkWP6v@|0ylR78F)RJkVk zK1i*nG_a!gtlbLIJxRsfHNB&DV^Iu zeH}*;=%~MrNOjdsgwek|BYOaY%d>~aA}*LU@7lncAn=Tb@8zCWz-%BKk4|1q2Pc!^ z?%h}TO5&0igD5_OpIu&F-fFursyv}cb0;0nnDZg&$&b<#>kTe-w;R4c?>lxip?{xG z3BCyUW=8)Cd>QcQd~`9w+j;W73V3==|8hiRIfJD$eD|OLS`Ui_GnCUvUTU+^1E3Hq zQxw*!IJHL8T8mqwz+gR7I!L#UqM)u;(_4=Co+zG_;%IddUB6Ivwph}|T|R$#j;!4D suc=S$rz`*goeEwhm4^J?wu>b%7 literal 0 HcmV?d00001 diff --git a/pkg/arvo/app/debug/index.html b/pkg/arvo/app/debug/index.html index cc97475f1d..d73c21e603 100644 --- a/pkg/arvo/app/debug/index.html +++ b/pkg/arvo/app/debug/index.html @@ -1,20 +1,16 @@ - - - - Debug Dashboard - - - - - - - -

-
- - - - - + + + + + Debug Dashboard + + + + + +
+ + + diff --git a/pkg/arvo/app/debug/index.js b/pkg/arvo/app/debug/index.js new file mode 100644 index 0000000000..cebcc308b6 --- /dev/null +++ b/pkg/arvo/app/debug/index.js @@ -0,0 +1,89 @@ +var FT=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var $4=FT((V4,_c)=>{(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const u of a.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();var Ir=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function gu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function UT(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}),n}var d_={exports:{}},ih={},p_={exports:{}},je={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var vu=Symbol.for("react.element"),WT=Symbol.for("react.portal"),BT=Symbol.for("react.fragment"),zT=Symbol.for("react.strict_mode"),$T=Symbol.for("react.profiler"),YT=Symbol.for("react.provider"),HT=Symbol.for("react.context"),GT=Symbol.for("react.forward_ref"),VT=Symbol.for("react.suspense"),qT=Symbol.for("react.memo"),QT=Symbol.for("react.lazy"),Dy=Symbol.iterator;function KT(e){return e===null||typeof e!="object"?null:(e=Dy&&e[Dy]||e["@@iterator"],typeof e=="function"?e:null)}var m_={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g_=Object.assign,v_={};function Ka(e,t,n){this.props=e,this.context=t,this.refs=v_,this.updater=n||m_}Ka.prototype.isReactComponent={};Ka.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ka.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function y_(){}y_.prototype=Ka.prototype;function J0(e,t,n){this.props=e,this.context=t,this.refs=v_,this.updater=n||m_}var em=J0.prototype=new y_;em.constructor=J0;g_(em,Ka.prototype);em.isPureReactComponent=!0;var Ay=Array.isArray,__=Object.prototype.hasOwnProperty,tm={current:null},w_={key:!0,ref:!0,__self:!0,__source:!0};function x_(e,t,n){var r,s={},a=null,u=null;if(t!=null)for(r in t.ref!==void 0&&(u=t.ref),t.key!==void 0&&(a=""+t.key),t)__.call(t,r)&&!w_.hasOwnProperty(r)&&(s[r]=t[r]);var h=arguments.length-2;if(h===1)s.children=n;else if(1>>1,G=R[M];if(0>>1;Ms(re,c))yes(Me,re)?(R[M]=Me,R[ye]=c,M=ye):(R[M]=re,R[ae]=c,M=ae);else if(yes(Me,c))R[M]=Me,R[ye]=c,M=ye;else break e}}return w}function s(R,w){var c=R.sortIndex-w.sortIndex;return c!==0?c:R.id-w.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var u=Date,h=u.now();e.unstable_now=function(){return u.now()-h}}var p=[],g=[],v=1,O=null,b=3,F=!1,z=!1,K=!1,me=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function I(R){for(var w=n(g);w!==null;){if(w.callback===null)r(g);else if(w.startTime<=R)r(g),w.sortIndex=w.expirationTime,t(p,w);else break;w=n(g)}}function Y(R){if(K=!1,I(R),!z)if(n(p)!==null)z=!0,T(X);else{var w=n(g);w!==null&&L(Y,w.startTime-R)}}function X(R,w){z=!1,K&&(K=!1,N(J),J=-1),F=!0;var c=b;try{for(I(w),O=n(p);O!==null&&(!(O.expirationTime>w)||R&&!P());){var M=O.callback;if(typeof M=="function"){O.callback=null,b=O.priorityLevel;var G=M(O.expirationTime<=w);w=e.unstable_now(),typeof G=="function"?O.callback=G:O===n(p)&&r(p),I(w)}else r(p);O=n(p)}if(O!==null)var se=!0;else{var ae=n(g);ae!==null&&L(Y,ae.startTime-w),se=!1}return se}finally{O=null,b=c,F=!1}}var te=!1,V=null,J=-1,le=5,fe=-1;function P(){return!(e.unstable_now()-feR||125M?(R.sortIndex=c,t(g,R),n(p)===null&&R===n(g)&&(K?(N(J),J=-1):K=!0,L(Y,c-M))):(R.sortIndex=G,t(p,R),z||F||(z=!0,T(X))),R},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(R){var w=b;return function(){var c=b;b=w;try{return R.apply(this,arguments)}finally{b=c}}}})(k_);C_.exports=k_;var aP=C_.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var O_=oe,yr=aP;function ne(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Hp=Object.prototype.hasOwnProperty,lP=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,jy={},Ny={};function uP(e){return Hp.call(Ny,e)?!0:Hp.call(jy,e)?!1:lP.test(e)?Ny[e]=!0:(jy[e]=!0,!1)}function fP(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function cP(e,t,n,r){if(t===null||typeof t>"u"||fP(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Yn(e,t,n,r,s,a,u){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=u}var Mn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Mn[e]=new Yn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Mn[t]=new Yn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Mn[e]=new Yn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Mn[e]=new Yn(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Mn[e]=new Yn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Mn[e]=new Yn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Mn[e]=new Yn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Mn[e]=new Yn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Mn[e]=new Yn(e,5,!1,e.toLowerCase(),null,!1,!1)});var rm=/[\-:]([a-z])/g;function im(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(rm,im);Mn[t]=new Yn(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(rm,im);Mn[t]=new Yn(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(rm,im);Mn[t]=new Yn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Mn[e]=new Yn(e,1,!1,e.toLowerCase(),null,!1,!1)});Mn.xlinkHref=new Yn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Mn[e]=new Yn(e,1,!1,e.toLowerCase(),null,!0,!0)});function sm(e,t,n,r){var s=Mn.hasOwnProperty(t)?Mn[t]:null;(s!==null?s.type!==0:r||!(2h||s[u]!==a[h]){var p=` +`+s[u].replace(" at new "," at ");return e.displayName&&p.includes("")&&(p=p.replace("",e.displayName)),p}while(1<=u&&0<=h);break}}}finally{cp=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Dl(e):""}function hP(e){switch(e.tag){case 5:return Dl(e.type);case 16:return Dl("Lazy");case 13:return Dl("Suspense");case 19:return Dl("SuspenseList");case 0:case 2:case 15:return e=hp(e.type,!1),e;case 11:return e=hp(e.type.render,!1),e;case 1:return e=hp(e.type,!0),e;default:return""}}function Qp(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ga:return"Fragment";case ma:return"Portal";case Gp:return"Profiler";case om:return"StrictMode";case Vp:return"Suspense";case qp:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case P_:return(e.displayName||"Context")+".Consumer";case T_:return(e._context.displayName||"Context")+".Provider";case am:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case lm:return t=e.displayName||null,t!==null?t:Qp(e.type)||"Memo";case Ts:t=e._payload,e=e._init;try{return Qp(e(t))}catch{}}return null}function dP(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Qp(t);case 8:return t===om?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Hs(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function b_(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function pP(e){var t=b_(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(u){r=""+u,a.call(this,u)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(u){r=""+u},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Nf(e){e._valueTracker||(e._valueTracker=pP(e))}function D_(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=b_(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function wc(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Kp(e,t){var n=t.checked;return Kt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Fy(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Hs(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function A_(e,t){t=t.checked,t!=null&&sm(e,"checked",t,!1)}function Zp(e,t){A_(e,t);var n=Hs(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Xp(e,t.type,n):t.hasOwnProperty("defaultValue")&&Xp(e,t.type,Hs(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Uy(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Xp(e,t,n){(t!=="number"||wc(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Al=Array.isArray;function Pa(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=If.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Zl(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Nl={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},mP=["Webkit","ms","Moz","O"];Object.keys(Nl).forEach(function(e){mP.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Nl[t]=Nl[e]})});function I_(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Nl.hasOwnProperty(e)&&Nl[e]?(""+t).trim():t+"px"}function F_(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=I_(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var gP=Kt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function t0(e,t){if(t){if(gP[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ne(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ne(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ne(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ne(62))}}function n0(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var r0=null;function um(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var i0=null,Ra=null,ba=null;function zy(e){if(e=wu(e)){if(typeof i0!="function")throw Error(ne(280));var t=e.stateNode;t&&(t=uh(t),i0(e.stateNode,e.type,t))}}function U_(e){Ra?ba?ba.push(e):ba=[e]:Ra=e}function W_(){if(Ra){var e=Ra,t=ba;if(ba=Ra=null,zy(e),t)for(e=0;e>>=0,e===0?32:31-(EP(e)/TP|0)|0}var Ff=64,Uf=4194304;function Ll(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Cc(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,a=e.pingedLanes,u=n&268435455;if(u!==0){var h=u&~s;h!==0?r=Ll(h):(a&=u,a!==0&&(r=Ll(a)))}else u=n&~s,u!==0?r=Ll(u):a!==0&&(r=Ll(a));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,a=t&-t,s>=a||s===16&&(a&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function yu(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ti(t),e[t]=n}function DP(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Fl),Zy=" ",Xy=!1;function ow(e,t){switch(e){case"keyup":return o3.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function aw(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var va=!1;function l3(e,t){switch(e){case"compositionend":return aw(t);case"keypress":return t.which!==32?null:(Xy=!0,Zy);case"textInput":return e=t.data,e===Zy&&Xy?null:e;default:return null}}function u3(e,t){if(va)return e==="compositionend"||!vm&&ow(e,t)?(e=iw(),sc=pm=Ds=null,va=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=n1(n)}}function cw(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?cw(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function hw(){for(var e=window,t=wc();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=wc(e.document)}return t}function ym(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function y3(e){var t=hw(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&cw(n.ownerDocument.documentElement,n)){if(r!==null&&ym(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,a=Math.min(r.start,s);r=r.end===void 0?a:Math.min(r.end,s),!e.extend&&a>r&&(s=r,r=a,a=s),s=r1(n,a);var u=r1(n,r);s&&u&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==u.node||e.focusOffset!==u.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(u.node,u.offset)):(t.setEnd(u.node,u.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,ya=null,f0=null,Wl=null,c0=!1;function i1(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;c0||ya==null||ya!==wc(r)||(r=ya,"selectionStart"in r&&ym(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Wl&&ru(Wl,r)||(Wl=r,r=Ec(f0,"onSelect"),0xa||(e.current=v0[xa],v0[xa]=null,xa--)}function Mt(e,t){xa++,v0[xa]=e.current,e.current=t}var Gs={},Dn=qs(Gs),nr=qs(!1),jo=Gs;function Ba(e,t){var n=e.type.contextTypes;if(!n)return Gs;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},a;for(a in n)s[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function rr(e){return e=e.childContextTypes,e!=null}function Pc(){bt(nr),bt(Dn)}function c1(e,t,n){if(Dn.current!==Gs)throw Error(ne(168));Mt(Dn,t),Mt(nr,n)}function xw(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(ne(108,dP(e)||"Unknown",s));return Kt({},n,r)}function Rc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Gs,jo=Dn.current,Mt(Dn,e),Mt(nr,nr.current),!0}function h1(e,t,n){var r=e.stateNode;if(!r)throw Error(ne(169));n?(e=xw(e,t,jo),r.__reactInternalMemoizedMergedChildContext=e,bt(nr),bt(Dn),Mt(Dn,e)):bt(nr),Mt(nr,n)}var Ki=null,fh=!1,Op=!1;function Sw(e){Ki===null?Ki=[e]:Ki.push(e)}function R3(e){fh=!0,Sw(e)}function Qs(){if(!Op&&Ki!==null){Op=!0;var e=0,t=et;try{var n=Ki;for(et=1;e>=u,s-=u,Zi=1<<32-ti(t)+s|n<J?(le=V,V=null):le=V.sibling;var fe=b(N,V,I[J],Y);if(fe===null){V===null&&(V=le);break}e&&V&&fe.alternate===null&&t(N,V),A=a(fe,A,J),te===null?X=fe:te.sibling=fe,te=fe,V=le}if(J===I.length)return n(N,V),Gt&&Co(N,J),X;if(V===null){for(;JJ?(le=V,V=null):le=V.sibling;var P=b(N,V,fe.value,Y);if(P===null){V===null&&(V=le);break}e&&V&&P.alternate===null&&t(N,V),A=a(P,A,J),te===null?X=P:te.sibling=P,te=P,V=le}if(fe.done)return n(N,V),Gt&&Co(N,J),X;if(V===null){for(;!fe.done;J++,fe=I.next())fe=O(N,fe.value,Y),fe!==null&&(A=a(fe,A,J),te===null?X=fe:te.sibling=fe,te=fe);return Gt&&Co(N,J),X}for(V=r(N,V);!fe.done;J++,fe=I.next())fe=F(V,N,J,fe.value,Y),fe!==null&&(e&&fe.alternate!==null&&V.delete(fe.key===null?J:fe.key),A=a(fe,A,J),te===null?X=fe:te.sibling=fe,te=fe);return e&&V.forEach(function(f){return t(N,f)}),Gt&&Co(N,J),X}function me(N,A,I,Y){if(typeof I=="object"&&I!==null&&I.type===ga&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case jf:e:{for(var X=I.key,te=A;te!==null;){if(te.key===X){if(X=I.type,X===ga){if(te.tag===7){n(N,te.sibling),A=s(te,I.props.children),A.return=N,N=A;break e}}else if(te.elementType===X||typeof X=="object"&&X!==null&&X.$$typeof===Ts&&_1(X)===te.type){n(N,te.sibling),A=s(te,I.props),A.ref=Ol(N,te,I),A.return=N,N=A;break e}n(N,te);break}else t(N,te);te=te.sibling}I.type===ga?(A=Do(I.props.children,N.mode,Y,I.key),A.return=N,N=A):(Y=dc(I.type,I.key,I.props,null,N.mode,Y),Y.ref=Ol(N,A,I),Y.return=N,N=Y)}return u(N);case ma:e:{for(te=I.key;A!==null;){if(A.key===te)if(A.tag===4&&A.stateNode.containerInfo===I.containerInfo&&A.stateNode.implementation===I.implementation){n(N,A.sibling),A=s(A,I.children||[]),A.return=N,N=A;break e}else{n(N,A);break}else t(N,A);A=A.sibling}A=Lp(I,N.mode,Y),A.return=N,N=A}return u(N);case Ts:return te=I._init,me(N,A,te(I._payload),Y)}if(Al(I))return z(N,A,I,Y);if(xl(I))return K(N,A,I,Y);Gf(N,I)}return typeof I=="string"&&I!==""||typeof I=="number"?(I=""+I,A!==null&&A.tag===6?(n(N,A.sibling),A=s(A,I),A.return=N,N=A):(n(N,A),A=Ap(I,N.mode,Y),A.return=N,N=A),u(N)):n(N,A)}return me}var $a=Rw(!0),bw=Rw(!1),xu={},Oi=qs(xu),au=qs(xu),lu=qs(xu);function Po(e){if(e===xu)throw Error(ne(174));return e}function Em(e,t){switch(Mt(lu,t),Mt(au,e),Mt(Oi,xu),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:e0(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=e0(t,e)}bt(Oi),Mt(Oi,t)}function Ya(){bt(Oi),bt(au),bt(lu)}function Dw(e){Po(lu.current);var t=Po(Oi.current),n=e0(t,e.type);t!==n&&(Mt(au,e),Mt(Oi,n))}function Tm(e){au.current===e&&(bt(Oi),bt(au))}var qt=qs(0);function Nc(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ep=[];function Pm(){for(var e=0;en?n:4,e(!0);var r=Tp.transition;Tp.transition={};try{e(!1),t()}finally{et=n,Tp.transition=r}}function qw(){return Br().memoizedState}function L3(e,t,n){var r=zs(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Qw(e))Kw(t,n);else if(n=Ow(e,t,n,r),n!==null){var s=Bn();ni(n,e,r,s),Zw(n,t,r)}}function j3(e,t,n){var r=zs(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Qw(e))Kw(t,s);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var u=t.lastRenderedState,h=a(u,n);if(s.hasEagerState=!0,s.eagerState=h,ri(h,u)){var p=t.interleaved;p===null?(s.next=s,km(t)):(s.next=p.next,p.next=s),t.interleaved=s;return}}catch{}finally{}n=Ow(e,t,s,r),n!==null&&(s=Bn(),ni(n,e,r,s),Zw(n,t,r))}}function Qw(e){var t=e.alternate;return e===Qt||t!==null&&t===Qt}function Kw(e,t){Bl=Ic=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Zw(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,cm(e,n)}}var Fc={readContext:Wr,useCallback:En,useContext:En,useEffect:En,useImperativeHandle:En,useInsertionEffect:En,useLayoutEffect:En,useMemo:En,useReducer:En,useRef:En,useState:En,useDebugValue:En,useDeferredValue:En,useTransition:En,useMutableSource:En,useSyncExternalStore:En,useId:En,unstable_isNewReconciler:!1},N3={readContext:Wr,useCallback:function(e,t){return wi().memoizedState=[e,t===void 0?null:t],e},useContext:Wr,useEffect:x1,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,uc(4194308,4,$w.bind(null,t,e),n)},useLayoutEffect:function(e,t){return uc(4194308,4,e,t)},useInsertionEffect:function(e,t){return uc(4,2,e,t)},useMemo:function(e,t){var n=wi();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=wi();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=L3.bind(null,Qt,e),[r.memoizedState,e]},useRef:function(e){var t=wi();return e={current:e},t.memoizedState=e},useState:w1,useDebugValue:Lm,useDeferredValue:function(e){return wi().memoizedState=e},useTransition:function(){var e=w1(!1),t=e[0];return e=A3.bind(null,e[1]),wi().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Qt,s=wi();if(Gt){if(n===void 0)throw Error(ne(407));n=n()}else{if(n=t(),vn===null)throw Error(ne(349));Io&30||jw(r,t,n)}s.memoizedState=n;var a={value:n,getSnapshot:t};return s.queue=a,x1(Iw.bind(null,r,a,e),[e]),r.flags|=2048,cu(9,Nw.bind(null,r,a,n,t),void 0,null),n},useId:function(){var e=wi(),t=vn.identifierPrefix;if(Gt){var n=Xi,r=Zi;n=(r&~(1<<32-ti(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=uu++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=u.createElement(n,{is:r.is}):(e=u.createElement(n),n==="select"&&(u=e,r.multiple?u.multiple=!0:r.size&&(u.size=r.size))):e=u.createElementNS(e,n),e[xi]=t,e[ou]=r,ox(e,t,!1,!1),t.stateNode=e;e:{switch(u=n0(n,r),n){case"dialog":Rt("cancel",e),Rt("close",e),s=r;break;case"iframe":case"object":case"embed":Rt("load",e),s=r;break;case"video":case"audio":for(s=0;sGa&&(t.flags|=128,r=!0,El(a,!1),t.lanes=4194304)}else{if(!r)if(e=Nc(u),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),El(a,!0),a.tail===null&&a.tailMode==="hidden"&&!u.alternate&&!Gt)return Tn(t),null}else 2*rn()-a.renderingStartTime>Ga&&n!==1073741824&&(t.flags|=128,r=!0,El(a,!1),t.lanes=4194304);a.isBackwards?(u.sibling=t.child,t.child=u):(n=a.last,n!==null?n.sibling=u:t.child=u,a.last=u)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=rn(),t.sibling=null,n=qt.current,Mt(qt,r?n&1|2:n&1),t):(Tn(t),null);case 22:case 23:return Wm(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?dr&1073741824&&(Tn(t),t.subtreeFlags&6&&(t.flags|=8192)):Tn(t),null;case 24:return null;case 25:return null}throw Error(ne(156,t.tag))}function Y3(e,t){switch(wm(t),t.tag){case 1:return rr(t.type)&&Pc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ya(),bt(nr),bt(Dn),Pm(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Tm(t),null;case 13:if(bt(qt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ne(340));za()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return bt(qt),null;case 4:return Ya(),null;case 10:return Cm(t.type._context),null;case 22:case 23:return Wm(),null;case 24:return null;default:return null}}var qf=!1,Rn=!1,H3=typeof WeakSet=="function"?WeakSet:Set,ge=null;function ka(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Xt(e,t,r)}else n.current=null}function P0(e,t,n){try{n()}catch(r){Xt(e,t,r)}}var R1=!1;function G3(e,t){if(h0=kc,e=hw(),ym(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break e}var u=0,h=-1,p=-1,g=0,v=0,O=e,b=null;t:for(;;){for(var F;O!==n||s!==0&&O.nodeType!==3||(h=u+s),O!==a||r!==0&&O.nodeType!==3||(p=u+r),O.nodeType===3&&(u+=O.nodeValue.length),(F=O.firstChild)!==null;)b=O,O=F;for(;;){if(O===e)break t;if(b===n&&++g===s&&(h=u),b===a&&++v===r&&(p=u),(F=O.nextSibling)!==null)break;O=b,b=O.parentNode}O=F}n=h===-1||p===-1?null:{start:h,end:p}}else n=null}n=n||{start:0,end:0}}else n=null;for(d0={focusedElem:e,selectionRange:n},kc=!1,ge=t;ge!==null;)if(t=ge,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ge=e;else for(;ge!==null;){t=ge;try{var z=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(z!==null){var K=z.memoizedProps,me=z.memoizedState,N=t.stateNode,A=N.getSnapshotBeforeUpdate(t.elementType===t.type?K:Zr(t.type,K),me);N.__reactInternalSnapshotBeforeUpdate=A}break;case 3:var I=t.stateNode.containerInfo;I.nodeType===1?I.textContent="":I.nodeType===9&&I.documentElement&&I.removeChild(I.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ne(163))}}catch(Y){Xt(t,t.return,Y)}if(e=t.sibling,e!==null){e.return=t.return,ge=e;break}ge=t.return}return z=R1,R1=!1,z}function zl(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var a=s.destroy;s.destroy=void 0,a!==void 0&&P0(t,n,a)}s=s.next}while(s!==r)}}function dh(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function R0(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function ux(e){var t=e.alternate;t!==null&&(e.alternate=null,ux(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[xi],delete t[ou],delete t[g0],delete t[T3],delete t[P3])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function fx(e){return e.tag===5||e.tag===3||e.tag===4}function b1(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||fx(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function b0(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Tc));else if(r!==4&&(e=e.child,e!==null))for(b0(e,t,n),e=e.sibling;e!==null;)b0(e,t,n),e=e.sibling}function D0(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(D0(e,t,n),e=e.sibling;e!==null;)D0(e,t,n),e=e.sibling}var xn=null,Xr=!1;function Cs(e,t,n){for(n=n.child;n!==null;)cx(e,t,n),n=n.sibling}function cx(e,t,n){if(ki&&typeof ki.onCommitFiberUnmount=="function")try{ki.onCommitFiberUnmount(sh,n)}catch{}switch(n.tag){case 5:Rn||ka(n,t);case 6:var r=xn,s=Xr;xn=null,Cs(e,t,n),xn=r,Xr=s,xn!==null&&(Xr?(e=xn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):xn.removeChild(n.stateNode));break;case 18:xn!==null&&(Xr?(e=xn,n=n.stateNode,e.nodeType===8?kp(e.parentNode,n):e.nodeType===1&&kp(e,n),tu(e)):kp(xn,n.stateNode));break;case 4:r=xn,s=Xr,xn=n.stateNode.containerInfo,Xr=!0,Cs(e,t,n),xn=r,Xr=s;break;case 0:case 11:case 14:case 15:if(!Rn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var a=s,u=a.destroy;a=a.tag,u!==void 0&&(a&2||a&4)&&P0(n,t,u),s=s.next}while(s!==r)}Cs(e,t,n);break;case 1:if(!Rn&&(ka(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(h){Xt(n,t,h)}Cs(e,t,n);break;case 21:Cs(e,t,n);break;case 22:n.mode&1?(Rn=(r=Rn)||n.memoizedState!==null,Cs(e,t,n),Rn=r):Cs(e,t,n);break;default:Cs(e,t,n)}}function D1(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new H3),t.forEach(function(r){var s=tR.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Kr(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=u),r&=~a}if(r=s,r=rn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*q3(r/1960))-r,10e?16:e,As===null)var r=!1;else{if(e=As,As=null,Bc=0,Be&6)throw Error(ne(331));var s=Be;for(Be|=4,ge=e.current;ge!==null;){var a=ge,u=a.child;if(ge.flags&16){var h=a.deletions;if(h!==null){for(var p=0;prn()-Fm?bo(e,0):Im|=n),ir(e,t)}function _x(e,t){t===0&&(e.mode&1?(t=Uf,Uf<<=1,!(Uf&130023424)&&(Uf=4194304)):t=1);var n=Bn();e=ss(e,t),e!==null&&(yu(e,t,n),ir(e,n))}function eR(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),_x(e,n)}function tR(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(ne(314))}r!==null&&r.delete(t),_x(e,n)}var wx;wx=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||nr.current)tr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return tr=!1,z3(e,t,n);tr=!!(e.flags&131072)}else tr=!1,Gt&&t.flags&1048576&&Mw(t,Dc,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;fc(e,t),e=t.pendingProps;var s=Ba(t,Dn.current);Aa(t,n),s=bm(null,t,r,e,s,n);var a=Dm();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,rr(r)?(a=!0,Rc(t)):a=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Om(t),s.updater=ch,t.stateNode=s,s._reactInternals=t,S0(t,r,e,n),t=k0(null,t,r,!0,a,n)):(t.tag=0,Gt&&a&&_m(t),Wn(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(fc(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=rR(r),e=Zr(r,e),s){case 0:t=C0(null,t,r,e,n);break e;case 1:t=E1(null,t,r,e,n);break e;case 11:t=k1(null,t,r,e,n);break e;case 14:t=O1(null,t,r,Zr(r.type,e),n);break e}throw Error(ne(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Zr(r,s),C0(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Zr(r,s),E1(e,t,r,s,n);case 3:e:{if(rx(t),e===null)throw Error(ne(387));r=t.pendingProps,a=t.memoizedState,s=a.element,Ew(e,t),jc(t,r,null,n);var u=t.memoizedState;if(r=u.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:u.cache,pendingSuspenseBoundaries:u.pendingSuspenseBoundaries,transitions:u.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){s=Ha(Error(ne(423)),t),t=T1(e,t,r,n,s);break e}else if(r!==s){s=Ha(Error(ne(424)),t),t=T1(e,t,r,n,s);break e}else for(mr=Us(t.stateNode.containerInfo.firstChild),vr=t,Gt=!0,Jr=null,n=bw(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(za(),r===s){t=os(e,t,n);break e}Wn(e,t,r,n)}t=t.child}return t;case 5:return Dw(t),e===null&&_0(t),r=t.type,s=t.pendingProps,a=e!==null?e.memoizedProps:null,u=s.children,p0(r,s)?u=null:a!==null&&p0(r,a)&&(t.flags|=32),nx(e,t),Wn(e,t,u,n),t.child;case 6:return e===null&&_0(t),null;case 13:return ix(e,t,n);case 4:return Em(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=$a(t,null,r,n):Wn(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Zr(r,s),k1(e,t,r,s,n);case 7:return Wn(e,t,t.pendingProps,n),t.child;case 8:return Wn(e,t,t.pendingProps.children,n),t.child;case 12:return Wn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,a=t.memoizedProps,u=s.value,Mt(Ac,r._currentValue),r._currentValue=u,a!==null)if(ri(a.value,u)){if(a.children===s.children&&!nr.current){t=os(e,t,n);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var h=a.dependencies;if(h!==null){u=a.child;for(var p=h.firstContext;p!==null;){if(p.context===r){if(a.tag===1){p=ts(-1,n&-n),p.tag=2;var g=a.updateQueue;if(g!==null){g=g.shared;var v=g.pending;v===null?p.next=p:(p.next=v.next,v.next=p),g.pending=p}}a.lanes|=n,p=a.alternate,p!==null&&(p.lanes|=n),w0(a.return,n,t),h.lanes|=n;break}p=p.next}}else if(a.tag===10)u=a.type===t.type?null:a.child;else if(a.tag===18){if(u=a.return,u===null)throw Error(ne(341));u.lanes|=n,h=u.alternate,h!==null&&(h.lanes|=n),w0(u,n,t),u=a.sibling}else u=a.child;if(u!==null)u.return=a;else for(u=a;u!==null;){if(u===t){u=null;break}if(a=u.sibling,a!==null){a.return=u.return,u=a;break}u=u.return}a=u}Wn(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Aa(t,n),s=Wr(s),r=r(s),t.flags|=1,Wn(e,t,r,n),t.child;case 14:return r=t.type,s=Zr(r,t.pendingProps),s=Zr(r.type,s),O1(e,t,r,s,n);case 15:return ex(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Zr(r,s),fc(e,t),t.tag=1,rr(r)?(e=!0,Rc(t)):e=!1,Aa(t,n),Pw(t,r,s),S0(t,r,s,n),k0(null,t,r,!0,e,n);case 19:return sx(e,t,n);case 22:return tx(e,t,n)}throw Error(ne(156,t.tag))};function xx(e,t){return V_(e,t)}function nR(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Fr(e,t,n,r){return new nR(e,t,n,r)}function zm(e){return e=e.prototype,!(!e||!e.isReactComponent)}function rR(e){if(typeof e=="function")return zm(e)?1:0;if(e!=null){if(e=e.$$typeof,e===am)return 11;if(e===lm)return 14}return 2}function $s(e,t){var n=e.alternate;return n===null?(n=Fr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function dc(e,t,n,r,s,a){var u=2;if(r=e,typeof e=="function")zm(e)&&(u=1);else if(typeof e=="string")u=5;else e:switch(e){case ga:return Do(n.children,s,a,t);case om:u=8,s|=8;break;case Gp:return e=Fr(12,n,t,s|2),e.elementType=Gp,e.lanes=a,e;case Vp:return e=Fr(13,n,t,s),e.elementType=Vp,e.lanes=a,e;case qp:return e=Fr(19,n,t,s),e.elementType=qp,e.lanes=a,e;case R_:return mh(n,s,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case T_:u=10;break e;case P_:u=9;break e;case am:u=11;break e;case lm:u=14;break e;case Ts:u=16,r=null;break e}throw Error(ne(130,e==null?e:typeof e,""))}return t=Fr(u,n,t,s),t.elementType=e,t.type=r,t.lanes=a,t}function Do(e,t,n,r){return e=Fr(7,e,r,t),e.lanes=n,e}function mh(e,t,n,r){return e=Fr(22,e,r,t),e.elementType=R_,e.lanes=n,e.stateNode={isHidden:!1},e}function Ap(e,t,n){return e=Fr(6,e,null,t),e.lanes=n,e}function Lp(e,t,n){return t=Fr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function iR(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=pp(0),this.expirationTimes=pp(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=pp(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function $m(e,t,n,r,s,a,u,h,p){return e=new iR(e,t,n,h,p),t===1?(t=1,a===!0&&(t|=8)):t=0,a=Fr(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Om(a),e}function sR(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(kx)}catch(e){console.error(e)}}kx(),M_.exports=_r;var fR=M_.exports;const cR=gu(fR);function I0(e,t){return I0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},I0(e,t)}function Ti(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,I0(e,t)}var Ox={exports:{}},hR="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",dR=hR,pR=dR;function Ex(){}function Tx(){}Tx.resetWarningCache=Ex;var mR=function(){function e(r,s,a,u,h,p){if(p!==pR){var g=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw g.name="Invariant Violation",g}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Tx,resetWarningCache:Ex};return n.PropTypes=n,n};Ox.exports=mR();var gR=Ox.exports;const W1=gu(gR);function zn(){return zn=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0;v--){var O=r[v];O==="."?jp(r,v):O===".."?(jp(r,v),g++):g&&(jp(r,v),g--)}if(!u)for(;g--;g)r.unshift("..");u&&r[0]!==""&&(!r[0]||!Zf(r[0]))&&r.unshift("");var b=r.join("/");return h&&b.substr(-1)!=="/"&&(b+="/"),b}var yR="Invariant failed";function zo(e,t){if(!e)throw new Error(yR)}function Hl(e){return e.charAt(0)==="/"?e:"/"+e}function B1(e){return e.charAt(0)==="/"?e.substr(1):e}function _R(e,t){return e.toLowerCase().indexOf(t.toLowerCase())===0&&"/?#".indexOf(e.charAt(t.length))!==-1}function Px(e,t){return _R(e,t)?e.substr(t.length):e}function Rx(e){return e.charAt(e.length-1)==="/"?e.slice(0,-1):e}function wR(e){var t=e||"/",n="",r="",s=t.indexOf("#");s!==-1&&(r=t.substr(s),t=t.substr(0,s));var a=t.indexOf("?");return a!==-1&&(n=t.substr(a),t=t.substr(0,a)),{pathname:t,search:n==="?"?"":n,hash:r==="#"?"":r}}function Jn(e){var t=e.pathname,n=e.search,r=e.hash,s=t||"/";return n&&n!=="?"&&(s+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(s+=r.charAt(0)==="#"?r:"#"+r),s}function gr(e,t,n,r){var s;typeof e=="string"?(s=wR(e),s.state=t):(s=zn({},e),s.pathname===void 0&&(s.pathname=""),s.search?s.search.charAt(0)!=="?"&&(s.search="?"+s.search):s.search="",s.hash?s.hash.charAt(0)!=="#"&&(s.hash="#"+s.hash):s.hash="",t!==void 0&&s.state===void 0&&(s.state=t));try{s.pathname=decodeURI(s.pathname)}catch(a){throw a instanceof URIError?new URIError('Pathname "'+s.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):a}return n&&(s.key=n),r?s.pathname?s.pathname.charAt(0)!=="/"&&(s.pathname=vR(s.pathname,r.pathname)):s.pathname=r.pathname:s.pathname||(s.pathname="/"),s}function Vm(){var e=null;function t(u){return e=u,function(){e===u&&(e=null)}}function n(u,h,p,g){if(e!=null){var v=typeof e=="function"?e(u,h):e;typeof v=="string"?typeof p=="function"?p(v,g):g(!0):g(v!==!1)}else g(!0)}var r=[];function s(u){var h=!0;function p(){h&&u.apply(void 0,arguments)}return r.push(p),function(){h=!1,r=r.filter(function(g){return g!==p})}}function a(){for(var u=arguments.length,h=new Array(u),p=0;pS?k.splice(S,k.length-S,P):k.push(P),v({action:fe,location:P,index:S,entries:k})}})}function me(J,le){var fe="REPLACE",P=gr(J,le,O(),V.location);g.confirmTransitionTo(P,fe,n,function(f){f&&(V.entries[V.index]=P,v({action:fe,location:P}))})}function N(J){var le=G1(V.index+J,0,V.entries.length-1),fe="POP",P=V.entries[le];g.confirmTransitionTo(P,fe,n,function(f){f?v({action:fe,location:P,index:le}):v()})}function A(){N(-1)}function I(){N(1)}function Y(J){var le=V.index+J;return le>=0&&le=0)&&(n[s]=e[s]);return n}var Ux=XR,JR={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},eb={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Wx={};Wx[Ux.ForwardRef]=JR;Wx[Ux.Memo]=eb;var Bx=function(t){var n=jR();return n.displayName=t,n},tb=Bx("Router-History"),Va=Bx("Router"),bh=function(e){Ti(t,e),t.computeRootMatch=function(s){return{path:"/",url:"/",params:{},isExact:s==="/"}};function t(r){var s;return s=e.call(this,r)||this,s.state={location:r.history.location},s._isMounted=!1,s._pendingLocation=null,r.staticContext||(s.unlisten=r.history.listen(function(a){s._pendingLocation=a})),s}var n=t.prototype;return n.componentDidMount=function(){var s=this;this._isMounted=!0,this.unlisten&&this.unlisten(),this.props.staticContext||(this.unlisten=this.props.history.listen(function(a){s._isMounted&&s.setState({location:a})})),this._pendingLocation&&this.setState({location:this._pendingLocation})},n.componentWillUnmount=function(){this.unlisten&&(this.unlisten(),this._isMounted=!1,this._pendingLocation=null)},n.render=function(){return qe.createElement(Va.Provider,{value:{history:this.props.history,location:this.state.location,match:t.computeRootMatch(this.state.location.pathname),staticContext:this.props.staticContext}},qe.createElement(tb.Provider,{children:this.props.children||null,value:this.props.history}))},t}(qe.Component);qe.Component;qe.Component;var q1={},nb=1e4,Q1=0;function rb(e,t){var n=""+t.end+t.strict+t.sensitive,r=q1[n]||(q1[n]={});if(r[e])return r[e];var s=[],a=GR(e,s,t),u={regexp:a,keys:s};return Q1"u"&&(qa=ng);function ub(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var fb=qa(function(e,t){var n=e.innerRef,r=e.navigate,s=e.onClick,a=Rh(e,["innerRef","navigate","onClick"]),u=a.target,h=zn({},a,{onClick:function(g){try{s&&s(g)}catch(v){throw g.preventDefault(),v}!g.defaultPrevented&&g.button===0&&(!u||u==="_self")&&!ub(g)&&(g.preventDefault(),r())}});return ng!==qa?h.ref=t||n:h.ref=n,qe.createElement("a",h)}),rg=qa(function(e,t){var n=e.component,r=n===void 0?fb:n,s=e.replace,a=e.to,u=e.innerRef,h=Rh(e,["component","replace","to","innerRef"]);return qe.createElement(Va.Consumer,null,function(p){p||zo(!1);var g=p.history,v=U0(F0(a,p.location),p.location),O=v?g.createHref(v):"",b=zn({},h,{href:O,navigate:function(){var z=F0(a,p.location),K=Jn(p.location)===Jn(U0(z)),me=s||K?g.replace:g.push;me(z)}});return ng!==qa?b.ref=t||u:b.innerRef=u,qe.createElement(r,b)})}),zx=function(t){return t},Hc=qe.forwardRef;typeof Hc>"u"&&(Hc=zx);function cb(){for(var e=arguments.length,t=new Array(e),n=0;n + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */Gc.exports;(function(e,t){(function(){var n,r="4.17.21",s=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",u="Expected a function",h="Invalid `variable` option passed into `_.template`",p="__lodash_hash_undefined__",g=500,v="__lodash_placeholder__",O=1,b=2,F=4,z=1,K=2,me=1,N=2,A=4,I=8,Y=16,X=32,te=64,V=128,J=256,le=512,fe=30,P="...",f=800,m=16,S=1,k=2,T=3,L=1/0,R=9007199254740991,w=17976931348623157e292,c=NaN,M=4294967295,G=M-1,se=M>>>1,ae=[["ary",V],["bind",me],["bindKey",N],["curry",I],["curryRight",Y],["flip",le],["partial",X],["partialRight",te],["rearg",J]],re="[object Arguments]",ye="[object Array]",Me="[object AsyncFunction]",ze="[object Boolean]",be="[object Date]",Ze="[object DOMException]",li="[object Error]",Xe="[object Function]",gt="[object GeneratorFunction]",_n="[object Map]",nt="[object Number]",Lt="[object Null]",Gn="[object Object]",Ct="[object Promise]",jt="[object Proxy]",ui="[object RegExp]",Ue="[object Set]",rt="[object String]",Di="[object Symbol]",Nt="[object Undefined]",it="[object WeakMap]",Yo="[object WeakSet]",He="[object ArrayBuffer]",Ge="[object DataView]",Ai="[object Float32Array]",Ne="[object Float64Array]",lt="[object Int8Array]",Li="[object Int16Array]",vt="[object Int32Array]",ut="[object Uint8Array]",Yr="[object Uint8ClampedArray]",ft="[object Uint16Array]",ct="[object Uint32Array]",Ho=/\b__p \+= '';/g,Qe=/\b(__p \+=) '' \+/g,kt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ks=/&(?:amp|lt|gt|quot|#39);/g,Ot=/[&<>"']/g,yt=RegExp(Ks.source),fi=RegExp(Ot.source),_t=/<%-([\s\S]+?)%>/g,wt=/<%([\s\S]+?)%>/g,ji=/<%=([\s\S]+?)%>/g,st=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,It=/^\w*$/,Go=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,xt=/[\\^$.*+?()[\]{}|]/g,Ft=RegExp(xt.source),cs=/^\s+/,Et=/\s/,St=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Cr=/\{\n\/\* \[wrapped with (.+)\] \*/,Ut=/,? & /,Wt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Vo=/[()=,{}\[\]\/\s]/,Bt=/\\(\\)?/g,zt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Cn=/\w*$/,Zs=/^[-+]0x[0-9a-f]+$/i,Xs=/^0b[01]+$/i,Js=/^\[object .+?Constructor\]$/,eo=/^0o[0-7]+$/i,to=/^(?:0|[1-9]\d*)$/,or=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ci=/($^)/,no=/['\n\r\u2028\u2029\\]/g,hi="\\ud800-\\udfff",ro="\\u0300-\\u036f",io="\\ufe20-\\ufe2f",di="\\u20d0-\\u20ff",hs=ro+io+di,ds="\\u2700-\\u27bf",jn="a-z\\xdf-\\xf6\\xf8-\\xff",so="\\xac\\xb1\\xd7\\xf7",oo="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",ao="\\u2000-\\u206f",Jh=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",bu="A-Z\\xc0-\\xd6\\xd8-\\xde",Du="\\ufe0e\\ufe0f",lo=so+oo+ao+Jh,nl="['’]",uo="["+hi+"]",rl="["+lo+"]",fo="["+hs+"]",Au="\\d+",ed="["+ds+"]",Lu="["+jn+"]",ju="[^"+hi+lo+Au+ds+jn+bu+"]",qo="\\ud83c[\\udffb-\\udfff]",td="(?:"+fo+"|"+qo+")",Nu="[^"+hi+"]",Qo="(?:\\ud83c[\\udde6-\\uddff]){2}",ps="[\\ud800-\\udbff][\\udc00-\\udfff]",ar="["+bu+"]",Iu="\\u200d",Fu="(?:"+Lu+"|"+ju+")",pi="(?:"+ar+"|"+ju+")",Uu="(?:"+nl+"(?:d|ll|m|re|s|t|ve))?",Wu="(?:"+nl+"(?:D|LL|M|RE|S|T|VE))?",Bu=td+"?",zu="["+Du+"]?",nd="(?:"+Iu+"(?:"+[Nu,Qo,ps].join("|")+")"+zu+Bu+")*",Ni="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",$u="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Yu=zu+Bu+nd,Ko="(?:"+[ed,Qo,ps].join("|")+")"+Yu,rd="(?:"+[Nu+fo+"?",fo,Qo,ps,uo].join("|")+")",il=RegExp(nl,"g"),id=RegExp(fo,"g"),Zo=RegExp(qo+"(?="+qo+")|"+rd+Yu,"g"),Hu=RegExp([ar+"?"+Lu+"+"+Uu+"(?="+[rl,ar,"$"].join("|")+")",pi+"+"+Wu+"(?="+[rl,ar+Fu,"$"].join("|")+")",ar+"?"+Fu+"+"+Uu,ar+"+"+Wu,$u,Ni,Au,Ko].join("|"),"g"),Gu=RegExp("["+Iu+hi+hs+Du+"]"),co=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Vu=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],sd=-1,ht={};ht[Ai]=ht[Ne]=ht[lt]=ht[Li]=ht[vt]=ht[ut]=ht[Yr]=ht[ft]=ht[ct]=!0,ht[re]=ht[ye]=ht[He]=ht[ze]=ht[Ge]=ht[be]=ht[li]=ht[Xe]=ht[_n]=ht[nt]=ht[Gn]=ht[ui]=ht[Ue]=ht[rt]=ht[it]=!1;var ot={};ot[re]=ot[ye]=ot[He]=ot[Ge]=ot[ze]=ot[be]=ot[Ai]=ot[Ne]=ot[lt]=ot[Li]=ot[vt]=ot[_n]=ot[nt]=ot[Gn]=ot[ui]=ot[Ue]=ot[rt]=ot[Di]=ot[ut]=ot[Yr]=ot[ft]=ot[ct]=!0,ot[li]=ot[Xe]=ot[it]=!1;var E={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},W={"&":"&","<":"<",">":">",'"':""","'":"'"},Z={"&":"&","<":"<",">":">",""":'"',"'":"'"},he={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},dt=parseFloat,ke=parseInt,Tt=typeof Ir=="object"&&Ir&&Ir.Object===Object&&Ir,sn=typeof self=="object"&&self&&self.Object===Object&&self,Ie=Tt||sn||Function("return this")(),pt=t&&!t.nodeType&&t,Jt=pt&&!0&&e&&!e.nodeType&&e,Vn=Jt&&Jt.exports===pt,on=Vn&&Tt.process,Pt=function(){try{var U=Jt&&Jt.require&&Jt.require("util").types;return U||on&&on.binding&&on.binding("util")}catch{}}(),Nn=Pt&&Pt.isArrayBuffer,Hr=Pt&&Pt.isDate,kr=Pt&&Pt.isMap,mi=Pt&&Pt.isRegExp,sl=Pt&&Pt.isSet,ho=Pt&&Pt.isTypedArray;function pn(U,H,$){switch($.length){case 0:return U.call(H);case 1:return U.call(H,$[0]);case 2:return U.call(H,$[0],$[1]);case 3:return U.call(H,$[0],$[1],$[2])}return U.apply(H,$)}function aM(U,H,$,de){for(var Ce=-1,Ve=U==null?0:U.length;++Ce-1}function od(U,H,$){for(var de=-1,Ce=U==null?0:U.length;++de-1;);return $}function Wg(U,H){for(var $=U.length;$--&&Xo(H,U[$],0)>-1;);return $}function gM(U,H){for(var $=U.length,de=0;$--;)U[$]===H&&++de;return de}var vM=fd(E),yM=fd(W);function _M(U){return"\\"+he[U]}function wM(U,H){return U==null?n:U[H]}function Jo(U){return Gu.test(U)}function xM(U){return co.test(U)}function SM(U){for(var H,$=[];!(H=U.next()).done;)$.push(H.value);return $}function pd(U){var H=-1,$=Array(U.size);return U.forEach(function(de,Ce){$[++H]=[Ce,de]}),$}function Bg(U,H){return function($){return U(H($))}}function vs(U,H){for(var $=-1,de=U.length,Ce=0,Ve=[];++$-1}function u2(i,o){var l=this.__data__,d=hf(l,i);return d<0?(++this.size,l.push([i,o])):l[d][1]=o,this}Ii.prototype.clear=s2,Ii.prototype.delete=o2,Ii.prototype.get=a2,Ii.prototype.has=l2,Ii.prototype.set=u2;function Fi(i){var o=-1,l=i==null?0:i.length;for(this.clear();++o=o?i:o)),i}function Pr(i,o,l,d,_,C){var D,j=o&O,B=o&b,q=o&F;if(l&&(D=_?l(i,d,_,C):l(i)),D!==n)return D;if(!Vt(i))return i;var Q=Oe(i);if(Q){if(D=dC(i),!j)return qn(i,D)}else{var ee=On(i),ue=ee==Xe||ee==gt;if(Ms(i))return Mv(i,j);if(ee==Gn||ee==re||ue&&!_){if(D=B||ue?{}:zv(i),!j)return B?nC(i,k2(D,i)):tC(i,Jg(D,i))}else{if(!ot[ee])return _?i:{};D=pC(i,ee,j)}}C||(C=new Vr);var ve=C.get(i);if(ve)return ve;C.set(i,D),vy(i)?i.forEach(function(Se){D.add(Pr(Se,o,l,Se,i,C))}):my(i)&&i.forEach(function(Se,Ae){D.set(Ae,Pr(Se,o,l,Ae,i,C))});var xe=q?B?Wd:Ud:B?Kn:mn,Pe=Q?n:xe(i);return Or(Pe||i,function(Se,Ae){Pe&&(Ae=Se,Se=i[Ae]),hl(D,Ae,Pr(Se,o,l,Ae,i,C))}),D}function O2(i){var o=mn(i);return function(l){return ev(l,i,o)}}function ev(i,o,l){var d=l.length;if(i==null)return!d;for(i=mt(i);d--;){var _=l[d],C=o[_],D=i[_];if(D===n&&!(_ in i)||!C(D))return!1}return!0}function tv(i,o,l){if(typeof i!="function")throw new Er(u);return _l(function(){i.apply(n,l)},o)}function dl(i,o,l,d){var _=-1,C=qu,D=!0,j=i.length,B=[],q=o.length;if(!j)return B;l&&(o=$t(o,lr(l))),d?(C=od,D=!1):o.length>=s&&(C=ol,D=!1,o=new go(o));e:for(;++__?0:_+l),d=d===n||d>_?_:Ee(d),d<0&&(d+=_),d=l>d?0:_y(d);l0&&l(j)?o>1?wn(j,o-1,l,d,_):gs(_,j):d||(_[_.length]=j)}return _}var xd=Pv(),iv=Pv(!0);function gi(i,o){return i&&xd(i,o,mn)}function Sd(i,o){return i&&iv(i,o,mn)}function pf(i,o){return ms(o,function(l){return $i(i[l])})}function yo(i,o){o=xs(o,i);for(var l=0,d=o.length;i!=null&&lo}function P2(i,o){return i!=null&&Je.call(i,o)}function R2(i,o){return i!=null&&o in mt(i)}function b2(i,o,l){return i>=kn(o,l)&&i=120&&Q.length>=120)?new go(D&&Q):n}Q=i[0];var ee=-1,ue=j[0];e:for(;++ee<_&&q.length-1;)j!==i&&sf.call(j,B,1),sf.call(i,B,1);return i}function mv(i,o){for(var l=i?o.length:0,d=l-1;l--;){var _=o[l];if(l==d||_!==C){var C=_;zi(_)?sf.call(i,_,1):Dd(i,_)}}return i}function Pd(i,o){return i+lf(Qg()*(o-i+1))}function Y2(i,o,l,d){for(var _=-1,C=fn(af((o-i)/(l||1)),0),D=$(C);C--;)D[d?C:++_]=i,i+=l;return D}function Rd(i,o){var l="";if(!i||o<1||o>R)return l;do o%2&&(l+=i),o=lf(o/2),o&&(i+=i);while(o);return l}function Re(i,o){return Vd(Hv(i,o,Zn),i+"")}function H2(i){return Xg(fa(i))}function G2(i,o){var l=fa(i);return kf(l,vo(o,0,l.length))}function gl(i,o,l,d){if(!Vt(i))return i;o=xs(o,i);for(var _=-1,C=o.length,D=C-1,j=i;j!=null&&++__?0:_+o),l=l>_?_:l,l<0&&(l+=_),_=o>l?0:l-o>>>0,o>>>=0;for(var C=$(_);++d<_;)C[d]=i[d+o];return C}function Q2(i,o){var l;return _s(i,function(d,_,C){return l=o(d,_,C),!l}),!!l}function gf(i,o,l){var d=0,_=i==null?d:i.length;if(typeof o=="number"&&o===o&&_<=se){for(;d<_;){var C=d+_>>>1,D=i[C];D!==null&&!fr(D)&&(l?D<=o:D=s){var q=o?null:oC(i);if(q)return Ku(q);D=!1,_=ol,B=new go}else B=o?[]:j;e:for(;++d=d?i:Rr(i,o,l)}var Sv=IM||function(i){return Ie.clearTimeout(i)};function Mv(i,o){if(o)return i.slice();var l=i.length,d=Yg?Yg(l):new i.constructor(l);return i.copy(d),d}function Nd(i){var o=new i.constructor(i.byteLength);return new nf(o).set(new nf(i)),o}function Z2(i,o){var l=o?Nd(i.buffer):i.buffer;return new i.constructor(l,i.byteOffset,i.byteLength)}function X2(i){var o=new i.constructor(i.source,Cn.exec(i));return o.lastIndex=i.lastIndex,o}function J2(i){return cl?mt(cl.call(i)):{}}function Cv(i,o){var l=o?Nd(i.buffer):i.buffer;return new i.constructor(l,i.byteOffset,i.length)}function kv(i,o){if(i!==o){var l=i!==n,d=i===null,_=i===i,C=fr(i),D=o!==n,j=o===null,B=o===o,q=fr(o);if(!j&&!q&&!C&&i>o||C&&D&&B&&!j&&!q||d&&D&&B||!l&&B||!_)return 1;if(!d&&!C&&!q&&i=j)return B;var q=l[d];return B*(q=="desc"?-1:1)}}return i.index-o.index}function Ov(i,o,l,d){for(var _=-1,C=i.length,D=l.length,j=-1,B=o.length,q=fn(C-D,0),Q=$(B+q),ee=!d;++j1?l[_-1]:n,D=_>2?l[2]:n;for(C=i.length>3&&typeof C=="function"?(_--,C):n,D&&Fn(l[0],l[1],D)&&(C=_<3?n:C,_=1),o=mt(o);++d<_;){var j=l[d];j&&i(o,j,d,C)}return o})}function Tv(i,o){return function(l,d){if(l==null)return l;if(!Qn(l))return i(l,d);for(var _=l.length,C=o?_:-1,D=mt(l);(o?C--:++C<_)&&d(D[C],C,D)!==!1;);return l}}function Pv(i){return function(o,l,d){for(var _=-1,C=mt(o),D=d(o),j=D.length;j--;){var B=D[i?j:++_];if(l(C[B],B,C)===!1)break}return o}}function rC(i,o,l){var d=o&me,_=vl(i);function C(){var D=this&&this!==Ie&&this instanceof C?_:i;return D.apply(d?l:this,arguments)}return C}function Rv(i){return function(o){o=Ke(o);var l=Jo(o)?Gr(o):n,d=l?l[0]:o.charAt(0),_=l?Ss(l,1).join(""):o.slice(1);return d[i]()+_}}function aa(i){return function(o){return ad(Ty(Ey(o).replace(il,"")),i,"")}}function vl(i){return function(){var o=arguments;switch(o.length){case 0:return new i;case 1:return new i(o[0]);case 2:return new i(o[0],o[1]);case 3:return new i(o[0],o[1],o[2]);case 4:return new i(o[0],o[1],o[2],o[3]);case 5:return new i(o[0],o[1],o[2],o[3],o[4]);case 6:return new i(o[0],o[1],o[2],o[3],o[4],o[5]);case 7:return new i(o[0],o[1],o[2],o[3],o[4],o[5],o[6])}var l=sa(i.prototype),d=i.apply(l,o);return Vt(d)?d:l}}function iC(i,o,l){var d=vl(i);function _(){for(var C=arguments.length,D=$(C),j=C,B=la(_);j--;)D[j]=arguments[j];var q=C<3&&D[0]!==B&&D[C-1]!==B?[]:vs(D,B);if(C-=q.length,C-1?_[C?o[D]:D]:n}}function Dv(i){return Bi(function(o){var l=o.length,d=l,_=Tr.prototype.thru;for(i&&o.reverse();d--;){var C=o[d];if(typeof C!="function")throw new Er(u);if(_&&!D&&Mf(C)=="wrapper")var D=new Tr([],!0)}for(d=D?d:l;++d1&&Fe.reverse(),Q&&Bj))return!1;var q=C.get(i),Q=C.get(o);if(q&&Q)return q==o&&Q==i;var ee=-1,ue=!0,ve=l&K?new go:n;for(C.set(i,o),C.set(o,i);++ee1?"& ":"")+o[d],o=o.join(l>2?", ":" "),i.replace(St,`{ +/* [wrapped with `+o+`] */ +`)}function gC(i){return Oe(i)||xo(i)||!!(Vg&&i&&i[Vg])}function zi(i,o){var l=typeof i;return o=o??R,!!o&&(l=="number"||l!="symbol"&&to.test(i))&&i>-1&&i%1==0&&i0){if(++o>=f)return arguments[0]}else o=0;return i.apply(n,arguments)}}function kf(i,o){var l=-1,d=i.length,_=d-1;for(o=o===n?d:o;++l1?i[o-1]:n;return l=typeof l=="function"?(i.pop(),l):n,ry(i,l)});function iy(i){var o=x(i);return o.__chain__=!0,o}function Ek(i,o){return o(i),i}function Of(i,o){return o(i)}var Tk=Bi(function(i){var o=i.length,l=o?i[0]:0,d=this.__wrapped__,_=function(C){return wd(C,i)};return o>1||this.__actions__.length||!(d instanceof Le)||!zi(l)?this.thru(_):(d=d.slice(l,+l+(o?1:0)),d.__actions__.push({func:Of,args:[_],thisArg:n}),new Tr(d,this.__chain__).thru(function(C){return o&&!C.length&&C.push(n),C}))});function Pk(){return iy(this)}function Rk(){return new Tr(this.value(),this.__chain__)}function bk(){this.__values__===n&&(this.__values__=yy(this.value()));var i=this.__index__>=this.__values__.length,o=i?n:this.__values__[this.__index__++];return{done:i,value:o}}function Dk(){return this}function Ak(i){for(var o,l=this;l instanceof cf;){var d=Zv(l);d.__index__=0,d.__values__=n,o?_.__wrapped__=d:o=d;var _=d;l=l.__wrapped__}return _.__wrapped__=i,o}function Lk(){var i=this.__wrapped__;if(i instanceof Le){var o=i;return this.__actions__.length&&(o=new Le(this)),o=o.reverse(),o.__actions__.push({func:Of,args:[qd],thisArg:n}),new Tr(o,this.__chain__)}return this.thru(qd)}function jk(){return wv(this.__wrapped__,this.__actions__)}var Nk=yf(function(i,o,l){Je.call(i,l)?++i[l]:Ui(i,l,1)});function Ik(i,o,l){var d=Oe(i)?Ag:E2;return l&&Fn(i,o,l)&&(o=n),d(i,we(o,3))}function Fk(i,o){var l=Oe(i)?ms:rv;return l(i,we(o,3))}var Uk=bv(Xv),Wk=bv(Jv);function Bk(i,o){return wn(Ef(i,o),1)}function zk(i,o){return wn(Ef(i,o),L)}function $k(i,o,l){return l=l===n?1:Ee(l),wn(Ef(i,o),l)}function sy(i,o){var l=Oe(i)?Or:_s;return l(i,we(o,3))}function oy(i,o){var l=Oe(i)?lM:nv;return l(i,we(o,3))}var Yk=yf(function(i,o,l){Je.call(i,l)?i[l].push(o):Ui(i,l,[o])});function Hk(i,o,l,d){i=Qn(i)?i:fa(i),l=l&&!d?Ee(l):0;var _=i.length;return l<0&&(l=fn(_+l,0)),Df(i)?l<=_&&i.indexOf(o,l)>-1:!!_&&Xo(i,o,l)>-1}var Gk=Re(function(i,o,l){var d=-1,_=typeof o=="function",C=Qn(i)?$(i.length):[];return _s(i,function(D){C[++d]=_?pn(o,D,l):pl(D,o,l)}),C}),Vk=yf(function(i,o,l){Ui(i,l,o)});function Ef(i,o){var l=Oe(i)?$t:uv;return l(i,we(o,3))}function qk(i,o,l,d){return i==null?[]:(Oe(o)||(o=o==null?[]:[o]),l=d?n:l,Oe(l)||(l=l==null?[]:[l]),dv(i,o,l))}var Qk=yf(function(i,o,l){i[l?0:1].push(o)},function(){return[[],[]]});function Kk(i,o,l){var d=Oe(i)?ad:Ig,_=arguments.length<3;return d(i,we(o,4),l,_,_s)}function Zk(i,o,l){var d=Oe(i)?uM:Ig,_=arguments.length<3;return d(i,we(o,4),l,_,nv)}function Xk(i,o){var l=Oe(i)?ms:rv;return l(i,Rf(we(o,3)))}function Jk(i){var o=Oe(i)?Xg:H2;return o(i)}function eO(i,o,l){(l?Fn(i,o,l):o===n)?o=1:o=Ee(o);var d=Oe(i)?S2:G2;return d(i,o)}function tO(i){var o=Oe(i)?M2:q2;return o(i)}function nO(i){if(i==null)return 0;if(Qn(i))return Df(i)?ea(i):i.length;var o=On(i);return o==_n||o==Ue?i.size:Od(i).length}function rO(i,o,l){var d=Oe(i)?ld:Q2;return l&&Fn(i,o,l)&&(o=n),d(i,we(o,3))}var iO=Re(function(i,o){if(i==null)return[];var l=o.length;return l>1&&Fn(i,o[0],o[1])?o=[]:l>2&&Fn(o[0],o[1],o[2])&&(o=[o[0]]),dv(i,wn(o,1),[])}),Tf=FM||function(){return Ie.Date.now()};function sO(i,o){if(typeof o!="function")throw new Er(u);return i=Ee(i),function(){if(--i<1)return o.apply(this,arguments)}}function ay(i,o,l){return o=l?n:o,o=i&&o==null?i.length:o,Wi(i,V,n,n,n,n,o)}function ly(i,o){var l;if(typeof o!="function")throw new Er(u);return i=Ee(i),function(){return--i>0&&(l=o.apply(this,arguments)),i<=1&&(o=n),l}}var Kd=Re(function(i,o,l){var d=me;if(l.length){var _=vs(l,la(Kd));d|=X}return Wi(i,d,o,l,_)}),uy=Re(function(i,o,l){var d=me|N;if(l.length){var _=vs(l,la(uy));d|=X}return Wi(o,d,i,l,_)});function fy(i,o,l){o=l?n:o;var d=Wi(i,I,n,n,n,n,n,o);return d.placeholder=fy.placeholder,d}function cy(i,o,l){o=l?n:o;var d=Wi(i,Y,n,n,n,n,n,o);return d.placeholder=cy.placeholder,d}function hy(i,o,l){var d,_,C,D,j,B,q=0,Q=!1,ee=!1,ue=!0;if(typeof i!="function")throw new Er(u);o=Dr(o)||0,Vt(l)&&(Q=!!l.leading,ee="maxWait"in l,C=ee?fn(Dr(l.maxWait)||0,o):C,ue="trailing"in l?!!l.trailing:ue);function ve(tn){var Qr=d,Hi=_;return d=_=n,q=tn,D=i.apply(Hi,Qr),D}function xe(tn){return q=tn,j=_l(Ae,o),Q?ve(tn):D}function Pe(tn){var Qr=tn-B,Hi=tn-q,by=o-Qr;return ee?kn(by,C-Hi):by}function Se(tn){var Qr=tn-B,Hi=tn-q;return B===n||Qr>=o||Qr<0||ee&&Hi>=C}function Ae(){var tn=Tf();if(Se(tn))return Fe(tn);j=_l(Ae,Pe(tn))}function Fe(tn){return j=n,ue&&d?ve(tn):(d=_=n,D)}function cr(){j!==n&&Sv(j),q=0,d=B=_=j=n}function Un(){return j===n?D:Fe(Tf())}function hr(){var tn=Tf(),Qr=Se(tn);if(d=arguments,_=this,B=tn,Qr){if(j===n)return xe(B);if(ee)return Sv(j),j=_l(Ae,o),ve(B)}return j===n&&(j=_l(Ae,o)),D}return hr.cancel=cr,hr.flush=Un,hr}var oO=Re(function(i,o){return tv(i,1,o)}),aO=Re(function(i,o,l){return tv(i,Dr(o)||0,l)});function lO(i){return Wi(i,le)}function Pf(i,o){if(typeof i!="function"||o!=null&&typeof o!="function")throw new Er(u);var l=function(){var d=arguments,_=o?o.apply(this,d):d[0],C=l.cache;if(C.has(_))return C.get(_);var D=i.apply(this,d);return l.cache=C.set(_,D)||C,D};return l.cache=new(Pf.Cache||Fi),l}Pf.Cache=Fi;function Rf(i){if(typeof i!="function")throw new Er(u);return function(){var o=arguments;switch(o.length){case 0:return!i.call(this);case 1:return!i.call(this,o[0]);case 2:return!i.call(this,o[0],o[1]);case 3:return!i.call(this,o[0],o[1],o[2])}return!i.apply(this,o)}}function uO(i){return ly(2,i)}var fO=K2(function(i,o){o=o.length==1&&Oe(o[0])?$t(o[0],lr(we())):$t(wn(o,1),lr(we()));var l=o.length;return Re(function(d){for(var _=-1,C=kn(d.length,l);++_=o}),xo=ov(function(){return arguments}())?ov:function(i){return Zt(i)&&Je.call(i,"callee")&&!Gg.call(i,"callee")},Oe=$.isArray,kO=Nn?lr(Nn):A2;function Qn(i){return i!=null&&bf(i.length)&&!$i(i)}function en(i){return Zt(i)&&Qn(i)}function OO(i){return i===!0||i===!1||Zt(i)&&In(i)==ze}var Ms=WM||lp,EO=Hr?lr(Hr):L2;function TO(i){return Zt(i)&&i.nodeType===1&&!wl(i)}function PO(i){if(i==null)return!0;if(Qn(i)&&(Oe(i)||typeof i=="string"||typeof i.splice=="function"||Ms(i)||ua(i)||xo(i)))return!i.length;var o=On(i);if(o==_n||o==Ue)return!i.size;if(yl(i))return!Od(i).length;for(var l in i)if(Je.call(i,l))return!1;return!0}function RO(i,o){return ml(i,o)}function bO(i,o,l){l=typeof l=="function"?l:n;var d=l?l(i,o):n;return d===n?ml(i,o,n,l):!!d}function Xd(i){if(!Zt(i))return!1;var o=In(i);return o==li||o==Ze||typeof i.message=="string"&&typeof i.name=="string"&&!wl(i)}function DO(i){return typeof i=="number"&&qg(i)}function $i(i){if(!Vt(i))return!1;var o=In(i);return o==Xe||o==gt||o==Me||o==jt}function py(i){return typeof i=="number"&&i==Ee(i)}function bf(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=R}function Vt(i){var o=typeof i;return i!=null&&(o=="object"||o=="function")}function Zt(i){return i!=null&&typeof i=="object"}var my=kr?lr(kr):N2;function AO(i,o){return i===o||kd(i,o,zd(o))}function LO(i,o,l){return l=typeof l=="function"?l:n,kd(i,o,zd(o),l)}function jO(i){return gy(i)&&i!=+i}function NO(i){if(_C(i))throw new Ce(a);return av(i)}function IO(i){return i===null}function FO(i){return i==null}function gy(i){return typeof i=="number"||Zt(i)&&In(i)==nt}function wl(i){if(!Zt(i)||In(i)!=Gn)return!1;var o=rf(i);if(o===null)return!0;var l=Je.call(o,"constructor")&&o.constructor;return typeof l=="function"&&l instanceof l&&Ju.call(l)==LM}var Jd=mi?lr(mi):I2;function UO(i){return py(i)&&i>=-R&&i<=R}var vy=sl?lr(sl):F2;function Df(i){return typeof i=="string"||!Oe(i)&&Zt(i)&&In(i)==rt}function fr(i){return typeof i=="symbol"||Zt(i)&&In(i)==Di}var ua=ho?lr(ho):U2;function WO(i){return i===n}function BO(i){return Zt(i)&&On(i)==it}function zO(i){return Zt(i)&&In(i)==Yo}var $O=Sf(Ed),YO=Sf(function(i,o){return i<=o});function yy(i){if(!i)return[];if(Qn(i))return Df(i)?Gr(i):qn(i);if(al&&i[al])return SM(i[al]());var o=On(i),l=o==_n?pd:o==Ue?Ku:fa;return l(i)}function Yi(i){if(!i)return i===0?i:0;if(i=Dr(i),i===L||i===-L){var o=i<0?-1:1;return o*w}return i===i?i:0}function Ee(i){var o=Yi(i),l=o%1;return o===o?l?o-l:o:0}function _y(i){return i?vo(Ee(i),0,M):0}function Dr(i){if(typeof i=="number")return i;if(fr(i))return c;if(Vt(i)){var o=typeof i.valueOf=="function"?i.valueOf():i;i=Vt(o)?o+"":o}if(typeof i!="string")return i===0?i:+i;i=Fg(i);var l=Xs.test(i);return l||eo.test(i)?ke(i.slice(2),l?2:8):Zs.test(i)?c:+i}function wy(i){return vi(i,Kn(i))}function HO(i){return i?vo(Ee(i),-R,R):i===0?i:0}function Ke(i){return i==null?"":ur(i)}var GO=oa(function(i,o){if(yl(o)||Qn(o)){vi(o,mn(o),i);return}for(var l in o)Je.call(o,l)&&hl(i,l,o[l])}),xy=oa(function(i,o){vi(o,Kn(o),i)}),Af=oa(function(i,o,l,d){vi(o,Kn(o),i,d)}),VO=oa(function(i,o,l,d){vi(o,mn(o),i,d)}),qO=Bi(wd);function QO(i,o){var l=sa(i);return o==null?l:Jg(l,o)}var KO=Re(function(i,o){i=mt(i);var l=-1,d=o.length,_=d>2?o[2]:n;for(_&&Fn(o[0],o[1],_)&&(d=1);++l1),C}),vi(i,Wd(i),l),d&&(l=Pr(l,O|b|F,aC));for(var _=o.length;_--;)Dd(l,o[_]);return l});function pE(i,o){return My(i,Rf(we(o)))}var mE=Bi(function(i,o){return i==null?{}:z2(i,o)});function My(i,o){if(i==null)return{};var l=$t(Wd(i),function(d){return[d]});return o=we(o),pv(i,l,function(d,_){return o(d,_[0])})}function gE(i,o,l){o=xs(o,i);var d=-1,_=o.length;for(_||(_=1,i=n);++d<_;){var C=i==null?n:i[yi(o[d])];C===n&&(d=_,C=l),i=$i(C)?C.call(i):C}return i}function vE(i,o,l){return i==null?i:gl(i,o,l)}function yE(i,o,l,d){return d=typeof d=="function"?d:n,i==null?i:gl(i,o,l,d)}var Cy=Nv(mn),ky=Nv(Kn);function _E(i,o,l){var d=Oe(i),_=d||Ms(i)||ua(i);if(o=we(o,4),l==null){var C=i&&i.constructor;_?l=d?new C:[]:Vt(i)?l=$i(C)?sa(rf(i)):{}:l={}}return(_?Or:gi)(i,function(D,j,B){return o(l,D,j,B)}),l}function wE(i,o){return i==null?!0:Dd(i,o)}function xE(i,o,l){return i==null?i:_v(i,o,jd(l))}function SE(i,o,l,d){return d=typeof d=="function"?d:n,i==null?i:_v(i,o,jd(l),d)}function fa(i){return i==null?[]:dd(i,mn(i))}function ME(i){return i==null?[]:dd(i,Kn(i))}function CE(i,o,l){return l===n&&(l=o,o=n),l!==n&&(l=Dr(l),l=l===l?l:0),o!==n&&(o=Dr(o),o=o===o?o:0),vo(Dr(i),o,l)}function kE(i,o,l){return o=Yi(o),l===n?(l=o,o=0):l=Yi(l),i=Dr(i),b2(i,o,l)}function OE(i,o,l){if(l&&typeof l!="boolean"&&Fn(i,o,l)&&(o=l=n),l===n&&(typeof o=="boolean"?(l=o,o=n):typeof i=="boolean"&&(l=i,i=n)),i===n&&o===n?(i=0,o=1):(i=Yi(i),o===n?(o=i,i=0):o=Yi(o)),i>o){var d=i;i=o,o=d}if(l||i%1||o%1){var _=Qg();return kn(i+_*(o-i+dt("1e-"+((_+"").length-1))),o)}return Pd(i,o)}var EE=aa(function(i,o,l){return o=o.toLowerCase(),i+(l?Oy(o):o)});function Oy(i){return np(Ke(i).toLowerCase())}function Ey(i){return i=Ke(i),i&&i.replace(or,vM).replace(id,"")}function TE(i,o,l){i=Ke(i),o=ur(o);var d=i.length;l=l===n?d:vo(Ee(l),0,d);var _=l;return l-=o.length,l>=0&&i.slice(l,_)==o}function PE(i){return i=Ke(i),i&&fi.test(i)?i.replace(Ot,yM):i}function RE(i){return i=Ke(i),i&&Ft.test(i)?i.replace(xt,"\\$&"):i}var bE=aa(function(i,o,l){return i+(l?"-":"")+o.toLowerCase()}),DE=aa(function(i,o,l){return i+(l?" ":"")+o.toLowerCase()}),AE=Rv("toLowerCase");function LE(i,o,l){i=Ke(i),o=Ee(o);var d=o?ea(i):0;if(!o||d>=o)return i;var _=(o-d)/2;return xf(lf(_),l)+i+xf(af(_),l)}function jE(i,o,l){i=Ke(i),o=Ee(o);var d=o?ea(i):0;return o&&d>>0,l?(i=Ke(i),i&&(typeof o=="string"||o!=null&&!Jd(o))&&(o=ur(o),!o&&Jo(i))?Ss(Gr(i),0,l):i.split(o,l)):[]}var zE=aa(function(i,o,l){return i+(l?" ":"")+np(o)});function $E(i,o,l){return i=Ke(i),l=l==null?0:vo(Ee(l),0,i.length),o=ur(o),i.slice(l,l+o.length)==o}function YE(i,o,l){var d=x.templateSettings;l&&Fn(i,o,l)&&(o=n),i=Ke(i),o=Af({},o,d,Iv);var _=Af({},o.imports,d.imports,Iv),C=mn(_),D=dd(_,C),j,B,q=0,Q=o.interpolate||ci,ee="__p += '",ue=md((o.escape||ci).source+"|"+Q.source+"|"+(Q===ji?zt:ci).source+"|"+(o.evaluate||ci).source+"|$","g"),ve="//# sourceURL="+(Je.call(o,"sourceURL")?(o.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++sd+"]")+` +`;i.replace(ue,function(Se,Ae,Fe,cr,Un,hr){return Fe||(Fe=cr),ee+=i.slice(q,hr).replace(no,_M),Ae&&(j=!0,ee+=`' + +__e(`+Ae+`) + +'`),Un&&(B=!0,ee+=`'; +`+Un+`; +__p += '`),Fe&&(ee+=`' + +((__t = (`+Fe+`)) == null ? '' : __t) + +'`),q=hr+Se.length,Se}),ee+=`'; +`;var xe=Je.call(o,"variable")&&o.variable;if(!xe)ee=`with (obj) { +`+ee+` +} +`;else if(Vo.test(xe))throw new Ce(h);ee=(B?ee.replace(Ho,""):ee).replace(Qe,"$1").replace(kt,"$1;"),ee="function("+(xe||"obj")+`) { +`+(xe?"":`obj || (obj = {}); +`)+"var __t, __p = ''"+(j?", __e = _.escape":"")+(B?`, __j = Array.prototype.join; +function print() { __p += __j.call(arguments, '') } +`:`; +`)+ee+`return __p +}`;var Pe=Py(function(){return Ve(C,ve+"return "+ee).apply(n,D)});if(Pe.source=ee,Xd(Pe))throw Pe;return Pe}function HE(i){return Ke(i).toLowerCase()}function GE(i){return Ke(i).toUpperCase()}function VE(i,o,l){if(i=Ke(i),i&&(l||o===n))return Fg(i);if(!i||!(o=ur(o)))return i;var d=Gr(i),_=Gr(o),C=Ug(d,_),D=Wg(d,_)+1;return Ss(d,C,D).join("")}function qE(i,o,l){if(i=Ke(i),i&&(l||o===n))return i.slice(0,zg(i)+1);if(!i||!(o=ur(o)))return i;var d=Gr(i),_=Wg(d,Gr(o))+1;return Ss(d,0,_).join("")}function QE(i,o,l){if(i=Ke(i),i&&(l||o===n))return i.replace(cs,"");if(!i||!(o=ur(o)))return i;var d=Gr(i),_=Ug(d,Gr(o));return Ss(d,_).join("")}function KE(i,o){var l=fe,d=P;if(Vt(o)){var _="separator"in o?o.separator:_;l="length"in o?Ee(o.length):l,d="omission"in o?ur(o.omission):d}i=Ke(i);var C=i.length;if(Jo(i)){var D=Gr(i);C=D.length}if(l>=C)return i;var j=l-ea(d);if(j<1)return d;var B=D?Ss(D,0,j).join(""):i.slice(0,j);if(_===n)return B+d;if(D&&(j+=B.length-j),Jd(_)){if(i.slice(j).search(_)){var q,Q=B;for(_.global||(_=md(_.source,Ke(Cn.exec(_))+"g")),_.lastIndex=0;q=_.exec(Q);)var ee=q.index;B=B.slice(0,ee===n?j:ee)}}else if(i.indexOf(ur(_),j)!=j){var ue=B.lastIndexOf(_);ue>-1&&(B=B.slice(0,ue))}return B+d}function ZE(i){return i=Ke(i),i&&yt.test(i)?i.replace(Ks,OM):i}var XE=aa(function(i,o,l){return i+(l?" ":"")+o.toUpperCase()}),np=Rv("toUpperCase");function Ty(i,o,l){return i=Ke(i),o=l?n:o,o===n?xM(i)?PM(i):hM(i):i.match(o)||[]}var Py=Re(function(i,o){try{return pn(i,n,o)}catch(l){return Xd(l)?l:new Ce(l)}}),JE=Bi(function(i,o){return Or(o,function(l){l=yi(l),Ui(i,l,Kd(i[l],i))}),i});function eT(i){var o=i==null?0:i.length,l=we();return i=o?$t(i,function(d){if(typeof d[1]!="function")throw new Er(u);return[l(d[0]),d[1]]}):[],Re(function(d){for(var _=-1;++_R)return[];var l=M,d=kn(i,M);o=we(o),i-=M;for(var _=hd(d,o);++l0||o<0)?new Le(l):(i<0?l=l.takeRight(-i):i&&(l=l.drop(i)),o!==n&&(o=Ee(o),l=o<0?l.dropRight(-o):l.take(o-i)),l)},Le.prototype.takeRightWhile=function(i){return this.reverse().takeWhile(i).reverse()},Le.prototype.toArray=function(){return this.take(M)},gi(Le.prototype,function(i,o){var l=/^(?:filter|find|map|reject)|While$/.test(o),d=/^(?:head|last)$/.test(o),_=x[d?"take"+(o=="last"?"Right":""):o],C=d||/^find/.test(o);_&&(x.prototype[o]=function(){var D=this.__wrapped__,j=d?[1]:arguments,B=D instanceof Le,q=j[0],Q=B||Oe(D),ee=function(Ae){var Fe=_.apply(x,gs([Ae],j));return d&&ue?Fe[0]:Fe};Q&&l&&typeof q=="function"&&q.length!=1&&(B=Q=!1);var ue=this.__chain__,ve=!!this.__actions__.length,xe=C&&!ue,Pe=B&&!ve;if(!C&&Q){D=Pe?D:new Le(this);var Se=i.apply(D,j);return Se.__actions__.push({func:Of,args:[ee],thisArg:n}),new Tr(Se,ue)}return xe&&Pe?i.apply(this,j):(Se=this.thru(ee),xe?d?Se.value()[0]:Se.value():Se)})}),Or(["pop","push","shift","sort","splice","unshift"],function(i){var o=Zu[i],l=/^(?:push|sort|unshift)$/.test(i)?"tap":"thru",d=/^(?:pop|shift)$/.test(i);x.prototype[i]=function(){var _=arguments;if(d&&!this.__chain__){var C=this.value();return o.apply(Oe(C)?C:[],_)}return this[l](function(D){return o.apply(Oe(D)?D:[],_)})}}),gi(Le.prototype,function(i,o){var l=x[o];if(l){var d=l.name+"";Je.call(ia,d)||(ia[d]=[]),ia[d].push({name:o,func:l})}}),ia[_f(n,N).name]=[{name:"wrapper",func:n}],Le.prototype.clone=ZM,Le.prototype.reverse=XM,Le.prototype.value=JM,x.prototype.at=Tk,x.prototype.chain=Pk,x.prototype.commit=Rk,x.prototype.next=bk,x.prototype.plant=Ak,x.prototype.reverse=Lk,x.prototype.toJSON=x.prototype.valueOf=x.prototype.value=jk,x.prototype.first=x.prototype.head,al&&(x.prototype[al]=Dk),x},ta=RM();Jt?((Jt.exports=ta)._=ta,pt._=ta):Ie._=ta}).call(Ir)})(Gc,Gc.exports);var db=Gc.exports;const an=gu(db);class pb{reduce(t,n){const r=an.get(t,"local",!1);r&&(this.status(r,n),this.apps(r,n),this.app(r,n),this.appState(r,n),this.appFailed(r,n),this.verbResult(r,n),this.verbStatus(r,n),this.threads(r,n),this.amesPeers(r,n),this.amesPeer(r,n),this.behnTimers(r,n),this.clayCommits(r,n),this.eyreBindings(r,n),this.eyreCache(r,n),this.eyreConnections(r,n),this.eyreAuthentication(r,n),this.eyreChannels(r,n))}status(t,n){const r=an.get(t,"status",!1);r&&(n.status=r)}apps(t,n){const r=an.get(t,"apps",!1);r&&Object.keys(r).map(s=>{n.apps[s]||(n.apps[s]=r[s])})}app(t,n){const r=an.get(t,"app",!1);r&&(n.apps[r.app]&&(r.state=n.apps[r.app].state),n.apps[r.app]=r)}appState(t,n){const r=an.get(t,"appState",!1);r&&(n.apps[r.app].state=r.state)}appFailed(t,n){const r=an.get(t,"appFailed",!1);r&&(console.log("loading app deets failed",r),n.apps[r]={noDebug:!0})}verbResult(t,n){const r=an.get(t,"verbResult",!1);if(r){n.apps[r.app]||(n.apps[r.app]={}),n.apps[r.app].events||(n.apps[r.app].events=[]);let s="some event";r["on-init"]&&(s="+on-init"),r["on-load"]&&(s="+on-load"),r["on-poke"]&&(s="+on-poke with mark "+r["on-poke"]),r["on-watch"]&&(s="+on-watch at path "+r["on-watch"]),r["on-leave"]&&(s="+on-leave on path "+r["on-leave"]),r["on-agent"]&&(s="+on-agent at wire "+r["on-agent"].wire+" with sign "+r["on-agent"].sign),r["on-arvo"]&&(s="+on-arvo at wire "+r["on-arvo"].wire+" from vane "+r["on-arvo"].vane+" with sign "+r["on-arvo"].sign),r["on-fail"]&&(s="+on-fail on "+r["on-fail"]),n.apps[r.app].events.push(s)}}verbStatus(t,n){const r=an.get(t,"verbStatus",!1);r&&(n.apps[r.app]||(n.apps[r.app]={}),n.apps[r.app].events||(n.apps[r.app].events=[]),n.apps[r.app].events.push(r.msg))}verbEventPlus(t,n){const r=an.get(t,"verbEventPlus",!1);r&&(n.logs[r.gill]?(n.logs[r.gill].logs.push(r.log),n.logs[r.gill].newest=r.log.now):n.logs[r.gill]={logs:[r.log],oldest:r.log.now,newest:r.log.now})}threads(t,n){const r=an.get(t,"threads",!1);r&&(n.threads=r)}amesPeers(t,n){const r=an.get(t,"amesPeers",!1);r&&(n.peers.known=r.known,n.peers.alien=r.alien)}amesPeer(t,n){const r=an.get(t,"amesPeer",!1);r&&(n.peers.deets[r.who]=r)}behnTimers(t,n){const r=an.get(t,"behnTimers",!1);r&&(n.timers=r)}clayCommits(t,n){const r=an.get(t,"clayCommits",!1);r&&(console.log("clay comms",r),n.commits=r)}eyreBindings(t,n){const r=an.get(t,"eyreBindings",!1);r&&(n.bindings=r)}eyreCache(t,n){const r=an.get(t,"eyreCache",!1);r&&(n.cache=r)}eyreConnections(t,n){const r=an.get(t,"eyreConnections",!1);r&&(n.connections=r)}eyreAuthentication(t,n){const r=an.get(t,"eyreAuthentication",!1);r&&(n.authentication=r)}eyreChannels(t,n){const r=an.get(t,"eyreChannels",!1);r&&(n.channels=r)}}class mb{constructor(){this.state={status:null,apps:{},logs:{},threads:{},peers:{known:[],alien:[],deets:{}},timers:[],commits:[],bindings:[],cache:[],connections:[],authentication:{sessions:[],visitors:[],visiting:[]},channels:[],sidebarShown:!0},this.localReducer=new pb,this.setState=()=>{}}setStateHandler(t){this.setState=t}handleEvent(t){let n;t.data?n=t.data:n=t,console.log("event",n),this.localReducer.reduce(n,this.state),this.setState(this.state)}}let Pn=new mb;window.store=Pn;//! moment.js +//! version : 2.29.3 +//! authors : Tim Wood, Iskren Chernev, Moment.js contributors +//! license : MIT +//! momentjs.com +var $x;function ce(){return $x.apply(null,arguments)}function gb(e){$x=e}function ii(e){return e instanceof Array||Object.prototype.toString.call(e)==="[object Array]"}function Ao(e){return e!=null&&Object.prototype.toString.call(e)==="[object Object]"}function $e(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ig(e){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(e).length===0;var t;for(t in e)if($e(e,t))return!1;return!0}function Xn(e){return e===void 0}function as(e){return typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]"}function Su(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function Yx(e,t){var n=[],r,s=e.length;for(r=0;r>>0,r;for(r=0;r0)for(n=0;n=0;return(a?n?"+":"":"-")+Math.pow(10,Math.max(0,s)).toString().substr(1)+r}var lg=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Xf=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Wp={},ja={};function _e(e,t,n,r){var s=r;typeof r=="string"&&(s=function(){return this[r]()}),e&&(ja[e]=s),t&&(ja[t[0]]=function(){return Pi(s.apply(this,arguments),t[1],t[2])}),n&&(ja[n]=function(){return this.localeData().ordinal(s.apply(this,arguments),e)})}function xb(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function Sb(e){var t=e.match(lg),n,r;for(n=0,r=t.length;n=0&&Xf.test(e);)e=e.replace(Xf,r),Xf.lastIndex=0,n-=1;return e}var Mb={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function Cb(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.match(lg).map(function(r){return r==="MMMM"||r==="MM"||r==="DD"||r==="dddd"?r.slice(1):r}).join(""),this._longDateFormat[e])}var kb="Invalid date";function Ob(){return this._invalidDate}var Eb="%d",Tb=/\d{1,2}/;function Pb(e){return this._ordinal.replace("%d",e)}var Rb={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function bb(e,t,n,r){var s=this._relativeTime[n];return bi(s)?s(e,t,n,r):s.replace(/%d/i,e)}function Db(e,t){var n=this._relativeTime[e>0?"future":"past"];return bi(n)?n(t):n.replace(/%s/i,t)}var Gl={};function An(e,t){var n=e.toLowerCase();Gl[n]=Gl[n+"s"]=Gl[t]=e}function $r(e){return typeof e=="string"?Gl[e]||Gl[e.toLowerCase()]:void 0}function ug(e){var t={},n,r;for(r in e)$e(e,r)&&(n=$r(r),n&&(t[n]=e[r]));return t}var qx={};function Ln(e,t){qx[e]=t}function Ab(e){var t=[],n;for(n in e)$e(e,n)&&t.push({unit:n,priority:qx[n]});return t.sort(function(r,s){return r.priority-s.priority}),t}function Ah(e){return e%4===0&&e%100!==0||e%400===0}function jr(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function De(e){var t=+e,n=0;return t!==0&&isFinite(t)&&(n=jr(t)),n}function el(e,t){return function(n){return n!=null?(Qx(this,e,n),ce.updateOffset(this,t),this):Vc(this,e)}}function Vc(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function Qx(e,t,n){e.isValid()&&!isNaN(n)&&(t==="FullYear"&&Ah(e.year())&&e.month()===1&&e.date()===29?(n=De(n),e._d["set"+(e._isUTC?"UTC":"")+t](n,e.month(),Uh(n,e.month()))):e._d["set"+(e._isUTC?"UTC":"")+t](n))}function Lb(e){return e=$r(e),bi(this[e])?this[e]():this}function jb(e,t){if(typeof e=="object"){e=ug(e);var n=Ab(e),r,s=n.length;for(r=0;r68?1900:2e3)};var sS=el("FullYear",!0);function eD(){return Ah(this.year())}function tD(e,t,n,r,s,a,u){var h;return e<100&&e>=0?(h=new Date(e+400,t,n,r,s,a,u),isFinite(h.getFullYear())&&h.setFullYear(e)):h=new Date(e,t,n,r,s,a,u),h}function du(e){var t,n;return e<100&&e>=0?(n=Array.prototype.slice.call(arguments),n[0]=e+400,t=new Date(Date.UTC.apply(null,n)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function Qc(e,t,n){var r=7+t-n,s=(7+du(e,0,r).getUTCDay()-t)%7;return-s+r-1}function oS(e,t,n,r,s){var a=(7+n-r)%7,u=Qc(e,r,s),h=1+7*(t-1)+a+u,p,g;return h<=0?(p=e-1,g=Vl(p)+h):h>Vl(e)?(p=e+1,g=h-Vl(e)):(p=e,g=h),{year:p,dayOfYear:g}}function pu(e,t,n){var r=Qc(e.year(),t,n),s=Math.floor((e.dayOfYear()-r-1)/7)+1,a,u;return s<1?(u=e.year()-1,a=s+ns(u,t,n)):s>ns(e.year(),t,n)?(a=s-ns(e.year(),t,n),u=e.year()+1):(u=e.year(),a=s),{week:a,year:u}}function ns(e,t,n){var r=Qc(e,t,n),s=Qc(e+1,t,n);return(Vl(e)-r+s)/7}_e("w",["ww",2],"wo","week");_e("W",["WW",2],"Wo","isoWeek");An("week","w");An("isoWeek","W");Ln("week",5);Ln("isoWeek",5);pe("w",At);pe("ww",At,Sr);pe("W",At);pe("WW",At,Sr);ku(["w","ww","W","WW"],function(e,t,n,r){t[r.substr(0,1)]=De(e)});function nD(e){return pu(e,this._week.dow,this._week.doy).week}var rD={dow:0,doy:6};function iD(){return this._week.dow}function sD(){return this._week.doy}function oD(e){var t=this.localeData().week(this);return e==null?t:this.add((e-t)*7,"d")}function aD(e){var t=pu(this,1,4).week;return e==null?t:this.add((e-t)*7,"d")}_e("d",0,"do","day");_e("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)});_e("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)});_e("dddd",0,0,function(e){return this.localeData().weekdays(this,e)});_e("e",0,0,"weekday");_e("E",0,0,"isoWeekday");An("day","d");An("weekday","e");An("isoWeekday","E");Ln("day",11);Ln("weekday",11);Ln("isoWeekday",11);pe("d",At);pe("e",At);pe("E",At);pe("dd",function(e,t){return t.weekdaysMinRegex(e)});pe("ddd",function(e,t){return t.weekdaysShortRegex(e)});pe("dddd",function(e,t){return t.weekdaysRegex(e)});ku(["dd","ddd","dddd"],function(e,t,n,r){var s=n._locale.weekdaysParse(e,r,n._strict);s!=null?t.d=s:Te(n).invalidWeekday=e});ku(["d","e","E"],function(e,t,n,r){t[r]=De(e)});function lD(e,t){return typeof e!="string"?e:isNaN(e)?(e=t.weekdaysParse(e),typeof e=="number"?e:null):parseInt(e,10)}function uD(e,t){return typeof e=="string"?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function hg(e,t){return e.slice(t,7).concat(e.slice(0,t))}var fD="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),aS="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),cD="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),hD=Cu,dD=Cu,pD=Cu;function mD(e,t){var n=ii(this._weekdays)?this._weekdays:this._weekdays[e&&e!==!0&&this._weekdays.isFormat.test(t)?"format":"standalone"];return e===!0?hg(n,this._week.dow):e?n[e.day()]:n}function gD(e){return e===!0?hg(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort}function vD(e){return e===!0?hg(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin}function yD(e,t,n){var r,s,a,u=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],r=0;r<7;++r)a=Ri([2e3,1]).day(r),this._minWeekdaysParse[r]=this.weekdaysMin(a,"").toLocaleLowerCase(),this._shortWeekdaysParse[r]=this.weekdaysShort(a,"").toLocaleLowerCase(),this._weekdaysParse[r]=this.weekdays(a,"").toLocaleLowerCase();return n?t==="dddd"?(s=nn.call(this._weekdaysParse,u),s!==-1?s:null):t==="ddd"?(s=nn.call(this._shortWeekdaysParse,u),s!==-1?s:null):(s=nn.call(this._minWeekdaysParse,u),s!==-1?s:null):t==="dddd"?(s=nn.call(this._weekdaysParse,u),s!==-1||(s=nn.call(this._shortWeekdaysParse,u),s!==-1)?s:(s=nn.call(this._minWeekdaysParse,u),s!==-1?s:null)):t==="ddd"?(s=nn.call(this._shortWeekdaysParse,u),s!==-1||(s=nn.call(this._weekdaysParse,u),s!==-1)?s:(s=nn.call(this._minWeekdaysParse,u),s!==-1?s:null)):(s=nn.call(this._minWeekdaysParse,u),s!==-1||(s=nn.call(this._weekdaysParse,u),s!==-1)?s:(s=nn.call(this._shortWeekdaysParse,u),s!==-1?s:null))}function _D(e,t,n){var r,s,a;if(this._weekdaysParseExact)return yD.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;r<7;r++){if(s=Ri([2e3,1]).day(r),n&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(s,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(s,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(s,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[r]||(a="^"+this.weekdays(s,"")+"|^"+this.weekdaysShort(s,"")+"|^"+this.weekdaysMin(s,""),this._weekdaysParse[r]=new RegExp(a.replace(".",""),"i")),n&&t==="dddd"&&this._fullWeekdaysParse[r].test(e))return r;if(n&&t==="ddd"&&this._shortWeekdaysParse[r].test(e))return r;if(n&&t==="dd"&&this._minWeekdaysParse[r].test(e))return r;if(!n&&this._weekdaysParse[r].test(e))return r}}function wD(e){if(!this.isValid())return e!=null?this:NaN;var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return e!=null?(e=lD(e,this.localeData()),this.add(e-t,"d")):t}function xD(e){if(!this.isValid())return e!=null?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return e==null?t:this.add(e-t,"d")}function SD(e){if(!this.isValid())return e!=null?this:NaN;if(e!=null){var t=uD(e,this.localeData());return this.day(this.day()%7?t:t-7)}else return this.day()||7}function MD(e){return this._weekdaysParseExact?($e(this,"_weekdaysRegex")||dg.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):($e(this,"_weekdaysRegex")||(this._weekdaysRegex=hD),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function CD(e){return this._weekdaysParseExact?($e(this,"_weekdaysRegex")||dg.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):($e(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=dD),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function kD(e){return this._weekdaysParseExact?($e(this,"_weekdaysRegex")||dg.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):($e(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=pD),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function dg(){function e(v,O){return O.length-v.length}var t=[],n=[],r=[],s=[],a,u,h,p,g;for(a=0;a<7;a++)u=Ri([2e3,1]).day(a),h=pr(this.weekdaysMin(u,"")),p=pr(this.weekdaysShort(u,"")),g=pr(this.weekdays(u,"")),t.push(h),n.push(p),r.push(g),s.push(h),s.push(p),s.push(g);t.sort(e),n.sort(e),r.sort(e),s.sort(e),this._weekdaysRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+t.join("|")+")","i")}function pg(){return this.hours()%12||12}function OD(){return this.hours()||24}_e("H",["HH",2],0,"hour");_e("h",["hh",2],0,pg);_e("k",["kk",2],0,OD);_e("hmm",0,0,function(){return""+pg.apply(this)+Pi(this.minutes(),2)});_e("hmmss",0,0,function(){return""+pg.apply(this)+Pi(this.minutes(),2)+Pi(this.seconds(),2)});_e("Hmm",0,0,function(){return""+this.hours()+Pi(this.minutes(),2)});_e("Hmmss",0,0,function(){return""+this.hours()+Pi(this.minutes(),2)+Pi(this.seconds(),2)});function lS(e,t){_e(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}lS("a",!0);lS("A",!1);An("hour","h");Ln("hour",13);function uS(e,t){return t._meridiemParse}pe("a",uS);pe("A",uS);pe("H",At);pe("h",At);pe("k",At);pe("HH",At,Sr);pe("hh",At,Sr);pe("kk",At,Sr);pe("hmm",Xx);pe("hmmss",Jx);pe("Hmm",Xx);pe("Hmmss",Jx);at(["H","HH"],dn);at(["k","kk"],function(e,t,n){var r=De(e);t[dn]=r===24?0:r});at(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e});at(["h","hh"],function(e,t,n){t[dn]=De(e),Te(n).bigHour=!0});at("hmm",function(e,t,n){var r=e.length-2;t[dn]=De(e.substr(0,r)),t[ei]=De(e.substr(r)),Te(n).bigHour=!0});at("hmmss",function(e,t,n){var r=e.length-4,s=e.length-2;t[dn]=De(e.substr(0,r)),t[ei]=De(e.substr(r,2)),t[es]=De(e.substr(s)),Te(n).bigHour=!0});at("Hmm",function(e,t,n){var r=e.length-2;t[dn]=De(e.substr(0,r)),t[ei]=De(e.substr(r))});at("Hmmss",function(e,t,n){var r=e.length-4,s=e.length-2;t[dn]=De(e.substr(0,r)),t[ei]=De(e.substr(r,2)),t[es]=De(e.substr(s))});function ED(e){return(e+"").toLowerCase().charAt(0)==="p"}var TD=/[ap]\.?m?\.?/i,PD=el("Hours",!0);function RD(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"}var fS={calendar:_b,longDateFormat:Mb,invalidDate:kb,ordinal:Eb,dayOfMonthOrdinalParse:Tb,relativeTime:Rb,months:Yb,monthsShort:eS,week:rD,weekdays:fD,weekdaysMin:cD,weekdaysShort:aS,meridiemParse:TD},Yt={},Rl={},mu;function bD(e,t){var n,r=Math.min(e.length,t.length);for(n=0;n0;){if(s=Wh(a.slice(0,n).join("-")),s)return s;if(r&&r.length>=n&&bD(a,r)>=n-1)break;n--}t++}return mu}function AD(e){return e.match("^[^/\\\\]*$")!=null}function Wh(e){var t=null,n;if(Yt[e]===void 0&&typeof _c<"u"&&_c&&_c.exports&&AD(e))try{t=mu._abbr,n=require,n("./locale/"+e),Ys(t)}catch{Yt[e]=null}return Yt[e]}function Ys(e,t){var n;return e&&(Xn(t)?n=us(e):n=mg(e,t),n?mu=n:typeof console<"u"&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),mu._abbr}function mg(e,t){if(t!==null){var n,r=fS;if(t.abbr=e,Yt[e]!=null)Gx("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),r=Yt[e]._config;else if(t.parentLocale!=null)if(Yt[t.parentLocale]!=null)r=Yt[t.parentLocale]._config;else if(n=Wh(t.parentLocale),n!=null)r=n._config;else return Rl[t.parentLocale]||(Rl[t.parentLocale]=[]),Rl[t.parentLocale].push({name:e,config:t}),null;return Yt[e]=new ag(B0(r,t)),Rl[e]&&Rl[e].forEach(function(s){mg(s.name,s.config)}),Ys(e),Yt[e]}else return delete Yt[e],null}function LD(e,t){if(t!=null){var n,r,s=fS;Yt[e]!=null&&Yt[e].parentLocale!=null?Yt[e].set(B0(Yt[e]._config,t)):(r=Wh(e),r!=null&&(s=r._config),t=B0(s,t),r==null&&(t.abbr=e),n=new ag(t),n.parentLocale=Yt[e],Yt[e]=n),Ys(e)}else Yt[e]!=null&&(Yt[e].parentLocale!=null?(Yt[e]=Yt[e].parentLocale,e===Ys()&&Ys(e)):Yt[e]!=null&&delete Yt[e]);return Yt[e]}function us(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return mu;if(!ii(e)){if(t=Wh(e),t)return t;e=[e]}return DD(e)}function jD(){return z0(Yt)}function gg(e){var t,n=e._a;return n&&Te(e).overflow===-2&&(t=n[Ji]<0||n[Ji]>11?Ji:n[Si]<1||n[Si]>Uh(n[bn],n[Ji])?Si:n[dn]<0||n[dn]>24||n[dn]===24&&(n[ei]!==0||n[es]!==0||n[Ro]!==0)?dn:n[ei]<0||n[ei]>59?ei:n[es]<0||n[es]>59?es:n[Ro]<0||n[Ro]>999?Ro:-1,Te(e)._overflowDayOfYear&&(tSi)&&(t=Si),Te(e)._overflowWeeks&&t===-1&&(t=Bb),Te(e)._overflowWeekday&&t===-1&&(t=zb),Te(e).overflow=t),e}var ND=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ID=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,FD=/Z|[+-]\d\d(?::?\d\d)?/,Jf=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Bp=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],UD=/^\/?Date\((-?\d+)/i,WD=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,BD={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function cS(e){var t,n,r=e._i,s=ND.exec(r)||ID.exec(r),a,u,h,p,g=Jf.length,v=Bp.length;if(s){for(Te(e).iso=!0,t=0,n=g;tVl(u)||e._dayOfYear===0)&&(Te(e)._overflowDayOfYear=!0),n=du(u,0,e._dayOfYear),e._a[Ji]=n.getUTCMonth(),e._a[Si]=n.getUTCDate()),t=0;t<3&&e._a[t]==null;++t)e._a[t]=r[t]=s[t];for(;t<7;t++)e._a[t]=r[t]=e._a[t]==null?t===2?1:0:e._a[t];e._a[dn]===24&&e._a[ei]===0&&e._a[es]===0&&e._a[Ro]===0&&(e._nextDay=!0,e._a[dn]=0),e._d=(e._useUTC?du:tD).apply(null,r),a=e._useUTC?e._d.getUTCDay():e._d.getDay(),e._tzm!=null&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[dn]=24),e._w&&typeof e._w.d<"u"&&e._w.d!==a&&(Te(e).weekdayMismatch=!0)}}function QD(e){var t,n,r,s,a,u,h,p,g;t=e._w,t.GG!=null||t.W!=null||t.E!=null?(a=1,u=4,n=pa(t.GG,e._a[bn],pu(Dt(),1,4).year),r=pa(t.W,1),s=pa(t.E,1),(s<1||s>7)&&(p=!0)):(a=e._locale._week.dow,u=e._locale._week.doy,g=pu(Dt(),a,u),n=pa(t.gg,e._a[bn],g.year),r=pa(t.w,g.week),t.d!=null?(s=t.d,(s<0||s>6)&&(p=!0)):t.e!=null?(s=t.e+a,(t.e<0||t.e>6)&&(p=!0)):s=a),r<1||r>ns(n,a,u)?Te(e)._overflowWeeks=!0:p!=null?Te(e)._overflowWeekday=!0:(h=oS(n,r,s,a,u),e._a[bn]=h.year,e._dayOfYear=h.dayOfYear)}ce.ISO_8601=function(){};ce.RFC_2822=function(){};function yg(e){if(e._f===ce.ISO_8601){cS(e);return}if(e._f===ce.RFC_2822){hS(e);return}e._a=[],Te(e).empty=!0;var t=""+e._i,n,r,s,a,u,h=t.length,p=0,g,v;for(s=Vx(e._f,e._locale).match(lg)||[],v=s.length,n=0;n0&&Te(e).unusedInput.push(u),t=t.slice(t.indexOf(r)+r.length),p+=r.length),ja[a]?(r?Te(e).empty=!1:Te(e).unusedTokens.push(a),Wb(a,r,e)):e._strict&&!r&&Te(e).unusedTokens.push(a);Te(e).charsLeftOver=h-p,t.length>0&&Te(e).unusedInput.push(t),e._a[dn]<=12&&Te(e).bigHour===!0&&e._a[dn]>0&&(Te(e).bigHour=void 0),Te(e).parsedDateParts=e._a.slice(0),Te(e).meridiem=e._meridiem,e._a[dn]=KD(e._locale,e._a[dn],e._meridiem),g=Te(e).era,g!==null&&(e._a[bn]=e._locale.erasConvertYear(g,e._a[bn])),vg(e),gg(e)}function KD(e,t,n){var r;return n==null?t:e.meridiemHour!=null?e.meridiemHour(t,n):(e.isPM!=null&&(r=e.isPM(n),r&&t<12&&(t+=12),!r&&t===12&&(t=0)),t)}function ZD(e){var t,n,r,s,a,u,h=!1,p=e._f.length;if(p===0){Te(e).invalidFormat=!0,e._d=new Date(NaN);return}for(s=0;sthis?this:e:Dh()});function mS(e,t){var n,r;if(t.length===1&&ii(t[0])&&(t=t[0]),!t.length)return Dt();for(n=t[0],r=1;rthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function yA(){if(!Xn(this._isDSTShifted))return this._isDSTShifted;var e={},t;return og(e,this),e=dS(e),e._a?(t=e._isUTC?Ri(e._a):Dt(e._a),this._isDSTShifted=this.isValid()&&uA(e._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function _A(){return this.isValid()?!this._isUTC:!1}function wA(){return this.isValid()?this._isUTC:!1}function vS(){return this.isValid()?this._isUTC&&this._offset===0:!1}var xA=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,SA=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function oi(e,t){var n=e,r=null,s,a,u;return gc(e)?n={ms:e._milliseconds,d:e._days,M:e._months}:as(e)||!isNaN(+e)?(n={},t?n[t]=+e:n.milliseconds=+e):(r=xA.exec(e))?(s=r[1]==="-"?-1:1,n={y:0,d:De(r[Si])*s,h:De(r[dn])*s,m:De(r[ei])*s,s:De(r[es])*s,ms:De(Y0(r[Ro]*1e3))*s}):(r=SA.exec(e))?(s=r[1]==="-"?-1:1,n={y:So(r[2],s),M:So(r[3],s),w:So(r[4],s),d:So(r[5],s),h:So(r[6],s),m:So(r[7],s),s:So(r[8],s)}):n==null?n={}:typeof n=="object"&&("from"in n||"to"in n)&&(u=MA(Dt(n.from),Dt(n.to)),n={},n.ms=u.milliseconds,n.M=u.months),a=new Bh(n),gc(e)&&$e(e,"_locale")&&(a._locale=e._locale),gc(e)&&$e(e,"_isValid")&&(a._isValid=e._isValid),a}oi.fn=Bh.prototype;oi.invalid=lA;function So(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function t_(e,t){var n={};return n.months=t.month()-e.month()+(t.year()-e.year())*12,e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function MA(e,t){var n;return e.isValid()&&t.isValid()?(t=wg(t,e),e.isBefore(t)?n=t_(e,t):(n=t_(t,e),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function yS(e,t){return function(n,r){var s,a;return r!==null&&!isNaN(+r)&&(Gx(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),a=n,n=r,r=a),s=oi(n,r),_S(this,s,e),this}}function _S(e,t,n,r){var s=t._milliseconds,a=Y0(t._days),u=Y0(t._months);e.isValid()&&(r=r??!0,u&&nS(e,Vc(e,"Month")+u*n),a&&Qx(e,"Date",Vc(e,"Date")+a*n),s&&e._d.setTime(e._d.valueOf()+s*n),r&&ce.updateOffset(e,a||u))}var CA=yS(1,"add"),kA=yS(-1,"subtract");function wS(e){return typeof e=="string"||e instanceof String}function OA(e){return si(e)||Su(e)||wS(e)||as(e)||TA(e)||EA(e)||e===null||e===void 0}function EA(e){var t=Ao(e)&&!ig(e),n=!1,r=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],s,a,u=r.length;for(s=0;sn.valueOf():n.valueOf()9999?mc(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):bi(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",mc(n,"Z")):mc(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function zA(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="",n,r,s,a;return this.isLocal()||(e=this.utcOffset()===0?"moment.utc":"moment.parseZone",t="Z"),n="["+e+'("]',r=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",s="-MM-DD[T]HH:mm:ss.SSS",a=t+'[")]',this.format(n+r+s+a)}function $A(e){e||(e=this.isUtc()?ce.defaultFormatUtc:ce.defaultFormat);var t=mc(this,e);return this.localeData().postformat(t)}function YA(e,t){return this.isValid()&&(si(e)&&e.isValid()||Dt(e).isValid())?oi({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function HA(e){return this.from(Dt(),e)}function GA(e,t){return this.isValid()&&(si(e)&&e.isValid()||Dt(e).isValid())?oi({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function VA(e){return this.to(Dt(),e)}function xS(e){var t;return e===void 0?this._locale._abbr:(t=us(e),t!=null&&(this._locale=t),this)}var SS=zr("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return e===void 0?this.localeData():this.locale(e)});function MS(){return this._locale}var Kc=1e3,Na=60*Kc,Zc=60*Na,CS=(365*400+97)*24*Zc;function Ia(e,t){return(e%t+t)%t}function kS(e,t,n){return e<100&&e>=0?new Date(e+400,t,n)-CS:new Date(e,t,n).valueOf()}function OS(e,t,n){return e<100&&e>=0?Date.UTC(e+400,t,n)-CS:Date.UTC(e,t,n)}function qA(e){var t,n;if(e=$r(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?OS:kS,e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=Ia(t+(this._isUTC?0:this.utcOffset()*Na),Zc);break;case"minute":t=this._d.valueOf(),t-=Ia(t,Na);break;case"second":t=this._d.valueOf(),t-=Ia(t,Kc);break}return this._d.setTime(t),ce.updateOffset(this,!0),this}function QA(e){var t,n;if(e=$r(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?OS:kS,e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=Zc-Ia(t+(this._isUTC?0:this.utcOffset()*Na),Zc)-1;break;case"minute":t=this._d.valueOf(),t+=Na-Ia(t,Na)-1;break;case"second":t=this._d.valueOf(),t+=Kc-Ia(t,Kc)-1;break}return this._d.setTime(t),ce.updateOffset(this,!0),this}function KA(){return this._d.valueOf()-(this._offset||0)*6e4}function ZA(){return Math.floor(this.valueOf()/1e3)}function XA(){return new Date(this.valueOf())}function JA(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function eL(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function tL(){return this.isValid()?this.toISOString():null}function nL(){return sg(this)}function rL(){return Ls({},Te(this))}function iL(){return Te(this).overflow}function sL(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}_e("N",0,0,"eraAbbr");_e("NN",0,0,"eraAbbr");_e("NNN",0,0,"eraAbbr");_e("NNNN",0,0,"eraName");_e("NNNNN",0,0,"eraNarrow");_e("y",["y",1],"yo","eraYear");_e("y",["yy",2],0,"eraYear");_e("y",["yyy",3],0,"eraYear");_e("y",["yyyy",4],0,"eraYear");pe("N",xg);pe("NN",xg);pe("NNN",xg);pe("NNNN",gL);pe("NNNNN",vL);at(["N","NN","NNN","NNNN","NNNNN"],function(e,t,n,r){var s=n._locale.erasParse(e,r,n._strict);s?Te(n).era=s:Te(n).invalidEra=e});pe("y",tl);pe("yy",tl);pe("yyy",tl);pe("yyyy",tl);pe("yo",yL);at(["y","yy","yyy","yyyy"],bn);at(["yo"],function(e,t,n,r){var s;n._locale._eraYearOrdinalRegex&&(s=e.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?t[bn]=n._locale.eraYearOrdinalParse(e,s):t[bn]=parseInt(e,10)});function oL(e,t){var n,r,s,a=this._eras||us("en")._eras;for(n=0,r=a.length;n=0)return a[r]}function lL(e,t){var n=e.since<=e.until?1:-1;return t===void 0?ce(e.since).year():ce(e.since).year()+(t-e.offset)*n}function uL(){var e,t,n,r=this.localeData().eras();for(e=0,t=r.length;ea&&(t=a),kL.call(this,e,t,n,r,s))}function kL(e,t,n,r,s){var a=oS(e,t,n,r,s),u=du(a.year,0,a.dayOfYear);return this.year(u.getUTCFullYear()),this.month(u.getUTCMonth()),this.date(u.getUTCDate()),this}_e("Q",0,"Qo","quarter");An("quarter","Q");Ln("quarter",7);pe("Q",Kx);at("Q",function(e,t){t[Ji]=(De(e)-1)*3});function OL(e){return e==null?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)}_e("D",["DD",2],"Do","date");An("date","D");Ln("date",9);pe("D",At);pe("DD",At,Sr);pe("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient});at(["D","DD"],Si);at("Do",function(e,t){t[Si]=De(e.match(At)[0])});var TS=el("Date",!0);_e("DDD",["DDDD",3],"DDDo","dayOfYear");An("dayOfYear","DDD");Ln("dayOfYear",4);pe("DDD",jh);pe("DDDD",Zx);at(["DDD","DDDD"],function(e,t,n){n._dayOfYear=De(e)});function EL(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return e==null?t:this.add(e-t,"d")}_e("m",["mm",2],0,"minute");An("minute","m");Ln("minute",14);pe("m",At);pe("mm",At,Sr);at(["m","mm"],ei);var TL=el("Minutes",!1);_e("s",["ss",2],0,"second");An("second","s");Ln("second",15);pe("s",At);pe("ss",At,Sr);at(["s","ss"],es);var PL=el("Seconds",!1);_e("S",0,0,function(){return~~(this.millisecond()/100)});_e(0,["SS",2],0,function(){return~~(this.millisecond()/10)});_e(0,["SSS",3],0,"millisecond");_e(0,["SSSS",4],0,function(){return this.millisecond()*10});_e(0,["SSSSS",5],0,function(){return this.millisecond()*100});_e(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3});_e(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4});_e(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5});_e(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6});An("millisecond","ms");Ln("millisecond",16);pe("S",jh,Kx);pe("SS",jh,Sr);pe("SSS",jh,Zx);var js,PS;for(js="SSSS";js.length<=9;js+="S")pe(js,tl);function RL(e,t){t[Ro]=De(("0."+e)*1e3)}for(js="S";js.length<=9;js+="S")at(js,RL);PS=el("Milliseconds",!1);_e("z",0,0,"zoneAbbr");_e("zz",0,0,"zoneName");function bL(){return this._isUTC?"UTC":""}function DL(){return this._isUTC?"Coordinated Universal Time":""}var ie=Mu.prototype;ie.add=CA;ie.calendar=bA;ie.clone=DA;ie.diff=UA;ie.endOf=QA;ie.format=$A;ie.from=YA;ie.fromNow=HA;ie.to=GA;ie.toNow=VA;ie.get=Lb;ie.invalidAt=iL;ie.isAfter=AA;ie.isBefore=LA;ie.isBetween=jA;ie.isSame=NA;ie.isSameOrAfter=IA;ie.isSameOrBefore=FA;ie.isValid=nL;ie.lang=SS;ie.locale=xS;ie.localeData=MS;ie.max=nA;ie.min=tA;ie.parsingFlags=rL;ie.set=jb;ie.startOf=qA;ie.subtract=kA;ie.toArray=JA;ie.toObject=eL;ie.toDate=XA;ie.toISOString=BA;ie.inspect=zA;typeof Symbol<"u"&&Symbol.for!=null&&(ie[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"});ie.toJSON=tL;ie.toString=WA;ie.unix=ZA;ie.valueOf=KA;ie.creationData=sL;ie.eraName=uL;ie.eraNarrow=fL;ie.eraAbbr=cL;ie.eraYear=hL;ie.year=sS;ie.isLeapYear=eD;ie.weekYear=_L;ie.isoWeekYear=wL;ie.quarter=ie.quarters=OL;ie.month=rS;ie.daysInMonth=Zb;ie.week=ie.weeks=oD;ie.isoWeek=ie.isoWeeks=aD;ie.weeksInYear=ML;ie.weeksInWeekYear=CL;ie.isoWeeksInYear=xL;ie.isoWeeksInISOWeekYear=SL;ie.date=TS;ie.day=ie.days=wD;ie.weekday=xD;ie.isoWeekday=SD;ie.dayOfYear=EL;ie.hour=ie.hours=PD;ie.minute=ie.minutes=TL;ie.second=ie.seconds=PL;ie.millisecond=ie.milliseconds=PS;ie.utcOffset=cA;ie.utc=dA;ie.local=pA;ie.parseZone=mA;ie.hasAlignedHourOffset=gA;ie.isDST=vA;ie.isLocal=_A;ie.isUtcOffset=wA;ie.isUtc=vS;ie.isUTC=vS;ie.zoneAbbr=bL;ie.zoneName=DL;ie.dates=zr("dates accessor is deprecated. Use date instead.",TS);ie.months=zr("months accessor is deprecated. Use month instead",rS);ie.years=zr("years accessor is deprecated. Use year instead",sS);ie.zone=zr("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",hA);ie.isDSTShifted=zr("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",yA);function AL(e){return Dt(e*1e3)}function LL(){return Dt.apply(null,arguments).parseZone()}function RS(e){return e}var Ye=ag.prototype;Ye.calendar=wb;Ye.longDateFormat=Cb;Ye.invalidDate=Ob;Ye.ordinal=Pb;Ye.preparse=RS;Ye.postformat=RS;Ye.relativeTime=bb;Ye.pastFuture=Db;Ye.set=yb;Ye.eras=oL;Ye.erasParse=aL;Ye.erasConvertYear=lL;Ye.erasAbbrRegex=pL;Ye.erasNameRegex=dL;Ye.erasNarrowRegex=mL;Ye.months=Vb;Ye.monthsShort=qb;Ye.monthsParse=Kb;Ye.monthsRegex=Jb;Ye.monthsShortRegex=Xb;Ye.week=nD;Ye.firstDayOfYear=sD;Ye.firstDayOfWeek=iD;Ye.weekdays=mD;Ye.weekdaysMin=vD;Ye.weekdaysShort=gD;Ye.weekdaysParse=_D;Ye.weekdaysRegex=MD;Ye.weekdaysShortRegex=CD;Ye.weekdaysMinRegex=kD;Ye.isPM=ED;Ye.meridiem=RD;function Xc(e,t,n,r){var s=us(),a=Ri().set(r,t);return s[n](a,e)}function bS(e,t,n){if(as(e)&&(t=e,e=void 0),e=e||"",t!=null)return Xc(e,t,n,"month");var r,s=[];for(r=0;r<12;r++)s[r]=Xc(e,r,n,"month");return s}function Mg(e,t,n,r){typeof e=="boolean"?(as(t)&&(n=t,t=void 0),t=t||""):(t=e,n=t,e=!1,as(t)&&(n=t,t=void 0),t=t||"");var s=us(),a=e?s._week.dow:0,u,h=[];if(n!=null)return Xc(t,(n+a)%7,r,"day");for(u=0;u<7;u++)h[u]=Xc(t,(u+a)%7,r,"day");return h}function jL(e,t){return bS(e,t,"months")}function NL(e,t){return bS(e,t,"monthsShort")}function IL(e,t,n){return Mg(e,t,n,"weekdays")}function FL(e,t,n){return Mg(e,t,n,"weekdaysShort")}function UL(e,t,n){return Mg(e,t,n,"weekdaysMin")}Ys("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,n=De(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return e+n}});ce.lang=zr("moment.lang is deprecated. Use moment.locale instead.",Ys);ce.langData=zr("moment.langData is deprecated. Use moment.localeData instead.",us);var Gi=Math.abs;function WL(){var e=this._data;return this._milliseconds=Gi(this._milliseconds),this._days=Gi(this._days),this._months=Gi(this._months),e.milliseconds=Gi(e.milliseconds),e.seconds=Gi(e.seconds),e.minutes=Gi(e.minutes),e.hours=Gi(e.hours),e.months=Gi(e.months),e.years=Gi(e.years),this}function DS(e,t,n,r){var s=oi(t,n);return e._milliseconds+=r*s._milliseconds,e._days+=r*s._days,e._months+=r*s._months,e._bubble()}function BL(e,t){return DS(this,e,t,1)}function zL(e,t){return DS(this,e,t,-1)}function n_(e){return e<0?Math.floor(e):Math.ceil(e)}function $L(){var e=this._milliseconds,t=this._days,n=this._months,r=this._data,s,a,u,h,p;return e>=0&&t>=0&&n>=0||e<=0&&t<=0&&n<=0||(e+=n_(G0(n)+t)*864e5,t=0,n=0),r.milliseconds=e%1e3,s=jr(e/1e3),r.seconds=s%60,a=jr(s/60),r.minutes=a%60,u=jr(a/60),r.hours=u%24,t+=jr(u/24),p=jr(AS(t)),n+=p,t-=n_(G0(p)),h=jr(n/12),n%=12,r.days=t,r.months=n,r.years=h,this}function AS(e){return e*4800/146097}function G0(e){return e*146097/4800}function YL(e){if(!this.isValid())return NaN;var t,n,r=this._milliseconds;if(e=$r(e),e==="month"||e==="quarter"||e==="year")switch(t=this._days+r/864e5,n=this._months+AS(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(G0(this._months)),e){case"week":return t/7+r/6048e5;case"day":return t+r/864e5;case"hour":return t*24+r/36e5;case"minute":return t*1440+r/6e4;case"second":return t*86400+r/1e3;case"millisecond":return Math.floor(t*864e5)+r;default:throw new Error("Unknown unit "+e)}}function HL(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+De(this._months/12)*31536e6:NaN}function fs(e){return function(){return this.as(e)}}var GL=fs("ms"),VL=fs("s"),qL=fs("m"),QL=fs("h"),KL=fs("d"),ZL=fs("w"),XL=fs("M"),JL=fs("Q"),ej=fs("y");function tj(){return oi(this)}function nj(e){return e=$r(e),this.isValid()?this[e+"s"]():NaN}function $o(e){return function(){return this.isValid()?this._data[e]:NaN}}var rj=$o("milliseconds"),ij=$o("seconds"),sj=$o("minutes"),oj=$o("hours"),aj=$o("days"),lj=$o("months"),uj=$o("years");function fj(){return jr(this.days()/7)}var qi=Math.round,Ea={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function cj(e,t,n,r,s){return s.relativeTime(t||1,!!n,e,r)}function hj(e,t,n,r){var s=oi(e).abs(),a=qi(s.as("s")),u=qi(s.as("m")),h=qi(s.as("h")),p=qi(s.as("d")),g=qi(s.as("M")),v=qi(s.as("w")),O=qi(s.as("y")),b=a<=n.ss&&["s",a]||a0,b[4]=r,cj.apply(null,b)}function dj(e){return e===void 0?qi:typeof e=="function"?(qi=e,!0):!1}function pj(e,t){return Ea[e]===void 0?!1:t===void 0?Ea[e]:(Ea[e]=t,e==="s"&&(Ea.ss=t-1),!0)}function mj(e,t){if(!this.isValid())return this.localeData().invalidDate();var n=!1,r=Ea,s,a;return typeof e=="object"&&(t=e,e=!1),typeof e=="boolean"&&(n=e),typeof t=="object"&&(r=Object.assign({},Ea,t),t.s!=null&&t.ss==null&&(r.ss=t.s-1)),s=this.localeData(),a=hj(this,!n,r,s),n&&(a=s.pastFuture(+this,a)),s.postformat(a)}var zp=Math.abs;function ha(e){return(e>0)-(e<0)||+e}function $h(){if(!this.isValid())return this.localeData().invalidDate();var e=zp(this._milliseconds)/1e3,t=zp(this._days),n=zp(this._months),r,s,a,u,h=this.asSeconds(),p,g,v,O;return h?(r=jr(e/60),s=jr(r/60),e%=60,r%=60,a=jr(n/12),n%=12,u=e?e.toFixed(3).replace(/\.?0+$/,""):"",p=h<0?"-":"",g=ha(this._months)!==ha(h)?"-":"",v=ha(this._days)!==ha(h)?"-":"",O=ha(this._milliseconds)!==ha(h)?"-":"",p+"P"+(a?g+a+"Y":"")+(n?g+n+"M":"")+(t?v+t+"D":"")+(s||r||e?"T":"")+(s?O+s+"H":"")+(r?O+r+"M":"")+(e?O+u+"S":"")):"P0D"}var We=Bh.prototype;We.isValid=aA;We.abs=WL;We.add=BL;We.subtract=zL;We.as=YL;We.asMilliseconds=GL;We.asSeconds=VL;We.asMinutes=qL;We.asHours=QL;We.asDays=KL;We.asWeeks=ZL;We.asMonths=XL;We.asQuarters=JL;We.asYears=ej;We.valueOf=HL;We._bubble=$L;We.clone=tj;We.get=nj;We.milliseconds=rj;We.seconds=ij;We.minutes=sj;We.hours=oj;We.days=aj;We.weeks=fj;We.months=lj;We.years=uj;We.humanize=mj;We.toISOString=$h;We.toString=$h;We.toJSON=$h;We.locale=xS;We.localeData=MS;We.toIsoString=zr("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",$h);We.lang=SS;_e("X",0,0,"unix");_e("x",0,0,"valueOf");pe("x",Ih);pe("X",Ib);at("X",function(e,t,n){n._d=new Date(parseFloat(e)*1e3)});at("x",function(e,t,n){n._d=new Date(De(e))});//! moment.js +ce.version="2.29.3";gb(Dt);ce.fn=ie;ce.min=rA;ce.max=iA;ce.now=sA;ce.utc=Ri;ce.unix=AL;ce.months=jL;ce.isDate=Su;ce.locale=Ys;ce.invalid=Dh;ce.duration=oi;ce.isMoment=si;ce.weekdays=IL;ce.parseZone=LL;ce.localeData=us;ce.isDuration=gc;ce.monthsShort=NL;ce.weekdaysMin=UL;ce.defineLocale=mg;ce.updateLocale=LD;ce.locales=jD;ce.weekdaysShort=FL;ce.normalizeUnits=$r;ce.relativeTimeRounding=dj;ce.relativeTimeThreshold=pj;ce.calendarFormat=RA;ce.prototype=ie;ce.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};function Es(e,t=!1){let n=window.location.href.split("?")[1];return t&&n?n="?"+n:n="","/~debug/"+e+n}function Mi(e,t){const n=new Date(e);var r=function(s){return s>=10?s:"0"+s};return`~${n.getUTCFullYear()}.${n.getUTCMonth()+1}.${r(n.getUTCDate())}..${r(n.getUTCHours())}.${r(n.getUTCMinutes())}.${r(n.getUTCSeconds())}${t?"..0000":""}`}function Qi(e){return e.reduce((t,n)=>t+n+" ","")}function gj(e){let t="";for(let n=0;n=97&&a<=122||a>=48&&a<=57||r==="-"?s=r:s="~"+a.toString(16)+"."}t=t+s}return"~~"+t}class vj{setAuthTokens(t){this.authTokens=t,this.bindPaths=[],this.bind=this.bind.bind(this)}bind(t,n,r=this.authTokens.ship,s,a,u,h){this.bindPaths=an.uniq([...this.bindPaths,t]),window.subscriptionId=window.urb.subscribe(r,s,t,p=>{u(p)},p=>{a({data:p,from:{ship:r,path:t}})},p=>{h(p)})}action(t,n,r){return new Promise((s,a)=>{window.urb.poke(ship,t,n,r,u=>{s(u)},u=>{a(u)})})}dbugAction(t){return this.action("dbug","dbug-action",t)}bindToVerb(t){return this.bind("/verb/events","PUT",this.authTokens.ship,t,n=>{n.data.app=t,Pn.handleEvent({data:{local:{verbResult:n.data}}})},()=>{Pn.handleEvent({data:{local:{verbStatus:{app:t,msg:"failed to establish verb connection to "+t}}}})},()=>{Pn.handleEvent({data:{local:{verbStatus:{app:t,msg:"verb connection to "+t+" was dropped"}}}})})}bindToVerbPlus(t){return this.bind("/verb/events-plus","PUT",this.authTokens.ship,t,n=>{n.data.app=t,Pn.handleEvent({data:{local:{verbResultPlus:{gill:`~${this.authTokens.ship}/${t}`,log:n.data}}}})},()=>{Pn.handleEvent({data:{local:{verbStatus:{app:t,msg:"failed to establish verb connection to "+t}}}})},()=>{Pn.handleEvent({data:{local:{verbStatus:{app:t,msg:"verb connection to "+t+" was dropped"}}}})})}getJson(t,n,r){let s="/~debug"+t+".json";const a=window.location.href.split("?")[1];a&&(s=s+"?"+a),fetch(s).then(u=>{if(!u.ok)console.error("Network response not ok"),r();else return u.json()}).then(u=>{Pn.handleEvent({data:{local:n(u)}})}).catch(u=>{console.error(`JSON fetch on ${s} failed:`,u),r()})}wrapLocal(t){return n=>{let r={};return r[t]=n,r.status=null,r}}showStatus(t){return()=>{Pn.handleEvent({data:{local:{status:t}}})}}getApps(){this.getJson("/apps",this.wrapLocal("apps"),this.showStatus("error fetching apps"))}getAppDetails(t){this.getJson("/app/"+t,n=>(n.app=t,this.wrapLocal("app")(n)),()=>{Pn.handleEvent({data:{local:{appFailed:t}}})})}getAppState(t,n=""){n!==""&&(n="/"+gj(n)),this.getJson("/app/"+t+"/state"+n,r=>(r.app=t,this.wrapLocal("appState")(r)),()=>{Pn.handleEvent({data:{local:{appFailed:t}}})})}getThreads(){this.getJson("/spider/threads",this.wrapLocal("threads"),this.showStatus("error fetching threads"))}killThread(t){return this.action("spider","spider-stop",{tid:t,nice:!1}).then(this.getThreads.bind(this))}getPeers(){this.getJson("/ames/peer",this.wrapLocal("amesPeers"),this.showStatus("error fetching ames peers"))}getPeer(t){this.getJson(`/ames/peer/${t}`,n=>(n.who=t,this.wrapLocal("amesPeer")(n)),this.showStatus("error fetching ames details for "+t))}getTimers(){this.getJson("/behn/timers",this.wrapLocal("behnTimers"),this.showStatus("error fetching behn timers"))}getCommits(){this.getJson("/clay/commits",this.wrapLocal("clayCommits"),this.showStatus("error fetching clay commits"))}getBindings(){this.getJson("/eyre/bindings",this.wrapLocal("eyreBindings"),this.showStatus("error fetching eyre bindings"))}getCache(){this.getJson("/eyre/cache",this.wrapLocal("eyreCache"),this.showStatus("error fetching eyre cache"))}getConnections(){this.getJson("/eyre/connections",this.wrapLocal("eyreConnections"),this.showStatus("error fetching eyre connections"))}getAuthenticationState(){this.getJson("/eyre/authentication",this.wrapLocal("eyreAuthentication"),this.showStatus("error fetching eyre authentication state"))}getChannels(){this.getJson("/eyre/channels",this.wrapLocal("eyreChannels"),this.showStatus("error fetching eyre channels"))}clearCache(t){return this.action("dbug","json",{"clear-eyre-cache":{url:t}}).then(this.getCache.bind(this))}sidebarToggle(){let t=!0;Pn.state.sidebarShown===!0&&(t=!1),Pn.handleEvent({data:{local:{sidebarToggle:t}}})}}let Cg=new vj;window.api=Cg;class yj{start(){Cg.authTokens||console.error("~~~ ERROR: Must set api.authTokens before operation ~~~")}handleEvent(t){Pn.handleEvent(t)}handleError(t){console.error(t)}handleQuitSilently(t){}handleQuitAndResubscribe(t){}}let _j=new yj;class wj extends oe.Component{render(){const{props:t}=this;let n=t.selected?"bg-gray5 bg-gray1-d":"pointer hover-bg-gray5 hover-bg-gray1-d";return y.jsx(rg,{to:Es(t.what,!0),children:y.jsx("div",{className:"w-100 v-mid f9 ph4 z1 pv1 "+n,children:y.jsx("p",{className:"f9 dib",children:t.what})})},"what")}}class Os extends oe.Component{render(){const{props:t}=this;let n=["apps","logs","spider","ames","behn","eyre"];n=n.map(a=>y.jsx(wj,{what:a,selected:t.selected===a}));let r=this.props.rightPanelHide?"dn-s":"";const s=t.status?y.jsx("div",{style:{position:"absolute",right:"16px",bottom:"16px",padding:"8px",border:"1px solid #e22"},children:t.status}):null;return y.jsx("div",{className:"absolute h-100 w-100 mono",children:y.jsxs("div",{className:"cf w-100 h-100 flex",children:[y.jsxs("div",{className:"bn br-m br-l br-xl b--gray4 b--gray1-d lh-copy h-100 flex-shrink-0 mw5-m mw5-l mw5-xl pt3 pt0-m pt0-l pt0-xl relative",children:[y.jsx("a",{className:"db dn-m dn-l dn-xl f8 pb3 pl3",href:"/",children:"⟵ Landscape"}),y.jsxs("div",{className:"overflow-y-scroll h-100",children:[y.jsx("div",{className:"w-100 bg-transparent",children:y.jsx(rg,{className:"dib f9 pointer green2 gray4-d pa4",to:"/~chat/join/~/~dopzod/urbit-help",children:"Get help"})}),n]})]}),s,y.jsx("div",{className:"h-100 w-100 flex-auto overflow-scroll relative "+r,style:{flexGrow:1,padding:"8px"},children:this.props.children})]})})}}class xj extends oe.Component{render(){return y.jsx("div",{className:"h-100 w-100 overflow-x-hidden flex flex-column bg-white bg-gray0-d dn db-ns",children:y.jsx("div",{className:"pl3 pr3 pt2 dt pb3 w-100 h-100",children:y.jsx("p",{className:"f8 pt3 gray2 w-100 h-100 dtc v-mid tc",children:this.props.text})})})}}var kg={exports:{}};const Sj={},Mj=Object.freeze(Object.defineProperty({__proto__:null,default:Sj},Symbol.toStringTag,{value:"Module"})),Cj=UT(Mj);kg.exports;(function(e){(function(t,n){function r(P,f){if(!P)throw new Error(f||"Assertion failed")}function s(P,f){P.super_=f;var m=function(){};m.prototype=f.prototype,P.prototype=new m,P.prototype.constructor=P}function a(P,f,m){if(a.isBN(P))return P;this.negative=0,this.words=null,this.length=0,this.red=null,P!==null&&((f==="le"||f==="be")&&(m=f,f=10),this._init(P||0,f||10,m||"be"))}typeof t=="object"?t.exports=a:n.BN=a,a.BN=a,a.wordSize=26;var u;try{typeof window<"u"&&typeof window.Buffer<"u"?u=window.Buffer:u=Cj.Buffer}catch{}a.isBN=function(f){return f instanceof a?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===a.wordSize&&Array.isArray(f.words)},a.max=function(f,m){return f.cmp(m)>0?f:m},a.min=function(f,m){return f.cmp(m)<0?f:m},a.prototype._init=function(f,m,S){if(typeof f=="number")return this._initNumber(f,m,S);if(typeof f=="object")return this._initArray(f,m,S);m==="hex"&&(m=16),r(m===(m|0)&&m>=2&&m<=36),f=f.toString().replace(/\s+/g,"");var k=0;f[0]==="-"&&(k++,this.negative=1),k=0;k-=3)L=f[k]|f[k-1]<<8|f[k-2]<<16,this.words[T]|=L<>>26-R&67108863,R+=24,R>=26&&(R-=26,T++);else if(S==="le")for(k=0,T=0;k>>26-R&67108863,R+=24,R>=26&&(R-=26,T++);return this.strip()};function h(P,f){var m=P.charCodeAt(f);return m>=65&&m<=70?m-55:m>=97&&m<=102?m-87:m-48&15}function p(P,f,m){var S=h(P,m);return m-1>=f&&(S|=h(P,m-1)<<4),S}a.prototype._parseHex=function(f,m,S){this.length=Math.ceil((f.length-m)/6),this.words=new Array(this.length);for(var k=0;k=m;k-=2)R=p(f,m,k)<=18?(T-=18,L+=1,this.words[L]|=R>>>26):T+=8;else{var w=f.length-m;for(k=w%2===0?m+1:m;k=18?(T-=18,L+=1,this.words[L]|=R>>>26):T+=8}this.strip()};function g(P,f,m,S){for(var k=0,T=Math.min(P.length,m),L=f;L=49?k+=R-49+10:R>=17?k+=R-17+10:k+=R}return k}a.prototype._parseBase=function(f,m,S){this.words=[0],this.length=1;for(var k=0,T=1;T<=67108863;T*=m)k++;k--,T=T/m|0;for(var L=f.length-S,R=L%k,w=Math.min(L,L-R)+S,c=0,M=S;M1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},a.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?""};var v=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],O=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],b=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];a.prototype.toString=function(f,m){f=f||10,m=m|0||1;var S;if(f===16||f==="hex"){S="";for(var k=0,T=0,L=0;L>>24-k&16777215,T!==0||L!==this.length-1?S=v[6-w.length]+w+S:S=w+S,k+=2,k>=26&&(k-=26,L--)}for(T!==0&&(S=T.toString(16)+S);S.length%m!==0;)S="0"+S;return this.negative!==0&&(S="-"+S),S}if(f===(f|0)&&f>=2&&f<=36){var c=O[f],M=b[f];S="";var G=this.clone();for(G.negative=0;!G.isZero();){var se=G.modn(M).toString(f);G=G.idivn(M),G.isZero()?S=se+S:S=v[c-se.length]+se+S}for(this.isZero()&&(S="0"+S);S.length%m!==0;)S="0"+S;return this.negative!==0&&(S="-"+S),S}r(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(f,m){return r(typeof u<"u"),this.toArrayLike(u,f,m)},a.prototype.toArray=function(f,m){return this.toArrayLike(Array,f,m)},a.prototype.toArrayLike=function(f,m,S){var k=this.byteLength(),T=S||Math.max(1,k);r(k<=T,"byte array longer than desired length"),r(T>0,"Requested array length <= 0"),this.strip();var L=m==="le",R=new f(T),w,c,M=this.clone();if(L){for(c=0;!M.isZero();c++)w=M.andln(255),M.iushrn(8),R[c]=w;for(;c=4096&&(S+=13,m>>>=13),m>=64&&(S+=7,m>>>=7),m>=8&&(S+=4,m>>>=4),m>=2&&(S+=2,m>>>=2),S+m},a.prototype._zeroBits=function(f){if(f===0)return 26;var m=f,S=0;return m&8191||(S+=13,m>>>=13),m&127||(S+=7,m>>>=7),m&15||(S+=4,m>>>=4),m&3||(S+=2,m>>>=2),m&1||S++,S},a.prototype.bitLength=function(){var f=this.words[this.length-1],m=this._countBits(f);return(this.length-1)*26+m};function F(P){for(var f=new Array(P.bitLength()),m=0;m>>k}return f}a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,m=0;mf.length?this.clone().ior(f):f.clone().ior(this)},a.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},a.prototype.iuand=function(f){var m;this.length>f.length?m=f:m=this;for(var S=0;Sf.length?this.clone().iand(f):f.clone().iand(this)},a.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},a.prototype.iuxor=function(f){var m,S;this.length>f.length?(m=this,S=f):(m=f,S=this);for(var k=0;kf.length?this.clone().ixor(f):f.clone().ixor(this)},a.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},a.prototype.inotn=function(f){r(typeof f=="number"&&f>=0);var m=Math.ceil(f/26)|0,S=f%26;this._expand(m),S>0&&m--;for(var k=0;k0&&(this.words[k]=~this.words[k]&67108863>>26-S),this.strip()},a.prototype.notn=function(f){return this.clone().inotn(f)},a.prototype.setn=function(f,m){r(typeof f=="number"&&f>=0);var S=f/26|0,k=f%26;return this._expand(S+1),m?this.words[S]=this.words[S]|1<f.length?(S=this,k=f):(S=f,k=this);for(var T=0,L=0;L>>26;for(;T!==0&&L>>26;if(this.length=S.length,T!==0)this.words[this.length]=T,this.length++;else if(S!==this)for(;Lf.length?this.clone().iadd(f):f.clone().iadd(this)},a.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var m=this.iadd(f);return f.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var S=this.cmp(f);if(S===0)return this.negative=0,this.length=1,this.words[0]=0,this;var k,T;S>0?(k=this,T=f):(k=f,T=this);for(var L=0,R=0;R>26,this.words[R]=m&67108863;for(;L!==0&&R>26,this.words[R]=m&67108863;if(L===0&&R>>26,G=w&67108863,se=Math.min(c,f.length-1),ae=Math.max(0,c-P.length+1);ae<=se;ae++){var re=c-ae|0;k=P.words[re]|0,T=f.words[ae]|0,L=k*T+G,M+=L/67108864|0,G=L&67108863}m.words[c]=G|0,w=M|0}return w!==0?m.words[c]=w|0:m.length--,m.strip()}var K=function(f,m,S){var k=f.words,T=m.words,L=S.words,R=0,w,c,M,G=k[0]|0,se=G&8191,ae=G>>>13,re=k[1]|0,ye=re&8191,Me=re>>>13,ze=k[2]|0,be=ze&8191,Ze=ze>>>13,li=k[3]|0,Xe=li&8191,gt=li>>>13,_n=k[4]|0,nt=_n&8191,Lt=_n>>>13,Gn=k[5]|0,Ct=Gn&8191,jt=Gn>>>13,ui=k[6]|0,Ue=ui&8191,rt=ui>>>13,Di=k[7]|0,Nt=Di&8191,it=Di>>>13,Yo=k[8]|0,He=Yo&8191,Ge=Yo>>>13,Ai=k[9]|0,Ne=Ai&8191,lt=Ai>>>13,Li=T[0]|0,vt=Li&8191,ut=Li>>>13,Yr=T[1]|0,ft=Yr&8191,ct=Yr>>>13,Ho=T[2]|0,Qe=Ho&8191,kt=Ho>>>13,Ks=T[3]|0,Ot=Ks&8191,yt=Ks>>>13,fi=T[4]|0,_t=fi&8191,wt=fi>>>13,ji=T[5]|0,st=ji&8191,It=ji>>>13,Go=T[6]|0,xt=Go&8191,Ft=Go>>>13,cs=T[7]|0,Et=cs&8191,St=cs>>>13,Cr=T[8]|0,Ut=Cr&8191,Wt=Cr>>>13,Vo=T[9]|0,Bt=Vo&8191,zt=Vo>>>13;S.negative=f.negative^m.negative,S.length=19,w=Math.imul(se,vt),c=Math.imul(se,ut),c=c+Math.imul(ae,vt)|0,M=Math.imul(ae,ut);var Cn=(R+w|0)+((c&8191)<<13)|0;R=(M+(c>>>13)|0)+(Cn>>>26)|0,Cn&=67108863,w=Math.imul(ye,vt),c=Math.imul(ye,ut),c=c+Math.imul(Me,vt)|0,M=Math.imul(Me,ut),w=w+Math.imul(se,ft)|0,c=c+Math.imul(se,ct)|0,c=c+Math.imul(ae,ft)|0,M=M+Math.imul(ae,ct)|0;var Zs=(R+w|0)+((c&8191)<<13)|0;R=(M+(c>>>13)|0)+(Zs>>>26)|0,Zs&=67108863,w=Math.imul(be,vt),c=Math.imul(be,ut),c=c+Math.imul(Ze,vt)|0,M=Math.imul(Ze,ut),w=w+Math.imul(ye,ft)|0,c=c+Math.imul(ye,ct)|0,c=c+Math.imul(Me,ft)|0,M=M+Math.imul(Me,ct)|0,w=w+Math.imul(se,Qe)|0,c=c+Math.imul(se,kt)|0,c=c+Math.imul(ae,Qe)|0,M=M+Math.imul(ae,kt)|0;var Xs=(R+w|0)+((c&8191)<<13)|0;R=(M+(c>>>13)|0)+(Xs>>>26)|0,Xs&=67108863,w=Math.imul(Xe,vt),c=Math.imul(Xe,ut),c=c+Math.imul(gt,vt)|0,M=Math.imul(gt,ut),w=w+Math.imul(be,ft)|0,c=c+Math.imul(be,ct)|0,c=c+Math.imul(Ze,ft)|0,M=M+Math.imul(Ze,ct)|0,w=w+Math.imul(ye,Qe)|0,c=c+Math.imul(ye,kt)|0,c=c+Math.imul(Me,Qe)|0,M=M+Math.imul(Me,kt)|0,w=w+Math.imul(se,Ot)|0,c=c+Math.imul(se,yt)|0,c=c+Math.imul(ae,Ot)|0,M=M+Math.imul(ae,yt)|0;var Js=(R+w|0)+((c&8191)<<13)|0;R=(M+(c>>>13)|0)+(Js>>>26)|0,Js&=67108863,w=Math.imul(nt,vt),c=Math.imul(nt,ut),c=c+Math.imul(Lt,vt)|0,M=Math.imul(Lt,ut),w=w+Math.imul(Xe,ft)|0,c=c+Math.imul(Xe,ct)|0,c=c+Math.imul(gt,ft)|0,M=M+Math.imul(gt,ct)|0,w=w+Math.imul(be,Qe)|0,c=c+Math.imul(be,kt)|0,c=c+Math.imul(Ze,Qe)|0,M=M+Math.imul(Ze,kt)|0,w=w+Math.imul(ye,Ot)|0,c=c+Math.imul(ye,yt)|0,c=c+Math.imul(Me,Ot)|0,M=M+Math.imul(Me,yt)|0,w=w+Math.imul(se,_t)|0,c=c+Math.imul(se,wt)|0,c=c+Math.imul(ae,_t)|0,M=M+Math.imul(ae,wt)|0;var eo=(R+w|0)+((c&8191)<<13)|0;R=(M+(c>>>13)|0)+(eo>>>26)|0,eo&=67108863,w=Math.imul(Ct,vt),c=Math.imul(Ct,ut),c=c+Math.imul(jt,vt)|0,M=Math.imul(jt,ut),w=w+Math.imul(nt,ft)|0,c=c+Math.imul(nt,ct)|0,c=c+Math.imul(Lt,ft)|0,M=M+Math.imul(Lt,ct)|0,w=w+Math.imul(Xe,Qe)|0,c=c+Math.imul(Xe,kt)|0,c=c+Math.imul(gt,Qe)|0,M=M+Math.imul(gt,kt)|0,w=w+Math.imul(be,Ot)|0,c=c+Math.imul(be,yt)|0,c=c+Math.imul(Ze,Ot)|0,M=M+Math.imul(Ze,yt)|0,w=w+Math.imul(ye,_t)|0,c=c+Math.imul(ye,wt)|0,c=c+Math.imul(Me,_t)|0,M=M+Math.imul(Me,wt)|0,w=w+Math.imul(se,st)|0,c=c+Math.imul(se,It)|0,c=c+Math.imul(ae,st)|0,M=M+Math.imul(ae,It)|0;var to=(R+w|0)+((c&8191)<<13)|0;R=(M+(c>>>13)|0)+(to>>>26)|0,to&=67108863,w=Math.imul(Ue,vt),c=Math.imul(Ue,ut),c=c+Math.imul(rt,vt)|0,M=Math.imul(rt,ut),w=w+Math.imul(Ct,ft)|0,c=c+Math.imul(Ct,ct)|0,c=c+Math.imul(jt,ft)|0,M=M+Math.imul(jt,ct)|0,w=w+Math.imul(nt,Qe)|0,c=c+Math.imul(nt,kt)|0,c=c+Math.imul(Lt,Qe)|0,M=M+Math.imul(Lt,kt)|0,w=w+Math.imul(Xe,Ot)|0,c=c+Math.imul(Xe,yt)|0,c=c+Math.imul(gt,Ot)|0,M=M+Math.imul(gt,yt)|0,w=w+Math.imul(be,_t)|0,c=c+Math.imul(be,wt)|0,c=c+Math.imul(Ze,_t)|0,M=M+Math.imul(Ze,wt)|0,w=w+Math.imul(ye,st)|0,c=c+Math.imul(ye,It)|0,c=c+Math.imul(Me,st)|0,M=M+Math.imul(Me,It)|0,w=w+Math.imul(se,xt)|0,c=c+Math.imul(se,Ft)|0,c=c+Math.imul(ae,xt)|0,M=M+Math.imul(ae,Ft)|0;var or=(R+w|0)+((c&8191)<<13)|0;R=(M+(c>>>13)|0)+(or>>>26)|0,or&=67108863,w=Math.imul(Nt,vt),c=Math.imul(Nt,ut),c=c+Math.imul(it,vt)|0,M=Math.imul(it,ut),w=w+Math.imul(Ue,ft)|0,c=c+Math.imul(Ue,ct)|0,c=c+Math.imul(rt,ft)|0,M=M+Math.imul(rt,ct)|0,w=w+Math.imul(Ct,Qe)|0,c=c+Math.imul(Ct,kt)|0,c=c+Math.imul(jt,Qe)|0,M=M+Math.imul(jt,kt)|0,w=w+Math.imul(nt,Ot)|0,c=c+Math.imul(nt,yt)|0,c=c+Math.imul(Lt,Ot)|0,M=M+Math.imul(Lt,yt)|0,w=w+Math.imul(Xe,_t)|0,c=c+Math.imul(Xe,wt)|0,c=c+Math.imul(gt,_t)|0,M=M+Math.imul(gt,wt)|0,w=w+Math.imul(be,st)|0,c=c+Math.imul(be,It)|0,c=c+Math.imul(Ze,st)|0,M=M+Math.imul(Ze,It)|0,w=w+Math.imul(ye,xt)|0,c=c+Math.imul(ye,Ft)|0,c=c+Math.imul(Me,xt)|0,M=M+Math.imul(Me,Ft)|0,w=w+Math.imul(se,Et)|0,c=c+Math.imul(se,St)|0,c=c+Math.imul(ae,Et)|0,M=M+Math.imul(ae,St)|0;var ci=(R+w|0)+((c&8191)<<13)|0;R=(M+(c>>>13)|0)+(ci>>>26)|0,ci&=67108863,w=Math.imul(He,vt),c=Math.imul(He,ut),c=c+Math.imul(Ge,vt)|0,M=Math.imul(Ge,ut),w=w+Math.imul(Nt,ft)|0,c=c+Math.imul(Nt,ct)|0,c=c+Math.imul(it,ft)|0,M=M+Math.imul(it,ct)|0,w=w+Math.imul(Ue,Qe)|0,c=c+Math.imul(Ue,kt)|0,c=c+Math.imul(rt,Qe)|0,M=M+Math.imul(rt,kt)|0,w=w+Math.imul(Ct,Ot)|0,c=c+Math.imul(Ct,yt)|0,c=c+Math.imul(jt,Ot)|0,M=M+Math.imul(jt,yt)|0,w=w+Math.imul(nt,_t)|0,c=c+Math.imul(nt,wt)|0,c=c+Math.imul(Lt,_t)|0,M=M+Math.imul(Lt,wt)|0,w=w+Math.imul(Xe,st)|0,c=c+Math.imul(Xe,It)|0,c=c+Math.imul(gt,st)|0,M=M+Math.imul(gt,It)|0,w=w+Math.imul(be,xt)|0,c=c+Math.imul(be,Ft)|0,c=c+Math.imul(Ze,xt)|0,M=M+Math.imul(Ze,Ft)|0,w=w+Math.imul(ye,Et)|0,c=c+Math.imul(ye,St)|0,c=c+Math.imul(Me,Et)|0,M=M+Math.imul(Me,St)|0,w=w+Math.imul(se,Ut)|0,c=c+Math.imul(se,Wt)|0,c=c+Math.imul(ae,Ut)|0,M=M+Math.imul(ae,Wt)|0;var no=(R+w|0)+((c&8191)<<13)|0;R=(M+(c>>>13)|0)+(no>>>26)|0,no&=67108863,w=Math.imul(Ne,vt),c=Math.imul(Ne,ut),c=c+Math.imul(lt,vt)|0,M=Math.imul(lt,ut),w=w+Math.imul(He,ft)|0,c=c+Math.imul(He,ct)|0,c=c+Math.imul(Ge,ft)|0,M=M+Math.imul(Ge,ct)|0,w=w+Math.imul(Nt,Qe)|0,c=c+Math.imul(Nt,kt)|0,c=c+Math.imul(it,Qe)|0,M=M+Math.imul(it,kt)|0,w=w+Math.imul(Ue,Ot)|0,c=c+Math.imul(Ue,yt)|0,c=c+Math.imul(rt,Ot)|0,M=M+Math.imul(rt,yt)|0,w=w+Math.imul(Ct,_t)|0,c=c+Math.imul(Ct,wt)|0,c=c+Math.imul(jt,_t)|0,M=M+Math.imul(jt,wt)|0,w=w+Math.imul(nt,st)|0,c=c+Math.imul(nt,It)|0,c=c+Math.imul(Lt,st)|0,M=M+Math.imul(Lt,It)|0,w=w+Math.imul(Xe,xt)|0,c=c+Math.imul(Xe,Ft)|0,c=c+Math.imul(gt,xt)|0,M=M+Math.imul(gt,Ft)|0,w=w+Math.imul(be,Et)|0,c=c+Math.imul(be,St)|0,c=c+Math.imul(Ze,Et)|0,M=M+Math.imul(Ze,St)|0,w=w+Math.imul(ye,Ut)|0,c=c+Math.imul(ye,Wt)|0,c=c+Math.imul(Me,Ut)|0,M=M+Math.imul(Me,Wt)|0,w=w+Math.imul(se,Bt)|0,c=c+Math.imul(se,zt)|0,c=c+Math.imul(ae,Bt)|0,M=M+Math.imul(ae,zt)|0;var hi=(R+w|0)+((c&8191)<<13)|0;R=(M+(c>>>13)|0)+(hi>>>26)|0,hi&=67108863,w=Math.imul(Ne,ft),c=Math.imul(Ne,ct),c=c+Math.imul(lt,ft)|0,M=Math.imul(lt,ct),w=w+Math.imul(He,Qe)|0,c=c+Math.imul(He,kt)|0,c=c+Math.imul(Ge,Qe)|0,M=M+Math.imul(Ge,kt)|0,w=w+Math.imul(Nt,Ot)|0,c=c+Math.imul(Nt,yt)|0,c=c+Math.imul(it,Ot)|0,M=M+Math.imul(it,yt)|0,w=w+Math.imul(Ue,_t)|0,c=c+Math.imul(Ue,wt)|0,c=c+Math.imul(rt,_t)|0,M=M+Math.imul(rt,wt)|0,w=w+Math.imul(Ct,st)|0,c=c+Math.imul(Ct,It)|0,c=c+Math.imul(jt,st)|0,M=M+Math.imul(jt,It)|0,w=w+Math.imul(nt,xt)|0,c=c+Math.imul(nt,Ft)|0,c=c+Math.imul(Lt,xt)|0,M=M+Math.imul(Lt,Ft)|0,w=w+Math.imul(Xe,Et)|0,c=c+Math.imul(Xe,St)|0,c=c+Math.imul(gt,Et)|0,M=M+Math.imul(gt,St)|0,w=w+Math.imul(be,Ut)|0,c=c+Math.imul(be,Wt)|0,c=c+Math.imul(Ze,Ut)|0,M=M+Math.imul(Ze,Wt)|0,w=w+Math.imul(ye,Bt)|0,c=c+Math.imul(ye,zt)|0,c=c+Math.imul(Me,Bt)|0,M=M+Math.imul(Me,zt)|0;var ro=(R+w|0)+((c&8191)<<13)|0;R=(M+(c>>>13)|0)+(ro>>>26)|0,ro&=67108863,w=Math.imul(Ne,Qe),c=Math.imul(Ne,kt),c=c+Math.imul(lt,Qe)|0,M=Math.imul(lt,kt),w=w+Math.imul(He,Ot)|0,c=c+Math.imul(He,yt)|0,c=c+Math.imul(Ge,Ot)|0,M=M+Math.imul(Ge,yt)|0,w=w+Math.imul(Nt,_t)|0,c=c+Math.imul(Nt,wt)|0,c=c+Math.imul(it,_t)|0,M=M+Math.imul(it,wt)|0,w=w+Math.imul(Ue,st)|0,c=c+Math.imul(Ue,It)|0,c=c+Math.imul(rt,st)|0,M=M+Math.imul(rt,It)|0,w=w+Math.imul(Ct,xt)|0,c=c+Math.imul(Ct,Ft)|0,c=c+Math.imul(jt,xt)|0,M=M+Math.imul(jt,Ft)|0,w=w+Math.imul(nt,Et)|0,c=c+Math.imul(nt,St)|0,c=c+Math.imul(Lt,Et)|0,M=M+Math.imul(Lt,St)|0,w=w+Math.imul(Xe,Ut)|0,c=c+Math.imul(Xe,Wt)|0,c=c+Math.imul(gt,Ut)|0,M=M+Math.imul(gt,Wt)|0,w=w+Math.imul(be,Bt)|0,c=c+Math.imul(be,zt)|0,c=c+Math.imul(Ze,Bt)|0,M=M+Math.imul(Ze,zt)|0;var io=(R+w|0)+((c&8191)<<13)|0;R=(M+(c>>>13)|0)+(io>>>26)|0,io&=67108863,w=Math.imul(Ne,Ot),c=Math.imul(Ne,yt),c=c+Math.imul(lt,Ot)|0,M=Math.imul(lt,yt),w=w+Math.imul(He,_t)|0,c=c+Math.imul(He,wt)|0,c=c+Math.imul(Ge,_t)|0,M=M+Math.imul(Ge,wt)|0,w=w+Math.imul(Nt,st)|0,c=c+Math.imul(Nt,It)|0,c=c+Math.imul(it,st)|0,M=M+Math.imul(it,It)|0,w=w+Math.imul(Ue,xt)|0,c=c+Math.imul(Ue,Ft)|0,c=c+Math.imul(rt,xt)|0,M=M+Math.imul(rt,Ft)|0,w=w+Math.imul(Ct,Et)|0,c=c+Math.imul(Ct,St)|0,c=c+Math.imul(jt,Et)|0,M=M+Math.imul(jt,St)|0,w=w+Math.imul(nt,Ut)|0,c=c+Math.imul(nt,Wt)|0,c=c+Math.imul(Lt,Ut)|0,M=M+Math.imul(Lt,Wt)|0,w=w+Math.imul(Xe,Bt)|0,c=c+Math.imul(Xe,zt)|0,c=c+Math.imul(gt,Bt)|0,M=M+Math.imul(gt,zt)|0;var di=(R+w|0)+((c&8191)<<13)|0;R=(M+(c>>>13)|0)+(di>>>26)|0,di&=67108863,w=Math.imul(Ne,_t),c=Math.imul(Ne,wt),c=c+Math.imul(lt,_t)|0,M=Math.imul(lt,wt),w=w+Math.imul(He,st)|0,c=c+Math.imul(He,It)|0,c=c+Math.imul(Ge,st)|0,M=M+Math.imul(Ge,It)|0,w=w+Math.imul(Nt,xt)|0,c=c+Math.imul(Nt,Ft)|0,c=c+Math.imul(it,xt)|0,M=M+Math.imul(it,Ft)|0,w=w+Math.imul(Ue,Et)|0,c=c+Math.imul(Ue,St)|0,c=c+Math.imul(rt,Et)|0,M=M+Math.imul(rt,St)|0,w=w+Math.imul(Ct,Ut)|0,c=c+Math.imul(Ct,Wt)|0,c=c+Math.imul(jt,Ut)|0,M=M+Math.imul(jt,Wt)|0,w=w+Math.imul(nt,Bt)|0,c=c+Math.imul(nt,zt)|0,c=c+Math.imul(Lt,Bt)|0,M=M+Math.imul(Lt,zt)|0;var hs=(R+w|0)+((c&8191)<<13)|0;R=(M+(c>>>13)|0)+(hs>>>26)|0,hs&=67108863,w=Math.imul(Ne,st),c=Math.imul(Ne,It),c=c+Math.imul(lt,st)|0,M=Math.imul(lt,It),w=w+Math.imul(He,xt)|0,c=c+Math.imul(He,Ft)|0,c=c+Math.imul(Ge,xt)|0,M=M+Math.imul(Ge,Ft)|0,w=w+Math.imul(Nt,Et)|0,c=c+Math.imul(Nt,St)|0,c=c+Math.imul(it,Et)|0,M=M+Math.imul(it,St)|0,w=w+Math.imul(Ue,Ut)|0,c=c+Math.imul(Ue,Wt)|0,c=c+Math.imul(rt,Ut)|0,M=M+Math.imul(rt,Wt)|0,w=w+Math.imul(Ct,Bt)|0,c=c+Math.imul(Ct,zt)|0,c=c+Math.imul(jt,Bt)|0,M=M+Math.imul(jt,zt)|0;var ds=(R+w|0)+((c&8191)<<13)|0;R=(M+(c>>>13)|0)+(ds>>>26)|0,ds&=67108863,w=Math.imul(Ne,xt),c=Math.imul(Ne,Ft),c=c+Math.imul(lt,xt)|0,M=Math.imul(lt,Ft),w=w+Math.imul(He,Et)|0,c=c+Math.imul(He,St)|0,c=c+Math.imul(Ge,Et)|0,M=M+Math.imul(Ge,St)|0,w=w+Math.imul(Nt,Ut)|0,c=c+Math.imul(Nt,Wt)|0,c=c+Math.imul(it,Ut)|0,M=M+Math.imul(it,Wt)|0,w=w+Math.imul(Ue,Bt)|0,c=c+Math.imul(Ue,zt)|0,c=c+Math.imul(rt,Bt)|0,M=M+Math.imul(rt,zt)|0;var jn=(R+w|0)+((c&8191)<<13)|0;R=(M+(c>>>13)|0)+(jn>>>26)|0,jn&=67108863,w=Math.imul(Ne,Et),c=Math.imul(Ne,St),c=c+Math.imul(lt,Et)|0,M=Math.imul(lt,St),w=w+Math.imul(He,Ut)|0,c=c+Math.imul(He,Wt)|0,c=c+Math.imul(Ge,Ut)|0,M=M+Math.imul(Ge,Wt)|0,w=w+Math.imul(Nt,Bt)|0,c=c+Math.imul(Nt,zt)|0,c=c+Math.imul(it,Bt)|0,M=M+Math.imul(it,zt)|0;var so=(R+w|0)+((c&8191)<<13)|0;R=(M+(c>>>13)|0)+(so>>>26)|0,so&=67108863,w=Math.imul(Ne,Ut),c=Math.imul(Ne,Wt),c=c+Math.imul(lt,Ut)|0,M=Math.imul(lt,Wt),w=w+Math.imul(He,Bt)|0,c=c+Math.imul(He,zt)|0,c=c+Math.imul(Ge,Bt)|0,M=M+Math.imul(Ge,zt)|0;var oo=(R+w|0)+((c&8191)<<13)|0;R=(M+(c>>>13)|0)+(oo>>>26)|0,oo&=67108863,w=Math.imul(Ne,Bt),c=Math.imul(Ne,zt),c=c+Math.imul(lt,Bt)|0,M=Math.imul(lt,zt);var ao=(R+w|0)+((c&8191)<<13)|0;return R=(M+(c>>>13)|0)+(ao>>>26)|0,ao&=67108863,L[0]=Cn,L[1]=Zs,L[2]=Xs,L[3]=Js,L[4]=eo,L[5]=to,L[6]=or,L[7]=ci,L[8]=no,L[9]=hi,L[10]=ro,L[11]=io,L[12]=di,L[13]=hs,L[14]=ds,L[15]=jn,L[16]=so,L[17]=oo,L[18]=ao,R!==0&&(L[19]=R,S.length++),S};Math.imul||(K=z);function me(P,f,m){m.negative=f.negative^P.negative,m.length=P.length+f.length;for(var S=0,k=0,T=0;T>>26)|0,k+=L>>>26,L&=67108863}m.words[T]=R,S=L,L=k}return S!==0?m.words[T]=S:m.length--,m.strip()}function N(P,f,m){var S=new A;return S.mulp(P,f,m)}a.prototype.mulTo=function(f,m){var S,k=this.length+f.length;return this.length===10&&f.length===10?S=K(this,f,m):k<63?S=z(this,f,m):k<1024?S=me(this,f,m):S=N(this,f,m),S};function A(P,f){this.x=P,this.y=f}A.prototype.makeRBT=function(f){for(var m=new Array(f),S=a.prototype._countBits(f)-1,k=0;k>=1;return k},A.prototype.permute=function(f,m,S,k,T,L){for(var R=0;R>>1)T++;return 1<>>13,S[2*L+1]=T&8191,T=T>>>13;for(L=2*m;L>=26,m+=k/67108864|0,m+=T>>>26,this.words[S]=T&67108863}return m!==0&&(this.words[S]=m,this.length++),this},a.prototype.muln=function(f){return this.clone().imuln(f)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(f){var m=F(f);if(m.length===0)return new a(1);for(var S=this,k=0;k=0);var m=f%26,S=(f-m)/26,k=67108863>>>26-m<<26-m,T;if(m!==0){var L=0;for(T=0;T>>26-m}L&&(this.words[T]=L,this.length++)}if(S!==0){for(T=this.length-1;T>=0;T--)this.words[T+S]=this.words[T];for(T=0;T=0);var k;m?k=(m-m%26)/26:k=0;var T=f%26,L=Math.min((f-T)/26,this.length),R=67108863^67108863>>>T<L)for(this.length-=L,c=0;c=0&&(M!==0||c>=k);c--){var G=this.words[c]|0;this.words[c]=M<<26-T|G>>>T,M=G&R}return w&&M!==0&&(w.words[w.length++]=M),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(f,m,S){return r(this.negative===0),this.iushrn(f,m,S)},a.prototype.shln=function(f){return this.clone().ishln(f)},a.prototype.ushln=function(f){return this.clone().iushln(f)},a.prototype.shrn=function(f){return this.clone().ishrn(f)},a.prototype.ushrn=function(f){return this.clone().iushrn(f)},a.prototype.testn=function(f){r(typeof f=="number"&&f>=0);var m=f%26,S=(f-m)/26,k=1<=0);var m=f%26,S=(f-m)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=S)return this;if(m!==0&&S++,this.length=Math.min(S,this.length),m!==0){var k=67108863^67108863>>>m<=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},a.prototype.isubn=function(f){if(r(typeof f=="number"),r(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m>26)-(w/67108864|0),this.words[T+S]=L&67108863}for(;T>26,this.words[T+S]=L&67108863;if(R===0)return this.strip();for(r(R===-1),R=0,T=0;T>26,this.words[T]=L&67108863;return this.negative=1,this.strip()},a.prototype._wordDiv=function(f,m){var S=this.length-f.length,k=this.clone(),T=f,L=T.words[T.length-1]|0,R=this._countBits(L);S=26-R,S!==0&&(T=T.ushln(S),k.iushln(S),L=T.words[T.length-1]|0);var w=k.length-T.length,c;if(m!=="mod"){c=new a(null),c.length=w+1,c.words=new Array(c.length);for(var M=0;M=0;se--){var ae=(k.words[T.length+se]|0)*67108864+(k.words[T.length+se-1]|0);for(ae=Math.min(ae/L|0,67108863),k._ishlnsubmul(T,ae,se);k.negative!==0;)ae--,k.negative=0,k._ishlnsubmul(T,1,se),k.isZero()||(k.negative^=1);c&&(c.words[se]=ae)}return c&&c.strip(),k.strip(),m!=="div"&&S!==0&&k.iushrn(S),{div:c||null,mod:k}},a.prototype.divmod=function(f,m,S){if(r(!f.isZero()),this.isZero())return{div:new a(0),mod:new a(0)};var k,T,L;return this.negative!==0&&f.negative===0?(L=this.neg().divmod(f,m),m!=="mod"&&(k=L.div.neg()),m!=="div"&&(T=L.mod.neg(),S&&T.negative!==0&&T.iadd(f)),{div:k,mod:T}):this.negative===0&&f.negative!==0?(L=this.divmod(f.neg(),m),m!=="mod"&&(k=L.div.neg()),{div:k,mod:L.mod}):this.negative&f.negative?(L=this.neg().divmod(f.neg(),m),m!=="div"&&(T=L.mod.neg(),S&&T.negative!==0&&T.isub(f)),{div:L.div,mod:T}):f.length>this.length||this.cmp(f)<0?{div:new a(0),mod:this}:f.length===1?m==="div"?{div:this.divn(f.words[0]),mod:null}:m==="mod"?{div:null,mod:new a(this.modn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new a(this.modn(f.words[0]))}:this._wordDiv(f,m)},a.prototype.div=function(f){return this.divmod(f,"div",!1).div},a.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},a.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},a.prototype.divRound=function(f){var m=this.divmod(f);if(m.mod.isZero())return m.div;var S=m.div.negative!==0?m.mod.isub(f):m.mod,k=f.ushrn(1),T=f.andln(1),L=S.cmp(k);return L<0||T===1&&L===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},a.prototype.modn=function(f){r(f<=67108863);for(var m=(1<<26)%f,S=0,k=this.length-1;k>=0;k--)S=(m*S+(this.words[k]|0))%f;return S},a.prototype.idivn=function(f){r(f<=67108863);for(var m=0,S=this.length-1;S>=0;S--){var k=(this.words[S]|0)+m*67108864;this.words[S]=k/f|0,m=k%f}return this.strip()},a.prototype.divn=function(f){return this.clone().idivn(f)},a.prototype.egcd=function(f){r(f.negative===0),r(!f.isZero());var m=this,S=f.clone();m.negative!==0?m=m.umod(f):m=m.clone();for(var k=new a(1),T=new a(0),L=new a(0),R=new a(1),w=0;m.isEven()&&S.isEven();)m.iushrn(1),S.iushrn(1),++w;for(var c=S.clone(),M=m.clone();!m.isZero();){for(var G=0,se=1;!(m.words[0]&se)&&G<26;++G,se<<=1);if(G>0)for(m.iushrn(G);G-- >0;)(k.isOdd()||T.isOdd())&&(k.iadd(c),T.isub(M)),k.iushrn(1),T.iushrn(1);for(var ae=0,re=1;!(S.words[0]&re)&&ae<26;++ae,re<<=1);if(ae>0)for(S.iushrn(ae);ae-- >0;)(L.isOdd()||R.isOdd())&&(L.iadd(c),R.isub(M)),L.iushrn(1),R.iushrn(1);m.cmp(S)>=0?(m.isub(S),k.isub(L),T.isub(R)):(S.isub(m),L.isub(k),R.isub(T))}return{a:L,b:R,gcd:S.iushln(w)}},a.prototype._invmp=function(f){r(f.negative===0),r(!f.isZero());var m=this,S=f.clone();m.negative!==0?m=m.umod(f):m=m.clone();for(var k=new a(1),T=new a(0),L=S.clone();m.cmpn(1)>0&&S.cmpn(1)>0;){for(var R=0,w=1;!(m.words[0]&w)&&R<26;++R,w<<=1);if(R>0)for(m.iushrn(R);R-- >0;)k.isOdd()&&k.iadd(L),k.iushrn(1);for(var c=0,M=1;!(S.words[0]&M)&&c<26;++c,M<<=1);if(c>0)for(S.iushrn(c);c-- >0;)T.isOdd()&&T.iadd(L),T.iushrn(1);m.cmp(S)>=0?(m.isub(S),k.isub(T)):(S.isub(m),T.isub(k))}var G;return m.cmpn(1)===0?G=k:G=T,G.cmpn(0)<0&&G.iadd(f),G},a.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var m=this.clone(),S=f.clone();m.negative=0,S.negative=0;for(var k=0;m.isEven()&&S.isEven();k++)m.iushrn(1),S.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;S.isEven();)S.iushrn(1);var T=m.cmp(S);if(T<0){var L=m;m=S,S=L}else if(T===0||S.cmpn(1)===0)break;m.isub(S)}while(!0);return S.iushln(k)},a.prototype.invm=function(f){return this.egcd(f).a.umod(f)},a.prototype.isEven=function(){return(this.words[0]&1)===0},a.prototype.isOdd=function(){return(this.words[0]&1)===1},a.prototype.andln=function(f){return this.words[0]&f},a.prototype.bincn=function(f){r(typeof f=="number");var m=f%26,S=(f-m)/26,k=1<>>26,R&=67108863,this.words[L]=R}return T!==0&&(this.words[L]=T,this.length++),this},a.prototype.isZero=function(){return this.length===1&&this.words[0]===0},a.prototype.cmpn=function(f){var m=f<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this.strip();var S;if(this.length>1)S=1;else{m&&(f=-f),r(f<=67108863,"Number is too big");var k=this.words[0]|0;S=k===f?0:kf.length)return 1;if(this.length=0;S--){var k=this.words[S]|0,T=f.words[S]|0;if(k!==T){kT&&(m=1);break}}return m},a.prototype.gtn=function(f){return this.cmpn(f)===1},a.prototype.gt=function(f){return this.cmp(f)===1},a.prototype.gten=function(f){return this.cmpn(f)>=0},a.prototype.gte=function(f){return this.cmp(f)>=0},a.prototype.ltn=function(f){return this.cmpn(f)===-1},a.prototype.lt=function(f){return this.cmp(f)===-1},a.prototype.lten=function(f){return this.cmpn(f)<=0},a.prototype.lte=function(f){return this.cmp(f)<=0},a.prototype.eqn=function(f){return this.cmpn(f)===0},a.prototype.eq=function(f){return this.cmp(f)===0},a.red=function(f){return new le(f)},a.prototype.toRed=function(f){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},a.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(f){return this.red=f,this},a.prototype.forceRed=function(f){return r(!this.red,"Already a number in reduction context"),this._forceRed(f)},a.prototype.redAdd=function(f){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},a.prototype.redIAdd=function(f){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},a.prototype.redSub=function(f){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},a.prototype.redISub=function(f){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},a.prototype.redShl=function(f){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},a.prototype.redMul=function(f){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},a.prototype.redIMul=function(f){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},a.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(f){return r(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var I={k256:null,p224:null,p192:null,p25519:null};function Y(P,f){this.name=P,this.p=new a(f,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Y.prototype._tmp=function(){var f=new a(null);return f.words=new Array(Math.ceil(this.n/13)),f},Y.prototype.ireduce=function(f){var m=f,S;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),S=m.bitLength();while(S>this.n);var k=S0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},Y.prototype.split=function(f,m){f.iushrn(this.n,0,m)},Y.prototype.imulK=function(f){return f.imul(this.k)};function X(){Y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(X,Y),X.prototype.split=function(f,m){for(var S=4194303,k=Math.min(f.length,9),T=0;T>>22,L=R}L>>>=22,f.words[T-10]=L,L===0&&f.length>10?f.length-=10:f.length-=9},X.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var m=0,S=0;S>>=26,f.words[S]=T,m=k}return m!==0&&(f.words[f.length++]=m),f},a._prime=function(f){if(I[f])return I[f];var m;if(f==="k256")m=new X;else if(f==="p224")m=new te;else if(f==="p192")m=new V;else if(f==="p25519")m=new J;else throw new Error("Unknown prime "+f);return I[f]=m,m};function le(P){if(typeof P=="string"){var f=a._prime(P);this.m=f.p,this.prime=f}else r(P.gtn(1),"modulus must be greater than 1"),this.m=P,this.prime=null}le.prototype._verify1=function(f){r(f.negative===0,"red works only with positives"),r(f.red,"red works only with red numbers")},le.prototype._verify2=function(f,m){r((f.negative|m.negative)===0,"red works only with positives"),r(f.red&&f.red===m.red,"red works only with red numbers")},le.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):f.umod(this.m)._forceRed(this)},le.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},le.prototype.add=function(f,m){this._verify2(f,m);var S=f.add(m);return S.cmp(this.m)>=0&&S.isub(this.m),S._forceRed(this)},le.prototype.iadd=function(f,m){this._verify2(f,m);var S=f.iadd(m);return S.cmp(this.m)>=0&&S.isub(this.m),S},le.prototype.sub=function(f,m){this._verify2(f,m);var S=f.sub(m);return S.cmpn(0)<0&&S.iadd(this.m),S._forceRed(this)},le.prototype.isub=function(f,m){this._verify2(f,m);var S=f.isub(m);return S.cmpn(0)<0&&S.iadd(this.m),S},le.prototype.shl=function(f,m){return this._verify1(f),this.imod(f.ushln(m))},le.prototype.imul=function(f,m){return this._verify2(f,m),this.imod(f.imul(m))},le.prototype.mul=function(f,m){return this._verify2(f,m),this.imod(f.mul(m))},le.prototype.isqr=function(f){return this.imul(f,f.clone())},le.prototype.sqr=function(f){return this.mul(f,f)},le.prototype.sqrt=function(f){if(f.isZero())return f.clone();var m=this.m.andln(3);if(r(m%2===1),m===3){var S=this.m.add(new a(1)).iushrn(2);return this.pow(f,S)}for(var k=this.m.subn(1),T=0;!k.isZero()&&k.andln(1)===0;)T++,k.iushrn(1);r(!k.isZero());var L=new a(1).toRed(this),R=L.redNeg(),w=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new a(2*c*c).toRed(this);this.pow(c,w).cmp(R)!==0;)c.redIAdd(R);for(var M=this.pow(c,k),G=this.pow(f,k.addn(1).iushrn(1)),se=this.pow(f,k),ae=T;se.cmp(L)!==0;){for(var re=se,ye=0;re.cmp(L)!==0;ye++)re=re.redSqr();r(ye=0;T--){for(var M=m.words[T],G=c-1;G>=0;G--){var se=M>>G&1;if(L!==k[0]&&(L=this.sqr(L)),se===0&&R===0){w=0;continue}R<<=1,R|=se,w++,!(w!==S&&(T!==0||G!==0))&&(L=this.mul(L,k[R]),w=0,R=0)}c=26}return L},le.prototype.convertTo=function(f){var m=f.umod(this.m);return m===f?m.clone():m},le.prototype.convertFrom=function(f){var m=f.clone();return m.red=null,m},a.mont=function(f){return new fe(f)};function fe(P){le.call(this,P),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}s(fe,le),fe.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},fe.prototype.convertFrom=function(f){var m=this.imod(f.mul(this.rinv));return m.red=null,m},fe.prototype.imul=function(f,m){if(f.isZero()||m.isZero())return f.words[0]=0,f.length=1,f;var S=f.imul(m),k=S.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=S.isub(k).iushrn(this.shift),L=T;return T.cmp(this.m)>=0?L=T.isub(this.m):T.cmpn(0)<0&&(L=T.iadd(this.m)),L._forceRed(this)},fe.prototype.mul=function(f,m){if(f.isZero()||m.isZero())return new a(0)._forceRed(this);var S=f.mul(m),k=S.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=S.isub(k).iushrn(this.shift),L=T;return T.cmp(this.m)>=0?L=T.isub(this.m):T.cmpn(0)<0&&(L=T.iadd(this.m)),L._forceRed(this)},fe.prototype.invm=function(f){var m=this.imod(f._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(e,Ir)})(kg);var Og=kg.exports,r_=1/0,LS=9007199254740991,kj=17976931348623157e292,i_=NaN,Oj="[object Function]",Ej="[object GeneratorFunction]",Tj="[object Symbol]",Pj=/^\s+|\s+$/g,Rj=/^[-+]0x[0-9a-f]+$/i,bj=/^0b[01]+$/i,Dj=/^0o[0-7]+$/i,Aj=/^(?:0|[1-9]\d*)$/,Lj=parseInt,jj=Object.prototype,jS=jj.toString,Nj=Math.ceil,Ij=Math.max;function Fj(e,t,n){var r=-1,s=e.length;t<0&&(t=-t>s?0:s+t),n=n>s?s:n,n<0&&(n+=s),s=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(s);++r-1&&e%1==0&&e-1&&e%1==0&&e<=LS}function Jc(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Gj(e){return!!e&&typeof e=="object"}function Vj(e){return typeof e=="symbol"||Gj(e)&&jS.call(e)==Tj}function qj(e){if(!e)return e===0?e:0;if(e=Kj(e),e===r_||e===-r_){var t=e<0?-1:1;return t*kj}return e===e?e:0}function Qj(e){var t=qj(e),n=t%1;return t===t?n?t-n:t:0}function Kj(e){if(typeof e=="number")return e;if(Vj(e))return i_;if(Jc(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Jc(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(Pj,"");var n=bj.test(e);return n||Dj.test(e)?Lj(e.slice(2),n?2:8):Rj.test(e)?i_:+e}var Zj=Bj,eh={exports:{}};eh.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",s=1,a=2,u=9007199254740991,h="[object Arguments]",p="[object Array]",g="[object AsyncFunction]",v="[object Boolean]",O="[object Date]",b="[object Error]",F="[object Function]",z="[object GeneratorFunction]",K="[object Map]",me="[object Number]",N="[object Null]",A="[object Object]",I="[object Promise]",Y="[object Proxy]",X="[object RegExp]",te="[object Set]",V="[object String]",J="[object Symbol]",le="[object Undefined]",fe="[object WeakMap]",P="[object ArrayBuffer]",f="[object DataView]",m="[object Float32Array]",S="[object Float64Array]",k="[object Int8Array]",T="[object Int16Array]",L="[object Int32Array]",R="[object Uint8Array]",w="[object Uint8ClampedArray]",c="[object Uint16Array]",M="[object Uint32Array]",G=/[\\^$.*+?()[\]{}|]/g,se=/^\[object .+?Constructor\]$/,ae=/^(?:0|[1-9]\d*)$/,re={};re[m]=re[S]=re[k]=re[T]=re[L]=re[R]=re[w]=re[c]=re[M]=!0,re[h]=re[p]=re[P]=re[v]=re[f]=re[O]=re[b]=re[F]=re[K]=re[me]=re[A]=re[X]=re[te]=re[V]=re[fe]=!1;var ye=typeof Ir=="object"&&Ir&&Ir.Object===Object&&Ir,Me=typeof self=="object"&&self&&self.Object===Object&&self,ze=ye||Me||Function("return this")(),be=t&&!t.nodeType&&t,Ze=be&&!0&&e&&!e.nodeType&&e,li=Ze&&Ze.exports===be,Xe=li&&ye.process,gt=function(){try{return Xe&&Xe.binding&&Xe.binding("util")}catch{}}(),_n=gt&>.isTypedArray;function nt(E,W){for(var Z=-1,he=E==null?0:E.length,dt=0,ke=[];++Z-1}function to(E,W){var Z=this.__data__,he=lo(Z,E);return he<0?(++this.size,Z.push([E,W])):Z[he][1]=W,this}Cn.prototype.clear=Zs,Cn.prototype.delete=Xs,Cn.prototype.get=Js,Cn.prototype.has=eo,Cn.prototype.set=to;function or(E){var W=-1,Z=E==null?0:E.length;for(this.clear();++Wsn))return!1;var pt=ke.get(E);if(pt&&ke.get(W))return pt==W;var Jt=-1,Vn=!0,on=Z&a?new di:void 0;for(ke.set(E,W),ke.set(W,E);++Jt-1&&E%1==0&&E-1&&E%1==0&&E<=u}function Gu(E){var W=typeof E;return E!=null&&(W=="object"||W=="function")}function co(E){return E!=null&&typeof E=="object"}var Vu=_n?jt(_n):Lu;function sd(E){return rd(E)?Du(E):ju(E)}function ht(){return[]}function ot(){return!1}e.exports=id})(eh,eh.exports);var Xj=eh.exports;const Yh=Og,Jj=new Yh(255),e6=new Yh(65280),t6=new Yh(256),n6=(e,t,n)=>{const r=n.and(Jj).toNumber(),s=n.and(e6).div(t6).toNumber(),a=String.fromCharCode(r)+String.fromCharCode(s);return new Yh(r6(a,e))},r6=(e,t)=>{let n,r,s,a,u,h,p,g;for(n=e.length&3,r=e.length-n,s=t,u=3432918353,h=461845907,g=0;g>>16)*u&65535)<<16)&4294967295,p=p<<15|p>>>17,p=(p&65535)*h+(((p>>>16)*h&65535)<<16)&4294967295,s^=p,s=s<<13|s>>>19,a=(s&65535)*5+(((s>>>16)*5&65535)<<16)&4294967295,s=(a&65535)+27492+(((a>>>16)+58964&65535)<<16);switch(p=0,n){case 3:p^=(e.charCodeAt(g+2)&255)<<16;case 2:p^=(e.charCodeAt(g+1)&255)<<8;case 1:p^=e.charCodeAt(g)&255,p=(p&65535)*u+(((p>>>16)*u&65535)<<16)&4294967295,p=p<<15|p>>>17,p=(p&65535)*h+(((p>>>16)*h&65535)<<16)&4294967295,s^=p}return s^=e.length,s^=s>>>16,s=(s&65535)*2246822507+(((s>>>16)*2246822507&65535)<<16)&4294967295,s^=s>>>13,s=(s&65535)*3266489909+(((s>>>16)*3266489909&65535)<<16)&4294967295,s^=s>>>16,s>>>0};var i6={muk:n6};const ai=Og,{muk:s6}=i6,Fa=new ai("10000","hex"),Qa=new ai("ffffffff","hex"),NS=new ai("100000000","hex"),IS=new ai("ffffffffffffffff","hex"),FS=new ai("ffffffff00000000","hex"),US=new ai("65535"),WS=new ai("65536"),Eg=(e,t)=>s6([3077398253,3995603712,2243735041,1261992695][e],2,t),o6=e=>{const t=n=>{const r=n.and(Qa),s=n.and(FS);return n.gte(Fa)&&n.lte(Qa)?Fa.add(BS(n.sub(Fa))):n.gte(NS)&&n.lte(IS)?s.or(t(r)):n};return t(new ai(e))},a6=e=>{const t=n=>{const r=n.and(Qa),s=n.and(FS);return n.gte(Fa)&&n.lte(Qa)?Fa.add($S(n.sub(Fa))):n.gte(NS)&&n.lte(IS)?s.or(t(r)):n};return t(new ai(e))},BS=e=>zS(4,US,WS,Qa,Eg,new ai(e)),zS=(e,t,n,r,s,a)=>{const u=V0(e,t,n,s,a);return u.lt(r)?u:V0(e,t,n,s,u)},V0=(e,t,n,r,s)=>{const a=(p,g,v)=>{if(p>e)return e%2!==0||v.eq(t)?t.mul(v).add(g):t.mul(g).add(v);{const O=r(p-1,v),b=p%2!==0?g.add(O).mod(t):g.add(O).mod(n);return a(p+1,v,b)}},u=s.mod(t),h=s.div(t);return a(1,u,h)},$S=e=>YS(4,US,WS,Qa,Eg,new ai(e)),YS=(e,t,n,r,s,a)=>{const u=q0(e,t,n,s,a);return u.lt(r)?u:q0(e,t,n,s,u)},q0=(e,t,n,r,s)=>{const a=(v,O,b)=>{if(v<1)return t.mul(b).add(O);{const F=r(v-1,O),z=v%2!==0?b.add(t).sub(F.mod(t)).mod(t):b.add(n).sub(F.mod(n)).mod(n);return a(v-1,z,O)}},u=e%2!==0?s.div(t):s.mod(t),h=e%2!==0?s.mod(t):s.div(t),p=h.eq(t)?u:h,g=h.eq(t)?h:u;return a(e,p,g)};var HS={F:Eg,fe:V0,Fe:zS,feis:BS,fein:o6,fen:q0,Fen:YS,tail:$S,fynd:a6};const Mr=Og,s_=Zj,l6=Xj,GS=HS,Ua=new Mr(0),Nr=new Mr(1),VS=new Mr(2),ql=new Mr(3),Ta=new Mr(4),u6=new Mr(5),f6=` +dozmarbinwansamlitsighidfidlissogdirwacsabwissibrigsoldopmodfoglidhopdardorlorhodfolrintogsilmirholpaslacrovlivdalsatlibtabhanticpidtorbolfosdotlosdilforpilramtirwintadbicdifrocwidbisdasmidloprilnardapmolsanlocnovsitnidtipsicropwitnatpanminritpodmottamtolsavposnapnopsomfinfonbanmorworsipronnorbotwicsocwatdolmagpicdavbidbaltimtasmalligsivtagpadsaldivdactansidfabtarmonranniswolmispallasdismaprabtobrollatlonnodnavfignomnibpagsopralbilhaddocridmocpacravripfaltodtiltinhapmicfanpattaclabmogsimsonpinlomrictapfirhasbosbatpochactidhavsaplindibhosdabbitbarracparloddosbortochilmactomdigfilfasmithobharmighinradmashalraglagfadtopmophabnilnosmilfopfamdatnoldinhatnacrisfotribhocnimlarfitwalrapsarnalmoslandondanladdovrivbacpollaptalpitnambonrostonfodponsovnocsorlavmatmipfip`,c6=` +zodnecbudwessevpersutletfulpensytdurwepserwylsunrypsyxdyrnuphebpeglupdepdysputlughecryttyvsydnexlunmeplutseppesdelsulpedtemledtulmetwenbynhexfebpyldulhetmevruttylwydtepbesdexsefwycburderneppurrysrebdennutsubpetrulsynregtydsupsemwynrecmegnetsecmulnymtevwebsummutnyxrextebfushepbenmuswyxsymselrucdecwexsyrwetdylmynmesdetbetbeltuxtugmyrpelsyptermebsetdutdegtexsurfeltudnuxruxrenwytnubmedlytdusnebrumtynseglyxpunresredfunrevrefmectedrusbexlebduxrynnumpyxrygryxfeptyrtustyclegnemfermertenlusnussyltecmexpubrymtucfyllepdebbermughuttunbylsudpemdevlurdefbusbeprunmelpexdytbyttyplevmylwedducfurfexnulluclennerlexrupnedlecrydlydfenwelnydhusrelrudneshesfetdesretdunlernyrsebhulrylludremlysfynwerrycsugnysnyllyndyndemluxfedsedbecmunlyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes`,qS=e=>e.replace(/[\^~-]/g,"").match(/.{1,3}/g)||[],h6=(e,t)=>[t.slice(0,e),t.slice(e)],Lo=f6.match(/.{1,3}/g),Ci=c6.match(/.{1,3}/g),th=e=>VS.pow(e),Q0=(e,t,n)=>n.div(th(th(e).mul(t))),nh=(e,t,n=Ua)=>t.eq(Ua)?n:nh(e,Q0(e,Nr,t),n.add(Nr)),Ql=(e,t,n)=>n.mod(th(th(e).mul(t))),d6=e=>{if(e===null)throw new Error("hex2patp: null input");return Hh(new Mr(e,"hex"))},QS=e=>{if(Ou(e)===!1)throw new Error("patp2hex: not a valid @p");const t=qS(e),n=u=>u.toString(2).padStart(8,"0"),r=t.reduce((u,h,p)=>p%2!==0||t.length===1?u+n(Ci.indexOf(h)):u+n(Lo.indexOf(h)),""),s=new Mr(r,2),a=GS.fynd(s).toString("hex");return a.length%2!==0?a.padStart(a.length+1,"0"):a},Tg=e=>new Mr(QS(e),"hex"),KS=e=>{let t;try{t=Tg(e)}catch{throw new Error("patp2dec: not a valid @p")}return t.toString()},ZS=e=>{const n=new Mr(e).toArrayLike(Buffer);return XS(n)},XS=e=>{const t=e.length%2!==0&&e.length>1?[[e[0]]].concat(s_(e.slice(1),2)):s_(e,2),n=a=>a[1]===void 0?Lo[0]+Ci[a[0]]:Lo[a[0]]+Ci[a[1]],r=a=>a[1]===void 0?Ci[a[0]]:Lo[a[0]]+Ci[a[1]],s=a=>a.length%2!==0&&t.length>1?n(a):r(a);return t.reduce((a,u)=>a+(a==="~"?"":"-")+s(u),"~")},p6=e=>{const t=e.length%2!==0?e.padStart(e.length+1,"0"):e,n=Buffer.from(t,"hex");return XS(n)},rh=e=>{if(Ou(e)===!1)throw new Error("patq2hex: not a valid @q");const t=e.slice(1).split("-"),n=s=>s.toString(16).padStart(2,"0"),r=t.map(s=>{let a=h6(3,s);return a[1]===""?n(Ci.indexOf(a[0])):n(Lo.indexOf(a[0]))+n(Ci.indexOf(a[1]))});return e.length===0?"00":r.join("")},m6=e=>new Mr(rh(e),"hex"),JS=e=>{let t;try{t=m6(e)}catch{throw new Error("patq2dec: not a valid @q")}return t.toString()},eM=e=>{let t;try{t=Tg(e)}catch{throw new Error("clan: not a valid @p")}const n=nh(ql,t);return n.lte(Nr)?"galaxy":n.eq(VS)?"star":n.lte(Ta)?"planet":n.lte(new Mr(8))?"moon":"comet"},g6=e=>{let t;try{t=Tg(e)}catch{throw new Error("sein: not a valid @p")}let n;try{n=eM(e)}catch{throw new Error("sein: not a valid @p")}const r=n==="galaxy"?t:n==="star"?Ql(ql,Nr,t):n==="planet"?Ql(Ta,Nr,t):n==="moon"?Ql(u6,Nr,t):Ua;return Hh(r)},Ou=e=>{if(typeof e!="string")throw new Error("isValidPat: non-string input");if(e.slice(0,1)==="~"===!1||e.length<4)return!1;{const n=qS(e),r=n.length%2!==0&&n.length!==1,s=n.reduce((a,u,h)=>a&&(h%2!==0||n.length===1?Ci.includes(u):Lo.includes(u)),!0);return!r&&s}},v6=e=>Ou(e)&&e===Hh(KS(e)),y6=e=>Ou(e)&&tM(e,ZS(JS(e))),K0=e=>e.slice(0,2)==="00"?K0(e.slice(2)):e,_6=(e,t)=>l6(K0(e),K0(t)),tM=(e,t)=>{let n;try{n=rh(e)}catch{throw new Error("eqPatq: not a valid @q")}let r;try{r=rh(t)}catch{throw new Error("eqPatq: not a valid @q")}return _6(n,r)},Hh=e=>{if(e===null)throw new Error("patp: null input");const t=new Mr(e),n=GS.fein(t),r=nh(Ta,n),s=(u,h,p)=>{const g=Ql(Ta,Nr,u),v=Lo[Q0(ql,Nr,g)],O=Ci[Ql(ql,Nr,g)],b=h.mod(Ta).eq(Ua)?h.eq(Ua)?"":"--":"-",F=v+O+b+p;return h.eq(r)?p:s(Q0(Ta,Nr,u),h.add(Nr),F)};return"~"+(nh(ql,n).lte(Nr)?Ci[n]:s(n,Ua,""))};var w6={patp:Hh,patp2hex:QS,hex2patp:d6,patp2dec:KS,sein:g6,clan:eM,patq:ZS,patq2hex:rh,hex2patq:p6,patq2dec:JS,eqPatq:tM,isValidPat:Ou,isValidPatp:v6,isValidPatq:y6};const x6=w6,S6=HS;Object.assign(x6,S6);class Ht extends oe.Component{constructor(t){super(t),this.state={query:""},this.updateQuery=this.updateQuery.bind(this)}updateQuery(t){this.setState({query:t.target.value})}render(){const{state:t,props:n}=this,r=y.jsx("input",{type:"text",placeholder:n.placeholder,onChange:this.updateQuery,value:t.query,style:{border:"1px solid black"}});let s=n.items.filter(a=>t.query.split(" ").reduce((u,h)=>u&&(""+a.key).includes(h),!0));return s=s.map(a=>y.jsx("div",{style:{marginTop:"4px"},children:a.jsx},a.key)),y.jsxs("div",{style:{position:"relative",border:"1px solid grey",padding:"4px"},children:[n.children,y.jsxs("div",{children:[r," (",s.length,")"]}),y.jsxs("details",{open:n.open===void 0?!0:n.open,children:[y.jsxs("summary",{children:[s.length," items"]}),y.jsx("div",{children:s.length===0?"none":s})]})]})}}class M6 extends oe.Component{constructor(t){super(t)}componentDidMount(){this.componentDidUpdate()}componentDidUpdate(t){}render(){const t=this.props,n=t.in.map(s=>({key:"~"+s.ship+" "+s.path,jsx:y.jsxs("div",{class:"flex",children:[y.jsxs("div",{class:"flex-auto",style:{maxWidth:"10%"},children:["~",s.ship]}),y.jsx("div",{class:"flex-auto",style:{maxWidth:"30%"},children:s.path}),y.jsx("div",{class:"flex-auto",style:{maxWidth:"60%"},children:Qi(s.duct)})]})})),r=t.out.map(s=>({key:`~${s.ship} ${s.app} ${s.wire} ${s.path}`,jsx:y.jsxs("div",{class:"flex",children:[y.jsx("div",{class:"flex-auto",style:{maxWidth:"35%"},children:s.wire}),y.jsxs("div",{class:"flex-auto",style:{maxWidth:"10%"},children:["~",s.ship]}),y.jsx("div",{class:"flex-auto",style:{maxWidth:"10%"},children:s.app}),y.jsx("div",{class:"flex-auto",style:{maxWidth:"35%"},children:s.path}),y.jsx("div",{class:"flex-auto",style:{maxWidth:"10%"},children:s.acked?"acked":"not acked"})]})}));return y.jsxs("div",{children:[y.jsx("h4",{children:"Incoming"}),y.jsx(Ht,{placeholder:"ship / path",items:n}),y.jsx("h4",{children:"Outgoing"}),y.jsx(Ht,{placeholder:"ship / app / wire / path",items:r})]})}}class Oo extends oe.Component{constructor(t){super(t),this.onToggle=this.onToggle.bind(this)}onToggle(t){t.target.open?this.props.onOpen&&this.props.onOpen(this.props.id):this.props.onClose&&this.props.onClose(this.props.id)}render(){const{props:t}=this;return y.jsxs("details",{onToggle:this.onToggle,...t,style:{border:"1px solid black",padding:"4px",position:"relative",...t.style},children:[y.jsx("summary",{children:t.summary}),y.jsx("div",{style:{borderTop:"1px solid black"},children:t.details})]})}}class C6 extends oe.Component{constructor(t){super(t),this.state={stateQuery:{}},this.changeStateQuery=this.changeStateQuery.bind(this),this.loadApps=this.loadApps.bind(this),this.loadAppDetails=this.loadAppDetails.bind(this)}componentDidMount(){Object.keys(this.props.apps).length===0&&this.loadApps()}componentDidUpdate(t,n){}changeStateQuery(t,n){this.state.stateQuery[t]=n.target.value,this.setState({stateQuery:this.state.stateQuery})}loadApps(){api.getApps()}loadAppDetails(t){api.getAppDetails(t)}loadAppState(t){api.getAppState(t,this.state.stateQuery[t])}render(){const{props:t,state:n}=this,r=Object.keys(t.apps).sort().map(s=>{const a=t.apps[s],u=typeof a=="object",h=u?!0:a,p=h?{borderLeft:"3px solid green"}:{borderLeft:"3px solid grey"};let g=null;if(!u)g=h?"Loading...":"App not running.";else if(a.noDebug)g="App doesn't use /lib/dbug";else{const O=a,b=(O.events||[]).map(F=>({key:F,jsx:y.jsxs(y.Fragment,{children:[F,y.jsx("br",{})]})}));g=y.jsxs(y.Fragment,{children:[y.jsx("button",{style:{position:"absolute",top:0,right:0},onClick:()=>{this.loadAppDetails(s)},children:"refresh"}),y.jsx("button",{onClick:()=>{this.loadAppState(s)},children:"query state"}),y.jsx("textarea",{class:"mono",onChange:F=>this.changeStateQuery(s,F),value:n.stateQuery[s],placeholder:"-.-",spellCheck:"false"}),y.jsx("div",{style:{maxHeight:"500px",overflow:"scroll"},children:y.jsx("pre",{children:(O.state||O.simpleState).join(` +`)})}),y.jsx("div",{children:y.jsx(M6,{...O.subscriptions})}),y.jsxs("div",{children:[y.jsx("button",{onClick:()=>{api.bindToVerb(s)},children:"listen to verb"}),y.jsx(Ht,{placeholder:"event description",items:b})]})]})}const v=h?this.loadAppDetails:null;return{key:s,jsx:y.jsx(Oo,{id:s,summary:"%"+s,details:g,onOpen:v,style:p})}});return y.jsx("div",{className:"h-100 w-100 pa3 pt4 overflow-x-hidden bg-gray0-d white-d flex flex-column",children:y.jsx(Ht,{placeholder:"app name",items:r,children:y.jsx("button",{onClick:this.loadApps,children:"refresh"})})})}}class k6 extends oe.Component{constructor(t){super(t),this.state={},this.loadLogs=this.loadLogs.bind(this),this.clearLogs=this.clearLogs.bind(this)}componentDidMount(){this.props}componentDidUpdate(t,n){}async loadLogs(){console.log("want to load log file")}clearLogs(){console.log("want to wipe logs state")}renderThreads(t){return Object.keys(t).map(n=>{const r=this.renderThreads(t[n]);return y.jsxs(y.Fragment,{children:[y.jsxs("div",{children:[y.jsx("button",{style:{margin:"4px"},onClick:()=>{this.killThread(n)},children:"kill"}),n]}),y.jsx("div",{style:{paddingLeft:"16px"},children:r})]})})}render(){return y.jsxs(y.Fragment,{children:[y.jsx("button",{onClick:this.loadLogs,children:"load logs"}),y.jsx("button",{onClick:this.clearLogs,children:"clear logs"})]})}}class O6 extends oe.Component{constructor(t){super(t),this.state={},this.loadThreads=this.loadThreads.bind(this),this.renderThreads=this.renderThreads.bind(this),this.killThread=this.killThread.bind(this)}componentDidMount(){const{threads:t}=this.props;Object.keys(t).length===0&&this.loadThreads()}componentDidUpdate(t,n){}loadThreads(){api.getThreads()}killThread(t){api.killThread(t)}renderThreads(t){return Object.keys(t).map(n=>{const r=this.renderThreads(t[n]);return y.jsxs(y.Fragment,{children:[y.jsxs("div",{children:[y.jsx("button",{style:{margin:"4px"},onClick:()=>{this.killThread(n)},children:"kill"}),n]}),y.jsx("div",{style:{paddingLeft:"16px"},children:r})]})})}render(){return y.jsxs(y.Fragment,{children:[y.jsx("button",{onClick:this.loadThreads,children:"refresh"}),y.jsx("br",{}),Object.keys(this.props.threads).length===0?"no running threads":this.renderThreads(this.props.threads)]})}}class E6 extends oe.Component{constructor(t){super(t),this.loadPeers=this.loadPeers.bind(this),this.loadPeerDetails=this.loadPeerDetails.bind(this),this.renderFlow=this.renderFlow.bind(this),this.renderScry=this.renderScry.bind(this)}componentDidMount(){const{known:t,alien:n}=this.props.peers;t.length===0&&n.length===0&&this.loadPeers()}componentDidUpdate(t,n){}loadPeers(){api.getPeers()}loadPeerDetails(t){api.getPeer(t)}renderPaths(t){const n=t.map(r=>({key:r,jsx:r}));return y.jsx(Ht,{placeholder:"path",items:n})}renderDucts(t){const n=t.map(r=>({key:r.join(" "),jsx:y.jsx("div",{children:Qi(r)})}));return y.jsx(Ht,{placeholder:"duct",items:n})}renderSnd(t){const n=t["unsent-messages"].reduce((F,z)=>F+z+" bytes, ","unsent msg sizes: "),r=t["queued-message-acks"].map(F=>({key:F["message-num"],jsx:F["message-num"]+": "+F.ack})),s=y.jsx(Ht,{placeholder:"msg num",items:r}),a=t["packet-pump-state"].metrics,u=y.jsx(y.Fragment,{children:y.jsx("table",{children:y.jsxs("tbody",{children:[y.jsxs("tr",{class:"inter",children:[y.jsx("td",{children:"rto"}),y.jsx("td",{children:"rtt"}),y.jsx("td",{children:"rttvar"}),y.jsx("td",{children:"ssthresh"}),y.jsx("td",{children:"num-live"}),y.jsx("td",{children:"cwnd"}),y.jsx("td",{children:"counter"})]}),y.jsxs("tr",{children:[y.jsx("td",{children:a.rto}),y.jsx("td",{children:a.rtt}),y.jsx("td",{children:a.rttvar}),y.jsx("td",{children:a.ssthresh}),y.jsx("td",{children:a["num-live"]}),y.jsx("td",{children:a.cwnd}),y.jsx("td",{children:a.counter})]})]})})}),h=t["packet-pump-state"].live.map(F=>({key:F["message-num"]+","+F["fragment-num"],jsx:y.jsx("table",{children:y.jsxs("tbody",{children:[y.jsxs("tr",{children:[y.jsx("td",{children:"message-num"}),y.jsx("td",{children:"fragment-num"}),y.jsx("td",{children:"num-fragments"}),y.jsx("td",{children:"last-sent"}),y.jsx("td",{children:"tries"}),y.jsx("td",{children:"skips"})]}),y.jsxs("tr",{children:[y.jsx("td",{children:F["message-num"]}),y.jsx("td",{children:F["fragment-num"]}),y.jsx("td",{children:F["num-fragments"]}),y.jsx("td",{children:Mi(F["last-sent"])}),y.jsx("td",{children:F.tries}),y.jsx("td",{children:F.skips})]})]})})})),p=y.jsx(Ht,{placeholder:"msg-num,frag-num",items:h}),g=y.jsxs(y.Fragment,{children:[y.jsx("b",{children:"snd"}),y.jsx("br",{}),Qi(t.duct),y.jsx("table",{children:y.jsxs("tbody",{children:[y.jsxs("tr",{class:"inter",children:[y.jsx("td",{children:"bone"}),y.jsx("td",{children:"current"}),y.jsx("td",{children:"next"}),y.jsx("td",{children:"next wake"}),y.jsx("td",{children:"total unsent"})]}),y.jsxs("tr",{children:[y.jsx("td",{children:t.bone}),y.jsx("td",{children:t.current}),y.jsx("td",{children:t.next}),y.jsx("td",{children:Mi(t["packet-pump-state"]["next-wake"])}),y.jsxs("td",{children:[t["unsent-messages"].reduce((F,z)=>F+z,0)," bytes (",t["unsent-messages"].length," messages)"]})]})]})})]}),v=y.jsxs(y.Fragment,{children:[u,n,s,p]}),O=t["unsent-messages"].length>0||t["packet-pump-state"].live.length>0?"active, ":"",b=t.closing?"lightyellow":t.corked?"lightred":"transparent";return{key:"snd "+O+t.bone+", "+Qi(t.duct),jsx:y.jsx("div",{style:{backgroundColor:b},children:y.jsx(Oo,{summary:g,details:v})})}}renderRcv(t){const n=t["pending-vane-ack"].reduce((g,v)=>g+v+", ","pending vane acks: "),r=t.nax.reduce((g,v)=>g+v+", ","nacks: "),s=t["live-messages"].map(g=>({key:g["message-num"],jsx:y.jsxs(y.Fragment,{children:["Message #",g["message-num"],y.jsx("br",{}),g["num-received"]," out of ",g["num-fragments"]," fragments received:",y.jsx("br",{}),g.fragments.reduce((v,O)=>v+O+", ","")]})})),a=y.jsxs(y.Fragment,{children:["Live messages:",y.jsx("br",{}),y.jsx(Ht,{placeholder:"message num",items:s})]}),u=y.jsxs(y.Fragment,{children:[y.jsx("b",{children:"rcv"}),y.jsx("br",{}),Qi(t.duct),y.jsx("table",{children:y.jsxs("tbody",{children:[y.jsxs("tr",{children:[y.jsx("td",{children:"bone"}),y.jsx("td",{children:"last-acked"}),y.jsx("td",{children:"last-heard"})]}),y.jsxs("tr",{children:[y.jsx("td",{children:t.bone}),y.jsx("td",{children:t["last-acked"]}),y.jsx("td",{children:t["last-heard"]})]})]})})]}),h=y.jsxs(y.Fragment,{children:[n,y.jsx("br",{}),r,y.jsx("br",{}),a]}),p=t.closing?"ligthyellow":t.corked?"lightred":"transparent";return{key:"rcv "+t.bone+", "+Qi(t.duct),jsx:y.jsx("div",{style:{backgroundColor:p},children:y.jsx(Oo,{summary:u,details:h})})}}renderFlow(t){return t.snd?this.renderSnd(t.snd):t.rcv?this.renderRcv(t.rcv):(console.log("weird flow",t),"weird flow")}renderScry(t){const n=t["keen-state"].metrics,r=y.jsx(y.Fragment,{children:y.jsx("table",{children:y.jsxs("tbody",{children:[y.jsxs("tr",{class:"inter",children:[y.jsx("td",{children:"rto"}),y.jsx("td",{children:"rtt"}),y.jsx("td",{children:"rttvar"}),y.jsx("td",{children:"ssthresh"}),y.jsx("td",{children:"cwnd"}),y.jsx("td",{children:"counter"})]}),y.jsxs("tr",{children:[y.jsx("td",{children:n.rto}),y.jsx("td",{children:n.rtt}),y.jsx("td",{children:n.rttvar}),y.jsx("td",{children:n.ssthresh}),y.jsx("td",{children:n.cwnd}),y.jsx("td",{children:n.counter})]})]})})}),s=t["keen-state"].wan.map(p=>({key:p.frag,jsx:y.jsx("table",{children:y.jsxs("tbody",{children:[y.jsxs("tr",{children:[y.jsx("td",{children:"fragment"}),y.jsx("td",{children:"size"}),y.jsx("td",{children:"last-sent"}),y.jsx("td",{children:"tries"}),y.jsx("td",{children:"skips"})]}),y.jsxs("tr",{children:[y.jsx("td",{children:p.frag}),y.jsx("td",{children:p.size}),y.jsx("td",{children:Mi(p["last-sent"])}),y.jsx("td",{children:p.tries}),y.jsx("td",{children:p.skips})]})]})})})),a=y.jsx(Ht,{placeholder:"fragment",items:s}),u=y.jsxs(y.Fragment,{children:[y.jsx("b",{children:t["scry-path"]}),y.jsx("br",{}),y.jsx("h5",{style:{marginTop:"1em"},children:"listeners:"}),Qi(t["keen-state"].listeners),y.jsx("h5",{style:{marginTop:"1em"},children:"scry state:"}),y.jsx("table",{children:y.jsxs("tbody",{children:[y.jsxs("tr",{class:"inter",children:[y.jsx("td",{children:"num-fragments"}),y.jsx("td",{children:"num-received"}),y.jsx("td",{children:"next-wake"})]}),y.jsxs("tr",{children:[y.jsx("td",{children:t["keen-state"]["num-fragments"]}),y.jsx("td",{children:t["keen-state"]["num-received"]}),y.jsx("td",{children:Mi(t["keen-state"]["next-wake"])})]})]})})]}),h=y.jsxs(y.Fragment,{children:[r,a]});return{key:t["scry-path"],jsx:y.jsx(Oo,{summary:u,details:h})}}render(){const{props:t,state:n}=this,{known:r,alien:s,deets:a}=t.peers,u=v=>{const O=a[v];if(O){if(O.alien)return y.jsxs(y.Fragment,{children:["Pending messages: ",O.alien.messages,"Pending packets: ",O.alien.packets,"Heeds: ",this.renderDucts(O.alien.heeds),"Keens: ",this.renderPaths(O.alien.keens)]});if(O.known){const b=O.known,F=y.jsxs(y.Fragment,{children:[y.jsx("h4",{style:{marginTop:"1em"},children:"status"}),y.jsx("table",{children:y.jsxs("tbody",{children:[y.jsxs("tr",{children:[y.jsx("td",{class:"inter",children:"Life"}),y.jsx("td",{children:b.life})]}),y.jsxs("tr",{children:[y.jsx("td",{class:"inter",children:"Route"}),y.jsx("td",{children:b.route?`${b.route.direct?"":"in"}direct, on lane ${b.route.lane}`:"none"})]}),y.jsxs("tr",{children:[y.jsx("td",{class:"inter",children:"QoS"}),y.jsxs("td",{children:[b.qos.kind,", last contact ",Mi(b.qos["last-contact"])]})]}),y.jsxs("tr",{children:[y.jsx("td",{class:"inter",children:"Bones "}),y.jsxs("td",{children:["closing: ",b.closing.length,", corked: ",b.corked.length]})]})]})})]}),z=b.flows.forward.map(this.renderFlow),K=y.jsxs(y.Fragment,{children:[y.jsx("h4",{style:{marginTop:"1em"},children:"forward"}),y.jsx(Ht,{placeholder:"bone, duct",items:z})]}),me=b.flows.backward.map(this.renderFlow),N=y.jsxs(y.Fragment,{children:[y.jsx("h4",{style:{marginTop:"1em"},children:"backward"}),y.jsx(Ht,{placeholder:"bone, duct",items:me})]}),A=b.nax.map(V=>({key:V.bone,jsx:y.jsxs("div",{children:["bone ",V.bone,", message #",V["message-num"],", duct:",y.jsx("br",{}),Qi(V.duct)]})})),I=y.jsxs(y.Fragment,{children:[y.jsx("h4",{style:{marginTop:"1em"},children:"nax"}),y.jsx(Ht,{placeholder:"bone",items:A})]}),Y=y.jsxs(y.Fragment,{children:[y.jsx("h4",{style:{marginTop:"1em"},children:"heeds"}),this.renderDucts(b.heeds)]}),X=b.scries.map(this.renderScry),te=y.jsxs(y.Fragment,{children:[y.jsx("h4",{style:{marginTop:"1em"},children:"scries"}),y.jsx(Ht,{placeholder:"path",items:X})]});return y.jsxs(y.Fragment,{children:[y.jsx("button",{style:{position:"absolute",top:0,right:0},onClick:()=>{this.loadPeerDetails(v)},children:"refresh"}),F,K,N,I,Y,te]})}else return console.log("weird peer",O),"???"}else return"Loading..."},h=r.map(v=>({key:"~"+v,jsx:y.jsx(Oo,{id:v,summary:"~"+v+" (known)",details:u(v),onOpen:this.loadPeerDetails})})),p=s.map(v=>({key:"~"+v,jsx:y.jsx(Oo,{id:v,summary:"~"+v+" (alien)",details:u(v),onOpen:this.loadPeerDetails})})),g=[...h,...p];return y.jsx(Ht,{placeholder:"ship name",items:g,children:y.jsx("button",{onClick:this.loadPeers,children:"refresh"})})}}class T6 extends oe.Component{constructor(t){super(t),this.state={},this.loadTimers=this.loadTimers.bind(this)}componentDidMount(){const{timers:t}=this.props;t.length===0&&this.loadTimers()}componentDidUpdate(t,n){}loadTimers(){api.getTimers()}render(){const{props:t,state:n}=this,r=t.timers.map(s=>{const a=Qi(s.duct);return{key:a,jsx:y.jsxs("div",{class:"flex",children:[y.jsx("div",{class:"flex-auto",style:{maxWidth:"50%"},children:Mi(s.date)}),y.jsx("div",{class:"flex-auto",style:{maxWidth:"50%"},children:a})]})}});return y.jsx("table",{children:y.jsx("tbody",{children:y.jsx(Ht,{placeholder:"duct",items:r,children:y.jsx("button",{onClick:this.loadTimers,children:"refresh"})})})})}}var Hn={},Pg={},da={},ec={},Eu={},Gh={},Vh={},sr={},qh={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.VerticalReverse="vertical-reverse",t.Horizontal="horizontal",t.HorizontalReverse="horizontal-reverse"}(e.Orientation||(e.Orientation={}))})(qh);Object.defineProperty(sr,"__esModule",{value:!0});const $p=qh;function P6(e,t){return typeof e=="boolean"?e:t}sr.booleanOptionOr=P6;function R6(e,t){return typeof e=="number"?e:t}sr.numberOptionOr=R6;function nM(e,t){return Object.assign({},t.reduce((n,r)=>Object.assign({},n,{[r]:e[r]}),{}))}sr.pick=nM;function b6(e,t){console.log(JSON.stringify(e.map(n=>nM(n,t)),null,2))}sr.debug=b6;function rM(e){return e===void 0}sr.isUndefined=rM;function D6(e={}){return Object.keys(e).reduce((t,n)=>rM(e[n])?t:Object.assign({},t,{[n]:e[n]}),{})}sr.withoutUndefinedKeys=D6;function A6(e,t,n){const r=n.style.dot.size,s=e.template.arrow.size,a=r+e.template.arrow.offset,u=Math.PI/7,h=L6(e,t,n),p=a*Math.cos(h),g=a*Math.sin(h),v=(a+s)*Math.cos(h-u),O=(a+s)*Math.sin(h-u),b=(a+s/2)*Math.cos(h),F=(a+s/2)*Math.sin(h),z=(a+s)*Math.cos(h+u),K=(a+s)*Math.sin(h+u);return`M${p},${g} L${v},${O} Q${b},${F} ${z},${K} L${z},${K}`}sr.arrowSvgPath=A6;function L6(e,t,n){const r=t.x-n.x,s=t.y-n.y,a=e.template.commit.spacing;let u,h;switch(e.orientation){case $p.Orientation.Horizontal:u=s,h=-a;break;case $p.Orientation.HorizontalReverse:u=s,h=a;break;case $p.Orientation.VerticalReverse:u=-a,h=r;break;default:u=a,h=r;break}return e.isVertical?Math.abs(s)>a&&(h=0):Math.abs(r)>a&&(u=0),e.reverseArrow&&(u*=-1,h*=-1),Math.atan2(u,h)}(function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=sr;var n;(function(g){g.Bezier="bezier",g.Straight="straight"})(n||(n={})),e.MergeStyle=n,e.DEFAULT_FONT="normal 12pt Calibri";class r{constructor(v){v.branch=v.branch||{},v.branch.label=v.branch.label||{},v.arrow=v.arrow||{},v.commit=v.commit||{},v.commit.dot=v.commit.dot||{},v.commit.message=v.commit.message||{},this.colors=v.colors||["#000000"],this.branch={color:v.branch.color,lineWidth:v.branch.lineWidth||2,mergeStyle:v.branch.mergeStyle||n.Bezier,spacing:t.numberOptionOr(v.branch.spacing,20),label:{display:t.booleanOptionOr(v.branch.label.display,!0),color:v.branch.label.color||v.commit.color,strokeColor:v.branch.label.strokeColor||v.commit.color,bgColor:v.branch.label.bgColor||"white",font:v.branch.label.font||v.commit.message.font||e.DEFAULT_FONT,borderRadius:t.numberOptionOr(v.branch.label.borderRadius,10)}},this.arrow={size:v.arrow.size||null,color:v.arrow.color||null,offset:v.arrow.offset||2},this.commit={color:v.commit.color,spacing:t.numberOptionOr(v.commit.spacing,25),hasTooltipInCompactMode:t.booleanOptionOr(v.commit.hasTooltipInCompactMode,!0),dot:{color:v.commit.dot.color||v.commit.color,size:v.commit.dot.size||3,strokeWidth:t.numberOptionOr(v.commit.dot.strokeWidth,0),strokeColor:v.commit.dot.strokeColor,font:v.commit.dot.font||v.commit.message.font||"normal 10pt Calibri"},message:{display:t.booleanOptionOr(v.commit.message.display,!0),displayAuthor:t.booleanOptionOr(v.commit.message.displayAuthor,!0),displayHash:t.booleanOptionOr(v.commit.message.displayHash,!0),color:v.commit.message.color||v.commit.color,font:v.commit.message.font||e.DEFAULT_FONT}},this.tag=v.tag||{}}}e.Template=r;const s=new r({colors:["#6963FF","#47E8D4","#6BDB52","#E84BA5","#FFA657"],branch:{color:"#000000",lineWidth:4,spacing:50,mergeStyle:n.Straight},commit:{spacing:60,dot:{size:16,strokeColor:"#000000",strokeWidth:4},message:{color:"black"}},arrow:{size:16,offset:-1.5}});e.blackArrowTemplate=s;const a=new r({colors:["#979797","#008fb5","#f1c109"],branch:{lineWidth:10,spacing:50},commit:{spacing:80,dot:{size:14},message:{font:"normal 14pt Arial"}}});e.metroTemplate=a;var u;(function(g){g.Metro="metro",g.BlackArrow="blackarrow"})(u||(u={})),e.TemplateName=u;function h(g,v){const O=p(g);return v.branch||(v.branch={}),v.commit||(v.commit={}),{colors:v.colors||O.colors,arrow:Object.assign({},O.arrow,v.arrow),branch:Object.assign({},O.branch,v.branch,{label:Object.assign({},O.branch.label,v.branch.label)}),commit:Object.assign({},O.commit,v.commit,{dot:Object.assign({},O.commit.dot,v.commit.dot),message:Object.assign({},O.commit.message,v.commit.message)}),tag:Object.assign({},O.tag,v.tag)}}e.templateExtend=h;function p(g){return g?typeof g=="string"?{[u.BlackArrow]:s,[u.Metro]:a}[g]:g:a}e.getTemplate=p})(Vh);Object.defineProperty(Gh,"__esModule",{value:!0});const j6=Vh,o_=sr;let N6=class{constructor(t,n,r,s){this.name=t,this.tagStyle=n,this.commitStyle=s,this.render=r}get style(){return{strokeColor:this.tagStyle.strokeColor||this.commitStyle.color,bgColor:this.tagStyle.bgColor||this.commitStyle.color,color:this.tagStyle.color||"white",font:this.tagStyle.font||this.commitStyle.message.font||j6.DEFAULT_FONT,borderRadius:o_.numberOptionOr(this.tagStyle.borderRadius,10),pointerWidth:o_.numberOptionOr(this.tagStyle.pointerWidth,12)}}};Gh.Tag=N6;Object.defineProperty(Eu,"__esModule",{value:!0});const I6=Gh,F6=()=>(Math.random().toString(16).substring(3)+Math.random().toString(16).substring(3)+Math.random().toString(16).substring(3)+Math.random().toString(16).substring(3)).substring(0,40);let U6=class iM{constructor(t){this.refs=[],this.x=0,this.y=0;let n,r;try{[,n,r]=t.author.match(/(.*) <(.*)>/)}catch{[n,r]=[t.author,""]}this.author={name:n,email:r,timestamp:Date.now()},this.committer={name:n,email:r,timestamp:Date.now()},this.subject=t.subject,this.body=t.body||"",this.hash=t.hash||F6(),this.hashAbbrev=this.hash.substring(0,7),this.parents=t.parents?t.parents:[],this.parentsAbbrev=this.parents.map(s=>s.substring(0,7)),this.style=Object.assign({},t.style,{message:Object.assign({},t.style.message),dot:Object.assign({},t.style.dot)}),this.dotText=t.dotText,this.onClick=()=>t.onClick?t.onClick(this):void 0,this.onMessageClick=()=>t.onMessageClick?t.onMessageClick(this):void 0,this.onMouseOver=()=>t.onMouseOver?t.onMouseOver(this):void 0,this.onMouseOut=()=>t.onMouseOut?t.onMouseOut(this):void 0,this.renderDot=t.renderDot,this.renderMessage=t.renderMessage,this.renderTooltip=t.renderTooltip}get message(){let t="";return this.style.message.displayHash&&(t+=`${this.hashAbbrev} `),t+=this.subject,this.style.message.displayAuthor&&(t+=` - ${this.author.name} <${this.author.email}>`),t}get branchToDisplay(){return this.branches?this.branches[0]:""}setRefs(t){return this.refs=t.getNames(this.hash),this}setTags(t,n,r){return this.tags=t.getNames(this.hash).map(s=>new I6.Tag(s,n(s),r(s),this.style)),this}setBranches(t){return this.branches=t,this}setPosition({x:t,y:n}){return this.x=t,this.y=n,this}withDefaultColor(t){const n=Object.assign({},this.style,{dot:Object.assign({},this.style.dot),message:Object.assign({},this.style.message)});n.color||(n.color=t),n.dot.color||(n.dot.color=t),n.message.color||(n.message.color=t);const r=this.cloneCommit();return r.style=n,r}cloneCommit(){const t=new iM({author:`${this.author.name} <${this.author.email}>`,subject:this.subject,style:this.style,body:this.body,hash:this.hash,parents:this.parents,dotText:this.dotText,onClick:this.onClick,onMessageClick:this.onMessageClick,onMouseOver:this.onMouseOver,onMouseOut:this.onMouseOut,renderDot:this.renderDot,renderMessage:this.renderMessage,renderTooltip:this.renderTooltip});return t.refs=this.refs,t.branches=this.branches,t.tags=this.tags,t.x=this.x,t.y=this.y,t}};Eu.Commit=U6;var a_;function sM(){if(a_)return ec;a_=1;var e=Ir&&Ir.__rest||function(u,h){var p={};for(var g in u)Object.prototype.hasOwnProperty.call(u,g)&&h.indexOf(g)<0&&(p[g]=u[g]);if(u!=null&&typeof Object.getOwnPropertySymbols=="function")for(var v=0,g=Object.getOwnPropertySymbols(u);vb.commits.find(({hash:z})=>z===F);let O=v(p,p.refs.getCommit(g.name));for(;O&&O.hash!==g.parentCommitHash;)yield O,O=v(p,O.parents[0])}(this._graph,this._branch)].forEach(p=>{p.refs=p.refs.filter(g=>g!==this.name)}),this._graph.refs.delete(this.name),this._graph.branches.delete(this.name),this._branch=n.createDeletedBranch(this._graph,this._branch.style,()=>{}),this._onGraphUpdate(),this}merge(...h){if(this._branch.isDeleted()&&!this._isReferenced())throw new Error(`Cannot merge to the deleted branch "${this.name}"`);let p=h[0];a(p)||(p={branch:h[0],fastForward:!1,commitOptions:{subject:h[1]}});const{branch:g,fastForward:v,commitOptions:O}=p,b=typeof g=="string"?g:g.name,F=this._graph.refs.getCommit(b);if(!F)throw new Error(`The branch called "${b}" is unknown`);let z=!1;if(v){const K=this._graph.refs.getCommit(this._branch.name);K&&(z=this._areCommitsConnected(K,F))}return v&&z?this._fastForwardTo(F):this._commitWithParents(Object.assign({},O,{subject:O&&O.subject||`Merge branch ${b}`}),[F]),this._onGraphUpdate(),this}tag(h){if(this._branch.isDeleted()&&!this._isReferenced())throw new Error(`Cannot tag on the deleted branch "${this.name}"`);return typeof h=="string"?this._graph.getUserApi().tag({name:h,ref:this._branch.name}):this._graph.getUserApi().tag(Object.assign({},h,{ref:this._branch.name})),this}checkout(){if(this._branch.isDeleted()&&!this._isReferenced())throw new Error(`Cannot checkout the deleted branch "${this.name}"`);const h=this._branch,p=this._graph.refs.getCommit(h.name);return this._graph.currentBranch=h,p&&this._graph.refs.set("HEAD",p),this}_commitWithParents(h,p){const g=this._graph.refs.getCommit(this._branch.name);g?p.unshift(g):this._branch.parentCommitHash&&p.unshift(this._branch.parentCommitHash);const{tag:v}=h,O=e(h,["tag"]),b=new t.Commit(Object.assign({hash:this._graph.generateCommitHash(),author:this._branch.commitDefaultOptions.author||this._graph.author,subject:this._branch.commitDefaultOptions.subject||this._graph.commitMessage},O,{parents:p,style:this._getCommitStyle(h.style)}));g?this._graph.refs.getNames(g).forEach(z=>this._graph.refs.set(z,b.hash)):this._graph.refs.set(this._branch.name,b.hash),this._graph.commits.push(b),this.checkout(),v&&this.tag(v)}_areCommitsConnected(h,p){const g=this._graph.commits.find(({hash:O})=>p===O);return!g||g.parents.length===0?!1:g.parents.includes(h)?!0:g.parents.some(O=>this._areCommitsConnected(h,O))}_fastForwardTo(h){this._graph.refs.set(this._branch.name,h)}_getCommitStyle(h={}){return Object.assign({},r.withoutUndefinedKeys(this._graph.template.commit),r.withoutUndefinedKeys(this._branch.commitDefaultOptions.style),h,{message:Object.assign({},r.withoutUndefinedKeys(this._graph.template.commit.message),r.withoutUndefinedKeys(this._branch.commitDefaultOptions.style.message),h.message,r.withoutUndefinedKeys({display:this._graph.shouldDisplayCommitMessage&&void 0})),dot:Object.assign({},r.withoutUndefinedKeys(this._graph.template.commit.dot),r.withoutUndefinedKeys(this._branch.commitDefaultOptions.style.dot),h.dot)})}_isReferenced(){return this._graph.branches.has(this.name)||this._graph.refs.hasName(this.name)||this._graph.commits.reduce((h,{refs:p})=>[...h,...p],[]).includes(this.name)}}ec.BranchUserApi=s;function a(u){return typeof u=="object"&&!(u instanceof s)}return ec}var l_;function Qh(){if(l_)return da;l_=1,Object.defineProperty(da,"__esModule",{value:!0});const e=sM(),t="";da.DELETED_BRANCH_NAME=t;class n{constructor(a){this.gitgraph=a.gitgraph,this.name=a.name,this.style=a.style,this.parentCommitHash=a.parentCommitHash,this.commitDefaultOptions=a.commitDefaultOptions||{style:{}},this.onGraphUpdate=a.onGraphUpdate,this.renderLabel=a.renderLabel}getUserApi(){return new e.BranchUserApi(this,this.gitgraph,this.onGraphUpdate)}isDeleted(){return this.name===t}}da.Branch=n;function r(s,a,u){return new n({name:t,gitgraph:s,style:a,onGraphUpdate:u})}return da.createDeletedBranch=r,da}var Kh={},Tu={};Object.defineProperty(Tu,"__esModule",{value:!0});var Z0;(function(e){e.Compact="compact"})(Z0||(Z0={}));Tu.Mode=Z0;var Rg={},Zh={};Object.defineProperty(Zh,"__esModule",{value:!0});class W6{constructor(t){this.rows=new Map,this.maxRowCache=void 0,this.computeRowsFromCommits(t)}getRowOf(t){return this.rows.get(t)||0}getMaxRow(){return this.maxRowCache===void 0&&(this.maxRowCache=B6(Array.from(this.rows.values())).length-1),this.maxRowCache}computeRowsFromCommits(t){t.forEach((n,r)=>{this.rows.set(n.hash,r)}),this.maxRowCache=void 0}}Zh.RegularGraphRows=W6;function B6(e){const t=new Set;return e.forEach(n=>t.add(n)),Array.from(t)}Object.defineProperty(Rg,"__esModule",{value:!0});const z6=Zh;class $6 extends z6.RegularGraphRows{computeRowsFromCommits(t){t.forEach((n,r)=>{let s=r;if(!(r===0)){const u=this.getRowOf(n.parents[0]),h=t[r-1];if(s=Math.max(u+1,this.getRowOf(h.hash)),n.parents.length>1){const g=this.getRowOf(n.parents[1]);uthis.branches.add(s.branchToDisplay)),r&&(this.branches=new Set(Array.from(this.branches).sort(r)))}get(t){return Array.from(this.branches).findIndex(n=>n===t)}getColorOf(t){return this.colors[this.get(t)%this.colors.length]}}bg.BranchesOrder=V6;var Pu={};Object.defineProperty(Pu,"__esModule",{value:!0});class q6{constructor(){this.commitPerName=new Map,this.namesPerCommit=new Map}set(t,n){const r=this.commitPerName.get(t);return r&&this.removeNameFrom(r,t),this.addNameTo(n,t),this.addCommitTo(t,n),this}delete(t){return this.hasName(t)&&(this.removeNameFrom(this.getCommit(t),t),this.commitPerName.delete(t)),this}getCommit(t){return this.commitPerName.get(t)}getNames(t){return this.namesPerCommit.get(t)||[]}getAllNames(){return Array.from(this.commitPerName.keys())}hasCommit(t){return this.namesPerCommit.has(t)}hasName(t){return this.commitPerName.has(t)}removeNameFrom(t,n){const r=this.namesPerCommit.get(t)||[];this.namesPerCommit.set(t,r.filter(s=>s!==n))}addNameTo(t,n){const r=this.namesPerCommit.get(t)||[];this.namesPerCommit.set(t,[...r,n])}addCommitTo(t,n){this.commitPerName.set(t,n)}}Pu.Refs=q6;var Ru={};Object.defineProperty(Ru,"__esModule",{value:!0});const Q6=sr;class K6{constructor(t,n,r,s,a,u){this.branchesPaths=new Map,this.commits=t,this.branches=n,this.commitSpacing=r,this.isGraphVertical=s,this.isGraphReverse=a,this.createDeletedBranch=u}execute(){return this.fromCommits(),this.withMergeCommits(),this.smoothBranchesPaths()}fromCommits(){this.commits.forEach(t=>{let n=this.branches.get(t.branchToDisplay);n||(n=this.getDeletedBranchInPath()||this.createDeletedBranch());const r=[],s=this.branchesPaths.get(n),a=this.commits.find(({hash:u})=>u===t.parents[0]);s?r.push(...s):a&&r.push({x:a.x,y:a.y}),r.push({x:t.x,y:t.y}),this.branchesPaths.set(n,r)})}withMergeCommits(){this.commits.filter(({parents:n})=>n.length>1).forEach(n=>{const r=this.commits.find(({hash:h})=>h===n.parents[1]);if(!r)return;const s=r.branches?r.branches[0]:"";let a=this.branches.get(s);if(!a&&(a=this.getDeletedBranchInPath(),!a))return;const u=[...this.branchesPaths.get(a)||[]];this.branchesPaths.set(a,[...u,{x:n.x,y:n.y,mergeCommit:!0}])})}getDeletedBranchInPath(){return Array.from(this.branchesPaths.keys()).find(t=>t.isDeleted())}smoothBranchesPaths(){const t=new Map;return this.branchesPaths.forEach((n,r)=>{if(n.length<=1){t.set(r,[n]);return}this.isGraphVertical?n=n.sort((a,u)=>a.y>u.y?-1:1):n=n.sort((a,u)=>a.x>u.x?1:-1),this.isGraphReverse&&(n=n.reverse());const s=n.reduce((a,u,h)=>{if(u.mergeCommit){a[a.length-1].push(Q6.pick(u,["x","y"]));let p=h-1,g=n[p];for(;p>=0&&g.mergeCommit;)p--,g=n[p];p>=0&&a.push([g])}else a[a.length-1].push(u);return a},[[]]);this.isGraphReverse&&s.forEach(a=>a.reverse()),this.isGraphVertical?s.forEach(a=>{if(a.length<=1)return;const u=a[0],h=a[a.length-1],p=a[1].x,g=Math.round(Math.abs(u.y-h.y)/this.commitSpacing)-1,v=g>0?new Array(g).fill(0).map((b,F)=>({x:p,y:a[0].y-this.commitSpacing*(F+1)})):[],O=t.get(r)||[];t.set(r,[...O,[u,...v,h]])}):s.forEach(a=>{if(a.length<=1)return;const u=a[0],h=a[a.length-1],p=a[1].y,g=Math.round(Math.abs(u.x-h.x)/this.commitSpacing)-1,v=g>0?new Array(g).fill(0).map((b,F)=>({y:p,x:a[0].x+this.commitSpacing*(F+1)})):[],O=t.get(r)||[];t.set(r,[...O,[u,...v,h]])})}),t}}Ru.BranchesPathsCalculator=K6;function Z6(e,t,n){return e.map(r=>"M"+r.map(({x:s,y:a},u,h)=>{if(t&&h.length>1&&(u===1||u===h.length-1)){const p=h[u-1];if(n){const g=(p.y+a)/2;return`C ${p.x} ${g} ${s} ${g} ${s} ${a}`}else{const g=(p.x+s)/2;return`C ${g} ${p.y} ${g} ${a} ${s} ${a}`}}return`L ${s} ${a}`}).join(" ").slice(1)).join(" ")}Ru.toSvgPath=Z6;var Xh={};Object.defineProperty(Xh,"__esModule",{value:!0});const X6=Eu,J6=Qh(),u_=Pu;class e4{constructor(t,n){this._graph=t,this._onGraphUpdate=n}clear(){return this._graph.refs=new u_.Refs,this._graph.tags=new u_.Refs,this._graph.commits=[],this._graph.branches=new Map,this._graph.currentBranch=this._graph.createBranch("master"),this._onGraphUpdate(),this}commit(t){return this._graph.currentBranch.getUserApi().commit(t),this}branch(t){return this._graph.createBranch(t).getUserApi()}tag(...t){let n,r,s,a;if(typeof t[0]=="string"?(n=t[0],r=t[1]):(n=t[0].name,r=t[0].ref,s=t[0].style,a=t[0].render),!r){const h=this._graph.refs.getCommit("HEAD");if(!h)return this;r=h}let u;if(this._graph.refs.hasCommit(r)&&(u=r),this._graph.refs.hasName(r)&&(u=this._graph.refs.getCommit(r)),!u)throw new Error(`The ref "${r}" does not exist`);return this._graph.tags.set(n,u),this._graph.tagStyles[n]=s,this._graph.tagRenders[n]=a,this._onGraphUpdate(),this}import(t){const n=new Error("Only `git2json` format is supported for imported data.");if(!Array.isArray(t)||!t.every(u=>typeof u=="object"&&typeof u.author=="object"&&Array.isArray(u.refs)))throw n;const s=t.map(u=>Object.assign({},u,{style:Object.assign({},this._graph.template.commit,{message:Object.assign({},this._graph.template.commit.message,{display:this._graph.shouldDisplayCommitMessage})}),author:`${u.author.name} <${u.author.email}>`})).reverse();this.clear(),this._graph.commits=s.map(u=>new X6.Commit(u)),s.forEach(({refs:u,hash:h})=>{if(!u||!h)return;const p="tag: ";u.map(v=>v.split(p)).map(([v,O])=>O).filter(v=>typeof v=="string").forEach(v=>this._graph.tags.set(v,h)),u.filter(v=>!v.startsWith(p)).forEach(v=>this._graph.refs.set(v,h))});const a=this._getBranches();return this._graph.commits.map(u=>this._withBranches(a,u)).reduce((u,h)=>(h.branches&&h.branches.forEach(p=>u.add(p)),u),new Set).forEach(u=>this.branch(u)),this._onGraphUpdate(),this}_withBranches(t,n){let r=Array.from((t.get(n.hash)||new Set).values());return r.length===0&&(r=[J6.DELETED_BRANCH_NAME]),n.setBranches(r)}_getBranches(){const t=new Map,n=[];return this._graph.refs.getAllNames().filter(s=>s!=="HEAD").forEach(s=>{const a=this._graph.refs.getCommit(s);for(a&&n.push(a);n.length>0;){const u=n.pop(),h=this._graph.commits.find(({hash:g})=>g===u),p=t.get(u)||new Set;p.add(s),t.set(u,p),h&&h.parents&&h.parents.length>0&&n.push(h.parents[0])}}),t}}Xh.GitgraphUserApi=e4;Object.defineProperty(Pg,"__esModule",{value:!0});const Yp=Qh(),t4=Kh,n4=Tu,f_=bg,r4=Vh,c_=Pu,i4=Ru,tc=sr,Mo=qh,s4=Xh;let o4=class{constructor(t={}){this.refs=new c_.Refs,this.tags=new c_.Refs,this.tagStyles={},this.tagRenders={},this.commits=[],this.branches=new Map,this.listeners=[],this.nextTimeoutId=null,this.template=r4.getTemplate(t.template),this.currentBranch=this.createBranch("master"),this.orientation=t.orientation,this.reverseArrow=tc.booleanOptionOr(t.reverseArrow,!1),this.initCommitOffsetX=tc.numberOptionOr(t.initCommitOffsetX,0),this.initCommitOffsetY=tc.numberOptionOr(t.initCommitOffsetY,0),this.mode=t.mode,this.author=t.author||"Sergio Flores ",this.commitMessage=t.commitMessage||"He doesn't like George Michael! Boooo!",this.generateCommitHash=typeof t.generateCommitHash=="function"?t.generateCommitHash:()=>{},this.branchesOrderFunction=typeof t.compareBranchesOrder=="function"?t.compareBranchesOrder:void 0,this.branchLabelOnEveryCommit=tc.booleanOptionOr(t.branchLabelOnEveryCommit,!1)}get isHorizontal(){return this.orientation===Mo.Orientation.Horizontal||this.orientation===Mo.Orientation.HorizontalReverse}get isVertical(){return!this.isHorizontal}get isReverse(){return this.orientation===Mo.Orientation.HorizontalReverse||this.orientation===Mo.Orientation.VerticalReverse}get shouldDisplayCommitMessage(){return!this.isHorizontal&&this.mode!==n4.Mode.Compact}getUserApi(){return new s4.GitgraphUserApi(this,()=>this.next())}subscribe(t){this.listeners.push(t);let n=!0;return()=>{if(!n)return;n=!1;const r=this.listeners.indexOf(t);this.listeners.splice(r,1)}}getRenderedData(){const t=this.computeRenderedCommits(),n=this.computeRenderedBranchesPaths(t),r=this.computeCommitMessagesX(n);return this.computeBranchesColor(t,n),{commits:t,branchesPaths:n,commitMessagesX:r}}createBranch(t){const n="HEAD";let r={gitgraph:this,name:"",parentCommitHash:this.refs.getCommit(n),style:this.template.branch,onGraphUpdate:()=>this.next()};if(typeof t=="string")r.name=t,r.parentCommitHash=this.refs.getCommit(n);else{const a=t.from?t.from.name:n,u=this.refs.getCommit(a)||(this.refs.hasCommit(t.from)?t.from:void 0);t.style=t.style||{},r=Object.assign({},r,t,{parentCommitHash:u,style:Object.assign({},r.style,t.style,{label:Object.assign({},r.style.label,t.style.label)})})}const s=new Yp.Branch(r);return this.branches.set(s.name,s),s}computeRenderedCommits(){const t=this.getBranches(),n=(()=>{const h=new Set(this.commits.reduce((v,{hash:O})=>t.has(O)?v:[...v,O],[])),p=this.commits.reduce((v,O)=>O.parents.length>1?[...v,...O.parents.slice(1).map(b=>this.commits.find(({hash:F})=>b===F))]:v,[]),g=new Set;return p.forEach(v=>{let O=v;for(;O&&h.has(O.hash);)g.add(O.hash),O=O.parents.length>0?this.commits.find(({hash:b})=>O.parents[0]===b):void 0}),g})(),r=this.commits.filter(({hash:h})=>t.has(h)||n.has(h)),s=r.map(h=>this.withBranches(t,h)),a=t4.createGraphRows(this.mode,r),u=new f_.BranchesOrder(s,this.template.colors,this.branchesOrderFunction);return s.map(h=>h.setRefs(this.refs)).map(h=>this.withPosition(a,u,h)).map(h=>h.withDefaultColor(this.getBranchDefaultColor(u,h.branchToDisplay))).map(h=>h.setTags(this.tags,p=>Object.assign({},this.tagStyles[p],this.template.tag),p=>this.tagRenders[p]))}computeRenderedBranchesPaths(t){return new i4.BranchesPathsCalculator(t,this.branches,this.template.commit.spacing,this.isVertical,this.isReverse,()=>Yp.createDeletedBranch(this,this.template.branch,()=>this.next())).execute()}computeBranchesColor(t,n){const r=new f_.BranchesOrder(t,this.template.colors,this.branchesOrderFunction);Array.from(n).forEach(([s])=>{s.computedColor=s.style.color||this.getBranchDefaultColor(r,s.name)})}computeCommitMessagesX(t){return Array.from(t).length*this.template.branch.spacing}withBranches(t,n){let r=Array.from((t.get(n.hash)||new Set).values());return r.length===0&&(r=[Yp.DELETED_BRANCH_NAME]),n.setBranches(r)}getBranches(){const t=new Map,n=[];return this.refs.getAllNames().filter(s=>s!=="HEAD").forEach(s=>{const a=this.refs.getCommit(s);for(a&&n.push(a);n.length>0;){const u=n.pop(),h=this.commits.find(({hash:g})=>g===u),p=t.get(u)||new Set;p.add(s),t.set(u,p),h&&h.parents&&h.parents.length>0&&n.push(h.parents[0])}}),t}withPosition(t,n,r){const s=t.getRowOf(r.hash),a=t.getMaxRow(),u=n.get(r.branchToDisplay);switch(this.orientation){default:return r.setPosition({x:this.initCommitOffsetX+this.template.branch.spacing*u,y:this.initCommitOffsetY+this.template.commit.spacing*(a-s)});case Mo.Orientation.VerticalReverse:return r.setPosition({x:this.initCommitOffsetX+this.template.branch.spacing*u,y:this.initCommitOffsetY+this.template.commit.spacing*s});case Mo.Orientation.Horizontal:return r.setPosition({x:this.initCommitOffsetX+this.template.commit.spacing*s,y:this.initCommitOffsetY+this.template.branch.spacing*u});case Mo.Orientation.HorizontalReverse:return r.setPosition({x:this.initCommitOffsetX+this.template.commit.spacing*(a-s),y:this.initCommitOffsetY+this.template.branch.spacing*u})}}getBranchDefaultColor(t,n){return t.getColorOf(n)}next(){this.nextTimeoutId&&window.clearTimeout(this.nextTimeoutId),this.nextTimeoutId=window.setTimeout(()=>{this.listeners.forEach(t=>t(this.getRenderedData()))},0)}};Pg.GitgraphCore=o4;Object.defineProperty(Hn,"__esModule",{value:!0});var a4=Pg,l4=Hn.GitgraphCore=a4.GitgraphCore,u4=Tu,f4=Hn.Mode=u4.Mode,c4=Xh;Hn.GitgraphUserApi=c4.GitgraphUserApi;var h4=sM();Hn.BranchUserApi=h4.BranchUserApi;var d4=Qh();Hn.Branch=d4.Branch;var p4=Eu;Hn.Commit=p4.Commit;var m4=Gh;Hn.Tag=m4.Tag;var g4=Pu;Hn.Refs=g4.Refs;var Dg=Vh,v4=Hn.MergeStyle=Dg.MergeStyle,y4=Hn.TemplateName=Dg.TemplateName,_4=Hn.templateExtend=Dg.templateExtend,w4=qh,x4=Hn.Orientation=w4.Orientation,S4=Ru,M4=Hn.toSvgPath=S4.toSvgPath,C4=sr,k4=Hn.arrowSvgPath=C4.arrowSvgPath;function O4(e){var t=e.branch,n=e.commit,r=oe.useState({textWidth:0,textHeight:0}),s=r[0],a=r[1],u=oe.useCallback(function(g){if(g){var v=g.getBBox();a({textWidth:v.width,textHeight:v.height})}},[]),h=s.textWidth+2*Ei.paddingX,p=s.textHeight+2*Ei.paddingY;return oe.createElement("g",null,oe.createElement("rect",{stroke:t.style.label.strokeColor||n.style.color,fill:t.style.label.bgColor,rx:t.style.label.borderRadius,width:h,height:p}),oe.createElement("text",{ref:u,fill:t.style.label.color||n.style.color,style:{font:t.style.label.font},alignmentBaseline:"middle",dominantBaseline:"middle",x:Ei.paddingX,y:p/2},t.name))}var Ei=oe.forwardRef(function(e,t){var n=e.branch,r=e.commit,s=e.branchLabelX;if(!n.style.label.display)return null;if(!e.gitgraph.branchLabelOnEveryCommit){var a=e.gitgraph.refs.getCommit(n.name);if(r.hash!==a)return null}if(r.branchToDisplay!==n.name)return null;var u=n.renderLabel?n.renderLabel(n):oe.createElement(O4,{branch:n,commit:r});if(e.gitgraph.isVertical)return oe.createElement("g",{ref:t,transform:"translate("+(s||0)+", 0)"},u);var h=r.style.dot.size*2,p=10,g=h+p;return oe.createElement("g",{ref:t,transform:"translate("+r.x+", "+g+")"},u)});Ei.paddingX=10;Ei.paddingY=5;var E4=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var a in s)s.hasOwnProperty(a)&&(r[a]=s[a])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),yc=function(e){E4(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.state={textWidth:0},n.$text=oe.createRef(),n}return t.prototype.componentDidMount=function(){this.setState({textWidth:this.$text.current.getBBox().width})},t.prototype.render=function(){if(this.props.commit.renderTooltip)return this.props.commit.renderTooltip(this.props.commit);var n=this.props.commit.style.dot.size*2,r=10,s=t.padding,a=5,u=50,h=r+this.state.textWidth+2*s,p=["M 0,0","L "+r+","+r,"V "+(u/2-a),"Q "+r+","+u/2+" "+(r+a)+","+u/2,"H "+(h-a),"Q "+h+","+u/2+" "+h+","+(u/2-a),"V -"+(u/2-a),"Q "+h+",-"+u/2+" "+(h-a)+",-"+u/2,"H "+(r+a),"Q "+r+",-"+u/2+" "+r+",-"+(u/2-a),"V -"+r,"z"].join(" ");return oe.createElement("g",{transform:"translate("+n+", "+n/2+")"},oe.createElement("path",{d:p,fill:"#EEE"}),oe.createElement("text",{ref:this.$text,x:r+s,y:0,alignmentBaseline:"central",fill:"#333"},this.props.children))},t.padding=10,t}(oe.Component),T4=function(e){var t=e.commit,n=e.onMouseOver,r=e.onMouseOut;return t.renderDot?t.renderDot(t):oe.createElement(oe.Fragment,null,oe.createElement("defs",null,oe.createElement("circle",{id:t.hash,cx:t.style.dot.size,cy:t.style.dot.size,r:t.style.dot.size,fill:t.style.dot.color}),oe.createElement("clipPath",{id:"clip-"+t.hash},oe.createElement("use",{xlinkHref:"#"+t.hash}))),oe.createElement("g",{onClick:t.onClick,onMouseOver:n,onMouseOut:r},oe.createElement("use",{xlinkHref:"#"+t.hash,clipPath:"url(#clip-"+t.hash+")",stroke:t.style.dot.strokeColor,strokeWidth:t.style.dot.strokeWidth&&t.style.dot.strokeWidth*2}),t.dotText&&oe.createElement("text",{alignmentBaseline:"central",textAnchor:"middle",x:t.style.dot.size,y:t.style.dot.size,style:{font:t.style.dot.font}},t.dotText)))},P4=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var a in s)s.hasOwnProperty(a)&&(r[a]=s[a])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),R4=function(e){P4(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(){var n=this,r=this.props.commits.find(function(a){var u=a.hash;return u===n.props.parentHash});if(!r)return null;var s=this.props.gitgraph.reverseArrow?{x:this.props.commitRadius+(r.x-this.props.commit.x),y:this.props.commitRadius+(r.y-this.props.commit.y)}:{x:this.props.commitRadius,y:this.props.commitRadius};return oe.createElement("g",{transform:"translate("+s.x+", "+s.y+")"},oe.createElement("path",{d:k4(this.props.gitgraph,r,this.props.commit),fill:this.props.gitgraph.template.arrow.color}))},t}(oe.Component),b4=oe.forwardRef(function(e,t){var n=e.commit,r=e.messageX;if(n.renderMessage)return oe.createElement("g",{ref:t,transform:"translate("+r+", 0)"},n.renderMessage(n));var s=null;n.body&&(s=oe.createElement("foreignObject",{width:"600",x:"10"},oe.createElement("p",null,n.body)));var a=n.style.dot.size;return oe.createElement("g",{ref:t,transform:"translate("+r+", "+a+")"},oe.createElement("text",{alignmentBaseline:"central",fill:n.style.message.color,style:{font:n.style.message.font},onClick:n.onMessageClick},n.message),s)}),X0=10,D4=5;function A4(e){var t=oe.useState({textWidth:0,textHeight:0}),n=t[0],r=t[1],s=oe.useRef(null);oe.useEffect(function(){var O=s.current.getBBox();r({textWidth:O.width,textHeight:O.height})},[]);var a=e.tag,u=a.style.pointerWidth,h=a.style.borderRadius,p=u+n.textWidth+2*X0,g=n.textHeight+2*D4,v=["M 0,0","L "+u+","+g/2,"V "+g/2,"Q "+u+","+g/2+" "+(u+h)+","+g/2,"H "+(p-h),"Q "+p+","+g/2+" "+p+","+(g/2-h),"V "+-(g/2-h),"Q "+p+",-"+g/2+" "+(p-h)+",-"+g/2,"H "+(u+h),"Q "+u+",-"+g/2+" "+u+",-"+g/2,"V -"+g/2,"z"].join(" ");return oe.createElement("g",null,oe.createElement("path",{d:v,fill:a.style.bgColor,stroke:a.style.strokeColor}),oe.createElement("text",{ref:s,fill:a.style.color,style:{font:a.style.font},alignmentBaseline:"middle",dominantBaseline:"middle",x:u+X0,y:0},a.name))}var L4=oe.forwardRef(function(e,t){var n=e.tag,r=e.commit,s=e.tagX;return oe.createElement("g",{ref:t,transform:"translate("+(s||0)+", "+r.style.dot.size+")"},n.render?n.render(n.name,n.style):oe.createElement(A4,{tag:n}))}),j4=function(e){var t=e.commit,n=e.commits,r=e.gitgraph,s=e.commitMessagesX,a=oe.useRef(),u=oe.useRef([]),h=oe.useRef(),p=oe.useState(0),g=p[0],v=p[1],O=oe.useState([]),b=O[0],F=O[1],z=oe.useState(0),K=z[0],me=z[1],N=oe.useMemo(function(){if(!r.template.arrow.size)return null;var J=t.style.dot.size;return t.parents.map(function(le){return oe.createElement(R4,{key:le,commits:n,commit:t,gitgraph:r,parentHash:le,commitRadius:J})})},[n,t,r]),A=oe.useMemo(function(){var J=Array.from(r.branches.values());return J.map(function(le){return oe.createElement(Ei,{key:le.name,gitgraph:r,branch:le,commit:t,ref:a,branchLabelX:g})})},[r,t,g]),I=oe.useMemo(function(){return u.current=[],!t.tags||r.isHorizontal?null:t.tags.map(function(J,le){return oe.createElement(L4,{key:t.hashAbbrev+"-"+J.name,commit:t,tag:J,ref:function(fe){return u.current[le]=fe},tagX:b[le]||0})})},[t,r,b]),Y=e.getWithCommitOffset(t),X=Y.x,te=Y.y;oe.useLayoutEffect(function(){if(!r.isHorizontal){var J=10,le=s;if(a.current){v(le);var fe=a.current.getBBox().width+Ei.paddingX;le+=fe+J}var P=u.current.map(function(f){if(!f)return 0;var m=le,S=f.getBBox().width+X0;return le+=S+J,m});F(P),h.current&&me(le)}},[u,r,s]);var V=e.currentCommitOver===t&&(e.gitgraph.isHorizontal||e.gitgraph.mode===f4.Compact&&t.style.hasTooltipInCompactMode);return V&&e.setTooltip(oe.createElement("g",{transform:"translate("+X+", "+te+")"},oe.createElement(yc,{commit:t},t.hashAbbrev," - ",t.subject))),oe.createElement("g",{transform:"translate("+X+", "+te+")"},oe.createElement(T4,{commit:t,onMouseOver:function(){e.setCurrentCommitOver(t),t.onMouseOver()},onMouseOut:function(){e.setCurrentCommitOver(null),e.setTooltip(null),t.onMouseOut()}}),N,oe.createElement("g",{transform:"translate("+-X+", 0)"},t.style.message.display&&oe.createElement(b4,{commit:t,ref:h,messageX:K}),A,I))},N4=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var a in s)s.hasOwnProperty(a)&&(r[a]=s[a])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),I4=function(e){N4(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(){var n=this;return oe.createElement("path",{d:M4(this.props.coordinates.map(function(r){return r.map(function(s){return n.props.getWithCommitOffset(s)})}),this.props.isBezier,this.props.gitgraph.isVertical),fill:"none",stroke:this.props.branch.computedColor,strokeWidth:this.props.branch.style.lineWidth,transform:"translate("+this.props.offset+", "+this.props.offset+")"})},t}(oe.Component),F4=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var a in s)s.hasOwnProperty(a)&&(r[a]=s[a])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();function h_(e){return"graph"in e}var U4=function(e){F4(t,e);function t(n){var r=e.call(this,n)||this;return r.$graph=oe.createRef(),r.$commits=oe.createRef(),r.$tooltip=null,r.state={commits:[],branchesPaths:new Map,commitMessagesX:0,commitYWithOffsets:{},shouldRecomputeOffsets:!0,currentCommitOver:null},r.gitgraph=h_(n)?n.graph:new l4(n.options),r.gitgraph.subscribe(function(s){var a=s.commits,u=s.branchesPaths,h=s.commitMessagesX;r.setState({commits:a,branchesPaths:u,commitMessagesX:h,shouldRecomputeOffsets:!0})}),r}return t.prototype.render=function(){var n=this;return oe.createElement("svg",{ref:this.$graph},oe.createElement("g",{transform:"translate("+Ei.paddingX+", "+yc.padding+")"},this.renderBranchesPaths(),oe.createElement("g",{ref:this.$commits},this.state.commits.map(function(r){return oe.createElement(j4,{key:r.hash,commits:n.state.commits,commit:r,currentCommitOver:n.state.currentCommitOver,setCurrentCommitOver:n.setCurrentCommitOver.bind(n),gitgraph:n.gitgraph,getWithCommitOffset:n.getWithCommitOffset.bind(n),setTooltip:n.setTooltip.bind(n),commitMessagesX:n.state.commitMessagesX})})),this.$tooltip))},t.prototype.componentDidMount=function(){h_(this.props)||this.props.children(this.gitgraph.getUserApi())},t.prototype.componentDidUpdate=function(){if(this.$graph.current){var n=this.$graph.current.getBBox(),r=n.height,s=n.width;this.$graph.current.setAttribute("width",(s+yc.padding+Ei.paddingX).toString()),this.$graph.current.setAttribute("height",(r+yc.padding+Ei.paddingY).toString())}if(this.state.shouldRecomputeOffsets&&this.$commits.current){var a=Array.from(this.$commits.current.children);this.setState({commitYWithOffsets:this.computeOffsets(a),shouldRecomputeOffsets:!1})}},t.prototype.setCurrentCommitOver=function(n){this.setState({currentCommitOver:n})},t.prototype.setTooltip=function(n){this.$tooltip=n},t.prototype.renderBranchesPaths=function(){var n=this,r=this.gitgraph.template.commit.dot.size,s=this.gitgraph.template.branch.mergeStyle===v4.Bezier;return Array.from(this.state.branchesPaths).map(function(a){var u=a[0],h=a[1];return oe.createElement(I4,{key:u.name,gitgraph:n.gitgraph,branch:u,coordinates:h,getWithCommitOffset:n.getWithCommitOffset.bind(n),isBezier:s,offset:r})})},t.prototype.computeOffsets=function(n){var r=0,s=this.gitgraph.orientation===x4.VerticalReverse?n:n.reverse();return s.reduce(function(a,u){var h=parseInt(u.getAttribute("transform").split(",")[1].slice(0,-1),10),p=u.getElementsByTagName("foreignObject")[0],g=p&&p.firstElementChild,v=0;if(g){var O=g.getBoundingClientRect().height,b=window.getComputedStyle(g).marginTop||"0px",F=parseInt(b.replace("px",""),10);v=O+F}return p&&p.setAttribute("height",v+"px"),a[h]=h+r,r+=v,a},{})},t.prototype.getWithCommitOffset=function(n){var r=n.x,s=n.y;return{x:r,y:this.state.commitYWithOffsets[s]||s}},t.defaultProps={options:{}},t}(oe.Component);class W4 extends oe.Component{constructor(t){super(t),this.clickety=this.clickety.bind(this),this.clickCommit=this.clickCommit.bind(this),this.submit=this.submit.bind(this),this.graph=this.graph.bind(this),this.template=_4(y4.Metro,{branch:{lineWidth:6},commit:{spacing:40,dot:{size:10},message:{displayHash:!1,displayAuthor:!1,font:"normal 16pt monospace"}}})}componentDidMount(){api.getCommits()}clickety(){let{commits:t,gitgraph:n}=this.props;if(!t.commits)return;let r={};t.commits.forEach(a=>{r[a.commitHash]=a});let s=t.commits.map(a=>{console.log(a.commitHash,t.head);let u=[];return a.commitHash in t.head&&(u=["HEAD",t.head[a.commitHash]]),{refs:u,hash:a.commitHash.slice(2),parents:a.parents.map(h=>h.slice(2)),onMessageClick:this.clickCommit,subject:"commit: "+a.commitHash.slice(-5)+", content: "+a.contentHash.slice(-5)+", parents: "+a.parents.map(h=>h.slice(-5)),author:{name:"me",email:"me",timestamp:15e11}}});n.import(s)}clickCommit(t,n){console.log("click",t);let r=t.refs.slice(-1)[0];if(r)this.bobDesk.value==""?this.bobDesk.value=r:this.aliDesk.value=r;else return}submit(){api.pottery({ali:this.aliDesk.value,bob:this.bobDesk.value,germ:this.germ.value})}graph(t){this.setState({gitgraph:t})}render(){let t="f7 mono ba bg-gray0-d white-d pa3 mb2 db focus-b--black focus-b--white-d b--gray3 b--gray2-d nowrap ";return y.Fragment,this.submit,this.clickety(),y.jsx("div",{className:"cf w-100 flex flex-column pa4 ba-m ba-l ba-xl b--gray2 br1 h-100 h-100-minus-40-m h-100-minus-40-l h-100-minus-40-xl f9 white-d",children:y.jsx(U4,{options:{template:this.template},children:this.graph})})}}class B4 extends oe.Component{constructor(t){super(t),this.state={},this.loadBindings=this.loadBindings.bind(this),this.loadCache=this.loadCache.bind(this),this.loadConnections=this.loadConnections.bind(this),this.loadAuthenticationState=this.loadAuthenticationState.bind(this),this.loadChannels=this.loadChannels.bind(this)}componentDidMount(){const{props:t}=this;t.bindings.length===0&&this.loadBindings(),t.cache.length===0&&this.loadCache(),t.connections.length==0&&this.loadConnections(),t.authentication.sessions.length==0&&this.loadAuthenticationState(),t.channels.length==0&&this.loadChannels()}componentDidUpdate(t,n){}loadBindings(){api.getBindings()}loadCache(){api.getCache()}clearCache(t){api.clearCache(t)}loadConnections(){api.getConnections()}loadAuthenticationState(){api.getAuthenticationState()}loadChannels(){api.getChannels()}render(){const{props:t,state:n}=this,r=t.bindings.map(v=>({key:v.location+" "+v.action,jsx:y.jsxs("div",{class:"flex",children:[y.jsx("div",{class:"flex-auto",style:{maxWidth:"50%"},children:v.location}),y.jsx("div",{class:"flex-auto",style:{maxWidth:"50%"},children:v.action})]})})),s=t.cache.map(v=>({key:v.url+" "+(v.val?"LIVE":"CLEARED"),jsx:y.jsxs("div",{class:"flex",style:{marginBottom:"3px"},children:[y.jsx("div",{style:{width:"45%"},children:v.url}),y.jsxs("div",{style:{width:"5%"},children:["(v",v.aeon,")"]}),v.val?y.jsxs("div",{style:{width:"50%",position:"relative"},children:[y.jsx("div",{style:{display:"inline-block",width:"10%"},children:v.val.auth?"auth":"free"}),y.jsx("div",{style:{display:"inline-block",width:"10%"},children:v.val.payload.status}),y.jsx("div",{style:{display:"inline-block",width:"50%"},children:v.val.payload.headers.reduce((O,b)=>(O?O+"; ":"")+b.key+"="+b.value,"")}),y.jsx("div",{style:{display:"inline-block",width:"25%"},children:v.val.payload.data?v.val.payload.data.toLocaleString("de-DE")+" bytes":"no data"}),y.jsx("div",{style:{display:"inline-block",width:"5%"},children:y.jsx("button",{onClick:()=>{this.clearCache(v.url)},children:"clear"})})]}):"cleared"]})})),a=t.connections.map(v=>({key:v.duct+" "+v.action,jsx:y.jsx("table",{style:{borderBottom:"1px solid black"},children:y.jsxs("tbody",{children:[y.jsxs("tr",{children:[y.jsx("td",{class:"inter",children:"duct"}),y.jsx("td",{children:v.duct})]}),y.jsxs("tr",{children:[y.jsx("td",{class:"inter",children:"binding"}),y.jsx("td",{children:v.action})]}),y.jsxs("tr",{children:[y.jsx("td",{class:"inter",children:"request"}),y.jsxs("td",{children:["from ",v.request.source,",",v.request.authenticated?" ":" un","authenticated and",v.request.secure?" ":" in","secure"]})]}),y.jsxs("tr",{children:[y.jsx("td",{class:"inter",children:"response"}),y.jsxs("td",{children:["sent ",v.response.sent," bytes.",y.jsx("br",{}),v.response.header?y.jsxs(y.Fragment,{children:["status ",v.response.header["status-code"],y.jsx("br",{}),v.response.header.headers.reduce((O,b)=>O+b+", ","")]}):null]})]})]})})})),u=t.channels.map(v=>{const O=y.jsxs(y.Fragment,{children:[v.session,y.jsx("table",{style:{borderBottom:"1px solid black"},children:y.jsxs("tbody",{children:[y.jsxs("tr",{children:[y.jsx("td",{class:"inter",children:"identity"}),y.jsx("td",{children:v.identity})]}),y.jsxs("tr",{children:[y.jsx("td",{class:"inter",children:"connected?"}),y.jsx("td",{children:v.connected?"connected":"disconnected, expires "+Mi(v.expiry)})]}),y.jsxs("tr",{children:[y.jsx("td",{class:"inter",children:"next-id"}),y.jsx("td",{children:v["next-id"]})]}),y.jsxs("tr",{children:[y.jsx("td",{class:"inter",children:"last-ack"}),y.jsx("td",{children:Mi(v["last-ack"])})]}),y.jsxs("tr",{children:[y.jsx("td",{class:"inter",children:"unacked"}),y.jsx("td",{children:v.unacked.reduce((F,z)=>F+z+", ","")})]})]})})]}),b=v.subscriptions.map(F=>({key:`${F.id} ${F.ship} ${F.app} ${F.path}`,jsx:y.jsxs("div",{class:"flex",children:[y.jsx("div",{class:"flex-auto",style:{maxWidth:"15%"},children:F.id}),y.jsxs("div",{class:"flex-auto",style:{maxWidth:"15%"},children:["~",F.ship]}),y.jsx("div",{class:"flex-auto",style:{maxWidth:"20%"},children:F.app}),y.jsx("div",{class:"flex-auto",style:{maxWidth:"35%"},children:F.path}),y.jsx("div",{class:"flex-auto",style:{maxWidth:"15%"},children:F.unacked})]})}));return{key:v.session,jsx:y.jsx(Oo,{summary:O,details:y.jsx(Ht,{placeholder:"id, ship, app, path",items:b})})}}),h=t.authentication.sessions.map(v=>({key:v.identity,jsx:y.jsxs("div",{class:"flex",children:[y.jsxs("div",{class:"flex-auto",style:{maxWidth:"5em"},children:[v.cookie.slice(0,6),"…"]}),y.jsxs("div",{class:"flex-auto",style:{width:"40%"},children:["~",v.identity]}),y.jsx("div",{class:"flex-auto",children:Mi(v.expiry)}),y.jsxs("div",{class:"flex-auto",children:[v.channels," channel(s)"]}),y.jsx("div",{class:"flex-auto",children:y.jsxs("form",{method:"post",action:"/~/logout?redirect=/~debug/eyre",children:[y.jsx("input",{type:"hidden",name:"sid",value:v.cookie}),y.jsx("button",{type:"submit",name:"all",children:"kick"})]})})]})})),p=t.authentication.visiting.map(v=>({key:"~"+v.who+":"+v.nonce,jsx:y.jsxs("div",{class:"flex",children:[y.jsxs("div",{class:"flex-auto",children:["~",v.who]}),y.jsx("div",{class:"flex-auto",children:v.nonce}),y.jsx("div",{class:"flex-auto",children:v.goal?"pending, will return to "+v.goal:y.jsxs("form",{method:"post",action:"/~/logout?redirect=/~debug/eyre",children:["logged in since ",Mi(v.made),y.jsx("input",{type:"hidden",name:"host",value:"~"+v.who}),y.jsx("input",{type:"hidden",name:"sid",value:v.nonce}),y.jsx("button",{type:"submit",name:"eauth",children:"log out"})]})})]})})),g=t.authentication.visitors.map(v=>({key:v.nonce+":~"+v.ship,jsx:y.jsxs("div",{class:"flex",children:[y.jsx("div",{class:"flex-auto",children:v.nonce}),y.jsx("div",{class:"flex-auto",children:v.duct}),v.sesh?y.jsxs("div",{class:"flex-auto",children:["session: ",v.sesh.slice(0,6),"…"]}):y.jsxs(y.Fragment,{children:[y.jsx("div",{class:"flex-auto",children:v.pend?"request pending":"no pending request"}),y.jsx("div",{class:"flex-auto",children:v.ship}),y.jsxs("div",{class:"flex-auto",children:["redirect: ",v.last]}),y.jsx("div",{class:"flex-auto",children:v.toke?"token received":"no token yet"})]})]})}));return y.jsxs(y.Fragment,{children:[y.jsx("h4",{children:"Bindings"}),y.jsx(Ht,{placeholder:"binding",items:r,children:y.jsx("button",{onClick:this.loadBindings,children:"refresh"})}),y.jsx("h4",{children:"Cache"}),t.cache.reduce((v,O)=>v+(O.val&&O.val.payload.data||0),0).toLocaleString("de-DE")," bytes in cache",y.jsx(Ht,{placeholder:"cache url, LIVE vs CLEARED",items:s,open:!1,children:y.jsx("button",{onClick:this.loadCache,children:"refresh"})}),y.jsx("h4",{children:"Connections"}),y.jsx(Ht,{placeholder:"duct, binding",items:a,children:y.jsx("button",{onClick:this.loadConnections,children:"refresh"})}),y.jsx("h4",{children:"Channels"}),y.jsx(Ht,{placeholder:"session id",items:u,children:y.jsx("button",{onClick:this.loadChannels,children:"refresh"})}),y.jsx("h4",{children:"Authentication"}),y.jsx("form",{method:"post",action:"/~/logout",children:y.jsx("button",{type:"submit",children:"logout self"})}),y.jsx("form",{method:"post",action:"/~/logout",children:y.jsx("button",{type:"submit",name:"all",children:"logout all selves"})}),y.jsx("br",{}),y.jsx("button",{onClick:this.loadAuthenticationState,children:"refresh"}),y.jsx("h3",{children:"Sessions"}),y.jsx(Ht,{placeholder:"identity",items:h,open:!1}),y.jsx("h3",{children:"Outgoing eauth"}),y.jsx(Ht,{placeholder:"host",items:p}),y.jsx("h3",{children:"Incoming eauth"}),y.jsx(Ht,{placeholder:"visitor",items:g})]})}}class z4 extends oe.Component{constructor(t){super(t),this.state=Pn.state,Pn.setStateHandler(this.setState.bind(this))}componentDidMount(){new Image().src="/~debug/img/Spinner.png"}render(){const{state:t}=this;return y.jsx(lb,{children:y.jsxs(ab,{children:[y.jsx(ks,{exact:!0,path:"/~debug",render:n=>y.jsx(Os,{status:t.status,selected:"",children:y.jsx(xj,{text:"select a component on the left"})})}),y.jsx(ks,{exact:!0,path:Es("apps"),render:n=>y.jsx(Os,{status:t.status,selected:"apps",children:y.jsx(C6,{apps:t.apps,...n})})}),y.jsx(ks,{exact:!0,path:Es("logs"),render:n=>y.jsx(Os,{status:t.status,selected:"logs",children:y.jsx(k6,{logs:t.logs,...n})})}),y.jsx(ks,{exact:!0,path:Es("spider"),render:n=>y.jsx(Os,{status:t.status,selected:"spider",children:y.jsx(O6,{threads:t.threads,...n})})}),y.jsx(ks,{exact:!0,path:Es("ames"),render:n=>y.jsx(Os,{status:t.status,selected:"ames",children:y.jsx(E6,{peers:t.peers,...n})})}),y.jsx(ks,{exact:!0,path:Es("behn"),render:n=>y.jsx(Os,{status:t.status,selected:"behn",children:y.jsx(T6,{timers:t.timers,...n})})}),y.jsx(ks,{exact:!0,path:Es("clay"),render:n=>y.jsx(Os,{status:t.status,selected:"clay",children:y.jsx(W4,{commits:t.commits,...n})})}),y.jsx(ks,{exact:!0,path:Es("eyre"),render:n=>y.jsx(Os,{status:t.status,selected:"eyre",children:y.jsx(B4,{bindings:t.bindings,cache:t.cache,connections:t.connections,authentication:t.authentication,channels:t.channels,...n})})})]})})}}Cg.setAuthTokens({ship:window.ship});console.log("new world!");window.urb=new window.channel;_j.start();cR.render(y.jsx(z4,{}),document.querySelectorAll("#root")[0])});export default $4(); diff --git a/pkg/arvo/app/debug/js/index.js b/pkg/arvo/app/debug/js/index.js deleted file mode 100644 index 1ca01870b8..0000000000 --- a/pkg/arvo/app/debug/js/index.js +++ /dev/null @@ -1,67646 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('buffer')) : - typeof define === 'function' && define.amd ? define('index', ['buffer'], factory) : - (global = global || self, factory(global.buffer)); -}(this, (function (buffer) { 'use strict'; - - buffer = buffer && Object.prototype.hasOwnProperty.call(buffer, 'default') ? buffer['default'] : buffer; - - var global$1 = (typeof global !== "undefined" ? global : - typeof self !== "undefined" ? self : - typeof window !== "undefined" ? window : {}); - - // from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js - var performance$1 = global$1.performance || {}; - var performanceNow = - performance$1.now || - performance$1.mozNow || - performance$1.msNow || - performance$1.oNow || - performance$1.webkitNow || - function(){ return (new Date()).getTime() }; - - var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; - - function commonjsRequire () { - throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs'); - } - - function unwrapExports (x) { - return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; - } - - function createCommonjsModule(fn, module) { - return module = { exports: {} }, fn(module, module.exports), module.exports; - } - - /* - object-assign - (c) Sindre Sorhus - @license MIT - */ - /* eslint-disable no-unused-vars */ - var getOwnPropertySymbols = Object.getOwnPropertySymbols; - var hasOwnProperty = Object.prototype.hasOwnProperty; - var propIsEnumerable = Object.prototype.propertyIsEnumerable; - - function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } - - return Object(val); - } - - function shouldUseNative() { - try { - if (!Object.assign) { - return false; - } - - // Detect buggy property enumeration order in older V8 versions. - - // https://bugs.chromium.org/p/v8/issues/detail?id=4118 - var test1 = new String('abc'); // eslint-disable-line no-new-wrappers - test1[5] = 'de'; - if (Object.getOwnPropertyNames(test1)[0] === '5') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test2 = {}; - for (var i = 0; i < 10; i++) { - test2['_' + String.fromCharCode(i)] = i; - } - var order2 = Object.getOwnPropertyNames(test2).map(function (n) { - return test2[n]; - }); - if (order2.join('') !== '0123456789') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test3 = {}; - 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { - test3[letter] = letter; - }); - if (Object.keys(Object.assign({}, test3)).join('') !== - 'abcdefghijklmnopqrst') { - return false; - } - - return true; - } catch (err) { - // We don't expect any of the above to throw, but better to be safe. - return false; - } - } - - var objectAssign = shouldUseNative() ? Object.assign : function (target, source) { - var from; - var to = toObject(target); - var symbols; - - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments[s]); - - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } - - if (getOwnPropertySymbols) { - symbols = getOwnPropertySymbols(from); - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]]; - } - } - } - } - - return to; - }; - - function C(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - printWarning('warn', format, args); - } - } - function error(format) { - { - for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - args[_key2 - 1] = arguments[_key2]; - } - - printWarning('error', format, args); - } - } - - function printWarning(level, format, args) { - // When changing this logic, you might want to also - // update consoleWithStackDev.www.js as well. - { - var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0; - - if (!hasExistingStack) { - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); - - if (stack !== '') { - format += '%s'; - args = args.concat([stack]); - } - } - - var argsWithFormat = args.map(function (item) { - return '' + item; - }); // Careful: RN currently depends on this prefix - - argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it - // breaks IE9: https://github.com/facebook/react/issues/13610 - // eslint-disable-next-line react-internal/no-production-logging - - Function.prototype.apply.call(console[level], console, argsWithFormat); - - try { - // --- Welcome to debugging React --- - // This error was thrown as a convenience so that you can use this stack - // to find the callsite that caused this warning to fire. - var argIndex = 0; - var message = 'Warning: ' + format.replace(/%s/g, function () { - return args[argIndex++]; - }); - throw new Error(message); - } catch (x) {} - } - } - - var didWarnStateUpdateForUnmountedComponent = {}; - - function warnNoop(publicInstance, callerName) { - { - var _constructor = publicInstance.constructor; - var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass'; - var warningKey = componentName + "." + callerName; - - if (didWarnStateUpdateForUnmountedComponent[warningKey]) { - return; - } - - error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName); - - didWarnStateUpdateForUnmountedComponent[warningKey] = true; - } - } - /** - * This is the abstract API for an update queue. - */ - - - var ReactNoopUpdateQueue = { - /** - * Checks whether or not this composite component is mounted. - * @param {ReactClass} publicInstance The instance we want to test. - * @return {boolean} True if mounted, false otherwise. - * @protected - * @final - */ - isMounted: function (publicInstance) { - return false; - }, - - /** - * Forces an update. This should only be invoked when it is known with - * certainty that we are **not** in a DOM transaction. - * - * You may want to call this when you know that some deeper aspect of the - * component's state has changed but `setState` was not called. - * - * This will not invoke `shouldComponentUpdate`, but it will invoke - * `componentWillUpdate` and `componentDidUpdate`. - * - * @param {ReactClass} publicInstance The instance that should rerender. - * @param {?function} callback Called after component is updated. - * @param {?string} callerName name of the calling function in the public API. - * @internal - */ - enqueueForceUpdate: function (publicInstance, callback, callerName) { - warnNoop(publicInstance, 'forceUpdate'); - }, - - /** - * Replaces all of the state. Always use this or `setState` to mutate state. - * You should treat `this.state` as immutable. - * - * There is no guarantee that `this.state` will be immediately updated, so - * accessing `this.state` after calling this method may return the old value. - * - * @param {ReactClass} publicInstance The instance that should rerender. - * @param {object} completeState Next state. - * @param {?function} callback Called after component is updated. - * @param {?string} callerName name of the calling function in the public API. - * @internal - */ - enqueueReplaceState: function (publicInstance, completeState, callback, callerName) { - warnNoop(publicInstance, 'replaceState'); - }, - - /** - * Sets a subset of the state. This only exists because _pendingState is - * internal. This provides a merging strategy that is not available to deep - * properties which is confusing. TODO: Expose pendingState or don't use it - * during the merge. - * - * @param {ReactClass} publicInstance The instance that should rerender. - * @param {object} partialState Next partial state to be merged with state. - * @param {?function} callback Called after component is updated. - * @param {?string} Name of the calling function in the public API. - * @internal - */ - enqueueSetState: function (publicInstance, partialState, callback, callerName) { - warnNoop(publicInstance, 'setState'); - } - }; - - var emptyObject = {}; - - { - Object.freeze(emptyObject); - } - /** - * Base class helpers for the updating state of a component. - */ - - - function Component(props, context, updater) { - this.props = props; - this.context = context; // If a component has string refs, we will assign a different object later. - - this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the - // renderer. - - this.updater = updater || ReactNoopUpdateQueue; - } - - Component.prototype.isReactComponent = {}; - /** - * Sets a subset of the state. Always use this to mutate - * state. You should treat `this.state` as immutable. - * - * There is no guarantee that `this.state` will be immediately updated, so - * accessing `this.state` after calling this method may return the old value. - * - * There is no guarantee that calls to `setState` will run synchronously, - * as they may eventually be batched together. You can provide an optional - * callback that will be executed when the call to setState is actually - * completed. - * - * When a function is provided to setState, it will be called at some point in - * the future (not synchronously). It will be called with the up to date - * component arguments (state, props, context). These values can be different - * from this.* because your function may be called after receiveProps but before - * shouldComponentUpdate, and this new state, props, and context will not yet be - * assigned to this. - * - * @param {object|function} partialState Next partial state or function to - * produce next partial state to be merged with current state. - * @param {?function} callback Called after state is updated. - * @final - * @protected - */ - - Component.prototype.setState = function (partialState, callback) { - if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) { - { - throw Error( "setState(...): takes an object of state variables to update or a function which returns an object of state variables." ); - } - } - - this.updater.enqueueSetState(this, partialState, callback, 'setState'); - }; - /** - * Forces an update. This should only be invoked when it is known with - * certainty that we are **not** in a DOM transaction. - * - * You may want to call this when you know that some deeper aspect of the - * component's state has changed but `setState` was not called. - * - * This will not invoke `shouldComponentUpdate`, but it will invoke - * `componentWillUpdate` and `componentDidUpdate`. - * - * @param {?function} callback Called after update is complete. - * @final - * @protected - */ - - - Component.prototype.forceUpdate = function (callback) { - this.updater.enqueueForceUpdate(this, callback, 'forceUpdate'); - }; - /** - * Deprecated APIs. These APIs used to exist on classic React classes but since - * we would like to deprecate them, we're not going to move them over to this - * modern base class. Instead, we define a getter that warns if it's accessed. - */ - - - { - var deprecatedAPIs = { - isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'], - replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'] - }; - - var defineDeprecationWarning = function (methodName, info) { - Object.defineProperty(Component.prototype, methodName, { - get: function () { - warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]); - - return undefined; - } - }); - }; - - for (var fnName in deprecatedAPIs) { - if (deprecatedAPIs.hasOwnProperty(fnName)) { - defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); - } - } - } - - function ComponentDummy() {} - - ComponentDummy.prototype = Component.prototype; - /** - * Convenience component with default shallow equality check for sCU. - */ - - function PureComponent(props, context, updater) { - this.props = props; - this.context = context; // If a component has string refs, we will assign a different object later. - - this.refs = emptyObject; - this.updater = updater || ReactNoopUpdateQueue; - } - - var pureComponentPrototype = PureComponent.prototype = new ComponentDummy(); - pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods. - - _assign(pureComponentPrototype, Component.prototype); - - pureComponentPrototype.isPureReactComponent = true; - - // an immutable object with a single mutable value - function createRef() { - var refObject = { - current: null - }; - - { - Object.seal(refObject); - } - - return refObject; - } - - var hasOwnProperty = Object.prototype.hasOwnProperty; - var RESERVED_PROPS = { - key: true, - ref: true, - __self: true, - __source: true - }; - var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs; - - { - didWarnAboutStringRefs = {}; - } - - function hasValidRef(config) { - { - if (hasOwnProperty.call(config, 'ref')) { - var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; - - if (getter && getter.isReactWarning) { - return false; - } - } - } - - return config.ref !== undefined; - } - - function hasValidKey(config) { - { - if (hasOwnProperty.call(config, 'key')) { - var getter = Object.getOwnPropertyDescriptor(config, 'key').get; - - if (getter && getter.isReactWarning) { - return false; - } - } - } - - return config.key !== undefined; - } - - function defineKeyPropWarningGetter(props, displayName) { - var warnAboutAccessingKey = function () { - { - if (!specialPropKeyWarningShown) { - specialPropKeyWarningShown = true; - - error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName); - } - } - }; - - warnAboutAccessingKey.isReactWarning = true; - Object.defineProperty(props, 'key', { - get: warnAboutAccessingKey, - configurable: true - }); - } - - function defineRefPropWarningGetter(props, displayName) { - var warnAboutAccessingRef = function () { - { - if (!specialPropRefWarningShown) { - specialPropRefWarningShown = true; - - error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName); - } - } - }; - - warnAboutAccessingRef.isReactWarning = true; - Object.defineProperty(props, 'ref', { - get: warnAboutAccessingRef, - configurable: true - }); - } - - function warnIfStringRefCannotBeAutoConverted(config) { - { - if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) { - var componentName = getComponentName(ReactCurrentOwner.current.type); - - if (!didWarnAboutStringRefs[componentName]) { - error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://fb.me/react-strict-mode-string-ref', getComponentName(ReactCurrentOwner.current.type), config.ref); - - didWarnAboutStringRefs[componentName] = true; - } - } - } - } - /** - * Factory method to create a new React element. This no longer adheres to - * the class pattern, so do not use new to call it. Also, instanceof check - * will not work. Instead test $$typeof field against Symbol.for('react.element') to check - * if something is a React Element. - * - * @param {*} type - * @param {*} props - * @param {*} key - * @param {string|object} ref - * @param {*} owner - * @param {*} self A *temporary* helper to detect places where `this` is - * different from the `owner` when React.createElement is called, so that we - * can warn. We want to get rid of owner and replace string `ref`s with arrow - * functions, and as long as `this` and owner are the same, there will be no - * change in behavior. - * @param {*} source An annotation object (added by a transpiler or otherwise) - * indicating filename, line number, and/or other information. - * @internal - */ - - - var ReactElement = function (type, key, ref, self, source, owner, props) { - var element = { - // This tag allows us to uniquely identify this as a React Element - $$typeof: REACT_ELEMENT_TYPE, - // Built-in properties that belong on the element - type: type, - key: key, - ref: ref, - props: props, - // Record the component responsible for creating this element. - _owner: owner - }; - - { - // The validation flag is currently mutative. We put it on - // an external backing store so that we can freeze the whole object. - // This can be replaced with a WeakMap once they are implemented in - // commonly used development environments. - element._store = {}; // To make comparing ReactElements easier for testing purposes, we make - // the validation flag non-enumerable (where possible, which should - // include every environment we run tests in), so the test framework - // ignores it. - - Object.defineProperty(element._store, 'validated', { - configurable: false, - enumerable: false, - writable: true, - value: false - }); // self and source are DEV only properties. - - Object.defineProperty(element, '_self', { - configurable: false, - enumerable: false, - writable: false, - value: self - }); // Two elements created in two different places should be considered - // equal for testing purposes and therefore we hide it from enumeration. - - Object.defineProperty(element, '_source', { - configurable: false, - enumerable: false, - writable: false, - value: source - }); - - if (Object.freeze) { - Object.freeze(element.props); - Object.freeze(element); - } - } - - return element; - }; - /** - * Create and return a new ReactElement of the given type. - * See https://reactjs.org/docs/react-api.html#createelement - */ - - function createElement(type, config, children) { - var propName; // Reserved names are extracted - - var props = {}; - var key = null; - var ref = null; - var self = null; - var source = null; - - if (config != null) { - if (hasValidRef(config)) { - ref = config.ref; - - { - warnIfStringRefCannotBeAutoConverted(config); - } - } - - if (hasValidKey(config)) { - key = '' + config.key; - } - - self = config.__self === undefined ? null : config.__self; - source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object - - for (propName in config) { - if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { - props[propName] = config[propName]; - } - } - } // Children can be more than one argument, and those are transferred onto - // the newly allocated props object. - - - var childrenLength = arguments.length - 2; - - if (childrenLength === 1) { - props.children = children; - } else if (childrenLength > 1) { - var childArray = Array(childrenLength); - - for (var i = 0; i < childrenLength; i++) { - childArray[i] = arguments[i + 2]; - } - - { - if (Object.freeze) { - Object.freeze(childArray); - } - } - - props.children = childArray; - } // Resolve default props - - - if (type && type.defaultProps) { - var defaultProps = type.defaultProps; - - for (propName in defaultProps) { - if (props[propName] === undefined) { - props[propName] = defaultProps[propName]; - } - } - } - - { - if (key || ref) { - var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; - - if (key) { - defineKeyPropWarningGetter(props, displayName); - } - - if (ref) { - defineRefPropWarningGetter(props, displayName); - } - } - } - - return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); - } - function cloneAndReplaceKey(oldElement, newKey) { - var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); - return newElement; - } - /** - * Clone and return a new ReactElement using element as the starting point. - * See https://reactjs.org/docs/react-api.html#cloneelement - */ - - function cloneElement(element, config, children) { - if (!!(element === null || element === undefined)) { - { - throw Error( "React.cloneElement(...): The argument must be a React element, but you passed " + element + "." ); - } - } - - var propName; // Original props are copied - - var props = _assign({}, element.props); // Reserved names are extracted - - - var key = element.key; - var ref = element.ref; // Self is preserved since the owner is preserved. - - var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a - // transpiler, and the original source is probably a better indicator of the - // true owner. - - var source = element._source; // Owner will be preserved, unless ref is overridden - - var owner = element._owner; - - if (config != null) { - if (hasValidRef(config)) { - // Silently steal the ref from the parent. - ref = config.ref; - owner = ReactCurrentOwner.current; - } - - if (hasValidKey(config)) { - key = '' + config.key; - } // Remaining properties override existing props - - - var defaultProps; - - if (element.type && element.type.defaultProps) { - defaultProps = element.type.defaultProps; - } - - for (propName in config) { - if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { - if (config[propName] === undefined && defaultProps !== undefined) { - // Resolve default props - props[propName] = defaultProps[propName]; - } else { - props[propName] = config[propName]; - } - } - } - } // Children can be more than one argument, and those are transferred onto - // the newly allocated props object. - - - var childrenLength = arguments.length - 2; - - if (childrenLength === 1) { - props.children = children; - } else if (childrenLength > 1) { - var childArray = Array(childrenLength); - - for (var i = 0; i < childrenLength; i++) { - childArray[i] = arguments[i + 2]; - } - - props.children = childArray; - } - - return ReactElement(element.type, key, ref, self, source, owner, props); - } - /** - * Verifies the object is a ReactElement. - * See https://reactjs.org/docs/react-api.html#isvalidelement - * @param {?object} object - * @return {boolean} True if `object` is a ReactElement. - * @final - */ - - function isValidElement(object) { - return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; - } - - var SEPARATOR = '.'; - var SUBSEPARATOR = ':'; - /** - * Escape and wrap key so it is safe to use as a reactid - * - * @param {string} key to be escaped. - * @return {string} the escaped key. - */ - - function escape(key) { - var escapeRegex = /[=:]/g; - var escaperLookup = { - '=': '=0', - ':': '=2' - }; - var escapedString = ('' + key).replace(escapeRegex, function (match) { - return escaperLookup[match]; - }); - return '$' + escapedString; - } - /** - * TODO: Test that a single child and an array with one item have the same key - * pattern. - */ - - - var didWarnAboutMaps = false; - var userProvidedKeyEscapeRegex = /\/+/g; - - function escapeUserProvidedKey(text) { - return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/'); - } - - var POOL_SIZE = 10; - var traverseContextPool = []; - - function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) { - if (traverseContextPool.length) { - var traverseContext = traverseContextPool.pop(); - traverseContext.result = mapResult; - traverseContext.keyPrefix = keyPrefix; - traverseContext.func = mapFunction; - traverseContext.context = mapContext; - traverseContext.count = 0; - return traverseContext; - } else { - return { - result: mapResult, - keyPrefix: keyPrefix, - func: mapFunction, - context: mapContext, - count: 0 - }; - } - } - - function releaseTraverseContext(traverseContext) { - traverseContext.result = null; - traverseContext.keyPrefix = null; - traverseContext.func = null; - traverseContext.context = null; - traverseContext.count = 0; - - if (traverseContextPool.length < POOL_SIZE) { - traverseContextPool.push(traverseContext); - } - } - /** - * @param {?*} children Children tree container. - * @param {!string} nameSoFar Name of the key path so far. - * @param {!function} callback Callback to invoke with each child found. - * @param {?*} traverseContext Used to pass information throughout the traversal - * process. - * @return {!number} The number of children in this subtree. - */ - - - function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) { - var type = typeof children; - - if (type === 'undefined' || type === 'boolean') { - // All of the above are perceived as null. - children = null; - } - - var invokeCallback = false; - - if (children === null) { - invokeCallback = true; - } else { - switch (type) { - case 'string': - case 'number': - invokeCallback = true; - break; - - case 'object': - switch (children.$$typeof) { - case REACT_ELEMENT_TYPE: - case REACT_PORTAL_TYPE: - invokeCallback = true; - } - - } - } - - if (invokeCallback) { - callback(traverseContext, children, // If it's the only child, treat the name as if it was wrapped in an array - // so that it's consistent if the number of children grows. - nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar); - return 1; - } - - var child; - var nextName; - var subtreeCount = 0; // Count of children found in the current subtree. - - var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; - - if (Array.isArray(children)) { - for (var i = 0; i < children.length; i++) { - child = children[i]; - nextName = nextNamePrefix + getComponentKey(child, i); - subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); - } - } else { - var iteratorFn = getIteratorFn(children); - - if (typeof iteratorFn === 'function') { - - { - // Warn about using Maps as children - if (iteratorFn === children.entries) { - if (!didWarnAboutMaps) { - warn('Using Maps as children is deprecated and will be removed in ' + 'a future major release. Consider converting children to ' + 'an array of keyed ReactElements instead.'); - } - - didWarnAboutMaps = true; - } - } - - var iterator = iteratorFn.call(children); - var step; - var ii = 0; - - while (!(step = iterator.next()).done) { - child = step.value; - nextName = nextNamePrefix + getComponentKey(child, ii++); - subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); - } - } else if (type === 'object') { - var addendum = ''; - - { - addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum(); - } - - var childrenString = '' + children; - - { - { - throw Error( "Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + ")." + addendum ); - } - } - } - } - - return subtreeCount; - } - /** - * Traverses children that are typically specified as `props.children`, but - * might also be specified through attributes: - * - * - `traverseAllChildren(this.props.children, ...)` - * - `traverseAllChildren(this.props.leftPanelChildren, ...)` - * - * The `traverseContext` is an optional argument that is passed through the - * entire traversal. It can be used to store accumulations or anything else that - * the callback might find relevant. - * - * @param {?*} children Children tree object. - * @param {!function} callback To invoke upon traversing each child. - * @param {?*} traverseContext Context for traversal. - * @return {!number} The number of children in this subtree. - */ - - - function traverseAllChildren(children, callback, traverseContext) { - if (children == null) { - return 0; - } - - return traverseAllChildrenImpl(children, '', callback, traverseContext); - } - /** - * Generate a key string that identifies a component within a set. - * - * @param {*} component A component that could contain a manual key. - * @param {number} index Index that is used if a manual key is not provided. - * @return {string} - */ - - - function getComponentKey(component, index) { - // Do some typechecking here since we call this blindly. We want to ensure - // that we don't block potential future ES APIs. - if (typeof component === 'object' && component !== null && component.key != null) { - // Explicit key - return escape(component.key); - } // Implicit key determined by the index in the set - - - return index.toString(36); - } - - function forEachSingleChild(bookKeeping, child, name) { - var func = bookKeeping.func, - context = bookKeeping.context; - func.call(context, child, bookKeeping.count++); - } - /** - * Iterates through children that are typically specified as `props.children`. - * - * See https://reactjs.org/docs/react-api.html#reactchildrenforeach - * - * The provided forEachFunc(child, index) will be called for each - * leaf child. - * - * @param {?*} children Children tree container. - * @param {function(*, int)} forEachFunc - * @param {*} forEachContext Context for forEachContext. - */ - - - function forEachChildren(children, forEachFunc, forEachContext) { - if (children == null) { - return children; - } - - var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext); - traverseAllChildren(children, forEachSingleChild, traverseContext); - releaseTraverseContext(traverseContext); - } - - function mapSingleChildIntoContext(bookKeeping, child, childKey) { - var result = bookKeeping.result, - keyPrefix = bookKeeping.keyPrefix, - func = bookKeeping.func, - context = bookKeeping.context; - var mappedChild = func.call(context, child, bookKeeping.count++); - - if (Array.isArray(mappedChild)) { - mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) { - return c; - }); - } else if (mappedChild != null) { - if (isValidElement(mappedChild)) { - mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as - // traverseAllChildren used to do for objects as children - keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey); - } - - result.push(mappedChild); - } - } - - function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) { - var escapedPrefix = ''; - - if (prefix != null) { - escapedPrefix = escapeUserProvidedKey(prefix) + '/'; - } - - var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context); - traverseAllChildren(children, mapSingleChildIntoContext, traverseContext); - releaseTraverseContext(traverseContext); - } - /** - * Maps children that are typically specified as `props.children`. - * - * See https://reactjs.org/docs/react-api.html#reactchildrenmap - * - * The provided mapFunction(child, key, index) will be called for each - * leaf child. - * - * @param {?*} children Children tree container. - * @param {function(*, int)} func The map function. - * @param {*} context Context for mapFunction. - * @return {object} Object containing the ordered map of results. - */ - - - function mapChildren(children, func, context) { - if (children == null) { - return children; - } - - var result = []; - mapIntoWithKeyPrefixInternal(children, result, null, func, context); - return result; - } - /** - * Count the number of children that are typically specified as - * `props.children`. - * - * See https://reactjs.org/docs/react-api.html#reactchildrencount - * - * @param {?*} children Children tree container. - * @return {number} The number of children. - */ - - - function countChildren(children) { - return traverseAllChildren(children, function () { - return null; - }, null); - } - /** - * Flatten a children object (typically specified as `props.children`) and - * return an array with appropriately re-keyed children. - * - * See https://reactjs.org/docs/react-api.html#reactchildrentoarray - */ - - - function toArray(children) { - var result = []; - mapIntoWithKeyPrefixInternal(children, result, null, function (child) { - return child; - }); - return result; - } - /** - * Returns the first child in a collection of children and verifies that there - * is only one child in the collection. - * - * See https://reactjs.org/docs/react-api.html#reactchildrenonly - * - * The current implementation of this function assumes that a single child gets - * passed without a wrapper, but the purpose of this helper function is to - * abstract away the particular structure of children. - * - * @param {?object} children Child collection structure. - * @return {ReactElement} The first and only `ReactElement` contained in the - * structure. - */ - - - function onlyChild(children) { - if (!isValidElement(children)) { - { - throw Error( "React.Children.only expected to receive a single React element child." ); - } - } - - return children; - } - - function createContext(defaultValue, calculateChangedBits) { - if (calculateChangedBits === undefined) { - calculateChangedBits = null; - } else { - { - if (calculateChangedBits !== null && typeof calculateChangedBits !== 'function') { - error('createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits); - } - } - } - - var context = { - $$typeof: REACT_CONTEXT_TYPE, - _calculateChangedBits: calculateChangedBits, - // As a workaround to support multiple concurrent renderers, we categorize - // some renderers as primary and others as secondary. We only expect - // there to be two concurrent renderers at most: React Native (primary) and - // Fabric (secondary); React DOM (primary) and React ART (secondary). - // Secondary renderers store their context values on separate fields. - _currentValue: defaultValue, - _currentValue2: defaultValue, - // Used to track how many concurrent renderers this context currently - // supports within in a single renderer. Such as parallel server rendering. - _threadCount: 0, - // These are circular - Provider: null, - Consumer: null - }; - context.Provider = { - $$typeof: REACT_PROVIDER_TYPE, - _context: context - }; - var hasWarnedAboutUsingNestedContextConsumers = false; - var hasWarnedAboutUsingConsumerProvider = false; - - { - // A separate object, but proxies back to the original context object for - // backwards compatibility. It has a different $$typeof, so we can properly - // warn for the incorrect usage of Context as a Consumer. - var Consumer = { - $$typeof: REACT_CONTEXT_TYPE, - _context: context, - _calculateChangedBits: context._calculateChangedBits - }; // $FlowFixMe: Flow complains about not setting a value, which is intentional here - - Object.defineProperties(Consumer, { - Provider: { - get: function () { - if (!hasWarnedAboutUsingConsumerProvider) { - hasWarnedAboutUsingConsumerProvider = true; - - error('Rendering is not supported and will be removed in ' + 'a future major release. Did you mean to render instead?'); - } - - return context.Provider; - }, - set: function (_Provider) { - context.Provider = _Provider; - } - }, - _currentValue: { - get: function () { - return context._currentValue; - }, - set: function (_currentValue) { - context._currentValue = _currentValue; - } - }, - _currentValue2: { - get: function () { - return context._currentValue2; - }, - set: function (_currentValue2) { - context._currentValue2 = _currentValue2; - } - }, - _threadCount: { - get: function () { - return context._threadCount; - }, - set: function (_threadCount) { - context._threadCount = _threadCount; - } - }, - Consumer: { - get: function () { - if (!hasWarnedAboutUsingNestedContextConsumers) { - hasWarnedAboutUsingNestedContextConsumers = true; - - error('Rendering is not supported and will be removed in ' + 'a future major release. Did you mean to render instead?'); - } - - return context.Consumer; - } - } - }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty - - context.Consumer = Consumer; - } - - { - context._currentRenderer = null; - context._currentRenderer2 = null; - } - - return context; - } - - function lazy(ctor) { - var lazyType = { - $$typeof: REACT_LAZY_TYPE, - _ctor: ctor, - // React uses these fields to store the result. - _status: -1, - _result: null - }; - - { - // In production, this would just set it on the object. - var defaultProps; - var propTypes; - Object.defineProperties(lazyType, { - defaultProps: { - configurable: true, - get: function () { - return defaultProps; - }, - set: function (newDefaultProps) { - error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.'); - - defaultProps = newDefaultProps; // Match production behavior more closely: - - Object.defineProperty(lazyType, 'defaultProps', { - enumerable: true - }); - } - }, - propTypes: { - configurable: true, - get: function () { - return propTypes; - }, - set: function (newPropTypes) { - error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.'); - - propTypes = newPropTypes; // Match production behavior more closely: - - Object.defineProperty(lazyType, 'propTypes', { - enumerable: true - }); - } - } - }); - } - - return lazyType; - } - - function forwardRef(render) { - { - if (render != null && render.$$typeof === REACT_MEMO_TYPE) { - error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).'); - } else if (typeof render !== 'function') { - error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render); - } else { - if (render.length !== 0 && render.length !== 2) { - error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.'); - } - } - - if (render != null) { - if (render.defaultProps != null || render.propTypes != null) { - error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?'); - } - } - } - - return { - $$typeof: REACT_FORWARD_REF_TYPE, - render: render - }; - } - - function isValidElementType(type) { - return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. - type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE); - } - - function memo(type, compare) { - { - if (!isValidElementType(type)) { - error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type); - } - } - - return { - $$typeof: REACT_MEMO_TYPE, - type: type, - compare: compare === undefined ? null : compare - }; - } - - function resolveDispatcher() { - var dispatcher = ReactCurrentDispatcher.current; - - if (!(dispatcher !== null)) { - { - throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." ); - } - } - - return dispatcher; - } - - function useContext(Context, unstable_observedBits) { - var dispatcher = resolveDispatcher(); - - { - if (unstable_observedBits !== undefined) { - error('useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://fb.me/rules-of-hooks' : ''); - } // TODO: add a more generic warning for invalid values. - - - if (Context._context !== undefined) { - var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs - // and nobody should be using this in existing code. - - if (realContext.Consumer === Context) { - error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?'); - } else if (realContext.Provider === Context) { - error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?'); - } - } - } - - return dispatcher.useContext(Context, unstable_observedBits); - } - function useState(initialState) { - var dispatcher = resolveDispatcher(); - return dispatcher.useState(initialState); - } - function useReducer(reducer, initialArg, init) { - var dispatcher = resolveDispatcher(); - return dispatcher.useReducer(reducer, initialArg, init); - } - function useRef(initialValue) { - var dispatcher = resolveDispatcher(); - return dispatcher.useRef(initialValue); - } - function useEffect(create, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useEffect(create, deps); - } - function useLayoutEffect(create, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useLayoutEffect(create, deps); - } - function useCallback(callback, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useCallback(callback, deps); - } - function useMemo(create, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useMemo(create, deps); - } - function useImperativeHandle(ref, create, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useImperativeHandle(ref, create, deps); - } - function useDebugValue(value, formatterFn) { - { - var dispatcher = resolveDispatcher(); - return dispatcher.useDebugValue(value, formatterFn); - } - } - - var propTypesMisspellWarningShown; - - { - propTypesMisspellWarningShown = false; - } - - function getDeclarationErrorAddendum() { - if (ReactCurrentOwner.current) { - var name = getComponentName(ReactCurrentOwner.current.type); - - if (name) { - return '\n\nCheck the render method of `' + name + '`.'; - } - } - - return ''; - } - - function getSourceInfoErrorAddendum(source) { - if (source !== undefined) { - var fileName = source.fileName.replace(/^.*[\\\/]/, ''); - var lineNumber = source.lineNumber; - return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.'; - } - - return ''; - } - - function getSourceInfoErrorAddendumForProps(elementProps) { - if (elementProps !== null && elementProps !== undefined) { - return getSourceInfoErrorAddendum(elementProps.__source); - } - - return ''; - } - /** - * Warn if there's no key explicitly set on dynamic arrays of children or - * object keys are not valid. This allows us to keep track of children between - * updates. - */ - - - var ownerHasKeyUseWarning = {}; - - function getCurrentComponentErrorInfo(parentType) { - var info = getDeclarationErrorAddendum(); - - if (!info) { - var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; - - if (parentName) { - info = "\n\nCheck the top-level render call using <" + parentName + ">."; - } - } - - return info; - } - /** - * Warn if the element doesn't have an explicit key assigned to it. - * This element is in an array. The array could grow and shrink or be - * reordered. All children that haven't already been validated are required to - * have a "key" property assigned to it. Error statuses are cached so a warning - * will only be shown once. - * - * @internal - * @param {ReactElement} element Element that requires a key. - * @param {*} parentType element's parent's type. - */ - - - function validateExplicitKey(element, parentType) { - if (!element._store || element._store.validated || element.key != null) { - return; - } - - element._store.validated = true; - var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); - - if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { - return; - } - - ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a - // property, it may be the creator of the child that's responsible for - // assigning it a key. - - var childOwner = ''; - - if (element && element._owner && element._owner !== ReactCurrentOwner.current) { - // Give the component that originally created this child. - childOwner = " It was passed a child from " + getComponentName(element._owner.type) + "."; - } - - setCurrentlyValidatingElement(element); - - { - error('Each child in a list should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner); - } - - setCurrentlyValidatingElement(null); - } - /** - * Ensure that every element either is passed in a static location, in an - * array with an explicit keys property defined, or in an object literal - * with valid key property. - * - * @internal - * @param {ReactNode} node Statically passed child of any type. - * @param {*} parentType node's parent's type. - */ - - - function validateChildKeys(node, parentType) { - if (typeof node !== 'object') { - return; - } - - if (Array.isArray(node)) { - for (var i = 0; i < node.length; i++) { - var child = node[i]; - - if (isValidElement(child)) { - validateExplicitKey(child, parentType); - } - } - } else if (isValidElement(node)) { - // This element was passed in a valid location. - if (node._store) { - node._store.validated = true; - } - } else if (node) { - var iteratorFn = getIteratorFn(node); - - if (typeof iteratorFn === 'function') { - // Entry iterators used to provide implicit keys, - // but now we print a separate warning for them later. - if (iteratorFn !== node.entries) { - var iterator = iteratorFn.call(node); - var step; - - while (!(step = iterator.next()).done) { - if (isValidElement(step.value)) { - validateExplicitKey(step.value, parentType); - } - } - } - } - } - } - /** - * Given an element, validate that its props follow the propTypes definition, - * provided by the type. - * - * @param {ReactElement} element - */ - - - function validatePropTypes(element) { - { - var type = element.type; - - if (type === null || type === undefined || typeof type === 'string') { - return; - } - - var name = getComponentName(type); - var propTypes; - - if (typeof type === 'function') { - propTypes = type.propTypes; - } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here. - // Inner props are checked in the reconciler. - type.$$typeof === REACT_MEMO_TYPE)) { - propTypes = type.propTypes; - } else { - return; - } - - if (propTypes) { - setCurrentlyValidatingElement(element); - checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum); - setCurrentlyValidatingElement(null); - } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) { - propTypesMisspellWarningShown = true; - - error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown'); - } - - if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) { - error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.'); - } - } - } - /** - * Given a fragment, validate that it can only be provided with fragment props - * @param {ReactElement} fragment - */ - - - function validateFragmentProps(fragment) { - { - setCurrentlyValidatingElement(fragment); - var keys = Object.keys(fragment.props); - - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - - if (key !== 'children' && key !== 'key') { - error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); - - break; - } - } - - if (fragment.ref !== null) { - error('Invalid attribute `ref` supplied to `React.Fragment`.'); - } - - setCurrentlyValidatingElement(null); - } - } - function createElementWithValidation(type, props, children) { - var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to - // succeed and there will likely be errors in render. - - if (!validType) { - var info = ''; - - if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { - info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; - } - - var sourceInfo = getSourceInfoErrorAddendumForProps(props); - - if (sourceInfo) { - info += sourceInfo; - } else { - info += getDeclarationErrorAddendum(); - } - - var typeString; - - if (type === null) { - typeString = 'null'; - } else if (Array.isArray(type)) { - typeString = 'array'; - } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { - typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />"; - info = ' Did you accidentally export a JSX literal instead of a component?'; - } else { - typeString = typeof type; - } - - { - error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info); - } - } - - var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used. - // TODO: Drop this when these are no longer allowed as the type argument. - - if (element == null) { - return element; - } // Skip key warning if the type isn't valid since our key validation logic - // doesn't expect a non-string/function type and can throw confusing errors. - // We don't want exception behavior to differ between dev and prod. - // (Rendering will throw with a helpful message and as soon as the type is - // fixed, the key warnings will appear.) - - - if (validType) { - for (var i = 2; i < arguments.length; i++) { - validateChildKeys(arguments[i], type); - } - } - - if (type === REACT_FRAGMENT_TYPE) { - validateFragmentProps(element); - } else { - validatePropTypes(element); - } - - return element; - } - var didWarnAboutDeprecatedCreateFactory = false; - function createFactoryWithValidation(type) { - var validatedFactory = createElementWithValidation.bind(null, type); - validatedFactory.type = type; - - { - if (!didWarnAboutDeprecatedCreateFactory) { - didWarnAboutDeprecatedCreateFactory = true; - - warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.'); - } // Legacy hook: remove it - - - Object.defineProperty(validatedFactory, 'type', { - enumerable: false, - get: function () { - warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.'); - - Object.defineProperty(this, 'type', { - value: type - }); - return type; - } - }); - } - - return validatedFactory; - } - function cloneElementWithValidation(element, props, children) { - var newElement = cloneElement.apply(this, arguments); - - for (var i = 2; i < arguments.length; i++) { - validateChildKeys(arguments[i], newElement.type); - } - - validatePropTypes(newElement); - return newElement; - } - - { - - try { - var frozenObject = Object.freeze({}); - var testMap = new Map([[frozenObject, null]]); - var testSet = new Set([frozenObject]); // This is necessary for Rollup to not consider these unused. - // https://github.com/rollup/rollup/issues/1771 - // TODO: we can remove these if Rollup fixes the bug. - - testMap.set(0, 0); - testSet.add(0); - } catch (e) { - } - } - - var createElement$1 = createElementWithValidation ; - var cloneElement$1 = cloneElementWithValidation ; - var createFactory = createFactoryWithValidation ; - var Children = { - map: mapChildren, - forEach: forEachChildren, - count: countChildren, - toArray: toArray, - only: onlyChild - }; - - exports.Children = Children; - exports.Component = Component; - exports.Fragment = REACT_FRAGMENT_TYPE; - exports.Profiler = REACT_PROFILER_TYPE; - exports.PureComponent = PureComponent; - exports.StrictMode = REACT_STRICT_MODE_TYPE; - exports.Suspense = REACT_SUSPENSE_TYPE; - exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals; - exports.cloneElement = cloneElement$1; - exports.createContext = createContext; - exports.createElement = createElement$1; - exports.createFactory = createFactory; - exports.createRef = createRef; - exports.forwardRef = forwardRef; - exports.isValidElement = isValidElement; - exports.lazy = lazy; - exports.memo = memo; - exports.useCallback = useCallback; - exports.useContext = useContext; - exports.useDebugValue = useDebugValue; - exports.useEffect = useEffect; - exports.useImperativeHandle = useImperativeHandle; - exports.useLayoutEffect = useLayoutEffect; - exports.useMemo = useMemo; - exports.useReducer = useReducer; - exports.useRef = useRef; - exports.useState = useState; - exports.version = ReactVersion; - })(); - } - }); - var react_development_1 = react_development.Children; - var react_development_2 = react_development.Component; - var react_development_3 = react_development.Fragment; - var react_development_4 = react_development.Profiler; - var react_development_5 = react_development.PureComponent; - var react_development_6 = react_development.StrictMode; - var react_development_7 = react_development.Suspense; - var react_development_8 = react_development.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - var react_development_9 = react_development.cloneElement; - var react_development_10 = react_development.createContext; - var react_development_11 = react_development.createElement; - var react_development_12 = react_development.createFactory; - var react_development_13 = react_development.createRef; - var react_development_14 = react_development.forwardRef; - var react_development_15 = react_development.isValidElement; - var react_development_16 = react_development.lazy; - var react_development_17 = react_development.memo; - var react_development_18 = react_development.useCallback; - var react_development_19 = react_development.useContext; - var react_development_20 = react_development.useDebugValue; - var react_development_21 = react_development.useEffect; - var react_development_22 = react_development.useImperativeHandle; - var react_development_23 = react_development.useLayoutEffect; - var react_development_24 = react_development.useMemo; - var react_development_25 = react_development.useReducer; - var react_development_26 = react_development.useRef; - var react_development_27 = react_development.useState; - var react_development_28 = react_development.version; - - var react = createCommonjsModule(function (module) { - - { - module.exports = react_development; - } - }); - var react_1 = react.Component; - var react_2 = react.createRef; - var react_3 = react.createElement; - var react_4 = react.useState; - var react_5 = react.useRef; - var react_6 = react.useEffect; - var react_7 = react.Fragment; - - var scheduler_production_min = createCommonjsModule(function (module, exports) { - var f,g,h,k,l; - if("undefined"===typeof window||"function"!==typeof MessageChannel){var p=null,q=null,t=function(){if(null!==p)try{var a=exports.unstable_now();p(!0,a);p=null;}catch(b){throw setTimeout(t,0),b;}},u=Date.now();exports.unstable_now=function(){return Date.now()-u};f=function(a){null!==p?setTimeout(f,0,a):(p=a,setTimeout(t,0));};g=function(a,b){q=setTimeout(a,b);};h=function(){clearTimeout(q);};k=function(){return !1};l=exports.unstable_forceFrameRate=function(){};}else {var w=window.performance,x=window.Date, - y=window.setTimeout,z=window.clearTimeout;if("undefined"!==typeof console){var A=window.cancelAnimationFrame;"function"!==typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills");"function"!==typeof A&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills");}if("object"=== - typeof w&&"function"===typeof w.now)exports.unstable_now=function(){return w.now()};else {var B=x.now();exports.unstable_now=function(){return x.now()-B};}var C=!1,D=null,E=-1,F=5,G=0;k=function(){return exports.unstable_now()>=G};l=function(){};exports.unstable_forceFrameRate=function(a){0>a||125>>1,e=a[d];if(void 0!==e&&0K(n,c))void 0!==r&&0>K(r,n)?(a[d]=r,a[v]=c,d=v):(a[d]=n,a[m]=c,d=m);else if(void 0!==r&&0>K(r,c))a[d]=r,a[v]=c,d=v;else break a}}return b}return null}function K(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}var N=[],O=[],P=1,Q=null,R=3,S=!1,T=!1,U=!1; - function V(a){for(var b=L(O);null!==b;){if(null===b.callback)M(O);else if(b.startTime<=a)M(O),b.sortIndex=b.expirationTime,J(N,b);else break;b=L(O);}}function W(a){U=!1;V(a);if(!T)if(null!==L(N))T=!0,f(X);else {var b=L(O);null!==b&&g(W,b.startTime-a);}} - function X(a,b){T=!1;U&&(U=!1,h());S=!0;var c=R;try{V(b);for(Q=L(N);null!==Q&&(!(Q.expirationTime>b)||a&&!k());){var d=Q.callback;if(null!==d){Q.callback=null;R=Q.priorityLevel;var e=d(Q.expirationTime<=b);b=exports.unstable_now();"function"===typeof e?Q.callback=e:Q===L(N)&&M(N);V(b);}else M(N);Q=L(N);}if(null!==Q)var m=!0;else {var n=L(O);null!==n&&g(W,n.startTime-b);m=!1;}return m}finally{Q=null,R=c,S=!1;}} - function Y(a){switch(a){case 1:return -1;case 2:return 250;case 5:return 1073741823;case 4:return 1E4;default:return 5E3}}var Z=l;exports.unstable_IdlePriority=5;exports.unstable_ImmediatePriority=1;exports.unstable_LowPriority=4;exports.unstable_NormalPriority=3;exports.unstable_Profiling=null;exports.unstable_UserBlockingPriority=2;exports.unstable_cancelCallback=function(a){a.callback=null;};exports.unstable_continueExecution=function(){T||S||(T=!0,f(X));}; - exports.unstable_getCurrentPriorityLevel=function(){return R};exports.unstable_getFirstCallbackNode=function(){return L(N)};exports.unstable_next=function(a){switch(R){case 1:case 2:case 3:var b=3;break;default:b=R;}var c=R;R=b;try{return a()}finally{R=c;}};exports.unstable_pauseExecution=function(){};exports.unstable_requestPaint=Z;exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3;}var c=R;R=a;try{return b()}finally{R=c;}}; - exports.unstable_scheduleCallback=function(a,b,c){var d=exports.unstable_now();if("object"===typeof c&&null!==c){var e=c.delay;e="number"===typeof e&&0d?(a.sortIndex=e,J(O,a),null===L(N)&&a===L(O)&&(U?h():U=!0,g(W,e-d))):(a.sortIndex=c,J(N,a),T||S||(T=!0,f(X)));return a}; - exports.unstable_shouldYield=function(){var a=exports.unstable_now();V(a);var b=L(N);return b!==Q&&null!==Q&&null!==b&&null!==b.callback&&b.startTime<=a&&b.expirationTime= deadline; - }; // Since we yield every frame regardless, `requestPaint` has no effect. - - - requestPaint = function () {}; - } - - exports.unstable_forceFrameRate = function (fps) { - if (fps < 0 || fps > 125) { - // Using console['error'] to evade Babel and ESLint - console['error']('forceFrameRate takes a positive int between 0 and 125, ' + 'forcing framerates higher than 125 fps is not unsupported'); - return; - } - - if (fps > 0) { - yieldInterval = Math.floor(1000 / fps); - } else { - // reset the framerate - yieldInterval = 5; - } - }; - - var performWorkUntilDeadline = function () { - if (scheduledHostCallback !== null) { - var currentTime = exports.unstable_now(); // Yield after `yieldInterval` ms, regardless of where we are in the vsync - // cycle. This means there's always time remaining at the beginning of - // the message event. - - deadline = currentTime + yieldInterval; - var hasTimeRemaining = true; - - try { - var hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime); - - if (!hasMoreWork) { - isMessageLoopRunning = false; - scheduledHostCallback = null; - } else { - // If there's more work, schedule the next message event at the end - // of the preceding one. - port.postMessage(null); - } - } catch (error) { - // If a scheduler task throws, exit the current browser task so the - // error can be observed. - port.postMessage(null); - throw error; - } - } else { - isMessageLoopRunning = false; - } // Yielding to the browser will give it a chance to paint, so we can - }; - - var channel = new MessageChannel(); - var port = channel.port2; - channel.port1.onmessage = performWorkUntilDeadline; - - requestHostCallback = function (callback) { - scheduledHostCallback = callback; - - if (!isMessageLoopRunning) { - isMessageLoopRunning = true; - port.postMessage(null); - } - }; - - requestHostTimeout = function (callback, ms) { - taskTimeoutID = _setTimeout(function () { - callback(exports.unstable_now()); - }, ms); - }; - - cancelHostTimeout = function () { - _clearTimeout(taskTimeoutID); - - taskTimeoutID = -1; - }; - } - - function push(heap, node) { - var index = heap.length; - heap.push(node); - siftUp(heap, node, index); - } - function peek(heap) { - var first = heap[0]; - return first === undefined ? null : first; - } - function pop(heap) { - var first = heap[0]; - - if (first !== undefined) { - var last = heap.pop(); - - if (last !== first) { - heap[0] = last; - siftDown(heap, last, 0); - } - - return first; - } else { - return null; - } - } - - function siftUp(heap, node, i) { - var index = i; - - while (true) { - var parentIndex = index - 1 >>> 1; - var parent = heap[parentIndex]; - - if (parent !== undefined && compare(parent, node) > 0) { - // The parent is larger. Swap positions. - heap[parentIndex] = node; - heap[index] = parent; - index = parentIndex; - } else { - // The parent is smaller. Exit. - return; - } - } - } - - function siftDown(heap, node, i) { - var index = i; - var length = heap.length; - - while (index < length) { - var leftIndex = (index + 1) * 2 - 1; - var left = heap[leftIndex]; - var rightIndex = leftIndex + 1; - var right = heap[rightIndex]; // If the left or right node is smaller, swap with the smaller of those. - - if (left !== undefined && compare(left, node) < 0) { - if (right !== undefined && compare(right, left) < 0) { - heap[index] = right; - heap[rightIndex] = node; - index = rightIndex; - } else { - heap[index] = left; - heap[leftIndex] = node; - index = leftIndex; - } - } else if (right !== undefined && compare(right, node) < 0) { - heap[index] = right; - heap[rightIndex] = node; - index = rightIndex; - } else { - // Neither child is smaller. Exit. - return; - } - } - } - - function compare(a, b) { - // Compare sort index first, then task id. - var diff = a.sortIndex - b.sortIndex; - return diff !== 0 ? diff : a.id - b.id; - } - - // TODO: Use symbols? - var NoPriority = 0; - var ImmediatePriority = 1; - var UserBlockingPriority = 2; - var NormalPriority = 3; - var LowPriority = 4; - var IdlePriority = 5; - - var runIdCounter = 0; - var mainThreadIdCounter = 0; - var profilingStateSize = 4; - var sharedProfilingBuffer = // $FlowFixMe Flow doesn't know about SharedArrayBuffer - typeof SharedArrayBuffer === 'function' ? new SharedArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : // $FlowFixMe Flow doesn't know about ArrayBuffer - typeof ArrayBuffer === 'function' ? new ArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : null // Don't crash the init path on IE9 - ; - var profilingState = sharedProfilingBuffer !== null ? new Int32Array(sharedProfilingBuffer) : []; // We can't read this but it helps save bytes for null checks - - var PRIORITY = 0; - var CURRENT_TASK_ID = 1; - var CURRENT_RUN_ID = 2; - var QUEUE_SIZE = 3; - - { - profilingState[PRIORITY] = NoPriority; // This is maintained with a counter, because the size of the priority queue - // array might include canceled tasks. - - profilingState[QUEUE_SIZE] = 0; - profilingState[CURRENT_TASK_ID] = 0; - } // Bytes per element is 4 - - - var INITIAL_EVENT_LOG_SIZE = 131072; - var MAX_EVENT_LOG_SIZE = 524288; // Equivalent to 2 megabytes - - var eventLogSize = 0; - var eventLogBuffer = null; - var eventLog = null; - var eventLogIndex = 0; - var TaskStartEvent = 1; - var TaskCompleteEvent = 2; - var TaskErrorEvent = 3; - var TaskCancelEvent = 4; - var TaskRunEvent = 5; - var TaskYieldEvent = 6; - var SchedulerSuspendEvent = 7; - var SchedulerResumeEvent = 8; - - function logEvent(entries) { - if (eventLog !== null) { - var offset = eventLogIndex; - eventLogIndex += entries.length; - - if (eventLogIndex + 1 > eventLogSize) { - eventLogSize *= 2; - - if (eventLogSize > MAX_EVENT_LOG_SIZE) { - // Using console['error'] to evade Babel and ESLint - console['error']("Scheduler Profiling: Event log exceeded maximum size. Don't " + 'forget to call `stopLoggingProfilingEvents()`.'); - stopLoggingProfilingEvents(); - return; - } - - var newEventLog = new Int32Array(eventLogSize * 4); - newEventLog.set(eventLog); - eventLogBuffer = newEventLog.buffer; - eventLog = newEventLog; - } - - eventLog.set(entries, offset); - } - } - - function startLoggingProfilingEvents() { - eventLogSize = INITIAL_EVENT_LOG_SIZE; - eventLogBuffer = new ArrayBuffer(eventLogSize * 4); - eventLog = new Int32Array(eventLogBuffer); - eventLogIndex = 0; - } - function stopLoggingProfilingEvents() { - var buffer = eventLogBuffer; - eventLogSize = 0; - eventLogBuffer = null; - eventLog = null; - eventLogIndex = 0; - return buffer; - } - function markTaskStart(task, ms) { - { - profilingState[QUEUE_SIZE]++; - - if (eventLog !== null) { - // performance.now returns a float, representing milliseconds. When the - // event is logged, it's coerced to an int. Convert to microseconds to - // maintain extra degrees of precision. - logEvent([TaskStartEvent, ms * 1000, task.id, task.priorityLevel]); - } - } - } - function markTaskCompleted(task, ms) { - { - profilingState[PRIORITY] = NoPriority; - profilingState[CURRENT_TASK_ID] = 0; - profilingState[QUEUE_SIZE]--; - - if (eventLog !== null) { - logEvent([TaskCompleteEvent, ms * 1000, task.id]); - } - } - } - function markTaskCanceled(task, ms) { - { - profilingState[QUEUE_SIZE]--; - - if (eventLog !== null) { - logEvent([TaskCancelEvent, ms * 1000, task.id]); - } - } - } - function markTaskErrored(task, ms) { - { - profilingState[PRIORITY] = NoPriority; - profilingState[CURRENT_TASK_ID] = 0; - profilingState[QUEUE_SIZE]--; - - if (eventLog !== null) { - logEvent([TaskErrorEvent, ms * 1000, task.id]); - } - } - } - function markTaskRun(task, ms) { - { - runIdCounter++; - profilingState[PRIORITY] = task.priorityLevel; - profilingState[CURRENT_TASK_ID] = task.id; - profilingState[CURRENT_RUN_ID] = runIdCounter; - - if (eventLog !== null) { - logEvent([TaskRunEvent, ms * 1000, task.id, runIdCounter]); - } - } - } - function markTaskYield(task, ms) { - { - profilingState[PRIORITY] = NoPriority; - profilingState[CURRENT_TASK_ID] = 0; - profilingState[CURRENT_RUN_ID] = 0; - - if (eventLog !== null) { - logEvent([TaskYieldEvent, ms * 1000, task.id, runIdCounter]); - } - } - } - function markSchedulerSuspended(ms) { - { - mainThreadIdCounter++; - - if (eventLog !== null) { - logEvent([SchedulerSuspendEvent, ms * 1000, mainThreadIdCounter]); - } - } - } - function markSchedulerUnsuspended(ms) { - { - if (eventLog !== null) { - logEvent([SchedulerResumeEvent, ms * 1000, mainThreadIdCounter]); - } - } - } - - /* eslint-disable no-var */ - // Math.pow(2, 30) - 1 - // 0b111111111111111111111111111111 - - var maxSigned31BitInt = 1073741823; // Times out immediately - - var IMMEDIATE_PRIORITY_TIMEOUT = -1; // Eventually times out - - var USER_BLOCKING_PRIORITY = 250; - var NORMAL_PRIORITY_TIMEOUT = 5000; - var LOW_PRIORITY_TIMEOUT = 10000; // Never times out - - var IDLE_PRIORITY = maxSigned31BitInt; // Tasks are stored on a min heap - - var taskQueue = []; - var timerQueue = []; // Incrementing id counter. Used to maintain insertion order. - - var taskIdCounter = 1; // Pausing the scheduler is useful for debugging. - var currentTask = null; - var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrancy. - - var isPerformingWork = false; - var isHostCallbackScheduled = false; - var isHostTimeoutScheduled = false; - - function advanceTimers(currentTime) { - // Check for tasks that are no longer delayed and add them to the queue. - var timer = peek(timerQueue); - - while (timer !== null) { - if (timer.callback === null) { - // Timer was cancelled. - pop(timerQueue); - } else if (timer.startTime <= currentTime) { - // Timer fired. Transfer to the task queue. - pop(timerQueue); - timer.sortIndex = timer.expirationTime; - push(taskQueue, timer); - - { - markTaskStart(timer, currentTime); - timer.isQueued = true; - } - } else { - // Remaining timers are pending. - return; - } - - timer = peek(timerQueue); - } - } - - function handleTimeout(currentTime) { - isHostTimeoutScheduled = false; - advanceTimers(currentTime); - - if (!isHostCallbackScheduled) { - if (peek(taskQueue) !== null) { - isHostCallbackScheduled = true; - requestHostCallback(flushWork); - } else { - var firstTimer = peek(timerQueue); - - if (firstTimer !== null) { - requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); - } - } - } - } - - function flushWork(hasTimeRemaining, initialTime) { - { - markSchedulerUnsuspended(initialTime); - } // We'll need a host callback the next time work is scheduled. - - - isHostCallbackScheduled = false; - - if (isHostTimeoutScheduled) { - // We scheduled a timeout but it's no longer needed. Cancel it. - isHostTimeoutScheduled = false; - cancelHostTimeout(); - } - - isPerformingWork = true; - var previousPriorityLevel = currentPriorityLevel; - - try { - if (enableProfiling) { - try { - return workLoop(hasTimeRemaining, initialTime); - } catch (error) { - if (currentTask !== null) { - var currentTime = exports.unstable_now(); - markTaskErrored(currentTask, currentTime); - currentTask.isQueued = false; - } - - throw error; - } - } else { - // No catch in prod codepath. - return workLoop(hasTimeRemaining, initialTime); - } - } finally { - currentTask = null; - currentPriorityLevel = previousPriorityLevel; - isPerformingWork = false; - - { - var _currentTime = exports.unstable_now(); - - markSchedulerSuspended(_currentTime); - } - } - } - - function workLoop(hasTimeRemaining, initialTime) { - var currentTime = initialTime; - advanceTimers(currentTime); - currentTask = peek(taskQueue); - - while (currentTask !== null && !(enableSchedulerDebugging )) { - if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) { - // This currentTask hasn't expired, and we've reached the deadline. - break; - } - - var callback = currentTask.callback; - - if (callback !== null) { - currentTask.callback = null; - currentPriorityLevel = currentTask.priorityLevel; - var didUserCallbackTimeout = currentTask.expirationTime <= currentTime; - markTaskRun(currentTask, currentTime); - var continuationCallback = callback(didUserCallbackTimeout); - currentTime = exports.unstable_now(); - - if (typeof continuationCallback === 'function') { - currentTask.callback = continuationCallback; - markTaskYield(currentTask, currentTime); - } else { - { - markTaskCompleted(currentTask, currentTime); - currentTask.isQueued = false; - } - - if (currentTask === peek(taskQueue)) { - pop(taskQueue); - } - } - - advanceTimers(currentTime); - } else { - pop(taskQueue); - } - - currentTask = peek(taskQueue); - } // Return whether there's additional work - - - if (currentTask !== null) { - return true; - } else { - var firstTimer = peek(timerQueue); - - if (firstTimer !== null) { - requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); - } - - return false; - } - } - - function unstable_runWithPriority(priorityLevel, eventHandler) { - switch (priorityLevel) { - case ImmediatePriority: - case UserBlockingPriority: - case NormalPriority: - case LowPriority: - case IdlePriority: - break; - - default: - priorityLevel = NormalPriority; - } - - var previousPriorityLevel = currentPriorityLevel; - currentPriorityLevel = priorityLevel; - - try { - return eventHandler(); - } finally { - currentPriorityLevel = previousPriorityLevel; - } - } - - function unstable_next(eventHandler) { - var priorityLevel; - - switch (currentPriorityLevel) { - case ImmediatePriority: - case UserBlockingPriority: - case NormalPriority: - // Shift down to normal priority - priorityLevel = NormalPriority; - break; - - default: - // Anything lower than normal priority should remain at the current level. - priorityLevel = currentPriorityLevel; - break; - } - - var previousPriorityLevel = currentPriorityLevel; - currentPriorityLevel = priorityLevel; - - try { - return eventHandler(); - } finally { - currentPriorityLevel = previousPriorityLevel; - } - } - - function unstable_wrapCallback(callback) { - var parentPriorityLevel = currentPriorityLevel; - return function () { - // This is a fork of runWithPriority, inlined for performance. - var previousPriorityLevel = currentPriorityLevel; - currentPriorityLevel = parentPriorityLevel; - - try { - return callback.apply(this, arguments); - } finally { - currentPriorityLevel = previousPriorityLevel; - } - }; - } - - function timeoutForPriorityLevel(priorityLevel) { - switch (priorityLevel) { - case ImmediatePriority: - return IMMEDIATE_PRIORITY_TIMEOUT; - - case UserBlockingPriority: - return USER_BLOCKING_PRIORITY; - - case IdlePriority: - return IDLE_PRIORITY; - - case LowPriority: - return LOW_PRIORITY_TIMEOUT; - - case NormalPriority: - default: - return NORMAL_PRIORITY_TIMEOUT; - } - } - - function unstable_scheduleCallback(priorityLevel, callback, options) { - var currentTime = exports.unstable_now(); - var startTime; - var timeout; - - if (typeof options === 'object' && options !== null) { - var delay = options.delay; - - if (typeof delay === 'number' && delay > 0) { - startTime = currentTime + delay; - } else { - startTime = currentTime; - } - - timeout = typeof options.timeout === 'number' ? options.timeout : timeoutForPriorityLevel(priorityLevel); - } else { - timeout = timeoutForPriorityLevel(priorityLevel); - startTime = currentTime; - } - - var expirationTime = startTime + timeout; - var newTask = { - id: taskIdCounter++, - callback: callback, - priorityLevel: priorityLevel, - startTime: startTime, - expirationTime: expirationTime, - sortIndex: -1 - }; - - { - newTask.isQueued = false; - } - - if (startTime > currentTime) { - // This is a delayed task. - newTask.sortIndex = startTime; - push(timerQueue, newTask); - - if (peek(taskQueue) === null && newTask === peek(timerQueue)) { - // All tasks are delayed, and this is the task with the earliest delay. - if (isHostTimeoutScheduled) { - // Cancel an existing timeout. - cancelHostTimeout(); - } else { - isHostTimeoutScheduled = true; - } // Schedule a timeout. - - - requestHostTimeout(handleTimeout, startTime - currentTime); - } - } else { - newTask.sortIndex = expirationTime; - push(taskQueue, newTask); - - { - markTaskStart(newTask, currentTime); - newTask.isQueued = true; - } // Schedule a host callback, if needed. If we're already performing work, - // wait until the next time we yield. - - - if (!isHostCallbackScheduled && !isPerformingWork) { - isHostCallbackScheduled = true; - requestHostCallback(flushWork); - } - } - - return newTask; - } - - function unstable_pauseExecution() { - } - - function unstable_continueExecution() { - - if (!isHostCallbackScheduled && !isPerformingWork) { - isHostCallbackScheduled = true; - requestHostCallback(flushWork); - } - } - - function unstable_getFirstCallbackNode() { - return peek(taskQueue); - } - - function unstable_cancelCallback(task) { - { - if (task.isQueued) { - var currentTime = exports.unstable_now(); - markTaskCanceled(task, currentTime); - task.isQueued = false; - } - } // Null out the callback to indicate the task has been canceled. (Can't - // remove from the queue because you can't remove arbitrary nodes from an - // array based heap, only the first one.) - - - task.callback = null; - } - - function unstable_getCurrentPriorityLevel() { - return currentPriorityLevel; - } - - function unstable_shouldYield() { - var currentTime = exports.unstable_now(); - advanceTimers(currentTime); - var firstTask = peek(taskQueue); - return firstTask !== currentTask && currentTask !== null && firstTask !== null && firstTask.callback !== null && firstTask.startTime <= currentTime && firstTask.expirationTime < currentTask.expirationTime || shouldYieldToHost(); - } - - var unstable_requestPaint = requestPaint; - var unstable_Profiling = { - startLoggingProfilingEvents: startLoggingProfilingEvents, - stopLoggingProfilingEvents: stopLoggingProfilingEvents, - sharedProfilingBuffer: sharedProfilingBuffer - } ; - - exports.unstable_IdlePriority = IdlePriority; - exports.unstable_ImmediatePriority = ImmediatePriority; - exports.unstable_LowPriority = LowPriority; - exports.unstable_NormalPriority = NormalPriority; - exports.unstable_Profiling = unstable_Profiling; - exports.unstable_UserBlockingPriority = UserBlockingPriority; - exports.unstable_cancelCallback = unstable_cancelCallback; - exports.unstable_continueExecution = unstable_continueExecution; - exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel; - exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode; - exports.unstable_next = unstable_next; - exports.unstable_pauseExecution = unstable_pauseExecution; - exports.unstable_requestPaint = unstable_requestPaint; - exports.unstable_runWithPriority = unstable_runWithPriority; - exports.unstable_scheduleCallback = unstable_scheduleCallback; - exports.unstable_shouldYield = unstable_shouldYield; - exports.unstable_wrapCallback = unstable_wrapCallback; - })(); - } - }); - var scheduler_development_1 = scheduler_development.unstable_now; - var scheduler_development_2 = scheduler_development.unstable_forceFrameRate; - var scheduler_development_3 = scheduler_development.unstable_IdlePriority; - var scheduler_development_4 = scheduler_development.unstable_ImmediatePriority; - var scheduler_development_5 = scheduler_development.unstable_LowPriority; - var scheduler_development_6 = scheduler_development.unstable_NormalPriority; - var scheduler_development_7 = scheduler_development.unstable_Profiling; - var scheduler_development_8 = scheduler_development.unstable_UserBlockingPriority; - var scheduler_development_9 = scheduler_development.unstable_cancelCallback; - var scheduler_development_10 = scheduler_development.unstable_continueExecution; - var scheduler_development_11 = scheduler_development.unstable_getCurrentPriorityLevel; - var scheduler_development_12 = scheduler_development.unstable_getFirstCallbackNode; - var scheduler_development_13 = scheduler_development.unstable_next; - var scheduler_development_14 = scheduler_development.unstable_pauseExecution; - var scheduler_development_15 = scheduler_development.unstable_requestPaint; - var scheduler_development_16 = scheduler_development.unstable_runWithPriority; - var scheduler_development_17 = scheduler_development.unstable_scheduleCallback; - var scheduler_development_18 = scheduler_development.unstable_shouldYield; - var scheduler_development_19 = scheduler_development.unstable_wrapCallback; - - var scheduler = createCommonjsModule(function (module) { - - { - module.exports = scheduler_development; - } - }); - - function u(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;cb}return !1}function v(a,b,c,d,e,f){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;this.propertyName=a;this.type=b;this.sanitizeURL=f;}var C$1={}; - "children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){C$1[a]=new v(a,0,!1,a,null,!1);});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){var b=a[0];C$1[b]=new v(b,1,!1,a[1],null,!1);});["contentEditable","draggable","spellCheck","value"].forEach(function(a){C$1[a]=new v(a,2,!1,a.toLowerCase(),null,!1);}); - ["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){C$1[a]=new v(a,2,!1,a,null,!1);});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(a){C$1[a]=new v(a,3,!1,a.toLowerCase(),null,!1);}); - ["checked","multiple","muted","selected"].forEach(function(a){C$1[a]=new v(a,3,!0,a,null,!1);});["capture","download"].forEach(function(a){C$1[a]=new v(a,4,!1,a,null,!1);});["cols","rows","size","span"].forEach(function(a){C$1[a]=new v(a,6,!1,a,null,!1);});["rowSpan","start"].forEach(function(a){C$1[a]=new v(a,5,!1,a.toLowerCase(),null,!1);});var Ua=/[\-:]([a-z])/g;function Va(a){return a[1].toUpperCase()} - "accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(a){var b=a.replace(Ua, - Va);C$1[b]=new v(b,1,!1,a,null,!1);});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var b=a.replace(Ua,Va);C$1[b]=new v(b,1,!1,a,"http://www.w3.org/1999/xlink",!1);});["xml:base","xml:lang","xml:space"].forEach(function(a){var b=a.replace(Ua,Va);C$1[b]=new v(b,1,!1,a,"http://www.w3.org/XML/1998/namespace",!1);});["tabIndex","crossOrigin"].forEach(function(a){C$1[a]=new v(a,1,!1,a.toLowerCase(),null,!1);}); - C$1.xlinkHref=new v("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0);["src","href","action","formAction"].forEach(function(a){C$1[a]=new v(a,1,!1,a.toLowerCase(),null,!0);});var Wa=react.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;Wa.hasOwnProperty("ReactCurrentDispatcher")||(Wa.ReactCurrentDispatcher={current:null});Wa.hasOwnProperty("ReactCurrentBatchConfig")||(Wa.ReactCurrentBatchConfig={suspense:null}); - function Xa(a,b,c,d){var e=C$1.hasOwnProperty(b)?C$1[b]:null;var f=null!==e?0===e.type:d?!1:!(2"+b.valueOf().toString()+"";for(b=Pb.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;b.firstChild;)a.appendChild(b.firstChild);}}); - function Sb(a,b){var c={};c[a.toLowerCase()]=b.toLowerCase();c["Webkit"+a]="webkit"+b;c["Moz"+a]="moz"+b;return c}var Tb={animationend:Sb("Animation","AnimationEnd"),animationiteration:Sb("Animation","AnimationIteration"),animationstart:Sb("Animation","AnimationStart"),transitionend:Sb("Transition","TransitionEnd")},Ub={},Vb={}; - ya&&(Vb=document.createElement("div").style,"AnimationEvent"in window||(delete Tb.animationend.animation,delete Tb.animationiteration.animation,delete Tb.animationstart.animation),"TransitionEvent"in window||delete Tb.transitionend.transition);function Wb(a){if(Ub[a])return Ub[a];if(!Tb[a])return a;var b=Tb[a],c;for(c in b)if(b.hasOwnProperty(c)&&c in Vb)return Ub[a]=b[c];return a} - var Xb=Wb("animationend"),Yb=Wb("animationiteration"),Zb=Wb("animationstart"),$b=Wb("transitionend"),bc=new ("function"===typeof WeakMap?WeakMap:Map);function cc(a){var b=bc.get(a);void 0===b&&(b=new Map,bc.set(a,b));return b} - function dc(a){var b=a,c=a;if(a.alternate)for(;b.return;)b=b.return;else {a=b;do b=a,0!==(b.effectTag&1026)&&(c=b.return),a=b.return;while(a)}return 3===b.tag?c:null}function fc(a){if(dc(a)!==a)throw Error(u(188));} - function gc(a){var b=a.alternate;if(!b){b=dc(a);if(null===b)throw Error(u(188));return b!==a?null:a}for(var c=a,d=b;;){var e=c.return;if(null===e)break;var f=e.alternate;if(null===f){d=e.return;if(null!==d){c=d;continue}break}if(e.child===f.child){for(f=e.child;f;){if(f===c)return fc(e),a;if(f===d)return fc(e),b;f=f.sibling;}throw Error(u(188));}if(c.return!==d.return)c=e,d=f;else {for(var g=!1,h=e.child;h;){if(h===c){g=!0;c=e;d=f;break}if(h===d){g=!0;d=e;c=f;break}h=h.sibling;}if(!g){for(h=f.child;h;){if(h=== - c){g=!0;c=f;d=e;break}if(h===d){g=!0;d=f;c=e;break}h=h.sibling;}if(!g)throw Error(u(189));}}if(c.alternate!==d)throw Error(u(190));}if(3!==c.tag)throw Error(u(188));return c.stateNode.current===c?a:b}function hc(a){a=gc(a);if(!a)return null;for(var b=a;;){if(5===b.tag||6===b.tag)return b;if(b.child)b.child.return=b,b=b.child;else {if(b===a)break;for(;!b.sibling;){if(!b.return||b.return===a)return null;b=b.return;}b.sibling.return=b.return;b=b.sibling;}}return null} - function ic(a,b){if(null==b)throw Error(u(30));if(null==a)return b;if(Array.isArray(a)){if(Array.isArray(b))return a.push.apply(a,b),a;a.push(b);return a}return Array.isArray(b)?[a].concat(b):[a,b]}function jc(a,b,c){Array.isArray(a)?a.forEach(b,c):a&&b.call(c,a);}var kc=null; - function lc(a){if(a){var b=a._dispatchListeners,c=a._dispatchInstances;if(Array.isArray(b))for(var d=0;dthis.eventPool.length&&this.eventPool.push(a);}function de(a){a.eventPool=[];a.getPooled=ee;a.release=fe;}var ge=G$1.extend({data:null}),he=G$1.extend({data:null}),ie=[9,13,27,32],je=ya&&"CompositionEvent"in window,ke=null;ya&&"documentMode"in document&&(ke=document.documentMode); - var le=ya&&"TextEvent"in window&&!ke,me=ya&&(!je||ke&&8=ke),ne=String.fromCharCode(32),oe={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["compositionend","keypress","textInput","paste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"blur compositionend keydown keypress keyup mousedown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart", - captured:"onCompositionStartCapture"},dependencies:"blur compositionstart keydown keypress keyup mousedown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"blur compositionupdate keydown keypress keyup mousedown".split(" ")}},pe=!1; - function qe(a,b){switch(a){case "keyup":return -1!==ie.indexOf(b.keyCode);case "keydown":return 229!==b.keyCode;case "keypress":case "mousedown":case "blur":return !0;default:return !1}}function re(a){a=a.detail;return "object"===typeof a&&"data"in a?a.data:null}var se=!1;function te(a,b){switch(a){case "compositionend":return re(b);case "keypress":if(32!==b.which)return null;pe=!0;return ne;case "textInput":return a=b.data,a===ne&&pe?null:a;default:return null}} - function ue(a,b){if(se)return "compositionend"===a||!je&&qe(a,b)?(a=ae(),$d=Zd=Yd=null,se=!1,a):null;switch(a){case "paste":return null;case "keypress":if(!(b.ctrlKey||b.altKey||b.metaKey)||b.ctrlKey&&b.altKey){if(b.char&&1=document.documentMode,df={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange".split(" ")}},ef=null,ff=null,gf=null,hf=!1; - function jf(a,b){var c=b.window===b?b.document:9===b.nodeType?b:b.ownerDocument;if(hf||null==ef||ef!==td(c))return null;c=ef;"selectionStart"in c&&yd(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset});return gf&&bf(gf,c)?null:(gf=c,a=G$1.getPooled(df.select,ff,a,b),a.type="select",a.target=ef,Xd(a),a)} - var kf={eventTypes:df,extractEvents:function(a,b,c,d,e,f){e=f||(d.window===d?d.document:9===d.nodeType?d:d.ownerDocument);if(!(f=!e)){a:{e=cc(e);f=wa.onSelect;for(var g=0;g 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_THREAD_ID; - - var interaction = { - __count: 1, - id: interactionIDCounter++, - name: name, - timestamp: timestamp - }; - var prevInteractions = exports.__interactionsRef.current; // Traced interactions should stack/accumulate. - // To do that, clone the current interactions. - // The previous set will be restored upon completion. - - var interactions = new Set(prevInteractions); - interactions.add(interaction); - exports.__interactionsRef.current = interactions; - var subscriber = exports.__subscriberRef.current; - var returnValue; - - try { - if (subscriber !== null) { - subscriber.onInteractionTraced(interaction); - } - } finally { - try { - if (subscriber !== null) { - subscriber.onWorkStarted(interactions, threadID); - } - } finally { - try { - returnValue = callback(); - } finally { - exports.__interactionsRef.current = prevInteractions; - - try { - if (subscriber !== null) { - subscriber.onWorkStopped(interactions, threadID); - } - } finally { - interaction.__count--; // If no async work was scheduled for this interaction, - // Notify subscribers that it's completed. - - if (subscriber !== null && interaction.__count === 0) { - subscriber.onInteractionScheduledWorkCompleted(interaction); - } - } - } - } - } - - return returnValue; - } - function unstable_wrap(callback) { - var threadID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_THREAD_ID; - - var wrappedInteractions = exports.__interactionsRef.current; - var subscriber = exports.__subscriberRef.current; - - if (subscriber !== null) { - subscriber.onWorkScheduled(wrappedInteractions, threadID); - } // Update the pending async work count for the current interactions. - // Update after calling subscribers in case of error. - - - wrappedInteractions.forEach(function (interaction) { - interaction.__count++; - }); - var hasRun = false; - - function wrapped() { - var prevInteractions = exports.__interactionsRef.current; - exports.__interactionsRef.current = wrappedInteractions; - subscriber = exports.__subscriberRef.current; - - try { - var returnValue; - - try { - if (subscriber !== null) { - subscriber.onWorkStarted(wrappedInteractions, threadID); - } - } finally { - try { - returnValue = callback.apply(undefined, arguments); - } finally { - exports.__interactionsRef.current = prevInteractions; - - if (subscriber !== null) { - subscriber.onWorkStopped(wrappedInteractions, threadID); - } - } - } - - return returnValue; - } finally { - if (!hasRun) { - // We only expect a wrapped function to be executed once, - // But in the event that it's executed more than once– - // Only decrement the outstanding interaction counts once. - hasRun = true; // Update pending async counts for all wrapped interactions. - // If this was the last scheduled async work for any of them, - // Mark them as completed. - - wrappedInteractions.forEach(function (interaction) { - interaction.__count--; - - if (subscriber !== null && interaction.__count === 0) { - subscriber.onInteractionScheduledWorkCompleted(interaction); - } - }); - } - } - } - - wrapped.cancel = function cancel() { - subscriber = exports.__subscriberRef.current; - - try { - if (subscriber !== null) { - subscriber.onWorkCanceled(wrappedInteractions, threadID); - } - } finally { - // Update pending async counts for all wrapped interactions. - // If this was the last scheduled async work for any of them, - // Mark them as completed. - wrappedInteractions.forEach(function (interaction) { - interaction.__count--; - - if (subscriber && interaction.__count === 0) { - subscriber.onInteractionScheduledWorkCompleted(interaction); - } - }); - } - }; - - return wrapped; - } - - var subscribers = null; - - { - subscribers = new Set(); - } - - function unstable_subscribe(subscriber) { - { - subscribers.add(subscriber); - - if (subscribers.size === 1) { - exports.__subscriberRef.current = { - onInteractionScheduledWorkCompleted: onInteractionScheduledWorkCompleted, - onInteractionTraced: onInteractionTraced, - onWorkCanceled: onWorkCanceled, - onWorkScheduled: onWorkScheduled, - onWorkStarted: onWorkStarted, - onWorkStopped: onWorkStopped - }; - } - } - } - function unstable_unsubscribe(subscriber) { - { - subscribers.delete(subscriber); - - if (subscribers.size === 0) { - exports.__subscriberRef.current = null; - } - } - } - - function onInteractionTraced(interaction) { - var didCatchError = false; - var caughtError = null; - subscribers.forEach(function (subscriber) { - try { - subscriber.onInteractionTraced(interaction); - } catch (error) { - if (!didCatchError) { - didCatchError = true; - caughtError = error; - } - } - }); - - if (didCatchError) { - throw caughtError; - } - } - - function onInteractionScheduledWorkCompleted(interaction) { - var didCatchError = false; - var caughtError = null; - subscribers.forEach(function (subscriber) { - try { - subscriber.onInteractionScheduledWorkCompleted(interaction); - } catch (error) { - if (!didCatchError) { - didCatchError = true; - caughtError = error; - } - } - }); - - if (didCatchError) { - throw caughtError; - } - } - - function onWorkScheduled(interactions, threadID) { - var didCatchError = false; - var caughtError = null; - subscribers.forEach(function (subscriber) { - try { - subscriber.onWorkScheduled(interactions, threadID); - } catch (error) { - if (!didCatchError) { - didCatchError = true; - caughtError = error; - } - } - }); - - if (didCatchError) { - throw caughtError; - } - } - - function onWorkStarted(interactions, threadID) { - var didCatchError = false; - var caughtError = null; - subscribers.forEach(function (subscriber) { - try { - subscriber.onWorkStarted(interactions, threadID); - } catch (error) { - if (!didCatchError) { - didCatchError = true; - caughtError = error; - } - } - }); - - if (didCatchError) { - throw caughtError; - } - } - - function onWorkStopped(interactions, threadID) { - var didCatchError = false; - var caughtError = null; - subscribers.forEach(function (subscriber) { - try { - subscriber.onWorkStopped(interactions, threadID); - } catch (error) { - if (!didCatchError) { - didCatchError = true; - caughtError = error; - } - } - }); - - if (didCatchError) { - throw caughtError; - } - } - - function onWorkCanceled(interactions, threadID) { - var didCatchError = false; - var caughtError = null; - subscribers.forEach(function (subscriber) { - try { - subscriber.onWorkCanceled(interactions, threadID); - } catch (error) { - if (!didCatchError) { - didCatchError = true; - caughtError = error; - } - } - }); - - if (didCatchError) { - throw caughtError; - } - } - - exports.unstable_clear = unstable_clear; - exports.unstable_getCurrent = unstable_getCurrent; - exports.unstable_getThreadID = unstable_getThreadID; - exports.unstable_subscribe = unstable_subscribe; - exports.unstable_trace = unstable_trace; - exports.unstable_unsubscribe = unstable_unsubscribe; - exports.unstable_wrap = unstable_wrap; - })(); - } - }); - var schedulerTracing_development_1 = schedulerTracing_development.__interactionsRef; - var schedulerTracing_development_2 = schedulerTracing_development.__subscriberRef; - var schedulerTracing_development_3 = schedulerTracing_development.unstable_clear; - var schedulerTracing_development_4 = schedulerTracing_development.unstable_getCurrent; - var schedulerTracing_development_5 = schedulerTracing_development.unstable_getThreadID; - var schedulerTracing_development_6 = schedulerTracing_development.unstable_subscribe; - var schedulerTracing_development_7 = schedulerTracing_development.unstable_trace; - var schedulerTracing_development_8 = schedulerTracing_development.unstable_unsubscribe; - var schedulerTracing_development_9 = schedulerTracing_development.unstable_wrap; - - var tracing = createCommonjsModule(function (module) { - - { - module.exports = schedulerTracing_development; - } - }); - - var reactDom_development = createCommonjsModule(function (module, exports) { - - - - { - (function() { - - var React = react; - var _assign = objectAssign; - var Scheduler = scheduler; - var checkPropTypes = checkPropTypes_1; - var tracing$1 = tracing; - - var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Prevent newer renderers from RTE when used with older react package versions. - // Current owner and dispatcher used to share the same ref, - // but PR #14548 split them out to better support the react-debug-tools package. - - if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) { - ReactSharedInternals.ReactCurrentDispatcher = { - current: null - }; - } - - if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) { - ReactSharedInternals.ReactCurrentBatchConfig = { - suspense: null - }; - } - - // by calls to these methods by a Babel plugin. - // - // In PROD (or in packages without access to React internals), - // they are left as they are instead. - - function warn(format) { - { - for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - printWarning('warn', format, args); - } - } - function error(format) { - { - for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - args[_key2 - 1] = arguments[_key2]; - } - - printWarning('error', format, args); - } - } - - function printWarning(level, format, args) { - // When changing this logic, you might want to also - // update consoleWithStackDev.www.js as well. - { - var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0; - - if (!hasExistingStack) { - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); - - if (stack !== '') { - format += '%s'; - args = args.concat([stack]); - } - } - - var argsWithFormat = args.map(function (item) { - return '' + item; - }); // Careful: RN currently depends on this prefix - - argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it - // breaks IE9: https://github.com/facebook/react/issues/13610 - // eslint-disable-next-line react-internal/no-production-logging - - Function.prototype.apply.call(console[level], console, argsWithFormat); - - try { - // --- Welcome to debugging React --- - // This error was thrown as a convenience so that you can use this stack - // to find the callsite that caused this warning to fire. - var argIndex = 0; - var message = 'Warning: ' + format.replace(/%s/g, function () { - return args[argIndex++]; - }); - throw new Error(message); - } catch (x) {} - } - } - - if (!React) { - { - throw Error( "ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM." ); - } - } - - var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f) { - var funcArgs = Array.prototype.slice.call(arguments, 3); - - try { - func.apply(context, funcArgs); - } catch (error) { - this.onError(error); - } - }; - - { - // In DEV mode, we swap out invokeGuardedCallback for a special version - // that plays more nicely with the browser's DevTools. The idea is to preserve - // "Pause on exceptions" behavior. Because React wraps all user-provided - // functions in invokeGuardedCallback, and the production version of - // invokeGuardedCallback uses a try-catch, all user exceptions are treated - // like caught exceptions, and the DevTools won't pause unless the developer - // takes the extra step of enabling pause on caught exceptions. This is - // unintuitive, though, because even though React has caught the error, from - // the developer's perspective, the error is uncaught. - // - // To preserve the expected "Pause on exceptions" behavior, we don't use a - // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake - // DOM node, and call the user-provided callback from inside an event handler - // for that fake event. If the callback throws, the error is "captured" using - // a global event handler. But because the error happens in a different - // event loop context, it does not interrupt the normal program flow. - // Effectively, this gives us try-catch behavior without actually using - // try-catch. Neat! - // Check that the browser supports the APIs we need to implement our special - // DEV version of invokeGuardedCallback - if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') { - var fakeNode = document.createElement('react'); - - var invokeGuardedCallbackDev = function (name, func, context, a, b, c, d, e, f) { - // If document doesn't exist we know for sure we will crash in this method - // when we call document.createEvent(). However this can cause confusing - // errors: https://github.com/facebookincubator/create-react-app/issues/3482 - // So we preemptively throw with a better message instead. - if (!(typeof document !== 'undefined')) { - { - throw Error( "The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous." ); - } - } - - var evt = document.createEvent('Event'); // Keeps track of whether the user-provided callback threw an error. We - // set this to true at the beginning, then set it to false right after - // calling the function. If the function errors, `didError` will never be - // set to false. This strategy works even if the browser is flaky and - // fails to call our global error handler, because it doesn't rely on - // the error event at all. - - var didError = true; // Keeps track of the value of window.event so that we can reset it - // during the callback to let user code access window.event in the - // browsers that support it. - - var windowEvent = window.event; // Keeps track of the descriptor of window.event to restore it after event - // dispatching: https://github.com/facebook/react/issues/13688 - - var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, 'event'); // Create an event handler for our fake event. We will synchronously - // dispatch our fake event using `dispatchEvent`. Inside the handler, we - // call the user-provided callback. - - var funcArgs = Array.prototype.slice.call(arguments, 3); - - function callCallback() { - // We immediately remove the callback from event listeners so that - // nested `invokeGuardedCallback` calls do not clash. Otherwise, a - // nested call would trigger the fake event handlers of any call higher - // in the stack. - fakeNode.removeEventListener(evtType, callCallback, false); // We check for window.hasOwnProperty('event') to prevent the - // window.event assignment in both IE <= 10 as they throw an error - // "Member not found" in strict mode, and in Firefox which does not - // support window.event. - - if (typeof window.event !== 'undefined' && window.hasOwnProperty('event')) { - window.event = windowEvent; - } - - func.apply(context, funcArgs); - didError = false; - } // Create a global error event handler. We use this to capture the value - // that was thrown. It's possible that this error handler will fire more - // than once; for example, if non-React code also calls `dispatchEvent` - // and a handler for that event throws. We should be resilient to most of - // those cases. Even if our error event handler fires more than once, the - // last error event is always used. If the callback actually does error, - // we know that the last error event is the correct one, because it's not - // possible for anything else to have happened in between our callback - // erroring and the code that follows the `dispatchEvent` call below. If - // the callback doesn't error, but the error event was fired, we know to - // ignore it because `didError` will be false, as described above. - - - var error; // Use this to track whether the error event is ever called. - - var didSetError = false; - var isCrossOriginError = false; - - function handleWindowError(event) { - error = event.error; - didSetError = true; - - if (error === null && event.colno === 0 && event.lineno === 0) { - isCrossOriginError = true; - } - - if (event.defaultPrevented) { - // Some other error handler has prevented default. - // Browsers silence the error report if this happens. - // We'll remember this to later decide whether to log it or not. - if (error != null && typeof error === 'object') { - try { - error._suppressLogging = true; - } catch (inner) {// Ignore. - } - } - } - } // Create a fake event type. - - - var evtType = "react-" + (name ? name : 'invokeguardedcallback'); // Attach our event handlers - - window.addEventListener('error', handleWindowError); - fakeNode.addEventListener(evtType, callCallback, false); // Synchronously dispatch our fake event. If the user-provided function - // errors, it will trigger our global error handler. - - evt.initEvent(evtType, false, false); - fakeNode.dispatchEvent(evt); - - if (windowEventDescriptor) { - Object.defineProperty(window, 'event', windowEventDescriptor); - } - - if (didError) { - if (!didSetError) { - // The callback errored, but the error event never fired. - error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.'); - } else if (isCrossOriginError) { - error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://fb.me/react-crossorigin-error for more information.'); - } - - this.onError(error); - } // Remove our event listeners - - - window.removeEventListener('error', handleWindowError); - }; - - invokeGuardedCallbackImpl = invokeGuardedCallbackDev; - } - } - - var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl; - - var hasError = false; - var caughtError = null; // Used by event system to capture/rethrow the first error. - - var hasRethrowError = false; - var rethrowError = null; - var reporter = { - onError: function (error) { - hasError = true; - caughtError = error; - } - }; - /** - * Call a function while guarding against errors that happens within it. - * Returns an error if it throws, otherwise null. - * - * In production, this is implemented using a try-catch. The reason we don't - * use a try-catch directly is so that we can swap out a different - * implementation in DEV mode. - * - * @param {String} name of the guard to use for logging or debugging - * @param {Function} func The function to invoke - * @param {*} context The context to use when calling the function - * @param {...*} args Arguments for function - */ - - function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) { - hasError = false; - caughtError = null; - invokeGuardedCallbackImpl$1.apply(reporter, arguments); - } - /** - * Same as invokeGuardedCallback, but instead of returning an error, it stores - * it in a global so it can be rethrown by `rethrowCaughtError` later. - * TODO: See if caughtError and rethrowError can be unified. - * - * @param {String} name of the guard to use for logging or debugging - * @param {Function} func The function to invoke - * @param {*} context The context to use when calling the function - * @param {...*} args Arguments for function - */ - - function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c, d, e, f) { - invokeGuardedCallback.apply(this, arguments); - - if (hasError) { - var error = clearCaughtError(); - - if (!hasRethrowError) { - hasRethrowError = true; - rethrowError = error; - } - } - } - /** - * During execution of guarded functions we will capture the first error which - * we will rethrow to be handled by the top level error handler. - */ - - function rethrowCaughtError() { - if (hasRethrowError) { - var error = rethrowError; - hasRethrowError = false; - rethrowError = null; - throw error; - } - } - function hasCaughtError() { - return hasError; - } - function clearCaughtError() { - if (hasError) { - var error = caughtError; - hasError = false; - caughtError = null; - return error; - } else { - { - { - throw Error( "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." ); - } - } - } - } - - var getFiberCurrentPropsFromNode = null; - var getInstanceFromNode = null; - var getNodeFromInstance = null; - function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeImpl, getNodeFromInstanceImpl) { - getFiberCurrentPropsFromNode = getFiberCurrentPropsFromNodeImpl; - getInstanceFromNode = getInstanceFromNodeImpl; - getNodeFromInstance = getNodeFromInstanceImpl; - - { - if (!getNodeFromInstance || !getInstanceFromNode) { - error('EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.'); - } - } - } - var validateEventDispatches; - - { - validateEventDispatches = function (event) { - var dispatchListeners = event._dispatchListeners; - var dispatchInstances = event._dispatchInstances; - var listenersIsArr = Array.isArray(dispatchListeners); - var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0; - var instancesIsArr = Array.isArray(dispatchInstances); - var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0; - - if (instancesIsArr !== listenersIsArr || instancesLen !== listenersLen) { - error('EventPluginUtils: Invalid `event`.'); - } - }; - } - /** - * Dispatch the event to the listener. - * @param {SyntheticEvent} event SyntheticEvent to handle - * @param {function} listener Application-level callback - * @param {*} inst Internal component instance - */ - - - function executeDispatch(event, listener, inst) { - var type = event.type || 'unknown-event'; - event.currentTarget = getNodeFromInstance(inst); - invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event); - event.currentTarget = null; - } - /** - * Standard/simple iteration through an event's collected dispatches. - */ - - function executeDispatchesInOrder(event) { - var dispatchListeners = event._dispatchListeners; - var dispatchInstances = event._dispatchInstances; - - { - validateEventDispatches(event); - } - - if (Array.isArray(dispatchListeners)) { - for (var i = 0; i < dispatchListeners.length; i++) { - if (event.isPropagationStopped()) { - break; - } // Listeners and Instances are two parallel arrays that are always in sync. - - - executeDispatch(event, dispatchListeners[i], dispatchInstances[i]); - } - } else if (dispatchListeners) { - executeDispatch(event, dispatchListeners, dispatchInstances); - } - - event._dispatchListeners = null; - event._dispatchInstances = null; - } - - var FunctionComponent = 0; - var ClassComponent = 1; - var IndeterminateComponent = 2; // Before we know whether it is function or class - - var HostRoot = 3; // Root of a host tree. Could be nested inside another node. - - var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. - - var HostComponent = 5; - var HostText = 6; - var Fragment = 7; - var Mode = 8; - var ContextConsumer = 9; - var ContextProvider = 10; - var ForwardRef = 11; - var Profiler = 12; - var SuspenseComponent = 13; - var MemoComponent = 14; - var SimpleMemoComponent = 15; - var LazyComponent = 16; - var IncompleteClassComponent = 17; - var DehydratedFragment = 18; - var SuspenseListComponent = 19; - var FundamentalComponent = 20; - var ScopeComponent = 21; - var Block = 22; - - /** - * Injectable ordering of event plugins. - */ - var eventPluginOrder = null; - /** - * Injectable mapping from names to event plugin modules. - */ - - var namesToPlugins = {}; - /** - * Recomputes the plugin list using the injected plugins and plugin ordering. - * - * @private - */ - - function recomputePluginOrdering() { - if (!eventPluginOrder) { - // Wait until an `eventPluginOrder` is injected. - return; - } - - for (var pluginName in namesToPlugins) { - var pluginModule = namesToPlugins[pluginName]; - var pluginIndex = eventPluginOrder.indexOf(pluginName); - - if (!(pluginIndex > -1)) { - { - throw Error( "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + pluginName + "`." ); - } - } - - if (plugins[pluginIndex]) { - continue; - } - - if (!pluginModule.extractEvents) { - { - throw Error( "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + pluginName + "` does not." ); - } - } - - plugins[pluginIndex] = pluginModule; - var publishedEvents = pluginModule.eventTypes; - - for (var eventName in publishedEvents) { - if (!publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName)) { - { - throw Error( "EventPluginRegistry: Failed to publish event `" + eventName + "` for plugin `" + pluginName + "`." ); - } - } - } - } - } - /** - * Publishes an event so that it can be dispatched by the supplied plugin. - * - * @param {object} dispatchConfig Dispatch configuration for the event. - * @param {object} PluginModule Plugin publishing the event. - * @return {boolean} True if the event was successfully published. - * @private - */ - - - function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { - if (!!eventNameDispatchConfigs.hasOwnProperty(eventName)) { - { - throw Error( "EventPluginRegistry: More than one plugin attempted to publish the same event name, `" + eventName + "`." ); - } - } - - eventNameDispatchConfigs[eventName] = dispatchConfig; - var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; - - if (phasedRegistrationNames) { - for (var phaseName in phasedRegistrationNames) { - if (phasedRegistrationNames.hasOwnProperty(phaseName)) { - var phasedRegistrationName = phasedRegistrationNames[phaseName]; - publishRegistrationName(phasedRegistrationName, pluginModule, eventName); - } - } - - return true; - } else if (dispatchConfig.registrationName) { - publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName); - return true; - } - - return false; - } - /** - * Publishes a registration name that is used to identify dispatched events. - * - * @param {string} registrationName Registration name to add. - * @param {object} PluginModule Plugin publishing the event. - * @private - */ - - - function publishRegistrationName(registrationName, pluginModule, eventName) { - if (!!registrationNameModules[registrationName]) { - { - throw Error( "EventPluginRegistry: More than one plugin attempted to publish the same registration name, `" + registrationName + "`." ); - } - } - - registrationNameModules[registrationName] = pluginModule; - registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies; - - { - var lowerCasedName = registrationName.toLowerCase(); - possibleRegistrationNames[lowerCasedName] = registrationName; - - if (registrationName === 'onDoubleClick') { - possibleRegistrationNames.ondblclick = registrationName; - } - } - } - /** - * Registers plugins so that they can extract and dispatch events. - */ - - /** - * Ordered list of injected plugins. - */ - - - var plugins = []; - /** - * Mapping from event name to dispatch config - */ - - var eventNameDispatchConfigs = {}; - /** - * Mapping from registration name to plugin module - */ - - var registrationNameModules = {}; - /** - * Mapping from registration name to event name - */ - - var registrationNameDependencies = {}; - /** - * Mapping from lowercase registration names to the properly cased version, - * used to warn in the case of missing event handlers. Available - * only in true. - * @type {Object} - */ - - var possibleRegistrationNames = {} ; // Trust the developer to only use possibleRegistrationNames in true - - /** - * Injects an ordering of plugins (by plugin name). This allows the ordering - * to be decoupled from injection of the actual plugins so that ordering is - * always deterministic regardless of packaging, on-the-fly injection, etc. - * - * @param {array} InjectedEventPluginOrder - * @internal - */ - - function injectEventPluginOrder(injectedEventPluginOrder) { - if (!!eventPluginOrder) { - { - throw Error( "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." ); - } - } // Clone the ordering so it cannot be dynamically mutated. - - - eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder); - recomputePluginOrdering(); - } - /** - * Injects plugins to be used by plugin event system. The plugin names must be - * in the ordering injected by `injectEventPluginOrder`. - * - * Plugins can be injected as part of page initialization or on-the-fly. - * - * @param {object} injectedNamesToPlugins Map from names to plugin modules. - * @internal - */ - - function injectEventPluginsByName(injectedNamesToPlugins) { - var isOrderingDirty = false; - - for (var pluginName in injectedNamesToPlugins) { - if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { - continue; - } - - var pluginModule = injectedNamesToPlugins[pluginName]; - - if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) { - if (!!namesToPlugins[pluginName]) { - { - throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + pluginName + "`." ); - } - } - - namesToPlugins[pluginName] = pluginModule; - isOrderingDirty = true; - } - } - - if (isOrderingDirty) { - recomputePluginOrdering(); - } - } - - var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined'); - - var PLUGIN_EVENT_SYSTEM = 1; - var IS_REPLAYED = 1 << 5; - var IS_FIRST_ANCESTOR = 1 << 6; - - var restoreImpl = null; - var restoreTarget = null; - var restoreQueue = null; - - function restoreStateOfTarget(target) { - // We perform this translation at the end of the event loop so that we - // always receive the correct fiber here - var internalInstance = getInstanceFromNode(target); - - if (!internalInstance) { - // Unmounted - return; - } - - if (!(typeof restoreImpl === 'function')) { - { - throw Error( "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue." ); - } - } - - var stateNode = internalInstance.stateNode; // Guard against Fiber being unmounted. - - if (stateNode) { - var _props = getFiberCurrentPropsFromNode(stateNode); - - restoreImpl(internalInstance.stateNode, internalInstance.type, _props); - } - } - - function setRestoreImplementation(impl) { - restoreImpl = impl; - } - function enqueueStateRestore(target) { - if (restoreTarget) { - if (restoreQueue) { - restoreQueue.push(target); - } else { - restoreQueue = [target]; - } - } else { - restoreTarget = target; - } - } - function needsStateRestore() { - return restoreTarget !== null || restoreQueue !== null; - } - function restoreStateIfNeeded() { - if (!restoreTarget) { - return; - } - - var target = restoreTarget; - var queuedTargets = restoreQueue; - restoreTarget = null; - restoreQueue = null; - restoreStateOfTarget(target); - - if (queuedTargets) { - for (var i = 0; i < queuedTargets.length; i++) { - restoreStateOfTarget(queuedTargets[i]); - } - } - } - - var enableProfilerTimer = true; // Trace which interactions trigger each commit. - - var enableDeprecatedFlareAPI = false; // Experimental Host Component support. - - var enableFundamentalAPI = false; // Experimental Scope support. - var warnAboutStringRefs = false; - - // the renderer. Such as when we're dispatching events or if third party - // libraries need to call batchedUpdates. Eventually, this API will go away when - // everything is batched by default. We'll then have a similar API to opt-out of - // scheduled work and instead do synchronous work. - // Defaults - - var batchedUpdatesImpl = function (fn, bookkeeping) { - return fn(bookkeeping); - }; - - var discreteUpdatesImpl = function (fn, a, b, c, d) { - return fn(a, b, c, d); - }; - - var flushDiscreteUpdatesImpl = function () {}; - - var batchedEventUpdatesImpl = batchedUpdatesImpl; - var isInsideEventHandler = false; - var isBatchingEventUpdates = false; - - function finishEventHandler() { - // Here we wait until all updates have propagated, which is important - // when using controlled components within layers: - // https://github.com/facebook/react/issues/1698 - // Then we restore state of any controlled component. - var controlledComponentsHavePendingUpdates = needsStateRestore(); - - if (controlledComponentsHavePendingUpdates) { - // If a controlled event was fired, we may need to restore the state of - // the DOM node back to the controlled value. This is necessary when React - // bails out of the update without touching the DOM. - flushDiscreteUpdatesImpl(); - restoreStateIfNeeded(); - } - } - - function batchedUpdates(fn, bookkeeping) { - if (isInsideEventHandler) { - // If we are currently inside another batch, we need to wait until it - // fully completes before restoring state. - return fn(bookkeeping); - } - - isInsideEventHandler = true; - - try { - return batchedUpdatesImpl(fn, bookkeeping); - } finally { - isInsideEventHandler = false; - finishEventHandler(); - } - } - function batchedEventUpdates(fn, a, b) { - if (isBatchingEventUpdates) { - // If we are currently inside another batch, we need to wait until it - // fully completes before restoring state. - return fn(a, b); - } - - isBatchingEventUpdates = true; - - try { - return batchedEventUpdatesImpl(fn, a, b); - } finally { - isBatchingEventUpdates = false; - finishEventHandler(); - } - } // This is for the React Flare event system - function discreteUpdates(fn, a, b, c, d) { - var prevIsInsideEventHandler = isInsideEventHandler; - isInsideEventHandler = true; - - try { - return discreteUpdatesImpl(fn, a, b, c, d); - } finally { - isInsideEventHandler = prevIsInsideEventHandler; - - if (!isInsideEventHandler) { - finishEventHandler(); - } - } - } - function flushDiscreteUpdatesIfNeeded(timeStamp) { - // event.timeStamp isn't overly reliable due to inconsistencies in - // how different browsers have historically provided the time stamp. - // Some browsers provide high-resolution time stamps for all events, - // some provide low-resolution time stamps for all events. FF < 52 - // even mixes both time stamps together. Some browsers even report - // negative time stamps or time stamps that are 0 (iOS9) in some cases. - // Given we are only comparing two time stamps with equality (!==), - // we are safe from the resolution differences. If the time stamp is 0 - // we bail-out of preventing the flush, which can affect semantics, - // such as if an earlier flush removes or adds event listeners that - // are fired in the subsequent flush. However, this is the same - // behaviour as we had before this change, so the risks are low. - if (!isInsideEventHandler && (!enableDeprecatedFlareAPI )) { - flushDiscreteUpdatesImpl(); - } - } - function setBatchingImplementation(_batchedUpdatesImpl, _discreteUpdatesImpl, _flushDiscreteUpdatesImpl, _batchedEventUpdatesImpl) { - batchedUpdatesImpl = _batchedUpdatesImpl; - discreteUpdatesImpl = _discreteUpdatesImpl; - flushDiscreteUpdatesImpl = _flushDiscreteUpdatesImpl; - batchedEventUpdatesImpl = _batchedEventUpdatesImpl; - } - - var DiscreteEvent = 0; - var UserBlockingEvent = 1; - var ContinuousEvent = 2; - - // A reserved attribute. - // It is handled by React separately and shouldn't be written to the DOM. - var RESERVED = 0; // A simple string attribute. - // Attributes that aren't in the whitelist are presumed to have this type. - - var STRING = 1; // A string attribute that accepts booleans in React. In HTML, these are called - // "enumerated" attributes with "true" and "false" as possible values. - // When true, it should be set to a "true" string. - // When false, it should be set to a "false" string. - - var BOOLEANISH_STRING = 2; // A real boolean attribute. - // When true, it should be present (set either to an empty string or its name). - // When false, it should be omitted. - - var BOOLEAN = 3; // An attribute that can be used as a flag as well as with a value. - // When true, it should be present (set either to an empty string or its name). - // When false, it should be omitted. - // For any other value, should be present with that value. - - var OVERLOADED_BOOLEAN = 4; // An attribute that must be numeric or parse as a numeric. - // When falsy, it should be removed. - - var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric. - // When falsy, it should be removed. - - var POSITIVE_NUMERIC = 6; - - /* eslint-disable max-len */ - var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD"; - /* eslint-enable max-len */ - - var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040"; - var ROOT_ATTRIBUTE_NAME = 'data-reactroot'; - var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$'); - var hasOwnProperty = Object.prototype.hasOwnProperty; - var illegalAttributeNameCache = {}; - var validatedAttributeNameCache = {}; - function isAttributeNameSafe(attributeName) { - if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) { - return true; - } - - if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) { - return false; - } - - if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) { - validatedAttributeNameCache[attributeName] = true; - return true; - } - - illegalAttributeNameCache[attributeName] = true; - - { - error('Invalid attribute name: `%s`', attributeName); - } - - return false; - } - function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) { - if (propertyInfo !== null) { - return propertyInfo.type === RESERVED; - } - - if (isCustomComponentTag) { - return false; - } - - if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) { - return true; - } - - return false; - } - function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) { - if (propertyInfo !== null && propertyInfo.type === RESERVED) { - return false; - } - - switch (typeof value) { - case 'function': // $FlowIssue symbol is perfectly valid here - - case 'symbol': - // eslint-disable-line - return true; - - case 'boolean': - { - if (isCustomComponentTag) { - return false; - } - - if (propertyInfo !== null) { - return !propertyInfo.acceptsBooleans; - } else { - var prefix = name.toLowerCase().slice(0, 5); - return prefix !== 'data-' && prefix !== 'aria-'; - } - } - - default: - return false; - } - } - function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) { - if (value === null || typeof value === 'undefined') { - return true; - } - - if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) { - return true; - } - - if (isCustomComponentTag) { - return false; - } - - if (propertyInfo !== null) { - switch (propertyInfo.type) { - case BOOLEAN: - return !value; - - case OVERLOADED_BOOLEAN: - return value === false; - - case NUMERIC: - return isNaN(value); - - case POSITIVE_NUMERIC: - return isNaN(value) || value < 1; - } - } - - return false; - } - function getPropertyInfo(name) { - return properties.hasOwnProperty(name) ? properties[name] : null; - } - - function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL) { - this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN; - this.attributeName = attributeName; - this.attributeNamespace = attributeNamespace; - this.mustUseProperty = mustUseProperty; - this.propertyName = name; - this.type = type; - this.sanitizeURL = sanitizeURL; - } // When adding attributes to this list, be sure to also add them to - // the `possibleStandardNames` module to ensure casing and incorrect - // name warnings. - - - var properties = {}; // These props are reserved by React. They shouldn't be written to the DOM. - - var reservedProps = ['children', 'dangerouslySetInnerHTML', // TODO: This prevents the assignment of defaultValue to regular - // elements (not just inputs). Now that ReactDOMInput assigns to the - // defaultValue property -- do we need this? - 'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style']; - - reservedProps.forEach(function (name) { - properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty - name, // attributeName - null, // attributeNamespace - false); - }); // A few React string attributes have a different name. - // This is a mapping from React prop names to the attribute names. - - [['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) { - var name = _ref[0], - attributeName = _ref[1]; - properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty - attributeName, // attributeName - null, // attributeNamespace - false); - }); // These are "enumerated" HTML attributes that accept "true" and "false". - // In React, we let users pass `true` and `false` even though technically - // these aren't boolean attributes (they are coerced to strings). - - ['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) { - properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty - name.toLowerCase(), // attributeName - null, // attributeNamespace - false); - }); // These are "enumerated" SVG attributes that accept "true" and "false". - // In React, we let users pass `true` and `false` even though technically - // these aren't boolean attributes (they are coerced to strings). - // Since these are SVG attributes, their attribute names are case-sensitive. - - ['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) { - properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty - name, // attributeName - null, // attributeNamespace - false); - }); // These are HTML boolean attributes. - - ['allowFullScreen', 'async', // Note: there is a special case that prevents it from being written to the DOM - // on the client side because the browsers are inconsistent. Instead we call focus(). - 'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', // Microdata - 'itemScope'].forEach(function (name) { - properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty - name.toLowerCase(), // attributeName - null, // attributeNamespace - false); - }); // These are the few React props that we set as DOM properties - // rather than attributes. These are all booleans. - - ['checked', // Note: `option.selected` is not updated if `select.multiple` is - // disabled with `removeAttribute`. We have special logic for handling this. - 'multiple', 'muted', 'selected' // NOTE: if you add a camelCased prop to this list, - // you'll need to set attributeName to name.toLowerCase() - // instead in the assignment below. - ].forEach(function (name) { - properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty - name, // attributeName - null, // attributeNamespace - false); - }); // These are HTML attributes that are "overloaded booleans": they behave like - // booleans, but can also accept a string value. - - ['capture', 'download' // NOTE: if you add a camelCased prop to this list, - // you'll need to set attributeName to name.toLowerCase() - // instead in the assignment below. - ].forEach(function (name) { - properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty - name, // attributeName - null, // attributeNamespace - false); - }); // These are HTML attributes that must be positive numbers. - - ['cols', 'rows', 'size', 'span' // NOTE: if you add a camelCased prop to this list, - // you'll need to set attributeName to name.toLowerCase() - // instead in the assignment below. - ].forEach(function (name) { - properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty - name, // attributeName - null, // attributeNamespace - false); - }); // These are HTML attributes that must be numbers. - - ['rowSpan', 'start'].forEach(function (name) { - properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty - name.toLowerCase(), // attributeName - null, // attributeNamespace - false); - }); - var CAMELIZE = /[\-\:]([a-z])/g; - - var capitalize = function (token) { - return token[1].toUpperCase(); - }; // This is a list of all SVG attributes that need special casing, namespacing, - // or boolean value assignment. Regular attributes that just accept strings - // and have the same names are omitted, just like in the HTML whitelist. - // Some of these attributes can be hard to find. This list was created by - // scraping the MDN documentation. - - - ['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height' // NOTE: if you add a camelCased prop to this list, - // you'll need to set attributeName to name.toLowerCase() - // instead in the assignment below. - ].forEach(function (attributeName) { - var name = attributeName.replace(CAMELIZE, capitalize); - properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty - attributeName, null, // attributeNamespace - false); - }); // String SVG attributes with the xlink namespace. - - ['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type' // NOTE: if you add a camelCased prop to this list, - // you'll need to set attributeName to name.toLowerCase() - // instead in the assignment below. - ].forEach(function (attributeName) { - var name = attributeName.replace(CAMELIZE, capitalize); - properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty - attributeName, 'http://www.w3.org/1999/xlink', false); - }); // String SVG attributes with the xml namespace. - - ['xml:base', 'xml:lang', 'xml:space' // NOTE: if you add a camelCased prop to this list, - // you'll need to set attributeName to name.toLowerCase() - // instead in the assignment below. - ].forEach(function (attributeName) { - var name = attributeName.replace(CAMELIZE, capitalize); - properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty - attributeName, 'http://www.w3.org/XML/1998/namespace', false); - }); // These attribute exists both in HTML and SVG. - // The attribute name is case-sensitive in SVG so we can't just use - // the React name like we do for attributes that exist only in HTML. - - ['tabIndex', 'crossOrigin'].forEach(function (attributeName) { - properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty - attributeName.toLowerCase(), // attributeName - null, // attributeNamespace - false); - }); // These attributes accept URLs. These must not allow javascript: URLS. - // These will also need to accept Trusted Types object in the future. - - var xlinkHref = 'xlinkHref'; - properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, // mustUseProperty - 'xlink:href', 'http://www.w3.org/1999/xlink', true); - ['src', 'href', 'action', 'formAction'].forEach(function (attributeName) { - properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty - attributeName.toLowerCase(), // attributeName - null, // attributeNamespace - true); - }); - - var ReactDebugCurrentFrame = null; - - { - ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - } // A javascript: URL can contain leading C0 control or \u0020 SPACE, - // and any newline or tab are filtered out as if they're not part of the URL. - // https://url.spec.whatwg.org/#url-parsing - // Tab or newline are defined as \r\n\t: - // https://infra.spec.whatwg.org/#ascii-tab-or-newline - // A C0 control is a code point in the range \u0000 NULL to \u001F - // INFORMATION SEPARATOR ONE, inclusive: - // https://infra.spec.whatwg.org/#c0-control-or-space - - /* eslint-disable max-len */ - - - var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i; - var didWarn = false; - - function sanitizeURL(url) { - { - if (!didWarn && isJavaScriptProtocol.test(url)) { - didWarn = true; - - error('A future version of React will block javascript: URLs as a security precaution. ' + 'Use event handlers instead if you can. If you need to generate unsafe HTML try ' + 'using dangerouslySetInnerHTML instead. React was passed %s.', JSON.stringify(url)); - } - } - } - - /** - * Get the value for a property on a node. Only used in DEV for SSR validation. - * The "expected" argument is used as a hint of what the expected value is. - * Some properties have multiple equivalent values. - */ - function getValueForProperty(node, name, expected, propertyInfo) { - { - if (propertyInfo.mustUseProperty) { - var propertyName = propertyInfo.propertyName; - return node[propertyName]; - } else { - if ( propertyInfo.sanitizeURL) { - // If we haven't fully disabled javascript: URLs, and if - // the hydration is successful of a javascript: URL, we - // still want to warn on the client. - sanitizeURL('' + expected); - } - - var attributeName = propertyInfo.attributeName; - var stringValue = null; - - if (propertyInfo.type === OVERLOADED_BOOLEAN) { - if (node.hasAttribute(attributeName)) { - var value = node.getAttribute(attributeName); - - if (value === '') { - return true; - } - - if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { - return value; - } - - if (value === '' + expected) { - return expected; - } - - return value; - } - } else if (node.hasAttribute(attributeName)) { - if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { - // We had an attribute but shouldn't have had one, so read it - // for the error message. - return node.getAttribute(attributeName); - } - - if (propertyInfo.type === BOOLEAN) { - // If this was a boolean, it doesn't matter what the value is - // the fact that we have it is the same as the expected. - return expected; - } // Even if this property uses a namespace we use getAttribute - // because we assume its namespaced name is the same as our config. - // To use getAttributeNS we need the local name which we don't have - // in our config atm. - - - stringValue = node.getAttribute(attributeName); - } - - if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { - return stringValue === null ? expected : stringValue; - } else if (stringValue === '' + expected) { - return expected; - } else { - return stringValue; - } - } - } - } - /** - * Get the value for a attribute on a node. Only used in DEV for SSR validation. - * The third argument is used as a hint of what the expected value is. Some - * attributes have multiple equivalent values. - */ - - function getValueForAttribute(node, name, expected) { - { - if (!isAttributeNameSafe(name)) { - return; - } - - if (!node.hasAttribute(name)) { - return expected === undefined ? undefined : null; - } - - var value = node.getAttribute(name); - - if (value === '' + expected) { - return expected; - } - - return value; - } - } - /** - * Sets the value for a property on a node. - * - * @param {DOMElement} node - * @param {string} name - * @param {*} value - */ - - function setValueForProperty(node, name, value, isCustomComponentTag) { - var propertyInfo = getPropertyInfo(name); - - if (shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag)) { - return; - } - - if (shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)) { - value = null; - } // If the prop isn't in the special list, treat it as a simple attribute. - - - if (isCustomComponentTag || propertyInfo === null) { - if (isAttributeNameSafe(name)) { - var _attributeName = name; - - if (value === null) { - node.removeAttribute(_attributeName); - } else { - node.setAttribute(_attributeName, '' + value); - } - } - - return; - } - - var mustUseProperty = propertyInfo.mustUseProperty; - - if (mustUseProperty) { - var propertyName = propertyInfo.propertyName; - - if (value === null) { - var type = propertyInfo.type; - node[propertyName] = type === BOOLEAN ? false : ''; - } else { - // Contrary to `setAttribute`, object properties are properly - // `toString`ed by IE8/9. - node[propertyName] = value; - } - - return; - } // The rest are treated as attributes with special cases. - - - var attributeName = propertyInfo.attributeName, - attributeNamespace = propertyInfo.attributeNamespace; - - if (value === null) { - node.removeAttribute(attributeName); - } else { - var _type = propertyInfo.type; - var attributeValue; - - if (_type === BOOLEAN || _type === OVERLOADED_BOOLEAN && value === true) { - // If attribute type is boolean, we know for sure it won't be an execution sink - // and we won't require Trusted Type here. - attributeValue = ''; - } else { - // `setAttribute` with objects becomes only `[object]` in IE8/9, - // ('' + value) makes it output the correct toString()-value. - { - attributeValue = '' + value; - } - - if (propertyInfo.sanitizeURL) { - sanitizeURL(attributeValue.toString()); - } - } - - if (attributeNamespace) { - node.setAttributeNS(attributeNamespace, attributeName, attributeValue); - } else { - node.setAttribute(attributeName, attributeValue); - } - } - } - - var BEFORE_SLASH_RE = /^(.*)[\\\/]/; - function describeComponentFrame (name, source, ownerName) { - var sourceInfo = ''; - - if (source) { - var path = source.fileName; - var fileName = path.replace(BEFORE_SLASH_RE, ''); - - { - // In DEV, include code for a common special case: - // prefer "folder/index.js" instead of just "index.js". - if (/^index\./.test(fileName)) { - var match = path.match(BEFORE_SLASH_RE); - - if (match) { - var pathBeforeSlash = match[1]; - - if (pathBeforeSlash) { - var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, ''); - fileName = folderName + '/' + fileName; - } - } - } - } - - sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')'; - } else if (ownerName) { - sourceInfo = ' (created by ' + ownerName + ')'; - } - - return '\n in ' + (name || 'Unknown') + sourceInfo; - } - - // The Symbol used to tag the ReactElement-like types. If there is no native Symbol - // nor polyfill, then a plain number is used for performance. - var hasSymbol = typeof Symbol === 'function' && Symbol.for; - var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; - var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; - var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; - var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; - var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; - var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; - var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary - var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; - var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; - var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; - var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; - var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; - var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; - var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; - var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; - var FAUX_ITERATOR_SYMBOL = '@@iterator'; - function getIteratorFn(maybeIterable) { - if (maybeIterable === null || typeof maybeIterable !== 'object') { - return null; - } - - var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; - - if (typeof maybeIterator === 'function') { - return maybeIterator; - } - - return null; - } - - var Uninitialized = -1; - var Pending = 0; - var Resolved = 1; - var Rejected = 2; - function refineResolvedLazyComponent(lazyComponent) { - return lazyComponent._status === Resolved ? lazyComponent._result : null; - } - function initializeLazyComponentType(lazyComponent) { - if (lazyComponent._status === Uninitialized) { - lazyComponent._status = Pending; - var ctor = lazyComponent._ctor; - var thenable = ctor(); - lazyComponent._result = thenable; - thenable.then(function (moduleObject) { - if (lazyComponent._status === Pending) { - var defaultExport = moduleObject.default; - - { - if (defaultExport === undefined) { - error('lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + "const MyComponent = lazy(() => import('./MyComponent'))", moduleObject); - } - } - - lazyComponent._status = Resolved; - lazyComponent._result = defaultExport; - } - }, function (error) { - if (lazyComponent._status === Pending) { - lazyComponent._status = Rejected; - lazyComponent._result = error; - } - }); - } - } - - function getWrappedName(outerType, innerType, wrapperName) { - var functionName = innerType.displayName || innerType.name || ''; - return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName); - } - - function getComponentName(type) { - if (type == null) { - // Host root, text node or just invalid type. - return null; - } - - { - if (typeof type.tag === 'number') { - error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.'); - } - } - - if (typeof type === 'function') { - return type.displayName || type.name || null; - } - - if (typeof type === 'string') { - return type; - } - - switch (type) { - case REACT_FRAGMENT_TYPE: - return 'Fragment'; - - case REACT_PORTAL_TYPE: - return 'Portal'; - - case REACT_PROFILER_TYPE: - return "Profiler"; - - case REACT_STRICT_MODE_TYPE: - return 'StrictMode'; - - case REACT_SUSPENSE_TYPE: - return 'Suspense'; - - case REACT_SUSPENSE_LIST_TYPE: - return 'SuspenseList'; - } - - if (typeof type === 'object') { - switch (type.$$typeof) { - case REACT_CONTEXT_TYPE: - return 'Context.Consumer'; - - case REACT_PROVIDER_TYPE: - return 'Context.Provider'; - - case REACT_FORWARD_REF_TYPE: - return getWrappedName(type, type.render, 'ForwardRef'); - - case REACT_MEMO_TYPE: - return getComponentName(type.type); - - case REACT_BLOCK_TYPE: - return getComponentName(type.render); - - case REACT_LAZY_TYPE: - { - var thenable = type; - var resolvedThenable = refineResolvedLazyComponent(thenable); - - if (resolvedThenable) { - return getComponentName(resolvedThenable); - } - - break; - } - } - } - - return null; - } - - var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; - - function describeFiber(fiber) { - switch (fiber.tag) { - case HostRoot: - case HostPortal: - case HostText: - case Fragment: - case ContextProvider: - case ContextConsumer: - return ''; - - default: - var owner = fiber._debugOwner; - var source = fiber._debugSource; - var name = getComponentName(fiber.type); - var ownerName = null; - - if (owner) { - ownerName = getComponentName(owner.type); - } - - return describeComponentFrame(name, source, ownerName); - } - } - - function getStackByFiberInDevAndProd(workInProgress) { - var info = ''; - var node = workInProgress; - - do { - info += describeFiber(node); - node = node.return; - } while (node); - - return info; - } - var current = null; - var isRendering = false; - function getCurrentFiberOwnerNameInDevOrNull() { - { - if (current === null) { - return null; - } - - var owner = current._debugOwner; - - if (owner !== null && typeof owner !== 'undefined') { - return getComponentName(owner.type); - } - } - - return null; - } - function getCurrentFiberStackInDev() { - { - if (current === null) { - return ''; - } // Safe because if current fiber exists, we are reconciling, - // and it is guaranteed to be the work-in-progress version. - - - return getStackByFiberInDevAndProd(current); - } - } - function resetCurrentFiber() { - { - ReactDebugCurrentFrame$1.getCurrentStack = null; - current = null; - isRendering = false; - } - } - function setCurrentFiber(fiber) { - { - ReactDebugCurrentFrame$1.getCurrentStack = getCurrentFiberStackInDev; - current = fiber; - isRendering = false; - } - } - function setIsRendering(rendering) { - { - isRendering = rendering; - } - } - - // Flow does not allow string concatenation of most non-string types. To work - // around this limitation, we use an opaque type that can only be obtained by - // passing the value through getToStringValue first. - function toString(value) { - return '' + value; - } - function getToStringValue(value) { - switch (typeof value) { - case 'boolean': - case 'number': - case 'object': - case 'string': - case 'undefined': - return value; - - default: - // function, symbol are assigned as empty strings - return ''; - } - } - - var ReactDebugCurrentFrame$2 = null; - var ReactControlledValuePropTypes = { - checkPropTypes: null - }; - - { - ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame; - var hasReadOnlyValue = { - button: true, - checkbox: true, - image: true, - hidden: true, - radio: true, - reset: true, - submit: true - }; - var propTypes = { - value: function (props, propName, componentName) { - if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null || enableDeprecatedFlareAPI ) { - return null; - } - - return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); - }, - checked: function (props, propName, componentName) { - if (props.onChange || props.readOnly || props.disabled || props[propName] == null || enableDeprecatedFlareAPI ) { - return null; - } - - return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); - } - }; - /** - * Provide a linked `value` attribute for controlled forms. You should not use - * this outside of the ReactDOM controlled form components. - */ - - ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) { - checkPropTypes(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$2.getStackAddendum); - }; - } - - function isCheckable(elem) { - var type = elem.type; - var nodeName = elem.nodeName; - return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio'); - } - - function getTracker(node) { - return node._valueTracker; - } - - function detachTracker(node) { - node._valueTracker = null; - } - - function getValueFromNode(node) { - var value = ''; - - if (!node) { - return value; - } - - if (isCheckable(node)) { - value = node.checked ? 'true' : 'false'; - } else { - value = node.value; - } - - return value; - } - - function trackValueOnNode(node) { - var valueField = isCheckable(node) ? 'checked' : 'value'; - var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField); - var currentValue = '' + node[valueField]; // if someone has already defined a value or Safari, then bail - // and don't track value will cause over reporting of changes, - // but it's better then a hard failure - // (needed for certain tests that spyOn input values and Safari) - - if (node.hasOwnProperty(valueField) || typeof descriptor === 'undefined' || typeof descriptor.get !== 'function' || typeof descriptor.set !== 'function') { - return; - } - - var get = descriptor.get, - set = descriptor.set; - Object.defineProperty(node, valueField, { - configurable: true, - get: function () { - return get.call(this); - }, - set: function (value) { - currentValue = '' + value; - set.call(this, value); - } - }); // We could've passed this the first time - // but it triggers a bug in IE11 and Edge 14/15. - // Calling defineProperty() again should be equivalent. - // https://github.com/facebook/react/issues/11768 - - Object.defineProperty(node, valueField, { - enumerable: descriptor.enumerable - }); - var tracker = { - getValue: function () { - return currentValue; - }, - setValue: function (value) { - currentValue = '' + value; - }, - stopTracking: function () { - detachTracker(node); - delete node[valueField]; - } - }; - return tracker; - } - - function track(node) { - if (getTracker(node)) { - return; - } // TODO: Once it's just Fiber we can move this to node._wrapperState - - - node._valueTracker = trackValueOnNode(node); - } - function updateValueIfChanged(node) { - if (!node) { - return false; - } - - var tracker = getTracker(node); // if there is no tracker at this point it's unlikely - // that trying again will succeed - - if (!tracker) { - return true; - } - - var lastValue = tracker.getValue(); - var nextValue = getValueFromNode(node); - - if (nextValue !== lastValue) { - tracker.setValue(nextValue); - return true; - } - - return false; - } - - var didWarnValueDefaultValue = false; - var didWarnCheckedDefaultChecked = false; - var didWarnControlledToUncontrolled = false; - var didWarnUncontrolledToControlled = false; - - function isControlled(props) { - var usesChecked = props.type === 'checkbox' || props.type === 'radio'; - return usesChecked ? props.checked != null : props.value != null; - } - /** - * Implements an host component that allows setting these optional - * props: `checked`, `value`, `defaultChecked`, and `defaultValue`. - * - * If `checked` or `value` are not supplied (or null/undefined), user actions - * that affect the checked state or value will trigger updates to the element. - * - * If they are supplied (and not null/undefined), the rendered element will not - * trigger updates to the element. Instead, the props must change in order for - * the rendered element to be updated. - * - * The rendered element will be initialized as unchecked (or `defaultChecked`) - * with an empty value (or `defaultValue`). - * - * See http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html - */ - - - function getHostProps(element, props) { - var node = element; - var checked = props.checked; - - var hostProps = _assign({}, props, { - defaultChecked: undefined, - defaultValue: undefined, - value: undefined, - checked: checked != null ? checked : node._wrapperState.initialChecked - }); - - return hostProps; - } - function initWrapperState(element, props) { - { - ReactControlledValuePropTypes.checkPropTypes('input', props); - - if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) { - error('%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type); - - didWarnCheckedDefaultChecked = true; - } - - if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) { - error('%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type); - - didWarnValueDefaultValue = true; - } - } - - var node = element; - var defaultValue = props.defaultValue == null ? '' : props.defaultValue; - node._wrapperState = { - initialChecked: props.checked != null ? props.checked : props.defaultChecked, - initialValue: getToStringValue(props.value != null ? props.value : defaultValue), - controlled: isControlled(props) - }; - } - function updateChecked(element, props) { - var node = element; - var checked = props.checked; - - if (checked != null) { - setValueForProperty(node, 'checked', checked, false); - } - } - function updateWrapper(element, props) { - var node = element; - - { - var controlled = isControlled(props); - - if (!node._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) { - error('A component is changing an uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type); - - didWarnUncontrolledToControlled = true; - } - - if (node._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) { - error('A component is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type); - - didWarnControlledToUncontrolled = true; - } - } - - updateChecked(element, props); - var value = getToStringValue(props.value); - var type = props.type; - - if (value != null) { - if (type === 'number') { - if (value === 0 && node.value === '' || // We explicitly want to coerce to number here if possible. - // eslint-disable-next-line - node.value != value) { - node.value = toString(value); - } - } else if (node.value !== toString(value)) { - node.value = toString(value); - } - } else if (type === 'submit' || type === 'reset') { - // Submit/reset inputs need the attribute removed completely to avoid - // blank-text buttons. - node.removeAttribute('value'); - return; - } - - { - // When syncing the value attribute, the value comes from a cascade of - // properties: - // 1. The value React property - // 2. The defaultValue React property - // 3. Otherwise there should be no change - if (props.hasOwnProperty('value')) { - setDefaultValue(node, props.type, value); - } else if (props.hasOwnProperty('defaultValue')) { - setDefaultValue(node, props.type, getToStringValue(props.defaultValue)); - } - } - - { - // When syncing the checked attribute, it only changes when it needs - // to be removed, such as transitioning from a checkbox into a text input - if (props.checked == null && props.defaultChecked != null) { - node.defaultChecked = !!props.defaultChecked; - } - } - } - function postMountWrapper(element, props, isHydrating) { - var node = element; // Do not assign value if it is already set. This prevents user text input - // from being lost during SSR hydration. - - if (props.hasOwnProperty('value') || props.hasOwnProperty('defaultValue')) { - var type = props.type; - var isButton = type === 'submit' || type === 'reset'; // Avoid setting value attribute on submit/reset inputs as it overrides the - // default value provided by the browser. See: #12872 - - if (isButton && (props.value === undefined || props.value === null)) { - return; - } - - var initialValue = toString(node._wrapperState.initialValue); // Do not assign value if it is already set. This prevents user text input - // from being lost during SSR hydration. - - if (!isHydrating) { - { - // When syncing the value attribute, the value property should use - // the wrapperState._initialValue property. This uses: - // - // 1. The value React property when present - // 2. The defaultValue React property when present - // 3. An empty string - if (initialValue !== node.value) { - node.value = initialValue; - } - } - } - - { - // Otherwise, the value attribute is synchronized to the property, - // so we assign defaultValue to the same thing as the value property - // assignment step above. - node.defaultValue = initialValue; - } - } // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug - // this is needed to work around a chrome bug where setting defaultChecked - // will sometimes influence the value of checked (even after detachment). - // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416 - // We need to temporarily unset name to avoid disrupting radio button groups. - - - var name = node.name; - - if (name !== '') { - node.name = ''; - } - - { - // When syncing the checked attribute, both the checked property and - // attribute are assigned at the same time using defaultChecked. This uses: - // - // 1. The checked React property when present - // 2. The defaultChecked React property when present - // 3. Otherwise, false - node.defaultChecked = !node.defaultChecked; - node.defaultChecked = !!node._wrapperState.initialChecked; - } - - if (name !== '') { - node.name = name; - } - } - function restoreControlledState(element, props) { - var node = element; - updateWrapper(node, props); - updateNamedCousins(node, props); - } - - function updateNamedCousins(rootNode, props) { - var name = props.name; - - if (props.type === 'radio' && name != null) { - var queryRoot = rootNode; - - while (queryRoot.parentNode) { - queryRoot = queryRoot.parentNode; - } // If `rootNode.form` was non-null, then we could try `form.elements`, - // but that sometimes behaves strangely in IE8. We could also try using - // `form.getElementsByName`, but that will only return direct children - // and won't include inputs that use the HTML5 `form=` attribute. Since - // the input might not even be in a form. It might not even be in the - // document. Let's just use the local `querySelectorAll` to ensure we don't - // miss anything. - - - var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]'); - - for (var i = 0; i < group.length; i++) { - var otherNode = group[i]; - - if (otherNode === rootNode || otherNode.form !== rootNode.form) { - continue; - } // This will throw if radio buttons rendered by different copies of React - // and the same name are rendered into the same form (same as #1939). - // That's probably okay; we don't support it just as we don't support - // mixing React radio buttons with non-React ones. - - - var otherProps = getFiberCurrentPropsFromNode$1(otherNode); - - if (!otherProps) { - { - throw Error( "ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported." ); - } - } // We need update the tracked value on the named cousin since the value - // was changed but the input saw no event or value set - - - updateValueIfChanged(otherNode); // If this is a controlled radio button group, forcing the input that - // was previously checked to update will cause it to be come re-checked - // as appropriate. - - updateWrapper(otherNode, otherProps); - } - } - } // In Chrome, assigning defaultValue to certain input types triggers input validation. - // For number inputs, the display value loses trailing decimal points. For email inputs, - // Chrome raises "The specified value is not a valid email address". - // - // Here we check to see if the defaultValue has actually changed, avoiding these problems - // when the user is inputting text - // - // https://github.com/facebook/react/issues/7253 - - - function setDefaultValue(node, type, value) { - if ( // Focused number inputs synchronize on blur. See ChangeEventPlugin.js - type !== 'number' || node.ownerDocument.activeElement !== node) { - if (value == null) { - node.defaultValue = toString(node._wrapperState.initialValue); - } else if (node.defaultValue !== toString(value)) { - node.defaultValue = toString(value); - } - } - } - - var didWarnSelectedSetOnOption = false; - var didWarnInvalidChild = false; - - function flattenChildren(children) { - var content = ''; // Flatten children. We'll warn if they are invalid - // during validateProps() which runs for hydration too. - // Note that this would throw on non-element objects. - // Elements are stringified (which is normally irrelevant - // but matters for ). - - React.Children.forEach(children, function (child) { - if (child == null) { - return; - } - - content += child; // Note: we don't warn about invalid children here. - // Instead, this is done separately below so that - // it happens during the hydration codepath too. - }); - return content; - } - /** - * Implements an