From 94889841955c697412e1e79e64dc8e0c049f4097 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 28 Jun 2019 14:26:40 -0700 Subject: [PATCH 001/451] larva passes tests --- pkg/arvo/sys/vane/alef.hoon | 141 ++++++++++++++++++++---------- pkg/arvo/tests/sys/vane/alef.hoon | 52 ++++++----- 2 files changed, 125 insertions(+), 68 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index ad1c1e852..e9180bee7 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -579,7 +579,12 @@ :: $move: output effect; either request or response :: +$ move [=duct card=(wind note gift)] +:: $queued-event: event to be handled after initial boot completes :: ++$ queued-event + $% [%call =duct type=* wrapped-task=(hobo task)] + [%take =wire =duct type=* =sign] + == :: $task: job for ames :: :: %born: process restart notification @@ -688,25 +693,18 @@ :: keys. :: +$ note - $% $: %a - $% [%memo sponsor=ship message=_[/a/ping ~]] - == == - $: %b + $~ [%b %wait *@da] + $% $: %b $% [%wait date=@da] [%rest date=@da] == == - $: %c - $% [%memo =ship =message] - == == - $: %g - $% [%memo =ship =message] - == == $: %j - $% [%memo =ship =message] - :: - [%private-keys ~] + $% [%private-keys ~] [%public-keys =ship] [%turf ~] + == == + $: @tas + $% [%memo =ship =message] == == == :: $sign: response from other vane :: @@ -722,27 +720,18 @@ :: triggers the next heartbeat message to be sent. :: +$ sign - $% $: %a - $% [%done error=(unit error)] - == == - $: %b + $~ [%b %wake ~] + $% $: %b $% [%wake error=(unit tang)] == == - $: %c - $% [%done error=(unit error)] - [%memo =message] - == == - $: %g - $% [%done error=(unit error)] - [%memo =message] - == == $: %j - $% [%done error=(unit error)] - [%memo =message] - :: - [%private-keys =life =private-key] + $% [%private-keys =life =private-key] [%public-keys =vent-result] [%turf turfs=(list turf)] + == == + $: @tas + $% [%done error=(unit error)] + [%memo =message] == == == :: $message-pump-task: job for |message-pump :: @@ -816,8 +805,79 @@ -- :: external vane interface :: -=< |= pit=vase +:: larval ames, before %born sets .unix-duct; wraps adult ames core +:: +=< =* adult-gate . + =| queued-events=(qeu queued-event) + :: + |= [our=ship eny=@ now=@da scry-gate=sley] + =* larval-gate . + =* adult-core (adult-gate +<) + |% + :: +call: handle request $task + :: + ++ call + |= [=duct type=* wrapped-task=(hobo task)] + :: %born: set .unix-duct and start draining .queued-events + :: + ?: ?=(%born -.wrapped-task) + :: process %born using wrapped adult ames + :: + =^ moves adult-gate (call:adult-core duct type wrapped-task) + :: if no events were queued up, metamorphose + :: + ?~ queued-events + [moves adult-gate] + :: kick off a timer to process the first of .queued-events + :: + =. moves :_(moves [duct %pass /larva %b %wait now]) + [moves larval-gate] + :: any other event: enqueue it until we have a .unix-duct + :: + =. queued-events (~(put to queued-events) %call duct type wrapped-task) + [~ larval-gate] + :: +take: handle response $sign + :: + ++ take + |= [=wire =duct type=* =sign] + :: enqueue event if not a larval drainage timer + :: + ?. =(/larva wire) + =. queued-events (~(put to queued-events) %take wire duct type sign) + [~ larval-gate] + :: larval event drainage timer; pop and process a queued event + :: + ?> ?=(%wake -.sign) + =^ first-event queued-events ~(get to queued-events) + =^ moves adult-gate + ?- -.first-event + %call (call:adult-core +.first-event) + %take (take:adult-core +.first-event) + == + :: .queued-events has been cleared; metamorphose + :: + ?~ queued-events + [moves adult-gate] + :: set timer to drain next event + :: + =. moves :_(moves [duct %pass /larva %b %wait now]) + [moves larval-gate] + :: lifecycle arms; mostly pass-throughs to the contained adult ames + :: + ++ scry scry:adult-core + ++ stay [queued-events stay:adult-core] + ++ load + |= old=_[queued-events stay:adult-core] + ^+ larval-gate + :: + =. queued-events -.old + =. adult-gate (load:adult-core +.old) + larval-gate + -- +:: adult ames, after metamorphosis from larva +:: +=< =| =ames-state |= [our=ship eny=@ now=@da scry-gate=sley] =* ames-gate . @@ -860,16 +920,10 @@ =^ moves ames-state =< abet ?- sign + [@ %done *] (on-take-done:event-core wire error.sign) + [@ %memo *] (on-take-memo:event-core wire message.sign) + :: [%b %wake *] (on-take-wake:event-core wire error.sign) - :: - [%a %done *] (on-take-done:event-core wire error.sign) - [%c %done *] (on-take-done:event-core wire error.sign) - [%g %done *] (on-take-done:event-core wire error.sign) - [%j %done *] (on-take-done:event-core wire error.sign) - :: - [%c %memo *] (on-take-memo:event-core wire message.sign) - [%g %memo *] (on-take-memo:event-core wire message.sign) - [%j %memo *] (on-take-memo:event-core wire message.sign) :: [%j %private-keys *] (on-priv:event-core [life private-key]:sign) [%j %public-keys *] (on-publ:event-core wire vent-result.sign) @@ -936,13 +990,8 @@ ++ on-hear |= [=lane =blob] ^+ event-core - :: register this duct as our new .unix-duct :: - =. unix-duct.ames-state duct - :: - =/ =packet (decode-packet blob) - :: - (on-hear-packet lane packet) + (on-hear-packet lane (decode-packet blob)) :: +on-hear-packet: handle mildly processed packet receipt :: ++ on-hear-packet @@ -1355,7 +1404,7 @@ :: +on-born: handle unix process restart :: +on-vega: handle kernel reload :: - ++ on-born event-core + ++ on-born event-core(unix-duct.ames-state duct) ++ on-vega event-core :: +enqueue-alien-todo: helper to enqueue a pending request :: diff --git a/pkg/arvo/tests/sys/vane/alef.hoon b/pkg/arvo/tests/sys/vane/alef.hoon index 626ff5b18..6b07920a0 100644 --- a/pkg/arvo/tests/sys/vane/alef.hoon +++ b/pkg/arvo/tests/sys/vane/alef.hoon @@ -24,8 +24,8 @@ =/ bob-pub pub:ex:crypto-core.ames-state.bob =/ bob-sec sec:ex:crypto-core.ames-state.bob :: -=/ alice-sym (derive-symmetric-key:alef bob-pub alice-sec) -=/ bob-sym (derive-symmetric-key:alef alice-pub bob-sec) +=/ alice-sym (derive-symmetric-key:vane bob-pub alice-sec) +=/ bob-sym (derive-symmetric-key:vane alice-pub bob-sec) :: ?> =(alice-sym bob-sym) :: @@ -54,7 +54,13 @@ == =. route.peer-state `[direct=%.y `lane:alef`[%| `@`%lane-bar]] [%known peer-state] +:: metamorphose :: +=> .(alice +:(call:(alice) ~[//unix] ** %born ~)) +=> .(bob +:(call:(bob) ~[//unix] ** %born ~)) +:: helper core +:: +=> |% ++ move-to-packet |= =move:alef @@ -75,7 +81,25 @@ %- move-to-packet %+ snag index (skim moves is-move-send) +:: +++ call + |= [vane=_alice =duct =task:alef] + ^- [moves=(list move:alef) _alice] + :: + =/ vane-core (vane(now `@da`(add ~s1 now.vane))) + :: + (call:vane-core duct ** task) +:: +++ take + |= [vane=_alice =wire =duct =sign:alef] + ^- [moves=(list move:alef) _alice] + :: + =/ vane-core (vane(now `@da`(add ~s1 now.vane))) + :: + (take:vane-core wire duct ** sign) -- +:: test core +:: |% ++ test-packet-encoding ^- tang :: @@ -86,8 +110,8 @@ content=[12 13] == :: - =/ encoded (encode-packet:alef packet) - =/ decoded (decode-packet:alef encoded) + =/ encoded (encode-packet:vane packet) + =/ decoded (decode-packet:vane encoded) :: %+ expect-eq !> packet @@ -111,10 +135,10 @@ :* [sndr=~bus rcvr=~doznec-doznec] encrypted=%.y origin=~ - content=(encrypt:alef alice-sym shut-packet) + content=(encrypt:vane alice-sym shut-packet) == :: - =/ =blob:alef (encode-packet:alef packet) + =/ =blob:alef (encode-packet:vane packet) =^ moves1 bob (call bob ~[//unix] %hear lane-foo blob) =^ moves2 bob =/ =point:alef @@ -181,20 +205,4 @@ %+ expect-eq !> [~[/alice] %give %done `error] !> (snag 1 `(list move:alef)`moves5) -:: -++ call - |= [vane=_alice =duct =task:alef] - ^- [moves=(list move:alef) _alice] - :: - =/ vane-core (vane(now `@da`(add ~s1 now.vane))) - :: - (call:vane-core duct ** task) -:: -++ take - |= [vane=_alice =wire =duct =sign:alef] - ^- [moves=(list move:alef) _alice] - :: - =/ vane-core (vane(now `@da`(add ~s1 now.vane))) - :: - (take:vane-core wire duct ** sign) -- From 99134ef5b96e25a3cff705d7bc63e6d05900fa1b Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 28 Jun 2019 15:27:59 -0700 Subject: [PATCH 002/451] zuse compiles --- pkg/arvo/sys/vane/alef.hoon | 185 ++++------- pkg/arvo/sys/zuse.hoon | 645 ++++++++---------------------------- 2 files changed, 201 insertions(+), 629 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index e9180bee7..5e8c7fd22 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1,3 +1,56 @@ +:: Ames extends Arvo's %pass/%give move semantics across the network. +:: +:: A "forward flow" message, which is like a request, is passed to +:: Ames from a local vane. Ames transmits the message to the peer's +:: Ames, which passes the message to the destination vane. +:: +:: Once the peer has processed the "forward flow" message, it sends a +:: message acknowledgment over the wire back to the local Ames. This +:: ack can either be positive or negative, in which case we call it a +:: "nack". (Don't confuse Ames nacks with TCP nacks, which are a +:: different concept). +:: +:: When the local Ames receives either a positive message ack or a +:: combination of a nack and nack-trace (explained in more detail +:: below), it gives an %done move to the local vane that had +:: requested the original "forward flow" message be sent. +:: +:: A "backward flow" message, which is similar to a response or a +:: subscription update, is given to Ames from a local vane. Ames +:: transmits the message to the peer's Ames, which gives the message +:: to the destination vane. +:: +:: Ames will give a %memo to a vane upon hearing the message from a +:: remote. This message is a "backward flow" message, forming one of +:: potentially many responses to a "forward flow" message that a +:: local vane had passed to our local Ames, and which local Ames had +:: relayed to the remote. Ames gives the %memo on the same duct the +:: local vane had originally used to pass Ames the "forward flow" +:: message. +:: +:: Backward flow messages are acked automatically by the receiver. +:: They cannot be nacked, and Ames only uses the ack internally, +:: without notifying the client vane. +:: +:: Forward flow messages can be nacked, in which case the peer will +:: send both a message-nack packet and a nack-trace message, which is +:: sent on a special diagnostic flow so as not to interfere with +:: normal operation. The nack-trace is sent as a full Ames message, +:: instead of just a packet, because the contained error information +:: can be arbitrarily large. +:: +:: Once the local Ames has received the nack-trace, it knows the peer +:: has received the full message and failed to process it. This +:: means if we later hear an ack packet on the failed message, we can +:: ignore it. +:: +:: Also, due to Ames's exactly-once delivery semantics, we know that +:: when we receive a nack-trace for message n, we know the peer has +:: positively acked all messages m+1 through n-1, where m is the last +:: message for which we heard a nack-trace. If we haven't heard acks +:: on all those messages, we apply positive acks when we hear the +:: nack-trace. +:: :: protocol-version: current version of the ames wire protocol :: =/ protocol-version=?(%0 %1 %2 %3 %4 %5 %6 %7) %0 @@ -239,8 +292,6 @@ :: +| %atomics :: -+$ address @uxaddress -+$ blob @uxblob +$ bone @udbone +$ fragment @uwfragment +$ fragment-num @udfragmentnum @@ -309,20 +360,6 @@ :: $dyad: pair of sender and receiver ships :: +$ dyad [sndr=ship rcvr=ship] -:: -+$ error [tag=@tas =tang] -:: $lane: ship transport address; either opaque $address or galaxy -:: -:: The runtime knows how to look up galaxies, so we don't need to -:: know their transport addresses. -:: -+$ lane (each @pC address) -:: $message: application-level message -:: -:: path: internal route on the receiving ship -:: payload: semantic message contents -:: -+$ message [=path payload=*] :: $packet: noun representation of an ames datagram packet :: :: Roundtrips losslessly through atom encoding and decoding. @@ -585,98 +622,6 @@ $% [%call =duct type=* wrapped-task=(hobo task)] [%take =wire =duct type=* =sign] == -:: $task: job for ames -:: -:: %born: process restart notification -:: %crud: crash report -:: %hear: packet from unix -:: %hole: report that packet handling crashed -:: %init: vane boot -:: %sunk: a ship breached and has a new .rift -:: %vega: kernel reload notification -:: %wegh: request for memory usage report -:: %memo: request to send message -:: -+$ task - $% [%born ~] - [%crud =error] - [%hear =lane =blob] - [%hole =lane =blob] - [%init =ship] - [%vega ~] - [%wegh ~] - [%memo =ship =message] - == -:: $gift: effect from ames -:: -:: Ames extends Arvo's %pass/%give move semantics across the network. -:: -:: A "forward flow" message, which is like a request, is passed to -:: Ames from a local vane. Ames transmits the message to the peer's -:: Ames, which passes the message to the destination vane. -:: -:: Once the peer has processed the "forward flow" message, it sends a -:: message acknowledgment over the wire back to the local Ames. This -:: ack can either be positive or negative, in which case we call it a -:: "nack". (Don't confuse Ames nacks with TCP nacks, which are a -:: different concept). -:: -:: When the local Ames receives either a positive message ack or a -:: combination of a nack and nack-trace (explained in more detail -:: below), it gives an %done move to the local vane that had -:: requested the original "forward flow" message be sent. -:: -:: A "backward flow" message, which is similar to a response or a -:: subscription update, is given to Ames from a local vane. Ames -:: transmits the message to the peer's Ames, which gives the message -:: to the destination vane. -:: -:: Ames will give a %memo to a vane upon hearing the message from a -:: remote. This message is a "backward flow" message, forming one of -:: potentially many responses to a "forward flow" message that a -:: local vane had passed to our local Ames, and which local Ames had -:: relayed to the remote. Ames gives the %memo on the same duct the -:: local vane had originally used to pass Ames the "forward flow" -:: message. -:: -:: Backward flow messages are acked automatically by the receiver. -:: They cannot be nacked, and Ames only uses the ack internally, -:: without notifying the client vane. -:: -:: Forward flow messages can be nacked, in which case the peer will -:: send both a message-nack packet and a nack-trace message, which is -:: sent on a special diagnostic flow so as not to interfere with -:: normal operation. The nack-trace is sent as a full Ames message, -:: instead of just a packet, because the contained error information -:: can be arbitrarily large. -:: -:: Once the local Ames has received the nack-trace, it knows the peer -:: has received the full message and failed to process it. This -:: means if we later hear an ack packet on the failed message, we can -:: ignore it. -:: -:: Also, due to Ames's exactly-once delivery semantics, we know that -:: when we receive a nack-trace for message n, we know the peer has -:: positively acked all messages m+1 through n-1, where m is the last -:: message for which we heard a nack-trace. If we haven't heard acks -:: on all those messages, we apply positive acks when we hear the -:: nack-trace. -:: -:: %memo: message to vane from peer -:: %send: packet to unix -:: %done: notify vane that peer (n)acked our message -:: -:: %mass: memory usage report -:: %turf: domain report, relayed from jael -:: -+$ gift - $% [%memo =message] - [%send =lane =blob] - [%done error=(unit error)] - :: - [%mass mass] - [%turf turfs=(list turf)] - == :: $note: request to other vane :: :: TODO: specialize gall interface for subscription management @@ -698,9 +643,9 @@ $% [%wait date=@da] [%rest date=@da] == == - $: %j + $: %k $% [%private-keys ~] - [%public-keys =ship] + [%public-keys ships=(set ship)] [%turf ~] == == $: @tas @@ -724,7 +669,7 @@ $% $: %b $% [%wake error=(unit tang)] == == - $: %j + $: %k $% [%private-keys =life =private-key] [%public-keys =vent-result] [%turf turfs=(list turf)] @@ -925,9 +870,9 @@ :: [%b %wake *] (on-take-wake:event-core wire error.sign) :: - [%j %private-keys *] (on-priv:event-core [life private-key]:sign) - [%j %public-keys *] (on-publ:event-core wire vent-result.sign) - [%j %turf *] (on-take-turf:event-core turfs.sign) + [%k %private-keys *] (on-priv:event-core [life private-key]:sign) + [%k %public-keys *] (on-publ:event-core wire vent-result.sign) + [%k %turf *] (on-take-turf:event-core turfs.sign) == :: [moves ames-gate] @@ -1170,9 +1115,9 @@ |= our=ship ^+ event-core :: - =~ (emit duct %pass /init/public-keys %j %public-keys our) - (emit duct %pass /init/private-keys %j %private-keys ~) - (emit duct %pass /init/turf %j %turf ~) + =~ (emit duct %pass /public-keys %k %public-keys [n=our ~ ~]) + (emit duct %pass /private-keys %k %private-keys ~) + (emit duct %pass /turf %k %turf ~) == :: +on-priv: set our private key to jael's response :: @@ -1430,7 +1375,7 @@ :: ?: already-pending event-core - (emit duct %pass /alien %j %public-keys ship) + (emit duct %pass /public-keys %k %public-keys [n=ship ~ ~]) :: +set-sponsor-heartbeat-timer: trigger sponsor ping after timeout :: ++ set-sponsor-heartbeat-timer @@ -1675,7 +1620,7 @@ |= [=message-num =message] ^+ peer-core :: - ?> ?=([?(%a %c %g %j) *] path.message) + ?> ?=([?(%a %c %g %k) *] path.message) :: odd .bone; "request" message to pass to vane before acking :: ?: =(1 (end 0 1 bone)) @@ -1692,7 +1637,7 @@ %a ~| %bad-ames-message^path.message^her.channel !! %c (emit client-duct %pass wire %c %memo her.channel message) %g (emit client-duct %pass wire %g %memo her.channel message) - %j (emit client-duct %pass wire %j %memo her.channel message) + %k (emit client-duct %pass wire %k %memo her.channel message) == :: even bone means backward flow; ack automatically :: diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 4e563f2ad..0b638a820 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -1,3 +1,4 @@ +!: :: :: /van/zuse :: :: %reference/1 :: %zuse: arvo library. @@ -16,7 +17,7 @@ :: - %eyre: web ("fair") :: - %ford: build ("lord") :: - %gall: application ("ball") -:: - %jael: security ("jail") +:: - %kale: security ("jail") :: :: with %zuse in your core, the engines of any vane are :: available at `engine:vane`. the models (molds) are @@ -120,7 +121,7 @@ -- -- :: :::: -:::: ++ethereum-types :: eth surs for jael +:::: ++ethereum-types :: eth surs for kale :: :::: ++ ethereum-types |% @@ -134,7 +135,7 @@ ++ events (set event-id) -- :: :::: -:::: ++azimuth-types :: az surs for jael +:::: ++azimuth-types :: az surs for kale :: :::: ++ azimuth-types =, ethereum-types @@ -165,7 +166,7 @@ $= kid %- unit $: spawn-proxy=address - spawned=(set @p) ::TODO sparse range, pile, see old jael ++py + spawned=(set @p) ::TODO sparse range, pile, see old kale ++py == == :: @@ -214,7 +215,7 @@ [%wegh ~] :: receive message via %ames :: - [%west p=ship q=path r=*] + [%memo p=ship q=path r=*] == :: :::: :::: ++http :: @@ -374,32 +375,46 @@ :: :::: ++ able ^? |% - ++ gift :: out result <-$ - $% {$mack p/(unit tang)} :: acknowledgement - {$mass p/mass} :: memory usage - {$send p/lane q/@} :: transmit packet - {$turf p/(list turf)} :: bind to domains - $>(%west vane-task) :: for the outside - {$woot p/ship q/coop} :: reaction message - == :: - ++ task :: in request ->$ - $~ [%vega ~] :: - $% {$barn ~} :: new unix process - {$bonk ~} :: reset the timer - $>(%crud vane-task) :: error with trace - {$hear p/lane q/@} :: receive packet - {$halo p/lane q/@ r/ares} :: hole with trace - {$hole p/lane q/@} :: packet failed - $>(%init vane-task) :: report install - {$kick p/@da} :: wake up - {$nuke p/@p} :: toggle auto-block - $>(%sunk vane-task) :: report death - $>(%vega vane-task) :: report upgrade - {$wake ~} :: timer activate - $>(%wegh vane-task) :: report memory - $>(%west vane-task) :: network request - {$want p/ship q/path r/*} :: forward message - == :: + :: $task: job for ames + :: + :: %hear: packet from unix + :: %hole: report that packet handling crashed + :: + :: %born: process restart notification + :: %crud: crash report + :: %init: vane boot + :: %memo: request to send message + :: %vega: kernel reload notification + :: %wegh: request for memory usage report + :: + +$ task + $% [%hear =lane =blob] + [%hole =lane =blob] + :: + $>(%born vane-task) + $>(%crud vane-task) + $>(%init vane-task) + $>(%memo vane-task) + $>(%vega vane-task) + $>(%wegh vane-task) + == + :: $gift: effect from ames + :: + :: %memo: message to vane from peer + :: %send: packet to unix + :: %done: notify vane that peer (n)acked our message + :: + :: %mass: memory usage report + :: %turf: domain report, relayed from kale + :: + +$ gift + $% [%memo =message] + [%send =lane =blob] + [%done error=(unit error)] + :: + [%mass mass] + [%turf turfs=(list turf)] + == -- ::able :: :::: :: (1a2) @@ -427,131 +442,27 @@ ++ com |~(a/pass ^?(..nu)) :: from pass -- ::nu :: -- ::acru :: - ++ bait {p/skin q/@ud r/dove} :: fmt nrecvd spec - ++ bath :: convo per client - $: sop/shed :: not stalled - raz/(map path race) :: statements inbound - ryl/(map path rill) :: statements outbound - == :: - ++ boon :: fort output - $% [%beer p=ship] :: request public keys - [%bock ~] :: bind to domains - [%brew ~] :: request domains - [%cake p=ship q=soap r=coop s=duct] :: e2e message result - [%mead p=lane q=rock] :: accept packet - [%milk p=ship q=soap r=*] :: e2e pass message - [%ouzo p=lane q=rock] :: transmit packet - [%pito p=@da] :: timeout - [%raki p=ship q=life r=pass] :: neighbor'd - [%sake ~] :: our private keys - [%wine p=ship q=tape] :: notify user - == :: - ++ cake {p/sock q/skin r/@} :: top level packet - ++ cape :: end-to-end result - $? $good :: delivered - $dead :: rejected - == :: - ++ clot :: symmetric record - $: yed/(unit {p/hand q/code}) :: outbound - heg/(map hand code) :: proposed - qim/(map hand code) :: inbound - == :: - ++ code @uvI :: symmetric key - ++ corn :: flow by server - $: nys/(map flap bait) :: packets incoming - olz/(map flap cape) :: packets completed - wab/(map ship bath) :: relationship - == :: - +$ deed [=life =pass oath=(unit oath:pki:jael)] :: life/pub/sig - ++ dore :: foreign contact - $: wod/road :: connection to - caq/clot :: symmetric key state - == :: - ++ dove {p/@ud q/(map @ud @)} :: count hash 13-blocks - ++ flap @uvH :: network packet id - ++ flow :: packet connection - $: rtt/@dr :: decaying avg rtt - wid/@ud :: logical wdow msgs - == :: - ++ fort :: formal state - $: $1 :: version - gad/duct :: client interface - tim/(unit @da) :: pending timer - tuf/(list turf) :: domains - hop/@da :: network boot date - bad/(set @p) :: bad ships - ton/town :: security - zac/corn :: flows by server - == :: - ++ hand @uvH :: 128-bit hash - ++ lane :: packet route - $% {$if p/@da q/@ud r/@if} :: IP4/public UDP/addr - {$is p/@ud q/(unit lane) r/@is} :: IPv6 w+alternates - {$ix p/@da q/@ud r/@if} :: IPv4 provisional - == :: - ++ meal :: payload - $% {$back p/coop q/flap r/@dr} :: ack - {$bond p/path q/@ud r/*} :: message - {$carp p/@ q/@ud r/@ud s/flap t/@} :: skin+inx+cnt+hash - {$fore p/ship q/(unit lane) r/@} :: forwarded packet - == :: - ++ name {p/@t q/(unit @t) r/(unit @t) s/@t} :: first mid+nick last - ++ putt :: outgoing message - $: ski/snow :: sequence acked+sent - wyv/(list rock) :: packet list XX gear - == :: - ++ race :: inbound stream - $: did/@ud :: filled sequence - dod/? :: not processing - bum/(map @ud ares) :: nacks - mis/(map @ud {p/cape q/lane r/flap s/(unit)}) :: misordered - == :: - ++ rill :: outbound stream - $: sed/@ud :: sent - san/(map @ud duct) :: outstanding - == :: - ++ road :: secured oneway route - $: exp/@da :: expiration date - lun/(unit lane) :: route to friend - lew/(unit deed) :: deed of friend - == :: - ++ rock @uvO :: packet - ++ shed :: packet flow - $: $: rtt/@dr :: smoothed rtt - rto/@dr :: retransmit timeout - rtn/(unit @da) :: next timeout - rue/(unit @da) :: last heard from - == :: - $: nus/@ud :: number sent - nif/@ud :: number live - nep/@ud :: next expected - caw/@ud :: logical window - cag/@ud :: congest thresh - == :: - $: diq/(map flap @ud) :: packets sent - pyz/(map soup @ud) :: message+unacked - puq/(qeu {p/@ud q/soul}) :: packet queue - == :: - == :: - ++ skin ?($none $open $fast $full) :: encoding stem - ++ snow {p/@ud q/@ud r/(set @ud)} :: window exceptions - ++ soap {p/{p/life q/life} q/path r/@ud} :: statement id - ++ soup {p/path q/@ud} :: new statement id - ++ soul :: packet in travel - $: gom/soup :: message identity - nux/@ud :: xmission count - liv/? :: deemed live - lys/@da :: last sent - pac/rock :: packet data - == :: - ++ town :: all security state - $: any/@ :: entropy - val/wund :: private keys - law/deed :: server deed - seh/(map hand {p/ship q/@da}) :: key cache - hoc/(map ship dore) :: neighborhood - == :: - ++ wund (list {p/life q/ring r/acru}) :: secrets in action + :: $address: opaque atomic transport address to or from unix + :: + +$ address @uxaddress + :: $blob: raw atom to or from unix, representing a packet + :: + +$ blob @uxblob + :: $error: tagged diagnostic trace + :: + +$ error [tag=@tas =tang] + :: $lane: ship transport address; either opaque $address or galaxy + :: + :: The runtime knows how to look up galaxies, so we don't need to + :: know their transport addresses. + :: + +$ lane (each @pC address) + :: $message: application-level message + :: + :: path: internal route on the receiving ship + :: payload: semantic message contents + :: + +$ message [=path payload=*] -- ::ames :: :::: :::: ++behn :: (1b) timekeeping @@ -598,13 +509,13 @@ {$dirk p/@tas} :: mark mount dirty {$ergo p/@tas q/mode} :: version update {$hill p/(list @tas)} :: mount points - {$mack p/(unit tang)} :: ack + [%done error=(unit error:ames)] :: message (n)ack + [%memo =message:ames] :: send ames message {$mass p/mass} :: memory usage {$mere p/(each (set path) (pair term tang))} :: merge result {$note p/@tD q/tank} :: debug message {$ogre p/@tas} :: delete mount point {$rule red/dict wit/dict} :: node r+w permissions - {$send p/lane:ames q/@} :: transmit packet {$writ p/riot} :: response {$wris p/{$da p/@da} q/(set (pair care path))} :: many changes == :: @@ -633,7 +544,7 @@ {$warp wer/ship rif/riff} :: internal file req {$werp who/ship wer/ship rif/riff} :: external file req $>(%wegh vane-task) :: report memory - $>(%west vane-task) :: network request + $>(%memo vane-task) :: network request == :: -- ::able :: @@ -869,10 +780,10 @@ ++ eyre ^? |% ++ bale :: driver state - |* a/_* :: %jael keys type + |* a/_* :: %kale keys type $: {our/ship now/@da eny/@uvJ byk/beak} :: base info {usr/user dom/(list @t)} :: req user, domain - key/a :: secrets from %jael + key/a :: secrets from %kale == :: :: ++ cred :: credential @@ -1725,9 +1636,9 @@ ++ gift :: outgoing result $% {$mass p/mass} :: memory usage {$onto p/(each suss tang)} :: about agent - {$rend p/path q/*} :: network request {$unto p/cuft} :: - {$mack p/(unit tang)} :: message ack + [%done error=(unit error:ames)] :: message (n)ack + [%memo =message:ames] :: send ames message == :: ++ task :: incoming request $~ [%vega ~] :: @@ -1736,7 +1647,7 @@ {$deal p/sock q/cush} :: full transmission $>(%sunk vane-task) :: report death $>(%vega vane-task) :: report upgrade - $>(%west vane-task) :: network request + $>(%memo vane-task) :: network request $>(%wegh vane-task) :: report memory == :: -- ::able @@ -1794,239 +1705,6 @@ ++ well (pair desk term) :: -- ::gall :: :::: -:::: ++jael :: (1h) security - :: :::: -++ jael ^? - |% - :: :: - :::: ++able:jael :: (1h1) arvo moves - :: :::: - ++ able ^? - =, pki - =, rights - |% - :: %jael has two general kinds of task: changes - :: and change subscriptions. - :: - :: change tasks are designed to match high-level - :: operations - for instance, we have %burn, %mint, - :: and %move, not just a single delta operation. - :: more of these operations will probably be added, - :: and invariants enforced at transaction end. - :: - :: subscriptions are also user-focused - for instance, - :: %vein sends all the information needed to maintain - :: the secure channel, both rights and certificates. - :: the security-critical tasks (%veil, %vein, %vine) - :: should probably be bound to a whitelisted duct set. - :: (all secrets are redacted from %vest gifts.) - :: - :: %jael only talks to %ames and %behn. we send messages - :: through %ames and use %behn timers. - :: - ++ logs :: on-chain changes - %+ map event-id:ethereum-types :: per event log - diff-azimuth:azimuth-types :: the change - ++ action :: balance change - %+ pair ship :: partner - %+ each bump :: &/liability change - bump :: |/asset change - :: :: - ++ balance :: balance sheet - %+ pair :: - (map ship safe) :: liabilities - (map ship safe) :: assets - :: :: - ++ vent-result :: %vent result - $% [%snap snap=snapshot:jael] :: restore snapshot - [%chain can=chain] :: get new events - == :: - :: :: - ++ chain :: batch of changes - %+ each logs :: & all events - logs :: | new events - ++ change :: urbit change - $% [%ethe can=chain] :: on-chain change - [%meet who=ship =life =pass] :: meet in new era - $: %rite :: rights change - rex/ship :: issuer - pal/ship :: issued to - del/bump :: change - == == :: - ++ gift :: out result <-$ - $% [%init p=ship] :: report install unix - [%mass p=mass] :: memory usage report - [%mack p=(unit tang)] :: message n/ack - [%pubs public] :: public keys - [%turf turf=(list turf)] :: domains - [%vest p=tally] :: balance update - [%vein =life vein=(map life ring)] :: private keys - [%vine p=(list change)] :: all raw changes - [%vent p=vent-result] :: ethereum changes - == :: - :: :: - ++ public :: public key state - $: life=life :: current key number - pubs=(map life pass) :: pubkeys by number - == :: - ++ remote :: remote notification - %+ each safe :: &/addition - safe :: |/replacement - :: +seed: private boot parameters - :: - +$ seed [who=ship lyf=life key=ring sig=(unit oath:pki)] - :: - ++ tally :: balance update - %+ each balance :: complete - action :: change - :: - += task :: in request ->$ - $~ [%vega ~] :: - $% [%burn p=ship q=safe] :: destroy rights - [%hail p=ship q=remote] :: remote update - $: %dawn :: boot from keys - =seed:able:jael :: identity params - spon=ship :: sponsor - czar=(map ship [=life =pass]) :: galaxy table - turf=(list turf) :: domains - bloq=@ud :: block number - node=(unit purl:eyre) :: gateway url - snap=(unit snapshot) :: head start - == :: - [%fake =ship] :: fake boot - [%look src=(each ship purl:eyre)] :: set ethereum source - [%mint p=ship q=safe] :: create rights - [%move p=ship q=ship r=safe] :: transfer from=to - ::TODO %next for generating/putting new private key - [%nuke ~] :: cancel tracker from - [%pubs =ship] :: view public keys - [%meet =ship =life =pass] :: met after breach - [%snap snap=snapshot kick=?] :: load snapshot - [%turf ~] :: view domains - $>(%vega vane-task) :: report upgrade - [%vein ~] :: view signing keys - [%vent ~] :: view ethereum events - [%vest ~] :: view public balance - [%vine ~] :: view secret history - $>(%wegh vane-task) :: memory usage request - $>(%west vane-task) :: remote request - [%wind p=@ud] :: rewind before block - == :: - -- :: - :: :: - :::: :: - :: :: - ++ node-src :: ethereum node comms - $: node=purl:eyre :: node url - filter-id=@ud :: current filter - poll-timer=@da :: next filter poll - == :: - ++ snapshot :: rewind point - =, azimuth-types :: - $: kyz=(map ship public:able) :: public key state - $= eth :: - $: dns=dnses :: on-chain dns state - pos=(map ship point) :: on-chain ship state - == :: - eth-bookmark - == - :: +eth-bookmark: cursor into the ethereum chain - :: - ++ eth-bookmark - $: heard=(set event-id:ethereum-types) - latest-block=@ud - == - :: +state-eth-node: state of a connection to an ethereum node - :: - ++ state-eth-node :: node config + meta - $: source=(each ship node-src) :: learning from - foreign-block=@ud :: node's latest block - eth-bookmark - == :: - :: :: - :::: ++pki:jael :: (1h2) certificates - :: :::: - ++ pki ^? - |% - ::TODO update to fit azimuth-style keys - :: the urbit meta-certificate (++will) is a sequence - :: of certificates (++cert). each cert in a will - :: revokes and replaces the previous cert. the - :: version number of a ship is a ++life. - :: - :: the deed contains an ++arms, a definition - :: of cosmetic identity; a semi-trusted parent, - :: which signs the initial certificate and provides - :: routing services; and a dirty bit. if the dirty - :: bit is set, the new life of this ship may have - :: lost information that the old life had. - :: - ++ hand @uvH :: 128-bit hash - ++ mind {who/ship lyf/life} :: key identifier - ++ name (pair @ta @t) :: ascii / unicode - ++ oath @ :: signature - -- :: pki - :: :: - :::: ++rights:jael :: (1h3) claims - :: :::: - ++ rights ^? - =, pki - |% - :: %jael tracks promises (++rite) from ship to ship. - :: a rite may be any right, badge, asset, secret, etc. - :: un-shared secret or private asset is stored as a - :: rite from self to self. - :: - :: each rite is really a class of rights, and often - :: has its own internal set or map structure. - :: - :: present kinds of rite: - :: - :: %apple: application secret for a web api. - :: %block: the promisee is banned. - :: %email: email tied to promissee's ship. - :: %final: ship/ticket pair, ready to launch. - :: %fungi: fungible, countable asset. - :: %guest: permission to adopt foreign child. - :: %hotel: block of unissued children. - :: %jewel: urbit private keys. - :: %login: user's login passcode. - :: %pword: password for a website/api. - :: %token: user access token for a web api. - :: %urban: symmetric key for urbit networking. - :: - :: %fungi keys can be anything, but don't reuse - :: currency codes. codes for urbit invitations: - :: %ugl == galaxy, %usr == star, %upl == planet - :: - :: you can think of [our her rite] as an rdf triple. - :: - ++ bill (pair @da @) :: expiring value - ++ bump :: rights change - $: mor/safe :: add rights - les/safe :: lose rights - == :: - ++ dorm (pair ship bloq) :: issuing group - ++ pile (tree (pair @ @)) :: efficient ship set - ++ rite :: urbit commitment - $% {$apple p/(map site @)} :: web api key - {$block ~} :: banned - {$email p/(set @t)} :: email addresses - {$final p/(map ship @pG)} :: ticketed ships - {$fungi p/(map term @ud)} :: fungibles - {$guest ~} :: refugee visa - {$hotel p/(map dorm pile)} :: reserved block - {$jewel p/(map life ring)} :: private keyring - {$login p/(set @pG)} :: login secret - {$pword p/(map site (map @t @t))} :: web passwd by user - {$token p/(map site (map @t @t))} :: app tokens by user - {$urban p/(map hand bill)} :: urbit symmetric keys - == :: - ++ site (list @ta) :: [%com %yahoo %www ~] - ++ safe (tree rite) :: rights set - -- :: rights - -- :: jael -:: :::: :::: ++kale :: (1h) security :: :::: ++ kale ^? @@ -2075,7 +1753,8 @@ ++ gift :: out result <-$ $% [%init p=ship] :: report install unix [%mass p=mass] :: memory usage report - [%mack p=(unit tang)] :: message n/ack + [%done error=(unit error:ames)] :: message (n)ack + [%memo =message:ames] :: send ames message [%source whos=(set ship) src=source] :: [%turf turf=(list turf)] :: domains [%private-keys =life vein=(map life ring)] :: private keys @@ -2109,7 +1788,7 @@ [%vent-update =vent-result] :: update from app $>(%vega vane-task) :: report upgrade $>(%wegh vane-task) :: memory usage request - $>(%west vane-task) :: remote request + $>(%memo vane-task) :: remote request [%wind p=@ud] :: rewind before block == :: -- :: @@ -2442,56 +2121,6 @@ =request:http == -- -:: :::: -:::: ++xmas :: (1i) new network - :: :::: -++ xmas ^? - :: :: - :::: ++able:xmas :: (1i1) arvo moves - :: :::: - |% - ++ able ^? - |% - ++ gift :: - $% {$east p/*} :: response message - {$home p/lane q/@} :: process forward - {$send p/lane q/@} :: send packet - {$rest p/coop} :: acknowledgment - == :: - ++ task :: in request ->$ - $% {$hear p/lane q/@} :: - {$mess p/ship q/path r/*} :: send message - {$wake ~} :: - == :: - ++ card :: out cards - $% {$west p/ship q/path r/*} :: network request - == :: - ++ sign :: in response $-< - $: $g :: - $% {$rend p/path q/*} :: network request - {$mack p/(unit tang)} :: message ack - == == :: - ++ note :: out request $-> - $% {$c $west p/ship q/path r/*} :: to %clay - {$e $west p/ship q/path r/*} :: to %eyre - {$g $west p/ship q/path r/*} :: to %gall - $: $j :: to %jael - $% {$line p/ship q/@da r/code} :: - {$link p/ship q/@da r/code} :: - {$veil p/ship} :: - {$west p/ship q/path r/*} :: to %gall - == == == :: - -- :: able - :: - :::: :: (1i2) - :: - ++ code @uvI :: symmetric key - ++ lane :: packet route - $% {$if p/@da q/@ud r/@if} :: IP4/public UDP/addr - {$is p/@ud q/(unit lane) r/@is} :: IPv6 w+alternates - {$ix p/@da q/@ud r/@if} :: IPv4 provisional - == :: - -- ::xmas -- :: :: :: :: :::: :: :: (2) engines @@ -7021,14 +6650,14 @@ ++ saxo :: autocanon |= [our=ship now=@da who=ship] .^ (list ship) - %j + %k /(scot %p our)/saxo/(scot %da now)/(scot %p who) == :: :: ++sein:title ++ sein :: autoboss |= [our=ship now=@da who=ship] .^ ship - %j + %k /(scot %p our)/sein/(scot %da now)/(scot %p who) == :: :: ++team:title @@ -7602,7 +7231,7 @@ gift:able:dill gift:able:ford gift:able:gall - gift:able:jael + gift:able:kale gift:able:http-client gift:able:http-server == @@ -7613,19 +7242,19 @@ task:able:dill task:able:ford task:able:gall - task:able:jael + task:able:kale task:able:http-client task:able:http-server == ++ note-arvo :: out request $-> - $~ [%a %wake ~] + $~ [%b %wake ~] $% {$a task:able:ames} {$b task:able:behn} {$c task:able:clay} {$d task:able:dill} {$f task:able:ford} {$g task:able:gall} - {$j task:able:jael} + {$k task:able:kale} [%l task:able:http-client] [%r task:able:http-server] {@tas $meta vase} @@ -7641,17 +7270,14 @@ {$d gift:able:dill} {$f gift:able:ford} {$g gift:able:gall} - {$j gift:able:jael} + {$k gift:able:kale} [%l gift:able:http-client] [%r gift:able:http-server] == :: +$ unix-task :: input from unix $~ [%wake ~] - $% :: %ames: new process - :: - $>(%barn task:able:ames) - :: %dill: keyboard input + $% :: %dill: keyboard input :: $>(%belt task:able:dill) :: %dill: configure terminal (resized) @@ -7700,7 +7326,7 @@ $>(%wake task:able:behn) :: %ames: send message :: - $>(%want task:able:ames) + $>(%memo task:able:ames) == :: :: :::: ++azimuth :: (2az) azimuth @@ -8928,7 +8554,7 @@ ?> ?=(%king (clan:title i.tar)) $(tar t.tar, stars (~(put in stars) i.tar)) :: - |- ^- seed:able:jael + |- ^- seed:able:kale =/ cub=acru:ames (pit:nu:crub:crypto 512 eny) =/ who=ship `@`fig:ex:cub ?: (~(has in stars) (^sein:title who)) @@ -9122,56 +8748,57 @@ :: ++ snap !: - |% - :: +bloq:snap:dawn: extract block number - :: - ++ bloq - |= snap=snapshot:jael - ^- (unit @ud) - =- ?:(?=(%| -.out) ~ (some p.out)) - ^= out %- mule |. - latest-block.snap - :: +czar:snap:dawn: extract galaxy table - :: - ++ czar - |= snap=snapshot:jael - ^- (unit (map ship [=life =pass])) - =- ?:(?=(%| -.out) ~ (some p.out)) - ^= out %- mule |. - %- ~(gas by *(map ship [=life =pass])) - %+ turn (gulf 0 255) - |= gal=@ - ^- [ship [life pass]] - :- gal - ~| czar-gal=gal - [life pass]:(need net:(~(got by pos.eth.snap) gal)) - :: +point:snap:dawn: extract ship's contract state - :: - ++ point - |= [who=ship snap=snapshot:jael] - ^- (unit point:azimuth) - (~(get by pos.eth.snap) who) - :: +turf:snap:dawn: extract network domains - :: - ++ turf - |= snap=snapshot:jael - ^- (unit (list ^turf)) - =- ?:(?=(%| -.out) ~ (some p.out)) - ^= out %- mule |. - %+ murn - ^- (list host:eyre) - %+ murn - ^- (list @t) - ~[pri sec ter]:dns.eth.snap - |= dom=@t - ^- (unit host:eyre) - (rush dom thos:de-purl:html) - |=(a=host:eyre ?:(?=(%| -.a) ~ (some p.a))) - -- + !! +:: |% +:: :: +bloq:snap:dawn: extract block number +:: :: +:: ++ bloq +:: |= snap=snapshot:kale +:: ^- (unit @ud) +:: =- ?:(?=(%| -.out) ~ (some p.out)) +:: ^= out %- mule |. +:: latest-block.snap +:: :: +czar:snap:dawn: extract galaxy table +:: :: +:: ++ czar +:: |= snap=snapshot:kale +:: ^- (unit (map ship [=life =pass])) +:: =- ?:(?=(%| -.out) ~ (some p.out)) +:: ^= out %- mule |. +:: %- ~(gas by *(map ship [=life =pass])) +:: %+ turn (gulf 0 255) +:: |= gal=@ +:: ^- [ship [life pass]] +:: :- gal +:: ~| czar-gal=gal +:: [life pass]:(need net:(~(got by pos.eth.snap) gal)) +:: :: +point:snap:dawn: extract ship's contract state +:: :: +:: ++ point +:: |= [who=ship snap=snapshot:kale] +:: ^- (unit point:azimuth) +:: (~(get by pos.eth.snap) who) +:: :: +turf:snap:dawn: extract network domains +:: :: +:: ++ turf +:: |= snap=snapshot:kale +:: ^- (unit (list ^turf)) +:: =- ?:(?=(%| -.out) ~ (some p.out)) +:: ^= out %- mule |. +:: %+ murn +:: ^- (list host:eyre) +:: %+ murn +:: ^- (list @t) +:: ~[pri sec ter]:dns.eth.snap +:: |= dom=@t +:: ^- (unit host:eyre) +:: (rush dom thos:de-purl:html) +:: |=(a=host:eyre ?:(?=(%| -.a) ~ (some p.a))) +:: -- :: +veri:dawn: validate keys, life, discontinuity, &c :: ++ veri - |= [=seed:able:jael =point:azimuth =live] + |= [=seed:able:kale =point:azimuth =live] ^- (each sponsor=ship error=term) =/ rac (clan:title who.seed) =/ cub (nol:nu:crub:crypto key.seed) From 889c300092f6d7a2c1520bcede812f7d03b17f54 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 28 Jun 2019 16:43:52 -0700 Subject: [PATCH 003/451] clay, alef, and zuse compile --- pkg/arvo/sys/vane/alef.hoon | 6 +- pkg/arvo/sys/vane/clay.hoon | 106 +++++++++++++++++++----------------- pkg/arvo/sys/zuse.hoon | 3 +- 3 files changed, 64 insertions(+), 51 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 5e8c7fd22..f58993796 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -53,8 +53,12 @@ :: :: protocol-version: current version of the ames wire protocol :: +!: =/ protocol-version=?(%0 %1 %2 %3 %4 %5 %6 %7) %0 +=, ames +=, able :: +=> |% +| %generics :: $mk-item: constructor for +ordered-map item type @@ -847,7 +851,7 @@ %crud !! %hear (on-hear:event-core [lane blob]:task) %hole !! - %init (on-init:event-core ship.task) + %init (on-init:event-core ship=p.task) %vega on-vega:event-core %wegh on-wegh:event-core %memo (on-memo:event-core [ship message]:task) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 2e7553b30..d541c23b3 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -471,7 +471,7 @@ ++ note :: out request $-> $~ [%b %wait *@da] :: $% $: %a :: to %ames - $>(%want task:able:ames) :: + $>(%memo task:able:ames) :: == :: $: %b :: to %behn $> $? %drip :: @@ -505,8 +505,8 @@ $% [%init-clad ~] :: == == :: $: %a :: by %ames - $> $? %send :: XX strange - %woot :: + $> $? %memo :: + %done :: == :: gift:able:ames :: == :: @@ -2790,8 +2790,13 @@ :: Transfer a request to another ship's clay. :: ++ send-over-ames - |= {a/duct b/path c/ship d/{p/@ud q/riff}} - (emit a %pass b %a %want c [%c %question p.q.d (scot %ud p.d) ~] q.d) + |= [=duct =ship index=@ud =riff] + ^+ +> + :: + =/ =desk p.riff + =/ =wire /warp-index/(scot %p ship)/(scot %tas desk)/(scot %ud index) + =/ =path [%c %question desk (scot %ud index) ~] + (emit duct %pass wire %a %memo ship path riff) :: :: Create a request that cannot be filled immediately. :: @@ -2815,7 +2820,7 @@ =+ inx=nix.u.ref =. +>+.$ =< ?>(?=(^ ref) .) - (send-over-ames hen [(scot %ud inx) ~] her inx syd ~ rave) + (send-over-ames hen her inx syd `rave) %= +>+.$ nix.u.ref +(nix.u.ref) bom.u.ref (~(put by bom.u.ref) inx [hen rave]) @@ -2913,12 +2918,12 @@ ?: |(?=(%& -.w) (~(has by cez) p.w)) s (~(put in s) p.w) ?^ mis - =- (emit hen %give %mack `[%leaf "No such group(s): {-}"]~) + =- (emit hen %give %done `[%perm-fail [%leaf "No such group(s): {-}"]~]) %+ roll ~(tap in `(set @ta)`mis) |= {g/@ta t/tape} ?~ t (trip g) :(weld t ", " (trip g)) - =< (emit hen %give %mack ~) + =< (emit hen %give %done ~) ?- -.rit $r wake(per (put-perm per pax red.rit)) $w wake(pew (put-perm pew pax wit.rit)) @@ -2969,7 +2974,7 @@ =: fod.u.ref (~(del by fod.u.ref) hen) bom.u.ref (~(del by bom.u.ref) u.nux) == - (send-over-ames hen [(scot %ud u.nux) ~] her u.nux syd ~) + (send-over-ames hen her u.nux syd ~) :: :: Handles a request. :: @@ -4105,7 +4110,7 @@ =| mos/(list move) =/ des ~(tap in ~(key by dos.rom.ruf)) |- - ?~ des [[[hen %give %mack ~] mos] ..^^$] + ?~ des [[[hen %give %done ~] mos] ..^^$] =/ den ((de our now ski hen ruf) our i.des) =^ mor ruf =< abet:wake @@ -4352,25 +4357,19 @@ (start-request:den for u.q.rif) [mos ..^$] :: - %west - =* wer p.req - =* pax q.req - =* res r.req - ?: ?=({%question *} pax) - =+ ryf=;;(riff res) - :_ ..^$ - :~ [hen %give %mack ~] - =/ =wire - [(scot %p our) (scot %p wer) t.pax] - [hen %pass wire %c %werp wer our ryf] - == - ?> ?=({%answer @ @ ~} pax) - =+ syd=(slav %tas i.t.pax) - =+ inx=(slav %ud i.t.t.pax) - =^ mos ruf - =/ den ((de our now ski hen ruf) wer syd) - abet:(take-foreign-answer:den inx ;;((unit rand) res)) - [[[hen %give %mack ~] mos] ..^$] + %memo + =* her ship.req + =* pax path.message.req + =* res payload.message.req + :: + ?> ?=({%question *} pax) + =+ ryf=;;(riff res) + :_ ..^$ + :~ [hen %give %done ~] + =/ =wire + [%foreign-warp (scot %p her) t.pax] + [hen %pass wire %c %werp her our ryf] + == :: %wegh :_ ..^$ :_ ~ @@ -4430,6 +4429,7 @@ ++ take :: accept response |= {tea/wire hen/duct hin/(hypo sign)} ^+ [*(list move) ..^$] + :: ?: ?=({$commit @ *} tea) =* syd i.t.tea =^ mos ruf @@ -4451,6 +4451,11 @@ abet:(take-mount:den q.hin) [mos ..^$] :: + ?: ?=([%foreign-warp *] tea) + ?> ?=(%writ +<.q.hin) + :_ ..^$ + [hen %give %memo /remove-me (bind `riot`p.q.hin rant-to-rand)]~ + :: ?: ?=({%foreign-request @ @ @ *} tea) =/ her (slav %p i.t.tea) =/ syd (slav %tas i.t.t.tea) @@ -4484,6 +4489,21 @@ `cage`(result-to-cage:ford build-result.result.q.hin) == == :: + ?: ?=([%warp-index @ @ @ ~] tea) + ?> ?=(%memo +<.q.hin) + ?> ?=([%remove-me ~] path.message.q.hin) + :: + =+ ;; res=(unit rand) payload.message.q.hin + :: + =/ her=ship (slav %p i.t.tea) + =/ =desk (slav %tas i.t.t.tea) + =/ index=@ud (slav %ud i.t.t.t.tea) + :: + =^ mos ruf + =/ den ((de our now ski hen ruf) her desk) + abet:(take-foreign-answer:den index res) + [mos ..^$] + :: ?- -.+.q.hin %init-clad ~|(%clad-not-real !!) @@ -4534,28 +4554,16 @@ :: (handle-task hen queued-task) :: - %writ - ?> ?=({@ @ *} tea) - ~| i=i.tea - ~| it=i.t.tea - =+ him=(slav %p i.t.tea) - :_ ..^$ - :~ :* hen %pass /writ-want %a - %want him [%c %answer t.t.tea] - (bind p.+.q.hin rant-to-rand) - == - == + :: handled in the wire dispatcher + :: + %memo !! + %writ !! :: - %send - [[[hen %give +.q.hin] ~] ..^$] - :: - %woot - ?~ q.q.hin + %done + ?~ error=error.q.hin [~ ..^$] - ~& [%clay-lost p.q.hin tea] - ?~ u.q.q.hin - [~ ..^$] - %- (slog >p.u.u.q.q.hin< q.u.u.q.q.hin) + ~& [%clay-lost u.error tea] + %- (slog >tag.u.error< tang.u.error) [~ ..^$] == :: diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 0b638a820..50d00b212 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -195,6 +195,7 @@ :: +vane-task: general tasks shared across vanes :: +$ vane-task + $~ [%born ~] $% :: i/o device replaced (reset state) :: [%born ~] @@ -215,7 +216,7 @@ [%wegh ~] :: receive message via %ames :: - [%memo p=ship q=path r=*] + [%memo =ship =message:ames] == :: :::: :::: ++http :: From 3a1a3e30cc75fdfc3fc5089de020998a79daf29a Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 28 Jun 2019 18:13:32 -0700 Subject: [PATCH 004/451] gall compiles --- pkg/arvo/sys/vane/gall.hoon | 200 ++++++++++-------------------------- pkg/arvo/sys/zuse.hoon | 1 - 2 files changed, 53 insertions(+), 148 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 57456d4ca..1393f5a85 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -11,7 +11,7 @@ ++ torc $@(?($iron $gold) {$lead p/ship}) :: security control ++ roon :: reverse ames msg $% {$d p/mark q/*} :: diff (diff) - {$x ~} :: + {$x ~} :: quit == :: ++ rook :: forward ames msg $% {$m p/mark q/*} :: message @@ -42,7 +42,6 @@ ++ gest :: subscriber data $: sup/bitt :: incoming subscribers neb/boat :: outgoing subscribers - qel/(map bone @ud) :: queue meter == :: ++ mast :: ship state $: mak/* :: (deprecated) @@ -211,16 +210,6 @@ ~/ %mo-away |= {him/ship caz/cush} :: ^+ +> - :: ~& [%mo-away him caz] - ?: ?=($pump -.q.caz) - :: - :: you'd think this would send an ack for the diff - :: that caused this pump. it would, but we already - :: sent it when we got the diff in ++mo-cyst. then - :: we'd have to save the network duct and connect it - :: to this returning pump. - :: - +> ?: ?=($peer-not -.q.caz) :: short circuit error (mo-give %unto %reap (some p.q.caz)) @@ -235,25 +224,20 @@ $peer [%s p.q.caz] == %+ mo-pass - [%sys %way -.q.caz ~] - `note-arvo`[%a %want him [%g %ge p.caz ~] [num roc]] - :: - ++ mo-baal :: error convert a - |= art/(unit ares) - ^- ares - ?~(art ~ ?~(u.art `[%blank ~] u.art)) + [%sys %way (scot %p him) p.caz -.q.caz ~] + `note-arvo`[%a %memo him [%g %ge p.caz ~] [num roc]] :: ++ mo-baba :: error convert b - |= ars/ares + |= error=(unit error:ames) ^- (unit tang) - ?~ ars ~ - `[[%leaf (trip p.u.ars)] q.u.ars] + ?~ error ~ + `[[%leaf (trip tag.u.error)] tang.u.error] :: ++ mo-awed :: foreign response - |= {him/ship why/?($peer $peel $poke $pull) art/(unit ares)} + |= {him/ship why/?($peer $peel $poke $pull) art/(unit error:ames)} ^+ +> :: ~& [%mo-awed him why art] - =+ tug=(mo-baba (mo-baal art)) + =+ tug=(mo-baba art) ?- why $peel (mo-give %unto %reap tug) $peer (mo-give %unto %reap tug) @@ -277,6 +261,7 @@ r (~(put by r.sad) p.sad hen) == == + :: TODO try to delete me :: ++ mo-ball :: outbone by index |= {him/ship num/@ud} @@ -325,28 +310,6 @@ (mo-give %unto %coup `message.build-result) :: (mo-give %unto %diff (result-to-cage:ford build-result)) - :: - $red :: diff ack - ?> ?=({@ @ @ ~} t.pax) - ?. ?=({$a $woot *} sih) - ~& [%red-went pax] - +>.$ - =+ :* him=(slav %p i.t.pax) - dap=i.t.t.pax - num=(slav %ud i.t.t.t.pax) - == - => .(pax `path`[%req t.pax]) - ?~ q.+>.sih - (mo-pass [%sys pax] %g %deal [him our] dap %pump ~) - :: should not happen (XX wat mean?) - :: - %- ?. ?=([~ ~ %mack *] q.+>.sih) - ~& [%diff-bad-ack q.+>.sih] - same - ~& [%diff-bad-ack %mack] - (slog (flop q.,.+>.q.+>.sih)) - =. +>.$ (mo-pass [%sys pax] %g %deal [him our] dap %pull ~) - (mo-pass [%sys pax] %a %want him [%g %gh dap ~] [num %x ~]) :: %rep :: reverse request ?> ?=({@ @ @ ~} t.pax) @@ -358,18 +321,18 @@ :: ?: ?=([%incomplete *] result.sih) :: "XX should crash" - (mo-give %mack `tang.result.sih) + %- (slog >%gall-sys-rep-incomplete< tang.result.sih) + +>.$ :: =/ build-result build-result.result.sih :: ?: ?=([%error *] build-result) :: "XX should crash" - (mo-give %mack `message.build-result) + %- (slog >%gall-sys-rep-error< message.build-result) + +>.$ :: - :: "XX pump should ack" - =. +>.$ (mo-give %mack ~) =* result-cage (result-to-cage:ford build-result) - (mo-give(hen (mo-ball him num)) %unto %diff result-cage) + (mo-give %unto %diff result-cage) :: $req :: inbound request ?> ?=({@ @ @ ~} t.pax) @@ -377,28 +340,28 @@ dap=i.t.t.pax num=(slav %ud i.t.t.t.pax) == + :: seems unreachable, probably delete + :: ?: ?=({$f $made *} sih) ?: ?=([%incomplete *] result.sih) :: "XX should crash" - (mo-give %mack `tang.result.sih) + (mo-give %done `[%gall-ford-incomplete tang.result.sih]) :: =/ build-result build-result.result.sih :: ?: ?=([%error *] build-result) :: "XX should crash" - (mo-give %mack `message.build-result) + (mo-give %done `[%gall-ford-error message.build-result]) =/ cay/cage (result-to-cage:ford build-result) (mo-pass [%sys pax] %g %deal [him our] i.t.t.pax %poke cay) - ?: ?=({$a $woot *} sih) +>.$ :: quit ack, boring + :: ?> ?=({$g $unto *} sih) =+ cuf=`cuft`+>.sih ?- -.cuf - $coup (mo-give %mack p.cuf) - $diff %+ mo-pass [%sys %red t.pax] - [%a %want him [%g %gh dap ~] [num %d p.p.cuf q.q.p.cuf]] - $quit %+ mo-pass [%sys pax] - [%a %want him [%g %gh dap ~] [num %x ~]] - $reap (mo-give %mack p.cuf) + %coup (mo-give %done ?~(p.cuf ~ `[%gall-coup u.p.cuf])) + %reap (mo-give %done ?~(p.cuf ~ `[%gall-reap u.p.cuf])) + %diff (mo-give %memo /remove-me num %d p.p.cuf q.q.p.cuf) + %quit (mo-give %memo /remove-me num %x ~) :: we send http-responses, we don't receive them. :: $http-response !! @@ -421,13 +384,18 @@ (mo-clip dap `prey`[%high ~ him] [%poke result-cage]) :: $way :: outbound request - ?> ?=({$a $woot *} sih) - ?> ?=({@ ~} t.pax) - %- mo-awed - :* `ship`p.+>.sih - ;;(?($peer $peel $poke $pull) i.t.pax) - +>+.sih - == + :: + ?> ?=([@ @ @ ~] t.pax) + =/ him (slav %p i.t.pax) + =/ dap i.t.t.pax + =/ cub ;;(?($peer $peel $poke $pull) i.t.t.t.pax) + :: + ?: ?=([%a %done *] sih) + (mo-awed him cub error.sih) + :: + ?> ?=([%a %memo *] sih) + =+ mes=;;([@ud roon] payload.message.sih) + (mo-gawd:(mo-abed:mo hen) him dap mes) == :: ++ mo-cook :: take in /use @@ -510,7 +478,7 @@ :: ++ mo-gawk :: ames forward |= {him/@p dap/dude num/@ud rok/rook} - =. +> ?.(?=($u -.rok) +> (mo-give %mack ~)) + =. +> ?.(?=($u -.rok) +> (mo-give %done ~)) %+ mo-pass [%sys %req (scot %p him) dap (scot %ud num) ~] ^- note-arvo @@ -525,13 +493,11 @@ ++ mo-gawd :: ames backward |= {him/@p dap/dude num/@ud ron/roon} ?- -.ron + $x (mo-give %unto %quit ~) $d %+ mo-pass [%sys %rep (scot %p him) dap (scot %ud num) ~] [%f %build live=%.n [%vale [p q]:(mo-beak dap) p.ron q.ron]] - :: - $x =. +> (mo-give %mack ~) :: XX should crash - (mo-give(hen (mo-ball him num)) %unto %quit ~) == :: ++ ap :: agent engine @@ -569,29 +535,11 @@ :: ++ ap-abet :: resolve ^+ +> - => ap-abut %_ +> bum.mas (~(put by bum.mas) dap +<+) moz :(weld (turn zip ap-aver) (turn dub ap-avid) moz) == :: - ++ ap-abut :: track queue - ^+ . - =+ [pyz=zip ful=*(set bone)] - |- ^+ +> - ?^ pyz - ?. ?=({$give $diff *} q.i.pyz) - $(pyz t.pyz) - =^ vad +> ap-fill(ost p.i.pyz) - $(pyz t.pyz, ful ?:(vad ful (~(put in ful) p.i.pyz))) - =+ ded=~(tap in ful) - |- ^+ +>.^$ - ?~ ded +>.^$ - => %*(. $(ded t.ded) ost i.ded) - =+ tib=(~(get by sup.ged) ost) - ?~ tib ~&([%ap-abut-bad-bone dap ost] ..ap-kill) - ap-kill(q.q.pry p.u.tib) - :: ++ ap-aver :: cove to move ~/ %ap-aver |= cov/cove @@ -677,7 +625,6 @@ $punk !! $peer-not !! $pull ap-pull - $pump ap-fall == :: ++ ap-diff :: pour a diff @@ -686,7 +633,7 @@ :: =. q.cag (sped q.cag) =^ cug +>.$ (ap-find [%diff p.cag +.pax]) ?~ cug - %. [| her +.pax] + %. [her +.pax] ap-pump:(ap-lame %diff (ap-suck "diff: no {<`path`[p.cag +.pax]>}")) =+ ^= arg ^- vase %- slop @@ -694,9 +641,9 @@ [!>(`path`+.pax) (ap-cage cag)] [!>((slag (dec p.u.cug) `path`+.pax)) q.cag] =^ cam +>.$ (ap-call q.u.cug arg) - ?^ cam - (ap-pump:(ap-lame q.u.cug u.cam) | her pax) - (ap-pump & her pax) + ?~ cam + +>.$ + (ap-pump:(ap-lame q.u.cug u.cam) her pax) :: ++ ap-cage :: cage to tagged vase |= cag/cage @@ -705,25 +652,10 @@ :: ++ ap-pump :: update subscription ~/ %ap-pump - |= {oak/? her/ship pax/path} + |= [her/ship pax/path] =+ way=[(scot %p her) %out pax] - ?: oak - (ap-pass way %send her -.pax %pump ~) (ap-pass:(ap-give %quit ~) way %send her -.pax %pull ~) :: - ++ ap-fall :: drop from queue - ^+ . - ?. (~(has by sup.ged) ost) . - =+ soy=(~(get by qel.ged) ost) - ?: |(?=(~ soy) =(0 u.soy)) - :: ~& [%ap-fill-under [our dap] q.q.pry ost] - + - =. u.soy (dec u.soy) - :: ~& [%ap-fill-sub [[our dap] q.q.pry ost] u.soy] - ?: =(0 u.soy) - +(qel.ged (~(del by qel.ged) ost)) - +(qel.ged (~(put by qel.ged) ost u.soy)) - :: ++ ap-farm :: produce arm ~/ %ap-farm |= cog/term @@ -739,25 +671,6 @@ $2 [%| p.ton] == :: - ++ ap-fill :: add to queue - ^- {? _.} - =+ suy=(fall (~(get by qel.ged) ost) 0) - =/ subscriber=(unit (pair ship path)) - (~(get by sup.ged) ost) - ?: ?& =(20 suy) - ?| ?=(~ subscriber) - !=(our p.u.subscriber) - == - == - ~& [%gall-pulling-20 ost (~(get by sup.ged) ost) (~(get by r.zam) ost)] - [%| ..ap-fill] - :: ~& :* %gall-pushing-20 - :: ost - :: suy=suy - :: (~(get by r.zam) ost) - :: == - [%& ..ap-fill(qel.ged (~(put by qel.ged) ost +(suy)))] - :: ++ ap-find :: general arm ~/ %ap-find |= {cog/term pax/path} @@ -1199,15 +1112,12 @@ ?~ wim + %_ + sup.ged (~(del by sup.ged) ost) - qel.ged (~(del by qel.ged) ost) == :: ++ ap-pull :: load delete =+ wim=(~(get by sup.ged) ost) ?~ wim + :: ~&(%ap-pull-none +) - =: sup.ged (~(del by sup.ged) ost) - qel.ged (~(del by qel.ged) ost) - == + =. sup.ged (~(del by sup.ged) ost) =^ cug ..ap-pull (ap-find %pull q.u.wim) ?~ cug +> =^ cam +> @@ -1373,21 +1283,17 @@ $init [~ ..^$(sys.mast.all hen)] :: - $sunk [~ ..^$] - :: - $vega [~ ..^$] - :: - $west - ?> ?=({?($ge $gh) @ ~} q.q.hic) - =* dap i.t.q.q.hic - =* him p.q.hic - ?: ?=($ge i.q.q.hic) - =+ mes=;;({@ud rook} r.q.hic) - =< mo-abet - (mo-gawk:(mo-abed:mo hen) him dap mes) - =+ mes=;;({@ud roon} r.q.hic) + %memo + ?> ?=([%ge @ ~] path.message.q.hic) + =/ him=ship ship.q.hic + =* dap i.t.path.message.q.hic + :: + =+ mes=;;([@ud rook] payload.message.q.hic) =< mo-abet - (mo-gawd:(mo-abed:mo hen) him dap mes) + (mo-gawk:(mo-abed:mo hen) him dap mes) + :: + $sunk [~ ..^$] + $vega [~ ..^$] :: $wegh =/ =mass diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 50d00b212..f42bc2c72 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -1677,7 +1677,6 @@ {$puff p/mark q/noun} :: unchecked poke {$pull ~} :: unsubscribe {$punk p/mark q/cage} :: translated poke - {$pump ~} :: pump yes+no {$peer-not p/tang} :: poison pill peer == :: ++ cuft :: internal gift From ed4d477ba0369303f0648e35a8d2bdffec33e9ed Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 9 Jul 2019 17:48:07 -0700 Subject: [PATCH 005/451] Initial vere test passes on ames lane codec --- pkg/urbit/Makefile | 11 ++++++--- pkg/urbit/include/vere/vere.h | 16 +++++++++++++ pkg/urbit/tests/ames_tests.c | 42 +++++++++++++++++++++++++++++++++++ pkg/urbit/vere/ames.c | 22 +++++++++++++++++- 4 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 pkg/urbit/tests/ames_tests.c diff --git a/pkg/urbit/Makefile b/pkg/urbit/Makefile index 985f05a1b..ab9bec709 100644 --- a/pkg/urbit/Makefile +++ b/pkg/urbit/Makefile @@ -15,7 +15,7 @@ worker_objs = $(shell echo $(worker) | sed 's/\.c/.o/g') all_objs = $(common_objs) $(daemon_objs) $(worker_objs) all_srcs = $(common) $(daemon) $(worker) -all_exes = ./mug_tests jam_tests ./hashtable_tests ./urbit ./urbit-worker +all_exes = ./ames_tests ./mug_tests jam_tests ./hashtable_tests ./urbit ./urbit-worker # -Werror promotes all warnings that are enabled into errors (this is on) @@ -29,9 +29,10 @@ CFLAGS := $(CFLAGS) ################################################################################ -all: urbit urbit-worker hashtable_tests jam_tests mug_tests +all: urbit urbit-worker ames_tests hashtable_tests jam_tests mug_tests -test: hashtable_tests jam_tests mug_tests +test: ames_tests hashtable_tests jam_tests mug_tests + ./ames_tests ./hashtable_tests ./jam_tests ./mug_tests @@ -44,6 +45,10 @@ mrproper: clean ################################################################################ +ames_tests: $(common_objs) tests/ames_tests.o + @echo CC -o $@ + @$(CC) $^ $(LDFLAGS) -o $@ + hashtable_tests: $(common_objs) tests/hashtable_tests.o @echo CC -o $@ @$(CC) $^ $(LDFLAGS) -o $@ diff --git a/pkg/urbit/include/vere/vere.h b/pkg/urbit/include/vere/vere.h index 708adf3cb..6b8042880 100644 --- a/pkg/urbit/include/vere/vere.h +++ b/pkg/urbit/include/vere/vere.h @@ -248,6 +248,13 @@ c3_c* dns_c; // galaxy fqdn (optional) } u3_pact; + /* u3_lane: ames lane (IP address and port) + */ + typedef struct _u3_lane { + c3_w pip_w; // target IPv4 address + c3_s por_s; // target port + } u3_lane; + /* u3_poke: poke callback function. */ typedef void (*u3_poke)(void*, u3_noun); @@ -983,6 +990,15 @@ void u3_ames_io_exit(u3_pier* pir_u); + /* u3_ames_decode_lane(): destructure lane from noun + */ + u3_lane + u3_ames_decode_lane(u3_noun); + + /* u3_ames_encode_lane(): encode lane as noun + */ + u3_noun + u3_ames_encode_lane(u3_lane); /** Autosave. **/ diff --git a/pkg/urbit/tests/ames_tests.c b/pkg/urbit/tests/ames_tests.c new file mode 100644 index 000000000..582bec4d1 --- /dev/null +++ b/pkg/urbit/tests/ames_tests.c @@ -0,0 +1,42 @@ +#include "all.h" +#include "vere/vere.h" + +/* _setup(): prepare for tests. +*/ +static void +_setup(void) +{ + u3m_init(); + u3m_pave(c3y, c3n); +} + +/* _test_ames(): spot check ames helpers +*/ +static void +_test_ames(void) +{ + u3_lane lan_u; + lan_u.pip_w = 0x7f000001; + lan_u.por_s = 12345; + + u3_lane nal_u = u3_ames_decode_lane(u3_ames_encode_lane(lan_u)); + + if ( !(lan_u.pip_w == nal_u.pip_w && lan_u.por_s == nal_u.por_s) ) { + fprintf(stderr, "ames: lane fail (a)\r\n"); + fprintf(stderr, "pip: %d, por: %d\r\n", nal_u.pip_w, nal_u.por_s); + exit(1); + } +} + +/* main(): run all test cases. +*/ +int +main(int argc, char* argv[]) +{ + _setup(); + + _test_ames(); + + fprintf(stderr, "ames ok"); + return 0; +} diff --git a/pkg/urbit/vere/ames.c b/pkg/urbit/vere/ames.c index a7c2540be..baac2acdb 100644 --- a/pkg/urbit/vere/ames.c +++ b/pkg/urbit/vere/ames.c @@ -185,6 +185,26 @@ _ames_czar_cb(uv_getaddrinfo_t* adr_u, uv_freeaddrinfo(aif_u); } +u3_lane +u3_ames_decode_lane(u3_noun lan) { + u3_noun cud, pip, por; + + cud = u3ke_cue(lan); + u3x_cell(cud, &pip, &por); + + u3_lane lan_u; + lan_u.pip_w = u3r_word(0, pip); + lan_u.por_s = por; + + u3z(pip); u3z(por); + return lan_u; +} + +u3_noun +u3_ames_encode_lane(u3_lane lan) { + return u3ke_jam(u3nc(u3i_words(1, &lan.pip_w), lan.por_s)); +} + /* _ames_czar(): galaxy address resolution. */ @@ -259,7 +279,7 @@ _ames_czar(u3_pact* pac_u, c3_c* bos_c) } } -/* _ames_lane_ipv4(): IPv4 address/ from lane. +/* _ames_lane_ipv4(): IPv4 address from noun. */ u3_noun _ames_lane_ip(u3_noun lan, c3_s* por_s, c3_w* pip_w) From f104f4115b1f79eb6f01b59c3a1064ac7760425d Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 10 Jul 2019 17:05:05 -0700 Subject: [PATCH 006/451] add %ipv4 tag to vere lane --- pkg/urbit/vere/ames.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pkg/urbit/vere/ames.c b/pkg/urbit/vere/ames.c index baac2acdb..0563da636 100644 --- a/pkg/urbit/vere/ames.c +++ b/pkg/urbit/vere/ames.c @@ -185,12 +185,15 @@ _ames_czar_cb(uv_getaddrinfo_t* adr_u, uv_freeaddrinfo(aif_u); } +/* u3_ames_decode_lane(): deserialize noun to lane +*/ u3_lane -u3_ames_decode_lane(u3_noun lan) { - u3_noun cud, pip, por; +u3_ames_decode_lane(u3_atom lan) { + u3_noun cud, tag, pip, por; cud = u3ke_cue(lan); - u3x_cell(cud, &pip, &por); + u3x_trel(cud, &tag, &pip, &por); + c3_assert( c3__ipv4 == tag ); u3_lane lan_u; lan_u.pip_w = u3r_word(0, pip); @@ -200,12 +203,13 @@ u3_ames_decode_lane(u3_noun lan) { return lan_u; } -u3_noun +/* u3_ames_encode_lane(): serialize lane to jammed noun +*/ +u3_atom u3_ames_encode_lane(u3_lane lan) { - return u3ke_jam(u3nc(u3i_words(1, &lan.pip_w), lan.por_s)); + return u3ke_jam(u3nt(c3__ipv4, u3i_words(1, &lan.pip_w), lan.por_s)); } - /* _ames_czar(): galaxy address resolution. */ static void From 6e3b4534a5076fa05f6510193d38ad5d617c0ba4 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 11 Jul 2019 11:44:00 -0700 Subject: [PATCH 007/451] rewrote u3_ames_ef_send() to use new lanes --- pkg/urbit/tests/ames_tests.c | 2 +- pkg/urbit/vere/ames.c | 88 ++++++++++++++---------------------- 2 files changed, 34 insertions(+), 56 deletions(-) diff --git a/pkg/urbit/tests/ames_tests.c b/pkg/urbit/tests/ames_tests.c index 582bec4d1..a8cdafc66 100644 --- a/pkg/urbit/tests/ames_tests.c +++ b/pkg/urbit/tests/ames_tests.c @@ -37,6 +37,6 @@ main(int argc, char* argv[]) _test_ames(); - fprintf(stderr, "ames ok"); + fprintf(stderr, "ames okeedokee"); return 0; } diff --git a/pkg/urbit/vere/ames.c b/pkg/urbit/vere/ames.c index 0563da636..d284a58d6 100644 --- a/pkg/urbit/vere/ames.c +++ b/pkg/urbit/vere/ames.c @@ -283,34 +283,6 @@ _ames_czar(u3_pact* pac_u, c3_c* bos_c) } } -/* _ames_lane_ipv4(): IPv4 address from noun. -*/ -u3_noun -_ames_lane_ip(u3_noun lan, c3_s* por_s, c3_w* pip_w) -{ - switch ( u3h(lan) ) { - case c3__if: { - *por_s= (c3_s) u3h(u3t(u3t(lan))); - *pip_w = u3r_word(0, u3t(u3t(u3t(lan)))); - - return c3y; - } break; - case c3__is: { - u3_noun pq_lan = u3h(u3t(u3t(lan))); - - if ( u3_nul == pq_lan ) return c3n; - else return _ames_lane_ip(u3t(pq_lan), por_s, pip_w); - } break; - case c3__ix: { - *por_s = (c3_s) u3h(u3t(u3t(lan))); - *pip_w = u3r_word(0, u3t(u3t(u3t(lan)))); - - return c3y; - } break; - } - return c3n; -} - /* u3_ames_ef_bake(): notify %ames that we're live. */ void @@ -326,44 +298,50 @@ u3_ames_ef_bake(u3_pier* pir_u) void u3_ames_ef_send(u3_pier* pir_u, u3_noun lan, u3_noun pac) { - u3_ames* sam_u = pir_u->sam_u; - if ( u3_Host.ops_u.fuz_w && ((rand() % 100) < u3_Host.ops_u.fuz_w) ) { u3z(lan); u3z(pac); return; } + u3_ames* sam_u = pir_u->sam_u; u3_pact* pac_u = c3_calloc(sizeof(*pac_u)); + pac_u->len_w = u3r_met(3, pac); + pac_u->hun_y = c3_malloc(pac_u->len_w); - if ( c3y == _ames_lane_ip(lan, &pac_u->por_s, &pac_u->pip_w) ) { - pac_u->len_w = u3r_met(3, pac); - pac_u->hun_y = c3_malloc(pac_u->len_w); + u3_noun tag, val; + u3x_cell(lan, &tag, &val); + c3_assert( (c3y == tag) || (c3n == tag) ); - u3r_bytes(0, pac_u->len_w, pac_u->hun_y, pac); - - if ( 0 == pac_u->pip_w ) { - pac_u->pip_w = 0x7f000001; - pac_u->por_s = pir_u->por_s; - } - - if ( (0 == (pac_u->pip_w >> 16)) && (1 == (pac_u->pip_w >> 8)) ) { - pac_u->imp_y = (pac_u->pip_w & 0xff); - - _ames_czar(pac_u, sam_u->dns_c); - } - else if ( (c3y == u3_Host.ops_u.net) || (0x7f000001 == pac_u->pip_w) ) { - _ames_send(pac_u); - } - else { - // networking disabled + // galaxy lane; do DNS lookup and send packet + // + if ( c3y == tag ) { + c3_assert( c3y == u3a_is_cat(val) ); + c3_assert( val < 256 ); + + _ames_czar(pac_u, sam_u->dns_c); + } + // non-galaxy lane + // + else { + u3_lane lan_u = u3_ames_decode_lane(lan); + // convert incoming localhost to outgoing localhost + // + lan_u.pip_w = ( 0 == lan_u.pip_w )? 0x7f000001 : lan_u.pip_w; + // if in local-only mode, don't send remote packets + // + if ( (c3n == u3_Host.ops_u.net) && (0x7f000001 != lan_u.pip_w) ) { _ames_pact_free(pac_u); } - } - else { - _ames_pact_free(pac_u); - } + // otherwise, mutate destination and send packet + // + else { + pac_u->pip_w = lan_u.pip_w; + pac_u->por_s = lan_u.por_s; - u3z(lan); u3z(pac); + _ames_send(pac_u); + } + } + u3z(tag); u3z(val); } /* _ames_recv_cb(): receive callback. From e6e2b6d197172994a96caeccb2f32e529233bef8 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 11 Jul 2019 11:47:02 -0700 Subject: [PATCH 008/451] fix _ames_recv_cb() to use new lanes --- pkg/urbit/vere/ames.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkg/urbit/vere/ames.c b/pkg/urbit/vere/ames.c index d284a58d6..1dd1022cd 100644 --- a/pkg/urbit/vere/ames.c +++ b/pkg/urbit/vere/ames.c @@ -366,15 +366,16 @@ _ames_recv_cb(uv_udp_t* wax_u, #if 0 u3z(msg); #else + u3_lane lan_u; struct sockaddr_in* add_u = (struct sockaddr_in *)adr_u; - c3_s por_s = ntohs(add_u->sin_port); - c3_w pip_w = ntohl(add_u->sin_addr.s_addr); + + lan_u.por_s = ntohs(add_u->sin_port); + lan_u.pip_w = ntohl(add_u->sin_addr.s_addr); + u3_noun lan = u3_ames_encode_lane(lan_u); u3_pier_plan (u3nt(u3_blip, c3__ames, u3_nul), - u3nt(c3__hear, - u3nq(c3__if, u3k(u3A->now), por_s, u3i_words(1, &pip_w)), - msg)); + u3nt(c3__hear, lan, msg)); #endif } _ames_free(buf_u->base); From 08fdb67063a7a815068b78cc2124403d199939c0 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 11 Jul 2019 14:38:47 -0700 Subject: [PATCH 009/451] begin kale integration; won't compile --- pkg/arvo/sys/vane/kale.hoon | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/sys/vane/kale.hoon b/pkg/arvo/sys/vane/kale.hoon index 17712eb4c..7a36a0245 100644 --- a/pkg/arvo/sys/vane/kale.hoon +++ b/pkg/arvo/sys/vane/kale.hoon @@ -78,9 +78,9 @@ [p=duct q=card] :: :: :: +$ note :: out request $-> - $~ [%a %want *ship *path **] :: + $~ [%a %memo *ship *message:ames] :: $% $: %a :: to %ames - $>(%want task:able:ames) :: send message + $>(%memo task:able:ames) :: send message == :: $: %k :: to self $>(%look task) :: set ethereum source @@ -90,8 +90,9 @@ == == == :: :: :: +$ sign :: in result $<- - $~ [%a %woot *ship ~] :: - $% [%a $>(%woot gift:able:ames)] :: message result + $~ [%a %done ~] :: + $% [%a $>(%memo gift:able:ames)] :: message result + [%a $>(%done gift:able:ames)] :: message ack == :: -- :: :: :::: From 38bbabf1b0a6c946b6f5a4d2f0ef65c6b6fa4519 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 12 Jul 2019 11:19:09 -0700 Subject: [PATCH 010/451] WIP kale integration; doesn't quite work --- pkg/arvo/sys/vane/kale.hoon | 60 ++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 34 deletions(-) diff --git a/pkg/arvo/sys/vane/kale.hoon b/pkg/arvo/sys/vane/kale.hoon index 7a36a0245..abf90fa12 100644 --- a/pkg/arvo/sys/vane/kale.hoon +++ b/pkg/arvo/sys/vane/kale.hoon @@ -69,7 +69,9 @@ +$ message :: message to her kale $% [%nuke whos=(set ship)] :: cancel trackers [%public-keys whos=(set ship)] :: view ethereum events - [%public-keys-result who=ship =vent-result] :: tmp workaround + == :: ++$ message-response :: kale ames response + $% [%public-keys-result =vent-result] :: tmp workaround == :: +$ card :: i/o action (wind note gift) :: @@ -92,7 +94,7 @@ +$ sign :: in result $<- $~ [%a %done ~] :: $% [%a $>(%memo gift:able:ames)] :: message result - [%a $>(%done gift:able:ames)] :: message ack + [%a $>(%done gift:able:ames)] :: message (n)ack == :: -- :: :: :::: @@ -435,33 +437,26 @@ == :: :: authenticated remote request - :: {$west p/ship q/path r/*} + :: [%memo =ship =message:ames] :: - $west - =* her p.tac - =/ mes (message r.tac) + %memo + =* her ship.tac + =/ mes (message message.tac) ?- -.mes :: :: cancel trackers :: [%nuke whos=(set ship)] :: %nuke - =. moz [[hen %give %mack ~] moz] + =. moz [[hen %give %done ~] moz] $(tac mes) :: :: view ethereum events :: [%public-keys whos=(set ship)] :: %public-keys - =. moz [[hen %give %mack ~] moz] + =. moz [[hen %give %done ~] moz] $(tac mes) - :: - :: receive keys result - :: [%public-keys-result =vent-result] - :: - %public-keys-result - =. moz [[hen %give %mack ~] moz] - $(tac [%vent-update vent-result.mes]) == :: :: rewind to snapshot @@ -476,14 +471,18 @@ ^+ +> ?> ?=([@ *] tea) =* wir t.tea - ?- hin - [%a %woot *] - ?~ q.hin +>.$ - ?~ u.q.hin ~&(%ares-fine +>.$) - ~& [%woot-bad p.u.u.q.hin] - ~_ q.u.u.q.hin + ?- hin + [%a %done *] + ?~ error.hin +>.$ + ~& [%kale-ames-nack u.error.hin] + ~_ tang.u.error.hin ::TODO fail:et +>.$ + :: + [%a %memo *] + =. moz [[hen %give %done ~] moz] + =+ ;; =message-response message.hin + (call hen %vent-update vent-result.message) == :: :: ++curd:of ++ curd :: relative moves @@ -563,19 +562,12 @@ |- ^+ this-su ?~ yez this-su =* d i.yez - ?. ?=([[%a @ @ *] *] d) - %- emit - [d %give %public-keys vent-result] - =/ our (slav %p i.t.i.d) - =/ who (slav %p i.t.t.i.d) - =/ =message [%public-keys-result who vent-result] =. this-su - %- emit - :^ d - %pass - /public-keys-result - ^- note - [%a %want who /k/public-keys-result message] + :: TODO: stop looking at the duct + :: + ?. ?=([[%a *] *] d) + (emit d %give %public-keys vent-result) + (emit d %give %memo /k/remove-me %public-keys-result vent-result) $(yez t.yez) :: ++ get-source @@ -746,7 +738,7 @@ ?: ?=(%& -.source) =/ send-message |= =message - [hen %pass /public-keys %a %want p.source /k/public-keys message] + [hen %pass /public-keys %a %memo p.source /k/public-keys message] =. ..feel (emit (send-message %nuke whos)) (emit (send-message %public-keys whos)) From 56598ee8569da4c7b11a14284809ec58e32fde90 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 15 Jul 2019 13:17:27 -0700 Subject: [PATCH 011/451] zuse, alef, and kale compile --- pkg/arvo/sys/vane/kale.hoon | 10 ++++------ pkg/arvo/sys/zuse.hoon | 3 ++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pkg/arvo/sys/vane/kale.hoon b/pkg/arvo/sys/vane/kale.hoon index abf90fa12..aba6f485f 100644 --- a/pkg/arvo/sys/vane/kale.hoon +++ b/pkg/arvo/sys/vane/kale.hoon @@ -482,7 +482,7 @@ [%a %memo *] =. moz [[hen %give %done ~] moz] =+ ;; =message-response message.hin - (call hen %vent-update vent-result.message) + (call hen %vent-update vent-result.message-response) == :: :: ++curd:of ++ curd :: relative moves @@ -897,8 +897,7 @@ =/ cub (nol:nu:crub:crypto sec) =/ sig (sign:as:cub (shaf %self (sham [u.who 1 pub:ex:cub]))) :^ ~ ~ %noun - !> ^- deed:ames - [1 pub:ex:cub `sig] + !> [1 pub:ex:cub `sig] :: ?: ?=(%earl rac) ?. =(u.who p.why) @@ -910,8 +909,7 @@ =/ sec (~(got by jaw.own.pki.lex) u.lyf) =/ cub (nol:nu:crub:crypto sec) :^ ~ ~ %noun - !> ^- deed:ames - [u.lyf pub:ex:cub sig.own.pki.lex] + !> [u.lyf pub:ex:cub sig.own.pki.lex] :: =/ pub (~(get by pos.zim.pki.lex) u.who) ?~ pub @@ -922,7 +920,7 @@ ?~ pas ~ :^ ~ ~ %noun - !> `deed:ames`[u.lyf pass.u.pas ~] + !> [u.lyf pass.u.pas ~] :: %earl ?. ?=([@ @ @ ~] tyl) [~ ~] diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 1acddfe46..92d76e1d6 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -2078,7 +2078,7 @@ [%vest ~] :: view public balance [%vine ~] :: view secret history $>(%wegh vane-task) :: memory usage request - $>(%west vane-task) :: remote request + $>(%memo vane-task) :: remote request [%wind p=@ud] :: rewind before block == :: -- :: @@ -2331,6 +2331,7 @@ ++ oath @ :: signature -- :: pki -- :: kale +-- :: :: :: :::: :: :: (2) engines :: :: :: From 793fc5c213c13e1c7eefb6f8edb7786edcb68965 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 15 Jul 2019 14:23:34 -0700 Subject: [PATCH 012/451] all vanes compile, at least individually --- bin/solid.pill | 4 +-- pkg/arvo/lib/pill.hoon | 8 +++--- pkg/arvo/sys/arvo.hoon | 13 +++------- pkg/arvo/sys/vane/clay.hoon | 4 +-- pkg/arvo/sys/vane/dill.hoon | 49 ++++++++++++++----------------------- pkg/arvo/sys/vane/gall.hoon | 8 +++--- pkg/arvo/sys/zuse.hoon | 2 +- 7 files changed, 36 insertions(+), 52 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 6098adcab..948f0a320 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:980cc9a756e49e6ba600ebfef91d09735eae1239da265cbc78fb6f783eab0f4c -size 8481672 +oid sha256:b7135ab911304fd1d884d2ee7d6c4c1b84f576dbe320abf4ec2672997074445a +size 6105223 diff --git a/pkg/arvo/lib/pill.hoon b/pkg/arvo/lib/pill.hoon index f7018bd66..38d2f5ef1 100644 --- a/pkg/arvo/lib/pill.hoon +++ b/pkg/arvo/lib/pill.hoon @@ -14,9 +14,9 @@ :~ :: sys/zuse: standard library :: [%$ /zuse] - :: sys/vane/ames: network + :: sys/vane/alef: network :: - [%a /vane/ames] + [%a /vane/alef] :: sys/vane/behn: timer :: [%b /vane/behn] @@ -38,9 +38,9 @@ :: sys/vane/iris: http client :: [%i /vane/iris] - :: sys/vane/jael: security + :: sys/vane/kale: security :: - [%j /vane/jael] + [%k /vane/kale] == |= [=term =path] =/ pax (weld sys path) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index 7f8e241d9..340f472db 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -241,14 +241,10 @@ ++ slur-e ~/(%slur-e |=({gat/vase hil/mill} =+(%e (slur gat hil)))) ++ slur-f ~/(%slur-f |=({gat/vase hil/mill} =+(%f (slur gat hil)))) ++ slur-g ~/(%slur-g |=({gat/vase hil/mill} =+(%g (slur gat hil)))) + ++ slur-i ~/(%slur-i |=({gat/vase hil/mill} =+(%i (slur gat hil)))) ++ slur-j ~/(%slur-j |=({gat/vase hil/mill} =+(%j (slur gat hil)))) + ++ slur-k ~/(%slur-k |=({gat/vase hil/mill} =+(%k (slur gat hil)))) ++ slur-z ~/(%slur-z |=({gat/vase hil/mill} =+(%z (slur gat hil)))) - ++ slur-r - ~/ %slur-r - |=({gat/vase hil/mill} =+(%r (slur gat hil))) - ++ slur-l - ~/ %slur-l - |=({gat/vase hil/mill} =+(%l (slur gat hil))) :: ++ slur-pro :: profiling slur ~/ %slur-pro @@ -261,10 +257,9 @@ $e (slur-e gat hil) $f (slur-f gat hil) $g (slur-g gat hil) + $i (slur-i gat hil) $j (slur-j gat hil) - :: - %l (slur-l gat hil) - %r (slur-r gat hil) + $k (slur-k gat hil) == :: ++ song :: reduce metacard diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 547c36bd0..5b45a7872 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2670,7 +2670,7 @@ %- (sloy-light ski) =/ pur=spur /(scot %p who) - [[151 %noun] %j our %rift da+now pur] + [[151 %noun] %k our %rift da+now pur] :: :: Handle `%sing` requests :: @@ -4623,5 +4623,5 @@ %- (sloy-light ski) =/ pur=spur /(scot %p who) - [[151 %noun] %j our %rift da+now pur] + [[151 %noun] %k our %rift da+now pur] -- diff --git a/pkg/arvo/sys/vane/dill.hoon b/pkg/arvo/sys/vane/dill.hoon index 80472e7cd..efc578ce7 100644 --- a/pkg/arvo/sys/vane/dill.hoon +++ b/pkg/arvo/sys/vane/dill.hoon @@ -20,7 +20,7 @@ f/(unit mass) :: g/(unit mass) :: i/(unit mass) :: - j/(unit mass) :: + k/(unit mass) :: == :: == :: ++ axon :: dill per duct @@ -79,15 +79,15 @@ $: %i :: $>(%wegh task:able:iris) :: == :: - $: %j :: + $: %k :: $> $? %dawn :: %fake :: %wegh :: == :: - task:able:jael :: + task:able:kale :: == == :: ++ sign :: in result $<- - $~ [%j %init *@p] :: + $~ [%k %init *@p] :: $% $: %a :: $% [%nice ~] :: XX obsolete $> $? %mass :: @@ -100,8 +100,7 @@ $>(%writ gift:able:clay) :: XX %slip == == :: $: %c :: - $> $? %mack :: XX strange - %mass :: + $> $? %mass :: %mere :: %note :: %writ :: @@ -127,11 +126,11 @@ $: %i :: $>(%mass gift:able:iris) :: == :: - $: %j :: + $: %k :: $> $? %init :: %mass :: == :: - gift:able:jael :: + gift:able:kale :: == == :: :::::::: :: dill tiles -- @@ -283,7 +282,7 @@ [hen %pass /heft/ford %f %wegh ~] [hen %pass /heft/gall %g %wegh ~] [hen %pass /heft/iris %i %wegh ~] - [hen %pass /heft/jael %j %wegh ~] + [hen %pass /heft/jael %k %wegh ~] moz == == @@ -294,7 +293,7 @@ ;; ship %- need %- need %- (sloy-light ski) - [[151 %noun] %j our %sein da+now /(scot %p who)] + [[151 %noun] %k our %sein da+now /(scot %p who)] :: ++ init :: initialize ~& [%dill-init our ram] @@ -375,24 +374,18 @@ == == :: - ++ pump :: send diff ack - %_ . - moz - :_(moz [hen %pass ~ %g %deal [our our] ram %pump ~]) - == - :: ++ take :: receive |= sih/sign ^+ +> ?- sih - {?($a $b $c $e $f $g $i $j) $mass *} + {?($a $b $c $e $f $g $i $k) $mass *} (wegh -.sih p.sih) :: {$a $nice *} :: ~& [%take-nice-ames sih] +> :: - [%j %init *] + [%k %init *] :: pass thru to unix :: +>(moz :_(moz [hen %give +.sih])) @@ -415,7 +408,7 @@ $reap ?~ p.p.+>.sih +>.$ (dump:(crud %reap u.p.p.+>.sih) %logo ~) - $diff pump:(from ;;(dill-blit q:`vase`+>+>.sih)) + $diff (from ;;(dill-blit q:`vase`+>+>.sih)) $http-response !! == :: @@ -429,10 +422,6 @@ ?: ?=(%& -.p.sih) mere (mean >%dill-mere-fail< >p.p.p.sih< q.p.p.sih) - :: - {$c $mack *} - ?~ p.sih +>.$ - (mean >%dill-clay-nack< u.p.sih) :: {$d $blit *} (done +.sih) @@ -440,7 +429,7 @@ :: +wegh: receive a memory report from a vane and maybe emit full report :: ++ wegh - |= [lal=?(%a %b %c %e %f %g %i %j) mas=mass] + |= [lal=?(%a %b %c %e %f %g %i %k) mas=mass] ^+ +> :: update our listing of vane responses with this new one :: @@ -453,7 +442,7 @@ %f ~?(?=(^ f.hef.all) %double-mass-f hef.all(f `mas)) %g ~?(?=(^ g.hef.all) %double-mass-g hef.all(g `mas)) %i ~?(?=(^ i.hef.all) %double-mass-i hef.all(i `mas)) - %j ~?(?=(^ j.hef.all) %double-mass-j hef.all(j `mas)) + %k ~?(?=(^ k.hef.all) %double-mass-k hef.all(k `mas)) == :: if not all vanes have responded yet, no-op :: @@ -464,7 +453,7 @@ ?=(^ f.hef.all) ?=(^ g.hef.all) ?=(^ i.hef.all) - ?=(^ j.hef.all) + ?=(^ k.hef.all) == +>.$ :: clear vane reports from our state before weighing ourself @@ -472,7 +461,7 @@ :: Otherwise, the state of vanes printed after this one get absorbed :: into Dill's %dot catchall report. :: - =/ ven=(list mass) ~[u.a u.b u.c u.e u.f u.g u.i u.j]:hef.all + =/ ven=(list mass) ~[u.a u.b u.c u.e u.f u.g u.i u.k]:hef.all => .(hef.all [~ ~ ~ ~ ~ ~ ~ ~]) :: wegh ourself now that our state doesn't include other masses :: @@ -512,10 +501,10 @@ ?> =(~ hey.all) =. hey.all `hen =/ boot - ((soft $>($?(%dawn %fake) task:able:jael)) p.task) + ((soft $>($?(%dawn %fake) task:able:kale)) p.task) ?~ boot ~| invalid-boot-event+hen !! - :_(..^$ [hen %pass / %j u.boot]~) + :_(..^$ [hen %pass / %k u.boot]~) :: we are subsequently initialized. single-home :: ?: ?=(%init -.task) @@ -539,7 +528,7 @@ =? p.task ?=([%crud %hax-heft ~] p.task) [%heft ~] :: $(hen u.hey.all, wrapped-task p.task) - :: a %sunk notification from %jail comes in on an unfamiliar duct + :: a %sunk notification from %kale in on an unfamiliar duct :: ?: ?=(%sunk -.task) [~ ..^$] diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index b84d9e8f0..19e1beaca 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -1237,19 +1237,19 @@ %info `%c %keep `%f %kill `%f - %look `%j + %look `%k %merg `%c - %mint `%j + %mint `%k %mont `%c %nuke `%a %ogre `%c %perm `%c %rest `%b - %snap `%j + %snap `%k %wait `%b %want `%a %warp `%c - %wind `%j + %wind `%k %wipe `%f :: %request `%i diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 92d76e1d6..f40929ec1 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -413,7 +413,7 @@ [%send =lane =blob] [%done error=(unit error)] :: - [%mass mass] + [%mass p=mass] [%turf turfs=(list turf)] == -- ::able From 75bb2d554efe2fd8ceee7ead914f67e6960a527d Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 15 Jul 2019 14:44:10 -0700 Subject: [PATCH 013/451] fix dill/ames interaction --- pkg/arvo/sys/vane/dill.hoon | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pkg/arvo/sys/vane/dill.hoon b/pkg/arvo/sys/vane/dill.hoon index efc578ce7..189d5e224 100644 --- a/pkg/arvo/sys/vane/dill.hoon +++ b/pkg/arvo/sys/vane/dill.hoon @@ -89,11 +89,7 @@ ++ sign :: in result $<- $~ [%k %init *@p] :: $% $: %a :: - $% [%nice ~] :: XX obsolete - $> $? %mass :: - %send :: XX strange - == :: - gift:able:ames :: + $% $>(%mass gift:able:ames) :: == == :: $: %b :: $% $>(%mass gift:able:behn) :: From 86da8e903302f1abd31796fa9ff058d8ae152088 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 15 Jul 2019 16:11:22 -0700 Subject: [PATCH 014/451] made a pill that boots without error --- pkg/arvo/sys/vane/clay.hoon | 11 ++++++++++- pkg/arvo/sys/vane/dill.hoon | 7 ------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 5b45a7872..b7ff5baab 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2918,12 +2918,21 @@ ?: |(?=(%& -.w) (~(has by cez) p.w)) s (~(put in s) p.w) ?^ mis + :: TODO remove this nasty hack + :: + ?. ?=([[%a *] *] hen) + +>.$ =- (emit hen %give %done `[%perm-fail [%leaf "No such group(s): {-}"]~]) %+ roll ~(tap in `(set @ta)`mis) |= {g/@ta t/tape} ?~ t (trip g) :(weld t ", " (trip g)) - =< (emit hen %give %done ~) + :: TODO remove this nasty hack + :: + =< ?. ?=([[%a *] *] hen) + . + (emit hen %give %done ~) + :: ?- -.rit $r wake(per (put-perm per pax red.rit)) $w wake(pew (put-perm pew pax wit.rit)) diff --git a/pkg/arvo/sys/vane/dill.hoon b/pkg/arvo/sys/vane/dill.hoon index 189d5e224..216f213bc 100644 --- a/pkg/arvo/sys/vane/dill.hoon +++ b/pkg/arvo/sys/vane/dill.hoon @@ -376,18 +376,11 @@ ?- sih {?($a $b $c $e $f $g $i $k) $mass *} (wegh -.sih p.sih) - :: - {$a $nice *} - :: ~& [%take-nice-ames sih] - +> :: [%k %init *] :: pass thru to unix :: +>(moz :_(moz [hen %give +.sih])) - :: - {$a $send *} - +>(moz :_(moz [hen %give +.sih])) :: {$g $onto *} :: ~& [%take-gall-onto +>.sih] From 5531cbd5e64f55fb90a0100d40bc8ee853914cc7 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 15 Jul 2019 17:02:21 -0700 Subject: [PATCH 015/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 948f0a320..7ab8c194e 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b7135ab911304fd1d884d2ee7d6c4c1b84f576dbe320abf4ec2672997074445a -size 6105223 +oid sha256:b334f2a5834dde920f02d6f35eb15a087f95a6a61c5156d61ae5705a036fede3 +size 8319602 From 490341bac610a6db47de39c4afdd2fe74d19192a Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 22 Jul 2019 19:14:18 -0700 Subject: [PATCH 016/451] Fixed %barn to %born in vere.c --- pkg/urbit/vere/ames.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/urbit/vere/ames.c b/pkg/urbit/vere/ames.c index c6d450421..24d519e83 100644 --- a/pkg/urbit/vere/ames.c +++ b/pkg/urbit/vere/ames.c @@ -290,7 +290,7 @@ u3_ames_ef_bake(u3_pier* pir_u) { u3_noun pax = u3nq(u3_blip, c3__newt, u3k(u3A->sen), u3_nul); - u3_pier_plan(pax, u3nc(c3__barn, u3_nul)); + u3_pier_plan(pax, u3nc(c3__born, u3_nul)); } /* u3_ames_ef_send(): send packet to network (v4). From 043f508f27a6e6ffd3c44b5d943e4bbac05aa222 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 22 Jul 2019 19:15:16 -0700 Subject: [PATCH 017/451] deleted old ames --- pkg/arvo/sys/vane/ames.hoon | 1668 ----------------------------------- 1 file changed, 1668 deletions(-) delete mode 100644 pkg/arvo/sys/vane/ames.hoon diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon deleted file mode 100644 index 67cfa59b6..000000000 --- a/pkg/arvo/sys/vane/ames.hoon +++ /dev/null @@ -1,1668 +0,0 @@ -!: :: ames (4a), networking -:: - |= pit=vase - => =~ -:: structures -=, ames -:: this number needs to be below 8 -:: -=+ protocol-version=3 -|% -+$ move [p=duct q=(wind note gift:able)] :: local move -+$ note :: out request $-> - $~ [%b %wait *@da] :: - $% $: %b :: to %behn - $> $? %rest :: cancel timer - %wait :: set timer - == :: - task:able:behn :: - == :: - $: %d :: to %dill - $>(%flog task:able:dill) :: log output - == :: - $: %j :: to %jael - $> $? %meet :: neighbor - %pubs :: view public keys - %turf :: view domains - %vein :: view private keys - == :: - task:able:jael :: - == :: - $: @tas :: to any - $>(%west task:able) :: deliver message - == == :: -+$ sign :: in result _<- - $~ [%b %wake ~] :: - $% $: %b :: from %behn - $>(%wake gift:able:behn) :: timer activate - == :: - $: %j :: from %jael - $> $? %pubs :: public keys - %turf :: bind to domains - %vein :: private keys - == :: - gift:able:jael :: - == :: - $: %g :: from %gall - $% [%mean p=ares] :: XX obsolete - [%nice ~] :: XX obsolete - $>(%unto gift:able:gall) :: application ack - == == :: - $: @tas :: from any - $% $>(%crud vane-task) :: XX strange - $> $? %mack :: message ack - %woot :: reaction message - == :: - gift:able :: - == == == :: -:: |pact: internal packet structures -:: -++ pact - |% - +$ full [lyf=[to=life from=life] law=(unit deed) txt=@] - +$ open [lyf=[to=~ from=life] law=(unit deed) txt=@] - -- --- - :::::::::::::::::::::::::::::::::::::::::::::::::::::::: - :: section 4aA, identity logic :: - :: removed in favor of jael/ethereum :: - :: - :::::::::::::::::::::::::::::::::::::::::::::::::::::::: - :: section 4aB, packet format :: - :: - |% - ++ bite :: packet to cake - |= pac=rock - ^- (unit cake) - =+ [mag=(end 5 1 pac) bod=(rsh 5 1 pac)] - =+ :* vez=(end 0 3 mag) :: protocol version - chk=(cut 0 [3 20] mag) :: checksum - wix=(bex +((cut 0 [23 2] mag))) :: width of receiver - vix=(bex +((cut 0 [25 2] mag))) :: width of sender - tay=(cut 0 [27 5] mag) :: message type - == - :: XX these packets should be firewalled in vere so that they don't - :: make it into the event log - :: - ?. =(protocol-version vez) ~ - ?. =(chk (end 0 20 (mug bod))) ~ - %- some - :+ [(end 3 wix bod) (cut 3 [wix vix] bod)] - (kins tay) - (rsh 3 (add wix vix) bod) - :: - ++ kins |=(tay=@ (snag tay `(list skin)`[%none %open %fast %full ~])) - ++ ksin |=(sin=skin `@`?-(sin %none 0, %open 1, %fast 2, %full 3)) - ++ spit :: cake to packet - |= kec=cake ^- @ - =+ wim=(met 3 p.p.kec) - =+ dum=(met 3 q.p.kec) - =+ yax=?:((lte wim 2) 0 ?:((lte wim 4) 1 ?:((lte wim 8) 2 3))) - =+ qax=?:((lte dum 2) 0 ?:((lte dum 4) 1 ?:((lte dum 8) 2 3))) - =+ wix=(bex +(yax)) - =+ vix=(bex +(qax)) - =+ bod=:(mix p.p.kec (lsh 3 wix q.p.kec) (lsh 3 (add wix vix) r.kec)) - =+ tay=(ksin q.kec) - %+ mix - %+ can 0 - :~ [3 protocol-version] - [20 (mug bod)] - [2 yax] - [2 qax] - [5 tay] - == - (lsh 5 1 bod) - -- - :::::::::::::::::::::::::::::::::::::::::::::::::::::::: - :: section 4aC, PKI engine :: - :: - |% - ++ go :: go - |_ ton=town :: ames state - ++ as :: as:go - |_ our=ship :: per server - ++ lax :: lax:as:go - |_ [her=ship dur=dore] :: per client - ++ cluy :: cluy:lax:as:go - ^- [lyf=life cub=acru] :: client crypto - ?> ?=(^ lew.wod.dur) - [life.u.lew.wod.dur (com:nu:crub:crypto pass.u.lew.wod.dur)] - :: - ++ clon - ^- life - :: if we don't have a +deed for :her, we guess 1 - :: - ?~(lew.wod.dur 1 life.u.lew.wod.dur) - :: - ++ griz :: griz:lax:as:go - |= now=@da :: generate key for - ^- [p=code q=_+>] - =+ key=(shas %enty (mix now any.ton)) - :- key - %= +>.$ - any.ton (shax (mix now any.ton)) - heg.caq.dur (~(put by heg.caq.dur) (shaf %hand key) key) - == - :: - ++ pode :: pode:lax:as:go - |= now=@da :: timeout route - ^+ +> - ?: (lth her 256) +>(lun.wod.dur [~ %if ~2000.1.1 0 (mix her .0.0.1.0)]) - +>(lun.wod.dur ~) - :: - ++ kuch :: kuch:lax:as:go - |= had=hand :: hear key tag - ^- (unit [code _+>]) - =+ wey=(~(get by heg.caq.dur) had) - ?^ wey - =+ key=u.wey - :+ ~ key - %= ..kuch - yed.caq.dur [~ had u.wey] - heg.caq.dur (~(del by heg.caq.dur) had) - qim.caq.dur (~(put by qim.caq.dur) had key) - == - =+ dyv=(~(get by qim.caq.dur) had) - ?~ dyv ~ - [~ u.dyv ..kuch] - :: - ++ wasc :: wasc:lax:as:go - |= key=code :: hear foreign code - ^+ +> - =+ had=(shaf %hand key) - %_ ..wasc - yed.caq.dur [~ had key] - qim.caq.dur (~(put by qim.caq.dur) had key) - == - :: - ++ wast :: wast:lax:as:go - |= ryn=lane :: set route - ^+ +> - %= +> - lun.wod.dur - ?: ?=([%ix *] ryn) - ?: ?| ?=(~ lun.wod.dur) - ?=([%ix *] u.lun.wod.dur) - ?& ?=([%if *] u.lun.wod.dur) - (gth p.ryn (add ~s10 p.u.lun.wod.dur)) - == - == - [~ ryn] - lun.wod.dur - [~ ryn] - == - :: - ++ wist :: wist:lax:as:go - |= $: now=@da :: route via - waz=(list @p) - ryn=(unit lane) - pac=rock - == - ^- (list boon) - ?: =(our her) [[%ouzo *lane pac] ~] - ?~ waz ~ - =+ dyr=?:(=(her i.waz) dur (gur i.waz)) - ?. ?& !=(our i.waz) - ?=(^ lun.wod.dyr) - == - $(waz t.waz) - :_ ?: ?=(%ix -.u.lun.wod.dyr) - $(waz t.waz) - ~ - :+ %ouzo u.lun.wod.dyr - ?: &(=(i.waz her) =(~ ryn)) pac - =+ mal=(jam `meal`[%fore her ryn pac]) - %- spit - ^- cake - :* [our i.waz] - ?~ yed.caq.dyr [%none mal] - :- %fast - %^ cat 7 - p.u.yed.caq.dyr - (en:crub:crypto q.u.yed.caq.dyr mal) - == - :: - ++ zuul :: zuul:lax:as:go - |= [now=@da seg=ship ham=meal] :: encode message - ^- [p=(list rock) q=_+>] - =< weft - |% - ++ wasp :: null security - ^-([p=skin q=@] [%none (jam ham)]) - :: - ++ weft :: fragment message - ^- [p=(list rock) q=_+>.$] - =^ gim ..weft wisp - :_ +>.$ - ^- (list rock) - =+ wit=(met 13 q.gim) - ?< =(0 wit) - ?: =(1 wit) - =+ yup=(spit [our her] p.gim q.gim) - [yup ~] - =+ ruv=(rip 13 q.gim) - =+ gom=(shaf %thug q.gim) - =+ inx=0 - |- ^- (list rock) - ?~ ruv ~ - =+ ^= vie - %+ spit - [our her] - wasp(ham [%carp (ksin p.gim) inx wit gom i.ruv]) - :- vie - $(ruv t.ruv, inx +(inx)) - :: - ++ wisp :: generate message - ^- [[p=skin q=@] q=_..wisp] - ?: =(%carp -.ham) - [wasp ..wisp] - ?: !=(~ yed.caq.dur) - ?> ?=(^ yed.caq.dur) - :_ ..wisp - :- %fast - %^ cat 7 - p.u.yed.caq.dur - (en:cub:cluy q.u.yed.caq.dur (jam ham)) - ?: &(=(~ lew.wod.dur) =(%back -.ham)) - [wasp ..wisp] - :: we include our deed in asymmetric skins (%open and %full) - :: if we're a comet or moon, or if we're sponsoring her - :: - =/ bil=(unit deed) - =/ rac (clan:title our) - ?. ?| ?=(?(%earl %pawn) rac) - &(!?=(%czar rac) =(our seg)) - == - ~ - `law.ton - =/ yig sen - =/ hom (jam ham) - ?: =(~ lew.wod.dur) - :_ ..wisp - :- %open - %- jam - ^- open:pact - :+ [~ lyf.yig] - bil - (sign:as:cub.yig hom) - =/ cay cluy - :: :tuy: symmetric key proposal - :: - =^ tuy +>.$ (griz now) - :_ ..wisp - :- %full - %- jam - ^- full:pact - :+ [lyf.cay lyf.yig] - bil - (seal:as:cub.yig pub:ex:cub.cay (jam tuy hom)) - -- :: --zuul:lax:as:go - -- :: --lax:as:go - :: - ++ gur :: default dore - |= her=ship - ^- dore - =+ def=?.((lth her 256) ~ [~ %if ~2000.1.1 0 (mix her .0.0.1.0)]) - [[~2100.1.1 def ~] *clot] - :: - ++ myx :: dore by ship - |= her=ship - ^+ lax - =/ fod=dore - (~(gut by hoc.ton) her (gur her)) - ~(. lax [her fod]) - :: - ++ nux :: install dore - |= new=_lax - ^+ +> - +>(hoc.ton (~(put by hoc.ton) her.new dur.new)) - :: - ++ sen :: current crypto - ^- [lyf=life cub=acru] - ?~(val.ton !! [p.i.val.ton r.i.val.ton]) - :: - ++ sev :: crypto by life - |= mar=life - ^- [p=? q=acru] - ?~ val.ton !! - ?: =(mar p.i.val.ton) - [& r.i.val.ton] - ?> (lth mar p.i.val.ton) - :- | - |- ^- acru - ?> ?=(^ t.val.ton) - ?: =(mar p.i.t.val.ton) - r.i.t.val.ton - $(t.val.ton t.t.val.ton) - -- :: --as:go - :: - ++ su :: install safe - |=(new=_as `town`ton.new) - :: - ++ ti :: expire by time - |= now=@da - ^- town - !! - :: - ++ us :: produce safe - |=(our=ship `_as`~(. as our)) - -- :: --go - -- - :::::::::::::::::::::::::::::::::::::::::::::::::::::::: - :: section 4aF, packet pump :: - |% - ++ pu :: packet pump - |_ shed - ++ abet +< - ++ ahoy :: ahoy:pu - ^+ . :: initialize - %_ . - rtt ~s1 - rto ~s4 - rtn ~ - rue ~ - nus 0 - nif 0 - nep 0 - caw 2 - cag 64 - diq ~ - pyz ~ - puq ~ - == - :: - ++ bick :: bick:pu - |= [now=@da fap=flap] :: ack by hash - ^- [[p=(unit soup) q=(list rock)] _+>] - =+ sun=(~(get by diq) fap) - ?~ sun - :: ~& [%bick-none `@p`(mug fap)] :: not a real error - [[~ ~] +>.$] - :: ~& [%bick-good `@p`(mug fap) u.sun] - =. diq (~(del by diq) fap) - =^ gub +>.$ (bock now u.sun) - =^ yop +>.$ (harv now) - [[gub yop] +>.$] - :: - ++ bilk :: bilk:pu - |= now=@da :: inbound packet - ^+ +> - =+ trt=(mul 2 rtt) - %= +>.$ - rue [~ now] - rto trt - rtn ?~(puq ~ [~ (add now trt)]) - == - :: - ++ boom :: boom:pu - |= now=@da ^- ? :: address timeout - |(?=(~ rue) (gte (sub now u.rue) ~m1)) - :: - ++ bust :: bust:pu - ^- ? :: not responding - &(?=(^ rtn) (gte rto ~s16)) - :: - ++ bike :: bike:pu - ^+ . :: check stats - ?> .= nif - |- ^- @ - ?~ puq 0 - :(add !liv.q.n.puq $(puq l.puq) $(puq r.puq)) - . - :: - ++ beet :: beet:pu - ^+ . :: advance unacked - =- +(nep ?~(foh nus u.foh)) - ^= foh - |- ^- (unit @ud) - ?~ puq ~ - ?: (lte p.n.puq nep) $(puq l.puq) - =+ rig=$(puq r.puq) - ?^(rig rig [~ p.n.puq]) - :: - ++ bine :: bine:pu - |= [now=@da num=@ud] :: apply ack - ^- [(unit soup) _+>] - ?~ puq !! - ?. =(num p.n.puq) - ?: (gth num p.n.puq) - =+ lef=$(puq l.puq) - [-.lef +.lef(puq [n.puq puq.lef r.puq])] - =+ rig=$(puq r.puq) - [-.rig +.rig(puq [n.puq l.puq puq.rig])] - =: rtt ?. &(liv.q.n.puq =(1 nux.q.n.puq)) rtt - =+ gap=(sub now lys.q.n.puq) - :: ~& [%bock-trip num (div gap (div ~s1 1.000))] - (div (add (mul 2 rtt) gap) 3) - nif (sub nif !liv.q.n.puq) - == - =+ lez=(dec (need (~(get by pyz) gom.q.n.puq))) - =^ gub pyz - ?: =(0 lez) - [[~ gom.q.n.puq] (~(del by pyz) gom.q.n.puq)] - [~ (~(put by pyz) gom.q.n.puq lez)] - :- gub - +>.$(puq ~(nap to puq)) - :: - ++ bock :: bock:pu - |= [now=@da num=@ud] :: ack by sequence - ^- [(unit soup) _+>] - =^ gym +> (bine now num) - :- gym - ?: (gth num nep) - =+ cam=(max 2 (div caw 2)) - :: ~& [%bock-hole num nep cam] - beet:(wept(nep num, cag cam, caw cam) nep num) - =. caw ?: (lth caw cag) +(caw) - (add caw !=(0 (mod (mug now) caw))) - ?: =(num nep) - :: ~& [%bock-fine num nif caw cag] - beet - :: ~& [%bock-fill num nif caw cag] - +>.$ - :: - ++ harv :: harv:pu - |= now=@da :: harvest queue - ^- [(list rock) _+>] - ?: =(~ puq) [~ +>(rtn ~)] - ?. (gth caw nif) [~ +>] - =+ wid=(sub caw nif) - =| rub=(list rock) - =< abet =< apse - |% - ++ abet - ?~ rub [~ +>.$] - [(flop rub) +>.$(rtn [~ (add rto now)])] - :: - ++ apse - ^+ . - ?~ puq . - ?: =(0 wid) . - => rigt =< left - ?> ?=(^ puq) - ?: =(0 wid) . - ?. =(| liv.q.n.puq) . - :: ~& [%harv nux.q.n.puq p.n.puq] - %_ . - wid (dec wid) - rub [pac.q.n.puq rub] - nif +(nif) - liv.q.n.puq & - nux.q.n.puq +(nux.q.n.puq) - lys.q.n.puq now - == - :: - ++ left - ?> ?=(^ puq) - ^+(. =+(lef=apse(puq l.puq) lef(puq [n.puq puq.lef r.puq]))) - ++ rigt - ?> ?=(^ puq) - ^+(. =+(rig=apse(puq r.puq) rig(puq [n.puq l.puq puq.rig]))) - -- - :: - ++ wack :: wack:pu - |= now=@da :: wakeup (timeout) - ^- [(list rock) _+>] - ?. &(!=(~ rtn) ?>(?=(^ rtn) (gte now u.rtn))) [~ +>] - :: ~& [%slow (div rto (div ~s1 1.000))] - =. +> (wept 0 nus) - ?> =(0 nif) - =: caw 2 - rto ;: min - (mul 2 rto) - ~m2 - (mul ~s16 ?~(rue 1 +((div (sub now u.rue) ~d1)))) - == - == - (harv now) - :: - ++ wept :: wept:pu - |= [fip=@ud lap=@ud] :: fip thru lap-1 - =< abet =< apse - |% - ++ abet +>.$ - ++ apse - ^+ . - ?~ puq . - ?: (lth p.n.puq fip) ?~(l.puq . left) - ?: (gte p.n.puq lap) ?~(r.puq . rigt) - => rigt =< left - ?> ?=(^ puq) - ?.(liv.q.n.puq . .(nif (dec nif), liv.q.n.puq |)) - :: - ++ left - ?> ?=(^ puq) - ^+(. =+(lef=apse(puq l.puq) lef(puq [n.puq puq.lef r.puq]))) - ++ rigt - ?> ?=(^ puq) - ^+(. =+(rig=apse(puq r.puq) rig(puq [n.puq l.puq puq.rig]))) - -- - :: - ++ whap :: whap:pu - |= [now=@da gom=soup wyv=(list rock)] :: send a message - ^- [(list rock) _+>] - =. pyz (~(put by pyz) gom (lent wyv)) - =. +> - |- ^+ +>.^$ - ?~ wyv +>.^$ - %= $ - wyv t.wyv - nus +(nus) - diq (~(put by diq) (shaf %flap i.wyv) nus) - puq (~(put to puq) [nus `soul`[gom 0 | ~2000.1.1 i.wyv]]) - == - (harv now) - -- - -- - :::::::::::::::::::::::::::::::::::::::::::::::::::::::: - :: section 4aG, protocol engine :: - :: - |% - ++ am :: am - ~% %ames-am ..is ~ - |_ [our=ship now=@da fox=fort ski=sley] :: protocol engine - :: +deed-scry: for a +deed at a +life - :: - ++ deed-scry - ~/ %deed-scry - |= [who=ship lyf=life] - ^- (unit deed) - =; ded - ?~(ded ~ u.ded) - ;; (unit (unit deed)) - %- (sloy-light ski) - =/ pur=spur - /(scot %ud lyf)/(scot %p who) - [[151 %noun] %j our %deed da+now pur] - :: +life-scry: for a +life - :: - ++ life-scry - ~/ %life-scry - |= who=ship - ^- (unit life) - =; lyf - ?~(lyf ~ u.lyf) - ;; (unit (unit life)) - %- (sloy-light ski) - =/ pur=spur - /(scot %p who) - [[151 %noun] %j our %life da+now pur] - :: +sein-scry: for sponsor - :: - ++ sein-scry - ~/ %sein - |= who=ship - ;; ship - %- need %- need - %- (sloy-light ski) - [[151 %noun] %j our %sein da+now /(scot %p who)] - :: +saxo-scry: for sponsorship chain - :: - ++ saxo-scry - ~/ %saxo - |= who=ship - ;; (list ship) - %- need %- need - %- (sloy-light ski) - [[151 %noun] %j our %saxo da+now /(scot %p who)] - :: +turf-scry: for network domains - :: - ++ turf-scry - =< $ - ~% %turf + ~ - |. ;; (list turf) - %- need %- need - %- (sloy-light ski) - [[151 %noun] %j our %turf da+now ~] - :: - ++ vein :: vein:am - ~/ %vein - |= [=life vein=(map life ring)] :: new private keys - ^- fort - :: - ?. ?& (~(has by vein) life) - =(life (roll ~(tap in ~(key by vein)) max)) - == - ~| [%vein-mismatch +<] !! - %= fox - hoc.ton - :: reset connections - :: - (~(run by hoc.ton.fox) |=(=dore dore(caq *clot))) - :: - seh.ton - :: reset symmetric key cache - :: - ~ - :: - :: save our secrets, ready for action - law.ton - :: save our deed (for comet/moon communication) - :: - (need (deed-scry our life)) - :: - val.ton - :: save our secrets, ready for action - :: - ^- wund - %+ turn - %+ sort - ~(tap by vein) - |= [a=[=^life =ring] b=[=^life =ring]] - (gth life.a life.b) - |= [=^life =ring] - [life ring (nol:nu:crub:crypto ring)] - == - :: - ++ gnaw :: gnaw:am - ~/ %gnaw - |= [kay=cape ryn=lane pac=rock] :: process packet - ^- [p=(list boon) q=fort] - =/ kec=(unit cake) (bite pac) - ?~ kec [~ fox] - ?: (goop p.p.u.kec) - [~ fox] - ?. =(our q.p.u.kec) - [~ fox] - =; zap=[p=(list boon) q=fort] - [(weld p.zap next) q.zap] - =< zork - =< zank - :: ~& [%hear p.p.u.kec ryn `@p`(mug (shaf %flap pac))] - %- ~(chew la:(ho:um p.p.u.kec) kay ryn %none (shaf %flap pac)) - [q.u.kec r.u.kec] - :: - ++ goop :: blacklist - |= him=ship - | - :: - ++ kick :: kick:am - |= hen=duct :: refresh net - ^- [p=(list boon) q=fort] - zork:(kick:um hen) - :: - ++ next - ^- (list boon) - =/ doz=(unit @da) [~ (add now ~s32)] - =. doz - |- ^+ doz - ?~ wab.zac.fox doz - =. doz $(wab.zac.fox l.wab.zac.fox) - =. doz $(wab.zac.fox r.wab.zac.fox) - =+ bah=q.n.wab.zac.fox - (hunt lth doz rtn.sop.bah) - =/ nex (hunt lth doz tim.fox) - ?: =(tim.fox nex) - ~ - [%pito (need nex)]~ - :: - ++ rack :: rack:am - ~/ %rack - |= [her=ship cha=path cop=coop] :: e2e ack - =/ oh (ho:um her) - =^ gud oh (cook:oh cop cha ~) - ?. gud oh - (cans:oh cha) - :: - ++ wake :: wake:am - ~/ %wake - |= hen=duct :: harvest packets - ^- [p=(list boon) q=fort] - =. tim.fox ~ - =/ neb=(list ship) ~(tap in ~(key by wab.zac.fox)) - =| bin=(list boon) - |- ^- [p=(list boon) q=fort] - ?~ neb - =^ ban fox (kick hen) - [:(weld bin p.ban next) fox] - =/ fro=(list ship) (saxo-scry our) - =/ hoz (ho:um i.neb) - =^ bun fox zork:zank:(thaw:hoz fro) - $(neb t.neb, bin (weld p.bun bin)) - :: - ++ wise :: wise:am - |= [hen=duct her=ship cha=path val=*] :: send a statement - ^- [p=(list boon) q=fort] - =^ ban fox zork:zank:(wool:(ho:um her) hen cha val) - [(weld p.ban next) fox] - :: - ++ um :: per server - =/ gus (~(us go ton.fox) our) - =/ weg=corn zac.fox - =| bin=(list boon) - |% - ++ ho :: ho:um:am - |= her=ship :: per friend - =+ diz=(myx:gus her) - =+ bah=(~(get by wab.weg) her) - =+ puz=?~(bah ahoy:pu %*(. pu +< sop.u.bah)) - => .(bah `bath`?~(bah [abet:puz ~ ~] u.bah)) - |% - ++ busk :: busk:ho:um:am - |= [waz=(list ship) pax=(list rock)] :: send packets - %_ +> - bin - |- ^+ bin - ?~ pax bin - $(pax t.pax, bin (weld (flop (wist:diz now waz ~ i.pax)) bin)) - == - :: - ++ cans :: cans:ho:um:am - |= cha=path - =+ rum=(need (~(get by raz.bah) cha)) - =. rum - %= rum - did +(did.rum) - mis (~(del by mis.rum) did.rum) - == - (coat cha rum) - :: - ++ coat :: coat:ho:um:am - |= [cha=path rum=race] :: update input race - ^+ +> - =+ cun=(~(get by mis.rum) did.rum) - ?: |(!dod.rum ?=(~ cun)) - :: - :: if we have not yet received the current message, - :: or if we are not idle, just wait. - :: - +>.$(raz.bah (~(put by raz.bah) cha rum)) - ?. =(%good p.u.cun) - :: - :: if we are recording a failed message, acknowledge - :: it now, since it obviously won't be processed. - :: - ~& [%fail-ack did.rum] - =^ gud +>.$ - (cook ``[%dead-message ~] cha `[q.u.cun r.u.cun]) - ?. gud +>.$ - %= +>.$ - raz.bah - %+ ~(put by raz.bah) cha - %= rum - did +(did.rum) - mis (~(del by mis.rum) did.rum) - == - == - :: - :: the message is good. send it to be processed. - :: - ?> ?=(^ s.u.cun) - %= +>.$ - raz.bah (~(put by raz.bah) cha rum(dod |)) - bin - :_ bin - :^ %milk - her - `soap`[[lyf:sen:gus clon:diz] cha did.rum] - u.s.u.cun - == - :: - ++ cook :: cook:ho:um:am - |= [cop=coop cha=path ram=(unit [ryn=lane dam=flap])] - ^- [gud=? con=_+>] :: acknowledgment - :: ~& [%ames-cook cop cha ram] - =+ rum=(need (~(get by raz.bah) cha)) - =+ lat=(~(get by mis.rum) did.rum) - ?: &(?=(~ lat) ?=(~ ram)) - ~& %ack-late-or-redundant - [%| +>.$] - :- %& - =+ ^- [ryn=lane dam=flap] - ?^ ram [ryn.u.ram dam.u.ram] - ?< ?=(~ lat) - [q r]:u.lat - =. raz.bah - ?^ ram raz.bah - %+ ~(put by raz.bah) cha - rum(dod &, bum ?~(cop bum.rum (~(put by bum.rum) did.rum u.cop))) - =/ seg (sein-scry her) - =^ roc diz (zuul:diz now seg [%back cop dam ~s0]) - =/ fro=(list ship) (saxo-scry our) - (busk(diz (wast:diz ryn)) (xong fro) roc) - :: XX move this logic into %zuse, namespaced under %jael? - :: - ++ deng :: deng:ho:um:am - |= law=(unit deed) :: accept inline deed - ^+ diz - ?: |(=(~ law) =(lew.wod.dur.diz law)) - diz - ~| [%deng-fail her] - ?> ?=(^ law) - =* wed u.law - ?> ^- ? - ?- (clan:title her) - %earl - :: signed by parent - :: - =/ seg (^sein:title her) - =/ yig - ?: =(our seg) - sen:gus - cluy:(myx:gus seg) - ?& =(lyf.yig life.wed) - ?=(^ oath.wed) - .= (need (sure:as:cub.yig u.oath.wed)) - (shaf %earl (sham [her life.wed pass.wed])) - == - :: - %pawn - :: self-signed, life 1, address is fingerprint - :: - =/ cub=acru (com:nu:crub:crypto pass.wed) - ?& =(`@`fig:ex:cub her) - ?=(%1 life.wed) - ?=(^ oath.wed) - :: XX do we care about this signature at all? - :: - .= (need (sure:as:cub u.oath.wed)) - (shaf %self (sham [her life.wed pass.wed])) - == - :: - * - :: our sponsor - :: - ?& !?=(%czar (clan:title our)) - =(her (sein-scry our)) - == - == - diz(lew.wod.dur law) - :: - ++ done :: done:ho:um:am - |= [cha=path num=@ud] :: complete outgoing - ^- [(unit duct) _+>] - :: ~& [%ames-done cha num] - =+ rol=(need (~(get by ryl.bah) cha)) - =+ rix=(~(get by san.rol) num) - ?~ rix [~ +>.$] - :- rix - %_ +>.$ - ryl.bah - (~(put by ryl.bah) cha rol(san (~(del by san.rol) num))) - == - :: - ++ la :: la:ho:um:am - |_ [kay=cape ryn=lane aut=skin dam=flap] :: per packet - :: - ++ chew :: chew:la:ho:um:am - |= [sin=skin msg=@] :: receive - ^+ +> - =< abed - |% - :: +abed: check that we have the keys to communicate with :her - :: - ++ abed - ^+ +>.$ - :: if we don't have a deed, subscribe for public key updates - :: - :: XX update state so we only ask once? - :: - =? +>.$ ?=(~ lew.wod.dur.diz) - (emit %beer her) - :: if we don't have a deed, scry for it - :: (to avoid dropping the packet, if possible). - :: - =? lew.wod.dur.diz ?=(~ lew.wod.dur.diz) - =/ life (life-scry her) - ?~(life ~ (deed-scry her u.life)) - :: if we have a deed, proceed - :: - ?^ lew.wod.dur.diz - apse - :: if :her is our initial sponsor, proceed (TOFU) - :: - :: XX TOFU is unnecessary if we include keys - :: for the full sponsorship chain in the boot event - :: - ?: =(her (sein-scry our)) - apse - :: if :her is a comet, or a moon of a known ship, proceed - :: - =/ =rank:title (clan:title her) - ?: ?| ?=(%pawn rank) - ?& ?=(%earl rank) - !=(~ lew.wod.dur:(myx:gus (sein-scry her))) - == == - apse - :: otherwise, drop the packet - :: - +>.$ - :: +apse: process the packet, notify if :her status changed - :: - ++ apse - ^+ +>.$ - =/ oub bust:puz - =/ neg =(~ yed.caq.dur.diz) - =. +>.$ east - =/ eng =(~ yed.caq.dur.diz) - =/ bou bust:puz - =? +>.$ &(oub !bou) - (emit [%wine her " is ok"]) - :: the presence of a symmetric key indicates neighboring - :: XX use deed instead? - :: - =? +>.$ &(neg !eng) - %- emir :~ - [%wine her " is your neighbor"] - ?> ?=(^ lew.wod.dur.diz) - [%raki her [life pass]:u.lew.wod.dur.diz] - == - +>.$ - :: - ++ east - ^+ +>.$ - ?- sin - %none - :: ~& %chew-none - =. puz (bilk:puz now) - (chow ;;(meal (cue msg))) - :: - %fast - :: ~& %chew-fast - =+ [mag=`hand`(end 7 1 msg) bod=(rsh 7 1 msg)] - =/ dey (kuch:diz mag) - :: ignore unknown key - :: - ?~ dey +>.$ - =. puz (bilk:puz now) - =^ key diz u.dey - (chow(aut sin) ;;(meal (cue (dy:cub:sen:gus key bod)))) - :: - %full - :: ~& %chew-full - =/ mex ;;(full:pact (cue msg)) - =. diz (deng law.mex) - =/ wug cluy:diz - ?> =(lyf.wug from.lyf.mex) - =/ gey (sev:gus to.lyf.mex) - =/ sem (need (tear:as:q.gey pub:ex:cub.wug txt.mex)) - =/ mes ;;((pair @ @) (cue sem)) - =. diz (wasc:diz p.mes) - =. puz (bilk:puz now) - (west(msg q.mes)) - :: - %open - :: ~& %chew-open - =/ mex ;;(open:pact (cue msg)) - =. diz (deng law.mex) - =/ wug cluy:diz - ?> =(lyf.wug from.lyf.mex) - =/ mes (need (sure:as:cub.wug txt.mex)) - =. puz (bilk:puz now) - (west(msg mes)) - == - ++ west - |= ~ - =+ vib=(cue msg) - =+ mal=(meal vib) - ?. =(mal vib) - ~& [%bad-meal her] - +>.^$ - (chow(aut sin) mal) - -- - :: - ++ chow :: chow:la:ho:um:am - |= fud=meal :: interpret meal - ^+ +> - =. diz ?:(=(%none aut) diz (wast:diz ryn)) - (dine fud) - :: - ++ cock :: cock:la:ho:um:am - ^+ . :: send new ack - :: ~& [%back kay dam] - =* cop `coop`?:(=(%good kay) ~ ``[%dead-packet ~]) - =/ seg (sein-scry her) - =^ pax diz (zuul:diz now seg [%back cop dam ~s0]) - =/ fro=(list ship) (saxo-scry our) - ..cock(+> (busk(diz (wast:diz ryn)) (xong fro) pax)) - :: - ++ deer :: deer:la:ho:um:am - |= [cha=path num=@ud dut=(unit)] :: interpret message - ^+ +> - =+ rum=(~(gut by raz.bah) cha *race) - :: ~& [%rx kay cha num [dod.rum did.rum] ?=(~ dut)] - =* bad (~(has in bad.fox) her) - =. kay ?.((~(has in bad.fox) her) kay ~&(%blocked %dead)) - %= +>.$ - +> - ?: (lth num did.rum) - :: - :: this message already acknowledged; repeat old ack, - :: or negative ack if this ship is blocked - :: - =* cop ^- coop - %+ ~(gut by bum.rum) num - ?:(bad ~ ``[%blocked ~]) - con:(cook (~(get by bum.rum) num) cha `[ryn dam]) - :: - :: insert this message in unprocessed set - :: - =. mis.rum (~(put by mis.rum) num [kay ryn dam dut]) - :: - :: if ship is blocked, advance pointer to latest message - :: - =. did.rum ?.(bad did.rum num) - :: - :: process update - :: - (coat cha rum) - == - :: - ++ dine :: dine:la:ho:um:am - |= fud=meal :: interpret meal - ^+ +> - ?- -.fud - %back - =. +> ?.(=(%full aut) +> cock) :: finish handshake - +>(..la (tock p.fud q.fud r.fud)) - :: - %bond - :: ~& [%bond p.fud q.fud] - (deer p.fud q.fud ?-(kay %dead ~, %good [~ r.fud])) - :: - %carp - :: =+ zol=(~(get by olz.weg) s.fud) - :: ?^ zol cock(kay u.zol) - =^ neb nys.weg - =+ neb=(~(get by nys.weg) s.fud) - ?^ neb [u.neb nys.weg] - =+ neb=`bait`[(kins p.fud) 0 r.fud ~] - [neb (~(put by nys.weg) s.fud neb)] - ?> (lth q.fud p.r.neb) - ?> =((kins p.fud) p.neb) - ?> =(r.fud p.r.neb) - =+ doy=`(unit @)`(~(get by q.r.neb) q.fud) - ?^ doy cock - => ^+ . %= . - q.r.neb (~(put by q.r.neb) q.fud t.fud) - q.neb +(q.neb) - == - :: ~& [%carp q.fud s.fud q.neb p.r.neb] - ?: =(q.neb p.r.neb) - =: nys.weg (~(del by nys.weg) s.fud) - :: olz.weg (~(put by olz.weg) s.fud kay) - == - (golf p.neb r.neb) - =. +>.$ cock - +>.$(nys.weg (~(put by nys.weg) s.fud neb)) - :: - %fore - =+ ^= lyn ^- lane - ?~ q.fud ryn - ?. ?=(%if -.u.q.fud) u.q.fud - [%ix +.u.q.fud] - :: u.q.fud - ?: =(our p.fud) - (emit %mead lyn r.fud) - =/ zid (myx:gus p.fud) - =/ zon %*(xong ..xong her p.fud) - =/ fro=(list ship) (saxo-scry our) - (emir (wist:zid now (zon fro) [~ lyn] r.fud)) - == - :: - ++ emir :: emir:la:ho:um:am - |= ben=(list boon) :: emit boons - ^+ +> - ?~(ben +> $(ben t.ben, bin [i.ben bin])) - :: - ++ emit :: emit:la:ho:um:am - |= bun=boon :: emit a boon - +>(bin [bun bin]) - :: - ++ golf :: golf:la:ho:um:am - |= [sin=skin duv=dove] :: assemble fragments - ^+ +> - %+ chew sin - =+ [nix=0 rax=*(list @)] - |- ^- @ - ?: =(p.duv nix) - (can 13 (turn (flop rax) |=(a=@ [1 a]))) - $(nix +(nix), rax [(need (~(get by q.duv) nix)) rax]) - -- :: --la:ho:um:am - :: - ++ pong :: pong:ho:um:am - |= hen=duct :: test connection - ^+ +> - ?. ?& =(~ puq.puz) - ?| bust:puz - ?=(~ rue.puz) - (gth now (add ~s32 u.rue.puz)) - :: XX hop.fox is never set, nothing sends %kick - :: - :: (lth u.rue.puz hop.fox) - == - == - +>.$ - (wool [/a/ping hen] /a/pi ~ |) - :: - ++ thaw :: thaw:ho:um:am - |= fro=(list ship) - ^+ +> :: wakeup bomb - =+ oub=bust:puz - =^ yem puz (wack:puz now) - =+ bou=bust:puz - =. bin - ?. &(bou !oub) bin - :_(bin [%wine her " not responding still trying"]) - =. diz ?:((boom:puz now) (pode:diz now) diz) - (busk (xong fro) yem) - :: - ++ tock :: tock:ho:um:am - |= [cop=coop fap=flap cot=@dr] :: e2e ack by hash - ^+ +> - =^ yoh puz (bick:puz now fap) - =. +>.$ - ?~ p.yoh +>.$ - =^ hud +>.$ - (done p.u.p.yoh q.u.p.yoh) - ?~ hud +>.$ - %= +>.$ - bin - :_ bin - `boon`[%cake her [[lyf:sen:gus clon:diz] u.p.yoh] cop u.hud] - == - =/ fro=(list ship) (saxo-scry our) - (busk (xong fro) q.yoh) - :: - ++ wind :: wind:ho:um:am - |= [gom=soup ham=meal] - :: ~& [%wind her gom] - ^+ +> - =/ seg (sein-scry her) - =^ wyv diz (zuul:diz now seg ham) - =^ feh puz (whap:puz now gom wyv) - =/ fro=(list ship) (saxo-scry our) - (busk (xong fro) feh) - :: - ++ wool :: wool:ho:um:am - |= [hen=duct cha=path val=*] :: send a statement - ^+ +> - =/ rol=rill (~(gut by ryl.bah) cha *rill) - =/ sex=@ud sed.rol - :: ~& [%tx [our her] cha sex] - :: if we don't have a public key for :her, - :: subscribe to %jael for keys and proceed - :: - :: XX update state so we only ask once? - :: - =? bin =(~ lew.wod.dur.diz) :_(bin [%beer her]) - :: if we don't have a public key for :her, - :: scry into %jael for them. - :: (skin will only be %open if the scry is ~) - :: - =? lew.wod.dur.diz =(~ lew.wod.dur.diz) - =/ life (life-scry her) - ?~(life ~ (deed-scry her u.life)) - =. ryl.bah - %+ ~(put by ryl.bah) cha - %= rol - sed +(sed.rol) - san (~(put by san.rol) sex hen) - == - %+ wind [cha sex] - [%bond cha sex val] - :: - ++ zest :: zest:ho:um:am - :~ :~ :* [%rtt rtt.sop.bah] - [%rto rto.sop.bah] - [%rtn rtn.sop.bah] - [%rue rue.sop.bah] - == - :* [%nus nus.sop.bah] - [%nif nif.sop.bah] - [%nep nep.sop.bah] - [%caw caw.sop.bah] - [%cag cag.sop.bah] - == - =+ qup=~(tap to puq.sop.bah) - :- %qup - %+ turn qup - |= [a=@ud b=soul] - :* a - nux.b - liv.b - lys.b - `@p`(mug (shaf %flap pac.b)) - gom.b - == - == - :: - :- %raz - =+ zar=~(tap by raz.bah) - %+ turn zar - |= [a=path b=race] - :+ a - did.b - =+ ciy=~(tap by mis.b) - %+ turn ciy - |= [c=@ud d=[p=cape q=lane r=flap s=(unit)]] - [c p.d r.d] - :: - [%ryl ~(tap to ryl.bah)] - [%lun lun.wod.dur.diz] - [%caq caq.dur.diz] - [%lew lew.wod.dur.diz] - == - :: - ++ zank :: zank:ho:um:am - %= +>.$ :: resolve - gus (nux:gus diz) - wab.weg (~(put by wab.weg) her bah(sop abet:puz)) - == - :: - ++ xong :: xong:ho:um:am - |= fro=(list ship) - ^- (list ship) :: route unto - =/ too (saxo-scry her) - =+ ^= oot ^- (list ship) - =| oot=(list ship) - |- ^+ oot - ?~ too ~ - ?: (lien fro |=(a=ship =(a i.too))) ~ - [i.too $(too t.too)] - :: ~& [%xong-to [our her] (weld oot ?>(?=(^ fro) t.fro))] - (weld oot ?>(?=(^ fro) t.fro)) - -- :: --ho:um:am - :: - ++ kick :: kick:um:am - |= hen=duct :: test connection - ^+ +> - =/ hoy (tail (saxo-scry our)) - |- ^+ +>.^$ - ?~ hoy - +>.^$ - $(hoy t.hoy, +>.^$ (pong i.hoy hen)) - :: - ++ pals :: pals:um:am - ^- (list @p) :: active neighbors - %+ turn - %+ skim ~(tap by wab.weg) - |= [a=ship b=bath] - !(~(boom pu sop.b) now) - |=([a=ship b=bath] a) - :: - ++ pong :: pong:um:am - |= [her=ship hen=duct] :: test neighbor - ^+ +> - zank:(pong:(ho her) hen) - :: - ++ zork :: zork:um:am - ^- [p=(list boon) q=fort] :: resolve - :- (flop bin) - %_ fox - ton (~(su go ton.fox) gus) - zac weg - == - -- :: --um:am - -- :: --am - -- - . == - :::::::::::::::::::::::::::::::::::::::::::::::::::::::: - :: section 4aH, protocol vane :: - :: - =| $: fox=fort :: kernel state - == :: - |= [our=ship now=@da eny=@uvJ ski=sley] :: current invocation - ^? :: opaque core - =< - ~% %ames-protocol ..is ~ - |% :: vane interface - ++ call :: handle request - ~/ %call - |= $: hen=duct - type=* - wrapped-task=(hobo task:able) - == - ^- [(list move) _..^$] - =/ task=task:able - ?. ?=(%soft -.wrapped-task) - wrapped-task - ;;(task:able p.wrapped-task) - =. any.ton.fox eny - =^ duy ..knob (knob hen task) - [duy ..^$] - :: - ++ load - |= old=fort - ..^$(fox old) - :: - ++ scry - |= [fur=(unit (set monk)) ren=@tas why=shop syd=desk lot=coin tyl=path] - ^- (unit (unit cage)) - ?. ?=(%& -.why) [~ ~] - ?~ tyl [~ ~] - =+ hun=(slaw %p i.tyl) - ?~ hun [~ ~] - ?. =(`@`0 ren) ~ - ?. ?=([$$ %da @] lot) - ~ - ?. =(now q.p.lot) ~ - (temp u.hun [syd t.tyl]) - :: - ++ stay fox - ++ take :: accept response - ~/ %take - |= [tea=wire hen=duct hin=(hypo sign)] - ^- [(list move) _..^$] - =. any.ton.fox eny - =^ duy ..knap - (knap tea hen q.hin) - [duy ..^$] - -- - ~% %ames-impl ..is ~ - |% - ++ clop - ~/ %clop - |= [now=@da hen=duct bon=boon] - ^- [(list move) fort] - ?- -.bon - %beer - =/ =wire /pubs/(scot %p p.bon) - :_ fox [hen [%pass wire %j %pubs p.bon]]~ - :: - %bock - :: ignore %turf if we haven't yet learned a unix duct - :: - :: Only happens during first boot. - :: - ?~ gad.fox - [~ fox] - :_ fox - [gad.fox %give %turf tuf.fox]~ - :: - %brew - :_ fox [hen [%pass / %j %turf ~]]~ - :: - %cake - :: ~? ?=(^ r.bon) [%cake-woot-bad hen r.bon] - :_ fox - :~ [s.bon %give %woot p.bon r.bon] - == - :: - %mead - =^ moz +>.$ (knob hen [%hear p.bon q.bon]) - [moz fox] - :: - %milk - :: ~& [%milk p.bon q.bon] - ?> ?=([@ @ *] q.q.bon) - ?> ?=(?(%a %c %e %g %j) i.q.q.bon) - =/ =wire [(scot %p our) (scot %p p.bon) q.q.bon] - :_ fox [hen %pass wire i.q.q.bon %west p.bon t.q.q.bon r.bon]~ - :: - %ouzo - :: drop packet if we haven't yet learned a unix duct - :: - :: Only happens during first boot. - :: - ?~ gad.fox - [~ fox] - :: ~& [%send now p.bon `@p`(mug (shaf %flap q.bon))] - :_ fox - [[gad.fox [%give %send p.bon q.bon]] ~] - :: - %pito - :_ fox(tim `p.bon) - %- flop - ^- (list move) - :: XX should this be the unix duct (gad.fox)? - :: - :: It seems far more important that the duct be always - :: predictable than that it be the unix duct, which - :: may change, or be unset during first boot. - :: - :- [gad.fox %pass /ames %b %wait p.bon] - ?~ tim.fox ~ - [gad.fox %pass /ames %b %rest u.tim.fox]~ - :: - %raki - :_ fox - [hen [%pass / %j %meet who=p.bon life=q.bon pass=r.bon]]~ - :: - %sake - =/ =wire /our/(scot %p our) - :_ fox [hen [%pass wire %j %vein ~]]~ - :: - %wine - :_ fox - =+ fom=~(rend co %$ %p p.bon) - :~ :- hen - :+ %slip %d - :+ %flog %text - ;: weld - "; " - fom - q.bon - == - == - == - :: - ++ knap - ~/ %knap - |= [tea=wire hen=duct sih=sign] - ^- [(list move) _+>] - :: if we got an error from behn, report it to %dill; TODO handle errors - :: - ?: ?=([%wake ^] +.sih) - =/ =flog:dill [%crud %wake u.error.sih] - [[hen %slip %d %flog flog]~ +>.$] - :: - ?- +<.sih - %crud [[[hen [%slip %d %flog +.sih]] ~] +>] - :: - %mack ?~ +>.sih $(sih [%g %nice ~]) :: XX using old code - $(sih [%g %mean `[%mack +>+.sih]]) - :: - %pubs - ?. ?=([%pubs @ ~] tea) - ~& [%strange-pubs tea] - [~ +>] - =/ her=ship (slav %p i.t.tea) - =/ gus (~(us go ton.fox) our) - =/ diz (myx:gus her) - ?: =(0 life.sih) - :: this should clear lew.wod.dur.diz because it means - :: we no longer trust that their public key came to - :: us honestly (becuse of a %jael snapshot restore). - :: in practice, that crashes in ++cluy:las:as:go, so - :: we ignore for now. - ~& [%ames-hear-empty-pub her] - [~ +>.$] - =/ ded=deed - [life.sih (~(got by pubs.sih) life.sih) oath=~] - =. lew.wod.dur.diz `ded - =. ton.fox (~(su go ton.fox) (nux:gus diz)) - [~ +>.$] - :: - %unto [~ +>] - :: - %vein - ?. ?=([%our @ ~] tea) - ~& [%strange-vein tea] - [~ +>] - =. fox (~(vein am [our now fox ski]) life.sih vein.sih) - [~ +>.$] - :: - %woot [~ +>] - :: - * - =+ ^= fuy - ^- [p=(list boon) q=fort] - ?- +<.sih - :: - :: only handles the non-error %wake case; error case above - :: - %wake - (~(wake am [our now fox ski]) hen) - :: - %turf - ?: =(tuf.fox turf.sih) - [~ fox] - =. tuf.fox turf.sih - [[%bock ~]~ fox] - :: - ?(%mean %nice) :: XX obsolete - ?: ?=([%ye ~] tea) - [~ fox] - ?> ?=([@ @ @ *] tea) - =/ her (slav %p i.t.tea) - =* pax t.t.tea - =< zork =< zank - %^ ~(rack am [our now fox ski]) her pax - :: ~& [%knap-ack ?-(+<.sih %mean `p.+.sih, %nice ~)] - ?-(+<.sih %mean `p.+.sih, %nice ~) - == - => %_(. fox q.fuy) - =| out=(list move) - |- ^- [p=(list move) q=_+>.^$] - ?~ p.fuy - [(flop out) +>.^$] - =^ toe fox (clop now hen i.p.fuy) - $(p.fuy t.p.fuy, out (weld (flop toe) out)) - == - :: - ++ knob - ~/ %knob - |= [hen=duct kyz=task:able] - ^- [(list move) _+>] - ?: ?=(%crud -.kyz) - [[[hen [%slip %d %flog kyz]] ~] +>] - ?: ?=(%west -.kyz) - :: a .cha path of /a/give/* is immediately acknowledged and - :: routed directly out to unix - :: - ?: ?=([%give *] q.kyz) - ~| [%ames-bad-duct %give from=p.kyz route=q.kyz] - ?> ?=(^ gad.fox) - :_ +>.$ - [[gad.fox %give kyz] [hen %give %mack ~] ~] - :: a .cha path of /a/pi is just a ping, immediately acknowledged - :: - ?> ?=([%pi ~] q.kyz) - :_ +>.$ - [[hen %give %mack ~] ~] - ?: ?=(%wegh -.kyz) - ~& %ames-weighing - [[hen %give %mass wegh]~ +>] - =+ ^= fuy - ^- [p=(list boon) q=fort] - ?- -.kyz - %barn - =: gad.fox hen - tuf.fox ~(turf-scry am [our now fox ski]) - == - [[%bock ~]~ fox] - :: - %bonk - :_ fox - ?~ tim.fox - ~& %ames-bonk-e - ~ - [%pito u.tim.fox]~ - :: - %hear - (~(gnaw am [our now fox ski]) %good p.kyz q.kyz) - :: - %halo - (~(gnaw am [our now fox ski]) %dead p.kyz q.kyz) - :: - %hole - (~(gnaw am [our now fox ski]) %dead p.kyz q.kyz) - :: - %init - :_ fox [[%sake ~] [%brew ~] ~] - :: - %kick - =^ ban fox (~(kick am [our now fox(hop p.kyz) ski]) hen) - :: +next:am called here because +wake calls +kick in a loop - :: - [(weld p.ban ~(next am [our now fox ski])) fox] - :: - %nuke - :- ~ - ?: (~(has in bad.fox) p.kyz) - ~& [%unblock p.kyz] - fox(bad (~(del in bad.fox) p.kyz)) - ~& [%block p.kyz] - fox(bad (~(put in bad.fox) p.kyz)) - :: - %sunk - =* who p.kyz - =* lyf q.kyz - ?: =(our who) - ?: (lth lyf p:(head val.ton.fox)) - :: replaying our old sinkage, ignore - :: XX review - :: - [~ fox] - :: XX include some helpful instructions here - :: - :_ fox - [%wine who ", you have sunk"]~ - :: - =: hoc.ton.fox (~(del by hoc.ton.fox) who) - wab.zac.fox (~(del by wab.zac.fox) who) - == - [[%wine who " has sunk"]~ fox] - :: - %vega - :: re-initialize our cryptosuite B cores - :: - =/ =wund - %+ turn - val.ton.fox - |= [=life =ring *] - [life ring (nol:nu:crub:crypto ring)] - [~ fox(val.ton wund)] - :: - %wake - (~(wake am [our now fox ski]) hen) - :: - %want - (~(wise am [our now fox ski]) hen p.kyz q.kyz r.kyz) - == - => %_(. fox q.fuy) - =| out=(list move) - |- ^- [p=(list move) q=_+>.^$] - ?~ p.fuy - [(flop out) +>.^$] - =^ toe fox (clop now hen i.p.fuy) - $(p.fuy t.p.fuy, out (weld (flop toe) out)) - :: - ++ temp - ~/ %temp - |= [his=ship tyl=path] - ^- (unit (unit cage)) - ?: ?=([?(%show %tell) *] tyl) - ?^ t.tyl [~ ~] - =+ zet=zest:(ho:~(um am [our now fox ski]) his) - ``[%noun ?:(=(%show i.tyl) !>(>zet<) !>(zet))] - ?: ?=([%pals ~] tyl) - ?. =(our his) - ~ - ``[%noun !>(pals:~(um am [our now fox ski]))] - ?: ?=([%time ~] tyl) - ?. =(our his) - ~ - ``[%noun !>(tim.fox)] - ~ - :: - ++ wegh - ^- mass - :+ %ames %| - :~ :+ %town %| - => ton.fox - :~ wund+&+val - deed+&+law - fast+&+seh - them+&+hoc - == - :+ %corn %| - => zac.fox - :~ incoming+&+nys - complete+&+olz - neighbor+&+wab - == - dot+&+fox - == - -- From 9d58e88c17c59de2edc43eecd93979d158b62937 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 22 Jul 2019 19:16:19 -0700 Subject: [PATCH 018/451] Fixed some larval bugs and kale integration --- pkg/arvo/sys/vane/alef.hoon | 116 ++++++++++++++++++------------------ 1 file changed, 59 insertions(+), 57 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index a2a7302c2..f02159f6c 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -57,6 +57,8 @@ =/ protocol-version=?(%0 %1 %2 %3 %4 %5 %6 %7) %0 =, ames =, able +=* point point:able:kale +=* vent-result vent-result:able:kale :: => |% @@ -314,35 +316,6 @@ +$ rank ?(%0 %1 %2 %3) :: +| %kinetics -:: -:: $point: TODO move to jael -:: -+$ point - $: =rift - =life - crypto-suite=@ud - encryption-key=pass - authentication-key=pass - sponsor=(unit @p) - == -:: $diff-point: TODO move to jael -:: -+$ diff-point - $% [%changed-continuity rift=@ud] - $: %changed-keys - =life - crypto-suite=@ud - continuity-number=@ud - encryption-key=@ud - == - [%new-sponsor sponsor=(unit @p)] - == -:: $vent-result: TODO move to jael -:: -+$ vent-result - $% [%full points=(map ship point)] - [%diff =ship diff-point] - == :: $channel: combined sender and receiver identifying data :: +$ channel @@ -674,7 +647,7 @@ $% [%wake error=(unit tang)] == == $: %k - $% [%private-keys =life =private-key] + $% [%private-keys =life vein=(map life ring)] [%public-keys =vent-result] [%turf turfs=(list turf)] == == @@ -760,7 +733,7 @@ =< =* adult-gate . =| queued-events=(qeu queued-event) :: - |= [our=ship eny=@ now=@da scry-gate=sley] + |= [our=ship now=@da eny=@ scry-gate=sley] =* larval-gate . =* adult-core (adult-gate +<) |% @@ -768,23 +741,31 @@ :: ++ call |= [=duct type=* wrapped-task=(hobo task)] + :: + =/ =task + ?. ?=(%soft -.wrapped-task) + wrapped-task + ;;(task p.wrapped-task) :: %born: set .unix-duct and start draining .queued-events :: - ?: ?=(%born -.wrapped-task) + ?: ?=(%born -.task) :: process %born using wrapped adult ames :: - =^ moves adult-gate (call:adult-core duct type wrapped-task) + =^ moves adult-gate (call:adult-core duct type task) :: if no events were queued up, metamorphose :: ?~ queued-events + ~& %alef-larva-metamorphose [moves adult-gate] + ~& %alef-larva-kick :: kick off a timer to process the first of .queued-events :: =. moves :_(moves [duct %pass /larva %b %wait now]) [moves larval-gate] + ~& %alef-larva-call :: any other event: enqueue it until we have a .unix-duct :: - =. queued-events (~(put to queued-events) %call duct type wrapped-task) + =. queued-events (~(put to queued-events) %call duct type task) [~ larval-gate] :: +take: handle response $sign :: @@ -793,11 +774,15 @@ :: enqueue event if not a larval drainage timer :: ?. =(/larva wire) + ~& %alef-larva-take =. queued-events (~(put to queued-events) %take wire duct type sign) [~ larval-gate] :: larval event drainage timer; pop and process a queued event :: - ?> ?=(%wake -.sign) + ?. ?=([%b %wake *] sign) + ~& %alef-larva-wtf^sign + [~ larval-gate] + ~& %alef-larva-wake =^ first-event queued-events ~(get to queued-events) =^ moves adult-gate ?- -.first-event @@ -807,18 +792,24 @@ :: .queued-events has been cleared; metamorphose :: ?~ queued-events + ~& %alef-metamorphosis [moves adult-gate] + ~& %alef-larva-drain :: set timer to drain next event :: =. moves :_(moves [duct %pass /larva %b %wait now]) [moves larval-gate] :: lifecycle arms; mostly pass-throughs to the contained adult ames :: + :: TODO: don't coerce the old state + :: ++ scry scry:adult-core - ++ stay [queued-events stay:adult-core] + ++ stay ~& %alef-larva-stay [queued-events ames-state.adult-gate] ++ load - |= old=_[queued-events stay:adult-core] + |= old=* ^+ larval-gate + ~& %alef-larva-load + => .(old ;;(_[queued-events ames-state.adult-gate] old)) :: =. queued-events -.old =. adult-gate (load:adult-core +.old) @@ -828,11 +819,13 @@ :: =< =| =ames-state -|= [our=ship eny=@ now=@da scry-gate=sley] +|= [our=ship now=@da eny=@ scry-gate=sley] =* ames-gate . |% :: +call: handle request $task :: +:: TODO: better %crud and %hole handling +:: ++ call |= [=duct type=* wrapped-task=(hobo task)] ^- [(list move) _ames-gate] @@ -842,15 +835,18 @@ wrapped-task ;;(task p.wrapped-task) :: - =/ event-core (per-event [our eny now scry-gate] duct ames-state) + =/ event-core (per-event [our now eny scry-gate] duct ames-state) :: =^ moves ames-state =< abet ?- -.task %born on-born:event-core - %crud !! + %crud ~| %ames-crud^p.task + %- (slog q.task) + event-core %hear (on-hear:event-core [lane blob]:task) - %hole !! + %hole ~| %ames-hole + event-core %init (on-init:event-core ship=p.task) %vega on-vega:event-core %wegh on-wegh:event-core @@ -864,7 +860,7 @@ |= [=wire =duct type=* =sign] ^- [(list move) _ames-gate] :: - =/ event-core (per-event [our eny now scry-gate] duct ames-state) + =/ event-core (per-event [our now eny scry-gate] duct ames-state) :: =^ moves ames-state =< abet @@ -874,7 +870,7 @@ :: [%b %wake *] (on-take-wake:event-core wire error.sign) :: - [%k %private-keys *] (on-priv:event-core [life private-key]:sign) + [%k %private-keys *] (on-priv:event-core [life vein]:sign) [%k %public-keys *] (on-publ:event-core wire vent-result.sign) [%k %turf *] (on-take-turf:event-core turfs.sign) == @@ -901,7 +897,7 @@ |% ++ per-event =| moves=(list move) - |= [[our=ship eny=@ now=@da scry-gate=sley] =duct =ames-state] + |= [[our=ship now=@da eny=@ scry-gate=sley] =duct =ames-state] |% ++ event-core . ++ abet [(flop moves) ames-state] @@ -1126,9 +1122,10 @@ :: +on-priv: set our private key to jael's response :: ++ on-priv - |= [=life =private-key] + |= [=life vein=(map life private-key)] ^+ event-core :: + =/ =private-key (~(got by vein) life) =. life.ames-state life =. crypto-core.ames-state (nol:nu:crub:crypto private-key) :: recalculate each peer's symmetric key @@ -1157,14 +1154,17 @@ :: |^ ^+ event-core ?- vent-result - [%diff @ %changed-continuity *] - (on-publ-breach [ship rift]:vent-result) + [%diff @ * %rift *] + (on-publ-breach [who rift.udiff]:vent-result) :: - [%diff @ %changed-keys *] - (on-publ-rekey [ship +>+]:vent-result) + [%diff @ * %keys *] + (on-publ-rekey [who +>.udiff]:vent-result) :: - [%diff @ %new-sponsor *] - (on-publ-sponsor [ship sponsor]:vent-result) + [%diff @ * %spon *] + (on-publ-sponsor [who sponsor.udiff]:vent-result) + :: + [%diff @ * %disavow ~] + (on-publ-sponsor [who ~]:vent-result) :: [%full *] (on-publ-full points.vent-result) == @@ -1190,12 +1190,11 @@ |= $: =ship =life crypto-suite=@ud - continuity-number=@ud - encryption-key=@ud + =public-key == ^+ event-core :: - (insert-peer-state ship (got-peer-state ship) life `@`encryption-key) + (insert-peer-state ship (got-peer-state ship) life public-key) :: +on-publ-sponsor: handle new or lost sponsor for self or peer :: :: TODO: handle sponsor loss @@ -1243,14 +1242,16 @@ |= [=ship =point] ^+ event-core :: - (insert-peer-state ship *peer-state [life `@`encryption-key]:point) + =/ =public-key pass:(~(got by keys.point) life.point) + (insert-peer-state ship *peer-state life.point public-key) :: ++ meet-alien |= [=ship =point todos=pending-requests] ^+ event-core :: + =/ =public-key pass:(~(got by keys.point) life.point) =. event-core - (insert-peer-state ship *peer-state [life `@`encryption-key]:point) + (insert-peer-state ship *peer-state life.point public-key) :: apply incoming packets :: =. event-core @@ -1310,7 +1311,8 @@ |= [=ship =point =peer-state] ^+ event-core :: - (insert-peer-state ship peer-state [life `@`encryption-key]:point) + =/ =public-key pass:(~(got by keys.point) life.point) + (insert-peer-state ship peer-state life.point public-key) -- :: ++ insert-peer-state From 4123674c9d0211e031614309866fceedc2f01c34 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 22 Jul 2019 19:26:38 -0700 Subject: [PATCH 019/451] WIP temporary changes to hoon and arvo --- pkg/arvo/sys/arvo.hoon | 3 ++- pkg/arvo/sys/hoon.hoon | 25 +++++++++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index 340f472db..cbb74c780 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -467,7 +467,7 @@ == :: ++ hurl :: start loop - |= {lac/? ovo/ovum} + |= {lac/_| ovo/ovum} ~? &(!lac !=(%belt -.q.ovo)) ["" %unix -.q.ovo p.ovo now] :: ^- {p/(list ovum) q/(pair worm (list {p/@tas q/vase}))} ^- {p/(list ovum) q=(list [label=@tas =vane])} @@ -755,6 +755,7 @@ :: In either case, they fall through here to be handled :: after the fact in +feck. :: + ~& %arvo-poke^-.q.ovo^p.ovo ?: ?=(?(%veer %verb %wack %warn) -.q.ovo) [[ovo ~] +>.$] :: diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 6eaf61d46..dd88b8d2d 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -14886,7 +14886,7 @@ ^= gen ^- hoon [%cnsg [%$ ~] [%$ 2] [%$ 3] ~] =+ gun=(~(mint ut typ) %noun gen) - [p.gun .*([q.gat q.sam] q.gun)] + [p.gun (slum q.gat q.sam)] :: ++ slab :: test if contains |= {cog/@tas typ/type} @@ -17268,36 +17268,49 @@ ~> %slog.[0 foo] [| +>+<.$] [& +>+<.$(nes (~(put in nes) [sut ref]))] + :: +play: +play:ut, cached :: - ++ play :: play:ut + ++ play |= {sut/type gen/hoon} ^- {type worm} =+ old=(~(get by pay) [sut gen]) ?^ old [u.old +>+<.$] =+ new=(~(play ut sut) gen) [new +>+<.$(pay (~(put by pay) [sut gen] new))] + :: +mint: +mint:ut to noun, cached :: - ++ mint :: mint:ut to noun + ++ mint |= {sut/type gen/hoon} ^- {(pair type nock) worm} =+ old=(~(get by mit) [sut gen]) ?^ old [u.old +>+<.$] =+ new=(~(mint ut sut) %noun gen) [new +>+<.$(mit (~(put by mit) [sut gen] new))] + :: +slam: +slam:ut, cached :: - ++ slap :: ++slap, cached + ++ slam + |= [gat=vase sam=vase] + =/ sut=type [%cell p.gat p.sam] + =/ gen=hoon [%cnsg [%$ ~] [%$ 2] [%$ 3] ~] + =^ new=type +>+<.$ (play sut gen) + [[new (slum q.gat q.sam)] +>+<.$] + :: +slap: +slap:ut, cached + :: + ++ slap |= {vax/vase gen/hoon} ^- {vase worm} =^ gun +>+< (mint p.vax gen) [[p.gun .*(q.vax q.gun)] +>+<.$] + :: +slot: +slot:ut, cached :: - ++ slot :: ++slot, cached + ++ slot |= {axe/@ vax/vase} ^- {vase worm} =^ gun +>+< (mint p.vax [%$ axe]) [[p.gun .*(q.vax [0 axe])] +>+<.$] + :: +slym: +slym:ut, cached :: - ++ slym :: ++slym, cached + ++ slym |= {gat/vase sam/*} ^- [vase worm] (slap gat(+<.q sam) [%limb %$]) From 39ae901c7b7717ba15c9d96804d4a278dde6e105 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 23 Jul 2019 14:36:01 -0700 Subject: [PATCH 020/451] wip moar prints --- pkg/arvo/sys/arvo.hoon | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 4 ++-- pkg/arvo/sys/vane/behn.hoon | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index cbb74c780..8be9845cf 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -467,7 +467,7 @@ == :: ++ hurl :: start loop - |= {lac/_| ovo/ovum} + |= {lac/? ovo/ovum} ~? &(!lac !=(%belt -.q.ovo)) ["" %unix -.q.ovo p.ovo now] :: ^- {p/(list ovum) q/(pair worm (list {p/@tas q/vase}))} ^- {p/(list ovum) q=(list [label=@tas =vane])} @@ -650,7 +650,7 @@ :: =/ pit=vase !>(..is) :: =/ vil=vile (viol p.pit) :: cached reflexives -=| $: lac=_& :: laconic bit +=| $: lac=_| :: laconic bit eny=@ :: entropy our=ship :: identity bud=vase :: %zuse diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index f02159f6c..dd313f363 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -841,11 +841,11 @@ =< abet ?- -.task %born on-born:event-core - %crud ~| %ames-crud^p.task + %crud ~& %ames-crud^p.task %- (slog q.task) event-core %hear (on-hear:event-core [lane blob]:task) - %hole ~| %ames-hole + %hole ~& %ames-hole event-core %init (on-init:event-core ship=p.task) %vega on-vega:event-core diff --git a/pkg/arvo/sys/vane/behn.hoon b/pkg/arvo/sys/vane/behn.hoon index 2dba6d501..9f9fc6f2f 100644 --- a/pkg/arvo/sys/vane/behn.hoon +++ b/pkg/arvo/sys/vane/behn.hoon @@ -63,6 +63,8 @@ :: ?: =(~ timers.state) ~| %behn-crud-no-timer^tag^error !! :: + ~& %behn-crud-tag^tag + %- (slog error) (wake `error) :: +rest: cancel the timer at :date, then adjust unix wakeup :: +wait: set a new timer at :date, then adjust unix wakeup From 3f9148ac4c83730135c1b2afb8d3c948a690cb3d Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 23 Jul 2019 16:20:21 -0700 Subject: [PATCH 021/451] alef boot better and kill direct routes better; still has bug in +send-blob --- pkg/arvo/sys/vane/alef.hoon | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index dd313f363..476c2c07b 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1084,9 +1084,11 @@ =/ ship-state (~(get by peers.ames-state) ship) :: ?. ?=([~ %known *] ship-state) + ~& %alef-on-memo-enqueue-alien %+ enqueue-alien-todo ship |= todos=pending-requests todos(snd-messages [[duct message] snd-messages.todos]) + ~& %alef-on-memo-known :: =/ =peer-state +.u.ship-state =/ =channel [[our ship] now +>.ames-state -.peer-state] @@ -1115,8 +1117,8 @@ |= our=ship ^+ event-core :: - =~ (emit duct %pass /public-keys %k %public-keys [n=our ~ ~]) - (emit duct %pass /private-keys %k %private-keys ~) + =~ (emit duct %pass /private-keys %k %private-keys ~) + (emit duct %pass /public-keys %k %public-keys [n=our ~ ~]) (emit duct %pass /turf %k %turf ~) == :: +on-priv: set our private key to jael's response @@ -1248,6 +1250,7 @@ ++ meet-alien |= [=ship =point todos=pending-requests] ^+ event-core + ~& %alef-meet-alien^ship :: =/ =public-key pass:(~(got by keys.point) life.point) =. event-core @@ -1407,26 +1410,34 @@ =/ ship-state (~(get by peers.ames-state) ship) :: ?. ?=([~ %known *] ship-state) + ~& %alef-send-blob-alien %+ enqueue-alien-todo ship |= todos=pending-requests todos(snd-packets (~(put in snd-packets.todos) blob)) + ~& %alef-send-blob-known :: =/ =peer-state +.u.ship-state =/ =channel [[our ship] now +>.ames-state -.peer-state] :: =* try-next-sponsor ?: =(ship her-sponsor.channel) + ~& %alef-send-blob-ship-eq-her-sponsor event-core + ~& %alef-send-blob-try-next-recurse $(ship her-sponsor.channel) :: ?~ route=route.peer-state + ~& %alef-send-blob-no-route try-next-sponsor :: + ~& %alef-send-blob-emit-to^ship =. event-core (emit unix-duct.ames-state %give %send lane.u.route blob) :: ?: direct.u.route + ~& %alef-send-blob-direct-done event-core + ~& %alef-send-blob-indirect-try-next try-next-sponsor :: +got-peer-state: lookup .her state or crash :: @@ -1486,7 +1497,9 @@ :: transport address has changed and this lane is no longer :: valid. :: - =. route.peer-state `[direct=%.n lane:(need route.peer-state)] + =? route.peer-state + &(?=(^ route.peer-state) direct.u.route.peer-state) + route.peer-state(direct.u %.n) :: (run-message-pump bone %wake ~) :: +run-message-pump: process $message-pump-task and its effects @@ -1510,6 +1523,7 @@ |^ ^+ peer-core ?~ pump-gifts peer-core =* gift i.pump-gifts + ~& %alef-on-pump-gift^-.gift =. peer-core ?- -.gift %done (on-pump-done [message-num ok]:gift) @@ -1552,7 +1566,7 @@ =. nax.peer-state (~(put in nax.peer-state) nax-key) :: peer-core - :: +on-pump-send: emit ack packet requested by |message-pump + :: +on-pump-send: emit message fragment requested by |message-pump :: ++ on-pump-send |= =static-fragment @@ -1975,9 +1989,11 @@ ++ feed |= fragments=(list static-fragment) ^+ [fragments gifts state] + ~& %alef-feed^(lent fragments) :: return unsent back to caller and reverse effects to finalize :: - =- [unsent (flop gifts) state] + =- ~& %alef-feed-unsent^(lent unsent) + [unsent (flop gifts) state] :: ^+ [unsent=fragments packet-pump] :: resend lost packets first, possibly adjusting congestion control @@ -2462,6 +2478,8 @@ |= [=public-key =private-key] ^- symmetric-key :: + ~| [public-key=public-key private-key=private-key] + :: ?> =('b' (end 3 1 public-key)) =. public-key (rsh 8 1 (rsh 3 1 public-key)) :: From 22c26414c11b70d0686013173a61b9130e5532c6 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 23 Jul 2019 16:55:35 -0700 Subject: [PATCH 022/451] more fixes to routing and sending --- pkg/arvo/sys/vane/alef.hoon | 40 +++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 476c2c07b..8c889b337 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -804,16 +804,26 @@ :: TODO: don't coerce the old state :: ++ scry scry:adult-core - ++ stay ~& %alef-larva-stay [queued-events ames-state.adult-gate] + ++ stay ~& %alef-larva-stay [%larva queued-events ames-state.adult-gate] ++ load - |= old=* - ^+ larval-gate + |= old-raw=* ~& %alef-larva-load - => .(old ;;(_[queued-events ames-state.adult-gate] old)) :: - =. queued-events -.old - =. adult-gate (load:adult-core +.old) - larval-gate + =/ old + ;; $% [%larva events=_queued-events state=_ames-state.adult-gate] + [%adult state=_ames-state.adult-gate] + == + old-raw + :: + ?- -.old + %adult + (load:adult-core state.old) + :: + %larva + =. queued-events events.old + =. adult-gate (load:adult-core state.old) + larval-gate + == -- :: adult ames, after metamorphosis from larva :: @@ -833,6 +843,7 @@ =/ =task ?. ?=(%soft -.wrapped-task) wrapped-task + ~| %alef-bad-task^p.wrapped-task ;;(task p.wrapped-task) :: =/ event-core (per-event [our now eny scry-gate] duct ames-state) @@ -878,12 +889,12 @@ [moves ames-gate] :: +stay: extract state before reload :: -++ stay ames-state +++ stay [%adult ames-state] :: +load: load in old state after reload :: ++ load - |= old=^ames-state - ames-gate(ames-state old) + |= old-state=_ames-state + ames-gate(ames-state old-state) :: +scry: dereference namespace :: ++ scry @@ -1328,6 +1339,10 @@ =. life.peer-state life =. public-key.peer-state public-key =. symmetric-key.peer-state symmetric-key + :: automatically set galaxy route, since unix handles lookup + :: + =? route.peer-state ?=(%czar (clan:title ship)) + `[direct=%.y lane=[%& ship]] :: =. peers.ames-state (~(put by peers.ames-state) ship %known peer-state) @@ -1498,7 +1513,10 @@ :: valid. :: =? route.peer-state - &(?=(^ route.peer-state) direct.u.route.peer-state) + ?& ?=(^ route.peer-state) + direct.u.route.peer-state + !=(%czar (clan:title her.channel)) + == route.peer-state(direct.u %.n) :: (run-message-pump bone %wake ~) From bccfb2a94bb42f37dbf4a201b9d051344bda27ad Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 23 Jul 2019 17:31:35 -0700 Subject: [PATCH 023/451] fix vere lane recv --- pkg/urbit/vere/ames.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/urbit/vere/ames.c b/pkg/urbit/vere/ames.c index 24d519e83..f1c2809d2 100644 --- a/pkg/urbit/vere/ames.c +++ b/pkg/urbit/vere/ames.c @@ -375,7 +375,7 @@ _ames_recv_cb(uv_udp_t* wax_u, u3_pier_plan (u3nt(u3_blip, c3__ames, u3_nul), - u3nt(c3__hear, lan, msg)); + u3nt(c3__hear, u3nc(c3n, lan), msg)); #endif } _ames_free(buf_u->base); From 05f65a454cc334633a8f3c84d4888b1e716a75dc Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 23 Jul 2019 17:31:51 -0700 Subject: [PATCH 024/451] filter out packets to self --- pkg/arvo/sys/vane/alef.hoon | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 8c889b337..d01fb9b84 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -954,13 +954,20 @@ |= [=lane =packet] ^+ event-core :: + ?: =(our sndr.packet) + ~& %alef-self + event-core + :: %. [lane packet] :: ?. =(our rcvr.packet) + ~& %alef-on-hear-forward on-hear-forward :: ?: encrypted.packet + ~& %alef-on-hear-shut on-hear-shut + ~& %alef-on-hear-open on-hear-open :: +on-hear-forward: maybe forward a packet to someone else :: @@ -1425,34 +1432,26 @@ =/ ship-state (~(get by peers.ames-state) ship) :: ?. ?=([~ %known *] ship-state) - ~& %alef-send-blob-alien %+ enqueue-alien-todo ship |= todos=pending-requests todos(snd-packets (~(put in snd-packets.todos) blob)) - ~& %alef-send-blob-known :: =/ =peer-state +.u.ship-state =/ =channel [[our ship] now +>.ames-state -.peer-state] :: =* try-next-sponsor ?: =(ship her-sponsor.channel) - ~& %alef-send-blob-ship-eq-her-sponsor event-core - ~& %alef-send-blob-try-next-recurse $(ship her-sponsor.channel) :: ?~ route=route.peer-state - ~& %alef-send-blob-no-route try-next-sponsor :: - ~& %alef-send-blob-emit-to^ship =. event-core (emit unix-duct.ames-state %give %send lane.u.route blob) :: ?: direct.u.route - ~& %alef-send-blob-direct-done event-core - ~& %alef-send-blob-indirect-try-next try-next-sponsor :: +got-peer-state: lookup .her state or crash :: From f09d7a4d7cd32b37332fdc63987221a1c706304b Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 24 Jul 2019 15:55:43 -0700 Subject: [PATCH 025/451] ames.c now works; fixed multiple bugs with help from @joemfb --- pkg/urbit/vere/ames.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pkg/urbit/vere/ames.c b/pkg/urbit/vere/ames.c index f1c2809d2..96f9a796a 100644 --- a/pkg/urbit/vere/ames.c +++ b/pkg/urbit/vere/ames.c @@ -88,7 +88,6 @@ _ames_send(u3_pact* pac_u) add_u.sin_port = htons(pac_u->por_s); uv_buf_t buf_u = uv_buf_init((c3_c*)pac_u->hun_y, pac_u->len_w); - c3_i sas_i; if ( 0 != (sas_i = uv_udp_send(&pac_u->snd_u, @@ -197,6 +196,8 @@ u3_ames_decode_lane(u3_atom lan) { u3_lane lan_u; lan_u.pip_w = u3r_word(0, pip); + c3_assert( _(u3a_is_cat(por)) ); + c3_assert( por < 65536 ); lan_u.por_s = por; u3z(pip); u3z(por); @@ -308,6 +309,8 @@ u3_ames_ef_send(u3_pier* pir_u, u3_noun lan, u3_noun pac) pac_u->len_w = u3r_met(3, pac); pac_u->hun_y = c3_malloc(pac_u->len_w); + u3r_bytes(0, pac_u->len_w, pac_u->hun_y, pac); + u3_noun tag, val; u3x_cell(lan, &tag, &val); c3_assert( (c3y == tag) || (c3n == tag) ); @@ -317,7 +320,8 @@ u3_ames_ef_send(u3_pier* pir_u, u3_noun lan, u3_noun pac) if ( c3y == tag ) { c3_assert( c3y == u3a_is_cat(val) ); c3_assert( val < 256 ); - + + pac_u->imp_y = val; _ames_czar(pac_u, sam_u->dns_c); } // non-galaxy lane @@ -372,10 +376,9 @@ _ames_recv_cb(uv_udp_t* wax_u, lan_u.por_s = ntohs(add_u->sin_port); lan_u.pip_w = ntohl(add_u->sin_addr.s_addr); u3_noun lan = u3_ames_encode_lane(lan_u); + u3_noun mov = u3nt(c3__hear, u3nc(c3n, lan), msg); - u3_pier_plan - (u3nt(u3_blip, c3__ames, u3_nul), - u3nt(c3__hear, u3nc(c3n, lan), msg)); + u3_pier_plan(u3nt(u3_blip, c3__ames, u3_nul), mov); #endif } _ames_free(buf_u->base); @@ -563,6 +566,7 @@ u3_ames_io_init(u3_pier* pir_u) void u3_ames_io_talk(u3_pier* pir_u) { + _ames_io_start(pir_u); } /* u3_ames_io_exit(): terminate ames I/O. From 221ae19b58b074d15c9b4334cf3cff9b461f5efb Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 24 Jul 2019 15:56:13 -0700 Subject: [PATCH 026/451] todo on alef born --- pkg/arvo/sys/vane/alef.hoon | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index d01fb9b84..cc225157c 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1378,9 +1378,12 @@ dot+&+ames-state == :: +on-born: handle unix process restart - :: +on-vega: handle kernel reload + :: + :: TODO: scry into jael and emit turf on %born :: ++ on-born event-core(unix-duct.ames-state duct) + :: +on-vega: handle kernel reload + :: ++ on-vega event-core :: +enqueue-alien-todo: helper to enqueue a pending request :: From c7c0c6334f703c06b97846951cf786af340b61a5 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 24 Jul 2019 18:01:01 -0700 Subject: [PATCH 027/451] serial experiments lane; fixed some bugs but still bail:fouls --- pkg/urbit/include/vere/vere.h | 1 - pkg/urbit/vere/ames.c | 25 +++++++------------------ 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/pkg/urbit/include/vere/vere.h b/pkg/urbit/include/vere/vere.h index dd40067b1..953669ee1 100644 --- a/pkg/urbit/include/vere/vere.h +++ b/pkg/urbit/include/vere/vere.h @@ -337,7 +337,6 @@ uv_udp_t wax_u; uv_handle_t had_u; }; - uv_timer_t tim_u; // XX temporary timer c3_o liv; // listener on c3_o alm; // alarm on c3_s por_s; // public IPv4 port diff --git a/pkg/urbit/vere/ames.c b/pkg/urbit/vere/ames.c index 96f9a796a..5bee06610 100644 --- a/pkg/urbit/vere/ames.c +++ b/pkg/urbit/vere/ames.c @@ -190,17 +190,20 @@ u3_lane u3_ames_decode_lane(u3_atom lan) { u3_noun cud, tag, pip, por; + c3_assert( _(u3a_is_atom(lan)) ); + u3m_p("to-cue", lan); cud = u3ke_cue(lan); u3x_trel(cud, &tag, &pip, &por); c3_assert( c3__ipv4 == tag ); u3_lane lan_u; lan_u.pip_w = u3r_word(0, pip); + u3z(pip); + c3_assert( _(u3a_is_cat(por)) ); c3_assert( por < 65536 ); lan_u.por_s = por; - u3z(pip); u3z(por); return lan_u; } @@ -311,6 +314,8 @@ u3_ames_ef_send(u3_pier* pir_u, u3_noun lan, u3_noun pac) u3r_bytes(0, pac_u->len_w, pac_u->hun_y, pac); + u3m_p("lan", lan); + u3_noun tag, val; u3x_cell(lan, &tag, &val); c3_assert( (c3y == tag) || (c3n == tag) ); @@ -327,7 +332,7 @@ u3_ames_ef_send(u3_pier* pir_u, u3_noun lan, u3_noun pac) // non-galaxy lane // else { - u3_lane lan_u = u3_ames_decode_lane(lan); + u3_lane lan_u = u3_ames_decode_lane(val); // convert incoming localhost to outgoing localhost // lan_u.pip_w = ( 0 == lan_u.pip_w )? 0x7f000001 : lan_u.pip_w; @@ -345,7 +350,6 @@ u3_ames_ef_send(u3_pier* pir_u, u3_noun lan, u3_noun pac) _ames_send(pac_u); } } - u3z(tag); u3z(val); } /* _ames_recv_cb(): receive callback. @@ -385,15 +389,6 @@ _ames_recv_cb(uv_udp_t* wax_u, } } -/* _ames_timer_cb(): wake up ames -*/ -static void -_ames_timer_cb(uv_timer_t* tim_u) -{ - u3_pier_plan(u3nt(u3_blip, c3__ames, u3_nul), - u3nc(c3__wake, u3_nul)); -} - /* _ames_io_start(): initialize ames I/O. */ static void @@ -463,8 +458,6 @@ _ames_io_start(u3_pier* pir_u) sam_u->liv = c3y; u3z(rac); u3z(who); - - uv_timer_start(&sam_u->tim_u, _ames_timer_cb, 300 * 1000, 300 * 1000); } /* _cttp_mcut_char(): measure/cut character. @@ -557,8 +550,6 @@ u3_ames_io_init(u3_pier* pir_u) { u3_ames* sam_u = pir_u->sam_u; sam_u->liv = c3n; - - uv_timer_init(u3L, &sam_u->tim_u); } /* u3_ames_io_talk(): start receiving ames traffic. @@ -580,6 +571,4 @@ u3_ames_io_exit(u3_pier* pir_u) // XX remove had_u/wax_u union, cast and close wax_u uv_close(&sam_u->had_u, 0); } - - uv_close((uv_handle_t*)&sam_u->tim_u, 0); } From de9ff11560ab72f3857b19e3647a5e1d322ed947 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 25 Jul 2019 14:50:08 -0700 Subject: [PATCH 028/451] |hi ~nec successful --- pkg/arvo/sys/vane/alef.hoon | 29 ++++++++++++++++++++++++----- pkg/arvo/sys/vane/gall.hoon | 5 ++++- pkg/urbit/tests/ames_tests.c | 4 +++- pkg/urbit/vere/ames.c | 6 +++++- pkg/urbit/vere/reck.c | 3 +++ 5 files changed, 39 insertions(+), 8 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index cc225157c..5fefce855 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -856,8 +856,7 @@ %- (slog q.task) event-core %hear (on-hear:event-core [lane blob]:task) - %hole ~& %ames-hole - event-core + %hole (on-hole:event-core [lane blob]:task) %init (on-init:event-core ship=p.task) %vega on-vega:event-core %wegh on-wegh:event-core @@ -912,7 +911,12 @@ |% ++ event-core . ++ abet [(flop moves) ames-state] - ++ emit |=(=move event-core(moves [move moves])) + :: TODO reenable after debug + ::++ emit |=(=move event-core(moves [move moves])) + ++ emit + |= =move + ~& %alef-emit^move + event-core(moves [move moves]) :: +on-take-done: handle notice from vane that it processed a message :: ++ on-take-done @@ -948,6 +952,16 @@ ^+ event-core :: (on-hear-packet lane (decode-packet blob)) + :: +on-hole: handle packet crash notification + :: + :: TODO: retry processing and nack if possible + :: + ++ on-hole + |= [=lane =blob] + ^+ event-core + :: + ~& %ames-hole + event-core :: +on-hear-packet: handle mildly processed packet receipt :: ++ on-hear-packet @@ -1077,6 +1091,9 @@ ?> =(rcvr-life.shut-packet our-life.channel) :: set .lane as new route to peer since packet is valid :: + :: TODO: enable (only disabled for testing) + ::=? route.peer-state !=(%czar (clan:title her.channel)) + :: `[direct=%.y lane] =. route.peer-state `[direct=%.y lane] :: =/ peer-core (make-peer-core peer-state channel) @@ -1659,8 +1676,10 @@ ++ on-still-memo |= [=message-num =message] ^+ peer-core + :: pop first element off .path.message as .target-vane :: - ?> ?=([?(%a %c %g %k) *] path.message) + =^ target-vane path.message + ?>(?=([?(%a %c %g %k) *] path.message) path.message) :: odd .bone; "request" message to pass to vane before acking :: ?: =(1 (end 0 1 bone)) @@ -1673,7 +1692,7 @@ =^ client-duct ossuary.peer-state (get-duct ossuary.peer-state bone duct) :: - ?- i.path.message + ?- target-vane %a ~| %bad-ames-message^path.message^her.channel !! %c (emit client-duct %pass wire %c %memo her.channel message) %g (emit client-duct %pass wire %g %memo her.channel message) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 7f9c740f8..2f2f9bcf8 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -484,8 +484,9 @@ :: ++ mo-gawk :: ames forward |= {him/@p dap/dude num/@ud rok/rook} - =. +> ?.(?=($u -.rok) +> (mo-give %done ~)) + =? +> ?=(%u -.rok) (mo-give %done ~) %+ mo-pass + =- ~& %gall-pass^- - [%sys %req (scot %p him) dap (scot %ud num) ~] ^- note-arvo ?- -.rok @@ -1290,11 +1291,13 @@ [~ ..^$(sys.mast.all hen)] :: %memo + ~& %gall-memo-path^path.message.q.hic ?> ?=([%ge @ ~] path.message.q.hic) =/ him=ship ship.q.hic =* dap i.t.path.message.q.hic :: =+ mes=;;([@ud rook] payload.message.q.hic) + ~& %gall-memo-coerced =< mo-abet (mo-gawk:(mo-abed:mo hen) him dap mes) :: diff --git a/pkg/urbit/tests/ames_tests.c b/pkg/urbit/tests/ames_tests.c index a8cdafc66..8fecb209d 100644 --- a/pkg/urbit/tests/ames_tests.c +++ b/pkg/urbit/tests/ames_tests.c @@ -19,7 +19,9 @@ _test_ames(void) lan_u.pip_w = 0x7f000001; lan_u.por_s = 12345; - u3_lane nal_u = u3_ames_decode_lane(u3_ames_encode_lane(lan_u)); + u3_noun lan = u3_ames_encode_lane(lan_u); + u3_lane nal_u = u3_ames_decode_lane(u3k(lan)); + u3_lane nal_u2 = u3_ames_decode_lane(lan); if ( !(lan_u.pip_w == nal_u.pip_w && lan_u.por_s == nal_u.por_s) ) { fprintf(stderr, "ames: lane fail (a)\r\n"); diff --git a/pkg/urbit/vere/ames.c b/pkg/urbit/vere/ames.c index 5bee06610..9213449bd 100644 --- a/pkg/urbit/vere/ames.c +++ b/pkg/urbit/vere/ames.c @@ -191,6 +191,7 @@ u3_ames_decode_lane(u3_atom lan) { u3_noun cud, tag, pip, por; c3_assert( _(u3a_is_atom(lan)) ); + u3l_log("refcount %d\n", u3a_use(lan)); u3m_p("to-cue", lan); cud = u3ke_cue(lan); u3x_trel(cud, &tag, &pip, &por); @@ -198,6 +199,7 @@ u3_ames_decode_lane(u3_atom lan) { u3_lane lan_u; lan_u.pip_w = u3r_word(0, pip); + u3l_log("pip_w %ull\n", lan_u.pip_w); u3z(pip); c3_assert( _(u3a_is_cat(por)) ); @@ -315,6 +317,7 @@ u3_ames_ef_send(u3_pier* pir_u, u3_noun lan, u3_noun pac) u3r_bytes(0, pac_u->len_w, pac_u->hun_y, pac); u3m_p("lan", lan); + u3l_log("lan-ref %d\n", u3a_use(lan)); u3_noun tag, val; u3x_cell(lan, &tag, &val); @@ -332,7 +335,8 @@ u3_ames_ef_send(u3_pier* pir_u, u3_noun lan, u3_noun pac) // non-galaxy lane // else { - u3_lane lan_u = u3_ames_decode_lane(val); + u3l_log("val-ref %d\n", u3a_use(val)); + u3_lane lan_u = u3_ames_decode_lane(u3k(val)); // convert incoming localhost to outgoing localhost // lan_u.pip_w = ( 0 == lan_u.pip_w )? 0x7f000001 : lan_u.pip_w; diff --git a/pkg/urbit/vere/reck.c b/pkg/urbit/vere/reck.c index 74556acd6..7b5c3ecca 100644 --- a/pkg/urbit/vere/reck.c +++ b/pkg/urbit/vere/reck.c @@ -200,6 +200,9 @@ _reck_kick_newt(u3_pier* pir_u, u3_noun pox, u3_noun fav) default: break; case c3__send: { + u3m_p("fav", fav); + u3l_log("fav-ref %d\n", u3a_use(fav)); + u3_noun lan = u3k(u3h(u3t(fav))); u3_noun pac = u3k(u3t(u3t(fav))); From 1f1c75ccb07183fbc3956d41af278bbd62542996 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 25 Jul 2019 15:56:33 -0700 Subject: [PATCH 029/451] Cleanup, remove printfs --- pkg/arvo/sys/arvo.hoon | 3 +-- pkg/arvo/sys/vane/alef.hoon | 16 +++++----------- pkg/urbit/vere/ames.c | 8 -------- pkg/urbit/vere/reck.c | 3 --- 4 files changed, 6 insertions(+), 24 deletions(-) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index 8be9845cf..340f472db 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -650,7 +650,7 @@ :: =/ pit=vase !>(..is) :: =/ vil=vile (viol p.pit) :: cached reflexives -=| $: lac=_| :: laconic bit +=| $: lac=_& :: laconic bit eny=@ :: entropy our=ship :: identity bud=vase :: %zuse @@ -755,7 +755,6 @@ :: In either case, they fall through here to be handled :: after the fact in +feck. :: - ~& %arvo-poke^-.q.ovo^p.ovo ?: ?=(?(%veer %verb %wack %warn) -.q.ovo) [[ovo ~] +>.$] :: diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 5fefce855..987b278e9 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -911,12 +911,7 @@ |% ++ event-core . ++ abet [(flop moves) ames-state] - :: TODO reenable after debug - ::++ emit |=(=move event-core(moves [move moves])) - ++ emit - |= =move - ~& %alef-emit^move - event-core(moves [move moves]) + ++ emit |=(=move event-core(moves [move moves])) :: +on-take-done: handle notice from vane that it processed a message :: ++ on-take-done @@ -1091,10 +1086,8 @@ ?> =(rcvr-life.shut-packet our-life.channel) :: set .lane as new route to peer since packet is valid :: - :: TODO: enable (only disabled for testing) - ::=? route.peer-state !=(%czar (clan:title her.channel)) - :: `[direct=%.y lane] - =. route.peer-state `[direct=%.y lane] + =? route.peer-state !=(%czar (clan:title her.channel)) + `[direct=%.y lane] :: =/ peer-core (make-peer-core peer-state channel) abet:(on-hear-shut-packet:peer-core lane shut-packet) @@ -1522,7 +1515,8 @@ :: TODO: handle error :: ?^ error - !! + ~| %ames-wake-error + (mean u.error) :: expire direct route :: :: Since a packet's timer expired, mark the .lane.route as diff --git a/pkg/urbit/vere/ames.c b/pkg/urbit/vere/ames.c index 9213449bd..1156cb67b 100644 --- a/pkg/urbit/vere/ames.c +++ b/pkg/urbit/vere/ames.c @@ -190,16 +190,12 @@ u3_lane u3_ames_decode_lane(u3_atom lan) { u3_noun cud, tag, pip, por; - c3_assert( _(u3a_is_atom(lan)) ); - u3l_log("refcount %d\n", u3a_use(lan)); - u3m_p("to-cue", lan); cud = u3ke_cue(lan); u3x_trel(cud, &tag, &pip, &por); c3_assert( c3__ipv4 == tag ); u3_lane lan_u; lan_u.pip_w = u3r_word(0, pip); - u3l_log("pip_w %ull\n", lan_u.pip_w); u3z(pip); c3_assert( _(u3a_is_cat(por)) ); @@ -316,9 +312,6 @@ u3_ames_ef_send(u3_pier* pir_u, u3_noun lan, u3_noun pac) u3r_bytes(0, pac_u->len_w, pac_u->hun_y, pac); - u3m_p("lan", lan); - u3l_log("lan-ref %d\n", u3a_use(lan)); - u3_noun tag, val; u3x_cell(lan, &tag, &val); c3_assert( (c3y == tag) || (c3n == tag) ); @@ -335,7 +328,6 @@ u3_ames_ef_send(u3_pier* pir_u, u3_noun lan, u3_noun pac) // non-galaxy lane // else { - u3l_log("val-ref %d\n", u3a_use(val)); u3_lane lan_u = u3_ames_decode_lane(u3k(val)); // convert incoming localhost to outgoing localhost // diff --git a/pkg/urbit/vere/reck.c b/pkg/urbit/vere/reck.c index 7b5c3ecca..74556acd6 100644 --- a/pkg/urbit/vere/reck.c +++ b/pkg/urbit/vere/reck.c @@ -200,9 +200,6 @@ _reck_kick_newt(u3_pier* pir_u, u3_noun pox, u3_noun fav) default: break; case c3__send: { - u3m_p("fav", fav); - u3l_log("fav-ref %d\n", u3a_use(fav)); - u3_noun lan = u3k(u3h(u3t(fav))); u3_noun pac = u3k(u3t(u3t(fav))); From fdb20a7528b8de2b25984cac0981c8f7c5dded65 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sun, 28 Jul 2019 00:50:32 -0700 Subject: [PATCH 030/451] %plea and %boon; might not compile --- pkg/arvo/sys/vane/alef.hoon | 254 +++++++++++++++++++++--------------- pkg/arvo/sys/zuse.hoon | 42 +++--- 2 files changed, 167 insertions(+), 129 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 987b278e9..210e59485 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -301,6 +301,7 @@ +$ bone @udbone +$ fragment @uwfragment +$ fragment-num @udfragmentnum ++$ message-blob @udmessageblob +$ message-num @udmessagenum +$ private-key @uwprivatekey +$ public-key @uwpublickey @@ -410,11 +411,12 @@ :: $pending-requests: what to do when we learn a peer's life and keys :: :: rcv-packets: packets we've received from unix -:: snd-messages: messages local vanes have asked us to send +:: snd-messages: pleas local vanes have asked us to send +:: snd-packets: packets we've tried to send :: +$ pending-requests $: rcv-packets=(list [=lane =packet]) - snd-messages=(list [=duct =message]) + snd-messages=(list [=duct =plea]) snd-packets=(set =blob) == :: $peer-state: state for a peer with known life and keys @@ -511,7 +513,7 @@ +$ message-pump-state $: current=_`message-num`1 next=_`message-num`1 - unsent-messages=(qeu message) + unsent-messages=(qeu message-blob) unsent-fragments=(list static-fragment) queued-message-acks=(map message-num ok=?) =packet-pump-state @@ -572,7 +574,7 @@ +$ message-still-state $: last-acked=message-num last-heard=message-num - pending-vane-ack=(qeu [=message-num =message]) + pending-vane-ack=(qeu [=message-num message=*]) live-messages=(map message-num partial-rcv-message) nax=(set message-num) == @@ -603,11 +605,11 @@ :: :: TODO: specialize gall interface for subscription management :: -:: Ames passes a %memo note to another vane when it receives a +:: Ames passes a %plea note to another vane when it receives a :: message on a "forward flow" from a peer, originally passed from :: one of the peer's vanes to the peer's Ames. :: -:: Ames passes a %memo to itself to trigger a heartbeat message to +:: Ames passes a %plea to itself to trigger a heartbeat message to :: our sponsor. :: :: Ames passes a %private-keys to Jael to request our private keys. @@ -626,11 +628,11 @@ [%turf ~] == == $: @tas - $% [%memo =ship =message] + $% [%plea =ship =plea] == == == :: $sign: response from other vane :: -:: A vane gives a %memo sign to Ames on a duct on which it had +:: A vane gives a %boon sign to Ames on a duct on which it had :: previously received a message on a "forward flow". Ames will :: transmit the message to the peer that had originally sent the :: message on the forward flow. The peer's Ames will then give the @@ -653,7 +655,7 @@ == == $: @tas $% [%done error=(unit error)] - [%memo =message] + [%boon payload=*] == == == :: $message-pump-task: job for |message-pump :: @@ -662,7 +664,7 @@ :: %wake: handle timer firing :: +$ message-pump-task - $% [%memo =message] + $% [%memo =message-blob] [%hear =message-num =ack-meat] [%wake ~] == @@ -716,12 +718,11 @@ == :: $message-still-gift: effect from |message-still :: -:: %memo: $message assembled from received packets, -:: to be sent to a local vane for processing +:: %memo: assembled from received packets :: %send: emit an ack packet :: +$ message-still-gift - $% [%memo =message-num =message] + $% [%memo =message-num message=*] [%send =message-num =ack-meat] == -- @@ -860,7 +861,7 @@ %init (on-init:event-core ship=p.task) %vega on-vega:event-core %wegh on-wegh:event-core - %memo (on-memo:event-core [ship message]:task) + %plea (on-plea:event-core [ship plea]:task) == :: [moves ames-gate] @@ -876,7 +877,7 @@ =< abet ?- sign [@ %done *] (on-take-done:event-core wire error.sign) - [@ %memo *] (on-take-memo:event-core wire message.sign) + [@ %boon *] (on-take-boon:event-core wire payload.sign) :: [%b %wake *] (on-take-wake:event-core wire error.sign) :: @@ -925,21 +926,24 @@ :: =/ =peer-state (got-peer-state her) =/ =channel [[our her] now +>.ames-state -.peer-state] - =/ peer-core (make-peer-core peer-state channel) - =/ ok=? ?=(~ error) - :: send message (n)ack packet + :: if processing succeded, send positive ack packet and exit :: - =. event-core abet:(run-message-still:peer-core bone %done ok) - :: if positive ack, we're done + ?~ error + =/ peer-core (make-peer-core peer-state channel) + abet:(run-message-still:peer-core bone %done ok=%.y) + :: failed; send message nack packet :: - ?: ok - event-core - :: send nack-trace message on designated bone + =. event-core abet:(run-message-still:peer-core bone %done ok=%.n) + :: construct nack-trace message, referencing .failed $message-num :: + =/ failed=message-num last-acked:(~(got by rcv.peer-state) bone) + =/ =message-blob (jam [failed u.error]) + :: send nack-trace message on associated .nack-trace-bone + :: + =/ peer-core (make-peer-core peer-state channel) =/ nack-trace-bone=^bone (mix 0b10 bone) - =. peer-core (make-peer-core peer-state channel) :: - abet:(run-message-pump:peer-core nack-trace-bone %memo /a/nax error) + abet:(run-message-pump:peer-core nack-trace-bone %boon message-blob) :: +on-hear: handle raw packet receipt :: ++ on-hear @@ -967,7 +971,7 @@ ~& %alef-self event-core :: - %. [lane packet] + %. +< :: ?. =(our rcvr.packet) ~& %alef-on-hear-forward @@ -1091,10 +1095,10 @@ :: =/ peer-core (make-peer-core peer-state channel) abet:(on-hear-shut-packet:peer-core lane shut-packet) - :: +on-take-memo: receive request to give message to peer + :: +on-take-boon: receive request to give message to peer :: - ++ on-take-memo - |= [=wire =message] + ++ on-take-boon + |= [=wire payload=*] ^+ event-core :: =+ ^- [her=ship =bone] (parse-bone-wire wire) @@ -1102,28 +1106,26 @@ =/ =peer-state (got-peer-state her) =/ =channel [[our her] now +>.ames-state -.peer-state] :: - abet:(on-memo:(make-peer-core peer-state channel) bone message) - :: +on-memo: handle request to send message + abet:(on-memo:(make-peer-core peer-state channel) bone payload) + :: +on-plea: handle request to send message :: - ++ on-memo - |= [=ship =message] + ++ on-plea + |= [=ship =plea] ^+ event-core :: =/ ship-state (~(get by peers.ames-state) ship) :: ?. ?=([~ %known *] ship-state) - ~& %alef-on-memo-enqueue-alien %+ enqueue-alien-todo ship |= todos=pending-requests - todos(snd-messages [[duct message] snd-messages.todos]) - ~& %alef-on-memo-known + todos(snd-messages [[duct plea] snd-messages.todos]) :: =/ =peer-state +.u.ship-state =/ =channel [[our ship] now +>.ames-state -.peer-state] :: =^ =bone ossuary.peer-state (get-bone ossuary.peer-state duct) :: - abet:(on-memo:(make-peer-core peer-state channel) bone message) + abet:(on-memo:(make-peer-core peer-state channel) bone plea) :: +on-take-wake: receive wakeup or error notification from behn :: ++ on-take-wake @@ -1431,7 +1433,7 @@ ++ ping-sponsor ^+ event-core :: - (emit duct %pass /ping %a %memo sponsor.ames-state /a/ping ~) + (emit duct %pass /ping %a %plea sponsor.ames-state /ping ~) :: +send-blob: fire packet at .ship and maybe sponsors :: :: Send to .ship and sponsors until we find a direct lane. @@ -1503,10 +1505,11 @@ :: +on-memo: handle request to send message :: ++ on-memo - |= [=bone =message] + |= [=bone payload=*] ^+ peer-core :: - (run-message-pump bone %memo message) + =/ =message-blob (jam payload) + (run-message-pump bone %memo message-blob) :: +on-wake: handle timer expiration :: ++ on-wake @@ -1533,6 +1536,21 @@ route.peer-state(direct.u %.n) :: (run-message-pump bone %wake ~) + :: +send-shut-packet: fire encrypted packet at rcvr and maybe sponsors + :: + ++ send-shut-packet + |= =shut-packet + ^+ peer-core + :: swizzle bone just before sending; TODO document + :: + =. bone.shut-packet (mix 1 bone.shut-packet) + :: + =/ content (encrypt symmetric-key.channel shut-packet) + =/ =packet [[our her.channel] encrypted=%.y origin=~ content] + =/ =blob (encode-packet packet) + :: + =. event-core (send-blob her.channel blob) + peer-core :: +run-message-pump: process $message-pump-task and its effects :: ++ run-message-pump @@ -1648,8 +1666,8 @@ =* gift i.still-gifts =. peer-core ?- -.gift - %send (on-still-send [message-num ack-meat]:gift) %memo (on-still-memo [message-num message]:gift) + %send (on-still-send [message-num ack-meat]:gift) == $(still-gifts t.still-gifts) :: +on-still-send: emit ack packet as requested by |message-still @@ -1665,55 +1683,57 @@ message-num %| ack-meat == - :: +on-still-memo: handle message received by |message-still + :: +on-still-memo: dispatch message received by |message-still + :: + :: odd bone: %plea request message + :: even bone, 0 second bit: %boon response message + :: even bone, 1 second bit: nack-trace %boon message :: ++ on-still-memo - |= [=message-num =message] - ^+ peer-core - :: pop first element off .path.message as .target-vane - :: - =^ target-vane path.message - ?>(?=([?(%a %c %g %k) *] path.message) path.message) - :: odd .bone; "request" message to pass to vane before acking - :: ?: =(1 (end 0 1 bone)) - =/ =wire (make-bone-wire her.channel bone) - :: /a/ping means sponsor ping timer; no-op - :: - ?: =(`path`/a/ping path.message) - peer-core - :: - =^ client-duct ossuary.peer-state - (get-duct ossuary.peer-state bone duct) - :: - ?- target-vane - %a ~| %bad-ames-message^path.message^her.channel !! - %c (emit client-duct %pass wire %c %memo her.channel message) - %g (emit client-duct %pass wire %g %memo her.channel message) - %k (emit client-duct %pass wire %k %memo her.channel message) - == - :: even bone means backward flow; ack automatically - :: - :: Only messages from forward flows can be nacked. - :: Note: reentrant. + on-still-plea + ?: =(0 (end 0 1 (rsh 0 1 bone))) + on-still-boon + on-still-nack-trace + :: +on-still-boon: handle response message received by |message-still + :: + ++ on-still-boon + |= [=message-num message=*] + ^+ peer-core + :: send message ack packet unconditionally :: =. peer-core (run-message-still bone %done ok=%.y) - :: is .bone a nack-trace flow? check the second bit + :: if no .client-duct, bone is invalid; don't send to vane :: - ?: =(0 (end 0 1 (rsh 0 1 bone))) - :: not a nack-trace; give message to local "subscriber" vane - :: - =/ client-duct (~(got by by-bone.ossuary.peer-state) bone) - :: - (emit client-duct %give %memo message) - :: .bone is a nack-trace; validate message + :: Future Ames should emit a security alert to local + :: subscribers if it can't find the duct for a %boon message. :: - ?> =(/a/nax `path`path.message) - =+ ;; [=target=^message-num =error] payload.message + ?~ client-duct=(~(get by by-bone.ossuary.peer-state) bone) + ~& %ames-bogus-boon-target^her.channel + peer-core + :: valid bone; give message to vane + :: + (emit u.client-duct %give %boon message) + :: +on-still-nack-trace: handle nack-trace received by |message-still + :: + ++ on-still-nack-trace + |= [=message-num message=*] + ^+ peer-core + :: + =+ ;; [=failed=message-num =error] message :: flip .bone's second bit to find referenced flow :: =/ target-bone=^bone (mix 0b10 bone) - =/ nax-key [target-bone target-message-num] + :: if no .target-duct, malformed message; don't ack + :: + ?~ target-duct=(~(get by by-bone.ossuary.peer-state) target-bone) + ~& %ames-bogus-nack-trace-target^her.channel + peer-core + :: valid .target-duct; ack + :: + =. peer-core (run-message-still bone %done ok=%.y) + :: + =/ nax-key [target-bone failed-message-num] :: if we haven't heard a message nack, pretend we have :: :: The nack-trace message counts as a valid message nack on @@ -1726,29 +1746,46 @@ :: =? peer-core !(~(has in nax.peer-state) nax-key) %- run-message-pump - [target-bone %hear target-message-num %| ok=%.n lag=`@dr`0] + [target-bone %hear failed-message-num %| ok=%.n lag=`@dr`0] :: clear the nack from our state and relay to vane :: =. nax.peer-state (~(del in nax.peer-state) nax-key) - =/ target-duct (~(got by by-bone.ossuary.peer-state) target-bone) :: - (emit target-duct %give %done `error) + (emit u.target-duct %give %done `error) + :: +on-still-plea: handle request message received by |message-still + :: + ++ on-still-plea + |= [=message-num message=*] + ^+ peer-core + :: don't accept requests for arbitrary vanes + :: + =+ ;; [vane=?(%a %c %g %k) =plea] message + :: %a /ping means sponsor ping timer; send ack + :: + ?: ?=(%a vane) + :: validate ping message and send ack + :: + :: TODO: treat ames as client vane and go through arvo? + :: removes reentrancy and could nack more easily + :: + =/ error=(unit error) + ?: =([/ping ~] plea) ~ + `[%ping [%leaf "ames: invalid ping"]~] + :: + (run-message-still bone %done ok=%.y) + :: not a sponsor ping; relay .plea to .vane + :: + =/ =wire (make-bone-wire her.channel bone) + :: + =^ client-duct ossuary.peer-state + (get-duct ossuary.peer-state bone duct) + :: + ?- vane + %c (emit client-duct %pass wire %c %plea her.channel plea) + %g (emit client-duct %pass wire %g %plea her.channel plea) + %k (emit client-duct %pass wire %k %plea her.channel plea) + == -- - :: +send-shut-packet: fire encrypted packet at rcvr and maybe sponsors - :: - ++ send-shut-packet - |= =shut-packet - ^+ peer-core - :: swizzle bone just before sending; TODO document - :: - =. bone.shut-packet (mix 1 bone.shut-packet) - :: - =/ content (encrypt symmetric-key.channel shut-packet) - =/ =packet [[our her.channel] encrypted=%.y origin=~ content] - =/ =blob (encode-packet packet) - :: - =. event-core (send-blob her.channel blob) - peer-core -- -- :: +make-message-pump: constructor for |message-pump @@ -1779,7 +1816,7 @@ ^+ message-pump :: ?- -.task - %memo (on-memo message.task) + %memo (on-memo message-blob.task) %wake (run-packet-pump task) %hear ?- -.ack-meat.task @@ -1789,10 +1826,10 @@ :: +on-memo: handle request to send a message :: ++ on-memo - |= =message + |= =message-blob ^+ message-pump :: - =. unsent-messages.state (~(put to unsent-messages.state) message) + =. unsent-messages.state (~(put to unsent-messages.state) message-blob) message-pump :: +on-hear: handle packet acknowledgment :: @@ -1899,10 +1936,10 @@ message-pump :: .unsent-messages is nonempty; pop a message off and feed it :: - =^ message unsent-messages.state ~(get to unsent-messages.state) + =^ =message-blob 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) + =. unsent-fragments.state (split-message next.state message-blob) :: try to feed packets from the next message :: =. next.state +(next.state) @@ -2320,7 +2357,8 @@ :: u.existing :: - =/ already-heard=? (~(has by fragments.partial-rcv-message) `^fragment-num``@`seq) + =/ already-heard=? + (~(has by fragments.partial-rcv-message) `^fragment-num``@`seq) :: ack dupes except for the last fragment, in which case drop :: ?: already-heard @@ -2361,14 +2399,14 @@ =. last-heard.state +(last-heard.state) =. live-messages.state (~(del by live-messages.state) seq) :: - =/ =message (assemble-fragments [num-fragments fragments]:u.live) + =/ message=* (assemble-fragments [num-fragments fragments]:u.live) =. message-still (enqueue-to-vane seq message) :: $(seq +(seq)) :: +enqueue-to-vane: enqueue message to be sent to local vane :: ++ enqueue-to-vane - |= [seq=message-num =message] + |= [seq=message-num message=*] ^+ message-still :: =/ empty=? =(~ pending-vane-ack.state) @@ -2402,10 +2440,10 @@ :: +split-message: split message into kilobyte-sized fragments :: ++ split-message - |= [=message-num =message] + |= [=message-num =message-blob] ^- (list static-fragment) :: - =/ fragments=(list fragment) (rip 13 (jam message)) + =/ fragments=(list fragment) (rip 13 message-blob) =/ num-fragments=fragment-num (lent fragments) =| counter=@ :: diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 7d4745ff9..4adb73bbd 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -216,7 +216,7 @@ [%wegh ~] :: receive message via %ames :: - [%memo =ship =message:ames] + [%plea =ship =plea:ames] == :: :::: :::: ++http :: @@ -395,23 +395,23 @@ $>(%born vane-task) $>(%crud vane-task) $>(%init vane-task) - $>(%memo vane-task) + $>(%plea vane-task) $>(%vega vane-task) $>(%wegh vane-task) == :: $gift: effect from ames :: - :: %memo: message to vane from peer - :: %send: packet to unix + :: %boon: response message from remote ship :: %done: notify vane that peer (n)acked our message + :: %send: packet to unix :: :: %mass: memory usage report :: %turf: domain report, relayed from kale :: +$ gift - $% [%memo =message] - [%send =lane =blob] + $% [%boon payload=*] [%done error=(unit error)] + [%send =lane =blob] :: [%mass p=mass] [%turf turfs=(list turf)] @@ -458,12 +458,13 @@ :: know their transport addresses. :: +$ lane (each @pC address) - :: $message: application-level message + :: $plea: application-level message, as a %pass :: + :: vane: destination vane on remote ship :: path: internal route on the receiving ship :: payload: semantic message contents :: - +$ message [=path payload=*] + +$ plea [vane=@tas =path payload=*] -- ::ames :: :::: :::: ++behn :: (1b) timekeeping @@ -505,13 +506,13 @@ ++ able ^? |% ++ gift :: out result <-$ - $% {$croz rus/(map desk {r/regs w/regs})} :: rules for group + $% [%boon payload=*] :: ames response + {$croz rus/(map desk {r/regs w/regs})} :: rules for group {$cruz cez/(map @ta crew)} :: permission groups {$dirk p/@tas} :: mark mount dirty {$ergo p/@tas q/mode} :: version update {$hill p/(list @tas)} :: mount points - [%done error=(unit error:ames)] :: message (n)ack - [%memo =message:ames] :: send ames message + [%done error=(unit error:ames)] :: ames message (n)ack {$mass p/mass} :: memory usage {$mere p/(each (set path) (pair term tang))} :: merge result {$note p/@tD q/tank} :: debug message @@ -545,7 +546,7 @@ {$warp wer/ship rif/riff} :: internal file req {$werp who/ship wer/ship rif/riff} :: external file req $>(%wegh vane-task) :: report memory - $>(%memo vane-task) :: network request + $>(%plea vane-task) :: ames request == :: -- ::able :: @@ -1780,20 +1781,20 @@ ++ able ^? |% ++ gift :: outgoing result - $% {$mass p/mass} :: memory usage + $% [%boon payload=*] :: ames response + [%done error=(unit error:ames)] :: ames message (n)ack + {$mass p/mass} :: memory usage {$onto p/(each suss tang)} :: about agent {$unto p/cuft} :: - [%done error=(unit error:ames)] :: message (n)ack - [%memo =message:ames] :: send ames message == :: ++ task :: incoming request $~ [%vega ~] :: $% {$conf p/dock q/culm} :: configure app - $>(%init vane-task) :: set owner {$deal p/sock q/cush} :: full transmission + $>(%init vane-task) :: set owner + $>(%plea vane-task) :: ames request $>(%sunk vane-task) :: report death $>(%vega vane-task) :: report upgrade - $>(%memo vane-task) :: network request $>(%wegh vane-task) :: report memory == :: -- ::able @@ -2078,7 +2079,6 @@ [%vest ~] :: view public balance [%vine ~] :: view secret history $>(%wegh vane-task) :: memory usage request - $>(%memo vane-task) :: remote request [%wind p=@ud] :: rewind before block == :: -- :: @@ -2335,8 +2335,8 @@ ++ gift :: out result <-$ $% [%init p=ship] :: report install unix [%mass p=mass] :: memory usage report - [%done error=(unit error:ames)] :: message (n)ack - [%memo =message:ames] :: send ames message + [%done error=(unit error:ames)] :: ames message (n)ack + [%boon payload=*] :: ames response [%source whos=(set ship) src=source] :: [%turf turf=(list turf)] :: domains [%private-keys =life vein=(map life ring)] :: private keys @@ -2370,7 +2370,7 @@ [%vent-update =vent-result] :: update from app $>(%vega vane-task) :: report upgrade $>(%wegh vane-task) :: memory usage request - $>(%memo vane-task) :: remote request + $>(%plea vane-task) :: ames request [%wind p=@ud] :: rewind before block == :: -- :: From 5b0ee61a6427a2a61a9b02cb5c13ac74bf0b594c Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sun, 28 Jul 2019 23:37:49 -0700 Subject: [PATCH 031/451] Boots without error and sends and receives talk messages --- pkg/arvo/sys/vane/alef.hoon | 28 +++++++++++++++------------- pkg/arvo/sys/vane/clay.hoon | 23 +++++++++++------------ pkg/arvo/sys/vane/gall.hoon | 22 +++++++++++----------- pkg/arvo/sys/vane/kale.hoon | 20 ++++++++++---------- pkg/arvo/sys/zuse.hoon | 6 ++---- 5 files changed, 49 insertions(+), 50 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 210e59485..7e97f01fd 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -926,10 +926,10 @@ :: =/ =peer-state (got-peer-state her) =/ =channel [[our her] now +>.ames-state -.peer-state] + =/ peer-core (make-peer-core peer-state channel) :: if processing succeded, send positive ack packet and exit :: ?~ error - =/ peer-core (make-peer-core peer-state channel) abet:(run-message-still:peer-core bone %done ok=%.y) :: failed; send message nack packet :: @@ -940,10 +940,10 @@ =/ =message-blob (jam [failed u.error]) :: send nack-trace message on associated .nack-trace-bone :: - =/ peer-core (make-peer-core peer-state channel) + =. peer-core (make-peer-core peer-state channel) =/ nack-trace-bone=^bone (mix 0b10 bone) :: - abet:(run-message-pump:peer-core nack-trace-bone %boon message-blob) + abet:(run-message-pump:peer-core nack-trace-bone %memo message-blob) :: +on-hear: handle raw packet receipt :: ++ on-hear @@ -1304,8 +1304,8 @@ ?~ snd-messages.todos event-core :: =. event-core - %- on-memo(duct duct.i.snd-messages.todos) - [ship message.i.snd-messages.todos] + %- on-plea(duct duct.i.snd-messages.todos) + [ship plea.i.snd-messages.todos] :: $(snd-messages.todos t.snd-messages.todos) :: apply outgoing packet blobs @@ -1433,7 +1433,7 @@ ++ ping-sponsor ^+ event-core :: - (emit duct %pass /ping %a %plea sponsor.ames-state /ping ~) + (emit duct %pass /ping %a %plea sponsor.ames-state %a /ping ~) :: +send-blob: fire packet at .ship and maybe sponsors :: :: Send to .ship and sponsors until we find a direct lane. @@ -1720,7 +1720,7 @@ |= [=message-num message=*] ^+ peer-core :: - =+ ;; [=failed=message-num =error] message + =+ ;; [=failed=^message-num =error] message :: flip .bone's second bit to find referenced flow :: =/ target-bone=^bone (mix 0b10 bone) @@ -1759,17 +1759,18 @@ ^+ peer-core :: don't accept requests for arbitrary vanes :: - =+ ;; [vane=?(%a %c %g %k) =plea] message + =+ ;; =plea message :: %a /ping means sponsor ping timer; send ack :: - ?: ?=(%a vane) + ?: ?=(%a vane.plea) :: validate ping message and send ack :: :: TODO: treat ames as client vane and go through arvo? :: removes reentrancy and could nack more easily :: =/ error=(unit error) - ?: =([/ping ~] plea) ~ + ?: =([/ping ~] +.plea) + ~ `[%ping [%leaf "ames: invalid ping"]~] :: (run-message-still bone %done ok=%.y) @@ -1780,7 +1781,7 @@ =^ client-duct ossuary.peer-state (get-duct ossuary.peer-state bone duct) :: - ?- vane + ?+ vane.plea ~| %ames-evil-vane^vane.plea !! %c (emit client-duct %pass wire %c %plea her.channel plea) %g (emit client-duct %pass wire %g %plea her.channel plea) %k (emit client-duct %pass wire %k %plea her.channel plea) @@ -2121,7 +2122,9 @@ =- :: if no sent packet matches the ack, don't apply mutations or effects :: ?. found.- + ~& %alef-hear-noop packet-pump + ~& %alef-hear-ack^message-num^fragment-num :: =. metrics.state metrics.- =. live.state live.- @@ -2457,7 +2460,7 @@ :: ++ assemble-fragments |= [num-fragments=fragment-num fragments=(map fragment-num fragment)] - ^- message + ^- * :: =| sorted=(list fragment) =. sorted @@ -2467,7 +2470,6 @@ sorted $(index +(index), sorted [(~(got by fragments) index) sorted]) :: - ;; message %- cue %+ can 13 %+ turn (flop sorted) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 38d98d02c..b676cf395 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -471,7 +471,7 @@ ++ note :: out request $-> $~ [%b %wait *@da] :: $% $: %a :: to %ames - $>(%memo task:able:ames) :: + $>(%plea task:able:ames) :: == :: $: %b :: to %behn $> $? %drip :: @@ -505,7 +505,7 @@ $% [%init-clad ~] :: == == :: $: %a :: by %ames - $> $? %memo :: + $> $? %boon :: %done :: == :: gift:able:ames :: @@ -2795,8 +2795,8 @@ :: =/ =desk p.riff =/ =wire /warp-index/(scot %p ship)/(scot %tas desk)/(scot %ud index) - =/ =path [%c %question desk (scot %ud index) ~] - (emit duct %pass wire %a %memo ship path riff) + =/ =path [%question desk (scot %ud index) ~] + (emit duct %pass wire %a %plea ship %c path riff) :: :: Create a request that cannot be filled immediately. :: @@ -4369,10 +4369,10 @@ (start-request:den for u.q.rif) [mos ..^$] :: - %memo + %plea =* her ship.req - =* pax path.message.req - =* res payload.message.req + =* pax path.plea.req + =* res payload.plea.req :: ?> ?=({%question *} pax) =+ ryf=;;(riff res) @@ -4466,7 +4466,7 @@ ?: ?=([%foreign-warp *] tea) ?> ?=(%writ +<.q.hin) :_ ..^$ - [hen %give %memo /remove-me (bind `riot`p.q.hin rant-to-rand)]~ + [hen %give %boon (bind `riot`p.q.hin rant-to-rand)]~ :: ?: ?=({%foreign-request @ @ @ *} tea) =/ her (slav %p i.t.tea) @@ -4502,10 +4502,9 @@ == == :: ?: ?=([%warp-index @ @ @ ~] tea) - ?> ?=(%memo +<.q.hin) - ?> ?=([%remove-me ~] path.message.q.hin) + ?> ?=(%boon +<.q.hin) :: - =+ ;; res=(unit rand) payload.message.q.hin + =+ ;; res=(unit rand) payload.q.hin :: =/ her=ship (slav %p i.t.tea) =/ =desk (slav %tas i.t.t.tea) @@ -4568,7 +4567,7 @@ :: :: handled in the wire dispatcher :: - %memo !! + %boon !! %writ !! :: %done diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 2f2f9bcf8..370b77176 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -225,7 +225,7 @@ == %+ mo-pass [%sys %way (scot %p him) p.caz -.q.caz ~] - `note-arvo`[%a %memo him [%g %ge p.caz ~] [num roc]] + `note-arvo`[%a %plea him %g [%ge p.caz ~] [num roc]] :: ++ mo-baba :: error convert b |= error=(unit error:ames) @@ -360,8 +360,8 @@ ?- -.cuf %coup (mo-give %done ?~(p.cuf ~ `[%gall-coup u.p.cuf])) %reap (mo-give %done ?~(p.cuf ~ `[%gall-reap u.p.cuf])) - %diff (mo-give %memo /remove-me num %d p.p.cuf q.q.p.cuf) - %quit (mo-give %memo /remove-me num %x ~) + %diff (mo-give %boon num %d p.p.cuf q.q.p.cuf) + %quit (mo-give %boon num %x ~) :: we send http-responses, we don't receive them. :: $http-response !! @@ -393,8 +393,8 @@ ?: ?=([%a %done *] sih) (mo-awed him cub error.sih) :: - ?> ?=([%a %memo *] sih) - =+ mes=;;([@ud roon] payload.message.sih) + ?> ?=([%a %boon *] sih) + =+ mes=;;([@ud roon] payload.sih) (mo-gawd:(mo-abed:mo hen) him dap mes) == :: @@ -1290,14 +1290,14 @@ $init [~ ..^$(sys.mast.all hen)] :: - %memo - ~& %gall-memo-path^path.message.q.hic - ?> ?=([%ge @ ~] path.message.q.hic) + %plea + ~& %gall-plea-path^path.plea.q.hic + ?> ?=([%ge @ ~] path.plea.q.hic) =/ him=ship ship.q.hic - =* dap i.t.path.message.q.hic + =* dap i.t.path.plea.q.hic :: - =+ mes=;;([@ud rook] payload.message.q.hic) - ~& %gall-memo-coerced + =+ mes=;;([@ud rook] payload.plea.q.hic) + ~& %gall-plea-coerced =< mo-abet (mo-gawk:(mo-abed:mo hen) him dap mes) :: diff --git a/pkg/arvo/sys/vane/kale.hoon b/pkg/arvo/sys/vane/kale.hoon index a8616e875..ed50403b4 100644 --- a/pkg/arvo/sys/vane/kale.hoon +++ b/pkg/arvo/sys/vane/kale.hoon @@ -80,9 +80,9 @@ [p=duct q=card] :: :: :: +$ note :: out request $-> - $~ [%a %memo *ship *message:ames] :: + $~ [%a %plea *ship *plea:ames] :: $% $: %a :: to %ames - $>(%memo task:able:ames) :: send message + $>(%plea task:able:ames) :: send request message == :: $: %k :: to self $>(%look task) :: set ethereum source @@ -93,7 +93,7 @@ :: :: +$ sign :: in result $<- $~ [%a %done ~] :: - $% [%a $>(%memo gift:able:ames)] :: message result + $% [%a $>(%boon gift:able:ames)] :: message response [%a $>(%done gift:able:ames)] :: message (n)ack == :: -- :: @@ -437,11 +437,11 @@ == :: :: authenticated remote request - :: [%memo =ship =message:ames] + :: [%plea =ship =plea:ames] :: - %memo + %plea =* her ship.tac - =/ mes (message message.tac) + =/ mes (message payload.plea.tac) ?- -.mes :: :: cancel trackers @@ -479,9 +479,9 @@ ::TODO fail:et +>.$ :: - [%a %memo *] + [%a %boon *] =. moz [[hen %give %done ~] moz] - =+ ;; =message-response message.hin + =+ ;; =message-response payload.hin (call hen %vent-update vent-result.message-response) == :: :: ++curd:of @@ -567,7 +567,7 @@ :: ?. ?=([[%a *] *] d) (emit d %give %public-keys vent-result) - (emit d %give %memo /k/remove-me %public-keys-result vent-result) + (emit d %give %boon %public-keys-result vent-result) $(yez t.yez) :: ++ get-source @@ -742,7 +742,7 @@ ?: ?=(%& -.source) =/ send-message |= =message - [hen %pass /public-keys %a %memo p.source /k/public-keys message] + [hen %pass /public-keys %a %plea p.source %k /public-keys message] =. ..feel (emit (send-message %nuke whos)) (emit (send-message %public-keys whos)) diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 4adb73bbd..b372a8c49 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -7579,8 +7579,9 @@ {$j gift:able:jael} {$k gift:able:kale} == +:: $unix-task: input from unix :: -+$ unix-task :: input from unix ++$ unix-task $~ [%wake ~] $% :: %dill: keyboard input :: @@ -7627,9 +7628,6 @@ :: %behn: wakeup :: $>(%wake task:able:behn) - :: %ames: send message - :: - $>(%memo task:able:ames) == :: :: :::: ++azimuth :: (2az) azimuth From c7c964b5077212404254ea434cadd931815dfdc0 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sun, 28 Jul 2019 23:38:18 -0700 Subject: [PATCH 032/451] update solid pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index a161162e5..452678d4b 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f02a70b0cae5370c8c2f8c450836ebbc590d50a96a5f6bb2e7dd8b299f35791d -size 8731129 +oid sha256:77d45ad7db4dff40691a2145e4cd02fc6264973e0f874133e8ed70dd14632d06 +size 9908218 From e04d2c8570d724354888743a16efa27cbb948202 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 29 Jul 2019 00:14:39 -0700 Subject: [PATCH 033/451] worker printfs --- pkg/urbit/worker/main.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pkg/urbit/worker/main.c b/pkg/urbit/worker/main.c index 840c44fbc..595bf9b08 100644 --- a/pkg/urbit/worker/main.c +++ b/pkg/urbit/worker/main.c @@ -374,6 +374,21 @@ _worker_send_slog(u3_noun hod) _worker_send(u3nt(c3__slog, u3i_chubs(1, &u3V.sen_d), hod)); } +/* _worker_send_tang(): send list of hoon tanks as hint outputs. +*/ +static void +_worker_send_tang(c3_y pri_y, u3_noun tan) +{ + u3_noun i_tan, t_tan; + while ( u3_nul != tan ) { + i_tan = u3k(u3h(tan)); + t_tan = u3k(u3t(tan)); + u3z(tan); + _worker_send_slog(u3nc(pri_y, i_tan)); + tan = t_tan; + } +} + /* _worker_lame(): event failed, replace with error event. */ static void @@ -393,6 +408,7 @@ _worker_lame(c3_d evt_d, u3_noun now, u3_noun ovo, u3_noun why, u3_noun tan) // with a crypto failure, just drop the packet. // if ( (c3__hear == tag) && (c3__exit == why) ) { + _worker_send_tang(1, u3k(tan)); rep = u3nt(u3k(wir), c3__hole, u3k(cad)); } // failed event notifications (%crud) are replaced with @@ -404,6 +420,7 @@ _worker_lame(c3_d evt_d, u3_noun now, u3_noun ovo, u3_noun why, u3_noun tan) else if ( c3__crud == tag ) { u3_noun lef = u3nc(c3__leaf, u3i_tape("crude crashed!")); u3_noun nat = u3kb_weld(u3k(u3t(cad)), u3nc(lef, u3k(tan))); + _worker_send_tang(1, u3k(nat)); rep = u3nc(u3nt(u3_blip, c3__arvo, u3_nul), u3nt(c3__warn, u3k(u3h(cad)), nat)); } @@ -423,6 +440,7 @@ _worker_lame(c3_d evt_d, u3_noun now, u3_noun ovo, u3_noun why, u3_noun tan) u3_noun lef = u3nc(c3__leaf, u3kb_weld(u3i_tape("bail: "), u3qc_rip(3, why))); u3_noun nat = u3kb_weld(u3k(tan), u3nc(lef, u3_nul)); + _worker_send_tang(1, u3k(nat)); rep = u3nc(u3k(wir), u3nt(c3__crud, u3k(tag), nat)); } From 505c0eb4d548d9ab08c54ea8988500fa979f9361 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 29 Jul 2019 02:08:26 -0700 Subject: [PATCH 034/451] clay |sync works; fixed ack bug and clay bug --- pkg/arvo/sys/vane/alef.hoon | 47 +++++++++++++++++++------------------ pkg/arvo/sys/vane/clay.hoon | 9 +++++++ 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 7e97f01fd..6320a12a9 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -57,8 +57,8 @@ =/ protocol-version=?(%0 %1 %2 %3 %4 %5 %6 %7) %0 =, ames =, able -=* point point:able:kale -=* vent-result vent-result:able:kale +=* point point:able:kale +=* public-keys-result public-keys-result:able:kale :: => |% @@ -650,7 +650,7 @@ == == $: %k $% [%private-keys =life vein=(map life ring)] - [%public-keys =vent-result] + [%public-keys =public-keys-result] [%turf turfs=(list turf)] == == $: @tas @@ -881,9 +881,9 @@ :: [%b %wake *] (on-take-wake:event-core wire error.sign) :: - [%k %private-keys *] (on-priv:event-core [life vein]:sign) - [%k %public-keys *] (on-publ:event-core wire vent-result.sign) [%k %turf *] (on-take-turf:event-core turfs.sign) + [%k %private-keys *] (on-priv:event-core [life vein]:sign) + [%k %public-keys *] (on-publ:event-core wire public-keys-result.sign) == :: [moves ames-gate] @@ -974,13 +974,10 @@ %. +< :: ?. =(our rcvr.packet) - ~& %alef-on-hear-forward on-hear-forward :: ?: encrypted.packet - ~& %alef-on-hear-shut on-hear-shut - ~& %alef-on-hear-open on-hear-open :: +on-hear-forward: maybe forward a packet to someone else :: @@ -1181,24 +1178,22 @@ :: +on-publ: update pki data for peer or self :: ++ on-publ - |= [=wire =vent-result] + |= [=wire =public-keys-result] ^+ event-core :: |^ ^+ event-core - ?- vent-result - [%diff @ * %rift *] - (on-publ-breach [who rift.udiff]:vent-result) :: - [%diff @ * %keys *] - (on-publ-rekey [who +>.udiff]:vent-result) + ?- public-keys-result + [%diff @ %rift *] + (on-publ-breach [who to.diff]:public-keys-result) :: - [%diff @ * %spon *] - (on-publ-sponsor [who sponsor.udiff]:vent-result) + [%diff @ %keys *] + (on-publ-rekey [who to.diff]:public-keys-result) :: - [%diff @ * %disavow ~] - (on-publ-sponsor [who ~]:vent-result) + [%diff @ %spon *] + (on-publ-sponsor [who to.diff]:public-keys-result) :: - [%full *] (on-publ-full points.vent-result) + [%full *] (on-publ-full points.public-keys-result) == :: +on-publ-breach: handle continuity breach of .ship; wipe its state :: @@ -1572,7 +1567,6 @@ |^ ^+ peer-core ?~ pump-gifts peer-core =* gift i.pump-gifts - ~& %alef-on-pump-gift^-.gift =. peer-core ?- -.gift %done (on-pump-done [message-num ok]:gift) @@ -1700,6 +1694,7 @@ ++ on-still-boon |= [=message-num message=*] ^+ peer-core + ~& %ames-still-boon :: send message ack packet unconditionally :: =. peer-core (run-message-still bone %done ok=%.y) @@ -1719,6 +1714,7 @@ ++ on-still-nack-trace |= [=message-num message=*] ^+ peer-core + ~& %ames-still-nack-trace :: =+ ;; [=failed=^message-num =error] message :: flip .bone's second bit to find referenced flow @@ -1757,6 +1753,7 @@ ++ on-still-plea |= [=message-num message=*] ^+ peer-core + ~& %ames-still-plea :: don't accept requests for arbitrary vanes :: =+ ;; =plea message @@ -2060,10 +2057,9 @@ ++ feed |= fragments=(list static-fragment) ^+ [fragments gifts state] - ~& %alef-feed^(lent fragments) :: return unsent back to caller and reverse effects to finalize :: - =- ~& %alef-feed-unsent^(lent unsent) + =- ~& %alef-feed^(lent fragments)^%unsent^(lent unsent) [unsent (flop gifts) state] :: ^+ [unsent=fragments packet-pump] @@ -2331,10 +2327,12 @@ ?. is-last-fragment :: single packet ack :: + ~& %send-dupe-ack^fragment-num (give %send seq %& fragment-num) :: whole message (n)ack :: =/ ok=? (~(has in nax.state) seq) + ~& %send-dupe-ack-whole-message (give %send seq %| ok lag=`@dr`0) :: last-acked ?=(%boon +<.q.hin) :: =+ ;; res=(unit rand) payload.q.hin From 558eee35f0fb2da184251d6a6cae8788a6f2d459 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 29 Jul 2019 02:08:54 -0700 Subject: [PATCH 035/451] update solid pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 452678d4b..a0a7a19be 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:77d45ad7db4dff40691a2145e4cd02fc6264973e0f874133e8ed70dd14632d06 -size 9908218 +oid sha256:c076e86f295e4e0a25bc2c5310b9abf64da945fe5eff462516aa6c24e8f333fd +size 9850171 From 14dba1d4ac24d1166ded4f3e8ee1d5aa518febb0 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 29 Jul 2019 04:05:52 -0700 Subject: [PATCH 036/451] all tests pass --- bin/solid.pill | 4 +- pkg/arvo/lib/ring.hoon | 17 ++- pkg/arvo/sys/vane/alef.hoon | 2 +- pkg/arvo/sys/vane/jael.hoon | 46 ++++---- pkg/arvo/sys/zuse.hoon | 97 +++++++++-------- pkg/arvo/tests/sys/vane/alef.hoon | 24 ++-- pkg/arvo/tests/sys/vane/ames.hoon | 175 ------------------------------ 7 files changed, 96 insertions(+), 269 deletions(-) delete mode 100644 pkg/arvo/tests/sys/vane/ames.hoon diff --git a/bin/solid.pill b/bin/solid.pill index a0a7a19be..a32cb8a23 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c076e86f295e4e0a25bc2c5310b9abf64da945fe5eff462516aa6c24e8f333fd -size 9850171 +oid sha256:a1b00e99a32486b872d79d110ffac2fa2c0d0a3cb42e5d7748df8a32bbe5bb13 +size 9857182 diff --git a/pkg/arvo/lib/ring.hoon b/pkg/arvo/lib/ring.hoon index 75effd06c..b51b58418 100644 --- a/pkg/arvo/lib/ring.hoon +++ b/pkg/arvo/lib/ring.hoon @@ -349,8 +349,15 @@ |= [our=@p now=@da ship=@p =life] ^- @udpoint :: - =/ d=deed:ames - .^(deed:ames j+/(scot %p our)/deed/(scot %da now)/(scot %p ship)/(scot %ud life)) + =/ d=[=^life =pass] + =/ scry-path=path + :~ %k + (scot %p our) + (scot %da now) + (scot %p ship) + (scot %ud life) + == + .^([^life pass] scry-path) :: we have the deed which has pass, which is several numbers +cat-ed :: together; pull out the keys :: @@ -370,7 +377,7 @@ [participants keys] :: =/ =life - .^(life j+/(scot %p our)/life/(scot %da now)/(scot %p i.invited)) + .^(life k+/(scot %p our)/life/(scot %da now)/(scot %p i.invited)) :: ?: =(life 0) $(invited t.invited) @@ -429,11 +436,11 @@ :: get our ships' current life :: =/ our-life=life - .^(life %j /(scot %p our)/life/(scot %da now)/(scot %p our)) + .^(life %k /(scot %p our)/life/(scot %da now)/(scot %p our)) :: get our ships' secret keyfile ring :: =/ secret-ring=ring - .^(ring %j /(scot %p our)/vein/(scot %da now)/(scot %ud our-life)) + .^(ring %k /(scot %p our)/vein/(scot %da now)/(scot %ud our-life)) :: fetch the encoded auth seed from the ring :: =/ secret-auth-seed=@ diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 6320a12a9..18e89d053 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2366,7 +2366,7 @@ ?: already-heard ?: is-last-fragment message-still - ~& %send-dupe-ack-fragment + ~& %send-dupe-ack-fragment^fragment (give %send seq %& fragment-num) :: new fragment; store in state and check if message is done :: diff --git a/pkg/arvo/sys/vane/jael.hoon b/pkg/arvo/sys/vane/jael.hoon index 749e18c57..cf65f9aa3 100644 --- a/pkg/arvo/sys/vane/jael.hoon +++ b/pkg/arvo/sys/vane/jael.hoon @@ -108,7 +108,7 @@ task:able:behn :: == :: $: %a :: to %ames - $>(%want task:able:ames) :: send message + $>(%plea task:able:ames) :: send request message == :: $: %i :: to %iris $>(%request task:able:iris) :: http request @@ -125,7 +125,7 @@ $~ [%b %wake ~] :: $% [%b $>(%wake gift:able:behn)] :: wakeup [%j $>(%vent gift)] :: ethereum changes - [%a $>(%woot gift:able:ames)] :: message result + [%a $>(%done gift:able:ames)] :: message result [%i $>(%http-response gift:able:iris)] :: http response == :: -- :: @@ -555,7 +555,7 @@ |=((map @ta @) (~(run by +<) |=(@ (shax +<)))) :: $urban - [%urban (~(run by p.rys) |=({@da code:ames} [+<- (shax +<+)]))] + [%urban (~(run by p.rys) |=({@da @} [+<- (shax +<+)]))] == :: :: ++remove:up ++ remove :: pig minus gob @@ -911,7 +911,7 @@ :: [%vent ~] :: %vent - =. moz [[hen %give %mack ~] moz] + =. moz [[hen %give %done ~] moz] (curd abet:~(vent ~(feed su hen our urb sub etn sap) hen)) :: :: monitor assets @@ -946,9 +946,9 @@ :: authenticated remote request :: {$west p/ship q/path r/*} :: - $west - =* her p.tac - =/ mes (message r.tac) + %plea + =* her ship.tac + =/ mes ;;(message payload.plea.tac) ?- -.mes :: :: reset remote rights @@ -975,7 +975,7 @@ :: ignore if not from currently configured source. ?. &(-.source.etn =(her p.source.etn)) +>.$ - =. moz [[hen %give %mack ~] moz] + =. moz [[hen %give %done ~] moz] %+ cute hen =< abet (~(hear-vent et hen our now urb.lex sub.lex etn.lex sap.lex) p.mes) == @@ -993,11 +993,10 @@ ?> ?=([@ *] tea) =* wir t.tea ?- hin - [%a %woot *] - ?~ q.hin +>.$ - ?~ u.q.hin ~&(%ares-fine +>.$) - ~& [%woot-bad p.u.u.q.hin] - ~_ q.u.u.q.hin + [%a %done *] + ?~ error.hin ~&(%ares-fine +>.$) + ~& [%done-bad tag.u.error.hin] + %- (slog tang.u.error.hin) ::TODO fail:et +>.$ :: @@ -1162,7 +1161,7 @@ :+ %pass /(scot %p our)/vent-result ^- note - [%a %want who /j/(scot %p our)/vent-result %vent-result res] + [%a %plea who %j /(scot %p our)/vent-result %vent-result res] $(yez t.yez) :: ++ extract-snap :: extract rewind point @@ -1275,9 +1274,8 @@ moz :_ moz :^ *duct %pass /vest/(scot %p p.hug) - :+ %a %want - :+ p.hug /j - ^- message + :+ %a %plea + :^ p.hug %j / [%hail |+pig] == :: @@ -1771,7 +1769,7 @@ |= [our=ship who=ship] %- put-move(source &+who) %+ wrap-note /vent/(scot %p who) - [%a %want who /j/(scot %p our)/vent `*`[%vent ~]] + [%a %plea who %j /(scot %p our)/vent `*`[%vent ~]] :: :: +unsubscribe-from-source: stop listening to current source ship :: @@ -1782,7 +1780,7 @@ %+ wrap-note /vent/(scot %p p.source) ::TODO should we maybe have a %nuke-vent, :: or do we have a unique duct here? - [%a %want p.source /j/(scot %p our)/vent `*`[%nuke ~]] + [%a %plea p.source %j /(scot %p our)/vent `*`[%nuke ~]] :: :: +listen-to-node: start syncing from a node :: @@ -2270,7 +2268,7 @@ :+ %pass /(scot %p our)/vent-result ^- note - [%a %want who /j/(scot %p our)/vent-result %vent-result res] + [%a %plea who %j /(scot %p our)/vent-result %vent-result res] :: :: ++feed:su -- -- @@ -2410,8 +2408,7 @@ =/ cub (nol:nu:crub:crypto sec) =/ sig (sign:as:cub (shaf %self (sham [u.who 1 pub:ex:cub]))) :^ ~ ~ %noun - !> ^- deed:ames - [1 pub:ex:cub `sig] + !> [1 pub:ex:cub `sig] :: ?: ?=(%earl rac) ?. =(u.who p.why) @@ -2423,8 +2420,7 @@ =/ sec (~(got by jaw.own.sub.lex) u.lyf) =/ cub (nol:nu:crub:crypto sec) :^ ~ ~ %noun - !> ^- deed:ames - [u.lyf pub:ex:cub sig.own.sub.lex] + !> [u.lyf pub:ex:cub sig.own.sub.lex] :: =/ pub (~(get by kyz.puk.sub.lex) u.who) ?~ pub @@ -2435,7 +2431,7 @@ ?~ pas ~ :^ ~ ~ %noun - !> `deed:ames`[u.lyf u.pas ~] + !> [u.lyf u.pas ~] :: %earl ?. ?=([@ @ @ ~] tyl) [~ ~] diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index f907b3b54..b5027fb4b 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -2024,7 +2024,8 @@ del/bump :: change == == :: ++ gift :: out result <-$ - $% [%init p=ship] :: report install unix + $% [%done error=(unit error:ames)] :: ames (n) ack + [%init p=ship] :: report install unix [%mass p=mass] :: memory usage report [%mack p=(unit tang)] :: message n/ack [%pubs public] :: public keys @@ -2080,6 +2081,7 @@ [%vine ~] :: view secret history $>(%wegh vane-task) :: memory usage request [%wind p=@ud] :: rewind before block + $>(%plea vane-task) :: ames request message == :: -- :: :: :: @@ -9089,53 +9091,52 @@ :: ++ snap !: - !! -:: |% -:: :: +bloq:snap:dawn: extract block number -:: :: -:: ++ bloq -:: |= snap=snapshot:kale -:: ^- (unit @ud) -:: =- ?:(?=(%| -.out) ~ (some p.out)) -:: ^= out %- mule |. -:: latest-block.snap -:: :: +czar:snap:dawn: extract galaxy table -:: :: -:: ++ czar -:: |= snap=snapshot:kale -:: ^- (unit (map ship [=life =pass])) -:: =- ?:(?=(%| -.out) ~ (some p.out)) -:: ^= out %- mule |. -:: %- ~(gas by *(map ship [=life =pass])) -:: %+ turn (gulf 0 255) -:: |= gal=@ -:: ^- [ship [life pass]] -:: :- gal -:: ~| czar-gal=gal -:: [life pass]:(need net:(~(got by pos.eth.snap) gal)) -:: :: +point:snap:dawn: extract ship's contract state -:: :: -:: ++ point -:: |= [who=ship snap=snapshot:kale] -:: ^- (unit point:azimuth) -:: (~(get by pos.eth.snap) who) -:: :: +turf:snap:dawn: extract network domains -:: :: -:: ++ turf -:: |= snap=snapshot:kale -:: ^- (unit (list ^turf)) -:: =- ?:(?=(%| -.out) ~ (some p.out)) -:: ^= out %- mule |. -:: %+ murn -:: ^- (list host:eyre) -:: %+ murn -:: ^- (list @t) -:: ~[pri sec ter]:dns.eth.snap -:: |= dom=@t -:: ^- (unit host:eyre) -:: (rush dom thos:de-purl:html) -:: |=(a=host:eyre ?:(?=(%| -.a) ~ (some p.a))) -:: -- + |% + :: +bloq:snap:dawn: extract block number + :: + ++ bloq + |= snap=snapshot:jael + ^- (unit @ud) + =- ?:(?=(%| -.out) ~ (some p.out)) + ^= out %- mule |. + latest-block.snap + :: +czar:snap:dawn: extract galaxy table + :: + ++ czar + |= snap=snapshot:jael + ^- (unit (map ship [=life =pass])) + =- ?:(?=(%| -.out) ~ (some p.out)) + ^= out %- mule |. + %- ~(gas by *(map ship [=life =pass])) + %+ turn (gulf 0 255) + |= gal=@ + ^- [ship [life pass]] + :- gal + ~| czar-gal=gal + [life pass]:(need net:(~(got by pos.eth.snap) gal)) + :: +point:snap:dawn: extract ship's contract state + :: + ++ point + |= [who=ship snap=snapshot:jael] + ^- (unit point:azimuth) + (~(get by pos.eth.snap) who) + :: +turf:snap:dawn: extract network domains + :: + ++ turf + |= snap=snapshot:jael + ^- (unit (list ^turf)) + =- ?:(?=(%| -.out) ~ (some p.out)) + ^= out %- mule |. + %+ murn + ^- (list host:eyre) + %+ murn + ^- (list @t) + ~[pri sec ter]:dns.eth.snap + |= dom=@t + ^- (unit host:eyre) + (rush dom thos:de-purl:html) + |=(a=host:eyre ?:(?=(%| -.a) ~ (some p.a))) + -- :: +veri:dawn: validate keys, life, discontinuity, &c :: ++ veri diff --git a/pkg/arvo/tests/sys/vane/alef.hoon b/pkg/arvo/tests/sys/vane/alef.hoon index 6b07920a0..9da66c3f7 100644 --- a/pkg/arvo/tests/sys/vane/alef.hoon +++ b/pkg/arvo/tests/sys/vane/alef.hoon @@ -121,14 +121,14 @@ :: =/ lane-foo=lane:alef [%| `@ux``@`%lane-foo] :: - =/ =message:alef [/g/talk [%first %post]] + =/ =plea:ames [%g /talk [%first %post]] :: =/ =shut-packet:alef :* sndr-life=4 rcvr-life=3 bone=1 message-num=1 - [%& num-fragments=1 fragment-num=0 (jam message)] + [%& num-fragments=1 fragment-num=0 (jam plea)] == :: =/ =packet:alef @@ -144,36 +144,34 @@ =/ =point:alef :* rift=1 life=4 - crypto-suite=1 - encryption-key=`@`alice-pub - authentication-key=`@`0 + keys=[[life=4 [crypto-suite=1 `@`alice-pub]] ~ ~] sponsor=`~bus == %- take - :^ bob /alien ~[//unix] + :^ bob /public-keys ~[//unix] ^- sign:alef - [%j %public-keys %full [n=[~bus point] ~ ~]] + [%k %public-keys %full [n=[~bus point] ~ ~]] :: ;: weld %+ expect-eq - !> [~[//unix] %pass /alien %j %public-keys ~bus]~ + !> [~[//unix] %pass /public-keys %k %public-keys [~bus ~ ~]]~ !> moves1 :: %+ expect-eq - !> [~[//unix] %pass /bone/~bus/1 %g %memo ~bus /g/talk [%first %post]]~ + !> [~[//unix] %pass /bone/~bus/1 %g %plea ~bus %g /talk [%first %post]]~ !> moves2 == :: ++ test-message-flow ^- tang :: =^ moves1 alice - (call alice ~[/alice] %memo ~doznec-doznec /g/talk [%get %post]) + (call alice ~[/alice] %plea ~doznec-doznec %g /talk [%get %post]) :: =^ moves2 bob (call bob ~[/bob] %hear (snag-packet 0 moves1)) =^ moves3 bob (take bob /bone/~nec/1 ~[/bob] %g %done ~) =^ moves4 alice (call alice ~[/alice] %hear (snag-packet 0 moves3)) =^ moves5 bob - (take bob /bone/~nec/1 ~[/bob] %g %memo /g/talk [%post 'first1!!']) + (take bob /bone/~nec/1 ~[/bob] %g %boon [%post 'first1!!']) :: =^ moves6 alice (call alice ~[/alice] %hear (snag-packet 0 moves5)) =^ moves7 bob (call bob ~[/bob] %hear (snag-packet 0 moves6)) @@ -187,13 +185,13 @@ !> moves4 :: %+ expect-eq - !> [~[/alice] %give %memo /g/talk %post 'first1!!'] + !> [~[/alice] %give %boon [%post 'first1!!']] !> (snag 1 `(list move:alef)`moves6) == :: ++ test-nack ^- tang =^ moves1 alice - (call alice ~[/alice] %memo ~doznec-doznec /g/talk [%get %post]) + (call alice ~[/alice] %plea ~doznec-doznec %g /talk [%get %post]) :: =^ moves2 bob (call bob ~[/bob] %hear (snag-packet 0 moves1)) =/ =error:alef [%flub [%leaf "sinusoidal repleneration"]~] diff --git a/pkg/arvo/tests/sys/vane/ames.hoon b/pkg/arvo/tests/sys/vane/ames.hoon deleted file mode 100644 index 14d17a8f4..000000000 --- a/pkg/arvo/tests/sys/vane/ames.hoon +++ /dev/null @@ -1,175 +0,0 @@ -/+ *test -:: -/= ames-raw /: /===/sys/vane/ames - /!noun/ -=/ type-spear -:!>(ames-raw) -:: -=/ test-pit=vase !>(.) -=/ ames-gate (ames-raw test-pit) -:: -|% -:: tests that %ames asks for private keys on %init -:: -++ test-init - =^ results1 ames-gate - =/ =duct [/ /term/1 / ~] - =/ =wire /our/~nul - %: ames-call - ames-gate - now=~1234.5.6 - call-args=[duct type=*type %soft %init ~nul] - expected-moves=[[duct %pass wire %j %vein ~] [duct %pass / %j %turf ~] ~] - == - :: - results1 -:: -:: tests that %ames sends a message to itself -:: -++ test-send - =/ now ~1234.5.6 - =/ =duct [/ /term/1 / ~] - =/ =wire /our/~nul - =/ pact1 - 0wHfb.1hdCh.0oxed.Ta7-f.4IIDV.4ku6J.PoJe7.AiyMS.w~mfu.V04ja.iXj8d.E3nq7. - gcW-a.0II6T.vb5zH.FHEkp.J7wgT.XTnuu.KaUiu.xZ6dg.qgWSH.3ovaO.dETNQ.5YAOR. - Lw8Mj.iQCrM.-TcjY.gFysP.XCfdx.52ack.MN~yA.0CNFU.0eL1M.Un-ey.CZyf9.Omk2p. - -Wbar.-w2bs.02sNg.340cg.okHUP - =/ pact2 - 0w78EWp.7898D.odZ3b.7iLvr.vyjzn.XBNaN.vxTZj.b4BFp.EHHvW.IjvpB.j0~87. - t06D0.SbrGK.QlIeE.1Xj1v.CX~YY.c9cAE.eUPSb.gj8-M.e15TJ.EPPXN.efms-.8y9og. - IdyLr.lkZJ5.KMB-F.S7mwd.t5rmo.CEYCp.3zC4n.HYh2T.RgVI8.0eT1z.Jxj9c.m1Sm5. - SaYrP.0LKO3.-w2cA.02sNg.340cg.oi9Nj - =/ vein-data - [life=1 (my [1 sec:ex:(pit:nu:crub:crypto 512 ~nul)] ~)] - :: - =^ results1 ames-gate - %: ames-call - ames-gate - now - call-args=[duct type=*type %soft [%barn ~]] - expected-moves=[[duct %give %turf ~] ~] - == - :: - =. now (add ~m1 now) - :: ~& [%fox1 now fox.ames-gate] - =^ results2 ames-gate - %: ames-take - ames-gate - now - take-args=[wire duct -:!>([%j %vein vein-data]) [%j %vein vein-data]] - expected-moves=~ - == - :: - =. now (add ~m1 now) - :: ~& [%fox2 now fox.ames-gate] - =^ results3 ames-gate - %: ames-call - ames-gate - now - call-args=[duct type=*type %soft [%want ~nul /foo 1]] - :~ [duct %pass /pubs/~nul %j %pubs ~nul] - [duct %give %send *lane:ames pact1] - :: XX why ~s4 ?? - :: - [duct %pass /ames %b %wait (add ~s4 now)] - == - == - :: - =. now (add ~m1 now) - :: ~& [%fox3 now fox.ames-gate] - =^ results4 ames-gate - %: ames-call - ames-gate - now - call-args=[duct type=*type %soft [%want ~nul /foo 2]] - expected-moves=[[duct %give %send *lane:ames pact2] ~] - == - :: - =. now (add ~m1 now) - :: ~& [%fox4 now fox.ames-gate] - =^ results5 ames-gate - %: ames-take - ames-gate - now - take-args=[wire duct -:!>([%b %wake ~]) [%b %wake ~]] - :~ [duct %give %send *lane:ames pact1] - [duct %give %send *lane:ames pact2] - [duct %pass /ames %b %wait (add ~s8 now)] - == - == - :: - :: ~& [%fox5 now fox.ames-gate] - :(weld results1 results2 results3 results4 results5) -:: -++ ames-scry - ^- sley - |= [* (unit (set monk)) =term =beam] - ^- (unit (unit cage)) - ?: =(%turf q.beam) - (some (some %noun !>(~))) - :: - ?: ?& =(%life q.beam) - =(/~nul s.beam) - == - (some (some %atom !>(1))) - :: - ?: ?& =(%saxo q.beam) - =(/~nul s.beam) - == - (some (some %noun !>([~nul ~]))) - :: - ?: ?& =(%sein q.beam) - =(/~nul s.beam) - == - (some (some %atom !>(~nul))) - :: - ?: ?& =(%deed q.beam) - =(/1/~nul s.beam) - == - =/ =deed:ames - [life=1 pub:ex:(pit:nu:crub:crypto 512 ~nul) ~] - (some (some %noun !>(deed))) - :: - ~& [%ames-scry-fail +<] - ~ -:: -++ ames-call - |= $: ames-gate=_ames-gate - now=@da - call-args=[=duct wrapped-task=(hypo (hobo task:able:ames-gate))] - expected-moves=(list move:ames-gate) - == - ^- [tang _ames-gate] - :: - =/ ames (ames-gate our=~nul now=now eny=`@`0xdead.beef ames-scry) - :: - =^ moves ames-gate - (call:ames call-args) - :: - =/ output=tang - %+ expect-eq - !> expected-moves - !> moves - :: - [output ames-gate] -:: -++ ames-take - |= $: ames-gate=_ames-gate - now=@da - take-args=[=wire =duct wrapped-sign=(hypo sign:ames-gate)] - expected-moves=(list move:ames-gate) - == - ^- [tang _ames-gate] - :: - =/ ames (ames-gate our=~nul now=now eny=`@`0xdead.beef ames-scry) - :: - =^ moves ames-gate - (take:ames take-args) - :: - =/ output=tang - %+ expect-eq - !> expected-moves - !> moves - :: - [output ames-gate] --- From 197ed0f2d4e6d6dc3adc8a84cdd191813be859bb Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 29 Jul 2019 14:53:19 -0700 Subject: [PATCH 037/451] no more memory leaks --- pkg/urbit/vere/ames.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/urbit/vere/ames.c b/pkg/urbit/vere/ames.c index 1156cb67b..83281cbea 100644 --- a/pkg/urbit/vere/ames.c +++ b/pkg/urbit/vere/ames.c @@ -196,12 +196,12 @@ u3_ames_decode_lane(u3_atom lan) { u3_lane lan_u; lan_u.pip_w = u3r_word(0, pip); - u3z(pip); c3_assert( _(u3a_is_cat(por)) ); c3_assert( por < 65536 ); lan_u.por_s = por; + u3z(cud); return lan_u; } @@ -346,6 +346,7 @@ u3_ames_ef_send(u3_pier* pir_u, u3_noun lan, u3_noun pac) _ames_send(pac_u); } } + u3z(lan); u3z(pac); } /* _ames_recv_cb(): receive callback. From 27ed2bff781dd8e240b3d416424d0dabd60a718f Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 29 Jul 2019 18:03:40 -0700 Subject: [PATCH 038/451] resend comet attestation on packet timeout --- pkg/arvo/sys/vane/alef.hoon | 59 ++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 20 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 18e89d053..f3168ca50 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1314,26 +1314,6 @@ $(blobs t.blobs) :: event-core - :: +attestation-packet: generate signed self-attestation for .her - :: - ++ attestation-packet - |= [her=ship =her=life] - ^- blob - :: - =/ signed=_+:*open-packet - :* ^= public-key pub:ex:crypto-core.ames-state - ^= sndr our - ^= sndr-life life.ames-state - ^= rcvr her - ^= rcvr-life her-life - == - :: - =/ =private-key sec:ex:crypto-core.ames-state - =/ =signature (sign-open-packet private-key signed) - =/ =open-packet [signature signed] - =/ =packet [[our her] encrypted=%.n origin=~ open-packet] - :: - (encode-packet packet) :: ++ update-known |= [=ship =point =peer-state] @@ -1463,6 +1443,28 @@ ?: direct.u.route event-core try-next-sponsor + :: +attestation-packet: generate signed self-attestation for .her + :: + :: Sent by a comet on first contact with a peer. Not acked. + :: + ++ attestation-packet + |= [her=ship =her=life] + ^- blob + :: + =/ signed=_+:*open-packet + :* ^= public-key pub:ex:crypto-core.ames-state + ^= sndr our + ^= sndr-life life.ames-state + ^= rcvr her + ^= rcvr-life her-life + == + :: + =/ =private-key sec:ex:crypto-core.ames-state + =/ =signature (sign-open-packet private-key signed) + =/ =open-packet [signature signed] + =/ =packet [[our her] encrypted=%.n origin=~ open-packet] + :: + (encode-packet packet) :: +got-peer-state: lookup .her state or crash :: ++ got-peer-state @@ -1523,12 +1525,29 @@ :: transport address has changed and this lane is no longer :: valid. :: + :: If .her is a galaxy, the lane will always remain direct. + :: =? route.peer-state ?& ?=(^ route.peer-state) direct.u.route.peer-state !=(%czar (clan:title her.channel)) == route.peer-state(direct.u %.n) + :: resend comet attestation packet if first message times out + :: + :: The attestation packet doesn't get acked, so if we tried to + :: send a packet but it timed out, maybe they didn't get our + :: attestation. + :: + :: Only resend on timeout of packets in the first message we + :: send them, since they should remember forever. + :: + =? event-core + ?& ?=(%pawn (clan:title our)) + =(1 current:(~(got by snd.peer-state) bone)) + == + (send-blob her.channel (attestation-packet [her her-life]:channel)) + :: maybe resend some timed out packets :: (run-message-pump bone %wake ~) :: +send-shut-packet: fire encrypted packet at rcvr and maybe sponsors From f32331cb380737670f9784b614e86deb8696abcf Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 29 Jul 2019 22:21:35 -0700 Subject: [PATCH 039/451] benchmarking printfs --- pkg/arvo/sys/vane/alef.hoon | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index f3168ca50..e6ed266b7 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2078,7 +2078,7 @@ ^+ [fragments gifts state] :: return unsent back to caller and reverse effects to finalize :: - =- ~& %alef-feed^(lent fragments)^%unsent^(lent unsent) + =- ::~& %alef-feed^(lent fragments)^%unsent^(lent unsent) [unsent (flop gifts) state] :: ^+ [unsent=fragments packet-pump] @@ -2139,7 +2139,7 @@ ?. found.- ~& %alef-hear-noop packet-pump - ~& %alef-hear-ack^message-num^fragment-num + ::~& %alef-hear-ack^message-num^fragment-num :: =. metrics.state metrics.- =. live.state live.- @@ -2362,7 +2362,7 @@ message-still :: ack all other packets :: - ~& %send-ack^fragment-num + ::~& %send-ack^fragment-num (give %send seq %& fragment-num) :: last-heard Date: Tue, 30 Jul 2019 16:11:19 -0700 Subject: [PATCH 040/451] behn fix crash from missing timer --- pkg/arvo/sys/vane/behn.hoon | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/arvo/sys/vane/behn.hoon b/pkg/arvo/sys/vane/behn.hoon index 9f9fc6f2f..54f54e211 100644 --- a/pkg/arvo/sys/vane/behn.hoon +++ b/pkg/arvo/sys/vane/behn.hoon @@ -103,8 +103,11 @@ ++ wake |= error=(unit tang) ^+ [moves state] + :: no-op on spurious but innocuous unix wakeups :: - ?~ timers.state ~| %behn-wake-no-timer^error !! + ?~ timers.state + ~? ?=(^ error) %behn-wake-no-timer^u.error + [moves state] :: if we errored, pop the timer and notify the client vane of the error :: ?^ error @@ -113,7 +116,6 @@ :: if unix woke us too early, retry by resetting the unix wakeup timer :: ?: (gth date.i.timers.state now) - ~? debug=%.n [%behn-wake-too-soon `@dr`(sub date.i.timers.state now)] set-unix-wake(next-wake.state ~) :: pop first timer, tell vane it has elapsed, and adjust next unix wakeup :: @@ -199,7 +201,6 @@ :: ignore duplicates :: ?: =(t i.timers) - ~? debug=%.n [%behn-set-duplicate t] timers :: timers at the same date form a fifo queue :: @@ -216,7 +217,6 @@ :: if we don't have this timer, no-op :: ?~ timers - ~? debug=%.n [%behn-unset-missing t] ~ ?: =(i.timers t) t.timers @@ -266,7 +266,7 @@ ^+ behn-gate :: ~| %behn-load-fail - behn-gate(state (behn-state old)) + behn-gate(state ;;(behn-state old)) :: +scry: view timer state :: :: TODO: not referentially transparent w.r.t. elapsed timers, From 43b35d7a0045cdda81a163ba0e8774adb693cae7 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 30 Jul 2019 19:31:15 -0700 Subject: [PATCH 041/451] ames %turf on %born --- pkg/arvo/sys/vane/alef.hoon | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index e6ed266b7..0fc993fff 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -808,7 +808,6 @@ ++ stay ~& %alef-larva-stay [%larva queued-events ames-state.adult-gate] ++ load |= old-raw=* - ~& %alef-larva-load :: =/ old ;; $% [%larva events=_queued-events state=_ames-state.adult-gate] @@ -818,9 +817,11 @@ :: ?- -.old %adult + ~& %alef-load (load:adult-core state.old) :: %larva + ~& %alef-load-larva =. queued-events events.old =. adult-gate (load:adult-core state.old) larval-gate @@ -894,6 +895,7 @@ :: ++ load |= old-state=_ames-state + ^+ ames-gate ames-gate(ames-state old-state) :: +scry: dereference namespace :: @@ -1366,9 +1368,17 @@ == :: +on-born: handle unix process restart :: - :: TODO: scry into jael and emit turf on %born - :: - ++ on-born event-core(unix-duct.ames-state duct) + ++ on-born + ^+ event-core + :: + =. unix-duct.ames-state duct + :: + =/ turfs + ;; (list turf) + =< q.q %- need %- need + (scry-gate [%141 %noun] ~ %k `beam`[[our %turf %da now] /]) + :: + (emit unix-duct.ames-state %give %turf turfs) :: +on-vega: handle kernel reload :: ++ on-vega event-core From b1aa926fd9f9bc78eadfe6a0275916674a47b45d Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 30 Jul 2019 22:56:58 -0700 Subject: [PATCH 042/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index a32cb8a23..e926598c6 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a1b00e99a32486b872d79d110ffac2fa2c0d0a3cb42e5d7748df8a32bbe5bb13 -size 9857182 +oid sha256:4c1b511e67f557ce6d59da29a70f7c6a305e12aef9abcefa217f99a16ac26aad +size 9870738 From bdd1aaf87d4a5ca764dd9567394e736eb2431881 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 31 Jul 2019 11:23:12 -0700 Subject: [PATCH 043/451] fix test scry --- pkg/arvo/tests/sys/vane/alef.hoon | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pkg/arvo/tests/sys/vane/alef.hoon b/pkg/arvo/tests/sys/vane/alef.hoon index 9da66c3f7..42e904f48 100644 --- a/pkg/arvo/tests/sys/vane/alef.hoon +++ b/pkg/arvo/tests/sys/vane/alef.hoon @@ -8,13 +8,15 @@ =/ alice vane =/ bob vane :: -=. our.alice ~nec -=. now.alice ~1111.1.1 -=. eny.alice 0xdead.beef +=. our.alice ~nec +=. now.alice ~1111.1.1 +=. eny.alice 0xdead.beef +=. scry-gate.alice |=(* ``[%noun !>(*(list turf))]) :: -=. our.bob ~doznec-doznec -=. now.bob ~1111.1.1 -=. eny.bob 0xbeef.dead +=. our.bob ~doznec-doznec +=. now.bob ~1111.1.1 +=. eny.bob 0xbeef.dead +=. scry-gate.bob |=(* ``[%noun !>(*(list turf))]) :: =. crypto-core.ames-state.alice (pit:nu:crub:crypto 512 (shaz 'alice')) =. crypto-core.ames-state.bob (pit:nu:crub:crypto 512 (shaz 'bob')) From 0c632e88118a949c14a4219719ee7bd63e9ba5d9 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 31 Jul 2019 11:51:31 -0700 Subject: [PATCH 044/451] fix |reload %a --- pkg/arvo/sys/vane/alef.hoon | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 0fc993fff..94c17991d 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -807,13 +807,10 @@ ++ scry scry:adult-core ++ stay ~& %alef-larva-stay [%larva queued-events ames-state.adult-gate] ++ load - |= old-raw=* - :: - =/ old - ;; $% [%larva events=_queued-events state=_ames-state.adult-gate] - [%adult state=_ames-state.adult-gate] - == - old-raw + |= $= old + $% [%larva events=_queued-events state=_ames-state.adult-gate] + [%adult state=_ames-state.adult-gate] + == :: ?- -.old %adult From c578d3282a7b469db699201bcb60e09c5e839998 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 31 Jul 2019 13:55:05 -0700 Subject: [PATCH 045/451] testnet config --- bin/ivory.pill | 4 ++-- bin/solid.pill | 4 ++-- pkg/arvo/app/acme.hoon | 2 +- pkg/arvo/sys/zuse.hoon | 7 ++++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/bin/ivory.pill b/bin/ivory.pill index b8eb687de..45499f9ea 100644 --- a/bin/ivory.pill +++ b/bin/ivory.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0e520b9ab0232d1765e1dacde96a1210845768e7334a334b5705d1c40348c82b -size 4464201 +oid sha256:44dac7f4c8d7940e86eaf0ee8d9bab06bef68ded19aa82182315eb9970bcaf73 +size 5071926 diff --git a/bin/solid.pill b/bin/solid.pill index e926598c6..ab1dba084 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4c1b511e67f557ce6d59da29a70f7c6a305e12aef9abcefa217f99a16ac26aad -size 9870738 +oid sha256:e92f44aa9c55cbe0a3f5ae9b6eebf99fd806ef20b4e3b4f52bb2198343430d59 +size 9945488 diff --git a/pkg/arvo/app/acme.hoon b/pkg/arvo/app/acme.hoon index bb0df2ae4..b61795b6a 100644 --- a/pkg/arvo/app/acme.hoon +++ b/pkg/arvo/app/acme.hoon @@ -344,7 +344,7 @@ :: =/ directory-base=purl =- (need (de-purl:html -)) - 'https://acme-v02.api.letsencrypt.org/directory' + 'https://acme-staging-v02.api.letsencrypt.org/directory' :: mov: list of outgoing moves for the current transaction :: =| mov=(list move) diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index b5027fb4b..1f341dea0 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -7736,8 +7736,8 @@ |% :: azimuth: data contract :: - ++ azimuth 0x223c.067f.8cf2.8ae1.73ee.5caf.ea60.ca44.c335.fecb :: mainnet - :: ++ azimuth 0x308a.b6a6.024c.f198.b57e.008d.0ac9.ad02.1988.6579 :: ropsten + :: ++ azimuth 0x223c.067f.8cf2.8ae1.73ee.5caf.ea60.ca44.c335.fecb :: mainnet + ++ azimuth 0x308a.b6a6.024c.f198.b57e.008d.0ac9.ad02.1988.6579 :: ropsten :: ++ azimuth 0x863d.9c2e.5c4c.1335.96cf.ac29.d552.55f0.d0f8.6381 :: local bridge :: ++ linear-star-release @@ -7748,7 +7748,8 @@ :: :: launch: block number of azimuth deploy :: - ++ launch 6.784.800 + :: ++ launch 6.784.800 + ++ launch 4.601.630 :: :: public: block number of azimuth becoming independent :: From 8fd260f9f88bd4e279ea7b85758243226dde8062 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 31 Jul 2019 14:21:07 -0700 Subject: [PATCH 046/451] print more --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index ab1dba084..ff4583b50 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e92f44aa9c55cbe0a3f5ae9b6eebf99fd806ef20b4e3b4f52bb2198343430d59 -size 9945488 +oid sha256:2e22d240ac19848f8d7a24bfc58c546d98237e4041c9007d48ba636de76b3bcc +size 9947077 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 94c17991d..4ddf412ec 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2541,6 +2541,7 @@ |= =wire ^- [her=ship =bone] :: + ~| %ames-wire-bone^wire ?> ?=([%bone @ @ ~] wire) [`@p`(slav %p i.t.wire) `@ud`(slav %ud i.t.t.wire)] :: +make-pump-timer-wire: construct wire for |packet-pump timer @@ -2555,6 +2556,7 @@ |= =wire ^- [her=ship =bone] :: + ~| %ames-wire-timer^wire ?> ?=([%pump @ @ ~] wire) [`@p`(slav %p i.t.wire) `@ud`(slav %ud i.t.t.wire)] :: +sign-open-packet: sign the contents of an $open-packet @@ -2658,14 +2660,18 @@ =/ rcvr-size (decode-ship-size (cut 0 [25 2] header)) =/ encrypted ?+((cut 0 [27 5] header) !! %0 %.y, %1 %.n) :: - ?> =(protocol-version version) - ?> =(checksum (end 0 20 (mug body))) - :: =/ =dyad :- sndr=(end 3 sndr-size body) rcvr=(cut 3 [sndr-size rcvr-size] body) :: - =+ ;; [origin=(unit lane) content=*] + ?. =(protocol-version version) + ~| %ames-protocol^version^dyad !! + ?. =(checksum (end 0 20 (mug body))) + ~| %ames-checksum^dyad !! + :: + =+ ~| %ames-invalid-packet + ;; [origin=(unit lane) content=*] + ~| %ames-invalid-noun %- cue (rsh 3 (add rcvr-size sndr-size) body) :: From 2068b41140977a23e82c94413ed3bb61eaaa2bb9 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 31 Jul 2019 19:51:11 -0700 Subject: [PATCH 047/451] fix kale ducts --- bin/solid.pill | 4 +- pkg/arvo/sys/vane/kale.hoon | 191 ++++++++++++++++++++---------------- 2 files changed, 109 insertions(+), 86 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index ff4583b50..01ad2c787 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2e22d240ac19848f8d7a24bfc58c546d98237e4041c9007d48ba636de76b3bcc -size 9947077 +oid sha256:bacb35feea08c3f18e39ecbd06b5c941e1db9cf63d1a5c64aa79e5d283302ca8 +size 9950726 diff --git a/pkg/arvo/sys/vane/kale.hoon b/pkg/arvo/sys/vane/kale.hoon index bd97fdb2c..61c2b6599 100644 --- a/pkg/arvo/sys/vane/kale.hoon +++ b/pkg/arvo/sys/vane/kale.hoon @@ -43,7 +43,7 @@ == :: +$ state-pki :: urbit metadata $: $= own :: vault (vein) - $: yen=(set duct) :: trackers + $: yen=(set tracker) :: trackers sig=(unit oath) :: for a moon tuf=(list turf) :: domains boq=@ud :: boot block @@ -53,8 +53,8 @@ jaw=(map life ring) :: private keys == :: $= zim :: public - $: yen=(jug duct ship) :: trackers - ney=(jug ship duct) :: reverse trackers + $: yen=(jug tracker ship) :: trackers + ney=(jug ship tracker) :: reverse trackers dns=dnses :: on-chain dns state pos=(map ship point) :: on-chain ship state == :: @@ -73,6 +73,9 @@ +$ message-response :: response from her kale $% [%public-keys-result =public-keys-result] :: %public-keys response == +:: $tracker: client; either domestic (here=%.y) or foreign +:: ++$ tracker [here=? =duct] +$ card :: i/o action (wind note gift) :: :: :: @@ -93,9 +96,10 @@ :: :: +$ sign :: in result $<- $~ [%a %done ~] :: - $% [%a $>(%boon gift:able:ames)] :: message response - [%a $>(%done gift:able:ames)] :: message (n)ack - == :: + $% $: %a + $% $>(%boon gift:able:ames) :: message response + $>(%done gift:able:ames) :: message (n)ack + == == == -- :: :: :::: :::: # light :: light cores @@ -194,9 +198,11 @@ [who ?:(=(who dad) ~ $(who dad))] :: :: ++call:of ++ call :: invoke - |= $: :: hen: event cause + |= $: :: hyr: domestic? or foreign + :: hen: event cause :: tac: event data :: + hyr=? hen/duct tac/task == @@ -261,7 +267,7 @@ +>.^$ =. +>.^$ %- curd =< abet - %- public-keys:~(feel su hen our pki etn sap) + %- public-keys:~(feel su hyr hen our pki etn sap) [%diff ship diff]:i.diffs $(diffs t.diffs) :: @@ -340,39 +346,17 @@ %listen ~& [%kale-listen whos source]:tac %- curd =< abet - (sources:~(feel su hen our pki etn sap) [whos source]:tac) + (sources:~(feel su hyr hen our pki etn sap) [whos source]:tac) :: :: cancel all trackers from duct :: {$nuke whos=(set ship)} :: - $nuke - =/ ships=(list ship) - %~ tap in - %- ~(int in whos.tac) - (~(get ju yen.zim.pki) hen) - =. ney.zim.pki - |- ^- (jug ship duct) - ?~ ships - ney.zim.pki - (~(del ju $(ships t.ships)) i.ships hen) - =. yen.zim.pki - |- ^- (jug duct ship) - ?~ ships - yen.zim.pki - (~(del ju $(ships t.ships)) hen i.ships) - ?^ whos.tac - +>.$ - %_ +>.$ - yen.own.pki (~(del in yen.own.pki) hen) - yen.etn (~(del in yen.etn) hen) - == + $nuke (on-nuke [hyr hen] whos.tac) :: :: watch public keys :: [%public-keys ships=(set ship)] :: - %public-keys - %- curd =< abet - (~(public-keys ~(feed su hen our pki etn sap) hen) ships.tac) + %public-keys (on-public-keys [hyr hen] ships.tac) :: :: seen after breach :: [%meet our=ship who=ship] @@ -392,7 +376,7 @@ :: %sources ~& [%kale-sources] - (curd abet:~(sources ~(feed su hen our pki etn sap) hen)) + (curd abet:~(sources ~(feed su hyr hen our pki etn sap) hyr hen)) :: :: XX should be a subscription :: XX reconcile with .dns.eth @@ -412,7 +396,7 @@ %new-event ~& [%kale-new-event ship udiff]:tac %- curd =< abet - (~(new-event su hen our pki etn sap) ship.tac udiff.tac) + (~(new-event su hyr hen our pki etn sap) ship.tac udiff.tac) :: :: learn of kernel upgrade :: [%vega ~] @@ -424,7 +408,7 @@ :: {$private-keys $~} :: %private-keys - (curd abet:~(private-keys ~(feed su hen our pki etn sap) hen)) + (curd abet:~(private-keys ~(feed su hyr hen our pki etn sap) hyr hen)) :: %wegh %_ +> @@ -445,23 +429,15 @@ :: [%plea =ship =plea:ames] :: %plea - =* her ship.tac - =/ mes (message payload.plea.tac) - ?- -.mes + :: send ack immediately :: - :: cancel trackers - :: [%nuke whos=(set ship)] + =. moz [[hen %give %done ~] moz] + :: coerce and handle message :: - %nuke - =. moz [[hen %give %done ~] moz] - $(tac mes) - :: - :: view ethereum events - :: [%public-keys whos=(set ship)] - :: - %public-keys - =. moz [[hen %give %done ~] moz] - $(tac mes) + =/ mes ;;(message payload.plea.tac) + ?- -.mes + %nuke (on-nuke [hyr hen] whos.mes) + %public-keys (on-public-keys [hyr hen] whos.mes) == :: :: rewind to snapshot @@ -470,10 +446,46 @@ %wind (wind hen p.tac) == + :: +on-nuke: cancel trackers + :: + ++ on-nuke + |= [=tracker whos=(set ship)] + ^+ +> + :: + =/ ships=(list ship) + %~ tap in + %- ~(int in whos) + (~(get ju yen.zim.pki) tracker) + =. ney.zim.pki + |- ^- (jug ship ^tracker) + ?~ ships + ney.zim.pki + (~(del ju $(ships t.ships)) i.ships tracker) + =. yen.zim.pki + |- ^- (jug ^tracker ship) + ?~ ships + yen.zim.pki + (~(del ju $(ships t.ships)) tracker i.ships) + ?^ whos + +>.$ + %_ +>.$ + yen.own.pki (~(del in yen.own.pki) tracker) + yen.etn (~(del in yen.etn) tracker) + == + :: + ++ on-public-keys + |= [=tracker whos=(set ship)] + ^+ +> + :: + =/ feeder ~(feed su here.tracker duct.tracker our pki etn sap) + (curd abet:(~(public-keys feeder tracker) whos)) :: ++ take - |= [tea=wire hen=duct hin=sign] + |= [tea=wire hyr=? hen=duct hin=sign] ^+ +> + :: at the moment, we only get a +sign from ames + :: + ?> hyr ?> ?=([@ *] tea) =* wir t.tea ?- hin @@ -490,7 +502,7 @@ ?> ?=(%public-keys-result -.res) :: %- curd =< abet - (public-keys:~(feel su hen our pki etn sap) public-keys-result.res) + (public-keys:~(feel su hyr hen our pki etn sap) public-keys-result.res) == :: :: ++curd:of ++ curd :: relative moves @@ -535,7 +547,8 @@ :: any subscribers. :: =| moz=(list move) - =| $: hen=duct + =| $: hyr=? + hen=duct our=ship state-pki state-eth-node @@ -544,9 +557,9 @@ :: moz: moves in reverse order :: pki: relative urbit state :: - =* pki ->+< - =* etn ->+>- - =* sap ->+>+ + =* pki &4.- + =* etn &5.- + =* sap |5.- |% ++ this-su . :: :: ++abet:su @@ -565,17 +578,15 @@ $(noy t.noy, moz [[i.noy cad] moz]) :: ++ public-keys-give - |= [yen=(set duct) =public-keys-result] + |= [yen=(set tracker) =public-keys-result] =+ yez=~(tap in yen) |- ^+ this-su ?~ yez this-su - =* d i.yez + =* t i.yez =. this-su - :: TODO: stop looking at the duct - :: - ?. ?=([[%a *] *] d) - (emit d %give %public-keys public-keys-result) - (emit d %give %boon %public-keys-result public-keys-result) + ?: here.t + (emit duct.t %give %public-keys public-keys-result) + (emit duct.t %give %boon %public-keys-result public-keys-result) $(yez t.yez) :: ++ get-source @@ -613,20 +624,24 @@ ~ :: :: ++feed:su ++ feed :: subscribe to view - |_ :: hen: subscription source + |_ :: hyr: domestic? or foreign + :: hen: subscription source :: - hen/duct + $: hyr=? + hen=duct + == :: ++ public-keys |= whos=(set ship) + ^+ ..feed ?: fak.own.pki (public-keys:fake whos) =. ney.zim =/ whol=(list ship) ~(tap in whos) - |- ^- (jug ship duct) + |- ^- (jug ship tracker) ?~ whol ney.zim - (~(put ju $(whol t.whol)) i.whol hen) + (~(put ju $(whol t.whol)) i.whol [hyr hen]) =/ =public-keys-result :- %full ?: =(~ whos) @@ -644,14 +659,14 @@ %- ~(gas ju yen.zim) %+ turn ~(tap in whos) |= who=ship - [hen who] - =. ..feed (public-keys-give (sy hen ~) public-keys-result) + [[hyr hen] who] + =. ..feed (public-keys-give (sy [hyr hen] ~) public-keys-result) ..feed :: ++ private-keys :: private keys %_ ..feed moz [[hen %give %private-keys [lyf jaw]:own] moz] - yen.own (~(put in yen.own) hen) + yen.own (~(put in yen.own) hyr hen) == :: ++ sources @@ -693,14 +708,14 @@ :: :: ++pubs:feel:su ++ public-keys |= =public-keys-result - ^+ ..feel + ^+ this-su ?: ?=(%full -.public-keys-result) =. pos.zim (~(uni by pos.zim) points.public-keys-result) =/ pointl=(list [who=ship =point]) ~(tap by points.public-keys-result) - |- ^+ ..feel + |- ^+ this-su ?~ pointl - ..feel + this-su %+ public-keys-give (~(get ju ney.zim) who.i.pointl) [%full (my i.pointl ~)] @@ -734,27 +749,30 @@ :: :: ++vein:feel:su ++ private-keys :: kick private keys |= [=life =ring] - ^+ ..feel + ^+ this-su ?: &(=(lyf.own life) =((~(get by jaw.own) life) `ring)) - ..feel + this-su =. lyf.own life =. jaw.own (~(put by jaw.own) life ring) - (exec yen.own [%give %private-keys lyf.own jaw.own]) + =/ yen (~(run in yen.own) tail) + (exec yen [%give %private-keys lyf.own jaw.own]) :: ++ sources |= [whos=(set ship) =source] - ^+ ..feel + ^+ this-su ?: ?=(%& -.source) =/ send-message |= =message [hen %pass /public-keys %a %plea p.source %k /public-keys message] - =. ..feel + =. this-su (emit (send-message %nuke whos)) (emit (send-message %public-keys whos)) =^ =source-id this-su (get-source-id source) - =. ..feed + =. this-su ?~ whos - ..feed(default-source.etn source-id) + :: + =. default-source.etn source-id + this-su =/ whol=(list ship) ~(tap in `(set ship)`whos) =. ship-sources.etn |- ^- (map ship ^source-id) @@ -764,7 +782,7 @@ =. ship-sources-reverse %- ~(gas ju ship-sources-reverse) (turn whol |=(=ship [source-id ship])) - ..feed + this-su (exec yen.etn [%give %source whos source]) -- :: :: ++meet:su @@ -808,8 +826,9 @@ ?. ?=($soft -.q.hic) q.hic (task:able p.q.hic) + =/ here=? !=(%plea -.task) =^ did lex - abet:(~(call of [our now eny] lex) hen task) + abet:(~(call of [our now eny] lex) here hen task) [did ..^$] :: :: ++load ++ load :: upgrade @@ -1007,6 +1026,10 @@ hin/(hypo sign) == ^- [(list move) _..^$] - =^ did lex abet:(~(take of [our now eny] lex) tea hen q.hin) + =/ =sign q.hin + ?> ?=(%a -.sign) + ?> ?=(?(%boon %done) +<.sign) + =/ here=? %.y + =^ did lex abet:(~(take of [our now eny] lex) tea here hen sign) [did ..^$] -- From 83500256d87789dab5d4080922f2d7f26c6110bb Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 31 Jul 2019 20:14:28 -0700 Subject: [PATCH 048/451] debug printfs --- pkg/arvo/sys/arvo.hoon | 2 +- pkg/arvo/sys/vane/alef.hoon | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index 0d53a7cfe..6202c597a 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -649,7 +649,7 @@ :: =/ pit=vase !>(..is) :: =/ vil=vile (viol p.pit) :: cached reflexives -=| $: lac=_& :: laconic bit +=| $: lac=_| :: laconic bit eny=@ :: entropy our=ship :: identity bud=vase :: %zuse diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 4ddf412ec..ca0515376 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -973,10 +973,13 @@ %. +< :: ?. =(our rcvr.packet) + ~& %on-hear-forward on-hear-forward :: ?: encrypted.packet + ~& %on-hear-shut on-hear-shut + ~& %on-hear-open on-hear-open :: +on-hear-forward: maybe forward a packet to someone else :: @@ -1504,7 +1507,9 @@ =/ =bone bone.shut-packet :: ?: ?=(%& -.meat.shut-packet) + ~& %run-message-still (run-message-still bone %hear lane shut-packet) + ~& %run-message-pump (run-message-pump bone %hear [message-num +.meat]:shut-packet) :: +on-memo: handle request to send message :: @@ -2344,6 +2349,7 @@ :: ignore messages from far future; limit to 10 in progress :: ?: (gte seq (add 10 last-acked.state)) + ~& %ignoring-message-from-future^seq^last-acked.state message-still :: =/ is-last-fragment=? =(+(fragment-num) num-fragments) @@ -2366,10 +2372,11 @@ ?: is-last-fragment :: drop last packet since we don't know whether to ack or nack :: + ~& %repeat-last-unprocessed^seq^last-heard.state message-still :: ack all other packets :: - ::~& %send-ack^fragment-num + ~& %send-ack^fragment-num (give %send seq %& fragment-num) :: last-heard Date: Wed, 31 Jul 2019 20:21:54 -0700 Subject: [PATCH 049/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 01ad2c787..a431f0f47 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bacb35feea08c3f18e39ecbd06b5c941e1db9cf63d1a5c64aa79e5d283302ca8 -size 9950726 +oid sha256:fc161e969f17fcaf42534bf9b224e3400f7a39ec17686202aed03cfec2966f73 +size 9950706 From 503d53a55efabd5d3eeb39609e80199555dc867c Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 31 Jul 2019 20:33:18 -0700 Subject: [PATCH 050/451] actually make a new pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index a431f0f47..abc5d8188 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fc161e969f17fcaf42534bf9b224e3400f7a39ec17686202aed03cfec2966f73 -size 9950706 +oid sha256:6d111552699d22e06bf7fbba7b48c596410271ce3a0a4498bd5e7d78c9b46e59 +size 9952998 From c9af213e77155e3433d8b57f495b1275fad25037 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 31 Jul 2019 21:24:54 -0700 Subject: [PATCH 051/451] moar printfs --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index abc5d8188..dedb69d40 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6d111552699d22e06bf7fbba7b48c596410271ce3a0a4498bd5e7d78c9b46e59 -size 9952998 +oid sha256:a75f2f65ec572711902550a1f1cd03ded180bf3afb0b9865acf70c69dec83d2d +size 9951118 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index ca0515376..70d946752 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1259,10 +1259,13 @@ :: =. event-core ?~ ship-state=(~(get by peers.ames-state) ship) + ~& %alef-fresh-peer^ship^point (fresh-peer ship point) :: ?: ?=([~ %alien *] ship-state) + ~& %alef-meet-alien^ship^point (meet-alien ship point +.u.ship-state) + ~& %alef-update-known^ship^point (update-known ship point +.u.ship-state) :: $(points t.points) @@ -1277,7 +1280,6 @@ ++ meet-alien |= [=ship =point todos=pending-requests] ^+ event-core - ~& %alef-meet-alien^ship :: =/ =public-key pass:(~(got by keys.point) life.point) =. event-core @@ -1507,9 +1509,7 @@ =/ =bone bone.shut-packet :: ?: ?=(%& -.meat.shut-packet) - ~& %run-message-still (run-message-still bone %hear lane shut-packet) - ~& %run-message-pump (run-message-pump bone %hear [message-num +.meat]:shut-packet) :: +on-memo: handle request to send message :: @@ -2349,7 +2349,7 @@ :: ignore messages from far future; limit to 10 in progress :: ?: (gte seq (add 10 last-acked.state)) - ~& %ignoring-message-from-future^seq^last-acked.state + ~& %ignoring-packet-from-future^seq^last-acked.state message-still :: =/ is-last-fragment=? =(+(fragment-num) num-fragments) @@ -2359,12 +2359,12 @@ ?. is-last-fragment :: single packet ack :: - ~& %send-dupe-ack^fragment-num + ~& %send-dupe-ack^seq^fragment-num (give %send seq %& fragment-num) :: whole message (n)ack :: =/ ok=? (~(has in nax.state) seq) - ~& %send-dupe-ack-whole-message + ~& %send-dupe-ack-whole-message^seq (give %send seq %| ok lag=`@dr`0) :: last-acked Date: Wed, 31 Jul 2019 21:45:31 -0700 Subject: [PATCH 052/451] print even more --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index dedb69d40..a88dbf1af 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a75f2f65ec572711902550a1f1cd03ded180bf3afb0b9865acf70c69dec83d2d -size 9951118 +oid sha256:ec30f9b4fdc9c540a7ef41a8f5d7668acf26990baf4fa5507dd66aac33b3532c +size 9951869 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 70d946752..2cac238b9 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1209,6 +1209,7 @@ |= [=ship =rift] ^+ event-core :: + ~& %alef-breach^ship^rift =. peers.ames-state (~(del by peers.ames-state) ship) event-core :: +on-publ-rekey: handle new key for peer @@ -1223,6 +1224,7 @@ == ^+ event-core :: + ~& %alef-rekey^ship^life^public-key (insert-peer-state ship (got-peer-state ship) life public-key) :: +on-publ-sponsor: handle new or lost sponsor for self or peer :: @@ -1250,6 +1252,7 @@ ++ on-publ-full |= points=(map ship point) ^+ event-core + ~& %alef-on-publ-full :: => .(points ~(tap by points)) |^ ^+ event-core From e16fb70512bf34975f5394393fdd0feacac8dd1d Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 1 Aug 2019 16:27:04 -0700 Subject: [PATCH 053/451] fix kale gall take bug --- pkg/arvo/sys/vane/kale.hoon | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pkg/arvo/sys/vane/kale.hoon b/pkg/arvo/sys/vane/kale.hoon index 764838738..790c271a1 100644 --- a/pkg/arvo/sys/vane/kale.hoon +++ b/pkg/arvo/sys/vane/kale.hoon @@ -522,11 +522,11 @@ (curd abet:(~(public-keys feeder tracker) whos)) :: ++ take - |= [tea=wire hyr=? hen=duct hin=sign] + |= [tea=wire hen=duct hin=sign] ^+ +> :: at the moment, we only get a +sign from ames :: - ?> hyr + =/ hyr=? %.y ?> ?=([@ *] tea) =* wir t.tea ?- hin @@ -1153,9 +1153,6 @@ == ^- [(list move) _..^$] =/ =sign q.hin - ?> ?=(%a -.sign) - ?> ?=(?(%boon %done) +<.sign) - =/ here=? %.y - =^ did lex abet:(~(take of [our now eny] lex) tea here hen sign) + =^ did lex abet:(~(take of [our now eny] lex) tea hen sign) [did ..^$] -- From 71ff3e5bd0da2af7af83bce5a9c393fc16a454f2 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 1 Aug 2019 16:27:33 -0700 Subject: [PATCH 054/451] fix alef aqua tests --- pkg/arvo/app/aqua-ames.hoon | 2 +- pkg/arvo/app/aqua.hoon | 2 +- pkg/arvo/app/ph.hoon | 13 +++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/app/aqua-ames.hoon b/pkg/arvo/app/aqua-ames.hoon index 96e77f809..6db84b86f 100644 --- a/pkg/arvo/app/aqua-ames.hoon +++ b/pkg/arvo/app/aqua-ames.hoon @@ -68,7 +68,7 @@ ++ handle-restore |= who=@p %- emit-aqua-events - [%event who [//newt/0v1n.2m9vh %barn ~]]~ + [%event who [//newt/0v1n.2m9vh %born ~]]~ :: ++ handle-send |= [way=wire %send lan=lane:ames pac=@] diff --git a/pkg/arvo/app/aqua.hoon b/pkg/arvo/app/aqua.hoon index 38686c89f..fe576fa6f 100644 --- a/pkg/arvo/app/aqua.hoon +++ b/pkg/arvo/app/aqua.hoon @@ -429,7 +429,7 @@ ^- (list unix-event) :~ [/ %wack 0] :: eny [/ %whom who.ae] :: eny - [//newt/0v1n.2m9vh %barn ~] + [//newt/0v1n.2m9vh %born ~] [//behn/0v1n.2m9vh %born ~] :+ //term/1 %boot ?~ keys.ae diff --git a/pkg/arvo/app/ph.hoon b/pkg/arvo/app/ph.hoon index caebee4f9..34ece13b7 100644 --- a/pkg/arvo/app/ph.hoon +++ b/pkg/arvo/app/ph.hoon @@ -125,6 +125,19 @@ ~& > %bud-done (send-hi ~bud ~dev) (pure:m ~) + :: + :+ %hi-marbud-az + ~[~bud ~marbud] + =. eth-node (spawn:eth-node ~marbud) + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + ;< ~ bind:m (raw-ship ~marbud `(dawn:eth-node ~marbud)) + ~& > 'MARBUD-DONE' + ;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud)) + ~& > 'BUD-DONE' + (send-hi ~bud ~marbud) + (pure:m ~) :: :+ %breach-hi ~[~bud ~dev] From 20b1ec9d5679c6604a2bcc18097c1eb6e03872d8 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 1 Aug 2019 16:27:52 -0700 Subject: [PATCH 055/451] turn off |verb --- pkg/arvo/sys/arvo.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index b4bb9f9de..a9f11e011 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -649,7 +649,7 @@ :: =/ pit=vase !>(..is) :: =/ vil=vile (viol p.pit) :: cached reflexives -=| $: lac=_| :: laconic bit +=| $: lac=_& :: laconic bit eny=@ :: entropy our=ship :: identity bud=vase :: %zuse From fce0e555ebddb59dce7f6f15ee31ecfaba8eac25 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 1 Aug 2019 16:29:09 -0700 Subject: [PATCH 056/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 0779de587..f38b5d6a9 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:65c2ea4e7acacc3fb89a4aa91fb7d3c5e02c9026e88b8af15e0046c72299c6ed -size 10211870 +oid sha256:f2d5d15da203868617d88f3fbd412136cb99515d7366cc7cb3908c4ef15fa9d5 +size 10283885 From 5b9efe3c4fe085c9f54a6847d81edd4019e32f51 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 1 Aug 2019 16:46:36 -0700 Subject: [PATCH 057/451] remove the most annoying alef printfs --- pkg/arvo/sys/vane/alef.hoon | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 2cac238b9..2d0a25447 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -967,19 +967,16 @@ ^+ event-core :: ?: =(our sndr.packet) - ~& %alef-self + ::~& %alef-self event-core :: %. +< :: ?. =(our rcvr.packet) - ~& %on-hear-forward on-hear-forward :: ?: encrypted.packet - ~& %on-hear-shut on-hear-shut - ~& %on-hear-open on-hear-open :: +on-hear-forward: maybe forward a packet to someone else :: @@ -2379,7 +2376,7 @@ message-still :: ack all other packets :: - ~& %send-ack^seq^fragment-num + ::~& %send-ack^seq^fragment-num (give %send seq %& fragment-num) :: last-heard Date: Thu, 1 Aug 2019 16:47:41 -0700 Subject: [PATCH 058/451] remove spammy azimuth-tracker printfs --- pkg/arvo/app/azimuth-tracker.hoon | 3 --- 1 file changed, 3 deletions(-) diff --git a/pkg/arvo/app/azimuth-tracker.hoon b/pkg/arvo/app/azimuth-tracker.hoon index 15d68c84f..8cb3aba1b 100644 --- a/pkg/arvo/app/azimuth-tracker.hoon +++ b/pkg/arvo/app/azimuth-tracker.hoon @@ -148,7 +148,6 @@ =/ m (async:stdio ,block) ^- form:m ;< =json bind:m (request-rpc url `'block number' %eth-block-number ~) - ~& [%block-number json (parse-eth-block-number:rpc:ethereum json)] (get-block-by-number url (parse-eth-block-number:rpc:ethereum json)) :: ++ get-block-by-number @@ -297,7 +296,6 @@ ;< state=app-state bind:m (zoom state number.id.latest-block) |- ^- form:m =* walk-loop $ - ~& [%walk-loop number.state] ?: (gth number.state number.id.latest-block) ;< now=@da bind:m get-time:stdio ;< ~ bind:m (wait-effect:stdio (add now ~s10)) @@ -318,7 +316,6 @@ |= [url=@ta whos=(set ship) =a=pending-udiffs =block blocks=(list block)] =/ m (async:stdio ,[pending-udiffs (lest ^block)]) ^- form:m - ~& [%taking id.block] ?: &(?=(^ blocks) !=(parent-hash.block hash.id.i.blocks)) ~& %rewinding (rewind url a-pending-udiffs block blocks) From 3d31a2ecb9a60bcbe2ca76f018350a411906b055 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 5 Aug 2019 13:04:57 -0700 Subject: [PATCH 059/451] fix aqua for alef --- pkg/arvo/app/aqua.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/app/aqua.hoon b/pkg/arvo/app/aqua.hoon index fe576fa6f..cf0282c70 100644 --- a/pkg/arvo/app/aqua.hoon +++ b/pkg/arvo/app/aqua.hoon @@ -359,7 +359,7 @@ %^ slum installed.boot-ova.pil now.hid =/ vane ?+ v ~|([%unknown-vane v] !!) - %a %ames + %a %alef %b %behn %c %clay %d %dill From 53d9b41a802204176e9f2261b4b0ce39cd9881cd Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 5 Aug 2019 13:58:53 -0700 Subject: [PATCH 060/451] fixed alef bone<->duct mapping and therefore %breah-sudden ph test --- pkg/arvo/sys/vane/alef.hoon | 129 ++++++++++++++++-------------------- pkg/arvo/sys/vane/clay.hoon | 27 +++++++- 2 files changed, 81 insertions(+), 75 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 2d0a25447..2841a44e0 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -747,6 +747,7 @@ ?. ?=(%soft -.wrapped-task) wrapped-task ;;(task p.wrapped-task) + ~& %ames-call^our^-.task :: %born: set .unix-duct and start draining .queued-events :: ?: ?=(%born -.task) @@ -772,6 +773,7 @@ :: ++ take |= [=wire =duct type=* =sign] + ~& %ames-take^our^-.sign :: enqueue event if not a larval drainage timer :: ?. =(/larva wire) @@ -781,7 +783,7 @@ :: larval event drainage timer; pop and process a queued event :: ?. ?=([%b %wake *] sign) - ~& %alef-larva-wtf^sign + ~& %alef-larva-wtf [~ larval-gate] ~& %alef-larva-wake =^ first-event queued-events ~(get to queued-events) @@ -851,7 +853,7 @@ =< abet ?- -.task %born on-born:event-core - %crud ~& %ames-crud^p.task + %crud ~& %ames-crud^our^p.task %- (slog q.task) event-core %hear (on-hear:event-core [lane blob]:task) @@ -911,7 +913,9 @@ |% ++ event-core . ++ abet [(flop moves) ames-state] - ++ emit |=(=move event-core(moves [move moves])) + ++ emit + |= =move + event-core(moves [move moves]) :: +on-take-done: handle notice from vane that it processed a message :: ++ on-take-done @@ -1101,6 +1105,7 @@ :: =/ =peer-state (got-peer-state her) =/ =channel [[our her] now +>.ames-state -.peer-state] + ~& %ames-take-boon^our^her^bone=bone :: abet:(on-memo:(make-peer-core peer-state channel) bone payload) :: +on-plea: handle request to send message @@ -1119,7 +1124,8 @@ =/ =peer-state +.u.ship-state =/ =channel [[our ship] now +>.ames-state -.peer-state] :: - =^ =bone ossuary.peer-state (get-bone ossuary.peer-state duct) + =^ =bone ossuary.peer-state (bind-duct ossuary.peer-state duct) + ~& %ames-plea^our^ship^[bone=bone]^vane.plea^path.plea :: abet:(on-memo:(make-peer-core peer-state channel) bone plea) :: +on-take-wake: receive wakeup or error notification from behn @@ -1206,7 +1212,7 @@ |= [=ship =rift] ^+ event-core :: - ~& %alef-breach^ship^rift + ~& %alef-breach^our^ship^rift =. peers.ames-state (~(del by peers.ames-state) ship) event-core :: +on-publ-rekey: handle new key for peer @@ -1221,7 +1227,7 @@ == ^+ event-core :: - ~& %alef-rekey^ship^life^public-key + ~& %alef-rekey^our^ship^life^public-key (insert-peer-state ship (got-peer-state ship) life public-key) :: +on-publ-sponsor: handle new or lost sponsor for self or peer :: @@ -1238,7 +1244,7 @@ =/ =peer-state (got-peer-state ship) :: ?~ sponsor - ~| %lost-sponsor^ship !! + ~| %lost-sponsor^our^ship !! :: =. sponsor.peer-state u.sponsor :: @@ -1249,7 +1255,7 @@ ++ on-publ-full |= points=(map ship point) ^+ event-core - ~& %alef-on-publ-full + ~& %alef-on-publ-full^our :: => .(points ~(tap by points)) |^ ^+ event-core @@ -1577,6 +1583,13 @@ :: =. event-core (send-blob her.channel blob) peer-core + :: +got-duct: look up $duct by .bone, asserting already bound + :: + ++ got-duct + |= =bone + ^- ^duct + ~| %dangling-bone^her.channel^bone + (~(got by by-bone.ossuary.peer-state) bone) :: +run-message-pump: process $message-pump-task and its effects :: ++ run-message-pump @@ -1587,9 +1600,6 @@ =/ =message-pump-state (~(gut by snd.peer-state) bone *message-pump-state) :: - =^ client-duct ossuary.peer-state - (get-duct ossuary.peer-state bone duct) - :: =/ message-pump (make-message-pump message-pump-state channel) =^ pump-gifts message-pump-state (work:message-pump task) =. snd.peer-state (~(put by snd.peer-state) bone message-pump-state) @@ -1626,16 +1636,14 @@ :: not a nack-trace bone; positive ack gets emitted trivially :: ?: ok - (emit client-duct %give %done error=~) + (emit (got-duct bone) %give %done error=~) :: nack; enqueue, pending nack-trace message :: + :: The pump must never emit duplicate acks. If we heard the + :: nack-trace message already, the pump should not generate a + :: duplicate %done event when we hear a message nack packet. + :: =/ nax-key [bone message-num] - :: sanity check - :: - :: The pump must never emit duplicate acks, and if we've - :: heard the nack-trace, that should have cleared this - :: message from the pump. - :: ?< (~(has in nax.peer-state) nax-key) =. nax.peer-state (~(put in nax.peer-state) nax-key) :: @@ -1661,7 +1669,7 @@ ^+ peer-core :: =/ =wire (make-pump-timer-wire her.channel bone) - (emit client-duct %pass wire %b %wait date) + (emit duct %pass wire %b %wait date) :: +on-pump-rest: relay |message-pump's unset-timer request :: ++ on-pump-rest @@ -1669,7 +1677,7 @@ ^+ peer-core :: =/ =wire (make-pump-timer-wire her.channel bone) - (emit client-duct %pass wire %b %rest date) + (emit duct %pass wire %b %rest date) -- :: +run-message-still: process $message-still-task and its effects :: @@ -1722,45 +1730,36 @@ on-still-nack-trace :: +on-still-boon: handle response message received by |message-still :: + :: .bone must be mapped in .ossuary.peer-state, or we crash. + :: This means a malformed message will kill a channel. We + :: could change this to a no-op if we had some sort of security + :: reporting. + :: ++ on-still-boon |= [=message-num message=*] ^+ peer-core - ~& %ames-still-boon - :: send message ack packet unconditionally + ~& %ames-still-boon^our^bone=bone + :: send ack unconditionally :: =. peer-core (run-message-still bone %done ok=%.y) - :: if no .client-duct, bone is invalid; don't send to vane + :: give message to client vane :: - :: Future Ames should emit a security alert to local - :: subscribers if it can't find the duct for a %boon message. - :: - ?~ client-duct=(~(get by by-bone.ossuary.peer-state) bone) - ~& %ames-bogus-boon-target^her.channel - peer-core - :: valid bone; give message to vane - :: - (emit u.client-duct %give %boon message) + (emit (got-duct bone) %give %boon message) :: +on-still-nack-trace: handle nack-trace received by |message-still :: ++ on-still-nack-trace |= [=message-num message=*] ^+ peer-core - ~& %ames-still-nack-trace + ~& %ames-still-nack-trace^our^bone=bone :: =+ ;; [=failed=^message-num =error] message + :: ack nack-trace message (only applied if we don't later crash) + :: + =. peer-core (run-message-still bone %done ok=%.y) :: flip .bone's second bit to find referenced flow :: =/ target-bone=^bone (mix 0b10 bone) - :: if no .target-duct, malformed message; don't ack - :: - ?~ target-duct=(~(get by by-bone.ossuary.peer-state) target-bone) - ~& %ames-bogus-nack-trace-target^her.channel - peer-core - :: valid .target-duct; ack - :: - =. peer-core (run-message-still bone %done ok=%.y) - :: - =/ nax-key [target-bone failed-message-num] + =/ nax-key [target-bone failed-message-num] :: if we haven't heard a message nack, pretend we have :: :: The nack-trace message counts as a valid message nack on @@ -1778,13 +1777,13 @@ :: =. nax.peer-state (~(del in nax.peer-state) nax-key) :: - (emit u.target-duct %give %done `error) + (emit (got-duct target-bone) %give %done `error) :: +on-still-plea: handle request message received by |message-still :: ++ on-still-plea |= [=message-num message=*] ^+ peer-core - ~& %ames-still-plea + ~& %ames-still-plea^our^bone=bone :: don't accept requests for arbitrary vanes :: =+ ;; =plea message @@ -1806,13 +1805,10 @@ :: =/ =wire (make-bone-wire her.channel bone) :: - =^ client-duct ossuary.peer-state - (get-duct ossuary.peer-state bone duct) - :: ?+ vane.plea ~| %ames-evil-vane^vane.plea !! - %c (emit client-duct %pass wire %c %plea her.channel plea) - %g (emit client-duct %pass wire %g %plea her.channel plea) - %k (emit client-duct %pass wire %k %plea her.channel plea) + %c (emit duct %pass wire %c %plea her.channel plea) + %g (emit duct %pass wire %g %plea her.channel plea) + %k (emit duct %pass wire %k %plea her.channel plea) == -- -- @@ -2359,12 +2355,12 @@ ?. is-last-fragment :: single packet ack :: - ~& %send-dupe-ack^seq^fragment-num + ~& %send-dupe-ack^our.channel^seq^fragment-num (give %send seq %& fragment-num) :: whole message (n)ack :: =/ ok=? (~(has in nax.state) seq) - ~& %send-dupe-ack-whole-message^seq + ~& %send-dupe-ack-whole-message^our.channel^seq (give %send seq %| ok lag=`@dr`0) :: last-acked+.$ =/ =rave (rove-to-rave rove.wov) @@ -2835,6 +2844,7 @@ =+ inx=nix.u.ref =. +>+.$ =< ?>(?=(^ ref) .) + ~& %clay-duce-plea (send-over-ames hen her inx syd `rave) %= +>+.$ nix.u.ref +(nix.u.ref) @@ -2987,6 +2997,7 @@ |= {{a/wove b/(set duct)} c/(list wove)} ?.((~(has in b) hen) c [a c]) ?~ ref + ~& %clay-cancel-future => .(ref `(unit rind)`ref) :: XX TMI ?: =(~ wos) + :: XX handle? |- ^+ +> @@ -2998,6 +3009,7 @@ =: fod.u.ref (~(del by fod.u.ref) hen) bom.u.ref (~(del by bom.u.ref) u.nux) == + ~& %clay-cancel-plea (send-over-ames hen her u.nux syd ~) :: :: Handles a request. @@ -4442,9 +4454,10 @@ [mos ..^$] :: ?: ?=([%foreign-warp *] tea) + ~& %clay-take-foreign-warp^our^tea ?> ?=(%writ +<.q.hin) :_ ..^$ - [hen %give %boon (bind `riot`p.q.hin rant-to-rand)]~ + [hen %give %boon `(unit rand)`(bind `riot`p.q.hin rant-to-rand)]~ :: ?: ?=([%foreign-request @ @ @ *] tea) =/ her (slav %p i.t.tea) @@ -4456,6 +4469,7 @@ [mos ..^$] :: ?: ?=([%foreign-update @ @ *] tea) + ~& %clay-take-foreign-update^tea =/ her (slav %p i.t.tea) =/ syd (slav %tas i.t.t.tea) =^ mos ruf @@ -4482,16 +4496,23 @@ ?: ?=([%warp-index @ @ @ ~] tea) ?: ?=(%done +<.q.hin) ?~ error.q.hin + ~& %clay-take-warp-index-ok^our^tea [~ ..^$] :: TODO better error handling :: - ~& %clay-take-warp-index-error^tag.u.error.q.hin + ~& %clay-take-warp-index-error^our^tea^tag.u.error.q.hin %- (slog tang.u.error.q.hin) [~ ..^$] :: ?> ?=(%boon +<.q.hin) :: - =+ ;; res=(unit rand) payload.q.hin + =/ res=(unit rand) + ?^ v=((soft ,(unit rand)) payload.q.hin) + ~& %clay-take-boon^our^tea + u.v + ~| %clay-take-boon-fail^our^payload.q.hin + !! + ::=+ ;; res=(unit rand) payload.q.hin :: =/ her=ship (slav %p i.t.tea) =/ =desk (slav %tas i.t.t.tea) From 849ff5f9d9fc6f451be27a7cec85e35fe638dd19 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 5 Aug 2019 14:34:53 -0700 Subject: [PATCH 061/451] remove a couple printfs --- pkg/arvo/sys/vane/alef.hoon | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 2841a44e0..29444f6f0 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2513,10 +2513,8 @@ ^+ [next-bone.ossuary ossuary] :: ?^ existing=(~(get by by-duct.ossuary) duct) - ~& %ames-existing-bone^u.existing [u.existing ossuary] :: - ~& %ames-next-bone^next-bone.ossuary :- next-bone.ossuary :+ (add 4 next-bone.ossuary) (~(put by by-duct.ossuary) duct next-bone.ossuary) From 035e4930033e48d86a79ec3f600462ac5edeac12 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 5 Aug 2019 14:39:40 -0700 Subject: [PATCH 062/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index f38b5d6a9..139d498af 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f2d5d15da203868617d88f3fbd412136cb99515d7366cc7cb3908c4ef15fa9d5 -size 10283885 +oid sha256:3016c17bac2299e88dfb6e6f034a1477fa69072f1c47f3df9ff4662898f6dbd7 +size 10285104 From b13266cf69b1473f667528d586dc436e3304b7e7 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 5 Aug 2019 14:48:25 -0700 Subject: [PATCH 063/451] update pill again --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 139d498af..7b540a19f 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3016c17bac2299e88dfb6e6f034a1477fa69072f1c47f3df9ff4662898f6dbd7 -size 10285104 +oid sha256:30fbb38ab062b6180166252956a5a2d9d6f1e9d86d7063a2898a9ffb339d72cf +size 10284117 From ff9547f196f644f193e635e1ee3004bc00fc4083 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 5 Aug 2019 16:05:40 -0700 Subject: [PATCH 064/451] wrote error handling pathways --- bin/solid.pill | 4 +- pkg/arvo/sys/vane/alef.hoon | 75 +++++++++++++++++++++++-------------- 2 files changed, 48 insertions(+), 31 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 7b540a19f..1baf61336 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:30fbb38ab062b6180166252956a5a2d9d6f1e9d86d7063a2898a9ffb339d72cf -size 10284117 +oid sha256:495cc6e23d6805366048ef1451deeb3f4836411999ffd4e3329f1434085b72a3 +size 10287843 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 29444f6f0..0643dff06 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -710,11 +710,12 @@ :: %done: receive confirmation from vane of processing or failure :: %drop: clear .message-num from .nax.state :: %hear: handle receiving a message fragment packet +:: .ok: %.y unless previous failed attempt :: +$ message-still-task $% [%done ok=?] [%drop =message-num] - [%hear =lane =shut-packet] + [%hear =lane =shut-packet ok=?] == :: $message-still-gift: effect from |message-still :: @@ -953,21 +954,19 @@ |= [=lane =blob] ^+ event-core :: - (on-hear-packet lane (decode-packet blob)) + (on-hear-packet lane (decode-packet blob) ok=%.y) :: +on-hole: handle packet crash notification :: - :: TODO: retry processing and nack if possible - :: ++ on-hole |= [=lane =blob] ^+ event-core :: ~& %ames-hole - event-core + (on-hear-packet lane (decode-packet blob) ok=%.n) :: +on-hear-packet: handle mildly processed packet receipt :: ++ on-hear-packet - |= [=lane =packet] + |= [=lane =packet ok=?] ^+ event-core :: ?: =(our sndr.packet) @@ -987,7 +986,7 @@ :: TODO: filter for transitive closure of sponsors/sponsees. :: ++ on-hear-forward - |= [=lane =packet] + |= [=lane =packet ok=?] ^+ event-core :: =/ ship-state (~(get by peers.ames-state) rcvr.packet) @@ -1007,7 +1006,7 @@ :: +on-hear-open: handle receipt of plaintext comet self-attestation :: ++ on-hear-open - |= [=lane =packet] + |= [=lane =packet ok=?] ^+ event-core :: if we already know .sndr, ignore duplicate attestation :: @@ -1059,7 +1058,7 @@ :: +on-hear-shut: handle receipt of encrypted packet :: ++ on-hear-shut - |= [=lane =packet] + |= [=lane =packet ok=?] ^+ event-core :: encrypted packet content must be an encrypted atom :: @@ -1094,7 +1093,7 @@ `[direct=%.y lane] :: =/ peer-core (make-peer-core peer-state channel) - abet:(on-hear-shut-packet:peer-core lane shut-packet) + abet:(on-hear-shut-packet:peer-core lane shut-packet ok) :: +on-take-boon: receive request to give message to peer :: ++ on-take-boon @@ -1296,7 +1295,9 @@ |- ^+ event-core ?~ rcv-packets.todos event-core :: - =. event-core (on-hear-packet i.rcv-packets.todos) + =. event-core + (on-hear-packet [lane packet ok=%.y]:i.rcv-packets.todos) + :: $(rcv-packets.todos t.rcv-packets.todos) :: we're a comet; send self-attestation packet first :: @@ -1420,12 +1421,14 @@ ++ set-sponsor-heartbeat-timer ^+ event-core :: + ~& %ames-set-sponsor-timer^now (emit duct %pass /ping %b %wait `@da`(add now ~m1)) :: +ping-sponsor: message our sponsor so they know our lane :: ++ ping-sponsor ^+ event-core :: + ~& %ames-ping-sponsor^now (emit duct %pass /ping %a %plea sponsor.ames-state %a /ping ~) :: +send-blob: fire packet at .ship and maybe sponsors :: @@ -1509,13 +1512,15 @@ :: +on-hear-shut-packet: handle receipt of ack or message fragment :: ++ on-hear-shut-packet - |= [=lane =shut-packet] + |= [=lane =shut-packet ok=?] ^+ peer-core :: =/ =bone bone.shut-packet :: ?: ?=(%& -.meat.shut-packet) - (run-message-still bone %hear lane shut-packet) + (run-message-still bone %hear lane shut-packet ok) + :: ignore .ok for |message-pump; just try again on error + :: (run-message-pump bone %hear [message-num +.meat]:shut-packet) :: +on-memo: handle request to send message :: @@ -1530,11 +1535,11 @@ ++ on-wake |= [=bone error=(unit tang)] ^+ peer-core - :: TODO: handle error + :: if we previously errored out, print and try again :: - ?^ error - ~| %ames-wake-error - (mean u.error) + %- ?~ error + same + (slog >%ames-wake-fail< u.error) :: expire direct route :: :: Since a packet's timer expired, mark the .lane.route as @@ -1795,21 +1800,33 @@ :: TODO: treat ames as client vane and go through arvo? :: removes reentrancy and could nack more easily :: - =/ error=(unit error) - ?: =([/ping ~] +.plea) - ~ - `[%ping [%leaf "ames: invalid ping"]~] + ~& ?: =([/ping ~] +.plea) + %ames-ping + %ames-ping-lame :: (run-message-still bone %done ok=%.y) :: not a sponsor ping; relay .plea to .vane :: =/ =wire (make-bone-wire her.channel bone) + :: is this the first time we're trying to process this message? :: - ?+ vane.plea ~| %ames-evil-vane^vane.plea !! - %c (emit duct %pass wire %c %plea her.channel plea) - %g (emit duct %pass wire %g %plea her.channel plea) - %k (emit duct %pass wire %k %plea her.channel plea) - == + ?. ?=([%hear * * ok=%.n] task) + :: fresh plea; pass to client vane + :: + ?+ vane.plea ~| %ames-evil-vane^vane.plea !! + %c (emit duct %pass wire %c %plea her.channel plea) + %g (emit duct %pass wire %g %plea her.channel plea) + %k (emit duct %pass wire %k %plea her.channel plea) + == + :: we previously crashed on this message; send nack + :: + =. peer-core (run-message-still bone %done ok=%.n) + :: also send nack-trace + :: + =/ nack-trace-bone=^bone (mix 0b10 bone) + =/ =message-blob (jam [message-num ~]) + :: + (run-message-pump nack-trace-bone %memo message-blob) -- -- -- @@ -2311,7 +2328,7 @@ ^- pump-metrics metrics -- -:: +:: +make-message-still: construct |message-still message receiver core :: ++ make-message-still |= [state=message-still-state =channel] @@ -2328,12 +2345,12 @@ ?- -.task %done (on-done ok.task) %drop (on-drop message-num.task) - %hear (on-hear [lane shut-packet]:task) + %hear (on-hear [lane shut-packet ok]:task) == :: +on-hear: receive message fragment, possibly completing message :: ++ on-hear - |= [=lane =shut-packet] + |= [=lane =shut-packet ok=?] ^+ message-still :: we know this is a fragment, not an ack; expose into namespace :: From 290276f108879b57c38a8e89827e6879596ae3bd Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 5 Aug 2019 17:00:04 -0700 Subject: [PATCH 065/451] try to fix sponsor pinging --- bin/solid.pill | 4 +-- pkg/arvo/sys/vane/alef.hoon | 69 ++++++++++++++++++++++++++----------- 2 files changed, 50 insertions(+), 23 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 1baf61336..389dff37b 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:495cc6e23d6805366048ef1451deeb3f4836411999ffd4e3329f1434085b72a3 -size 10287843 +oid sha256:52447461c64b4abf79b6daafa9e693077e3342101f1d451f280d5bd145ac544e +size 10290998 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 0643dff06..1da77ae61 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -395,6 +395,7 @@ +$ ames-state $: peers=(map ship ship-state) =unix=duct + sponsor-ping-timer=(unit [=duct date=@da]) =life sponsor=ship crypto-core=acru:ames @@ -924,12 +925,13 @@ ^+ event-core :: ?: =(/ping wire) - set-sponsor-heartbeat-timer + ~& %ames-take-ping-done + set-sponsor-ping-timer :: =+ ^- [her=ship =bone] (parse-bone-wire wire) :: =/ =peer-state (got-peer-state her) - =/ =channel [[our her] now +>.ames-state -.peer-state] + =/ =channel [[our her] now |3.ames-state -.peer-state] =/ peer-core (make-peer-core peer-state channel) :: if processing succeded, send positive ack packet and exit :: @@ -1078,7 +1080,7 @@ :: and their public key using elliptic curve Diffie-Hellman. :: =/ =peer-state +.u.sndr-state - =/ =channel [[our sndr.packet] now +>.ames-state -.peer-state] + =/ =channel [[our sndr.packet] now |3.ames-state -.peer-state] =/ =shut-packet (decrypt symmetric-key.channel content.packet) :: ward against replay attacks :: @@ -1103,7 +1105,7 @@ =+ ^- [her=ship =bone] (parse-bone-wire wire) :: =/ =peer-state (got-peer-state her) - =/ =channel [[our her] now +>.ames-state -.peer-state] + =/ =channel [[our her] now |3.ames-state -.peer-state] ~& %ames-take-boon^our^her^bone=bone :: abet:(on-memo:(make-peer-core peer-state channel) bone payload) @@ -1121,7 +1123,7 @@ todos(snd-messages [[duct plea] snd-messages.todos]) :: =/ =peer-state +.u.ship-state - =/ =channel [[our ship] now +>.ames-state -.peer-state] + =/ =channel [[our ship] now |3.ames-state -.peer-state] :: =^ =bone ossuary.peer-state (bind-duct ossuary.peer-state duct) ~& %ames-plea^our^ship^[bone=bone]^vane.plea^path.plea @@ -1134,12 +1136,13 @@ ^+ event-core :: ?: =(/ping wire) + =. sponsor-ping-timer.ames-state ~ ping-sponsor :: =+ ^- [her=ship =bone] (parse-pump-timer-wire wire) :: =/ =peer-state (got-peer-state her) - =/ =channel [[our her] now +>.ames-state -.peer-state] + =/ =channel [[our her] now |3.ames-state -.peer-state] :: abet:(on-wake:(make-peer-core peer-state channel) bone error) :: +on-init: first boot; subscribe to our info from jael @@ -1236,15 +1239,16 @@ |= [=ship sponsor=(unit ship)] ^+ event-core :: + ?~ sponsor + ~| %lost-sponsor^our^ship !! + :: ?: =(our ship) - =. sponsor.ames-state ship + =. sponsor.ames-state u.sponsor + =. event-core set-sponsor-ping-timer ping-sponsor :: =/ =peer-state (got-peer-state ship) :: - ?~ sponsor - ~| %lost-sponsor^our^ship !! - :: =. sponsor.peer-state u.sponsor :: =. peers.ames-state (~(put by peers.ames-state) ship %known peer-state) @@ -1260,7 +1264,13 @@ |^ ^+ event-core ?~ points event-core :: - =+ [ship point]=i.points + =+ ^- [=ship =point] i.points + :: (re)start sponsor ping on new sponsor + :: + =? event-core &(=(our ship) ?=(^ sponsor.point)) + =. sponsor.ames-state u.sponsor.point + =. event-core set-sponsor-ping-timer + ping-sponsor :: =. event-core ?~ ship-state=(~(get by peers.ames-state) ship) @@ -1270,6 +1280,7 @@ ?: ?=([~ %alien *] ship-state) ~& %alef-meet-alien^ship^point (meet-alien ship point +.u.ship-state) + :: ~& %alef-update-known^ship^point (update-known ship point +.u.ship-state) :: @@ -1416,13 +1427,29 @@ ?: already-pending event-core (emit duct %pass /public-keys %k %public-keys [n=ship ~ ~]) - :: +set-sponsor-heartbeat-timer: trigger sponsor ping after timeout + :: +set-sponsor-ping-timer: trigger sponsor ping after timeout :: - ++ set-sponsor-heartbeat-timer + ++ set-sponsor-ping-timer + ^+ event-core + :: make sure there's never more than one timer + :: + =. event-core unset-sponsor-ping-timer + :: set new timer in state and emit request to behn + :: + =/ date=@da (add now ~m1) + =. sponsor-ping-timer.ames-state `[duct date] + :: + ~& %ames-set-sponsor-timer^now^date + (emit duct %pass /ping %b %wait date) + :: +unset-sponsor-ping-timer: cancel timer to ping sponsor + :: + ++ unset-sponsor-ping-timer ^+ event-core :: - ~& %ames-set-sponsor-timer^now - (emit duct %pass /ping %b %wait `@da`(add now ~m1)) + ?~ timer=sponsor-ping-timer.ames-state + event-core + ~& %ames-unset-sponsor-ping-timer + (emit duct.u.timer %pass /ping %b %rest date.u.timer) :: +ping-sponsor: message our sponsor so they know our lane :: ++ ping-sponsor @@ -1448,22 +1475,22 @@ todos(snd-packets (~(put in snd-packets.todos) blob)) :: =/ =peer-state +.u.ship-state - =/ =channel [[our ship] now +>.ames-state -.peer-state] + =/ =channel [[our ship] now |3.ames-state -.peer-state] :: - =* try-next-sponsor + ?~ route=route.peer-state ?: =(ship her-sponsor.channel) event-core $(ship her-sponsor.channel) :: - ?~ route=route.peer-state - try-next-sponsor - :: =. event-core (emit unix-duct.ames-state %give %send lane.u.route blob) :: ?: direct.u.route event-core - try-next-sponsor + :: + ?: =(ship her-sponsor.channel) + event-core + $(ship her-sponsor.channel) :: +attestation-packet: generate signed self-attestation for .her :: :: Sent by a comet on first contact with a peer. Not acked. From 2157995bb0c89bc1496bc2ab205295448a86174f Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 5 Aug 2019 17:21:00 -0700 Subject: [PATCH 066/451] stop pinging yourself, zod --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 389dff37b..d8fd98f41 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:52447461c64b4abf79b6daafa9e693077e3342101f1d451f280d5bd145ac544e -size 10290998 +oid sha256:91878e1cf47f40528ff924771938927b69e7672ef5c9e314ef1b26e1857a0186 +size 10291667 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 1da77ae61..170b74b82 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1147,12 +1147,19 @@ abet:(on-wake:(make-peer-core peer-state channel) bone error) :: +on-init: first boot; subscribe to our info from jael :: + :: A non-galaxy ship makes a %public-keys subscription to stay + :: updated about its sponsor. A galaxy is its own sponsor, so it + :: does not make such a request. + :: ++ on-init |= our=ship ^+ event-core :: - =~ (emit duct %pass /private-keys %k %private-keys ~) + =~ ?: =(%czar (clan:title our)) + event-core(sponsor.ames-state our) (emit duct %pass /public-keys %k %public-keys [n=our ~ ~]) + :: + (emit duct %pass /private-keys %k %private-keys ~) (emit duct %pass /turf %k %turf ~) == :: +on-priv: set our private key to jael's response From 2c652647fa85ced8ed808a741b9a28d6805f228f Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 5 Aug 2019 18:19:17 -0700 Subject: [PATCH 067/451] try to fix jael initialization request order --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index d8fd98f41..148614ade 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:91878e1cf47f40528ff924771938927b69e7672ef5c9e314ef1b26e1857a0186 -size 10291667 +oid sha256:0aca97b9f69b65bf0606fc4538ac6809ed09454959373d5bc6f73031b21e5a6c +size 10291742 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 170b74b82..229a255d9 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1155,13 +1155,12 @@ |= our=ship ^+ event-core :: - =~ ?: =(%czar (clan:title our)) - event-core(sponsor.ames-state our) - (emit duct %pass /public-keys %k %public-keys [n=our ~ ~]) + =. event-core (emit duct %pass /turf %k %turf ~) + =. event-core (emit duct %pass /private-keys %k %private-keys ~) :: - (emit duct %pass /private-keys %k %private-keys ~) - (emit duct %pass /turf %k %turf ~) - == + ?: =(%czar (clan:title our)) + event-core(sponsor.ames-state our) + (emit duct %pass /public-keys %k %public-keys [n=our ~ ~]) :: +on-priv: set our private key to jael's response :: ++ on-priv From e7f4859fd452b9ca338302ead72ee4bcf0cf6b63 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 5 Aug 2019 21:12:01 -0700 Subject: [PATCH 068/451] try again to get ~zod to stop pinging itself --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 148614ade..905eaaca4 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0aca97b9f69b65bf0606fc4538ac6809ed09454959373d5bc6f73031b21e5a6c -size 10291742 +oid sha256:c53e0f4465b1807da125dc535eec6bbda202b0227aad7cac174bfc8f8849bfa3 +size 10292159 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 229a255d9..a11db0b74 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1248,7 +1248,7 @@ ?~ sponsor ~| %lost-sponsor^our^ship !! :: - ?: =(our ship) + ?: &(=(our ship) !=(our u.sponsor)) =. sponsor.ames-state u.sponsor =. event-core set-sponsor-ping-timer ping-sponsor @@ -1273,7 +1273,8 @@ =+ ^- [=ship =point] i.points :: (re)start sponsor ping on new sponsor :: - =? event-core &(=(our ship) ?=(^ sponsor.point)) + =? event-core + &(=(our ship) ?=(^ sponsor.point) !=(our u.sponsor.point)) =. sponsor.ames-state u.sponsor.point =. event-core set-sponsor-ping-timer ping-sponsor From b4935c50c095c937f73ba0c0b7551bb460d4e47e Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 5 Aug 2019 21:42:51 -0700 Subject: [PATCH 069/451] fix kale->dill %done --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/kale.hoon | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 905eaaca4..f10a192d4 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c53e0f4465b1807da125dc535eec6bbda202b0227aad7cac174bfc8f8849bfa3 -size 10292159 +oid sha256:b7b50f915b1a081dd82d4a409b48bcddec51a1842c37b54fdbaa25c7e18b6f79 +size 10292045 diff --git a/pkg/arvo/sys/vane/kale.hoon b/pkg/arvo/sys/vane/kale.hoon index 790c271a1..0d0995e54 100644 --- a/pkg/arvo/sys/vane/kale.hoon +++ b/pkg/arvo/sys/vane/kale.hoon @@ -538,7 +538,6 @@ +>.$ :: [%a %boon *] - =. moz [[hen %give %done ~] moz] =+ ;; res=message-response payload.hin ?> ?=(%public-keys-result -.res) :: From 2767765835e33763cb6060f7abbac47fd9350d1e Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 7 Aug 2019 22:18:25 -0700 Subject: [PATCH 070/451] fix undead ames crash --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 7 +------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 61965ad82..575cb5eaa 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:332ec24cf9347844fb77d75484a2f2b93b9281d331af06f4351910b74e5771d9 -size 10373689 +oid sha256:aff0bad3374ea6a5e88e80a4e307620daa762bbfce062d65db8b64e240ad4018 +size 10373055 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 12734deb2..e2bc6dcac 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1587,12 +1587,7 @@ ^+ peer-core :: update and print connection status :: - =. peer-core %- update-qos - ?- -.qos.peer-state - %unborn [%live last-contact=now] - %live [%live last-contact=now] - %dead ~| %undead-peer^her.channel !! - == + =. peer-core (update-qos %live last-contact=now) :: =/ =bone bone.shut-packet :: From f21533cc19bccd3a2159cf278c58b976e722860e Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 7 Aug 2019 22:40:33 -0700 Subject: [PATCH 071/451] ping sponsor on %born --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 575cb5eaa..291c174ad 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aff0bad3374ea6a5e88e80a4e307620daa762bbfce062d65db8b64e240ad4018 -size 10373055 +oid sha256:4f6ce501f6f7e164aab23c347790664bc6075994c9bf950a7f57b39d7be90a5a +size 10373580 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index e2bc6dcac..67ab6f9ec 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1424,6 +1424,11 @@ ^+ event-core :: =. unix-duct.ames-state duct + :: clear sponsor ping timer and ping now + :: + =? event-core !=(%czar (clan:title our)) + => unset-sponsor-ping-timer + ping-sponsor :: =/ turfs ;; (list turf) From 0b24c5be0b16042a4a0e2cc36a4e5d6ba79e6bcb Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 7 Aug 2019 23:13:23 -0700 Subject: [PATCH 072/451] stop pinging yourself, round two --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 291c174ad..df821add9 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4f6ce501f6f7e164aab23c347790664bc6075994c9bf950a7f57b39d7be90a5a -size 10373580 +oid sha256:58e38755647e95f705c77cceff5a111fe44b3688d7400d194e82a378c9fee69e +size 10373733 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 67ab6f9ec..e3a31e835 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1133,9 +1133,9 @@ ++ on-plea |= [=ship =plea] ^+ event-core - :: if .plea is a sponsor ping; ack it + :: if .plea is a sponsor ping, ack it :: - ?: =([%a /ping ~] plea) + ?: =([our %a /ping ~] [ship plea]) ~& %ames-ack-ping^our^ship (emit duct %give %done ~) :: .plea is from local vane to foreign ship From 9961f2946b328413a03fb58badb1bacbdd63bc99 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 9 Aug 2019 14:20:16 -0700 Subject: [PATCH 073/451] remove all sponsor logic from ames in preparation for moving to an app --- bin/solid.pill | 4 +- pkg/arvo/sys/vane/alef.hoon | 96 +++++-------------------------------- 2 files changed, 14 insertions(+), 86 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index df821add9..ccaa0f8a8 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:58e38755647e95f705c77cceff5a111fe44b3688d7400d194e82a378c9fee69e -size 10373733 +oid sha256:ba52227fca803f06c6b1dc7b344bc013dee518c3a68e9bd58a1da2d6fdd1fc96 +size 10363694 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index e3a31e835..b663e6716 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -325,7 +325,6 @@ :: our data, common to all dyads :: $: =our=life - our-sponsor=ship crypto-core=acru:ames == :: her data, specific to this dyad @@ -395,9 +394,7 @@ +$ ames-state $: peers=(map ship ship-state) =unix=duct - sponsor-ping-timer=(unit [=duct date=@da]) =life - sponsor=ship crypto-core=acru:ames == :: $ship-state: all we know about a peer @@ -653,10 +650,6 @@ :: message to the remote vane from which the forward flow message :: originated. :: -:: Ames gives a %done sign to itself when our sponsor acks a -:: heartbeat message we sent it. This triggers a timer, which then -:: triggers the next heartbeat message to be sent. -:: +$ sign $~ [%b %wake ~] $% $: %b @@ -932,17 +925,12 @@ ++ on-take-done |= [=wire error=(unit error)] ^+ event-core - :: if /ping wire, sponsor acked our ping; reset timer - :: - ?: =(/ping wire) - ~& %ames-take-ping-done - set-sponsor-ping-timer - :: otherwise, we need to relay the vane ack to the foreign peer + :: relay the vane ack to the foreign peer :: =+ ^- [her=ship =bone] (parse-bone-wire wire) :: =/ =peer-state (got-peer-state her) - =/ =channel [[our her] now |3.ames-state -.peer-state] + =/ =channel [[our her] now |2.ames-state -.peer-state] =/ peer-core (make-peer-core peer-state channel) :: if processing succeded, send positive ack packet and exit :: @@ -1096,7 +1084,7 @@ :: and their public key using elliptic curve Diffie-Hellman. :: =/ =peer-state +.u.sndr-state - =/ =channel [[our sndr.packet] now |3.ames-state -.peer-state] + =/ =channel [[our sndr.packet] now |2.ames-state -.peer-state] =/ =shut-packet (decrypt symmetric-key.channel content.packet) :: ward against replay attacks :: @@ -1124,7 +1112,7 @@ =+ ^- [her=ship =bone] (parse-bone-wire wire) :: =/ =peer-state (got-peer-state her) - =/ =channel [[our her] now |3.ames-state -.peer-state] + =/ =channel [[our her] now |2.ames-state -.peer-state] ~& %ames-take-boon^our^her^bone=bone :: abet:(on-memo:(make-peer-core peer-state channel) bone payload) @@ -1133,11 +1121,6 @@ ++ on-plea |= [=ship =plea] ^+ event-core - :: if .plea is a sponsor ping, ack it - :: - ?: =([our %a /ping ~] [ship plea]) - ~& %ames-ack-ping^our^ship - (emit duct %give %done ~) :: .plea is from local vane to foreign ship :: =/ ship-state (~(get by peers.ames-state) ship) @@ -1148,7 +1131,7 @@ todos(snd-messages [[duct plea] snd-messages.todos]) :: =/ =peer-state +.u.ship-state - =/ =channel [[our ship] now |3.ames-state -.peer-state] + =/ =channel [[our ship] now |2.ames-state -.peer-state] :: =^ =bone ossuary.peer-state (bind-duct ossuary.peer-state duct) ~& %ames-plea^our^ship^[bone=bone]^vane.plea^path.plea @@ -1160,14 +1143,10 @@ |= [=wire error=(unit tang)] ^+ event-core :: - ?: =(/ping wire) - =. sponsor-ping-timer.ames-state ~ - ping-sponsor - :: =+ ^- [her=ship =bone] (parse-pump-timer-wire wire) :: =/ =peer-state (got-peer-state her) - =/ =channel [[our her] now |3.ames-state -.peer-state] + =/ =channel [[our her] now |2.ames-state -.peer-state] :: abet:(on-wake:(make-peer-core peer-state channel) bone error) :: +on-init: first boot; subscribe to our info from jael @@ -1180,12 +1159,9 @@ |= our=ship ^+ event-core :: - =. event-core (emit duct %pass /turf %k %turf ~) - =. event-core (emit duct %pass /private-keys %k %private-keys ~) - :: - ?: =(%czar (clan:title our)) - event-core(sponsor.ames-state our) - (emit duct %pass /public-keys %k %public-keys [n=our ~ ~]) + =~ (emit duct %pass /turf %k %turf ~) + (emit duct %pass /private-keys %k %private-keys ~) + == :: +on-priv: set our private key to jael's response :: ++ on-priv @@ -1262,7 +1238,7 @@ :: ~& %alef-rekey^our^ship^life^public-key (insert-peer-state ship (got-peer-state ship) life public-key) - :: +on-publ-sponsor: handle new or lost sponsor for self or peer + :: +on-publ-sponsor: handle new or lost sponsor for peer :: :: TODO: handle sponsor loss :: @@ -1273,13 +1249,7 @@ ?~ sponsor ~| %lost-sponsor^our^ship !! :: - ?: &(=(our ship) !=(our u.sponsor)) - =. sponsor.ames-state u.sponsor - =. event-core set-sponsor-ping-timer - ping-sponsor - :: - =/ =peer-state (got-peer-state ship) - :: + =/ =peer-state (got-peer-state ship) =. sponsor.peer-state u.sponsor :: =. peers.ames-state (~(put by peers.ames-state) ship %known peer-state) @@ -1296,13 +1266,6 @@ ?~ points event-core :: =+ ^- [=ship =point] i.points - :: (re)start sponsor ping on new sponsor - :: - =? event-core - &(=(our ship) ?=(^ sponsor.point) !=(our u.sponsor.point)) - =. sponsor.ames-state u.sponsor.point - =. event-core set-sponsor-ping-timer - ping-sponsor :: =. event-core ?~ ship-state=(~(get by peers.ames-state) ship) @@ -1424,11 +1387,6 @@ ^+ event-core :: =. unix-duct.ames-state duct - :: clear sponsor ping timer and ping now - :: - =? event-core !=(%czar (clan:title our)) - => unset-sponsor-ping-timer - ping-sponsor :: =/ turfs ;; (list turf) @@ -1464,36 +1422,6 @@ ?: already-pending event-core (emit duct %pass /public-keys %k %public-keys [n=ship ~ ~]) - :: +set-sponsor-ping-timer: trigger sponsor ping after timeout - :: - ++ set-sponsor-ping-timer - ^+ event-core - :: make sure there's never more than one timer - :: - =. event-core unset-sponsor-ping-timer - :: set new timer in state and emit request to behn - :: - =/ date=@da (add now ~m1) - =. sponsor-ping-timer.ames-state `[duct date] - :: - ~& %ames-set-sponsor-timer^now^date - (emit duct %pass /ping %b %wait date) - :: +unset-sponsor-ping-timer: cancel timer to ping sponsor - :: - ++ unset-sponsor-ping-timer - ^+ event-core - :: - ?~ timer=sponsor-ping-timer.ames-state - event-core - ~& %ames-unset-sponsor-ping-timer - (emit duct.u.timer %pass /ping %b %rest date.u.timer) - :: +ping-sponsor: message our sponsor so they know our lane - :: - ++ ping-sponsor - ^+ event-core - :: - ~& %ames-ping-sponsor^now - (emit duct %pass /ping %a %plea sponsor.ames-state %a /ping ~) :: +send-blob: fire packet at .ship and maybe sponsors :: :: Send to .ship and sponsors until we find a direct lane. @@ -1512,7 +1440,7 @@ todos(snd-packets (~(put in snd-packets.todos) blob)) :: =/ =peer-state +.u.ship-state - =/ =channel [[our ship] now |3.ames-state -.peer-state] + =/ =channel [[our ship] now |2.ames-state -.peer-state] :: ?~ route=route.peer-state ?: =(ship her-sponsor.channel) From 6682f2d0ef63ee33a33802225bea4bf1af5e35c0 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 9 Aug 2019 18:24:47 -0700 Subject: [PATCH 074/451] %ping app --- bin/solid.pill | 4 +- pkg/arvo/app/ping.hoon | 94 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 pkg/arvo/app/ping.hoon diff --git a/bin/solid.pill b/bin/solid.pill index ccaa0f8a8..bc3646bdb 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ba52227fca803f06c6b1dc7b344bc013dee518c3a68e9bd58a1da2d6fdd1fc96 -size 10363694 +oid sha256:ebc712b448f1f1029a89c30db70c90d40238e33e693a3293c54df8d7151024b1 +size 10365770 diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon new file mode 100644 index 000000000..ed8907daf --- /dev/null +++ b/pkg/arvo/app/ping.hoon @@ -0,0 +1,94 @@ +=* point point:able:kale +:: +=> |% + +$ app-state ~ + +$ move [=bone =card] + +$ card + $% [%poke =wire [=ship app=term] =action] + [%wait =wire date=@da] + == + +$ action + $% [%ping ~] + == + -- +:: +=> |% + :: +print-error: maybe +slog + :: + ++ print-error + |= [=tape error=(unit tang)] + ^+ same + ?~ error same + %- (slog leaf+tape u.error) same + -- +:: +|_ [=bowl:gall state=app-state] +:: ++| %entry-points +:: +:: +prep: (re)load, initializing on startup +:: +++ prep + |= old=(unit app-state) + ^- [(list move) _app-core] + :: reload; no-op + :: + ?^ old + [~ app-core(state u.old)] + :: first load; galaxies no-op; everyone else pings sponsor + :: + ?: =(%czar (clan:title our.bowl)) + [~ app-core] + send-ping +:: +coup-ping-send: handle ames ack +:: +++ coup-ping-send + |= error=(unit tang) + ^- [(list move) _app-core] + :: + %- (print-error "ping: coup" error) + set-timer +:: +wake: handle timer firing +:: +++ wake + |= [=wire error=(unit tang)] + ^- [(list move) _app-core] + :: + ?> =(/ping-wait wire) + %- (print-error "ping: wake" error) + send-ping +:: +poke-noun: handle request; no-op to ack, crash to nack +:: +++ poke-noun + |= input=* + ^- [(list move) _app-core] + :: + ?> ?=([%ping ~] input) + [~ app-core] +:: ++| %helpers +:: +++ app-core . +:: +set-timer: send a move to behn to set a timer +:: +++ set-timer + ^- [(list move) _app-core] + :: + :_ app-core + [ost.bowl %wait /ping-wait `@da`(add ~s30 now.bowl)]~ +:: +send-ping: scry our sponsor from jael and poke their %ping app +:: +++ send-ping + ^- [(list move) _app-core] + :: + =/ our=@ta (scot %p our.bowl) + =/ now=@ta (scot %da now.bowl) + =/ =life .^(life %k /[our]/life/[now]/[our]) + =/ =point .^(point %k /[our]/deed/[now]/[our]/(scot %ud life)) + :: TODO: handle missing sponsor case + :: + =/ sponsor=ship (need sponsor.point) + :: + :_ app-core + [ost.bowl %poke /ping-send [sponsor %ping] %ping ~]~ +-- From 87fc52fd459176542eaf6464670ee4233536ae2e Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 9 Aug 2019 18:55:04 -0700 Subject: [PATCH 075/451] use +sein:title in ping app --- bin/solid.pill | 4 ++-- pkg/arvo/app/ping.hoon | 8 +------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index bc3646bdb..33188617c 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ebc712b448f1f1029a89c30db70c90d40238e33e693a3293c54df8d7151024b1 -size 10365770 +oid sha256:863aa8546990db6d31091bb414913b63dff3a959d561828b0739c3008862a4a4 +size 10367556 diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index ed8907daf..d66d3bfcd 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -81,13 +81,7 @@ ++ send-ping ^- [(list move) _app-core] :: - =/ our=@ta (scot %p our.bowl) - =/ now=@ta (scot %da now.bowl) - =/ =life .^(life %k /[our]/life/[now]/[our]) - =/ =point .^(point %k /[our]/deed/[now]/[our]/(scot %ud life)) - :: TODO: handle missing sponsor case - :: - =/ sponsor=ship (need sponsor.point) + =/ sponsor=ship (sein:title [our now our]:bowl) :: :_ app-core [ost.bowl %poke /ping-send [sponsor %ping] %ping ~]~ From 08961feb7fb834d5088b3b05be36c53e93335d35 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 9 Aug 2019 19:08:31 -0700 Subject: [PATCH 076/451] add wire to +coup-ping-send sample --- pkg/arvo/app/ping.hoon | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index d66d3bfcd..b9d206d87 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -43,9 +43,10 @@ :: +coup-ping-send: handle ames ack :: ++ coup-ping-send - |= error=(unit tang) + |= [=wire error=(unit tang)] ^- [(list move) _app-core] :: + ?> =(/send-ping wire) %- (print-error "ping: coup" error) set-timer :: +wake: handle timer firing From f88221d65bff0133e333090c3d9ca1d69fa2e5e0 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 9 Aug 2019 19:14:20 -0700 Subject: [PATCH 077/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 33188617c..ce6a6a721 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:863aa8546990db6d31091bb414913b63dff3a959d561828b0739c3008862a4a4 -size 10367556 +oid sha256:ed3663db57d2ea737af797c38ea64654550fdd27fe24a03121abada5f2414cc7 +size 10365547 From ea718bcc87acd27242b4eca054e54388ba0414da Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 9 Aug 2019 19:26:39 -0700 Subject: [PATCH 078/451] make the wires match --- bin/solid.pill | 2 +- pkg/arvo/app/ping.hoon | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index ce6a6a721..33ffe954e 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ed3663db57d2ea737af797c38ea64654550fdd27fe24a03121abada5f2414cc7 +oid sha256:d210b3672e4d1fe4422839876e110b90e21e0fcca407a22ff589ce0bad3b3d1a size 10365547 diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index b9d206d87..67028934e 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -46,7 +46,7 @@ |= [=wire error=(unit tang)] ^- [(list move) _app-core] :: - ?> =(/send-ping wire) + ?> =(/ping-send wire) %- (print-error "ping: coup" error) set-timer :: +wake: handle timer firing From 23e2cc7f3c58a4ca7c27e416859e539f38e43367 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 9 Aug 2019 19:40:45 -0700 Subject: [PATCH 079/451] try harder to make wires match --- bin/solid.pill | 4 ++-- pkg/arvo/app/ping.hoon | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 33ffe954e..d81a2e6fb 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d210b3672e4d1fe4422839876e110b90e21e0fcca407a22ff589ce0bad3b3d1a -size 10365547 +oid sha256:93e213c1f3e4773a88172948c985f5c0b57c83bc7bdfd1d78c0e852f56f11258 +size 10365516 diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index 67028934e..581e6ae2a 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -46,16 +46,14 @@ |= [=wire error=(unit tang)] ^- [(list move) _app-core] :: - ?> =(/ping-send wire) %- (print-error "ping: coup" error) set-timer :: +wake: handle timer firing :: -++ wake +++ wake-ping-wait |= [=wire error=(unit tang)] ^- [(list move) _app-core] :: - ?> =(/ping-wait wire) %- (print-error "ping: wake" error) send-ping :: +poke-noun: handle request; no-op to ack, crash to nack From 096942a25e3fe9164f3ec479951ed72068997a1f Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 9 Aug 2019 19:57:58 -0700 Subject: [PATCH 080/451] try again --- bin/solid.pill | 4 ++-- pkg/arvo/app/ping.hoon | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index d81a2e6fb..744ccc03b 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:93e213c1f3e4773a88172948c985f5c0b57c83bc7bdfd1d78c0e852f56f11258 -size 10365516 +oid sha256:bfc81c03d15c990cde6e0d5798fbcd9a39fa2eb0318d952cd31a0b032c81310e +size 10365474 diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index 581e6ae2a..ad097b798 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -8,7 +8,7 @@ [%wait =wire date=@da] == +$ action - $% [%ping ~] + $% [%noun ~] == -- :: @@ -59,10 +59,7 @@ :: +poke-noun: handle request; no-op to ack, crash to nack :: ++ poke-noun - |= input=* - ^- [(list move) _app-core] - :: - ?> ?=([%ping ~] input) + |= * [~ app-core] :: +| %helpers @@ -83,5 +80,5 @@ =/ sponsor=ship (sein:title [our now our]:bowl) :: :_ app-core - [ost.bowl %poke /ping-send [sponsor %ping] %ping ~]~ + [ost.bowl %poke /ping-send [sponsor %ping] %noun ~]~ -- From 3f5a96485b6e339c4a6bb22d4561d91759267761 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sat, 10 Aug 2019 11:48:40 -0700 Subject: [PATCH 081/451] printing cleanup --- bin/solid.pill | 4 +-- pkg/arvo/sys/vane/alef.hoon | 62 ++++++++++++++++--------------------- pkg/arvo/sys/vane/clay.hoon | 16 ---------- pkg/arvo/sys/vane/gall.hoon | 3 -- 4 files changed, 28 insertions(+), 57 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 744ccc03b..d73b977f9 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bfc81c03d15c990cde6e0d5798fbcd9a39fa2eb0318d952cd31a0b032c81310e -size 10365474 +oid sha256:cf66821fdfe8dde68c995ef3bfcd51853e7a26571b1b1f6489cc4cbe70eb6143 +size 10137135 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index b663e6716..45c1b0856 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -755,7 +755,6 @@ ?. ?=(%soft -.wrapped-task) wrapped-task ;;(task p.wrapped-task) - ~& %ames-call^our^-.task :: %born: set .unix-duct and start draining .queued-events :: ?: ?=(%born -.task) @@ -765,14 +764,12 @@ :: if no events were queued up, metamorphose :: ?~ queued-events - ~& %alef-larva-metamorphose + ~> %slog.0^leaf/"ames: metamorphosis" [moves adult-gate] - ~& %alef-larva-kick :: kick off a timer to process the first of .queued-events :: =. moves :_(moves [duct %pass /larva %b %wait now]) [moves larval-gate] - ~& %alef-larva-call :: any other event: enqueue it until we have a .unix-duct :: =. queued-events (~(put to queued-events) %call duct type task) @@ -781,19 +778,16 @@ :: ++ take |= [=wire =duct type=* =sign] - ~& %ames-take^our^-.sign :: enqueue event if not a larval drainage timer :: ?. =(/larva wire) - ~& %alef-larva-take =. queued-events (~(put to queued-events) %take wire duct type sign) [~ larval-gate] :: larval event drainage timer; pop and process a queued event :: ?. ?=([%b %wake *] sign) - ~& %alef-larva-wtf + ~> %slog.0^leaf/"ames: larva: strange sign" [~ larval-gate] - ~& %alef-larva-wake =^ first-event queued-events ~(get to queued-events) =^ moves adult-gate ?- -.first-event @@ -803,9 +797,9 @@ :: .queued-events has been cleared; metamorphose :: ?~ queued-events - ~& %alef-metamorphosis + ~> %slog.0^leaf/"ames: metamorphosis" [moves adult-gate] - ~& %alef-larva-drain + ~> %slog.0^leaf/"ames: larva: drain" :: set timer to drain next event :: =. moves :_(moves [duct %pass /larva %b %wait now]) @@ -815,7 +809,7 @@ :: TODO: don't coerce the old state :: ++ scry scry:adult-core - ++ stay ~& %alef-larva-stay [%larva queued-events ames-state.adult-gate] + ++ stay [%larva queued-events ames-state.adult-gate] ++ load |= $= old $% [%larva events=_queued-events state=_ames-state.adult-gate] @@ -824,11 +818,10 @@ :: ?- -.old %adult - ~& %alef-load (load:adult-core state.old) :: %larva - ~& %alef-load-larva + ~> %slog.0^leaf/"ames: larva: load" =. queued-events events.old =. adult-gate (load:adult-core state.old) larval-gate @@ -967,7 +960,7 @@ |= [=lane =blob] ^+ event-core :: - ~& %ames-hole + ~> %slog.0^leaf/"ames: %hole" (on-hear-packet lane (decode-packet blob) ok=%.n) :: +on-hear-packet: handle mildly processed packet receipt :: @@ -976,7 +969,6 @@ ^+ event-core :: ?: =(our sndr.packet) - ::~& %alef-self event-core :: %. +< @@ -1113,7 +1105,6 @@ :: =/ =peer-state (got-peer-state her) =/ =channel [[our her] now |2.ames-state -.peer-state] - ~& %ames-take-boon^our^her^bone=bone :: abet:(on-memo:(make-peer-core peer-state channel) bone payload) :: +on-plea: handle request to send message @@ -1134,7 +1125,7 @@ =/ =channel [[our ship] now |2.ames-state -.peer-state] :: =^ =bone ossuary.peer-state (bind-duct ossuary.peer-state duct) - ~& %ames-plea^our^ship^[bone=bone]^vane.plea^path.plea + ~> %slog.0^leaf/"ames: plea {}" :: abet:(on-memo:(make-peer-core peer-state channel) bone plea) :: +on-take-wake: receive wakeup or error notification from behn @@ -1221,7 +1212,7 @@ |= [=ship =rift] ^+ event-core :: - ~& %alef-breach^our^ship^rift + ~> %slog.0^leaf/"ames: breach {}" =. peers.ames-state (~(del by peers.ames-state) ship) event-core :: +on-publ-rekey: handle new key for peer @@ -1236,7 +1227,7 @@ == ^+ event-core :: - ~& %alef-rekey^our^ship^life^public-key + ~> %slog.0^leaf/"ames: rekey {}" (insert-peer-state ship (got-peer-state ship) life public-key) :: +on-publ-sponsor: handle new or lost sponsor for peer :: @@ -1247,7 +1238,7 @@ ^+ event-core :: ?~ sponsor - ~| %lost-sponsor^our^ship !! + ~| %ames-lost-sponsor^our^ship !! :: =/ =peer-state (got-peer-state ship) =. sponsor.peer-state u.sponsor @@ -1259,7 +1250,6 @@ ++ on-publ-full |= points=(map ship point) ^+ event-core - ~& %alef-on-publ-full^our :: => .(points ~(tap by points)) |^ ^+ event-core @@ -1269,14 +1259,14 @@ :: =. event-core ?~ ship-state=(~(get by peers.ames-state) ship) - ~& %alef-fresh-peer^ship^point + ~> %slog.0^leaf/"ames: new peer {}" (fresh-peer ship point) :: ?: ?=([~ %alien *] ship-state) - ~& %alef-meet-alien^ship^point + ~> %slog.0^leaf/"ames: met alien {}" (meet-alien ship point +.u.ship-state) :: - ~& %alef-update-known^ship^point + ~> %slog.0^leaf/"ames: update peer {}" (update-known ship point +.u.ship-state) :: $(points t.points) @@ -1757,7 +1747,7 @@ ++ on-still-boon |= [=message-num message=*] ^+ peer-core - ~& %ames-still-boon^our^bone=bone + ~> %slog.0^leaf/"ames: %boon {}" :: send ack unconditionally :: =. peer-core (run-message-still bone %done ok=%.y) @@ -1769,7 +1759,7 @@ ++ on-still-nack-trace |= [=message-num message=*] ^+ peer-core - ~& %ames-still-nack-trace^our^bone=bone + ~> %slog.0^leaf/"ames: nack trace {}" :: =+ ;; [=failed=^message-num =error] message :: ack nack-trace message (only applied if we don't later crash) @@ -1802,7 +1792,7 @@ ++ on-still-plea |= [=message-num message=*] ^+ peer-core - ~& %ames-still-plea^our^bone=bone + ~> %slog.0^leaf/"ames: rcvd %plea {}" :: is this the first time we're trying to process this message? :: ?. ?=([%hear * * ok=%.n] task) @@ -1919,7 +1909,7 @@ =? unsent-fragments.state &(=(current next) ?=(^ unsent-fragments)):state :: - ~& %early-message-ack^ok^her.channel + ~> %slog.0^leaf/"ames: early message ack {}" ~ :: clear all packets from this message from the packet pump :: @@ -2162,7 +2152,7 @@ =- :: if no sent packet matches the ack, don't apply mutations or effects :: ?. found.- - ~& %alef-hear-noop + ~> %slog.0^leaf/"ames: hear: no-op" packet-pump ::~& %alef-hear-ack^message-num^fragment-num :: @@ -2362,7 +2352,7 @@ :: ignore messages from far future; limit to 10 in progress :: ?: (gte seq (add 10 last-acked.state)) - ~& %ignoring-packet-from-future^seq^last-acked.state + ~> %slog.0^leaf/"ames: future %hear {}" message-still :: =/ is-last-fragment=? =(+(fragment-num) num-fragments) @@ -2372,12 +2362,12 @@ ?. is-last-fragment :: single packet ack :: - ~& %send-dupe-ack^our.channel^seq^fragment-num + ~> %slog.0^leaf/"ames: send dupe ack {}" (give %send seq %& fragment-num) :: whole message (n)ack :: =/ ok=? (~(has in nax.state) seq) - ~& %send-dupe-ack-whole-message^our.channel^seq + ~> %slog.0^leaf/"ames: send dupe message ack { %slog.0^leaf/"ames: %hear last {}" message-still :: ack all other packets :: @@ -2411,9 +2401,9 @@ :: ?: already-heard-fragment ?: is-last-fragment - ~& %already-heard-last-fragment^our.channel^seq^fragment-num + ~> %slog.0^leaf/"ames: %hear last dupe {}" message-still - ~& %send-dupe-ack-fragment^our.channel^seq^fragment-num + ~> %slog.0^leaf/"ames: dupe {}" (give %send seq %& fragment-num) :: new fragment; store in state and check if message is done :: @@ -2450,7 +2440,7 @@ =. last-heard.state +(last-heard.state) =. live-messages.state (~(del by live-messages.state) seq) :: - ~& %ames-still-rcv-kb-on^our.channel^%from^her.channel^seq^num-fragments.u.live + ~> %slog.0^leaf/"ames: rcv {}kb from {}" =/ message=* (assemble-fragments [num-fragments fragments]:u.live) =. message-still (enqueue-to-vane seq message) :: diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 9fde740e7..6661a577f 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2811,14 +2811,6 @@ =/ =desk p.riff =/ =wire /warp-index/(scot %p ship)/(scot %tas desk)/(scot %ud index) =/ =path [%question desk (scot %ud index) ~] - ~& :* %clay-send-plea - our=our - ship=ship - wire=wire - duct=duct - path=path - riff=-.riff - == (emit duct %pass wire %a %plea ship %c path riff) :: :: Create a request that cannot be filled immediately. @@ -2834,7 +2826,6 @@ =. wov (dedupe wov) =. qyx (~(put ju qyx) wov hen) ?~ ref - ~& %clay-duce-future (run-if-future rove.wov |=(@da (bait hen +<))) |- ^+ +>+.$ =/ =rave (rove-to-rave rove.wov) @@ -2844,7 +2835,6 @@ =+ inx=nix.u.ref =. +>+.$ =< ?>(?=(^ ref) .) - ~& %clay-duce-plea (send-over-ames hen her inx syd `rave) %= +>+.$ nix.u.ref +(nix.u.ref) @@ -2997,7 +2987,6 @@ |= {{a/wove b/(set duct)} c/(list wove)} ?.((~(has in b) hen) c [a c]) ?~ ref - ~& %clay-cancel-future => .(ref `(unit rind)`ref) :: XX TMI ?: =(~ wos) + :: XX handle? |- ^+ +> @@ -3009,7 +2998,6 @@ =: fod.u.ref (~(del by fod.u.ref) hen) bom.u.ref (~(del by bom.u.ref) u.nux) == - ~& %clay-cancel-plea (send-over-ames hen her u.nux syd ~) :: :: Handles a request. @@ -4454,7 +4442,6 @@ [mos ..^$] :: ?: ?=([%foreign-warp *] tea) - ~& %clay-take-foreign-warp^our^tea ?> ?=(%writ +<.q.hin) :_ ..^$ [hen %give %boon `(unit rand)`(bind `riot`p.q.hin rant-to-rand)]~ @@ -4469,7 +4456,6 @@ [mos ..^$] :: ?: ?=([%foreign-update @ @ *] tea) - ~& %clay-take-foreign-update^tea =/ her (slav %p i.t.tea) =/ syd (slav %tas i.t.t.tea) =^ mos ruf @@ -4496,7 +4482,6 @@ ?: ?=([%warp-index @ @ @ ~] tea) ?: ?=(%done +<.q.hin) ?~ error.q.hin - ~& %clay-take-warp-index-ok^our^tea [~ ..^$] :: TODO better error handling :: @@ -4508,7 +4493,6 @@ :: =/ res=(unit rand) ?^ v=((soft ,(unit rand)) payload.q.hin) - ~& %clay-take-boon^our^tea u.v ~| %clay-take-boon-fail^our^payload.q.hin !! diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index f3e11786d..2e20c9087 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -486,7 +486,6 @@ |= {him/@p dap/dude num/@ud rok/rook} =? +> ?=(%u -.rok) (mo-give %done ~) %+ mo-pass - =- ~& %gall-pass^- - [%sys %req (scot %p him) dap (scot %ud num) ~] ^- note-arvo ?- -.rok @@ -1292,13 +1291,11 @@ [~ ..^$(sys.mast.all hen)] :: %plea - ~& %gall-plea-path^path.plea.q.hic ?> ?=([%ge @ ~] path.plea.q.hic) =/ him=ship ship.q.hic =* dap i.t.path.plea.q.hic :: =+ mes=;;([@ud rook] payload.plea.q.hic) - ~& %gall-plea-coerced =< mo-abet (mo-gawk:(mo-abed:mo hen) him dap mes) :: From 65bea91f9d95d53ca41b5fd7d16b514bdcd07332 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sat, 10 Aug 2019 11:58:08 -0700 Subject: [PATCH 082/451] start %ping on startup; fix printing bugs --- bin/solid.pill | 4 ++-- pkg/arvo/lib/hood/drum.hoon | 14 ++++++++------ pkg/arvo/sys/vane/alef.hoon | 4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index d73b977f9..ccac15bbe 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cf66821fdfe8dde68c995ef3bfcd51853e7a26571b1b1f6489cc4cbe70eb6143 -size 10137135 +oid sha256:459bdb70844deebd48f5eb2317babf5cc62678db691d3eb028fa942c929dbd80 +size 10362724 diff --git a/pkg/arvo/lib/hood/drum.hoon b/pkg/arvo/lib/hood/drum.hoon index ed61c9e99..4a84b63dc 100644 --- a/pkg/arvo/lib/hood/drum.hoon +++ b/pkg/arvo/lib/hood/drum.hoon @@ -79,16 +79,18 @@ =+ myr=(clan:title our) :: ?: ?=($pawn myr) - :~ [%home %lens] - [%base %hall] - [%base %talk] - [%base %dojo] - [%base %modulo] - == + :~ [%home %lens] + [%base %hall] + [%base %talk] + [%base %dojo] + [%base %ping] + [%base %modulo] + == :~ [%home %lens] [%home %acme] [%home %dns] [%home %dojo] + [%home %ping] [%home %hall] [%home %talk] [%home %modulo] diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 45c1b0856..16f4d72b9 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2367,7 +2367,7 @@ :: whole message (n)ack :: =/ ok=? (~(has in nax.state) seq) - ~> %slog.0^leaf/"ames: send dupe message ack { %slog.0^leaf/"ames: send dupe message ack {}" (give %send seq %| ok lag=`@dr`0) :: last-acked %slog.0^leaf/"ames: rcv {}kb from {}" + ~> %slog.0^leaf/"ames: rcv {}kb from {}" =/ message=* (assemble-fragments [num-fragments fragments]:u.live) =. message-still (enqueue-to-vane seq message) :: From 173b3f84af5fcfe3753d664add15ed2560419e89 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sat, 10 Aug 2019 13:46:53 -0700 Subject: [PATCH 083/451] more printf cleaning --- pkg/arvo/sys/vane/alef.hoon | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 16f4d72b9..ad655c986 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -845,7 +845,7 @@ =/ =task ?. ?=(%soft -.wrapped-task) wrapped-task - ~| %alef-bad-task^p.wrapped-task + ~| %ames-bad-task^p.wrapped-task ;;(task p.wrapped-task) :: =/ event-core (per-event [our now eny scry-gate] duct ames-state) @@ -1747,7 +1747,7 @@ ++ on-still-boon |= [=message-num message=*] ^+ peer-core - ~> %slog.0^leaf/"ames: %boon {}" + ~> %slog.0^leaf/"ames: boon {}" :: send ack unconditionally :: =. peer-core (run-message-still bone %done ok=%.y) @@ -1759,7 +1759,7 @@ ++ on-still-nack-trace |= [=message-num message=*] ^+ peer-core - ~> %slog.0^leaf/"ames: nack trace {}" + ~> %slog.0^leaf/"ames: nack trace {}" :: =+ ;; [=failed=^message-num =error] message :: ack nack-trace message (only applied if we don't later crash) @@ -1792,7 +1792,7 @@ ++ on-still-plea |= [=message-num message=*] ^+ peer-core - ~> %slog.0^leaf/"ames: rcvd %plea {}" + ~> %slog.0^leaf/"ames: plea {}" :: is this the first time we're trying to process this message? :: ?. ?=([%hear * * ok=%.n] task) @@ -2093,7 +2093,7 @@ ^+ [fragments gifts state] :: return unsent back to caller and reverse effects to finalize :: - =- ::~& %alef-feed^(lent fragments)^%unsent^(lent unsent) + =- ::~& %ames-feed^(lent fragments)^%unsent^(lent unsent) [unsent (flop gifts) state] :: ^+ [unsent=fragments packet-pump] @@ -2154,7 +2154,7 @@ ?. found.- ~> %slog.0^leaf/"ames: hear: no-op" packet-pump - ::~& %alef-hear-ack^message-num^fragment-num + ::~& %ames-hear-ack^message-num^fragment-num :: =. metrics.state metrics.- =. live.state live.- @@ -2362,12 +2362,12 @@ ?. is-last-fragment :: single packet ack :: - ~> %slog.0^leaf/"ames: send dupe ack {}" + ~> %slog.0^leaf/"ames: send dupe ack {}" (give %send seq %& fragment-num) :: whole message (n)ack :: =/ ok=? (~(has in nax.state) seq) - ~> %slog.0^leaf/"ames: send dupe message ack {}" + ~> %slog.0^leaf/"ames: send dupe message ack {}" (give %send seq %| ok lag=`@dr`0) :: last-acked %slog.0^leaf/"ames: %hear last {}" + ~> %slog.0^leaf/"ames: hear last in-progress {}" message-still :: ack all other packets :: @@ -2401,9 +2401,9 @@ :: ?: already-heard-fragment ?: is-last-fragment - ~> %slog.0^leaf/"ames: %hear last dupe {}" + ~> %slog.0^leaf/"ames: hear last dupe {}" message-still - ~> %slog.0^leaf/"ames: dupe {}" + ~> %slog.0^leaf/"ames: send dupe ack {}" (give %send seq %& fragment-num) :: new fragment; store in state and check if message is done :: @@ -2440,7 +2440,7 @@ =. last-heard.state +(last-heard.state) =. live-messages.state (~(del by live-messages.state) seq) :: - ~> %slog.0^leaf/"ames: rcv {}kb from {}" + ~> %slog.0^leaf/"ames: hear {} {}kb" =/ message=* (assemble-fragments [num-fragments fragments]:u.live) =. message-still (enqueue-to-vane seq message) :: From b890831d8235465b2ec6a96e27c61a77dacce2e4 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 13 Aug 2019 14:30:15 -0700 Subject: [PATCH 084/451] fixed alef tests --- pkg/arvo/tests/sys/vane/alef.hoon | 158 +++++++++++++++++------------- 1 file changed, 90 insertions(+), 68 deletions(-) diff --git a/pkg/arvo/tests/sys/vane/alef.hoon b/pkg/arvo/tests/sys/vane/alef.hoon index 42e904f48..97d2f1004 100644 --- a/pkg/arvo/tests/sys/vane/alef.hoon +++ b/pkg/arvo/tests/sys/vane/alef.hoon @@ -5,61 +5,61 @@ :: =/ vane (alef !>(..zuse)) :: -=/ alice vane -=/ bob vane +=/ nec vane +=/ bud vane :: -=. our.alice ~nec -=. now.alice ~1111.1.1 -=. eny.alice 0xdead.beef -=. scry-gate.alice |=(* ``[%noun !>(*(list turf))]) +=. our.nec ~nec +=. now.nec ~1111.1.1 +=. eny.nec 0xdead.beef +=. scry-gate.nec |=(* ``[%noun !>(*(list turf))]) :: -=. our.bob ~doznec-doznec -=. now.bob ~1111.1.1 -=. eny.bob 0xbeef.dead -=. scry-gate.bob |=(* ``[%noun !>(*(list turf))]) +=. our.bud ~bud +=. now.bud ~1111.1.1 +=. eny.bud 0xbeef.dead +=. scry-gate.bud |=(* ``[%noun !>(*(list turf))]) :: -=. crypto-core.ames-state.alice (pit:nu:crub:crypto 512 (shaz 'alice')) -=. crypto-core.ames-state.bob (pit:nu:crub:crypto 512 (shaz 'bob')) +=. crypto-core.ames-state.nec (pit:nu:crub:crypto 512 (shaz 'nec')) +=. crypto-core.ames-state.bud (pit:nu:crub:crypto 512 (shaz 'bud')) :: -=/ alice-pub pub:ex:crypto-core.ames-state.alice -=/ alice-sec sec:ex:crypto-core.ames-state.alice -=/ bob-pub pub:ex:crypto-core.ames-state.bob -=/ bob-sec sec:ex:crypto-core.ames-state.bob +=/ nec-pub pub:ex:crypto-core.ames-state.nec +=/ nec-sec sec:ex:crypto-core.ames-state.nec +=/ bud-pub pub:ex:crypto-core.ames-state.bud +=/ bud-sec sec:ex:crypto-core.ames-state.bud :: -=/ alice-sym (derive-symmetric-key:vane bob-pub alice-sec) -=/ bob-sym (derive-symmetric-key:vane alice-pub bob-sec) +=/ nec-sym (derive-symmetric-key:vane bud-pub nec-sec) +=/ bud-sym (derive-symmetric-key:vane nec-pub bud-sec) :: -?> =(alice-sym bob-sym) +?> =(nec-sym bud-sym) :: -=. life.ames-state.alice 2 -=. peers.ames-state.alice - %+ ~(put by peers.ames-state.alice) ~doznec-doznec +=. life.ames-state.nec 2 +=. peers.ames-state.nec + %+ ~(put by peers.ames-state.nec) ~bud =| =peer-state:alef =. -.peer-state - :* symmetric-key=bob-sym + :* symmetric-key=bud-sym life=3 - public-key=bob-pub - sponsor=~marzod + public-key=bud-pub + sponsor=~nec == =. route.peer-state `[direct=%.y `lane:alef`[%& ~nec]] [%known peer-state] :: -=. life.ames-state.bob 3 -=. peers.ames-state.bob - %+ ~(put by peers.ames-state.bob) ~nec +=. life.ames-state.bud 3 +=. peers.ames-state.bud + %+ ~(put by peers.ames-state.bud) ~nec =| =peer-state:alef =. -.peer-state - :* symmetric-key=alice-sym + :* symmetric-key=nec-sym life=2 - public-key=alice-pub + public-key=nec-pub sponsor=~nec == =. route.peer-state `[direct=%.y `lane:alef`[%| `@`%lane-bar]] [%known peer-state] :: metamorphose :: -=> .(alice +:(call:(alice) ~[//unix] ** %born ~)) -=> .(bob +:(call:(bob) ~[//unix] ** %born ~)) +=> .(nec +:(call:(nec) ~[//unix] ** %born ~)) +=> .(bud +:(call:(bud) ~[//unix] ** %born ~)) :: helper core :: => @@ -85,16 +85,16 @@ (skim moves is-move-send) :: ++ call - |= [vane=_alice =duct =task:alef] - ^- [moves=(list move:alef) _alice] + |= [vane=_nec =duct =task:alef] + ^- [moves=(list move:alef) _nec] :: =/ vane-core (vane(now `@da`(add ~s1 now.vane))) :: (call:vane-core duct ** task) :: ++ take - |= [vane=_alice =wire =duct =sign:alef] - ^- [moves=(list move:alef) _alice] + |= [vane=_nec =wire =duct =sign:alef] + ^- [moves=(list move:alef) _nec] :: =/ vane-core (vane(now `@da`(add ~s1 now.vane))) :: @@ -106,7 +106,7 @@ ++ test-packet-encoding ^- tang :: =/ =packet:alef - :* [sndr=~nec rcvr=~doznec-doznec] + :* [sndr=~nec rcvr=~bud] encrypted=%.n origin=~ content=[12 13] @@ -134,23 +134,23 @@ == :: =/ =packet:alef - :* [sndr=~bus rcvr=~doznec-doznec] + :* [sndr=~bus rcvr=~bud] encrypted=%.y origin=~ - content=(encrypt:vane alice-sym shut-packet) + content=(encrypt:vane nec-sym shut-packet) == :: =/ =blob:alef (encode-packet:vane packet) - =^ moves1 bob (call bob ~[//unix] %hear lane-foo blob) - =^ moves2 bob + =^ moves1 bud (call bud ~[//unix] %hear lane-foo blob) + =^ moves2 bud =/ =point:alef :* rift=1 life=4 - keys=[[life=4 [crypto-suite=1 `@`alice-pub]] ~ ~] + keys=[[life=4 [crypto-suite=1 `@`nec-pub]] ~ ~] sponsor=`~bus == %- take - :^ bob /public-keys ~[//unix] + :^ bud /public-keys ~[//unix] ^- sign:alef [%k %public-keys %full [n=[~bus point] ~ ~]] :: @@ -160,49 +160,71 @@ !> moves1 :: %+ expect-eq - !> [~[//unix] %pass /bone/~bus/1 %g %plea ~bus %g /talk [%first %post]]~ - !> moves2 + !> %- sy + :~ :^ ~[//unix] %pass /bone/~bus/1 + [%g %plea ~bus %g /talk [%first %post]] + :: + :^ ~[//unix] %pass /qos + [%d %flog %text "; ~bus is your neighbor"] + == + !> (sy ,.moves2) == :: ++ test-message-flow ^- tang + :: ~nec -> %plea -> ~bud :: - =^ moves1 alice - (call alice ~[/alice] %plea ~doznec-doznec %g /talk [%get %post]) + =^ moves1 nec (call nec ~[/g/talk] %plea ~bud %g /talk [%get %post]) + =^ moves2 bud (call bud ~[//unix] %hear (snag-packet 0 moves1)) + :: ~bud -> %done -> ~nec :: - =^ moves2 bob (call bob ~[/bob] %hear (snag-packet 0 moves1)) - =^ moves3 bob (take bob /bone/~nec/1 ~[/bob] %g %done ~) - =^ moves4 alice (call alice ~[/alice] %hear (snag-packet 0 moves3)) - =^ moves5 bob - (take bob /bone/~nec/1 ~[/bob] %g %boon [%post 'first1!!']) + =^ moves3 bud (take bud /bone/~nec/1 ~[//unix] %g %done ~) + =^ moves4 nec (call nec ~[//unix] %hear (snag-packet 0 moves3)) + :: ~bud -> %boon -> ~nec :: - =^ moves6 alice (call alice ~[/alice] %hear (snag-packet 0 moves5)) - =^ moves7 bob (call bob ~[/bob] %hear (snag-packet 0 moves6)) + =^ moves5 bud (take bud /bone/~nec/1 ~[//unix] %g %boon [%post 'first1!!']) + =^ moves6 nec (call nec ~[//unix] %hear (snag-packet 0 moves5)) + :: ~nec -> %done -> ~bud (just make sure ~bud doesn't crash on ack) + :: + =^ moves7 bud (call bud ~[//unix] %hear (snag-packet 0 moves6)) :: ;: weld %+ expect-eq - !> :~ :+ ~[/alice] %give [%done error=~] - :+ ~[/alice] %pass - [/pump/~doznec-doznec/0 %b %rest ~1111.1.1..00.00.06] + !> :~ [~[//unix] %pass /qos %d %flog %text "; ~nec is your neighbor"] + [~[//unix] %pass /bone/~nec/1 %g %plea ~nec %g /talk [%get %post]] == - !> moves4 + !> moves2 :: %+ expect-eq - !> [~[/alice] %give %boon [%post 'first1!!']] + !> %- sy + :~ [~[//unix] %pass /qos %d %flog %text "; ~bud is your neighbor"] + [~[//unix] %pass /pump/~bud/0 %b %rest ~1111.1.1..00.00.06] + [~[/g/talk] %give %done error=~] + == + !> (sy ,.moves4) + :: + %+ expect-eq + !> [~[/g/talk] %give %boon [%post 'first1!!']] !> (snag 1 `(list move:alef)`moves6) == :: ++ test-nack ^- tang - =^ moves1 alice - (call alice ~[/alice] %plea ~doznec-doznec %g /talk [%get %post]) + :: ~nec -> %plea -> ~bud :: - =^ moves2 bob (call bob ~[/bob] %hear (snag-packet 0 moves1)) - =/ =error:alef [%flub [%leaf "sinusoidal repleneration"]~] - =^ moves3 bob (take bob /bone/~nec/1 ~[/bob] %g %done `error) - =^ moves4 alice (call alice ~[/alice] %hear (snag-packet 0 moves3)) - =^ moves5 alice (call alice ~[/alice] %hear (snag-packet 1 moves3)) - =^ moves6 bob (call bob ~[/bob] %hear (snag-packet 0 moves5)) + =^ moves1 nec (call nec ~[/g/talk] %plea ~bud %g /talk [%get %post]) + =^ moves2 bud (call bud ~[//unix] %hear (snag-packet 0 moves1)) + :: ~bud -> nack -> ~nec + :: + =/ =error:alef [%flub [%leaf "sinusoidal repleneration"]~] + =^ moves3 bud (take bud /bone/~nec/1 ~[/bud] %g %done `error) + =^ moves4 nec (call nec ~[//unix] %hear (snag-packet 0 moves3)) + :: ~bud -> nack-trace -> ~nec + :: + =^ moves5 nec (call nec ~[//unix] %hear (snag-packet 1 moves3)) + :: ~nec -> ack nack-trace -> ~bud + :: + =^ moves6 bud (call bud ~[//unix] %hear (snag-packet 0 moves5)) :: %+ expect-eq - !> [~[/alice] %give %done `error] + !> [~[/g/talk] %give %done `error] !> (snag 1 `(list move:alef)`moves5) -- From f28c011ed43ecd95982820d95384a6c1abc28a8b Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 13 Aug 2019 17:55:10 -0700 Subject: [PATCH 085/451] TEMP turn off extraneous apps on boot for dev --- pkg/arvo/lib/hood/drum.hoon | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/pkg/arvo/lib/hood/drum.hoon b/pkg/arvo/lib/hood/drum.hoon index 4a84b63dc..fb2b667c1 100644 --- a/pkg/arvo/lib/hood/drum.hoon +++ b/pkg/arvo/lib/hood/drum.hoon @@ -79,26 +79,26 @@ =+ myr=(clan:title our) :: ?: ?=($pawn myr) - :~ [%home %lens] - [%base %hall] - [%base %talk] + :~ ::[%home %lens] + ::[%base %hall] + ::[%base %talk] [%base %dojo] [%base %ping] - [%base %modulo] + ::[%base %modulo] == - :~ [%home %lens] - [%home %acme] - [%home %dns] + :~ ::[%home %lens] + ::[%home %acme] + ::[%home %dns] [%home %dojo] [%home %ping] - [%home %hall] - [%home %talk] - [%home %modulo] - [%home %launch] - [%home %chat] - [%home %publish] - [%home %clock] - [%home %weather] + ::[%home %hall] + ::[%home %talk] + ::[%home %modulo] + ::[%home %launch] + ::[%home %chat] + ::[%home %publish] + ::[%home %clock] + ::[%home %weather] [%home %azimuth-tracker] == :: @@ -106,7 +106,8 @@ |= our/ship %- ~(gas in *(set gill:gall)) ^- (list gill:gall) - [[our %talk] [our %dojo] ~] + ::[[our %talk] [our %dojo] ~] + [[our %dojo] ~] :: ++ make :: initial part |= our/ship From d7199c63e9d17a238865d646a468eaa07b5b98e4 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 13 Aug 2019 17:55:35 -0700 Subject: [PATCH 086/451] TEMP speed up azimuth-tracker timeout --- 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 5fcb450a2..5e5cd849b 100644 --- a/pkg/arvo/app/azimuth-tracker.hoon +++ b/pkg/arvo/app/azimuth-tracker.hoon @@ -299,7 +299,7 @@ =* walk-loop $ ?: (gth number.state number.id.latest-block) ;< now=@da bind:m get-time:stdio - ;< ~ bind:m (wait-effect:stdio (add now ~m5)) + ;< ~ bind:m (wait-effect:stdio (add now ~s5)) (pure:m state) ;< =block bind:m (get-block-by-number url.state number.state) ;< [=new=pending-udiffs new-blocks=(lest ^block)] bind:m From eb654e1a9de84c3fb76469c75bf3471e358ee8b8 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 13 Aug 2019 17:56:08 -0700 Subject: [PATCH 087/451] ph: another planet test --- pkg/arvo/app/ph.hoon | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pkg/arvo/app/ph.hoon b/pkg/arvo/app/ph.hoon index ea85e1af9..fa50c4ae1 100644 --- a/pkg/arvo/app/ph.hoon +++ b/pkg/arvo/app/ph.hoon @@ -144,6 +144,24 @@ ~[~bud ~marbud ~linnup-torsyx] =. eth-node (spawn:eth-node ~marbud) =. eth-node (spawn:eth-node ~linnup-torsyx) + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + ;< ~ bind:m (raw-real-ship:eth-node ~bud) + ~& > 'BUD-DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~marbud) + ~& > 'MARBUD-DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~linnup-torsyx) + ~& > 'LINNUP DONE' + ;< ~ bind:m (send-hi ~linnup-torsyx ~marbud) + ~& > 'HI DONE-------------------------------' + (pure:m ~) + (pure:m ~) + :: + :+ %hi-linnup-az-backward + ~[~bud ~marbud ~linnup-torsyx] + =. eth-node (spawn:eth-node ~marbud) + =. eth-node (spawn:eth-node ~linnup-torsyx) ;< [eth-node=_eth-node ~] bind:m %+ (wrap-philter ,_eth-node ,~) router:eth-node From 3c8a0164cee2630ea97f4195674738938edea4e1 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 13 Aug 2019 17:56:37 -0700 Subject: [PATCH 088/451] %ping: print on ping --- pkg/arvo/app/ping.hoon | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index ad097b798..c59518e08 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -39,6 +39,7 @@ :: ?: =(%czar (clan:title our.bowl)) [~ app-core] + ~> %slog.0^leaf/"ping: prep {}" send-ping :: +coup-ping-send: handle ames ack :: @@ -79,6 +80,7 @@ :: =/ sponsor=ship (sein:title [our now our]:bowl) :: + ~> %slog.0^leaf/"ping: {} -> {}" :_ app-core [ost.bowl %poke /ping-send [sponsor %ping] %noun ~]~ -- From 66e62f1edb53ead11dbde75a1d3a2c44aa7bc046 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 13 Aug 2019 17:56:56 -0700 Subject: [PATCH 089/451] (hopefully) fix alef alien encounter --- pkg/arvo/sys/vane/alef.hoon | 73 +++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index ad655c986..c67b35a16 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1228,7 +1228,27 @@ ^+ event-core :: ~> %slog.0^leaf/"ames: rekey {}" - (insert-peer-state ship (got-peer-state ship) life public-key) + :: + =/ ship-state (~(get by peers.ames-state) ship) + ?. ?=([~ %known *] ship-state) + =| =point + =. life.point life + =. keys.point (my [life crypto-suite public-key]~) + =. sponsor.point `(^sein:title ship) + :: + (on-publ-full (my [ship point]~)) + :: + =/ =peer-state +.u.ship-state + :: + =/ =private-key sec:ex:crypto-core.ames-state + =. symmetric-key.peer-state + (derive-symmetric-key public-key private-key) + :: + =. life.peer-state life + =. public-key.peer-state public-key + :: + =. peers.ames-state (~(put by peers.ames-state) ship %known peer-state) + event-core :: +on-publ-sponsor: handle new or lost sponsor for peer :: :: TODO: handle sponsor loss @@ -1257,34 +1277,18 @@ :: =+ ^- [=ship =point] i.points :: - =. event-core - ?~ ship-state=(~(get by peers.ames-state) ship) - ~> %slog.0^leaf/"ames: new peer {}" - (fresh-peer ship point) - :: - ?: ?=([~ %alien *] ship-state) - ~> %slog.0^leaf/"ames: met alien {}" - (meet-alien ship point +.u.ship-state) - :: - ~> %slog.0^leaf/"ames: update peer {}" - (update-known ship point +.u.ship-state) + =/ old-ship-state (~(get by peers.ames-state) ship) + :: + =. event-core (insert-peer-state ship point) + :: + =? event-core ?=([~ %alien *] old-ship-state) + (meet-alien ship point +.u.old-ship-state) :: $(points t.points) :: - ++ fresh-peer - |= [=ship =point] - ^+ event-core - :: - =/ =public-key pass:(~(got by keys.point) life.point) - (insert-peer-state ship *peer-state life.point public-key) - :: ++ meet-alien |= [=ship =point todos=pending-requests] ^+ event-core - :: - =/ =public-key pass:(~(got by keys.point) life.point) - =. event-core - (insert-peer-state ship *peer-state life.point public-key) :: apply incoming packets :: =. event-core @@ -1321,25 +1325,21 @@ $(blobs t.blobs) :: event-core - :: - ++ update-known - |= [=ship =point =peer-state] - ^+ event-core - :: - =/ =public-key pass:(~(got by keys.point) life.point) - (insert-peer-state ship peer-state life.point public-key) -- :: ++ insert-peer-state - |= [=ship =peer-state =life =public-key] + |= [=ship =point] ^+ event-core :: + =/ =peer-state (gut-peer-state ship) + =/ =public-key pass:(~(got by keys.point) life.point) =/ =private-key sec:ex:crypto-core.ames-state =/ =symmetric-key (derive-symmetric-key public-key private-key) :: - =. life.peer-state life + =. life.peer-state life.point =. public-key.peer-state public-key =. symmetric-key.peer-state symmetric-key + =. sponsor.peer-state (fall sponsor.point (^sein:title ship)) :: automatically set galaxy route, since unix handles lookup :: =? route.peer-state ?=(%czar (clan:title ship)) @@ -1477,6 +1477,15 @@ ~| %freaky-alien^her =- ?>(?=(%known -<) ->) (~(got by peers.ames-state) her) + :: +gut-peer-state: lookup .her state or default + :: + ++ gut-peer-state + |= her=ship + ^- peer-state + =/ ship-state (~(get by peers.ames-state) her) + ?. ?=([~ %known *] ship-state) + *peer-state + +.u.ship-state :: +make-peer-core: create nested |peer-core for per-peer processing :: ++ make-peer-core From 1cde58b960ae9289005d6df8cacd9ff045830c78 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 15 Aug 2019 20:09:48 -0700 Subject: [PATCH 090/451] plug alien queue space leak --- pkg/arvo/sys/vane/alef.hoon | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index c67b35a16..991b90d71 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1068,6 +1068,10 @@ ?. ?=([~ %known *] sndr-state) %+ enqueue-alien-todo sndr.packet |= todos=pending-requests + :: only enqueue one packet from an alien, to plug space leak + :: + ?. =(~ rcv-packets.todos) + todos todos(rcv-packets [[lane packet] rcv-packets.todos]) :: decrypt packet contents using symmetric-key.channel :: From f26b71aa069830a4e9719e6fb685deb968d3ca50 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 15 Aug 2019 21:12:59 -0700 Subject: [PATCH 091/451] ames: only forward downward --- pkg/arvo/sys/vane/alef.hoon | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 991b90d71..5b83bb778 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -754,6 +754,7 @@ =/ =task ?. ?=(%soft -.wrapped-task) wrapped-task + ~| our^%ames-fail-soft ;;(task p.wrapped-task) :: %born: set .unix-duct and start draining .queued-events :: @@ -981,11 +982,28 @@ on-hear-open :: +on-hear-forward: maybe forward a packet to someone else :: - :: TODO: filter for transitive closure of sponsors/sponsees. + :: Only forward downward, to limit DDoS amplification vectors: + :: Galaxies forward to stars and below. + :: Stars forward to planets and below. + :: Planets forward to moons. + :: + :: Also, only stars forward to comets, since only a star can be a + :: comet's sponsor. :: ++ on-hear-forward |= [=lane =packet ok=?] ^+ event-core + :: only forward downward + :: + ?: %+ lte + rank:(encode-ship-metadata sndr.packet) + rank:(encode-ship-metadata our) + :: + event-core + :: only stars forward to comets + :: + ?: &(=(%pawn (clan:title sndr.packet)) !=(%king (clan:title our))) + event-core :: =/ ship-state (~(get by peers.ames-state) rcvr.packet) :: ignore packets to unfamiliar ships From 25e04c208442a069fb90dccd8303eb227476e64e Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 16 Aug 2019 01:37:20 -0700 Subject: [PATCH 092/451] aqua: stop DDoS'ing yourslef --- pkg/arvo/app/aqua-ames.hoon | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/pkg/arvo/app/aqua-ames.hoon b/pkg/arvo/app/aqua-ames.hoon index 6db84b86f..078d1238c 100644 --- a/pkg/arvo/app/aqua-ames.hoon +++ b/pkg/arvo/app/aqua-ames.hoon @@ -61,7 +61,7 @@ =. this ?+ -.q.i.ufs.afs this %restore (handle-restore who.afs) - %send (handle-send i.ufs.afs) + %send (handle-send who.afs i.ufs.afs) == $(ufs.afs t.ufs.afs) :: @@ -71,13 +71,30 @@ [%event who [//newt/0v1n.2m9vh %born ~]]~ :: ++ handle-send - |= [way=wire %send lan=lane:ames pac=@] + |= [sndr=ship way=wire %send lan=lane:ames pac=@] ^+ this - =/ hear [//newt/0v1n.2m9vh %hear lan pac] - =? ships =(~ ships) - .^((list ship) %gx /(scot %p our)/aqua/(scot %da now)/ships/noun) + =/ rcvr=ship (lane-to-ship lan) + =/ hear-lane (ship-to-lane sndr) + ::~> %slog.0^leaf/"aqua: {(scow %p sndr)} -> {(scow %p rcvr)}" %- emit-aqua-events - %+ turn ships - |= who=ship - [%event who hear] + [%event rcvr //newt/0v1n.2m9vh %hear hear-lane pac]~ +:: +lane-to-ship: decode a ship from an aqua lane +:: +++ lane-to-ship + |= =lane:ames + ^- ship + :: + ?- -.lane + %& p.lane + %| `ship``@`p.lane + == +:: +ship-to-lane: encode a lane to look like it came from .ship +:: +:: Never shows up as a galaxy, because Vere wouldn't know that either. +:: +++ ship-to-lane + |= =ship + ^- lane:ames + :: + [%| `address:ames``@`ship] -- From 77987d292d6064100d9d7b63006c3ef57c6e41df Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 16 Aug 2019 02:26:03 -0700 Subject: [PATCH 093/451] ames: redo forwarding logic --- pkg/arvo/sys/vane/alef.hoon | 91 ++++++++++++++----------------------- 1 file changed, 35 insertions(+), 56 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 5b83bb778..6f8715ae4 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -982,43 +982,14 @@ on-hear-open :: +on-hear-forward: maybe forward a packet to someone else :: - :: Only forward downward, to limit DDoS amplification vectors: - :: Galaxies forward to stars and below. - :: Stars forward to planets and below. - :: Planets forward to moons. - :: - :: Also, only stars forward to comets, since only a star can be a - :: comet's sponsor. + :: TODO: DDoS protection, possibly in Vere :: ++ on-hear-forward |= [=lane =packet ok=?] ^+ event-core - :: only forward downward - :: - ?: %+ lte - rank:(encode-ship-metadata sndr.packet) - rank:(encode-ship-metadata our) - :: - event-core - :: only stars forward to comets - :: - ?: &(=(%pawn (clan:title sndr.packet)) !=(%king (clan:title our))) - event-core - :: - =/ ship-state (~(get by peers.ames-state) rcvr.packet) - :: ignore packets to unfamiliar ships - :: - ?. ?=([~ %known *] ship-state) - event-core - :: if we don't have a lane to .rcvr, give up - :: - ?~ rcvr-lane=route.+.u.ship-state - event-core :: set .origin.packet, re-encode, and send :: - =/ =blob (encode-packet packet(origin `lane)) - :: - (emit unix-duct.ames-state %give %send lane.u.rcvr-lane blob) + (send-blob rcvr.packet (encode-packet packet(origin `lane))) :: +on-hear-open: handle receipt of plaintext comet self-attestation :: ++ on-hear-open @@ -1111,7 +1082,7 @@ :: =? route.peer-state !=(%czar (clan:title her.channel)) ?~ origin.packet - `[direct=%.n lane] + `[direct=%.y lane] `[direct=%.n u.origin.packet] :: perform peer-specific handling of packet :: @@ -1436,38 +1407,46 @@ (emit duct %pass /public-keys %k %public-keys [n=ship ~ ~]) :: +send-blob: fire packet at .ship and maybe sponsors :: - :: Send to .ship and sponsors until we find a direct lane. + :: Send to .ship and sponsors until we find a direct lane or + :: encounter .our in the sponsorship chain. + :: :: If we have no PKI data for a recipient, enqueue the packet and :: request the information from Jael if we haven't already. :: ++ send-blob |= [=ship =blob] - ^+ event-core :: - =/ ship-state (~(get by peers.ames-state) ship) + |^ ^+ event-core + :: + =/ ship-state (~(get by peers.ames-state) ship) + :: + ?. ?=([~ %known *] ship-state) + %+ enqueue-alien-todo ship + |= todos=pending-requests + todos(snd-packets (~(put in snd-packets.todos) blob)) + :: + =/ =peer-state +.u.ship-state + :: + ?~ route=route.peer-state + (try-next-sponsor sponsor.peer-state) + :: + =. event-core + (emit unix-duct.ames-state %give %send lane.u.route blob) + :: + ?: direct.u.route + event-core + (try-next-sponsor sponsor.peer-state) :: - ?. ?=([~ %known *] ship-state) - %+ enqueue-alien-todo ship - |= todos=pending-requests - todos(snd-packets (~(put in snd-packets.todos) blob)) - :: - =/ =peer-state +.u.ship-state - =/ =channel [[our ship] now |2.ames-state -.peer-state] - :: - ?~ route=route.peer-state - ?: =(ship her-sponsor.channel) + ++ try-next-sponsor + |= sponsor=^ship + ^+ event-core + :: + ?: =(ship sponsor) event-core - $(ship her-sponsor.channel) - :: - =. event-core - (emit unix-duct.ames-state %give %send lane.u.route blob) - :: - ?: direct.u.route - event-core - :: - ?: =(ship her-sponsor.channel) - event-core - $(ship her-sponsor.channel) + ?: =(our sponsor) + event-core + ^$(ship sponsor) + -- :: +attestation-packet: generate signed self-attestation for .her :: :: Sent by a comet on first contact with a peer. Not acked. From 98c6254d662c417bded33e6ba8611d15337a56da Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 19 Aug 2019 16:40:57 -0700 Subject: [PATCH 094/451] fix jael after merge --- pkg/arvo/sys/vane/jael.hoon | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/pkg/arvo/sys/vane/jael.hoon b/pkg/arvo/sys/vane/jael.hoon index 90a02e481..37335be07 100644 --- a/pkg/arvo/sys/vane/jael.hoon +++ b/pkg/arvo/sys/vane/jael.hoon @@ -61,8 +61,10 @@ +$ message :: message to her jael $% [%nuke whos=(set ship)] :: cancel trackers [%public-keys whos=(set ship)] :: view ethereum events - [%public-keys-result =public-keys-result] :: tmp workaround == :: ++$ message-result + $% [%public-keys-result =public-keys-result] :: public keys boon + == +$ card :: i/o action (wind note gift) :: :: :: @@ -492,14 +494,6 @@ %public-keys =. moz [[hen %give %done ~] moz] $(tac mes) - :: - :: receive keys result - :: [%public-keys-result =public-keys-result] - :: - %public-keys-result - =. moz [[hen %give %done ~] moz] - %- curd =< abet - (public-keys:~(feel su hen our pki etn) public-keys-result.mes) == == :: @@ -513,6 +507,11 @@ %- (slog tang.u.error.hin) ::TODO fail:et +>.$ + :: + [%a %boon *] + =+ ;; [%public-keys-result =public-keys-result] payload.hin + %- curd =< abet + (public-keys:~(feel su hen our pki etn) public-keys-result) :: [%g %onto *] ~& [%jael-onto tea hin] @@ -538,8 +537,6 @@ ?> ?=([@ *] tea) =* app i.tea =/ =peer-sign ;;(peer-sign q.q.p.p.+>.hin) - %. [hen tea app] - =< pump %- curd =< abet (~(new-event su hen our pki etn) peer-sign) == @@ -551,10 +548,6 @@ etn/state-eth-node == +>(pki pki, etn etn, moz (weld (flop moz) ^moz)) - :: :: ++wind:of - ++ pump - |= [hen=duct =wire app=term] - (emit [hen %pass wire %g %deal [our our] app %pump ~]) -- :: :: ++su :::: ## relative^heavy :: subjective engine @@ -632,9 +625,9 @@ [d %give %public-keys public-keys-result] =/ our (slav %p i.t.i.d) =/ who (slav %p i.t.t.i.d) - =/ =message [%public-keys-result public-keys-result] + =/ =message-result [%public-keys-result public-keys-result] %- emit - [d %give %boon message] + [d %give %boon message-result] $(yez t.yez) :: ++ get-source @@ -988,7 +981,7 @@ ?: fak.own.pki.lex =/ cub (pit:nu:crub:crypto 512 u.who) :^ ~ ~ %noun - !> `deed:ames`[1 pub:ex:cub ~] + !> [1 pub:ex:cub ~] :: =/ rac (clan:title u.who) ?: ?=(%pawn rac) From 6b1e7e441d158c895c2a9e8f26e7671627985b26 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 19 Aug 2019 16:41:05 -0700 Subject: [PATCH 095/451] update solid pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index ccac15bbe..9c39eabac 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:459bdb70844deebd48f5eb2317babf5cc62678db691d3eb028fa942c929dbd80 -size 10362724 +oid sha256:958ec9a401990f8ba90233edad19fb3d11c5828153679cda0b5f81a6054704d6 +size 13061779 From 45b22cd0a783e07acb36561fc7b2a33e7adb54fc Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 19 Aug 2019 16:54:30 -0700 Subject: [PATCH 096/451] do not look into the duct --- pkg/arvo/sys/vane/jael.hoon | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/arvo/sys/vane/jael.hoon b/pkg/arvo/sys/vane/jael.hoon index 37335be07..5d353c2d6 100644 --- a/pkg/arvo/sys/vane/jael.hoon +++ b/pkg/arvo/sys/vane/jael.hoon @@ -623,11 +623,8 @@ ?. &(?=([[%a @ @ *] *] d) !=(%pubs i.t.i.d)) %- emit [d %give %public-keys public-keys-result] - =/ our (slav %p i.t.i.d) - =/ who (slav %p i.t.t.i.d) - =/ =message-result [%public-keys-result public-keys-result] %- emit - [d %give %boon message-result] + [d %give %boon %public-keys-result public-keys-result] $(yez t.yez) :: ++ get-source From 137be0ffde0b0bb34751fe5b401df5cbebfeaa3a Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 20 Aug 2019 14:44:44 -0700 Subject: [PATCH 097/451] alef: fix .origin.packet and a printf --- pkg/arvo/app/aqua-ames.hoon | 7 ++++++- pkg/arvo/sys/vane/alef.hoon | 10 ++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pkg/arvo/app/aqua-ames.hoon b/pkg/arvo/app/aqua-ames.hoon index 078d1238c..b8c1306f3 100644 --- a/pkg/arvo/app/aqua-ames.hoon +++ b/pkg/arvo/app/aqua-ames.hoon @@ -75,7 +75,12 @@ ^+ this =/ rcvr=ship (lane-to-ship lan) =/ hear-lane (ship-to-lane sndr) - ::~> %slog.0^leaf/"aqua: {(scow %p sndr)} -> {(scow %p rcvr)}" + => ?. ?| =(rcvr ~linnup-torsyx-linnup-torsyx) + =(sndr ~linnup-torsyx-linnup-torsyx) + == + . + ~> %slog.0^leaf/"aqua: {(scow %p sndr)} -> {(scow %p rcvr)}" + . %- emit-aqua-events [%event rcvr //newt/0v1n.2m9vh %hear hear-lane pac]~ :: +lane-to-ship: decode a ship from an aqua lane diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 9772fe551..cea1bef33 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -987,9 +987,11 @@ ++ on-hear-forward |= [=lane =packet ok=?] ^+ event-core - :: set .origin.packet, re-encode, and send + :: set .origin.packet if it doesn't already have one, re-encode, and send :: - (send-blob rcvr.packet (encode-packet packet(origin `lane))) + =? origin.packet ?=(~ origin.packet) `lane + =/ =blob (encode-packet packet) + (send-blob rcvr.packet blob) :: +on-hear-open: handle receipt of plaintext comet self-attestation :: ++ on-hear-open @@ -2376,8 +2378,8 @@ (give %send seq %& fragment-num) :: whole message (n)ack :: - =/ ok=? (~(has in nax.state) seq) - ~> %slog.0^leaf/"ames: send dupe message ack {}" + =/ ok=? !(~(has in nax.state) seq) + ~> %slog.0^leaf/"ames: send dupe message ack {} ok={}" (give %send seq %| ok lag=`@dr`0) :: last-acked Date: Thu, 22 Aug 2019 19:51:51 -0700 Subject: [PATCH 098/451] alef: preserve peer pki data on breach --- pkg/arvo/sys/vane/alef.hoon | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index cea1bef33..bda6abc26 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1203,12 +1203,38 @@ :: TODO: cancel all timers? otherwise we'll get spurious firings :: from behn :: + :: TODO: cancel gall subscriptions on breach + :: ++ on-publ-breach |= [=ship =rift] ^+ event-core :: ~> %slog.0^leaf/"ames: breach {}" - =. peers.ames-state (~(del by peers.ames-state) ship) + =/ ship-state (~(get by peers.ames-state) ship) + :: we shouldn't be hearing about ships we don't care about + :: + ?~ ship-state + ~> %slog.0^leaf/"ames: unknown breach {}" + event-core + :: if an alien breached, this doesn't affect us + :: + ?: ?=([~ %alien *] ship) + event-core + :: a peer breached; drop messaging state + :: + =/ =peer-state +.u.ship-state + =. peers.ames-state + %+ ~(put by peers.ames-state) ship + :: reset all peer state other than pki data + :: + =. +.peer-state +:*^peer-state + :: reinitialize galaxy route if applicable + :: + =? route.peer-state =(%czar (clan:title ship)) + `[direct=%.y lane=[%& ship]] + :: + peer-state + :: event-core :: +on-publ-rekey: handle new key for peer :: From bad425660ce867fe865f763a845c7bb080179af8 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 22 Aug 2019 20:53:45 -0700 Subject: [PATCH 099/451] alef: %breach-hi aqua test passes --- pkg/arvo/sys/vane/alef.hoon | 40 +++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index bda6abc26..169a0b2a8 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1197,7 +1197,7 @@ == :: +on-publ-breach: handle continuity breach of .ship; wipe its state :: - :: Abandon all pretense of continuity and delete all state + :: Abandon all pretense of continuity and delete all messaging state :: associated with .ship, including sent and unsent messages. :: :: TODO: cancel all timers? otherwise we'll get spurious firings @@ -1209,31 +1209,38 @@ |= [=ship =rift] ^+ event-core :: - ~> %slog.0^leaf/"ames: breach {}" =/ ship-state (~(get by peers.ames-state) ship) :: we shouldn't be hearing about ships we don't care about :: ?~ ship-state - ~> %slog.0^leaf/"ames: unknown breach {}" + ~> %slog.0^leaf/"ames: breach unknown {}" event-core :: if an alien breached, this doesn't affect us :: - ?: ?=([~ %alien *] ship) + ?: ?=([~ %alien *] ship-state) + ~> %slog.0^leaf/"ames: breach alien {}" event-core + ~> %slog.0^leaf/"ames: breach peer {}" :: a peer breached; drop messaging state :: =/ =peer-state +.u.ship-state + =/ old-qos=qos qos.peer-state + :: reset all peer state other than pki data + :: + =. +.peer-state +:*^peer-state + :: print change to quality of service, if any + :: + =/ text=(unit tape) (qos-update-text ship old-qos qos.peer-state) + :: + =? event-core ?=(^ text) + (emit duct %pass /qos %d %flog %text u.text) + :: reinitialize galaxy route if applicable + :: + =? route.peer-state =(%czar (clan:title ship)) + `[direct=%.y lane=[%& ship]] + :: =. peers.ames-state - %+ ~(put by peers.ames-state) ship - :: reset all peer state other than pki data - :: - =. +.peer-state +:*^peer-state - :: reinitialize galaxy route if applicable - :: - =? route.peer-state =(%czar (clan:title ship)) - `[direct=%.y lane=[%& ship]] - :: - peer-state + (~(put by peers.ames-state) ship [%known peer-state]) :: event-core :: +on-publ-rekey: handle new key for peer @@ -1577,6 +1584,8 @@ :: update and print connection state :: =. peer-core %- update-qos + ?: ?=(%unborn -.qos.peer-state) + [%dead now] ?. ?& ?=(%live -.qos.peer-state) (gte now (add ~s30 last-contact.qos.peer-state)) == @@ -2525,8 +2534,9 @@ :: ?+ [-.old -.new] ~ [%unborn %live] `"; {(scow %p ship)} is your neighbor" - [%live %dead] `"; {(scow %p ship)} not responding still trying" [%dead %live] `"; {(scow %p ship)} is ok" + [%live %dead] `"; {(scow %p ship)} not responding still trying" + [%unborn %dead] `"; {(scow %p ship)} not responding still trying" [%live %unborn] `"; {(scow %p ship)} is dead" [%dead %unborn] `"; {(scow %p ship)} is dead" == From 507a5f722fb4d727d2e608b4c49c740dd9e424ce Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 22 Aug 2019 22:53:38 -0700 Subject: [PATCH 100/451] alef: stop queueing alien packets; %breach-sudden passes --- pkg/arvo/app/ph.hoon | 6 ++++-- pkg/arvo/sys/vane/alef.hoon | 30 +++++++----------------------- 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/pkg/arvo/app/ph.hoon b/pkg/arvo/app/ph.hoon index fa50c4ae1..d1e0629ec 100644 --- a/pkg/arvo/app/ph.hoon +++ b/pkg/arvo/app/ph.hoon @@ -345,9 +345,11 @@ ;< [eth-node=_eth-node ~] bind:m %+ (wrap-philter ,_eth-node ,~) router:eth-node - ;< ~ bind:m (raw-real-ship:eth-node ~bud) + ;< ~ bind:m (raw-real-ship:eth-node ~bud) ~& > 'BUD RE DONE' - ;< ~ bind:m (just-events (dojo ~bud "|merge %base ~marbud %kids, =gem %this")) + ;< ~ bind:m (send-hi ~bud ~marbud) + ~& > 'BUD HI MARBUD' + ;< ~ bind:m (just-events (dojo ~bud "|merge %base ~marbud %kids, =gem %this")) ~& > 'THIS MERGE STARTED DONE' ;< file=@t bind:m (touch-file ~bud %base) ~& > 'TOUCH-1 DONE' diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 169a0b2a8..1d88687ab 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -408,13 +408,11 @@ == :: $pending-requests: what to do when we learn a peer's life and keys :: -:: rcv-packets: packets we've received from unix :: snd-messages: pleas local vanes have asked us to send :: snd-packets: packets we've tried to send :: +$ pending-requests - $: rcv-packets=(list [=lane =packet]) - snd-messages=(list [=duct =plea]) + $: snd-messages=(list [=duct =plea]) snd-packets=(set =blob) == :: $peer-state: state for a peer with known life and keys @@ -1054,16 +1052,10 @@ ?> ?=(@ content.packet) :: =/ sndr-state (~(get by peers.ames-state) sndr.packet) - :: if we don't know them, enqueue the packet to be handled later + :: if we don't know them, maybe enqueue a jael %public-keys request :: ?. ?=([~ %known *] sndr-state) - %+ enqueue-alien-todo sndr.packet - |= todos=pending-requests - :: only enqueue one packet from an alien, to plug space leak - :: - ?. =(~ rcv-packets.todos) - todos - todos(rcv-packets [[lane packet] rcv-packets.todos]) + (enqueue-alien-todo sndr.packet (bake same pending-requests)) :: decrypt packet contents using symmetric-key.channel :: :: If we know them, we have a $channel with them, which we've @@ -1120,7 +1112,7 @@ =/ =channel [[our ship] now |2.ames-state -.peer-state] :: =^ =bone ossuary.peer-state (bind-duct ossuary.peer-state duct) - ~> %slog.0^leaf/"ames: plea {}" + ~> %slog.0^leaf/"ames: plea {<[our our-life.channel]^[ship her-life.channel]^bone^vane.plea^path.plea>}" :: abet:(on-memo:(make-peer-core peer-state channel) bone plea) :: +on-take-wake: receive wakeup or error notification from behn @@ -1317,17 +1309,7 @@ ++ meet-alien |= [=ship =point todos=pending-requests] ^+ event-core - :: apply incoming packets - :: - =. event-core - |- ^+ event-core - ?~ rcv-packets.todos event-core - :: - =. event-core - (on-hear-packet [lane packet ok=%.y]:i.rcv-packets.todos) - :: - $(rcv-packets.todos t.rcv-packets.todos) - :: we're a comet; send self-attestation packet first + :: if we're a comet, send self-attestation packet first :: =? event-core =(%pawn (clan:title our)) (send-blob ship (attestation-packet ship life.point)) @@ -2132,6 +2114,8 @@ =. sent-date.val now.channel =. retried.val %.y :: + ~& [%ames-resend [our our-life her her-life]:channel key] + :: [`val stop=%.n (dec num-slots.acc) packet-pump] :: +feed: try to send a list of packets, returning unsent and effects :: From a50181b65cd3db99a50a164e5466c985e1521c5e Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 23 Aug 2019 18:19:50 -0700 Subject: [PATCH 101/451] fix old jael subscription bug; aqua %hi-cousin-az passes --- pkg/arvo/app/ph.hoon | 63 +++++++++++++++++++++++++++++++++++++ pkg/arvo/sys/vane/jael.hoon | 8 +++-- 2 files changed, 68 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/app/ph.hoon b/pkg/arvo/app/ph.hoon index d1e0629ec..1d6760490 100644 --- a/pkg/arvo/app/ph.hoon +++ b/pkg/arvo/app/ph.hoon @@ -139,6 +139,60 @@ ~& > 'BUD-DONE' (send-hi ~bud ~marbud) (pure:m ~) + :: + :+ %hi-uncle-az + ~[~bud ~marbud ~dev] + =. eth-node (spawn:eth-node ~marbud) + =. eth-node (spawn:eth-node ~dev) + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + ;< ~ bind:m (raw-real-ship:eth-node ~bud) + ~& > 'BUD-DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~marbud) + ~& > 'MARBUD-DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~dev) + ~& > 'BUD-DONE' + (send-hi ~marbud ~dev) + ~& > 'HI DONE' + (pure:m ~) + :: + :+ %hi-nephew-az + ~[~bud ~marbud ~dev] + =. eth-node (spawn:eth-node ~marbud) + =. eth-node (spawn:eth-node ~dev) + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + ;< ~ bind:m (raw-real-ship:eth-node ~bud) + ~& > 'BUD-DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~marbud) + ~& > 'MARBUD-DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~dev) + ~& > 'BUD-DONE' + (send-hi ~dev ~marbud) + ~& > 'HI DONE' + (pure:m ~) + :: + :+ %hi-cousin-az + ~[~bud ~marbud ~dev ~mardev] + =. eth-node (spawn:eth-node ~marbud) + =. eth-node (spawn:eth-node ~dev) + =. eth-node (spawn:eth-node ~mardev) + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + ;< ~ bind:m (raw-real-ship:eth-node ~bud) + ~& > 'BUD-DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~marbud) + ~& > 'MARBUD-DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~dev) + ~& > 'BUD-DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~mardev) + ~& > 'MARDEV-DONE' + (send-hi ~mardev ~marbud) + ~& > 'HI DONE' + (pure:m ~) :: :+ %hi-linnup-az ~[~bud ~marbud ~linnup-torsyx] @@ -240,18 +294,27 @@ %+ (wrap-philter ,_eth-node ,~) router:eth-node ;< ~ bind:m (raw-real-ship:eth-node ~bud) + ~& > 'BUD DONE' ;< ~ bind:m (raw-real-ship:eth-node ~dev) + ~& > 'DEV DONE' ;< ~ bind:m (raw-real-ship:eth-node ~marbud) + ~& > 'MARBUD DONE' ;< ~ bind:m (raw-real-ship:eth-node ~mardev) + ~& > 'MARDEV DONE' (send-hi ~marbud ~mardev) + ~& > 'HI MARBUD MARDEV' ;< eth-node=_eth-node bind:m (breach-and-hear:eth-node our.hid ~mardev ~marbud) + ~& > 'BREACH MARDEV' ;< [eth-node=_eth-node ~] bind:m %+ (wrap-philter ,_eth-node ,~) router:eth-node ;< ~ bind:m (send-hi-not-responding ~marbud ~mardev) + ~& > 'HI NOT RESPONDING' ;< ~ bind:m (raw-real-ship:eth-node ~mardev) + ~& > 'MARDEV RE DONE' (wait-for-dojo ~marbud "hi ~mardev successful") + ~& > 'DONE' (pure:m ~) :: :+ %breach-sync diff --git a/pkg/arvo/sys/vane/jael.hoon b/pkg/arvo/sys/vane/jael.hoon index fad6b7cfc..52bd0ae4f 100644 --- a/pkg/arvo/sys/vane/jael.hoon +++ b/pkg/arvo/sys/vane/jael.hoon @@ -791,9 +791,11 @@ |- ^+ ..feel ?~ pointl ..feel - %+ public-keys-give - (subscribers-on-ship who.i.pointl) - [%full (my i.pointl ~)] + =. ..feel + %+ public-keys-give + (subscribers-on-ship who.i.pointl) + [%full (my i.pointl ~)] + $(pointl t.pointl) =* who who.public-keys-result =/ a-diff=diff:point diff.public-keys-result =/ maybe-point (~(get by pos.zim) who) From fc9e382cf157c48c5b5b7d29da8d3183828ae3ab Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 13:54:16 -0700 Subject: [PATCH 102/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 9c39eabac..5d1dad8ff 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:958ec9a401990f8ba90233edad19fb3d11c5828153679cda0b5f81a6054704d6 -size 13061779 +oid sha256:d7b16544b9ab01bc185e85831b8054f69af58fbe27daa6d8b68263432c376dc1 +size 13150031 From dff9d6eba34064735985927e63f87233c59cbbd4 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 14:18:46 -0700 Subject: [PATCH 103/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 5d1dad8ff..f357ab8ba 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d7b16544b9ab01bc185e85831b8054f69af58fbe27daa6d8b68263432c376dc1 -size 13150031 +oid sha256:0cc9b2acf33f76f0a41fda2522fc2b90c5f5d00b16230c2d4c4b8fd4dd55a074 +size 13155446 From 4ff5302c3d98b09187c62b65f71b4e50d4ce4f0a Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 15:56:24 -0700 Subject: [PATCH 104/451] update ivory pill --- bin/ivory.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/ivory.pill b/bin/ivory.pill index 3ffbd083f..0df4a6f22 100644 --- a/bin/ivory.pill +++ b/bin/ivory.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:eb747c039645dc647a919a4f26f216b46fcfbb5964f667da329369b5798d3839 -size 5309578 +oid sha256:ca25931cd5e915a250884f0bd54a02b02b59378ba7026e4da0f3008330f186cb +size 5609666 From 7a58bcd50e7ef740b38f13b4ae8778b49ad5728a Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 16:09:56 -0700 Subject: [PATCH 105/451] fix testnet config in zuse --- 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 141f41f05..bec64013a 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -7457,7 +7457,7 @@ :: # constants :: :: contract addresses - ++ contracts mainnet-contracts + ++ contracts ropsten-contracts ++ mainnet-contracts |% :: azimuth: data contract From 33ebf6c1a5178f9fb115aebfa347a092676a794e Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 16:10:07 -0700 Subject: [PATCH 106/451] update pills --- bin/ivory.pill | 2 +- bin/solid.pill | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/ivory.pill b/bin/ivory.pill index 0df4a6f22..3eee6b0e6 100644 --- a/bin/ivory.pill +++ b/bin/ivory.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ca25931cd5e915a250884f0bd54a02b02b59378ba7026e4da0f3008330f186cb +oid sha256:04ed9fd682f427f8bb419e2b75a6fdbdbb62b06d3341589ec7ac9e74ca3050f4 size 5609666 diff --git a/bin/solid.pill b/bin/solid.pill index f357ab8ba..98e4c6401 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0cc9b2acf33f76f0a41fda2522fc2b90c5f5d00b16230c2d4c4b8fd4dd55a074 -size 13155446 +oid sha256:433ae52c22061f5cab5fcf5862702986614b7ff371058afd2853c3368741b5b2 +size 13227933 From ca00d89286381ad731c5f06a48f10135ef680c6f Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 20:12:56 -0700 Subject: [PATCH 107/451] %lost ames gift and stub handlers in vanes --- pkg/arvo/sys/vane/alef.hoon | 15 +++++++++++--- pkg/arvo/sys/vane/clay.hoon | 39 ++++++++++++++++++++----------------- pkg/arvo/sys/vane/gall.hoon | 20 ++++++++++++------- pkg/arvo/sys/vane/jael.hoon | 7 +++++++ pkg/arvo/sys/zuse.hoon | 2 ++ 5 files changed, 55 insertions(+), 28 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 1d88687ab..1811e4d55 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1773,16 +1773,25 @@ :: could change this to a no-op if we had some sort of security :: reporting. :: + :: TODO: This handles a previous crash in the client vane, but not in + :: Ames itself. + :: ++ on-still-boon |= [=message-num message=*] ^+ peer-core - ~> %slog.0^leaf/"ames: boon {}" :: send ack unconditionally :: =. peer-core (run-message-still bone %done ok=%.y) - :: give message to client vane :: - (emit (got-duct bone) %give %boon message) + ?. ?=([%hear * * ok=%.n] task) + :: fresh boon; give message to client vane + :: + ~> %slog.0^leaf/"ames: boon {}" + (emit (got-duct bone) %give %boon message) + :: we previously crashed on this message; notify client vane + :: + ~> %slog.1^leaf/"ames: crashed on boon {}" + (emit (got-duct bone) %give %lost ~) :: +on-still-nack-trace: handle nack-trace received by |message-still :: ++ on-still-nack-trace diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 5c6951db6..fd4f38c70 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -508,8 +508,9 @@ $% [%init-clad ~] :: == == :: $: %a :: by %ames - $> $? %boon :: - %done :: + $> $? %boon :: response + %done :: (n)ack + %lost :: lost boon == :: gift:able:ames :: == :: @@ -4478,7 +4479,8 @@ == == :: ?: ?=([%warp-index @ @ @ ~] tea) - ?: ?=(%done +<.q.hin) + ?+ +<.q.hin ~| %clay-warp-index-strange !! + %done ?~ error.q.hin [~ ..^$] :: TODO better error handling @@ -4487,23 +4489,23 @@ %- (slog tang.u.error.q.hin) [~ ..^$] :: - ?> ?=(%boon +<.q.hin) - :: - =/ res=(unit rand) - ?^ v=((soft ,(unit rand)) payload.q.hin) - u.v - ~| %clay-take-boon-fail^our^payload.q.hin + %lost + ~| %clay-take-lost^our + :: TODO better error handling !! - ::=+ ;; res=(unit rand) payload.q.hin :: - =/ her=ship (slav %p i.t.tea) - =/ =desk (slav %tas i.t.t.tea) - =/ index=@ud (slav %ud i.t.t.t.tea) - :: - =^ mos ruf - =/ den ((de our now ski hen ruf) her desk) - abet:(take-foreign-answer:den index res) - [mos ..^$] + %boon + =+ ;; res=(unit rand) payload.q.hin + :: + =/ her=ship (slav %p i.t.tea) + =/ =desk (slav %tas i.t.t.tea) + =/ index=@ud (slav %ud i.t.t.t.tea) + :: + =^ mos ruf + =/ den ((de our now ski hen ruf) her desk) + abet:(take-foreign-answer:den index res) + [mos ..^$] + == :: ?: ?=([%sinks ~] tea) ?> ?=(%public-keys +<.q.hin) @@ -4603,6 +4605,7 @@ :: handled in the wire dispatcher :: %boon !! + %lost !! %writ !! :: %done diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 6346e81c3..b1ee5e612 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -393,9 +393,12 @@ ?: ?=([%a %done *] sih) (mo-awed him cub error.sih) :: - ?> ?=([%a %boon *] sih) - =+ mes=;;([@ud roon] payload.sih) - (mo-gawd:(mo-abed:mo hen) him dap mes) + ?: ?=([%a %boon *] sih) + =+ mes=;;([@ud roon] payload.sih) + (mo-gawd:(mo-abed:mo hen) him dap %& mes) + :: + ?> ?=([%a %lost *] sih) + (mo-gawd:(mo-abed:mo hen) him dap %| [%leaf "ames: lost boon"]~) == :: ++ mo-cook :: take in /use @@ -497,13 +500,16 @@ == :: ++ mo-gawd :: ames backward - |= {him/@p dap/dude num/@ud ron/roon} - ?- -.ron + |= {him/@p dap/dude ron/(each [num=@ud =roon] tang)} + :: + ?: ?=(%| -.ron) + (mo-give %unto %quit ~) + ?- -.roon.p.ron $x (mo-give %unto %quit ~) $d %+ mo-pass - [%sys %rep (scot %p him) dap (scot %ud num) ~] - [%f %build live=%.n [%vale [p q]:(mo-beak dap) p.ron q.ron]] + [%sys %rep (scot %p him) dap (scot %ud num.p.ron) ~] + [%f %build live=%.n [%vale [p q]:(mo-beak dap) [p q]:roon.p.ron]] == :: ++ ap :: agent engine diff --git a/pkg/arvo/sys/vane/jael.hoon b/pkg/arvo/sys/vane/jael.hoon index 52bd0ae4f..dc2cb50c2 100644 --- a/pkg/arvo/sys/vane/jael.hoon +++ b/pkg/arvo/sys/vane/jael.hoon @@ -94,6 +94,7 @@ $% $: %a $% $>(%boon gift:able:ames) :: message response $>(%done gift:able:ames) :: message (n)ack + $>(%lost gift:able:ames) :: lost boon == == $: %g :: $> $? %onto :: @@ -522,6 +523,12 @@ =+ ;; [%public-keys-result =public-keys-result] payload.hin %- curd =< abet (public-keys:~(feel su hen our pki etn) public-keys-result) + :: + [%a %lost *] + :: TODO: better error handling + :: + ~| %jael-ames-lost + !! :: [%g %onto *] ~& [%jael-onto tea hin] diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index bec64013a..e3080bce0 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -400,6 +400,7 @@ :: :: %boon: response message from remote ship :: %done: notify vane that peer (n)acked our message + :: %lost: notify vane that we crashed on %boon :: %send: packet to unix :: :: %mass: memory usage report @@ -408,6 +409,7 @@ +$ gift $% [%boon payload=*] [%done error=(unit error)] + [%lost ~] [%send =lane =blob] :: [%mass p=mass] From ffdaa1694a4acdbcc8daff82fa73a1b09feb9dae Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 20:53:19 -0700 Subject: [PATCH 108/451] ames: first attempt at congestion control --- pkg/arvo/sys/vane/alef.hoon | 43 ++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 1811e4d55..ffcf197d5 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -547,11 +547,9 @@ :: +$ pump-metrics $: num-live=@ud - num-lost=@ud last-sent-at=@da - last-dead-at=@da - rtt=@dr - max-live=_7 + rtt=_~s1 + max-live=_2 == +$ live-packet-key [=message-num =fragment-num] +$ live-packet-val @@ -2303,14 +2301,13 @@ :: ++ next-expiry ^- @da - :: - (add now ~s5) + (add now (mul 2 rtt)) :: +next-retry-expiry: when should a resent packet time out? :: ++ next-retry-expiry |= sent-packet-state ^- @da - (add now ~s10) + next-expiry :: +has-slot: can we send a packet right now? :: ++ has-slot @@ -2330,33 +2327,49 @@ max-live :: +on-skipped-packet: adjust metrics based on a misordered ack :: - :: TODO: decrease .max-live - :: ++ on-skipped-packet |= sent-packet-state - metrics + ^- pump-metrics + :: + %_ metrics + max-live (max 1 (dec max-live)) + == :: +on-ack: adjust metrics based on a packet getting acknowledged :: - :: TODO: adjust .rtt and .max-live - :: ++ on-ack |= sent-packet-state ^- pump-metrics :: - metrics(num-live (dec num-live)) + %_ metrics + num-live ?:(=(0 num-live) 0 (dec num-live)) + max-live +(max-live) + rtt smooth-rtt + == :: +on-sent: adjust metrics based on sending .num-sent fresh packets :: ++ on-sent |= num-sent=@ud ^- pump-metrics :: - metrics(num-live (add num-sent num-live)) + %_ metrics + last-sent-at now + num-live (add num-sent num-live) + == :: +on-resent: adjust metrics based on retrying an expired packet :: ++ on-resent |= sent-packet-state ^- pump-metrics - metrics + :: + %_ metrics + last-sent-at now + max-live (max 1 (div max-live 2)) + == + :: +smooth-rtt: apply a low-pass-filtered update to .rtt + :: + ++ smooth-rtt + ^+ rtt + (div (add rtt (sub now last-sent-at)) 2) -- :: +make-message-still: construct |message-still message receiver core :: From 64fb29d3eeeff3e4523c07be5002359fd1e5723c Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 20:53:49 -0700 Subject: [PATCH 109/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 98e4c6401..9ebda35c0 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:433ae52c22061f5cab5fcf5862702986614b7ff371058afd2853c3368741b5b2 -size 13227933 +oid sha256:9ec3055a657862467d589a5e7fa59886f9408cc813d4667a86037fe6ba6fb7fb +size 13233650 From 46f0e6c1ae13fb612aa0c2a904e2b63b82935996 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 21:12:12 -0700 Subject: [PATCH 110/451] ames: congestion control backoff --- pkg/arvo/sys/vane/alef.hoon | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index ffcf197d5..3b01fd90d 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2341,9 +2341,9 @@ ^- pump-metrics :: %_ metrics - num-live ?:(=(0 num-live) 0 (dec num-live)) + num-live (dec (max 1 num-live)) max-live +(max-live) - rtt smooth-rtt + rtt (smooth-rtt-since sent-date) == :: +on-sent: adjust metrics based on sending .num-sent fresh packets :: @@ -2364,12 +2364,16 @@ %_ metrics last-sent-at now max-live (max 1 (div max-live 2)) + rtt (smooth-rtt-since sent-date) == - :: +smooth-rtt: apply a low-pass-filtered update to .rtt + :: +smooth-rtt-since: calculate new low-passed roundtrip time :: - ++ smooth-rtt - ^+ rtt - (div (add rtt (sub now last-sent-at)) 2) + ++ smooth-rtt-since + |= start=@da + %+ min ~s30 + =- (div - 2) + %+ add rtt + (sub now start) -- :: +make-message-still: construct |message-still message receiver core :: From badd3eacbaedaeb028f7896812a81f4e9eb9b2ba Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 21:12:17 -0700 Subject: [PATCH 111/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 9ebda35c0..fe0f2eb8a 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9ec3055a657862467d589a5e7fa59886f9408cc813d4667a86037fe6ba6fb7fb -size 13233650 +oid sha256:78731c85a8d67a9fbb2fd0033aa95eb1823165a219f7ebf4c16f03e3d0fa7a2b +size 13234161 From 88cfba3bf1dc85ecdc0492264893a298c2c42a81 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 21:25:35 -0700 Subject: [PATCH 112/451] ames: print and smoother RTT --- pkg/arvo/sys/vane/alef.hoon | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 3b01fd90d..92f3cb0af 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2331,6 +2331,8 @@ |= sent-packet-state ^- pump-metrics :: + ~& %skipped^max-live + :: %_ metrics max-live (max 1 (dec max-live)) == @@ -2339,6 +2341,7 @@ ++ on-ack |= sent-packet-state ^- pump-metrics + =- ~& %ack^rtt^%to^rtt.- - :: %_ metrics num-live (dec (max 1 num-live)) @@ -2360,6 +2363,7 @@ ++ on-resent |= sent-packet-state ^- pump-metrics + =- ~& %resent^rtt^%to^rtt.- - :: %_ metrics last-sent-at now @@ -2371,8 +2375,8 @@ ++ smooth-rtt-since |= start=@da %+ min ~s30 - =- (div - 2) - %+ add rtt + =- (div - 4) + %+ add (mul 3 rtt) (sub now start) -- :: +make-message-still: construct |message-still message receiver core From 1edaf89ae0bad89bc91975483c64b91faa122525 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 21:25:42 -0700 Subject: [PATCH 113/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index fe0f2eb8a..44cbfee50 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:78731c85a8d67a9fbb2fd0033aa95eb1823165a219f7ebf4c16f03e3d0fa7a2b -size 13234161 +oid sha256:39eae010ffe1ff0c3363ee32a2da24fec2db009e9442fcc2e6e2fe5095e206ec +size 13235323 From 84742025e73f80f188fbcbf31db96feb2bbcd0b4 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 21:41:32 -0700 Subject: [PATCH 114/451] ames: slow multiplicatively on skipped packet --- pkg/arvo/sys/vane/alef.hoon | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 92f3cb0af..38e05d7ff 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2331,17 +2331,17 @@ |= sent-packet-state ^- pump-metrics :: - ~& %skipped^max-live + =- ~& %skipped^max-live^%to^max-live.- - :: %_ metrics - max-live (max 1 (dec max-live)) + max-live (max 1 (div max-live 2)) == :: +on-ack: adjust metrics based on a packet getting acknowledged :: ++ on-ack |= sent-packet-state ^- pump-metrics - =- ~& %ack^rtt^%to^rtt.- - + =- ~& %ack^(mul rtt 1.000)^%to^(mul rtt.- 1.000) - :: %_ metrics num-live (dec (max 1 num-live)) @@ -2363,7 +2363,7 @@ ++ on-resent |= sent-packet-state ^- pump-metrics - =- ~& %resent^rtt^%to^rtt.- - + =- ~& %resent^(mul rtt 1.000)^%to^(mul rtt.- 1.000) - :: %_ metrics last-sent-at now From 38c2822bbbe8812a4a64cf4b7d981d4c11b7326a Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 21:41:40 -0700 Subject: [PATCH 115/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 44cbfee50..fa9598c31 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:39eae010ffe1ff0c3363ee32a2da24fec2db009e9442fcc2e6e2fe5095e206ec -size 13235323 +oid sha256:8458aa05a6849e0c6d83d2a472e654aa2b5fa99bd26668c310522801d7720e68 +size 13236148 From 461495658fb51195449702311dbdadd00465383b Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 22:35:01 -0700 Subject: [PATCH 116/451] don't resend as much; print differently --- pkg/arvo/sys/vane/alef.hoon | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 38e05d7ff..6a045cc3c 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -550,6 +550,7 @@ last-sent-at=@da rtt=_~s1 max-live=_2 + skipped=@ud == +$ live-packet-key [=message-num =fragment-num] +$ live-packet-val @@ -2078,6 +2079,7 @@ :: =- =. packet-pump core.- =. live.state live.- + ~? !=(0 num-sent.-) %resent^num-sent.- packet-pump :: acc: state to thread through traversal :: @@ -2085,6 +2087,7 @@ :: =| $= acc $: num-slots=_num-retry-slots:gauge + num-sent=@ud core=_packet-pump == :: @@ -2115,15 +2118,15 @@ :: =. packet-pump (give %send static-fragment) =. metrics.state (on-resent:gauge -.val) + =. num-sent.acc +(num-sent.acc) + =. num-slots.acc (dec num-slots.acc) :: update $sent-packet-state in .val and continue :: =. expiry.val (next-retry-expiry:gauge -.val) =. sent-date.val now.channel =. retried.val %.y :: - ~& [%ames-resend [our our-life her her-life]:channel key] - :: - [`val stop=%.n (dec num-slots.acc) packet-pump] + [`val stop=%.n acc] :: +feed: try to send a list of packets, returning unsent and effects :: ++ feed @@ -2192,7 +2195,7 @@ ?. found.- ~> %slog.0^leaf/"ames: hear: no-op" packet-pump - ::~& %ames-hear-ack^message-num^fragment-num + ~& %ames-hear-ack^message-num^fragment-num :: =. metrics.state metrics.- =. live.state live.- @@ -2235,6 +2238,7 @@ =- =. metrics.state metrics.- =. live.state live.- :: + ~& %done^metrics.state resend-lost :: ^- $: metrics=pump-metrics @@ -2324,24 +2328,22 @@ :: ++ num-retry-slots ^- @ud - max-live + (max 1 (div max-live 10)) :: +on-skipped-packet: adjust metrics based on a misordered ack :: ++ on-skipped-packet |= sent-packet-state ^- pump-metrics :: - =- ~& %skipped^max-live^%to^max-live.- - - :: %_ metrics max-live (max 1 (div max-live 2)) + skipped +(skipped) == :: +on-ack: adjust metrics based on a packet getting acknowledged :: ++ on-ack |= sent-packet-state ^- pump-metrics - =- ~& %ack^(mul rtt 1.000)^%to^(mul rtt.- 1.000) - :: %_ metrics num-live (dec (max 1 num-live)) @@ -2363,7 +2365,6 @@ ++ on-resent |= sent-packet-state ^- pump-metrics - =- ~& %resent^(mul rtt 1.000)^%to^(mul rtt.- 1.000) - :: %_ metrics last-sent-at now From dccdfd7684d54c4cf6836cd2d4eb4083465d5508 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 22:38:12 -0700 Subject: [PATCH 117/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index fa9598c31..62886cab0 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8458aa05a6849e0c6d83d2a472e654aa2b5fa99bd26668c310522801d7720e68 -size 13236148 +oid sha256:fd3cd5653571daf9fc20843daacaae8d8fff6adfe426fa147b4dd2ff4ec53fab +size 13235699 From ee84936add782b5e308e8336da04e3857462bca7 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Wed, 28 Aug 2019 15:39:04 -0700 Subject: [PATCH 118/451] adds type-safety to scry via +nets:wa in the scry-wrappers --- bin/solid.pill | 4 ++-- pkg/arvo/sys/arvo.hoon | 38 ++++++++++++++++++++++++++----------- pkg/arvo/sys/vane/ford.hoon | 4 ++-- 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 2e9f26ff3..2ef86c084 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b95177c581a71c0820323177df52ffe4389a4c77d9d5d08feb44e1fd82a0da23 -size 15286456 +oid sha256:ccadeb320517eb506679198684eae00d0d37d28554de5c29f6de4a02b52b22ae +size 13599425 diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index 6e74ffabe..159a7c781 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -64,7 +64,7 @@ ++ sley $- {* (unit (set monk)) term beam} :: namespace function (unit (unit cage)) :: ++ slyd $- {* (unit (set monk)) term beam} :: super advanced - (unit (unit (cask))) :: + (unit (unit (cask milt))) :: ++ slyt $-({* *} (unit (unit))) :: old namespace +$ vane [=vase =worm] ++ vile :: reflexive constants @@ -112,10 +112,18 @@ ?~ dyc ~ ?. ?=(^ ved) ~ =/ ron=@tas u.hyr - =+ bed=[[u.fal u.dyc (case p.u.ved)] (flop tyl)] - =+ bop=(sod ref ~ ron bed) + =/ bed=beam + [[u.fal u.dyc (case p.u.ved)] (flop tyl)] + =/ bop=(unit (unit (cask milt))) + (sod ref ~ ron bed) ?~ bop ~ ?~ u.bop [~ ~] + :: XX figure out wth to do about hoon-version + :: + ?. ?& ?=([?(%151 %141) *] ref) + -:(~(nets wa *worm) +.ref -.q.u.u.bop) + == + ~>(%slog.[0 leaf+"arvo: scry-lost"] ~) [~ ~ +.q.u.u.bop] :: +sloy-light: minimal parsing version of sloy :: @@ -135,10 +143,18 @@ |= [ref=* ron=@tas fal=@p dyc=@tas ved=case tyl=path] :: we do not flop tyl because tyl wouldn't have been flopped by +en-beam :: - =+ bed=[[fal dyc ved] tyl] - =+ bop=(sod ref ~ ron bed) + =/ bed=beam + [[fal dyc ved] tyl] + =/ bop=(unit (unit (cask milt))) + (sod ref ~ ron bed) ?~ bop ~ ?~ u.bop [~ ~] + :: XX figure out wth to do about hoon-version + :: + ?. ?& ?=([?(%151 %141) *] ref) + -:(~(nets wa *worm) +.ref -.q.u.u.bop) + == + ~>(%slog.[0 leaf+"arvo: scry-dark"] ~) [~ ~ +.q.u.u.bop] :: ++ symp :: symbol or empty @@ -350,7 +366,7 @@ ren/@t bed/beam == - ^- (unit (unit (cask))) + ^- (unit (unit (cask milt))) :: ~& [%arvo-scry ren bed] =/ old=scry-sample :* fur @@ -360,10 +376,10 @@ `coin`[%$ r.bed] (flop s.bed) == - ^- (unit (unit (cask))) + ^- (unit (unit (cask milt))) =+ fun=-:(~(slap wa worm.vane) rig [%limb %scry]) :: - %- (unit (unit (cask))) + %- (unit (unit (cask milt))) (slum q.fun old) :: ++ soar :: scrub vane @@ -441,12 +457,12 @@ |_ now/@da ++ beck ^- slyd - |= {* fur/(unit (set monk)) ron/term bed/beam} - ^- (unit (unit (cask))) + |= {typ/* fur/(unit (set monk)) ron/term bed/beam} + ^- (unit (unit (cask milt))) => .(fur ?^(fur fur `[[%& p.bed] ~ ~])) :: XX heinous =+ lal=(end 3 1 ron) =+ ren=(@t (rsh 3 1 ron)) - |- ^- (unit (unit (cask))) + |- ^- (unit (unit (cask milt))) ?~ vanes ~ ?. =(lal label.i.vanes) $(vanes t.vanes) ~| [%failed-scry ron bed] diff --git a/pkg/arvo/sys/vane/ford.hoon b/pkg/arvo/sys/vane/ford.hoon index 23b81fa15..e425d7cfe 100644 --- a/pkg/arvo/sys/vane/ford.hoon +++ b/pkg/arvo/sys/vane/ford.hoon @@ -5570,7 +5570,7 @@ %- sloy ^- slyd ~/ %intercepted-scry |= [ref=* (unit (set monk)) =term =beam] - ^- (unit (unit (cask))) + ^- (unit (unit (cask milt))) :: if the actual scry produces a value, use that value; otherwise use local :: =/ scry-response (scry +<.$) @@ -5606,7 +5606,7 @@ ?. -:(nets:wa +.ref `type`p.q.local-cage) [~ ~] :: - [~ ~ `(cask)`local-cage] + [~ ~ local-cage] :: +unblock-clients-on-duct: unblock and produce clients blocked on :build :: ++ unblock-clients-on-duct From 97d67e81fb00489d01e9ca7d6a620bd9a6779fba Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Wed, 28 Aug 2019 15:55:13 -0700 Subject: [PATCH 119/451] enables scry in +mule (by way of explicit nock 12 in +mute) --- bin/brass.pill | 4 ++-- bin/ivory.pill | 4 ++-- bin/solid.pill | 4 ++-- pkg/arvo/sys/hoon.hoon | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/brass.pill b/bin/brass.pill index 11899d714..81c48ca4c 100644 --- a/bin/brass.pill +++ b/bin/brass.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6143926c8a07a3d2a38abf2be0d3d1ef46315bf1ae13b5401113082ddbe481ec -size 12650146 +oid sha256:acd24dbae33439a2a2d6ad1658dd6a8a8aebd153ba19358340bd3a68febd3d03 +size 11104450 diff --git a/bin/ivory.pill b/bin/ivory.pill index 8f0211fe0..26ab2500c 100644 --- a/bin/ivory.pill +++ b/bin/ivory.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:42ae74a4f2997ff13ec9c9c19d2019ab44852dc8c69937d70d29607c4cefdf59 -size 5882422 +oid sha256:933d3437fa16c793ebd627d6d9121c47cef7ea28320ea5c4dc2fee5e14c3fd49 +size 6114638 diff --git a/bin/solid.pill b/bin/solid.pill index 2ef86c084..551054d59 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ccadeb320517eb506679198684eae00d0d37d28554de5c29f6de4a02b52b22ae -size 13599425 +oid sha256:a54260504e4f96c64241e5a9d3df496d786b98a883a7d923ba824bfd0fc5f0dc +size 13679971 diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index ffed1c0d0..dc7f82571 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -6470,7 +6470,7 @@ ++ mute :: untyped virtual |= taq/_=>(~ ^?(|.(**))) ^- (each * (list tank)) - =+ ton=(mock [taq %9 2 %0 1] |=({* *} ~)) + =/ ton (mock [taq %9 2 %0 1] |=((pair) ``.*(~ [%12 1+p 1+q]))) ?- -.ton $0 [%& p.ton] $1 [%| (turn p.ton |=(a/* (smyt (path a))))] From e6e919b9bfb865f711b9031883a97594063f7e72 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 28 Aug 2019 17:28:31 -0700 Subject: [PATCH 120/451] moar gauge changes --- pkg/arvo/sys/vane/alef.hoon | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 6a045cc3c..850d05516 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2199,7 +2199,6 @@ :: =. metrics.state metrics.- =. live.state live.- - :: resend-lost :: ^- $: [found=? metrics=pump-metrics] @@ -2328,7 +2327,7 @@ :: ++ num-retry-slots ^- @ud - (max 1 (div max-live 10)) + max-live :: +on-skipped-packet: adjust metrics based on a misordered ack :: ++ on-skipped-packet @@ -2336,8 +2335,7 @@ ^- pump-metrics :: %_ metrics - max-live (max 1 (div max-live 2)) - skipped +(skipped) + skipped +(skipped) == :: +on-ack: adjust metrics based on a packet getting acknowledged :: @@ -2345,8 +2343,15 @@ |= sent-packet-state ^- pump-metrics :: + =? metrics (gth skipped 0) + ~& %skipped^skipped + %_ metrics + skipped 0 + max-live (max 1 (div max-live 2)) + == + :: %_ metrics - num-live (dec (max 1 num-live)) + num-live (dec num-live) max-live +(max-live) rtt (smooth-rtt-since sent-date) == From 5975699c43548cc20f2372f2e553b6a1201e8ef8 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 28 Aug 2019 17:28:36 -0700 Subject: [PATCH 121/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 62886cab0..e10b70088 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fd3cd5653571daf9fc20843daacaae8d8fff6adfe426fa147b4dd2ff4ec53fab -size 13235699 +oid sha256:9ab988d645c38dc4c92088a74ceeeffb0cda22a99f6b6d8daf6c43db04b13e7c +size 13235913 From 0fe443fc7c9c2246a334d46e7421531edc99302d Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 28 Aug 2019 17:44:36 -0700 Subject: [PATCH 122/451] print to figure out why this is broken --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index e10b70088..2356f806f 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9ab988d645c38dc4c92088a74ceeeffb0cda22a99f6b6d8daf6c43db04b13e7c -size 13235913 +oid sha256:1fe1521148d4c43e1b822a02bd41d420945427060cfc86cdcc61604d3a65d849 +size 13236589 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 850d05516..970198a56 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1908,7 +1908,9 @@ :: pass to |packet-pump unless duplicate or future ack :: ?. (is-message-num-in-range message-num) + ~& %hear-pump-out-of-range message-pump + ~& %hear-pump (run-packet-pump %hear message-num fragment-num) :: +on-done: handle message acknowledgment :: @@ -2079,7 +2081,7 @@ :: =- =. packet-pump core.- =. live.state live.- - ~? !=(0 num-sent.-) %resent^num-sent.- + ~? !=(0 num-sent.-) %resent-lost^num-sent.- packet-pump :: acc: state to thread through traversal :: @@ -2409,6 +2411,7 @@ ++ on-hear |= [=lane =shut-packet ok=?] ^+ message-still + ~& %on-hear-message-still^ok=ok :: we know this is a fragment, not an ack; expose into namespace :: ?> ?=(%& -.meat.shut-packet) From 4334b25ac611dccf11ec3dd4b227207aef841804 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 28 Aug 2019 17:58:44 -0700 Subject: [PATCH 123/451] hopefully fix packet sending --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 2356f806f..74644f0a5 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1fe1521148d4c43e1b822a02bd41d420945427060cfc86cdcc61604d3a65d849 -size 13236589 +oid sha256:d3b353adb8d5316b3a8d958ca206e942e0a6a6fc00ed68e2a99ef5fdb264c967 +size 13236307 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 970198a56..ac4dd9ef8 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1908,9 +1908,8 @@ :: pass to |packet-pump unless duplicate or future ack :: ?. (is-message-num-in-range message-num) - ~& %hear-pump-out-of-range + ~> %slog.0^leaf/"ames: hear pump out of range" message-pump - ~& %hear-pump (run-packet-pump %hear message-num fragment-num) :: +on-done: handle message acknowledgment :: @@ -2118,15 +2117,18 @@ => [key val] [message-num num-fragments fragment-num fragment] :: - =. packet-pump (give %send static-fragment) - =. metrics.state (on-resent:gauge -.val) - =. num-sent.acc +(num-sent.acc) - =. num-slots.acc (dec num-slots.acc) + =. packet-pump (give %send static-fragment) + =. metrics.state (on-resent:gauge -.val) :: update $sent-packet-state in .val and continue :: =. expiry.val (next-retry-expiry:gauge -.val) =. sent-date.val now.channel =. retried.val %.y + :: update .acc, writing back .packet-pump + :: + =. num-sent.acc +(num-sent.acc) + =. num-slots.acc (dec num-slots.acc) + =. core.acc packet-pump :: [`val stop=%.n acc] :: +feed: try to send a list of packets, returning unsent and effects @@ -2411,7 +2413,6 @@ ++ on-hear |= [=lane =shut-packet ok=?] ^+ message-still - ~& %on-hear-message-still^ok=ok :: we know this is a fragment, not an ack; expose into namespace :: ?> ?=(%& -.meat.shut-packet) From 99b98ca744fbb6be4a3063578717d7772b3c22f4 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 28 Aug 2019 18:09:05 -0700 Subject: [PATCH 124/451] ames: print duplicate acks --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 74644f0a5..60be01789 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d3b353adb8d5316b3a8d958ca206e942e0a6a6fc00ed68e2a99ef5fdb264c967 -size 13236307 +oid sha256:2e36bab49d8c7829d373037bba00dc67785024d45cfc73bec70104917ec9fa40 +size 13236816 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index ac4dd9ef8..1f30c90aa 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2197,7 +2197,7 @@ =- :: if no sent packet matches the ack, don't apply mutations or effects :: ?. found.- - ~> %slog.0^leaf/"ames: hear: no-op" + ~> %slog.0^leaf/"ames: hear: no-op {(scow %ud message-num)} {(scow %ud fragment-num)}" packet-pump ~& %ames-hear-ack^message-num^fragment-num :: From 72b2dbe19e5eaf678e37391b2e5bdbf51075b51f Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 28 Aug 2019 18:30:31 -0700 Subject: [PATCH 125/451] don't back off on skipped packet --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 60be01789..e287c162b 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2e36bab49d8c7829d373037bba00dc67785024d45cfc73bec70104917ec9fa40 -size 13236816 +oid sha256:81cbdadd4bca830243762c097a7c85c24b8b7dc2b5b02e38448f2aafac925cbf +size 13237282 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 1f30c90aa..04151fa9f 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2179,6 +2179,7 @@ :: |- ^+ packet-pump ?~ sent packet-pump + ~& %sent^[message-num fragment-num]:i.sent =. packet-pump (give %send i.sent) $(sent t.sent) :: +on-hear: handle ack on a live packet @@ -2351,7 +2352,6 @@ ~& %skipped^skipped %_ metrics skipped 0 - max-live (max 1 (div max-live 2)) == :: %_ metrics @@ -2450,7 +2450,7 @@ message-still :: ack all other packets :: - ::~& %send-ack^seq^fragment-num + ~& %send-ack^seq^fragment-num (give %send seq %& fragment-num) :: last-heard Date: Thu, 29 Aug 2019 11:44:37 -0700 Subject: [PATCH 126/451] mall: rewrite gall with static +agent --- pkg/arvo/sys/vane/mall.hoon | 1710 +++++++++++++++++++++++++++++++++++ 1 file changed, 1710 insertions(+) create mode 100644 pkg/arvo/sys/vane/mall.hoon diff --git a/pkg/arvo/sys/vane/mall.hoon b/pkg/arvo/sys/vane/mall.hoon new file mode 100644 index 000000000..9a179cfbd --- /dev/null +++ b/pkg/arvo/sys/vane/mall.hoon @@ -0,0 +1,1710 @@ +!: :: %gall, agent execution +!? 163 +!: +:::: +|= pit=vase +=, gall +=> =~ +|% +:: +coke: cook +:: +++ coke + $? %inn + %out + %cay + == +:: +reverse-ames: reverse ames message +:: +++ reverse-ames + $% :: diff + :: + [%d p=mark q=*] + :: etc. + :: + [%x ~] + == +:: +forward-ames: forward ames message +:: +++ forward-ames + $% :: message + :: + [%m =mark noun=*] + :: "peel" subscribe + :: + [%l =mark =path] + :: subscribe + :: + [%s =path] + :: cancel+unsubscribe + :: + [%u ~] + == +:: +foreign-response: foreign response +:: +++ foreign-response + $? %peer + %peel + %poke + %pull + == +-- +|% +:: +internal-note: +ap note +:: +++ internal-note + $% [%meta =term =vase] + [%send =ship =internal-task] + == +:: +internal-move: agent-level move +:: +:: Analogous to an Arvo move, except these are routed by bone, instead of +:: duct. +:: +++ internal-move + $: =bone + move=(wind internal-note internal-gift) + == +:: +move: Arvo-level move +:: +++ move + $: =duct + move=(wind note-arvo gift-arvo) + == +-- +|% +:: +state-old: upgrade path +:: +++ state-old ?(state) +:: +state: all state +:: +++ state + $: :: state version + :: + %0 + :: agents by ship + :: + =agents + == +:: +subscribers: subscriber data +:: +++ subscribers + $: :: incoming subscribers + :: + incoming=bitt + :: outgoing subscribers + :: + outgoing=boat + :: queue meter + :: + meter=(map bone @ud) + == +:: +agents: ship state +:: +++ agents + $: :: system duct + :: + system-duct=duct + :: foreign contacts + :: + contacts=(map ship foreign) + :: running agents + :: + running=(map term running-agent) + :: waiting queue + :: + blocked=(map term blocked) + == +:: +routes: new cuff +:: +++ routes + $: :: disclosing to + :: + disclosing=(unit (set ship)) + :: attributed to + :: + attributing=ship + == +:: +foreign: foreign connections +:: +++ foreign + $: :: index + :: + index=@ud + :: by duct + :: + index-map=(map duct @ud) + :: by index + :: + duct-map=(map @ud duct) + == +:: +ducts: opaque input +:: +++ ducts + $: :: bone sequence + :: + bone=@ud + :: by duct + :: + bone-map=(map duct bone) + :: by bone + :: + duct-map=(map bone duct) + == +:: +running-agent: agent state +:: +++ running-agent + $: :: cache + :: + cache=worm + :: control duct + :: + control-duct=duct + :: unstopped + :: + live=? + :: statistics + :: + =stats + :: subscribers + :: + =subscribers + :: agent core + :: + =agent + :: running state + :: + state=vase + :: update control + :: + =beak + :: req'd translations + :: + marks=(map bone mark) + :: opaque ducts + :: + =ducts + == +:: +agent: app core +:: +++ agent + => |% + +$ move cove + :: [bone (wind note=vase gift=vase)] + +$ step (quip move new-state=vase) + -- + $_ ^| + |_ [bowl:gall state=vase] + ++ handle-init + *step + :: + ++ handle-prep + |~ old-state=vase + *step + :: + ++ handle-poke + |~ in-poke-data=cage + *step + :: + ++ handle-peer + |~ path + *step + :: + ++ handle-peek + |~ path + *(unit (unit cage)) + :: + ++ handle-gall + |~ [wire internal-gift:gall] + *step + :: + ++ handle-take + |~ [wire sign=vase] + *step + :: + ++ handle-pull + |~ path + *step + -- +:: +blocked: blocked tasks +:: +++ blocked (qeu (trel duct routes agent-action)) +:: +stats: statistics +:: +++ stats + $: :: change number + :: + change=@ud + :: entropy + :: + eny=@uvJ + :: time + :: + time=@da + == +-- +. == +=| =state +|= $: :: identity + :: + our=ship + :: urban time + :: + now=@da + :: entropy + :: + eny=@uvJ + :: activate + :: + ska=sley + == +~% %gall-top ..is ~ +|% +:: +gall-payload: gall payload +:: +++ gall-payload + +:: +mo: Arvo-level move handling +:: +:: An outer core responsible for routing moves to and from Arvo; it calls +:: an inner core, +ap, to route internal moves to and from agents. +:: +++ mo + ~% %gall-mo +> ~ + |_ + $: hen=duct + moves=(list move) + == + ++ mo-core . + :: +mo-abed: initialise state with the provided duct. + :: + ++ mo-abed + |= =duct + ^+ mo-core + :: + mo-core(hen duct) + :: +mo-abet: resolve moves. + :: + ++ mo-abet + ^- [(list move) _gall-payload] + :: + =/ resolved (flop moves) + [resolved gall-payload] + :: + :: +mo-boot: ask %ford to build us a core for the specified agent. + :: + ++ mo-boot + |= [=term =ship =desk] + ^+ mo-core + :: + =/ =case [%da now] + =/ =path + =/ ship (scot %p ship) + =/ case (scot case) + /sys/core/[term]/[ship]/[desk]/[case] + :: + =/ =note-arvo + =/ =schematic:ford [%core [ship desk] /hoon/[term]/app] + [%f %build live=%.y schematic] + :: + =/ pass [path note-arvo] + (mo-pass pass) + :: + :: +mo-pass: prepend a standard %pass to the current list of moves. + :: + ++ mo-pass + |= pass=(pair path note-arvo) + ^+ mo-core + :: + =/ =move [hen [%pass pass]] + mo-core(moves [move moves]) + :: +mo-give: prepend a standard %give to the current list of moves. + :: + ++ mo-give + |= =gift:able + ^+ mo-core + :: + =/ =move [hen [%give gift]] + mo-core(moves [move moves]) + :: +mo-contains-valid-bowl: check that a vase contains a valid bowl. + :: + ++ mo-contains-valid-bowl + ~/ %mo-contains-valid-bowl + |= =vase + ^- ? + :: + =/ maybe-vase (slew 12 vase) + ?~ maybe-vase + %.n + =/ =type p.u.maybe-vase + (~(nest ut type) %.n -:!>(*bowl)) + :: +mo-receive-core: receives an app core built by %ford. + :: + :: Presuming we receive a good core, we first check to see if the agent + :: is already running. If so, we update its beak in %gall's state, + :: initialise an +ap core for the agent, install the core we got from + :: %ford, and then resolve any moves associated with it. + :: + :: If we're dealing with a new agent, we create one using the result we + :: got from %ford, add it to the collection of agents %gall is keeping + :: track of, and then do more or less the same procedure as we did for the + :: running agent case. + :: + ++ mo-receive-core + ~/ %mo-receive-core + |= [=term =beak =made-result:ford] + ^+ mo-core + :: + ?: ?=([%incomplete *] made-result) + (mo-give %onto %.n tang.made-result) + :: + =/ build-result build-result.made-result + :: + ?: ?=([%error *] build-result) + (mo-give %onto %.n message.build-result) + :: + =/ =cage (result-to-cage:ford build-result) + =/ result-vase q.cage + =/ maybe-agent=(unit running-agent) + (~(get by running.agents.state) term) + :: + ?^ maybe-agent + =/ agent u.maybe-agent(beak beak) + =. running.agents.state + (~(put by running.agents.state) term agent) + =/ =routes [disclosing=~ attributing=our] + =/ app (ap-abed:ap term routes) + =. app (ap-reinstall:app result-vase) + ap-abet:app + :: + ?. (mo-contains-valid-bowl result-vase) + =/ err [[%leaf "{}: bogus core"] ~] + (mo-give %onto %.n err) + :: + =. mo-core (mo-new-agent term beak result-vase) + =/ old mo-core + =/ wag + =/ =routes [disclosing=~ attributing=our] + =/ app (ap-abed:ap term routes) + (ap-prep:app ~) + :: + =/ maybe-tang -.wag + =/ app +.wag + ?^ maybe-tang + =. mo-core old + (mo-give %onto %.n u.maybe-tang) + :: + =. mo-core ap-abet:app + =. mo-core (mo-clear-queue term) + =/ =suss [term %boot now] + (mo-give %onto [%.y suss]) + :: +mo-new-agent: create a new agent and add it to %gall's state. + :: + :: %gall maintains a collection of running agents. This arm creates a + :: new one with the provided name, beak, and state (held in a vase). + :: + ++ mo-new-agent + |= [=term =beak =vase] + ^+ mo-core + :: + =/ =ducts + :+ bone=1 + bone-map=[[[~ ~] 0] ~ ~] + duct-map=[[0 [~ ~]] ~ ~] + :: + =/ running-agent + =/ default-agent *running-agent + %_ default-agent + control-duct hen + beak beak + running-state vase + agent !<(agent vase) + state !>(~) + ducts ducts + == + :: + %_ mo-core + running.agents.state (~(put by running.agents.state) term agent) + == + :: +mo-handle-foreign-request: handle a foreign request. + :: + :: Handles tasks received on a +call that have come from another ship. + :: + ++ mo-handle-foreign-request + ~/ %mo-handle-foreign-request + |= [=ship =internal-task] + ^+ mo-core + :: + =/ =term p.internal-task + =/ =agent-action q.internal-task + ?: ?=(%pump -.agent-action) + :: + :: you'd think this would send an ack for the diff + :: that caused this pump. it would, but we already + :: sent it when we got the diff in +mo-handle-sys. then + :: we'd have to save the network duct and connect it + :: to this returning pump. + :: + mo-core + :: + ?: ?=(%peer-not -.agent-action) + =/ =tang p.agent-action + (mo-give %unto %reap (some tang)) + :: + =^ bone mo-core (mo-assign-bone ship) + =/ =forward-ames + ?- -.agent-action + %poke [%m p.p.agent-action q.q.p.agent-action] + %pull [%u ~] + %puff !! + %punk !! + %peel [%l agent-action] + %peer [%s p.agent-action] + == + :: + =/ sys-path + =/ action -.agent-action + /sys/way/[action] + :: + =/ =note-arvo + =/ =path /g/ge/[term] + =/ =noun [bone forward-ames] + [%a %want ship path noun] + :: + (mo-pass sys-path note-arvo) + :: +mo-handle-foreign-response: handle foreign response. + :: + :: Handle a received %woot from %ames. + :: + ++ mo-handle-foreign-response + ++ mo-handle-foreign-response + |= [=foreign-response art=(unit ares)] + ^+ mo-core + :: + =/ to-tang + |= =ares + ^- tang + ?~ ares + ~ + =/ tape (trip p.u.ares) + [[%leaf tape] q.u.ares] + :: + =/ result (bind art to-tang) + ?- foreign-response + %peel (mo-give %unto %reap result) + %peer (mo-give %unto %reap result) + %poke (mo-give %unto %coup result) + %pull mo-core + == + :: +mo-assign-bone: assign an outbone to a ship. + :: + :: If we know about the ship, we simply use its existing bone. Otherwise + :: we register a new entry for the ship, and use a default bone for it. + :: + ++ mo-assign-bone + |= =ship + ^- [bone _mo-core] + :: + =/ =foreign + =/ existing (~(get by contacts.agents.state) ship) + (fall existing [1 ~ ~]) + :: + =/ existing (~(get by index-map.foreign) hen) + ?^ existing + [u.existing mo-core] + :: + =/ index index.foreign + =/ contacts + =/ new-foreign + %_ foreign + index +(index) + index-map (~(put by index-map.foreign) hen index) + duct-map (~(put by duct-map.foreign) index hen) + == + (~(put by contacts.agents.state) ship new-foreign) + :: + =/ next mo-core(contacts.agents.state contacts) + [index next] + :: +mo-retrieve-duct: retrieve a duct by index. + :: + ++ mo-retrieve-duct + |= [=ship index=@ud] + ^- duct + :: + =/ =foreign (~(got by contacts.agents.state) ship) + (~(got by duct-map.foreign) index) + :: +mo-handle-sys: handle a +sign incoming over /sys. + :: + :: (Note that /sys implies the +sign should be routed to a vane.) + :: + ++ mo-handle-sys + ~/ %mo-handle-sys + |= [=path =sign-arvo] + ^+ mo-core + :: + ?+ -.path !! + %core (mo-handle-sys-core path sign-arvo) + %pel (mo-handle-sys-pel path sign-arvo) + %red (mo-handle-sys-red path sign-arvo) + %rep (mo-handle-sys-rep path sign-arvo) + %req (mo-handle-sys-req path sign-arvo) + %val (mo-handle-sys-val path sign-arvo) + %way (mo-handle-sys-way path sign-arvo) + == + :: +mo-handle-sys-core: receive a core from %ford. + :: + ++ mo-handle-sys-core + |= [=path =sign-arvo] + ^+ mo-core + :: + ?> ?=([%f %made *] sign-arvo) + ?> ?=([@ @ @ @ @ ~] path) + =/ beak-path t.t.path + =/ =beak + =/ =ship (slav %p i.beak-path) + =/ =desk i.t.beak-path + =/ =case [%da (slav %da i.t.t.beak-path)] + [ship desk case] + (mo-receive-core i.t.path beak result.sign-arvo) + :: +mo-handle-sys-pel: translated peer. + :: + :: Validates a received %ford result and %gives an internal %diff. + :: + ++ mo-handle-sys-pel + |= [=path =sign-arvo] + ^+ mo-core + :: + ?> ?=([%f %made *] sign-arvo) + ?> ?=([@ @ ~] path) + :: + ?: ?=([%incomplete *] result.sign-arvo) + =/ err (some tang.result.sign-arvo) + (mo-give %unto %coup err) + :: + =/ build-result build-result.result.sign-arvo + :: + ?: ?=([%error *] build-result) + =/ err (some message.build-result) + (mo-give %unto %coup err) + :: + =/ =cage (result-to-cage:ford build-result) + (mo-give %unto %diff cage) + :: +mo-handle-sys-red: diff ack. + :: + :: On receipt of a valid +sign from %ames, we simply pass a %pump + :: acknowledgement internally; otherwise we pass both an internal + :: unsubscribing %pull, plus a %want to %ames, before complaining about a + :: bad message acknowledgment. + :: + ++ mo-handle-sys-red + |= [=path =sign-arvo] + ^+ mo-core + :: + ?> ?=([@ @ @ @ ~] path) + ?. ?=([%a %woot *] sign-arvo) + ~& [%red-want path] + mo-core + :: + =/ him (slav %p i.t.path) + =/ dap i.t.t.path + =/ num (slav %ud i.t.t.t.path) + =/ =coop q.+>.sign-arvo + =/ sys-path + =/ pax [%req t.path] + [%sys pax] + :: + ?~ coop + =/ =note-arvo + =/ =sock [him our] + =/ =internal-task [dap %pump ~] + =/ =task:able [%deal sock internal-task] + [%g task] + (mo-pass sys-path note-arvo) + :: + =/ gall-move=note-arvo + =/ =sock [him our] + =/ =internal-task [dap %pull ~] + =/ =task:able [%deal sock internal-task] + [%g task] + :: + =/ ames-move=note-arvo + =/ path [%g %gh dap ~] + =/ =noun [num %x ~] + =/ =task:able:ames [%want him path noun] + [%a task] + :: + =. mo-core (mo-pass sys-path gall-move) + =. mo-core (mo-pass sys-path ames-move) + :: + ?. ?=([~ ~ %mack *] coop) + ~& [%diff-bad-ack coop] + mo-core + :: + ~& [%diff-bad-ack %mack] + =/ print (slog (flop q.,.+>.coop)) + (print mo-core) + :: +mo-handle-sys-rep: reverse request. + :: + :: On receipt of a valid +sign from %ford, sets state to the appropriate + :: duct and gives an internal %diff containing the +sign payload. + :: + ++ mo-handle-sys-rep + |= [=path =sign-arvo] + ^+ mo-core + :: + ?> ?=([@ @ @ @ ~] path) + ?> ?=([%f %made *] sign-arvo) + =/ him (slav %p i.t.path) + =/ dap i.t.t.path + =/ num (slav %ud i.t.t.t.path) + :: + ?: ?=([%incomplete *] result.sign-arvo) + =/ err (some tang.result.sign-arvo) + (mo-give %mack err) + :: + =/ build-result build-result.result.sign-arvo + ?: ?=([%error *] build-result) + :: XX should crash + =/ err (some message.build-result) + (mo-give %mack err) + :: XX pump should ack + =. mo-core (mo-give %mack ~) + =/ duct (mo-retrieve-duct him num) + =. mo-core (mo-abed duct) + =/ =cage (result-to-cage:ford build-result) + =/ move [%unto [%diff cage]] + (mo-give move) + :: +mo-handle-sys-req: process an inbound request. + :: + ++ mo-handle-sys-req + |= [=path =sign-arvo] + ^+ mo-core + :: + ?> ?=([@ @ @ @ ~] path) + =/ him (slav %p i.t.path) + =/ dap i.t.t.path + =/ num (slav %ud i.t.t.t.path) + :: + ?: ?=([%f %made *] sign-arvo) + ?: ?=([%incomplete *] result.sign-arvo) + =/ err (some tang.result.sign-arvo) + (mo-give %mack err) + :: + =/ build-result build-result.result.sign-arvo + ?: ?=([%error *] build-result) + =/ err (some message.build-result) + (mo-give %mack err) + :: + =/ sys-path [%sys path] + =/ =note-arvo + =/ =cage (result-to-cage:ford build-result) + [%g %deal [him our] i.t.t.path %poke cage] + (mo-pass sys-path note-arvo) + :: + ?: ?=([%a %woot *] sign-arvo) + mo-core + :: + ?> ?=([%g %unto *] sign-arvo) + =/ =internal-gift +>.sign-arvo + :: + ?- -.internal-gift + %coup + (mo-give %mack p.internal-gift) + :: + %diff + =/ sys-path [%sys %red t.path] + =/ =note-arvo + =/ path [%g %gh dap ~] + =/ noun [num %d p.p.internal-gift q.q.p.internal-gift] + [%a %want him path noun] + (mo-pass sys-path note-arvo) + :: + %quit + =/ sys-path [%sys path] + =/ =note-arvo + =/ path [%g %gh dap ~] + =/ noun [num %x ~] + [%a %want him path noun] + (mo-pass sys-path note-arvo) + :: + %reap + (mo-give %mack p.internal-gift) + :: + %http-response + !! + == + :: +mo-handle-sys-val: inbound validate. + :: + :: Validates an incoming +sign from %ford and applies it to the specified + :: agent. + :: + ++ mo-handle-sys-val + |= [=path =sign-arvo] + ^+ mo-core + :: + ?> ?=([%f %made *] sign-arvo) + ?> ?=([@ @ @ ~] path) + =/ =ship (slav %p i.t.path) + =/ =term i.t.t.path + ?: ?=([%incomplete *] result.sign-arvo) + =/ err (some tang.result.sign-arvo) + (mo-give %unto %coup err) + :: + =/ build-result build-result.result.sign-arvo + ?: ?=([%error *] build-result) + =/ err (some message.build-result) + (mo-give %unto %coup err) + :: + =/ =routes [disclosing=~ attributing=ship] + =/ =cage (result-to-cage:ford build-result) + =/ =agent-action [%poke cage] + (mo-apply term routes agent-action) + :: +mo-handle-sys-way: outbound request. + :: + ++ mo-handle-sys-way + |= [=path =sign-arvo] + ^+ mo-core + :: + ?> ?=([%a %woot *] sign-arvo) + ?> ?=([@ @ ~] path) + =/ =foreign-response (foreign-response i.t.path) + =/ maybe-ares +>+.sign-arvo + (mo-handle-foreign-response foreign-response maybe-ares) + :: +mo-handle-use: handle a typed +sign incoming on /use. + :: + :: (Note that /use implies the +sign should be routed to an agent.) + :: + :: Initialises the specified agent and then performs an agent-level +take + :: on the supplied +sign. + :: + ++ mo-handle-use + ~/ %mo-handle-use + |= [=path hin=(hypo sign-arvo)] + ^+ mo-core + :: + ?. ?=([@ @ coke *] path) + ~& [%mo-handle-use-bad-path path] + !! + :: + =/ app + =/ =term i.path + =/ =ship (slav %p i.t.path) + =/ =routes [disclosing=~ attributing=ship] + (ap-abed:ap term routes) + :: + =/ =sign-arvo q.hin + ?- i.t.t.path + %inn + =/ =vase (slot 3 hin) + =. app (ap-generic-take:app t.t.t.path vase) + ap-abet:app + :: + %cay + ~& [%mo-handle-use-weird sign-arvo] + ~& [%mo-handle-use-weird-path path] + mo-core + :: + %out + ?. ?=([%g %unto *] sign-arvo) + ~& [%mo-handle-use-weird sign-arvo] + ~& [%mo-handle-use-weird-path path] + mo-core + =. app + =/ =internal-gift +>.sign-arvo + (ap-specific-take:app t.t.t.path internal-gift) + ap-abet:app + == + :: +mo-clear-queue: clear blocked tasks from the specified running agent. + :: + ++ mo-clear-queue + |= =term + ^+ mo-core + :: + ?. (~(has by running.agents.state) term) + mo-core + =/ maybe-blocked (~(get by blocked.agents.state) term) + ?~ maybe-blocked + mo-core + :: + =/ =blocked u.maybe-blocked + :: + |- ^+ mo-core + ?: =(~ blocked) + =/ blocked (~(del by blocked.agents.state) term) + %_ mo-core + blocked.agents.state blocked + == + =^ task blocked [p q]:~(get to blocked) + =/ =duct p.task + =/ =routes q.task + =/ =agent-action r.task + :: + =/ move + =/ =sock [attributing.routes our] + =/ =internal-task [term agent-action] + =/ card [%slip %g %deal sock internal-task] + [duct card] + $(moves [move moves]) + :: +mo-beak: assemble a beak for the specified agent. + :: + ++ mo-beak + |= =term + ^- beak + :: + ?~ running=(~(get by running.agents.state) term) + :: XX this fallback is necessary, as .term could be either the source + :: or the destination app. ie, it might not exist locally ... + :: + [our %home %da now] + beak.u.running + :: +mo-peek: call to +ap-peek (which is not accessible outside of +mo). + :: + ++ mo-peek + ~/ %mo-peek + |= [agent=term =routes =term =path] + ^- (unit (unit cage)) + :: + =/ app (ap-abed:ap agent routes) + (ap-peek:app term path) + :: +mo-apply: apply the supplied action to the specified agent. + :: + ++ mo-apply + |= [=term =routes =agent-action] + ^+ mo-core + :: + =/ =path + =/ ship (scot %p attributing.routes) + /sys/val/[ship]/[term] + :: + =/ ship-desk + =/ =beak (mo-beak term) + [p q]:beak + :: + ?: ?=(%puff -.agent-action) + =/ =schematic:ford [%vale ship-desk +.agent-action] + =/ =note-arvo [%f %build live=%.n schematic] + (mo-pass path note-arvo) + :: + ?: ?=(%punk -.agent-action) + =/ =schematic:ford [%cast ship-desk p.agent-action [%$ q.agent-action]] + =/ =note-arvo [%f %build live=%.n schematic] + (mo-pass path note-arvo) + :: + ?: ?=(%peer-not -.agent-action) + =/ err (some p.agent-action) + (mo-give %unto %reap err) + :: + =/ app (ap-abed:ap term routes) + =. app (ap-apply:app agent-action) + ap-abet:app + :: +mo-handle-local: handle locally. + :: + :: If the agent is running or blocked, assign it the supplied +task. + :: Otherwise simply apply the action to the agent. + :: + ++ mo-handle-local + |= [=ship =internal-task] + ^+ mo-core + :: + =/ =routes [disclosing=~ attributing=ship] + =/ =term p.internal-task + =/ =agent-action q.internal-task + =/ is-running (~(has by running.agents.state) term) + =/ is-blocked (~(has by blocked.agents.state) term) + :: + ?: |(!is-running is-blocked) + =/ =blocked + =/ waiting (~(get by blocked.agents.state) term) + =/ tasks (fall waiting *blocked) + =/ task [hen routes agent-action] + (~(put to tasks) task) + :: + %_ mo-core + blocked.agents.state (~(put by blocked.agents.state) term blocked) + == + (mo-apply term routes agent-action) + :: +mo-handle-forward: handle forward %ames message. + :: + ++ mo-handle-forward + |= [=ship =term =bone =forward-ames] + ^+ mo-core + :: + =. mo-core + ?. ?=(%u -.forward-ames) + mo-core + (mo-give %mack ~) + :: + =/ =path + =/ him (scot %p ship) + =/ num (scot %ud bone) + /sys/req/[him]/[term]/[num] + :: + =/ =sock [ship our] + =/ =note-arvo + ?- -.forward-ames + %m + =/ =task:able + =/ =internal-task [term %puff [mark noun]:forward-ames] + [%deal sock internal-task] + [%g task] + :: + %l + =/ =task:able + =/ =internal-task [term %peel [mark path]:forward-ames] + [%deal sock internal-task] + [%g task] + :: + %s + =/ =task:able + =/ =internal-task [term %peer path.forward-ames] + [%deal sock internal-task] + [%g task] + :: + %u + =/ =task:able + =/ =internal-task [term %pull ~] + [%deal sock internal-task] + [%g task] + == + (mo-pass path note-arvo) + :: +mo-handle-backward: handle reverse %ames message. + :: + ++ mo-handle-backward + |= [=ship =term =bone =reverse-ames] + ^+ mo-core + :: + ?- -.reverse-ames + %d + =/ =path + =/ him (scot %p ship) + =/ num (scot %ud bone) + /sys/rep/[him]/[term]/[num] + :: + =/ =note-arvo + =/ beak (mo-beak term) + =/ info [p q]:beak + =/ =schematic:ford [%vale info p.reverse-ames q.reverse-ames] + [%f %build live=%.n schematic] + :: + (mo-pass path note-arvo) + :: + %x + :: XX should crash + =. mo-core (mo-give %mack ~) + =/ initialised + =/ out (mo-retrieve-duct ship bone) + (mo-abed out) + (mo-give:initialised %unto %quit ~) + == + :: +ap: agent engine + :: + :: An inner, agent-level core. The sample refers to the agent we're + :: currently focused on. + :: + ++ ap + ~% %gall-ap +> ~ + |_ $: agent-name=term + agent-routes=routes + agent-bone=bone + agent-moves=(list internal-move) + agent-config=(list (each suss tang)) + current-agent=running-agent + == + ++ ap-core . + :: +ap-abed: initialise state for an agent, with the supplied routes. + :: + :: The agent must already be running in +gall -- here we simply update + :: +ap's state to focus on it. + :: + ++ ap-abed + ~/ %ap-abed + |= [=term =routes] + ^+ ap-core + :: + =/ =running-agent + =/ running (~(got by running.agents.state) term) + =/ =stats + :+ +(change.stats.running) + (shaz (mix (add term change.stats.running) eny)) + now + running(stats stats) + :: + =. agent-name term + =. agent-routes routes + =. current-agent running-agent + =/ maybe-bone (~(get by bone-map.ducts.running-agent) hen) + ?^ maybe-bone + ap-core(agent-bone u.maybe-bone) + :: + =/ =ducts + :+ +(bone.ducts.running-agent) + (~(put by bone-map.ducts.running-agent) hen bone.ducts.running-agent) + (~(put by duct-map.ducts.running-agent) bone.ducts.running-agent hen) + :: + %_ ap-core + agent-bone bone.ducts.running-agent + ducts.current-agent ducts + == + :: +ap-abet: resolve moves. + :: + ++ ap-abet + ^+ mo-core + :: + => ap-track-queue + =/ running (~(put by running.agents.state) agent-name current-agent) + =/ moves + =/ giver |=(report=(each suss tang) [hen %give %onto report]) + =/ from-internal (turn agent-moves ap-from-internal) + =/ from-suss (turn agent-config giver) + :(weld from-internal from-suss moves) + :: + %_ mo-core + running.agents.state running + moves moves + == + :: +ap-track-queue: track queue. + :: + ++ ap-track-queue + ^+ ap-core + :: + =/ internal-moves agent-moves + =/ bones *(set bone) + |- ^+ ap-core + ?^ internal-moves + =/ =internal-move i.internal-moves + ?. ?=([%give %diff *] move.internal-move) + $(internal-moves t.internal-moves) + :: + =^ filled ap-core ap-enqueue(agent-bone bone.internal-move) + =/ new-bones + ?: filled + bones + (~(put in bones) bone.internal-move) + $(internal-moves t.internal-moves, bones new-bones) + :: + =/ bones ~(tap in bones) + :: + |- ^+ ap-core + ?~ bones + ap-core + :: + => $(bones t.bones, agent-bone i.bones) + =/ incoming + (~(get by incoming.subscribers.current-agent) agent-bone) + ?~ incoming + ~& [%ap-track-queue-bad-bone agent-name agent-bone] + ap-core + :: + =/ =ship p.u.incoming + ap-kill(attributing.agent-routes ship) + :: +ap-from-internal: internal move to move. + :: + :: We convert from bone-indexed moves to duct-indexed moves when + :: resolving them in Arvo. + :: + ++ ap-from-internal + ~/ %ap-from-internal + |= =internal-move + ^- move + :: + ~| [%gall-move-conversion-failed internal-move] + =/ =duct + (~(got by duct-map.ducts.current-agent) bone.internal-move) + :: + =/ card + ?- -.move.internal-move + %slip !! + :: + %give + ?< =(0 bone.internal-move) + :: + =/ =internal-gift p.move.internal-move + ?. ?=(%diff -.internal-gift) + [%give %unto internal-gift] + :: + =/ =cage p.internal-gift + =/ =mark + =/ mark (~(get by marks.current-agent) bone.internal-move) + (fall mark p.cage) + :: + ?: =(mark p.cage) + [%give %unto internal-gift] + =/ =path /sys/pel/[agent-name] + =/ =note-arvo + =/ =schematic:ford + =/ =beak (mo-beak agent-name) + [%cast [p q]:beak mark [%$ cage]] + [%f %build live=%.n schematic] + :: + [%pass path note-arvo] + :: + %pass + =/ =path p.move.internal-move + =/ =internal-note q.move.internal-move + =/ use-path [%use agent-name path] + =/ =note-arvo + ?- -.internal-note + %send + =/ =task:able + =/ =sock [our ship.internal-note] + =/ =internal-task internal-task.internal-note + [%deal sock internal-task] + [%g task] + :: + %meta + =/ =term term.internal-note + =/ =vase vase.internal-note + [term %meta vase] + == + [%pass use-path note-arvo] + == + [duct card] + :: +ap-agent-core: agent core with current bowl and state + :: + ++ ap-agent-core + ~(. agent.current-agent ap-construct-bowl state.current-agent) + :: +ap-apply: apply effect. + :: + ++ ap-apply + |= =agent-action + ^+ ap-core + :: + ?- -.agent-action + %peel (ap-peel +.agent-action) + %poke (ap-poke +.agent-action) + %peer (ap-peer +.agent-action) + %puff !! + %punk !! + %peer-not !! + %pull ap-load-delete + %pump ap-dequeue + == + :: +ap-peek: peek. + :: + ++ ap-peek + ~/ %ap-peek + |= [=term tyl=path] + ^- (unit (unit cage)) + :: + =/ peek-result=(each (unit (unit cage)) tang) + (mule |.((handle-peek:ap-agent-core [term tyl]))) + :: + ?- -.peek-result + %& p.peek-result + %| ((slog leaf+"peek bad result" p.peek-result) [~ ~]) + -- + :: +ap-update-subscription: update subscription. + :: + ++ ap-update-subscription + ~/ %ap-update-subscription + |= [is-ok=? =ship =path] + ^+ ap-core + :: + =/ way [(scot %p ship) %out path] + :: + ?: is-ok + =/ =internal-note [%send ship -.path %pump ~] + (ap-pass way internal-note) + =. ap-core (ap-give %quit ~) + =/ =internal-note [%send ship -.path %pull ~] + (ap-pass way internal-note) + :: +ap-dequeue: drop from queue. + :: + :: Dequeues along the current bone, deleting the queue entirely if it + :: drops to zero. + :: + ++ ap-dequeue + ^+ ap-core + :: + ?. (~(has by incoming.subscribers.current-agent) agent-bone) + ap-core + =/ level (~(get by meter.subscribers.current-agent) agent-bone) + ?: |(?=(~ level) =(0 u.level)) + ap-core + :: + =. u.level (dec u.level) + ?: =(0 u.level) + =/ deleted (~(del by meter.subscribers.current-agent) agent-bone) + ap-core(meter.subscribers.current-agent deleted) + :: + =/ dequeued + (~(put by meter.subscribers.current-agent) agent-bone u.level) + ap-core(meter.subscribers.current-agent dequeued) + :: +ap-enqueue: add to queue. + :: + :: Every agent has a 'meter', that tracks the number of incoming + :: subscribers by bone. We get both the meter and ship associated with + :: the current bone; if the meter has hit twenty for another ship, we + :: don't enqueue the subscriber. Otherwise we increment the meter for + :: the current bone and update the agent's state with it. + :: + :: Returns a yes if the meter has been incremented, and no otherwise. + :: + ++ ap-enqueue + ^- [? _ap-core] + :: + =/ meter (~(gut by meter.subscribers.current-agent) agent-bone 0) + =/ subscriber=(unit (pair ship path)) + (~(get by incoming.subscribers.current-agent) agent-bone) + :: + ?: ?& =(20 meter) + ?| ?=(~ subscriber) + !=(our p.u.subscriber) + == + == + =/ incoming (~(get by incoming.subscribers.current-agent) agent-bone) + =/ duct (~(get by duct-map.ducts.current-agent) agent-bone) + ~& [%gall-pulling-20 agent-bone incoming duct] + [%.n ap-core] + :: + =/ next + =/ meter + (~(put by meter.subscribers.current-agent) agent-bone +(meter)) + ap-core(meter.subscribers.current-agent meter) + :: + [%.y next] + :: +ap-give: return result. + :: + ++ ap-give + |= =internal-gift + ^+ ap-core + :: + =/ internal-moves + =/ move [%give internal-gift] + =/ =internal-move [agent-bone move] + [internal-move agent-moves] + ap-core(agent-moves internal-moves) + :: +ap-construct-bowl: set up bowl. + :: + ++ ap-construct-bowl + ^- bowl + :* :* our :: host + attributing.agent-routes :: guest + agent-name :: agent + == :: + :* :: NB (jtobin): see urbit/urbit#1466 + wex=~ :: outgoing + sup=incoming.subscribers.current-agent :: incoming + == :: + :* agent-bone=agent-bone :: cause + act=change.stats.current-agent :: tick + eny=eny.stats.current-agent :: nonce + now=time.stats.current-agent :: time + byk=beak.current-agent :: source + == == + :: +ap-pass: request action. + :: + ++ ap-pass + |= [=path =internal-note] + ^+ ap-core + :: + =/ =internal-move + =/ move [%pass path internal-note] + [agent-bone move] + =/ internal-moves [internal-move agent-moves] + ap-core(agent-moves internal-moves) + :: +ap-reinstall: reinstall. + :: + ++ ap-reinstall + ~/ %ap-reinstall + |= =vase + ^+ ap-core + :: + =/ prep + =/ =agent !<(agent vase) + =/ installed ap-install(agent.current-agent agent) + =/ running (some state.current-agent) + (installed running) + :: + =^ maybe-tang ap-core prep + ?~ maybe-tang + ap-core + (ap-lame %prep-failed u.maybe-tang) + :: +ap-peel: apply %peel. + :: + ++ ap-peel + |= [=mark =path] + ^+ ap-core + :: + =. marks.current-agent (~(put by marks.current-agent) agent-bone mark) + (ap-peer path) + :: +ap-peer: apply %peer. + :: + ++ ap-peer + ~/ %ap-peer + |= pax=path + ^+ ap-core + :: + =/ incoming [attributing.agent-routes pax] + =. incoming.subscribers.current-agent + (~(put by incoming.subscribers.current-agent) agent-bone incoming) + :: + =^ maybe-tang ap-core + %+ ap-ingest %reap |. + (handle-peer:ap-agent-core pax) + ?^ maybe-tang + ap-silent-delete + ap-core + :: +ap-poke: apply %poke. + :: + ++ ap-poke + ~/ %ap-poke + |= =cage + ^+ ap-core + :: + =^ maybe-tang ap-core + %+ ap-ingest %coup |. + (handle-poke:ap-agent-core cage) + ap-core + :: +ap-lame: pour error. + :: + :: !! wat do + ++ ap-lame + |= [=term =tang] + ^+ ap-core + :: + =^ maybe-arm ap-core (ap-find-arm /lame) + =/ form |=(=tank [%rose [~ "! " ~] tank ~]) + ?~ maybe-arm + =/ tang [>%ap-lame agent-name term< (turn tang form)] + ~> %slog.`rose+[" " "[" "]"]^(flop tang) + ap-core + :: + =/ arm u.maybe-arm + =/ =vase !>([term tang]) + =^ maybe-tang ap-core (ap-call q.arm vase) + ?^ maybe-tang + =/ tang u.maybe-tang + =/ etc (flop [>%ap-lame-lame< (turn tang form)]) + ~> %slog.`rose+[" " "[" "]"]^(welp etc [%leaf "." (flop tang)]) + ap-core + :: + ap-core + :: +ap-generic-take: generic take. + :: + ++ ap-generic-take + ~/ %ap-generic-take + |= [=wire =vase] + ^+ ap-core + :: + =^ maybe-tang ap-core + %+ ap-ingest ~ |. + (handle-take:ap-agent-core wire vase) + ?^ maybe-tang + (ap-lame ktake u.maybe-tang) + ap-core + :: +ap-specific-take: specific take. + :: + ++ ap-specific-take + |= [=path =internal-gift] + ^+ ap-core + :: + =^ maybe-tang ap-core + %+ ap-ingest ~ |. + (handle-gall:ap-agent-core +.path internal-gift) + ?: ?=(%diff -.internal-gift) + (ap-update-subscription =(~ maybe-tang) ship +.path) + ?^ maybe-tang + (ap-lame -.internal-gift u.maybe-tang) + ap-core + :: +ap-install: install wrapper. + :: + ++ ap-install + |= maybe-vase=(unit vase) + ^- [(unit tang) _ap-core] + :: + =^ maybe-tang ap-core (ap-prep maybe-vase) + :: + =/ new-agent-config + =/ =term ?~(maybe-vase %boot %bump) + =/ possibly-suss + ?~ maybe-tang + =/ =suss [agent-name term now] + [%.y suss] + [%.n u.maybe-tang] + [possibly-suss agent-config] + :: + =/ next + %= ap-core + agent-config new-agent-config + arm-cache.current-agent ~ + == + :: + [maybe-tang next] + :: +ap-prep: low-level install. + :: + ++ ap-prep + ~/ %ap-prep + |= maybe-vase=(unit vase) + ^- [(unit tang) _ap-core] + :: + =^ maybe-tang ap-core + %+ ap-ingest ~ + ?~ maybe-vase + |. handle-init:ap-agent-core + |. (handle-prep:ap-agent-core u.maybe-vase) + [maybe-tang ap-core] + :: +ap-silent-delete: silent delete. + :: + ++ ap-silent-delete + ^+ ap-core + :: + ?~ (~(get by incoming.subscribers.current-agent) agent-bone) + ap-core + :: + =/ incoming (~(del by incoming.subscribers.current-agent) agent-bone) + =/ meter (~(del by meter.subscribers.current-agent) agent-bone) + %_ ap-core + incoming.subscribers.current-agent incoming + meter.subscribers.current-agent meter + == + :: +ap-load-delete: load delete. + :: + ++ ap-load-delete + ^+ ap-core + :: + =/ maybe-incoming + (~(get by incoming.subscribers.current-agent) agent-bone) + ?~ maybe-incoming + ap-core + :: + =/ incoming u.maybe-incoming + =. incoming.subscribers.current-agent + (~(del by incoming.subscribers.current-agent) agent-bone) + =. meter.subscribers.current-agent + (~(del by meter.subscribers.current-agent) agent-bone) + :: + =^ maybe-tang ap-core + %+ ap-ingest ~ |. + (handle-pull:ap-agent-core q.incoming) + ?^ maybe-tang + (ap-lame q.arm u.maybe-tang) + ap-core + :: +ap-kill: queue kill. + :: + ++ ap-kill + ^+ ap-core + :: + => ap-load-delete + (ap-give %quit ~) + :: +ap-ingest: call agent arm + :: + :: Handle acks here because they need to be emitted before the + :: rest of the moves. + :: + ++ ap-ingest + |= $: ack=?(%coup %reap ~) + result=_^?(|.(each [moves=(list move:agent) new-state=vase] tang)) + == + ^- [(unit tang) _ap-core] + =^ new-moves ap-core (ap-handle-result (mule result)) + =/ maybe-tang=(unit tang) + ?: =(%& -.peer-result) + ~ + `p.peer-result + =/ ack-moves + ?- ack + ~ ~ + %coup [agent-bone %give %coup maybe-tang]~ + %reap [agent-bone %give %reap maybe-tang]~ + == + :: + =. agent-moves + :(weld new-moves ack-moves agent-moves) + [maybe-tang ap-core] + :: +ap-handle-result: handle result. + :: + ++ ap-handle-result + ~/ %ap-handle-result + |= result=(each [moves=(list move:agent) new-state=vase] tang) + ^- [(list move:agent) ap-core] + ?: ?=(%| -.result) + (ap-lame %diff-crash p.result) + :: + =/ new-subs (ap-handle-quits moves.p.result) + :: + :- (flop moves.p.result) + %_ +>.$ + state.current-agent new-state.p.result + incoming.subscribers.current-agent new-subs + == + :: +ap-handle-quits: handle cancels of incoming subscriptions + :: + ++ ap-handle-quits + ~/ %ap-handle-quits + |= moves=(list move:agent) + ^- bitt + =/ quits=(list bone) + %+ murn moves.p.result + |= =move:agent + ?. ?=([%give %quit *] move.internal-move) + ~ + bone.internal-move + :: + =/ quit-map=bitt + (malt (turn quits |=(=bone [=bone *[ship path]]))) + (~(dif by incoming.subscribers.current-agent) quit-map) + :: +ap-tang: standard tang. + :: + ++ ap-tang + |= =tape + ^- tang + :: + =/ =tank [%leaf (weld "gall: {}: " tape)] + [tank ~] + -- + -- +:: +call: request +:: +++ call + ~% %gall-call +> ~ + |= [=duct hic=(hypo (hobo task:able))] + ^- [(list move) _gall-payload] + :: + ~| [%gall-call-failed duct q.hic] + :: make sure our task is hard + :: + =/ =task:able + ?. ?=(%soft -.q.hic) + q.hic + ;; task:able p.q.hic + :: + =/ initialised (mo-abed:mo duct) + ?- -.task + %conf + =/ =dock p.task + =/ =ship p.dock + ?. =(our ship) + ~& [%gall-not-ours ship] + [~ gall-payload] + :: + => (mo-boot:initialised q.dock q.task) + mo-abet + :: + %deal + =/ =sock p.task + =/ =internal-task q.task + ?. =(q.sock our) + ?> =(p.sock our) + => (mo-handle-foreign-request:initialised q.sock internal-task) + mo-abet + :: + => (mo-handle-local:initialised p.sock internal-task) + mo-abet + :: + %init + =/ payload gall-payload(system-duct.agents.state duct) + [~ payload] + :: + %vega + [~ gall-payload] + :: + %west + =/ =ship p.task + =/ =path q.task + =/ =noun r.task + :: + ?> ?=([?(%ge %gh) @ ~] path) + =/ agent-name i.t.path + :: + ?: ?=(%ge i.path) + =/ mes ;;((pair @ud forward-ames) noun) + => (mo-handle-forward:initialised ship agent-name mes) + mo-abet + :: + =/ mes ;;((pair @ud reverse-ames) noun) + => (mo-handle-backward:initialised ship agent-name mes) + mo-abet + :: + %wash + =. running.agents.state + %- ~(run by running.agents.state) + |= =running-agent + running-agent(cache *worm) + [~ gall-payload] + :: + %wegh + =/ blocked + =/ queued (~(run by blocked.agents.state) |=(blocked [%.y +<])) + (sort ~(tap by queued) aor) + :: + =/ running + =/ active (~(run by running.agents.state) |=(agent [%.y +<])) + (sort ~(tap by active) aor) + :: + =/ =mass + :+ %gall %.n + :~ [%foreign %.y contacts.agents.state] + [%blocked %.n blocked] + [%active %.n running] + [%dot %.y state] + == + :: + =/ moves + =/ =move [duct %give %mass mass] + [move ~] + :: + [moves gall-payload] + == +:: +load: recreate vane +:: +++ load + |= =state-old + ^+ gall-payload + :: + ?- -.state-old + %0 gall-payload(state state-old) + == +:: +scry: standard scry +:: +++ scry + ~/ %gall-scry + |= [fur=(unit (set monk)) =term =shop =desk =coin =path] + ^- (unit (unit cage)) + ?. ?=(%.y -.shop) + ~ + :: + =/ =ship p.shop + ?: ?& =(%u term) + =(~ path) + =([%$ %da now] coin) + =(our ship) + == + =/ =vase !>((~(has by running.agents.state) desk)) + =/ =cage [%noun vase] + (some (some cage)) + :: + ?. =(our ship) + ~ + :: + ?. =([%$ %da now] coin) + ~ + :: + ?. (~(has by running.agents.state) desk) + (some ~) + :: + ?. ?=(^ path) + ~ + :: + =/ initialised mo-abed:mo + =/ =routes [~ ship] + (mo-peek:initialised desk routes term path) +:: +stay: save without cache +:: +++ stay state +:: +take: response +:: +++ take + ~/ %gall-take + |= [=wire =duct hin=(hypo sign-arvo)] + ^- [(list move) _gall-payload] + :: + ~| [%gall-take-failed wire] + ?> ?=([?(%sys %use) *] wire) + =/ initialised (mo-abed:mo duct) + =/ =sign-arvo q.hin + => + ?- i.wire + %sys (mo-handle-sys:initialised t.wire sign-arvo) + %use (mo-handle-use:initialised t.wire hin) + == + mo-abet +-- From f8171138c3223aa58357e3197f9aa4abedfb00db Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 29 Aug 2019 12:57:33 -0700 Subject: [PATCH 127/451] mall: add lame handling --- pkg/arvo/sys/vane/mall.hoon | 59 +++++++++++++------------------------ 1 file changed, 21 insertions(+), 38 deletions(-) diff --git a/pkg/arvo/sys/vane/mall.hoon b/pkg/arvo/sys/vane/mall.hoon index 9a179cfbd..666503c97 100644 --- a/pkg/arvo/sys/vane/mall.hoon +++ b/pkg/arvo/sys/vane/mall.hoon @@ -209,6 +209,10 @@ |~ path *step :: + ++ handle-pull + |~ path + *step + :: ++ handle-peek |~ path *(unit (unit cage)) @@ -221,8 +225,8 @@ |~ [wire sign=vase] *step :: - ++ handle-pull - |~ path + ++ handle-lame + |~ [term tang] *step -- :: +blocked: blocked tasks @@ -324,18 +328,6 @@ :: =/ =move [hen [%give gift]] mo-core(moves [move moves]) - :: +mo-contains-valid-bowl: check that a vase contains a valid bowl. - :: - ++ mo-contains-valid-bowl - ~/ %mo-contains-valid-bowl - |= =vase - ^- ? - :: - =/ maybe-vase (slew 12 vase) - ?~ maybe-vase - %.n - =/ =type p.u.maybe-vase - (~(nest ut type) %.n -:!>(*bowl)) :: +mo-receive-core: receives an app core built by %ford. :: :: Presuming we receive a good core, we first check to see if the agent @@ -375,11 +367,11 @@ =. app (ap-reinstall:app result-vase) ap-abet:app :: - ?. (mo-contains-valid-bowl result-vase) - =/ err [[%leaf "{}: bogus core"] ~] + =/ maybe-new-agent !<(agent vase) + ?~ maybe-new-agent + =/ err [[%leaf "{}: not valid agent"] ~] (mo-give %onto %.n err) - :: - =. mo-core (mo-new-agent term beak result-vase) + =. mo-core (mo-new-agent term beak u.maybe-new-agent) =/ old mo-core =/ wag =/ =routes [disclosing=~ attributing=our] @@ -402,13 +394,13 @@ :: new one with the provided name, beak, and state (held in a vase). :: ++ mo-new-agent - |= [=term =beak =vase] + |= [=term =beak =agent] ^+ mo-core :: =/ =ducts :+ bone=1 bone-map=[[[~ ~] 0] ~ ~] - duct-map=[[0 [~ ~]] ~ ~] + duct-map=[[0 [~ ~]] ~ ~] :: =/ running-agent =/ default-agent *running-agent @@ -416,7 +408,7 @@ control-duct hen beak beak running-state vase - agent !<(agent vase) + agent agent state !>(~) ducts ducts == @@ -1308,8 +1300,12 @@ |= =vase ^+ ap-core :: + =/ maybe-agent !<(agent vase) + ?~ maybe-agent + (ap-lame %new-core-not-agent ~) + :: =/ prep - =/ =agent !<(agent vase) + =/ =agent u.maybe-agent =/ installed ap-install(agent.current-agent agent) =/ running (some state.current-agent) (installed running) @@ -1356,27 +1352,14 @@ ap-core :: +ap-lame: pour error. :: - :: !! wat do ++ ap-lame |= [=term =tang] ^+ ap-core :: - =^ maybe-arm ap-core (ap-find-arm /lame) =/ form |=(=tank [%rose [~ "! " ~] tank ~]) - ?~ maybe-arm - =/ tang [>%ap-lame agent-name term< (turn tang form)] - ~> %slog.`rose+[" " "[" "]"]^(flop tang) - ap-core - :: - =/ arm u.maybe-arm - =/ =vase !>([term tang]) - =^ maybe-tang ap-core (ap-call q.arm vase) - ?^ maybe-tang - =/ tang u.maybe-tang - =/ etc (flop [>%ap-lame-lame< (turn tang form)]) - ~> %slog.`rose+[" " "[" "]"]^(welp etc [%leaf "." (flop tang)]) - ap-core - :: + =^ maybe-tang ap-core + %+ ap-ingest ~ |. + (handle-lame:ap-agent-core term (turn tang form)) ap-core :: +ap-generic-take: generic take. :: From c5cec4036bca6fd92cdfb3a544c7a90bebbeea35 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Fri, 9 Aug 2019 00:23:08 -0700 Subject: [PATCH 128/451] add !< rune --- pkg/arvo/sys/hoon.hoon | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 77e62a5de..85e6311e9 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -6753,6 +6753,7 @@ :: :::::: special {$zpcm p/hoon q/hoon} :: !, {$zpbn p/hoon} :: !> + {$zpgl p/spec q/hoon} :: !< {$zpmc p/hoon q/hoon} :: !; {$zpts p/hoon} :: != {$zpvt p/(list wing) q/hoon r/hoon} :: !@ @@ -10301,6 +10302,28 @@ =+ vos=$(gol %noun, gen q.gen) =+ ref=p:$(gol %noun, gen p.gen) [(nice (cell ref p.vos)) (cons [%1 burp(sut p.vos)] q.vos)] + :: + {$zpgl *} + =+ ^= typ + %- nice + %- fork + :~ [%atom %n `0] + [%cell [%atom %n `0] [%face %u (play [%kttr p.gen])]] + == + =+ ^= val + =< q + %_ $ + gol %noun + gen + :^ %wtcl + :+ %cncl [%limb %levi] + :~ [%tsbn [%zpbn [%kttr p.gen]] [%$ 2]] + [%tsbn q.gen [%$ 2]] + == + [%clhp [%bust %null] [%tsbn q.gen [%$ 3]]] + [%bust %null] + == + [typ val] :: {$zpts *} [(nice %noun) [%1 q:$(vet |, gen p.gen)]] {$zpvt *} ?:((feel p.gen) $(gen q.gen) $(gen r.gen)) @@ -10463,6 +10486,14 @@ {$zpmc *} =+ vos=$(gol %noun, gen q.gen) :: XX validate! [(nice (cell (play p.gen) p.vos)) (cell (play(sut dox) p.gen) q.vos)] + :: + {$zpgl *} + :: XX is this right? + %- beth + %- fork + :~ [%atom %n `0] + [%cell [%atom %n `0] [%face %u (play [%kttr p.gen])]] + == :: {$zpvt *} =+ [(feel p.gen) (feel(sut dox) p.gen)] @@ -10767,6 +10798,10 @@ {$zpcm *} $(gen p.gen) {$lost *} %void {$zpmc *} (cell $(gen p.gen) $(gen q.gen)) + {$zpgl *} %- fork + :~ [%atom %n `0] + [%cell [%atom %n `0] [%face %u (play [%kttr p.gen])]] + == {$zpts *} %noun {$zpvt *} ?:((feel p.gen) $(gen q.gen) $(gen r.gen)) {$zpzp *} %void @@ -11532,6 +11567,10 @@ ++ cain sell :: $-(vase tank) ++ noah text :: $-(vase tape) ++ onan seer :: $-(vise vase) +++ levi :: $-([type type] ?) + |= [a=type b=type] + (~(nest ut a) | b) +:: ++ text :: tape pretty-print |= vax/vase ^- tape ~(ram re (sell vax)) @@ -14108,6 +14147,7 @@ [%wtzp *] (rune '?!' ~ `['!' '' ''] (hoons ~[p]:x)) [%zpcm *] (rune '!,' ~ ~ (hoons ~[p q]:x)) [%zpbn *] (rune '!>' ~ ~ (hoons ~[p]:x)) + [%zpgl *] (rune '!<' ~ ~ (spec p.x) (hoons ~[q]:x)) [%zpmc *] (rune '!;' ~ ~ (hoons ~[p q]:x)) [%zpts *] (rune '!=' ~ ~ (hoons ~[p]:x)) [%zpvt *] (rune '!@' ~ ~ (wingseq p.x) (hoons ~[q r]:x)) @@ -16739,6 +16779,7 @@ [',' (rune com %zpcm expb)] [';' (rune mic %zpmc expb)] ['>' (rune ban %zpbn expa)] + ['<' (rune led %zpgl exqc)] ['@' (rune vat %zpvt expy)] ['=' (rune tis %zpts expa)] ['?' (rune wut %zpwt hinh)] From bc1ba10a11deb6f78741f25eb5740814871781a1 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 4 Sep 2019 12:48:36 -0700 Subject: [PATCH 129/451] mall: compiles and runs app, but type hole --- bin/solid.pill | 4 +- pkg/arvo/age/first.hoon | 45 ++++++++ pkg/arvo/app/cop.hoon | 41 +++++++ pkg/arvo/lib/agent.hoon | 89 +++++++++++++++ pkg/arvo/sys/vane/gall.hoon | 3 + pkg/arvo/sys/vane/mall.hoon | 221 +++++++++++++----------------------- pkg/arvo/sys/zuse.hoon | 137 ++++++++++++++++++++++ 7 files changed, 396 insertions(+), 144 deletions(-) create mode 100644 pkg/arvo/age/first.hoon create mode 100644 pkg/arvo/app/cop.hoon create mode 100644 pkg/arvo/lib/agent.hoon diff --git a/bin/solid.pill b/bin/solid.pill index 0b3b640df..5c736b369 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:447868a553c636c2b46c1d3cd2f48def1f66050976fb2ea03775443bdb591aae -size 16468208 +oid sha256:48eb6f561c22b0bd4828bd1f1690fb4f54fc9c092a6c2f48f2a995af53188d02 +size 16851284 diff --git a/pkg/arvo/age/first.hoon b/pkg/arvo/age/first.hoon new file mode 100644 index 000000000..53c15b125 --- /dev/null +++ b/pkg/arvo/age/first.hoon @@ -0,0 +1,45 @@ +/+ agent +|% ++$ in-poke-data %hoy +++ agent (^agent ,~ in-poke-data ,*) +-- +%- agent-to-mall-agent:agent +^- agent:agent +|_ [bowl:mall state=~] +++ handle-init + `~ +:: +++ handle-prep + |~ old-state=vase + *step:agent:agent +:: +++ handle-poke + |= =a=in-poke-data + ~& >> 'ouchers!' + ~& >>> a-in-poke-data + *step:agent:agent +:: +++ handle-peer + |~ path + *step:agent:agent +:: +++ handle-pull + |~ path + *step:agent:agent +:: +++ handle-peek + |~ path + *(unit (unit cage)) +:: +++ handle-mall + |~ [wire internal-gift:mall] + *step:agent:agent +:: +++ handle-take + |~ [wire *] + *step:agent:agent +:: +++ handle-lame + |~ [term tang] + *step:agent:agent +-- diff --git a/pkg/arvo/app/cop.hoon b/pkg/arvo/app/cop.hoon new file mode 100644 index 000000000..ada8e4c92 --- /dev/null +++ b/pkg/arvo/app/cop.hoon @@ -0,0 +1,41 @@ +|% ++$ move [bone card] ++$ card + $% [%conf-mall wire dock dock] + [%deal-mall wire sock internal-task:mall] + == +-- +|_ [=bowl:gall ~] +++ this . +++ poke-noun + |= arg=* + ^- (quip move _this) + :_ this :_ ~ + ?+ arg ~|(%bad-arg !!) + %conf `move`[ost.bowl %conf-mall / [our.bowl %first] [our.bowl %home]] + %poke `move`[ost.bowl %deal-mall / [our.bowl our.bowl] %first %poke %noun !>(%hey)] + == +:: +++ onto + |= [wire res=(each suss:mall tang)] + ?: ?=(%& -.res) + ~& %ontoad + `this + %- (slog >'conf-failed'< p.res) + `this +:: +++ unto + |= [wire res=internal-gift:mall] + ?- -.res + %diff !! + %quit !! + %reap !! + %http-response !! + %coup + ?~ p.res + ~& %mall-coup-good + `this + %- (slog >'mall-coup-failed'< u.p.res) + `this + == +-- diff --git a/pkg/arvo/lib/agent.hoon b/pkg/arvo/lib/agent.hoon new file mode 100644 index 000000000..e683ff299 --- /dev/null +++ b/pkg/arvo/lib/agent.hoon @@ -0,0 +1,89 @@ +|* [state=mold in-poke-data=mold sign=mold] +|% +++ agent + => |% + +$ step (quip move:agent:mall state) + -- + $_ ^| + |_ [bowl:mall state] + ++ handle-init + *step + :: + ++ handle-prep + |~ old-state=vase + *step + :: + ++ handle-poke + |~ =in-poke-data + *step + :: + ++ handle-peer + |~ path + *step + :: + ++ handle-pull + |~ path + *step + :: + ++ handle-peek + |~ path + *(unit (unit cage)) + :: + ++ handle-mall + |~ [wire internal-gift:mall] + *step + :: + ++ handle-take + |~ [wire =sign] + *step + :: + ++ handle-lame + |~ [term tang] + *step + -- +++ agent-to-mall-agent + |= =a=agent + |^ ^- agent:mall + |_ [=bowl:mall state=vase] + ++ handle-init (ag-step handle-init:(ag-core bowl state)) + ++ handle-prep ((ag-pace ,vase) handle-prep:(ag-core bowl state)) + ++ handle-poke + |= in=cage + ~& poke-in=in + ~& !>(*in-poke-data) + =/ data=(unit in-poke-data) !<(in-poke-data q.in) + ?~ data + ~| [%agent-received-malformed-poke our.bowl dap.bowl] + !! + (ag-step (handle-poke:(ag-core bowl state) u.data)) + :: + ++ handle-peer ((ag-pace ,path) handle-peer:(ag-core bowl state)) + ++ handle-pull ((ag-pace ,path) handle-pull:(ag-core bowl state)) + ++ handle-peek handle-peek:(ag-core bowl state) + ++ handle-mall + %- (ag-pace ,[wire internal-gift:mall]) + handle-mall:(ag-core bowl state) + :: + ++ handle-take ((ag-pace ,[wire vase]) handle-take:(ag-core bowl state)) + ++ handle-lame ((ag-pace ,[term tang]) handle-lame:(ag-core bowl state)) + -- + :: + ++ ag-core + |= [=bowl:mall =state=vase] + =/ static-state !<(state state-vase) + ?~ static-state + ~| [%bad-state-type our.bowl dap.bowl] + !! + ~(. a-agent bowl u.static-state) + :: + ++ ag-step + |= =step:agent + [-.step !>(+.step)] + :: + ++ ag-pace + |* in=mold + |= fun=$-(in step:agent) + |= =in + (ag-step (fun in)) + -- +-- diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 02c4b2e36..1191243d8 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -2285,14 +2285,17 @@ %build `%f %cash `%a %conf `%g + %conf-mall `%m %cred `%c %crew `%c %crow `%c %deal `%g + %deal-mall `%m %dirk `%c %drop `%c %flog `%d %info `%c + %init `%m %keep `%f %kill `%f %look `%j diff --git a/pkg/arvo/sys/vane/mall.hoon b/pkg/arvo/sys/vane/mall.hoon index 666503c97..f5a41061a 100644 --- a/pkg/arvo/sys/vane/mall.hoon +++ b/pkg/arvo/sys/vane/mall.hoon @@ -1,9 +1,9 @@ -!: :: %gall, agent execution +!: :: %mall, agent execution !? 163 !: :::: |= pit=vase -=, gall +=, mall => =~ |% :: +coke: cook @@ -49,21 +49,6 @@ == -- |% -:: +internal-note: +ap note -:: -++ internal-note - $% [%meta =term =vase] - [%send =ship =internal-task] - == -:: +internal-move: agent-level move -:: -:: Analogous to an Arvo move, except these are routed by bone, instead of -:: duct. -:: -++ internal-move - $: =bone - move=(wind internal-note internal-gift) - == :: +move: Arvo-level move :: ++ move @@ -184,51 +169,6 @@ :: =ducts == -:: +agent: app core -:: -++ agent - => |% - +$ move cove - :: [bone (wind note=vase gift=vase)] - +$ step (quip move new-state=vase) - -- - $_ ^| - |_ [bowl:gall state=vase] - ++ handle-init - *step - :: - ++ handle-prep - |~ old-state=vase - *step - :: - ++ handle-poke - |~ in-poke-data=cage - *step - :: - ++ handle-peer - |~ path - *step - :: - ++ handle-pull - |~ path - *step - :: - ++ handle-peek - |~ path - *(unit (unit cage)) - :: - ++ handle-gall - |~ [wire internal-gift:gall] - *step - :: - ++ handle-take - |~ [wire sign=vase] - *step - :: - ++ handle-lame - |~ [term tang] - *step - -- :: +blocked: blocked tasks :: ++ blocked (qeu (trel duct routes agent-action)) @@ -261,18 +201,18 @@ :: ska=sley == -~% %gall-top ..is ~ +~% %mall-top ..is ~ |% -:: +gall-payload: gall payload +:: +mall-payload: mall payload :: -++ gall-payload + +++ mall-payload + :: +mo: Arvo-level move handling :: :: An outer core responsible for routing moves to and from Arvo; it calls :: an inner core, +ap, to route internal moves to and from agents. :: ++ mo - ~% %gall-mo +> ~ + ~% %mall-mo +> ~ |_ $: hen=duct moves=(list move) @@ -288,10 +228,10 @@ :: +mo-abet: resolve moves. :: ++ mo-abet - ^- [(list move) _gall-payload] + ^- [(list move) _mall-payload] :: =/ resolved (flop moves) - [resolved gall-payload] + [resolved mall-payload] :: :: +mo-boot: ask %ford to build us a core for the specified agent. :: @@ -306,7 +246,7 @@ /sys/core/[term]/[ship]/[desk]/[case] :: =/ =note-arvo - =/ =schematic:ford [%core [ship desk] /hoon/[term]/app] + =/ =schematic:ford [%core [ship desk] /hoon/[term]/age] [%f %build live=%.y schematic] :: =/ pass [path note-arvo] @@ -331,12 +271,12 @@ :: +mo-receive-core: receives an app core built by %ford. :: :: Presuming we receive a good core, we first check to see if the agent - :: is already running. If so, we update its beak in %gall's state, + :: is already running. If so, we update its beak in %mall's state, :: initialise an +ap core for the agent, install the core we got from :: %ford, and then resolve any moves associated with it. :: :: If we're dealing with a new agent, we create one using the result we - :: got from %ford, add it to the collection of agents %gall is keeping + :: got from %ford, add it to the collection of agents %mall is keeping :: track of, and then do more or less the same procedure as we did for the :: running agent case. :: @@ -367,7 +307,7 @@ =. app (ap-reinstall:app result-vase) ap-abet:app :: - =/ maybe-new-agent !<(agent vase) + =/ maybe-new-agent !<(agent result-vase) ?~ maybe-new-agent =/ err [[%leaf "{}: not valid agent"] ~] (mo-give %onto %.n err) @@ -388,9 +328,9 @@ =. mo-core (mo-clear-queue term) =/ =suss [term %boot now] (mo-give %onto [%.y suss]) - :: +mo-new-agent: create a new agent and add it to %gall's state. + :: +mo-new-agent: create a new agent and add it to %mall's state. :: - :: %gall maintains a collection of running agents. This arm creates a + :: %mall maintains a collection of running agents. This arm creates a :: new one with the provided name, beak, and state (held in a vase). :: ++ mo-new-agent @@ -407,14 +347,13 @@ %_ default-agent control-duct hen beak beak - running-state vase agent agent state !>(~) ducts ducts == :: %_ mo-core - running.agents.state (~(put by running.agents.state) term agent) + running.agents.state (~(put by running.agents.state) term running-agent) == :: +mo-handle-foreign-request: handle a foreign request. :: @@ -466,7 +405,6 @@ :: :: Handle a received %woot from %ames. :: - ++ mo-handle-foreign-response ++ mo-handle-foreign-response |= [=foreign-response art=(unit ares)] ^+ mo-core @@ -608,22 +546,22 @@ =/ =sock [him our] =/ =internal-task [dap %pump ~] =/ =task:able [%deal sock internal-task] - [%g task] + [%m task] (mo-pass sys-path note-arvo) :: - =/ gall-move=note-arvo + =/ mall-move=note-arvo =/ =sock [him our] =/ =internal-task [dap %pull ~] =/ =task:able [%deal sock internal-task] - [%g task] + [%m task] :: =/ ames-move=note-arvo - =/ path [%g %gh dap ~] + =/ path [%m %gh dap ~] =/ =noun [num %x ~] =/ =task:able:ames [%want him path noun] [%a task] :: - =. mo-core (mo-pass sys-path gall-move) + =. mo-core (mo-pass sys-path mall-move) =. mo-core (mo-pass sys-path ames-move) :: ?. ?=([~ ~ %mack *] coop) @@ -688,13 +626,13 @@ =/ sys-path [%sys path] =/ =note-arvo =/ =cage (result-to-cage:ford build-result) - [%g %deal [him our] i.t.t.path %poke cage] + [%m %deal [him our] i.t.t.path %poke cage] (mo-pass sys-path note-arvo) :: ?: ?=([%a %woot *] sign-arvo) mo-core :: - ?> ?=([%g %unto *] sign-arvo) + ?> ?=([%m %unto *] sign-arvo) =/ =internal-gift +>.sign-arvo :: ?- -.internal-gift @@ -704,7 +642,7 @@ %diff =/ sys-path [%sys %red t.path] =/ =note-arvo - =/ path [%g %gh dap ~] + =/ path [%m %gh dap ~] =/ noun [num %d p.p.internal-gift q.q.p.internal-gift] [%a %want him path noun] (mo-pass sys-path note-arvo) @@ -712,7 +650,7 @@ %quit =/ sys-path [%sys path] =/ =note-arvo - =/ path [%g %gh dap ~] + =/ path [%m %gh dap ~] =/ noun [num %x ~] [%a %want him path noun] (mo-pass sys-path note-arvo) @@ -795,7 +733,7 @@ mo-core :: %out - ?. ?=([%g %unto *] sign-arvo) + ?. ?=([%m %unto *] sign-arvo) ~& [%mo-handle-use-weird sign-arvo] ~& [%mo-handle-use-weird-path path] mo-core @@ -832,7 +770,7 @@ =/ move =/ =sock [attributing.routes our] =/ =internal-task [term agent-action] - =/ card [%slip %g %deal sock internal-task] + =/ card [%slip %m %deal sock internal-task] [duct card] $(moves [move moves]) :: +mo-beak: assemble a beak for the specified agent. @@ -936,25 +874,25 @@ =/ =task:able =/ =internal-task [term %puff [mark noun]:forward-ames] [%deal sock internal-task] - [%g task] + [%m task] :: %l =/ =task:able =/ =internal-task [term %peel [mark path]:forward-ames] [%deal sock internal-task] - [%g task] + [%m task] :: %s =/ =task:able =/ =internal-task [term %peer path.forward-ames] [%deal sock internal-task] - [%g task] + [%m task] :: %u =/ =task:able =/ =internal-task [term %pull ~] [%deal sock internal-task] - [%g task] + [%m task] == (mo-pass path note-arvo) :: +mo-handle-backward: handle reverse %ames message. @@ -992,7 +930,7 @@ :: currently focused on. :: ++ ap - ~% %gall-ap +> ~ + ~% %mall-ap +> ~ |_ $: agent-name=term agent-routes=routes agent-bone=bone @@ -1003,7 +941,7 @@ ++ ap-core . :: +ap-abed: initialise state for an agent, with the supplied routes. :: - :: The agent must already be running in +gall -- here we simply update + :: The agent must already be running in +mall -- here we simply update :: +ap's state to focus on it. :: ++ ap-abed @@ -1097,7 +1035,7 @@ |= =internal-move ^- move :: - ~| [%gall-move-conversion-failed internal-move] + ~| [%mall-move-conversion-failed internal-move] =/ =duct (~(got by duct-map.ducts.current-agent) bone.internal-move) :: @@ -1139,7 +1077,7 @@ =/ =sock [our ship.internal-note] =/ =internal-task internal-task.internal-note [%deal sock internal-task] - [%g task] + [%m task] :: %meta =/ =term term.internal-note @@ -1182,7 +1120,7 @@ ?- -.peek-result %& p.peek-result %| ((slog leaf+"peek bad result" p.peek-result) [~ ~]) - -- + == :: +ap-update-subscription: update subscription. :: ++ ap-update-subscription @@ -1244,7 +1182,7 @@ == =/ incoming (~(get by incoming.subscribers.current-agent) agent-bone) =/ duct (~(get by duct-map.ducts.current-agent) agent-bone) - ~& [%gall-pulling-20 agent-bone incoming duct] + ~& [%mall-pulling-20 agent-bone incoming duct] [%.n ap-core] :: =/ next @@ -1372,7 +1310,7 @@ %+ ap-ingest ~ |. (handle-take:ap-agent-core wire vase) ?^ maybe-tang - (ap-lame ktake u.maybe-tang) + (ap-lame %take u.maybe-tang) ap-core :: +ap-specific-take: specific take. :: @@ -1382,9 +1320,9 @@ :: =^ maybe-tang ap-core %+ ap-ingest ~ |. - (handle-gall:ap-agent-core +.path internal-gift) + (handle-mall:ap-agent-core +.path internal-gift) ?: ?=(%diff -.internal-gift) - (ap-update-subscription =(~ maybe-tang) ship +.path) + (ap-update-subscription =(~ maybe-tang) attributing.agent-routes +.path) ?^ maybe-tang (ap-lame -.internal-gift u.maybe-tang) ap-core @@ -1406,10 +1344,7 @@ [possibly-suss agent-config] :: =/ next - %= ap-core - agent-config new-agent-config - arm-cache.current-agent ~ - == + ap-core(agent-config new-agent-config) :: [maybe-tang next] :: +ap-prep: low-level install. @@ -1459,7 +1394,7 @@ %+ ap-ingest ~ |. (handle-pull:ap-agent-core q.incoming) ?^ maybe-tang - (ap-lame q.arm u.maybe-tang) + (ap-lame %pull u.maybe-tang) ap-core :: +ap-kill: queue kill. :: @@ -1474,15 +1409,14 @@ :: rest of the moves. :: ++ ap-ingest - |= $: ack=?(%coup %reap ~) - result=_^?(|.(each [moves=(list move:agent) new-state=vase] tang)) - == + |= [ack=?(%coup %reap ~) run=_^?(|.(*step:agent))] ^- [(unit tang) _ap-core] - =^ new-moves ap-core (ap-handle-result (mule result)) + =/ result (mule run) + =^ new-moves ap-core (ap-handle-result result) =/ maybe-tang=(unit tang) - ?: =(%& -.peer-result) + ?: ?=(%& -.result) ~ - `p.peer-result + `p.result =/ ack-moves ?- ack ~ ~ @@ -1497,16 +1431,16 @@ :: ++ ap-handle-result ~/ %ap-handle-result - |= result=(each [moves=(list move:agent) new-state=vase] tang) - ^- [(list move:agent) ap-core] + |= result=(each step:agent tang) + ^- [(list move:agent) _ap-core] ?: ?=(%| -.result) - (ap-lame %diff-crash p.result) + `ap-core :: - =/ new-subs (ap-handle-quits moves.p.result) + =/ new-subs (ap-handle-quits -.p.result) :: - :- (flop moves.p.result) - %_ +>.$ - state.current-agent new-state.p.result + :- (flop -.p.result) + %_ ap-core + state.current-agent +.p.result incoming.subscribers.current-agent new-subs == :: +ap-handle-quits: handle cancels of incoming subscriptions @@ -1516,14 +1450,15 @@ |= moves=(list move:agent) ^- bitt =/ quits=(list bone) - %+ murn moves.p.result + %+ murn moves |= =move:agent + ^- (unit bone) ?. ?=([%give %quit *] move.internal-move) ~ - bone.internal-move + `bone.move :: =/ quit-map=bitt - (malt (turn quits |=(=bone [=bone *[ship path]]))) + (malt (turn quits |=(=bone [bone *[ship path]]))) (~(dif by incoming.subscribers.current-agent) quit-map) :: +ap-tang: standard tang. :: @@ -1531,18 +1466,18 @@ |= =tape ^- tang :: - =/ =tank [%leaf (weld "gall: {}: " tape)] + =/ =tank [%leaf (weld "mall: {}: " tape)] [tank ~] -- -- :: +call: request :: ++ call - ~% %gall-call +> ~ + ~% %mall-call +> ~ |= [=duct hic=(hypo (hobo task:able))] - ^- [(list move) _gall-payload] + ^- [(list move) _mall-payload] :: - ~| [%gall-call-failed duct q.hic] + ~| [%mall-call-failed duct q.hic] :: make sure our task is hard :: =/ =task:able @@ -1552,17 +1487,19 @@ :: =/ initialised (mo-abed:mo duct) ?- -.task - %conf + %conf-mall =/ =dock p.task =/ =ship p.dock ?. =(our ship) - ~& [%gall-not-ours ship] - [~ gall-payload] + ~& [%mall-not-ours ship] + [~ mall-payload] :: + ~& [%mall-ours ship] => (mo-boot:initialised q.dock q.task) + ~& [%mall-initialized ship] mo-abet :: - %deal + ?(%deal %deal-mall) =/ =sock p.task =/ =internal-task q.task ?. =(q.sock our) @@ -1574,11 +1511,11 @@ mo-abet :: %init - =/ payload gall-payload(system-duct.agents.state duct) + =/ payload mall-payload(system-duct.agents.state duct) [~ payload] :: %vega - [~ gall-payload] + [~ mall-payload] :: %west =/ =ship p.task @@ -1602,7 +1539,7 @@ %- ~(run by running.agents.state) |= =running-agent running-agent(cache *worm) - [~ gall-payload] + [~ mall-payload] :: %wegh =/ blocked @@ -1610,11 +1547,11 @@ (sort ~(tap by queued) aor) :: =/ running - =/ active (~(run by running.agents.state) |=(agent [%.y +<])) + =/ active (~(run by running.agents.state) |=(running-agent [%.y +<])) (sort ~(tap by active) aor) :: =/ =mass - :+ %gall %.n + :+ %mall %.n :~ [%foreign %.y contacts.agents.state] [%blocked %.n blocked] [%active %.n running] @@ -1625,21 +1562,21 @@ =/ =move [duct %give %mass mass] [move ~] :: - [moves gall-payload] + [moves mall-payload] == :: +load: recreate vane :: ++ load |= =state-old - ^+ gall-payload + ^+ mall-payload :: ?- -.state-old - %0 gall-payload(state state-old) + %0 mall-payload :: (state state-old) == :: +scry: standard scry :: ++ scry - ~/ %gall-scry + ~/ %mall-scry |= [fur=(unit (set monk)) =term =shop =desk =coin =path] ^- (unit (unit cage)) ?. ?=(%.y -.shop) @@ -1676,11 +1613,11 @@ :: +take: response :: ++ take - ~/ %gall-take + ~/ %mall-take |= [=wire =duct hin=(hypo sign-arvo)] - ^- [(list move) _gall-payload] + ^- [(list move) _mall-payload] :: - ~| [%gall-take-failed wire] + ~| [%mall-take-failed wire] ?> ?=([?(%sys %use) *] wire) =/ initialised (mo-abed:mo duct) =/ =sign-arvo q.hin diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 67243721b..bdfd3ba4c 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -1849,6 +1849,141 @@ ~ -- :: :::: +:::: ++mall :: (1g) extensions + :: :::: +++ mall ^? + |% + :: :: + :::: ++able:mall :: (1g1) arvo moves + :: :::: + ++ able ^? + |% + ++ gift :: outgoing result + $% {$mass p/mass} :: memory usage + {$onto p/(each suss tang)} :: about agent + {$rend p/path q/*} :: network request + {$unto p/internal-gift} :: + {$mack p/(unit tang)} :: message ack + == :: + ++ task :: incoming request + $~ [%vega ~] :: + $% {$conf-mall p/dock q/dock} :: configure app + $>(%init vane-task) :: set owner + {$deal p/sock q/internal-task} :: full transmission + {$deal-mall p/sock q/internal-task} :: full transmission + $>(%vega vane-task) :: report upgrade + $>(%west vane-task) :: network request + [%wash ~] :: clear caches + $>(%wegh vane-task) :: report memory + == :: + -- ::able + ++ bitt (map bone (pair ship path)) :: incoming subs + ++ boat :: outgoing subs + %+ map (pair bone wire) :: + (trel bean ship path) :: + ++ bowl :: standard app state + $: $: our/ship :: host + src/ship :: guest + dap/term :: agent + == :: + $: wex/boat :: outgoing subs + sup/bitt :: incoming subs + == :: + $: ost/bone :: opaque cause + act/@ud :: change number + eny/@uvJ :: entropy + now/@da :: current time + byk/beak :: load source + == == :: + ++ agent-action :: agent action + $% {$peel p/mark q/path} :: translated peer + {$peer p/path} :: subscribe + {$poke p/cage} :: apply + {$puff p/mark q/noun} :: unchecked poke + {$pull ~} :: unsubscribe + {$punk p/mark q/cage} :: translated poke + {$pump ~} :: pump yes+no + {$peer-not p/tang} :: poison pill peer + == :: + ++ internal-gift :: + $% {$coup p/(unit tang)} :: poke result + {$diff p/cage} :: subscription output + {$quit ~} :: close subscription + {$reap p/(unit tang)} :: peer result + [%http-response =http-event:http] :: serve http result + == :: + ++ internal-task (pair term agent-action) :: internal task + ++ dude term :: server identity + ++ gill (pair ship term) :: general contact + ++ scar :: opaque duct + $: p/@ud :: bone sequence + q/(map duct bone) :: by duct + r/(map bone duct) :: by bone + == :: + ++ suss (trel dude @tas @da) :: config report + ++ well (pair desk term) :: + :: + :: +internal-note: +ap note + :: + ++ internal-note + $% [%meta =term =vase] + [%send =ship =internal-task] + == + :: +internal-move: agent-level move + :: + :: Analogous to an Arvo move, except these are routed by bone, instead of + :: duct. + :: + ++ internal-move + $: =bone + move=(wind internal-note internal-gift) + == + :: +agent: app core + :: + ++ agent + => |% + +$ move internal-move + +$ step (quip move new-state=vase) + -- + $_ ^| + |_ [bowl state=vase] + ++ handle-init + *step + :: + ++ handle-prep + |~ old-state=vase + *step + :: + ++ handle-poke + |~ in-poke-data=cage + *step + :: + ++ handle-peer + |~ path + *step + :: + ++ handle-pull + |~ path + *step + :: + ++ handle-peek + |~ path + *(unit (unit cage)) + :: + ++ handle-mall + |~ [wire internal-gift] + *step + :: + ++ handle-take + |~ [wire sign=vase] + *step + :: + ++ handle-lame + |~ [term tang] + *step + -- + -- ::mall +:: :::: :::: ++gall :: (1g) extensions :: :::: ++ gall ^? @@ -7433,6 +7568,7 @@ [%e task:able:eyre] {$f task:able:ford} {$g task:able:gall} + {$m task:able:mall} [%i task:able:iris] {$j task:able:jael} {@tas $meta vase} @@ -7449,6 +7585,7 @@ {$f gift:able:ford} [%e gift:able:eyre] {$g gift:able:gall} + {$m gift:able:mall} [%i gift:able:iris] {$j gift:able:jael} == From f52e60bb09e903d0fd198083f90cc3f9f09e8499 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 4 Sep 2019 14:20:47 -0700 Subject: [PATCH 130/451] mall: use +stay instead of explicit state --- bin/solid.pill | 4 +- pkg/arvo/age/first.hoon | 57 +++++++++++++------------ pkg/arvo/sys/vane/mall.hoon | 12 ++---- pkg/arvo/sys/zuse.hoon | 85 ++++++++++++++++++++----------------- 4 files changed, 82 insertions(+), 76 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 5c736b369..dd8f62e38 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:48eb6f561c22b0bd4828bd1f1690fb4f54fc9c092a6c2f48f2a995af53188d02 -size 16851284 +oid sha256:89e9469aa6e5d9da7cfb62aeed0424c7f2ba0364b8fb7a84b1366219406038d0 +size 16997852 diff --git a/pkg/arvo/age/first.hoon b/pkg/arvo/age/first.hoon index 53c15b125..6a4cd51fe 100644 --- a/pkg/arvo/age/first.hoon +++ b/pkg/arvo/age/first.hoon @@ -1,45 +1,50 @@ -/+ agent -|% -+$ in-poke-data %hoy -++ agent (^agent ,~ in-poke-data ,*) --- -%- agent-to-mall-agent:agent -^- agent:agent -|_ [bowl:mall state=~] +^- agent:mall +=| state=@ +|_ bowl:mall ++ handle-init - `~ + `..handle-init :: ++ handle-prep - |~ old-state=vase - *step:agent:agent + |= =old-state=vase + =/ old-state !<(@ old-state-vase) + ?~ old-state + ~& %prep-lost + `..handle-init + ~& %prep-found + `..handle-init(state u.old-state) :: ++ handle-poke - |= =a=in-poke-data - ~& >> 'ouchers!' - ~& >>> a-in-poke-data - *step:agent:agent + |= in-poke-data=cage + ~& >> 'ouchies!' + ~& >>> in-poke-data + ~& > state=state + =. state +(state) + `..handle-init :: ++ handle-peer - |~ path - *step:agent:agent + |= path + `..handle-init :: ++ handle-pull - |~ path - *step:agent:agent + |= path + `..handle-init :: ++ handle-peek - |~ path + |= path *(unit (unit cage)) :: ++ handle-mall - |~ [wire internal-gift:mall] - *step:agent:agent + |= [wire internal-gift:mall] + `..handle-init :: ++ handle-take - |~ [wire *] - *step:agent:agent + |= [wire vase] + `..handle-init :: ++ handle-lame - |~ [term tang] - *step:agent:agent + |= [term tang] + `..handle-init +:: +++ handle-stay + !>(state) -- diff --git a/pkg/arvo/sys/vane/mall.hoon b/pkg/arvo/sys/vane/mall.hoon index f5a41061a..84c69dba6 100644 --- a/pkg/arvo/sys/vane/mall.hoon +++ b/pkg/arvo/sys/vane/mall.hoon @@ -156,9 +156,6 @@ :: agent core :: =agent - :: running state - :: - state=vase :: update control :: =beak @@ -348,7 +345,6 @@ control-duct hen beak beak agent agent - state !>(~) ducts ducts == :: @@ -1090,7 +1086,7 @@ :: +ap-agent-core: agent core with current bowl and state :: ++ ap-agent-core - ~(. agent.current-agent ap-construct-bowl state.current-agent) + ~(. agent.current-agent ap-construct-bowl) :: +ap-apply: apply effect. :: ++ ap-apply @@ -1244,8 +1240,8 @@ :: =/ prep =/ =agent u.maybe-agent + =/ running (some ~(handle-stay agent.current-agent ap-construct-bowl)) =/ installed ap-install(agent.current-agent agent) - =/ running (some state.current-agent) (installed running) :: =^ maybe-tang ap-core prep @@ -1440,7 +1436,7 @@ :: :- (flop -.p.result) %_ ap-core - state.current-agent +.p.result + agent.current-agent +.p.result incoming.subscribers.current-agent new-subs == :: +ap-handle-quits: handle cancels of incoming subscriptions @@ -1571,7 +1567,7 @@ ^+ mall-payload :: ?- -.state-old - %0 mall-payload :: (state state-old) + %0 mall-payload(state state-old) == :: +scry: standard scry :: diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index bdfd3ba4c..63c547150 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -1941,46 +1941,51 @@ :: +agent: app core :: ++ agent - => |% - +$ move internal-move - +$ step (quip move new-state=vase) - -- - $_ ^| - |_ [bowl state=vase] - ++ handle-init - *step - :: - ++ handle-prep - |~ old-state=vase - *step - :: - ++ handle-poke - |~ in-poke-data=cage - *step - :: - ++ handle-peer - |~ path - *step - :: - ++ handle-pull - |~ path - *step - :: - ++ handle-peek - |~ path - *(unit (unit cage)) - :: - ++ handle-mall - |~ [wire internal-gift] - *step - :: - ++ handle-take - |~ [wire sign=vase] - *step - :: - ++ handle-lame - |~ [term tang] - *step + =< form + |% + +$ move internal-move + +$ step (quip move form) + ++ form + $_ ^| + |_ bowl + ++ handle-init + *(quip move _^|(..handle-init)) + :: + ++ handle-prep + |~ old-state=vase + *(quip move _^|(..handle-init)) + :: + ++ handle-poke + |~ in-poke-data=cage + *(quip move _^|(..handle-init)) + :: + ++ handle-peer + |~ path + *(quip move _^|(..handle-init)) + :: + ++ handle-pull + |~ path + *(quip move _^|(..handle-init)) + :: + ++ handle-peek + |~ path + *(unit (unit cage)) + :: + ++ handle-mall + |~ [wire internal-gift] + *(quip move _^|(..handle-init)) + :: + ++ handle-take + |~ [wire sign=vase] + *(quip move _^|(..handle-init)) + :: + ++ handle-lame + |~ [term tang] + *(quip move _^|(..handle-init)) + :: + ++ handle-stay + *vase + -- -- -- ::mall :: :::: From 274e8aad906dc7977c25684bc5002777464a1ede Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 4 Sep 2019 15:44:22 -0700 Subject: [PATCH 131/451] mall: hood framework --- pkg/arvo/age/hood.hoon | 175 ++++++++++++++++++++++++++++++++++++ pkg/arvo/app/cop.hoon | 4 +- pkg/arvo/lib/hood/helm.hoon | 14 ++- 3 files changed, 189 insertions(+), 4 deletions(-) create mode 100644 pkg/arvo/age/hood.hoon diff --git a/pkg/arvo/age/hood.hoon b/pkg/arvo/age/hood.hoon new file mode 100644 index 000000000..cd9ef14c4 --- /dev/null +++ b/pkg/arvo/age/hood.hoon @@ -0,0 +1,175 @@ +:: :: :: +:::: /hoon/hood/app :: :: + :: :: :: +/? 310 :: zuse version +/+ sole, :: libraries + :: XX these should really be separate apps, as + :: none of them interact with each other in + :: any fashion; however, to reduce boot-time + :: complexity and work around the current + :: non-functionality of end-to-end acknowledgments, + :: they have been bundled into :hood + :: + :: |command handlers + hood-helm, hood-kiln, hood-drum, hood-write +:: :: :: +:::: :: :: + :: :: :: +|% +++ hood-module + :: each hood module follows this general shape + => |% + +$ part [%module %0 pith] + +$ pith ~ + :: + +$ move [bone card] + +$ card $% [%fake ~] + == + -- + |= [bowl:gall own=part] + |_ moz=(list move) + ++ abet [(flop moz) own] + -- +-- +:: :: :: +:::: :: :: state handling + :: :: :: +!: +=> |% :: + ++ hood-old :: unified old-state + {?($0 $1) lac/(map @tas hood-part-old)} :: + ++ hood-1 :: unified state + {$1 lac/(map @tas hood-part)} :: + ++ hood-good :: extract specific + =+ hed=$:hood-head + |@ ++ $ + |: paw=$:hood-part + ?- hed + $drum ?>(?=($drum -.paw) `part:hood-drum`paw) + $helm ?>(?=($helm -.paw) `part:hood-helm`paw) + $kiln ?>(?=($kiln -.paw) `part:hood-kiln`paw) + $write ?>(?=($write -.paw) `part:hood-write`paw) + == + -- + ++ hood-head _-:$:hood-part :: initialize state + ++ hood-make :: + =+ $:{our/@p hed/hood-head} :: + |@ ++ $ + ?- hed + $drum (make:hood-drum our) + $helm *part:hood-helm + $kiln *part:hood-kiln + $write *part:hood-write + == + -- + ++ hood-part-old hood-part :: old state for ++prep + ++ hood-port :: state transition + |: paw=$:hood-part-old ^- hood-part :: + paw :: + :: :: + ++ hood-part :: current module state + $% {$drum $2 pith-2:hood-drum} :: + {$helm $0 pith:hood-helm} :: + {$kiln $0 pith:hood-kiln} :: + {$write $0 pith:hood-write} :: + == :: + -- :: +:: :: :: +:::: :: :: app proper + :: :: :: +^- agent:mall +=| hood-1 :: module states +=> |% + ++ able :: find+make part + |= hid=bowl:mall + =+ hed=$:hood-head + |@ ++ $ + =+ rep=(~(get by lac) hed) + =+ par=?^(rep u.rep `hood-part`(hood-make our.hid hed)) + ((hood-good hed) par) + -- + :: + ++ ably :: save part + =+ $:{(list) hood-part} + |@ ++ $ + [(flop +<-) (~(put by lac) +<+< +<+)] + -- + :: :: :: + :::: :: :: generic handling + :: :: :: + ++ prep + |= old/(unit hood-old) ^- (quip _!! _+>) + :- ~ + ?~ old +> + +>(lac (~(run by lac.u.old) hood-port)) + :: + :: ++ poke-hood-load :: recover lost brain + :: |= dat/hood-part + :: ?> =(our.hid src.hid) + :: ~& loaded+-.dat + :: [~ %_(+> lac (~(put by lac) -.dat dat))] + :: + :: + ++ from-module :: create wrapper + |* _[identity=%module start=..$ finish=_abet]:(hood-module) + |= hid=bowl:mall + =- [wrap=- *start] :: usage (wrap handle-arm):from-foo + |* handle/_finish + |= a=_+<.handle + =. +>.handle (start hid ((able hid) identity)) + (ably (handle a)) + :: per-module interface wrappers + ++ from-drum (from-module %drum [..$ _se-abet]:(hood-drum)) + ++ from-helm (from-module %helm [..$ _abet]:(hood-helm)) + ++ from-kiln (from-module %kiln [..$ _abet]:(hood-kiln)) + ++ from-write (from-module %write [..$ _abet]:(hood-write)) + -- +|_ hid/bowl:mall :: gall environment +++ handle-init + `..handle-init +:: +++ handle-prep + |= =old-state=vase + =/ old-state !<(hood-1 old-state-vase) + ?~ old-state + ~& %prep-lost + `..handle-init + ~& %prep-found + `..handle-init(lac lac.u.old-state) +:: +++ handle-poke + |= [=mark =vase] + ^- (quip move:agent:mall agent:mall) + =^ moves lac + ?+ mark ~|([%poke-hood-bad-mark mark] !!) + %atom ((wrap poke-atom):(from-helm hid) (need !<(@ vase))) + == + [moves ..handle-init] +:: +++ handle-peer + |= path + `..handle-init +:: +++ handle-pull + |= path + `..handle-init +:: +++ handle-peek + |= path + *(unit (unit cage)) +:: +++ handle-mall + |= [wire internal-gift:mall] + `..handle-init +:: +++ handle-take + |= [wire vase] + `..handle-init +:: +++ handle-lame + |= [term tang] + `..handle-init +:: +++ handle-stay + !>([%1 lac]) +-- diff --git a/pkg/arvo/app/cop.hoon b/pkg/arvo/app/cop.hoon index ada8e4c92..1a46d5e63 100644 --- a/pkg/arvo/app/cop.hoon +++ b/pkg/arvo/app/cop.hoon @@ -12,8 +12,8 @@ ^- (quip move _this) :_ this :_ ~ ?+ arg ~|(%bad-arg !!) - %conf `move`[ost.bowl %conf-mall / [our.bowl %first] [our.bowl %home]] - %poke `move`[ost.bowl %deal-mall / [our.bowl our.bowl] %first %poke %noun !>(%hey)] + %conf `move`[ost.bowl %conf-mall / [our.bowl %hood] [our.bowl %home]] + %poke `move`[ost.bowl %deal-mall / [our.bowl our.bowl] %hood %poke %atom !>(%hey)] == :: ++ onto diff --git a/pkg/arvo/lib/hood/helm.hoon b/pkg/arvo/lib/hood/helm.hoon index e02c3d9ff..50ec68c8a 100644 --- a/pkg/arvo/lib/hood/helm.hoon +++ b/pkg/arvo/lib/hood/helm.hoon @@ -57,11 +57,19 @@ == :: -- =+ moz=((list move)) +=| moi=(list move:agent:mall) |% ++ abet :: resolve [(flop moz) %_(+<+.$ hoc (~(put by hoc) ost sez))] :: +++ abei + [(flop moi) %_(+<+.$ hoc (~(put by hoc) ost sez))] +:: ++ emit |=(card %_(+> moz [[ost +<] moz])) :: return card +++ emii + |= (wind internal-note:mall internal-gift:mall) + %_(+> moi [[ost +<] moi]) +:: ++ emil :: return cards |= (list card) ^+ +> @@ -144,8 +152,10 @@ |= ato/@ =+ len=(scow %ud (met 3 ato)) =+ gum=(scow %p (mug ato)) - =< abet - (emit %flog /di %text "< {}: atom: {len} bytes, mug {gum}") + =< abei + %^ emii %pass /di + :+ %meta %d + !> [%flog %text "< {}: atom: {len} bytes, mug {gum}"] :: ++ coup-hi |= {pax/path cop/(unit tang)} =< abet From 84c7b442e9b562ccb4ff61e7b1791ce383a39696 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 5 Sep 2019 18:18:31 -0700 Subject: [PATCH 132/451] mall: convert helm to mall --- pkg/arvo/age/hood.hoon | 79 ++++++++--- pkg/arvo/app/cop.hoon | 5 +- pkg/arvo/app/hood.hoon | 1 - pkg/arvo/lib/hood/helm-mall.hoon | 225 +++++++++++++++++++++++++++++++ pkg/arvo/lib/hood/helm.hoon | 14 +- pkg/arvo/sys/vane/mall.hoon | 57 +++----- 6 files changed, 313 insertions(+), 68 deletions(-) create mode 100644 pkg/arvo/lib/hood/helm-mall.hoon diff --git a/pkg/arvo/age/hood.hoon b/pkg/arvo/age/hood.hoon index cd9ef14c4..69a0c2527 100644 --- a/pkg/arvo/age/hood.hoon +++ b/pkg/arvo/age/hood.hoon @@ -11,7 +11,7 @@ :: they have been bundled into :hood :: :: |command handlers - hood-helm, hood-kiln, hood-drum, hood-write + hood-helm-mall, hood-kiln, hood-drum, hood-write :: :: :: :::: :: :: :: :: :: @@ -46,7 +46,7 @@ |: paw=$:hood-part ?- hed $drum ?>(?=($drum -.paw) `part:hood-drum`paw) - $helm ?>(?=($helm -.paw) `part:hood-helm`paw) + $helm ?>(?=($helm -.paw) `part:hood-helm-mall`paw) $kiln ?>(?=($kiln -.paw) `part:hood-kiln`paw) $write ?>(?=($write -.paw) `part:hood-write`paw) == @@ -57,7 +57,7 @@ |@ ++ $ ?- hed $drum (make:hood-drum our) - $helm *part:hood-helm + $helm *part:hood-helm-mall $kiln *part:hood-kiln $write *part:hood-write == @@ -69,7 +69,7 @@ :: :: ++ hood-part :: current module state $% {$drum $2 pith-2:hood-drum} :: - {$helm $0 pith:hood-helm} :: + {$helm $0 pith:hood-helm-mall} :: {$kiln $0 pith:hood-kiln} :: {$write $0 pith:hood-write} :: == :: @@ -79,7 +79,9 @@ :: :: :: ^- agent:mall =| hood-1 :: module states -=> |% +=/ help + |= hid/bowl:mall + |% ++ able :: find+make part |= hid=bowl:mall =+ hed=$:hood-head @@ -103,16 +105,15 @@ ?~ old +> +>(lac (~(run by lac.u.old) hood-port)) :: - :: ++ poke-hood-load :: recover lost brain - :: |= dat/hood-part - :: ?> =(our.hid src.hid) - :: ~& loaded+-.dat - :: [~ %_(+> lac (~(put by lac) -.dat dat))] + ++ poke-hood-load :: recover lost brain + |= dat/hood-part + ?> =(our.hid src.hid) + ~& loaded+-.dat + [~ (~(put by lac) -.dat dat)] :: :: ++ from-module :: create wrapper |* _[identity=%module start=..$ finish=_abet]:(hood-module) - |= hid=bowl:mall =- [wrap=- *start] :: usage (wrap handle-arm):from-foo |* handle/_finish |= a=_+<.handle @@ -120,7 +121,7 @@ (ably (handle a)) :: per-module interface wrappers ++ from-drum (from-module %drum [..$ _se-abet]:(hood-drum)) - ++ from-helm (from-module %helm [..$ _abet]:(hood-helm)) + ++ from-helm (from-module %helm [..$ _abet]:(hood-helm-mall)) ++ from-kiln (from-module %kiln [..$ _abet]:(hood-kiln)) ++ from-write (from-module %write [..$ _abet]:(hood-write)) -- @@ -140,9 +141,41 @@ ++ handle-poke |= [=mark =vase] ^- (quip move:agent:mall agent:mall) + =/ h (help hid) =^ moves lac ?+ mark ~|([%poke-hood-bad-mark mark] !!) - %atom ((wrap poke-atom):(from-helm hid) (need !<(@ vase))) + %hood-load %- poke-hood-load:h + (need !<(hood-part vase)) + %atom %- (wrap poke-atom):from-helm:h + (need !<(@ vase)) + %helm-hi %- (wrap poke-hi):from-helm:h + (need !<(@t vase)) + %helm-mass %- (wrap poke-mass):from-helm:h + (need !<(~ vase)) + %helm-reload %- (wrap poke-reload):from-helm:h + (need !<((list term) vase)) + %helm-reload-desk %- (wrap poke-reload-desk):from-helm:h + (need !<([@t (list term)] vase)) + %helm-reset %- (wrap poke-reset):from-helm:h + (need !<(~ vase)) + %helm-serve %- (wrap poke-serve):from-helm:h + (need !<([=binding:eyre =generator:eyre] vase)) + %helm-send-hi %- (wrap poke-send-hi):from-helm:h + (need !<([ship (unit tape)] vase)) + %helm-verb %- (wrap poke-verb):from-helm:h + (need !<(~ vase)) + %helm-rekey %- (wrap poke-rekey):from-helm:h + (need !<(@t vase)) + %helm-moon %- (wrap poke-moon):from-helm:h + (need !<((unit [ship udiff:point:able:jael]) vase)) + %helm-nuke %- (wrap poke-nuke):from-helm:h + (need !<(ship vase)) + %helm-automass %- (wrap poke-automass):from-helm:h + (need !<(@dr vase)) + %helm-cancel-automass %- (wrap poke-cancel-automass):from-helm:h + (need !<(~ vase)) + %helm-bonk %- (wrap poke-bonk):from-helm:h + (need !<(~ vase)) == [moves ..handle-init] :: @@ -159,12 +192,24 @@ *(unit (unit cage)) :: ++ handle-mall - |= [wire internal-gift:mall] - `..handle-init + |= [=wire =internal-gift:mall] + ~& [%handling-mall wire] + =/ h (help hid) + =^ moves lac + ?+ wire ~|([%hood-bad-wire wire] !!) + [%helm %hi *] %+ (wrap coup-hi):from-helm:h t.t.wire + ?>(?=(%coup -.internal-gift) p.internal-gift) + == + [moves ..handle-init] :: ++ handle-take - |= [wire vase] - `..handle-init + |= [=wire =vase] + =/ h (help hid) + =^ moves lac + ?+ wire ~|([%hood-bad-wire wire] !!) + [%helm *] ((wrap take):from-helm:h t.wire vase) + == + [moves ..handle-init] :: ++ handle-lame |= [term tang] diff --git a/pkg/arvo/app/cop.hoon b/pkg/arvo/app/cop.hoon index 1a46d5e63..d64bbfa69 100644 --- a/pkg/arvo/app/cop.hoon +++ b/pkg/arvo/app/cop.hoon @@ -12,8 +12,9 @@ ^- (quip move _this) :_ this :_ ~ ?+ arg ~|(%bad-arg !!) - %conf `move`[ost.bowl %conf-mall / [our.bowl %hood] [our.bowl %home]] - %poke `move`[ost.bowl %deal-mall / [our.bowl our.bowl] %hood %poke %atom !>(%hey)] + %conf [ost.bowl %conf-mall / [our.bowl %hood] [our.bowl %home]] + %poke [ost.bowl %deal-mall / [our.bowl our.bowl] %hood %poke %atom !>(%hey)] + %hi [ost.bowl %deal-mall / [our.bowl our.bowl] %hood %poke %helm-send-hi !>([our.bowl `"heyza"])] == :: ++ onto diff --git a/pkg/arvo/app/hood.hoon b/pkg/arvo/app/hood.hoon index 83648971a..356d20838 100644 --- a/pkg/arvo/app/hood.hoon +++ b/pkg/arvo/app/hood.hoon @@ -200,6 +200,5 @@ ++ writ-kiln-autoload (wrap take-writ-autoload):from-kiln ++ writ-kiln-find-ship (wrap take-writ-find-ship):from-kiln ++ writ-kiln-sync (wrap take-writ-sync):from-kiln - ++ bound (wrap take-bound):from-helm -- diff --git a/pkg/arvo/lib/hood/helm-mall.hoon b/pkg/arvo/lib/hood/helm-mall.hoon new file mode 100644 index 000000000..4dbe28137 --- /dev/null +++ b/pkg/arvo/lib/hood/helm-mall.hoon @@ -0,0 +1,225 @@ +:: :: :: +:::: /hoon/helm/hood/lib :: :: + :: :: :: +/? 310 :: version +/- sole, hall +/+ pill +:: :: :: +:::: :: :: + :: :: :: +|% :: :: +++ part {$helm $0 pith} :: helm state +++ pith :: helm content + $: hoc/(map bone session) :: consoles + == :: +++ session :: + $: say/sole-share:sole :: console state + mud/(unit (sole-dialog:sole @ud)) :: console dialog + mass-timer/{way/wire nex/@da tim/@dr} + == :: +:: :: :: +:::: :: :: + :: :: :: +++ hood-nuke :: block/unblock + $: him/ship :: + == :: +++ hood-reset :: reset command + $~ :: +++ helm-verb :: reset command + $~ :: +++ hood-reload :: reload command + (list term) :: +-- :: +:: :: :: +:::: :: :: + :: :: :: +|: $:{bowl:gall part} :: main helm work +=+ sez=(~(gut by hoc) ost $:session) +=> |% :: arvo structures + ++ card :: + $% [%bonk wire ~] :: + {$flog wire flog:dill} :: + {$nuke wire ship} :: + [%serve wire binding:eyre generator:eyre] :: + {$poke wire dock pear} :: + {$rest wire @da} :: + {$wait wire @da} :: + {$rekey wire life ring} :: + {$moon wire ship udiff:point:able:jael} :: + == :: + ++ move (pair bone card) :: user-level move + ++ pear :: poke fruit + $% {$hood-unsync desk ship desk} :: + {$helm-hi cord} :: + {$drum-start well:gall} :: + {$hall-action action:hall} :: + == :: + -- +=| moz=(list move:agent:mall) +|% +++ abet + [(flop moz) %_(+<+.$ hoc (~(put by hoc) ost sez))] +:: +++ emit + |= (wind internal-note:mall internal-gift:mall) + %_(+> moz [[ost +<] moz]) +:: +++ flog + |= =flog:dill + (emit %pass /di %meta %d !>([%flog flog])) +:: +++ emil :: return cards + |= (list (wind internal-note:mall internal-gift:mall)) + ^+ +> + ?~(+< +> $(+< t.+<, +> (emit i.+<))) +:: +++ poke-rekey :: rotate private keys + |= des=@t + =/ sed=(unit seed:able:jael) + %+ biff + (bind (slaw %uw des) cue) + (soft seed:able:jael) + =< abet + ?~ sed + ~& %invalid-private-key + +>.$ + ?. =(our who.u.sed) + ~& [%wrong-private-key-ship who.u.sed] + +>.$ + (emit %pass / %meta %j !>([%rekey lyf.u.sed key.u.sed])) +:: +++ poke-moon :: rotate moon keys + |= sed=(unit [=ship =udiff:point:able:jael]) + =< abet + ?~ sed + +>.$ + (emit %pass / %meta %j !>([%moon u.sed])) +:: +++ poke-nuke :: initialize + |= him/ship =< abet + (emit %pass /helm %meta %j !>([%nuke him])) +:: +++ poke-mass + |= ~ =< abet + (flog %crud %hax-heft ~) +:: +++ poke-automass + |= recur=@dr + =. mass-timer.sez + [/helm/automass (add now recur) recur] + abet:(emit %pass way.mass-timer.sez %meta %b !>([%wait nex.mass-timer.sez])) +:: +++ poke-cancel-automass + |= ~ + abet:(emit %pass way.mass-timer.sez %meta %b !>([%rest nex.mass-timer.sez])) +:: +++ poke-bonk + |= ~ + ~& .^((unit @da) %a /(scot %p our)/time/(scot %da now)/(scot %p our)) + %- %- slog :_ ~ .^(tank %b /(scot %p our)/timers/(scot %da now)) + abet:(emit %pass /bonk %meta %a !>([%bonk ~])) +:: +++ take-wake-automass + |= [way=wire error=(unit tang)] + ?^ error + %- (slog u.error) + ~& %helm-wake-automass-fail + abet + =. nex.mass-timer.sez (add now tim.mass-timer.sez) + =< abet + %- emil + :~ [%pass /heft %meta %d !>([%flog %crud %hax-heft ~])] + [%pass way.mass-timer.sez %meta %b !>([%wait nex.mass-timer.sez])] + == +:: +++ poke-send-hi + |= {her/ship mes/(unit tape)} =< abet + %- emit + :* %pass /helm/hi/(scot %p her) + %send her %hood %poke + %helm-hi !>(?~(mes '' (crip u.mes))) + == +:: +:: +++ poke-hi + |= mes/@t + ~| %poke-hi-fail + ?: =(%fail mes) + ~& %poke-hi-fail + !! + abet:(flog %text "< {}: {(trip mes)}") +:: +++ poke-atom + |= ato/@ + =+ len=(scow %ud (met 3 ato)) + =+ gum=(scow %p (mug ato)) + =< abet + (flog %text "< {}: atom: {len} bytes, mug {gum}") +:: +++ coup-hi + |= {pax/path cop/(unit tang)} =< abet + ?> ?=({@t ~} pax) + (flog %text "hi {(trip i.pax)} {?~(cop "" "un")}successful") +:: +++ poke-reload |=(all/(list term) (poke-reload-desk %home all)) +++ poke-reload-desk :: reload vanes + |: $:{syd/desk all/(list term)} =< abet + %- emil + %- flop + %+ turn all + =+ top=`path`/(scot %p our)/[syd]/(scot %da now) + =/ van/(list {term ~}) + :- zus=[%zuse ~] + ~(tap by dir:.^(arch %cy (welp top /sys/vane))) + |= nam/@tas + =. nam + ?. =(1 (met 3 nam)) + nam + =+ ^- zaz/(list {p/knot ~}) + (skim van |=({a/term ~} =(nam (end 3 1 a)))) + ?> ?=({{@ ~} ~} zaz) + `term`p.i.zaz + =+ tip=(end 3 1 nam) + =+ zus==('z' tip) + =+ way=?:(zus (welp top /sys/[nam]) (welp top /sys/vane/[nam])) + =+ fil=.^(@ %cx (welp way /hoon)) + [%pass /reload %meta %d !>([%flog %veer ?:(=('z' tip) %$ tip) way fil])] +:: +poke-reset: send %lyra to initiate kernel upgrade +:: +:: And reinstall %zuse and the vanes with %veer. +:: Trigger with |reset. +:: +++ poke-reset + |= hood-reset + =< abet + %- emil %- flop + ^- (list (wind internal-note:mall internal-gift:mall)) + =/ top=path /(scot %p our)/home/(scot %da now)/sys + =/ hun .^(@ %cx (welp top /hoon/hoon)) + =/ arv .^(@ %cx (welp top /arvo/hoon)) + :- [%pass /reset %meta %d !>([%flog %lyra `@t`hun `@t`arv])] + %+ turn + (module-ova:pill top) + |=([=wire =flog:dill] [%pass wire %meta %d !>([%flog flog])]) +:: +++ poke-verb :: toggle verbose + |= ~ =< abet + (flog %verb ~) +:: +++ poke-serve + |= [=binding:eyre =generator:eyre] =< abet + (emit %pass /helm/serv %meta %e !>([%serve binding generator])) +:: +++ take-bound + |= [wir=wire success=? binding=binding:eyre] =< abet + (flog %text "bound: {}") +:: +++ take + |= [=wire =vase] + ?+ wire ~|([%helm-bad-take-wire wire] !!) + [%automass *] %+ take-wake-automass t.wire + +:(need !<([%wake (unit tang)] vase)) + [%serv *] %+ take-bound t.wire + +:(need !<([%bound ? binding:eyre] vase)) + == +-- diff --git a/pkg/arvo/lib/hood/helm.hoon b/pkg/arvo/lib/hood/helm.hoon index 50ec68c8a..e02c3d9ff 100644 --- a/pkg/arvo/lib/hood/helm.hoon +++ b/pkg/arvo/lib/hood/helm.hoon @@ -57,19 +57,11 @@ == :: -- =+ moz=((list move)) -=| moi=(list move:agent:mall) |% ++ abet :: resolve [(flop moz) %_(+<+.$ hoc (~(put by hoc) ost sez))] :: -++ abei - [(flop moi) %_(+<+.$ hoc (~(put by hoc) ost sez))] -:: ++ emit |=(card %_(+> moz [[ost +<] moz])) :: return card -++ emii - |= (wind internal-note:mall internal-gift:mall) - %_(+> moi [[ost +<] moi]) -:: ++ emil :: return cards |= (list card) ^+ +> @@ -152,10 +144,8 @@ |= ato/@ =+ len=(scow %ud (met 3 ato)) =+ gum=(scow %p (mug ato)) - =< abei - %^ emii %pass /di - :+ %meta %d - !> [%flog %text "< {}: atom: {len} bytes, mug {gum}"] + =< abet + (emit %flog /di %text "< {}: atom: {len} bytes, mug {gum}") :: ++ coup-hi |= {pax/path cop/(unit tang)} =< abet diff --git a/pkg/arvo/sys/vane/mall.hoon b/pkg/arvo/sys/vane/mall.hoon index 84c69dba6..9bfc05c03 100644 --- a/pkg/arvo/sys/vane/mall.hoon +++ b/pkg/arvo/sys/vane/mall.hoon @@ -6,13 +6,6 @@ =, mall => =~ |% -:: +coke: cook -:: -++ coke - $? %inn - %out - %cay - == :: +reverse-ames: reverse ames message :: ++ reverse-ames @@ -706,7 +699,7 @@ |= [=path hin=(hypo sign-arvo)] ^+ mo-core :: - ?. ?=([@ @ coke *] path) + ?. ?=([@ @ *] path) ~& [%mo-handle-use-bad-path path] !! :: @@ -717,27 +710,16 @@ (ap-abed:ap term routes) :: =/ =sign-arvo q.hin - ?- i.t.t.path - %inn + ?. ?=([%m %unto *] sign-arvo) =/ =vase (slot 3 hin) - =. app (ap-generic-take:app t.t.t.path vase) + ~& [%handling-use path] + =. app (ap-generic-take:app t.t.path vase) ap-abet:app - :: - %cay - ~& [%mo-handle-use-weird sign-arvo] - ~& [%mo-handle-use-weird-path path] - mo-core - :: - %out - ?. ?=([%m %unto *] sign-arvo) - ~& [%mo-handle-use-weird sign-arvo] - ~& [%mo-handle-use-weird-path path] - mo-core - =. app - =/ =internal-gift +>.sign-arvo - (ap-specific-take:app t.t.t.path internal-gift) - ap-abet:app - == + =. app + =/ =internal-gift +>.sign-arvo + ~& [%handling-use path] + (ap-specific-take:app t.t.path internal-gift) + ap-abet:app :: +mo-clear-queue: clear blocked tasks from the specified running agent. :: ++ mo-clear-queue @@ -1065,7 +1047,8 @@ %pass =/ =path p.move.internal-move =/ =internal-note q.move.internal-move - =/ use-path [%use agent-name path] + =/ use-path + [%use agent-name (scot %p attributing.agent-routes) path] =/ =note-arvo ?- -.internal-note %send @@ -1316,9 +1299,9 @@ :: =^ maybe-tang ap-core %+ ap-ingest ~ |. - (handle-mall:ap-agent-core +.path internal-gift) + (handle-mall:ap-agent-core path internal-gift) ?: ?=(%diff -.internal-gift) - (ap-update-subscription =(~ maybe-tang) attributing.agent-routes +.path) + (ap-update-subscription =(~ maybe-tang) attributing.agent-routes path) ?^ maybe-tang (ap-lame -.internal-gift u.maybe-tang) ap-core @@ -1563,12 +1546,14 @@ :: +load: recreate vane :: ++ load - |= =state-old - ^+ mall-payload - :: - ?- -.state-old - %0 mall-payload(state state-old) - == + |= * + mall-payload + :: |= =state-old + :: ^+ mall-payload + :: :: + :: ?- -.state-old + :: %0 mall-payload(state state-old) + :: == :: +scry: standard scry :: ++ scry From 2c5a478a848923d7e933af6426ec87a3655bf6fe Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 5 Sep 2019 20:01:31 -0700 Subject: [PATCH 133/451] mall: convert drum to mall --- pkg/arvo/age/hood.hoon | 52 +- pkg/arvo/app/cop.hoon | 8 +- pkg/arvo/lib/hood/drum-mall.hoon | 1072 ++++++++++++++++++++++++++++++ pkg/arvo/lib/hood/helm-mall.hoon | 20 - pkg/arvo/sys/vane/mall.hoon | 2 +- pkg/arvo/sys/zuse.hoon | 3 +- 6 files changed, 1123 insertions(+), 34 deletions(-) create mode 100644 pkg/arvo/lib/hood/drum-mall.hoon diff --git a/pkg/arvo/age/hood.hoon b/pkg/arvo/age/hood.hoon index 69a0c2527..1acc0c47d 100644 --- a/pkg/arvo/age/hood.hoon +++ b/pkg/arvo/age/hood.hoon @@ -2,6 +2,7 @@ :::: /hoon/hood/app :: :: :: :: :: /? 310 :: zuse version +/- *sole /+ sole, :: libraries :: XX these should really be separate apps, as :: none of them interact with each other in @@ -11,7 +12,7 @@ :: they have been bundled into :hood :: :: |command handlers - hood-helm-mall, hood-kiln, hood-drum, hood-write + hood-helm-mall, hood-kiln, hood-drum-mall, hood-write :: :: :: :::: :: :: :: :: :: @@ -45,7 +46,7 @@ |@ ++ $ |: paw=$:hood-part ?- hed - $drum ?>(?=($drum -.paw) `part:hood-drum`paw) + $drum ?>(?=($drum -.paw) `part:hood-drum-mall`paw) $helm ?>(?=($helm -.paw) `part:hood-helm-mall`paw) $kiln ?>(?=($kiln -.paw) `part:hood-kiln`paw) $write ?>(?=($write -.paw) `part:hood-write`paw) @@ -56,7 +57,7 @@ =+ $:{our/@p hed/hood-head} :: |@ ++ $ ?- hed - $drum (make:hood-drum our) + $drum (make:hood-drum-mall our) $helm *part:hood-helm-mall $kiln *part:hood-kiln $write *part:hood-write @@ -68,7 +69,7 @@ paw :: :: :: ++ hood-part :: current module state - $% {$drum $2 pith-2:hood-drum} :: + $% {$drum $2 pith-2:hood-drum-mall} :: {$helm $0 pith:hood-helm-mall} :: {$kiln $0 pith:hood-kiln} :: {$write $0 pith:hood-write} :: @@ -120,7 +121,7 @@ =. +>.handle (start hid ((able hid) identity)) (ably (handle a)) :: per-module interface wrappers - ++ from-drum (from-module %drum [..$ _se-abet]:(hood-drum)) + ++ from-drum (from-module %drum [..$ _se-abet]:(hood-drum-mall)) ++ from-helm (from-module %helm [..$ _abet]:(hood-helm-mall)) ++ from-kiln (from-module %kiln [..$ _abet]:(hood-kiln)) ++ from-write (from-module %write [..$ _abet]:(hood-write)) @@ -176,12 +177,33 @@ (need !<(~ vase)) %helm-bonk %- (wrap poke-bonk):from-helm:h (need !<(~ vase)) + %dill-belt %- (wrap poke-dill-belt):from-drum:h + (need !<(dill-belt:dill vase)) + %dill-blit %- (wrap poke-dill-blit):from-drum:h + (need !<(dill-blit:dill vase)) + %drum-put %- (wrap poke-put):from-drum:h + (need !<([path @] vase)) + %drum-link %- (wrap poke-link):from-drum:h + (need !<(gill:gall vase)) + %drum-unlink %- (wrap poke-unlink):from-drum:h + (need !<(gill:gall vase)) + %drum-exit %- (wrap poke-exit):from-drum:h + (need !<(~ vase)) + %drum-start %- (wrap poke-start):from-drum:h + (need !<(well:gall vase)) + %drum-set-boot-apps %- (wrap poke-set-boot-apps):from-drum:h + (need !<(? vase)) == [moves ..handle-init] :: ++ handle-peer - |= path - `..handle-init + |= =path + =/ h (help hid) + =^ moves lac + ?+ path ~|([%hood-bad-path wire] !!) + [%drum *] ((wrap peer):from-drum:h t.path) + == + [moves ..handle-init] :: ++ handle-pull |= path @@ -197,8 +219,19 @@ =/ h (help hid) =^ moves lac ?+ wire ~|([%hood-bad-wire wire] !!) - [%helm %hi *] %+ (wrap coup-hi):from-helm:h t.t.wire - ?>(?=(%coup -.internal-gift) p.internal-gift) + [%helm %hi *] %+ (wrap coup-hi):from-helm:h t.t.wire + ?>(?=(%coup -.internal-gift) p.internal-gift) + [%drum %phat *] + ?- -.internal-gift + %http-response !! + %coup ((wrap take-coup-phat):from-drum:h t.t.wire p.internal-gift) + %reap ((wrap reap-phat):from-drum:h t.t.wire p.internal-gift) + %quit ((wrap quit-phat):from-drum:h t.t.wire) + %diff + %+ (wrap diff-sole-effect-phat):from-drum:h t.t.wire + ?> ?=(%sole-effect p.p.internal-gift) + (need !<(sole-effect q.p.internal-gift)) + == == [moves ..handle-init] :: @@ -208,6 +241,7 @@ =^ moves lac ?+ wire ~|([%hood-bad-wire wire] !!) [%helm *] ((wrap take):from-helm:h t.wire vase) + [%drum *] ((wrap take):from-drum:h t.wire vase) == [moves ..handle-init] :: diff --git a/pkg/arvo/app/cop.hoon b/pkg/arvo/app/cop.hoon index d64bbfa69..449f3ba3e 100644 --- a/pkg/arvo/app/cop.hoon +++ b/pkg/arvo/app/cop.hoon @@ -12,9 +12,11 @@ ^- (quip move _this) :_ this :_ ~ ?+ arg ~|(%bad-arg !!) - %conf [ost.bowl %conf-mall / [our.bowl %hood] [our.bowl %home]] - %poke [ost.bowl %deal-mall / [our.bowl our.bowl] %hood %poke %atom !>(%hey)] - %hi [ost.bowl %deal-mall / [our.bowl our.bowl] %hood %poke %helm-send-hi !>([our.bowl `"heyza"])] + %conf [ost.bowl %conf-mall / [our.bowl %hood] [our.bowl %home]] + %poke [ost.bowl %deal-mall / [our.bowl our.bowl] %hood %poke %atom !>(%hey)] + %hi [ost.bowl %deal-mall / [our.bowl our.bowl] %hood %poke %helm-send-hi !>([our.bowl `"heyza"])] + %start [ost.bowl %deal-mall / [our.bowl our.bowl] %hood %poke %drum-start !>([%home %first])] + %first [ost.bowl %deal-mall / [our.bowl our.bowl] %first %poke %atom !>(%hey)] == :: ++ onto diff --git a/pkg/arvo/lib/hood/drum-mall.hoon b/pkg/arvo/lib/hood/drum-mall.hoon new file mode 100644 index 000000000..f5d9e6b8b --- /dev/null +++ b/pkg/arvo/lib/hood/drum-mall.hoon @@ -0,0 +1,1072 @@ +:: :: :: +:::: /hoon/drum/hood/lib :: :: + :: :: :: +/? 310 :: version +/- *sole, hall +/+ sole +:: :: :: +:::: :: :: + :: :: :: +|% :: :: +++ part {$drum $2 pith-2} :: +++ part-old {$drum $1 pith-1} :: +:: :: +++ pith-1 :: pre-style + %+ cork pith-2 :: + |:($:pith-2 +<(bin ((map bone source-1)))) :: +:: :: +++ source-1 :: + %+ cork source :: + |:($:source +<(mir ((pair @ud (list @c))))) :: style-less mir +:: :: +++ pith-2 :: + $: sys/(unit bone) :: local console + eel/(set gill:gall) :: connect to + ray/(set well:gall) :: + fur/(map dude:gall (unit server)) :: servers + bin/(map bone source) :: terminals + == :: +:: :: :: +:::: :: :: + :: :: :: +++ server :: running server + $: syd/desk :: app identity + cas/case :: boot case + == :: +++ kill :: kill ring + $: pos/@ud :: ring position + num/@ud :: number of entries + max/_60 :: max entries + old/(list (list @c)) :: entries proper + == :: +++ source :: input device + $: edg/_80 :: terminal columns + off/@ud :: window offset + kil/kill :: kill buffer + inx/@ud :: ring index + fug/(map gill:gall (unit target)) :: connections + mir/(pair @ud stub) :: mirrored terminal + == :: +++ history :: past input + $: pos/@ud :: input position + num/@ud :: number of entries + lay/(map @ud (list @c)) :: editing overlay + old/(list (list @c)) :: entries proper + == :: +++ search :: reverse-i-search + $: pos/@ud :: search position + str/(list @c) :: search string + == :: +++ target :: application target + $: $= blt :: curr & prev belts + %+ pair + (unit dill-belt:dill) + (unit dill-belt:dill) + ris/(unit search) :: reverse-i-search + hit/history :: all past input + pom/sole-prompt :: static prompt + inp/sole-command :: input state + == :: +-- +:: :: :: +:::: :: :: + :: :: :: +|% +++ deft-apes :: default servers + |= [our/ship lit/?] + %- ~(gas in *(set well:gall)) + ^- (list well:gall) + ?: lit + :~ [%home %dojo] + [%home %azimuth-tracker] + == + =+ myr=(clan:title our) + :: + ?: ?=($pawn myr) + :~ [%home %lens] + [%base %hall] + [%base %talk] + [%base %dojo] + [%base %modulo] + [%home %launch] + [%home %chat] + [%home %publish] + [%home %clock] + [%home %weather] + == + :~ [%home %lens] + [%home %acme] + [%home %dns] + [%home %dojo] + [%home %hall] + [%home %talk] + [%home %modulo] + [%home %launch] + [%home %chat] + [%home %publish] + [%home %clock] + [%home %weather] + [%home %azimuth-tracker] + == +:: +++ deft-fish :: default connects + |= our/ship + %- ~(gas in *(set gill:gall)) + ^- (list gill:gall) + [[our %talk] [our %dojo] ~] +:: +++ make :: initial part + |= our/ship + ^- part + :* %drum + %2 + sys=~ + eel=(deft-fish our) + ray=~ + fur=~ + bin=~ + == +:: +:: +++ en-gill :: gill to wire + |= gyl/gill:gall + ^- wire + [%drum %phat (scot %p p.gyl) q.gyl ~] +:: +++ de-gill :: gill from wire + |= way/wire ^- gill:gall + ?>(?=({@ @ ~} way) [(slav %p i.way) i.t.way]) +-- +:: +:::: + :: +|= {hid/bowl:gall part} :: main drum work +=+ (~(gut by bin) ost.hid *source) +=* dev - +=> |% :: arvo structures + ++ pear :: request + $% {$sole-action vase} :: + {$hall-command vase} :: + == :: + ++ lime :: update + $% {$dill-blit dill-blit:dill} :: + == :: + ++ card :: general card + $% {$conf wire dock ship term} :: + {$diff lime} :: + {$peer wire dock path} :: + {$poke wire dock pear} :: + {$pull wire dock ~} :: + == :: + ++ move (pair bone card) :: user-level move + -- +|_ {moz/(list move:agent:mall) biz/(list dill-blit:dill)} +++ diff-sole-effect-phat :: app event + |= {way/wire fec/sole-effect} + =< se-abet =< se-view + =+ gyl=(de-gill way) + ?: (se-aint gyl) +>.$ + (se-diff gyl fec) +:: +++ peer :: + |= pax/path + ~| [%drum-unauthorized our+our.hid src+src.hid] :: ourself + ?> (team:title our.hid src.hid) :: or our own moon + =< se-abet =< se-view + (se-text "[{}, driving {}]") +:: +++ poke-set-boot-apps :: + |= lit/? + ^- (quip move:agent:mall part) + :: We do not run se-abet:se-view here because that starts the apps, + :: and some apps are not ready to start (eg Talk crashes because the + :: terminal has width 0). It appears the first message to drum must + :: be the peer. + :: + [~ +<+.^$(ray (deft-apes our.hid lit))] +:: +++ poke-dill-belt :: terminal event + |= bet/dill-belt:dill + =< se-abet =< se-view + (se-belt bet) +:: +++ poke-dill-blit :: terminal output + |= bit/dill-blit:dill + se-abet:(se-blit-sys bit) +:: +++ poke-start :: start app + |= wel/well:gall + =< se-abet =< se-view + (se-born wel) +:: +++ poke-link :: connect app + |= gyl/gill:gall + =< se-abet =< se-view + (se-link gyl) +:: +++ poke-unlink :: disconnect app + |= gyl/gill:gall + =< se-abet =< se-view + (se-klin gyl) +:: +++ poke-exit :: shutdown + |= ~ + se-abet:(se-blit-sys `dill-blit:dill`[%qit ~]) +:: +++ poke-put :: write file + |= {pax/path txt/@} + se-abet:(se-blit-sys [%sav pax txt]) :: +:: +++ reap-phat :: ack connect + |= {way/wire saw/(unit tang)} + =< se-abet =< se-view + =+ gyl=(de-gill way) + ?~ saw + (se-join gyl) + (se-dump:(se-drop & gyl) u.saw) +:: +++ take :: + |= [=wire =vase] + %+ take-onto wire + +:(need !<([%onto (each suss:gall tang)] vase)) +:: +++ take-coup-phat :: ack poke + |= {way/wire saw/(unit tang)} + =< se-abet =< se-view + ?~ saw +> + =+ gyl=(de-gill way) + ?: (se-aint gyl) +>.$ + %- se-dump:(se-drop & gyl) + :_ u.saw + >[%drum-coup-fail src.hid ost.hid gyl]< +:: +++ take-onto :: ack start + |= {way/wire saw/(each suss:gall tang)} + =< se-abet =< se-view + ?> ?=({@ @ ~} way) + ?> (~(has by fur) i.t.way) + =/ wel/well:gall [i.way i.t.way] + ?- saw + {%| *} (se-dump p.saw) + {%& *} ?> =(q.wel p.p.saw) + :: =. +>.$ (se-text "live {}") + +>.$(fur (~(put by fur) q.wel `[p.wel %da r.p.saw])) + == +:: +++ quit-phat :: + |= way/wire + =< se-abet =< se-view + =+ gyl=(de-gill way) + ~& [%drum-quit src.hid ost.hid gyl] + (se-drop %| gyl) +:: :: :: +:::: :: :: + :: :: :: +++ se-abet :: resolve + ^- (quip move:agent:mall part) + =* pith +<+.$ + ?. se-ably + =. . se-adit + [(flop moz) pith] + =. sys ?^(sys sys `ost.hid) + =. . se-subze:se-adze:se-adit + :_ pith(bin (~(put by bin) ost.hid dev)) + %- flop + ^- (list move:agent:mall) + ?~ biz moz + :_ moz + [ost.hid %give %diff %dill-blit !>(?~(t.biz i.biz [%mor (flop biz)]))] +:: +++ se-ably (~(has by sup.hid) ost.hid) :: caused by console +:: +++ se-adit :: update servers + ^+ . + :: ensure dojo connects after talk + =* dojo-on-top aor + %+ roll (sort ~(tap in ray) dojo-on-top) + =< .(con +>) + |: $:{wel/well:gall con/_..se-adit} ^+ con + =. +>.$ con + =+ hig=(~(get by fur) q.wel) + ?: &(?=(^ hig) |(?=(~ u.hig) =(p.wel syd.u.u.hig))) +>.$ + =. +>.$ (se-text "activated app {(trip p.wel)}/{(trip q.wel)}") + %- se-emit(fur (~(put by fur) q.wel ~)) + =/ =wire [%drum p.wel q.wel ~] + [ost.hid %pass wire %meta %m !>([%conf [our.hid q.wel] our.hid p.wel])] +:: +++ se-adze :: update connections + ^+ . + %+ roll ~(tap in eel) + =< .(con +>) + |: $:{gil/gill:gall con/_.} ^+ con + =. +>.$ con + ?: (~(has by fug) gil) + +>.$ + (se-peer gil) +:: +++ se-subze :: downdate connections + =< .(dev (~(got by bin) ost.hid)) + =. bin (~(put by bin) ost.hid dev) + ^+ . + %- ~(rep by bin) + =< .(con +>) + |: $:{{ost/bone dev/source} con/_.} ^+ con + =+ xeno=se-subze-local:%_(con ost.hid ost, dev dev) + xeno(ost.hid ost.hid.con, dev dev.con, bin (~(put by bin) ost dev.xeno)) +:: +++ se-subze-local + ^+ . + %- ~(rep by fug) + =< .(con +>) + |: $:{{gil/gill:gall *} con/_.} ^+ con + =. +>.$ con + ?: (~(has in eel) gil) + +>.$ + (se-nuke gil) +:: +++ se-aint :: ignore result + |= gyl/gill:gall + ^- ? + ?. (~(has by bin) ost.hid) & + =+ gyr=(~(get by fug) gyl) + |(?=(~ gyr) ?=(~ u.gyr)) +:: +++ se-alas :: recalculate index + |= gyl/gill:gall + =+ [xin=0 wag=se-amor] + |- ^+ +>.^$ + ?~ wag +>.^$(inx 0) + ?: =(i.wag gyl) +>.^$(inx xin) + $(wag t.wag, xin +(xin)) +:: +++ se-amor :: live targets + ^- (list gill:gall) + %+ skim ~(tap in eel) + |=(a/gill:gall ?=({~ ~ *} (~(get by fug) a))) +:: +++ se-anon :: rotate index + =+ wag=se-amor + ?~ wag + + :: ~& [%se-anon inx+inx wag+wag nex+(mod +(inx) (lent se-amor))] + +(off 0, inx (mod +(inx) (lent wag))) +:: +++ se-agon :: current gill + ^- (unit gill:gall) + =+ wag=se-amor + ?~ wag ~ + `(snag inx `(list gill:gall)`wag) +:: +++ se-belt :: handle input + |= bet/dill-belt:dill + ^+ +> + ?: ?=({?($cru $hey $rez $yow) *} bet) :: target-agnostic + ?- bet + {$cru *} (se-dump:(se-text (trip p.bet)) q.bet) + {$hey *} +>(mir [0 ~]) :: refresh + {$rez *} +>(edg (dec p.bet)) :: resize window + {$yow *} ~&([%no-yow -.bet] +>) + == + =+ gul=se-agon + ?: |(?=(~ gul) (se-aint u.gul)) + (se-blit %bel ~) + ta-abet:(ta-belt:(se-tame u.gul) bet) +:: +++ se-born :: new server + |= wel/well:gall + ^+ +> + ?: (~(has in ray) wel) + (se-text "[already running {}/{}]") + %= +> + ray (~(put in ray) wel) + eel (~(put in eel) [our.hid q.wel]) + == +:: +++ se-drop :: disconnect + |= {pej/? gyl/gill:gall} + ^+ +> + =+ lag=se-agon + ?. (~(has by fug) gyl) +>.$ + =. fug (~(del by fug) gyl) + =. eel ?.(pej eel (~(del in eel) gyl)) + =. +>.$ ?. &(?=(^ lag) !=(gyl u.lag)) + +>.$(inx 0) + (se-alas u.lag) + =. +>.$ (se-text "[unlinked from {}]") + ?: =(gyl [our.hid %dojo]) :: undead dojo + (se-link gyl) + +>.$ +:: +++ se-dump :: print tanks + |= tac/(list tank) + ^+ +> + ?. se-ably (se-hall tac) + =/ wol/wall + (zing (turn (flop tac) |=(a/tank (~(win re a) [0 edg])))) + |- ^+ +>.^$ + ?~ wol +>.^$ + ?. ((sane %t) (crip i.wol)) :: XX upstream validation + ~& bad-text+<`*`i.wol> + $(wol t.wol) + $(wol t.wol, +>.^$ (se-blit %out (tuba i.wol))) +:: +++ se-join :: confirm connection + |= gyl/gill:gall + ^+ +> + =. +> (se-text "[linked to {}]") + ?> ?=(~ (~(got by fug) gyl)) + (se-alas(fug (~(put by fug) gyl `*target)) gyl) +:: +++ se-nuke :: teardown connection + |= gyl/gill:gall + ^+ +> + (se-drop:(se-pull gyl) & gyl) +:: +++ se-klin :: disconnect app + |= gyl/gill:gall + +>(eel (~(del in eel) gyl)) +:: +++ se-link :: connect to app + |= gyl/gill:gall + +>(eel (~(put in eel) gyl)) +:: +++ se-blit :: give output + |= bil/dill-blit:dill + +>(biz [bil biz]) +:: +++ se-blit-sys :: output to system + |= bil/dill-blit:dill ^+ +> + ?~ sys ~&(%se-blit-no-sys +>) + (se-emit [u.sys %give %diff %dill-blit !>(bil)]) +:: +++ se-show :: show buffer, raw + |= lin/(pair @ud stub) + ^+ +> + =. p.lin (add p.lin (lent-stye:klr q.lin)) + ?: =(mir lin) +> + =. +> ?:(=(p.mir p.lin) +> (se-blit %hop p.lin)) + =. +> ?:(=(q.mir q.lin) +> (se-blit %pom q.lin)) + +>(mir lin) +:: +++ se-just :: adjusted buffer + |= {pom/stub lin/(pair @ud (list @c))} + ^+ +> + =/ pol (lent-char:klr pom) + =/ pos (add pol p.lin) + ?: (gte (div (mul pol 100) edg) 35) :: old style (long prompt) + =/ off ?:((lte pos edg) 0 (sub pos edg)) + %+ se-show + (sub pos off) + (swag:klr [off edg] (welp pom [*stye q.lin]~)) + =/ end (sub edg pol) + =. off ?: (gth p.lin (add end off)) + (sub p.lin end) + ?: (lth p.lin off) + (min p.lin (dec off)) + off + %+ se-show + (sub pos off) + (welp pom [*stye (swag [off end] q.lin)]~) +:: +++ se-view :: flush buffer + ^+ . + =+ gul=se-agon + ?: |(?=(~ gul) (se-aint u.gul)) + + (se-just ta-vew:(se-tame u.gul)) +:: +++ se-emit + |= move:agent:mall + %_(+> moz [+< moz]) +:: +++ se-hall + |= tac/(list tank) + ^+ +> + :: XX hall should be usable for stack traces, see urbit#584 which this change + :: closed for the problems there + ((slog (flop tac)) +>) + ::(se-emit 0 %poke /drum/hall [our.hid %hall] (said:hall our.hid %drum now.hid eny.hid tac)) +:: +++ se-text :: return text + |= txt/tape + ^+ +> + ?. ((sane %t) (crip txt)) :: XX upstream validation + ~& bad-text+<`*`txt> + +> + ?. se-ably (se-hall [%leaf txt]~) + (se-blit %out (tuba txt)) +:: +++ se-poke :: send a poke + |= {gyl/gill:gall par/pear} + (se-emit [ost.hid %pass (en-gill gyl) %send p.gyl q.gyl %poke par]) +:: +++ se-peer :: send a peer + |= gyl/gill:gall + %- se-emit(fug (~(put by fug) gyl ~)) + [ost.hid %pass (en-gill gyl) %send p.gyl q.gyl %peer /sole] +:: +++ se-pull :: cancel subscription + |= gyl/gill:gall + (se-emit [ost.hid %pass (en-gill gyl) %send p.gyl q.gyl %pull ~]) +:: +++ se-tame :: switch connection + |= gyl/gill:gall + ^+ ta + ~(. ta gyl (need (~(got by fug) gyl))) +:: +++ se-diff :: receive results + |= {gyl/gill:gall fec/sole-effect} + ^+ +> + ta-abet:(ta-fec:(se-tame gyl) fec) +:: +++ ta :: per target + |_ {gyl/gill:gall target} :: app and state + ++ ta-abet :: resolve + ^+ ..ta + ..ta(fug (~(put by fug) gyl ``target`+<+)) + :: + ++ ta-poke |=(a/pear +>(..ta (se-poke gyl a))) :: poke gyl + :: + ++ ta-act :: send action + |= act/sole-action + ^+ +> + (ta-poke %sole-action !>(act)) + :: + ++ ta-aro :: hear arrow + |= key/?($d $l $r $u) + ^+ +> + =. ris ~ + ?- key + $d ?. =(num.hit pos.hit) + (ta-mov +(pos.hit)) + ?: =(0 (lent buf.say.inp)) + ta-bel + (ta-hom:ta-nex %set ~) + $l ?: =(0 pos.inp) ta-bel + +>(pos.inp (dec pos.inp)) + $r ?: =((lent buf.say.inp) pos.inp) + ta-bel + +>(pos.inp +(pos.inp)) + $u ?:(=(0 pos.hit) ta-bel (ta-mov (dec pos.hit))) + == + :: + ++ ta-bel :: beep + .(..ta (se-blit %bel ~), q.blt ~) :: forget belt + :: + ++ ta-belt :: handle input + |= bet/dill-belt:dill + ^+ +> + ?< ?=({?($cru $hey $rez $yow) *} bet) :: target-specific + =. blt [q.blt `bet] :: remember belt + ?- bet + {$aro *} (ta-aro p.bet) + {$bac *} ta-bac + {$ctl *} (ta-ctl p.bet) + {$del *} ta-del + {$met *} (ta-met p.bet) + {$ret *} ta-ret + {$txt *} (ta-txt p.bet) + == + :: + ++ ta-det :: send edit + |= ted/sole-edit + ^+ +> + (ta-act %det [[his.ven.say.inp own.ven.say.inp] (sham buf.say.inp) ted]) + :: + ++ ta-bac :: hear backspace + ^+ . + ?^ ris + ?: =(~ str.u.ris) + ta-bel + .(str.u.ris (scag (dec (lent str.u.ris)) str.u.ris)) + ?: =(0 pos.inp) + ?~ buf.say.inp + (ta-act %clr ~) + ta-bel + (ta-hom %del (dec pos.inp)) + :: + ++ ta-ctl :: hear control + |= key/@ud + ^+ +> + =. ris ?.(?=(?($g $r) key) ~ ris) + ?+ key ta-bel + $a +>(pos.inp 0) + $b (ta-aro %l) + $c ta-bel + $d ?^ buf.say.inp + ta-del + ?: (~(has in (deft-fish our.hid)) gyl) + +>(..ta (se-blit qit+~)) :: quit pier + +>(..ta (se-klin gyl)) :: unlink app + $e +>(pos.inp (lent buf.say.inp)) + $f (ta-aro %r) + $g ?~ ris ta-bel + (ta-hom(pos.hit num.hit, ris ~) [%set ~]) + $k =+ len=(lent buf.say.inp) + ?: =(pos.inp len) + ta-bel + (ta-kil %r [pos.inp (sub len pos.inp)]) + $l +>(..ta (se-blit %clr ~)) + $n (ta-aro %d) + $p (ta-aro %u) + $r ?~ ris + +>(ris `[pos.hit ~]) + ?: =(0 pos.u.ris) + ta-bel + (ta-ser ~) + $t =+ len=(lent buf.say.inp) + ?: |(=(0 pos.inp) (lth len 2)) + ta-bel + =+ sop=(sub pos.inp ?:(=(len pos.inp) 2 1)) + (ta-hom (rep:edit [sop 2] (flop (swag [sop 2] buf.say.inp)))) + $u ?: =(0 pos.inp) + ta-bel + (ta-kil %l [0 pos.inp]) + $v ta-bel + $w ?: =(0 pos.inp) + ta-bel + =+ sop=(ta-pos %l %ace pos.inp) + (ta-kil %l [(sub pos.inp sop) sop]) + $x +>(..ta se-anon) + $y ?: =(0 num.kil) + ta-bel + (ta-hom (cat:edit pos.inp ta-yan)) + == + :: + ++ ta-del :: hear delete + ^+ . + ?: =((lent buf.say.inp) pos.inp) + ta-bel + (ta-hom %del pos.inp) + :: + ++ ta-erl :: hear local error + |= pos/@ud + ta-bel(pos.inp (min pos (lent buf.say.inp))) + :: + ++ ta-err :: hear remote error + |= pos/@ud + (ta-erl (~(transpose sole say.inp) pos)) + :: + ++ ta-fec :: apply effect + |= fec/sole-effect + ^+ +> + ?- fec + {$bel *} ta-bel + {$blk *} +> + {$clr *} +>(..ta (se-blit fec)) + {$det *} (ta-got +.fec) + {$err *} (ta-err p.fec) + {$klr *} +>(..ta (se-blit %klr (make:klr p.fec))) + {$mor *} |- ^+ +>.^$ + ?~ p.fec +>.^$ + $(p.fec t.p.fec, +>.^$ ^$(fec i.p.fec)) + {$nex *} ta-nex + {$pro *} (ta-pro +.fec) + {$tan *} +>(..ta (se-dump p.fec)) + {$sag *} +>(..ta (se-blit fec)) + {$sav *} +>(..ta (se-blit fec)) + {$txt *} +>(..ta (se-text p.fec)) + {$url *} +>(..ta (se-blit fec)) + == + :: + ++ ta-dog :: change cursor + |= ted/sole-edit + %_ +> + pos.inp + =+ len=(lent buf.say.inp) + %+ min len + |- ^- @ud + ?- ted + {$del *} ?:((gth pos.inp p.ted) (dec pos.inp) pos.inp) + {$ins *} ?:((gte pos.inp p.ted) +(pos.inp) pos.inp) + {$mor *} |- ^- @ud + ?~ p.ted pos.inp + $(p.ted t.p.ted, pos.inp ^$(ted i.p.ted)) + {$nop *} pos.inp + {$set *} len + == + == + :: + ++ ta-off :: reset buffer offset + |= ted/sole-edit + =? off (any:edit ted |=(a/sole-edit ?=($set -.a))) 0 + +> + :: + ++ ta-got :: apply change + |= cal/sole-change + =^ ted say.inp (~(receive sole say.inp) cal) + (ta-dog:(ta-off ted.cal) ted) + :: + ++ ta-hom :: local edit + |= ted/sole-edit + ^+ +> + =. +> (ta-det:(ta-off ted) ted) + (ta-dog(say.inp (~(commit sole say.inp) ted)) ted) + :: + ++ ta-jump :: buffer pos + |= {dir/?($l $r) til/?($ace $edg $wrd) pos/@ud} + ^- @ud + %- ?:(?=($l dir) sub add) + [pos (ta-pos dir til pos)] + :: + ++ ta-kil :: kill selection + |= {dir/?($l $r) sel/{@ @}} + ^+ +> + =+ buf=(swag sel buf.say.inp) + %. (cut:edit sel) + %= ta-hom + kil + ?. ?& ?=(^ old.kil) + ?=(^ p.blt) + ?| ?=({$ctl ?($k $u $w)} u.p.blt) + ?=({$met ?($d $bac)} u.p.blt) + == == + %= kil :: prepend + num +(num.kil) + pos +(num.kil) + old (scag max.kil `(list (list @c))`[buf old.kil]) + == + %= kil :: cumulative yanks + pos num.kil + old :_ t.old.kil + ?- dir + $l (welp buf i.old.kil) + $r (welp i.old.kil buf) + == == + == + :: + ++ ta-met :: meta key + |= key/@ud + ^+ +> + =. ris ~ + ?+ key ta-bel + $dot ?. &(?=(^ old.hit) ?=(^ i.old.hit)) :: last "arg" from hist + ta-bel + =+ old=`(list @c)`i.old.hit + =+ sop=(ta-jump(buf.say.inp old) %l %ace (lent old)) + (ta-hom (cat:edit pos.inp (slag sop old))) + :: + $bac ?: =(0 pos.inp) :: kill left-word + ta-bel + =+ sop=(ta-pos %l %edg pos.inp) + (ta-kil %l [(sub pos.inp sop) sop]) + :: + $b ?: =(0 pos.inp) :: jump left-word + ta-bel + +>(pos.inp (ta-jump %l %edg pos.inp)) + :: + $c ?: =(pos.inp (lent buf.say.inp)) :: capitalize + ta-bel + =+ sop=(ta-jump %r %wrd pos.inp) + %- ta-hom(pos.inp (ta-jump %r %edg sop)) + %+ rep:edit [sop 1] + ^- (list @c) ^- (list @) :: XX unicode + (cuss `tape``(list @)`(swag [sop 1] buf.say.inp)) + :: + $d ?: =(pos.inp (lent buf.say.inp)) :: kill right-word + ta-bel + (ta-kil %r [pos.inp (ta-pos %r %edg pos.inp)]) + :: + $f ?: =(pos.inp (lent buf.say.inp)) :: jump right-word + ta-bel + +>(pos.inp (ta-jump %r %edg pos.inp)) + :: + $r %- ta-hom(lay.hit (~(put by lay.hit) pos.hit ~)) + :- %set :: revert hist edit + ?: =(pos.hit num.hit) ~ + (snag (sub num.hit +(pos.hit)) old.hit) + :: + $t =+ a=(ta-jump %r %edg pos.inp) :: transpose words + =+ b=(ta-jump %l %edg a) + =+ c=(ta-jump %l %edg b) + ?: =(b c) + ta-bel + =+ next=[b (sub a b)] + =+ prev=[c (ta-pos %r %edg c)] + %- ta-hom(pos.inp a) + :~ %mor + (rep:edit next (swag prev buf.say.inp)) + (rep:edit prev (swag next buf.say.inp)) + == + :: + ?($u $l) :: upper/lower case + ?: =(pos.inp (lent buf.say.inp)) + ta-bel + =+ case=?:(?=($u key) cuss cass) + =+ sop=(ta-jump %r %wrd pos.inp) + =+ sel=[sop (ta-pos %r %edg sop)] + %- ta-hom + %+ rep:edit sel + ^- (list @c) ^- (list @) :: XX unicode + (case `tape``(list @)`(swag sel buf.say.inp)) + :: + $y ?. ?& ?=(^ old.kil) :: rotate & yank + ?=(^ p.blt) + ?| ?=({$ctl $y} u.p.blt) + ?=({$met $y} u.p.blt) + == == + ta-bel + =+ las=(lent ta-yan) + =. pos.kil ?:(=(1 pos.kil) num.kil (dec pos.kil)) + (ta-hom (rep:edit [(sub pos.inp las) las] ta-yan)) + == + :: + ++ ta-mov :: move in history + |= sop/@ud + ^+ +> + ?: =(sop pos.hit) +> + %- %= ta-hom + pos.hit sop + lay.hit (~(put by lay.hit) pos.hit buf.say.inp) + == + :- %set + %. (~(get by lay.hit) sop) + (bond |.((snag (sub num.hit +(sop)) old.hit))) + :: + ++ ta-nex :: advance history + ^+ . + =. ris ~ + =. lay.hit ~ + ?: ?| ?=(~ buf.say.inp) + &(?=(^ old.hit) =(buf.say.inp i.old.hit)) + == + .(pos.hit num.hit) + %_ . + num.hit +(num.hit) + pos.hit +(num.hit) + old.hit [buf.say.inp old.hit] + == + :: + ++ ta-pos :: buffer pos offset + |= {dir/?($l $r) til/?($ace $edg $wrd) pos/@ud} + ^- @ud + %- ?- til $ace ace:offset + $edg edg:offset + $wrd wrd:offset + == + ?- dir $l (flop (scag pos buf.say.inp)) + $r (slag pos buf.say.inp) + == + :: + ++ ta-pro :: set prompt + |= pom/sole-prompt + %_ +> + pom + %_ pom + cad + ;: welp + ?. ?=($earl (clan:title p.gyl)) + (cite:title p.gyl) + (scow %p p.gyl) + :: + ":" + (trip q.gyl) + cad.pom + == + == + == + :: + ++ ta-ret :: hear return + (ta-act %ret ~) + :: + ++ ta-ser :: reverse search + |= ext/(list @c) + ^+ +> + ?: |(?=(~ ris) =(0 pos.u.ris)) + ta-bel + =+ sop=?~(ext (dec pos.u.ris) pos.u.ris) + =+ tot=(weld str.u.ris ext) + =+ dol=(slag (sub num.hit sop) old.hit) + =/ sup + |- ^- (unit @ud) + ?~ dol ~ + ?^ (find tot i.dol) + `sop + $(sop (dec sop), dol t.dol) + ?~ sup ta-bel + (ta-mov(str.u.ris tot, pos.u.ris u.sup) (dec u.sup)) + :: + ++ ta-txt :: hear text + |= txt/(list @c) + ^+ +> + ?^ ris + (ta-ser txt) + (ta-hom (cat:edit pos.inp txt)) + :: + ++ ta-vew :: computed prompt + ^- {pom/stub lin/(pair @ud (list @c))} + =; vew/(pair (list @c) styx) + [(make:klr q.vew) pos.inp p.vew] + ?: vis.pom + :- buf.say.inp :: default prompt + ?~ ris + cad.pom + :(welp "(reverse-i-search)'" (tufa str.u.ris) "': ") + :- (reap (lent buf.say.inp) `@c`'*') :: hidden input + %+ welp + cad.pom + ?~ buf.say.inp ~ + :(welp "<" (scow %p (end 4 1 (sham buf.say.inp))) "> ") + :: + ++ ta-yan :: yank + (snag (sub num.kil pos.kil) old.kil) + -- +++ edit :: produce sole-edits + |% + ++ cat :: mass insert + |= {pos/@ud txt/(list @c)} + ^- sole-edit + :- %mor + |- ^- (list sole-edit) + ?~ txt ~ + [[%ins pos i.txt] $(pos +(pos), txt t.txt)] + :: + ++ cut :: mass delete + |= {pos/@ud num/@ud} + ^- sole-edit + :- %mor + |- ^- (list sole-edit) + ?: =(0 num) ~ + [[%del pos] $(num (dec num))] + :: + ++ rep :: mass replace + |= {{pos/@ud num/@ud} txt/(list @c)} + ^- sole-edit + :~ %mor + (cut pos num) + (cat pos txt) + == + ++ any :: matches? + |= {a/sole-edit b/$-(sole-edit ?)} + ^- ? + ?. ?=($mor -.a) (b a) + (lien p.a |=(c/sole-edit ^$(a c))) + -- +++ offset :: calculate offsets + |% + ++ alnm :: alpha-numeric + |= a/@ ^- ? + ?| &((gte a '0') (lte a '9')) + &((gte a 'A') (lte a 'Z')) + &((gte a 'a') (lte a 'z')) + == + :: + ++ ace :: next whitespace + |= a/(list @) + =| {b/_| i/@ud} + |- ^- @ud + ?~ a i + =/ c !=(32 i.a) + =. b |(b c) + ?: &(b !|(=(0 i) c)) i + $(i +(i), a t.a) + :: + ++ edg :: next word boundary + |= a/(list @) + =| {b/_| i/@ud} + |- ^- @ud + ?~ a i + =/ c (alnm i.a) + =. b |(b c) + ?: &(b !|(=(0 i) c)) i + $(i +(i), a t.a) + :: + ++ wrd :: next or current word + |= a/(list @) + =| i/@ud + |- ^- @ud + ?: |(?=(~ a) (alnm i.a)) i + $(i +(i), a t.a) + -- +:: +++ klr :: styx/stub engine + =, dill + |% + ++ make :: stub from styx + |= a/styx ^- stub + =| b/stye + %+ reel + |- ^- stub + %- zing %+ turn a + |= a/$@(@t (pair styl styx)) + ?@ a [b (tuba (trip a))]~ + ^$(a q.a, b (styd p.a b)) + :: + |= {a/(pair stye (list @c)) b/stub} + ?~ b [a ~] + ?. =(p.a p.i.b) [a b] + [[p.a (weld q.a q.i.b)] t.b] + :: + ++ styd :: stye from styl + |= {a/styl b/stye} ^+ b :: with inheritance + :+ ?~ p.a p.b + ?~ u.p.a ~ + (~(put in p.b) u.p.a) + (fall p.q.a p.q.b) + (fall q.q.a q.q.b) + :: + ++ lent-stye + |= a/stub ^- @ + (roll (lnts-stye a) add) + :: + ++ lent-char + |= a/stub ^- @ + (roll (lnts-char a) add) + :: + ++ lnts-stye :: stub pair head lengths + |= a/stub ^- (list @) + %+ turn a + |= a/(pair stye (list @c)) + ;: add :: presumes impl of cvrt:ansi in %dill + (mul 5 2) :: bg + (mul 5 2) :: fg + =+ b=~(wyt in p.p.a) :: effect + ?:(=(0 b) 0 (mul 4 +(b))) + == + :: + ++ lnts-char :: stub pair tail lengths + |= a/stub ^- (list @) + %+ turn a + |= a/(pair stye (list @c)) + (lent q.a) + :: + ++ brek :: index + incl-len of + |= {a/@ b/(list @)} :: stub pair w/ idx a + =| {c/@ i/@} + |- ^- (unit (pair @ @)) + ?~ b ~ + =. c (add c i.b) + ?: (gte c a) + `[i c] + $(i +(i), b t.b) + :: + ++ slag :: slag stub, keep stye + |= {a/@ b/stub} + ^- stub + =+ c=(lnts-char b) + =+ i=(brek a c) + ?~ i b + =+ r=(^slag +(p.u.i) b) + ?: =(a q.u.i) + r + =+ n=(snag p.u.i b) + :_ r :- p.n + (^slag (sub (snag p.u.i c) (sub q.u.i a)) q.n) + :: + ++ scag :: scag stub, keep stye + |= {a/@ b/stub} + ^- stub + =+ c=(lnts-char b) + =+ i=(brek a c) + ?~ i b + ?: =(a q.u.i) + (^scag +(p.u.i) b) + %+ welp + (^scag p.u.i b) + =+ n=(snag p.u.i b) + :_ ~ :- p.n + (^scag (sub (snag p.u.i c) (sub q.u.i a)) q.n) + :: + ++ swag :: swag stub, keep stye + |= {{a/@ b/@} c/stub} + (scag b (slag a c)) + -- +-- diff --git a/pkg/arvo/lib/hood/helm-mall.hoon b/pkg/arvo/lib/hood/helm-mall.hoon index 4dbe28137..3bd2051a4 100644 --- a/pkg/arvo/lib/hood/helm-mall.hoon +++ b/pkg/arvo/lib/hood/helm-mall.hoon @@ -35,26 +35,6 @@ :: :: :: |: $:{bowl:gall part} :: main helm work =+ sez=(~(gut by hoc) ost $:session) -=> |% :: arvo structures - ++ card :: - $% [%bonk wire ~] :: - {$flog wire flog:dill} :: - {$nuke wire ship} :: - [%serve wire binding:eyre generator:eyre] :: - {$poke wire dock pear} :: - {$rest wire @da} :: - {$wait wire @da} :: - {$rekey wire life ring} :: - {$moon wire ship udiff:point:able:jael} :: - == :: - ++ move (pair bone card) :: user-level move - ++ pear :: poke fruit - $% {$hood-unsync desk ship desk} :: - {$helm-hi cord} :: - {$drum-start well:gall} :: - {$hall-action action:hall} :: - == :: - -- =| moz=(list move:agent:mall) |% ++ abet diff --git a/pkg/arvo/sys/vane/mall.hoon b/pkg/arvo/sys/vane/mall.hoon index 9bfc05c03..da9dee709 100644 --- a/pkg/arvo/sys/vane/mall.hoon +++ b/pkg/arvo/sys/vane/mall.hoon @@ -1466,7 +1466,7 @@ :: =/ initialised (mo-abed:mo duct) ?- -.task - %conf-mall + ?(%conf %conf-mall) =/ =dock p.task =/ =ship p.dock ?. =(our ship) diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 63c547150..5cab5ca7a 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -1867,7 +1867,8 @@ == :: ++ task :: incoming request $~ [%vega ~] :: - $% {$conf-mall p/dock q/dock} :: configure app + $% {$conf p/dock q/dock} :: configure app + {$conf-mall p/dock q/dock} :: configure app $>(%init vane-task) :: set owner {$deal p/sock q/internal-task} :: full transmission {$deal-mall p/sock q/internal-task} :: full transmission From 0f6bd70aa3426a096b2a030f33a8e8b93733b52e Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 5 Sep 2019 21:24:20 -0700 Subject: [PATCH 134/451] mall: convert kiln to mall --- pkg/arvo/age/hood.hoon | 65 ++- pkg/arvo/lib/hood/kiln-mall.hoon | 729 +++++++++++++++++++++++++++++++ 2 files changed, 787 insertions(+), 7 deletions(-) create mode 100644 pkg/arvo/lib/hood/kiln-mall.hoon diff --git a/pkg/arvo/age/hood.hoon b/pkg/arvo/age/hood.hoon index 1acc0c47d..d7132e0c2 100644 --- a/pkg/arvo/age/hood.hoon +++ b/pkg/arvo/age/hood.hoon @@ -12,7 +12,7 @@ :: they have been bundled into :hood :: :: |command handlers - hood-helm-mall, hood-kiln, hood-drum-mall, hood-write + hood-helm-mall, hood-kiln-mall, hood-drum-mall, hood-write :: :: :: :::: :: :: :: :: :: @@ -48,7 +48,7 @@ ?- hed $drum ?>(?=($drum -.paw) `part:hood-drum-mall`paw) $helm ?>(?=($helm -.paw) `part:hood-helm-mall`paw) - $kiln ?>(?=($kiln -.paw) `part:hood-kiln`paw) + $kiln ?>(?=($kiln -.paw) `part:hood-kiln-mall`paw) $write ?>(?=($write -.paw) `part:hood-write`paw) == -- @@ -59,7 +59,7 @@ ?- hed $drum (make:hood-drum-mall our) $helm *part:hood-helm-mall - $kiln *part:hood-kiln + $kiln *part:hood-kiln-mall $write *part:hood-write == -- @@ -71,7 +71,7 @@ ++ hood-part :: current module state $% {$drum $2 pith-2:hood-drum-mall} :: {$helm $0 pith:hood-helm-mall} :: - {$kiln $0 pith:hood-kiln} :: + {$kiln $0 pith:hood-kiln-mall} :: {$write $0 pith:hood-write} :: == :: -- :: @@ -123,7 +123,7 @@ :: per-module interface wrappers ++ from-drum (from-module %drum [..$ _se-abet]:(hood-drum-mall)) ++ from-helm (from-module %helm [..$ _abet]:(hood-helm-mall)) - ++ from-kiln (from-module %kiln [..$ _abet]:(hood-kiln)) + ++ from-kiln (from-module %kiln [..$ _abet]:(hood-kiln-mall)) ++ from-write (from-module %write [..$ _abet]:(hood-write)) -- |_ hid/bowl:mall :: gall environment @@ -193,6 +193,50 @@ (need !<(well:gall vase)) %drum-set-boot-apps %- (wrap poke-set-boot-apps):from-drum:h (need !<(? vase)) + %hood-sync %- (wrap poke-sync):from-kiln:h + (need !<([desk ship desk] vase)) + %kiln-commit %- (wrap poke-commit):from-kiln:h + (need !<([term ?] vase)) + %kiln-info %- (wrap poke-info):from-kiln:h + (need !<([tape (unit toro:clay)] vase)) + %kiln-label %- (wrap poke-label):from-kiln:h + (need !<([desk @tas] vase)) + %kiln-merge %- (wrap poke-merge):from-kiln:h + (need !<([desk ship desk case ?($auto germ:clay)] vase)) + %kiln-cancel %- (wrap poke-cancel):from-kiln:h + (need !<(desk vase)) + %kiln-cancel-autocommit %- (wrap poke-cancel-autocommit):from-kiln:h + (need !<(~ vase)) + %kiln-mount %- (wrap poke-mount):from-kiln:h + (need !<([path term] vase)) + %kiln-rm %- (wrap poke-rm):from-kiln:h + (need !<(path vase)) + %kiln-schedule %- (wrap poke-schedule):from-kiln:h + (need !<([path @da @t] vase)) + %kiln-track %- (wrap poke-track):from-kiln:h + (need !<([desk ship desk] vase)) + %kiln-sync %- (wrap poke-sync):from-kiln:h + (need !<([desk ship desk] vase)) + %kiln-syncs %- (wrap poke-syncs):from-kiln:h + (need !<(~ vase)) + %kiln-start-autoload %- (wrap poke-start-autoload):from-kiln:h + (need !<(~ vase)) + %kiln-wipe-ford %- (wrap poke-wipe-ford):from-kiln:h + (need !<(@ud vase)) + %kiln-keep-ford %- (wrap poke-keep-ford):from-kiln:h + (need !<([@ud @ud] vase)) + %kiln-autoload %- (wrap poke-autoload):from-kiln:h + (need !<((unit ?) vase)) + %kiln-overload %- (wrap poke-overload):from-kiln:h + (need !<([@dr @da] vase)) + %kiln-wash-gall %- (wrap poke-wash-gall):from-kiln:h + (need !<(* vase)) + %kiln-unmount %- (wrap poke-unmount):from-kiln:h + (need !<($@(term [knot path]) vase)) + %kiln-unsync %- (wrap poke-unsync):from-kiln:h + (need !<([desk ship desk] vase)) + %kiln-permission %- (wrap poke-permission):from-kiln:h + (need !<([desk path ?] vase)) == [moves ..handle-init] :: @@ -219,8 +263,14 @@ =/ h (help hid) =^ moves lac ?+ wire ~|([%hood-bad-wire wire] !!) - [%helm %hi *] %+ (wrap coup-hi):from-helm:h t.t.wire - ?>(?=(%coup -.internal-gift) p.internal-gift) + [%helm %hi *] %+ (wrap coup-hi):from-helm:h t.t.wire + ?>(?=(%coup -.internal-gift) p.internal-gift) + [%kiln %fancy *] %+ (wrap take-coup-fancy):from-kiln:h t.t.wire + ?>(?=(%coup -.internal-gift) p.internal-gift) + [%kiln %reload *] %+ (wrap take-coup-reload):from-kiln:h t.t.wire + ?>(?=(%coup -.internal-gift) p.internal-gift) + [%kiln %spam *] %+ (wrap take-coup-spam):from-kiln:h t.t.wire + ?>(?=(%coup -.internal-gift) p.internal-gift) [%drum %phat *] ?- -.internal-gift %http-response !! @@ -242,6 +292,7 @@ ?+ wire ~|([%hood-bad-wire wire] !!) [%helm *] ((wrap take):from-helm:h t.wire vase) [%drum *] ((wrap take):from-drum:h t.wire vase) + [%kiln *] ((wrap take-general):from-kiln:h t.wire vase) == [moves ..handle-init] :: diff --git a/pkg/arvo/lib/hood/kiln-mall.hoon b/pkg/arvo/lib/hood/kiln-mall.hoon new file mode 100644 index 000000000..6d72702cf --- /dev/null +++ b/pkg/arvo/lib/hood/kiln-mall.hoon @@ -0,0 +1,729 @@ +:: :: :: +:::: /hoon/kiln/hood/lib :: :: + :: :: :: +/? 310 :: version +/- hall +:: :: :: +:::: :: :: + :: :: :: +=, clay +=, space:userlib +=, format +|% :: :: +++ part {$kiln $0 pith} :: kiln state +++ pith :: :: + $: rem/(map desk per-desk) :: + syn/(map kiln-sync {let/@ud ust/bone}) :: + autoload-on/? :: + cur-hoon/@uvI :: + cur-arvo/@uvI :: + cur-zuse/@uvI :: + cur-vanes/(map @tas @uvI) :: + commit-timer/{way/wire nex/@da tim/@dr mon=term} + == :: +++ per-desk :: per-desk state + $: auto/? :: escalate on failure + gem/germ :: strategy + her/@p :: from ship + sud/@tas :: from desk + cas/case :: at case + == :: +:: :: :: +:::: :: :: + :: :: :: +++ kiln-commit term :: +++ kiln-mount :: + $: pax/path :: + pot/term :: + == :: +++ kiln-unmount $@(term {knot path}) :: +++ kiln-sync :: + $: syd/desk :: + her/ship :: + sud/desk :: + == :: +++ kiln-unsync :: + $: syd/desk :: + her/ship :: + sud/desk :: + == :: +++ kiln-merge :: + $: syd/desk :: + ali/ship :: + sud/desk :: + cas/case :: + gim/?($auto germ) :: + == :: +-- :: +:: :: :: +:::: :: :: + :: :: :: +|= {bowl:gall part} :: main kiln work +?> =(src our) +|_ moz/(list move:agent:mall) +++ abet :: resolve + [(flop moz) `part`+<+.$] +:: +++ emit + |= (wind internal-note:mall internal-gift:mall) + %_(+> moz [[ost +<] moz]) +:: +++ emil :: return cards + |= (list (wind internal-note:mall internal-gift:mall)) + ^+ +> + ?~(+< +> $(+< t.+<, +> (emit i.+<))) +:: +++ render + |= {mez/tape sud/desk who/ship syd/desk} + :^ %palm [" " ~ ~ ~] leaf+mez + ~[leaf+"from {}" leaf+"on {}" leaf+"to {}"] +:: +++ poke-commit + |= [mon/kiln-commit auto=?] + =< abet + =. +>.$ (emit %pass /commit %meta %c !>([%dirk mon])) + ?. auto + +>.$ + =/ recur ~s1 + =. commit-timer + [/kiln/autocommit (add now recur) recur mon] + (emit %pass way.commit-timer %meta %b !>([%wait nex.commit-timer])) +:: +++ poke-cancel-autocommit + |= ~ + abet:(emit %pass way.commit-timer %meta %b !>([%rest nex.commit-timer])) +:: +++ poke-mount + |= kiln-mount + =+ bem=(de-beam pax) + ?~ bem + =+ "can't mount bad path: {}" + abet:(spam leaf+- ~) + abet:(emit %pass /mount %meta %c !>([%mont pot u.bem])) +:: +++ poke-unmount + |= mon/kiln-unmount + ?^ mon + =+ bem=(de-beam mon) + ?~ bem + =+ "can't unmount bad path: {}" + abet:(spam leaf+- ~) + abet:(emit %pass /unmount-beam %meta %c !>([%ogre [[p q r] s]:u.bem])) + abet:(emit %pass /unmount-point %meta %c !>([%ogre mon])) +:: +++ poke-track :: + |= hos/kiln-sync + ?: (~(has by syn) hos) + abet:(spam (render "already tracking" [sud her syd]:hos) ~) + abet:abet:start-track:(auto hos) +:: +++ poke-sync :: + |= hos/kiln-sync + ?: (~(has by syn) hos) + abet:(spam (render "already syncing" [sud her syd]:hos) ~) + abet:abet:start-sync:(auto hos) +:: +++ poke-syncs :: print sync config + |= ~ + =< abet %- spam + ?: =(0 ~(wyt by syn)) + [%leaf "no syncs configured"]~ + %+ turn ~(tap in ~(key by syn)) + |=(a/kiln-sync (render "sync configured" [sud her syd]:a)) +:: +++ poke-unsync :: + |= hus/kiln-unsync + ?. (~(has by syn) hus) + abet:(spam (render "not syncing" [sud her syd]:hus) ~) + %* . abet:abet:stop:(auto hus) + syn (~(del by syn) hus) + == +:: +++ poke-merge :: + |= kiln-merge + abet:abet:(merge:(work syd) ali sud cas gim) +:: +++ poke-cancel + |= syd/desk + abet:(emit %pass /cancel %meta %c !>([%drop syd])) +:: +++ poke-info + |= {mez/tape tor/(unit toro)} + ?~ tor + abet:(spam leaf+mez ~) + abet:(emit:(spam leaf+mez ~) %pass /kiln %meta %c !>([%info u.tor])) +:: +++ poke-rm + |= a/path + =+ b=.^(arch %cy a) + ?~ fil.b + =+ ~[leaf+"No such file:" leaf+"{}"] + abet:(spam -) + (poke-info "removed" `(fray a)) +:: +++ poke-label + |= {syd/desk lab/@tas} + =+ pax=/(scot %p our)/[syd]/[lab] + (poke-info "labeled {(spud pax)}" `[syd %| lab]) +:: +++ poke-schedule + |= {where/path tym/@da eve/@t} + =. where (welp where /sched) + %+ poke-info "scheduled" + =+ old=;;((map @da cord) (fall (file where) ~)) + `(foal where %sched !>((~(put by old) tym eve))) +:: +++ poke-permission + |= {syd/desk pax/path pub/?} + =< abet + %- emit + =/ =rite [%r ~ ?:(pub %black %white) ~] + [%pass /kiln/permission %meta %c !>([%perm syd pax rite])] +:: +++ poke-autoload |=(lod/(unit ?) abet:(poke:autoload lod)) +++ poke-start-autoload |=(~ abet:start:autoload) +:: +++ autoload + |% + ++ emit + |= a/(wind internal-note:mall internal-gift:mall) + +>(..autoload (^emit a)) + :: + ++ tracked-vanes + ^- (list @tas) + ~[%ames %behn %clay %dill %eyre %ford %gall %iris %jael] + :: + ++ our-home /(scot %p our)/home/(scot %da now) + ++ sys-hash |=(pax/path .^(@uvI %cz :(welp our-home /sys pax))) + ++ hash-vane + |= syd/@tas ^- (pair term @uvI) + [syd (sys-hash /vane/[syd]/hoon)] + :: + ++ rehash-vanes + ^+ cur-vanes + (malt (turn tracked-vanes hash-vane)) + :: + :: + ++ poke + |= lod/(unit ?) + ?^ lod + ..autoload(autoload-on u.lod) + =. autoload-on !autoload-on + (spam leaf+"turned autoload {?:(autoload-on "on" "off")}" ~) + :: + ++ start + =. cur-hoon (sys-hash /hoon/hoon) + =. cur-arvo (sys-hash /arvo/hoon) + =. cur-zuse (sys-hash /zuse/hoon) + =. cur-vanes rehash-vanes + subscribe-next + :: + ++ subscribe-next + %- emit + [%pass /kiln/autoload %meta %c !>([%warp our %home `[%next %z da+now /sys]])] + :: + ++ writ =>(check-new subscribe-next) + ++ check-new + ?. autoload-on + ..check-new + =/ new-hoon (sys-hash /hoon/hoon) + =/ new-arvo (sys-hash /arvo/hoon) + ?: |(!=(new-hoon cur-hoon) !=(new-arvo cur-arvo)) + =. cur-hoon new-hoon + =. cur-arvo new-arvo + =. cur-vanes rehash-vanes + (emit %pass /kiln/reload/hoon %send our %hood %poke %helm-reset !>(~)) + :: XX updates cur-vanes? + =/ new-zuse (sys-hash /zuse/hoon) + ?: !=(new-zuse cur-zuse) + =. cur-zuse new-zuse + =. cur-vanes rehash-vanes + =/ =cage [%helm-reload !>([%zuse tracked-vanes])] + (emit [%pass /kiln/reload/zuse %send our %hood %poke cage]) + (roll tracked-vanes load-vane) + :: + ++ load-vane + =< %_(. con ..load-vane) + |: $:{syd/@tas con/_.} + =. +>.$ con + =/ new-vane q:(hash-vane syd) + ?: =(`new-vane (~(get by cur-vanes) syd)) + +>.$ + =. cur-vanes (~(put by cur-vanes) syd new-vane) + =/ =cage [%helm-reload !>(~[syd])] + (emit %pass /kiln/reload/[syd] %send our %hood %poke cage) + :: + ++ coup-reload + |= {way/wire saw/(unit tang)} + ~? ?=(^ saw) [%kiln-reload-lame u.saw] + +>.$ + -- +:: +++ poke-overload + :: +poke-overload: wipes ford cache at {start}, and then every {recur}. + |= [recur=@dr start=@da] + ?> (gte start now) + abet:(emit %pass /kiln/overload/(scot %dr recur) %meta %c !>([%wait start])) +:: +++ poke-wipe-ford + |=(percent=@ud abet:(emit %pass /kiln %meta %c !>([%wipe percent]))) +:: +++ poke-keep-ford + |= [compiler-cache-size=@ud build-cache-size=@ud] + =< abet + (emit %pass /kiln %meta %c !>([%keep compiler-cache-size build-cache-size])) +:: +++ poke-wash-gall |=(* abet:(emit %pass /kiln %meta %c !>([%wash ~]))) +:: +++ mack + |= {way/wire saw/(unit tang)} + ~? ?=(^ saw) [%kiln-nack u.saw] + abet +:: +++ take-general + |= [=wire =vase] + ?- wire + [%sync %merg *] %+ take-mere-sync t.t.wire + +:(need !<([%mere (each (set path) (pair term tang))] vase)) + [%autoload *] %+ take-writ-autoload t.wire + +:(need !<([%writ riot] vase)) + [%find-ship *] %+ take-writ-find-ship t.wire + +:(need !<([%writ riot] vase)) + [%sync *] %+ take-writ-sync t.wire + +:(need !<([%writ riot] vase)) + [%overload *] %+ take-wake-overload t.wire + +:(need !<([%wake (unit tang)] vase)) + [%autocommit *] %+ take-wake-autocommit t.wire + +:(need !<([%wake (unit tang)] vase)) + * + ?+ -.q.vase ~|([%kiln-bad-take-card -.q.vase] !!) + %mack %+ mack wire + +:(need !<([%mack (unit tang)] vase)) + %made %+ take-made wire + +:(need !<([%made @da made-result:ford] vase)) + %mere %+ take-mere wire + +:(need !<([%mere (each (set path) (pair term tang))] vase)) + == + == +++ take |=(way/wire ?>(?=({@ ~} way) (work i.way))) :: general handler +++ take-mere :: + |= {way/wire are/(each (set path) (pair term tang))} + abet:abet:(mere:(take way) are) +:: +++ take-made + |= [way=wire date=@da result=made-result:ford] + :: hack for |overload + :: + :: We might have gotten an ignorable response back for our cache priming + :: ford call. If it matches our magic wire, ignore it. + :: + ?: =(/prime/cache way) + ~& %cache-primed + abet + abet:abet:(made:(take way) date result) +:: +++ take-coup-fancy :: + |= {way/wire saw/(unit tang)} + abet:abet:(coup-fancy:(take way) saw) +:: +++ take-coup-reload :: + |= {way/wire saw/(unit tang)} + abet:(coup-reload:autoload way saw) +:: +++ take-coup-spam :: + |= {way/wire saw/(unit tang)} + ~? ?=(^ saw) [%kiln-spam-lame u.saw] + abet +:: +++ take-mere-sync :: + |= {way/wire mes/(each (set path) (pair term tang))} + ?> ?=({@ @ @ *} way) + =+ ^- hos/kiln-sync + :* syd=(slav %tas i.way) + her=(slav %p i.t.way) + sud=(slav %tas i.t.t.way) + == + abet:abet:(mere:(auto hos) mes) +:: +++ take-writ-find-ship :: + |= {way/wire rot/riot} + ?> ?=({@ @ @ *} way) + =+ ^- hos/kiln-sync + :* syd=(slav %tas i.way) + her=(slav %p i.t.way) + sud=(slav %tas i.t.t.way) + == + abet:abet:(take-find-ship:(auto hos) rot) +:: +++ take-writ-sync :: + |= {way/wire rot/riot} + ?> ?=({@ @ @ *} way) + =+ ^- hos/kiln-sync + :* syd=(slav %tas i.way) + her=(slav %p i.t.way) + sud=(slav %tas i.t.t.way) + == + abet:abet:(writ:(auto hos) rot) +:: +++ take-writ-autoload + |= {way/wire rot/riot} + ?> ?=(~ way) + ?> ?=(^ rot) + abet:writ:autoload +:: +++ take-wake-overload + |= {way/wire error=(unit tang)} + ?^ error + %- (slog u.error) + ~& %kiln-take-wake-overload-fail + abet + ?> ?=({@ ~} way) + =+ tym=(slav %dr i.way) + ~& %wake-overload-deprecated + abet +:: +++ take-wake-autocommit + |= [way=wire error=(unit tang)] + ?^ error + %- (slog u.error) + ~& %kiln-wake-autocommit-fail + abet + =. nex.commit-timer (add now tim.commit-timer) + =< abet + %- emil + :~ [%pass /commit %meta %c !>([%dirk mon.commit-timer])] + [%pass way.commit-timer %meta %b !>([%wait nex.commit-timer])] + == +:: +:: +++ spam + |= mes/(list tank) + ((slog mes) ..spam) +:: %- emit :: XX not displayed/immediately +:: [%poke /kiln/spam [our %hall] (said our %kiln now eny mes)] +:: +++ auto + |= kiln-sync + =+ (~(gut by syn) [syd her sud] [let=*@ud ust=ost]) + |% + ++ abet + ..auto(syn (~(put by syn) [syd her sud] let ust)) + :: + ++ blab + |= new/(list move:agent:mall) + ^+ +> + +>.$(moz (welp new moz)) + :: + ++ warp + |= [=bone =wire =ship =riff] + (blab [bone %pass wire %meta %c !>([ship riff])] ~) + :: + ++ spam |*(* %_(+> ..auto (^spam +<))) + ++ stop + => (spam (render "ended autosync" sud her syd) ~) + =/ =wire /kiln/sync/[syd]/(scot %p her)/[sud] + (warp ust wire her sud ~) + :: XX duplicate of start-sync? see |track + :: + ++ start-track + => (spam (render "activated track" sud her syd) ~) + =. let 1 + =/ =wire /kiln/sync/[syd]/(scot %p her)/[sud] + (warp ost wire her sud `[%sing %y ud+let /]) + :: + ++ start-sync + => (spam (render "finding ship and desk" sud her syd) ~) + =/ =wire /kiln/find-ship/[syd]/(scot %p her)/[sud] + (warp ost wire her sud `[%sing %y ud+1 /]) + :: + ++ take-find-ship + |= rot=riot + => (spam (render "activated sync" sud her syd) ~) + =/ =wire /kiln/sync/[syd]/(scot %p her)/[sud] + (warp ost wire her sud `[%sing %w [%da now] /]) + :: + ++ writ + |= rot=riot + ?~ rot + =. +>.$ + %^ spam + leaf+"sync cancelled, retrying" + (render "on sync" sud her syd) + ~ + start-sync + =. let ?. ?=($w p.p.u.rot) let ud:;;(cass:clay q.q.r.u.rot) + =/ =wire /kiln/sync/merg/[syd]/(scot %p her)/[sud] + :: germ: merge mode for sync merges + :: + :: Initial merges from any source must use the %init germ. + :: Subsequent merges may use any germ, but if the source is + :: a remote ship with which we have not yet merged, we won't + :: share a merge-base commit and all germs but %that will fail. + :: + :: We want to always use %that for the first remote merge. + :: But we also want local syncs (%base to %home or %kids) + :: to succeed after that first remote sync. To accomplish both + :: we simply use %that for the first three sync merges. + :: (The first two are from the pill.) + :: + =/ =germ + =/ =cass + .^(cass:clay %cw /(scot %p our)/[syd]/(scot %da now)) + ?: =(0 ud.cass) + %init + ?:((gth 3 ud.cass) %that %mate) + =< %- spam + ?: =(our her) ~ + [(render "beginning sync" sud her syd) ~] + (blab [ost %pass wire %meta %c !>([%merg syd her sud ud+let germ])] ~) + :: + ++ mere + |= mes=(each (set path) (pair term tang)) + ?: ?=([%| %bad-fetch-ali *] mes) + =. +>.$ + %^ spam + leaf+"merge cancelled, maybe because sunk; restarting" + (render "on sync" sud her syd) + ~ + start-sync:stop + =. let +(let) + =. +>.$ + %- spam + ?: ?=(%& -.mes) + [(render "sync succeeded" sud her syd) ~] + ?+ p.p.mes + :* (render "sync failed" sud her syd) + leaf+"please manually merge the desks with" + leaf+"|merge %{(trip syd)} {(scow %p her)} %{(trip sud)}" + leaf+"" + leaf+"error code: {}" + q.p.mes + == + :: + $no-ali-disc + :~ (render "sync activated" sud her syd) + leaf+"note: blank desk {} on {}" + == + == + =/ =wire /kiln/sync/[syd]/(scot %p her)/[sud] + (warp ost wire her sud `[%sing %y ud+let /]) + -- +:: +++ work :: state machine + |= syd/desk + =+ ^- per-desk + %+ ~(gut by rem) syd + =+ *per-desk + %_(- cas [%da now]) + |% + ++ abet :: resolve + ..work(rem (~(put by rem) syd auto gem her sud cas)) + :: + ++ blab + |= new/(list move:agent:mall) + ^+ +> + +>.$(moz (welp new moz)) + :: + ++ win . :: successful poke + ++ lose + ^+ . + ~| %kiln-work-fail + . + :: + ++ ford-fail + |=(tan/tang ~|(%ford-fail (mean tan))) + :: + ++ unwrap-tang + |* res/(each * tang) + ?: ?=(%& -.res) + p.res + (ford-fail p.res) + :: + ++ perform :: + ^+ . + (blab [ost %pass /kiln/[syd] %meta %c !>([%merg syd her sud cas gem])] ~) + :: + ++ fancy-merge :: send to self + |= {syd/desk her/@p sud/desk gem/?($auto germ)} + ^+ +> + =/ =cage [%kiln-merge !>([syd her sud cas gem])] + %- blab :_ ~ + [ost %pass /kiln/fancy/[^syd] %send our %hood %poke cage] + :: + ++ spam ::|=(tang ((slog +<) ..spam)) + |*(* +>(..work (^spam +<))) + ++ merge + |= {her/@p sud/@tas cas/case gim/?($auto germ)} + ^+ +> + ?. ?=($auto gim) + perform(auto |, gem gim, her her, cas cas, sud sud) + ?: =(0 ud:.^(cass:clay %cw /(scot %p our)/[syd]/(scot %da now))) + => $(gim %init) + .(auto &) + => $(gim %fine) + .(auto &) + :: + ++ coup-fancy + |= saw/(unit tang) + ?~ saw + => (spam leaf+"%melding %{(trip sud)} into scratch space" ~) + %- blab :_ ~ + =/ =vase !>([%merg (cat 3 syd '-scratch') her sud cas gem]) + [ost %pass /kiln/[syd] %meta %c vase] + =+ :- "failed to set up conflict resolution scratch space" + "I'm out of ideas" + lose:(spam leaf+-< leaf+-> u.saw) + :: + ++ mere + |= are/(each (set path) (pair term tang)) + ^+ +> + ?: =(%meld gem) + ?: ?=(%& -.are) + ?. auto + =+ "merged with strategy {}" + win:(spam leaf+- ?~(p.are ~ [>`(set path)`p.are< ~])) + :: ~? > =(~ p.are) [%mere-no-conflict syd] + =+ "mashing conflicts" + => .(+>.$ (spam leaf+- ~)) + =+ tic=(cat 3 syd '-scratch') + %- blab :_ ~ + =, ford + :* ost %pass /kiln/[syd] %meta %f !> + :* %build live=%.n + ^- schematic + :- %list + ^- (list schematic) + :: ~& > kiln-mashing+[p.are syd=syd +<.abet] + %+ turn ~(tap in p.are) + |= pax/path + ^- [schematic schematic] + :- [%$ %path -:!>(*path) pax] + =/ base=schematic [%scry %c %x `rail`[[our tic] (flop pax)]] + ?> ?=([%da @] cas) + =/ alis=schematic + [%pin p.cas `schematic`[%scry %c %x [[our syd] (flop pax)]]] + =/ bobs=schematic + [%scry %c %x [[our syd] (flop pax)]] + =/ dali=schematic [%diff [our syd] base alis] + =/ dbob=schematic [%diff [our syd] base bobs] + =+ ^- for/mark + =+ (slag (dec (lent pax)) pax) + ?~(- %$ i.-) + ^- schematic + [%mash [our tic] for [[her sud] for dali] [[our syd] for dbob]] + == == + =+ "failed to merge with strategy meld" + lose:(spam leaf+- >p.p.are< q.p.are) + ?: ?=(%& -.are) + =+ "merged with strategy {}" + win:(spam leaf+- ?~(p.are ~ [>`(set path)`p.are< ~])) + ?. auto + =+ "failed to merge with strategy {}" + lose:(spam leaf+- >p.p.are< q.p.are) + ?+ gem + (spam leaf+"strange auto" >gem< ~) + :: + $init + =+ :- "auto merge failed on strategy %init" + "I'm out of ideas" + lose:(spam leaf+-< leaf+-> [>p.p.are< q.p.are]) + :: + $fine + ?. ?=($bad-fine-merge p.p.are) + =+ "auto merge failed on strategy %fine" + lose:(spam leaf+- >p.p.are< q.p.are) + => (spam leaf+"%fine merge failed, trying %meet" ~) + perform(gem %meet) + :: + $meet + ?. ?=($meet-conflict p.p.are) + =+ "auto merge failed on strategy %meet" + lose:(spam leaf+- >p.p.are< q.p.are) + => (spam leaf+"%meet merge failed, trying %mate" ~) + perform(gem %mate) + :: + $mate + ?. ?=($mate-conflict p.p.are) + =+ "auto merge failed on strategy %mate" + lose:(spam leaf+- >p.p.are< q.p.are) + => .(gem %meld) + =+ tic=(cat 3 syd '-scratch') + => =+ :- "%mate merge failed with conflicts," + "setting up scratch space at %{(trip tic)}" + [tic=tic (spam leaf+-< leaf+-> q.p.are)] + (fancy-merge tic our syd %init) + == + :: + ++ tape-to-tanks + |= a/tape ^- (list tank) + (scan a (more (just '\0a') (cook |=(a/tape leaf+a) (star prn)))) + :: + ++ tanks-if-any + |= {a/tape b/(list path) c/tape} ^- (list tank) + ?: =(~ b) ~ + (welp (tape-to-tanks "\0a{c}{a}") >b< ~) + :: + ++ made + |= [date=@da result=made-result:ford] + :: |= {dep/@uvH reg/gage:ford} + ^+ +> + :: + ?: ?=([%incomplete *] result) + =+ "failed to mash" + lose:(spam leaf+- tang.result) + ?: ?=([%complete %error *] result) + =+ "failed to mash" + lose:(spam leaf+- message.build-result.result) + ?> ?=([%complete %success %list *] result) + =+ ^- can/(list (pair path (unit miso))) + %+ turn results.build-result.result + |= res=build-result:ford + ^- (pair path (unit miso)) + ?> ?=([%success ^ *] res) + ~! res + =+ pax=(result-to-cage:ford head.res) + =+ dif=(result-to-cage:ford tail.res) + :: + ?. ?=($path p.pax) + ~| "strange path mark: {}" + !! + [;;(path q.q.pax) ?:(?=($null p.dif) ~ `[%dif dif])] + :: ~& > kiln-made+[(turn can head) syd=syd +<.abet] + =+ notated=(skid can |=({path a/(unit miso)} ?=(^ a))) + =+ annotated=(turn `(list (pair path *))`-.notated head) + =+ unnotated=(turn `(list (pair path *))`+.notated head) + =+ `desk`(cat 3 syd '-scratch') + =+ ^- tan/(list tank) + %- zing + ^- (list (list tank)) + :~ %- tape-to-tanks + """ + done setting up scratch space in {<[-]>} + please resolve the following conflicts and run + |merge {} our {<[-]>} + """ + %^ tanks-if-any + "annotated conflicts in:" annotated + "" + %^ tanks-if-any + "unannotated conflicts in:" unnotated + """ + some conflicts could not be annotated. + for these, the scratch space contains + the most recent common ancestor of the + conflicting content. + + """ + == + =< win + %- blab:(spam tan) + :_ ~ + :* ost %pass /kiln/[syd] %meta %c !> + :* %info + (cat 3 syd '-scratch') %& + %+ murn can + |= {p/path q/(unit miso)} + `(unit (pair path miso))`?~(q ~ `[p u.q]) + == == + -- +-- From 7f5ac366c9a0174919e1b5d13f0191ddb79ed7f2 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 5 Sep 2019 21:35:42 -0700 Subject: [PATCH 135/451] mall: convert write to mall --- pkg/arvo/age/hood.hoon | 25 ++++-- pkg/arvo/lib/hood/write-mall.hoon | 129 ++++++++++++++++++++++++++++++ 2 files changed, 146 insertions(+), 8 deletions(-) create mode 100644 pkg/arvo/lib/hood/write-mall.hoon diff --git a/pkg/arvo/age/hood.hoon b/pkg/arvo/age/hood.hoon index d7132e0c2..0bb57903b 100644 --- a/pkg/arvo/age/hood.hoon +++ b/pkg/arvo/age/hood.hoon @@ -12,7 +12,7 @@ :: they have been bundled into :hood :: :: |command handlers - hood-helm-mall, hood-kiln-mall, hood-drum-mall, hood-write + hood-helm-mall, hood-kiln-mall, hood-drum-mall, hood-write-mall :: :: :: :::: :: :: :: :: :: @@ -49,7 +49,7 @@ $drum ?>(?=($drum -.paw) `part:hood-drum-mall`paw) $helm ?>(?=($helm -.paw) `part:hood-helm-mall`paw) $kiln ?>(?=($kiln -.paw) `part:hood-kiln-mall`paw) - $write ?>(?=($write -.paw) `part:hood-write`paw) + $write ?>(?=($write -.paw) `part:hood-write-mall`paw) == -- ++ hood-head _-:$:hood-part :: initialize state @@ -60,7 +60,7 @@ $drum (make:hood-drum-mall our) $helm *part:hood-helm-mall $kiln *part:hood-kiln-mall - $write *part:hood-write + $write *part:hood-write-mall == -- ++ hood-part-old hood-part :: old state for ++prep @@ -72,7 +72,7 @@ $% {$drum $2 pith-2:hood-drum-mall} :: {$helm $0 pith:hood-helm-mall} :: {$kiln $0 pith:hood-kiln-mall} :: - {$write $0 pith:hood-write} :: + {$write $0 pith:hood-write-mall} :: == :: -- :: :: :: :: @@ -124,7 +124,7 @@ ++ from-drum (from-module %drum [..$ _se-abet]:(hood-drum-mall)) ++ from-helm (from-module %helm [..$ _abet]:(hood-helm-mall)) ++ from-kiln (from-module %kiln [..$ _abet]:(hood-kiln-mall)) - ++ from-write (from-module %write [..$ _abet]:(hood-write)) + ++ from-write (from-module %write [..$ _abet]:(hood-write-mall)) -- |_ hid/bowl:mall :: gall environment ++ handle-init @@ -237,6 +237,14 @@ (need !<([desk ship desk] vase)) %kiln-permission %- (wrap poke-permission):from-kiln:h (need !<([desk path ?] vase)) + %write-sec-atom %- (wrap poke-sec-atom):from-write:h + (need !<([host:eyre @] vase)) + %write-paste %- (wrap poke-paste):from-write:h + (need !<([?(%hoon %md %txt) @t] vase)) + %write-tree %- (wrap poke-tree):from-write:h + (need !<([path mime] vase)) + %write-wipe %- (wrap poke-wipe):from-write:h + (need !<(path vase)) == [moves ..handle-init] :: @@ -290,9 +298,10 @@ =/ h (help hid) =^ moves lac ?+ wire ~|([%hood-bad-wire wire] !!) - [%helm *] ((wrap take):from-helm:h t.wire vase) - [%drum *] ((wrap take):from-drum:h t.wire vase) - [%kiln *] ((wrap take-general):from-kiln:h t.wire vase) + [%helm *] ((wrap take):from-helm:h t.wire vase) + [%drum *] ((wrap take):from-drum:h t.wire vase) + [%kiln *] ((wrap take-general):from-kiln:h t.wire vase) + [%write *] ((wrap take):from-write:h t.wire vase) == [moves ..handle-init] :: diff --git a/pkg/arvo/lib/hood/write-mall.hoon b/pkg/arvo/lib/hood/write-mall.hoon new file mode 100644 index 000000000..65e944d25 --- /dev/null +++ b/pkg/arvo/lib/hood/write-mall.hoon @@ -0,0 +1,129 @@ +:: File writer module +:: +:::: /hoon/write/hood/lib + :: +/? 310 +=, format +=* as-octs as-octs:mimes:html +=, space:userlib +|% ++$ part {$write $0 pith} :: no state ++$ pith ~ +-- +:: +:::: + :: +|% +++ data $%({$json json} {$mime mime}) +-- +:: +:::: + :: +|= {bowl:gall part} +=* par +<+ +|_ moz/(list move:agent:mall) +++ abet [(flop moz) `part`par] +++ emit + |= a/(wind internal-note:mall internal-gift:mall) + %_(+> moz :_(moz [ost a])) +:: +++ beak-now byk(r [%da now]) +++ poke-wipe + |= sup/path ^+ abet :: XX determine extension, beak + =+ ext=%md + ?~ (file (en-beam beak-now [ext sup])) + ~|(not-found+[ext `path`(flop sup)] !!) + =- abet:(emit %pass /write %meta %c !>([%info -])) + (fray (en-beam beak-now [ext sup])) +:: +++ poke-tree + |= {sup/path mim/mime} ^+ abet :: XX determine extension, beak + (poke--data [`%md (flop sup)] %mime mim) +:: +++ poke-paste + |= {typ/?($hoon $md $txt) txt/@t} ^+ abet + (poke--data [`typ /web/paste/(scot %da now)] %mime / (as-octs txt)) +:: +++ poke-comment + |= {sup/path him/ship txt/@t} ^+ abet + =+ pax=(welp (flop sup) /comments/(scot %da now)) + =. txt + %+ rap 3 :~ + '## `' (scot %p him) '`' + '\0a' txt + == + (poke--data [`%md pax] %mime / (as-octs txt)) +:: +++ poke-fora-post + |= {sup/path him/ship hed/@t txt/@t} ^+ abet + =+ pax=(welp (flop sup) /posts/(cat 3 (scot %da now) '~')) + =. txt + %- crip + """ + --- + type: post + date: {} + title: {(trip hed)} + author: {} + navsort: bump + navuptwo: true + comments: reverse + --- + + {(trip txt)} + """ + (poke--data [`%md pax] %mime / (as-octs txt)) +:: +++ ames-secret + ^- @t + =- (crip +:<.^(@p %j pax)>) + pax=/(scot %p our)/code/(scot %da now)/(scot %p our) +:: +++ poke-sec-atom + |= {hot/host:eyre dat/@} + ?> ?=(%& -.hot) + =. p.hot (scag 2 p.hot) :: ignore subdomain + =. dat (scot %uw (en:crub:crypto ames-secret dat)) + (poke--data [`%atom [%sec p.hot]] %mime / (as-octs dat)) +:: +++ poke--data + |= {{ext/(unit @t) pax/path} dat/data} ^+ abet + ?~ ext $(ext [~ -.dat]) + =+ cay=?-(-.dat $json [-.dat !>(+.dat)], $mime [-.dat !>(+.dat)]) + ?: =(u.ext -.dat) + (made pax now [%complete %success %$ cay]) + =< abet + %- emit :* + %pass write+pax %meta %f !> + :* %build + live=%.n :: XX defer %nice + ^- schematic:ford :: SYNTAX ERROR AT START OF LINE? + =/ =beak beak-now + [%cast [p q]:beak u.ext [%$ cay]] + == == +:: +++ made + |= [pax=wire date=@da result=made-result:ford] + ^+ abet + :: |= {pax/wire @ res/gage:ford} ^+ abet + :: ?. =(our src) + :: ~|(foreign-write/[our=our src=src] !!) + ?: ?=(%incomplete -.result) + (mean tang.result) + :: + =/ build-result build-result.result + :: + ?: ?=([%error *] build-result) + (mean message.build-result) + :: + =/ =cage (result-to-cage:ford build-result) + :: + =- abet:(emit %pass /write %meta %c !>([%info -])) + :: + (foal :(welp (en-beam beak-now ~) pax /[-.cage]) cage) +:: +++ take :: + |= [=wire =vase] + %+ made wire + +:(need !<([%made @da made-result:ford] vase)) +-- From ca8c3e0910598a4eed0bf8537c739115db89043b Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Fri, 6 Sep 2019 12:34:04 -0700 Subject: [PATCH 136/451] mall: convert dojo to mall --- pkg/arvo/age/dojo.hoon | 1213 ++++++++++++++++++++++++++++++++++++++++ pkg/arvo/app/cop.hoon | 2 +- pkg/arvo/app/hood.hoon | 1 - pkg/arvo/sys/zuse.hoon | 3 +- 4 files changed, 1216 insertions(+), 3 deletions(-) create mode 100644 pkg/arvo/age/dojo.hoon diff --git a/pkg/arvo/age/dojo.hoon b/pkg/arvo/age/dojo.hoon new file mode 100644 index 000000000..2d4fbe578 --- /dev/null +++ b/pkg/arvo/age/dojo.hoon @@ -0,0 +1,1213 @@ +:: :: :: +:::: /hoon/dojo/app :: :::: + :: :: :: +/? 309 :: arvo kelvin +/- sole, lens :: console structures +/+ sole :: console library +=, sole +:: :: :: +:::: :: :::: + :: :: :: +=> |% :: external structures + ++ house :: all state + $: $5 + egg/@u :: command count + hoc/(map bone session) :: conversations + == :: + ++ session :: per conversation + $: say/sole-share :: command-line state + dir/beam :: active path + poy/(unit dojo-project) :: working + $: :: sur: structure imports + :: + sur=(list cable:ford) + :: lib: library imports + :: + lib=(list cable:ford) + == + var/(map term cage) :: variable state + old/(set term) :: used TLVs + buf/tape :: multiline buffer + == :: + ++ monkey :: per conversation + $: say/sole-share :: command-line state + dir/beam :: active path + poy/(unit dojo-project) :: working + var/(map term cage) :: variable state + old/(set term) :: used TLVs + buf/tape :: multiline buffer + == :: + ++ dojo-command :: + $^ (pair dojo-sink dojo-source) :: route value + {$brev p/term} :: unbind variable + :: + ++ dojo-sink :: + $% {$flat p/path} :: atom to unix + {$pill p/path} :: noun to unix pill + :: {$tree p/path} :: noun to unix tree + {$file p/beam} :: save to clay + $: $http :: http outbound + p/?($post $put) + r/@t + == + {$poke p/goal} :: poke app + {$show p/?($0 $1 $2 $3 $4 $5)} :: val/type/hoon/xray + {$verb p/term} :: store variable + == :: + ++ dojo-source :: construction node + $: p/@ud :: assembly index + q/dojo-build :: general build + == :: + ++ dojo-build :: one arvo step + $~ [%ex *hoon] + $% {$ur p/@t} :: http GET request + {$ge p/dojo-model} :: generator + {$dv p/path} :: core from source + {$ex p/hoon} :: hoon expression + {$sa p/mark} :: example mark value + {$as p/mark q/dojo-source} :: simple transmute + {$do p/hoon q/dojo-source} :: gate apply + {$tu p/(list dojo-source)} :: tuple + == :: + ++ dojo-model :: data construction + $: p/dojo-server :: core source + q/dojo-config :: configuration + == :: + ++ dojo-server :: numbered device + $: p/@ud :: assembly index + q/path :: gate path + == :: + ++ dojo-config :: configuration + $: p/(list dojo-source) :: by order + q/(map term (unit dojo-source)) :: by keyword + == :: + ++ dojo-project :: construction state + $: mad/dojo-command :: operation + num/@ud :: number of tasks + cud/(unit dojo-source) :: now solving + pux/(unit path) :: ford working + pro/(unit vase) :: prompting loop + per/(unit sole-edit) :: pending reverse + job/(map @ud dojo-build) :: problems + rez/(map @ud cage) :: results + == :: + ++ bead {p/(set beam) q/cage} :: computed result + ++ goal {p/ship q/term} :: flat application + ++ clap :: action, user + $% {$peer p/path} :: subscribe + {$poke p/(cask)} :: apply + {$pull ~} :: unsubscribe + == :: + ++ club :: action, system + $% {$peer p/path} :: subscribe + {$poke p/cage} :: apply + {$pull ~} :: unsubscribe + == :: + ++ sign :: + $% :: %made: build result; response to %build +task + :: + $: %made + :: date: formal date of the build + :: + date=@da + :: result: result of the build; either complete build, or error + :: + $= result + $% :: %complete: contains the result of the completed build + :: + [%complete build-result=build-result:ford] + :: %incomplete: couldn't finish build; contains error message + :: + [%incomplete =tang] + == == + {$unto p/internal-gift:gall} + == + -- +=> +|% +:: |parser-at: parsers for dojo expressions using :dir as working directory +:: +++ parser-at + |= [our=ship dir=beam] + |% + ++ default-app %hood + ++ hoon-parser (vang | (en-beam:format dir)) + ++ our p.dir + :: + ++ parse-command-line ;~(sfix parse-command (star ace) (just '\0a')) + :: + ++ to-command + |= [gol=goal mod=dojo-model] + ^- dojo-command + [[%poke gol] [0 [%ge mod(q.p [q.gol q.p.mod])]]] + :: + ++ parse-variable + |* [sym=rule src=rule] + %+ cook + |= {a/term b/(unit dojo-source)} + ^- dojo-command + ?~(b [%brev a] [[%verb a] u.b]) + ;~(plug sym (punt src)) + :: + ++ parse-command + :: =< ;~(less |-(;~(pose (jest '|*') ;~(pfix next (knee ** |.(^$))))) .) + %+ knee *dojo-command |. ~+ + ;~ pose + ;~ pfix bar + %+ cook to-command + (stag `goal`[our default-app] parse-model) + == + :: + ;~ pfix col + %+ cook + |= {a/goal b/$^(dojo-model dojo-source)} + ?@ -.b [[%poke a] b] + (to-command a b) + ;~ plug + parse-goal + ;~ pose + ;~(pfix bar parse-model) + ;~(pfix ace parse-source) + == + == + == + :: + ;~ pfix tis + ;~ pose + (parse-variable (jest %dir) ;~(pfix ace :(stag 0 %ex parse-rood))) + (parse-variable sym ;~(pfix ace parse-source)) + == + == + :: + ;~ pfix net + ;~ pose + (parse-variable (cold %sur hep) ;~(pfix gap parse-cables)) + (parse-variable (cold %lib lus) ;~(pfix gap parse-cables)) + == + == + :: + ;~((glue ace) parse-sink parse-source) + (stag [%show %0] parse-source) + == + :: + ++ parse-sink + ;~ pose + ;~(plug (cold %file tar) parse-beam) + ;~(plug (cold %flat vat) (most net sym)) + ;~(plug (cold %pill dot) (most net sym)) + ;~(plug (cold %http lus) (stag %post parse-url)) + ;~(plug (cold %http hep) (stag %put parse-url)) + (stag %show (cook $?($1 $2 $3 $4 $5) (cook lent (stun [1 5] wut)))) + == + :: + ++ parse-cables + %+ cook + |= cables=(list cable:ford) + :+ 0 %ex + ^- hoon + :: + :- %clsg + %+ turn cables + |= cable=cable:ford + ^- hoon + :: + :+ %clhp + ?~ face.cable + [%rock %n ~] + [%clhp [%rock %n ~] [%sand %tas u.face.cable]] + [%sand %tas file-path.cable] + (most ;~(plug com gaw) parse-cable) + :: + ++ parse-cable + %+ cook |=(a=cable:ford a) + ;~ pose + (stag ~ ;~(pfix tar sym)) + (cook |=([face=term tis=@ file=term] [`face file]) ;~(plug sym tis sym)) + (cook |=(a=term [`a a]) sym) + == + ++ parse-source (stag 0 parse-build) + ++ parse-build + %+ knee *dojo-build |. ~+ + ;~ pose + ;~(plug (cold %ur lus) parse-url) + ;~(plug (cold %ge lus) parse-model) + ;~(plug (cold %as pad) sym ;~(pfix ace parse-source)) + ;~(plug (cold %do cab) parse-hoon ;~(pfix ace parse-source)) + parse-value + == + :: + ++ parse-goal + %+ cook |=(a/goal a) + ;~ pose + ;~ plug + ;~(pfix sig fed:ag) + ;~(pose ;~(pfix net sym) (easy default-app)) + == + %+ stag our + ;~(pose sym (easy default-app)) + == + :: + ++ parse-beam + %+ cook + |= a=path + :: hack: fixup paths that come out of the hoon parser + :: + :: We currently invoke the hoon parser to read relative paths from + :: the command line, and this parser will produce leading ~ path + :: components with paths that start with a `/`. + :: + :: This entire path is nuts and we shouldn't be representing paths + :: as arbitrary hoons. + :: + =? a &(?=(^ a) =('' i.a)) + t.a + (fall (de-beam:format a) [`beak`[p q r]:dir (flop a)]) + =+ vez=hoon-parser + (sear plex:vez (stag %clsg poor:vez)) + :: + ++ parse-iden-url + %+ cook + |=([a=(unit knot) b=purl:eyre] [`(fall a *knot) b]) + auru:de-purl:html + :: + ++ parse-url + %+ cook + |=(a=purl:eyre (crip (en-purl:html a))) + auri:de-purl:html + :: + ++ parse-model ;~(plug parse-server parse-config) + ++ parse-server (stag 0 (most net sym)) + ++ parse-hoon tall:hoon-parser + :: + ++ parse-rood + :: XX should this use +hoon-parser instead to normalize the case? + :: + => (vang | (en-beam:format dir)) + ;~ pose + rood + :: + :: XX refactor ++scat + :: + =- ;~(pfix cen (stag %clsg -)) + %+ sear |=([a=@ud b=tyke] (posh ~ ~ a b)) + ;~ pose + porc + (cook |=(a=(list) [(lent a) ~]) (star cen)) + == + == + ++ parse-value + ;~ pose + (stag %sa ;~(pfix tar pad sym)) + (stag %ex parse-hoon) + (stag %tu (ifix [lac rac] (most ace parse-source))) + == + :: + ++ parse-config + ;~ plug + (star ;~(pfix ace (stag 0 parse-value))) + %+ cook + ~(gas by *(map term (unit dojo-source))) + %- star + ;~ plug + ;~(pfix com ace tis sym) + (punt ;~(pfix ace (stag 0 parse-value))) + == + == + -- +-- +:: :: +:::: :: + :: :: +=, gall +=+ foo=*monkey +=| house :: program state +=* state - +++ he :: per session + |_ {hid/bowl:mall moz/(list move:agent:mall) session} + :: + ++ he-beam + ^- beam + ?. =([%ud 0] r.dir) + dir + dir(r [%da now.hid]) + :: + ++ he-disc `disc:ford`[p q]:he-beam + ++ he-beak `beak`[p q r]:he-beam + ++ he-rail `rail:ford`[[p q] s]:he-beam + ++ he-parser (parser-at our.hid he-beam) + :: + ++ dy :: project work + |_ dojo-project :: + ++ dy-abet +>(poy `+<) :: resolve + ++ dy-amok +>(poy ~) :: terminate + ++ dy-ford :: send work to ford + |= [way=wire schematic=schematic:ford] + ^+ +>+> + ?> ?=($~ pux) + :: pin all builds to :now.hid so they don't get cached forever + :: + %- he-card(poy `+>+<(pux `way)) + [%pass way %meta %f !>([%build live=%.n schematic])] + :: + ++ dy-request + |= [way=wire =request:http] + ^+ +>+> + ?> ?=(~ pux) + %- he-card(poy `+>+<(pux `way)) + [%pass way %meta %l !>([%request request *outbound-config:iris])] + :: + ++ dy-stop :: stop work + ^+ +> + =. poy ~ + ?~ pux +> + %. [%txt "! cancel {}"] + he-diff:(he-card [%pass u.pux %meta %f !>([%kill ~])) + :: + ++ dy-slam :: call by ford + |= {way/wire gat/vase sam/vase} + ^+ +>+> + (dy-ford way `schematic:ford`[%call [%$ %noun gat] [%$ %noun sam]]) + :: + ++ dy-errd :: reject change, abet + |= {rev/(unit sole-edit) err/@u} + ^+ +>+> + (he-errd(poy `+>+<) rev err) + :: + ++ dy-diff :: send effects, abet + |= fec/sole-effect + ^+ +>+> + (he-diff(poy `+>+<) fec) + :: + ++ dy-rash :: send effects, amok + |= fec/sole-effect + ^+ +>+> + (he-diff(poy ~) fec) + :: + ++ dy-init-command :: ++dojo-command + |= mad/dojo-command + ^+ [mad +>] + ?@ -.mad [mad +>.$] + =. q.mad + ?+(-.p.mad q.mad $http [0 %as %mime q.mad]) + =^ src +>.$ (dy-init-source q.mad) + [mad(q src) +>.$] + :: + ++ dy-init-source :: ++dojo-source + |= src/dojo-source + ^+ [src +>] + =^ bul +> (dy-init-build q.src) + =: p.src num + q.src bul + == + [src +>.$(num +(num), job (~(put by job) -.src +.src))] + :: + ++ dy-init-source-unit :: (unit dojo-source) + |= urc/(unit dojo-source) + ^+ [urc +>] + ?~ urc [~ +>] + =^ src +> (dy-init-source u.urc) + [`src +>.$] + :: + ++ dy-init-build :: ++dojo-build + |= bul/dojo-build + ^+ [bul +>] + ?- -.bul + $ex [bul +>.$] + $dv [bul +>.$] + $sa [bul +>.$] + $as =^(mor +>.$ (dy-init-source q.bul) [bul(q mor) +>.$]) + $do =^(mor +>.$ (dy-init-source q.bul) [bul(q mor) +>.$]) + $ge =^(mod +>.$ (dy-init-model p.bul) [[%ge mod] +>.$]) + $ur [bul +>.$] + $tu =^ dof +>.$ + |- ^+ [p.bul +>.^$] + ?~ p.bul [~ +>.^$] + =^ dis +>.^$ (dy-init-source i.p.bul) + =^ mor +>.^$ $(p.bul t.p.bul) + [[dis mor] +>.^$] + [[%tu dof] +>.$] + == + :: + ++ dy-init-model :: ++dojo-model + |= mol/dojo-model + ^+ [mol +>] + =^ one +>.$ (dy-init-server p.mol) + =^ two +>.$ (dy-init-config q.mol) + [[one two] +>.$] + :: + ++ dy-init-server :: ++dojo-server + |= srv/dojo-server + =. p.srv num + [srv +>.$(num +(num), job (~(put by job) num [%dv [%gen q.srv]]))] + :: + ++ dy-init-config :: prepare config + |= cig/dojo-config + ^+ [cig +>] + =^ ord +>.$ (dy-init-ordered p.cig) + =^ key +>.$ (dy-init-named q.cig) + [[ord key] +>.$] + :: + ++ dy-init-ordered :: (list dojo-source) + |= ord/(list dojo-source) + ^+ [ord +>] + ?~ ord [~ +>.$] + =^ fir +>.$ (dy-init-source i.ord) + =^ mor +>.$ $(ord t.ord) + [[fir mor] +>.$] + :: + ++ dy-init-named :: (map @tas dojo-src) + |= key/(map term (unit dojo-source)) + ^+ [key +>.$] + ?~ key [~ +>.$] + =^ top +>.$ (dy-init-source-unit q.n.key) + =^ lef +>.$ $(key l.key) + =^ rit +>.$ $(key r.key) + [[[p.n.key top] lef rit] +>.$] + :: + ++ dy-init :: full initialize + ^+ . + =^(dam . (dy-init-command mad) +(mad dam)) + :: + ++ dy-hand :: complete step + |= cag/cage + ^+ +>+> + ?> ?=(^ cud) + (dy-step(cud ~, rez (~(put by rez) p.u.cud cag)) +(p.u.cud)) + :: + ++ dy-meal :: vase to cage + |= vax/vase + ?. &(?=(@ -.q.vax) ((sane %tas) -.q.vax)) + ~& %dy-meal-cage + (dy-rash %bel ~) + (dy-hand -.q.vax (slot 3 vax)) + :: + ++ dy-made-edit :: sole edit + |= cag/cage + ^+ +>+> + ?> ?=(^ per) + ?: ?| ?=(^ q.q.cag) + =((lent buf.say) q.q.cag) + !&(?=($del -.u.per) =(+(p.u.per) (lent buf.say))) + == + dy-abet(per ~) + (dy-errd(per ~) per q.q.cag) + :: + ++ dy-done :: dialog submit + |= txt/tape + ?: |(?=(^ per) ?=(^ pux) ?=(~ pro)) + ~& %dy-no-prompt + (dy-diff %bel ~) + (dy-slam /dial u.pro !>(txt)) + :: + ++ dy-cast + |* {typ/_* bun/vase} + |= a/vase ^- typ + ~| [p.bun p.a] + ?> (~(nest ut p.bun) & p.a) + ;;(typ q.a) + :: + ++ dy-over :: finish construction + ^+ +> + :: XX needs filter + :: + :: ?: ?=({$show $3} -.mad) + :: (dy-rash %tan (dy-show-source q.mad) ~) :: XX separate command + ?: ?=($brev -.mad) + =. var (~(del by var) p.mad) + =< dy-amok + ?+ p.mad . + $?($eny $now $our) !! + $lib .(lib ~) + $sur .(sur ~) + $dir .(dir [[our.hid %home ud+0] /]) + == + =+ cay=(~(got by rez) p.q.mad) + ?- -.p.mad + $verb + =. var (~(put by var) p.p.mad cay) + ~| bad-set+[p.p.mad p.q.cay] + =< dy-amok + ?+ p.p.mad . + $eny ~|(%entropy-is-eternal !!) + $now ~|(%time-is-immutable !!) + $our ~|(%self-is-immutable !!) + $lib + %_ . + lib + ((dy-cast (list cable:ford) !>(*(list cable:ford))) q.cay) + == + :: + $sur + %_ . + sur + ((dy-cast (list cable:ford) !>(*(list cable:ford))) q.cay) + == + :: + $dir =+ ^= pax ^- path + =+ pax=((dy-cast path !>(*path)) q.cay) + ?: ?=(~ pax) ~[(scot %p our.hid) %home '0'] + ?: ?=({@ ~} pax) ~[i.pax %home '0'] + ?: ?=({@ @ ~} pax) ~[i.pax i.t.pax '0'] + pax + =. dir (need (de-beam:format pax)) + =- +>(..dy (he-diff %tan - ~)) + rose+[" " `~]^~[leaf+"=%" (smyt (en-beam:format he-beak s.dir))] + == + :: + $poke + %- he-card(poy ~) + :* %pass + /poke + %send + our.hid + p.p.p.mad + q.p.p.mad + %poke + cay + == + :: + $file + %- he-card(poy ~) + :* %pass /file %meta %c !> + [%info (foal:space:userlib (en-beam:format p.p.mad) cay)] + == + :: + $flat + ?^ q.q.cay + (dy-rash %tan [%leaf "not an atom"]~) + (dy-rash %sav p.p.mad q.q.cay) + :: + $pill + (dy-rash %sag p.p.mad q.q.cay) + :: + $http + ?> ?=($mime p.cay) + =+ mim=;;(mime q.q.cay) + %+ dy-request /show + :* ?:(=(%put p.p.mad) %'PUT' %'POST') + r.p.mad + ~[['content-type' (en-mite:mimes:html p.mim)]] + `q.mim + == + :: + $show + |^ (prnt cay note) + ++ prnt ?: (gte p.p.mad 4) + dy-xprint + dy-print + ++ note ^- tang + ?- p.p.mad + %0 ~ + %1 [[%rose [~ " " ~] (skol p.q.cay) ~] maar] + :: XX actually print something meaningful here + :: + %2 [[%rose [~ " " ~] *tank ~] maar] + %3 ~ + %4 ~ + %5 [[%rose [~ " " ~] (xskol p.q.cay) ~] maar] + == + ++ maar ?: =(%noun p.cay) ~ + [[%rose [~ " " ~] >p.cay< ~] ~] + -- + == + :: + ++ dy-show |=(cay/cage (dy-print cay ~)) + :: + :: Print a value (given as a cage) and a note (given as a tang). + :: + ++ dy-xprint + |= {cay/cage tan/tang} + %+ dy-rash %tan + %- welp :_ tan + ?+ p.cay [(xsell q.cay)]~ + $tang ;;(tang q.q.cay) + $httr + =+ hit=;;(httr:eyre q.q.cay) + =- (flop (turn `wall`- |=(a/tape leaf+(dash:us a '' ~)))) + :- "HTTP {}" + %+ weld + (turn q.hit |=({a/@t b/@t} "{(trip a)}: {(trip b)}")) + :- i="" + t=(turn `wain`?~(r.hit ~ (to-wain:format q.u.r.hit)) trip) + == + :: + :: Print a value (given as a cage) and a note (given as a tang). + :: + ++ dy-print + |= {cay/cage tan/tang} + %+ dy-rash %tan + %- welp :_ tan + ?+ p.cay [(sell q.cay)]~ + $tang ;;(tang q.q.cay) + $httr + =+ hit=;;(httr:eyre q.q.cay) + =- (flop (turn `wall`- |=(a/tape leaf+(dash:us a '' ~)))) + :- "HTTP {}" + %+ weld + (turn q.hit |=({a/@t b/@t} "{(trip a)}: {(trip b)}")) + :- i="" + t=(turn `wain`?~(r.hit ~ (to-wain:format q.u.r.hit)) trip) + == + :: + ++ dy-edit :: handle edit + |= cal/sole-change + ^+ +>+> + =^ dat say (~(transceive sole say) cal) + ?: |(?=(^ per) ?=(^ pux) ?=(~ pro)) + ~& %dy-edit-busy + =^ lic say (~(transmit sole say) dat) + (dy-diff %mor [%det lic] [%bel ~] ~) + (dy-slam(per `dat) /edit u.pro !>((tufa buf.say))) + :: + ++ dy-type :: sole action + |= act/sole-action + ?- -.act + $det (dy-edit +.act) + $ret (dy-done (tufa buf.say)) + $clr dy-stop + == + :: + ++ dy-cage |=(num/@ud (~(got by rez) num)) :: known cage + ++ dy-vase |=(num/@ud q:(dy-cage num)) :: known vase + ++ dy-silk-vase |=(vax/vase [%$ %noun vax]) :: vase to silk + ++ dy-silk-sources :: arglist to silk + |= src/(list dojo-source) + ^- schematic:ford + :: + :+ %$ %noun + |- + ?~ src !>(~) + (slop (dy-vase p.i.src) $(src t.src)) + :: + ++ dy-silk-config :: configure + |= {cay/cage cig/dojo-config} + ^- [wire schematic:ford] + ?. (~(nest ut [%cell [%atom %$ ~] %noun]) | p.q.cay) + :: + :: naked gate + :: + ?. &(?=({* ~} p.cig) ?=(~ q.cig)) + ~|(%one-argument !!) + :- /noun + :+ %call [%$ %noun q.cay] + [%$ %noun (dy-vase p.i.p.cig)] + :: + :: normal generator + :: + :- ?+ -.q.q.cay ~|(%bad-gen ~_((sell (slot 2 q.cay)) !!)) + $say /gent + $ask /dial + == + =+ gat=(slot 3 q.cay) + :+ %call [%$ %noun gat] + :+ [%$ %noun !>([now=now.hid eny=eny.hid bec=he-beak])] + (dy-silk-sources p.cig) + :+ %mute [%$ %noun (fall (slew 27 gat) !>(~))] + ^- (list [wing schematic:ford]) + %+ turn ~(tap by q.cig) + |= {a/term b/(unit dojo-source)} + ^- [wing schematic:ford] + :- [a ~] + :+ %$ %noun + ?~(b !>([~ ~]) (dy-vase p.u.b)) + :: + ++ dy-hoon-head :: dynamic state + :: todo: how do i separate the toplevel 'dojo state' comment? + :: dojo state + :: + :: our: the name of this urbit + :: now: the current time + :: eny: a piece of random entropy + :: + ^- cage + :- %noun + =+ sloop=|=({a/vase b/vase} ?:(=(*vase a) b ?:(=(*vase b) a (slop a b)))) + %+ sloop + %- ~(rep by var) + |= {{a/term @ b/vase} c/vase} ^- vase + (sloop b(p face+[a p.b]) c) + !>([our=our now=now eny=eny]:hid) + :: + ++ dy-made-dial :: dialog product + |= cag/cage + ^+ +>+> + ?. ?=(^ q.q.cag) + (dy-errd ~ q.q.cag) + =+ tan=((list tank) +2.q.q.cag) + =. +>+>.$ (he-diff %tan tan) + =+ vax=(sped (slot 3 q.cag)) + ?+ -.q.vax !! + %& + ?~ +.q.vax + ~& %dy-made-dial-abort + (dy-rash %bel ~) + (dy-meal (slot 7 vax)) + :: + %| + =< he-pone + %- dy-diff(pro `(slap (slot 7 vax) [%limb %q])) + =+ pom=(sole-prompt +<.q.vax) + [%pro pom(cad [':' ' ' cad.pom])] + == + :: + ++ dy-made-gent :: generator product + |= cag/cage + (dy-meal q.cag) + :: + ++ dy-made-noun :: generator product + |= cag/cage + (dy-hand %noun q.cag) + :: + ++ dy-make :: build step + ^+ +> + ?> ?=(^ cud) + =+ bil=q.u.cud :: XX =* + ?: ?=($ur -.bil) + (dy-request /hand `request:http`[%'GET' p.bil ~ ~]) + %- dy-ford + ^- [path schematic:ford] + ?- -.bil + $ge (dy-silk-config (dy-cage p.p.p.bil) q.p.bil) + $dv [/hand [%core [he-disc (weld /hoon (flop p.bil))]]] + $ex [/hand (dy-mare p.bil)] + $sa [/hand [%bunt he-disc p.bil]] + $as [/hand [%cast he-disc p.bil [%$ (dy-cage p.q.bil)]]] + $do [/hand [%call (dy-mare p.bil) [%$ (dy-cage p.q.bil)]]] + $tu :- /hand + :+ %$ %noun + |- ^- vase + ?~ p.bil !! + =+ hed=(dy-vase p.i.p.bil) + ?~ t.p.bil hed + (slop hed $(p.bil t.p.bil)) + == + :: + ++ dy-hoon-mark :: XX architect + =+ ^= ope + |= gen/hoon ^- hoon + ?: ?=(?($sgld $sgbn) -.gen) + $(gen q.gen) + =+ ~(open ap gen) + ?.(=(gen -) $(gen -) gen) + |= gen/hoon ^- (unit mark) + =. gen (ope gen) + ?: ?=({$cnts {@ ~} ~} gen) + (bind (~(get by var) i.p.gen) head) + ~ + :: + ++ dy-mare :: build expression + |= gen/hoon + ^- schematic:ford + =+ too=(dy-hoon-mark gen) + =- ?~(too - [%cast he-disc u.too -]) + :+ %ride gen + :- [%$ dy-hoon-head] + :^ %plan he-rail `coin`blob+** + `scaffold:ford`[he-rail zuse sur lib ~ ~] + :: + ++ dy-step :: advance project + |= nex/@ud + ^+ +>+> + ?> ?=(~ cud) + ?: =(nex num) + dy-over + dy-make(cud `[nex (~(got by job) nex)]) + -- + :: + ++ he-dope + |= txt/tape :: + ^- (each (unit (each dojo-command tape)) hair) :: prefix+result + =+ len=+((lent txt)) :: line length + =. txt (weld buf `tape`(weld txt "\0a")) :: + =+ vex=((full parse-command-line:he-parser) [1 1] txt) + ?: =(q.p.vex len) :: matched to line end + [%& ~] :: + ?: =(p.p.vex +((lent (skim txt |=(a/@ =(10 a)))))) :: parsed all lines + [%& ~ ?~(q.vex [%| txt] [%& p.u.q.vex])] :: new buffer+complete + [%| p.p.vex (dec q.p.vex)] :: syntax error + :: + ++ he-duke :: ++he-dope variant + |= txt/tape + ^- (each (unit (each dojo-command tape)) @ud) + =+ foy=(he-dope txt) + ?- -.foy + %| [%| q.p.foy] + %& [%& p.foy] + == + :: + ++ he-abet :: resolve + [(flop moz) %_(state hoc (~(put by hoc) ost.hid +<+))] + :: + ++ he-abut :: discard + => he-stop + [(flop moz) %_(state hoc (~(del by hoc) ost.hid))] + :: + ++ he-card :: emit gift + |= cad/card:agent:mall + ^+ +> + %_(+> moz [[ost.hid cad] moz]) + :: + ++ he-diff :: emit update + |= fec/sole-effect + ^+ +> + (he-card %give %diff %sole-effect !>(fec)) + :: + ++ he-stop :: abort work + ^+ . + ?~(poy . ~(dy-stop dy u.poy)) + :: + ++ he-peer :: subscribe to + |=(pax/path ?>(=(~ pax) he-prom)) + :: + ++ he-pine :: restore prompt + ^+ . + ?^ poy . + he-prom:he-pone + :: + ++ he-errd :: reject update + |= {rev/(unit sole-edit) err/@u} ^+ +> + =+ red=(fall rev [%nop ~]) :: required for error location sync + =^ lic say (~(transmit sole say) red) + (he-diff %mor [%det lic] [%err err] ~) + :: + ++ he-pone :: clear prompt + ^+ . + =^ cal say (~(transmit sole say) [%set ~]) + (he-diff %mor [%det cal] ~) + :: + ++ he-prow :: where we are + ^- tape + ?: &(=(our.hid p.dir) =(%home q.dir) =([%ud 0] r.dir) =(~ s.dir)) ~ + %+ weld + ?: &(=(our.hid p.dir) =([%ud 0] r.dir)) + (weld "/" (trip q.dir)) + ;: weld + "/" ?:(=(our.hid p.dir) "=" (scow %p p.dir)) + "/" ?:(=(%home q.dir) "=" (trip q.dir)) + "/" ?:(=([%ud 0] r.dir) "=" (scow r.dir)) + == + ?:(=(~ s.dir) "" (spud (flop s.dir))) + :: + ++ he-prom :: send prompt + %- he-diff + :- %pro + [& %$ (weld he-prow ?~(buf "> " "< "))] + :: + ++ he-made :: result from ford + |= $: way=wire + date=@da + $= result + $% [%complete build-result=build-result:ford] + [%incomplete =tang] + == == + ^+ +> + ?> ?=(^ poy) + =< he-pine + ?- -.result + %incomplete + (he-diff(poy ~) %tan tang.result) + :: + %complete + ?- -.build-result.result + :: + %success + :: + %. (result-to-cage:ford build-result.result) + =+ dye=~(. dy u.poy(pux ~)) + ?+ way !! + {$hand ~} dy-hand:dye + {$dial ~} dy-made-dial:dye + {$gent ~} dy-made-gent:dye + {$noun ~} dy-made-noun:dye + {$edit ~} dy-made-edit:dye + == + :: + %error + (he-diff(poy ~) %tan message.build-result.result) + == == + :: + ++ he-unto :: result from behn + |= {way/wire cit/internal-gift:gall} + ^+ +> + ?. ?=($coup -.cit) + ~& [%strange-unto cit] + +> + ?~ p.cit + (he-diff %txt ">=") + (he-diff %tan u.p.cit) + :: +he-http-response: result from http-client + :: + ++ he-http-response + |= [way=wire response=client-response:iris] + ^+ +> + ?> ?=(^ poy) + =< he-pine + ?. ?=(%finished -.response) + ~& %dojo-received-http-progress + +> + :: + ~! response + %. [%httr !>((to-httr:iris response-header.response full-file.response))] + =+ dye=~(. dy u.poy(pux ~)) + ?+ way !! + {$hand ~} dy-hand:dye + {$show ~} dy-show:dye + == + :: + ++ he-lens + |= com/command:lens + ^+ +> + =+ ^- source/dojo-source + =| num/@ + =- ?. ?=($send-api -.sink.com) :: XX num is incorrect + sor + :- 0 + :+ %as `mark`(cat 3 api.sink.com '-poke') + :- 1 + :+ %do + ^- hoon + :+ %brtr [%base %noun] + :^ %clls [%rock %tas %post] + [%rock %$ endpoint.sink.com] + [%cnts [%& 6]~ ~] + sor + ^= sor + |- ^- dojo-source + :- num + ?- -.source.com + $data [%ex %sand %t data.source.com] + $dojo + %+ rash command.source.com + (ifix [(punt gap) (punt gap)] parse-build:he-parser) + :: + $clay + :- %ex + ^- hoon + :+ %dtkt + [%base %noun] + :+ %clhp + [%rock %tas %cx] + %+ rash pax.source.com + rood:(vang | /(scot %p our.hid)/home/(scot %da now.hid)) + :: + $url [%ur (crip (en-purl:html url.source.com))] + $api !! + $get-api + :- %ex + ^- hoon + :+ %dtkt + [%like ~[%json] ~] + :* %clsg + [%rock %tas %gx] + [%sand %ta (scot %p our.hid)] + [%sand %tas api.source.com] + [%sand %ta (scot %da now.hid)] + (turn endpoint.source.com |=(a/@t [%sand %ta a])) + == + :: + $listen-api !! + $export !! + $import !! + $as + :* %as mar.source.com + $(num +(num), source.com next.source.com) + == + :: + $hoon + :* %do + %+ rash code.source.com + tall:(vang | /(scot %p our.hid)/home/(scot %da now.hid)) + $(num +(num), source.com next.source.com) + == + :: + $tuple + :- %tu + |- ^- (list dojo-source) + ?~ next.source.com + ~ + =. num +(num) + :- ^$(source.com i.next.source.com) + $(next.source.com t.next.source.com) + == + =+ |- ^- sink/dojo-sink + ?- -.sink.com + $stdout [%show %0] + $output-file $(sink.com [%command (cat 3 '@' pax.sink.com)]) + $output-pill $(sink.com [%command (cat 3 '.' pax.sink.com)]) + $output-clay [%file (need (de-beam:format pax.sink.com))] + $url [%http %post (crip (en-purl:html url.sink.com))] + $to-api !! + $send-api [%poke our.hid api.sink.com] + $command (rash command.sink.com parse-sink:he-parser) + $app [%poke our.hid app.sink.com] + == + (he-plan sink source) + :: + ++ he-like :: accept line + |= buf/(list @c) + =(%& -:(he-dope (tufa buf))) + :: + ++ he-stir :: apply change + |= cal/sole-change + ^+ +> + :: ~& [%his-clock ler.cal] + :: ~& [%our-clock ven.say] + =^ dat say (~(transceive sole say) cal) + ?. ?& ?=($del -.dat) + =(+(p.dat) (lent buf.say)) + == + +>.$ + =+ foy=(he-dope (tufa buf.say)) + ?: ?=(%& -.foy) +>.$ + :: ~& [%bad-change dat ted.cal] + :: ~& [%our-leg leg.say] + (he-errd `dat q.p.foy) + :: + ++ he-plan :: execute command + |= mad/dojo-command + ^+ +> + ?> ?=(~ poy) + he-pine:(dy-step:~(dy-init dy %*(. *dojo-project mad mad)) 0) + :: + ++ he-done :: parse command + |= txt/tape + ^+ +> + ?~ txt + =< he-prom(buf ~) + %- he-diff + :~ %mor + [%txt "> "] + [%nex ~] + == + =+ doy=(he-duke txt) + ?- -.doy + %| (he-errd ~ p.doy) + %& + ?~ p.doy + (he-errd ~ (lent txt)) + =+ old=(weld ?~(buf "> " " ") (tufa buf.say)) + =^ cal say (~(transmit sole say) [%set ~]) + =. +>.$ (he-diff %mor txt+old nex+~ det+cal ~) + ?- -.u.p.doy + %& (he-plan(buf ~) p.u.p.doy) + %| he-prom(buf p.u.p.doy) + == + == + :: + ++ he-type :: apply input + |= act/sole-action + ^+ +> + ?^ poy + he-pine:(~(dy-type dy u.poy) act) + ?- -.act + $det (he-stir +.act) + $ret (he-done (tufa buf.say)) + $clr he-pine(buf "") + == + :: + ++ he-lame :: handle error + |= {wut/term why/tang} + ^+ +> + %- (slog (flop `tang`[>%dojo-lame wut< why])) + ?^ poy + he-pine:~(dy-amok dy u.poy) + he-pine :: XX give mean to original keystroke + -- +-- +^- agent:mall +|_ hid=bowl:mall +++ handle-init + `..handle-init +:: +++ handle-prep + |= =old-state=vase + =/ old-state !<(house old-state-vase) + ?~ old-state + ~& %prep-lost + `..handle-init + ~& %prep-found + `..handle-init(state u.old-state) +:: +++ handle-poke + |= [=mark =vase] + ^- (quip move _..handle-init) + =/ =session (~(got by hoc) ost.hid) + =/ he-full ~(. he hid ~ session) + =^ moves state + =< he-abet + ?+ mark ~|([%dojo-poke-bad-mark mark] !!) + %sole-action (he-type:he-full (need !<(sole-action vase))) + %lens-command (he-lens:he-full (need !<(command:lens vase))) + %json ~& jon=(need !<(json vase)) `state + %wipe + ~& %dojo-wipe + =. hoc + %- ~(run by hoc) + |= =session + %_ session + sur ~ + lib ~ + var ~ + old ~ + == + [~ state] + == + :: + [moves ..handle-init] +:: +++ handle-peer + |= =path + ^- (quip move _..handle-init) + ~? !=(our.hid src.hid) [%dojo-peer-stranger ost.hid src.hid] + ?> (team:title our.hid src.hid) + =^ moves-1 state + ?. (~(has by hoc) ost.hid) [~ state] + ~& [%dojo-peer-replaced ost.hid] + ~(he-abut he hid ~ (~(got by hoc) ost.hid)) + =^ moves-2 state + =/ =session %*(. *session -.dir [our.hid %home ud+0]) + he-abet:(~(he-peer hid moves-1 session) path) + [moves-2 ..handle-init] +:: +++ handle-pull + |= path + =^ moves state + ~(he-abut he hid ~ (~(got by hoc) ost.hid)) + =. hoc (~(del by hoc) ost.hid) + [moves ..handle-init] +:: +++ handle-peek + |= path + *(unit (unit cage)) +:: +++ handle-mall + |= [=wire =internal-gift:mall] + =/ =session (~(got by hoc) ost.hid) + =^ moves state + he-abet:(~(he-unto hid ~ session) wire internal-gift) + [moves ..handle-init] +:: +++ handle-take + |= [=wire =vase] + =/ sesssion (~(got by hoc) ost.hid) + =/ he-full ~(. he hid ~ session) + =^ moves state + =< he-abet + ?+ -.q.vase ~|([%dojo-bad-take -.q.vase] !!) + %made + (he-made:he-full wire (need !<([@da made-result:ford] vase))) + :: + %http-response + (he-http-response:he-full wire (need !<(client-response:iris vase))) + == +:: +++ handle-lame + |= [=term =tang] + =/ =session (~(got by hoc) ost.hid) + =^ moves state + he-abet:(~(he-lame hid ~ session) term tang) + [moves ..handle-init] +:: +++ handle-stay + !>(state) +-- diff --git a/pkg/arvo/app/cop.hoon b/pkg/arvo/app/cop.hoon index 449f3ba3e..e73ae09d6 100644 --- a/pkg/arvo/app/cop.hoon +++ b/pkg/arvo/app/cop.hoon @@ -15,7 +15,7 @@ %conf [ost.bowl %conf-mall / [our.bowl %hood] [our.bowl %home]] %poke [ost.bowl %deal-mall / [our.bowl our.bowl] %hood %poke %atom !>(%hey)] %hi [ost.bowl %deal-mall / [our.bowl our.bowl] %hood %poke %helm-send-hi !>([our.bowl `"heyza"])] - %start [ost.bowl %deal-mall / [our.bowl our.bowl] %hood %poke %drum-start !>([%home %first])] + %start [ost.bowl %deal-mall / [our.bowl our.bowl] %hood %poke %drum-start !>([%home %dojo])] %first [ost.bowl %deal-mall / [our.bowl our.bowl] %first %poke %atom !>(%hey)] == :: diff --git a/pkg/arvo/app/hood.hoon b/pkg/arvo/app/hood.hoon index 356d20838..8b6024d05 100644 --- a/pkg/arvo/app/hood.hoon +++ b/pkg/arvo/app/hood.hoon @@ -154,7 +154,6 @@ ++ poke-drum-start (wrap poke-start):from-drum ++ poke-drum-set-boot-apps (wrap poke-set-boot-apps):from-drum ++ poke-helm-hi (wrap poke-hi):from-helm -::++ poke-helm-invite (wrap poke-invite):from-helm ++ poke-helm-mass (wrap poke-mass):from-helm ++ poke-helm-reload (wrap poke-reload):from-helm ++ poke-helm-reload-desk (wrap poke-reload-desk):from-helm diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 5cab5ca7a..5c2204d40 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -1944,7 +1944,8 @@ ++ agent =< form |% - +$ move internal-move + +$ move [=bone move=card] + +$ card (wind internal-note internal-gift) +$ step (quip move form) ++ form $_ ^| From 1ca4c72aa553e4b0fa601e7dca70d04b89b57b36 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Mon, 9 Sep 2019 20:00:56 -0700 Subject: [PATCH 137/451] mall: make boot --- bin/solid.pill | 4 +- pkg/arvo/age/dojo.hoon | 41 ++++++++------- pkg/arvo/age/hood.hoon | 88 ++++++++++++++++---------------- pkg/arvo/app/aqua.hoon | 4 +- pkg/arvo/lib/hood/drum-mall.hoon | 7 +-- pkg/arvo/lib/hood/kiln-mall.hoon | 2 +- pkg/arvo/lib/pill.hoon | 4 +- pkg/arvo/sys/arvo.hoon | 44 +++++++++++----- pkg/arvo/sys/vane/clay.hoon | 4 +- pkg/arvo/sys/vane/dill.hoon | 37 +++++++------- pkg/arvo/sys/vane/jael.hoon | 4 +- pkg/arvo/sys/vane/mall.hoon | 20 +++----- pkg/arvo/sys/zuse.hoon | 1 + 13 files changed, 141 insertions(+), 119 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index dd8f62e38..d8c3a69e8 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:89e9469aa6e5d9da7cfb62aeed0424c7f2ba0364b8fb7a84b1366219406038d0 -size 16997852 +oid sha256:7b8a1701002c00861ac55afcf4596f43d6daac82c0d5dca5e25274720a2cdd10 +size 17162691 diff --git a/pkg/arvo/age/dojo.hoon b/pkg/arvo/age/dojo.hoon index 2d4fbe578..fbc40ab09 100644 --- a/pkg/arvo/age/dojo.hoon +++ b/pkg/arvo/age/dojo.hoon @@ -322,6 +322,7 @@ =+ foo=*monkey =| house :: program state =* state - +=> |% ++ he :: per session |_ {hid/bowl:mall moz/(list move:agent:mall) session} :: @@ -361,7 +362,7 @@ =. poy ~ ?~ pux +> %. [%txt "! cancel {}"] - he-diff:(he-card [%pass u.pux %meta %f !>([%kill ~])) + he-diff:(he-card [%pass u.pux %meta %f !>([%kill ~])]) :: ++ dy-slam :: call by ford |= {way/wire gat/vase sam/vase} @@ -559,7 +560,6 @@ :* %pass /poke %send - our.hid p.p.p.mad q.p.p.mad %poke @@ -836,16 +836,16 @@ == :: ++ he-abet :: resolve - [(flop moz) %_(state hoc (~(put by hoc) ost.hid +<+))] + [(flop moz) %_(state hoc (~(put by hoc) ost.hid +<+>))] :: ++ he-abut :: discard => he-stop [(flop moz) %_(state hoc (~(del by hoc) ost.hid))] :: ++ he-card :: emit gift - |= cad/card:agent:mall + |= =card:agent:mall ^+ +> - %_(+> moz [[ost.hid cad] moz]) + %_(+> moz [[ost.hid card] moz]) :: ++ he-diff :: emit update |= fec/sole-effect @@ -857,7 +857,8 @@ ?~(poy . ~(dy-stop dy u.poy)) :: ++ he-peer :: subscribe to - |=(pax/path ?>(=(~ pax) he-prom)) + |= pax/path + ?>(=(~ pax) he-prom) :: ++ he-pine :: restore prompt ^+ . @@ -1130,14 +1131,14 @@ :: ++ handle-poke |= [=mark =vase] - ^- (quip move _..handle-init) - =/ =session (~(got by hoc) ost.hid) - =/ he-full ~(. he hid ~ session) + ^- (quip move:agent:mall _..handle-init) + =/ a-session=session (~(got by hoc) ost.hid) + =/ he-full ~(. he hid ~ a-session) =^ moves state - =< he-abet + ^- (quip move:agent:mall house) ?+ mark ~|([%dojo-poke-bad-mark mark] !!) - %sole-action (he-type:he-full (need !<(sole-action vase))) - %lens-command (he-lens:he-full (need !<(command:lens vase))) + %sole-action he-abet:(he-type:he-full (need !<(sole-action vase))) + %lens-command he-abet:(he-lens:he-full (need !<(command:lens vase))) %json ~& jon=(need !<(json vase)) `state %wipe ~& %dojo-wipe @@ -1157,7 +1158,7 @@ :: ++ handle-peer |= =path - ^- (quip move _..handle-init) + ^- (quip move:agent:mall _..handle-init) ~? !=(our.hid src.hid) [%dojo-peer-stranger ost.hid src.hid] ?> (team:title our.hid src.hid) =^ moves-1 state @@ -1166,7 +1167,8 @@ ~(he-abut he hid ~ (~(got by hoc) ost.hid)) =^ moves-2 state =/ =session %*(. *session -.dir [our.hid %home ud+0]) - he-abet:(~(he-peer hid moves-1 session) path) + ?> ?=([%sole *] path) + he-abet:(~(he-peer he hid moves-1 session) t.path) [moves-2 ..handle-init] :: ++ handle-pull @@ -1184,28 +1186,29 @@ |= [=wire =internal-gift:mall] =/ =session (~(got by hoc) ost.hid) =^ moves state - he-abet:(~(he-unto hid ~ session) wire internal-gift) + he-abet:(~(he-unto he hid ~ session) wire internal-gift) [moves ..handle-init] :: ++ handle-take |= [=wire =vase] - =/ sesssion (~(got by hoc) ost.hid) + =/ =session (~(got by hoc) ost.hid) =/ he-full ~(. he hid ~ session) =^ moves state =< he-abet ?+ -.q.vase ~|([%dojo-bad-take -.q.vase] !!) %made - (he-made:he-full wire (need !<([@da made-result:ford] vase))) + (he-made:he-full wire +:(need !<([%made @da made-result:ford] vase))) :: %http-response - (he-http-response:he-full wire (need !<(client-response:iris vase))) + (he-http-response:he-full wire +:(need !<([%made client-response:iris] vase))) == + [moves ..handle-init] :: ++ handle-lame |= [=term =tang] =/ =session (~(got by hoc) ost.hid) =^ moves state - he-abet:(~(he-lame hid ~ session) term tang) + he-abet:(~(he-lame he hid ~ session) term tang) [moves ..handle-init] :: ++ handle-stay diff --git a/pkg/arvo/age/hood.hoon b/pkg/arvo/age/hood.hoon index 0bb57903b..1737ecb41 100644 --- a/pkg/arvo/age/hood.hoon +++ b/pkg/arvo/age/hood.hoon @@ -80,51 +80,52 @@ :: :: :: ^- agent:mall =| hood-1 :: module states -=/ help +=> |% + ++ help |= hid/bowl:mall - |% - ++ able :: find+make part - |= hid=bowl:mall - =+ hed=$:hood-head - |@ ++ $ - =+ rep=(~(get by lac) hed) - =+ par=?^(rep u.rep `hood-part`(hood-make our.hid hed)) - ((hood-good hed) par) - -- - :: - ++ ably :: save part - =+ $:{(list) hood-part} - |@ ++ $ - [(flop +<-) (~(put by lac) +<+< +<+)] - -- - :: :: :: - :::: :: :: generic handling + |% + ++ able :: find+make part + =+ hed=$:hood-head + |@ ++ $ + =+ rep=(~(get by lac) hed) + =+ par=?^(rep u.rep `hood-part`(hood-make our.hid hed)) + ((hood-good hed) par) + -- + :: + ++ ably :: save part + =+ $:{(list) hood-part} + |@ ++ $ + [+<- (~(put by lac) +<+< +<+)] + -- :: :: :: - ++ prep - |= old/(unit hood-old) ^- (quip _!! _+>) - :- ~ - ?~ old +> - +>(lac (~(run by lac.u.old) hood-port)) - :: - ++ poke-hood-load :: recover lost brain - |= dat/hood-part - ?> =(our.hid src.hid) - ~& loaded+-.dat - [~ (~(put by lac) -.dat dat)] - :: - :: - ++ from-module :: create wrapper - |* _[identity=%module start=..$ finish=_abet]:(hood-module) - =- [wrap=- *start] :: usage (wrap handle-arm):from-foo - |* handle/_finish - |= a=_+<.handle - =. +>.handle (start hid ((able hid) identity)) - (ably (handle a)) - :: per-module interface wrappers - ++ from-drum (from-module %drum [..$ _se-abet]:(hood-drum-mall)) - ++ from-helm (from-module %helm [..$ _abet]:(hood-helm-mall)) - ++ from-kiln (from-module %kiln [..$ _abet]:(hood-kiln-mall)) - ++ from-write (from-module %write [..$ _abet]:(hood-write-mall)) + :::: :: :: generic handling + :: :: :: + ++ prep + |= old/(unit hood-old) ^- (quip _!! _+>) + :- ~ + ?~ old +> + +>(lac (~(run by lac.u.old) hood-port)) + :: + ++ poke-hood-load :: recover lost brain + |= dat/hood-part + ?> =(our.hid src.hid) + ~& loaded+-.dat + [~ (~(put by lac) -.dat dat)] + :: + :: + ++ from-module :: create wrapper + |* _[identity=%module start=..$ finish=_abet]:(hood-module) + =- [wrap=- *start] :: usage (wrap handle-arm):from-foo + |* handle/_finish + |= a=_+<.handle + =. +>.handle (start hid (able identity)) + (ably (handle a)) + :: per-module interface wrappers + ++ from-drum (from-module %drum [..$ _se-abet]:(hood-drum-mall)) + ++ from-helm (from-module %helm [..$ _abet]:(hood-helm-mall)) + ++ from-kiln (from-module %kiln [..$ _abet]:(hood-kiln-mall)) + ++ from-write (from-module %write [..$ _abet]:(hood-write-mall)) + -- -- |_ hid/bowl:mall :: gall environment ++ handle-init @@ -267,7 +268,6 @@ :: ++ handle-mall |= [=wire =internal-gift:mall] - ~& [%handling-mall wire] =/ h (help hid) =^ moves lac ?+ wire ~|([%hood-bad-wire wire] !!) diff --git a/pkg/arvo/app/aqua.hoon b/pkg/arvo/app/aqua.hoon index 0989d6626..fadd874b9 100644 --- a/pkg/arvo/app/aqua.hoon +++ b/pkg/arvo/app/aqua.hoon @@ -378,8 +378,8 @@ :: [%swap-files ~] =. userspace-ova.pil - =/ slim-dirs - `(list path)`~[/app /gen /lib /mar /sur /hoon/sys /arvo/sys /zuse/sys] + =/ slim-dirs=(list path) + ~[/app /gen /lib /mar /sur /hoon/sys /arvo/sys /zuse/sys /age] :_ ~ %- unix-event %- %*(. file-ovum:pill-lib directories slim-dirs) diff --git a/pkg/arvo/lib/hood/drum-mall.hoon b/pkg/arvo/lib/hood/drum-mall.hoon index f5d9e6b8b..6ecb18f18 100644 --- a/pkg/arvo/lib/hood/drum-mall.hoon +++ b/pkg/arvo/lib/hood/drum-mall.hoon @@ -44,7 +44,7 @@ off/@ud :: window offset kil/kill :: kill buffer inx/@ud :: ring index - fug/(map gill:gall (unit target)) :: connections + fug/(map gill:gall (unit target)) :: connections mir/(pair @ud stub) :: mirrored terminal == :: ++ history :: past input @@ -78,7 +78,7 @@ ^- (list well:gall) ?: lit :~ [%home %dojo] - [%home %azimuth-tracker] + :: [%home %azimuth-tracker] == =+ myr=(clan:title our) :: @@ -113,7 +113,8 @@ |= our/ship %- ~(gas in *(set gill:gall)) ^- (list gill:gall) - [[our %talk] [our %dojo] ~] + :: [[our %talk] [our %dojo] ~] + [[our %dojo] ~] :: ++ make :: initial part |= our/ship diff --git a/pkg/arvo/lib/hood/kiln-mall.hoon b/pkg/arvo/lib/hood/kiln-mall.hoon index 6d72702cf..98e369130 100644 --- a/pkg/arvo/lib/hood/kiln-mall.hoon +++ b/pkg/arvo/lib/hood/kiln-mall.hoon @@ -416,7 +416,7 @@ :: ++ warp |= [=bone =wire =ship =riff] - (blab [bone %pass wire %meta %c !>([ship riff])] ~) + (blab [bone %pass wire %meta %c !>([%warp ship riff])] ~) :: ++ spam |*(* %_(+> ..auto (^spam +<))) ++ stop diff --git a/pkg/arvo/lib/pill.hoon b/pkg/arvo/lib/pill.hoon index b2dcb5858..457552f0a 100644 --- a/pkg/arvo/lib/pill.hoon +++ b/pkg/arvo/lib/pill.hoon @@ -45,7 +45,7 @@ [%f /vane/ford] :: sys/vane/gall: applications :: - [%g /vane/gall] + [%m /vane/mall] :: sys/vane/iris: http client :: [%i /vane/iris] @@ -63,7 +63,7 @@ :: ++ file-ovum =/ directories - `(list path)`~[/app /gen /lib /mar /ren /sec /sur /sys /tests /web] + `(list path)`~[/app /age /gen /lib /mar /ren /sec /sur /sys /tests /web] |= bas=path ^- unix-event :: diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index 159a7c781..a3009d68e 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -691,26 +691,49 @@ =^ rey +>+ (^load +<) [rey +>.$] :: - ++ peek |=(* (^peek ;;([@da path] +<))) :: 46 + ++ peek |= * :: 46 + =/ rob (^peek ;;([@da path] +<)) + ?~ rob ~ + ?~ u.rob ~ + [~ u.u.rob] :: ++ poke |= * :: 47 - ^- [(list ovum) *] => .(+< ;;([now=@da ovo=ovum] +<)) - =^ ova +>+.$ (^poke now ovo) + =; taq=_^?(|.(**)) + =/ res + %+ mock + [taq 9 2 0 1] + |= [ref=* raw=*] + (^peek now ;;(path raw)) + |- + ?- -.res + %0 p.res + %1 $(res [%2 leaf+"blocked" >p.res< ~]) + %2 + ~_ leaf+"deterministic error" + |- + ?~ p.res + !! + ~_ i.p.res + $(p.res t.p.res) + == + |. + ^- [(list ovum) *] + =^ ova +>+.^$ (^poke now ovo) =| out=(list ovum) |- ^- [(list ovum) *] ?~ ova - [(flop out) +>.^$] + [(flop out) +>.^^$] :: upgrade the kernel :: ?: ?=(%lyra -.q.i.ova) %+ fall (vega now t.ova ;;([@ @] +.q.i.ova)) - [~ +>.^$] + [~ +>.^^$] :: iterate over effects, handling those on arvo proper :: and passing the rest through as output :: - =^ vov +>+.^$ (feck now i.ova) + =^ vov +>+.^^$ (feck now i.ova) =? out ?=(^ vov) [+.vov out] $(ova t.ova) :: @@ -758,12 +781,9 @@ :: ++ peek :: external inspect |= {now/@da hap/path} - ^- (unit) - ?~ hap [~ hoon-version] - =+ rob=((sloy ~(beck (is our vil eny bud vanes) now)) [151 %noun] hap) - ?~ rob ~ - ?~ u.rob ~ - [~ u.u.rob] + ^- (unit (unit)) + ?~ hap [~ ~ hoon-version] + ((sloy ~(beck (is our vil eny bud vanes) now)) [151 %noun] hap) :: ++ poke :: external apply |= [now=@da ovo=ovum] diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 9a8d4dcab..1e186685b 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3075,7 +3075,7 @@ |= err=(pair term tang) ^+ +> =. +>.$ - (emit [hen %give %mere %| err]) + (emit [hen %slip %b %drip !>([%mere %| err])]) finish-write :: :: Release effects and apply state changes @@ -3083,7 +3083,7 @@ ++ done-merge |= [conflicts=(set path) =dome =rang] ^+ +> - =. +>.$ (emit [hen %give %mere %& conflicts]) + =. +>.$ (emit [hen %slip %b %drip !>([%mere %& conflicts])]) =: dom dome hut.ran (~(uni by hut.rang) hut.ran) lat.ran (~(uni by lat.rang) lat.ran) diff --git a/pkg/arvo/sys/vane/dill.hoon b/pkg/arvo/sys/vane/dill.hoon index e660e83de..772804eb8 100644 --- a/pkg/arvo/sys/vane/dill.hoon +++ b/pkg/arvo/sys/vane/dill.hoon @@ -70,12 +70,12 @@ $: %f :: $>(%wegh task:able:ford) :: == :: - $: %g :: + $: %m :: $> $? %conf :: %deal :: %wegh :: == :: - task:able:gall :: + task:able:mall :: == :: $: %i :: $>(%wegh task:able:iris) :: @@ -99,6 +99,7 @@ $: %b :: $% $>(%mass gift:able:behn) :: $>(%writ gift:able:clay) :: XX %slip + $>(%mere gift:able:clay) :: XX %slip == == :: $: %c :: $> $? %mack :: XX strange @@ -118,12 +119,12 @@ $: %f :: $>(%mass gift:able:ford) :: == :: - $: %g :: + $: %m :: $> $? %mass :: %onto :: %unto :: == :: - gift:able:gall :: + gift:able:mall :: == :: $: %i :: $>(%mass gift:able:iris) :: @@ -282,7 +283,7 @@ [hen %pass /heft/clay %c %wegh ~] [hen %pass /heft/eyre %e %wegh ~] [hen %pass /heft/ford %f %wegh ~] - [hen %pass /heft/gall %g %wegh ~] + [hen %pass /heft/gall %m %wegh ~] [hen %pass /heft/iris %i %wegh ~] [hen %pass /heft/jael %j %wegh ~] moz @@ -309,7 +310,7 @@ =/ myt (flop (fall tem ~)) =/ can (clan:title our) =. tem ~ - =. moz :_(moz [hen %pass ~ %g %conf [[our ram] our %home]]) + =. moz :_(moz [hen %pass ~ %m %conf [[our ram] our %home]]) =. +> (sync %home our %base) =. +> ?: ?=(?($czar $pawn) can) +> (sync %base (sein our) %kids) @@ -341,14 +342,14 @@ %_ +> moz :_ moz - [hen %pass ~ %g %deal [our our] ram %poke [%dill-belt -:!>(bet) bet]] + [hen %pass ~ %m %deal [our our] ram %poke [%dill-belt -:!>(bet) bet]] == :: ++ hood-set-boot-apps %_ . moz :_ moz - :* hen %pass ~ %g %deal [our our] + :* hen %pass ~ %m %deal [our our] ram %poke %drum-set-boot-apps !>(lit.all) == == @@ -356,7 +357,7 @@ ++ peer %_ . moz - :_(moz [hen %pass ~ %g %deal [our our] ram %peer /drum]) + :_(moz [hen %pass ~ %m %deal [our our] ram %peer /drum]) == :: ++ show :: permit reads on desk @@ -372,7 +373,7 @@ %_ +>.$ moz :_ moz - :* hen %pass /sync %g %deal [our our] + :* hen %pass /sync %m %deal [our our] ram %poke %hood-sync -:!>(syn) syn == == @@ -381,7 +382,7 @@ %_ . moz :_ moz - :* hen %pass /autoload %g %deal [our our] + :* hen %pass /autoload %m %deal [our our] ram %poke %kiln-start-autoload [%atom %n `~] ~ == == @@ -389,14 +390,14 @@ ++ pump :: send diff ack %_ . moz - :_(moz [hen %pass ~ %g %deal [our our] ram %pump ~]) + :_(moz [hen %pass ~ %m %deal [our our] ram %pump ~]) == :: ++ take :: receive |= sih/sign ^+ +> ?- sih - {?($a $b $c $e $f $g $i $j) $mass *} + {?($a $b $c $e $f $m $i $j) $mass *} (wegh -.sih p.sih) :: {$a $nice *} @@ -411,14 +412,14 @@ {$a $send *} +>(moz :_(moz [hen %give +.sih])) :: - {$g $onto *} + {$m $onto *} :: ~& [%take-gall-onto +>.sih] ?- -.+>.sih %| (crud %onto p.p.+>.sih) %& (done %blit [%lin (tuba "{}")]~) == :: - {$g $unto *} + {$m $unto *} :: ~& [%take-gall-unto +>.sih] ?- -.+>.sih $coup ?~(p.p.+>.sih +>.$ (crud %coup u.p.p.+>.sih)) @@ -436,7 +437,7 @@ {?($b $c) $writ *} init :: - {$c $mere *} + {?($b %c) $mere *} ?: ?=(%& -.p.sih) mere (mean >%dill-mere-fail< >p.p.p.sih< q.p.p.sih) @@ -451,7 +452,7 @@ :: +wegh: receive a memory report from a vane and maybe emit full report :: ++ wegh - |= [lal=?(%a %b %c %e %f %g %i %j) mas=mass] + |= [lal=?(%a %b %c %e %f %m %i %j) mas=mass] ^+ +> :: update our listing of vane responses with this new one :: @@ -462,7 +463,7 @@ %c ~?(?=(^ c.hef.all) %double-mass-c hef.all(c `mas)) %e ~?(?=(^ e.hef.all) %double-mass-e hef.all(e `mas)) %f ~?(?=(^ f.hef.all) %double-mass-f hef.all(f `mas)) - %g ~?(?=(^ g.hef.all) %double-mass-g hef.all(g `mas)) + %m ~?(?=(^ g.hef.all) %double-mass-g hef.all(g `mas)) %i ~?(?=(^ i.hef.all) %double-mass-i hef.all(i `mas)) %j ~?(?=(^ j.hef.all) %double-mass-j hef.all(j `mas)) == diff --git a/pkg/arvo/sys/vane/jael.hoon b/pkg/arvo/sys/vane/jael.hoon index b2e601401..ce14c5a17 100644 --- a/pkg/arvo/sys/vane/jael.hoon +++ b/pkg/arvo/sys/vane/jael.hoon @@ -326,7 +326,7 @@ :~ [hen %give %init our] [hen %slip %e %init our] [hen %slip %d %init our] - [hen %slip %g %init our] + [hen %slip %m %init our] [hen %slip %c %init our] [hen %slip %a %init our] == @@ -368,7 +368,7 @@ :~ [hen %give %init our] [hen %slip %e %init our] [hen %slip %d %init our] - [hen %slip %g %init our] + [hen %slip %m %init our] [hen %slip %c %init our] [hen %slip %a %init our] == diff --git a/pkg/arvo/sys/vane/mall.hoon b/pkg/arvo/sys/vane/mall.hoon index da9dee709..86ab8c47f 100644 --- a/pkg/arvo/sys/vane/mall.hoon +++ b/pkg/arvo/sys/vane/mall.hoon @@ -712,12 +712,10 @@ =/ =sign-arvo q.hin ?. ?=([%m %unto *] sign-arvo) =/ =vase (slot 3 hin) - ~& [%handling-use path] =. app (ap-generic-take:app t.t.path vase) ap-abet:app =. app =/ =internal-gift +>.sign-arvo - ~& [%handling-use path] (ap-specific-take:app t.t.path internal-gift) ap-abet:app :: +mo-clear-queue: clear blocked tasks from the specified running agent. @@ -1473,9 +1471,7 @@ ~& [%mall-not-ours ship] [~ mall-payload] :: - ~& [%mall-ours ship] => (mo-boot:initialised q.dock q.task) - ~& [%mall-initialized ship] mo-abet :: ?(%deal %deal-mall) @@ -1546,14 +1542,14 @@ :: +load: recreate vane :: ++ load - |= * - mall-payload - :: |= =state-old - :: ^+ mall-payload - :: :: - :: ?- -.state-old - :: %0 mall-payload(state state-old) - :: == + :: |= * + :: mall-payload + |= =state-old + ^+ mall-payload + :: + ?- -.state-old + %0 mall-payload(state state-old) + == :: +scry: standard scry :: ++ scry diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 5c2204d40..cefcb1611 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -7585,6 +7585,7 @@ $: $b $% gift:able:behn [%writ riot:clay] + $>(%mere gift:able:clay) == == {$c gift:able:clay} From abf4bc39cd350803f66a499279e11894c0694db5 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 10 Sep 2019 13:12:38 -0700 Subject: [PATCH 138/451] wip --- pkg/arvo/age/first.hoon | 56 ++++++------------------ pkg/arvo/lib/default-agent.hoon | 63 +++++++++++++++++++++++++++ pkg/arvo/sys/zuse.hoon | 75 ++++++++++++++++----------------- 3 files changed, 113 insertions(+), 81 deletions(-) create mode 100644 pkg/arvo/lib/default-agent.hoon diff --git a/pkg/arvo/age/first.hoon b/pkg/arvo/age/first.hoon index 6a4cd51fe..5c3d405e0 100644 --- a/pkg/arvo/age/first.hoon +++ b/pkg/arvo/age/first.hoon @@ -1,50 +1,22 @@ +/+ default-agent ^- agent:mall =| state=@ -|_ bowl:mall -++ handle-init - `..handle-init -:: -++ handle-prep - |= =old-state=vase - =/ old-state !<(@ old-state-vase) - ?~ old-state - ~& %prep-lost - `..handle-init - ~& %prep-found - `..handle-init(state u.old-state) -:: +|_ =bowl:mall ++* this . +++ handle-init ~(handle-init default-agent bowl this) +++ handle-extract-state ~(handle-extract-state default-agent bowl this) +++ handle-upgrade-state ~(handle-upgrade-state default-agent bowl this) ++ handle-poke |= in-poke-data=cage - ~& >> 'ouchies!' - ~& >>> in-poke-data ~& > state=state + ~& > in-poke-data =. state +(state) - `..handle-init + `this :: -++ handle-peer - |= path - `..handle-init -:: -++ handle-pull - |= path - `..handle-init -:: -++ handle-peek - |= path - *(unit (unit cage)) -:: -++ handle-mall - |= [wire internal-gift:mall] - `..handle-init -:: -++ handle-take - |= [wire vase] - `..handle-init -:: -++ handle-lame - |= [term tang] - `..handle-init -:: -++ handle-stay - !>(state) +++ handle-subscribe ~(handle-subscribe default-agent bowl this) +++ handle-unsubscribe ~(handle-unsubscribe default-agent bowl this) +++ handle-peek ~(handle-peek default-agent bowl this) +++ handle-agent-response ~(handle-agent-response default-agent bowl this) +++ handle-arvo-response ~(handle-arvo-response default-agent bowl this) +++ handle-error ~(handle-error default-agent bowl this) -- diff --git a/pkg/arvo/lib/default-agent.hoon b/pkg/arvo/lib/default-agent.hoon new file mode 100644 index 000000000..06d505e17 --- /dev/null +++ b/pkg/arvo/lib/default-agent.hoon @@ -0,0 +1,63 @@ +|_ [=bowl:mall =agent:mall] +++ handle-init + `agent +:: +++ handle-prep + |= old-state=vase + ~& "updating agent {} by throwing away old state" + `agent +:: +++ handle-poke + |= =cage + ~& "unexpected poke to {} with mark {}" + ~| "unexpected poke to {} with mark {}" + !! +:: +++ handle-peer + |= =path + ~& "unexpected subscription to {} on path {}" + ~| "unexpected subscription to {} on path {}" + !! +:: +++ handle-pull + |= path + `agent +:: +++ handle-peek + |= path + ~| "unexpected scry into {} on path {}" + !! +:: +++ handle-mall + |= [=wire =internal-gift:mall] + ?- -.internal-gift + %coup `agent + %reap `agent + %quit + ~| "unexpected subscription closure to {} on wire {}" + !! + :: + %diff + ~| "unexpected subscription update to {} on wire {}" + ~| "with mark {}" + !! + :: + %http-response + ~| "unexpected http-response to {} on wire {}" + !! + == +:: +++ handle-take + |= [=wire =vase] + ~| "unexpected system response {} to {} on wire {}" + !! +:: +++ handle-lame + |= [=term =tang] + %- (slog leaf+"error in {}" >term< tang) + `agent +:: +++ handle-stay + ~& "extracting empty state for {}" + !>(~) +-- diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index cefcb1611..4e934edfa 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -1862,7 +1862,7 @@ $% {$mass p/mass} :: memory usage {$onto p/(each suss tang)} :: about agent {$rend p/path q/*} :: network request - {$unto p/internal-gift} :: + {$unto p/gift:agent} :: {$mack p/(unit tang)} :: message ack == :: ++ task :: incoming request @@ -1901,19 +1901,12 @@ {$peer p/path} :: subscribe {$poke p/cage} :: apply {$puff p/mark q/noun} :: unchecked poke - {$pull ~} :: unsubscribe + {$pull ~} :: unsubscribe {$punk p/mark q/cage} :: translated poke - {$pump ~} :: pump yes+no + {$pump ~} :: pump yes+no {$peer-not p/tang} :: poison pill peer == :: - ++ internal-gift :: - $% {$coup p/(unit tang)} :: poke result - {$diff p/cage} :: subscription output - {$quit ~} :: close subscription - {$reap p/(unit tang)} :: peer result - [%http-response =http-event:http] :: serve http result - == :: - ++ internal-task (pair term agent-action) :: internal task + ++ internal-task task:agent :: internal task ++ dude term :: server identity ++ gill (pair ship term) :: general contact ++ scar :: opaque duct @@ -1924,36 +1917,43 @@ ++ suss (trel dude @tas @da) :: config report ++ well (pair desk term) :: :: - :: +internal-note: +ap note - :: - ++ internal-note - $% [%meta =term =vase] - [%send =ship =internal-task] - == - :: +internal-move: agent-level move - :: - :: Analogous to an Arvo move, except these are routed by bone, instead of - :: duct. - :: - ++ internal-move - $: =bone - move=(wind internal-note internal-gift) - == :: +agent: app core :: ++ agent =< form |% - +$ move [=bone move=card] - +$ card (wind internal-note internal-gift) - +$ step (quip move form) + +$ step (quip card form) + +$ card (wind note gift) + +$ note + $% [%arvo note-arvo] + [%agent =ship name=term =task] + == + +$ task + $% [%subscribe-translated =mark =path] + [%subscribe =path] + [%unsubscribe ~] + [%poke =cage] + [%raw-poke =mark =noun] + [%poke-translated =mark =cage] + [%pump ~] + == + +$ gift + $% [%poke-ack p=(unit tang)] + [%subscription-update p=cage] + [%subscription-closed ~] + [%subscription-ack p=(unit tang)] + [%http-response =http-event:http] + == ++ form $_ ^| |_ bowl ++ handle-init *(quip move _^|(..handle-init)) :: - ++ handle-prep + ++ handle-extract-state + *vase + :: + ++ handle-upgrade-state |~ old-state=vase *(quip move _^|(..handle-init)) :: @@ -1961,11 +1961,11 @@ |~ in-poke-data=cage *(quip move _^|(..handle-init)) :: - ++ handle-peer + ++ handle-subscribe |~ path *(quip move _^|(..handle-init)) :: - ++ handle-pull + ++ handle-unsubscribe |~ path *(quip move _^|(..handle-init)) :: @@ -1973,20 +1973,17 @@ |~ path *(unit (unit cage)) :: - ++ handle-mall + ++ handle-agent-response |~ [wire internal-gift] *(quip move _^|(..handle-init)) :: - ++ handle-take - |~ [wire sign=vase] + ++ handle-arvo-response + |~ [wire =sign-arvo] *(quip move _^|(..handle-init)) :: - ++ handle-lame + ++ handle-error |~ [term tang] *(quip move _^|(..handle-init)) - :: - ++ handle-stay - *vase -- -- -- ::mall From fbf56e3033ffb6c38ce95fa077ea4065db59ff38 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 11 Sep 2019 19:55:31 -0700 Subject: [PATCH 139/451] mall: refactor and rename remove bones, give agent arms long names, remove metavase use, general cleanup --- pkg/arvo/age/hood.hoon | 62 ++-- pkg/arvo/lib/default-agent.hoon | 4 +- pkg/arvo/lib/hood/drum-mall.hoon | 53 ++- pkg/arvo/lib/hood/helm-mall.hoon | 45 +-- pkg/arvo/lib/hood/kiln-mall.hoon | 98 +++--- pkg/arvo/lib/hood/write-mall.hoon | 21 +- pkg/arvo/sys/vane/mall.hoon | 563 ++++++++++++++---------------- pkg/arvo/sys/zuse.hoon | 268 +++++++------- 8 files changed, 535 insertions(+), 579 deletions(-) diff --git a/pkg/arvo/age/hood.hoon b/pkg/arvo/age/hood.hoon index 1737ecb41..b5d272ded 100644 --- a/pkg/arvo/age/hood.hoon +++ b/pkg/arvo/age/hood.hoon @@ -131,7 +131,10 @@ ++ handle-init `..handle-init :: -++ handle-prep +++ handle-extract-state + !>([%1 lac]) +:: +++ handle-upgrade-state |= =old-state=vase =/ old-state !<(hood-1 old-state-vase) ?~ old-state @@ -142,9 +145,9 @@ :: ++ handle-poke |= [=mark =vase] - ^- (quip move:agent:mall agent:mall) + ^- (quip card:agent:mall agent:mall) =/ h (help hid) - =^ moves lac + =^ cards lac ?+ mark ~|([%poke-hood-bad-mark mark] !!) %hood-load %- poke-hood-load:h (need !<(hood-part vase)) @@ -247,18 +250,18 @@ %write-wipe %- (wrap poke-wipe):from-write:h (need !<(path vase)) == - [moves ..handle-init] + [cards ..handle-init] :: -++ handle-peer +++ handle-subscribe |= =path =/ h (help hid) - =^ moves lac + =^ cards lac ?+ path ~|([%hood-bad-path wire] !!) [%drum *] ((wrap peer):from-drum:h t.path) == - [moves ..handle-init] + [cards ..handle-init] :: -++ handle-pull +++ handle-unsubscribe |= path `..handle-init :: @@ -266,49 +269,46 @@ |= path *(unit (unit cage)) :: -++ handle-mall +++ handle-agent-response |= [=wire =internal-gift:mall] =/ h (help hid) - =^ moves lac + =^ cards lac ?+ wire ~|([%hood-bad-wire wire] !!) [%helm %hi *] %+ (wrap coup-hi):from-helm:h t.t.wire - ?>(?=(%coup -.internal-gift) p.internal-gift) + ?>(?=(%poke-ack -.internal-gift) p.internal-gift) [%kiln %fancy *] %+ (wrap take-coup-fancy):from-kiln:h t.t.wire - ?>(?=(%coup -.internal-gift) p.internal-gift) + ?>(?=(%poke-ack -.internal-gift) p.internal-gift) [%kiln %reload *] %+ (wrap take-coup-reload):from-kiln:h t.t.wire - ?>(?=(%coup -.internal-gift) p.internal-gift) + ?>(?=(%poke-ack -.internal-gift) p.internal-gift) [%kiln %spam *] %+ (wrap take-coup-spam):from-kiln:h t.t.wire - ?>(?=(%coup -.internal-gift) p.internal-gift) + ?>(?=(%poke-ack -.internal-gift) p.internal-gift) [%drum %phat *] ?- -.internal-gift %http-response !! - %coup ((wrap take-coup-phat):from-drum:h t.t.wire p.internal-gift) - %reap ((wrap reap-phat):from-drum:h t.t.wire p.internal-gift) - %quit ((wrap quit-phat):from-drum:h t.t.wire) - %diff + %poke-ack ((wrap take-coup-phat):from-drum:h t.t.wire p.internal-gift) + %subscription-ack ((wrap reap-phat):from-drum:h t.t.wire p.internal-gift) + %subscription-close ((wrap quit-phat):from-drum:h t.t.wire) + %subscription-update %+ (wrap diff-sole-effect-phat):from-drum:h t.t.wire ?> ?=(%sole-effect p.p.internal-gift) (need !<(sole-effect q.p.internal-gift)) == == - [moves ..handle-init] + [cards ..handle-init] :: -++ handle-take - |= [=wire =vase] +++ handle-system-response + |= [=wire =sign-arvo] =/ h (help hid) - =^ moves lac + =^ cards lac ?+ wire ~|([%hood-bad-wire wire] !!) - [%helm *] ((wrap take):from-helm:h t.wire vase) - [%drum *] ((wrap take):from-drum:h t.wire vase) - [%kiln *] ((wrap take-general):from-kiln:h t.wire vase) - [%write *] ((wrap take):from-write:h t.wire vase) + [%helm *] ((wrap take):from-helm:h t.wire sign-arvo) + [%drum *] ((wrap take):from-drum:h t.wire sign-arvo) + [%kiln *] ((wrap take-general):from-kiln:h t.wire sign-arvo) + [%write *] ((wrap take):from-write:h t.wire sign-arvo) == - [moves ..handle-init] + [cards ..handle-init] :: -++ handle-lame +++ handle-error |= [term tang] `..handle-init -:: -++ handle-stay - !>([%1 lac]) -- diff --git a/pkg/arvo/lib/default-agent.hoon b/pkg/arvo/lib/default-agent.hoon index 06d505e17..e8fe7060b 100644 --- a/pkg/arvo/lib/default-agent.hoon +++ b/pkg/arvo/lib/default-agent.hoon @@ -36,12 +36,12 @@ %quit ~| "unexpected subscription closure to {} on wire {}" !! - :: + :: %diff ~| "unexpected subscription update to {} on wire {}" ~| "with mark {}" !! - :: + :: %http-response ~| "unexpected http-response to {} on wire {}" !! diff --git a/pkg/arvo/lib/hood/drum-mall.hoon b/pkg/arvo/lib/hood/drum-mall.hoon index 6ecb18f18..3815374a0 100644 --- a/pkg/arvo/lib/hood/drum-mall.hoon +++ b/pkg/arvo/lib/hood/drum-mall.hoon @@ -20,8 +20,7 @@ |:($:source +<(mir ((pair @ud (list @c))))) :: style-less mir :: :: ++ pith-2 :: - $: sys/(unit bone) :: local console - eel/(set gill:gall) :: connect to + $: eel/(set gill:gall) :: connect to ray/(set well:gall) :: fur/(map dude:gall (unit server)) :: servers bin/(map bone source) :: terminals @@ -121,7 +120,6 @@ ^- part :* %drum %2 - sys=~ eel=(deft-fish our) ray=~ fur=~ @@ -142,7 +140,8 @@ :::: :: |= {hid/bowl:gall part} :: main drum work -=+ (~(gut by bin) ost.hid *source) +=/ ost 0 +=+ (~(gut by bin) ost *source) =* dev - => |% :: arvo structures ++ pear :: request @@ -161,7 +160,7 @@ == :: ++ move (pair bone card) :: user-level move -- -|_ {moz/(list move:agent:mall) biz/(list dill-blit:dill)} +|_ {moz/(list card:agent:mall) biz/(list dill-blit:dill)} ++ diff-sole-effect-phat :: app event |= {way/wire fec/sole-effect} =< se-abet =< se-view @@ -227,9 +226,10 @@ (se-dump:(se-drop & gyl) u.saw) :: ++ take :: - |= [=wire =vase] + |= [=wire =sign-arvo] %+ take-onto wire - +:(need !<([%onto (each suss:gall tang)] vase)) + ?> ?=(%onto +<.sign-arvo) + +>.sign-arvo :: ++ take-coup-phat :: ack poke |= {way/wire saw/(unit tang)} @@ -239,7 +239,7 @@ ?: (se-aint gyl) +>.$ %- se-dump:(se-drop & gyl) :_ u.saw - >[%drum-coup-fail src.hid ost.hid gyl]< + >[%drum-coup-fail src.hid gyl]< :: ++ take-onto :: ack start |= {way/wire saw/(each suss:gall tang)} @@ -258,27 +258,27 @@ |= way/wire =< se-abet =< se-view =+ gyl=(de-gill way) - ~& [%drum-quit src.hid ost.hid gyl] + ~& [%drum-quit src.hid gyl] (se-drop %| gyl) :: :: :: :::: :: :: :: :: :: ++ se-abet :: resolve - ^- (quip move:agent:mall part) + ^- (quip card:agent:mall part) =* pith +<+.$ ?. se-ably =. . se-adit [(flop moz) pith] - =. sys ?^(sys sys `ost.hid) =. . se-subze:se-adze:se-adit - :_ pith(bin (~(put by bin) ost.hid dev)) + :_ pith(bin (~(put by bin) ost dev)) %- flop - ^- (list move:agent:mall) + ^- (list card:agent:mall) ?~ biz moz :_ moz - [ost.hid %give %diff %dill-blit !>(?~(t.biz i.biz [%mor (flop biz)]))] + =/ =blit:dill ?~(t.biz i.biz [%mor (flop biz)]) + [%give %subscription-update `/drum %dill-blit !>(blit)] :: -++ se-ably (~(has by sup.hid) ost.hid) :: caused by console +++ se-ably (~(has by sup.hid) ost) :: caused by console :: ++ se-adit :: update servers ^+ . @@ -293,7 +293,7 @@ =. +>.$ (se-text "activated app {(trip p.wel)}/{(trip q.wel)}") %- se-emit(fur (~(put by fur) q.wel ~)) =/ =wire [%drum p.wel q.wel ~] - [ost.hid %pass wire %meta %m !>([%conf [our.hid q.wel] our.hid p.wel])] + [%pass wire %arvo %m %conf [our.hid q.wel] our.hid p.wel] :: ++ se-adze :: update connections ^+ . @@ -306,14 +306,14 @@ (se-peer gil) :: ++ se-subze :: downdate connections - =< .(dev (~(got by bin) ost.hid)) - =. bin (~(put by bin) ost.hid dev) + =< .(dev (~(got by bin) ost)) + =. bin (~(put by bin) ost dev) ^+ . %- ~(rep by bin) =< .(con +>) |: $:{{ost/bone dev/source} con/_.} ^+ con - =+ xeno=se-subze-local:%_(con ost.hid ost, dev dev) - xeno(ost.hid ost.hid.con, dev dev.con, bin (~(put by bin) ost dev.xeno)) + =+ xeno=se-subze-local:%_(con ost ost, dev dev) + xeno(ost ost.con, dev dev.con, bin (~(put by bin) ost dev.xeno)) :: ++ se-subze-local ^+ . @@ -328,7 +328,7 @@ ++ se-aint :: ignore result |= gyl/gill:gall ^- ? - ?. (~(has by bin) ost.hid) & + ?. (~(has by bin) ost) & =+ gyr=(~(get by fug) gyl) |(?=(~ gyr) ?=(~ u.gyr)) :: @@ -436,8 +436,7 @@ :: ++ se-blit-sys :: output to system |= bil/dill-blit:dill ^+ +> - ?~ sys ~&(%se-blit-no-sys +>) - (se-emit [u.sys %give %diff %dill-blit !>(bil)]) + (se-emit %give %subscription-update %dill-blit `/drum !>(bil)) :: ++ se-show :: show buffer, raw |= lin/(pair @ud stub) @@ -475,7 +474,7 @@ (se-just ta-vew:(se-tame u.gul)) :: ++ se-emit - |= move:agent:mall + |= card:agent:mall %_(+> moz [+< moz]) :: ++ se-hall @@ -497,16 +496,16 @@ :: ++ se-poke :: send a poke |= {gyl/gill:gall par/pear} - (se-emit [ost.hid %pass (en-gill gyl) %send p.gyl q.gyl %poke par]) + (se-emit %pass (en-gill gyl) %agent p.gyl q.gyl %poke par) :: ++ se-peer :: send a peer |= gyl/gill:gall %- se-emit(fug (~(put by fug) gyl ~)) - [ost.hid %pass (en-gill gyl) %send p.gyl q.gyl %peer /sole] + [%pass (en-gill gyl) %agent p.gyl q.gyl %subscribe /sole] :: ++ se-pull :: cancel subscription |= gyl/gill:gall - (se-emit [ost.hid %pass (en-gill gyl) %send p.gyl q.gyl %pull ~]) + (se-emit %pass (en-gill gyl) %agent p.gyl q.gyl %unsubscribe ~) :: ++ se-tame :: switch connection |= gyl/gill:gall diff --git a/pkg/arvo/lib/hood/helm-mall.hoon b/pkg/arvo/lib/hood/helm-mall.hoon index 3bd2051a4..508a9747c 100644 --- a/pkg/arvo/lib/hood/helm-mall.hoon +++ b/pkg/arvo/lib/hood/helm-mall.hoon @@ -34,19 +34,20 @@ :::: :: :: :: :: :: |: $:{bowl:gall part} :: main helm work -=+ sez=(~(gut by hoc) ost $:session) -=| moz=(list move:agent:mall) +=/ ost 0 +=+ sez=(~(gut by hoc) $:session) +=| moz=(list card:agent:mall) |% ++ abet - [(flop moz) %_(+<+.$ hoc (~(put by hoc) ost sez))] + [(flop moz) %_(+<+.$ hoc (~(put by hoc) sez))] :: ++ emit - |= (wind internal-note:mall internal-gift:mall) - %_(+> moz [[ost +<] moz]) + |= card:agent:mall + %_(+> moz [+< moz]) :: ++ flog |= =flog:dill - (emit %pass /di %meta %d !>([%flog flog])) + (emit %pass /di %arvo %d %flog flog) :: ++ emil :: return cards |= (list (wind internal-note:mall internal-gift:mall)) @@ -66,18 +67,18 @@ ?. =(our who.u.sed) ~& [%wrong-private-key-ship who.u.sed] +>.$ - (emit %pass / %meta %j !>([%rekey lyf.u.sed key.u.sed])) + (emit %pass / %arvo %j %rekey lyf.u.sed key.u.sed) :: ++ poke-moon :: rotate moon keys |= sed=(unit [=ship =udiff:point:able:jael]) =< abet ?~ sed +>.$ - (emit %pass / %meta %j !>([%moon u.sed])) + (emit %pass / %arvo %j %moon u.sed) :: ++ poke-nuke :: initialize |= him/ship =< abet - (emit %pass /helm %meta %j !>([%nuke him])) + (emit %pass /helm %arvo %j %nuke him) :: ++ poke-mass |= ~ =< abet @@ -87,17 +88,17 @@ |= recur=@dr =. mass-timer.sez [/helm/automass (add now recur) recur] - abet:(emit %pass way.mass-timer.sez %meta %b !>([%wait nex.mass-timer.sez])) + abet:(emit %pass way.mass-timer.sez %arvo %b %wait nex.mass-timer.sez) :: ++ poke-cancel-automass |= ~ - abet:(emit %pass way.mass-timer.sez %meta %b !>([%rest nex.mass-timer.sez])) + abet:(emit %pass way.mass-timer.sez %arvo %b %rest nex.mass-timer.sez) :: ++ poke-bonk |= ~ ~& .^((unit @da) %a /(scot %p our)/time/(scot %da now)/(scot %p our)) %- %- slog :_ ~ .^(tank %b /(scot %p our)/timers/(scot %da now)) - abet:(emit %pass /bonk %meta %a !>([%bonk ~])) + abet:(emit %pass /bonk %arvo %a %bonk ~) :: ++ take-wake-automass |= [way=wire error=(unit tang)] @@ -108,15 +109,15 @@ =. nex.mass-timer.sez (add now tim.mass-timer.sez) =< abet %- emil - :~ [%pass /heft %meta %d !>([%flog %crud %hax-heft ~])] - [%pass way.mass-timer.sez %meta %b !>([%wait nex.mass-timer.sez])] + :~ [%pass /heft %arvo %d %flog %crud %hax-heft ~] + [%pass way.mass-timer.sez %arvo %b %wait nex.mass-timer.sez] == :: ++ poke-send-hi |= {her/ship mes/(unit tape)} =< abet %- emit :* %pass /helm/hi/(scot %p her) - %send her %hood %poke + %agent her %hood %poke %helm-hi !>(?~(mes '' (crip u.mes))) == :: @@ -163,7 +164,7 @@ =+ zus==('z' tip) =+ way=?:(zus (welp top /sys/[nam]) (welp top /sys/vane/[nam])) =+ fil=.^(@ %cx (welp way /hoon)) - [%pass /reload %meta %d !>([%flog %veer ?:(=('z' tip) %$ tip) way fil])] + [%pass /reload %arvo %d %flog %veer ?:(=('z' tip) %$ tip) way fil] :: +poke-reset: send %lyra to initiate kernel upgrade :: :: And reinstall %zuse and the vanes with %veer. @@ -177,10 +178,10 @@ =/ top=path /(scot %p our)/home/(scot %da now)/sys =/ hun .^(@ %cx (welp top /hoon/hoon)) =/ arv .^(@ %cx (welp top /arvo/hoon)) - :- [%pass /reset %meta %d !>([%flog %lyra `@t`hun `@t`arv])] + :- [%pass /reset %arvo %d %flog %lyra `@t`hun `@t`arv] %+ turn (module-ova:pill top) - |=([=wire =flog:dill] [%pass wire %meta %d !>([%flog flog])]) + |=([=wire =flog:dill] [%pass wire %arvo %d %flog flog]) :: ++ poke-verb :: toggle verbose |= ~ =< abet @@ -188,18 +189,18 @@ :: ++ poke-serve |= [=binding:eyre =generator:eyre] =< abet - (emit %pass /helm/serv %meta %e !>([%serve binding generator])) + (emit %pass /helm/serv %arvo %e %serve binding generator) :: ++ take-bound |= [wir=wire success=? binding=binding:eyre] =< abet (flog %text "bound: {}") :: ++ take - |= [=wire =vase] + |= [=wire =sign-arvo] ?+ wire ~|([%helm-bad-take-wire wire] !!) [%automass *] %+ take-wake-automass t.wire - +:(need !<([%wake (unit tang)] vase)) + ?>(?=(%wake +<.sign-arvo) +>.sign-arvo) [%serv *] %+ take-bound t.wire - +:(need !<([%bound ? binding:eyre] vase)) + ?>(?=(%bound +<.sign-arvo) +>.sign-arvo) == -- diff --git a/pkg/arvo/lib/hood/kiln-mall.hoon b/pkg/arvo/lib/hood/kiln-mall.hoon index 98e369130..96440d759 100644 --- a/pkg/arvo/lib/hood/kiln-mall.hoon +++ b/pkg/arvo/lib/hood/kiln-mall.hoon @@ -13,7 +13,7 @@ ++ part {$kiln $0 pith} :: kiln state ++ pith :: :: $: rem/(map desk per-desk) :: - syn/(map kiln-sync {let/@ud ust/bone}) :: + syn/(map kiln-sync let/@ud) :: autoload-on/? :: cur-hoon/@uvI :: cur-arvo/@uvI :: @@ -60,13 +60,13 @@ :: :: :: |= {bowl:gall part} :: main kiln work ?> =(src our) -|_ moz/(list move:agent:mall) +|_ moz/(list card:agent:mall) ++ abet :: resolve [(flop moz) `part`+<+.$] :: ++ emit - |= (wind internal-note:mall internal-gift:mall) - %_(+> moz [[ost +<] moz]) + |= card:agent:mall + %_(+> moz [+< moz]) :: ++ emil :: return cards |= (list (wind internal-note:mall internal-gift:mall)) @@ -81,17 +81,17 @@ ++ poke-commit |= [mon/kiln-commit auto=?] =< abet - =. +>.$ (emit %pass /commit %meta %c !>([%dirk mon])) + =. +>.$ (emit %pass /commit %arvo %c [%dirk mon]) ?. auto +>.$ =/ recur ~s1 =. commit-timer [/kiln/autocommit (add now recur) recur mon] - (emit %pass way.commit-timer %meta %b !>([%wait nex.commit-timer])) + (emit %pass way.commit-timer %arvo %b [%wait nex.commit-timer]) :: ++ poke-cancel-autocommit |= ~ - abet:(emit %pass way.commit-timer %meta %b !>([%rest nex.commit-timer])) + abet:(emit %pass way.commit-timer %arvo %b [%rest nex.commit-timer]) :: ++ poke-mount |= kiln-mount @@ -99,7 +99,7 @@ ?~ bem =+ "can't mount bad path: {}" abet:(spam leaf+- ~) - abet:(emit %pass /mount %meta %c !>([%mont pot u.bem])) + abet:(emit %pass /mount %arvo %c [%mont pot u.bem]) :: ++ poke-unmount |= mon/kiln-unmount @@ -108,8 +108,8 @@ ?~ bem =+ "can't unmount bad path: {}" abet:(spam leaf+- ~) - abet:(emit %pass /unmount-beam %meta %c !>([%ogre [[p q r] s]:u.bem])) - abet:(emit %pass /unmount-point %meta %c !>([%ogre mon])) + abet:(emit %pass /unmount-beam %arvo %c [%ogre [[p q r] s]:u.bem]) + abet:(emit %pass /unmount-point %arvo %c [%ogre mon]) :: ++ poke-track :: |= hos/kiln-sync @@ -145,13 +145,13 @@ :: ++ poke-cancel |= syd/desk - abet:(emit %pass /cancel %meta %c !>([%drop syd])) + abet:(emit %pass /cancel %arvo %c [%drop syd]) :: ++ poke-info |= {mez/tape tor/(unit toro)} ?~ tor abet:(spam leaf+mez ~) - abet:(emit:(spam leaf+mez ~) %pass /kiln %meta %c !>([%info u.tor])) + abet:(emit:(spam leaf+mez ~) %pass /kiln %arvo %c [%info u.tor]) :: ++ poke-rm |= a/path @@ -178,7 +178,7 @@ =< abet %- emit =/ =rite [%r ~ ?:(pub %black %white) ~] - [%pass /kiln/permission %meta %c !>([%perm syd pax rite])] + [%pass /kiln/permission %arvo %c [%perm syd pax rite]] :: ++ poke-autoload |=(lod/(unit ?) abet:(poke:autoload lod)) ++ poke-start-autoload |=(~ abet:start:autoload) @@ -220,7 +220,7 @@ :: ++ subscribe-next %- emit - [%pass /kiln/autoload %meta %c !>([%warp our %home `[%next %z da+now /sys]])] + [%pass /kiln/autoload %arvo %c [%warp our %home `[%next %z da+now /sys]]] :: ++ writ =>(check-new subscribe-next) ++ check-new @@ -232,14 +232,14 @@ =. cur-hoon new-hoon =. cur-arvo new-arvo =. cur-vanes rehash-vanes - (emit %pass /kiln/reload/hoon %send our %hood %poke %helm-reset !>(~)) + (emit %pass /kiln/reload/hoon %agent our %hood %poke %helm-reset !>(~)) :: XX updates cur-vanes? =/ new-zuse (sys-hash /zuse/hoon) ?: !=(new-zuse cur-zuse) =. cur-zuse new-zuse =. cur-vanes rehash-vanes =/ =cage [%helm-reload !>([%zuse tracked-vanes])] - (emit [%pass /kiln/reload/zuse %send our %hood %poke cage]) + (emit [%pass /kiln/reload/zuse %agent our %hood %poke cage]) (roll tracked-vanes load-vane) :: ++ load-vane @@ -251,7 +251,7 @@ +>.$ =. cur-vanes (~(put by cur-vanes) syd new-vane) =/ =cage [%helm-reload !>(~[syd])] - (emit %pass /kiln/reload/[syd] %send our %hood %poke cage) + (emit %pass /kiln/reload/[syd] %agent our %hood %poke cage) :: ++ coup-reload |= {way/wire saw/(unit tang)} @@ -263,17 +263,17 @@ :: +poke-overload: wipes ford cache at {start}, and then every {recur}. |= [recur=@dr start=@da] ?> (gte start now) - abet:(emit %pass /kiln/overload/(scot %dr recur) %meta %c !>([%wait start])) + abet:(emit %pass /kiln/overload/(scot %dr recur) %arvo %c [%wait start]) :: ++ poke-wipe-ford - |=(percent=@ud abet:(emit %pass /kiln %meta %c !>([%wipe percent]))) + |=(percent=@ud abet:(emit %pass /kiln %arvo %c [%wipe percent])) :: ++ poke-keep-ford |= [compiler-cache-size=@ud build-cache-size=@ud] =< abet - (emit %pass /kiln %meta %c !>([%keep compiler-cache-size build-cache-size])) + (emit %pass /kiln %arvo %c [%keep compiler-cache-size build-cache-size]) :: -++ poke-wash-gall |=(* abet:(emit %pass /kiln %meta %c !>([%wash ~]))) +++ poke-wash-gall |=(* abet:(emit %pass /kiln %arvo %c [%wash ~])) :: ++ mack |= {way/wire saw/(unit tang)} @@ -281,28 +281,28 @@ abet :: ++ take-general - |= [=wire =vase] + |= [=wire =sign-arvo] ?- wire [%sync %merg *] %+ take-mere-sync t.t.wire - +:(need !<([%mere (each (set path) (pair term tang))] vase)) + ?>(?=(%mere +<.sign-arvo) +>.sign-arvo) [%autoload *] %+ take-writ-autoload t.wire - +:(need !<([%writ riot] vase)) + ?>(?=(%writ +<.sign-arvo) +>.sign-arvo) [%find-ship *] %+ take-writ-find-ship t.wire - +:(need !<([%writ riot] vase)) + ?>(?=(%writ +<.sign-arvo) +>.sign-arvo) [%sync *] %+ take-writ-sync t.wire - +:(need !<([%writ riot] vase)) + ?>(?=(%writ +<.sign-arvo) +>.sign-arvo) [%overload *] %+ take-wake-overload t.wire - +:(need !<([%wake (unit tang)] vase)) + ?>(?=(%wake +<.sign-arvo) +>.sign-arvo) [%autocommit *] %+ take-wake-autocommit t.wire - +:(need !<([%wake (unit tang)] vase)) + ?>(?=(%wake +<.sign-arvo) +>.sign-arvo) * - ?+ -.q.vase ~|([%kiln-bad-take-card -.q.vase] !!) + ?+ +<.sign-arvo ~|([%kiln-bad-take-card -.q.vase] !!) %mack %+ mack wire - +:(need !<([%mack (unit tang)] vase)) + ?>(?=(%mack +<.sign-arvo) +>.sign-arvo) %made %+ take-made wire - +:(need !<([%made @da made-result:ford] vase)) + ?>(?=(%made +<.sign-arvo) +>.sign-arvo) %mere %+ take-mere wire - +:(need !<([%mere (each (set path) (pair term tang))] vase)) + ?>(?=(%mere +<.sign-arvo) +>.sign-arvo) == == ++ take |=(way/wire ?>(?=({@ ~} way) (work i.way))) :: general handler @@ -391,8 +391,8 @@ =. nex.commit-timer (add now tim.commit-timer) =< abet %- emil - :~ [%pass /commit %meta %c !>([%dirk mon.commit-timer])] - [%pass way.commit-timer %meta %b !>([%wait nex.commit-timer])] + :~ [%pass /commit %arvo %c [%dirk mon.commit-timer]] + [%pass way.commit-timer %arvo %b [%wait nex.commit-timer]] == :: :: @@ -404,19 +404,19 @@ :: ++ auto |= kiln-sync - =+ (~(gut by syn) [syd her sud] [let=*@ud ust=ost]) + =+ (~(gut by syn) [syd her sud] let=*@ud) |% ++ abet ..auto(syn (~(put by syn) [syd her sud] let ust)) :: ++ blab - |= new/(list move:agent:mall) + |= new/(list card:agent:mall) ^+ +> +>.$(moz (welp new moz)) :: ++ warp |= [=bone =wire =ship =riff] - (blab [bone %pass wire %meta %c !>([%warp ship riff])] ~) + (blab [bone %pass wire %arvo %c [%warp ship riff]] ~) :: ++ spam |*(* %_(+> ..auto (^spam +<))) ++ stop @@ -429,18 +429,18 @@ => (spam (render "activated track" sud her syd) ~) =. let 1 =/ =wire /kiln/sync/[syd]/(scot %p her)/[sud] - (warp ost wire her sud `[%sing %y ud+let /]) + (warp wire her sud `[%sing %y ud+let /]) :: ++ start-sync => (spam (render "finding ship and desk" sud her syd) ~) =/ =wire /kiln/find-ship/[syd]/(scot %p her)/[sud] - (warp ost wire her sud `[%sing %y ud+1 /]) + (warp wire her sud `[%sing %y ud+1 /]) :: ++ take-find-ship |= rot=riot => (spam (render "activated sync" sud her syd) ~) =/ =wire /kiln/sync/[syd]/(scot %p her)/[sud] - (warp ost wire her sud `[%sing %w [%da now] /]) + (warp wire her sud `[%sing %w [%da now] /]) :: ++ writ |= rot=riot @@ -475,7 +475,7 @@ =< %- spam ?: =(our her) ~ [(render "beginning sync" sud her syd) ~] - (blab [ost %pass wire %meta %c !>([%merg syd her sud ud+let germ])] ~) + (blab [%pass wire %arvo %c [%merg syd her sud ud+let germ]] ~) :: ++ mere |= mes=(each (set path) (pair term tang)) @@ -506,7 +506,7 @@ == == =/ =wire /kiln/sync/[syd]/(scot %p her)/[sud] - (warp ost wire her sud `[%sing %y ud+let /]) + (warp wire her sud `[%sing %y ud+let /]) -- :: ++ work :: state machine @@ -520,7 +520,7 @@ ..work(rem (~(put by rem) syd auto gem her sud cas)) :: ++ blab - |= new/(list move:agent:mall) + |= new/(list card:agent:mall) ^+ +> +>.$(moz (welp new moz)) :: @@ -541,14 +541,14 @@ :: ++ perform :: ^+ . - (blab [ost %pass /kiln/[syd] %meta %c !>([%merg syd her sud cas gem])] ~) + (blab [%pass /kiln/[syd] %arvo %c [%merg syd her sud cas gem]] ~) :: ++ fancy-merge :: send to self |= {syd/desk her/@p sud/desk gem/?($auto germ)} ^+ +> =/ =cage [%kiln-merge !>([syd her sud cas gem])] %- blab :_ ~ - [ost %pass /kiln/fancy/[^syd] %send our %hood %poke cage] + [%pass /kiln/fancy/[^syd] %agent our %hood %poke cage] :: ++ spam ::|=(tang ((slog +<) ..spam)) |*(* +>(..work (^spam +<))) @@ -568,8 +568,8 @@ ?~ saw => (spam leaf+"%melding %{(trip sud)} into scratch space" ~) %- blab :_ ~ - =/ =vase !>([%merg (cat 3 syd '-scratch') her sud cas gem]) - [ost %pass /kiln/[syd] %meta %c vase] + =/ note [%merg (cat 3 syd '-scratch') her sud cas gem] + [%pass /kiln/[syd] %arvo %c note] =+ :- "failed to set up conflict resolution scratch space" "I'm out of ideas" lose:(spam leaf+-< leaf+-> u.saw) @@ -588,7 +588,7 @@ =+ tic=(cat 3 syd '-scratch') %- blab :_ ~ =, ford - :* ost %pass /kiln/[syd] %meta %f !> + :* %pass /kiln/[syd] %arvo %f :* %build live=%.n ^- schematic :- %list @@ -718,7 +718,7 @@ =< win %- blab:(spam tan) :_ ~ - :* ost %pass /kiln/[syd] %meta %c !> + :* %pass /kiln/[syd] %arvo %c :* %info (cat 3 syd '-scratch') %& %+ murn can diff --git a/pkg/arvo/lib/hood/write-mall.hoon b/pkg/arvo/lib/hood/write-mall.hoon index 65e944d25..5a4e82bb4 100644 --- a/pkg/arvo/lib/hood/write-mall.hoon +++ b/pkg/arvo/lib/hood/write-mall.hoon @@ -21,11 +21,11 @@ :: |= {bowl:gall part} =* par +<+ -|_ moz/(list move:agent:mall) +|_ moz/(list card:agent:mall) ++ abet [(flop moz) `part`par] ++ emit - |= a/(wind internal-note:mall internal-gift:mall) - %_(+> moz :_(moz [ost a])) + |= =card:agent:mall + %_(+> moz :_(moz card)) :: ++ beak-now byk(r [%da now]) ++ poke-wipe @@ -33,7 +33,7 @@ =+ ext=%md ?~ (file (en-beam beak-now [ext sup])) ~|(not-found+[ext `path`(flop sup)] !!) - =- abet:(emit %pass /write %meta %c !>([%info -])) + =- abet:(emit %pass /write %arvo %c %info -) (fray (en-beam beak-now [ext sup])) :: ++ poke-tree @@ -94,13 +94,13 @@ (made pax now [%complete %success %$ cay]) =< abet %- emit :* - %pass write+pax %meta %f !> - :* %build + %pass write+pax %arvo %f + %build live=%.n :: XX defer %nice ^- schematic:ford :: SYNTAX ERROR AT START OF LINE? =/ =beak beak-now [%cast [p q]:beak u.ext [%$ cay]] - == == + == :: ++ made |= [pax=wire date=@da result=made-result:ford] @@ -118,12 +118,13 @@ :: =/ =cage (result-to-cage:ford build-result) :: - =- abet:(emit %pass /write %meta %c !>([%info -])) + =- abet:(emit %pass /write %arvo %c %info -) :: (foal :(welp (en-beam beak-now ~) pax /[-.cage]) cage) :: ++ take :: - |= [=wire =vase] + |= [=wire =sign-arvo] %+ made wire - +:(need !<([%made @da made-result:ford] vase)) + ?> ?=(%made +<.sign-arvo) + +>.sign-arvo -- diff --git a/pkg/arvo/sys/vane/mall.hoon b/pkg/arvo/sys/vane/mall.hoon index 86ab8c47f..d6d3e019a 100644 --- a/pkg/arvo/sys/vane/mall.hoon +++ b/pkg/arvo/sys/vane/mall.hoon @@ -35,10 +35,10 @@ :: +foreign-response: foreign response :: ++ foreign-response - $? %peer - %peel + $? %subscribe + %subscribe-translated %poke - %pull + %unsubscribe == -- |% @@ -74,7 +74,7 @@ outgoing=boat :: queue meter :: - meter=(map bone @ud) + meter=(map duct @ud) == :: +agents: ship state :: @@ -115,19 +115,6 @@ :: duct-map=(map @ud duct) == -:: +ducts: opaque input -:: -++ ducts - $: :: bone sequence - :: - bone=@ud - :: by duct - :: - bone-map=(map duct bone) - :: by bone - :: - duct-map=(map bone duct) - == :: +running-agent: agent state :: ++ running-agent @@ -154,14 +141,11 @@ =beak :: req'd translations :: - marks=(map bone mark) - :: opaque ducts - :: - =ducts + marks=(map duct mark) == :: +blocked: blocked tasks :: -++ blocked (qeu (trel duct routes agent-action)) +++ blocked (qeu (trel duct routes task:agent)) :: +stats: statistics :: ++ stats @@ -306,7 +290,7 @@ =/ wag =/ =routes [disclosing=~ attributing=our] =/ app (ap-abed:ap term routes) - (ap-prep:app ~) + (ap-upgrade-state:app ~) :: =/ maybe-tang -.wag =/ app +.wag @@ -327,18 +311,12 @@ |= [=term =beak =agent] ^+ mo-core :: - =/ =ducts - :+ bone=1 - bone-map=[[[~ ~] 0] ~ ~] - duct-map=[[0 [~ ~]] ~ ~] - :: =/ running-agent =/ default-agent *running-agent %_ default-agent control-duct hen beak beak agent agent - ducts ducts == :: %_ mo-core @@ -350,38 +328,31 @@ :: ++ mo-handle-foreign-request ~/ %mo-handle-foreign-request - |= [=ship =internal-task] + |= [=ship =term =task:agent] ^+ mo-core :: - =/ =term p.internal-task - =/ =agent-action q.internal-task - ?: ?=(%pump -.agent-action) + ?: ?=(%pump -.task) :: - :: you'd think this would send an ack for the diff - :: that caused this pump. it would, but we already - :: sent it when we got the diff in +mo-handle-sys. then - :: we'd have to save the network duct and connect it - :: to this returning pump. + :: you'd think this would send an ack for the diff that caused + :: this pump. it would, but we already sent it when we got the + :: diff in +mo-handle-sys. then we'd have to save the network + :: duct and connect it to this returning pump. :: mo-core :: - ?: ?=(%peer-not -.agent-action) - =/ =tang p.agent-action - (mo-give %unto %reap (some tang)) - :: =^ bone mo-core (mo-assign-bone ship) =/ =forward-ames - ?- -.agent-action - %poke [%m p.p.agent-action q.q.p.agent-action] - %pull [%u ~] - %puff !! - %punk !! - %peel [%l agent-action] - %peer [%s p.agent-action] + ?- -.task + %poke [%m p.cage.task q.q.cage.task] + %unsubscribe [%u ~] + %raw-poke !! + %poke-translated !! + %subscribe-translated [%l task] + %subscribe [%s path.task] == :: =/ sys-path - =/ action -.agent-action + =/ action -.task /sys/way/[action] :: =/ =note-arvo @@ -408,10 +379,10 @@ :: =/ result (bind art to-tang) ?- foreign-response - %peel (mo-give %unto %reap result) - %peer (mo-give %unto %reap result) - %poke (mo-give %unto %coup result) - %pull mo-core + %subscribe-translated (mo-give %unto %subscription-ack result) + %subscribe (mo-give %unto %subscription-ack result) + %poke (mo-give %unto %poke-ack result) + %unsubscribe mo-core == :: +mo-assign-bone: assign an outbone to a ship. :: @@ -485,7 +456,8 @@ (mo-receive-core i.t.path beak result.sign-arvo) :: +mo-handle-sys-pel: translated peer. :: - :: Validates a received %ford result and %gives an internal %diff. + :: Validates a received %ford result and %gives an internal + :: %subscription-update. :: ++ mo-handle-sys-pel |= [=path =sign-arvo] @@ -496,22 +468,22 @@ :: ?: ?=([%incomplete *] result.sign-arvo) =/ err (some tang.result.sign-arvo) - (mo-give %unto %coup err) + (mo-give %unto %poke-ack err) :: =/ build-result build-result.result.sign-arvo :: ?: ?=([%error *] build-result) =/ err (some message.build-result) - (mo-give %unto %coup err) + (mo-give %unto %poke-ack err) :: =/ =cage (result-to-cage:ford build-result) - (mo-give %unto %diff cage) + (mo-give %unto %subscription-update ~ cage) :: +mo-handle-sys-red: diff ack. :: :: On receipt of a valid +sign from %ames, we simply pass a %pump :: acknowledgement internally; otherwise we pass both an internal - :: unsubscribing %pull, plus a %want to %ames, before complaining about a - :: bad message acknowledgment. + :: unsubscribing %unsubscribe, plus a %want to %ames, before + :: complaining about a bad message acknowledgment. :: ++ mo-handle-sys-red |= [=path =sign-arvo] @@ -533,15 +505,15 @@ ?~ coop =/ =note-arvo =/ =sock [him our] - =/ =internal-task [dap %pump ~] - =/ =task:able [%deal sock internal-task] + =/ =task:agent [%pump ~] + =/ =task:able [%deal sock dap task] [%m task] (mo-pass sys-path note-arvo) :: =/ mall-move=note-arvo =/ =sock [him our] - =/ =internal-task [dap %pull ~] - =/ =task:able [%deal sock internal-task] + =/ =task:agent [%unsubscribe ~] + =/ =task:able [%deal sock dap task] [%m task] :: =/ ames-move=note-arvo @@ -562,8 +534,9 @@ (print mo-core) :: +mo-handle-sys-rep: reverse request. :: - :: On receipt of a valid +sign from %ford, sets state to the appropriate - :: duct and gives an internal %diff containing the +sign payload. + :: On receipt of a valid +sign from %ford, sets state to the + :: appropriate duct and gives an internal %subscription-update + :: containing the +sign payload. :: ++ mo-handle-sys-rep |= [=path =sign-arvo] @@ -589,8 +562,8 @@ =/ duct (mo-retrieve-duct him num) =. mo-core (mo-abed duct) =/ =cage (result-to-cage:ford build-result) - =/ move [%unto [%diff cage]] - (mo-give move) + =/ =gift:able [%unto [%subscription-update ~ cage]] + (mo-give gift) :: +mo-handle-sys-req: process an inbound request. :: ++ mo-handle-sys-req @@ -622,21 +595,21 @@ mo-core :: ?> ?=([%m %unto *] sign-arvo) - =/ =internal-gift +>.sign-arvo + =/ =gift:agent +>.sign-arvo :: - ?- -.internal-gift - %coup - (mo-give %mack p.internal-gift) + ?- -.gift + %poke-ack + (mo-give %mack p.gift) :: - %diff + %subscription-update =/ sys-path [%sys %red t.path] =/ =note-arvo =/ path [%m %gh dap ~] - =/ noun [num %d p.p.internal-gift q.q.p.internal-gift] + =/ noun [num %d p.cage.gift q.q.cage.gift] [%a %want him path noun] (mo-pass sys-path note-arvo) :: - %quit + %subscription-close =/ sys-path [%sys path] =/ =note-arvo =/ path [%m %gh dap ~] @@ -644,8 +617,8 @@ [%a %want him path noun] (mo-pass sys-path note-arvo) :: - %reap - (mo-give %mack p.internal-gift) + %subscription-ack + (mo-give %mack p.gift) :: %http-response !! @@ -665,17 +638,17 @@ =/ =term i.t.t.path ?: ?=([%incomplete *] result.sign-arvo) =/ err (some tang.result.sign-arvo) - (mo-give %unto %coup err) + (mo-give %unto %poke-ack err) :: =/ build-result build-result.result.sign-arvo ?: ?=([%error *] build-result) =/ err (some message.build-result) - (mo-give %unto %coup err) + (mo-give %unto %poke-ack err) :: =/ =routes [disclosing=~ attributing=ship] =/ =cage (result-to-cage:ford build-result) - =/ =agent-action [%poke cage] - (mo-apply term routes agent-action) + =/ =task:agent [%poke cage] + (mo-apply term routes task) :: +mo-handle-sys-way: outbound request. :: ++ mo-handle-sys-way @@ -711,12 +684,11 @@ :: =/ =sign-arvo q.hin ?. ?=([%m %unto *] sign-arvo) - =/ =vase (slot 3 hin) - =. app (ap-generic-take:app t.t.path vase) + =. app (ap-generic-take:app t.t.path sign-arvo) ap-abet:app =. app - =/ =internal-gift +>.sign-arvo - (ap-specific-take:app t.t.path internal-gift) + =/ =gift:agent +>.sign-arvo + (ap-specific-take:app t.t.path gift) ap-abet:app :: +mo-clear-queue: clear blocked tasks from the specified running agent. :: @@ -741,12 +713,11 @@ =^ task blocked [p q]:~(get to blocked) =/ =duct p.task =/ =routes q.task - =/ =agent-action r.task + =/ =task:agent r.task :: =/ move =/ =sock [attributing.routes our] - =/ =internal-task [term agent-action] - =/ card [%slip %m %deal sock internal-task] + =/ card [%slip %m %deal sock term task] [duct card] $(moves [move moves]) :: +mo-beak: assemble a beak for the specified agent. @@ -773,7 +744,7 @@ :: +mo-apply: apply the supplied action to the specified agent. :: ++ mo-apply - |= [=term =routes =agent-action] + |= [=term =routes =task:agent] ^+ mo-core :: =/ =path @@ -784,22 +755,18 @@ =/ =beak (mo-beak term) [p q]:beak :: - ?: ?=(%puff -.agent-action) - =/ =schematic:ford [%vale ship-desk +.agent-action] + ?: ?=(%raw-poke -.task) + =/ =schematic:ford [%vale ship-desk +.task] =/ =note-arvo [%f %build live=%.n schematic] (mo-pass path note-arvo) :: - ?: ?=(%punk -.agent-action) - =/ =schematic:ford [%cast ship-desk p.agent-action [%$ q.agent-action]] + ?: ?=(%poke-translated -.task) + =/ =schematic:ford [%cast ship-desk mark.task [%$ cage.task]] =/ =note-arvo [%f %build live=%.n schematic] (mo-pass path note-arvo) :: - ?: ?=(%peer-not -.agent-action) - =/ err (some p.agent-action) - (mo-give %unto %reap err) - :: =/ app (ap-abed:ap term routes) - =. app (ap-apply:app agent-action) + =. app (ap-apply:app task) ap-abet:app :: +mo-handle-local: handle locally. :: @@ -807,12 +774,10 @@ :: Otherwise simply apply the action to the agent. :: ++ mo-handle-local - |= [=ship =internal-task] + |= [=ship =term =task:agent] ^+ mo-core :: =/ =routes [disclosing=~ attributing=ship] - =/ =term p.internal-task - =/ =agent-action q.internal-task =/ is-running (~(has by running.agents.state) term) =/ is-blocked (~(has by blocked.agents.state) term) :: @@ -820,13 +785,13 @@ =/ =blocked =/ waiting (~(get by blocked.agents.state) term) =/ tasks (fall waiting *blocked) - =/ task [hen routes agent-action] + =/ task [hen routes task] (~(put to tasks) task) :: %_ mo-core blocked.agents.state (~(put by blocked.agents.state) term blocked) == - (mo-apply term routes agent-action) + (mo-apply term routes task) :: +mo-handle-forward: handle forward %ames message. :: ++ mo-handle-forward @@ -848,26 +813,26 @@ ?- -.forward-ames %m =/ =task:able - =/ =internal-task [term %puff [mark noun]:forward-ames] - [%deal sock internal-task] + =/ =task:agent [%raw-poke [mark noun]:forward-ames] + [%deal sock term task] [%m task] :: %l =/ =task:able - =/ =internal-task [term %peel [mark path]:forward-ames] - [%deal sock internal-task] + =/ =task:agent [%subscribe-translated [mark path]:forward-ames] + [%deal sock term task] [%m task] :: %s =/ =task:able - =/ =internal-task [term %peer path.forward-ames] - [%deal sock internal-task] + =/ =task:agent [%subscribe path.forward-ames] + [%deal sock term task] [%m task] :: %u =/ =task:able - =/ =internal-task [term %pull ~] - [%deal sock internal-task] + =/ =task:agent [%unsubscribe ~] + [%deal sock term task] [%m task] == (mo-pass path note-arvo) @@ -898,7 +863,7 @@ =/ initialised =/ out (mo-retrieve-duct ship bone) (mo-abed out) - (mo-give:initialised %unto %quit ~) + (mo-give:initialised %unto %subscription-close ~) == :: +ap: agent engine :: @@ -909,8 +874,8 @@ ~% %mall-ap +> ~ |_ $: agent-name=term agent-routes=routes - agent-bone=bone - agent-moves=(list internal-move) + agent-duct=duct + agent-cards=(list card:agent) agent-config=(list (each suss tang)) current-agent=running-agent == @@ -936,19 +901,8 @@ =. agent-name term =. agent-routes routes =. current-agent running-agent - =/ maybe-bone (~(get by bone-map.ducts.running-agent) hen) - ?^ maybe-bone - ap-core(agent-bone u.maybe-bone) - :: - =/ =ducts - :+ +(bone.ducts.running-agent) - (~(put by bone-map.ducts.running-agent) hen bone.ducts.running-agent) - (~(put by duct-map.ducts.running-agent) bone.ducts.running-agent hen) - :: - %_ ap-core - agent-bone bone.ducts.running-agent - ducts.current-agent ducts - == + =. agent-duct hen + ap-core :: +ap-abet: resolve moves. :: ++ ap-abet @@ -958,7 +912,8 @@ =/ running (~(put by running.agents.state) agent-name current-agent) =/ moves =/ giver |=(report=(each suss tang) [hen %give %onto report]) - =/ from-internal (turn agent-moves ap-from-internal) + =/ from-internal=(list move) + (zing (turn agent-cards ap-from-internal)) =/ from-suss (turn agent-config giver) :(weld from-internal from-suss moves) :: @@ -971,118 +926,130 @@ ++ ap-track-queue ^+ ap-core :: - =/ internal-moves agent-moves - =/ bones *(set bone) + =/ internal-cards agent-cards + =/ bad-ducts *(set duct) |- ^+ ap-core - ?^ internal-moves - =/ =internal-move i.internal-moves - ?. ?=([%give %diff *] move.internal-move) - $(internal-moves t.internal-moves) + ?^ internal-cards + =/ =card:agent i.internal-cards + ?. ?=([%give %subscription-update *] card) + $(internal-cards t.internal-cards) :: - =^ filled ap-core ap-enqueue(agent-bone bone.internal-move) - =/ new-bones + =/ ducts (ap-ducts-from-path path.p.card) + |- ^+ ap-core + ?~ ducts + ^$(internal-cards t.internal-cards) + =^ filled ap-core ap-enqueue(agent-duct i.ducts) + =. bad-ducts ?: filled - bones - (~(put in bones) bone.internal-move) - $(internal-moves t.internal-moves, bones new-bones) + bad-ducts + (~(put in bad-ducts) i.ducts) + $(ducts t.ducts) :: - =/ bones ~(tap in bones) + =/ ducts ~(tap in bad-ducts) :: |- ^+ ap-core - ?~ bones + ?~ ducts ap-core :: - => $(bones t.bones, agent-bone i.bones) + => $(ducts t.ducts, agent-duct i.ducts) =/ incoming - (~(get by incoming.subscribers.current-agent) agent-bone) + (~(get by incoming.subscribers.current-agent) agent-duct) ?~ incoming - ~& [%ap-track-queue-bad-bone agent-name agent-bone] + ~& [%ap-track-queue-bad-duct agent-name agent-duct] ap-core :: =/ =ship p.u.incoming ap-kill(attributing.agent-routes ship) :: +ap-from-internal: internal move to move. :: - :: We convert from bone-indexed moves to duct-indexed moves when - :: resolving them in Arvo. + :: We convert from cards to duct-indexed moves when resolving + :: them in Arvo. :: ++ ap-from-internal ~/ %ap-from-internal - |= =internal-move - ^- move + |= =card:agent + ^- (list move) :: - ~| [%mall-move-conversion-failed internal-move] - =/ =duct - (~(got by duct-map.ducts.current-agent) bone.internal-move) + ?- -.card + %slip !! :: - =/ card - ?- -.move.internal-move - %slip !! + %give + =/ =gift:agent p.card + ?. ?=(%subscription-update -.gift) + [agent-duct %give %unto gift]~ :: - %give - ?< =(0 bone.internal-move) - :: - =/ =internal-gift p.move.internal-move - ?. ?=(%diff -.internal-gift) - [%give %unto internal-gift] - :: - =/ =cage p.internal-gift - =/ =mark - =/ mark (~(get by marks.current-agent) bone.internal-move) - (fall mark p.cage) - :: - ?: =(mark p.cage) - [%give %unto internal-gift] - =/ =path /sys/pel/[agent-name] - =/ =note-arvo - =/ =schematic:ford - =/ =beak (mo-beak agent-name) - [%cast [p q]:beak mark [%$ cage]] - [%f %build live=%.n schematic] - :: - [%pass path note-arvo] + =/ ducts=(list duct) (ap-ducts-from-path path.gift) + =/ =cage cage.gift + %+ turn ducts + |= =duct + ~? =(duct system-duct.agents.state) + [%agent-giving-on-system-duct agent-name -.gift] + ^- move + =/ =mark + (~(gut by marks.current-agent) duct p.cage) :: - %pass - =/ =path p.move.internal-move - =/ =internal-note q.move.internal-move - =/ use-path - [%use agent-name (scot %p attributing.agent-routes) path] - =/ =note-arvo - ?- -.internal-note - %send - =/ =task:able - =/ =sock [our ship.internal-note] - =/ =internal-task internal-task.internal-note - [%deal sock internal-task] - [%m task] - :: - %meta - =/ =term term.internal-note - =/ =vase vase.internal-note - [term %meta vase] - == - [%pass use-path note-arvo] - == - [duct card] + ?: =(mark p.cage) + [duct %give %unto gift] + =/ =path /sys/pel/[agent-name] + =/ =note-arvo + =/ =schematic:ford + =/ =beak (mo-beak agent-name) + [%cast [p q]:beak mark [%$ cage]] + [%f %build live=%.n schematic] + :: + [duct %pass path note-arvo] + :: + %pass + =/ =duct system-duct.agents.state + =/ =path p.card + =/ =note:agent q.card + =/ use-path + :: Is it bad that this includes attributing ship? May create + :: spurious duct mismatches + :: + [%use agent-name (scot %p attributing.agent-routes) path] + =/ =note-arvo + ?- -.note + %arvo note-arvo.note + %agent + =/ =task:able + =/ =sock [our ship.note] + [%deal sock [name task]:note] + [%m task] + == + [duct %pass use-path note-arvo]~ + == :: +ap-agent-core: agent core with current bowl and state :: ++ ap-agent-core ~(. agent.current-agent ap-construct-bowl) + :: +ap-ducts-from-path: get ducts subscribed to path + :: + ++ ap-ducts-from-path + |= target-path=(unit path) + ^- (list duct) + ?~ target-path + ~[agent-duct] + %+ murn ~(tap by incoming.subscribers.current-agent) + |= [=duct =ship =path] + ^- (unit ^duct) + ?: =(target-path path) + `duct + ~ :: +ap-apply: apply effect. :: ++ ap-apply - |= =agent-action + |= =task:agent ^+ ap-core :: - ?- -.agent-action - %peel (ap-peel +.agent-action) - %poke (ap-poke +.agent-action) - %peer (ap-peer +.agent-action) - %puff !! - %punk !! - %peer-not !! - %pull ap-load-delete - %pump ap-dequeue + ?- -.task + %subscribe-translated (ap-subscribe-translated +.task) + %poke (ap-poke +.task) + %subscribe (ap-subscribe +.task) + %raw-poke !! + %poke-translated !! + %unsubscribe ap-load-delete + %pump ap-dequeue == :: +ap-peek: peek. :: @@ -1108,77 +1075,75 @@ =/ way [(scot %p ship) %out path] :: ?: is-ok - =/ =internal-note [%send ship -.path %pump ~] - (ap-pass way internal-note) - =. ap-core (ap-give %quit ~) - =/ =internal-note [%send ship -.path %pull ~] - (ap-pass way internal-note) + =/ =note:agent [%agent ship -.path %pump ~] + (ap-pass way note) + =. ap-core (ap-give %subscription-close ~) + =/ =note:agent [%agent ship -.path %unsubscribe ~] + (ap-pass way note) :: +ap-dequeue: drop from queue. :: - :: Dequeues along the current bone, deleting the queue entirely if it + :: Dequeues along the current duct, deleting the queue entirely if it :: drops to zero. :: ++ ap-dequeue ^+ ap-core :: - ?. (~(has by incoming.subscribers.current-agent) agent-bone) + ?. (~(has by incoming.subscribers.current-agent) agent-duct) ap-core - =/ level (~(get by meter.subscribers.current-agent) agent-bone) + =/ level (~(get by meter.subscribers.current-agent) agent-duct) ?: |(?=(~ level) =(0 u.level)) ap-core :: =. u.level (dec u.level) ?: =(0 u.level) - =/ deleted (~(del by meter.subscribers.current-agent) agent-bone) + =/ deleted (~(del by meter.subscribers.current-agent) agent-duct) ap-core(meter.subscribers.current-agent deleted) :: =/ dequeued - (~(put by meter.subscribers.current-agent) agent-bone u.level) + (~(put by meter.subscribers.current-agent) agent-duct u.level) ap-core(meter.subscribers.current-agent dequeued) :: +ap-enqueue: add to queue. :: :: Every agent has a 'meter', that tracks the number of incoming - :: subscribers by bone. We get both the meter and ship associated with - :: the current bone; if the meter has hit twenty for another ship, we + :: subscribers by duct. We get both the meter and ship associated with + :: the current duct; if the meter has hit twenty for another ship, we :: don't enqueue the subscriber. Otherwise we increment the meter for - :: the current bone and update the agent's state with it. + :: the current duct and update the agent's state with it. :: :: Returns a yes if the meter has been incremented, and no otherwise. :: ++ ap-enqueue ^- [? _ap-core] :: - =/ meter (~(gut by meter.subscribers.current-agent) agent-bone 0) + =/ meter (~(gut by meter.subscribers.current-agent) agent-duct 0) =/ subscriber=(unit (pair ship path)) - (~(get by incoming.subscribers.current-agent) agent-bone) + (~(get by incoming.subscribers.current-agent) agent-duct) :: ?: ?& =(20 meter) ?| ?=(~ subscriber) !=(our p.u.subscriber) == == - =/ incoming (~(get by incoming.subscribers.current-agent) agent-bone) - =/ duct (~(get by duct-map.ducts.current-agent) agent-bone) - ~& [%mall-pulling-20 agent-bone incoming duct] + =/ incoming (~(get by incoming.subscribers.current-agent) agent-duct) + ~& [%mall-pulling-20 agent-duct incoming] [%.n ap-core] :: =/ next =/ meter - (~(put by meter.subscribers.current-agent) agent-bone +(meter)) + (~(put by meter.subscribers.current-agent) agent-duct +(meter)) ap-core(meter.subscribers.current-agent meter) :: [%.y next] :: +ap-give: return result. :: ++ ap-give - |= =internal-gift + |= =gift:agent ^+ ap-core :: - =/ internal-moves - =/ move [%give internal-gift] - =/ =internal-move [agent-bone move] - [internal-move agent-moves] - ap-core(agent-moves internal-moves) + =/ internal-cards + =/ =card:agent [%give gift] + [card agent-cards] + ap-core(agent-cards internal-cards) :: +ap-construct-bowl: set up bowl. :: ++ ap-construct-bowl @@ -1191,8 +1156,7 @@ wex=~ :: outgoing sup=incoming.subscribers.current-agent :: incoming == :: - :* agent-bone=agent-bone :: cause - act=change.stats.current-agent :: tick + :* act=change.stats.current-agent :: tick eny=eny.stats.current-agent :: nonce now=time.stats.current-agent :: time byk=beak.current-agent :: source @@ -1200,14 +1164,12 @@ :: +ap-pass: request action. :: ++ ap-pass - |= [=path =internal-note] + |= [=path =note:agent] ^+ ap-core :: - =/ =internal-move - =/ move [%pass path internal-note] - [agent-bone move] - =/ internal-moves [internal-move agent-moves] - ap-core(agent-moves internal-moves) + =/ =card:agent [%pass path note] + =/ internal-cards [card agent-cards] + ap-core(agent-cards internal-cards) :: +ap-reinstall: reinstall. :: ++ ap-reinstall @@ -1217,40 +1179,42 @@ :: =/ maybe-agent !<(agent vase) ?~ maybe-agent - (ap-lame %new-core-not-agent ~) + (ap-error %new-core-not-agent ~) :: =/ prep =/ =agent u.maybe-agent - =/ running (some ~(handle-stay agent.current-agent ap-construct-bowl)) + =/ running + %- some + ~(handle-extract-state agent.current-agent ap-construct-bowl) =/ installed ap-install(agent.current-agent agent) (installed running) :: =^ maybe-tang ap-core prep ?~ maybe-tang ap-core - (ap-lame %prep-failed u.maybe-tang) - :: +ap-peel: apply %peel. + (ap-error %prep-failed u.maybe-tang) + :: +ap-subscribe-translated: apply %subscribe-translated. :: - ++ ap-peel + ++ ap-subscribe-translated |= [=mark =path] ^+ ap-core :: - =. marks.current-agent (~(put by marks.current-agent) agent-bone mark) - (ap-peer path) - :: +ap-peer: apply %peer. + =. marks.current-agent (~(put by marks.current-agent) agent-duct mark) + (ap-subscribe path) + :: +ap-subscribe: apply %subscribe. :: - ++ ap-peer - ~/ %ap-peer + ++ ap-subscribe + ~/ %ap-subscribe |= pax=path ^+ ap-core :: =/ incoming [attributing.agent-routes pax] =. incoming.subscribers.current-agent - (~(put by incoming.subscribers.current-agent) agent-bone incoming) + (~(put by incoming.subscribers.current-agent) agent-duct incoming) :: =^ maybe-tang ap-core - %+ ap-ingest %reap |. - (handle-peer:ap-agent-core pax) + %+ ap-ingest %subscription-ack |. + (handle-subscribe:ap-agent-core pax) ?^ maybe-tang ap-silent-delete ap-core @@ -1262,46 +1226,46 @@ ^+ ap-core :: =^ maybe-tang ap-core - %+ ap-ingest %coup |. + %+ ap-ingest %poke-ack |. (handle-poke:ap-agent-core cage) ap-core - :: +ap-lame: pour error. + :: +ap-error: pour error. :: - ++ ap-lame + ++ ap-error |= [=term =tang] ^+ ap-core :: =/ form |=(=tank [%rose [~ "! " ~] tank ~]) =^ maybe-tang ap-core %+ ap-ingest ~ |. - (handle-lame:ap-agent-core term (turn tang form)) + (handle-error:ap-agent-core term (turn tang form)) ap-core :: +ap-generic-take: generic take. :: ++ ap-generic-take ~/ %ap-generic-take - |= [=wire =vase] + |= [=wire =sign-arvo] ^+ ap-core :: =^ maybe-tang ap-core %+ ap-ingest ~ |. - (handle-take:ap-agent-core wire vase) + (handle-arvo-response:ap-agent-core wire sign-arvo) ?^ maybe-tang - (ap-lame %take u.maybe-tang) + (ap-error %arvo-response u.maybe-tang) ap-core :: +ap-specific-take: specific take. :: ++ ap-specific-take - |= [=path =internal-gift] + |= [=path =gift:agent] ^+ ap-core :: =^ maybe-tang ap-core %+ ap-ingest ~ |. - (handle-mall:ap-agent-core path internal-gift) - ?: ?=(%diff -.internal-gift) + (handle-agent-response:ap-agent-core path gift) + ?: ?=(%subscription-update -.gift) (ap-update-subscription =(~ maybe-tang) attributing.agent-routes path) ?^ maybe-tang - (ap-lame -.internal-gift u.maybe-tang) + (ap-error -.gift u.maybe-tang) ap-core :: +ap-install: install wrapper. :: @@ -1309,7 +1273,7 @@ |= maybe-vase=(unit vase) ^- [(unit tang) _ap-core] :: - =^ maybe-tang ap-core (ap-prep maybe-vase) + =^ maybe-tang ap-core (ap-upgrade-state maybe-vase) :: =/ new-agent-config =/ =term ?~(maybe-vase %boot %bump) @@ -1324,10 +1288,10 @@ ap-core(agent-config new-agent-config) :: [maybe-tang next] - :: +ap-prep: low-level install. + :: +ap-upgrade-state: low-level install. :: - ++ ap-prep - ~/ %ap-prep + ++ ap-upgrade-state + ~/ %ap-upgrade-state |= maybe-vase=(unit vase) ^- [(unit tang) _ap-core] :: @@ -1335,18 +1299,18 @@ %+ ap-ingest ~ ?~ maybe-vase |. handle-init:ap-agent-core - |. (handle-prep:ap-agent-core u.maybe-vase) + |. (handle-upgrade-state:ap-agent-core u.maybe-vase) [maybe-tang ap-core] :: +ap-silent-delete: silent delete. :: ++ ap-silent-delete ^+ ap-core :: - ?~ (~(get by incoming.subscribers.current-agent) agent-bone) + ?~ (~(get by incoming.subscribers.current-agent) agent-duct) ap-core :: - =/ incoming (~(del by incoming.subscribers.current-agent) agent-bone) - =/ meter (~(del by meter.subscribers.current-agent) agent-bone) + =/ incoming (~(del by incoming.subscribers.current-agent) agent-duct) + =/ meter (~(del by meter.subscribers.current-agent) agent-duct) %_ ap-core incoming.subscribers.current-agent incoming meter.subscribers.current-agent meter @@ -1357,21 +1321,21 @@ ^+ ap-core :: =/ maybe-incoming - (~(get by incoming.subscribers.current-agent) agent-bone) + (~(get by incoming.subscribers.current-agent) agent-duct) ?~ maybe-incoming ap-core :: =/ incoming u.maybe-incoming =. incoming.subscribers.current-agent - (~(del by incoming.subscribers.current-agent) agent-bone) + (~(del by incoming.subscribers.current-agent) agent-duct) =. meter.subscribers.current-agent - (~(del by meter.subscribers.current-agent) agent-bone) + (~(del by meter.subscribers.current-agent) agent-duct) :: =^ maybe-tang ap-core %+ ap-ingest ~ |. - (handle-pull:ap-agent-core q.incoming) + (handle-unsubscribe:ap-agent-core q.incoming) ?^ maybe-tang - (ap-lame %pull u.maybe-tang) + (ap-error %unsubscribe u.maybe-tang) ap-core :: +ap-kill: queue kill. :: @@ -1379,37 +1343,37 @@ ^+ ap-core :: => ap-load-delete - (ap-give %quit ~) + (ap-give %subscription-close ~) :: +ap-ingest: call agent arm :: :: Handle acks here because they need to be emitted before the :: rest of the moves. :: ++ ap-ingest - |= [ack=?(%coup %reap ~) run=_^?(|.(*step:agent))] + |= [ack=?(%poke-ack %subscription-ack ~) run=_^?(|.(*step:agent))] ^- [(unit tang) _ap-core] =/ result (mule run) - =^ new-moves ap-core (ap-handle-result result) + =^ new-cards ap-core (ap-handle-result result) =/ maybe-tang=(unit tang) ?: ?=(%& -.result) ~ `p.result - =/ ack-moves + =/ ack-cards ?- ack ~ ~ - %coup [agent-bone %give %coup maybe-tang]~ - %reap [agent-bone %give %reap maybe-tang]~ + %poke-ack [%give %poke-ack maybe-tang]~ + %subscription-ack [%give %subscription-ack maybe-tang]~ == :: - =. agent-moves - :(weld new-moves ack-moves agent-moves) + =. agent-cards + :(weld new-cards ack-cards agent-cards) [maybe-tang ap-core] :: +ap-handle-result: handle result. :: ++ ap-handle-result ~/ %ap-handle-result |= result=(each step:agent tang) - ^- [(list move:agent) _ap-core] + ^- [(list card:agent) _ap-core] ?: ?=(%| -.result) `ap-core :: @@ -1424,18 +1388,20 @@ :: ++ ap-handle-quits ~/ %ap-handle-quits - |= moves=(list move:agent) + |= moves=(list card:agent) ^- bitt - =/ quits=(list bone) - %+ murn moves - |= =move:agent - ^- (unit bone) - ?. ?=([%give %quit *] move.internal-move) + =/ quits=(list duct) + %- zing + ^- (list (list duct)) + %+ turn moves + |= =card:agent + ^- (list duct) + ?. ?=([%give %subscription-close *] card) ~ - `bone.move + (ap-ducts-from-path path.p.card) :: =/ quit-map=bitt - (malt (turn quits |=(=bone [bone *[ship path]]))) + (malt (turn quits |=(=duct [duct *[ship path]]))) (~(dif by incoming.subscribers.current-agent) quit-map) :: +ap-tang: standard tang. :: @@ -1476,13 +1442,14 @@ :: ?(%deal %deal-mall) =/ =sock p.task - =/ =internal-task q.task + =/ =term q.task + =/ =task:agent r.task ?. =(q.sock our) ?> =(p.sock our) - => (mo-handle-foreign-request:initialised q.sock internal-task) + => (mo-handle-foreign-request:initialised q.sock term task) mo-abet :: - => (mo-handle-local:initialised p.sock internal-task) + => (mo-handle-local:initialised p.sock term task) mo-abet :: %init diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 4e934edfa..efbb39d9c 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -1870,17 +1870,17 @@ $% {$conf p/dock q/dock} :: configure app {$conf-mall p/dock q/dock} :: configure app $>(%init vane-task) :: set owner - {$deal p/sock q/internal-task} :: full transmission - {$deal-mall p/sock q/internal-task} :: full transmission + {$deal p/sock q/term r/task:agent} :: full transmission + {$deal-mall p/sock q/term r/task:agent} :: full transmission $>(%vega vane-task) :: report upgrade $>(%west vane-task) :: network request [%wash ~] :: clear caches $>(%wegh vane-task) :: report memory == :: -- ::able - ++ bitt (map bone (pair ship path)) :: incoming subs + ++ bitt (map duct (pair ship path)) :: incoming subs ++ boat :: outgoing subs - %+ map (pair bone wire) :: + %+ map wire :: (trel bean ship path) :: ++ bowl :: standard app state $: $: our/ship :: host @@ -1890,23 +1890,11 @@ $: wex/boat :: outgoing subs sup/bitt :: incoming subs == :: - $: ost/bone :: opaque cause - act/@ud :: change number + $: act/@ud :: change number eny/@uvJ :: entropy now/@da :: current time byk/beak :: load source == == :: - ++ agent-action :: agent action - $% {$peel p/mark q/path} :: translated peer - {$peer p/path} :: subscribe - {$poke p/cage} :: apply - {$puff p/mark q/noun} :: unchecked poke - {$pull ~} :: unsubscribe - {$punk p/mark q/cage} :: translated poke - {$pump ~} :: pump yes+no - {$peer-not p/tang} :: poison pill peer - == :: - ++ internal-task task:agent :: internal task ++ dude term :: server identity ++ gill (pair ship term) :: general contact ++ scar :: opaque duct @@ -1916,7 +1904,6 @@ == :: ++ suss (trel dude @tas @da) :: config report ++ well (pair desk term) :: - :: :: +agent: app core :: ++ agent @@ -1924,8 +1911,8 @@ |% +$ step (quip card form) +$ card (wind note gift) - +$ note - $% [%arvo note-arvo] + +$ note + $% [%arvo =note-arvo] [%agent =ship name=term =task] == +$ task @@ -1939,8 +1926,8 @@ == +$ gift $% [%poke-ack p=(unit tang)] - [%subscription-update p=cage] - [%subscription-closed ~] + [%subscription-update path=(unit path) =cage] + [%subscription-close path=(unit path)] [%subscription-ack p=(unit tang)] [%http-response =http-event:http] == @@ -1948,42 +1935,42 @@ $_ ^| |_ bowl ++ handle-init - *(quip move _^|(..handle-init)) + *(quip card _^|(..handle-init)) :: ++ handle-extract-state *vase :: ++ handle-upgrade-state |~ old-state=vase - *(quip move _^|(..handle-init)) + *(quip card _^|(..handle-init)) :: ++ handle-poke |~ in-poke-data=cage - *(quip move _^|(..handle-init)) + *(quip card _^|(..handle-init)) :: ++ handle-subscribe |~ path - *(quip move _^|(..handle-init)) + *(quip card _^|(..handle-init)) :: ++ handle-unsubscribe |~ path - *(quip move _^|(..handle-init)) + *(quip card _^|(..handle-init)) :: ++ handle-peek |~ path *(unit (unit cage)) :: ++ handle-agent-response - |~ [wire internal-gift] - *(quip move _^|(..handle-init)) + |~ [wire gift] + *(quip card _^|(..handle-init)) :: ++ handle-arvo-response |~ [wire =sign-arvo] - *(quip move _^|(..handle-init)) + *(quip card _^|(..handle-init)) :: ++ handle-error |~ [term tang] - *(quip move _^|(..handle-init)) + *(quip card _^|(..handle-init)) -- -- -- ::mall @@ -2442,6 +2429,116 @@ {$ix p/@da q/@ud r/@if} :: IPv4 provisional == :: -- ::xmas +++ gift-arvo :: out result <-$ + $~ [%init ~zod] + $% gift:able:ames + gift:able:behn + gift:able:clay + gift:able:dill + gift:able:eyre + gift:able:ford + gift:able:gall + gift:able:mall + gift:able:iris + gift:able:jael + == +++ task-arvo :: in request ->$ + $% task:able:ames + task:able:clay + task:able:behn + task:able:dill + task:able:iris + task:able:ford + task:able:gall + task:able:eyre + task:able:jael + == +++ note-arvo :: out request $-> + $~ [%a %wake ~] + $% {$a task:able:ames} + {$b task:able:behn} + {$c task:able:clay} + {$d task:able:dill} + [%e task:able:eyre] + {$f task:able:ford} + {$g task:able:gall} + {$m task:able:mall} + [%i task:able:iris] + {$j task:able:jael} + {@tas $meta vase} + == +++ sign-arvo :: in result $<- + $% {$a gift:able:ames} + $: $b + $% gift:able:behn + [%writ riot:clay] + $>(%mere gift:able:clay) + == + == + {$c gift:able:clay} + {$d gift:able:dill} + {$f gift:able:ford} + [%e gift:able:eyre] + {$g gift:able:gall} + {$m gift:able:mall} + [%i gift:able:iris] + {$j gift:able:jael} + == +:: ++$ unix-task :: input from unix + $~ [%wake ~] + $% :: %ames: new process + :: + $>(%barn task:able:ames) + :: %dill: keyboard input + :: + $>(%belt task:able:dill) + :: %dill: configure terminal (resized) + :: + $>(%blew task:able:dill) + :: %clay: new process + :: + $>(%boat task:able:clay) + :: %behn/%eyre/%iris: new process + :: + $>(%born vane-task) + :: %eyre: cancel request + :: + [%cancel-request ~] + :: any vane: error report + :: + $>(%crud vane-task) + :: %dill: reset terminal configuration + :: + $>(%hail task:able:dill) + :: %ames: hear packet + :: + $>(%hear task:able:ames) + :: %dill: hangup + :: + $>(%hook task:able:dill) + :: %clay: external edit + :: + $>(%into task:able:clay) + :: %eyre: learn ports of live http servers + :: + $>(%live task:able:eyre) + :: %iris: hear (partial) http response + :: + $>(%receive task:able:iris) + :: %eyre: starts handling an inbound http request + :: + $>(%request task:able:eyre) + :: %eyre: starts handling an backdoor http request + :: + $>(%request-local task:able:eyre) + :: %behn: wakeup + :: + $>(%wake task:able:behn) + :: %ames: send message + :: + $>(%want task:able:ames) + == -- :: :: :: :: :::: :: :: (2) engines @@ -7540,115 +7637,6 @@ -- :: ++ zuse %309 :: hoon+zuse kelvin -++ gift-arvo :: out result <-$ - $~ [%init ~zod] - $% gift:able:ames - gift:able:behn - gift:able:clay - gift:able:dill - gift:able:eyre - gift:able:ford - gift:able:gall - gift:able:iris - gift:able:jael - == -++ task-arvo :: in request ->$ - $% task:able:ames - task:able:clay - task:able:behn - task:able:dill - task:able:iris - task:able:ford - task:able:gall - task:able:eyre - task:able:jael - == -++ note-arvo :: out request $-> - $~ [%a %wake ~] - $% {$a task:able:ames} - {$b task:able:behn} - {$c task:able:clay} - {$d task:able:dill} - [%e task:able:eyre] - {$f task:able:ford} - {$g task:able:gall} - {$m task:able:mall} - [%i task:able:iris] - {$j task:able:jael} - {@tas $meta vase} - == -++ sign-arvo :: in result $<- - $% {$a gift:able:ames} - $: $b - $% gift:able:behn - [%writ riot:clay] - $>(%mere gift:able:clay) - == - == - {$c gift:able:clay} - {$d gift:able:dill} - {$f gift:able:ford} - [%e gift:able:eyre] - {$g gift:able:gall} - {$m gift:able:mall} - [%i gift:able:iris] - {$j gift:able:jael} - == -:: -+$ unix-task :: input from unix - $~ [%wake ~] - $% :: %ames: new process - :: - $>(%barn task:able:ames) - :: %dill: keyboard input - :: - $>(%belt task:able:dill) - :: %dill: configure terminal (resized) - :: - $>(%blew task:able:dill) - :: %clay: new process - :: - $>(%boat task:able:clay) - :: %behn/%eyre/%iris: new process - :: - $>(%born vane-task) - :: %eyre: cancel request - :: - [%cancel-request ~] - :: any vane: error report - :: - $>(%crud vane-task) - :: %dill: reset terminal configuration - :: - $>(%hail task:able:dill) - :: %ames: hear packet - :: - $>(%hear task:able:ames) - :: %dill: hangup - :: - $>(%hook task:able:dill) - :: %clay: external edit - :: - $>(%into task:able:clay) - :: %eyre: learn ports of live http servers - :: - $>(%live task:able:eyre) - :: %iris: hear (partial) http response - :: - $>(%receive task:able:iris) - :: %eyre: starts handling an inbound http request - :: - $>(%request task:able:eyre) - :: %eyre: starts handling an backdoor http request - :: - $>(%request-local task:able:eyre) - :: %behn: wakeup - :: - $>(%wake task:able:behn) - :: %ames: send message - :: - $>(%want task:able:ames) - == :: :: :::: ++azimuth :: (2az) azimuth :: :::: From 839a822f71b53211d294fe021ddab5116a339352 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 12 Sep 2019 12:57:37 -0700 Subject: [PATCH 140/451] mall: convert hood/dojo to refactored form --- bin/solid.pill | 4 +- pkg/arvo/age/dojo.hoon | 123 +++++++++++------------------- pkg/arvo/age/hood.hoon | 33 ++++---- pkg/arvo/app/aqua.hoon | 1 + pkg/arvo/lib/hood/drum-mall.hoon | 17 ++--- pkg/arvo/lib/hood/helm-mall.hoon | 14 ++-- pkg/arvo/lib/hood/kiln-mall.hoon | 24 +++--- pkg/arvo/lib/hood/write-mall.hoon | 2 +- pkg/arvo/sys/vane/ames.hoon | 10 +-- pkg/arvo/sys/vane/dill.hoon | 16 ++-- pkg/arvo/sys/vane/jael.hoon | 35 ++++----- pkg/arvo/sys/vane/mall.hoon | 6 +- pkg/arvo/sys/zuse.hoon | 5 +- 13 files changed, 124 insertions(+), 166 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index d8c3a69e8..cfaa83ca8 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7b8a1701002c00861ac55afcf4596f43d6daac82c0d5dca5e25274720a2cdd10 -size 17162691 +oid sha256:09d619d75bf296a740e90b7d54a766526f93ba0acc114216b064d4115b3f5d1b +size 15445021 diff --git a/pkg/arvo/age/dojo.hoon b/pkg/arvo/age/dojo.hoon index fbc40ab09..e49318350 100644 --- a/pkg/arvo/age/dojo.hoon +++ b/pkg/arvo/age/dojo.hoon @@ -93,35 +93,6 @@ == :: ++ bead {p/(set beam) q/cage} :: computed result ++ goal {p/ship q/term} :: flat application - ++ clap :: action, user - $% {$peer p/path} :: subscribe - {$poke p/(cask)} :: apply - {$pull ~} :: unsubscribe - == :: - ++ club :: action, system - $% {$peer p/path} :: subscribe - {$poke p/cage} :: apply - {$pull ~} :: unsubscribe - == :: - ++ sign :: - $% :: %made: build result; response to %build +task - :: - $: %made - :: date: formal date of the build - :: - date=@da - :: result: result of the build; either complete build, or error - :: - $= result - $% :: %complete: contains the result of the completed build - :: - [%complete build-result=build-result:ford] - :: %incomplete: couldn't finish build; contains error message - :: - [%incomplete =tang] - == == - {$unto p/internal-gift:gall} - == -- => |% @@ -324,7 +295,7 @@ =* state - => |% ++ he :: per session - |_ {hid/bowl:mall moz/(list move:agent:mall) session} + |_ {hid/bowl:mall ost=bone moz/(list card:agent:mall) session} :: ++ he-beam ^- beam @@ -348,21 +319,21 @@ :: pin all builds to :now.hid so they don't get cached forever :: %- he-card(poy `+>+<(pux `way)) - [%pass way %meta %f !>([%build live=%.n schematic])] + [%pass way %arvo %f %build live=%.n schematic] :: ++ dy-request |= [way=wire =request:http] ^+ +>+> ?> ?=(~ pux) %- he-card(poy `+>+<(pux `way)) - [%pass way %meta %l !>([%request request *outbound-config:iris])] + [%pass way %arvo %i %request request *outbound-config:iris] :: ++ dy-stop :: stop work ^+ +> =. poy ~ ?~ pux +> %. [%txt "! cancel {}"] - he-diff:(he-card [%pass u.pux %meta %f !>([%kill ~])]) + he-diff:(he-card [%pass u.pux %arvo %f %kill ~]) :: ++ dy-slam :: call by ford |= {way/wire gat/vase sam/vase} @@ -559,7 +530,7 @@ %- he-card(poy ~) :* %pass /poke - %send + %agent p.p.p.mad q.p.p.mad %poke @@ -568,8 +539,8 @@ :: $file %- he-card(poy ~) - :* %pass /file %meta %c !> - [%info (foal:space:userlib (en-beam:format p.p.mad) cay)] + :* %pass /file %arvo %c + %info (foal:space:userlib (en-beam:format p.p.mad) cay) == :: $flat @@ -836,21 +807,21 @@ == :: ++ he-abet :: resolve - [(flop moz) %_(state hoc (~(put by hoc) ost.hid +<+>))] + [(flop moz) %_(state hoc (~(put by hoc) ost +<+>+))] :: ++ he-abut :: discard => he-stop - [(flop moz) %_(state hoc (~(del by hoc) ost.hid))] + [(flop moz) %_(state hoc (~(del by hoc) ost))] :: ++ he-card :: emit gift |= =card:agent:mall ^+ +> - %_(+> moz [[ost.hid card] moz]) + %_(+> moz [card moz]) :: ++ he-diff :: emit update |= fec/sole-effect ^+ +> - (he-card %give %diff %sole-effect !>(fec)) + (he-card %give %subscription-update `/sole %sole-effect !>(fec)) :: ++ he-stop :: abort work ^+ . @@ -928,9 +899,9 @@ == == :: ++ he-unto :: result from behn - |= {way/wire cit/internal-gift:gall} + |= {way/wire cit/gift:agent:mall} ^+ +> - ?. ?=($coup -.cit) + ?. ?=($poke-ack -.cit) ~& [%strange-unto cit] +> ?~ p.cit @@ -1115,12 +1086,16 @@ he-pine :: XX give mean to original keystroke -- -- +=/ ost=bone 0 ^- agent:mall |_ hid=bowl:mall ++ handle-init `..handle-init :: -++ handle-prep +++ handle-extract-state + !>(state) +:: +++ handle-upgrade-state |= =old-state=vase =/ old-state !<(house old-state-vase) ?~ old-state @@ -1131,11 +1106,11 @@ :: ++ handle-poke |= [=mark =vase] - ^- (quip move:agent:mall _..handle-init) - =/ a-session=session (~(got by hoc) ost.hid) - =/ he-full ~(. he hid ~ a-session) + ^- (quip card:agent:mall _..handle-init) + =/ a-session=session (~(got by hoc) ost) + =/ he-full ~(. he hid ost ~ a-session) =^ moves state - ^- (quip move:agent:mall house) + ^- (quip card:agent:mall house) ?+ mark ~|([%dojo-poke-bad-mark mark] !!) %sole-action he-abet:(he-type:he-full (need !<(sole-action vase))) %lens-command he-abet:(he-lens:he-full (need !<(command:lens vase))) @@ -1156,61 +1131,55 @@ :: [moves ..handle-init] :: -++ handle-peer +++ handle-subscribe |= =path - ^- (quip move:agent:mall _..handle-init) - ~? !=(our.hid src.hid) [%dojo-peer-stranger ost.hid src.hid] + ^- (quip card:agent:mall _..handle-init) + ~? !=(our.hid src.hid) [%dojo-peer-stranger src.hid] ?> (team:title our.hid src.hid) =^ moves-1 state - ?. (~(has by hoc) ost.hid) [~ state] - ~& [%dojo-peer-replaced ost.hid] - ~(he-abut he hid ~ (~(got by hoc) ost.hid)) + ?. (~(has by hoc) ost) [~ state] + ~& [%dojo-peer-replaced ost] + ~(he-abut he hid ost ~ (~(got by hoc) ost)) =^ moves-2 state =/ =session %*(. *session -.dir [our.hid %home ud+0]) ?> ?=([%sole *] path) - he-abet:(~(he-peer he hid moves-1 session) t.path) + he-abet:(~(he-peer he hid ost moves-1 session) t.path) [moves-2 ..handle-init] :: -++ handle-pull +++ handle-unsubscribe |= path =^ moves state - ~(he-abut he hid ~ (~(got by hoc) ost.hid)) - =. hoc (~(del by hoc) ost.hid) + ~(he-abut he hid ost ~ (~(got by hoc) ost)) + =. hoc (~(del by hoc) ost) [moves ..handle-init] :: ++ handle-peek |= path *(unit (unit cage)) :: -++ handle-mall - |= [=wire =internal-gift:mall] - =/ =session (~(got by hoc) ost.hid) +++ handle-agent-response + |= [=wire =gift:agent:mall] + =/ =session (~(got by hoc) ost) =^ moves state - he-abet:(~(he-unto he hid ~ session) wire internal-gift) + he-abet:(~(he-unto he hid ost ~ session) wire gift) [moves ..handle-init] :: -++ handle-take - |= [=wire =vase] - =/ =session (~(got by hoc) ost.hid) - =/ he-full ~(. he hid ~ session) +++ handle-arvo-response + |= [=wire =sign-arvo] + =/ =session (~(got by hoc) ost) + =/ he-full ~(. he hid ost ~ session) =^ moves state =< he-abet - ?+ -.q.vase ~|([%dojo-bad-take -.q.vase] !!) - %made - (he-made:he-full wire +:(need !<([%made @da made-result:ford] vase))) - :: - %http-response - (he-http-response:he-full wire +:(need !<([%made client-response:iris] vase))) + ?+ +<.sign-arvo ~|([%dojo-bad-take +<.sign-arvo] !!) + %made (he-made:he-full wire +>.sign-arvo) + %http-response (he-http-response:he-full wire +>.sign-arvo) == [moves ..handle-init] :: -++ handle-lame +++ handle-error |= [=term =tang] - =/ =session (~(got by hoc) ost.hid) + =/ =session (~(got by hoc) ost) =^ moves state - he-abet:(~(he-lame he hid ~ session) term tang) + he-abet:(~(he-lame he hid ost ~ session) term tang) [moves ..handle-init] -:: -++ handle-stay - !>(state) -- diff --git a/pkg/arvo/age/hood.hoon b/pkg/arvo/age/hood.hoon index b5d272ded..fd005d220 100644 --- a/pkg/arvo/age/hood.hoon +++ b/pkg/arvo/age/hood.hoon @@ -22,13 +22,9 @@ => |% +$ part [%module %0 pith] +$ pith ~ - :: - +$ move [bone card] - +$ card $% [%fake ~] - == -- - |= [bowl:gall own=part] - |_ moz=(list move) + |= [bowl:mall own=part] + |_ moz=(list card:agent:mall) ++ abet [(flop moz) own] -- -- @@ -119,6 +115,7 @@ |* handle/_finish |= a=_+<.handle =. +>.handle (start hid (able identity)) + ^- (quip card:agent:mall _lac) (ably (handle a)) :: per-module interface wrappers ++ from-drum (from-module %drum [..$ _se-abet]:(hood-drum-mall)) @@ -250,7 +247,7 @@ %write-wipe %- (wrap poke-wipe):from-write:h (need !<(path vase)) == - [cards ..handle-init] + [`(list card:agent:mall)`cards `agent:mall`..handle-init] :: ++ handle-subscribe |= =path @@ -270,33 +267,33 @@ *(unit (unit cage)) :: ++ handle-agent-response - |= [=wire =internal-gift:mall] + |= [=wire =gift:agent:mall] =/ h (help hid) =^ cards lac ?+ wire ~|([%hood-bad-wire wire] !!) [%helm %hi *] %+ (wrap coup-hi):from-helm:h t.t.wire - ?>(?=(%poke-ack -.internal-gift) p.internal-gift) + ?>(?=(%poke-ack -.gift) p.gift) [%kiln %fancy *] %+ (wrap take-coup-fancy):from-kiln:h t.t.wire - ?>(?=(%poke-ack -.internal-gift) p.internal-gift) + ?>(?=(%poke-ack -.gift) p.gift) [%kiln %reload *] %+ (wrap take-coup-reload):from-kiln:h t.t.wire - ?>(?=(%poke-ack -.internal-gift) p.internal-gift) + ?>(?=(%poke-ack -.gift) p.gift) [%kiln %spam *] %+ (wrap take-coup-spam):from-kiln:h t.t.wire - ?>(?=(%poke-ack -.internal-gift) p.internal-gift) + ?>(?=(%poke-ack -.gift) p.gift) [%drum %phat *] - ?- -.internal-gift + ?- -.gift %http-response !! - %poke-ack ((wrap take-coup-phat):from-drum:h t.t.wire p.internal-gift) - %subscription-ack ((wrap reap-phat):from-drum:h t.t.wire p.internal-gift) + %poke-ack ((wrap take-coup-phat):from-drum:h t.t.wire p.gift) + %subscription-ack ((wrap reap-phat):from-drum:h t.t.wire p.gift) %subscription-close ((wrap quit-phat):from-drum:h t.t.wire) %subscription-update %+ (wrap diff-sole-effect-phat):from-drum:h t.t.wire - ?> ?=(%sole-effect p.p.internal-gift) - (need !<(sole-effect q.p.internal-gift)) + ?> ?=(%sole-effect p.cage.gift) + (need !<(sole-effect q.cage.gift)) == == [cards ..handle-init] :: -++ handle-system-response +++ handle-arvo-response |= [=wire =sign-arvo] =/ h (help hid) =^ cards lac diff --git a/pkg/arvo/app/aqua.hoon b/pkg/arvo/app/aqua.hoon index fadd874b9..fab6634e5 100644 --- a/pkg/arvo/app/aqua.hoon +++ b/pkg/arvo/app/aqua.hoon @@ -367,6 +367,7 @@ %f %ford %g %gall %j %jael + %m %mall == =/ pax /(scot %p our.hid)/home/(scot %da now.hid)/sys/vane/[vane] diff --git a/pkg/arvo/lib/hood/drum-mall.hoon b/pkg/arvo/lib/hood/drum-mall.hoon index 3815374a0..14df15430 100644 --- a/pkg/arvo/lib/hood/drum-mall.hoon +++ b/pkg/arvo/lib/hood/drum-mall.hoon @@ -139,7 +139,7 @@ :: :::: :: -|= {hid/bowl:gall part} :: main drum work +|= {hid/bowl:mall part} :: main drum work =/ ost 0 =+ (~(gut by bin) ost *source) =* dev - @@ -177,7 +177,7 @@ :: ++ poke-set-boot-apps :: |= lit/? - ^- (quip move:agent:mall part) + ^- (quip card:agent:mall part) :: We do not run se-abet:se-view here because that starts the apps, :: and some apps are not ready to start (eg Talk crashes because the :: terminal has width 0). It appears the first message to drum must @@ -266,19 +266,14 @@ ++ se-abet :: resolve ^- (quip card:agent:mall part) =* pith +<+.$ - ?. se-ably - =. . se-adit - [(flop moz) pith] =. . se-subze:se-adze:se-adit :_ pith(bin (~(put by bin) ost dev)) %- flop ^- (list card:agent:mall) ?~ biz moz :_ moz - =/ =blit:dill ?~(t.biz i.biz [%mor (flop biz)]) - [%give %subscription-update `/drum %dill-blit !>(blit)] -:: -++ se-ably (~(has by sup.hid) ost) :: caused by console + =/ =dill-blit:dill ?~(t.biz i.biz [%mor (flop biz)]) + [%give %subscription-update `/drum %dill-blit !>(dill-blit)] :: ++ se-adit :: update servers ^+ . @@ -400,7 +395,6 @@ ++ se-dump :: print tanks |= tac/(list tank) ^+ +> - ?. se-ably (se-hall tac) =/ wol/wall (zing (turn (flop tac) |=(a/tank (~(win re a) [0 edg])))) |- ^+ +>.^$ @@ -436,7 +430,7 @@ :: ++ se-blit-sys :: output to system |= bil/dill-blit:dill ^+ +> - (se-emit %give %subscription-update %dill-blit `/drum !>(bil)) + (se-emit %give %subscription-update `/drum %dill-blit !>(bil)) :: ++ se-show :: show buffer, raw |= lin/(pair @ud stub) @@ -491,7 +485,6 @@ ?. ((sane %t) (crip txt)) :: XX upstream validation ~& bad-text+<`*`txt> +> - ?. se-ably (se-hall [%leaf txt]~) (se-blit %out (tuba txt)) :: ++ se-poke :: send a poke diff --git a/pkg/arvo/lib/hood/helm-mall.hoon b/pkg/arvo/lib/hood/helm-mall.hoon index 508a9747c..f85cc6ea6 100644 --- a/pkg/arvo/lib/hood/helm-mall.hoon +++ b/pkg/arvo/lib/hood/helm-mall.hoon @@ -33,13 +33,13 @@ :: :: :: :::: :: :: :: :: :: -|: $:{bowl:gall part} :: main helm work +|: $:{bowl:mall part} :: main helm work =/ ost 0 -=+ sez=(~(gut by hoc) $:session) +=+ sez=(~(gut by hoc) ost $:session) =| moz=(list card:agent:mall) |% ++ abet - [(flop moz) %_(+<+.$ hoc (~(put by hoc) sez))] + [(flop moz) %_(+<+.$ hoc (~(put by hoc) ost sez))] :: ++ emit |= card:agent:mall @@ -50,7 +50,7 @@ (emit %pass /di %arvo %d %flog flog) :: ++ emil :: return cards - |= (list (wind internal-note:mall internal-gift:mall)) + |= (list card:agent:mall) ^+ +> ?~(+< +> $(+< t.+<, +> (emit i.+<))) :: @@ -78,7 +78,7 @@ :: ++ poke-nuke :: initialize |= him/ship =< abet - (emit %pass /helm %arvo %j %nuke him) + (emit %pass /helm %arvo %a %nuke him) :: ++ poke-mass |= ~ =< abet @@ -174,7 +174,7 @@ |= hood-reset =< abet %- emil %- flop - ^- (list (wind internal-note:mall internal-gift:mall)) + ^- (list card:agent:mall) =/ top=path /(scot %p our)/home/(scot %da now)/sys =/ hun .^(@ %cx (welp top /hoon/hoon)) =/ arv .^(@ %cx (welp top /arvo/hoon)) @@ -197,7 +197,7 @@ :: ++ take |= [=wire =sign-arvo] - ?+ wire ~|([%helm-bad-take-wire wire] !!) + ?+ wire ~|([%helm-bad-take-wire wire +<.sign-arvo] !!) [%automass *] %+ take-wake-automass t.wire ?>(?=(%wake +<.sign-arvo) +>.sign-arvo) [%serv *] %+ take-bound t.wire diff --git a/pkg/arvo/lib/hood/kiln-mall.hoon b/pkg/arvo/lib/hood/kiln-mall.hoon index 96440d759..93716d929 100644 --- a/pkg/arvo/lib/hood/kiln-mall.hoon +++ b/pkg/arvo/lib/hood/kiln-mall.hoon @@ -58,7 +58,7 @@ :: :: :: :::: :: :: :: :: :: -|= {bowl:gall part} :: main kiln work +|= {bowl:mall part} :: main kiln work ?> =(src our) |_ moz/(list card:agent:mall) ++ abet :: resolve @@ -69,7 +69,7 @@ %_(+> moz [+< moz]) :: ++ emil :: return cards - |= (list (wind internal-note:mall internal-gift:mall)) + |= (list card:agent:mall) ^+ +> ?~(+< +> $(+< t.+<, +> (emit i.+<))) :: @@ -186,7 +186,7 @@ ++ autoload |% ++ emit - |= a/(wind internal-note:mall internal-gift:mall) + |= a/card:agent:mall +>(..autoload (^emit a)) :: ++ tracked-vanes @@ -263,17 +263,17 @@ :: +poke-overload: wipes ford cache at {start}, and then every {recur}. |= [recur=@dr start=@da] ?> (gte start now) - abet:(emit %pass /kiln/overload/(scot %dr recur) %arvo %c [%wait start]) + abet:(emit %pass /kiln/overload/(scot %dr recur) %arvo %b [%wait start]) :: ++ poke-wipe-ford - |=(percent=@ud abet:(emit %pass /kiln %arvo %c [%wipe percent])) + |=(percent=@ud abet:(emit %pass /kiln %arvo %f [%wipe percent])) :: ++ poke-keep-ford |= [compiler-cache-size=@ud build-cache-size=@ud] =< abet - (emit %pass /kiln %arvo %c [%keep compiler-cache-size build-cache-size]) + (emit %pass /kiln %arvo %f [%keep compiler-cache-size build-cache-size]) :: -++ poke-wash-gall |=(* abet:(emit %pass /kiln %arvo %c [%wash ~])) +++ poke-wash-gall |=(* abet:(emit %pass /kiln %arvo %m [%wash ~])) :: ++ mack |= {way/wire saw/(unit tang)} @@ -296,7 +296,7 @@ [%autocommit *] %+ take-wake-autocommit t.wire ?>(?=(%wake +<.sign-arvo) +>.sign-arvo) * - ?+ +<.sign-arvo ~|([%kiln-bad-take-card -.q.vase] !!) + ?+ +<.sign-arvo ~|([%kiln-bad-take-card +<.sign-arvo] !!) %mack %+ mack wire ?>(?=(%mack +<.sign-arvo) +>.sign-arvo) %made %+ take-made wire @@ -407,7 +407,7 @@ =+ (~(gut by syn) [syd her sud] let=*@ud) |% ++ abet - ..auto(syn (~(put by syn) [syd her sud] let ust)) + ..auto(syn (~(put by syn) [syd her sud] let)) :: ++ blab |= new/(list card:agent:mall) @@ -415,14 +415,14 @@ +>.$(moz (welp new moz)) :: ++ warp - |= [=bone =wire =ship =riff] - (blab [bone %pass wire %arvo %c [%warp ship riff]] ~) + |= [=wire =ship =riff] + (blab [%pass wire %arvo %c [%warp ship riff]] ~) :: ++ spam |*(* %_(+> ..auto (^spam +<))) ++ stop => (spam (render "ended autosync" sud her syd) ~) =/ =wire /kiln/sync/[syd]/(scot %p her)/[sud] - (warp ust wire her sud ~) + (warp wire her sud ~) :: XX duplicate of start-sync? see |track :: ++ start-track diff --git a/pkg/arvo/lib/hood/write-mall.hoon b/pkg/arvo/lib/hood/write-mall.hoon index 5a4e82bb4..c61337a93 100644 --- a/pkg/arvo/lib/hood/write-mall.hoon +++ b/pkg/arvo/lib/hood/write-mall.hoon @@ -19,7 +19,7 @@ :: :::: :: -|= {bowl:gall part} +|= {bowl:mall part} =* par +<+ |_ moz/(list card:agent:mall) ++ abet [(flop moz) `part`par] diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index c382fb051..293949a86 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -43,10 +43,10 @@ == :: gift:able:jael :: == :: - $: %g :: from %gall + $: %m :: from %gall $% [%mean p=ares] :: XX obsolete [%nice ~] :: XX obsolete - $>(%unto gift:able:gall) :: application ack + $>(%unto gift:able:mall) :: application ack == == :: $: @tas :: from any $% $>(%crud vane-task) :: XX strange @@ -1369,7 +1369,7 @@ %milk :: ~& [%milk p.bon q.bon] ?> ?=([@ @ *] q.q.bon) - ?> ?=(?(%a %c %e %g %j) i.q.q.bon) + ?> ?=(?(%a %c %e %m %j) i.q.q.bon) =/ =wire [(scot %p our) (scot %p p.bon) q.q.bon] :_ fox [hen %pass wire i.q.q.bon %west p.bon t.q.q.bon r.bon]~ :: @@ -1436,8 +1436,8 @@ ?- +<.sih %crud [[[hen [%slip %d %flog +.sih]] ~] +>] :: - %mack ?~ +>.sih $(sih [%g %nice ~]) :: XX using old code - $(sih [%g %mean `[%mack +>+.sih]]) + %mack ?~ +>.sih $(sih [%m %nice ~]) :: XX using old code + $(sih [%m %mean `[%mack +>+.sih]]) :: %public-keys ?. ?=([%pubs @ ~] tea) diff --git a/pkg/arvo/sys/vane/dill.hoon b/pkg/arvo/sys/vane/dill.hoon index 772804eb8..50dcdda20 100644 --- a/pkg/arvo/sys/vane/dill.hoon +++ b/pkg/arvo/sys/vane/dill.hoon @@ -357,7 +357,7 @@ ++ peer %_ . moz - :_(moz [hen %pass ~ %m %deal [our our] ram %peer /drum]) + :_(moz [hen %pass ~ %m %deal [our our] ram %subscribe /drum]) == :: ++ show :: permit reads on desk @@ -422,13 +422,13 @@ {$m $unto *} :: ~& [%take-gall-unto +>.sih] ?- -.+>.sih - $coup ?~(p.p.+>.sih +>.$ (crud %coup u.p.p.+>.sih)) - $quit peer - $reap ?~ p.p.+>.sih - +>.$ - (dump:(crud %reap u.p.p.+>.sih) %logo ~) - $diff pump:(from ;;(dill-blit q:`vase`+>+>.sih)) - $http-response !! + $poke-ack ?~(p.p.+>.sih +>.$ (crud %coup u.p.p.+>.sih)) + $subscription-close peer + $subscription-ack ?~ p.p.+>.sih + +>.$ + (dump:(crud %reap u.p.p.+>.sih) %logo ~) + $subscription-update pump:(from ;;(dill-blit q:`vase`+>+>+.sih)) + $http-response !! == :: {$c $note *} diff --git a/pkg/arvo/sys/vane/jael.hoon b/pkg/arvo/sys/vane/jael.hoon index ce14c5a17..eef76e3ce 100644 --- a/pkg/arvo/sys/vane/jael.hoon +++ b/pkg/arvo/sys/vane/jael.hoon @@ -75,8 +75,8 @@ $% $: %a :: to %ames $>(%want task:able:ames) :: send message == :: - $: %g :: to self - $>(%deal task:able:gall) :: set ethereum source + $: %m :: to self + $>(%deal task:able:mall) :: set ethereum source == :: $: %j :: to self $>(%listen task) :: set ethereum source @@ -90,11 +90,11 @@ +$ sign :: in result $<- $~ [%a %woot *ship ~] :: $% [%a $>(%woot gift:able:ames)] :: message result - $: %g :: + $: %m :: $> $? %onto :: %unto :: == :: - gift:able:gall :: + gift:able:mall :: == == :: -- :: @@ -186,7 +186,7 @@ :* hen %pass /[app]/poke - %g + %m %deal [our our] app @@ -318,7 +318,7 @@ %+ weld moz :: order is crucial! :: - :: %dill must init after %gall + :: %dill must init after %mall :: the %give init (for unix) must be after %dill init :: %jael init must be deferred (makes http requests) :: @@ -522,30 +522,31 @@ ::TODO fail:et +>.$ :: - [%g %onto *] + [%m %onto *] ~& [%jael-onto tea hin] +>.$ :: - [%g %unto *] + [%m %unto *] ?- +>-.hin - $quit ~|([%jael-unexpected-quit tea hin] !!) - $http-response ~|([%jael-unexpected-http-response tea hin] !!) - $coup + $subscription-close ~|([%jael-unexpected-quit tea hin] !!) + $http-response ~|([%jael-unexpected-http-response tea hin] !!) + $poke-ack ?~ p.p.+>.hin +>.$ %- (slog leaf+"jael-bad-coup" u.p.p.+>.hin) +>.$ :: - $reap + $subscription-ack ?~ p.p.+>.hin +>.$ %- (slog u.p.p.+>.hin) ~|([%jael-unexpected-reap tea hin] +>.$) :: - $diff + $subscription-update ?> ?=([@ *] tea) =* app i.tea - =/ =peer-sign ;;(peer-sign q.q.p.p.+>.hin) + ~! +>.hin + =/ =peer-sign ;;(peer-sign q.q.cage.p.+>.hin) %. [hen tea app] =< pump %- curd =< abet @@ -562,7 +563,7 @@ :: :: ++wind:of ++ pump |= [hen=duct =wire app=term] - (emit [hen %pass wire %g %deal [our our] app %pump ~]) + (emit [hen %pass wire %m %deal [our our] app %pump ~]) -- :: :: ++su :::: ## relative^heavy :: subjective engine @@ -610,11 +611,11 @@ :* hen %pass [app path] - %g + %m %deal [our our] app - %peer + %subscribe path == :: diff --git a/pkg/arvo/sys/vane/mall.hoon b/pkg/arvo/sys/vane/mall.hoon index d6d3e019a..54d4fff4d 100644 --- a/pkg/arvo/sys/vane/mall.hoon +++ b/pkg/arvo/sys/vane/mall.hoon @@ -356,7 +356,7 @@ /sys/way/[action] :: =/ =note-arvo - =/ =path /g/ge/[term] + =/ =path /m/ge/[term] =/ =noun [bone forward-ames] [%a %want ship path noun] :: @@ -982,7 +982,7 @@ =/ =cage cage.gift %+ turn ducts |= =duct - ~? =(duct system-duct.agents.state) + ~? &(=(duct system-duct.agents.state) !=(agent-name %hood)) [%agent-giving-on-system-duct agent-name -.gift] ^- move =/ =mark @@ -1033,7 +1033,7 @@ %+ murn ~(tap by incoming.subscribers.current-agent) |= [=duct =ship =path] ^- (unit ^duct) - ?: =(target-path path) + ?: =(u.target-path path) `duct ~ :: +ap-apply: apply effect. diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index efbb39d9c..5f1c1a9aa 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -2437,7 +2437,6 @@ gift:able:dill gift:able:eyre gift:able:ford - gift:able:gall gift:able:mall gift:able:iris gift:able:jael @@ -2449,7 +2448,7 @@ task:able:dill task:able:iris task:able:ford - task:able:gall + task:able:mall task:able:eyre task:able:jael == @@ -2461,7 +2460,6 @@ {$d task:able:dill} [%e task:able:eyre] {$f task:able:ford} - {$g task:able:gall} {$m task:able:mall} [%i task:able:iris] {$j task:able:jael} @@ -2479,7 +2477,6 @@ {$d gift:able:dill} {$f gift:able:ford} [%e gift:able:eyre] - {$g gift:able:gall} {$m gift:able:mall} [%i gift:able:iris] {$j gift:able:jael} From d7671efec0131e5b7de61bc5e4512e1ed2e6454f Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Fri, 13 Sep 2019 11:53:54 -0700 Subject: [PATCH 141/451] mall, hood: avoid referencing library internals --- bin/solid.pill | 4 +- pkg/arvo/age/hood.hoon | 158 +++++++----------------------- pkg/arvo/lib/hood/drum-mall.hoon | 27 +++++ pkg/arvo/lib/hood/helm-mall.hoon | 29 ++++++ pkg/arvo/lib/hood/kiln-mall.hoon | 36 +++++++ pkg/arvo/lib/hood/write-mall.hoon | 13 +++ 6 files changed, 144 insertions(+), 123 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index cfaa83ca8..23ed89e62 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:09d619d75bf296a740e90b7d54a766526f93ba0acc114216b064d4115b3f5d1b -size 15445021 +oid sha256:c7b503de1c4f8627920b59131b1aa23d198f68abaf3a64c5c3388ec77c539b69 +size 15516353 diff --git a/pkg/arvo/age/hood.hoon b/pkg/arvo/age/hood.hoon index fd005d220..e27e0f219 100644 --- a/pkg/arvo/age/hood.hoon +++ b/pkg/arvo/age/hood.hoon @@ -22,6 +22,15 @@ => |% +$ part [%module %0 pith] +$ pith ~ + ++ take + |~ [wire sign-arvo] + *(quip card:agent:mall part) + ++ take-agent + |~ [wire gift:agent:mall] + *(quip card:agent:mall part) + ++ poke + |~ [mark vase] + *(quip card:agent:mall part) -- |= [bowl:mall own=part] |_ moz=(list card:agent:mall) @@ -116,7 +125,9 @@ |= a=_+<.handle =. +>.handle (start hid (able identity)) ^- (quip card:agent:mall _lac) - (ably (handle a)) + %- ably + ^- (quip card:agent:mall hood-part) + (handle a) :: per-module interface wrappers ++ from-drum (from-module %drum [..$ _se-abet]:(hood-drum-mall)) ++ from-helm (from-module %helm [..$ _abet]:(hood-helm-mall)) @@ -145,109 +156,29 @@ ^- (quip card:agent:mall agent:mall) =/ h (help hid) =^ cards lac + ?: =(%helm (end 3 4 mark)) + ((wrap poke):from-helm:h mark vase) + ?: =(%drum (end 3 4 mark)) + ((wrap poke):from-drum:h mark vase) + ?: =(%kiln (end 3 4 mark)) + ((wrap poke):from-kiln:h mark vase) + ?: =(%write (end 3 5 mark)) + ((wrap poke):from-write:h mark vase) + :: XX should rename and move to libs + :: ?+ mark ~|([%poke-hood-bad-mark mark] !!) - %hood-load %- poke-hood-load:h - (need !<(hood-part vase)) - %atom %- (wrap poke-atom):from-helm:h - (need !<(@ vase)) - %helm-hi %- (wrap poke-hi):from-helm:h - (need !<(@t vase)) - %helm-mass %- (wrap poke-mass):from-helm:h - (need !<(~ vase)) - %helm-reload %- (wrap poke-reload):from-helm:h - (need !<((list term) vase)) - %helm-reload-desk %- (wrap poke-reload-desk):from-helm:h - (need !<([@t (list term)] vase)) - %helm-reset %- (wrap poke-reset):from-helm:h - (need !<(~ vase)) - %helm-serve %- (wrap poke-serve):from-helm:h - (need !<([=binding:eyre =generator:eyre] vase)) - %helm-send-hi %- (wrap poke-send-hi):from-helm:h - (need !<([ship (unit tape)] vase)) - %helm-verb %- (wrap poke-verb):from-helm:h - (need !<(~ vase)) - %helm-rekey %- (wrap poke-rekey):from-helm:h - (need !<(@t vase)) - %helm-moon %- (wrap poke-moon):from-helm:h - (need !<((unit [ship udiff:point:able:jael]) vase)) - %helm-nuke %- (wrap poke-nuke):from-helm:h - (need !<(ship vase)) - %helm-automass %- (wrap poke-automass):from-helm:h - (need !<(@dr vase)) - %helm-cancel-automass %- (wrap poke-cancel-automass):from-helm:h - (need !<(~ vase)) - %helm-bonk %- (wrap poke-bonk):from-helm:h - (need !<(~ vase)) - %dill-belt %- (wrap poke-dill-belt):from-drum:h - (need !<(dill-belt:dill vase)) - %dill-blit %- (wrap poke-dill-blit):from-drum:h - (need !<(dill-blit:dill vase)) - %drum-put %- (wrap poke-put):from-drum:h - (need !<([path @] vase)) - %drum-link %- (wrap poke-link):from-drum:h - (need !<(gill:gall vase)) - %drum-unlink %- (wrap poke-unlink):from-drum:h - (need !<(gill:gall vase)) - %drum-exit %- (wrap poke-exit):from-drum:h - (need !<(~ vase)) - %drum-start %- (wrap poke-start):from-drum:h - (need !<(well:gall vase)) - %drum-set-boot-apps %- (wrap poke-set-boot-apps):from-drum:h - (need !<(? vase)) - %hood-sync %- (wrap poke-sync):from-kiln:h - (need !<([desk ship desk] vase)) - %kiln-commit %- (wrap poke-commit):from-kiln:h - (need !<([term ?] vase)) - %kiln-info %- (wrap poke-info):from-kiln:h - (need !<([tape (unit toro:clay)] vase)) - %kiln-label %- (wrap poke-label):from-kiln:h - (need !<([desk @tas] vase)) - %kiln-merge %- (wrap poke-merge):from-kiln:h - (need !<([desk ship desk case ?($auto germ:clay)] vase)) - %kiln-cancel %- (wrap poke-cancel):from-kiln:h - (need !<(desk vase)) - %kiln-cancel-autocommit %- (wrap poke-cancel-autocommit):from-kiln:h - (need !<(~ vase)) - %kiln-mount %- (wrap poke-mount):from-kiln:h - (need !<([path term] vase)) - %kiln-rm %- (wrap poke-rm):from-kiln:h - (need !<(path vase)) - %kiln-schedule %- (wrap poke-schedule):from-kiln:h - (need !<([path @da @t] vase)) - %kiln-track %- (wrap poke-track):from-kiln:h - (need !<([desk ship desk] vase)) - %kiln-sync %- (wrap poke-sync):from-kiln:h - (need !<([desk ship desk] vase)) - %kiln-syncs %- (wrap poke-syncs):from-kiln:h - (need !<(~ vase)) - %kiln-start-autoload %- (wrap poke-start-autoload):from-kiln:h - (need !<(~ vase)) - %kiln-wipe-ford %- (wrap poke-wipe-ford):from-kiln:h - (need !<(@ud vase)) - %kiln-keep-ford %- (wrap poke-keep-ford):from-kiln:h - (need !<([@ud @ud] vase)) - %kiln-autoload %- (wrap poke-autoload):from-kiln:h - (need !<((unit ?) vase)) - %kiln-overload %- (wrap poke-overload):from-kiln:h - (need !<([@dr @da] vase)) - %kiln-wash-gall %- (wrap poke-wash-gall):from-kiln:h - (need !<(* vase)) - %kiln-unmount %- (wrap poke-unmount):from-kiln:h - (need !<($@(term [knot path]) vase)) - %kiln-unsync %- (wrap poke-unsync):from-kiln:h - (need !<([desk ship desk] vase)) - %kiln-permission %- (wrap poke-permission):from-kiln:h - (need !<([desk path ?] vase)) - %write-sec-atom %- (wrap poke-sec-atom):from-write:h - (need !<([host:eyre @] vase)) - %write-paste %- (wrap poke-paste):from-write:h - (need !<([?(%hoon %md %txt) @t] vase)) - %write-tree %- (wrap poke-tree):from-write:h - (need !<([path mime] vase)) - %write-wipe %- (wrap poke-wipe):from-write:h - (need !<(path vase)) + %hood-load %- poke-hood-load:h + (need !<(hood-part vase)) + %atom %- (wrap poke-atom):from-helm:h + (need !<(@ vase)) + %dill-belt %- (wrap poke-dill-belt):from-drum:h + (need !<(dill-belt:dill vase)) + %dill-blit %- (wrap poke-dill-blit):from-drum:h + (need !<(dill-blit:dill vase)) + %hood-sync %- (wrap poke-sync):from-kiln:h + (need !<([desk ship desk] vase)) == - [`(list card:agent:mall)`cards `agent:mall`..handle-init] + [cards ..handle-init] :: ++ handle-subscribe |= =path @@ -271,25 +202,10 @@ =/ h (help hid) =^ cards lac ?+ wire ~|([%hood-bad-wire wire] !!) - [%helm %hi *] %+ (wrap coup-hi):from-helm:h t.t.wire - ?>(?=(%poke-ack -.gift) p.gift) - [%kiln %fancy *] %+ (wrap take-coup-fancy):from-kiln:h t.t.wire - ?>(?=(%poke-ack -.gift) p.gift) - [%kiln %reload *] %+ (wrap take-coup-reload):from-kiln:h t.t.wire - ?>(?=(%poke-ack -.gift) p.gift) - [%kiln %spam *] %+ (wrap take-coup-spam):from-kiln:h t.t.wire - ?>(?=(%poke-ack -.gift) p.gift) - [%drum %phat *] - ?- -.gift - %http-response !! - %poke-ack ((wrap take-coup-phat):from-drum:h t.t.wire p.gift) - %subscription-ack ((wrap reap-phat):from-drum:h t.t.wire p.gift) - %subscription-close ((wrap quit-phat):from-drum:h t.t.wire) - %subscription-update - %+ (wrap diff-sole-effect-phat):from-drum:h t.t.wire - ?> ?=(%sole-effect p.cage.gift) - (need !<(sole-effect q.cage.gift)) - == + [%helm *] ((wrap take-agent):from-helm:h wire gift) + [%kiln *] ((wrap take-agent):from-kiln:h wire gift) + [%drum *] ((wrap take-agent):from-drum:h wire gift) + [%write *] ((wrap take-agent):from-write:h wire gift) == [cards ..handle-init] :: diff --git a/pkg/arvo/lib/hood/drum-mall.hoon b/pkg/arvo/lib/hood/drum-mall.hoon index 14df15430..f4858bf8f 100644 --- a/pkg/arvo/lib/hood/drum-mall.hoon +++ b/pkg/arvo/lib/hood/drum-mall.hoon @@ -217,6 +217,17 @@ |= {pax/path txt/@} se-abet:(se-blit-sys [%sav pax txt]) :: :: +++ poke + |= [=mark =vase] + ?+ mark ~|([%poke-drum-bad-mark mark] !!) + %drum-put (poke-put (need !<([path @] vase))) + %drum-link (poke-link (need !<(gill:gall vase))) + %drum-unlink (poke-unlink (need !<(gill:gall vase))) + %drum-exit (poke-exit (need !<(~ vase))) + %drum-start (poke-start (need !<(well:gall vase))) + %drum-set-boot-apps (poke-set-boot-apps (need !<(? vase))) + == +:: ++ reap-phat :: ack connect |= {way/wire saw/(unit tang)} =< se-abet =< se-view @@ -254,6 +265,22 @@ +>.$(fur (~(put by fur) q.wel `[p.wel %da r.p.saw])) == :: +++ take-agent + |= [=wire =gift:agent:mall] + ?+ wire ~|([%drum-bad-take-agent wire -.gift] !!) + [%drum %phat *] + ?- -.gift + %http-response !! + %poke-ack (take-coup-phat t.t.wire p.gift) + %subscription-ack (reap-phat t.t.wire p.gift) + %subscription-close (quit-phat t.t.wire) + %subscription-update + %+ diff-sole-effect-phat t.t.wire + ?> ?=(%sole-effect p.cage.gift) + (need !<(sole-effect q.cage.gift)) + == + == +:: ++ quit-phat :: |= way/wire =< se-abet =< se-view diff --git a/pkg/arvo/lib/hood/helm-mall.hoon b/pkg/arvo/lib/hood/helm-mall.hoon index f85cc6ea6..3f342b7eb 100644 --- a/pkg/arvo/lib/hood/helm-mall.hoon +++ b/pkg/arvo/lib/hood/helm-mall.hoon @@ -191,6 +191,35 @@ |= [=binding:eyre =generator:eyre] =< abet (emit %pass /helm/serv %arvo %e %serve binding generator) :: +++ poke + |= [=mark =vase] + ?+ mark ~|([%poke-helm-bad-mark mark] !!) + %helm-hi (poke-hi (need !<(@t vase))) + %helm-mass (poke-mass (need !<(~ vase))) + %helm-reload (poke-reload (need !<((list term) vase))) + %helm-reload-desk (poke-reload-desk (need !<([@t (list term)] vase))) + %helm-reset (poke-reset (need !<(~ vase))) + %helm-send-hi (poke-send-hi (need !<([ship (unit tape)] vase))) + %helm-verb (poke-verb (need !<(~ vase))) + %helm-rekey (poke-rekey (need !<(@t vase))) + %helm-nuke (poke-nuke (need !<(ship vase))) + %helm-automass (poke-automass (need !<(@dr vase))) + %helm-bonk (poke-bonk (need !<(~ vase))) + %helm-cancel-automass + (poke-cancel-automass (need !<(~ vase))) + %helm-moon + (poke-moon (need !<((unit [ship udiff:point:able:jael]) vase))) + %helm-serve + (poke-serve (need !<([=binding:eyre =generator:eyre] vase))) + == +:: +++ take-agent + |= [=wire =gift:agent:mall] + ?+ wire ~|([%helm-bad-take-agent wire -.gift] !!) + [%helm %hi *] ?> ?=(%poke-ack -.gift) + (coup-hi t.t.wire p.gift) + == +:: ++ take-bound |= [wir=wire success=? binding=binding:eyre] =< abet (flog %text "bound: {}") diff --git a/pkg/arvo/lib/hood/kiln-mall.hoon b/pkg/arvo/lib/hood/kiln-mall.hoon index 93716d929..99208ab7c 100644 --- a/pkg/arvo/lib/hood/kiln-mall.hoon +++ b/pkg/arvo/lib/hood/kiln-mall.hoon @@ -182,6 +182,31 @@ :: ++ poke-autoload |=(lod/(unit ?) abet:(poke:autoload lod)) ++ poke-start-autoload |=(~ abet:start:autoload) +++ poke + |= [=mark =vase] + ?+ mark ~|([%poke-kiln-bad-mark mark] !!) + %kiln-commit (poke-commit (need !<([term ?] vase))) + %kiln-info (poke-info (need !<([tape (unit toro:clay)] vase))) + %kiln-label (poke-label (need !<([desk @tas] vase))) + %kiln-cancel (poke-cancel (need !<(desk vase))) + %kiln-mount (poke-mount (need !<([path term] vase))) + %kiln-rm (poke-rm (need !<(path vase))) + %kiln-schedule (poke-schedule (need !<([path @da @t] vase))) + %kiln-track (poke-track (need !<(kiln-sync vase))) + %kiln-sync (poke-sync (need !<(kiln-sync vase))) + %kiln-syncs (poke-syncs (need !<(~ vase))) + %kiln-wipe-ford (poke-wipe-ford (need !<(@ud vase))) + %kiln-keep-ford (poke-keep-ford (need !<([@ud @ud] vase))) + %kiln-autoload (poke-autoload (need !<((unit ?) vase))) + %kiln-overload (poke-overload (need !<([@dr @da] vase))) + %kiln-wash-gall (poke-wash-gall (need !<(* vase))) + %kiln-unmount (poke-unmount (need !<($@(term [knot path]) vase))) + %kiln-unsync (poke-unsync (need !<(kiln-unsync vase))) + %kiln-permission (poke-permission (need !<([desk path ?] vase))) + %kiln-cancel-autocommit (poke-cancel-autocommit (need !<(~ vase))) + %kiln-start-autoload (poke-start-autoload (need !<(~ vase))) + %kiln-merge (poke-merge (need !<(kiln-merge vase))) + == :: ++ autoload |% @@ -280,6 +305,17 @@ ~? ?=(^ saw) [%kiln-nack u.saw] abet :: +++ take-agent + |= [=wire =gift:agent:mall] + ?+ wire ~|([%kiln-bad-take-agent wire -.gift] !!) + [%kiln %fancy *] ?> ?=(%poke-ack -.gift) + (take-coup-fancy t.t.wire p.gift) + [%kiln %reload *] ?> ?=(%poke-ack -.gift) + (take-coup-reload t.t.wire p.gift) + [%kiln %spam *] ?> ?=(%poke-ack -.gift) + (take-coup-spam t.t.wire p.gift) + == +:: ++ take-general |= [=wire =sign-arvo] ?- wire diff --git a/pkg/arvo/lib/hood/write-mall.hoon b/pkg/arvo/lib/hood/write-mall.hoon index c61337a93..1c7a16b15 100644 --- a/pkg/arvo/lib/hood/write-mall.hoon +++ b/pkg/arvo/lib/hood/write-mall.hoon @@ -102,6 +102,15 @@ [%cast [p q]:beak u.ext [%$ cay]] == :: +++ poke + |= [=mark =vase] + ?+ mark ~|([%poke-write-bad-mark mark] !!) + %write-sec-atom (poke-sec-atom (need !<([host:eyre @] vase))) + %write-paste (poke-paste (need !<([?(%hoon %md %txt) @t] vase))) + %write-tree (poke-tree (need !<([path mime] vase))) + %write-wipe (poke-wipe (need !<(path vase))) + == +:: ++ made |= [pax=wire date=@da result=made-result:ford] ^+ abet @@ -127,4 +136,8 @@ %+ made wire ?> ?=(%made +<.sign-arvo) +>.sign-arvo +:: +++ take-agent + |= [=wire =gift:agent:mall] + ~|([%write-bad-take-agent wire -.gift] !!) -- From eeac28bdc6cbb8f42a303411e1fad2bc4984bf87 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Fri, 13 Sep 2019 13:01:04 -0700 Subject: [PATCH 142/451] mall, hood: deduplicate types in libs --- bin/solid.pill | 4 +-- pkg/arvo/lib/hood/drum-mall.hoon | 12 ++++----- pkg/arvo/lib/hood/helm-mall.hoon | 31 +++++++++++------------ pkg/arvo/lib/hood/kiln-mall.hoon | 42 +++++++++++++++---------------- pkg/arvo/lib/hood/write-mall.hoon | 8 +++--- 5 files changed, 47 insertions(+), 50 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 23ed89e62..53c1a2d24 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c7b503de1c4f8627920b59131b1aa23d198f68abaf3a64c5c3388ec77c539b69 -size 15516353 +oid sha256:617f028e5c381e8adf813d5b18e81c6b1ddd676049c4e520308af545a20999d2 +size 15663155 diff --git a/pkg/arvo/lib/hood/drum-mall.hoon b/pkg/arvo/lib/hood/drum-mall.hoon index f4858bf8f..5c563a9f0 100644 --- a/pkg/arvo/lib/hood/drum-mall.hoon +++ b/pkg/arvo/lib/hood/drum-mall.hoon @@ -220,12 +220,12 @@ ++ poke |= [=mark =vase] ?+ mark ~|([%poke-drum-bad-mark mark] !!) - %drum-put (poke-put (need !<([path @] vase))) - %drum-link (poke-link (need !<(gill:gall vase))) - %drum-unlink (poke-unlink (need !<(gill:gall vase))) - %drum-exit (poke-exit (need !<(~ vase))) - %drum-start (poke-start (need !<(well:gall vase))) - %drum-set-boot-apps (poke-set-boot-apps (need !<(? vase))) + %drum-put =;(f (f (need !<(_+<.f vase))) poke-put) + %drum-link =;(f (f (need !<(_+<.f vase))) poke-link) + %drum-unlink =;(f (f (need !<(_+<.f vase))) poke-unlink) + %drum-exit =;(f (f (need !<(_+<.f vase))) poke-exit) + %drum-start =;(f (f (need !<(_+<.f vase))) poke-start) + %drum-set-boot-apps =;(f (f (need !<(_+<.f vase))) poke-set-boot-apps) == :: ++ reap-phat :: ack connect diff --git a/pkg/arvo/lib/hood/helm-mall.hoon b/pkg/arvo/lib/hood/helm-mall.hoon index 3f342b7eb..09b3d2757 100644 --- a/pkg/arvo/lib/hood/helm-mall.hoon +++ b/pkg/arvo/lib/hood/helm-mall.hoon @@ -194,23 +194,20 @@ ++ poke |= [=mark =vase] ?+ mark ~|([%poke-helm-bad-mark mark] !!) - %helm-hi (poke-hi (need !<(@t vase))) - %helm-mass (poke-mass (need !<(~ vase))) - %helm-reload (poke-reload (need !<((list term) vase))) - %helm-reload-desk (poke-reload-desk (need !<([@t (list term)] vase))) - %helm-reset (poke-reset (need !<(~ vase))) - %helm-send-hi (poke-send-hi (need !<([ship (unit tape)] vase))) - %helm-verb (poke-verb (need !<(~ vase))) - %helm-rekey (poke-rekey (need !<(@t vase))) - %helm-nuke (poke-nuke (need !<(ship vase))) - %helm-automass (poke-automass (need !<(@dr vase))) - %helm-bonk (poke-bonk (need !<(~ vase))) - %helm-cancel-automass - (poke-cancel-automass (need !<(~ vase))) - %helm-moon - (poke-moon (need !<((unit [ship udiff:point:able:jael]) vase))) - %helm-serve - (poke-serve (need !<([=binding:eyre =generator:eyre] vase))) + %helm-hi =;(f (f (need !<(_+<.f vase))) poke-hi) + %helm-mass =;(f (f (need !<(_+<.f vase))) poke-mass) + %helm-reload =;(f (f (need !<(_+<.f vase))) poke-reload) + %helm-reload-desk =;(f (f (need !<(_+<.f vase))) poke-reload-desk) + %helm-reset =;(f (f (need !<(_+<.f vase))) poke-reset) + %helm-send-hi =;(f (f (need !<(_+<.f vase))) poke-send-hi) + %helm-verb =;(f (f (need !<(_+<.f vase))) poke-verb) + %helm-rekey =;(f (f (need !<(_+<.f vase))) poke-rekey) + %helm-nuke =;(f (f (need !<(_+<.f vase))) poke-nuke) + %helm-automass =;(f (f (need !<(_+<.f vase))) poke-automass) + %helm-bonk =;(f (f (need !<(_+<.f vase))) poke-bonk) + %helm-cancel-automass =;(f (f (need !<(_+<.f vase))) poke-cancel-automass) + %helm-moon =;(f (f (need !<(_+<.f vase))) poke-moon) + %helm-serve =;(f (f (need !<(_+<.f vase))) poke-serve) == :: ++ take-agent diff --git a/pkg/arvo/lib/hood/kiln-mall.hoon b/pkg/arvo/lib/hood/kiln-mall.hoon index 99208ab7c..e295de313 100644 --- a/pkg/arvo/lib/hood/kiln-mall.hoon +++ b/pkg/arvo/lib/hood/kiln-mall.hoon @@ -185,27 +185,27 @@ ++ poke |= [=mark =vase] ?+ mark ~|([%poke-kiln-bad-mark mark] !!) - %kiln-commit (poke-commit (need !<([term ?] vase))) - %kiln-info (poke-info (need !<([tape (unit toro:clay)] vase))) - %kiln-label (poke-label (need !<([desk @tas] vase))) - %kiln-cancel (poke-cancel (need !<(desk vase))) - %kiln-mount (poke-mount (need !<([path term] vase))) - %kiln-rm (poke-rm (need !<(path vase))) - %kiln-schedule (poke-schedule (need !<([path @da @t] vase))) - %kiln-track (poke-track (need !<(kiln-sync vase))) - %kiln-sync (poke-sync (need !<(kiln-sync vase))) - %kiln-syncs (poke-syncs (need !<(~ vase))) - %kiln-wipe-ford (poke-wipe-ford (need !<(@ud vase))) - %kiln-keep-ford (poke-keep-ford (need !<([@ud @ud] vase))) - %kiln-autoload (poke-autoload (need !<((unit ?) vase))) - %kiln-overload (poke-overload (need !<([@dr @da] vase))) - %kiln-wash-gall (poke-wash-gall (need !<(* vase))) - %kiln-unmount (poke-unmount (need !<($@(term [knot path]) vase))) - %kiln-unsync (poke-unsync (need !<(kiln-unsync vase))) - %kiln-permission (poke-permission (need !<([desk path ?] vase))) - %kiln-cancel-autocommit (poke-cancel-autocommit (need !<(~ vase))) - %kiln-start-autoload (poke-start-autoload (need !<(~ vase))) - %kiln-merge (poke-merge (need !<(kiln-merge vase))) + %kiln-commit =;(f (f (need !<(_+<.f vase))) poke-commit) + %kiln-info =;(f (f (need !<(_+<.f vase))) poke-info) + %kiln-label =;(f (f (need !<(_+<.f vase))) poke-label) + %kiln-cancel =;(f (f (need !<(_+<.f vase))) poke-cancel) + %kiln-mount =;(f (f (need !<(_+<.f vase))) poke-mount) + %kiln-rm =;(f (f (need !<(_+<.f vase))) poke-rm) + %kiln-schedule =;(f (f (need !<(_+<.f vase))) poke-schedule) + %kiln-track =;(f (f (need !<(_+<.f vase))) poke-track) + %kiln-sync =;(f (f (need !<(_+<.f vase))) poke-sync) + %kiln-syncs =;(f (f (need !<(_+<.f vase))) poke-syncs) + %kiln-wipe-ford =;(f (f (need !<(_+<.f vase))) poke-wipe-ford) + %kiln-keep-ford =;(f (f (need !<(_+<.f vase))) poke-keep-ford) + %kiln-autoload =;(f (f (need !<(_+<.f vase))) poke-autoload) + %kiln-overload =;(f (f (need !<(_+<.f vase))) poke-overload) + %kiln-wash-gall =;(f (f (need !<(_+<.f vase))) poke-wash-gall) + %kiln-unmount =;(f (f (need !<(_+<.f vase))) poke-unmount) + %kiln-unsync =;(f (f (need !<(_+<.f vase))) poke-unsync) + %kiln-permission =;(f (f (need !<(_+<.f vase))) poke-permission) + %kiln-cancel-autocommit =;(f (f (need !<(_+<.f vase))) poke-cancel-autocommit) + %kiln-start-autoload =;(f (f (need !<(_+<.f vase))) poke-start-autoload) + %kiln-merge =;(f (f (need !<(_+<.f vase))) poke-merge) == :: ++ autoload diff --git a/pkg/arvo/lib/hood/write-mall.hoon b/pkg/arvo/lib/hood/write-mall.hoon index 1c7a16b15..3ec1cecd3 100644 --- a/pkg/arvo/lib/hood/write-mall.hoon +++ b/pkg/arvo/lib/hood/write-mall.hoon @@ -105,10 +105,10 @@ ++ poke |= [=mark =vase] ?+ mark ~|([%poke-write-bad-mark mark] !!) - %write-sec-atom (poke-sec-atom (need !<([host:eyre @] vase))) - %write-paste (poke-paste (need !<([?(%hoon %md %txt) @t] vase))) - %write-tree (poke-tree (need !<([path mime] vase))) - %write-wipe (poke-wipe (need !<(path vase))) + %write-sec-atom =;(f (f (need !<(_+<.f vase))) poke-sec-atom) + %write-paste =;(f (f (need !<(_+<.f vase))) poke-paste) + %write-tree =;(f (f (need !<(_+<.f vase))) poke-tree) + %write-wipe =;(f (f (need !<(_+<.f vase))) poke-wipe) == :: ++ made From cfce0e1390e742540b14e89891c0644cd1e7a45f Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 16 Sep 2019 22:04:56 -0400 Subject: [PATCH 143/451] turn off some debug printfs for benchmarking --- pkg/arvo/sys/vane/alef.hoon | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 04151fa9f..e8feabcd2 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2138,7 +2138,7 @@ ^+ [fragments gifts state] :: return unsent back to caller and reverse effects to finalize :: - =- ::~& %ames-feed^(lent fragments)^%unsent^(lent unsent) + =- ::::::::~&~&~& %ames-feed^(lent fragments)^%unsent^(lent unsent) [unsent (flop gifts) state] :: ^+ [unsent=fragments packet-pump] @@ -2179,7 +2179,7 @@ :: |- ^+ packet-pump ?~ sent packet-pump - ~& %sent^[message-num fragment-num]:i.sent + ::::::~&~&~& %sent^[message-num fragment-num]:i.sent =. packet-pump (give %send i.sent) $(sent t.sent) :: +on-hear: handle ack on a live packet @@ -2198,9 +2198,9 @@ =- :: if no sent packet matches the ack, don't apply mutations or effects :: ?. found.- - ~> %slog.0^leaf/"ames: hear: no-op {(scow %ud message-num)} {(scow %ud fragment-num)}" + ::~> %slog.0^leaf/"ames: hear: no-op {(scow %ud message-num)} {(scow %ud fragment-num)}" packet-pump - ~& %ames-hear-ack^message-num^fragment-num + ::::::~&~&~& %ames-hear-ack^message-num^fragment-num :: =. metrics.state metrics.- =. live.state live.- @@ -2242,7 +2242,7 @@ =- =. metrics.state metrics.- =. live.state live.- :: - ~& %done^metrics.state + ::::::~&~&~& %done^metrics.state resend-lost :: ^- $: metrics=pump-metrics @@ -2299,8 +2299,6 @@ -- :: +make-pump-gauge: construct |pump-gauge congestion control core :: -:: TODO: actual congestion control -:: ++ make-pump-gauge |= [now=@da pump-metrics] =* metrics +<+ @@ -2349,7 +2347,7 @@ ^- pump-metrics :: =? metrics (gth skipped 0) - ~& %skipped^skipped + ::::::~&~&~& %skipped^skipped %_ metrics skipped 0 == @@ -2433,12 +2431,12 @@ ?. is-last-fragment :: single packet ack :: - ~> %slog.0^leaf/"ames: send dupe ack {}" + ::~> %slog.0^leaf/"ames: send dupe ack {}" (give %send seq %& fragment-num) :: whole message (n)ack :: =/ ok=? !(~(has in nax.state) seq) - ~> %slog.0^leaf/"ames: send dupe message ack {} ok={}" + ::~> %slog.0^leaf/"ames: send dupe message ack {} ok={}" (give %send seq %| ok lag=`@dr`0) :: last-acked %slog.0^leaf/"ames: hear last in-progress {}" + ::~> %slog.0^leaf/"ames: hear last in-progress {}" message-still :: ack all other packets :: - ~& %send-ack^seq^fragment-num + ::::::~&~&~& %send-ack^seq^fragment-num (give %send seq %& fragment-num) :: last-heard %slog.0^leaf/"ames: hear last dupe {}" + ::~> %slog.0^leaf/"ames: hear last dupe {}" message-still - ~> %slog.0^leaf/"ames: send dupe ack {}" + ::~> %slog.0^leaf/"ames: send dupe ack {}" (give %send seq %& fragment-num) :: new fragment; store in state and check if message is done :: @@ -2489,7 +2487,7 @@ :: ack any packet other than the last one, and continue either way :: =? message-still !is-last-fragment - ~& %send-ack^seq^fragment-num + ::::::~&~&~& %send-ack^seq^fragment-num (give %send seq %& fragment-num) :: enqueue all completed messages starting at +(last-heard.state) :: From 7f3917107be7e25edd6325e5aba9279797937aac Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 16 Sep 2019 22:05:30 -0400 Subject: [PATCH 144/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index e287c162b..9130be7a4 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:81cbdadd4bca830243762c097a7c85c24b8b7dc2b5b02e38448f2aafac925cbf -size 13237282 +oid sha256:db46624b8e5f95578fc11fc178e6ecbd72cd4e799266980e1da65e6b4ace7631 +size 13232377 From fc9f17ae23e793ae8fe8650dfb1f6af188c823b0 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Mon, 23 Sep 2019 15:44:48 -0700 Subject: [PATCH 145/451] mall: convert talk to mall also change !< to crash on failure --- bin/solid.pill | 4 +- pkg/arvo/age/dojo.hoon | 15 +- pkg/arvo/age/hood.hoon | 21 +- pkg/arvo/age/talk.hoon | 2627 +++++++++++++++++++++++++++++ pkg/arvo/lib/default-agent.hoon | 38 +- pkg/arvo/lib/hood/drum-mall.hoon | 20 +- pkg/arvo/lib/hood/helm-mall.hoon | 30 +- pkg/arvo/lib/hood/kiln-mall.hoon | 50 +- pkg/arvo/lib/hood/write-mall.hoon | 8 +- pkg/arvo/sys/hoon.hoon | 44 +- pkg/arvo/sys/vane/mall.hoon | 20 +- pkg/arvo/sys/zuse.hoon | 2 +- 12 files changed, 2740 insertions(+), 139 deletions(-) create mode 100644 pkg/arvo/age/talk.hoon diff --git a/bin/solid.pill b/bin/solid.pill index 53c1a2d24..14a52f5ad 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:617f028e5c381e8adf813d5b18e81c6b1ddd676049c4e520308af545a20999d2 -size 15663155 +oid sha256:393705422a0c117f1adb64c4606021d50f2520152dd5b34691cf8a386e0dfec6 +size 15813426 diff --git a/pkg/arvo/age/dojo.hoon b/pkg/arvo/age/dojo.hoon index e49318350..88f75e96d 100644 --- a/pkg/arvo/age/dojo.hoon +++ b/pkg/arvo/age/dojo.hoon @@ -531,8 +531,7 @@ :* %pass /poke %agent - p.p.p.mad - q.p.p.mad + p.p.mad %poke cay == @@ -1098,11 +1097,7 @@ ++ handle-upgrade-state |= =old-state=vase =/ old-state !<(house old-state-vase) - ?~ old-state - ~& %prep-lost - `..handle-init - ~& %prep-found - `..handle-init(state u.old-state) + `..handle-init(state old-state) :: ++ handle-poke |= [=mark =vase] @@ -1112,9 +1107,9 @@ =^ moves state ^- (quip card:agent:mall house) ?+ mark ~|([%dojo-poke-bad-mark mark] !!) - %sole-action he-abet:(he-type:he-full (need !<(sole-action vase))) - %lens-command he-abet:(he-lens:he-full (need !<(command:lens vase))) - %json ~& jon=(need !<(json vase)) `state + %sole-action he-abet:(he-type:he-full !<(sole-action vase)) + %lens-command he-abet:(he-lens:he-full !<(command:lens vase)) + %json ~& jon=!<(json vase) `state %wipe ~& %dojo-wipe =. hoc diff --git a/pkg/arvo/age/hood.hoon b/pkg/arvo/age/hood.hoon index e27e0f219..ee4ee824b 100644 --- a/pkg/arvo/age/hood.hoon +++ b/pkg/arvo/age/hood.hoon @@ -145,11 +145,7 @@ ++ handle-upgrade-state |= =old-state=vase =/ old-state !<(hood-1 old-state-vase) - ?~ old-state - ~& %prep-lost - `..handle-init - ~& %prep-found - `..handle-init(lac lac.u.old-state) + `..handle-init(lac lac.old-state) :: ++ handle-poke |= [=mark =vase] @@ -167,16 +163,11 @@ :: XX should rename and move to libs :: ?+ mark ~|([%poke-hood-bad-mark mark] !!) - %hood-load %- poke-hood-load:h - (need !<(hood-part vase)) - %atom %- (wrap poke-atom):from-helm:h - (need !<(@ vase)) - %dill-belt %- (wrap poke-dill-belt):from-drum:h - (need !<(dill-belt:dill vase)) - %dill-blit %- (wrap poke-dill-blit):from-drum:h - (need !<(dill-blit:dill vase)) - %hood-sync %- (wrap poke-sync):from-kiln:h - (need !<([desk ship desk] vase)) + %hood-load (poke-hood-load:h !<(hood-part vase)) + %atom ((wrap poke-atom):from-helm:h !<(@ vase)) + %dill-belt ((wrap poke-dill-belt):from-drum:h !<(dill-belt:dill vase)) + %dill-blit ((wrap poke-dill-blit):from-drum:h !<(dill-blit:dill vase)) + %hood-sync ((wrap poke-sync):from-kiln:h !<([desk ship desk] vase)) == [cards ..handle-init] :: diff --git a/pkg/arvo/age/talk.hoon b/pkg/arvo/age/talk.hoon new file mode 100644 index 000000000..c3cd81c16 --- /dev/null +++ b/pkg/arvo/age/talk.hoon @@ -0,0 +1,2627 @@ +:: :: :: +:::: /app/talk/hoon :: :: + :: :: :: +:: +::TODO maybe keep track of received grams per circle, too? +:: +::TODO [type query] => [press tab to cycle search results, newest-first] +:: => [escape to clear] +:: +:: This client implementation makes use of the %inbox +:: for all its subscriptions and messaging. All +:: rumors received are exclusively about the %inbox, +:: since that's the only thing the client ever +:: subscribes to. +:: +/- sole-sur=sole :: structures +/+ *hall, sole-lib=sole, default-agent :: libraries +/= seed /~ !>(.) +:: +:::: + :: +=> :: # + :: # %arch + :: # + :: data structures + :: + |% + ++ state :: application state + $: :: messaging state :: + grams/(list telegram) :: all history + known/(map serial @ud) :: messages heard + last/@ud :: last heard + count/@ud :: (lent grams) + sources/(set circle) :: our subscriptions + :: circle details :: + remotes/(map circle group) :: remote presences + mirrors/(map circle config) :: remote configs + :: ui state :: + nicks/(map ship nick) :: human identities + bound/(map audience char) :: bound circle glyphs + binds/(jug char audience) :: circle glyph lookup + cli/shell :: interaction state + == :: + ++ shell :: console session + $: latest/@ud :: latest shown msg num + say/sole-share:sole-sur :: console state + active/audience :: active targets + settings/(set term) :: frontend settings + width/@ud :: display width + timez/(pair ? @ud) :: timezone adjustment + == :: + +$ card card:agent:mall :: + ++ work :: interface action + $% :: circle management :: + {$join (map circle range) (unit char)} :: subscribe to + {$leave audience} :: unsubscribe from + {$create security name cord (unit char)} :: create circle + {$delete name (unit cord)} :: delete circle + {$depict name cord} :: change description + {$filter name ? ?} :: change message rules + {$invite name (set ship)} :: give permission + {$banish name (set ship)} :: deny permission + {$source name (map circle range)} :: add source + {$unsource name (map circle range)} :: remove source + {$read name @ud} :: set read count + :: personal metadata :: + {$attend audience (unit presence)} :: set our presence + {$name audience human} :: set our name + :: messaging :: + {$say (list speech)} :: send message + {$eval cord hoon} :: send #-message + {$target p/audience q/(unit work)} :: set active targets + {$reply $@(@ud {@u @ud}) (list speech)} :: reply to + :: displaying info :: + {$number $@(@ud {@u @ud})} :: relative/absolute + {$who audience} :: presence + {$what (unit $@(char audience))} :: show bound glyph + {$circles ~} :: show our circles + {$sources circle} :: show active sources + :: ui settings :: + {$bind char (unit audience)} :: bind glyph + {$unbind char (unit audience)} :: unbind glyph + {$nick (unit ship) (unit cord)} :: un/set/show nick + {$set term} :: enable setting + {$unset term} :: disable setting + {$width @ud} :: change display width + {$timez ? @ud} :: adjust shown times + :: miscellaneous :: + {$show circle} :: show membership + {$hide circle} :: hide membership + {$help ~} :: print usage info + == :: + ++ glyphs `wall`~[">=+-" "}),." "\"'`^" "$%&@"] :: circle char pool ' + -- +=> |% + ++ states + $%({$1 s/state} {$0 s/state-0}) + :: + ++ state-0 + (cork state |=(a/state a(mirrors (~(run by mirrors.a) config-0)))) + ++ config-0 + {src/(set source-0) cap/cord tag/tags fit/filter con/control} + ++ source-0 + {cir/circle ran/range-0} + ++ range-0 + %- unit + $: hed/place-0 + tal/(unit place-0) + == + ++ place-0 + $% {$da @da} + {$ud @ud} + {$sd @sd} + == + -- +:: +:: # +:: # %work +:: # +:: functional cores and arms. +:: +=; talk-core + =| stat=[%1 state] + ^- agent:mall + |_ =bowl:mall + +* this . + ++ handle-init + ^- step:agent:mall + =^ cards talk-core (~(prep talk-core bowl stat) ~) + [cards this(stat +<+.talk-core)] + :: + ++ handle-extract-state + !>(stat) + :: + ++ handle-upgrade-state + |= old-state=vase + ^- step:agent:mall + =/ =states !<(states old-state) + =^ cards talk-core (~(prep talk-core bowl stat) `states) + [cards this(stat +<+.talk-core)] + :: + ++ handle-poke + |= [=mark =vase] + ^- step:agent:mall + =^ cards talk-core + ?+ mark ~|([%talk-bad-mark mark] !!) + %noun (~(poke-noun talk-core bowl stat) !<(@t vase)) + %sole-action + %- ~(poke-sole-action talk-core bowl stat) + !<(sole-action:sole-sur vase) + == + [cards this(stat +<+.talk-core)] + :: + ++ handle-subscribe + |= =path + + ^- step:agent:mall + =^ cards=(list card:agent:mall) talk-core (~(peer talk-core bowl stat) path) + [cards this(stat +<+.talk-core)] + :: + ++ handle-unsubscribe ~(handle-unsubscribe default-agent bowl this) + ++ handle-peek ~(handle-peek default-agent bowl this) + :: + ++ handle-agent-response + |= [=wire =gift:agent:mall] + ^- step:agent:mall + =^ cards talk-core + =/ t ~(. talk-core bowl stat) + ?- -.gift + %http-response !! + %poke-ack (coup-client-action:t +>.wire +.gift) + %subscription-ack `talk-core + %subscription-close + ?+ wire ~|([%talk-bad-sub-close-wire wire] !!) + [%server %client *] (quit-server-client:t +>.wire) + [%server %inbox *] (quit-server-inbox:t +>.wire) + == + :: + %subscription-update + ?+ p.cage.gift ~|([%talk-bad-sub-up-mark wire p.cage.gift] !!) + %hall-prize (diff-hall-prize:t wire !<(prize q.cage.gift)) + %hall-rumor (diff-hall-rumor:t wire !<(rumor q.cage.gift)) + == + == + [cards this(stat +<+.talk-core)] + :: + ++ handle-arvo-response ~(handle-arvo-response default-agent bowl this) + ++ handle-error ~(handle-error default-agent bowl this) + -- +|_ {bol/bowl:mall $1 state} +:: +:: # %transition +:: prep transition ++| %transition +:: +++ prep + :: adapts state + :: + =| mos/(list card) + |= old/(unit states) + ^- (quip card _..prep) + ?~ old + ta-done:ta-init:ta + ?- -.u.old + $1 + [mos ..prep(+<+ u.old)] + :: + $0 + =. mos [[%pass /server/inbox %agent server %unsubscribe ~] peer-inbox mos] + =- $(old `[%1 s.u.old(mirrors -)]) + |^ + (~(run by mirrors.s.u.old) prep-config) + :: + ++ prep-config + |= cof/config-0 + ^- config + =. src.cof + %- ~(gas in *(set source)) + (murn ~(tap in src.cof) prep-source) + :* src.cof + cap.cof + tag.cof + fit.cof + con.cof + 0 + == + :: + ++ prep-source + |= src/source-0 + ^- (unit source) + =+ nan=(prep-range ran.src) + ?~ nan + ~& [%forgetting-source src] + ~ + `src(ran u.nan) + :: + ++ prep-range + |= ran/range-0 + ^- (unit range) + ?~ ran `ran + :: ranges with a relative end aren't stored because they end + :: immediately, so if we find one we can safely discard it. + ?: ?=({$~ {$sd @sd}} tal.u.ran) ~ + :: we replace relative range starts with the current date. + :: this is practically correct. + ?: ?=({$sd @sd} hed.u.ran) + `ran(hed.u [%da now.bol]) + `ran + -- + == +:: +:: # +:: # %utility +:: # +:: small utility functions. ++| %utility +:: +++ self + (true-self [our now our]:bol) +:: +++ server + :: our hall instance + ^- dock + [self %hall] +:: +++ inbox + :: client's circle name + :: + :: produces the name of the circle used by this + :: client for all its operations + ^- name + %inbox +:: +++ incir + :: client's circle + :: + :: ++inbox, except a full circle. + ^- circle + [self inbox] +:: +++ renum + :: find the grams list index for gram with serial. + |= ser/serial + ^- (unit @ud) + =+ num=(~(get by known) ser) + ?~ num ~ + `(sub count +(u.num)) +:: +++ recall + :: find a known gram with serial {ser}. + |= ser/serial + ^- (unit telegram) + =+ num=(renum ser) + ?~ num ~ + `(snag u.num grams) +:: +++ bound-from-binds + :: bound from binds + :: + :: using a mapping of character to audiences, create + :: a mapping of audience to character. + :: + |: bin=binds + ^+ bound + %- ~(gas by *(map audience char)) + =- (zing -) + %+ turn ~(tap by bin) + |= {a/char b/(set audience)} + (turn ~(tap by b) |=(c/audience [c a])) +:: +++ glyph + :: finds a new glyph for assignment. + :: + |= idx/@ + =< cha + %+ reel glyphs + |= {all/tape ole/{cha/char num/@}} + =+ new=(snag (mod idx (lent all)) all) + =+ num=~(wyt in (~(get ju binds) new)) + ?~ cha.ole [new num] + ?: (lth num.ole num) + ole + [new num] +:: +++ peer-client + :: ui state peer card + ^- card + :* %pass + /server/client + %agent + server + %subscribe + /client + == +:: +++ peer-inbox + ^- card + :* %pass + /server/inbox + %agent + server + %subscribe + :: + %+ welp /circle/[inbox]/grams/config/group + ?. =(0 count) + [(scot %ud last) ~] + =+ history-msgs=200 + [(cat 3 '-' (scot %ud history-msgs)) ~] + == +:: +:: # +:: # %engines +:: # +:: main cores. ++| %engines +:: +++ ta + :: per transaction + :: + :: for every transaction/event (poke, peer etc.) + :: talk receives, the ++ta transaction core is + :: called. + :: in processing transactions, ++ta may modify app + :: state, or create cards. these cards get produced + :: upon finalizing the core's with with ++ta-done. + :: when making changes to the shell, the ++sh core is + :: used. + :: + |_ :: cards: cards created by core operations. + :: sole-effects: sole effects created by core operations + :: + $: cards/(list card) + sole-effects/(list sole-effect:sole-sur) + == + :: + :: # %resolve + +| %resolve + :: + ++ ta-done + :: resolve core + :: + :: produces the cards stored in ++ta's cards. + :: %sole-effect cards get squashed into a %mor. + :: + ^+ [*(list card) +>] + :_ +> + =/ foc/(unit sole-effect:sole-sur) + ?~ sole-effects ~ + ?~ t.sole-effects `i.sole-effects :: single sole-effect + `[%mor (flop sole-effects)] :: more sole-effects + :: produce cards or sole-effects and cards. + ?~ foc (flop cards) + [[%give %subscription-update `/sole %sole-effect !>(u.foc)] (flop cards)] + :: + :: # + :: # %emitters + :: # + :: arms that create outward changes. + +| %emitters + :: + ++ ta-emil + :: emit card list + :: + :: adds multiple cards to the core's list. + :: flops to emulate ++ta-emit. + :: + |= mol/(list card) + %_(+> cards (welp (flop mol) cards)) + :: + ++ ta-emit + :: adds a card to the core's list. + :: + |= mov/card + %_(+> cards [mov cards]) + :: + :: # + :: # %interaction-events + :: # + :: arms that apply events we received. + +| %interaction-events + :: + ++ ta-init + :: subscribes to our hall. + :: + %- ta-emil + ^- (list card) + ~[peer-client peer-inbox] + :: + ++ ta-take + :: accept prize + :: + |= piz/prize + ^+ +> + ?+ -.piz +> + $client + %= +> + binds gys.piz + bound (bound-from-binds gys.piz) + nicks nis.piz + == + :: + $circle + %. nes.piz + %= ta-unpack + sources (~(run in src.loc.cos.piz) head) + mirrors (~(put by rem.cos.piz) incir loc.cos.piz) + remotes (~(put by rem.pes.piz) incir loc.pes.piz) + == + == + :: + ++ ta-hear + :: apply change + :: + |= rum/rumor + ^+ +> + ?+ -.rum +> + $client + ?- -.rum.rum + $glyph + (ta-change-glyph +.rum.rum) + :: + $nick + +>(nicks (change-nicks nicks who.rum.rum nic.rum.rum)) + == + :: + $circle + (ta-change-circle rum.rum) + == + :: + ++ ta-change-circle + :: apply circle change + :: + |= rum/rumor-story + ^+ +> + ?+ -.rum + ~&([%unexpected-circle-rumor -.rum] +>) + :: + $gram + (ta-open nev.rum) + :: + $config + =+ cur=(~(gut by mirrors) cir.rum *config) + =. +>.$ + =< sh-done + %- ~(sh-show-config sh cli) + [cir.rum cur dif.rum] + =? +>.$ + ?& ?=($source -.dif.rum) + add.dif.rum + =(cir.rum incir) + == + =* cir cir.src.dif.rum + =+ ren=~(cr-phat cr cir) + =+ gyf=(~(get by bound) [cir ~ ~]) + =< sh-done + =/ sho + :: only present if we're here indefinitely. + =* ran ran.src.dif.rum + ?. |(?=(~ ran) ?=(~ tal.u.ran)) + ~(. sh cli) + %- ~(sh-act sh cli) + [%notify [cir ~ ~] `%hear] + ?^ gyf + (sh-note:sho "has glyph {[u.gyf ~]} for {ren}") + :: we use the rendered circle name to determine + :: the glyph for higher glyph consistency when + :: federating. + =+ cha=(glyph (mug ren)) + (sh-work:sho %bind cha `[cir ~ ~]) + %= +>.$ + sources + ?. &(?=($source -.dif.rum) =(cir.rum incir)) + sources + %. cir.src.dif.rum + ?: add.dif.rum + ~(put in sources) + ~(del in sources) + :: + mirrors + ?: ?=($remove -.dif.rum) (~(del by mirrors) cir.rum) + %+ ~(put by mirrors) cir.rum + (change-config cur dif.rum) + == + :: + $status + =+ rem=(~(gut by remotes) cir.rum *group) + =+ cur=(~(gut by rem) who.rum *status) + =. +>.$ + =< sh-done + %- ~(sh-show-status sh cli) + [cir.rum who.rum cur dif.rum] + %= +>.$ + remotes + %+ ~(put by remotes) cir.rum + ?: ?=($remove -.dif.rum) (~(del by rem) who.rum) + %+ ~(put by rem) who.rum + (change-status cur dif.rum) + == + == + :: + ++ ta-change-glyph + :: applies new set of glyph bindings. + :: + |= {bin/? gyf/char aud/audience} + ^+ +> + =+ nek=(change-glyphs binds bin gyf aud) + ?: =(nek binds) +>.$ :: no change + =. binds nek + =. bound (bound-from-binds nek) + sh-done:~(sh-prod sh cli) + :: + :: # + :: # %messages + :: # + :: storing and updating messages. + +| %messages + :: + ++ ta-unpack + :: open envelopes + :: + :: the client currently doesn't care about nums. + :: + |= nes/(list envelope) + ^+ +> + ?~ nes +> + $(nes t.nes, +> (ta-open i.nes)) + :: + ++ ta-open + :: learn message from an envelope. + :: + |= nev/envelope + ^+ +> + =? last (gth num.nev last) num.nev + (ta-learn gam.nev) + :: + ++ ta-learn + :: save/update message + :: + :: store an incoming telegram, updating if it + :: already exists. + :: + |= gam/telegram + ^+ +> + =+ old=(renum uid.gam) + ?~ old + (ta-append gam) :: add + (ta-revise u.old gam) :: modify + :: + ++ ta-append + :: store a new telegram. + :: + |= gam/telegram + ^+ +> + =: grams [gam grams] + count +(count) + known (~(put by known) uid.gam count) + == + =< sh-done + (~(sh-gram sh cli) gam) + :: + ++ ta-revise + :: modify a telegram we know. + :: + |= {num/@ud gam/telegram} + =+ old=(snag num grams) + ?: =(gam old) +>.$ :: no change + =. grams + %+ welp + (scag num grams) + [gam (slag +(num) grams)] + ?: =(sep.gam sep.old) +>.$ :: no worthy change + =< sh-done + (~(sh-gram sh cli) gam) + :: + :: # + :: # %console + :: # + :: arms for shell functionality. + +| %console + :: + ++ ta-console + :: initialize the shell of this client. + :: + ^+ . + =| she/shell + :: XXX: +sy should be smarter than this + =/ circle-list=(list circle) [incir ~] + =. active.she (sy circle-list) + =. width.she 80 + sh-done:~(sh-prod sh she) + :: + ++ ta-sole + :: apply sole input + :: + |= act/sole-action:sole-sur + ^+ +> + sh-done:(~(sh-sole sh cli) act) + :: + ++ sh + :: per console + :: + :: shell core, responsible for handling user input + :: and the related actions, and outputting changes + :: to the cli. + :: + |_ $: :: she: console state. + :: + she/shell + == + :: + :: # %resolve + +| %resolve + :: + ++ sh-done + :: stores changes to the cli. + :: + ^+ +> + +>(cli she) + :: + :: # + :: # %emitters + :: # + :: arms that create outward changes. + +| %emitters + :: + ++ sh-fact + :: adds a console effect to ++ta's cards. + :: + |= fec/sole-effect:sole-sur + ^+ +> + +>(sole-effects [fec sole-effects]) + :: + ++ sh-act + :: adds an action to ++ta's cards. + :: + |= act/action + ^+ +> + %= +> + cards + :_ cards + :* %pass + /client/action + %agent + server + %poke + [%hall-action !>(act)] + == + == + :: + :: # + :: # %cli-interaction + :: # + :: processing user input as it happens. + +| %cli-interaction + :: + ++ sh-sole + :: applies sole action. + :: + |= act/sole-action:sole-sur + ^+ +> + ?- -.act + $det (sh-edit +.act) + $clr ..sh-sole :: (sh-pact ~) :: XX clear to PM-to-self? + $ret sh-obey + == + :: + ++ sh-edit + :: apply sole edit + :: + :: called when typing into the cli prompt. + :: applies the change and does sanitizing. + :: + |= cal/sole-change:sole-sur + ^+ +> + =^ inv say.she (~(transceive sole-lib say.she) cal) + =+ fix=(sh-sane inv buf.say.she) + ?~ lit.fix + +>.$ + :: just capital correction + ?~ err.fix + (sh-slug fix) + :: allow interior edits and deletes + ?. &(?=($del -.inv) =(+(p.inv) (lent buf.say.she))) + +>.$ + (sh-slug fix) + :: + ++ sh-read + :: command parser + :: + :: parses the command line buffer. produces work + :: items which can be executed by ++sh-work. + :: + =< work + :: # %parsers + :: various parsers for command line input. + |% + ++ expr + :: [cord hoon] + |= tub/nail %. tub + %+ stag (crip q.tub) + wide:(vang & [&1:% &2:% (scot %da now.bol) |3:%]) + :: + ++ dare + :: @dr + %+ sear + |= a/coin + ?. ?=({$$ $dr @} a) ~ + (some `@dr`+>.a) + nuck:so + :: + ++ ship ;~(pfix sig fed:ag) :: ship + ++ shiz :: ship set + %+ cook + |=(a/(list ^ship) (~(gas in *(set ^ship)) a)) + (most ;~(plug com (star ace)) ship) + :: + ++ cire :: local circle + ;~(pfix cen urs:ab) + :: + ++ circ :: circle + ;~ pose + (cold incir col) + ;~(pfix net (stag (^sein:title self) urs:ab)) + ;~ pfix cen + %+ stag self + %+ sear |=(circ=name ?:(=('' circ) ~ (some circ))) + urs:ab + == + :: + %+ cook + |= {a/@p b/(unit term)} + [a ?^(b u.b %inbox)] + ;~ plug + ship + (punt ;~(pfix net urs:ab)) + == + == + :: + ++ circles-flat :: collapse mixed list + |= a/(list (each circle (set circle))) + ^- (set circle) + ?~ a ~ + ?- -.i.a + %& (~(put in $(a t.a)) p.i.a) + %| (~(uni in $(a t.a)) p.i.a) + == + :: + ++ cirs :: non-empty circles + %+ cook circles-flat + %+ most ;~(plug com (star ace)) + (^pick circ (sear sh-glyf glyph)) + :: + ++ drat + :: @da or @dr + :: + :: pas: whether @dr's are in the past or not. + |= pas/? + =- ;~(pfix sig (sear - crub:so)) + |= a/^dime + ^- (unit @da) + ?+ p.a ~ + $da `q.a + $dr :- ~ + %. [now.bol q.a] + ?:(pas sub add) + == + :: + ++ pont :: point for range + :: hed: whether this is the head or tail point. + |= hed/? + ;~ pose + (cold [%da now.bol] (jest 'now')) + (stag %da (drat hed)) + placer + == + :: + ++ rang :: subscription range + =+ ;~ pose + (cook some ;~(pfix net (pont |))) + (easy ~) + == + ;~ pose + (cook some ;~(plug ;~(pfix net (pont &)) -)) + (easy ~) + == + :: + ++ sorz :: non-empty sources + %+ cook ~(gas by *(map circle range)) + (most ;~(plug com (star ace)) ;~(plug circ rang)) + :: + ++ pick :: message reference + ;~(pose nump (cook lent (star mic))) + :: + ++ nump :: number reference + ;~ pose + ;~(pfix hep dem:ag) + ;~ plug + (cook lent (plus (just '0'))) + ;~(pose dem:ag (easy 0)) + == + (stag 0 dem:ag) + == + :: + ++ pore :: security + (perk %channel %village %journal %mailbox ~) + :: + ++ lobe :: y/n loob + ;~ pose + (cold %& ;~(pose (jest 'y') (jest '&') (just 'true'))) + (cold %| ;~(pose (jest 'n') (jest '|') (just 'false'))) + == + :: + ++ message :: exp, lin or url msg + ;~ pose + ;~(plug (cold %eval hax) expr) + (stag %say speeches) + == + :: + ++ speeches :: lin or url msgs + %+ most (jest '•') + ;~ pose + (stag %url aurf:de-purl:html) + :(stag %lin & ;~(pfix vat text)) + :(stag %lin | ;~(less mic hax text)) + == + :: + ++ text :: msg without break + %+ cook crip + (plus ;~(less (jest '•') next)) + :: + ++ nick (cook crip (plus next)) :: nickname + ++ glyph (mask "/\\\{( + ?~ lit +> + =^ lic say.she + (~(transmit sole-lib say.she) `sole-edit:sole-sur`?~(t.lit i.lit [%mor lit])) + (sh-fact [%mor [%det lic] ?~(err ~ [%err u.err]~)]) + :: + ++ sh-obey + :: apply result + :: + :: called upon hitting return in the prompt. if + :: input is invalid, ++sh-slug is called. + :: otherwise, the appropriate work is done and + :: the entered command (if any) gets displayed + :: to the user. + :: + =+ fix=(sh-sane [%nop ~] buf.say.she) + ?^ lit.fix + (sh-slug fix) + =+ jub=(rust (tufa buf.say.she) sh-read) + ?~ jub (sh-fact %bel ~) + %. u.jub + =< sh-work + =+ buf=buf.say.she + =? ..sh-obey &(?=({$';' *} buf) !?=($reply -.u.jub)) + (sh-note (tufa `(list @)`buf)) + =^ cal say.she (~(transmit sole-lib say.she) [%set ~]) + %+ sh-fact %mor + :~ [%nex ~] + [%det cal] + == + :: + :: # + :: # %user-action + :: # + :: processing user actions. + +| %user-action + :: + ++ sh-work + :: do work + :: + :: implements worker arms for different talk + :: commands. + :: worker arms must produce updated state. + :: + |= job/work + ^+ +> + =< work + |% + :: + :: # + :: # %helpers + :: # + +| %helpers + :: + ++ work + :: call correct worker + ?- -.job + :: circle management + $join (join +.job) + $leave (leave +.job) + $create (create +.job) + $delete (delete +.job) + $depict (depict +.job) + $filter (filter +.job) + $invite (permit & +.job) + $banish (permit | +.job) + $source (source & +.job) + $unsource (source | +.job) + $read (read +.job) + :: personal metadata + $attend (attend +.job) + $name (set-name +.job) + :: messaging + $say (say +.job) + $eval (eval +.job) + $target (target +.job) + $reply (reply +.job) + :: displaying info + $number (number +.job) + $who (who +.job) + $what (what +.job) + $circles circles + $sources (list-sources +.job) + :: ui settings + $bind (bind +.job) + $unbind (unbind +.job) + $nick (nick +.job) + $set (wo-set +.job) + $unset (unset +.job) + $width (width +.job) + $timez (timez +.job) + :: miscelaneous + $show (public & +.job) + $hide (public | +.job) + $help help + == + :: + ++ activate + :: prints message details. + :: + |= gam/telegram + ^+ ..sh-work + =+ tay=~(. tr settings.she gam) + =. ..sh-work (sh-fact tr-fact:tay) + sh-prod(active.she aud.gam) + :: + ++ deli + :: gets absolute message number from relative. + :: + |= {max/@ud nul/@u fin/@ud} + ^- @ud + =+ dog=|-(?:(=(0 fin) 1 (mul 10 $(fin (div fin 10))))) + =. dog (mul dog (pow 10 nul)) + =- ?:((lte - max) - (sub - dog)) + (add fin (sub max (mod max dog))) + :: + ++ set-glyph + :: new glyph binding + :: + :: applies glyph binding to our state and sends + :: an action. + :: + |= {cha/char aud/audience} + =: bound (~(put by bound) aud cha) + binds (~(put ju binds) cha aud) + == + sh-prod:(sh-act %glyph cha aud &) + :: + ++ unset-glyph + :: remote old glyph binding + :: + :: removes either {aud} or all bindings on a + :: glyph and sends an action. + :: + |= {cha/char aud/(unit audience)} + =/ ole/(set audience) + ?^ aud [u.aud ~ ~] + (~(get ju binds) cha) + =. ..sh-work (sh-act %glyph cha (fall aud ~) |) + |- ^+ ..sh-work + ?~ ole ..sh-work + =. ..sh-work $(ole l.ole) + =. ..sh-work $(ole r.ole) + %= ..sh-work + bound (~(del by bound) n.ole) + binds (~(del ju binds) cha n.ole) + == + :: + ++ reverse-nicks + :: finds all ships whose handle matches {nym}. + :: + |= nym/^nick + ^- (list ship) + %+ murn ~(tap by nicks) + |= {p/ship q/^nick} + ?. =(q nym) ~ + [~ u=p] + :: + ++ hoon-head + :: eval data + :: + :: makes a vase of environment data to evaluate + :: against (for #-messages). + :: + ^- vase + !> ^- {our/@p now/@da eny/@uvI} + [self now.bol (shas %eny eny.bol)] + :: + :: # + :: # %circle-management + :: # + +| %circle-management + :: + ++ join + :: %join + :: + :: change local mailbox config to include + :: subscriptions to {pas}. + :: + |= {pos/(map circle range) gyf/(unit char)} + ^+ ..sh-work + =+ pas=~(key by pos) + =? ..sh-work ?=(^ gyf) + (bind u.gyf `pas) + =. ..sh-work + sh-prod(active.she pas) + :: default to a day of backlog + =. pos + %- ~(run by pos) + |= r/range + ?~(r `[da+(sub now.bol ~d1) ~] r) + (sh-act %source inbox & pos) + :: + ++ leave + :: %leave + :: + :: change local mailbox config to exclude + :: subscriptions to {pas}. + :: + |= pas/(set circle) + ^+ ..sh-work + :: remove *all* sources relating to {pas}. + =/ pos + %- ~(gas in *(set ^source)) + %- zing + =/ sos + =- ~(tap in src:-) + (~(gut by mirrors) incir *config) + %+ turn ~(tap in pas) + |= c/circle + %+ skim sos + |=(s/^source =(cir.s c)) + =. ..sh-work + (sh-act %source inbox | pos) + (sh-act %notify pas ~) + :: + ++ create + :: %create + :: + :: creates circle {nom} with specified config. + :: + |= {sec/security nom/name txt/cord gyf/(unit char)} + ^+ ..sh-work + =. ..sh-work + (sh-act %create nom txt sec) + (join [[[self nom] ~] ~ ~] gyf) + :: + ++ delete + :: %delete + :: + :: deletes our circle {nom}, after optionally + :: sending a last announce message {say}. + :: + |= {nom/name say/(unit cord)} + ^+ ..sh-work + (sh-act %delete nom say) + :: + ++ depict + :: %depict + :: + :: changes the description of {nom} to {txt}. + :: + |= {nom/name txt/cord} + ^+ ..sh-work + (sh-act %depict nom txt) + :: + ++ permit + :: %invite / %banish + :: + :: invites or banishes {sis} to/from our + :: circle {nom}. + :: + |= {inv/? nom/name sis/(set ship)} + ^+ ..sh-work + =. ..sh-work (sh-act %permit nom inv sis) + =- (sh-act %phrase - [%inv inv [self nom]]~) + %- ~(rep in sis) + |= {s/ship a/audience} + (~(put in a) [s %i]) + :: + ++ filter + |= {nom/name cus/? utf/?} + ^+ ..sh-work + (sh-act %filter nom cus utf) + :: + ++ source + :: %source + :: + :: adds {pas} to {nom}'s src. + :: + |= {sub/? nom/name pos/(map circle range)} + ^+ ..sh-work + (sh-act %source nom sub pos) + :: + ++ read + :: %read + :: + :: set {red} for {nom} + :: + |= {nom/name red/@ud} + ^+ ..sh-work + (sh-act %read nom red) + :: + :: # + :: # %personal-metadata + :: # + +| %personal-metadata + :: + ++ attend + :: sets our presence to {pec} for {aud}. + :: + |= {aud/audience pec/(unit presence)} + ^+ ..sh-work + (sh-act %notify aud pec) + :: + ++ set-name + :: sets our name to {man} for {aud}. + :: + |= {aud/audience man/human} + ^+ ..sh-work + (sh-act %naming aud man) + :: + :: # + :: # %messaging + :: # + +| %messaging + :: + ++ say + :: sends message. + :: + |= sep/(list speech) + ^+ ..sh-work + (sh-act %phrase active.she sep) + :: + ++ eval + :: run + :: + :: executes {exe} and sends both its code and + :: result. + :: + |= {txt/cord exe/hoon} + => |.([(sell (slap (slop hoon-head seed) exe))]~) + =+ tan=p:(mule .) + (say [%exp txt tan] ~) + :: + ++ target + :: %target + :: + :: sets messaging target, then execute {woe}. + :: + |= {aud/audience woe/(unit ^work)} + ^+ ..sh-work + =. ..sh-pact (sh-pact aud) + ?~(woe ..sh-work work(job u.woe)) + :: + ++ reply + :: %reply + :: + :: send a reply to the selected message. + :: + |= {num/$@(@ud {p/@u q/@ud}) sep/(list speech)} + ^+ ..sh-work + :: =- (say (turn ... [%ire - s])) nest-fails on the - ??? + ::TODO what's friendlier, reply-to-null or error? + =/ ser/serial + ?@ num + ?: (gte num count) 0v0 + uid:(snag num grams) + ?: (gth q.num count) 0v0 + ?: =(count 0) 0v0 + =+ msg=(deli (dec count) num) + uid:(snag (sub count +(msg)) grams) + (say (turn sep |=(s/speech [%ire ser s]))) + :: + :: # + :: # %displaying-info + :: # + +| %displaying-info + :: + ++ who + :: %who + :: + :: prints presence lists for {cis} or all. + :: + |= cis/(set circle) ^+ ..sh-work + =< (sh-fact %mor (murn (sort ~(tap by remotes) aor) .)) + |= {cir/circle gop/group} ^- (unit sole-effect:sole-sur) + ?. |(=(~ cis) (~(has in cis) cir)) ~ + ?: =(%mailbox sec.con:(~(gut by mirrors) cir *config)) ~ + ?. (~(has in sources) cir) ~ + =- `[%tan rose+[", " `~]^- leaf+~(cr-full cr cir) ~] + =< (murn (sort ~(tap by gop) aor) .) + |= {a/ship b/presence c/human} ^- (unit tank) + =? c =(han.c `(scot %p a)) [~ tru.c] + ?- b + $gone ~ + $idle `leaf+:(weld "idle " (scow %p a) " " (trip (fall han.c ''))) + $hear `leaf+:(weld "hear " (scow %p a) " " (trip (fall han.c ''))) + $talk `leaf+:(weld "talk " (scow %p a) " " (trip (fall han.c ''))) + == + :: + ++ what + :: %what + :: + :: prints binding details. goes both ways. + :: + :: XX this type is a misjunction, audience can be ~ + :: + |= qur/(unit $@(char audience)) + ^+ ..sh-work + ?^ qur + ?^ u.qur + =+ cha=(~(get by bound) u.qur) + (sh-fact %txt ?~(cha "none" [u.cha]~)) + =+ pan=~(tap in (~(get ju binds) `@t`u.qur)) + ?: =(~ pan) (sh-fact %txt "~") + =< (sh-fact %mor (turn pan .)) + |=(a/audience [%txt ~(ar-phat ar a)]) + %+ sh-fact %mor + %- ~(rep by binds) + |= $: {gyf/char aus/(set audience)} + lis/(list sole-effect:sole-sur) + == + %+ weld lis + ^- (list sole-effect:sole-sur) + %- ~(rep in aus) + |= {a/audience l/(list sole-effect:sole-sur)} + %+ weld l + ^- (list sole-effect:sole-sur) + [%txt [gyf ' ' ~(ar-phat ar a)]]~ + :: + ++ number + :: %number + :: + :: finds selected message, expand it. + :: + |= num/$@(@ud {p/@u q/@ud}) + ^+ ..sh-work + |- + ?@ num + ?: (gte num count) + (sh-lame "{(scow %s (new:si | +(num)))}: no such telegram") + =. ..sh-fact (sh-fact %txt "? {(scow %s (new:si | +(num)))}") + (activate (snag num grams)) + ?. (gte q.num count) + ?: =(count 0) + (sh-lame "0: no messages") + =+ msg=(deli (dec count) num) + =. ..sh-fact (sh-fact %txt "? {(scow %ud msg)}") + (activate (snag (sub count +(msg)) grams)) + (sh-lame "…{(reap p.num '0')}{(scow %ud q.num)}: no such telegram") + :: + ++ circles + :: %circles + :: + :: list all local circles. + :: + ^+ ..sh-work + =/ piz + =- .^(prize %gx -) + %+ weld /(scot %p our.bol)/hall/(scot %da now.bol) + /circles/(scot %p our.bol)/hall-prize + ?> ?=($circles -.piz) + %+ sh-fact %mor + %+ turn (sort ~(tap in cis.piz) lth) + |= a/name [%txt "%{(trip a)}"] + :: + ++ list-sources + :: %sources + :: + :: display the active sources for our circle. + :: + |= cir/circle + ^+ ..sh-work + %+ sh-fact %mor + %+ turn + :: make sure to exclude {nom} itself. + =- ~(tap in (~(del in src:-) [cir ~])) + (~(gut by mirrors) cir *config) + |= s/^source + ^- sole-effect:sole-sur + :- %txt + %+ weld ~(cr-phat cr cir.s) + %+ roll (range-to-path ran.s) + |= {a/@ta b/tape} + :(weld b "/" (trip a)) + :: + :: # + :: # %ui-settings + :: # + +| %ui-settings + :: + ++ bind + :: %bind + :: + :: binds targets {aud} to the glyph {cha}. + :: + |= {cha/char aud/(unit audience)} + ^+ ..sh-work + ?~ aud $(aud `active.she) + =+ ole=(~(get by bound) u.aud) + ?: =(ole [~ cha]) ..sh-work + %. "bound {} {}" + sh-note:sh-prod:(set-glyph cha u.aud) + :: + ++ unbind + :: %unbind + :: + :: unbinds targets {aud} to glyph {cha}. + :: + |= {cha/char aud/(unit audience)} + ^+ ..sh-work + ?. ?| &(?=(^ aud) (~(has by bound) u.aud)) + &(?=(~ aud) (~(has by binds) cha)) + == + ..sh-work + %. "unbound {}" + sh-note:sh-prod:(unset-glyph cha aud) + :: + ++ nick + :: %nick + :: + :: either shows, sets or unsets nicknames + :: depending on arguments. + :: + |= {her/(unit ship) nym/(unit ^nick)} + ^+ ..sh-work + :: no arguments, show all + ?: ?=({~ ~} +<) + %+ sh-fact %mor + %+ turn ~(tap by nicks) + |= {p/ship q/^nick} + :- %txt + "{

}: {}" + :: show her nick + ?~ nym + ?> ?=(^ her) + =+ asc=(~(get by nicks) u.her) + %+ sh-fact %txt + ?~ asc "{} unbound" + "{}: {}" + :: show nick ship + ?~ her + %+ sh-fact %mor + %+ turn (reverse-nicks u.nym) + |= p/ship + [%txt "{

}: {}"] + %. [%nick u.her (fall nym '')] + %= sh-act + nicks + ?~ u.nym + :: unset nickname + (~(del by nicks) u.her) + :: set nickname + (~(put by nicks) u.her u.nym) + == + :: + ++ wo-set + :: %set + :: + :: enables ui setting flag. + :: + |= seg/term + ^+ ..sh-work + ?~ seg + %+ sh-fact %mor + %+ turn ~(tap in settings.she) + |= s/term + [%txt (trip s)] + %= ..sh-work + settings.she (~(put in settings.she) seg) + == + :: + ++ unset + :: %unset + :: + :: disables ui setting flag. + :: + |= neg/term + ^+ ..sh-work + %= ..sh-work + settings.she (~(del in settings.she) neg) + == + :: + ++ width + :: ;set width + :: + :: change the display width in cli. + :: + |= wid/@ud + ^+ ..sh-work + ..sh-work(width.she (max 30 wid)) + :: + ++ timez + :: ;set timezone + :: + :: adjust the displayed timestamp. + :: + |= tim/(pair ? @ud) + ^+ ..sh-work + ..sh-work(timez.she tim) + :: + :: # + :: # %miscellaneous + :: # + +| %miscellaneous + :: + ++ public + :: show/hide membership + :: + :: adds or removes the circle from the public + :: membership list. + :: + |= {add/? cir/circle} + (sh-act %public add cir) + :: + ++ help + :: %help + :: + :: prints help message + :: + (sh-fact %txt "see https://urbit.org/docs/using/messaging/") + -- + :: + ++ sh-pact + :: update active aud + :: + :: change currently selected audience to {aud} + :: and update the prompt. + :: + |= aud/audience + ^+ +> + :: ensure we can see what we send. + =+ act=(sh-pare aud) + ?: =(active.she act) +>.$ + sh-prod(active.she act) + :: + ++ sh-pare + :: adjust target list + :: + :: if the audience {aud} does not contain a + :: circle we're subscribed to, add our mailbox + :: to the audience (so that we can see our own + :: message). + :: + |= aud/audience + ?: (sh-pear aud) aud + (~(put in aud) incir) + :: + ++ sh-pear + :: hearback + :: + :: produces true if any circle is included in + :: our subscriptions, meaning, we hear messages + :: sent to {aud}. + :: + |= aud/audience + ?~ aud | + ?| (~(has in sources) `circle`n.aud) + $(aud l.aud) + $(aud r.aud) + == + :: + ++ sh-glyf + :: decode glyph + :: + :: finds the circle(s) that match a glyph. + :: + |= cha/char ^- (unit audience) + =+ lax=(~(get ju binds) cha) + :: no circle. + ?: =(~ lax) ~ + :: single circle. + ?: ?=({* ~ ~} lax) `n.lax + :: in case of multiple audiences, pick the most recently active one. + |- ^- (unit audience) + ?~ grams ~ + :: get first circle from a telegram's audience. + =+ pan=(silt ~(tap in aud.i.grams)) + ?: (~(has in lax) pan) `pan + $(grams t.grams) + :: + :: # + :: # %differs + :: # + :: arms that calculate differences between datasets. + +| %differs + :: + ++ sh-group-diff + :: group diff parts + :: + :: calculates the difference between two presence + :: lists, producing lists of removed, added and + :: changed presences. + :: + |= {one/group two/group} + =| $= ret + $: old/(list (pair ship status)) + new/(list (pair ship status)) + cha/(list (pair ship status)) + == + ^+ ret + =. ret + =+ eno=~(tap by one) + |- ^+ ret + ?~ eno ret + =. ret $(eno t.eno) + ?: =(%gone pec.q.i.eno) ret + =+ unt=(~(get by two) p.i.eno) + ?~ unt + ret(old [i.eno old.ret]) + ?: =(%gone pec.u.unt) + ret(old [i.eno old.ret]) + ?: =(q.i.eno u.unt) ret + ret(cha [[p.i.eno u.unt] cha.ret]) + =. ret + =+ owt=~(tap by two) + |- ^+ ret + ?~ owt ret + =. ret $(owt t.owt) + ?: =(%gone pec.q.i.owt) ret + ?. (~(has by one) p.i.owt) + ret(new [i.owt new.ret]) + ?: =(%gone pec:(~(got by one) p.i.owt)) + ret(new [i.owt new.ret]) + ret + ret + :: + ++ sh-rempe-diff + :: remotes diff + :: + :: calculates the difference between two remote + :: presence maps, producing a list of removed, + :: added and changed presences maps. + :: + |= {one/(map circle group) two/(map circle group)} + =| $= ret + $: old/(list (pair circle group)) + new/(list (pair circle group)) + cha/(list (pair circle group)) + == + ^+ ret + =. ret + =+ eno=~(tap by one) + |- ^+ ret + ?~ eno ret + =. ret $(eno t.eno) + =+ unt=(~(get by two) p.i.eno) + ?~ unt + ret(old [i.eno old.ret]) + ?: =(q.i.eno u.unt) ret + ret(cha [[p.i.eno u.unt] cha.ret]) + =. ret + =+ owt=~(tap by two) + |- ^+ ret + ?~ owt ret + =. ret $(owt t.owt) + ?: (~(has by one) p.i.owt) + ret + ret(new [i.owt new.ret]) + ret + :: + ++ sh-remco-diff + :: config diff parts + :: + :: calculates the difference between two config + :: maps, producing lists of removed, added and + :: changed configs. + :: + |= {one/(map circle config) two/(map circle config)} + =| $= ret + $: old/(list (pair circle config)) + new/(list (pair circle config)) + cha/(list (pair circle config)) + == + ^+ ret + =. ret + =+ eno=~(tap by one) + |- ^+ ret + ?~ eno ret + =. ret $(eno t.eno) + =+ unt=(~(get by two) p.i.eno) + ?~ unt + ret(old [i.eno old.ret]) + ?: =(q.i.eno u.unt) ret + ret(cha [[p.i.eno u.unt] cha.ret]) + =. ret + =+ owt=~(tap by two) + |- ^+ ret + ?~ owt ret + =. ret $(owt t.owt) + ?: (~(has by one) p.i.owt) + ret + ret(new [i.owt new.ret]) + ret + :: + ++ sh-set-diff + :: set diff + :: + :: calculates the difference between two sets, + :: procuding lists of removed and added items. + :: + |* {one/(set *) two/(set *)} + :- ^= old ~(tap in (~(dif in one) two)) + ^= new ~(tap in (~(dif in two) one)) + :: + :: # + :: # %printers + :: # + :: arms for printing data to the cli. + +| %printers + :: + ++ sh-lame + :: send error + :: + :: just puts some text into the cli as-is. + :: + |= txt/tape + (sh-fact [%txt txt]) + :: + ++ sh-note + :: shell message + :: + :: left-pads {txt} with heps and prints it. + :: + |= txt/tape + ^+ +> + =+ lis=(simple-wrap txt (sub width.she 16)) + %+ sh-fact %mor + =+ ?:((gth (lent lis) 0) (snag 0 lis) "") + :- txt+(runt [14 '-'] '|' ' ' -) + %+ turn (slag 1 lis) + |=(a/tape txt+(runt [14 ' '] '|' ' ' a)) + :: + ++ sh-prod + :: show prompt + :: + :: makes and stores a card to modify the cli + :: prompt to display the current audience. + :: + ^+ . + %+ sh-fact %pro + :+ & %talk-line + ^- tape + =/ rew/(pair (pair cord cord) audience) + [['[' ']'] active.she] + =+ cha=(~(get by bound) q.rew) + ?^ cha ~[u.cha ' '] + =+ por=~(ar-prom ar q.rew) + (weld `tape`[p.p.rew por] `tape`[q.p.rew ' ' ~]) + :: + ++ sh-rend + :: prints a telegram as rendered by ++tr-rend. + :: + |= gam/telegram + ^+ +> + =+ lis=~(tr-rend tr settings.she gam) + ?~ lis +>.$ + %+ sh-fact %mor + %+ turn `(list tape)`lis + =+ nom=(scag 7 (cite:title self)) + |= t/tape + ?. ?& (~(has in settings.she) %notify) + ?=(^ (find nom (slag 15 t))) + == + [%txt t] + [%mor [%txt t] [%bel ~] ~] + :: + ++ sh-numb + :: prints a message number, left-padded by heps. + :: + |= num/@ud + ^+ +> + =+ bun=(scow %ud num) + %+ sh-fact %txt + (runt [(sub 13 (lent bun)) '-'] "[{bun}]") + :: + ++ sh-cure + :: renders a security kind. + :: + |= a/security + ^- tape + (scow %tas a) + :: + ++ sh-scis + :: render status + :: + :: gets the presence of {saz} as a tape. + :: + |= sat/status + ^- tape + ['%' (trip pec.sat)] + :: + ++ sh-show-status + :: prints presence changes to the cli. + :: + |= {cir/circle who/ship cur/status dif/diff-status} + ^+ +> + ?: (~(has in settings.she) %quiet) +> + %- sh-note + %+ weld + (weld ~(cr-phat cr cir) ": ") + ?- -.dif + $full + "hey {(scow %p who)} {(scow %tas pec.sat.dif)}" + :: + $presence + "see {(scow %p who)} {(scow %tas pec.dif)}" + :: + $human + %+ weld "nom {(scow %p who)}" + ?: ?=($true -.dif.dif) ~ + =- " '{(trip (fall han.man.cur ''))}' -> '{-}'" + %- trip + =- (fall - '') + ?- -.dif.dif + $full han.man.dif.dif + $handle han.dif.dif + == + :: + $remove + "bye {(scow %p who)}" + == + :: + ++ sh-show-config + :: prints config changes to the cli. + :: + |= {cir/circle cur/config dif/diff-config} + ^+ +> + ?: (~(has in settings.she) %quiet) +> + ?: ?=($full -.dif) + =. +> + (sh-note (weld "new " (~(cr-show cr cir) ~))) + =. +> $(dif [%caption cap.cof.dif]) + $(dif [%filter fit.cof.dif]) + ?: ?=($remove -.dif) + (sh-note (weld "rip " (~(cr-show cr cir) ~))) + ?: ?=(?($usage $read) -.dif) +> + %- sh-note + %+ weld + (weld ~(cr-phat cr cir) ": ") + ?- -.dif + $source + %+ weld ?:(add.dif "onn " "off ") + ~(cr-full cr cir.src.dif) + :: + $caption + "cap: {(trip cap.dif)}" + :: + $filter + ;: weld + "fit: caps:" + ?:(cas.fit.dif "Y" "n") + " unic:" + ?:(utf.fit.dif "✔" "n") + == + :: + $secure + "sec {(trip sec.con.cur)} -> {(trip sec.dif)}" + :: + $permit + %+ weld + =? add.dif + ?=(?($channel $mailbox) sec.con.cur) + !add.dif + ?:(add.dif "inv " "ban ") + ^- tape + %- ~(rep in sis.dif) + |= {s/ship t/tape} + =? t ?=(^ t) (weld t ", ") + (weld t (cite:title s)) + == + :: + ++ sh-gram + :: show telegram + :: + :: prints the telegram. every fifth message, + :: print the message number also. + :: + |= gam/telegram + ^+ +> + =+ num=(~(got by known) uid.gam) + =. +>.$ + :: if the number isn't directly after latest, print it always. + ?. =(num +(latest.she)) + (sh-numb num) + :: if the number is directly after latest, print every fifth. + ?. =(0 (mod num 5)) +>.$ + (sh-numb num) + (sh-rend(latest.she num) gam) + :: + ++ sh-grams + :: prints multiple telegrams. + :: + |= gaz/(list telegram) + ^+ +> + ?~ gaz +> + $(gaz t.gaz, +> (sh-gram i.gaz)) + -- + -- +:: +:: # +:: # %renderers +:: # +:: rendering cores. ++| %renderers +:: +++ cr + :: circle renderer + :: + :: used in both circle and ship rendering. + :: + |_ :: one: the circle. + :: + one/circle + :: + ++ cr-beat + :: {one} more relevant? + :: + :: returns true if one is better to show, false + :: otherwise. prioritizes: our > main > size. + :: + |= two/circle + ^- ? + :: the circle that's ours is better. + ?: =(self hos.one) + ?. =(self hos.two) & + ?< =(nom.one nom.two) + :: if both circles are ours, the main story is better. + ?: =(%inbox nom.one) & + ?: =(%inbox nom.two) | + :: if neither are, pick the "larger" one. + (lth nom.one nom.two) + :: if one isn't ours but two is, two is better. + ?: =(self hos.two) | + ?: =(hos.one hos.two) + :: if they're from the same ship, pick the "larger" one. + (lth nom.one nom.two) + :: if they're from different ships, neither ours, pick hierarchically. + (lth (xeb hos.one) (xeb hos.two)) + :: + ++ cr-best + :: returns the most relevant circle. + :: + |= two/circle + ?:((cr-beat two) one two) + :: + ++ cr-curt + :: prints a ship name in 14 characters. + :: + :: left-pads with spaces. {mup} signifies + :: "are there other targets besides this one?" + :: + |= mup/? + ^- tape + =+ raw=(cite:title hos.one) + (runt [(sub 14 (lent raw)) ' '] raw) + :: + ++ cr-nick + :: get nick for ship, or shortname if no nick. + :: + :: left-pads with spaces. + :: + |= aud/audience + ^- tape + =/ nic/(unit cord) + ?: (~(has by nicks) hos.one) + (~(get by nicks) hos.one) + %- ~(rep in aud) + |= {cir/circle han/(unit cord)} + ?^ han han + =+ gop=(~(get by remotes) cir) + ?~ gop ~ + han.man:(~(gut by u.gop) hos.one *status) + ?~ nic (cr-curt |) + =+ raw=(scag 14 (trip u.nic)) + =+ len=(sub 14 (lent raw)) + (weld (reap len ' ') raw) + :: + :: todo: figure out why enabling the doccord causes a nest fail, even when + :: attached to the arm instead of the product. + :: + ++ cr-phat ::: render accurately + ::: prints a circle fully, but still taking + ::: "shortcuts" where possible: + ::: ":" for local mailbox, "~ship" for foreign + ::: mailbox, "%channel" for local circle, + ::: "/channel" for parent circle. + :: + ^- tape + ?: =(hos.one self) + ?: =(nom.one inbox) + ":" + ['%' (trip nom.one)] + =+ wun=(cite:title hos.one) + ?: =(nom.one %inbox) + wun + ?: =(hos.one (^sein:title self)) + ['/' (trip nom.one)] + :(welp wun "/" (trip nom.one)) + :: + ++ cr-full (cr-show ~) :: render full width + :: + ++ cr-show + :: renders a circle as text. + :: + :: moy: multiple circles in audience? + |= moy/(unit ?) + ^- tape + :: render circle (as glyph if we can). + ?~ moy + =+ cha=(~(get by bound) one ~ ~) + =- ?~(cha - "{u.cha ~}") + ~(cr-phat cr one) + (~(cr-curt cr one) u.moy) + -- +:: +++ ar + :: audience renderer + :: + :: used for representing audiences (sets of circles) + :: as tapes. + :: + |_ :: aud: members of the audience. + :: + aud/audience + :: + ++ ar-best + :: find the most relevant circle in the set. + :: + ^- (unit circle) + ?~ aud ~ + :- ~ + |- ^- circle + =+ lef=`(unit circle)`ar-best(aud l.aud) + =+ rit=`(unit circle)`ar-best(aud r.aud) + =? n.aud ?=(^ lef) (~(cr-best cr n.aud) u.lef) + =? n.aud ?=(^ rit) (~(cr-best cr n.aud) u.rit) + n.aud + :: + ++ ar-deaf + :: remove ourselves from the audience. + :: + ^+ . + .(aud (~(del in aud) `circle`incir)) + :: + ++ ar-maud + :: multiple audience + :: + :: checks if there's multiple circles in the + :: audience via pattern matching. + :: + ^- ? + =. . ar-deaf + !?=($@(~ {* ~ ~}) aud) + :: + ++ ar-phat + :: render all circles, no glyphs. + :: + ^- tape + %- ~(rep in aud) + |= {c/circle t/tape} + =? t ?=(^ t) + (weld t ", ") + (weld t ~(cr-phat cr c)) + :: + ++ ar-prom + :: render all circles, ordered by relevance. + :: + ^- tape + =. . ar-deaf + =/ all + %+ sort `(list circle)`~(tap in aud) + |= {a/circle b/circle} + (~(cr-beat cr a) b) + =+ fir=& + |- ^- tape + ?~ all ~ + ;: welp + ?:(fir "" " ") + (~(cr-show cr i.all) ~) + $(all t.all, fir |) + == + :: + ++ ar-whom + :: render sender as the most relevant circle. + :: + (~(cr-show cr (need ar-best)) ~ ar-maud) + :: + ++ ar-dire + :: returns true if circle is a mailbox of ours. + :: + |= cir/circle ^- ? + ?& =(hos.cir self) + =+ sot=(~(get by mirrors) cir) + &(?=(^ sot) ?=($mailbox sec.con.u.sot)) + == + :: + ++ ar-glyf + :: todo: another place where doccords break things. + :: + ::: audience glyph + ::: + ::: get the glyph that corresponds to the audience. + ::: for mailbox messages and complex audiences, use + ::: reserved "glyphs". + :: + ^- tape + =+ cha=(~(get by bound) aud) + ?^ cha ~[u.cha] + ?. (lien ~(tap by aud) ar-dire) + "*" + ?: ?=({^ ~ ~} aud) + ":" + ";" + -- +:: +++ tr + :: telegram renderer + :: + :: responsible for converting telegrams and + :: everything relating to them to text to be + :: displayed in the cli. + :: + |_ $: :: sef: settings flags. + :: who: author. + :: sen: unique identifier. + :: aud: audience. + :: wen: timestamp. + :: sep: message contents. + :: + sef/(set term) + who/ship + sen/serial + aud/audience + wen/@da + sep/speech + == + :: + ++ tr-fact + :: activate effect + :: + :: produces sole-effect for printing message + :: details. + :: + ^- sole-effect:sole-sur + ~[%mor [%tan tr-meta] tr-body] + :: + ++ tr-rend + :: renders a telegram + :: + :: the first line will contain the author and + :: optional timestamp. + :: + ^- (list tape) + =/ wyd + %+ sub width.cli :: termwidth, + %+ add 14 :: minus author, + ?:((~(has in sef) %showtime) 10 0) :: minus timestamp. + =+ txs=(tr-text wyd) + ?~ txs ~ + :: render the author. + =/ nom/tape + ?: (~(has in sef) %nicks) + (~(cr-nick cr [who %inbox]) aud) + (~(cr-curt cr [who %inbox]) |) + :: regular indent. + =/ den/tape + (reap (lent nom) ' ') + :: timestamp, if desired. + =/ tam/tape + ?. (~(has in sef) %showtime) "" + =. wen + %. [wen (mul q.timez.cli ~h1)] + ?:(p.timez.cli add sub) + =+ dat=(yore wen) + =/ t + |= a/@ + %+ weld + ?:((lth a 10) "0" ~) + (scow %ud a) + =/ time + ;: weld + "~" (t h.t.dat) + "." (t m.t.dat) + "." (t s.t.dat) + == + %+ weld + (reap (sub +(wyd) (min wyd (lent (tuba i.txs)))) ' ') + time + %- flop + %+ roll `(list tape)`txs + |= {t/tape l/(list tape)} + ?~ l [:(weld nom t tam) ~] + [(weld den t) l] + :: + ++ tr-meta + :: metadata + :: + :: builds string that display metadata, including + :: message serial, timestamp, author and audience. + :: + ^- tang + =. wen (sub wen (mod wen (div wen ~s0..0001))) :: round + =+ hed=leaf+"{(scow %uv sen)} at {(scow %da wen)}" + =/ cis + %+ turn ~(tap in aud) + |= a/circle + leaf+~(cr-full cr a) + [%rose [" " ~ ~] [hed >who< [%rose [", " "to " ~] cis] ~]]~ + :: + ++ tr-body + :: message content + :: + :: long-form display of message contents, specific + :: to each speech type. + :: + |- ^- sole-effect:sole-sur + ?- -.sep + $lin + tan+~[leaf+"{?:(pat.sep "@ " "")}{(trip msg.sep)}"] + :: + $url + url+(crip (apix:en-purl:html url.sep)) + :: + $exp + =/ texp=tape ['>' ' ' (trip exp.sep)] + :- %mor + |- ^- (list sole-effect:sole-sur) + ?: =("" texp) [tan+res.sep ~] + =/ newl (find "\0a" texp) + ?~ newl [txt+texp $(texp "")] + =+ (trim u.newl texp) + :- txt+(scag u.newl texp) + $(texp [' ' ' ' (slag +(u.newl) texp)]) + :: + $ire + =+ num=(~(get by known) top.sep) + ?~ num $(sep sep.sep) + =+ gam=(snag (sub count +(u.num)) grams) + =- mor+[tan+- $(sep sep.sep) ~] + %- flop %+ weld + :_ ~ :- %leaf + %+ weld "in reply to: {(cite:title aut.gam)}: " + "[{(scow %ud u.num)}]" + %+ turn (~(tr-text tr sef gam) width.cli) + |=(t/tape [%leaf t]) + :: + $fat + [%mor $(sep sep.sep) tan+(tr-tach tac.sep) ~] + :: + $inv + :- %tan + :_ ~ + :- %leaf + %+ weld + ?: inv.sep + "you have been invited to " + "you have been banished from " + ~(cr-phat cr cir.sep) + :: + $app + [%mor tan+~[leaf+"[{(trip app.sep)}]: "] $(sep sep.sep) ~] + == + :: + ++ tr-tach + :: renders an attachment. + :: + |= att/attache + ^- tang + ?- -.att + $name (welp $(att tac.att) leaf+"= {(trip nom.att)}" ~) + $tank +.att + $text (turn (flop `(list cord)`+.att) |=(b/cord leaf+(trip b))) + == + :: + ++ tr-chow + :: truncate + :: + :: truncates the {txt} to be of max {len} + :: characters. if it does truncate, indicates it + :: did so by appending _ or …. + :: + |= {len/@u txt/tape} + ^- tape + ?: (gth len (lent txt)) txt + =. txt (scag len txt) + |- + ?~ txt txt + ?: =(' ' i.txt) + |- + :- '_' + ?. ?=({$' ' *} t.txt) + t.txt + $(txt t.txt) + ?~ t.txt "…" + [i.txt $(txt t.txt)] + :: + ++ tr-text + :: compact contents + :: + :: renders just the most important data of the + :: message. if possible, these stay within a single + :: line. + :: + :: pre: replace/append line prefix + ::TODO this should probably be redone someday. + =| pre/(unit (pair ? tape)) + |= wyd/@ud + ^- (list tape) + ?- -.sep + $fat + %+ weld $(sep sep.sep) + ^- (list tape) + ?+ -.tac.sep [" attached: ..." ~] + $name [(scag wyd " attached: {(trip nom.tac.sep)}") ~] + == + :: + $exp + =+ texp=(trip exp.sep) + =+ newline=(find "\0a" texp) + =? texp ?=(^ newline) + (weld (scag u.newline texp) " ...") + :- (tr-chow wyd '#' ' ' texp) + ?~ res.sep ~ + =- [' ' (tr-chow (dec wyd) ' ' -)]~ + ~(ram re (snag 0 `(list tank)`res.sep)) + :: + $ire + $(sep sep.sep, pre `[| "^ "]) + :: + $url + :_ ~ + =+ ful=(apix:en-purl:html url.sep) + =+ pef=q:(fall pre [p=| q=""]) + :: clean up prefix if needed. + =? pef =((scag 1 (flop pef)) " ") + (scag (dec (lent pef)) pef) + =. pef (weld "/" pef) + =. wyd (sub wyd +((lent pef))) :: account for prefix. + :: if the full url fits, just render it. + ?: (gte wyd (lent ful)) :(weld pef " " ful) + :: if it doesn't, prefix with _ and render just (the tail of) the domain. + %+ weld (weld pef "_") + =+ hok=r.p.p.url.sep + =- (swag [a=(sub (max wyd (lent -)) wyd) b=wyd] -) + ^- tape + =< ?: ?=(%& -.hok) + (reel p.hok .) + +:(scow %if p.hok) + |= {a/knot b/tape} + ?~ b (trip a) + (welp b '.' (trip a)) + :: + $lin + :: glyph prefix + =/ pef/tape + ?: &(?=(^ pre) p.u.pre) q.u.pre + ?: pat.sep " " + =- (weld - q:(fall pre [p=| q=" "])) + %~ ar-glyf ar + ?: =(who self) aud + (~(del in aud) [who %inbox]) + =/ lis/(list tape) + %+ simple-wrap + `tape``(list @)`(tuba (trip msg.sep)) + (sub wyd (min (div wyd 2) (lent pef))) + =+ lef=(lent pef) + =+ ?:((gth (lent lis) 0) (snag 0 lis) "") + :- (weld pef -) + %+ turn (slag 1 lis) + |=(a/tape (runt [lef ' '] a)) + :: + $inv + :_ ~ + %+ tr-chow wyd + %+ weld + ?: inv.sep + " invited you to " + " banished you from " + ~(cr-phat cr cir.sep) + :: + $app + $(sep sep.sep, pre `[& "[{(trip app.sep)}]: "]) + == + -- +:: +:: # +:: # %events +:: # ++| %events +:: +++ quit-server-client + |= wir/wire + ^- (quip card _+>) + [[peer-client]~ +>] +:: +++ quit-server-inbox + |= wir/wire + ^- (quip card _+>) + [[peer-inbox]~ +>] +:: +++ peer + :: incoming subscription on pax. + :: + |= pax/path + ^- (quip card _+>) + ?. =(src.bol our.bol) + ~! [%peer-talk-stranger src.bol] + !! + ?. ?=({$sole *} pax) + ~! [%peer-talk-strange pax] + !! + ta-done:ta-console:ta +:: +++ diff-hall-prize + :: accept query answer + :: + |= {way/wire piz/prize} + ^- (quip card _+>) + ta-done:(ta-take:ta piz) +:: +++ diff-hall-rumor + :: accept query change + :: + |= {way/wire rum/rumor} + ^- (quip card _+>) + ta-done:(ta-hear:ta rum) +:: +++ poke-sole-action + :: incoming sole action. process it. + :: + |= act/sole-action:sole-sur + ta-done:(ta-sole:ta act) +:: +::TODO for debug purposes. remove eventually. +:: users beware, here be dragons. +++ poke-noun + |= a/@t + ^- (quip card _+>) + ?: =(a 'check') + ~& 'verifying message reference integrity...' + =- ~&(- [~ +>.$]) + ~& [%count--lent count (lent grams)] + =+ %- ~(rep by known) + |= {{u/serial a/@ud} k/@ud m/@ud} + :- ?:((gth a k) a k) + ?: =(u uid:(snag (sub count +(a)) grams)) m +(m) + :- %check-talk + [known=k mismatch=m] + ?: =(a 'rebuild') + ~& 'rebuilding message references...' + =+ %+ reel grams + |= {t/telegram c/@ud k/(map serial @ud)} + [+(c) (~(put by k) uid.t c)] + [~ +>.$(count c, known k)] + ?: =(a 'reconnect') + ~& 'disconnecting and reconnecting to hall...' + :_ +> + :~ [%pass /server/client %agent server %unsubscribe ~] + [%pass /server/inbox %agent server %unsubscribe ~] + peer-client + peer-inbox + == + ?: =(a 'reset') + ~& 'full reset incoming, hold on to your cli...' + :_ +>(grams ~, known ~, count 0, last 0) + :~ [%pass /server/client %agent server %unsubscribe ~] + [%pass /server/inbox %agent server %unsubscribe ~] + peer-client + peer-inbox + == + :: this deletes a message from your backlog, and may + :: make talk throw stack traces. + :: **aka don't run this!** + ?: =(a 'screw') + ~& 'screwing things up...' + :- ~ + +>(grams (oust [0 1] grams)) + [~ +>] +:: +++ coup-client-action + :: accept n/ack + :: + |= {wir/wire fal/(unit tang)} + ^- (quip card _+>) + ?~ fal [~ +>] + %- (slog leaf+"action failed: " u.fal) + [~ +>] +-- diff --git a/pkg/arvo/lib/default-agent.hoon b/pkg/arvo/lib/default-agent.hoon index e8fe7060b..e71bc7223 100644 --- a/pkg/arvo/lib/default-agent.hoon +++ b/pkg/arvo/lib/default-agent.hoon @@ -2,7 +2,11 @@ ++ handle-init `agent :: -++ handle-prep +++ handle-extract-state + ~& "extracting empty state for {}" + !>(~) +:: +++ handle-upgrade-state |= old-state=vase ~& "updating agent {} by throwing away old state" `agent @@ -13,13 +17,13 @@ ~| "unexpected poke to {} with mark {}" !! :: -++ handle-peer +++ handle-subscribe |= =path ~& "unexpected subscription to {} on path {}" ~| "unexpected subscription to {} on path {}" !! :: -++ handle-pull +++ handle-unsubscribe |= path `agent :: @@ -28,18 +32,18 @@ ~| "unexpected scry into {} on path {}" !! :: -++ handle-mall - |= [=wire =internal-gift:mall] - ?- -.internal-gift - %coup `agent - %reap `agent - %quit +++ handle-agent-response + |= [=wire =gift:agent:mall] + ?- -.gift + %poke-ack `agent + %subscription-ack `agent + %subscription-close ~| "unexpected subscription closure to {} on wire {}" !! :: - %diff + %subscription-update ~| "unexpected subscription update to {} on wire {}" - ~| "with mark {}" + ~| "with mark {}" !! :: %http-response @@ -47,17 +51,13 @@ !! == :: -++ handle-take - |= [=wire =vase] - ~| "unexpected system response {} to {} on wire {}" +++ handle-arvo-response + |= [=wire =sign-arvo] + ~| "unexpected system response {<-.sign-arvo>} to {} on wire {}" !! :: -++ handle-lame +++ handle-error |= [=term =tang] %- (slog leaf+"error in {}" >term< tang) `agent -:: -++ handle-stay - ~& "extracting empty state for {}" - !>(~) -- diff --git a/pkg/arvo/lib/hood/drum-mall.hoon b/pkg/arvo/lib/hood/drum-mall.hoon index 5c563a9f0..163e5f996 100644 --- a/pkg/arvo/lib/hood/drum-mall.hoon +++ b/pkg/arvo/lib/hood/drum-mall.hoon @@ -220,12 +220,12 @@ ++ poke |= [=mark =vase] ?+ mark ~|([%poke-drum-bad-mark mark] !!) - %drum-put =;(f (f (need !<(_+<.f vase))) poke-put) - %drum-link =;(f (f (need !<(_+<.f vase))) poke-link) - %drum-unlink =;(f (f (need !<(_+<.f vase))) poke-unlink) - %drum-exit =;(f (f (need !<(_+<.f vase))) poke-exit) - %drum-start =;(f (f (need !<(_+<.f vase))) poke-start) - %drum-set-boot-apps =;(f (f (need !<(_+<.f vase))) poke-set-boot-apps) + %drum-put =;(f (f !<(_+<.f vase)) poke-put) + %drum-link =;(f (f !<(_+<.f vase)) poke-link) + %drum-unlink =;(f (f !<(_+<.f vase)) poke-unlink) + %drum-exit =;(f (f !<(_+<.f vase)) poke-exit) + %drum-start =;(f (f !<(_+<.f vase)) poke-start) + %drum-set-boot-apps =;(f (f !<(_+<.f vase)) poke-set-boot-apps) == :: ++ reap-phat :: ack connect @@ -277,7 +277,7 @@ %subscription-update %+ diff-sole-effect-phat t.t.wire ?> ?=(%sole-effect p.cage.gift) - (need !<(sole-effect q.cage.gift)) + !<(sole-effect q.cage.gift) == == :: @@ -516,16 +516,16 @@ :: ++ se-poke :: send a poke |= {gyl/gill:gall par/pear} - (se-emit %pass (en-gill gyl) %agent p.gyl q.gyl %poke par) + (se-emit %pass (en-gill gyl) %agent gyl %poke par) :: ++ se-peer :: send a peer |= gyl/gill:gall %- se-emit(fug (~(put by fug) gyl ~)) - [%pass (en-gill gyl) %agent p.gyl q.gyl %subscribe /sole] + [%pass (en-gill gyl) %agent gyl %subscribe /sole] :: ++ se-pull :: cancel subscription |= gyl/gill:gall - (se-emit %pass (en-gill gyl) %agent p.gyl q.gyl %unsubscribe ~) + (se-emit %pass (en-gill gyl) %agent gyl %unsubscribe ~) :: ++ se-tame :: switch connection |= gyl/gill:gall diff --git a/pkg/arvo/lib/hood/helm-mall.hoon b/pkg/arvo/lib/hood/helm-mall.hoon index 09b3d2757..fc5fdea60 100644 --- a/pkg/arvo/lib/hood/helm-mall.hoon +++ b/pkg/arvo/lib/hood/helm-mall.hoon @@ -117,7 +117,7 @@ |= {her/ship mes/(unit tape)} =< abet %- emit :* %pass /helm/hi/(scot %p her) - %agent her %hood %poke + %agent [her %hood] %poke %helm-hi !>(?~(mes '' (crip u.mes))) == :: @@ -194,20 +194,20 @@ ++ poke |= [=mark =vase] ?+ mark ~|([%poke-helm-bad-mark mark] !!) - %helm-hi =;(f (f (need !<(_+<.f vase))) poke-hi) - %helm-mass =;(f (f (need !<(_+<.f vase))) poke-mass) - %helm-reload =;(f (f (need !<(_+<.f vase))) poke-reload) - %helm-reload-desk =;(f (f (need !<(_+<.f vase))) poke-reload-desk) - %helm-reset =;(f (f (need !<(_+<.f vase))) poke-reset) - %helm-send-hi =;(f (f (need !<(_+<.f vase))) poke-send-hi) - %helm-verb =;(f (f (need !<(_+<.f vase))) poke-verb) - %helm-rekey =;(f (f (need !<(_+<.f vase))) poke-rekey) - %helm-nuke =;(f (f (need !<(_+<.f vase))) poke-nuke) - %helm-automass =;(f (f (need !<(_+<.f vase))) poke-automass) - %helm-bonk =;(f (f (need !<(_+<.f vase))) poke-bonk) - %helm-cancel-automass =;(f (f (need !<(_+<.f vase))) poke-cancel-automass) - %helm-moon =;(f (f (need !<(_+<.f vase))) poke-moon) - %helm-serve =;(f (f (need !<(_+<.f vase))) poke-serve) + %helm-hi =;(f (f !<(_+<.f vase)) poke-hi) + %helm-mass =;(f (f !<(_+<.f vase)) poke-mass) + %helm-reload =;(f (f !<(_+<.f vase)) poke-reload) + %helm-reload-desk =;(f (f !<(_+<.f vase)) poke-reload-desk) + %helm-reset =;(f (f !<(_+<.f vase)) poke-reset) + %helm-send-hi =;(f (f !<(_+<.f vase)) poke-send-hi) + %helm-verb =;(f (f !<(_+<.f vase)) poke-verb) + %helm-rekey =;(f (f !<(_+<.f vase)) poke-rekey) + %helm-nuke =;(f (f !<(_+<.f vase)) poke-nuke) + %helm-automass =;(f (f !<(_+<.f vase)) poke-automass) + %helm-bonk =;(f (f !<(_+<.f vase)) poke-bonk) + %helm-cancel-automass =;(f (f !<(_+<.f vase)) poke-cancel-automass) + %helm-moon =;(f (f !<(_+<.f vase)) poke-moon) + %helm-serve =;(f (f !<(_+<.f vase)) poke-serve) == :: ++ take-agent diff --git a/pkg/arvo/lib/hood/kiln-mall.hoon b/pkg/arvo/lib/hood/kiln-mall.hoon index e295de313..b55387231 100644 --- a/pkg/arvo/lib/hood/kiln-mall.hoon +++ b/pkg/arvo/lib/hood/kiln-mall.hoon @@ -185,27 +185,27 @@ ++ poke |= [=mark =vase] ?+ mark ~|([%poke-kiln-bad-mark mark] !!) - %kiln-commit =;(f (f (need !<(_+<.f vase))) poke-commit) - %kiln-info =;(f (f (need !<(_+<.f vase))) poke-info) - %kiln-label =;(f (f (need !<(_+<.f vase))) poke-label) - %kiln-cancel =;(f (f (need !<(_+<.f vase))) poke-cancel) - %kiln-mount =;(f (f (need !<(_+<.f vase))) poke-mount) - %kiln-rm =;(f (f (need !<(_+<.f vase))) poke-rm) - %kiln-schedule =;(f (f (need !<(_+<.f vase))) poke-schedule) - %kiln-track =;(f (f (need !<(_+<.f vase))) poke-track) - %kiln-sync =;(f (f (need !<(_+<.f vase))) poke-sync) - %kiln-syncs =;(f (f (need !<(_+<.f vase))) poke-syncs) - %kiln-wipe-ford =;(f (f (need !<(_+<.f vase))) poke-wipe-ford) - %kiln-keep-ford =;(f (f (need !<(_+<.f vase))) poke-keep-ford) - %kiln-autoload =;(f (f (need !<(_+<.f vase))) poke-autoload) - %kiln-overload =;(f (f (need !<(_+<.f vase))) poke-overload) - %kiln-wash-gall =;(f (f (need !<(_+<.f vase))) poke-wash-gall) - %kiln-unmount =;(f (f (need !<(_+<.f vase))) poke-unmount) - %kiln-unsync =;(f (f (need !<(_+<.f vase))) poke-unsync) - %kiln-permission =;(f (f (need !<(_+<.f vase))) poke-permission) - %kiln-cancel-autocommit =;(f (f (need !<(_+<.f vase))) poke-cancel-autocommit) - %kiln-start-autoload =;(f (f (need !<(_+<.f vase))) poke-start-autoload) - %kiln-merge =;(f (f (need !<(_+<.f vase))) poke-merge) + %kiln-commit =;(f (f !<(_+<.f vase)) poke-commit) + %kiln-info =;(f (f !<(_+<.f vase)) poke-info) + %kiln-label =;(f (f !<(_+<.f vase)) poke-label) + %kiln-cancel =;(f (f !<(_+<.f vase)) poke-cancel) + %kiln-mount =;(f (f !<(_+<.f vase)) poke-mount) + %kiln-rm =;(f (f !<(_+<.f vase)) poke-rm) + %kiln-schedule =;(f (f !<(_+<.f vase)) poke-schedule) + %kiln-track =;(f (f !<(_+<.f vase)) poke-track) + %kiln-sync =;(f (f !<(_+<.f vase)) poke-sync) + %kiln-syncs =;(f (f !<(_+<.f vase)) poke-syncs) + %kiln-wipe-ford =;(f (f !<(_+<.f vase)) poke-wipe-ford) + %kiln-keep-ford =;(f (f !<(_+<.f vase)) poke-keep-ford) + %kiln-autoload =;(f (f !<(_+<.f vase)) poke-autoload) + %kiln-overload =;(f (f !<(_+<.f vase)) poke-overload) + %kiln-wash-gall =;(f (f !<(_+<.f vase)) poke-wash-gall) + %kiln-unmount =;(f (f !<(_+<.f vase)) poke-unmount) + %kiln-unsync =;(f (f !<(_+<.f vase)) poke-unsync) + %kiln-permission =;(f (f !<(_+<.f vase)) poke-permission) + %kiln-cancel-autocommit =;(f (f !<(_+<.f vase)) poke-cancel-autocommit) + %kiln-start-autoload =;(f (f !<(_+<.f vase)) poke-start-autoload) + %kiln-merge =;(f (f !<(_+<.f vase)) poke-merge) == :: ++ autoload @@ -257,14 +257,14 @@ =. cur-hoon new-hoon =. cur-arvo new-arvo =. cur-vanes rehash-vanes - (emit %pass /kiln/reload/hoon %agent our %hood %poke %helm-reset !>(~)) + (emit %pass /kiln/reload/hoon %agent [our %hood] %poke %helm-reset !>(~)) :: XX updates cur-vanes? =/ new-zuse (sys-hash /zuse/hoon) ?: !=(new-zuse cur-zuse) =. cur-zuse new-zuse =. cur-vanes rehash-vanes =/ =cage [%helm-reload !>([%zuse tracked-vanes])] - (emit [%pass /kiln/reload/zuse %agent our %hood %poke cage]) + (emit [%pass /kiln/reload/zuse %agent [our %hood] %poke cage]) (roll tracked-vanes load-vane) :: ++ load-vane @@ -276,7 +276,7 @@ +>.$ =. cur-vanes (~(put by cur-vanes) syd new-vane) =/ =cage [%helm-reload !>(~[syd])] - (emit %pass /kiln/reload/[syd] %agent our %hood %poke cage) + (emit %pass /kiln/reload/[syd] %agent [our %hood] %poke cage) :: ++ coup-reload |= {way/wire saw/(unit tang)} @@ -584,7 +584,7 @@ ^+ +> =/ =cage [%kiln-merge !>([syd her sud cas gem])] %- blab :_ ~ - [%pass /kiln/fancy/[^syd] %agent our %hood %poke cage] + [%pass /kiln/fancy/[^syd] %agent [our %hood] %poke cage] :: ++ spam ::|=(tang ((slog +<) ..spam)) |*(* +>(..work (^spam +<))) diff --git a/pkg/arvo/lib/hood/write-mall.hoon b/pkg/arvo/lib/hood/write-mall.hoon index 3ec1cecd3..b74410677 100644 --- a/pkg/arvo/lib/hood/write-mall.hoon +++ b/pkg/arvo/lib/hood/write-mall.hoon @@ -105,10 +105,10 @@ ++ poke |= [=mark =vase] ?+ mark ~|([%poke-write-bad-mark mark] !!) - %write-sec-atom =;(f (f (need !<(_+<.f vase))) poke-sec-atom) - %write-paste =;(f (f (need !<(_+<.f vase))) poke-paste) - %write-tree =;(f (f (need !<(_+<.f vase))) poke-tree) - %write-wipe =;(f (f (need !<(_+<.f vase))) poke-wipe) + %write-sec-atom =;(f (f !<(_+<.f vase)) poke-sec-atom) + %write-paste =;(f (f !<(_+<.f vase)) poke-paste) + %write-tree =;(f (f !<(_+<.f vase)) poke-tree) + %write-wipe =;(f (f !<(_+<.f vase)) poke-wipe) == :: ++ made diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index ec3a8ed6b..b43f110a1 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -10304,25 +10304,20 @@ [(nice (cell ref p.vos)) (cons [%1 burp(sut p.vos)] q.vos)] :: {$zpgl *} - =+ ^= typ - %- nice - %- fork - :~ [%atom %n `0] - [%cell [%atom %n `0] [%face %u (play [%kttr p.gen])]] - == - =+ ^= val - =< q - %_ $ - gol %noun - gen - :^ %wtcl - :+ %cncl [%limb %levi] - :~ [%tsbn [%zpbn [%kttr p.gen]] [%$ 2]] - [%tsbn q.gen [%$ 2]] - == - [%clhp [%bust %null] [%tsbn q.gen [%$ 3]]] - [%bust %null] - == + =/ typ (nice (play [%kttr p.gen])) + =/ val + =< q + %_ $ + gol %noun + gen + :^ %wtcl + :+ %cncl [%limb %levi] + :~ [%tsbn [%zpbn [%kttr p.gen]] [%$ 2]] + [%tsbn q.gen [%$ 2]] + == + [%tsbn q.gen [%$ 3]] + [%zpzp ~] + == [typ val] :: {$zpts *} [(nice %noun) [%1 q:$(vet |, gen p.gen)]] @@ -10489,11 +10484,7 @@ :: {$zpgl *} :: XX is this right? - %- beth - %- fork - :~ [%atom %n `0] - [%cell [%atom %n `0] [%face %u (play [%kttr p.gen])]] - == + (beth (play [%kttr p.gen])) :: {$zpvt *} =+ [(feel p.gen) (feel(sut dox) p.gen)] @@ -10798,10 +10789,7 @@ {$zpcm *} $(gen p.gen) {$lost *} %void {$zpmc *} (cell $(gen p.gen) $(gen q.gen)) - {$zpgl *} %- fork - :~ [%atom %n `0] - [%cell [%atom %n `0] [%face %u (play [%kttr p.gen])]] - == + {$zpgl *} (play [%kttr p.gen]) {$zpts *} %noun {$zpvt *} ?:((feel p.gen) $(gen q.gen) $(gen r.gen)) {$zpzp *} %void diff --git a/pkg/arvo/sys/vane/mall.hoon b/pkg/arvo/sys/vane/mall.hoon index 54d4fff4d..fb75b5a79 100644 --- a/pkg/arvo/sys/vane/mall.hoon +++ b/pkg/arvo/sys/vane/mall.hoon @@ -281,11 +281,11 @@ =. app (ap-reinstall:app result-vase) ap-abet:app :: - =/ maybe-new-agent !<(agent result-vase) - ?~ maybe-new-agent - =/ err [[%leaf "{}: not valid agent"] ~] + =/ maybe-new-agent (mule |.(!<(agent result-vase))) + ?: ?=(%| -.maybe-new-agent) + =/ err [[%leaf "{}: not valid agent"] p.maybe-new-agent] (mo-give %onto %.n err) - =. mo-core (mo-new-agent term beak u.maybe-new-agent) + =. mo-core (mo-new-agent term beak p.maybe-new-agent) =/ old mo-core =/ wag =/ =routes [disclosing=~ attributing=our] @@ -1075,10 +1075,10 @@ =/ way [(scot %p ship) %out path] :: ?: is-ok - =/ =note:agent [%agent ship -.path %pump ~] + =/ =note:agent [%agent [ship -.path] %pump ~] (ap-pass way note) =. ap-core (ap-give %subscription-close ~) - =/ =note:agent [%agent ship -.path %unsubscribe ~] + =/ =note:agent [%agent [ship -.path] %unsubscribe ~] (ap-pass way note) :: +ap-dequeue: drop from queue. :: @@ -1177,12 +1177,12 @@ |= =vase ^+ ap-core :: - =/ maybe-agent !<(agent vase) - ?~ maybe-agent - (ap-error %new-core-not-agent ~) + =/ maybe-agent (mule |.(!<(agent vase))) + ?: ?=(%| -.maybe-agent) + (ap-error %new-core-not-agent p.maybe-agent) :: =/ prep - =/ =agent u.maybe-agent + =/ =agent p.maybe-agent =/ running %- some ~(handle-extract-state agent.current-agent ap-construct-bowl) diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 5f1c1a9aa..e4a3f20d9 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -1913,7 +1913,7 @@ +$ card (wind note gift) +$ note $% [%arvo =note-arvo] - [%agent =ship name=term =task] + [%agent [=ship name=term] =task] == +$ task $% [%subscribe-translated =mark =path] From 30f74368fb0851ba97deee83a6f36d8ce25de71c Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Mon, 23 Sep 2019 20:46:59 -0700 Subject: [PATCH 146/451] mall: convert hall to mall --- bin/solid.pill | 4 +- pkg/arvo/age/hall.hoon | 3437 +++++++++++++++++++++++++++++++++++ pkg/arvo/age/hood.hoon | 2 +- pkg/arvo/age/talk.hoon | 15 +- pkg/arvo/lib/hall.hoon | 15 +- pkg/arvo/sur/hall.hoon | 12 +- pkg/arvo/sys/arvo.hoon | 12 +- pkg/arvo/sys/vane/mall.hoon | 33 +- pkg/arvo/sys/zuse.hoon | 2 +- 9 files changed, 3496 insertions(+), 36 deletions(-) create mode 100644 pkg/arvo/age/hall.hoon diff --git a/bin/solid.pill b/bin/solid.pill index 14a52f5ad..62bc5a016 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:393705422a0c117f1adb64c4606021d50f2520152dd5b34691cf8a386e0dfec6 -size 15813426 +oid sha256:ed76a74e19d04666431b99f8cfc74d370f48e726ecf1aa82f4da7a4f1b97846a +size 16241615 diff --git a/pkg/arvo/age/hall.hoon b/pkg/arvo/age/hall.hoon new file mode 100644 index 000000000..18506ad2b --- /dev/null +++ b/pkg/arvo/age/hall.hoon @@ -0,0 +1,3437 @@ +:: :: :: +:::: /app/hall/hoon :: :: + :: :: :: +:: +::TODO document gate samples fully. +:: +::TODO for using moons as tmp identities for friends: stories may want to keep +:: lists of moons (or just ships in general?) that we define as "standalone" +:: so that the "convert to true identity" doesn't happen for them. +:: +/- hall-sur=hall :: structures +/+ hall-lib=hall, hall-legacy, default-agent :: libraries +/= seed /~ !>(.) +/= filter-gram + /^ $-({telegram:hall-sur bowl:mall} telegram:hall-sur) + /| /: /%/filter /!noun/ + /~ |=({t/telegram:hall-sur bowl:mall} t) + == +/= custom-rules + /^ (map knot $-({ship ?($r %w) bowl:mall} ?)) + /: /%/rules /_ /!noun/ +:: +:::: +=, hall-sur +=> :: # + :: # %arch + :: # + :: data structures + :: + |% + :: # %state + :: state data structures + ++ state :: application state + $: stories/(map name story) :: conversations + outbox/(map serial tracking) :: sent messages + log/(map name @ud) :: logged to clay + nicks/(map ship nick) :: local nicknames + binds/(jug char audience) :: circle glyph lookup + public/(set circle) :: publicly member of + rir/wire :: current rumor wire + == :: + ++ story :: wire content + $: count/@ud :: (lent grams) + grams/(list telegram) :: all messages + known/(map serial @ud) :: messages heard + sourced/(map circle (list @ud)) :: heard from + sequence/(map circle @ud) :: last-heard p circle + locals/group :: local status + remotes/(map circle group) :: remote status + shape/config :: configuration + mirrors/(map circle config) :: remote config + peers/(jar ship query) :: subscribers + inherited/_| :: from parent? + == :: + :: # %deltas + :: changes to state + ++ delta :: + $% :: public state :: + {$public add/? cir/circle} :: show/hide membership + :: messaging state :: + {$out cir/circle out/(list thought)} :: send msgs to circle + $: $done :: set delivery state + cir/circle :: + ses/(list serial) :: + res/delivery :: + == :: + :: shared ui state :: + {$glyph diff-glyph} :: un/bound glyph + {$nick diff-nick} :: changed nickname + :: story state :: + {$story nom/name det/delta-story} :: change to story + :: side-effects :: + {$init ~} :: initialize + {$observe who/ship} :: watch burden bearer + $: $present :: send %present cmd + hos/ship :: + nos/(set name) :: + dif/diff-status :: + == :: + == :: + ++ delta-story :: story delta + $% {$inherited ihr/?} :: inherited flag + {$follow sub/? srs/(set source)} :: un/subscribe + {$sequent cir/circle num/@ud} :: update last-heard + {$gram src/circle gam/telegram} :: new/changed msgs + {$sourced src/circle num/@ud} :: new heard-from + diff-story :: both in & outward + == :: + +$ card card:agent:mall :: + ++ weir :: parsed wire + $% {$repeat cir/circle ses/(list serial)} :: messaging wire + {$circle nom/name src/source} :: subscription wire + == :: + -- +:: +=> |% + ++ states + $%({$1 s/state} {$0 s/state-0}) + :: + ++ state-0 + (cork state |=(a/state a(stories (~(run by stories.a) story-0)))) + ++ story-0 + %+ cork story + |= a/story + %= a + shape *config-0 + mirrors (~(run by mirrors.a) config-0) + peers (~(run by peers.a) |=(a/(list query) (turn a query-0))) + == + ++ query-0 + $% $: $circle + nom/name + wer/(unit circle) + wat/(set circle-data) + ran/range-0 + == + query + == + ++ config-0 + {src/(set source-0) cap/cord tag/tags fit/filter con/control} + ++ source-0 + {cir/circle ran/range-0} + ++ range-0 + %- unit + $: hed/place-0 + tal/(unit place-0) + == + ++ place-0 + $% {$da @da} + {$ud @ud} + {$sd @sd} + == + -- +:: +:: Formal agent +:: +=; hall-core + =| stat=[%1 state] + ^- agent:mall + |_ =bowl:mall + +* this . + ++ handle-init + ^- step:agent:mall + =^ cards hall-core (~(prep hall-core bowl stat) ~) + [cards this(stat +<+.hall-core)] + :: + ++ handle-extract-state + !>(stat) + :: + ++ handle-upgrade-state + |= old-state=vase + ^- step:agent:mall + =/ =states !<(states old-state) + =^ cards hall-core (~(prep hall-core bowl stat) `states) + [cards this(stat +<+.hall-core)] + :: + ++ handle-poke + |= [=mark =vase] + ^- step:agent:mall + =^ cards hall-core + =/ t ~(. hall-core bowl stat) + ?+ mark ~|([%hall-bad-mark mark] !!) + %hall-command (poke-hall-command:t !<(command vase)) + %hall-action (poke-hall-action:t !<(action vase)) + %hall-save (poke-hall-save:t !<(name vase)) + %load-legacy (poke-load-legacy:t !<(name vase)) + %hall-load (poke-hall-load:t !<(name vase)) + %hall-log (poke-hall-log:t !<(name vase)) + %hall-unlog (poke-hall-unlog:t !<(name vase)) + %import (poke-import:t !<(* vase)) + %noun (poke-noun:t !<(* vase)) + == + [cards this(stat +<+.hall-core)] + :: + ++ handle-subscribe + |= =path + ^- step:agent:mall + =^ cards=(list card:agent:mall) hall-core + (~(peer hall-core bowl stat) path) + [cards this(stat +<+.hall-core)] + :: + ++ handle-unsubscribe + |= =path + ^- step:agent:mall + =^ cards=(list card:agent:mall) hall-core + ?+ path `hall-core + [%circle *] (~(pull-circle hall-core bowl stat) +.path) + == + [cards this(stat +<+.hall-core)] + :: + ++ handle-peek + |= =path + ^- (unit (unit cage)) + (~(peek hall-core bowl stat) path) + :: + ++ handle-agent-response + |= [=wire =gift:agent:mall] + ^- step:agent:mall + =^ cards hall-core + =/ t ~(. hall-core bowl stat) + ?- -.gift + %http-response !! + %poke-ack + ?. ?=([%repeat *] wire) + `hall-core + (coup-repeat:t +.wire p.gift) + :: + %subscription-ack (reap:t wire p.gift) + %subscription-close + ?- wire + [%circle *] (quit-circle:t +.wire) + * (quit:t wire) + == + :: + %subscription-update + ?+ p.cage.gift ~|([%hall-bad-sub-up-mark wire p.cage.gift] !!) + %hall-prize (diff-hall-prize:t wire !<(prize q.cage.gift)) + %hall-rumor (diff-hall-rumor:t wire !<(rumor q.cage.gift)) + == + == + [cards this(stat +<+.hall-core)] + :: + ++ handle-arvo-response ~(handle-arvo-response default-agent bowl this) + ++ handle-error ~(handle-error default-agent bowl this) + -- +:: # +:: # %work +:: # +:: functional cores and arms. +:: +~% %hall-door ..is ~ +|_ {bol/bowl:mall $1 state} +:: +:: # %transition +:: prep transition +:: +++ prep + :: adapts state. + :: + =| mos/(list card) + |= old/(unit states) + ^- (quip card _..prep) + ?~ old + %- pre-bake + ta-done:ta-init:ta + ?- -.u.old + $1 + [mos ..prep(+<+ u.old)] + :: + $0 + =- $(old `[%1 s.u.old(stories -)]) + |^ %- ~(run by stories.s.u.old) + |= soy/story-0 + ^- story + %= soy + shape (prep-config shape.soy) + mirrors (~(run by mirrors.soy) prep-config) + peers %- ~(run by peers.soy) + |= a/(list query-0) + ^- (list query) + (murn a prep-query) + == + :: + ++ prep-config + |= cof/config-0 + ^- config + =. src.cof + %- ~(gas in *(set source)) + (murn ~(tap in src.cof) prep-source) + :* src.cof + cap.cof + tag.cof + fit.cof + con.cof + 0 + == + + :: + ++ prep-source + |= src/source-0 + ^- (unit source) + =+ nan=(prep-range ran.src) + ?~ nan + ~& [%forgetting-source src] + ~ + `src(ran u.nan) + :: + ++ prep-query + |= que/query-0 + ^- (unit query) + ?. ?=($circle -.que) `que + =+ nan=(prep-range ran.que) + ?~ nan + ~& [%forgetting-query que] + ~ + `que(ran u.nan) + :: + ++ prep-range + |= ran/range-0 + ^- (unit range) + ?~ ran `ran + :: ranges with a relative end aren't stored because they end + :: immediately, so if we find one we can safely discard it. + ?: ?=({$~ {$sd @sd}} tal.u.ran) ~ + :: we replace relative range starts with the current date. + :: this is practically correct. + ?: ?=({$sd @sd} hed.u.ran) + `ran(hed.u [%da now.bol]) + `ran + -- + == +:: +:: # %engines +:: main cores. +:: +++ ta + :: thinker core, used for processing pokes into deltas. + :: + ~/ %hall-ta + |_ :: deltas: deltas created by core operations. + :: + deltas/(list delta) + :: # %resolve + :: + ++ ta-done + :: resolve core + :: + :: produces the cards stored in ++ta's cards. + :: they are produced in reverse order because + :: ++ta-emil and ++ta-emit add them to the head of + :: the {cards}. + :: + :: we don't produce any new state, because ++ta + :: doesn't make any changes to it itself. + :: + ^- (list delta) + (flop deltas) + :: + :: # + :: # %emitters + :: # + :: arms that create outward changes. + :: + ++ ta-delta + :: adds a delta to the head of {deltas}. + :: + ~/ %hall-ta-delta + |= det/delta + %_(+> deltas [det deltas]) + :: + ++ ta-deltas + :: adds multiple deltas to the head of {deltas}. + :: + :: flops to stay consistent with ++ta-delta. + :: + ~/ %hall-ta-deltas + |= des/(list delta) + %_(+> deltas (welp (flop des) deltas)) + :: + ++ ta-speak + :: sends {sep} as an %app message to the user's inbox. + :: + ~/ %hall-ta-speak + |= sep/speech + %+ ta-action %phrase + :- [[our.bol %inbox] ~ ~] + [%app dap.bol sep]~ + :: + ++ ta-grieve + :: sends a stack trace to the user's inbox. + :: + ~/ %hall-ta-grieve + |= {msg/tape fal/tang} + %^ ta-speak %fat + [%name 'stack trace' %tank fal] + [%lin | (crip msg)] + :: + ++ ta-note + :: sends {msg} to the user's inbox. + :: + ~/ %hall-ta-note + |= msg/tape + (ta-speak %lin | (crip msg)) + :: + ++ ta-evil + :: tracing printf and crash. + :: + ~/ %hall-ta-evil + |= msg/cord + ~| [%hall-ta-evil msg] + !! + :: + :: # + :: # %data + :: # + :: utility functions for data retrieval. + :: + ++ ta-know + :: story monad + :: + :: produces a gill that takes a gate. if the story + :: {nom} exists, calls the gate with a story core. + :: if it doesn't, does nothing. + :: + ~/ %hall-ta-know + |= nom/name + |: fun=^|(|:(so ta)) + ^+ +>+> + =+ pur=(~(get by stories) nom) + ?~ pur + %- ta-evil + (crip "no story '{(trip nom)}'") + (fun ~(. so nom ~ u.pur)) + :: + :: # + :: # %interaction-events + :: # + :: arms that apply events we received. + :: + ++ ta-init + :: initialize app + :: + :: populate state on first boot. creates our default mailbox and journal. + :: + :: create default circles. + => %+ roll + ^- (list {security name cord}) + :~ [%mailbox %inbox 'default home'] + [%journal %public 'visible activity'] + [%mailbox %i 'dm invites'] + == + |: [[typ=*security nom=*name des=*cord] ta] + (ta-action [%create nom des typ]) + %- ta-deltas + :: if needed, subscribe to our parent's /burden. + =+ sen=(above:hall-lib [our now our]:bol) + ?: ?| !=(%czar (clan:title sen)) + =(sen our.bol) + =(%pawn (clan:title our.bol)) + == + ~ + [%init ~]~ + :: + ++ ta-apply + :: applies the command sent by {src}. + :: + ~/ %hall-ta-apply + |= {src/ship cod/command} + ^+ +> + ?- -.cod + :: %publish commands prompt us (as a circle host) + :: to verify and distribute messages. + $publish (ta-think | src +.cod) + :: %present commands are used to ask us to set + :: someone's status in the indicated stories. + $present (ta-present src +.cod) + :: %bearing commands are used by our children to + :: let us know they're bearing our /burden. we + :: need to watch them to allow changes to go up. + $bearing (ta-observe src) ::TODO isn't this redundant with ta-subscribe? + == + :: + ++ ta-present + :: update a status + :: + :: sets status for the indicated stories, + :: but only if they have write permission there. + :: + ~/ %hall-ta-present + |= {who/ship nos/(set name) dif/diff-status} + ^+ +> + =+ nol=~(tap in nos) + |- + ?~ nol +>.^$ + =. +>.^$ + ?. (~(has by stories) i.nol) +>.^$ + =+ soy=(~(got by stories) i.nol) + so-done:(~(so-present so i.nol ~ soy) who dif) + $(nol t.nol) + :: + ++ ta-action + :: performs action sent by a client. + :: + ~/ %hall-ta-action + |= act/action + ^+ +> + =< work + :: # + :: # %actions + :: # + :: action processing core + :: + :: ++work calls the appropriate action processing + :: arm. most use ++affect to retrieve the affected + :: story, crashing if it doesn't exist. + ~% %hall-ta-action-inner + ~ + |% + :: # %utility + ++ work :: perform action + ^+ ..ta-action + ?- -.act + :: circle configuration + $create (action-create +.act) + $design (action-design +.act) + $source (action-source +.act) + $depict (action-depict +.act) + $filter (action-filter +.act) + $permit (action-permit +.act) + $delete (action-delete +.act) + $usage (action-usage +.act) + $read (action-read +.act) + $newdm (action-newdm +.act) + :: messaging + $convey (action-convey +.act) + $phrase (action-phrase +.act) + :: personal metadata + $notify (action-notify +.act) + $naming (action-naming +.act) + :: changing shared ui + $glyph (action-glyph +.act) + $nick (action-nick +.act) + :: misc changes + $public (action-public +.act) + == + :: + ++ affect + :: delta to story + :: + :: store a delta about a story. if the story + :: does not exist, crash. + :: + ~/ %hall-affect + |= {nom/name det/delta-story} + ?: (~(has by stories) nom) + (impact nom det) + (ta-evil (crip "no story {(trip nom)}")) + :: + ++ impact + :: delta for story + :: + :: Store a delta about a story. + :: + ~/ %hall-impact + |= {nom/name det/delta-story} + (ta-delta %story nom det) + :: + ++ present + :: send status update + :: + ~/ %hall-present + |= {aud/audience dif/diff-status} + ^+ ..ta-action + =/ cic + ^- (jug ship name) + %- ~(rep in aud) + |= {c/circle m/(jug ship name)} + (~(put ju m) hos.c nom.c) + =? ..ta-action (~(has by cic) our.bol) + =+ nos=~(tap in (~(get ju cic) our.bol)) + (ta-present our.bol (~(get ju cic) our.bol) dif) + =. cic (~(del by cic) our.bol) + %- ta-deltas + %- ~(rep by cic) + |= {{h/ship s/(set name)} l/(list delta)} + :_ l + [%present h s dif] + :: + :: # %circle-configuration + ++ action-create + :: creates a story with the specified parameters. + :: + ~/ %hall-action-create + |= {nom/name des/cord typ/security} + ^+ ..ta-action + ?. (~(has by stories) nom) + %^ impact nom %new + :* [[[our.bol nom] ~] ~ ~] + des + ~ + *filter + :- typ + ?. ?=(?($village $journal) typ) ~ + [our.bol ~ ~] + 0 + == + (ta-evil (crip "{(trip nom)}: already exists")) + :: + ++ action-design + :: creates a story with the specified config. + :: + ~/ %hall-action-design + |= {nom/name cof/config} + ?. (~(has by stories) nom) + (impact nom %new cof) + (ta-evil (crip "{(trip nom)}: already exists")) + :: + ++ action-delete + :: delete + announce + :: + :: delete story {nom}, optionally announcing the + :: event with message {mes}. + :: + ~/ %hall-action-delete + |= {nom/name mes/(unit cord)} + ^+ ..ta-action + =? ..ta-action ?=(^ mes) + %+ action-phrase + [[our.bol nom] ~ ~] + [%lin | u.mes]~ + (affect nom %remove ~) + :: + ++ action-depict + :: change description of story {nom} to {des}. + :: + ~/ %hall-depict + |= {nom/name cap/cord} + (affect nom %config [our.bol nom] %caption cap) + :: + ++ action-filter + :: change message rules + :: + :: replaces the story's current filter with the + :: specified one. + :: + ~/ %hall-action-filter + |= {nom/name fit/filter} + (affect nom %config [our.bol nom] %filter fit) + :: + ++ action-permit + :: invite to/banish from story {nom} all {sis}. + :: + ~/ %hall-action-permit + |= {nom/name inv/? sis/(set ship)} + =+ soy=(~(get by stories) nom) + ?~ soy + (ta-evil (crip "no story {(trip nom)}")) + so-done:(~(so-permit so nom ~ u.soy) inv sis) + :: + ++ action-source + :: add/remove {pos} as sources for story {nom}. + :: + ~/ %hall-action-source + |= {nom/name sub/? srs/(set source)} + =+ soy=(~(get by stories) nom) + ?~ soy + (ta-evil (crip "no story {(trip nom)}")) + so-done:(~(so-sources so nom ~ u.soy) sub srs) + :: + ++ action-usage + :: add or remove usage tags. + :: + ~/ %hall-action-usage + |= {nom/name add/? tas/tags} + =+ soy=(~(get by stories) nom) + ?~ soy + (ta-evil (crip "no story {(trip nom)}")) + so-done:(~(so-usage so nom ~ u.soy) add tas) + :: + ++ action-read + :: set the read message number + :: + ~/ %hall-action-read + |= {nom/name red/@ud} + =+ soy=(~(get by stories) nom) + ?~ soy + (ta-evil (crip "no story {(trip nom)}")) + so-done:(~(so-read so nom ~ u.soy) red) + :: + ++ action-newdm + :: copy all behavior of create, permit, and source in that order + :: + ~/ %hall-action-newdm + |= sis/(set ship) + :: generate circle name from sis as a dot seperated list of ship names + :: in alphabetical order + :: + =/ nom/name + %^ rsh 3 1 + %+ roll + %+ sort %+ turn ~(tap in (~(put in sis) our.bol)) + |= p/ship + ^- cord + (scot %p p) + aor + |= {p/cord nam/name} + ^- @tas + (crip "{(trip `@t`nam)}.{(slag 1 (trip p))}") + :: if we've already created this circle, no-op + :: + ?: (~(has in ~(key by stories)) nom) + (ta-deltas ~) + :: check if we already have an invite to this dm group + :: or if we are creating it + :: + =/ inv=(list telegram) + %+ skim grams:(~(got by stories) %i) + |= g=telegram + ^- ? + ?. ?=({$inv *} sep.g) %.n + ?. =(nom nom.cir.sep.g) %.n + ?. (~(has in sis) aut.g) %.n + %.y + :: + =. inv %+ sort inv + |= {a/telegram b/telegram} + (lte wen.a wen.b) + :: create our side of the dm and source it to our inbox + :: + =/ dels/(list delta) + :~ :* %story + %inbox + %follow + & + [[[our.bol nom] ~] ~ ~] + == + :* %story + nom + %new + [[[our.bol nom] ~] ~ ~] + 'dm' + ~ + *filter + [%village (~(put in sis) our.bol)] + 0 + == + == + :: if we did initiate the dm, send out invites + :: + ?: ?=(~ inv) + =. ..ta-action (ta-deltas dels) + %- action-convey + ^- (list thought) + %+ turn ~(tap in (~(del in sis) our.bol)) + |= a=ship + ^- thought + :* uid=(shaf a eny.bol) + aud=(sy [a %i] ~) + wen=now.bol + sep=[%inv & [our.bol nom]] + == + :: if we did not initiate the dm, source to the initiators copy + :: + =. dels + :_ dels + :* %story + nom + %follow + & + [[[aut.i.inv nom] ~] ~ ~] + == + (ta-deltas dels) + :: + :: # %messaging + ++ action-convey + :: post exact + :: + :: sends the messages provided in the action. + :: + ~/ %hall-action-convey + |= tos/(list thought) + (ta-think & our.bol tos) + :: + ++ action-phrase + :: post easy + :: + :: sends the message contents provided in the + :: action generating a serial and setting a + :: timestamp. + :: + ~/ %hall-action-phrase + |= {aud/audience ses/(list speech)} + ^+ ..ta-action + =- (ta-think & our.bol tos) + |- ^- tos/(list thought) + ?~ ses ~ + =^ sir eny.bol ~(uniq hall-lib bol) + :_ $(ses t.ses) + [sir aud [now.bol i.ses]] + :: + :: # %personal-metadata + :: + ++ action-notify + :: our presence update + :: + :: notify the audience of our new presence state, + :: or tell them to remove us if {pes} is ~. + :: + ~/ %hall-action-notify + |= {aud/audience pes/(unit presence)} + ^+ ..ta-action + ?~ pes (present aud %remove ~) + (present aud %presence u.pes) + :: + ++ action-naming + :: our name update + :: + ~/ %hall-action-naming + |= {aud/audience man/human} + ^+ ..ta-action + (present aud %human %full man) + :: + :: # %changing-shared-ui + ++ action-nick + :: new identity + :: + :: assigns a new local identity ("nickname") to the + :: target ship. + :: + ~/ %hall-action-nick + |= {who/ship nic/nick} + ^+ ..ta-action + ?. =((~(get by nicks) who) `nic) ..ta-action :: no change + (ta-delta %nick who nic) + :: + ++ action-glyph + :: un/bind glyph {lif} to audience {aud}. + :: + ~/ %hall-action-glyph + |= {lif/char aud/audience bin/?} + (ta-delta %glyph bin lif aud) + :: + ++ action-public + :: show/hide membership + :: + :: add or remove a circle from the public membership list. + :: + ~/ %hall-action-public + |= {add/? cir/circle} + (ta-delta %public add cir) + -- + :: + :: # + :: # %subscription-events + :: # + :: arms that react to subscription events. + :: + ++ ta-observe + :: watch burden bearer + :: + :: subscribe to a child who is bearing our burden. + ::TODO everyone should be able to bear if they so desire. + :: + ~/ %hall-ta-observe + |= who/ship + ^+ +> + ?. =(our.bol (above:hall-lib our.bol now.bol who)) + ~&([%not-our-bearer who] +>) + (ta-delta %observe who) + :: + ++ ta-subscribe + :: listen to + :: + :: reaction to incoming subscriptions. + :: + ~/ %hall-ta-subscribe + |= {her/ship qer/query} + ^+ +> + ?+ -.qer +> + $burden (ta-observe her) + $circle %+ ta-delta %story + [nom.qer %peer & her qer] + == + :: + ++ ta-greet + :: subscription success + :: + :: store a started subscription as source. + :: + ~/ %hall-ta-greet + |= {nom/name src/source} + %- (ta-know nom) |= sor/_so =< so-done + (so-greet:sor src) + :: + ++ ta-leave + :: subscription failed + :: + :: removes {src} from story {nom}'s sources. + :: + ~/ %hall-ta-leave + |= {nom/name src/source} + %- (ta-know nom) |= sor/_so =< so-done + (so-leave:sor src) + :: + ++ ta-take + :: apply prize + :: + :: for a %burden prize, bear the burden in a new + :: or existing story. + :: for a %circle prize, use ++so to accept it. + :: for a %report prize, silently ignore. + :: + ~/ %hall-ta-take + |= {wir/wire piz/prize} + ^+ +> + ?+ -.piz ~&([%ignoring-prize -.piz] +>) + $report + +> + :: + $burden + =+ sos=~(tap by sos.piz) + |- ^+ ..ta-take + ?~ sos ..ta-take + =. ..ta-take + =+ (~(gut by stories) p.i.sos *story) + => (~(so-bear so p.i.sos ~ -) q.i.sos) + =. acs (flop acs) + |- ^+ ..ta-take + ?~ acs ..ta-take + =. ..ta-take (ta-action i.acs) + $(acs t.acs) + $(sos t.sos) + ::TODO runtime error + ::%+ roll ~(tap by sos.piz) + ::|= {{n/name b/burden} _..ta-take} + ::=+ (~(gut by stories) n *story) + ::so-done:(~(so-bear so n ~ -) b) + :: + $circle + =+ wer=(etch wir) + ?> ?=($circle -.wer) + %- (ta-know nom.wer) |= sor/_so =< so-done + (so-take:sor cir.src.wer +.piz) + == + :: + ++ ta-hear + :: apply rumor + :: + :: apply changes from a rumor to our state. + :: for %burden, authoratively apply the story + :: diff. if it's a new one, bear it. + :: for %circle, apply the story diff normally. + :: + ~/ %hall-ta-hear + |= {wir/wire rum/rumor} + ^+ +> + ?+ -.rum + ~&([%ignoring-rumor -.rum] +>) + :: + $burden + ?+ -.rum.rum + %- (ta-know nom.rum) |= sor/_so =< so-done + (so-hear:sor & [our.bol nom.rum] rum.rum) + :: + $new + =? +> !(~(has by stories) nom.rum) + (ta-delta %story +.rum) + => =+ (~(gut by stories) nom.rum *story) + %- ~(so-bear so nom.rum ~ -) + [~ [cof.rum.rum ~] [~ ~]] + =. acs (flop acs) + |- ^+ +>+ + ?~ acs +>+ + =. +>+ (ta-action i.acs) + $(acs t.acs) + ::TODO runtime error + ::=< so-done + ::%- ~(so-bear so nom.rum ~ (~(gut by stories) nom.rum *story)) + ::[~ [cof.rum.rum ~] [~ ~]] + == + :: + $circle + =+ wer=(etch wir) + ?> ?=($circle -.wer) + %- (ta-know nom.wer) |= sor/_so =< so-done + (so-hear:sor | cir.src.wer rum.rum) + == + :: + ++ ta-repeat + :: message delivered + :: + :: message got delivered. if an error was returned + :: mark the message as rejected. if not, received. + :: + ~/ %hall-ta-repeat + |= {who/circle ses/(list serial) fal/(unit tang)} + ^+ +> + ?~ fal + (ta-delta %done who ses %accepted) + =. +> (ta-delta %done who ses %rejected) + =- (ta-grieve - u.fal) + %+ weld "{(scow %ud (lent ses))} message(s) " + "rejected by {(scow %p hos.who)}/{(trip nom.who)}" + :: + ++ ta-resub + :: subscription dropped + :: + :: when a subscription gets dropped by gall, we + :: resubscribe. + :: + ~/ %hall-ta-resub + |= {nom/name src/source} + ^+ +> + %- (ta-know nom) |= sor/_so =< so-done + (so-resub:sor src) + :: + :: # + :: # %messaging + :: # + :: arms for sending and processing messages. + :: + ++ ta-think + :: publish or review + :: + :: consumes each thought. + :: + ~/ %hall-ta-think + |= {pub/? aut/ship tos/(list thought)} + ^+ +> + ?~ tos +> + $(tos t.tos, +> (ta-consume pub aut i.tos)) + :: + ++ ta-consume + :: to each audience + :: + :: conducts thought {tot} to each circle in its audience. + :: + ~/ %hall-ta-consume + |= {pub/? aut/ship tot/thought} + =+ aud=~(tap in aud.tot) + |- ^+ +>.^$ + ?~ aud +>.^$ + $(aud t.aud, +>.^$ (ta-conduct pub aut i.aud tot)) + :: + ++ ta-conduct + :: thought to circle + :: + :: either publishes or records a thought. + :: + ~/ %hall-ta-conduct + |= {pub/? aut/ship cir/circle tot/thought} + ^+ +> + ?: pub + ?. (team:title our.bol aut) + (ta-note "strange author {(scow %p aut)}") + =. aut our.bol + ?: =(aut hos.cir) + ?: (~(has by stories) nom.cir) + (ta-record nom.cir hos.cir tot) + ::TODO avenue for abuse? + (ta-note "have no story {(scow %tas nom.cir)}") + (ta-transmit cir tot) + ?. =(our.bol hos.cir) +> + (ta-record nom.cir aut tot) + :: + ++ ta-record + :: add to story + :: + :: add or update telegram {gam} in story {nom}. + :: + ~/ %hall-ta-record + |= {nom/name gam/telegram} + %- (ta-know nom) |= sor/_so =< so-done + (so-learn:sor [our.bol nom] gam) + :: + ++ ta-transmit + :: sends thought {tot} to {cir}. + :: + ~/ %hall-ta-transmit + |= {cir/circle tot/thought} + ^+ +> + (ta-delta %out cir tot ~) + :: + :: # + :: # %stories + :: # + :: arms for modifying stories. + :: + ++ so + :: story core, used for doing work on a story. + :: + ~/ %hall-so + |_ :: nom: story name in {stories}. + :: acs: hall actions issued due to changes. + :: story is faceless to ease data access. + :: + $: nom/name + acs/(list action) + story + == + :: + :: # %resolve + ++ so-done + :: apply actions generated by story operations. + ::TODO maybe produce list of actions, apply in ++ta + :: + ^+ +> + =. acs (flop acs) + |- ^+ +>+ + ?~ acs +>+ + =. +>+ (ta-action i.acs) + $(acs t.acs) + :: + :: # + :: # %emitters + :: # + :: arms that create outward changes. + :: + ++ so-act + :: stores a hall action. + :: + ~/ %hall-so-act + |= act/action + ^+ +> + +>(acs [act acs]) + :: + ++ so-note + :: sends {msg} as an %app message to the user's inbox. + :: + ~/ %hall-so-note + |= msg/cord + ^+ +> + %+ so-act %phrase + :- [[our.bol %inbox] ~ ~] + [%app dap.bol %lin | msg]~ + :: + ++ so-delta + :: store delta in ++ta core. + :: + ~/ %hall-so-delta + |= det/delta + ^+ +> + +>(deltas [det deltas]) + :: + ++ so-deltas + :: store multiple deltas in ++ta core. + :: + ~/ %hall-so-deltas + |= des/(list delta) + %_(+> deltas (welp (flop des) deltas)) + :: + ++ so-delta-our + :: adds a delta about this story. + :: + ~/ %hall-so-delta-our + |= det/delta-story + ^+ +> + (so-delta %story nom det) + :: + ++ so-deltas-our + :: adds multiple deltas about this story. + :: + ~/ %hall-so-deltas-our + |= des/(list delta-story) + ^+ +> + %- so-deltas + %+ turn des + |= d/delta-story + [%story nom d] + :: + :: # + :: # %data + :: # + :: utility functions for data retrieval. + :: + ++ so-cir [our.bol nom] :: us as circle + :: + :: # + :: # %interaction-events + :: # + :: arms that apply events we received. + :: + ++ so-take + :: apply the prize as if it were rumors. + :: + ~/ %hall-so-take + |= {src/circle nes/(list envelope) cos/lobby pes/crowd} + ^+ +> + =. +>.$ + (so-hear | src %config src %full loc.cos) + =. +>.$ + =+ los=~(tap by loc.pes) + |- + ?~ los +>.^$ + =. +>.^$ + (so-hear | src %status src p.i.los %full q.i.los) + $(los t.los) + ::TODO ideally you'd just do this, but that runtime errors... + ::%- ~(rep in loc.pes) + ::|= {{w/ship s/status} _+>.$} + ::(so-hear | src %status src w %full s) + (so-unpack src nes) + :: + ++ so-hear + :: apply changes from a rumor to this story. + :: + ~/ %hall-so-hear + |= {bur/? src/circle rum/rumor-story} + ::TODO tall-form gate comments like this for everything? + ::|= $: :: bur: whether the story is inherited + :: :: src: story to change + :: :: rum: change to this story + :: :: + :: bur/? + :: src/circle + :: rum/rumor-story + :: == + ^+ +> + ?- -.rum + $bear (so-bear bur.rum) + $peer (so-delta-our rum) + $gram (so-open src nev.rum) + $remove ::TODO should also remove from {remotes}? + (so-delta-our %config src %remove ~) + :: + $new + ?: =(src so-cir) + (so-config-full ~ cof.rum) + $(rum [%config src %full cof.rum]) + :: + $config + :: we only subscribe to remotes' configs. + ?. =(src cir.rum) + ~! %unexpected-remote-config-from-remote + !! + =/ old/(unit config) + ?: =(cir.rum so-cir) `shape + (~(get by mirrors) cir.rum) + :: ignore if it won't result in change. + ?. ?| &(?=($remove -.dif.rum) ?=(^ old)) + ?=(~ old) + !=(u.old (change-config:hall-lib u.old dif.rum)) + == + +>.$ + :: full changes to us need to get split up. + ?: &(=(cir.rum so-cir) ?=($full -.dif.rum)) + (so-config-full `shape cof.dif.rum) + (so-delta-our rum) + :: + $status + :: we only subscribe to remotes' locals. + ?. |(=(src cir.rum) =(src so-cir)) + ~! %unexpected-remote-status-from-remote + !! + =/ old/(unit status) + ?: =(cir.rum so-cir) (~(get by locals) who.rum) + =- (~(get by -) who.rum) + (~(gut by remotes) cir.rum *group) + :: ignore if it won't result in change. + ?. ?| &(?=($remove -.dif.rum) ?=(^ old)) + ?=(~ old) + !=(u.old (change-status:hall-lib u.old dif.rum)) + == + +>.$ + (so-delta-our rum) + == + :: + ++ so-bear + :: accept burden + :: + :: add what was pushed down from above to our + :: state. in case of conflict, existing data is + :: overwritten. + :: + ::NOTE we don't use ++roll here because of urbit/arvo#447. + :: + ~/ %hall-so-bear + |= {gaz/(list telegram) cos/lobby pes/crowd} + ^+ +> + =* self +> + :: + :: local config + =. self + (so-config-full `shape loc.cos) + :: + :: remote config + =. self + =+ rem=~(tap by rem.cos) + |- ^+ self + ?~ rem self + =* wer p.i.rem + =* cof q.i.rem + :: only make a delta if it actually changed. + =? self !=(`cof (~(get by mirrors) wer)) + (so-delta-our %config wer %full cof) + $(rem t.rem) + :: + :: local status + =. self + =+ sas=~(tap by loc.pes) + |- ^+ self + ?~ sas self + =* who p.i.sas + =* sat q.i.sas + :: only make a delta if it actually changed. + =? deltas !=(`sat (~(get by locals) who)) + :_ deltas + :^ %story nom %status + [[our.bol nom] who %full sat] + $(sas t.sas) + :: + :: remote status + =. self + =+ rem=~(tap by rem.pes) + |- ^+ self + ?~ rem self + =* wer p.i.rem + =* gou q.i.rem + :: only make deltas if it actually changed. + =? deltas !=(`gou (~(get by remotes) wer)) + %+ welp deltas + =+ gop=~(tap by gou) + =+ hav=(~(gut by remotes) wer *group) + =| l/(list delta) + |- ^+ l + ?~ gop l + =* who p.i.gop + =* sat q.i.gop + :: only make a delta if it actually changed. + =? l !=(`sat (~(get by hav) who)) + [[%story nom %status wer who %full sat] l] + $(gop t.gop) + $(rem t.rem) + :: + :: telegrams + =. self + %_ self + deltas + %+ welp deltas + %- flop + ^- (list delta) + %+ murn gaz + |= t/telegram + ^- (unit delta) + :: in audience, replace above with us. + ::TODO this really should be done by the sender. + =. aud.t + =+ dem=[(above:hall-lib [our now our]:bol) nom] + ?. (~(has in aud.t) dem) aud.t + =+ (~(del in aud.t) dem) + (~(put in -) so-cir) + =+ num=(~(get by known) uid.t) + ?: &(?=(^ num) =(t (snag u.num grams))) ~ + ::TODO this really should have sent us the message + :: src as well but that's not an easy fix. + `[%story nom %gram [(above:hall-lib [our now our]:bol) nom] t] + == + :: inherited flag + %_(self deltas [[%story nom %inherited &] deltas]) + ::TODO runtime error + ::(so-delta-our %inherited &) + :: + :: # + :: # %changes + :: # + :: arms that make miscellaneous changes to this story. + :: + ++ so-present + :: accept status diff + ~/ %hall-so-present + |= {who/ship dif/diff-status} + ^+ +> + :: only have presence if you have write permission. + ?. |((so-admire who) ?=($remove -.dif)) +> + :: ignore if it won't result in change, + :: or if it sets an impersonating handle. + ?. ?: ?=($remove -.dif) (~(has by locals) who) + ?| !(~(has by locals) who) + :: + =+ old=(~(got by locals) who) + =+ new=(change-status:hall-lib - dif) + ?& !=(old new) + :: + ?= ~ + (rush (fall han.man.new '') ;~(pfix sig fed:ag)) + ::TODO calling with %+ gives syntax error + == + == + +> + (so-delta-our %status so-cir who dif) + :: + ++ so-config-full + :: split full config + :: + :: split a %full config delta up into multiple + :: smaller ones, for easier application. + :: + ~/ %hall-so-config-full + |= {old/(unit config) cof/config} + ^+ +> + ~? &(?=(^ old) !=(src.u.old src.cof)) + %maybe-missing-src-changes + %- so-deltas + =- %+ turn - + |= d/diff-config + [%story nom [%config so-cir d]] + ^- (list diff-config) + ::TODO figure out how to deal with src changes here. + :: %follow will probably behave a bit iffy in some cases. + ?~ old + :: if we have no previous config, all diffs apply. + :~ [%caption cap.cof] + [%usage & tag.cof] + [%filter fit.cof] + [%secure sec.con.cof] + [%permit & sis.con.cof] + [%read red.cof] + == + =- (murn - same) + ^- (list (unit diff-config)) + =* col u.old + :: if we have previous config, figure out the changes. + :~ ?: =(cap.col cap.cof) ~ + `[%caption cap.cof] + :: + =+ gon=(~(dif in tag.col) tag.cof) + ?~ gon ~ + `[%usage | gon] + :: + =+ new=(~(dif in tag.cof) tag.col) + ?~ new ~ + `[%usage & new] + :: + ?: =(fit.col fit.cof) ~ + `[%filter fit.cof] + :: + ?: =(sec.con.col sec.con.cof) ~ + `[%secure sec.con.cof] + :: + =+ gon=(~(dif in sis.con.col) sis.con.cof) + ?~ gon ~ + `[%permit | gon] + :: + =+ new=(~(dif in sis.con.cof) sis.con.col) + ?~ new ~ + `[%permit & new] + == + :: + ++ so-sources + :: change source + :: + :: adds or removes {srs} from our sources, + :: skipping over ones we already (don't) have. + :: + ~/ %hall-so-sources + |= {add/? srs/(set source)} + ^+ +> + =/ sus/(set source) + %. src.shape + ?:(add ~(dif in srs) ~(int in srs)) + :: we only make a delta for removals here, + :: because we don't need to wait for ++reap when + :: pulling subscriptions. + =? +>.$ !add + =+ sos=~(tap in sus) + |- ^+ +>.^$ + ?~ sos +>.^$ + =. +>.^$ (so-delta-our %config so-cir %source | i.sos) + $(sos t.sos) + ::TODO ideally below, but unexplained runtime error at `so-delta-our` + ::%+ roll ~(tap in sus) + ::|= {src/source _+>.$} + ::^+ +>.^$ + ::(so-delta-our %config so-cir %source | src) + ?~ sus +>.$ + (so-delta-our %follow add sus) + :: + ++ so-depict + :: change description + :: + :: modifies our caption. + :: + ~/ %hall-so-depict + |= cap/cord + ^+ +> + ?: =(cap cap.shape) +> + (so-delta-our %config so-cir %caption cap) + :: + ++ so-usage + :: add or remove usage tags. + :: + ~/ %hall-so-usage + |= {add/? tas/tags} + ^+ +> + =/ sas/tags + %. tag.shape + ?:(add ~(dif in tas) ~(int in tas)) + ?~ sas +>.$ + (so-delta-our %config so-cir %usage add sas) + :: + ++ so-read + :: set the read message number in circle config + ~/ %hall-so-read + |= {red/@ud} + ^+ +> + ?: =(red red.shape) +> + (so-delta-our %config so-cir %read red) + :: + ++ so-filter + :: change message rules + :: + :: modifies our filter. + :: + ~/ %hall-so-filter + |= fit/filter + ^+ +> + ?: =(fit fit.shape) +> + (so-delta-our %config so-cir %filter fit) + :: + ++ so-delete + :: delete story + :: + :: deletes this story. removes it from {stories} + :: and unsubscribes from all src. + :: + (so-delta-our %remove ~) + :: + :: # + :: # %subscriptions + :: # + :: arms for starting and ending subscriptions + :: + ++ so-greet + :: subscription started + :: + :: store a started subscription as source. + :: + ~/ %hall-so-greet + |= src/source + ^+ +> + ?: (~(has in src.shape) src) +> + (so-delta-our %config so-cir %source & src) + :: + ++ so-leave + :: subscription ended + :: + :: delete {src} from our sources. + :: + ~/ %hall-so-leave + |= src/source + ^+ +> + ?. (~(has in src.shape) src) +> + (so-delta-our %config so-cir %source | src) + :: + ++ so-resub + :: subscription revived + :: + :: re-subscribe to a dropped subscription. + :: if it was already active, we continue where + :: we left off. + :: + ~/ %hall-so-resub + |= src/source + ^+ +> + =+ seq=(~(get by sequence) cir.src) + =/ ner/range + ?~ seq ran.src + =- `[[%ud u.seq] -] + ?~ ran.src ~ + tal.u.ran.src + :: if our subscription changes or ends, remove + :: the original source. + =? +>.$ !=(ner ran.src) + (so-delta-our %config so-cir %source | src) + :: if we're past the range, don't resubscribe. + ?: ?& ?=(^ ran.src) + ?=(^ tal.u.ran.src) + :: + ?- -.u.tal.u.ran.src + $sd & + $da (gte now.bol +.u.tal.u.ran.src) + $ud ?& ?=(^ seq) + (gte u.seq +.u.tal.u.ran.src) + == + == + == + +>.$ + (so-delta-our %follow & [[cir.src -] ~ ~]) + :: + ++ so-first-grams + :: beginning of stream + :: + :: find all grams that fall within the range. + :: + ~/ %hall-so-first-grams + |= ran/range + ^- (list telegram) + =+ [num=0 gaz=grams zeg=*(list telegram)] + :: fill in empty ranges to select all grams, + :: and calculate absolutes for relative places. + =. ran + ?~ ran `[[%ud 0] `[%ud count]] + =* hed hed.u.ran + =? hed ?=($sd -.hed) + [%ud (sub count (min count (abs:si +.hed)))] + ?~ tal.u.ran `[hed `[%ud count]] + =* tal u.tal.u.ran + =? tal ?=($sd -.tal) + [%ud (sub count (min count (abs:si +.tal)))] + ran + :: never fails, but compiler needs it. + ?> &(?=(^ ran) ?=(^ tal.u.ran)) + =* hed hed.u.ran + =* tal u.tal.u.ran + %- flop + |- ^- (list telegram) + ?~ gaz zeg + ?: ?- -.u.tal.u.ran :: after the end + $ud (lth +.u.tal.u.ran num) + $da (lth +.u.tal.u.ran wen.i.gaz) + $sd !! :: caught above + == + :: if past the range, we're done searching. + zeg + ?: ?- -.hed.u.ran :: before the start + $ud (lth num +.hed.u.ran) + $da (lth wen.i.gaz +.hed.u.ran) + $sd !! :: caught above + == + :: if before the range, continue onward. + $(num +(num), gaz t.gaz) + :: if in the range, add this gram and continue. + $(num +(num), gaz t.gaz, zeg [i.gaz zeg]) + :: + ++ so-in-range + :: place in range? + :: + :: produces two booleans: whether we're + :: currently in the range, and whether the range + :: has passed. + ::TODO to deal with changed messages, we'll want + :: to be able to pass in a num. + :: + ~/ %hall-so-in-range + |= ran/range + ^- {in/? done/?} + ?~ ran [& |] + =/ min + ?- -.hed.u.ran + $sd & :: relative is always in. + $ud (gth count +.hed.u.ran) + $da (gth now.bol +.hed.u.ran) + == + ?~ tal.u.ran + [min |] + =- [&(min -) !-] + ?- -.u.tal.u.ran + $sd | :: relative is always done. + $ud (gte +(+.u.tal.u.ran) count) + $da (gte +.u.tal.u.ran now.bol) + == + :: + :: # + :: # %messaging + :: # + :: arms for adding to this story's messages. + :: + ++ so-sane + :: sanitize %lin speech according to our settings. + :: + ~/ %hall-so-sane + |= sep/speech + ^- speech + ?+ -.sep sep + ?($ire $fat $app) + sep(sep $(sep sep.sep)) + :: + $lin + =- sep(msg -) + %- crip + %- tufa + %+ turn (tuba (trip msg.sep)) + |= a/@c + :: always replace control characters. + ?: |((lth a 32) =(a `@c`127)) + `@`'?' + :: if desired, remove uppercasing. + ?: ?& !cas.fit.shape + (gte a 'A') + (lte a 'Z') + == + (add a 32) + :: if desired, replace non-ascii characters. + ?: ?& !utf.fit.shape + (gth a 127) + == + `@`'?' + a + == + :: + ++ so-unpack + :: process envelopes + :: + :: learn telegrams from list of envelopes and + :: update the sequence of the source if needed. + :: + ~/ %hall-so-unpack + |= {src/circle nes/(list envelope)} + ^+ +> + =. +> (so-lesson src (turn nes tail)) + =/ num + %+ roll nes + |= {nev/envelope max/@ud} + ?:((gth num.nev max) num.nev max) + ?. (gth num (~(gut by sequence) src 0)) + +>.$ + (so-delta-our %sequent src num) + :: + ++ so-open + :: process envelope + :: + :: learn telegram from envelope and update the + :: sequence of the source if needed. + :: + ~/ %hall-so-open + |= {src/circle nev/envelope} + ^+ +> + =. +> (so-learn src gam.nev) + ?. (gth num.nev (~(gut by sequence) src 0)) + +> + (so-delta-our %sequent src num.nev) + :: + ++ so-lesson + :: learn all telegrams in a list. + :: + ~/ %hall-so-lesson + |= {src/circle gaz/(list telegram)} + ^+ +> + ?~ gaz +> + $(gaz t.gaz, +> (so-learn src i.gaz)) + :: + ++ so-learn + :: save/update message + :: + :: store an incoming telegram, updating if it + :: already exists. + :: + ~/ %hall-so-learn + |= {src/circle gam/telegram} + ^+ +> + :: check for write permissions. + ::TODO we want to !! instead of silently failing, + :: so that ++coup-repeat of the caller gets + :: an error. but the caller may not be the + :: author. if we check for that to be true, + :: can we guarantee it's not an older message + :: getting resent? does that matter? think. + ?. (so-admire aut.gam) +> + :: clean up the message to conform to our rules. + =. sep.gam (so-sane sep.gam) + :: + =. gam (filter-gram gam bol) + :: if we already have it, ignore. + =+ old=(~(get by known) uid.gam) + ?. &(?=(^ old) =(gam (snag u.old grams))) + (so-delta-our %gram src gam) + =+ sed=(~(get by sourced) src) + ?: |(?=(~ sed) ?=(~ (find [u.old]~ u.sed))) + (so-delta-our %sourced src u.old) + +>.$ + :: + :: # + :: # %permissions + :: # + :: arms relating to story permissions. + :: + ++ so-permit + :: invite/banish + :: + :: update config to dis/allow ships permission. + :: + ~/ %hall-so-permit + |= {inv/? sis/(set ship)} + ^+ +> + :: wyt: whitelist? + :: add: add to list? + =/ wyt/? ?=(?($village $journal) sec.con.shape) + =/ add/? =(inv wyt) + =/ sus/(set ship) + %. sis.con.shape + ?:(add ~(dif in sis) ~(int in sis)) + ?~ sus +>.$ + :: if banished, remove their presences. + =? +>.$ !inv + %- so-deltas-our + %+ turn ~(tap in `(set ship)`sus) + |= s/ship + :+ %status so-cir + [s %remove ~] + (so-delta-our %config so-cir %permit [add sus]) + :: + ++ so-admire + :: accept from + :: + :: checks {her} write permissions. + :: + ~/ %hall-so-admire + |= her/ship + ^- ? + ?- sec.con.shape + $channel !(~(has in sis.con.shape) her) :: blacklist + $village (~(has in sis.con.shape) her) :: whitelist + $journal (~(has in sis.con.shape) her) :: author whitelist + $mailbox !(~(has in sis.con.shape) her) :: author blacklist + $custom :: custom rule + =/ rul/$-({ship ?($r $w) bowl:mall} ?) + (~(gut by custom-rules) nom |=(* |)) + (rul her %w bol) + == + :: + ++ so-visible + :: checks {her} read permissions. + :: + ~/ %hall-so-visible + |= her/ship + ^- ? + ?- sec.con.shape + $channel !(~(has in sis.con.shape) her) :: blacklist + $village (~(has in sis.con.shape) her) :: whitelist + $journal & :: all + $mailbox (team:title our.bol her) :: our team + $custom :: custom rule + =/ rul/$-({ship ?($r $w) bowl:mall} ?) + (~(gut by custom-rules) nom |=(* |)) + (rul her %r bol) + == + -- + -- +:: +++ da + :: delta application + :: + :: core for doing things, mostly applying deltas to + :: application state, but also dealing with events + :: that aren't pokes. + :: where appropriate, creates cards. those get + :: produced when finalizing with ++da-done. + :: + ~/ %hall-da + |_ :: cards: cards created by core operations. + :: + cards/(list card) + :: # %resolve + :: + ++ da-done + :: resolve core + :: + :: produces the cards stored in ++da's cards. + :: they are produced in reverse order because + :: ++da-emil and ++da-emit add them to the head of + :: the {cards}. + :: + ^- (quip card _+>) + [(flop cards) +>] + :: + :: # + :: # %emitters + :: # + :: arms that create outward changes. + :: + ++ da-emil + :: emit card list + :: + :: adds multiple cards to the head of {cards}. + :: flops to stay consistent with ++ta-emit. + :: + ~/ %hall-da-emil + |= mol/(list card) + %_(+> cards (welp (flop mol) cards)) + :: + ++ da-emit + :: emit a card + :: + :: adds a card to the head of {cards}. + :: + ~/ %hall-da-emit + |= mov/card + %_(+> cards [mov cards]) + :: + ++ da-present + :: send %present cmd + :: + ~/ %hall-da-present + |= {hos/ship nos/(set name) dif/diff-status} + ^+ +> + %- da-emit + :* %pass + /present + %agent + [hos dap.bol] + %poke + %hall-command + !>([%present nos dif]) + == + :: + :: # + :: # %change-application + :: # + :: arms that change the application state. + :: + ++ da-change + :: apply delta + :: + :: modifies application state according to the + :: change specified in {dif}. + :: + ~/ %hall-da-change + |= det/delta + ^+ +> + ?- -.det + $public (da-change-public +.det) + $out (da-change-out +.det) + $done (da-change-done +.det) + $glyph (da-change-glyph +.det) + $nick (da-change-nick +.det) + $story (da-change-story +.det) + $init da-init + $observe (da-observe +.det) + $present (da-present +.det) + == + :: + ++ da-init + :: startup side-effects + :: + :: apply %init delta, querying the /burden of the + :: ship above us. + :: + (da-emit (wire-to-peer /burden)) + :: + ++ da-observe + :: watch burden bearer + :: + :: apply %observe delta, querying the /report of + :: {who} below us. + :: + ~/ %hall-da-observe + |= who/ship + (da-emit (wire-to-peer /report/(scot %p who))) + :: + ++ da-change-public + :: show/hide membership + :: + :: add/remove a circle to/from the public + :: membership list. + :: + ~/ %hall-da-change-public + |= {add/? cir/circle} + ^+ +> + =- +>.$(public -) + ?: add (~(put in public) cir) + (~(del in public) cir) + :: + ++ da-change-out + :: outgoing messages + :: + :: apply an %out delta, sending a message. + :: + ~/ %hall-da-change-out + |= {cir/circle out/(list thought)} + ^+ +> + =+ ses=(turn out head) + =. outbox + :: for every serial, add %pending state. + %+ roll ses + |= {s/serial o/_outbox} + =? o ?=(~ o) outbox + =+ t=(~(gut by o) s *tracking) + %+ ~(put by o) s + (~(put by t) cir %pending) + %- da-emit + :* %pass + /repeat/(scot %p hos.cir)/[nom.cir]/(scot %ud (jam ses)) + %agent + [hos.cir dap.bol] + %poke + %hall-command + !>([%publish out]) + == + :: + ++ da-change-done + :: delivered messages + :: + :: apply a %done delta, setting new delivery state + :: for messages. + :: + ~/ %hall-da-change-done + |= {cir/circle ses/(list serial) res/delivery} + ^+ +> + %_ +> + outbox + :: for every serial, set new delivery state. + %- ~(gas by outbox) + %+ turn ses + |= s/serial + :- s + %+ ~(put by (~(got by outbox) s)) + cir res + == + :: + ++ da-change-glyph + :: un/bound glyph + :: + :: apply a %glyph delta, un/binding a glyph to/from + :: an audience. + :: + ~/ %hall-da-change-glyph + |= {bin/? gyf/char aud/audience} + ^+ +> + ?: bin + %_ +> + binds (~(put ju binds) gyf aud) + == + =/ ole/(list audience) + ?. =(aud ~) [aud ~] + ~(tap in (~(get ju binds) gyf)) + |- ^+ +>.^$ + ?~ ole +>.^$ + %_ $ + binds (~(del ju binds) gyf i.ole) + ole t.ole + == + :: + ++ da-change-nick + :: changed nickname + :: + :: apply a %nick delta, setting a nickname for a + :: ship. + :: + ~/ %hall-da-change-nick + |= {who/ship nic/nick} + ^+ +> + +>(nicks (change-nicks:hall-lib nicks who nic)) + :: + :: # + :: # %stories + :: # + :: arms for modifying stories. + :: + ++ da-change-story + :: apply circle delta + :: + :: apply a %story delta, redirecting the delta + :: itself to ++sa-change. + :: in case of a new or deleted story, specialized + :: arms are called. + :: + ~/ %hall-da-change-story + |= {nom/name det/delta-story} + ^+ +> + ?+ -.det + =< sa-done + %. det + =+ (~(gut by stories) nom *story) + ~(sa-change sa nom -) + :: + $new (da-create nom +.det) + $bear ~&(%unexpected-unsplit-bear +>) + $remove (da-delete nom) + == + :: + ++ da-create + :: configure story + :: + :: creates story {nom} with config {con}. + :: + ~/ %hall-da-create + |= {nom/name cof/config} + ^+ +> + =< sa-done + %- ~(sa-change sa nom *story) + [%config [our.bol nom] %full cof] + :: + ++ da-delete + :: delete story + :: + :: calls the story core to delete story {nom}. + :: + ~/ %hall-da-delete + |= nom/name + ^+ +> + =. +> + %- da-emil + ~(sa-delete sa nom (~(got by stories) nom)) + +>(stories (~(del by stories) nom)) + :: + ++ sa + :: story delta core + :: + :: story core, used for doing work on a story. + :: + ~/ %hall-sa + |_ :: nom: story name in {stories}. + :: story is faceless to ease data access. + :: + $: nom/name + story + == + :: # %resolve + :: + ++ sa-done + :: apply changes + :: + :: put changed story back into the map. + :: + +>(stories (~(put by stories) nom +<+)) + :: + :: # + :: # %emitters + :: # + :: arms that create outward changes. + :: + ++ sa-emil + :: emit card list + :: + :: adds multiple cards to the head of {cards}. + :: flops to stay consistent with ++ta-emit. + :: + ~/ %hall-sa-emil + |= mol/(list card) + %_(+> cards (welp (flop mol) cards)) + :: + ++ sa-emit + :: emit a card + :: + :: adds a card to the head of {cards}. + :: + ~/ %hall-sa-emit + |= mov/card + %_(+> cards [mov cards]) + :: + ++ sa-sauce + :: cards to cards. + :: + ~/ %hall-sa-sauce + |= cub/(list card) + ^- (list card) + (flop cub) + :: + :: # + :: # %data + :: # + :: utility functions for data retrieval. + :: + ++ sa-cir [our.bol nom] + :: + :: # + :: # %delta-application + :: # + :: arms for applying deltas. + :: + ++ sa-delete + :: deletion of story + :: + :: apply a %remove story delta, unsubscribing + :: this story from all its active sources. + :: + %+ weld + (sa-abjure src.shape) + (sa-eject ~(key by peers)) + :: + ++ sa-change + :: apply circle delta + :: + :: figure out whether to apply a %story delta to + :: local or remote data. + :: + ~/ %hall-sa-change + |= det/delta-story + ^+ +> + %. det + ?: ?& ?=(?($config $status) -.det) + !=(cir.det sa-cir) + == + sa-change-remote + sa-change-local + :: + ++ sa-change-local + :: apply our delta + :: + :: apply a %story delta to local data. + :: + ~/ %hall-sa-change-local + |= det/delta-story + ^+ +> + ?+ -.det + ~&([%unexpected-delta-local -.det] !!) + :: + $inherited + +>(inherited ihr.det) + :: + $peer + ?: add.det + +>(peers (~(add ja peers) who.det qer.det)) + =+ qes=(~(get ja peers) who.det) + =. qes + =+ res=(find ~[qer.det] qes) + ?~ res qes + (oust [u.res 1] qes) + ?~ qes +>.$(peers (~(del by peers) who.det)) + +>.$(peers (~(put in peers) who.det qes)) + :: + $follow + (sa-emil (sa-follow-effects sub.det srs.det)) + :: + $sequent + +>(sequence (~(put by sequence) cir.det num.det)) + :: + $gram + (sa-change-gram +.det) + :: + $sourced + (sa-add-gram-source +.det) + :: + $config + =. +> + %- sa-emil + (sa-config-effects shape dif.det) + +>(shape (change-config:hall-lib shape dif.det)) + :: + $status + %_ +> + locals + ?: ?=($remove -.dif.det) + (~(del by locals) who.det) + %+ ~(put by locals) who.det + %+ change-status:hall-lib + (~(gut by locals) who.det *status) + dif.det + == + == + :: + ++ sa-add-gram-source + :: remember message source + :: + :: if it's not already known, make note of the + :: fact that message {num} was heard from {src}. + :: + ~/ %hall-sa-add-gram-source + |= {src/circle num/@ud} + ^+ +> + =- +>.$(sourced -) + =+ sed=(~(gut by sourced) src ~) + ?^ (find ~[num] sed) sourced + (~(put by sourced) src [num sed]) + :: + ++ sa-change-gram + :: save/update message + :: + :: apply a %gram delta, either appending or + :: updating a message. + :: + ~/ %hall-sa-change-gram + |= {src/circle gam/telegram} + ^+ +> + ::TODO move "known" logic up into ++so? that way, + :: we can attach message numbers to changes. + =+ old=(~(get by known) uid.gam) + ?~ old + :: new message + %. [src count] + %_ sa-add-gram-source + grams (welp grams [gam ~]) + count +(count) + known (~(put by known) uid.gam count) + == + :: changed message + %. [src u.old] + %_ sa-add-gram-source + grams %+ welp + (scag u.old grams) + [gam (slag +(u.old) grams)] + == + :: + ++ sa-change-remote + :: apply remote's delta + :: + :: apply a story diff to remote data. + :: + ~/ %hall-sa-change-remote + |= det/delta-story + ^+ +> + ?+ -.det + ~&([%unexpected-delta-remote -.det] !!) + :: + $config + ?: ?=($remove -.dif.det) + +>(mirrors (~(del by mirrors) cir.det)) + =/ new/config + %+ change-config:hall-lib + (~(gut by mirrors) cir.det *config) + dif.det + +>.$(mirrors (~(put by mirrors) cir.det new)) + :: + $status + %_ +>.$ + remotes + %+ ~(put by remotes) cir.det + =+ ole=(~(gut by remotes) cir.det *group) + ?: ?=($remove -.dif.det) (~(del by ole) who.det) + =+ old=(~(gut by ole) who.det *status) + (~(put by ole) who.det (change-status:hall-lib old dif.det)) + == + == + :: + ++ sa-config-effects + :: apply side-effects for a %config delta. + :: + ~/ %hall-sa-change-effects + |= {old/config dif/diff-config} + ^- (list card) + ?+ -.dif ~ + $permit (sa-permit-effects sec.con.old sis.con.old +.dif) + ::NOTE when doing a lone %secure, calculate the + :: necessary %permit deltas alongside it. + == + :: + ++ sa-follow-effects + :: un/subscribe + :: + :: apply side-effects for a %follow delta, + :: un/subscribing this story to/from {cos}. + :: + ~/ %hall-sa-follow-effects + |= {sub/? srs/(set source)} + ^- (list card) + %. srs + ?:(sub sa-acquire sa-abjure) + :: + ++ sa-permit-effects + :: notify permitted + :: + :: apply side-effects for a %permit delta, + :: kicking the subscriptions of {sis} if they + :: are being banished. + :: + ~/ %hall-sa-permit-effects + |= {sec/security old/(set ship) add/? sis/(set ship)} + ^- (list card) + =/ wyt ?=(?($village $journal) sec) + =/ inv =(wyt add) + ?: inv ~ + =/ sus/(set ship) + %. sis.con.shape + ?:(add ~(dif in sis) ~(int in sis)) + (sa-eject sus) + :: + :: # + :: # %subscriptions + :: # + :: arms for starting and ending subscriptions + :: + ++ sa-acquire + :: subscribes this story to each circle. + :: + ~/ %hall-sa-aquire + |= srs/(set source) + =- (murn - same) + %+ turn ~(tap in srs) + |= {cir/circle ran/range} + ^- (unit card) + ?: =(cir sa-cir) ~ :: ignore self-subs + =+ wat=~[%grams %config-l %group-l] + `(wire-to-peer (circle-wire nom wat cir ran)) + :: + ++ sa-abjure + :: unsubscribes this story from each circle. + :: + ~/ %hall-sa-abjure + |= srs/(set source) + ^- (list card) + %+ turn ~(tap in srs) + |= {cir/circle ran/range} + ^- card + =/ wir + %^ circle-wire nom + ~[%grams %config-l %group-l] + [cir ran] + [%pass wir %agent [hos.cir dap.bol] %unsubscribe ~] + :: + ++ sa-eject + :: removes ships {sis} from {followers}. + :: + ~/ %hall-sa-eject + |= sis/(set ship) + ^- (list card) + %- zing + %+ turn ~(tap in sup.bol) + |= {d/duct s/ship p/path} + ^- (list card) + ?. ?& (~(has in sis) s) + ?=({$circle @tas *} p) + =(i.t.p nom) + == + ~ + ~& > %gentle-3 + (gentle-quit s p) + -- +-- +:: +:: +:: # +:: # %wire-utility +:: # +:: +++ circle-wire + :: /circle peer wire + :: + :: constructs a /circle %peer path for subscribing + :: {nom} to a source. + :: + ~/ %hall-circle-wire + |= {nom/name wat/(list circle-data) source} + ^- wire + ;: weld + /circle/[nom]/(scot %p hos.cir)/[nom.cir] + (sort wat gth) :: consistence + (range-to-path:hall-lib ran) + == +:: +++ wire-to-peer + :: peer card from wire + :: + :: builds the peer card associated with the wire. + :: + ~/ %hall-wire-to-peer + |= wir/wire + ^- card + =+ tar=(wire-to-target wir) + [%pass wir %agent [p.tar dap.bol] %subscribe q.tar] +:: +++ wire-to-target + :: ship+path from wire + :: + :: parses {wir} to obtain the target ship and the + :: query path. + :: + ~/ %hall-wire-to-target + |= wir/wire + ^- (pair ship path) + ?+ wir ~&(wir !!) + {$circle @ @ *} + :- (slav %p i.t.t.wir) + (welp /circle t.t.t.wir) + :: + {$burden *} + :- (above:hall-lib [our now our]:bol) + /burden/(scot %p our.bol) + :: + {$report @ *} + :- (slav %p i.t.wir) + /report + == +:: +++ etch + :: parse wire + :: + :: parses {wir} to obtain either %circle with story + :: and circle or %repeat with message number, source + :: ship, story and serials. + :: + ~/ %hall-etch + |= wir/wire + ^- weir + ?+ wir !! + {$circle @ @ @ *} + :: $circle, us, host, target + :^ %circle + i.t.wir + [(slav %p i.t.t.wir) i.t.t.t.wir] + (path-to-range:hall-lib t.t.t.t.wir) + :: + {$repeat @ @ @ ~} + :+ %repeat + [(slav %p i.t.wir) i.t.t.wir] + ((list serial) (cue (slav %ud i.t.t.t.wir))) + == +:: +++ etch-circle + :: parse /circle wire + :: + :: parses a /circle wire, call a gate with the + :: result. + :: + ~/ %hall-etch-circle + |= $: wir/wire + $= fun + $- {nom/name src/source} + {(list card) _.} + == + =+ wer=(etch wir) + ?>(?=($circle -.wer) (fun nom.wer src.wer)) +:: +++ etch-repeat + :: parses a /repeat wire, call gate with the result. + :: + ~/ %hall-etch-repeat + |= $: wir/wire + $= fun + $- {cir/circle ses/(list serial)} + {(list card) _.} + == + =+ wer=(etch wir) + ?>(?=($repeat -.wer) (fun cir.wer ses.wer)) +:: +++ gentle-quit + :: quit other, pull us + :: + :: we want to gently pull our own subscriptions, + :: rather than quitting them, so that we may + :: differentiate between a gall/ames quit and a + :: foreign quit. but since wex.bol isn't filled, + :: we'll have to just guess at what the correct wire + :: wire is. this is truly terrible, but will have to + :: do for now. + ::TODO get rid of this once gall improves. + :: it needs to tell us the difference between + :: an app-caused quit and a queue-caused one. + :: (aka connected/disconnected/rejected state) + :: + ~/ %hall-gentle-quit + |= {who/ship pat/path} + ^- (list card) + =/ qer=query (path-to-query pat) + ?. ?=($circle -.qer) ~ + ?. =(who our.bol) [%give %subscription-close `pat `who]~ + %- zing + %+ turn ~(tap in ~(key by stories)) + |= n/name + ^- (list card) + :~ :* %pass / + %agent [our.bol dap.bol] + %poke %hall-action + !>([%source n | [[[our.bol nom.qer] ran.qer] ~ ~]]) + == + :: + :* %pass + %^ circle-wire n ~(tap in wat.qer) + [[our.bol nom.qer] ran.qer] + %agent + [our.bol dap.bol] + %unsubscribe + ~ + == + == +:: +:: # +:: # %new-events +:: # +++ bake + :: apply state delta + :: + :: applies a change to the application state, + :: producing side-effects. + :: + ~/ %hall-bake + |= det/delta + ^- (quip card _+>) + da-done:(da-change:da det) +:: +++ pre-bake + :: apply more deltas + :: + ~/ %hall-pre-bake + |= des/(list delta) + ^- (quip card _+>) + =| moz/(list card) + |- ^- (quip card _+>.^$) + ?~ des [moz +>.^$] + =^ mos +>.^$ (bake i.des) + $(moz :(welp moz mos (affection i.des)), des t.des) + ::TODO ideally you'd just do this, but that runtime errors on "bake"... + ::%+ roll des + ::|= {d/delta m/(list card) _+>.$} + ::=^ mos +>.^$ (bake d) + ::[:(welp m mos (affection d)) +>.^$] +:: +++ peek + ~/ %hall-peek + |= pax/path + ?> ?=({$x *} pax) :: others unsupported. + ^- (unit (unit (pair mark vase))) + =+ piz=(look (path-to-query t.pax)) + ?~ piz ~ + ?~ u.piz [~ ~] + ``[%hall-prize !>(u.u.piz)] +:: +++ look + :: query on state + :: + :: find the result (if any) for a given query. + :: + ~/ %hall-look + |= qer/query + ^- (unit (unit prize)) + ?- -.qer + $client + ``[%client binds nicks] + :: + $circles + =- ``[%circles -] + %- ~(gas in *(set name)) + %+ murn ~(tap by stories) + |= {n/name s/story} + ^- (unit name) + ?:((~(so-visible so:ta n ~ s) who.qer) `n ~) + :: + $public + ``[%public public] + :: + $burden + :+ ~ ~ + :- %burden + %- ~(gas in *(map name burden)) + %+ murn ~(tap by stories) + |= {n/name s/story} + ^- (unit (pair name burden)) + :: don't federate channels + ~ + :: only auto-federate channels for now. + ::?. ?=($channel sec.con.shape.s) ~ + :::+ ~ n + :::: share no more than the last 100, for performance reasons. + :::+ ?: (lte count.s 100) grams.s + :: (slag (sub count.s 100) grams.s) + :: [shape.s mirrors.s] + ::[locals.s remotes.s] + :: + $report + ::TODO gall note: need to be able to subscirbe to just changes... or just + :: data etc. + ``[%report ~] + :: + $peers + =+ soy=(~(get by stories) nom.qer) + ?~ soy ~ + ``[%peers peers.u.soy] + :: + $circle ::REVIEW should we send precs & config to out of range subs? + =+ soy=(~(get by stories) nom.qer) + ?~ soy ~ + :+ ~ ~ + :- %circle + :+ ?. (~(has in wat.qer) %grams) ~ + %+ turn + =- (~(so-first-grams so:ta nom.qer ~ -) ran.qer) + ::TODO this can be done more efficiently. + ?~ wer.qer u.soy + =- u.soy(grams -, count (lent -)) + ?. (~(has by sourced.u.soy) u.wer.qer) ~ + %+ turn + %- flop + (~(got by sourced.u.soy) u.wer.qer) + |= n/@ud + (snag n grams.u.soy) + (cury gram-to-envelope nom.qer) + :- shape.u.soy + ?. (~(has in wat.qer) %config-r) ~ + mirrors.u.soy + :- locals.u.soy + ?. (~(has in wat.qer) %group-r) ~ + remotes.u.soy + == +:: +++ dedicate + :: rumor-story to theirs + :: + :: modify a %story diff to make it about their ship + :: instead of ours. + :: + ~/ %hall-dedicate + |= {who/ship nom/name det/delta-story} + ^- rumor-story + ?+ -.det det + :: + :: internal-only changes. + $follow !! + $inherited !! + $sequent !! + $sourced !! + :: + $gram + :+ %gram + ?. =(src.det [our.bol nom]) + src.det + [who nom] + %+ gram-to-envelope nom + %_ gam.det + aud + %- ~(run in aud.gam.det) + |= c/circle + ?. =(c [our.bol nom]) c + [who nom] + == + :: + $config + ?. =(cir.det [our.bol nom]) + det + det(cir [who nom]) + :: + $status + ?. =(cir.det [our.bol nom]) + det + det(cir [who nom]) + == +:: +++ gram-to-envelope + :: wrap gram with nr + :: + :: deduce the initial msg number from a telegram + :: for a given story. assumes both story and + :: telegram are known. + :: + ~/ %hall-gram-to-envelope + |= {nom/name gam/telegram} + ^- envelope + :_ gam + %. uid.gam + ~(got by known:(~(got by stories) nom)) +:: +++ circle-feel-story + :: + ~/ %hall-circle-feel-story + |= $: wer/(unit circle) + wat/(set circle-data) + nom/name + det/delta-story + == + ^- ? + ?& + ?~ wer & + ?+ -.det & + $gram =(src.det u.wer) + $config =(cir.det u.wer) + $status =(cir.det u.wer) + == + :: + ?: =(wat ~) & + ?+ -.det | + $gram (~(has in wat) %grams) + $new (~(has in wat) %config-l) + $remove (~(has in wat) %config-l) + $config ?: =(cir.det [our.bol nom]) + (~(has in wat) %config-l) + (~(has in wat) %config-r) + $status ?: =(cir.det [our.bol nom]) + (~(has in wat) %group-l) + (~(has in wat) %group-r) + == + == +:: +++ feel + :: delta to rumor + :: + :: if the given delta changes the result of the given + :: query, produce the relevant rumor. + :: + ~/ %hall-feel + |= {qer/query det/delta} + ^- (unit rumor) + ?- -.qer + $client + :: changes to shared ui state apply. + ?+ -.det ~ + $glyph `[%client det] + $nick `[%client det] + == + :: + $circles + ::NOTE this is another case where having access to + :: the pre-delta state would be nice to have. + ?. ?=($story -.det) ~ + =; add/(unit ?) + ?~ add ~ + `[%circles u.add nom.det] + ::REVIEW this could be considered leaky, since it + :: doesn't check if {who} ever knew of {nom}, + :: but does that matter? can't really check.. + :: if the story got deleted, remove it from the circles listing. + ?: ?=($remove -.det.det) `| + =+ soy=(~(got by stories) nom.det) + :: if the story got created, or something about the read permissions set + :: for the subscriber changed, update the circles listing. + =; dif/? + ?. dif ~ + :: if the story just got created, don't send a remove rumor, because it + :: never showed up in the first place. + =- ?:(&(?=($new -.det.det) !-) ~ `-) + ?| (team:title our.bol who.qer) + (~(so-visible so:ta nom.det ~ soy) who.qer) + == + ?| ?=($new -.det.det) + :: + ?& ?=($config -.det.det) + ?=($permit -.dif.det.det) + ?=(?($channel $village) sec.con.shape.soy) + (~(has in sis.dif.det.det) who.qer) + == + == + :: + $public + ?. ?=($public -.det) ~ + `det + :: + $burden + ?. ?=($story -.det) ~ + ?: &(=(who.qer src.bol) =(rir /report/(scot %p src.bol))) ~ + ?: ?=(?($follow $inherited $sequent $sourced) -.det.det) ~ + :: only burden channels for now. + ?. (~(has by stories) nom.det) ~ + ?. =(%channel sec.con.shape:(~(got by stories) nom.det)) ~ + `[%burden nom.det (dedicate who.qer nom.det det.det)] + :: + $report + :: only send changes we didn't get from above. + ?: =(src.bol (above:hall-lib [our now our]:bol)) ~ + :: only send story reports about grams and status. + ?. ?=($story -.det) ~ + ?. ?=(?($gram $status) -.det.det) ~ + =+ soy=(~(got by stories) nom.det) + :: and only if the story is inherited. + ?. inherited.soy ~ + :: only burden channels for now. + ?. =(%channel sec.con.shape.soy) ~ + `[%burden nom.det (dedicate (above:hall-lib [our now our]:bol) nom.det det.det)] + :: + $peers + ?. ?=($story -.det) ~ + ?. =(nom.qer nom.det) ~ + ?. ?=($peer -.det.det) ~ + `[%peers +.det.det] + :: + $circle + ?. ?=($story -.det) ~ + ?. =(nom.qer nom.det) ~ + ?. %- circle-feel-story + [wer.qer wat.qer nom.det det.det] ~ + ?. ?| ?=($remove -.det.det) + :: + =< in %. ran.qer + =+ soy=(~(got by stories) nom.qer) + ~(so-in-range so:ta nom.qer ~ soy) + == + ~ + ?. ?=(?($gram $new $config $status $remove) -.det.det) ~ + :+ ~ %circle + ?+ det.det det.det + {$gram *} + :+ %gram src.det.det + (gram-to-envelope nom.det gam.det.det) + == + == +:: +:: +++ affection + :: rumors to interested + :: + :: for a given delta, send rumors to all queries it + :: affects. + :: + ~/ %hall-affection + |= det/delta + ^- (list card) + :: cache results for paths. + %- zing + =< cards + %+ roll ~(tap by sup.bol) + |= [[d=duct s=ship p=path] cards=(list (list card)) already=(set path)] + ^- [(list (list card)) (set path)] + ?: =([%export ~] p) + [~ already] + =+ qer=(path-to-query p) + =/ first=(list card) + =+ rum=(feel qer det) + ?~ rum ~ + ?: ?& + ?=(%burden -.u.rum) + ?=(%config -.rum.u.rum) + ?=(%read -.dif.rum.u.rum) + == + :: don't send read burdens + ~ + ?: ?& + ?!(=(s our.bol)) + ?=(%circle -.u.rum) + ?=(%config -.rum.u.rum) + ?=(%read -.dif.rum.u.rum) + == + :: don't send read circle events to other ships + :: + :: XX we might be sending them anyway because the next line may + :: still fire on another subscription + ~ + [%give %subscription-update `p %hall-rumor !>(u.rum)]~ + =? already ?=(^ first) (~(put in already) p) + :_ already + :_ cards + %+ welp first + ?. ?=($circle -.qer) ~ + :: kill the subscription if we forgot the story. + ?. (~(has by stories) nom.qer) ~& > %gentle-1 (gentle-quit s p) + :: kill the subscription if it's past its range. + =- ?:(done:- ~&(> %gentle-2 (gentle-quit s p)) ~) + %. ran.qer + =- ~(so-in-range so:ta nom.qer ~ -) + (~(got by stories) nom.qer) +:: +++ path-to-query + :: path, coins, query + :: + :: parse a path into a (list coin), then parse that + :: into a query structure. + :: + ~/ %hall-path-to-query + |= pax/path + ?. ?=({$circle @tas *} pax) + (coins-to-query (path-to-coins pax)) + =/ qer/query [%circle i.t.pax ~ ~ ~] + ?> ?=($circle -.qer) :: for type system. + =+ pax=t.t.pax + =+ ^- {qer/query pax/path} + ?. ?=({@ @ *} pax) [qer pax] + =+ hos=(slaw %p i.pax) + ?~ hos [qer pax] + :_ t.t.pax + qer(wer `[u.hos i.t.pax]) + ?> ?=($circle -.qer) + |- ^+ qer + ?~ pax qer + ::TODO can probably do this a bit better... + ?+ i.pax + qer(ran (path-to-range:hall-lib pax)) + :: + circle-data %_ $ pax t.pax + wat.qer (~(put in wat.qer) i.pax) + == + $group %_ $ pax t.pax + wat.qer %- ~(uni in wat.qer) + ^+ wat.qer + =/ dat=(list circle-data) [%group-l %group-r ~] + (sy dat) + == + $config %_ $ pax t.pax + wat.qer %- ~(uni in wat.qer) + ^+ wat.qer + =/ dat=(list circle-data) [%config-l %config-r ~] + (sy dat) + == + == +:: +++ path-to-coins + :: path to coin list + :: + :: parse a path into a list of coins. + :: + ~/ %hall-path-to-coins + |= pax/path + ^- (list coin) + %+ turn `path`pax + |= a/@ta + (need (slay a)) +:: +++ coins-to-query + :: coin list to query + :: + :: parse a list of coins into a query structure. + :: + ^- $-((list coin) query) + => depa:hall-lib + |^ %- af :~ + [%client ul] + [%circles (at /[%p])] + [%public ul] + [%burden (at /[%p])] + [%report ul] + == + ++ term (do %tas) + ++ rang (mu (al plac (mu (un plac)))) + ++ plac (or %da %ud) + -- +:: +++ leak + :: visible to + :: + :: determine if the given query is visible to the + :: ship. + :: + ~/ %hall-leak + |= {who/ship qer/query} + ^- ? + ?- -.qer + $client (team:title our.bol who) + $circles =(who who.qer) + $public & + $burden ?& =(who who.qer) + =(our.bol (above:hall-lib our.bol now.bol who)) + == + $peers =(who our.bol) ::TODO or so-visible? + $report =(who (above:hall-lib [our now our]:bol)) + :: + $circle + ?. (~(has by stories) nom.qer) | + %. who + ~(so-visible so:ta nom.qer ~ (~(got by stories) nom.qer)) + == +:: +:: # +:: # %poke-events +:: # +:: +++ poke-hall-command + :: accept command + :: + :: incoming hall command. process it and update logs. + :: + ~/ %hall-poke-hall-command + |= cod/command + ^- (quip card _+>) + =^ mos +>.$ + %- pre-bake + ta-done:(ta-apply:ta src.bol cod) + =^ mow +>.$ + log-all-to-file + [(welp mos mow) +>.$] +:: +++ poke-hall-action + :: accept action + :: + :: incoming hall action. process it. + :: + ~/ %hall-poke-hall-action + |= act/action + ^- (quip card _+>) + ?. (team:title our.bol src.bol) + %- pre-bake + =< ta-done + %- ta-note:ta + "hall-action stranger {(scow %p src.bol)}" + =^ mos +>.$ + %- pre-bake + ta-done:(ta-action:ta act) + =^ mow +>.$ + log-all-to-file + [(welp mos mow) +>.$] +:: +:: # +:: # %subscription-events +:: # +:: +++ diff-hall-prize + :: accept prize + :: + :: accept a query result. + :: + ~/ %hall-diff-hall-prize + |= {wir/wire piz/prize} + ^- (quip card _+>) + =^ mos +>.$ + %- pre-bake + => (ta-take:ta wir piz) + (flop deltas) + ::TODO ideally this, but runtime error for %burden prize + ::%- pre-bake + ::ta-done:(ta-take:ta wir piz) + =^ mow +>.$ + log-all-to-file + [(welp mos mow) +>.$] +:: +++ diff-hall-rumor + :: accept rumor + :: + :: accept a query result change. + :: + ~/ %hall-diff-hall-rumor + |= {wir/wire rum/rumor} + ^- (quip card _+>) + ::NOTE to keep us from echoing changes back to their + :: sender, we want to know (in ++feel) if a delta + :: was caused by a rumor from a /report. + :: if gall worked as advertised, we'd use ost.bol + :: and wex.bol to find out, but wex is never set, + :: so we just keep track of the "current rumor + :: wire" instead. + =. rir wir + =^ mos +>.$ + %- pre-bake + => (ta-hear:ta wir rum) + (flop deltas) + ::TODO runtime error for %burden rumors. + ::ta-done:(ta-hear:ta wir rum) + =^ mow +>.$ + log-all-to-file + [(welp mos mow) +>.$] +:: +++ peer + :: accept subscription + :: + :: incoming subscription on {pax}. + :: + ~/ %hall-peer + |= pax/path + ^- (quip card _+>) + ?: ?=([%sole *] pax) ~&(%hall-no-sole !!) + ?: ?=([%export *] pax) + :_ +>.$ :_ ~ + :* %give + %subscription-update + ~ + %export + !>([%hall-v0 grams:(~(got by stories) ~.inbox)]) + == + :: + =+ qer=(path-to-query pax) + ?. (leak src.bol qer) ~&(%peer-invisible !!) + =^ mos +>.$ + %- pre-bake + ta-done:(ta-subscribe:ta src.bol qer) + :_ +>.$ + =+ piz=(look qer) + ?~ piz ~&([%query-unavailable pax] mos) + ?~ u.piz ~&([%query-invalid pax] mos) + :_ mos + [%give %subscription-update ~ %hall-prize !>(u.u.piz)] +:: +++ pull-circle + :: someone ends a /circle subscription. + :: + ~/ %hall-pull-circle + |= pax/path + ^- (quip card _+>) + %- pre-bake + =+ qer=(path-to-query %circle pax) + ?> ?=($circle -.qer) + ?. (~(has by stories) nom.qer) ~ + [%story nom.qer %peer | src.bol qer]~ +:: +++ reap + :: subscription n/ack + :: + :: update state to reflect subscription success + :: + ~/ %hall-reap + |= {wir/wire fal/(unit tang)} + ^- (quip card _+>) + %- pre-bake + %+ welp + ?. ?=({$circle *} wir) ~ + =+ wer=(etch wir) + ?> ?=($circle -.wer) + =< ta-done + %. [nom.wer src.wer] + ?~ fal ta-greet:ta + ta-leave:ta + ?~ fal ~ + =< ta-done + =- (ta-grieve:ta - u.fal) + =+ (wire-to-target wir) + %+ weld "failed (re)subscribe to {(scow %p p)} on " + %+ roll q + |= {a/@ta b/tape} + :(weld b "/" (trip a)) +:: +++ quit + :: dropped subscription + :: + :: gall dropped out subscription. resubscribe. + :: + ~/ %hall-quit + |= wir/wire + ^- (quip card _+>) + [[(wire-to-peer wir) ~] +>] +:: +++ quit-circle + :: dropped circle sub + :: + :: gall dropped our subscription. resubscribe. + :: + ~/ %hall-quit-circle + |= wir/wire + ^- (quip card _+>) + %+ etch-circle [%circle wir] + |= {nom/name src/source} + %- pre-bake + ta-done:(ta-resub:ta nom src) +:: +++ coup-repeat + :: message n/ack + :: + :: ack from ++ta-transmit. mark the message as + :: received or rejected. + :: + ~/ %hall-coup-repeat + |= {wir/wire fal/(unit tang)} + ^- (quip card _+>) + %+ etch-repeat [%repeat wir] + |= {cir/circle ses/(list serial)} + %- pre-bake + ta-done:(ta-repeat:ta cir ses fal) +:: +:: # +:: # %logging +:: # +:: +++ poke-hall-save + :: save as log + :: + :: stores the telegrams of story {nom} in a log file, + :: to be re-loaded by ++poke-hall-load. + ::TODO maybe update to also store sourced list. + :: + ~/ %hall-poke-hall-save + |= nom/name + ^- (quip card _+>) + =/ paf/path + /(scot %p our.bol)/home/(scot %da now.bol)/hall/[nom]/hall-telegrams + =+ grams:(~(got by stories) nom) + :_ +>.$ + :_ ~ + :* %pass + /jamfile + %arvo + %c + %info + (foal:space:userlib paf [%hall-telegrams !>(-)]) + == +:: +++ poke-load-legacy + :: loads legacy messages into the story {nom}. + :: + ~/ %hall-poke-hall-legacy + |= nom/name + ^- (quip card _+>) + =/ jams/json + .^ json + %cx + /(scot %p our.bol)/home/(scot %da now.bol)/hall/legacy-telegrams/json + == + =+ grams=(from-json:hall-legacy jams) + ~& [%loaded (lent grams)] + %- pre-bake + %+ turn (flop grams) + |= t/telegram + [%story nom %gram [our.bol nom] t] +:: +++ poke-hall-load + :: load from log + :: + :: loads the telegrams of story {nom} into our state, + :: as saved in ++poke-hall-save. + :: + ~/ %hall-poke-hall-load + |= nom/name + ^- (quip card _+>) + =/ grams + .^ (list telegram) + %cx + /(scot %p our.bol)/home/(scot %da now.bol)/hall/[nom]/hall-telegrams + == + %- pre-bake + %+ turn grams + |= t/telegram + [%story nom %gram [our.bol nom] t] +:: +++ poke-hall-log + :: starts logging story {nom}'s messages. + :: + ~/ %hall-poke-hall-log + |= nom/name + ^- (quip card _+>) + :- [(log-to-file nom) ~] + %= +>.$ + log + %+ ~(put by log) nom + count:(~(got by stories) nom) + == +:: +++ poke-hall-unlog + :: stops logging story {nom}'s messages. + :: + ~/ %hall-poke-hall-unlog + |= nom/name + ^- (quip card _+>) + :- ~ + +>.$(log (~(del by log) nom)) +:: +++ poke-import + |= i=* + ^- (quip card _+>) + :: + ?> ?=([%hall-v0 *] i) + =/ grams=(list telegram) ;;((list telegram) +.i) + :: + ~& [%importing-telegrams count=(lent grams)] + :: + %- pre-bake + %+ turn grams + |= t/telegram + [%story ~.inbox %gram [our.bol ~.inbox] t] +:: +++ log-all-to-file + :: update stories logs + :: + :: for every story we're logging, (over)writes all + :: their grams to log files if new ones have arrived. + :: + ^- (quip card _.) + :_ %_ . + log + %- ~(urn by log) + |= {nom/name len/@ud} + count:(~(got by stories) nom) + == + %+ murn ~(tap by log) + |= {nom/name len/@ud} + ^- (unit card) + ?: (gte len count:(~(got by stories) nom)) + ~ + `(log-to-file nom) +:: +++ log-to-file + :: logs all grams of story {nom} to a file. + :: + ~/ %hall-log-all-to-file + |= nom/name + ^- card + =+ ^- paf/path + =+ day=(year %*(. (yore now.bol) +.t +:*tarp)) + %+ en-beam:format [our.bol %home da+now.bol] + /hall-telegrams/(scot %da day)/[nom]/hall + =+ grams:(~(got by stories) nom) + :* %pass + /jamfile + %arvo + %c + %info + (foal:space:userlib paf [%hall-telegrams !>(-)]) + == +:: +::TODO for debug purposes. remove eventually. +:: users beware, here be dragons. +++ poke-noun + ~/ %hall-poke-noun + |= a/* + ^- (quip card _+>) + ?: ?=([%kill ship] a) + :_ +> + [%give %subscription-close ~ `+.a]~ + ?> ?=(@t a) + ?: =(a 'check') + ~& 'verifying message reference integrity...' + =- ~&(- [~ +>.$]) + %- ~(urn by stories) + |= {n/name s/story} + =+ %- ~(rep by known.s) + |= {{u/serial a/@ud} k/@ud m/@ud} + :- ?:((gth a k) a k) + ?: =(u uid:(snag a grams.s)) m + ~? (lth m 3) + :* [%fake a u] + [%prev uid:(snag (dec a) grams.s)] + [%real uid:(snag a grams.s)] + [%next uid:(snag +(a) grams.s)] + == + +(m) + :^ count=count.s + lent=(lent grams.s) + known=k + mismatch=m + ?: =(a 'check subs') + ~& 'here are all incoming non-circle subs' + ~& ^- (list (pair ship path)) + %+ murn ~(tap by sup.bol) + |= {d/duct s/ship p/path} + ^- (unit (pair ship path)) + ?: ?=({$circle *} p) ~ + `[s p] + [~ +>] + ?: =(a 'check all subs') + ~& 'here are all incoming subs' + ~& ^- (list (pair ship path)) + %+ turn ~(tap by sup.bol) + |= {d/duct s/ship p/path} + ^- (pair ship path) + [s p] + [~ +>] + ?: =(a 'rebuild') + ~& 'rebuilding message references...' + =- [~ +>.$(stories -)] + %- ~(urn by stories) + |= {nom/name soy/story} + =+ %+ roll grams.soy + |= {t/telegram c/@ud k/(map serial @ud) s/(map circle (list @ud))} + :+ +(c) (~(put by k) uid.t c) + =/ src/circle + ?: (~(has in aud.t) [our.bol nom]) [our.bol nom] + ?~ aud.t ~&(%strange-aud [our.bol %inbox]) + n.aud.t + %+ ~(put by s) src + [c (~(gut by s) src ~)] + soy(count c, known k, sourced s) + ?: =(a 'refederate') + ~& 'refederating. may take a while...' + :_ +> + =+ bov=(above:hall-lib [our now our]:bol) + ?: =(bov our.bol) ~ + :~ [%pass /burden %agent [bov dap.bol] %unsubscribe ~] + (wire-to-peer /burden) + == + ?: =(a 'incoming') + ~& 'incoming subscriptions (ignoring circle subs):' + ~& %+ skip ~(tap by sup.bol) + |= {duct (pair ship path)} + &(?=({$circle *} q) !?=({$circle $inbox *} q)) + [~ +>] + ?: =(a 'sources') + ~& 'sources per story:' + ~& %- ~(urn by stories) + |= {n/name s/story} + [n src.shape.s] + [~ +>] + ?: =(`0 (find "re-listen " (trip a))) + ~& 're-listening' + :_ +> + :_ ~ + (wire-to-peer /report/(crip (slag 10 (trip a)))) + :: + :: + ?: =(a 'kill-all-subs') + :_ +> + %- ~(rep by sup.bol) + |= [[d=duct =ship =path] out=(list card)] + [[%give %subscription-close `path `ship] out] + :: + ?: =(a 'kill-our-subs') + :_ +> + [%give %subscription-close ~ `our.bol]~ + :: + ?: =(a 'print') + ~& shape:(~(got by stories) %inbox) + [~ +>] + :: + ?: =(a 'print all') + ~& %+ turn ~(tap by stories) + |= [n=name s=story] + [n shape:s] + [~ +>] + :: + [~ +>] +-- diff --git a/pkg/arvo/age/hood.hoon b/pkg/arvo/age/hood.hoon index ee4ee824b..101adca74 100644 --- a/pkg/arvo/age/hood.hoon +++ b/pkg/arvo/age/hood.hoon @@ -100,7 +100,7 @@ ++ ably :: save part =+ $:{(list) hood-part} |@ ++ $ - [+<- (~(put by lac) +<+< +<+)] + [(flop +<-) (~(put by lac) +<+< +<+)] -- :: :: :: :::: :: :: generic handling diff --git a/pkg/arvo/age/talk.hoon b/pkg/arvo/age/talk.hoon index c3cd81c16..c10695b6c 100644 --- a/pkg/arvo/age/talk.hoon +++ b/pkg/arvo/age/talk.hoon @@ -114,10 +114,7 @@ == -- :: -:: # -:: # %work -:: # -:: functional cores and arms. +:: Formal agent :: =; talk-core =| stat=[%1 state] @@ -153,9 +150,9 @@ :: ++ handle-subscribe |= =path - ^- step:agent:mall - =^ cards=(list card:agent:mall) talk-core (~(peer talk-core bowl stat) path) + =^ cards=(list card:agent:mall) talk-core + (~(peer talk-core bowl stat) path) [cards this(stat +<+.talk-core)] :: ++ handle-unsubscribe ~(handle-unsubscribe default-agent bowl this) @@ -187,6 +184,12 @@ ++ handle-arvo-response ~(handle-arvo-response default-agent bowl this) ++ handle-error ~(handle-error default-agent bowl this) -- +:: +:: # +:: # %work +:: # +:: functional cores and arms. +:: |_ {bol/bowl:mall $1 state} :: :: # %transition diff --git a/pkg/arvo/lib/hall.hoon b/pkg/arvo/lib/hall.hoon index e9bc866ef..da5b7a97b 100644 --- a/pkg/arvo/lib/hall.hoon +++ b/pkg/arvo/lib/hall.hoon @@ -5,7 +5,7 @@ :: :::: :: -|_ bol/bowl:gall +|_ bol/bowl:mall :: ::TODO add to zuse? ++ true-self @@ -20,12 +20,13 @@ :: ++ said-url :: app url |= url/purl:eyre - :^ ost.bol %poke /said-url - :+ [our.bol %hall] %hall-action - ^- action - :+ %phrase - [[our.bol %inbox] ~ ~] - [%app dap.bol %lin | (crip (en-purl:html url))]~ :: XX + :* %pass /said-url %agent [our.bol %hall] + %poke %hall-action !> + ^- action + :+ %phrase + [[our.bol %inbox] ~ ~] + [%app dap.bol %lin | (crip (en-purl:html url))]~ :: XX + == :: ++ said :: app message |= mes/(list tank) diff --git a/pkg/arvo/sur/hall.hoon b/pkg/arvo/sur/hall.hoon index 595a5e28c..58aaaa721 100644 --- a/pkg/arvo/sur/hall.hoon +++ b/pkg/arvo/sur/hall.hoon @@ -26,11 +26,11 @@ +| %query-models :: ++ query :: query paths - $% {$client ~} :: shared ui state + $% {$client ~} :: shared ui state {$circles who/ship} :: readable circles - {$public ~} :: public memberships + {$public ~} :: public memberships {$burden who/ship} ::TODO eventually, nom/name. :: duties to share - {$report ~} :: duty reports + {$report ~} :: duty reports {$peers nom/name} :: readers of story $: $circle :: story query nom/name :: circle name @@ -63,7 +63,7 @@ {$circles cis/(set name)} :: /circles {$public cis/(set circle)} :: /public {$burden sos/(map name burden)} :: /burden - {$report ~} :: /report + {$report ~} :: /report {$peers pes/(jar ship query)} :: /peers {$circle package} :: /circle == :: @@ -103,7 +103,7 @@ {$peer add/? who/ship qer/query} :: gain/lose subscriber {$config cir/circle dif/diff-config} :: new/changed config {$status cir/circle who/ship dif/diff-status} :: new/changed status - {$remove ~} :: removed story + {$remove ~} :: removed story == :: ++ rumor-story :: story rumor $% {$gram src/circle nev/envelope} :: new/changed message @@ -172,7 +172,7 @@ ++ command :: effect on story $% {$publish tos/(list thought)} :: deliver {$present nos/(set name) dif/diff-status} :: status update - {$bearing ~} :: prompt to listen + {$bearing ~} :: prompt to listen == :: :: :: # diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index a3009d68e..d6955f306 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -488,7 +488,7 @@ :: ++ hurl :: start loop |= {lac/? ovo/ovum} - ~? &(!lac !=(%belt -.q.ovo)) ["" %unix -.q.ovo p.ovo now] + ~? !lac ["" %unix -.q.ovo p.ovo now] :: ^- {p/(list ovum) q/(pair worm (list {p/@tas q/vase}))} ^- {p/(list ovum) q=(list [label=@tas =vane])} ?> ?=(^ p.ovo) @@ -543,6 +543,10 @@ ~? &(!lac !=(%$ p.gum)) :- (runt [s.gum '|'] "") :^ %pass [p.gum p.q.r.gum] + ?: ?=(?(%deal %deal-mall) +>-.q.q.r.gum) + :- :- +>-.q.q.r.gum + (,[[ship ship] term term] [+>+< +>+>- +>+>+<]:q.q.r.gum) + p.r.gum [(symp +>-.q.q.r.gum) p.r.gum] q.gum [p.q.r.gum ~ [[p.gum p.r.gum] q.gum] q.q.r.gum] @@ -554,7 +558,11 @@ !! ~? &(!lac |(!=(%blit +>-.p.r.gum) !=(%d p.gum))) :- (runt [s.gum '|'] "") - [%give p.gum (symp +>-.p.r.gum) `duct`q.gum] + :^ %give p.gum + ?: ?=(%unto +>-.p.r.gum) + [+>-.p.r.gum (term +>+<.p.r.gum)] + (symp +>-.p.r.gum) + `duct`q.gum [i.i.q.gum [~ t.i.q.gum] t.q.gum p.r.gum] :: $slip diff --git a/pkg/arvo/sys/vane/mall.hoon b/pkg/arvo/sys/vane/mall.hoon index fb75b5a79..9725c959d 100644 --- a/pkg/arvo/sys/vane/mall.hoon +++ b/pkg/arvo/sys/vane/mall.hoon @@ -863,7 +863,7 @@ =/ initialised =/ out (mo-retrieve-duct ship bone) (mo-abed out) - (mo-give:initialised %unto %subscription-close ~) + (mo-give:initialised %unto %subscription-close ~ ~) == :: +ap: agent engine :: @@ -928,13 +928,15 @@ :: =/ internal-cards agent-cards =/ bad-ducts *(set duct) + =; core + core(agent-duct agent-duct) |- ^+ ap-core ?^ internal-cards =/ =card:agent i.internal-cards ?. ?=([%give %subscription-update *] card) $(internal-cards t.internal-cards) :: - =/ ducts (ap-ducts-from-path path.p.card) + =/ ducts (ap-ducts-from-path path.p.card ~) |- ^+ ap-core ?~ ducts ^$(internal-cards t.internal-cards) @@ -978,7 +980,7 @@ ?. ?=(%subscription-update -.gift) [agent-duct %give %unto gift]~ :: - =/ ducts=(list duct) (ap-ducts-from-path path.gift) + =/ ducts=(list duct) (ap-ducts-from-path path.gift ~) =/ =cage cage.gift %+ turn ducts |= =duct @@ -1026,14 +1028,22 @@ :: +ap-ducts-from-path: get ducts subscribed to path :: ++ ap-ducts-from-path - |= target-path=(unit path) + |= [target-path=(unit path) target-ship=(unit ship)] ^- (list duct) - ?~ target-path + ?: &(?=(~ target-path) ?=(~ target-ship)) ~[agent-duct] %+ murn ~(tap by incoming.subscribers.current-agent) |= [=duct =ship =path] ^- (unit ^duct) - ?: =(u.target-path path) + ?~ target-ship + ?: =(target-path `path) + `duct + ~ + ?~ target-path + ?: =(target-ship `ship) + `duct + ~ + ?: &(=(target-path `path) =(target-ship `ship)) `duct ~ :: +ap-apply: apply effect. @@ -1077,7 +1087,8 @@ ?: is-ok =/ =note:agent [%agent [ship -.path] %pump ~] (ap-pass way note) - =. ap-core (ap-give %subscription-close ~) + ~& > %agent-update-failed + =. ap-core (ap-specific-take path %subscription-close ~ ~) =/ =note:agent [%agent [ship -.path] %unsubscribe ~] (ap-pass way note) :: +ap-dequeue: drop from queue. @@ -1262,10 +1273,10 @@ =^ maybe-tang ap-core %+ ap-ingest ~ |. (handle-agent-response:ap-agent-core path gift) - ?: ?=(%subscription-update -.gift) + =? ap-core ?=(%subscription-update -.gift) (ap-update-subscription =(~ maybe-tang) attributing.agent-routes path) ?^ maybe-tang - (ap-error -.gift u.maybe-tang) + (ap-error -.gift leaf/"closing subscription" u.maybe-tang) ap-core :: +ap-install: install wrapper. :: @@ -1343,7 +1354,7 @@ ^+ ap-core :: => ap-load-delete - (ap-give %subscription-close ~) + (ap-give %subscription-close ~ ~) :: +ap-ingest: call agent arm :: :: Handle acks here because they need to be emitted before the @@ -1398,7 +1409,7 @@ ^- (list duct) ?. ?=([%give %subscription-close *] card) ~ - (ap-ducts-from-path path.p.card) + (ap-ducts-from-path [path ship]:p.card) :: =/ quit-map=bitt (malt (turn quits |=(=duct [duct *[ship path]]))) diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index e4a3f20d9..34450062d 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -1927,7 +1927,7 @@ +$ gift $% [%poke-ack p=(unit tang)] [%subscription-update path=(unit path) =cage] - [%subscription-close path=(unit path)] + [%subscription-close path=(unit path) ship=(unit ship)] [%subscription-ack p=(unit tang)] [%http-response =http-event:http] == From 34ab4c4e777fcd17924eba0bd4f74ac0e4a9ff8a Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 24 Sep 2019 18:57:05 -0700 Subject: [PATCH 147/451] mall: convert aqua vane handlers to mall --- pkg/arvo/age/aqua-ames.hoon | 52 +++++++++++++ pkg/arvo/age/aqua-behn.hoon | 110 +++++++++++++++++++++++++++ pkg/arvo/age/aqua-dill.hoon | 46 ++++++++++++ pkg/arvo/age/aqua-eyre.hoon | 128 ++++++++++++++++++++++++++++++++ pkg/arvo/lib/aqua-vane.hoon | 79 ++++++++++++++++++++ pkg/arvo/lib/default-agent.hoon | 17 ++++- pkg/arvo/sur/aquarium.hoon | 24 ------ pkg/arvo/sys/zuse.hoon | 2 +- 8 files changed, 429 insertions(+), 29 deletions(-) create mode 100644 pkg/arvo/age/aqua-ames.hoon create mode 100644 pkg/arvo/age/aqua-behn.hoon create mode 100644 pkg/arvo/age/aqua-dill.hoon create mode 100644 pkg/arvo/age/aqua-eyre.hoon create mode 100644 pkg/arvo/lib/aqua-vane.hoon diff --git a/pkg/arvo/age/aqua-ames.hoon b/pkg/arvo/age/aqua-ames.hoon new file mode 100644 index 000000000..3ab41d349 --- /dev/null +++ b/pkg/arvo/age/aqua-ames.hoon @@ -0,0 +1,52 @@ +:: This needs a better SDN solution. Every ship should have an IP +:: address, and we should eventually test changing those IP +:: addresses. +:: +:: For now, we broadcast every packet to every ship and rely on them +:: to drop them. +:: +/- aquarium +/+ aqua-vane +=, aquarium +=| ships=(list ship) +|% +++ emit-aqua-events + |= [our=ship aes=(list aqua-event)] + ^- (list card:agent:mall) + [%pass /aqua-events %agent [our %aqua] %poke %aqua-events !>(aes)]~ +:: +++ handle-restore + |= [our=ship who=@p] + ^- (quip card:agent:mall _ships) + :_ ships + %+ emit-aqua-events our + [%event who [//newt/0v1n.2m9vh %barn ~]]~ +:: +++ handle-send + |= [our=ship now=@da way=wire %send lan=lane:ames pac=@] + ^- (quip card:agent:mall _ships) + =/ hear [//newt/0v1n.2m9vh %hear lan pac] + =? ships =(~ ships) + .^((list ship) %gx /(scot %p our)/aqua/(scot %da now)/ships/noun) + :_ ships + %+ emit-aqua-events our + %+ turn ships + |= who=ship + [%event who hear] +-- +:: +%- aqua-vane +|_ =bowl:mall ++* this . +++ handle-unix-effect + |= [who=@p ue=unix-effect] + ^- (quip card:agent:mall _this) + =^ cards ships + ?+ -.q.ue `ships + %restore (handle-restore our.bowl who) + %send (handle-send our.bowl now.bowl ue) + == + [cards this] +:: +++ handle-arvo-response _!! +-- diff --git a/pkg/arvo/age/aqua-behn.hoon b/pkg/arvo/age/aqua-behn.hoon new file mode 100644 index 000000000..24f6bdcbb --- /dev/null +++ b/pkg/arvo/age/aqua-behn.hoon @@ -0,0 +1,110 @@ +/- aquarium +/+ aqua-vane +=, aquarium +|% ++$ pier next-timer=(unit @da) +-- +:: +=| piers=(map ship pier) +:: +|% +++ pe + |= [bowl:mall who=ship] + =+ (~(gut by piers) who *pier) + =* pier-data - + =| cards=(list card:agent:mall) + |% + ++ this . + ++ abet-pe + ^- (quip card:agent:mall _piers) + =. piers (~(put by piers) who pier-data) + [(flop cards) piers] + :: + ++ emit-cards + |= cs=(list card:agent:mall) + %_(this cards (weld cs cards)) + :: + ++ emit-aqua-events + |= aes=(list aqua-event) + %- emit-cards + [%pass /aqua-events %agent [our %aqua] %poke %aqua-events !>(aes)]~ + :: + ++ handle-sleep + ^+ ..abet-pe + =< ..abet-pe(pier-data *pier) + ?~ next-timer + ..abet-pe + cancel-timer + :: + ++ handle-restore + ^+ ..abet-pe + =. this + %- emit-aqua-events + [%event who [//behn/0v1n.2m9vh %born ~]]~ + ..abet-pe + :: + ++ handle-doze + |= [way=wire %doze tim=(unit @da)] + ^+ ..abet-pe + ?~ tim + ?~ next-timer + ..abet-pe + cancel-timer + ?~ next-timer + (set-timer u.tim) + (set-timer:cancel-timer u.tim) + :: + ++ set-timer + |= tim=@da + ~? debug=| [who=who %setting-timer tim] + =. next-timer `tim + =. this (emit-cards [%pass /(scot %p who) %arvo %b %wait tim]~) + ..abet-pe + :: + ++ cancel-timer + ~? debug=| [who=who %cancell-timer (need next-timer)] + =. this + (emit-cards [%pass /(scot %p who) %arvo %b %rest (need next-timer)]~) + =. next-timer ~ + ..abet-pe + :: + ++ take-wake + |= [way=wire error=(unit tang)] + ~? debug=| [who=who %aqua-behn-wake now error=error] + =. next-timer ~ + =. this + %- emit-aqua-events + :_ ~ + ^- aqua-event + :+ %event who + :- //behn/0v1n.2m9vh + ?~ error + [%wake ~] + [%crud %fail u.error] + ..abet-pe + -- +-- +:: +%- aqua-vane +|_ =bowl:mall ++* this . +++ handle-unix-effect + |= [who=@p ue=unix-effect:aquarium] + ^- (quip card:agent:mall _this) + =^ cards piers + ?+ -.q.ue `piers + %sleep abet-pe:handle-sleep:(pe bowl who) + %restore abet-pe:handle-restore:(pe bowl who) + %doze abet-pe:(handle-doze:(pe bowl who) ue) + == + [cards this] +:: +++ handle-arvo-response + |= [=wire =sign-arvo] + ?> ?=([%b %wake *] sign-arvo) + ?> ?=([@ *] wire) + =/ who (,@p (slav %p i.wire)) + =^ cards piers + abet-pe:(take-wake:(pe bowl who) t.wire error.sign-arvo) + [cards this] +-- diff --git a/pkg/arvo/age/aqua-dill.hoon b/pkg/arvo/age/aqua-dill.hoon new file mode 100644 index 000000000..880bb365e --- /dev/null +++ b/pkg/arvo/age/aqua-dill.hoon @@ -0,0 +1,46 @@ +:: Would love to see a proper stateful terminal handler. Ideally, +:: you'd be able to ^X into the virtual ship, like the old ^W. +:: +:: However, that's probably not the primary way of interacting with +:: it. In practice, most of the time you'll be running from a file +:: (eg for automated testing) or fanning the same command to multiple +:: ships or otherwise making use of the fact that we can +:: programmatically send events. +:: +/- aquarium +/+ aqua-vane +|% +++ handle-blit + |= [who=@p way=wire %blit blits=(list blit:dill)] + ^- (list card:agent:mall) + =/ last-line + %+ roll blits + |= [b=blit:dill line=tape] + ?- -.b + %lin (tape p.b) + %mor ~& "{}: {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 + == + ~? !=(~ last-line) last-line + ~ +-- +:: +%- aqua-vane +|_ =bowl:mall ++* this . +++ handle-unix-effect + |= [who=@p ue=unix-effect:aquarium] + ^- (quip card:agent:mall _this) + =/ cards + ?+ -.q.ue ~ + %blit (handle-blit who ue) + == + [cards this] +:: +++ handle-arvo-response _!! +-- diff --git a/pkg/arvo/age/aqua-eyre.hoon b/pkg/arvo/age/aqua-eyre.hoon new file mode 100644 index 000000000..b70f15e49 --- /dev/null +++ b/pkg/arvo/age/aqua-eyre.hoon @@ -0,0 +1,128 @@ +:: Pass-through Eyre driver +:: +/- aquarium +/+ aqua-vane +=, aquarium +|% ++$ pier http-requests=(set @ud) +-- +:: +=| piers=(map ship pier) +:: +|% +++ pe + |= [bowl:mall who=ship] + =+ (~(gut by piers) who *pier) + =* pier-data - + =| cards=(list card:agent:mall) + |% + ++ this . + ++ abet-pe + ^- (quip card:agent:mall _piers) + =. piers (~(put by piers) who pier-data) + [(flop cards) piers] + :: + ++ emit-cards + |= cs=(list card:agent:mall) + %_(this cards (weld cs cards)) + :: + ++ emit-aqua-events + |= aes=(list aqua-event) + %- emit-cards + [%pass /aqua-events %agent [our %aqua] %poke %aqua-events !>(aes)]~ + :: + ++ handle-sleep + ^+ ..abet-pe + ..abet-pe(pier-data *pier) + :: + ++ handle-restore + ^+ ..abet-pe + =. this + %- emit-aqua-events + [%event who [//http/0v1n.2m9vh %born ~]]~ + ..abet-pe + :: + ++ handle-thus + |= [way=wire %thus num=@ud req=(unit hiss:eyre)] + ^+ ..abet-pe + ?~ req + ?. (~(has in http-requests) num) + ..abet-pe + :: Eyre doesn't support cancelling HTTP requests from userspace, + :: so we remove it from our state so we won't pass along the + :: response. + :: + ~& [who=who %aqua-eyre-cant-cancel-thus num=num] + =. http-requests (~(del in http-requests) num) + ..abet-pe + ~& [who=who %aqua-eyre-requesting u.req] + =. http-requests (~(put in http-requests) num) + =. this + %- emit-cards :_ ~ + :* %pass + /(scot %p who)/(scot %ud num) + %arvo + %i + %request + (hiss-to-request:html u.req) + *outbound-config:iris + == + ..abet-pe + :: + :: Pass HTTP response back to virtual ship + :: + ++ take-sigh-httr + |= [way=wire res=httr:eyre] + ^+ ..abet-pe + ?> ?=([@ ~] way) + =/ num (slav %ud i.way) + ?. (~(has in http-requests) num) + ~& [who=who %ignoring-httr num=num] + ..abet-pe + =. http-requests (~(del in http-requests) num) + =. this + (emit-aqua-events [%event who [//http/0v1n.2m9vh %receive num [%start [p.res q.res] r.res &]]]~) + ..abet-pe + :: + :: Got error in HTTP response + :: + ++ take-sigh-tang + |= [way=wire tan=tang] + ^+ ..abet-pe + ?> ?=([@ ~] way) + =/ num (slav %ud i.way) + ?. (~(has in http-requests) num) + ~& [who=who %ignoring-httr num=num] + ..abet-pe + =. http-requests (~(del in http-requests) num) + %- (slog tan) + ..abet-pe + -- +-- +:: +%- aqua-vane +|_ =bowl:mall ++* this . +++ handle-unix-effect + |= [who=@p ue=unix-effect:aquarium] + ^- (quip card:agent:mall _this) + =^ cards piers + ?+ -.q.ue `piers + %sleep abet-pe:handle-sleep:(pe bowl who) + %restore abet-pe:handle-restore:(pe bowl who) + %thus abet-pe:(handle-thus:(pe bowl who) ue) + == + [cards this] +:: +++ handle-arvo-response + |= [=wire =sign-arvo] + ^- (quip card:agent:mall _this) + ?> ?=([%i %http-response %finished *] sign-arvo) + ?> ?=([@ *] wire) + =/ who (,@p (slav %p i.wire)) + =/ =httr:eyre + (to-httr:iris [response-header full-file]:client-response.sign-arvo) + =^ cards piers + abet-pe:(take-sigh-httr:(pe bowl who) t.wire httr) + [cards this] +-- diff --git a/pkg/arvo/lib/aqua-vane.hoon b/pkg/arvo/lib/aqua-vane.hoon new file mode 100644 index 000000000..a0733772c --- /dev/null +++ b/pkg/arvo/lib/aqua-vane.hoon @@ -0,0 +1,79 @@ +/- aquarium +/+ default-agent +=, aquarium +|% +++ vane-handler + $_ ^| + |_ bowl:mall + ++ handle-unix-effect + |~ [ship unix-effect] + *(quip card:agent:mall _^|(..handle-unix-effect)) + :: + ++ handle-arvo-response + |~ [wire sign-arvo] + *(quip card:agent:mall _^|(..handle-unix-effect)) + -- +-- +:: +|= handler=vane-handler +^- agent:mall +=| subscribed=_| +|_ =bowl:mall ++* this . + def ~(. default-agent bowl this) +++ handle-init handle-init:def +++ handle-extract-state !>(subscribed) +++ handle-upgrade-state + |= old-state=vase + `this(subscribed !<(_| old-state)) +:: +++ handle-poke + |= [=mark =vase] + ^- (quip card:agent:mall _this) + ?. ?=(%aqua-vane-control mark) + (handle-poke:def mark vase) + =/ command !<(?(%subscribe %unsubscribe) vase) + =. subscribed =(command %subscribe) + :_ this + ?- command + %subscribe + %+ weld + ^- (list card:agent:mall) + ?. subscribed + ~ + [%pass /aqua %agent [our.bowl %ph] %unsubscribe ~]~ + ^- (list card:agent:mall) + [%pass /aqua %agent [our.bowl %ph] %subscribe /effects]~ + :: + %unsubscribe + ?. subscribed + ~ + [%pass /aqua %agent [our.bowl %ph] %unsubscribe ~]~ + == +:: +++ handle-subscribe handle-subscribe:def +++ handle-unsubscribe handle-unsubscribe:def +++ handle-peek handle-peek:def +++ handle-agent-response + |= [=wire =gift:agent:mall] + ?. ?=([%subscription-update * %aqua-effects *] gift) + (handle-agent-response:def wire gift) + =/ afs !<(aqua-effects q.cage.gift) + |- ^- (quip card:agent:mall _this) + ?~ ufs.afs + `this + =^ cards-1 handler + (~(handle-unix-effect handler bowl) who.afs i.ufs.afs) + =^ cards-2 this + $(ufs.afs t.ufs.afs) + [(welp cards-1 cards-2) this] +:: +++ handle-arvo-response + |= [=wire =sign-arvo] + ^- (quip card:agent:mall _this) + =^ cards handler + (~(handle-arvo-response handler bowl) wire sign-arvo) + [cards this] +:: +++ handle-error handle-error:def +-- diff --git a/pkg/arvo/lib/default-agent.hoon b/pkg/arvo/lib/default-agent.hoon index e71bc7223..71d85f8f1 100644 --- a/pkg/arvo/lib/default-agent.hoon +++ b/pkg/arvo/lib/default-agent.hoon @@ -13,13 +13,11 @@ :: ++ handle-poke |= =cage - ~& "unexpected poke to {} with mark {}" ~| "unexpected poke to {} with mark {}" !! :: ++ handle-subscribe |= =path - ~& "unexpected subscription to {} on path {}" ~| "unexpected subscription to {} on path {}" !! :: @@ -35,8 +33,19 @@ ++ handle-agent-response |= [=wire =gift:agent:mall] ?- -.gift - %poke-ack `agent - %subscription-ack `agent + %poke-ack + ?~ p.gift + `agent + %- (slog leaf+"poke failed from {} on wire {}" u.p.gift) + `agent + :: + %subscription-ack + ?~ p.gift + `agent + =/ =tank leaf+"subscribe failed from {} on wire {}" + %- (slog tank u.p.gift) + `agent + :: %subscription-close ~| "unexpected subscription closure to {} on wire {}" !! diff --git a/pkg/arvo/sur/aquarium.hoon b/pkg/arvo/sur/aquarium.hoon index 7959b4dfa..c0d6e6829 100644 --- a/pkg/arvo/sur/aquarium.hoon +++ b/pkg/arvo/sur/aquarium.hoon @@ -57,28 +57,4 @@ [%init ~] [%request id=@ud request=request:http] == -+$ vane-move - %+ pair bone - $% [%peer wire dock path] - [%pull wire dock ~] - == -:: -++ aqua-vane-control-handler - |= [our=@p ost=bone subscribed=? command=?(%subscribe %unsubscribe)] - ^- (list vane-move) - ?- command - %subscribe - %+ weld - ^- (list vane-move) - ?. subscribed - ~ - [ost %pull /aqua [our %ph] ~]~ - ^- (list vane-move) - [ost %peer /aqua [our %ph] /effects]~ - :: - %unsubscribe - ?. subscribed - ~ - [ost %pull /aqua [our %ph] ~]~ - == -- diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 34450062d..decb9b6df 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -6927,7 +6927,7 @@ :: r.q.hiss == - -- ::eyre + -- :: html :: :: :::: ++wired :: wire formatting :: :::: From 49ae542adf260f9caf169f82906913a08a9997f4 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 24 Sep 2019 19:51:01 -0700 Subject: [PATCH 148/451] mall: convert aqua to mall --- pkg/arvo/age/aqua.hoon | 531 +++++++++++++++++++++++++++++++++++++++++ pkg/arvo/app/ph.hoon | 4 - 2 files changed, 531 insertions(+), 4 deletions(-) create mode 100644 pkg/arvo/age/aqua.hoon diff --git a/pkg/arvo/age/aqua.hoon b/pkg/arvo/age/aqua.hoon new file mode 100644 index 000000000..416fda9ca --- /dev/null +++ b/pkg/arvo/age/aqua.hoon @@ -0,0 +1,531 @@ +:: An aquarium of virtual ships. Put in some fish and watch them! +:: +:: usage: +:: |start %aqua +:: /- aquarium +:: :aqua &pill .^(pill:aquarium %cx %/urbit/pill) +:: OR +:: :aqua &pill +solid +:: +:: Then try stuff: +:: :aqua [%init ~[~bud ~dev]] +:: :aqua [%dojo ~[~bud ~dev] "[our eny (add 3 5)]"] +:: :aqua [%dojo ~[~bud] "|hi ~dev"] +:: :aqua [%wish ~[~bud ~dev] '(add 2 3)'] +:: :aqua [%peek ~[~bud] /cx/~bud/home/(scot %da now)/app/curl/hoon] +:: :aqua [%dojo ~[~bud ~dev] '|mount %'] +:: :aqua [%file ~[~bud ~dev] %/sys/vane] +:: :aqua [%pause-events ~[~bud ~dev]] +:: +:: +:: We get ++unix-event and ++pill from /-aquarium +:: +/- aquarium +/+ pill, default-agent +=, pill-lib=pill +=, aquarium +=> $~ |% + +$ state + $: %0 + pil=pill + assembled=* + tym=@da + fleet-snaps=(map term (map ship pier)) + piers=(map ship pier) + == + :: + +$ pier + $: snap=* + event-log=(list unix-timed-event) + next-events=(qeu unix-event) + processing-events=? + == + -- +=, gall +=; aqua-core + =| =all=state + ^- agent:mall + |_ =bowl:mall + +* this . + def ~(. default-agent bowl this) + ++ handle-init + `this + :: + ++ handle-extract-state !>(all-state) + ++ handle-upgrade-state + |= old-state=vase + ^- step:agent:mall + ~& prep=%aqua + =+ new=((soft state) !<(* old-state)) + ?~ new + `this + `this(all-state u.new) + :: + ++ handle-poke + |= [=mark =vase] + ^- step:agent:mall + =^ cards aqua-core + =/ t ~(. aqua-core bowl all-state) + ?+ mark ~|([%aqua-bad-mark mark] !!) + %aqua-events (poke-aqua-events:t !<((list aqua-event) vase)) + %pill (poke-pill:t !<(pill vase)) + %noun (poke-noun:t !<(* vase)) + == + [cards this(all-state +<+.aqua-core)] + :: + ++ handle-subscribe + |= =path + ^- step:agent:mall + ?. ?=([?(%effects %evens %boths) @ ~] path) + ~| [%aqua-bad-subscribe-path path] + !! + ?~ (slaw %p i.t.path) + ~| [%aqua-bad-subscribe-path-ship path] + !! + `this + :: + ++ handle-unsubscribe handle-unsubscribe:def + ++ handle-peek + |= =path + ^- (unit (unit cage)) + (~(peek aqua-core bowl all-state) path) + :: + ++ handle-agent-response handle-agent-response:def + ++ handle-arvo-response handle-arvo-response:def + ++ handle-error handle-error:def + -- +:: +:: unix-{effects,events,boths}: collect jar of effects and events to +:: brodcast all at once to avoid gall backpressure +:: moves: Hoist moves into state for cleaner state management +:: +=| unix-effects=(jar ship unix-effect) +=| unix-events=(jar ship unix-timed-event) +=| unix-boths=(jar ship unix-both) +=| cards=(list card:agent:mall) +|_ $: hid=bowl:mall + state + == +:: +:: Represents a single ship's state. +:: +++ pe + |= who=ship + =+ (~(gut by piers) who *pier) + =* pier-data - + |% + :: + :: Done; install data + :: + ++ abet-pe + ^+ this + =. piers (~(put by piers) who pier-data) + this + :: + :: Initialize new ship + :: + ++ apex + =. pier-data *pier + =. snap assembled + ~& pill-size=(met 3 (jam snap)) + ..abet-pe + :: + :: Enqueue events to child arvo + :: + ++ push-events + |= ues=(list unix-event) + ^+ ..abet-pe + =. next-events (~(gas to next-events) ues) + ..abet-pe + :: + :: Send cards to host arvo + :: + ++ emit-cards + |= ms=(list card:agent:mall) + =. this (^emit-cards ms) + ..abet-pe + :: + :: Process the events in our queue. + :: + ++ plow + |- ^+ ..abet-pe + ?: =(~ next-events) + ..abet-pe + ?. processing-events + ..abet-pe + =^ ue next-events ~(get to next-events) + =/ poke-arm (mox +47.snap) + ?> ?=(%0 -.poke-arm) + =/ poke p.poke-arm + =. tym (max +(tym) now.hid) + =/ poke-result (mule |.((slum poke tym ue))) + ?: ?=(%| -.poke-result) + %- (slog >%aqua-crash< >guest=who< p.poke-result) + $ + =. snap +.p.poke-result + =. ..abet-pe (publish-event tym ue) + =. ..abet-pe (handle-effects ((list ovum) -.p.poke-result)) + $ + :: + :: Peek + :: + ++ peek + |= p=* + =/ res (mox +46.snap) + ?> ?=(%0 -.res) + =/ peek p.res + =/ pax (path p) + ?> ?=([@ @ @ @ *] pax) + =. i.t.t.t.pax (scot %da tym) + =/ pek (slum peek [tym pax]) + pek + :: + :: Wish + :: + ++ wish + |= txt=@t + =/ res (mox +22.snap) + ?> ?=(%0 -.res) + =/ wish p.res + ~& [who=who %wished (slum wish txt)] + ..abet-pe + :: + ++ mox |=(* (mock [snap +<] scry)) + :: + :: Start/stop processing events. When stopped, events are added to + :: our queue but not processed. + :: + ++ start-processing-events .(processing-events &) + ++ stop-processing-events .(processing-events |) + :: + :: Handle all the effects produced by a single event. + :: + ++ handle-effects + |= effects=(list ovum) + ^+ ..abet-pe + ?~ effects + ..abet-pe + =. ..abet-pe + =/ sof ((soft unix-effect) i.effects) + ?~ sof + ~? aqua-debug=& [who=who %unknown-effect i.effects] + ..abet-pe + (publish-effect u.sof) + $(effects t.effects) + :: + :: Give effect to our subscribers + :: + ++ publish-effect + |= uf=unix-effect + ^+ ..abet-pe + =. unix-effects (~(add ja unix-effects) who uf) + =. unix-boths (~(add ja unix-boths) who [%effect uf]) + ..abet-pe + :: + :: Give event to our subscribers + :: + ++ publish-event + |= ute=unix-timed-event + ^+ ..abet-pe + =. event-log [ute event-log] + =. unix-events (~(add ja unix-events) who ute) + =. unix-boths (~(add ja unix-boths) who [%event ute]) + ..abet-pe + -- +:: +++ this . +:: +:: ++apex-aqua and ++abet-aqua must bookend calls from gall +:: +++ apex-aqua + ^+ this + =: cards ~ + unix-effects ~ + unix-events ~ + unix-boths ~ + == + this +:: +++ abet-aqua + ^- (quip card:agent:mall _this) + =. this + =/ =path /effects + %- emit-cards + %+ turn ~(tap by unix-effects) + |= [=ship ufs=(list unix-effect)] + [%give %subscription-update `path %aqua-effects !>((flop ufs))] + :: + =. this + %- emit-cards + %+ turn ~(tap by unix-effects) + |= [=ship ufs=(list unix-effect)] + =/ =path /effects/(scot %p ship) + [%give %subscription-update `path %aqua-effects !>((flop ufs))] + :: + =. this + %- emit-cards + %+ turn ~(tap by unix-events) + |= [=ship ve=(list unix-timed-event)] + =/ =path /events/(scot %p ship) + [%give %subscription-update `path %aqua-events !>((flop ve))] + :: + =. this + %- emit-cards + %+ turn ~(tap by unix-boths) + |= [=ship bo=(list unix-both)] + =/ =path /boths/(scot %p ship) + [%give %subscription-update `path %aqua-boths !>((flop bo))] + :: + [(flop cards) this] +:: +++ emit-cards + |= ms=(list card:agent:mall) + =. cards (weld ms cards) + this +:: +:: +:: Run all events on all ships until all queues are empty +:: +++ plow-all + |- ^+ this + =/ who + =/ pers ~(tap by piers) + |- ^- (unit ship) + ?~ pers + ~ + ?: &(?=(^ next-events.q.i.pers) processing-events.q.i.pers) + `p.i.pers + $(pers t.pers) + ~? aqua-debug=| plowing=who + ?~ who + this + =. this abet-pe:plow:(pe u.who) + $ +:: +:: Load a pill and assemble arvo. Doesn't send any of the initial +:: events. +:: +++ poke-pill + |= p=pill + ^- (quip card:agent:mall _this) + =. this apex-aqua =< abet-aqua + =. pil p + ~& lent=(met 3 (jam boot-ova.pil)) + =/ res=toon :: (each * (list tank)) + (mock [boot-ova.pil [2 [0 3] [0 2]]] scry) + =. fleet-snaps ~ + ?- -.res + %0 + ~& %suc + =. assembled +7.p.res + this + :: + %1 + ~& [%vere-blocked p.res] + this + :: + %2 + ~& %vere-fail + %- (slog p.res) + this + == +:: +:: Handle commands from CLI +:: +:: Should put some thought into arg structure, maybe make a mark. +:: +:: Should convert some of these to just rewrite into ++poke-events. +:: +++ poke-noun + |= val=* + ^- (quip card:agent:mall _this) + =. this apex-aqua =< abet-aqua + ^+ this + :: Could potentially factor out the three lines of turn-ships + :: boilerplate + :: + ?+ val ~|(%bad-noun-arg !!) + [%swap-vanes vs=*] + ?> ?=([[%7 * %1 installed=*] ~] boot-ova.pil) + =. installed.boot-ova.pil + %+ roll (,(list term) vs.val) + |= [v=term _installed.boot-ova.pil] + %^ slum installed.boot-ova.pil now.hid + =/ vane + ?+ v ~|([%unknown-vane v] !!) + %a %ames + %b %behn + %c %clay + %d %dill + %e %eyre + %f %ford + %g %gall + %j %jael + %m %mall + == + =/ pax + /(scot %p our.hid)/home/(scot %da now.hid)/sys/vane/[vane] + =/ txt .^(@ %cx (weld pax /hoon)) + [/vane/[vane] [%veer v pax txt]] + => .(this ^+(this this)) + =^ ms this (poke-pill pil) + (emit-cards ms) + :: + [%swap-files ~] + =. userspace-ova.pil + =/ slim-dirs=(list path) + ~[/app /gen /lib /mar /sur /hoon/sys /arvo/sys /zuse/sys /age] + :_ ~ + %- unix-event + %- %*(. file-ovum:pill-lib directories slim-dirs) + /(scot %p our.hid)/home/(scot %da now.hid) + =^ ms this (poke-pill pil) + (emit-cards ms) + :: + [%wish hers=* p=@t] + %+ turn-ships ((list ship) hers.val) + |= [who=ship thus=_this] + =. this thus + (wish:(pe who) p.val) + :: + [%unpause-events hers=*] + %+ turn-ships ((list ship) hers.val) + |= [who=ship thus=_this] + =. this thus + start-processing-events:(pe who) + :: + [%pause-events hers=*] + %+ turn-ships ((list ship) hers.val) + |= [who=ship thus=_this] + =. this thus + stop-processing-events:(pe who) + :: + [%clear-snap lab=@tas] + =. fleet-snaps ~ :: (~(del by fleet-snaps) lab.val) + this + == +:: +:: Apply a list of events tagged by ship +:: +++ poke-aqua-events + |= events=(list aqua-event) + ^- (quip card:agent:mall _this) + =. this apex-aqua =< abet-aqua + %+ turn-events events + |= [ae=aqua-event thus=_this] + =. this thus + ?- -.ae + %init-ship + =. this abet-pe:(publish-effect:(pe who.ae) [/ %sleep ~]) + =/ initted + =< plow + %- push-events:apex:(pe who.ae) + ^- (list unix-event) + :~ [/ %wack 0] :: eny + [/ %whom who.ae] :: eny + [//newt/0v1n.2m9vh %barn ~] + [//behn/0v1n.2m9vh %born ~] + :^ //term/1 %boot & + ?~ keys.ae + [%fake who.ae] + [%dawn u.keys.ae] + -.userspace-ova.pil + [//http-client/0v1n.2m9vh %born ~] + [//http-server/0v1n.2m9vh %born ~] + [//http-server/0v1n.2m9vh %live 8.080 `8.445] + == + =. this abet-pe:initted + (pe who.ae) + :: + %pause-events + stop-processing-events:(pe who.ae) + :: + %snap-ships + =. fleet-snaps + %+ ~(put by fleet-snaps) lab.ae + %- malt + %+ murn hers.ae + |= her=ship + ^- (unit (pair ship pier)) + =+ per=(~(get by piers) her) + ?~ per + ~ + `[her u.per] + (pe -.hers.ae) + :: + %restore-snap + =. this + %+ turn-ships (turn ~(tap by piers) head) + |= [who=ship thus=_this] + =. this thus + (publish-effect:(pe who) [/ %sleep ~]) + =. piers (~(uni by piers) (~(got by fleet-snaps) lab.ae)) + =. this + %+ turn-ships (turn ~(tap by piers) head) + |= [who=ship thus=_this] + =. this thus + (publish-effect:(pe who) [/ %restore ~]) + (pe ~bud) :: XX why ~bud? need an example + :: + %event + ~? &(aqua-debug=| !?=(?(%belt %hear) -.q.ue.ae)) + raw-event=[who.ae -.q.ue.ae] + ~? &(debug=| ?=(%receive -.q.ue.ae)) + raw-event=[who.ae ue.ae] + (push-events:(pe who.ae) [ue.ae]~) + == +:: +:: Run a callback function against a list of ships, aggregating state +:: and plowing all ships at the end. +:: +:: I think we should use patterns like this more often. Because we +:: don't, here's some points to be aware. +:: +:: `fun` must take `this` as a parameter, since it needs to be +:: downstream of previous state changes. You could use `state` as +:: the state variable, but it muddles the code and it's not clear +:: whether it's better. You could use the `_(pe)` core if you're +:: sure you'll never need to refer to anything outside of your pier, +:: but I don't think we can guarantee that. +:: +:: The callback function must start with `=. this thus`, or else +:: you don't get the new state. Would be great if you could hot-swap +:: that context in here, but we don't know where to put it unless we +:: restrict the callbacks to always have `this` at a particular axis, +:: and that doesn't feel right +:: +++ turn-plow + |* arg=mold + |= [hers=(list arg) fun=$-([arg _this] _(pe))] + |- ^+ this + ?~ hers + plow-all + =. this + abet-pe:plow:(fun i.hers this) + $(hers t.hers, this this) +:: +++ turn-ships (turn-plow ship) +++ turn-events (turn-plow aqua-event) +:: +:: Check whether we have a snapshot +:: +++ peek + |= =path + ^- (unit (unit cage)) + ?+ path ~ + [%x %fleet-snap @ ~] ``noun+!>((~(has by fleet-snaps) i.t.t.path)) + [%x %ships ~] ``noun+!>((turn ~(tap by piers) head)) + [%x %pill ~] ``pill+!>(pil) + [%x %i @ @ @ @ @ *] + =/ who (slav %p i.t.t.path) + =/ pier (~(get by piers) who) + ?~ pier + ~ + :^ ~ ~ %noun !> + (peek:(pe who) t.t.t.path) + == +:: +:: Trivial scry for mock +:: +++ scry |=([* *] ~) +-- diff --git a/pkg/arvo/app/ph.hoon b/pkg/arvo/app/ph.hoon index 3350eb513..3d6331af2 100644 --- a/pkg/arvo/app/ph.hoon +++ b/pkg/arvo/app/ph.hoon @@ -3,10 +3,6 @@ :: usage: :: :aqua [%run-test %test-add] :: -:: TODO: -:: - Restore a fleet -:: - Compose tests -:: /- aquarium, ph /+ ph, ph-tests, ph-azimuth, ph-philter =, ph-sur=^ph From 303eb634b6770ef5d8d740756bcca76333a1ce13 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 24 Sep 2019 20:21:41 -0700 Subject: [PATCH 149/451] mall: convert ph to mall --- pkg/arvo/age/aqua.hoon | 8 +- pkg/arvo/age/ph.hoon | 582 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 586 insertions(+), 4 deletions(-) create mode 100644 pkg/arvo/age/ph.hoon diff --git a/pkg/arvo/age/aqua.hoon b/pkg/arvo/age/aqua.hoon index 416fda9ca..2d7115e8e 100644 --- a/pkg/arvo/age/aqua.hoon +++ b/pkg/arvo/age/aqua.hoon @@ -41,16 +41,14 @@ processing-events=? == -- -=, gall +:: =; aqua-core =| =all=state ^- agent:mall |_ =bowl:mall +* this . def ~(. default-agent bowl this) - ++ handle-init - `this - :: + ++ handle-init `this ++ handle-extract-state !>(all-state) ++ handle-upgrade-state |= old-state=vase @@ -76,6 +74,8 @@ ++ handle-subscribe |= =path ^- step:agent:mall + ?: ?=([%effects ~] path) + `this ?. ?=([?(%effects %evens %boths) @ ~] path) ~| [%aqua-bad-subscribe-path path] !! diff --git a/pkg/arvo/age/ph.hoon b/pkg/arvo/age/ph.hoon new file mode 100644 index 000000000..face1925a --- /dev/null +++ b/pkg/arvo/age/ph.hoon @@ -0,0 +1,582 @@ +:: Test the pH of your aquarium. See if it's safe to put in real fish. +:: +:: usage: +:: :aqua [%run-test %test-add] +:: +/- aquarium, ph +/+ ph, ph-tests, ph-azimuth, ph-philter, default-agent +=, ph-sur=^ph +=, aquarium +=, ph +=, ph-philter +=> $~ |% + +$ card card:agent:mall + +$ state + $: %0 + test-core=(unit test-core-state) + tests=(map term [(list ship) _*form:(ph ,~)]) + other-state + == + :: + +$ test-core-state + $: lab=term + hers=(list ship) + test=_*form:(ph ,~) + == + :: + +$ other-state + $: test-qeu=(qeu term) + results=(list (pair term ?)) + effect-log=(list [who=ship uf=unix-effect]) + == + -- +:: +=; ph-core + =| =all=state + ^- agent:mall + |_ =bowl:mall + +* this . + def ~(. default-agent bowl this) + ++ handle-init `this + ++ handle-extract-state !>(all-state) + ++ handle-upgrade-state + |= old-state=vase + ^- step:agent:mall + ~& prep=%ph + =. tests.all-state (malt ~(manual-tests ph-core bowl all-state)) + `this + :: + ++ handle-poke + |= [=mark =vase] + ^- step:agent:mall + ?. ?=(%ph-command mark) + (handle-poke:def mark vase) + =^ cards ph-core + (~(poke-ph-command ph-core bowl all-state) !<(cli:ph-sur vase)) + [cards this(all-state +<+.ph-core)] + :: + ++ handle-subscribe + |= =path + ^- step:agent:mall + ?. ?=([%effects ~] path) + ~| [%ph-bad-subscribe-path path] + !! + `this + :: + ++ handle-unsubscribe handle-unsubscribe:def + ++ handle-peek handle-peek:def + ++ handle-agent-response + |= [=wire =gift:agent:mall] + ^- step:agent:mall + ?. ?=([%subscription-update * %aqua-effects *] gift) + (handle-agent-response:def wire gift) + =^ cards ph-core + %+ ~(diff-aqua-effects ph-core bowl all-state) + wire + !<(aqua-effects q.cage.gift) + [cards this(all-state +<+.ph-core)] + :: + ++ handle-arvo-response handle-arvo-response:def + ++ handle-error handle-error:def + -- +:: +=/ vane-apps=(list term) + ~[%aqua-ames %aqua-behn %aqua-dill %aqua-eyre] +|_ $: hid=bowl:mall + state + == +++ this . +++ manual-tests + ^- (list (pair term [(list ship) _*form:(ph ,~)])) + =+ (ph-tests our.hid) + =+ ph-azimuth=(ph-azimuth our.hid) + =/ eth-node (spawn:ph-azimuth ~bud) + =/ m (ph ,~) + :~ :+ %boot-bud + ~[~bud] + (raw-ship ~bud ~) + :: + :+ %add + ~[~bud] + ;< ~ bind:m (raw-ship ~bud ~) + |= pin=ph-input + ?: =(%init -.q.uf.pin) + [& (dojo ~bud "[%test-result (add 2 3)]") %wait ~] + ?: (is-dojo-output ~bud who.pin uf.pin "[%test-result 5]") + [& ~ %done ~] + [& ~ %wait ~] + :: + :+ %hi + ~[~bud ~dev] + ;< ~ bind:m (raw-ship ~bud ~) + ~& > "BUD DONE" + ;< ~ bind:m (raw-ship ~dev ~) + ~& > "DEV DONE" + (send-hi ~bud ~dev) + :: + :+ %boot-planet + ~[~bud ~marbud ~linnup-torsyx] + (planet ~linnup-torsyx) + :: + :+ %second-cousin-hi + ~[~bud ~marbud ~linnup-torsyx ~dev ~mardev ~mitnep-todsut] + ;< ~ bind:m (planet ~linnup-torsyx) + ;< ~ bind:m (planet ~mitnep-todsut) + (send-hi ~linnup-torsyx ~mitnep-todsut) + :: + :+ %change-file + ~[~bud] + ;< ~ bind:m (raw-ship ~bud ~) + ;< file=@t bind:m (touch-file ~bud %home) + (check-file-touched ~bud %home file) + :: + :+ %child-sync + ~[~bud ~marbud] + ;< ~ bind:m (star ~marbud) + ;< file=@t bind:m (touch-file ~bud %base) + (check-file-touched ~marbud %home file) + :: + :+ %boot-az + ~[~bud] + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + (raw-real-ship:eth-node ~bud) + (pure:m ~) + :: + :+ %hi-az + ~[~bud ~dev] + =. eth-node (spawn:eth-node ~dev) + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + ;< ~ bind:m (raw-real-ship:eth-node ~dev) + ~& > %dev-done + ;< ~ bind:m (raw-real-ship:eth-node ~bud) + ~& > %bud-done + (send-hi ~bud ~dev) + (pure:m ~) + :: + :+ %moon-az + ~[~bud ~marbud ~linnup-torsyx ~linnup-torsyx-linnup-torsyx ~dev] + =. eth-node (spawn:eth-node ~marbud) + =. eth-node (spawn:eth-node ~linnup-torsyx) + =. eth-node (spawn:eth-node ~dev) + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + ;< ~ bind:m (raw-real-ship:eth-node ~bud) + ~& > 'BUD DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~marbud) + ~& > 'MARBUD DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~linnup-torsyx) + ~& > 'LINNUP DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~linnup-torsyx-linnup-torsyx) + ~& > 'MOON LINNUP DONE' + ;< ~ bind:m (send-hi ~bud ~linnup-torsyx-linnup-torsyx) + ~& > 'HI DOWN DONE' + ;< ~ bind:m (send-hi ~linnup-torsyx-linnup-torsyx ~marbud) + ~& > 'HI UP DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~dev) + ~& > 'DEV DONE' + ;< ~ bind:m (send-hi ~linnup-torsyx-linnup-torsyx ~dev) + ~& > 'HI OVER UP DONE' + ;< ~ bind:m (send-hi ~dev ~linnup-torsyx-linnup-torsyx) + ~& > 'HI OVER DOWN DONE' + (pure:m ~) + (pure:m ~) + :: + :+ %breach-hi + ~[~bud ~dev] + =. eth-node (spawn:eth-node ~dev) + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + ;< ~ bind:m (raw-real-ship:eth-node ~bud) + ~& > 'BUD DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~dev) + ~& > 'DEV DONE' + (send-hi ~bud ~dev) + ~& > 'HI DONE' + ;< eth-node=_eth-node bind:m + (breach-and-hear:eth-node our.hid ~dev ~bud) + ~& > 'BREACH DONE' + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + ;< ~ bind:m (send-hi-not-responding ~bud ~dev) + ~& > 'HI NOT RESPONDING DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~dev) + ~& > 'REBOOT DEV DONE' + (wait-for-dojo ~bud "hi ~dev successful") + ~& > 'DONE' + (pure:m ~) + :: + :+ %breach-hi-cousin + ~[~bud ~dev ~marbud ~mardev] + =. eth-node (spawn:eth-node ~dev) + =. eth-node (spawn:eth-node ~marbud) + =. eth-node (spawn:eth-node ~mardev) + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + ;< ~ bind:m (raw-real-ship:eth-node ~bud) + ;< ~ bind:m (raw-real-ship:eth-node ~dev) + ;< ~ bind:m (raw-real-ship:eth-node ~marbud) + ;< ~ bind:m (raw-real-ship:eth-node ~mardev) + (send-hi ~marbud ~mardev) + ;< eth-node=_eth-node bind:m + (breach-and-hear:eth-node our.hid ~mardev ~marbud) + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + ;< ~ bind:m (send-hi-not-responding ~marbud ~mardev) + ;< ~ bind:m (raw-real-ship:eth-node ~mardev) + (wait-for-dojo ~marbud "hi ~mardev successful") + (pure:m ~) + :: + :+ %breach-sync + ~[~bud ~marbud] + =. eth-node (spawn:eth-node ~marbud) + =. eth-node (spawn:eth-node ~fipfes) + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + ;< ~ bind:m (raw-real-ship:eth-node ~bud) + ~& > 'BUD DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~marbud) + ~& > 'MARBUD DONE' + ;< file=@t bind:m (touch-file ~bud %base) + ~& > 'TOUCH FILE DONE' + (check-file-touched ~marbud %home file) + ~& > 'TOUCH FILE CHECK DONE' + ;< eth-node=_eth-node bind:m + (breach-and-hear:eth-node our.hid ~bud ~marbud) + ~& > 'BREACH DONE' + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + ;< ~ bind:m (raw-real-ship:eth-node ~bud) + ~& > 'BUD RE DONE' + ;< ~ bind:m (just-events (dojo ~bud "|merge %base ~marbud %kids, =gem %this")) + ~& > 'THIS MERGE STARTED DONE' + ;< file=@t bind:m (touch-file ~bud %base) + ~& > 'TOUCH-1 DONE' + ;< file=@t bind:m (touch-file ~bud %base) + ~& > 'TOUCH-2 DONE' + (check-file-touched ~marbud %home file) + ~& > 'DONE DONE' + (pure:m ~) + :: + :+ %breach-multiple + ~[~bud ~marbud] + =. eth-node (spawn:eth-node ~marbud) + =. eth-node (spawn:eth-node ~fipfes) + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + ;< ~ bind:m (raw-real-ship:eth-node ~bud) + ~& > 'BUD DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~marbud) + ~& > 'MARBUD DONE' + ;< file=@t bind:m (touch-file ~bud %base) + ~& > 'TOUCH DONE' + (check-file-touched ~marbud %home file) + ;< eth-node=_eth-node bind:m + (breach-and-hear:eth-node our.hid ~bud ~marbud) + ~& > 'BREACH-1 DONE' + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + (raw-real-ship:eth-node ~bud) + ~& > 'BUD RE DONE' + ;< eth-node=_eth-node bind:m + (breach-and-hear:eth-node our.hid ~marbud ~bud) + ~& > 'BREACH-2 DONE' + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + ;< ~ bind:m (raw-real-ship:eth-node ~marbud) + ~& > 'MARBUD RE DONE' + ;< file=@t bind:m (touch-file ~bud %base) + ~& > 'TOUCH-1 DONE' + ;< file=@t bind:m (touch-file ~bud %base) + ~& > 'TOUCH-2 DONE' + (check-file-touched ~marbud %home file) + ~& > 'DONE DONE' + (pure:m ~) + :: + :+ %breach-sudden + ~[~bud ~marbud] + =. eth-node (spawn:eth-node ~marbud) + =. eth-node (spawn:eth-node ~fipfes) + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + ;< ~ bind:m (raw-real-ship:eth-node ~bud) + ~& > 'BUD DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~marbud) + ~& > 'MARBUD DONE' + ;< file=@t bind:m (touch-file ~bud %base) + ~& > 'TOUCH FILE DONE' + (check-file-touched ~marbud %home file) + ~& > 'TOUCH FILE CHECK DONE' + =. eth-node (breach:eth-node ~bud) + ~& > 'BREACH EXECUTED' + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + ;< ~ bind:m (raw-real-ship:eth-node ~bud) + ~& > 'BUD RE DONE' + ;< ~ bind:m (just-events (dojo ~bud "|merge %base ~marbud %kids, =gem %this")) + ~& > 'THIS MERGE STARTED DONE' + ;< file=@t bind:m (touch-file ~bud %base) + ~& > 'TOUCH-1 DONE' + ;< file=@t bind:m (touch-file ~bud %base) + ~& > 'TOUCH-2 DONE' + (check-file-touched ~marbud %home file) + ~& > 'DONE DONE' + (pure:m ~) + == +:: +++ publish-aqua-effects + |= afs=aqua-effects + ^- (list card) + [%give %subscription-update `/effects %aqua-effects !>(afs)]~ +:: +++ run-events + |= [lab=term what=(list ph-event)] + ^- (quip card _this) + ?: =(~ what) + `this + =/ res + |- ^- (each (list aqua-event) ?) + ?~ what + [%& ~] + ?: ?=(%test-done -.i.what) + [%| p.i.what] + =/ nex $(what t.what) + ?: ?=(%| -.nex) + nex + [%& `aqua-event`i.what p.nex] + ?: ?=(%| -.res) + =^ cards-1 this (finish-test lab p.res) + =^ cards-2 this run-test + [(weld cards-1 cards-2) this] + [[%pass /running %agent [our.hid %aqua] %poke %aqua-events !>(p.res)]~ this] +:: +:: Cancel subscriptions to ships +:: +++ finish-test + |= [lab=term success=?] + ^- (quip card _this) + ?~ test-core + `this + ~& ?: success + "TEST {(trip lab)} SUCCESSFUL" + "TEST {(trip lab)} FAILED" + :_ this(test-core ~, results [[lab success] results]) + %- zing + %+ turn hers.u.test-core + |= her=ship + ^- (list card) + :~ [%pass /[lab]/(scot %p her) %agent [our.hid %aqua] %unsubscribe ~] + :* %pass + /cancelling + %agent + [our.hid %aqua] + %poke + %aqua-events + !>([%pause-events her]~) + == + == +:: +:: Start another test if one is in the queue +:: +++ run-test + ^- (quip card _this) + ?^ test-core + `this + ?: =(~ test-qeu) + ?~ results + `this + =/ throw-away print-results + `this(results ~) + =^ lab test-qeu ~(get to test-qeu) + ~& [running-test=lab test-qeu] + =. effect-log ~ + =+ ^- [ships=(list ship) test=_*form:(ph ,~)] + (~(got by tests) lab) + => .(test-core `(unit test-core-state)`test-core) + =. test-core `[lab ships test] + =^ cards-1 this (subscribe-to-effects lab ships) + =^ cards-2 this + (diff-aqua-effects /[lab]/(scot %p -.ships) -.ships [/ %init ~]~) + [:(weld init-vanes pause-fleet subscribe-vanes cards-1 cards-2) this] +:: +:: Print results with ~& +:: +++ print-results + ~& "TEST REPORT:" + =/ throw-away + %+ turn + results + |= [lab=term success=?] + ~& "{?:(success "SUCCESS" "FAILURE")}: {(trip lab)}" + ~ + ~& ?: (levy results |=([term s=?] s)) + "ALL TESTS SUCCEEDED" + "FAILURES" + ~ +:: +:: Should check whether we're already subscribed +:: +++ subscribe-to-effects + |= [lab=@tas hers=(list ship)] + :_ this + %+ turn hers + |= her=ship + ^- card + :* %pass + /[lab]/(scot %p her) + %agent + [our.hid %aqua] + %subscribe + /effects/(scot %p her) + == +:: +:: Start the vane drivers +:: +++ init-vanes + ^- (list card) + %+ murn + `(list term)`[%aqua vane-apps] + |= vane-app=term + ^- (unit card) + =/ app-started + .^(? %mu /(scot %p our.hid)/[vane-app]/(scot %da now.hid)) + ?: app-started + ~ + `[%pass /start %agent [our.hid %hood] %poke %drum-start !>([%home vane-app])] +:: +:: Restart the vane drivers' subscriptions +:: +++ subscribe-vanes + ^- (list card) + %+ turn + vane-apps + |= vane-app=term + :* %pass /init + %agent [our.hid vane-app] + %poke %aqua-vane-control + !>(%subscribe) + == +:: +:: Pause all existing ships +:: +++ pause-fleet + ^- (list card) + :_ ~ + :* %pass /pause-fleet + %agent [our.hid %aqua] + %poke %aqua-events !> + %+ turn + .^((list ship) %gx /(scot %p our.hid)/aqua/(scot %da now.hid)/ships/noun) + |= who=ship + [%pause-events who] + == +:: +:: User interface +:: +++ poke-ph-command + |= com=cli:ph-sur + ^- (quip card _this) + ?- -.com + %init [init-vanes this] + %run + ?. (~(has by tests) lab.com) + ~& [%no-test lab.com] + `this + =. test-qeu (~(put to test-qeu) lab.com) + run-test + :: + %cancel + =^ cards-1 this (finish-test %last |) + =. test-qeu ~ + =^ cards-2 this run-test + [:(weld cards-1 cards-2) this] + :: + %run-all + =. test-qeu + %- ~(gas to test-qeu) + (turn manual-tests head) + run-test + :: + %print + ~& lent=(lent effect-log) + ~& %+ roll effect-log + |= [[who=ship uf=unix-effect] ~] + ?: ?=(?(%blit %doze) -.q.uf) + ~ + ?: ?=(%ergo -.q.uf) + ~& [who [- +<]:uf %omitted-by-ph] + ~ + ~& [who uf] + ~ + `this + == +:: +:: Receive effects back from aqua +:: +++ diff-aqua-effects + |= [way=wire afs=aqua-effects] + ^- (quip card _this) + :: ~& [%diff-aqua-effect way who.afs] + ?> ?=([@tas @ ~] way) + =/ lab i.way + ?~ test-core + ~& [%ph-dropping-done lab] + [[%pass way %agent [our.hid %aqua] %unsubscribe ~]~ this] + ?. =(lab lab.u.test-core) + ~& [%ph-dropping-strange lab] + [[%pass way %agent [our.hid %aqua] %unsubscribe ~]~ this] + =+ |- ^- $: thru-effects=(list unix-effect) + events=(list ph-event) + log=_effect-log + done=(unit ?) + test=_test.u.test-core + == + ?~ ufs.afs + [~ ~ ~ ~ test.u.test-core] + =/ m-res=_*output:(ph ,~) + (test.u.test-core now.hid who.afs i.ufs.afs) + =? ufs.afs =(%cont -.next.m-res) + [i.ufs.afs [/ %init ~] t.ufs.afs] + =^ done=(unit ?) test.u.test-core + ?- -.next.m-res + %wait [~ test.u.test-core] + %cont [~ self.next.m-res] + %fail [`| test.u.test-core] + %done [`& test.u.test-core] + == + =+ ^- _$ + ?~ done + $(ufs.afs t.ufs.afs) + [~ ~ ~ done test.u.test-core] + :^ ?: thru.m-res + [i.ufs.afs thru-effects] + thru-effects + (weld events.m-res events) + [[who i.ufs]:afs log] + [done test] + =. test.u.test-core test + =. effect-log (weld log effect-log) + => .(test-core `(unit test-core-state)`test-core) + ?^ done + =^ cards-1 this (finish-test lab u.done) + =^ cards-2 this run-test + [(weld cards-1 cards-2) this] + =/ cards-1 (publish-aqua-effects who.afs thru-effects) + =^ cards-2 this (run-events lab events) + [(weld cards-1 cards-2) this] +-- From e6f5b0d3fd8ba9fe167ce7eb0d7900ba4c54bd39 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 25 Sep 2019 13:19:09 -0700 Subject: [PATCH 150/451] mall: fix %child-sync ph test --- bin/solid.pill | 4 ++-- pkg/arvo/age/aqua-ames.hoon | 2 +- pkg/arvo/age/aqua.hoon | 10 +++++----- pkg/arvo/age/ph.hoon | 13 ++++++++----- pkg/arvo/lib/default-agent.hoon | 5 +---- pkg/arvo/lib/ph/tests.hoon | 5 ++++- pkg/arvo/lib/ph/util.hoon | 2 +- pkg/arvo/sys/arvo.hoon | 2 +- pkg/arvo/sys/hoon.hoon | 2 +- pkg/arvo/sys/vane/behn.hoon | 1 + pkg/arvo/sys/vane/mall.hoon | 12 +++++++++++- 11 files changed, 36 insertions(+), 22 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 62bc5a016..74e238288 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ed76a74e19d04666431b99f8cfc74d370f48e726ecf1aa82f4da7a4f1b97846a -size 16241615 +oid sha256:e77bbe0897bca5b85d6ffeeafe76dd6b746832795ba300743a3049814e5f75b9 +size 16357755 diff --git a/pkg/arvo/age/aqua-ames.hoon b/pkg/arvo/age/aqua-ames.hoon index 3ab41d349..98c7d06e1 100644 --- a/pkg/arvo/age/aqua-ames.hoon +++ b/pkg/arvo/age/aqua-ames.hoon @@ -27,7 +27,7 @@ ^- (quip card:agent:mall _ships) =/ hear [//newt/0v1n.2m9vh %hear lan pac] =? ships =(~ ships) - .^((list ship) %gx /(scot %p our)/aqua/(scot %da now)/ships/noun) + .^((list ship) %mx /(scot %p our)/aqua/(scot %da now)/ships/noun) :_ ships %+ emit-aqua-events our %+ turn ships diff --git a/pkg/arvo/age/aqua.hoon b/pkg/arvo/age/aqua.hoon index 2d7115e8e..fa36e31b3 100644 --- a/pkg/arvo/age/aqua.hoon +++ b/pkg/arvo/age/aqua.hoon @@ -65,7 +65,7 @@ =^ cards aqua-core =/ t ~(. aqua-core bowl all-state) ?+ mark ~|([%aqua-bad-mark mark] !!) - %aqua-events (poke-aqua-events:t !<((list aqua-event) vase)) + %aqua-events ~|(p.vase (poke-aqua-events:t !<((list aqua-event) vase))) %pill (poke-pill:t !<(pill vase)) %noun (poke-noun:t !<(* vase)) == @@ -253,28 +253,28 @@ %- emit-cards %+ turn ~(tap by unix-effects) |= [=ship ufs=(list unix-effect)] - [%give %subscription-update `path %aqua-effects !>((flop ufs))] + [%give %subscription-update `path %aqua-effects !>(`aqua-effects`[ship (flop ufs)])] :: =. this %- emit-cards %+ turn ~(tap by unix-effects) |= [=ship ufs=(list unix-effect)] =/ =path /effects/(scot %p ship) - [%give %subscription-update `path %aqua-effects !>((flop ufs))] + [%give %subscription-update `path %aqua-effects !>(`aqua-effects`[ship (flop ufs)])] :: =. this %- emit-cards %+ turn ~(tap by unix-events) |= [=ship ve=(list unix-timed-event)] =/ =path /events/(scot %p ship) - [%give %subscription-update `path %aqua-events !>((flop ve))] + [%give %subscription-update `path %aqua-events !>(`aqua-events`[ship (flop ve)])] :: =. this %- emit-cards %+ turn ~(tap by unix-boths) |= [=ship bo=(list unix-both)] =/ =path /boths/(scot %p ship) - [%give %subscription-update `path %aqua-boths !>((flop bo))] + [%give %subscription-update `path %aqua-boths !>(`aqua-boths`[ship (flop bo)])] :: [(flop cards) this] :: diff --git a/pkg/arvo/age/ph.hoon b/pkg/arvo/age/ph.hoon index face1925a..e402b67b0 100644 --- a/pkg/arvo/age/ph.hoon +++ b/pkg/arvo/age/ph.hoon @@ -37,14 +37,15 @@ |_ =bowl:mall +* this . def ~(. default-agent bowl this) - ++ handle-init `this + ++ handle-init + ~& prep=%ph + =. tests.all-state (malt ~(manual-tests ph-core bowl all-state)) + `this ++ handle-extract-state !>(all-state) ++ handle-upgrade-state |= old-state=vase ^- step:agent:mall - ~& prep=%ph - =. tests.all-state (malt ~(manual-tests ph-core bowl all-state)) - `this + handle-init :: ++ handle-poke |= [=mark =vase] @@ -133,7 +134,9 @@ :+ %child-sync ~[~bud ~marbud] ;< ~ bind:m (star ~marbud) + ~& > 'MARBUD DONE' ;< file=@t bind:m (touch-file ~bud %base) + ~& > 'TOUCH DONE' (check-file-touched ~marbud %home file) :: :+ %boot-az @@ -481,7 +484,7 @@ %agent [our.hid %aqua] %poke %aqua-events !> %+ turn - .^((list ship) %gx /(scot %p our.hid)/aqua/(scot %da now.hid)/ships/noun) + .^((list ship) %mx /(scot %p our.hid)/aqua/(scot %da now.hid)/ships/noun) |= who=ship [%pause-events who] == diff --git a/pkg/arvo/lib/default-agent.hoon b/pkg/arvo/lib/default-agent.hoon index 71d85f8f1..bb25529a4 100644 --- a/pkg/arvo/lib/default-agent.hoon +++ b/pkg/arvo/lib/default-agent.hoon @@ -46,10 +46,7 @@ %- (slog tank u.p.gift) `agent :: - %subscription-close - ~| "unexpected subscription closure to {} on wire {}" - !! - :: + %subscription-close `agent %subscription-update ~| "unexpected subscription update to {} on wire {}" ~| "with mark {}" diff --git a/pkg/arvo/lib/ph/tests.hoon b/pkg/arvo/lib/ph/tests.hoon index f15e34a2c..c35ca2022 100644 --- a/pkg/arvo/lib/ph/tests.hoon +++ b/pkg/arvo/lib/ph/tests.hoon @@ -162,7 +162,10 @@ ;< ~ bind:m (mount her des) ^- form:m |= pin=ph-input - ?. &(=(her who.pin) ?=(?(%init %ergo) -.q.uf.pin)) + :: %ergo is no longer sufficient because .^ is pinned to beginning of + :: the event. So we hope somebody sets a timer for something. + :: + ?. &(=(her who.pin) ?=(?(%init %ergo %doze) -.q.uf.pin)) [& ~ %wait ~] =/ pax /sur/aquarium/hoon =/ aqua-pax diff --git a/pkg/arvo/lib/ph/util.hoon b/pkg/arvo/lib/ph/util.hoon index 16b8d5589..b5f5cad08 100644 --- a/pkg/arvo/lib/ph/util.hoon +++ b/pkg/arvo/lib/ph/util.hoon @@ -92,7 +92,7 @@ ++ scry-aqua |* [a=mold our=@p now=@da pax=path] .^ a - %gx + %mx (scot %p our) %aqua (scot %da now) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index d6955f306..657426e22 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -716,7 +716,7 @@ |- ?- -.res %0 p.res - %1 $(res [%2 leaf+"blocked" >p.res< ~]) + %1 $(res [%2 leaf+"blocked" >((list path) p.res)< ~]) %2 ~_ leaf+"deterministic error" |- diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index b43f110a1..48afd1607 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -11557,7 +11557,7 @@ ++ onan seer :: $-(vise vase) ++ levi :: $-([type type] ?) |= [a=type b=type] - (~(nest ut a) | b) + (~(nest ut a) & b) :: ++ text :: tape pretty-print |= vax/vase ^- tape diff --git a/pkg/arvo/sys/vane/behn.hoon b/pkg/arvo/sys/vane/behn.hoon index 1521daff9..78877ef97 100644 --- a/pkg/arvo/sys/vane/behn.hoon +++ b/pkg/arvo/sys/vane/behn.hoon @@ -91,6 +91,7 @@ =. movs.drips.state (~(del by movs.drips.state) num) ?^ error :: if we errored, drop it + %- (slog leaf/"drip failed" u.error) event-core event-core(moves [duct %give %meta drip]~) :: +vega: learn of a kernel upgrade diff --git a/pkg/arvo/sys/vane/mall.hoon b/pkg/arvo/sys/vane/mall.hoon index 9725c959d..f6ba08980 100644 --- a/pkg/arvo/sys/vane/mall.hoon +++ b/pkg/arvo/sys/vane/mall.hoon @@ -1068,6 +1068,17 @@ |= [=term tyl=path] ^- (unit (unit cage)) :: + =/ marked + ?. ?=(%x term) + [mark=%$ tyl=tyl] + :: + =/ =path (flop tyl) + ?> ?=(^ path) + [mark=i.path tyl=(flop t.path)] + :: + =/ =mark mark.marked + =/ tyl tyl.marked + :: =/ peek-result=(each (unit (unit cage)) tang) (mule |.((handle-peek:ap-agent-core [term tyl]))) :: @@ -1087,7 +1098,6 @@ ?: is-ok =/ =note:agent [%agent [ship -.path] %pump ~] (ap-pass way note) - ~& > %agent-update-failed =. ap-core (ap-specific-take path %subscription-close ~ ~) =/ =note:agent [%agent [ship -.path] %unsubscribe ~] (ap-pass way note) From 45451aeafa6e9dd23dc0447d5cf63dc40b7fe712 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 25 Sep 2019 21:12:58 -0700 Subject: [PATCH 151/451] spider: initial commit --- pkg/arvo/age/spider.hoon | 142 ++++++++++++++++++++++++++++++ pkg/arvo/gen/spider/poke.hoon | 3 + pkg/arvo/gen/spider/start.hoon | 3 + pkg/arvo/lib/thread.hoon | 153 +++++++++++++++++++++++++++++++++ pkg/arvo/lib/threadio.hoon | 68 +++++++++++++++ 5 files changed, 369 insertions(+) create mode 100644 pkg/arvo/age/spider.hoon create mode 100644 pkg/arvo/gen/spider/poke.hoon create mode 100644 pkg/arvo/gen/spider/start.hoon create mode 100644 pkg/arvo/lib/thread.hoon create mode 100644 pkg/arvo/lib/threadio.hoon diff --git a/pkg/arvo/age/spider.hoon b/pkg/arvo/age/spider.hoon new file mode 100644 index 000000000..528b51ffb --- /dev/null +++ b/pkg/arvo/age/spider.hoon @@ -0,0 +1,142 @@ +/+ libthread=thread, threadio, default-agent +=, thread=thread:libthread +~! thread +|% ++$ card card:agent:mall ++$ state (map imp-name _*eval-form:[~!(. eval)]:(thread ,~)) ++$ imp $-(bowl:mall _*form:(thread ,~)) ++$ imp-name term ++$ imput [=imp-name =cage] +-- +^- agent:mall +=; spider-core + =| =state + |_ =bowl:mall + +* this . + sc ~(. spider-core bowl state) + def ~(. default-agent bowl this) + :: + ++ handle-init handle-init:def + ++ handle-extract-state handle-extract-state:def + ++ handle-upgrade-state handle-upgrade-state:def + ++ handle-poke + |= [=mark =vase] + ^- (quip card _this) + =^ cards state + ?+ mark (handle-poke:def mark vase) + %spider-imput (handle-poke-imput:sc !<(imput vase)) + %spider-start (handle-start-imp:sc !<(imp-name vase)) + == + [cards this] + :: + ++ handle-subscribe handle-subscribe:def + ++ handle-unsubscribe handle-unsubscribe:def + ++ handle-peek handle-peek:def + ++ handle-agent-response handle-agent-response:def + ++ handle-arvo-response + |= [=wire =sign-arvo] + ^- (quip card _this) + =^ cards state + ?+ wire (handle-arvo-response:def wire sign-arvo) + [%imp @ *] (handle-sign:sc i.t.wire t.t.wire sign-arvo) + == + [cards this] + ++ handle-error handle-error:def + -- +:: +|_ [=bowl:mall =state] +++ handle-poke-imput + |= imput + (take-input imp-name ~ %poke cage) +:: +++ handle-sign + |= [=imp-name =wire =sign-arvo] + (take-input imp-name ~ %sign wire sign-arvo) +:: +++ handle-start-imp + |= =imp-name + ^- (quip card ^state) + ?: (~(has by state) imp-name) + ~| [%already-started imp-name] + !! + ?. (~(has by imps) imp-name) + ~| [%imp-not-found imp-name] + !! + =/ m (thread ,~) + =/ =eval-form:eval:m + %- from-form:eval:m + ((~(got by imps) imp-name) bowl) + =. state (~(put by state) imp-name eval-form) + (take-input imp-name ~) +:: +++ take-input + |= [=imp-name input=(unit input:thread)] + ^- (quip card ^state) + =/ m (thread ,~) + =/ =eval-form:eval:m + ~| [%no-imp imp-name] + (~(got by state) imp-name) + =| cards=(list card) + |- ^- (quip card ^state) + =^ r=[cards=(list card) =eval-result:eval:m] eval-form + =/ out + %- mule |. + (take:eval:m eval-form bowl input) + ?- -.out + %& p.out + %| [[~ [%fail %crash p.out]] eval-form] + == + =. state (~(put by state) imp-name eval-form) + =. cards.r + %+ turn cards.r + |= =card + ^- ^card + ?+ card card + [%pass * *] [%pass [%imp imp-name p.card] q.card] + [%give %subscription-update *] + ?~ path.p.card + card + card(path.p `[%imp imp-name u.path.p.card]) + :: + [%give %subscription-close *] + ?~ path.p.card + card + card(path.p `[%imp imp-name u.path.p.card]) + == + =. cards (weld cards cards.r) + =^ final-cards=(list card) state + ?- -.eval-result.r + %next `state + %fail (imp-fail imp-name err.eval-result.r) + %done (imp-done imp-name) + == + [(weld cards final-cards) state] +:: +++ imp-fail + |= [=imp-name =term =tang] + ^- (quip card ^state) + %- (slog leaf+"thread {} failed" leaf+ tang) + `(~(del by state) imp-name) +:: +++ imp-done + |= =imp-name + ^- (quip card ^state) + %- (slog leaf+"thread {} finished" ~) + `(~(del by state) imp-name) +:: +++ imps + %- malt + ^- (list [imp-name imp]) + |^ + :~ [%first-imp first-imp] + == + :: + ++ first-imp + ^- imp + |= bowl:mall + =/ m (thread ,~) + ^- form:m + ;< ~ bind:m echo:threadio + (pure:m ~) + -- +-- diff --git a/pkg/arvo/gen/spider/poke.hoon b/pkg/arvo/gen/spider/poke.hoon new file mode 100644 index 000000000..d906b066e --- /dev/null +++ b/pkg/arvo/gen/spider/poke.hoon @@ -0,0 +1,3 @@ +:- %say +|= [* [=term =mark =vase ~] ~] +[%spider-imput term mark vase] diff --git a/pkg/arvo/gen/spider/start.hoon b/pkg/arvo/gen/spider/start.hoon new file mode 100644 index 000000000..941a7ca59 --- /dev/null +++ b/pkg/arvo/gen/spider/start.hoon @@ -0,0 +1,3 @@ +:- %say +|= [* [=term ~] ~] +[%spider-start term] diff --git a/pkg/arvo/lib/thread.hoon b/pkg/arvo/lib/thread.hoon new file mode 100644 index 000000000..53f4ce8d8 --- /dev/null +++ b/pkg/arvo/lib/thread.hoon @@ -0,0 +1,153 @@ +|% ++$ card card:agent:mall ++$ input + $% [%poke =cage] + [%sign =wire =sign-arvo] + == ++$ thread-input [=bowl:mall in=(unit input)] +:: +:: cards: cards to send immediately. These will go out even if a +:: later stage of the computation fails, so they shouldn't have +:: any semantic effect on the rest of the system. +:: Alternately, they may record an entry in contracts with +:: enough information to undo the effect if the computation +:: fails. +:: wait: don't move on, stay here. The next sign should come back +:: to this same callback. +:: skip: didn't expect this input; drop it down to be handled +:: elsewhere +:: cont: continue computation with new callback. +:: fail: abort computation; don't send effects +:: done: finish computation; send effects +:: +++ thread-output-raw + |* a=mold + $~ [~ %done *a] + $: cards=(list card) + $= next + $% [%wait ~] + [%skip ~] + [%cont self=(thread-form-raw a)] + [%fail err=(pair term tang)] + [%done value=a] + == + == +:: +++ thread-form-raw + |* a=mold + $-(thread-input (thread-output-raw a)) +:: +:: Abort thread computation with error message +:: +++ thread-fail + |= err=(pair term tang) + |= thread-input + [~ ~ ~ %fail err] +:: +:: Asynchronous transcaction monad. +:: +:: Combo of four monads: +:: - Reader on input +:: - Writer on card +:: - Continuation +:: - Exception +:: +++ thread + |* a=mold + |% + ++ output (thread-output-raw a) + :: + :: Type of an thread computation. + :: + ++ form (thread-form-raw a) + :: + :: Monadic pure. Identity computation for bind. + :: + ++ pure + |= arg=a + ^- form + |= thread-input + [~ %done arg] + :: + :: Monadic bind. Combines two computations, associatively. + :: + ++ bind + |* b=mold + |= [m-b=(thread-form-raw b) fun=$-(b form)] + ^- form + |= input=thread-input + =/ b-res=(thread-output-raw b) + (m-b input) + ^- output + :- cards.b-res + ?- -.next.b-res + %wait [%wait ~] + %skip ~|(%bind-got-skip !!) + %cont [%cont ..$(m-b self.next.b-res)] + %fail [%fail err.next.b-res] + %done [%cont (fun value.next.b-res)] + == + :: + :: The thread monad must be evaluted in a particular way to maintain + :: its monadic character. +take:eval implements this. + :: + ++ eval + |% + :: Indelible state of a thread + :: + +$ eval-form + $: =form + == + :: + :: Convert initial form to eval-form + :: + ++ from-form + |= =form + ^- eval-form + form + :: + :: The cases of results of +take + :: + +$ eval-result + $% [%next ~] + [%fail err=(pair term tang)] + [%done value=a] + == + :: + :: Take a new sign and run the thread against it + :: + ++ take + :: cards: accumulate throughout recursion the cards to be + :: produced now + =| cards=(list card) + |= [=eval-form =thread-input] + ^- [[(list card) =eval-result] _eval-form] + =* take-loop $ + :: run the thread callback + :: + =/ =output (form.eval-form thread-input) + :: add cards to cards + :: + =. cards + %+ welp + cards + :: XX add tag to wires? + cards.output + :: case-wise handle next steps + :: + ?- -.next.output + %wait [[cards %next ~] eval-form] + %skip ~|(%take-got-skip !!) + %fail [[cards %fail err.next.output] eval-form] + %done [[cards %done value.next.output] eval-form] + %cont + :: recurse to run continuation with initialization input + :: + %_ take-loop + form.eval-form self.next.output + thread-input [bowl.thread-input ~] + == + == + -- + -- +-- diff --git a/pkg/arvo/lib/threadio.hoon b/pkg/arvo/lib/threadio.hoon new file mode 100644 index 000000000..cd2283a95 --- /dev/null +++ b/pkg/arvo/lib/threadio.hoon @@ -0,0 +1,68 @@ +/+ libthread=thread +=, thread=thread:libthread +|% +++ send-raw-card + |= =card:agent:mall + =/ m (thread ,~) + ^- form:m + |= thread-input:thread + [[card ~] %done ~] +:: +++ get-time + =/ m (thread ,@da) + ^- form:m + |= tin=thread-input:thread + `[%done now.bowl.tin] +:: +++ take-poke + |= =mark + =/ m (thread ,vase) + ^- form:m + |= tin=thread-input:thread + ?+ in.tin `[%skip ~] + ~ `[%wait ~] + [~ %poke @ *] + ?. =(mark p.cage.u.in.tin) + `[%skip ~] + `[%done q.cage.u.in.tin] + == +:: +++ echo + =/ m (thread ,~) + ^- form:m + ;< =vase bind:m (take-poke %echo) + =/ message=tape !<(tape vase) + %- (slog leaf/"{message}..." ~) + ;< ~ bind:m (sleep ~s2) + %- (slog leaf/"{message}.." ~) + echo +:: +++ take-wake + |= until=@da + =/ m (thread ,~) + ^- form:m + |= tin=thread-input:thread + ?+ in.tin `[%skip ~] + ~ `[%wait ~] + [~ %sign [%wait @ ~] %b %wake *] + ?. =(`until (slaw %da i.t.wire.u.in.tin)) + `[%skip ~] + `[%done ~] + == +:: +++ wait + |= until=@da + =/ m (thread ,~) + ^- form:m + =/ =card:agent:mall + [%pass /wait/(scot %da until) %arvo %b %wait until] + ;< ~ bind:m (send-raw-card card) + (take-wake until) +:: +++ sleep + |= for=@dr + =/ m (thread ,~) + ^- form:m + ;< now=@da bind:m get-time + (wait (add now for)) +-- From 814d97fafdb87c7b3bfdbd03c4a76888d69836dc Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 25 Sep 2019 22:43:14 -0700 Subject: [PATCH 152/451] spider: add +main-loop --- pkg/arvo/lib/thread.hoon | 2 +- pkg/arvo/lib/threadio.hoon | 77 +++++++++++++++++++++++++++++++++++--- 2 files changed, 72 insertions(+), 7 deletions(-) diff --git a/pkg/arvo/lib/thread.hoon b/pkg/arvo/lib/thread.hoon index 53f4ce8d8..d39fa965e 100644 --- a/pkg/arvo/lib/thread.hoon +++ b/pkg/arvo/lib/thread.hoon @@ -82,7 +82,7 @@ :- cards.b-res ?- -.next.b-res %wait [%wait ~] - %skip ~|(%bind-got-skip !!) + %skip [%skip ~] %cont [%cont ..$(m-b self.next.b-res)] %fail [%fail err.next.b-res] %done [%cont (fun value.next.b-res)] diff --git a/pkg/arvo/lib/threadio.hoon b/pkg/arvo/lib/threadio.hoon index cd2283a95..0ded19f36 100644 --- a/pkg/arvo/lib/threadio.hoon +++ b/pkg/arvo/lib/threadio.hoon @@ -14,6 +14,19 @@ |= tin=thread-input:thread `[%done now.bowl.tin] :: +++ handle-poke + |= =mark + =/ m (thread ,vase) + ^- form:m + |= tin=thread-input:thread + ?+ in.tin `[%fail %ignore ~] + ~ `[%wait ~] + [~ %poke @ *] + ?. =(mark p.cage.u.in.tin) + `[%fail %ignore ~] + `[%done q.cage.u.in.tin] + == +:: ++ take-poke |= =mark =/ m (thread ,vase) @@ -30,12 +43,18 @@ ++ echo =/ m (thread ,~) ^- form:m - ;< =vase bind:m (take-poke %echo) - =/ message=tape !<(tape vase) - %- (slog leaf/"{message}..." ~) - ;< ~ bind:m (sleep ~s2) - %- (slog leaf/"{message}.." ~) - echo + ;: (main-loop ,~) + ;< =vase bind:m (handle-poke %echo) + =/ message=tape !<(tape vase) + %- (slog leaf/"{message}..." ~) + ;< ~ bind:m (sleep ~s2) + %- (slog leaf/"{message}.." ~) + (pure:m ~) + :: + ;< =vase bind:m (handle-poke %over) + %- (slog leaf/"over..." ~) + (pure:m ~) + == :: ++ take-wake |= until=@da @@ -65,4 +84,50 @@ ^- form:m ;< now=@da bind:m get-time (wait (add now for)) +:: +:: Queue on skip, try next on fail %ignore +:: +++ main-loop + |* a=mold + =/ m (thread ,a) + =| queue=(qeu (unit input:thread)) + =| active=(unit [?(%one %two) =form:m]) + |= [one=form:m two=form:m] + ^- form:m + |= tin=thread-input:thread + =* top `form:m`..$ + =. queue (~(put to queue) in.tin) + |^ (continue bowl.tin) + :: + ++ continue + |= =bowl:mall + ^- output:m + ?> =(~ active) + ?: =(~ queue) + `[%cont top] + =^ in=(unit input:thread) queue ~(get to queue) + ^- output:m + =. active `one+one + ^- output:m + (run bowl in) + :: + ++ run + ^- form:m + |= tin=thread-input:thread + ^- output:m + ?> ?=(^ active) + =/ res (form.u.active tin) + =/ =output:m + ?- -.next.res + %wait `[%wait ~] + %skip `[%cont ..$(queue (~(put to queue) in.tin))] + %cont `[%cont ..$(active `one+self.next.res)] + %done (continue(active ~) bowl.tin) + %fail + ?: &(?=(%one -.u.active) ?=(%ignore p.err.next.res)) + $(active `two+two) + `[%fail err.next.res] + == + [(weld cards.res cards.output) next.output] + -- -- From 957aa99d9f4a49b5bae7b31f92c0861328ce5b59 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 26 Sep 2019 12:00:11 -0700 Subject: [PATCH 153/451] spider: build imps in ford --- pkg/arvo/age/spider.hoon | 66 +++++++++++++++++++--------------- pkg/arvo/gen/spider/start.hoon | 4 +-- pkg/arvo/sur/spider.hoon | 5 +++ 3 files changed, 45 insertions(+), 30 deletions(-) create mode 100644 pkg/arvo/sur/spider.hoon diff --git a/pkg/arvo/age/spider.hoon b/pkg/arvo/age/spider.hoon index 528b51ffb..58fd211be 100644 --- a/pkg/arvo/age/spider.hoon +++ b/pkg/arvo/age/spider.hoon @@ -1,10 +1,10 @@ -/+ libthread=thread, threadio, default-agent +/- spider +/+ libthread=thread, default-agent =, thread=thread:libthread -~! thread |% +$ card card:agent:mall +$ state (map imp-name _*eval-form:[~!(. eval)]:(thread ,~)) -+$ imp $-(bowl:mall _*form:(thread ,~)) ++$ imp imp:spider +$ imp-name term +$ imput [=imp-name =cage] -- @@ -25,7 +25,7 @@ =^ cards state ?+ mark (handle-poke:def mark vase) %spider-imput (handle-poke-imput:sc !<(imput vase)) - %spider-start (handle-start-imp:sc !<(imp-name vase)) + %spider-start (handle-start-imp:sc !<([imp-name path] vase)) == [cards this] :: @@ -38,7 +38,8 @@ ^- (quip card _this) =^ cards state ?+ wire (handle-arvo-response:def wire sign-arvo) - [%imp @ *] (handle-sign:sc i.t.wire t.t.wire sign-arvo) + [%imp @ *] (handle-sign:sc i.t.wire t.t.wire sign-arvo) + [%build @ ~] (handle-build:sc i.t.wire sign-arvo) == [cards this] ++ handle-error handle-error:def @@ -54,18 +55,43 @@ (take-input imp-name ~ %sign wire sign-arvo) :: ++ handle-start-imp - |= =imp-name + |= [=imp-name =path] ^- (quip card ^state) ?: (~(has by state) imp-name) ~| [%already-started imp-name] !! - ?. (~(has by imps) imp-name) - ~| [%imp-not-found imp-name] - !! + =/ =card + =/ =beam (need (de-beam:format path)) + =/ =schematic:ford [%core [p q]:beam hoon+s.beam] + [%pass /build/[imp-name] %arvo %f %build live=%.y schematic] + [[card ~] state] +:: +++ handle-build + |= [=imp-name =sign-arvo] + ^- (quip card ^state) + ?> ?=([%f %made *] sign-arvo) + ?: ?=(%incomplete -.result.sign-arvo) + %- (slog leaf/"{} build incomplete" tang.result.sign-arvo) + `state + =/ =build-result:ford build-result.result.sign-arvo + ?: ?=(%error -.build-result) + %- (slog leaf/"{} build error" message.build-result) + `state + =/ =cage (result-to-cage:ford build-result) + ?. ?=(%noun p.cage) + %- (slog leaf/"{} build not noun, is {}" ~) + `state + =/ maybe-imp (mule |.(!<(imp q.cage))) + ?: ?=(%| -.maybe-imp) + %- (slog leaf/"{} not valid imp" p.maybe-imp) + `state + (start-imp imp-name p.maybe-imp) +:: +++ start-imp + |= [=imp-name =imp] + ^- (quip card ^state) =/ m (thread ,~) - =/ =eval-form:eval:m - %- from-form:eval:m - ((~(got by imps) imp-name) bowl) + =/ =eval-form:eval:m (from-form:eval:m (imp bowl)) =. state (~(put by state) imp-name eval-form) (take-input imp-name ~) :: @@ -123,20 +149,4 @@ ^- (quip card ^state) %- (slog leaf+"thread {} finished" ~) `(~(del by state) imp-name) -:: -++ imps - %- malt - ^- (list [imp-name imp]) - |^ - :~ [%first-imp first-imp] - == - :: - ++ first-imp - ^- imp - |= bowl:mall - =/ m (thread ,~) - ^- form:m - ;< ~ bind:m echo:threadio - (pure:m ~) - -- -- diff --git a/pkg/arvo/gen/spider/start.hoon b/pkg/arvo/gen/spider/start.hoon index 941a7ca59..9953d463f 100644 --- a/pkg/arvo/gen/spider/start.hoon +++ b/pkg/arvo/gen/spider/start.hoon @@ -1,3 +1,3 @@ :- %say -|= [* [=term ~] ~] -[%spider-start term] +|= [* [=term =path ~] ~] +[%spider-start term path] diff --git a/pkg/arvo/sur/spider.hoon b/pkg/arvo/sur/spider.hoon new file mode 100644 index 000000000..79978eda3 --- /dev/null +++ b/pkg/arvo/sur/spider.hoon @@ -0,0 +1,5 @@ +/+ libthread=thread +=, thread=thread:libthread +|% ++$ imp $-(bowl:mall _*form:(thread ,~)) +-- From 7dcce421e743a71db3f153afbc98feab13463b34 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 26 Sep 2019 12:13:01 -0700 Subject: [PATCH 154/451] spider: move imps to /imp --- pkg/arvo/age/spider.hoon | 7 +++---- pkg/arvo/gen/spider/start.hoon | 4 ++-- pkg/arvo/imp/first.hoon | 9 +++++++++ 3 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 pkg/arvo/imp/first.hoon diff --git a/pkg/arvo/age/spider.hoon b/pkg/arvo/age/spider.hoon index 58fd211be..a7da61cca 100644 --- a/pkg/arvo/age/spider.hoon +++ b/pkg/arvo/age/spider.hoon @@ -25,7 +25,7 @@ =^ cards state ?+ mark (handle-poke:def mark vase) %spider-imput (handle-poke-imput:sc !<(imput vase)) - %spider-start (handle-start-imp:sc !<([imp-name path] vase)) + %spider-start (handle-start-imp:sc !<([imp-name term] vase)) == [cards this] :: @@ -55,14 +55,13 @@ (take-input imp-name ~ %sign wire sign-arvo) :: ++ handle-start-imp - |= [=imp-name =path] + |= [=imp-name =term] ^- (quip card ^state) ?: (~(has by state) imp-name) ~| [%already-started imp-name] !! =/ =card - =/ =beam (need (de-beam:format path)) - =/ =schematic:ford [%core [p q]:beam hoon+s.beam] + =/ =schematic:ford [%core [our.bowl %home] /hoon/[term]/imp] [%pass /build/[imp-name] %arvo %f %build live=%.y schematic] [[card ~] state] :: diff --git a/pkg/arvo/gen/spider/start.hoon b/pkg/arvo/gen/spider/start.hoon index 9953d463f..61f33890f 100644 --- a/pkg/arvo/gen/spider/start.hoon +++ b/pkg/arvo/gen/spider/start.hoon @@ -1,3 +1,3 @@ :- %say -|= [* [=term =path ~] ~] -[%spider-start term path] +|= [* [name=term where=term ~] ~] +[%spider-start name where] diff --git a/pkg/arvo/imp/first.hoon b/pkg/arvo/imp/first.hoon new file mode 100644 index 000000000..006fc8b71 --- /dev/null +++ b/pkg/arvo/imp/first.hoon @@ -0,0 +1,9 @@ +/- spider +/+ threadio +=, thread=thread:spider +^- imp:spider +|= bowl:mall +=/ m (thread ,~) +^- form:m +;< ~ bind:m echo:threadio +(pure:m ~) From 087adacc15156c725ea4bb101a6ad093326e2fcd Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 27 Sep 2019 07:45:22 -0400 Subject: [PATCH 155/451] alef: reno-style congestion control (todo: misordered acks) --- pkg/arvo/sys/vane/alef.hoon | 350 +++++++++++++++++------------------- 1 file changed, 163 insertions(+), 187 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index e8feabcd2..815ad73a5 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -160,6 +160,24 @@ ?: |(?=(~ rest.l) (mor key.n.a key.n.rest.l)) a(l rest.l) rest.l(r a(r r.rest.l)) + :: +del: delete .key from .a if it exists, producing value iff deleted + :: + ++ del + |= [a=(tree item) =key] + ^- [(unit val) (tree item)] + :: + ?~ a [~ ~] + :: we found .key at the root; delete and rebalance + :: + ?: =(key key.n.a) + [`val.n.a (nip a)] + :: recurse left or right to find .key + :: + ?: (compare key key.n.a) + =+ [found lef]=$(a l.a) + [found a(l lef)] + =+ [found rig]=$(a r.a) + [found a(r rig)] :: +nip: remove root; for internal use :: ++ nip @@ -524,11 +542,16 @@ queued-message-acks=(map message-num ok=?) =packet-pump-state == ++$ static-fragment + $: =message-num + num-fragments=fragment-num + =fragment-num + =fragment + == :: $packet-pump-state: persistent state for |packet-pump :: :: next-wake: last timer we've set, or null :: live: packets in flight; sent but not yet acked -:: lost: packets to retry, since they timed out with no ack :: metrics: congestion control information :: +$ packet-pump-state @@ -536,38 +559,44 @@ live=(tree [live-packet-key live-packet-val]) metrics=pump-metrics == -:: $pump-metrics: congestion control statistics for the |pump-gauge +:: $pump-metrics: congestion control state for a |packet-pump :: -:: num-live: number of sent packets in flight -:: num-lost: number of expired packets -:: last-sent-at: last date at which we sent a packet -:: last-dead-at: most recently packet expiry -:: rtt: roundtrip time estimate -:: max-live: current window size +:: This is an Ames adaptation of TCP's Reno congestion control +:: algorithm. The information signals and their responses are +:: identical to Reno's; the implementation differs because Ames +:: acknowledgments differ from TCP's and because we're using +:: functional data structures. +:: +:: If .skips reaches 3, we perform a fast retransmit and fast +:: recovery. This corresponds to Reno's handling of "three duplicate +:: acks". +:: +:: rto: retransmission timeout +:: rtt: roundtrip time estimate, low-passed using EWMA +:: rttvar: mean deviation of .rtt, also low-passed with EWMA +:: num-live: how many packets sent, awaiting ack +:: ssthresh: slow-start threshold +:: cwnd: congestion window; max unacked packets +:: skips: how many misordered acks we've received :: +$ pump-metrics - $: num-live=@ud - last-sent-at=@da + $: rto=_~s1 rtt=_~s1 - max-live=_2 - skipped=@ud + rttvar=_~s1 + ssthresh=_1.000.000 + cwnd=_1 + num-live=@ud + num-skips=@ud == +$ live-packet-key [=message-num =fragment-num] +$ live-packet-val - $: sent-packet-state + $: packet-state num-fragments=fragment-num =fragment == -+$ sent-packet-state - $: expiry=@da - sent-date=@da - retried=? - == -+$ static-fragment - $: =message-num - num-fragments=fragment-num - =fragment-num - =fragment ++$ packet-state + $: last-sent=@da + retries=@ud == :: $message-still-state: state of |message-still to assemble messages :: @@ -1706,6 +1735,7 @@ ^+ peer-core :: =/ =wire (make-pump-timer-wire her.channel bone) + =/ duct ~[/ames] (emit duct %pass wire %b %wait date) :: +on-pump-rest: relay |message-pump's unset-timer request :: @@ -1714,6 +1744,7 @@ ^+ peer-core :: =/ =wire (make-pump-timer-wire her.channel bone) + =/ duct ~[/ames] (emit duct %pass wire %b %rest date) -- :: +run-message-still: process $message-still-task and its effects @@ -2070,29 +2101,29 @@ ?- -.task %hear (on-hear [message-num fragment-num]:task) %done (on-done message-num.task) - %wake resend-lost(next-wake.state ~) + %wake on-wake %halt set-wake == - :: +resend-lost: resend as many lost packets as .gauge will allow + :: +on-wake: handle packet timeout :: - ++ resend-lost + ++ on-wake ^+ packet-pump + :: assert temporal coherence :: - =- =. packet-pump core.- - =. live.state live.- - ~? !=(0 num-sent.-) %resent-lost^num-sent.- + ?< =(~ next-wake.state) + ?> (gte now.channel (need next-wake.state)) + =. next-wake.state ~ + :: tell congestion control a packet timed out + :: + =. metrics.state on-timeout:gauge + :: re-send first packet and update its state in-place + :: + =- =. live.state live.- + =. packet-pump (give %send static-fragment.-) packet-pump - :: acc: state to thread through traversal :: - :: num-slots: start with max retries; decrement on each resend - :: - =| $= acc - $: num-slots=_num-retry-slots:gauge - num-sent=@ud - core=_packet-pump - == - :: - ^+ [acc live=live.state] + =| acc=static-fragment + ^+ [static-fragment=acc live=live.state] :: %^ (traverse:packet-queue _acc) live.state acc |= $: acc=_acc @@ -2100,37 +2131,15 @@ val=live-packet-val == ^- [new-val=(unit live-packet-val) stop=? _acc] - :: load mutant environment + :: packet has expired; update it in-place, stop, and produce it :: - =. packet-pump core.acc - :: if we can't send any more packets, we're done - :: - ?: =(0 num-slots.acc) - [`val stop=%.y acc] - :: if the packet hasn't expired, we're done - :: - ?: (gte expiry.val now.channel) - [`val stop=%.y acc] - :: packet has expired so re-send it + =. last-sent.val now.channel + =. retries.val +(retries.val) :: =/ =static-fragment - => [key val] - [message-num num-fragments fragment-num fragment] + [message-num num-fragments fragment-num fragment]:[key val] :: - =. packet-pump (give %send static-fragment) - =. metrics.state (on-resent:gauge -.val) - :: update $sent-packet-state in .val and continue - :: - =. expiry.val (next-retry-expiry:gauge -.val) - =. sent-date.val now.channel - =. retried.val %.y - :: update .acc, writing back .packet-pump - :: - =. num-sent.acc +(num-sent.acc) - =. num-slots.acc (dec num-slots.acc) - =. core.acc packet-pump - :: - [`val stop=%.n acc] + [`val stop=%.y static-fragment] :: +feed: try to send a list of packets, returning unsent and effects :: ++ feed @@ -2138,13 +2147,9 @@ ^+ [fragments gifts state] :: return unsent back to caller and reverse effects to finalize :: - =- ::::::::~&~&~& %ames-feed^(lent fragments)^%unsent^(lent unsent) - [unsent (flop gifts) state] + =- [unsent (flop gifts) state] :: ^+ [unsent=fragments packet-pump] - :: resend lost packets first, possibly adjusting congestion control - :: - =. packet-pump resend-lost :: bite off as many fragments as we can send :: =/ num-slots num-slots:gauge @@ -2164,9 +2169,7 @@ ^- [key=live-packet-key val=live-packet-val] :: :- [message-num fragment-num] - :- :+ expiry=next-expiry:gauge - sent-date=now.channel - retried=%.n + :- [sent-date=now.channel retries=0] [num-fragments fragment] :: update .live and .metrics :: @@ -2179,60 +2182,27 @@ :: |- ^+ packet-pump ?~ sent packet-pump - ::::::~&~&~& %sent^[message-num fragment-num]:i.sent + :: =. packet-pump (give %send i.sent) $(sent t.sent) :: +on-hear: handle ack on a live packet :: - :: Traverse .live from the head, marking packets as lost until we - :: find the acked packet. Then delete the acked packet and try to - :: resend lost packets. - :: - :: If we don't find the acked packet, no-op: no mutations, effects, - :: or resending of lost packets. + :: If the packet was in our queue, delete it and update our + :: metrics. Otherwise, no-op. :: ++ on-hear - |= [=message-num =fragment-num] + |= key=live-packet-key ^+ packet-pump :: - =- :: if no sent packet matches the ack, don't apply mutations or effects - :: - ?. found.- - ::~> %slog.0^leaf/"ames: hear: no-op {(scow %ud message-num)} {(scow %ud fragment-num)}" - packet-pump - ::::::~&~&~& %ames-hear-ack^message-num^fragment-num - :: - =. metrics.state metrics.- - =. live.state live.- - resend-lost + :: TODO handle misordered ack + =^ packet=(unit live-packet-val) live.state + (del:packet-queue live.state key) :: - ^- $: [found=? metrics=pump-metrics] - live=(tree [live-packet-key live-packet-val]) - == + ?~ packet + packet-pump :: - =/ acc=[found=? metrics=pump-metrics] [%.n metrics.state] - :: - %^ (traverse:packet-queue _acc) live.state acc - |= $: acc=_acc - key=live-packet-key - val=live-packet-val - == - ^- [new-val=(unit live-packet-val) stop=? _acc] - :: - =/ gauge (make-pump-gauge now.channel metrics.acc) - :: is this the acked packet? - :: - ?: =(key [message-num fragment-num]) - :: delete acked packet, update metrics, and stop traversal - :: - :+ new-val=~ - stop=%.y - [found=%.y metrics=(on-ack:gauge -.val)] - :: ack was out of order; mark expired, tell gauge, and continue - :: - :+ new-val=`val(expiry `@da`0) - stop=%.n - [found=%.n metrics=(on-skipped-packet:gauge -.val)] + =. metrics.state (on-ack:gauge -.u.packet) + packet-pump :: +on-done: apply ack to all packets from .message-num :: ++ on-done @@ -2242,8 +2212,7 @@ =- =. metrics.state metrics.- =. live.state live.- :: - ::::::~&~&~& %done^metrics.state - resend-lost + packet-pump :: ^- $: metrics=pump-metrics live=(tree [live-packet-key live-packet-val]) @@ -2258,9 +2227,10 @@ :: =/ gauge (make-pump-gauge now.channel metrics) :: if ack was out of order, mark expired and continue + :: TODO redo skipped packet logic :: ?: (lth message-num.key message-num) - :+ new-val=`val(expiry `@da`0) + :+ new-val=`val stop=%.n metrics=(on-skipped-packet:gauge -.val) :: if packet was from acked message, delete it and continue @@ -2279,7 +2249,7 @@ =/ new-wake=(unit @da) ?~ head=(peek:packet-queue live.state) ~ - `expiry.val.u.head + `next-expiry:gauge :: no-op if no change :: ?: =(new-wake next-wake.state) packet-pump @@ -2305,87 +2275,93 @@ |% :: +next-expiry: when should a newly sent fresh packet time out? :: + :: Use rtt + 4*sigma, where sigma is the mean deviation of rtt. + :: This should make it unlikely that a packet would time out from a + :: delay, as opposed to an actual packet loss. + :: ++ next-expiry ^- @da - (add now (mul 2 rtt)) - :: +next-retry-expiry: when should a resent packet time out? - :: - ++ next-retry-expiry - |= sent-packet-state - ^- @da - next-expiry - :: +has-slot: can we send a packet right now? - :: - ++ has-slot - ^- ? - (gth num-slots 0) + (add now rto) :: +num-slots: how many packets can we send right now? :: ++ num-slots ^- @ud - ?. (gth max-live num-live) - 0 - (sub max-live num-live) - :: +num-retry-slots: how many lost packets can we resend right now? - :: - ++ num-retry-slots - ^- @ud - max-live - :: +on-skipped-packet: adjust metrics based on a misordered ack - :: - ++ on-skipped-packet - |= sent-packet-state - ^- pump-metrics - :: - %_ metrics - skipped +(skipped) - == - :: +on-ack: adjust metrics based on a packet getting acknowledged - :: - ++ on-ack - |= sent-packet-state - ^- pump-metrics - :: - =? metrics (gth skipped 0) - ::::::~&~&~& %skipped^skipped - %_ metrics - skipped 0 - == - :: - %_ metrics - num-live (dec num-live) - max-live +(max-live) - rtt (smooth-rtt-since sent-date) - == + (sub-safe cwnd num-live) :: +on-sent: adjust metrics based on sending .num-sent fresh packets :: ++ on-sent |= num-sent=@ud ^- pump-metrics :: - %_ metrics - last-sent-at now - num-live (add num-sent num-live) - == - :: +on-resent: adjust metrics based on retrying an expired packet + =. num-live (add num-live num-sent) + ?> (lte num-live cwnd) + metrics + :: +on-ack: adjust metrics based on a packet getting acknowledged :: - ++ on-resent - |= sent-packet-state + ++ on-ack + |= =packet-state ^- pump-metrics :: - %_ metrics - last-sent-at now - max-live (max 1 (div max-live 2)) - rtt (smooth-rtt-since sent-date) - == - :: +smooth-rtt-since: calculate new low-passed roundtrip time + =. num-live (dec num-live) + :: if below congestion threshold, add 1; else, add avg. 1 / cwnd + :: + =. cwnd + ?: in-slow-start + +(cwnd) + (add cwnd !=(0 (mod (mug now) cwnd))) + :: if this was a re-send, don't adjust rtt or downstream state + :: + ?. =(0 retries.packet-state) + metrics + :: rtt-datum: new rtt measurement based on this packet roundtrip + :: + =/ rtt-datum=@dr (sub-safe now last-sent.packet-state) + :: rtt-error: difference between this rtt measurement and expected + :: + =/ rtt-error=@dr + ?: (gte rtt-datum rtt) + (sub rtt-datum rtt) + (sub rtt rtt-datum) + :: exponential weighting ratio for .rtt and .rttvar + :: + =. rtt (div (add rtt-datum (mul rtt 7)) 8) + =. rttvar (div (add rtt-error (mul rttvar 7)) 8) + =. rto (clamp-rto (add rtt (mul 4 rttvar))) + :: + metrics + :: +on-skipped-packet: TODO :: - ++ smooth-rtt-since - |= start=@da - %+ min ~s30 - =- (div - 4) - %+ add (mul 3 rtt) - (sub now start) + ++ on-skipped-packet + |= packet-state + ^- pump-metrics + metrics + :: +on-timeout: (re)enter slow-start mode on packet loss + :: + ++ on-timeout + ^- pump-metrics + :: + =: ssthresh (div cwnd 2) + cwnd 1 + rto (clamp-rto (mul rto 2)) + == + metrics + :: +clamp-rto: apply min and max to an .rto value + :: + ++ clamp-rto + |= rto=@dr + ^+ rto + (min ~m2 (max ^~((div ~s1 5)) rto)) + :: +in-slow-start: produces %.y iff we're in "slow-start" mode + :: + ++ in-slow-start + ^- ? + (lth cwnd ssthresh) + :: +sub-safe: subtract with underflow protection + :: + ++ sub-safe + |= [a=@ b=@] + ^- @ + ?:((lte a b) 0 (sub a b)) -- :: +make-message-still: construct |message-still message receiver core :: From 4188acde315bb565ab8166f08dd3a9f18229bdc9 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 27 Sep 2019 07:57:35 -0400 Subject: [PATCH 156/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 9130be7a4..c9806cc36 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:db46624b8e5f95578fc11fc178e6ecbd72cd4e799266980e1da65e6b4ace7631 -size 13232377 +oid sha256:e60129f7ddf2921181c7615068df4b2731ea0ab3c51ccc113fc4710905ec9312 +size 13302691 From b79dead5f81de54ffea1d1e121414f911051d0be Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Fri, 27 Sep 2019 10:40:22 -0700 Subject: [PATCH 157/451] spider: convert example-fetch to imp --- bin/solid.pill | 4 +- pkg/arvo/age/spider.hoon | 8 ++-- pkg/arvo/imp/first.hoon | 1 + pkg/arvo/lib/thread.hoon | 2 +- pkg/arvo/lib/threadio.hoon | 91 +++++++++++++++++++++++++++++++++---- pkg/arvo/sys/vane/eyre.hoon | 2 +- pkg/arvo/sys/zuse.hoon | 4 +- pkg/urbit/vere/http.c | 2 +- 8 files changed, 93 insertions(+), 21 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 74e238288..8405c5d22 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e77bbe0897bca5b85d6ffeeafe76dd6b746832795ba300743a3049814e5f75b9 -size 16357755 +oid sha256:90aacf3bcc5a56f5185e9e30782786b72efb7ac058d7402b6b32954589126db5 +size 16459224 diff --git a/pkg/arvo/age/spider.hoon b/pkg/arvo/age/spider.hoon index a7da61cca..d881828d4 100644 --- a/pkg/arvo/age/spider.hoon +++ b/pkg/arvo/age/spider.hoon @@ -70,19 +70,19 @@ ^- (quip card ^state) ?> ?=([%f %made *] sign-arvo) ?: ?=(%incomplete -.result.sign-arvo) - %- (slog leaf/"{} build incomplete" tang.result.sign-arvo) + %- (slog leaf+"{} build incomplete" tang.result.sign-arvo) `state =/ =build-result:ford build-result.result.sign-arvo ?: ?=(%error -.build-result) - %- (slog leaf/"{} build error" message.build-result) + %- (slog leaf+"{} build error" message.build-result) `state =/ =cage (result-to-cage:ford build-result) ?. ?=(%noun p.cage) - %- (slog leaf/"{} build not noun, is {}" ~) + %- (slog leaf+"{} build not noun, is {}" ~) `state =/ maybe-imp (mule |.(!<(imp q.cage))) ?: ?=(%| -.maybe-imp) - %- (slog leaf/"{} not valid imp" p.maybe-imp) + %- (slog leaf+"{} not valid imp" p.maybe-imp) `state (start-imp imp-name p.maybe-imp) :: diff --git a/pkg/arvo/imp/first.hoon b/pkg/arvo/imp/first.hoon index 006fc8b71..f2ee1e404 100644 --- a/pkg/arvo/imp/first.hoon +++ b/pkg/arvo/imp/first.hoon @@ -5,5 +5,6 @@ |= bowl:mall =/ m (thread ,~) ^- form:m +~& > %first-starting ;< ~ bind:m echo:threadio (pure:m ~) diff --git a/pkg/arvo/lib/thread.hoon b/pkg/arvo/lib/thread.hoon index d39fa965e..8fbb8a75a 100644 --- a/pkg/arvo/lib/thread.hoon +++ b/pkg/arvo/lib/thread.hoon @@ -42,7 +42,7 @@ ++ thread-fail |= err=(pair term tang) |= thread-input - [~ ~ ~ %fail err] + [~ %fail err] :: :: Asynchronous transcaction monad. :: diff --git a/pkg/arvo/lib/threadio.hoon b/pkg/arvo/lib/threadio.hoon index 0ded19f36..ba052abfb 100644 --- a/pkg/arvo/lib/threadio.hoon +++ b/pkg/arvo/lib/threadio.hoon @@ -1,5 +1,6 @@ /+ libthread=thread =, thread=thread:libthread +=, thread-fail=thread-fail:libthread |% ++ send-raw-card |= =card:agent:mall @@ -44,15 +45,19 @@ =/ m (thread ,~) ^- form:m ;: (main-loop ,~) + |= ~ + ^- form:m ;< =vase bind:m (handle-poke %echo) =/ message=tape !<(tape vase) - %- (slog leaf/"{message}..." ~) + %- (slog leaf+"{message}..." ~) ;< ~ bind:m (sleep ~s2) - %- (slog leaf/"{message}.." ~) + %- (slog leaf+"{message}.." ~) (pure:m ~) :: + |= ~ + ^- form:m ;< =vase bind:m (handle-poke %over) - %- (slog leaf/"over..." ~) + %- (slog leaf+"over..." ~) (pure:m ~) == :: @@ -66,7 +71,9 @@ [~ %sign [%wait @ ~] %b %wake *] ?. =(`until (slaw %da i.t.wire.u.in.tin)) `[%skip ~] - `[%done ~] + ?~ error.sign-arvo.u.in.tin + `[%done ~] + `[%fail %timer-error u.error.sign-arvo.u.in.tin] == :: ++ wait @@ -85,14 +92,78 @@ ;< now=@da bind:m get-time (wait (add now for)) :: +++ set-timeout + |* computation-result=mold + =/ m (thread ,computation-result) + |= [time=@dr computation=form:m] + ^- form:m + ;< now=@da bind:m get-time + =/ when (add now time) + =/ =card:agent:mall + [%pass /timeout/(scot %da when) %arvo %b %wait when] + ;< ~ bind:m (send-raw-card card) + |= tin=thread-input:thread + =* loop $ + ?: ?& ?=([~ %sign [%timeout @ ~] %b %wake *] in.tin) + =((scot %da when) i.t.wire.u.in.tin) + == + `[%fail %timeout ~] + =/ c-res (computation tin) + ?: ?=(%cont -.next.c-res) + c-res(self.next ..loop(computation self.next.c-res)) + ?: ?=(%done -.next.c-res) + =/ =card:agent:mall + [%pass /timeout/(scot %da when) %arvo %b %rest when] + c-res(cards [card cards.c-res]) + c-res +:: +++ send-request + |= =request:http + =/ m (thread ,~) + ^- form:m + (send-raw-card %pass /request %arvo %i %request request *outbound-config:iris) +:: +++ take-client-response + =/ m (thread ,client-response:iris) + ^- form:m + |= tin=thread-input:thread + ?+ in.tin `[%skip ~] + ~ `[%wait ~] + [~ %sign [%request ~] %i %http-response %finished *] + `[%done client-response.sign-arvo.u.in.tin] + == +:: +++ extract-body + |= =client-response:iris + =/ m (thread ,cord) + ^- form:m + ?> ?=(%finished -.client-response) + ?> ?=(^ full-file.client-response) + (pure:m q.data.u.full-file.client-response) +:: +++ fetch-json + |= url=tape + =/ m (thread ,json) + ^- form:m + =/ =request:http [%'GET' (crip url) ~ ~] + ;< ~ bind:m (send-request request) + ;< =client-response:iris bind:m take-client-response + ;< =cord bind:m (extract-body client-response) + =/ json=(unit json) (de-json:html cord) + ?~ json + (thread-fail %json-parse-error ~) + (pure:m u.json) +:: :: Queue on skip, try next on fail %ignore :: ++ main-loop |* a=mold - =/ m (thread ,a) + =/ m (thread ,~) + =/ m-a (thread ,a) =| queue=(qeu (unit input:thread)) - =| active=(unit [?(%one %two) =form:m]) - |= [one=form:m two=form:m] + =| active=(unit [?(%one %two) =form:m-a]) + =| state=a + |= [one=$-(a form:m-a) two=$-(a form:m-a)] ^- form:m |= tin=thread-input:thread =* top `form:m`..$ @@ -107,7 +178,7 @@ `[%cont top] =^ in=(unit input:thread) queue ~(get to queue) ^- output:m - =. active `one+one + =. active `one+(one state) ^- output:m (run bowl in) :: @@ -122,10 +193,10 @@ %wait `[%wait ~] %skip `[%cont ..$(queue (~(put to queue) in.tin))] %cont `[%cont ..$(active `one+self.next.res)] - %done (continue(active ~) bowl.tin) + %done (continue(active ~, state value.next.res) bowl.tin) %fail ?: &(?=(%one -.u.active) ?=(%ignore p.err.next.res)) - $(active `two+two) + $(active `two+(two state)) `[%fail err.next.res] == [(weld cards.res cards.output) next.output] diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index 859d6e048..95855bc4b 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -1973,7 +1973,7 @@ [duct %pass /acme/order %g %deal [our our] cmd]~ == :: - %request + %request-foreign =^ moves server-state.ax (request:server +.task) [moves http-server-gate] :: diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index decb9b6df..b164c90bd 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -907,7 +907,7 @@ [%rule =http-rule] :: starts handling an inbound http request :: - [%request secure=? =address =request:http] + [%request-foreign secure=? =address =request:http] :: starts handling an backdoor http request :: [%request-local secure=? =address =request:http] @@ -2525,7 +2525,7 @@ $>(%receive task:able:iris) :: %eyre: starts handling an inbound http request :: - $>(%request task:able:eyre) + $>(%request-foreign task:able:eyre) :: %eyre: starts handling an backdoor http request :: $>(%request-local task:able:eyre) diff --git a/pkg/urbit/vere/http.c b/pkg/urbit/vere/http.c index d3963d6eb..6f5ee6f46 100644 --- a/pkg/urbit/vere/http.c +++ b/pkg/urbit/vere/http.c @@ -394,7 +394,7 @@ _http_req_dispatch(u3_hreq* req_u, u3_noun req) } else { - u3_pier_plan(pox, u3nq(u3i_string("request"), + u3_pier_plan(pox, u3nq(u3i_string("request-foreign"), req_u->hon_u->htp_u->sec, u3nc(c3__ipv4, u3i_words(1, &req_u->hon_u->ipf_w)), From 9c9115a7e088b0353254110c901ce0d06e8b49fa Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Sat, 28 Sep 2019 21:44:31 -0700 Subject: [PATCH 158/451] spider, ph: convert ph to imps --- bin/solid.pill | 4 +- pkg/arvo/age/aqua.hoon | 26 ++- pkg/arvo/age/spider.hoon | 60 +++++- pkg/arvo/gen/spider/stop.hoon | 3 + .../aqua-ames.hoon => imp/aqua/ames.hoon} | 5 +- .../aqua-behn.hoon => imp/aqua/behn.hoon} | 4 +- .../aqua-dill.hoon => imp/aqua/dill.hoon} | 4 +- .../aqua-eyre.hoon => imp/aqua/eyre.hoon} | 4 +- pkg/arvo/imp/example-fetch.hoon | 132 +++++++++++++ pkg/arvo/imp/ph.hoon | 33 ++++ pkg/arvo/imp/ph/add.hoon | 18 ++ pkg/arvo/lib/aqua-vane-imp.hoon | 55 ++++++ pkg/arvo/lib/default-agent.hoon | 3 +- pkg/arvo/lib/ph/io.hoon | 122 ++++++++++++ pkg/arvo/lib/ph/util.hoon | 6 +- pkg/arvo/lib/thread.hoon | 4 +- pkg/arvo/lib/threadio.hoon | 187 +++++++++++++++--- pkg/arvo/sur/aquarium.hoon | 3 + pkg/arvo/sys/vane/mall.hoon | 59 +++--- 19 files changed, 655 insertions(+), 77 deletions(-) create mode 100644 pkg/arvo/gen/spider/stop.hoon rename pkg/arvo/{age/aqua-ames.hoon => imp/aqua/ames.hoon} (95%) rename pkg/arvo/{age/aqua-behn.hoon => imp/aqua/behn.hoon} (98%) rename pkg/arvo/{age/aqua-dill.hoon => imp/aqua/dill.hoon} (97%) rename pkg/arvo/{age/aqua-eyre.hoon => imp/aqua/eyre.hoon} (98%) create mode 100644 pkg/arvo/imp/example-fetch.hoon create mode 100644 pkg/arvo/imp/ph.hoon create mode 100644 pkg/arvo/imp/ph/add.hoon create mode 100644 pkg/arvo/lib/aqua-vane-imp.hoon create mode 100644 pkg/arvo/lib/ph/io.hoon diff --git a/bin/solid.pill b/bin/solid.pill index 8405c5d22..7e56b5bd6 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:90aacf3bcc5a56f5185e9e30782786b72efb7ac058d7402b6b32954589126db5 -size 16459224 +oid sha256:d2bb354f316b850a21bf4717d8440d7bbb6bf9f34536c53d7f84435c719c0224 +size 16455581 diff --git a/pkg/arvo/age/aqua.hoon b/pkg/arvo/age/aqua.hoon index fa36e31b3..ce727731c 100644 --- a/pkg/arvo/age/aqua.hoon +++ b/pkg/arvo/age/aqua.hoon @@ -74,9 +74,9 @@ ++ handle-subscribe |= =path ^- step:agent:mall - ?: ?=([%effects ~] path) + ?: ?=([?(%effects %effect) ~] path) `this - ?. ?=([?(%effects %evens %boths) @ ~] path) + ?. ?=([?(%effects %effect %evens %boths) @ ~] path) ~| [%aqua-bad-subscribe-path path] !! ?~ (slaw %p i.t.path) @@ -84,7 +84,7 @@ !! `this :: - ++ handle-unsubscribe handle-unsubscribe:def + ++ handle-unsubscribe ~& >> %k handle-unsubscribe:def ++ handle-peek |= =path ^- (unit (unit cage)) @@ -248,6 +248,16 @@ :: ++ abet-aqua ^- (quip card:agent:mall _this) + =. this + =/ =path /effect + %- emit-cards + %- zing + %+ turn ~(tap by unix-effects) + |= [=ship ufs=(list unix-effect)] + %+ turn ufs + |= uf=unix-effect + [%give %subscription-update `path %aqua-effect !>(`aqua-effect`[ship uf])] + :: =. this =/ =path /effects %- emit-cards @@ -255,6 +265,16 @@ |= [=ship ufs=(list unix-effect)] [%give %subscription-update `path %aqua-effects !>(`aqua-effects`[ship (flop ufs)])] :: + =. this + %- emit-cards + %- zing + %+ turn ~(tap by unix-effects) + |= [=ship ufs=(list unix-effect)] + =/ =path /effect/(scot %p ship) + %+ turn ufs + |= uf=unix-effect + [%give %subscription-update `path %aqua-effect !>(`aqua-effect`[ship uf])] + :: =. this %- emit-cards %+ turn ~(tap by unix-effects) diff --git a/pkg/arvo/age/spider.hoon b/pkg/arvo/age/spider.hoon index d881828d4..e2bc1d4df 100644 --- a/pkg/arvo/age/spider.hoon +++ b/pkg/arvo/age/spider.hoon @@ -26,22 +26,39 @@ ?+ mark (handle-poke:def mark vase) %spider-imput (handle-poke-imput:sc !<(imput vase)) %spider-start (handle-start-imp:sc !<([imp-name term] vase)) + %spider-stop (handle-stop-imp:sc !<(imp-name vase)) == [cards this] :: ++ handle-subscribe handle-subscribe:def ++ handle-unsubscribe handle-unsubscribe:def - ++ handle-peek handle-peek:def - ++ handle-agent-response handle-agent-response:def + ++ handle-peek + |= =path + ^- (unit (unit cage)) + ?+ path (handle-peek:def path) + [%x %started @ ~] ``noun+!>((~(has by state) i.t.t.path)) + == + :: + ++ handle-agent-response + |= [=wire =gift:agent:mall] + ^- (quip card _this) + =^ cards state + ?+ wire !! + [%imp @ *] (handle-agent-response:sc i.t.wire t.t.wire gift) + == + [cards this] + :: ++ handle-arvo-response |= [=wire =sign-arvo] ^- (quip card _this) =^ cards state ?+ wire (handle-arvo-response:def wire sign-arvo) [%imp @ *] (handle-sign:sc i.t.wire t.t.wire sign-arvo) + [%find @ ~] (handle-find:sc i.t.wire sign-arvo) [%build @ ~] (handle-build:sc i.t.wire sign-arvo) == [cards this] + :: ++ handle-error handle-error:def -- :: @@ -54,6 +71,10 @@ |= [=imp-name =wire =sign-arvo] (take-input imp-name ~ %sign wire sign-arvo) :: +++ handle-agent-response + |= [=imp-name =wire =gift:agent:mall] + (take-input imp-name ~ %agent wire gift) +:: ++ handle-start-imp |= [=imp-name =term] ^- (quip card ^state) @@ -61,7 +82,26 @@ ~| [%already-started imp-name] !! =/ =card - =/ =schematic:ford [%core [our.bowl %home] /hoon/[term]/imp] + =/ =schematic:ford [%path [our.bowl %home] %imp term] + [%pass /find/[imp-name] %arvo %f %build live=%.n schematic] + [[card ~] state] +:: +++ handle-find + |= [=imp-name =sign-arvo] + ^- (quip card ^state) + ?> ?=([%f %made *] sign-arvo) + ?: ?=(%incomplete -.result.sign-arvo) + %- (slog leaf+"{} find incomplete" tang.result.sign-arvo) + `state + =/ =build-result:ford build-result.result.sign-arvo + ?: ?=(%error -.build-result) + %- (slog leaf+"{} find error" message.build-result) + `state + ?. ?=([%path *] +.build-result) + %- (slog leaf+"{} find strange" ~) + `state + =/ =card + =/ =schematic:ford [%core rail.build-result] [%pass /build/[imp-name] %arvo %f %build live=%.y schematic] [[card ~] state] :: @@ -94,6 +134,14 @@ =. state (~(put by state) imp-name eval-form) (take-input imp-name ~) :: +++ handle-stop-imp + |= =imp-name + ^- (quip card ^state) + ?. (~(has by state) imp-name) + ~| [%not-started imp-name] + !! + (imp-fail imp-name %cancelled ~) +:: ++ take-input |= [=imp-name input=(unit input:thread)] ^- (quip card ^state) @@ -141,11 +189,13 @@ |= [=imp-name =term =tang] ^- (quip card ^state) %- (slog leaf+"thread {} failed" leaf+ tang) - `(~(del by state) imp-name) + :- [%pass /build/[imp-name] %arvo %f %kill ~]~ + (~(del by state) imp-name) :: ++ imp-done |= =imp-name ^- (quip card ^state) %- (slog leaf+"thread {} finished" ~) - `(~(del by state) imp-name) + :- [%pass /build/[imp-name] %arvo %f %kill ~]~ + (~(del by state) imp-name) -- diff --git a/pkg/arvo/gen/spider/stop.hoon b/pkg/arvo/gen/spider/stop.hoon new file mode 100644 index 000000000..f33c28ba5 --- /dev/null +++ b/pkg/arvo/gen/spider/stop.hoon @@ -0,0 +1,3 @@ +:- %say +|= [* [name=term ~] ~] +[%spider-stop name] diff --git a/pkg/arvo/age/aqua-ames.hoon b/pkg/arvo/imp/aqua/ames.hoon similarity index 95% rename from pkg/arvo/age/aqua-ames.hoon rename to pkg/arvo/imp/aqua/ames.hoon index 98c7d06e1..0a180bd93 100644 --- a/pkg/arvo/age/aqua-ames.hoon +++ b/pkg/arvo/imp/aqua/ames.hoon @@ -6,7 +6,7 @@ :: to drop them. :: /- aquarium -/+ aqua-vane +/+ aqua-vane-imp =, aquarium =| ships=(list ship) |% @@ -35,12 +35,13 @@ [%event who hear] -- :: -%- aqua-vane +%- aqua-vane-imp |_ =bowl:mall +* this . ++ handle-unix-effect |= [who=@p ue=unix-effect] ^- (quip card:agent:mall _this) + ~& >> 'feeling affected' =^ cards ships ?+ -.q.ue `ships %restore (handle-restore our.bowl who) diff --git a/pkg/arvo/age/aqua-behn.hoon b/pkg/arvo/imp/aqua/behn.hoon similarity index 98% rename from pkg/arvo/age/aqua-behn.hoon rename to pkg/arvo/imp/aqua/behn.hoon index 24f6bdcbb..6ac3ec23a 100644 --- a/pkg/arvo/age/aqua-behn.hoon +++ b/pkg/arvo/imp/aqua/behn.hoon @@ -1,5 +1,5 @@ /- aquarium -/+ aqua-vane +/+ aqua-vane-imp =, aquarium |% +$ pier next-timer=(unit @da) @@ -85,7 +85,7 @@ -- -- :: -%- aqua-vane +%- aqua-vane-imp |_ =bowl:mall +* this . ++ handle-unix-effect diff --git a/pkg/arvo/age/aqua-dill.hoon b/pkg/arvo/imp/aqua/dill.hoon similarity index 97% rename from pkg/arvo/age/aqua-dill.hoon rename to pkg/arvo/imp/aqua/dill.hoon index 880bb365e..1ba48e511 100644 --- a/pkg/arvo/age/aqua-dill.hoon +++ b/pkg/arvo/imp/aqua/dill.hoon @@ -8,7 +8,7 @@ :: programmatically send events. :: /- aquarium -/+ aqua-vane +/+ aqua-vane-imp |% ++ handle-blit |= [who=@p way=wire %blit blits=(list blit:dill)] @@ -30,7 +30,7 @@ ~ -- :: -%- aqua-vane +%- aqua-vane-imp |_ =bowl:mall +* this . ++ handle-unix-effect diff --git a/pkg/arvo/age/aqua-eyre.hoon b/pkg/arvo/imp/aqua/eyre.hoon similarity index 98% rename from pkg/arvo/age/aqua-eyre.hoon rename to pkg/arvo/imp/aqua/eyre.hoon index b70f15e49..300fd6728 100644 --- a/pkg/arvo/age/aqua-eyre.hoon +++ b/pkg/arvo/imp/aqua/eyre.hoon @@ -1,7 +1,7 @@ :: Pass-through Eyre driver :: /- aquarium -/+ aqua-vane +/+ aqua-vane-imp =, aquarium |% +$ pier http-requests=(set @ud) @@ -100,7 +100,7 @@ -- -- :: -%- aqua-vane +%- aqua-vane-imp |_ =bowl:mall +* this . ++ handle-unix-effect diff --git a/pkg/arvo/imp/example-fetch.hoon b/pkg/arvo/imp/example-fetch.hoon new file mode 100644 index 000000000..21937873e --- /dev/null +++ b/pkg/arvo/imp/example-fetch.hoon @@ -0,0 +1,132 @@ +:: Little app to demonstrate the structure of imps. +:: +:: Fetches the top comment of each of the top stories from Hacker News +:: +:: +/- spider +/+ *threadio +=, thread=thread:spider +|% ++$ top-comments (list tape) +-- +=; core + ^- imp:spider + |= =bowl:mall + =/ m (thread ,~) + ^- form:m + ~& > 'entering main loop' + %- (main-loop ,top-comments) + :~ handle-print:core + handle-fetch:core + :: `$-(top-comments _*form:(thread ,top-comments))`handle-poll:core + == +|% +:: Helper function to print a comment +:: +++ comment-to-tang + |= =tape + ^- tang + %+ welp + %+ turn (rip 10 (crip tape)) + |= line=cord + leaf+(trip line) + [leaf+""]~ +:: +:: All the URLs we fetch from +:: +++ urls + =/ base "https://hacker-news.firebaseio.com/v0/" + :* top-stories=(weld base "topstories.json") + item=|=(item=@ud `tape`:(welp base "item/" +>:(scow %ui item) ".json")) + == +:: +:: XX +:: +++ handle-print + |= =top-comments + =/ m (thread ,^top-comments) + ^- form:m + ;< =vase bind:m ((handle ,vase) (take-poke %example-fetch-print)) + (print top-comments) +:: +:: XX +:: +++ print + |= =top-comments + =/ m (thread ,^top-comments) + ^- form:m + %- (slog leaf+"drumroll please..." ~) + ;< ~ bind:m (sleep ~s3) + %- (slog leaf+"Top comments:" (zing (turn top-comments comment-to-tang))) + (pure:m top-comments) +:: +:: XX +:: +++ handle-fetch + |= =top-comments + =/ m (thread ,^top-comments) + ^- form:m + ;< =vase bind:m ((handle ,vase) (take-poke %example-fetch-fetch)) + (fetch top-comments) +:: +:: XX +:: +++ fetch + |= =top-comments + =/ m (thread ,^top-comments) + ^- form:m + =. top-comments ~ + %+ (set-timeout ^top-comments) ~s15 + ;< =top-stories=json bind:m (fetch-json top-stories:urls) + =/ top-stories=(list @ud) + ((ar ni):dejs:format top-stories-json) + :: + :: Loop through the first 5 stories + :: + =. top-stories (scag 5 top-stories) + |- ^- form:m + =* loop $ + :: + :: If done, tell subscribers and print the results + :: + ?~ top-stories + (print top-comments) + :: + :: Else, fetch the story info + :: + %- (slog leaf+"fetching item #{+>:(scow %ui i.top-stories)}" ~) + ;< =story-info=json bind:m (fetch-json (item:urls i.top-stories)) + =/ story-comments=(unit (list @ud)) + ((ot kids+(ar ni) ~):dejs-soft:format story-info-json) + :: + :: If no comments, say so + :: + ?: |(?=(~ story-comments) ?=(~ u.story-comments)) + =. top-comments ["" top-comments] + loop(top-stories t.top-stories) + :: + :: Else, fetch comment info + :: + ;< =comment-info=json bind:m (fetch-json (item:urls i.u.story-comments)) + =/ comment-text=(unit tape) + ((ot text+sa ~):dejs-soft:format comment-info-json) + :: + :: If no text (eg comment deleted), record that + :: + ?~ comment-text + =. top-comments ["" top-comments] + loop(top-stories t.top-stories) + :: + :: Else, add text to state + :: + =. top-comments [u.comment-text top-comments] + loop(top-stories t.top-stories) +:: +:: XX +:: +++ handle-poll + |= =top-comments + =/ m (thread ,^top-comments) + ^- form:m + !! +-- diff --git a/pkg/arvo/imp/ph.hoon b/pkg/arvo/imp/ph.hoon new file mode 100644 index 000000000..2c44a891e --- /dev/null +++ b/pkg/arvo/imp/ph.hoon @@ -0,0 +1,33 @@ +/- spider +/+ *threadio +=, thread=thread:spider +=; core + ^- imp:spider + |= =bowl:mall + =/ m (thread ,~) + ^- form:m + ~& > 'Entering pH loop' + %- (main-loop ,~) + :~ handle-run:core + handle-run-all:core + == +:: +|% +++ handle-run + |= ~ + =/ m (thread ,~) + ^- form:m + ;< =vase bind:m ((handle ,vase) (take-poke %ph-run)) + =/ ph-name !<(term vase) + =/ poke-vase !>([%ph-active (cat 3 %ph- ph-name)]) + ;< ~ bind:m (poke-our %spider %spider-start poke-vase) + :: ;< ~ bind:m (subscribe-our /active %spider /imp/active-ph) + :: ;< =cage bind:m (take-subscription-update /active) + (pure:m ~) +:: +++ handle-run-all + |= ~ + =/ m (thread ,~) + ^- form:m + (pure:m ~) +-- diff --git a/pkg/arvo/imp/ph/add.hoon b/pkg/arvo/imp/ph/add.hoon new file mode 100644 index 000000000..30a1063d9 --- /dev/null +++ b/pkg/arvo/imp/ph/add.hoon @@ -0,0 +1,18 @@ +/- spider +/+ ph-io +=, thread=thread:spider +^- imp:spider +|= =bowl:mall +=/ m (thread ,~) +~& > 'STARTING' +;< ~ bind:m start-simple:ph-io +~& > 'START ~BUD' +;< ~ bind:m (raw-ship:ph-io ~bud ~) +~& > 'DOJO' +;< ~ bind:m (dojo:ph-io ~bud "[%test-result (add 2 3)]") +~& > 'WAIT' +;< ~ bind:m (wait-for-output:ph-io ~bud "[%test-result 5]") +~& > 'STOPPING' +;< ~ bind:m end-simple:ph-io +~& > 'DONE' +(pure:m ~) diff --git a/pkg/arvo/lib/aqua-vane-imp.hoon b/pkg/arvo/lib/aqua-vane-imp.hoon new file mode 100644 index 000000000..654faca11 --- /dev/null +++ b/pkg/arvo/lib/aqua-vane-imp.hoon @@ -0,0 +1,55 @@ +/- spider, *aquarium +/+ ph-io, threadio +=, thread=thread:spider +|% +++ vane-handler + $_ ^| + |_ bowl:mall + ++ handle-unix-effect + |~ [ship unix-effect] + *(quip card:agent:mall _^|(..handle-unix-effect)) + :: + ++ handle-arvo-response + |~ [wire sign-arvo] + *(quip card:agent:mall _^|(..handle-unix-effect)) + -- +-- +:: +=; core + |= handler=vane-handler + ^- imp:spider + |= =bowl:mall + =/ m (thread ,~) + ^- form:m + ;< ~ bind:m (subscribe-our:threadio /effects %aqua /effect) + %- (main-loop:threadio ,_handler) + :~ handle-unix-effect:core + handle-arvo-response:core + pure:(thread ,vane-handler) + == +:: +|% +++ handle-unix-effect + |= handler=vane-handler + =/ m (thread ,vane-handler) + ^- form:m + ;< [her=ship =unix-effect] bind:m + ((handle:threadio ,[ship unix-effect]) take-unix-effect:ph-io) + ;< =bowl:mall bind:m get-bowl:threadio + =^ cards handler + (~(handle-unix-effect handler bowl) her unix-effect) + ;< ~ bind:m (send-raw-cards:threadio cards) + (pure:m handler) +:: +++ handle-arvo-response + |= handler=vane-handler + =/ m (thread ,vane-handler) + ^- form:m + ;< [=wire =sign-arvo] bind:m + ((handle:threadio ,[wire sign-arvo]) take-sign-arvo:threadio) + ;< =bowl:mall bind:m get-bowl:threadio + =^ cards handler + (~(handle-arvo-response handler bowl) wire sign-arvo) + ;< ~ bind:m (send-raw-cards:threadio cards) + (pure:m handler) +-- diff --git a/pkg/arvo/lib/default-agent.hoon b/pkg/arvo/lib/default-agent.hoon index bb25529a4..97d421d1f 100644 --- a/pkg/arvo/lib/default-agent.hoon +++ b/pkg/arvo/lib/default-agent.hoon @@ -26,12 +26,13 @@ `agent :: ++ handle-peek - |= path + |= =path ~| "unexpected scry into {} on path {}" !! :: ++ handle-agent-response |= [=wire =gift:agent:mall] + ^- (quip card:agent:mall agent:mall) ?- -.gift %poke-ack ?~ p.gift diff --git a/pkg/arvo/lib/ph/io.hoon b/pkg/arvo/lib/ph/io.hoon new file mode 100644 index 000000000..2177c6396 --- /dev/null +++ b/pkg/arvo/lib/ph/io.hoon @@ -0,0 +1,122 @@ +/- *aquarium +/+ libthread=thread, *threadio, util=ph-util +=, thread=thread:libthread +|% +++ send-events + |= events=(list aqua-event) + =/ m (thread ,~) + ^- form:m + (poke-our %aqua %aqua-events !>(events)) +:: +++ take-unix-effect + =/ m (thread ,[ship unix-effect]) + ^- form:m + ;< =cage bind:m (take-subscription-update /effects) + ?> ?=(%aqua-effect p.cage) + (pure:m !<([aqua-effect] q.cage)) +:: +++ start-simple + =/ m (thread ,~) + ^- form:m + =/ vane-imps=(list term) + ~[%aqua-ames %aqua-behn %aqua-dill %aqua-eyre] + ;< ~ bind:m (start-imps vane-imps) + ;< ~ bind:m start-watching + (pure:m ~) +:: +++ end-simple + =/ m (thread ,~) + ^- form:m + =/ vane-imps=(list term) + ~[%aqua-ames %aqua-behn %aqua-dill %aqua-eyre] + ;< ~ bind:m (stop-imps vane-imps) + ;< ~ bind:m stop-watching + (pure:m ~) +:: +++ start-imps + |= imps=(list term) + =/ m (thread ,~) + ^- form:m + ;< our=@p bind:m get-our + |- ^- form:m + =* loop $ + ?~ imps + (pure:m ~) + ;< now=@da bind:m get-time + =/ imp-started + .^(? %mx /(scot %p our)/spider/(scot %da now)/started/[i.imps]/noun) + ?: imp-started + loop(imps t.imps) + =/ poke-vase !>([i.imps i.imps]) + ;< ~ bind:m (poke-our %spider %spider-start poke-vase) + loop(imps t.imps) +:: +++ stop-imps + |= imps=(list term) + =/ m (thread ,~) + ^- form:m + ;< our=@p bind:m get-our + |- ^- form:m + =* loop $ + ?~ imps + (pure:m ~) + ;< now=@da bind:m get-time + =/ imp-started + .^(? %mx /(scot %p our)/spider/(scot %da now)/started/[i.imps]/noun) + ?. imp-started + loop(imps t.imps) + =/ poke-vase !>(i.imps) + ;< ~ bind:m (poke-our %spider %spider-stop poke-vase) + loop(imps t.imps) +:: +++ start-watching + =/ m (thread ,~) + ^- form:m + =* loop $ + (subscribe-our /effects %aqua /effect) +:: +++ stop-watching + =/ m (thread ,~) + ^- form:m + (unsubscribe-our /effects %aqua) +:: +++ raw-ship + |= [=ship keys=(unit dawn-event:able:jael)] + =/ m (thread ,~) + ^- form:m + ;< ~ bind:m (send-events (init:util ship keys)) + (check-ship-booted ship) +:: +++ check-ship-booted + |= =ship + =/ m (thread ,~) + ^- form:m + =* loop $ + ;< [her=^ship =unix-effect] bind:m take-unix-effect + =/ f |=(=tape (is-dojo-output:util ship her unix-effect tape)) + :: This is a pretty bad heuristic, but in general galaxies will + :: hit the first of these cases, and other ships will hit the + :: second. + :: + ?: ?| (f "clay: committed initial filesystem (all)") + (f "is your neighbor") + == + (pure:m ~) + loop +:: +++ dojo + |= [=ship =tape] + =/ m (thread ,~) + ^- form:m + (send-events (dojo:util ship tape)) +:: +++ wait-for-output + |= [=ship =tape] + =/ m (thread ,~) + ^- form:m + =* loop $ + ;< [her=^ship =unix-effect] bind:m take-unix-effect + ?: (is-dojo-output:util ship her unix-effect tape) + (pure:m ~) + loop +-- diff --git a/pkg/arvo/lib/ph/util.hoon b/pkg/arvo/lib/ph/util.hoon index b5f5cad08..f264214c8 100644 --- a/pkg/arvo/lib/ph/util.hoon +++ b/pkg/arvo/lib/ph/util.hoon @@ -8,7 +8,7 @@ :: ++ send-events-to |= [who=ship what=(list unix-event)] - ^- (list ph-event) + ^- (list aqua-event) %+ turn what |= ue=unix-event [%event who ue] @@ -17,14 +17,14 @@ :: ++ init |= [who=ship keys=(unit dawn-event:able:jael)] - ^- (list ph-event) + ^- (list aqua-event) [%init-ship who keys]~ :: :: Send dojo command :: ++ dojo |= [who=ship what=tape] - ^- (list ph-event) + ^- (list aqua-event) %+ send-events-to who ^- (list unix-event) :~ diff --git a/pkg/arvo/lib/thread.hoon b/pkg/arvo/lib/thread.hoon index 8fbb8a75a..596e6ef33 100644 --- a/pkg/arvo/lib/thread.hoon +++ b/pkg/arvo/lib/thread.hoon @@ -3,6 +3,7 @@ +$ input $% [%poke =cage] [%sign =wire =sign-arvo] + [%agent =wire =gift:agent:mall] == +$ thread-input [=bowl:mall in=(unit input)] :: @@ -137,7 +138,8 @@ :: ?- -.next.output %wait [[cards %next ~] eval-form] - %skip ~|(%take-got-skip !!) + %skip ~| [%take-got-skip ?~(in.thread-input ~ [+< +>-]:u.in.thread-input)] + !! %fail [[cards %fail err.next.output] eval-form] %done [[cards %done value.next.output] eval-form] %cont diff --git a/pkg/arvo/lib/threadio.hoon b/pkg/arvo/lib/threadio.hoon index ba052abfb..60fd5bf1b 100644 --- a/pkg/arvo/lib/threadio.hoon +++ b/pkg/arvo/lib/threadio.hoon @@ -2,12 +2,24 @@ =, thread=thread:libthread =, thread-fail=thread-fail:libthread |% +++ send-raw-cards + |= cards=(list =card:agent:mall) + =/ m (thread ,~) + ^- form:m + |= thread-input:thread + [cards %done ~] +:: ++ send-raw-card |= =card:agent:mall =/ m (thread ,~) ^- form:m - |= thread-input:thread - [[card ~] %done ~] + (send-raw-cards card ~) +:: +++ get-bowl + =/ m (thread ,bowl:mall) + ^- form:m + |= tin=thread-input:thread + `[%done bowl.tin] :: ++ get-time =/ m (thread ,@da) @@ -15,18 +27,28 @@ |= tin=thread-input:thread `[%done now.bowl.tin] :: -++ handle-poke - |= =mark - =/ m (thread ,vase) +++ get-our + =/ m (thread ,ship) ^- form:m |= tin=thread-input:thread - ?+ in.tin `[%fail %ignore ~] - ~ `[%wait ~] - [~ %poke @ *] - ?. =(mark p.cage.u.in.tin) - `[%fail %ignore ~] - `[%done q.cage.u.in.tin] - == + `[%done our.bowl.tin] +:: +:: Convert skips to %ignore failures. +:: +:: This tells the main loop to try the next handler. +:: +++ handle + |* a=mold + =/ m (thread ,a) + |= =form:m + ^- form:m + |= tin=thread-input:thread + =/ res (form tin) + =? next.res ?=(%skip -.next.res) + [%fail %ignore ~] + res +:: +:: Wait for a poke with a particular mark :: ++ take-poke |= =mark @@ -41,24 +63,51 @@ `[%done q.cage.u.in.tin] == :: +:: +:: +++ take-sign-arvo + =/ m (thread ,[wire sign-arvo]) + ^- form:m + |= tin=thread-input:thread + ?+ in.tin `[%skip ~] + ~ `[%wait ~] + [~ %sign *] + `[%done [wire sign-arvo]:u.in.tin] + == +:: +:: Wait for a subscription update on a wire +:: +++ take-subscription-update + |= =wire + =/ m (thread ,cage) + ^- form:m + |= tin=thread-input:thread + ?+ in.tin `[%skip ~] + ~ `[%wait ~] + [~ %agent * %subscription-update *] + ?. =(subscribe+wire wire.u.in.tin) + `[%skip ~] + `[%done cage.gift.u.in.tin] + == +:: ++ echo =/ m (thread ,~) ^- form:m - ;: (main-loop ,~) - |= ~ - ^- form:m - ;< =vase bind:m (handle-poke %echo) - =/ message=tape !<(tape vase) - %- (slog leaf+"{message}..." ~) - ;< ~ bind:m (sleep ~s2) - %- (slog leaf+"{message}.." ~) - (pure:m ~) + %- (main-loop ,~) + :~ |= ~ + ^- form:m + ;< =vase bind:m ((handle ,vase) (take-poke %echo)) + =/ message=tape !<(tape vase) + %- (slog leaf+"{message}..." ~) + ;< ~ bind:m (sleep ~s2) + %- (slog leaf+"{message}.." ~) + (pure:m ~) :: - |= ~ - ^- form:m - ;< =vase bind:m (handle-poke %over) - %- (slog leaf+"over..." ~) - (pure:m ~) + |= ~ + ^- form:m + ;< =vase bind:m ((handle ,vase) (take-poke %over)) + %- (slog leaf+"over..." ~) + (pure:m ~) == :: ++ take-wake @@ -76,6 +125,80 @@ `[%fail %timer-error u.error.sign-arvo.u.in.tin] == :: +++ take-poke-ack + |= =wire + =/ m (thread ,~) + ^- form:m + |= tin=thread-input:thread + ?+ in.tin `[%skip ~] + ~ `[%wait ~] + [~ %agent * %poke-ack *] + ?. =(wire wire.u.in.tin) + `[%skip ~] + ?~ p.gift.u.in.tin + `[%done ~] + `[%fail %poke-fail u.p.gift.u.in.tin] + == +:: +++ take-subscription-ack + |= =wire + =/ m (thread ,~) + ^- form:m + |= tin=thread-input:thread + ?+ in.tin `[%skip ~] + ~ `[%wait ~] + [~ %agent * %subscription-ack *] + ?. =(subscribe+wire wire.u.in.tin) + `[%skip ~] + ?~ p.gift.u.in.tin + `[%done ~] + `[%fail %subscription-ack-fail u.p.gift.u.in.tin] + == +:: +++ poke + |= [=dock =cage] + =/ m (thread ,~) + ^- form:m + =/ =card:agent:mall [%pass /poke %agent dock %poke cage] + ;< ~ bind:m (send-raw-card card) + (take-poke-ack /poke) +:: +++ poke-our + |= [=term =cage] + =/ m (thread ,~) + ^- form:m + ;< our=@p bind:m get-our + (poke [our term] cage) +:: +++ subscribe + |= [=wire =dock =path] + =/ m (thread ,~) + ^- form:m + =/ =card:agent:mall [%pass subscribe+wire %agent dock %subscribe path] + ;< ~ bind:m (send-raw-card card) + (take-subscription-ack wire) +:: +++ subscribe-our + |= [=wire =term =path] + =/ m (thread ,~) + ^- form:m + ;< our=@p bind:m get-our + (subscribe wire [our term] path) +:: +++ unsubscribe + |= [=wire =dock] + =/ m (thread ,~) + ^- form:m + =/ =card:agent:mall [%pass subscribe+wire %agent dock %unsubscribe ~] + (send-raw-card card) +:: +++ unsubscribe-our + |= [=wire =term] + =/ m (thread ,~) + ^- form:m + ;< our=@p bind:m get-our + (unsubscribe wire [our term]) +:: ++ wait |= until=@da =/ m (thread ,~) @@ -161,9 +284,9 @@ =/ m (thread ,~) =/ m-a (thread ,a) =| queue=(qeu (unit input:thread)) - =| active=(unit [?(%one %two) =form:m-a]) + =| active=(unit [=form:m-a forms=(list $-(a form:m-a))]) =| state=a - |= [one=$-(a form:m-a) two=$-(a form:m-a)] + |= forms=(lest $-(a form:m-a)) ^- form:m |= tin=thread-input:thread =* top `form:m`..$ @@ -178,7 +301,7 @@ `[%cont top] =^ in=(unit input:thread) queue ~(get to queue) ^- output:m - =. active `one+(one state) + =. active `[(i.forms state) t.forms] ^- output:m (run bowl in) :: @@ -192,11 +315,11 @@ ?- -.next.res %wait `[%wait ~] %skip `[%cont ..$(queue (~(put to queue) in.tin))] - %cont `[%cont ..$(active `one+self.next.res)] + %cont `[%cont ..$(active `[self.next.res forms.u.active])] %done (continue(active ~, state value.next.res) bowl.tin) %fail - ?: &(?=(%one -.u.active) ?=(%ignore p.err.next.res)) - $(active `two+(two state)) + ?: &(?=(^ forms.u.active) ?=(%ignore p.err.next.res)) + $(active `[(i.forms.u.active state) t.forms.u.active]) `[%fail err.next.res] == [(weld cards.res cards.output) next.output] diff --git a/pkg/arvo/sur/aquarium.hoon b/pkg/arvo/sur/aquarium.hoon index c0d6e6829..db760b355 100644 --- a/pkg/arvo/sur/aquarium.hoon +++ b/pkg/arvo/sur/aquarium.hoon @@ -32,6 +32,9 @@ +$ aqua-effects [who=ship ufs=(list unix-effect)] :: ++$ aqua-effect + [who=ship ufs=unix-effect] +:: +$ aqua-events [who=ship utes=(list unix-timed-event)] :: diff --git a/pkg/arvo/sys/vane/mall.hoon b/pkg/arvo/sys/vane/mall.hoon index f6ba08980..960b65974 100644 --- a/pkg/arvo/sys/vane/mall.hoon +++ b/pkg/arvo/sys/vane/mall.hoon @@ -961,7 +961,7 @@ ap-core :: =/ =ship p.u.incoming - ap-kill(attributing.agent-routes ship) + ap-kill-up(attributing.agent-routes ship) :: +ap-from-internal: internal move to move. :: :: We convert from cards to duct-indexed moves when resolving @@ -1003,13 +1003,15 @@ :: %pass =/ =duct system-duct.agents.state - =/ =path p.card + =/ =wire p.card =/ =note:agent q.card - =/ use-path + =? wire ?=(%agent -.note) + [%out (scot %p ship.note) name.note wire] + =. wire :: Is it bad that this includes attributing ship? May create :: spurious duct mismatches :: - [%use agent-name (scot %p attributing.agent-routes) path] + [%use agent-name (scot %p attributing.agent-routes) wire] =/ =note-arvo ?- -.note %arvo note-arvo.note @@ -1019,7 +1021,7 @@ [%deal sock [name task]:note] [%m task] == - [duct %pass use-path note-arvo]~ + [duct %pass wire note-arvo]~ == :: +ap-agent-core: agent core with current bowl and state :: @@ -1090,17 +1092,16 @@ :: ++ ap-update-subscription ~/ %ap-update-subscription - |= [is-ok=? =ship =path] + |= [is-ok=? =other=ship other-agent=term =wire] ^+ ap-core :: - =/ way [(scot %p ship) %out path] + :: XX pretty sure this shouldn't be used for pump + :: =/ way [(scot %p ship) %out wire] :: ?: is-ok - =/ =note:agent [%agent [ship -.path] %pump ~] - (ap-pass way note) - =. ap-core (ap-specific-take path %subscription-close ~ ~) - =/ =note:agent [%agent [ship -.path] %unsubscribe ~] - (ap-pass way note) + =/ =note:agent [%agent [other-ship other-agent] %pump ~] + (ap-pass wire note) + (ap-kill-down wire [other-ship other-agent]) :: +ap-dequeue: drop from queue. :: :: Dequeues along the current duct, deleting the queue entirely if it @@ -1277,14 +1278,19 @@ :: +ap-specific-take: specific take. :: ++ ap-specific-take - |= [=path =gift:agent] + |= [=wire =gift:agent] ^+ ap-core :: + ~| wire=wire + ?> ?=([%out @ @ *] wire) + =/ other-ship (slav %p i.t.wire) + =/ other-agent i.t.t.wire + =/ agent-wire t.t.t.wire =^ maybe-tang ap-core %+ ap-ingest ~ |. - (handle-agent-response:ap-agent-core path gift) + (handle-agent-response:ap-agent-core agent-wire gift) =? ap-core ?=(%subscription-update -.gift) - (ap-update-subscription =(~ maybe-tang) attributing.agent-routes path) + (ap-update-subscription =(~ maybe-tang) other-ship other-agent agent-wire) ?^ maybe-tang (ap-error -.gift leaf/"closing subscription" u.maybe-tang) ap-core @@ -1358,13 +1364,23 @@ ?^ maybe-tang (ap-error %unsubscribe u.maybe-tang) ap-core - :: +ap-kill: queue kill. + :: +ap-kill-up: 2-sided kill from publisher side :: - ++ ap-kill + ++ ap-kill-up ^+ ap-core :: => ap-load-delete (ap-give %subscription-close ~ ~) + :: +ap-kill-down: 2-sided kill from subscriber side + :: + ++ ap-kill-down + |= [=wire =dock] + ^+ ap-core + :: + =. ap-core + =/ way [%out (scot %p p.dock) q.dock wire] + (ap-specific-take way %subscription-close ~ ~) + (ap-pass wire %agent dock %unsubscribe ~) :: +ap-ingest: call agent arm :: :: Handle acks here because they need to be emitted before the @@ -1586,10 +1602,9 @@ ?> ?=([?(%sys %use) *] wire) =/ initialised (mo-abed:mo duct) =/ =sign-arvo q.hin - => - ?- i.wire - %sys (mo-handle-sys:initialised t.wire sign-arvo) - %use (mo-handle-use:initialised t.wire hin) - == + => ?- i.wire + %sys (mo-handle-sys:initialised t.wire sign-arvo) + %use (mo-handle-use:initialised t.wire hin) + == mo-abet -- From 9fc28a95388ddf57c188c58c0623f802320a18d5 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Mon, 30 Sep 2019 20:53:02 -0700 Subject: [PATCH 159/451] mall: populate wex.bowl with outgoing subscriptions fixes #1466 --- bin/solid.pill | 4 +- pkg/arvo/age/aqua.hoon | 2 +- pkg/arvo/age/spider.hoon | 43 ++++++++++++++------ pkg/arvo/gen/spider/stop.hoon | 2 +- pkg/arvo/imp/aqua/ames.hoon | 1 - pkg/arvo/lib/ph/io.hoon | 16 +++++++- pkg/arvo/sys/vane/mall.hoon | 74 ++++++++++++++++++++++++++--------- pkg/arvo/sys/zuse.hoon | 4 +- 8 files changed, 109 insertions(+), 37 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 7e56b5bd6..399b0220e 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d2bb354f316b850a21bf4717d8440d7bbb6bf9f34536c53d7f84435c719c0224 -size 16455581 +oid sha256:466901e624c1515a69a63a7cd11fab0afffeb6caef18ac640f8de44b555f3a00 +size 16472260 diff --git a/pkg/arvo/age/aqua.hoon b/pkg/arvo/age/aqua.hoon index ce727731c..4e94379e3 100644 --- a/pkg/arvo/age/aqua.hoon +++ b/pkg/arvo/age/aqua.hoon @@ -84,7 +84,7 @@ !! `this :: - ++ handle-unsubscribe ~& >> %k handle-unsubscribe:def + ++ handle-unsubscribe handle-unsubscribe:def ++ handle-peek |= =path ^- (unit (unit cage)) diff --git a/pkg/arvo/age/spider.hoon b/pkg/arvo/age/spider.hoon index e2bc1d4df..d388f5720 100644 --- a/pkg/arvo/age/spider.hoon +++ b/pkg/arvo/age/spider.hoon @@ -26,7 +26,7 @@ ?+ mark (handle-poke:def mark vase) %spider-imput (handle-poke-imput:sc !<(imput vase)) %spider-start (handle-start-imp:sc !<([imp-name term] vase)) - %spider-stop (handle-stop-imp:sc !<(imp-name vase)) + %spider-stop (handle-stop-imp:sc !<([imp-name ?] vase)) == [cards this] :: @@ -129,25 +129,34 @@ ++ start-imp |= [=imp-name =imp] ^- (quip card ^state) + =^ cards-1 state + ?. (~(has by state) imp-name) + `state + (imp-done imp-name) =/ m (thread ,~) =/ =eval-form:eval:m (from-form:eval:m (imp bowl)) =. state (~(put by state) imp-name eval-form) - (take-input imp-name ~) + =^ cards-2 state + (take-input imp-name ~) + [(weld cards-1 cards-2) state] :: ++ handle-stop-imp - |= =imp-name + |= [=imp-name nice=?] ^- (quip card ^state) - ?. (~(has by state) imp-name) - ~| [%not-started imp-name] - !! + ~? !(~(has by state) imp-name) + [%not-started imp-name] + ?: nice + (imp-done imp-name) (imp-fail imp-name %cancelled ~) :: ++ take-input |= [=imp-name input=(unit input:thread)] ^- (quip card ^state) =/ m (thread ,~) + ?. (~(has by state) imp-name) + %- (slog leaf+"spider got input for non-existent {}" ~) + `state =/ =eval-form:eval:m - ~| [%no-imp imp-name] (~(got by state) imp-name) =| cards=(list card) |- ^- (quip card ^state) @@ -189,13 +198,25 @@ |= [=imp-name =term =tang] ^- (quip card ^state) %- (slog leaf+"thread {} failed" leaf+ tang) - :- [%pass /build/[imp-name] %arvo %f %kill ~]~ - (~(del by state) imp-name) + (imp-clean imp-name) :: ++ imp-done |= =imp-name ^- (quip card ^state) %- (slog leaf+"thread {} finished" ~) - :- [%pass /build/[imp-name] %arvo %f %kill ~]~ - (~(del by state) imp-name) + (imp-clean imp-name) +:: +++ imp-clean + |= =imp-name + ^- (quip card ^state) + :_ (~(del by state) imp-name) + :- [%pass /build/[imp-name] %arvo %f %kill ~] + %+ murn ~(tap by wex.bowl) + |= [[=wire =ship =term] [acked=? =path]] + ^- (unit card) + ?. ?& ?=([%imp @ *] wire) + =(imp-name i.t.wire) + == + ~ + `[%pass wire %agent [ship term] %unsubscribe ~] -- diff --git a/pkg/arvo/gen/spider/stop.hoon b/pkg/arvo/gen/spider/stop.hoon index f33c28ba5..814bcf34a 100644 --- a/pkg/arvo/gen/spider/stop.hoon +++ b/pkg/arvo/gen/spider/stop.hoon @@ -1,3 +1,3 @@ :- %say |= [* [name=term ~] ~] -[%spider-stop name] +[%spider-stop name |] diff --git a/pkg/arvo/imp/aqua/ames.hoon b/pkg/arvo/imp/aqua/ames.hoon index 0a180bd93..aa5e10383 100644 --- a/pkg/arvo/imp/aqua/ames.hoon +++ b/pkg/arvo/imp/aqua/ames.hoon @@ -41,7 +41,6 @@ ++ handle-unix-effect |= [who=@p ue=unix-effect] ^- (quip card:agent:mall _this) - ~& >> 'feeling affected' =^ cards ships ?+ -.q.ue `ships %restore (handle-restore our.bowl who) diff --git a/pkg/arvo/lib/ph/io.hoon b/pkg/arvo/lib/ph/io.hoon index 2177c6396..ff6852218 100644 --- a/pkg/arvo/lib/ph/io.hoon +++ b/pkg/arvo/lib/ph/io.hoon @@ -22,6 +22,15 @@ ~[%aqua-ames %aqua-behn %aqua-dill %aqua-eyre] ;< ~ bind:m (start-imps vane-imps) ;< ~ bind:m start-watching + :: We want to wait for the vane imps to actually start and get their + :: subscriptions started. Other ways to do this are delaying the ack + :: from spider until the build is finished (does that guarantee the + :: subscriptions have started?) or subscribe to the imps themselves + :: for a notification when they're done. This is probably the best + :: option because the imp can delay until it gets a positive ack on + :: the subscription. + :: + ;< ~ bind:m (sleep ~s0) (pure:m ~) :: ++ end-simple @@ -29,6 +38,11 @@ ^- form:m =/ vane-imps=(list term) ~[%aqua-ames %aqua-behn %aqua-dill %aqua-eyre] + :: Get our very own event with mistakes in it... yet. Specifically, + :: this avoids the situation where updates going to the vane imps + :: crash in spider because the imp is already gone. + :: + ;< ~ bind:m (sleep ~s0) ;< ~ bind:m (stop-imps vane-imps) ;< ~ bind:m stop-watching (pure:m ~) @@ -65,7 +79,7 @@ .^(? %mx /(scot %p our)/spider/(scot %da now)/started/[i.imps]/noun) ?. imp-started loop(imps t.imps) - =/ poke-vase !>(i.imps) + =/ poke-vase !>([i.imps &]) ;< ~ bind:m (poke-our %spider %spider-stop poke-vase) loop(imps t.imps) :: diff --git a/pkg/arvo/sys/vane/mall.hoon b/pkg/arvo/sys/vane/mall.hoon index 960b65974..394a0eaa2 100644 --- a/pkg/arvo/sys/vane/mall.hoon +++ b/pkg/arvo/sys/vane/mall.hoon @@ -1174,8 +1174,7 @@ attributing.agent-routes :: guest agent-name :: agent == :: - :* :: NB (jtobin): see urbit/urbit#1466 - wex=~ :: outgoing + :* wex=outgoing.subscribers.current-agent :: outgoing sup=incoming.subscribers.current-agent :: incoming == :: :* act=change.stats.current-agent :: tick @@ -1285,12 +1284,29 @@ ?> ?=([%out @ @ *] wire) =/ other-ship (slav %p i.t.wire) =/ other-agent i.t.t.wire + =/ =dock [other-ship other-agent] =/ agent-wire t.t.t.wire + :: if subscription ack or close, handle before calling user code + :: + =? outgoing.subscribers.current-agent ?=(%subscription-close -.gift) + %- ~(del by outgoing.subscribers.current-agent) + [wire dock] + =? outgoing.subscribers.current-agent ?=(%subscription-ack -.gift) + ?^ p.gift + %- ~(del by outgoing.subscribers.current-agent) + [wire dock] + %+ ~(jab by outgoing.subscribers.current-agent) [agent-wire dock] + |= [acked=? =path] + ~| [%already-acked agent-name wire dock path] + ?< acked + [& path] + :: =^ maybe-tang ap-core %+ ap-ingest ~ |. (handle-agent-response:ap-agent-core agent-wire gift) + :: =? ap-core ?=(%subscription-update -.gift) - (ap-update-subscription =(~ maybe-tang) other-ship other-agent agent-wire) + (ap-update-subscription =(~ maybe-tang) p.dock q.dock agent-wire) ?^ maybe-tang (ap-error -.gift leaf/"closing subscription" u.maybe-tang) ap-core @@ -1403,7 +1419,7 @@ == :: =. agent-cards - :(weld new-cards ack-cards agent-cards) + :(weld (flop new-cards) ack-cards agent-cards) [maybe-tang ap-core] :: +ap-handle-result: handle result. :: @@ -1414,13 +1430,10 @@ ?: ?=(%| -.result) `ap-core :: - =/ new-subs (ap-handle-quits -.p.result) - :: - :- (flop -.p.result) - %_ ap-core - agent.current-agent +.p.result - incoming.subscribers.current-agent new-subs - == + =. agent.current-agent +.p.result + =. incoming.subscribers.current-agent + (ap-handle-quits -.p.result) + (ap-handle-peers -.p.result) :: +ap-handle-quits: handle cancels of incoming subscriptions :: ++ ap-handle-quits @@ -1440,14 +1453,39 @@ =/ quit-map=bitt (malt (turn quits |=(=duct [duct *[ship path]]))) (~(dif by incoming.subscribers.current-agent) quit-map) - :: +ap-tang: standard tang. + :: +ap-handle-peers: handle new outgoing subscriptions :: - ++ ap-tang - |= =tape - ^- tang - :: - =/ =tank [%leaf (weld "mall: {}: " tape)] - [tank ~] + ++ ap-handle-peers + ~/ %ap-handle-peers + |= moves=(list card:agent) + ^- [(list card:agent) _ap-core] + =| cards=(list card:agent) + |- ^- [(list card:agent) _ap-core] + ?~ moves + [(flop cards) ap-core] + =/ =card:agent i.moves + ?: ?=([%pass * %agent * %unsubscribe *] card) + =/ =wire p.card + =/ =dock [ship name]:q.card + =. outgoing.subscribers.current-agent + (~(del by outgoing.subscribers.current-agent) [wire dock]) + $(moves t.moves, cards [card cards]) + ?. ?=([%pass * %agent * %subscribe *] card) + $(moves t.moves, cards [card cards]) + =/ =wire p.card + =/ =dock [ship name]:q.card + =/ =path path.task.q.card + ?: (~(has by outgoing.subscribers.current-agent) wire dock) + =. ap-core + =/ way [%out (scot %p p.dock) q.dock wire] + =/ =tang + ~[leaf+"subscribe wire not unique" >agent-name< >wire< >dock<] + %- (slog leaf/"XXX remove" tang) + (ap-specific-take way %subscription-ack `tang) + $(moves t.moves) + =. outgoing.subscribers.current-agent + (~(put by outgoing.subscribers.current-agent) [wire dock] [| path]) + $(moves t.moves, cards [card cards]) -- -- :: +call: request diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index b164c90bd..3d9616c02 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -1880,8 +1880,8 @@ -- ::able ++ bitt (map duct (pair ship path)) :: incoming subs ++ boat :: outgoing subs - %+ map wire :: - (trel bean ship path) :: + %+ map ,[=wire =ship =term] :: + ,[acked=? =path] :: ++ bowl :: standard app state $: $: our/ship :: host src/ship :: guest From 45b19807f5ff1a9ef3dd49f70cc414dfea2ec64c Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 1 Oct 2019 15:06:12 -0700 Subject: [PATCH 160/451] spider, ph: convert all fake tests to imps --- pkg/arvo/age/spider.hoon | 2 +- pkg/arvo/imp/ph.hoon | 13 ++++ pkg/arvo/imp/ph/add.hoon | 6 -- pkg/arvo/imp/ph/boot-planet.hoon | 12 ++++ pkg/arvo/imp/ph/change-file.hoon | 13 ++++ pkg/arvo/imp/ph/child-sync.hoon | 13 ++++ pkg/arvo/imp/ph/hi.hoon | 13 ++++ pkg/arvo/imp/ph/second-cousin-hi.hoon | 16 +++++ pkg/arvo/lib/aqua-vane-imp.hoon | 6 ++ pkg/arvo/lib/ph/io.hoon | 90 +++++++++++++++++++++++++-- pkg/arvo/lib/ph/util.hoon | 2 +- 11 files changed, 173 insertions(+), 13 deletions(-) create mode 100644 pkg/arvo/imp/ph/boot-planet.hoon create mode 100644 pkg/arvo/imp/ph/change-file.hoon create mode 100644 pkg/arvo/imp/ph/child-sync.hoon create mode 100644 pkg/arvo/imp/ph/hi.hoon create mode 100644 pkg/arvo/imp/ph/second-cousin-hi.hoon diff --git a/pkg/arvo/age/spider.hoon b/pkg/arvo/age/spider.hoon index d388f5720..760b15b26 100644 --- a/pkg/arvo/age/spider.hoon +++ b/pkg/arvo/age/spider.hoon @@ -154,7 +154,7 @@ ^- (quip card ^state) =/ m (thread ,~) ?. (~(has by state) imp-name) - %- (slog leaf+"spider got input for non-existent {}" ~) + :: %- (slog leaf+"spider got input for non-existent {}" ~) `state =/ =eval-form:eval:m (~(got by state) imp-name) diff --git a/pkg/arvo/imp/ph.hoon b/pkg/arvo/imp/ph.hoon index 2c44a891e..5c07775a9 100644 --- a/pkg/arvo/imp/ph.hoon +++ b/pkg/arvo/imp/ph.hoon @@ -9,6 +9,7 @@ ~& > 'Entering pH loop' %- (main-loop ,~) :~ handle-run:core + handle-stop:core handle-run-all:core == :: @@ -25,6 +26,18 @@ :: ;< =cage bind:m (take-subscription-update /active) (pure:m ~) :: +++ handle-stop + |= ~ + =/ m (thread ,~) + ^- form:m + ;< =vase bind:m ((handle ,vase) (take-poke %ph-stop)) + ;< ~ bind:m (poke-our %spider %spider-stop !>([%ph-active &])) + ;< ~ bind:m (poke-our %spider %spider-stop !>([%aqua-ames &])) + ;< ~ bind:m (poke-our %spider %spider-stop !>([%aqua-behn &])) + ;< ~ bind:m (poke-our %spider %spider-stop !>([%aqua-dill &])) + ;< ~ bind:m (poke-our %spider %spider-stop !>([%aqua-eyre &])) + (pure:m ~) +:: ++ handle-run-all |= ~ =/ m (thread ,~) diff --git a/pkg/arvo/imp/ph/add.hoon b/pkg/arvo/imp/ph/add.hoon index 30a1063d9..c4840fcd4 100644 --- a/pkg/arvo/imp/ph/add.hoon +++ b/pkg/arvo/imp/ph/add.hoon @@ -4,15 +4,9 @@ ^- imp:spider |= =bowl:mall =/ m (thread ,~) -~& > 'STARTING' ;< ~ bind:m start-simple:ph-io -~& > 'START ~BUD' ;< ~ bind:m (raw-ship:ph-io ~bud ~) -~& > 'DOJO' ;< ~ bind:m (dojo:ph-io ~bud "[%test-result (add 2 3)]") -~& > 'WAIT' ;< ~ bind:m (wait-for-output:ph-io ~bud "[%test-result 5]") -~& > 'STOPPING' ;< ~ bind:m end-simple:ph-io -~& > 'DONE' (pure:m ~) diff --git a/pkg/arvo/imp/ph/boot-planet.hoon b/pkg/arvo/imp/ph/boot-planet.hoon new file mode 100644 index 000000000..758331f68 --- /dev/null +++ b/pkg/arvo/imp/ph/boot-planet.hoon @@ -0,0 +1,12 @@ +/- spider +/+ ph-io +=, thread=thread:spider +^- imp:spider +|= =bowl:mall +=/ m (thread ,~) +;< ~ bind:m start-simple:ph-io +;< ~ bind:m (raw-ship:ph-io ~bud ~) +;< ~ bind:m (raw-ship:ph-io ~marbud ~) +;< ~ bind:m (raw-ship:ph-io ~linnup-torsyx ~) +;< ~ bind:m end-simple:ph-io +(pure:m ~) diff --git a/pkg/arvo/imp/ph/change-file.hoon b/pkg/arvo/imp/ph/change-file.hoon new file mode 100644 index 000000000..b278abf88 --- /dev/null +++ b/pkg/arvo/imp/ph/change-file.hoon @@ -0,0 +1,13 @@ +/- spider +/+ ph-io, threadio +=, thread=thread:spider +^- imp:spider +|= =bowl:mall +=/ m (thread ,~) +;< ~ bind:m start-simple:ph-io +;< ~ bind:m (raw-ship:ph-io ~bud ~) +;< file=@t bind:m (touch-file:ph-io ~bud %home) +;< ~ bind:m (check-file-touched:ph-io ~bud %home file) +;< ~ bind:m (sleep:threadio ~d1) +;< ~ bind:m end-simple:ph-io +(pure:m ~) diff --git a/pkg/arvo/imp/ph/child-sync.hoon b/pkg/arvo/imp/ph/child-sync.hoon new file mode 100644 index 000000000..1c6c3a432 --- /dev/null +++ b/pkg/arvo/imp/ph/child-sync.hoon @@ -0,0 +1,13 @@ +/- spider +/+ ph-io +=, thread=thread:spider +^- imp:spider +|= =bowl:mall +=/ m (thread ,~) +;< ~ bind:m start-simple:ph-io +;< ~ bind:m (raw-ship:ph-io ~bud ~) +;< ~ bind:m (raw-ship:ph-io ~marbud ~) +;< file=@t bind:m (touch-file:ph-io ~bud %base) +;< ~ bind:m (check-file-touched:ph-io ~marbud %home file) +;< ~ bind:m end-simple:ph-io +(pure:m ~) diff --git a/pkg/arvo/imp/ph/hi.hoon b/pkg/arvo/imp/ph/hi.hoon new file mode 100644 index 000000000..63088f4db --- /dev/null +++ b/pkg/arvo/imp/ph/hi.hoon @@ -0,0 +1,13 @@ +/- spider +/+ ph-io +=, thread=thread:spider +^- imp:spider +|= =bowl:mall +=/ m (thread ,~) +;< ~ bind:m start-simple:ph-io +;< ~ bind:m (raw-ship:ph-io ~bud ~) +;< ~ bind:m (raw-ship:ph-io ~dev ~) +;< ~ bind:m (raw-ship:ph-io ~dev ~) +;< ~ bind:m (send-hi:ph-io ~bud ~dev) +;< ~ bind:m end-simple:ph-io +(pure:m ~) diff --git a/pkg/arvo/imp/ph/second-cousin-hi.hoon b/pkg/arvo/imp/ph/second-cousin-hi.hoon new file mode 100644 index 000000000..c3edecda4 --- /dev/null +++ b/pkg/arvo/imp/ph/second-cousin-hi.hoon @@ -0,0 +1,16 @@ +/- spider +/+ ph-io +=, thread=thread:spider +^- imp:spider +|= =bowl:mall +=/ m (thread ,~) +;< ~ bind:m start-simple:ph-io +;< ~ bind:m (raw-ship:ph-io ~bud ~) +;< ~ bind:m (raw-ship:ph-io ~marbud ~) +;< ~ bind:m (raw-ship:ph-io ~linnup-torsyx ~) +;< ~ bind:m (raw-ship:ph-io ~dev ~) +;< ~ bind:m (raw-ship:ph-io ~mardev ~) +;< ~ bind:m (raw-ship:ph-io ~mitnep-todsut ~) +;< ~ bind:m (send-hi:ph-io ~linnup-torsyx ~mitnep-todsut) +;< ~ bind:m end-simple:ph-io +(pure:m ~) diff --git a/pkg/arvo/lib/aqua-vane-imp.hoon b/pkg/arvo/lib/aqua-vane-imp.hoon index 654faca11..d8c256c7e 100644 --- a/pkg/arvo/lib/aqua-vane-imp.hoon +++ b/pkg/arvo/lib/aqua-vane-imp.hoon @@ -38,6 +38,12 @@ ;< =bowl:mall bind:m get-bowl:threadio =^ cards handler (~(handle-unix-effect handler bowl) her unix-effect) + ?~ cards + (pure:m handler) + :: send in next event to avoid inverting subscription flow. real + :: solution is probably for gall to drip subscription updates. + :: + ;< ~ bind:m (sleep:threadio ~s0) ;< ~ bind:m (send-raw-cards:threadio cards) (pure:m handler) :: diff --git a/pkg/arvo/lib/ph/io.hoon b/pkg/arvo/lib/ph/io.hoon index ff6852218..852e2e044 100644 --- a/pkg/arvo/lib/ph/io.hoon +++ b/pkg/arvo/lib/ph/io.hoon @@ -20,8 +20,11 @@ ^- form:m =/ vane-imps=(list term) ~[%aqua-ames %aqua-behn %aqua-dill %aqua-eyre] + ~& > "starting" ;< ~ bind:m (start-imps vane-imps) ;< ~ bind:m start-watching + :: Get our very own event with no mistakes in it... yet. + :: :: We want to wait for the vane imps to actually start and get their :: subscriptions started. Other ways to do this are delaying the ack :: from spider until the build is finished (does that guarantee the @@ -38,11 +41,7 @@ ^- form:m =/ vane-imps=(list term) ~[%aqua-ames %aqua-behn %aqua-dill %aqua-eyre] - :: Get our very own event with mistakes in it... yet. Specifically, - :: this avoids the situation where updates going to the vane imps - :: crash in spider because the imp is already gone. - :: - ;< ~ bind:m (sleep ~s0) + ~& > "done" ;< ~ bind:m (stop-imps vane-imps) ;< ~ bind:m stop-watching (pure:m ~) @@ -98,6 +97,7 @@ |= [=ship keys=(unit dawn-event:able:jael)] =/ m (thread ,~) ^- form:m + ~& > "starting {}" ;< ~ bind:m (send-events (init:util ship keys)) (check-ship-booted ship) :: @@ -122,15 +122,95 @@ |= [=ship =tape] =/ m (thread ,~) ^- form:m + ~& > "dojo: {tape}" (send-events (dojo:util ship tape)) :: ++ wait-for-output |= [=ship =tape] =/ m (thread ,~) ^- form:m + ~& > "waiting for output: {tape}" + |- ^- form:m =* loop $ ;< [her=^ship =unix-effect] bind:m take-unix-effect ?: (is-dojo-output:util ship her unix-effect tape) (pure:m ~) loop +:: +:: Send "|hi" from one ship to another +:: +++ send-hi + |= [from=@p to=@p] + =/ m (thread ,~) + ^- form:m + ;< ~ bind:m (dojo from "|hi {(scow %p to)}") + (wait-for-output from "hi {(scow %p to)} successful") +:: +:: Mount a desk. +:: +++ mount + |= [=ship =desk] + =/ m (thread ,~) + ^- form:m + ;< ~ bind:m (dojo ship "|mount /={(trip desk)}=") + |- ^- form:m + =* loop $ + ;< [her=^ship =unix-effect] bind:m take-unix-effect + ?: (is-ergo:util ship her unix-effect) + (pure:m ~) + loop +:: +:: Modify /sur/aquarium/hoon on the given ship +:: +++ touch-file + |= [her=ship =desk] + =/ m (thread ,@t) + ^- form:m + ~& > "touching file on {}/{}" + ;< ~ bind:m (mount her desk) + ;< our=@p bind:m get-our + ;< now=@da bind:m get-time + =/ host-pax + /(scot %p our)/home/(scot %da now)/sur/aquarium/hoon + =/ pax /sur/aquarium/hoon + =/ aqua-pax + ;: weld + /i/(scot %p her)/cx/(scot %p her)/[desk]/(scot %da now) + pax + /noun + == + =/ warped + %^ cat 3 '=> . ' + (need (scry-aqua:util (unit @) our now aqua-pax)) + ;< ~ bind:m (send-events (insert-file:util her desk host-pax warped)) + (pure:m warped) +:: +:: Check /sur/aquarium/hoon on the given has the given contents. +:: +++ check-file-touched + |= [=ship =desk warped=@t] + =/ m (thread ,~) + ~& > "checking file touched on {}/{}" + ;< ~ bind:m (mount ship desk) + ^- form:m + |- ^- form:m + =* loop $ + ;< [her=^ship =unix-effect] bind:m take-unix-effect + ;< our=@p bind:m get-our + ;< now=@da bind:m get-time + :: %ergo is no longer sufficient because .^ is pinned to beginning of + :: the event. So we hope somebody sets a timer for something. + :: + ?. &(=(ship her) ?=(?(%init %ergo %doze) -.q.unix-effect)) + loop + =/ pax /sur/aquarium/hoon + =/ aqua-pax + ;: weld + /i/(scot %p ship)/cx/(scot %p ship)/[desk]/(scot %da now) + pax + /noun + == + ?: =(warped (need (scry-aqua:util (unit @) our now aqua-pax))) + (pure:m ~) + loop -- diff --git a/pkg/arvo/lib/ph/util.hoon b/pkg/arvo/lib/ph/util.hoon index f264214c8..5eac32d43 100644 --- a/pkg/arvo/lib/ph/util.hoon +++ b/pkg/arvo/lib/ph/util.hoon @@ -38,7 +38,7 @@ :: ++ insert-file |= [who=ship des=desk pax=path txt=@t] - ^- (list ph-event) + ^- (list aqua-event) ?> ?=([@ @ @ *] pax) =/ file [/text/plain (as-octs:mimes:html txt)] %+ send-events-to who From 01c120e8de4ec8ab3b306cbf7a755ad697547de3 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 1 Oct 2019 19:50:25 -0700 Subject: [PATCH 161/451] ph: port azimuth handlers to imp --- pkg/arvo/imp/aqua/eyre-azimuth.hoon | 440 ++++++++++++++++++++++++++++ pkg/arvo/imp/ph.hoon | 1 + pkg/arvo/imp/ph/boot-az.hoon | 11 + pkg/arvo/lib/ph/io.hoon | 38 ++- 4 files changed, 476 insertions(+), 14 deletions(-) create mode 100644 pkg/arvo/imp/aqua/eyre-azimuth.hoon create mode 100644 pkg/arvo/imp/ph/boot-az.hoon diff --git a/pkg/arvo/imp/aqua/eyre-azimuth.hoon b/pkg/arvo/imp/aqua/eyre-azimuth.hoon new file mode 100644 index 000000000..d4f8608ea --- /dev/null +++ b/pkg/arvo/imp/aqua/eyre-azimuth.hoon @@ -0,0 +1,440 @@ +:: Pass-through Eyre driver +:: +/- spider, *aquarium +/+ ph-io, util=ph-util, threadio +=, thread=thread:spider +|% ++$ state + $: logs=(list az-log) :: oldest logs first + lives=(map ship [lyfe=life rut=rift]) + == +:: ++$ azimuth-command + $% [%spawn =ship] + [%create-ship =ship] + [%breach =ship] + [%breach-and-hear who=ship her=ship] + == +:: ++$ az-log [topics=(lest @) data=@t] +-- +=; core + ^- imp:spider + |= =bowl:mall + =/ m (thread ,~) + ^- form:m + ;< ~ bind:m (subscribe-our:threadio /effects %aqua /effect) + %- (main-loop:threadio ,state) + :~ |=(=state ~(handle-unix-effect core state)) + |=(=state ~(handle-poke core state)) + pure:(thread ,state) + == +:: +|_ =state +++ handle-unix-effect + =/ m (thread ,_state) + ^- form:m + ;< [her=ship =unix-effect] bind:m + ((handle:threadio ,[ship unix-effect]) take-unix-effect:ph-io) + ;< our=ship bind:m get-our:ph-io + =/ card (router our her unix-effect) + ?~ card + (pure:m state) + :: send in next event to avoid inverting subscription flow. real + :: solution is probably for gall to drip subscription updates. + :: + ;< ~ bind:m (sleep:threadio ~s0) + ;< ~ bind:m (send-raw-cards:threadio u.card ~) + (pure:m state) +:: +++ router + |= [our=ship her=ship uf=unix-effect] + ^- (unit card:agent:mall) + =, enjs:format + =/ ask (extract-request:util uf 'http://localhost:8545/') + ?~ ask + ~ + ?~ body.request.u.ask + ~ + =/ req q.u.body.request.u.ask + |^ ^- (unit card:agent:mall) + =/ method (get-method req) + ?: =(method 'eth_blockNumber') + :- ~ + %+ answer-request req + s+(crip (num-to-hex:ethereum latest-block)) + ?: =(method 'eth_getBlockByNumber') + :- ~ + %+ answer-request req + :- %o + =/ number (hex-to-num:ethereum (get-first-param req)) + =/ hash (number-to-hash number) + =/ parent-hash (number-to-hash ?~(number number (dec number))) + %- malt + ^- (list (pair term json)) + :~ hash+s+(crip (prefix-hex:ethereum (render-hex-bytes:ethereum 32 hash))) + number+s+(crip (num-to-hex:ethereum number)) + 'parentHash'^s+(crip (num-to-hex:ethereum parent-hash)) + == + ?: =(method 'eth_getLogs') + :- ~ + %+ answer-request req + ?^ (get-param-obj-maybe req 'blockHash') + %- logs-by-hash + (get-param-obj req 'blockHash') + %+ logs-by-range + (get-param-obj req 'fromBlock') + (get-param-obj req 'toBlock') + ~& [%ph-azimuth-miss req] + ~ + :: + ++ latest-block + (add launch:contracts:azimuth (dec (lent logs.state))) + :: + ++ get-id + |= req=@t + =, dejs:format + %. (need (de-json:html req)) + (ot id+so ~) + :: + ++ get-method + |= req=@t + =, dejs:format + %. (need (de-json:html req)) + (ot method+so ~) + :: + ++ get-param-obj + |= [req=@t param=@t] + =, dejs:format + %- hex-to-num:ethereum + =/ array + %. (need (de-json:html req)) + (ot params+(ar (ot param^so ~)) ~) + ?> ?=([* ~] array) + i.array + :: + ++ get-param-obj-maybe + |= [req=@t param=@t] + ^- (unit @ud) + =, dejs-soft:format + =/ array + %. (need (de-json:html req)) + (ot params+(ar (ot param^so ~)) ~) + ?~ array + ~ + :- ~ + ?> ?=([* ~] u.array) + %- hex-to-num:ethereum + i.u.array + :: + ++ get-first-param + |= req=@t + =, dejs:format + =/ id + %. (need (de-json:html req)) + (ot params+(at so bo ~) ~) + -.id + :: + ++ answer-request + |= [req=@t result=json] + ^- card:agent:mall + =/ resp + %- crip + %- en-json:html + %- pairs + :~ id+s+(get-id req) + jsonrpc+s+'2.0' + result+result + == + =/ events=(list aqua-event) + :_ ~ + :* %event + her + //http-client/0v1n.2m9vh + %receive + num.u.ask + [%start [200 ~] `(as-octs:mimes:html resp) &] + == + :* %pass /aqua-events + %agent [our %aqua] + %poke %aqua-events + !>(aqua-events) + == + :: + ++ number-to-hash + |= =number:block:able:jael + ^- @ + ?: (lth number launch:contracts:azimuth) + (cat 3 0x5364 (sub launch:contracts:azimuth number)) + (cat 3 0x5363 (sub number launch:contracts:azimuth)) + :: + ++ hash-to-number + |= =hash:block:able:jael + (add launch:contracts:azimuth (div hash 0x1.0000)) + :: + ++ logs-by-range + |= [from-block=@ud to-block=@ud] + %+ logs-to-json (max launch:contracts:azimuth from-block) + ?: (lth to-block launch:contracts:azimuth) + ~ + %+ swag + ?: (lth from-block launch:contracts:azimuth) + [0 +((sub to-block launch:contracts:azimuth))] + :- (sub from-block launch:contracts:azimuth) + +((sub to-block from-block)) + logs.state + :: + ++ logs-by-hash + |= =hash:block:able:jael + =/ =number:block:able:jael (hash-to-number hash) + (logs-by-range number number) + :: + ++ logs-to-json + |= [count=@ud selected-logs=(list az-log)] + ^- json + :- %a + |- ^- (list json) + ?~ selected-logs + ~ + :_ $(selected-logs t.selected-logs, count +(count)) + %- pairs + :~ 'logIndex'^s+'0x0' + 'transactionIndex'^s+'0x0' + :+ 'transactionHash' %s + (crip (prefix-hex:ethereum (render-hex-bytes:ethereum 32 `@`0x5362))) + :: + :+ 'blockHash' %s + =/ hash (number-to-hash count) + (crip (prefix-hex:ethereum (render-hex-bytes:ethereum 32 hash))) + :: + :+ 'blockNumber' %s + (crip (num-to-hex:ethereum count)) + :: + :+ 'address' %s + (crip (address-to-hex:ethereum azimuth:contracts:azimuth)) + :: + 'type'^s+'mined' + :: + 'data'^s+data.i.selected-logs + :+ 'topics' %a + %+ turn topics.i.selected-logs + |= topic=@ux + ^- json + :- %s + %- crip + %- prefix-hex:ethereum + (render-hex-bytes:ethereum 32 `@`topic) + == + -- +:: +++ handle-poke + =/ m (thread ,_state) + ^- form:m + ;< =vase bind:m ((handle:ph-io ,vase) (take-poke:ph-io %azimuth-command)) + =/ command !<(azimuth-command vase) + ?- -.command + %spawn (spawn +.command) + %create-ship (raw-real-ship +.command) + %breach (breach +.command) + %breach-and-hear (breach-and-hear +.command) + == +:: +++ raw-real-ship + |= who=ship + =/ m (thread ,_state) + ^- form:m + ?. =(%earl (clan:title who)) + ;< ~ bind:m (raw-ship:ph-io who `(dawn who ~)) + (pure:m state) + =/ spon=ship (^sein:title who) + =/ cub (pit:nu:crub:crypto 512 (shaz (jam who life=1 %entropy))) + =/ =seed:able:jael + [who 1 sec:ex:cub ~] + =/ =pass pub:ex:cub + =/ com=tape "|moon {(scow %p who)}, =public-key {(scow %uw pass)}" + ;< ~ bind:m (dojo:ph-io spon com) + ;< ~ bind:m (raw-ship:ph-io who `(dawn who `seed)) + (pure:m state) +:: +++ dawn + |= [who=ship seed=(unit seed:able:jael)] + ^- dawn-event:able:jael + =/ spon=(list [ship point:azimuth]) + |- ^- (list [ship point:azimuth]) + =/ =ship (^sein:title who) + =/ a-point=[^ship point:azimuth] + =/ spon-spon [& (^sein:title ship)] + =/ life-rift ~|([ship lives.state] (~(got by lives.state) ship)) + =/ =life lyfe.life-rift + =/ =rift rut.life-rift + =/ =pass + %^ pass-from-eth:azimuth + (as-octs:mimes:html (get-public ship life %crypt)) + (as-octs:mimes:html (get-public ship life %auth)) + 1 + :^ ship + *[address address address address]:azimuth + `[life=life pass rift spon-spon ~] + ~ + ?: ?=(%czar (clan:title ship)) + [a-point]~ + [a-point $(who ship)] + =/ =seed:able:jael + ?^ seed + u.seed + =/ life-rift (~(got by lives.state) who) + =/ =life lyfe.life-rift + [who life sec:ex:(get-keys who life) ~] + :* seed + spon + get-czars + ~[~['arvo' 'netw' 'ork']] + 0 + `(need (de-purl:html 'http://localhost:8545')) + == +:: +:: Should only do galaxies +:: +++ get-czars + ^- (map ship [rift life pass]) + %- malt + %+ murn + ~(tap by lives.state) + |= [who=ship lyfe=life rut=rift] + ?. =(%czar (clan:title who)) + ~ + %- some + :^ who rut lyfe + %^ pass-from-eth:azimuth + (as-octs:mimes:html (get-public who lyfe %crypt)) + (as-octs:mimes:html (get-public who lyfe %auth)) + 1 +:: +++ spawn + |= who=@p + =/ m (thread ,_state) + ^- form:m + ?< (~(has by lives.state) who) + =. lives.state (~(put by lives.state) who [1 0]) + =. logs.state + %+ weld logs.state + :~ %- changed-keys:lo + :* who + (get-public who 1 %crypt) + (get-public who 1 %auth) + 1 + 1 + == + == + (spam-logs 30) +:: +++ cycle-keys + |= who=@p + =/ m (thread ,_state) + ^- form:m + =/ prev (~(got by lives.state) who) + =/ lyfe +(lyfe.prev) + =. lives.state (~(put by lives.state) who [lyfe rut.prev]) + =. logs.state + %+ weld logs.state + :_ ~ + %- changed-keys:lo + :* who + (get-public who lyfe %crypt) + (get-public who lyfe %auth) + 1 + lyfe + == + (pure:m state) +:: +:: who: breachee +:: her: wait until hears about breach +:: +++ breach-and-hear + |= [who=@p her=@p] + =/ m (thread ,_state) + ^- form:m + ;< =new=^state bind:m (breach who) + =. state new-state + =/ new-rut rut:(~(got by lives.state) who) + |- ^- form:m + =* loop $ + ;< [him=ship =unix-effect] bind:m take-unix-effect:ph-io + ;< =bowl:mall bind:m get-bowl:ph-io + =/ aqua-pax + :- %i + /(scot %p her)/j/(scot %p her)/rift/(scot %da now.bowl)/(scot %p who)/noun + =/ rut (scry-aqua:util noun our.bowl now.bowl aqua-pax) + ?: =([~ new-rut] rut) + (pure:m state) + loop +:: +++ breach + |= who=@p + =/ m (thread ,_state) + ^- form:m + ;< =new=^state bind:m (cycle-keys who) + =. state new-state + =/ prev (~(got by lives.state) who) + =/ rut +(rut.prev) + =. lives.state (~(put by lives.state) who [lyfe.prev rut]) + =. logs.state + %+ weld logs.state + [(broke-continuity:lo who rut) ~] + (spam-logs 30) +:: +++ spam-logs + |= n=@ + =/ m (thread ,_state) + ^- form:m + =* loop $ + ?: =(n 0) + (pure:m state) + ;< =new=^state bind:m + ?. (~(has by lives.state) ~fes) + (spawn ~fes) + (cycle-keys ~fes) + =. state new-state + loop(n (dec n)) +:: +++ get-keys + |= [who=@p lyfe=life] + ^- acru:ames + %+ pit:nu:crub:crypto 32 + (can 5 [1 (scot %p who)] [1 (scot %ud lyfe)] ~) +:: +++ get-public + |= [who=@p lyfe=life typ=?(%auth %crypt)] + =/ bod (rsh 3 1 pub:ex:(get-keys who lyfe)) + =+ [enc=(rsh 8 1 bod) aut=(end 8 1 bod)] + ?: =(%auth typ) + aut + enc +:: +:: Generate logs +:: +++ lo + =, azimuth-events:azimuth + |% + ++ broke-continuity + |= [who=ship rut=rift] + ^- az-log + :- ~[^broke-continuity who] + %- crip + %- prefix-hex:ethereum + (render-hex-bytes:ethereum 32 `@`rut) + :: + ++ changed-keys + |= [who=ship enc=@ux aut=@ux crypto=@ud lyfe=life] + ^- az-log + :- ~[^changed-keys who] + %- crip + %- prefix-hex:ethereum + ;: welp + (render-hex-bytes:ethereum 32 `@`enc) + (render-hex-bytes:ethereum 32 `@`aut) + (render-hex-bytes:ethereum 32 `@`crypto) + (render-hex-bytes:ethereum 32 `@`lyfe) + == + -- +-- diff --git a/pkg/arvo/imp/ph.hoon b/pkg/arvo/imp/ph.hoon index 5c07775a9..98cd782fd 100644 --- a/pkg/arvo/imp/ph.hoon +++ b/pkg/arvo/imp/ph.hoon @@ -36,6 +36,7 @@ ;< ~ bind:m (poke-our %spider %spider-stop !>([%aqua-behn &])) ;< ~ bind:m (poke-our %spider %spider-stop !>([%aqua-dill &])) ;< ~ bind:m (poke-our %spider %spider-stop !>([%aqua-eyre &])) + ;< ~ bind:m (poke-our %spider %spider-stop !>([%aqua-eyre-azimuth &])) (pure:m ~) :: ++ handle-run-all diff --git a/pkg/arvo/imp/ph/boot-az.hoon b/pkg/arvo/imp/ph/boot-az.hoon new file mode 100644 index 000000000..3a31973f9 --- /dev/null +++ b/pkg/arvo/imp/ph/boot-az.hoon @@ -0,0 +1,11 @@ +/- spider +/+ ph-io +=, thread=thread:spider +^- imp:spider +|= =bowl:mall +=/ m (thread ,~) +;< ~ bind:m start-azimuth:ph-io +;< ~ bind:m (spawn:ph-io ~bud) +;< ~ bind:m (real-ship:ph-io ~bud) +;< ~ bind:m end-azimuth:ph-io +(pure:m ~) diff --git a/pkg/arvo/lib/ph/io.hoon b/pkg/arvo/lib/ph/io.hoon index 852e2e044..75b1f24fb 100644 --- a/pkg/arvo/lib/ph/io.hoon +++ b/pkg/arvo/lib/ph/io.hoon @@ -16,13 +16,22 @@ (pure:m !<([aqua-effect] q.cage)) :: ++ start-simple + (start-test %aqua-ames %aqua-behn %aqua-dill %aqua-eyre ~) +++ end-simple + (end-test %aqua-ames %aqua-behn %aqua-dill %aqua-eyre ~) +:: +++ start-azimuth + (start-test %aqua-ames %aqua-behn %aqua-dill %aqua-eyre-azimuth ~) +++ end-azimuth + (end-test %aqua-ames %aqua-behn %aqua-dill %aqua-eyre-azimuth ~) +:: +++ start-test + |= vane-imps=(list term) =/ m (thread ,~) ^- form:m - =/ vane-imps=(list term) - ~[%aqua-ames %aqua-behn %aqua-dill %aqua-eyre] ~& > "starting" ;< ~ bind:m (start-imps vane-imps) - ;< ~ bind:m start-watching + ;< ~ bind:m (subscribe-our /effects %aqua /effect) :: Get our very own event with no mistakes in it... yet. :: :: We want to wait for the vane imps to actually start and get their @@ -36,14 +45,13 @@ ;< ~ bind:m (sleep ~s0) (pure:m ~) :: -++ end-simple +++ end-test + |= vane-imps=(list term) =/ m (thread ,~) ^- form:m - =/ vane-imps=(list term) - ~[%aqua-ames %aqua-behn %aqua-dill %aqua-eyre] ~& > "done" ;< ~ bind:m (stop-imps vane-imps) - ;< ~ bind:m stop-watching + ;< ~ bind:m (unsubscribe-our /effects %aqua) (pure:m ~) :: ++ start-imps @@ -82,16 +90,18 @@ ;< ~ bind:m (poke-our %spider %spider-stop poke-vase) loop(imps t.imps) :: -++ start-watching +++ spawn + |= =ship =/ m (thread ,~) - ^- form:m - =* loop $ - (subscribe-our /effects %aqua /effect) + =/ =vase !>([%aqua-eyre-azimuth %azimuth-command !>([%spawn ship])]) + (poke-our %spider %spider-imput vase) :: -++ stop-watching +++ real-ship + |= =ship =/ m (thread ,~) - ^- form:m - (unsubscribe-our /effects %aqua) + =/ =vase !>([%aqua-eyre-azimuth %azimuth-command !>([%create-ship ship])]) + ;< ~ bind:m (poke-our %spider %spider-imput vase) + (check-ship-booted ship) :: ++ raw-ship |= [=ship keys=(unit dawn-event:able:jael)] From aaf21f1f994e7abf518d5f895d2f06537185b6d7 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 1 Oct 2019 20:25:19 -0700 Subject: [PATCH 162/451] ph: port all azimuth tests to imps --- pkg/arvo/imp/ph/breach-hi-cousin.hoon | 22 ++++++++++++++++++++++ pkg/arvo/imp/ph/breach-hi.hoon | 18 ++++++++++++++++++ pkg/arvo/imp/ph/breach-multiple.hoon | 22 ++++++++++++++++++++++ pkg/arvo/imp/ph/breach-sudden.hoon | 21 +++++++++++++++++++++ pkg/arvo/imp/ph/breach-sync.hoon | 21 +++++++++++++++++++++ pkg/arvo/imp/ph/hi-az.hoon | 14 ++++++++++++++ pkg/arvo/imp/ph/moon-az.hoon | 22 ++++++++++++++++++++++ pkg/arvo/lib/ph/io.hoon | 24 ++++++++++++++++++++++++ 8 files changed, 164 insertions(+) create mode 100644 pkg/arvo/imp/ph/breach-hi-cousin.hoon create mode 100644 pkg/arvo/imp/ph/breach-hi.hoon create mode 100644 pkg/arvo/imp/ph/breach-multiple.hoon create mode 100644 pkg/arvo/imp/ph/breach-sudden.hoon create mode 100644 pkg/arvo/imp/ph/breach-sync.hoon create mode 100644 pkg/arvo/imp/ph/hi-az.hoon create mode 100644 pkg/arvo/imp/ph/moon-az.hoon diff --git a/pkg/arvo/imp/ph/breach-hi-cousin.hoon b/pkg/arvo/imp/ph/breach-hi-cousin.hoon new file mode 100644 index 000000000..7b923867e --- /dev/null +++ b/pkg/arvo/imp/ph/breach-hi-cousin.hoon @@ -0,0 +1,22 @@ +/- spider +/+ ph-io +=, thread=thread:spider +^- imp:spider +|= =bowl:mall +=/ m (thread ,~) +;< ~ bind:m start-azimuth:ph-io +;< ~ bind:m (spawn:ph-io ~bud) +;< ~ bind:m (spawn:ph-io ~dev) +;< ~ bind:m (spawn:ph-io ~marbud) +;< ~ bind:m (spawn:ph-io ~mardev) +;< ~ bind:m (real-ship:ph-io ~bud) +;< ~ bind:m (real-ship:ph-io ~dev) +;< ~ bind:m (real-ship:ph-io ~marbud) +;< ~ bind:m (real-ship:ph-io ~mardev) +;< ~ bind:m (send-hi:ph-io ~marbud ~mardev) +;< ~ bind:m (breach-and-hear:ph-io ~mardev ~marbud) +;< ~ bind:m (send-hi-not-responding:ph-io ~marbud ~mardev) +;< ~ bind:m (real-ship:ph-io ~mardev) +;< ~ bind:m (wait-for-output:ph-io ~marbud "hi ~mardev successful") +;< ~ bind:m end-azimuth:ph-io +(pure:m ~) diff --git a/pkg/arvo/imp/ph/breach-hi.hoon b/pkg/arvo/imp/ph/breach-hi.hoon new file mode 100644 index 000000000..354cec0fa --- /dev/null +++ b/pkg/arvo/imp/ph/breach-hi.hoon @@ -0,0 +1,18 @@ +/- spider +/+ ph-io +=, thread=thread:spider +^- imp:spider +|= =bowl:mall +=/ m (thread ,~) +;< ~ bind:m start-azimuth:ph-io +;< ~ bind:m (spawn:ph-io ~bud) +;< ~ bind:m (spawn:ph-io ~dev) +;< ~ bind:m (real-ship:ph-io ~bud) +;< ~ bind:m (real-ship:ph-io ~dev) +;< ~ bind:m (send-hi:ph-io ~bud ~dev) +;< ~ bind:m (breach-and-hear:ph-io ~dev ~bud) +;< ~ bind:m (send-hi-not-responding:ph-io ~bud ~dev) +;< ~ bind:m (real-ship:ph-io ~dev) +;< ~ bind:m (wait-for-output:ph-io ~bud "hi ~dev successful") +;< ~ bind:m end-azimuth:ph-io +(pure:m ~) diff --git a/pkg/arvo/imp/ph/breach-multiple.hoon b/pkg/arvo/imp/ph/breach-multiple.hoon new file mode 100644 index 000000000..16cf91657 --- /dev/null +++ b/pkg/arvo/imp/ph/breach-multiple.hoon @@ -0,0 +1,22 @@ +/- spider +/+ ph-io +=, thread=thread:spider +^- imp:spider +|= =bowl:mall +=/ m (thread ,~) +;< ~ bind:m start-azimuth:ph-io +;< ~ bind:m (spawn:ph-io ~bud) +;< ~ bind:m (spawn:ph-io ~marbud) +;< ~ bind:m (real-ship:ph-io ~bud) +;< ~ bind:m (real-ship:ph-io ~marbud) +;< file=@t bind:m (touch-file:ph-io ~bud %base) +;< ~ bind:m (check-file-touched:ph-io ~marbud %home file) +;< ~ bind:m (breach-and-hear:ph-io ~bud ~marbud) +;< ~ bind:m (real-ship:ph-io ~bud) +;< ~ bind:m (breach-and-hear:ph-io ~marbud ~bud) +;< ~ bind:m (real-ship:ph-io ~marbud) +;< file=@t bind:m (touch-file:ph-io ~bud %base) +;< file=@t bind:m (touch-file:ph-io ~bud %base) +;< ~ bind:m (check-file-touched:ph-io ~marbud %home file) +;< ~ bind:m end-azimuth:ph-io +(pure:m ~) diff --git a/pkg/arvo/imp/ph/breach-sudden.hoon b/pkg/arvo/imp/ph/breach-sudden.hoon new file mode 100644 index 000000000..a0173f468 --- /dev/null +++ b/pkg/arvo/imp/ph/breach-sudden.hoon @@ -0,0 +1,21 @@ +/- spider +/+ ph-io +=, thread=thread:spider +^- imp:spider +|= =bowl:mall +=/ m (thread ,~) +;< ~ bind:m start-azimuth:ph-io +;< ~ bind:m (spawn:ph-io ~bud) +;< ~ bind:m (spawn:ph-io ~marbud) +;< ~ bind:m (real-ship:ph-io ~bud) +;< ~ bind:m (real-ship:ph-io ~marbud) +;< file=@t bind:m (touch-file:ph-io ~bud %base) +;< ~ bind:m (check-file-touched:ph-io ~marbud %home file) +;< ~ bind:m (breach:ph-io ~bud) +;< ~ bind:m (real-ship:ph-io ~bud) +;< ~ bind:m (dojo:ph-io ~bud "|merge %base ~marbud %kids, =gem %this") +;< file=@t bind:m (touch-file:ph-io ~bud %base) +;< file=@t bind:m (touch-file:ph-io ~bud %base) +;< ~ bind:m (check-file-touched:ph-io ~marbud %home file) +;< ~ bind:m end-azimuth:ph-io +(pure:m ~) diff --git a/pkg/arvo/imp/ph/breach-sync.hoon b/pkg/arvo/imp/ph/breach-sync.hoon new file mode 100644 index 000000000..54d771cb7 --- /dev/null +++ b/pkg/arvo/imp/ph/breach-sync.hoon @@ -0,0 +1,21 @@ +/- spider +/+ ph-io +=, thread=thread:spider +^- imp:spider +|= =bowl:mall +=/ m (thread ,~) +;< ~ bind:m start-azimuth:ph-io +;< ~ bind:m (spawn:ph-io ~bud) +;< ~ bind:m (spawn:ph-io ~marbud) +;< ~ bind:m (real-ship:ph-io ~bud) +;< ~ bind:m (real-ship:ph-io ~marbud) +;< file=@t bind:m (touch-file:ph-io ~bud %base) +;< ~ bind:m (check-file-touched:ph-io ~marbud %home file) +;< ~ bind:m (breach-and-hear:ph-io ~bud ~marbud) +;< ~ bind:m (real-ship:ph-io ~bud) +;< ~ bind:m (dojo:ph-io ~bud "|merge %base ~marbud %kids, =gem %this") +;< file=@t bind:m (touch-file:ph-io ~bud %base) +;< file=@t bind:m (touch-file:ph-io ~bud %base) +;< ~ bind:m (check-file-touched:ph-io ~marbud %home file) +;< ~ bind:m end-azimuth:ph-io +(pure:m ~) diff --git a/pkg/arvo/imp/ph/hi-az.hoon b/pkg/arvo/imp/ph/hi-az.hoon new file mode 100644 index 000000000..c2cd3f419 --- /dev/null +++ b/pkg/arvo/imp/ph/hi-az.hoon @@ -0,0 +1,14 @@ +/- spider +/+ ph-io +=, thread=thread:spider +^- imp:spider +|= =bowl:mall +=/ m (thread ,~) +;< ~ bind:m start-azimuth:ph-io +;< ~ bind:m (spawn:ph-io ~bud) +;< ~ bind:m (spawn:ph-io ~dev) +;< ~ bind:m (real-ship:ph-io ~bud) +;< ~ bind:m (real-ship:ph-io ~dev) +;< ~ bind:m (send-hi:ph-io ~bud ~dev) +;< ~ bind:m end-azimuth:ph-io +(pure:m ~) diff --git a/pkg/arvo/imp/ph/moon-az.hoon b/pkg/arvo/imp/ph/moon-az.hoon new file mode 100644 index 000000000..a8dc9a4b6 --- /dev/null +++ b/pkg/arvo/imp/ph/moon-az.hoon @@ -0,0 +1,22 @@ +/- spider +/+ ph-io +=, thread=thread:spider +^- imp:spider +|= =bowl:mall +=/ m (thread ,~) +;< ~ bind:m start-azimuth:ph-io +;< ~ bind:m (spawn:ph-io ~bud) +;< ~ bind:m (spawn:ph-io ~marbud) +;< ~ bind:m (spawn:ph-io ~linnup-torsyx) +;< ~ bind:m (spawn:ph-io ~dev) +;< ~ bind:m (real-ship:ph-io ~bud) +;< ~ bind:m (real-ship:ph-io ~marbud) +;< ~ bind:m (real-ship:ph-io ~linnup-torsyx) +;< ~ bind:m (real-ship:ph-io ~linnup-torsyx-linnup-torsyx) +;< ~ bind:m (send-hi:ph-io ~bud ~linnup-torsyx-linnup-torsyx) +;< ~ bind:m (send-hi:ph-io ~linnup-torsyx-linnup-torsyx ~marbud) +;< ~ bind:m (real-ship:ph-io ~dev) +;< ~ bind:m (send-hi:ph-io ~linnup-torsyx-linnup-torsyx ~dev) +;< ~ bind:m (send-hi:ph-io ~dev ~linnup-torsyx-linnup-torsyx) +;< ~ bind:m end-azimuth:ph-io +(pure:m ~) diff --git a/pkg/arvo/lib/ph/io.hoon b/pkg/arvo/lib/ph/io.hoon index 75b1f24fb..41bd7cc8c 100644 --- a/pkg/arvo/lib/ph/io.hoon +++ b/pkg/arvo/lib/ph/io.hoon @@ -96,6 +96,22 @@ =/ =vase !>([%aqua-eyre-azimuth %azimuth-command !>([%spawn ship])]) (poke-our %spider %spider-imput vase) :: +++ breach + |= who=ship + =/ m (thread ,~) + ~& > "breaching {}" + =/ =vase + !>([%aqua-eyre-azimuth %azimuth-command !>([%breach who])]) + (poke-our %spider %spider-imput vase) +:: +++ breach-and-hear + |= [who=ship her=ship] + =/ m (thread ,~) + ~& > "breaching {} for {}" + =/ =vase + !>([%aqua-eyre-azimuth %azimuth-command !>([%breach-and-hear who her])]) + (poke-our %spider %spider-imput vase) +:: ++ real-ship |= =ship =/ m (thread ,~) @@ -156,6 +172,14 @@ ;< ~ bind:m (dojo from "|hi {(scow %p to)}") (wait-for-output from "hi {(scow %p to)} successful") :: +:: Send "|hi" and wait for "not responding" message +:: +++ send-hi-not-responding + |= [from=@p to=@p] + =/ m (thread ,~) + ;< ~ bind:m (dojo from "|hi {(scow %p to)}") + (wait-for-output from "{(scow %p to)} not responding still trying") +:: :: Mount a desk. :: ++ mount From aeba01b670942f5d0449813d618198bca74603e6 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 1 Oct 2019 20:26:58 -0700 Subject: [PATCH 163/451] ph: remove old ph agent --- pkg/arvo/age/ph.hoon | 585 ------------------------------------------- 1 file changed, 585 deletions(-) delete mode 100644 pkg/arvo/age/ph.hoon diff --git a/pkg/arvo/age/ph.hoon b/pkg/arvo/age/ph.hoon deleted file mode 100644 index e402b67b0..000000000 --- a/pkg/arvo/age/ph.hoon +++ /dev/null @@ -1,585 +0,0 @@ -:: Test the pH of your aquarium. See if it's safe to put in real fish. -:: -:: usage: -:: :aqua [%run-test %test-add] -:: -/- aquarium, ph -/+ ph, ph-tests, ph-azimuth, ph-philter, default-agent -=, ph-sur=^ph -=, aquarium -=, ph -=, ph-philter -=> $~ |% - +$ card card:agent:mall - +$ state - $: %0 - test-core=(unit test-core-state) - tests=(map term [(list ship) _*form:(ph ,~)]) - other-state - == - :: - +$ test-core-state - $: lab=term - hers=(list ship) - test=_*form:(ph ,~) - == - :: - +$ other-state - $: test-qeu=(qeu term) - results=(list (pair term ?)) - effect-log=(list [who=ship uf=unix-effect]) - == - -- -:: -=; ph-core - =| =all=state - ^- agent:mall - |_ =bowl:mall - +* this . - def ~(. default-agent bowl this) - ++ handle-init - ~& prep=%ph - =. tests.all-state (malt ~(manual-tests ph-core bowl all-state)) - `this - ++ handle-extract-state !>(all-state) - ++ handle-upgrade-state - |= old-state=vase - ^- step:agent:mall - handle-init - :: - ++ handle-poke - |= [=mark =vase] - ^- step:agent:mall - ?. ?=(%ph-command mark) - (handle-poke:def mark vase) - =^ cards ph-core - (~(poke-ph-command ph-core bowl all-state) !<(cli:ph-sur vase)) - [cards this(all-state +<+.ph-core)] - :: - ++ handle-subscribe - |= =path - ^- step:agent:mall - ?. ?=([%effects ~] path) - ~| [%ph-bad-subscribe-path path] - !! - `this - :: - ++ handle-unsubscribe handle-unsubscribe:def - ++ handle-peek handle-peek:def - ++ handle-agent-response - |= [=wire =gift:agent:mall] - ^- step:agent:mall - ?. ?=([%subscription-update * %aqua-effects *] gift) - (handle-agent-response:def wire gift) - =^ cards ph-core - %+ ~(diff-aqua-effects ph-core bowl all-state) - wire - !<(aqua-effects q.cage.gift) - [cards this(all-state +<+.ph-core)] - :: - ++ handle-arvo-response handle-arvo-response:def - ++ handle-error handle-error:def - -- -:: -=/ vane-apps=(list term) - ~[%aqua-ames %aqua-behn %aqua-dill %aqua-eyre] -|_ $: hid=bowl:mall - state - == -++ this . -++ manual-tests - ^- (list (pair term [(list ship) _*form:(ph ,~)])) - =+ (ph-tests our.hid) - =+ ph-azimuth=(ph-azimuth our.hid) - =/ eth-node (spawn:ph-azimuth ~bud) - =/ m (ph ,~) - :~ :+ %boot-bud - ~[~bud] - (raw-ship ~bud ~) - :: - :+ %add - ~[~bud] - ;< ~ bind:m (raw-ship ~bud ~) - |= pin=ph-input - ?: =(%init -.q.uf.pin) - [& (dojo ~bud "[%test-result (add 2 3)]") %wait ~] - ?: (is-dojo-output ~bud who.pin uf.pin "[%test-result 5]") - [& ~ %done ~] - [& ~ %wait ~] - :: - :+ %hi - ~[~bud ~dev] - ;< ~ bind:m (raw-ship ~bud ~) - ~& > "BUD DONE" - ;< ~ bind:m (raw-ship ~dev ~) - ~& > "DEV DONE" - (send-hi ~bud ~dev) - :: - :+ %boot-planet - ~[~bud ~marbud ~linnup-torsyx] - (planet ~linnup-torsyx) - :: - :+ %second-cousin-hi - ~[~bud ~marbud ~linnup-torsyx ~dev ~mardev ~mitnep-todsut] - ;< ~ bind:m (planet ~linnup-torsyx) - ;< ~ bind:m (planet ~mitnep-todsut) - (send-hi ~linnup-torsyx ~mitnep-todsut) - :: - :+ %change-file - ~[~bud] - ;< ~ bind:m (raw-ship ~bud ~) - ;< file=@t bind:m (touch-file ~bud %home) - (check-file-touched ~bud %home file) - :: - :+ %child-sync - ~[~bud ~marbud] - ;< ~ bind:m (star ~marbud) - ~& > 'MARBUD DONE' - ;< file=@t bind:m (touch-file ~bud %base) - ~& > 'TOUCH DONE' - (check-file-touched ~marbud %home file) - :: - :+ %boot-az - ~[~bud] - ;< [eth-node=_eth-node ~] bind:m - %+ (wrap-philter ,_eth-node ,~) - router:eth-node - (raw-real-ship:eth-node ~bud) - (pure:m ~) - :: - :+ %hi-az - ~[~bud ~dev] - =. eth-node (spawn:eth-node ~dev) - ;< [eth-node=_eth-node ~] bind:m - %+ (wrap-philter ,_eth-node ,~) - router:eth-node - ;< ~ bind:m (raw-real-ship:eth-node ~dev) - ~& > %dev-done - ;< ~ bind:m (raw-real-ship:eth-node ~bud) - ~& > %bud-done - (send-hi ~bud ~dev) - (pure:m ~) - :: - :+ %moon-az - ~[~bud ~marbud ~linnup-torsyx ~linnup-torsyx-linnup-torsyx ~dev] - =. eth-node (spawn:eth-node ~marbud) - =. eth-node (spawn:eth-node ~linnup-torsyx) - =. eth-node (spawn:eth-node ~dev) - ;< [eth-node=_eth-node ~] bind:m - %+ (wrap-philter ,_eth-node ,~) - router:eth-node - ;< ~ bind:m (raw-real-ship:eth-node ~bud) - ~& > 'BUD DONE' - ;< ~ bind:m (raw-real-ship:eth-node ~marbud) - ~& > 'MARBUD DONE' - ;< ~ bind:m (raw-real-ship:eth-node ~linnup-torsyx) - ~& > 'LINNUP DONE' - ;< ~ bind:m (raw-real-ship:eth-node ~linnup-torsyx-linnup-torsyx) - ~& > 'MOON LINNUP DONE' - ;< ~ bind:m (send-hi ~bud ~linnup-torsyx-linnup-torsyx) - ~& > 'HI DOWN DONE' - ;< ~ bind:m (send-hi ~linnup-torsyx-linnup-torsyx ~marbud) - ~& > 'HI UP DONE' - ;< ~ bind:m (raw-real-ship:eth-node ~dev) - ~& > 'DEV DONE' - ;< ~ bind:m (send-hi ~linnup-torsyx-linnup-torsyx ~dev) - ~& > 'HI OVER UP DONE' - ;< ~ bind:m (send-hi ~dev ~linnup-torsyx-linnup-torsyx) - ~& > 'HI OVER DOWN DONE' - (pure:m ~) - (pure:m ~) - :: - :+ %breach-hi - ~[~bud ~dev] - =. eth-node (spawn:eth-node ~dev) - ;< [eth-node=_eth-node ~] bind:m - %+ (wrap-philter ,_eth-node ,~) - router:eth-node - ;< ~ bind:m (raw-real-ship:eth-node ~bud) - ~& > 'BUD DONE' - ;< ~ bind:m (raw-real-ship:eth-node ~dev) - ~& > 'DEV DONE' - (send-hi ~bud ~dev) - ~& > 'HI DONE' - ;< eth-node=_eth-node bind:m - (breach-and-hear:eth-node our.hid ~dev ~bud) - ~& > 'BREACH DONE' - ;< [eth-node=_eth-node ~] bind:m - %+ (wrap-philter ,_eth-node ,~) - router:eth-node - ;< ~ bind:m (send-hi-not-responding ~bud ~dev) - ~& > 'HI NOT RESPONDING DONE' - ;< ~ bind:m (raw-real-ship:eth-node ~dev) - ~& > 'REBOOT DEV DONE' - (wait-for-dojo ~bud "hi ~dev successful") - ~& > 'DONE' - (pure:m ~) - :: - :+ %breach-hi-cousin - ~[~bud ~dev ~marbud ~mardev] - =. eth-node (spawn:eth-node ~dev) - =. eth-node (spawn:eth-node ~marbud) - =. eth-node (spawn:eth-node ~mardev) - ;< [eth-node=_eth-node ~] bind:m - %+ (wrap-philter ,_eth-node ,~) - router:eth-node - ;< ~ bind:m (raw-real-ship:eth-node ~bud) - ;< ~ bind:m (raw-real-ship:eth-node ~dev) - ;< ~ bind:m (raw-real-ship:eth-node ~marbud) - ;< ~ bind:m (raw-real-ship:eth-node ~mardev) - (send-hi ~marbud ~mardev) - ;< eth-node=_eth-node bind:m - (breach-and-hear:eth-node our.hid ~mardev ~marbud) - ;< [eth-node=_eth-node ~] bind:m - %+ (wrap-philter ,_eth-node ,~) - router:eth-node - ;< ~ bind:m (send-hi-not-responding ~marbud ~mardev) - ;< ~ bind:m (raw-real-ship:eth-node ~mardev) - (wait-for-dojo ~marbud "hi ~mardev successful") - (pure:m ~) - :: - :+ %breach-sync - ~[~bud ~marbud] - =. eth-node (spawn:eth-node ~marbud) - =. eth-node (spawn:eth-node ~fipfes) - ;< [eth-node=_eth-node ~] bind:m - %+ (wrap-philter ,_eth-node ,~) - router:eth-node - ;< ~ bind:m (raw-real-ship:eth-node ~bud) - ~& > 'BUD DONE' - ;< ~ bind:m (raw-real-ship:eth-node ~marbud) - ~& > 'MARBUD DONE' - ;< file=@t bind:m (touch-file ~bud %base) - ~& > 'TOUCH FILE DONE' - (check-file-touched ~marbud %home file) - ~& > 'TOUCH FILE CHECK DONE' - ;< eth-node=_eth-node bind:m - (breach-and-hear:eth-node our.hid ~bud ~marbud) - ~& > 'BREACH DONE' - ;< [eth-node=_eth-node ~] bind:m - %+ (wrap-philter ,_eth-node ,~) - router:eth-node - ;< ~ bind:m (raw-real-ship:eth-node ~bud) - ~& > 'BUD RE DONE' - ;< ~ bind:m (just-events (dojo ~bud "|merge %base ~marbud %kids, =gem %this")) - ~& > 'THIS MERGE STARTED DONE' - ;< file=@t bind:m (touch-file ~bud %base) - ~& > 'TOUCH-1 DONE' - ;< file=@t bind:m (touch-file ~bud %base) - ~& > 'TOUCH-2 DONE' - (check-file-touched ~marbud %home file) - ~& > 'DONE DONE' - (pure:m ~) - :: - :+ %breach-multiple - ~[~bud ~marbud] - =. eth-node (spawn:eth-node ~marbud) - =. eth-node (spawn:eth-node ~fipfes) - ;< [eth-node=_eth-node ~] bind:m - %+ (wrap-philter ,_eth-node ,~) - router:eth-node - ;< ~ bind:m (raw-real-ship:eth-node ~bud) - ~& > 'BUD DONE' - ;< ~ bind:m (raw-real-ship:eth-node ~marbud) - ~& > 'MARBUD DONE' - ;< file=@t bind:m (touch-file ~bud %base) - ~& > 'TOUCH DONE' - (check-file-touched ~marbud %home file) - ;< eth-node=_eth-node bind:m - (breach-and-hear:eth-node our.hid ~bud ~marbud) - ~& > 'BREACH-1 DONE' - ;< [eth-node=_eth-node ~] bind:m - %+ (wrap-philter ,_eth-node ,~) - router:eth-node - (raw-real-ship:eth-node ~bud) - ~& > 'BUD RE DONE' - ;< eth-node=_eth-node bind:m - (breach-and-hear:eth-node our.hid ~marbud ~bud) - ~& > 'BREACH-2 DONE' - ;< [eth-node=_eth-node ~] bind:m - %+ (wrap-philter ,_eth-node ,~) - router:eth-node - ;< ~ bind:m (raw-real-ship:eth-node ~marbud) - ~& > 'MARBUD RE DONE' - ;< file=@t bind:m (touch-file ~bud %base) - ~& > 'TOUCH-1 DONE' - ;< file=@t bind:m (touch-file ~bud %base) - ~& > 'TOUCH-2 DONE' - (check-file-touched ~marbud %home file) - ~& > 'DONE DONE' - (pure:m ~) - :: - :+ %breach-sudden - ~[~bud ~marbud] - =. eth-node (spawn:eth-node ~marbud) - =. eth-node (spawn:eth-node ~fipfes) - ;< [eth-node=_eth-node ~] bind:m - %+ (wrap-philter ,_eth-node ,~) - router:eth-node - ;< ~ bind:m (raw-real-ship:eth-node ~bud) - ~& > 'BUD DONE' - ;< ~ bind:m (raw-real-ship:eth-node ~marbud) - ~& > 'MARBUD DONE' - ;< file=@t bind:m (touch-file ~bud %base) - ~& > 'TOUCH FILE DONE' - (check-file-touched ~marbud %home file) - ~& > 'TOUCH FILE CHECK DONE' - =. eth-node (breach:eth-node ~bud) - ~& > 'BREACH EXECUTED' - ;< [eth-node=_eth-node ~] bind:m - %+ (wrap-philter ,_eth-node ,~) - router:eth-node - ;< ~ bind:m (raw-real-ship:eth-node ~bud) - ~& > 'BUD RE DONE' - ;< ~ bind:m (just-events (dojo ~bud "|merge %base ~marbud %kids, =gem %this")) - ~& > 'THIS MERGE STARTED DONE' - ;< file=@t bind:m (touch-file ~bud %base) - ~& > 'TOUCH-1 DONE' - ;< file=@t bind:m (touch-file ~bud %base) - ~& > 'TOUCH-2 DONE' - (check-file-touched ~marbud %home file) - ~& > 'DONE DONE' - (pure:m ~) - == -:: -++ publish-aqua-effects - |= afs=aqua-effects - ^- (list card) - [%give %subscription-update `/effects %aqua-effects !>(afs)]~ -:: -++ run-events - |= [lab=term what=(list ph-event)] - ^- (quip card _this) - ?: =(~ what) - `this - =/ res - |- ^- (each (list aqua-event) ?) - ?~ what - [%& ~] - ?: ?=(%test-done -.i.what) - [%| p.i.what] - =/ nex $(what t.what) - ?: ?=(%| -.nex) - nex - [%& `aqua-event`i.what p.nex] - ?: ?=(%| -.res) - =^ cards-1 this (finish-test lab p.res) - =^ cards-2 this run-test - [(weld cards-1 cards-2) this] - [[%pass /running %agent [our.hid %aqua] %poke %aqua-events !>(p.res)]~ this] -:: -:: Cancel subscriptions to ships -:: -++ finish-test - |= [lab=term success=?] - ^- (quip card _this) - ?~ test-core - `this - ~& ?: success - "TEST {(trip lab)} SUCCESSFUL" - "TEST {(trip lab)} FAILED" - :_ this(test-core ~, results [[lab success] results]) - %- zing - %+ turn hers.u.test-core - |= her=ship - ^- (list card) - :~ [%pass /[lab]/(scot %p her) %agent [our.hid %aqua] %unsubscribe ~] - :* %pass - /cancelling - %agent - [our.hid %aqua] - %poke - %aqua-events - !>([%pause-events her]~) - == - == -:: -:: Start another test if one is in the queue -:: -++ run-test - ^- (quip card _this) - ?^ test-core - `this - ?: =(~ test-qeu) - ?~ results - `this - =/ throw-away print-results - `this(results ~) - =^ lab test-qeu ~(get to test-qeu) - ~& [running-test=lab test-qeu] - =. effect-log ~ - =+ ^- [ships=(list ship) test=_*form:(ph ,~)] - (~(got by tests) lab) - => .(test-core `(unit test-core-state)`test-core) - =. test-core `[lab ships test] - =^ cards-1 this (subscribe-to-effects lab ships) - =^ cards-2 this - (diff-aqua-effects /[lab]/(scot %p -.ships) -.ships [/ %init ~]~) - [:(weld init-vanes pause-fleet subscribe-vanes cards-1 cards-2) this] -:: -:: Print results with ~& -:: -++ print-results - ~& "TEST REPORT:" - =/ throw-away - %+ turn - results - |= [lab=term success=?] - ~& "{?:(success "SUCCESS" "FAILURE")}: {(trip lab)}" - ~ - ~& ?: (levy results |=([term s=?] s)) - "ALL TESTS SUCCEEDED" - "FAILURES" - ~ -:: -:: Should check whether we're already subscribed -:: -++ subscribe-to-effects - |= [lab=@tas hers=(list ship)] - :_ this - %+ turn hers - |= her=ship - ^- card - :* %pass - /[lab]/(scot %p her) - %agent - [our.hid %aqua] - %subscribe - /effects/(scot %p her) - == -:: -:: Start the vane drivers -:: -++ init-vanes - ^- (list card) - %+ murn - `(list term)`[%aqua vane-apps] - |= vane-app=term - ^- (unit card) - =/ app-started - .^(? %mu /(scot %p our.hid)/[vane-app]/(scot %da now.hid)) - ?: app-started - ~ - `[%pass /start %agent [our.hid %hood] %poke %drum-start !>([%home vane-app])] -:: -:: Restart the vane drivers' subscriptions -:: -++ subscribe-vanes - ^- (list card) - %+ turn - vane-apps - |= vane-app=term - :* %pass /init - %agent [our.hid vane-app] - %poke %aqua-vane-control - !>(%subscribe) - == -:: -:: Pause all existing ships -:: -++ pause-fleet - ^- (list card) - :_ ~ - :* %pass /pause-fleet - %agent [our.hid %aqua] - %poke %aqua-events !> - %+ turn - .^((list ship) %mx /(scot %p our.hid)/aqua/(scot %da now.hid)/ships/noun) - |= who=ship - [%pause-events who] - == -:: -:: User interface -:: -++ poke-ph-command - |= com=cli:ph-sur - ^- (quip card _this) - ?- -.com - %init [init-vanes this] - %run - ?. (~(has by tests) lab.com) - ~& [%no-test lab.com] - `this - =. test-qeu (~(put to test-qeu) lab.com) - run-test - :: - %cancel - =^ cards-1 this (finish-test %last |) - =. test-qeu ~ - =^ cards-2 this run-test - [:(weld cards-1 cards-2) this] - :: - %run-all - =. test-qeu - %- ~(gas to test-qeu) - (turn manual-tests head) - run-test - :: - %print - ~& lent=(lent effect-log) - ~& %+ roll effect-log - |= [[who=ship uf=unix-effect] ~] - ?: ?=(?(%blit %doze) -.q.uf) - ~ - ?: ?=(%ergo -.q.uf) - ~& [who [- +<]:uf %omitted-by-ph] - ~ - ~& [who uf] - ~ - `this - == -:: -:: Receive effects back from aqua -:: -++ diff-aqua-effects - |= [way=wire afs=aqua-effects] - ^- (quip card _this) - :: ~& [%diff-aqua-effect way who.afs] - ?> ?=([@tas @ ~] way) - =/ lab i.way - ?~ test-core - ~& [%ph-dropping-done lab] - [[%pass way %agent [our.hid %aqua] %unsubscribe ~]~ this] - ?. =(lab lab.u.test-core) - ~& [%ph-dropping-strange lab] - [[%pass way %agent [our.hid %aqua] %unsubscribe ~]~ this] - =+ |- ^- $: thru-effects=(list unix-effect) - events=(list ph-event) - log=_effect-log - done=(unit ?) - test=_test.u.test-core - == - ?~ ufs.afs - [~ ~ ~ ~ test.u.test-core] - =/ m-res=_*output:(ph ,~) - (test.u.test-core now.hid who.afs i.ufs.afs) - =? ufs.afs =(%cont -.next.m-res) - [i.ufs.afs [/ %init ~] t.ufs.afs] - =^ done=(unit ?) test.u.test-core - ?- -.next.m-res - %wait [~ test.u.test-core] - %cont [~ self.next.m-res] - %fail [`| test.u.test-core] - %done [`& test.u.test-core] - == - =+ ^- _$ - ?~ done - $(ufs.afs t.ufs.afs) - [~ ~ ~ done test.u.test-core] - :^ ?: thru.m-res - [i.ufs.afs thru-effects] - thru-effects - (weld events.m-res events) - [[who i.ufs]:afs log] - [done test] - =. test.u.test-core test - =. effect-log (weld log effect-log) - => .(test-core `(unit test-core-state)`test-core) - ?^ done - =^ cards-1 this (finish-test lab u.done) - =^ cards-2 this run-test - [(weld cards-1 cards-2) this] - =/ cards-1 (publish-aqua-effects who.afs thru-effects) - =^ cards-2 this (run-events lab events) - [(weld cards-1 cards-2) this] --- From 8dca89f6f8cc6edd24dca8b0e692d9d447d5a801 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 1 Oct 2019 20:39:49 -0700 Subject: [PATCH 164/451] ph: reduce ph-io boilerplate --- pkg/arvo/imp/ph/add.hoon | 12 +++++----- pkg/arvo/imp/ph/boot-az.hoon | 10 ++++----- pkg/arvo/imp/ph/boot-planet.hoon | 12 +++++----- pkg/arvo/imp/ph/breach-hi-cousin.hoon | 32 +++++++++++++-------------- pkg/arvo/imp/ph/breach-hi.hoon | 24 ++++++++++---------- pkg/arvo/imp/ph/breach-multiple.hoon | 32 +++++++++++++-------------- pkg/arvo/imp/ph/breach-sudden.hoon | 30 ++++++++++++------------- pkg/arvo/imp/ph/breach-sync.hoon | 30 ++++++++++++------------- pkg/arvo/imp/ph/change-file.hoon | 13 +++++------ pkg/arvo/imp/ph/child-sync.hoon | 14 ++++++------ pkg/arvo/imp/ph/hi-az.hoon | 16 +++++++------- pkg/arvo/imp/ph/hi.hoon | 14 ++++++------ pkg/arvo/imp/ph/moon-az.hoon | 32 +++++++++++++-------------- pkg/arvo/imp/ph/second-cousin-hi.hoon | 20 ++++++++--------- 14 files changed, 145 insertions(+), 146 deletions(-) diff --git a/pkg/arvo/imp/ph/add.hoon b/pkg/arvo/imp/ph/add.hoon index c4840fcd4..5aa1ba24b 100644 --- a/pkg/arvo/imp/ph/add.hoon +++ b/pkg/arvo/imp/ph/add.hoon @@ -1,12 +1,12 @@ /- spider -/+ ph-io +/+ *ph-io =, thread=thread:spider ^- imp:spider |= =bowl:mall =/ m (thread ,~) -;< ~ bind:m start-simple:ph-io -;< ~ bind:m (raw-ship:ph-io ~bud ~) -;< ~ bind:m (dojo:ph-io ~bud "[%test-result (add 2 3)]") -;< ~ bind:m (wait-for-output:ph-io ~bud "[%test-result 5]") -;< ~ bind:m end-simple:ph-io +;< ~ bind:m start-simple +;< ~ bind:m (raw-ship ~bud ~) +;< ~ bind:m (dojo ~bud "[%test-result (add 2 3)]") +;< ~ bind:m (wait-for-output ~bud "[%test-result 5]") +;< ~ bind:m end-simple (pure:m ~) diff --git a/pkg/arvo/imp/ph/boot-az.hoon b/pkg/arvo/imp/ph/boot-az.hoon index 3a31973f9..60f3d322f 100644 --- a/pkg/arvo/imp/ph/boot-az.hoon +++ b/pkg/arvo/imp/ph/boot-az.hoon @@ -1,11 +1,11 @@ /- spider -/+ ph-io +/+ *ph-io =, thread=thread:spider ^- imp:spider |= =bowl:mall =/ m (thread ,~) -;< ~ bind:m start-azimuth:ph-io -;< ~ bind:m (spawn:ph-io ~bud) -;< ~ bind:m (real-ship:ph-io ~bud) -;< ~ bind:m end-azimuth:ph-io +;< ~ bind:m start-azimuth +;< ~ bind:m (spawn ~bud) +;< ~ bind:m (real-ship ~bud) +;< ~ bind:m end-azimuth (pure:m ~) diff --git a/pkg/arvo/imp/ph/boot-planet.hoon b/pkg/arvo/imp/ph/boot-planet.hoon index 758331f68..da62c45f3 100644 --- a/pkg/arvo/imp/ph/boot-planet.hoon +++ b/pkg/arvo/imp/ph/boot-planet.hoon @@ -1,12 +1,12 @@ /- spider -/+ ph-io +/+ *ph-io =, thread=thread:spider ^- imp:spider |= =bowl:mall =/ m (thread ,~) -;< ~ bind:m start-simple:ph-io -;< ~ bind:m (raw-ship:ph-io ~bud ~) -;< ~ bind:m (raw-ship:ph-io ~marbud ~) -;< ~ bind:m (raw-ship:ph-io ~linnup-torsyx ~) -;< ~ bind:m end-simple:ph-io +;< ~ bind:m start-simple +;< ~ bind:m (raw-ship ~bud ~) +;< ~ bind:m (raw-ship ~marbud ~) +;< ~ bind:m (raw-ship ~linnup-torsyx ~) +;< ~ bind:m end-simple (pure:m ~) diff --git a/pkg/arvo/imp/ph/breach-hi-cousin.hoon b/pkg/arvo/imp/ph/breach-hi-cousin.hoon index 7b923867e..c1aaf44c3 100644 --- a/pkg/arvo/imp/ph/breach-hi-cousin.hoon +++ b/pkg/arvo/imp/ph/breach-hi-cousin.hoon @@ -1,22 +1,22 @@ /- spider -/+ ph-io +/+ *ph-io =, thread=thread:spider ^- imp:spider |= =bowl:mall =/ m (thread ,~) -;< ~ bind:m start-azimuth:ph-io -;< ~ bind:m (spawn:ph-io ~bud) -;< ~ bind:m (spawn:ph-io ~dev) -;< ~ bind:m (spawn:ph-io ~marbud) -;< ~ bind:m (spawn:ph-io ~mardev) -;< ~ bind:m (real-ship:ph-io ~bud) -;< ~ bind:m (real-ship:ph-io ~dev) -;< ~ bind:m (real-ship:ph-io ~marbud) -;< ~ bind:m (real-ship:ph-io ~mardev) -;< ~ bind:m (send-hi:ph-io ~marbud ~mardev) -;< ~ bind:m (breach-and-hear:ph-io ~mardev ~marbud) -;< ~ bind:m (send-hi-not-responding:ph-io ~marbud ~mardev) -;< ~ bind:m (real-ship:ph-io ~mardev) -;< ~ bind:m (wait-for-output:ph-io ~marbud "hi ~mardev successful") -;< ~ bind:m end-azimuth:ph-io +;< ~ bind:m start-azimuth +;< ~ bind:m (spawn ~bud) +;< ~ bind:m (spawn ~dev) +;< ~ bind:m (spawn ~marbud) +;< ~ bind:m (spawn ~mardev) +;< ~ bind:m (real-ship ~bud) +;< ~ bind:m (real-ship ~dev) +;< ~ bind:m (real-ship ~marbud) +;< ~ bind:m (real-ship ~mardev) +;< ~ bind:m (send-hi ~marbud ~mardev) +;< ~ bind:m (breach-and-hear ~mardev ~marbud) +;< ~ bind:m (send-hi-not-responding ~marbud ~mardev) +;< ~ bind:m (real-ship ~mardev) +;< ~ bind:m (wait-for-output ~marbud "hi ~mardev successful") +;< ~ bind:m end-azimuth (pure:m ~) diff --git a/pkg/arvo/imp/ph/breach-hi.hoon b/pkg/arvo/imp/ph/breach-hi.hoon index 354cec0fa..1c043ca5b 100644 --- a/pkg/arvo/imp/ph/breach-hi.hoon +++ b/pkg/arvo/imp/ph/breach-hi.hoon @@ -1,18 +1,18 @@ /- spider -/+ ph-io +/+ *ph-io =, thread=thread:spider ^- imp:spider |= =bowl:mall =/ m (thread ,~) -;< ~ bind:m start-azimuth:ph-io -;< ~ bind:m (spawn:ph-io ~bud) -;< ~ bind:m (spawn:ph-io ~dev) -;< ~ bind:m (real-ship:ph-io ~bud) -;< ~ bind:m (real-ship:ph-io ~dev) -;< ~ bind:m (send-hi:ph-io ~bud ~dev) -;< ~ bind:m (breach-and-hear:ph-io ~dev ~bud) -;< ~ bind:m (send-hi-not-responding:ph-io ~bud ~dev) -;< ~ bind:m (real-ship:ph-io ~dev) -;< ~ bind:m (wait-for-output:ph-io ~bud "hi ~dev successful") -;< ~ bind:m end-azimuth:ph-io +;< ~ bind:m start-azimuth +;< ~ bind:m (spawn ~bud) +;< ~ bind:m (spawn ~dev) +;< ~ bind:m (real-ship ~bud) +;< ~ bind:m (real-ship ~dev) +;< ~ bind:m (send-hi ~bud ~dev) +;< ~ bind:m (breach-and-hear ~dev ~bud) +;< ~ bind:m (send-hi-not-responding ~bud ~dev) +;< ~ bind:m (real-ship ~dev) +;< ~ bind:m (wait-for-output ~bud "hi ~dev successful") +;< ~ bind:m end-azimuth (pure:m ~) diff --git a/pkg/arvo/imp/ph/breach-multiple.hoon b/pkg/arvo/imp/ph/breach-multiple.hoon index 16cf91657..fa09816a1 100644 --- a/pkg/arvo/imp/ph/breach-multiple.hoon +++ b/pkg/arvo/imp/ph/breach-multiple.hoon @@ -1,22 +1,22 @@ /- spider -/+ ph-io +/+ *ph-io =, thread=thread:spider ^- imp:spider |= =bowl:mall =/ m (thread ,~) -;< ~ bind:m start-azimuth:ph-io -;< ~ bind:m (spawn:ph-io ~bud) -;< ~ bind:m (spawn:ph-io ~marbud) -;< ~ bind:m (real-ship:ph-io ~bud) -;< ~ bind:m (real-ship:ph-io ~marbud) -;< file=@t bind:m (touch-file:ph-io ~bud %base) -;< ~ bind:m (check-file-touched:ph-io ~marbud %home file) -;< ~ bind:m (breach-and-hear:ph-io ~bud ~marbud) -;< ~ bind:m (real-ship:ph-io ~bud) -;< ~ bind:m (breach-and-hear:ph-io ~marbud ~bud) -;< ~ bind:m (real-ship:ph-io ~marbud) -;< file=@t bind:m (touch-file:ph-io ~bud %base) -;< file=@t bind:m (touch-file:ph-io ~bud %base) -;< ~ bind:m (check-file-touched:ph-io ~marbud %home file) -;< ~ bind:m end-azimuth:ph-io +;< ~ bind:m start-azimuth +;< ~ bind:m (spawn ~bud) +;< ~ bind:m (spawn ~marbud) +;< ~ bind:m (real-ship ~bud) +;< ~ bind:m (real-ship ~marbud) +;< file=@t bind:m (touch-file ~bud %base) +;< ~ bind:m (check-file-touched ~marbud %home file) +;< ~ bind:m (breach-and-hear ~bud ~marbud) +;< ~ bind:m (real-ship ~bud) +;< ~ bind:m (breach-and-hear ~marbud ~bud) +;< ~ bind:m (real-ship ~marbud) +;< file=@t bind:m (touch-file ~bud %base) +;< file=@t bind:m (touch-file ~bud %base) +;< ~ bind:m (check-file-touched ~marbud %home file) +;< ~ bind:m end-azimuth (pure:m ~) diff --git a/pkg/arvo/imp/ph/breach-sudden.hoon b/pkg/arvo/imp/ph/breach-sudden.hoon index a0173f468..dc25fc01a 100644 --- a/pkg/arvo/imp/ph/breach-sudden.hoon +++ b/pkg/arvo/imp/ph/breach-sudden.hoon @@ -1,21 +1,21 @@ /- spider -/+ ph-io +/+ *ph-io =, thread=thread:spider ^- imp:spider |= =bowl:mall =/ m (thread ,~) -;< ~ bind:m start-azimuth:ph-io -;< ~ bind:m (spawn:ph-io ~bud) -;< ~ bind:m (spawn:ph-io ~marbud) -;< ~ bind:m (real-ship:ph-io ~bud) -;< ~ bind:m (real-ship:ph-io ~marbud) -;< file=@t bind:m (touch-file:ph-io ~bud %base) -;< ~ bind:m (check-file-touched:ph-io ~marbud %home file) -;< ~ bind:m (breach:ph-io ~bud) -;< ~ bind:m (real-ship:ph-io ~bud) -;< ~ bind:m (dojo:ph-io ~bud "|merge %base ~marbud %kids, =gem %this") -;< file=@t bind:m (touch-file:ph-io ~bud %base) -;< file=@t bind:m (touch-file:ph-io ~bud %base) -;< ~ bind:m (check-file-touched:ph-io ~marbud %home file) -;< ~ bind:m end-azimuth:ph-io +;< ~ bind:m start-azimuth +;< ~ bind:m (spawn ~bud) +;< ~ bind:m (spawn ~marbud) +;< ~ bind:m (real-ship ~bud) +;< ~ bind:m (real-ship ~marbud) +;< file=@t bind:m (touch-file ~bud %base) +;< ~ bind:m (check-file-touched ~marbud %home file) +;< ~ bind:m (breach ~bud) +;< ~ bind:m (real-ship ~bud) +;< ~ bind:m (dojo ~bud "|merge %base ~marbud %kids, =gem %this") +;< file=@t bind:m (touch-file ~bud %base) +;< file=@t bind:m (touch-file ~bud %base) +;< ~ bind:m (check-file-touched ~marbud %home file) +;< ~ bind:m end-azimuth (pure:m ~) diff --git a/pkg/arvo/imp/ph/breach-sync.hoon b/pkg/arvo/imp/ph/breach-sync.hoon index 54d771cb7..889fce0ce 100644 --- a/pkg/arvo/imp/ph/breach-sync.hoon +++ b/pkg/arvo/imp/ph/breach-sync.hoon @@ -1,21 +1,21 @@ /- spider -/+ ph-io +/+ *ph-io =, thread=thread:spider ^- imp:spider |= =bowl:mall =/ m (thread ,~) -;< ~ bind:m start-azimuth:ph-io -;< ~ bind:m (spawn:ph-io ~bud) -;< ~ bind:m (spawn:ph-io ~marbud) -;< ~ bind:m (real-ship:ph-io ~bud) -;< ~ bind:m (real-ship:ph-io ~marbud) -;< file=@t bind:m (touch-file:ph-io ~bud %base) -;< ~ bind:m (check-file-touched:ph-io ~marbud %home file) -;< ~ bind:m (breach-and-hear:ph-io ~bud ~marbud) -;< ~ bind:m (real-ship:ph-io ~bud) -;< ~ bind:m (dojo:ph-io ~bud "|merge %base ~marbud %kids, =gem %this") -;< file=@t bind:m (touch-file:ph-io ~bud %base) -;< file=@t bind:m (touch-file:ph-io ~bud %base) -;< ~ bind:m (check-file-touched:ph-io ~marbud %home file) -;< ~ bind:m end-azimuth:ph-io +;< ~ bind:m start-azimuth +;< ~ bind:m (spawn ~bud) +;< ~ bind:m (spawn ~marbud) +;< ~ bind:m (real-ship ~bud) +;< ~ bind:m (real-ship ~marbud) +;< file=@t bind:m (touch-file ~bud %base) +;< ~ bind:m (check-file-touched ~marbud %home file) +;< ~ bind:m (breach-and-hear ~bud ~marbud) +;< ~ bind:m (real-ship ~bud) +;< ~ bind:m (dojo ~bud "|merge %base ~marbud %kids, =gem %this") +;< file=@t bind:m (touch-file ~bud %base) +;< file=@t bind:m (touch-file ~bud %base) +;< ~ bind:m (check-file-touched ~marbud %home file) +;< ~ bind:m end-azimuth (pure:m ~) diff --git a/pkg/arvo/imp/ph/change-file.hoon b/pkg/arvo/imp/ph/change-file.hoon index b278abf88..7ee47890c 100644 --- a/pkg/arvo/imp/ph/change-file.hoon +++ b/pkg/arvo/imp/ph/change-file.hoon @@ -1,13 +1,12 @@ /- spider -/+ ph-io, threadio +/+ *ph-io =, thread=thread:spider ^- imp:spider |= =bowl:mall =/ m (thread ,~) -;< ~ bind:m start-simple:ph-io -;< ~ bind:m (raw-ship:ph-io ~bud ~) -;< file=@t bind:m (touch-file:ph-io ~bud %home) -;< ~ bind:m (check-file-touched:ph-io ~bud %home file) -;< ~ bind:m (sleep:threadio ~d1) -;< ~ bind:m end-simple:ph-io +;< ~ bind:m start-simple +;< ~ bind:m (raw-ship ~bud ~) +;< file=@t bind:m (touch-file ~bud %home) +;< ~ bind:m (check-file-touched ~bud %home file) +;< ~ bind:m end-simple (pure:m ~) diff --git a/pkg/arvo/imp/ph/child-sync.hoon b/pkg/arvo/imp/ph/child-sync.hoon index 1c6c3a432..19465ddb1 100644 --- a/pkg/arvo/imp/ph/child-sync.hoon +++ b/pkg/arvo/imp/ph/child-sync.hoon @@ -1,13 +1,13 @@ /- spider -/+ ph-io +/+ *ph-io =, thread=thread:spider ^- imp:spider |= =bowl:mall =/ m (thread ,~) -;< ~ bind:m start-simple:ph-io -;< ~ bind:m (raw-ship:ph-io ~bud ~) -;< ~ bind:m (raw-ship:ph-io ~marbud ~) -;< file=@t bind:m (touch-file:ph-io ~bud %base) -;< ~ bind:m (check-file-touched:ph-io ~marbud %home file) -;< ~ bind:m end-simple:ph-io +;< ~ bind:m start-simple +;< ~ bind:m (raw-ship ~bud ~) +;< ~ bind:m (raw-ship ~marbud ~) +;< file=@t bind:m (touch-file ~bud %base) +;< ~ bind:m (check-file-touched ~marbud %home file) +;< ~ bind:m end-simple (pure:m ~) diff --git a/pkg/arvo/imp/ph/hi-az.hoon b/pkg/arvo/imp/ph/hi-az.hoon index c2cd3f419..7702309df 100644 --- a/pkg/arvo/imp/ph/hi-az.hoon +++ b/pkg/arvo/imp/ph/hi-az.hoon @@ -1,14 +1,14 @@ /- spider -/+ ph-io +/+ *ph-io =, thread=thread:spider ^- imp:spider |= =bowl:mall =/ m (thread ,~) -;< ~ bind:m start-azimuth:ph-io -;< ~ bind:m (spawn:ph-io ~bud) -;< ~ bind:m (spawn:ph-io ~dev) -;< ~ bind:m (real-ship:ph-io ~bud) -;< ~ bind:m (real-ship:ph-io ~dev) -;< ~ bind:m (send-hi:ph-io ~bud ~dev) -;< ~ bind:m end-azimuth:ph-io +;< ~ bind:m start-azimuth +;< ~ bind:m (spawn ~bud) +;< ~ bind:m (spawn ~dev) +;< ~ bind:m (real-ship ~bud) +;< ~ bind:m (real-ship ~dev) +;< ~ bind:m (send-hi ~bud ~dev) +;< ~ bind:m end-azimuth (pure:m ~) diff --git a/pkg/arvo/imp/ph/hi.hoon b/pkg/arvo/imp/ph/hi.hoon index 63088f4db..9ef495270 100644 --- a/pkg/arvo/imp/ph/hi.hoon +++ b/pkg/arvo/imp/ph/hi.hoon @@ -1,13 +1,13 @@ /- spider -/+ ph-io +/+ *ph-io =, thread=thread:spider ^- imp:spider |= =bowl:mall =/ m (thread ,~) -;< ~ bind:m start-simple:ph-io -;< ~ bind:m (raw-ship:ph-io ~bud ~) -;< ~ bind:m (raw-ship:ph-io ~dev ~) -;< ~ bind:m (raw-ship:ph-io ~dev ~) -;< ~ bind:m (send-hi:ph-io ~bud ~dev) -;< ~ bind:m end-simple:ph-io +;< ~ bind:m start-simple +;< ~ bind:m (raw-ship ~bud ~) +;< ~ bind:m (raw-ship ~dev ~) +;< ~ bind:m (raw-ship ~dev ~) +;< ~ bind:m (send-hi ~bud ~dev) +;< ~ bind:m end-simple (pure:m ~) diff --git a/pkg/arvo/imp/ph/moon-az.hoon b/pkg/arvo/imp/ph/moon-az.hoon index a8dc9a4b6..4e41d06bf 100644 --- a/pkg/arvo/imp/ph/moon-az.hoon +++ b/pkg/arvo/imp/ph/moon-az.hoon @@ -1,22 +1,22 @@ /- spider -/+ ph-io +/+ *ph-io =, thread=thread:spider ^- imp:spider |= =bowl:mall =/ m (thread ,~) -;< ~ bind:m start-azimuth:ph-io -;< ~ bind:m (spawn:ph-io ~bud) -;< ~ bind:m (spawn:ph-io ~marbud) -;< ~ bind:m (spawn:ph-io ~linnup-torsyx) -;< ~ bind:m (spawn:ph-io ~dev) -;< ~ bind:m (real-ship:ph-io ~bud) -;< ~ bind:m (real-ship:ph-io ~marbud) -;< ~ bind:m (real-ship:ph-io ~linnup-torsyx) -;< ~ bind:m (real-ship:ph-io ~linnup-torsyx-linnup-torsyx) -;< ~ bind:m (send-hi:ph-io ~bud ~linnup-torsyx-linnup-torsyx) -;< ~ bind:m (send-hi:ph-io ~linnup-torsyx-linnup-torsyx ~marbud) -;< ~ bind:m (real-ship:ph-io ~dev) -;< ~ bind:m (send-hi:ph-io ~linnup-torsyx-linnup-torsyx ~dev) -;< ~ bind:m (send-hi:ph-io ~dev ~linnup-torsyx-linnup-torsyx) -;< ~ bind:m end-azimuth:ph-io +;< ~ bind:m start-azimuth +;< ~ bind:m (spawn ~bud) +;< ~ bind:m (spawn ~marbud) +;< ~ bind:m (spawn ~linnup-torsyx) +;< ~ bind:m (spawn ~dev) +;< ~ bind:m (real-ship: ~bud) +;< ~ bind:m (real-ship ~marbud) +;< ~ bind:m (real-ship ~linnup-torsyx) +;< ~ bind:m (real-ship ~linnup-torsyx-linnup-torsyx) +;< ~ bind:m (send-hi ~bud ~linnup-torsyx-linnup-torsyx) +;< ~ bind:m (send-hi ~linnup-torsyx-linnup-torsyx ~marbud) +;< ~ bind:m (real-ship ~dev) +;< ~ bind:m (send-hi ~linnup-torsyx-linnup-torsyx ~dev) +;< ~ bind:m (send-hi ~dev ~linnup-torsyx-linnup-torsyx) +;< ~ bind:m end-azimuth (pure:m ~) diff --git a/pkg/arvo/imp/ph/second-cousin-hi.hoon b/pkg/arvo/imp/ph/second-cousin-hi.hoon index c3edecda4..2becfcb2d 100644 --- a/pkg/arvo/imp/ph/second-cousin-hi.hoon +++ b/pkg/arvo/imp/ph/second-cousin-hi.hoon @@ -1,16 +1,16 @@ /- spider -/+ ph-io +/+ *ph-io =, thread=thread:spider ^- imp:spider |= =bowl:mall =/ m (thread ,~) -;< ~ bind:m start-simple:ph-io -;< ~ bind:m (raw-ship:ph-io ~bud ~) -;< ~ bind:m (raw-ship:ph-io ~marbud ~) -;< ~ bind:m (raw-ship:ph-io ~linnup-torsyx ~) -;< ~ bind:m (raw-ship:ph-io ~dev ~) -;< ~ bind:m (raw-ship:ph-io ~mardev ~) -;< ~ bind:m (raw-ship:ph-io ~mitnep-todsut ~) -;< ~ bind:m (send-hi:ph-io ~linnup-torsyx ~mitnep-todsut) -;< ~ bind:m end-simple:ph-io +;< ~ bind:m start-simple +;< ~ bind:m (raw-ship ~bud ~) +;< ~ bind:m (raw-ship ~marbud ~) +;< ~ bind:m (raw-ship ~linnup-torsyx ~) +;< ~ bind:m (raw-ship ~dev ~) +;< ~ bind:m (raw-ship ~mardev ~) +;< ~ bind:m (raw-ship ~mitnep-todsut ~) +;< ~ bind:m (send-hi ~linnup-torsyx ~mitnep-todsut) +;< ~ bind:m end-simple (pure:m ~) From ed0483bd63a83ea628b113827865b5dc81655511 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 02:21:05 -0400 Subject: [PATCH 165/451] alef: preparing for misordered ack handling --- pkg/arvo/sys/vane/alef.hoon | 88 ++++++++++++++++++++++++++++++------- 1 file changed, 71 insertions(+), 17 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 815ad73a5..3d90004ba 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -577,7 +577,6 @@ :: num-live: how many packets sent, awaiting ack :: ssthresh: slow-start threshold :: cwnd: congestion window; max unacked packets -:: skips: how many misordered acks we've received :: +$ pump-metrics $: rto=_~s1 @@ -586,7 +585,7 @@ ssthresh=_1.000.000 cwnd=_1 num-live=@ud - num-skips=@ud + counter=@ud == +$ live-packet-key [=message-num =fragment-num] +$ live-packet-val @@ -597,6 +596,7 @@ +$ packet-state $: last-sent=@da retries=@ud + skips=@ud == :: $message-still-state: state of |message-still to assemble messages :: @@ -2169,7 +2169,7 @@ ^- [key=live-packet-key val=live-packet-val] :: :- [message-num fragment-num] - :- [sent-date=now.channel retries=0] + :- [sent-date=now.channel retries=0 skips=0] [num-fragments fragment] :: update .live and .metrics :: @@ -2191,18 +2191,46 @@ :: metrics. Otherwise, no-op. :: ++ on-hear - |= key=live-packet-key + |= [=message-num =fragment-num] ^+ packet-pump :: - :: TODO handle misordered ack - =^ packet=(unit live-packet-val) live.state - (del:packet-queue live.state key) + =- :: if no sent packet matches the ack, don't apply mutations or effects + :: + ?. found.- + packet-pump + :: + =. metrics.state metrics.- + =. live.state live.- + :: + packet-pump :: - ?~ packet - packet-pump + ^- $: [found=? metrics=pump-metrics] + live=(tree [live-packet-key live-packet-val]) + == :: - =. metrics.state (on-ack:gauge -.u.packet) - packet-pump + =/ acc=[found=? metrics=pump-metrics] [%.n metrics.state] + :: + %^ (traverse:packet-queue _acc) live.state acc + |= $: acc=_acc + key=live-packet-key + val=live-packet-val + == + ^- [new-val=(unit live-packet-val) stop=? _acc] + :: + =/ gauge (make-pump-gauge now.channel metrics.acc) + :: is this the acked packet? + :: + ?: =(key [message-num fragment-num]) + :: delete acked packet, update metrics, and stop traversal + :: + :+ new-val=~ + stop=%.y + [found=%.y metrics=(on-ack:gauge -.val)] + :: ack was out of order; mark skipped, tell gauge, and continue + :: + :+ new-val=`val(skips +(skips.val)) + stop=%.n + [found=%.n metrics=(on-skipped-packet:gauge -.val)] :: +on-done: apply ack to all packets from .message-num :: ++ on-done @@ -2226,13 +2254,19 @@ ^- [new-val=(unit live-packet-val) stop=? pump-metrics] :: =/ gauge (make-pump-gauge now.channel metrics) - :: if ack was out of order, mark expired and continue - :: TODO redo skipped packet logic + :: if we get an out-of-order ack for a message, no-op + :: + :: We need to receive message acks in order, so if we get an ack + :: for anything other than the first unacked message, pretend we + :: never heard it. If the other end is correct, the first + :: message will get acked, and we'll re-send the second message + :: once it times out. + :: + :: This arrangement could probably be optimized, but it isn't + :: very likely to happen, so it's more important we stay correct. :: ?: (lth message-num.key message-num) - :+ new-val=`val - stop=%.n - metrics=(on-skipped-packet:gauge -.val) + [new-val=`val stop=%.y metrics] :: if packet was from acked message, delete it and continue :: ?: =(message-num.key message-num) @@ -2302,6 +2336,7 @@ |= =packet-state ^- pump-metrics :: + =. counter +(counter) =. num-live (dec num-live) :: if below congestion threshold, add 1; else, add avg. 1 / cwnd :: @@ -2312,6 +2347,8 @@ :: if this was a re-send, don't adjust rtt or downstream state :: ?. =(0 retries.packet-state) + :: + ~? =(0 (mod counter 100)) show metrics :: rtt-datum: new rtt measurement based on this packet roundtrip :: @@ -2328,22 +2365,26 @@ =. rttvar (div (add rtt-error (mul rttvar 7)) 8) =. rto (clamp-rto (add rtt (mul 4 rttvar))) :: + ~? =(0 (mod counter 100)) show + :: metrics :: +on-skipped-packet: TODO :: ++ on-skipped-packet |= packet-state ^- pump-metrics + ~& 'SKIPPED'^show metrics :: +on-timeout: (re)enter slow-start mode on packet loss :: ++ on-timeout ^- pump-metrics :: - =: ssthresh (div cwnd 2) + =: ssthresh (max 1 (div cwnd 2)) cwnd 1 rto (clamp-rto (mul rto 2)) == + ~& 'TIMEOUT'^show metrics :: +clamp-rto: apply min and max to an .rto value :: @@ -2362,6 +2403,19 @@ |= [a=@ b=@] ^- @ ?:((lte a b) 0 (sub a b)) + :: + :: + ++ show + =/ ms (div ~s1 1.000) + :: + :* rto=(div rto ms) + rtt=(div rtt ms) + rttvar=(div rttvar ms) + ssthresh=ssthresh + cwnd=cwnd + num-live=num-live + counter=counter + == -- :: +make-message-still: construct |message-still message receiver core :: From 86f2163410fdc8afdb51c8707dc8ae94a3f40116 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 02:21:31 -0400 Subject: [PATCH 166/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index c9806cc36..78274c78a 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e60129f7ddf2921181c7615068df4b2731ea0ab3c51ccc113fc4710905ec9312 -size 13302691 +oid sha256:392583b445bdcec51946b3e62513b02b154437ed84cbdfde9dcd1cfcc218bfc9 +size 13310149 From c480d12995efc2afc265d56ad9900318bed5fd6a Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 02:38:56 -0400 Subject: [PATCH 167/451] adjust printing --- pkg/arvo/sys/vane/alef.hoon | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 3d90004ba..409506002 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2197,10 +2197,12 @@ =- :: if no sent packet matches the ack, don't apply mutations or effects :: ?. found.- + ~& 'MISS'^show:gauge packet-pump :: =. metrics.state metrics.- =. live.state live.- + ~? =(0 (mod counter.metrics.state 20)) [fragment-num show:gauge] :: packet-pump :: @@ -2347,8 +2349,6 @@ :: if this was a re-send, don't adjust rtt or downstream state :: ?. =(0 retries.packet-state) - :: - ~? =(0 (mod counter 100)) show metrics :: rtt-datum: new rtt measurement based on this packet roundtrip :: @@ -2365,8 +2365,6 @@ =. rttvar (div (add rtt-error (mul rttvar 7)) 8) =. rto (clamp-rto (add rtt (mul 4 rttvar))) :: - ~? =(0 (mod counter 100)) show - :: metrics :: +on-skipped-packet: TODO :: From 850f7b392bee2c31a76db1dee921be0ba439bb41 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 02:47:45 -0400 Subject: [PATCH 168/451] tweak printing --- pkg/arvo/sys/vane/alef.hoon | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 409506002..b8f8c6d2a 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2242,6 +2242,7 @@ =- =. metrics.state metrics.- =. live.state live.- :: + ~& 'DONE'^[fragment-num show:gauge] packet-pump :: ^- $: metrics=pump-metrics From b5644ba23f7bb9a41195f44fe6fbcdd718d3d118 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 02:55:10 -0400 Subject: [PATCH 169/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 78274c78a..47b2e8112 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:392583b445bdcec51946b3e62513b02b154437ed84cbdfde9dcd1cfcc218bfc9 -size 13310149 +oid sha256:e8ea169a13eac81fce101a21f95bae11ef404ff2cdb51dc068fb4453a11af328 +size 13381963 From f04e5b9f977c2fde733bf2ed1e693312bb33f960 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 03:13:11 -0400 Subject: [PATCH 170/451] alef: print more --- pkg/arvo/sys/vane/alef.hoon | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index b8f8c6d2a..004d02843 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -586,6 +586,7 @@ cwnd=_1 num-live=@ud counter=@ud + start=@da == +$ live-packet-key [=message-num =fragment-num] +$ live-packet-val @@ -2203,6 +2204,7 @@ =. metrics.state metrics.- =. live.state live.- ~? =(0 (mod counter.metrics.state 20)) [fragment-num show:gauge] + =? start.metrics.state =(0 fragment-num) now :: packet-pump :: @@ -2242,7 +2244,8 @@ =- =. metrics.state metrics.- =. live.state live.- :: - ~& 'DONE'^[fragment-num show:gauge] + =/ elapsed=@dr (sub now start.metrics.state) + ~& 'DONE'^[message-num seconds=(div elapsed ~s1) show:gauge] packet-pump :: ^- $: metrics=pump-metrics From dbafe99332baccdcb4e53026b679756e21710d25 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 03:13:15 -0400 Subject: [PATCH 171/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 47b2e8112..c9a5da6c4 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e8ea169a13eac81fce101a21f95bae11ef404ff2cdb51dc068fb4453a11af328 -size 13381963 +oid sha256:002f037da7d8b8400b9bb6169fc3717c5f20ca445c4259265f131cfc947c8647 +size 13381994 From 59ac079488c43a32028d487ac461e2c7abd40eee Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 03:20:19 -0400 Subject: [PATCH 172/451] alef: tweak printing --- pkg/arvo/sys/vane/alef.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 004d02843..60e7bb975 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2204,7 +2204,7 @@ =. metrics.state metrics.- =. live.state live.- ~? =(0 (mod counter.metrics.state 20)) [fragment-num show:gauge] - =? start.metrics.state =(0 fragment-num) now + =? start.metrics.state =(0 fragment-num) now.channel :: packet-pump :: @@ -2244,7 +2244,7 @@ =- =. metrics.state metrics.- =. live.state live.- :: - =/ elapsed=@dr (sub now start.metrics.state) + =/ elapsed=@dr (sub now.channel start.metrics.state) ~& 'DONE'^[message-num seconds=(div elapsed ~s1) show:gauge] packet-pump :: From 86ef9c78616c1326bbec6e70aefc12e59ce81b82 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 03:23:50 -0400 Subject: [PATCH 173/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index c9a5da6c4..e0d196745 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:002f037da7d8b8400b9bb6169fc3717c5f20ca445c4259265f131cfc947c8647 -size 13381994 +oid sha256:c8850fd0c3b1519958a9e439c2fed8e71f470e6a3b5c5efc55a039ea1ab09e54 +size 13383045 From 04bd18054266beccf3b2e6e1842e66f02dea6e00 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 03:37:56 -0400 Subject: [PATCH 174/451] alef: cap cwnd --- pkg/arvo/sys/vane/alef.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 60e7bb975..aba4d7a13 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2334,7 +2334,6 @@ ^- pump-metrics :: =. num-live (add num-live num-sent) - ?> (lte num-live cwnd) metrics :: +on-ack: adjust metrics based on a packet getting acknowledged :: @@ -2347,6 +2346,7 @@ :: if below congestion threshold, add 1; else, add avg. 1 / cwnd :: =. cwnd + %+ min 200 ?: in-slow-start +(cwnd) (add cwnd !=(0 (mod (mug now) cwnd))) From 5e93b33835bb512d345fb762af118bbd09c5be1a Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 03:38:05 -0400 Subject: [PATCH 175/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index e0d196745..8cf83df75 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c8850fd0c3b1519958a9e439c2fed8e71f470e6a3b5c5efc55a039ea1ab09e54 -size 13383045 +oid sha256:193d5f5e99787f3041ea8b30dfaf9ef3a55afaa523c0d8900c8937a9c5eff45a +size 13382948 From 895927e5835b8d21b330f6d1ca5d714702f5d489 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 03:46:34 -0400 Subject: [PATCH 176/451] print more --- pkg/arvo/sys/vane/alef.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index aba4d7a13..95aa01b12 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2116,11 +2116,12 @@ =. next-wake.state ~ :: tell congestion control a packet timed out :: - =. metrics.state on-timeout:gauge + =. metrics.state on-timeout:gauge :: re-send first packet and update its state in-place :: =- =. live.state live.- =. packet-pump (give %send static-fragment.-) + ~& 'DEAD'^fragment-num.static-fragment.-^show:gauge packet-pump :: =| acc=static-fragment @@ -2386,7 +2387,6 @@ cwnd 1 rto (clamp-rto (mul rto 2)) == - ~& 'TIMEOUT'^show metrics :: +clamp-rto: apply min and max to an .rto value :: From a3dbe2181e496eae9900e917147ef83c1614e7b6 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 03:54:07 -0400 Subject: [PATCH 177/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 8cf83df75..19154e2ec 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:193d5f5e99787f3041ea8b30dfaf9ef3a55afaa523c0d8900c8937a9c5eff45a -size 13382948 +oid sha256:ba6825d46dd669342d77cc8618f5f2f3f4d7fb8de9b5a9ada635f469a7c7088d +size 13383141 From 32360c2e5a58fbc2e2159b60444aca0790db668a Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 4 Oct 2019 23:21:29 -0400 Subject: [PATCH 178/451] try misordered acks --- pkg/arvo/sys/vane/alef.hoon | 123 +++++++++++++++++++++--------------- 1 file changed, 71 insertions(+), 52 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 95aa01b12..52c3b8270 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -586,9 +586,15 @@ cwnd=_1 num-live=@ud counter=@ud - start=@da == -+$ live-packet-key [=message-num =fragment-num] ++$ live-packet + $: key=live-packet-key + val=live-packet-val + == ++$ live-packet-key + $: =message-num + =fragment-num + == +$ live-packet-val $: packet-state num-fragments=fragment-num @@ -1345,23 +1351,15 @@ :: apply outgoing messages :: =. event-core - |- ^+ event-core - ?~ snd-messages.todos event-core - :: - =. event-core - %- on-plea(duct duct.i.snd-messages.todos) - [ship plea.i.snd-messages.todos] - :: - $(snd-messages.todos t.snd-messages.todos) + %+ roll snd-messages.todos + |= [[=^duct =plea] core=_event-core] + (on-plea:core(duct duct) ship plea) :: apply outgoing packet blobs :: =. event-core - =/ blobs ~(tap in snd-packets.todos) - |- ^+ event-core - ?~ blobs event-core - :: - =. event-core (send-blob ship i.blobs) - $(blobs t.blobs) + %+ roll ~(tap in snd-packets.todos) + |= [=blob core=_event-core] + (send-blob:core ship blob) :: event-core -- @@ -2138,10 +2136,7 @@ =. last-sent.val now.channel =. retries.val +(retries.val) :: - =/ =static-fragment - [message-num num-fragments fragment-num fragment]:[key val] - :: - [`val stop=%.y static-fragment] + [`val stop=%.y (to-static-fragment key val)] :: +feed: try to send a list of packets, returning unsent and effects :: ++ feed @@ -2182,11 +2177,9 @@ => .(sent `(list static-fragment)`sent) :: emit a $packet-pump-gift for each packet to send :: - |- ^+ packet-pump - ?~ sent packet-pump - :: - =. packet-pump (give %send i.sent) - $(sent t.sent) + %+ roll sent + |= [packet=static-fragment core=_packet-pump] + (give:core %send packet) :: +on-hear: handle ack on a live packet :: :: If the packet was in our queue, delete it and update our @@ -2204,16 +2197,23 @@ :: =. metrics.state metrics.- =. live.state live.- - ~? =(0 (mod counter.metrics.state 20)) [fragment-num show:gauge] - =? start.metrics.state =(0 fragment-num) now.channel + ~? ?| =(0 fragment-num) + =(0 (mod counter.metrics.state 20)) + == + [fragment-num show:gauge] + :: .resends is backward, so fold backward and emit :: - packet-pump + %+ reel resends.- + |= [packet=static-fragment core=_packet-pump] + (give:core %send packet) :: - ^- $: [found=? metrics=pump-metrics] - live=(tree [live-packet-key live-packet-val]) - == + =/ acc + :* found=`?`%.n + resends=*(list static-fragment) + metrics=metrics.state + == :: - =/ acc=[found=? metrics=pump-metrics] [%.n metrics.state] + ^+ [acc live=live.state] :: %^ (traverse:packet-queue _acc) live.state acc |= $: acc=_acc @@ -2228,14 +2228,20 @@ ?: =(key [message-num fragment-num]) :: delete acked packet, update metrics, and stop traversal :: - :+ new-val=~ - stop=%.y - [found=%.y metrics=(on-ack:gauge -.val)] - :: ack was out of order; mark skipped, tell gauge, and continue + =. found.acc %.y + =. metrics.acc (on-ack:gauge -.val) + [new-val=~ stop=%.y acc] + :: ack was on later packet; mark skipped, tell gauge, and continue :: - :+ new-val=`val(skips +(skips.val)) - stop=%.n - [found=%.n metrics=(on-skipped-packet:gauge -.val)] + =. skips.val +(skips.val) + =^ resend metrics.acc (on-skipped-packet:gauge -.val) + ?. resend + [new-val=`val stop=%.n acc] + :: + =. last-sent.val now.channel + =. retries.val +(retries.val) + =. resends.acc [(to-static-fragment key val) resends.acc] + [new-val=`val stop=%.n acc] :: +on-done: apply ack to all packets from .message-num :: ++ on-done @@ -2245,13 +2251,10 @@ =- =. metrics.state metrics.- =. live.state live.- :: - =/ elapsed=@dr (sub now.channel start.metrics.state) - ~& 'DONE'^[message-num seconds=(div elapsed ~s1) show:gauge] + ~& 'DONE'^[message-num show:gauge] packet-pump :: - ^- $: metrics=pump-metrics - live=(tree [live-packet-key live-packet-val]) - == + ^+ [metrics=metrics.state live=live.state] :: %^ (traverse:packet-queue pump-metrics) live.state acc=metrics.state |= $: metrics=pump-metrics @@ -2308,6 +2311,12 @@ :: packet-pump -- +:: +to-static-fragment: convenience function for |packet-pump +:: +++ to-static-fragment + |= [live-packet-key live-packet-val] + ^- static-fragment + [message-num num-fragments fragment-num fragment] :: +make-pump-gauge: construct |pump-gauge congestion control core :: ++ make-pump-gauge @@ -2347,7 +2356,6 @@ :: if below congestion threshold, add 1; else, add avg. 1 / cwnd :: =. cwnd - %+ min 200 ?: in-slow-start +(cwnd) (add cwnd !=(0 (mod (mug now) cwnd))) @@ -2371,12 +2379,17 @@ =. rto (clamp-rto (add rtt (mul 4 rttvar))) :: metrics - :: +on-skipped-packet: TODO + :: +on-skipped-packet: handle misordered ack :: ++ on-skipped-packet |= packet-state - ^- pump-metrics - ~& 'SKIPPED'^show + ^- [resend=? pump-metrics] + :: + =/ resend=? &(=(0 retries) |(in-recovery (gte skips 3))) + :- resend + :: + =? cwnd !in-recovery (max 2 (div cwnd 2)) + ~& ['SKIPPED' resend=resend in-recovery=in-recovery show] metrics :: +on-timeout: (re)enter slow-start mode on packet loss :: @@ -2394,18 +2407,26 @@ |= rto=@dr ^+ rto (min ~m2 (max ^~((div ~s1 5)) rto)) - :: +in-slow-start: produces %.y iff we're in "slow-start" mode + :: +in-slow-start: %.y iff we're in "slow-start" mode :: ++ in-slow-start ^- ? (lth cwnd ssthresh) + :: +in-recovery: %.y iff we're recovering from a skipped packet + :: + :: We finish recovering when .num-live finally dips back down to + :: .cwnd. + :: + ++ in-recovery + ^- ? + (gth num-live cwnd) :: +sub-safe: subtract with underflow protection :: ++ sub-safe |= [a=@ b=@] ^- @ ?:((lte a b) 0 (sub a b)) - :: + :: +show: produce a printable version of .metrics :: ++ show =/ ms (div ~s1 1.000) @@ -2694,8 +2715,6 @@ |= [=public-key =private-key] ^- symmetric-key :: - ~| [public-key=public-key private-key=private-key] - :: ?> =('b' (end 3 1 public-key)) =. public-key (rsh 8 1 (rsh 3 1 public-key)) :: From ce75ae779adc0e0d09a7aa779d4bb5a2a9a86a16 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 4 Oct 2019 23:21:51 -0400 Subject: [PATCH 179/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 19154e2ec..2b5699a93 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ba6825d46dd669342d77cc8618f5f2f3f4d7fb8de9b5a9ada635f469a7c7088d -size 13383141 +oid sha256:59abbbef272e029ce6fb23aa3e7c839a2539570f6dfed45fad38ad7ae19a1323 +size 13385791 From 6bae84fbe4811e80b0e486776bf6a60da3b10285 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 4 Oct 2019 23:38:32 -0400 Subject: [PATCH 180/451] fix enqueued message order --- pkg/arvo/sys/vane/alef.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 52c3b8270..f6ca01e49 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1348,10 +1348,10 @@ :: =? event-core =(%pawn (clan:title our)) (send-blob ship (attestation-packet ship life.point)) - :: apply outgoing messages + :: apply outgoing messages, reversing for FIFO order :: =. event-core - %+ roll snd-messages.todos + %+ reel snd-messages.todos |= [[=^duct =plea] core=_event-core] (on-plea:core(duct duct) ship plea) :: apply outgoing packet blobs From eed3d8ce369c491ddd5b80e8848b44dee322d51c Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 4 Oct 2019 23:39:51 -0400 Subject: [PATCH 181/451] try slowing down once cwnd > 200 --- pkg/arvo/sys/vane/alef.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index f6ca01e49..9c197f691 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -582,7 +582,7 @@ $: rto=_~s1 rtt=_~s1 rttvar=_~s1 - ssthresh=_1.000.000 + ssthresh=_200 cwnd=_1 num-live=@ud counter=@ud From 0abea7eb25636b1a3e44625ebd093d053f78e906 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 4 Oct 2019 23:46:20 -0400 Subject: [PATCH 182/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 2b5699a93..1631202eb 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:59abbbef272e029ce6fb23aa3e7c839a2539570f6dfed45fad38ad7ae19a1323 -size 13385791 +oid sha256:1e0003a43376106e2c79dcfa51f890122f01cdb44d15c1689ee8fa9ac0766d8b +size 13385807 From 8749fc7f136cc61f09f6d60eba691a41aa630cf8 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 4 Oct 2019 23:54:09 -0400 Subject: [PATCH 183/451] try slowing down once cwnd > 1.000; 200 was too slow --- pkg/arvo/sys/vane/alef.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 9c197f691..4f834f5ab 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -582,7 +582,7 @@ $: rto=_~s1 rtt=_~s1 rttvar=_~s1 - ssthresh=_200 + ssthresh=_1.000 cwnd=_1 num-live=@ud counter=@ud From d1a7a339b757fce9c1fb7cf2ef89aac33b8a5926 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 4 Oct 2019 23:55:45 -0400 Subject: [PATCH 184/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 1631202eb..8547b1fa0 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1e0003a43376106e2c79dcfa51f890122f01cdb44d15c1689ee8fa9ac0766d8b -size 13385807 +oid sha256:b87cabc7a36d1b713446595ae2d558b1aab3b2f4697ef05f5a899523240f2175 +size 13385779 From cc5e2c9564d9a59068804bd3b26b43605d8e283f Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sat, 5 Oct 2019 00:41:18 -0400 Subject: [PATCH 185/451] temporary fast start for testing --- pkg/arvo/sys/vane/alef.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 4f834f5ab..3d4881aaa 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -582,8 +582,8 @@ $: rto=_~s1 rtt=_~s1 rttvar=_~s1 - ssthresh=_1.000 - cwnd=_1 + ssthresh=_1.000.000 + cwnd=_1.000.000 num-live=@ud counter=@ud == From e6cefceb7ef06da9db79cab452a82dcc69d6ec41 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sat, 5 Oct 2019 00:43:34 -0400 Subject: [PATCH 186/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 8547b1fa0..6f27dae8e 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b87cabc7a36d1b713446595ae2d558b1aab3b2f4697ef05f5a899523240f2175 -size 13385779 +oid sha256:1c0997870a6d110b172328dd49325e7f79f620d9e2885d074c6dc99d8cd6a521 +size 13385805 From 5fcdb02db9e99fd864c85837e8b41b3cbf55bc53 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sat, 5 Oct 2019 01:00:20 -0400 Subject: [PATCH 187/451] ames: reset congestion control params to 'reasonable' values --- pkg/arvo/sys/vane/alef.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 3d4881aaa..95650c41d 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -582,8 +582,8 @@ $: rto=_~s1 rtt=_~s1 rttvar=_~s1 - ssthresh=_1.000.000 - cwnd=_1.000.000 + ssthresh=_10.000 + cwnd=_1 num-live=@ud counter=@ud == From 81cab03610a293adcfc027ffb315b61c6b9acd38 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sat, 5 Oct 2019 01:16:31 -0400 Subject: [PATCH 188/451] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 6f27dae8e..554950afd 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1c0997870a6d110b172328dd49325e7f79f620d9e2885d074c6dc99d8cd6a521 -size 13385805 +oid sha256:ca29c74e14f13b3e3e4c7853666cad4f5aea73d4839673b7add4083e9a6ad707 +size 13385789 From 754fd61e1bd8fdf9f6177d9c27853bd7b00b5d7e Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 8 Oct 2019 18:35:22 -0700 Subject: [PATCH 189/451] custody: initial commit --- pkg/arvo/gen/sql.hoon | 16 ++++++ pkg/arvo/lib/csv.hoon | 78 +++++++++++++++++++++++++++++ pkg/arvo/lib/custody.hoon | 100 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 194 insertions(+) create mode 100644 pkg/arvo/gen/sql.hoon create mode 100644 pkg/arvo/lib/csv.hoon create mode 100644 pkg/arvo/lib/custody.hoon diff --git a/pkg/arvo/gen/sql.hoon b/pkg/arvo/gen/sql.hoon new file mode 100644 index 000000000..d4be42561 --- /dev/null +++ b/pkg/arvo/gen/sql.hoon @@ -0,0 +1,16 @@ +/+ *custody, *csv +|= [=key=path =loc=path] +%. ~ +%- print-rows +%+ select + !, *hoon + :* (need ship.left) + physical-form.left + == +%^ join + (load:keys key-path) + (load:locations loc-path) +!, *hoon +?& !=(~ ship.left) + =(location.left location.right) +== diff --git a/pkg/arvo/lib/csv.hoon b/pkg/arvo/lib/csv.hoon new file mode 100644 index 000000000..560dd5149 --- /dev/null +++ b/pkg/arvo/lib/csv.hoon @@ -0,0 +1,78 @@ +|% +++ text + %+ cook + |= =tape + (crip tape) + ;~ pose + (cook tape soil:vast) + non-quote-text + == +:: +++ non-quote-text + (star ;~(less com qit)) +:: +++ parse + |* cols=(list rule) + %+ ifix + :- ;~(sfix ;~(less (just `@`10) (star prn)) (just `@`10)) + (just `@`10) + (more (just `@`10) (parse-line cols)) +:: +++ parse-line + |* cols=(list rule) + ?~ cols + (easy ~) + ?~ t.cols + i.cols + ;~ plug + i.cols + ;~(pfix com $(cols t.cols)) + == +:: +:: inner join +:: +++ join + =/ name-side (ream '[left=- right=+]') + |= [left=(list vase) rite=(list vase) =hoon] + ^- (list vase) + |- ^- (list vase) + =* left-loop $ + ?~ left + ~ + =/ rote rite + |- ^- (list vase) + =* rite-loop $ + ?~ rite + left-loop(left t.left, rite rote) + =/ slopped-row (slap (slop i.left i.rite) name-side) + =/ val (slap (slop slopped-row !>(..zuse)) hoon) + ?. =(%& q.val) + rite-loop(rite t.rite) + :- slopped-row + rite-loop(rite t.rite) +:: +:: filter +:: +++ where + |= [rows=(list vase) =hoon] + ^- (list vase) + %+ skim rows + |= =vase + =/ val (slap vase hoon) + =(%& q.val) +:: +:: select +:: +++ select + |= [=hoon rows=(list vase)] + ^- (list vase) + %+ turn rows + |= =vase + (slap (slop vase !>(..zuse)) hoon) +:: +:: pretty-print rows +:: +++ print-rows + |= rows=(list vase) + (slog (turn rows sell)) +-- diff --git a/pkg/arvo/lib/custody.hoon b/pkg/arvo/lib/custody.hoon new file mode 100644 index 000000000..adbea72b8 --- /dev/null +++ b/pkg/arvo/lib/custody.hoon @@ -0,0 +1,100 @@ +/+ csv +|% +++ fed ;~(pfix sig fed:ag) +++ parse-enum + |* form=mold + %- sear :_ text:csv + |= =cord + ((soft form) cord) +:: +++ keys + =< form + |% + +$ form + $: =location:locations + ship=(unit ship) + =role + shard=(unit shard) + copy=(unit copy) + =physical-form + note=cord + formal-ship=(unit ship) + == + :: + +$ role + $? %empty + %other + %master + %own + %spawn + %manage + %vote + %transfer + == + :: + +$ shard @udshard + +$ copy ?(%a %b %c) + +$ physical-form ?(%usb %dvd %paper) + ++ parsers + :~ text:csv + (punt fed) + (parse-enum role) + (punt dim:ag) + (punt (parse-enum copy)) + (parse-enum physical-form) + text:csv + (punt fed) + == + :: + ++ parse + %+ cook + |* arg=* + ^- (list form) + arg + (parse:csv parsers) + :: + ++ load-forms + |= =path + ^- (list form) + (rash (of-wain:format .^(wain %cx path)) parse) + :: + ++ load + |= =path + ^- (list vase) + (turn (load-forms path) |=(=form !>(form))) + -- +:: +++ locations + =< form + |% + +$ form + $: =location + description=@t + =physical-location + == + +$ location @tlocation + +$ physical-location @tphysicallocation + ++ parsers + :~ text:csv + text:csv + text:csv + == + :: + ++ parse + %+ cook + |* arg=* + ^- (list form) + arg + (parse:csv parsers) + :: + ++ load-forms + |= =path + ^- (list form) + (rash (of-wain:format .^(wain %cx path)) parse) + :: + ++ load + |= =path + ^- (list vase) + (turn (load-forms path) |=(=form !>(form))) + -- +-- From adba48241ac5b6c8f7fb5cbf8bfd7cdbcff0fa50 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 10 Oct 2019 15:30:24 -0700 Subject: [PATCH 190/451] spider: convert azimuth-tracker to imp --- pkg/arvo/age/spider.hoon | 14 +- pkg/arvo/imp/azimuth-tracker.hoon | 433 ++++++++++++++++++++++++++++++ pkg/arvo/imp/azt.hoon | 17 ++ pkg/arvo/imp/example-fetch.hoon | 2 +- pkg/arvo/lib/thread.hoon | 1 + pkg/arvo/lib/threadio.hoon | 65 ++++- 6 files changed, 520 insertions(+), 12 deletions(-) create mode 100644 pkg/arvo/imp/azimuth-tracker.hoon create mode 100644 pkg/arvo/imp/azt.hoon diff --git a/pkg/arvo/age/spider.hoon b/pkg/arvo/age/spider.hoon index 760b15b26..289fd6a40 100644 --- a/pkg/arvo/age/spider.hoon +++ b/pkg/arvo/age/spider.hoon @@ -30,7 +30,15 @@ == [cards this] :: - ++ handle-subscribe handle-subscribe:def + ++ handle-subscribe + |= =path + ^- (quip card _this) + =^ cards state + ?+ path (handle-subscribe:def path) + [%imp @ *] (handle-subscribe:sc t.path) + == + [cards this] + :: ++ handle-unsubscribe handle-unsubscribe:def ++ handle-peek |= =path @@ -67,6 +75,10 @@ |= imput (take-input imp-name ~ %poke cage) :: +++ handle-subscribe + |= [=imp-name =path] + (take-input imp-name ~ %subscribe path) +:: ++ handle-sign |= [=imp-name =wire =sign-arvo] (take-input imp-name ~ %sign wire sign-arvo) diff --git a/pkg/arvo/imp/azimuth-tracker.hoon b/pkg/arvo/imp/azimuth-tracker.hoon new file mode 100644 index 000000000..d8f53a6d2 --- /dev/null +++ b/pkg/arvo/imp/azimuth-tracker.hoon @@ -0,0 +1,433 @@ +/- spider +/+ threadio +=, thread=thread:spider +=, able:jael +|% ++$ pending-udiffs (map number:block udiffs:point) ++$ app-state + $: %2 + url=@ta + =number:block + =pending-udiffs + blocks=(list block) + whos=(set ship) + == ++$ in-poke-data + $% [%listen whos=(list ship) =source:jael] + [%watch url=@ta] + == ++$ in-peer-data ~ +-- +:: +:: Async helpers +:: +|% +++ topics + |= ships=(set ship) + ^- (list ?(@ux (list @ux))) + :: The first topic should be one of these event types + :: + :- => azimuth-events:azimuth + :~ broke-continuity + changed-keys + lost-sponsor + escape-accepted + == + :: If we're looking for a specific set of ships, specify them as + :: the second topic. Otherwise don't specify the second topic so + :: we will match all ships. + :: + ?: =(~ ships) + ~ + [(turn ~(tap in ships) ,@) ~] +:: +++ request-rpc + |= [url=@ta id=(unit @t) req=request:rpc:ethereum] + =/ m (thread ,json) + ^- form:m + %+ (retry json) `10 + =/ m (thread ,(unit json)) + ^- form:m + |^ + =/ =request:http + :* method=%'POST' + url=url + header-list=['Content-Type'^'application/json' ~] + ^= body + %- some %- as-octt:mimes:html + %- en-json:html + (request-to-json:rpc:ethereum id req) + == + ;< ~ bind:m (send-request:threadio request) + ;< rep=(unit client-response:iris) bind:m + take-maybe-response:threadio + ?~ rep + (pure:m ~) + (parse-response u.rep) + :: + ++ parse-response + |= =client-response:iris + =/ m (thread ,(unit json)) + ^- form:m + ?> ?=(%finished -.client-response) + ?~ full-file.client-response + (pure:m ~) + =/ body=@t q.data.u.full-file.client-response + =/ jon=(unit json) (de-json:html body) + ?~ jon + (pure:m ~) + =, dejs-soft:format + =/ array=(unit (list response:rpc:jstd)) + ((ar parse-one-response) u.jon) + ?~ array + =/ res=(unit response:rpc:jstd) (parse-one-response u.jon) + ?~ res + (thread-fail:threadio %request-rpc-parse-error >id< ~) + ?: ?=(%error -.u.res) + (thread-fail:threadio %request-rpc-error >id< >+.res< ~) + ?. ?=(%result -.u.res) + (thread-fail:threadio %request-rpc-fail >u.res< ~) + (pure:m `res.u.res) + (thread-fail:threadio %request-rpc-batch >%not-implemented< ~) + :: (pure:m `[%batch u.array]) + :: + ++ parse-one-response + |= =json + ^- (unit response:rpc:jstd) + =/ res=(unit [@t ^json]) + %. json + =, dejs-soft:format + (ot id+so result+some ~) + ?^ res `[%result u.res] + ~| parse-one-response=json + :+ ~ %error %- need + %. json + =, dejs-soft:format + (ot id+so error+(ot code+no message+so ~) ~) + -- +:: +++ retry + |* result=mold + |= [crash-after=(unit @ud) computation=_*form:(thread (unit result))] + =/ m (thread ,result) + =| try=@ud + |^ + |- ^- form:m + =* loop $ + ?: =(crash-after `try) + (thread-fail:threadio %retry-too-many ~) + ;< ~ bind:m (backoff try ~m1) + ;< res=(unit result) bind:m computation + ?^ res + (pure:m u.res) + loop(try +(try)) + :: + ++ backoff + |= [try=@ud limit=@dr] + =/ m (thread ,~) + ^- form:m + ;< eny=@uvJ bind:m get-entropy:threadio + ;< now=@da bind:m get-time:threadio + %- wait:threadio + %+ add now + %+ min limit + ?: =(0 try) ~s0 + %+ add + (mul ~s1 (bex (dec try))) + (mul ~s0..0001 (~(rad og eny) 1.000)) + -- +:: +++ get-latest-block + |= url=@ta + =/ m (thread ,block) + ^- form:m + ;< =json bind:m (request-rpc url `'block number' %eth-block-number ~) + (get-block-by-number url (parse-eth-block-number:rpc:ethereum json)) +:: +++ get-block-by-number + |= [url=@ta =number:block] + =/ m (thread ,block) + ^- form:m + |^ + ;< =json bind:m + (request-rpc url `'block by number' %eth-get-block-by-number number |) + =/ =block (parse-block json) + ?. =(number number.id.block) + (thread-fail:threadio %reorg-detected >number< >block< ~) + (pure:m block) + :: + ++ parse-block + |= =json + ^- block + =< [[&1 &2] |2] + ^- [@ @ @] + ~| json + %. json + =, dejs:format + %- ot + :~ hash+parse-hex-result:rpc:ethereum + number+parse-hex-result:rpc:ethereum + 'parentHash'^parse-hex-result:rpc:ethereum + == + -- +:: +++ get-logs-by-hash + |= [url=@ta whos=(set ship) =hash:block] + =/ m (thread udiffs:point) + ^- form:m + ;< =json bind:m + %+ request-rpc url + :* `'logs by hash' + %eth-get-logs-by-hash + hash + ~[azimuth:contracts:azimuth] + (topics whos) + == + =/ event-logs=(list event-log:rpc:ethereum) + (parse-event-logs:rpc:ethereum json) + =/ =udiffs:point (event-logs-to-udiffs event-logs) + (pure:m udiffs) +:: +++ get-logs-by-range + |= [url=@ta whos=(set ship) =from=number:block =to=number:block] + =/ m (thread udiffs:point) + ^- form:m + ;< =json bind:m + %+ request-rpc url + :* `'logs by range' + %eth-get-logs + `number+from-number + `number+to-number + ~[azimuth:contracts:azimuth] + (topics whos) + == + =/ event-logs=(list event-log:rpc:ethereum) + (parse-event-logs:rpc:ethereum json) + =/ =udiffs:point (event-logs-to-udiffs event-logs) + (pure:m udiffs) +:: +++ event-logs-to-udiffs + |= event-logs=(list =event-log:rpc:ethereum) + ^- =udiffs:point + %+ murn event-logs + |= =event-log:rpc:ethereum + ^- (unit [=ship =udiff:point]) + ?~ mined.event-log + ~ + ?: removed.u.mined.event-log + ~& [%removed-log event-log] + ~ + =/ =id:block [block-hash block-number]:u.mined.event-log + =, azimuth-events:azimuth + =, abi:ethereum + ?: =(broke-continuity i.topics.event-log) + =/ who=@ (decode-topics t.topics.event-log ~[%uint]) + =/ num=@ (decode-results data.event-log ~[%uint]) + `[who id %rift num] + ?: =(changed-keys i.topics.event-log) + =/ who=@ (decode-topics t.topics.event-log ~[%uint]) + =+ ^- [enc=octs aut=octs sut=@ud rev=@ud] + %+ decode-results data.event-log + ~[[%bytes-n 32] [%bytes-n 32] %uint %uint] + `[who id %keys rev sut (pass-from-eth:azimuth enc aut sut)] + ?: =(lost-sponsor i.topics.event-log) + =+ ^- [who=@ pos=@] + (decode-topics t.topics.event-log ~[%uint %uint]) + `[who id %spon ~] + ?: =(escape-accepted i.topics.event-log) + =+ ^- [who=@ wer=@] + (decode-topics t.topics.event-log ~[%uint %uint]) + `[who id %spon `wer] + ~& [%bad-topic event-log] + ~ +:: +++ jael-update + |= =udiffs:point + =/ m (thread ,~) + |- ^- form:m + =* loop $ + ?~ udiffs + (pure:m ~) + =/ =path /(scot %p ship.i.udiffs) + =/ cards + :~ [%give %subscription-update `/ %azimuth-udiff !>(i.udiffs)] + [%give %subscription-update `path %azimuth-udiff !>(i.udiffs)] + == + ;< ~ bind:m (send-raw-cards:threadio cards) + loop(udiffs t.udiffs) +:: +++ handle-azimuth-tracker-poke + =/ m (thread ,in-poke-data) + ^- form:m + ;< =vase bind:m + ((handle:threadio ,vase) (take-poke:threadio %azimuth-tracker-poke)) + =/ =in-poke-data !<(in-poke-data vase) + (pure:m in-poke-data) +-- +:: +:: Main loop +:: +|% +:: +:: Switch eth node +:: +++ handle-watch + |= state=app-state + =/ m (thread ,app-state) + ^- form:m + ;< =in-poke-data bind:m handle-azimuth-tracker-poke + ?. ?=(%watch -.in-poke-data) + ignore:threadio + (pure:m state(url url.in-poke-data)) +:: +:: Send %listen to jael +:: +++ handle-listen + |= state=app-state + =/ m (thread ,app-state) + ^- form:m + ;< =in-poke-data bind:m handle-azimuth-tracker-poke + ?. ?=(%listen -.in-poke-data) + ignore:threadio + =/ card + [%pass /lo %arvo %j %listen (silt whos.in-poke-data) source.in-poke-data] + ;< ~ bind:m (send-raw-card:threadio card) + (pure:m state) +:: +:: Start watching a node +:: +++ handle-peer + |= state=app-state + =/ m (thread ,app-state) + ;< =path bind:m ((handle:threadio ,path) take-subscribe:threadio) + =: number.state 0 + pending-udiffs.state *pending-udiffs + blocks.state *(list block) + whos.state + =/ who=(unit ship) ?~(path ~ `(slav %p i.path)) + ?~ who + ~ + (~(put in whos.state) u.who) + == + :: + ;< ~ bind:m send-cancel-request:threadio + (get-updates state) +:: +:: Get more blocks +:: +++ handle-wake + |= state=app-state + =/ m (thread ,app-state) + ^- form:m + ;< ~ bind:m ((handle:threadio ,~) (take-wake:threadio ~)) + (get-updates state) +:: +:: Get updates since last checked +:: +++ get-updates + |= state=app-state + =/ m (thread ,app-state) + ^- form:m + ;< =latest=block bind:m (get-latest-block url.state) + ;< state=app-state bind:m (zoom state number.id.latest-block) + |- ^- form:m + =* walk-loop $ + ?: (gth number.state number.id.latest-block) + ;< now=@da bind:m get-time:threadio + ;< ~ bind:m (send-wait:threadio (add now ~m5)) + (pure:m state) + ;< =block bind:m (get-block-by-number url.state number.state) + ;< [=new=pending-udiffs new-blocks=(lest ^block)] bind:m + %- take-block + [url.state whos.state pending-udiffs.state block blocks.state] + =: pending-udiffs.state new-pending-udiffs + blocks.state new-blocks + number.state +(number.id.i.new-blocks) + == + walk-loop +:: +:: Process a block, detecting and handling reorgs +:: +++ take-block + |= [url=@ta whos=(set ship) =a=pending-udiffs =block blocks=(list block)] + =/ m (thread ,[pending-udiffs (lest ^block)]) + ^- form:m + ?: &(?=(^ blocks) !=(parent-hash.block hash.id.i.blocks)) + (rewind url a-pending-udiffs block blocks) + ;< =b=pending-udiffs bind:m + (release-old-events a-pending-udiffs number.id.block) + ;< =new=udiffs:point bind:m (get-logs-by-hash url whos hash.id.block) + =. b-pending-udiffs (~(put by b-pending-udiffs) number.id.block new-udiffs) + (pure:m b-pending-udiffs block blocks) +:: +:: Release events if they're more than 30 blocks ago +:: +++ release-old-events + |= [=pending-udiffs =number:block] + =/ m (thread ,^pending-udiffs) + ^- form:m + =/ rel-number (sub number 30) + =/ =udiffs:point (~(get ja pending-udiffs) rel-number) + ;< ~ bind:m (jael-update udiffs) + (pure:m (~(del by pending-udiffs) rel-number)) +:: +:: Reorg detected, so rewind until we're back in sync +:: +++ rewind + |= [url=@ta =pending-udiffs =block blocks=(list block)] + =/ m (thread ,[^pending-udiffs (lest ^block)]) + |- ^- form:m + =* loop $ + ?~ blocks + (pure:m pending-udiffs block blocks) + ?: =(parent-hash.block hash.id.i.blocks) + (pure:m pending-udiffs block blocks) + ;< =next=^block bind:m (get-block-by-number url number.id.i.blocks) + ?: =(~ pending-udiffs) + ;< ~ bind:m (disavow block) + loop(block next-block, blocks t.blocks) + =. pending-udiffs (~(del by pending-udiffs) number.id.block) + loop(block next-block, blocks t.blocks) +:: +:: Tell subscribers there was a deep reorg +:: +++ disavow + |= =block + =/ m (thread ,~) + ^- form:m + (jael-update [*ship id.block %disavow ~]~) +:: +:: Zoom forward to near a given block number. +:: +:: Zooming doesn't go forward one block at a time. As a +:: consequence, it cannot detect and handle reorgs. Only use it +:: at a safe distance -- 500 blocks ago is probably sufficient. +:: +++ zoom + |= [state=app-state =latest=number:block] + =/ m (thread ,app-state) + ^- form:m + =/ zoom-margin=number:block 100 + ?: (lth latest-number (add number.state zoom-margin)) + (pure:m state) + =/ to-number=number:block (sub latest-number zoom-margin) + ;< =udiffs:point bind:m + (get-logs-by-range url.state whos.state number.state to-number) + ;< ~ bind:m (jael-update udiffs) + =. number.state +(to-number) + =. blocks.state ~ + (pure:m state) +-- +:: +:: Main +:: +^- imp:spider +|= =bowl:mall +=/ m (thread ,~) +^- form:m +%- (main-loop:threadio ,app-state) +:~ handle-listen + handle-watch + handle-wake + handle-peer +== diff --git a/pkg/arvo/imp/azt.hoon b/pkg/arvo/imp/azt.hoon new file mode 100644 index 000000000..92424b043 --- /dev/null +++ b/pkg/arvo/imp/azt.hoon @@ -0,0 +1,17 @@ +/- spider +/+ *threadio +=, thread=thread:libthread +^- imp:spider +|= =bowl:mall +=/ m (thread ,~) +^- form:m +~& > 'starting azt' +=/ url 'http://eth-mainnet.urbit.org:8545' +=/ poke-vase !>([%azimuth-tracker %azimuth-tracker-poke !>([%watch url])]) +;< ~ bind:m (poke-our %spider %spider-imput poke-vase) +;< ~ bind:m (subscribe-our /sub %spider /imp/azimuth-tracker) +|- ^- form:m +=* loop $ +;< [=mark =vase] bind:m (take-subscription-update /sub) +%- (slog (sell vase) ~) +loop diff --git a/pkg/arvo/imp/example-fetch.hoon b/pkg/arvo/imp/example-fetch.hoon index 21937873e..4a8c669fa 100644 --- a/pkg/arvo/imp/example-fetch.hoon +++ b/pkg/arvo/imp/example-fetch.hoon @@ -56,7 +56,7 @@ =/ m (thread ,^top-comments) ^- form:m %- (slog leaf+"drumroll please..." ~) - ;< ~ bind:m (sleep ~s3) + ;< ~ bind:m (sleep ~s3) %- (slog leaf+"Top comments:" (zing (turn top-comments comment-to-tang))) (pure:m top-comments) :: diff --git a/pkg/arvo/lib/thread.hoon b/pkg/arvo/lib/thread.hoon index 596e6ef33..fd32016d7 100644 --- a/pkg/arvo/lib/thread.hoon +++ b/pkg/arvo/lib/thread.hoon @@ -4,6 +4,7 @@ $% [%poke =cage] [%sign =wire =sign-arvo] [%agent =wire =gift:agent:mall] + [%subscribe =path] == +$ thread-input [=bowl:mall in=(unit input)] :: diff --git a/pkg/arvo/lib/threadio.hoon b/pkg/arvo/lib/threadio.hoon index 60fd5bf1b..2f5b9b97c 100644 --- a/pkg/arvo/lib/threadio.hoon +++ b/pkg/arvo/lib/threadio.hoon @@ -15,6 +15,10 @@ ^- form:m (send-raw-cards card ~) :: +++ ignore + |= tin=thread-input:thread + `[%fail %ignore ~] +:: ++ get-bowl =/ m (thread ,bowl:mall) ^- form:m @@ -33,6 +37,12 @@ |= tin=thread-input:thread `[%done our.bowl.tin] :: +++ get-entropy + =/ m (thread ,@uvJ) + ^- form:m + |= tin=thread-input:thread + `[%done eny.bowl.tin] +:: :: Convert skips to %ignore failures. :: :: This tells the main loop to try the next handler. @@ -110,15 +120,24 @@ (pure:m ~) == :: +++ take-subscribe + =/ m (thread ,path) + |= tin=thread-input:thread + ?+ in.tin `[%skip ~] + ~ `[%wait ~] + [~ %subscribe *] + `[%done path.u.in.tin] + == +:: ++ take-wake - |= until=@da + |= until=(unit @da) =/ m (thread ,~) ^- form:m |= tin=thread-input:thread ?+ in.tin `[%skip ~] ~ `[%wait ~] [~ %sign [%wait @ ~] %b %wake *] - ?. =(`until (slaw %da i.t.wire.u.in.tin)) + ?. |(?=(~ until) =(`u.until (slaw %da i.t.wire.u.in.tin))) `[%skip ~] ?~ error.sign-arvo.u.in.tin `[%done ~] @@ -203,10 +222,8 @@ |= until=@da =/ m (thread ,~) ^- form:m - =/ =card:agent:mall - [%pass /wait/(scot %da until) %arvo %b %wait until] - ;< ~ bind:m (send-raw-card card) - (take-wake until) + ;< ~ bind:m (send-wait until) + (take-wake `until) :: ++ sleep |= for=@dr @@ -215,6 +232,14 @@ ;< now=@da bind:m get-time (wait (add now for)) :: +++ send-wait + |= until=@da + =/ m (thread ,~) + ^- form:m + =/ =card:agent:mall + [%pass /wait/(scot %da until) %arvo %b %wait until] + (send-raw-card card) +:: ++ set-timeout |* computation-result=mold =/ m (thread ,computation-result) @@ -246,6 +271,11 @@ ^- form:m (send-raw-card %pass /request %arvo %i %request request *outbound-config:iris) :: +++ send-cancel-request + =/ m (thread ,~) + ^- form:m + (send-raw-card %pass /request %arvo %i %cancel-request ~) +:: ++ take-client-response =/ m (thread ,client-response:iris) ^- form:m @@ -256,6 +286,18 @@ `[%done client-response.sign-arvo.u.in.tin] == :: +++ take-maybe-response + =/ m (thread ,(unit client-response:iris)) + ^- form:m + |= tin=thread-input:thread + ?+ in.tin `[%skip ~] + ~ `[%wait ~] + [~ %sign [%request ~] %i %http-response %cancel *] + `[%done ~] + [~ %sign [%request ~] %i %http-response %finished *] + `[%done `client-response.sign-arvo.u.in.tin] + == +:: ++ extract-body |= =client-response:iris =/ m (thread ,cord) @@ -284,7 +326,7 @@ =/ m (thread ,~) =/ m-a (thread ,a) =| queue=(qeu (unit input:thread)) - =| active=(unit [=form:m-a forms=(list $-(a form:m-a))]) + =| active=(unit [in=(unit input:thread) =form:m-a forms=(list $-(a form:m-a))]) =| state=a |= forms=(lest $-(a form:m-a)) ^- form:m @@ -301,7 +343,7 @@ `[%cont top] =^ in=(unit input:thread) queue ~(get to queue) ^- output:m - =. active `[(i.forms state) t.forms] + =. active `[in (i.forms state) t.forms] ^- output:m (run bowl in) :: @@ -315,11 +357,14 @@ ?- -.next.res %wait `[%wait ~] %skip `[%cont ..$(queue (~(put to queue) in.tin))] - %cont `[%cont ..$(active `[self.next.res forms.u.active])] + %cont `[%cont ..$(active `[in.u.active self.next.res forms.u.active])] %done (continue(active ~, state value.next.res) bowl.tin) %fail ?: &(?=(^ forms.u.active) ?=(%ignore p.err.next.res)) - $(active `[(i.forms.u.active state) t.forms.u.active]) + %= $ + active `[in.u.active (i.forms.u.active state) t.forms.u.active] + in.tin in.u.active + == `[%fail err.next.res] == [(weld cards.res cards.output) next.output] From c668a24df285aad3f1d9a7402ed56d83ab9e5351 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 10 Oct 2019 18:26:18 -0700 Subject: [PATCH 191/451] custody: get data from chain --- pkg/arvo/imp/azimuth-tracker.hoon | 132 +------------------------ pkg/arvo/imp/custody.hoon | 30 ++++++ pkg/arvo/lib/azimuth.hoon | 159 ++++++++++++++++++++++++++++++ pkg/arvo/lib/custody.hoon | 4 + 4 files changed, 194 insertions(+), 131 deletions(-) create mode 100644 pkg/arvo/imp/custody.hoon create mode 100644 pkg/arvo/lib/azimuth.hoon diff --git a/pkg/arvo/imp/azimuth-tracker.hoon b/pkg/arvo/imp/azimuth-tracker.hoon index d8f53a6d2..7d4215a72 100644 --- a/pkg/arvo/imp/azimuth-tracker.hoon +++ b/pkg/arvo/imp/azimuth-tracker.hoon @@ -1,5 +1,5 @@ /- spider -/+ threadio +/+ threadio, *azimuth =, thread=thread:spider =, able:jael |% @@ -41,136 +41,6 @@ ~ [(turn ~(tap in ships) ,@) ~] :: -++ request-rpc - |= [url=@ta id=(unit @t) req=request:rpc:ethereum] - =/ m (thread ,json) - ^- form:m - %+ (retry json) `10 - =/ m (thread ,(unit json)) - ^- form:m - |^ - =/ =request:http - :* method=%'POST' - url=url - header-list=['Content-Type'^'application/json' ~] - ^= body - %- some %- as-octt:mimes:html - %- en-json:html - (request-to-json:rpc:ethereum id req) - == - ;< ~ bind:m (send-request:threadio request) - ;< rep=(unit client-response:iris) bind:m - take-maybe-response:threadio - ?~ rep - (pure:m ~) - (parse-response u.rep) - :: - ++ parse-response - |= =client-response:iris - =/ m (thread ,(unit json)) - ^- form:m - ?> ?=(%finished -.client-response) - ?~ full-file.client-response - (pure:m ~) - =/ body=@t q.data.u.full-file.client-response - =/ jon=(unit json) (de-json:html body) - ?~ jon - (pure:m ~) - =, dejs-soft:format - =/ array=(unit (list response:rpc:jstd)) - ((ar parse-one-response) u.jon) - ?~ array - =/ res=(unit response:rpc:jstd) (parse-one-response u.jon) - ?~ res - (thread-fail:threadio %request-rpc-parse-error >id< ~) - ?: ?=(%error -.u.res) - (thread-fail:threadio %request-rpc-error >id< >+.res< ~) - ?. ?=(%result -.u.res) - (thread-fail:threadio %request-rpc-fail >u.res< ~) - (pure:m `res.u.res) - (thread-fail:threadio %request-rpc-batch >%not-implemented< ~) - :: (pure:m `[%batch u.array]) - :: - ++ parse-one-response - |= =json - ^- (unit response:rpc:jstd) - =/ res=(unit [@t ^json]) - %. json - =, dejs-soft:format - (ot id+so result+some ~) - ?^ res `[%result u.res] - ~| parse-one-response=json - :+ ~ %error %- need - %. json - =, dejs-soft:format - (ot id+so error+(ot code+no message+so ~) ~) - -- -:: -++ retry - |* result=mold - |= [crash-after=(unit @ud) computation=_*form:(thread (unit result))] - =/ m (thread ,result) - =| try=@ud - |^ - |- ^- form:m - =* loop $ - ?: =(crash-after `try) - (thread-fail:threadio %retry-too-many ~) - ;< ~ bind:m (backoff try ~m1) - ;< res=(unit result) bind:m computation - ?^ res - (pure:m u.res) - loop(try +(try)) - :: - ++ backoff - |= [try=@ud limit=@dr] - =/ m (thread ,~) - ^- form:m - ;< eny=@uvJ bind:m get-entropy:threadio - ;< now=@da bind:m get-time:threadio - %- wait:threadio - %+ add now - %+ min limit - ?: =(0 try) ~s0 - %+ add - (mul ~s1 (bex (dec try))) - (mul ~s0..0001 (~(rad og eny) 1.000)) - -- -:: -++ get-latest-block - |= url=@ta - =/ m (thread ,block) - ^- form:m - ;< =json bind:m (request-rpc url `'block number' %eth-block-number ~) - (get-block-by-number url (parse-eth-block-number:rpc:ethereum json)) -:: -++ get-block-by-number - |= [url=@ta =number:block] - =/ m (thread ,block) - ^- form:m - |^ - ;< =json bind:m - (request-rpc url `'block by number' %eth-get-block-by-number number |) - =/ =block (parse-block json) - ?. =(number number.id.block) - (thread-fail:threadio %reorg-detected >number< >block< ~) - (pure:m block) - :: - ++ parse-block - |= =json - ^- block - =< [[&1 &2] |2] - ^- [@ @ @] - ~| json - %. json - =, dejs:format - %- ot - :~ hash+parse-hex-result:rpc:ethereum - number+parse-hex-result:rpc:ethereum - 'parentHash'^parse-hex-result:rpc:ethereum - == - -- -:: ++ get-logs-by-hash |= [url=@ta whos=(set ship) =hash:block] =/ m (thread udiffs:point) diff --git a/pkg/arvo/imp/custody.hoon b/pkg/arvo/imp/custody.hoon new file mode 100644 index 000000000..dc42bd88d --- /dev/null +++ b/pkg/arvo/imp/custody.hoon @@ -0,0 +1,30 @@ +/- spider +/+ *threadio, *azimuth, *custody, *csv +=, thread=thread:libthread +^- imp:spider +|= =bowl:mall +=/ m (thread ,~) +^- form:m +=/ url 'http://eth-mainnet.urbit.org:8545' +=/ key-path /=home/(scot %da now.bowl)/keys/txt +=/ loc-path /=home/(scot %da now.bowl)/locations/txt +=/ vases=(list vase) + %+ select + !, *hoon + (need ship.left) + %^ join + (load:keys key-path) + (load:locations loc-path) + !, *hoon + ?& !=(~ ship.left) + =(location.left location.right) + =(%master role.left) + == +=/ ships (turn vases |=(=vase !<(ship vase))) +|- ^- form:m +=* loop $ +?~ ships + (pure:m) +;< =point:azimuth bind:m (fetch-point url i.ships) +%- (slog >[i.ships owner.own.point]< ~) +loop(ships t.ships) diff --git a/pkg/arvo/lib/azimuth.hoon b/pkg/arvo/lib/azimuth.hoon new file mode 100644 index 000000000..004fe40d0 --- /dev/null +++ b/pkg/arvo/lib/azimuth.hoon @@ -0,0 +1,159 @@ +/+ threadio +=, thread=thread:threadio +=, able:jael +|% +++ tract azimuth:contracts:azimuth +++ fetch-point + |= [url=@ta who=ship] + =/ m (thread ,point:azimuth) + ^- form:m + =/ =request:rpc:ethereum + :+ %eth-call + =- [from=~ to=tract gas=~ price=~ value=~ data=-] + (encode-call:rpc:ethereum 'points(uint32)' [%uint `@`who]~) + [%label %latest] + ;< jon=json bind:m (request-rpc url `'point' request) + =/ res=cord (so:dejs:format jon) + =/ =point:eth-noun:azimuth + (decode-results:abi:ethereum res point:eth-type:azimuth) + :: + =/ =request:rpc:ethereum + :+ %eth-call + =- [from=~ to=tract gas=~ price=~ value=~ data=-] + (encode-call:rpc:ethereum 'rights(uint32)' [%uint `@`who]~) + [%label %latest] + ;< jon=json bind:m (request-rpc url `'deed' request) + =/ res=cord (so:dejs:format jon) + =/ =deed:eth-noun:azimuth + (decode-results:abi:ethereum res deed:eth-type:azimuth) + :: + (pure:m (point-from-eth:azimuth who point deed)) +:: +++ request-rpc + |= [url=@ta id=(unit @t) req=request:rpc:ethereum] + =/ m (thread ,json) + ^- form:m + %+ (retry json) `10 + =/ m (thread ,(unit json)) + ^- form:m + |^ + =/ =request:http + :* method=%'POST' + url=url + header-list=['Content-Type'^'application/json' ~] + ^= body + %- some %- as-octt:mimes:html + %- en-json:html + (request-to-json:rpc:ethereum id req) + == + ;< ~ bind:m (send-request:threadio request) + ;< rep=(unit client-response:iris) bind:m + take-maybe-response:threadio + ?~ rep + (pure:m ~) + (parse-response u.rep) + :: + ++ parse-response + |= =client-response:iris + =/ m (thread ,(unit json)) + ^- form:m + ?> ?=(%finished -.client-response) + ?~ full-file.client-response + (pure:m ~) + =/ body=@t q.data.u.full-file.client-response + =/ jon=(unit json) (de-json:html body) + ?~ jon + (pure:m ~) + =, dejs-soft:format + =/ array=(unit (list response:rpc:jstd)) + ((ar parse-one-response) u.jon) + ?~ array + =/ res=(unit response:rpc:jstd) (parse-one-response u.jon) + ?~ res + (thread-fail:threadio %request-rpc-parse-error >id< ~) + ?: ?=(%error -.u.res) + (thread-fail:threadio %request-rpc-error >id< >+.res< ~) + ?. ?=(%result -.u.res) + (thread-fail:threadio %request-rpc-fail >u.res< ~) + (pure:m `res.u.res) + (thread-fail:threadio %request-rpc-batch >%not-implemented< ~) + :: (pure:m `[%batch u.array]) + :: + ++ parse-one-response + |= =json + ^- (unit response:rpc:jstd) + =/ res=(unit [@t ^json]) + %. json + =, dejs-soft:format + (ot id+so result+some ~) + ?^ res `[%result u.res] + ~| parse-one-response=json + :+ ~ %error %- need + %. json + =, dejs-soft:format + (ot id+so error+(ot code+no message+so ~) ~) + -- +:: +++ retry + |* result=mold + |= [crash-after=(unit @ud) computation=_*form:(thread (unit result))] + =/ m (thread ,result) + =| try=@ud + |^ + |- ^- form:m + =* loop $ + ?: =(crash-after `try) + (thread-fail:threadio %retry-too-many ~) + ;< ~ bind:m (backoff try ~m1) + ;< res=(unit result) bind:m computation + ?^ res + (pure:m u.res) + loop(try +(try)) + :: + ++ backoff + |= [try=@ud limit=@dr] + =/ m (thread ,~) + ^- form:m + ;< eny=@uvJ bind:m get-entropy:threadio + %- sleep:threadio + %+ min limit + ?: =(0 try) ~s0 + %+ add + (mul ~s1 (bex (dec try))) + (mul ~s0..0001 (~(rad og eny) 1.000)) + -- +:: +++ get-latest-block + |= url=@ta + =/ m (thread ,block) + ^- form:m + ;< =json bind:m (request-rpc url `'block number' %eth-block-number ~) + (get-block-by-number url (parse-eth-block-number:rpc:ethereum json)) +:: +++ get-block-by-number + |= [url=@ta =number:block] + =/ m (thread ,block) + ^- form:m + |^ + ;< =json bind:m + (request-rpc url `'block by number' %eth-get-block-by-number number |) + =/ =block (parse-block json) + ?. =(number number.id.block) + (thread-fail:threadio %reorg-detected >number< >block< ~) + (pure:m block) + :: + ++ parse-block + |= =json + ^- block + =< [[&1 &2] |2] + ^- [@ @ @] + ~| json + %. json + =, dejs:format + %- ot + :~ hash+parse-hex-result:rpc:ethereum + number+parse-hex-result:rpc:ethereum + 'parentHash'^parse-hex-result:rpc:ethereum + == + -- +-- diff --git a/pkg/arvo/lib/custody.hoon b/pkg/arvo/lib/custody.hoon index adbea72b8..389feb03b 100644 --- a/pkg/arvo/lib/custody.hoon +++ b/pkg/arvo/lib/custody.hoon @@ -97,4 +97,8 @@ ^- (list vase) (turn (load-forms path) |=(=form !>(form))) -- +:: +++ policies !! +++ galaxies !! +++ ships !! -- From 625f855f2471bf814b3be8ab0cc33918af573f21 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 14 Oct 2019 16:02:27 -0400 Subject: [PATCH 192/451] master without pills, hopefully --- .mailmap | 24 + CONTRIBUTING.md | 15 +- bin/brass.pill | 3 - nix/ops/brass/default.nix | 14 +- nix/ops/default.nix | 23 +- nix/ops/fakeship/default.nix | 14 +- nix/ops/image/default.nix | 60 + nix/ops/ivory/default.nix | 14 +- nix/ops/solid/default.nix | 14 +- nix/ops/test/default.nix | 14 +- nix/pkgs/default.nix | 4 +- nix/pkgs/urbit/default.nix | 40 +- pkg/arvo/README.md | 22 +- pkg/arvo/app/chat-cli.hoon | 1218 ++++++++++ pkg/arvo/app/chat-hook.hoon | 354 +++ pkg/arvo/app/chat-store.hoon | 237 ++ pkg/arvo/app/chat-view.hoon | 344 +++ pkg/arvo/app/chat.hoon | 614 ------ pkg/arvo/app/chat/css/index.css | 2 +- pkg/arvo/app/chat/js/index.js | 2 +- pkg/arvo/app/chat/js/tile.js | 2 +- pkg/arvo/app/claz.hoon | 60 +- pkg/arvo/app/group-hook.hoon | 121 +- pkg/arvo/app/group-store.hoon | 54 +- pkg/arvo/app/permission-group-hook.hoon | 49 +- pkg/arvo/app/permission-hook.hoon | 281 +++ pkg/arvo/app/permission-store.hoon | 42 +- pkg/arvo/gen/hood/claz-invites.hoon | 41 + pkg/arvo/lib/chat-json.hoon | 245 +++ pkg/arvo/lib/chat/eval.hoon | 16 + pkg/arvo/lib/hood/drum.hoon | 80 +- pkg/arvo/lib/keygen.hoon | 6 + pkg/arvo/mar/chat/action.hoon | 59 +- pkg/arvo/mar/chat/config.hoon | 44 +- pkg/arvo/mar/chat/configs.hoon | 14 + pkg/arvo/mar/chat/hook-action.hoon | 38 + pkg/arvo/mar/chat/initial.hoon | 14 + pkg/arvo/mar/chat/update.hoon | 93 +- pkg/arvo/mar/chat/view-action.hoon | 11 + .../hook-action.hoon} | 0 .../group-hook-action.hoon} | 0 pkg/arvo/mar/permission/hook-action.hoon | 7 + pkg/arvo/sur/chat-hook.hoon | 23 + pkg/arvo/sur/chat-store.hoon | 45 + pkg/arvo/sur/chat-view.hoon | 14 + pkg/arvo/sur/permission-hook.hoon | 15 + pkg/arvo/sys/hoon.hoon | 147 +- pkg/arvo/sys/vane/ames.hoon | 7 + pkg/arvo/sys/vane/behn.hoon | 1 + pkg/arvo/sys/vane/eyre.hoon | 140 +- pkg/arvo/tests/sys/hoon/differ.hoon | 386 ++++ pkg/arvo/tests/sys/hoon/map.hoon | 747 +++++++ pkg/arvo/tests/sys/hoon/molds.hoon | 2 +- pkg/arvo/tests/sys/hoon/qeu.hoon | 357 +++ pkg/arvo/tests/sys/hoon/set.hoon | 504 +++++ pkg/arvo/tests/sys/vane/eyre.hoon | 60 +- pkg/interface/chat/package-lock.json | 1949 ++++++++++------- pkg/interface/chat/src/css/custom.css | 4 +- pkg/interface/chat/src/js/api.js | 177 +- pkg/interface/chat/src/js/components/chat.js | 158 +- pkg/interface/chat/src/js/components/join.js | 108 + .../chat/src/js/components/landing.js | 86 - .../chat/src/js/components/lib/chat-input.js | 282 +-- .../chat/src/js/components/lib/chat-tabbar.js | 27 +- .../src/js/components/lib/invite-element.js | 111 + .../src/js/components/lib/member-element.js | 13 +- .../chat/src/js/components/lib/message.js | 202 +- .../src/js/components/lib/sidebar-invite.js | 76 - .../src/js/components/lib/sidebar-item.js | 24 +- .../chat/src/js/components/member.js | 175 +- pkg/interface/chat/src/js/components/new.js | 156 +- pkg/interface/chat/src/js/components/root.js | 150 +- .../chat/src/js/components/settings.js | 49 +- .../chat/src/js/components/sidebar.js | 149 +- .../chat/src/js/reducers/chat-update.js | 78 + pkg/interface/chat/src/js/reducers/config.js | 16 - .../chat/src/js/reducers/group-update.js | 65 + pkg/interface/chat/src/js/reducers/initial.js | 30 +- .../chat/src/js/reducers/invite-update.js | 52 + .../chat/src/js/reducers/permission-update.js | 51 + pkg/interface/chat/src/js/reducers/update.js | 101 - pkg/interface/chat/src/js/store.js | 25 +- pkg/interface/chat/src/js/subscription.js | 46 +- pkg/interface/chat/tile/tile.js | 41 +- pkg/interface/clock/LICENSE | 21 - pkg/interface/clock/README.md | 10 - pkg/interface/clock/package-lock.json | 1291 ++++++++--- pkg/interface/clock/urbitrc-sample | 5 - pkg/interface/launch/package-lock.json | 253 ++- pkg/interface/timer/LICENSE | 21 - pkg/interface/timer/README.md | 10 - pkg/interface/timer/package-lock.json | 1011 ++++----- pkg/interface/timer/package.json | 6 +- pkg/interface/timer/urbitrc-sample | 5 - pkg/urbit/.gitignore | 2 - pkg/urbit/configure | 2 +- pkg/urbit/daemon/main.c | 60 +- pkg/urbit/include/vere/vere.h | 6 +- pkg/urbit/noun/events.c | 24 +- pkg/urbit/noun/manage.c | 4 + pkg/urbit/vere/ames.c | 5 - pkg/urbit/vere/pier.c | 22 +- pkg/urbit/vere/term.c | 35 +- pkg/urbit/vere/unix.c | 19 +- sh/image | 30 + 105 files changed, 9541 insertions(+), 4459 deletions(-) create mode 100644 .mailmap delete mode 100644 bin/brass.pill create mode 100644 nix/ops/image/default.nix create mode 100644 pkg/arvo/app/chat-cli.hoon create mode 100644 pkg/arvo/app/chat-hook.hoon create mode 100644 pkg/arvo/app/chat-store.hoon create mode 100644 pkg/arvo/app/chat-view.hoon delete mode 100644 pkg/arvo/app/chat.hoon create mode 100644 pkg/arvo/app/permission-hook.hoon create mode 100644 pkg/arvo/gen/hood/claz-invites.hoon create mode 100644 pkg/arvo/lib/chat-json.hoon create mode 100644 pkg/arvo/lib/chat/eval.hoon create mode 100644 pkg/arvo/mar/chat/configs.hoon create mode 100644 pkg/arvo/mar/chat/hook-action.hoon create mode 100644 pkg/arvo/mar/chat/initial.hoon create mode 100644 pkg/arvo/mar/chat/view-action.hoon rename pkg/arvo/mar/{group-hook-action.hoon => group/hook-action.hoon} (100%) rename pkg/arvo/mar/{permission-group-hook-action.hoon => permission/group-hook-action.hoon} (100%) create mode 100644 pkg/arvo/mar/permission/hook-action.hoon create mode 100644 pkg/arvo/sur/chat-hook.hoon create mode 100644 pkg/arvo/sur/chat-store.hoon create mode 100644 pkg/arvo/sur/chat-view.hoon create mode 100644 pkg/arvo/sur/permission-hook.hoon create mode 100644 pkg/arvo/tests/sys/hoon/differ.hoon create mode 100644 pkg/arvo/tests/sys/hoon/map.hoon create mode 100644 pkg/arvo/tests/sys/hoon/qeu.hoon create mode 100644 pkg/arvo/tests/sys/hoon/set.hoon create mode 100644 pkg/interface/chat/src/js/components/join.js delete mode 100644 pkg/interface/chat/src/js/components/landing.js create mode 100644 pkg/interface/chat/src/js/components/lib/invite-element.js create mode 100644 pkg/interface/chat/src/js/reducers/chat-update.js delete mode 100644 pkg/interface/chat/src/js/reducers/config.js create mode 100644 pkg/interface/chat/src/js/reducers/group-update.js create mode 100644 pkg/interface/chat/src/js/reducers/invite-update.js create mode 100644 pkg/interface/chat/src/js/reducers/permission-update.js delete mode 100644 pkg/interface/chat/src/js/reducers/update.js delete mode 100644 pkg/interface/clock/LICENSE delete mode 100644 pkg/interface/clock/README.md delete mode 100644 pkg/interface/clock/urbitrc-sample delete mode 100644 pkg/interface/timer/LICENSE delete mode 100644 pkg/interface/timer/README.md delete mode 100644 pkg/interface/timer/urbitrc-sample create mode 100755 sh/image diff --git a/.mailmap b/.mailmap new file mode 100644 index 000000000..59c31e4d9 --- /dev/null +++ b/.mailmap @@ -0,0 +1,24 @@ +b +b <42358674+benjamin-tlon@users.noreply.github.com> +BernardoDeLaPlaz <40804016+BernardoDeLaPlaz@users.noreply.github.com> +BernardoDeLaPlaz +Elliot Glaysher +Fang +Fang +Frank Ch. Eigler +Isaac Visintainer +Isaac Visintainer +Jared Tobin +John Franklin +Joe Bryan +Jose L. Bellod Cisneros +Jōshin +Jōshin <_@wholezero.org> +Joshua Reagan +Joshua Reagan +Logan Allen +Logan Allen +Matilde Park +pilfer-pandex <47340789+pilfer-pandex@users.noreply.github.com> +Robert +Ted Blackman diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 171b5952a..c14bb3f80 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -40,7 +40,7 @@ $ urbit my-fake-zod ### Contributing -The canonical source tree is located in the `master` branch at +The canonical source tree is the `master` branch of [https://github.com/urbit/urbit][repo]. You should typically branch off of `master` when commencing new work; similarly, when we pull in your contribution, we'll do so by merging it to `master`. @@ -51,6 +51,19 @@ email them to maintainers, or request a maintainer pull from your tree directly -- but note that some maintainers will be more receptive to these methods than others. +When contributing changes, via whatever means, make sure you describe them +appropriately. You should attach a reasonably high-level summary of what the +changes are and what they do; reference any useful background material that may +exist, e.g. a GitHub issue, a mailing list discussion, a UP, etc. [Here][jbpr] +is a good example of a pull request with a useful, concise description. + +If your changes replace significant extant functionality, be sure to compare +them with the thing you're replacing. You may also want to cc maintainers, +reviewers, or other parties who might have a particular interest in what you're +contributing. + +[jbpr]: https://github.com/urbit/urbit/pull/1782 + ### Hygiene Commits should generally be relevant, atomic, and have descriptions formatted diff --git a/bin/brass.pill b/bin/brass.pill deleted file mode 100644 index 24d81b915..000000000 --- a/bin/brass.pill +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:bb0a7faca368603e55469035da0deae500a0ad69c9858699a49118f8310b16b2 -size 12603952 diff --git a/nix/ops/brass/default.nix b/nix/ops/brass/default.nix index 1dfb5f998..2b35dc000 100644 --- a/nix/ops/brass/default.nix +++ b/nix/ops/brass/default.nix @@ -1,19 +1,11 @@ -{ pkgs, tlon, deps, pier, arvo, debug }: - -let - - urbitExe = if debug - then "${tlon.urbit-debug}/bin/urbit-debug -g" - else "${tlon.urbit}/bin/urbit"; - -in +{ pkgs, herb, urbit, pier, arvo }: pkgs.stdenv.mkDerivation rec { name = "brass"; builder = ./builder.sh; - buildInputs = [ tlon.herb pkgs.coreutils ]; + buildInputs = [ herb pkgs.coreutils ]; - URBIT = urbitExe; + URBIT = ubit.meta.exe; PIER = pier; ARVO = arvo; } diff --git a/nix/ops/default.nix b/nix/ops/default.nix index 0a5625463..5ebbdb8c6 100644 --- a/nix/ops/default.nix +++ b/nix/ops/default.nix @@ -2,29 +2,29 @@ let - deps = import ../deps { inherit pkgs; }; tlon = import ../pkgs { inherit pkgs; }; arvo = tlon.arvo; - urbit = tlon.urbit; + herb = tlon.herb; + urbit = if debug then tlon.urbit-debug else tlon.urbit; bootbrass = ../../bin/brass.pill; bootsolid = ../../bin/solid.pill; rawzod = import ./fakeship { - inherit pkgs tlon deps debug; + inherit pkgs herb urbit; pill = bootsolid; ship = "zod"; arvo = null; }; zod = import ./fakeship { - inherit pkgs tlon deps arvo debug; + inherit pkgs herb urbit arvo; pill = bootsolid; ship = "zod"; }; bus = import ./fakeship { - inherit pkgs tlon deps arvo debug; + inherit pkgs herb urbit arvo; pill = bootsolid; ship = "bus"; }; @@ -34,23 +34,28 @@ in rec { test = import ./test { - inherit pkgs tlon deps debug; + inherit pkgs herb urbit; ship = bus; }; solid = import ./solid { - inherit arvo pkgs tlon deps debug; + inherit pkgs herb urbit arvo; pier = rawzod; }; brass = import ./brass { - inherit arvo pkgs tlon deps debug; + inherit pkgs herb urbit arvo; pier = zod; }; ivory = import ./ivory { - inherit arvo pkgs tlon deps debug; + inherit pkgs herb urbit arvo; pier = zod; }; + image = import ./image { + inherit pkgs urbit; + pill = bootsolid; + }; + } diff --git a/nix/ops/fakeship/default.nix b/nix/ops/fakeship/default.nix index be6eb210b..8ebfa4a5e 100644 --- a/nix/ops/fakeship/default.nix +++ b/nix/ops/fakeship/default.nix @@ -1,18 +1,10 @@ -{ pkgs, tlon, deps, pill, ship, arvo, debug }: - -let - - urbitExe = if debug - then "${tlon.urbit-debug}/bin/urbit-debug -g" - else "${tlon.urbit}/bin/urbit"; - -in +{ pkgs, herb, urbit, pill, ship, arvo }: pkgs.stdenv.mkDerivation { name = "fake" + ship; builder = ./builder.sh; - buildInputs = [ tlon.herb ]; - URBIT = urbitExe; + buildInputs = [ herb ]; + URBIT = urbit.meta.exe; ARVO = arvo; PILL = pill; SHIP = ship; diff --git a/nix/ops/image/default.nix b/nix/ops/image/default.nix new file mode 100644 index 000000000..6e630ec02 --- /dev/null +++ b/nix/ops/image/default.nix @@ -0,0 +1,60 @@ +{ pkgs, urbit, pill }: + +let + + name = urbit.meta.name; + debug = urbit.meta.debug; + exe = ''${urbit.meta.exe} "$@"''; + + coredump = '' + ulimit -c unlimited + + ${exe} || \ + ${pkgs.gdb}/bin/gdb -ex "thread apply all bt" -ex "set pagination 0" -batch \ + ${urbit.meta.bin} \ + /tmp/cores/core* + ''; + + entrypoint = pkgs.writeScript "entrypoint.sh" '' + #!${pkgs.stdenv.shell} + + set -euo pipefail + + ${pkgs.coreutils}/bin/ln -sf ${pill} /data/urbit.pill + + ${if debug then coredump else exe} + ''; + +in + +pkgs.dockerTools.buildImage { + inherit name; + + runAsRoot = '' + #!${pkgs.stdenv.shell} + + set -euo pipefail + + export PATH=/bin:/usr/bin:/sbin:/usr/sbin:$PATH + + ${pkgs.dockerTools.shadowSetup} + + mkdir -p /data /tmp/cores + ''; + + config = { + Entrypoint = entrypoint; + + WorkingDir = "/data"; + + Volumes = { + "/data" = {}; + "/tmp" = {}; + }; + + ExposedPorts = { + "80/tcp" = {}; + "443/tcp" = {}; + }; + }; +} diff --git a/nix/ops/ivory/default.nix b/nix/ops/ivory/default.nix index 059bc2902..36532b7b5 100644 --- a/nix/ops/ivory/default.nix +++ b/nix/ops/ivory/default.nix @@ -1,19 +1,11 @@ -{ pkgs, tlon, deps, pier, arvo, debug }: - -let - - urbitExe = if debug - then "${tlon.urbit-debug}/bin/urbit-debug -g" - else "${tlon.urbit}/bin/urbit"; - -in +{ pkgs, herb, urbit, pier, arvo }: pkgs.stdenv.mkDerivation rec { name = "ivory"; builder = ./builder.sh; - buildInputs = [ tlon.herb pkgs.coreutils ]; + buildInputs = [ herb pkgs.coreutils ]; - URBIT = urbitExe; + URBIT = urbit.meta.exe; PIER = pier; ARVO = arvo; } diff --git a/nix/ops/solid/default.nix b/nix/ops/solid/default.nix index feafaea97..0e6fa4c28 100644 --- a/nix/ops/solid/default.nix +++ b/nix/ops/solid/default.nix @@ -1,19 +1,11 @@ -{ pkgs, tlon, deps, pier, arvo, debug }: - -let - - urbitExe = if debug - then "${tlon.urbit-debug}/bin/urbit-debug -g" - else "${tlon.urbit}/bin/urbit"; - -in +{ pkgs, herb, urbit, pier, arvo }: pkgs.stdenv.mkDerivation rec { name = "solid"; builder = ./builder.sh; - buildInputs = [ tlon.herb ]; + buildInputs = [ herb ]; - URBIT = urbitExe; + URBIT = urbit.exe; PIER = pier; ARVO = arvo; } diff --git a/nix/ops/test/default.nix b/nix/ops/test/default.nix index c1e4ac1c3..e901d2dc5 100644 --- a/nix/ops/test/default.nix +++ b/nix/ops/test/default.nix @@ -1,18 +1,10 @@ -{ pkgs, tlon, deps, ship, debug }: - -let - - urbitExe = if debug - then "${tlon.urbit-debug}/bin/urbit-debug -g" - else "${tlon.urbit}/bin/urbit"; - -in +{ pkgs, herb, urbit, ship }: pkgs.stdenv.mkDerivation rec { name = "test"; builder = ./builder.sh; - buildInputs = [ tlon.herb ]; + buildInputs = [ herb ]; - URBIT = urbitExe; + URBIT = urbit.meta.exe; SHIP = ship; } diff --git a/nix/pkgs/default.nix b/nix/pkgs/default.nix index 15285186a..f973672d5 100644 --- a/nix/pkgs/default.nix +++ b/nix/pkgs/default.nix @@ -20,8 +20,8 @@ let inherit (deps) secp256k1 h2o ivory-header ca-header; }; - urbit = mkUrbit { debug=false; }; - urbit-debug = mkUrbit { debug=true; }; + urbit = mkUrbit { debug = false; }; + urbit-debug = mkUrbit { debug = true; }; in diff --git a/nix/pkgs/urbit/default.nix b/nix/pkgs/urbit/default.nix index 0e64c5cf1..6572f721f 100644 --- a/nix/pkgs/urbit/default.nix +++ b/nix/pkgs/urbit/default.nix @@ -9,6 +9,13 @@ let name = if debug then "urbit-debug" else "urbit"; + meta = rec { + inherit debug; + bin = "${urbit}/bin/${name}"; + flags = if debug then "-g" else ""; + exe = "${meta.bin} ${meta.flags}"; + }; + deps = with pkgs; [ curl gmp libsigsegv ncurses openssl zlib lmdb ]; @@ -16,21 +23,22 @@ let vendor = [ argon2 softfloat3 ed25519 ent ge-additions h2o scrypt uv murmur3 secp256k1 sni ivory-header ca-header ]; + urbit = pkgs.stdenv.mkDerivation { + inherit name meta; + exename = name; + src = ../../../pkg/urbit; + builder = ./builder.sh; + nativeBuildInputs = deps ++ vendor; + + # See https://github.com/NixOS/nixpkgs/issues/18995 + hardeningDisable = if debug then [ "all" ] else []; + + CFLAGS = if debug then "-O3 -g -Werror" else "-O3 -Werror"; + MEMORY_DEBUG = debug; + CPU_DEBUG = debug; + EVENT_TIME_DEBUG = false; + }; + in -pkgs.stdenv.mkDerivation { - name = name; - exename = name; - src = ../../../pkg/urbit; - builder = ./builder.sh; - - nativeBuildInputs = deps ++ vendor; - - # See https://github.com/NixOS/nixpkgs/issues/18995 - hardeningDisable = if debug then [ "all" ] else []; - - CFLAGS = if debug then "-O3 -g -Werror" else "-O3 -Werror"; - MEMORY_DEBUG = debug; - CPU_DEBUG = debug; - EVENT_TIME_DEBUG = false; -} +urbit diff --git a/pkg/arvo/README.md b/pkg/arvo/README.md index 76398e367..8f1d06870 100644 --- a/pkg/arvo/README.md +++ b/pkg/arvo/README.md @@ -4,7 +4,10 @@ A clean-slate operating system. ## Usage -To run Arvo, you'll need [Urbit](https://github.com/urbit/urbit/). To install Urbit and run Arvo please follow the instructions in the [getting started docs](https://urbit.org/docs/getting-started/). You'll be on the live network in a few minutes. +To run Arvo, you'll need [Urbit](https://github.com/urbit/urbit/). To install +Urbit and run Arvo please follow the instructions in the [getting started +docs](https://urbit.org/docs/getting-started/). You'll be on the live network +in a few minutes. If you're doing development on Arvo, keep reading. @@ -56,11 +59,16 @@ Most parts of Arvo have dedicated maintainers. ## Contributing -Contributions of any form are more than welcome! If something doesn't seem right, and there is no issue about it yet, feel free to open one. +Contributions of any form are more than welcome! Please take a look at our +[contributing guidelines][cont] for details on our git practices, coding +styles, how we manage issues, and so on. -If you're looking to make code contributions, there are a few things you can do: +You might also be interested in: -- Join the [urbit-dev](https://groups.google.com/a/urbit.org/forum/#!forum/dev) mailing list. -- [Ask us about Hoon School](mailto:support@urbit.org), a course we run to teach the Hoon programming language and Urbit application development. -- Check out [good contributor issues](https://github.com/urbit/arvo/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+contributor+issue%22). -- Reach out to [support@urbit.org](mailto:support@urbit.org) to say hi and ask any questions you might have. +- joining the [urbit-dev][list] mailing list. +- [applying to Hoon School][mail], a course we run to teach the Hoon + programming language and Urbit application development. + +[list]: https://groups.google.com/a/urbit.org/forum/#!forum/dev +[mail]: mailto:support@urbit.org +[cont]: https://github.com/urbit/urbit/blob/master/CONTRIBUTING.md diff --git a/pkg/arvo/app/chat-cli.hoon b/pkg/arvo/app/chat-cli.hoon new file mode 100644 index 000000000..b88db89f1 --- /dev/null +++ b/pkg/arvo/app/chat-cli.hoon @@ -0,0 +1,1218 @@ +:: chat-cli: cli chat client using chat-store and friends +:: +:: pulls all known messages into a single stream. +:: type ;help for usage instructions. +:: +:: note that while the chat-store only cares about paths, +:: we mostly deal with [ship path] (aka target) here. +:: when sending messages (through the chat hook), +:: we concat the ship onto the head of the path, +:: and trust it to take care of the rest. +:: +/- *chat-store, *chat-view, *chat-hook, + *permission-store, *group-store, + sole-sur=sole +/+ sole-lib=sole, chat-eval +:: +|% ++$ state + $: grams=(list mail) :: all messages + known=(set [target serial]) :: known message lookup + count=@ud :: (lent grams) + bound=(map target glyph) :: bound circle glyphs + binds=(jug glyph target) :: circle glyph lookup + audience=(set target) :: active targets + settings=(set term) :: frontend flags + width=@ud :: display width + timez=(pair ? @ud) :: timezone adjustment + cli=[=bone state=sole-share:sole-sur] :: console id & state + == +:: ++$ mail [source=target envelope] ++$ target [=ship =path] +:: ++$ glyph char +++ glyphs "!@#$%^&()-=_+[]\{};'\\:\",.<>?" +:: ++$ command + $% [%target (set target)] :: set messaging target + [%say letter] :: send message + [%eval cord hoon] :: send #-message + :: + [%create chat-security path (unit glyph)] :: create chat + [%delete path] :: delete chat + [%invite ?(%r %w %rw) path (set ship)] :: allow + [%banish ?(%r %w %rw) path (set ship)] :: disallow + :: + [%join target (unit glyph)] :: join target + [%leave target] :: nuke target + :: + [%bind glyph target] :: bind glyph + [%unbind glyph (unit target)] :: unbind glyph + [%what (unit $@(char target))] :: glyph lookup + :: + [%settings ~] :: show active settings + [%set term] :: set settings flag + [%unset term] :: unset settings flag + [%width @ud] :: adjust display width + [%timezone ? @ud] :: adjust time printing + :: + [%select $@(rel=@ud [zeros=@u abs=@ud])] :: rel/abs msg selection + [%chats ~] :: list available chats + [%help ~] :: print usage info + == :: +:: ++$ move [bone card] ++$ card + $% [%diff %sole-effect sole-effect:sole-sur] + [%poke wire dock out-action] + [%peer wire dock path] + == +:: ++$ out-action + $% [%chat-action chat-action] + [%chat-view-action chat-view-action] + [%chat-hook-action chat-hook-action] + [%group-action group-action] + == +-- +:: +|_ [=bowl:gall state] +++ this . +:: +prep: setup & state adapter +:: +++ prep + |= old=(unit state) + ?^ old + [~ this(+<+ u.old)] + =^ moves this + %_ catch-up + audience [[our-self /] ~ ~] + settings (sy %showtime %notify ~) + width 80 + == + [[connect moves] this] +:: +catch-up: process all chat-store state +:: +++ catch-up + ^- (quip move _this) + =/ =inbox + .^ inbox + %gx + (scot %p our.bowl) + %chat-store + (scot %da now.bowl) + /all/noun + == + |- ^- (quip move _this) + ?~ inbox [~ this] + =* path p.n.inbox + =* mailbox q.n.inbox + =/ =target (path-to-target path) + =^ moves-n this (read-envelopes target envelopes.mailbox) + =^ moves-l this $(inbox l.inbox) + =^ moves-r this $(inbox r.inbox) + [:(weld moves-n moves-l moves-r) this] +:: +connect: connect to the chat-store +:: +++ connect + ^- move + [ost.bowl %peer /chat-store [our-self %chat-store] /updates] +:: +true-self: moons to planets +:: +++ true-self + |= who=ship + ^- ship + ?. ?=(%earl (clan:title who)) who + (sein:title our.bowl now.bowl who) +++ our-self (true-self our.bowl) +:: +target-to-path: prepend ship to the path +:: +++ target-to-path + |= target + [(scot %p ship) path] +:: +path-to-target: deduces a target from a mailbox path +:: +++ path-to-target + |= =path + ^- target + ?. ?=([@ @ *] path) + ::TODO can we safely assert the above? + ~& [%path-without-host path] + [our-self path] + =+ who=(slaw %p i.path) + ?~ who [our-self path] + [u.who t.path] +:: +poke-noun: debug helpers +:: +++ poke-noun + |= a=* + ^- (quip move _this) + ?: ?=(%connect a) + [[connect ~] this] + ?: ?=(%catch-up a) + catch-up + [~ this] +:: +poke-sole-action: handle cli input +:: +++ poke-sole-action + |= act=sole-action:sole-sur + ^- (quip move _this) + ?. =(bone.cli ost.bowl) + ~|(%strange-sole !!) + (sole:sh-in act) +:: +peer: accept only cli subscriptions from ourselves +:: +++ peer + |= =path + ^- (quip move _this) + ?. (team:title our-self src.bowl) + ~| [%peer-talk-stranger src.bowl] + !! + ?. ?=([%sole *] path) + ~| [%peer-talk-strange path] + !! + =. bone.cli ost.bowl + :: display a fresh prompt + :- [prompt:sh-out ~] + :: start with fresh sole state + this(state.cli *sole-share:sole-sur) +:: +diff-chat-update: get new mailboxes & messages +:: +++ diff-chat-update + |= [=wire upd=chat-update] + ^- (quip move _this) + ?+ -.upd [~ this] + %create (notice-create +.upd) + %delete [[(show-delete:sh-out (path-to-target path.upd)) ~] this] + %message (read-envelope (path-to-target path.upd) envelope.upd) + == +:: +++ read-envelopes + |= [=target envs=(list envelope)] + ^- (quip move _this) + ?~ envs [~ this] + =^ moves-i this (read-envelope target i.envs) + =^ moves-t this $(envs t.envs) + [(weld moves-i moves-t) this] +:: +++ notice-create + |= =target + ^- (quip move _this) + =^ moves this + ?: (~(has by bound) target) + [~ this] + (bind-default-glyph target) + [[(show-create:sh-out target) moves] this] +:: +bind-default-glyph: bind to default, or random available +:: +++ bind-default-glyph + |= =target + ^- (quip move _this) + =; =glyph (bind-glyph glyph target) + |^ =/ g=glyph (choose glyphs) + ?. (~(has by binds) g) g + =/ available=(list glyph) + %~ tap in + (~(dif in `(set glyph)`(sy glyphs)) ~(key by binds)) + ?~ available g + (choose available) + ++ choose + |= =(list glyph) + =; i=@ud (snag i list) + (mod (mug target) (lent list)) + -- +:: +bind-glyph: add binding for glyph +:: +++ bind-glyph + |= [=glyph =target] + ^- (quip move _this) + ::TODO should send these to settings store eventually + :: if the target was already bound to another glyph, un-bind that + :: + =? binds (~(has by bound) target) + (~(del ju binds) (~(got by bound) target) target) + =. bound (~(put by bound) target glyph) + =. binds (~(put ju binds) glyph target) + [(show-glyph:sh-out glyph `target) this] +:: +unbind-glyph: remove all binding for glyph +:: +++ unbind-glyph + |= [=glyph targ=(unit target)] + ^- (quip move _this) + ?^ targ + =. binds (~(del ju binds) glyph u.targ) + =. bound (~(del by bound) u.targ) + [(show-glyph:sh-out glyph ~) this] + =/ ole=(set target) + (~(get ju binds) glyph) + =. binds (~(del by binds) glyph) + =. bound + |- + ?~ ole bound + =. bound $(ole l.ole) + =. bound $(ole r.ole) + (~(del by bound) n.ole) + [(show-glyph:sh-out glyph ~) this] +:: +decode-glyph: find the target that matches a glyph, if any +:: +++ decode-glyph + |= =glyph + ^- (unit target) + =+ lax=(~(get ju binds) glyph) + :: no circle + ?: =(~ lax) ~ + %- some + :: single circle + ?: ?=([* ~ ~] lax) n.lax + :: in case of multiple audiences, pick the most recently active one + |- ^- target + ?~ grams -:~(tap in lax) + =* source source.i.grams + ?: (~(has in lax) source) + source + $(grams t.grams) +:: +read-envelope: add envelope to state and show it to user +:: +++ read-envelope + |= [=target =envelope] + ^- (quip move _this) + ?: (~(has in known) [target uid.envelope]) + ::NOTE we no-op only because edits aren't possible + [~ this] + :- (show-envelope:sh-out target envelope) + %_ this + known (~(put in known) [target uid.envelope]) + grams [[target envelope] grams] + count +(count) + == +:: +:: +sh-in: handle user input +:: +++ sh-in + ::NOTE interestingly, adding =, sh-out breaks compliation + |% + :: +sole: apply sole action + :: + ++ sole + |= act=sole-action:sole-sur + ^- (quip move _this) + ?- -.act + $det (edit +.act) + $clr [~ this] + $ret obey + == + :: +edit: apply sole edit + :: + :: called when typing into the cli prompt. + :: applies the change and does sanitizing. + :: + ++ edit + |= cal=sole-change:sole-sur + ^- (quip move _this) + =^ inv state.cli (~(transceive sole-lib state.cli) cal) + =+ fix=(sanity inv buf.state.cli) + ?~ lit.fix + [~ this] + :: just capital correction + ?~ err.fix + (slug fix) + :: allow interior edits and deletes + ?. &(?=($del -.inv) =(+(p.inv) (lent buf.state.cli))) + [~ this] + (slug fix) + :: +sanity: check input sanity + :: + :: parses cli prompt using +read. + :: if invalid, produces error correction description, for use with +slug. + :: + ++ sanity + |= [inv=sole-edit:sole-sur buf=(list @c)] + ^- [lit=(list sole-edit:sole-sur) err=(unit @u)] + =+ res=(rose (tufa buf) read) + ?: ?=(%& -.res) [~ ~] + [[inv]~ `p.res] + :: +slug: apply error correction to prompt input + :: + ++ slug + |= [lit=(list sole-edit:sole-sur) err=(unit @u)] + ^- (quip move _this) + ?~ lit [~ this] + =^ lic state.cli + %- ~(transmit sole-lib state.cli) + ^- sole-edit:sole-sur + ?~(t.lit i.lit [%mor lit]) + :_ this + :_ ~ + %+ effect:sh-out %mor + :- [%det lic] + ?~(err ~ [%err u.err]~) + :: +read: command parser + :: + :: parses the command line buffer. + :: produces commands which can be executed by +work. + :: + ++ read + |^ + %+ knee *command |. ~+ + =- ;~(pose ;~(pfix mic -) message) + ;~ pose + (stag %target tars) + :: + ;~ (glue ace) + (tag %create) + security + ;~(plug path (punt ;~(pfix ace glyph))) + == + ;~((glue ace) (tag %delete) path) + ;~((glue ace) (tag %invite) rw path ships) + ;~((glue ace) (tag %banish) rw path ships) + :: + ;~((glue ace) (tag %join) ;~(plug targ (punt ;~(pfix ace glyph)))) + ;~((glue ace) (tag %leave) targ) + :: + ;~((glue ace) (tag %bind) glyph targ) + ;~((glue ace) (tag %unbind) ;~(plug glyph (punt ;~(pfix ace targ)))) + ;~(plug (perk %what ~) (punt ;~(pfix ace ;~(pose glyph targ)))) + :: + ;~(plug (tag %settings) (easy ~)) + ;~((glue ace) (tag %set) flag) + ;~((glue ace) (tag %unset) flag) + ;~(plug (cold %width (jest 'set width ')) dem:ag) + ;~ plug + (cold %timezone (jest 'set timezone ')) + ;~ pose + (cold %| (just '-')) + (cold %& (just '+')) + == + %+ sear + |= a=@ud + ^- (unit @ud) + ?:(&((gte a 0) (lte a 14)) `a ~) + dem:ag + == + :: + ;~(plug (tag %chats) (easy ~)) + ;~(plug (tag %help) (easy ~)) + :: + (stag %select nump) + == + :: + ::TODO + :: ++ cmd + :: |* [cmd=term req=(list rule) opt=(list rule)] + :: |^ ;~ plug + :: (tag cmd) + :: :: + :: ::TODO this feels slightly too dumb + :: ?~ req + :: ?~ opt (easy ~) + :: (opt-rules opt) + :: ?~ opt (req-rules req) + :: ;~(plug (req-rules req) (opt-rules opt)) ::TODO rest-loop + :: == + :: ++ req-rules + :: |* req=(lest rule) + :: =- ;~(pfix ace -) + :: ?~ t.req i.req + :: ;~(plug i.req $(req t.req)) + :: ++ opt-rules + :: |* opt=(lest rule) + :: =- (punt ;~(pfix ace -)) + :: ?~ t.opt ;~(pfix ace i.opt) + :: ;~(pfix ace ;~(plug i.opt $(opt t.opt))) + :: -- + :: + ++ tag |*(a=@tas (cold a (jest a))) ::TODO into stdlib + ++ ship ;~(pfix sig fed:ag) + ++ path ;~(pfix net (most net urs:ab)) + :: +tarl: local target, as /path + :: + ++ tarl (stag our-self path) + :: +tarp: sponsor target, as ^/path + :: + ++ tarp + =- ;~(pfix ket (stag - path)) + (sein:title our.bowl now.bowl our-self) + :: +targ: any target, as tarl, tarp, ~ship/path or glyph + :: + ++ targ + ;~ pose + tarl + tarp + ;~(plug ship path) + (sear decode-glyph glyph) + == + :: +tars: set of comma-separated targs + :: + ++ tars + %+ cook ~(gas in *(set target)) + (most ;~(plug com (star ace)) targ) + :: +ships: set of comma-separated ships + :: + ++ ships + %+ cook ~(gas in *(set ^ship)) + (most ;~(plug com (star ace)) ship) + :: + :: +security: security mode + :: + ++ security + (perk %channel %village %journal %mailbox ~) + :: +rw: read, write, or read-write + :: + ++ rw + (perk %rw %r %w ~) + :: + :: +glyph: shorthand character + :: + ++ glyph (mask glyphs) + :: +flag: valid flag + :: + ++ flag + %- perk :~ + %notify + %showtime + == + :: +nump: message number reference + :: + ++ nump + ;~ pose + ;~(pfix hep dem:ag) + ;~ plug + (cook lent (plus (just '0'))) + ;~(pose dem:ag (easy 0)) + == + (stag 0 dem:ag) + (cook lent (star mic)) + == + :: +message: all messages + :: + ++ message + ;~ pose + ;~(plug (cold %eval hax) expr) + (stag %say letter) + == + :: +letter: simple messages + :: + ++ letter + ;~ pose + (stag %url turl) + :(stag %me ;~(pfix vat text)) + :(stag %text ;~(less mic hax text)) + == + :: +turl: url parser + :: + ++ turl + =- (sear - text) + |= t=cord + ^- (unit cord) + ?~((rush t aurf:de-purl:html) ~ `t) + :: +text: text message body + :: + ++ text + %+ cook crip + (plus ;~(less (jest '•') next)) + :: +expr: parse expression into [cord hoon] + :: + ++ expr + |= tub=nail + %. tub + %+ stag (crip q.tub) + wide:(vang & [&1:% &2:% (scot %da now.bowl) |3:%]) + -- + :: +obey: apply result + :: + :: called upon hitting return in the prompt. + :: if input is invalid, +slug is called. + :: otherwise, the appropriate work is done and + :: the command (if any) gets echoed to the user. + :: + ++ obey + ^- (quip move _this) + =+ buf=buf.state.cli + =+ fix=(sanity [%nop ~] buf) + ?^ lit.fix + (slug fix) + =+ jub=(rust (tufa buf) read) + ?~ jub [[(effect:sh-out %bel ~) ~] this] + =^ cal state.cli (~(transmit sole-lib state.cli) [%set ~]) + =^ moves this (work u.jub) + :_ this + %+ weld + ^- (list move) + :: echo commands into scrollback + ?. =(`0 (find ";" buf)) ~ + [(note:sh-out (tufa `(list @)`buf)) ~] + :_ moves + %+ effect:sh-out %mor + :~ [%nex ~] + [%det cal] + == + :: +work: run user command + :: + ++ work + |= job=command + ^- (quip move _this) + |^ ?- -.job + %target (set-target +.job) + %say (say +.job) + %eval (eval +.job) + :: + %create (create +.job) + %delete (delete +.job) + %invite (change-permission & +.job) + %banish (change-permission | +.job) + :: + %join (join +.job) + %leave (leave +.job) + :: + %bind (bind-glyph +.job) + %unbind (unbind-glyph +.job) + %what (lookup-glyph +.job) + :: + %settings show-settings + %set (set-setting +.job) + %unset (unset-setting +.job) + %width (set-width +.job) + %timezone (set-timezone +.job) + :: + %select (select +.job) + %chats chats + %help help + == + :: +act: build action move + :: + ++ act + |= [what=term app=term =out-action] + ^- move + :* ost.bowl + %poke + /cli-command/[what] + [our-self app] + out-action + == + :: +set-target: set audience, update prompt + :: + ++ set-target + |= tars=(set target) + ^- (quip move _this) + =. audience tars + [[prompt:sh-out ~] this] + :: +create: new local mailbox + :: + ++ create + |= [security=chat-security =path gyf=(unit char)] + ^- (quip move _this) + ::TODO check if already exists + =/ =target [our-self path] + =. audience [target ~ ~] + =^ moz this + ?. ?=(^ gyf) [~ this] + (bind-glyph u.gyf target) + =- [[- moz] this] + %^ act %do-create %chat-view + :- %chat-view-action + :^ %create path security + :: ensure we can read from/write to our own chats + :: + :- :: read + ?- security + ?(%channel %journal) ~ + ?(%village %mailbox) [our-self ~ ~] + == + :: write + ?- security + ?(%channel %mailbox) ~ + ?(%village %journal) [our-self ~ ~] + == + :: +delete: delete local chats + :: + ++ delete + |= =path + ^- (quip move _this) + =- [[- ~] this] + %^ act %do-delete %chat-view + :- %chat-view-action + [%delete (target-to-path our-self path)] + :: +change-permission: modify permissions on a local chat + :: + ++ change-permission + |= [allow=? rw=?(%r %w %rw) =path ships=(set ship)] + ^- (quip move _this) + :_ this + %+ murn + ^- (list term) + ?- rw + %r [%read ~] + %w [%write ~] + %rw [%read %write ~] + == + |= =term + ^- (unit move) + =. path + =- (snoc `^path`- term) + [%chat (target-to-path our-self path)] + :: whitelist: empty if no matching permission, else true if whitelist + :: + =/ whitelist=(unit ?) + =; perm=(unit permission) + ?~(perm ~ `?=(%white kind.u.perm)) + ::TODO +permission-of-target? + .^ (unit permission) + %gx + (scot %p our-self) + %permission-store + (scot %da now.bowl) + %permission + (snoc path %noun) + == + ?~ whitelist + ~& [%weird-no-permission path] + ~ + %- some + %^ act %do-permission %group-store + ^- out-action + :- %group-action + ?: =(u.whitelist allow) + [%add ships path] + [%remove ships path] + :: +join: sync with remote mailbox + :: + ++ join + |= [=target gyf=(unit char)] + ^- (quip move _this) + =^ moz this + ?. ?=(^ gyf) [~ this] + (bind-glyph u.gyf target) + =- [[- moz] this(audience [target ~ ~])] + ::TODO ideally we'd check permission first. attempting this and failing + :: gives ugly %chat-hook-reap + %^ act %do-join %chat-view + :- %chat-view-action + [%join target] + :: +leave: unsync & destroy mailbox + :: + ::TODO allow us to "mute" local chats using this + ++ leave + |= =target + =- [[- ~] this] + ?: =(our-self ship.target) + %- print:sh-out + "can't ;leave local chats, maybe use ;delete instead" + %^ act %do-leave %chat-hook + :- %chat-hook-action + [%remove (target-to-path target)] + :: +say: send messages + :: + ++ say + |= =letter + ^- (quip move _this) + =/ =serial (shaf %msg-uid eny.bowl) + :_ this(eny.bowl (shax eny.bowl)) + ^- (list move) + %+ turn ~(tap in audience) + |= =target + %^ act %out-message %chat-hook + :- %chat-action + :+ %message (target-to-path target) + [serial *@ our-self now.bowl letter] + :: +eval: run hoon, send code and result as message + :: + :: this double-virtualizes and clams to disable .^ for security reasons + :: + ++ eval + |= [txt=cord exe=hoon] + (say %code txt (eval:chat-eval bowl exe)) + :: +lookup-glyph: print glyph info for all, glyph or target + :: + ++ lookup-glyph + |= qur=(unit $@(glyph target)) + ^- (quip move _this) + =- [[- ~] this] + ?^ qur + ?^ u.qur + =+ gyf=(~(get by bound) u.qur) + (print:sh-out ?~(gyf "none" [u.gyf]~)) + =+ pan=~(tap in (~(get ju binds) `@t`u.qur)) + ?: =(~ pan) (print:sh-out "~") + =< (effect:sh-out %mor (turn pan .)) + |=(t=target [%txt ~(phat tr t)]) + %- print-more:sh-out + %- ~(rep by binds) + |= $: [=glyph tars=(set target)] + lis=(list tape) + == + %+ weld lis + ^- (list tape) + %- ~(rep in tars) + |= [t=target l=(list tape)] + %+ weld l + ^- (list tape) + [glyph ' ' ~(phat tr t)]~ + :: +show-settings: print enabled flags, timezone and width settings + :: + ++ show-settings + ^- (quip move _this) + :_ this + :~ %- print:sh-out + %- zing + ^- (list tape) + :- "flags: " + %+ ^join ", " + (turn `(list @t)`~(tap in settings) trip) + :: + %- print:sh-out + %+ weld "timezone: " + ^- tape + :- ?:(p.timez '+' '-') + (scow %ud q.timez) + :: + (print:sh-out "width: {(scow %ud width)}") + == + :: +set-setting: enable settings flag + :: + ++ set-setting + |= =term + ^- (quip move _this) + [~ this(settings (~(put in settings) term))] + :: +unset-setting: disable settings flag + :: + ++ unset-setting + |= =term + ^- (quip move _this) + [~ this(settings (~(del in settings) term))] + :: +set-width: configure cli printing width + :: + ++ set-width + |= w=@ud + [~ this(width w)] + :: +set-timezone: configure timestamp printing adjustment + :: + ++ set-timezone + |= tz=[? @ud] + [~ this(timez tz)] + :: +select: expand message from number reference + :: + ++ select + ::NOTE rel is the nth most recent message, + :: abs is the last message whose numbers ends in n + :: (with leading zeros used for precision) + :: + |= num=$@(rel=@ud [zeros=@u abs=@ud]) + ^- (quip move _this) + |^ ?@ num + =+ tum=(scow %s (new:si | +(num))) + ?: (gte rel.num count) + %- just-print + "{tum}: no such telegram" + (activate tum rel.num) + ?. (gte abs.num count) + ?: =(count 0) + (just-print "0: no messages") + =+ msg=(index (dec count) num) + (activate (scow %ud msg) (sub count +(msg))) + %- just-print + "…{(reap zeros.num '0')}{(scow %ud abs.num)}: no such telegram" + :: +just-print: full [moves state] output with a single print move + :: + ++ just-print + |= txt=tape + [[(print:sh-out txt) ~] this] + :: +index: get message index from absolute reference + :: + ++ index + |= [max=@ud nul=@u fin=@ud] + ^- @ud + =+ dog=|-(?:(=(0 fin) 1 (mul 10 $(fin (div fin 10))))) + =. dog (mul dog (pow 10 nul)) + =- ?:((lte - max) - (sub - dog)) + (add fin (sub max (mod max dog))) + :: +activate: echo message selector and print details + :: + ++ activate + |= [number=tape index=@ud] + ^- (quip move _this) + =+ gam=(snag index grams) + =. audience [source.gam ~ ~] + :_ this + ^- (list move) + :~ (print:sh-out ['?' ' ' number]) + (effect:sh-out ~(render-activate mr gam)) + prompt:sh-out + == + -- + :: +chats: display list of local mailboxes + :: + ++ chats + ^- (quip move _this) + :_ this + :_ ~ + %- print-more:sh-out + =/ all + ::TODO refactor + ::TODO remote scries fail... but moon support? + .^ (set path) + %gx + /(scot %p our-self)/chat-store/(scot %da now.bowl)/keys/noun + == + %+ turn ~(tap in all) + %+ cork path-to-target + |= target + (weld (scow %p ship) (spud path)) + :: +help: print (link to) usage instructions + :: + ++ help + ^- (quip move _this) + =- [[- ~] this] + (print:sh-out "see https://urbit.org/docs/using/messaging/") + -- + -- +:: +:: +sh-out: output to the cli +:: +++ sh-out + |% + :: +effect: console effect move + :: + ++ effect + |= fec=sole-effect:sole-sur + ^- move + [bone.cli %diff %sole-effect fec] + :: +print: puts some text into the cli as-is + :: + ++ print + |= txt=tape + ^- move + (effect %txt txt) + :: +print-more: puts lines of text into the cli + :: + ++ print-more + |= txs=(list tape) + ^- move + %+ effect %mor + (turn txs |=(t=tape [%txt t])) + :: +note: prints left-padded ---| txt + :: + ++ note + |= txt=tape + ^- move + =+ lis=(simple-wrap txt (sub width 16)) + %- print-more + =+ ?:((gth (lent lis) 0) (snag 0 lis) "") + :- (runt [14 '-'] '|' ' ' -) + %+ turn (slag 1 lis) + |=(a=tape (runt [14 ' '] '|' ' ' a)) + :: +prompt: update prompt to display current audience + :: + ++ prompt + ^- move + %+ effect %pro + :+ & %talk-line + ^- tape + =- ?: =(1 (lent -)) "{-} " + "[{-}] " + =/ all + %+ sort ~(tap in audience) + |= [a=target b=target] + (~(beat tr a) b) + =+ fir=& + |- ^- tape + ?~ all ~ + ;: welp + ?:(fir "" " ") + ~(show tr i.all) + $(all t.all, fir |) + == + :: +show-envelope: print incoming message + :: + :: every five messages, prints the message number also. + :: if the message mentions the user's (shortened) ship name, + :: and the %notify flag is set, emit a bell. + :: + ++ show-envelope + |= [=target =envelope] + ^- (list move) + %+ weld + ^- (list move) + ?. =(0 (mod count 5)) ~ + :_ ~ + =+ num=(scow %ud count) + %- print + (runt [(sub 13 (lent num)) '-'] "[{num}]") + =+ lis=~(render-inline mr target envelope) + ?~ lis ~ + :_ ~ + %+ effect %mor + %+ turn `(list tape)`lis + =+ nom=(scag 7 (cite:title our-self)) + |= t=tape + ?. ?& (~(has in settings) %notify) + ?=(^ (find nom (slag 15 t))) + == + [%txt t] + [%mor [%txt t] [%bel ~] ~] + :: +show-create: print mailbox creation notification + :: + ++ show-create + |= =target + ^- move + (note "new: {~(phat tr target)}") + :: +show-delete: print mailbox deletion notification + :: + ++ show-delete + |= =target + ^- move + (note "del: {~(phat tr target)}") + :: +show-glyph: print glyph un/bind notification + :: + ++ show-glyph + |= [=glyph target=(unit target)] + ^- (list move) + :_ [prompt ~] + %- note + %+ weld "set: {[glyph ~]} " + ?~ target "unbound" + ~(phat tr u.target) + -- +:: +:: +tr: render targets +:: +++ tr + |_ :: one: the target. + :: + one=target + :: +beat: true if one is more "relevant" than two + :: + ++ beat + |= two=target + ^- ? + :: the target that's ours is better. + ?: =(our-self ship.one) + ?. =(our-self ship.two) & + ?< =(path.one path.two) + :: if both targets are ours, the main story is better. + ?: =(%inbox path.one) & + ?: =(%inbox path.two) | + :: if neither are, pick the "larger" one. + (lth (lent path.one) (lent path.two)) + :: if one isn't ours but two is, two is better. + ?: =(our-self ship.two) | + ?: =(ship.one ship.two) + :: if they're from the same ship, pick the "larger" one. + (lth (lent path.one) (lent path.two)) + :: if they're from different ships, neither ours, pick hierarchically. + (lth (xeb ship.one) (xeb ship.two)) + :: +phat: render target fully + :: + :: renders as ~ship/path. + :: for local mailboxes, renders just /path. + :: for sponsor's mailboxes, renders ^/path. + :: + ::NOTE but, given current implementation, all will be local + :: + ++ phat + ^- tape + %+ weld + ?: =(our-self ship.one) ~ + ?: =((sein:title our.bowl now.bowl our-self) ship.one) "^" + (scow %p ship.one) + (spud path.one) + :: +show: render as tape, as glyph if we can + :: + ++ show + ^- tape + =+ cha=(~(get by bound) one) + ?~(cha phat "{u.cha ~}") + :: +glyph: tape for glyph of target, defaulting to * + :: + ++ glyph + ^- tape + [(~(gut by bound) one '*') ~] + -- +:: +:: +mr: render messages +:: +++ mr + |_ $: source=target + envelope + == + :: +activate: produce sole-effect for printing message details + :: + ++ render-activate + ^- sole-effect:sole-sur + ~[%mor [%tan meta] body] + :: +meta: render message metadata (serial, timestamp, author, target) + :: + ++ meta + ^- tang + =. when (sub when (mod when (div when ~s0..0001))) :: round + =+ hed=leaf+"{(scow %uv uid)} at {(scow %da when)}" + =/ src=tape ~(phat tr source) + [%rose [" " ~ ~] [hed >author< [%rose [", " "to " ~] [leaf+src]~] ~]]~ + :: +body: long-form render of message contents + :: + ++ body + |- ^- sole-effect:sole-sur + ?- -.letter + ?(%text %me) + =/ pre=tape ?:(?=(%me -.letter) "@ " "") + tan+~[leaf+"{pre}{(trip +.letter)}"] + :: + %url + url+url.letter + :: + %code + =/ texp=tape ['>' ' ' (trip expression.letter)] + :- %mor + |- ^- (list sole-effect:sole-sur) + ?: =("" texp) [tan+output.letter ~] + =/ newl (find "\0a" texp) + ?~ newl [txt+texp $(texp "")] + =+ (trim u.newl texp) + :- txt+(scag u.newl texp) + $(texp [' ' ' ' (slag +(u.newl) texp)]) + == + :: +render-inline: produces lines to display message body in scrollback + :: + ++ render-inline + ^- (list tape) + =/ wyd + :: termwidth, + %+ sub width + :: minus autor, + %+ add 14 + :: minus timestamp. + ?:((~(has in settings) %showtime) 10 0) + =+ txs=(line wyd) + ?~ txs ~ + :: nom: rendered author + :: den: regular indent + :: tam: timestamp, if desired + :: + =/ nom=tape (nome author) + =/ den=tape (reap (lent nom) ' ') + =/ tam=tape + ?. (~(has in settings) %showtime) "" + =. when + %. [when (mul q.timez ~h1)] + ?:(p.timez add sub) + =+ dat=(yore when) + =/ t + |= a/@ + %+ weld + ?:((lth a 10) "0" ~) + (scow %ud a) + =/ time + ;: weld + "~" (t h.t.dat) + "." (t m.t.dat) + "." (t s.t.dat) + == + %+ weld + (reap (sub +(wyd) (min wyd (lent (tuba i.txs)))) ' ') + time + %- flop + %+ roll `(list tape)`txs + |= [t=tape l=(list tape)] + ?~ l [:(weld nom t tam) ~] + [(weld den t) l] + :: +nome: prints a ship name in 14 characters, left-padding with spaces + :: + ++ nome + |= =ship + ^- tape + =+ raw=(cite:title ship) + (runt [(sub 14 (lent raw)) ' '] raw) + :: +line: renders most important contents, tries to fit one line + :: + ::TODO this should probably be rewritten someday + ++ line + :: pre: replace/append line prefix + :: + =| pre=(unit (pair ? tape)) + |= wyd=@ud + ^- (list tape) + ?- -.letter + %code + =+ texp=(trip expression.letter) + =+ newline=(find "\0a" texp) + =? texp ?=(^ newline) + (weld (scag u.newline texp) " ...") + :- (truncate wyd '#' ' ' texp) + ?~ output.letter ~ + =- [' ' (truncate (dec wyd) ' ' -)]~ + ~(ram re (snag 0 `(list tank)`output.letter)) + :: + %url + :_ ~ + =+ ful=(trip url.letter) + =+ pef=q:(fall pre [p=| q=""]) + :: clean up prefix if needed. + =? pef =((scag 1 (flop pef)) " ") + (scag (dec (lent pef)) pef) + =. pef (weld "/" pef) + =. wyd (sub wyd +((lent pef))) :: account for prefix. + :: if the full url fits, just render it. + ?: (gte wyd (lent ful)) :(weld pef " " ful) + :: if it doesn't, prefix with _ and render just (the tail of) the domain. + %+ weld (weld pef "_") + =+ prl=(rust ful aurf:de-purl:html) + ?~ prl (weld (scag (dec wyd) ful) "…") + =+ hok=r.p.p.u.prl + =- (swag [a=(sub (max wyd (lent -)) wyd) b=wyd] -) + ^- tape + =< ?: ?=(%& -.hok) + (reel p.hok .) + +:(scow %if p.hok) + |= [a=knot b=tape] + ?~ b (trip a) + (welp b '.' (trip a)) + :: + ?(%text %me) + :: glyph prefix + =/ pef=tape + ?: &(?=(^ pre) p.u.pre) q.u.pre + ?: ?=(%me -.letter) " " + =- (weld - q:(fall pre [p=| q=" "])) + ~(glyph tr source) + =/ lis=(list tape) + %+ simple-wrap + `tape``(list @)`(tuba (trip +.letter)) + (sub wyd (min (div wyd 2) (lent pef))) + =+ lef=(lent pef) + =+ ?:((gth (lent lis) 0) (snag 0 lis) "") + :- (weld pef -) + %+ turn (slag 1 lis) + |=(a=tape (runt [lef ' '] a)) + == + :: +truncate: truncate txt to fit len, indicating truncation with _ or … + :: + ++ truncate + |= [len=@u txt=tape] + ^- tape + ?: (gth len (lent txt)) txt + =. txt (scag len txt) + |- + ?~ txt txt + ?: =(' ' i.txt) + |- + :- '_' + ?. ?=([%' ' *] t.txt) + t.txt + $(txt t.txt) + ?~ t.txt "…" + [i.txt $(txt t.txt)] + -- +:: +++ simple-wrap + |= [txt=tape wid=@ud] + ^- (list tape) + ?~ txt ~ + =+ ^- [end=@ud nex=?] + ?: (lte (lent txt) wid) [(lent txt) &] + =+ ace=(find " " (flop (scag +(wid) `tape`txt))) + ?~ ace [wid |] + [(sub wid u.ace) &] + :- (tufa (scag end `(list @)`txt)) + $(txt (slag ?:(nex +(end) end) `tape`txt)) +-- diff --git a/pkg/arvo/app/chat-hook.hoon b/pkg/arvo/app/chat-hook.hoon new file mode 100644 index 000000000..1665b5d0a --- /dev/null +++ b/pkg/arvo/app/chat-hook.hoon @@ -0,0 +1,354 @@ +:: chat-hook: +:: mirror chat data from foreign to local based on read permissions +:: allow sending chat messages to foreign paths based on write perms +:: +/- *permission-store, *chat-hook +/+ *chat-json +|% ++$ move [bone card] +:: ++$ card + $% [%diff [%chat-update chat-update]] + [%quit ~] + [%poke wire dock poke] + [%pull wire dock ~] + [%peer wire dock path] + == +:: ++$ state + $% [%0 state-zero] + == +:: ++$ state-zero + $: synced=(map path ship) + boned=(map wire (list bone)) + == +:: ++$ poke + $% [%chat-action chat-action] + [%permission-action permission-action] + == +:: +-- +:: +|_ [bol=bowl:gall state] +:: +++ this . +:: +++ prep + |= old=(unit state) + ^- (quip move _this) + ?~ old + :_ this + [ost.bol %peer /permissions [our.bol %permission-store] /updates]~ + [~ this(+<+ u.old)] +:: +++ poke-json + |= jon=json + ^- (quip move _this) + (poke-chat-action (json-to-action jon)) +:: +++ poke-chat-action + |= act=chat-action + ^- (quip move _this) + ?> ?=(%message -.act) + :: local + :_ this + ?: (team:title our.bol src.bol) + ?. (~(has by synced) path.act) + ~ + =/ ship (~(got by synced) path.act) + =/ appl ?:(=(ship our.bol) %chat-store %chat-hook) + [ost.bol %poke / [ship appl] [%chat-action act]]~ + :: foreign + =/ ship (~(get by synced) path.act) + ?~ ship + ~ + ?. =(u.ship our.bol) + ~ + :: scry permissions to check if write is permitted + ?. (permitted-scry [(scot %p src.bol) %chat (weld path.act /write)]) + ~ + =: author.envelope.act src.bol + when.envelope.act now.bol + == + [ost.bol %poke / [our.bol %chat-store] [%chat-action act]]~ +:: +++ poke-chat-hook-action + |= act=chat-hook-action + ^- (quip move _this) + ?- -.act + %add-owned + ?> (team:title our.bol src.bol) + =/ chat-path [%mailbox path.act] + ?: (~(has by synced) path.act) + [~ this] + =. synced (~(put by synced) path.act our.bol) + :_ (track-bone chat-path) + %+ weld + [ost.bol %peer chat-path [our.bol %chat-store] chat-path]~ + (create-permission [%chat path.act] security.act) + :: + %add-synced + ?> (team:title our.bol src.bol) + =/ chat-path [%mailbox (scot %p ship.act) path.act] + ?: (~(has by synced) [(scot %p ship.act) path.act]) + [~ this] + =. synced (~(put by synced) [(scot %p ship.act) path.act] ship.act) + :_ (track-bone chat-path) + [ost.bol %peer chat-path [ship.act %chat-hook] chat-path]~ + :: + %remove + =/ ship (~(get by synced) path.act) + ?~ ship + [~ this] + ?: &(=(u.ship our.bol) (team:title our.bol src.bol)) + :: delete one of our.bol own paths + :_ %_ this + synced (~(del by synced) path.act) + boned (~(del by boned) [%mailbox path.act]) + == + %- zing + :~ (pull-wire [%mailbox path.act]) + (delete-permission [%chat path.act]) + ^- (list move) + %+ turn (prey:pubsub:userlib [%mailbox path.act] bol) + |= [=bone *] + [bone %quit ~] + == + ?. |(=(u.ship src.bol) (team:title our.bol src.bol)) + :: if neither ship = source or source = us, do nothing + [~ this] + :: delete a foreign ship's path + :- (pull-wire [%mailbox path.act]) + %_ this + synced (~(del by synced) path.act) + boned (~(del by boned) [%mailbox path.act]) + == + == +:: +++ peer-mailbox + |= pax=path + ^- (quip move _this) + ?> ?=([* ^] pax) + ?> (~(has by synced) pax) + :: scry permissions to check if read is permitted + ?> (permitted-scry [(scot %p src.bol) %chat (weld pax /read)]) + =/ box (chat-scry pax) + ?~ box !! + :_ this + [ost.bol %diff %chat-update [%create (slav %p i.pax) pax]]~ +:: +++ diff-permission-update + |= [wir=wire diff=permission-update] + ^- (quip move _this) + :_ this + ?- -.diff + %create ~ + %delete ~ + %add (handle-permissions [%add path.diff who.diff]) + %remove (handle-permissions [%remove path.diff who.diff]) + == +:: +++ handle-permissions + |= [kind=?(%add %remove) pax=path who=(set ship)] + ^- (list move) + ?> ?=([* *] pax) + ?. =(%chat i.pax) ~ + :: check path to see if this is a %read permission + ?. =(%read (snag (dec (lent pax)) `(list @t)`pax)) + ~ + =/ sup + %- ~(gas by *(map [ship path] bone)) + %+ turn ~(tap by sup.bol) + |=([=bone anchor=[ship path]] [anchor bone]) + %- zing + %+ turn ~(tap in who) + |= check-ship=ship + ?: (permitted-scry [(scot %p check-ship) pax]) + ~ + :: if ship is not permitted, quit their subscription + =/ mail-path + (oust [(dec (lent t.pax)) (lent t.pax)] `(list @t)`t.pax) + =/ bne (~(get by sup) [check-ship [%mailbox mail-path]]) + ?~(bne ~ [u.bne %quit ~]~) +:: +++ diff-chat-update + |= [wir=wire diff=chat-update] + ^- (quip move _this) + ?: (team:title our.bol src.bol) + (handle-local diff) + (handle-foreign diff) +:: +++ handle-local + |= diff=chat-update + ^- (quip move _this) + ?- -.diff + %keys [~ this] + %config [~ this] + %create [~ this] + %read [~ this] + %delete + ?. (~(has by synced) path.diff) + [~ this] + :_ this(synced (~(del by synced) path.diff)) + [ost.bol %pull [%mailbox path.diff] [our.bol %chat-store] ~]~ + :: + %message + :_ this + %+ turn (prey:pubsub:userlib [%mailbox path.diff] bol) + |= [=bone *] + ^- move + [bone %diff [%chat-update diff]] + == +:: +++ handle-foreign + |= diff=chat-update + ^- (quip move _this) + ?- -.diff + %keys [~ this] + %config [~ this] + %read [~ this] + %create + :_ this + ?> ?=([* ^] path.diff) + =/ shp (~(get by synced) path.diff) + ?~ shp ~ + ?. =(src.bol u.shp) ~ + [(chat-poke [%create ship.diff t.path.diff])]~ + :: + %delete + ?> ?=([* ^] path.diff) + =/ shp (~(get by synced) path.diff) + ?~ shp + [~ this] + ?. =(u.shp src.bol) + [~ this] + :_ this(synced (~(del by synced) path.diff)) + :- (chat-poke diff) + [ost.bol %pull [%mailbox path.diff] [src.bol %chat-hook] ~]~ + :: + %message + :_ this + ?> ?=([* ^] path.diff) + =/ shp (~(get by synced) path.diff) + ?~ shp ~ + ?. =(src.bol u.shp) ~ + [(chat-poke diff)]~ + == +:: +++ quit + |= wir=wire + ^- (quip move _this) + ~& chat-hook-quit+wir + ?: =(wir /permissions) + :_ this + [ost.bol %peer /permissions [our.bol %permission-store] /updates]~ + ?> ?=([* ^] wir) + ?. (~(has by synced) t.wir) + :: no-op + [~ this] + ~& %chat-hook-resubscribe + :_ (track-bone wir) + [ost.bol %peer wir [(slav %p i.t.wir) %chat-hook] wir]~ +:: +++ reap + |= [wir=wire saw=(unit tang)] + ^- (quip move _this) + ?~ saw + [~ this] + ?> ?=(^ wir) + :_ this(synced (~(del by synced) t.wir)) + %. ~ + %- slog + :* leaf+"chat-hook failed subscribe on {(spud t.wir)}" + leaf+"stack trace:" + u.saw + == +:: +++ chat-poke + |= act=chat-action + ^- move + [ost.bol %poke / [our.bol %chat-store] [%chat-action act]] +:: +++ permission-poke + |= act=permission-action + ^- move + [ost.bol %poke / [our.bol %permission-store] [%permission-action act]] +:: +++ create-permission + |= [pax=path sec=chat-security] + ^- (list move) + =/ read-perm (weld pax /read) + =/ write-perm (weld pax /write) + ?- sec + %channel + :~ (permission-poke (sec-to-perm read-perm %black)) + (permission-poke (sec-to-perm write-perm %black)) + == + :: + %village + :~ (permission-poke (sec-to-perm read-perm %white)) + (permission-poke (sec-to-perm write-perm %white)) + == + :: + %journal + :~ (permission-poke (sec-to-perm read-perm %black)) + (permission-poke (sec-to-perm write-perm %white)) + == + :: + %mailbox + :~ (permission-poke (sec-to-perm read-perm %white)) + (permission-poke (sec-to-perm write-perm %black)) + == + == +:: +++ delete-permission + |= pax=path + ^- (list move) + =/ read-perm (weld pax /read) + =/ write-perm (weld pax /write) + :~ (permission-poke [%delete read-perm]) + (permission-poke [%delete write-perm]) + == +:: +++ sec-to-perm + |= [pax=path =kind] + ^- permission-action + [%create pax kind *(set ship)] +:: +++ chat-scry + |= pax=path + ^- (unit mailbox) + =. pax ;:(weld /=chat-store/(scot %da now.bol)/mailbox pax /noun) + .^((unit mailbox) %gx pax) +:: +++ permitted-scry + |= pax=path + ^- ? + .^(? %gx ;:(weld /=permission-store/(scot %da now.bol)/permitted pax /noun)) +:: +++ track-bone + |= wir=wire + ^+ this + =/ bnd (~(get by boned) wir) + ?^ bnd + this(boned (~(put by boned) wir (snoc u.bnd ost.bol))) + this(boned (~(put by boned) wir [ost.bol]~)) +:: +++ pull-wire + |= pax=path + ^- (list move) + ?> ?=(^ pax) + =/ bnd (~(get by boned) pax) + ?~ bnd ~ + =/ shp (~(get by synced) t.pax) + ?~ shp ~ + %+ turn u.bnd + |= =bone + ^- move + ?: =(u.shp our.bol) + [bone %pull pax [our.bol %chat-store] ~] + [bone %pull pax [u.shp %chat-hook] ~] +:: +-- diff --git a/pkg/arvo/app/chat-store.hoon b/pkg/arvo/app/chat-store.hoon new file mode 100644 index 000000000..12d807b60 --- /dev/null +++ b/pkg/arvo/app/chat-store.hoon @@ -0,0 +1,237 @@ +:: chat-store: data store that holds linear sequences of chat messages +:: +/+ *chat-json, *chat-eval +|% ++$ move [bone card] +:: ++$ card + $% [%diff diff] + [%quit ~] + == +:: ++$ state + $% [%0 state-zero] + == +:: ++$ state-zero + $: =inbox + == +:: ++$ diff + $% [%chat-initial inbox] + [%chat-configs chat-configs] + [%chat-update chat-update] + == +-- +:: +|_ [bol=bowl:gall state] +:: +++ this . +:: +++ prep + |= old=(unit state) + ^- (quip move _this) + [~ ?~(old this this(+<+ u.old))] +:: +++ peek-x-all + |= pax=path + ^- (unit (unit [%noun (map path mailbox)])) + [~ ~ %noun inbox] +:: +++ peek-x-configs + |= pax=path + ^- (unit (unit [%noun chat-configs])) + :^ ~ ~ %noun + (inbox-to-configs inbox) +:: +++ peek-x-keys + |= pax=path + ^- (unit (unit [%noun (set path)])) + [~ ~ %noun ~(key by inbox)] +:: +++ peek-x-mailbox + |= pax=path + ^- (unit (unit [%noun (unit mailbox)])) + ?~ pax ~ + =/ mailbox=(unit mailbox) (~(get by inbox) pax) + [~ ~ %noun mailbox] +:: +++ peek-x-config + |= pax=path + ^- (unit (unit [%noun config])) + ?~ pax ~ + =/ mailbox (~(get by inbox) pax) + ?~ mailbox ~ + :^ ~ ~ %noun + config.u.mailbox +:: +++ peek-x-envelopes + |= pax=path + ^- (unit (unit [%noun (list envelope)])) + ?+ pax ~ + [@ @ *] + =/ mail-path t.t.pax + =/ mailbox (~(get by inbox) mail-path) + ?~ mailbox + [~ ~ %noun ~] + =* envelopes envelopes.u.mailbox + =/ sign-test=[?(%neg %pos) @] + %- need + %+ rush i.pax + ;~ pose + %+ cook + |= n=@ + [%neg n] + ;~(pfix hep dem:ag) + :: + %+ cook + |= n=@ + [%pos n] + dem:ag + == + =* length length.config.u.mailbox + =* start +.sign-test + ?: =(-.sign-test %neg) + ?: (gth start length) + [~ ~ %noun envelopes] + [~ ~ %noun (swag [(sub length start) start] envelopes)] + :: + =/ end (slav %ud i.t.pax) + ?. (lte start end) + ~ + =. end ?:((lth end length) end length) + [~ ~ %noun (swag [start (sub end start)] envelopes)] + == +:: +++ peer-keys + |= pax=path + ^- (quip move _this) + ?> (team:title our.bol src.bol) + :: we send the list of keys then send events when they change + :_ this + [ost.bol %diff %chat-update [%keys ~(key by inbox)]]~ +:: +++ peer-all + |= pax=path + ^- (quip move _this) + ?> (team:title our.bol src.bol) + :_ this + [ost.bol %diff %chat-initial inbox]~ +:: +++ peer-configs + |= pax=path + ^- (quip move _this) + ?> (team:title our.bol src.bol) + :_ this + [ost.bol %diff %chat-configs (inbox-to-configs inbox)]~ +:: +++ peer-updates + |= pax=path + ^- (quip move _this) + ?> (team:title our.bol src.bol) + :: we now proxy all events to this path + [~ this] +:: +++ peer-mailbox + |= pax=path + ^- (quip move _this) + ?> (team:title our.bol src.bol) + ?> (~(has by inbox) pax) + =^ =ship pax + ?> ?=([* ^] pax) + [(slav %p i.pax) t.pax] + :_ this + [ost.bol %diff %chat-update [%create ship pax]]~ +:: +++ poke-json + |= jon=json + ^- (quip move _this) + ?> (team:title our.bol src.bol) + (poke-chat-action (json-to-action jon)) +:: +++ poke-chat-action + |= action=chat-action + ^- (quip move _this) + ?> (team:title our.bol src.bol) + ?- -.action + %create (handle-create action) + %delete (handle-delete action) + %message (handle-message action) + %read (handle-read action) + == +:: +++ handle-create + |= act=chat-action + ^- (quip move _this) + ?> ?=(%create -.act) + =/ pax [(scot %p ship.act) path.act] + ?: (~(has by inbox) pax) + [~ this] + :- (send-diff pax act) + this(inbox (~(put by inbox) pax *mailbox)) +:: +++ handle-delete + |= act=chat-action + ^- (quip move _this) + ?> ?=(%delete -.act) + =/ mailbox=(unit mailbox) (~(get by inbox) path.act) + ?~ mailbox + [~ this] + :- (send-diff path.act act) + this(inbox (~(del by inbox) path.act)) +:: +++ handle-message + |= act=chat-action + ^- (quip move _this) + ?> ?=(%message -.act) + =/ mailbox=(unit mailbox) (~(get by inbox) path.act) + ?~ mailbox + [~ this] + =* letter letter.envelope.act + =? letter &(?=(%code -.letter) ?=(~ output.letter)) + =/ =hoon (ream expression.letter) + letter(output (eval bol hoon)) + =: length.config.u.mailbox +(length.config.u.mailbox) + number.envelope.act length.config.u.mailbox + envelopes.u.mailbox (snoc envelopes.u.mailbox envelope.act) + inbox (~(put by inbox) path.act u.mailbox) + == + :_ this(inbox inbox) + (send-diff path.act act) +:: +++ handle-read + |= act=chat-action + ^- (quip move _this) + ?> ?=(%read -.act) + =/ mailbox=(unit mailbox) (~(get by inbox) path.act) + ?~ mailbox + [~ this] + =: read.config.u.mailbox length.config.u.mailbox + inbox (~(put by inbox) path.act u.mailbox) + == + :_ this(inbox inbox) + (send-diff path.act act) +:: +++ update-subscribers + |= [pax=path act=chat-action] + ^- (list move) + %+ turn (prey:pubsub:userlib pax bol) + |= [=bone *] + [bone %diff %chat-update act] +:: +++ send-diff + |= [pax=path act=chat-action] + ^- (list move) + %- zing + :~ (update-subscribers /all act) + (update-subscribers /updates act) + (update-subscribers [%mailbox pax] act) + ?. |(=(%read -.act) =(%message -.act)) + ~ + (update-subscribers /configs act) + ?. |(=(%create -.act) =(%delete -.act)) + ~ + (update-subscribers /keys act) + == +:: +-- diff --git a/pkg/arvo/app/chat-view.hoon b/pkg/arvo/app/chat-view.hoon new file mode 100644 index 000000000..fcafbb48b --- /dev/null +++ b/pkg/arvo/app/chat-view.hoon @@ -0,0 +1,344 @@ +:: chat-view: sets up chat JS client, paginates data, and combines commands +:: into semantic actions for the UI +:: +/- *permission-store, + *permission-hook, + *group-store, + *permission-group-hook, + *chat-hook +/+ *server, *chat-json +/= index + /^ octs + /; as-octs:mimes:html + /: /===/app/chat/index + /| /html/ + /~ ~ + == +/= tile-js + /^ octs + /; as-octs:mimes:html + /: /===/app/chat/js/tile + /| /js/ + /~ ~ + == +/= script + /^ octs + /; as-octs:mimes:html + /: /===/app/chat/js/index + /| /js/ + /~ ~ + == +/= style + /^ octs + /; as-octs:mimes:html + /: /===/app/chat/css/index + /| /css/ + /~ ~ + == +/= chat-png + /^ (map knot @) + /: /===/app/chat/img /_ /png/ +:: +|% +:: ++$ move [bone card] +:: ++$ card + $% [%http-response =http-event:http] + [%connect wire binding:eyre term] + [%peer wire dock path] + [%poke wire dock poke] + [%diff %json json] + [%quit ~] + == +:: ++$ poke + $% [%launch-action [@tas path @t]] + [%chat-action chat-action] + [%group-action group-action] + [%chat-hook-action chat-hook-action] + [%permission-hook-action permission-hook-action] + [%permission-group-hook-action permission-group-hook-action] + == +-- +:: +|_ [bol=bowl:gall ?] +:: +++ this . +:: +++ prep + |= old=(unit ?) + ^- (quip move _this) + ?~ old + :_ this + :~ [ost.bol %peer / [our.bol %chat-store] /updates] + [ost.bol %connect / [~ /'~chat'] %chat-view] + (launch-poke [/configs '/~chat/js/tile.js']) + == + [~ this(+<+ u.old)] +:: +++ bound + |= [wir=wire success=? binding=binding:eyre] + ^- (quip move _this) + [~ this] +:: +++ poke-handle-http-request + %- (require-authorization:app ost.bol move this) + |= =inbound-request:eyre + ^- (quip move _this) + :: + =+ url=(parse-request-line url.request.inbound-request) + =/ name=@t + =+ back-path=(flop site.url) + ?~ back-path + '' + i.back-path + ?: =(name 'tile') + [[ost.bol %http-response (js-response:app tile-js)]~ this] + ?+ site.url + :_ this + [ost.bol %http-response not-found:app]~ + :: + :: styling + :: + [%'~chat' %css %index ~] + :_ this + [ost.bol %http-response (css-response:app style)]~ + :: + :: javascript + :: + [%'~chat' %js %index ~] + :_ this + [ost.bol %http-response (js-response:app script)]~ + :: + :: images + :: + [%'~chat' %img *] + =/ img (as-octs:mimes:html (~(got by chat-png) `@ta`name)) + :_ this + [ost.bol %http-response (png-response:app img)]~ + :: + [%'~chat' %paginate @t @t *] + =/ start (need (rush i.t.t.site.url dem)) + =/ end (need (rush i.t.t.t.site.url dem)) + =/ pax t.t.t.t.site.url + =/ envelopes (envelope-scry [(scot %ud start) (scot %ud end) pax]) + :_ this + :~ + :+ ost.bol + %http-response + %- json-response:app + %- json-to-octs + %+ envelopes-update + envelopes + [start end pax] + == + :: + :: inbox page + :: + [%'~chat' *] + :_ this + [ost.bol %http-response (html-response:app index)]~ + == +:: +++ poke-json + |= jon=json + ^- (quip move _this) + ?. =(src.bol our.bol) + [~ this] + (poke-chat-view-action (json-to-view-action jon)) +:: +++ poke-chat-view-action + |= act=chat-view-action + ^- (quip move _this) + ?. =(src.bol our.bol) + [~ this] + ?- -.act + %create + :: TODO: add invites + =/ pax [(scot %p our.bol) path.act] + =/ group-read=path [%chat (weld pax /read)] + =/ group-write=path [%chat (weld pax /write)] + :_ this + %- zing + :~ :~ (group-poke [%bundle group-read]) + (group-poke [%bundle group-write]) + (group-poke [%add read.act group-read]) + (group-poke [%add write.act group-write]) + (chat-poke [%create our.bol path.act]) + (chat-hook-poke [%add-owned pax security.act]) + == + (create-security [%chat pax] security.act) + :~ (permission-hook-poke [%add-owned group-read group-read]) + (permission-hook-poke [%add-owned group-write group-read]) + == + == + :: + %delete + =/ group-read [%chat (weld path.act /read)] + =/ group-write [%chat (weld path.act /write)] + :_ this + :~ (chat-hook-poke [%remove path.act]) + (permission-hook-poke [%remove group-read]) + (permission-hook-poke [%remove group-write]) + (group-poke [%unbundle group-read]) + (group-poke [%unbundle group-write]) + (chat-poke [%delete path.act]) + == + :: + %join + =/ group-read [%chat (scot %p ship.act) (weld path.act /read)] + =/ group-write [%chat (scot %p ship.act) (weld path.act /write)] + :_ this + :~ (chat-hook-poke [%add-synced ship.act path.act]) + (permission-hook-poke [%add-synced ship.act group-write]) + (permission-hook-poke [%add-synced ship.act group-read]) + == + :: + == +:: +++ peer-primary + |= pax=path + ^- (quip move _this) + ?> (team:title our.bol src.bol) + :: create inbox with 100 messages max per mailbox and send that along + :: then quit the subscription + :_ this + [ost.bol %diff %json (inbox-to-json (truncate-inbox all-scry))]~ +:: +++ peer-configs + |= pax=path + ^- (quip move _this) + ?> (team:title our.bol src.bol) + :_ this + [ost.bol %diff %json *json]~ +:: +++ diff-chat-update + |= [wir=wire upd=chat-update] + ^- (quip move _this) + =/ updates-json (update-to-json upd) + =/ configs-json (configs-to-json configs-scry) + :_ this + %+ weld + %+ turn (prey:pubsub:userlib /primary bol) + |= [=bone *] + [bone %diff %json updates-json] + %+ turn (prey:pubsub:userlib /configs bol) + |= [=bone *] + [bone %diff %json configs-json] +:: +++ quit + |= wir=wire + ^- (quip move _this) + :_ this + [ost.bol %peer / [our.bol %chat-store] /updates]~ +:: +:: +utilities +:: +++ launch-poke + |= [=path =cord] + ^- move + [ost.bol %poke / [our.bol %launch] [%launch-action %chat-view path cord]] +:: +++ chat-poke + |= act=chat-action + ^- move + [ost.bol %poke / [our.bol %chat-store] [%chat-action act]] +:: +++ group-poke + |= act=group-action + ^- move + [ost.bol %poke / [our.bol %group-store] [%group-action act]] +:: +++ chat-hook-poke + |= act=chat-hook-action + ^- move + [ost.bol %poke / [our.bol %chat-hook] [%chat-hook-action act]] +:: +++ permission-hook-poke + |= act=permission-hook-action + ^- move + [ost.bol %poke / [our.bol %permission-hook] [%permission-hook-action act]] +:: +++ perm-group-hook-poke + |= act=permission-group-hook-action + ^- move + =/ pok [%permission-group-hook-action act] + [ost.bol %poke / [our.bol %permission-group-hook] pok] +:: +++ envelope-scry + |= pax=path + ^- (list envelope) + =. pax ;:(weld /=chat-store/(scot %da now.bol)/envelopes pax /noun) + .^((list envelope) %gx pax) +:: +++ all-scry + ^- inbox + .^(inbox %gx /=chat-store/(scot %da now.bol)/all/noun) +:: +++ configs-scry + ^- chat-configs + .^(chat-configs %gx /=chat-store/(scot %da now.bol)/configs/noun) +:: +++ create-security + |= [pax=path sec=chat-security] + ^- (list move) + =/ read (weld pax /read) + =/ write (weld pax /write) + ?- sec + %channel + :~ (perm-group-hook-poke [%associate read [[read %black] ~ ~]]) + (perm-group-hook-poke [%associate write [[write %black] ~ ~]]) + == + :: + %village + :~ (perm-group-hook-poke [%associate read [[read %white] ~ ~]]) + (perm-group-hook-poke [%associate write [[write %white] ~ ~]]) + == + :: + %journal + :~ (perm-group-hook-poke [%associate read [[read %black] ~ ~]]) + (perm-group-hook-poke [%associate write [[write %white] ~ ~]]) + == + :: + %mailbox + :~ (perm-group-hook-poke [%associate read [[read %white] ~ ~]]) + (perm-group-hook-poke [%associate write [[write %black] ~ ~]]) + == + :: + == +:: +++ envelopes-update + |= [envelopes=(list envelope) start=@ud end=@ud pax=path] + ^- json + =, enjs:format + %+ frond %chat-update + %- pairs + :~ + :- %messages + %- pairs + :~ [%path (path pax)] + [%start (numb start)] + [%end (numb end)] + [%envelopes [%a (turn envelopes enve)]] + == + == +:: +++ truncate-envelopes + |= envelopes=(list envelope) + ^- (list envelope) + =/ length (lent envelopes) + ?: (lth length 100) + envelopes + (swag [(sub length 100) 100] envelopes) +:: +++ truncate-inbox + |= box=inbox + ^- inbox + %- ~(run by box) + |= mail=mailbox + ^- mailbox + :- config.mail + (truncate-envelopes envelopes.mail) +:: +-- diff --git a/pkg/arvo/app/chat.hoon b/pkg/arvo/app/chat.hoon deleted file mode 100644 index 37ce00a80..000000000 --- a/pkg/arvo/app/chat.hoon +++ /dev/null @@ -1,614 +0,0 @@ -/- hall -/+ *server, chat, hall-json -/= index - /^ octs - /; as-octs:mimes:html - /: /===/app/chat/index - /| /html/ - /~ ~ - == -/= tile-js - /^ octs - /; as-octs:mimes:html - /: /===/app/chat/js/tile - /| /js/ - /~ ~ - == -/= script - /^ octs - /; as-octs:mimes:html - /: /===/app/chat/js/index - /| /js/ - /~ ~ - == -/= style - /^ octs - /; as-octs:mimes:html - /: /===/app/chat/css/index - /| /css/ - /~ ~ - == -/= chat-png - /^ (map knot @) - /: /===/app/chat/img /_ /png/ -:: -=, chat -:: -|% -+$ state - $% [%0 str=streams] - == -:: -+$ move [bone card] -:: -+$ card - $% [%http-response =http-event:http] - [%connect wire binding:eyre term] - [%peer wire dock path] - [%quit ~] - [%poke wire dock poke] - [%peer wire dock path] - [%pull wire dock ~] - [%diff diff] - == --- -:: -|_ [bol=bowl:gall state] -:: -++ this . -:: -:: +prep: set up the app, migrate the state -:: -++ prep - |= old=(unit state) - ^- (quip move _this) - ?^ old - :_ this(+<+ u.old) - [(launch-poke [/chattile '/~chat/js/tile.js'])]~ - :: - =/ inbox-path /circle/inbox/config/group - :: - :_ this - :* [ost.bol %connect / [~ /'~chat'] %chat] - (launch-poke [/chattile '/~chat/js/tile.js']) - (hall-peer /circle/(scot %p our.bol)/inbox/config/group inbox-path) - (hall-peer /circles/(scot %p our.bol) /circles/(scot %p our.bol)) - (hall-source [our.bol %i]) - ?: =((clan:title our.bol) %czar) - ~ - ?: =(our.bol ~marzod) - :- (hall-create %announcements 'Announcements from Tlon' %journal) - [(hall-source [~marzod %announcements])]~ - ?: =(our.bol ~dopzod) - :- (hall-create %urbit-dev 'Chat about developing on Urbit' %channel) - [(hall-create %urbit-help 'Help about Urbit' %channel)]~ - :~ (hall-create %hall-internal-announcements '' %village) - (hall-source [our.bol %hall-internal-announcements]) - (hall-source [~marzod %announcements]) - == - == -:: -:: +peer-chattile: subscribe to data necessary for chat tile -:: -++ peer-chattile - |= wir=wire - ^- (quip move _this) - :_ this - [ost.bol %diff %json (construct-tile-json str)]~ -:: -:: +peer-messages: subscribe to subset of messages and updates -:: -++ peer-primary - |= wir=wire - ^- (quip move _this) - =* messages messages.str - :_ this - :- [ost.bol %diff %chat-config str] - %+ murn ~(tap by messages) - |= [cir=circle:hall envelopes=(list envelope:hall)] - ^- (unit move) - =/ length=@ (lent envelopes) - =/ start=@ - ?: (gte length 100) - (sub length 100) - 0 - =/ end=@ length - =/ offset=@ (sub end start) - :- ~ - :* ost.bol - %diff - %chat-update - [%messages cir start end (swag [start offset] envelopes)] - == -:: -:: +poke-chat: send a list of actions to hall -:: -++ poke-chat-action - |= act=action:chat - ^- (quip move _this) - :_ this - %+ turn lis.act - |= hac=action:hall - ^- move - [ost.bol %poke /p/(scot %da now.bol) [our.bol %hall] [%hall-action hac]] -:: -:: +diff-hall-prize: handle full state initially handed to us by hall -:: -++ diff-hall-prize - |= [wir=wire piz=prize:hall] - ^- (quip move _this) - ?~ wir - (mean [leaf+"invalid wire for diff: {(spud wir)}"]~) - ?+ i.wir - (mean [leaf+"invalid wire for diff: {(spud wir)}"]~) - :: - %circles - ?> ?=(%circles -.piz) - =. str str(circles cis.piz) - :_ this(str str) - (send-chat-update [[%circles cis.piz] str]) - :: - %circle - ?> ?=(%circle -.piz) - ?. =([our.bol &3:wir] [our.bol %inbox]) - :: - :: fill remote configs with message data - :: - =* messages messages.str - =/ circle [`@p`(slav %p &2:wir) &3:wir] - =/ peers=(map circle:hall (set @p)) - %- ~(rep by rem.pes.piz) - |= [[cir=circle:hall grp=group:hall] acc=(map circle:hall (set @p))] - ^+ acc - (~(put by acc) cir (silt (turn ~(tap by grp) head))) - :: - =. str - %= str - messages (~(put by messages) circle nes.piz) - peers - %- ~(uni by peers.str) - (~(put by peers) circle ~(key by loc.pes.piz)) - == - :_ this(str str) - (send-chat-update [[%messages circle 0 (lent messages) nes.piz] str]) - :: - :: fill inbox config and remote configs with prize data - :: - =/ circles=(list circle:hall) (turn ~(tap in src.loc.cos.piz) head) - :: - =/ peers=(map circle:hall (set @p)) - %- ~(rep by rem.pes.piz) - |= [[cir=circle:hall grp=group:hall] acc=(map circle:hall (set @p))] - ^+ acc - (~(put by acc) cir (silt (turn ~(tap by grp) head))) - :: - :- - %+ turn - %~ tap in - %- ~(del in (silt circles)) - [our.bol %inbox] - |= cir=circle:hall - %+ hall-peer - /circle/(scot %p our.bol)/[nom.cir]/config/group - /circle/[nom.cir]/config/group - %= this - inbox.str loc.cos.piz - peers.str (~(put by peers) [our.bol %inbox] ~(key by loc.pes.piz)) - :: - configs.str - %- ~(uni by configs.str) - ^- (map circle:hall (unit config:hall)) - (~(run by rem.cos.piz) some) - :: - messages.str - %- molt - %+ turn circles - |= cir=circle:hall - ^- [circle:hall (list envelope:hall)] - [cir ~] - == - == -:: -:: +diff-hall-rumor: handle updates to hall state -:: -++ diff-hall-rumor - |= [wir=wire rum=rumor:hall] - ^- (quip move _this) - ?~ wir - (mean [leaf+"invalid wire for diff: {(spud wir)}"]~) - ?+ i.wir - (mean [leaf+"invalid wire for diff: {(spud wir)}"]~) - :: - %circles - (handle-rumor-circles rum) - :: - %circle - (handle-rumor-circle wir rum) - :: - == -:: -:: +handle-rumor-circles -:: -++ handle-rumor-circles - |= rum=rumor:hall - ^- (quip move _this) - ?> ?=(%circles -.rum) - =/ cis - ?: add.rum - (~(put in circles.str) cir.rum) - (~(del in circles.str) cir.rum) - =. str - %= str - circles cis - peers - ?: add.rum - (~(put by peers.str) [our.bol cir.rum] ~) - (~(del by peers.str) [our.bol cir.rum]) - == - :_ this(str str) - (send-chat-update [[%circles cis] str]) -:: -++ handle-rumor-circle - |= [wir=wire rum=rumor:hall] - ^- (quip move _this) - ?> ?=(%circle -.rum) - ?+ -.rum.rum - [~ this] - :: - :: %gram: new message - :: - %gram - (handle-rumor-circle-gram wir rum.rum) - :: - :: status: status update - :: - %status - (handle-rumor-circle-status rum.rum) - :: - :: %config: config has changed - :: - %config - ?+ -.dif.rum.rum - [~ this] - :: - :: %full: set all of config without side effects - :: - %full - =* conf cof.dif.rum.rum - =. configs.str (~(put by configs.str) cir.rum.rum `conf) - :_ this(str str) - (send-chat-update [[%config cir.rum.rum conf] str]) - :: - :: %read: the read count of one of our configs has changed - :: - %read - (handle-rumor-circle-config-read rum.rum) - :: - :: %source: the sources of our inbox have changed - :: - %source - (handle-rumor-circle-config-source rum.rum) - :: - :: %remove: remove a circle - :: - %remove - =. str - %= str - configs (~(del by configs.str) cir.rum.rum) - messages (~(del by messages.str) cir.rum.rum) - peers (~(del by peers.str) cir.rum.rum) - == - :_ this(str str) - (send-chat-update [[%delete cir.rum.rum] str]) - :: - == - == -:: -++ handle-rumor-circle-gram - |= [wir=wire sto=rumor-story:hall] - ^- (quip move _this) - ?> ?=(%gram -.sto) - =* messages messages.str - =/ circle [`@p`(slav %p &2:wir) &3:wir] - =/ nes=(unit (list envelope:hall)) - (~(get by messages) circle) - ?~ nes - [~ this] - =. messages.str (~(put by messages) circle (snoc u.nes nev.sto)) - :_ this(str str) - (send-chat-update [[%message circle nev.sto] str]) -:: -++ handle-rumor-circle-status - |= sto=rumor-story:hall - ^- (quip move _this) - ?> ?=(%status -.sto) - =/ upeers=(unit (set @p)) (~(get by peers.str) cir.sto) - ?~ upeers - [~ this] - =/ peers=(set @p) - ?: =(%remove -.dif.sto) - (~(del in u.upeers) who.sto) - (~(put in u.upeers) who.sto) - =. peers.str (~(put by peers.str) cir.sto peers) - :_ this(str str) - (send-chat-update [[%peers cir.sto peers] str]) -:: -++ handle-rumor-circle-config-read - |= sto=rumor-story:hall - ^- (quip move _this) - ?> ?=(%config -.sto) - ?> ?=(%read -.dif.sto) - ?: =(cir.sto [our.bol %inbox]) - :: ignore when cir.sto is inbox - [~ this] - =/ conf=(unit config:hall) (~(got by configs.str) cir.sto) - ?~ conf - [~ this] - =. red.u.conf red.dif.sto - =. configs.str (~(put by configs.str) cir.sto conf) - :_ this(str str) - (send-chat-update [[%config cir.sto u.conf] str]) -:: -:: +handle-rumor-circle-config-source: on source, subscribe and add to inbox -:: on remove source, send delete and remove data from state -:: -++ handle-rumor-circle-config-source - |= sto=rumor-story:hall - ^- (quip move _this) - ?> ?=(%config -.sto) - ?> ?=(%source -.dif.sto) - ?. =(cir.sto [our.bol %inbox]) - :: ignore when cir.sto is not inbox - [~ this] - =* circ cir.src.dif.sto - =/ wir /circle/(scot %p hos.circ)/[nom.circ]/grams/0/config/group - :: we've added a source to our inbox - :: - ?: add.dif.sto - =. str - %_ str - src.inbox (~(put in src.inbox.str) src.dif.sto) - :: - configs - ?: (~(has by configs.str) circ) - configs.str - (~(put by configs.str) circ ~) - == - :: - =/ pax /circle/[nom.circ]/grams/0/config/group - :_ this(str str) - :- [ost.bol %peer wir [hos.circ %hall] pax] - (send-chat-update [[%inbox inbox.str] str]) - :: - =. src.inbox.str (~(del in src.inbox.str) src.dif.sto) - :: we've removed a source from our inbox - :: - =. str - %= str - inbox inbox.str - :: - configs (~(del by configs.str) circ) - messages (~(del by messages.str) circ) - peers (~(del by peers.str) circ) - == - =/ fake=circle:hall - [our.bol (crip (weld (trip 'hall-internal-') (trip nom.circ)))] - :: - :_ this(str str) - ;: weld - ^- (list move) - :: just forward the delete to our clients - :: - ?~ (~(get by configs.str) fake) - [ost.bol %pull wir [hos.circ %hall] ~]~ - :: if we get a delete from another ship, delete our fake circle copy - :: - :- [ost.bol %pull wir [hos.circ %hall] ~] - [ost.bol %poke /f [our.bol %hall] [%hall-action [%delete nom.fake ~]]]~ - :: - (send-chat-update [[%inbox inbox.str] str]) - (send-chat-update [[%delete circ] str]) - == -:: -:: +bound: lient tells us we successfully bound our server to the ~chat url -:: -++ bound - |= [wir=wire success=? binding=binding:eyre] - ^- (quip move _this) - [~ this] -:: -:: +poke-handle-http-request: serve pages from file system based on URl path -:: -++ poke-handle-http-request - %- (require-authorization:app ost.bol move this) - |= =inbound-request:eyre - ^- (quip move _this) - :: - =+ request-line=(parse-request-line url.request.inbound-request) - =/ name=@t - =+ back-path=(flop site.request-line) - ?~ back-path - '' - i.back-path - ?: =(name 'tile') - [[ost.bol %http-response (js-response:app tile-js)]~ this] - ?+ site.request-line - :_ this - [ost.bol %http-response not-found:app]~ - :: - :: styling - :: - [%'~chat' %css %index ~] - :_ this - [ost.bol %http-response (css-response:app style)]~ - :: - :: javascript - :: - [%'~chat' %js %index ~] - :_ this - [ost.bol %http-response (js-response:app script)]~ - :: - :: images - :: - [%'~chat' %img *] - =/ img (as-octs:mimes:html (~(got by chat-png) `@ta`name)) - :_ this - [ost.bol %http-response (png-response:app img)]~ - :: - :: paginated message data - :: - [%'~chat' %scroll @t @t @t @t ~] - =/ cir [(slav %p &3:site.request-line) &4:site.request-line] - =/ start=@ud (need (rush &5:site.request-line dem)) - =/ parsedend=@ud (need (rush &6:site.request-line dem)) - =* messages messages.str - =/ envs=(unit (list envelope:hall)) (~(get by messages) cir) - ?~ envs - [~ this] - ?: (gte start (lent u.envs)) - [~ this] - =/ end=@ - ?: (gte parsedend (lent u.envs)) - (dec (lent u.envs)) - parsedend - =/ offset (sub end start) - =/ jon - %- msg-to-json - :* %messages - cir - start - end - (swag [start offset] u.envs) - == - :_ this - [ost.bol %http-response (json-response:app (json-to-octs jon))]~ - :: - :: - :: inbox page - :: - [%'~chat' *] - :_ this - [ost.bol %http-response (html-response:app index)]~ - == -:: -:: -:: +subscription-retry arms -:: -:: -:: +reap: recieve acknowledgement for peer, retry on failure -:: -++ reap - |= [wir=wire err=(unit tang)] - ^- (quip move _this) - ?~ err - [~ this] - ?~ wir - (mean [leaf+"invalid wire for diff: {(spud wir)}"]~) - ?+ i.wir - (mean [leaf+"invalid wire for diff: {(spud wir)}"]~) - :: - %circle - =/ shp=@p (slav %p &2:wir) - =/ pat /circle/[&3:wir]/config/group - ?: =(&3:wir 'inbox') - :_ this - [ost.bol %peer wir [shp %hall] pat]~ - ?: (~(has in src.inbox.str) [[shp &3:wir] ~]) - :_ this - [ost.bol %peer wir [shp %hall] pat]~ - [~ this] - :: - %circles - :_ this - [ost.bol %peer wir [our.bol %hall] wir]~ - == -:: -:: +quit: subscription failed/quit at some point, retry -:: -++ quit - |= wir=wire - ^- (quip move _this) - ?~ wir - (mean [leaf+"invalid wire for diff: {(spud wir)}"]~) - ?+ i.wir - (mean [leaf+"invalid wire for diff: {(spud wir)}"]~) - :: - %circle - =/ shp=@p (slav %p &2:wir) - =/ pat /circle/[&3:wir]/config/group - ?: =(&3:wir 'inbox') - :_ this - [ost.bol %peer wir [shp %hall] pat]~ - ?: (~(has in src.inbox.str) [[shp &3:wir] ~]) - :_ this - [ost.bol %peer wir [shp %hall] pat]~ - [~ this] - :: - %circles - :_ this - [ost.bol %peer wir [our.bol %hall] wir]~ - == -:: -:: +utilities -:: -:: -:: +send-chat-update: utility func for sending updates to all our subscribers -:: -++ send-chat-update - |= [upd=update str=streams] - ^- (list move) - =/ jon-one (update-to-json upd) - =/ jon-two (construct-tile-json str) - :: - %+ weld - ^- (list move) - %+ turn (prey:pubsub:userlib /primary bol) - |= [=bone *] - [bone %diff %json jon-one] - ^- (list move) - %+ turn (prey:pubsub:userlib /chattile bol) - |= [=bone *] - [bone %diff %json jon-two] -:: -++ construct-tile-json - |= str=streams - ^- json - :- %o - %- my - :~ ['config' (config-to-json str)] - :: - :- 'numbers' - %- numbers-to-json - ^- (list [circle:hall @ud]) - %+ turn ~(tap by messages.str) - |= [cir=circle:hall lis=(list envelope:hall)] - ^- [circle:hall @ud] - ?~ lis - [cir 0] - =/ last (snag (dec (lent lis)) `(list envelope:hall)`lis) - [cir (add num.last 1)] - == -:: -++ launch-poke - |= [=path =cord] - ^- move - [ost.bol %poke /chat [our.bol %launch] [%launch-action %chat path cord]] -:: -++ hall-peer - |= [wir=wire pat=path] - ^- move - [ost.bol %peer wir [our.bol %hall] pat] -:: -++ hall-create - |= [name=@tas description=@t =security:hall] - ^- move - =/ poke [%hall-action [%create name description security]] - [ost.bol %poke /chat [our.bol %hall] poke] -:: -++ hall-source - |= cir=circle:hall - ^- move - =/ poke [%hall-action [%source %inbox %.y (silt [cir ~]~)]] - [ost.bol %poke /chat [our.bol %hall] poke] -:: --- diff --git a/pkg/arvo/app/chat/css/index.css b/pkg/arvo/app/chat/css/index.css index eb0154331..6afdb752c 100644 --- a/pkg/arvo/app/chat/css/index.css +++ b/pkg/arvo/app/chat/css/index.css @@ -1,2 +1,2 @@ /*! TACHYONS v4.11.2 | http://tachyons.io */ -/*! normalize.css v8.0.0 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}[hidden],template{display:none}.border-box,a,article,aside,blockquote,body,code,dd,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,html,input[type=email],input[type=number],input[type=password],input[type=tel],input[type=text],input[type=url],legend,li,main,nav,ol,p,pre,section,table,td,textarea,th,tr,ul{box-sizing:border-box}.aspect-ratio{height:0;position:relative}.aspect-ratio--16x9{padding-bottom:56.25%}.aspect-ratio--9x16{padding-bottom:177.77%}.aspect-ratio--4x3{padding-bottom:75%}.aspect-ratio--3x4{padding-bottom:133.33%}.aspect-ratio--6x4{padding-bottom:66.6%}.aspect-ratio--4x6{padding-bottom:150%}.aspect-ratio--8x5{padding-bottom:62.5%}.aspect-ratio--5x8{padding-bottom:160%}.aspect-ratio--7x5{padding-bottom:71.42%}.aspect-ratio--5x7{padding-bottom:140%}.aspect-ratio--1x1{padding-bottom:100%}.aspect-ratio--object{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;z-index:100}img{max-width:100%}.cover{background-size:cover!important}.contain{background-size:contain!important}.bg-center{background-position:50%}.bg-center,.bg-top{background-repeat:no-repeat}.bg-top{background-position:top}.bg-right{background-position:100%}.bg-bottom,.bg-right{background-repeat:no-repeat}.bg-bottom{background-position:bottom}.bg-left{background-repeat:no-repeat;background-position:0}.outline{outline:1px solid}.outline-transparent{outline:1px solid transparent}.outline-0{outline:0}.ba{border-style:solid;border-width:1px}.bt{border-top-style:solid;border-top-width:1px}.br{border-right-style:solid;border-right-width:1px}.bb{border-bottom-style:solid;border-bottom-width:1px}.bl{border-left-style:solid;border-left-width:1px}.bn{border-style:none;border-width:0}.b--black{border-color:#000}.b--near-black{border-color:#111}.b--dark-gray{border-color:#333}.b--mid-gray{border-color:#555}.b--gray{border-color:#777}.b--silver{border-color:#999}.b--light-silver{border-color:#aaa}.b--moon-gray{border-color:#ccc}.b--light-gray{border-color:#eee}.b--near-white{border-color:#f4f4f4}.b--white{border-color:#fff}.b--white-90{border-color:hsla(0,0%,100%,.9)}.b--white-80{border-color:hsla(0,0%,100%,.8)}.b--white-70{border-color:hsla(0,0%,100%,.7)}.b--white-60{border-color:hsla(0,0%,100%,.6)}.b--white-50{border-color:hsla(0,0%,100%,.5)}.b--white-40{border-color:hsla(0,0%,100%,.4)}.b--white-30{border-color:hsla(0,0%,100%,.3)}.b--white-20{border-color:hsla(0,0%,100%,.2)}.b--white-10{border-color:hsla(0,0%,100%,.1)}.b--white-05{border-color:hsla(0,0%,100%,.05)}.b--white-025{border-color:hsla(0,0%,100%,.025)}.b--white-0125{border-color:hsla(0,0%,100%,.0125)}.b--black-90{border-color:rgba(0,0,0,.9)}.b--black-80{border-color:rgba(0,0,0,.8)}.b--black-70{border-color:rgba(0,0,0,.7)}.b--black-60{border-color:rgba(0,0,0,.6)}.b--black-50{border-color:rgba(0,0,0,.5)}.b--black-40{border-color:rgba(0,0,0,.4)}.b--black-30{border-color:rgba(0,0,0,.3)}.b--black-20{border-color:rgba(0,0,0,.2)}.b--black-10{border-color:rgba(0,0,0,.1)}.b--black-05{border-color:rgba(0,0,0,.05)}.b--black-025{border-color:rgba(0,0,0,.025)}.b--black-0125{border-color:rgba(0,0,0,.0125)}.b--dark-red{border-color:#e7040f}.b--red{border-color:#ff4136}.b--light-red{border-color:#ff725c}.b--orange{border-color:#ff6300}.b--gold{border-color:#ffb700}.b--yellow{border-color:gold}.b--light-yellow{border-color:#fbf1a9}.b--purple{border-color:#5e2ca5}.b--light-purple{border-color:#a463f2}.b--dark-pink{border-color:#d5008f}.b--hot-pink{border-color:#ff41b4}.b--pink{border-color:#ff80cc}.b--light-pink{border-color:#ffa3d7}.b--dark-green{border-color:#137752}.b--green{border-color:#19a974}.b--light-green{border-color:#9eebcf}.b--navy{border-color:#001b44}.b--dark-blue{border-color:#00449e}.b--blue{border-color:#357edd}.b--light-blue{border-color:#96ccff}.b--lightest-blue{border-color:#cdecff}.b--washed-blue{border-color:#f6fffe}.b--washed-green{border-color:#e8fdf5}.b--washed-yellow{border-color:#fffceb}.b--washed-red{border-color:#ffdfdf}.b--transparent{border-color:transparent}.b--inherit{border-color:inherit}.br0{border-radius:0}.br1{border-radius:.125rem}.br2{border-radius:.25rem}.br3{border-radius:.5rem}.br4{border-radius:1rem}.br-100{border-radius:100%}.br-pill{border-radius:9999px}.br--bottom{border-top-left-radius:0;border-top-right-radius:0}.br--top{border-bottom-right-radius:0}.br--right,.br--top{border-bottom-left-radius:0}.br--right{border-top-left-radius:0}.br--left{border-top-right-radius:0;border-bottom-right-radius:0}.b--dotted{border-style:dotted}.b--dashed{border-style:dashed}.b--solid{border-style:solid}.b--none{border-style:none}.bw0{border-width:0}.bw1{border-width:.125rem}.bw2{border-width:.25rem}.bw3{border-width:.5rem}.bw4{border-width:1rem}.bw5{border-width:2rem}.bt-0{border-top-width:0}.br-0{border-right-width:0}.bb-0{border-bottom-width:0}.bl-0{border-left-width:0}.shadow-1{box-shadow:0 0 4px 2px rgba(0,0,0,.2)}.shadow-2{box-shadow:0 0 8px 2px rgba(0,0,0,.2)}.shadow-3{box-shadow:2px 2px 4px 2px rgba(0,0,0,.2)}.shadow-4{box-shadow:2px 2px 8px 0 rgba(0,0,0,.2)}.shadow-5{box-shadow:4px 4px 8px 0 rgba(0,0,0,.2)}.pre{overflow-x:auto;overflow-y:hidden;overflow:scroll}.top-0{top:0}.right-0{right:0}.bottom-0{bottom:0}.left-0{left:0}.top-1{top:1rem}.right-1{right:1rem}.bottom-1{bottom:1rem}.left-1{left:1rem}.top-2{top:2rem}.right-2{right:2rem}.bottom-2{bottom:2rem}.left-2{left:2rem}.top--1{top:-1rem}.right--1{right:-1rem}.bottom--1{bottom:-1rem}.left--1{left:-1rem}.top--2{top:-2rem}.right--2{right:-2rem}.bottom--2{bottom:-2rem}.left--2{left:-2rem}.absolute--fill{top:0;right:0;bottom:0;left:0}.cf:after,.cf:before{content:" ";display:table}.cf:after{clear:both}.cf{*zoom:1}.cl{clear:left}.cr{clear:right}.cb{clear:both}.cn{clear:none}.dn{display:none}.di{display:inline}.db{display:block}.dib{display:inline-block}.dit{display:inline-table}.dt{display:table}.dtc{display:table-cell}.dt-row{display:table-row}.dt-row-group{display:table-row-group}.dt-column{display:table-column}.dt-column-group{display:table-column-group}.dt--fixed{table-layout:fixed;width:100%}.flex{display:flex}.inline-flex{display:inline-flex}.flex-auto{flex:1 1 auto;min-width:0;min-height:0}.flex-none{flex:none}.flex-column{flex-direction:column}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.flex-nowrap{flex-wrap:nowrap}.flex-wrap-reverse{flex-wrap:wrap-reverse}.flex-column-reverse{flex-direction:column-reverse}.flex-row-reverse{flex-direction:row-reverse}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.self-start{align-self:flex-start}.self-end{align-self:flex-end}.self-center{align-self:center}.self-baseline{align-self:baseline}.self-stretch{align-self:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-around{justify-content:space-around}.content-start{align-content:flex-start}.content-end{align-content:flex-end}.content-center{align-content:center}.content-between{align-content:space-between}.content-around{align-content:space-around}.content-stretch{align-content:stretch}.order-0{order:0}.order-1{order:1}.order-2{order:2}.order-3{order:3}.order-4{order:4}.order-5{order:5}.order-6{order:6}.order-7{order:7}.order-8{order:8}.order-last{order:99999}.flex-grow-0{flex-grow:0}.flex-grow-1{flex-grow:1}.flex-shrink-0{flex-shrink:0}.flex-shrink-1{flex-shrink:1}.fl{float:left}.fl,.fr{_display:inline}.fr{float:right}.fn{float:none}.sans-serif{font-family:-apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif}.serif{font-family:georgia,times,serif}.system-sans-serif{font-family:sans-serif}.system-serif{font-family:serif}.code,code{font-family:Consolas,monaco,monospace}.courier{font-family:Courier Next,courier,monospace}.helvetica{font-family:helvetica neue,helvetica,sans-serif}.avenir{font-family:avenir next,avenir,sans-serif}.athelas{font-family:athelas,georgia,serif}.georgia{font-family:georgia,serif}.times{font-family:times,serif}.bodoni{font-family:Bodoni MT,serif}.calisto{font-family:Calisto MT,serif}.garamond{font-family:garamond,serif}.baskerville{font-family:baskerville,serif}.i{font-style:italic}.fs-normal{font-style:normal}.normal{font-weight:400}.b{font-weight:700}.fw1{font-weight:100}.fw2{font-weight:200}.fw3{font-weight:300}.fw4{font-weight:400}.fw5{font-weight:500}.fw6{font-weight:600}.fw7{font-weight:700}.fw8{font-weight:800}.fw9{font-weight:900}.input-reset{-webkit-appearance:none;-moz-appearance:none}.button-reset::-moz-focus-inner,.input-reset::-moz-focus-inner{border:0;padding:0}.h1{height:1rem}.h2{height:2rem}.h3{height:4rem}.h4{height:8rem}.h5{height:16rem}.h-25{height:25%}.h-50{height:50%}.h-75{height:75%}.h-100{height:100%}.min-h-100{min-height:100%}.vh-25{height:25vh}.vh-50{height:50vh}.vh-75{height:75vh}.vh-100{height:100vh}.min-vh-100{min-height:100vh}.h-auto{height:auto}.h-inherit{height:inherit}.tracked{letter-spacing:.1em}.tracked-tight{letter-spacing:-.05em}.tracked-mega{letter-spacing:.25em}.lh-solid{line-height:1}.lh-title{line-height:1.25}.lh-copy{line-height:1.5}.link{text-decoration:none}.link,.link:active,.link:focus,.link:hover,.link:link,.link:visited{transition:color .15s ease-in}.link:focus{outline:1px dotted currentColor}.list{list-style-type:none}.mw-100{max-width:100%}.mw1{max-width:1rem}.mw2{max-width:2rem}.mw3{max-width:4rem}.mw4{max-width:8rem}.mw5{max-width:16rem}.mw6{max-width:32rem}.mw7{max-width:48rem}.mw8{max-width:64rem}.mw9{max-width:96rem}.mw-none{max-width:none}.w1{width:1rem}.w2{width:2rem}.w3{width:4rem}.w4{width:8rem}.w5{width:16rem}.w-10{width:10%}.w-20{width:20%}.w-25{width:25%}.w-30{width:30%}.w-33{width:33%}.w-34{width:34%}.w-40{width:40%}.w-50{width:50%}.w-60{width:60%}.w-70{width:70%}.w-75{width:75%}.w-80{width:80%}.w-90{width:90%}.w-100{width:100%}.w-third{width:33.33333%}.w-two-thirds{width:66.66667%}.w-auto{width:auto}.overflow-visible{overflow:visible}.overflow-hidden{overflow:hidden}.overflow-scroll{overflow:scroll}.overflow-auto{overflow:auto}.overflow-x-visible{overflow-x:visible}.overflow-x-hidden{overflow-x:hidden}.overflow-x-scroll{overflow-x:scroll}.overflow-x-auto{overflow-x:auto}.overflow-y-visible{overflow-y:visible}.overflow-y-hidden{overflow-y:hidden}.overflow-y-scroll{overflow-y:scroll}.overflow-y-auto{overflow-y:auto}.static{position:static}.relative{position:relative}.absolute{position:absolute}.fixed{position:fixed}.o-100{opacity:1}.o-90{opacity:.9}.o-80{opacity:.8}.o-70{opacity:.7}.o-60{opacity:.6}.o-50{opacity:.5}.o-40{opacity:.4}.o-30{opacity:.3}.o-20{opacity:.2}.o-10{opacity:.1}.o-05{opacity:.05}.o-025{opacity:.025}.o-0{opacity:0}.rotate-45{-webkit-transform:rotate(45deg);transform:rotate(45deg)}.rotate-90{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.rotate-135{-webkit-transform:rotate(135deg);transform:rotate(135deg)}.rotate-180{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.rotate-225{-webkit-transform:rotate(225deg);transform:rotate(225deg)}.rotate-270{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.rotate-315{-webkit-transform:rotate(315deg);transform:rotate(315deg)}.black-90{color:rgba(0,0,0,.9)}.black-80{color:rgba(0,0,0,.8)}.black-70{color:rgba(0,0,0,.7)}.black-60{color:rgba(0,0,0,.6)}.black-50{color:rgba(0,0,0,.5)}.black-40{color:rgba(0,0,0,.4)}.black-30{color:rgba(0,0,0,.3)}.black-20{color:rgba(0,0,0,.2)}.black-10{color:rgba(0,0,0,.1)}.black-05{color:rgba(0,0,0,.05)}.white-90{color:hsla(0,0%,100%,.9)}.white-80{color:hsla(0,0%,100%,.8)}.white-70{color:hsla(0,0%,100%,.7)}.white-60{color:hsla(0,0%,100%,.6)}.white-50{color:hsla(0,0%,100%,.5)}.white-40{color:hsla(0,0%,100%,.4)}.white-30{color:hsla(0,0%,100%,.3)}.white-20{color:hsla(0,0%,100%,.2)}.white-10{color:hsla(0,0%,100%,.1)}.black{color:#000}.near-black{color:#111}.dark-gray{color:#333}.mid-gray{color:#555}.gray{color:#777}.silver{color:#999}.light-silver{color:#aaa}.moon-gray{color:#ccc}.light-gray{color:#eee}.near-white{color:#f4f4f4}.white{color:#fff}.dark-red{color:#e7040f}.red{color:#ff4136}.light-red{color:#ff725c}.orange{color:#ff6300}.gold{color:#ffb700}.yellow{color:gold}.light-yellow{color:#fbf1a9}.purple{color:#5e2ca5}.light-purple{color:#a463f2}.dark-pink{color:#d5008f}.hot-pink{color:#ff41b4}.pink{color:#ff80cc}.light-pink{color:#ffa3d7}.dark-green{color:#137752}.green{color:#19a974}.light-green{color:#9eebcf}.navy{color:#001b44}.dark-blue{color:#00449e}.blue{color:#357edd}.light-blue{color:#96ccff}.lightest-blue{color:#cdecff}.washed-blue{color:#f6fffe}.washed-green{color:#e8fdf5}.washed-yellow{color:#fffceb}.washed-red{color:#ffdfdf}.color-inherit{color:inherit}.bg-black-90{background-color:rgba(0,0,0,.9)}.bg-black-80{background-color:rgba(0,0,0,.8)}.bg-black-70{background-color:rgba(0,0,0,.7)}.bg-black-60{background-color:rgba(0,0,0,.6)}.bg-black-50{background-color:rgba(0,0,0,.5)}.bg-black-40{background-color:rgba(0,0,0,.4)}.bg-black-30{background-color:rgba(0,0,0,.3)}.bg-black-20{background-color:rgba(0,0,0,.2)}.bg-black-10{background-color:rgba(0,0,0,.1)}.bg-black-05{background-color:rgba(0,0,0,.05)}.bg-white-90{background-color:hsla(0,0%,100%,.9)}.bg-white-80{background-color:hsla(0,0%,100%,.8)}.bg-white-70{background-color:hsla(0,0%,100%,.7)}.bg-white-60{background-color:hsla(0,0%,100%,.6)}.bg-white-50{background-color:hsla(0,0%,100%,.5)}.bg-white-40{background-color:hsla(0,0%,100%,.4)}.bg-white-30{background-color:hsla(0,0%,100%,.3)}.bg-white-20{background-color:hsla(0,0%,100%,.2)}.bg-white-10{background-color:hsla(0,0%,100%,.1)}.bg-black{background-color:#000}.bg-near-black{background-color:#111}.bg-dark-gray{background-color:#333}.bg-mid-gray{background-color:#555}.bg-gray{background-color:#777}.bg-silver{background-color:#999}.bg-light-silver{background-color:#aaa}.bg-moon-gray{background-color:#ccc}.bg-light-gray{background-color:#eee}.bg-near-white{background-color:#f4f4f4}.bg-white{background-color:#fff}.bg-transparent{background-color:transparent}.bg-dark-red{background-color:#e7040f}.bg-red{background-color:#ff4136}.bg-light-red{background-color:#ff725c}.bg-orange{background-color:#ff6300}.bg-gold{background-color:#ffb700}.bg-yellow{background-color:gold}.bg-light-yellow{background-color:#fbf1a9}.bg-purple{background-color:#5e2ca5}.bg-light-purple{background-color:#a463f2}.bg-dark-pink{background-color:#d5008f}.bg-hot-pink{background-color:#ff41b4}.bg-pink{background-color:#ff80cc}.bg-light-pink{background-color:#ffa3d7}.bg-dark-green{background-color:#137752}.bg-green{background-color:#19a974}.bg-light-green{background-color:#9eebcf}.bg-navy{background-color:#001b44}.bg-dark-blue{background-color:#00449e}.bg-blue{background-color:#357edd}.bg-light-blue{background-color:#96ccff}.bg-lightest-blue{background-color:#cdecff}.bg-washed-blue{background-color:#f6fffe}.bg-washed-green{background-color:#e8fdf5}.bg-washed-yellow{background-color:#fffceb}.bg-washed-red{background-color:#ffdfdf}.bg-inherit{background-color:inherit}.hover-black:focus,.hover-black:hover{color:#000}.hover-near-black:focus,.hover-near-black:hover{color:#111}.hover-dark-gray:focus,.hover-dark-gray:hover{color:#333}.hover-mid-gray:focus,.hover-mid-gray:hover{color:#555}.hover-gray:focus,.hover-gray:hover{color:#777}.hover-silver:focus,.hover-silver:hover{color:#999}.hover-light-silver:focus,.hover-light-silver:hover{color:#aaa}.hover-moon-gray:focus,.hover-moon-gray:hover{color:#ccc}.hover-light-gray:focus,.hover-light-gray:hover{color:#eee}.hover-near-white:focus,.hover-near-white:hover{color:#f4f4f4}.hover-white:focus,.hover-white:hover{color:#fff}.hover-black-90:focus,.hover-black-90:hover{color:rgba(0,0,0,.9)}.hover-black-80:focus,.hover-black-80:hover{color:rgba(0,0,0,.8)}.hover-black-70:focus,.hover-black-70:hover{color:rgba(0,0,0,.7)}.hover-black-60:focus,.hover-black-60:hover{color:rgba(0,0,0,.6)}.hover-black-50:focus,.hover-black-50:hover{color:rgba(0,0,0,.5)}.hover-black-40:focus,.hover-black-40:hover{color:rgba(0,0,0,.4)}.hover-black-30:focus,.hover-black-30:hover{color:rgba(0,0,0,.3)}.hover-black-20:focus,.hover-black-20:hover{color:rgba(0,0,0,.2)}.hover-black-10:focus,.hover-black-10:hover{color:rgba(0,0,0,.1)}.hover-white-90:focus,.hover-white-90:hover{color:hsla(0,0%,100%,.9)}.hover-white-80:focus,.hover-white-80:hover{color:hsla(0,0%,100%,.8)}.hover-white-70:focus,.hover-white-70:hover{color:hsla(0,0%,100%,.7)}.hover-white-60:focus,.hover-white-60:hover{color:hsla(0,0%,100%,.6)}.hover-white-50:focus,.hover-white-50:hover{color:hsla(0,0%,100%,.5)}.hover-white-40:focus,.hover-white-40:hover{color:hsla(0,0%,100%,.4)}.hover-white-30:focus,.hover-white-30:hover{color:hsla(0,0%,100%,.3)}.hover-white-20:focus,.hover-white-20:hover{color:hsla(0,0%,100%,.2)}.hover-white-10:focus,.hover-white-10:hover{color:hsla(0,0%,100%,.1)}.hover-inherit:focus,.hover-inherit:hover{color:inherit}.hover-bg-black:focus,.hover-bg-black:hover{background-color:#000}.hover-bg-near-black:focus,.hover-bg-near-black:hover{background-color:#111}.hover-bg-dark-gray:focus,.hover-bg-dark-gray:hover{background-color:#333}.hover-bg-mid-gray:focus,.hover-bg-mid-gray:hover{background-color:#555}.hover-bg-gray:focus,.hover-bg-gray:hover{background-color:#777}.hover-bg-silver:focus,.hover-bg-silver:hover{background-color:#999}.hover-bg-light-silver:focus,.hover-bg-light-silver:hover{background-color:#aaa}.hover-bg-moon-gray:focus,.hover-bg-moon-gray:hover{background-color:#ccc}.hover-bg-light-gray:focus,.hover-bg-light-gray:hover{background-color:#eee}.hover-bg-near-white:focus,.hover-bg-near-white:hover{background-color:#f4f4f4}.hover-bg-white:focus,.hover-bg-white:hover{background-color:#fff}.hover-bg-transparent:focus,.hover-bg-transparent:hover{background-color:transparent}.hover-bg-black-90:focus,.hover-bg-black-90:hover{background-color:rgba(0,0,0,.9)}.hover-bg-black-80:focus,.hover-bg-black-80:hover{background-color:rgba(0,0,0,.8)}.hover-bg-black-70:focus,.hover-bg-black-70:hover{background-color:rgba(0,0,0,.7)}.hover-bg-black-60:focus,.hover-bg-black-60:hover{background-color:rgba(0,0,0,.6)}.hover-bg-black-50:focus,.hover-bg-black-50:hover{background-color:rgba(0,0,0,.5)}.hover-bg-black-40:focus,.hover-bg-black-40:hover{background-color:rgba(0,0,0,.4)}.hover-bg-black-30:focus,.hover-bg-black-30:hover{background-color:rgba(0,0,0,.3)}.hover-bg-black-20:focus,.hover-bg-black-20:hover{background-color:rgba(0,0,0,.2)}.hover-bg-black-10:focus,.hover-bg-black-10:hover{background-color:rgba(0,0,0,.1)}.hover-bg-white-90:focus,.hover-bg-white-90:hover{background-color:hsla(0,0%,100%,.9)}.hover-bg-white-80:focus,.hover-bg-white-80:hover{background-color:hsla(0,0%,100%,.8)}.hover-bg-white-70:focus,.hover-bg-white-70:hover{background-color:hsla(0,0%,100%,.7)}.hover-bg-white-60:focus,.hover-bg-white-60:hover{background-color:hsla(0,0%,100%,.6)}.hover-bg-white-50:focus,.hover-bg-white-50:hover{background-color:hsla(0,0%,100%,.5)}.hover-bg-white-40:focus,.hover-bg-white-40:hover{background-color:hsla(0,0%,100%,.4)}.hover-bg-white-30:focus,.hover-bg-white-30:hover{background-color:hsla(0,0%,100%,.3)}.hover-bg-white-20:focus,.hover-bg-white-20:hover{background-color:hsla(0,0%,100%,.2)}.hover-bg-white-10:focus,.hover-bg-white-10:hover{background-color:hsla(0,0%,100%,.1)}.hover-dark-red:focus,.hover-dark-red:hover{color:#e7040f}.hover-red:focus,.hover-red:hover{color:#ff4136}.hover-light-red:focus,.hover-light-red:hover{color:#ff725c}.hover-orange:focus,.hover-orange:hover{color:#ff6300}.hover-gold:focus,.hover-gold:hover{color:#ffb700}.hover-yellow:focus,.hover-yellow:hover{color:gold}.hover-light-yellow:focus,.hover-light-yellow:hover{color:#fbf1a9}.hover-purple:focus,.hover-purple:hover{color:#5e2ca5}.hover-light-purple:focus,.hover-light-purple:hover{color:#a463f2}.hover-dark-pink:focus,.hover-dark-pink:hover{color:#d5008f}.hover-hot-pink:focus,.hover-hot-pink:hover{color:#ff41b4}.hover-pink:focus,.hover-pink:hover{color:#ff80cc}.hover-light-pink:focus,.hover-light-pink:hover{color:#ffa3d7}.hover-dark-green:focus,.hover-dark-green:hover{color:#137752}.hover-green:focus,.hover-green:hover{color:#19a974}.hover-light-green:focus,.hover-light-green:hover{color:#9eebcf}.hover-navy:focus,.hover-navy:hover{color:#001b44}.hover-dark-blue:focus,.hover-dark-blue:hover{color:#00449e}.hover-blue:focus,.hover-blue:hover{color:#357edd}.hover-light-blue:focus,.hover-light-blue:hover{color:#96ccff}.hover-lightest-blue:focus,.hover-lightest-blue:hover{color:#cdecff}.hover-washed-blue:focus,.hover-washed-blue:hover{color:#f6fffe}.hover-washed-green:focus,.hover-washed-green:hover{color:#e8fdf5}.hover-washed-yellow:focus,.hover-washed-yellow:hover{color:#fffceb}.hover-washed-red:focus,.hover-washed-red:hover{color:#ffdfdf}.hover-bg-dark-red:focus,.hover-bg-dark-red:hover{background-color:#e7040f}.hover-bg-red:focus,.hover-bg-red:hover{background-color:#ff4136}.hover-bg-light-red:focus,.hover-bg-light-red:hover{background-color:#ff725c}.hover-bg-orange:focus,.hover-bg-orange:hover{background-color:#ff6300}.hover-bg-gold:focus,.hover-bg-gold:hover{background-color:#ffb700}.hover-bg-yellow:focus,.hover-bg-yellow:hover{background-color:gold}.hover-bg-light-yellow:focus,.hover-bg-light-yellow:hover{background-color:#fbf1a9}.hover-bg-purple:focus,.hover-bg-purple:hover{background-color:#5e2ca5}.hover-bg-light-purple:focus,.hover-bg-light-purple:hover{background-color:#a463f2}.hover-bg-dark-pink:focus,.hover-bg-dark-pink:hover{background-color:#d5008f}.hover-bg-hot-pink:focus,.hover-bg-hot-pink:hover{background-color:#ff41b4}.hover-bg-pink:focus,.hover-bg-pink:hover{background-color:#ff80cc}.hover-bg-light-pink:focus,.hover-bg-light-pink:hover{background-color:#ffa3d7}.hover-bg-dark-green:focus,.hover-bg-dark-green:hover{background-color:#137752}.hover-bg-green:focus,.hover-bg-green:hover{background-color:#19a974}.hover-bg-light-green:focus,.hover-bg-light-green:hover{background-color:#9eebcf}.hover-bg-navy:focus,.hover-bg-navy:hover{background-color:#001b44}.hover-bg-dark-blue:focus,.hover-bg-dark-blue:hover{background-color:#00449e}.hover-bg-blue:focus,.hover-bg-blue:hover{background-color:#357edd}.hover-bg-light-blue:focus,.hover-bg-light-blue:hover{background-color:#96ccff}.hover-bg-lightest-blue:focus,.hover-bg-lightest-blue:hover{background-color:#cdecff}.hover-bg-washed-blue:focus,.hover-bg-washed-blue:hover{background-color:#f6fffe}.hover-bg-washed-green:focus,.hover-bg-washed-green:hover{background-color:#e8fdf5}.hover-bg-washed-yellow:focus,.hover-bg-washed-yellow:hover{background-color:#fffceb}.hover-bg-washed-red:focus,.hover-bg-washed-red:hover{background-color:#ffdfdf}.hover-bg-inherit:focus,.hover-bg-inherit:hover{background-color:inherit}.pa0{padding:0}.pa1{padding:.25rem}.pa2{padding:.5rem}.pa3{padding:1rem}.pa4{padding:2rem}.pa5{padding:4rem}.pa6{padding:8rem}.pa7{padding:16rem}.pl0{padding-left:0}.pl1{padding-left:.25rem}.pl2{padding-left:.5rem}.pl3{padding-left:1rem}.pl4{padding-left:2rem}.pl5{padding-left:4rem}.pl6{padding-left:8rem}.pl7{padding-left:16rem}.pr0{padding-right:0}.pr1{padding-right:.25rem}.pr2{padding-right:.5rem}.pr3{padding-right:1rem}.pr4{padding-right:2rem}.pr5{padding-right:4rem}.pr6{padding-right:8rem}.pr7{padding-right:16rem}.pb0{padding-bottom:0}.pb1{padding-bottom:.25rem}.pb2{padding-bottom:.5rem}.pb3{padding-bottom:1rem}.pb4{padding-bottom:2rem}.pb5{padding-bottom:4rem}.pb6{padding-bottom:8rem}.pb7{padding-bottom:16rem}.pt0{padding-top:0}.pt1{padding-top:.25rem}.pt2{padding-top:.5rem}.pt3{padding-top:1rem}.pt4{padding-top:2rem}.pt5{padding-top:4rem}.pt6{padding-top:8rem}.pt7{padding-top:16rem}.pv0{padding-top:0;padding-bottom:0}.pv1{padding-top:.25rem;padding-bottom:.25rem}.pv2{padding-top:.5rem;padding-bottom:.5rem}.pv3{padding-top:1rem;padding-bottom:1rem}.pv4{padding-top:2rem;padding-bottom:2rem}.pv5{padding-top:4rem;padding-bottom:4rem}.pv6{padding-top:8rem;padding-bottom:8rem}.pv7{padding-top:16rem;padding-bottom:16rem}.ph0{padding-left:0;padding-right:0}.ph1{padding-left:.25rem;padding-right:.25rem}.ph2{padding-left:.5rem;padding-right:.5rem}.ph3{padding-left:1rem;padding-right:1rem}.ph4{padding-left:2rem;padding-right:2rem}.ph5{padding-left:4rem;padding-right:4rem}.ph6{padding-left:8rem;padding-right:8rem}.ph7{padding-left:16rem;padding-right:16rem}.ma0{margin:0}.ma1{margin:.25rem}.ma2{margin:.5rem}.ma3{margin:1rem}.ma4{margin:2rem}.ma5{margin:4rem}.ma6{margin:8rem}.ma7{margin:16rem}.ml0{margin-left:0}.ml1{margin-left:.25rem}.ml2{margin-left:.5rem}.ml3{margin-left:1rem}.ml4{margin-left:2rem}.ml5{margin-left:4rem}.ml6{margin-left:8rem}.ml7{margin-left:16rem}.mr0{margin-right:0}.mr1{margin-right:.25rem}.mr2{margin-right:.5rem}.mr3{margin-right:1rem}.mr4{margin-right:2rem}.mr5{margin-right:4rem}.mr6{margin-right:8rem}.mr7{margin-right:16rem}.mb0{margin-bottom:0}.mb1{margin-bottom:.25rem}.mb2{margin-bottom:.5rem}.mb3{margin-bottom:1rem}.mb4{margin-bottom:2rem}.mb5{margin-bottom:4rem}.mb6{margin-bottom:8rem}.mb7{margin-bottom:16rem}.mt0{margin-top:0}.mt1{margin-top:.25rem}.mt2{margin-top:.5rem}.mt3{margin-top:1rem}.mt4{margin-top:2rem}.mt5{margin-top:4rem}.mt6{margin-top:8rem}.mt7{margin-top:16rem}.mv0{margin-top:0;margin-bottom:0}.mv1{margin-top:.25rem;margin-bottom:.25rem}.mv2{margin-top:.5rem;margin-bottom:.5rem}.mv3{margin-top:1rem;margin-bottom:1rem}.mv4{margin-top:2rem;margin-bottom:2rem}.mv5{margin-top:4rem;margin-bottom:4rem}.mv6{margin-top:8rem;margin-bottom:8rem}.mv7{margin-top:16rem;margin-bottom:16rem}.mh0{margin-left:0;margin-right:0}.mh1{margin-left:.25rem;margin-right:.25rem}.mh2{margin-left:.5rem;margin-right:.5rem}.mh3{margin-left:1rem;margin-right:1rem}.mh4{margin-left:2rem;margin-right:2rem}.mh5{margin-left:4rem;margin-right:4rem}.mh6{margin-left:8rem;margin-right:8rem}.mh7{margin-left:16rem;margin-right:16rem}.na1{margin:-.25rem}.na2{margin:-.5rem}.na3{margin:-1rem}.na4{margin:-2rem}.na5{margin:-4rem}.na6{margin:-8rem}.na7{margin:-16rem}.nl1{margin-left:-.25rem}.nl2{margin-left:-.5rem}.nl3{margin-left:-1rem}.nl4{margin-left:-2rem}.nl5{margin-left:-4rem}.nl6{margin-left:-8rem}.nl7{margin-left:-16rem}.nr1{margin-right:-.25rem}.nr2{margin-right:-.5rem}.nr3{margin-right:-1rem}.nr4{margin-right:-2rem}.nr5{margin-right:-4rem}.nr6{margin-right:-8rem}.nr7{margin-right:-16rem}.nb1{margin-bottom:-.25rem}.nb2{margin-bottom:-.5rem}.nb3{margin-bottom:-1rem}.nb4{margin-bottom:-2rem}.nb5{margin-bottom:-4rem}.nb6{margin-bottom:-8rem}.nb7{margin-bottom:-16rem}.nt1{margin-top:-.25rem}.nt2{margin-top:-.5rem}.nt3{margin-top:-1rem}.nt4{margin-top:-2rem}.nt5{margin-top:-4rem}.nt6{margin-top:-8rem}.nt7{margin-top:-16rem}.collapse{border-collapse:collapse;border-spacing:0}.striped--light-silver:nth-child(odd){background-color:#aaa}.striped--moon-gray:nth-child(odd){background-color:#ccc}.striped--light-gray:nth-child(odd){background-color:#eee}.striped--near-white:nth-child(odd){background-color:#f4f4f4}.stripe-light:nth-child(odd){background-color:hsla(0,0%,100%,.1)}.stripe-dark:nth-child(odd){background-color:rgba(0,0,0,.1)}.strike{text-decoration:line-through}.underline{text-decoration:underline}.no-underline{text-decoration:none}.tl{text-align:left}.tr{text-align:right}.tc{text-align:center}.tj{text-align:justify}.ttc{text-transform:capitalize}.ttl{text-transform:lowercase}.ttu{text-transform:uppercase}.ttn{text-transform:none}.f-6,.f-headline{font-size:6rem}.f-5,.f-subheadline{font-size:5rem}.f1{font-size:3rem}.f2{font-size:2.25rem}.f3{font-size:1.5rem}.f4{font-size:1.25rem}.f5{font-size:1rem}.f6{font-size:.875rem}.f7{font-size:.75rem}.measure{max-width:30em}.measure-wide{max-width:34em}.measure-narrow{max-width:20em}.indent{text-indent:1em;margin-top:0;margin-bottom:0}.small-caps{font-variant:small-caps}.truncate{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.overflow-container{overflow-y:scroll}.center{margin-left:auto}.center,.mr-auto{margin-right:auto}.ml-auto{margin-left:auto}.clip{position:fixed!important;_position:absolute!important;clip:rect(1px 1px 1px 1px);clip:rect(1px,1px,1px,1px)}.ws-normal{white-space:normal}.nowrap{white-space:nowrap}.pre{white-space:pre}.v-base{vertical-align:baseline}.v-mid{vertical-align:middle}.v-top{vertical-align:top}.v-btm{vertical-align:bottom}.dim{opacity:1}.dim,.dim:focus,.dim:hover{transition:opacity .15s ease-in}.dim:focus,.dim:hover{opacity:.5}.dim:active{opacity:.8;transition:opacity .15s ease-out}.glow,.glow:focus,.glow:hover{transition:opacity .15s ease-in}.glow:focus,.glow:hover{opacity:1}.hide-child .child{opacity:0;transition:opacity .15s ease-in}.hide-child:active .child,.hide-child:focus .child,.hide-child:hover .child{opacity:1;transition:opacity .15s ease-in}.underline-hover:focus,.underline-hover:hover{text-decoration:underline}.grow{-moz-osx-font-smoothing:grayscale;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-transform:translateZ(0);transform:translateZ(0);transition:-webkit-transform .25s ease-out;transition:transform .25s ease-out;transition:transform .25s ease-out,-webkit-transform .25s ease-out}.grow:focus,.grow:hover{-webkit-transform:scale(1.05);transform:scale(1.05)}.grow:active{-webkit-transform:scale(.9);transform:scale(.9)}.grow-large{-moz-osx-font-smoothing:grayscale;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-transform:translateZ(0);transform:translateZ(0);transition:-webkit-transform .25s ease-in-out;transition:transform .25s ease-in-out;transition:transform .25s ease-in-out,-webkit-transform .25s ease-in-out}.grow-large:focus,.grow-large:hover{-webkit-transform:scale(1.2);transform:scale(1.2)}.grow-large:active{-webkit-transform:scale(.95);transform:scale(.95)}.pointer:hover,.shadow-hover{cursor:pointer}.shadow-hover{position:relative;transition:all .5s cubic-bezier(.165,.84,.44,1)}.shadow-hover:after{content:"";box-shadow:0 0 16px 2px rgba(0,0,0,.2);border-radius:inherit;opacity:0;position:absolute;top:0;left:0;width:100%;height:100%;z-index:-1;transition:opacity .5s cubic-bezier(.165,.84,.44,1)}.shadow-hover:focus:after,.shadow-hover:hover:after{opacity:1}.bg-animate,.bg-animate:focus,.bg-animate:hover{transition:background-color .15s ease-in-out}.z-0{z-index:0}.z-1{z-index:1}.z-2{z-index:2}.z-3{z-index:3}.z-4{z-index:4}.z-5{z-index:5}.z-999{z-index:999}.z-9999{z-index:9999}.z-max{z-index:2147483647}.z-inherit{z-index:inherit}.z-initial{z-index:auto}.z-unset{z-index:unset}.nested-copy-line-height ol,.nested-copy-line-height p,.nested-copy-line-height ul{line-height:1.5}.nested-headline-line-height h1,.nested-headline-line-height h2,.nested-headline-line-height h3,.nested-headline-line-height h4,.nested-headline-line-height h5,.nested-headline-line-height h6{line-height:1.25}.nested-list-reset ol,.nested-list-reset ul{padding-left:0;margin-left:0;list-style-type:none}.nested-copy-indent p+p{text-indent:1em;margin-top:0;margin-bottom:0}.nested-copy-separator p+p{margin-top:1.5em}.nested-img img{width:100%;max-width:100%;display:block}.nested-links a{color:#357edd;transition:color .15s ease-in}.nested-links a:focus,.nested-links a:hover{color:#96ccff;transition:color .15s ease-in}.debug *{outline:1px solid gold}.debug-white *{outline:1px solid #fff}.debug-black *{outline:1px solid #000}.debug-grid{background:transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAFElEQVR4AWPAC97/9x0eCsAEPgwAVLshdpENIxcAAAAASUVORK5CYII=) repeat 0 0}.debug-grid-16{background:transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMklEQVR4AWOgCLz/b0epAa6UGuBOqQHOQHLUgFEDnAbcBZ4UGwDOkiCnkIhdgNgNxAYAiYlD+8sEuo8AAAAASUVORK5CYII=) repeat 0 0}.debug-grid-8-solid{background:#fff url(data:image/gif;base64,R0lGODdhCAAIAPEAAADw/wDx/////wAAACwAAAAACAAIAAACDZQvgaeb/lxbAIKA8y0AOw==) repeat 0 0}.debug-grid-16-solid{background:#fff url(data:image/gif;base64,R0lGODdhEAAQAPEAAADw/wDx/xXy/////ywAAAAAEAAQAAACIZyPKckYDQFsb6ZqD85jZ2+BkwiRFKehhqQCQgDHcgwEBQA7) repeat 0 0}@media screen and (min-width:30em){.aspect-ratio-ns{height:0;position:relative}.aspect-ratio--16x9-ns{padding-bottom:56.25%}.aspect-ratio--9x16-ns{padding-bottom:177.77%}.aspect-ratio--4x3-ns{padding-bottom:75%}.aspect-ratio--3x4-ns{padding-bottom:133.33%}.aspect-ratio--6x4-ns{padding-bottom:66.6%}.aspect-ratio--4x6-ns{padding-bottom:150%}.aspect-ratio--8x5-ns{padding-bottom:62.5%}.aspect-ratio--5x8-ns{padding-bottom:160%}.aspect-ratio--7x5-ns{padding-bottom:71.42%}.aspect-ratio--5x7-ns{padding-bottom:140%}.aspect-ratio--1x1-ns{padding-bottom:100%}.aspect-ratio--object-ns{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;z-index:100}.cover-ns{background-size:cover!important}.contain-ns{background-size:contain!important}.bg-center-ns{background-position:50%}.bg-center-ns,.bg-top-ns{background-repeat:no-repeat}.bg-top-ns{background-position:top}.bg-right-ns{background-position:100%}.bg-bottom-ns,.bg-right-ns{background-repeat:no-repeat}.bg-bottom-ns{background-position:bottom}.bg-left-ns{background-repeat:no-repeat;background-position:0}.outline-ns{outline:1px solid}.outline-transparent-ns{outline:1px solid transparent}.outline-0-ns{outline:0}.ba-ns{border-style:solid;border-width:1px}.bt-ns{border-top-style:solid;border-top-width:1px}.br-ns{border-right-style:solid;border-right-width:1px}.bb-ns{border-bottom-style:solid;border-bottom-width:1px}.bl-ns{border-left-style:solid;border-left-width:1px}.bn-ns{border-style:none;border-width:0}.br0-ns{border-radius:0}.br1-ns{border-radius:.125rem}.br2-ns{border-radius:.25rem}.br3-ns{border-radius:.5rem}.br4-ns{border-radius:1rem}.br-100-ns{border-radius:100%}.br-pill-ns{border-radius:9999px}.br--bottom-ns{border-top-left-radius:0;border-top-right-radius:0}.br--top-ns{border-bottom-right-radius:0}.br--right-ns,.br--top-ns{border-bottom-left-radius:0}.br--right-ns{border-top-left-radius:0}.br--left-ns{border-top-right-radius:0;border-bottom-right-radius:0}.b--dotted-ns{border-style:dotted}.b--dashed-ns{border-style:dashed}.b--solid-ns{border-style:solid}.b--none-ns{border-style:none}.bw0-ns{border-width:0}.bw1-ns{border-width:.125rem}.bw2-ns{border-width:.25rem}.bw3-ns{border-width:.5rem}.bw4-ns{border-width:1rem}.bw5-ns{border-width:2rem}.bt-0-ns{border-top-width:0}.br-0-ns{border-right-width:0}.bb-0-ns{border-bottom-width:0}.bl-0-ns{border-left-width:0}.shadow-1-ns{box-shadow:0 0 4px 2px rgba(0,0,0,.2)}.shadow-2-ns{box-shadow:0 0 8px 2px rgba(0,0,0,.2)}.shadow-3-ns{box-shadow:2px 2px 4px 2px rgba(0,0,0,.2)}.shadow-4-ns{box-shadow:2px 2px 8px 0 rgba(0,0,0,.2)}.shadow-5-ns{box-shadow:4px 4px 8px 0 rgba(0,0,0,.2)}.top-0-ns{top:0}.left-0-ns{left:0}.right-0-ns{right:0}.bottom-0-ns{bottom:0}.top-1-ns{top:1rem}.left-1-ns{left:1rem}.right-1-ns{right:1rem}.bottom-1-ns{bottom:1rem}.top-2-ns{top:2rem}.left-2-ns{left:2rem}.right-2-ns{right:2rem}.bottom-2-ns{bottom:2rem}.top--1-ns{top:-1rem}.right--1-ns{right:-1rem}.bottom--1-ns{bottom:-1rem}.left--1-ns{left:-1rem}.top--2-ns{top:-2rem}.right--2-ns{right:-2rem}.bottom--2-ns{bottom:-2rem}.left--2-ns{left:-2rem}.absolute--fill-ns{top:0;right:0;bottom:0;left:0}.cl-ns{clear:left}.cr-ns{clear:right}.cb-ns{clear:both}.cn-ns{clear:none}.dn-ns{display:none}.di-ns{display:inline}.db-ns{display:block}.dib-ns{display:inline-block}.dit-ns{display:inline-table}.dt-ns{display:table}.dtc-ns{display:table-cell}.dt-row-ns{display:table-row}.dt-row-group-ns{display:table-row-group}.dt-column-ns{display:table-column}.dt-column-group-ns{display:table-column-group}.dt--fixed-ns{table-layout:fixed;width:100%}.flex-ns{display:flex}.inline-flex-ns{display:inline-flex}.flex-auto-ns{flex:1 1 auto;min-width:0;min-height:0}.flex-none-ns{flex:none}.flex-column-ns{flex-direction:column}.flex-row-ns{flex-direction:row}.flex-wrap-ns{flex-wrap:wrap}.flex-nowrap-ns{flex-wrap:nowrap}.flex-wrap-reverse-ns{flex-wrap:wrap-reverse}.flex-column-reverse-ns{flex-direction:column-reverse}.flex-row-reverse-ns{flex-direction:row-reverse}.items-start-ns{align-items:flex-start}.items-end-ns{align-items:flex-end}.items-center-ns{align-items:center}.items-baseline-ns{align-items:baseline}.items-stretch-ns{align-items:stretch}.self-start-ns{align-self:flex-start}.self-end-ns{align-self:flex-end}.self-center-ns{align-self:center}.self-baseline-ns{align-self:baseline}.self-stretch-ns{align-self:stretch}.justify-start-ns{justify-content:flex-start}.justify-end-ns{justify-content:flex-end}.justify-center-ns{justify-content:center}.justify-between-ns{justify-content:space-between}.justify-around-ns{justify-content:space-around}.content-start-ns{align-content:flex-start}.content-end-ns{align-content:flex-end}.content-center-ns{align-content:center}.content-between-ns{align-content:space-between}.content-around-ns{align-content:space-around}.content-stretch-ns{align-content:stretch}.order-0-ns{order:0}.order-1-ns{order:1}.order-2-ns{order:2}.order-3-ns{order:3}.order-4-ns{order:4}.order-5-ns{order:5}.order-6-ns{order:6}.order-7-ns{order:7}.order-8-ns{order:8}.order-last-ns{order:99999}.flex-grow-0-ns{flex-grow:0}.flex-grow-1-ns{flex-grow:1}.flex-shrink-0-ns{flex-shrink:0}.flex-shrink-1-ns{flex-shrink:1}.fl-ns{float:left}.fl-ns,.fr-ns{_display:inline}.fr-ns{float:right}.fn-ns{float:none}.i-ns{font-style:italic}.fs-normal-ns{font-style:normal}.normal-ns{font-weight:400}.b-ns{font-weight:700}.fw1-ns{font-weight:100}.fw2-ns{font-weight:200}.fw3-ns{font-weight:300}.fw4-ns{font-weight:400}.fw5-ns{font-weight:500}.fw6-ns{font-weight:600}.fw7-ns{font-weight:700}.fw8-ns{font-weight:800}.fw9-ns{font-weight:900}.h1-ns{height:1rem}.h2-ns{height:2rem}.h3-ns{height:4rem}.h4-ns{height:8rem}.h5-ns{height:16rem}.h-25-ns{height:25%}.h-50-ns{height:50%}.h-75-ns{height:75%}.h-100-ns{height:100%}.min-h-100-ns{min-height:100%}.vh-25-ns{height:25vh}.vh-50-ns{height:50vh}.vh-75-ns{height:75vh}.vh-100-ns{height:100vh}.min-vh-100-ns{min-height:100vh}.h-auto-ns{height:auto}.h-inherit-ns{height:inherit}.tracked-ns{letter-spacing:.1em}.tracked-tight-ns{letter-spacing:-.05em}.tracked-mega-ns{letter-spacing:.25em}.lh-solid-ns{line-height:1}.lh-title-ns{line-height:1.25}.lh-copy-ns{line-height:1.5}.mw-100-ns{max-width:100%}.mw1-ns{max-width:1rem}.mw2-ns{max-width:2rem}.mw3-ns{max-width:4rem}.mw4-ns{max-width:8rem}.mw5-ns{max-width:16rem}.mw6-ns{max-width:32rem}.mw7-ns{max-width:48rem}.mw8-ns{max-width:64rem}.mw9-ns{max-width:96rem}.mw-none-ns{max-width:none}.w1-ns{width:1rem}.w2-ns{width:2rem}.w3-ns{width:4rem}.w4-ns{width:8rem}.w5-ns{width:16rem}.w-10-ns{width:10%}.w-20-ns{width:20%}.w-25-ns{width:25%}.w-30-ns{width:30%}.w-33-ns{width:33%}.w-34-ns{width:34%}.w-40-ns{width:40%}.w-50-ns{width:50%}.w-60-ns{width:60%}.w-70-ns{width:70%}.w-75-ns{width:75%}.w-80-ns{width:80%}.w-90-ns{width:90%}.w-100-ns{width:100%}.w-third-ns{width:33.33333%}.w-two-thirds-ns{width:66.66667%}.w-auto-ns{width:auto}.overflow-visible-ns{overflow:visible}.overflow-hidden-ns{overflow:hidden}.overflow-scroll-ns{overflow:scroll}.overflow-auto-ns{overflow:auto}.overflow-x-visible-ns{overflow-x:visible}.overflow-x-hidden-ns{overflow-x:hidden}.overflow-x-scroll-ns{overflow-x:scroll}.overflow-x-auto-ns{overflow-x:auto}.overflow-y-visible-ns{overflow-y:visible}.overflow-y-hidden-ns{overflow-y:hidden}.overflow-y-scroll-ns{overflow-y:scroll}.overflow-y-auto-ns{overflow-y:auto}.static-ns{position:static}.relative-ns{position:relative}.absolute-ns{position:absolute}.fixed-ns{position:fixed}.rotate-45-ns{-webkit-transform:rotate(45deg);transform:rotate(45deg)}.rotate-90-ns{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.rotate-135-ns{-webkit-transform:rotate(135deg);transform:rotate(135deg)}.rotate-180-ns{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.rotate-225-ns{-webkit-transform:rotate(225deg);transform:rotate(225deg)}.rotate-270-ns{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.rotate-315-ns{-webkit-transform:rotate(315deg);transform:rotate(315deg)}.pa0-ns{padding:0}.pa1-ns{padding:.25rem}.pa2-ns{padding:.5rem}.pa3-ns{padding:1rem}.pa4-ns{padding:2rem}.pa5-ns{padding:4rem}.pa6-ns{padding:8rem}.pa7-ns{padding:16rem}.pl0-ns{padding-left:0}.pl1-ns{padding-left:.25rem}.pl2-ns{padding-left:.5rem}.pl3-ns{padding-left:1rem}.pl4-ns{padding-left:2rem}.pl5-ns{padding-left:4rem}.pl6-ns{padding-left:8rem}.pl7-ns{padding-left:16rem}.pr0-ns{padding-right:0}.pr1-ns{padding-right:.25rem}.pr2-ns{padding-right:.5rem}.pr3-ns{padding-right:1rem}.pr4-ns{padding-right:2rem}.pr5-ns{padding-right:4rem}.pr6-ns{padding-right:8rem}.pr7-ns{padding-right:16rem}.pb0-ns{padding-bottom:0}.pb1-ns{padding-bottom:.25rem}.pb2-ns{padding-bottom:.5rem}.pb3-ns{padding-bottom:1rem}.pb4-ns{padding-bottom:2rem}.pb5-ns{padding-bottom:4rem}.pb6-ns{padding-bottom:8rem}.pb7-ns{padding-bottom:16rem}.pt0-ns{padding-top:0}.pt1-ns{padding-top:.25rem}.pt2-ns{padding-top:.5rem}.pt3-ns{padding-top:1rem}.pt4-ns{padding-top:2rem}.pt5-ns{padding-top:4rem}.pt6-ns{padding-top:8rem}.pt7-ns{padding-top:16rem}.pv0-ns{padding-top:0;padding-bottom:0}.pv1-ns{padding-top:.25rem;padding-bottom:.25rem}.pv2-ns{padding-top:.5rem;padding-bottom:.5rem}.pv3-ns{padding-top:1rem;padding-bottom:1rem}.pv4-ns{padding-top:2rem;padding-bottom:2rem}.pv5-ns{padding-top:4rem;padding-bottom:4rem}.pv6-ns{padding-top:8rem;padding-bottom:8rem}.pv7-ns{padding-top:16rem;padding-bottom:16rem}.ph0-ns{padding-left:0;padding-right:0}.ph1-ns{padding-left:.25rem;padding-right:.25rem}.ph2-ns{padding-left:.5rem;padding-right:.5rem}.ph3-ns{padding-left:1rem;padding-right:1rem}.ph4-ns{padding-left:2rem;padding-right:2rem}.ph5-ns{padding-left:4rem;padding-right:4rem}.ph6-ns{padding-left:8rem;padding-right:8rem}.ph7-ns{padding-left:16rem;padding-right:16rem}.ma0-ns{margin:0}.ma1-ns{margin:.25rem}.ma2-ns{margin:.5rem}.ma3-ns{margin:1rem}.ma4-ns{margin:2rem}.ma5-ns{margin:4rem}.ma6-ns{margin:8rem}.ma7-ns{margin:16rem}.ml0-ns{margin-left:0}.ml1-ns{margin-left:.25rem}.ml2-ns{margin-left:.5rem}.ml3-ns{margin-left:1rem}.ml4-ns{margin-left:2rem}.ml5-ns{margin-left:4rem}.ml6-ns{margin-left:8rem}.ml7-ns{margin-left:16rem}.mr0-ns{margin-right:0}.mr1-ns{margin-right:.25rem}.mr2-ns{margin-right:.5rem}.mr3-ns{margin-right:1rem}.mr4-ns{margin-right:2rem}.mr5-ns{margin-right:4rem}.mr6-ns{margin-right:8rem}.mr7-ns{margin-right:16rem}.mb0-ns{margin-bottom:0}.mb1-ns{margin-bottom:.25rem}.mb2-ns{margin-bottom:.5rem}.mb3-ns{margin-bottom:1rem}.mb4-ns{margin-bottom:2rem}.mb5-ns{margin-bottom:4rem}.mb6-ns{margin-bottom:8rem}.mb7-ns{margin-bottom:16rem}.mt0-ns{margin-top:0}.mt1-ns{margin-top:.25rem}.mt2-ns{margin-top:.5rem}.mt3-ns{margin-top:1rem}.mt4-ns{margin-top:2rem}.mt5-ns{margin-top:4rem}.mt6-ns{margin-top:8rem}.mt7-ns{margin-top:16rem}.mv0-ns{margin-top:0;margin-bottom:0}.mv1-ns{margin-top:.25rem;margin-bottom:.25rem}.mv2-ns{margin-top:.5rem;margin-bottom:.5rem}.mv3-ns{margin-top:1rem;margin-bottom:1rem}.mv4-ns{margin-top:2rem;margin-bottom:2rem}.mv5-ns{margin-top:4rem;margin-bottom:4rem}.mv6-ns{margin-top:8rem;margin-bottom:8rem}.mv7-ns{margin-top:16rem;margin-bottom:16rem}.mh0-ns{margin-left:0;margin-right:0}.mh1-ns{margin-left:.25rem;margin-right:.25rem}.mh2-ns{margin-left:.5rem;margin-right:.5rem}.mh3-ns{margin-left:1rem;margin-right:1rem}.mh4-ns{margin-left:2rem;margin-right:2rem}.mh5-ns{margin-left:4rem;margin-right:4rem}.mh6-ns{margin-left:8rem;margin-right:8rem}.mh7-ns{margin-left:16rem;margin-right:16rem}.na1-ns{margin:-.25rem}.na2-ns{margin:-.5rem}.na3-ns{margin:-1rem}.na4-ns{margin:-2rem}.na5-ns{margin:-4rem}.na6-ns{margin:-8rem}.na7-ns{margin:-16rem}.nl1-ns{margin-left:-.25rem}.nl2-ns{margin-left:-.5rem}.nl3-ns{margin-left:-1rem}.nl4-ns{margin-left:-2rem}.nl5-ns{margin-left:-4rem}.nl6-ns{margin-left:-8rem}.nl7-ns{margin-left:-16rem}.nr1-ns{margin-right:-.25rem}.nr2-ns{margin-right:-.5rem}.nr3-ns{margin-right:-1rem}.nr4-ns{margin-right:-2rem}.nr5-ns{margin-right:-4rem}.nr6-ns{margin-right:-8rem}.nr7-ns{margin-right:-16rem}.nb1-ns{margin-bottom:-.25rem}.nb2-ns{margin-bottom:-.5rem}.nb3-ns{margin-bottom:-1rem}.nb4-ns{margin-bottom:-2rem}.nb5-ns{margin-bottom:-4rem}.nb6-ns{margin-bottom:-8rem}.nb7-ns{margin-bottom:-16rem}.nt1-ns{margin-top:-.25rem}.nt2-ns{margin-top:-.5rem}.nt3-ns{margin-top:-1rem}.nt4-ns{margin-top:-2rem}.nt5-ns{margin-top:-4rem}.nt6-ns{margin-top:-8rem}.nt7-ns{margin-top:-16rem}.strike-ns{text-decoration:line-through}.underline-ns{text-decoration:underline}.no-underline-ns{text-decoration:none}.tl-ns{text-align:left}.tr-ns{text-align:right}.tc-ns{text-align:center}.tj-ns{text-align:justify}.ttc-ns{text-transform:capitalize}.ttl-ns{text-transform:lowercase}.ttu-ns{text-transform:uppercase}.ttn-ns{text-transform:none}.f-6-ns,.f-headline-ns{font-size:6rem}.f-5-ns,.f-subheadline-ns{font-size:5rem}.f1-ns{font-size:3rem}.f2-ns{font-size:2.25rem}.f3-ns{font-size:1.5rem}.f4-ns{font-size:1.25rem}.f5-ns{font-size:1rem}.f6-ns{font-size:.875rem}.f7-ns{font-size:.75rem}.measure-ns{max-width:30em}.measure-wide-ns{max-width:34em}.measure-narrow-ns{max-width:20em}.indent-ns{text-indent:1em;margin-top:0;margin-bottom:0}.small-caps-ns{font-variant:small-caps}.truncate-ns{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.center-ns{margin-left:auto}.center-ns,.mr-auto-ns{margin-right:auto}.ml-auto-ns{margin-left:auto}.clip-ns{position:fixed!important;_position:absolute!important;clip:rect(1px 1px 1px 1px);clip:rect(1px,1px,1px,1px)}.ws-normal-ns{white-space:normal}.nowrap-ns{white-space:nowrap}.pre-ns{white-space:pre}.v-base-ns{vertical-align:baseline}.v-mid-ns{vertical-align:middle}.v-top-ns{vertical-align:top}.v-btm-ns{vertical-align:bottom}}@media screen and (min-width:30em) and (max-width:60em){.aspect-ratio-m{height:0;position:relative}.aspect-ratio--16x9-m{padding-bottom:56.25%}.aspect-ratio--9x16-m{padding-bottom:177.77%}.aspect-ratio--4x3-m{padding-bottom:75%}.aspect-ratio--3x4-m{padding-bottom:133.33%}.aspect-ratio--6x4-m{padding-bottom:66.6%}.aspect-ratio--4x6-m{padding-bottom:150%}.aspect-ratio--8x5-m{padding-bottom:62.5%}.aspect-ratio--5x8-m{padding-bottom:160%}.aspect-ratio--7x5-m{padding-bottom:71.42%}.aspect-ratio--5x7-m{padding-bottom:140%}.aspect-ratio--1x1-m{padding-bottom:100%}.aspect-ratio--object-m{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;z-index:100}.cover-m{background-size:cover!important}.contain-m{background-size:contain!important}.bg-center-m{background-position:50%}.bg-center-m,.bg-top-m{background-repeat:no-repeat}.bg-top-m{background-position:top}.bg-right-m{background-position:100%}.bg-bottom-m,.bg-right-m{background-repeat:no-repeat}.bg-bottom-m{background-position:bottom}.bg-left-m{background-repeat:no-repeat;background-position:0}.outline-m{outline:1px solid}.outline-transparent-m{outline:1px solid transparent}.outline-0-m{outline:0}.ba-m{border-style:solid;border-width:1px}.bt-m{border-top-style:solid;border-top-width:1px}.br-m{border-right-style:solid;border-right-width:1px}.bb-m{border-bottom-style:solid;border-bottom-width:1px}.bl-m{border-left-style:solid;border-left-width:1px}.bn-m{border-style:none;border-width:0}.br0-m{border-radius:0}.br1-m{border-radius:.125rem}.br2-m{border-radius:.25rem}.br3-m{border-radius:.5rem}.br4-m{border-radius:1rem}.br-100-m{border-radius:100%}.br-pill-m{border-radius:9999px}.br--bottom-m{border-top-left-radius:0;border-top-right-radius:0}.br--top-m{border-bottom-right-radius:0}.br--right-m,.br--top-m{border-bottom-left-radius:0}.br--right-m{border-top-left-radius:0}.br--left-m{border-top-right-radius:0;border-bottom-right-radius:0}.b--dotted-m{border-style:dotted}.b--dashed-m{border-style:dashed}.b--solid-m{border-style:solid}.b--none-m{border-style:none}.bw0-m{border-width:0}.bw1-m{border-width:.125rem}.bw2-m{border-width:.25rem}.bw3-m{border-width:.5rem}.bw4-m{border-width:1rem}.bw5-m{border-width:2rem}.bt-0-m{border-top-width:0}.br-0-m{border-right-width:0}.bb-0-m{border-bottom-width:0}.bl-0-m{border-left-width:0}.shadow-1-m{box-shadow:0 0 4px 2px rgba(0,0,0,.2)}.shadow-2-m{box-shadow:0 0 8px 2px rgba(0,0,0,.2)}.shadow-3-m{box-shadow:2px 2px 4px 2px rgba(0,0,0,.2)}.shadow-4-m{box-shadow:2px 2px 8px 0 rgba(0,0,0,.2)}.shadow-5-m{box-shadow:4px 4px 8px 0 rgba(0,0,0,.2)}.top-0-m{top:0}.left-0-m{left:0}.right-0-m{right:0}.bottom-0-m{bottom:0}.top-1-m{top:1rem}.left-1-m{left:1rem}.right-1-m{right:1rem}.bottom-1-m{bottom:1rem}.top-2-m{top:2rem}.left-2-m{left:2rem}.right-2-m{right:2rem}.bottom-2-m{bottom:2rem}.top--1-m{top:-1rem}.right--1-m{right:-1rem}.bottom--1-m{bottom:-1rem}.left--1-m{left:-1rem}.top--2-m{top:-2rem}.right--2-m{right:-2rem}.bottom--2-m{bottom:-2rem}.left--2-m{left:-2rem}.absolute--fill-m{top:0;right:0;bottom:0;left:0}.cl-m{clear:left}.cr-m{clear:right}.cb-m{clear:both}.cn-m{clear:none}.dn-m{display:none}.di-m{display:inline}.db-m{display:block}.dib-m{display:inline-block}.dit-m{display:inline-table}.dt-m{display:table}.dtc-m{display:table-cell}.dt-row-m{display:table-row}.dt-row-group-m{display:table-row-group}.dt-column-m{display:table-column}.dt-column-group-m{display:table-column-group}.dt--fixed-m{table-layout:fixed;width:100%}.flex-m{display:flex}.inline-flex-m{display:inline-flex}.flex-auto-m{flex:1 1 auto;min-width:0;min-height:0}.flex-none-m{flex:none}.flex-column-m{flex-direction:column}.flex-row-m{flex-direction:row}.flex-wrap-m{flex-wrap:wrap}.flex-nowrap-m{flex-wrap:nowrap}.flex-wrap-reverse-m{flex-wrap:wrap-reverse}.flex-column-reverse-m{flex-direction:column-reverse}.flex-row-reverse-m{flex-direction:row-reverse}.items-start-m{align-items:flex-start}.items-end-m{align-items:flex-end}.items-center-m{align-items:center}.items-baseline-m{align-items:baseline}.items-stretch-m{align-items:stretch}.self-start-m{align-self:flex-start}.self-end-m{align-self:flex-end}.self-center-m{align-self:center}.self-baseline-m{align-self:baseline}.self-stretch-m{align-self:stretch}.justify-start-m{justify-content:flex-start}.justify-end-m{justify-content:flex-end}.justify-center-m{justify-content:center}.justify-between-m{justify-content:space-between}.justify-around-m{justify-content:space-around}.content-start-m{align-content:flex-start}.content-end-m{align-content:flex-end}.content-center-m{align-content:center}.content-between-m{align-content:space-between}.content-around-m{align-content:space-around}.content-stretch-m{align-content:stretch}.order-0-m{order:0}.order-1-m{order:1}.order-2-m{order:2}.order-3-m{order:3}.order-4-m{order:4}.order-5-m{order:5}.order-6-m{order:6}.order-7-m{order:7}.order-8-m{order:8}.order-last-m{order:99999}.flex-grow-0-m{flex-grow:0}.flex-grow-1-m{flex-grow:1}.flex-shrink-0-m{flex-shrink:0}.flex-shrink-1-m{flex-shrink:1}.fl-m{float:left}.fl-m,.fr-m{_display:inline}.fr-m{float:right}.fn-m{float:none}.i-m{font-style:italic}.fs-normal-m{font-style:normal}.normal-m{font-weight:400}.b-m{font-weight:700}.fw1-m{font-weight:100}.fw2-m{font-weight:200}.fw3-m{font-weight:300}.fw4-m{font-weight:400}.fw5-m{font-weight:500}.fw6-m{font-weight:600}.fw7-m{font-weight:700}.fw8-m{font-weight:800}.fw9-m{font-weight:900}.h1-m{height:1rem}.h2-m{height:2rem}.h3-m{height:4rem}.h4-m{height:8rem}.h5-m{height:16rem}.h-25-m{height:25%}.h-50-m{height:50%}.h-75-m{height:75%}.h-100-m{height:100%}.min-h-100-m{min-height:100%}.vh-25-m{height:25vh}.vh-50-m{height:50vh}.vh-75-m{height:75vh}.vh-100-m{height:100vh}.min-vh-100-m{min-height:100vh}.h-auto-m{height:auto}.h-inherit-m{height:inherit}.tracked-m{letter-spacing:.1em}.tracked-tight-m{letter-spacing:-.05em}.tracked-mega-m{letter-spacing:.25em}.lh-solid-m{line-height:1}.lh-title-m{line-height:1.25}.lh-copy-m{line-height:1.5}.mw-100-m{max-width:100%}.mw1-m{max-width:1rem}.mw2-m{max-width:2rem}.mw3-m{max-width:4rem}.mw4-m{max-width:8rem}.mw5-m{max-width:16rem}.mw6-m{max-width:32rem}.mw7-m{max-width:48rem}.mw8-m{max-width:64rem}.mw9-m{max-width:96rem}.mw-none-m{max-width:none}.w1-m{width:1rem}.w2-m{width:2rem}.w3-m{width:4rem}.w4-m{width:8rem}.w5-m{width:16rem}.w-10-m{width:10%}.w-20-m{width:20%}.w-25-m{width:25%}.w-30-m{width:30%}.w-33-m{width:33%}.w-34-m{width:34%}.w-40-m{width:40%}.w-50-m{width:50%}.w-60-m{width:60%}.w-70-m{width:70%}.w-75-m{width:75%}.w-80-m{width:80%}.w-90-m{width:90%}.w-100-m{width:100%}.w-third-m{width:33.33333%}.w-two-thirds-m{width:66.66667%}.w-auto-m{width:auto}.overflow-visible-m{overflow:visible}.overflow-hidden-m{overflow:hidden}.overflow-scroll-m{overflow:scroll}.overflow-auto-m{overflow:auto}.overflow-x-visible-m{overflow-x:visible}.overflow-x-hidden-m{overflow-x:hidden}.overflow-x-scroll-m{overflow-x:scroll}.overflow-x-auto-m{overflow-x:auto}.overflow-y-visible-m{overflow-y:visible}.overflow-y-hidden-m{overflow-y:hidden}.overflow-y-scroll-m{overflow-y:scroll}.overflow-y-auto-m{overflow-y:auto}.static-m{position:static}.relative-m{position:relative}.absolute-m{position:absolute}.fixed-m{position:fixed}.rotate-45-m{-webkit-transform:rotate(45deg);transform:rotate(45deg)}.rotate-90-m{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.rotate-135-m{-webkit-transform:rotate(135deg);transform:rotate(135deg)}.rotate-180-m{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.rotate-225-m{-webkit-transform:rotate(225deg);transform:rotate(225deg)}.rotate-270-m{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.rotate-315-m{-webkit-transform:rotate(315deg);transform:rotate(315deg)}.pa0-m{padding:0}.pa1-m{padding:.25rem}.pa2-m{padding:.5rem}.pa3-m{padding:1rem}.pa4-m{padding:2rem}.pa5-m{padding:4rem}.pa6-m{padding:8rem}.pa7-m{padding:16rem}.pl0-m{padding-left:0}.pl1-m{padding-left:.25rem}.pl2-m{padding-left:.5rem}.pl3-m{padding-left:1rem}.pl4-m{padding-left:2rem}.pl5-m{padding-left:4rem}.pl6-m{padding-left:8rem}.pl7-m{padding-left:16rem}.pr0-m{padding-right:0}.pr1-m{padding-right:.25rem}.pr2-m{padding-right:.5rem}.pr3-m{padding-right:1rem}.pr4-m{padding-right:2rem}.pr5-m{padding-right:4rem}.pr6-m{padding-right:8rem}.pr7-m{padding-right:16rem}.pb0-m{padding-bottom:0}.pb1-m{padding-bottom:.25rem}.pb2-m{padding-bottom:.5rem}.pb3-m{padding-bottom:1rem}.pb4-m{padding-bottom:2rem}.pb5-m{padding-bottom:4rem}.pb6-m{padding-bottom:8rem}.pb7-m{padding-bottom:16rem}.pt0-m{padding-top:0}.pt1-m{padding-top:.25rem}.pt2-m{padding-top:.5rem}.pt3-m{padding-top:1rem}.pt4-m{padding-top:2rem}.pt5-m{padding-top:4rem}.pt6-m{padding-top:8rem}.pt7-m{padding-top:16rem}.pv0-m{padding-top:0;padding-bottom:0}.pv1-m{padding-top:.25rem;padding-bottom:.25rem}.pv2-m{padding-top:.5rem;padding-bottom:.5rem}.pv3-m{padding-top:1rem;padding-bottom:1rem}.pv4-m{padding-top:2rem;padding-bottom:2rem}.pv5-m{padding-top:4rem;padding-bottom:4rem}.pv6-m{padding-top:8rem;padding-bottom:8rem}.pv7-m{padding-top:16rem;padding-bottom:16rem}.ph0-m{padding-left:0;padding-right:0}.ph1-m{padding-left:.25rem;padding-right:.25rem}.ph2-m{padding-left:.5rem;padding-right:.5rem}.ph3-m{padding-left:1rem;padding-right:1rem}.ph4-m{padding-left:2rem;padding-right:2rem}.ph5-m{padding-left:4rem;padding-right:4rem}.ph6-m{padding-left:8rem;padding-right:8rem}.ph7-m{padding-left:16rem;padding-right:16rem}.ma0-m{margin:0}.ma1-m{margin:.25rem}.ma2-m{margin:.5rem}.ma3-m{margin:1rem}.ma4-m{margin:2rem}.ma5-m{margin:4rem}.ma6-m{margin:8rem}.ma7-m{margin:16rem}.ml0-m{margin-left:0}.ml1-m{margin-left:.25rem}.ml2-m{margin-left:.5rem}.ml3-m{margin-left:1rem}.ml4-m{margin-left:2rem}.ml5-m{margin-left:4rem}.ml6-m{margin-left:8rem}.ml7-m{margin-left:16rem}.mr0-m{margin-right:0}.mr1-m{margin-right:.25rem}.mr2-m{margin-right:.5rem}.mr3-m{margin-right:1rem}.mr4-m{margin-right:2rem}.mr5-m{margin-right:4rem}.mr6-m{margin-right:8rem}.mr7-m{margin-right:16rem}.mb0-m{margin-bottom:0}.mb1-m{margin-bottom:.25rem}.mb2-m{margin-bottom:.5rem}.mb3-m{margin-bottom:1rem}.mb4-m{margin-bottom:2rem}.mb5-m{margin-bottom:4rem}.mb6-m{margin-bottom:8rem}.mb7-m{margin-bottom:16rem}.mt0-m{margin-top:0}.mt1-m{margin-top:.25rem}.mt2-m{margin-top:.5rem}.mt3-m{margin-top:1rem}.mt4-m{margin-top:2rem}.mt5-m{margin-top:4rem}.mt6-m{margin-top:8rem}.mt7-m{margin-top:16rem}.mv0-m{margin-top:0;margin-bottom:0}.mv1-m{margin-top:.25rem;margin-bottom:.25rem}.mv2-m{margin-top:.5rem;margin-bottom:.5rem}.mv3-m{margin-top:1rem;margin-bottom:1rem}.mv4-m{margin-top:2rem;margin-bottom:2rem}.mv5-m{margin-top:4rem;margin-bottom:4rem}.mv6-m{margin-top:8rem;margin-bottom:8rem}.mv7-m{margin-top:16rem;margin-bottom:16rem}.mh0-m{margin-left:0;margin-right:0}.mh1-m{margin-left:.25rem;margin-right:.25rem}.mh2-m{margin-left:.5rem;margin-right:.5rem}.mh3-m{margin-left:1rem;margin-right:1rem}.mh4-m{margin-left:2rem;margin-right:2rem}.mh5-m{margin-left:4rem;margin-right:4rem}.mh6-m{margin-left:8rem;margin-right:8rem}.mh7-m{margin-left:16rem;margin-right:16rem}.na1-m{margin:-.25rem}.na2-m{margin:-.5rem}.na3-m{margin:-1rem}.na4-m{margin:-2rem}.na5-m{margin:-4rem}.na6-m{margin:-8rem}.na7-m{margin:-16rem}.nl1-m{margin-left:-.25rem}.nl2-m{margin-left:-.5rem}.nl3-m{margin-left:-1rem}.nl4-m{margin-left:-2rem}.nl5-m{margin-left:-4rem}.nl6-m{margin-left:-8rem}.nl7-m{margin-left:-16rem}.nr1-m{margin-right:-.25rem}.nr2-m{margin-right:-.5rem}.nr3-m{margin-right:-1rem}.nr4-m{margin-right:-2rem}.nr5-m{margin-right:-4rem}.nr6-m{margin-right:-8rem}.nr7-m{margin-right:-16rem}.nb1-m{margin-bottom:-.25rem}.nb2-m{margin-bottom:-.5rem}.nb3-m{margin-bottom:-1rem}.nb4-m{margin-bottom:-2rem}.nb5-m{margin-bottom:-4rem}.nb6-m{margin-bottom:-8rem}.nb7-m{margin-bottom:-16rem}.nt1-m{margin-top:-.25rem}.nt2-m{margin-top:-.5rem}.nt3-m{margin-top:-1rem}.nt4-m{margin-top:-2rem}.nt5-m{margin-top:-4rem}.nt6-m{margin-top:-8rem}.nt7-m{margin-top:-16rem}.strike-m{text-decoration:line-through}.underline-m{text-decoration:underline}.no-underline-m{text-decoration:none}.tl-m{text-align:left}.tr-m{text-align:right}.tc-m{text-align:center}.tj-m{text-align:justify}.ttc-m{text-transform:capitalize}.ttl-m{text-transform:lowercase}.ttu-m{text-transform:uppercase}.ttn-m{text-transform:none}.f-6-m,.f-headline-m{font-size:6rem}.f-5-m,.f-subheadline-m{font-size:5rem}.f1-m{font-size:3rem}.f2-m{font-size:2.25rem}.f3-m{font-size:1.5rem}.f4-m{font-size:1.25rem}.f5-m{font-size:1rem}.f6-m{font-size:.875rem}.f7-m{font-size:.75rem}.measure-m{max-width:30em}.measure-wide-m{max-width:34em}.measure-narrow-m{max-width:20em}.indent-m{text-indent:1em;margin-top:0;margin-bottom:0}.small-caps-m{font-variant:small-caps}.truncate-m{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.center-m{margin-left:auto}.center-m,.mr-auto-m{margin-right:auto}.ml-auto-m{margin-left:auto}.clip-m{position:fixed!important;_position:absolute!important;clip:rect(1px 1px 1px 1px);clip:rect(1px,1px,1px,1px)}.ws-normal-m{white-space:normal}.nowrap-m{white-space:nowrap}.pre-m{white-space:pre}.v-base-m{vertical-align:baseline}.v-mid-m{vertical-align:middle}.v-top-m{vertical-align:top}.v-btm-m{vertical-align:bottom}}@media screen and (min-width:60em){.aspect-ratio-l{height:0;position:relative}.aspect-ratio--16x9-l{padding-bottom:56.25%}.aspect-ratio--9x16-l{padding-bottom:177.77%}.aspect-ratio--4x3-l{padding-bottom:75%}.aspect-ratio--3x4-l{padding-bottom:133.33%}.aspect-ratio--6x4-l{padding-bottom:66.6%}.aspect-ratio--4x6-l{padding-bottom:150%}.aspect-ratio--8x5-l{padding-bottom:62.5%}.aspect-ratio--5x8-l{padding-bottom:160%}.aspect-ratio--7x5-l{padding-bottom:71.42%}.aspect-ratio--5x7-l{padding-bottom:140%}.aspect-ratio--1x1-l{padding-bottom:100%}.aspect-ratio--object-l{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;z-index:100}.cover-l{background-size:cover!important}.contain-l{background-size:contain!important}.bg-center-l{background-position:50%}.bg-center-l,.bg-top-l{background-repeat:no-repeat}.bg-top-l{background-position:top}.bg-right-l{background-position:100%}.bg-bottom-l,.bg-right-l{background-repeat:no-repeat}.bg-bottom-l{background-position:bottom}.bg-left-l{background-repeat:no-repeat;background-position:0}.outline-l{outline:1px solid}.outline-transparent-l{outline:1px solid transparent}.outline-0-l{outline:0}.ba-l{border-style:solid;border-width:1px}.bt-l{border-top-style:solid;border-top-width:1px}.br-l{border-right-style:solid;border-right-width:1px}.bb-l{border-bottom-style:solid;border-bottom-width:1px}.bl-l{border-left-style:solid;border-left-width:1px}.bn-l{border-style:none;border-width:0}.br0-l{border-radius:0}.br1-l{border-radius:.125rem}.br2-l{border-radius:.25rem}.br3-l{border-radius:.5rem}.br4-l{border-radius:1rem}.br-100-l{border-radius:100%}.br-pill-l{border-radius:9999px}.br--bottom-l{border-top-left-radius:0;border-top-right-radius:0}.br--top-l{border-bottom-right-radius:0}.br--right-l,.br--top-l{border-bottom-left-radius:0}.br--right-l{border-top-left-radius:0}.br--left-l{border-top-right-radius:0;border-bottom-right-radius:0}.b--dotted-l{border-style:dotted}.b--dashed-l{border-style:dashed}.b--solid-l{border-style:solid}.b--none-l{border-style:none}.bw0-l{border-width:0}.bw1-l{border-width:.125rem}.bw2-l{border-width:.25rem}.bw3-l{border-width:.5rem}.bw4-l{border-width:1rem}.bw5-l{border-width:2rem}.bt-0-l{border-top-width:0}.br-0-l{border-right-width:0}.bb-0-l{border-bottom-width:0}.bl-0-l{border-left-width:0}.shadow-1-l{box-shadow:0 0 4px 2px rgba(0,0,0,.2)}.shadow-2-l{box-shadow:0 0 8px 2px rgba(0,0,0,.2)}.shadow-3-l{box-shadow:2px 2px 4px 2px rgba(0,0,0,.2)}.shadow-4-l{box-shadow:2px 2px 8px 0 rgba(0,0,0,.2)}.shadow-5-l{box-shadow:4px 4px 8px 0 rgba(0,0,0,.2)}.top-0-l{top:0}.left-0-l{left:0}.right-0-l{right:0}.bottom-0-l{bottom:0}.top-1-l{top:1rem}.left-1-l{left:1rem}.right-1-l{right:1rem}.bottom-1-l{bottom:1rem}.top-2-l{top:2rem}.left-2-l{left:2rem}.right-2-l{right:2rem}.bottom-2-l{bottom:2rem}.top--1-l{top:-1rem}.right--1-l{right:-1rem}.bottom--1-l{bottom:-1rem}.left--1-l{left:-1rem}.top--2-l{top:-2rem}.right--2-l{right:-2rem}.bottom--2-l{bottom:-2rem}.left--2-l{left:-2rem}.absolute--fill-l{top:0;right:0;bottom:0;left:0}.cl-l{clear:left}.cr-l{clear:right}.cb-l{clear:both}.cn-l{clear:none}.dn-l{display:none}.di-l{display:inline}.db-l{display:block}.dib-l{display:inline-block}.dit-l{display:inline-table}.dt-l{display:table}.dtc-l{display:table-cell}.dt-row-l{display:table-row}.dt-row-group-l{display:table-row-group}.dt-column-l{display:table-column}.dt-column-group-l{display:table-column-group}.dt--fixed-l{table-layout:fixed;width:100%}.flex-l{display:flex}.inline-flex-l{display:inline-flex}.flex-auto-l{flex:1 1 auto;min-width:0;min-height:0}.flex-none-l{flex:none}.flex-column-l{flex-direction:column}.flex-row-l{flex-direction:row}.flex-wrap-l{flex-wrap:wrap}.flex-nowrap-l{flex-wrap:nowrap}.flex-wrap-reverse-l{flex-wrap:wrap-reverse}.flex-column-reverse-l{flex-direction:column-reverse}.flex-row-reverse-l{flex-direction:row-reverse}.items-start-l{align-items:flex-start}.items-end-l{align-items:flex-end}.items-center-l{align-items:center}.items-baseline-l{align-items:baseline}.items-stretch-l{align-items:stretch}.self-start-l{align-self:flex-start}.self-end-l{align-self:flex-end}.self-center-l{align-self:center}.self-baseline-l{align-self:baseline}.self-stretch-l{align-self:stretch}.justify-start-l{justify-content:flex-start}.justify-end-l{justify-content:flex-end}.justify-center-l{justify-content:center}.justify-between-l{justify-content:space-between}.justify-around-l{justify-content:space-around}.content-start-l{align-content:flex-start}.content-end-l{align-content:flex-end}.content-center-l{align-content:center}.content-between-l{align-content:space-between}.content-around-l{align-content:space-around}.content-stretch-l{align-content:stretch}.order-0-l{order:0}.order-1-l{order:1}.order-2-l{order:2}.order-3-l{order:3}.order-4-l{order:4}.order-5-l{order:5}.order-6-l{order:6}.order-7-l{order:7}.order-8-l{order:8}.order-last-l{order:99999}.flex-grow-0-l{flex-grow:0}.flex-grow-1-l{flex-grow:1}.flex-shrink-0-l{flex-shrink:0}.flex-shrink-1-l{flex-shrink:1}.fl-l{float:left}.fl-l,.fr-l{_display:inline}.fr-l{float:right}.fn-l{float:none}.i-l{font-style:italic}.fs-normal-l{font-style:normal}.normal-l{font-weight:400}.b-l{font-weight:700}.fw1-l{font-weight:100}.fw2-l{font-weight:200}.fw3-l{font-weight:300}.fw4-l{font-weight:400}.fw5-l{font-weight:500}.fw6-l{font-weight:600}.fw7-l{font-weight:700}.fw8-l{font-weight:800}.fw9-l{font-weight:900}.h1-l{height:1rem}.h2-l{height:2rem}.h3-l{height:4rem}.h4-l{height:8rem}.h5-l{height:16rem}.h-25-l{height:25%}.h-50-l{height:50%}.h-75-l{height:75%}.h-100-l{height:100%}.min-h-100-l{min-height:100%}.vh-25-l{height:25vh}.vh-50-l{height:50vh}.vh-75-l{height:75vh}.vh-100-l{height:100vh}.min-vh-100-l{min-height:100vh}.h-auto-l{height:auto}.h-inherit-l{height:inherit}.tracked-l{letter-spacing:.1em}.tracked-tight-l{letter-spacing:-.05em}.tracked-mega-l{letter-spacing:.25em}.lh-solid-l{line-height:1}.lh-title-l{line-height:1.25}.lh-copy-l{line-height:1.5}.mw-100-l{max-width:100%}.mw1-l{max-width:1rem}.mw2-l{max-width:2rem}.mw3-l{max-width:4rem}.mw4-l{max-width:8rem}.mw5-l{max-width:16rem}.mw6-l{max-width:32rem}.mw7-l{max-width:48rem}.mw8-l{max-width:64rem}.mw9-l{max-width:96rem}.mw-none-l{max-width:none}.w1-l{width:1rem}.w2-l{width:2rem}.w3-l{width:4rem}.w4-l{width:8rem}.w5-l{width:16rem}.w-10-l{width:10%}.w-20-l{width:20%}.w-25-l{width:25%}.w-30-l{width:30%}.w-33-l{width:33%}.w-34-l{width:34%}.w-40-l{width:40%}.w-50-l{width:50%}.w-60-l{width:60%}.w-70-l{width:70%}.w-75-l{width:75%}.w-80-l{width:80%}.w-90-l{width:90%}.w-100-l{width:100%}.w-third-l{width:33.33333%}.w-two-thirds-l{width:66.66667%}.w-auto-l{width:auto}.overflow-visible-l{overflow:visible}.overflow-hidden-l{overflow:hidden}.overflow-scroll-l{overflow:scroll}.overflow-auto-l{overflow:auto}.overflow-x-visible-l{overflow-x:visible}.overflow-x-hidden-l{overflow-x:hidden}.overflow-x-scroll-l{overflow-x:scroll}.overflow-x-auto-l{overflow-x:auto}.overflow-y-visible-l{overflow-y:visible}.overflow-y-hidden-l{overflow-y:hidden}.overflow-y-scroll-l{overflow-y:scroll}.overflow-y-auto-l{overflow-y:auto}.static-l{position:static}.relative-l{position:relative}.absolute-l{position:absolute}.fixed-l{position:fixed}.rotate-45-l{-webkit-transform:rotate(45deg);transform:rotate(45deg)}.rotate-90-l{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.rotate-135-l{-webkit-transform:rotate(135deg);transform:rotate(135deg)}.rotate-180-l{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.rotate-225-l{-webkit-transform:rotate(225deg);transform:rotate(225deg)}.rotate-270-l{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.rotate-315-l{-webkit-transform:rotate(315deg);transform:rotate(315deg)}.pa0-l{padding:0}.pa1-l{padding:.25rem}.pa2-l{padding:.5rem}.pa3-l{padding:1rem}.pa4-l{padding:2rem}.pa5-l{padding:4rem}.pa6-l{padding:8rem}.pa7-l{padding:16rem}.pl0-l{padding-left:0}.pl1-l{padding-left:.25rem}.pl2-l{padding-left:.5rem}.pl3-l{padding-left:1rem}.pl4-l{padding-left:2rem}.pl5-l{padding-left:4rem}.pl6-l{padding-left:8rem}.pl7-l{padding-left:16rem}.pr0-l{padding-right:0}.pr1-l{padding-right:.25rem}.pr2-l{padding-right:.5rem}.pr3-l{padding-right:1rem}.pr4-l{padding-right:2rem}.pr5-l{padding-right:4rem}.pr6-l{padding-right:8rem}.pr7-l{padding-right:16rem}.pb0-l{padding-bottom:0}.pb1-l{padding-bottom:.25rem}.pb2-l{padding-bottom:.5rem}.pb3-l{padding-bottom:1rem}.pb4-l{padding-bottom:2rem}.pb5-l{padding-bottom:4rem}.pb6-l{padding-bottom:8rem}.pb7-l{padding-bottom:16rem}.pt0-l{padding-top:0}.pt1-l{padding-top:.25rem}.pt2-l{padding-top:.5rem}.pt3-l{padding-top:1rem}.pt4-l{padding-top:2rem}.pt5-l{padding-top:4rem}.pt6-l{padding-top:8rem}.pt7-l{padding-top:16rem}.pv0-l{padding-top:0;padding-bottom:0}.pv1-l{padding-top:.25rem;padding-bottom:.25rem}.pv2-l{padding-top:.5rem;padding-bottom:.5rem}.pv3-l{padding-top:1rem;padding-bottom:1rem}.pv4-l{padding-top:2rem;padding-bottom:2rem}.pv5-l{padding-top:4rem;padding-bottom:4rem}.pv6-l{padding-top:8rem;padding-bottom:8rem}.pv7-l{padding-top:16rem;padding-bottom:16rem}.ph0-l{padding-left:0;padding-right:0}.ph1-l{padding-left:.25rem;padding-right:.25rem}.ph2-l{padding-left:.5rem;padding-right:.5rem}.ph3-l{padding-left:1rem;padding-right:1rem}.ph4-l{padding-left:2rem;padding-right:2rem}.ph5-l{padding-left:4rem;padding-right:4rem}.ph6-l{padding-left:8rem;padding-right:8rem}.ph7-l{padding-left:16rem;padding-right:16rem}.ma0-l{margin:0}.ma1-l{margin:.25rem}.ma2-l{margin:.5rem}.ma3-l{margin:1rem}.ma4-l{margin:2rem}.ma5-l{margin:4rem}.ma6-l{margin:8rem}.ma7-l{margin:16rem}.ml0-l{margin-left:0}.ml1-l{margin-left:.25rem}.ml2-l{margin-left:.5rem}.ml3-l{margin-left:1rem}.ml4-l{margin-left:2rem}.ml5-l{margin-left:4rem}.ml6-l{margin-left:8rem}.ml7-l{margin-left:16rem}.mr0-l{margin-right:0}.mr1-l{margin-right:.25rem}.mr2-l{margin-right:.5rem}.mr3-l{margin-right:1rem}.mr4-l{margin-right:2rem}.mr5-l{margin-right:4rem}.mr6-l{margin-right:8rem}.mr7-l{margin-right:16rem}.mb0-l{margin-bottom:0}.mb1-l{margin-bottom:.25rem}.mb2-l{margin-bottom:.5rem}.mb3-l{margin-bottom:1rem}.mb4-l{margin-bottom:2rem}.mb5-l{margin-bottom:4rem}.mb6-l{margin-bottom:8rem}.mb7-l{margin-bottom:16rem}.mt0-l{margin-top:0}.mt1-l{margin-top:.25rem}.mt2-l{margin-top:.5rem}.mt3-l{margin-top:1rem}.mt4-l{margin-top:2rem}.mt5-l{margin-top:4rem}.mt6-l{margin-top:8rem}.mt7-l{margin-top:16rem}.mv0-l{margin-top:0;margin-bottom:0}.mv1-l{margin-top:.25rem;margin-bottom:.25rem}.mv2-l{margin-top:.5rem;margin-bottom:.5rem}.mv3-l{margin-top:1rem;margin-bottom:1rem}.mv4-l{margin-top:2rem;margin-bottom:2rem}.mv5-l{margin-top:4rem;margin-bottom:4rem}.mv6-l{margin-top:8rem;margin-bottom:8rem}.mv7-l{margin-top:16rem;margin-bottom:16rem}.mh0-l{margin-left:0;margin-right:0}.mh1-l{margin-left:.25rem;margin-right:.25rem}.mh2-l{margin-left:.5rem;margin-right:.5rem}.mh3-l{margin-left:1rem;margin-right:1rem}.mh4-l{margin-left:2rem;margin-right:2rem}.mh5-l{margin-left:4rem;margin-right:4rem}.mh6-l{margin-left:8rem;margin-right:8rem}.mh7-l{margin-left:16rem;margin-right:16rem}.na1-l{margin:-.25rem}.na2-l{margin:-.5rem}.na3-l{margin:-1rem}.na4-l{margin:-2rem}.na5-l{margin:-4rem}.na6-l{margin:-8rem}.na7-l{margin:-16rem}.nl1-l{margin-left:-.25rem}.nl2-l{margin-left:-.5rem}.nl3-l{margin-left:-1rem}.nl4-l{margin-left:-2rem}.nl5-l{margin-left:-4rem}.nl6-l{margin-left:-8rem}.nl7-l{margin-left:-16rem}.nr1-l{margin-right:-.25rem}.nr2-l{margin-right:-.5rem}.nr3-l{margin-right:-1rem}.nr4-l{margin-right:-2rem}.nr5-l{margin-right:-4rem}.nr6-l{margin-right:-8rem}.nr7-l{margin-right:-16rem}.nb1-l{margin-bottom:-.25rem}.nb2-l{margin-bottom:-.5rem}.nb3-l{margin-bottom:-1rem}.nb4-l{margin-bottom:-2rem}.nb5-l{margin-bottom:-4rem}.nb6-l{margin-bottom:-8rem}.nb7-l{margin-bottom:-16rem}.nt1-l{margin-top:-.25rem}.nt2-l{margin-top:-.5rem}.nt3-l{margin-top:-1rem}.nt4-l{margin-top:-2rem}.nt5-l{margin-top:-4rem}.nt6-l{margin-top:-8rem}.nt7-l{margin-top:-16rem}.strike-l{text-decoration:line-through}.underline-l{text-decoration:underline}.no-underline-l{text-decoration:none}.tl-l{text-align:left}.tr-l{text-align:right}.tc-l{text-align:center}.tj-l{text-align:justify}.ttc-l{text-transform:capitalize}.ttl-l{text-transform:lowercase}.ttu-l{text-transform:uppercase}.ttn-l{text-transform:none}.f-6-l,.f-headline-l{font-size:6rem}.f-5-l,.f-subheadline-l{font-size:5rem}.f1-l{font-size:3rem}.f2-l{font-size:2.25rem}.f3-l{font-size:1.5rem}.f4-l{font-size:1.25rem}.f5-l{font-size:1rem}.f6-l{font-size:.875rem}.f7-l{font-size:.75rem}.measure-l{max-width:30em}.measure-wide-l{max-width:34em}.measure-narrow-l{max-width:20em}.indent-l{text-indent:1em;margin-top:0;margin-bottom:0}.small-caps-l{font-variant:small-caps}.truncate-l{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.center-l{margin-left:auto}.center-l,.mr-auto-l{margin-right:auto}.ml-auto-l{margin-left:auto}.clip-l{position:fixed!important;_position:absolute!important;clip:rect(1px 1px 1px 1px);clip:rect(1px,1px,1px,1px)}.ws-normal-l{white-space:normal}.nowrap-l{white-space:nowrap}.pre-l{white-space:pre}.v-base-l{vertical-align:baseline}.v-mid-l{vertical-align:middle}.v-top-l{vertical-align:top}.v-btm-l{vertical-align:bottom}}@font-face{font-family:Inter;font-style:normal;font-weight:400;src:url(https://media.urbit.org/fonts/Inter-Regular.woff2) format("woff2")}@font-face{font-family:Inter;font-style:italic;font-weight:400;src:url(https://media.urbit.org/fonts/Inter-Italic.woff2) format("woff2")}@font-face{font-family:Inter;font-style:normal;font-weight:700;src:url(https://media.urbit.org/fonts/Inter-Bold.woff2) format("woff2")}@font-face{font-family:Inter;font-style:italic;font-weight:700;src:url(https://media.urbit.org/fonts/Inter-BoldItalic.woff2) format("woff2")}@font-face{font-family:Source Code Pro;src:url(https://storage.googleapis.com/media.urbit.org/fonts/scp-extralight.woff);font-weight:200}@font-face{font-family:Source Code Pro;src:url(https://storage.googleapis.com/media.urbit.org/fonts/scp-light.woff);font-weight:300}@font-face{font-family:Source Code Pro;src:url(https://storage.googleapis.com/media.urbit.org/fonts/scp-regular.woff);font-weight:400}@font-face{font-family:Source Code Pro;src:url(https://storage.googleapis.com/media.urbit.org/fonts/scp-medium.woff);font-weight:500}@font-face{font-family:Source Code Pro;src:url(https://storage.googleapis.com/media.urbit.org/fonts/scp-semibold.woff);font-weight:600}@font-face{font-family:Source Code Pro;src:url(https://storage.googleapis.com/media.urbit.org/fonts/scp-bold.woff);font-weight:700}.spinner-pending{position:relative;background-color:#fff}.spinner-pending,.spinner-pending:after{content:"";border-radius:100%;height:16px;width:16px}.spinner-pending:after{background-color:grey;position:absolute;clip:rect(0,16px,16px,8px);animation:spin 1s cubic-bezier(.745,.045,.355,1) infinite}@keyframes spin{0%{transform:rotate(0deg)}25%{transform:rotate(90deg)}50%{transform:rotate(180deg)}75%{transform:rotate(270deg)}to{transform:rotate(1turn)}}.spinner-nostart{width:8px;height:8px;border-radius:100%;content:"";background-color:#000}a,button,h1,h2,h3,h4,h5,h6,input,p,textarea{margin-block-end:unset;margin-block-start:unset;-webkit-margin-before:unset;-webkit-margin-after:unset;font-family:Inter,sans-serif;padding:0}button,input,select,textarea{outline:none;-webkit-appearance:none;border:none;background-color:#fff}a{color:#000!important;font-weight:400!important}h2{font-size:32px;line-height:48px;font-weight:700}.body-regular{font-size:16px;line-height:24px;font-weight:600}.body-large{font-size:20px;line-height:24px}.body-medium{font-size:16px;line-height:19px}.body-small{font-size:12px;line-height:16px;color:#7f7f7f}.label-regular,.label-small{font-size:14px;line-height:24px}.label-small-mono{font-size:12px;line-height:24px;font-family:Source Code Pro,monospace}.body-regular-400{font-size:16px;line-height:24px;font-weight:400}.plus-font{font-size:32px;line-height:24px}.btn-font{font-size:14px;line-height:16px;font-weight:600!important}.fw-normal{font-weight:400}.fw-bold{font-weight:700}.fs-italic{font-style:italic}.td-underline{text-decoration:underline}.bg-v-light-gray{background-color:#f9f9f9}.nice-green{color:#2aa779!important}.bg-nice-green{background:#2ed196}.nice-red{color:#ee5432!important}.inter{font-family:Inter,sans-serif}.clamp-3{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;-webkit-line-clamp:2;-webkit-box-orient:vertical}.clamp-message{max-width:calc(100% - 36px - 1.5rem)}.clamp-attachment{overflow:scroll;max-height:10em;max-width:100%}.lh-16{line-height:16px}.mono{font-family:Source Code Pro,monospace}.label-small-mono.list-ship{line-height:29px} \ No newline at end of file +/*! normalize.css v8.0.0 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}[hidden],template{display:none}.border-box,a,article,aside,blockquote,body,code,dd,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,html,input[type=email],input[type=number],input[type=password],input[type=tel],input[type=text],input[type=url],legend,li,main,nav,ol,p,pre,section,table,td,textarea,th,tr,ul{box-sizing:border-box}.aspect-ratio{height:0;position:relative}.aspect-ratio--16x9{padding-bottom:56.25%}.aspect-ratio--9x16{padding-bottom:177.77%}.aspect-ratio--4x3{padding-bottom:75%}.aspect-ratio--3x4{padding-bottom:133.33%}.aspect-ratio--6x4{padding-bottom:66.6%}.aspect-ratio--4x6{padding-bottom:150%}.aspect-ratio--8x5{padding-bottom:62.5%}.aspect-ratio--5x8{padding-bottom:160%}.aspect-ratio--7x5{padding-bottom:71.42%}.aspect-ratio--5x7{padding-bottom:140%}.aspect-ratio--1x1{padding-bottom:100%}.aspect-ratio--object{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;z-index:100}img{max-width:100%}.cover{background-size:cover!important}.contain{background-size:contain!important}.bg-center{background-position:50%}.bg-center,.bg-top{background-repeat:no-repeat}.bg-top{background-position:top}.bg-right{background-position:100%}.bg-bottom,.bg-right{background-repeat:no-repeat}.bg-bottom{background-position:bottom}.bg-left{background-repeat:no-repeat;background-position:0}.outline{outline:1px solid}.outline-transparent{outline:1px solid transparent}.outline-0{outline:0}.ba{border-style:solid;border-width:1px}.bt{border-top-style:solid;border-top-width:1px}.br{border-right-style:solid;border-right-width:1px}.bb{border-bottom-style:solid;border-bottom-width:1px}.bl{border-left-style:solid;border-left-width:1px}.bn{border-style:none;border-width:0}.b--black{border-color:#000}.b--near-black{border-color:#111}.b--dark-gray{border-color:#333}.b--mid-gray{border-color:#555}.b--gray{border-color:#777}.b--silver{border-color:#999}.b--light-silver{border-color:#aaa}.b--moon-gray{border-color:#ccc}.b--light-gray{border-color:#eee}.b--near-white{border-color:#f4f4f4}.b--white{border-color:#fff}.b--white-90{border-color:hsla(0,0%,100%,.9)}.b--white-80{border-color:hsla(0,0%,100%,.8)}.b--white-70{border-color:hsla(0,0%,100%,.7)}.b--white-60{border-color:hsla(0,0%,100%,.6)}.b--white-50{border-color:hsla(0,0%,100%,.5)}.b--white-40{border-color:hsla(0,0%,100%,.4)}.b--white-30{border-color:hsla(0,0%,100%,.3)}.b--white-20{border-color:hsla(0,0%,100%,.2)}.b--white-10{border-color:hsla(0,0%,100%,.1)}.b--white-05{border-color:hsla(0,0%,100%,.05)}.b--white-025{border-color:hsla(0,0%,100%,.025)}.b--white-0125{border-color:hsla(0,0%,100%,.0125)}.b--black-90{border-color:rgba(0,0,0,.9)}.b--black-80{border-color:rgba(0,0,0,.8)}.b--black-70{border-color:rgba(0,0,0,.7)}.b--black-60{border-color:rgba(0,0,0,.6)}.b--black-50{border-color:rgba(0,0,0,.5)}.b--black-40{border-color:rgba(0,0,0,.4)}.b--black-30{border-color:rgba(0,0,0,.3)}.b--black-20{border-color:rgba(0,0,0,.2)}.b--black-10{border-color:rgba(0,0,0,.1)}.b--black-05{border-color:rgba(0,0,0,.05)}.b--black-025{border-color:rgba(0,0,0,.025)}.b--black-0125{border-color:rgba(0,0,0,.0125)}.b--dark-red{border-color:#e7040f}.b--red{border-color:#ff4136}.b--light-red{border-color:#ff725c}.b--orange{border-color:#ff6300}.b--gold{border-color:#ffb700}.b--yellow{border-color:gold}.b--light-yellow{border-color:#fbf1a9}.b--purple{border-color:#5e2ca5}.b--light-purple{border-color:#a463f2}.b--dark-pink{border-color:#d5008f}.b--hot-pink{border-color:#ff41b4}.b--pink{border-color:#ff80cc}.b--light-pink{border-color:#ffa3d7}.b--dark-green{border-color:#137752}.b--green{border-color:#19a974}.b--light-green{border-color:#9eebcf}.b--navy{border-color:#001b44}.b--dark-blue{border-color:#00449e}.b--blue{border-color:#357edd}.b--light-blue{border-color:#96ccff}.b--lightest-blue{border-color:#cdecff}.b--washed-blue{border-color:#f6fffe}.b--washed-green{border-color:#e8fdf5}.b--washed-yellow{border-color:#fffceb}.b--washed-red{border-color:#ffdfdf}.b--transparent{border-color:transparent}.b--inherit{border-color:inherit}.br0{border-radius:0}.br1{border-radius:.125rem}.br2{border-radius:.25rem}.br3{border-radius:.5rem}.br4{border-radius:1rem}.br-100{border-radius:100%}.br-pill{border-radius:9999px}.br--bottom{border-top-left-radius:0;border-top-right-radius:0}.br--top{border-bottom-right-radius:0}.br--right,.br--top{border-bottom-left-radius:0}.br--right{border-top-left-radius:0}.br--left{border-top-right-radius:0;border-bottom-right-radius:0}.b--dotted{border-style:dotted}.b--dashed{border-style:dashed}.b--solid{border-style:solid}.b--none{border-style:none}.bw0{border-width:0}.bw1{border-width:.125rem}.bw2{border-width:.25rem}.bw3{border-width:.5rem}.bw4{border-width:1rem}.bw5{border-width:2rem}.bt-0{border-top-width:0}.br-0{border-right-width:0}.bb-0{border-bottom-width:0}.bl-0{border-left-width:0}.shadow-1{box-shadow:0 0 4px 2px rgba(0,0,0,.2)}.shadow-2{box-shadow:0 0 8px 2px rgba(0,0,0,.2)}.shadow-3{box-shadow:2px 2px 4px 2px rgba(0,0,0,.2)}.shadow-4{box-shadow:2px 2px 8px 0 rgba(0,0,0,.2)}.shadow-5{box-shadow:4px 4px 8px 0 rgba(0,0,0,.2)}.pre{overflow-x:auto;overflow-y:hidden;overflow:scroll}.top-0{top:0}.right-0{right:0}.bottom-0{bottom:0}.left-0{left:0}.top-1{top:1rem}.right-1{right:1rem}.bottom-1{bottom:1rem}.left-1{left:1rem}.top-2{top:2rem}.right-2{right:2rem}.bottom-2{bottom:2rem}.left-2{left:2rem}.top--1{top:-1rem}.right--1{right:-1rem}.bottom--1{bottom:-1rem}.left--1{left:-1rem}.top--2{top:-2rem}.right--2{right:-2rem}.bottom--2{bottom:-2rem}.left--2{left:-2rem}.absolute--fill{top:0;right:0;bottom:0;left:0}.cf:after,.cf:before{content:" ";display:table}.cf:after{clear:both}.cf{*zoom:1}.cl{clear:left}.cr{clear:right}.cb{clear:both}.cn{clear:none}.dn{display:none}.di{display:inline}.db{display:block}.dib{display:inline-block}.dit{display:inline-table}.dt{display:table}.dtc{display:table-cell}.dt-row{display:table-row}.dt-row-group{display:table-row-group}.dt-column{display:table-column}.dt-column-group{display:table-column-group}.dt--fixed{table-layout:fixed;width:100%}.flex{display:flex}.inline-flex{display:inline-flex}.flex-auto{flex:1 1 auto;min-width:0;min-height:0}.flex-none{flex:none}.flex-column{flex-direction:column}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.flex-nowrap{flex-wrap:nowrap}.flex-wrap-reverse{flex-wrap:wrap-reverse}.flex-column-reverse{flex-direction:column-reverse}.flex-row-reverse{flex-direction:row-reverse}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.self-start{align-self:flex-start}.self-end{align-self:flex-end}.self-center{align-self:center}.self-baseline{align-self:baseline}.self-stretch{align-self:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-around{justify-content:space-around}.content-start{align-content:flex-start}.content-end{align-content:flex-end}.content-center{align-content:center}.content-between{align-content:space-between}.content-around{align-content:space-around}.content-stretch{align-content:stretch}.order-0{order:0}.order-1{order:1}.order-2{order:2}.order-3{order:3}.order-4{order:4}.order-5{order:5}.order-6{order:6}.order-7{order:7}.order-8{order:8}.order-last{order:99999}.flex-grow-0{flex-grow:0}.flex-grow-1{flex-grow:1}.flex-shrink-0{flex-shrink:0}.flex-shrink-1{flex-shrink:1}.fl{float:left}.fl,.fr{_display:inline}.fr{float:right}.fn{float:none}.sans-serif{font-family:-apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif}.serif{font-family:georgia,times,serif}.system-sans-serif{font-family:sans-serif}.system-serif{font-family:serif}.code,code{font-family:Consolas,monaco,monospace}.courier{font-family:Courier Next,courier,monospace}.helvetica{font-family:helvetica neue,helvetica,sans-serif}.avenir{font-family:avenir next,avenir,sans-serif}.athelas{font-family:athelas,georgia,serif}.georgia{font-family:georgia,serif}.times{font-family:times,serif}.bodoni{font-family:Bodoni MT,serif}.calisto{font-family:Calisto MT,serif}.garamond{font-family:garamond,serif}.baskerville{font-family:baskerville,serif}.i{font-style:italic}.fs-normal{font-style:normal}.normal{font-weight:400}.b{font-weight:700}.fw1{font-weight:100}.fw2{font-weight:200}.fw3{font-weight:300}.fw4{font-weight:400}.fw5{font-weight:500}.fw6{font-weight:600}.fw7{font-weight:700}.fw8{font-weight:800}.fw9{font-weight:900}.input-reset{-webkit-appearance:none;-moz-appearance:none}.button-reset::-moz-focus-inner,.input-reset::-moz-focus-inner{border:0;padding:0}.h1{height:1rem}.h2{height:2rem}.h3{height:4rem}.h4{height:8rem}.h5{height:16rem}.h-25{height:25%}.h-50{height:50%}.h-75{height:75%}.h-100{height:100%}.min-h-100{min-height:100%}.vh-25{height:25vh}.vh-50{height:50vh}.vh-75{height:75vh}.vh-100{height:100vh}.min-vh-100{min-height:100vh}.h-auto{height:auto}.h-inherit{height:inherit}.tracked{letter-spacing:.1em}.tracked-tight{letter-spacing:-.05em}.tracked-mega{letter-spacing:.25em}.lh-solid{line-height:1}.lh-title{line-height:1.25}.lh-copy{line-height:1.5}.link{text-decoration:none}.link,.link:active,.link:focus,.link:hover,.link:link,.link:visited{transition:color .15s ease-in}.link:focus{outline:1px dotted currentColor}.list{list-style-type:none}.mw-100{max-width:100%}.mw1{max-width:1rem}.mw2{max-width:2rem}.mw3{max-width:4rem}.mw4{max-width:8rem}.mw5{max-width:16rem}.mw6{max-width:32rem}.mw7{max-width:48rem}.mw8{max-width:64rem}.mw9{max-width:96rem}.mw-none{max-width:none}.w1{width:1rem}.w2{width:2rem}.w3{width:4rem}.w4{width:8rem}.w5{width:16rem}.w-10{width:10%}.w-20{width:20%}.w-25{width:25%}.w-30{width:30%}.w-33{width:33%}.w-34{width:34%}.w-40{width:40%}.w-50{width:50%}.w-60{width:60%}.w-70{width:70%}.w-75{width:75%}.w-80{width:80%}.w-90{width:90%}.w-100{width:100%}.w-third{width:33.33333%}.w-two-thirds{width:66.66667%}.w-auto{width:auto}.overflow-visible{overflow:visible}.overflow-hidden{overflow:hidden}.overflow-scroll{overflow:scroll}.overflow-auto{overflow:auto}.overflow-x-visible{overflow-x:visible}.overflow-x-hidden{overflow-x:hidden}.overflow-x-scroll{overflow-x:scroll}.overflow-x-auto{overflow-x:auto}.overflow-y-visible{overflow-y:visible}.overflow-y-hidden{overflow-y:hidden}.overflow-y-scroll{overflow-y:scroll}.overflow-y-auto{overflow-y:auto}.static{position:static}.relative{position:relative}.absolute{position:absolute}.fixed{position:fixed}.o-100{opacity:1}.o-90{opacity:.9}.o-80{opacity:.8}.o-70{opacity:.7}.o-60{opacity:.6}.o-50{opacity:.5}.o-40{opacity:.4}.o-30{opacity:.3}.o-20{opacity:.2}.o-10{opacity:.1}.o-05{opacity:.05}.o-025{opacity:.025}.o-0{opacity:0}.rotate-45{-webkit-transform:rotate(45deg);transform:rotate(45deg)}.rotate-90{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.rotate-135{-webkit-transform:rotate(135deg);transform:rotate(135deg)}.rotate-180{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.rotate-225{-webkit-transform:rotate(225deg);transform:rotate(225deg)}.rotate-270{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.rotate-315{-webkit-transform:rotate(315deg);transform:rotate(315deg)}.black-90{color:rgba(0,0,0,.9)}.black-80{color:rgba(0,0,0,.8)}.black-70{color:rgba(0,0,0,.7)}.black-60{color:rgba(0,0,0,.6)}.black-50{color:rgba(0,0,0,.5)}.black-40{color:rgba(0,0,0,.4)}.black-30{color:rgba(0,0,0,.3)}.black-20{color:rgba(0,0,0,.2)}.black-10{color:rgba(0,0,0,.1)}.black-05{color:rgba(0,0,0,.05)}.white-90{color:hsla(0,0%,100%,.9)}.white-80{color:hsla(0,0%,100%,.8)}.white-70{color:hsla(0,0%,100%,.7)}.white-60{color:hsla(0,0%,100%,.6)}.white-50{color:hsla(0,0%,100%,.5)}.white-40{color:hsla(0,0%,100%,.4)}.white-30{color:hsla(0,0%,100%,.3)}.white-20{color:hsla(0,0%,100%,.2)}.white-10{color:hsla(0,0%,100%,.1)}.black{color:#000}.near-black{color:#111}.dark-gray{color:#333}.mid-gray{color:#555}.gray{color:#777}.silver{color:#999}.light-silver{color:#aaa}.moon-gray{color:#ccc}.light-gray{color:#eee}.near-white{color:#f4f4f4}.white{color:#fff}.dark-red{color:#e7040f}.red{color:#ff4136}.light-red{color:#ff725c}.orange{color:#ff6300}.gold{color:#ffb700}.yellow{color:gold}.light-yellow{color:#fbf1a9}.purple{color:#5e2ca5}.light-purple{color:#a463f2}.dark-pink{color:#d5008f}.hot-pink{color:#ff41b4}.pink{color:#ff80cc}.light-pink{color:#ffa3d7}.dark-green{color:#137752}.green{color:#19a974}.light-green{color:#9eebcf}.navy{color:#001b44}.dark-blue{color:#00449e}.blue{color:#357edd}.light-blue{color:#96ccff}.lightest-blue{color:#cdecff}.washed-blue{color:#f6fffe}.washed-green{color:#e8fdf5}.washed-yellow{color:#fffceb}.washed-red{color:#ffdfdf}.color-inherit{color:inherit}.bg-black-90{background-color:rgba(0,0,0,.9)}.bg-black-80{background-color:rgba(0,0,0,.8)}.bg-black-70{background-color:rgba(0,0,0,.7)}.bg-black-60{background-color:rgba(0,0,0,.6)}.bg-black-50{background-color:rgba(0,0,0,.5)}.bg-black-40{background-color:rgba(0,0,0,.4)}.bg-black-30{background-color:rgba(0,0,0,.3)}.bg-black-20{background-color:rgba(0,0,0,.2)}.bg-black-10{background-color:rgba(0,0,0,.1)}.bg-black-05{background-color:rgba(0,0,0,.05)}.bg-white-90{background-color:hsla(0,0%,100%,.9)}.bg-white-80{background-color:hsla(0,0%,100%,.8)}.bg-white-70{background-color:hsla(0,0%,100%,.7)}.bg-white-60{background-color:hsla(0,0%,100%,.6)}.bg-white-50{background-color:hsla(0,0%,100%,.5)}.bg-white-40{background-color:hsla(0,0%,100%,.4)}.bg-white-30{background-color:hsla(0,0%,100%,.3)}.bg-white-20{background-color:hsla(0,0%,100%,.2)}.bg-white-10{background-color:hsla(0,0%,100%,.1)}.bg-black{background-color:#000}.bg-near-black{background-color:#111}.bg-dark-gray{background-color:#333}.bg-mid-gray{background-color:#555}.bg-gray{background-color:#777}.bg-silver{background-color:#999}.bg-light-silver{background-color:#aaa}.bg-moon-gray{background-color:#ccc}.bg-light-gray{background-color:#eee}.bg-near-white{background-color:#f4f4f4}.bg-white{background-color:#fff}.bg-transparent{background-color:transparent}.bg-dark-red{background-color:#e7040f}.bg-red{background-color:#ff4136}.bg-light-red{background-color:#ff725c}.bg-orange{background-color:#ff6300}.bg-gold{background-color:#ffb700}.bg-yellow{background-color:gold}.bg-light-yellow{background-color:#fbf1a9}.bg-purple{background-color:#5e2ca5}.bg-light-purple{background-color:#a463f2}.bg-dark-pink{background-color:#d5008f}.bg-hot-pink{background-color:#ff41b4}.bg-pink{background-color:#ff80cc}.bg-light-pink{background-color:#ffa3d7}.bg-dark-green{background-color:#137752}.bg-green{background-color:#19a974}.bg-light-green{background-color:#9eebcf}.bg-navy{background-color:#001b44}.bg-dark-blue{background-color:#00449e}.bg-blue{background-color:#357edd}.bg-light-blue{background-color:#96ccff}.bg-lightest-blue{background-color:#cdecff}.bg-washed-blue{background-color:#f6fffe}.bg-washed-green{background-color:#e8fdf5}.bg-washed-yellow{background-color:#fffceb}.bg-washed-red{background-color:#ffdfdf}.bg-inherit{background-color:inherit}.hover-black:focus,.hover-black:hover{color:#000}.hover-near-black:focus,.hover-near-black:hover{color:#111}.hover-dark-gray:focus,.hover-dark-gray:hover{color:#333}.hover-mid-gray:focus,.hover-mid-gray:hover{color:#555}.hover-gray:focus,.hover-gray:hover{color:#777}.hover-silver:focus,.hover-silver:hover{color:#999}.hover-light-silver:focus,.hover-light-silver:hover{color:#aaa}.hover-moon-gray:focus,.hover-moon-gray:hover{color:#ccc}.hover-light-gray:focus,.hover-light-gray:hover{color:#eee}.hover-near-white:focus,.hover-near-white:hover{color:#f4f4f4}.hover-white:focus,.hover-white:hover{color:#fff}.hover-black-90:focus,.hover-black-90:hover{color:rgba(0,0,0,.9)}.hover-black-80:focus,.hover-black-80:hover{color:rgba(0,0,0,.8)}.hover-black-70:focus,.hover-black-70:hover{color:rgba(0,0,0,.7)}.hover-black-60:focus,.hover-black-60:hover{color:rgba(0,0,0,.6)}.hover-black-50:focus,.hover-black-50:hover{color:rgba(0,0,0,.5)}.hover-black-40:focus,.hover-black-40:hover{color:rgba(0,0,0,.4)}.hover-black-30:focus,.hover-black-30:hover{color:rgba(0,0,0,.3)}.hover-black-20:focus,.hover-black-20:hover{color:rgba(0,0,0,.2)}.hover-black-10:focus,.hover-black-10:hover{color:rgba(0,0,0,.1)}.hover-white-90:focus,.hover-white-90:hover{color:hsla(0,0%,100%,.9)}.hover-white-80:focus,.hover-white-80:hover{color:hsla(0,0%,100%,.8)}.hover-white-70:focus,.hover-white-70:hover{color:hsla(0,0%,100%,.7)}.hover-white-60:focus,.hover-white-60:hover{color:hsla(0,0%,100%,.6)}.hover-white-50:focus,.hover-white-50:hover{color:hsla(0,0%,100%,.5)}.hover-white-40:focus,.hover-white-40:hover{color:hsla(0,0%,100%,.4)}.hover-white-30:focus,.hover-white-30:hover{color:hsla(0,0%,100%,.3)}.hover-white-20:focus,.hover-white-20:hover{color:hsla(0,0%,100%,.2)}.hover-white-10:focus,.hover-white-10:hover{color:hsla(0,0%,100%,.1)}.hover-inherit:focus,.hover-inherit:hover{color:inherit}.hover-bg-black:focus,.hover-bg-black:hover{background-color:#000}.hover-bg-near-black:focus,.hover-bg-near-black:hover{background-color:#111}.hover-bg-dark-gray:focus,.hover-bg-dark-gray:hover{background-color:#333}.hover-bg-mid-gray:focus,.hover-bg-mid-gray:hover{background-color:#555}.hover-bg-gray:focus,.hover-bg-gray:hover{background-color:#777}.hover-bg-silver:focus,.hover-bg-silver:hover{background-color:#999}.hover-bg-light-silver:focus,.hover-bg-light-silver:hover{background-color:#aaa}.hover-bg-moon-gray:focus,.hover-bg-moon-gray:hover{background-color:#ccc}.hover-bg-light-gray:focus,.hover-bg-light-gray:hover{background-color:#eee}.hover-bg-near-white:focus,.hover-bg-near-white:hover{background-color:#f4f4f4}.hover-bg-white:focus,.hover-bg-white:hover{background-color:#fff}.hover-bg-transparent:focus,.hover-bg-transparent:hover{background-color:transparent}.hover-bg-black-90:focus,.hover-bg-black-90:hover{background-color:rgba(0,0,0,.9)}.hover-bg-black-80:focus,.hover-bg-black-80:hover{background-color:rgba(0,0,0,.8)}.hover-bg-black-70:focus,.hover-bg-black-70:hover{background-color:rgba(0,0,0,.7)}.hover-bg-black-60:focus,.hover-bg-black-60:hover{background-color:rgba(0,0,0,.6)}.hover-bg-black-50:focus,.hover-bg-black-50:hover{background-color:rgba(0,0,0,.5)}.hover-bg-black-40:focus,.hover-bg-black-40:hover{background-color:rgba(0,0,0,.4)}.hover-bg-black-30:focus,.hover-bg-black-30:hover{background-color:rgba(0,0,0,.3)}.hover-bg-black-20:focus,.hover-bg-black-20:hover{background-color:rgba(0,0,0,.2)}.hover-bg-black-10:focus,.hover-bg-black-10:hover{background-color:rgba(0,0,0,.1)}.hover-bg-white-90:focus,.hover-bg-white-90:hover{background-color:hsla(0,0%,100%,.9)}.hover-bg-white-80:focus,.hover-bg-white-80:hover{background-color:hsla(0,0%,100%,.8)}.hover-bg-white-70:focus,.hover-bg-white-70:hover{background-color:hsla(0,0%,100%,.7)}.hover-bg-white-60:focus,.hover-bg-white-60:hover{background-color:hsla(0,0%,100%,.6)}.hover-bg-white-50:focus,.hover-bg-white-50:hover{background-color:hsla(0,0%,100%,.5)}.hover-bg-white-40:focus,.hover-bg-white-40:hover{background-color:hsla(0,0%,100%,.4)}.hover-bg-white-30:focus,.hover-bg-white-30:hover{background-color:hsla(0,0%,100%,.3)}.hover-bg-white-20:focus,.hover-bg-white-20:hover{background-color:hsla(0,0%,100%,.2)}.hover-bg-white-10:focus,.hover-bg-white-10:hover{background-color:hsla(0,0%,100%,.1)}.hover-dark-red:focus,.hover-dark-red:hover{color:#e7040f}.hover-red:focus,.hover-red:hover{color:#ff4136}.hover-light-red:focus,.hover-light-red:hover{color:#ff725c}.hover-orange:focus,.hover-orange:hover{color:#ff6300}.hover-gold:focus,.hover-gold:hover{color:#ffb700}.hover-yellow:focus,.hover-yellow:hover{color:gold}.hover-light-yellow:focus,.hover-light-yellow:hover{color:#fbf1a9}.hover-purple:focus,.hover-purple:hover{color:#5e2ca5}.hover-light-purple:focus,.hover-light-purple:hover{color:#a463f2}.hover-dark-pink:focus,.hover-dark-pink:hover{color:#d5008f}.hover-hot-pink:focus,.hover-hot-pink:hover{color:#ff41b4}.hover-pink:focus,.hover-pink:hover{color:#ff80cc}.hover-light-pink:focus,.hover-light-pink:hover{color:#ffa3d7}.hover-dark-green:focus,.hover-dark-green:hover{color:#137752}.hover-green:focus,.hover-green:hover{color:#19a974}.hover-light-green:focus,.hover-light-green:hover{color:#9eebcf}.hover-navy:focus,.hover-navy:hover{color:#001b44}.hover-dark-blue:focus,.hover-dark-blue:hover{color:#00449e}.hover-blue:focus,.hover-blue:hover{color:#357edd}.hover-light-blue:focus,.hover-light-blue:hover{color:#96ccff}.hover-lightest-blue:focus,.hover-lightest-blue:hover{color:#cdecff}.hover-washed-blue:focus,.hover-washed-blue:hover{color:#f6fffe}.hover-washed-green:focus,.hover-washed-green:hover{color:#e8fdf5}.hover-washed-yellow:focus,.hover-washed-yellow:hover{color:#fffceb}.hover-washed-red:focus,.hover-washed-red:hover{color:#ffdfdf}.hover-bg-dark-red:focus,.hover-bg-dark-red:hover{background-color:#e7040f}.hover-bg-red:focus,.hover-bg-red:hover{background-color:#ff4136}.hover-bg-light-red:focus,.hover-bg-light-red:hover{background-color:#ff725c}.hover-bg-orange:focus,.hover-bg-orange:hover{background-color:#ff6300}.hover-bg-gold:focus,.hover-bg-gold:hover{background-color:#ffb700}.hover-bg-yellow:focus,.hover-bg-yellow:hover{background-color:gold}.hover-bg-light-yellow:focus,.hover-bg-light-yellow:hover{background-color:#fbf1a9}.hover-bg-purple:focus,.hover-bg-purple:hover{background-color:#5e2ca5}.hover-bg-light-purple:focus,.hover-bg-light-purple:hover{background-color:#a463f2}.hover-bg-dark-pink:focus,.hover-bg-dark-pink:hover{background-color:#d5008f}.hover-bg-hot-pink:focus,.hover-bg-hot-pink:hover{background-color:#ff41b4}.hover-bg-pink:focus,.hover-bg-pink:hover{background-color:#ff80cc}.hover-bg-light-pink:focus,.hover-bg-light-pink:hover{background-color:#ffa3d7}.hover-bg-dark-green:focus,.hover-bg-dark-green:hover{background-color:#137752}.hover-bg-green:focus,.hover-bg-green:hover{background-color:#19a974}.hover-bg-light-green:focus,.hover-bg-light-green:hover{background-color:#9eebcf}.hover-bg-navy:focus,.hover-bg-navy:hover{background-color:#001b44}.hover-bg-dark-blue:focus,.hover-bg-dark-blue:hover{background-color:#00449e}.hover-bg-blue:focus,.hover-bg-blue:hover{background-color:#357edd}.hover-bg-light-blue:focus,.hover-bg-light-blue:hover{background-color:#96ccff}.hover-bg-lightest-blue:focus,.hover-bg-lightest-blue:hover{background-color:#cdecff}.hover-bg-washed-blue:focus,.hover-bg-washed-blue:hover{background-color:#f6fffe}.hover-bg-washed-green:focus,.hover-bg-washed-green:hover{background-color:#e8fdf5}.hover-bg-washed-yellow:focus,.hover-bg-washed-yellow:hover{background-color:#fffceb}.hover-bg-washed-red:focus,.hover-bg-washed-red:hover{background-color:#ffdfdf}.hover-bg-inherit:focus,.hover-bg-inherit:hover{background-color:inherit}.pa0{padding:0}.pa1{padding:.25rem}.pa2{padding:.5rem}.pa3{padding:1rem}.pa4{padding:2rem}.pa5{padding:4rem}.pa6{padding:8rem}.pa7{padding:16rem}.pl0{padding-left:0}.pl1{padding-left:.25rem}.pl2{padding-left:.5rem}.pl3{padding-left:1rem}.pl4{padding-left:2rem}.pl5{padding-left:4rem}.pl6{padding-left:8rem}.pl7{padding-left:16rem}.pr0{padding-right:0}.pr1{padding-right:.25rem}.pr2{padding-right:.5rem}.pr3{padding-right:1rem}.pr4{padding-right:2rem}.pr5{padding-right:4rem}.pr6{padding-right:8rem}.pr7{padding-right:16rem}.pb0{padding-bottom:0}.pb1{padding-bottom:.25rem}.pb2{padding-bottom:.5rem}.pb3{padding-bottom:1rem}.pb4{padding-bottom:2rem}.pb5{padding-bottom:4rem}.pb6{padding-bottom:8rem}.pb7{padding-bottom:16rem}.pt0{padding-top:0}.pt1{padding-top:.25rem}.pt2{padding-top:.5rem}.pt3{padding-top:1rem}.pt4{padding-top:2rem}.pt5{padding-top:4rem}.pt6{padding-top:8rem}.pt7{padding-top:16rem}.pv0{padding-top:0;padding-bottom:0}.pv1{padding-top:.25rem;padding-bottom:.25rem}.pv2{padding-top:.5rem;padding-bottom:.5rem}.pv3{padding-top:1rem;padding-bottom:1rem}.pv4{padding-top:2rem;padding-bottom:2rem}.pv5{padding-top:4rem;padding-bottom:4rem}.pv6{padding-top:8rem;padding-bottom:8rem}.pv7{padding-top:16rem;padding-bottom:16rem}.ph0{padding-left:0;padding-right:0}.ph1{padding-left:.25rem;padding-right:.25rem}.ph2{padding-left:.5rem;padding-right:.5rem}.ph3{padding-left:1rem;padding-right:1rem}.ph4{padding-left:2rem;padding-right:2rem}.ph5{padding-left:4rem;padding-right:4rem}.ph6{padding-left:8rem;padding-right:8rem}.ph7{padding-left:16rem;padding-right:16rem}.ma0{margin:0}.ma1{margin:.25rem}.ma2{margin:.5rem}.ma3{margin:1rem}.ma4{margin:2rem}.ma5{margin:4rem}.ma6{margin:8rem}.ma7{margin:16rem}.ml0{margin-left:0}.ml1{margin-left:.25rem}.ml2{margin-left:.5rem}.ml3{margin-left:1rem}.ml4{margin-left:2rem}.ml5{margin-left:4rem}.ml6{margin-left:8rem}.ml7{margin-left:16rem}.mr0{margin-right:0}.mr1{margin-right:.25rem}.mr2{margin-right:.5rem}.mr3{margin-right:1rem}.mr4{margin-right:2rem}.mr5{margin-right:4rem}.mr6{margin-right:8rem}.mr7{margin-right:16rem}.mb0{margin-bottom:0}.mb1{margin-bottom:.25rem}.mb2{margin-bottom:.5rem}.mb3{margin-bottom:1rem}.mb4{margin-bottom:2rem}.mb5{margin-bottom:4rem}.mb6{margin-bottom:8rem}.mb7{margin-bottom:16rem}.mt0{margin-top:0}.mt1{margin-top:.25rem}.mt2{margin-top:.5rem}.mt3{margin-top:1rem}.mt4{margin-top:2rem}.mt5{margin-top:4rem}.mt6{margin-top:8rem}.mt7{margin-top:16rem}.mv0{margin-top:0;margin-bottom:0}.mv1{margin-top:.25rem;margin-bottom:.25rem}.mv2{margin-top:.5rem;margin-bottom:.5rem}.mv3{margin-top:1rem;margin-bottom:1rem}.mv4{margin-top:2rem;margin-bottom:2rem}.mv5{margin-top:4rem;margin-bottom:4rem}.mv6{margin-top:8rem;margin-bottom:8rem}.mv7{margin-top:16rem;margin-bottom:16rem}.mh0{margin-left:0;margin-right:0}.mh1{margin-left:.25rem;margin-right:.25rem}.mh2{margin-left:.5rem;margin-right:.5rem}.mh3{margin-left:1rem;margin-right:1rem}.mh4{margin-left:2rem;margin-right:2rem}.mh5{margin-left:4rem;margin-right:4rem}.mh6{margin-left:8rem;margin-right:8rem}.mh7{margin-left:16rem;margin-right:16rem}.na1{margin:-.25rem}.na2{margin:-.5rem}.na3{margin:-1rem}.na4{margin:-2rem}.na5{margin:-4rem}.na6{margin:-8rem}.na7{margin:-16rem}.nl1{margin-left:-.25rem}.nl2{margin-left:-.5rem}.nl3{margin-left:-1rem}.nl4{margin-left:-2rem}.nl5{margin-left:-4rem}.nl6{margin-left:-8rem}.nl7{margin-left:-16rem}.nr1{margin-right:-.25rem}.nr2{margin-right:-.5rem}.nr3{margin-right:-1rem}.nr4{margin-right:-2rem}.nr5{margin-right:-4rem}.nr6{margin-right:-8rem}.nr7{margin-right:-16rem}.nb1{margin-bottom:-.25rem}.nb2{margin-bottom:-.5rem}.nb3{margin-bottom:-1rem}.nb4{margin-bottom:-2rem}.nb5{margin-bottom:-4rem}.nb6{margin-bottom:-8rem}.nb7{margin-bottom:-16rem}.nt1{margin-top:-.25rem}.nt2{margin-top:-.5rem}.nt3{margin-top:-1rem}.nt4{margin-top:-2rem}.nt5{margin-top:-4rem}.nt6{margin-top:-8rem}.nt7{margin-top:-16rem}.collapse{border-collapse:collapse;border-spacing:0}.striped--light-silver:nth-child(odd){background-color:#aaa}.striped--moon-gray:nth-child(odd){background-color:#ccc}.striped--light-gray:nth-child(odd){background-color:#eee}.striped--near-white:nth-child(odd){background-color:#f4f4f4}.stripe-light:nth-child(odd){background-color:hsla(0,0%,100%,.1)}.stripe-dark:nth-child(odd){background-color:rgba(0,0,0,.1)}.strike{text-decoration:line-through}.underline{text-decoration:underline}.no-underline{text-decoration:none}.tl{text-align:left}.tr{text-align:right}.tc{text-align:center}.tj{text-align:justify}.ttc{text-transform:capitalize}.ttl{text-transform:lowercase}.ttu{text-transform:uppercase}.ttn{text-transform:none}.f-6,.f-headline{font-size:6rem}.f-5,.f-subheadline{font-size:5rem}.f1{font-size:3rem}.f2{font-size:2.25rem}.f3{font-size:1.5rem}.f4{font-size:1.25rem}.f5{font-size:1rem}.f6{font-size:.875rem}.f7{font-size:.75rem}.measure{max-width:30em}.measure-wide{max-width:34em}.measure-narrow{max-width:20em}.indent{text-indent:1em;margin-top:0;margin-bottom:0}.small-caps{font-variant:small-caps}.truncate{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.overflow-container{overflow-y:scroll}.center{margin-left:auto}.center,.mr-auto{margin-right:auto}.ml-auto{margin-left:auto}.clip{position:fixed!important;_position:absolute!important;clip:rect(1px 1px 1px 1px);clip:rect(1px,1px,1px,1px)}.ws-normal{white-space:normal}.nowrap{white-space:nowrap}.pre{white-space:pre}.v-base{vertical-align:baseline}.v-mid{vertical-align:middle}.v-top{vertical-align:top}.v-btm{vertical-align:bottom}.dim{opacity:1}.dim,.dim:focus,.dim:hover{transition:opacity .15s ease-in}.dim:focus,.dim:hover{opacity:.5}.dim:active{opacity:.8;transition:opacity .15s ease-out}.glow,.glow:focus,.glow:hover{transition:opacity .15s ease-in}.glow:focus,.glow:hover{opacity:1}.hide-child .child{opacity:0;transition:opacity .15s ease-in}.hide-child:active .child,.hide-child:focus .child,.hide-child:hover .child{opacity:1;transition:opacity .15s ease-in}.underline-hover:focus,.underline-hover:hover{text-decoration:underline}.grow{-moz-osx-font-smoothing:grayscale;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-transform:translateZ(0);transform:translateZ(0);transition:-webkit-transform .25s ease-out;transition:transform .25s ease-out;transition:transform .25s ease-out,-webkit-transform .25s ease-out}.grow:focus,.grow:hover{-webkit-transform:scale(1.05);transform:scale(1.05)}.grow:active{-webkit-transform:scale(.9);transform:scale(.9)}.grow-large{-moz-osx-font-smoothing:grayscale;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-transform:translateZ(0);transform:translateZ(0);transition:-webkit-transform .25s ease-in-out;transition:transform .25s ease-in-out;transition:transform .25s ease-in-out,-webkit-transform .25s ease-in-out}.grow-large:focus,.grow-large:hover{-webkit-transform:scale(1.2);transform:scale(1.2)}.grow-large:active{-webkit-transform:scale(.95);transform:scale(.95)}.pointer:hover,.shadow-hover{cursor:pointer}.shadow-hover{position:relative;transition:all .5s cubic-bezier(.165,.84,.44,1)}.shadow-hover:after{content:"";box-shadow:0 0 16px 2px rgba(0,0,0,.2);border-radius:inherit;opacity:0;position:absolute;top:0;left:0;width:100%;height:100%;z-index:-1;transition:opacity .5s cubic-bezier(.165,.84,.44,1)}.shadow-hover:focus:after,.shadow-hover:hover:after{opacity:1}.bg-animate,.bg-animate:focus,.bg-animate:hover{transition:background-color .15s ease-in-out}.z-0{z-index:0}.z-1{z-index:1}.z-2{z-index:2}.z-3{z-index:3}.z-4{z-index:4}.z-5{z-index:5}.z-999{z-index:999}.z-9999{z-index:9999}.z-max{z-index:2147483647}.z-inherit{z-index:inherit}.z-initial{z-index:auto}.z-unset{z-index:unset}.nested-copy-line-height ol,.nested-copy-line-height p,.nested-copy-line-height ul{line-height:1.5}.nested-headline-line-height h1,.nested-headline-line-height h2,.nested-headline-line-height h3,.nested-headline-line-height h4,.nested-headline-line-height h5,.nested-headline-line-height h6{line-height:1.25}.nested-list-reset ol,.nested-list-reset ul{padding-left:0;margin-left:0;list-style-type:none}.nested-copy-indent p+p{text-indent:1em;margin-top:0;margin-bottom:0}.nested-copy-separator p+p{margin-top:1.5em}.nested-img img{width:100%;max-width:100%;display:block}.nested-links a{color:#357edd;transition:color .15s ease-in}.nested-links a:focus,.nested-links a:hover{color:#96ccff;transition:color .15s ease-in}.debug *{outline:1px solid gold}.debug-white *{outline:1px solid #fff}.debug-black *{outline:1px solid #000}.debug-grid{background:transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAFElEQVR4AWPAC97/9x0eCsAEPgwAVLshdpENIxcAAAAASUVORK5CYII=) repeat 0 0}.debug-grid-16{background:transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMklEQVR4AWOgCLz/b0epAa6UGuBOqQHOQHLUgFEDnAbcBZ4UGwDOkiCnkIhdgNgNxAYAiYlD+8sEuo8AAAAASUVORK5CYII=) repeat 0 0}.debug-grid-8-solid{background:#fff url(data:image/gif;base64,R0lGODdhCAAIAPEAAADw/wDx/////wAAACwAAAAACAAIAAACDZQvgaeb/lxbAIKA8y0AOw==) repeat 0 0}.debug-grid-16-solid{background:#fff url(data:image/gif;base64,R0lGODdhEAAQAPEAAADw/wDx/xXy/////ywAAAAAEAAQAAACIZyPKckYDQFsb6ZqD85jZ2+BkwiRFKehhqQCQgDHcgwEBQA7) repeat 0 0}@media screen and (min-width:30em){.aspect-ratio-ns{height:0;position:relative}.aspect-ratio--16x9-ns{padding-bottom:56.25%}.aspect-ratio--9x16-ns{padding-bottom:177.77%}.aspect-ratio--4x3-ns{padding-bottom:75%}.aspect-ratio--3x4-ns{padding-bottom:133.33%}.aspect-ratio--6x4-ns{padding-bottom:66.6%}.aspect-ratio--4x6-ns{padding-bottom:150%}.aspect-ratio--8x5-ns{padding-bottom:62.5%}.aspect-ratio--5x8-ns{padding-bottom:160%}.aspect-ratio--7x5-ns{padding-bottom:71.42%}.aspect-ratio--5x7-ns{padding-bottom:140%}.aspect-ratio--1x1-ns{padding-bottom:100%}.aspect-ratio--object-ns{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;z-index:100}.cover-ns{background-size:cover!important}.contain-ns{background-size:contain!important}.bg-center-ns{background-position:50%}.bg-center-ns,.bg-top-ns{background-repeat:no-repeat}.bg-top-ns{background-position:top}.bg-right-ns{background-position:100%}.bg-bottom-ns,.bg-right-ns{background-repeat:no-repeat}.bg-bottom-ns{background-position:bottom}.bg-left-ns{background-repeat:no-repeat;background-position:0}.outline-ns{outline:1px solid}.outline-transparent-ns{outline:1px solid transparent}.outline-0-ns{outline:0}.ba-ns{border-style:solid;border-width:1px}.bt-ns{border-top-style:solid;border-top-width:1px}.br-ns{border-right-style:solid;border-right-width:1px}.bb-ns{border-bottom-style:solid;border-bottom-width:1px}.bl-ns{border-left-style:solid;border-left-width:1px}.bn-ns{border-style:none;border-width:0}.br0-ns{border-radius:0}.br1-ns{border-radius:.125rem}.br2-ns{border-radius:.25rem}.br3-ns{border-radius:.5rem}.br4-ns{border-radius:1rem}.br-100-ns{border-radius:100%}.br-pill-ns{border-radius:9999px}.br--bottom-ns{border-top-left-radius:0;border-top-right-radius:0}.br--top-ns{border-bottom-right-radius:0}.br--right-ns,.br--top-ns{border-bottom-left-radius:0}.br--right-ns{border-top-left-radius:0}.br--left-ns{border-top-right-radius:0;border-bottom-right-radius:0}.b--dotted-ns{border-style:dotted}.b--dashed-ns{border-style:dashed}.b--solid-ns{border-style:solid}.b--none-ns{border-style:none}.bw0-ns{border-width:0}.bw1-ns{border-width:.125rem}.bw2-ns{border-width:.25rem}.bw3-ns{border-width:.5rem}.bw4-ns{border-width:1rem}.bw5-ns{border-width:2rem}.bt-0-ns{border-top-width:0}.br-0-ns{border-right-width:0}.bb-0-ns{border-bottom-width:0}.bl-0-ns{border-left-width:0}.shadow-1-ns{box-shadow:0 0 4px 2px rgba(0,0,0,.2)}.shadow-2-ns{box-shadow:0 0 8px 2px rgba(0,0,0,.2)}.shadow-3-ns{box-shadow:2px 2px 4px 2px rgba(0,0,0,.2)}.shadow-4-ns{box-shadow:2px 2px 8px 0 rgba(0,0,0,.2)}.shadow-5-ns{box-shadow:4px 4px 8px 0 rgba(0,0,0,.2)}.top-0-ns{top:0}.left-0-ns{left:0}.right-0-ns{right:0}.bottom-0-ns{bottom:0}.top-1-ns{top:1rem}.left-1-ns{left:1rem}.right-1-ns{right:1rem}.bottom-1-ns{bottom:1rem}.top-2-ns{top:2rem}.left-2-ns{left:2rem}.right-2-ns{right:2rem}.bottom-2-ns{bottom:2rem}.top--1-ns{top:-1rem}.right--1-ns{right:-1rem}.bottom--1-ns{bottom:-1rem}.left--1-ns{left:-1rem}.top--2-ns{top:-2rem}.right--2-ns{right:-2rem}.bottom--2-ns{bottom:-2rem}.left--2-ns{left:-2rem}.absolute--fill-ns{top:0;right:0;bottom:0;left:0}.cl-ns{clear:left}.cr-ns{clear:right}.cb-ns{clear:both}.cn-ns{clear:none}.dn-ns{display:none}.di-ns{display:inline}.db-ns{display:block}.dib-ns{display:inline-block}.dit-ns{display:inline-table}.dt-ns{display:table}.dtc-ns{display:table-cell}.dt-row-ns{display:table-row}.dt-row-group-ns{display:table-row-group}.dt-column-ns{display:table-column}.dt-column-group-ns{display:table-column-group}.dt--fixed-ns{table-layout:fixed;width:100%}.flex-ns{display:flex}.inline-flex-ns{display:inline-flex}.flex-auto-ns{flex:1 1 auto;min-width:0;min-height:0}.flex-none-ns{flex:none}.flex-column-ns{flex-direction:column}.flex-row-ns{flex-direction:row}.flex-wrap-ns{flex-wrap:wrap}.flex-nowrap-ns{flex-wrap:nowrap}.flex-wrap-reverse-ns{flex-wrap:wrap-reverse}.flex-column-reverse-ns{flex-direction:column-reverse}.flex-row-reverse-ns{flex-direction:row-reverse}.items-start-ns{align-items:flex-start}.items-end-ns{align-items:flex-end}.items-center-ns{align-items:center}.items-baseline-ns{align-items:baseline}.items-stretch-ns{align-items:stretch}.self-start-ns{align-self:flex-start}.self-end-ns{align-self:flex-end}.self-center-ns{align-self:center}.self-baseline-ns{align-self:baseline}.self-stretch-ns{align-self:stretch}.justify-start-ns{justify-content:flex-start}.justify-end-ns{justify-content:flex-end}.justify-center-ns{justify-content:center}.justify-between-ns{justify-content:space-between}.justify-around-ns{justify-content:space-around}.content-start-ns{align-content:flex-start}.content-end-ns{align-content:flex-end}.content-center-ns{align-content:center}.content-between-ns{align-content:space-between}.content-around-ns{align-content:space-around}.content-stretch-ns{align-content:stretch}.order-0-ns{order:0}.order-1-ns{order:1}.order-2-ns{order:2}.order-3-ns{order:3}.order-4-ns{order:4}.order-5-ns{order:5}.order-6-ns{order:6}.order-7-ns{order:7}.order-8-ns{order:8}.order-last-ns{order:99999}.flex-grow-0-ns{flex-grow:0}.flex-grow-1-ns{flex-grow:1}.flex-shrink-0-ns{flex-shrink:0}.flex-shrink-1-ns{flex-shrink:1}.fl-ns{float:left}.fl-ns,.fr-ns{_display:inline}.fr-ns{float:right}.fn-ns{float:none}.i-ns{font-style:italic}.fs-normal-ns{font-style:normal}.normal-ns{font-weight:400}.b-ns{font-weight:700}.fw1-ns{font-weight:100}.fw2-ns{font-weight:200}.fw3-ns{font-weight:300}.fw4-ns{font-weight:400}.fw5-ns{font-weight:500}.fw6-ns{font-weight:600}.fw7-ns{font-weight:700}.fw8-ns{font-weight:800}.fw9-ns{font-weight:900}.h1-ns{height:1rem}.h2-ns{height:2rem}.h3-ns{height:4rem}.h4-ns{height:8rem}.h5-ns{height:16rem}.h-25-ns{height:25%}.h-50-ns{height:50%}.h-75-ns{height:75%}.h-100-ns{height:100%}.min-h-100-ns{min-height:100%}.vh-25-ns{height:25vh}.vh-50-ns{height:50vh}.vh-75-ns{height:75vh}.vh-100-ns{height:100vh}.min-vh-100-ns{min-height:100vh}.h-auto-ns{height:auto}.h-inherit-ns{height:inherit}.tracked-ns{letter-spacing:.1em}.tracked-tight-ns{letter-spacing:-.05em}.tracked-mega-ns{letter-spacing:.25em}.lh-solid-ns{line-height:1}.lh-title-ns{line-height:1.25}.lh-copy-ns{line-height:1.5}.mw-100-ns{max-width:100%}.mw1-ns{max-width:1rem}.mw2-ns{max-width:2rem}.mw3-ns{max-width:4rem}.mw4-ns{max-width:8rem}.mw5-ns{max-width:16rem}.mw6-ns{max-width:32rem}.mw7-ns{max-width:48rem}.mw8-ns{max-width:64rem}.mw9-ns{max-width:96rem}.mw-none-ns{max-width:none}.w1-ns{width:1rem}.w2-ns{width:2rem}.w3-ns{width:4rem}.w4-ns{width:8rem}.w5-ns{width:16rem}.w-10-ns{width:10%}.w-20-ns{width:20%}.w-25-ns{width:25%}.w-30-ns{width:30%}.w-33-ns{width:33%}.w-34-ns{width:34%}.w-40-ns{width:40%}.w-50-ns{width:50%}.w-60-ns{width:60%}.w-70-ns{width:70%}.w-75-ns{width:75%}.w-80-ns{width:80%}.w-90-ns{width:90%}.w-100-ns{width:100%}.w-third-ns{width:33.33333%}.w-two-thirds-ns{width:66.66667%}.w-auto-ns{width:auto}.overflow-visible-ns{overflow:visible}.overflow-hidden-ns{overflow:hidden}.overflow-scroll-ns{overflow:scroll}.overflow-auto-ns{overflow:auto}.overflow-x-visible-ns{overflow-x:visible}.overflow-x-hidden-ns{overflow-x:hidden}.overflow-x-scroll-ns{overflow-x:scroll}.overflow-x-auto-ns{overflow-x:auto}.overflow-y-visible-ns{overflow-y:visible}.overflow-y-hidden-ns{overflow-y:hidden}.overflow-y-scroll-ns{overflow-y:scroll}.overflow-y-auto-ns{overflow-y:auto}.static-ns{position:static}.relative-ns{position:relative}.absolute-ns{position:absolute}.fixed-ns{position:fixed}.rotate-45-ns{-webkit-transform:rotate(45deg);transform:rotate(45deg)}.rotate-90-ns{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.rotate-135-ns{-webkit-transform:rotate(135deg);transform:rotate(135deg)}.rotate-180-ns{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.rotate-225-ns{-webkit-transform:rotate(225deg);transform:rotate(225deg)}.rotate-270-ns{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.rotate-315-ns{-webkit-transform:rotate(315deg);transform:rotate(315deg)}.pa0-ns{padding:0}.pa1-ns{padding:.25rem}.pa2-ns{padding:.5rem}.pa3-ns{padding:1rem}.pa4-ns{padding:2rem}.pa5-ns{padding:4rem}.pa6-ns{padding:8rem}.pa7-ns{padding:16rem}.pl0-ns{padding-left:0}.pl1-ns{padding-left:.25rem}.pl2-ns{padding-left:.5rem}.pl3-ns{padding-left:1rem}.pl4-ns{padding-left:2rem}.pl5-ns{padding-left:4rem}.pl6-ns{padding-left:8rem}.pl7-ns{padding-left:16rem}.pr0-ns{padding-right:0}.pr1-ns{padding-right:.25rem}.pr2-ns{padding-right:.5rem}.pr3-ns{padding-right:1rem}.pr4-ns{padding-right:2rem}.pr5-ns{padding-right:4rem}.pr6-ns{padding-right:8rem}.pr7-ns{padding-right:16rem}.pb0-ns{padding-bottom:0}.pb1-ns{padding-bottom:.25rem}.pb2-ns{padding-bottom:.5rem}.pb3-ns{padding-bottom:1rem}.pb4-ns{padding-bottom:2rem}.pb5-ns{padding-bottom:4rem}.pb6-ns{padding-bottom:8rem}.pb7-ns{padding-bottom:16rem}.pt0-ns{padding-top:0}.pt1-ns{padding-top:.25rem}.pt2-ns{padding-top:.5rem}.pt3-ns{padding-top:1rem}.pt4-ns{padding-top:2rem}.pt5-ns{padding-top:4rem}.pt6-ns{padding-top:8rem}.pt7-ns{padding-top:16rem}.pv0-ns{padding-top:0;padding-bottom:0}.pv1-ns{padding-top:.25rem;padding-bottom:.25rem}.pv2-ns{padding-top:.5rem;padding-bottom:.5rem}.pv3-ns{padding-top:1rem;padding-bottom:1rem}.pv4-ns{padding-top:2rem;padding-bottom:2rem}.pv5-ns{padding-top:4rem;padding-bottom:4rem}.pv6-ns{padding-top:8rem;padding-bottom:8rem}.pv7-ns{padding-top:16rem;padding-bottom:16rem}.ph0-ns{padding-left:0;padding-right:0}.ph1-ns{padding-left:.25rem;padding-right:.25rem}.ph2-ns{padding-left:.5rem;padding-right:.5rem}.ph3-ns{padding-left:1rem;padding-right:1rem}.ph4-ns{padding-left:2rem;padding-right:2rem}.ph5-ns{padding-left:4rem;padding-right:4rem}.ph6-ns{padding-left:8rem;padding-right:8rem}.ph7-ns{padding-left:16rem;padding-right:16rem}.ma0-ns{margin:0}.ma1-ns{margin:.25rem}.ma2-ns{margin:.5rem}.ma3-ns{margin:1rem}.ma4-ns{margin:2rem}.ma5-ns{margin:4rem}.ma6-ns{margin:8rem}.ma7-ns{margin:16rem}.ml0-ns{margin-left:0}.ml1-ns{margin-left:.25rem}.ml2-ns{margin-left:.5rem}.ml3-ns{margin-left:1rem}.ml4-ns{margin-left:2rem}.ml5-ns{margin-left:4rem}.ml6-ns{margin-left:8rem}.ml7-ns{margin-left:16rem}.mr0-ns{margin-right:0}.mr1-ns{margin-right:.25rem}.mr2-ns{margin-right:.5rem}.mr3-ns{margin-right:1rem}.mr4-ns{margin-right:2rem}.mr5-ns{margin-right:4rem}.mr6-ns{margin-right:8rem}.mr7-ns{margin-right:16rem}.mb0-ns{margin-bottom:0}.mb1-ns{margin-bottom:.25rem}.mb2-ns{margin-bottom:.5rem}.mb3-ns{margin-bottom:1rem}.mb4-ns{margin-bottom:2rem}.mb5-ns{margin-bottom:4rem}.mb6-ns{margin-bottom:8rem}.mb7-ns{margin-bottom:16rem}.mt0-ns{margin-top:0}.mt1-ns{margin-top:.25rem}.mt2-ns{margin-top:.5rem}.mt3-ns{margin-top:1rem}.mt4-ns{margin-top:2rem}.mt5-ns{margin-top:4rem}.mt6-ns{margin-top:8rem}.mt7-ns{margin-top:16rem}.mv0-ns{margin-top:0;margin-bottom:0}.mv1-ns{margin-top:.25rem;margin-bottom:.25rem}.mv2-ns{margin-top:.5rem;margin-bottom:.5rem}.mv3-ns{margin-top:1rem;margin-bottom:1rem}.mv4-ns{margin-top:2rem;margin-bottom:2rem}.mv5-ns{margin-top:4rem;margin-bottom:4rem}.mv6-ns{margin-top:8rem;margin-bottom:8rem}.mv7-ns{margin-top:16rem;margin-bottom:16rem}.mh0-ns{margin-left:0;margin-right:0}.mh1-ns{margin-left:.25rem;margin-right:.25rem}.mh2-ns{margin-left:.5rem;margin-right:.5rem}.mh3-ns{margin-left:1rem;margin-right:1rem}.mh4-ns{margin-left:2rem;margin-right:2rem}.mh5-ns{margin-left:4rem;margin-right:4rem}.mh6-ns{margin-left:8rem;margin-right:8rem}.mh7-ns{margin-left:16rem;margin-right:16rem}.na1-ns{margin:-.25rem}.na2-ns{margin:-.5rem}.na3-ns{margin:-1rem}.na4-ns{margin:-2rem}.na5-ns{margin:-4rem}.na6-ns{margin:-8rem}.na7-ns{margin:-16rem}.nl1-ns{margin-left:-.25rem}.nl2-ns{margin-left:-.5rem}.nl3-ns{margin-left:-1rem}.nl4-ns{margin-left:-2rem}.nl5-ns{margin-left:-4rem}.nl6-ns{margin-left:-8rem}.nl7-ns{margin-left:-16rem}.nr1-ns{margin-right:-.25rem}.nr2-ns{margin-right:-.5rem}.nr3-ns{margin-right:-1rem}.nr4-ns{margin-right:-2rem}.nr5-ns{margin-right:-4rem}.nr6-ns{margin-right:-8rem}.nr7-ns{margin-right:-16rem}.nb1-ns{margin-bottom:-.25rem}.nb2-ns{margin-bottom:-.5rem}.nb3-ns{margin-bottom:-1rem}.nb4-ns{margin-bottom:-2rem}.nb5-ns{margin-bottom:-4rem}.nb6-ns{margin-bottom:-8rem}.nb7-ns{margin-bottom:-16rem}.nt1-ns{margin-top:-.25rem}.nt2-ns{margin-top:-.5rem}.nt3-ns{margin-top:-1rem}.nt4-ns{margin-top:-2rem}.nt5-ns{margin-top:-4rem}.nt6-ns{margin-top:-8rem}.nt7-ns{margin-top:-16rem}.strike-ns{text-decoration:line-through}.underline-ns{text-decoration:underline}.no-underline-ns{text-decoration:none}.tl-ns{text-align:left}.tr-ns{text-align:right}.tc-ns{text-align:center}.tj-ns{text-align:justify}.ttc-ns{text-transform:capitalize}.ttl-ns{text-transform:lowercase}.ttu-ns{text-transform:uppercase}.ttn-ns{text-transform:none}.f-6-ns,.f-headline-ns{font-size:6rem}.f-5-ns,.f-subheadline-ns{font-size:5rem}.f1-ns{font-size:3rem}.f2-ns{font-size:2.25rem}.f3-ns{font-size:1.5rem}.f4-ns{font-size:1.25rem}.f5-ns{font-size:1rem}.f6-ns{font-size:.875rem}.f7-ns{font-size:.75rem}.measure-ns{max-width:30em}.measure-wide-ns{max-width:34em}.measure-narrow-ns{max-width:20em}.indent-ns{text-indent:1em;margin-top:0;margin-bottom:0}.small-caps-ns{font-variant:small-caps}.truncate-ns{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.center-ns{margin-left:auto}.center-ns,.mr-auto-ns{margin-right:auto}.ml-auto-ns{margin-left:auto}.clip-ns{position:fixed!important;_position:absolute!important;clip:rect(1px 1px 1px 1px);clip:rect(1px,1px,1px,1px)}.ws-normal-ns{white-space:normal}.nowrap-ns{white-space:nowrap}.pre-ns{white-space:pre}.v-base-ns{vertical-align:baseline}.v-mid-ns{vertical-align:middle}.v-top-ns{vertical-align:top}.v-btm-ns{vertical-align:bottom}}@media screen and (min-width:30em) and (max-width:60em){.aspect-ratio-m{height:0;position:relative}.aspect-ratio--16x9-m{padding-bottom:56.25%}.aspect-ratio--9x16-m{padding-bottom:177.77%}.aspect-ratio--4x3-m{padding-bottom:75%}.aspect-ratio--3x4-m{padding-bottom:133.33%}.aspect-ratio--6x4-m{padding-bottom:66.6%}.aspect-ratio--4x6-m{padding-bottom:150%}.aspect-ratio--8x5-m{padding-bottom:62.5%}.aspect-ratio--5x8-m{padding-bottom:160%}.aspect-ratio--7x5-m{padding-bottom:71.42%}.aspect-ratio--5x7-m{padding-bottom:140%}.aspect-ratio--1x1-m{padding-bottom:100%}.aspect-ratio--object-m{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;z-index:100}.cover-m{background-size:cover!important}.contain-m{background-size:contain!important}.bg-center-m{background-position:50%}.bg-center-m,.bg-top-m{background-repeat:no-repeat}.bg-top-m{background-position:top}.bg-right-m{background-position:100%}.bg-bottom-m,.bg-right-m{background-repeat:no-repeat}.bg-bottom-m{background-position:bottom}.bg-left-m{background-repeat:no-repeat;background-position:0}.outline-m{outline:1px solid}.outline-transparent-m{outline:1px solid transparent}.outline-0-m{outline:0}.ba-m{border-style:solid;border-width:1px}.bt-m{border-top-style:solid;border-top-width:1px}.br-m{border-right-style:solid;border-right-width:1px}.bb-m{border-bottom-style:solid;border-bottom-width:1px}.bl-m{border-left-style:solid;border-left-width:1px}.bn-m{border-style:none;border-width:0}.br0-m{border-radius:0}.br1-m{border-radius:.125rem}.br2-m{border-radius:.25rem}.br3-m{border-radius:.5rem}.br4-m{border-radius:1rem}.br-100-m{border-radius:100%}.br-pill-m{border-radius:9999px}.br--bottom-m{border-top-left-radius:0;border-top-right-radius:0}.br--top-m{border-bottom-right-radius:0}.br--right-m,.br--top-m{border-bottom-left-radius:0}.br--right-m{border-top-left-radius:0}.br--left-m{border-top-right-radius:0;border-bottom-right-radius:0}.b--dotted-m{border-style:dotted}.b--dashed-m{border-style:dashed}.b--solid-m{border-style:solid}.b--none-m{border-style:none}.bw0-m{border-width:0}.bw1-m{border-width:.125rem}.bw2-m{border-width:.25rem}.bw3-m{border-width:.5rem}.bw4-m{border-width:1rem}.bw5-m{border-width:2rem}.bt-0-m{border-top-width:0}.br-0-m{border-right-width:0}.bb-0-m{border-bottom-width:0}.bl-0-m{border-left-width:0}.shadow-1-m{box-shadow:0 0 4px 2px rgba(0,0,0,.2)}.shadow-2-m{box-shadow:0 0 8px 2px rgba(0,0,0,.2)}.shadow-3-m{box-shadow:2px 2px 4px 2px rgba(0,0,0,.2)}.shadow-4-m{box-shadow:2px 2px 8px 0 rgba(0,0,0,.2)}.shadow-5-m{box-shadow:4px 4px 8px 0 rgba(0,0,0,.2)}.top-0-m{top:0}.left-0-m{left:0}.right-0-m{right:0}.bottom-0-m{bottom:0}.top-1-m{top:1rem}.left-1-m{left:1rem}.right-1-m{right:1rem}.bottom-1-m{bottom:1rem}.top-2-m{top:2rem}.left-2-m{left:2rem}.right-2-m{right:2rem}.bottom-2-m{bottom:2rem}.top--1-m{top:-1rem}.right--1-m{right:-1rem}.bottom--1-m{bottom:-1rem}.left--1-m{left:-1rem}.top--2-m{top:-2rem}.right--2-m{right:-2rem}.bottom--2-m{bottom:-2rem}.left--2-m{left:-2rem}.absolute--fill-m{top:0;right:0;bottom:0;left:0}.cl-m{clear:left}.cr-m{clear:right}.cb-m{clear:both}.cn-m{clear:none}.dn-m{display:none}.di-m{display:inline}.db-m{display:block}.dib-m{display:inline-block}.dit-m{display:inline-table}.dt-m{display:table}.dtc-m{display:table-cell}.dt-row-m{display:table-row}.dt-row-group-m{display:table-row-group}.dt-column-m{display:table-column}.dt-column-group-m{display:table-column-group}.dt--fixed-m{table-layout:fixed;width:100%}.flex-m{display:flex}.inline-flex-m{display:inline-flex}.flex-auto-m{flex:1 1 auto;min-width:0;min-height:0}.flex-none-m{flex:none}.flex-column-m{flex-direction:column}.flex-row-m{flex-direction:row}.flex-wrap-m{flex-wrap:wrap}.flex-nowrap-m{flex-wrap:nowrap}.flex-wrap-reverse-m{flex-wrap:wrap-reverse}.flex-column-reverse-m{flex-direction:column-reverse}.flex-row-reverse-m{flex-direction:row-reverse}.items-start-m{align-items:flex-start}.items-end-m{align-items:flex-end}.items-center-m{align-items:center}.items-baseline-m{align-items:baseline}.items-stretch-m{align-items:stretch}.self-start-m{align-self:flex-start}.self-end-m{align-self:flex-end}.self-center-m{align-self:center}.self-baseline-m{align-self:baseline}.self-stretch-m{align-self:stretch}.justify-start-m{justify-content:flex-start}.justify-end-m{justify-content:flex-end}.justify-center-m{justify-content:center}.justify-between-m{justify-content:space-between}.justify-around-m{justify-content:space-around}.content-start-m{align-content:flex-start}.content-end-m{align-content:flex-end}.content-center-m{align-content:center}.content-between-m{align-content:space-between}.content-around-m{align-content:space-around}.content-stretch-m{align-content:stretch}.order-0-m{order:0}.order-1-m{order:1}.order-2-m{order:2}.order-3-m{order:3}.order-4-m{order:4}.order-5-m{order:5}.order-6-m{order:6}.order-7-m{order:7}.order-8-m{order:8}.order-last-m{order:99999}.flex-grow-0-m{flex-grow:0}.flex-grow-1-m{flex-grow:1}.flex-shrink-0-m{flex-shrink:0}.flex-shrink-1-m{flex-shrink:1}.fl-m{float:left}.fl-m,.fr-m{_display:inline}.fr-m{float:right}.fn-m{float:none}.i-m{font-style:italic}.fs-normal-m{font-style:normal}.normal-m{font-weight:400}.b-m{font-weight:700}.fw1-m{font-weight:100}.fw2-m{font-weight:200}.fw3-m{font-weight:300}.fw4-m{font-weight:400}.fw5-m{font-weight:500}.fw6-m{font-weight:600}.fw7-m{font-weight:700}.fw8-m{font-weight:800}.fw9-m{font-weight:900}.h1-m{height:1rem}.h2-m{height:2rem}.h3-m{height:4rem}.h4-m{height:8rem}.h5-m{height:16rem}.h-25-m{height:25%}.h-50-m{height:50%}.h-75-m{height:75%}.h-100-m{height:100%}.min-h-100-m{min-height:100%}.vh-25-m{height:25vh}.vh-50-m{height:50vh}.vh-75-m{height:75vh}.vh-100-m{height:100vh}.min-vh-100-m{min-height:100vh}.h-auto-m{height:auto}.h-inherit-m{height:inherit}.tracked-m{letter-spacing:.1em}.tracked-tight-m{letter-spacing:-.05em}.tracked-mega-m{letter-spacing:.25em}.lh-solid-m{line-height:1}.lh-title-m{line-height:1.25}.lh-copy-m{line-height:1.5}.mw-100-m{max-width:100%}.mw1-m{max-width:1rem}.mw2-m{max-width:2rem}.mw3-m{max-width:4rem}.mw4-m{max-width:8rem}.mw5-m{max-width:16rem}.mw6-m{max-width:32rem}.mw7-m{max-width:48rem}.mw8-m{max-width:64rem}.mw9-m{max-width:96rem}.mw-none-m{max-width:none}.w1-m{width:1rem}.w2-m{width:2rem}.w3-m{width:4rem}.w4-m{width:8rem}.w5-m{width:16rem}.w-10-m{width:10%}.w-20-m{width:20%}.w-25-m{width:25%}.w-30-m{width:30%}.w-33-m{width:33%}.w-34-m{width:34%}.w-40-m{width:40%}.w-50-m{width:50%}.w-60-m{width:60%}.w-70-m{width:70%}.w-75-m{width:75%}.w-80-m{width:80%}.w-90-m{width:90%}.w-100-m{width:100%}.w-third-m{width:33.33333%}.w-two-thirds-m{width:66.66667%}.w-auto-m{width:auto}.overflow-visible-m{overflow:visible}.overflow-hidden-m{overflow:hidden}.overflow-scroll-m{overflow:scroll}.overflow-auto-m{overflow:auto}.overflow-x-visible-m{overflow-x:visible}.overflow-x-hidden-m{overflow-x:hidden}.overflow-x-scroll-m{overflow-x:scroll}.overflow-x-auto-m{overflow-x:auto}.overflow-y-visible-m{overflow-y:visible}.overflow-y-hidden-m{overflow-y:hidden}.overflow-y-scroll-m{overflow-y:scroll}.overflow-y-auto-m{overflow-y:auto}.static-m{position:static}.relative-m{position:relative}.absolute-m{position:absolute}.fixed-m{position:fixed}.rotate-45-m{-webkit-transform:rotate(45deg);transform:rotate(45deg)}.rotate-90-m{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.rotate-135-m{-webkit-transform:rotate(135deg);transform:rotate(135deg)}.rotate-180-m{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.rotate-225-m{-webkit-transform:rotate(225deg);transform:rotate(225deg)}.rotate-270-m{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.rotate-315-m{-webkit-transform:rotate(315deg);transform:rotate(315deg)}.pa0-m{padding:0}.pa1-m{padding:.25rem}.pa2-m{padding:.5rem}.pa3-m{padding:1rem}.pa4-m{padding:2rem}.pa5-m{padding:4rem}.pa6-m{padding:8rem}.pa7-m{padding:16rem}.pl0-m{padding-left:0}.pl1-m{padding-left:.25rem}.pl2-m{padding-left:.5rem}.pl3-m{padding-left:1rem}.pl4-m{padding-left:2rem}.pl5-m{padding-left:4rem}.pl6-m{padding-left:8rem}.pl7-m{padding-left:16rem}.pr0-m{padding-right:0}.pr1-m{padding-right:.25rem}.pr2-m{padding-right:.5rem}.pr3-m{padding-right:1rem}.pr4-m{padding-right:2rem}.pr5-m{padding-right:4rem}.pr6-m{padding-right:8rem}.pr7-m{padding-right:16rem}.pb0-m{padding-bottom:0}.pb1-m{padding-bottom:.25rem}.pb2-m{padding-bottom:.5rem}.pb3-m{padding-bottom:1rem}.pb4-m{padding-bottom:2rem}.pb5-m{padding-bottom:4rem}.pb6-m{padding-bottom:8rem}.pb7-m{padding-bottom:16rem}.pt0-m{padding-top:0}.pt1-m{padding-top:.25rem}.pt2-m{padding-top:.5rem}.pt3-m{padding-top:1rem}.pt4-m{padding-top:2rem}.pt5-m{padding-top:4rem}.pt6-m{padding-top:8rem}.pt7-m{padding-top:16rem}.pv0-m{padding-top:0;padding-bottom:0}.pv1-m{padding-top:.25rem;padding-bottom:.25rem}.pv2-m{padding-top:.5rem;padding-bottom:.5rem}.pv3-m{padding-top:1rem;padding-bottom:1rem}.pv4-m{padding-top:2rem;padding-bottom:2rem}.pv5-m{padding-top:4rem;padding-bottom:4rem}.pv6-m{padding-top:8rem;padding-bottom:8rem}.pv7-m{padding-top:16rem;padding-bottom:16rem}.ph0-m{padding-left:0;padding-right:0}.ph1-m{padding-left:.25rem;padding-right:.25rem}.ph2-m{padding-left:.5rem;padding-right:.5rem}.ph3-m{padding-left:1rem;padding-right:1rem}.ph4-m{padding-left:2rem;padding-right:2rem}.ph5-m{padding-left:4rem;padding-right:4rem}.ph6-m{padding-left:8rem;padding-right:8rem}.ph7-m{padding-left:16rem;padding-right:16rem}.ma0-m{margin:0}.ma1-m{margin:.25rem}.ma2-m{margin:.5rem}.ma3-m{margin:1rem}.ma4-m{margin:2rem}.ma5-m{margin:4rem}.ma6-m{margin:8rem}.ma7-m{margin:16rem}.ml0-m{margin-left:0}.ml1-m{margin-left:.25rem}.ml2-m{margin-left:.5rem}.ml3-m{margin-left:1rem}.ml4-m{margin-left:2rem}.ml5-m{margin-left:4rem}.ml6-m{margin-left:8rem}.ml7-m{margin-left:16rem}.mr0-m{margin-right:0}.mr1-m{margin-right:.25rem}.mr2-m{margin-right:.5rem}.mr3-m{margin-right:1rem}.mr4-m{margin-right:2rem}.mr5-m{margin-right:4rem}.mr6-m{margin-right:8rem}.mr7-m{margin-right:16rem}.mb0-m{margin-bottom:0}.mb1-m{margin-bottom:.25rem}.mb2-m{margin-bottom:.5rem}.mb3-m{margin-bottom:1rem}.mb4-m{margin-bottom:2rem}.mb5-m{margin-bottom:4rem}.mb6-m{margin-bottom:8rem}.mb7-m{margin-bottom:16rem}.mt0-m{margin-top:0}.mt1-m{margin-top:.25rem}.mt2-m{margin-top:.5rem}.mt3-m{margin-top:1rem}.mt4-m{margin-top:2rem}.mt5-m{margin-top:4rem}.mt6-m{margin-top:8rem}.mt7-m{margin-top:16rem}.mv0-m{margin-top:0;margin-bottom:0}.mv1-m{margin-top:.25rem;margin-bottom:.25rem}.mv2-m{margin-top:.5rem;margin-bottom:.5rem}.mv3-m{margin-top:1rem;margin-bottom:1rem}.mv4-m{margin-top:2rem;margin-bottom:2rem}.mv5-m{margin-top:4rem;margin-bottom:4rem}.mv6-m{margin-top:8rem;margin-bottom:8rem}.mv7-m{margin-top:16rem;margin-bottom:16rem}.mh0-m{margin-left:0;margin-right:0}.mh1-m{margin-left:.25rem;margin-right:.25rem}.mh2-m{margin-left:.5rem;margin-right:.5rem}.mh3-m{margin-left:1rem;margin-right:1rem}.mh4-m{margin-left:2rem;margin-right:2rem}.mh5-m{margin-left:4rem;margin-right:4rem}.mh6-m{margin-left:8rem;margin-right:8rem}.mh7-m{margin-left:16rem;margin-right:16rem}.na1-m{margin:-.25rem}.na2-m{margin:-.5rem}.na3-m{margin:-1rem}.na4-m{margin:-2rem}.na5-m{margin:-4rem}.na6-m{margin:-8rem}.na7-m{margin:-16rem}.nl1-m{margin-left:-.25rem}.nl2-m{margin-left:-.5rem}.nl3-m{margin-left:-1rem}.nl4-m{margin-left:-2rem}.nl5-m{margin-left:-4rem}.nl6-m{margin-left:-8rem}.nl7-m{margin-left:-16rem}.nr1-m{margin-right:-.25rem}.nr2-m{margin-right:-.5rem}.nr3-m{margin-right:-1rem}.nr4-m{margin-right:-2rem}.nr5-m{margin-right:-4rem}.nr6-m{margin-right:-8rem}.nr7-m{margin-right:-16rem}.nb1-m{margin-bottom:-.25rem}.nb2-m{margin-bottom:-.5rem}.nb3-m{margin-bottom:-1rem}.nb4-m{margin-bottom:-2rem}.nb5-m{margin-bottom:-4rem}.nb6-m{margin-bottom:-8rem}.nb7-m{margin-bottom:-16rem}.nt1-m{margin-top:-.25rem}.nt2-m{margin-top:-.5rem}.nt3-m{margin-top:-1rem}.nt4-m{margin-top:-2rem}.nt5-m{margin-top:-4rem}.nt6-m{margin-top:-8rem}.nt7-m{margin-top:-16rem}.strike-m{text-decoration:line-through}.underline-m{text-decoration:underline}.no-underline-m{text-decoration:none}.tl-m{text-align:left}.tr-m{text-align:right}.tc-m{text-align:center}.tj-m{text-align:justify}.ttc-m{text-transform:capitalize}.ttl-m{text-transform:lowercase}.ttu-m{text-transform:uppercase}.ttn-m{text-transform:none}.f-6-m,.f-headline-m{font-size:6rem}.f-5-m,.f-subheadline-m{font-size:5rem}.f1-m{font-size:3rem}.f2-m{font-size:2.25rem}.f3-m{font-size:1.5rem}.f4-m{font-size:1.25rem}.f5-m{font-size:1rem}.f6-m{font-size:.875rem}.f7-m{font-size:.75rem}.measure-m{max-width:30em}.measure-wide-m{max-width:34em}.measure-narrow-m{max-width:20em}.indent-m{text-indent:1em;margin-top:0;margin-bottom:0}.small-caps-m{font-variant:small-caps}.truncate-m{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.center-m{margin-left:auto}.center-m,.mr-auto-m{margin-right:auto}.ml-auto-m{margin-left:auto}.clip-m{position:fixed!important;_position:absolute!important;clip:rect(1px 1px 1px 1px);clip:rect(1px,1px,1px,1px)}.ws-normal-m{white-space:normal}.nowrap-m{white-space:nowrap}.pre-m{white-space:pre}.v-base-m{vertical-align:baseline}.v-mid-m{vertical-align:middle}.v-top-m{vertical-align:top}.v-btm-m{vertical-align:bottom}}@media screen and (min-width:60em){.aspect-ratio-l{height:0;position:relative}.aspect-ratio--16x9-l{padding-bottom:56.25%}.aspect-ratio--9x16-l{padding-bottom:177.77%}.aspect-ratio--4x3-l{padding-bottom:75%}.aspect-ratio--3x4-l{padding-bottom:133.33%}.aspect-ratio--6x4-l{padding-bottom:66.6%}.aspect-ratio--4x6-l{padding-bottom:150%}.aspect-ratio--8x5-l{padding-bottom:62.5%}.aspect-ratio--5x8-l{padding-bottom:160%}.aspect-ratio--7x5-l{padding-bottom:71.42%}.aspect-ratio--5x7-l{padding-bottom:140%}.aspect-ratio--1x1-l{padding-bottom:100%}.aspect-ratio--object-l{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;z-index:100}.cover-l{background-size:cover!important}.contain-l{background-size:contain!important}.bg-center-l{background-position:50%}.bg-center-l,.bg-top-l{background-repeat:no-repeat}.bg-top-l{background-position:top}.bg-right-l{background-position:100%}.bg-bottom-l,.bg-right-l{background-repeat:no-repeat}.bg-bottom-l{background-position:bottom}.bg-left-l{background-repeat:no-repeat;background-position:0}.outline-l{outline:1px solid}.outline-transparent-l{outline:1px solid transparent}.outline-0-l{outline:0}.ba-l{border-style:solid;border-width:1px}.bt-l{border-top-style:solid;border-top-width:1px}.br-l{border-right-style:solid;border-right-width:1px}.bb-l{border-bottom-style:solid;border-bottom-width:1px}.bl-l{border-left-style:solid;border-left-width:1px}.bn-l{border-style:none;border-width:0}.br0-l{border-radius:0}.br1-l{border-radius:.125rem}.br2-l{border-radius:.25rem}.br3-l{border-radius:.5rem}.br4-l{border-radius:1rem}.br-100-l{border-radius:100%}.br-pill-l{border-radius:9999px}.br--bottom-l{border-top-left-radius:0;border-top-right-radius:0}.br--top-l{border-bottom-right-radius:0}.br--right-l,.br--top-l{border-bottom-left-radius:0}.br--right-l{border-top-left-radius:0}.br--left-l{border-top-right-radius:0;border-bottom-right-radius:0}.b--dotted-l{border-style:dotted}.b--dashed-l{border-style:dashed}.b--solid-l{border-style:solid}.b--none-l{border-style:none}.bw0-l{border-width:0}.bw1-l{border-width:.125rem}.bw2-l{border-width:.25rem}.bw3-l{border-width:.5rem}.bw4-l{border-width:1rem}.bw5-l{border-width:2rem}.bt-0-l{border-top-width:0}.br-0-l{border-right-width:0}.bb-0-l{border-bottom-width:0}.bl-0-l{border-left-width:0}.shadow-1-l{box-shadow:0 0 4px 2px rgba(0,0,0,.2)}.shadow-2-l{box-shadow:0 0 8px 2px rgba(0,0,0,.2)}.shadow-3-l{box-shadow:2px 2px 4px 2px rgba(0,0,0,.2)}.shadow-4-l{box-shadow:2px 2px 8px 0 rgba(0,0,0,.2)}.shadow-5-l{box-shadow:4px 4px 8px 0 rgba(0,0,0,.2)}.top-0-l{top:0}.left-0-l{left:0}.right-0-l{right:0}.bottom-0-l{bottom:0}.top-1-l{top:1rem}.left-1-l{left:1rem}.right-1-l{right:1rem}.bottom-1-l{bottom:1rem}.top-2-l{top:2rem}.left-2-l{left:2rem}.right-2-l{right:2rem}.bottom-2-l{bottom:2rem}.top--1-l{top:-1rem}.right--1-l{right:-1rem}.bottom--1-l{bottom:-1rem}.left--1-l{left:-1rem}.top--2-l{top:-2rem}.right--2-l{right:-2rem}.bottom--2-l{bottom:-2rem}.left--2-l{left:-2rem}.absolute--fill-l{top:0;right:0;bottom:0;left:0}.cl-l{clear:left}.cr-l{clear:right}.cb-l{clear:both}.cn-l{clear:none}.dn-l{display:none}.di-l{display:inline}.db-l{display:block}.dib-l{display:inline-block}.dit-l{display:inline-table}.dt-l{display:table}.dtc-l{display:table-cell}.dt-row-l{display:table-row}.dt-row-group-l{display:table-row-group}.dt-column-l{display:table-column}.dt-column-group-l{display:table-column-group}.dt--fixed-l{table-layout:fixed;width:100%}.flex-l{display:flex}.inline-flex-l{display:inline-flex}.flex-auto-l{flex:1 1 auto;min-width:0;min-height:0}.flex-none-l{flex:none}.flex-column-l{flex-direction:column}.flex-row-l{flex-direction:row}.flex-wrap-l{flex-wrap:wrap}.flex-nowrap-l{flex-wrap:nowrap}.flex-wrap-reverse-l{flex-wrap:wrap-reverse}.flex-column-reverse-l{flex-direction:column-reverse}.flex-row-reverse-l{flex-direction:row-reverse}.items-start-l{align-items:flex-start}.items-end-l{align-items:flex-end}.items-center-l{align-items:center}.items-baseline-l{align-items:baseline}.items-stretch-l{align-items:stretch}.self-start-l{align-self:flex-start}.self-end-l{align-self:flex-end}.self-center-l{align-self:center}.self-baseline-l{align-self:baseline}.self-stretch-l{align-self:stretch}.justify-start-l{justify-content:flex-start}.justify-end-l{justify-content:flex-end}.justify-center-l{justify-content:center}.justify-between-l{justify-content:space-between}.justify-around-l{justify-content:space-around}.content-start-l{align-content:flex-start}.content-end-l{align-content:flex-end}.content-center-l{align-content:center}.content-between-l{align-content:space-between}.content-around-l{align-content:space-around}.content-stretch-l{align-content:stretch}.order-0-l{order:0}.order-1-l{order:1}.order-2-l{order:2}.order-3-l{order:3}.order-4-l{order:4}.order-5-l{order:5}.order-6-l{order:6}.order-7-l{order:7}.order-8-l{order:8}.order-last-l{order:99999}.flex-grow-0-l{flex-grow:0}.flex-grow-1-l{flex-grow:1}.flex-shrink-0-l{flex-shrink:0}.flex-shrink-1-l{flex-shrink:1}.fl-l{float:left}.fl-l,.fr-l{_display:inline}.fr-l{float:right}.fn-l{float:none}.i-l{font-style:italic}.fs-normal-l{font-style:normal}.normal-l{font-weight:400}.b-l{font-weight:700}.fw1-l{font-weight:100}.fw2-l{font-weight:200}.fw3-l{font-weight:300}.fw4-l{font-weight:400}.fw5-l{font-weight:500}.fw6-l{font-weight:600}.fw7-l{font-weight:700}.fw8-l{font-weight:800}.fw9-l{font-weight:900}.h1-l{height:1rem}.h2-l{height:2rem}.h3-l{height:4rem}.h4-l{height:8rem}.h5-l{height:16rem}.h-25-l{height:25%}.h-50-l{height:50%}.h-75-l{height:75%}.h-100-l{height:100%}.min-h-100-l{min-height:100%}.vh-25-l{height:25vh}.vh-50-l{height:50vh}.vh-75-l{height:75vh}.vh-100-l{height:100vh}.min-vh-100-l{min-height:100vh}.h-auto-l{height:auto}.h-inherit-l{height:inherit}.tracked-l{letter-spacing:.1em}.tracked-tight-l{letter-spacing:-.05em}.tracked-mega-l{letter-spacing:.25em}.lh-solid-l{line-height:1}.lh-title-l{line-height:1.25}.lh-copy-l{line-height:1.5}.mw-100-l{max-width:100%}.mw1-l{max-width:1rem}.mw2-l{max-width:2rem}.mw3-l{max-width:4rem}.mw4-l{max-width:8rem}.mw5-l{max-width:16rem}.mw6-l{max-width:32rem}.mw7-l{max-width:48rem}.mw8-l{max-width:64rem}.mw9-l{max-width:96rem}.mw-none-l{max-width:none}.w1-l{width:1rem}.w2-l{width:2rem}.w3-l{width:4rem}.w4-l{width:8rem}.w5-l{width:16rem}.w-10-l{width:10%}.w-20-l{width:20%}.w-25-l{width:25%}.w-30-l{width:30%}.w-33-l{width:33%}.w-34-l{width:34%}.w-40-l{width:40%}.w-50-l{width:50%}.w-60-l{width:60%}.w-70-l{width:70%}.w-75-l{width:75%}.w-80-l{width:80%}.w-90-l{width:90%}.w-100-l{width:100%}.w-third-l{width:33.33333%}.w-two-thirds-l{width:66.66667%}.w-auto-l{width:auto}.overflow-visible-l{overflow:visible}.overflow-hidden-l{overflow:hidden}.overflow-scroll-l{overflow:scroll}.overflow-auto-l{overflow:auto}.overflow-x-visible-l{overflow-x:visible}.overflow-x-hidden-l{overflow-x:hidden}.overflow-x-scroll-l{overflow-x:scroll}.overflow-x-auto-l{overflow-x:auto}.overflow-y-visible-l{overflow-y:visible}.overflow-y-hidden-l{overflow-y:hidden}.overflow-y-scroll-l{overflow-y:scroll}.overflow-y-auto-l{overflow-y:auto}.static-l{position:static}.relative-l{position:relative}.absolute-l{position:absolute}.fixed-l{position:fixed}.rotate-45-l{-webkit-transform:rotate(45deg);transform:rotate(45deg)}.rotate-90-l{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.rotate-135-l{-webkit-transform:rotate(135deg);transform:rotate(135deg)}.rotate-180-l{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.rotate-225-l{-webkit-transform:rotate(225deg);transform:rotate(225deg)}.rotate-270-l{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.rotate-315-l{-webkit-transform:rotate(315deg);transform:rotate(315deg)}.pa0-l{padding:0}.pa1-l{padding:.25rem}.pa2-l{padding:.5rem}.pa3-l{padding:1rem}.pa4-l{padding:2rem}.pa5-l{padding:4rem}.pa6-l{padding:8rem}.pa7-l{padding:16rem}.pl0-l{padding-left:0}.pl1-l{padding-left:.25rem}.pl2-l{padding-left:.5rem}.pl3-l{padding-left:1rem}.pl4-l{padding-left:2rem}.pl5-l{padding-left:4rem}.pl6-l{padding-left:8rem}.pl7-l{padding-left:16rem}.pr0-l{padding-right:0}.pr1-l{padding-right:.25rem}.pr2-l{padding-right:.5rem}.pr3-l{padding-right:1rem}.pr4-l{padding-right:2rem}.pr5-l{padding-right:4rem}.pr6-l{padding-right:8rem}.pr7-l{padding-right:16rem}.pb0-l{padding-bottom:0}.pb1-l{padding-bottom:.25rem}.pb2-l{padding-bottom:.5rem}.pb3-l{padding-bottom:1rem}.pb4-l{padding-bottom:2rem}.pb5-l{padding-bottom:4rem}.pb6-l{padding-bottom:8rem}.pb7-l{padding-bottom:16rem}.pt0-l{padding-top:0}.pt1-l{padding-top:.25rem}.pt2-l{padding-top:.5rem}.pt3-l{padding-top:1rem}.pt4-l{padding-top:2rem}.pt5-l{padding-top:4rem}.pt6-l{padding-top:8rem}.pt7-l{padding-top:16rem}.pv0-l{padding-top:0;padding-bottom:0}.pv1-l{padding-top:.25rem;padding-bottom:.25rem}.pv2-l{padding-top:.5rem;padding-bottom:.5rem}.pv3-l{padding-top:1rem;padding-bottom:1rem}.pv4-l{padding-top:2rem;padding-bottom:2rem}.pv5-l{padding-top:4rem;padding-bottom:4rem}.pv6-l{padding-top:8rem;padding-bottom:8rem}.pv7-l{padding-top:16rem;padding-bottom:16rem}.ph0-l{padding-left:0;padding-right:0}.ph1-l{padding-left:.25rem;padding-right:.25rem}.ph2-l{padding-left:.5rem;padding-right:.5rem}.ph3-l{padding-left:1rem;padding-right:1rem}.ph4-l{padding-left:2rem;padding-right:2rem}.ph5-l{padding-left:4rem;padding-right:4rem}.ph6-l{padding-left:8rem;padding-right:8rem}.ph7-l{padding-left:16rem;padding-right:16rem}.ma0-l{margin:0}.ma1-l{margin:.25rem}.ma2-l{margin:.5rem}.ma3-l{margin:1rem}.ma4-l{margin:2rem}.ma5-l{margin:4rem}.ma6-l{margin:8rem}.ma7-l{margin:16rem}.ml0-l{margin-left:0}.ml1-l{margin-left:.25rem}.ml2-l{margin-left:.5rem}.ml3-l{margin-left:1rem}.ml4-l{margin-left:2rem}.ml5-l{margin-left:4rem}.ml6-l{margin-left:8rem}.ml7-l{margin-left:16rem}.mr0-l{margin-right:0}.mr1-l{margin-right:.25rem}.mr2-l{margin-right:.5rem}.mr3-l{margin-right:1rem}.mr4-l{margin-right:2rem}.mr5-l{margin-right:4rem}.mr6-l{margin-right:8rem}.mr7-l{margin-right:16rem}.mb0-l{margin-bottom:0}.mb1-l{margin-bottom:.25rem}.mb2-l{margin-bottom:.5rem}.mb3-l{margin-bottom:1rem}.mb4-l{margin-bottom:2rem}.mb5-l{margin-bottom:4rem}.mb6-l{margin-bottom:8rem}.mb7-l{margin-bottom:16rem}.mt0-l{margin-top:0}.mt1-l{margin-top:.25rem}.mt2-l{margin-top:.5rem}.mt3-l{margin-top:1rem}.mt4-l{margin-top:2rem}.mt5-l{margin-top:4rem}.mt6-l{margin-top:8rem}.mt7-l{margin-top:16rem}.mv0-l{margin-top:0;margin-bottom:0}.mv1-l{margin-top:.25rem;margin-bottom:.25rem}.mv2-l{margin-top:.5rem;margin-bottom:.5rem}.mv3-l{margin-top:1rem;margin-bottom:1rem}.mv4-l{margin-top:2rem;margin-bottom:2rem}.mv5-l{margin-top:4rem;margin-bottom:4rem}.mv6-l{margin-top:8rem;margin-bottom:8rem}.mv7-l{margin-top:16rem;margin-bottom:16rem}.mh0-l{margin-left:0;margin-right:0}.mh1-l{margin-left:.25rem;margin-right:.25rem}.mh2-l{margin-left:.5rem;margin-right:.5rem}.mh3-l{margin-left:1rem;margin-right:1rem}.mh4-l{margin-left:2rem;margin-right:2rem}.mh5-l{margin-left:4rem;margin-right:4rem}.mh6-l{margin-left:8rem;margin-right:8rem}.mh7-l{margin-left:16rem;margin-right:16rem}.na1-l{margin:-.25rem}.na2-l{margin:-.5rem}.na3-l{margin:-1rem}.na4-l{margin:-2rem}.na5-l{margin:-4rem}.na6-l{margin:-8rem}.na7-l{margin:-16rem}.nl1-l{margin-left:-.25rem}.nl2-l{margin-left:-.5rem}.nl3-l{margin-left:-1rem}.nl4-l{margin-left:-2rem}.nl5-l{margin-left:-4rem}.nl6-l{margin-left:-8rem}.nl7-l{margin-left:-16rem}.nr1-l{margin-right:-.25rem}.nr2-l{margin-right:-.5rem}.nr3-l{margin-right:-1rem}.nr4-l{margin-right:-2rem}.nr5-l{margin-right:-4rem}.nr6-l{margin-right:-8rem}.nr7-l{margin-right:-16rem}.nb1-l{margin-bottom:-.25rem}.nb2-l{margin-bottom:-.5rem}.nb3-l{margin-bottom:-1rem}.nb4-l{margin-bottom:-2rem}.nb5-l{margin-bottom:-4rem}.nb6-l{margin-bottom:-8rem}.nb7-l{margin-bottom:-16rem}.nt1-l{margin-top:-.25rem}.nt2-l{margin-top:-.5rem}.nt3-l{margin-top:-1rem}.nt4-l{margin-top:-2rem}.nt5-l{margin-top:-4rem}.nt6-l{margin-top:-8rem}.nt7-l{margin-top:-16rem}.strike-l{text-decoration:line-through}.underline-l{text-decoration:underline}.no-underline-l{text-decoration:none}.tl-l{text-align:left}.tr-l{text-align:right}.tc-l{text-align:center}.tj-l{text-align:justify}.ttc-l{text-transform:capitalize}.ttl-l{text-transform:lowercase}.ttu-l{text-transform:uppercase}.ttn-l{text-transform:none}.f-6-l,.f-headline-l{font-size:6rem}.f-5-l,.f-subheadline-l{font-size:5rem}.f1-l{font-size:3rem}.f2-l{font-size:2.25rem}.f3-l{font-size:1.5rem}.f4-l{font-size:1.25rem}.f5-l{font-size:1rem}.f6-l{font-size:.875rem}.f7-l{font-size:.75rem}.measure-l{max-width:30em}.measure-wide-l{max-width:34em}.measure-narrow-l{max-width:20em}.indent-l{text-indent:1em;margin-top:0;margin-bottom:0}.small-caps-l{font-variant:small-caps}.truncate-l{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.center-l{margin-left:auto}.center-l,.mr-auto-l{margin-right:auto}.ml-auto-l{margin-left:auto}.clip-l{position:fixed!important;_position:absolute!important;clip:rect(1px 1px 1px 1px);clip:rect(1px,1px,1px,1px)}.ws-normal-l{white-space:normal}.nowrap-l{white-space:nowrap}.pre-l{white-space:pre}.v-base-l{vertical-align:baseline}.v-mid-l{vertical-align:middle}.v-top-l{vertical-align:top}.v-btm-l{vertical-align:bottom}}@font-face{font-family:Inter;font-style:normal;font-weight:400;src:url(https://media.urbit.org/fonts/Inter-Regular.woff2) format("woff2")}@font-face{font-family:Inter;font-style:italic;font-weight:400;src:url(https://media.urbit.org/fonts/Inter-Italic.woff2) format("woff2")}@font-face{font-family:Inter;font-style:normal;font-weight:700;src:url(https://media.urbit.org/fonts/Inter-Bold.woff2) format("woff2")}@font-face{font-family:Inter;font-style:italic;font-weight:700;src:url(https://media.urbit.org/fonts/Inter-BoldItalic.woff2) format("woff2")}@font-face{font-family:Source Code Pro;src:url(https://storage.googleapis.com/media.urbit.org/fonts/scp-extralight.woff);font-weight:200}@font-face{font-family:Source Code Pro;src:url(https://storage.googleapis.com/media.urbit.org/fonts/scp-light.woff);font-weight:300}@font-face{font-family:Source Code Pro;src:url(https://storage.googleapis.com/media.urbit.org/fonts/scp-regular.woff);font-weight:400}@font-face{font-family:Source Code Pro;src:url(https://storage.googleapis.com/media.urbit.org/fonts/scp-medium.woff);font-weight:500}@font-face{font-family:Source Code Pro;src:url(https://storage.googleapis.com/media.urbit.org/fonts/scp-semibold.woff);font-weight:600}@font-face{font-family:Source Code Pro;src:url(https://storage.googleapis.com/media.urbit.org/fonts/scp-bold.woff);font-weight:700}.spinner-pending{position:relative;background-color:#fff}.spinner-pending,.spinner-pending:after{content:"";border-radius:100%;height:16px;width:16px}.spinner-pending:after{background-color:grey;position:absolute;clip:rect(0,16px,16px,8px);animation:spin 1s cubic-bezier(.745,.045,.355,1) infinite}@keyframes spin{0%{transform:rotate(0deg)}25%{transform:rotate(90deg)}50%{transform:rotate(180deg)}75%{transform:rotate(270deg)}to{transform:rotate(1turn)}}.spinner-nostart{width:8px;height:8px;border-radius:100%;content:"";background-color:#000}a,button,h1,h2,h3,h4,h5,h6,input,p,textarea{margin-block-end:unset;margin-block-start:unset;-webkit-margin-before:unset;-webkit-margin-after:unset;font-family:Inter,sans-serif;padding:0}button,input,textarea{outline:none;-webkit-appearance:none;border:none;background-color:#fff}a{color:#000!important;font-weight:400!important}h2{font-size:32px;line-height:48px;font-weight:700}.body-regular{font-size:16px;line-height:24px;font-weight:600}.body-large{font-size:20px;line-height:24px}.body-medium{font-size:16px;line-height:19px}.body-small{font-size:12px;line-height:16px;color:#7f7f7f}.label-regular,.label-small{font-size:14px;line-height:24px}.label-small-mono{font-size:12px;line-height:24px;font-family:Source Code Pro,monospace}.body-regular-400{font-size:16px;line-height:24px;font-weight:400}.plus-font{font-size:32px;line-height:24px}.btn-font{font-size:14px;line-height:16px;font-weight:600!important}.fw-normal{font-weight:400}.fw-bold{font-weight:700}.fs-italic{font-style:italic}.td-underline{text-decoration:underline}.bg-v-light-gray{background-color:#f9f9f9}.nice-green{color:#2aa779!important}.bg-nice-green{background:#2ed196}.nice-red{color:#ee5432!important}.inter{font-family:Inter,sans-serif}.clamp-3{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;-webkit-line-clamp:2;-webkit-box-orient:vertical}.clamp-message{max-width:calc(100% - 36px - 1.5rem)}.clamp-attachment{overflow:scroll;max-height:10em;max-width:100%}.lh-16{line-height:16px}.mono{font-family:Source Code Pro,monospace}.label-small-mono.list-ship{line-height:29px} \ No newline at end of file diff --git a/pkg/arvo/app/chat/js/index.js b/pkg/arvo/app/chat/js/index.js index ccbb42794..f1b90df04 100644 --- a/pkg/arvo/app/chat/js/index.js +++ b/pkg/arvo/app/chat/js/index.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("buffer")):"function"==typeof define&&define.amd?define("index",["buffer"],t):t((e=e||self).buffer)}(this,function(e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var t="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};t.setTimeout,t.clearTimeout;var n=t.performance||{},r=(n.now||n.mozNow||n.msNow||n.oNow||n.webkitNow,"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{});function i(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function l(e,t){return e(t={exports:{}},t.exports),t.exports}var o=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable;var u=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,r,i=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),a=1;a2?n-2:0),i=2;i1?t-1:0),r=1;r2?n-2:0),i=2;i8)throw new Error("warningWithoutStack() currently supports at most 8 arguments.");if(!e){if("undefined"!=typeof console){var a=r.map(function(e){return""+e});a.unshift("Warning: "+t),Function.prototype.apply.call(console.error,console,a)}try{var l=0,o="Warning: "+t.replace(/%s/g,function(){return r[l++]});throw new Error(o)}catch(e){}}},M={};function S(e,t){var n=e.constructor,r=n&&(n.displayName||n.name)||"ReactClass",i=r+"."+t;M[i]||(x(!1,"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.",t,r),M[i]=!0)}var T={isMounted:function(e){return!1},enqueueForceUpdate:function(e,t,n){S(e,"forceUpdate")},enqueueReplaceState:function(e,t,n,r){S(e,"replaceState")},enqueueSetState:function(e,t,n,r){S(e,"setState")}},E={};function P(e,t,n){this.props=e,this.context=t,this.refs=E,this.updater=n||T}Object.freeze(E),P.prototype.isReactComponent={},P.prototype.setState=function(e,t){"object"!=typeof e&&"function"!=typeof e&&null!=e&&w(!1,"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")},P.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};var N={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)."]},R=function(e,t){Object.defineProperty(P.prototype,e,{get:function(){_(!1,"%s(...) is deprecated in plain JavaScript React classes. %s",t[0],t[1])}})};for(var L in N)N.hasOwnProperty(L)&&R(L,N[L]);function O(){}function D(e,t,n){this.props=e,this.context=t,this.refs=E,this.updater=n||T}O.prototype=P.prototype;var A=D.prototype=new O;A.constructor=D,t(A,P.prototype),A.isPureReactComponent=!0;var I={current:null},U={current:null},j=/^(.*)[\\\/]/,H=1;function z(e){if(null==e)return null;if("number"==typeof e.tag&&x(!1,"Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case d:return"ConcurrentMode";case l:return"Fragment";case a:return"Portal";case s:return"Profiler";case o:return"StrictMode";case p:return"Suspense"}if("object"==typeof e)switch(e.$$typeof){case f:return"Context.Consumer";case c:return"Context.Provider";case h:return r=e,i=e.render,u="ForwardRef",g=i.displayName||i.name||"",r.displayName||(""!==g?u+"("+g+")":u);case m:return z(e.type);case v:var t=(n=e)._status===H?n._result:null;if(t)return z(t)}var n,r,i,u,g;return null}var Z={},F=null;function W(e){F=e}Z.getCurrentStack=null,Z.getStackAddendum=function(){var e="";if(F){var t=z(F.type),n=F._owner;e+=function(e,t,n){var r="";if(t){var i=t.fileName,a=i.replace(j,"");if(/^index\./.test(a)){var l=i.match(j);if(l){var o=l[1];o&&(a=o.replace(j,"")+"/"+a)}}r=" (at "+a+":"+t.lineNumber+")"}else n&&(r=" (created by "+n+")");return"\n in "+(e||"Unknown")+r}(t,F._source,n&&z(n.type))}var r=Z.getCurrentStack;return r&&(e+=r()||""),e};var V={ReactCurrentDispatcher:I,ReactCurrentOwner:U,assign:t};t(V,{ReactDebugCurrentFrame:Z,ReactComponentTreeHook:{}});var q=function(e,t){if(!e){for(var n=V.ReactDebugCurrentFrame.getStackAddendum(),r=arguments.length,i=Array(r>2?r-2:0),a=2;a1){for(var u=Array(c),f=0;f.")}return t}(t);if(!ye[n]){ye[n]=!0;var r="";e&&e._owner&&e._owner!==U.current&&(r=" It was passed a child from "+z(e._owner.type)+"."),W(e),q(!1,'Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',n,r),W(null)}}}function we(e,t){if("object"==typeof e)if(Array.isArray(e))for(var n=0;n",a=" Did you accidentally export a JSX literal instead of a component?"):s=typeof e,q(!1,"React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",s,a)}var c=J.apply(this,arguments);if(null==c)return c;if(r)for(var u=2;u is not supported and will be removed in a future major release. Did you mean to render instead?")),n.Provider},set:function(e){n.Provider=e}},_currentValue:{get:function(){return n._currentValue},set:function(e){n._currentValue=e}},_currentValue2:{get:function(){return n._currentValue2},set:function(e){n._currentValue2=e}},_threadCount:{get:function(){return n._threadCount},set:function(e){n._threadCount=e}},Consumer:{get:function(){return r||(r=!0,q(!1,"Rendering is not supported and will be removed in a future major release. Did you mean to render instead?")),n.Consumer}}}),n.Consumer=a,n._currentRenderer=null,n._currentRenderer2=null,n},forwardRef:function(e){return null!=e&&e.$$typeof===m?x(!1,"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):"function"!=typeof e?x(!1,"forwardRef requires a render function but was given %s.",null===e?"null":typeof e):0!==e.length&&2!==e.length&&x(!1,"forwardRef render functions accept exactly two parameters: props and ref. %s",1===e.length?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),null!=e&&(null!=e.defaultProps||null!=e.propTypes)&&x(!1,"forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?"),{$$typeof:h,render:e}},lazy:function(e){var t={$$typeof:v,_ctor:e,_status:-1,_result:null},n=void 0,r=void 0;return Object.defineProperties(t,{defaultProps:{configurable:!0,get:function(){return n},set:function(e){q(!1,"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."),n=e,Object.defineProperty(t,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return r},set:function(e){q(!1,"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."),r=e,Object.defineProperty(t,"propTypes",{enumerable:!0})}}}),t},memo:function(e,t){return me(e)||x(!1,"memo: The first argument must be a component. Instead received: %s",null===e?"null":typeof e),{$$typeof:m,type:e,compare:void 0===t?null:t}},useCallback:function(e,t){return ve().useCallback(e,t)},useContext:function(e,t){var n=ve();if(void 0!==t&&q(!1,"useContext() second argument is reserved for future use in React. Passing it is not supported. You passed: %s.%s",t,"number"==typeof t&&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":""),void 0!==e._context){var r=e._context;r.Consumer===e?q(!1,"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?"):r.Provider===e&&q(!1,"Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return n.useContext(e,t)},useEffect:function(e,t){return ve().useEffect(e,t)},useImperativeHandle:function(e,t,n){return ve().useImperativeHandle(e,t,n)},useDebugValue:function(e,t){return ve().useDebugValue(e,t)},useLayoutEffect:function(e,t){return ve().useLayoutEffect(e,t)},useMemo:function(e,t){return ve().useMemo(e,t)},useReducer:function(e,t,n){return ve().useReducer(e,t,n)},useRef:function(e){return ve().useRef(e)},useState:function(e){return ve().useState(e)},Fragment:l,StrictMode:o,Suspense:p,createElement:xe,cloneElement:function(e,n,r){for(var i=function(e,n,r){null==e&&w(!1,"React.cloneElement(...): The argument must be a React element, but you passed %s.",e);var i=void 0,a=t({},e.props),l=e.key,o=e.ref,s=e._self,c=e._source,u=e._owner;if(null!=n){Q(n)&&(o=n.ref,u=U.current),K(n)&&(l=""+n.key);var f=void 0;for(i in e.type&&e.type.defaultProps&&(f=e.type.defaultProps),n)Y.call(n,i)&&!B.hasOwnProperty(i)&&(void 0===n[i]&&void 0!==f?a[i]=f[i]:a[i]=n[i])}var d=arguments.length-2;if(1===d)a.children=r;else if(d>1){for(var h=Array(d),p=0;p=t){r=e;break}e=e.next}while(e!==n);null===r?r=n:r===n&&(n=s,u()),(t=r.previous).next=r.previous=s,s.next=r,s.previous=t}}function d(){if(-1===l&&null!==n&&1===n.priorityLevel){s=!0;try{do{f()}while(null!==n&&1===n.priorityLevel)}finally{s=!1,null!==n?u():c=!1}}}function h(e){s=!0;var r=i;i=e;try{if(e)for(;null!==n;){var a=t.unstable_now();if(!(n.expirationTime<=a))break;do{f()}while(null!==n&&n.expirationTime<=a)}else if(null!==n)do{f()}while(null!==n&&!M())}finally{s=!1,i=r,null!==n?u():c=!1,d()}}var p,m,v=Date,g="function"==typeof setTimeout?setTimeout:void 0,b="function"==typeof clearTimeout?clearTimeout:void 0,y="function"==typeof requestAnimationFrame?requestAnimationFrame:void 0,k="function"==typeof cancelAnimationFrame?cancelAnimationFrame:void 0;function w(e){p=y(function(t){b(m),e(t)}),m=g(function(){k(p),e(t.unstable_now())},100)}if("object"==typeof performance&&"function"==typeof performance.now){var _=performance;t.unstable_now=function(){return _.now()}}else t.unstable_now=function(){return v.now()};var x,C,M,S=null;if("undefined"!=typeof window?S=window:void 0!==r&&(S=r),S&&S._schedMock){var T=S._schedMock;x=T[0],C=T[1],M=T[2],t.unstable_now=T[3]}else if("undefined"==typeof window||"function"!=typeof MessageChannel){var E=null,P=function(e){if(null!==E)try{E(e)}finally{E=null}};x=function(e){null!==E?setTimeout(x,0,e):(E=e,setTimeout(P,0,!1))},C=function(){E=null},M=function(){return!1}}else{"undefined"!=typeof console&&("function"!=typeof y&&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 k&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"));var N=null,R=!1,L=-1,O=!1,D=!1,A=0,I=33,U=33;M=function(){return A<=t.unstable_now()};var j=new MessageChannel,H=j.port2;j.port1.onmessage=function(){R=!1;var e=N,n=L;N=null,L=-1;var r=t.unstable_now(),i=!1;if(0>=A-r){if(!(-1!==n&&n<=r))return O||(O=!0,w(z)),N=e,void(L=n);i=!0}if(null!==e){D=!0;try{e(i)}finally{D=!1}}};var z=function(e){if(null!==N){w(z);var t=e-A+U;tt&&(t=8),U=tt?H.postMessage(void 0):O||(O=!0,w(z))},C=function(){N=null,R=!1,L=-1}}t.unstable_ImmediatePriority=1,t.unstable_UserBlockingPriority=2,t.unstable_NormalPriority=3,t.unstable_IdlePriority=5,t.unstable_LowPriority=4,t.unstable_runWithPriority=function(e,n){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var r=a,i=l;a=e,l=t.unstable_now();try{return n()}finally{a=r,l=i,d()}},t.unstable_next=function(e){switch(a){case 1:case 2:case 3:var n=3;break;default:n=a}var r=a,i=l;a=n,l=t.unstable_now();try{return e()}finally{a=r,l=i,d()}},t.unstable_scheduleCallback=function(e,r){var i=-1!==l?l:t.unstable_now();if("object"==typeof r&&null!==r&&"number"==typeof r.timeout)r=i+r.timeout;else switch(a){case 1:r=i+-1;break;case 2:r=i+250;break;case 5:r=i+1073741823;break;case 4:r=i+1e4;break;default:r=i+5e3}if(e={callback:e,priorityLevel:a,expirationTime:r,next:null,previous:null},null===n)n=e.next=e.previous=e,u();else{i=null;var o=n;do{if(o.expirationTime>r){i=o;break}o=o.next}while(o!==n);null===i?i=n:i===n&&(n=e,u()),(r=i.previous).next=i.previous=e,e.next=i,e.previous=r}return e},t.unstable_cancelCallback=function(e){var t=e.next;if(null!==t){if(t===e)n=null;else{e===n&&(n=t);var r=e.previous;r.next=t,t.previous=r}e.next=e.previous=null}},t.unstable_wrapCallback=function(e){var n=a;return function(){var r=a,i=l;a=n,l=t.unstable_now();try{return e.apply(this,arguments)}finally{a=r,l=i,d()}}},t.unstable_getCurrentPriorityLevel=function(){return a},t.unstable_shouldYield=function(){return!i&&(null!==n&&n.expirationTime=a){u=f;break}f=f.next}while(f!==h);null===u?u=h:u===h&&(h=c,_());var d=u.previous;d.next=u.previous=c,c.next=u,c.previous=d}}}function C(){if(-1===g&&null!==h&&h.priorityLevel===n){y=!0;try{do{x()}while(null!==h&&h.priorityLevel===n)}finally{y=!1,null!==h?_():k=!1}}}function M(n){y=!0;var r=p;p=n;try{if(n)for(;!(null===h||e&&m);){var i=t.unstable_now();if(!(h.expirationTime<=i))break;do{x()}while(null!==h&&h.expirationTime<=i&&(!e||!m))}else if(null!==h)do{if(e&&m)break;x()}while(null!==h&&!N())}finally{y=!1,p=r,null!==h?_():k=!1,C()}}var S,T,E,P,N,R=Date,L="function"==typeof setTimeout?setTimeout:void 0,O="function"==typeof clearTimeout?clearTimeout:void 0,D="function"==typeof requestAnimationFrame?requestAnimationFrame:void 0,A="function"==typeof cancelAnimationFrame?cancelAnimationFrame:void 0,I=function(e){S=D(function(t){O(T),e(t)}),T=L(function(){A(S),e(t.unstable_now())},100)};if(w){var U=performance;t.unstable_now=function(){return U.now()}}else t.unstable_now=function(){return R.now()};var j=null;if("undefined"!=typeof window?j=window:void 0!==r&&(j=r),j&&j._schedMock){var H=j._schedMock;E=H[0],P=H[1],N=H[2],t.unstable_now=H[3]}else if("undefined"==typeof window||"function"!=typeof MessageChannel){var z=null,Z=function(e){if(null!==z)try{z(e)}finally{z=null}};E=function(e,t){null!==z?setTimeout(E,0,e):(z=e,setTimeout(Z,0,!1))},P=function(){z=null},N=function(){return!1}}else{"undefined"!=typeof console&&("function"!=typeof D&&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"));var F=null,W=!1,V=-1,q=!1,Y=!1,B=0,$=33,G=33;N=function(){return B<=t.unstable_now()};var Q=new MessageChannel,K=Q.port2;Q.port1.onmessage=function(e){W=!1;var n=F,r=V;F=null,V=-1;var i=t.unstable_now(),a=!1;if(B-i<=0){if(!(-1!==r&&r<=i))return q||(q=!0,I(X)),F=n,void(V=r);a=!0}if(null!==n){Y=!0;try{n(a)}finally{Y=!1}}};var X=function(e){if(null!==F){I(X);var t=e-B+G;tp){y=k;break}k=k.next}while(k!==h);null===y?y=h:y===h&&(h=b,_());var w=y.previous;w.next=y.previous=b,b.next=y,b.previous=w}return b},t.unstable_cancelCallback=function(e){var t=e.next;if(null!==t){if(t===e)h=null;else{e===h&&(h=t);var n=e.previous;n.next=t,t.previous=n}e.next=e.previous=null}},t.unstable_wrapCallback=function(e){var n=v;return function(){var r=v,i=g;v=n,g=t.unstable_now();try{return e.apply(this,arguments)}finally{v=r,g=i,C()}}},t.unstable_getCurrentPriorityLevel=function(){return v},t.unstable_shouldYield=function(){return!p&&(null!==h&&h.expirationTimethis.eventPool.length&&this.eventPool.push(e)}function Ae(e){e.eventPool=[],e.getPooled=Oe,e.release=De}u(Le.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=Ne)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=Ne)},persist:function(){this.isPersistent=Ne},isPersistent:Re,destructor:function(){var e,t=this.constructor.Interface;for(e in t)this[e]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null,this.isPropagationStopped=this.isDefaultPrevented=Re,this._dispatchInstances=this._dispatchListeners=null}}),Le.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null},Le.extend=function(e){function t(){}function n(){return r.apply(this,arguments)}var r=this;t.prototype=r.prototype;var i=new t;return u(i,n.prototype),n.prototype=i,n.prototype.constructor=n,n.Interface=u({},r.Interface,e),n.extend=r.extend,Ae(n),n},Ae(Le);var Ie=Le.extend({data:null}),Ue=Le.extend({data:null}),je=[9,13,27,32],He=me&&"CompositionEvent"in window,ze=null;me&&"documentMode"in document&&(ze=document.documentMode);var Ze=me&&"TextEvent"in window&&!ze,Fe=me&&(!He||ze&&8=ze),We=String.fromCharCode(32),Ve={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(" ")}},qe=!1;function Ye(e,t){switch(e){case"keyup":return-1!==je.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function Be(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var $e=!1;var Ge={eventTypes:Ve,extractEvents:function(e,t,n,r){var i=void 0,a=void 0;if(He)e:{switch(e){case"compositionstart":i=Ve.compositionStart;break e;case"compositionend":i=Ve.compositionEnd;break e;case"compositionupdate":i=Ve.compositionUpdate;break e}i=void 0}else $e?Ye(e,n)&&(i=Ve.compositionEnd):"keydown"===e&&229===n.keyCode&&(i=Ve.compositionStart);return i?(Fe&&"ko"!==n.locale&&($e||i!==Ve.compositionStart?i===Ve.compositionEnd&&$e&&(a=Pe()):(Te="value"in(Se=r)?Se.value:Se.textContent,$e=!0)),i=Ie.getPooled(i,t,n,r),a?i.data=a:null!==(a=Be(n))&&(i.data=a),pe(i),a=i):a=null,(e=Ze?function(e,t){switch(e){case"compositionend":return Be(t);case"keypress":return 32!==t.which?null:(qe=!0,We);case"textInput":return(e=t.data)===We&&qe?null:e;default:return null}}(e,n):function(e,t){if($e)return"compositionend"===e||!He&&Ye(e,t)?(e=Pe(),Ee=Te=Se=null,$e=!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

+

Host

); - } else if (window.ship !== props.ship && - `~${window.ship}` === props.host) { + } else if (window.ship !== props.ship && window.ship === props.owner) { actionElem = (
+ className="w-20 dib list-ship black underline label-small-mono pointer"> Remove ); @@ -39,7 +38,7 @@ export class MemberElement extends Component {

{props.ship}

diff --git a/pkg/interface/chat/src/js/components/lib/message.js b/pkg/interface/chat/src/js/components/lib/message.js index b9af5f0a5..483c2abdf 100644 --- a/pkg/interface/chat/src/js/components/lib/message.js +++ b/pkg/interface/chat/src/js/components/lib/message.js @@ -4,181 +4,61 @@ import classnames from 'classnames'; import moment from 'moment'; import _ from 'lodash'; + export class Message extends Component { - renderSpeech(speech) { - if (_.has(speech, 'lin')) { - return this.renderLin(speech.lin.msg, speech.lin.pat); - } else if (_.has(speech, 'url')) { - return this.renderUrl(speech.url); - } else if (_.has(speech, 'exp')) { - return this.renderExp(speech.exp.exp, speech.exp.res); - } else if (_.has(speech, 'ire')) { - return this.renderSpeech(speech.ire.sep); - } else if (_.has(speech, 'app')) { - return this.renderSpeech(speech.app.sep); - } else if (_.has(speech, 'fat')) { - return this.renderFat(speech.fat.sep, speech.fat.tac); - } else { - return this.renderUnknown(); - } - } - - renderUnknown() { - return this.renderLin('') - } - - renderLin(content, action = false) { - if (content === '') { - return null; - } - //TODO remove once arvo:// urls are supported in url speeches - if (content.indexOf('arvo://') === 0) { - return this.renderUrl(content); - } - return ( -

- {content} -

- ); - } - - renderUrl(url) { - try { - let urlObject = new URL(url); - let imgMatch = - /(jpg|img|png|gif|tiff|jpeg|JPG|IMG|PNG|TIFF|GIF|webp|WEBP|webm|WEBM)$/ - .exec( - urlObject.pathname - ); - if (imgMatch) { - return this.renderImageUrl(url); - } else { - let localUrl = this.localizeUrl(url); - return this.renderAnchor(localUrl, url); - } - } catch(e) { - console.error('url render error', e); - return this.renderAnchor(url); - } - } - - renderImageUrl(url) { - return this.renderAnchor(url, ( - - )); - } - - renderAnchor(href, content) { - content = content || href; - return ( - {content} - ); - } - - renderExp(expression, result) { - return (<> -

-

-          {expression}
-        
-
-          {result[0].join('\n')}
-        
-

- ); - } - - renderFat(speech, attachment) { - return (<> - {this.renderSpeech(speech)} - {this.renderAttachment(attachment)} - ); - } - - renderAttachment(content, title = '') { - if (_.has(content, 'name')) { - return this.renderAttachment(content.name.tac, content.name.nom); - } - - return (
- {'Attached: ' + title} - { _.has(content, 'text') - ? (title === 'long-form') - ? this.renderParagraphs(content.text.split('\n')) - : this.renderPlaintext(content.text) - : _.has(content, 'tank') - ? this.renderPlaintext(content.tank.join('\n')) - : null - } -
); - } - - renderParagraphs(paragraphs) { - return (
- {paragraphs.map(p => (

{p}

))} -
); - } - - renderPlaintext(text) { - return (
{text}
); - } - renderContent() { const { props } = this; + let letter = props.msg.letter; - try { - if (!_.has(props.msg, 'sep')) { - return this.renderUnknown(); - } - return this.renderSpeech(props.msg.sep); - } catch (e) { - console.error('speech rendering error', e); - return this.renderUnknown(); - } - } - - renderAuthor() { - const msg = this.props.msg; - const ship = '~' + msg.aut; - if (_.has(msg, 'sep.app.app')) { - return `:${msg.sep.app.app} (${ship})`; + if ('code' in letter) { + let outputElement = + (!!letter.code.output && + letter.code.output.length && letter.code.output.length > 0) ? + ( +
+            {letter.code.output[0].join('\n')}
+          
+ ) : null; + return ( + +
+            {letter.code.expression}
+          
+ {outputElement} +
+ ); + } else if ('url' in letter) { + return ( + + {letter.url} + + ); + } else if ('me' in letter) { + return ( +

+ {letter.me} +

+ ); } else { - return ship; - } - } - - //NOTE see also lib/chat-input's globalizeUrl - localizeUrl(url) { - if (typeof url !== 'string') { throw 'Only localize strings!'; } - const arvo = 'arvo://'; - if (url.indexOf(arvo) === 0) { - // this application is being served by an urbit also, so /path will - // point to the arvo url as hosted by this same urbit. - return url.slice(arvo.length); - } else { - return url; + return ( +

+ {letter.text} +

+ ); } } render() { const { props } = this; let pending = !!props.msg.pending ? ' o-40' : ''; - let datestamp = moment.unix(props.msg.wen / 1000).format('LL'); + let datestamp = moment.unix(props.msg.when / 1000).format('LL'); let paddingTop = props.paddingTop ? 'pt3' : ''; let paddingBot = props.paddingBot ? 'pb2' : 'pb1'; if (props.renderSigil) { - let timestamp = moment.unix(props.msg.wen / 1000).format('hh:mm a'); + let timestamp = moment.unix(props.msg.when / 1000).format('hh:mm a'); return (
- +

- {this.renderAuthor()} + {props.msg.author}

{timestamp}

@@ -203,7 +83,7 @@ export class Message extends Component {

); } else { - let timestamp = moment.unix(props.msg.wen / 1000).format('hh:mm'); + let timestamp = moment.unix(props.msg.when / 1000).format('hh:mm'); return (
); + let description = this.getLetter(props.description); + let selectedCss = !!props.selected ? 'bg-light-gray' : 'bg-white pointer'; return (
{unreadElem} -

{props.title}

+

{props.title.substr(1)}

{props.ship}

{state.timeSinceNewestMessage}

-

{props.description}

+

{description}

) } diff --git a/pkg/interface/chat/src/js/components/member.js b/pkg/interface/chat/src/js/components/member.js index 3cf1f1e27..86b908a68 100644 --- a/pkg/interface/chat/src/js/components/member.js +++ b/pkg/interface/chat/src/js/components/member.js @@ -5,130 +5,117 @@ import urbitOb from 'urbit-ob'; import { deSig } from '/lib/util'; import { ChatTabBar } from '/components/lib/chat-tabbar'; import { MemberElement } from '/components/lib/member-element'; +import { InviteElement } from '/components/lib/invite-element'; + export class MemberScreen extends Component { constructor(props) { super(props); this.state = { - station: props.match.params.ship + "/" + props.match.params.station, - circle: props.match.params.station, - host: props.match.params.ship, - invMembers: '', - error: false, - success: false + station: `/${props.match.params.ship}/${props.match.params.station}`, }; } - inviteMembers() { - const { props, state } = this; - let sis = state.invMembers.split(',') - .map((mem) => mem.trim()) - .map(deSig); - - let isValid = true; - sis.forEach((mem) => { - if (!urbitOb.isValidPatp(`~${mem}`)) { - isValid = false; - } - }); - - if (isValid) { - props.api.permit(state.circle, sis, true); - if (this.textarea) { - this.textarea.value = ''; - } - this.setState({ - error: false, - success: true, - invMembers: '' - }); - } else { - this.setState({ error: true, success: false }); - } - } - - inviteMembersChange(e) { - this.setState({ - invMembers: e.target.value - }); - } - render() { const { props, state } = this; - let peers = props.peers[state.station] || [window.ship]; - let listMembers = peers.map((mem) => { + let writeGroup = Array.from(props.write.who.values()); + let readGroup = Array.from(props.read.who.values()); + + let writeText = ''; + let readText = ''; + let modWriteText = ''; + let modReadText = ''; + + if (props.write.kind === 'black') { + writeText = 'Everyone banned from writing to this chat.'; + modWriteText = 'Ban someone from writing to this chat.'; + } else if (props.write.kind === 'white') { + writeText = 'Everyone with permission to message this chat.'; + modWriteText = 'Invite someone to write to this chat.'; + } + + if (props.read.kind === 'black') { + readText = 'Everyone banned from reading this chat.'; + modReadText = 'Ban someone from reading this chat.'; + } else if (props.read.kind === 'white') { + readText = 'Everyone with permission to read this chat.'; + modReadText = 'Invite someone to read this chat.'; + } + + let writeListMembers = writeGroup.map((mem) => { return ( + ); + }); + + let readListMembers = readGroup.map((mem) => { + return ( + ); }); - let errorElem = !!this.state.error ? ( -

Invalid ship name.

- ) : ( -
- ); - - let successElem = !!this.state.success ? ( -

Sent invites!

- ) : ( -
- ); - - - let inviteButtonClasses = "label-regular black underline btn-font pointer"; - if (!this.state.error) { - inviteButtonClasses = inviteButtonClasses + ' black'; - } - return (
-

{state.circle}

+

{state.station.substr(1)}

+ numPeers={writeGroup.length} + isOwner={deSig(props.match.params.ship) === window.ship} />
-
-

Permitted Members

-

- Everyone with permission to see this chat. -

- {listMembers} +
+

Members

+

{writeText}

+ {writeListMembers} +
+
+

Modify Permissions

+

+ {modWriteText} +

+ { window.ship === deSig(props.match.params.ship) ? ( + + ) : null } +
+
+
+
+

{readText}

+ {readListMembers} +
+
+

+ {modReadText} +

+ { window.ship === deSig(props.match.params.ship) ? + ( + ) : null + }
- { `~${window.ship}` === state.host ? ( -
-

Invite

-

- Invite new participants to this chat. -

- - - {errorElem} - {successElem} -
- ) : null }
) diff --git a/pkg/interface/chat/src/js/components/new.js b/pkg/interface/chat/src/js/components/new.js index c5de2c798..a8830f1ab 100644 --- a/pkg/interface/chat/src/js/components/new.js +++ b/pkg/interface/chat/src/js/components/new.js @@ -12,21 +12,23 @@ export class NewScreen extends Component { this.state = { idName: '', invites: '', + security: 'village', idError: false, inviteError: false }; this.idChange = this.idChange.bind(this); this.invChange = this.invChange.bind(this); + this.securityChange = this.securityChange.bind(this); } componentDidUpdate(prevProps, prevState) { const { props, state } = this; - if (prevProps.circles !== props.circles) { - let station = `~${window.ship}/${state.idName}`; - if (props.circles.includes(station)) { - props.history.push('/~chat/' + station); + if (prevProps !== props) { + let station = `/~${window.ship}/${state.idName}`; + if (station in props.inbox) { + props.history.push('/~chat/room' + station); } } } @@ -41,6 +43,10 @@ export class NewScreen extends Component { this.setState({invites: event.target.value}); } + securityChange(event) { + this.setState({security: event.target.value}); + } + onClickCreate() { const { props, state } = this; if (!state.idName) { @@ -51,91 +57,73 @@ export class NewScreen extends Component { return; } - let station = `~${window.ship}/${state.idName}`; - let actions = [ - { - create: { - nom: state.idName, - des: "chatroom", - sec: "village" - } - }, - { - source: { - nom: 'inbox', - sub: true, - srs: [station] - } - } - ]; + let station = `/${state.idName}`; + if (station in props.inbox) { + this.setState({ + inviteError: false, + idError: true, + success: false + }); + return; + } - if (state.invites.length > 0) { + // TODO: send invites + let aud = []; + let isValid = true; + if (state.invites.length > 2) { + aud = state.invites.split(',') + .map((mem) => `~${deSig(mem.trim())}`); - let aud = state.invites.split(',') - .map((mem) => mem.trim()) - .map(deSig); - - let isValid = true; aud.forEach((mem) => { - if (!urbitOb.isValidPatp(`~${mem}`)) { + if (!urbitOb.isValidPatp(mem)) { isValid = false; } }); - - if (isValid) { - actions.push({ - permit: { - nom: state.idName, - sis: aud, - inv: true - } - }); - - actions.push({ - phrase: { - aud: aud.map((aud) => `~${aud}/i`), - ses: [{ - inv: { - inv: true, - cir: station - } - }] - } - }); - - if (this.textarea) { - this.textarea.value = ''; - } - - this.setState({ - inviteError: false, - idError: false, - success: true, - invites: '' - }, () => { - props.setSpinner(true); - props.api.chat(actions); - }); - - } else { - this.setState({ - inviteError: true, - idError: false, - success: false - }); - } - } else { - this.setState({ - error: false, - success: true, - invites: '' - }, () => { - props.setSpinner(true); - props.api.chat(actions); - }); } + if (!isValid) { + this.setState({ + inviteError: true, + idError: false, + success: false + }); + return; + } + + if (this.textarea) { + this.textarea.value = ''; + } + + // TODO: don't do this, it's shitty + let writeAud; + let readAud; + + if (state.security === 'village') { + aud.push(`~${window.ship}`); + readAud = aud.slice(); // white list + writeAud = aud.slice(); // white list + } else if (state.security === 'channel') { + readAud = []; // black list + writeAud = []; // black list + } else if (state.security === 'journal') { + aud.push(`~${window.ship}`); + readAud = []; // black list + writeAud = aud.slice(); // white list + } else if (state.security === 'mailbox') { + aud.push(`~${window.ship}`); + readAud = aud.slice(); // white list + writeAud = []; // black list + } + + this.setState({ + error: false, + success: true, + invites: '' + }, () => { + props.setSpinner(true); + props.api.chatView.create(station, state.security, readAud, writeAud); + }); } render() { @@ -194,6 +182,14 @@ export class NewScreen extends Component { }} onChange={this.invChange} /> {invErrElem} +