From 974c41546e253c1bb6d3bdd3c63578c7622762f7 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 22 Mar 2017 19:28:10 +0100 Subject: [PATCH 001/303] Inline documentation. ::x Should eventually be rewritten for consistency, clarity and accuracy, in the doccords format. --- app/talk.hoon | 584 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 545 insertions(+), 39 deletions(-) diff --git a/app/talk.hoon b/app/talk.hoon index 4323b9d609..c7452a07f6 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -1,13 +1,23 @@ :: :: :: :::: /hoon/talk/app :: :: :: :: :: -/? 310 -/- talk, sole -/+ talk, sole, time-to-id, twitter +:: +::TODO master changes +::TODO =/ instead of =+ ^= where possible +::TODO avoid lark where possible +::TODO remove old/unused code +::TODO improve naming +::TODO tidiness +:: +/? 310 :: hoon version +/- talk, sole :: structures +/+ talk, sole, time-to-id, twitter :: libraries /= seed /~ !>(.) :: :::: :: +::x include talk and sole cores from the /+ include into our subject, +::x so we can do some-arm instead of some-arm:talk. [. talk sole] => |% :: data structures ++ house {$6 house-6} :: full state @@ -121,6 +131,8 @@ == :: ++ where (set partner) :: non-empty audience ++ sigh :: assemble label + ::x? why is this not in ++ta? + :: |= {len/@ud pre/tape yiz/cord} ^- tape =+ nez=(trip yiz) @@ -132,8 +144,11 @@ ?. (lth lez len) nez (runt [(sub len lez) '-'] nez) :(welp pre (scag (dec len) nez) "+") - ++ glyphs `wall`~[">=+-" "}),." "\"'`^" "$%&@"] :: station char pool + ++ glyphs `wall`~[">=+-" "}),." "\"'`^" "$%&@"] :: station char pool' ++ peer-type :: stream requests + ::x helper functions for determining/specifying from/in a path, what kind + ::x of subscription our peer wants/what they're interested in. + :: =< apex |% ++ apex ?($a-group $f-grams $v-glyph $x-cabal) :: options @@ -151,22 +166,37 @@ |% :: old protocol workaround door ++ timed + ::x? seems hacky. if old, should be removed in "new talk", right? + ::x? seems like it's used for adding/dealing with "fake"/workaround ships + ::x? with datetimes in their status. but why? + ::x looking at ++pa-remind, this can safely be deleted when breaching state. + :: + ::x a: stations with ships and their status. |_ a/(map partner atlas) :: XX (map partner (pair @da atlas)) ++ strip + ::x removes workaround ships from all partner's status lists. + :: (~(run by a) |=(b/atlas (~(del by b) `@p`%timed-sub))) :: ++ put :: XX put:by + ::x adds workaround ship to d with pretty-printed date c in its status, + ::x then adds it to a with key/partner b. + :: |= {b/partner c/@da d/atlas} =/ sta/status [%gone [~ (some (scot %da c))]] (~(put by a) b (~(put by d) `@p`%timed-sub sta)) :: ++ decode-status + ::x attempts to retrieve datetime from status (as inserted by put:timed). + :: |= a/status ^- (unit @da) ?. ?=({$gone $~ $~ tym/@t} a) ~ => .(a `{$gone $~ $~ tym/@t}`a) (slaw %da tym.a) :: ++ uni + ::x union of two station-shipstatus maps. + :: |= b/_a ^+ a :: XX efficiency %- ~(uni by a) @@ -190,12 +220,34 @@ -- |_ {hid/bowl house} ++ ra :: per transaction + ::x gets called when talk gets poked or otherwise prompted/needs to perform + ::x an action. + ::x arms generally modify state, and store moves in ++ra's moves. these get + ::x produced when calling ++ra-abet. + ::x in applying commands and making reports, it uses ++pa for story work. + :: + ::x moves: moves storage, added to by ++ra-emit and -emil, produced by -abed. |_ moves/(list move) ++ sh :: per console - |_ $: coz/(list command) :: talk actions + ::x shell core, responsible for doing things with console sessions, + ::x like parsing input, acting based on input, showing output, keeping + ::x track of settings and other frontend state. + ::x important arms include ++sh-repo which is used to apply reports, and + ::x ++sh-sole which gets called upon cli prompt interaction. + ::x any talk commands the core's arms want to have executed get put into + ::x coz. the stored commands get applied upon calling ++sh-abet. + :: + |_ $: ::x coz: talk commands storage, applied by ++sh-abet. + ::x she: console session state used in this core. + :: + coz/(list command) :: talk actions she/shell == ++ sh-scad :: command parser + ::x builds a core with parsers for talk-cli, and produces its work arm. + ::x ++work uses those parsers to parse the current talk-cli prompt input + ::x and produce a work item to be executed by ++sh-work. + :: =< work |% ++ expr :: [cord twig] @@ -346,47 +398,71 @@ == -- ++ sh-abet - ^+ +> + ::x applies talk commands (in reverse order, because ++sh-tell adds them + ::x to coz as [new coz], but you want to apply them in the order + ::x [coz new]). produces an updated context for the ++sh core. + :: + ^+ +> ::x points to ++sh's |_ core's context. =+ zoc=(flop coz) - |- ^+ +>+> + |- ^+ +>+> ::x +> would point to |-'s context. +>+> goes to ++sh |_'s. + ::x produce context with this shell updated. ?~ zoc +>+>.$(shells (~(put by shells) ost.hid she)) + ::x recurse, with context (of |-?) modified. $(zoc t.zoc, +>.$ (sh-deal i.zoc)) :: ++ sh-deal :: apply from shell + ::x used by ++sh-abet, applies an individual talk command. + :: |= cod/command ^+ +> ?- -.cod + ::x the $design command is used for modifying channel configs, + ::x which is done when joining, leaving or creating channels. $design ?~ q.cod + ::x updates context with new config state. =. +>+>.$ (ra-config p.cod *config) + ::x produces context with story p.cod deleted. +>.$(stories (~(del by stories) p.cod)) + ::x produces +> with its +> (so, +>+>) updated by ++ra-think. +>(+> (ra-config p.cod u.q.cod)) :: + ::x used for relaying messages (as a station host). $review +>(+> (ra-think | her.she +.cod)) + ::x used for sending messages (as their author). $publish +>(+> (ra-think & her.she +.cod)) == :: ++ sh-fact :: send console effect + ::x adds a console effect to ++ra's moves. + :: |= fec/sole-effect ^+ +> +>(moves :_(moves [ost.hid %diff %sole-effect fec])) :: ++ sh-peep :: peer to path + ::x? unused? + :: |= pax/path ^+ +> +>(+> (ra-subscribe her.she pax)) :: ++ sh-peer :: subscribe shell + ::x create a shell, subscribe to default stories. + :: =< sh-prod %_ . +> =/ typ =+ (ly ~[%a-group %f-grams %x-cabal]) (rap 3 (turn - encode:peer-type)) + ::x subscriptions to the shell's ship's default channels. (ra-subscribe:(ra-subscribe her.she ~) her.she [typ man.she ~]) == :: ++ sh-prod :: show prompt + ::x make and store a move to modify the cli prompt, displaying audience. + :: ^+ . %+ sh-fact %pro :+ & %talk-line @@ -400,19 +476,27 @@ (weld `tape`[p.p.rew por] `tape`[q.p.rew ' ' ~]) :: ++ sh-pact :: update active aud + ::x change currently selected audience to lix, updating prompt. + :: |= lix/(set partner) ^+ +> - =+ act=(sh-pare lix) - ?~ act ~|(%no-audience !!) + =+ act=(sh-pare lix) ::x ensure we can see what we send. + ?~ act ~|(%no-audience !!) ::x? this can't actually happen, right? ?: =(active.she `act) +>.$ sh-prod(active.she `act) :: ++ sh-pare :: adjust target list + ::x if the audience paz does not contain a partner we're subscribed to, + ::x add our mailbox to the audience (so that we can see our own message). + :: |= paz/(set partner) ?: (sh-pear paz) paz (~(put in paz) [%& our.hid man.she]) :: ++ sh-pear :: hearback + ::x produces true if any partner is included in our subscriptions, + ::x aka, if we hear messages sent to paz. + :: |= paz/(set partner) ?~ paz | ?| $(paz l.paz) @@ -421,20 +505,28 @@ == :: ++ sh-pest :: report listen + ::x updates audience to be tay, only if tay is not a village/%white. + ::x? why exclude village (invite-only?) audiences from this? + :: |= tay/partner ^+ +> - ?. ?=($& -.tay) +> - =+ sib=(~(get by ham.system.she) `station`p.tay) + ?. ?=($& -.tay) +> ::x if partner is a passport, do nothing. + =+ sib=(~(get by ham.system.she) `station`p.tay) ::x get config for tay ?. |(?=($~ sib) !?=($white p.cordon.u.sib)) +>.$ (sh-pact [tay ~ ~]) :: ++ sh-rend :: print on one line + ::x renders a telegram as a single line, adds it as a console move, + ::x and updates the selected audience to match the telegram's. + :: |= gam/telegram =+ lin=~(tr-line tr man.she settings.she gam) (sh-fact %txt lin) :: ++ sh-numb :: print msg number + ::x does as it says on the box. + :: |= num/@ud ^+ +> =+ bun=(scow %ud num) @@ -442,18 +534,27 @@ (runt [(sub 13 (lent bun)) '-'] "[{bun}]") :: ++ sh-glyf :: decode glyph + ::x gets the partner(s) that match a glyph. + ::x? why (set partner)? it seems like it only ever returns a single one. + ::TODO should produce a set when ambiguous. + :: |= cha/char ^- (unit (set partner)) =+ lax=(~(get ju nak) cha) - ?: =(~ lax) ~ - ?: ?=({* $~ $~} lax) `n.lax + ?: =(~ lax) ~ ::x no partner. + ?: ?=({* $~ $~} lax) `n.lax ::x single partner. + ::x in case of multiple partners, pick the most recently active one. =+ grams=grams:(~(got by stories) man.she) |- ^- (unit (set partner)) ?~ grams ~ + ::x get first partner from a telegram's audience. =+ pan=(silt (turn (~(tap by q.q.i.grams)) head)) ?: (~(has in lax) pan) `pan $(grams t.grams) - :: + :: + ::TODO we have a stdlib set diff now! ++ sh-repo-house-diff + ::x calculates difference between two shelves (channel definitions). + :: |= {one/shelf two/shelf} =| $= ret $: old/(list (pair knot (pair posture cord))) @@ -482,6 +583,8 @@ ret :: ++ sh-repo-atlas-diff + ::x calculates the difference between two atlasses (presence lists). + :: |= {one/atlas two/atlas} =| $= ret $: old/(list (pair ship status)) @@ -516,6 +619,8 @@ ret :: ++ sh-repo-cabal-diff + ::x calculates the difference between two cabals (station configurations) + :: |= {one/(map station config) two/(map station config)} =| $= ret $: old/(list (pair station config)) @@ -544,6 +649,9 @@ ret :: ++ sh-repo-rogue-diff + ::x calculates the difference between two maps of stations and their + ::x presence lists. + :: |= {one/(map partner atlas) two/(map partner atlas)} =| $= ret $: old/(list (pair partner atlas)) @@ -574,6 +682,8 @@ ret :: ++ sh-repo-whom-diff + ::x calculates the difference between two partner sets. + :: |= {one/(set partner) two/(set partner)} =| $= ret $: old/(list partner) @@ -599,6 +709,8 @@ ret :: ++ sh-repo-ship-diff + ::x calculates the difference between two ship sets. + :: |= {one/(set ship) two/(set ship)} =| $= ret $: old/(list ship) @@ -624,6 +736,8 @@ ret :: ++ sh-puss + ::x posture as text. + :: |= a/posture ^- tape ?- a $black "channel" @@ -633,6 +747,8 @@ == :: ++ sh-repo-config-exceptions + ::x used by ++sh-repo-config-show to aid in printing info to cli. + :: |= {pre/tape por/posture old/(list ship) new/(list ship)} =+ out=?:(?=(?($black $brown) por) "try " "cut ") =+ inn=?:(?=(?($black $brown) por) "ban " "add ") @@ -649,6 +765,9 @@ +>.$ :: ++ sh-repo-config-sources + ::x used by ++sh-repo-config-show to aid in printing info to cli, + ::x pertaining to the un/subscribing to partners. + :: |= {pre/tape old/(list partner) new/(list partner)} ^+ +> =. +>.$ @@ -664,6 +783,8 @@ +>.$ :: ++ sh-repo-config-show + ::x prints config changes to the cli. + :: |= {pre/tape laz/config loc/config} ^+ +> =. +>.$ @@ -685,6 +806,8 @@ (sh-repo-ship-diff q.cordon.laz q.cordon.loc) :: ++ sh-repo-cabal-changes + ::x used by ++sh-repo-cabal for printing cabal config changes to cli. + :: |= $: laz/(map station config) old/(list (pair station config)) new/(list (pair station config)) @@ -708,6 +831,8 @@ +>.$ :: ++ sh-repo-cabal + ::x updates the current shell's cabal and prints changes to cli. + :: |= bal/cabal ^+ +> =+ laz=system.she @@ -718,6 +843,8 @@ (sh-repo-config-show "" loc.laz loc.bal) :: ++ sh-repo-house + ::x applies new shelf ("house"?) and prints changes to cli. + :: |= awl/(map knot (pair posture cord)) ^+ +> =+ dif=(sh-repo-house-diff harbor.she awl) @@ -748,16 +875,22 @@ +>.$ :: ++ sh-note :: shell message + ::x prints a txt to cli in talk's format. + :: |= txt/tape ^+ +> (sh-fact %txt (runt [14 '-'] `tape`['|' ' ' (scag 64 txt)])) :: ++ sh-spaz :: print status + ::x gets the presence of a status. + :: |= saz/status ^- tape ['%' (trip p.saz)] :: ++ sh-repo-group-diff-here :: print atlas diff + ::x prints presence notifications. + :: |= $: pre/tape $= cul $: old/(list (pair ship status)) @@ -786,6 +919,8 @@ +>.$ :: ++ sh-repo-group-here :: update local + ::x updates local presence store and prints changes. + :: |= loc/atlas ^+ +> =+ cul=(sh-repo-atlas-diff p.owners.she loc) @@ -793,6 +928,8 @@ (sh-repo-group-diff-here "" cul) :: ++ sh-repo-group-there :: update foreign + ::x updates remote presences(?) and prints changes. + :: |= yid/(map partner atlas) =+ day=(sh-repo-rogue-diff q.owners.she yid) =+ dun=q.owners.she @@ -823,6 +960,8 @@ +>.$ :: ++ sh-repo-group + ::x update local and remote presences. + :: |= ges/register ^+ +> =. +> (sh-repo-group-here p.ges) @@ -830,6 +969,9 @@ +> :: ++ sh-repo-gram + ::x renders telegram: increase gram count and print the gram. + ::x every fifth gram, prints the number. + :: |= {num/@ud gam/telegram} ^+ +> ?: =(num count.she) @@ -841,12 +983,16 @@ +> :: ++ sh-repo-grams :: apply telegrams + ::x renders telegrams. + :: |= {num/@ud gaz/(list telegram)} ^+ +> ?~ gaz +> $(gaz t.gaz, num +(num), +> (sh-repo-gram num i.gaz)) :: ++ sh-repo-glyph :: apply binding + ::x updates glyph bindings and lookup, and updates selected audience. + :: |= nac/(jug char (set partner)) ^+ +> %_ sh-prod @@ -859,6 +1005,8 @@ == :: ++ sh-repo :: apply report + ::x applies the different kinds of reports using their handler arms above + :: |= rad/report ^+ +> :: ~& [%sh-repo rad] @@ -871,6 +1019,9 @@ == :: ++ sh-sane-chat :: sanitize chatter + ::x (for chat messages) sanitizes the input buffer and splits it into + ::x multiple lines ('•'). + :: |= buf/(list @c) ^- (list sole-edit) ?~ buf ~ @@ -911,6 +1062,8 @@ -- :: ++ sh-sane :: sanitize input + ::x parses cli prompt input using ++sh-scad and sanitizes when invalid. + :: |= {inv/sole-edit buf/(list @c)} ^- {lit/(list sole-edit) err/(unit @u)} =+ res=(rose (tufa buf) sh-scad) @@ -929,6 +1082,8 @@ == :: ++ sh-slug :: edit to sanity + ::x corrects invalid prompt input. + :: |= {lit/(list sole-edit) err/(unit @u)} ^+ +> ?~ lit +> @@ -937,6 +1092,9 @@ (sh-fact [%mor [%det lic] ?~(err ~ [%err u.err]~)]) :: ++ sh-stir :: apply edit + ::x called when typing into the talk prompt. applies the change and does + ::x sanitizing. + :: |= cal/sole-change ^+ +> =^ inv say.she (~(transceive sole say.she) cal) @@ -950,23 +1108,34 @@ (sh-slug fix) :: ++ sh-lame :: send error + ::x just puts some text into the cli. + :: |= txt/tape (sh-fact [%txt txt]) :: ++ sh-whom :: current audience + ::x produces the currently selected audience for this shell. + :: ^- audience %- ~(gas by *audience) %+ turn (~(tap in u.active.she)) |=(a/partner [a *envelope %pending]) :: ++ sh-tell :: add command + ::x adds talk command to core state. these get applied with ++sh-abet. + :: |= cod/command %_(+> coz [cod coz]) :: ++ sh-twig-head ^- vase :: eval data + ::x makes a vase of environment data to evaluate against (#-messages). + :: !>(`{our/@p now/@da eny/@uvI}`[our.hid now.hid (shas %eny eny.hid)]) :: ++ sh-work :: do work + ::x implements worker arms for different talk commands. + ::x all worker arms must produce updated state/context. + :: |= job/work ^+ +> =+ roy=(~(got by stories) man.she) @@ -1037,6 +1206,7 @@ =+ cha=(glyph (mug pan)) (sh-note:(set-glyph cha pan) "new glyph {}") =+ loc=loc.system.she + ::x change local mailbox config to include subscription to pan. %^ sh-tell %design man.she `loc(sources (~(uni in sources.loc) pan)) :: @@ -1044,6 +1214,7 @@ |= pan/(set partner) ^+ ..sh-work =+ loc=loc.system.she + ::x change local mailbox config to exclude subscription to pan. %^ sh-tell %design man.she `loc(sources (~(dif in sources.loc) pan)) :: @@ -1104,6 +1275,7 @@ ?: (~(has in stories) nom) (sh-lame "{(trip nom)}: already exists") =. ..sh-work + ::x create new config for channel. %^ sh-tell %design nom :- ~ :+ *(set partner) @@ -1222,6 +1394,10 @@ -- :: ++ sh-done :: apply result + ::x called upon hitting return in the prompt. if input is invalid, + ::x ++sh-slug is called. otherwise, the appropriate work is done + ::x and the entered command (if any) gets displayed to the user. + :: =+ fix=(sh-sane [%nop ~] buf.say.she) ?^ lit.fix (sh-slug fix) @@ -1241,6 +1417,8 @@ == :: ++ sh-sole :: apply edit + ::x applies sole action. + :: |= act/sole-action ^+ +> ?- -.act @@ -1250,33 +1428,46 @@ == :: ++ sh-uniq + ::x generates a new serial. + :: ^- {serial _.} [(shaf %serial eny.hid) .(eny.hid (shax eny.hid))] -- ++ ra-abed :: resolve core + ::x produces the moves stored in ++ra's moves. + ::x sole-effects get special treatment to become a single move. + :: ^+ [*(list move) +>] :_ +> - =+ ^= yop + ::x seperate our sole-effects from other moves. + =+ ^= yop |- ^- (pair (list move) (list sole-effect)) ?~ moves [~ ~] =+ mor=$(moves t.moves) - ?: ?& =(ost.hid p.i.moves) + ?: ?& =(ost.hid p.i.moves) ?=({$diff $sole-effect *} q.i.moves) == [p.mor [+>.q.i.moves q.mor]] [[i.moves p.mor] q.mor] + ::x flop moves, flop and squash sole-effects into a %mor. =+ :* moz=(flop p.yop) ^= foc ^- (unit sole-effect) - ?~ q.yop ~ + ?~ q.yop ~ ?~(t.q.yop `i.q.yop `[%mor (flop `(list sole-effect)`q.yop)]) == + ::x produce moves or sole-effects and moves. ?~(foc moz [[ost.hid %diff %sole-effect u.foc] moz]) :: ++ ra-abet :: complete core + ::x applies talk reports, then produces moves and updated state. + :: ra-abed:ra-axel :: ++ ra-axel :: rebound reports + ::x extracts and applies the talk-reports in moves. + :: ^+ . + ::x separate our talk-reports from other moves. =+ ^= rey |- ^- (pair (list move) (list (pair bone report))) ?~ moves @@ -1287,20 +1478,26 @@ == [[i.moves p.mor] q.mor] [p.mor [[p.i.moves +>.q.i.moves] q.mor]] + ::x update moves to exclude talk-reports. =. moves p.rey =. q.rey (flop q.rey) ?: =(q.rey ~) + |- ^+ +> ?~ q.rey ra-axel + ::x apply reports. =+ bak=(ra-back(ost.hid p.i.q.rey) q.i.q.rey) $(q.rey t.q.rey, +> bak(ost.hid ost.hid)) :: ++ ra-back + ::x applies report. + :: |= rad/report ^+ +> sh-abet:(~(sh-repo sh ~ (~(got by shells) ost.hid)) rad) :: ++ ra-sole + ::x applies sole-action. + :: |= act/sole-action ^+ +> =+ shu=(~(get by shells) ost.hid) @@ -1311,19 +1508,29 @@ sh-abet:(~(sh-sole sh ~ u.shu) act) :: ++ ra-emil :: ra-emit move list + ::x adds multiple moves to the core's list. flops to emulate ++ra-emit. + :: |= mol/(list move) %_(+> moves (welp (flop mol) moves)) :: ++ ra-emit :: emit a move + ::x adds a move to the core's list. + :: |= mov/move %_(+> moves [mov moves]) :: ++ ra-evil :: emit error + ::x stack trace and crash. + :: |= msg/cord ~| [%ra-evil msg] !! :: ++ ra-house :: emit partners + ::x emits a talk-report move containing all our stories? + ::x? this is for showing people what they can subscribe to, right? + ::x? but this also shows invite-only stories, aren't they secret clubs? + :: |= ost/bone %+ ra-emit ost.hid :+ %diff %talk-report @@ -1333,6 +1540,8 @@ |=({a/knot b/story} [a p.cordon.shape.b caption.shape.b]) :: ++ ra-homes :: update partners + ::x send a list of our stories to all general subscribers. + :: =+ gel=general |- ^+ +> ?~ gel +> @@ -1341,6 +1550,8 @@ (ra-house n.gel) :: ++ ra-init :: initialize talk + ::x populate state on first boot. creates our main and public stories. + :: %+ roll ^- (list {posture knot cord}) :~ [%brown (main our.hid) 'default home'] @@ -1353,26 +1564,37 @@ [des [typ ~]] :: ++ ra-apply :: apply command + ::x applies the command sent by her. + :: |= {her/ship cod/command} ^+ +> ?- -.cod + ::x the $design command is used for modifying channel configs, + ::x which is done when joining, leaving or creating channels. + ::x this may only be done by ourselves. + ::x? shouldn't this be team-only too? $design ?. =(her our.hid) (ra-evil %talk-no-owner) ?~ q.cod ?. (~(has by stories) p.cod) (ra-evil %talk-no-story) + ::x? why delete story if we got no config? can't we overwrite? (ra-config(stories (~(del by stories) p.cod)) p.cod *config) (ra-config p.cod u.q.cod) :: + ::x used for relaying messages (as a station host). $review (ra-think | her +.cod) :: + ::x used for sending messages (as their author). $publish ?. (team our.hid her) +>.$ (ra-think & her +.cod) == :: ++ ra-config :: configure story + ::x (re)configures story man. if it's a new story, emit our stories. + :: |= {man/knot con/config} ^+ +> =+ :- neu=(~(has by stories) man) @@ -1380,9 +1602,16 @@ =. +>.$ pa-abet:(~(pa-reform pa man pur) con) ?:(neu +>.$ ra-homes) :: - ++ ra-base-hart .^(hart %e /(scot %p our.hid)/host/(scot %da now.hid)) + ++ ra-base-hart + ::x produces our ship's host desk's web address as a hart. + :: + .^(hart %e /(scot %p our.hid)/host/(scot %da now.hid)) + :: ++ ra-fora-post + ::x sends a fora post. if we don't have a channel for posts yet, create one + :: |= {pax/path sup/spur hed/@t txt/@t} + ::x tell %hood to submit a fora post. =. ..ra-emit %+ ra-emit ost.hid :* %poke @@ -1391,22 +1620,28 @@ [%write-fora-post sup src.hid hed txt] == =+ man=%posts + ::x if we have a %posts story, go ahead and consume. ?: (~(has by stories) man) (ra-consume-fora-post man pax hed txt) + ::x if we have no %posts story, first create it, then consume. =; new (ra-consume-fora-post:new man pax hed txt) =. ..ra-apply %+ ra-apply our.hid :+ %design man - :- ~ :- ~ - :- 'towards a community' - [%brown ~] + :- ~ :- ~ ::x sources + :- 'towards a community' ::x caption + [%brown ~] ::x cordon + ::x send informative message to our mailbox. %^ ra-consume & our.hid - :^ (shaf %init eny.hid) - (my [[%& our.hid (main our.hid)] *envelope %pending] ~) + :^ (shaf %init eny.hid) ::x serial + (my [[%& our.hid (main our.hid)] *envelope %pending] ~) ::x audience + ::x statement now.hid [~ %app %tree 'receiving forum posts, ;join %posts for details'] :: ++ ra-consume-fora-post + ::x add a message for a fora post to the man story. + :: |= {man/knot pax/path hed/@t txt/@t} ^+ +> =. pax (welp pax /posts/(crip "{}~")) %^ ra-consume | @@ -1422,6 +1657,8 @@ == :: ++ ra-comment + ::x sends a comment. if we don't have a channel for them yet, creates one. + :: |= {pax/path sup/spur txt/@t} =. ..ra-emit %+ ra-emit ost.hid @@ -1447,6 +1684,8 @@ [~ %app %tree 'receiving comments, ;join %comments for details'] :: ++ ra-consume-comment + ::x adds a message for a comment to the man story. + :: |= {man/knot pax/path sup/spur txt/@t} ^+ +> =+ nam=?~(sup "" (trip i.sup)) :: file name =+ fra=(crip (time-to-id now.hid)) :: url fragment @@ -1463,6 +1702,9 @@ == :: ++ ra-know :: story monad + ::x produces a wet core that takes a gate that takes a story core and + ::x produces updated state. + :: |= man/knot |* fun/$-(_pa _+>) ^+ +>+> @@ -1470,28 +1712,40 @@ ?~ pur ~& [%ra-know-not man] :: XX should crash +>+>.$ + ::x call the sample gate with a ++pa core. (fun ~(. pa man u.pur)) :: ++ ra-diff-talk-report :: subscription update + ::x process a talk report from cuz into story man. + :: |= {man/knot cuz/station rad/report} %- (ra-know man) |= par/_pa =< pa-abet (pa-diff-talk-report:par cuz rad) :: ++ ra-quit :: subscription quit + ::x removes cuz from the subscribers of story man. + :: |= {man/knot cuz/station} %- (ra-know man) |= par/_pa =< pa-abet (pa-quit:par %& cuz) :: ++ ra-retry :: subscription resend + ::x produce a %peer/subscribe move for cuz to story man. + :: |= {man/knot cuz/station} %- (ra-know man) |= par/_pa =< pa-abet (pa-acquire:par [%& cuz]~) :: ++ ra-coup-repeat :: + ::x assemble partner and call ++ra-repeat. + :: |= {{num/@ud her/@p man/knot} saw/(unit tang)} (ra-repeat num [%& her man] saw) :: - ++ ra-repeat :: remove from outbox + ++ ra-repeat :: remove from outbox + ::x take message out of outbox, mark it as received or rejected. + ::x crashes if pan is not in message's audience. + :: |= {num/@ud pan/partner saw/(unit tang)} =+ oot=(~(get by q.outbox) num) ?~ oot ~|([%ra-repeat-none num] !!) @@ -1506,14 +1760,20 @@ (ra-think | our.hid u.oot ~) :: ++ ra-cancel :: drop a bone + ::x removes a bone from the story in pax. + :: |= {src/ship pax/path} ^+ +> ?. ?=({@ @ *} pax) + ::x if story is not in path, just delete the bone from general. +>(general (~(del in general) ost.hid)) %- (ra-know i.t.pax) |= par/_pa =< pa-abet + ::x delete bone from all follower groups and set src's status to %gone. (pa-notify:pa-cancel:par src %gone *human) :: ++ ra-human :: look up person + ::x get her identity. if she has none, make her one. + :: |= her/ship ^- {human _+>} =^ who folks @@ -1524,8 +1784,11 @@ [who +>.$] :: ++ ra-console :: console subscribe + ::x make a shell for her, subscribe her to it. + :: |= {her/ship pax/path} ^+ +> + ::x get story from the path, default to standard mailbox. =/ man/knot ?+ pax !! $~ (main her) @@ -1536,9 +1799,12 @@ sh-abet:~(sh-peer sh ~ `shell`she) :: ++ ra-subscribe :: listen to + ::x subscribe her at pax. + :: |= {her/ship pax/path} ^+ +> :: ~& [%ra-subscribe ost.hid her pax] + ::x empty path, meta-subscribe and send report with all our stories. ?: ?=($~ pax) (ra-house(general (~(put in general) ost.hid)) ost.hid) ?. ?=({@ @ *} pax) @@ -1549,23 +1815,31 @@ ~& [%bad-subscribe-story-c i.t.pax] (ra-evil %talk-no-story) =+ soy=~(. pa i.t.pax u.pur) + ::x check her read permissions. ?. (pa-visible:soy her) (ra-evil %talk-no-story) =^ who +>.$ (ra-human her) + ::x for each stream type she is interested in, add her to the followers. =. soy ?.((~(has in vab) %a-group) soy (pa-watch-group:soy her)) =. soy ?.((~(has in vab) %v-glyph) soy (pa-watch-glyph:soy her)) =. soy ?.((~(has in vab) %x-cabal) soy (pa-watch-cabal:soy her)) =. soy ?.((~(has in vab) %f-grams) soy (pa-watch-grams:soy her t.t.pax)) + ::x add her status to presence map. =. soy (pa-notify:soy her %hear who) + ::x apply changes to story. pa-abet:soy :: ++ ra-think :: publish+review + ::x consumes each thought. + :: |= {pub/? her/ship tiz/(list thought)} ^+ +> ?~ tiz +> $(tiz t.tiz, +> (ra-consume pub her i.tiz)) :: ++ ra-normal :: normalize + ::x sanitize %lin speech, enforce lowercase and no special characters. + :: |= tip/thought ^- thought ?. ?=({$lin *} r.r.tip) tip @@ -1584,14 +1858,19 @@ == :: ++ ra-consume :: consume thought + ::x if pub is true, sends the thought to each partner in the audience. + ::x if false, updates the thought in our store. + :: |= {pub/? her/ship tip/thought} =. tip (ra-normal tip) - =+ aud=(~(tap by q.tip) ~) + =+ aud=(~(tap by q.tip) ~) ::x why ~ ? |- ^+ +>.^$ ?~ aud +>.^$ $(aud t.aud, +>.^$ (ra-conduct pub her p.i.aud tip)) :: ++ ra-conduct :: thought to partner + ::x record a message or sends it. + :: |= {pub/? her/ship tay/partner tip/thought} ^+ +> :: ~& [%ra-conduct pub her tay] @@ -1608,11 +1887,15 @@ == :: ++ ra-record :: add to story + ::x add or update a telegram in story man. + :: |= {man/knot gam/telegram} %- (ra-know man) |= par/_pa =< pa-abet (pa-learn:par gam) :: ++ ra-transmit :: send to neighbor + ::x sends a thought to a station, adds it to the outbox. + :: |= {cuz/station tip/thought} ^+ +> =. +> @@ -1625,14 +1908,28 @@ +>(p.outbox +(p.outbox), q.outbox (~(put by q.outbox) p.outbox tip)) :: ++ pa :: story core - |_ $: man/knot + ::x story core, used for doing work on a story. + ::x as always, an -abet arms is used for applying changes to the state. + ::x ++pa-watch- arms get called by ++ra-subscribe to add a subscriber. + ::x bones are used to identify subscribers (source event identifiers) + :: + |_ ::x man: the knot identifying the story in stories. + ::x story doesn't get a face because ease of use + :: + $: man/knot story == ++ pa-abet + ::x apply/fold changes back into the stories map. + :: ^+ +> +>(stories (~(put by stories) man `story`+<+)) :: ++ pa-admire :: accept from + ::x should be checking her write permissions, but defaults to allowed. + ::x commented code seems to use an older control structure. + ::x? this seems like an easy fix, why was this ever disabled? + :: |= her/ship ^- ? ::?- -.cordon.shape @@ -1642,16 +1939,20 @@ & :: ++ pa-visible :: display to + ::x checks her read permissions. + :: |= her/ship ^- ? ?- p.cordon.shape - $black & - $green & - $brown (team our.hid her) - $white (~(has in q.cordon.shape) her) + $black & ::x channel, all + $green & ::x journal, all + $brown (team our.hid her) ::x mailbox, our + $white (~(has in q.cordon.shape) her) ::x village, invite == :: ++ pa-report :: update + ::x sends report to all bones. + :: |= {wac/(set bone) caw/report} :: ~& [%pa-report man -.caw] ^+ +> @@ -1662,6 +1963,9 @@ (pa-sauce n.wac [%diff %talk-report caw]~) :: ++ pa-watch-group :: subscribe presence + ::x if she may, add her bone to presence followers and send her a group + ::x (presence) report. + :: |= her/ship ?. (pa-admire her) (pa-sauce ost.hid [%quit ~]~) @@ -1669,6 +1973,9 @@ (pa-report-group ost.hid ~ ~) :: ++ pa-watch-cabal :: subscribe config + ::x if she may, add her bone to config followers and send her an updated + ::x cabal (config) report. + :: |= her/ship ?. (pa-admire her) ~& [%pa-admire-not her] @@ -1678,6 +1985,9 @@ (pa-sauce ost.hid [[%diff %talk-report %cabal shape mirrors] ~]) :: ++ pa-watch-glyph :: subscribe config + ::x if she may, add her bone to glyph followers and send an updated glyph + ::x report. + :: |= her/ship ?. (pa-admire her) ~& [%pa-admire-not her] @@ -1686,6 +1996,10 @@ (pa-report [ost.hid ~ ~] %glyph nak) :: ++ pa-report-group :: update presence + ::x build a group report, containing our different presence maps, and + ::x send it to all bones. + ::x? why should we be responsible for sending remotes presences? + :: |= vew/(set bone) %^ pa-report vew %group :- %- ~(run by locals) @@ -1699,9 +2013,15 @@ |=({@ a/status} a) :: ++ pa-report-cabal :: update config + ::x a cabal report, containing our and remote configs, to all config + ::x followers. + :: (pa-report cabalers %cabal shape mirrors) :: ++ pa-cabal + ::x add station's config to our remote config map. + ::x? ham is unused, not even when calling this. + :: |= {cuz/station con/config ham/(map station config)} ^+ +> =+ old=mirrors @@ -1711,8 +2031,11 @@ pa-report-cabal :: ++ pa-diff-talk-report :: subscribed update + ::x process a talk report from cuz. + :: |= {cuz/station rad/report} ^+ +> + ::x verify we are supposed to receive reports from cuz. ?. (~(has in sources.shape) [%& cuz]) ~& [%pa-diff-unexpected cuz rad] +> @@ -1723,10 +2046,14 @@ == :: ++ pa-quit :: stop subscription + ::x delete tay from our subscriptions, then send an updated capal report. + :: |= tay/partner pa-report-cabal(sources.shape (~(del in sources.shape) tay)) :: ++ pa-sauce :: send backward + ::x turns cards into moves, reverse order, prepend to existing moves. + :: |= {ost/bone cub/(list card)} %_ +>.$ moves @@ -1734,8 +2061,10 @@ == :: ++ pa-abjure :: unsubscribe move + ::x for each partner, produce a %pull/unsubscribe move. + :: |= tal/(list partner) - %+ pa-sauce 0 + %+ pa-sauce 0 ::x why bone 0? %- zing %+ turn tal |= tay/partner @@ -1754,6 +2083,8 @@ == :: ++ pa-acquire :: subscribe to + ::x for each partner, produce a %peer/subscribe move. + :: |= tal/(list partner) %+ pa-sauce 0 %- zing @@ -1762,6 +2093,8 @@ ^- (list card) =+ num=(~(get by sequence) tay) =+ old=(sub now.hid ~d1) :: XX full backlog + ::x subscribe starting at the last message we read, + ::x or if we haven't read any yet, messages from up to a day ago. =+ ini=?^(num (scot %ud u.num) (scot %da old)) =/ typ =+ (ly ~[%a-group %f-grams %x-cabal]) @@ -1778,6 +2111,9 @@ == :: ++ pa-reform :: reconfigure, ugly + ::x change config of current story, subscribe/unsubscribe to/from the + ::x partners we gained/lost, and send out an updated cabal report. + :: |= cof/config =+ ^= dif ^- (pair (list partner) (list partner)) =+ old=`(list partner)`(~(tap in sources.shape) ~) @@ -1790,6 +2126,8 @@ pa-report-cabal :: ++ pa-cancel :: unsubscribe from + ::x deletes the current ost.hid from all follower groups. + :: :: ~& [%pa-cancel ost.hid] %_ . gramsers (~(del by gramsers) ost.hid) @@ -1799,6 +2137,8 @@ == :: ++ pa-notify :: local presence + ::x add her status to our presence map. if this changes it, send report. + :: |= {her/ship saz/status} ^+ +> =/ nol (~(put by locals) her now.hid saz) @@ -1806,7 +2146,11 @@ (pa-report-group(locals nol) groupers) :: ++ pa-remind :: remote presence + ::x adds tay's loc to our remote presence map, after merging with rem. + ::x if this changes anything, send update report. + :: |= {tay/partner loc/atlas rem/(map partner atlas)} + ::x remove this story from the presence map, since it's in local already. =. rem (~(del by rem) %& our.hid man) :: superceded by local data =/ buk (~(uni timed remotes) rem) :: XX drop? =. buk (~(put timed buk) tay now.hid loc) @@ -1814,12 +2158,15 @@ (pa-report-group(remotes buk) groupers) :: ++ pa-start :: start stream + ::x grab all telegrams that fall within the river and send them in a + ::x grams report to ost.hid. + :: |= riv/river ^+ +> =- :: ~& [%pa-start riv lab] =. +>.$ (pa-sauce ost.hid [[%diff %talk-report %grams q.lab r.lab] ~]) - ?: p.lab + ?: p.lab ::x? dun never gets changed, so always | ? (pa-sauce ost.hid [[%quit ~] ~]) +>.$(gramsers (~(put by gramsers) ost.hid riv)) ^= lab @@ -1830,22 +2177,29 @@ $ud (lte p.q.riv end) $da (lte p.q.riv p.r.q.i.gaz) == + ::x if we're past the river, continue browsing back. $(end (dec end), gaz t.gaz) ?: ?- -.p.riv :: before the start $ud (lth end p.p.riv) $da (lth p.r.q.i.gaz p.p.riv) == + ::x if we're before the river, we're done. [dun end zeg] + ::x if we're in the river, add this gram and continue. $(end (dec end), gaz t.gaz, zeg [i.gaz zeg]) :: ++ pa-watch-grams :: subscribe messages + ::x (called upon subscribe) send backlog of grams to her. + ::x deduces which messages to send from pax. + :: |= {her/ship pax/path} ^+ +> ?. (pa-admire her) ~& [%pa-watch-grams-admire ~] (pa-sauce ost.hid [%quit ~]~) + ::x find the range of grams to send. =+ ^= ruv ^- (unit river) - %+ biff + %+ biff ::x collapse unit list. (zl:jo (turn pax ;~(biff slay |=(a/coin `(unit dime)`?~(-.a a ~))))) |= paf/(list dime) ?~ paf @@ -1854,6 +2208,7 @@ $(t.paf [%da (dec (bex 128))]~) ?. ?=({{?($ud $da) @} {?($ud $da) @} $~} paf) ~ + ::x? the switches, they do nothing! `[[?+(- . $ud .)]:i.paf [?+(- . $ud .)]:i.t.paf] :: XX types :: ~& [%pa-watch-grams her pax ruv] ?~ ruv @@ -1862,6 +2217,10 @@ (pa-start u.ruv) :: ++ pa-refresh :: update to listeners + ::x called when grams get added or changed. calculates the changes and + ::x sends them to all message followers. if we run into any followers + ::x that are no longer interested in this story, remove them. + :: |= {num/@ud gam/telegram} ^+ +> =+ ^= moy @@ -1889,33 +2248,43 @@ $(p.moy t.p.moy, gramsers (~(del by gramsers) i.p.moy)) :: ++ pa-lesson :: learn multiple + ::x learn all telegrams in a list. + :: |= gaz/(list telegram) ^+ +> ?~ gaz +> $(gaz t.gaz, +> (pa-learn i.gaz)) :: ++ pa-learn :: learn message + ::x store an incoming telegram, modifying audience to say we received it. + ::x update existing telegram if it already exists. + :: |= gam/telegram ^+ +> + ::x if author isn't allowed to write here, reject. ?. (pa-admire p.gam) ~& %pa-admire-rejected +>.$ - =. q.q.gam + =. q.q.gam + ::x if we are in the audience, mark us as having received it. =+ ole=(~(get by q.q.gam) [%& our.hid man]) ?^ ole (~(put by q.q.gam) [%& our.hid man] -.u.ole %received) :: for fedearted stations, pretend station src/foo is also our/foo :: XX pass src through explicitly instead of relying on implicit - :: value in hid from the subscription to src/foo + :: value in hid from the subscription to src/foo =+ ole=(~(get by q.q.gam) [%& src.hid man]) ?~ ole q.q.gam + ::x as described above, fake src into our. =. q.q.gam (~(del by q.q.gam) [%& src.hid man]) (~(put by q.q.gam) [%& our.hid man] -.u.ole %received) =+ old=(~(get by known) p.q.gam) ?~ old - (pa-append gam) - (pa-revise u.old gam) + (pa-append gam) ::x add + (pa-revise u.old gam) ::x modify :: ++ pa-append :: append new + ::x add gram to our story, and update our subscribers. + :: |= gam/telegram ^+ +> %+ %= pa-refresh @@ -1927,6 +2296,8 @@ gam :: ++ pa-revise :: revise existing + ::x modify a gram in our story, and update our subscribers. + :: |= {num/@ud gam/telegram} =+ way=(sub count num) ?: =(gam (snag (dec way) grams)) @@ -1937,30 +2308,50 @@ -- :: ++ sn :: station render core + ::x used in both station and ship rendering. + :: + ::x man: mailbox. + ::x one: the station. |_ {man/knot one/station} ++ sn-best :: best to show + ::x returns true if one is better to show, false otherwise. + ::x prioritizes: our > main > size. + :: |= two/station ^- ? + ::x the station that's ours is better. ?: =(our.hid p.one) ?: =(our.hid p.two) ?< =(q.one q.two) + ::x if both stations are ours, the main story is better. ?: =((main p.one) q.one) %& ?: =((main p.two) q.two) %| + ::x if neither are, pick the "larger" one. (lth q.one q.two) %& + ::x if one isn't ours but two is, two is better. ?: =(our.hid p.two) %| ?: =(p.one p.two) + ::x if they're from the same ship, pick the "larger" one. (lth q.one q.two) + ::x when in doubt, pick one if its ship is "smaller" than its channel. + ::x? i guess you want this to be consistent across (a b) and (b a), but + ::x this still seems pretty arbitrary. (lth p.one q.one) :: ++ sn-curt :: render name in 14 + ::x prints a ship name in 14 characters. left-pads with spaces. + ::x? mup is unused, what is it even for? ++ta-show still uses it. + :: |= mup/? ^- tape =+ raw=(cite p.one) (runt [(sub 14 (lent raw)) ' '] raw) :: ++ sn-nick + ::x get nick for ship, or shortname if no nick. left-pads with spaces. + :: |. ^- tape =+ nym=(~(get by folks) p.one) ?~ nym @@ -1972,6 +2363,10 @@ (weld (reap len ' ') raw) :: ++ sn-phat :: render accurately + ::x prints a station fully, but still taking "shortcuts" where possible: + ::x ":" for local mailbox, "~ship" for foreign mailbox, + ::x "%channel" for local station, "/channel" for parent station. + :: ^- tape ?: =(p.one our.hid) ?: =(q.one man) @@ -1986,8 +2381,16 @@ -- :: ++ ta :: partner core + ::x used primarily for printing partners. + :: + ::x man: mailbox. + ::x one: the partner. |_ {man/knot one/partner} ++ ta-beat :: more relevant + ::x returns true if one is better to show, false otherwise. + ::x prefers stations over passports. if both are stations, sn-best. if both + ::x are passports, pick the "larger" one, if they're equal, content hash. + :: |= two/partner ^- ? ?- -.one $& @@ -2004,14 +2407,19 @@ (lth -.p.two -.p.one) == == - ++ ta-best :: most relevant + ++ ta-best :: most relevant + ::x picks the most relevant partner. + :: |=(two/partner ?:((ta-beat two) two one)) :: ++ ta-full (ta-show ~) :: render full width ++ ta-show :: render partner + ::x renders a partner as text. + :: |= moy/(unit ?) ^- tape ?- -.one + ::x render station as glyph if we can. $& ?~ moy =+ cha=(~(get by nik) one ~ ~) @@ -2019,6 +2427,7 @@ ~(sn-phat sn man p.one) (~(sn-curt sn man p.one) u.moy) :: + ::x render passport. $| =+ ^= pre ^- tape ?- -.p.one @@ -2032,8 +2441,14 @@ -- :: ++ te :: audience renderer + ::x used for representing audiences (sets of partners) as tapes. + :: + :: man: mailbox. + :: lix: members of the audience. |_ {man/knot lix/(set partner)} ++ te-best ^- (unit partner) + ::x pick the most relevant partner. + :: ?~ lix ~ :- ~ |- ^- partner @@ -2044,13 +2459,19 @@ n.lix :: ++ te-deaf ^+ . :: except for self + ::x remove ourselves from the audience. + :: .(lix (~(del in lix) `partner`[%& our.hid man])) :: ++ te-maud ^- ? :: multiple audience + ::x checks if there's multiple partners in the audience via pattern match. + :: =. . te-deaf !?=($@($~ {* $~ $~}) lix) :: ++ te-prom ^- tape :: render targets + ::x render all partners, ordered by relevance. + :: =. . te-deaf =+ ^= all %+ sort `(list partner)`(~(tap in lix)) @@ -2066,9 +2487,13 @@ == :: ++ te-whom :: render sender + ::x render sender as the most relevant partner. + :: (~(ta-show ta man (need te-best)) ~ te-maud) :: ++ ta-dire :: direct message + ::x returns true if partner is a mailbox of ours. + :: |= pan/partner ^- ? ?& ?=($& -.pan) =(p.p.pan our.hid) @@ -2078,6 +2503,9 @@ == :: ++ te-pref :: audience glyph + ::x get the glyph that corresponds to the audience, with a space appended. + ::x if it's a dm to us, use :. if it's a dm by us, use ;. complex, use *. + :: ^- tape =+ cha=(~(get by nik) lix) ?^ cha ~[u.cha ' '] @@ -2089,7 +2517,22 @@ -- :: ++ tr :: telegram renderer - |_ $: man/knot + ::x responsible for converting telegrams and everything relating to them to + ::x text to be displayed in the cli. + :: + |_ $: ::x man: story. + ::x sef: settings flags. + ::x telegram: + ::x who: author. + ::x thought: + ::x sen: unique identifier. + ::x aud: audience. + ::x statement: + ::x wen: timestamp. + ::x bou: complete aroma. + ::x sep: message contents. + :: + man/knot sef/(set knot) who/ship sen/serial @@ -2099,9 +2542,14 @@ sep/speech == ++ tr-fact ^- sole-effect :: activate effect + ::x produce sole-effect for printing message details. + :: ~[%mor [%tan tr-meta] tr-body] :: ++ tr-line ^- tape :: one-line print + ::x crams a telegram into a single line by displaying a short ship name, + ::x a short representation of the gram, and an optional timestamp. + :: =+ txt=(tr-text =(who our.hid)) ?: =(~ txt) "" =+ ^= baw @@ -2122,6 +2570,9 @@ (weld baw txt) :: ++ tr-meta ^- tang + ::x build strings that display metadata, including message serial, + ::x timestamp, author and audience. + :: =. wen (sub wen (mod wen (div wen ~s0..0001))) :: round =+ hed=leaf+"{(scow %uv sen)} at {(scow %da wen)}" =+ =< paz=(turn (~(tap by aud)) .) @@ -2130,6 +2581,8 @@ [%rose [" " ~ ~] [hed >who< [%rose [", " "to " ~] paz] bok]]~ :: ++ tr-body + ::x long-form display of message contents, specific to each speech type. + :: |- ^- sole-effect ?+ -.sep tan+[>sep<]~ $exp tan+~[leaf+"# {(trip p.sep)}"] @@ -2151,6 +2604,8 @@ == :: ++ tr-rend-tors + ::x render an attachment. + :: |= a/torso ^- tang ?- -.a $name (welp $(a q.a) leaf+"={(trip p.a)}" ~) @@ -2159,11 +2614,16 @@ == :: ++ tr-pals + ::x strip delivery info from audience, producing a set of partners. + :: ^- (set partner) %- ~(gas in *(set partner)) (turn (~(tap by aud)) |=({a/partner *} a)) :: ++ tr-chow + ::x truncate the txt to be of max len characters. if it does truncate, + ::x indicates it did so by appending a character. + :: |= {len/@u txt/tape} ^- tape ?: (gth len (lent txt)) txt =. txt (scag len txt) @@ -2175,12 +2635,16 @@ [i.txt $(txt t.txt)] :: ++ tr-both + ::x try to fit two tapes into a single line. + :: |= {a/tape b/tape} ^- tape ?: (gth (lent a) 62) (tr-chow 64 a) %+ weld a (tr-chow (sub 64 (lent a)) " {b}") :: ++ tr-text + ::x gets a tape representation of a message that fits within a single line. + :: |= oug/? ^- tape ?+ -.sep ~&(tr-lost+sep "") @@ -2225,6 +2689,8 @@ -- :: ++ peer :: accept subscription + ::x incoming subscription on pax. + :: |= pax/path ^+ [*(list move) +>] ~? !=(src.hid our.hid) [%peer-talk-stranger src.hid] @@ -2237,6 +2703,8 @@ ra-abet:(ra-subscribe:ra src.hid pax) :: ++ poke-talk-command :: accept command + ::x incoming talk command. process it and update logs. + :: |= cod/command ^+ [*(list move) +>] :: ~& [%talk-poke-command src.hid cod] @@ -2246,10 +2714,14 @@ [(welp mos mow) +>.$] :: ++ poke-sole-action :: accept console + ::x incoming sole action. process it. + :: |= act/sole-action ra-abet:(ra-sole:ra act) :: ++ diff-talk-report :: + ::x incoming talk-report. process it and update logs. + :: |= {way/wire rad/report} ^- (quip move +>) =^ mos +>.$ @@ -2259,11 +2731,16 @@ [(welp mos mow) +>.$] :: ++ coup-repeat :: + ::x ack from ++ra-transmit. mark the message as received or rejected. + :: |= {way/wire saw/(unit tang)} %+ etch-repeat [%repeat way] |= {num/@ud src/@p man/knot} ra-abet:(ra-coup-repeat:ra [num src man] saw) :: ++ etch :: parse wire + ::x parse wire to obtain either %friend with story and station or %repeat + ::x with message number, source ship and story. + :: |= way/wire ^- weir ?+ -.way !! @@ -2277,16 +2754,22 @@ == :: ++ etch-friend :: + ::x parse a /friend wire, call gate with resulting data. + :: |= {way/wire fun/$-({man/knot cuz/station} {(list move) _.})} =+ wer=(etch way) ?>(?=($friend -.wer) (fun p.wer q.wer)) :: ++ etch-repeat :: + ::x parse a /repeat wire, call gate with resulting data. + :: |= {way/wire fun/$-({num/@ud src/@p man/knot} {(list move) _.})} =+ wer=(etch way) ?>(?=($repeat -.wer) (fun p.wer q.wer r.wer)) :: ++ reap-friend :: + ::x subscription n/ack. if it failed, remove their subscription from state. + :: |= {way/wire saw/(unit tang)} ^- (quip move +>) ?~ saw [~ +>] @@ -2296,11 +2779,15 @@ ra-abet:(ra-quit:ra man cuz) :: ++ quit-friend :: + ::x resubscribe. + :: |= way/wire %+ etch-friend [%friend way] |= {man/knot cuz/station} ra-abet:(ra-retry:ra man cuz) :: ++ pull :: + ::x unsubscribe. remove from story and shells. + :: |= pax/path ^+ [*(list move) +>] :: ~& [%talk-pull src.hid ost.hid pax] @@ -2308,6 +2795,9 @@ [moz +>.$(shells (~(del by shells) ost.hid))] :: ++ log-all-to-file + ::x for every story we're logging, (over)write all their grams to log files, + ::x if new ones have arrived. + :: ^- (quip move .) ?: & [~ .] :: XXX!!!! :_ %_ . @@ -2322,6 +2812,8 @@ `(log-to-file man) :: ++ log-to-file + ::x log all grams of story man to a file. + :: |= man/knot ^- move =+ ^- paf/path @@ -2332,14 +2824,20 @@ [ost.hid %info /jamfile our.hid (foal paf [%talk-telegrams !>(-)])] :: ++ poke-talk-comment + ::x send a comment. + :: |= {pax/path sup/spur txt/@t} ^- (quip move +>) ra-abet:(ra-comment:ra pax sup txt) :: ++ poke-talk-fora-post + ::x send a fora post. + :: |= {pax/path sup/spur hed/@t txt/@t} ^- (quip move +>) ra-abet:(ra-fora-post:ra pax sup hed txt) :: ++ poke-talk-save + ::x store the talk telegrams of story man in a log file. + :: |= man/knot ^- (quip move +>) =+ paf=/(scot %p our.hid)/home/(scot %da now.hid)/talk/[man]/talk-telegrams @@ -2347,6 +2845,8 @@ [[ost.hid %info /jamfile our.hid (foal paf [%talk-telegrams !>(-)])]~ +>.$] :: ++ poke-talk-load + ::x load/update the story man into our state, as saved in ++poke-talk-save. + :: |= man/knot =+ ^= grams .^ (list telegram) @@ -2357,6 +2857,8 @@ [~ +>.$(stories (~(put by stories) man toy(grams grams, count (lent grams))))] :: ++ poke-talk-log + ::x start logging story man. + :: |= man/knot ~& %poke-log ^- (quip move +>) @@ -2364,12 +2866,16 @@ +>.$(log (~(put by log) man count:(~(got by stories) man))) :: ++ poke-talk-unlog + ::x stop logging story man. + :: |= man/knot ^- (quip move +>) :- ~ +>.$(log (~(del by log) man)) :: ++ prep + ::x state adapter. + :: |= old/(unit house-any) ^- (quip move ..prep) ?~ old From b092ea2e71b6da05514aef6cdc2306951ddd9301 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 23 Mar 2017 01:34:56 +0100 Subject: [PATCH 002/303] Rough initial split. Nonfunctional. --- app/talk-agent.hoon | 1619 ++++++++++++++++++++++++++++++++++++++++ app/talk-guardian.hoon | 1259 +++++++++++++++++++++++++++++++ 2 files changed, 2878 insertions(+) create mode 100644 app/talk-agent.hoon create mode 100644 app/talk-guardian.hoon diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon new file mode 100644 index 0000000000..176f60137b --- /dev/null +++ b/app/talk-agent.hoon @@ -0,0 +1,1619 @@ +:: :: :: +:::: /hoon/talk-agent/app :: :: + :: :: :: +/? 310 :: hoon version +/- talk, sole :: structures +/+ talk, sole, time-to-id, twitter :: libraries +/= seed /~ !>(.) +:: +:::: + :: +=> |% :: data structures + ++ house :: full state + $: shells/(map bone shell) :: interaction state + folks/(map ship human) :: human identities + nik/(map (set partner) char) :: bound station glyphs + nak/(jug char (set partner)) :: station glyph lookup + == :: + ::TODO ++rental, state from the guardian we want to keep around + ++ shell :: console session + $: her/ship :: client identity + man/knot :: mailbox + count/@ud :: messages shown + say/sole-share :: console state + active/{$~ u/(set partner)} :: active targets + $passive-deprecated :: passive targets + owners/register :: presence mirror + harbor/(map knot (pair posture cord)) :: stations mirror + system/cabal :: config mirror + settings/(set knot) :: frontend settings + == :: + -- +|_ {hid/bowl house} +++ sh :: per console + ::x shell core, responsible for doing things with console sessions, + ::x like parsing input, acting based on input, showing output, keeping + ::x track of settings and other frontend state. + ::x important arms include ++sh-repo which is used to apply reports, and + ::x ++sh-sole which gets called upon cli prompt interaction. + ::x any talk commands the core's arms want to have executed get put into + ::x coz. the stored commands get applied upon calling ++sh-abet. + :: + |_ $: ::x coz: talk commands storage, applied by ++sh-abet. + ::x she: console session state used in this core. + :: + she/shell + coz/(list command) :: talk actions + == + ++ sh-scad :: command parser + ::x builds a core with parsers for talk-cli, and produces its work arm. + ::x ++work uses those parsers to parse the current talk-cli prompt input + ::x and produce a work item to be executed by ++sh-work. + :: + =< work + |% + ++ expr :: [cord twig] + |= tub/nail %. tub + %+ stag (crip q.tub) + wide:(vang & [&1:% &2:% (scot %da now.hid) |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) + :: + ++ pasp :: passport + ;~ pfix pat + ;~ pose + (stag %twitter ;~(pfix (jest 't') col urs:ab)) + == + == + :: + ++ stan :: station + ;~ pose + (cold [our.hid man.she] col) + ;~(pfix cen (stag our.hid sym)) + ;~(pfix fas (stag (sein our.hid) sym)) + :: + %+ cook + |= {a/@p b/(unit term)} + [a ?^(b u.b (main a))] + ;~ plug + ship + (punt ;~(pfix fas urs:ab)) + == + == + :: + ++ parn :: partner + ;~ pose + (stag %& stan) + (stag %| pasp) + == + ++ partners-flat :: collapse mixed list + |= a/(list (each partner (set partner))) + ^- (set partner) + ?~ a ~ + ?- -.i.a + $& (~(put in $(a t.a)) p.i.a) + $| (~(uni in $(a t.a)) p.i.a) + == + :: + ++ para :: partners alias + %+ cook partners-flat + %+ most ;~(plug com (star ace)) + (pick parn (sear sh-glyf glyph)) + :: + ++ parz :: non-empty partners + %+ cook ~(gas in *(set partner)) + (most ;~(plug com (star ace)) parn) + :: + ++ nump :: number reference + ;~ pose + ;~(pfix hep dem:ag) + ;~ plug + (cook lent (plus (just '0'))) + ;~(pose dem:ag (easy 0)) + == + (stag 0 dem:ag) + == + :: + ++ pore :: posture + ;~ pose + (cold %black (jest %channel)) + (cold %white (jest %village)) + (cold %green (jest %journal)) + (cold %brown (jest %mailbox)) + == + :: + ++ message + ;~ pose + ;~(plug (cold %eval hax) expr) + :: + %+ stag %say + %+ most (jest '•') + ;~ pose + (stag %url aurf:urlp) + :(stag %lin | ;~(pfix pat text)) + :(stag %lin & ;~(less sem hax text)) + == + == + :: + ++ nick (cook crip (stun [1 14] low)) :: nickname + ++ text (cook crip (plus (shim ' ' '~'))) :: bullets separating + ++ glyph (mask "/\\\{( ::x points to ++sh's |_ core's context. + =+ zoc=(flop coz) + |- ^+ +>+> ::x +> would point to |-'s context. +>+> goes to ++sh |_'s. + ::x produce context with this shell updated. + ?~ zoc +>+>.$(shells (~(put by shells) ost.hid she)) + ::x recurse, with context (of |-?) modified. + $(zoc t.zoc, +>.$ (sh-deal i.zoc)) + :: + ++ sh-deal :: apply from shell + ::x used by ++sh-abet, applies an individual talk command. + :: + |= cod/command + ^+ +> + ?- -.cod + ::x the $design command is used for modifying channel configs, + ::x which is done when joining, leaving or creating channels. + $design + ?~ q.cod + ::x updates context with new config state. + =. +>+>.$ (ra-config p.cod *config) + ::x produces context with story p.cod deleted. + +>.$(stories (~(del by stories) p.cod)) + ::x produces +> with its +> (so, +>+>) updated by ++ra-think. + +>(+> (ra-config p.cod u.q.cod)) + :: + ::x used for relaying messages (as a station host). + $review +>(+> (ra-think | her.she +.cod)) + ::x used for sending messages (as their author). + $publish +>(+> (ra-think & her.she +.cod)) + == + :: + ++ sh-fact :: send console effect + ::x adds a console effect to ++ra's moves. + :: + |= fec/sole-effect + ^+ +> + +>(moves :_(moves [ost.hid %diff %sole-effect fec])) + :: + ++ sh-peep :: peer to path + ::x? unused? + :: + |= pax/path + ^+ +> + +>(+> (ra-subscribe her.she pax)) + :: + ++ sh-peer :: subscribe shell + ::x create a shell, subscribe to default stories. + :: + =< sh-prod + %_ . + +> + =/ typ + =+ (ly ~[%a-group %f-grams %x-cabal]) + (rap 3 (turn - encode:peer-type)) + ::x subscriptions to the shell's ship's default channels. + (ra-subscribe:(ra-subscribe her.she ~) her.she [typ man.she ~]) + == + :: + ++ sh-prod :: show prompt + ::x make and store a move to modify the cli prompt, displaying audience. + :: + ^+ . + %+ sh-fact %pro + :+ & %talk-line + ^- tape + =/ rew/(pair (pair @t @t) (set partner)) + [['[' ']'] u.active.she] + =+ cha=(~(get by nik) q.rew) + ?^ cha ~[u.cha ' '] + :: ~& [rew nik nak] + =+ por=~(te-prom te man.she q.rew) + (weld `tape`[p.p.rew por] `tape`[q.p.rew ' ' ~]) + :: + ++ sh-pact :: update active aud + ::x change currently selected audience to lix, updating prompt. + :: + |= lix/(set partner) + ^+ +> + =+ act=(sh-pare lix) ::x ensure we can see what we send. + ?~ act ~|(%no-audience !!) ::x? this can't actually happen, right? + ?: =(active.she `act) +>.$ + sh-prod(active.she `act) + :: + ++ sh-pare :: adjust target list + ::x if the audience paz does not contain a partner we're subscribed to, + ::x add our mailbox to the audience (so that we can see our own message). + :: + |= paz/(set partner) + ?: (sh-pear paz) paz + (~(put in paz) [%& our.hid man.she]) + :: + ++ sh-pear :: hearback + ::x produces true if any partner is included in our subscriptions, + ::x aka, if we hear messages sent to paz. + :: + |= paz/(set partner) + ?~ paz | + ?| $(paz l.paz) + $(paz r.paz) + (~(has in sources.shape:(~(got by stories) man.she)) `partner`n.paz) + == + :: + ++ sh-pest :: report listen + ::x updates audience to be tay, only if tay is not a village/%white. + ::x? why exclude village (invite-only?) audiences from this? + :: + |= tay/partner + ^+ +> + ?. ?=($& -.tay) +> ::x if partner is a passport, do nothing. + =+ sib=(~(get by ham.system.she) `station`p.tay) ::x get config for tay + ?. |(?=($~ sib) !?=($white p.cordon.u.sib)) + +>.$ + (sh-pact [tay ~ ~]) + :: + ++ sh-rend :: print on one line + ::x renders a telegram as a single line, adds it as a console move, + ::x and updates the selected audience to match the telegram's. + :: + |= gam/telegram + =+ lin=~(tr-line tr man.she settings.she gam) + (sh-fact %txt lin) + :: + ++ sh-numb :: print msg number + ::x does as it says on the box. + :: + |= num/@ud + ^+ +> + =+ bun=(scow %ud num) + %+ sh-fact %txt + (runt [(sub 13 (lent bun)) '-'] "[{bun}]") + :: + ++ sh-glyf :: decode glyph + ::x gets the partner(s) that match a glyph. + ::x? why (set partner)? it seems like it only ever returns a single one. + ::TODO should produce a set when ambiguous. + :: + |= cha/char ^- (unit (set partner)) + =+ lax=(~(get ju nak) cha) + ?: =(~ lax) ~ ::x no partner. + ?: ?=({* $~ $~} lax) `n.lax ::x single partner. + ::x in case of multiple partners, pick the most recently active one. + =+ grams=grams:(~(got by stories) man.she) + |- ^- (unit (set partner)) + ?~ grams ~ + ::x get first partner from a telegram's audience. + =+ pan=(silt (turn (~(tap by q.q.i.grams)) head)) + ?: (~(has in lax) pan) `pan + $(grams t.grams) + :: + ::TODO we have a stdlib set diff now! + ++ sh-repo-house-diff + ::x calculates difference between two shelves (channel definitions). + :: + |= {one/shelf two/shelf} + =| $= ret + $: old/(list (pair knot (pair posture cord))) + new/(list (pair knot (pair posture cord))) + cha/(list (pair knot (pair posture cord))) + == + ^+ 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-repo-atlas-diff + ::x calculates the difference between two atlasses (presence lists). + :: + |= {one/atlas two/atlas} + =| $= 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 p.q.i.eno) ret + =+ unt=(~(get by two) p.i.eno) + ?~ unt + ret(old [i.eno old.ret]) + ?: =(%gone p.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 p.q.i.owt) ret + ?. (~(has by one) p.i.owt) + ret(new [i.owt new.ret]) + ?: =(%gone p:(~(got by one) p.i.owt)) + ret(new [i.owt new.ret]) + ret + ret + :: + ++ sh-repo-cabal-diff + ::x calculates the difference between two cabals (station configurations) + :: + |= {one/(map station config) two/(map station config)} + =| $= ret + $: old/(list (pair station config)) + new/(list (pair station config)) + cha/(list (pair station 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-repo-rogue-diff + ::x calculates the difference between two maps of stations and their + ::x presence lists. + :: + |= {one/(map partner atlas) two/(map partner atlas)} + =| $= ret + $: old/(list (pair partner atlas)) + new/(list (pair partner atlas)) + cha/(list (pair partner atlas)) + == + =. one ~(strip timed one) + =. two ~(strip timed two) + ^+ 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-repo-whom-diff + ::x calculates the difference between two partner sets. + :: + |= {one/(set partner) two/(set partner)} + =| $= ret + $: old/(list partner) + new/(list partner) + == + ^+ ret + =. ret + =+ eno=(~(tap by one)) + |- ^+ ret + ?~ eno ret + =. ret $(eno t.eno) + ?: (~(has in two) i.eno) + ret + ret(old [i.eno old.ret]) + =. ret + =+ owt=(~(tap by two)) + |- ^+ ret + ?~ owt ret + =. ret $(owt t.owt) + ?: (~(has in one) i.owt) + ret + ret(new [i.owt new.ret]) + ret + :: + ++ sh-repo-ship-diff + ::x calculates the difference between two ship sets. + :: + |= {one/(set ship) two/(set ship)} + =| $= ret + $: old/(list ship) + new/(list ship) + == + ^+ ret + =. ret + =+ eno=(~(tap by one)) + |- ^+ ret + ?~ eno ret + =. ret $(eno t.eno) + ?: (~(has in two) i.eno) + ret + ret(old [i.eno old.ret]) + =. ret + =+ owt=(~(tap by two)) + |- ^+ ret + ?~ owt ret + =. ret $(owt t.owt) + ?: (~(has in one) i.owt) + ret + ret(new [i.owt new.ret]) + ret + :: + ++ sh-puss + ::x posture as text. + :: + |= a/posture ^- tape + ?- a + $black "channel" + $brown "mailbox" + $white "village" + $green "journal" + == + :: + ++ sh-repo-config-exceptions + ::x used by ++sh-repo-config-show to aid in printing info to cli. + :: + |= {pre/tape por/posture old/(list ship) new/(list ship)} + =+ out=?:(?=(?($black $brown) por) "try " "cut ") + =+ inn=?:(?=(?($black $brown) por) "ban " "add ") + =. +>.$ + |- ^+ +>.^$ + ?~ old +>.^$ + =. +>.^$ $(old t.old) + (sh-note :(weld pre out " " (scow %p i.old))) + =. +>.$ + |- ^+ +>.^$ + ?~ new +>.^$ + =. +>.^$ $(new t.new) + (sh-note :(weld pre out " " (scow %p i.new))) + +>.$ + :: + ++ sh-repo-config-sources + ::x used by ++sh-repo-config-show to aid in printing info to cli, + ::x pertaining to the un/subscribing to partners. + :: + |= {pre/tape old/(list partner) new/(list partner)} + ^+ +> + =. +>.$ + |- ^+ +>.^$ + ?~ old +>.^$ + =. +>.^$ $(old t.old) + (sh-note (weld pre "off {~(ta-full ta man.she i.old)}")) + =. +>.$ + |- ^+ +>.^$ + ?~ new +>.^$ + =. +>.^$ $(new t.new) + (sh-note (weld pre "hey {~(ta-full ta man.she i.new)}")) + +>.$ + :: + ++ sh-repo-config-show + ::x prints config changes to the cli. + :: + |= {pre/tape laz/config loc/config} + ^+ +> + =. +>.$ + ?: =(caption.loc caption.laz) +>.$ + (sh-note :(weld pre "cap " (trip caption.loc))) + =. +>.$ + %+ sh-repo-config-sources + (weld (trip man.she) ": ") + (sh-repo-whom-diff sources.laz sources.loc) + ?: !=(p.cordon.loc p.cordon.laz) + =. +>.$ (sh-note :(weld pre "but " (sh-puss p.cordon.loc))) + %^ sh-repo-config-exceptions + (weld (trip man.she) ": ") + p.cordon.loc + [~ (~(tap in q.cordon.loc))] + %^ sh-repo-config-exceptions + (weld (trip man.she) ": ") + p.cordon.loc + (sh-repo-ship-diff q.cordon.laz q.cordon.loc) + :: + ++ sh-repo-cabal-changes + ::x used by ++sh-repo-cabal for printing cabal config changes to cli. + :: + |= $: laz/(map station config) + old/(list (pair station config)) + new/(list (pair station config)) + cha/(list (pair station config)) + == + =. +>.$ + |- ^+ +>.^$ + ?~ new +>.^$ + =. +>.^$ $(new t.new) + =. +>.^$ (sh-pest [%& p.i.new]) + %+ sh-repo-config-show + (weld ~(sn-phat sn man.she p.i.new) ": ") + [*config q.i.new] + =. +>.$ + |- ^+ +>.^$ + ?~ cha +>.^$ + =. +>.^$ $(cha t.cha) + %+ sh-repo-config-show + (weld ~(sn-phat sn man.she p.i.cha) ": ") + [(~(got by laz) `station`p.i.cha) q.i.cha] + +>.$ + :: + ++ sh-repo-cabal + ::x updates the current shell's cabal and prints changes to cli. + :: + |= bal/cabal + ^+ +> + =+ laz=system.she + =. system.she bal + =. +>.$ + %+ sh-repo-cabal-changes ham.laz + (sh-repo-cabal-diff ham.laz ham.bal) + (sh-repo-config-show "" loc.laz loc.bal) + :: + ++ sh-repo-house + ::x applies new shelf ("house"?) and prints changes to cli. + :: + |= awl/(map knot (pair posture cord)) + ^+ +> + =+ dif=(sh-repo-house-diff harbor.she awl) + =. harbor.she awl + =. +>.$ + |- ^+ +>.^$ + ?~ old.dif +>.^$ + =. +>.^$ $(old.dif t.old.dif) + (sh-note "cut {(sh-puss p.q.i.old.dif)} %{(trip p.i.old.dif)}") + =. +>.$ + |- ^+ +>.^$ + ?~ new.dif +>.^$ + =. +>.^$ $(new.dif t.new.dif) + =+ :* nam=(trip p.i.new.dif) + por=(sh-puss p.q.i.new.dif) + des=(trip q.q.i.new.dif) + == + (sh-note "new {por} %{nam}: {des}") + =. +>.$ + |- ^+ +>.^$ + ?~ cha.dif +>.^$ + =. +>.^$ $(cha.dif t.cha.dif) + =+ :* nam=(trip p.i.cha.dif) + por=(sh-puss p.q.i.cha.dif) + des=(trip q.q.i.cha.dif) + == + (sh-note "mod %{nam}: {por}, {des}") + +>.$ + :: + ++ sh-note :: shell message + ::x prints a txt to cli in talk's format. + :: + |= txt/tape + ^+ +> + (sh-fact %txt (runt [14 '-'] `tape`['|' ' ' (scag 64 txt)])) + :: + ++ sh-spaz :: print status + ::x gets the presence of a status. + :: + |= saz/status + ^- tape + ['%' (trip p.saz)] + :: + ++ sh-repo-group-diff-here :: print atlas diff + ::x prints presence notifications. + :: + |= $: pre/tape + $= cul + $: old/(list (pair ship status)) + new/(list (pair ship status)) + cha/(list (pair ship status)) + == + == + ?: (~(has in settings.she) %quiet) + +>.$ + =. +>.$ + |- ^+ +>.^$ + ?~ old.cul +>.^$ + =. +>.^$ $(old.cul t.old.cul) + (sh-note (weld pre "bye {(scow %p p.i.old.cul)}")) + =. +>.$ + |- ^+ +>.^$ + ?~ new.cul +>.^$ + =. +>.^$ $(new.cul t.new.cul) + %- sh-note + (weld pre "met {(scow %p p.i.new.cul)} {(sh-spaz q.i.new.cul)}") + =. +>.$ + |- ^+ +>.^$ + ?~ cha.cul +>.^$ + %- sh-note + (weld pre "set {(scow %p p.i.cha.cul)} {(sh-spaz q.i.cha.cul)}") + +>.$ + :: + ++ sh-repo-group-here :: update local + ::x updates local presence store and prints changes. + :: + |= loc/atlas + ^+ +> + =+ cul=(sh-repo-atlas-diff p.owners.she loc) + =. p.owners.she loc + (sh-repo-group-diff-here "" cul) + :: + ++ sh-repo-group-there :: update foreign + ::x updates remote presences(?) and prints changes. + :: + |= yid/(map partner atlas) + =+ day=(sh-repo-rogue-diff q.owners.she yid) + =+ dun=q.owners.she + =. q.owners.she yid + ?: (~(has in settings.she) %quiet) + +>.$ + =. +>.$ + |- ^+ +>.^$ + ?~ old.day +>.^$ + =. +>.^$ $(old.day t.old.day) + (sh-note (weld "not " (~(ta-show ta man.she p.i.old.day) ~))) + =. +>.$ + |- ^+ +>.^$ + ?~ new.day +>.^$ + =. +>.^$ $(new.day t.new.day) + =. +>.^$ + (sh-note (weld "new " (~(ta-show ta man.she p.i.new.day) ~))) + (sh-repo-group-diff-here "--" ~ (~(tap by q.i.new.day)) ~) + =. +>.$ + |- ^+ +>.^$ + ?~ cha.day +>.^$ + =. +>.^$ $(cha.day t.cha.day) + =. +>.^$ + (sh-note (weld "for " (~(ta-show ta man.she p.i.cha.day) ~))) + =+ yez=(~(got by dun) p.i.cha.day) + %+ sh-repo-group-diff-here "--" + (sh-repo-atlas-diff yez q.i.cha.day) + +>.$ + :: + ++ sh-repo-group + ::x update local and remote presences. + :: + |= ges/register + ^+ +> + =. +> (sh-repo-group-here p.ges) + =. +> (sh-repo-group-there q.ges) + +> + :: + ++ sh-repo-gram + ::x renders telegram: increase gram count and print the gram. + ::x every fifth gram, prints the number. + :: + |= {num/@ud gam/telegram} + ^+ +> + ?: =(num count.she) + =. +> ?:(=(0 (mod num 5)) (sh-numb num) +>) + (sh-rend(count.she +(num)) gam) + ?: (gth num count.she) + =. +> (sh-numb num) + (sh-rend(count.she +(num)) gam) + +> + :: + ++ sh-repo-grams :: apply telegrams + ::x renders telegrams. + :: + |= {num/@ud gaz/(list telegram)} + ^+ +> + ?~ gaz +> + $(gaz t.gaz, num +(num), +> (sh-repo-gram num i.gaz)) + :: + ++ sh-repo-glyph :: apply binding + ::x updates glyph bindings and lookup, and updates selected audience. + :: + |= nac/(jug char (set partner)) + ^+ +> + %_ sh-prod + nak nac + nik %- ~(gas by *(map (set partner) char)) + =- (zing `(list (list {(set partner) char}))`-) + %+ turn (~(tap by nac)) + |= {a/char b/(set (set partner))} + (turn (~(tap by b)) |=(c/(set partner) [c a])) + == + :: + ++ sh-repo :: apply report + ::x applies the different kinds of reports using their handler arms above + :: + |= rad/report + ^+ +> + :: ~& [%sh-repo rad] + ?- -.rad + $cabal (sh-repo-cabal +.rad) + $grams (sh-repo-grams +.rad) + $glyph (sh-repo-glyph +.rad) :: XX ever happens? + $group (sh-repo-group +.rad) + $house (sh-repo-house +.rad) + == + :: + ++ sh-sane-chat :: sanitize chatter + ::x (for chat messages) sanitizes the input buffer and splits it into + ::x multiple lines ('•'). + :: + |= buf/(list @c) + ^- (list sole-edit) + ?~ buf ~ + =+ isa==(i.buf (turf '@')) + =+ [[pre=*@c cur=i.buf buf=t.buf] inx=0 brk=0 len=0 new=|] + =* txt -< + |^ ^- (list sole-edit) + ?: =(cur (turf '•')) + ?: =(pre (turf '•')) + [[%del inx] ?~(buf ~ $(txt +.txt))] + ?: new + [(fix ' ') $(cur `@c`' ')] + newline + ?: =(cur `@`' ') + =. brk ?:(=(pre `@`' ') brk inx) + ?. =(64 len) advance + :- (fix(inx brk) (turf '•')) + ?: isa + [[%ins +(brk) (turf '@')] newline(new &)] + newline(new &) + ?: =(64 len) + =+ dif=(sub inx brk) + ?: (lth dif 64) + :- (fix(inx brk) (turf '•')) + ?: isa + [[%ins +(brk) (turf '@')] $(len dif, new &)] + $(len dif, new &) + [[%ins inx (turf '•')] $(len 0, inx +(inx), new &)] + ?: |((lth cur 32) (gth cur 126)) + [(fix '?') advance] + ?: &((gte cur 'A') (lte cur 'Z')) + [(fix (add 32 cur)) advance] + advance + :: + ++ advance ?~(buf ~ $(len +(len), inx +(inx), txt +.txt)) + ++ newline ?~(buf ~ $(len 0, inx +(inx), txt +.txt)) + ++ fix |=(cha/@ [%mor [%del inx] [%ins inx `@c`cha] ~]) + -- + :: + ++ sh-sane :: sanitize input + ::x parses cli prompt input using ++sh-scad and sanitizes when invalid. + :: + |= {inv/sole-edit buf/(list @c)} + ^- {lit/(list sole-edit) err/(unit @u)} + =+ res=(rose (tufa buf) sh-scad) + ?: ?=($| -.res) [[inv]~ `p.res] + :_ ~ + ?~ p.res ~ + =+ wok=u.p.res + |- ^- (list sole-edit) + ?+ -.wok ~ + $target ?~(q.wok ~ $(wok u.q.wok)) + $say |- :: XX per line + ?~ p.wok ~ + ?: ?=($lin -.i.p.wok) + (sh-sane-chat buf) + $(p.wok t.p.wok) + == + :: + ++ sh-slug :: edit to sanity + ::x corrects invalid prompt input. + :: + |= {lit/(list sole-edit) err/(unit @u)} + ^+ +> + ?~ lit +> + =^ lic say.she + (~(transmit sole say.she) `sole-edit`?~(t.lit i.lit [%mor lit])) + (sh-fact [%mor [%det lic] ?~(err ~ [%err u.err]~)]) + :: + ++ sh-stir :: apply edit + ::x called when typing into the talk prompt. applies the change and does + ::x sanitizing. + :: + |= cal/sole-change + ^+ +> + =^ inv say.she (~(transceive sole say.she) cal) + =+ fix=(sh-sane inv buf.say.she) + ?~ lit.fix + +>.$ + ?~ err.fix + (sh-slug fix) :: just capital correction + ?. &(?=($del -.inv) =(+(p.inv) (lent buf.say.she))) + +>.$ :: allow interior edits, deletes + (sh-slug fix) + :: + ++ sh-lame :: send error + ::x just puts some text into the cli. + :: + |= txt/tape + (sh-fact [%txt txt]) + :: + ++ sh-whom :: current audience + ::x produces the currently selected audience for this shell. + :: + ^- audience + %- ~(gas by *audience) + %+ turn (~(tap in u.active.she)) + |=(a/partner [a *envelope %pending]) + :: + ++ sh-tell :: add command + ::x adds talk command to core state. these get applied with ++sh-abet. + :: + |= cod/command + %_(+> coz [cod coz]) + :: + ++ sh-twig-head ^- vase :: eval data + ::x makes a vase of environment data to evaluate against (#-messages). + :: + !>(`{our/@p now/@da eny/@uvI}`[our.hid now.hid (shas %eny eny.hid)]) + :: + ++ sh-work :: do work + ::x implements worker arms for different talk commands. + ::x all worker arms must produce updated state/context. + :: + |= job/work + ^+ +> + =+ roy=(~(got by stories) man.she) + =< work + |% + ++ work + ?- -.job + $number (number +.job) + $leave (leave +.job) + $join (join +.job) + $eval (eval +.job) + $who (who +.job) + $what (what +.job) + $bind (bind +.job) + $invite (invite +.job) + $banish (banish +.job) + $author (author +.job) + $block (block +.job) + $create (create +.job) + $nick (nick +.job) + $set (wo-set +.job) + $unset (unset +.job) + $target (target +.job) + $probe (probe +.job) + $help help + $say (say +.job) + == + :: + ++ activate :: from %number + |= gam/telegram + ^+ ..sh-work + =+ tay=~(. tr man.she settings.she gam) + =. ..sh-work (sh-fact tr-fact:tay) + sh-prod(active.she `tr-pals:tay) + :: + ++ help + (sh-fact %txt "see http://urbit.org/docs/using/messaging/") + :: + ++ glyph + |= idx/@ + =< cha + %+ reel glyphs + |= {all/tape ole/{cha/char num/@}} + =+ new=(snag (mod idx (lent all)) all) + =+ num=~(wyt in (~(get ju nak) new)) + ?~ cha.ole [new num] + ?: (lth num.ole num) + ole + [new num] + :: + ++ set-glyph + |= {cha/char lix/(set partner)} + =: nik (~(put by nik) lix cha) + nak (~(put ju nak) cha lix) + == + %_ ..sh-work + ..pa + %- (ra-know man.she) + |=(_pa pa-abet:(pa-report glyphers %glyph nak)) + == + :: + ++ join :: %join + |= pan/(set partner) + ^+ ..sh-work + =. ..sh-work + =+ (~(get by nik) pan) + ?^ - (sh-note "has glyph {}") + =+ cha=(glyph (mug pan)) + (sh-note:(set-glyph cha pan) "new glyph {}") + =+ loc=loc.system.she + ::x change local mailbox config to include subscription to pan. + %^ sh-tell %design man.she + `loc(sources (~(uni in sources.loc) pan)) + :: + ++ leave :: %leave + |= pan/(set partner) + ^+ ..sh-work + =+ loc=loc.system.she + ::x change local mailbox config to exclude subscription to pan. + %^ sh-tell %design man.she + `loc(sources (~(dif in sources.loc) pan)) + :: + ++ what :: %what + |= qur/$@(char (set partner)) ^+ ..sh-work + ?^ qur + =+ cha=(~(get by nik) qur) + (sh-fact %txt ?~(cha "none" [u.cha]~)) + =+ pan=(~(tap in (~(get ju nak) qur))) + ?: =(~ pan) (sh-fact %txt "~") + =< (sh-fact %mor (turn pan .)) + |=(a/(set partner) [%txt ]) :: XX ~(te-whom te man.she a) + :: + ++ who :: %who + |= pan/(set partner) ^+ ..sh-work + =< (sh-fact %mor (murn (sort (~(tap by q.owners.she) ~) aor) .)) + |= {pon/partner alt/atlas} ^- (unit sole-effect) + ?. |(=(~ pan) (~(has in pan) pon)) ~ + =- `[%tan rose+[", " `~]^- leaf+~(ta-full ta man.she pon) ~] + =< (murn (sort (~(tap by alt)) aor) .) + |= {a/ship b/presence c/human} ^- (unit tank) :: XX names + ?- b + $gone ~ + $hear `>a< + $talk `>a< :: XX difference + == + :: + ++ bind :: %bind + |= {cha/char pan/(unit (set partner))} ^+ ..sh-work + ?~ pan $(pan [~ u.active.she]) + =+ ole=(~(get by nik) u.pan) + ?: =(ole [~ cha]) ..sh-work + (sh-note:(set-glyph cha u.pan) "bound {} {}") + :: + ++ invite :: %invite + |= {nom/knot tal/(list partner)} + ^+ ..sh-work + !! + :: + ++ block :: %block + |= {nom/knot tal/(list partner)} + ^+ ..sh-work + !! + :: + ++ author :: %author + |= {nom/knot tal/(list partner)} + ^+ ..sh-work + !! + :: + ++ banish :: %banish + |= {nom/knot tal/(list partner)} + ^+ ..sh-work + !! + :: + ++ create :: %create + |= {por/posture nom/knot txt/cord} + ^+ ..sh-work + ?: (~(has in stories) nom) + (sh-lame "{(trip nom)}: already exists") + =. ..sh-work + ::x create new config for channel. + %^ sh-tell %design nom + :- ~ + :+ *(set partner) + (end 3 64 txt) + [por ~] + (join [[%& our.hid nom] ~ ~]) + :: + ++ reverse-folks + |= nym/knot + ^- (list ship) + %+ murn (~(tap by folks)) + |= {p/ship q/human} + ?~ hand.q ~ + ?. =(u.hand.q nym) ~ + [~ u=p] + :: + ++ nick :: %nick + |= {her/(unit ship) nym/(unit cord)} + ^+ ..sh-work + ?: ?=({$~ $~} +<) + %+ sh-fact %mor + %+ turn (~(tap by folks)) + |= {p/ship q/human} + :- %txt + ?~ hand.q + "{

}:" + "{

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

}: {}"] + %= ..sh-work + folks ?~ u.nym + (~(del by folks) u.her) + (~(put by folks) u.her [true=~ hand=nym]) + == + :: + ++ wo-set :: %set + |= seg/knot + ^+ ..sh-work + ?~ seg + %+ sh-fact %mor + %+ turn (~(tap in settings.she)) + |= s/knot + [%txt (trip s)] + %= ..sh-work + settings.she (~(put in settings.she) seg) + == + :: + ++ unset :: %unset + |= neg/knot + ^+ ..sh-work + %= ..sh-work + settings.she (~(del in settings.she) neg) + == + :: + ++ target :: %target + |= {pan/(set partner) woe/(unit ^work)} + ^+ ..sh-work + =. ..sh-pact (sh-pact pan) + ?~(woe ..sh-work work(job u.woe)) + :: + ++ number :: %number + |= num/$@(@ud {p/@u q/@ud}) + ^+ ..sh-work + =+ roy=(~(got by stories) man.she) + |- + ?@ num + ?: (gte num count.roy) + (sh-lame "{(scow %s (new:si | +(num)))}: no such telegram") + =. ..sh-fact (sh-fact %txt "? {(scow %s (new:si | +(num)))}") + (activate (snag num grams.roy)) + ?. (gth q.num count.roy) + ?~ count.roy + (sh-lame "0: no messages") + =+ msg=(deli (dec count.roy) num) + =. ..sh-fact (sh-fact %txt "? {(scow %ud msg)}") + (activate (snag (sub count.roy +(msg)) grams.roy)) + (sh-lame "…{(reap p.num '0')}{(scow %ud q.num)}: no such telegram") + :: + ++ deli :: find number + |= {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))) + :: + ++ probe :: inquire + |= cuz/station + ^+ ..sh-work + ~& [%probe cuz] + ..sh-work + :: + ++ eval :: run + |= {txt/cord exe/twig} + => |.([(sell (slap (slop sh-twig-head seed) exe))]~) + =+ tan=p:(mule .) + (say [%fat tank+tan exp+txt] ~) + :: + ++ say :: publish + |= sep/(list speech) + ^+ ..sh-work + =- ..sh-work(coz ?~(tot coz :_(coz [%publish tot]))) + |- ^- tot/(list thought) + ?~ sep ~ + =^ sir ..sh-work sh-uniq + [[sir sh-whom [now.hid ~ i.sep]] $(sep t.sep)] + -- + :: + ++ sh-done :: apply result + ::x called upon hitting return in the prompt. if input is invalid, + ::x ++sh-slug is called. otherwise, the appropriate work is done + ::x 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-scad) + ?~ jub (sh-fact %bel ~) + %. u.jub + =< sh-work + =+ buf=buf.say.she + =^ cal say.she (~(transmit sole say.she) [%set ~]) + %- sh-fact + :* %mor + [%nex ~] + [%det cal] + ?. ?=({$';' *} buf) ~ + :_ ~ + [%txt (runt [14 '-'] `tape`['|' ' ' (tufa `(list @)`buf)])] + == + :: + ++ sh-sole :: apply edit + ::x applies sole action. + :: + |= act/sole-action + ^+ +> + ?- -.act + $det (sh-stir +.act) + $clr ..sh-sole :: (sh-pact ~) :: XX clear to PM-to-self? + $ret sh-done + == + :: + ++ sh-uniq + ::x generates a new serial. + :: + ^- {serial _.} + [(shaf %serial eny.hid) .(eny.hid (shax eny.hid))] + -- +:: +++ sn :: station render core + ::x used in both station and ship rendering. + :: + ::x man: mailbox. + ::x one: the station. + |_ {man/knot one/station} + ++ sn-best :: best to show + ::x returns true if one is better to show, false otherwise. + ::x prioritizes: our > main > size. + :: + |= two/station + ^- ? + ::x the station that's ours is better. + ?: =(our.hid p.one) + ?: =(our.hid p.two) + ?< =(q.one q.two) + ::x if both stations are ours, the main story is better. + ?: =((main p.one) q.one) %& + ?: =((main p.two) q.two) %| + ::x if neither are, pick the "larger" one. + (lth q.one q.two) + %& + ::x if one isn't ours but two is, two is better. + ?: =(our.hid p.two) + %| + ?: =(p.one p.two) + ::x if they're from the same ship, pick the "larger" one. + (lth q.one q.two) + ::x when in doubt, pick one if its ship is "smaller" than its channel. + ::x? i guess you want this to be consistent across (a b) and (b a), but + ::x this still seems pretty arbitrary. + (lth p.one q.one) + :: + ++ sn-curt :: render name in 14 + ::x prints a ship name in 14 characters. left-pads with spaces. + ::x? mup is unused, what is it even for? ++ta-show still uses it. + :: + |= mup/? + ^- tape + =+ raw=(cite p.one) + (runt [(sub 14 (lent raw)) ' '] raw) + :: + ++ sn-nick + ::x get nick for ship, or shortname if no nick. left-pads with spaces. + :: + |. ^- tape + =+ nym=(~(get by folks) p.one) + ?~ nym + (sn-curt |) + ?~ hand.u.nym + (sn-curt |) + =+ raw=(trip u.hand.u.nym) + =+ len=(sub 14 (lent raw)) + (weld (reap len ' ') raw) + :: + ++ sn-phat :: render accurately + ::x prints a station fully, but still taking "shortcuts" where possible: + ::x ":" for local mailbox, "~ship" for foreign mailbox, + ::x "%channel" for local station, "/channel" for parent station. + :: + ^- tape + ?: =(p.one our.hid) + ?: =(q.one man) + ":" + ['%' (trip q.one)] + ?: =(p.one (sein our.hid)) + ['/' (trip q.one)] + =+ wun=(scow %p p.one) + ?: =(q.one (main p.one)) + wun + :(welp wun "/" (trip q.one)) + -- +:: +++ ta :: partner core + ::x used primarily for printing partners. + :: + ::x man: mailbox. + ::x one: the partner. + |_ {man/knot one/partner} + ++ ta-beat :: more relevant + ::x returns true if one is better to show, false otherwise. + ::x prefers stations over passports. if both are stations, sn-best. if both + ::x are passports, pick the "larger" one, if they're equal, content hash. + :: + |= two/partner ^- ? + ?- -.one + $& + ?- -.two + $| %& + $& (~(sn-best sn man p.one) p.two) + == + :: + $| + ?- -.two + $& %| + $| ?: =(-.p.two -.p.one) + (lth (mug +.p.one) (mug +.p.two)) + (lth -.p.two -.p.one) + == + == + ++ ta-best :: most relevant + ::x picks the most relevant partner. + :: + |=(two/partner ?:((ta-beat two) two one)) + :: + ++ ta-full (ta-show ~) :: render full width + ++ ta-show :: render partner + ::x renders a partner as text. + :: + |= moy/(unit ?) + ^- tape + ?- -.one + ::x render station as glyph if we can. + $& + ?~ moy + =+ cha=(~(get by nik) one ~ ~) + =- ?~(cha - "'{u.cha ~}' {-}") + ~(sn-phat sn man p.one) + (~(sn-curt sn man p.one) u.moy) + :: + ::x render passport. + $| + =+ ^= pre ^- tape + ?- -.p.one + $twitter "@t:" + == + ?~ moy + (weld pre (trip p.p.one)) + =. pre ?.(=(& u.moy) pre ['*' pre]) + (sigh 14 pre p.p.one) + == + -- +:: +++ te :: audience renderer + ::x used for representing audiences (sets of partners) as tapes. + :: + :: man: mailbox. + :: lix: members of the audience. + |_ {man/knot lix/(set partner)} + ++ te-best ^- (unit partner) + ::x pick the most relevant partner. + :: + ?~ lix ~ + :- ~ + |- ^- partner + =+ lef=`(unit partner)`te-best(lix l.lix) + =+ rit=`(unit partner)`te-best(lix r.lix) + =. n.lix ?~(lef n.lix (~(ta-best ta man n.lix) u.lef)) + =. n.lix ?~(rit n.lix (~(ta-best ta man n.lix) u.rit)) + n.lix + :: + ++ te-deaf ^+ . :: except for self + ::x remove ourselves from the audience. + :: + .(lix (~(del in lix) `partner`[%& our.hid man])) + :: + ++ te-maud ^- ? :: multiple audience + ::x checks if there's multiple partners in the audience via pattern match. + :: + =. . te-deaf + !?=($@($~ {* $~ $~}) lix) + :: + ++ te-prom ^- tape :: render targets + ::x render all partners, ordered by relevance. + :: + =. . te-deaf + =+ ^= all + %+ sort `(list partner)`(~(tap in lix)) + |= {a/partner b/partner} + (~(ta-beat ta man a) b) + =+ fir=& + |- ^- tape + ?~ all ~ + ;: welp + ?:(fir "" " ") + (~(ta-show ta man i.all) ~) + $(all t.all, fir |) + == + :: + ++ te-whom :: render sender + ::x render sender as the most relevant partner. + :: + (~(ta-show ta man (need te-best)) ~ te-maud) + :: + ++ ta-dire :: direct message + ::x returns true if partner is a mailbox of ours. + :: + |= pan/partner ^- ? + ?& ?=($& -.pan) + =(p.p.pan our.hid) + :: + =+ sot=(~(get by stories) q.p.pan) + &(?=(^ sot) ?=($brown p.cordon.shape.u.sot)) + == + :: + ++ te-pref :: audience glyph + ::x get the glyph that corresponds to the audience, with a space appended. + ::x if it's a dm to us, use :. if it's a dm by us, use ;. complex, use *. + :: + ^- tape + =+ cha=(~(get by nik) lix) + ?^ cha ~[u.cha ' '] + ?. (lien (~(tap by lix)) ta-dire) + "* " + ?: ?=({{$& ^} $~ $~} lix) + ": " + "; " + -- +:: +++ tr :: telegram renderer + ::x responsible for converting telegrams and everything relating to them to + ::x text to be displayed in the cli. + :: + |_ $: ::x man: story. + ::x sef: settings flags. + ::x telegram: + ::x who: author. + ::x thought: + ::x sen: unique identifier. + ::x aud: audience. + ::x statement: + ::x wen: timestamp. + ::x bou: complete aroma. + ::x sep: message contents. + :: + man/knot + sef/(set knot) + who/ship + sen/serial + aud/audience + wen/@da + bou/bouquet + sep/speech + == + ++ tr-fact ^- sole-effect :: activate effect + ::x produce sole-effect for printing message details. + :: + ~[%mor [%tan tr-meta] tr-body] + :: + ++ tr-line ^- tape :: one-line print + ::x crams a telegram into a single line by displaying a short ship name, + ::x a short representation of the gram, and an optional timestamp. + :: + =+ txt=(tr-text =(who our.hid)) + ?: =(~ txt) "" + =+ ^= baw + :: ?: oug + :: ~(te-whom te man tr-pals) + ?. (~(has in sef) %noob) + (~(sn-curt sn man [who (main who)]) |) + (~(sn-nick sn man [who (main who)])) + ?: (~(has in sef) %showtime) + =+ dat=(yore now.hid) + =+ ^= t + |= a/@ ^- tape + %+ weld + ?: (lth a 10) "0" ~ + (scow %ud a) + =+ ^= time :(weld "~" (t h.t.dat) "." (t m.t.dat) "." (t s.t.dat)) + :(weld baw txt (reap (sub 67 (lent txt)) ' ') time) + (weld baw txt) + :: + ++ tr-meta ^- tang + ::x build strings that display metadata, including message serial, + ::x timestamp, author and audience. + :: + =. wen (sub wen (mod wen (div wen ~s0..0001))) :: round + =+ hed=leaf+"{(scow %uv sen)} at {(scow %da wen)}" + =+ =< paz=(turn (~(tap by aud)) .) + |=({a/partner *} leaf+~(ta-full ta man a)) + =+ bok=(turn (sort (~(tap in bou)) aor) smyt) + [%rose [" " ~ ~] [hed >who< [%rose [", " "to " ~] paz] bok]]~ + :: + ++ tr-body + ::x long-form display of message contents, specific to each speech type. + :: + |- ^- sole-effect + ?+ -.sep tan+[>sep<]~ + $exp tan+~[leaf+"# {(trip p.sep)}"] + $lin tan+~[leaf+"{?:(p.sep "" "@ ")}{(trip q.sep)}"] + $non tan+~ + $app tan+~[rose+[": " ~ ~]^~[leaf+"[{(trip p.sep)}]" leaf+(trip q.sep)]] + $url url+(crip (earf p.sep)) + $mor mor+(turn p.sep |=(speech ^$(sep +<))) + $fat [%mor $(sep q.sep) tan+(tr-rend-tors p.sep) ~] + $api + :- %tan + :_ ~ + :+ %rose + [": " ~ ~] + :~ leaf+"[{(trip id.sep)} on {(trip service.sep)}]" + leaf+(trip body.sep) + leaf+(earf url.sep) + == + == + :: + ++ tr-rend-tors + ::x render an attachment. + :: + |= a/torso ^- tang + ?- -.a + $name (welp $(a q.a) leaf+"={(trip p.a)}" ~) + $tank +.a + $text (turn (flop +.a) |=(b/cord leaf+(trip b))) + == + :: + ++ tr-pals + ::x strip delivery info from audience, producing a set of partners. + :: + ^- (set partner) + %- ~(gas in *(set partner)) + (turn (~(tap by aud)) |=({a/partner *} a)) + :: + ++ tr-chow + ::x truncate the txt to be of max len characters. if it does truncate, + ::x indicates it did so by appending a character. + :: + |= {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-both + ::x try to fit two tapes into a single line. + :: + |= {a/tape b/tape} ^- tape + ?: (gth (lent a) 62) (tr-chow 64 a) + %+ weld a + (tr-chow (sub 64 (lent a)) " {b}") + :: + ++ tr-text + ::x gets a tape representation of a message that fits within a single line. + :: + |= oug/? + ^- tape + ?+ -.sep ~&(tr-lost+sep "") + $mor + ?~ p.sep ~&(%tr-mor-empty "") + |- ^- tape + ?~ t.p.sep ^$(sep i.p.sep) + (tr-both ^$(sep i.p.sep) $(p.sep t.p.sep)) + :: + $fat + %+ tr-both $(sep q.sep) + ?+ -.p.sep "..." + $tank ~(ram re %rose [" " `~] +.p.sep) + == + :: + $exp (tr-chow 66 '#' ' ' (trip p.sep)) + $url =+ ful=(earf p.sep) + ?: (gth 64 (lent ful)) ['/' ' ' ful] + :+ '/' '_' + =+ hok=r.p.p.p.sep + ~! hok + =- (swag [a=(sub (max 64 (lent -)) 64) b=64] -) + ^- tape + =< ?:(?=($& -.hok) (reel p.hok .) +:(scow %if p.hok)) + |=({a/knot b/tape} ?~(b (trip a) (welp b '.' (trip a)))) + :: + $lin + =+ txt=(trip q.sep) + ?: p.sep + =+ pal=tr-pals + =. pal ?: =(who our.hid) pal + (~(del in pal) [%& who (main who)]) + (weld ~(te-pref te man pal) txt) + (weld " " txt) + :: + $app + (tr-chow 64 "[{(trip p.sep)}]: {(trip q.sep)}") + :: + $api + (tr-chow 64 "[{(trip id.sep)}@{(trip service.sep)}]: {(trip summary.sep)}") + == + -- +-- \ No newline at end of file diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon new file mode 100644 index 0000000000..41e984e294 --- /dev/null +++ b/app/talk-guardian.hoon @@ -0,0 +1,1259 @@ +:: :: :: +:::: /hoon/talk/app :: :: + :: :: :: +:: +::TODO master changes +::TODO =/ instead of =+ ^= where possible +::TODO avoid lark where possible +::TODO remove old/unused code +::TODO improve naming +::TODO tidiness +::TODO better presence notifications. typing, idle... +:: +/? 310 :: hoon version +/- talk, sole :: structures +/+ talk, sole, time-to-id, twitter :: libraries +/= seed /~ !>(.) +:: +:::: + :: +::x include talk and sole cores from the /+ include into our subject, +::x so we can do some-arm instead of some-arm:talk. +[. talk sole] +=> |% :: data structures + ++ house :: + $: stories/(map knot story) :: conversations + general/(set bone) :: meta-subscribe + outbox/(pair @ud (map @ud thought)) :: urbit outbox + log/(map knot @ud) :: logged to clay + == :: + ++ story :: wire content + $: count/@ud :: (lent grams) + grams/(list telegram) :: all history + locals/(map ship (pair @da status)) :: local presence + remotes/(map partner atlas) :: remote presence + mirrors/(map station config) :: remote config + sequence/(map partner @ud) :: partners heard + shape/config :: configuration + known/(map serial @ud) :: messages heard + gramsers/(map bone river) :: message followers + groupers/(set bone) :: presence followers + cabalers/(set bone) :: config followers + glyphers/(set bone) :: glyph followers + == :: + ++ river (pair point point) :: stream definition + ++ point :: stream endpoint + $% {$ud p/@ud} :: by number + {$da p/@da} :: by date + == :: + ++ move (pair bone card) :: all actions + ++ lime :: diff fruit + $% {$talk-report report} :: + {$sole-effect sole-effect} :: + == :: + ++ pear :: poke fruit + $% {$talk-command command} :: + {$write-comment spur ship cord} :: + {$write-fora-post spur ship cord cord} :: + == :: + ++ card :: general card + $% {$diff lime} :: + {$info wire @p @tas nori} :: + {$peer wire dock path} :: + {$poke wire dock pear} :: + {$pull wire dock $~} :: + {$quit $~} :: + == :: + ++ weir :: parsed wire + $% {$repeat p/@ud q/@p r/knot} :: + {$friend p/knot q/station} :: + == :: + ++ work :: interface action + $% {$number p/$@(@ud {@u @ud})} :: relative/absolute + {$help $~} :: print usage info + {$who p/where} :: presence + {$what p/$@(char (set partner))} :: show bound glyph + {$bind p/char q/(unit where)} :: + {$join p/where} :: + {$leave p/where} :: + {$say p/(list speech)} :: + {$eval p/cord q/twig} :: + {$invite p/knot q/(list partner)} :: whitelist add + {$banish p/knot q/(list partner)} :: blacklist add + {$block p/knot q/(list partner)} :: blacklist add + {$author p/knot q/(list partner)} :: whitelist add + {$nick p/(unit ship) q/(unit cord)} :: + {$set p/knot} :: + {$unset p/knot} :: + {$target p/where q/(unit work)} :: set active targets + :: {$destroy p/knot} :: + {$create p/posture q/knot r/cord} :: + {$probe p/station} :: + == :: + ++ where (set partner) :: non-empty audience + ++ sigh :: assemble label + ::x? why is this not in ++ta? + :: + |= {len/@ud pre/tape yiz/cord} + ^- tape + =+ nez=(trip yiz) + =+ lez=(lent nez) + ?> (gth len (lent pre)) + =. len (sub len (lent pre)) + ?. (gth lez len) + =. nez (welp pre nez) + ?. (lth lez len) nez + (runt [(sub len lez) '-'] nez) + :(welp pre (scag (dec len) nez) "+") + ++ glyphs `wall`~[">=+-" "}),." "\"'`^" "$%&@"] :: station char pool' + ++ peer-type :: stream requests + ::x helper functions for determining/specifying from/in a path, what kind + ::x of subscription our peer wants/what they're interested in. + :: + =< apex + |% + ++ apex ?($a-group $f-grams $v-glyph $x-cabal) :: options + ++ encode |=(a/apex ^-(char (end 3 1 a))) :: by first char + ++ decode :: discriminate + |= a/char ^- apex + ?+ a ~|(bad-subscription-designator+a !!) + $a %a-group + $f %f-grams + $v %v-glyph + $x %x-cabal + == + -- + -- +|% +:: old protocol workaround door +++ timed + ::x? seems hacky. if old, should be removed in "new talk", right? + ::x? seems like it's used for adding/dealing with "fake"/workaround ships + ::x? with datetimes in their status. but why? + ::x looking at ++pa-remind, this can safely be deleted when breaching state. + :: + ::x a: stations with ships and their status. + |_ a/(map partner atlas) :: XX (map partner (pair @da atlas)) + ++ strip + ::x removes workaround ships from all partner's status lists. + :: + (~(run by a) |=(b/atlas (~(del by b) `@p`%timed-sub))) + :: + ++ put :: XX put:by + ::x adds workaround ship to d with pretty-printed date c in its status, + ::x then adds it to a with key/partner b. + :: + |= {b/partner c/@da d/atlas} + =/ sta/status [%gone [~ (some (scot %da c))]] + (~(put by a) b (~(put by d) `@p`%timed-sub sta)) + :: + ++ decode-status + ::x attempts to retrieve datetime from status (as inserted by put:timed). + :: + |= a/status ^- (unit @da) + ?. ?=({$gone $~ $~ tym/@t} a) ~ + => .(a `{$gone $~ $~ tym/@t}`a) + (slaw %da tym.a) + :: + ++ uni + ::x union of two station-shipstatus maps. + :: + |= b/_a ^+ a + :: XX efficiency + %- ~(uni by a) + %- ~(urn by b) + |= nb/{p/partner q/atlas} + ?. (~(has by a) p.nb) q.nb + =/ qna (~(got by a) p.nb) + :: XX p.qna p.q.nb + =/ pqna (biff (~(get by qna) `@p`%timed-sub) decode-status) + ?~ pqna q.nb + =/ pqnb (biff (~(get by q.nb) `@p`%timed-sub) decode-status) + ?~ pqnb qna + ?: (gth u.pqna u.pqnb) qna + ?: (gth u.pqnb u.pqna) q.nb + :: unfortunately, multiple reports on the same channel can + :: be sent on the same event, necessitating last-wins + :: ~| uni-timed+[n.a n.b] + :: ?> =(n.a n.b) + q.nb + -- +-- +|_ {hid/bowl house} +++ ra :: per transaction + ::x gets called when talk gets poked or otherwise prompted/needs to perform + ::x an action. + ::x arms generally modify state, and store moves in ++ra's moves. these get + ::x produced when calling ++ra-abet. + ::x in applying commands and making reports, it uses ++pa for story work. + :: + ::x moves: moves storage, added to by ++ra-emit and -emil, produced by -abed. + |_ moves/(list move) + ++ ra-abed :: resolve core + ::x produces the moves stored in ++ra's moves. + ::x sole-effects get special treatment to become a single move. + :: + ^+ [*(list move) +>] + :_ +> + ::x seperate our sole-effects from other moves. + =+ ^= yop + |- ^- (pair (list move) (list sole-effect)) + ?~ moves [~ ~] + =+ mor=$(moves t.moves) + ?: ?& =(ost.hid p.i.moves) + ?=({$diff $sole-effect *} q.i.moves) + == + [p.mor [+>.q.i.moves q.mor]] + [[i.moves p.mor] q.mor] + ::x flop moves, flop and squash sole-effects into a %mor. + =+ :* moz=(flop p.yop) + ^= foc ^- (unit sole-effect) + ?~ q.yop ~ + ?~(t.q.yop `i.q.yop `[%mor (flop `(list sole-effect)`q.yop)]) + == + ::x produce moves or sole-effects and moves. + ?~(foc moz [[ost.hid %diff %sole-effect u.foc] moz]) + :: + ++ ra-abet :: complete core + ::x applies talk reports, then produces moves and updated state. + :: + ra-abed:ra-axel + :: + ++ ra-axel :: rebound reports + ::x extracts and applies the talk-reports in moves. + :: + ^+ . + ::x separate our talk-reports from other moves. + =+ ^= rey + |- ^- (pair (list move) (list (pair bone report))) + ?~ moves + [~ ~] + =+ mor=$(moves t.moves) + ?. ?& (~(has by shells) `bone`p.i.moves) + ?=({$diff $talk-report *} q.i.moves) + == + [[i.moves p.mor] q.mor] + [p.mor [[p.i.moves +>.q.i.moves] q.mor]] + ::x update moves to exclude talk-reports. + =. moves p.rey + =. q.rey (flop q.rey) + ?: =(q.rey ~) + + |- ^+ +> + ?~ q.rey ra-axel + ::x apply reports. + =+ bak=(ra-back(ost.hid p.i.q.rey) q.i.q.rey) + $(q.rey t.q.rey, +> bak(ost.hid ost.hid)) + :: + ++ ra-back + ::x applies report. + :: + |= rad/report + ^+ +> + sh-abet:(~(sh-repo sh ~ (~(got by shells) ost.hid)) rad) + :: + ++ ra-sole + ::x applies sole-action. + :: + |= act/sole-action + ^+ +> + =+ shu=(~(get by shells) ost.hid) + ?~ shu + ~| :+ %ra-console-broken ost.hid + ?:((~(has by sup.hid) ost.hid) %lost %unknown) + !! + sh-abet:(~(sh-sole sh ~ u.shu) act) + :: + ++ ra-emil :: ra-emit move list + ::x adds multiple moves to the core's list. flops to emulate ++ra-emit. + :: + |= mol/(list move) + %_(+> moves (welp (flop mol) moves)) + :: + ++ ra-emit :: emit a move + ::x adds a move to the core's list. + :: + |= mov/move + %_(+> moves [mov moves]) + :: + ++ ra-evil :: emit error + ::x stack trace and crash. + :: + |= msg/cord + ~| [%ra-evil msg] + !! + :: + ++ ra-house :: emit partners + ::x emits a talk-report move containing all our stories? + ::x? this is for showing people what they can subscribe to, right? + ::x? but this also shows invite-only stories, aren't they secret clubs? + :: + |= ost/bone + %+ ra-emit ost.hid + :+ %diff %talk-report + :- %house + %- ~(gas in *(map knot (pair posture cord))) + %+ turn (~(tap by stories)) + |=({a/knot b/story} [a p.cordon.shape.b caption.shape.b]) + :: + ++ ra-homes :: update partners + ::x send a list of our stories to all general subscribers. + :: + =+ gel=general + |- ^+ +> + ?~ gel +> + =. +> $(gel l.gel) + =. +> $(gel r.gel) + (ra-house n.gel) + :: + ++ ra-init :: initialize talk + ::x populate state on first boot. creates our main and public stories. + :: + %+ roll + ^- (list {posture knot cord}) + :~ [%brown (main our.hid) 'default home'] + [%green ~.public 'visible activity'] + == + |: [[typ=*posture man=*knot des=*cord] ..ra-init] ^+ ..ra-init + %+ ra-apply our.hid + :+ %design man + :- ~ :- ~ + [des [typ ~]] + :: + ++ ra-apply :: apply command + ::x applies the command sent by her. + :: + |= {her/ship cod/command} + ^+ +> + ?- -.cod + ::x the $design command is used for modifying channel configs, + ::x which is done when joining, leaving or creating channels. + ::x this may only be done by ourselves. + ::x? shouldn't this be team-only too? + $design + ?. =(her our.hid) + (ra-evil %talk-no-owner) + ?~ q.cod + ?. (~(has by stories) p.cod) + (ra-evil %talk-no-story) + ::x? why delete story if we got no config? can't we overwrite? + (ra-config(stories (~(del by stories) p.cod)) p.cod *config) + (ra-config p.cod u.q.cod) + :: + ::x used for relaying messages (as a station host). + $review (ra-think | her +.cod) + :: + ::x used for sending messages (as their author). + $publish + ?. (team our.hid her) +>.$ + (ra-think & her +.cod) + == + :: + ++ ra-config :: configure story + ::x (re)configures story man. if it's a new story, emit our stories. + :: + |= {man/knot con/config} + ^+ +> + =+ :- neu=(~(has by stories) man) + pur=(fall (~(get by stories) man) *story) + =. +>.$ pa-abet:(~(pa-reform pa man pur) con) + ?:(neu +>.$ ra-homes) + :: + ++ ra-base-hart + ::x produces our ship's host desk's web address as a hart. + :: + .^(hart %e /(scot %p our.hid)/host/(scot %da now.hid)) + :: + ++ ra-fora-post + ::x sends a fora post. if we don't have a channel for posts yet, create one + :: + |= {pax/path sup/spur hed/@t txt/@t} + ::x tell %hood to submit a fora post. + =. ..ra-emit + %+ ra-emit ost.hid + :* %poke + /fora-post + [our.hid %hood] + [%write-fora-post sup src.hid hed txt] + == + =+ man=%posts + ::x if we have a %posts story, go ahead and consume. + ?: (~(has by stories) man) + (ra-consume-fora-post man pax hed txt) + ::x if we have no %posts story, first create it, then consume. + =; new (ra-consume-fora-post:new man pax hed txt) + =. ..ra-apply + %+ ra-apply our.hid + :+ %design man + :- ~ :- ~ ::x sources + :- 'towards a community' ::x caption + [%brown ~] ::x cordon + ::x send informative message to our mailbox. + %^ ra-consume & our.hid + :^ (shaf %init eny.hid) ::x serial + (my [[%& our.hid (main our.hid)] *envelope %pending] ~) ::x audience + ::x statement + now.hid + [~ %app %tree 'receiving forum posts, ;join %posts for details'] + :: + ++ ra-consume-fora-post + ::x add a message for a fora post to the man story. + :: + |= {man/knot pax/path hed/@t txt/@t} ^+ +> + =. pax (welp pax /posts/(crip "{}~")) + %^ ra-consume | + src.hid + :* (shaf %comt eny.hid) + (my [[%& our.hid man] *envelope %pending] ~) + now.hid + (sy /fora-post eyre+pax ~) + :- %mor :~ + [%fat text+(lore txt) [%url [ra-base-hart `pax ~] ~]] + [%app %tree (crip "forum post: '{(trip hed)}'")] + == + == + :: + ++ ra-comment + ::x sends a comment. if we don't have a channel for them yet, creates one. + :: + |= {pax/path sup/spur txt/@t} + =. ..ra-emit + %+ ra-emit ost.hid + :* %poke + /comment + [our.hid %hood] + [%write-comment sup src.hid txt] + == + =+ man=%comments + ?: (~(has by stories) man) + (ra-consume-comment man pax sup txt) + =; new (ra-consume-comment:new man pax sup txt) + =. ..ra-apply + %+ ra-apply our.hid + :+ %design man + :- ~ :- ~ + :- 'letters to the editor' + [%brown ~] + %^ ra-consume & our.hid + :^ (shaf %init eny.hid) + (my [[%& our.hid (main our.hid)] *envelope %pending] ~) + now.hid + [~ %app %tree 'receiving comments, ;join %comments for details'] + :: + ++ ra-consume-comment + ::x adds a message for a comment to the man story. + :: + |= {man/knot pax/path sup/spur txt/@t} ^+ +> + =+ nam=?~(sup "" (trip i.sup)) :: file name + =+ fra=(crip (time-to-id now.hid)) :: url fragment + %^ ra-consume | + src.hid + :* (shaf %comt eny.hid) + (my [[%& our.hid man] *envelope %pending] ~) + now.hid + (sy /comment eyre+pax ~) + :- %mor :~ + [%fat text+(lore txt) [%url [ra-base-hart `pax ~] `fra]] + [%app %tree (crip "comment on /{nam}")] + == + == + :: + ++ ra-know :: story monad + ::x produces a wet core that takes a gate that takes a story core and + ::x produces updated state. + :: + |= man/knot + |* fun/$-(_pa _+>) + ^+ +>+> + =+ pur=(~(get by stories) man) + ?~ pur + ~& [%ra-know-not man] :: XX should crash + +>+>.$ + ::x call the sample gate with a ++pa core. + (fun ~(. pa man u.pur)) + :: + ++ ra-diff-talk-report :: subscription update + ::x process a talk report from cuz into story man. + :: + |= {man/knot cuz/station rad/report} + %- (ra-know man) |= par/_pa =< pa-abet + (pa-diff-talk-report:par cuz rad) + :: + ++ ra-quit :: subscription quit + ::x removes cuz from the subscribers of story man. + :: + |= {man/knot cuz/station} + %- (ra-know man) |= par/_pa =< pa-abet + (pa-quit:par %& cuz) + :: + ++ ra-retry :: subscription resend + ::x produce a %peer/subscribe move for cuz to story man. + :: + |= {man/knot cuz/station} + %- (ra-know man) |= par/_pa =< pa-abet + (pa-acquire:par [%& cuz]~) + :: + ++ ra-coup-repeat :: + ::x assemble partner and call ++ra-repeat. + :: + |= {{num/@ud her/@p man/knot} saw/(unit tang)} + (ra-repeat num [%& her man] saw) + :: + ++ ra-repeat :: remove from outbox + ::x take message out of outbox, mark it as received or rejected. + ::x crashes if pan is not in message's audience. + :: + |= {num/@ud pan/partner saw/(unit tang)} + =+ oot=(~(get by q.outbox) num) + ?~ oot ~|([%ra-repeat-none num] !!) + =. q.outbox (~(del by q.outbox) num) + =. q.u.oot + =+ olg=(~(got by q.u.oot) pan) + %+ ~(put by q.u.oot) pan + :- -.olg + ?~ saw %received + ~> %slog.[0 u.saw] + %rejected + (ra-think | our.hid u.oot ~) + :: + ++ ra-cancel :: drop a bone + ::x removes a bone from the story in pax. + :: + |= {src/ship pax/path} + ^+ +> + ?. ?=({@ @ *} pax) + ::x if story is not in path, just delete the bone from general. + +>(general (~(del in general) ost.hid)) + %- (ra-know i.t.pax) |= par/_pa =< pa-abet + ::x delete bone from all follower groups and set src's status to %gone. + (pa-notify:pa-cancel:par src %gone *human) + :: + ++ ra-human :: look up person + ::x get her identity. if she has none, make her one. + :: + |= her/ship + ^- {human _+>} + =^ who folks + =+ who=(~(get by folks) her) + ?^ who [u.who folks] + =+ who=`human`[~ `(scot %p her)] :: XX do right + [who (~(put by folks) her who)] + [who +>.$] + :: + ++ ra-console :: console subscribe + ::x make a shell for her, subscribe her to it. + :: + |= {her/ship pax/path} + ^+ +> + ::x get story from the path, default to standard mailbox. + =/ man/knot + ?+ pax !! + $~ (main her) + {@ta $~} i.pax + == + =/ she/shell + %*(. *shell her her, man man, active `(sy [%& our.hid man] ~)) + sh-abet:~(sh-peer sh ~ `shell`she) + :: + ++ ra-subscribe :: listen to + ::x subscribe her at pax. + :: + |= {her/ship pax/path} + ^+ +> + :: ~& [%ra-subscribe ost.hid her pax] + ::x empty path, meta-subscribe and send report with all our stories. + ?: ?=($~ pax) + (ra-house(general (~(put in general) ost.hid)) ost.hid) + ?. ?=({@ @ *} pax) + (ra-evil %talk-bad-path) + =+ vab=(~(gas in *(set peer-type)) (turn (rip 3 i.pax) decode:peer-type)) + =+ pur=(~(get by stories) i.t.pax) + ?~ pur + ~& [%bad-subscribe-story-c i.t.pax] + (ra-evil %talk-no-story) + =+ soy=~(. pa i.t.pax u.pur) + ::x check her read permissions. + ?. (pa-visible:soy her) + (ra-evil %talk-no-story) + =^ who +>.$ (ra-human her) + ::x for each stream type she is interested in, add her to the followers. + =. soy ?.((~(has in vab) %a-group) soy (pa-watch-group:soy her)) + =. soy ?.((~(has in vab) %v-glyph) soy (pa-watch-glyph:soy her)) + =. soy ?.((~(has in vab) %x-cabal) soy (pa-watch-cabal:soy her)) + =. soy ?.((~(has in vab) %f-grams) soy (pa-watch-grams:soy her t.t.pax)) + ::x add her status to presence map. + =. soy (pa-notify:soy her %hear who) + ::x apply changes to story. + pa-abet:soy + :: + ++ ra-think :: publish+review + ::x consumes each thought. + :: + |= {pub/? her/ship tiz/(list thought)} + ^+ +> + ?~ tiz +> + $(tiz t.tiz, +> (ra-consume pub her i.tiz)) + :: + ++ ra-normal :: normalize + ::x sanitize %lin speech, enforce lowercase and no special characters. + :: + |= tip/thought + ^- thought + ?. ?=({$lin *} r.r.tip) tip + %_ tip + q.r.r + %- crip + %+ scag 64 + %- tufa + %+ turn (tuba (trip q.r.r.tip)) + |= a/@c + ?: &((gte a 'A') (lte a 'Z')) + (add a 32) + ?: |((lth a 32) (gth a 126)) + `@`'?' + a + == + :: + ++ ra-consume :: consume thought + ::x if pub is true, sends the thought to each partner in the audience. + ::x if false, updates the thought in our store. + :: + |= {pub/? her/ship tip/thought} + =. tip (ra-normal tip) + =+ aud=(~(tap by q.tip) ~) ::x why ~ ? + |- ^+ +>.^$ + ?~ aud +>.^$ + $(aud t.aud, +>.^$ (ra-conduct pub her p.i.aud tip)) + :: + ++ ra-conduct :: thought to partner + ::x record a message or sends it. + :: + |= {pub/? her/ship tay/partner tip/thought} + ^+ +> + :: ~& [%ra-conduct pub her tay] + ?- -.tay + $& ?: pub + =. her our.hid :: XX security! + ?: =(her p.p.tay) + (ra-record q.p.tay p.p.tay tip) + (ra-transmit p.tay tip) + ?. =(our.hid p.p.tay) + +> + (ra-record q.p.tay her tip) + $| !! + == + :: + ++ ra-record :: add to story + ::x add or update a telegram in story man. + :: + |= {man/knot gam/telegram} + %- (ra-know man) |= par/_pa =< pa-abet + (pa-learn:par gam) + :: + ++ ra-transmit :: send to neighbor + ::x sends a thought to a station, adds it to the outbox. + :: + |= {cuz/station tip/thought} + ^+ +> + =. +> + %+ ra-emit ost.hid + :* %poke + /repeat/(scot %ud p.outbox)/(scot %p p.cuz)/[q.cuz] + [p.cuz %talk] + [%talk-command `command`[%review tip ~]] + == + +>(p.outbox +(p.outbox), q.outbox (~(put by q.outbox) p.outbox tip)) + :: + ++ pa :: story core + ::x story core, used for doing work on a story. + ::x as always, an -abet arms is used for applying changes to the state. + ::x ++pa-watch- arms get called by ++ra-subscribe to add a subscriber. + ::x bones are used to identify subscribers (source event identifiers) + :: + |_ ::x man: the knot identifying the story in stories. + ::x story doesn't get a face because ease of use + :: + $: man/knot + story + == + ++ pa-abet + ::x apply/fold changes back into the stories map. + :: + ^+ +> + +>(stories (~(put by stories) man `story`+<+)) + :: + ++ pa-admire :: accept from + ::x should be checking her write permissions, but defaults to allowed. + ::x commented code seems to use an older control structure. + ::x? this seems like an easy fix, why was this ever disabled? + :: + |= her/ship + ^- ? + ::?- -.cordon.shape + :: %& (~(has in p.cordon.shape) her) + :: %| !(~(has in p.cordon.shape) her) + ::== + & + :: + ++ pa-visible :: display to + ::x checks her read permissions. + :: + |= her/ship + ^- ? + ?- p.cordon.shape + $black & ::x channel, all + $green & ::x journal, all + $brown (team our.hid her) ::x mailbox, our + $white (~(has in q.cordon.shape) her) ::x village, invite + == + :: + ++ pa-report :: update + ::x sends report to all bones. + :: + |= {wac/(set bone) caw/report} + :: ~& [%pa-report man -.caw] + ^+ +> + ?~ wac +> + =. +> $(wac l.wac) + =. +> $(wac r.wac) + :: ~& [%pa-report-cabal man shape] + (pa-sauce n.wac [%diff %talk-report caw]~) + :: + ++ pa-watch-group :: subscribe presence + ::x if she may, add her bone to presence followers and send her a group + ::x (presence) report. + :: + |= her/ship + ?. (pa-admire her) + (pa-sauce ost.hid [%quit ~]~) + =. groupers (~(put in groupers) ost.hid) + (pa-report-group ost.hid ~ ~) + :: + ++ pa-watch-cabal :: subscribe config + ::x if she may, add her bone to config followers and send her an updated + ::x cabal (config) report. + :: + |= her/ship + ?. (pa-admire her) + ~& [%pa-admire-not her] + (pa-sauce ost.hid [%quit ~]~) + =. cabalers (~(put in cabalers) ost.hid) + :: ~& [%pa-watch-cabal her man shape] + (pa-sauce ost.hid [[%diff %talk-report %cabal shape mirrors] ~]) + :: + ++ pa-watch-glyph :: subscribe config + ::x if she may, add her bone to glyph followers and send an updated glyph + ::x report. + :: + |= her/ship + ?. (pa-admire her) + ~& [%pa-admire-not her] + (pa-sauce ost.hid [%quit ~]~) + =. glyphers (~(put in glyphers) ost.hid) + (pa-report [ost.hid ~ ~] %glyph nak) + :: + ++ pa-report-group :: update presence + ::x build a group report, containing our different presence maps, and + ::x send it to all bones. + ::x? why should we be responsible for sending remotes presences? + :: + |= vew/(set bone) + %^ pa-report vew %group + :- %- ~(run by locals) + |=({@ a/status} a) + %- ~(urn by remotes) :: XX preformance + |= {pan/partner atl/atlas} ^- atlas + ?. &(?=($& -.pan) =(our.hid p.p.pan)) atl + =+ (~(get by stories) q.p.pan) + ?~ - atl + %- ~(run by locals.u) + |=({@ a/status} a) + :: + ++ pa-report-cabal :: update config + ::x a cabal report, containing our and remote configs, to all config + ::x followers. + :: + (pa-report cabalers %cabal shape mirrors) + :: + ++ pa-cabal + ::x add station's config to our remote config map. + ::x? ham is unused, not even when calling this. + :: + |= {cuz/station con/config ham/(map station config)} + ^+ +> + =+ old=mirrors + =. mirrors (~(put by mirrors) cuz con) + ?: =(mirrors old) + +>.$ + pa-report-cabal + :: + ++ pa-diff-talk-report :: subscribed update + ::x process a talk report from cuz. + :: + |= {cuz/station rad/report} + ^+ +> + ::x verify we are supposed to receive reports from cuz. + ?. (~(has in sources.shape) [%& cuz]) + ~& [%pa-diff-unexpected cuz rad] + +> + ?+ -.rad ~|([%talk-odd-friend rad] !!) + $cabal (pa-cabal cuz +.rad) + $group (pa-remind [%& cuz] +.rad) + $grams (pa-lesson q.+.rad) + == + :: + ++ pa-quit :: stop subscription + ::x delete tay from our subscriptions, then send an updated capal report. + :: + |= tay/partner + pa-report-cabal(sources.shape (~(del in sources.shape) tay)) + :: + ++ pa-sauce :: send backward + ::x turns cards into moves, reverse order, prepend to existing moves. + :: + |= {ost/bone cub/(list card)} + %_ +>.$ + moves + (welp (flop (turn cub |=(a/card [ost a]))) moves) + == + :: + ++ pa-abjure :: unsubscribe move + ::x for each partner, produce a %pull/unsubscribe move. + :: + |= tal/(list partner) + %+ pa-sauce 0 ::x why bone 0? + %- zing + %+ turn tal + |= tay/partner + ^- (list card) + ?- -.tay + $| ~& tweet-abjure+p.p.tay + !! + :: + $& ~& [%pa-abjure [our.hid man] [p.p.tay q.p.tay]] + :_ ~ + :* %pull + /friend/show/[man]/(scot %p p.p.tay)/[q.p.tay] + [p.p.tay %talk] + ~ + == + == + :: + ++ pa-acquire :: subscribe to + ::x for each partner, produce a %peer/subscribe move. + :: + |= tal/(list partner) + %+ pa-sauce 0 + %- zing + %+ turn tal + |= tay/partner + ^- (list card) + =+ num=(~(get by sequence) tay) + =+ old=(sub now.hid ~d1) :: XX full backlog + ::x subscribe starting at the last message we read, + ::x or if we haven't read any yet, messages from up to a day ago. + =+ ini=?^(num (scot %ud u.num) (scot %da old)) + =/ typ + =+ (ly ~[%a-group %f-grams %x-cabal]) + (rap 3 (turn - encode:peer-type)) + ?- -.tay + $| !! + $& :: ~& [%pa-acquire [our.hid man] [p.p.tay q.p.tay]] + :_ ~ + :* %peer + /friend/show/[man]/(scot %p p.p.tay)/[q.p.tay] + [p.p.tay %talk] + /[typ]/[q.p.tay]/[ini] + == + == + :: + ++ pa-reform :: reconfigure, ugly + ::x change config of current story, subscribe/unsubscribe to/from the + ::x partners we gained/lost, and send out an updated cabal report. + :: + |= cof/config + =+ ^= dif ^- (pair (list partner) (list partner)) + =+ old=`(list partner)`(~(tap in sources.shape) ~) + =+ new=`(list partner)`(~(tap in sources.cof) ~) + :- (skip new |=(a/partner (~(has in sources.shape) a))) + (skip old |=(a/partner (~(has in sources.cof) a))) + =. +>.$ (pa-acquire p.dif) + =. +>.$ (pa-abjure q.dif) + =. shape cof + pa-report-cabal + :: + ++ pa-cancel :: unsubscribe from + ::x deletes the current ost.hid from all follower groups. + :: + :: ~& [%pa-cancel ost.hid] + %_ . + gramsers (~(del by gramsers) ost.hid) + groupers (~(del in groupers) ost.hid) + glyphers (~(del in glyphers) ost.hid) + cabalers (~(del in cabalers) ost.hid) + == + :: + ++ pa-notify :: local presence + ::x add her status to our presence map. if this changes it, send report. + :: + |= {her/ship saz/status} + ^+ +> + =/ nol (~(put by locals) her now.hid saz) + ?: =(nol locals) +>.$ + (pa-report-group(locals nol) groupers) + :: + ++ pa-remind :: remote presence + ::x adds tay's loc to our remote presence map, after merging with rem. + ::x if this changes anything, send update report. + :: + |= {tay/partner loc/atlas rem/(map partner atlas)} + ::x remove this story from the presence map, since it's in local already. + =. rem (~(del by rem) %& our.hid man) :: superceded by local data + =/ buk (~(uni timed remotes) rem) :: XX drop? + =. buk (~(put timed buk) tay now.hid loc) + ?: =(~(strip timed buk) ~(strip timed remotes)) +>.$ + (pa-report-group(remotes buk) groupers) + :: + ++ pa-start :: start stream + ::x grab all telegrams that fall within the river and send them in a + ::x grams report to ost.hid. + :: + |= riv/river + ^+ +> + =- :: ~& [%pa-start riv lab] + =. +>.$ + (pa-sauce ost.hid [[%diff %talk-report %grams q.lab r.lab] ~]) + ?: p.lab ::x? dun never gets changed, so always | ? + (pa-sauce ost.hid [[%quit ~] ~]) + +>.$(gramsers (~(put by gramsers) ost.hid riv)) + ^= lab + =+ [end=count gaz=grams dun=| zeg=*(list telegram)] + |- ^- (trel ? @ud (list telegram)) + ?~ gaz [dun end zeg] + ?: ?- -.q.riv :: after the end + $ud (lte p.q.riv end) + $da (lte p.q.riv p.r.q.i.gaz) + == + ::x if we're past the river, continue browsing back. + $(end (dec end), gaz t.gaz) + ?: ?- -.p.riv :: before the start + $ud (lth end p.p.riv) + $da (lth p.r.q.i.gaz p.p.riv) + == + ::x if we're before the river, we're done. + [dun end zeg] + ::x if we're in the river, add this gram and continue. + $(end (dec end), gaz t.gaz, zeg [i.gaz zeg]) + :: + ++ pa-watch-grams :: subscribe messages + ::x (called upon subscribe) send backlog of grams to her. + ::x deduces which messages to send from pax. + :: + |= {her/ship pax/path} + ^+ +> + ?. (pa-admire her) + ~& [%pa-watch-grams-admire ~] + (pa-sauce ost.hid [%quit ~]~) + ::x find the range of grams to send. + =+ ^= ruv ^- (unit river) + %+ biff ::x collapse unit list. + (zl:jo (turn pax ;~(biff slay |=(a/coin `(unit dime)`?~(-.a a ~))))) + |= paf/(list dime) + ?~ paf + $(paf [%ud (sub (max 64 count) 64)]~) + ?~ t.paf + $(t.paf [%da (dec (bex 128))]~) + ?. ?=({{?($ud $da) @} {?($ud $da) @} $~} paf) + ~ + ::x? the switches, they do nothing! + `[[?+(- . $ud .)]:i.paf [?+(- . $ud .)]:i.t.paf] :: XX types + :: ~& [%pa-watch-grams her pax ruv] + ?~ ruv + ~& [%pa-watch-grams-malformed pax] + (pa-sauce ost.hid [%quit ~]~) + (pa-start u.ruv) + :: + ++ pa-refresh :: update to listeners + ::x called when grams get added or changed. calculates the changes and + ::x sends them to all message followers. if we run into any followers + ::x that are no longer interested in this story, remove them. + :: + |= {num/@ud gam/telegram} + ^+ +> + =+ ^= moy + |- ^- (pair (list bone) (list move)) + ?~ gramsers [~ ~] + :: ~& [%pa-refresh num n.gramsers] + =+ lef=$(gramsers l.gramsers) + =+ rit=$(gramsers r.gramsers) + =+ old=[p=(welp p.lef p.rit) q=(welp q.lef q.rit)] + ?: ?- -.q.q.n.gramsers :: after the end + $ud (lte p.q.q.n.gramsers num) + $da (lte p.q.q.n.gramsers p.r.q.gam) + == + [[p.n.gramsers p.old] [[p.n.gramsers %quit ~] q.old]] + ?: ?- -.p.q.n.gramsers :: before the start + $ud (gth p.p.q.n.gramsers num) + $da (gth p.p.q.n.gramsers p.r.q.gam) + == + old + :- p.old + [[p.n.gramsers %diff %talk-report %grams num gam ~] q.old] + =. moves (welp q.moy moves) + |- ^+ +>.^$ + ?~ p.moy +>.^$ + $(p.moy t.p.moy, gramsers (~(del by gramsers) i.p.moy)) + :: + ++ pa-lesson :: learn multiple + ::x learn all telegrams in a list. + :: + |= gaz/(list telegram) + ^+ +> + ?~ gaz +> + $(gaz t.gaz, +> (pa-learn i.gaz)) + :: + ++ pa-learn :: learn message + ::x store an incoming telegram, modifying audience to say we received it. + ::x update existing telegram if it already exists. + :: + |= gam/telegram + ^+ +> + ::x if author isn't allowed to write here, reject. + ?. (pa-admire p.gam) + ~& %pa-admire-rejected + +>.$ + =. q.q.gam + ::x if we are in the audience, mark us as having received it. + =+ ole=(~(get by q.q.gam) [%& our.hid man]) + ?^ ole (~(put by q.q.gam) [%& our.hid man] -.u.ole %received) + :: for fedearted stations, pretend station src/foo is also our/foo + :: XX pass src through explicitly instead of relying on implicit + :: value in hid from the subscription to src/foo + =+ ole=(~(get by q.q.gam) [%& src.hid man]) + ?~ ole q.q.gam + ::x as described above, fake src into our. + =. q.q.gam (~(del by q.q.gam) [%& src.hid man]) + (~(put by q.q.gam) [%& our.hid man] -.u.ole %received) + =+ old=(~(get by known) p.q.gam) + ?~ old + (pa-append gam) ::x add + (pa-revise u.old gam) ::x modify + :: + ++ pa-append :: append new + ::x add gram to our story, and update our subscribers. + :: + |= gam/telegram + ^+ +> + %+ %= pa-refresh + grams [gam grams] + count +(count) + known (~(put by known) p.q.gam count) + == + count + gam + :: + ++ pa-revise :: revise existing + ::x modify a gram in our story, and update our subscribers. + :: + |= {num/@ud gam/telegram} + =+ way=(sub count num) + ?: =(gam (snag (dec way) grams)) + +>.$ :: no change + =. grams (welp (scag (dec way) grams) [gam (slag way grams)]) + (pa-refresh num gam) + -- + -- +:: +++ peer :: accept subscription + ::x incoming subscription on pax. + :: + |= pax/path + ^+ [*(list move) +>] + ~? !=(src.hid our.hid) [%peer-talk-stranger src.hid] + :: ~& [%talk-peer src.hid ost.hid pax] + ?: ?=({$sole *} pax) + ?> (team our.hid src.hid) + ~? (~(has by shells) ost.hid) [%talk-peer-replaced ost.hid pax] + ra-abet:(ra-console:ra src.hid t.pax) + :: ~& [%talk-peer-data ost.hid src.hid pax] + ra-abet:(ra-subscribe:ra src.hid pax) +:: +++ poke-talk-command :: accept command + ::x incoming talk command. process it and update logs. + :: + |= cod/command + ^+ [*(list move) +>] + :: ~& [%talk-poke-command src.hid cod] + =^ mos +>.$ + ra-abet:(ra-apply:ra src.hid cod) + =^ mow +>.$ log-all-to-file + [(welp mos mow) +>.$] +:: +++ poke-sole-action :: accept console + ::x incoming sole action. process it. + :: + |= act/sole-action + ra-abet:(ra-sole:ra act) +:: +++ diff-talk-report :: + ::x incoming talk-report. process it and update logs. + :: + |= {way/wire rad/report} + ^- (quip move +>) + =^ mos +>.$ + %+ etch-friend way |= {man/knot cuz/station} + ra-abet:(ra-diff-talk-report:ra man cuz rad) + =^ mow +>.$ log-all-to-file + [(welp mos mow) +>.$] +:: +++ coup-repeat :: + ::x ack from ++ra-transmit. mark the message as received or rejected. + :: + |= {way/wire saw/(unit tang)} + %+ etch-repeat [%repeat way] |= {num/@ud src/@p man/knot} + ra-abet:(ra-coup-repeat:ra [num src man] saw) +:: +++ etch :: parse wire + ::x parse wire to obtain either %friend with story and station or %repeat + ::x with message number, source ship and story. + :: + |= way/wire + ^- weir + ?+ -.way !! + $friend + ?> ?=({$show @ @ @ $~} t.way) + [%friend i.t.t.way (slav %p i.t.t.t.way) i.t.t.t.t.way] + :: + $repeat + ?> ?=({@ @ @ $~} t.way) + [%repeat (slav %ud i.t.way) (slav %p i.t.t.way) i.t.t.t.way] + == +:: +++ etch-friend :: + ::x parse a /friend wire, call gate with resulting data. + :: + |= {way/wire fun/$-({man/knot cuz/station} {(list move) _.})} + =+ wer=(etch way) + ?>(?=($friend -.wer) (fun p.wer q.wer)) +:: +++ etch-repeat :: + ::x parse a /repeat wire, call gate with resulting data. + :: + |= {way/wire fun/$-({num/@ud src/@p man/knot} {(list move) _.})} + =+ wer=(etch way) + ?>(?=($repeat -.wer) (fun p.wer q.wer r.wer)) +:: +++ reap-friend :: + ::x subscription n/ack. if it failed, remove their subscription from state. + :: + |= {way/wire saw/(unit tang)} + ^- (quip move +>) + ?~ saw [~ +>] + %+ etch-friend [%friend way] |= {man/knot cuz/station} + =. u.saw [>%reap-friend-fail man cuz< u.saw] + %- (slog (flop u.saw)) + ra-abet:(ra-quit:ra man cuz) +:: +++ quit-friend :: + ::x resubscribe. + :: + |= way/wire + %+ etch-friend [%friend way] |= {man/knot cuz/station} + ra-abet:(ra-retry:ra man cuz) +:: +++ pull :: + ::x unsubscribe. remove from story and shells. + :: + |= pax/path + ^+ [*(list move) +>] + :: ~& [%talk-pull src.hid ost.hid pax] + =^ moz +>.$ ra-abet:(ra-cancel:ra src.hid pax) + [moz +>.$(shells (~(del by shells) ost.hid))] +:: +++ log-all-to-file + ::x for every story we're logging, (over)write all their grams to log files, + ::x if new ones have arrived. + :: + ^- (quip move .) + ?: & [~ .] :: XXX!!!! + :_ %_ . + log %- ~(urn by log) + |=({man/knot len/@ud} count:(~(got by stories) man)) + == + %+ murn (~(tap by log)) + |= {man/knot len/@ud} + ^- (unit move) + ?: (gte len count:(~(got by stories) man)) + ~ + `(log-to-file man) +:: +++ log-to-file + ::x log all grams of story man to a file. + :: + |= man/knot + ^- move + =+ ^- paf/path + =+ day=(year %*(. (yore now.hid) +.t +:*tarp)) + %+ tope [our.hid %home da+now.hid] + /talk-telegrams/(scot %da day)/[man]/talk + =+ grams:(~(got by stories) man) + [ost.hid %info /jamfile our.hid (foal paf [%talk-telegrams !>(-)])] +:: +++ poke-talk-comment + ::x send a comment. + :: + |= {pax/path sup/spur txt/@t} ^- (quip move +>) + ra-abet:(ra-comment:ra pax sup txt) +:: +++ poke-talk-fora-post + ::x send a fora post. + :: + |= {pax/path sup/spur hed/@t txt/@t} ^- (quip move +>) + ra-abet:(ra-fora-post:ra pax sup hed txt) +:: +++ poke-talk-save + ::x store the talk telegrams of story man in a log file. + :: + |= man/knot + ^- (quip move +>) + =+ paf=/(scot %p our.hid)/home/(scot %da now.hid)/talk/[man]/talk-telegrams + =+ grams:(~(got by stories) man) + [[ost.hid %info /jamfile our.hid (foal paf [%talk-telegrams !>(-)])]~ +>.$] +:: +++ poke-talk-load + ::x load/update the story man into our state, as saved in ++poke-talk-save. + :: + |= man/knot + =+ ^= grams + .^ (list telegram) + %cx + /(scot %p our.hid)/home/(scot %da now.hid)/talk/[man]/talk-telegrams + == + =+ toy=(~(got by stories) man) + [~ +>.$(stories (~(put by stories) man toy(grams grams, count (lent grams))))] +:: +++ poke-talk-log + ::x start logging story man. + :: + |= man/knot + ~& %poke-log + ^- (quip move +>) + :- [(log-to-file man) ~] + +>.$(log (~(put by log) man count:(~(got by stories) man))) +:: +++ poke-talk-unlog + ::x stop logging story man. + :: + |= man/knot + ^- (quip move +>) + :- ~ + +>.$(log (~(del by log) man)) +:: +++ prep + ::x state adapter. + :: + |= old/(unit house) + ^- (quip move ..prep) + ?~ old + ra-abet:ra-init:ra + [~ ..prep(+<+ u.old)] +-- From 8c2d8327b8343637c834c686040ebc377f177fb9 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 23 Mar 2017 23:07:35 +0100 Subject: [PATCH 003/303] Updated comments and new TODO's. --- app/talk-agent.hoon | 9 ++++++--- app/talk-guardian.hoon | 33 ++++++++++++++++++--------------- sur/talk.hoon | 2 +- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 176f60137b..11ed04784f 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -243,7 +243,7 @@ +>(moves :_(moves [ost.hid %diff %sole-effect fec])) :: ++ sh-peep :: peer to path - ::x? unused? + ::TODO remove. :: |= pax/path ^+ +> @@ -283,7 +283,7 @@ |= lix/(set partner) ^+ +> =+ act=(sh-pare lix) ::x ensure we can see what we send. - ?~ act ~|(%no-audience !!) ::x? this can't actually happen, right? + ?~ act ~|(%no-audience !!) ::TODO can't happen, remove. ?: =(active.she `act) +>.$ sh-prod(active.she `act) :: @@ -1245,6 +1245,7 @@ ++ sn-best :: best to show ::x returns true if one is better to show, false otherwise. ::x prioritizes: our > main > size. + ::TODO maybe simplify. (lth (xeb (xeb p.one)) (xeb (xeb p.two))) :: |= two/station ^- ? @@ -1271,7 +1272,7 @@ :: ++ sn-curt :: render name in 14 ::x prints a ship name in 14 characters. left-pads with spaces. - ::x? mup is unused, what is it even for? ++ta-show still uses it. + ::x mup signifies "are there other targets besides this one" :: |= mup/? ^- tape @@ -1616,4 +1617,6 @@ (tr-chow 64 "[{(trip id.sep)}@{(trip service.sep)}]: {(trip summary.sep)}") == -- +::TODO ++ poke-sole-action +::TODO ++ diff-talk-report -- \ No newline at end of file diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 41e984e294..72b7997bc1 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -92,7 +92,7 @@ == :: ++ where (set partner) :: non-empty audience ++ sigh :: assemble label - ::x? why is this not in ++ta? + ::TODO move to ++ta. :: |= {len/@ud pre/tape yiz/cord} ^- tape @@ -223,24 +223,26 @@ ::x extracts and applies the talk-reports in moves. :: ^+ . - ::x separate our talk-reports from other moves. + ::x separate talk-reports meant for our shells from other moves. =+ ^= rey |- ^- (pair (list move) (list (pair bone report))) ?~ moves [~ ~] =+ mor=$(moves t.moves) + ::x if we know the target shell is ours, and it's a talk report, + ::x add it to the list of reports to be locally applied. ?. ?& (~(has by shells) `bone`p.i.moves) ?=({$diff $talk-report *} q.i.moves) == [[i.moves p.mor] q.mor] [p.mor [[p.i.moves +>.q.i.moves] q.mor]] - ::x update moves to exclude talk-reports. + ::x update moves to exclude our talk-reports. =. moves p.rey =. q.rey (flop q.rey) ?: =(q.rey ~) + |- ^+ +> ?~ q.rey ra-axel - ::x apply reports. + ::x apply reports to our shells. =+ bak=(ra-back(ost.hid p.i.q.rey) q.i.q.rey) $(q.rey t.q.rey, +> bak(ost.hid ost.hid)) :: @@ -283,9 +285,8 @@ !! :: ++ ra-house :: emit partners - ::x emits a talk-report move containing all our stories? - ::x? this is for showing people what they can subscribe to, right? - ::x? but this also shows invite-only stories, aren't they secret clubs? + ::x emits a talk-report move containing all our stories. + ::TODO if we don't check for team on subscription, check here. :: |= ost/bone %+ ra-emit ost.hid @@ -328,14 +329,16 @@ ::x the $design command is used for modifying channel configs, ::x which is done when joining, leaving or creating channels. ::x this may only be done by ourselves. - ::x? shouldn't this be team-only too? + ::TODO use team instead of our. $design ?. =(her our.hid) (ra-evil %talk-no-owner) ?~ q.cod ?. (~(has by stories) p.cod) (ra-evil %talk-no-story) - ::x? why delete story if we got no config? can't we overwrite? + ::x $design with ~ for config signals delete + ::TODO untangle into ++ra-unconfig, ++pa-reform-gone instead of using + :: bunts or empty keys. (ra-config(stories (~(del by stories) p.cod)) p.cod *config) (ra-config p.cod u.q.cod) :: @@ -754,7 +757,7 @@ ++ pa-report-group :: update presence ::x build a group report, containing our different presence maps, and ::x send it to all bones. - ::x? why should we be responsible for sending remotes presences? + ::x we send remote presences to facilitate federation. aka "relay" :: |= vew/(set bone) %^ pa-report vew %group @@ -776,7 +779,7 @@ :: ++ pa-cabal ::x add station's config to our remote config map. - ::x? ham is unused, not even when calling this. + ::TODO if web frontend doesn't use ham, remove it (also from sur/talk) :: |= {cuz/station con/config ham/(map station config)} ^+ +> @@ -820,7 +823,7 @@ ::x for each partner, produce a %pull/unsubscribe move. :: |= tal/(list partner) - %+ pa-sauce 0 ::x why bone 0? + %+ pa-sauce 0 ::x subscription is caused by this app %- zing %+ turn tal |= tay/partner @@ -919,6 +922,7 @@ :: |= riv/river ^+ +> + ::TODO use =; lab/{dun/? end/@u zeg/(list telegram)} =- :: ~& [%pa-start riv lab] =. +>.$ (pa-sauce ost.hid [[%diff %talk-report %grams q.lab r.lab] ~]) @@ -934,7 +938,7 @@ $da (lte p.q.riv p.r.q.i.gaz) == ::x if we're past the river, continue browsing back. - $(end (dec end), gaz t.gaz) + $(end (dec end), gaz t.gaz) ::TODO dun & ?: ?- -.p.riv :: before the start $ud (lth end p.p.riv) $da (lth p.r.q.i.gaz p.p.riv) @@ -964,8 +968,7 @@ $(t.paf [%da (dec (bex 128))]~) ?. ?=({{?($ud $da) @} {?($ud $da) @} $~} paf) ~ - ::x? the switches, they do nothing! - `[[?+(- . $ud .)]:i.paf [?+(- . $ud .)]:i.t.paf] :: XX types + `[[?+(- . $ud .)]:i.paf [?+(- . $ud .)]:i.t.paf] ::XX arvo issue #366 :: ~& [%pa-watch-grams her pax ruv] ?~ ruv ~& [%pa-watch-grams-malformed pax] diff --git a/sur/talk.hoon b/sur/talk.hoon index 61285dc135..5e87529976 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -38,7 +38,7 @@ == :: ++ posture :: security posture $? $black :: channel - $white :: chamber + $white :: village $green :: journal $brown :: mailbox == :: From 8602a6c5ff34319c1758f3bb33c88bbbc4df8f09 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 23 Mar 2017 23:10:28 +0100 Subject: [PATCH 004/303] Better split state. --- app/talk-agent.hoon | 17 +++++++++++------ app/talk-guardian.hoon | 6 +++++- sur/talk.hoon | 7 +++++++ 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 11ed04784f..a640e0fb00 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -9,27 +9,32 @@ :::: :: => |% :: data structures - ++ house :: full state - $: shells/(map bone shell) :: interaction state + ++ chattel :: full state + $: tales/(map knot tale) :: conversations folks/(map ship human) :: human identities nik/(map (set partner) char) :: bound station glyphs nak/(jug char (set partner)) :: station glyph lookup + shells/(map bone shell) :: interaction state + == :: + ++ tale :: user-facing story + $: count/@ud :: (lent grams) + grams/(list telegram) :: all history + locals/atlas :: local presence + shape/config :: configuration == :: - ::TODO ++rental, state from the guardian we want to keep around ++ shell :: console session $: her/ship :: client identity man/knot :: mailbox count/@ud :: messages shown say/sole-share :: console state - active/{$~ u/(set partner)} :: active targets - $passive-deprecated :: passive targets + active/(unit (set partner)) :: active targets owners/register :: presence mirror harbor/(map knot (pair posture cord)) :: stations mirror system/cabal :: config mirror settings/(set knot) :: frontend settings == :: -- -|_ {hid/bowl house} +|_ {hid/bowl chattel} ++ sh :: per console ::x shell core, responsible for doing things with console sessions, ::x like parsing input, acting based on input, showing output, keeping diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 72b7997bc1..42b3280e0a 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -23,14 +23,18 @@ => |% :: data structures ++ house :: $: stories/(map knot story) :: conversations + ::TODO rename to readers? general/(set bone) :: meta-subscribe outbox/(pair @ud (map @ud thought)) :: urbit outbox log/(map knot @ud) :: logged to clay + folks/(map ship human) :: human identities + nik/(map (set partner) char) :: bound station glyphs + nak/(jug char (set partner)) :: station glyph lookup == :: ++ story :: wire content $: count/@ud :: (lent grams) grams/(list telegram) :: all history - locals/(map ship (pair @da status)) :: local presence + locals/atlas :: local presence remotes/(map partner atlas) :: remote presence mirrors/(map station config) :: remote config sequence/(map partner @ud) :: partners heard diff --git a/sur/talk.hoon b/sur/talk.hoon index 5e87529976..83e4b63d3b 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -9,6 +9,12 @@ $% {$design (pair knot (unit config))} :: configure+destroy {$publish (list thought)} :: originate {$review (list thought)} :: deliver + {$update update} :: change shared state + == :: +++ update ::x these may need work + $% {$status (pair (set knot) status) :: our status update + {$human (map ship human)} :: new identity + {$bind (pair char (set partner))} :: bind a glyph == :: ++ cabal :: metaconfiguration $: loc/config :: local config @@ -52,6 +58,7 @@ {$group register} :: presence {$house shelf} :: station set {$glyph (jug char (set partner))} :: relevant binding + {$names (map ship human)} :: new identities == :: ++ speech :: narrative action $% {$lan p/knot q/@t} :: local announce From 803e521e38e2663af1dc047048bdc774bfa08ab9 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 24 Mar 2017 21:10:27 +0100 Subject: [PATCH 005/303] Set up protocol for updating/sharing generic UI state. Moved/copied parts of ++ra and ++pa into the agent. --- app/talk-agent.hoon | 2617 ++++++++++++++++++++++------------------ app/talk-guardian.hoon | 90 +- sur/talk.hoon | 9 +- 3 files changed, 1517 insertions(+), 1199 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index a640e0fb00..e6bd7e01a1 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -21,6 +21,7 @@ grams/(list telegram) :: all history locals/atlas :: local presence shape/config :: configuration + known/(map serial @ud) :: messages heard == :: ++ shell :: console session $: her/ship :: client identity @@ -33,1212 +34,1455 @@ system/cabal :: config mirror settings/(set knot) :: frontend settings == :: + :: :: + ++ move (pair bone card) :: all actions + ++ lime {$sole-effect sole-effect} :: diff fruit + ++ pear :: poke fruit + $% {$talk-command command} :: + {$talk-update update} :: + == :: + ++ card :: general card + $% {$diff lime} :: + {$poke wire dock pear} :: + == :: + ++ work :: interface action + $% {$number p/$@(@ud {@u @ud})} :: relative/absolute + {$help $~} :: print usage info + {$who p/where} :: presence + {$what p/$@(char (set partner))} :: show bound glyph + {$bind p/char q/(unit where)} :: + {$join p/where} :: + {$leave p/where} :: + {$say p/(list speech)} :: + {$eval p/cord q/twig} :: + {$invite p/knot q/(list partner)} :: whitelist add + {$banish p/knot q/(list partner)} :: blacklist add + {$block p/knot q/(list partner)} :: blacklist add + {$author p/knot q/(list partner)} :: whitelist add + {$nick p/(unit ship) q/(unit cord)} :: + {$set p/knot} :: + {$unset p/knot} :: + {$target p/where q/(unit work)} :: set active targets + :: {$destroy p/knot} :: + {$create p/posture q/knot r/cord} :: + {$probe p/station} :: + == :: + ++ where (set partner) :: non-empty audience + ++ glyphs `wall`~[">=+-" "}),." "\"'`^" "$%&@"] :: station char pool' + -- +:: |_ {hid/bowl chattel} -++ sh :: per console - ::x shell core, responsible for doing things with console sessions, - ::x like parsing input, acting based on input, showing output, keeping - ::x track of settings and other frontend state. - ::x important arms include ++sh-repo which is used to apply reports, and - ::x ++sh-sole which gets called upon cli prompt interaction. - ::x any talk commands the core's arms want to have executed get put into - ::x coz. the stored commands get applied upon calling ++sh-abet. +:: +++ ra :: per transaction + ::x gets called when talk gets poked or otherwise prompted/needs to perform + ::x an action. + ::x arms generally modify state, and store moves in ++ra's moves. these get + ::x produced when calling ++ra-abet. + ::x in applying commands and making reports, it uses ++pa for story work. :: - |_ $: ::x coz: talk commands storage, applied by ++sh-abet. - ::x she: console session state used in this core. - :: - she/shell - coz/(list command) :: talk actions - == - ++ sh-scad :: command parser - ::x builds a core with parsers for talk-cli, and produces its work arm. - ::x ++work uses those parsers to parse the current talk-cli prompt input - ::x and produce a work item to be executed by ++sh-work. + ::x moves: moves storage, added to by ++ra-emit and -emil, produced by -abed. + |_ moves/(list move) + :: + ++ ra-abed :: resolve core + ::x produces the moves stored in ++ra's moves. + ::x sole-effects get special treatment to become a single move. :: - =< work - |% - ++ expr :: [cord twig] - |= tub/nail %. tub - %+ stag (crip q.tub) - wide:(vang & [&1:% &2:% (scot %da now.hid) |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) - :: - ++ pasp :: passport - ;~ pfix pat - ;~ pose - (stag %twitter ;~(pfix (jest 't') col urs:ab)) + ^+ [*(list move) +>] + :_ +> + ::x seperate our sole-effects from other moves. + =+ ^= yop + |- ^- (pair (list move) (list sole-effect)) + ?~ moves [~ ~] + =+ mor=$(moves t.moves) + ?: ?& =(ost.hid p.i.moves) + ?=({$diff $sole-effect *} q.i.moves) + == + [p.mor [+>.q.i.moves q.mor]] + [[i.moves p.mor] q.mor] + ::x flop moves, flop and squash sole-effects into a %mor. + =+ :* moz=(flop p.yop) + ^= foc ^- (unit sole-effect) + ?~ q.yop ~ + ?~(t.q.yop `i.q.yop `[%mor (flop `(list sole-effect)`q.yop)]) == + ::x produce moves or sole-effects and moves. + ?~(foc moz [[ost.hid %diff %sole-effect u.foc] moz]) + :: + ++ ra-abet :: complete core + ::x applies talk reports, then produces moves and updated state. + :: + ra-abed:ra-axel + :: + ++ ra-axel :: rebound reports + ::x extracts and applies the talk-reports in moves meant for our shells. + :: + ^+ . + ::x separate talk-reports meant for our shells from other moves. + =+ ^= rey + |- ^- (pair (list move) (list (pair bone report))) + ?~ moves + [~ ~] + =+ mor=$(moves t.moves) + ::x if we know the target shell is ours, and it's a talk report, + ::x add it to the list of reports to be locally applied. + ?. ?& (~(has by shells) `bone`p.i.moves) + ?=({$diff $talk-report *} q.i.moves) + == + [[i.moves p.mor] q.mor] + [p.mor [[p.i.moves +>.q.i.moves] q.mor]] + ::x update moves to exclude our talk-reports. + =. moves p.rey + =. q.rey (flop q.rey) + ?: =(q.rey ~) + + |- ^+ +> + ?~ q.rey ra-axel + ::x apply reports to our shells. + ::TODO will this ever happen? yes: implement ra-back. no: delete sh-repo-* + =+ bak=(ra-back(ost.hid p.i.q.rey) q.i.q.rey) + $(q.rey t.q.rey, +> bak(ost.hid ost.hid)) + :: + ++ ra-diff-talk-report :: subscription update + ::x process a talk report from cuz into story man. + :: + |= {man/knot cuz/station rad/report} + ^+ +> + ::TODO ra-know needed counter +1 + =+ tal=(~(get by tales) man) + ?~ tal ~&([%know-no-tale man] !!) + pa-abet:(~(pa-diff-talk-report pa man u.tal) cuz rad) + + :: + ++ ra-sole + ::x applies sole-action. + :: + |= act/sole-action + ^+ +> + =+ shu=(~(get by shells) ost.hid) + ?~ shu + ~| :+ %ra-console-broken ost.hid + ::x differentiate between subscribers we know and don't know. + ?:((~(has by sup.hid) ost.hid) %lost %unknown) + !! + sh-abet:(~(sh-sole sh ~ u.shu) act) + :: + ++ pa :: story core + ::x tale core, used for doing work on a story. + ::x as always, an -abet arms is used for applying changes to the state. + ::x ++pa-watch- arms get called by ++ra-subscribe to add a subscriber. + ::x bones are used to identify subscribers (source event identifiers) + :: + |_ ::x man: the knot identifying the story in stories. + ::x story doesn't get a face because ease of use + :: + $: man/knot + story + == + ++ pa-abet + ::x apply/fold changes back into the stories map. + :: + ^+ +> + +>(stories (~(put by stories) man `story`+<+)) + :: + ++ pa-lesson :: learn multiple + ::x learn all telegrams in a list. + :: + |= gaz/(list telegram) + ^+ +> + ?~ gaz +> + $(gaz t.gaz, +> (pa-learn i.gaz)) + :: + ++ pa-learn :: learn message + ::x store an incoming telegram, modifying audience to say we received it. + ::x update existing telegram if it already exists. + :: + |= gam/telegram + ^+ +> + ::x if author isn't allowed to write here, reject. + ::TODO we shouldn't need to do permission checks anymore, all we need to + :: do is make sure the grams came from our broker. + ?. (pa-admire p.gam) + ~& %pa-admire-rejected + +>.$ + =. q.q.gam + ::x if we are in the audience, mark us as having received it. + =+ ole=(~(get by q.q.gam) [%& our.hid man]) + ?^ ole (~(put by q.q.gam) [%& our.hid man] -.u.ole %received) + :: for fedearted stations, pretend station src/foo is also our/foo + :: XX pass src through explicitly instead of relying on implicit + :: value in hid from the subscription to src/foo + =+ ole=(~(get by q.q.gam) [%& src.hid man]) + ?~ ole q.q.gam + ::x as described above, fake src into our. + =. q.q.gam (~(del by q.q.gam) [%& src.hid man]) + (~(put by q.q.gam) [%& our.hid man] -.u.ole %received) + =+ old=(~(get by known) p.q.gam) + ?~ old + (pa-append gam) ::x add + (pa-revise u.old gam) ::x modify + :: + ++ pa-append :: append new gram + ::x add gram to our story, and update our subscribers. + :: + |= gam/telegram + ^+ +> + %= +> + grams [gam grams] + count +(count) + known (~(put by known) p.q.gam count) == :: - ++ stan :: station - ;~ pose - (cold [our.hid man.she] col) - ;~(pfix cen (stag our.hid sym)) - ;~(pfix fas (stag (sein our.hid) sym)) + ++ pa-revise :: revise existing gram + ::x modify a gram in our story, and update our subscribers. :: + |= {num/@ud gam/telegram} + =+ way=(sub count num) + ?: =(gam (snag (dec way) grams)) + +>.$ :: no change + =. grams (welp (scag (dec way) grams) [gam (slag way grams)]) + +>.$ + :: + ++ pa-remind :: presence update + ::x merge local and remote presences, and store them in locals. + :: + ::TODO stop using timed. + |= {tay/partner loc/atlas rem/(map partner atlas)} + ::x remove this story from the presence map, since it's in local already. + =. rem (~(del by rem) %& our.hid man) :: superceded by local data + ::TODO stop using timed, just do uni here. + =/ buk (~(uni timed remotes) rem) :: XX drop? + =. buk (~(put timed buk) tay now.hid loc) + +>.$ + :: + ++ pa-cabal + ::x update the tale's config. + :: + |= {cuz/station con/config} + ^+ +> + +>(shape con) + :: + ++ pa-diff-talk-report :: subscribed update + ::x process a talk report from cuz. + :: + |= {cuz/station rad/report} + ^+ +> + ::x verify we are supposed to receive reports from cuz. + ?. (~(has in sources.shape) [%& cuz]) + ~& [%pa-diff-unexpected cuz rad] + +> + ?+ -.rad ~|([%talk-odd-friend rad] !!) + $cabal (pa-cabal cuz +.rad) + $group (pa-remind [%& cuz] +.rad) + $grams (pa-lesson q.+.rad) + == + :: + -- + ++ sh :: per console + ::x shell core, responsible for doing things with console sessions, + ::x like parsing input, acting based on input, showing output, keeping + ::x track of settings and other frontend state. + ::x important arms include ++sh-repo which is used to apply reports, and + ::x ++sh-sole which gets called upon cli prompt interaction. + ::x any talk commands the core's arms want to have executed get put into + ::x coz. the stored commands get applied upon calling ++sh-abet. + :: + |_ $: ::x coz: talk commands storage, applied by ++sh-abet. + ::x she: console session state used in this core. + :: + she/shell + coz/(list command) :: talk actions + == + ++ sh-scad :: command parser + ::x builds a core with parsers for talk-cli, and produces its work arm. + ::x ++work uses those parsers to parse the current talk-cli prompt input + ::x and produce a work item to be executed by ++sh-work. + :: + =< work + |% + ++ expr :: [cord twig] + |= tub/nail %. tub + %+ stag (crip q.tub) + wide:(vang & [&1:% &2:% (scot %da now.hid) |3:%]) + :: + ++ dare :: @dr + %+ sear + |= a/coin + ?. ?=({$$ $dr @} a) ~ + (some `@dr`+>.a) + nuck:so + :: + ++ ship ;~(pfix sig fed:ag) :: ship + ++ shiz :: ship set %+ cook - |= {a/@p b/(unit term)} - [a ?^(b u.b (main a))] - ;~ plug - ship - (punt ;~(pfix fas urs:ab)) - == - == - :: - ++ parn :: partner - ;~ pose - (stag %& stan) - (stag %| pasp) - == - ++ partners-flat :: collapse mixed list - |= a/(list (each partner (set partner))) - ^- (set partner) - ?~ a ~ - ?- -.i.a - $& (~(put in $(a t.a)) p.i.a) - $| (~(uni in $(a t.a)) p.i.a) - == - :: - ++ para :: partners alias - %+ cook partners-flat - %+ most ;~(plug com (star ace)) - (pick parn (sear sh-glyf glyph)) - :: - ++ parz :: non-empty partners - %+ cook ~(gas in *(set partner)) - (most ;~(plug com (star ace)) parn) - :: - ++ nump :: number reference - ;~ pose - ;~(pfix hep dem:ag) - ;~ plug - (cook lent (plus (just '0'))) - ;~(pose dem:ag (easy 0)) - == - (stag 0 dem:ag) - == - :: - ++ pore :: posture - ;~ pose - (cold %black (jest %channel)) - (cold %white (jest %village)) - (cold %green (jest %journal)) - (cold %brown (jest %mailbox)) - == - :: - ++ message - ;~ pose - ;~(plug (cold %eval hax) expr) + |=(a/(list ^ship) (~(gas in *(set ^ship)) a)) + (most ;~(plug com (star ace)) ship) :: - %+ stag %say - %+ most (jest '•') - ;~ pose - (stag %url aurf:urlp) - :(stag %lin | ;~(pfix pat text)) - :(stag %lin & ;~(less sem hax text)) - == - == - :: - ++ nick (cook crip (stun [1 14] low)) :: nickname - ++ text (cook crip (plus (shim ' ' '~'))) :: bullets separating - ++ glyph (mask "/\\\{( ::x points to ++sh's |_ core's context. + =+ zoc=(flop coz) + |- ^+ +>+> ::x +> would point to |-'s context. +>+> goes to ++sh |_'s. + ::x produce context with this shell updated. + ?~ zoc +>+>.$(shells (~(put by shells) ost.hid she)) + ::x recurse, with context (of |-?) modified. + $(zoc t.zoc, +>.$ (sh-deal i.zoc)) + :: + ++ sh-deal :: apply from shell + ::x used by ++sh-abet, applies an individual talk command. + :: + |= cod/command + ^+ +> + ?- -.cod + ::x the $design command is used for modifying channel configs, + ::x which is done when joining, leaving or creating channels. + $design + ?~ q.cod + ::x updates context with new config state. + =. +>+>.$ (ra-config p.cod *config) + ::x produces context with story p.cod deleted. + +>.$(stories (~(del by stories) p.cod)) + ::x produces +> with its +> (so, +>+>) updated by ++ra-think. + +>(+> (ra-config p.cod u.q.cod)) + :: + ::x used for relaying messages (as a station host). + $review +>(+> (ra-think | her.she +.cod)) + ::x used for sending messages (as their author). + $publish +>(+> (ra-think & her.she +.cod)) == - -- - ++ sh-abet - ::x applies talk commands (in reverse order, because ++sh-tell adds them - ::x to coz as [new coz], but you want to apply them in the order - ::x [coz new]). produces an updated context for the ++sh core. :: - ^+ +> ::x points to ++sh's |_ core's context. - =+ zoc=(flop coz) - |- ^+ +>+> ::x +> would point to |-'s context. +>+> goes to ++sh |_'s. - ::x produce context with this shell updated. - ?~ zoc +>+>.$(shells (~(put by shells) ost.hid she)) - ::x recurse, with context (of |-?) modified. - $(zoc t.zoc, +>.$ (sh-deal i.zoc)) - :: - ++ sh-deal :: apply from shell - ::x used by ++sh-abet, applies an individual talk command. + ++ sh-fact :: send console effect + ::x adds a console effect to ++ra's moves. + :: + |= fec/sole-effect + ^+ +> + +>(moves :_(moves [ost.hid %diff %sole-effect fec])) :: - |= cod/command - ^+ +> - ?- -.cod - ::x the $design command is used for modifying channel configs, - ::x which is done when joining, leaving or creating channels. - $design - ?~ q.cod - ::x updates context with new config state. - =. +>+>.$ (ra-config p.cod *config) - ::x produces context with story p.cod deleted. - +>.$(stories (~(del by stories) p.cod)) - ::x produces +> with its +> (so, +>+>) updated by ++ra-think. - +>(+> (ra-config p.cod u.q.cod)) + ++ sh-peep :: peer to path + ::TODO remove. + :: + |= pax/path + ^+ +> + +>(+> (ra-subscribe her.she pax)) :: - ::x used for relaying messages (as a station host). - $review +>(+> (ra-think | her.she +.cod)) - ::x used for sending messages (as their author). - $publish +>(+> (ra-think & her.she +.cod)) - == - :: - ++ sh-fact :: send console effect - ::x adds a console effect to ++ra's moves. + ++ sh-peer :: subscribe shell + ::x create a shell, subscribe to default stories. + :: + =< sh-prod + %_ . + +> + =/ typ + =+ (ly ~[%a-group %f-grams %x-cabal]) + (rap 3 (turn - encode:peer-type)) + ::x subscriptions to the shell's ship's default channels. + (ra-subscribe:(ra-subscribe her.she ~) her.she [typ man.she ~]) + == :: - |= fec/sole-effect - ^+ +> - +>(moves :_(moves [ost.hid %diff %sole-effect fec])) - :: - ++ sh-peep :: peer to path - ::TODO remove. + ++ sh-prod :: show prompt + ::x make and store a move to modify the cli prompt, displaying audience. + :: + ^+ . + %+ sh-fact %pro + :+ & %talk-line + ^- tape + =/ rew/(pair (pair @t @t) (set partner)) + [['[' ']'] u.active.she] + =+ cha=(~(get by nik) q.rew) + ?^ cha ~[u.cha ' '] + :: ~& [rew nik nak] + =+ por=~(te-prom te man.she q.rew) + (weld `tape`[p.p.rew por] `tape`[q.p.rew ' ' ~]) :: - |= pax/path - ^+ +> - +>(+> (ra-subscribe her.she pax)) - :: - ++ sh-peer :: subscribe shell - ::x create a shell, subscribe to default stories. + ++ sh-pact :: update active aud + ::x change currently selected audience to lix, updating prompt. + :: + |= lix/(set partner) + ^+ +> + =+ act=(sh-pare lix) ::x ensure we can see what we send. + ?~ act ~|(%no-audience !!) ::TODO can't happen, remove. + ?: =(active.she `act) +>.$ + sh-prod(active.she `act) :: - =< sh-prod - %_ . - +> - =/ typ - =+ (ly ~[%a-group %f-grams %x-cabal]) - (rap 3 (turn - encode:peer-type)) - ::x subscriptions to the shell's ship's default channels. - (ra-subscribe:(ra-subscribe her.she ~) her.she [typ man.she ~]) - == - :: - ++ sh-prod :: show prompt - ::x make and store a move to modify the cli prompt, displaying audience. + ++ sh-pare :: adjust target list + ::x if the audience paz does not contain a partner we're subscribed to, + ::x add our mailbox to the audience (so that we can see our own message). + :: + |= paz/(set partner) + ?: (sh-pear paz) paz + (~(put in paz) [%& our.hid man.she]) :: - ^+ . - %+ sh-fact %pro - :+ & %talk-line - ^- tape - =/ rew/(pair (pair @t @t) (set partner)) - [['[' ']'] u.active.she] - =+ cha=(~(get by nik) q.rew) - ?^ cha ~[u.cha ' '] - :: ~& [rew nik nak] - =+ por=~(te-prom te man.she q.rew) - (weld `tape`[p.p.rew por] `tape`[q.p.rew ' ' ~]) - :: - ++ sh-pact :: update active aud - ::x change currently selected audience to lix, updating prompt. + ++ sh-pear :: hearback + ::x produces true if any partner is included in our subscriptions, + ::x aka, if we hear messages sent to paz. + :: + |= paz/(set partner) + ?~ paz | + ?| $(paz l.paz) + $(paz r.paz) + (~(has in sources.shape:(~(got by stories) man.she)) `partner`n.paz) + == :: - |= lix/(set partner) - ^+ +> - =+ act=(sh-pare lix) ::x ensure we can see what we send. - ?~ act ~|(%no-audience !!) ::TODO can't happen, remove. - ?: =(active.she `act) +>.$ - sh-prod(active.she `act) - :: - ++ sh-pare :: adjust target list - ::x if the audience paz does not contain a partner we're subscribed to, - ::x add our mailbox to the audience (so that we can see our own message). + ++ sh-pest :: report listen + ::x updates audience to be tay, only if tay is not a village/%white. + ::x? why exclude village (invite-only?) audiences from this? + :: + |= tay/partner + ^+ +> + ?. ?=($& -.tay) +> ::x if partner is a passport, do nothing. + =+ sib=(~(get by ham.system.she) `station`p.tay) ::x get config for tay + ?. |(?=($~ sib) !?=($white p.cordon.u.sib)) + +>.$ + (sh-pact [tay ~ ~]) :: - |= paz/(set partner) - ?: (sh-pear paz) paz - (~(put in paz) [%& our.hid man.she]) - :: - ++ sh-pear :: hearback - ::x produces true if any partner is included in our subscriptions, - ::x aka, if we hear messages sent to paz. + ++ sh-rend :: print on one line + ::x renders a telegram as a single line, adds it as a console move, + ::x and updates the selected audience to match the telegram's. + :: + |= gam/telegram + =+ lin=~(tr-line tr man.she settings.she gam) + (sh-fact %txt lin) :: - |= paz/(set partner) - ?~ paz | - ?| $(paz l.paz) - $(paz r.paz) - (~(has in sources.shape:(~(got by stories) man.she)) `partner`n.paz) - == - :: - ++ sh-pest :: report listen - ::x updates audience to be tay, only if tay is not a village/%white. - ::x? why exclude village (invite-only?) audiences from this? + ++ sh-numb :: print msg number + ::x does as it says on the box. + :: + |= num/@ud + ^+ +> + =+ bun=(scow %ud num) + %+ sh-fact %txt + (runt [(sub 13 (lent bun)) '-'] "[{bun}]") :: - |= tay/partner - ^+ +> - ?. ?=($& -.tay) +> ::x if partner is a passport, do nothing. - =+ sib=(~(get by ham.system.she) `station`p.tay) ::x get config for tay - ?. |(?=($~ sib) !?=($white p.cordon.u.sib)) - +>.$ - (sh-pact [tay ~ ~]) - :: - ++ sh-rend :: print on one line - ::x renders a telegram as a single line, adds it as a console move, - ::x and updates the selected audience to match the telegram's. + ++ sh-glyf :: decode glyph + ::x gets the partner(s) that match a glyph. + ::x? why (set partner)? it seems like it only ever returns a single one. + ::TODO should produce a set when ambiguous. + :: + |= cha/char ^- (unit (set partner)) + =+ lax=(~(get ju nak) cha) + ?: =(~ lax) ~ ::x no partner. + ?: ?=({* $~ $~} lax) `n.lax ::x single partner. + ::x in case of multiple partners, pick the most recently active one. + =+ grams=grams:(~(got by stories) man.she) + |- ^- (unit (set partner)) + ?~ grams ~ + ::x get first partner from a telegram's audience. + =+ pan=(silt (turn (~(tap by q.q.i.grams)) head)) + ?: (~(has in lax) pan) `pan + $(grams t.grams) :: - |= gam/telegram - =+ lin=~(tr-line tr man.she settings.she gam) - (sh-fact %txt lin) - :: - ++ sh-numb :: print msg number - ::x does as it says on the box. - :: - |= num/@ud - ^+ +> - =+ bun=(scow %ud num) - %+ sh-fact %txt - (runt [(sub 13 (lent bun)) '-'] "[{bun}]") - :: - ++ sh-glyf :: decode glyph - ::x gets the partner(s) that match a glyph. - ::x? why (set partner)? it seems like it only ever returns a single one. - ::TODO should produce a set when ambiguous. - :: - |= cha/char ^- (unit (set partner)) - =+ lax=(~(get ju nak) cha) - ?: =(~ lax) ~ ::x no partner. - ?: ?=({* $~ $~} lax) `n.lax ::x single partner. - ::x in case of multiple partners, pick the most recently active one. - =+ grams=grams:(~(got by stories) man.she) - |- ^- (unit (set partner)) - ?~ grams ~ - ::x get first partner from a telegram's audience. - =+ pan=(silt (turn (~(tap by q.q.i.grams)) head)) - ?: (~(has in lax) pan) `pan - $(grams t.grams) - :: - ::TODO we have a stdlib set diff now! - ++ sh-repo-house-diff - ::x calculates difference between two shelves (channel definitions). - :: - |= {one/shelf two/shelf} - =| $= ret - $: old/(list (pair knot (pair posture cord))) - new/(list (pair knot (pair posture cord))) - cha/(list (pair knot (pair posture cord))) - == - ^+ 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-repo-atlas-diff - ::x calculates the difference between two atlasses (presence lists). - :: - |= {one/atlas two/atlas} - =| $= 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 p.q.i.eno) ret - =+ unt=(~(get by two) p.i.eno) - ?~ unt - ret(old [i.eno old.ret]) - ?: =(%gone p.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 p.q.i.owt) ret - ?. (~(has by one) p.i.owt) - ret(new [i.owt new.ret]) - ?: =(%gone p:(~(got by one) p.i.owt)) + ::TODO we have a stdlib set diff now! + ++ sh-repo-house-diff + ::x calculates difference between two shelves (channel definitions). + :: + |= {one/shelf two/shelf} + =| $= ret + $: old/(list (pair knot (pair posture cord))) + new/(list (pair knot (pair posture cord))) + cha/(list (pair knot (pair posture cord))) + == + ^+ 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 - ret - :: - ++ sh-repo-cabal-diff - ::x calculates the difference between two cabals (station configurations) :: - |= {one/(map station config) two/(map station config)} - =| $= ret - $: old/(list (pair station config)) - new/(list (pair station config)) - cha/(list (pair station 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-repo-rogue-diff - ::x calculates the difference between two maps of stations and their - ::x presence lists. - :: - |= {one/(map partner atlas) two/(map partner atlas)} - =| $= ret - $: old/(list (pair partner atlas)) - new/(list (pair partner atlas)) - cha/(list (pair partner atlas)) - == - =. one ~(strip timed one) - =. two ~(strip timed two) - ^+ 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-repo-whom-diff - ::x calculates the difference between two partner sets. - :: - |= {one/(set partner) two/(set partner)} - =| $= ret - $: old/(list partner) - new/(list partner) - == - ^+ ret - =. ret - =+ eno=(~(tap by one)) - |- ^+ ret - ?~ eno ret - =. ret $(eno t.eno) - ?: (~(has in two) i.eno) - ret - ret(old [i.eno old.ret]) - =. ret - =+ owt=(~(tap by two)) - |- ^+ ret - ?~ owt ret - =. ret $(owt t.owt) - ?: (~(has in one) i.owt) - ret - ret(new [i.owt new.ret]) - ret - :: - ++ sh-repo-ship-diff - ::x calculates the difference between two ship sets. - :: - |= {one/(set ship) two/(set ship)} - =| $= ret - $: old/(list ship) - new/(list ship) - == - ^+ ret - =. ret - =+ eno=(~(tap by one)) - |- ^+ ret - ?~ eno ret - =. ret $(eno t.eno) - ?: (~(has in two) i.eno) - ret - ret(old [i.eno old.ret]) - =. ret - =+ owt=(~(tap by two)) - |- ^+ ret - ?~ owt ret - =. ret $(owt t.owt) - ?: (~(has in one) i.owt) - ret - ret(new [i.owt new.ret]) - ret - :: - ++ sh-puss - ::x posture as text. - :: - |= a/posture ^- tape - ?- a - $black "channel" - $brown "mailbox" - $white "village" - $green "journal" - == - :: - ++ sh-repo-config-exceptions - ::x used by ++sh-repo-config-show to aid in printing info to cli. - :: - |= {pre/tape por/posture old/(list ship) new/(list ship)} - =+ out=?:(?=(?($black $brown) por) "try " "cut ") - =+ inn=?:(?=(?($black $brown) por) "ban " "add ") - =. +>.$ - |- ^+ +>.^$ - ?~ old +>.^$ - =. +>.^$ $(old t.old) - (sh-note :(weld pre out " " (scow %p i.old))) - =. +>.$ - |- ^+ +>.^$ - ?~ new +>.^$ - =. +>.^$ $(new t.new) - (sh-note :(weld pre out " " (scow %p i.new))) - +>.$ - :: - ++ sh-repo-config-sources - ::x used by ++sh-repo-config-show to aid in printing info to cli, - ::x pertaining to the un/subscribing to partners. - :: - |= {pre/tape old/(list partner) new/(list partner)} - ^+ +> - =. +>.$ - |- ^+ +>.^$ - ?~ old +>.^$ - =. +>.^$ $(old t.old) - (sh-note (weld pre "off {~(ta-full ta man.she i.old)}")) - =. +>.$ - |- ^+ +>.^$ - ?~ new +>.^$ - =. +>.^$ $(new t.new) - (sh-note (weld pre "hey {~(ta-full ta man.she i.new)}")) - +>.$ - :: - ++ sh-repo-config-show - ::x prints config changes to the cli. - :: - |= {pre/tape laz/config loc/config} - ^+ +> - =. +>.$ - ?: =(caption.loc caption.laz) +>.$ - (sh-note :(weld pre "cap " (trip caption.loc))) - =. +>.$ - %+ sh-repo-config-sources - (weld (trip man.she) ": ") - (sh-repo-whom-diff sources.laz sources.loc) - ?: !=(p.cordon.loc p.cordon.laz) - =. +>.$ (sh-note :(weld pre "but " (sh-puss p.cordon.loc))) - %^ sh-repo-config-exceptions - (weld (trip man.she) ": ") - p.cordon.loc - [~ (~(tap in q.cordon.loc))] - %^ sh-repo-config-exceptions - (weld (trip man.she) ": ") - p.cordon.loc - (sh-repo-ship-diff q.cordon.laz q.cordon.loc) - :: - ++ sh-repo-cabal-changes - ::x used by ++sh-repo-cabal for printing cabal config changes to cli. - :: - |= $: laz/(map station config) - old/(list (pair station config)) - new/(list (pair station config)) - cha/(list (pair station config)) - == - =. +>.$ - |- ^+ +>.^$ - ?~ new +>.^$ - =. +>.^$ $(new t.new) - =. +>.^$ (sh-pest [%& p.i.new]) - %+ sh-repo-config-show - (weld ~(sn-phat sn man.she p.i.new) ": ") - [*config q.i.new] - =. +>.$ - |- ^+ +>.^$ - ?~ cha +>.^$ - =. +>.^$ $(cha t.cha) - %+ sh-repo-config-show - (weld ~(sn-phat sn man.she p.i.cha) ": ") - [(~(got by laz) `station`p.i.cha) q.i.cha] - +>.$ - :: - ++ sh-repo-cabal - ::x updates the current shell's cabal and prints changes to cli. - :: - |= bal/cabal - ^+ +> - =+ laz=system.she - =. system.she bal - =. +>.$ - %+ sh-repo-cabal-changes ham.laz - (sh-repo-cabal-diff ham.laz ham.bal) - (sh-repo-config-show "" loc.laz loc.bal) - :: - ++ sh-repo-house - ::x applies new shelf ("house"?) and prints changes to cli. - :: - |= awl/(map knot (pair posture cord)) - ^+ +> - =+ dif=(sh-repo-house-diff harbor.she awl) - =. harbor.she awl - =. +>.$ - |- ^+ +>.^$ - ?~ old.dif +>.^$ - =. +>.^$ $(old.dif t.old.dif) - (sh-note "cut {(sh-puss p.q.i.old.dif)} %{(trip p.i.old.dif)}") - =. +>.$ - |- ^+ +>.^$ - ?~ new.dif +>.^$ - =. +>.^$ $(new.dif t.new.dif) - =+ :* nam=(trip p.i.new.dif) - por=(sh-puss p.q.i.new.dif) - des=(trip q.q.i.new.dif) - == - (sh-note "new {por} %{nam}: {des}") - =. +>.$ - |- ^+ +>.^$ - ?~ cha.dif +>.^$ - =. +>.^$ $(cha.dif t.cha.dif) - =+ :* nam=(trip p.i.cha.dif) - por=(sh-puss p.q.i.cha.dif) - des=(trip q.q.i.cha.dif) - == - (sh-note "mod %{nam}: {por}, {des}") - +>.$ - :: - ++ sh-note :: shell message - ::x prints a txt to cli in talk's format. - :: - |= txt/tape - ^+ +> - (sh-fact %txt (runt [14 '-'] `tape`['|' ' ' (scag 64 txt)])) - :: - ++ sh-spaz :: print status - ::x gets the presence of a status. - :: - |= saz/status - ^- tape - ['%' (trip p.saz)] - :: - ++ sh-repo-group-diff-here :: print atlas diff - ::x prints presence notifications. - :: - |= $: pre/tape - $= cul + ++ sh-repo-atlas-diff + ::x calculates the difference between two atlasses (presence lists). + :: + |= {one/atlas two/atlas} + =| $= ret $: old/(list (pair ship status)) new/(list (pair ship status)) cha/(list (pair ship status)) == - == - ?: (~(has in settings.she) %quiet) + ^+ ret + =. ret + =+ eno=(~(tap by one)) + |- ^+ ret + ?~ eno ret + =. ret $(eno t.eno) + ?: =(%gone p.q.i.eno) ret + =+ unt=(~(get by two) p.i.eno) + ?~ unt + ret(old [i.eno old.ret]) + ?: =(%gone p.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 p.q.i.owt) ret + ?. (~(has by one) p.i.owt) + ret(new [i.owt new.ret]) + ?: =(%gone p:(~(got by one) p.i.owt)) + ret(new [i.owt new.ret]) + ret + ret + :: + ++ sh-repo-cabal-diff + ::x calculates the difference between two cabals (station configurations) + :: + |= {one/(map station config) two/(map station config)} + =| $= ret + $: old/(list (pair station config)) + new/(list (pair station config)) + cha/(list (pair station 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-repo-rogue-diff + ::x calculates the difference between two maps of stations and their + ::x presence lists. + :: + |= {one/(map partner atlas) two/(map partner atlas)} + =| $= ret + $: old/(list (pair partner atlas)) + new/(list (pair partner atlas)) + cha/(list (pair partner atlas)) + == + =. one ~(strip timed one) + =. two ~(strip timed two) + ^+ 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-repo-whom-diff + ::x calculates the difference between two partner sets. + :: + |= {one/(set partner) two/(set partner)} + =| $= ret + $: old/(list partner) + new/(list partner) + == + ^+ ret + =. ret + =+ eno=(~(tap by one)) + |- ^+ ret + ?~ eno ret + =. ret $(eno t.eno) + ?: (~(has in two) i.eno) + ret + ret(old [i.eno old.ret]) + =. ret + =+ owt=(~(tap by two)) + |- ^+ ret + ?~ owt ret + =. ret $(owt t.owt) + ?: (~(has in one) i.owt) + ret + ret(new [i.owt new.ret]) + ret + :: + ++ sh-repo-ship-diff + ::x calculates the difference between two ship sets. + :: + |= {one/(set ship) two/(set ship)} + =| $= ret + $: old/(list ship) + new/(list ship) + == + ^+ ret + =. ret + =+ eno=(~(tap by one)) + |- ^+ ret + ?~ eno ret + =. ret $(eno t.eno) + ?: (~(has in two) i.eno) + ret + ret(old [i.eno old.ret]) + =. ret + =+ owt=(~(tap by two)) + |- ^+ ret + ?~ owt ret + =. ret $(owt t.owt) + ?: (~(has in one) i.owt) + ret + ret(new [i.owt new.ret]) + ret + :: + ++ sh-puss + ::x posture as text. + :: + |= a/posture ^- tape + ?- a + $black "channel" + $brown "mailbox" + $white "village" + $green "journal" + == + :: + ++ sh-repo-config-exceptions + ::x used by ++sh-repo-config-show to aid in printing info to cli. + :: + |= {pre/tape por/posture old/(list ship) new/(list ship)} + =+ out=?:(?=(?($black $brown) por) "try " "cut ") + =+ inn=?:(?=(?($black $brown) por) "ban " "add ") + =. +>.$ + |- ^+ +>.^$ + ?~ old +>.^$ + =. +>.^$ $(old t.old) + (sh-note :(weld pre out " " (scow %p i.old))) + =. +>.$ + |- ^+ +>.^$ + ?~ new +>.^$ + =. +>.^$ $(new t.new) + (sh-note :(weld pre out " " (scow %p i.new))) +>.$ - =. +>.$ - |- ^+ +>.^$ - ?~ old.cul +>.^$ - =. +>.^$ $(old.cul t.old.cul) - (sh-note (weld pre "bye {(scow %p p.i.old.cul)}")) - =. +>.$ - |- ^+ +>.^$ - ?~ new.cul +>.^$ - =. +>.^$ $(new.cul t.new.cul) - %- sh-note - (weld pre "met {(scow %p p.i.new.cul)} {(sh-spaz q.i.new.cul)}") - =. +>.$ - |- ^+ +>.^$ - ?~ cha.cul +>.^$ - %- sh-note - (weld pre "set {(scow %p p.i.cha.cul)} {(sh-spaz q.i.cha.cul)}") - +>.$ - :: - ++ sh-repo-group-here :: update local - ::x updates local presence store and prints changes. :: - |= loc/atlas - ^+ +> - =+ cul=(sh-repo-atlas-diff p.owners.she loc) - =. p.owners.she loc - (sh-repo-group-diff-here "" cul) - :: - ++ sh-repo-group-there :: update foreign - ::x updates remote presences(?) and prints changes. - :: - |= yid/(map partner atlas) - =+ day=(sh-repo-rogue-diff q.owners.she yid) - =+ dun=q.owners.she - =. q.owners.she yid - ?: (~(has in settings.she) %quiet) + ++ sh-repo-config-sources + ::x used by ++sh-repo-config-show to aid in printing info to cli, + ::x pertaining to the un/subscribing to partners. + :: + |= {pre/tape old/(list partner) new/(list partner)} + ^+ +> + =. +>.$ + |- ^+ +>.^$ + ?~ old +>.^$ + =. +>.^$ $(old t.old) + (sh-note (weld pre "off {~(ta-full ta man.she i.old)}")) + =. +>.$ + |- ^+ +>.^$ + ?~ new +>.^$ + =. +>.^$ $(new t.new) + (sh-note (weld pre "hey {~(ta-full ta man.she i.new)}")) +>.$ - =. +>.$ - |- ^+ +>.^$ - ?~ old.day +>.^$ - =. +>.^$ $(old.day t.old.day) - (sh-note (weld "not " (~(ta-show ta man.she p.i.old.day) ~))) - =. +>.$ - |- ^+ +>.^$ - ?~ new.day +>.^$ - =. +>.^$ $(new.day t.new.day) - =. +>.^$ - (sh-note (weld "new " (~(ta-show ta man.she p.i.new.day) ~))) - (sh-repo-group-diff-here "--" ~ (~(tap by q.i.new.day)) ~) - =. +>.$ - |- ^+ +>.^$ - ?~ cha.day +>.^$ - =. +>.^$ $(cha.day t.cha.day) - =. +>.^$ - (sh-note (weld "for " (~(ta-show ta man.she p.i.cha.day) ~))) - =+ yez=(~(got by dun) p.i.cha.day) - %+ sh-repo-group-diff-here "--" - (sh-repo-atlas-diff yez q.i.cha.day) - +>.$ - :: - ++ sh-repo-group - ::x update local and remote presences. :: - |= ges/register - ^+ +> - =. +> (sh-repo-group-here p.ges) - =. +> (sh-repo-group-there q.ges) - +> - :: - ++ sh-repo-gram - ::x renders telegram: increase gram count and print the gram. - ::x every fifth gram, prints the number. + ++ sh-repo-config-show + ::x prints config changes to the cli. + :: + |= {pre/tape laz/config loc/config} + ^+ +> + =. +>.$ + ?: =(caption.loc caption.laz) +>.$ + (sh-note :(weld pre "cap " (trip caption.loc))) + =. +>.$ + %+ sh-repo-config-sources + (weld (trip man.she) ": ") + (sh-repo-whom-diff sources.laz sources.loc) + ?: !=(p.cordon.loc p.cordon.laz) + =. +>.$ (sh-note :(weld pre "but " (sh-puss p.cordon.loc))) + %^ sh-repo-config-exceptions + (weld (trip man.she) ": ") + p.cordon.loc + [~ (~(tap in q.cordon.loc))] + %^ sh-repo-config-exceptions + (weld (trip man.she) ": ") + p.cordon.loc + (sh-repo-ship-diff q.cordon.laz q.cordon.loc) :: - |= {num/@ud gam/telegram} - ^+ +> - ?: =(num count.she) - =. +> ?:(=(0 (mod num 5)) (sh-numb num) +>) - (sh-rend(count.she +(num)) gam) - ?: (gth num count.she) - =. +> (sh-numb num) - (sh-rend(count.she +(num)) gam) - +> - :: - ++ sh-repo-grams :: apply telegrams - ::x renders telegrams. + ++ sh-repo-cabal-changes + ::x used by ++sh-repo-cabal for printing cabal config changes to cli. + :: + |= $: laz/(map station config) + old/(list (pair station config)) + new/(list (pair station config)) + cha/(list (pair station config)) + == + =. +>.$ + |- ^+ +>.^$ + ?~ new +>.^$ + =. +>.^$ $(new t.new) + =. +>.^$ (sh-pest [%& p.i.new]) + %+ sh-repo-config-show + (weld ~(sn-phat sn man.she p.i.new) ": ") + [*config q.i.new] + =. +>.$ + |- ^+ +>.^$ + ?~ cha +>.^$ + =. +>.^$ $(cha t.cha) + %+ sh-repo-config-show + (weld ~(sn-phat sn man.she p.i.cha) ": ") + [(~(got by laz) `station`p.i.cha) q.i.cha] + +>.$ :: - |= {num/@ud gaz/(list telegram)} - ^+ +> - ?~ gaz +> - $(gaz t.gaz, num +(num), +> (sh-repo-gram num i.gaz)) - :: - ++ sh-repo-glyph :: apply binding - ::x updates glyph bindings and lookup, and updates selected audience. + ++ sh-repo-cabal + ::x updates the current shell's cabal and prints changes to cli. + :: + |= bal/cabal + ^+ +> + =+ laz=system.she + =. system.she bal + =. +>.$ + %+ sh-repo-cabal-changes ham.laz + (sh-repo-cabal-diff ham.laz ham.bal) + (sh-repo-config-show "" loc.laz loc.bal) :: - |= nac/(jug char (set partner)) - ^+ +> - %_ sh-prod - nak nac - nik %- ~(gas by *(map (set partner) char)) - =- (zing `(list (list {(set partner) char}))`-) - %+ turn (~(tap by nac)) - |= {a/char b/(set (set partner))} - (turn (~(tap by b)) |=(c/(set partner) [c a])) - == - :: - ++ sh-repo :: apply report - ::x applies the different kinds of reports using their handler arms above + ++ sh-repo-house + ::x applies new shelf ("house"?) and prints changes to cli. + :: + |= awl/(map knot (pair posture cord)) + ^+ +> + =+ dif=(sh-repo-house-diff harbor.she awl) + =. harbor.she awl + =. +>.$ + |- ^+ +>.^$ + ?~ old.dif +>.^$ + =. +>.^$ $(old.dif t.old.dif) + (sh-note "cut {(sh-puss p.q.i.old.dif)} %{(trip p.i.old.dif)}") + =. +>.$ + |- ^+ +>.^$ + ?~ new.dif +>.^$ + =. +>.^$ $(new.dif t.new.dif) + =+ :* nam=(trip p.i.new.dif) + por=(sh-puss p.q.i.new.dif) + des=(trip q.q.i.new.dif) + == + (sh-note "new {por} %{nam}: {des}") + =. +>.$ + |- ^+ +>.^$ + ?~ cha.dif +>.^$ + =. +>.^$ $(cha.dif t.cha.dif) + =+ :* nam=(trip p.i.cha.dif) + por=(sh-puss p.q.i.cha.dif) + des=(trip q.q.i.cha.dif) + == + (sh-note "mod %{nam}: {por}, {des}") + +>.$ :: - |= rad/report - ^+ +> - :: ~& [%sh-repo rad] - ?- -.rad - $cabal (sh-repo-cabal +.rad) - $grams (sh-repo-grams +.rad) - $glyph (sh-repo-glyph +.rad) :: XX ever happens? - $group (sh-repo-group +.rad) - $house (sh-repo-house +.rad) - == - :: - ++ sh-sane-chat :: sanitize chatter - ::x (for chat messages) sanitizes the input buffer and splits it into - ::x multiple lines ('•'). + ++ sh-note :: shell message + ::x prints a txt to cli in talk's format. + :: + |= txt/tape + ^+ +> + (sh-fact %txt (runt [14 '-'] `tape`['|' ' ' (scag 64 txt)])) :: - |= buf/(list @c) - ^- (list sole-edit) - ?~ buf ~ - =+ isa==(i.buf (turf '@')) - =+ [[pre=*@c cur=i.buf buf=t.buf] inx=0 brk=0 len=0 new=|] - =* txt -< - |^ ^- (list sole-edit) - ?: =(cur (turf '•')) - ?: =(pre (turf '•')) - [[%del inx] ?~(buf ~ $(txt +.txt))] - ?: new - [(fix ' ') $(cur `@c`' ')] - newline - ?: =(cur `@`' ') - =. brk ?:(=(pre `@`' ') brk inx) - ?. =(64 len) advance - :- (fix(inx brk) (turf '•')) - ?: isa - [[%ins +(brk) (turf '@')] newline(new &)] - newline(new &) - ?: =(64 len) - =+ dif=(sub inx brk) - ?: (lth dif 64) + ++ sh-spaz :: print status + ::x gets the presence of a status. + :: + |= saz/status + ^- tape + ['%' (trip p.saz)] + :: + ++ sh-repo-group-diff-here :: print atlas diff + ::x prints presence notifications. + :: + |= $: pre/tape + $= cul + $: old/(list (pair ship status)) + new/(list (pair ship status)) + cha/(list (pair ship status)) + == + == + ?: (~(has in settings.she) %quiet) + +>.$ + =. +>.$ + |- ^+ +>.^$ + ?~ old.cul +>.^$ + =. +>.^$ $(old.cul t.old.cul) + (sh-note (weld pre "bye {(scow %p p.i.old.cul)}")) + =. +>.$ + |- ^+ +>.^$ + ?~ new.cul +>.^$ + =. +>.^$ $(new.cul t.new.cul) + %- sh-note + (weld pre "met {(scow %p p.i.new.cul)} {(sh-spaz q.i.new.cul)}") + =. +>.$ + |- ^+ +>.^$ + ?~ cha.cul +>.^$ + %- sh-note + (weld pre "set {(scow %p p.i.cha.cul)} {(sh-spaz q.i.cha.cul)}") + +>.$ + :: + ++ sh-repo-group-here :: update local + ::x updates local presence store and prints changes. + :: + |= loc/atlas + ^+ +> + =+ cul=(sh-repo-atlas-diff p.owners.she loc) + =. p.owners.she loc + (sh-repo-group-diff-here "" cul) + :: + ++ sh-repo-group-there :: update foreign + ::x updates remote presences(?) and prints changes. + :: + |= yid/(map partner atlas) + =+ day=(sh-repo-rogue-diff q.owners.she yid) + =+ dun=q.owners.she + =. q.owners.she yid + ?: (~(has in settings.she) %quiet) + +>.$ + =. +>.$ + |- ^+ +>.^$ + ?~ old.day +>.^$ + =. +>.^$ $(old.day t.old.day) + (sh-note (weld "not " (~(ta-show ta man.she p.i.old.day) ~))) + =. +>.$ + |- ^+ +>.^$ + ?~ new.day +>.^$ + =. +>.^$ $(new.day t.new.day) + =. +>.^$ + (sh-note (weld "new " (~(ta-show ta man.she p.i.new.day) ~))) + (sh-repo-group-diff-here "--" ~ (~(tap by q.i.new.day)) ~) + =. +>.$ + |- ^+ +>.^$ + ?~ cha.day +>.^$ + =. +>.^$ $(cha.day t.cha.day) + =. +>.^$ + (sh-note (weld "for " (~(ta-show ta man.she p.i.cha.day) ~))) + =+ yez=(~(got by dun) p.i.cha.day) + %+ sh-repo-group-diff-here "--" + (sh-repo-atlas-diff yez q.i.cha.day) + +>.$ + :: + ++ sh-repo-group + ::x update local and remote presences. + :: + |= ges/register + ^+ +> + =. +> (sh-repo-group-here p.ges) + =. +> (sh-repo-group-there q.ges) + +> + :: + ++ sh-repo-gram + ::x renders telegram: increase gram count and print the gram. + ::x every fifth gram, prints the number. + :: + |= {num/@ud gam/telegram} + ^+ +> + ?: =(num count.she) + =. +> ?:(=(0 (mod num 5)) (sh-numb num) +>) + (sh-rend(count.she +(num)) gam) + ?: (gth num count.she) + =. +> (sh-numb num) + (sh-rend(count.she +(num)) gam) + +> + :: + ++ sh-repo-grams :: apply telegrams + ::x renders telegrams. + :: + |= {num/@ud gaz/(list telegram)} + ^+ +> + ?~ gaz +> + $(gaz t.gaz, num +(num), +> (sh-repo-gram num i.gaz)) + :: + ++ sh-repo-glyph :: apply binding + ::x updates glyph bindings and lookup, and updates selected audience. + :: + |= nac/(jug char (set partner)) + ^+ +> + %_ sh-prod + nak nac + nik %- ~(gas by *(map (set partner) char)) + =- (zing `(list (list {(set partner) char}))`-) + %+ turn (~(tap by nac)) + |= {a/char b/(set (set partner))} + (turn (~(tap by b)) |=(c/(set partner) [c a])) + == + :: + ++ sh-repo :: apply report + ::x applies the different kinds of reports using their handler arms above + :: + |= rad/report + ^+ +> + :: ~& [%sh-repo rad] + ?- -.rad + $cabal (sh-repo-cabal +.rad) + $grams (sh-repo-grams +.rad) + $glyph (sh-repo-glyph +.rad) :: XX ever happens? + $group (sh-repo-group +.rad) + $house (sh-repo-house +.rad) + == + :: + ++ sh-sane-chat :: sanitize chatter + ::x (for chat messages) sanitizes the input buffer and splits it into + ::x multiple lines ('•'). + :: + |= buf/(list @c) + ^- (list sole-edit) + ?~ buf ~ + =+ isa==(i.buf (turf '@')) + =+ [[pre=*@c cur=i.buf buf=t.buf] inx=0 brk=0 len=0 new=|] + =* txt -< + |^ ^- (list sole-edit) + ?: =(cur (turf '•')) + ?: =(pre (turf '•')) + [[%del inx] ?~(buf ~ $(txt +.txt))] + ?: new + [(fix ' ') $(cur `@c`' ')] + newline + ?: =(cur `@`' ') + =. brk ?:(=(pre `@`' ') brk inx) + ?. =(64 len) advance :- (fix(inx brk) (turf '•')) ?: isa - [[%ins +(brk) (turf '@')] $(len dif, new &)] - $(len dif, new &) - [[%ins inx (turf '•')] $(len 0, inx +(inx), new &)] - ?: |((lth cur 32) (gth cur 126)) - [(fix '?') advance] - ?: &((gte cur 'A') (lte cur 'Z')) - [(fix (add 32 cur)) advance] - advance + [[%ins +(brk) (turf '@')] newline(new &)] + newline(new &) + ?: =(64 len) + =+ dif=(sub inx brk) + ?: (lth dif 64) + :- (fix(inx brk) (turf '•')) + ?: isa + [[%ins +(brk) (turf '@')] $(len dif, new &)] + $(len dif, new &) + [[%ins inx (turf '•')] $(len 0, inx +(inx), new &)] + ?: |((lth cur 32) (gth cur 126)) + [(fix '?') advance] + ?: &((gte cur 'A') (lte cur 'Z')) + [(fix (add 32 cur)) advance] + advance + :: + ++ advance ?~(buf ~ $(len +(len), inx +(inx), txt +.txt)) + ++ newline ?~(buf ~ $(len 0, inx +(inx), txt +.txt)) + ++ fix |=(cha/@ [%mor [%del inx] [%ins inx `@c`cha] ~]) + -- :: - ++ advance ?~(buf ~ $(len +(len), inx +(inx), txt +.txt)) - ++ newline ?~(buf ~ $(len 0, inx +(inx), txt +.txt)) - ++ fix |=(cha/@ [%mor [%del inx] [%ins inx `@c`cha] ~]) - -- - :: - ++ sh-sane :: sanitize input - ::x parses cli prompt input using ++sh-scad and sanitizes when invalid. - :: - |= {inv/sole-edit buf/(list @c)} - ^- {lit/(list sole-edit) err/(unit @u)} - =+ res=(rose (tufa buf) sh-scad) - ?: ?=($| -.res) [[inv]~ `p.res] - :_ ~ - ?~ p.res ~ - =+ wok=u.p.res - |- ^- (list sole-edit) - ?+ -.wok ~ - $target ?~(q.wok ~ $(wok u.q.wok)) - $say |- :: XX per line - ?~ p.wok ~ - ?: ?=($lin -.i.p.wok) - (sh-sane-chat buf) - $(p.wok t.p.wok) - == - :: - ++ sh-slug :: edit to sanity - ::x corrects invalid prompt input. - :: - |= {lit/(list sole-edit) err/(unit @u)} - ^+ +> - ?~ lit +> - =^ lic say.she - (~(transmit sole say.she) `sole-edit`?~(t.lit i.lit [%mor lit])) - (sh-fact [%mor [%det lic] ?~(err ~ [%err u.err]~)]) - :: - ++ sh-stir :: apply edit - ::x called when typing into the talk prompt. applies the change and does - ::x sanitizing. - :: - |= cal/sole-change - ^+ +> - =^ inv say.she (~(transceive sole say.she) cal) - =+ fix=(sh-sane inv buf.say.she) - ?~ lit.fix - +>.$ - ?~ err.fix - (sh-slug fix) :: just capital correction - ?. &(?=($del -.inv) =(+(p.inv) (lent buf.say.she))) - +>.$ :: allow interior edits, deletes - (sh-slug fix) - :: - ++ sh-lame :: send error - ::x just puts some text into the cli. - :: - |= txt/tape - (sh-fact [%txt txt]) - :: - ++ sh-whom :: current audience - ::x produces the currently selected audience for this shell. - :: - ^- audience - %- ~(gas by *audience) - %+ turn (~(tap in u.active.she)) - |=(a/partner [a *envelope %pending]) - :: - ++ sh-tell :: add command - ::x adds talk command to core state. these get applied with ++sh-abet. - :: - |= cod/command - %_(+> coz [cod coz]) - :: - ++ sh-twig-head ^- vase :: eval data - ::x makes a vase of environment data to evaluate against (#-messages). - :: - !>(`{our/@p now/@da eny/@uvI}`[our.hid now.hid (shas %eny eny.hid)]) - :: - ++ sh-work :: do work - ::x implements worker arms for different talk commands. - ::x all worker arms must produce updated state/context. - :: - |= job/work - ^+ +> - =+ roy=(~(got by stories) man.she) - =< work - |% - ++ work - ?- -.job - $number (number +.job) - $leave (leave +.job) - $join (join +.job) - $eval (eval +.job) - $who (who +.job) - $what (what +.job) - $bind (bind +.job) - $invite (invite +.job) - $banish (banish +.job) - $author (author +.job) - $block (block +.job) - $create (create +.job) - $nick (nick +.job) - $set (wo-set +.job) - $unset (unset +.job) - $target (target +.job) - $probe (probe +.job) - $help help - $say (say +.job) + ++ sh-sane :: sanitize input + ::x parses cli prompt input using ++sh-scad and sanitizes when invalid. + :: + |= {inv/sole-edit buf/(list @c)} + ^- {lit/(list sole-edit) err/(unit @u)} + =+ res=(rose (tufa buf) sh-scad) + ?: ?=($| -.res) [[inv]~ `p.res] + :_ ~ + ?~ p.res ~ + =+ wok=u.p.res + |- ^- (list sole-edit) + ?+ -.wok ~ + $target ?~(q.wok ~ $(wok u.q.wok)) + $say |- :: XX per line + ?~ p.wok ~ + ?: ?=($lin -.i.p.wok) + (sh-sane-chat buf) + $(p.wok t.p.wok) == :: - ++ activate :: from %number - |= gam/telegram - ^+ ..sh-work - =+ tay=~(. tr man.she settings.she gam) - =. ..sh-work (sh-fact tr-fact:tay) - sh-prod(active.she `tr-pals:tay) + ++ sh-slug :: edit to sanity + ::x corrects invalid prompt input. + :: + |= {lit/(list sole-edit) err/(unit @u)} + ^+ +> + ?~ lit +> + =^ lic say.she + (~(transmit sole say.she) `sole-edit`?~(t.lit i.lit [%mor lit])) + (sh-fact [%mor [%det lic] ?~(err ~ [%err u.err]~)]) :: - ++ help - (sh-fact %txt "see http://urbit.org/docs/using/messaging/") - :: - ++ glyph - |= idx/@ - =< cha - %+ reel glyphs - |= {all/tape ole/{cha/char num/@}} - =+ new=(snag (mod idx (lent all)) all) - =+ num=~(wyt in (~(get ju nak) new)) - ?~ cha.ole [new num] - ?: (lth num.ole num) - ole - [new num] - :: - ++ set-glyph - |= {cha/char lix/(set partner)} - =: nik (~(put by nik) lix cha) - nak (~(put ju nak) cha lix) - == - %_ ..sh-work - ..pa - %- (ra-know man.she) - |=(_pa pa-abet:(pa-report glyphers %glyph nak)) - == - :: - ++ join :: %join - |= pan/(set partner) - ^+ ..sh-work - =. ..sh-work - =+ (~(get by nik) pan) - ?^ - (sh-note "has glyph {}") - =+ cha=(glyph (mug pan)) - (sh-note:(set-glyph cha pan) "new glyph {}") - =+ loc=loc.system.she - ::x change local mailbox config to include subscription to pan. - %^ sh-tell %design man.she - `loc(sources (~(uni in sources.loc) pan)) - :: - ++ leave :: %leave - |= pan/(set partner) - ^+ ..sh-work - =+ loc=loc.system.she - ::x change local mailbox config to exclude subscription to pan. - %^ sh-tell %design man.she - `loc(sources (~(dif in sources.loc) pan)) - :: - ++ what :: %what - |= qur/$@(char (set partner)) ^+ ..sh-work - ?^ qur - =+ cha=(~(get by nik) qur) - (sh-fact %txt ?~(cha "none" [u.cha]~)) - =+ pan=(~(tap in (~(get ju nak) qur))) - ?: =(~ pan) (sh-fact %txt "~") - =< (sh-fact %mor (turn pan .)) - |=(a/(set partner) [%txt ]) :: XX ~(te-whom te man.she a) - :: - ++ who :: %who - |= pan/(set partner) ^+ ..sh-work - =< (sh-fact %mor (murn (sort (~(tap by q.owners.she) ~) aor) .)) - |= {pon/partner alt/atlas} ^- (unit sole-effect) - ?. |(=(~ pan) (~(has in pan) pon)) ~ - =- `[%tan rose+[", " `~]^- leaf+~(ta-full ta man.she pon) ~] - =< (murn (sort (~(tap by alt)) aor) .) - |= {a/ship b/presence c/human} ^- (unit tank) :: XX names - ?- b - $gone ~ - $hear `>a< - $talk `>a< :: XX difference - == - :: - ++ bind :: %bind - |= {cha/char pan/(unit (set partner))} ^+ ..sh-work - ?~ pan $(pan [~ u.active.she]) - =+ ole=(~(get by nik) u.pan) - ?: =(ole [~ cha]) ..sh-work - (sh-note:(set-glyph cha u.pan) "bound {} {}") - :: - ++ invite :: %invite - |= {nom/knot tal/(list partner)} - ^+ ..sh-work - !! - :: - ++ block :: %block - |= {nom/knot tal/(list partner)} - ^+ ..sh-work - !! - :: - ++ author :: %author - |= {nom/knot tal/(list partner)} - ^+ ..sh-work - !! - :: - ++ banish :: %banish - |= {nom/knot tal/(list partner)} - ^+ ..sh-work - !! - :: - ++ create :: %create - |= {por/posture nom/knot txt/cord} - ^+ ..sh-work - ?: (~(has in stories) nom) - (sh-lame "{(trip nom)}: already exists") - =. ..sh-work - ::x create new config for channel. - %^ sh-tell %design nom - :- ~ - :+ *(set partner) - (end 3 64 txt) - [por ~] - (join [[%& our.hid nom] ~ ~]) - :: - ++ reverse-folks - |= nym/knot - ^- (list ship) - %+ murn (~(tap by folks)) - |= {p/ship q/human} - ?~ hand.q ~ - ?. =(u.hand.q nym) ~ - [~ u=p] - :: - ++ nick :: %nick - |= {her/(unit ship) nym/(unit cord)} - ^+ ..sh-work - ?: ?=({$~ $~} +<) - %+ sh-fact %mor - %+ turn (~(tap by folks)) - |= {p/ship q/human} - :- %txt - ?~ hand.q - "{

}:" - "{

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

}: {}"] - %= ..sh-work - folks ?~ u.nym - (~(del by folks) u.her) - (~(put by folks) u.her [true=~ hand=nym]) - == - :: - ++ wo-set :: %set - |= seg/knot - ^+ ..sh-work - ?~ seg - %+ sh-fact %mor - %+ turn (~(tap in settings.she)) - |= s/knot - [%txt (trip s)] - %= ..sh-work - settings.she (~(put in settings.she) seg) - == - :: - ++ unset :: %unset - |= neg/knot - ^+ ..sh-work - %= ..sh-work - settings.she (~(del in settings.she) neg) - == - :: - ++ target :: %target - |= {pan/(set partner) woe/(unit ^work)} - ^+ ..sh-work - =. ..sh-pact (sh-pact pan) - ?~(woe ..sh-work work(job u.woe)) - :: - ++ number :: %number - |= num/$@(@ud {p/@u q/@ud}) - ^+ ..sh-work - =+ roy=(~(got by stories) man.she) - |- - ?@ num - ?: (gte num count.roy) - (sh-lame "{(scow %s (new:si | +(num)))}: no such telegram") - =. ..sh-fact (sh-fact %txt "? {(scow %s (new:si | +(num)))}") - (activate (snag num grams.roy)) - ?. (gth q.num count.roy) - ?~ count.roy - (sh-lame "0: no messages") - =+ msg=(deli (dec count.roy) num) - =. ..sh-fact (sh-fact %txt "? {(scow %ud msg)}") - (activate (snag (sub count.roy +(msg)) grams.roy)) - (sh-lame "…{(reap p.num '0')}{(scow %ud q.num)}: no such telegram") - :: - ++ deli :: find number - |= {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))) - :: - ++ probe :: inquire - |= cuz/station - ^+ ..sh-work - ~& [%probe cuz] - ..sh-work - :: - ++ eval :: run - |= {txt/cord exe/twig} - => |.([(sell (slap (slop sh-twig-head seed) exe))]~) - =+ tan=p:(mule .) - (say [%fat tank+tan exp+txt] ~) - :: - ++ say :: publish - |= sep/(list speech) - ^+ ..sh-work - =- ..sh-work(coz ?~(tot coz :_(coz [%publish tot]))) - |- ^- tot/(list thought) - ?~ sep ~ - =^ sir ..sh-work sh-uniq - [[sir sh-whom [now.hid ~ i.sep]] $(sep t.sep)] - -- - :: - ++ sh-done :: apply result - ::x called upon hitting return in the prompt. if input is invalid, - ::x ++sh-slug is called. otherwise, the appropriate work is done - ::x and the entered command (if any) gets displayed to the user. - :: - =+ fix=(sh-sane [%nop ~] buf.say.she) - ?^ lit.fix + ++ sh-stir :: apply edit + ::x called when typing into the talk prompt. applies the change and does + ::x sanitizing. + :: + |= cal/sole-change + ^+ +> + =^ inv say.she (~(transceive sole say.she) cal) + =+ fix=(sh-sane inv buf.say.she) + ?~ lit.fix + +>.$ + ?~ err.fix + (sh-slug fix) :: just capital correction + ?. &(?=($del -.inv) =(+(p.inv) (lent buf.say.she))) + +>.$ :: allow interior edits, deletes (sh-slug fix) - =+ jub=(rust (tufa buf.say.she) sh-scad) - ?~ jub (sh-fact %bel ~) - %. u.jub - =< sh-work - =+ buf=buf.say.she - =^ cal say.she (~(transmit sole say.she) [%set ~]) - %- sh-fact - :* %mor - [%nex ~] - [%det cal] - ?. ?=({$';' *} buf) ~ - :_ ~ - [%txt (runt [14 '-'] `tape`['|' ' ' (tufa `(list @)`buf)])] - == - :: - ++ sh-sole :: apply edit - ::x applies sole action. :: - |= act/sole-action - ^+ +> - ?- -.act - $det (sh-stir +.act) - $clr ..sh-sole :: (sh-pact ~) :: XX clear to PM-to-self? - $ret sh-done - == - :: - ++ sh-uniq - ::x generates a new serial. + ++ sh-lame :: send error + ::x just puts some text into the cli. + :: + |= txt/tape + (sh-fact [%txt txt]) :: - ^- {serial _.} - [(shaf %serial eny.hid) .(eny.hid (shax eny.hid))] + ++ sh-whom :: current audience + ::x produces the currently selected audience for this shell. + :: + ^- audience + %- ~(gas by *audience) + %+ turn (~(tap in u.active.she)) + |=(a/partner [a *envelope %pending]) + :: + ++ sh-tell :: add command + ::x adds talk command to core state. these get applied with ++sh-abet. + :: + |= cod/command + %_(+> coz [cod coz]) + :: + ++ sh-twig-head ^- vase :: eval data + ::x makes a vase of environment data to evaluate against (#-messages). + :: + !>(`{our/@p now/@da eny/@uvI}`[our.hid now.hid (shas %eny eny.hid)]) + :: + ++ sh-work :: do work + ::x implements worker arms for different talk commands. + ::x all worker arms must produce updated state/context. + :: + |= job/work + ^+ +> + =+ roy=(~(got by stories) man.she) + =< work + |% + ++ work + ?- -.job + $number (number +.job) + $leave (leave +.job) + $join (join +.job) + $eval (eval +.job) + $who (who +.job) + $what (what +.job) + $bind (bind +.job) + $invite (invite +.job) + $banish (banish +.job) + $author (author +.job) + $block (block +.job) + $create (create +.job) + $nick (nick +.job) + $set (wo-set +.job) + $unset (unset +.job) + $target (target +.job) + $probe (probe +.job) + $help help + $say (say +.job) + == + :: + ++ activate :: from %number + |= gam/telegram + ^+ ..sh-work + =+ tay=~(. tr man.she settings.she gam) + =. ..sh-work (sh-fact tr-fact:tay) + sh-prod(active.she `tr-pals:tay) + :: + ++ help + (sh-fact %txt "see http://urbit.org/docs/using/messaging/") + :: + ++ glyph + |= idx/@ + =< cha + %+ reel glyphs + |= {all/tape ole/{cha/char num/@}} + =+ new=(snag (mod idx (lent all)) all) + =+ num=~(wyt in (~(get ju nak) new)) + ?~ cha.ole [new num] + ?: (lth num.ole num) + ole + [new num] + :: + ++ set-glyph + |= {cha/char lix/(set partner)} + =: nik (~(put by nik) lix cha) + nak (~(put ju nak) cha lix) + == + %_ ..sh-work + ..pa + %- (ra-know man.she) + ::TODO send %talk-update instead. + |=(_pa pa-abet:(pa-report glyphers %glyph nak)) + == + :: + ++ join :: %join + |= pan/(set partner) + ^+ ..sh-work + =. ..sh-work + =+ (~(get by nik) pan) + ?^ - (sh-note "has glyph {}") + =+ cha=(glyph (mug pan)) + (sh-note:(set-glyph cha pan) "new glyph {}") + =+ loc=loc.system.she + ::x change local mailbox config to include subscription to pan. + %^ sh-tell %design man.she + `loc(sources (~(uni in sources.loc) pan)) + :: + ++ leave :: %leave + |= pan/(set partner) + ^+ ..sh-work + =+ loc=loc.system.she + ::x change local mailbox config to exclude subscription to pan. + %^ sh-tell %design man.she + `loc(sources (~(dif in sources.loc) pan)) + :: + ++ what :: %what + |= qur/$@(char (set partner)) ^+ ..sh-work + ?^ qur + =+ cha=(~(get by nik) qur) + (sh-fact %txt ?~(cha "none" [u.cha]~)) + =+ pan=(~(tap in (~(get ju nak) qur))) + ?: =(~ pan) (sh-fact %txt "~") + =< (sh-fact %mor (turn pan .)) + |=(a/(set partner) [%txt ]) :: XX ~(te-whom te man.she a) + :: + ++ who :: %who + |= pan/(set partner) ^+ ..sh-work + =< (sh-fact %mor (murn (sort (~(tap by q.owners.she) ~) aor) .)) + |= {pon/partner alt/atlas} ^- (unit sole-effect) + ?. |(=(~ pan) (~(has in pan) pon)) ~ + =- `[%tan rose+[", " `~]^- leaf+~(ta-full ta man.she pon) ~] + =< (murn (sort (~(tap by alt)) aor) .) + |= {a/ship b/presence c/human} ^- (unit tank) :: XX names + ?- b + $gone ~ + $hear `>a< + $talk `>a< :: XX difference + == + :: + ++ bind :: %bind + |= {cha/char pan/(unit (set partner))} ^+ ..sh-work + ?~ pan $(pan [~ u.active.she]) + =+ ole=(~(get by nik) u.pan) + ?: =(ole [~ cha]) ..sh-work + (sh-note:(set-glyph cha u.pan) "bound {} {}") + :: + ++ invite :: %invite + |= {nom/knot tal/(list partner)} + ^+ ..sh-work + !! + :: + ++ block :: %block + |= {nom/knot tal/(list partner)} + ^+ ..sh-work + !! + :: + ++ author :: %author + |= {nom/knot tal/(list partner)} + ^+ ..sh-work + !! + :: + ++ banish :: %banish + |= {nom/knot tal/(list partner)} + ^+ ..sh-work + !! + :: + ++ create :: %create + |= {por/posture nom/knot txt/cord} + ^+ ..sh-work + ?: (~(has in stories) nom) + (sh-lame "{(trip nom)}: already exists") + =. ..sh-work + ::x create new config for channel. + %^ sh-tell %design nom + :- ~ + :+ *(set partner) + (end 3 64 txt) + [por ~] + (join [[%& our.hid nom] ~ ~]) + :: + ++ reverse-folks + |= nym/knot + ^- (list ship) + %+ murn (~(tap by folks)) + |= {p/ship q/human} + ?~ hand.q ~ + ?. =(u.hand.q nym) ~ + [~ u=p] + :: + ++ nick :: %nick + |= {her/(unit ship) nym/(unit cord)} + ^+ ..sh-work + ?: ?=({$~ $~} +<) + %+ sh-fact %mor + %+ turn (~(tap by folks)) + |= {p/ship q/human} + :- %txt + ?~ hand.q + "{

}:" + "{

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

}: {}"] + %= ..sh-work + folks ?~ u.nym + (~(del by folks) u.her) + (~(put by folks) u.her [true=~ hand=nym]) + == + :: + ++ wo-set :: %set + |= seg/knot + ^+ ..sh-work + ?~ seg + %+ sh-fact %mor + %+ turn (~(tap in settings.she)) + |= s/knot + [%txt (trip s)] + %= ..sh-work + settings.she (~(put in settings.she) seg) + == + :: + ++ unset :: %unset + |= neg/knot + ^+ ..sh-work + %= ..sh-work + settings.she (~(del in settings.she) neg) + == + :: + ++ target :: %target + |= {pan/(set partner) woe/(unit ^work)} + ^+ ..sh-work + =. ..sh-pact (sh-pact pan) + ?~(woe ..sh-work work(job u.woe)) + :: + ++ number :: %number + |= num/$@(@ud {p/@u q/@ud}) + ^+ ..sh-work + =+ roy=(~(got by stories) man.she) + |- + ?@ num + ?: (gte num count.roy) + (sh-lame "{(scow %s (new:si | +(num)))}: no such telegram") + =. ..sh-fact (sh-fact %txt "? {(scow %s (new:si | +(num)))}") + (activate (snag num grams.roy)) + ?. (gth q.num count.roy) + ?~ count.roy + (sh-lame "0: no messages") + =+ msg=(deli (dec count.roy) num) + =. ..sh-fact (sh-fact %txt "? {(scow %ud msg)}") + (activate (snag (sub count.roy +(msg)) grams.roy)) + (sh-lame "…{(reap p.num '0')}{(scow %ud q.num)}: no such telegram") + :: + ++ deli :: find number + |= {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))) + :: + ++ probe :: inquire + |= cuz/station + ^+ ..sh-work + ~& [%probe cuz] + ..sh-work + :: + ++ eval :: run + |= {txt/cord exe/twig} + => |.([(sell (slap (slop sh-twig-head seed) exe))]~) + =+ tan=p:(mule .) + (say [%fat tank+tan exp+txt] ~) + :: + ++ say :: publish + |= sep/(list speech) + ^+ ..sh-work + =- ..sh-work(coz ?~(tot coz :_(coz [%publish tot]))) + |- ^- tot/(list thought) + ?~ sep ~ + =^ sir ..sh-work sh-uniq + [[sir sh-whom [now.hid ~ i.sep]] $(sep t.sep)] + -- + :: + ++ sh-done :: apply result + ::x called upon hitting return in the prompt. if input is invalid, + ::x ++sh-slug is called. otherwise, the appropriate work is done + ::x 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-scad) + ?~ jub (sh-fact %bel ~) + %. u.jub + =< sh-work + =+ buf=buf.say.she + =^ cal say.she (~(transmit sole say.she) [%set ~]) + %- sh-fact + :* %mor + [%nex ~] + [%det cal] + ?. ?=({$';' *} buf) ~ + :_ ~ + [%txt (runt [14 '-'] `tape`['|' ' ' (tufa `(list @)`buf)])] + == + :: + ++ sh-sole :: apply edit + ::x applies sole action. + :: + |= act/sole-action + ^+ +> + ?- -.act + $det (sh-stir +.act) + $clr ..sh-sole :: (sh-pact ~) :: XX clear to PM-to-self? + $ret sh-done + == + :: + ++ sh-uniq + ::x generates a new serial. + :: + ^- {serial _.} + [(shaf %serial eny.hid) .(eny.hid (shax eny.hid))] + -- -- :: ++ sn :: station render core @@ -1246,7 +1490,7 @@ :: ::x man: mailbox. ::x one: the station. - |_ {man/knot one/station} + |_ {man/knot one/station} ++ sn-best :: best to show ::x returns true if one is better to show, false otherwise. ::x prioritizes: our > main > size. @@ -1347,6 +1591,21 @@ :: |=(two/partner ?:((ta-beat two) two one)) :: + ++ ta-sigh :: assemble label + ::x prepend pre to yiz, omitting characters of yiz to stay within len. + :: + |= {len/@ud pre/tape yiz/cord} + ^- tape + =+ nez=(trip yiz) + =+ lez=(lent nez) + ?> (gth len (lent pre)) + =. len (sub len (lent pre)) + ?. (gth lez len) + =. nez (welp pre nez) + ?. (lth lez len) nez + (runt [(sub len lez) '-'] nez) + :(welp pre (scag (dec len) nez) "+") + :: ++ ta-full (ta-show ~) :: render full width ++ ta-show :: render partner ::x renders a partner as text. @@ -1371,7 +1630,7 @@ ?~ moy (weld pre (trip p.p.one)) =. pre ?.(=(& u.moy) pre ['*' pre]) - (sigh 14 pre p.p.one) + (ta-sigh 14 pre p.p.one) == -- :: @@ -1622,6 +1881,48 @@ (tr-chow 64 "[{(trip id.sep)}@{(trip service.sep)}]: {(trip summary.sep)}") == -- -::TODO ++ poke-sole-action -::TODO ++ diff-talk-report --- \ No newline at end of file +:: +::TODO move to lib. +++ etch-friend :: + ::x parse a /friend wire, call gate with resulting data. + :: + |= {way/wire fun/$-({man/knot cuz/station} {(list move) _.})} + =+ wer=(etch way) + ?>(?=($friend -.wer) (fun p.wer q.wer)) +:: +++ diff-talk-report :: accept report + ::x incoming talk-report. process it. + :: + |= {way/wire rad/report} + ^- (quip move +>) + %+ etch-friend way |= {man/knot cuz/station} + ra-abet:(ra-diff-talk-report:ra man cuz rad) +:: +++ diff-talk-lowdown + ::x incoming talk-lowdown. process it. + :: + ::TODO would it be tidier to put this into ++ra? + |= {way/wire low/lowdown} + ^- (quip move +>) + :- ~ + ?- -.low + $glyph + %_ +> + nak +.rad + nik %- ~(gas by *(map (set partner) char)) + =- (zing `(list (list {(set partner) char}))`-) + %+ turn (~(tap by +.rad)) + |= {a/char b/(set (set partner))} + (turn (~(tap by b)) |=(c/(set partner) [c a])) + == + ::TODO sh-prod each shell? + $names + +>(folks (~(uni by +.rad) folks)) +:: +++ poke-sole-action :: accept console + ::x incoming sole action. process it. + :: + |= act/sole-action + ra-abet:(ra-sole:ra act) +:: +-- diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 42b3280e0a..3e3304daf3 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -53,6 +53,7 @@ ++ move (pair bone card) :: all actions ++ lime :: diff fruit $% {$talk-report report} :: + {$talk-lowdown lowdown} :: {$sole-effect sole-effect} :: == :: ++ pear :: poke fruit @@ -72,43 +73,6 @@ $% {$repeat p/@ud q/@p r/knot} :: {$friend p/knot q/station} :: == :: - ++ work :: interface action - $% {$number p/$@(@ud {@u @ud})} :: relative/absolute - {$help $~} :: print usage info - {$who p/where} :: presence - {$what p/$@(char (set partner))} :: show bound glyph - {$bind p/char q/(unit where)} :: - {$join p/where} :: - {$leave p/where} :: - {$say p/(list speech)} :: - {$eval p/cord q/twig} :: - {$invite p/knot q/(list partner)} :: whitelist add - {$banish p/knot q/(list partner)} :: blacklist add - {$block p/knot q/(list partner)} :: blacklist add - {$author p/knot q/(list partner)} :: whitelist add - {$nick p/(unit ship) q/(unit cord)} :: - {$set p/knot} :: - {$unset p/knot} :: - {$target p/where q/(unit work)} :: set active targets - :: {$destroy p/knot} :: - {$create p/posture q/knot r/cord} :: - {$probe p/station} :: - == :: - ++ where (set partner) :: non-empty audience - ++ sigh :: assemble label - ::TODO move to ++ta. - :: - |= {len/@ud pre/tape yiz/cord} - ^- tape - =+ nez=(trip yiz) - =+ lez=(lent nez) - ?> (gth len (lent pre)) - =. len (sub len (lent pre)) - ?. (gth lez len) - =. nez (welp pre nez) - ?. (lth lez len) nez - (runt [(sub len lez) '-'] nez) - :(welp pre (scag (dec len) nez) "+") ++ glyphs `wall`~[">=+-" "}),." "\"'`^" "$%&@"] :: station char pool' ++ peer-type :: stream requests ::x helper functions for determining/specifying from/in a path, what kind @@ -355,6 +319,52 @@ (ra-think & her +.cod) == :: + ++ ra-update + ::x applies update sent by her. + :: + |= {her/ship dup/update} + ^+ +> + ::x only allow updates by our team. + ?. (team our.hid her) +> + ?- -.dup + $status ::x update our status. + ::x for every knot (story) in the set, update our status. + |- ^+ +> ::TODO maybe +>.^$ + ?~ p.dup +> + =. +> $(p.dup l.p.dup) + =. +> $(p.dup r.p.dup) + ::x uses our because status is per identity, not per client. + pa-abet:(~(pa-notify n.p.dup story) our q.dup) + :: + $human ::x change an identity. + =+ who=(~(get by folks) her) + ?. ?|(?=($~ who) !.=(who q.dup)) ::TODO? != won't work, right? + +>.$ ::x no change. + =. folks (~(put by folks) her q.dup) + ::TODO make arm for sending lowdowns to readers, which takes lowdowns + :: and sends to all readers. + %- ra-emil ::TODO? order doesn't matter here, right? + =/ cad/card + :^ %diff %talk-lowdown %names + (~(put by *(map ship human)) her q.dup) + %- ~(rep in general) + |= {b/bone l/(list move)} + [[b cad] l] + ::TODO eventually squash multiple %names reports for same bone into one. + :: + $bind ::x set glyph binding. + ::TODO maybe %- %= ra-emil ? + =: nik (~(put by nik) q.dup p.dup) + nak (~(put ju nak) p.dup q.dup) + == + ::TODO see above + %- ra-emil + =/ cad/card [%diff %talk-lowdown %glyph nak] + %- ~(rep in glyphers) + |= {b/bone l/(list move)} + [[b cad] l] + == + :: ++ ra-config :: configure story ::x (re)configures story man. if it's a new story, emit our stories. :: @@ -1095,6 +1105,12 @@ =^ mow +>.$ log-all-to-file [(welp mos mow) +>.$] :: +++ poke-talk-update :: accept update + ::x incoming talk update. process it. + :: + |= dup/update + ra-abet:(ra-update src.hid dup) +:: ++ poke-sole-action :: accept console ::x incoming sole action. process it. :: diff --git a/sur/talk.hoon b/sur/talk.hoon index 83e4b63d3b..90beb12a56 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -9,11 +9,10 @@ $% {$design (pair knot (unit config))} :: configure+destroy {$publish (list thought)} :: originate {$review (list thought)} :: deliver - {$update update} :: change shared state == :: -++ update ::x these may need work +++ update :: change shared state $% {$status (pair (set knot) status) :: our status update - {$human (map ship human)} :: new identity + {$human (pair ship human)} :: new identity {$bind (pair char (set partner))} :: bind a glyph == :: ++ cabal :: metaconfiguration @@ -57,7 +56,9 @@ {$grams (pair @ud (list telegram))} :: beginning thoughts {$group register} :: presence {$house shelf} :: station set - {$glyph (jug char (set partner))} :: relevant binding + == :: +++ lowdown :: changed shared state + $% {$glyph (jug char (set partner))} :: new bindings {$names (map ship human)} :: new identities == :: ++ speech :: narrative action From 073990055f958704c029aad674add5cb440bd051 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 24 Mar 2017 21:30:20 +0100 Subject: [PATCH 006/303] Better talk-lowdown move creation. --- app/talk-guardian.hoon | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 3e3304daf3..5bc830385d 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -319,6 +319,15 @@ (ra-think & her +.cod) == :: + ++ ra-inform ::x new lowdown + ::x send talk-lowdown to all readers. + :: + |= low/lowdown + %- ra-emil + %- ~(rep in general) + |= {b/bone l/(list move)} + [[b %diff %talk-lowdown low] l] + :: ++ ra-update ::x applies update sent by her. :: @@ -341,28 +350,15 @@ ?. ?|(?=($~ who) !.=(who q.dup)) ::TODO? != won't work, right? +>.$ ::x no change. =. folks (~(put by folks) her q.dup) - ::TODO make arm for sending lowdowns to readers, which takes lowdowns - :: and sends to all readers. - %- ra-emil ::TODO? order doesn't matter here, right? - =/ cad/card - :^ %diff %talk-lowdown %names - (~(put by *(map ship human)) her q.dup) - %- ~(rep in general) - |= {b/bone l/(list move)} - [[b cad] l] - ::TODO eventually squash multiple %names reports for same bone into one. + %+ ra-inform %names + (~(put by *(map ship human)) her q.dup) :: $bind ::x set glyph binding. - ::TODO maybe %- %= ra-emil ? - =: nik (~(put by nik) q.dup p.dup) - nak (~(put ju nak) p.dup q.dup) + %. [%glyph nak] + %= ra-inform + nik (~(put by nik) q.dup p.dup) + nak (~(put ju nak) p.dup q.dup) == - ::TODO see above - %- ra-emil - =/ cad/card [%diff %talk-lowdown %glyph nak] - %- ~(rep in glyphers) - |= {b/bone l/(list move)} - [[b cad] l] == :: ++ ra-config :: configure story From cf346ddcf59d47c54befb897387d8e245bce8203 Mon Sep 17 00:00:00 2001 From: Fang Date: Sat, 25 Mar 2017 00:24:55 +0100 Subject: [PATCH 007/303] Changed update and lowdown of identities to allow for deletion. --- app/talk-agent.hoon | 29 ++++++++++++++++++++++------- app/talk-guardian.hoon | 11 ++++++----- sur/talk.hoon | 4 ++-- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index e6bd7e01a1..b039882338 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -489,6 +489,14 @@ ^+ +> +>(moves :_(moves [ost.hid %diff %sole-effect fec])) :: + ++ sh-update + ::x adds a talk-update to ++ra's moves + :: + |= dup/update + ^+ +> + ::TODO is ost.hid okay here? or do we want to store bone of broker? + +>(moves :_(moves [ost.hid %diff %talk-update dup])) + :: ++ sh-peep :: peer to path ::TODO remove. :: @@ -1241,10 +1249,7 @@ nak (~(put ju nak) cha lix) == %_ ..sh-work - ..pa - %- (ra-know man.she) - ::TODO send %talk-update instead. - |=(_pa pa-abet:(pa-report glyphers %glyph nak)) + (sh-update %glyph cha lix) == :: ++ join :: %join @@ -1367,8 +1372,9 @@ [%txt "{

}: {}"] %= ..sh-work folks ?~ u.nym - (~(del by folks) u.her) - (~(put by folks) u.her [true=~ hand=nym]) + (~(del by folks) u.her) ::x unset nickname + (~(put by folks) u.her [true=~ hand=nym]) ::x set nickname + ..sh-work (sh-update %human [true=~ hand=nym]) == :: ++ wo-set :: %set @@ -1917,7 +1923,16 @@ == ::TODO sh-prod each shell? $names - +>(folks (~(uni by +.rad) folks)) + %= +> + folks %- ~(gas by *(map ship human)) + %+ murn + %~ tap by + %- ~(uni by +.rad) + (~(run by folks) some) + |= {s/ship h/(unit human)} + ?~ h ~ + [s u.h] + == :: ++ poke-sole-action :: accept console ::x incoming sole action. process it. diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 5bc830385d..ebe1c2a4e5 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -346,12 +346,13 @@ pa-abet:(~(pa-notify n.p.dup story) our q.dup) :: $human ::x change an identity. - =+ who=(~(get by folks) her) - ?. ?|(?=($~ who) !.=(who q.dup)) ::TODO? != won't work, right? - +>.$ ::x no change. - =. folks (~(put by folks) her q.dup) + ?. =((~(get by folks) her) q.dup) + +> ::x no change. + =. folks + ?~ hand.q.dup (~(del by folks) p.dup) + (~(put by folks) her u.q.dup) %+ ra-inform %names - (~(put by *(map ship human)) her q.dup) + (~(put by *(map ship (unit human))) her q.dup) :: $bind ::x set glyph binding. %. [%glyph nak] diff --git a/sur/talk.hoon b/sur/talk.hoon index 90beb12a56..e9e95dd389 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -12,7 +12,7 @@ == :: ++ update :: change shared state $% {$status (pair (set knot) status) :: our status update - {$human (pair ship human)} :: new identity + {$human (pair ship (unit human))} :: new identity {$bind (pair char (set partner))} :: bind a glyph == :: ++ cabal :: metaconfiguration @@ -59,7 +59,7 @@ == :: ++ lowdown :: changed shared state $% {$glyph (jug char (set partner))} :: new bindings - {$names (map ship human)} :: new identities + {$names (map ship (unit human))} :: new identities == :: ++ speech :: narrative action $% {$lan p/knot q/@t} :: local announce From c27d9fcf8dfb8fb67691ca09b095250d02898ce4 Mon Sep 17 00:00:00 2001 From: Fang Date: Sat, 25 Mar 2017 00:54:56 +0100 Subject: [PATCH 008/303] Merged subscription groups into one. --- app/talk-agent.hoon | 5 +- app/talk-guardian.hoon | 148 +++++++++++++---------------------------- 2 files changed, 47 insertions(+), 106 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index b039882338..7a1e8afc76 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -510,11 +510,8 @@ =< sh-prod %_ . +> - =/ typ - =+ (ly ~[%a-group %f-grams %x-cabal]) - (rap 3 (turn - encode:peer-type)) ::x subscriptions to the shell's ship's default channels. - (ra-subscribe:(ra-subscribe her.she ~) her.she [typ man.she ~]) + (ra-subscribe:(ra-subscribe her.she ~) her.she [man.she ~]) == :: ++ sh-prod :: show prompt diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index ebe1c2a4e5..57590d5479 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -40,10 +40,7 @@ sequence/(map partner @ud) :: partners heard shape/config :: configuration known/(map serial @ud) :: messages heard - gramsers/(map bone river) :: message followers - groupers/(set bone) :: presence followers - cabalers/(set bone) :: config followers - glyphers/(set bone) :: glyph followers + followers/(map bone river) :: subscribers == :: ++ river (pair point point) :: stream definition ++ point :: stream endpoint @@ -74,23 +71,6 @@ {$friend p/knot q/station} :: == :: ++ glyphs `wall`~[">=+-" "}),." "\"'`^" "$%&@"] :: station char pool' - ++ peer-type :: stream requests - ::x helper functions for determining/specifying from/in a path, what kind - ::x of subscription our peer wants/what they're interested in. - :: - =< apex - |% - ++ apex ?($a-group $f-grams $v-glyph $x-cabal) :: options - ++ encode |=(a/apex ^-(char (end 3 1 a))) :: by first char - ++ decode :: discriminate - |= a/char ^- apex - ?+ a ~|(bad-subscription-designator+a !!) - $a %a-group - $f %f-grams - $v %v-glyph - $x %x-cabal - == - -- -- |% :: old protocol workaround door @@ -577,23 +557,22 @@ ::x empty path, meta-subscribe and send report with all our stories. ?: ?=($~ pax) (ra-house(general (~(put in general) ost.hid)) ost.hid) - ?. ?=({@ @ *} pax) + ?. ?=({@ *} pax) (ra-evil %talk-bad-path) - =+ vab=(~(gas in *(set peer-type)) (turn (rip 3 i.pax) decode:peer-type)) - =+ pur=(~(get by stories) i.t.pax) + =+ pur=(~(get by stories) i.pax) ?~ pur - ~& [%bad-subscribe-story-c i.t.pax] + ~& [%bad-subscribe-story-c i.pax] (ra-evil %talk-no-story) - =+ soy=~(. pa i.t.pax u.pur) - ::x check her read permissions. + =+ soy=~(. pa i.pax u.pur) + ::x she needs read permissions to subscribe. ?. (pa-visible:soy her) (ra-evil %talk-no-story) - =^ who +>.$ (ra-human her) - ::x for each stream type she is interested in, add her to the followers. - =. soy ?.((~(has in vab) %a-group) soy (pa-watch-group:soy her)) - =. soy ?.((~(has in vab) %v-glyph) soy (pa-watch-glyph:soy her)) - =. soy ?.((~(has in vab) %x-cabal) soy (pa-watch-cabal:soy her)) - =. soy ?.((~(has in vab) %f-grams) soy (pa-watch-grams:soy her t.t.pax)) + ::TODO? or (pa-sauce ost.hid [%quit ~]~) ? + =^ who +>.$ (ra-human her) ::TODO? can we safely move this down? + ::x send current data to bring her up to date. + =. soy (pa-report-group:soy ost.hid ~ ~) + =. soy (pa-report-cabal:soy ost.hid ~ ~) + =. soy (pa-first-grams:soy her t.pax) ::x add her status to presence map. =. soy (pa-notify:soy her %hear who) ::x apply changes to story. @@ -695,6 +674,12 @@ ^+ +> +>(stories (~(put by stories) man `story`+<+)) :: + ++ pa-followers + ^- (set bone) + %- ~(gas in *(set bone)) + %+ turn (~(tap by followers)) + |= {b/bone *} b + :: ++ pa-admire :: accept from ::x should be checking her write permissions, but defaults to allowed. ::x commented code seems to use an older control structure. @@ -732,39 +717,6 @@ :: ~& [%pa-report-cabal man shape] (pa-sauce n.wac [%diff %talk-report caw]~) :: - ++ pa-watch-group :: subscribe presence - ::x if she may, add her bone to presence followers and send her a group - ::x (presence) report. - :: - |= her/ship - ?. (pa-admire her) - (pa-sauce ost.hid [%quit ~]~) - =. groupers (~(put in groupers) ost.hid) - (pa-report-group ost.hid ~ ~) - :: - ++ pa-watch-cabal :: subscribe config - ::x if she may, add her bone to config followers and send her an updated - ::x cabal (config) report. - :: - |= her/ship - ?. (pa-admire her) - ~& [%pa-admire-not her] - (pa-sauce ost.hid [%quit ~]~) - =. cabalers (~(put in cabalers) ost.hid) - :: ~& [%pa-watch-cabal her man shape] - (pa-sauce ost.hid [[%diff %talk-report %cabal shape mirrors] ~]) - :: - ++ pa-watch-glyph :: subscribe config - ::x if she may, add her bone to glyph followers and send an updated glyph - ::x report. - :: - |= her/ship - ?. (pa-admire her) - ~& [%pa-admire-not her] - (pa-sauce ost.hid [%quit ~]~) - =. glyphers (~(put in glyphers) ost.hid) - (pa-report [ost.hid ~ ~] %glyph nak) - :: ++ pa-report-group :: update presence ::x build a group report, containing our different presence maps, and ::x send it to all bones. @@ -783,10 +735,10 @@ |=({@ a/status} a) :: ++ pa-report-cabal :: update config - ::x a cabal report, containing our and remote configs, to all config - ::x followers. + ::x a cabal report, containing our and remote configs, to all bones. :: - (pa-report cabalers %cabal shape mirrors) + |= vew/(set bone) + (pa-report vew %cabal shape mirrors) :: ++ pa-cabal ::x add station's config to our remote config map. @@ -866,17 +818,14 @@ ::x subscribe starting at the last message we read, ::x or if we haven't read any yet, messages from up to a day ago. =+ ini=?^(num (scot %ud u.num) (scot %da old)) - =/ typ - =+ (ly ~[%a-group %f-grams %x-cabal]) - (rap 3 (turn - encode:peer-type)) ?- -.tay $| !! $& :: ~& [%pa-acquire [our.hid man] [p.p.tay q.p.tay]] :_ ~ :* %peer /friend/show/[man]/(scot %p p.p.tay)/[q.p.tay] - [p.p.tay %talk] - /[typ]/[q.p.tay]/[ini] + [p.p.tay %talk] + /[q.p.tay]/[ini] == == :: @@ -899,12 +848,7 @@ ::x deletes the current ost.hid from all follower groups. :: :: ~& [%pa-cancel ost.hid] - %_ . - gramsers (~(del by gramsers) ost.hid) - groupers (~(del in groupers) ost.hid) - glyphers (~(del in glyphers) ost.hid) - cabalers (~(del in cabalers) ost.hid) - == + .(followers (~(del by followers) ost.hid)) :: ++ pa-notify :: local presence ::x add her status to our presence map. if this changes it, send report. @@ -913,7 +857,7 @@ ^+ +> =/ nol (~(put by locals) her now.hid saz) ?: =(nol locals) +>.$ - (pa-report-group(locals nol) groupers) + (pa-report-group(locals nol) pa-followers) :: ++ pa-remind :: remote presence ::x adds tay's loc to our remote presence map, after merging with rem. @@ -925,7 +869,7 @@ =/ buk (~(uni timed remotes) rem) :: XX drop? =. buk (~(put timed buk) tay now.hid loc) ?: =(~(strip timed buk) ~(strip timed remotes)) +>.$ - (pa-report-group(remotes buk) groupers) + (pa-report-group(remotes buk) pa-followers) :: ++ pa-start :: start stream ::x grab all telegrams that fall within the river and send them in a @@ -939,7 +883,7 @@ (pa-sauce ost.hid [[%diff %talk-report %grams q.lab r.lab] ~]) ?: p.lab ::x? dun never gets changed, so always | ? (pa-sauce ost.hid [[%quit ~] ~]) - +>.$(gramsers (~(put by gramsers) ost.hid riv)) + +>.$(followers (~(put by followers) ost.hid riv)) ^= lab =+ [end=count gaz=grams dun=| zeg=*(list telegram)] |- ^- (trel ? @ud (list telegram)) @@ -959,14 +903,14 @@ ::x if we're in the river, add this gram and continue. $(end (dec end), gaz t.gaz, zeg [i.gaz zeg]) :: - ++ pa-watch-grams :: subscribe messages + ++ pa-first-grams :: subscribe messages ::x (called upon subscribe) send backlog of grams to her. ::x deduces which messages to send from pax. :: |= {her/ship pax/path} ^+ +> ?. (pa-admire her) - ~& [%pa-watch-grams-admire ~] + ~& [%pa-first-grams-admire ~] (pa-sauce ost.hid [%quit ~]~) ::x find the range of grams to send. =+ ^= ruv ^- (unit river) @@ -980,42 +924,42 @@ ?. ?=({{?($ud $da) @} {?($ud $da) @} $~} paf) ~ `[[?+(- . $ud .)]:i.paf [?+(- . $ud .)]:i.t.paf] ::XX arvo issue #366 - :: ~& [%pa-watch-grams her pax ruv] + :: ~& [%pa-first-grams her pax ruv] ?~ ruv - ~& [%pa-watch-grams-malformed pax] + ~& [%pa-first-grams-malformed pax] (pa-sauce ost.hid [%quit ~]~) (pa-start u.ruv) :: ++ pa-refresh :: update to listeners ::x called when grams get added or changed. calculates the changes and - ::x sends them to all message followers. if we run into any followers - ::x that are no longer interested in this story, remove them. + ::x sends them to all followers. if we run into any followers that are + ::x no longer interested in this story, remove them. :: |= {num/@ud gam/telegram} ^+ +> =+ ^= moy |- ^- (pair (list bone) (list move)) - ?~ gramsers [~ ~] - :: ~& [%pa-refresh num n.gramsers] - =+ lef=$(gramsers l.gramsers) - =+ rit=$(gramsers r.gramsers) + ?~ followers [~ ~] + :: ~& [%pa-refresh num n.followers] + =+ lef=$(followers l.followers) + =+ rit=$(followers r.followers) =+ old=[p=(welp p.lef p.rit) q=(welp q.lef q.rit)] - ?: ?- -.q.q.n.gramsers :: after the end - $ud (lte p.q.q.n.gramsers num) - $da (lte p.q.q.n.gramsers p.r.q.gam) + ?: ?- -.q.q.n.followers :: after the end + $ud (lte p.q.q.n.followers num) + $da (lte p.q.q.n.followers p.r.q.gam) == - [[p.n.gramsers p.old] [[p.n.gramsers %quit ~] q.old]] - ?: ?- -.p.q.n.gramsers :: before the start - $ud (gth p.p.q.n.gramsers num) - $da (gth p.p.q.n.gramsers p.r.q.gam) + [[p.n.followers p.old] [[p.n.followers %quit ~] q.old]] + ?: ?- -.p.q.n.followers :: before the start + $ud (gth p.p.q.n.followers num) + $da (gth p.p.q.n.followers p.r.q.gam) == old :- p.old - [[p.n.gramsers %diff %talk-report %grams num gam ~] q.old] + [[p.n.followers %diff %talk-report %grams num gam ~] q.old] =. moves (welp q.moy moves) |- ^+ +>.^$ ?~ p.moy +>.^$ - $(p.moy t.p.moy, gramsers (~(del by gramsers) i.p.moy)) + $(p.moy t.p.moy, followers (~(del by followers) i.p.moy)) :: ++ pa-lesson :: learn multiple ::x learn all telegrams in a list. From a2d2633776e50d8c1a8c90cb4b3356228babb4e9 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 27 Mar 2017 11:26:23 +0200 Subject: [PATCH 009/303] Fixed syntax errors. --- app/talk-agent.hoon | 4 +++- sur/talk.hoon | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 7a1e8afc76..5ff381153a 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -1246,7 +1246,7 @@ nak (~(put ju nak) cha lix) == %_ ..sh-work - (sh-update %glyph cha lix) + ..sh (sh-update %bind cha lix) == :: ++ join :: %join @@ -1926,10 +1926,12 @@ %~ tap by %- ~(uni by +.rad) (~(run by folks) some) + == |= {s/ship h/(unit human)} ?~ h ~ [s u.h] == + == :: ++ poke-sole-action :: accept console ::x incoming sole action. process it. diff --git a/sur/talk.hoon b/sur/talk.hoon index e9e95dd389..53d41a8fe2 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -11,7 +11,7 @@ {$review (list thought)} :: deliver == :: ++ update :: change shared state - $% {$status (pair (set knot) status) :: our status update + $% {$status (pair (set knot) status)} :: our status update {$human (pair ship (unit human))} :: new identity {$bind (pair char (set partner))} :: bind a glyph == :: From 2873ab49f59e752bf11c97d59c3564fbb967d8a1 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 27 Mar 2017 12:50:39 +0200 Subject: [PATCH 010/303] Changed update $human. --- app/talk-agent.hoon | 4 ++-- app/talk-guardian.hoon | 6 ++++-- sur/talk.hoon | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 5ff381153a..34309b263c 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -1367,11 +1367,11 @@ %+ turn (reverse-folks u.nym) |= p/ship [%txt "{

}: {}"] - %= ..sh-work + %. [%human u.her [true=~ hand=nym]] + %= sh-update folks ?~ u.nym (~(del by folks) u.her) ::x unset nickname (~(put by folks) u.her [true=~ hand=nym]) ::x set nickname - ..sh-work (sh-update %human [true=~ hand=nym]) == :: ++ wo-set :: %set diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 57590d5479..0e9d908181 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -330,9 +330,11 @@ +> ::x no change. =. folks ?~ hand.q.dup (~(del by folks) p.dup) - (~(put by folks) her u.q.dup) + (~(put by folks) her q.dup) %+ ra-inform %names - (~(put by *(map ship (unit human))) her q.dup) + ::TODO think long and hard, do we need unit for delition or is a human + :: with [~ ~] good enough? if the latter, agent's $names will change. + (~(put by *(map ship (unit human))) her ?~(hand.q.dup ~ q.dup)) :: $bind ::x set glyph binding. %. [%glyph nak] diff --git a/sur/talk.hoon b/sur/talk.hoon index 53d41a8fe2..169a860b5c 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -12,7 +12,7 @@ == :: ++ update :: change shared state $% {$status (pair (set knot) status)} :: our status update - {$human (pair ship (unit human))} :: new identity + {$human (pair ship human)} :: new identity {$bind (pair char (set partner))} :: bind a glyph == :: ++ cabal :: metaconfiguration From 394566869bba230e87c92b03a64b9e22d3ba11eb Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 27 Mar 2017 12:52:30 +0200 Subject: [PATCH 011/303] Shell's audience no longer a unit. --- app/talk-agent.hoon | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 34309b263c..7374b6f152 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -28,7 +28,7 @@ man/knot :: mailbox count/@ud :: messages shown say/sole-share :: console state - active/(unit (set partner)) :: active targets + active/(set partner) :: active targets owners/register :: presence mirror harbor/(map knot (pair posture cord)) :: stations mirror system/cabal :: config mirror @@ -522,7 +522,7 @@ :+ & %talk-line ^- tape =/ rew/(pair (pair @t @t) (set partner)) - [['[' ']'] u.active.she] + [['[' ']'] active.she] =+ cha=(~(get by nik) q.rew) ?^ cha ~[u.cha ' '] :: ~& [rew nik nak] @@ -536,8 +536,8 @@ ^+ +> =+ act=(sh-pare lix) ::x ensure we can see what we send. ?~ act ~|(%no-audience !!) ::TODO can't happen, remove. - ?: =(active.she `act) +>.$ - sh-prod(active.she `act) + ?: =(active.she act) +>.$ + sh-prod(active.she act) :: ++ sh-pare :: adjust target list ::x if the audience paz does not contain a partner we're subscribed to, @@ -1172,7 +1172,7 @@ :: ^- audience %- ~(gas by *audience) - %+ turn (~(tap in u.active.she)) + %+ turn (~(tap in active.she)) |=(a/partner [a *envelope %pending]) :: ++ sh-tell :: add command @@ -1223,7 +1223,7 @@ ^+ ..sh-work =+ tay=~(. tr man.she settings.she gam) =. ..sh-work (sh-fact tr-fact:tay) - sh-prod(active.she `tr-pals:tay) + sh-prod(active.she tr-pals:tay) :: ++ help (sh-fact %txt "see http://urbit.org/docs/using/messaging/") @@ -1296,7 +1296,7 @@ :: ++ bind :: %bind |= {cha/char pan/(unit (set partner))} ^+ ..sh-work - ?~ pan $(pan [~ u.active.she]) + ?~ pan $(pan `active.she) =+ ole=(~(get by nik) u.pan) ?: =(ole [~ cha]) ..sh-work (sh-note:(set-glyph cha u.pan) "bound {} {}") From e53cedd10d8b76369677bdae3d399101b9c3a105 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 27 Mar 2017 14:52:53 +0200 Subject: [PATCH 012/303] Agent now actually sends talk command to the guardian. --- app/talk-agent.hoon | 79 +++++++++++++++++++++++++++------------------ 1 file changed, 47 insertions(+), 32 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 7374b6f152..f0f029591d 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -69,7 +69,12 @@ == :: ++ where (set partner) :: non-empty audience ++ glyphs `wall`~[">=+-" "}),." "\"'`^" "$%&@"] :: station char pool' - + ++ broker :: broker ship and name + |= our/ship + :_ %talk-guardian + ?. =((clan our) %earl) + our + (sein our) -- :: |_ {hid/bowl chattel} @@ -142,6 +147,13 @@ =+ bak=(ra-back(ost.hid p.i.q.rey) q.i.q.rey) $(q.rey t.q.rey, +> bak(ost.hid ost.hid)) :: + ++ ra-back + ::x applies report. + :: + |= rad/report + ^+ +> + sh-abet:(~(sh-repo sh ~ (~(got by shells) ost.hid)) rad) + :: ++ ra-diff-talk-report :: subscription update ::x process a talk report from cuz into story man. :: @@ -151,7 +163,18 @@ =+ tal=(~(get by tales) man) ?~ tal ~&([%know-no-tale man] !!) pa-abet:(~(pa-diff-talk-report pa man u.tal) cuz rad) - + :: + ++ ra-emil :: ra-emit move list + ::x adds multiple moves to the core's list. flops to emulate ++ra-emit. + :: + |= mol/(list move) + %_(+> moves (welp (flop mol) moves)) + :: + ++ ra-emit :: emit a move + ::x adds a move to the core's list. + :: + |= mov/move + %_(+> moves [mov moves]) :: ++ ra-sole ::x applies sole-action. @@ -452,35 +475,18 @@ ::x [coz new]). produces an updated context for the ++sh core. :: ^+ +> ::x points to ++sh's |_ core's context. - =+ zoc=(flop coz) - |- ^+ +>+> ::x +> would point to |-'s context. +>+> goes to ++sh |_'s. - ::x produce context with this shell updated. - ?~ zoc +>+>.$(shells (~(put by shells) ost.hid she)) - ::x recurse, with context (of |-?) modified. - $(zoc t.zoc, +>.$ (sh-deal i.zoc)) - :: - ++ sh-deal :: apply from shell - ::x used by ++sh-abet, applies an individual talk command. - :: - |= cod/command - ^+ +> - ?- -.cod - ::x the $design command is used for modifying channel configs, - ::x which is done when joining, leaving or creating channels. - $design - ?~ q.cod - ::x updates context with new config state. - =. +>+>.$ (ra-config p.cod *config) - ::x produces context with story p.cod deleted. - +>.$(stories (~(del by stories) p.cod)) - ::x produces +> with its +> (so, +>+>) updated by ++ra-think. - +>(+> (ra-config p.cod u.q.cod)) - :: - ::x used for relaying messages (as a station host). - $review +>(+> (ra-think | her.she +.cod)) - ::x used for sending messages (as their author). - $publish +>(+> (ra-think & her.she +.cod)) - == + %. ^- (list move) + %- flop + %+ turn coz + |= c/command + ^- move + :* ost.hid + %poke + /reader/command + (broker our.hid) + [%talk-command c] + == + ra-emil(shells (~(put by shells) ost.hid she)) :: ++ sh-fact :: send console effect ::x adds a console effect to ++ra's moves. @@ -495,7 +501,16 @@ |= dup/update ^+ +> ::TODO is ost.hid okay here? or do we want to store bone of broker? - +>(moves :_(moves [ost.hid %diff %talk-update dup])) + ~& [%update-to ost.hid] + %= +> + moves :_ moves + :* ost.hid + %poke + /reader/update + (broker our.hid) + [%talk-update dup] + == + == :: ++ sh-peep :: peer to path ::TODO remove. From 36d02bfc42abb30a420b119291518b512744a94c Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 27 Mar 2017 15:27:08 +0200 Subject: [PATCH 013/303] Numerous small changes and fixes to get the agent to compile. --- app/talk-agent.hoon | 109 ++++++++++++++++++++++---------------------- 1 file changed, 55 insertions(+), 54 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index f0f029591d..f032bd0498 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -8,6 +8,7 @@ :: :::: :: +[. talk sole] => |% :: data structures ++ chattel :: full state $: tales/(map knot tale) :: conversations @@ -36,7 +37,10 @@ == :: :: :: ++ move (pair bone card) :: all actions - ++ lime {$sole-effect sole-effect} :: diff fruit + ++ lime :: diff fruit + $% {$talk-report report} :: + {$sole-effect sole-effect} :: + == :: ++ pear :: poke fruit $% {$talk-command command} :: {$talk-update update} :: @@ -67,6 +71,10 @@ {$create p/posture q/knot r/cord} :: {$probe p/station} :: == :: + ++ weir :: parsed wire + $% {$repeat p/@ud q/@p r/knot} :: + {$friend p/knot q/station} :: + == :: ++ where (set partner) :: non-empty audience ++ glyphs `wall`~[">=+-" "}),." "\"'`^" "$%&@"] :: station char pool' ++ broker :: broker ship and name @@ -199,13 +207,13 @@ ::x story doesn't get a face because ease of use :: $: man/knot - story + tale == ++ pa-abet ::x apply/fold changes back into the stories map. :: ^+ +> - +>(stories (~(put by stories) man `story`+<+)) + +>(tales (~(put by tales) man `tale`+<+)) :: ++ pa-lesson :: learn multiple ::x learn all telegrams in a list. @@ -223,10 +231,8 @@ ^+ +> ::x if author isn't allowed to write here, reject. ::TODO we shouldn't need to do permission checks anymore, all we need to - :: do is make sure the grams came from our broker. - ?. (pa-admire p.gam) - ~& %pa-admire-rejected - +>.$ + :: do is make sure the grams were sent to us by our broker. + :: do this earlier up in the chain. =. q.q.gam ::x if we are in the audience, mark us as having received it. =+ ole=(~(get by q.q.gam) [%& our.hid man]) @@ -268,19 +274,22 @@ ++ pa-remind :: presence update ::x merge local and remote presences, and store them in locals. :: - ::TODO stop using timed. - |= {tay/partner loc/atlas rem/(map partner atlas)} + ::TODO verify if this now does what it's supposed to. + |= {loc/atlas rem/(map partner atlas)} ::x remove this story from the presence map, since it's in local already. =. rem (~(del by rem) %& our.hid man) :: superceded by local data ::TODO stop using timed, just do uni here. - =/ buk (~(uni timed remotes) rem) :: XX drop? - =. buk (~(put timed buk) tay now.hid loc) - +>.$ + =/ pres + %+ roll (~(tap by rem)) + |= {r/(pair partner atlas) l/atlas} + =. l ?~(l loc l) ::TODO =? + (~(uni by l) q.r) + +>.$(locals pres) :: ++ pa-cabal ::x update the tale's config. :: - |= {cuz/station con/config} + |= {cuz/station con/config ham/(map station config)} ^+ +> +>(shape con) :: @@ -295,7 +304,7 @@ +> ?+ -.rad ~|([%talk-odd-friend rad] !!) $cabal (pa-cabal cuz +.rad) - $group (pa-remind [%& cuz] +.rad) + $group (pa-remind +.rad) $grams (pa-lesson q.+.rad) == :: @@ -312,8 +321,8 @@ |_ $: ::x coz: talk commands storage, applied by ++sh-abet. ::x she: console session state used in this core. :: + coz/(list command) she/shell - coz/(list command) :: talk actions == ++ sh-scad :: command parser ::x builds a core with parsers for talk-cli, and produces its work arm. @@ -512,21 +521,14 @@ == == :: - ++ sh-peep :: peer to path - ::TODO remove. - :: - |= pax/path - ^+ +> - +>(+> (ra-subscribe her.she pax)) - :: ++ sh-peer :: subscribe shell ::x create a shell, subscribe to default stories. :: =< sh-prod %_ . +> - ::x subscriptions to the shell's ship's default channels. - (ra-subscribe:(ra-subscribe her.she ~) her.she [man.she ~]) + +> + ::TODO peer susbcribe to /sole and /sole/man.she at our broker. == :: ++ sh-prod :: show prompt @@ -570,7 +572,7 @@ ?~ paz | ?| $(paz l.paz) $(paz r.paz) - (~(has in sources.shape:(~(got by stories) man.she)) `partner`n.paz) + (~(has in sources.shape:(~(got by tales) man.she)) `partner`n.paz) == :: ++ sh-pest :: report listen @@ -612,7 +614,7 @@ ?: =(~ lax) ~ ::x no partner. ?: ?=({* $~ $~} lax) `n.lax ::x single partner. ::x in case of multiple partners, pick the most recently active one. - =+ grams=grams:(~(got by stories) man.she) + =+ grams=grams:(~(got by tales) man.she) |- ^- (unit (set partner)) ?~ grams ~ ::x get first partner from a telegram's audience. @@ -727,8 +729,6 @@ new/(list (pair partner atlas)) cha/(list (pair partner atlas)) == - =. one ~(strip timed one) - =. two ~(strip timed two) ^+ ret =. ret =+ eno=(~(tap by one)) @@ -1059,20 +1059,6 @@ ?~ gaz +> $(gaz t.gaz, num +(num), +> (sh-repo-gram num i.gaz)) :: - ++ sh-repo-glyph :: apply binding - ::x updates glyph bindings and lookup, and updates selected audience. - :: - |= nac/(jug char (set partner)) - ^+ +> - %_ sh-prod - nak nac - nik %- ~(gas by *(map (set partner) char)) - =- (zing `(list (list {(set partner) char}))`-) - %+ turn (~(tap by nac)) - |= {a/char b/(set (set partner))} - (turn (~(tap by b)) |=(c/(set partner) [c a])) - == - :: ++ sh-repo :: apply report ::x applies the different kinds of reports using their handler arms above :: @@ -1082,7 +1068,6 @@ ?- -.rad $cabal (sh-repo-cabal +.rad) $grams (sh-repo-grams +.rad) - $glyph (sh-repo-glyph +.rad) :: XX ever happens? $group (sh-repo-group +.rad) $house (sh-repo-house +.rad) == @@ -1207,7 +1192,7 @@ :: |= job/work ^+ +> - =+ roy=(~(got by stories) man.she) + =+ roy=(~(got by tales) man.she) =< work |% ++ work @@ -1260,9 +1245,7 @@ =: nik (~(put by nik) lix cha) nak (~(put ju nak) cha lix) == - %_ ..sh-work - ..sh (sh-update %bind cha lix) - == + (sh-update %bind cha lix) :: ++ join :: %join |= pan/(set partner) @@ -1339,7 +1322,7 @@ ++ create :: %create |= {por/posture nom/knot txt/cord} ^+ ..sh-work - ?: (~(has in stories) nom) + ?: (~(has in tales) nom) (sh-lame "{(trip nom)}: already exists") =. ..sh-work ::x create new config for channel. @@ -1417,7 +1400,7 @@ ++ number :: %number |= num/$@(@ud {p/@u q/@ud}) ^+ ..sh-work - =+ roy=(~(got by stories) man.she) + =+ roy=(~(got by tales) man.she) |- ?@ num ?: (gte num count.roy) @@ -1710,7 +1693,7 @@ ?& ?=($& -.pan) =(p.p.pan our.hid) :: - =+ sot=(~(get by stories) q.p.pan) + =+ sot=(~(get by tales) q.p.pan) &(?=(^ sot) ?=($brown p.cordon.shape.u.sot)) == :: @@ -1901,6 +1884,22 @@ -- :: ::TODO move to lib. +++ etch :: parse wire + ::x parse wire to obtain either %friend with story and station or %repeat + ::x with message number, source ship and story. + :: + |= way/wire + ^- weir + ?+ -.way !! + $friend + ?> ?=({$show @ @ @ $~} t.way) + [%friend i.t.t.way (slav %p i.t.t.t.way) i.t.t.t.t.way] + :: + $repeat + ?> ?=({@ @ @ $~} t.way) + [%repeat (slav %ud i.t.way) (slav %p i.t.t.way) i.t.t.t.way] + == +:: ++ etch-friend :: ::x parse a /friend wire, call gate with resulting data. :: @@ -1926,10 +1925,10 @@ ?- -.low $glyph %_ +> - nak +.rad + nak +.low nik %- ~(gas by *(map (set partner) char)) =- (zing `(list (list {(set partner) char}))`-) - %+ turn (~(tap by +.rad)) + %+ turn (~(tap by +.low)) |= {a/char b/(set (set partner))} (turn (~(tap by b)) |=(c/(set partner) [c a])) == @@ -1938,13 +1937,15 @@ %= +> folks %- ~(gas by *(map ship human)) %+ murn + =< $ %~ tap by - %- ~(uni by +.rad) + %- ~(uni by +.low) + ^- (map ship (unit human)) (~(run by folks) some) == |= {s/ship h/(unit human)} ?~ h ~ - [s u.h] + (some [s u.h]) == == :: From 81c9bb6ba04c8e804c5119ae7622da39b94fb220 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 27 Mar 2017 17:26:05 +0200 Subject: [PATCH 014/303] Numerous small changes and fixes to get the guardian to compile. --- app/talk-guardian.hoon | 124 ++++++++--------------------------------- 1 file changed, 24 insertions(+), 100 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 0e9d908181..1a3a4089ed 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -137,7 +137,7 @@ :: ::x moves: moves storage, added to by ++ra-emit and -emil, produced by -abed. |_ moves/(list move) - ++ ra-abed :: resolve core + ++ ra-abet :: resolve core ::x produces the moves stored in ++ra's moves. ::x sole-effects get special treatment to become a single move. :: @@ -162,57 +162,6 @@ ::x produce moves or sole-effects and moves. ?~(foc moz [[ost.hid %diff %sole-effect u.foc] moz]) :: - ++ ra-abet :: complete core - ::x applies talk reports, then produces moves and updated state. - :: - ra-abed:ra-axel - :: - ++ ra-axel :: rebound reports - ::x extracts and applies the talk-reports in moves. - :: - ^+ . - ::x separate talk-reports meant for our shells from other moves. - =+ ^= rey - |- ^- (pair (list move) (list (pair bone report))) - ?~ moves - [~ ~] - =+ mor=$(moves t.moves) - ::x if we know the target shell is ours, and it's a talk report, - ::x add it to the list of reports to be locally applied. - ?. ?& (~(has by shells) `bone`p.i.moves) - ?=({$diff $talk-report *} q.i.moves) - == - [[i.moves p.mor] q.mor] - [p.mor [[p.i.moves +>.q.i.moves] q.mor]] - ::x update moves to exclude our talk-reports. - =. moves p.rey - =. q.rey (flop q.rey) - ?: =(q.rey ~) + - |- ^+ +> - ?~ q.rey ra-axel - ::x apply reports to our shells. - =+ bak=(ra-back(ost.hid p.i.q.rey) q.i.q.rey) - $(q.rey t.q.rey, +> bak(ost.hid ost.hid)) - :: - ++ ra-back - ::x applies report. - :: - |= rad/report - ^+ +> - sh-abet:(~(sh-repo sh ~ (~(got by shells) ost.hid)) rad) - :: - ++ ra-sole - ::x applies sole-action. - :: - |= act/sole-action - ^+ +> - =+ shu=(~(get by shells) ost.hid) - ?~ shu - ~| :+ %ra-console-broken ost.hid - ?:((~(has by sup.hid) ost.hid) %lost %unknown) - !! - sh-abet:(~(sh-sole sh ~ u.shu) act) - :: ++ ra-emil :: ra-emit move list ::x adds multiple moves to the core's list. flops to emulate ++ra-emit. :: @@ -318,15 +267,17 @@ ?- -.dup $status ::x update our status. ::x for every knot (story) in the set, update our status. - |- ^+ +> ::TODO maybe +>.^$ - ?~ p.dup +> - =. +> $(p.dup l.p.dup) - =. +> $(p.dup r.p.dup) + |- ^+ +>.^$ + ?~ p.dup +>.^$ + =. +>.^$ $(p.dup l.p.dup) + =. +>.^$ $(p.dup r.p.dup) ::x uses our because status is per identity, not per client. - pa-abet:(~(pa-notify n.p.dup story) our q.dup) + ::TODO check if this can crash or not. + =< pa-abet + (~(pa-notify pa n.p.dup (~(got by stories) n.p.dup)) our.hid q.dup) :: $human ::x change an identity. - ?. =((~(get by folks) her) q.dup) + ?. =((~(get by folks) her) `q.dup) +> ::x no change. =. folks ?~ hand.q.dup (~(del by folks) p.dup) @@ -334,7 +285,7 @@ %+ ra-inform %names ::TODO think long and hard, do we need unit for delition or is a human :: with [~ ~] good enough? if the latter, agent's $names will change. - (~(put by *(map ship (unit human))) her ?~(hand.q.dup ~ q.dup)) + (~(put by *(map ship (unit human))) her ?~(hand.q.dup ~ `q.dup)) :: $bind ::x set glyph binding. %. [%glyph nak] @@ -535,21 +486,6 @@ [who (~(put by folks) her who)] [who +>.$] :: - ++ ra-console :: console subscribe - ::x make a shell for her, subscribe her to it. - :: - |= {her/ship pax/path} - ^+ +> - ::x get story from the path, default to standard mailbox. - =/ man/knot - ?+ pax !! - $~ (main her) - {@ta $~} i.pax - == - =/ she/shell - %*(. *shell her her, man man, active `(sy [%& our.hid man] ~)) - sh-abet:~(sh-peer sh ~ `shell`she) - :: ++ ra-subscribe :: listen to ::x subscribe her at pax. :: @@ -558,9 +494,11 @@ :: ~& [%ra-subscribe ost.hid her pax] ::x empty path, meta-subscribe and send report with all our stories. ?: ?=($~ pax) + ::TODO these are our readers! send lowdowns and tell them our tales! (ra-house(general (~(put in general) ost.hid)) ost.hid) - ?. ?=({@ *} pax) - (ra-evil %talk-bad-path) + ::?. ?=({@ *} pax) + :: (ra-evil %talk-bad-path) + ::TODO ^ mint-vains? =+ pur=(~(get by stories) i.pax) ?~ pur ~& [%bad-subscribe-story-c i.pax] @@ -726,15 +664,13 @@ :: |= vew/(set bone) %^ pa-report vew %group - :- %- ~(run by locals) - |=({@ a/status} a) + :- locals %- ~(urn by remotes) :: XX preformance |= {pan/partner atl/atlas} ^- atlas ?. &(?=($& -.pan) =(our.hid p.p.pan)) atl - =+ (~(get by stories) q.p.pan) - ?~ - atl - %- ~(run by locals.u) - |=({@ a/status} a) + =+ soy=(~(get by stories) q.p.pan) + ?~ soy atl + locals.u.soy :: ++ pa-report-cabal :: update config ::x a cabal report, containing our and remote configs, to all bones. @@ -752,7 +688,7 @@ =. mirrors (~(put by mirrors) cuz con) ?: =(mirrors old) +>.$ - pa-report-cabal + (pa-report-cabal pa-followers) :: ++ pa-diff-talk-report :: subscribed update ::x process a talk report from cuz. @@ -773,6 +709,7 @@ ::x delete tay from our subscriptions, then send an updated capal report. :: |= tay/partner + %. pa-followers pa-report-cabal(sources.shape (~(del in sources.shape) tay)) :: ++ pa-sauce :: send backward @@ -857,7 +794,7 @@ :: |= {her/ship saz/status} ^+ +> - =/ nol (~(put by locals) her now.hid saz) + =/ nol (~(put by locals) her saz) ?: =(nol locals) +>.$ (pa-report-group(locals nol) pa-followers) :: @@ -1028,13 +965,7 @@ :: |= pax/path ^+ [*(list move) +>] - ~? !=(src.hid our.hid) [%peer-talk-stranger src.hid] - :: ~& [%talk-peer src.hid ost.hid pax] - ?: ?=({$sole *} pax) - ?> (team our.hid src.hid) - ~? (~(has by shells) ost.hid) [%talk-peer-replaced ost.hid pax] - ra-abet:(ra-console:ra src.hid t.pax) - :: ~& [%talk-peer-data ost.hid src.hid pax] + ~? !(team src.hid our.hid) [%peer-talk-stranger src.hid] ra-abet:(ra-subscribe:ra src.hid pax) :: ++ poke-talk-command :: accept command @@ -1052,13 +983,7 @@ ::x incoming talk update. process it. :: |= dup/update - ra-abet:(ra-update src.hid dup) -:: -++ poke-sole-action :: accept console - ::x incoming sole action. process it. - :: - |= act/sole-action - ra-abet:(ra-sole:ra act) + ra-abet:(ra-update:ra src.hid dup) :: ++ diff-talk-report :: ::x incoming talk-report. process it and update logs. @@ -1132,8 +1057,7 @@ |= pax/path ^+ [*(list move) +>] :: ~& [%talk-pull src.hid ost.hid pax] - =^ moz +>.$ ra-abet:(ra-cancel:ra src.hid pax) - [moz +>.$(shells (~(del by shells) ost.hid))] + ra-abet:(ra-cancel:ra src.hid pax) :: ++ log-all-to-file ::x for every story we're logging, (over)write all their grams to log files, From 9305be2a0a0bfd998c3763388331c931518a0731 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 27 Mar 2017 23:11:25 +0200 Subject: [PATCH 015/303] State now contains a single shell. --- app/talk-agent.hoon | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index f032bd0498..60eeab1aa9 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -15,7 +15,7 @@ folks/(map ship human) :: human identities nik/(map (set partner) char) :: bound station glyphs nak/(jug char (set partner)) :: station glyph lookup - shells/(map bone shell) :: interaction state + cli/shell :: interaction state == :: ++ tale :: user-facing story $: count/@ud :: (lent grams) @@ -26,6 +26,7 @@ == :: ++ shell :: console session $: her/ship :: client identity + id/bone :: identifier man/knot :: mailbox count/@ud :: messages shown say/sole-share :: console state @@ -139,7 +140,7 @@ =+ mor=$(moves t.moves) ::x if we know the target shell is ours, and it's a talk report, ::x add it to the list of reports to be locally applied. - ?. ?& (~(has by shells) `bone`p.i.moves) + ?. ?& =(id.cli `bone`p.i.moves) ?=({$diff $talk-report *} q.i.moves) == [[i.moves p.mor] q.mor] @@ -160,7 +161,7 @@ :: |= rad/report ^+ +> - sh-abet:(~(sh-repo sh ~ (~(got by shells) ost.hid)) rad) + sh-abet:(~(sh-repo sh ~ cli) rad) :: ++ ra-diff-talk-report :: subscription update ::x process a talk report from cuz into story man. @@ -189,13 +190,26 @@ :: |= act/sole-action ^+ +> - =+ shu=(~(get by shells) ost.hid) - ?~ shu - ~| :+ %ra-console-broken ost.hid - ::x differentiate between subscribers we know and don't know. - ?:((~(has by sup.hid) ost.hid) %lost %unknown) + ?. =(id.cli ost.hid) + ~& %strange-sole !! - sh-abet:(~(sh-sole sh ~ u.shu) act) + sh-abet:(~(sh-sole sh ~ cli) act) + :: + ++ ra-console + ::x make a shell for her. + :: + |= {her/ship pax/path} + ~& [%ra-console her pax] + ^+ +> + ::x get story from the path, default to standard mailbox. + =/ man/knot + ?+ pax !! + $~ (main her) + {@ta $~} i.pax + == + =/ she/shell + %*(. *shell her her, man man, id ost.hid, active (sy [%& our.hid man] ~)) + sh-abet:~(sh-peer sh ~ she) :: ++ pa :: story core ::x tale core, used for doing work on a story. @@ -495,7 +509,7 @@ (broker our.hid) [%talk-command c] == - ra-emil(shells (~(put by shells) ost.hid she)) + ra-emil(cli she) :: ++ sh-fact :: send console effect ::x adds a console effect to ++ra's moves. From 5313bf635a4d5c3621eba8d05ba8d7d37cf5398d Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 27 Mar 2017 23:17:09 +0200 Subject: [PATCH 016/303] Agent can now boot, get initial data from guardian, and perform sole-actions. --- app/talk-agent.hoon | 58 +++++++++++++++++++++++++++++++++++++++++- app/talk-guardian.hoon | 2 +- 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 60eeab1aa9..1002ff71b4 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -49,6 +49,7 @@ ++ card :: general card $% {$diff lime} :: {$poke wire dock pear} :: + {$peer wire dock path} :: == :: ++ work :: interface action $% {$number p/$@(@ud {@u @ud})} :: relative/absolute @@ -166,13 +167,29 @@ ++ ra-diff-talk-report :: subscription update ::x process a talk report from cuz into story man. :: + ::TODO also show reports to sh-repo |= {man/knot cuz/station rad/report} ^+ +> + ?: ?=($house -.rad) + (ra-diff-talk-report-house +.rad) ::TODO ra-know needed counter +1 =+ tal=(~(get by tales) man) ?~ tal ~&([%know-no-tale man] !!) pa-abet:(~(pa-diff-talk-report pa man u.tal) cuz rad) :: + ++ ra-diff-talk-report-house + ::x learn of stories. + :: + |= sef/shelf + ^+ +> + =+ sas=(~(tap by sef)) + |- ^+ +>.^$ + ?~ sas +>.^$ + =/ tal (fall (~(get by tales) p.i.sas) *tale) + =. caption.shape.tal q.q.i.sas + =. p.cordon.shape.tal p.q.i.sas + $(sas t.sas, tales (~(put by tales) p.i.sas tal)) + :: ++ ra-emil :: ra-emit move list ::x adds multiple moves to the core's list. flops to emulate ++ra-emit. :: @@ -211,6 +228,18 @@ %*(. *shell her her, man man, id ost.hid, active (sy [%& our.hid man] ~)) sh-abet:~(sh-peer sh ~ she) :: + ++ ra-init + ::x populate state on first boot. subscribes to our broker. + :: + ~& %r-ra-init + %- ra-emit + :* ost.hid + %peer + / + (broker our.hid) + / + == + :: ++ pa :: story core ::x tale core, used for doing work on a story. ::x as always, an -abet arms is used for applying changes to the state. @@ -928,8 +957,9 @@ ++ sh-repo-house ::x applies new shelf ("house"?) and prints changes to cli. :: - |= awl/(map knot (pair posture cord)) + |= awl/shelf ^+ +> + ~& [%sh-repo-house awl] =+ dif=(sh-repo-house-diff harbor.she awl) =. harbor.she awl =. +>.$ @@ -1897,6 +1927,21 @@ == -- :: +++ peer + ::x incoming subscription on pax. + :: + |= pax/path + ~& [%r-peer pax ost.hid src.hid] + ^- (quip move +>) + ?. (team src.hid our.hid) + ~& [%peer-talk-reader-stranger src.hid] + [~ +>] + ?. ?=({$sole *} pax) + ~& [%peer-talk-reader-strange pax] + [~ +>] + ::~? (~(has by shells) ost.hid) [%talk-peer-replaced ost.hid pax] + ra-abet:(ra-console:ra src.hid t.pax) +:: ::TODO move to lib. ++ etch :: parse wire ::x parse wire to obtain either %friend with story and station or %repeat @@ -1926,6 +1971,8 @@ :: |= {way/wire rad/report} ^- (quip move +>) + ?: =(-.rad %house) + ra-abet:(ra-diff-talk-report:ra *knot *station rad) %+ etch-friend way |= {man/knot cuz/station} ra-abet:(ra-diff-talk-report:ra man cuz rad) :: @@ -1969,4 +2016,13 @@ |= act/sole-action ra-abet:(ra-sole:ra act) :: +++ prep + ::x state adapter. + :: + |= old/(unit chattel) + ra-abet:ra-init:ra + ::^- (quip move ..prep) + ::?~ old + :: ra-abet:ra-init:ra + ::[~ ..prep(+<+ u.old)] -- diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 1a3a4089ed..cfb45dd396 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -781,7 +781,7 @@ =. +>.$ (pa-acquire p.dif) =. +>.$ (pa-abjure q.dif) =. shape cof - pa-report-cabal + (pa-report-cabal pa-followers) :: ++ pa-cancel :: unsubscribe from ::x deletes the current ost.hid from all follower groups. From 47f36dda658a18ff12636979abf7e31244de4cbf Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 29 Mar 2017 00:11:12 +0200 Subject: [PATCH 017/303] Readers no longer receive talk reports. Rely on lowdowns for updates instead. Working title. Compiles but doesn't run well. ++sh needs work to accommodate. --- app/talk-agent.hoon | 149 ++++++++++++++++++++--------------------- app/talk-guardian.hoon | 33 ++++++++- sur/talk.hoon | 9 ++- 3 files changed, 113 insertions(+), 78 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 1002ff71b4..3499fad9f2 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -164,31 +164,84 @@ ^+ +> sh-abet:(~(sh-repo sh ~ cli) rad) :: - ++ ra-diff-talk-report :: subscription update - ::x process a talk report from cuz into story man. + ++ ra-diff-talk-lowdown + ::x process a talk lowdown :: - ::TODO also show reports to sh-repo - |= {man/knot cuz/station rad/report} + |= low/lowdown ^+ +> - ?: ?=($house -.rad) - (ra-diff-talk-report-house +.rad) - ::TODO ra-know needed counter +1 - =+ tal=(~(get by tales) man) - ?~ tal ~&([%know-no-tale man] !!) - pa-abet:(~(pa-diff-talk-report pa man u.tal) cuz rad) + ?- -.low + $glyph (ra-diff-talk-lowdown-glyph +.low) + $names (ra-diff-talk-lowdown-names +.low) + $tales (ra-diff-talk-lowdown-tales +.low) + $precs (ra-diff-talk-lowdown-precs +.low) + $grams (ra-diff-talk-lowdown-grams +.low) + == :: - ++ ra-diff-talk-report-house - ::x learn of stories. + ++ ra-diff-talk-lowdown-glyph + ::x apply new set of glyph bindings. :: - |= sef/shelf + |= nek/_nak ^+ +> - =+ sas=(~(tap by sef)) - |- ^+ +>.^$ - ?~ sas +>.^$ - =/ tal (fall (~(get by tales) p.i.sas) *tale) - =. caption.shape.tal q.q.i.sas - =. p.cordon.shape.tal p.q.i.sas - $(sas t.sas, tales (~(put by tales) p.i.sas tal)) + =. nak nek + =. nik %- ~(gas by *(map (set partner) char)) + =- (zing `(list (list {(set partner) char}))`-) + %+ turn (~(tap by nek)) + |= {a/char b/(set (set partner))} + (turn (~(tap by b)) |=(c/(set partner) [c a])) + sh-abet:~(sh-prod sh ~ cli) + :: + ++ ra-diff-talk-lowdown-names + ::x apply new local identities. + :: + |= nas/(map ship (unit human)) + ^+ +> + %= +> folks + %- ~(gas by *(map ship human)) + %+ murn + =< $ + %~ tap by + %- ~(uni by nas) + ^- _nas + (~(run by folks) some) + == + |= {s/ship h/(unit human)} + ?~ h ~ + (some [s u.h]) + == + :: :: + ++ ra-diff-talk-lowdown-tales + ::x apply tale configs. + :: + |= tals/(map knot config) + ~& %ra-diff-talk-lowdown-tales + ^+ +> + ::TODO for every config, (sh-repo-config-show "" oldconfig newconfig) + %= +> tales + %+ roll (~(tap by tals)) + |= {t/(pair knot config) tas/_tales} + =. tas ?~(tas tales tas) + =+ tal=(fall (~(get by tas) p.t) *tale) + (~(put by tas) p.t tal(shape q.t)) + == + :: + ++ ra-diff-talk-lowdown-precs + ::x apply new presence. + :: + |= {man/knot pes/atlas} + ^+ +> + =+ tal=(~(get by tales) man) + ?~ tal ~&([%know-no-tale man] +>.$) + =. +>.$ sh-abet:(~(sh-repo-group-here sh ~ cli(p.owners locals.u.tal)) pes) + +>.$(tales (~(put by tales) man u.tal(locals pes))) + :: + ++ ra-diff-talk-lowdown-grams + ::x apply new grams + :: + |= {man/knot num/@ud gams/(list telegram)} + =+ tal=(~(get by tales) man) + ?~ tal ~&([%know-no-tale man] +>.$) + =. +>.$ sh-abet:(~(sh-repo-grams sh ~ cli) num gams) + pa-abet:(~(pa-lesson pa man u.tal) gams) :: ++ ra-emil :: ra-emit move list ::x adds multiple moves to the core's list. flops to emulate ++ra-emit. @@ -335,22 +388,6 @@ |= {cuz/station con/config ham/(map station config)} ^+ +> +>(shape con) - :: - ++ pa-diff-talk-report :: subscribed update - ::x process a talk report from cuz. - :: - |= {cuz/station rad/report} - ^+ +> - ::x verify we are supposed to receive reports from cuz. - ?. (~(has in sources.shape) [%& cuz]) - ~& [%pa-diff-unexpected cuz rad] - +> - ?+ -.rad ~|([%talk-odd-friend rad] !!) - $cabal (pa-cabal cuz +.rad) - $group (pa-remind +.rad) - $grams (pa-lesson q.+.rad) - == - :: -- ++ sh :: per console ::x shell core, responsible for doing things with console sessions, @@ -1966,49 +2003,11 @@ =+ wer=(etch way) ?>(?=($friend -.wer) (fun p.wer q.wer)) :: -++ diff-talk-report :: accept report - ::x incoming talk-report. process it. - :: - |= {way/wire rad/report} - ^- (quip move +>) - ?: =(-.rad %house) - ra-abet:(ra-diff-talk-report:ra *knot *station rad) - %+ etch-friend way |= {man/knot cuz/station} - ra-abet:(ra-diff-talk-report:ra man cuz rad) -:: ++ diff-talk-lowdown ::x incoming talk-lowdown. process it. :: - ::TODO would it be tidier to put this into ++ra? |= {way/wire low/lowdown} - ^- (quip move +>) - :- ~ - ?- -.low - $glyph - %_ +> - nak +.low - nik %- ~(gas by *(map (set partner) char)) - =- (zing `(list (list {(set partner) char}))`-) - %+ turn (~(tap by +.low)) - |= {a/char b/(set (set partner))} - (turn (~(tap by b)) |=(c/(set partner) [c a])) - == - ::TODO sh-prod each shell? - $names - %= +> - folks %- ~(gas by *(map ship human)) - %+ murn - =< $ - %~ tap by - %- ~(uni by +.low) - ^- (map ship (unit human)) - (~(run by folks) some) - == - |= {s/ship h/(unit human)} - ?~ h ~ - (some [s u.h]) - == - == + ra-abet:(ra-diff-talk-lowdown:ra low) :: ++ poke-sole-action :: accept console ::x incoming sole action. process it. diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index cfb45dd396..984c322831 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -495,7 +495,7 @@ ::x empty path, meta-subscribe and send report with all our stories. ?: ?=($~ pax) ::TODO these are our readers! send lowdowns and tell them our tales! - (ra-house(general (~(put in general) ost.hid)) ost.hid) + (ra-welcome(general (~(put in general) ost.hid)) ost.hid) ::?. ?=({@ *} pax) :: (ra-evil %talk-bad-path) ::TODO ^ mint-vains? @@ -518,6 +518,25 @@ ::x apply changes to story. pa-abet:soy :: + ++ ra-welcome + ::x brings reader new up to date. + :: + |= new/bone + =. +> %- ra-emit + :* new %diff %talk-lowdown %tales + %- ~(gas in *(map knot config)) + %+ turn (~(tap by stories)) + |=({a/knot b/story} [a shape.b]) + == + =. +> %- ra-emil :~ + [new %diff %talk-lowdown %glyph nak] + [new %diff %talk-lowdown %names (~(run by folks) some)] + == + %- ra-emil + %+ turn (~(tap by stories)) + |= {k/knot s/story} + [new %diff %talk-lowdown %grams k count.s grams.s] + :: ++ ra-think :: publish+review ::x consumes each thought. :: @@ -876,6 +895,16 @@ :: |= {num/@ud gam/telegram} ^+ +> + ::x notify all of our readers. + =+ ^= roy + |- ^- (list move) + ?~ general ~ + =+ lef=$(general l.general) + =+ rit=$(general r.general) + ~& [%b-refreshing n.general] + :_ (welp lef rit) + [n.general %diff %talk-lowdown %grams man num gam ~] + ::x notify only the followers who are currently interested. =+ ^= moy |- ^- (pair (list bone) (list move)) ?~ followers [~ ~] @@ -895,7 +924,7 @@ old :- p.old [[p.n.followers %diff %talk-report %grams num gam ~] q.old] - =. moves (welp q.moy moves) + =. moves :(welp roy q.moy moves) |- ^+ +>.^$ ?~ p.moy +>.^$ $(p.moy t.p.moy, followers (~(del by followers) i.p.moy)) diff --git a/sur/talk.hoon b/sur/talk.hoon index 169a860b5c..b2401b803e 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -58,8 +58,15 @@ {$house shelf} :: station set == :: ++ lowdown :: changed shared state + ::TODO change these so that they're always just the diff. + :: this will aid with ++sh's printing. $% {$glyph (jug char (set partner))} :: new bindings - {$names (map ship (unit human))} :: new identities + {$names (map ship (unit human))} :: new identities + {$tales (map knot config)} :: changed config + ::TODO cabal, or merge its contents into tale's config + :: basically we just want to merge the ship sets, right? + {$precs (pair knot atlas)} :: changed presence + {$grams (pair knot (pair @ud (list telegram)))} :: new grams == :: ++ speech :: narrative action $% {$lan p/knot q/@t} :: local announce From 91421fd8d23193c2845239d4757dda17cadb158f Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 29 Mar 2017 13:00:44 +0200 Subject: [PATCH 018/303] Fixed issue where the incorrect bone was used for sole effects. --- app/talk-agent.hoon | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 3499fad9f2..afdb44f9a7 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -110,7 +110,7 @@ |- ^- (pair (list move) (list sole-effect)) ?~ moves [~ ~] =+ mor=$(moves t.moves) - ?: ?& =(ost.hid p.i.moves) + ?: ?& =(id.cli p.i.moves) ?=({$diff $sole-effect *} q.i.moves) == [p.mor [+>.q.i.moves q.mor]] @@ -121,8 +121,13 @@ ?~ q.yop ~ ?~(t.q.yop `i.q.yop `[%mor (flop `(list sole-effect)`q.yop)]) == + ?~ foc + moz + ?~ id.cli + ~& %no-sole + moz ::x produce moves or sole-effects and moves. - ?~(foc moz [[ost.hid %diff %sole-effect u.foc] moz]) + [[id.cli %diff %sole-effect u.foc] moz] :: ++ ra-abet :: complete core ::x applies talk reports, then produces moves and updated state. @@ -582,7 +587,7 @@ :: |= fec/sole-effect ^+ +> - +>(moves :_(moves [ost.hid %diff %sole-effect fec])) + +>(moves :_(moves [id.she %diff %sole-effect fec])) :: ++ sh-update ::x adds a talk-update to ++ra's moves From 00d8c11178e0eec5f1563111d3581bd6f2d8b583 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 29 Mar 2017 16:53:42 +0200 Subject: [PATCH 019/303] Removed $glyph case from the talk-report mark. --- mar/talk/report.hoon | 1 - 1 file changed, 1 deletion(-) diff --git a/mar/talk/report.hoon b/mar/talk/report.hoon index ab76c84fe1..87a056fdb4 100644 --- a/mar/talk/report.hoon +++ b/mar/talk/report.hoon @@ -21,7 +21,6 @@ ?- -.rep $cabal (cabl +.rep) $house a+(turn (~(tap by +.rep)) jose) - $glyph ((jome |=(a/char a) nack) +.rep) $grams (jobe num+(jone p.rep) tele+[%a (turn q.rep gram)] ~) $group (jobe local+(grop p.rep) global+%.(q.rep (jome parn grop)) ~) == From c41973005f041320908bffecaa2251fc7afa4ee8 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 29 Mar 2017 17:03:59 +0200 Subject: [PATCH 020/303] Subscriptions now happen properly and config data gets propagated to readers. --- app/talk-guardian.hoon | 47 +++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 984c322831..c33c78a5e0 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -71,6 +71,7 @@ {$friend p/knot q/station} :: == :: ++ glyphs `wall`~[">=+-" "}),." "\"'`^" "$%&@"] :: station char pool' + ++ strap |*({k/* v/*} (~(put by *(map _k _v)) k v)) -- |% :: old protocol workaround door @@ -226,9 +227,8 @@ ::x the $design command is used for modifying channel configs, ::x which is done when joining, leaving or creating channels. ::x this may only be done by ourselves. - ::TODO use team instead of our. $design - ?. =(her our.hid) + ?. (team our.hid her) (ra-evil %talk-no-owner) ?~ q.cod ?. (~(has by stories) p.cod) @@ -285,7 +285,7 @@ %+ ra-inform %names ::TODO think long and hard, do we need unit for delition or is a human :: with [~ ~] good enough? if the latter, agent's $names will change. - (~(put by *(map ship (unit human))) her ?~(hand.q.dup ~ `q.dup)) + (strap her ?~(hand.q.dup ~ `q.dup)) :: $bind ::x set glyph binding. %. [%glyph nak] @@ -303,6 +303,7 @@ =+ :- neu=(~(has by stories) man) pur=(fall (~(get by stories) man) *story) =. +>.$ pa-abet:(~(pa-reform pa man pur) con) + =. +>.$ (ra-inform %tales (strap man con)) ?:(neu +>.$ ra-homes) :: ++ ra-base-hart @@ -491,10 +492,12 @@ :: |= {her/ship pax/path} ^+ +> - :: ~& [%ra-subscribe ost.hid her pax] ::x empty path, meta-subscribe and send report with all our stories. ?: ?=($~ pax) - ::TODO these are our readers! send lowdowns and tell them our tales! + ?. (team our.hid her) + ~& [%foreign-reader her] + +> + ~& [%subscribed-reader ost.hid] (ra-welcome(general (~(put in general) ost.hid)) ost.hid) ::?. ?=({@ *} pax) :: (ra-evil %talk-bad-path) @@ -610,7 +613,7 @@ %+ ra-emit ost.hid :* %poke /repeat/(scot %ud p.outbox)/(scot %p p.cuz)/[q.cuz] - [p.cuz %talk] + [p.cuz %talk-guardian] [%talk-command `command`[%review tip ~]] == +>(p.outbox +(p.outbox), q.outbox (~(put by q.outbox) p.outbox tip)) @@ -676,6 +679,19 @@ :: ~& [%pa-report-cabal man shape] (pa-sauce n.wac [%diff %talk-report caw]~) :: + ++ pa-inform + ::x sends lowdown to all readers. + :: + |= low/lowdown + =. moves + |- ^- (list move) + ?~ general moves + =+ lef=$(general l.general) + =+ rit=$(general r.general) + :_ (welp lef rit) + [n.general %diff %talk-lowdown low] + +>.$ + :: ++ pa-report-group :: update presence ::x build a group report, containing our different presence maps, and ::x send it to all bones. @@ -707,6 +723,7 @@ =. mirrors (~(put by mirrors) cuz con) ?: =(mirrors old) +>.$ + =. +>.$ (pa-inform %tales (strap man con)) (pa-report-cabal pa-followers) :: ++ pa-diff-talk-report :: subscribed update @@ -728,6 +745,8 @@ ::x delete tay from our subscriptions, then send an updated capal report. :: |= tay/partner + ::TODO send deletion lowdown. + ::=. +> (pa-inform %tales ) %. pa-followers pa-report-cabal(sources.shape (~(del in sources.shape) tay)) :: @@ -757,7 +776,7 @@ :_ ~ :* %pull /friend/show/[man]/(scot %p p.p.tay)/[q.p.tay] - [p.p.tay %talk] + [p.p.tay %talk-guardian] ~ == == @@ -782,7 +801,7 @@ :_ ~ :* %peer /friend/show/[man]/(scot %p p.p.tay)/[q.p.tay] - [p.p.tay %talk] + [p.p.tay %talk-guardian] /[q.p.tay]/[ini] == == @@ -800,6 +819,7 @@ =. +>.$ (pa-acquire p.dif) =. +>.$ (pa-abjure q.dif) =. shape cof + =. +>.$ (pa-inform %tales (strap man cof)) (pa-report-cabal pa-followers) :: ++ pa-cancel :: unsubscribe from @@ -896,14 +916,7 @@ |= {num/@ud gam/telegram} ^+ +> ::x notify all of our readers. - =+ ^= roy - |- ^- (list move) - ?~ general ~ - =+ lef=$(general l.general) - =+ rit=$(general r.general) - ~& [%b-refreshing n.general] - :_ (welp lef rit) - [n.general %diff %talk-lowdown %grams man num gam ~] + =. +> (pa-inform %grams man num gam ~) ::x notify only the followers who are currently interested. =+ ^= moy |- ^- (pair (list bone) (list move)) @@ -924,7 +937,7 @@ old :- p.old [[p.n.followers %diff %talk-report %grams num gam ~] q.old] - =. moves :(welp roy q.moy moves) + =. moves (welp q.moy moves) |- ^+ +>.^$ ?~ p.moy +>.^$ $(p.moy t.p.moy, followers (~(del by followers) i.p.moy)) From 9b94bbeb33ca9c191008dcd529ff53fbb4aeb78a Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 29 Mar 2017 20:17:21 +0200 Subject: [PATCH 021/303] Removed %house reports, superseded by %tales lowdowns. --- app/talk-guardian.hoon | 24 +----------------------- mar/talk/report.hoon | 11 +++-------- sur/talk.hoon | 1 - 3 files changed, 4 insertions(+), 32 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index c33c78a5e0..a9976d03d2 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -182,28 +182,6 @@ ~| [%ra-evil msg] !! :: - ++ ra-house :: emit partners - ::x emits a talk-report move containing all our stories. - ::TODO if we don't check for team on subscription, check here. - :: - |= ost/bone - %+ ra-emit ost.hid - :+ %diff %talk-report - :- %house - %- ~(gas in *(map knot (pair posture cord))) - %+ turn (~(tap by stories)) - |=({a/knot b/story} [a p.cordon.shape.b caption.shape.b]) - :: - ++ ra-homes :: update partners - ::x send a list of our stories to all general subscribers. - :: - =+ gel=general - |- ^+ +> - ?~ gel +> - =. +> $(gel l.gel) - =. +> $(gel r.gel) - (ra-house n.gel) - :: ++ ra-init :: initialize talk ::x populate state on first boot. creates our main and public stories. :: @@ -735,7 +713,7 @@ ?. (~(has in sources.shape) [%& cuz]) ~& [%pa-diff-unexpected cuz rad] +> - ?+ -.rad ~|([%talk-odd-friend rad] !!) + ?- -.rad $cabal (pa-cabal cuz +.rad) $group (pa-remind [%& cuz] +.rad) $grams (pa-lesson q.+.rad) diff --git a/mar/talk/report.hoon b/mar/talk/report.hoon index 87a056fdb4..b293162596 100644 --- a/mar/talk/report.hoon +++ b/mar/talk/report.hoon @@ -20,14 +20,10 @@ |^ %+ joba -.rep ?- -.rep $cabal (cabl +.rep) - $house a+(turn (~(tap by +.rep)) jose) $grams (jobe num+(jone p.rep) tele+[%a (turn q.rep gram)] ~) $group (jobe local+(grop p.rep) global+%.(q.rep (jome parn grop)) ~) == ++ joce |=(a/knot [%s a]) - ++ jose - |= {a/knot b/posture c/cord} - (jobe name+[%s a] posture+[%s a] caption+[%s b] ~) :: ++ jove |= {a/envelope b/delivery} @@ -60,7 +56,7 @@ ++ audi (jome parn jove) ++ bouq |= a/bouquet - a+(turn (~(tap in a)) |=(b/path a+(turn b |=(c/knot s+c)))) + a+(turn (~(tap in a)) |=(b/path a+(turn b |=(c/knot s+c)))) :: ++ parn |= a/partner ^- cord @@ -87,7 +83,7 @@ $lin (jobe txt+[%s q.a] say+[%b p.a] ~) $url (joba txt+[%s (crip (earf p.a))]) $exp (joba txt+[%s p.a]) - $app (jobe txt+[%s q.a] src+[%s p.a] ~) + $app (jobe txt+[%s q.a] src+[%s p.a] ~) $fat (jobe tor+(tors p.a) taf+$(a q.a) ~) $mor a+(turn p.a spec) $api @@ -129,7 +125,7 @@ ham+((jome stat conf) ham) == :: - ++ sorc + ++ sorc |= a/(set partner) ^- json [%a (turn (~(tap in a)) |=(b/partner s+(parn b)))] :: @@ -143,4 +139,3 @@ == -- -- -- - diff --git a/sur/talk.hoon b/sur/talk.hoon index b2401b803e..e92001a58d 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -55,7 +55,6 @@ :: {$folder (list report)} :: multiple {$grams (pair @ud (list telegram))} :: beginning thoughts {$group register} :: presence - {$house shelf} :: station set == :: ++ lowdown :: changed shared state ::TODO change these so that they're always just the diff. From 30e11f0dd139b88b629a8f262a2395b9586af296 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 29 Mar 2017 20:19:36 +0200 Subject: [PATCH 022/303] No longer sends multiple %tales reports for the same change. --- app/talk-guardian.hoon | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index a9976d03d2..c95d599530 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -278,11 +278,8 @@ :: |= {man/knot con/config} ^+ +> - =+ :- neu=(~(has by stories) man) - pur=(fall (~(get by stories) man) *story) - =. +>.$ pa-abet:(~(pa-reform pa man pur) con) - =. +>.$ (ra-inform %tales (strap man con)) - ?:(neu +>.$ ra-homes) + =+ pur=(fall (~(get by stories) man) *story) + pa-abet:(~(pa-reform pa man pur) con) :: ++ ra-base-hart ::x produces our ship's host desk's web address as a hart. From c03921811a212ba97efa7cc06def3b59ff8b5528 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 30 Mar 2017 11:52:40 +0200 Subject: [PATCH 023/303] ++sh now has a generic diff function for sets. --- app/talk-agent.hoon | 63 ++++++--------------------------------------- 1 file changed, 8 insertions(+), 55 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index afdb44f9a7..cbab1aecaa 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -835,59 +835,13 @@ ret(new [i.owt new.ret]) ret :: - ++ sh-repo-whom-diff - ::x calculates the difference between two partner sets. + ++ sh-set-diff + ::x calculates the difference between two sets, + ::x returning what was lost in old and what was gained in new. :: - |= {one/(set partner) two/(set partner)} - =| $= ret - $: old/(list partner) - new/(list partner) - == - ^+ ret - =. ret - =+ eno=(~(tap by one)) - |- ^+ ret - ?~ eno ret - =. ret $(eno t.eno) - ?: (~(has in two) i.eno) - ret - ret(old [i.eno old.ret]) - =. ret - =+ owt=(~(tap by two)) - |- ^+ ret - ?~ owt ret - =. ret $(owt t.owt) - ?: (~(has in one) i.owt) - ret - ret(new [i.owt new.ret]) - ret - :: - ++ sh-repo-ship-diff - ::x calculates the difference between two ship sets. - :: - |= {one/(set ship) two/(set ship)} - =| $= ret - $: old/(list ship) - new/(list ship) - == - ^+ ret - =. ret - =+ eno=(~(tap by one)) - |- ^+ ret - ?~ eno ret - =. ret $(eno t.eno) - ?: (~(has in two) i.eno) - ret - ret(old [i.eno old.ret]) - =. ret - =+ owt=(~(tap by two)) - |- ^+ ret - ?~ owt ret - =. ret $(owt t.owt) - ?: (~(has in one) i.owt) - ret - ret(new [i.owt new.ret]) - ret + |* {one/(set *) two/(set *)} + :- ^= old (~(tap in (~(dif in one) two))) + ^= new (~(tap in (~(dif in two) one))) :: ++ sh-puss ::x posture as text. @@ -947,7 +901,7 @@ =. +>.$ %+ sh-repo-config-sources (weld (trip man.she) ": ") - (sh-repo-whom-diff sources.laz sources.loc) + (sh-set-diff sources.laz sources.loc) ?: !=(p.cordon.loc p.cordon.laz) =. +>.$ (sh-note :(weld pre "but " (sh-puss p.cordon.loc))) %^ sh-repo-config-exceptions @@ -957,7 +911,7 @@ %^ sh-repo-config-exceptions (weld (trip man.she) ": ") p.cordon.loc - (sh-repo-ship-diff q.cordon.laz q.cordon.loc) + (sh-set-diff q.cordon.laz q.cordon.loc) :: ++ sh-repo-cabal-changes ::x used by ++sh-repo-cabal for printing cabal config changes to cli. @@ -1155,7 +1109,6 @@ $cabal (sh-repo-cabal +.rad) $grams (sh-repo-grams +.rad) $group (sh-repo-group +.rad) - $house (sh-repo-house +.rad) == :: ++ sh-sane-chat :: sanitize chatter From 163c31d4252a6cd1431b12ac1b028eae3db465a3 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 30 Mar 2017 13:33:37 +0200 Subject: [PATCH 024/303] Talk lowdowns can now indicate story/tale deletions. --- app/talk-agent.hoon | 10 +++++----- app/talk-guardian.hoon | 17 +++++++++-------- sur/talk.hoon | 2 +- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index cbab1aecaa..caf09acb14 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -217,16 +217,16 @@ ++ ra-diff-talk-lowdown-tales ::x apply tale configs. :: - |= tals/(map knot config) - ~& %ra-diff-talk-lowdown-tales + |= tals/(map knot (unit config)) ^+ +> ::TODO for every config, (sh-repo-config-show "" oldconfig newconfig) %= +> tales %+ roll (~(tap by tals)) - |= {t/(pair knot config) tas/_tales} - =. tas ?~(tas tales tas) + |= {t/(pair knot (unit config)) tas/_tales} + =. tas ?~(tas tales tas) ::x start with our current tales. =+ tal=(fall (~(get by tas) p.t) *tale) - (~(put by tas) p.t tal(shape q.t)) + ?~ q.t (~(del by tas) p.t) + (~(put by tas) p.t tal(shape u.q.t)) == :: ++ ra-diff-talk-lowdown-precs diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index c95d599530..356e497018 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -214,6 +214,7 @@ ::x $design with ~ for config signals delete ::TODO untangle into ++ra-unconfig, ++pa-reform-gone instead of using :: bunts or empty keys. + :: be sure to send a deletion %tales lowdown! (ra-config(stories (~(del by stories) p.cod)) p.cod *config) (ra-config p.cod u.q.cod) :: @@ -502,9 +503,9 @@ |= new/bone =. +> %- ra-emit :* new %diff %talk-lowdown %tales - %- ~(gas in *(map knot config)) + %- ~(gas in *(map knot (unit config))) %+ turn (~(tap by stories)) - |=({a/knot b/story} [a shape.b]) + |=({a/knot b/story} [a `shape.b]) == =. +> %- ra-emil :~ [new %diff %talk-lowdown %glyph nak] @@ -698,7 +699,7 @@ =. mirrors (~(put by mirrors) cuz con) ?: =(mirrors old) +>.$ - =. +>.$ (pa-inform %tales (strap man con)) + =. +>.$ (pa-inform %tales (strap man `con)) (pa-report-cabal pa-followers) :: ++ pa-diff-talk-report :: subscribed update @@ -720,10 +721,10 @@ ::x delete tay from our subscriptions, then send an updated capal report. :: |= tay/partner - ::TODO send deletion lowdown. - ::=. +> (pa-inform %tales ) - %. pa-followers - pa-report-cabal(sources.shape (~(del in sources.shape) tay)) + =. +> + %. pa-followers + pa-report-cabal(sources.shape (~(del in sources.shape) tay)) + (pa-inform %tales (strap man `shape)) :: ++ pa-sauce :: send backward ::x turns cards into moves, reverse order, prepend to existing moves. @@ -794,7 +795,7 @@ =. +>.$ (pa-acquire p.dif) =. +>.$ (pa-abjure q.dif) =. shape cof - =. +>.$ (pa-inform %tales (strap man cof)) + =. +>.$ (pa-inform %tales (strap man `cof)) (pa-report-cabal pa-followers) :: ++ pa-cancel :: unsubscribe from diff --git a/sur/talk.hoon b/sur/talk.hoon index e92001a58d..f83af0f4e1 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -61,9 +61,9 @@ :: this will aid with ++sh's printing. $% {$glyph (jug char (set partner))} :: new bindings {$names (map ship (unit human))} :: new identities - {$tales (map knot config)} :: changed config ::TODO cabal, or merge its contents into tale's config :: basically we just want to merge the ship sets, right? + {$tales (map knot (unit config))} :: changed config {$precs (pair knot atlas)} :: changed presence {$grams (pair knot (pair @ud (list telegram)))} :: new grams == :: From 718d88f3b7c755c7f7758668b692e62e74ae004d Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 30 Mar 2017 14:14:30 +0200 Subject: [PATCH 025/303] Moved some report-related parts of ++sh to be lowdown-oriented. --- app/talk-agent.hoon | 71 +++++++++------------------------------------ 1 file changed, 14 insertions(+), 57 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index caf09acb14..1acff006f9 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -129,46 +129,6 @@ ::x produce moves or sole-effects and moves. [[id.cli %diff %sole-effect u.foc] moz] :: - ++ ra-abet :: complete core - ::x applies talk reports, then produces moves and updated state. - :: - ra-abed:ra-axel - :: - ++ ra-axel :: rebound reports - ::x extracts and applies the talk-reports in moves meant for our shells. - :: - ^+ . - ::x separate talk-reports meant for our shells from other moves. - =+ ^= rey - |- ^- (pair (list move) (list (pair bone report))) - ?~ moves - [~ ~] - =+ mor=$(moves t.moves) - ::x if we know the target shell is ours, and it's a talk report, - ::x add it to the list of reports to be locally applied. - ?. ?& =(id.cli `bone`p.i.moves) - ?=({$diff $talk-report *} q.i.moves) - == - [[i.moves p.mor] q.mor] - [p.mor [[p.i.moves +>.q.i.moves] q.mor]] - ::x update moves to exclude our talk-reports. - =. moves p.rey - =. q.rey (flop q.rey) - ?: =(q.rey ~) + - |- ^+ +> - ?~ q.rey ra-axel - ::x apply reports to our shells. - ::TODO will this ever happen? yes: implement ra-back. no: delete sh-repo-* - =+ bak=(ra-back(ost.hid p.i.q.rey) q.i.q.rey) - $(q.rey t.q.rey, +> bak(ost.hid ost.hid)) - :: - ++ ra-back - ::x applies report. - :: - |= rad/report - ^+ +> - sh-abet:(~(sh-repo sh ~ cli) rad) - :: ++ ra-diff-talk-lowdown ::x process a talk lowdown :: @@ -236,16 +196,17 @@ ^+ +> =+ tal=(~(get by tales) man) ?~ tal ~&([%know-no-tale man] +>.$) - =. +>.$ sh-abet:(~(sh-repo-group-here sh ~ cli(p.owners locals.u.tal)) pes) + =. +>.$ sh-abet:(~(sh-low-precs sh ~ cli) locals.u.tal pes) +>.$(tales (~(put by tales) man u.tal(locals pes))) :: ++ ra-diff-talk-lowdown-grams ::x apply new grams :: |= {man/knot num/@ud gams/(list telegram)} + ^+ +> =+ tal=(~(get by tales) man) ?~ tal ~&([%know-no-tale man] +>.$) - =. +>.$ sh-abet:(~(sh-repo-grams sh ~ cli) num gams) + =. +>.$ sh-abet:(~(sh-low-grams sh ~ cli) num gams) pa-abet:(~(pa-lesson pa man u.tal) gams) :: ++ ra-emil :: ra-emit move list @@ -1027,6 +988,14 @@ (weld pre "set {(scow %p p.i.cha.cul)} {(sh-spaz q.i.cha.cul)}") +>.$ :: + ++ sh-low-precs + ::x print presence changes + :: + |= {old/atlas new/atlas} + ^+ +> + =+ dif=(sh-repo-atlas-diff old new) + (sh-repo-group-diff-here "" dif) + :: ++ sh-repo-group-here :: update local ::x updates local presence store and prints changes. :: @@ -1077,7 +1046,7 @@ =. +> (sh-repo-group-there q.ges) +> :: - ++ sh-repo-gram + ++ sh-low-gram ::x renders telegram: increase gram count and print the gram. ::x every fifth gram, prints the number. :: @@ -1091,25 +1060,13 @@ (sh-rend(count.she +(num)) gam) +> :: - ++ sh-repo-grams :: apply telegrams + ++ sh-low-grams :: apply telegrams ::x renders telegrams. :: |= {num/@ud gaz/(list telegram)} ^+ +> ?~ gaz +> - $(gaz t.gaz, num +(num), +> (sh-repo-gram num i.gaz)) - :: - ++ sh-repo :: apply report - ::x applies the different kinds of reports using their handler arms above - :: - |= rad/report - ^+ +> - :: ~& [%sh-repo rad] - ?- -.rad - $cabal (sh-repo-cabal +.rad) - $grams (sh-repo-grams +.rad) - $group (sh-repo-group +.rad) - == + $(gaz t.gaz, num +(num), +> (sh-low-gram num i.gaz)) :: ++ sh-sane-chat :: sanitize chatter ::x (for chat messages) sanitizes the input buffer and splits it into From f15a52a7f2c26d262e2eac98f0d48c6f43041c81 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 30 Mar 2017 14:17:37 +0200 Subject: [PATCH 026/303] Miscellaneous small changes, mostly comments and debugging. --- app/talk-agent.hoon | 60 ++++++++++++++++++++++++++---------------- app/talk-guardian.hoon | 52 +++++++++++++++++++++++------------- sur/talk.hoon | 10 +++++-- 3 files changed, 79 insertions(+), 43 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 1acff006f9..680ad1bd5d 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -1,10 +1,21 @@ :: :: :: :::: /hoon/talk-agent/app :: :: :: :: :: +:: +::TODO guardian's todo's apply here too +::TODO if we use a new structure for sending messages broker->reader, then we +:: can be safe in not doing permission checks. +::TODO actually send update moves when needed +::TODO process reports +::TODO init, general subscribe to broker. +::TODO? do we even need multiple shells? +::TODO rename cores. pa->ta (transaction), ta->pa (partner), etc. +:: /? 310 :: hoon version /- talk, sole :: structures /+ talk, sole, time-to-id, twitter :: libraries /= seed /~ !>(.) +!: :: :::: :: @@ -15,7 +26,7 @@ folks/(map ship human) :: human identities nik/(map (set partner) char) :: bound station glyphs nak/(jug char (set partner)) :: station glyph lookup - cli/shell :: interaction state + cli/shell :: interaction state == :: ++ tale :: user-facing story $: count/@ud :: (lent grams) @@ -24,6 +35,7 @@ shape/config :: configuration known/(map serial @ud) :: messages heard == :: + ::TODO do away with most of shell state, it's largely a mirror of tale..? ++ shell :: console session $: her/ship :: client identity id/bone :: identifier @@ -99,7 +111,7 @@ ::x moves: moves storage, added to by ++ra-emit and -emil, produced by -abed. |_ moves/(list move) :: - ++ ra-abed :: resolve core + ++ ra-abet :: resolve core ::x produces the moves stored in ++ra's moves. ::x sole-effects get special treatment to become a single move. :: @@ -183,6 +195,7 @@ %= +> tales %+ roll (~(tap by tals)) |= {t/(pair knot (unit config)) tas/_tales} + ~& [%r-new-config-for p.t] =. tas ?~(tas tales tas) ::x start with our current tales. =+ tal=(fall (~(get by tas) p.t) *tale) ?~ q.t (~(del by tas) p.t) @@ -235,7 +248,7 @@ ::x make a shell for her. :: |= {her/ship pax/path} - ~& [%ra-console her pax] + ~& [%ra-console her pax ost.hid] ^+ +> ::x get story from the path, default to standard mailbox. =/ man/knot @@ -245,12 +258,12 @@ == =/ she/shell %*(. *shell her her, man man, id ost.hid, active (sy [%& our.hid man] ~)) - sh-abet:~(sh-peer sh ~ she) + sh-abet:~(sh-prod sh ~ she) :: ++ ra-init ::x populate state on first boot. subscribes to our broker. :: - ~& %r-ra-init + ~& [%r-ra-init ost.hid] %- ra-emit :* ost.hid %peer @@ -355,6 +368,7 @@ ^+ +> +>(shape con) -- + :: ++ sh :: per console ::x shell core, responsible for doing things with console sessions, ::x like parsing input, acting based on input, showing output, keeping @@ -556,7 +570,7 @@ |= dup/update ^+ +> ::TODO is ost.hid okay here? or do we want to store bone of broker? - ~& [%update-to ost.hid] + ~& [%r-update-to ost.hid] %= +> moves :_ moves :* ost.hid @@ -567,16 +581,6 @@ == == :: - ++ sh-peer :: subscribe shell - ::x create a shell, subscribe to default stories. - :: - =< sh-prod - %_ . - +> - +> - ::TODO peer susbcribe to /sole and /sole/man.she at our broker. - == - :: ++ sh-prod :: show prompt ::x make and store a move to modify the cli prompt, displaying audience. :: @@ -668,7 +672,9 @@ ?: (~(has in lax) pan) `pan $(grams t.grams) :: - ::TODO we have a stdlib set diff now! + ::TODO can we really not do some shenanigans to make a generic maps diff? + :: that way we could do rogue- cabal- and house- diffs in one arm. + :: you want to be able to indicate return type based on map contents... ++ sh-repo-house-diff ::x calculates difference between two shelves (channel definitions). :: @@ -1341,6 +1347,7 @@ ++ nick :: %nick |= {her/(unit ship) nym/(unit cord)} ^+ ..sh-work + ::x no arguments ?: ?=({$~ $~} +<) %+ sh-fact %mor %+ turn (~(tap by folks)) @@ -1349,6 +1356,7 @@ ?~ hand.q "{

}:" "{

}: {}" + ::x unset nickname ?~ nym ?> ?=(^ her) =+ asc=(~(get by folks) u.her) @@ -1356,6 +1364,7 @@ ?~ asc "{} unbound" ?~ hand.u.asc "{}:" "{}: {}" + ::x get nickname ?~ her %+ sh-fact %mor %+ turn (reverse-folks u.nym) @@ -1394,6 +1403,12 @@ ?~(woe ..sh-work work(job u.woe)) :: ++ number :: %number + ::TODO !!!!! + ::TODO mistakes were made. turns out we need multiple shells after all! + ::TODO but that seems a bit hacky, surely we can do better than it was? + ::TODO ...just storing the telegrams in the order they were printed + :: doesn't seem clean enough though. + ::TODO !!!!! |= num/$@(@ud {p/@u q/@ud}) ^+ ..sh-work =+ roy=(~(got by tales) man.she) @@ -1744,7 +1759,7 @@ =+ txt=(tr-text =(who our.hid)) ?: =(~ txt) "" =+ ^= baw - :: ?: oug + :: ?: oug :: ~(te-whom te man tr-pals) ?. (~(has in sef) %noob) (~(sn-curt sn man [who (main who)]) |) @@ -1854,7 +1869,7 @@ $exp (tr-chow 66 '#' ' ' (trip p.sep)) $url =+ ful=(earf p.sep) ?: (gth 64 (lent ful)) ['/' ' ' ful] - :+ '/' '_' + :+ '/' '_' =+ hok=r.p.p.p.sep ~! hok =- (swag [a=(sub (max 64 (lent -)) 64) b=64] -) @@ -1891,7 +1906,7 @@ ?. ?=({$sole *} pax) ~& [%peer-talk-reader-strange pax] [~ +>] - ::~? (~(has by shells) ost.hid) [%talk-peer-replaced ost.hid pax] + ~& [%r-peer-sole ost.hid] ra-abet:(ra-console:ra src.hid t.pax) :: ::TODO move to lib. @@ -1933,10 +1948,9 @@ ++ prep ::x state adapter. :: - |= old/(unit chattel) - ra-abet:ra-init:ra + |= old/*::(unit chattel) ::^- (quip move ..prep) ::?~ old - :: ra-abet:ra-init:ra + ra-abet:ra-init:ra ::[~ ..prep(+<+ u.old)] -- diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 356e497018..188ab4bfea 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -1,19 +1,27 @@ -:: :: :: +:: :: :: :::: /hoon/talk/app :: :: - :: :: :: + :: :: :: :: ::TODO master changes ::TODO =/ instead of =+ ^= where possible ::TODO avoid lark where possible ::TODO remove old/unused code -::TODO improve naming -::TODO tidiness +::TODO improve naming. way->wir, rad->rep, etc. +::TODO tidiness, remove unnecessary ~&, etc. ::TODO better presence notifications. typing, idle... :: +::TODO crash on pokes/peers we do not expect +::TODO send %names report when a reader first connects +::TODO merge follower groups into followers +::TODO rename cores. ra->ta (transaction), pa->to (story). +::TODO maybe ensure every arm has a mini-description at :57 too? +::TODO maybe prefix all printfs and other errors with %talk? +:: /? 310 :: hoon version /- talk, sole :: structures /+ talk, sole, time-to-id, twitter :: libraries /= seed /~ !>(.) +!: :: :::: :: @@ -24,7 +32,7 @@ ++ house :: $: stories/(map knot story) :: conversations ::TODO rename to readers? - general/(set bone) :: meta-subscribe + general/(set bone) :: our message readers outbox/(pair @ud (map @ud thought)) :: urbit outbox log/(map knot @ud) :: logged to clay folks/(map ship human) :: human identities @@ -70,7 +78,6 @@ $% {$repeat p/@ud q/@p r/knot} :: {$friend p/knot q/station} :: == :: - ++ glyphs `wall`~[">=+-" "}),." "\"'`^" "$%&@"] :: station char pool' ++ strap |*({k/* v/*} (~(put by *(map _k _v)) k v)) -- |% @@ -128,7 +135,9 @@ q.nb -- -- +:: |_ {hid/bowl house} +:: ++ ra :: per transaction ::x gets called when talk gets poked or otherwise prompted/needs to perform ::x an action. @@ -138,9 +147,13 @@ :: ::x moves: moves storage, added to by ++ra-emit and -emil, produced by -abed. |_ moves/(list move) + :: ++ ra-abet :: resolve core ::x produces the moves stored in ++ra's moves. ::x sole-effects get special treatment to become a single move. + ::TODO this shouldn't ever make sole-effects anymore, so remove that logic. + ::TODO instead, we want to squash lowdown %names and %glyphs, + :: but figure out if that'll ever be needed first. :: ^+ [*(list move) +>] :_ +> @@ -185,6 +198,7 @@ ++ ra-init :: initialize talk ::x populate state on first boot. creates our main and public stories. :: + ~& %ra-init %+ roll ^- (list {posture knot cord}) :~ [%brown (main our.hid) 'default home'] @@ -356,9 +370,9 @@ :+ %design man :- ~ :- ~ :- 'letters to the editor' - [%brown ~] + [%brown ~] %^ ra-consume & our.hid - :^ (shaf %init eny.hid) + :^ (shaf %init eny.hid) (my [[%& our.hid (main our.hid)] *envelope %pending] ~) now.hid [~ %app %tree 'receiving comments, ;join %comments for details'] @@ -560,7 +574,6 @@ :: |= {pub/? her/ship tay/partner tip/thought} ^+ +> - :: ~& [%ra-conduct pub her tay] ?- -.tay $& ?: pub =. her our.hid :: XX security! @@ -748,7 +761,7 @@ $| ~& tweet-abjure+p.p.tay !! :: - $& ~& [%pa-abjure [our.hid man] [p.p.tay q.p.tay]] + $& ~& [%pa-abjure /[man]/(scot %p p.p.tay)/[q.p.tay]] :_ ~ :* %pull /friend/show/[man]/(scot %p p.p.tay)/[q.p.tay] @@ -761,7 +774,7 @@ ::x for each partner, produce a %peer/subscribe move. :: |= tal/(list partner) - %+ pa-sauce 0 + %+ pa-sauce 0 ::x subscription is caused by this app %- zing %+ turn tal |= tay/partner @@ -775,6 +788,7 @@ $| !! $& :: ~& [%pa-acquire [our.hid man] [p.p.tay q.p.tay]] :_ ~ + ~& [%pa-acquire /[man]/(scot %p p.p.tay)/[q.p.tay]] :* %peer /friend/show/[man]/(scot %p p.p.tay)/[q.p.tay] [p.p.tay %talk-guardian] @@ -817,6 +831,7 @@ ::x adds tay's loc to our remote presence map, after merging with rem. ::x if this changes anything, send update report. :: + ::TODO stop using timed. |= {tay/partner loc/atlas rem/(map partner atlas)} ::x remove this story from the presence map, since it's in local already. =. rem (~(del by rem) %& our.hid man) :: superceded by local data @@ -972,7 +987,7 @@ |= {num/@ud gam/telegram} =+ way=(sub count num) ?: =(gam (snag (dec way) grams)) - +>.$ :: no change + +>.$ :: no change =. grams (welp (scag (dec way) grams) [gam (slag way grams)]) (pa-refresh num gam) -- @@ -982,6 +997,7 @@ ::x incoming subscription on pax. :: |= pax/path + ~& [%b-peer pax src.hid ost.hid] ^+ [*(list move) +>] ~? !(team src.hid our.hid) [%peer-talk-stranger src.hid] ra-abet:(ra-subscribe:ra src.hid pax) @@ -1003,7 +1019,7 @@ |= dup/update ra-abet:(ra-update:ra src.hid dup) :: -++ diff-talk-report :: +++ diff-talk-report :: accept report ::x incoming talk-report. process it and update logs. :: |= {way/wire rad/report} @@ -1028,7 +1044,7 @@ |= way/wire ^- weir ?+ -.way !! - $friend + $friend ?> ?=({$show @ @ @ $~} t.way) [%friend i.t.t.way (slav %p i.t.t.t.way) i.t.t.t.t.way] :: @@ -1070,7 +1086,7 @@ ra-abet:(ra-retry:ra man cuz) :: ++ pull :: - ::x unsubscribe. remove from story and shells. + ::x unsubscribe. :: |= pax/path ^+ [*(list move) +>] @@ -1160,8 +1176,8 @@ ::x state adapter. :: |= old/(unit house) - ^- (quip move ..prep) - ?~ old + ::^- (quip move ..prep) + ::?~ old ra-abet:ra-init:ra - [~ ..prep(+<+ u.old)] + ::[~ ..prep(+<+ u.old)] -- diff --git a/sur/talk.hoon b/sur/talk.hoon index f83af0f4e1..b63fb7e5b2 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -1,4 +1,4 @@ -:: +:: :::: /hoon/talk/sur !: |% @@ -35,7 +35,7 @@ ++ envelope (pair ? (unit partner)) :: visible sender ++ flavor path :: content flavor ++ human :: human identifier - $: true/(unit (trel @t (unit @t) @t)) :: true name + $: true/(unit (trel @t (unit @t) @t)) ::TODO used? true name hand/(unit @t) :: handle == :: ++ passport :: foreign flow @@ -64,6 +64,7 @@ ::TODO cabal, or merge its contents into tale's config :: basically we just want to merge the ship sets, right? {$tales (map knot (unit config))} :: changed config + ::TODO merge remote and local presences. {$precs (pair knot atlas)} :: changed presence {$grams (pair knot (pair @ud (list telegram)))} :: new grams == :: @@ -71,6 +72,10 @@ $% {$lan p/knot q/@t} :: local announce {$exp p/@t} :: hoon line {$non $~} :: no content (yo) + ::TODO so, this is extensibility tacked on, rather than built-in? + :: really, talk has been two-split but the guardian is still two + :: things at once. you want base-guardian and talk-guardian. + :: ...that's probably what %gall is, but then why do we have $ext? {$ext p/@tas q/*} :: extended action {$fat p/torso q/speech} :: attachment :: {$inv p/station} :: invite to station @@ -78,6 +83,7 @@ {$ire p/serial q/speech} :: in-reply-to {$lin p/? q/@t} :: no/@ text line {$mor p/(list speech)} :: multiplex + ::TODO? what are p and q supposed to be? {$app p/@tas q/@t} :: app message $: $api :: api message service/@tas :: service name From 7d8e0e8e332ae99480db053f9f8e665266b5fa2d Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 30 Mar 2017 15:23:52 +0200 Subject: [PATCH 027/303] Removed remote mirrors (federation) from guardian. --- app/talk-guardian.hoon | 46 +++++++++++++----------------------------- sur/talk.hoon | 4 ++-- 2 files changed, 16 insertions(+), 34 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 188ab4bfea..4f4d41d9f2 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -42,9 +42,7 @@ ++ story :: wire content $: count/@ud :: (lent grams) grams/(list telegram) :: all history - locals/atlas :: local presence - remotes/(map partner atlas) :: remote presence - mirrors/(map station config) :: remote config + locals/atlas :: presence sequence/(map partner @ud) :: partners heard shape/config :: configuration known/(map serial @ud) :: messages heard @@ -682,38 +680,27 @@ +>.$ :: ++ pa-report-group :: update presence - ::x build a group report, containing our different presence maps, and - ::x send it to all bones. - ::x we send remote presences to facilitate federation. aka "relay" + ::x build a group report, containing our presence map, and send it to all + ::x bones. :: |= vew/(set bone) - %^ pa-report vew %group - :- locals - %- ~(urn by remotes) :: XX preformance - |= {pan/partner atl/atlas} ^- atlas - ?. &(?=($& -.pan) =(our.hid p.p.pan)) atl - =+ soy=(~(get by stories) q.p.pan) - ?~ soy atl - locals.u.soy + (pa-report vew %group locals) :: ++ pa-report-cabal :: update config ::x a cabal report, containing our and remote configs, to all bones. :: |= vew/(set bone) - (pa-report vew %cabal shape mirrors) + (pa-report vew %cabal shape) :: ++ pa-cabal ::x add station's config to our remote config map. - ::TODO if web frontend doesn't use ham, remove it (also from sur/talk) :: - |= {cuz/station con/config ham/(map station config)} + |= con/config ^+ +> - =+ old=mirrors - =. mirrors (~(put by mirrors) cuz con) - ?: =(mirrors old) + ?: =(shape con) +>.$ =. +>.$ (pa-inform %tales (strap man `con)) - (pa-report-cabal pa-followers) + (pa-report-cabal(shape con) pa-followers) :: ++ pa-diff-talk-report :: subscribed update ::x process a talk report from cuz. @@ -725,8 +712,8 @@ ~& [%pa-diff-unexpected cuz rad] +> ?- -.rad - $cabal (pa-cabal cuz +.rad) - $group (pa-remind [%& cuz] +.rad) + $cabal (pa-cabal +.rad) + $group (pa-remind +.rad) $grams (pa-lesson q.+.rad) == :: @@ -827,18 +814,13 @@ ?: =(nol locals) +>.$ (pa-report-group(locals nol) pa-followers) :: - ++ pa-remind :: remote presence + ++ pa-remind :: update presence ::x adds tay's loc to our remote presence map, after merging with rem. ::x if this changes anything, send update report. :: - ::TODO stop using timed. - |= {tay/partner loc/atlas rem/(map partner atlas)} - ::x remove this story from the presence map, since it's in local already. - =. rem (~(del by rem) %& our.hid man) :: superceded by local data - =/ buk (~(uni timed remotes) rem) :: XX drop? - =. buk (~(put timed buk) tay now.hid loc) - ?: =(~(strip timed buk) ~(strip timed remotes)) +>.$ - (pa-report-group(remotes buk) pa-followers) + |= loc/atlas + ?: =(loc locals) +> + (pa-report-group(locals loc) pa-followers) :: ++ pa-start :: start stream ::x grab all telegrams that fall within the river and send them in a diff --git a/sur/talk.hoon b/sur/talk.hoon index b63fb7e5b2..c9beac249f 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -51,10 +51,10 @@ ++ register (pair atlas (map partner atlas)) :: ping me, ping srcs ++ shelf (map knot (pair posture cord)) :: ship shape ++ report :: talk update - $% {$cabal cabal} :: config neighborhood + $% {$cabal config} :: config neighborhood :: {$folder (list report)} :: multiple {$grams (pair @ud (list telegram))} :: beginning thoughts - {$group register} :: presence + {$group atlas} :: presence == :: ++ lowdown :: changed shared state ::TODO change these so that they're always just the diff. From 6a15fb2cab762d09772387cf0a5fa3efee46e713 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 30 Mar 2017 18:04:47 +0200 Subject: [PATCH 028/303] Removed remote mirrors (federation) from agent's shell. Now passing ++sh tale knots instead of being specified within shell. --- app/talk-agent.hoon | 311 ++++++++------------------------------------ 1 file changed, 55 insertions(+), 256 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 680ad1bd5d..760f9b2197 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -31,21 +31,16 @@ ++ tale :: user-facing story $: count/@ud :: (lent grams) grams/(list telegram) :: all history - locals/atlas :: local presence + locals/atlas :: presence shape/config :: configuration known/(map serial @ud) :: messages heard == :: ::TODO do away with most of shell state, it's largely a mirror of tale..? ++ shell :: console session - $: her/ship :: client identity - id/bone :: identifier - man/knot :: mailbox + $: id/bone :: identifier count/@ud :: messages shown say/sole-share :: console state active/(set partner) :: active targets - owners/register :: presence mirror - harbor/(map knot (pair posture cord)) :: stations mirror - system/cabal :: config mirror settings/(set knot) :: frontend settings == :: :: :: @@ -165,7 +160,7 @@ %+ turn (~(tap by nek)) |= {a/char b/(set (set partner))} (turn (~(tap by b)) |=(c/(set partner) [c a])) - sh-abet:~(sh-prod sh ~ cli) + sh-abet:~(sh-prod sh ~ cli (main our.hid)) ::TODO mailbox not used :: ++ ra-diff-talk-lowdown-names ::x apply new local identities. @@ -191,7 +186,8 @@ :: |= tals/(map knot (unit config)) ^+ +> - ::TODO for every config, (sh-repo-config-show "" oldconfig newconfig) + ::TODO for every changed config, (sh-low-config oldconfig newconfig) + :: maybe something else for new/removed tales? %= +> tales %+ roll (~(tap by tals)) |= {t/(pair knot (unit config)) tas/_tales} @@ -209,7 +205,7 @@ ^+ +> =+ tal=(~(get by tales) man) ?~ tal ~&([%know-no-tale man] +>.$) - =. +>.$ sh-abet:(~(sh-low-precs sh ~ cli) locals.u.tal pes) + =. +>.$ sh-abet:(~(sh-low-precs sh ~ cli man) locals.u.tal pes) +>.$(tales (~(put by tales) man u.tal(locals pes))) :: ++ ra-diff-talk-lowdown-grams @@ -219,7 +215,7 @@ ^+ +> =+ tal=(~(get by tales) man) ?~ tal ~&([%know-no-tale man] +>.$) - =. +>.$ sh-abet:(~(sh-low-grams sh ~ cli) num gams) + =. +>.$ sh-abet:(~(sh-low-grams sh ~ cli man) num gams) pa-abet:(~(pa-lesson pa man u.tal) gams) :: ++ ra-emil :: ra-emit move list @@ -242,7 +238,8 @@ ?. =(id.cli ost.hid) ~& %strange-sole !! - sh-abet:(~(sh-sole sh ~ cli) act) + ::TODO but there's not actually a tale to specify. mailbox is "fake"! + sh-abet:(~(sh-sole sh ~ cli (main our.hid)) act) :: ++ ra-console ::x make a shell for her. @@ -257,8 +254,8 @@ {@ta $~} i.pax == =/ she/shell - %*(. *shell her her, man man, id ost.hid, active (sy [%& our.hid man] ~)) - sh-abet:~(sh-prod sh ~ she) + %*(. *shell id ost.hid, active (sy [%& our.hid man] ~)) + sh-abet:~(sh-prod sh ~ she man) :: ++ ra-init ::x populate state on first boot. subscribes to our broker. @@ -383,6 +380,7 @@ :: coz/(list command) she/shell + man/knot == ++ sh-scad :: command parser ::x builds a core with parsers for talk-cli, and produces its work arm. @@ -418,7 +416,7 @@ :: ++ stan :: station ;~ pose - (cold [our.hid man.she] col) + (cold [our.hid (main our.hid)] col) ;~(pfix cen (stag our.hid sym)) ;~(pfix fas (stag (sein our.hid) sym)) :: @@ -593,7 +591,7 @@ =+ cha=(~(get by nik) q.rew) ?^ cha ~[u.cha ' '] :: ~& [rew nik nak] - =+ por=~(te-prom te man.she q.rew) + =+ por=~(te-prom te man q.rew) (weld `tape`[p.p.rew por] `tape`[q.p.rew ' ' ~]) :: ++ sh-pact :: update active aud @@ -612,7 +610,7 @@ :: |= paz/(set partner) ?: (sh-pear paz) paz - (~(put in paz) [%& our.hid man.she]) + (~(put in paz) [%& our.hid (main our.hid)]) :: ++ sh-pear :: hearback ::x produces true if any partner is included in our subscriptions, @@ -620,20 +618,22 @@ :: |= paz/(set partner) ?~ paz | + ::TODO hoon does short-circuiting, right? do the has first, then recurse. ?| $(paz l.paz) $(paz r.paz) - (~(has in sources.shape:(~(got by tales) man.she)) `partner`n.paz) + (~(has in sources.shape:(~(got by tales) man)) `partner`n.paz) == :: ++ sh-pest :: report listen ::x updates audience to be tay, only if tay is not a village/%white. ::x? why exclude village (invite-only?) audiences from this? :: + ::TODO does this still do the correct thing? |= tay/partner ^+ +> ?. ?=($& -.tay) +> ::x if partner is a passport, do nothing. - =+ sib=(~(get by ham.system.she) `station`p.tay) ::x get config for tay - ?. |(?=($~ sib) !?=($white p.cordon.u.sib)) + =+ tal=(~(get by tales) q.p.tay) + ?. |(?=($~ tal) !?=($white p.cordon.shape.u.tal)) +>.$ (sh-pact [tay ~ ~]) :: @@ -642,7 +642,7 @@ ::x and updates the selected audience to match the telegram's. :: |= gam/telegram - =+ lin=~(tr-line tr man.she settings.she gam) + =+ lin=~(tr-line tr man settings.she gam) (sh-fact %txt lin) :: ++ sh-numb :: print msg number @@ -664,7 +664,7 @@ ?: =(~ lax) ~ ::x no partner. ?: ?=({* $~ $~} lax) `n.lax ::x single partner. ::x in case of multiple partners, pick the most recently active one. - =+ grams=grams:(~(got by tales) man.she) + =+ grams=grams:(~(got by tales) man) ::TODO probably no longer correct. |- ^- (unit (set partner)) ?~ grams ~ ::x get first partner from a telegram's audience. @@ -672,39 +672,6 @@ ?: (~(has in lax) pan) `pan $(grams t.grams) :: - ::TODO can we really not do some shenanigans to make a generic maps diff? - :: that way we could do rogue- cabal- and house- diffs in one arm. - :: you want to be able to indicate return type based on map contents... - ++ sh-repo-house-diff - ::x calculates difference between two shelves (channel definitions). - :: - |= {one/shelf two/shelf} - =| $= ret - $: old/(list (pair knot (pair posture cord))) - new/(list (pair knot (pair posture cord))) - cha/(list (pair knot (pair posture cord))) - == - ^+ 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-repo-atlas-diff ::x calculates the difference between two atlasses (presence lists). :: @@ -741,67 +708,6 @@ ret ret :: - ++ sh-repo-cabal-diff - ::x calculates the difference between two cabals (station configurations) - :: - |= {one/(map station config) two/(map station config)} - =| $= ret - $: old/(list (pair station config)) - new/(list (pair station config)) - cha/(list (pair station 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-repo-rogue-diff - ::x calculates the difference between two maps of stations and their - ::x presence lists. - :: - |= {one/(map partner atlas) two/(map partner atlas)} - =| $= ret - $: old/(list (pair partner atlas)) - new/(list (pair partner atlas)) - cha/(list (pair partner atlas)) - == - ^+ 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 ::x calculates the difference between two sets, ::x returning what was lost in old and what was gained in new. @@ -849,12 +755,12 @@ |- ^+ +>.^$ ?~ old +>.^$ =. +>.^$ $(old t.old) - (sh-note (weld pre "off {~(ta-full ta man.she i.old)}")) + (sh-note (weld pre "off {~(ta-full ta man i.old)}")) =. +>.$ |- ^+ +>.^$ ?~ new +>.^$ =. +>.^$ $(new t.new) - (sh-note (weld pre "hey {~(ta-full ta man.she i.new)}")) + (sh-note (weld pre "hey {~(ta-full ta man i.new)}")) +>.$ :: ++ sh-repo-config-show @@ -867,88 +773,25 @@ (sh-note :(weld pre "cap " (trip caption.loc))) =. +>.$ %+ sh-repo-config-sources - (weld (trip man.she) ": ") + (weld (trip man) ": ") (sh-set-diff sources.laz sources.loc) ?: !=(p.cordon.loc p.cordon.laz) =. +>.$ (sh-note :(weld pre "but " (sh-puss p.cordon.loc))) %^ sh-repo-config-exceptions - (weld (trip man.she) ": ") + (weld (trip man) ": ") p.cordon.loc [~ (~(tap in q.cordon.loc))] %^ sh-repo-config-exceptions - (weld (trip man.she) ": ") + (weld (trip man) ": ") p.cordon.loc (sh-set-diff q.cordon.laz q.cordon.loc) :: - ++ sh-repo-cabal-changes - ::x used by ++sh-repo-cabal for printing cabal config changes to cli. - :: - |= $: laz/(map station config) - old/(list (pair station config)) - new/(list (pair station config)) - cha/(list (pair station config)) - == - =. +>.$ - |- ^+ +>.^$ - ?~ new +>.^$ - =. +>.^$ $(new t.new) - =. +>.^$ (sh-pest [%& p.i.new]) - %+ sh-repo-config-show - (weld ~(sn-phat sn man.she p.i.new) ": ") - [*config q.i.new] - =. +>.$ - |- ^+ +>.^$ - ?~ cha +>.^$ - =. +>.^$ $(cha t.cha) - %+ sh-repo-config-show - (weld ~(sn-phat sn man.she p.i.cha) ": ") - [(~(got by laz) `station`p.i.cha) q.i.cha] - +>.$ - :: - ++ sh-repo-cabal + ++ sh-low-config ::x updates the current shell's cabal and prints changes to cli. :: - |= bal/cabal + |= {old/config new/config} ^+ +> - =+ laz=system.she - =. system.she bal - =. +>.$ - %+ sh-repo-cabal-changes ham.laz - (sh-repo-cabal-diff ham.laz ham.bal) - (sh-repo-config-show "" loc.laz loc.bal) - :: - ++ sh-repo-house - ::x applies new shelf ("house"?) and prints changes to cli. - :: - |= awl/shelf - ^+ +> - ~& [%sh-repo-house awl] - =+ dif=(sh-repo-house-diff harbor.she awl) - =. harbor.she awl - =. +>.$ - |- ^+ +>.^$ - ?~ old.dif +>.^$ - =. +>.^$ $(old.dif t.old.dif) - (sh-note "cut {(sh-puss p.q.i.old.dif)} %{(trip p.i.old.dif)}") - =. +>.$ - |- ^+ +>.^$ - ?~ new.dif +>.^$ - =. +>.^$ $(new.dif t.new.dif) - =+ :* nam=(trip p.i.new.dif) - por=(sh-puss p.q.i.new.dif) - des=(trip q.q.i.new.dif) - == - (sh-note "new {por} %{nam}: {des}") - =. +>.$ - |- ^+ +>.^$ - ?~ cha.dif +>.^$ - =. +>.^$ $(cha.dif t.cha.dif) - =+ :* nam=(trip p.i.cha.dif) - por=(sh-puss p.q.i.cha.dif) - des=(trip q.q.i.cha.dif) - == - (sh-note "mod %{nam}: {por}, {des}") - +>.$ + (sh-repo-config-show "" old new) :: ++ sh-note :: shell message ::x prints a txt to cli in talk's format. @@ -1002,56 +845,6 @@ =+ dif=(sh-repo-atlas-diff old new) (sh-repo-group-diff-here "" dif) :: - ++ sh-repo-group-here :: update local - ::x updates local presence store and prints changes. - :: - |= loc/atlas - ^+ +> - =+ cul=(sh-repo-atlas-diff p.owners.she loc) - =. p.owners.she loc - (sh-repo-group-diff-here "" cul) - :: - ++ sh-repo-group-there :: update foreign - ::x updates remote presences(?) and prints changes. - :: - |= yid/(map partner atlas) - =+ day=(sh-repo-rogue-diff q.owners.she yid) - =+ dun=q.owners.she - =. q.owners.she yid - ?: (~(has in settings.she) %quiet) - +>.$ - =. +>.$ - |- ^+ +>.^$ - ?~ old.day +>.^$ - =. +>.^$ $(old.day t.old.day) - (sh-note (weld "not " (~(ta-show ta man.she p.i.old.day) ~))) - =. +>.$ - |- ^+ +>.^$ - ?~ new.day +>.^$ - =. +>.^$ $(new.day t.new.day) - =. +>.^$ - (sh-note (weld "new " (~(ta-show ta man.she p.i.new.day) ~))) - (sh-repo-group-diff-here "--" ~ (~(tap by q.i.new.day)) ~) - =. +>.$ - |- ^+ +>.^$ - ?~ cha.day +>.^$ - =. +>.^$ $(cha.day t.cha.day) - =. +>.^$ - (sh-note (weld "for " (~(ta-show ta man.she p.i.cha.day) ~))) - =+ yez=(~(got by dun) p.i.cha.day) - %+ sh-repo-group-diff-here "--" - (sh-repo-atlas-diff yez q.i.cha.day) - +>.$ - :: - ++ sh-repo-group - ::x update local and remote presences. - :: - |= ges/register - ^+ +> - =. +> (sh-repo-group-here p.ges) - =. +> (sh-repo-group-there q.ges) - +> - :: ++ sh-low-gram ::x renders telegram: increase gram count and print the gram. ::x every fifth gram, prints the number. @@ -1194,7 +987,7 @@ :: |= job/work ^+ +> - =+ roy=(~(got by tales) man.she) + =+ roy=(~(got by tales) man) =< work |% ++ work @@ -1223,7 +1016,7 @@ ++ activate :: from %number |= gam/telegram ^+ ..sh-work - =+ tay=~(. tr man.she settings.she gam) + =+ tay=~(. tr man settings.she gam) =. ..sh-work (sh-fact tr-fact:tay) sh-prod(active.she tr-pals:tay) :: @@ -1257,17 +1050,17 @@ ?^ - (sh-note "has glyph {}") =+ cha=(glyph (mug pan)) (sh-note:(set-glyph cha pan) "new glyph {}") - =+ loc=loc.system.she + =+ loc=shape:(~(got by tales) man) ::x change local mailbox config to include subscription to pan. - %^ sh-tell %design man.she + %^ sh-tell %design man `loc(sources (~(uni in sources.loc) pan)) :: ++ leave :: %leave |= pan/(set partner) ^+ ..sh-work - =+ loc=loc.system.she + =+ loc=shape:(~(got by tales) man) ::x change local mailbox config to exclude subscription to pan. - %^ sh-tell %design man.she + %^ sh-tell %design man `loc(sources (~(dif in sources.loc) pan)) :: ++ what :: %what @@ -1282,17 +1075,23 @@ :: ++ who :: %who |= pan/(set partner) ^+ ..sh-work - =< (sh-fact %mor (murn (sort (~(tap by q.owners.she) ~) aor) .)) - |= {pon/partner alt/atlas} ^- (unit sole-effect) - ?. |(=(~ pan) (~(has in pan) pon)) ~ - =- `[%tan rose+[", " `~]^- leaf+~(ta-full ta man.she pon) ~] - =< (murn (sort (~(tap by alt)) aor) .) - |= {a/ship b/presence c/human} ^- (unit tank) :: XX names - ?- b - $gone ~ - $hear `>a< - $talk `>a< :: XX difference - == + ::TODO clever use of =< and . take note! + ::TODO test/fix/update + =< (sh-fact %mor (murn (sort (~(tap by tales) ~) aor) .)) + |= {nam/knot tal/tale} + ~ + ::=< (sh-fact %mor (murn (sort (~(tap by q.owners.she) ~) aor) .)) + ::|= {pon/partner alt/atlas} ^- (unit sole-effect) + ::?. |(=(~ pan) (~(has in pan) pon)) ~ + ::=- `[%tan rose+[", " `~]^- leaf+~(ta-full ta man.she pon) ~] + ::=< (murn (sort (~(tap by alt)) aor) .) + ::|= {a/ship b/presence c/human} ^- (unit tank) + ::::TODO print human names. + ::?- b + :: $gone ~ + :: $hear `>a< + :: $talk `>a< :: XX difference + ::== :: ++ bind :: %bind |= {cha/char pan/(unit (set partner))} ^+ ..sh-work @@ -1330,7 +1129,7 @@ ::x create new config for channel. %^ sh-tell %design nom :- ~ - :+ *(set partner) + :+ [[%& our.hid nom] ~ ~] (end 3 64 txt) [por ~] (join [[%& our.hid nom] ~ ~]) @@ -1411,7 +1210,7 @@ ::TODO !!!!! |= num/$@(@ud {p/@u q/@ud}) ^+ ..sh-work - =+ roy=(~(got by tales) man.she) + =+ roy=(~(got by tales) man) ::TODO see above |- ?@ num ?: (gte num count.roy) From fdc36b3688430cd38adae52203a54a016afd7afa Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 30 Mar 2017 21:28:36 +0200 Subject: [PATCH 029/303] Updated the talk report mark to match changes to the structure. --- mar/talk/report.hoon | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/mar/talk/report.hoon b/mar/talk/report.hoon index b293162596..f915da615b 100644 --- a/mar/talk/report.hoon +++ b/mar/talk/report.hoon @@ -19,9 +19,9 @@ => + |^ %+ joba -.rep ?- -.rep - $cabal (cabl +.rep) + $cabal (conf +.rep) $grams (jobe num+(jone p.rep) tele+[%a (turn q.rep gram)] ~) - $group (jobe local+(grop p.rep) global+%.(q.rep (jome parn grop)) ~) + $group (grop +.rep) == ++ joce |=(a/knot [%s a]) :: @@ -118,13 +118,6 @@ (jobe first+[%s p] middle+?~(q ~ [%s u.q]) last+[%s r] ~) ~ :: - ++ cabl - |= cabal - %- jobe :~ - loc+(conf loc) - ham+((jome stat conf) ham) - == - :: ++ sorc |= a/(set partner) ^- json [%a (turn (~(tap in a)) |=(b/partner s+(parn b)))] From 6c20c8d0fe27caaf9f4f96309aa0773b60549667 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 30 Mar 2017 23:56:48 +0200 Subject: [PATCH 030/303] Fixed error in %glyph lowdown construction and improved its handling. --- app/talk-agent.hoon | 2 ++ app/talk-guardian.hoon | 8 +++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 760f9b2197..93f66cb550 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -154,6 +154,8 @@ :: |= nek/_nak ^+ +> + ?: =(nek nak) + +> =. nak nek =. nik %- ~(gas by *(map (set partner) char)) =- (zing `(list (list {(set partner) char}))`-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 4f4d41d9f2..241b9ddd39 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -279,11 +279,9 @@ (strap her ?~(hand.q.dup ~ `q.dup)) :: $bind ::x set glyph binding. - %. [%glyph nak] - %= ra-inform - nik (~(put by nik) q.dup p.dup) - nak (~(put ju nak) p.dup q.dup) - == + =. nik (~(put by nik) q.dup p.dup) + =. nak (~(put ju nak) p.dup q.dup) + (ra-inform %glyph nak) == :: ++ ra-config :: configure story From 8ac81e570dcd3ac1a9f0215e9e4e7eb0c858b611 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 30 Mar 2017 23:57:49 +0200 Subject: [PATCH 031/303] Removed unused ++etch arms from agent. --- app/talk-agent.hoon | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 93f66cb550..ac2391f556 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -1710,30 +1710,6 @@ ~& [%r-peer-sole ost.hid] ra-abet:(ra-console:ra src.hid t.pax) :: -::TODO move to lib. -++ etch :: parse wire - ::x parse wire to obtain either %friend with story and station or %repeat - ::x with message number, source ship and story. - :: - |= way/wire - ^- weir - ?+ -.way !! - $friend - ?> ?=({$show @ @ @ $~} t.way) - [%friend i.t.t.way (slav %p i.t.t.t.way) i.t.t.t.t.way] - :: - $repeat - ?> ?=({@ @ @ $~} t.way) - [%repeat (slav %ud i.t.way) (slav %p i.t.t.way) i.t.t.t.way] - == -:: -++ etch-friend :: - ::x parse a /friend wire, call gate with resulting data. - :: - |= {way/wire fun/$-({man/knot cuz/station} {(list move) _.})} - =+ wer=(etch way) - ?>(?=($friend -.wer) (fun p.wer q.wer)) -:: ++ diff-talk-lowdown ::x incoming talk-lowdown. process it. :: From 40b01138e4a626b651b7fd2db592b9902398da5c Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 31 Mar 2017 12:46:40 +0200 Subject: [PATCH 032/303] Fixed issue where audience wasn't getting set on create/join. --- app/talk-agent.hoon | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index ac2391f556..cecbcca4e1 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -1052,6 +1052,8 @@ ?^ - (sh-note "has glyph {}") =+ cha=(glyph (mug pan)) (sh-note:(set-glyph cha pan) "new glyph {}") + =. ..sh-work + sh-prod(active.she pan) =+ loc=shape:(~(got by tales) man) ::x change local mailbox config to include subscription to pan. %^ sh-tell %design man From 4af1e444673d09f6acf2d840289b546bb529df80 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 31 Mar 2017 15:01:17 +0200 Subject: [PATCH 033/303] Properly send, process and show presences. --- app/talk-agent.hoon | 34 ++++++++++++++++++---------------- app/talk-guardian.hoon | 1 + 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index cecbcca4e1..d4cfd66e7a 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -207,8 +207,10 @@ ^+ +> =+ tal=(~(get by tales) man) ?~ tal ~&([%know-no-tale man] +>.$) - =. +>.$ sh-abet:(~(sh-low-precs sh ~ cli man) locals.u.tal pes) - +>.$(tales (~(put by tales) man u.tal(locals pes))) + =+ new=(~(uni by pes) locals.u.tal) + ?: =(locals.u.tal new) +>.$ + =. +>.$ sh-abet:(~(sh-low-precs sh ~ cli man) locals.u.tal new) + +>.$(tales (~(put by tales) man u.tal(locals new))) :: ++ ra-diff-talk-lowdown-grams ::x apply new grams @@ -1080,22 +1082,22 @@ ++ who :: %who |= pan/(set partner) ^+ ..sh-work ::TODO clever use of =< and . take note! - ::TODO test/fix/update + ::TODO actually use the correct station. + ~& [%who-ing pan] =< (sh-fact %mor (murn (sort (~(tap by tales) ~) aor) .)) |= {nam/knot tal/tale} - ~ - ::=< (sh-fact %mor (murn (sort (~(tap by q.owners.she) ~) aor) .)) - ::|= {pon/partner alt/atlas} ^- (unit sole-effect) - ::?. |(=(~ pan) (~(has in pan) pon)) ~ - ::=- `[%tan rose+[", " `~]^- leaf+~(ta-full ta man.she pon) ~] - ::=< (murn (sort (~(tap by alt)) aor) .) - ::|= {a/ship b/presence c/human} ^- (unit tank) - ::::TODO print human names. - ::?- b - :: $gone ~ - :: $hear `>a< - :: $talk `>a< :: XX difference - ::== + ^- (unit sole-effect) + ?. |(=(~ pan) (~(any in pan) ~(has in sources.shape.tal))) ~ + =- `[%tan rose+[", " `~]^- leaf+~(ta-full ta man [%& ~zod nam]) ~] + =< (murn (sort (~(tap by locals.tal)) aor) .) + |= {a/ship b/presence c/human} ^- (unit tank) + ::TODO print human names. + ~& %present + ?- b + $gone ~ + $hear `>a< + $talk `>a< :: XX difference + == :: ++ bind :: %bind |= {cha/char pan/(unit (set partner))} ^+ ..sh-work diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 241b9ddd39..bdf1c7f16d 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -810,6 +810,7 @@ ^+ +> =/ nol (~(put by locals) her saz) ?: =(nol locals) +>.$ + =. +>.$ (pa-inform %precs man (strap her saz)) (pa-report-group(locals nol) pa-followers) :: ++ pa-remind :: update presence From 29034fc5a14d794a5cbf24e5545a8c015f66f805 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 31 Mar 2017 15:53:58 +0200 Subject: [PATCH 034/303] Fixed the order in which lowdowns get sent: %tales should always go first. --- app/talk-guardian.hoon | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index bdf1c7f16d..f529223cf8 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -511,13 +511,12 @@ ::x brings reader new up to date. :: |= new/bone - =. +> %- ra-emit + =. +> %- ra-emil :~ :* new %diff %talk-lowdown %tales %- ~(gas in *(map knot (unit config))) %+ turn (~(tap by stories)) |=({a/knot b/story} [a `shape.b]) == - =. +> %- ra-emil :~ [new %diff %talk-lowdown %glyph nak] [new %diff %talk-lowdown %names (~(run by folks) some)] == @@ -786,6 +785,7 @@ ::x partners we gained/lost, and send out an updated cabal report. :: |= cof/config + =. +>.$ (pa-inform %tales (strap man `cof)) =+ ^= dif ^- (pair (list partner) (list partner)) =+ old=`(list partner)`(~(tap in sources.shape) ~) =+ new=`(list partner)`(~(tap in sources.cof) ~) @@ -794,7 +794,6 @@ =. +>.$ (pa-acquire p.dif) =. +>.$ (pa-abjure q.dif) =. shape cof - =. +>.$ (pa-inform %tales (strap man `cof)) (pa-report-cabal pa-followers) :: ++ pa-cancel :: unsubscribe from From c0a8d7ba5cf8b3e19258a63654baa73317cc5661 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 3 Apr 2017 12:44:05 +0200 Subject: [PATCH 035/303] $design commands can now actually delete stories again. --- app/talk-guardian.hoon | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index f529223cf8..3ed48aa894 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -227,7 +227,8 @@ ::TODO untangle into ++ra-unconfig, ++pa-reform-gone instead of using :: bunts or empty keys. :: be sure to send a deletion %tales lowdown! - (ra-config(stories (~(del by stories) p.cod)) p.cod *config) + =. +>.$ (ra-config p.cod *config) + +>.$(stories (~(del by stories) p.cod)) (ra-config p.cod u.q.cod) :: ::x used for relaying messages (as a station host). From e36aed977884cc3d7243168b791a79016c7947da Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 3 Apr 2017 14:42:09 +0200 Subject: [PATCH 036/303] Undid removal of federation functionality to facilitate traditional mailbox behavior. The default mailbox gets used to contain foreign stories. --- app/talk-guardian.hoon | 47 ++++++++++++++++++++++++++++-------------- mar/talk/report.hoon | 11 ++++++++-- sur/talk.hoon | 4 ++-- 3 files changed, 43 insertions(+), 19 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 3ed48aa894..853dab346d 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -42,7 +42,9 @@ ++ story :: wire content $: count/@ud :: (lent grams) grams/(list telegram) :: all history - locals/atlas :: presence + locals/atlas :: local presence + remotes/(map partner atlas) :: remote presence + mirrors/(map station config) :: remote config sequence/(map partner @ud) :: partners heard shape/config :: configuration known/(map serial @ud) :: messages heard @@ -678,27 +680,38 @@ +>.$ :: ++ pa-report-group :: update presence - ::x build a group report, containing our presence map, and send it to all - ::x bones. + ::x build a group report, containing our different presence maps, and + ::x send it to all bones. + ::x we send remote presences to facilitate federation. aka "relay" :: |= vew/(set bone) - (pa-report vew %group locals) + %^ pa-report vew %group + :- locals + %- ~(urn by remotes) :: XX performance + |= {pan/partner atl/atlas} ^- atlas + ?. &(?=($& -.pan) =(our.hid p.p.pan)) atl + =+ soy=(~(get by stories) q.p.pan) + ?~ soy atl + locals.u.soy :: ++ pa-report-cabal :: update config ::x a cabal report, containing our and remote configs, to all bones. :: |= vew/(set bone) - (pa-report vew %cabal shape) + (pa-report vew %cabal shape mirrors) :: ++ pa-cabal ::x add station's config to our remote config map. :: - |= con/config + ::TODO if web frontend doesn't use ham, remove it (also from sur/talk) + |= {cuz/station con/config ham/(map station config)} ^+ +> - ?: =(shape con) - +>.$ + =+ old=mirrors + =. mirrors (~(put by mirrors) cuz con) + ?: =(mirrors old) +>.$ =. +>.$ (pa-inform %tales (strap man `con)) - (pa-report-cabal(shape con) pa-followers) + (pa-report-cabal pa-followers) + :: ++ pa-diff-talk-report :: subscribed update ::x process a talk report from cuz. @@ -710,8 +723,8 @@ ~& [%pa-diff-unexpected cuz rad] +> ?- -.rad - $cabal (pa-cabal +.rad) - $group (pa-remind +.rad) + $cabal (pa-cabal cuz +.rad) + $group (pa-remind [%& cuz] +.rad) $grams (pa-lesson q.+.rad) == :: @@ -813,13 +826,17 @@ =. +>.$ (pa-inform %precs man (strap her saz)) (pa-report-group(locals nol) pa-followers) :: - ++ pa-remind :: update presence + ++ pa-remind :: remote presence ::x adds tay's loc to our remote presence map, after merging with rem. ::x if this changes anything, send update report. :: - |= loc/atlas - ?: =(loc locals) +> - (pa-report-group(locals loc) pa-followers) + |= {tay/partner loc/atlas rem/(map partner atlas)} + ::x remove this story from the presence map, since it's in local already. + =. rem (~(del by rem) %& our.hid man) :: superceded by local data + =/ buk (~(uni by remotes) rem) ::TODO drop? + =. buk (~(put by buk) tay loc) + ?: =(buk remotes) +>.$ + (pa-report-group(remotes buk) pa-followers) :: ++ pa-start :: start stream ::x grab all telegrams that fall within the river and send them in a diff --git a/mar/talk/report.hoon b/mar/talk/report.hoon index f915da615b..b293162596 100644 --- a/mar/talk/report.hoon +++ b/mar/talk/report.hoon @@ -19,9 +19,9 @@ => + |^ %+ joba -.rep ?- -.rep - $cabal (conf +.rep) + $cabal (cabl +.rep) $grams (jobe num+(jone p.rep) tele+[%a (turn q.rep gram)] ~) - $group (grop +.rep) + $group (jobe local+(grop p.rep) global+%.(q.rep (jome parn grop)) ~) == ++ joce |=(a/knot [%s a]) :: @@ -118,6 +118,13 @@ (jobe first+[%s p] middle+?~(q ~ [%s u.q]) last+[%s r] ~) ~ :: + ++ cabl + |= cabal + %- jobe :~ + loc+(conf loc) + ham+((jome stat conf) ham) + == + :: ++ sorc |= a/(set partner) ^- json [%a (turn (~(tap in a)) |=(b/partner s+(parn b)))] diff --git a/sur/talk.hoon b/sur/talk.hoon index c9beac249f..b63fb7e5b2 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -51,10 +51,10 @@ ++ register (pair atlas (map partner atlas)) :: ping me, ping srcs ++ shelf (map knot (pair posture cord)) :: ship shape ++ report :: talk update - $% {$cabal config} :: config neighborhood + $% {$cabal cabal} :: config neighborhood :: {$folder (list report)} :: multiple {$grams (pair @ud (list telegram))} :: beginning thoughts - {$group atlas} :: presence + {$group register} :: presence == :: ++ lowdown :: changed shared state ::TODO change these so that they're always just the diff. From 2fef0b771beff027c24dd20be1b9b934af42612b Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 3 Apr 2017 16:50:35 +0200 Subject: [PATCH 037/303] Lowdowns for readers now include remote presences and configs, to aid mailbox behavior. --- app/talk-agent.hoon | 111 +++++++++++++++++++++++++++++++++-------- app/talk-guardian.hoon | 36 ++++++++----- sur/talk.hoon | 4 +- 3 files changed, 115 insertions(+), 36 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index d4cfd66e7a..0e0b647bbb 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -32,10 +32,11 @@ $: count/@ud :: (lent grams) grams/(list telegram) :: all history locals/atlas :: presence + remotes/(map partner atlas) :: remote presences shape/config :: configuration + mirrors/(map station config) :: remote configs known/(map serial @ud) :: messages heard == :: - ::TODO do away with most of shell state, it's largely a mirror of tale..? ++ shell :: console session $: id/bone :: identifier count/@ud :: messages shown @@ -186,31 +187,37 @@ ++ ra-diff-talk-lowdown-tales ::x apply tale configs. :: - |= tals/(map knot (unit config)) + |= tals/(map knot (unit cabal)) ^+ +> ::TODO for every changed config, (sh-low-config oldconfig newconfig) :: maybe something else for new/removed tales? %= +> tales %+ roll (~(tap by tals)) - |= {t/(pair knot (unit config)) tas/_tales} + |= {t/(pair knot (unit cabal)) tas/_tales} ~& [%r-new-config-for p.t] =. tas ?~(tas tales tas) ::x start with our current tales. =+ tal=(fall (~(get by tas) p.t) *tale) ?~ q.t (~(del by tas) p.t) - (~(put by tas) p.t tal(shape u.q.t)) + (~(put by tas) p.t tal(shape loc.u.q.t, mirrors ham.u.q.t)) == :: ++ ra-diff-talk-lowdown-precs ::x apply new presence. :: - |= {man/knot pes/atlas} + |= {man/knot pes/atlas pas/(map partner atlas)} ^+ +> =+ tal=(~(get by tales) man) - ?~ tal ~&([%know-no-tale man] +>.$) - =+ new=(~(uni by pes) locals.u.tal) - ?: =(locals.u.tal new) +>.$ - =. +>.$ sh-abet:(~(sh-low-precs sh ~ cli man) locals.u.tal new) - +>.$(tales (~(put by tales) man u.tal(locals new))) + ?~ tal ~&([%low-precs-know-no-tale man] +>.$) + =+ nel=(~(uni by pes) locals.u.tal) + ::TODO make better ++sh arms for this. + =. +>.$ + ?: =(locals.u.tal nel) +>.$ + sh-abet:(~(sh-low-precs sh ~ cli man) [locals.u.tal ~] [nel ~]) + =+ ner=(~(uni by pas) remotes.u.tal) ::TODO better uni. + =. +>.$ + ?: =(remotes.u.tal ner) +>.$ + sh-abet:(~(sh-low-precs sh ~ cli man) [~ remotes.u.tal] [~ ner]) + +>.$(tales (~(put by tales) man u.tal(locals nel, remotes ner))) :: ++ ra-diff-talk-lowdown-grams ::x apply new grams @@ -811,6 +818,37 @@ ^- tape ['%' (trip p.saz)] :: + ++ sh-repo-rogue-diff + ::x calculates the difference between two maps of stations and their + ::x presence lists. + :: + |= {one/(map partner atlas) two/(map partner atlas)} + =| $= ret + $: old/(list (pair partner atlas)) + new/(list (pair partner atlas)) + cha/(list (pair partner atlas)) + == + ^+ 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-repo-group-diff-here :: print atlas diff ::x prints presence notifications. :: @@ -841,13 +879,46 @@ (weld pre "set {(scow %p p.i.cha.cul)} {(sh-spaz q.i.cha.cul)}") +>.$ :: + ++ sh-repo-group-there :: update foreign + ::x updates remote presences(?) and prints changes. + :: + |= {old/(map partner atlas) new/(map partner atlas)} + =+ day=(sh-repo-rogue-diff old new) + ?: (~(has in settings.she) %quiet) + +>.$ + =. +>.$ + |- ^+ +>.^$ + ?~ old.day +>.^$ + =. +>.^$ $(old.day t.old.day) + (sh-note (weld "not " (~(ta-show ta man p.i.old.day) ~))) + =. +>.$ + |- ^+ +>.^$ + ?~ new.day +>.^$ + =. +>.^$ $(new.day t.new.day) + =. +>.^$ + (sh-note (weld "new " (~(ta-show ta man p.i.new.day) ~))) + (sh-repo-group-diff-here "--" ~ (~(tap by q.i.new.day)) ~) + =. +>.$ + |- ^+ +>.^$ + ?~ cha.day +>.^$ + =. +>.^$ $(cha.day t.cha.day) + =. +>.^$ + (sh-note (weld "for " (~(ta-show ta man p.i.cha.day) ~))) + =+ yez=(~(got by old) p.i.cha.day) + %+ sh-repo-group-diff-here "--" + (sh-repo-atlas-diff yez q.i.cha.day) + +>.$ + :: ++ sh-low-precs ::x print presence changes :: - |= {old/atlas new/atlas} + |= $: old/(pair atlas (map partner atlas)) + new/(pair atlas (map partner atlas)) + == ^+ +> - =+ dif=(sh-repo-atlas-diff old new) - (sh-repo-group-diff-here "" dif) + =+ dif=(sh-repo-atlas-diff p.old p.new) + =. +>.$ (sh-repo-group-diff-here "" dif) + (sh-repo-group-there q.old q.new) :: ++ sh-low-gram ::x renders telegram: increase gram count and print the gram. @@ -1082,17 +1153,15 @@ ++ who :: %who |= pan/(set partner) ^+ ..sh-work ::TODO clever use of =< and . take note! - ::TODO actually use the correct station. ~& [%who-ing pan] - =< (sh-fact %mor (murn (sort (~(tap by tales) ~) aor) .)) - |= {nam/knot tal/tale} - ^- (unit sole-effect) - ?. |(=(~ pan) (~(any in pan) ~(has in sources.shape.tal))) ~ - =- `[%tan rose+[", " `~]^- leaf+~(ta-full ta man [%& ~zod nam]) ~] - =< (murn (sort (~(tap by locals.tal)) aor) .) + =+ tal=(~(got by tales) man) + =< (sh-fact %mor (murn (sort (~(tap by remotes.tal) ~) aor) .)) + |= {pon/partner alt/atlas} ^- (unit sole-effect) + ?. |(=(~ pan) (~(has in pan) pon)) ~ + =- `[%tan rose+[", " `~]^- leaf+~(ta-full ta man pon) ~] + =< (murn (sort (~(tap by alt)) aor) .) |= {a/ship b/presence c/human} ^- (unit tank) ::TODO print human names. - ~& %present ?- b $gone ~ $hear `>a< diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 853dab346d..6923a2044b 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -516,9 +516,9 @@ |= new/bone =. +> %- ra-emil :~ :* new %diff %talk-lowdown %tales - %- ~(gas in *(map knot (unit config))) + %- ~(gas in *(map knot (unit cabal))) %+ turn (~(tap by stories)) - |=({a/knot b/story} [a `shape.b]) + |=({a/knot b/story} [a `[shape.b mirrors.b]]) == [new %diff %talk-lowdown %glyph nak] [new %diff %talk-lowdown %names (~(run by folks) some)] @@ -679,14 +679,10 @@ [n.general %diff %talk-lowdown low] +>.$ :: - ++ pa-report-group :: update presence - ::x build a group report, containing our different presence maps, and - ::x send it to all bones. - ::x we send remote presences to facilitate federation. aka "relay" + ++ pa-remotes + ::x produces remotes, with all our local presences replaced by their + ::x versions from their stories. :: - |= vew/(set bone) - %^ pa-report vew %group - :- locals %- ~(urn by remotes) :: XX performance |= {pan/partner atl/atlas} ^- atlas ?. &(?=($& -.pan) =(our.hid p.p.pan)) atl @@ -694,6 +690,19 @@ ?~ soy atl locals.u.soy :: + ++ pa-report-group :: update presence + ::x build a group report, containing our different presence maps, and + ::x send it to all bones. + ::x we send remote presences to facilitate federation. aka "relay" + :: + |= vew/(set bone) + (pa-report vew %group locals pa-remotes) + :: + ++ pa-lowdown-precs + ::x build a presence lowdown, containing our different presence maps. + :: + (pa-inform %precs man locals pa-remotes) + :: ++ pa-report-cabal :: update config ::x a cabal report, containing our and remote configs, to all bones. :: @@ -709,7 +718,7 @@ =+ old=mirrors =. mirrors (~(put by mirrors) cuz con) ?: =(mirrors old) +>.$ - =. +>.$ (pa-inform %tales (strap man `con)) + =. +>.$ (pa-inform %tales (strap man `[con ham])) (pa-report-cabal pa-followers) :: @@ -735,7 +744,7 @@ =. +> %. pa-followers pa-report-cabal(sources.shape (~(del in sources.shape) tay)) - (pa-inform %tales (strap man `shape)) + (pa-inform %tales (strap man `[shape mirrors])) :: ++ pa-sauce :: send backward ::x turns cards into moves, reverse order, prepend to existing moves. @@ -799,7 +808,7 @@ ::x partners we gained/lost, and send out an updated cabal report. :: |= cof/config - =. +>.$ (pa-inform %tales (strap man `cof)) + =. +>.$ (pa-inform %tales (strap man `[cof mirrors])) =+ ^= dif ^- (pair (list partner) (list partner)) =+ old=`(list partner)`(~(tap in sources.shape) ~) =+ new=`(list partner)`(~(tap in sources.cof) ~) @@ -823,7 +832,7 @@ ^+ +> =/ nol (~(put by locals) her saz) ?: =(nol locals) +>.$ - =. +>.$ (pa-inform %precs man (strap her saz)) + =< pa-lowdown-precs (pa-report-group(locals nol) pa-followers) :: ++ pa-remind :: remote presence @@ -836,6 +845,7 @@ =/ buk (~(uni by remotes) rem) ::TODO drop? =. buk (~(put by buk) tay loc) ?: =(buk remotes) +>.$ + =< pa-lowdown-precs (pa-report-group(remotes buk) pa-followers) :: ++ pa-start :: start stream diff --git a/sur/talk.hoon b/sur/talk.hoon index b63fb7e5b2..fe55f4a5a8 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -63,9 +63,9 @@ {$names (map ship (unit human))} :: new identities ::TODO cabal, or merge its contents into tale's config :: basically we just want to merge the ship sets, right? - {$tales (map knot (unit config))} :: changed config + {$tales (map knot (unit cabal))} :: changed config ::TODO merge remote and local presences. - {$precs (pair knot atlas)} :: changed presence + {$precs (pair knot register)} :: changed presence {$grams (pair knot (pair @ud (list telegram)))} :: new grams == :: ++ speech :: narrative action From 0d41537f9146175a24c7b9934888f76cdc60202d Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 3 Apr 2017 21:12:58 +0200 Subject: [PATCH 038/303] Removed ++timed from talk-guardian, no longer in use. --- app/talk-guardian.hoon | 55 ------------------------------------------ 1 file changed, 55 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 6923a2044b..246363ee71 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -80,61 +80,6 @@ == :: ++ strap |*({k/* v/*} (~(put by *(map _k _v)) k v)) -- -|% -:: old protocol workaround door -++ timed - ::x? seems hacky. if old, should be removed in "new talk", right? - ::x? seems like it's used for adding/dealing with "fake"/workaround ships - ::x? with datetimes in their status. but why? - ::x looking at ++pa-remind, this can safely be deleted when breaching state. - :: - ::x a: stations with ships and their status. - |_ a/(map partner atlas) :: XX (map partner (pair @da atlas)) - ++ strip - ::x removes workaround ships from all partner's status lists. - :: - (~(run by a) |=(b/atlas (~(del by b) `@p`%timed-sub))) - :: - ++ put :: XX put:by - ::x adds workaround ship to d with pretty-printed date c in its status, - ::x then adds it to a with key/partner b. - :: - |= {b/partner c/@da d/atlas} - =/ sta/status [%gone [~ (some (scot %da c))]] - (~(put by a) b (~(put by d) `@p`%timed-sub sta)) - :: - ++ decode-status - ::x attempts to retrieve datetime from status (as inserted by put:timed). - :: - |= a/status ^- (unit @da) - ?. ?=({$gone $~ $~ tym/@t} a) ~ - => .(a `{$gone $~ $~ tym/@t}`a) - (slaw %da tym.a) - :: - ++ uni - ::x union of two station-shipstatus maps. - :: - |= b/_a ^+ a - :: XX efficiency - %- ~(uni by a) - %- ~(urn by b) - |= nb/{p/partner q/atlas} - ?. (~(has by a) p.nb) q.nb - =/ qna (~(got by a) p.nb) - :: XX p.qna p.q.nb - =/ pqna (biff (~(get by qna) `@p`%timed-sub) decode-status) - ?~ pqna q.nb - =/ pqnb (biff (~(get by q.nb) `@p`%timed-sub) decode-status) - ?~ pqnb qna - ?: (gth u.pqna u.pqnb) qna - ?: (gth u.pqnb u.pqna) q.nb - :: unfortunately, multiple reports on the same channel can - :: be sent on the same event, necessitating last-wins - :: ~| uni-timed+[n.a n.b] - :: ?> =(n.a n.b) - q.nb - -- --- :: |_ {hid/bowl house} :: From 3350be68d5c54a28d765ca71863d860c5e313d92 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 4 Apr 2017 00:14:06 +0200 Subject: [PATCH 039/303] Moved remotes and mirrors out of stories/tales and into global state. --- app/talk-agent.hoon | 69 ++++++++++++++++++++---------------------- app/talk-guardian.hoon | 52 ++++++++++++++++--------------- sur/talk.hoon | 6 ++-- 3 files changed, 65 insertions(+), 62 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 0e0b647bbb..dfd0642bc6 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -23,6 +23,8 @@ => |% :: data structures ++ chattel :: full state $: tales/(map knot tale) :: conversations + remotes/(map partner atlas) :: remote presences + mirrors/(map station config) :: remote configs folks/(map ship human) :: human identities nik/(map (set partner) char) :: bound station glyphs nak/(jug char (set partner)) :: station glyph lookup @@ -31,10 +33,9 @@ ++ tale :: user-facing story $: count/@ud :: (lent grams) grams/(list telegram) :: all history + ::TODO given remotes and mirrors, do we still need locals and shape? locals/atlas :: presence - remotes/(map partner atlas) :: remote presences shape/config :: configuration - mirrors/(map station config) :: remote configs known/(map serial @ud) :: messages heard == :: ++ shell :: console session @@ -146,7 +147,9 @@ $glyph (ra-diff-talk-lowdown-glyph +.low) $names (ra-diff-talk-lowdown-names +.low) $tales (ra-diff-talk-lowdown-tales +.low) + $remco (ra-diff-talk-lowdown-remco +.low) $precs (ra-diff-talk-lowdown-precs +.low) + $rempe (ra-diff-talk-lowdown-rempe +.low) $grams (ra-diff-talk-lowdown-grams +.low) == :: @@ -183,41 +186,45 @@ ?~ h ~ (some [s u.h]) == - :: :: + :: ++ ra-diff-talk-lowdown-tales ::x apply tale configs. :: - |= tals/(map knot (unit cabal)) + |= {man/knot cof/(unit config)} ^+ +> - ::TODO for every changed config, (sh-low-config oldconfig newconfig) + ::TODO for changed configs, (sh-low-config oldconfig newconfig) :: maybe something else for new/removed tales? - %= +> tales - %+ roll (~(tap by tals)) - |= {t/(pair knot (unit cabal)) tas/_tales} - ~& [%r-new-config-for p.t] - =. tas ?~(tas tales tas) ::x start with our current tales. - =+ tal=(fall (~(get by tas) p.t) *tale) - ?~ q.t (~(del by tas) p.t) - (~(put by tas) p.t tal(shape loc.u.q.t, mirrors ham.u.q.t)) - == + ~& [%r-new-config-for man] + ?~ cof +>(tales (~(del by tales) man)) + =+ tal=(fall (~(get by tales) man) *tale) + +>.$(tales (~(put by tales) man tal(shape u.cof))) + :: + ++ ra-diff-talk-lowdown-remco + |= cofs/(map station config) + ^+ +> + ::TODO ++sh arm for printing of remote configs. + +>(mirrors (~(uni by cofs) mirrors)) :: ++ ra-diff-talk-lowdown-precs ::x apply new presence. :: - |= {man/knot pes/atlas pas/(map partner atlas)} + |= {man/knot pes/atlas} ^+ +> =+ tal=(~(get by tales) man) ?~ tal ~&([%low-precs-know-no-tale man] +>.$) =+ nel=(~(uni by pes) locals.u.tal) - ::TODO make better ++sh arms for this. =. +>.$ ?: =(locals.u.tal nel) +>.$ - sh-abet:(~(sh-low-precs sh ~ cli man) [locals.u.tal ~] [nel ~]) - =+ ner=(~(uni by pas) remotes.u.tal) ::TODO better uni. - =. +>.$ - ?: =(remotes.u.tal ner) +>.$ - sh-abet:(~(sh-low-precs sh ~ cli man) [~ remotes.u.tal] [~ ner]) - +>.$(tales (~(put by tales) man u.tal(locals nel, remotes ner))) + sh-abet:(~(sh-low-precs sh ~ cli man) locals.u.tal nel) + +>.$(tales (~(put by tales) man u.tal(locals nel))) + :: + ++ ra-diff-talk-lowdown-rempe + |= pas/(map partner atlas) + ^+ +> + =+ ner=(~(uni by pas) remotes) ::TODO better uni. + ?: =(remotes ner) +>.$ + =. remotes ner + sh-abet:(~(sh-repo-group-there sh ~ cli (main our.hid)) remotes ner) :: ++ ra-diff-talk-lowdown-grams ::x apply new grams @@ -368,13 +375,6 @@ =. l ?~(l loc l) ::TODO =? (~(uni by l) q.r) +>.$(locals pres) - :: - ++ pa-cabal - ::x update the tale's config. - :: - |= {cuz/station con/config ham/(map station config)} - ^+ +> - +>(shape con) -- :: ++ sh :: per console @@ -912,13 +912,10 @@ ++ sh-low-precs ::x print presence changes :: - |= $: old/(pair atlas (map partner atlas)) - new/(pair atlas (map partner atlas)) - == + |= {old/atlas new/atlas} ^+ +> - =+ dif=(sh-repo-atlas-diff p.old p.new) - =. +>.$ (sh-repo-group-diff-here "" dif) - (sh-repo-group-there q.old q.new) + =+ dif=(sh-repo-atlas-diff old new) + (sh-repo-group-diff-here "" dif) :: ++ sh-low-gram ::x renders telegram: increase gram count and print the gram. @@ -1155,7 +1152,7 @@ ::TODO clever use of =< and . take note! ~& [%who-ing pan] =+ tal=(~(got by tales) man) - =< (sh-fact %mor (murn (sort (~(tap by remotes.tal) ~) aor) .)) + =< (sh-fact %mor (murn (sort (~(tap by remotes) ~) aor) .)) |= {pon/partner alt/atlas} ^- (unit sole-effect) ?. |(=(~ pan) (~(has in pan) pon)) ~ =- `[%tan rose+[", " `~]^- leaf+~(ta-full ta man pon) ~] diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 246363ee71..f9e15ae398 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -31,6 +31,8 @@ => |% :: data structures ++ house :: $: stories/(map knot story) :: conversations + remotes/(map partner atlas) :: remote presence + mirrors/(map station config) :: remote config ::TODO rename to readers? general/(set bone) :: our message readers outbox/(pair @ud (map @ud thought)) :: urbit outbox @@ -43,8 +45,6 @@ $: count/@ud :: (lent grams) grams/(list telegram) :: all history locals/atlas :: local presence - remotes/(map partner atlas) :: remote presence - mirrors/(map station config) :: remote config sequence/(map partner @ud) :: partners heard shape/config :: configuration known/(map serial @ud) :: messages heard @@ -458,20 +458,30 @@ ++ ra-welcome ::x brings reader new up to date. :: + ::TODO just like weld somehow |= new/bone - =. +> %- ra-emil :~ - :* new %diff %talk-lowdown %tales - %- ~(gas in *(map knot (unit cabal))) - %+ turn (~(tap by stories)) - |=({a/knot b/story} [a `[shape.b mirrors.b]]) - == - [new %diff %talk-lowdown %glyph nak] - [new %diff %talk-lowdown %names (~(run by folks) some)] - == - %- ra-emil + =. +> %- ra-emil + %- zing %+ turn (~(tap by stories)) |= {k/knot s/story} - [new %diff %talk-lowdown %grams k count.s grams.s] + ^- (list move) + :~ ::x story configurations + [new %diff %talk-lowdown %tales k `shape.s] + ::x local presences + [new %diff %talk-lowdown %precs k locals.s] + ::x telegrams + [new %diff %talk-lowdown %grams k count.s grams.s] + == + %- ra-emil + :~ ::x remote configurations + [new %diff %talk-lowdown %remco mirrors] + ::x remote presences + [new %diff %talk-lowdown %rempe remotes] + ::x bound glyphs + [new %diff %talk-lowdown %glyph nak] + ::x nicknames + [new %diff %talk-lowdown %names (~(run by folks) some)] + == :: ++ ra-think :: publish+review ::x consumes each thought. @@ -643,11 +653,6 @@ |= vew/(set bone) (pa-report vew %group locals pa-remotes) :: - ++ pa-lowdown-precs - ::x build a presence lowdown, containing our different presence maps. - :: - (pa-inform %precs man locals pa-remotes) - :: ++ pa-report-cabal :: update config ::x a cabal report, containing our and remote configs, to all bones. :: @@ -663,9 +668,8 @@ =+ old=mirrors =. mirrors (~(put by mirrors) cuz con) ?: =(mirrors old) +>.$ - =. +>.$ (pa-inform %tales (strap man `[con ham])) + =. +>.$ (pa-inform %remco mirrors) (pa-report-cabal pa-followers) - :: ++ pa-diff-talk-report :: subscribed update ::x process a talk report from cuz. @@ -689,7 +693,7 @@ =. +> %. pa-followers pa-report-cabal(sources.shape (~(del in sources.shape) tay)) - (pa-inform %tales (strap man `[shape mirrors])) + (pa-inform %tales man `shape) :: ++ pa-sauce :: send backward ::x turns cards into moves, reverse order, prepend to existing moves. @@ -753,7 +757,7 @@ ::x partners we gained/lost, and send out an updated cabal report. :: |= cof/config - =. +>.$ (pa-inform %tales (strap man `[cof mirrors])) + =. +>.$ (pa-inform %tales man `cof) =+ ^= dif ^- (pair (list partner) (list partner)) =+ old=`(list partner)`(~(tap in sources.shape) ~) =+ new=`(list partner)`(~(tap in sources.cof) ~) @@ -777,7 +781,7 @@ ^+ +> =/ nol (~(put by locals) her saz) ?: =(nol locals) +>.$ - =< pa-lowdown-precs + =. +>.$ (pa-inform %precs man nol) (pa-report-group(locals nol) pa-followers) :: ++ pa-remind :: remote presence @@ -790,7 +794,7 @@ =/ buk (~(uni by remotes) rem) ::TODO drop? =. buk (~(put by buk) tay loc) ?: =(buk remotes) +>.$ - =< pa-lowdown-precs + =. +>.$ (pa-inform %rempe buk) (pa-report-group(remotes buk) pa-followers) :: ++ pa-start :: start stream diff --git a/sur/talk.hoon b/sur/talk.hoon index fe55f4a5a8..015c259c49 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -63,9 +63,11 @@ {$names (map ship (unit human))} :: new identities ::TODO cabal, or merge its contents into tale's config :: basically we just want to merge the ship sets, right? - {$tales (map knot (unit cabal))} :: changed config + {$tales (pair knot (unit config))} :: changed config + {$remco (map station config)} :: remote configs ::TODO merge remote and local presences. - {$precs (pair knot register)} :: changed presence + {$precs (pair knot atlas)} :: changed presence + {$rempe (map partner atlas)} :: remote presences {$grams (pair knot (pair @ud (list telegram)))} :: new grams == :: ++ speech :: narrative action From 670d4d26af3006c7d675d824373ef97db28d4728 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 4 Apr 2017 13:33:38 +0200 Subject: [PATCH 040/303] Fixed incorrect usage of uni:by. --- app/talk-agent.hoon | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index dfd0642bc6..40d5b159b6 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -176,12 +176,11 @@ %= +> folks %- ~(gas by *(map ship human)) %+ murn - =< $ - %~ tap by - %- ~(uni by nas) - ^- _nas - (~(run by folks) some) - == + =< $ + %~ tap by + %. nas + ~(uni by `_nas`(~(run by folks) some)) + == |= {s/ship h/(unit human)} ?~ h ~ (some [s u.h]) @@ -203,7 +202,7 @@ |= cofs/(map station config) ^+ +> ::TODO ++sh arm for printing of remote configs. - +>(mirrors (~(uni by cofs) mirrors)) + +>(mirrors (~(uni by mirrors) cofs)) :: ++ ra-diff-talk-lowdown-precs ::x apply new presence. @@ -212,7 +211,7 @@ ^+ +> =+ tal=(~(get by tales) man) ?~ tal ~&([%low-precs-know-no-tale man] +>.$) - =+ nel=(~(uni by pes) locals.u.tal) + =+ nel=(~(uni by locals.u.tal) pes) =. +>.$ ?: =(locals.u.tal nel) +>.$ sh-abet:(~(sh-low-precs sh ~ cli man) locals.u.tal nel) @@ -221,7 +220,7 @@ ++ ra-diff-talk-lowdown-rempe |= pas/(map partner atlas) ^+ +> - =+ ner=(~(uni by pas) remotes) ::TODO better uni. + =+ ner=(~(uni by remotes) pas) ::TODO better uni. ?: =(remotes ner) +>.$ =. remotes ner sh-abet:(~(sh-repo-group-there sh ~ cli (main our.hid)) remotes ner) From b39393acb97686ac710e72fac6922b067d9b014e Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 4 Apr 2017 15:40:59 +0200 Subject: [PATCH 041/303] Resolved TODO's and removed old code. ;who now prints human handles if available. --- app/talk-agent.hoon | 48 +++++++++------------------------------------ 1 file changed, 9 insertions(+), 39 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 40d5b159b6..c70a57b067 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -3,12 +3,6 @@ :: :: :: :: ::TODO guardian's todo's apply here too -::TODO if we use a new structure for sending messages broker->reader, then we -:: can be safe in not doing permission checks. -::TODO actually send update moves when needed -::TODO process reports -::TODO init, general subscribe to broker. -::TODO? do we even need multiple shells? ::TODO rename cores. pa->ta (transaction), ta->pa (partner), etc. :: /? 310 :: hoon version @@ -166,7 +160,7 @@ %+ turn (~(tap by nek)) |= {a/char b/(set (set partner))} (turn (~(tap by b)) |=(c/(set partner) [c a])) - sh-abet:~(sh-prod sh ~ cli (main our.hid)) ::TODO mailbox not used + sh-abet:~(sh-prod sh ~ cli (main our.hid)) :: ++ ra-diff-talk-lowdown-names ::x apply new local identities. @@ -255,7 +249,6 @@ ?. =(id.cli ost.hid) ~& %strange-sole !! - ::TODO but there's not actually a tale to specify. mailbox is "fake"! sh-abet:(~(sh-sole sh ~ cli (main our.hid)) act) :: ++ ra-console @@ -359,21 +352,6 @@ +>.$ :: no change =. grams (welp (scag (dec way) grams) [gam (slag way grams)]) +>.$ - :: - ++ pa-remind :: presence update - ::x merge local and remote presences, and store them in locals. - :: - ::TODO verify if this now does what it's supposed to. - |= {loc/atlas rem/(map partner atlas)} - ::x remove this story from the presence map, since it's in local already. - =. rem (~(del by rem) %& our.hid man) :: superceded by local data - ::TODO stop using timed, just do uni here. - =/ pres - %+ roll (~(tap by rem)) - |= {r/(pair partner atlas) l/atlas} - =. l ?~(l loc l) ::TODO =? - (~(uni by l) q.r) - +>.$(locals pres) -- :: ++ sh :: per console @@ -577,8 +555,6 @@ :: |= dup/update ^+ +> - ::TODO is ost.hid okay here? or do we want to store bone of broker? - ~& [%r-update-to ost.hid] %= +> moves :_ moves :* ost.hid @@ -610,7 +586,6 @@ |= lix/(set partner) ^+ +> =+ act=(sh-pare lix) ::x ensure we can see what we send. - ?~ act ~|(%no-audience !!) ::TODO can't happen, remove. ?: =(active.she act) +>.$ sh-prod(active.she act) :: @@ -628,10 +603,9 @@ :: |= paz/(set partner) ?~ paz | - ::TODO hoon does short-circuiting, right? do the has first, then recurse. - ?| $(paz l.paz) + ?| (~(has in sources.shape:(~(got by tales) man)) `partner`n.paz) + $(paz l.paz) $(paz r.paz) - (~(has in sources.shape:(~(got by tales) man)) `partner`n.paz) == :: ++ sh-pest :: report listen @@ -1157,11 +1131,13 @@ =- `[%tan rose+[", " `~]^- leaf+~(ta-full ta man pon) ~] =< (murn (sort (~(tap by alt)) aor) .) |= {a/ship b/presence c/human} ^- (unit tank) - ::TODO print human names. + =. c + ?. =(hand.c `(scot %p a)) c + [true.c ~] ?- b $gone ~ - $hear `>a< - $talk `>a< :: XX difference + $hear `leaf+:(weld "hear " (scow %p a) " " (trip (fall hand.c ''))) + $talk `leaf+:(weld "talk " (scow %p a) " " (trip (fall hand.c ''))) == :: ++ bind :: %bind @@ -1273,15 +1249,9 @@ ?~(woe ..sh-work work(job u.woe)) :: ++ number :: %number - ::TODO !!!!! - ::TODO mistakes were made. turns out we need multiple shells after all! - ::TODO but that seems a bit hacky, surely we can do better than it was? - ::TODO ...just storing the telegrams in the order they were printed - :: doesn't seem clean enough though. - ::TODO !!!!! |= num/$@(@ud {p/@u q/@ud}) ^+ ..sh-work - =+ roy=(~(got by tales) man) ::TODO see above + =+ roy=(~(got by tales) man) |- ?@ num ?: (gte num count.roy) From ce8a9a8ca227ebfd739502f74eb799ba71c5beb9 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 4 Apr 2017 16:15:12 +0200 Subject: [PATCH 042/303] ++ra-unconfig and ++pa-reform-gone for story deletion. --- app/talk-guardian.hoon | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index f9e15ae398..7f459d5327 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -171,11 +171,8 @@ ?. (~(has by stories) p.cod) (ra-evil %talk-no-story) ::x $design with ~ for config signals delete - ::TODO untangle into ++ra-unconfig, ++pa-reform-gone instead of using - :: bunts or empty keys. - :: be sure to send a deletion %tales lowdown! - =. +>.$ (ra-config p.cod *config) - +>.$(stories (~(del by stories) p.cod)) + ::TODO be sure to send a deletion %tales lowdown! + (ra-unconfig p.cod) (ra-config p.cod u.q.cod) :: ::x used for relaying messages (as a station host). @@ -240,6 +237,14 @@ =+ pur=(fall (~(get by stories) man) *story) pa-abet:(~(pa-reform pa man pur) con) :: + ++ ra-unconfig + |= man/knot + ^+ +> + =+ soy=(~(get by stories) man) + ?~ soy +>.$ + =. stories (~(del by stories) man) + pa-abet:~(pa-reform-gone pa man u.soy) + :: ++ ra-base-hart ::x produces our ship's host desk's web address as a hart. :: @@ -768,6 +773,11 @@ =. shape cof (pa-report-cabal pa-followers) :: + ++ pa-reform-gone + =. . (pa-inform %tales man ~) + =. . (pa-report-cabal pa-followers) + (pa-abjure (~(tap in sources.shape))) + :: ++ pa-cancel :: unsubscribe from ::x deletes the current ost.hid from all follower groups. :: @@ -778,9 +788,11 @@ ::x add her status to our presence map. if this changes it, send report. :: |= {her/ship saz/status} + ~& [%b-pa-notify man her saz] ^+ +> =/ nol (~(put by locals) her saz) ?: =(nol locals) +>.$ + ~& [%notifying pa-followers nol] =. +>.$ (pa-inform %precs man nol) (pa-report-group(locals nol) pa-followers) :: From f895a898feca38b8b7968b763d6e57f8996d1b12 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 4 Apr 2017 18:47:11 +0200 Subject: [PATCH 043/303] Fixed old and incorrect usage of subscription path. --- app/talk-guardian.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 7f459d5327..550072c3d1 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -410,7 +410,7 @@ ?. ?=({@ @ *} pax) ::x if story is not in path, just delete the bone from general. +>(general (~(del in general) ost.hid)) - %- (ra-know i.t.pax) |= par/_pa =< pa-abet + %- (ra-know i.pax) |= par/_pa =< pa-abet ::x delete bone from all follower groups and set src's status to %gone. (pa-notify:pa-cancel:par src %gone *human) :: From 1d3e57ebe40fd7a0aebe80040daa7c12e13a2c27 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 4 Apr 2017 20:59:51 +0200 Subject: [PATCH 044/303] Changes in configs now get printed to the cli. --- app/talk-agent.hoon | 59 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 55 insertions(+), 4 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index c70a57b067..84491648ac 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -185,11 +185,9 @@ :: |= {man/knot cof/(unit config)} ^+ +> - ::TODO for changed configs, (sh-low-config oldconfig newconfig) - :: maybe something else for new/removed tales? - ~& [%r-new-config-for man] ?~ cof +>(tales (~(del by tales) man)) =+ tal=(fall (~(get by tales) man) *tale) + =. +>.$ sh-abet:(~(sh-low-config sh ~ cli man) shape.tal (fall cof *config)) +>.$(tales (~(put by tales) man tal(shape u.cof))) :: ++ ra-diff-talk-lowdown-remco @@ -692,6 +690,36 @@ ret ret :: + ++ sh-repo-cabal-diff + ::x calculates the difference between two cabals (station configurations) + :: + |= {one/(map station config) two/(map station config)} + =| $= ret + $: old/(list (pair station config)) + new/(list (pair station config)) + cha/(list (pair station 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 ::x calculates the difference between two sets, ::x returning what was lost in old and what was gained in new. @@ -771,12 +799,35 @@ (sh-set-diff q.cordon.laz q.cordon.loc) :: ++ sh-low-config - ::x updates the current shell's cabal and prints changes to cli. + ::x prints changes to a config to cli. :: |= {old/config new/config} ^+ +> (sh-repo-config-show "" old new) :: + ++ sh-low-remco + ::x prints changes to remote configs to cli. + :: + |= {ole/(map station config) neu/(map station config)} + ^+ +> + =+ (sh-repo-cabal-diff ole neu) + =. +>.$ + |- ^+ +>.^$ + ?~ new +>.^$ + =. +>.^$ $(new t.new) + =. +>.^$ (sh-pest [%& p.i.new]) + %+ sh-repo-config-show + (weld ~(sn-phat sn man p.i.new) ": ") + [*config q.i.new] + =. +>.$ + |- ^+ +>.^$ + ?~ cha +>.^$ + =. +>.^$ $(cha t.cha) + %+ sh-repo-config-show + (weld ~(sn-phat sn man p.i.cha) ": ") + [(~(got by ole) `station`p.i.cha) q.i.cha] + +>.$ + :: ++ sh-note :: shell message ::x prints a txt to cli in talk's format. :: From 7b819b644ad947ebd24fc545ba7bdb578494fd64 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 4 Apr 2017 21:08:57 +0200 Subject: [PATCH 045/303] Renamed ++sh-repo- arms to be consistent with their new usage. --- app/talk-agent.hoon | 52 ++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 84491648ac..0fd85bf3c2 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -193,7 +193,7 @@ ++ ra-diff-talk-lowdown-remco |= cofs/(map station config) ^+ +> - ::TODO ++sh arm for printing of remote configs. + =. +> sh-abet:(~(sh-low-remco sh ~ cli (main our.hid)) mirrors cofs) +>(mirrors (~(uni by mirrors) cofs)) :: ++ ra-diff-talk-lowdown-precs @@ -215,7 +215,7 @@ =+ ner=(~(uni by remotes) pas) ::TODO better uni. ?: =(remotes ner) +>.$ =. remotes ner - sh-abet:(~(sh-repo-group-there sh ~ cli (main our.hid)) remotes ner) + sh-abet:(~(sh-low-rempe sh ~ cli (main our.hid)) remotes ner) :: ++ ra-diff-talk-lowdown-grams ::x apply new grams @@ -654,7 +654,7 @@ ?: (~(has in lax) pan) `pan $(grams t.grams) :: - ++ sh-repo-atlas-diff + ++ sh-low-atlas-diff ::x calculates the difference between two atlasses (presence lists). :: |= {one/atlas two/atlas} @@ -690,8 +690,8 @@ ret ret :: - ++ sh-repo-cabal-diff - ::x calculates the difference between two cabals (station configurations) + ++ sh-low-remco-diff + ::x calculates the difference between two maps of station configurations. :: |= {one/(map station config) two/(map station config)} =| $= ret @@ -739,8 +739,8 @@ $green "journal" == :: - ++ sh-repo-config-exceptions - ::x used by ++sh-repo-config-show to aid in printing info to cli. + ++ sh-low-config-exceptions + ::x used by ++sh-low-config-show to aid in printing info to cli. :: |= {pre/tape por/posture old/(list ship) new/(list ship)} =+ out=?:(?=(?($black $brown) por) "try " "cut ") @@ -757,8 +757,8 @@ (sh-note :(weld pre out " " (scow %p i.new))) +>.$ :: - ++ sh-repo-config-sources - ::x used by ++sh-repo-config-show to aid in printing info to cli, + ++ sh-low-config-sources + ::x used by ++sh-low-config-show to aid in printing info to cli, ::x pertaining to the un/subscribing to partners. :: |= {pre/tape old/(list partner) new/(list partner)} @@ -775,7 +775,7 @@ (sh-note (weld pre "hey {~(ta-full ta man i.new)}")) +>.$ :: - ++ sh-repo-config-show + ++ sh-low-config-show ::x prints config changes to the cli. :: |= {pre/tape laz/config loc/config} @@ -784,16 +784,16 @@ ?: =(caption.loc caption.laz) +>.$ (sh-note :(weld pre "cap " (trip caption.loc))) =. +>.$ - %+ sh-repo-config-sources + %+ sh-low-config-sources (weld (trip man) ": ") (sh-set-diff sources.laz sources.loc) ?: !=(p.cordon.loc p.cordon.laz) =. +>.$ (sh-note :(weld pre "but " (sh-puss p.cordon.loc))) - %^ sh-repo-config-exceptions + %^ sh-low-config-exceptions (weld (trip man) ": ") p.cordon.loc [~ (~(tap in q.cordon.loc))] - %^ sh-repo-config-exceptions + %^ sh-low-config-exceptions (weld (trip man) ": ") p.cordon.loc (sh-set-diff q.cordon.laz q.cordon.loc) @@ -803,27 +803,27 @@ :: |= {old/config new/config} ^+ +> - (sh-repo-config-show "" old new) + (sh-low-config-show "" old new) :: ++ sh-low-remco ::x prints changes to remote configs to cli. :: |= {ole/(map station config) neu/(map station config)} ^+ +> - =+ (sh-repo-cabal-diff ole neu) + =+ (sh-low-remco-diff ole neu) =. +>.$ |- ^+ +>.^$ ?~ new +>.^$ =. +>.^$ $(new t.new) =. +>.^$ (sh-pest [%& p.i.new]) - %+ sh-repo-config-show + %+ sh-low-config-show (weld ~(sn-phat sn man p.i.new) ": ") [*config q.i.new] =. +>.$ |- ^+ +>.^$ ?~ cha +>.^$ =. +>.^$ $(cha t.cha) - %+ sh-repo-config-show + %+ sh-low-config-show (weld ~(sn-phat sn man p.i.cha) ": ") [(~(got by ole) `station`p.i.cha) q.i.cha] +>.$ @@ -842,7 +842,7 @@ ^- tape ['%' (trip p.saz)] :: - ++ sh-repo-rogue-diff + ++ sh-low-rogue-diff ::x calculates the difference between two maps of stations and their ::x presence lists. :: @@ -873,7 +873,7 @@ ret(new [i.owt new.ret]) ret :: - ++ sh-repo-group-diff-here :: print atlas diff + ++ sh-low-precs-diff :: print atlas diff ::x prints presence notifications. :: |= $: pre/tape @@ -903,11 +903,11 @@ (weld pre "set {(scow %p p.i.cha.cul)} {(sh-spaz q.i.cha.cul)}") +>.$ :: - ++ sh-repo-group-there :: update foreign + ++ sh-low-rempe :: update foreign ::x updates remote presences(?) and prints changes. :: |= {old/(map partner atlas) new/(map partner atlas)} - =+ day=(sh-repo-rogue-diff old new) + =+ day=(sh-low-rogue-diff old new) ?: (~(has in settings.she) %quiet) +>.$ =. +>.$ @@ -921,7 +921,7 @@ =. +>.^$ $(new.day t.new.day) =. +>.^$ (sh-note (weld "new " (~(ta-show ta man p.i.new.day) ~))) - (sh-repo-group-diff-here "--" ~ (~(tap by q.i.new.day)) ~) + (sh-low-precs-diff "--" ~ (~(tap by q.i.new.day)) ~) =. +>.$ |- ^+ +>.^$ ?~ cha.day +>.^$ @@ -929,8 +929,8 @@ =. +>.^$ (sh-note (weld "for " (~(ta-show ta man p.i.cha.day) ~))) =+ yez=(~(got by old) p.i.cha.day) - %+ sh-repo-group-diff-here "--" - (sh-repo-atlas-diff yez q.i.cha.day) + %+ sh-low-precs-diff "--" + (sh-low-atlas-diff yez q.i.cha.day) +>.$ :: ++ sh-low-precs @@ -938,8 +938,8 @@ :: |= {old/atlas new/atlas} ^+ +> - =+ dif=(sh-repo-atlas-diff old new) - (sh-repo-group-diff-here "" dif) + =+ dif=(sh-low-atlas-diff old new) + (sh-low-precs-diff "" dif) :: ++ sh-low-gram ::x renders telegram: increase gram count and print the gram. From 97a32fca797467729015fe3b7c692693a8803b48 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 4 Apr 2017 21:52:05 +0200 Subject: [PATCH 046/303] Renamed ++ra-diff-talk-lowdown- arms to ++ra-low-. --- app/talk-agent.hoon | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 0fd85bf3c2..4c14c2a9f5 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -132,22 +132,22 @@ ::x produce moves or sole-effects and moves. [[id.cli %diff %sole-effect u.foc] moz] :: - ++ ra-diff-talk-lowdown + ++ ra-low ::x process a talk lowdown :: |= low/lowdown ^+ +> ?- -.low - $glyph (ra-diff-talk-lowdown-glyph +.low) - $names (ra-diff-talk-lowdown-names +.low) - $tales (ra-diff-talk-lowdown-tales +.low) - $remco (ra-diff-talk-lowdown-remco +.low) - $precs (ra-diff-talk-lowdown-precs +.low) - $rempe (ra-diff-talk-lowdown-rempe +.low) - $grams (ra-diff-talk-lowdown-grams +.low) + $glyph (ra-low-glyph +.low) + $names (ra-low-names +.low) + $tales (ra-low-tales +.low) + $remco (ra-low-remco +.low) + $precs (ra-low-precs +.low) + $rempe (ra-low-rempe +.low) + $grams (ra-low-grams +.low) == :: - ++ ra-diff-talk-lowdown-glyph + ++ ra-low-glyph ::x apply new set of glyph bindings. :: |= nek/_nak @@ -162,7 +162,7 @@ (turn (~(tap by b)) |=(c/(set partner) [c a])) sh-abet:~(sh-prod sh ~ cli (main our.hid)) :: - ++ ra-diff-talk-lowdown-names + ++ ra-low-names ::x apply new local identities. :: |= nas/(map ship (unit human)) @@ -180,7 +180,7 @@ (some [s u.h]) == :: - ++ ra-diff-talk-lowdown-tales + ++ ra-low-tales ::x apply tale configs. :: |= {man/knot cof/(unit config)} @@ -190,13 +190,13 @@ =. +>.$ sh-abet:(~(sh-low-config sh ~ cli man) shape.tal (fall cof *config)) +>.$(tales (~(put by tales) man tal(shape u.cof))) :: - ++ ra-diff-talk-lowdown-remco + ++ ra-low-remco |= cofs/(map station config) ^+ +> =. +> sh-abet:(~(sh-low-remco sh ~ cli (main our.hid)) mirrors cofs) +>(mirrors (~(uni by mirrors) cofs)) :: - ++ ra-diff-talk-lowdown-precs + ++ ra-low-precs ::x apply new presence. :: |= {man/knot pes/atlas} @@ -209,7 +209,7 @@ sh-abet:(~(sh-low-precs sh ~ cli man) locals.u.tal nel) +>.$(tales (~(put by tales) man u.tal(locals nel))) :: - ++ ra-diff-talk-lowdown-rempe + ++ ra-low-rempe |= pas/(map partner atlas) ^+ +> =+ ner=(~(uni by remotes) pas) ::TODO better uni. @@ -217,7 +217,7 @@ =. remotes ner sh-abet:(~(sh-low-rempe sh ~ cli (main our.hid)) remotes ner) :: - ++ ra-diff-talk-lowdown-grams + ++ ra-low-grams ::x apply new grams :: |= {man/knot num/@ud gams/(list telegram)} @@ -1804,7 +1804,7 @@ ::x incoming talk-lowdown. process it. :: |= {way/wire low/lowdown} - ra-abet:(ra-diff-talk-lowdown:ra low) + ra-abet:(ra-low:ra low) :: ++ poke-sole-action :: accept console ::x incoming sole action. process it. From 0e850fc8bd2506572c3f9ef2f045c7de1849f93e Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 4 Apr 2017 21:55:05 +0200 Subject: [PATCH 047/303] Small changes, TODOs and miscellaneous cleanup. --- app/talk-agent.hoon | 14 +++++++------- app/talk-guardian.hoon | 27 ++++++++++++--------------- sur/talk.hoon | 7 ++----- 3 files changed, 21 insertions(+), 27 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 4c14c2a9f5..b0d4779408 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -138,13 +138,13 @@ |= low/lowdown ^+ +> ?- -.low - $glyph (ra-low-glyph +.low) - $names (ra-low-names +.low) - $tales (ra-low-tales +.low) - $remco (ra-low-remco +.low) - $precs (ra-low-precs +.low) - $rempe (ra-low-rempe +.low) - $grams (ra-low-grams +.low) + $glyph (ra-low-glyph +.low) + $names (ra-low-names +.low) + $tales (ra-low-tales +.low) + $remco (ra-low-remco +.low) + $precs (ra-low-precs +.low) + $rempe (ra-low-rempe +.low) + $grams (ra-low-grams +.low) == :: ++ ra-low-glyph diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 550072c3d1..ff6379e80b 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -8,15 +8,14 @@ ::TODO remove old/unused code ::TODO improve naming. way->wir, rad->rep, etc. ::TODO tidiness, remove unnecessary ~&, etc. -::TODO better presence notifications. typing, idle... -:: -::TODO crash on pokes/peers we do not expect -::TODO send %names report when a reader first connects -::TODO merge follower groups into followers -::TODO rename cores. ra->ta (transaction), pa->to (story). ::TODO maybe ensure every arm has a mini-description at :57 too? ::TODO maybe prefix all printfs and other errors with %talk? :: +::TODO sending remotes and mirrors alongside locals and shape no longer makes +:: any sense, does it? +::TODO crash on pokes/peers we do not expect +::TODO rename cores. ra->ta (transaction), pa->to (story). +:: /? 310 :: hoon version /- talk, sole :: structures /+ talk, sole, time-to-id, twitter :: libraries @@ -31,6 +30,7 @@ => |% :: data structures ++ house :: $: stories/(map knot story) :: conversations + ::TODO maybe also store locals/shapes for easier syncing with readers remotes/(map partner atlas) :: remote presence mirrors/(map station config) :: remote config ::TODO rename to readers? @@ -436,7 +436,6 @@ ?. (team our.hid her) ~& [%foreign-reader her] +> - ~& [%subscribed-reader ost.hid] (ra-welcome(general (~(put in general) ost.hid)) ost.hid) ::?. ?=({@ *} pax) :: (ra-evil %talk-bad-path) @@ -450,11 +449,11 @@ ?. (pa-visible:soy her) (ra-evil %talk-no-story) ::TODO? or (pa-sauce ost.hid [%quit ~]~) ? - =^ who +>.$ (ra-human her) ::TODO? can we safely move this down? + =^ who +>.$ (ra-human her) ::x send current data to bring her up to date. - =. soy (pa-report-group:soy ost.hid ~ ~) =. soy (pa-report-cabal:soy ost.hid ~ ~) - =. soy (pa-first-grams:soy her t.pax) + ::=. soy (pa-report-group:soy ost.hid ~ ~) ::TODO reenable if pa-not=dif + =. soy (pa-first-grams:soy her t.pax) ::x also adds new sub to followers ::x add her status to presence map. =. soy (pa-notify:soy her %hear who) ::x apply changes to story. @@ -683,7 +682,7 @@ ^+ +> ::x verify we are supposed to receive reports from cuz. ?. (~(has in sources.shape) [%& cuz]) - ~& [%pa-diff-unexpected cuz rad] + ~& [%pa-diff-unexpected cuz -.rad] +> ?- -.rad $cabal (pa-cabal cuz +.rad) @@ -749,7 +748,6 @@ $| !! $& :: ~& [%pa-acquire [our.hid man] [p.p.tay q.p.tay]] :_ ~ - ~& [%pa-acquire /[man]/(scot %p p.p.tay)/[q.p.tay]] :* %peer /friend/show/[man]/(scot %p p.p.tay)/[q.p.tay] [p.p.tay %talk-guardian] @@ -788,11 +786,9 @@ ::x add her status to our presence map. if this changes it, send report. :: |= {her/ship saz/status} - ~& [%b-pa-notify man her saz] ^+ +> =/ nol (~(put by locals) her saz) ?: =(nol locals) +>.$ - ~& [%notifying pa-followers nol] =. +>.$ (pa-inform %precs man nol) (pa-report-group(locals nol) pa-followers) :: @@ -818,7 +814,7 @@ ::TODO use =; lab/{dun/? end/@u zeg/(list telegram)} =- :: ~& [%pa-start riv lab] =. +>.$ - (pa-sauce ost.hid [[%diff %talk-report %grams q.lab r.lab] ~]) + (pa-sauce ost.hid [[%diff %talk-report %grams q.lab r.lab] ~]) ?: p.lab ::x? dun never gets changed, so always | ? (pa-sauce ost.hid [[%quit ~] ~]) +>.$(followers (~(put by followers) ost.hid riv)) @@ -969,6 +965,7 @@ ~& [%b-peer pax src.hid ost.hid] ^+ [*(list move) +>] ~? !(team src.hid our.hid) [%peer-talk-stranger src.hid] + ?: ?=({$sole *} pax) ~&(%broker-no-sole !!) ra-abet:(ra-subscribe:ra src.hid pax) :: ++ poke-talk-command :: accept command diff --git a/sur/talk.hoon b/sur/talk.hoon index 015c259c49..a74e921aa8 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -57,15 +57,13 @@ {$group register} :: presence == :: ++ lowdown :: changed shared state - ::TODO change these so that they're always just the diff. + ::TODO change these so that they're always just the diff? + :: re-check existing implementations too! :: this will aid with ++sh's printing. $% {$glyph (jug char (set partner))} :: new bindings {$names (map ship (unit human))} :: new identities - ::TODO cabal, or merge its contents into tale's config - :: basically we just want to merge the ship sets, right? {$tales (pair knot (unit config))} :: changed config {$remco (map station config)} :: remote configs - ::TODO merge remote and local presences. {$precs (pair knot atlas)} :: changed presence {$rempe (map partner atlas)} :: remote presences {$grams (pair knot (pair @ud (list telegram)))} :: new grams @@ -85,7 +83,6 @@ {$ire p/serial q/speech} :: in-reply-to {$lin p/? q/@t} :: no/@ text line {$mor p/(list speech)} :: multiplex - ::TODO? what are p and q supposed to be? {$app p/@tas q/@t} :: app message $: $api :: api message service/@tas :: service name From 2a3dffc8c4e2f835adb1823a0a3d07403e7f7313 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 10 Apr 2017 22:24:25 +0200 Subject: [PATCH 048/303] Implemented %action and %reaction types for better reader-broker comms. Opens up new possibilities for refactoring. --- app/talk-agent.hoon | 58 +++++++++++++++++++++++++++++++++++------- app/talk-guardian.hoon | 45 ++++++++++++++++++++++++++++---- sur/talk.hoon | 11 ++++++++ 3 files changed, 100 insertions(+), 14 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index b0d4779408..ce591a7833 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -47,6 +47,7 @@ == :: ++ pear :: poke fruit $% {$talk-command command} :: + {$talk-action action} :: {$talk-update update} :: == :: ++ card :: general card @@ -132,6 +133,13 @@ ::x produce moves or sole-effects and moves. [[id.cli %diff %sole-effect u.foc] moz] :: + ++ ra-reaction + ::x process a talk reaction. + :: + |= rac/reaction + ^+ +> + sh-abet:(~(sh-reaction sh ~ ~ cli (main our.hid)) rac) + :: ++ ra-low ::x process a talk lowdown :: @@ -160,7 +168,7 @@ %+ turn (~(tap by nek)) |= {a/char b/(set (set partner))} (turn (~(tap by b)) |=(c/(set partner) [c a])) - sh-abet:~(sh-prod sh ~ cli (main our.hid)) + sh-abet:~(sh-prod sh ~ ~ cli (main our.hid)) :: ++ ra-low-names ::x apply new local identities. @@ -187,13 +195,13 @@ ^+ +> ?~ cof +>(tales (~(del by tales) man)) =+ tal=(fall (~(get by tales) man) *tale) - =. +>.$ sh-abet:(~(sh-low-config sh ~ cli man) shape.tal (fall cof *config)) + =. +>.$ sh-abet:(~(sh-low-config sh ~ ~ cli man) shape.tal (fall cof *config)) +>.$(tales (~(put by tales) man tal(shape u.cof))) :: ++ ra-low-remco |= cofs/(map station config) ^+ +> - =. +> sh-abet:(~(sh-low-remco sh ~ cli (main our.hid)) mirrors cofs) + =. +> sh-abet:(~(sh-low-remco sh ~ ~ cli (main our.hid)) mirrors cofs) +>(mirrors (~(uni by mirrors) cofs)) :: ++ ra-low-precs @@ -206,7 +214,7 @@ =+ nel=(~(uni by locals.u.tal) pes) =. +>.$ ?: =(locals.u.tal nel) +>.$ - sh-abet:(~(sh-low-precs sh ~ cli man) locals.u.tal nel) + sh-abet:(~(sh-low-precs sh ~ ~ cli man) locals.u.tal nel) +>.$(tales (~(put by tales) man u.tal(locals nel))) :: ++ ra-low-rempe @@ -215,7 +223,7 @@ =+ ner=(~(uni by remotes) pas) ::TODO better uni. ?: =(remotes ner) +>.$ =. remotes ner - sh-abet:(~(sh-low-rempe sh ~ cli (main our.hid)) remotes ner) + sh-abet:(~(sh-low-rempe sh ~ ~ cli (main our.hid)) remotes ner) :: ++ ra-low-grams ::x apply new grams @@ -224,7 +232,7 @@ ^+ +> =+ tal=(~(get by tales) man) ?~ tal ~&([%know-no-tale man] +>.$) - =. +>.$ sh-abet:(~(sh-low-grams sh ~ cli man) num gams) + =. +>.$ sh-abet:(~(sh-low-grams sh ~ ~ cli man) num gams) pa-abet:(~(pa-lesson pa man u.tal) gams) :: ++ ra-emil :: ra-emit move list @@ -247,7 +255,7 @@ ?. =(id.cli ost.hid) ~& %strange-sole !! - sh-abet:(~(sh-sole sh ~ cli (main our.hid)) act) + sh-abet:(~(sh-sole sh ~ ~ cli (main our.hid)) act) :: ++ ra-console ::x make a shell for her. @@ -263,7 +271,7 @@ == =/ she/shell %*(. *shell id ost.hid, active (sy [%& our.hid man] ~)) - sh-abet:~(sh-prod sh ~ she man) + sh-abet:~(sh-prod sh ~ ~ she man) :: ++ ra-init ::x populate state on first boot. subscribes to our broker. @@ -365,6 +373,7 @@ ::x she: console session state used in this core. :: coz/(list command) + acs/(list action) she/shell man/knot == @@ -528,7 +537,17 @@ ::x [coz new]). produces an updated context for the ++sh core. :: ^+ +> ::x points to ++sh's |_ core's context. - %. ^- (list move) + %. %+ weld + %- flop + %+ turn acs + |= a/action + ^- move + :* ost.hid + %poke + /reader/action + (broker our.hid) + [%talk-action a] + == %- flop %+ turn coz |= c/command @@ -654,6 +673,12 @@ ?: (~(has in lax) pan) `pan $(grams t.grams) :: + ++ sh-reaction + ::x renders a reaction. + :: + |= rac/reaction + (sh-lame (trip what.rac)) + :: ++ sh-low-atlas-diff ::x calculates the difference between two atlasses (presence lists). :: @@ -1072,6 +1097,12 @@ |= cod/command %_(+> coz [cod coz]) :: + ++ sh-act + ::x adds an action to the core state. + :: + |= act/action + %_(+> acs [act acs]) + :: ++ sh-twig-head ^- vase :: eval data ::x makes a vase of environment data to evaluate against (#-messages). :: @@ -1806,6 +1837,15 @@ |= {way/wire low/lowdown} ra-abet:(ra-low:ra low) :: +++ diff-talk-reaction :: accept reaction + ::x incoming talk reaction. process it. + :: + |= {way/wire rac/reaction} + ?. =(src.hid -:(broker our.hid)) + ~& [%diff-reaction-stranger src.hid] + [~ +>] + ra-abet:(ra-reaction:ra rac) +:: ++ poke-sole-action :: accept console ::x incoming sole action. process it. :: diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index ff6379e80b..96489c8c0e 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -59,6 +59,7 @@ ++ lime :: diff fruit $% {$talk-report report} :: {$talk-lowdown lowdown} :: + {$talk-reaction reaction} :: {$sole-effect sole-effect} :: == :: ++ pear :: poke fruit @@ -193,6 +194,31 @@ |= {b/bone l/(list move)} [[b %diff %talk-lowdown low] l] :: + ++ ra-react + ::x send a talk-reaction to a reader. + :: + |= {red/bone rac/reaction} + %- ra-emit + [red %diff %talk-reaction rac] + :: + ++ ra-action + ::x peforms action sent by a reader. + :: + |= {red/bone act/action} + ^+ +> + ?- -.act + $create + ~&(%talk-action-create !!) + $permit + =+ soy=(~(get by stories) p.act) + ?~ soy + %+ ra-react red + [%fail (crip (weld "no story " (trip p.act))) `act] + pa-abet:(~(pa-permit pa p.act ~ u.soy) q.act r.act) + $say + ~&(%talk-action-say !!) + == + :: ++ ra-update ::x applies update sent by her. :: @@ -210,7 +236,7 @@ ::x uses our because status is per identity, not per client. ::TODO check if this can crash or not. =< pa-abet - (~(pa-notify pa n.p.dup (~(got by stories) n.p.dup)) our.hid q.dup) + (~(pa-notify pa n.p.dup ~ (~(got by stories) n.p.dup)) our.hid q.dup) :: $human ::x change an identity. ?. =((~(get by folks) her) `q.dup) @@ -235,7 +261,7 @@ |= {man/knot con/config} ^+ +> =+ pur=(fall (~(get by stories) man) *story) - pa-abet:(~(pa-reform pa man pur) con) + pa-abet:(~(pa-reform pa man ~ pur) con) :: ++ ra-unconfig |= man/knot @@ -243,7 +269,7 @@ =+ soy=(~(get by stories) man) ?~ soy +>.$ =. stories (~(del by stories) man) - pa-abet:~(pa-reform-gone pa man u.soy) + pa-abet:~(pa-reform-gone pa man ~ u.soy) :: ++ ra-base-hart ::x produces our ship's host desk's web address as a hart. @@ -356,7 +382,7 @@ ~& [%ra-know-not man] :: XX should crash +>+>.$ ::x call the sample gate with a ++pa core. - (fun ~(. pa man u.pur)) + (fun ~(. pa man ~ u.pur)) :: ++ ra-diff-talk-report :: subscription update ::x process a talk report from cuz into story man. @@ -444,7 +470,7 @@ ?~ pur ~& [%bad-subscribe-story-c i.pax] (ra-evil %talk-no-story) - =+ soy=~(. pa i.pax u.pur) + =+ soy=~(. pa i.pax `(list command)`~ u.pur) ::TODO nest-fail if no cast ::x she needs read permissions to subscribe. ?. (pa-visible:soy her) (ra-evil %talk-no-story) @@ -979,6 +1005,15 @@ =^ mow +>.$ log-all-to-file [(welp mos mow) +>.$] :: +++ poke-talk-action :: accept action + ::x incoming talk action. process it. + :: + |= act/action + ?. (team src.hid our.hid) + ~& [%talk-action-stranger src.hid] + [~ +>] + ra-abet:(ra-action:ra ost.hid act) +:: ++ poke-talk-update :: accept update ::x incoming talk update. process it. :: diff --git a/sur/talk.hoon b/sur/talk.hoon index a74e921aa8..3d01f14668 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -10,6 +10,17 @@ {$publish (list thought)} :: originate {$review (list thought)} :: deliver == :: +++ action :: user action + $% {$create (pair knot (pair cord posture))} :: configure + destroy + {$permit (trel knot ? (set ship))} :: invite/banish + {$say (list (pair audience statement))} :: originate + ::TODO probably include ++update in this. :: + == :: +++ reaction :: user information + $: kind/?($info $fail) :: result + what/@t :: explain + why/(unit action) :: cause + == :: ++ update :: change shared state $% {$status (pair (set knot) status)} :: our status update {$human (pair ship human)} :: new identity From c33d5a04e597fe6f515d5ad73a724b458973147a Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 10 Apr 2017 22:35:25 +0200 Subject: [PATCH 049/303] Implemented ;invite and ;banish for giving and denying permission to stations. Read permissions for journals and mailboxes are constant: all and our team resp. --- app/talk-agent.hoon | 45 +++++++++++--------- app/talk-guardian.hoon | 97 ++++++++++++++++++++++++++++++++++++------ lib/talk.hoon | 5 +++ sur/talk.hoon | 10 ++--- 4 files changed, 118 insertions(+), 39 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index ce591a7833..b4047ae311 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -65,10 +65,8 @@ {$leave p/where} :: {$say p/(list speech)} :: {$eval p/cord q/twig} :: - {$invite p/knot q/(list partner)} :: whitelist add - {$banish p/knot q/(list partner)} :: blacklist add - {$block p/knot q/(list partner)} :: blacklist add - {$author p/knot q/(list partner)} :: whitelist add + {$invite p/knot q/(set ship)} :: give permission + {$banish p/knot q/(set ship)} :: deny permission {$nick p/(unit ship) q/(unit cord)} :: {$set p/knot} :: {$unset p/knot} :: @@ -496,6 +494,9 @@ ;~(pfix cen sym) qut == + :: + ;~((glue ace) (perk %invite ~) ;~(pfix cen sym) shiz) + ;~((glue ace) (perk %banish ~) ;~(pfix cen sym) shiz) :: ;~(plug (perk %who ~) ;~(pose ;~(pfix ace para) (easy ~))) ;~(plug (perk %bind ~) ;~(pfix ace glyph) (punt ;~(pfix ace para))) @@ -1128,8 +1129,6 @@ $bind (bind +.job) $invite (invite +.job) $banish (banish +.job) - $author (author +.job) - $block (block +.job) $create (create +.job) $nick (nick +.job) $set (wo-set +.job) @@ -1230,24 +1229,14 @@ (sh-note:(set-glyph cha u.pan) "bound {} {}") :: ++ invite :: %invite - |= {nom/knot tal/(list partner)} + |= {nom/knot sis/(set ship)} ^+ ..sh-work - !! - :: - ++ block :: %block - |= {nom/knot tal/(list partner)} - ^+ ..sh-work - !! - :: - ++ author :: %author - |= {nom/knot tal/(list partner)} - ^+ ..sh-work - !! + (sh-act %permit nom & sis) :: ++ banish :: %banish - |= {nom/knot tal/(list partner)} + |= {nom/knot sis/(set ship)} ^+ ..sh-work - !! + (sh-act %permit nom | sis) :: ++ create :: %create |= {por/posture nom/knot txt/cord} @@ -1720,6 +1709,15 @@ $url url+(crip (earf p.sep)) $mor mor+(turn p.sep |=(speech ^$(sep +<))) $fat [%mor $(sep q.sep) tan+(tr-rend-tors p.sep) ~] + $inv + :- %tan + :_ ~ + :- %leaf + %+ weld + ?: p.sep + "you have been invited to " + "you have been banished from " + ~(sn-phat sn man q.sep) $api :- %tan :_ ~ @@ -1807,6 +1805,13 @@ (~(del in pal) [%& who (main who)]) (weld ~(te-pref te man pal) txt) (weld " " txt) + :: + $inv + %+ weld + ?: p.sep + " invited you to " + " banished you from " + ~(sn-phat sn man q.sep) :: $app (tr-chow 64 "[{(trip p.sep)}]: {(trip q.sep)}") diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 96489c8c0e..bad0ffda50 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -260,7 +260,12 @@ :: |= {man/knot con/config} ^+ +> - =+ pur=(fall (~(get by stories) man) *story) + =+ :- neu=!(~(has by stories) man) + pur=(fall (~(get by stories) man) *story) + ::x if we just created the story, and it's invite only, make sure we're in. + =. con ::TODO =? + ?. &(neu ?=(?($white $green) p.cordon.con)) con + con(q.cordon [our.hid ~ ~]) pa-abet:(~(pa-reform pa man ~ pur) con) :: ++ ra-unconfig @@ -594,19 +599,33 @@ ::x story core, used for doing work on a story. ::x as always, an -abet arms is used for applying changes to the state. ::x ++pa-watch- arms get called by ++ra-subscribe to add a subscriber. - ::x bones are used to identify subscribers (source event identifiers) + ::x bones are used to identify subscribers (source event identifiers). :: |_ ::x man: the knot identifying the story in stories. - ::x story doesn't get a face because ease of use + ::x coz: talk commands issued due to changes. + ::x story doesn't get a face because ease of use. :: $: man/knot + coz/(list command) story == ++ pa-abet ::x apply/fold changes back into the stories map. :: ^+ +> - +>(stories (~(put by stories) man `story`+<+)) + =. +> +>(stories (~(put by stories) man `story`+<+>)) + =. coz (flop coz) + |- ^+ +>+ + ?~ coz +>+ + =. +>+ (ra-apply our.hid i.coz) + $(coz t.coz) + :: + ++ pa-tell + ::x stores a talk command. + :: + |= cod/command + ^+ +> + +>(coz [cod coz]) :: ++ pa-followers ^- (set bone) @@ -621,11 +640,12 @@ :: |= her/ship ^- ? - ::?- -.cordon.shape - :: %& (~(has in p.cordon.shape) her) - :: %| !(~(has in p.cordon.shape) her) - ::== - & + ?- p.cordon.shape + $black !(~(has in q.cordon.shape) her) ::x channel, blacklist + $green (~(has in q.cordon.shape) her) ::x journal, whitelist + $brown !(~(has in q.cordon.shape) her) ::x mailbox, blacklist + $white (~(has in q.cordon.shape) her) ::x village, whitelist + == :: ++ pa-visible :: display to ::x checks her read permissions. @@ -633,10 +653,10 @@ |= her/ship ^- ? ?- p.cordon.shape - $black & ::x channel, all + $black !(~(has in q.cordon.shape) her) ::x channel, blacklist $green & ::x journal, all $brown (team our.hid her) ::x mailbox, our - $white (~(has in q.cordon.shape) her) ::x village, invite + $white (~(has in q.cordon.shape) her) ::x village, whitelist == :: ++ pa-report :: update @@ -869,8 +889,8 @@ :: |= {her/ship pax/path} ^+ +> - ?. (pa-admire her) - ~& [%pa-first-grams-admire ~] + ?. (pa-visible her) + ~& [%pa-first-grams-visible ~] (pa-sauce ost.hid [%quit ~]~) ::x find the range of grams to send. =+ ^= ruv ^- (unit river) @@ -940,7 +960,6 @@ ^+ +> ::x if author isn't allowed to write here, reject. ?. (pa-admire p.gam) - ~& %pa-admire-rejected +>.$ =. q.q.gam ::x if we are in the audience, mark us as having received it. @@ -981,6 +1000,56 @@ +>.$ :: no change =. grams (welp (scag (dec way) grams) [gam (slag way grams)]) (pa-refresh num gam) + :: + ++ pa-unearth + ::x find the bones in our follower list than belong to a ship in sis. + :: + |= sis/(set ship) + ^- (set bone) + %- ~(rep in sup.hid) + |= {{b/bone s/ship p/path} c/(set bone)} + ?. ?& (~(has in sis) s) + (~(has by followers) b) + ?=({@tas *} p) + =(i.p man) + == + c + (~(put in c) b) + :: + ++ pa-permit + ::x invite/banish ships to/from this station. + :: + |= {inv/? sis/(set ship)} + ^+ +> + =/ white/? ?=(?($white $green) p.cordon.shape) :: whitelist? + =/ add/? =(inv white) :: add to list? + =. followers ::TODO =? + ?: inv followers + %- ~(rep in (pa-unearth sis)) + |= {b/bone f/_followers} + =. f ?~ f followers f ::TODO =? + (~(del by f) b) + =. +>.$ + %- pa-tell + :- %publish + %- ~(rep in sis) + |= {s/ship t/(list thought)} + :_ t + =^ sir eny.hid (uniq eny.hid) + :+ sir :: serial + [[[%& s (main s)] [*envelope %pending]] ~ ~] :: audience + :+ now.hid ~ :: statement + [%inv inv [our.hid man]] + %- pa-reform + %= shape + q.cordon + %. sis + ?: add + ~& [%new-shape (~(uni in q.cordon.shape) sis)] + ~(uni in q.cordon.shape) + ~& [%new-shape (~(dif in q.cordon.shape) sis)] + ~(dif in q.cordon.shape) + == -- -- :: diff --git a/lib/talk.hoon b/lib/talk.hoon index 5a5f619e1c..f161df768a 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -42,4 +42,9 @@ :+ (shaf %thot eny) [[[%& our (main our)] [*envelope %pending]] ~ ~] [now *bouquet [%app dap (crip ~(ram re i.mes))]] +:: +++ uniq + |= eny/@uvJ + ^- {@uvH _eny} + [(shaf %serial eny) (shax eny)] -- diff --git a/sur/talk.hoon b/sur/talk.hoon index 3d01f14668..d6a42ce1c5 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -53,10 +53,10 @@ $% {$twitter p/@t} :: twitter == :: ++ posture :: security posture - $? $black :: channel - $white :: village - $green :: journal - $brown :: mailbox + $? $black :: channel, blacklist + $white :: village, whitelist + $green :: journal, author list + $brown :: mailbox, our + black == :: ++ presence ?($gone $hear $talk) :: status type ++ register (pair atlas (map partner atlas)) :: ping me, ping srcs @@ -89,7 +89,7 @@ :: ...that's probably what %gall is, but then why do we have $ext? {$ext p/@tas q/*} :: extended action {$fat p/torso q/speech} :: attachment - :: {$inv p/station} :: invite to station + {$inv p/? q/station} :: inv/ban for station {$url p/purf} :: parsed url {$ire p/serial q/speech} :: in-reply-to {$lin p/? q/@t} :: no/@ text line From 38b91e2f373b65f04c3aa1e4570a1e3a9750f0fb Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 11 Apr 2017 12:18:37 +0200 Subject: [PATCH 050/303] Implemented ++ra-know equivalent that sends a reaction if story lookup fails. --- app/talk-guardian.hoon | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index bad0ffda50..02a04feac5 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -210,13 +210,8 @@ $create ~&(%talk-action-create !!) $permit - =+ soy=(~(get by stories) p.act) - ?~ soy - %+ ra-react red - [%fail (crip (weld "no story " (trip p.act))) `act] - pa-abet:(~(pa-permit pa p.act ~ u.soy) q.act r.act) - $say - ~&(%talk-action-say !!) + %- (ra-affect p.act red `act) |= par/_pa =< pa-abet + (pa-permit:par q.act r.act) == :: ++ ra-update @@ -389,6 +384,19 @@ ::x call the sample gate with a ++pa core. (fun ~(. pa man ~ u.pur)) :: + ++ ra-affect + ::x attempt to retrieve a story and call a sample gate with it. + ::x if no such story, react. + :: + |= {man/knot red/bone act/(unit action)} + |* fun/$-(_pa _+>) + ^+ +>+> + =+ pur=(~(get by stories) man) + ?~ pur + %+ ra-react red + [%fail (crip (weld "no story " (trip man))) act] + (fun ~(. pa man ~ u.pur)) + :: ++ ra-diff-talk-report :: subscription update ::x process a talk report from cuz into story man. :: From eebd69903207b3f20954cbc3239f435c2ee3a0a7 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 11 Apr 2017 13:00:13 +0200 Subject: [PATCH 051/303] Removed ++update in favor of ++action. --- app/talk-agent.hoon | 68 ++++++++++++++++-------------------------- app/talk-guardian.hoon | 64 +++++++++++++++++---------------------- sur/talk.hoon | 16 +++++----- 3 files changed, 60 insertions(+), 88 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index b4047ae311..90351173f9 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -48,7 +48,6 @@ ++ pear :: poke fruit $% {$talk-command command} :: {$talk-action action} :: - {$talk-update update} :: == :: ++ card :: general card $% {$diff lime} :: @@ -136,7 +135,7 @@ :: |= rac/reaction ^+ +> - sh-abet:(~(sh-reaction sh ~ ~ cli (main our.hid)) rac) + sh-abet:(~(sh-reaction sh ~ cli (main our.hid)) rac) :: ++ ra-low ::x process a talk lowdown @@ -166,7 +165,7 @@ %+ turn (~(tap by nek)) |= {a/char b/(set (set partner))} (turn (~(tap by b)) |=(c/(set partner) [c a])) - sh-abet:~(sh-prod sh ~ ~ cli (main our.hid)) + sh-abet:~(sh-prod sh ~ cli (main our.hid)) :: ++ ra-low-names ::x apply new local identities. @@ -193,13 +192,13 @@ ^+ +> ?~ cof +>(tales (~(del by tales) man)) =+ tal=(fall (~(get by tales) man) *tale) - =. +>.$ sh-abet:(~(sh-low-config sh ~ ~ cli man) shape.tal (fall cof *config)) + =. +>.$ sh-abet:(~(sh-low-config sh ~ cli man) shape.tal (fall cof *config)) +>.$(tales (~(put by tales) man tal(shape u.cof))) :: ++ ra-low-remco |= cofs/(map station config) ^+ +> - =. +> sh-abet:(~(sh-low-remco sh ~ ~ cli (main our.hid)) mirrors cofs) + =. +> sh-abet:(~(sh-low-remco sh ~ cli (main our.hid)) mirrors cofs) +>(mirrors (~(uni by mirrors) cofs)) :: ++ ra-low-precs @@ -212,7 +211,7 @@ =+ nel=(~(uni by locals.u.tal) pes) =. +>.$ ?: =(locals.u.tal nel) +>.$ - sh-abet:(~(sh-low-precs sh ~ ~ cli man) locals.u.tal nel) + sh-abet:(~(sh-low-precs sh ~ cli man) locals.u.tal nel) +>.$(tales (~(put by tales) man u.tal(locals nel))) :: ++ ra-low-rempe @@ -221,7 +220,7 @@ =+ ner=(~(uni by remotes) pas) ::TODO better uni. ?: =(remotes ner) +>.$ =. remotes ner - sh-abet:(~(sh-low-rempe sh ~ ~ cli (main our.hid)) remotes ner) + sh-abet:(~(sh-low-rempe sh ~ cli (main our.hid)) remotes ner) :: ++ ra-low-grams ::x apply new grams @@ -230,7 +229,7 @@ ^+ +> =+ tal=(~(get by tales) man) ?~ tal ~&([%know-no-tale man] +>.$) - =. +>.$ sh-abet:(~(sh-low-grams sh ~ ~ cli man) num gams) + =. +>.$ sh-abet:(~(sh-low-grams sh ~ cli man) num gams) pa-abet:(~(pa-lesson pa man u.tal) gams) :: ++ ra-emil :: ra-emit move list @@ -253,7 +252,7 @@ ?. =(id.cli ost.hid) ~& %strange-sole !! - sh-abet:(~(sh-sole sh ~ ~ cli (main our.hid)) act) + sh-abet:(~(sh-sole sh ~ cli (main our.hid)) act) :: ++ ra-console ::x make a shell for her. @@ -269,7 +268,7 @@ == =/ she/shell %*(. *shell id ost.hid, active (sy [%& our.hid man] ~)) - sh-abet:~(sh-prod sh ~ ~ she man) + sh-abet:~(sh-prod sh ~ she man) :: ++ ra-init ::x populate state on first boot. subscribes to our broker. @@ -371,7 +370,6 @@ ::x she: console session state used in this core. :: coz/(list command) - acs/(list action) she/shell man/knot == @@ -538,18 +536,7 @@ ::x [coz new]). produces an updated context for the ++sh core. :: ^+ +> ::x points to ++sh's |_ core's context. - %. %+ weld - %- flop - %+ turn acs - |= a/action - ^- move - :* ost.hid - %poke - /reader/action - (broker our.hid) - [%talk-action a] - == - %- flop + %. %- flop %+ turn coz |= c/command ^- move @@ -568,19 +555,20 @@ ^+ +> +>(moves :_(moves [id.she %diff %sole-effect fec])) :: - ++ sh-update - ::x adds a talk-update to ++ra's moves + ++ sh-action + ::x adds a talk-action to ++ra's moves :: - |= dup/update + |= act/action ^+ +> %= +> - moves :_ moves - :* ost.hid - %poke - /reader/update - (broker our.hid) - [%talk-update dup] - == + moves + :_ moves + :* ost.hid + %poke + /reader/action + (broker our.hid) + [%talk-action act] + == == :: ++ sh-prod :: show prompt @@ -1098,12 +1086,6 @@ |= cod/command %_(+> coz [cod coz]) :: - ++ sh-act - ::x adds an action to the core state. - :: - |= act/action - %_(+> acs [act acs]) - :: ++ sh-twig-head ^- vase :: eval data ::x makes a vase of environment data to evaluate against (#-messages). :: @@ -1166,7 +1148,7 @@ =: nik (~(put by nik) lix cha) nak (~(put ju nak) cha lix) == - (sh-update %bind cha lix) + (sh-action %glyph cha lix) :: ++ join :: %join |= pan/(set partner) @@ -1231,12 +1213,12 @@ ++ invite :: %invite |= {nom/knot sis/(set ship)} ^+ ..sh-work - (sh-act %permit nom & sis) + (sh-action %permit nom & sis) :: ++ banish :: %banish |= {nom/knot sis/(set ship)} ^+ ..sh-work - (sh-act %permit nom | sis) + (sh-action %permit nom | sis) :: ++ create :: %create |= {por/posture nom/knot txt/cord} @@ -1288,7 +1270,7 @@ |= p/ship [%txt "{

}: {}"] %. [%human u.her [true=~ hand=nym]] - %= sh-update + %= sh-action folks ?~ u.nym (~(del by folks) u.her) ::x unset nickname (~(put by folks) u.her [true=~ hand=nym]) ::x set nickname diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 02a04feac5..35c2e5bfb7 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -207,46 +207,42 @@ |= {red/bone act/action} ^+ +> ?- -.act - $create + :: + :: station configuration + :: + $create :: create station ~&(%talk-action-create !!) - $permit + :: + $permit :: invite/banish %- (ra-affect p.act red `act) |= par/_pa =< pa-abet (pa-permit:par q.act r.act) - == - :: - ++ ra-update - ::x applies update sent by her. - :: - |= {her/ship dup/update} - ^+ +> - ::x only allow updates by our team. - ?. (team our.hid her) +> - ?- -.dup - $status ::x update our status. + :: + :: personal metadata + :: + $status :: our status update ::x for every knot (story) in the set, update our status. |- ^+ +>.^$ - ?~ p.dup +>.^$ - =. +>.^$ $(p.dup l.p.dup) - =. +>.^$ $(p.dup r.p.dup) - ::x uses our because status is per identity, not per client. - ::TODO check if this can crash or not. - =< pa-abet - (~(pa-notify pa n.p.dup ~ (~(got by stories) n.p.dup)) our.hid q.dup) - :: - $human ::x change an identity. - ?. =((~(get by folks) her) `q.dup) - +> ::x no change. + ?~ p.act +>.^$ + =. +>.^$ $(p.act l.p.act) + =. +>.^$ $(p.act r.p.act) + %- (ra-affect n.p.act red `act) |= par/_pa =< pa-abet + (pa-notify:par our.hid q.act) + :: + :: changing shared ui + :: + $human :: new identity + ?. =((~(get by folks) p.act) `q.act) +> :: no change =. folks - ?~ hand.q.dup (~(del by folks) p.dup) - (~(put by folks) her q.dup) + ?~ hand.q.act (~(del by folks) p.act) + (~(put by folks) p.act q.act) %+ ra-inform %names ::TODO think long and hard, do we need unit for delition or is a human :: with [~ ~] good enough? if the latter, agent's $names will change. - (strap her ?~(hand.q.dup ~ `q.dup)) - :: - $bind ::x set glyph binding. - =. nik (~(put by nik) q.dup p.dup) - =. nak (~(put ju nak) p.dup q.dup) + (strap p.act ?~(hand.q.act ~ `q.act)) + :: + $glyph :: bind a glyph + =. nik (~(put by nik) q.act p.act) + =. nak (~(put ju nak) p.act q.act) (ra-inform %glyph nak) == :: @@ -1091,12 +1087,6 @@ [~ +>] ra-abet:(ra-action:ra ost.hid act) :: -++ poke-talk-update :: accept update - ::x incoming talk update. process it. - :: - |= dup/update - ra-abet:(ra-update:ra src.hid dup) -:: ++ diff-talk-report :: accept report ::x incoming talk-report. process it and update logs. :: diff --git a/sur/talk.hoon b/sur/talk.hoon index d6a42ce1c5..039b353d78 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -11,21 +11,21 @@ {$review (list thought)} :: deliver == :: ++ action :: user action - $% {$create (pair knot (pair cord posture))} :: configure + destroy + $% :: station configuration :: + {$create (pair knot (pair cord posture))} :: create station {$permit (trel knot ? (set ship))} :: invite/banish - {$say (list (pair audience statement))} :: originate - ::TODO probably include ++update in this. :: + :: personal metadata :: + ::TODO change to target partners, not only our stations. + {$status (pair (set knot) status)} :: our status update + :: changing shared ui :: + {$human (pair ship human)} :: new identity + {$glyph (pair char (set partner))} :: bind a glyph == :: ++ reaction :: user information $: kind/?($info $fail) :: result what/@t :: explain why/(unit action) :: cause == :: -++ update :: change shared state - $% {$status (pair (set knot) status)} :: our status update - {$human (pair ship human)} :: new identity - {$bind (pair char (set partner))} :: bind a glyph - == :: ++ cabal :: metaconfiguration $: loc/config :: local config ham/(map station config) :: neighborhood configs From 4b5010a7ba1fbd11942cfa64a7306b2c9c481d05 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 11 Apr 2017 13:08:15 +0200 Subject: [PATCH 052/303] ++sh no longer stores commands in its core, but adds moves directly to ++ra. --- app/talk-agent.hoon | 65 +++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 35 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 90351173f9..565e3783b4 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -135,7 +135,7 @@ :: |= rac/reaction ^+ +> - sh-abet:(~(sh-reaction sh ~ cli (main our.hid)) rac) + sh-abet:(~(sh-reaction sh cli (main our.hid)) rac) :: ++ ra-low ::x process a talk lowdown @@ -165,7 +165,7 @@ %+ turn (~(tap by nek)) |= {a/char b/(set (set partner))} (turn (~(tap by b)) |=(c/(set partner) [c a])) - sh-abet:~(sh-prod sh ~ cli (main our.hid)) + sh-abet:~(sh-prod sh cli (main our.hid)) :: ++ ra-low-names ::x apply new local identities. @@ -192,13 +192,13 @@ ^+ +> ?~ cof +>(tales (~(del by tales) man)) =+ tal=(fall (~(get by tales) man) *tale) - =. +>.$ sh-abet:(~(sh-low-config sh ~ cli man) shape.tal (fall cof *config)) + =. +>.$ sh-abet:(~(sh-low-config sh cli man) shape.tal (fall cof *config)) +>.$(tales (~(put by tales) man tal(shape u.cof))) :: ++ ra-low-remco |= cofs/(map station config) ^+ +> - =. +> sh-abet:(~(sh-low-remco sh ~ cli (main our.hid)) mirrors cofs) + =. +> sh-abet:(~(sh-low-remco sh cli (main our.hid)) mirrors cofs) +>(mirrors (~(uni by mirrors) cofs)) :: ++ ra-low-precs @@ -211,7 +211,7 @@ =+ nel=(~(uni by locals.u.tal) pes) =. +>.$ ?: =(locals.u.tal nel) +>.$ - sh-abet:(~(sh-low-precs sh ~ cli man) locals.u.tal nel) + sh-abet:(~(sh-low-precs sh cli man) locals.u.tal nel) +>.$(tales (~(put by tales) man u.tal(locals nel))) :: ++ ra-low-rempe @@ -220,7 +220,7 @@ =+ ner=(~(uni by remotes) pas) ::TODO better uni. ?: =(remotes ner) +>.$ =. remotes ner - sh-abet:(~(sh-low-rempe sh ~ cli (main our.hid)) remotes ner) + sh-abet:(~(sh-low-rempe sh cli (main our.hid)) remotes ner) :: ++ ra-low-grams ::x apply new grams @@ -229,7 +229,7 @@ ^+ +> =+ tal=(~(get by tales) man) ?~ tal ~&([%know-no-tale man] +>.$) - =. +>.$ sh-abet:(~(sh-low-grams sh ~ cli man) num gams) + =. +>.$ sh-abet:(~(sh-low-grams sh cli man) num gams) pa-abet:(~(pa-lesson pa man u.tal) gams) :: ++ ra-emil :: ra-emit move list @@ -252,7 +252,7 @@ ?. =(id.cli ost.hid) ~& %strange-sole !! - sh-abet:(~(sh-sole sh ~ cli (main our.hid)) act) + sh-abet:(~(sh-sole sh cli (main our.hid)) act) :: ++ ra-console ::x make a shell for her. @@ -268,7 +268,7 @@ == =/ she/shell %*(. *shell id ost.hid, active (sy [%& our.hid man] ~)) - sh-abet:~(sh-prod sh ~ she man) + sh-abet:~(sh-prod sh she man) :: ++ ra-init ::x populate state on first boot. subscribes to our broker. @@ -363,13 +363,10 @@ ::x track of settings and other frontend state. ::x important arms include ++sh-repo which is used to apply reports, and ::x ++sh-sole which gets called upon cli prompt interaction. - ::x any talk commands the core's arms want to have executed get put into - ::x coz. the stored commands get applied upon calling ++sh-abet. :: - |_ $: ::x coz: talk commands storage, applied by ++sh-abet. - ::x she: console session state used in this core. + |_ $: ::x she: console session state used in this core. + ::x man: our mailbox :: - coz/(list command) she/shell man/knot == @@ -531,22 +528,10 @@ == -- ++ sh-abet - ::x applies talk commands (in reverse order, because ++sh-tell adds them - ::x to coz as [new coz], but you want to apply them in the order - ::x [coz new]). produces an updated context for the ++sh core. + ::x stores changes to the cli. :: ^+ +> ::x points to ++sh's |_ core's context. - %. %- flop - %+ turn coz - |= c/command - ^- move - :* ost.hid - %poke - /reader/command - (broker our.hid) - [%talk-command c] - == - ra-emil(cli she) + +>(cli she) :: ++ sh-fact :: send console effect ::x adds a console effect to ++ra's moves. @@ -555,6 +540,22 @@ ^+ +> +>(moves :_(moves [id.she %diff %sole-effect fec])) :: + ++ sh-tell :: add command + ::x adds talk command to ++ra's moves. + :: + |= cod/command + ^+ +> + %= +> + moves + :_ moves + :* ost.hid + %poke + /reader/command + (broker our.hid) + [%talk-command cod] + == + == + :: ++ sh-action ::x adds a talk-action to ++ra's moves :: @@ -1080,12 +1081,6 @@ %+ turn (~(tap in active.she)) |=(a/partner [a *envelope %pending]) :: - ++ sh-tell :: add command - ::x adds talk command to core state. these get applied with ++sh-abet. - :: - |= cod/command - %_(+> coz [cod coz]) - :: ++ sh-twig-head ^- vase :: eval data ::x makes a vase of environment data to evaluate against (#-messages). :: @@ -1341,7 +1336,7 @@ ++ say :: publish |= sep/(list speech) ^+ ..sh-work - =- ..sh-work(coz ?~(tot coz :_(coz [%publish tot]))) + =- (sh-tell [%publish tot]) |- ^- tot/(list thought) ?~ sep ~ =^ sir ..sh-work sh-uniq From d769b2f32592f05705d5e162d8b95ac190626944 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 11 Apr 2017 13:24:07 +0200 Subject: [PATCH 053/303] Implemented %create action. --- app/talk-agent.hoon | 7 +------ app/talk-guardian.hoon | 6 ++++-- sur/talk.hoon | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 565e3783b4..98db0aadd1 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -1221,12 +1221,7 @@ ?: (~(has in tales) nom) (sh-lame "{(trip nom)}: already exists") =. ..sh-work - ::x create new config for channel. - %^ sh-tell %design nom - :- ~ - :+ [[%& our.hid nom] ~ ~] - (end 3 64 txt) - [por ~] + (sh-action %create nom txt por) (join [[%& our.hid nom] ~ ~]) :: ++ reverse-folks diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 35c2e5bfb7..b6dbfd62ca 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -211,7 +211,9 @@ :: station configuration :: $create :: create station - ~&(%talk-action-create !!) + ?. (~(has in stories) p.act) + (ra-config p.act [[%& our.hid p.act] ~ ~] q.act [r.act ~]) + (ra-react red %fail (crip "{(trip p.act)}: already exists") `act) :: $permit :: invite/banish %- (ra-affect p.act red `act) |= par/_pa =< pa-abet @@ -390,7 +392,7 @@ =+ pur=(~(get by stories) man) ?~ pur %+ ra-react red - [%fail (crip (weld "no story " (trip man))) act] + [%fail (crip "no story {(trip man)}") act] (fun ~(. pa man ~ u.pur)) :: ++ ra-diff-talk-report :: subscription update diff --git a/sur/talk.hoon b/sur/talk.hoon index 039b353d78..7d5fbaa5f8 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -12,7 +12,7 @@ == :: ++ action :: user action $% :: station configuration :: - {$create (pair knot (pair cord posture))} :: create station + {$create (trel knot cord posture)} :: create station {$permit (trel knot ? (set ship))} :: invite/banish :: personal metadata :: ::TODO change to target partners, not only our stations. From 59aa18e6d2ced813910cded32b362249974f7e28 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 11 Apr 2017 17:01:25 +0200 Subject: [PATCH 054/303] Merged local story configs and presences into the remote maps. Reader lowdowns no longer distinguish between local and remote stories. --- app/talk-agent.hoon | 41 ++++++++++----------------------------- app/talk-guardian.hoon | 44 +++++++++++++++++------------------------- sur/talk.hoon | 6 ++---- 3 files changed, 30 insertions(+), 61 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 98db0aadd1..82c742e970 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -145,10 +145,8 @@ ?- -.low $glyph (ra-low-glyph +.low) $names (ra-low-names +.low) - $tales (ra-low-tales +.low) - $remco (ra-low-remco +.low) + $confs (ra-low-confs +.low) $precs (ra-low-precs +.low) - $rempe (ra-low-rempe +.low) $grams (ra-low-grams +.low) == :: @@ -185,39 +183,19 @@ (some [s u.h]) == :: - ++ ra-low-tales - ::x apply tale configs. - :: - |= {man/knot cof/(unit config)} + ++ ra-low-confs + |= cofs/(map station (unit config)) ^+ +> - ?~ cof +>(tales (~(del by tales) man)) - =+ tal=(fall (~(get by tales) man) *tale) - =. +>.$ sh-abet:(~(sh-low-config sh cli man) shape.tal (fall cof *config)) - +>.$(tales (~(put by tales) man tal(shape u.cof))) - :: - ++ ra-low-remco - |= cofs/(map station config) - ^+ +> - =. +> sh-abet:(~(sh-low-remco sh cli (main our.hid)) mirrors cofs) - +>(mirrors (~(uni by mirrors) cofs)) + ::TODO fix sh-low-remco to print properly. + =/ cogs/_mirrors (~(run by cofs) |=(a/(unit config) (fall a *config))) + =. +>.$ sh-abet:(~(sh-low-remco sh cli (main our.hid)) mirrors cogs) + =. mirrors (~(uni by mirrors) cogs) + +>.$ :: ++ ra-low-precs - ::x apply new presence. - :: - |= {man/knot pes/atlas} - ^+ +> - =+ tal=(~(get by tales) man) - ?~ tal ~&([%low-precs-know-no-tale man] +>.$) - =+ nel=(~(uni by locals.u.tal) pes) - =. +>.$ - ?: =(locals.u.tal nel) +>.$ - sh-abet:(~(sh-low-precs sh cli man) locals.u.tal nel) - +>.$(tales (~(put by tales) man u.tal(locals nel))) - :: - ++ ra-low-rempe |= pas/(map partner atlas) ^+ +> - =+ ner=(~(uni by remotes) pas) ::TODO better uni. + =+ ner=(~(uni by remotes) pas) ::TODO per-partner uni. ?: =(remotes ner) +>.$ =. remotes ner sh-abet:(~(sh-low-rempe sh cli (main our.hid)) remotes ner) @@ -610,6 +588,7 @@ :: |= paz/(set partner) ?~ paz | + ::TODO use mailbox sources.shape ?| (~(has in sources.shape:(~(got by tales) man)) `partner`n.paz) $(paz l.paz) $(paz r.paz) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index b6dbfd62ca..b3be76cdca 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -172,7 +172,6 @@ ?. (~(has by stories) p.cod) (ra-evil %talk-no-story) ::x $design with ~ for config signals delete - ::TODO be sure to send a deletion %tales lowdown! (ra-unconfig p.cod) (ra-config p.cod u.q.cod) :: @@ -266,7 +265,6 @@ ^+ +> =+ soy=(~(get by stories) man) ?~ soy +>.$ - =. stories (~(del by stories) man) pa-abet:~(pa-reform-gone pa man ~ u.soy) :: ++ ra-base-hart @@ -499,30 +497,18 @@ ++ ra-welcome ::x brings reader new up to date. :: - ::TODO just like weld somehow |= new/bone - =. +> %- ra-emil - %- zing - %+ turn (~(tap by stories)) - |= {k/knot s/story} - ^- (list move) - :~ ::x story configurations - [new %diff %talk-lowdown %tales k `shape.s] - ::x local presences - [new %diff %talk-lowdown %precs k locals.s] - ::x telegrams - [new %diff %talk-lowdown %grams k count.s grams.s] - == %- ra-emil :~ ::x remote configurations - [new %diff %talk-lowdown %remco mirrors] + [new %diff %talk-lowdown %confs (~(run by mirrors) some)] ::x remote presences - [new %diff %talk-lowdown %rempe remotes] + [new %diff %talk-lowdown %precs remotes] ::x bound glyphs [new %diff %talk-lowdown %glyph nak] ::x nicknames [new %diff %talk-lowdown %names (~(run by folks) some)] == + ::TODO all mailbox %grams! :: ++ ra-think :: publish+review ::x consumes each thought. @@ -724,7 +710,7 @@ =+ old=mirrors =. mirrors (~(put by mirrors) cuz con) ?: =(mirrors old) +>.$ - =. +>.$ (pa-inform %remco mirrors) + =. +>.$ (pa-inform %confs (~(run by mirrors) some)) (pa-report-cabal pa-followers) :: ++ pa-diff-talk-report :: subscribed update @@ -746,10 +732,12 @@ ::x delete tay from our subscriptions, then send an updated capal report. :: |= tay/partner - =. +> - %. pa-followers - pa-report-cabal(sources.shape (~(del in sources.shape) tay)) - (pa-inform %tales man `shape) + ^+ +> + ?. (~(has in sources.shape) tay) +> + =. sources.shape (~(del in sources.shape) tay) + =. mirrors (~(put by mirrors) [our.hid man] shape) + =. +> (pa-inform %confs (strap [our.hid man] `shape)) + (pa-report-cabal pa-followers) :: ++ pa-sauce :: send backward ::x turns cards into moves, reverse order, prepend to existing moves. @@ -812,7 +800,7 @@ ::x partners we gained/lost, and send out an updated cabal report. :: |= cof/config - =. +>.$ (pa-inform %tales man `cof) + =. +>.$ (pa-inform %confs (strap [our.hid man] `cof)) =+ ^= dif ^- (pair (list partner) (list partner)) =+ old=`(list partner)`(~(tap in sources.shape) ~) =+ new=`(list partner)`(~(tap in sources.cof) ~) @@ -821,10 +809,13 @@ =. +>.$ (pa-acquire p.dif) =. +>.$ (pa-abjure q.dif) =. shape cof + =. mirrors (~(put by mirrors) [our.hid man] cof) (pa-report-cabal pa-followers) :: ++ pa-reform-gone - =. . (pa-inform %tales man ~) + =. stories (~(del by stories) man) + =. mirrors (~(del by mirrors) [our.hid man]) + =. . (pa-inform %confs (strap [our.hid man] ~)) =. . (pa-report-cabal pa-followers) (pa-abjure (~(tap in sources.shape))) :: @@ -841,7 +832,8 @@ ^+ +> =/ nol (~(put by locals) her saz) ?: =(nol locals) +>.$ - =. +>.$ (pa-inform %precs man nol) + =. +>.$ (pa-inform %precs (strap [%& our.hid man] nol)) + =/ ner (~(put by remotes) [%& our.hid man] nol) (pa-report-group(locals nol) pa-followers) :: ++ pa-remind :: remote presence @@ -854,7 +846,7 @@ =/ buk (~(uni by remotes) rem) ::TODO drop? =. buk (~(put by buk) tay loc) ?: =(buk remotes) +>.$ - =. +>.$ (pa-inform %rempe buk) + =. +>.$ (pa-inform %precs buk) (pa-report-group(remotes buk) pa-followers) :: ++ pa-start :: start stream diff --git a/sur/talk.hoon b/sur/talk.hoon index 7d5fbaa5f8..5e384bd1a4 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -73,10 +73,8 @@ :: this will aid with ++sh's printing. $% {$glyph (jug char (set partner))} :: new bindings {$names (map ship (unit human))} :: new identities - {$tales (pair knot (unit config))} :: changed config - {$remco (map station config)} :: remote configs - {$precs (pair knot atlas)} :: changed presence - {$rempe (map partner atlas)} :: remote presences + {$confs (map station (unit config))} :: changed configs + {$precs (map partner atlas)} :: changed presences {$grams (pair knot (pair @ud (list telegram)))} :: new grams == :: ++ speech :: narrative action From 1345c9b3c0c92b7a8342b45b05aa332004dfbb69 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 11 Apr 2017 22:36:11 +0200 Subject: [PATCH 055/303] Reader no longer uses tales for any storage. Configs and presences in maps, all grams in one place (as the mailbox already did), subscriptions as a set of sources rather than mailbox config. --- app/talk-agent.hoon | 162 +++++++++++++++++--------------------------- 1 file changed, 61 insertions(+), 101 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 82c742e970..030272fb03 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -5,6 +5,9 @@ ::TODO guardian's todo's apply here too ::TODO rename cores. pa->ta (transaction), ta->pa (partner), etc. :: +::TODO maybe collapse sources, remotes and mirrors into a single map? +::TODO maybe keep track of received grams per partner, too? +:: /? 310 :: hoon version /- talk, sole :: structures /+ talk, sole, time-to-id, twitter :: libraries @@ -16,22 +19,20 @@ [. talk sole] => |% :: data structures ++ chattel :: full state - $: tales/(map knot tale) :: conversations + $: :: messaging state :: + count/@ud :: (lent grams) + grams/(list telegram) :: all history + known/(map serial @ud) :: messages heard + sources/(set partner) :: our subscriptions + :: partner details :: remotes/(map partner atlas) :: remote presences mirrors/(map station config) :: remote configs + :: ui state :: folks/(map ship human) :: human identities nik/(map (set partner) char) :: bound station glyphs nak/(jug char (set partner)) :: station glyph lookup cli/shell :: interaction state == :: - ++ tale :: user-facing story - $: count/@ud :: (lent grams) - grams/(list telegram) :: all history - ::TODO given remotes and mirrors, do we still need locals and shape? - locals/atlas :: presence - shape/config :: configuration - known/(map serial @ud) :: messages heard - == :: ++ shell :: console session $: id/bone :: identifier count/@ud :: messages shown @@ -187,6 +188,7 @@ |= cofs/(map station (unit config)) ^+ +> ::TODO fix sh-low-remco to print properly. + ::TODO actually delete ~ configs. =/ cogs/_mirrors (~(run by cofs) |=(a/(unit config) (fall a *config))) =. +>.$ sh-abet:(~(sh-low-remco sh cli (main our.hid)) mirrors cogs) =. mirrors (~(uni by mirrors) cogs) @@ -205,10 +207,8 @@ :: |= {man/knot num/@ud gams/(list telegram)} ^+ +> - =+ tal=(~(get by tales) man) - ?~ tal ~&([%know-no-tale man] +>.$) =. +>.$ sh-abet:(~(sh-low-grams sh cli man) num gams) - pa-abet:(~(pa-lesson pa man u.tal) gams) + (ra-lesson gams) :: ++ ra-emil :: ra-emit move list ::x adds multiple moves to the core's list. flops to emulate ++ra-emit. @@ -260,80 +260,45 @@ / == :: - ++ pa :: story core - ::x tale core, used for doing work on a story. - ::x as always, an -abet arms is used for applying changes to the state. - ::x ++pa-watch- arms get called by ++ra-subscribe to add a subscriber. - ::x bones are used to identify subscribers (source event identifiers) + ++ ra-lesson :: learn multiple + ::x learn all telegrams in a list. :: - |_ ::x man: the knot identifying the story in stories. - ::x story doesn't get a face because ease of use - :: - $: man/knot - tale - == - ++ pa-abet - ::x apply/fold changes back into the stories map. - :: - ^+ +> - +>(tales (~(put by tales) man `tale`+<+)) + |= gaz/(list telegram) + ^+ +> + ?~ gaz +> + $(gaz t.gaz, +> (ra-learn i.gaz)) + :: + ++ ra-learn :: learn message + ::x store an incoming telegram, modifying audience to say we received it. + ::x update existing telegram if it already exists. :: - ++ pa-lesson :: learn multiple - ::x learn all telegrams in a list. - :: - |= gaz/(list telegram) - ^+ +> - ?~ gaz +> - $(gaz t.gaz, +> (pa-learn i.gaz)) + |= gam/telegram + ^+ +> + =+ old=(~(get by known) p.q.gam) + ?~ old + (ra-append gam) ::x add + (ra-revise u.old gam) ::x modify + :: + ++ ra-append :: append new gram + ::x add gram to our story, and update our subscribers. :: - ++ pa-learn :: learn message - ::x store an incoming telegram, modifying audience to say we received it. - ::x update existing telegram if it already exists. - :: - |= gam/telegram - ^+ +> - ::x if author isn't allowed to write here, reject. - ::TODO we shouldn't need to do permission checks anymore, all we need to - :: do is make sure the grams were sent to us by our broker. - :: do this earlier up in the chain. - =. q.q.gam - ::x if we are in the audience, mark us as having received it. - =+ ole=(~(get by q.q.gam) [%& our.hid man]) - ?^ ole (~(put by q.q.gam) [%& our.hid man] -.u.ole %received) - :: for fedearted stations, pretend station src/foo is also our/foo - :: XX pass src through explicitly instead of relying on implicit - :: value in hid from the subscription to src/foo - =+ ole=(~(get by q.q.gam) [%& src.hid man]) - ?~ ole q.q.gam - ::x as described above, fake src into our. - =. q.q.gam (~(del by q.q.gam) [%& src.hid man]) - (~(put by q.q.gam) [%& our.hid man] -.u.ole %received) - =+ old=(~(get by known) p.q.gam) - ?~ old - (pa-append gam) ::x add - (pa-revise u.old gam) ::x modify + |= gam/telegram + ^+ +> + %= +> + grams [gam grams] + count +(count) + known (~(put by known) p.q.gam count) + == + :: + ++ ra-revise :: revise existing gram + ::x modify a gram in our story, and update our subscribers. :: - ++ pa-append :: append new gram - ::x add gram to our story, and update our subscribers. - :: - |= gam/telegram - ^+ +> - %= +> - grams [gam grams] - count +(count) - known (~(put by known) p.q.gam count) - == - :: - ++ pa-revise :: revise existing gram - ::x modify a gram in our story, and update our subscribers. - :: - |= {num/@ud gam/telegram} - =+ way=(sub count num) - ?: =(gam (snag (dec way) grams)) - +>.$ :: no change - =. grams (welp (scag (dec way) grams) [gam (slag way grams)]) - +>.$ - -- + |= {num/@ud gam/telegram} + =+ way=(sub count num) + ?: =(gam (snag (dec way) grams)) + +>.$ :: no change + =. grams (welp (scag (dec way) grams) [gam (slag way grams)]) + +>.$ :: ++ sh :: per console ::x shell core, responsible for doing things with console sessions, @@ -588,8 +553,7 @@ :: |= paz/(set partner) ?~ paz | - ::TODO use mailbox sources.shape - ?| (~(has in sources.shape:(~(got by tales) man)) `partner`n.paz) + ?| (~(has in sources) `partner`n.paz) $(paz l.paz) $(paz r.paz) == @@ -602,8 +566,8 @@ |= tay/partner ^+ +> ?. ?=($& -.tay) +> ::x if partner is a passport, do nothing. - =+ tal=(~(get by tales) q.p.tay) - ?. |(?=($~ tal) !?=($white p.cordon.shape.u.tal)) + =+ cof=(~(get by mirrors) +.tay) + ?. |(?=($~ cof) !?=($white p.cordon.u.cof)) +>.$ (sh-pact [tay ~ ~]) :: @@ -634,7 +598,6 @@ ?: =(~ lax) ~ ::x no partner. ?: ?=({* $~ $~} lax) `n.lax ::x single partner. ::x in case of multiple partners, pick the most recently active one. - =+ grams=grams:(~(got by tales) man) ::TODO probably no longer correct. |- ^- (unit (set partner)) ?~ grams ~ ::x get first partner from a telegram's audience. @@ -1071,7 +1034,6 @@ :: |= job/work ^+ +> - =+ roy=(~(got by tales) man) =< work |% ++ work @@ -1134,7 +1096,7 @@ (sh-note:(set-glyph cha pan) "new glyph {}") =. ..sh-work sh-prod(active.she pan) - =+ loc=shape:(~(got by tales) man) + =+ loc=(~(got by mirrors) [our.hid man]) ::x change local mailbox config to include subscription to pan. %^ sh-tell %design man `loc(sources (~(uni in sources.loc) pan)) @@ -1142,7 +1104,7 @@ ++ leave :: %leave |= pan/(set partner) ^+ ..sh-work - =+ loc=shape:(~(got by tales) man) + =+ loc=(~(got by mirrors) [our.hid man]) ::x change local mailbox config to exclude subscription to pan. %^ sh-tell %design man `loc(sources (~(dif in sources.loc) pan)) @@ -1161,7 +1123,6 @@ |= pan/(set partner) ^+ ..sh-work ::TODO clever use of =< and . take note! ~& [%who-ing pan] - =+ tal=(~(got by tales) man) =< (sh-fact %mor (murn (sort (~(tap by remotes) ~) aor) .)) |= {pon/partner alt/atlas} ^- (unit sole-effect) ?. |(=(~ pan) (~(has in pan) pon)) ~ @@ -1197,7 +1158,7 @@ ++ create :: %create |= {por/posture nom/knot txt/cord} ^+ ..sh-work - ?: (~(has in tales) nom) + ?: (~(has in mirrors) [our.hid nom]) (sh-lame "{(trip nom)}: already exists") =. ..sh-work (sh-action %create nom txt por) @@ -1273,19 +1234,18 @@ ++ number :: %number |= num/$@(@ud {p/@u q/@ud}) ^+ ..sh-work - =+ roy=(~(got by tales) man) |- ?@ num - ?: (gte num count.roy) + ?: (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.roy)) - ?. (gth q.num count.roy) - ?~ count.roy + (activate (snag num grams)) + ?. (gth q.num count) + ?: =(count 0) (sh-lame "0: no messages") - =+ msg=(deli (dec count.roy) num) + =+ msg=(deli (dec count) num) =. ..sh-fact (sh-fact %txt "? {(scow %ud msg)}") - (activate (snag (sub count.roy +(msg)) grams.roy)) + (activate (snag (sub count +(msg)) grams)) (sh-lame "…{(reap p.num '0')}{(scow %ud q.num)}: no such telegram") :: ++ deli :: find number @@ -1566,8 +1526,8 @@ ?& ?=($& -.pan) =(p.p.pan our.hid) :: - =+ sot=(~(get by tales) q.p.pan) - &(?=(^ sot) ?=($brown p.cordon.shape.u.sot)) + =+ sot=(~(get by mirrors) +.pan) + &(?=(^ sot) ?=($brown p.cordon.u.sot)) == :: ++ te-pref :: audience glyph From f0331924b372b2620faaecf59e796dd6d5be4654 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 11 Apr 2017 22:51:47 +0200 Subject: [PATCH 056/303] Lowdown %grams now exclusively come from the mailbox. --- app/talk-agent.hoon | 4 ++-- app/talk-guardian.hoon | 9 +++++++-- sur/talk.hoon | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 030272fb03..55a6e916d3 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -205,9 +205,9 @@ ++ ra-low-grams ::x apply new grams :: - |= {man/knot num/@ud gams/(list telegram)} + |= {num/@ud gams/(list telegram)} ^+ +> - =. +>.$ sh-abet:(~(sh-low-grams sh cli man) num gams) + =. +>.$ sh-abet:(~(sh-low-grams sh cli (main our.hid)) num gams) (ra-lesson gams) :: ++ ra-emil :: ra-emit move list diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index b3be76cdca..34400c653f 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -507,8 +507,11 @@ [new %diff %talk-lowdown %glyph nak] ::x nicknames [new %diff %talk-lowdown %names (~(run by folks) some)] + ::x messages + :* new %diff %talk-lowdown %grams 0 + grams:(~(got by stories) (main our.hid)) + == == - ::TODO all mailbox %grams! :: ++ ra-think :: publish+review ::x consumes each thought. @@ -916,7 +919,9 @@ |= {num/@ud gam/telegram} ^+ +> ::x notify all of our readers. - =. +> (pa-inform %grams man num gam ~) + =. +> ::TODO =? + ?. =(man (main our.hid)) +> + (pa-inform %grams num gam ~) ::x notify only the followers who are currently interested. =+ ^= moy |- ^- (pair (list bone) (list move)) diff --git a/sur/talk.hoon b/sur/talk.hoon index 5e384bd1a4..9adac38299 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -75,7 +75,7 @@ {$names (map ship (unit human))} :: new identities {$confs (map station (unit config))} :: changed configs {$precs (map partner atlas)} :: changed presences - {$grams (pair knot (pair @ud (list telegram)))} :: new grams + {$grams (pair @ud (list telegram))} :: new grams == :: ++ speech :: narrative action $% {$lan p/knot q/@t} :: local announce From 3a43657bc1254d51b75f8d0f4ea996eb932cd845 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 12 Apr 2017 13:14:09 +0200 Subject: [PATCH 057/303] Allowed readers to subscribe to grams from specific stories. This means apps don't have to write to the standard mailbox to be able to get messages. --- app/talk-agent.hoon | 8 +++- app/talk-guardian.hoon | 84 ++++++++++++++++++++++++------------------ sur/talk.hoon | 2 +- 3 files changed, 56 insertions(+), 38 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 55a6e916d3..3ecc5bf73a 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -8,6 +8,9 @@ ::TODO maybe collapse sources, remotes and mirrors into a single map? ::TODO maybe keep track of received grams per partner, too? :: +::x This reader implementation makes use of the mailbox for all its +::x subscriptions and messaging. +:: /? 310 :: hoon version /- talk, sole :: structures /+ talk, sole, time-to-id, twitter :: libraries @@ -205,8 +208,9 @@ ++ ra-low-grams ::x apply new grams :: - |= {num/@ud gams/(list telegram)} + |= {man/knot num/@ud gams/(list telegram)} ^+ +> + ?. =(man (main our.hid)) ~&([%unexpected-grams man] +>) =. +>.$ sh-abet:(~(sh-low-grams sh cli (main our.hid)) num gams) (ra-lesson gams) :: @@ -257,7 +261,7 @@ %peer / (broker our.hid) - / + /reader/(main our.hid) == :: ++ ra-lesson :: learn multiple diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 34400c653f..b4a24cd890 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -34,7 +34,7 @@ remotes/(map partner atlas) :: remote presence mirrors/(map station config) :: remote config ::TODO rename to readers? - general/(set bone) :: our message readers + general/(map bone (set knot)) :: our message readers outbox/(pair @ud (map @ud thought)) :: urbit outbox log/(map knot @ud) :: logged to clay folks/(map ship human) :: human identities @@ -189,8 +189,8 @@ :: |= low/lowdown %- ra-emil - %- ~(rep in general) - |= {b/bone l/(list move)} + %- ~(rep by general) + |= {{b/bone *} l/(list move)} [[b %diff %talk-lowdown low] l] :: ++ ra-react @@ -444,7 +444,7 @@ ^+ +> ?. ?=({@ @ *} pax) ::x if story is not in path, just delete the bone from general. - +>(general (~(del in general) ost.hid)) + +>(general (~(del by general) ost.hid)) %- (ra-know i.pax) |= par/_pa =< pa-abet ::x delete bone from all follower groups and set src's status to %gone. (pa-notify:pa-cancel:par src %gone *human) @@ -467,14 +467,15 @@ |= {her/ship pax/path} ^+ +> ::x empty path, meta-subscribe and send report with all our stories. - ?: ?=($~ pax) + ~& [%b-ra-subscribe-path pax] + ?: ?=({$reader *} pax) ?. (team our.hid her) ~& [%foreign-reader her] +> - (ra-welcome(general (~(put in general) ost.hid)) ost.hid) - ::?. ?=({@ *} pax) - :: (ra-evil %talk-bad-path) - ::TODO ^ mint-vains? + ~& [%b-subscribed-reader ost.hid] + (ra-welcome ost.hid t.pax) + ?. ?=({@ *} pax) + (ra-evil %talk-bad-path) =+ pur=(~(get by stories) i.pax) ?~ pur ~& [%bad-subscribe-story-c i.pax] @@ -495,22 +496,35 @@ pa-abet:soy :: ++ ra-welcome - ::x brings reader new up to date. + ::x brings new reader up to date. susbcribes it to the specified story. :: - |= new/bone - %- ra-emil - :~ ::x remote configurations - [new %diff %talk-lowdown %confs (~(run by mirrors) some)] - ::x remote presences - [new %diff %talk-lowdown %precs remotes] - ::x bound glyphs - [new %diff %talk-lowdown %glyph nak] - ::x nicknames - [new %diff %talk-lowdown %names (~(run by folks) some)] - ::x messages - :* new %diff %talk-lowdown %grams 0 - grams:(~(got by stories) (main our.hid)) - == + |= {new/bone pax/path} + =/ sor/knot + ?: ?=({@tas *} pax) i.pax + (main our.hid) :: default to mailbox + =. +>.$ ::TODO =? + ?: (~(has by general) new) +>.$ + %- ra-emil + :~ ::x remote configurations + [new %diff %talk-lowdown %confs (~(run by mirrors) some)] + ::x remote presences + [new %diff %talk-lowdown %precs remotes] + ::x bound glyphs + [new %diff %talk-lowdown %glyph nak] + ::x nicknames + [new %diff %talk-lowdown %names (~(run by folks) some)] + == + =. +>.$ ::TODO =? + ?. (~(has by stories) sor) +>.$ + %- ra-emit + ::x messages + :* new %diff %talk-lowdown %grams sor 0 + grams:(~(got by stories) sor) + == + %= +>.$ + general + %+ ~(put by general) new + (~(put in (fall (~(get by general) new) ~)) sor) == :: ++ ra-think :: publish+review @@ -667,16 +681,18 @@ (pa-sauce n.wac [%diff %talk-report caw]~) :: ++ pa-inform - ::x sends lowdown to all readers. + ::x sends lowdown to all interested readers. :: |= low/lowdown =. moves - |- ^- (list move) - ?~ general moves - =+ lef=$(general l.general) - =+ rit=$(general r.general) - :_ (welp lef rit) - [n.general %diff %talk-lowdown low] + %+ weld + ^- (list move) + %+ murn (~(tap by general)) + |= {b/bone s/(set knot)} + ^- (unit move) + ?: &(=(%grams -.low) !(~(has in s) man)) ~ + `[b %diff %talk-lowdown low] + moves +>.$ :: ++ pa-remotes @@ -918,10 +934,8 @@ :: |= {num/@ud gam/telegram} ^+ +> - ::x notify all of our readers. - =. +> ::TODO =? - ?. =(man (main our.hid)) +> - (pa-inform %grams num gam ~) + ::x notify the interested readers. + =. +> (pa-inform %grams man num gam ~) ::x notify only the followers who are currently interested. =+ ^= moy |- ^- (pair (list bone) (list move)) diff --git a/sur/talk.hoon b/sur/talk.hoon index 9adac38299..718cf1f758 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -75,7 +75,7 @@ {$names (map ship (unit human))} :: new identities {$confs (map station (unit config))} :: changed configs {$precs (map partner atlas)} :: changed presences - {$grams (pair @ud (list telegram))} :: new grams + {$grams (trel knot @ud (list telegram))} :: new grams == :: ++ speech :: narrative action $% {$lan p/knot q/@t} :: local announce From 496a177a8ecba3f71acb944061716e78ee32d174 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 12 Apr 2017 15:09:24 +0200 Subject: [PATCH 058/303] Reader now properly stores mailbox's sources, and updates audience for new sources. The latter is necessary because of the delay between setting audience to a newly created/joined station, which causes the mailbox to be included because we don't know we're actually subscribed to the new station yet. --- app/talk-agent.hoon | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 3ecc5bf73a..f871c92e0d 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -190,6 +190,19 @@ ++ ra-low-confs |= cofs/(map station (unit config)) ^+ +> + ::x if possible, update sources. if we do, and we gain new ones, update + ::x the prompt. (this is to remove the mailbox from the audience after + ::x creating or joining a new station.) + =. +> + =+ cof=(fall (~(get by cofs) [our.hid (main our.hid)]) ~) + ?~ cof +>.$ + =. +>.$ ::TODO =? + ?~ (~(dif in sources.u.cof) sources) +>.$ + =< sh-abet + %- ~(sh-pact sh(sources sources.u.cof) cli (main our.hid)) + (~(dif in sources.u.cof) sources) + =. sources sources.u.cof + +>.$ ::TODO fix sh-low-remco to print properly. ::TODO actually delete ~ configs. =/ cogs/_mirrors (~(run by cofs) |=(a/(unit config) (fall a *config))) From 17b1abc0ba55d09bc4777371f08ff4254efaa985 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 12 Apr 2017 20:09:23 +0200 Subject: [PATCH 059/303] Lowdowns now contain only what changed. +other small changes/TODOs. Pre-rollback. --- app/talk-agent.hoon | 28 +++++++++++++++++++++++----- app/talk-guardian.hoon | 23 +++++++++-------------- 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index f871c92e0d..be566feb58 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -4,7 +4,10 @@ :: ::TODO guardian's todo's apply here too ::TODO rename cores. pa->ta (transaction), ta->pa (partner), etc. +::TODO make sure glyphs get unbound when joins etc don't succeed. +::TODO correct/clean up presence/config change notifications :: +::TODO remove man from door sample where it's always (main our.hid). ::TODO maybe collapse sources, remotes and mirrors into a single map? ::TODO maybe keep track of received grams per partner, too? :: @@ -203,11 +206,21 @@ (~(dif in sources.u.cof) sources) =. sources sources.u.cof +>.$ + =. +> + =< sh-abet + %+ roll (~(tap by cofs)) + |= {{s/station c/(unit config)} core/_sh} + (~(sh-low-config core cli (main our.hid)) s (~(get by mirrors) s) c) ::TODO fix sh-low-remco to print properly. ::TODO actually delete ~ configs. - =/ cogs/_mirrors (~(run by cofs) |=(a/(unit config) (fall a *config))) - =. +>.$ sh-abet:(~(sh-low-remco sh cli (main our.hid)) mirrors cogs) - =. mirrors (~(uni by mirrors) cogs) + ::=/ cogs/_mirrors (~(run by cofs) |=(a/(unit config) (fall a *config))) + ::=. +>.$ sh-abet:(~(sh-low-remco sh cli (main our.hid)) mirrors cogs) + =. mirrors + %- ~(gas by *_mirrors) + %+ murn (~(tap by cofs)) + |= {s/station c/(unit config)} + ^- (unit (pair station config)) + ?~(c ~ `[s u.c]) +>.$ :: ++ ra-low-precs @@ -775,9 +788,13 @@ ++ sh-low-config ::x prints changes to a config to cli. :: - |= {old/config new/config} + |= {sat/station old/(unit config) new/(unit config)} ^+ +> - (sh-low-config-show "" old new) + ?~ old ~&([%new-conf sat] +>) + ?~ new ~&([%del-conf sat] +>) ::TODO tmp + %^ sh-low-config-show + (weld ~(sn-phat sn man sat) ": ") + u.old u.new :: ++ sh-low-remco ::x prints changes to remote configs to cli. @@ -1275,6 +1292,7 @@ ++ probe :: inquire |= cuz/station ^+ ..sh-work + ::TODO? what's this? ~& [%probe cuz] ..sh-work :: diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index b4a24cd890..1d0c71f6b3 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -11,6 +11,9 @@ ::TODO maybe ensure every arm has a mini-description at :57 too? ::TODO maybe prefix all printfs and other errors with %talk? :: +::TODO put remotes and mirrors back into stories. +:: +::TODO do permission checks for the whole team instead of just a ship, maybe? ::TODO sending remotes and mirrors alongside locals and shape no longer makes :: any sense, does it? ::TODO crash on pokes/peers we do not expect @@ -28,9 +31,8 @@ ::x so we can do some-arm instead of some-arm:talk. [. talk sole] => |% :: data structures - ++ house :: + ++ house :: broker state $: stories/(map knot story) :: conversations - ::TODO maybe also store locals/shapes for easier syncing with readers remotes/(map partner atlas) :: remote presence mirrors/(map station config) :: remote config ::TODO rename to readers? @@ -467,12 +469,10 @@ |= {her/ship pax/path} ^+ +> ::x empty path, meta-subscribe and send report with all our stories. - ~& [%b-ra-subscribe-path pax] ?: ?=({$reader *} pax) ?. (team our.hid her) ~& [%foreign-reader her] +> - ~& [%b-subscribed-reader ost.hid] (ra-welcome ost.hid t.pax) ?. ?=({@ *} pax) (ra-evil %talk-bad-path) @@ -706,7 +706,7 @@ ?~ soy atl locals.u.soy :: - ++ pa-report-group :: update presence + ++ pa-report-group :: update presence ::x build a group report, containing our different presence maps, and ::x send it to all bones. ::x we send remote presences to facilitate federation. aka "relay" @@ -723,13 +723,12 @@ ++ pa-cabal ::x add station's config to our remote config map. :: - ::TODO if web frontend doesn't use ham, remove it (also from sur/talk) |= {cuz/station con/config ham/(map station config)} ^+ +> =+ old=mirrors =. mirrors (~(put by mirrors) cuz con) ?: =(mirrors old) +>.$ - =. +>.$ (pa-inform %confs (~(run by mirrors) some)) + =. +>.$ (pa-inform %confs (strap cuz `con)) (pa-report-cabal pa-followers) :: ++ pa-diff-talk-report :: subscribed update @@ -805,8 +804,7 @@ =+ ini=?^(num (scot %ud u.num) (scot %da old)) ?- -.tay $| !! - $& :: ~& [%pa-acquire [our.hid man] [p.p.tay q.p.tay]] - :_ ~ + $& :_ ~ :* %peer /friend/show/[man]/(scot %p p.p.tay)/[q.p.tay] [p.p.tay %talk-guardian] @@ -851,7 +849,7 @@ ^+ +> =/ nol (~(put by locals) her saz) ?: =(nol locals) +>.$ - =. +>.$ (pa-inform %precs (strap [%& our.hid man] nol)) + =. +>.$ (pa-inform %precs (strap [%& our.hid man] (strap her saz))) =/ ner (~(put by remotes) [%& our.hid man] nol) (pa-report-group(locals nol) pa-followers) :: @@ -865,7 +863,7 @@ =/ buk (~(uni by remotes) rem) ::TODO drop? =. buk (~(put by buk) tay loc) ?: =(buk remotes) +>.$ - =. +>.$ (pa-inform %precs buk) + =. +>.$ (pa-inform %precs (~(dif in buk) remotes)) (pa-report-group(remotes buk) pa-followers) :: ++ pa-start :: start stream @@ -1062,9 +1060,7 @@ q.cordon %. sis ?: add - ~& [%new-shape (~(uni in q.cordon.shape) sis)] ~(uni in q.cordon.shape) - ~& [%new-shape (~(dif in q.cordon.shape) sis)] ~(dif in q.cordon.shape) == -- @@ -1074,7 +1070,6 @@ ::x incoming subscription on pax. :: |= pax/path - ~& [%b-peer pax src.hid ost.hid] ^+ [*(list move) +>] ~? !(team src.hid our.hid) [%peer-talk-stranger src.hid] ?: ?=({$sole *} pax) ~&(%broker-no-sole !!) From 108431b2c9007a6d0c9cfcd9a8e6e5a8563822e4 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 12 Apr 2017 22:37:37 +0200 Subject: [PATCH 060/303] Put remotes and mirrors back into config. They no longer contain local story data. Reader doesn't care much, aside from changes to lowdowns. It subscribes exclusively to the default mailbox. --- app/talk-agent.hoon | 41 ++++++++++++++++----------------- app/talk-guardian.hoon | 51 ++++++++++++++++++++---------------------- sur/talk.hoon | 19 ++++++++-------- 3 files changed, 55 insertions(+), 56 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index be566feb58..5b1d7d7472 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -12,7 +12,8 @@ ::TODO maybe keep track of received grams per partner, too? :: ::x This reader implementation makes use of the mailbox for all its -::x subscriptions and messaging. +::x subscriptions and messaging. All lowdowns received are exclusively about +::x the mailbox, since that's the only thing the reader ever subscribes to. :: /? 310 :: hoon version /- talk, sole :: structures @@ -191,22 +192,20 @@ == :: ++ ra-low-confs - |= cofs/(map station (unit config)) + |= {coy/(unit config) cofs/(map station (unit config))} ^+ +> ::x if possible, update sources. if we do, and we gain new ones, update ::x the prompt. (this is to remove the mailbox from the audience after ::x creating or joining a new station.) - =. +> - =+ cof=(fall (~(get by cofs) [our.hid (main our.hid)]) ~) - ?~ cof +>.$ - =. +>.$ ::TODO =? - ?~ (~(dif in sources.u.cof) sources) +>.$ - =< sh-abet - %- ~(sh-pact sh(sources sources.u.cof) cli (main our.hid)) - (~(dif in sources.u.cof) sources) - =. sources sources.u.cof - +>.$ - =. +> + ?~ coy ~&(%mailbox-deleted !!) + =. +> ::TODO =? + ?~ (~(dif in sources.u.coy) sources) +>.$ + =< sh-abet + %- ~(sh-pact sh(sources sources.u.coy) cli (main our.hid)) + (~(dif in sources.u.coy) sources) + =. sources sources.u.coy + =. cofs (~(put by cofs) [our.hid (main our.hid)] coy) + =. +>.$ =< sh-abet %+ roll (~(tap by cofs)) |= {{s/station c/(unit config)} core/_sh} @@ -224,19 +223,18 @@ +>.$ :: ++ ra-low-precs - |= pas/(map partner atlas) + |= {tas/atlas pas/(map partner atlas)} ^+ +> =+ ner=(~(uni by remotes) pas) ::TODO per-partner uni. ?: =(remotes ner) +>.$ - =. remotes ner - sh-abet:(~(sh-low-rempe sh cli (main our.hid)) remotes ner) + =. +>.$ sh-abet:(~(sh-low-rempe sh cli (main our.hid)) remotes ner) + +>.$(remotes ner) :: ++ ra-low-grams ::x apply new grams :: - |= {man/knot num/@ud gams/(list telegram)} + |= {num/@ud gams/(list telegram)} ^+ +> - ?. =(man (main our.hid)) ~&([%unexpected-grams man] +>) =. +>.$ sh-abet:(~(sh-low-grams sh cli (main our.hid)) num gams) (ra-lesson gams) :: @@ -285,9 +283,9 @@ %- ra-emit :* ost.hid %peer - / + / ::x return/diff path (broker our.hid) - /reader/(main our.hid) + /reader/(main our.hid) ::x peer path == :: ++ ra-lesson :: learn multiple @@ -1784,6 +1782,9 @@ :: ++ diff-talk-lowdown ::x incoming talk-lowdown. process it. + ::x we *could* use the wire to identify what story subscription our lowdown + ::x is coming from, but since we only ever subscribe to a single story, we + ::x don't bother. :: |= {way/wire low/lowdown} ra-abet:(ra-low:ra low) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 1d0c71f6b3..b3bb85e651 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -11,8 +11,6 @@ ::TODO maybe ensure every arm has a mini-description at :57 too? ::TODO maybe prefix all printfs and other errors with %talk? :: -::TODO put remotes and mirrors back into stories. -:: ::TODO do permission checks for the whole team instead of just a ship, maybe? ::TODO sending remotes and mirrors alongside locals and shape no longer makes :: any sense, does it? @@ -33,8 +31,6 @@ => |% :: data structures ++ house :: broker state $: stories/(map knot story) :: conversations - remotes/(map partner atlas) :: remote presence - mirrors/(map station config) :: remote config ::TODO rename to readers? general/(map bone (set knot)) :: our message readers outbox/(pair @ud (map @ud thought)) :: urbit outbox @@ -47,8 +43,11 @@ $: count/@ud :: (lent grams) grams/(list telegram) :: all history locals/atlas :: local presence - sequence/(map partner @ud) :: partners heard + remotes/(map partner atlas) :: remote presence shape/config :: configuration + mirrors/(map station config) :: remote config + ::TODO never gets updated. :: + sequence/(map partner @ud) :: partners heard known/(map serial @ud) :: messages heard followers/(map bone river) :: subscribers == :: @@ -505,21 +504,23 @@ =. +>.$ ::TODO =? ?: (~(has by general) new) +>.$ %- ra-emil - :~ ::x remote configurations - [new %diff %talk-lowdown %confs (~(run by mirrors) some)] - ::x remote presences - [new %diff %talk-lowdown %precs remotes] - ::x bound glyphs + :~ ::x bound glyphs [new %diff %talk-lowdown %glyph nak] ::x nicknames [new %diff %talk-lowdown %names (~(run by folks) some)] == =. +>.$ ::TODO =? ?. (~(has by stories) sor) +>.$ - %- ra-emit - ::x messages - :* new %diff %talk-lowdown %grams sor 0 - grams:(~(got by stories) sor) + =+ soy=(~(got by stories) sor) + %- ra-emil + :~ ::x configurations + :* new %diff %talk-lowdown %confs + `shape.soy (~(run by mirrors.soy) some) + == + ::x presences + [new %diff %talk-lowdown %precs locals.soy remotes.soy] + ::x messages + [new %diff %talk-lowdown %grams 0 grams.soy] == %= +>.$ general @@ -690,7 +691,7 @@ %+ murn (~(tap by general)) |= {b/bone s/(set knot)} ^- (unit move) - ?: &(=(%grams -.low) !(~(has in s) man)) ~ + ?. (~(has in s) man) ~ `[b %diff %talk-lowdown low] moves +>.$ @@ -728,7 +729,7 @@ =+ old=mirrors =. mirrors (~(put by mirrors) cuz con) ?: =(mirrors old) +>.$ - =. +>.$ (pa-inform %confs (strap cuz `con)) + =. +>.$ (pa-inform %confs `shape (strap cuz `con)) (pa-report-cabal pa-followers) :: ++ pa-diff-talk-report :: subscribed update @@ -753,8 +754,7 @@ ^+ +> ?. (~(has in sources.shape) tay) +> =. sources.shape (~(del in sources.shape) tay) - =. mirrors (~(put by mirrors) [our.hid man] shape) - =. +> (pa-inform %confs (strap [our.hid man] `shape)) + =. +> (pa-inform %confs `shape ~) (pa-report-cabal pa-followers) :: ++ pa-sauce :: send backward @@ -789,7 +789,7 @@ == :: ++ pa-acquire :: subscribe to - ::x for each partner, produce a %peer/subscribe move. + ::x subscribe this story to the partners. :: |= tal/(list partner) %+ pa-sauce 0 ::x subscription is caused by this app @@ -817,7 +817,7 @@ ::x partners we gained/lost, and send out an updated cabal report. :: |= cof/config - =. +>.$ (pa-inform %confs (strap [our.hid man] `cof)) + =. +>.$ (pa-inform %confs `cof ~) =+ ^= dif ^- (pair (list partner) (list partner)) =+ old=`(list partner)`(~(tap in sources.shape) ~) =+ new=`(list partner)`(~(tap in sources.cof) ~) @@ -826,13 +826,11 @@ =. +>.$ (pa-acquire p.dif) =. +>.$ (pa-abjure q.dif) =. shape cof - =. mirrors (~(put by mirrors) [our.hid man] cof) (pa-report-cabal pa-followers) :: ++ pa-reform-gone =. stories (~(del by stories) man) - =. mirrors (~(del by mirrors) [our.hid man]) - =. . (pa-inform %confs (strap [our.hid man] ~)) + =. . (pa-inform %confs ~ ~) =. . (pa-report-cabal pa-followers) (pa-abjure (~(tap in sources.shape))) :: @@ -849,8 +847,7 @@ ^+ +> =/ nol (~(put by locals) her saz) ?: =(nol locals) +>.$ - =. +>.$ (pa-inform %precs (strap [%& our.hid man] (strap her saz))) - =/ ner (~(put by remotes) [%& our.hid man] nol) + =. +>.$ (pa-inform %precs (strap her saz) ~) (pa-report-group(locals nol) pa-followers) :: ++ pa-remind :: remote presence @@ -863,7 +860,7 @@ =/ buk (~(uni by remotes) rem) ::TODO drop? =. buk (~(put by buk) tay loc) ?: =(buk remotes) +>.$ - =. +>.$ (pa-inform %precs (~(dif in buk) remotes)) + =. +>.$ (pa-inform %precs ~ (~(dif in buk) remotes)) (pa-report-group(remotes buk) pa-followers) :: ++ pa-start :: start stream @@ -933,7 +930,7 @@ |= {num/@ud gam/telegram} ^+ +> ::x notify the interested readers. - =. +> (pa-inform %grams man num gam ~) + =. +> (pa-inform %grams num gam ~) ::x notify only the followers who are currently interested. =+ ^= moy |- ^- (pair (list bone) (list move)) diff --git a/sur/talk.hoon b/sur/talk.hoon index 718cf1f758..222f151ee9 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -56,26 +56,27 @@ $? $black :: channel, blacklist $white :: village, whitelist $green :: journal, author list - $brown :: mailbox, our + black + $brown :: mailbox, our r, bl w == :: ++ presence ?($gone $hear $talk) :: status type ++ register (pair atlas (map partner atlas)) :: ping me, ping srcs ++ shelf (map knot (pair posture cord)) :: ship shape ++ report :: talk update - $% {$cabal cabal} :: config neighborhood + $% :: relevant story is determined from wire: reader responsibility. + {$cabal cabal} :: config neighborhood :: {$folder (list report)} :: multiple {$grams (pair @ud (list telegram))} :: beginning thoughts {$group register} :: presence == :: ++ lowdown :: changed shared state - ::TODO change these so that they're always just the diff? - :: re-check existing implementations too! - :: this will aid with ++sh's printing. - $% {$glyph (jug char (set partner))} :: new bindings + $% :: ui state + {$glyph (jug char (set partner))} :: new bindings {$names (map ship (unit human))} :: new identities - {$confs (map station (unit config))} :: changed configs - {$precs (map partner atlas)} :: changed presences - {$grams (trel knot @ud (list telegram))} :: new grams + :: story state + :: relevant story is determined from wire: reader responsibility. + {$confs (unit config) (map station (unit config))}:: changed configs + {$precs register} :: changed presences + {$grams (pair @ud (list telegram))} :: new grams == :: ++ speech :: narrative action $% {$lan p/knot q/@t} :: local announce From 8b82260408098e820c0bb189d51000f96bd04b03 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 13 Apr 2017 23:40:53 +0200 Subject: [PATCH 061/303] Added %source action for un/subscribing, %convey and %phrase actions for sending. New actions are used in reader to simplify implementation. --- app/talk-agent.hoon | 36 +++--------------------------------- app/talk-guardian.hoon | 29 +++++++++++++++++++++++++++++ sur/talk.hoon | 4 ++++ 3 files changed, 36 insertions(+), 33 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 5b1d7d7472..bcdde9e207 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -511,22 +511,6 @@ ^+ +> +>(moves :_(moves [id.she %diff %sole-effect fec])) :: - ++ sh-tell :: add command - ::x adds talk command to ++ra's moves. - :: - |= cod/command - ^+ +> - %= +> - moves - :_ moves - :* ost.hid - %poke - /reader/command - (broker our.hid) - [%talk-command cod] - == - == - :: ++ sh-action ::x adds a talk-action to ++ra's moves :: @@ -1047,14 +1031,6 @@ |= txt/tape (sh-fact [%txt txt]) :: - ++ sh-whom :: current audience - ::x produces the currently selected audience for this shell. - :: - ^- audience - %- ~(gas by *audience) - %+ turn (~(tap in active.she)) - |=(a/partner [a *envelope %pending]) - :: ++ sh-twig-head ^- vase :: eval data ::x makes a vase of environment data to evaluate against (#-messages). :: @@ -1130,16 +1106,14 @@ sh-prod(active.she pan) =+ loc=(~(got by mirrors) [our.hid man]) ::x change local mailbox config to include subscription to pan. - %^ sh-tell %design man - `loc(sources (~(uni in sources.loc) pan)) + (sh-action %source man & pan) :: ++ leave :: %leave |= pan/(set partner) ^+ ..sh-work =+ loc=(~(got by mirrors) [our.hid man]) ::x change local mailbox config to exclude subscription to pan. - %^ sh-tell %design man - `loc(sources (~(dif in sources.loc) pan)) + (sh-action %source man | pan) :: ++ what :: %what |= qur/$@(char (set partner)) ^+ ..sh-work @@ -1303,11 +1277,7 @@ ++ say :: publish |= sep/(list speech) ^+ ..sh-work - =- (sh-tell [%publish tot]) - |- ^- tot/(list thought) - ?~ sep ~ - =^ sir ..sh-work sh-uniq - [[sir sh-whom [now.hid ~ i.sep]] $(sep t.sep)] + (sh-action %phrase active.she sep) -- :: ++ sh-done :: apply result diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index b3bb85e651..c1e947fae8 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -218,6 +218,35 @@ $permit :: invite/banish %- (ra-affect p.act red `act) |= par/_pa =< pa-abet (pa-permit:par q.act r.act) + :: + $source :: un/sub p to/from r + =+ pur=(~(get by stories) p.act) + ?~ pur + %+ ra-react red + [%fail (crip "no story {(trip p.act)}") `act] + =. sources.shape.u.pur + %. r.act + ?: q.act + ~(uni in sources.shape.u.pur) + ~(dif in sources.shape.u.pur) + (ra-config p.act shape.u.pur) + :: + :: messaging + :: + $convey :: post exact + (ra-think & our.hid +.act) + :: + $phrase :: post easy + =- (ra-think & our.hid tos) + |- ^- tos/(list thought) + ?~ q.act ~ + =^ sir eny.hid (uniq eny.hid) + :_ $(q.act t.q.act) + :+ sir + %- ~(gas by *audience) + %+ turn (~(tap in p.act)) + |=(p/partner [p *envelope %pending]) + [now.hid ~ i.q.act] :: :: personal metadata :: diff --git a/sur/talk.hoon b/sur/talk.hoon index 222f151ee9..896655ceec 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -14,6 +14,10 @@ $% :: station configuration :: {$create (trel knot cord posture)} :: create station {$permit (trel knot ? (set ship))} :: invite/banish + {$source (trel knot ? (set partner))} :: un/sub p to/from r + :: messaging :: + {$convey (list thought)} :: post exact + {$phrase (pair (set partner) (list speech))} :: post easy :: personal metadata :: ::TODO change to target partners, not only our stations. {$status (pair (set knot) status)} :: our status update From 85a13cea216442b84e1bb08fc56d4fb6ce2fda0d Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 14 Apr 2017 00:46:15 +0200 Subject: [PATCH 062/303] Fully deprecated %design and %publish commands in favor of the new actions. --- app/talk-guardian.hoon | 78 +++++++++++++----------------------------- lib/talk.hoon | 19 +++++----- mar/talk/command.hoon | 15 +------- sur/talk.hoon | 4 +-- 4 files changed, 34 insertions(+), 82 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index c1e947fae8..9d8a2e49c4 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -152,10 +152,8 @@ [%green ~.public 'visible activity'] == |: [[typ=*posture man=*knot des=*cord] ..ra-init] ^+ ..ra-init - %+ ra-apply our.hid - :+ %design man - :- ~ :- ~ - [des [typ ~]] + %+ ra-action ost.hid + [%create man des typ] :: ++ ra-apply :: apply command ::x applies the command sent by her. @@ -163,26 +161,8 @@ |= {her/ship cod/command} ^+ +> ?- -.cod - ::x the $design command is used for modifying channel configs, - ::x which is done when joining, leaving or creating channels. - ::x this may only be done by ourselves. - $design - ?. (team our.hid her) - (ra-evil %talk-no-owner) - ?~ q.cod - ?. (~(has by stories) p.cod) - (ra-evil %talk-no-story) - ::x $design with ~ for config signals delete - (ra-unconfig p.cod) - (ra-config p.cod u.q.cod) - :: ::x used for relaying messages (as a station host). $review (ra-think | her +.cod) - :: - ::x used for sending messages (as their author). - $publish - ?. (team our.hid her) +>.$ - (ra-think & her +.cod) == :: ++ ra-inform ::x new lowdown @@ -320,12 +300,9 @@ (ra-consume-fora-post man pax hed txt) ::x if we have no %posts story, first create it, then consume. =; new (ra-consume-fora-post:new man pax hed txt) - =. ..ra-apply - %+ ra-apply our.hid - :+ %design man - :- ~ :- ~ ::x sources - :- 'towards a community' ::x caption - [%brown ~] ::x cordon + =. ..ra-action + %+ ra-action ost.hid + [%create man 'towards a community' %brown] ::x send informative message to our mailbox. %^ ra-consume & our.hid :^ (shaf %init eny.hid) ::x serial @@ -366,12 +343,9 @@ ?: (~(has by stories) man) (ra-consume-comment man pax sup txt) =; new (ra-consume-comment:new man pax sup txt) - =. ..ra-apply - %+ ra-apply our.hid - :+ %design man - :- ~ :- ~ - :- 'letters to the editor' - [%brown ~] + =. ..ra-action + %+ ra-action ost.hid + [%create man 'letters to the editor' %brown] %^ ra-consume & our.hid :^ (shaf %init eny.hid) (my [[%& our.hid (main our.hid)] *envelope %pending] ~) @@ -508,7 +482,7 @@ ?~ pur ~& [%bad-subscribe-story-c i.pax] (ra-evil %talk-no-story) - =+ soy=~(. pa i.pax `(list command)`~ u.pur) ::TODO nest-fail if no cast + =+ soy=~(. pa i.pax `(list action)`~ u.pur) ::TODO nest-fail if no cast ::x she needs read permissions to subscribe. ?. (pa-visible:soy her) (ra-evil %talk-no-story) @@ -641,11 +615,11 @@ ::x bones are used to identify subscribers (source event identifiers). :: |_ ::x man: the knot identifying the story in stories. - ::x coz: talk commands issued due to changes. + ::x acs: talk actions issued due to changes. ::x story doesn't get a face because ease of use. :: $: man/knot - coz/(list command) + acs/(list action) story == ++ pa-abet @@ -653,18 +627,18 @@ :: ^+ +> =. +> +>(stories (~(put by stories) man `story`+<+>)) - =. coz (flop coz) + =. acs (flop acs) |- ^+ +>+ - ?~ coz +>+ - =. +>+ (ra-apply our.hid i.coz) - $(coz t.coz) + ?~ acs +>+ + =. +>+ (ra-action ost.hid i.acs) + $(acs t.acs) :: - ++ pa-tell - ::x stores a talk command. + ++ pa-act + ::x stores a talk action. :: - |= cod/command + |= act/action ^+ +> - +>(coz [cod coz]) + +>(acs [act acs]) :: ++ pa-followers ^- (set bone) @@ -1071,16 +1045,12 @@ =. f ?~ f followers f ::TODO =? (~(del by f) b) =. +>.$ - %- pa-tell - :- %publish + %- pa-act + :- %phrase %- ~(rep in sis) - |= {s/ship t/(list thought)} - :_ t - =^ sir eny.hid (uniq eny.hid) - :+ sir :: serial - [[[%& s (main s)] [*envelope %pending]] ~ ~] :: audience - :+ now.hid ~ :: statement - [%inv inv [our.hid man]] + |= {s/ship a/(set partner) t/(list speech)} + :- (~(put in a) [%& s (main s)]) + [[%inv inv [our.hid man]] t] %- pa-reform %= shape q.cordon diff --git a/lib/talk.hoon b/lib/talk.hoon index f161df768a..3184bd6c13 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -21,20 +21,17 @@ ++ said-url :: app url |= url/purl :^ ost.bol %poke /said-url - :+ [our.bol %talk] %talk-command - ^- command - :- %publish - :_ ~ - ^- thought - :+ (shaf %thot eny.bol) - [[[%& our.bol (main our.bol)] [*envelope %pending]] ~ ~] - [now.bol *bouquet [%app dap.bol (crip (earn url))]] :: XX + :+ [our.bol %talk] %talk-action + ^- action + :+ %phrase + [[%& our.bol (main our.bol)] ~ ~] + [%app dap.bol (crip (earn url))]~ :: XX :: ++ said :: app message |= {our/@p dap/term now/@da eny/@uvJ mes/(list tank)} - :- %talk-command - ^- command - :- %publish + :- %talk-action + ^- action + :- %convey |- ^- (list thought) ?~ mes ~ :_ $(mes t.mes, eny (sham eny mes)) diff --git a/mar/talk/command.hoon b/mar/talk/command.hoon index 7494b5d20d..b029ded9f6 100644 --- a/mar/talk/command.hoon +++ b/mar/talk/command.hoon @@ -14,9 +14,7 @@ => [jo ..command] |= a/json ^- command =- (need ((of -) a)) - =< :~ publish+(ar thot) - review+(ar thot) - design+(ot party+so config+(mu conf) ~) + =< :~ review+(ar thot) == |% ++ op :: parse keys of map @@ -39,7 +37,6 @@ |* a/fist (cu ~(gas in *(set _(need *a))) (ar a)) :: - ++ lake |*(a/_* $-(json (unit a))) ++ peach |* a/{rule rule} |= tub/nail @@ -71,7 +68,6 @@ ^- $-(json (unit audience)) (op parn memb) :: - ++ auri (op parn (ci (soft presence) so)) ++ memb (ot [envelope+lope delivery+(ci (soft delivery) so) ~]) ++ lope (ot [visible+bo sender+(mu (su parn)) ~]) :: @@ -111,15 +107,6 @@ :: exp+(cu |=(a=cord [a ~]) so) :: inv+(ot ship+(su fed:ag) party+(su urs:ab) ~) == - :: - ++ conf - ^- $-(json (unit config)) - %- ot :~ - sources+(as (su parn)) - caption+so - :- %cordon - (ot posture+(ci (soft posture) so) list+(as (su fed:ag)) ~) - == -- -- -- diff --git a/sur/talk.hoon b/sur/talk.hoon index 896655ceec..e77b56b137 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -6,9 +6,7 @@ ++ atlas (map ship status) :: presence map ++ bouquet (set flavor) :: complete aroma ++ command :: effect on party - $% {$design (pair knot (unit config))} :: configure+destroy - {$publish (list thought)} :: originate - {$review (list thought)} :: deliver + $% {$review (list thought)} :: deliver == :: ++ action :: user action $% :: station configuration :: From 8b8e0808064d22eee362846fa304781d97c0a9fa Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 14 Apr 2017 13:04:19 +0200 Subject: [PATCH 063/303] Removed talk invite functionality from lib/helm. It's now done through talk. --- lib/helm.hoon | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lib/helm.hoon b/lib/helm.hoon index 1f6ae12000..4f8fab03a9 100644 --- a/lib/helm.hoon +++ b/lib/helm.hoon @@ -3,7 +3,6 @@ :: :: :: /? 310 :: version /- sole -/+ talk [. sole] :: :: :: :::: :: :: @@ -60,7 +59,6 @@ ++ move (pair bone card) :: user-level move ++ pear :: poke fruit $% {$hood-unsync desk ship desk} :: - {$talk-command command:talk} :: {$ask-mail cord} :: {$helm-hi cord} :: == :: @@ -138,12 +136,6 @@ =+ fil=.^(@ %cx (welp way /hoon)) [%flog /reload [%veer ?:(=('z' tip) %$ tip) way fil]] :: -++ poke-invite :: send invite; fake - |= {who/@p myl/@t} =< abet - %^ emit %poke /helm/invite - :- [our %talk] - (said:talk our %helm now eny [%leaf "invited: {} at {(trip myl)}"]~) -:: ++ poke-reset :: reset system |= hood-reset =< abet %- emil From 86deb6204bf7895889d49983b47ac2fe7068f3b3 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 14 Apr 2017 16:16:36 +0200 Subject: [PATCH 064/303] Implemented %depict, %source and %delete commands. --- app/talk-agent.hoon | 31 ++++++++++++++++++++++++++++ app/talk-guardian.hoon | 47 ++++++++++++++++++++++++++---------------- sur/talk.hoon | 3 +++ 3 files changed, 63 insertions(+), 18 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index bcdde9e207..9d3caed7dd 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -80,6 +80,9 @@ {$target p/where q/(unit work)} :: set active targets :: {$destroy p/knot} :: {$create p/posture q/knot r/cord} :: + {$depict p/knot q/cord} :: + {$source p/knot q/(set partner)} :: + {$delete p/knot q/(unit cord)} :: {$probe p/station} :: == :: ++ weir :: parsed wire @@ -463,6 +466,16 @@ :: ;~((glue ace) (perk %invite ~) ;~(pfix cen sym) shiz) ;~((glue ace) (perk %banish ~) ;~(pfix cen sym) shiz) + :: + ;~((glue ace) (perk %depict ~) ;~(pfix cen sym) qut) + ;~((glue ace) (perk %source ~) ;~(pfix cen sym) parz) + ;~ plug (perk %delete ~) + ;~(pfix ;~(plug ace cen) sym) + ;~ pose + (cook some ;~(pfix ace qut)) + (easy ~) + == + == :: ;~(plug (perk %who ~) ;~(pose ;~(pfix ace para) (easy ~))) ;~(plug (perk %bind ~) ;~(pfix ace glyph) (punt ;~(pfix ace para))) @@ -1056,6 +1069,9 @@ $invite (invite +.job) $banish (banish +.job) $create (create +.job) + $depict (depict +.job) + $source (source +.job) + $delete (delete +.job) $nick (nick +.job) $set (wo-set +.job) $unset (unset +.job) @@ -1170,6 +1186,21 @@ (sh-action %create nom txt por) (join [[%& our.hid nom] ~ ~]) :: + ++ depict + |= {nom/knot txt/cord} + ^+ ..sh-work + (sh-action %depict nom txt) + :: + ++ source + |= {nom/knot pas/(set partner)} + ^+ ..sh-work + (sh-action %source nom & pas) + :: + ++ delete + |= {nom/knot say/(unit cord)} + ^+ ..sh-work + (sh-action %delete nom say) + :: ++ reverse-folks |= nym/knot ^- (list ship) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 9d8a2e49c4..735436b8d7 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -194,22 +194,31 @@ ?. (~(has in stories) p.act) (ra-config p.act [[%& our.hid p.act] ~ ~] q.act [r.act ~]) (ra-react red %fail (crip "{(trip p.act)}: already exists") `act) - :: - $permit :: invite/banish - %- (ra-affect p.act red `act) |= par/_pa =< pa-abet - (pa-permit:par q.act r.act) :: $source :: un/sub p to/from r - =+ pur=(~(get by stories) p.act) - ?~ pur - %+ ra-react red - [%fail (crip "no story {(trip p.act)}") `act] - =. sources.shape.u.pur + %- (ra-affect p.act red `act) |= {par/_pa soy/story} + =. sources.shape.soy %. r.act ?: q.act - ~(uni in sources.shape.u.pur) - ~(dif in sources.shape.u.pur) - (ra-config p.act shape.u.pur) + ~(uni in sources.shape.soy) + ~(dif in sources.shape.soy) + (ra-config p.act shape.soy) + :: + $depict :: change description + %- (ra-affect p.act red `act) |= {par/_pa soy/story} + =. caption.shape.soy q.act + (ra-config p.act shape.soy) + :: + $permit :: invite/banish + %- (ra-affect p.act red `act) |= {par/_pa *} =< pa-abet + (pa-permit:par q.act r.act) + :: + $delete :: delete + announce + %- (ra-affect p.act red `act) |= * + =. +>.^$ ::TODO =? + ?~ q.act +>.^$ + (ra-action red %phrase [[%& our.hid p.act] ~ ~] [%lin | u.q.act]~) + (ra-unconfig p.act) :: :: messaging :: @@ -236,7 +245,7 @@ ?~ p.act +>.^$ =. +>.^$ $(p.act l.p.act) =. +>.^$ $(p.act r.p.act) - %- (ra-affect n.p.act red `act) |= par/_pa =< pa-abet + %- (ra-affect n.p.act red `act) |= {par/_pa *} =< pa-abet (pa-notify:par our.hid q.act) :: :: changing shared ui @@ -264,10 +273,12 @@ ^+ +> =+ :- neu=!(~(has by stories) man) pur=(fall (~(get by stories) man) *story) - ::x if we just created the story, and it's invite only, make sure we're in. - =. con ::TODO =? - ?. &(neu ?=(?($white $green) p.cordon.con)) con - con(q.cordon [our.hid ~ ~]) + :: wyt: will be white + =+ wyt=?=(?($white $green) p.cordon.con) + ::x if we just created the story, and invite only, make sure we're in. + =. q.cordon.con ::TODO =? + ?: &(neu wyt) q.cordon.con + [our.hid ~ ~] pa-abet:(~(pa-reform pa man ~ pur) con) :: ++ ra-unconfig @@ -395,7 +406,7 @@ ?~ pur %+ ra-react red [%fail (crip "no story {(trip man)}") act] - (fun ~(. pa man ~ u.pur)) + (fun ~(. pa man ~ u.pur) u.pur) :: ++ ra-diff-talk-report :: subscription update ::x process a talk report from cuz into story man. diff --git a/sur/talk.hoon b/sur/talk.hoon index e77b56b137..6fd4ad3506 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -13,6 +13,9 @@ {$create (trel knot cord posture)} :: create station {$permit (trel knot ? (set ship))} :: invite/banish {$source (trel knot ? (set partner))} :: un/sub p to/from r + {$depict (pair knot cord)} :: change description + {$permit (trel knot ? (set ship))} :: invite/banish + {$delete (pair knot (unit @t))} :: delete + announce :: messaging :: {$convey (list thought)} :: post exact {$phrase (pair (set partner) (list speech))} :: post easy From ad8fb2607e36e4f6ceee5f5457d7e7d1f0465d64 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 14 Apr 2017 16:41:49 +0200 Subject: [PATCH 065/303] Moved unsubscribing of specific ships (instead of bones) into its own arm. --- app/talk-guardian.hoon | 20 ++++++++++++++------ sur/talk.hoon | 1 - 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 735436b8d7..c82e1b2e1b 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -1042,6 +1042,17 @@ c (~(put in c) b) :: + ++ pa-eject + ::x removes the ships from our followers. + |= sis/(set ship) + %= +> + followers + %- ~(rep in (pa-unearth sis)) + |= {b/bone f/_followers} + =. f ?~ f followers f ::TODO =? + (~(del by f) b) + == + :: ++ pa-permit ::x invite/banish ships to/from this station. :: @@ -1049,12 +1060,9 @@ ^+ +> =/ white/? ?=(?($white $green) p.cordon.shape) :: whitelist? =/ add/? =(inv white) :: add to list? - =. followers ::TODO =? - ?: inv followers - %- ~(rep in (pa-unearth sis)) - |= {b/bone f/_followers} - =. f ?~ f followers f ::TODO =? - (~(del by f) b) + =. +>.$ ::TODO =? + ?: inv +>.$ + (pa-eject sis) =. +>.$ %- pa-act :- %phrase diff --git a/sur/talk.hoon b/sur/talk.hoon index 6fd4ad3506..2d56bc9c26 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -11,7 +11,6 @@ ++ action :: user action $% :: station configuration :: {$create (trel knot cord posture)} :: create station - {$permit (trel knot ? (set ship))} :: invite/banish {$source (trel knot ? (set partner))} :: un/sub p to/from r {$depict (pair knot cord)} :: change description {$permit (trel knot ? (set ship))} :: invite/banish From 6d39b45cb8dacb2deef68b1b06ea32209de49b3b Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 17 Apr 2017 13:14:04 +0200 Subject: [PATCH 066/303] Station parser. --- app/talk-agent.hoon | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 9d3caed7dd..900abf297a 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -376,6 +376,9 @@ == == :: + ++ stat :: local station + ;~(pfix cen sym) + :: ++ stan :: station ;~ pose (cold [our.hid (main our.hid)] col) @@ -460,15 +463,15 @@ ;~ pose ;~ (glue ace) (perk %create ~) pore - ;~(pfix cen sym) + stat qut == :: - ;~((glue ace) (perk %invite ~) ;~(pfix cen sym) shiz) - ;~((glue ace) (perk %banish ~) ;~(pfix cen sym) shiz) + ;~((glue ace) (perk %invite ~) stat shiz) + ;~((glue ace) (perk %banish ~) stat shiz) :: - ;~((glue ace) (perk %depict ~) ;~(pfix cen sym) qut) - ;~((glue ace) (perk %source ~) ;~(pfix cen sym) parz) + ;~((glue ace) (perk %depict ~) stat qut) + ;~((glue ace) (perk %source ~) stat parz) ;~ plug (perk %delete ~) ;~(pfix ;~(plug ace cen) sym) ;~ pose From 9355a4d9b4f67fd0812b1bc705b06d963d690ef4 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 17 Apr 2017 13:49:46 +0200 Subject: [PATCH 067/303] Self-permissions issue. --- app/talk-guardian.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index c82e1b2e1b..d8aac98336 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -277,8 +277,8 @@ =+ wyt=?=(?($white $green) p.cordon.con) ::x if we just created the story, and invite only, make sure we're in. =. q.cordon.con ::TODO =? - ?: &(neu wyt) q.cordon.con - [our.hid ~ ~] + ?: &(neu wyt) [our.hid ~ ~] + q.cordon.con pa-abet:(~(pa-reform pa man ~ pur) con) :: ++ ra-unconfig From 02b31e4cb06ec11032ac193cfc1367a81d5564e9 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 18 Apr 2017 14:29:17 +0200 Subject: [PATCH 068/303] Implemented ;unbind for unbinding glyphs. --- app/talk-agent.hoon | 32 +++++++++++++++++++++++++++++--- app/talk-guardian.hoon | 19 +++++++++++++++++-- sur/talk.hoon | 2 +- 3 files changed, 47 insertions(+), 6 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 900abf297a..cc8148bd9e 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -68,6 +68,7 @@ {$who p/where} :: presence {$what p/$@(char (set partner))} :: show bound glyph {$bind p/char q/(unit where)} :: + {$unbind p/char q/(unit where)} :: {$join p/where} :: {$leave p/where} :: {$say p/(list speech)} :: @@ -482,6 +483,7 @@ :: ;~(plug (perk %who ~) ;~(pose ;~(pfix ace para) (easy ~))) ;~(plug (perk %bind ~) ;~(pfix ace glyph) (punt ;~(pfix ace para))) + ;~(plug (perk %unbind ~) ;~(pfix ace glyph) (punt ;~(pfix ace para))) ;~((glue ace) (perk %join ~) para) ;~((glue ace) (perk %leave ~) para) ;~((glue ace) (perk %what ~) ;~(pose parz glyph)) @@ -1069,6 +1071,7 @@ $who (who +.job) $what (what +.job) $bind (bind +.job) + $unbind (unbind +.job) $invite (invite +.job) $banish (banish +.job) $create (create +.job) @@ -1110,8 +1113,23 @@ |= {cha/char lix/(set partner)} =: nik (~(put by nik) lix cha) nak (~(put ju nak) cha lix) - == - (sh-action %glyph cha lix) + == + (sh-action %glyph cha lix &) + :: + ++ unset-glyph + |= {cha/char lix/(unit (set partner))} + =/ ole/(set (set partner)) + ?^ lix [u.lix ~ ~] + (~(get ju nak) cha) + =. ..sh-work (sh-action %glyph cha (fall lix ~) |) + |- ^+ ..sh-work + ?~ ole ..sh-work + =. ..sh-work $(ole l.ole) + =. ..sh-work $(ole r.ole) + %= ..sh-work + nik (~(del by nik) n.ole) + nak (~(del ju nak) cha n.ole) + == :: ++ join :: %join |= pan/(set partner) @@ -1168,7 +1186,15 @@ ?~ pan $(pan `active.she) =+ ole=(~(get by nik) u.pan) ?: =(ole [~ cha]) ..sh-work - (sh-note:(set-glyph cha u.pan) "bound {} {}") + (sh-note:sh-prod:(set-glyph cha u.pan) "bound {} {}") + :: + ++ unbind :: %unbind + |= {cha/char pan/(unit (set partner))} ^+ ..sh-work + ?. ?| &(?=(^ pan) (~(has by nik) u.pan)) + &(?=($~ pan) (~(has by nak) cha)) + == + ..sh-work + (sh-note:sh-prod:(unset-glyph cha pan) "unbound {}") :: ++ invite :: %invite |= {nom/knot sis/(set ship)} diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index d8aac98336..865b16a57e 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -261,8 +261,23 @@ (strap p.act ?~(hand.q.act ~ `q.act)) :: $glyph :: bind a glyph - =. nik (~(put by nik) q.act p.act) - =. nak (~(put ju nak) p.act q.act) + =. +>.$ + ?: r.act + %= +>.$ + nik (~(put by nik) q.act p.act) + nak (~(put ju nak) p.act q.act) + == + =/ ole/(set (set partner)) + ?. =(q.act ~) [q.act ~ ~] + (~(get ju nak) p.act) + |- ^+ +>.^$ + ?~ ole +>.^$ + =. +>.^$ $(ole l.ole) + =. +>.^$ $(ole r.ole) + %= +>.^$ + nik (~(del by nik) n.ole) + nak (~(del ju nak) p.act n.ole) + == (ra-inform %glyph nak) == :: diff --git a/sur/talk.hoon b/sur/talk.hoon index 2d56bc9c26..9afef1c079 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -23,7 +23,7 @@ {$status (pair (set knot) status)} :: our status update :: changing shared ui :: {$human (pair ship human)} :: new identity - {$glyph (pair char (set partner))} :: bind a glyph + {$glyph (trel char (set partner) ?)} :: un/bind a glyph == :: ++ reaction :: user information $: kind/?($info $fail) :: result From af459acbb8d65fbff7ddaf007984239d7326bece Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 18 Apr 2017 14:29:58 +0200 Subject: [PATCH 069/303] Agent now properly does a per-partner uni of presence maps. --- app/talk-agent.hoon | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index cc8148bd9e..10c7472b5a 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -227,9 +227,19 @@ +>.$ :: ++ ra-low-precs + ::x applies new presences. other clients might care for tas, but we're only + ::x ever getting this for the mailbox, where we're the only ones present. + :: |= {tas/atlas pas/(map partner atlas)} ^+ +> - =+ ner=(~(uni by remotes) pas) ::TODO per-partner uni. + =/ ner/_remotes + :: per-partner uni. + %- ~(urn by pas) + |= {p/partner a/atlas} + =+ o=(~(get by remotes) p) + ?~(o a (~(uni by u.o) a)) + :: then fill in the gaps with what we know. + =. ner (~(uni by remotes) ner) ?: =(remotes ner) +>.$ =. +>.$ sh-abet:(~(sh-low-rempe sh cli (main our.hid)) remotes ner) +>.$(remotes ner) From 019bb9e3e59ebf2bbf012cbf70fee24e37671903 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 18 Apr 2017 16:10:01 +0200 Subject: [PATCH 070/303] Guardian now only sends remote presence diffs to readers, not the whole thing. --- app/talk-guardian.hoon | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 865b16a57e..140bc156b1 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -886,10 +886,16 @@ |= {tay/partner loc/atlas rem/(map partner atlas)} ::x remove this story from the presence map, since it's in local already. =. rem (~(del by rem) %& our.hid man) :: superceded by local data - =/ buk (~(uni by remotes) rem) ::TODO drop? + =/ buk (~(uni by remotes) rem) =. buk (~(put by buk) tay loc) ?: =(buk remotes) +>.$ - =. +>.$ (pa-inform %precs ~ (~(dif in buk) remotes)) + =. +>.$ + %^ pa-inform %precs ~ + :: per-partner diff. + %- ~(urn by buk) + |= {p/partner a/atlas} + =+ o=(~(get by remotes) p) + ?~(o a (~(dif in a) u.o)) (pa-report-group(remotes buk) pa-followers) :: ++ pa-start :: start stream From 49eb5fe7dd9eaf37d56494c7ade33269b4c1815c Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 18 Apr 2017 18:59:29 +0200 Subject: [PATCH 071/303] ++pa-start no longer adds a follower if they are only interested in past data. --- app/talk-guardian.hoon | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 140bc156b1..056e065119 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -904,14 +904,12 @@ :: |= riv/river ^+ +> - ::TODO use =; lab/{dun/? end/@u zeg/(list telegram)} - =- :: ~& [%pa-start riv lab] + =; lab/{dun/? end/@u zeg/(list telegram)} =. +>.$ - (pa-sauce ost.hid [[%diff %talk-report %grams q.lab r.lab] ~]) - ?: p.lab ::x? dun never gets changed, so always | ? + (pa-sauce ost.hid [[%diff %talk-report %grams end.lab zeg.lab] ~]) + ?: dun.lab (pa-sauce ost.hid [[%quit ~] ~]) +>.$(followers (~(put by followers) ost.hid riv)) - ^= lab =+ [end=count gaz=grams dun=| zeg=*(list telegram)] |- ^- (trel ? @ud (list telegram)) ?~ gaz [dun end zeg] @@ -919,8 +917,8 @@ $ud (lte p.q.riv end) $da (lte p.q.riv p.r.q.i.gaz) == - ::x if we're past the river, continue browsing back. - $(end (dec end), gaz t.gaz) ::TODO dun & + ::x if we're past the river, keep browsing back, mark stream as done. + $(end (dec end), gaz t.gaz, dun &) ?: ?- -.p.riv :: before the start $ud (lth end p.p.riv) $da (lth p.r.q.i.gaz p.p.riv) From 738ac9015286c2a02bb77d3262947adabefdb733 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 18 Apr 2017 21:33:02 +0200 Subject: [PATCH 072/303] Updated TODOs. --- app/talk-agent.hoon | 3 +-- app/talk-guardian.hoon | 28 ++++++++++++++++++++-------- sur/talk.hoon | 15 ++++++--------- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 10c7472b5a..9f1e9ddf37 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -8,7 +8,7 @@ ::TODO correct/clean up presence/config change notifications :: ::TODO remove man from door sample where it's always (main our.hid). -::TODO maybe collapse sources, remotes and mirrors into a single map? +::TODO sh-action -> sh-act ::TODO maybe keep track of received grams per partner, too? :: ::x This reader implementation makes use of the mailbox for all its @@ -631,7 +631,6 @@ ++ sh-glyf :: decode glyph ::x gets the partner(s) that match a glyph. ::x? why (set partner)? it seems like it only ever returns a single one. - ::TODO should produce a set when ambiguous. :: |= cha/char ^- (unit (set partner)) =+ lax=(~(get ju nak) cha) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 056e065119..404bc84038 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -10,13 +10,22 @@ ::TODO tidiness, remove unnecessary ~&, etc. ::TODO maybe ensure every arm has a mini-description at :57 too? ::TODO maybe prefix all printfs and other errors with %talk? -:: -::TODO do permission checks for the whole team instead of just a ship, maybe? -::TODO sending remotes and mirrors alongside locals and shape no longer makes -:: any sense, does it? -::TODO crash on pokes/peers we do not expect ::TODO rename cores. ra->ta (transaction), pa->to (story). :: +::TODO we can't do away with the default mailbox because we need it for things +:: like invite notifications etc. can we do better than request that apps +:: don't use it frivolously? +::TODO federation stuff. +::TODO ".. the importance of the CQRS pattern (command-query separation) behind +:: Urbit's separation of %poke and %peer. Pokes (messages) are one-way +:: commands, not queries. Peers (subscriptions) have no effect on the +:: server state." +:: but we *do* change state on-subscribe! is that a problem? +:: +::TODO permission checks should only use team if it's coming from a reader. +::TODO for story permission checks, count moons as their parent identity. +::TODO crash on pokes/peers we do not expect +:: /? 310 :: hoon version /- talk, sole :: structures /+ talk, sole, time-to-id, twitter :: libraries @@ -47,6 +56,7 @@ shape/config :: configuration mirrors/(map station config) :: remote config ::TODO never gets updated. :: + :: should probably just be @ud, per story? sequence/(map partner @ud) :: partners heard known/(map serial @ud) :: messages heard followers/(map bone river) :: subscribers @@ -508,7 +518,7 @@ ?~ pur ~& [%bad-subscribe-story-c i.pax] (ra-evil %talk-no-story) - =+ soy=~(. pa i.pax `(list action)`~ u.pur) ::TODO nest-fail if no cast + =+ soy=~(. pa i.pax `(list action)`~ u.pur) :: nest-fails if not cast? ::x she needs read permissions to subscribe. ?. (pa-visible:soy her) (ra-evil %talk-no-story) @@ -516,7 +526,7 @@ =^ who +>.$ (ra-human her) ::x send current data to bring her up to date. =. soy (pa-report-cabal:soy ost.hid ~ ~) - ::=. soy (pa-report-group:soy ost.hid ~ ~) ::TODO reenable if pa-not=dif + =. soy (pa-report-group:soy ost.hid ~ ~) =. soy (pa-first-grams:soy her t.pax) ::x also adds new sub to followers ::x add her status to presence map. =. soy (pa-notify:soy her %hear who) @@ -524,7 +534,8 @@ pa-abet:soy :: ++ ra-welcome - ::x brings new reader up to date. susbcribes it to the specified story. + ::x brings new reader up to date. susbcribes it to the specified story, + ::TODO or shared ui state if no story was specified. :: |= {new/bone pax/path} =/ sor/knot @@ -753,6 +764,7 @@ ++ pa-cabal ::x add station's config to our remote config map. :: + ::TODO when do we care about ham? |= {cuz/station con/config ham/(map station config)} ^+ +> =+ old=mirrors diff --git a/sur/talk.hoon b/sur/talk.hoon index 9afef1c079..15d3ae5e4e 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -66,21 +66,18 @@ ++ register (pair atlas (map partner atlas)) :: ping me, ping srcs ++ shelf (map knot (pair posture cord)) :: ship shape ++ report :: talk update - $% :: relevant story is determined from wire: reader responsibility. - {$cabal cabal} :: config neighborhood - :: {$folder (list report)} :: multiple - {$grams (pair @ud (list telegram))} :: beginning thoughts + $% {$cabal cabal} :: config neighborhood + {$grams (pair @ud (list telegram))} :: thoughts {$group register} :: presence == :: ++ lowdown :: changed shared state - $% :: ui state - {$glyph (jug char (set partner))} :: new bindings - {$names (map ship (unit human))} :: new identities - :: story state - :: relevant story is determined from wire: reader responsibility. + $% :: story state :: {$confs (unit config) (map station (unit config))}:: changed configs {$precs register} :: changed presences {$grams (pair @ud (list telegram))} :: new grams + :: ui state :: + {$glyph (jug char (set partner))} :: new bindings + {$names (map ship (unit human))} :: new identities == :: ++ speech :: narrative action $% {$lan p/knot q/@t} :: local announce From 227f59f3db64ae0c4ea602e4e234b25f5a79d167 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 19 Apr 2017 11:33:00 +0200 Subject: [PATCH 073/303] Removed unimportant ~&. --- app/talk-agent.hoon | 15 ++++----------- app/talk-guardian.hoon | 11 +---------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 9f1e9ddf37..30dc2062cc 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -137,7 +137,7 @@ ?~ foc moz ?~ id.cli - ~& %no-sole + ~& %reader-no-sole moz ::x produce moves or sole-effects and moves. [[id.cli %diff %sole-effect u.foc] moz] @@ -201,7 +201,7 @@ ::x if possible, update sources. if we do, and we gain new ones, update ::x the prompt. (this is to remove the mailbox from the audience after ::x creating or joining a new station.) - ?~ coy ~&(%mailbox-deleted !!) + ?~ coy ~&(%mailbox-gone !!) =. +> ::TODO =? ?~ (~(dif in sources.u.coy) sources) +>.$ =< sh-abet @@ -270,15 +270,13 @@ |= act/sole-action ^+ +> ?. =(id.cli ost.hid) - ~& %strange-sole - !! + ~&(%strange-sole !!) sh-abet:(~(sh-sole sh cli (main our.hid)) act) :: ++ ra-console ::x make a shell for her. :: |= {her/ship pax/path} - ~& [%ra-console her pax ost.hid] ^+ +> ::x get story from the path, default to standard mailbox. =/ man/knot @@ -293,7 +291,6 @@ ++ ra-init ::x populate state on first boot. subscribes to our broker. :: - ~& [%r-ra-init ost.hid] %- ra-emit :* ost.hid %peer @@ -566,7 +563,6 @@ [['[' ']'] active.she] =+ cha=(~(get by nik) q.rew) ?^ cha ~[u.cha ' '] - :: ~& [rew nik nak] =+ por=~(te-prom te man q.rew) (weld `tape`[p.p.rew por] `tape`[q.p.rew ' ' ~]) :: @@ -1174,7 +1170,6 @@ ++ who :: %who |= pan/(set partner) ^+ ..sh-work ::TODO clever use of =< and . take note! - ~& [%who-ing pan] =< (sh-fact %mor (murn (sort (~(tap by remotes) ~) aor) .)) |= {pon/partner alt/atlas} ^- (unit sole-effect) ?. |(=(~ pan) (~(has in pan) pon)) ~ @@ -1331,9 +1326,9 @@ (add fin (sub max (mod max dog))) :: ++ probe :: inquire + ::TODO? what's this? unused... |= cuz/station ^+ ..sh-work - ::TODO? what's this? ~& [%probe cuz] ..sh-work :: @@ -1808,7 +1803,6 @@ ::x incoming subscription on pax. :: |= pax/path - ~& [%r-peer pax ost.hid src.hid] ^- (quip move +>) ?. (team src.hid our.hid) ~& [%peer-talk-reader-stranger src.hid] @@ -1816,7 +1810,6 @@ ?. ?=({$sole *} pax) ~& [%peer-talk-reader-strange pax] [~ +>] - ~& [%r-peer-sole ost.hid] ra-abet:(ra-console:ra src.hid t.pax) :: ++ diff-talk-lowdown diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 404bc84038..7ef15adcf8 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -155,7 +155,6 @@ ++ ra-init :: initialize talk ::x populate state on first boot. creates our main and public stories. :: - ~& %ra-init %+ roll ^- (list {posture knot cord}) :~ [%brown (main our.hid) 'default home'] @@ -713,12 +712,10 @@ ::x sends report to all bones. :: |= {wac/(set bone) caw/report} - :: ~& [%pa-report man -.caw] ^+ +> ?~ wac +> =. +> $(wac l.wac) =. +> $(wac r.wac) - :: ~& [%pa-report-cabal man shape] (pa-sauce n.wac [%diff %talk-report caw]~) :: ++ pa-inform @@ -820,8 +817,7 @@ $| ~& tweet-abjure+p.p.tay !! :: - $& ~& [%pa-abjure /[man]/(scot %p p.p.tay)/[q.p.tay]] - :_ ~ + $& :_ ~ :* %pull /friend/show/[man]/(scot %p p.p.tay)/[q.p.tay] [p.p.tay %talk-guardian] @@ -878,7 +874,6 @@ ++ pa-cancel :: unsubscribe from ::x deletes the current ost.hid from all follower groups. :: - :: ~& [%pa-cancel ost.hid] .(followers (~(del by followers) ost.hid)) :: ++ pa-notify :: local presence @@ -961,7 +956,6 @@ ?. ?=({{?($ud $da) @} {?($ud $da) @} $~} paf) ~ `[[?+(- . $ud .)]:i.paf [?+(- . $ud .)]:i.t.paf] ::XX arvo issue #366 - :: ~& [%pa-first-grams her pax ruv] ?~ ruv ~& [%pa-first-grams-malformed pax] (pa-sauce ost.hid [%quit ~]~) @@ -980,7 +974,6 @@ =+ ^= moy |- ^- (pair (list bone) (list move)) ?~ followers [~ ~] - :: ~& [%pa-refresh num n.followers] =+ lef=$(followers l.followers) =+ rit=$(followers r.followers) =+ old=[p=(welp p.lef p.rit) q=(welp q.lef q.rit)] @@ -1126,7 +1119,6 @@ :: |= cod/command ^+ [*(list move) +>] - :: ~& [%talk-poke-command src.hid cod] =^ mos +>.$ ra-abet:(ra-apply:ra src.hid cod) =^ mow +>.$ log-all-to-file @@ -1212,7 +1204,6 @@ :: |= pax/path ^+ [*(list move) +>] - :: ~& [%talk-pull src.hid ost.hid pax] ra-abet:(ra-cancel:ra src.hid pax) :: ++ log-all-to-file From a08d4908528b52104f7b5f8867f7449dedd10399 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 20 Apr 2017 23:59:36 +0200 Subject: [PATCH 074/303] Significant cleanup of talk-guardian. Renamed some arms and faces to be more obvious, refactored some code to be more clear, reorganized arms and updated inline documentation. --- app/talk-guardian.hoon | 2231 ++++++++++++++++++++++------------------ 1 file changed, 1256 insertions(+), 975 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 7ef15adcf8..92433c3b3c 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -3,14 +3,10 @@ :: :: :: :: ::TODO master changes -::TODO =/ instead of =+ ^= where possible ::TODO avoid lark where possible -::TODO remove old/unused code -::TODO improve naming. way->wir, rad->rep, etc. -::TODO tidiness, remove unnecessary ~&, etc. -::TODO maybe ensure every arm has a mini-description at :57 too? -::TODO maybe prefix all printfs and other errors with %talk? -::TODO rename cores. ra->ta (transaction), pa->to (story). +::TODO think about what printfs we want to keep for the user to see. +::TODO document what user-facing printfs actually mean! +::TODO ::> to :> etc. :: ::TODO we can't do away with the default mailbox because we need it for things :: like invite notifications etc. can we do better than request that apps @@ -25,60 +21,60 @@ ::TODO permission checks should only use team if it's coming from a reader. ::TODO for story permission checks, count moons as their parent identity. ::TODO crash on pokes/peers we do not expect +::TODO keep both a folks and nicks maps. (actual profiles and local nicknames.) :: -/? 310 :: hoon version -/- talk, sole :: structures -/+ talk, sole, time-to-id, twitter :: libraries +/? 310 ::< hoon version +/- talk ::< structures +/+ talk, time-to-id, twitter ::< libraries /= seed /~ !>(.) !: -:: :::: :: -::x include talk and sole cores from the /+ include into our subject, -::x so we can do some-arm instead of some-arm:talk. -[. talk sole] -=> |% :: data structures - ++ house :: broker state - $: stories/(map knot story) :: conversations - ::TODO rename to readers? - general/(map bone (set knot)) :: our message readers - outbox/(pair @ud (map @ud thought)) :: urbit outbox - log/(map knot @ud) :: logged to clay - folks/(map ship human) :: human identities - nik/(map (set partner) char) :: bound station glyphs - nak/(jug char (set partner)) :: station glyph lookup +[. talk] +=> ::> || + ::> || %arch + ::> || + ::> data structures + :: + |% + ++ house ::> broker state + $: stories/(map knot story) ::< conversations + readers/(map bone (set knot)) ::< our message readers + outbox/(pair @ud (map @ud thought)) ::< urbit outbox + log/(map knot @ud) ::< logged to clay + folks/(map ship human) ::< human identities + nik/(map (set partner) char) ::< bound station glyphs + nak/(jug char (set partner)) ::< station glyph lookup == :: - ++ story :: wire content - $: count/@ud :: (lent grams) - grams/(list telegram) :: all history - locals/atlas :: local presence - remotes/(map partner atlas) :: remote presence - shape/config :: configuration - mirrors/(map station config) :: remote config + ++ story ::> wire content + $: count/@ud ::< (lent grams) + grams/(list telegram) ::< all messages + locals/atlas ::< local presence + remotes/(map partner atlas) ::< remote presence + shape/config ::< configuration + mirrors/(map station config) ::< remote config ::TODO never gets updated. :: - :: should probably just be @ud, per story? - sequence/(map partner @ud) :: partners heard - known/(map serial @ud) :: messages heard - followers/(map bone river) :: subscribers + sequence/(map partner @ud) ::< partners heard + known/(map serial @ud) ::< messages heard + followers/(map bone river) ::< subscribers == :: - ++ river (pair point point) :: stream definition - ++ point :: stream endpoint - $% {$ud p/@ud} :: by number - {$da p/@da} :: by date + ++ river (pair point point) ::< stream definition + ++ point ::> stream endpoint + $% {$ud p/@ud} ::< by number + {$da p/@da} ::< by date == :: - ++ move (pair bone card) :: all actions - ++ lime :: diff fruit + ++ move (pair bone card) ::< all actions + ++ lime ::> diff fruit $% {$talk-report report} :: {$talk-lowdown lowdown} :: {$talk-reaction reaction} :: - {$sole-effect sole-effect} :: == :: - ++ pear :: poke fruit + ++ pear ::> poke fruit $% {$talk-command command} :: {$write-comment spur ship cord} :: {$write-fora-post spur ship cord cord} :: == :: - ++ card :: general card + ++ card ::> general card $% {$diff lime} :: {$info wire @p @tas nori} :: {$peer wire dock path} :: @@ -86,472 +82,431 @@ {$pull wire dock $~} :: {$quit $~} :: == :: - ++ weir :: parsed wire - $% {$repeat p/@ud q/@p r/knot} :: - {$friend p/knot q/station} :: + ++ weir ::> parsed wire + $% {$repeat p/@ud q/@p r/knot} ::< messaging wire + {$friend p/knot q/station} ::< subscription wire == :: - ++ strap |*({k/* v/*} (~(put by *(map _k _v)) k v)) -- :: -|_ {hid/bowl house} +::> || +::> || %work +::> || +::> functional cores and arms. :: -++ ra :: per transaction - ::x gets called when talk gets poked or otherwise prompted/needs to perform - ::x an action. - ::x arms generally modify state, and store moves in ++ra's moves. these get - ::x produced when calling ++ra-abet. - ::x in applying commands and making reports, it uses ++pa for story work. +|_ {bol/bowl house} +:: +++ prep ::< prepare state + ::x adapts state. :: - ::x moves: moves storage, added to by ++ra-emit and -emil, produced by -abed. - |_ moves/(list move) + |= old/(unit house) + ^- (quip move ..prep) + ?~ old + ta-done:ta-init:ta + [~ ..prep(+<+ u.old)] +:: +::> || +::> || %utility +::> || +::> small utility functions. +::+| +:: +++ strap |*({k/* v/*} (~(put by *(map _k _v)) k v)) ::< map key-value pair +:: +::> || +::> || %engines +::> || +::> main cores. +::+| +:: +++ ta ::< per transaction + ::> for every transaction/event (poke, peer, etc.) + ::> talk-guardian receives, the ++ta transaction core + ::> is called. + ::> in processing transactions, ++ta may modify app + ::> state, or create moves. these moves get produced + ::> upon finalizing the core's work with ++ta-done. + ::> when making changes to stories, the ++so core is + ::> used. :: - ++ ra-abet :: resolve core - ::x produces the moves stored in ++ra's moves. - ::x sole-effects get special treatment to become a single move. - ::TODO this shouldn't ever make sole-effects anymore, so remove that logic. - ::TODO instead, we want to squash lowdown %names and %glyphs, - :: but figure out if that'll ever be needed first. + |_ ::> moves: moves created by core operations. + :: + moves/(list move) + :: + ++ ta-done ::< resolve core + ::> produces the moves stored in ++ta's moves. + ::> they are produced in reverse order because + ::> ++ta-emil and ++ta-emit add them to the head of + ::> the {moves}. + ::TODO maybe squash lowdown %names and %glyphs into single moves. :: - ^+ [*(list move) +>] - :_ +> - ::x seperate our sole-effects from other moves. - =+ ^= yop - |- ^- (pair (list move) (list sole-effect)) - ?~ moves [~ ~] - =+ mor=$(moves t.moves) - ?: ?& =(ost.hid p.i.moves) - ?=({$diff $sole-effect *} q.i.moves) - == - [p.mor [+>.q.i.moves q.mor]] - [[i.moves p.mor] q.mor] - ::x flop moves, flop and squash sole-effects into a %mor. - =+ :* moz=(flop p.yop) - ^= foc ^- (unit sole-effect) - ?~ q.yop ~ - ?~(t.q.yop `i.q.yop `[%mor (flop `(list sole-effect)`q.yop)]) - == - ::x produce moves or sole-effects and moves. - ?~(foc moz [[ost.hid %diff %sole-effect u.foc] moz]) + ^- (quip move +>) + [(flop moves) +>] :: - ++ ra-emil :: ra-emit move list - ::x adds multiple moves to the core's list. flops to emulate ++ra-emit. + ::> || + ::> || %emitters + ::> || + ::> arms that create outward changes. + ::+| + :: + ++ ta-emil ::< emit move list + ::> adds multiple moves to the head of {moves}. + ::> flops to stay consistent with ++ta-emit. :: |= mol/(list move) %_(+> moves (welp (flop mol) moves)) :: - ++ ra-emit :: emit a move - ::x adds a move to the core's list. + ++ ta-emit ::< emit a move + ::> adds a move to the head of {moves}. :: |= mov/move %_(+> moves [mov moves]) :: - ++ ra-evil :: emit error - ::x stack trace and crash. - :: - |= msg/cord - ~| [%ra-evil msg] - !! - :: - ++ ra-init :: initialize talk - ::x populate state on first boot. creates our main and public stories. - :: - %+ roll - ^- (list {posture knot cord}) - :~ [%brown (main our.hid) 'default home'] - [%green ~.public 'visible activity'] - == - |: [[typ=*posture man=*knot des=*cord] ..ra-init] ^+ ..ra-init - %+ ra-action ost.hid - [%create man des typ] - :: - ++ ra-apply :: apply command - ::x applies the command sent by her. - :: - |= {her/ship cod/command} - ^+ +> - ?- -.cod - ::x used for relaying messages (as a station host). - $review (ra-think | her +.cod) - == - :: - ++ ra-inform ::x new lowdown - ::x send talk-lowdown to all readers. + ++ ta-inform ::< broadcast lowdown + ::> sends a talk-lowdown diff to all readers. :: |= low/lowdown - %- ra-emil - %- ~(rep by general) + %- ta-emil + %- ~(rep by readers) |= {{b/bone *} l/(list move)} [[b %diff %talk-lowdown low] l] :: - ++ ra-react - ::x send a talk-reaction to a reader. + ++ ta-react ::< send reaction + ::> sends a talk-reaction diff to a reader. :: |= {red/bone rac/reaction} - %- ra-emit + %- ta-emit [red %diff %talk-reaction rac] :: - ++ ra-action - ::x peforms action sent by a reader. + ++ ta-evil ::< emit error + ::> tracing printf and crash. + :: + |= msg/cord + ~| [%talk-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. + :: + |= nom/knot + |* fun/$-(_so _+>) + ^+ +>+> + =+ pur=(~(get by stories) nom) + ?~ pur + ~& [%talk-ta-know-not nom] :: XX should crash + +>+>.$ + (fun ~(. so nom ~ u.pur)) + :: + ++ ta-human ::< look up person + ::> get {her} identity. if we need to, create one. + :: + |= her/ship + ^- (quid human +>) + =^ who folks + =+ who=(~(get by folks) her) + ?^ who [u.who folks] + =+ who=`human`[~ `(scot %p her)] :: XX do right + [who (~(put by folks) her who)] + [who +>.$] + :: + ::> || + ::> || %interaction-events + ::> || + ::> arms that apply events we received. + ::+| + :: + ++ ta-init ::< initialize app + ::> populate state on first boot. + ::> creates our default mailbox and journal. + :: + %+ roll + ^- (list {posture knot cord}) + :~ [%brown (main our.bol) 'default home'] + [%green ~.public 'visible activity'] + == + |= {{typ/posture nom/knot des/cord} _ta} + %+ ta-action ost.bol + [%create nom des typ] + :: + ++ ta-apply ::< apply command + ::> applies the command sent by {src}. + :: + |= {src/ship cod/command} + ^+ +> + ?- -.cod + ::> %review commands prompt us (as a station host) + ::> to verify and distribute messages. + $review + (ta-think | src +.cod) + == + :: + ++ ta-action ::< apply reader action + ::> performs action sent by a reader. :: |= {red/bone act/action} ^+ +> - ?- -.act + =< work + ::> || + ::> || %actions + ::> || + ::> action processing core + ::> + ::> ++work calls the appropriate action processing + ::> arm. most use ++affect to retrieve the affected + ::> story, reacting if it doesn't exist. + |% + :: || %utility + ::+| + ++ work ::< perform action + ^+ ..ta-action + ?- -.act + :: station configuration + $create (action-create +.act) + $source (action-source +.act) + $depict (action-depict +.act) + $permit (action-permit +.act) + $delete (action-delete +.act) + :: messaging + $convey (action-convey +.act) + $phrase (action-phrase +.act) + :: personal metadata + $status (action-status +.act) + :: changing shared ui + $human (action-human +.act) + $glyph (action-glyph +.act) + == + :: + ++ affect ::< affect story + ::> produces a gill that takes a gate. + ::> if the story {nom} exists, calls the gate with + ::> a story core and the story itself. + ::> if it doesn't, reacts accordingly. :: - :: station configuration + |= nom/knot + |* fec/$-(_so _ta) + ^+ ta + =+ pur=(~(get by stories) nom) + ?^ pur + (fec ~(. so nom ~ u.pur) u.pur) + %+ ta-react red + [%fail (crip "no story {(trip nom)}") `act] + :: + ::> || %station-configuration + ::+| + ++ action-create ::< create story + ::> creates a story with the specified parameters. :: - $create :: create station - ?. (~(has in stories) p.act) - (ra-config p.act [[%& our.hid p.act] ~ ~] q.act [r.act ~]) - (ra-react red %fail (crip "{(trip p.act)}: already exists") `act) + |= {nom/knot des/cord typ/posture} + ^+ ..ta-action + ?. (~(has in stories) nom) + (ta-config nom [[%& our.bol nom] ~ ~] des [typ ~]) + (ta-react red %fail (crip "{(trip nom)}: already exists") `act) + :: + ++ action-source ::< un/sub p to/from r + ::> add/remove {pas} as sources for story {nom}. :: - $source :: un/sub p to/from r - %- (ra-affect p.act red `act) |= {par/_pa soy/story} + |= {nom/knot sub/? pas/(set partner)} + ^+ ..ta-action + %- (affect nom) |= {sor/_so soy/story} =. sources.shape.soy - %. r.act - ?: q.act + %. pas + ?: sub ~(uni in sources.shape.soy) ~(dif in sources.shape.soy) - (ra-config p.act shape.soy) + (ta-config nom shape.soy) + :: + ++ action-depict ::< change description + ::> change description of story {nom} to {des}. :: - $depict :: change description - %- (ra-affect p.act red `act) |= {par/_pa soy/story} - =. caption.shape.soy q.act - (ra-config p.act shape.soy) + |= {nom/knot des/cord} + ^+ ..ta-action + %- (affect nom) |= {sor/_so soy/story} + =. caption.shape.soy des + (ta-config nom shape.soy) + :: + ++ action-permit ::< invite/banish + ::> invite to/banish from story {nom} all {sis}. :: - $permit :: invite/banish - %- (ra-affect p.act red `act) |= {par/_pa *} =< pa-abet - (pa-permit:par q.act r.act) + |= {nom/knot inv/? sis/(set ship)} + ^+ ..ta-action + %- (affect nom) |= {sor/_so *} =< so-done + (so-permit:sor inv sis) + :: + ++ action-delete ::< delete + announce + ::> delete story {nom}, optionally announcing the + ::> event with message {mes}. :: - $delete :: delete + announce - %- (ra-affect p.act red `act) |= * - =. +>.^$ ::TODO =? - ?~ q.act +>.^$ - (ra-action red %phrase [[%& our.hid p.act] ~ ~] [%lin | u.q.act]~) - (ra-unconfig p.act) + |= {nom/knot mes/(unit cord)} + ^+ ..ta-action + %- (affect nom) |= * + =. ..ta-action ::TODO =? + ?~ mes ..ta-action + %+ action-phrase + [[%& our.bol nom] ~ ~] + [%lin | u.mes]~ + (ta-unconfig nom) + :: + ::> || %messaging + ::+| + ++ action-convey ::< post exact + ::> sends the messages provided in the action. :: - :: messaging + |= tos/(list thought) + ^+ ..ta-action + (ta-think & our.bol tos) + :: + ++ action-phrase ::< post easy + ::> sends the message contents provided in the + ::> action, constructing the audience, generating a + ::> serial and setting a timestamp. :: - $convey :: post exact - (ra-think & our.hid +.act) - :: - $phrase :: post easy - =- (ra-think & our.hid tos) + |= {pas/(set partner) ses/(list speech)} + ^+ ..ta-action + =- (ta-think & our.bol tos) |- ^- tos/(list thought) - ?~ q.act ~ - =^ sir eny.hid (uniq eny.hid) - :_ $(q.act t.q.act) + ?~ ses ~ + =^ sir eny.bol (uniq eny.bol) + :_ $(ses t.ses) :+ sir %- ~(gas by *audience) - %+ turn (~(tap in p.act)) + %+ turn (~(tap in pas)) |=(p/partner [p *envelope %pending]) - [now.hid ~ i.q.act] + [now.bol ~ i.ses] + :: + ::> || %personal-metadata + ::+| + ++ action-status ::< our status update + ::> for every story in the set, update our status. :: - :: personal metadata + |= {nos/(set knot) sat/status} + ^+ ..ta-action + %- ~(rep in nos) + |= {k/knot _ta} + %- (affect k) |= {sor/_so *} + so-done:(so-notify:sor our.bol sat) + :: + ::> || %changing-shared-ui + ::+| + ++ action-human ::< new identity + ::> assigns a new local identity ("nickname") to the + ::> target ship. :: - $status :: our status update - ::x for every knot (story) in the set, update our status. - |- ^+ +>.^$ - ?~ p.act +>.^$ - =. +>.^$ $(p.act l.p.act) - =. +>.^$ $(p.act r.p.act) - %- (ra-affect n.p.act red `act) |= {par/_pa *} =< pa-abet - (pa-notify:par our.hid q.act) - :: - :: changing shared ui - :: - $human :: new identity - ?. =((~(get by folks) p.act) `q.act) +> :: no change + |= {sip/ship nic/human} + ^+ ..ta-action + ?. =((~(get by folks) sip) `nic) ..ta-action ::< no change =. folks - ?~ hand.q.act (~(del by folks) p.act) - (~(put by folks) p.act q.act) - %+ ra-inform %names + ?~ hand.nic (~(del by folks) sip) + (~(put by folks) sip nic) + %+ ta-inform %names ::TODO think long and hard, do we need unit for delition or is a human :: with [~ ~] good enough? if the latter, agent's $names will change. - (strap p.act ?~(hand.q.act ~ `q.act)) + (strap sip ?~(hand.nic ~ `nic)) + :: + ++ action-glyph ::< bind a glyph + ::> un/bind glyph {lif} to partners {pas}. :: - $glyph :: bind a glyph - =. +>.$ - ?: r.act - %= +>.$ - nik (~(put by nik) q.act p.act) - nak (~(put ju nak) p.act q.act) + |= {lif/char pas/(set partner) bin/?} + =. ..ta-action + ?: bin + %= ..ta-action ::< bind + nik (~(put by nik) pas lif) + nak (~(put ju nak) lif pas) == - =/ ole/(set (set partner)) - ?. =(q.act ~) [q.act ~ ~] - (~(get ju nak) p.act) - |- ^+ +>.^$ - ?~ ole +>.^$ - =. +>.^$ $(ole l.ole) - =. +>.^$ $(ole r.ole) - %= +>.^$ - nik (~(del by nik) n.ole) - nak (~(del ju nak) p.act n.ole) + =/ ole/(set (set partner)) ::< unbind + ?. =(pas ~) [pas ~ ~] + (~(get ju nak) lif) + ::TODO want to replace these kinds of loops with + :: ++rep:in and ++roll, but doesn't seem to + :: work correctly? + |- ^+ ..ta-action + ?~ ole ..ta-action + =. ..ta-action $(ole l.ole) + =. ..ta-action $(ole r.ole) + %= ..ta-action + nik (~(del by nik) pas) + nak (~(del ju nak) lif pas) == - (ra-inform %glyph nak) - == + (ta-inform %glyph nak) + -- :: - ++ ra-config :: configure story - ::x (re)configures story man. if it's a new story, emit our stories. + ++ ta-diff-report ::< subscription update + ::> process a talk report from {sat} into story {nom}. :: - |= {man/knot con/config} - ^+ +> - =+ :- neu=!(~(has by stories) man) - pur=(fall (~(get by stories) man) *story) - :: wyt: will be white - =+ wyt=?=(?($white $green) p.cordon.con) - ::x if we just created the story, and invite only, make sure we're in. - =. q.cordon.con ::TODO =? - ?: &(neu wyt) [our.hid ~ ~] - q.cordon.con - pa-abet:(~(pa-reform pa man ~ pur) con) + |= {nom/knot sat/station ret/report} + %- (ta-know nom) |= sor/_so =< so-done + (so-diff-report:sor sat ret) :: - ++ ra-unconfig - |= man/knot - ^+ +> - =+ soy=(~(get by stories) man) - ?~ soy +>.$ - pa-abet:~(pa-reform-gone pa man ~ u.soy) + ::> || + ::> || %subscription-events + ::> || + ::> arms that react to subscription events. + ::+| :: - ++ ra-base-hart - ::x produces our ship's host desk's web address as a hart. - :: - .^(hart %e /(scot %p our.hid)/host/(scot %da now.hid)) - :: - ++ ra-fora-post - ::x sends a fora post. if we don't have a channel for posts yet, create one - :: - |= {pax/path sup/spur hed/@t txt/@t} - ::x tell %hood to submit a fora post. - =. ..ra-emit - %+ ra-emit ost.hid - :* %poke - /fora-post - [our.hid %hood] - [%write-fora-post sup src.hid hed txt] - == - =+ man=%posts - ::x if we have a %posts story, go ahead and consume. - ?: (~(has by stories) man) - (ra-consume-fora-post man pax hed txt) - ::x if we have no %posts story, first create it, then consume. - =; new (ra-consume-fora-post:new man pax hed txt) - =. ..ra-action - %+ ra-action ost.hid - [%create man 'towards a community' %brown] - ::x send informative message to our mailbox. - %^ ra-consume & our.hid - :^ (shaf %init eny.hid) ::x serial - (my [[%& our.hid (main our.hid)] *envelope %pending] ~) ::x audience - ::x statement - now.hid - [~ %app %tree 'receiving forum posts, ;join %posts for details'] - :: - ++ ra-consume-fora-post - ::x add a message for a fora post to the man story. - :: - |= {man/knot pax/path hed/@t txt/@t} ^+ +> - =. pax (welp pax /posts/(crip "{}~")) - %^ ra-consume | - src.hid - :* (shaf %comt eny.hid) - (my [[%& our.hid man] *envelope %pending] ~) - now.hid - (sy /fora-post eyre+pax ~) - :- %mor :~ - [%fat text+(lore txt) [%url [ra-base-hart `pax ~] ~]] - [%app %tree (crip "forum post: '{(trip hed)}'")] - == - == - :: - ++ ra-comment - ::x sends a comment. if we don't have a channel for them yet, creates one. - :: - |= {pax/path sup/spur txt/@t} - =. ..ra-emit - %+ ra-emit ost.hid - :* %poke - /comment - [our.hid %hood] - [%write-comment sup src.hid txt] - == - =+ man=%comments - ?: (~(has by stories) man) - (ra-consume-comment man pax sup txt) - =; new (ra-consume-comment:new man pax sup txt) - =. ..ra-action - %+ ra-action ost.hid - [%create man 'letters to the editor' %brown] - %^ ra-consume & our.hid - :^ (shaf %init eny.hid) - (my [[%& our.hid (main our.hid)] *envelope %pending] ~) - now.hid - [~ %app %tree 'receiving comments, ;join %comments for details'] - :: - ++ ra-consume-comment - ::x adds a message for a comment to the man story. - :: - |= {man/knot pax/path sup/spur txt/@t} ^+ +> - =+ nam=?~(sup "" (trip i.sup)) :: file name - =+ fra=(crip (time-to-id now.hid)) :: url fragment - %^ ra-consume | - src.hid - :* (shaf %comt eny.hid) - (my [[%& our.hid man] *envelope %pending] ~) - now.hid - (sy /comment eyre+pax ~) - :- %mor :~ - [%fat text+(lore txt) [%url [ra-base-hart `pax ~] `fra]] - [%app %tree (crip "comment on /{nam}")] - == - == - :: - ++ ra-know :: story monad - ::x produces a wet core that takes a gate that takes a story core and - ::x produces updated state. - :: - |= man/knot - |* fun/$-(_pa _+>) - ^+ +>+> - =+ pur=(~(get by stories) man) - ?~ pur - ~& [%ra-know-not man] :: XX should crash - +>+>.$ - ::x call the sample gate with a ++pa core. - (fun ~(. pa man ~ u.pur)) - :: - ++ ra-affect - ::x attempt to retrieve a story and call a sample gate with it. - ::x if no such story, react. - :: - |= {man/knot red/bone act/(unit action)} - |* fun/$-(_pa _+>) - ^+ +>+> - =+ pur=(~(get by stories) man) - ?~ pur - %+ ra-react red - [%fail (crip "no story {(trip man)}") act] - (fun ~(. pa man ~ u.pur) u.pur) - :: - ++ ra-diff-talk-report :: subscription update - ::x process a talk report from cuz into story man. - :: - |= {man/knot cuz/station rad/report} - %- (ra-know man) |= par/_pa =< pa-abet - (pa-diff-talk-report:par cuz rad) - :: - ++ ra-quit :: subscription quit - ::x removes cuz from the subscribers of story man. - :: - |= {man/knot cuz/station} - %- (ra-know man) |= par/_pa =< pa-abet - (pa-quit:par %& cuz) - :: - ++ ra-retry :: subscription resend - ::x produce a %peer/subscribe move for cuz to story man. - :: - |= {man/knot cuz/station} - %- (ra-know man) |= par/_pa =< pa-abet - (pa-acquire:par [%& cuz]~) - :: - ++ ra-coup-repeat :: - ::x assemble partner and call ++ra-repeat. - :: - |= {{num/@ud her/@p man/knot} saw/(unit tang)} - (ra-repeat num [%& her man] saw) - :: - ++ ra-repeat :: remove from outbox - ::x take message out of outbox, mark it as received or rejected. - ::x crashes if pan is not in message's audience. - :: - |= {num/@ud pan/partner saw/(unit tang)} - =+ oot=(~(get by q.outbox) num) - ?~ oot ~|([%ra-repeat-none num] !!) - =. q.outbox (~(del by q.outbox) num) - =. q.u.oot - =+ olg=(~(got by q.u.oot) pan) - %+ ~(put by q.u.oot) pan - :- -.olg - ?~ saw %received - ~> %slog.[0 u.saw] - %rejected - (ra-think | our.hid u.oot ~) - :: - ++ ra-cancel :: drop a bone - ::x removes a bone from the story in pax. - :: - |= {src/ship pax/path} - ^+ +> - ?. ?=({@ @ *} pax) - ::x if story is not in path, just delete the bone from general. - +>(general (~(del by general) ost.hid)) - %- (ra-know i.pax) |= par/_pa =< pa-abet - ::x delete bone from all follower groups and set src's status to %gone. - (pa-notify:pa-cancel:par src %gone *human) - :: - ++ ra-human :: look up person - ::x get her identity. if she has none, make her one. - :: - |= her/ship - ^- {human _+>} - =^ who folks - =+ who=(~(get by folks) her) - ?^ who [u.who folks] - =+ who=`human`[~ `(scot %p her)] :: XX do right - [who (~(put by folks) her who)] - [who +>.$] - :: - ++ ra-subscribe :: listen to - ::x subscribe her at pax. + ++ ta-subscribe ::< listen to + ::> start {her} susbcription on {pax}. + ::> for readers, we forward to ++ta-welcome. + ::> for foreign brokers, we check if their desired + ::> story exists and if they have permission to + ::> subscribe to it, before sending them all data. :: |= {her/ship pax/path} ^+ +> - ::x empty path, meta-subscribe and send report with all our stories. + :: reader subscription. ?: ?=({$reader *} pax) - ?. (team our.hid her) - ~& [%foreign-reader her] + ?. (team our.bol her) + ~& [%talk-foreign-reader her] +> - (ra-welcome ost.hid t.pax) + (ta-welcome ost.bol t.pax) + :: weird subscription path. ?. ?=({@ *} pax) - (ra-evil %talk-bad-path) + (ta-evil %bad-path) =+ pur=(~(get by stories) i.pax) ?~ pur - ~& [%bad-subscribe-story-c i.pax] - (ra-evil %talk-no-story) - =+ soy=~(. pa i.pax `(list action)`~ u.pur) :: nest-fails if not cast? - ::x she needs read permissions to subscribe. - ?. (pa-visible:soy her) - (ra-evil %talk-no-story) - ::TODO? or (pa-sauce ost.hid [%quit ~]~) ? - =^ who +>.$ (ra-human her) - ::x send current data to bring her up to date. - =. soy (pa-report-cabal:soy ost.hid ~ ~) - =. soy (pa-report-group:soy ost.hid ~ ~) - =. soy (pa-first-grams:soy her t.pax) ::x also adds new sub to followers - ::x add her status to presence map. - =. soy (pa-notify:soy her %hear who) - ::x apply changes to story. - pa-abet:soy + ~& [%talk-bad-subscribe-story i.pax] + (ta-evil %no-story) + =+ soy=~(. so i.pax `(list action)`~ u.pur) :: nest-fail if no cast + :: she needs read permissions to subscribe. + ?. (so-visible:soy her) + (ta-evil %no-story) + ::TODO? or (so-sauce ost.bol [%quit ~]~) ? + =^ who +>.$ (ta-human her) + :: send current data to bring her up to date. + =. soy (so-report-cabal:soy ost.bol ~ ~) + =. soy (so-report-group:soy ost.bol ~ ~) + =. soy (so-start:soy her t.pax) ::< also adds story sub + =. soy (so-notify:soy her %hear who) ::< add her status + so-done:soy ::< apply story changes :: - ++ ra-welcome - ::x brings new reader up to date. susbcribes it to the specified story, + ++ ta-welcome ::< reader subscription + ::> brings new reader up to date. susbcribes it to the specified story, ::TODO or shared ui state if no story was specified. + ::TODO maybe also send a list of knots again? (basically a %house lowdown) :: |= {new/bone pax/path} =/ sor/knot ?: ?=({@tas *} pax) i.pax - (main our.hid) :: default to mailbox + (main our.bol) :: default to mailbox + ::> new reader? send shared ui state. =. +>.$ ::TODO =? - ?: (~(has by general) new) +>.$ - %- ra-emil + ?: (~(has by readers) new) +>.$ + %- ta-emil :~ ::x bound glyphs [new %diff %talk-lowdown %glyph nak] ::x nicknames [new %diff %talk-lowdown %names (~(run by folks) some)] == + ::> send story state. =. +>.$ ::TODO =? ?. (~(has by stories) sor) +>.$ =+ soy=(~(got by stories) sor) - %- ra-emil + %- ta-emil :~ ::x configurations :* new %diff %talk-lowdown %confs `shape.soy (~(run by mirrors.soy) some) @@ -561,32 +516,174 @@ ::x messages [new %diff %talk-lowdown %grams 0 grams.soy] == + ::> add this subscription to {readers}. %= +>.$ - general - %+ ~(put by general) new - (~(put in (fall (~(get by general) new) ~)) sor) + readers + %+ ~(put by readers) new + (~(put in (fall (~(get by readers) new) ~)) sor) == :: - ++ ra-think :: publish+review - ::x consumes each thought. + ++ ta-retry ::< subscription resend + ::> re-subscribes {sat} to story {nom}. :: - |= {pub/? her/ship tiz/(list thought)} - ^+ +> - ?~ tiz +> - $(tiz t.tiz, +> (ra-consume pub her i.tiz)) + |= {nom/knot sat/station} + %- (ta-know nom) |= sor/_so =< so-done + (so-acquire:sor [%& sat]~) :: - ++ ra-normal :: normalize - ::x sanitize %lin speech, enforce lowercase and no special characters. + ++ ta-quit ::< subscription failed + ::> removes {sat} from story {nom}'s followers. :: - |= tip/thought + |= {nom/knot sat/station} + %- (ta-know nom) |= sor/_so =< so-done + (so-quit:sor %& sat) + :: + ++ ta-cancel ::< unsubscribe + ::> drops {src}'s subscription. deduce the right way + ::> to do this from the subscription path {pax}. + :: + |= {src/ship pax/path} + ^+ +> + :: remove a reader subscription. + ?: ?=({$reader *} pax) + =/ nom/knot + ?: ?=({@tas *} t.pax) i.pax + (main our.bol) ::TODO change when ++ta-welcome changes. + =/ nes/(set knot) + %. nom + ~(del in (~(got by readers) ost.bol)) + +>.$(readers (~(put by readers) ost.bol nes)) + :: weird subscription path. + ?. ?=({@ @ *} pax) + ~&([%talk-ta-cancel-weird-path pax] +>) + :: remove a regular subscription, set ship status to %gone. + %- (ta-know i.pax) |= sor/_so =< so-done + (so-notify:so-cancel:sor src %gone *human) + :: + ::> || %fora + ::> fora things. + ::TODO move outside of guardian... + ::+| + :: + ++ ta-base-hart + ::x produces our ship's host desk's web address as a hart. + :: + .^(hart %e /(scot %p our.bol)/host/(scot %da now.bol)) + :: + ++ ta-fora-post + ::x sends a fora post. if we don't have a channel for posts yet, create one + :: + |= {pax/path sup/spur hed/@t txt/@t} + ::x tell %hood to submit a fora post. + =. ..ta-emit + %+ ta-emit ost.bol + :* %poke + /fora-post + [our.bol %hood] + [%write-fora-post sup src.bol hed txt] + == + =+ man=%posts + ::x if we have a %posts story, go ahead and consume. + ?: (~(has by stories) man) + (ta-consume-fora-post man pax hed txt) + ::x if we have no %posts story, first create it, then consume. + =; new (ta-consume-fora-post:new man pax hed txt) + =. ..ta-action + %+ ta-action ost.bol + [%create man 'towards a community' %brown] + ::x send informative message to our mailbox. + %^ ta-consume & our.bol + :^ (shaf %init eny.bol) ::< serial + (my [[%& our.bol (main our.bol)] *envelope %pending] ~) ::< audience + ::> statement + now.bol + [~ %app %tree 'receiving forum posts, ;join %posts for details'] + :: + ++ ta-consume-fora-post + ::x add a message for a fora post to the man story. + :: + |= {man/knot pax/path hed/@t txt/@t} ^+ +> + =. pax (welp pax /posts/(crip "{}~")) + %^ ta-consume | + src.bol + :* (shaf %comt eny.bol) + (my [[%& our.bol man] *envelope %pending] ~) + now.bol + (sy /fora-post eyre+pax ~) + :- %mor :~ + [%fat text+(lore txt) [%url [ta-base-hart `pax ~] ~]] + [%app %tree (crip "forum post: '{(trip hed)}'")] + == + == + :: + ++ ta-comment + ::x sends a comment. if we don't have a channel for them yet, creates one. + :: + |= {pax/path sup/spur txt/@t} + =. ..ta-emit + %+ ta-emit ost.bol + :* %poke + /comment + [our.bol %hood] + [%write-comment sup src.bol txt] + == + =+ man=%comments + ?: (~(has by stories) man) + (ta-consume-comment man pax sup txt) + =; new (ta-consume-comment:new man pax sup txt) + =. ..ta-action + %+ ta-action ost.bol + [%create man 'letters to the editor' %brown] + %^ ta-consume & our.bol + :^ (shaf %init eny.bol) + (my [[%& our.bol (main our.bol)] *envelope %pending] ~) + now.bol + [~ %app %tree 'receiving comments, ;join %comments for details'] + :: + ++ ta-consume-comment + ::x adds a message for a comment to the man story. + :: + |= {man/knot pax/path sup/spur txt/@t} ^+ +> + =+ nam=?~(sup "" (trip i.sup)) :: file name + =+ fra=(crip (time-to-id now.bol)) :: url fragment + %^ ta-consume | + src.bol + :* (shaf %comt eny.bol) + (my [[%& our.bol man] *envelope %pending] ~) + now.bol + (sy /comment eyre+pax ~) + :- %mor :~ + [%fat text+(lore txt) [%url [ta-base-hart `pax ~] `fra]] + [%app %tree (crip "comment on /{nam}")] + == + == + :: + ::> || + ::> || %messaging + ::> || + ::> arms for sending and processing messages. + ::+| + :: + ++ ta-think ::< publish or review + ::> consumes each thought. + :: + |= {pub/? aut/ship tos/(list thought)} + ^+ +> + ?~ tos +> + $(tos t.tos, +> (ta-consume pub aut i.tos)) + :: + ++ ta-sane ::< sanitize + ::> sanitize %lin speech, enforce lowercase and no special characters. + ::TODO make configurable per-station. + :: + |= tot/thought ^- thought - ?. ?=({$lin *} r.r.tip) tip - %_ tip + ?. ?=({$lin *} r.r.tot) tot + %_ tot q.r.r %- crip %+ scag 64 %- tufa - %+ turn (tuba (trip q.r.r.tip)) + %+ turn (tuba (trip q.r.r.tot)) |= a/@c ?: &((gte a 'A') (lte a 'Z')) (add a 32) @@ -595,208 +692,147 @@ a == :: - ++ ra-consume :: consume thought - ::x if pub is true, sends the thought to each partner in the audience. - ::x if false, updates the thought in our store. + ++ ta-consume ::< consume thought + ::> conducts thought {tot} to each partner in its audience. :: - |= {pub/? her/ship tip/thought} - =. tip (ra-normal tip) - =+ aud=(~(tap by q.tip) ~) ::x why ~ ? + |= {pub/? aut/ship tot/thought} + =. tot (ta-sane tot) + =+ aud=(~(tap by q.tot)) |- ^+ +>.^$ ?~ aud +>.^$ - $(aud t.aud, +>.^$ (ra-conduct pub her p.i.aud tip)) + $(aud t.aud, +>.^$ (ta-conduct pub aut p.i.aud tot)) :: - ++ ra-conduct :: thought to partner - ::x record a message or sends it. + ++ ta-conduct :: thought to partner + ::> either publishes or records a thought. :: - |= {pub/? her/ship tay/partner tip/thought} + |= {pub/? aut/ship pan/partner tot/thought} ^+ +> - ?- -.tay - $& ?: pub - =. her our.hid :: XX security! - ?: =(her p.p.tay) - (ra-record q.p.tay p.p.tay tip) - (ra-transmit p.tay tip) - ?. =(our.hid p.p.tay) - +> - (ra-record q.p.tay her tip) - $| !! + ?- -.pan + $& ::< station partner + ?: pub + ?. (team our.bol aut) + ~&([%talk-strange-author aut] +>) + =. aut our.bol + ?: =(aut p.p.pan) + (ta-record q.p.pan p.p.pan tot) + (ta-transmit p.pan tot) + ?. =(our.bol p.p.pan) +> + (ta-record q.p.pan aut tot) + :: + $| !! ::< passport partner == :: - ++ ra-record :: add to story - ::x add or update a telegram in story man. + ++ ta-record ::< add to story + ::> add or update telegram {gam} in story {nom}. :: - |= {man/knot gam/telegram} - %- (ra-know man) |= par/_pa =< pa-abet - (pa-learn:par gam) + |= {nom/knot gam/telegram} + %- (ta-know nom) |= sor/_so =< so-done + (so-learn:sor gam) :: - ++ ra-transmit :: send to neighbor - ::x sends a thought to a station, adds it to the outbox. + ++ ta-transmit ::< send message + ::> sends thought {tot} to {sat}. + ::> stores it to the outbox to await confirmation. :: - |= {cuz/station tip/thought} + |= {sat/station tot/thought} ^+ +> =. +> - %+ ra-emit ost.hid + %+ ta-emit ost.bol :* %poke - /repeat/(scot %ud p.outbox)/(scot %p p.cuz)/[q.cuz] - [p.cuz %talk-guardian] - [%talk-command `command`[%review tip ~]] + /repeat/(scot %ud p.outbox)/(scot %p p.sat)/[q.sat] + [p.sat %talk-guardian] + [%talk-command [%review tot ~]] == - +>(p.outbox +(p.outbox), q.outbox (~(put by q.outbox) p.outbox tip)) + +>(p.outbox +(p.outbox), q.outbox (~(put by q.outbox) p.outbox tot)) :: - ++ pa :: story core - ::x story core, used for doing work on a story. - ::x as always, an -abet arms is used for applying changes to the state. - ::x ++pa-watch- arms get called by ++ra-subscribe to add a subscriber. - ::x bones are used to identify subscribers (source event identifiers). + ++ ta-coup-repeat ::< remove from outbox + ::> assemble partner and call ++ta-repeat. :: - |_ ::x man: the knot identifying the story in stories. - ::x acs: talk actions issued due to changes. - ::x story doesn't get a face because ease of use. + |= {{num/@ud src/ship nom/knot} fal/(unit tang)} + (ta-repeat num [%& src nom] fal) + :: + ++ ta-repeat ::< remove from outbox + ::> take message out of outbox, mark it as received + ::> or rejected, based on the existence of error + ::> message {fal}. + :: + |= {num/@ud pan/partner fal/(unit tang)} + =+ oot=(~(get by q.outbox) num) + ?~ oot ~|([%ta-repeat-none num] !!) + =. q.outbox (~(del by q.outbox) num) + =. q.u.oot + =+ olg=(~(got by q.u.oot) pan) + %+ ~(put by q.u.oot) pan + :- -.olg + ?~ fal %received + ~> %slog.[0 u.fal] + %rejected + (ta-think | our.bol u.oot ~) + :: + ::> || + ::> || %stories + ::> || + ::> arms for modifying stories. + ::+| + :: + ++ ta-config ::< configure story + ::> configures story {nom}, creating it if needed. + ::> if it's a whitelist config, and we're creating + ::> the story, makes sure we're in it. + :: + |= {nom/knot con/config} + ^+ +> + ::> neu: is new story + ::> pur: the story + ::> wyt: will be white + =+ :+ neu=!(~(has by stories) nom) + pur=(fall (~(get by stories) nom) *story) + wyt=?=(?($white $green) p.cordon.con) + =. q.cordon.con ::TODO =? + ?: &(neu wyt) [our.bol ~ ~] + q.cordon.con + so-done:(~(so-reform so nom ~ pur) con) + :: + ++ ta-unconfig ::< delete story + ::> calls the story core to delete story {nom}. + :: + |= nom/knot + ^+ +> + =+ soy=(~(get by stories) nom) + ?~ soy +>.$ + so-done:~(so-reform-gone so nom ~ u.soy) + :: + ++ so ::< story core + ::> story core, used for doing work on a story. + :: + |_ ::> nom: story name in {stories}. + ::> acs: talk actions issued due to changes. + ::> story is faceless to ease data access. :: - $: man/knot + $: nom/knot acs/(list action) story == - ++ pa-abet - ::x apply/fold changes back into the stories map. + :: + ++ so-done ::< apply changes + ::> put changed story back into the map and apply + ::> actions. :: ^+ +> - =. +> +>(stories (~(put by stories) man `story`+<+>)) + =. +> +>(stories (~(put by stories) nom +<+>)) =. acs (flop acs) |- ^+ +>+ ?~ acs +>+ - =. +>+ (ra-action ost.hid i.acs) + =. +>+ (ta-action ost.bol i.acs) $(acs t.acs) :: - ++ pa-act - ::x stores a talk action. - :: - |= act/action - ^+ +> - +>(acs [act acs]) + ::> || + ::> || %emitters + ::> || + ::> arms that create outward changes. + ::+| :: - ++ pa-followers - ^- (set bone) - %- ~(gas in *(set bone)) - %+ turn (~(tap by followers)) - |= {b/bone *} b - :: - ++ pa-admire :: accept from - ::x should be checking her write permissions, but defaults to allowed. - ::x commented code seems to use an older control structure. - ::x? this seems like an easy fix, why was this ever disabled? - :: - |= her/ship - ^- ? - ?- p.cordon.shape - $black !(~(has in q.cordon.shape) her) ::x channel, blacklist - $green (~(has in q.cordon.shape) her) ::x journal, whitelist - $brown !(~(has in q.cordon.shape) her) ::x mailbox, blacklist - $white (~(has in q.cordon.shape) her) ::x village, whitelist - == - :: - ++ pa-visible :: display to - ::x checks her read permissions. - :: - |= her/ship - ^- ? - ?- p.cordon.shape - $black !(~(has in q.cordon.shape) her) ::x channel, blacklist - $green & ::x journal, all - $brown (team our.hid her) ::x mailbox, our - $white (~(has in q.cordon.shape) her) ::x village, whitelist - == - :: - ++ pa-report :: update - ::x sends report to all bones. - :: - |= {wac/(set bone) caw/report} - ^+ +> - ?~ wac +> - =. +> $(wac l.wac) - =. +> $(wac r.wac) - (pa-sauce n.wac [%diff %talk-report caw]~) - :: - ++ pa-inform - ::x sends lowdown to all interested readers. - :: - |= low/lowdown - =. moves - %+ weld - ^- (list move) - %+ murn (~(tap by general)) - |= {b/bone s/(set knot)} - ^- (unit move) - ?. (~(has in s) man) ~ - `[b %diff %talk-lowdown low] - moves - +>.$ - :: - ++ pa-remotes - ::x produces remotes, with all our local presences replaced by their - ::x versions from their stories. - :: - %- ~(urn by remotes) :: XX performance - |= {pan/partner atl/atlas} ^- atlas - ?. &(?=($& -.pan) =(our.hid p.p.pan)) atl - =+ soy=(~(get by stories) q.p.pan) - ?~ soy atl - locals.u.soy - :: - ++ pa-report-group :: update presence - ::x build a group report, containing our different presence maps, and - ::x send it to all bones. - ::x we send remote presences to facilitate federation. aka "relay" - :: - |= vew/(set bone) - (pa-report vew %group locals pa-remotes) - :: - ++ pa-report-cabal :: update config - ::x a cabal report, containing our and remote configs, to all bones. - :: - |= vew/(set bone) - (pa-report vew %cabal shape mirrors) - :: - ++ pa-cabal - ::x add station's config to our remote config map. - :: - ::TODO when do we care about ham? - |= {cuz/station con/config ham/(map station config)} - ^+ +> - =+ old=mirrors - =. mirrors (~(put by mirrors) cuz con) - ?: =(mirrors old) +>.$ - =. +>.$ (pa-inform %confs `shape (strap cuz `con)) - (pa-report-cabal pa-followers) - :: - ++ pa-diff-talk-report :: subscribed update - ::x process a talk report from cuz. - :: - |= {cuz/station rad/report} - ^+ +> - ::x verify we are supposed to receive reports from cuz. - ?. (~(has in sources.shape) [%& cuz]) - ~& [%pa-diff-unexpected cuz -.rad] - +> - ?- -.rad - $cabal (pa-cabal cuz +.rad) - $group (pa-remind [%& cuz] +.rad) - $grams (pa-lesson q.+.rad) - == - :: - ++ pa-quit :: stop subscription - ::x delete tay from our subscriptions, then send an updated capal report. - :: - |= tay/partner - ^+ +> - ?. (~(has in sources.shape) tay) +> - =. sources.shape (~(del in sources.shape) tay) - =. +> (pa-inform %confs `shape ~) - (pa-report-cabal pa-followers) - :: - ++ pa-sauce :: send backward - ::x turns cards into moves, reverse order, prepend to existing moves. + ++ so-sauce ::< send backward + ::> cards to moves, prepend to {moves} reversed. :: |= {ost/bone cub/(list card)} %_ +>.$ @@ -804,149 +840,266 @@ (welp (flop (turn cub |=(a/card [ost a]))) moves) == :: - ++ pa-abjure :: unsubscribe move - ::x for each partner, produce a %pull/unsubscribe move. + ++ so-act ::< send action + ::> stores a talk action. :: - |= tal/(list partner) - %+ pa-sauce 0 ::x subscription is caused by this app - %- zing - %+ turn tal - |= tay/partner - ^- (list card) - ?- -.tay - $| ~& tweet-abjure+p.p.tay - !! - :: - $& :_ ~ - :* %pull - /friend/show/[man]/(scot %p p.p.tay)/[q.p.tay] - [p.p.tay %talk-guardian] - ~ - == - == - :: - ++ pa-acquire :: subscribe to - ::x subscribe this story to the partners. - :: - |= tal/(list partner) - %+ pa-sauce 0 ::x subscription is caused by this app - %- zing - %+ turn tal - |= tay/partner - ^- (list card) - =+ num=(~(get by sequence) tay) - =+ old=(sub now.hid ~d1) :: XX full backlog - ::x subscribe starting at the last message we read, - ::x or if we haven't read any yet, messages from up to a day ago. - =+ ini=?^(num (scot %ud u.num) (scot %da old)) - ?- -.tay - $| !! - $& :_ ~ - :* %peer - /friend/show/[man]/(scot %p p.p.tay)/[q.p.tay] - [p.p.tay %talk-guardian] - /[q.p.tay]/[ini] - == - == - :: - ++ pa-reform :: reconfigure, ugly - ::x change config of current story, subscribe/unsubscribe to/from the - ::x partners we gained/lost, and send out an updated cabal report. - :: - |= cof/config - =. +>.$ (pa-inform %confs `cof ~) - =+ ^= dif ^- (pair (list partner) (list partner)) - =+ old=`(list partner)`(~(tap in sources.shape) ~) - =+ new=`(list partner)`(~(tap in sources.cof) ~) - :- (skip new |=(a/partner (~(has in sources.shape) a))) - (skip old |=(a/partner (~(has in sources.cof) a))) - =. +>.$ (pa-acquire p.dif) - =. +>.$ (pa-abjure q.dif) - =. shape cof - (pa-report-cabal pa-followers) - :: - ++ pa-reform-gone - =. stories (~(del by stories) man) - =. . (pa-inform %confs ~ ~) - =. . (pa-report-cabal pa-followers) - (pa-abjure (~(tap in sources.shape))) - :: - ++ pa-cancel :: unsubscribe from - ::x deletes the current ost.hid from all follower groups. - :: - .(followers (~(del by followers) ost.hid)) - :: - ++ pa-notify :: local presence - ::x add her status to our presence map. if this changes it, send report. - :: - |= {her/ship saz/status} + |= act/action ^+ +> - =/ nol (~(put by locals) her saz) - ?: =(nol locals) +>.$ - =. +>.$ (pa-inform %precs (strap her saz) ~) - (pa-report-group(locals nol) pa-followers) + +>(acs [act acs]) :: - ++ pa-remind :: remote presence - ::x adds tay's loc to our remote presence map, after merging with rem. - ::x if this changes anything, send update report. + ++ so-inform ::< send lowdown + ::> sends lowdown to all interested readers. :: - |= {tay/partner loc/atlas rem/(map partner atlas)} - ::x remove this story from the presence map, since it's in local already. - =. rem (~(del by rem) %& our.hid man) :: superceded by local data + |= low/lowdown + =. moves + %+ weld + ^- (list move) + %+ murn (~(tap by readers)) + |= {b/bone s/(set knot)} + ^- (unit move) + ?. (~(has in s) nom) ~ + `[b %diff %talk-lowdown low] + moves + +>.$ + :: + ++ so-report ::< send update + ::> sends report to all bones. + :: + |= {bos/(set bone) ret/report} + ^+ +> + ?~ bos +> + =. +> $(bos l.bos) + =. +> $(bos r.bos) + (so-sauce n.bos [%diff %talk-report ret]~) + :: + ++ so-report-group ::< presence update + ::> send local and remote presences in a report. + :: + |= bos/(set bone) + (so-report bos %group locals so-remotes) + :: + ++ so-report-cabal ::< config update + ::> send local and remote configs in a report. + :: + |= bos/(set bone) + (so-report bos %cabal shape mirrors) + :: + ::> || + ::> || %data + ::> || + ::> utility functions for data retrieval. + ::+| + :: + ++ so-followers ::< follower bones + ::> turns the keys of {followers} into a set. + :: + ^- (set bone) + %- ~(gas in *(set bone)) + %+ turn (~(tap by followers)) + |= {b/bone *} b + :: + ++ so-unearth ::< ships' bones + ::> find the bones in {followers} that belong to + ::> a ship in {sis}. + :: + |= sis/(set ship) + ^- (set bone) + %- ~(rep in sup.bol) + |= {{b/bone s/ship p/path} c/(set bone)} + ?. ?& (~(has in sis) s) + (~(has by followers) b) + ?=({@tas *} p) + =(i.p nom) + == + c + (~(put in c) b) + :: + ++ so-remotes ::< remote presences + ::> produces {remotes}, with all our local + ::> presences replaced by the versions from their + ::> stories. + :: + %- ~(urn by remotes) :: XX performance + |= {pan/partner atl/atlas} + ^- atlas + ?. &(?=($& -.pan) =(our.bol p.p.pan)) atl + =+ soy=(~(get by stories) q.p.pan) + ?~ soy atl + locals.u.soy + :: + ::> || + ::> || %interaction-events + ::> || + ::> arms that apply events we received. + ::+| + :: + ++ so-diff-report ::< process update + ::> process a talk report from {sat}. + ::> if we didn't expect it, ignore. + :: + |= {sat/station ret/report} + ^+ +> + ?. (~(has in sources.shape) [%& sat]) + ~& [%talk-so-diff-unexpected sat -.ret] + +> + ?- -.ret + $cabal (so-cabal sat +.ret) + $group (so-remind [%& sat] +.ret) + $grams (so-lesson q.+.ret) + == + :: + ++ so-cabal ::< update config + ::> add station's config to our remote config map. + :: + ::TODO when do we care about ham? + |= {sat/station con/config ham/(map station config)} + ^+ +> + =+ old=mirrors + =. mirrors (~(put by mirrors) sat con) + ?: =(mirrors old) +>.$ + =. +>.$ (so-inform %confs `shape (strap sat `con)) + (so-report-cabal so-followers) + :: + ++ so-remind ::< remote presence + ::> adds tay's loc to our remote presence map, + ::> after merging with rem. + ::> if this changes anything, send a report. + :: + |= {pan/partner loc/atlas rem/(map partner atlas)} + =. rem (~(del by rem) %& our.bol nom) ::< superseded by local =/ buk (~(uni by remotes) rem) - =. buk (~(put by buk) tay loc) + =. buk (~(put by buk) pan loc) ?: =(buk remotes) +>.$ =. +>.$ - %^ pa-inform %precs ~ - :: per-partner diff. + %^ so-inform %precs ~ + ::> per-partner diff. %- ~(urn by buk) |= {p/partner a/atlas} =+ o=(~(get by remotes) p) ?~(o a (~(dif in a) u.o)) - (pa-report-group(remotes buk) pa-followers) + (so-report-group(remotes buk) so-followers) :: - ++ pa-start :: start stream - ::x grab all telegrams that fall within the river and send them in a - ::x grams report to ost.hid. + ::> || + ::> || %changes + ::> || + ::> arms that make miscelaneous changes to this story. + ::+| + :: + ++ so-reform ::< reconfigure + ::> changes the config of this story and notify + ::> our followers. + ::> subscribes to new sources, unsubs from removed + ::> ones. :: - |= riv/river - ^+ +> - =; lab/{dun/? end/@u zeg/(list telegram)} - =. +>.$ - (pa-sauce ost.hid [[%diff %talk-report %grams end.lab zeg.lab] ~]) - ?: dun.lab - (pa-sauce ost.hid [[%quit ~] ~]) - +>.$(followers (~(put by followers) ost.hid riv)) - =+ [end=count gaz=grams dun=| zeg=*(list telegram)] - |- ^- (trel ? @ud (list telegram)) - ?~ gaz [dun end zeg] - ?: ?- -.q.riv :: after the end - $ud (lte p.q.riv end) - $da (lte p.q.riv p.r.q.i.gaz) - == - ::x if we're past the river, keep browsing back, mark stream as done. - $(end (dec end), gaz t.gaz, dun &) - ?: ?- -.p.riv :: before the start - $ud (lth end p.p.riv) - $da (lth p.r.q.i.gaz p.p.riv) - == - ::x if we're before the river, we're done. - [dun end zeg] - ::x if we're in the river, add this gram and continue. - $(end (dec end), gaz t.gaz, zeg [i.gaz zeg]) + |= cof/config + =. +>.$ (so-inform %confs `cof ~) + =/ dif/(pair (list partner) (list partner)) + =+ old=`(list partner)`(~(tap in sources.shape) ~) + =+ new=`(list partner)`(~(tap in sources.cof) ~) + :- (skip new |=(a/partner (~(has in sources.shape) a))) + (skip old |=(a/partner (~(has in sources.cof) a))) + =. +>.$ (so-acquire p.dif) + =. +>.$ (so-abjure q.dif) + =. shape cof + (so-report-cabal so-followers) :: - ++ pa-first-grams :: subscribe messages - ::x (called upon subscribe) send backlog of grams to her. - ::x deduces which messages to send from pax. + ++ so-reform-gone ::< delete story + ::> deletes this story. removes it from {stories} + ::> and unsubscribes from all sources. + :: + =. stories (~(del by stories) nom) + =. . (so-inform %confs ~ ~) + =. . (so-report-cabal so-followers) + (so-abjure (~(tap in sources.shape))) + :: + ++ so-notify ::< local presence + ::> add {her} status to this story's presence map. + ::> if this changes it, send a report. + :: + |= {her/ship sas/status} + ^+ +> + =/ nol (~(put by locals) her sas) + ?: =(nol locals) +>.$ + =. +>.$ (so-inform %precs (strap her sas) ~) + (so-report-group(locals nol) so-followers) + :: + ::> || + ::> || %subscriptions + ::> || + ::> arms for starting and ending subscriptions + ::+| + :: + ++ so-acquire ::< subscribe us + ::> subscribes this story to each partner. + :: + |= pas/(list partner) + %+ so-sauce 0 :: subscription is caused by this app + %- zing + %+ turn pas + |= pan/partner + ^- (list card) + ::> subscribe starting at the last message we got, + ::> or if we haven't gotten any yet, messages + ::> from up to a day ago. + =+ num=(~(get by sequence) pan) + =+ old=(sub now.bol ~d1) :: XX full backlog + =+ ini=?^(num (scot %ud u.num) (scot %da old)) + ?- -.pan + $| !! ::< passport partner + :: + $& ::< station partner + :_ ~ + :* %peer + /friend/show/[nom]/(scot %p p.p.pan)/[q.p.pan] + [p.p.pan %talk-guardian] + /[q.p.pan]/[ini] + == + == + :: + ++ so-abjure ::< unsubscribe us + ::> unsubscribes this story from each partner. + :: + |= pas/(list partner) + %+ so-sauce 0 :: subscription is caused by this app + %- zing + %+ turn pas + |= pan/partner + ^- (list card) + ?- -.pan + $| !! ::< passport partner + :: + $& ::< station partner + :_ ~ + :* %pull + /friend/show/[nom]/(scot %p p.p.pan)/[q.p.pan] + [p.p.pan %talk-guardian] + ~ + == + == + :: + ++ so-quit ::< subscription failed + ::> delete {pan} from our subscriptions, then send + ::> an updated capal report. + :: + |= pan/partner + ^+ +> + ?. (~(has in sources.shape) pan) +> + =. sources.shape (~(del in sources.shape) pan) + =. +> (so-inform %confs `shape ~) + (so-report-cabal so-followers) + :: + ++ so-start ::< subscribe follower + ::> called upon subscribe. deduces the range of + ::> {her} subscription from {pax}, then sends + ::> the currently available part of it. :: |= {her/ship pax/path} ^+ +> - ?. (pa-visible her) - ~& [%pa-first-grams-visible ~] - (pa-sauce ost.hid [%quit ~]~) - ::x find the range of grams to send. - =+ ^= ruv ^- (unit river) - %+ biff ::x collapse unit list. + ?. (so-visible her) :: read permissions + ~& [%talk-so-start-visible ~] + (so-sauce ost.bol [%quit ~]~) + =/ ruv/(unit river) :: find grams range + %+ biff :: collapse unit list (zl:jo (turn pax ;~(biff slay |=(a/coin `(unit dime)`?~(-.a a ~))))) |= paf/(list dime) ?~ paf @@ -957,21 +1110,77 @@ ~ `[[?+(- . $ud .)]:i.paf [?+(- . $ud .)]:i.t.paf] ::XX arvo issue #366 ?~ ruv - ~& [%pa-first-grams-malformed pax] - (pa-sauce ost.hid [%quit ~]~) - (pa-start u.ruv) + ~& [%talk-so-start-malformed pax] + (so-sauce ost.bol [%quit ~]~) + (so-first-grams u.ruv) :: - ++ pa-refresh :: update to listeners - ::x called when grams get added or changed. calculates the changes and - ::x sends them to all followers. if we run into any followers that are - ::x no longer interested in this story, remove them. + ++ so-first-grams ::< beginning of stream + ::> find all grams that fall within the river and + ::> send them in a grams report to {ost.bol}. + :: + |= riv/river + ^+ +> + =; lab/{dun/? end/@u zeg/(list telegram)} + =. +>.$ + (so-sauce ost.bol [[%diff %talk-report %grams end.lab zeg.lab] ~]) + ?: dun.lab + (so-sauce ost.bol [[%quit ~] ~]) + +>.$(followers (~(put by followers) ost.bol riv)) + =+ [end=count gaz=grams dun=| zeg=*(list telegram)] + |- ^- (trel ? @ud (list telegram)) + ?~ gaz [dun end zeg] + ?: ?- -.q.riv :: after the end + $ud (lte p.q.riv end) + $da (lte p.q.riv p.r.q.i.gaz) + == + :: if past the river, continue back, mark as done. + $(end (dec end), gaz t.gaz, dun &) + ?: ?- -.p.riv :: before the start + $ud (lth end p.p.riv) + $da (lth p.r.q.i.gaz p.p.riv) + == + :: if before the river, we're done searching. + [dun end zeg] + ::x if in the river, add this gram and continue. + $(end (dec end), gaz t.gaz, zeg [i.gaz zeg]) + :: + ++ so-cancel ::< unsubscribe follower + ::> removes {ost.bol} from our followers. + :: + .(followers (~(del by followers) ost.bol)) + :: + ++ so-eject ::< unsubscribe ships + ::> removes ships {sis} from {followers}. + :: + |= sis/(set ship) + %= +> + followers + %- ~(rep in (so-unearth sis)) + |= {b/bone f/_followers} + =. f ?~(f followers f) ::TODO =? + (~(del by f) b) + == + :: + ::> || + ::> || %messaging + ::> || + ::> arms for adding to this story's messages. + ::+| + :: + ++ so-refresh ::< update to listeners + ::> called when messages get added or changed. + ::> calculates the changes and sends them to all + ::> followers. + ::> any followers that are no longer interested + ::> get removed. :: |= {num/@ud gam/telegram} ^+ +> - ::x notify the interested readers. - =. +> (pa-inform %grams num gam ~) - ::x notify only the followers who are currently interested. - =+ ^= moy + ::> notify the interested readers. + =. +> (so-inform %grams num gam ~) + ::> notify only the followers who are currently interested. + ::TODO might be able to refactor using ~(rep in followers)? + =/ moy |- ^- (pair (list bone) (list move)) ?~ followers [~ ~] =+ lef=$(followers l.followers) @@ -994,46 +1203,46 @@ ?~ p.moy +>.^$ $(p.moy t.p.moy, followers (~(del by followers) i.p.moy)) :: - ++ pa-lesson :: learn multiple - ::x learn all telegrams in a list. + ++ so-lesson ::< learn messages + ::> learn all telegrams in a list. :: |= gaz/(list telegram) ^+ +> ?~ gaz +> - $(gaz t.gaz, +> (pa-learn i.gaz)) + $(gaz t.gaz, +> (so-learn i.gaz)) :: - ++ pa-learn :: learn message - ::x store an incoming telegram, modifying audience to say we received it. - ::x update existing telegram if it already exists. + ++ so-learn ::< save/update message + ::> store an incoming telegram, updating if it + ::> already exists. :: |= gam/telegram ^+ +> - ::x if author isn't allowed to write here, reject. - ?. (pa-admire p.gam) + ?. (so-admire p.gam) ::< write permissions +>.$ =. q.q.gam - ::x if we are in the audience, mark us as having received it. - =+ ole=(~(get by q.q.gam) [%& our.hid man]) - ?^ ole (~(put by q.q.gam) [%& our.hid man] -.u.ole %received) - :: for fedearted stations, pretend station src/foo is also our/foo - :: XX pass src through explicitly instead of relying on implicit - :: value in hid from the subscription to src/foo - =+ ole=(~(get by q.q.gam) [%& src.hid man]) + ::> if we are in the audience, mark as received. + =+ ole=(~(get by q.q.gam) [%& our.bol nom]) + ?^ ole (~(put by q.q.gam) [%& our.bol nom] -.u.ole %received) + ::> federated stations need to pretend ~src/nom + ::> is also ~our/nom. + ::TODO pass src through explicitly instead of + :: relying on src.bol. + =+ ole=(~(get by q.q.gam) [%& src.bol nom]) ?~ ole q.q.gam - ::x as described above, fake src into our. - =. q.q.gam (~(del by q.q.gam) [%& src.hid man]) - (~(put by q.q.gam) [%& our.hid man] -.u.ole %received) + ::> as described above, fake src into our. + =. q.q.gam (~(del by q.q.gam) [%& src.bol nom]) + (~(put by q.q.gam) [%& our.bol nom] -.u.ole %received) =+ old=(~(get by known) p.q.gam) ?~ old - (pa-append gam) ::x add - (pa-revise u.old gam) ::x modify + (so-append gam) ::< add + (so-revise u.old gam) ::< modify :: - ++ pa-append :: append new - ::x add gram to our story, and update our subscribers. + ++ so-append ::< append message + ::> add gram to our story, send report to subs. :: |= gam/telegram ^+ +> - %+ %= pa-refresh + %+ %= so-refresh grams [gam grams] count +(count) known (~(put by known) p.q.gam count) @@ -1041,60 +1250,45 @@ count gam :: - ++ pa-revise :: revise existing - ::x modify a gram in our story, and update our subscribers. + ++ so-revise ::< revise message + ::> modify gram in our story, send report to subs. :: |= {num/@ud gam/telegram} - =+ way=(sub count num) - ?: =(gam (snag (dec way) grams)) - +>.$ :: no change - =. grams (welp (scag (dec way) grams) [gam (slag way grams)]) - (pa-refresh num gam) + ::> dex: index in grams list to insert message at. + =+ dex=(sub count num) + ?: =(gam (snag (dec dex) grams)) +>.$ ::< no change + =. grams + %+ welp + (scag (dec dex) grams) + [gam (slag dex grams)] + (so-refresh num gam) :: - ++ pa-unearth - ::x find the bones in our follower list than belong to a ship in sis. - :: - |= sis/(set ship) - ^- (set bone) - %- ~(rep in sup.hid) - |= {{b/bone s/ship p/path} c/(set bone)} - ?. ?& (~(has in sis) s) - (~(has by followers) b) - ?=({@tas *} p) - =(i.p man) - == - c - (~(put in c) b) + ::> || + ::> || %permissions + ::> || + ::> arms relating to story permissions. + ::+| :: - ++ pa-eject - ::x removes the ships from our followers. - |= sis/(set ship) - %= +> - followers - %- ~(rep in (pa-unearth sis)) - |= {b/bone f/_followers} - =. f ?~ f followers f ::TODO =? - (~(del by f) b) - == - :: - ++ pa-permit - ::x invite/banish ships to/from this station. + ++ so-permit ::< invite/banish + ::> update config to dis/allow ships permission. :: |= {inv/? sis/(set ship)} ^+ +> - =/ white/? ?=(?($white $green) p.cordon.shape) :: whitelist? - =/ add/? =(inv white) :: add to list? + ::> wyt: whitelist? + ::> add: add to list? + =/ wyt/? ?=(?($white $green) p.cordon.shape) + =/ add/? =(inv wyt) =. +>.$ ::TODO =? ?: inv +>.$ - (pa-eject sis) + (so-eject sis) =. +>.$ - %- pa-act + %- so-act :- %phrase %- ~(rep in sis) |= {s/ship a/(set partner) t/(list speech)} :- (~(put in a) [%& s (main s)]) - [[%inv inv [our.hid man]] t] - %- pa-reform + [[%inv inv [our.bol nom]] t] + %- so-reform %= shape q.cordon %. sis @@ -1102,195 +1296,282 @@ ~(uni in q.cordon.shape) ~(dif in q.cordon.shape) == + :: + ++ so-admire ::< accept from + ::> checks {her} write permissions. + :: + |= her/ship + ^- ? + ?- p.cordon.shape + $black !(~(has in q.cordon.shape) her) ::< channel, blacklist + $white (~(has in q.cordon.shape) her) ::< village, whitelist + $green (~(has in q.cordon.shape) her) ::< journal, whitelist + $brown !(~(has in q.cordon.shape) her) ::< mailbox, blacklist + == + :: + ++ so-visible ::< display to + ::> checks {her} read permissions. + :: + |= her/ship + ^- ? + ?- p.cordon.shape + $black !(~(has in q.cordon.shape) her) ::< channel, blacklist + $white (~(has in q.cordon.shape) her) ::< village, whitelist + $green & ::< journal, all + $brown (team our.bol her) ::< mailbox, our team + == -- -- :: -++ peer :: accept subscription - ::x incoming subscription on pax. - :: - |= pax/path - ^+ [*(list move) +>] - ~? !(team src.hid our.hid) [%peer-talk-stranger src.hid] - ?: ?=({$sole *} pax) ~&(%broker-no-sole !!) - ra-abet:(ra-subscribe:ra src.hid pax) +::> || +::> || %wire-parsing +::> || +::+| :: -++ poke-talk-command :: accept command - ::x incoming talk command. process it and update logs. +++ etch ::< parse wire + ::> parses {wir}} to obtain either %friend with story + ::> and station or %repeat with message number, + ::> source ship and story. :: - |= cod/command - ^+ [*(list move) +>] - =^ mos +>.$ - ra-abet:(ra-apply:ra src.hid cod) - =^ mow +>.$ log-all-to-file - [(welp mos mow) +>.$] -:: -++ poke-talk-action :: accept action - ::x incoming talk action. process it. - :: - |= act/action - ?. (team src.hid our.hid) - ~& [%talk-action-stranger src.hid] - [~ +>] - ra-abet:(ra-action:ra ost.hid act) -:: -++ diff-talk-report :: accept report - ::x incoming talk-report. process it and update logs. - :: - |= {way/wire rad/report} - ^- (quip move +>) - =^ mos +>.$ - %+ etch-friend way |= {man/knot cuz/station} - ra-abet:(ra-diff-talk-report:ra man cuz rad) - =^ mow +>.$ log-all-to-file - [(welp mos mow) +>.$] -:: -++ coup-repeat :: - ::x ack from ++ra-transmit. mark the message as received or rejected. - :: - |= {way/wire saw/(unit tang)} - %+ etch-repeat [%repeat way] |= {num/@ud src/@p man/knot} - ra-abet:(ra-coup-repeat:ra [num src man] saw) -:: -++ etch :: parse wire - ::x parse wire to obtain either %friend with story and station or %repeat - ::x with message number, source ship and story. - :: - |= way/wire + |= wir/wire ^- weir - ?+ -.way !! + ?+ -.wir !! $friend - ?> ?=({$show @ @ @ $~} t.way) - [%friend i.t.t.way (slav %p i.t.t.t.way) i.t.t.t.t.way] - :: + ?> ?=({$show @ @ @ $~} t.wir) + :^ %friend + i.t.t.wir + (slav %p i.t.t.t.wir) + i.t.t.t.t.wir + :: $repeat - ?> ?=({@ @ @ $~} t.way) - [%repeat (slav %ud i.t.way) (slav %p i.t.t.way) i.t.t.t.way] + ?> ?=({@ @ @ $~} t.wir) + :^ %repeat + (slav %ud i.t.wir) + (slav %p i.t.t.wir) + i.t.t.t.wir == :: -++ etch-friend :: - ::x parse a /friend wire, call gate with resulting data. +++ etch-friend ::< parse /friend wire + ::> parses a /friend wire, call a gate with the result. :: - |= {way/wire fun/$-({man/knot cuz/station} {(list move) _.})} - =+ wer=(etch way) + |= $: wir/wire + $= fun + $- {nom/knot sat/station} + {(list move) _.} + == + =+ wer=(etch wir) ?>(?=($friend -.wer) (fun p.wer q.wer)) :: -++ etch-repeat :: - ::x parse a /repeat wire, call gate with resulting data. +++ etch-repeat ::< parse /repeat wire + ::> parses a /repeat wire, call gate with the result. :: - |= {way/wire fun/$-({num/@ud src/@p man/knot} {(list move) _.})} - =+ wer=(etch way) + |= $: wir/wire + $= fun + $- {num/@ud src/ship nom/knot} + {(list move) _.} + == + =+ wer=(etch wir) ?>(?=($repeat -.wer) (fun p.wer q.wer r.wer)) :: -++ reap-friend :: - ::x subscription n/ack. if it failed, remove their subscription from state. +::> || +::> || %poke-events +::> || +::+| +:: +++ poke-talk-command ::< accept command + ::> incoming talk command. process it and update logs. :: - |= {way/wire saw/(unit tang)} + |= cod/command ^- (quip move +>) - ?~ saw [~ +>] - %+ etch-friend [%friend way] |= {man/knot cuz/station} - =. u.saw [>%reap-friend-fail man cuz< u.saw] - %- (slog (flop u.saw)) - ra-abet:(ra-quit:ra man cuz) + =^ mos +>.$ + ta-done:(ta-apply:ta src.bol cod) + =^ mow +>.$ + log-all-to-file + [(welp mos mow) +>.$] :: -++ quit-friend :: - ::x resubscribe. +++ poke-talk-action ::< accept action + ::> incoming talk action. process it. :: - |= way/wire - %+ etch-friend [%friend way] |= {man/knot cuz/station} - ra-abet:(ra-retry:ra man cuz) + |= act/action + ^- (quip move +>) + ?. (team src.bol our.bol) + ~& [%talk-action-stranger src.bol] + [~ +>] + ta-done:(ta-action:ta ost.bol act) :: -++ pull :: - ::x unsubscribe. +++ poke-talk-comment ::< do comment + ::> sends a comment. + :: + |= {pax/path sup/spur txt/@t} + ^- (quip move +>) + ta-done:(ta-comment:ta pax sup txt) +:: +++ poke-talk-fora-post ::< do fora post + ::> sends a fora post. + :: + |= {pax/path sup/spur hed/@t txt/@t} + ^- (quip move +>) + ta-done:(ta-fora-post:ta pax sup hed txt) +:: +::> || +::> || %subscription-events +::> || +::+| +:: +++ diff-talk-report ::< accept report + ::> incoming talk-report. process it and update logs. + :: + |= {wir/wire ret/report} + ^- (quip move +>) + =^ mos +>.$ + %+ etch-friend wir + |= {nom/knot sat/station} + ta-done:(ta-diff-report:ta nom sat ret) + =^ mow +>.$ + log-all-to-file + [(welp mos mow) +>.$] +:: +++ peer ::< accept subscription + ::> incoming subscription on {pax}. :: |= pax/path - ^+ [*(list move) +>] - ra-abet:(ra-cancel:ra src.hid pax) + ^- (quip move +>) + ~? !(team src.bol our.bol) [%talk-peer-stranger src.bol] + ?: ?=({$sole *} pax) ~&(%talk-broker-no-sole !!) + ta-done:(ta-subscribe:ta src.bol pax) :: -++ log-all-to-file - ::x for every story we're logging, (over)write all their grams to log files, - ::x if new ones have arrived. +++ pull ::< unsubscribe + ::> unsubscribes. :: + |= pax/path + ^- (quip move +>) + ta-done:(ta-cancel:ta src.bol pax) +:: +++ reap-friend ::< subscription n/ack + ::> if subscribing failed, update state to reflect + ::> that. + :: + ::TODO this should deal with /reader subscriptions too. + |= {wir/wire fal/(unit tang)} + ^- (quip move +>) + ?~ fal [~ +>] + %+ etch-friend [%friend wir] + |= {nom/knot sat/station} + =. u.fal [>%reap-friend-fail nom sat< u.fal] + %- (slog (flop u.fal)) + ta-done:(ta-quit:ta nom sat) +:: +++ quit-friend ::< dropped subscription + ::> gall dropped our subscription. resubscribe. + :: + |= wir/wire + ^- (quip move +>) + %+ etch-friend [%friend wir] + |= {nom/knot sat/station} + ta-done:(ta-retry:ta nom sat) +:: +++ coup-repeat ::< message n/ack + ::> ack from ++ta-transmit. mark the message as + ::> received or rejected. + :: + |= {wir/wire fal/(unit tang)} + ^- (quip move +>) + %+ etch-repeat [%repeat wir] + |= {num/@ud src/ship nom/knot} + ta-done:(ta-coup-repeat:ta [num src nom] fal) +:: +::> || +::> || %logging +::> || +::+| +:: +++ poke-talk-save ::< save as log + ::> stores the telegrams of story {nom} in a log file, + ::> to be re-loaded by ++poke-talk-load. + :: + |= nom/knot + ^- (quip move +>) + =/ paf/path + /(scot %p our.bol)/home/(scot %da now.bol)/talk/[nom]/talk-telegrams + =+ grams:(~(got by stories) nom) + :_ +>.$ + :_ ~ + :* ost.bol + %info + /jamfile + our.bol + (foal paf [%talk-telegrams !>(-)]) + == +:: +++ poke-talk-load ::< load from log + ::> loads the telegrams of story {nom} into our state, + ::> as saved in ++poke-talk-save. + :: + |= nom/knot + ^- (quip move +>) + =/ grams + .^ (list telegram) + %cx + /(scot %p our.bol)/home/(scot %da now.bol)/talk/[nom]/talk-telegrams + == + =+ soy=(~(got by stories) nom) + :- ~ + %= +>.$ + stories + %+ ~(put by stories) nom + soy(grams grams, count (lent grams)) + == +:: +++ poke-talk-log ::< start logging + ::> starts logging story {nom}'s messages. + :: + |= nom/knot + ~& %talk-poke-log + ^- (quip move +>) + :- [(log-to-file nom) ~] + %= +>.$ + log + %+ ~(put by log) nom + count:(~(got by stories) nom) + == +:: +++ poke-talk-unlog ::< stop logging + ::> stops logging story {nom}'s messages. + :: + |= nom/knot + ^- (quip move +>) + :- ~ + +>.$(log (~(del by log) nom)) +:: +++ 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. + :: + ::TODO re-enable and test. ^- (quip move .) ?: & [~ .] :: XXX!!!! :_ %_ . - log %- ~(urn by log) - |=({man/knot len/@ud} count:(~(got by stories) man)) + log + %- ~(urn by log) + |= {nom/knot len/@ud} + count:(~(got by stories) nom) == %+ murn (~(tap by log)) - |= {man/knot len/@ud} + |= {nom/knot len/@ud} ^- (unit move) - ?: (gte len count:(~(got by stories) man)) + ?: (gte len count:(~(got by stories) nom)) ~ - `(log-to-file man) + `(log-to-file nom) :: -++ log-to-file - ::x log all grams of story man to a file. +++ log-to-file ::< update story log + ::> logs all grams of story {nom} to a file. :: - |= man/knot + |= nom/knot ^- move =+ ^- paf/path - =+ day=(year %*(. (yore now.hid) +.t +:*tarp)) - %+ tope [our.hid %home da+now.hid] - /talk-telegrams/(scot %da day)/[man]/talk - =+ grams:(~(got by stories) man) - [ost.hid %info /jamfile our.hid (foal paf [%talk-telegrams !>(-)])] -:: -++ poke-talk-comment - ::x send a comment. - :: - |= {pax/path sup/spur txt/@t} ^- (quip move +>) - ra-abet:(ra-comment:ra pax sup txt) -:: -++ poke-talk-fora-post - ::x send a fora post. - :: - |= {pax/path sup/spur hed/@t txt/@t} ^- (quip move +>) - ra-abet:(ra-fora-post:ra pax sup hed txt) -:: -++ poke-talk-save - ::x store the talk telegrams of story man in a log file. - :: - |= man/knot - ^- (quip move +>) - =+ paf=/(scot %p our.hid)/home/(scot %da now.hid)/talk/[man]/talk-telegrams - =+ grams:(~(got by stories) man) - [[ost.hid %info /jamfile our.hid (foal paf [%talk-telegrams !>(-)])]~ +>.$] -:: -++ poke-talk-load - ::x load/update the story man into our state, as saved in ++poke-talk-save. - :: - |= man/knot - =+ ^= grams - .^ (list telegram) - %cx - /(scot %p our.hid)/home/(scot %da now.hid)/talk/[man]/talk-telegrams - == - =+ toy=(~(got by stories) man) - [~ +>.$(stories (~(put by stories) man toy(grams grams, count (lent grams))))] -:: -++ poke-talk-log - ::x start logging story man. - :: - |= man/knot - ~& %poke-log - ^- (quip move +>) - :- [(log-to-file man) ~] - +>.$(log (~(put by log) man count:(~(got by stories) man))) -:: -++ poke-talk-unlog - ::x stop logging story man. - :: - |= man/knot - ^- (quip move +>) - :- ~ - +>.$(log (~(del by log) man)) -:: -++ prep - ::x state adapter. - :: - |= old/(unit house) - ::^- (quip move ..prep) - ::?~ old - ra-abet:ra-init:ra - ::[~ ..prep(+<+ u.old)] + =+ day=(year %*(. (yore now.bol) +.t +:*tarp)) + %+ tope [our.bol %home da+now.bol] + /talk-telegrams/(scot %da day)/[nom]/talk + =+ grams:(~(got by stories) nom) + [ost.bol %info /jamfile our.bol (foal paf [%talk-telegrams !>(-)])] -- From 1cf95788fa42006e379e8cf7cfdd6e9b5c0f6e79 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 21 Apr 2017 13:43:17 +0200 Subject: [PATCH 075/303] Reorganized the talk structures and slightly improved their documentation. --- sur/talk.hoon | 239 +++++++++++++++++++++++++++++--------------------- 1 file changed, 137 insertions(+), 102 deletions(-) diff --git a/sur/talk.hoon b/sur/talk.hoon index 15d3ae5e4e..07f6760d35 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -2,119 +2,154 @@ :::: /hoon/talk/sur !: |% -++ audience (map partner (pair envelope delivery)) :: destination+state -++ atlas (map ship status) :: presence map -++ bouquet (set flavor) :: complete aroma -++ command :: effect on party - $% {$review (list thought)} :: deliver - == :: -++ action :: user action +:: +::TODO station -> circle +:: +::> || +::> || %reader-communication +::> || +::> broker interfaces for readers. +::+| +:: +++ action ::> user action $% :: station configuration :: - {$create (trel knot cord posture)} :: create station - {$source (trel knot ? (set partner))} :: un/sub p to/from r - {$depict (pair knot cord)} :: change description - {$permit (trel knot ? (set ship))} :: invite/banish - {$delete (pair knot (unit @t))} :: delete + announce + {$create (trel knot cord posture)} ::< create station + {$source (trel knot ? (set partner))} ::< un/sub p to/from r + {$depict (pair knot cord)} ::< change description + {$permit (trel knot ? (set ship))} ::< invite/banish + {$delete (pair knot (unit cord))} ::< delete + announce :: messaging :: - {$convey (list thought)} :: post exact - {$phrase (pair (set partner) (list speech))} :: post easy + {$convey (list thought)} ::< post exact + {$phrase (pair (set partner) (list speech))} ::< post easy :: personal metadata :: ::TODO change to target partners, not only our stations. - {$status (pair (set knot) status)} :: our status update + {$status (pair (set knot) status)} ::< our status update :: changing shared ui :: - {$human (pair ship human)} :: new identity - {$glyph (trel char (set partner) ?)} :: un/bind a glyph + {$human (pair ship human)} ::< new identity + {$glyph (trel char (set partner) ?)} ::< un/bind a glyph == :: -++ reaction :: user information - $: kind/?($info $fail) :: result - what/@t :: explain - why/(unit action) :: cause +++ reaction ::> user information + $: kind/?($info $fail) ::< result + what/@t ::< explain + why/(unit action) ::< cause == :: -++ cabal :: metaconfiguration - $: loc/config :: local config - ham/(map station config) :: neighborhood configs - == :: -++ config :: party configuration - $: sources/(set partner) :: pulls from - caption/cord :: about - cordon/control :: restricted to - == :: -++ control (pair posture (set ship)) :: access control -++ delivery :: delivery state - $? $pending :: undelivered - $received :: delivered - $rejected :: undeliverable - $released :: sent one-way - $accepted :: fully processed - == :: -++ envelope (pair ? (unit partner)) :: visible sender -++ flavor path :: content flavor -++ human :: human identifier - $: true/(unit (trel @t (unit @t) @t)) ::TODO used? true name - hand/(unit @t) :: handle - == :: -++ passport :: foreign flow - $% {$twitter p/@t} :: twitter - == :: -++ posture :: security posture - $? $black :: channel, blacklist - $white :: village, whitelist - $green :: journal, author list - $brown :: mailbox, our r, bl w - == :: -++ presence ?($gone $hear $talk) :: status type -++ register (pair atlas (map partner atlas)) :: ping me, ping srcs -++ shelf (map knot (pair posture cord)) :: ship shape -++ report :: talk update - $% {$cabal cabal} :: config neighborhood - {$grams (pair @ud (list telegram))} :: thoughts - {$group register} :: presence - == :: -++ lowdown :: changed shared state +++ lowdown ::> new/changed state $% :: story state :: - {$confs (unit config) (map station (unit config))}:: changed configs - {$precs register} :: changed presences - {$grams (pair @ud (list telegram))} :: new grams + {$confs (unit config) (map station (unit config))}::< configs + {$precs register} ::< presences + {$grams (pair @ud (list telegram))} ::< messages :: ui state :: - {$glyph (jug char (set partner))} :: new bindings - {$names (map ship (unit human))} :: new identities + {$glyph (jug char (set partner))} ::< glyph bindings + {$names (map ship (unit human))} ::< nicknames == :: -++ speech :: narrative action - $% {$lan p/knot q/@t} :: local announce - {$exp p/@t} :: hoon line - {$non $~} :: no content (yo) - ::TODO so, this is extensibility tacked on, rather than built-in? - :: really, talk has been two-split but the guardian is still two - :: things at once. you want base-guardian and talk-guardian. - :: ...that's probably what %gall is, but then why do we have $ext? - {$ext p/@tas q/*} :: extended action - {$fat p/torso q/speech} :: attachment - {$inv p/? q/station} :: inv/ban for station - {$url p/purf} :: parsed url - {$ire p/serial q/speech} :: in-reply-to - {$lin p/? q/@t} :: no/@ text line - {$mor p/(list speech)} :: multiplex - {$app p/@tas q/@t} :: app message - $: $api :: api message - service/@tas :: service name - id/@t :: id on the service - id-url/purf :: link to id - summary/@t :: summary of event - body/@t :: body of event - url/purf :: link to event - meta/json :: other data for web +:: +::> || +::> || %broker-communication +::> || +::> structures for communicating between brokers. +::+| +:: +++ command ::> effect on story + $% {$review (list thought)} ::< deliver + == :: +++ report ::> update + $% {$cabal cabal} ::< config neighborhood + {$group register} ::< presence + {$grams (pair @ud (list telegram))} ::< thoughts + == :: +:: +::> || +::> || %circles +::> || +::> messaging targets and their metadata. +::+| +:: +++ partner (each station passport) ::< message target +++ station (pair ship knot) ::< native target +++ passport ::> foreign target + $% {$twitter p/@t} ::< twitter handle + == :: +::> circle configurations. +++ cabal ::> metaconfiguration + $: loc/config ::< local config + ham/(map station config) ::< neighborhood configs + == :: +++ config ::> station config + $: sources/(set partner) ::< pulls from + caption/cord ::< description + cordon/control ::< restrictions + == :: +++ control (pair posture (set ship)) ::< access control +++ posture ::> security kind + $? $black ::< channel, blacklist + $white ::< village, whitelist + $green ::< journal, author list + $brown ::< mailbox, our r, bl w + == :: +::> participant metadata. +++ register (pair atlas (map partner atlas)) ::< our & srcs presences +++ atlas (map ship status) ::< presence map +++ status (pair presence human) ::< participant +++ presence ?($gone $hear $talk) ::< status type +++ human ::> human identifier + $: true/(unit (trel @t (unit @t) @t)) :: || +::> || %message-data +::> || +::> structures for containing main message data. +::+| +:: +++ telegram (pair ship thought) ::< who thought +++ thought (trel serial audience statement) ::< which whom what +++ statement (trel @da bouquet speech) ::< when this +++ speech ::> narrative action + $% {$non $~} ::< no content (yo) + {$lin p/? q/@t} ::< no/@ text line + {$ire p/serial q/speech} ::< in-reply-to + {$url p/purf} ::< parsed url + {$exp p/@t} ::< hoon line + {$fat p/torso q/speech} ::< attachment + {$lan p/knot q/@t} ::< local announce + {$inv p/? q/station} ::< inv/ban for station + {$mor p/(list speech)} ::< multiplex + {$ext p/@tas q/*} ::< extended action + {$app p/@tas q/@t} ::< app message + $: $api ::< api message + service/@tas ::< service name + id/@t ::< id on the service + id-url/purf ::< link to id + summary/@t ::< summary of event + body/@t ::< body of event + url/purf ::< link to event + meta/json ::< other data for web == :: == :: -++ serial @uvH :: unique identity -++ partner (each station passport) :: interlocutor -++ status (pair presence human) :: participant -++ statement (trel @da bouquet speech) :: when this -++ station (pair ship knot) :: domestic flow -++ telegram (pair ship thought) :: who which whom what -++ thought (trel serial audience statement) :: which whom what -++ torso :: attachment - $% {$name (pair @t torso)} :: named attachment - {$text (list @t)} :: text lines - {$tank (list tank)} :: tank list +++ torso ::> attachment + $% {$name (pair @t torso)} ::< named attachment + {$text (list @t)} ::< text lines + {$tank (list tank)} ::< tank list == :: +:: +::> || +::> || %message-metadata +::> || +:: structures for containing message metadata. +::+| +:: +++ serial @uvH ::< unique identifier +++ audience (map partner (pair envelope delivery)) ::< destination + state +++ envelope (pair ? (unit partner)) ::< visible sender +++ delivery ::> delivery state + $? $pending ::< undelivered + $received ::< delivered + $rejected ::< undeliverable + $released ::< sent one-way + $accepted ::< fully processed + == :: +::TODO what is ++bouquet even for? not yet used... +++ bouquet (set flavor) ::< complete aroma +++ flavor path ::< content flavor -- From ba1546347c90eb8f6f3119e551899f3d3df15b7a Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 21 Apr 2017 16:14:11 +0200 Subject: [PATCH 076/303] Further touch-ups to talk-guardian. --- app/talk-guardian.hoon | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 92433c3b3c..112e5b37cb 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -4,6 +4,7 @@ :: ::TODO master changes ::TODO avoid lark where possible +::TODO maybe rename wires. repeat & friend -> message & follower ::TODO think about what printfs we want to keep for the user to see. ::TODO document what user-facing printfs actually mean! ::TODO ::> to :> etc. @@ -25,7 +26,7 @@ :: /? 310 ::< hoon version /- talk ::< structures -/+ talk, time-to-id, twitter ::< libraries +/+ talk, time-to-id ::< libraries /= seed /~ !>(.) !: :::: @@ -96,7 +97,7 @@ |_ {bol/bowl house} :: ++ prep ::< prepare state - ::x adapts state. + ::> adapts state. :: |= old/(unit house) ^- (quip move ..prep) @@ -497,9 +498,9 @@ =. +>.$ ::TODO =? ?: (~(has by readers) new) +>.$ %- ta-emil - :~ ::x bound glyphs + :~ ::> bound glyphs [new %diff %talk-lowdown %glyph nak] - ::x nicknames + ::> nicknames [new %diff %talk-lowdown %names (~(run by folks) some)] == ::> send story state. @@ -507,13 +508,13 @@ ?. (~(has by stories) sor) +>.$ =+ soy=(~(got by stories) sor) %- ta-emil - :~ ::x configurations + :~ ::> configurations :* new %diff %talk-lowdown %confs `shape.soy (~(run by mirrors.soy) some) == - ::x presences + ::> presences [new %diff %talk-lowdown %precs locals.soy remotes.soy] - ::x messages + ::> messages [new %diff %talk-lowdown %grams 0 grams.soy] == ::> add this subscription to {readers}. @@ -692,7 +693,7 @@ a == :: - ++ ta-consume ::< consume thought + ++ ta-consume ::< to each audience ::> conducts thought {tot} to each partner in its audience. :: |= {pub/? aut/ship tot/thought} @@ -702,7 +703,7 @@ ?~ aud +>.^$ $(aud t.aud, +>.^$ (ta-conduct pub aut p.i.aud tot)) :: - ++ ta-conduct :: thought to partner + ++ ta-conduct ::< thought to partner ::> either publishes or records a thought. :: |= {pub/? aut/ship pan/partner tot/thought} @@ -797,9 +798,8 @@ :: |= nom/knot ^+ +> - =+ soy=(~(get by stories) nom) - ?~ soy +>.$ - so-done:~(so-reform-gone so nom ~ u.soy) + %- (ta-know nom) |= sor/_so =< so-done + so-reform-gone:so :: ++ so ::< story core ::> story core, used for doing work on a story. @@ -1141,7 +1141,7 @@ == :: if before the river, we're done searching. [dun end zeg] - ::x if in the river, add this gram and continue. + :: if in the river, add this gram and continue. $(end (dec end), gaz t.gaz, zeg [i.gaz zeg]) :: ++ so-cancel ::< unsubscribe follower From b7381410e8db227c2860ba1afa8a0f7687666747 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 21 Apr 2017 17:37:10 +0200 Subject: [PATCH 077/303] Partial cleanup of talk-agent. So far includes some renaming of arms, partial documentation, bits of refactoring. --- app/talk-agent.hoon | 644 +++++++++++++++++++++++--------------------- 1 file changed, 336 insertions(+), 308 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 30dc2062cc..1b572d2d9f 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -3,186 +3,215 @@ :: :: :: :: ::TODO guardian's todo's apply here too -::TODO rename cores. pa->ta (transaction), ta->pa (partner), etc. ::TODO make sure glyphs get unbound when joins etc don't succeed. ::TODO correct/clean up presence/config change notifications :: -::TODO remove man from door sample where it's always (main our.hid). -::TODO sh-action -> sh-act +::TODO remove man from door sample where it's always (main our.bol). ::TODO maybe keep track of received grams per partner, too? :: -::x This reader implementation makes use of the mailbox for all its -::x subscriptions and messaging. All lowdowns received are exclusively about -::x the mailbox, since that's the only thing the reader ever subscribes to. +::> This reader implementation makes use of the mailbox for all its +::> subscriptions and messaging. All lowdowns received are exclusively about +::> the mailbox, since that's the only thing the reader ever subscribes to. :: -/? 310 :: hoon version -/- talk, sole :: structures -/+ talk, sole, time-to-id, twitter :: libraries +/? 310 ::< hoon version +/- talk, sole ::< structures +/+ talk, sole ::< libraries /= seed /~ !>(.) !: -:: :::: :: [. talk sole] -=> |% :: data structures - ++ chattel :: full state +=> ::> || + ::> || %arch + ::> || + ::> data structures + :: + |% + ++ chattel ::> reader state $: :: messaging state :: - count/@ud :: (lent grams) - grams/(list telegram) :: all history - known/(map serial @ud) :: messages heard - sources/(set partner) :: our subscriptions + count/@ud ::< (lent grams) + grams/(list telegram) ::< all history + known/(map serial @ud) ::< messages heard + sources/(set partner) ::< our subscriptions :: partner details :: - remotes/(map partner atlas) :: remote presences - mirrors/(map station config) :: remote configs + remotes/(map partner atlas) ::< remote presences + mirrors/(map station config) ::< remote configs :: ui state :: - folks/(map ship human) :: human identities - nik/(map (set partner) char) :: bound station glyphs - nak/(jug char (set partner)) :: station glyph lookup - cli/shell :: interaction state + folks/(map ship human) ::< human identities + nik/(map (set partner) char) ::< bound station glyphs + nak/(jug char (set partner)) ::< station glyph lookup + cli/shell ::< interaction state == :: - ++ shell :: console session - $: id/bone :: identifier - count/@ud :: messages shown - say/sole-share :: console state - active/(set partner) :: active targets - settings/(set knot) :: frontend settings + ++ shell ::> console session + $: id/bone ::< identifier + count/@ud ::< messages shown + say/sole-share ::< console state + active/(set partner) ::< active targets + settings/(set knot) ::< frontend settings == :: - :: :: - ++ move (pair bone card) :: all actions - ++ lime :: diff fruit + ++ move (pair bone card) ::< all actions + ++ lime ::> diff fruit $% {$talk-report report} :: {$sole-effect sole-effect} :: == :: - ++ pear :: poke fruit + ++ pear ::> poke fruit $% {$talk-command command} :: {$talk-action action} :: == :: - ++ card :: general card + ++ card ::> general card $% {$diff lime} :: {$poke wire dock pear} :: {$peer wire dock path} :: == :: - ++ work :: interface action - $% {$number p/$@(@ud {@u @ud})} :: relative/absolute - {$help $~} :: print usage info - {$who p/where} :: presence - {$what p/$@(char (set partner))} :: show bound glyph - {$bind p/char q/(unit where)} :: - {$unbind p/char q/(unit where)} :: - {$join p/where} :: - {$leave p/where} :: - {$say p/(list speech)} :: - {$eval p/cord q/twig} :: - {$invite p/knot q/(set ship)} :: give permission - {$banish p/knot q/(set ship)} :: deny permission - {$nick p/(unit ship) q/(unit cord)} :: - {$set p/knot} :: - {$unset p/knot} :: - {$target p/where q/(unit work)} :: set active targets - :: {$destroy p/knot} :: - {$create p/posture q/knot r/cord} :: - {$depict p/knot q/cord} :: - {$source p/knot q/(set partner)} :: - {$delete p/knot q/(unit cord)} :: - {$probe p/station} :: + ++ work ::> interface action + $% :: station management :: + {$join p/where} ::< subscribe to + {$leave p/where} ::< unsubscribe from + {$create p/posture q/knot r/cord} ::< create station + {$delete p/knot q/(unit cord)} ::< delete station + {$depict p/knot q/cord} ::< change description + {$source p/knot q/(set partner)} ::< add source + {$invite p/knot q/(set ship)} ::< give permission + {$banish p/knot q/(set ship)} ::< deny permission + :: messaging :: + {$say p/(list speech)} ::< send message + {$eval p/cord q/twig} ::< send #-message + {$target p/where q/(unit work)} ::< set active targets + :: displaying info :: + {$number p/$@(@ud {@u @ud})} ::< relative/absolute + {$who p/where} ::< presence + {$what p/$@(char (set partner))} ::< show bound glyph + :: ui settings :: + {$bind p/char q/(unit where)} ::< bind glyph + {$unbind p/char q/(unit where)} ::< unbind glyph + {$nick p/(unit ship) q/(unit cord)} ::< un/set/show nick + {$set p/knot} ::< enable setting + {$unset p/knot} ::< disable setting + :: miscelaneous :: + {$help $~} ::< print usage info == :: - ++ weir :: parsed wire - $% {$repeat p/@ud q/@p r/knot} :: - {$friend p/knot q/station} :: - == :: - ++ where (set partner) :: non-empty audience - ++ glyphs `wall`~[">=+-" "}),." "\"'`^" "$%&@"] :: station char pool' - ++ broker :: broker ship and name - |= our/ship - :_ %talk-guardian - ?. =((clan our) %earl) - our - (sein our) + ++ where (set partner) ::< non-empty audience + ++ glyphs `wall`~[">=+-" "}),." "\"'`^" "$%&@"] ::< station char pool ' -- :: -|_ {hid/bowl chattel} +::> || +::> || %work +::> || +::> functional cores and arms. :: -++ ra :: per transaction - ::x gets called when talk gets poked or otherwise prompted/needs to perform - ::x an action. - ::x arms generally modify state, and store moves in ++ra's moves. these get - ::x produced when calling ++ra-abet. - ::x in applying commands and making reports, it uses ++pa for story work. +|_ {bol/bowl chattel} +:: +++ prep ::< prepare state + ::> adapts state. :: - ::x moves: moves storage, added to by ++ra-emit and -emil, produced by -abed. - |_ moves/(list move) + |= old/(unit chattel) + ^- (quip move ..prep) + ?~ old + ta-done:ta-init:ta + [~ ..prep(+<+ u.old)] +:: +::> || +::> || %utility +::> || +::> small utility functions. +::+| +:: +++ broker ::< broker ship + name + |= our/ship + :_ %talk-guardian + ?. =((clan our) %earl) + our + (sein our) +:: +::> || +::> || %engines +::> || +::> main cores. +::+| +:: +++ ta :: per transaction + ::> for every transaction/event (poke, peer etc.) + ::> talk-agent receives, the ++ta transaction core is + ::> called. + ::> in processing transactions, ++ta may modify app + ::> state, or create moves. these moves get produced + ::> upon finalizing the core's with with ++ta-done. + ::> when making changes to the shell, the ++sh core is + ::> used. :: - ++ ra-abet :: resolve core - ::x produces the moves stored in ++ra's moves. - ::x sole-effects get special treatment to become a single move. + |_ ::> moves: moves created by core operations. + :: + moves/(list move) + :: + ++ ta-done ::< resolve core + ::> produces the moves stored in ++ta's moves. + ::> %sole-effect moves get squashed into a %mor. :: ^+ [*(list move) +>] :_ +> - ::x seperate our sole-effects from other moves. - =+ ^= yop - |- ^- (pair (list move) (list sole-effect)) - ?~ moves [~ ~] - =+ mor=$(moves t.moves) - ?: ?& =(id.cli p.i.moves) - ?=({$diff $sole-effect *} q.i.moves) - == - [p.mor [+>.q.i.moves q.mor]] - [[i.moves p.mor] q.mor] - ::x flop moves, flop and squash sole-effects into a %mor. - =+ :* moz=(flop p.yop) - ^= foc ^- (unit sole-effect) - ?~ q.yop ~ - ?~(t.q.yop `i.q.yop `[%mor (flop `(list sole-effect)`q.yop)]) - == - ?~ foc - moz - ?~ id.cli - ~& %reader-no-sole - moz - ::x produce moves or sole-effects and moves. + :: seperate our sole-effects from other moves. + =/ yop + |- ^- (pair (list move) (list sole-effect)) + ?~ moves [~ ~] + =+ mor=$(moves t.moves) + ?: ?& =(id.cli p.i.moves) + ?=({$diff $sole-effect *} q.i.moves) + == + [p.mor [+>.q.i.moves q.mor]] + [[i.moves p.mor] q.mor] + :: flop moves, flop and squash sole-effects into a %mor. + =+ moz=(flop p.yop) + =/ foc/(unit sole-effect) + ?~ q.yop ~ + ?~ t.q.yop `i.q.yop ::< single sole-effect + `[%mor (flop q.yop)] ::< more sole-effects + :: produce moves or sole-effects and moves. + ?~ foc moz + ?~ id.cli ~&(%reader-no-sole moz) [[id.cli %diff %sole-effect u.foc] moz] :: - ++ ra-reaction - ::x process a talk reaction. + ++ ta-reaction ::< apply reaction + ::> processes a talk reaction. :: |= rac/reaction ^+ +> - sh-abet:(~(sh-reaction sh cli (main our.hid)) rac) + sh-done:(~(sh-reaction sh cli (main our.bol)) rac) :: - ++ ra-low - ::x process a talk lowdown + ++ ta-low ::< apply lowdown + ::> processes a talk lowdown :: |= low/lowdown ^+ +> ?- -.low - $glyph (ra-low-glyph +.low) - $names (ra-low-names +.low) - $confs (ra-low-confs +.low) - $precs (ra-low-precs +.low) - $grams (ra-low-grams +.low) + $glyph (ta-low-glyph +.low) + $names (ta-low-names +.low) + $confs (ta-low-confs +.low) + $precs (ta-low-precs +.low) + $grams (ta-low-grams +.low) == :: - ++ ra-low-glyph - ::x apply new set of glyph bindings. + ++ ta-low-glyph ::< apply changed glyphs + ::x applies new set of glyph bindings. :: |= nek/_nak ^+ +> - ?: =(nek nak) - +> + ?: =(nek nak) +> :: no change =. nak nek - =. nik %- ~(gas by *(map (set partner) char)) - =- (zing `(list (list {(set partner) char}))`-) - %+ turn (~(tap by nek)) - |= {a/char b/(set (set partner))} - (turn (~(tap by b)) |=(c/(set partner) [c a])) - sh-abet:~(sh-prod sh cli (main our.hid)) + =. nik + %- ~(gas by *(map (set partner) char)) + =- (zing -) + %+ turn (~(tap by nek)) + |= {a/char b/(set (set partner))} + (turn (~(tap by b)) |=(c/(set partner) [c a])) + sh-done:~(sh-prod sh cli (main our.bol)) :: - ++ ra-low-names - ::x apply new local identities. + ++ ta-low-names ::< apply changed names + ::> applies new local identities. :: |= nas/(map ship (unit human)) ^+ +> - %= +> folks + %= +> + folks %- ~(gas by *(map ship human)) %+ murn =< $ @@ -191,33 +220,37 @@ ~(uni by `_nas`(~(run by folks) some)) == |= {s/ship h/(unit human)} - ?~ h ~ - (some [s u.h]) + ?~(h ~ (some [s u.h])) == :: - ++ ra-low-confs + ++ ta-low-confs ::< apply changed confs + ::> applies new station configurations. + ::> because of how this reader only subscribes to + ::> the main mailbox, {coy} is always the mailbox's + ::> config. + :: |= {coy/(unit config) cofs/(map station (unit config))} ^+ +> - ::x if possible, update sources. if we do, and we gain new ones, update - ::x the prompt. (this is to remove the mailbox from the audience after - ::x creating or joining a new station.) + ::> if possible, update {sources}. if we do, and we + ::> gain new ones, update the prompt. (this is to + ::> remove the mailbox from the audience after + ::> creating or joining a new station.) ?~ coy ~&(%mailbox-gone !!) =. +> ::TODO =? ?~ (~(dif in sources.u.coy) sources) +>.$ - =< sh-abet - %- ~(sh-pact sh(sources sources.u.coy) cli (main our.hid)) + =< sh-done + %- ~(sh-pact sh(sources sources.u.coy) cli (main our.bol)) (~(dif in sources.u.coy) sources) =. sources sources.u.coy - =. cofs (~(put by cofs) [our.hid (main our.hid)] coy) + =. cofs (~(put by cofs) [our.bol (main our.bol)] coy) + :: print changes for each config. =. +>.$ - =< sh-abet + =< sh-done %+ roll (~(tap by cofs)) |= {{s/station c/(unit config)} core/_sh} - (~(sh-low-config core cli (main our.hid)) s (~(get by mirrors) s) c) - ::TODO fix sh-low-remco to print properly. - ::TODO actually delete ~ configs. - ::=/ cogs/_mirrors (~(run by cofs) |=(a/(unit config) (fall a *config))) - ::=. +>.$ sh-abet:(~(sh-low-remco sh cli (main our.hid)) mirrors cogs) + %^ ~(sh-low-config core cli (main our.bol)) + s (~(get by mirrors) s) c + :: apply config changes to {mirrors}. =. mirrors %- ~(gas by *_mirrors) %+ murn (~(tap by cofs)) @@ -226,54 +259,60 @@ ?~(c ~ `[s u.c]) +>.$ :: - ++ ra-low-precs - ::x applies new presences. other clients might care for tas, but we're only - ::x ever getting this for the mailbox, where we're the only ones present. + ++ ta-low-precs ::< apply changed precs + ::> applies new presences. + ::> other clients might care for {tas}, but we're + ::> only ever getting this for the mailbox, where + ::> we're the only ones present. :: |= {tas/atlas pas/(map partner atlas)} ^+ +> - =/ ner/_remotes - :: per-partner uni. + =/ ner/_remotes :: per-partner uni %- ~(urn by pas) |= {p/partner a/atlas} =+ o=(~(get by remotes) p) ?~(o a (~(uni by u.o) a)) - :: then fill in the gaps with what we know. - =. ner (~(uni by remotes) ner) - ?: =(remotes ner) +>.$ - =. +>.$ sh-abet:(~(sh-low-rempe sh cli (main our.hid)) remotes ner) + =. ner (~(uni by remotes) ner) :: fill in the gaps + ?: =(remotes ner) +>.$ :: no change + =. +>.$ + =< sh-done + %+ ~(sh-low-rempe sh cli (main our.bol)) + remotes ner +>.$(remotes ner) :: - ++ ra-low-grams - ::x apply new grams + ++ ta-low-grams ::< apply messages + ::> applies new or changed telegrams. :: |= {num/@ud gams/(list telegram)} ^+ +> - =. +>.$ sh-abet:(~(sh-low-grams sh cli (main our.hid)) num gams) - (ra-lesson gams) + =. +>.$ + =< sh-done + %+ ~(sh-low-grams sh cli (main our.bol)) + num gams + (ta-lesson gams) :: - ++ ra-emil :: ra-emit move list - ::x adds multiple moves to the core's list. flops to emulate ++ra-emit. + ++ ta-emil :: ta-emit move list + ::x adds multiple moves to the core's list. flops to emulate ++ta-emit. :: |= mol/(list move) %_(+> moves (welp (flop mol) moves)) :: - ++ ra-emit :: emit a move + ++ ta-emit :: emit a move ::x adds a move to the core's list. :: |= mov/move %_(+> moves [mov moves]) :: - ++ ra-sole + ++ ta-sole ::x applies sole-action. :: |= act/sole-action ^+ +> - ?. =(id.cli ost.hid) + ?. =(id.cli ost.bol) ~&(%strange-sole !!) - sh-abet:(~(sh-sole sh cli (main our.hid)) act) + sh-done:(~(sh-sole sh cli (main our.bol)) act) :: - ++ ra-console + ++ ta-console ::x make a shell for her. :: |= {her/ship pax/path} @@ -285,29 +324,29 @@ {@ta $~} i.pax == =/ she/shell - %*(. *shell id ost.hid, active (sy [%& our.hid man] ~)) - sh-abet:~(sh-prod sh she man) + %*(. *shell id ost.bol, active (sy [%& our.bol man] ~)) + sh-done:~(sh-prod sh she man) :: - ++ ra-init + ++ ta-init ::x populate state on first boot. subscribes to our broker. :: - %- ra-emit - :* ost.hid + %- ta-emit + :* ost.bol %peer / ::x return/diff path - (broker our.hid) - /reader/(main our.hid) ::x peer path + (broker our.bol) + /reader/(main our.bol) ::x peer path == :: - ++ ra-lesson :: learn multiple + ++ ta-lesson :: learn multiple ::x learn all telegrams in a list. :: |= gaz/(list telegram) ^+ +> ?~ gaz +> - $(gaz t.gaz, +> (ra-learn i.gaz)) + $(gaz t.gaz, +> (ta-learn i.gaz)) :: - ++ ra-learn :: learn message + ++ ta-learn :: learn message ::x store an incoming telegram, modifying audience to say we received it. ::x update existing telegram if it already exists. :: @@ -315,10 +354,10 @@ ^+ +> =+ old=(~(get by known) p.q.gam) ?~ old - (ra-append gam) ::x add - (ra-revise u.old gam) ::x modify + (ta-append gam) ::x add + (ta-revise u.old gam) ::x modify :: - ++ ra-append :: append new gram + ++ ta-append :: append new gram ::x add gram to our story, and update our subscribers. :: |= gam/telegram @@ -329,7 +368,7 @@ known (~(put by known) p.q.gam count) == :: - ++ ra-revise :: revise existing gram + ++ ta-revise :: revise existing gram ::x modify a gram in our story, and update our subscribers. :: |= {num/@ud gam/telegram} @@ -362,7 +401,7 @@ ++ expr :: [cord twig] |= tub/nail %. tub %+ stag (crip q.tub) - wide:(vang & [&1:% &2:% (scot %da now.hid) |3:%]) + wide:(vang & [&1:% &2:% (scot %da now.bol) |3:%]) :: ++ dare :: @dr %+ sear @@ -389,9 +428,9 @@ :: ++ stan :: station ;~ pose - (cold [our.hid (main our.hid)] col) - ;~(pfix cen (stag our.hid sym)) - ;~(pfix fas (stag (sein our.hid) sym)) + (cold [our.bol (main our.bol)] col) + ;~(pfix cen (stag our.bol sym)) + ;~(pfix fas (stag (sein our.bol) sym)) :: %+ cook |= {a/@p b/(unit term)} @@ -523,31 +562,31 @@ (stag %number (cook lent (star sem))) == -- - ++ sh-abet + ++ sh-done ::x stores changes to the cli. :: ^+ +> ::x points to ++sh's |_ core's context. +>(cli she) :: ++ sh-fact :: send console effect - ::x adds a console effect to ++ra's moves. + ::x adds a console effect to ++ta's moves. :: |= fec/sole-effect ^+ +> +>(moves :_(moves [id.she %diff %sole-effect fec])) :: - ++ sh-action - ::x adds a talk-action to ++ra's moves + ++ sh-act + ::x adds a talk-action to ++ta's moves :: |= act/action ^+ +> %= +> moves :_ moves - :* ost.hid + :* ost.bol %poke /reader/action - (broker our.hid) + (broker our.bol) [%talk-action act] == == @@ -563,7 +602,7 @@ [['[' ']'] active.she] =+ cha=(~(get by nik) q.rew) ?^ cha ~[u.cha ' '] - =+ por=~(te-prom te man q.rew) + =+ por=~(ar-prom ar man q.rew) (weld `tape`[p.p.rew por] `tape`[q.p.rew ' ' ~]) :: ++ sh-pact :: update active aud @@ -581,7 +620,7 @@ :: |= paz/(set partner) ?: (sh-pear paz) paz - (~(put in paz) [%& our.hid (main our.hid)]) + (~(put in paz) [%& our.bol (main our.bol)]) :: ++ sh-pear :: hearback ::x produces true if any partner is included in our subscriptions, @@ -596,7 +635,7 @@ :: ++ sh-pest :: report listen ::x updates audience to be tay, only if tay is not a village/%white. - ::x? why exclude village (invite-only?) audiences from this? + ::x? why exclude village (inviar-only?) audiences from this? :: ::TODO does this still do the correct thing? |= tay/partner @@ -759,12 +798,12 @@ |- ^+ +>.^$ ?~ old +>.^$ =. +>.^$ $(old t.old) - (sh-note (weld pre "off {~(ta-full ta man i.old)}")) + (sh-note (weld pre "off {~(pr-full pr man i.old)}")) =. +>.$ |- ^+ +>.^$ ?~ new +>.^$ =. +>.^$ $(new t.new) - (sh-note (weld pre "hey {~(ta-full ta man i.new)}")) + (sh-note (weld pre "hey {~(pr-full pr man i.new)}")) +>.$ :: ++ sh-low-config-show @@ -798,7 +837,7 @@ ?~ old ~&([%new-conf sat] +>) ?~ new ~&([%del-conf sat] +>) ::TODO tmp %^ sh-low-config-show - (weld ~(sn-phat sn man sat) ": ") + (weld ~(sr-phat sr man sat) ": ") u.old u.new :: ++ sh-low-remco @@ -813,14 +852,14 @@ =. +>.^$ $(new t.new) =. +>.^$ (sh-pest [%& p.i.new]) %+ sh-low-config-show - (weld ~(sn-phat sn man p.i.new) ": ") + (weld ~(sr-phat sr man p.i.new) ": ") [*config q.i.new] =. +>.$ |- ^+ +>.^$ ?~ cha +>.^$ =. +>.^$ $(cha t.cha) %+ sh-low-config-show - (weld ~(sn-phat sn man p.i.cha) ": ") + (weld ~(sr-phat sr man p.i.cha) ": ") [(~(got by ole) `station`p.i.cha) q.i.cha] +>.$ :: @@ -910,20 +949,20 @@ |- ^+ +>.^$ ?~ old.day +>.^$ =. +>.^$ $(old.day t.old.day) - (sh-note (weld "not " (~(ta-show ta man p.i.old.day) ~))) + (sh-note (weld "not " (~(pr-show pr man p.i.old.day) ~))) =. +>.$ |- ^+ +>.^$ ?~ new.day +>.^$ =. +>.^$ $(new.day t.new.day) =. +>.^$ - (sh-note (weld "new " (~(ta-show ta man p.i.new.day) ~))) + (sh-note (weld "new " (~(pr-show pr man p.i.new.day) ~))) (sh-low-precs-diff "--" ~ (~(tap by q.i.new.day)) ~) =. +>.$ |- ^+ +>.^$ ?~ cha.day +>.^$ =. +>.^$ $(cha.day t.cha.day) =. +>.^$ - (sh-note (weld "for " (~(ta-show ta man p.i.cha.day) ~))) + (sh-note (weld "for " (~(pr-show pr man p.i.cha.day) ~))) =+ yez=(~(got by old) p.i.cha.day) %+ sh-low-precs-diff "--" (sh-low-atlas-diff yez q.i.cha.day) @@ -1057,7 +1096,7 @@ ++ sh-twig-head ^- vase :: eval data ::x makes a vase of environment data to evaluate against (#-messages). :: - !>(`{our/@p now/@da eny/@uvI}`[our.hid now.hid (shas %eny eny.hid)]) + !>(`{our/@p now/@da eny/@uvI}`[our.bol now.bol (shas %eny eny.bol)]) :: ++ sh-work :: do work ::x implements worker arms for different talk commands. @@ -1069,27 +1108,31 @@ |% ++ work ?- -.job - $number (number +.job) - $leave (leave +.job) + :: station management $join (join +.job) - $eval (eval +.job) - $who (who +.job) - $what (what +.job) - $bind (bind +.job) - $unbind (unbind +.job) - $invite (invite +.job) - $banish (banish +.job) + $leave (leave +.job) $create (create +.job) + $delete (delete +.job) $depict (depict +.job) $source (source +.job) - $delete (delete +.job) + $invite (invite +.job) + $banish (banish +.job) + :: messaging + $say (say +.job) + $eval (eval +.job) + $target (target +.job) + :: displaying info + $number (number +.job) + $who (who +.job) + $what (what +.job) + :: ui settings + $bind (bind +.job) + $unbind (unbind +.job) $nick (nick +.job) $set (wo-set +.job) $unset (unset +.job) - $target (target +.job) - $probe (probe +.job) + :: miscelaneous $help help - $say (say +.job) == :: ++ activate :: from %number @@ -1119,14 +1162,14 @@ =: nik (~(put by nik) lix cha) nak (~(put ju nak) cha lix) == - (sh-action %glyph cha lix &) + (sh-act %glyph cha lix &) :: ++ unset-glyph |= {cha/char lix/(unit (set partner))} =/ ole/(set (set partner)) ?^ lix [u.lix ~ ~] (~(get ju nak) cha) - =. ..sh-work (sh-action %glyph cha (fall lix ~) |) + =. ..sh-work (sh-act %glyph cha (fall lix ~) |) |- ^+ ..sh-work ?~ ole ..sh-work =. ..sh-work $(ole l.ole) @@ -1146,16 +1189,16 @@ (sh-note:(set-glyph cha pan) "new glyph {}") =. ..sh-work sh-prod(active.she pan) - =+ loc=(~(got by mirrors) [our.hid man]) + =+ loc=(~(got by mirrors) [our.bol man]) ::x change local mailbox config to include subscription to pan. - (sh-action %source man & pan) + (sh-act %source man & pan) :: ++ leave :: %leave |= pan/(set partner) ^+ ..sh-work - =+ loc=(~(got by mirrors) [our.hid man]) + =+ loc=(~(got by mirrors) [our.bol man]) ::x change local mailbox config to exclude subscription to pan. - (sh-action %source man | pan) + (sh-act %source man | pan) :: ++ what :: %what |= qur/$@(char (set partner)) ^+ ..sh-work @@ -1165,7 +1208,7 @@ =+ pan=(~(tap in (~(get ju nak) qur))) ?: =(~ pan) (sh-fact %txt "~") =< (sh-fact %mor (turn pan .)) - |=(a/(set partner) [%txt ]) :: XX ~(te-whom te man.she a) + |=(a/(set partner) [%txt ]) :: XX ~(ar-whom ar man.she a) :: ++ who :: %who |= pan/(set partner) ^+ ..sh-work @@ -1173,7 +1216,7 @@ =< (sh-fact %mor (murn (sort (~(tap by remotes) ~) aor) .)) |= {pon/partner alt/atlas} ^- (unit sole-effect) ?. |(=(~ pan) (~(has in pan) pon)) ~ - =- `[%tan rose+[", " `~]^- leaf+~(ta-full ta man pon) ~] + =- `[%tan rose+[", " `~]^- leaf+~(pr-full pr man pon) ~] =< (murn (sort (~(tap by alt)) aor) .) |= {a/ship b/presence c/human} ^- (unit tank) =. c @@ -1203,36 +1246,37 @@ ++ invite :: %invite |= {nom/knot sis/(set ship)} ^+ ..sh-work - (sh-action %permit nom & sis) + (sh-act %permit nom & sis) :: ++ banish :: %banish |= {nom/knot sis/(set ship)} ^+ ..sh-work - (sh-action %permit nom | sis) + (sh-act %permit nom | sis) :: ++ create :: %create |= {por/posture nom/knot txt/cord} ^+ ..sh-work - ?: (~(has in mirrors) [our.hid nom]) + ::TODO simplify? + ?: (~(has in mirrors) [our.bol nom]) (sh-lame "{(trip nom)}: already exists") =. ..sh-work - (sh-action %create nom txt por) - (join [[%& our.hid nom] ~ ~]) + (sh-act %create nom txt por) + (join [[%& our.bol nom] ~ ~]) :: ++ depict |= {nom/knot txt/cord} ^+ ..sh-work - (sh-action %depict nom txt) + (sh-act %depict nom txt) :: ++ source |= {nom/knot pas/(set partner)} ^+ ..sh-work - (sh-action %source nom & pas) + (sh-act %source nom & pas) :: ++ delete |= {nom/knot say/(unit cord)} ^+ ..sh-work - (sh-action %delete nom say) + (sh-act %delete nom say) :: ++ reverse-folks |= nym/knot @@ -1270,7 +1314,7 @@ |= p/ship [%txt "{

}: {}"] %. [%human u.her [true=~ hand=nym]] - %= sh-action + %= sh-act folks ?~ u.nym (~(del by folks) u.her) ::x unset nickname (~(put by folks) u.her [true=~ hand=nym]) ::x set nickname @@ -1325,13 +1369,6 @@ =- ?:((lte - max) - (sub - dog)) (add fin (sub max (mod max dog))) :: - ++ probe :: inquire - ::TODO? what's this? unused... - |= cuz/station - ^+ ..sh-work - ~& [%probe cuz] - ..sh-work - :: ++ eval :: run |= {txt/cord exe/twig} => |.([(sell (slap (slop sh-twig-head seed) exe))]~) @@ -1341,10 +1378,10 @@ ++ say :: publish |= sep/(list speech) ^+ ..sh-work - (sh-action %phrase active.she sep) + (sh-act %phrase active.she sep) -- :: - ++ sh-done :: apply result + ++ sh-obey :: apply result ::x called upon hitting return in the prompt. if input is invalid, ::x ++sh-slug is called. otherwise, the appropriate work is done ::x and the entered command (if any) gets displayed to the user. @@ -1375,24 +1412,24 @@ ?- -.act $det (sh-stir +.act) $clr ..sh-sole :: (sh-pact ~) :: XX clear to PM-to-self? - $ret sh-done + $ret sh-obey == :: ++ sh-uniq ::x generates a new serial. :: ^- {serial _.} - [(shaf %serial eny.hid) .(eny.hid (shax eny.hid))] + [(shaf %serial eny.bol) .(eny.bol (shax eny.bol))] -- -- :: -++ sn :: station render core +++ sr :: station render core ::x used in both station and ship rendering. :: ::x man: mailbox. ::x one: the station. |_ {man/knot one/station} - ++ sn-best :: best to show + ++ sr-best :: best to show ::x returns true if one is better to show, false otherwise. ::x prioritizes: our > main > size. ::TODO maybe simplify. (lth (xeb (xeb p.one)) (xeb (xeb p.two))) @@ -1400,8 +1437,8 @@ |= two/station ^- ? ::x the station that's ours is better. - ?: =(our.hid p.one) - ?: =(our.hid p.two) + ?: =(our.bol p.one) + ?: =(our.bol p.two) ?< =(q.one q.two) ::x if both stations are ours, the main story is better. ?: =((main p.one) q.one) %& @@ -1410,7 +1447,7 @@ (lth q.one q.two) %& ::x if one isn't ours but two is, two is better. - ?: =(our.hid p.two) + ?: =(our.bol p.two) %| ?: =(p.one p.two) ::x if they're from the same ship, pick the "larger" one. @@ -1420,7 +1457,7 @@ ::x this still seems pretty arbitrary. (lth p.one q.one) :: - ++ sn-curt :: render name in 14 + ++ sr-curt :: render name in 14 ::x prints a ship name in 14 characters. left-pads with spaces. ::x mup signifies "are there other targets besides this one" :: @@ -1429,30 +1466,30 @@ =+ raw=(cite p.one) (runt [(sub 14 (lent raw)) ' '] raw) :: - ++ sn-nick + ++ sr-nick ::x get nick for ship, or shortname if no nick. left-pads with spaces. :: |. ^- tape =+ nym=(~(get by folks) p.one) ?~ nym - (sn-curt |) + (sr-curt |) ?~ hand.u.nym - (sn-curt |) + (sr-curt |) =+ raw=(trip u.hand.u.nym) =+ len=(sub 14 (lent raw)) (weld (reap len ' ') raw) :: - ++ sn-phat :: render accurately + ++ sr-phat :: render accurately ::x prints a station fully, but still taking "shortcuts" where possible: ::x ":" for local mailbox, "~ship" for foreign mailbox, ::x "%channel" for local station, "/channel" for parent station. :: ^- tape - ?: =(p.one our.hid) + ?: =(p.one our.bol) ?: =(q.one man) ":" ['%' (trip q.one)] - ?: =(p.one (sein our.hid)) + ?: =(p.one (sein our.bol)) ['/' (trip q.one)] =+ wun=(scow %p p.one) ?: =(q.one (main p.one)) @@ -1460,15 +1497,15 @@ :(welp wun "/" (trip q.one)) -- :: -++ ta :: partner core +++ pr :: partner render core ::x used primarily for printing partners. :: ::x man: mailbox. ::x one: the partner. |_ {man/knot one/partner} - ++ ta-beat :: more relevant + ++ pr-beat :: more relevant ::x returns true if one is better to show, false otherwise. - ::x prefers stations over passports. if both are stations, sn-best. if both + ::x prefers stations over passports. if both are stations, sr-best. if both ::x are passports, pick the "larger" one, if they're equal, content hash. :: |= two/partner ^- ? @@ -1476,7 +1513,7 @@ $& ?- -.two $| %& - $& (~(sn-best sn man p.one) p.two) + $& (~(sr-best sr man p.one) p.two) == :: $| @@ -1487,12 +1524,12 @@ (lth -.p.two -.p.one) == == - ++ ta-best :: most relevant + ++ pr-best :: most relevant ::x picks the most relevant partner. :: - |=(two/partner ?:((ta-beat two) two one)) + |=(two/partner ?:((pr-beat two) two one)) :: - ++ ta-sigh :: assemble label + ++ pr-sigh :: assemble label ::x prepend pre to yiz, omitting characters of yiz to stay within len. :: |= {len/@ud pre/tape yiz/cord} @@ -1507,8 +1544,8 @@ (runt [(sub len lez) '-'] nez) :(welp pre (scag (dec len) nez) "+") :: - ++ ta-full (ta-show ~) :: render full width - ++ ta-show :: render partner + ++ pr-full (pr-show ~) :: render full width + ++ pr-show :: render partner ::x renders a partner as text. :: |= moy/(unit ?) @@ -1519,8 +1556,8 @@ ?~ moy =+ cha=(~(get by nik) one ~ ~) =- ?~(cha - "'{u.cha ~}' {-}") - ~(sn-phat sn man p.one) - (~(sn-curt sn man p.one) u.moy) + ~(sr-phat sr man p.one) + (~(sr-curt sr man p.one) u.moy) :: ::x render passport. $| @@ -1531,80 +1568,80 @@ ?~ moy (weld pre (trip p.p.one)) =. pre ?.(=(& u.moy) pre ['*' pre]) - (ta-sigh 14 pre p.p.one) + (pr-sigh 14 pre p.p.one) == -- :: -++ te :: audience renderer +++ ar :: audience renderer ::x used for representing audiences (sets of partners) as tapes. :: :: man: mailbox. :: lix: members of the audience. |_ {man/knot lix/(set partner)} - ++ te-best ^- (unit partner) + ++ ar-best ^- (unit partner) ::x pick the most relevant partner. :: ?~ lix ~ :- ~ |- ^- partner - =+ lef=`(unit partner)`te-best(lix l.lix) - =+ rit=`(unit partner)`te-best(lix r.lix) - =. n.lix ?~(lef n.lix (~(ta-best ta man n.lix) u.lef)) - =. n.lix ?~(rit n.lix (~(ta-best ta man n.lix) u.rit)) + =+ lef=`(unit partner)`ar-best(lix l.lix) + =+ rit=`(unit partner)`ar-best(lix r.lix) + =. n.lix ?~(lef n.lix (~(pr-best pr man n.lix) u.lef)) + =. n.lix ?~(rit n.lix (~(pr-best pr man n.lix) u.rit)) n.lix :: - ++ te-deaf ^+ . :: except for self + ++ ar-deaf ^+ . :: except for self ::x remove ourselves from the audience. :: - .(lix (~(del in lix) `partner`[%& our.hid man])) + .(lix (~(del in lix) `partner`[%& our.bol man])) :: - ++ te-maud ^- ? :: multiple audience + ++ ar-maud ^- ? :: multiple audience ::x checks if there's multiple partners in the audience via pattern match. :: - =. . te-deaf + =. . ar-deaf !?=($@($~ {* $~ $~}) lix) :: - ++ te-prom ^- tape :: render targets + ++ ar-prom ^- tape :: render targets ::x render all partners, ordered by relevance. :: - =. . te-deaf + =. . ar-deaf =+ ^= all %+ sort `(list partner)`(~(tap in lix)) |= {a/partner b/partner} - (~(ta-beat ta man a) b) + (~(pr-beat pr man a) b) =+ fir=& |- ^- tape ?~ all ~ ;: welp ?:(fir "" " ") - (~(ta-show ta man i.all) ~) + (~(pr-show pr man i.all) ~) $(all t.all, fir |) == :: - ++ te-whom :: render sender + ++ ar-whom :: render sender ::x render sender as the most relevant partner. :: - (~(ta-show ta man (need te-best)) ~ te-maud) + (~(pr-show pr man (need ar-best)) ~ ar-maud) :: - ++ ta-dire :: direct message + ++ pr-dire :: direct message ::x returns true if partner is a mailbox of ours. :: |= pan/partner ^- ? ?& ?=($& -.pan) - =(p.p.pan our.hid) + =(p.p.pan our.bol) :: =+ sot=(~(get by mirrors) +.pan) &(?=(^ sot) ?=($brown p.cordon.u.sot)) == :: - ++ te-pref :: audience glyph + ++ ar-pref :: audience glyph ::x get the glyph that corresponds to the audience, with a space appended. ::x if it's a dm to us, use :. if it's a dm by us, use ;. complex, use *. :: ^- tape =+ cha=(~(get by nik) lix) ?^ cha ~[u.cha ' '] - ?. (lien (~(tap by lix)) ta-dire) + ?. (lien (~(tap by lix)) pr-dire) "* " ?: ?=({{$& ^} $~ $~} lix) ": " @@ -1645,16 +1682,16 @@ ::x crams a telegram into a single line by displaying a short ship name, ::x a short representation of the gram, and an optional timestamp. :: - =+ txt=(tr-text =(who our.hid)) + =+ txt=(tr-text =(who our.bol)) ?: =(~ txt) "" =+ ^= baw :: ?: oug - :: ~(te-whom te man tr-pals) + :: ~(ar-whom ar man tr-pals) ?. (~(has in sef) %noob) - (~(sn-curt sn man [who (main who)]) |) - (~(sn-nick sn man [who (main who)])) + (~(sr-curt sr man [who (main who)]) |) + (~(sr-nick sr man [who (main who)])) ?: (~(has in sef) %showtime) - =+ dat=(yore now.hid) + =+ dat=(yore now.bol) =+ ^= t |= a/@ ^- tape %+ weld @@ -1671,7 +1708,7 @@ =. wen (sub wen (mod wen (div wen ~s0..0001))) :: round =+ hed=leaf+"{(scow %uv sen)} at {(scow %da wen)}" =+ =< paz=(turn (~(tap by aud)) .) - |=({a/partner *} leaf+~(ta-full ta man a)) + |=({a/partner *} leaf+~(pr-full pr man a)) =+ bok=(turn (sort (~(tap in bou)) aor) smyt) [%rose [" " ~ ~] [hed >who< [%rose [", " "to " ~] paz] bok]]~ :: @@ -1695,7 +1732,7 @@ ?: p.sep "you have been invited to " "you have been banished from " - ~(sn-phat sn man q.sep) + ~(sr-phat sr man q.sep) $api :- %tan :_ ~ @@ -1779,9 +1816,9 @@ =+ txt=(trip q.sep) ?: p.sep =+ pal=tr-pals - =. pal ?: =(who our.hid) pal + =. pal ?: =(who our.bol) pal (~(del in pal) [%& who (main who)]) - (weld ~(te-pref te man pal) txt) + (weld ~(ar-pref ar man pal) txt) (weld " " txt) :: $inv @@ -1789,7 +1826,7 @@ ?: p.sep " invited you to " " banished you from " - ~(sn-phat sn man q.sep) + ~(sr-phat sr man q.sep) :: $app (tr-chow 64 "[{(trip p.sep)}]: {(trip q.sep)}") @@ -1804,13 +1841,13 @@ :: |= pax/path ^- (quip move +>) - ?. (team src.hid our.hid) - ~& [%peer-talk-reader-stranger src.hid] + ?. (team src.bol our.bol) + ~& [%peer-talk-reader-stranger src.bol] [~ +>] ?. ?=({$sole *} pax) ~& [%peer-talk-reader-strange pax] [~ +>] - ra-abet:(ra-console:ra src.hid t.pax) + ta-done:(ta-console:ta src.bol t.pax) :: ++ diff-talk-lowdown ::x incoming talk-lowdown. process it. @@ -1819,29 +1856,20 @@ ::x don't bother. :: |= {way/wire low/lowdown} - ra-abet:(ra-low:ra low) + ta-done:(ta-low:ta low) :: ++ diff-talk-reaction :: accept reaction ::x incoming talk reaction. process it. :: |= {way/wire rac/reaction} - ?. =(src.hid -:(broker our.hid)) - ~& [%diff-reaction-stranger src.hid] + ?. =(src.bol -:(broker our.bol)) + ~& [%diff-reaction-stranger src.bol] [~ +>] - ra-abet:(ra-reaction:ra rac) + ta-done:(ta-reaction:ta rac) :: ++ poke-sole-action :: accept console ::x incoming sole action. process it. :: |= act/sole-action - ra-abet:(ra-sole:ra act) -:: -++ prep - ::x state adapter. - :: - |= old/*::(unit chattel) - ::^- (quip move ..prep) - ::?~ old - ra-abet:ra-init:ra - ::[~ ..prep(+<+ u.old)] + ta-done:(ta-sole:ta act) -- From 0a4d5e9b3be3da68fef5c0aa72cd2685d0391708 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 24 Apr 2017 17:30:01 +0200 Subject: [PATCH 078/303] Completed the cleanup of talk-agent. Refactoring, renaming, reordering. Removes man/knot from all cores, replaced with calls to ++inbox. --- app/talk-agent.hoon | 2286 ++++++++++++++++++++++++------------------- 1 file changed, 1281 insertions(+), 1005 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 1b572d2d9f..dcea570da3 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -6,12 +6,13 @@ ::TODO make sure glyphs get unbound when joins etc don't succeed. ::TODO correct/clean up presence/config change notifications :: -::TODO remove man from door sample where it's always (main our.bol). ::TODO maybe keep track of received grams per partner, too? :: -::> This reader implementation makes use of the mailbox for all its -::> subscriptions and messaging. All lowdowns received are exclusively about -::> the mailbox, since that's the only thing the reader ever subscribes to. +::> This reader implementation makes use of the mailbox +::> for all its subscriptions and messaging. All +::> lowdowns received are exclusively about the mailbox, +::> since that's the only thing the reader ever +::> subscribes to. :: /? 310 ::< hoon version /- talk, sole ::< structures @@ -87,7 +88,7 @@ {$nick p/(unit ship) q/(unit cord)} ::< un/set/show nick {$set p/knot} ::< enable setting {$unset p/knot} ::< disable setting - :: miscelaneous :: + :: miscellaneous :: {$help $~} ::< print usage info == :: ++ where (set partner) ::< non-empty audience @@ -123,6 +124,11 @@ our (sein our) :: +++ inbox ::< reader's station + ::> produces the name of the station used by this + ::> reader for all its operations + (main our.bol) +:: ::> || ::> || %engines ::> || @@ -170,12 +176,48 @@ ?~ id.cli ~&(%reader-no-sole moz) [[id.cli %diff %sole-effect u.foc] moz] :: + ::> || + ::> || %emitters + ::> || + ::> arms that create outward changes. + ::+| + :: + ++ ta-emil ::< emit move list + ::> adds multiple moves to the core's list. + ::> flops to emulate ++ta-emit. + :: + |= mol/(list move) + %_(+> moves (welp (flop mol) moves)) + :: + ++ ta-emit ::< emit a move + ::> adds a move to the core's list. + :: + |= mov/move + %_(+> moves [mov moves]) + :: + ::> || + ::> || %interaction-events + ::> || + ::> arms that apply events we received. + ::+| + :: + ++ ta-init ::< initialize app + ::> subscribes to our broker. + :: + %- ta-emit + :* ost.bol + %peer + / ::< return/diff path + (broker our.bol) + /reader/[inbox] ::< peer path + == + :: ++ ta-reaction ::< apply reaction ::> processes a talk reaction. :: |= rac/reaction ^+ +> - sh-done:(~(sh-reaction sh cli (main our.bol)) rac) + sh-done:(~(sh-reaction sh cli) rac) :: ++ ta-low ::< apply lowdown ::> processes a talk lowdown @@ -191,7 +233,7 @@ == :: ++ ta-low-glyph ::< apply changed glyphs - ::x applies new set of glyph bindings. + ::> applies new set of glyph bindings. :: |= nek/_nak ^+ +> @@ -203,7 +245,7 @@ %+ turn (~(tap by nek)) |= {a/char b/(set (set partner))} (turn (~(tap by b)) |=(c/(set partner) [c a])) - sh-done:~(sh-prod sh cli (main our.bol)) + sh-done:~(sh-prod sh cli) :: ++ ta-low-names ::< apply changed names ::> applies new local identities. @@ -239,16 +281,16 @@ =. +> ::TODO =? ?~ (~(dif in sources.u.coy) sources) +>.$ =< sh-done - %- ~(sh-pact sh(sources sources.u.coy) cli (main our.bol)) + %- ~(sh-pact sh(sources sources.u.coy) cli) (~(dif in sources.u.coy) sources) =. sources sources.u.coy - =. cofs (~(put by cofs) [our.bol (main our.bol)] coy) + =. cofs (~(put by cofs) [our.bol inbox] coy) :: print changes for each config. =. +>.$ =< sh-done %+ roll (~(tap by cofs)) |= {{s/station c/(unit config)} core/_sh} - %^ ~(sh-low-config core cli (main our.bol)) + %^ ~(sh-low-config core cli) s (~(get by mirrors) s) c :: apply config changes to {mirrors}. =. mirrors @@ -276,7 +318,7 @@ ?: =(remotes ner) +>.$ :: no change =. +>.$ =< sh-done - %+ ~(sh-low-rempe sh cli (main our.bol)) + %+ ~(sh-low-rempe sh cli) remotes ner +>.$(remotes ner) :: @@ -285,80 +327,37 @@ :: |= {num/@ud gams/(list telegram)} ^+ +> - =. +>.$ - =< sh-done - %+ ~(sh-low-grams sh cli (main our.bol)) - num gams - (ta-lesson gams) + =. +>.$ (ta-lesson gams) + =< sh-done + (~(sh-low-grams sh cli) num gams) :: - ++ ta-emil :: ta-emit move list - ::x adds multiple moves to the core's list. flops to emulate ++ta-emit. - :: - |= mol/(list move) - %_(+> moves (welp (flop mol) moves)) + ::> || + ::> || %messages + ::> || + ::> storing and updating messages. + ::+| :: - ++ ta-emit :: emit a move - ::x adds a move to the core's list. - :: - |= mov/move - %_(+> moves [mov moves]) - :: - ++ ta-sole - ::x applies sole-action. - :: - |= act/sole-action - ^+ +> - ?. =(id.cli ost.bol) - ~&(%strange-sole !!) - sh-done:(~(sh-sole sh cli (main our.bol)) act) - :: - ++ ta-console - ::x make a shell for her. - :: - |= {her/ship pax/path} - ^+ +> - ::x get story from the path, default to standard mailbox. - =/ man/knot - ?+ pax !! - $~ (main her) - {@ta $~} i.pax - == - =/ she/shell - %*(. *shell id ost.bol, active (sy [%& our.bol man] ~)) - sh-done:~(sh-prod sh she man) - :: - ++ ta-init - ::x populate state on first boot. subscribes to our broker. - :: - %- ta-emit - :* ost.bol - %peer - / ::x return/diff path - (broker our.bol) - /reader/(main our.bol) ::x peer path - == - :: - ++ ta-lesson :: learn multiple - ::x learn all telegrams in a list. + ++ ta-lesson ::< learn messages + ::> learn all telegrams in a list. :: |= gaz/(list telegram) ^+ +> ?~ gaz +> $(gaz t.gaz, +> (ta-learn i.gaz)) :: - ++ ta-learn :: learn message - ::x store an incoming telegram, modifying audience to say we received it. - ::x update existing telegram if it already exists. + ++ ta-learn ::< save/update message + ::> store an incoming telegram, updating if it + ::> already exists. :: |= gam/telegram ^+ +> =+ old=(~(get by known) p.q.gam) ?~ old - (ta-append gam) ::x add - (ta-revise u.old gam) ::x modify + (ta-append gam) ::< add + (ta-revise u.old gam) ::< modify :: - ++ ta-append :: append new gram - ::x add gram to our story, and update our subscribers. + ++ ta-append ::< append message + ::> store a new telegram. :: |= gam/telegram ^+ +> @@ -368,8 +367,8 @@ known (~(put by known) p.q.gam count) == :: - ++ ta-revise :: revise existing gram - ::x modify a gram in our story, and update our subscribers. + ++ ta-revise ::< revise message + ::> modify a telegram we know. :: |= {num/@ud gam/telegram} =+ way=(sub count num) @@ -378,57 +377,149 @@ =. grams (welp (scag (dec way) grams) [gam (slag way grams)]) +>.$ :: - ++ sh :: per console - ::x shell core, responsible for doing things with console sessions, - ::x like parsing input, acting based on input, showing output, keeping - ::x track of settings and other frontend state. - ::x important arms include ++sh-repo which is used to apply reports, and - ::x ++sh-sole which gets called upon cli prompt interaction. + ::> || + ::> || %console + ::> || + ::> arms for shell functionality. + ::+| + :: + ++ ta-console ::< initialize shell + ::> initialize the shell of this reader. :: - |_ $: ::x she: console session state used in this core. - ::x man: our mailbox + ^+ . + =/ she/shell + %*(. *shell id ost.bol, active (sy [%& our.bol inbox] ~)) + sh-done:~(sh-prod sh she) + :: + ++ ta-sole ::< apply sole input + ::> applies sole-action. + :: + |= act/sole-action + ^+ +> + ?. =(id.cli ost.bol) + ~&(%strange-sole !!) + 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. + ::> man: our mailbox :: she/shell - man/knot == - ++ sh-scad :: command parser - ::x builds a core with parsers for talk-cli, and produces its work arm. - ::x ++work uses those parsers to parse the current talk-cli prompt input - ::x and produce a work item to be executed by ++sh-work. + :: + ++ sh-done ::< resolve core + ::> stores changes to the cli. + :: + ^+ +> + +>(cli she) + :: + ::> || + ::> || %emitters + ::> || + ::> arms that create outward changes. + ::+| + :: + ++ sh-fact ::< send console effect + ::> adds a console effect to ++ta's moves. + :: + |= fec/sole-effect + ^+ +> + +>(moves [[id.she %diff %sole-effect fec] moves]) + :: + ++ sh-act ::< send action + ::> adds an aaction to ++ta's moves. + :: + |= act/action + ^+ +> + %= +> + moves + :_ moves + :* ost.bol + %poke + /reader/action + (broker our.bol) + [%talk-action act] + == + == + :: + ::> || + ::> || %cli-interaction + ::> || + ::> processing user input as it happens. + ::+| + :: + ++ sh-sole ::< apply edit + ::> applies sole action. + :: + |= act/sole-action + ^+ +> + ?- -.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 + ^+ +> + =^ inv say.she (~(transceive sole 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 twig] + ++ expr ::< [cord twig] |= tub/nail %. tub %+ stag (crip q.tub) wide:(vang & [&1:% &2:% (scot %da now.bol) |3:%]) :: - ++ dare :: @dr + ++ dare ::< @dr %+ sear |= a/coin ?. ?=({$$ $dr @} a) ~ (some `@dr`+>.a) nuck:so :: - ++ ship ;~(pfix sig fed:ag) :: ship - ++ shiz :: ship set + ++ ship ;~(pfix sig fed:ag) ::< ship + ++ shiz ::< ship set %+ cook |=(a/(list ^ship) (~(gas in *(set ^ship)) a)) (most ;~(plug com (star ace)) ship) :: - ++ pasp :: passport + ++ pasp ::< passport ;~ pfix pat ;~ pose (stag %twitter ;~(pfix (jest 't') col urs:ab)) == == :: - ++ stat :: local station + ++ stat ::< local station ;~(pfix cen sym) :: - ++ stan :: station + ++ stan ::< station ;~ pose - (cold [our.bol (main our.bol)] col) + (cold [our.bol inbox] col) ;~(pfix cen (stag our.bol sym)) ;~(pfix fas (stag (sein our.bol) sym)) :: @@ -441,12 +532,13 @@ == == :: - ++ parn :: partner + ++ parn ::< partner ;~ pose (stag %& stan) (stag %| pasp) == - ++ partners-flat :: collapse mixed list + :: + ++ partners-flat ::< collapse mixed list |= a/(list (each partner (set partner))) ^- (set partner) ?~ a ~ @@ -455,16 +547,16 @@ $| (~(uni in $(a t.a)) p.i.a) == :: - ++ para :: partners alias + ++ para ::< partners alias %+ cook partners-flat %+ most ;~(plug com (star ace)) (pick parn (sear sh-glyf glyph)) :: - ++ parz :: non-empty partners + ++ parz ::< non-empty partners %+ cook ~(gas in *(set partner)) (most ;~(plug com (star ace)) parn) :: - ++ nump :: number reference + ++ nump ::< number reference ;~ pose ;~(pfix hep dem:ag) ;~ plug @@ -474,7 +566,7 @@ (stag 0 dem:ag) == :: - ++ pore :: posture + ++ pore ::< posture ;~ pose (cold %black (jest %channel)) (cold %white (jest %village)) @@ -482,7 +574,7 @@ (cold %brown (jest %mailbox)) == :: - ++ message + ++ message ::< exp, lin or url msg ;~ pose ;~(plug (cold %eval hax) expr) :: @@ -495,30 +587,32 @@ == == :: - ++ nick (cook crip (stun [1 14] low)) :: nickname - ++ text (cook crip (plus (shim ' ' '~'))) :: bullets separating - ++ glyph (mask "/\\\{( ::x points to ++sh's |_ core's context. - +>(cli she) :: - ++ sh-fact :: send console effect - ::x adds a console effect to ++ta's moves. - :: - |= fec/sole-effect - ^+ +> - +>(moves :_(moves [id.she %diff %sole-effect fec])) - :: - ++ sh-act - ::x adds a talk-action to ++ta's moves - :: - |= act/action - ^+ +> - %= +> - moves - :_ moves - :* ost.bol - %poke - /reader/action - (broker our.bol) - [%talk-action act] - == - == - :: - ++ sh-prod :: show prompt - ::x make and store a move to modify the cli prompt, displaying audience. - :: - ^+ . - %+ sh-fact %pro - :+ & %talk-line - ^- tape - =/ rew/(pair (pair @t @t) (set partner)) - [['[' ']'] active.she] - =+ cha=(~(get by nik) q.rew) - ?^ cha ~[u.cha ' '] - =+ por=~(ar-prom ar man q.rew) - (weld `tape`[p.p.rew por] `tape`[q.p.rew ' ' ~]) - :: - ++ sh-pact :: update active aud - ::x change currently selected audience to lix, updating prompt. - :: - |= lix/(set partner) - ^+ +> - =+ act=(sh-pare lix) ::x ensure we can see what we send. - ?: =(active.she act) +>.$ - sh-prod(active.she act) - :: - ++ sh-pare :: adjust target list - ::x if the audience paz does not contain a partner we're subscribed to, - ::x add our mailbox to the audience (so that we can see our own message). - :: - |= paz/(set partner) - ?: (sh-pear paz) paz - (~(put in paz) [%& our.bol (main our.bol)]) - :: - ++ sh-pear :: hearback - ::x produces true if any partner is included in our subscriptions, - ::x aka, if we hear messages sent to paz. - :: - |= paz/(set partner) - ?~ paz | - ?| (~(has in sources) `partner`n.paz) - $(paz l.paz) - $(paz r.paz) - == - :: - ++ sh-pest :: report listen - ::x updates audience to be tay, only if tay is not a village/%white. - ::x? why exclude village (inviar-only?) audiences from this? - :: - ::TODO does this still do the correct thing? - |= tay/partner - ^+ +> - ?. ?=($& -.tay) +> ::x if partner is a passport, do nothing. - =+ cof=(~(get by mirrors) +.tay) - ?. |(?=($~ cof) !?=($white p.cordon.u.cof)) - +>.$ - (sh-pact [tay ~ ~]) - :: - ++ sh-rend :: print on one line - ::x renders a telegram as a single line, adds it as a console move, - ::x and updates the selected audience to match the telegram's. - :: - |= gam/telegram - =+ lin=~(tr-line tr man settings.she gam) - (sh-fact %txt lin) - :: - ++ sh-numb :: print msg number - ::x does as it says on the box. - :: - |= num/@ud - ^+ +> - =+ bun=(scow %ud num) - %+ sh-fact %txt - (runt [(sub 13 (lent bun)) '-'] "[{bun}]") - :: - ++ sh-glyf :: decode glyph - ::x gets the partner(s) that match a glyph. - ::x? why (set partner)? it seems like it only ever returns a single one. - :: - |= cha/char ^- (unit (set partner)) - =+ lax=(~(get ju nak) cha) - ?: =(~ lax) ~ ::x no partner. - ?: ?=({* $~ $~} lax) `n.lax ::x single partner. - ::x in case of multiple partners, pick the most recently active one. - |- ^- (unit (set partner)) - ?~ grams ~ - ::x get first partner from a telegram's audience. - =+ pan=(silt (turn (~(tap by q.q.i.grams)) head)) - ?: (~(has in lax) pan) `pan - $(grams t.grams) - :: - ++ sh-reaction - ::x renders a reaction. - :: - |= rac/reaction - (sh-lame (trip what.rac)) - :: - ++ sh-low-atlas-diff - ::x calculates the difference between two atlasses (presence lists). - :: - |= {one/atlas two/atlas} - =| $= 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 p.q.i.eno) ret - =+ unt=(~(get by two) p.i.eno) - ?~ unt - ret(old [i.eno old.ret]) - ?: =(%gone p.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 p.q.i.owt) ret - ?. (~(has by one) p.i.owt) - ret(new [i.owt new.ret]) - ?: =(%gone p:(~(got by one) p.i.owt)) - ret(new [i.owt new.ret]) - ret - ret - :: - ++ sh-low-remco-diff - ::x calculates the difference between two maps of station configurations. - :: - |= {one/(map station config) two/(map station config)} - =| $= ret - $: old/(list (pair station config)) - new/(list (pair station config)) - cha/(list (pair station 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 - ::x calculates the difference between two sets, - ::x returning what was lost in old and what was gained in new. - :: - |* {one/(set *) two/(set *)} - :- ^= old (~(tap in (~(dif in one) two))) - ^= new (~(tap in (~(dif in two) one))) - :: - ++ sh-puss - ::x posture as text. - :: - |= a/posture ^- tape - ?- a - $black "channel" - $brown "mailbox" - $white "village" - $green "journal" - == - :: - ++ sh-low-config-exceptions - ::x used by ++sh-low-config-show to aid in printing info to cli. - :: - |= {pre/tape por/posture old/(list ship) new/(list ship)} - =+ out=?:(?=(?($black $brown) por) "try " "cut ") - =+ inn=?:(?=(?($black $brown) por) "ban " "add ") - =. +>.$ - |- ^+ +>.^$ - ?~ old +>.^$ - =. +>.^$ $(old t.old) - (sh-note :(weld pre out " " (scow %p i.old))) - =. +>.$ - |- ^+ +>.^$ - ?~ new +>.^$ - =. +>.^$ $(new t.new) - (sh-note :(weld pre out " " (scow %p i.new))) - +>.$ - :: - ++ sh-low-config-sources - ::x used by ++sh-low-config-show to aid in printing info to cli, - ::x pertaining to the un/subscribing to partners. - :: - |= {pre/tape old/(list partner) new/(list partner)} - ^+ +> - =. +>.$ - |- ^+ +>.^$ - ?~ old +>.^$ - =. +>.^$ $(old t.old) - (sh-note (weld pre "off {~(pr-full pr man i.old)}")) - =. +>.$ - |- ^+ +>.^$ - ?~ new +>.^$ - =. +>.^$ $(new t.new) - (sh-note (weld pre "hey {~(pr-full pr man i.new)}")) - +>.$ - :: - ++ sh-low-config-show - ::x prints config changes to the cli. - :: - |= {pre/tape laz/config loc/config} - ^+ +> - =. +>.$ - ?: =(caption.loc caption.laz) +>.$ - (sh-note :(weld pre "cap " (trip caption.loc))) - =. +>.$ - %+ sh-low-config-sources - (weld (trip man) ": ") - (sh-set-diff sources.laz sources.loc) - ?: !=(p.cordon.loc p.cordon.laz) - =. +>.$ (sh-note :(weld pre "but " (sh-puss p.cordon.loc))) - %^ sh-low-config-exceptions - (weld (trip man) ": ") - p.cordon.loc - [~ (~(tap in q.cordon.loc))] - %^ sh-low-config-exceptions - (weld (trip man) ": ") - p.cordon.loc - (sh-set-diff q.cordon.laz q.cordon.loc) - :: - ++ sh-low-config - ::x prints changes to a config to cli. - :: - |= {sat/station old/(unit config) new/(unit config)} - ^+ +> - ?~ old ~&([%new-conf sat] +>) - ?~ new ~&([%del-conf sat] +>) ::TODO tmp - %^ sh-low-config-show - (weld ~(sr-phat sr man sat) ": ") - u.old u.new - :: - ++ sh-low-remco - ::x prints changes to remote configs to cli. - :: - |= {ole/(map station config) neu/(map station config)} - ^+ +> - =+ (sh-low-remco-diff ole neu) - =. +>.$ - |- ^+ +>.^$ - ?~ new +>.^$ - =. +>.^$ $(new t.new) - =. +>.^$ (sh-pest [%& p.i.new]) - %+ sh-low-config-show - (weld ~(sr-phat sr man p.i.new) ": ") - [*config q.i.new] - =. +>.$ - |- ^+ +>.^$ - ?~ cha +>.^$ - =. +>.^$ $(cha t.cha) - %+ sh-low-config-show - (weld ~(sr-phat sr man p.i.cha) ": ") - [(~(got by ole) `station`p.i.cha) q.i.cha] - +>.$ - :: - ++ sh-note :: shell message - ::x prints a txt to cli in talk's format. - :: - |= txt/tape - ^+ +> - (sh-fact %txt (runt [14 '-'] `tape`['|' ' ' (scag 64 txt)])) - :: - ++ sh-spaz :: print status - ::x gets the presence of a status. - :: - |= saz/status - ^- tape - ['%' (trip p.saz)] - :: - ++ sh-low-rogue-diff - ::x calculates the difference between two maps of stations and their - ::x presence lists. - :: - |= {one/(map partner atlas) two/(map partner atlas)} - =| $= ret - $: old/(list (pair partner atlas)) - new/(list (pair partner atlas)) - cha/(list (pair partner atlas)) - == - ^+ 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-low-precs-diff :: print atlas diff - ::x prints presence notifications. - :: - |= $: pre/tape - $= cul - $: old/(list (pair ship status)) - new/(list (pair ship status)) - cha/(list (pair ship status)) - == - == - ?: (~(has in settings.she) %quiet) - +>.$ - =. +>.$ - |- ^+ +>.^$ - ?~ old.cul +>.^$ - =. +>.^$ $(old.cul t.old.cul) - (sh-note (weld pre "bye {(scow %p p.i.old.cul)}")) - =. +>.$ - |- ^+ +>.^$ - ?~ new.cul +>.^$ - =. +>.^$ $(new.cul t.new.cul) - %- sh-note - (weld pre "met {(scow %p p.i.new.cul)} {(sh-spaz q.i.new.cul)}") - =. +>.$ - |- ^+ +>.^$ - ?~ cha.cul +>.^$ - %- sh-note - (weld pre "set {(scow %p p.i.cha.cul)} {(sh-spaz q.i.cha.cul)}") - +>.$ - :: - ++ sh-low-rempe :: update foreign - ::x updates remote presences(?) and prints changes. - :: - |= {old/(map partner atlas) new/(map partner atlas)} - =+ day=(sh-low-rogue-diff old new) - ?: (~(has in settings.she) %quiet) - +>.$ - =. +>.$ - |- ^+ +>.^$ - ?~ old.day +>.^$ - =. +>.^$ $(old.day t.old.day) - (sh-note (weld "not " (~(pr-show pr man p.i.old.day) ~))) - =. +>.$ - |- ^+ +>.^$ - ?~ new.day +>.^$ - =. +>.^$ $(new.day t.new.day) - =. +>.^$ - (sh-note (weld "new " (~(pr-show pr man p.i.new.day) ~))) - (sh-low-precs-diff "--" ~ (~(tap by q.i.new.day)) ~) - =. +>.$ - |- ^+ +>.^$ - ?~ cha.day +>.^$ - =. +>.^$ $(cha.day t.cha.day) - =. +>.^$ - (sh-note (weld "for " (~(pr-show pr man p.i.cha.day) ~))) - =+ yez=(~(got by old) p.i.cha.day) - %+ sh-low-precs-diff "--" - (sh-low-atlas-diff yez q.i.cha.day) - +>.$ - :: - ++ sh-low-precs - ::x print presence changes - :: - |= {old/atlas new/atlas} - ^+ +> - =+ dif=(sh-low-atlas-diff old new) - (sh-low-precs-diff "" dif) - :: - ++ sh-low-gram - ::x renders telegram: increase gram count and print the gram. - ::x every fifth gram, prints the number. - :: - |= {num/@ud gam/telegram} - ^+ +> - ?: =(num count.she) - =. +> ?:(=(0 (mod num 5)) (sh-numb num) +>) - (sh-rend(count.she +(num)) gam) - ?: (gth num count.she) - =. +> (sh-numb num) - (sh-rend(count.she +(num)) gam) - +> - :: - ++ sh-low-grams :: apply telegrams - ::x renders telegrams. - :: - |= {num/@ud gaz/(list telegram)} - ^+ +> - ?~ gaz +> - $(gaz t.gaz, num +(num), +> (sh-low-gram num i.gaz)) - :: - ++ sh-sane-chat :: sanitize chatter - ::x (for chat messages) sanitizes the input buffer and splits it into - ::x multiple lines ('•'). + ++ sh-sane-chat ::< sanitize chatter + ::> (for chat messages) sanitizes the input buffer + ::> and splits it into multiple lines (by '•'). :: |= buf/(list @c) ^- (list sole-edit) @@ -1041,28 +724,34 @@ ++ fix |=(cha/@ [%mor [%del inx] [%ins inx `@c`cha] ~]) -- :: - ++ sh-sane :: sanitize input - ::x parses cli prompt input using ++sh-scad and sanitizes when invalid. + ++ sh-sane ::< sanitize input + ::> parses cli prompt input using ++sh-read and + ::> sanitizes when invalid. :: |= {inv/sole-edit buf/(list @c)} ^- {lit/(list sole-edit) err/(unit @u)} - =+ res=(rose (tufa buf) sh-scad) + =+ res=(rose (tufa buf) sh-read) ?: ?=($| -.res) [[inv]~ `p.res] :_ ~ ?~ p.res ~ =+ wok=u.p.res |- ^- (list sole-edit) - ?+ -.wok ~ - $target ?~(q.wok ~ $(wok u.q.wok)) - $say |- :: XX per line - ?~ p.wok ~ - ?: ?=($lin -.i.p.wok) - (sh-sane-chat buf) - $(p.wok t.p.wok) + ?+ -.wok + ~ + :: + $target + ?~(q.wok ~ $(wok u.q.wok)) + :: + $say + |- :: XX per line + ?~ p.wok ~ + ?: ?=($lin -.i.p.wok) + (sh-sane-chat buf) + $(p.wok t.p.wok) == :: - ++ sh-slug :: edit to sanity - ::x corrects invalid prompt input. + ++ sh-slug ::< edit to sanity + ::> corrects invalid prompt input. :: |= {lit/(list sole-edit) err/(unit @u)} ^+ +> @@ -1071,42 +760,53 @@ (~(transmit sole say.she) `sole-edit`?~(t.lit i.lit [%mor lit])) (sh-fact [%mor [%det lic] ?~(err ~ [%err u.err]~)]) :: - ++ sh-stir :: apply edit - ::x called when typing into the talk prompt. applies the change and does - ::x sanitizing. + ++ 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. :: - |= cal/sole-change - ^+ +> - =^ inv say.she (~(transceive sole say.she) cal) - =+ fix=(sh-sane inv buf.say.she) - ?~ lit.fix - +>.$ - ?~ err.fix - (sh-slug fix) :: just capital correction - ?. &(?=($del -.inv) =(+(p.inv) (lent buf.say.she))) - +>.$ :: allow interior edits, deletes - (sh-slug fix) + =+ 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 + =^ cal say.she (~(transmit sole say.she) [%set ~]) + %- sh-fact + :* %mor + [%nex ~] + [%det cal] + ?. ?=({$';' *} buf) ~ + :_ ~ + [%txt (runt [14 '-'] `tape`['|' ' ' (tufa `(list @)`buf)])] + == :: - ++ sh-lame :: send error - ::x just puts some text into the cli. - :: - |= txt/tape - (sh-fact [%txt txt]) + ::> || + ::> || %user-action + ::> || + ::> processing user actions. + ::+| :: - ++ sh-twig-head ^- vase :: eval data - ::x makes a vase of environment data to evaluate against (#-messages). - :: - !>(`{our/@p now/@da eny/@uvI}`[our.bol now.bol (shas %eny eny.bol)]) - :: - ++ sh-work :: do work - ::x implements worker arms for different talk commands. - ::x all worker arms must produce updated state/context. + ++ sh-work ::< do work + ::> implements worker arms for different talk + ::> commands. + ::> worker arms must produce updated state. :: |= job/work ^+ +> =< work |% - ++ work + :: + ::> || + ::> || %helpers + ::> || + ::+| + :: + ++ work ::< call correct worker ?- -.job :: station management $join (join +.job) @@ -1135,17 +835,28 @@ $help help == :: - ++ activate :: from %number + ++ activate ::< from %number + ::> prints message details. + :: |= gam/telegram ^+ ..sh-work - =+ tay=~(. tr man settings.she gam) + =+ tay=~(. tr settings.she gam) =. ..sh-work (sh-fact tr-fact:tay) sh-prod(active.she tr-pals:tay) :: - ++ help - (sh-fact %txt "see http://urbit.org/docs/using/messaging/") + ++ deli ::< find number + ::> 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))) :: - ++ glyph + ++ glyph ::< grab a glyph + ::> finds a new glyph for assignment. + :: |= idx/@ =< cha %+ reel glyphs @@ -1157,19 +868,25 @@ ole [new num] :: - ++ set-glyph - |= {cha/char lix/(set partner)} - =: nik (~(put by nik) lix cha) - nak (~(put ju nak) cha lix) + ++ set-glyph ::< new glyph binding + ::> applies glyph binding to our state and sends + ::> an action. + :: + |= {cha/char pas/(set partner)} + =: nik (~(put by nik) pas cha) + nak (~(put ju nak) cha pas) == - (sh-act %glyph cha lix &) + (sh-act %glyph cha pas &) :: - ++ unset-glyph - |= {cha/char lix/(unit (set partner))} + ++ unset-glyph ::< old glyph binding + ::> removes either {pas} or all bindings on a + ::> glyph and sends an action. + :: + |= {cha/char pas/(unit (set partner))} =/ ole/(set (set partner)) - ?^ lix [u.lix ~ ~] + ?^ pas [u.pas ~ ~] (~(get ju nak) cha) - =. ..sh-work (sh-act %glyph cha (fall lix ~) |) + =. ..sh-work (sh-act %glyph cha (fall pas ~) |) |- ^+ ..sh-work ?~ ole ..sh-work =. ..sh-work $(ole l.ole) @@ -1179,44 +896,146 @@ nak (~(del ju nak) cha n.ole) == :: - ++ join :: %join - |= pan/(set partner) + ++ reverse-folks ::< find by handle + ::> finds all ships whose handle matches {nym}. + :: + |= nym/knot + ^- (list ship) + %+ murn (~(tap by folks)) + |= {p/ship q/human} + ?~ hand.q ~ + ?. =(u.hand.q nym) ~ + [~ u=p] + :: + ++ twig-head ::< eval data + ::> makes a vase of environment data to evaluate + ::> against (for #-messages). + :: + ^- vase + !> ^- {our/@p now/@da eny/@uvI} + [our.bol now.bol (shas %eny eny.bol)] + :: + ::> || + ::> || %station-management + ::> || + ::+| + :: + ++ join ::< %join + ::> change local mailbox config to include + ::> subscriptions to {pas}. + ::TODO only bind glyph *after* we've + :: successfully joined. + :: + |= pas/(set partner) ^+ ..sh-work =. ..sh-work - =+ (~(get by nik) pan) + =+ (~(get by nik) pas) ?^ - (sh-note "has glyph {}") - =+ cha=(glyph (mug pan)) - (sh-note:(set-glyph cha pan) "new glyph {}") + =+ cha=(glyph (mug pas)) + (sh-note:(set-glyph cha pas) "new glyph {}") =. ..sh-work - sh-prod(active.she pan) - =+ loc=(~(got by mirrors) [our.bol man]) - ::x change local mailbox config to include subscription to pan. - (sh-act %source man & pan) + sh-prod(active.she pas) + (sh-act %source inbox & pas) :: - ++ leave :: %leave - |= pan/(set partner) + ++ leave ::< %leave + ::> change local mailbox config to exclude + ::> subscriptions to {pas}. + :: + |= pas/(set partner) ^+ ..sh-work - =+ loc=(~(got by mirrors) [our.bol man]) - ::x change local mailbox config to exclude subscription to pan. - (sh-act %source man | pan) + (sh-act %source inbox | pas) :: - ++ what :: %what - |= qur/$@(char (set partner)) ^+ ..sh-work - ?^ qur - =+ cha=(~(get by nik) qur) - (sh-fact %txt ?~(cha "none" [u.cha]~)) - =+ pan=(~(tap in (~(get ju nak) qur))) - ?: =(~ pan) (sh-fact %txt "~") - =< (sh-fact %mor (turn pan .)) - |=(a/(set partner) [%txt ]) :: XX ~(ar-whom ar man.she a) + ++ create ::< %create + ::> creates station {nom} with specified config. + :: + |= {por/posture nom/knot txt/cord} + ^+ ..sh-work + ::TODO simplify? + ?: (~(has in mirrors) [our.bol nom]) + (sh-lame "{(trip nom)}: already exists") + =. ..sh-work + (sh-act %create nom txt por) + (join [[%& our.bol nom] ~ ~]) :: - ++ who :: %who - |= pan/(set partner) ^+ ..sh-work + ++ delete ::< %delete + ::> deletes our station {nom}, after optionally + ::> sending a last announce message {say}. + :: + |= {nom/knot say/(unit cord)} + ^+ ..sh-work + (sh-act %delete nom say) + :: + ++ depict ::< %depict + ::> changes the description of {nom} to {txt}. + :: + |= {nom/knot txt/cord} + ^+ ..sh-work + (sh-act %depict nom txt) + :: + ++ source ::< %source + ::> adds {pas} to {nom}'s sources. + :: + |= {nom/knot pas/(set partner)} + ^+ ..sh-work + (sh-act %source nom & pas) + :: + ++ invite ::< %invite + ::> invites {sis} to our station {nom}. + :: + |= {nom/knot sis/(set ship)} + ^+ ..sh-work + (sh-act %permit nom & sis) + :: + ++ banish ::< %banish + ::> banish {sis} from our station {nom}. + :: + |= {nom/knot sis/(set ship)} + ^+ ..sh-work + (sh-act %permit nom | sis) + :: + ::> || + ::> || %messaging + ::> || + ::+| + :: + ++ say ::< publish + ::> 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/twig} + => |.([(sell (slap (slop twig-head seed) exe))]~) + =+ tan=p:(mule .) + (say [%fat tank+tan exp+txt] ~) + :: + ++ target ::< %target + ::> sets messaging target, then execute {woe}. + :: + |= {pan/(set partner) woe/(unit ^work)} + ^+ ..sh-work + =. ..sh-pact (sh-pact pan) + ?~(woe ..sh-work work(job u.woe)) + :: + ::> || + ::> || %displaying-info + ::> || + ::+| + :: + ++ who ::< %who + ::> prints presence lists for {pas} or all. + :: + |= pas/(set partner) ^+ ..sh-work ::TODO clever use of =< and . take note! =< (sh-fact %mor (murn (sort (~(tap by remotes) ~) aor) .)) |= {pon/partner alt/atlas} ^- (unit sole-effect) - ?. |(=(~ pan) (~(has in pan) pon)) ~ - =- `[%tan rose+[", " `~]^- leaf+~(pr-full pr man pon) ~] + ?. |(=(~ pas) (~(has in pas) pon)) ~ + =- `[%tan rose+[", " `~]^- leaf+~(pr-full pr pon) ~] =< (murn (sort (~(tap by alt)) aor) .) |= {a/ship b/presence c/human} ^- (unit tank) =. c @@ -1228,124 +1047,23 @@ $talk `leaf+:(weld "talk " (scow %p a) " " (trip (fall hand.c ''))) == :: - ++ bind :: %bind - |= {cha/char pan/(unit (set partner))} ^+ ..sh-work - ?~ pan $(pan `active.she) - =+ ole=(~(get by nik) u.pan) - ?: =(ole [~ cha]) ..sh-work - (sh-note:sh-prod:(set-glyph cha u.pan) "bound {} {}") - :: - ++ unbind :: %unbind - |= {cha/char pan/(unit (set partner))} ^+ ..sh-work - ?. ?| &(?=(^ pan) (~(has by nik) u.pan)) - &(?=($~ pan) (~(has by nak) cha)) - == - ..sh-work - (sh-note:sh-prod:(unset-glyph cha pan) "unbound {}") - :: - ++ invite :: %invite - |= {nom/knot sis/(set ship)} + ++ what ::< %what + ::> prints binding details. goes both ways. + ::TODO pretty-print + :: + |= qur/$@(char (set partner)) ^+ ..sh-work - (sh-act %permit nom & sis) + ?^ qur + =+ cha=(~(get by nik) qur) + (sh-fact %txt ?~(cha "none" [u.cha]~)) + =+ pan=(~(tap in (~(get ju nak) qur))) + ?: =(~ pan) (sh-fact %txt "~") + =< (sh-fact %mor (turn pan .)) + |=(a/(set partner) [%txt ]) :: XX ~(ar-whom ar a) :: - ++ banish :: %banish - |= {nom/knot sis/(set ship)} - ^+ ..sh-work - (sh-act %permit nom | sis) - :: - ++ create :: %create - |= {por/posture nom/knot txt/cord} - ^+ ..sh-work - ::TODO simplify? - ?: (~(has in mirrors) [our.bol nom]) - (sh-lame "{(trip nom)}: already exists") - =. ..sh-work - (sh-act %create nom txt por) - (join [[%& our.bol nom] ~ ~]) - :: - ++ depict - |= {nom/knot txt/cord} - ^+ ..sh-work - (sh-act %depict nom txt) - :: - ++ source - |= {nom/knot pas/(set partner)} - ^+ ..sh-work - (sh-act %source nom & pas) - :: - ++ delete - |= {nom/knot say/(unit cord)} - ^+ ..sh-work - (sh-act %delete nom say) - :: - ++ reverse-folks - |= nym/knot - ^- (list ship) - %+ murn (~(tap by folks)) - |= {p/ship q/human} - ?~ hand.q ~ - ?. =(u.hand.q nym) ~ - [~ u=p] - :: - ++ nick :: %nick - |= {her/(unit ship) nym/(unit cord)} - ^+ ..sh-work - ::x no arguments - ?: ?=({$~ $~} +<) - %+ sh-fact %mor - %+ turn (~(tap by folks)) - |= {p/ship q/human} - :- %txt - ?~ hand.q - "{

}:" - "{

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

}: {}"] - %. [%human u.her [true=~ hand=nym]] - %= sh-act - folks ?~ u.nym - (~(del by folks) u.her) ::x unset nickname - (~(put by folks) u.her [true=~ hand=nym]) ::x set nickname - == - :: - ++ wo-set :: %set - |= seg/knot - ^+ ..sh-work - ?~ seg - %+ sh-fact %mor - %+ turn (~(tap in settings.she)) - |= s/knot - [%txt (trip s)] - %= ..sh-work - settings.she (~(put in settings.she) seg) - == - :: - ++ unset :: %unset - |= neg/knot - ^+ ..sh-work - %= ..sh-work - settings.she (~(del in settings.she) neg) - == - :: - ++ target :: %target - |= {pan/(set partner) woe/(unit ^work)} - ^+ ..sh-work - =. ..sh-pact (sh-pact pan) - ?~(woe ..sh-work work(job u.woe)) - :: - ++ number :: %number + ++ number ::< %number + ::> finds selected message, expand it. + :: |= num/$@(@ud {p/@u q/@ud}) ^+ ..sh-work |- @@ -1362,112 +1080,602 @@ (activate (snag (sub count +(msg)) grams)) (sh-lame "…{(reap p.num '0')}{(scow %ud q.num)}: no such telegram") :: - ++ deli :: find number - |= {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))) + ::> || + ::> || %ui-settings + ::> || + ::+| :: - ++ eval :: run - |= {txt/cord exe/twig} - => |.([(sell (slap (slop sh-twig-head seed) exe))]~) - =+ tan=p:(mule .) - (say [%fat tank+tan exp+txt] ~) - :: - ++ say :: publish - |= sep/(list speech) + ++ bind ::< %bind + ::> binds targets {pas} to the glyph {cha}. + :: + |= {cha/char pas/(unit (set partner))} ^+ ..sh-work - (sh-act %phrase active.she sep) + ?~ pas $(pas `active.she) + =+ ole=(~(get by nik) u.pas) + ?: =(ole [~ cha]) ..sh-work + %. "bound {} {}" + sh-note:sh-prod:(set-glyph cha u.pas) + :: + ++ unbind ::< %unbind + ::> unbinds targets {pas} to glyph {cha}. + :: + |= {cha/char pan/(unit (set partner))} + ^+ ..sh-work + ?. ?| &(?=(^ pan) (~(has by nik) u.pan)) + &(?=($~ pan) (~(has by nak) cha)) + == + ..sh-work + %. "unbound {}" + sh-note:sh-prod:(unset-glyph cha pan) + :: + ++ nick ::< %nick + ::> either shows, sets or unsets nicknames + ::> depending on arguments. + :: + |= {her/(unit ship) nym/(unit cord)} + ^+ ..sh-work + ::> no arguments, show all + ?: ?=({$~ $~} +<) + %+ sh-fact %mor + %+ turn (~(tap by folks)) + |= {p/ship q/human} + :- %txt + ?~ hand.q + "{

}:" + "{

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

}: {}"] + %. [%human u.her [true=~ hand=nym]] + %= sh-act + folks + ?~ u.nym + ::> unset nickname + (~(del by folks) u.her) + ::> set nickname + (~(put by folks) u.her [true=~ hand=nym]) + == + :: + ++ wo-set ::< %set + ::> enables ui setting flag. + :: + |= seg/knot + ^+ ..sh-work + ?~ seg + %+ sh-fact %mor + %+ turn (~(tap in settings.she)) + |= s/knot + [%txt (trip s)] + %= ..sh-work + settings.she (~(put in settings.she) seg) + == + :: + ++ unset ::< %unset + ::> disables ui setting flag. + :: + |= neg/knot + ^+ ..sh-work + %= ..sh-work + settings.she (~(del in settings.she) neg) + == + :: + ::> || + ::> || %miscellaneous + ::> || + ::+| + :: + ++ help ::< %help + ::> prints help message + :: + (sh-fact %txt "see http://urbit.org/docs/using/messaging/") -- :: - ++ sh-obey :: apply result - ::x called upon hitting return in the prompt. if input is invalid, - ::x ++sh-slug is called. otherwise, the appropriate work is done - ::x and the entered command (if any) gets displayed to the user. + ++ sh-pact ::< update active aud + ::> change currently selected audience to {lix} + ::> and update the prompt. :: - =+ fix=(sh-sane [%nop ~] buf.say.she) - ?^ lit.fix - (sh-slug fix) - =+ jub=(rust (tufa buf.say.she) sh-scad) - ?~ jub (sh-fact %bel ~) - %. u.jub - =< sh-work - =+ buf=buf.say.she - =^ cal say.she (~(transmit sole say.she) [%set ~]) - %- sh-fact - :* %mor - [%nex ~] - [%det cal] - ?. ?=({$';' *} buf) ~ - :_ ~ - [%txt (runt [14 '-'] `tape`['|' ' ' (tufa `(list @)`buf)])] - == - :: - ++ sh-sole :: apply edit - ::x applies sole action. - :: - |= act/sole-action + |= lix/(set partner) ^+ +> - ?- -.act - $det (sh-stir +.act) - $clr ..sh-sole :: (sh-pact ~) :: XX clear to PM-to-self? - $ret sh-obey + ::> ensure we can see what we send. + =+ act=(sh-pare lix) + ?: =(active.she act) +>.$ + sh-prod(active.she act) + :: + ++ sh-pare ::< adjust target list + ::> if the audience {paz} does not contain a + ::> partner we're subscribed to, add our mailbox + ::> to the audience (so that we can see our own + ::> message). + :: + |= paz/(set partner) + ?: (sh-pear paz) paz + (~(put in paz) [%& our.bol inbox]) + :: + ++ sh-pear ::< hearback + ::> produces true if any partner is included in + ::> our subscriptions, meaning, we hear messages + ::> sent to {paz}. + :: + |= paz/(set partner) + ?~ paz | + ?| (~(has in sources) `partner`n.paz) + $(paz l.paz) + $(paz r.paz) == :: - ++ sh-uniq - ::x generates a new serial. + ++ sh-pest ::< report listen + ::> updates audience to be {tay}, only if {tay} is + ::> not a village/%white. + ::TODO why exclude village (invite-only?) audiences from this? + ::TODO only used in config change printing, maybe delete. :: - ^- {serial _.} - [(shaf %serial eny.bol) .(eny.bol (shax eny.bol))] + |= tay/partner + ^+ +> + ::> if partner is a passport, ignore. + ?. ?=($& -.tay) +> + =+ cof=(~(get by mirrors) +.tay) + ?. |(?=($~ cof) !?=($white p.cordon.u.cof)) + +>.$ + (sh-pact [tay ~ ~]) + :: + ++ sh-glyf ::< decode glyph + ::> finds the partner(s) that match a glyph. + ::TODO should maybe return full set, not latest, + :: if ambiguous. + :: + |= cha/char ^- (unit (set partner)) + =+ lax=(~(get ju nak) cha) + ::> no partner. + ?: =(~ lax) ~ + ::> single partner. + ?: ?=({* $~ $~} lax) `n.lax + ::> in case of multiple partners, pick the most recently active one. + |- ^- (unit (set partner)) + ?~ grams ~ + ::> get first partner from a telegram's audience. + =+ pan=(silt (turn (~(tap by q.q.i.grams)) head)) + ?: (~(has in lax) pan) `pan + $(grams t.grams) + :: + ::> || + ::> || %differs + ::> || + ::> arms that calculate differences between datasets. + ::+| + :: + ++ sh-atlas-diff ::< atlas diff parts + ::> calculates the difference between two presence + ::> lists, producing lists of removed, added and + ::> changed presences. + :: + |= {one/atlas two/atlas} + =| $= 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 p.q.i.eno) ret + =+ unt=(~(get by two) p.i.eno) + ?~ unt + ret(old [i.eno old.ret]) + ?: =(%gone p.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 p.q.i.owt) ret + ?. (~(has by one) p.i.owt) + ret(new [i.owt new.ret]) + ?: =(%gone p:(~(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 partner atlas) two/(map partner atlas)} + =| $= ret + $: old/(list (pair partner atlas)) + new/(list (pair partner atlas)) + cha/(list (pair partner atlas)) + == + ^+ 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 station config) two/(map station config)} + =| $= ret + $: old/(list (pair station config)) + new/(list (pair station config)) + cha/(list (pair station 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. + ::+| + :: + ++ sh-reaction ::< apply reaction + ::> renders a reaction to the cli. + :: + |= rac/reaction + (sh-lame (trip what.rac)) + :: + ++ 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 + ^+ +> + (sh-fact %txt (runt [14 '-'] `tape`['|' ' ' (scag 64 txt)])) + :: + ++ sh-prod ::< show prompt + ::> makes and stores a move to modify the cli + ::> prompt to display the current audience. + :: + ^+ . + %+ sh-fact %pro + :+ & %talk-line + ^- tape + =/ rew/(pair (pair @t @t) (set partner)) + [['[' ']'] active.she] + =+ cha=(~(get by nik) q.rew) + ?^ cha ~[u.cha ' '] + =+ por=~(ar-prom ar q.rew) + (weld `tape`[p.p.rew por] `tape`[q.p.rew ' ' ~]) + :: + ++ sh-rend ::< print on one line + ::> renders a telegram as a single line, adds it + ::> as a console move. + :: + |= gam/telegram + =+ lin=~(tr-line tr settings.she gam) + (sh-fact %txt lin) + :: + ++ sh-numb ::< print msg number + ::> prints a message number, left-padded by heps. + :: + |= num/@ud + ^+ +> + =+ bun=(scow %ud num) + %+ sh-fact %txt + (runt [(sub 13 (lent bun)) '-'] "[{bun}]") + :: + ++ sh-puss ::< readable posture + ::> renders a security posture. + :: + |= a/posture ^- tape + ?- a + $black "channel" + $brown "mailbox" + $white "village" + $green "journal" + == + :: + ++ sh-spaz ::< render status + ::> gets the presence of {saz} as a tape. + :: + |= saz/status + ^- tape + ['%' (trip p.saz)] + :: + ++ sh-show-precs ::< print atlas diff + ::> prints presence changes to the cli. + :: + |= $: pre/tape + $= cul + $: old/(list (pair ship status)) + new/(list (pair ship status)) + cha/(list (pair ship status)) + == + == + ?: (~(has in settings.she) %quiet) + +>.$ + =. +>.$ + |- ^+ +>.^$ + ?~ old.cul +>.^$ + =. +>.^$ $(old.cul t.old.cul) + (sh-note (weld pre "bye {(scow %p p.i.old.cul)}")) + =. +>.$ + |- ^+ +>.^$ + ?~ new.cul +>.^$ + =. +>.^$ $(new.cul t.new.cul) + %- sh-note + (weld pre "met {(scow %p p.i.new.cul)} {(sh-spaz q.i.new.cul)}") + =. +>.$ + |- ^+ +>.^$ + ?~ cha.cul +>.^$ + %- sh-note + (weld pre "set {(scow %p p.i.cha.cul)} {(sh-spaz q.i.cha.cul)}") + +>.$ + :: + ++ sh-show-permits ::< show permits + ::> prints invite/banish effects to the cli. + :: + |= {pre/tape por/posture old/(list ship) new/(list ship)} + =+ out=?:(?=(?($black $brown) por) "try " "cut ") + =+ inn=?:(?=(?($black $brown) por) "ban " "add ") + =. +>.$ + |- ^+ +>.^$ + ?~ old +>.^$ + =. +>.^$ $(old t.old) + (sh-note :(weld pre out " " (scow %p i.old))) + =. +>.$ + |- ^+ +>.^$ + ?~ new +>.^$ + =. +>.^$ $(new t.new) + (sh-note :(weld pre out " " (scow %p i.new))) + +>.$ + :: + ++ sh-show-sources ::< show sources + ::> prints subscription changes to the cli. + :: + |= {pre/tape old/(list partner) new/(list partner)} + ^+ +> + =. +>.$ + |- ^+ +>.^$ + ?~ old +>.^$ + =. +>.^$ $(old t.old) + (sh-note (weld pre "off {~(pr-full pr i.old)}")) + =. +>.$ + |- ^+ +>.^$ + ?~ new +>.^$ + =. +>.^$ $(new t.new) + (sh-note (weld pre "hey {~(pr-full pr i.new)}")) + +>.$ + :: + ++ sh-show-config ::< show config + ::> prints config changes to the cli. + :: + |= {pre/tape laz/config loc/config} + ^+ +> + =. +>.$ + ?: =(caption.loc caption.laz) +>.$ + (sh-note :(weld pre "cap " (trip caption.loc))) + =. +>.$ + %+ sh-show-sources + (weld (trip inbox) ": ") + (sh-set-diff sources.laz sources.loc) + ?: !=(p.cordon.loc p.cordon.laz) + =. +>.$ (sh-note :(weld pre "but " (sh-puss p.cordon.loc))) + %^ sh-show-permits + (weld (trip inbox) ": ") + p.cordon.loc + [~ (~(tap in q.cordon.loc))] + %^ sh-show-permits + (weld (trip inbox) ": ") + p.cordon.loc + (sh-set-diff q.cordon.laz q.cordon.loc) + :: + ++ sh-low-config ::< do show config + ::> prints a station's config changes to the cli. + :: + |= {sat/station old/(unit config) new/(unit config)} + ^+ +> + ?~ old ~&([%new-conf sat] +>) + ?~ new ~&([%del-conf sat] +>) ::TODO tmp + %^ sh-show-config + (weld ~(sr-phat sr sat) ": ") + u.old u.new + :: + ++ sh-low-remco ::TODO delete me + ::> prints changes to remote configs to the cli + :: + |= {ole/(map station config) neu/(map station config)} + ^+ +> + =+ (sh-remco-diff ole neu) + =. +>.$ + |- ^+ +>.^$ + ?~ new +>.^$ + =. +>.^$ $(new t.new) + =. +>.^$ (sh-pest [%& p.i.new]) + %+ sh-show-config + (weld ~(sr-phat sr p.i.new) ": ") + [*config q.i.new] + =. +>.$ + |- ^+ +>.^$ + ?~ cha +>.^$ + =. +>.^$ $(cha t.cha) + %+ sh-show-config + (weld ~(sr-phat sr p.i.cha) ": ") + [(~(got by ole) `station`p.i.cha) q.i.cha] + +>.$ + :: + ++ sh-low-rempe ::< show remotes + ::> prints remote presence changes to the cli. + :: + |= {old/(map partner atlas) new/(map partner atlas)} + =+ day=(sh-rempe-diff old new) + ?: (~(has in settings.she) %quiet) + +>.$ + =. +>.$ + |- ^+ +>.^$ + ?~ old.day +>.^$ + =. +>.^$ $(old.day t.old.day) + (sh-note (weld "not " (~(pr-show pr p.i.old.day) ~))) + =. +>.$ + |- ^+ +>.^$ + ?~ new.day +>.^$ + =. +>.^$ $(new.day t.new.day) + =. +>.^$ + (sh-note (weld "new " (~(pr-show pr p.i.new.day) ~))) + (sh-show-precs "--" ~ (~(tap by q.i.new.day)) ~) + =. +>.$ + |- ^+ +>.^$ + ?~ cha.day +>.^$ + =. +>.^$ $(cha.day t.cha.day) + =. +>.^$ + (sh-note (weld "for " (~(pr-show pr p.i.cha.day) ~))) + =+ yez=(~(got by old) p.i.cha.day) + %+ sh-show-precs "--" + (sh-atlas-diff yez q.i.cha.day) + +>.$ + :: + ++ sh-low-precs ::< show presence + ::> prints presence changes to the cli. + :: + |= {old/atlas new/atlas} + ^+ +> + =+ dif=(sh-atlas-diff old new) + (sh-show-precs "" dif) + :: + ++ sh-low-gram ::< show telegram + ::> prints the telegram. every fifth message, + ::> print the message number also. + :: + |= {num/@ud gam/telegram} + ^+ +> + ?: =(num count.she) + =. +> ?:(=(0 (mod num 5)) (sh-numb num) +>) + (sh-rend(count.she +(num)) gam) + ?: (gth num count.she) + =. +> (sh-numb num) + (sh-rend(count.she +(num)) gam) + +> + :: + ++ sh-low-grams ::< do show telegrams + ::> prints multiple telegrams. + :: + |= {num/@ud gaz/(list telegram)} + ^+ +> + ?~ gaz +> + $(gaz t.gaz, num +(num), +> (sh-low-gram num i.gaz)) + :: -- -- :: -++ sr :: station render core - ::x used in both station and ship rendering. +::> || +::> || %renderers +::> || +::> rendering cores. +::+| +:: +++ sr ::< station renderer + ::> used in both station and ship rendering. :: - ::x man: mailbox. - ::x one: the station. - |_ {man/knot one/station} - ++ sr-best :: best to show - ::x returns true if one is better to show, false otherwise. - ::x prioritizes: our > main > size. + |_ ::> one: the station. + :: + one/station + :: + ++ sr-best ::< best to show + ::> returns true if one is better to show, false + ::> otherwise. prioritizes: our > main > size. ::TODO maybe simplify. (lth (xeb (xeb p.one)) (xeb (xeb p.two))) :: |= two/station ^- ? - ::x the station that's ours is better. + :: the station that's ours is better. ?: =(our.bol p.one) ?: =(our.bol p.two) ?< =(q.one q.two) - ::x if both stations are ours, the main story is better. + :: if both stations are ours, the main story is better. ?: =((main p.one) q.one) %& ?: =((main p.two) q.two) %| - ::x if neither are, pick the "larger" one. + :: if neither are, pick the "larger" one. (lth q.one q.two) %& - ::x if one isn't ours but two is, two is better. + :: if one isn't ours but two is, two is better. ?: =(our.bol p.two) %| ?: =(p.one p.two) - ::x if they're from the same ship, pick the "larger" one. + :: if they're from the same ship, pick the "larger" one. (lth q.one q.two) - ::x when in doubt, pick one if its ship is "smaller" than its channel. - ::x? i guess you want this to be consistent across (a b) and (b a), but - ::x this still seems pretty arbitrary. + :: when in doubt, pick one if its ship is "smaller" than its channel. (lth p.one q.one) :: - ++ sr-curt :: render name in 14 - ::x prints a ship name in 14 characters. left-pads with spaces. - ::x mup signifies "are there other targets besides this one" + ++ sr-curt ::< render name in 14 + ::> prints a ship name in 14 characters. left-pads + ::> with spaces. {mup} signifies "are there other + ::> targets besides this one?" :: |= mup/? ^- tape =+ raw=(cite p.one) (runt [(sub 14 (lent raw)) ' '] raw) :: - ++ sr-nick - ::x get nick for ship, or shortname if no nick. left-pads with spaces. + ++ sr-nick ::< nick or name in 14 + ::> get nick for ship, or shortname if no nick. + ::> left-pads with spaces. :: |. ^- tape =+ nym=(~(get by folks) p.one) @@ -1479,14 +1687,16 @@ =+ len=(sub 14 (lent raw)) (weld (reap len ' ') raw) :: - ++ sr-phat :: render accurately - ::x prints a station fully, but still taking "shortcuts" where possible: - ::x ":" for local mailbox, "~ship" for foreign mailbox, - ::x "%channel" for local station, "/channel" for parent station. + ++ sr-phat ::< render accurately + ::> prints a station fully, but still taking + ::> "shortcuts" where possible: + ::> ":" for local mailbox, "~ship" for foreign + ::> mailbox, "%channel" for local station, + ::> "/channel" for parent station. :: ^- tape ?: =(p.one our.bol) - ?: =(q.one man) + ?: =(q.one inbox) ":" ['%' (trip q.one)] ?: =(p.one (sein our.bol)) @@ -1497,23 +1707,26 @@ :(welp wun "/" (trip q.one)) -- :: -++ pr :: partner render core - ::x used primarily for printing partners. +++ pr ::< partner renderer + ::> used primarily for printing partners. :: - ::x man: mailbox. - ::x one: the partner. - |_ {man/knot one/partner} - ++ pr-beat :: more relevant - ::x returns true if one is better to show, false otherwise. - ::x prefers stations over passports. if both are stations, sr-best. if both - ::x are passports, pick the "larger" one, if they're equal, content hash. + |_ ::> one: the partner + :: + one/partner + :: + ++ pr-beat ::< more relevant + ::> returns true if one is better to show, false + ::> otherwise. prefers stations over passports. + ::> if both are stations, ++sr-best. + ::> if both are passports, pick the "larger" one. + ::> if they're equal, content hash. :: |= two/partner ^- ? - ?- -.one + ?- -.one $& ?- -.two $| %& - $& (~(sr-best sr man p.one) p.two) + $& (~(sr-best sr p.one) p.two) == :: $| @@ -1524,13 +1737,15 @@ (lth -.p.two -.p.one) == == - ++ pr-best :: most relevant - ::x picks the most relevant partner. + :: + ++ pr-best ::< most relevant + ::> picks the most relevant partner. :: |=(two/partner ?:((pr-beat two) two one)) :: - ++ pr-sigh :: assemble label - ::x prepend pre to yiz, omitting characters of yiz to stay within len. + ++ pr-sigh ::< assemble label + ::> prepend {pre} to {yiz}, omitting characters of + ::> {yiz} to stay within {len} characters. :: |= {len/@ud pre/tape yiz/cord} ^- tape @@ -1544,127 +1759,133 @@ (runt [(sub len lez) '-'] nez) :(welp pre (scag (dec len) nez) "+") :: - ++ pr-full (pr-show ~) :: render full width - ++ pr-show :: render partner - ::x renders a partner as text. + ++ pr-full (pr-show ~) ::< render full width + :: + ++ pr-show ::< render partner + ::> renders a partner as text. :: |= moy/(unit ?) ^- tape - ?- -.one - ::x render station as glyph if we can. + ?- -.one + :: render station (as glyph if we can). $& ?~ moy =+ cha=(~(get by nik) one ~ ~) =- ?~(cha - "'{u.cha ~}' {-}") - ~(sr-phat sr man p.one) - (~(sr-curt sr man p.one) u.moy) - :: - ::x render passport. + ~(sr-phat sr p.one) + (~(sr-curt sr p.one) u.moy) + :: render passport. $| - =+ ^= pre ^- tape - ?- -.p.one - $twitter "@t:" - == + =/ pre ^- tape + ?- -.p.one + $twitter "@t:" + == ?~ moy (weld pre (trip p.p.one)) - =. pre ?.(=(& u.moy) pre ['*' pre]) + =. pre ?.(u.moy pre ['*' pre]) (pr-sigh 14 pre p.p.one) == -- :: -++ ar :: audience renderer - ::x used for representing audiences (sets of partners) as tapes. +++ ar ::< audience renderer + ::> used for representing audiences (sets of partners) + ::> as tapes. :: - :: man: mailbox. - :: lix: members of the audience. - |_ {man/knot lix/(set partner)} - ++ ar-best ^- (unit partner) - ::x pick the most relevant partner. + |_ ::> lix: members of the audience. + :: + lix/(set partner) + :: + ++ ar-best ::< most relevant + ::> find the most relevant partner in the set. :: + ^- (unit partner) ?~ lix ~ :- ~ |- ^- partner =+ lef=`(unit partner)`ar-best(lix l.lix) =+ rit=`(unit partner)`ar-best(lix r.lix) - =. n.lix ?~(lef n.lix (~(pr-best pr man n.lix) u.lef)) - =. n.lix ?~(rit n.lix (~(pr-best pr man n.lix) u.rit)) + =. n.lix ?~(lef n.lix (~(pr-best pr n.lix) u.lef)) + =. n.lix ?~(rit n.lix (~(pr-best pr n.lix) u.rit)) n.lix :: - ++ ar-deaf ^+ . :: except for self - ::x remove ourselves from the audience. + ++ ar-deaf ::< except for self + ::> remove ourselves from the audience. :: - .(lix (~(del in lix) `partner`[%& our.bol man])) + ^+ . + .(lix (~(del in lix) `partner`[%& our.bol inbox])) :: - ++ ar-maud ^- ? :: multiple audience - ::x checks if there's multiple partners in the audience via pattern match. + ++ ar-maud ::< multiple audience + ::> checks if there's multiple partners in the + ::> audience via pattern matching. :: + ^- ? =. . ar-deaf !?=($@($~ {* $~ $~}) lix) :: - ++ ar-prom ^- tape :: render targets - ::x render all partners, ordered by relevance. + ++ ar-prom ::< render targets + ::> render all partners, ordered by relevance. :: + ^- tape =. . ar-deaf - =+ ^= all - %+ sort `(list partner)`(~(tap in lix)) - |= {a/partner b/partner} - (~(pr-beat pr man a) b) + =/ all + %+ sort `(list partner)`(~(tap in lix)) + |= {a/partner b/partner} + (~(pr-beat pr a) b) =+ fir=& |- ^- tape ?~ all ~ ;: welp ?:(fir "" " ") - (~(pr-show pr man i.all) ~) + (~(pr-show pr i.all) ~) $(all t.all, fir |) == :: - ++ ar-whom :: render sender - ::x render sender as the most relevant partner. + ++ ar-whom ::< render sender + ::> render sender as the most relevant partner. :: - (~(pr-show pr man (need ar-best)) ~ ar-maud) + (~(pr-show pr (need ar-best)) ~ ar-maud) :: - ++ pr-dire :: direct message - ::x returns true if partner is a mailbox of ours. + ++ ar-dire ::< direct message + ::> returns true if partner is a mailbox of ours. :: |= pan/partner ^- ? ?& ?=($& -.pan) =(p.p.pan our.bol) - :: =+ sot=(~(get by mirrors) +.pan) &(?=(^ sot) ?=($brown p.cordon.u.sot)) == :: - ++ ar-pref :: audience glyph - ::x get the glyph that corresponds to the audience, with a space appended. - ::x if it's a dm to us, use :. if it's a dm by us, use ;. complex, use *. + ++ ar-pref ::< audience glyph + ::> get the glyph that corresponds to the audience, + ::> with a space appended. for mailbox messages and + ::> complex audiences, use reserved "glyphs". :: ^- tape =+ cha=(~(get by nik) lix) ?^ cha ~[u.cha ' '] - ?. (lien (~(tap by lix)) pr-dire) + ?. (lien (~(tap by lix)) ar-dire) "* " ?: ?=({{$& ^} $~ $~} lix) ": " "; " -- :: -++ tr :: telegram renderer - ::x responsible for converting telegrams and everything relating to them to - ::x text to be displayed in the cli. +++ tr ::< telegram renderer + ::> responsible for converting telegrams and + ::> everything relating to them to text to be + ::> displayed in the cli. :: - |_ $: ::x man: story. - ::x sef: settings flags. - ::x telegram: - ::x who: author. - ::x thought: - ::x sen: unique identifier. - ::x aud: audience. - ::x statement: - ::x wen: timestamp. - ::x bou: complete aroma. - ::x sep: message contents. + |_ $: ::> sef: settings flags. + ::> \ telegram + ::> who: author. + ::> \ thought + ::> sen: unique identifier. + ::> aud: audience. + ::> \ statement + ::> wen: timestamp. + ::> bou: complete aroma. + ::> sep: message contents. :: - man/knot sef/(set knot) who/ship sen/serial @@ -1673,99 +1894,135 @@ bou/bouquet sep/speech == - ++ tr-fact ^- sole-effect :: activate effect - ::x produce sole-effect for printing message details. + :: + ++ tr-fact ::< activate effect + ::> produces sole-effect for printing message + ::> details. :: + ^- sole-effect ~[%mor [%tan tr-meta] tr-body] :: - ++ tr-line ^- tape :: one-line print - ::x crams a telegram into a single line by displaying a short ship name, - ::x a short representation of the gram, and an optional timestamp. + ++ tr-line ::< one-line print + ::> crams a telegram into a single line by + ::> displaying a short ship name, a short + ::> representation of the gram, and an optional + ::> timestamp. :: + ^- tape =+ txt=(tr-text =(who our.bol)) ?: =(~ txt) "" - =+ ^= baw - :: ?: oug - :: ~(ar-whom ar man tr-pals) - ?. (~(has in sef) %noob) - (~(sr-curt sr man [who (main who)]) |) - (~(sr-nick sr man [who (main who)])) + =/ baw + :: ?: oug + :: ~(ar-whom ar tr-pals) + ?. (~(has in sef) %noob) + (~(sr-curt sr [who (main who)]) |) + (~(sr-nick sr [who (main who)])) ?: (~(has in sef) %showtime) =+ dat=(yore now.bol) - =+ ^= t - |= a/@ ^- tape + =/ t + |= a/@ %+ weld - ?: (lth a 10) "0" ~ - (scow %ud a) - =+ ^= time :(weld "~" (t h.t.dat) "." (t m.t.dat) "." (t s.t.dat)) + ?: (lth a 10) "0" ~ + (scow %ud a) + =/ time + ;: weld + "~" (t h.t.dat) + "." (t m.t.dat) + "." (t s.t.dat) + == :(weld baw txt (reap (sub 67 (lent txt)) ' ') time) (weld baw txt) :: - ++ tr-meta ^- tang - ::x build strings that display metadata, including message serial, - ::x timestamp, author and audience. + ++ tr-meta ::< metadata + ::> builds string that display metadata, including + ::> message serial, timestamp, author and audience. :: - =. wen (sub wen (mod wen (div wen ~s0..0001))) :: round + ^- tang + =. wen (sub wen (mod wen (div wen ~s0..0001))) :: round =+ hed=leaf+"{(scow %uv sen)} at {(scow %da wen)}" - =+ =< paz=(turn (~(tap by aud)) .) - |=({a/partner *} leaf+~(pr-full pr man a)) + =/ paz + %+ turn (~(tap by aud)) + |= {a/partner *} + leaf+~(pr-full pr a) =+ bok=(turn (sort (~(tap in bou)) aor) smyt) [%rose [" " ~ ~] [hed >who< [%rose [", " "to " ~] paz] bok]]~ :: - ++ tr-body - ::x long-form display of message contents, specific to each speech type. + ++ tr-body ::< message content + ::> long-form display of message contents, specific + ::> to each speech type. :: |- ^- sole-effect - ?+ -.sep tan+[>sep<]~ - $exp tan+~[leaf+"# {(trip p.sep)}"] - $lin tan+~[leaf+"{?:(p.sep "" "@ ")}{(trip q.sep)}"] - $non tan+~ - $app tan+~[rose+[": " ~ ~]^~[leaf+"[{(trip p.sep)}]" leaf+(trip q.sep)]] - $url url+(crip (earf p.sep)) - $mor mor+(turn p.sep |=(speech ^$(sep +<))) - $fat [%mor $(sep q.sep) tan+(tr-rend-tors p.sep) ~] - $inv - :- %tan - :_ ~ - :- %leaf - %+ weld - ?: p.sep - "you have been invited to " - "you have been banished from " - ~(sr-phat sr man q.sep) - $api - :- %tan - :_ ~ - :+ %rose - [": " ~ ~] - :~ leaf+"[{(trip id.sep)} on {(trip service.sep)}]" - leaf+(trip body.sep) - leaf+(earf url.sep) - == + ?+ -.sep + tan+[>sep<]~ + :: + $non + tan+~ + :: + $lin + tan+~[leaf+"{?:(p.sep "" "@ ")}{(trip q.sep)}"] + :: + $url + url+(crip (earf p.sep)) + :: + $exp + tan+~[leaf+"# {(trip p.sep)}"] + :: + $fat + [%mor $(sep q.sep) tan+(tr-tors p.sep) ~] + :: + $inv + :- %tan + :_ ~ + :- %leaf + %+ weld + ?: p.sep + "you have been invited to " + "you have been banished from " + ~(sr-phat sr q.sep) + $mor + mor+(turn p.sep |=(speech ^$(sep +<))) + :: + $app + tan+~[rose+[": " ~ ~]^~[leaf+"[{(trip p.sep)}]" leaf+(trip q.sep)]] + :: + $api + :- %tan + :_ ~ + :+ %rose + [": " ~ ~] + :~ leaf+"[{(trip id.sep)} on {(trip service.sep)}]" + leaf+(trip body.sep) + leaf+(earf url.sep) + == == :: - ++ tr-rend-tors - ::x render an attachment. + ++ tr-tors ::< attachment + ::> renders an attachment. :: - |= a/torso ^- tang + |= a/torso + ^- tang ?- -.a $name (welp $(a q.a) leaf+"={(trip p.a)}" ~) $tank +.a $text (turn (flop +.a) |=(b/cord leaf+(trip b))) == :: - ++ tr-pals - ::x strip delivery info from audience, producing a set of partners. + ++ tr-pals ::< aud w/o delivery + ::> strip delivery info from audience, producing a + ::> plain set of partners. :: ^- (set partner) %- ~(gas in *(set partner)) - (turn (~(tap by aud)) |=({a/partner *} a)) + %+ turn (~(tap by aud)) + |=({a/partner *} a) :: - ++ tr-chow - ::x truncate the txt to be of max len characters. if it does truncate, - ::x indicates it did so by appending a character. + ++ 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 + |= {len/@u txt/tape} + ^- tape ?: (gth len (lent txt)) txt =. txt (scag len txt) |- @@ -1775,69 +2032,87 @@ ?~ t.txt "…" [i.txt $(txt t.txt)] :: - ++ tr-both - ::x try to fit two tapes into a single line. + ++ tr-both ::< two tapes one line + ::> attempts to fit two tapes into a 64-char line. :: - |= {a/tape b/tape} ^- tape + |= {a/tape b/tape} + ^- tape ?: (gth (lent a) 62) (tr-chow 64 a) %+ weld a (tr-chow (sub 64 (lent a)) " {b}") :: - ++ tr-text - ::x gets a tape representation of a message that fits within a single line. + ++ tr-text ::< one line contents + ::> renders a single-line version of the message. :: |= oug/? ^- tape - ?+ -.sep ~&(tr-lost+sep "") + ?+ -.sep + ~&(tr-lost+sep "") + :: $mor ?~ p.sep ~&(%tr-mor-empty "") |- ^- tape ?~ t.p.sep ^$(sep i.p.sep) (tr-both ^$(sep i.p.sep) $(p.sep t.p.sep)) - :: + :: $fat %+ tr-both $(sep q.sep) ?+ -.p.sep "..." $tank ~(ram re %rose [" " `~] +.p.sep) == - :: - $exp (tr-chow 66 '#' ' ' (trip p.sep)) - $url =+ ful=(earf p.sep) - ?: (gth 64 (lent ful)) ['/' ' ' ful] - :+ '/' '_' - =+ hok=r.p.p.p.sep - ~! hok - =- (swag [a=(sub (max 64 (lent -)) 64) b=64] -) - ^- tape - =< ?:(?=($& -.hok) (reel p.hok .) +:(scow %if p.hok)) - |=({a/knot b/tape} ?~(b (trip a) (welp b '.' (trip a)))) - :: + :: + $exp + (tr-chow 66 '#' ' ' (trip p.sep)) + :: + $url + =+ ful=(earf p.sep) + ?: (gth 64 (lent ful)) ['/' ' ' ful] + :+ '/' '_' + =+ hok=r.p.p.p.sep + ~! hok + =- (swag [a=(sub (max 64 (lent -)) 64) b=64] -) + ^- tape + =< ?: ?=($& -.hok) + (reel p.hok .) + +:(scow %if p.hok) + |= {a/knot b/tape} + ?~ b (trip a) + (welp b '.' (trip a)) + :: $lin =+ txt=(trip q.sep) ?: p.sep =+ pal=tr-pals - =. pal ?: =(who our.bol) pal + =. pal ?: =(who our.bol) pal ::TODO =? (~(del in pal) [%& who (main who)]) - (weld ~(ar-pref ar man pal) txt) + (weld ~(ar-pref ar pal) txt) (weld " " txt) - :: + :: $inv %+ weld ?: p.sep " invited you to " " banished you from " - ~(sr-phat sr man q.sep) - :: + ~(sr-phat sr q.sep) + :: $app (tr-chow 64 "[{(trip p.sep)}]: {(trip q.sep)}") - :: + :: $api - (tr-chow 64 "[{(trip id.sep)}@{(trip service.sep)}]: {(trip summary.sep)}") + %+ tr-chow 64 + %+ weld + "[{(trip id.sep)}@{(trip service.sep)}]: " + (trip summary.sep) == -- :: -++ peer - ::x incoming subscription on pax. +::> || +::> || %events +::> || +::+| +:: +++ peer ::< accept subscription + ::> incoming subscription on pax. :: |= pax/path ^- (quip move +>) @@ -1847,19 +2122,20 @@ ?. ?=({$sole *} pax) ~& [%peer-talk-reader-strange pax] [~ +>] - ta-done:(ta-console:ta src.bol t.pax) + ta-done:ta-console:ta :: -++ diff-talk-lowdown - ::x incoming talk-lowdown. process it. - ::x we *could* use the wire to identify what story subscription our lowdown - ::x is coming from, but since we only ever subscribe to a single story, we - ::x don't bother. +++ diff-talk-lowdown ::< accept lowdown + ::> incoming talk-lowdown. process it. + ::> we *could* use the wire to identify what story + ::> subscription our lowdown is coming from, but + ::> since we only ever subscribe to a single story, + ::> we don't bother. :: |= {way/wire low/lowdown} ta-done:(ta-low:ta low) :: -++ diff-talk-reaction :: accept reaction - ::x incoming talk reaction. process it. +++ diff-talk-reaction ::< accept reaction + ::> incoming talk reaction. process it. :: |= {way/wire rac/reaction} ?. =(src.bol -:(broker our.bol)) @@ -1867,8 +2143,8 @@ [~ +>] ta-done:(ta-reaction:ta rac) :: -++ poke-sole-action :: accept console - ::x incoming sole action. process it. +++ poke-sole-action ::< accept console + ::> incoming sole action. process it. :: |= act/sole-action ta-done:(ta-sole:ta act) From 23bdb637b2ba2e2d6b2266ba201bc055c90fdaec Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 24 Apr 2017 20:17:56 +0200 Subject: [PATCH 079/303] Bound faces to talk structures. Renamed stations to circles. Communication structures get no new faces because their ideal implementation uses gates to process them. --- app/talk-agent.hoon | 290 +++++++++++++++++++++-------------------- app/talk-guardian.hoon | 198 ++++++++++++++-------------- sur/talk.hoon | 108 +++++++-------- 3 files changed, 303 insertions(+), 293 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index dcea570da3..0103a33518 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -36,11 +36,11 @@ sources/(set partner) ::< our subscriptions :: partner details :: remotes/(map partner atlas) ::< remote presences - mirrors/(map station config) ::< remote configs + mirrors/(map circle config) ::< remote configs :: ui state :: folks/(map ship human) ::< human identities - nik/(map (set partner) char) ::< bound station glyphs - nak/(jug char (set partner)) ::< station glyph lookup + nik/(map (set partner) char) ::< bound circle glyphs + nak/(jug char (set partner)) ::< circle glyph lookup cli/shell ::< interaction state == :: ++ shell ::> console session @@ -65,11 +65,11 @@ {$peer wire dock path} :: == :: ++ work ::> interface action - $% :: station management :: + $% :: circle management :: {$join p/where} ::< subscribe to {$leave p/where} ::< unsubscribe from - {$create p/posture q/knot r/cord} ::< create station - {$delete p/knot q/(unit cord)} ::< delete station + {$create p/posture q/knot r/cord} ::< create circle + {$delete p/knot q/(unit cord)} ::< delete circle {$depict p/knot q/cord} ::< change description {$source p/knot q/(set partner)} ::< add source {$invite p/knot q/(set ship)} ::< give permission @@ -88,11 +88,11 @@ {$nick p/(unit ship) q/(unit cord)} ::< un/set/show nick {$set p/knot} ::< enable setting {$unset p/knot} ::< disable setting - :: miscellaneous :: + :: miscellaneous :: {$help $~} ::< print usage info == :: ++ where (set partner) ::< non-empty audience - ++ glyphs `wall`~[">=+-" "}),." "\"'`^" "$%&@"] ::< station char pool ' + ++ glyphs `wall`~[">=+-" "}),." "\"'`^" "$%&@"] ::< circle char pool ' -- :: ::> || @@ -124,8 +124,8 @@ our (sein our) :: -++ inbox ::< reader's station - ::> produces the name of the station used by this +++ inbox ::< reader's circle + ::> produces the name of the circle used by this ::> reader for all its operations (main our.bol) :: @@ -266,38 +266,38 @@ == :: ++ ta-low-confs ::< apply changed confs - ::> applies new station configurations. + ::> applies new circle configurations. ::> because of how this reader only subscribes to ::> the main mailbox, {coy} is always the mailbox's ::> config. :: - |= {coy/(unit config) cofs/(map station (unit config))} + |= {coy/(unit config) cofs/(map circle (unit config))} ^+ +> ::> if possible, update {sources}. if we do, and we ::> gain new ones, update the prompt. (this is to ::> remove the mailbox from the audience after - ::> creating or joining a new station.) + ::> creating or joining a new circle.) ?~ coy ~&(%mailbox-gone !!) =. +> ::TODO =? - ?~ (~(dif in sources.u.coy) sources) +>.$ + ?~ (~(dif in src.u.coy) sources) +>.$ =< sh-done - %- ~(sh-pact sh(sources sources.u.coy) cli) - (~(dif in sources.u.coy) sources) - =. sources sources.u.coy + %- ~(sh-pact sh(sources src.u.coy) cli) + (~(dif in src.u.coy) sources) + =. sources src.u.coy =. cofs (~(put by cofs) [our.bol inbox] coy) :: print changes for each config. =. +>.$ =< sh-done %+ roll (~(tap by cofs)) - |= {{s/station c/(unit config)} core/_sh} + |= {{s/circle c/(unit config)} core/_sh} %^ ~(sh-low-config core cli) s (~(get by mirrors) s) c :: apply config changes to {mirrors}. =. mirrors %- ~(gas by *_mirrors) %+ murn (~(tap by cofs)) - |= {s/station c/(unit config)} - ^- (unit (pair station config)) + |= {s/circle c/(unit config)} + ^- (unit (pair circle config)) ?~(c ~ `[s u.c]) +>.$ :: @@ -351,7 +351,7 @@ :: |= gam/telegram ^+ +> - =+ old=(~(get by known) p.q.gam) + =+ old=(~(get by known) uid.tot.gam) ?~ old (ta-append gam) ::< add (ta-revise u.old gam) ::< modify @@ -364,7 +364,7 @@ %= +> grams [gam grams] count +(count) - known (~(put by known) p.q.gam count) + known (~(put by known) uid.tot.gam count) == :: ++ ta-revise ::< revise message @@ -514,10 +514,10 @@ == == :: - ++ stat ::< local station + ++ stat ::< local circle ;~(pfix cen sym) :: - ++ stan ::< station + ++ stan ::< circle ;~ pose (cold [our.bol inbox] col) ;~(pfix cen (stag our.bol sym)) @@ -589,7 +589,7 @@ :: ++ nick (cook crip (stun [1 14] low)) ::< nickname ++ text (cook crip (plus (shim ' ' '~'))) ::< bullets separating - ++ glyph (mask "/\\\{( || - ::> || %station-management + ::> || %circle-management ::> || ::+| :: @@ -946,7 +946,7 @@ (sh-act %source inbox | pas) :: ++ create ::< %create - ::> creates station {nom} with specified config. + ::> creates circle {nom} with specified config. :: |= {por/posture nom/knot txt/cord} ^+ ..sh-work @@ -958,7 +958,7 @@ (join [[%& our.bol nom] ~ ~]) :: ++ delete ::< %delete - ::> deletes our station {nom}, after optionally + ::> deletes our circle {nom}, after optionally ::> sending a last announce message {say}. :: |= {nom/knot say/(unit cord)} @@ -973,21 +973,21 @@ (sh-act %depict nom txt) :: ++ source ::< %source - ::> adds {pas} to {nom}'s sources. + ::> adds {pas} to {nom}'s src. :: |= {nom/knot pas/(set partner)} ^+ ..sh-work (sh-act %source nom & pas) :: ++ invite ::< %invite - ::> invites {sis} to our station {nom}. + ::> invites {sis} to our circle {nom}. :: |= {nom/knot sis/(set ship)} ^+ ..sh-work (sh-act %permit nom & sis) :: ++ banish ::< %banish - ::> banish {sis} from our station {nom}. + ::> banish {sis} from our circle {nom}. :: |= {nom/knot sis/(set ship)} ^+ ..sh-work @@ -1039,12 +1039,13 @@ =< (murn (sort (~(tap by alt)) aor) .) |= {a/ship b/presence c/human} ^- (unit tank) =. c - ?. =(hand.c `(scot %p a)) c - [true.c ~] + ?. =(han.c `(scot %p a)) c + [tru.c ~] ?- b $gone ~ - $hear `leaf+:(weld "hear " (scow %p a) " " (trip (fall hand.c ''))) - $talk `leaf+:(weld "talk " (scow %p a) " " (trip (fall hand.c ''))) + $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 @@ -1120,17 +1121,17 @@ %+ turn (~(tap by folks)) |= {p/ship q/human} :- %txt - ?~ hand.q + ?~ han.q "{

}:" - "{

}: {}" + "{

}: {}" ::> show her nick ?~ nym ?> ?=(^ her) =+ asc=(~(get by folks) u.her) %+ sh-fact %txt ?~ asc "{} unbound" - ?~ hand.u.asc "{}:" - "{}: {}" + ?~ han.u.asc "{}:" + "{}: {}" ::> show nick ship ?~ her %+ sh-fact %mor @@ -1225,7 +1226,7 @@ ::> if partner is a passport, ignore. ?. ?=($& -.tay) +> =+ cof=(~(get by mirrors) +.tay) - ?. |(?=($~ cof) !?=($white p.cordon.u.cof)) + ?. |(?=($~ cof) !?=($white sec.con.u.cof)) +>.$ (sh-pact [tay ~ ~]) :: @@ -1244,7 +1245,7 @@ |- ^- (unit (set partner)) ?~ grams ~ ::> get first partner from a telegram's audience. - =+ pan=(silt (turn (~(tap by q.q.i.grams)) head)) + =+ pan=(silt (turn (~(tap by aud.tot.i.grams)) head)) ?: (~(has in lax) pan) `pan $(grams t.grams) :: @@ -1271,11 +1272,11 @@ |- ^+ ret ?~ eno ret =. ret $(eno t.eno) - ?: =(%gone p.q.i.eno) ret + ?: =(%gone pec.q.i.eno) ret =+ unt=(~(get by two) p.i.eno) ?~ unt ret(old [i.eno old.ret]) - ?: =(%gone p.u.unt) + ?: =(%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]) @@ -1284,10 +1285,10 @@ |- ^+ ret ?~ owt ret =. ret $(owt t.owt) - ?: =(%gone p.q.i.owt) ret + ?: =(%gone pec.q.i.owt) ret ?. (~(has by one) p.i.owt) ret(new [i.owt new.ret]) - ?: =(%gone p:(~(got by one) p.i.owt)) + ?: =(%gone pec:(~(got by one) p.i.owt)) ret(new [i.owt new.ret]) ret ret @@ -1329,11 +1330,11 @@ ::> maps, producing lists of removed, added and ::> changed configs. :: - |= {one/(map station config) two/(map station config)} + |= {one/(map circle config) two/(map circle config)} =| $= ret - $: old/(list (pair station config)) - new/(list (pair station config)) - cha/(list (pair station config)) + $: old/(list (pair circle config)) + new/(list (pair circle config)) + cha/(list (pair circle config)) == ^+ ret =. ret @@ -1374,7 +1375,7 @@ ::> renders a reaction to the cli. :: |= rac/reaction - (sh-lame (trip what.rac)) + (sh-lame (trip wat.rac)) :: ++ sh-lame ::< send error ::> just puts some text into the cli as-is. @@ -1435,9 +1436,9 @@ ++ sh-spaz ::< render status ::> gets the presence of {saz} as a tape. :: - |= saz/status + |= sat/status ^- tape - ['%' (trip p.saz)] + ['%' (trip pec.sat)] :: ++ sh-show-precs ::< print atlas diff ::> prints presence changes to the cli. @@ -1510,38 +1511,38 @@ |= {pre/tape laz/config loc/config} ^+ +> =. +>.$ - ?: =(caption.loc caption.laz) +>.$ - (sh-note :(weld pre "cap " (trip caption.loc))) + ?: =(cap.loc cap.laz) +>.$ + (sh-note :(weld pre "cap " (trip cap.loc))) =. +>.$ %+ sh-show-sources (weld (trip inbox) ": ") - (sh-set-diff sources.laz sources.loc) - ?: !=(p.cordon.loc p.cordon.laz) - =. +>.$ (sh-note :(weld pre "but " (sh-puss p.cordon.loc))) + (sh-set-diff src.laz src.loc) + ?: !=(sec.con.loc sec.con.laz) + =. +>.$ (sh-note :(weld pre "but " (sh-puss sec.con.loc))) %^ sh-show-permits (weld (trip inbox) ": ") - p.cordon.loc - [~ (~(tap in q.cordon.loc))] + sec.con.loc + [~ (~(tap in ses.con.loc))] %^ sh-show-permits (weld (trip inbox) ": ") - p.cordon.loc - (sh-set-diff q.cordon.laz q.cordon.loc) + sec.con.loc + (sh-set-diff ses.con.laz ses.con.loc) :: ++ sh-low-config ::< do show config - ::> prints a station's config changes to the cli. + ::> prints a circle's config changes to the cli. :: - |= {sat/station old/(unit config) new/(unit config)} + |= {sat/circle old/(unit config) new/(unit config)} ^+ +> ?~ old ~&([%new-conf sat] +>) ?~ new ~&([%del-conf sat] +>) ::TODO tmp %^ sh-show-config - (weld ~(sr-phat sr sat) ": ") + (weld ~(cr-phat cr sat) ": ") u.old u.new :: ++ sh-low-remco ::TODO delete me ::> prints changes to remote configs to the cli :: - |= {ole/(map station config) neu/(map station config)} + |= {ole/(map circle config) neu/(map circle config)} ^+ +> =+ (sh-remco-diff ole neu) =. +>.$ @@ -1550,15 +1551,15 @@ =. +>.^$ $(new t.new) =. +>.^$ (sh-pest [%& p.i.new]) %+ sh-show-config - (weld ~(sr-phat sr p.i.new) ": ") + (weld ~(cr-phat cr p.i.new) ": ") [*config q.i.new] =. +>.$ |- ^+ +>.^$ ?~ cha +>.^$ =. +>.^$ $(cha t.cha) %+ sh-show-config - (weld ~(sr-phat sr p.i.cha) ": ") - [(~(got by ole) `station`p.i.cha) q.i.cha] + (weld ~(cr-phat cr p.i.cha) ": ") + [(~(got by ole) `circle`p.i.cha) q.i.cha] +>.$ :: ++ sh-low-rempe ::< show remotes @@ -1630,81 +1631,81 @@ ::> rendering cores. ::+| :: -++ sr ::< station renderer - ::> used in both station and ship rendering. +++ cr ::< circle renderer + ::> used in both circle and ship rendering. :: - |_ ::> one: the station. + |_ ::> one: the circle. :: - one/station + one/circle :: - ++ sr-best ::< best to show + ++ cr-best ::< best to show ::> returns true if one is better to show, false ::> otherwise. prioritizes: our > main > size. - ::TODO maybe simplify. (lth (xeb (xeb p.one)) (xeb (xeb p.two))) + ::TODO maybe simplify. (lth (xeb (xeb hos.one)) (xeb (xeb hos.two))) :: - |= two/station + |= two/circle ^- ? - :: the station that's ours is better. - ?: =(our.bol p.one) - ?: =(our.bol p.two) - ?< =(q.one q.two) - :: if both stations are ours, the main story is better. - ?: =((main p.one) q.one) %& - ?: =((main p.two) q.two) %| + :: the circle that's ours is better. + ?: =(our.bol hos.one) + ?: =(our.bol hos.two) + ?< =(nom.one nom.two) + :: if both circles are ours, the main story is better. + ?: =((main hos.one) nom.one) %& + ?: =((main hos.two) nom.two) %| :: if neither are, pick the "larger" one. - (lth q.one q.two) + (lth nom.one nom.two) %& :: if one isn't ours but two is, two is better. - ?: =(our.bol p.two) + ?: =(our.bol hos.two) %| - ?: =(p.one p.two) + ?: =(hos.one hos.two) :: if they're from the same ship, pick the "larger" one. - (lth q.one q.two) + (lth nom.one nom.two) :: when in doubt, pick one if its ship is "smaller" than its channel. - (lth p.one q.one) + (lth hos.one nom.one) :: - ++ sr-curt ::< render name in 14 + ++ cr-curt ::< render name in 14 ::> prints a ship name in 14 characters. left-pads ::> with spaces. {mup} signifies "are there other ::> targets besides this one?" :: |= mup/? ^- tape - =+ raw=(cite p.one) + =+ raw=(cite hos.one) (runt [(sub 14 (lent raw)) ' '] raw) :: - ++ sr-nick ::< nick or name in 14 + ++ cr-nick ::< nick or name in 14 ::> get nick for ship, or shortname if no nick. ::> left-pads with spaces. :: |. ^- tape - =+ nym=(~(get by folks) p.one) + =+ nym=(~(get by folks) hos.one) ?~ nym - (sr-curt |) - ?~ hand.u.nym - (sr-curt |) - =+ raw=(trip u.hand.u.nym) + (cr-curt |) + ?~ han.u.nym + (cr-curt |) + =+ raw=(trip u.han.u.nym) =+ len=(sub 14 (lent raw)) (weld (reap len ' ') raw) :: - ++ sr-phat ::< render accurately - ::> prints a station fully, but still taking + ++ cr-phat ::< render accurately + ::> prints a circle fully, but still taking ::> "shortcuts" where possible: ::> ":" for local mailbox, "~ship" for foreign - ::> mailbox, "%channel" for local station, - ::> "/channel" for parent station. + ::> mailbox, "%channel" for local circle, + ::> "/channel" for parent circle. :: ^- tape - ?: =(p.one our.bol) - ?: =(q.one inbox) + ?: =(hos.one our.bol) + ?: =(nom.one inbox) ":" - ['%' (trip q.one)] - ?: =(p.one (sein our.bol)) - ['/' (trip q.one)] - =+ wun=(scow %p p.one) - ?: =(q.one (main p.one)) + ['%' (trip nom.one)] + ?: =(hos.one (sein our.bol)) + ['/' (trip nom.one)] + =+ wun=(scow %p hos.one) + ?: =(nom.one (main hos.one)) wun - :(welp wun "/" (trip q.one)) + :(welp wun "/" (trip nom.one)) -- :: ++ pr ::< partner renderer @@ -1716,8 +1717,8 @@ :: ++ pr-beat ::< more relevant ::> returns true if one is better to show, false - ::> otherwise. prefers stations over passports. - ::> if both are stations, ++sr-best. + ::> otherwise. prefers circles over passports. + ::> if both are circles, ++cr-best. ::> if both are passports, pick the "larger" one. ::> if they're equal, content hash. :: @@ -1726,7 +1727,7 @@ $& ?- -.two $| %& - $& (~(sr-best sr p.one) p.two) + $& (~(cr-best cr p.one) p.two) == :: $| @@ -1767,13 +1768,13 @@ |= moy/(unit ?) ^- tape ?- -.one - :: render station (as glyph if we can). + :: render circle (as glyph if we can). $& ?~ moy =+ cha=(~(get by nik) one ~ ~) =- ?~(cha - "'{u.cha ~}' {-}") - ~(sr-phat sr p.one) - (~(sr-curt sr p.one) u.moy) + ~(cr-phat cr p.one) + (~(cr-curt cr p.one) u.moy) :: render passport. $| =/ pre ^- tape @@ -1850,9 +1851,9 @@ :: |= pan/partner ^- ? ?& ?=($& -.pan) - =(p.p.pan our.bol) + =(hos.p.pan our.bol) =+ sot=(~(get by mirrors) +.pan) - &(?=(^ sot) ?=($brown p.cordon.u.sot)) + &(?=(^ sot) ?=($brown sec.con.u.sot)) == :: ++ ar-pref ::< audience glyph @@ -1915,8 +1916,8 @@ :: ?: oug :: ~(ar-whom ar tr-pals) ?. (~(has in sef) %noob) - (~(sr-curt sr [who (main who)]) |) - (~(sr-nick sr [who (main who)])) + (~(cr-curt cr [who (main who)]) |) + (~(cr-nick cr [who (main who)])) ?: (~(has in sef) %showtime) =+ dat=(yore now.bol) =/ t @@ -1959,31 +1960,32 @@ tan+~ :: $lin - tan+~[leaf+"{?:(p.sep "" "@ ")}{(trip q.sep)}"] + tan+~[leaf+"{?:(pat.sep "" "@ ")}{(trip msg.sep)}"] :: $url - url+(crip (earf p.sep)) + url+(crip (earf url.sep)) :: $exp - tan+~[leaf+"# {(trip p.sep)}"] + tan+~[leaf+"# {(trip exp.sep)}"] :: $fat - [%mor $(sep q.sep) tan+(tr-tors p.sep) ~] + [%mor $(sep sep.sep) tan+(tr-tors tac.sep) ~] :: $inv :- %tan :_ ~ :- %leaf %+ weld - ?: p.sep + ?: inv.sep "you have been invited to " "you have been banished from " - ~(sr-phat sr q.sep) + ~(cr-phat cr sat.sep) + :: $mor - mor+(turn p.sep |=(speech ^$(sep +<))) + mor+(turn ses.sep |=(speech ^$(sep +<))) :: $app - tan+~[rose+[": " ~ ~]^~[leaf+"[{(trip p.sep)}]" leaf+(trip q.sep)]] + tan+~[rose+[": " ~ ~]^~[leaf+"[{(trip app.sep)}]" leaf+(trip msg.sep)]] :: $api :- %tan @@ -2002,7 +2004,7 @@ |= a/torso ^- tang ?- -.a - $name (welp $(a q.a) leaf+"={(trip p.a)}" ~) + $name (welp $(a tac.a) leaf+"={(trip nom.a)}" ~) $tank +.a $text (turn (flop +.a) |=(b/cord leaf+(trip b))) == @@ -2050,25 +2052,25 @@ ~&(tr-lost+sep "") :: $mor - ?~ p.sep ~&(%tr-mor-empty "") + ?~ ses.sep ~&(%tr-mor-empty "") |- ^- tape - ?~ t.p.sep ^$(sep i.p.sep) - (tr-both ^$(sep i.p.sep) $(p.sep t.p.sep)) + ?~ t.ses.sep ^$(sep i.ses.sep) + (tr-both ^$(sep i.ses.sep) $(ses.sep t.ses.sep)) :: $fat - %+ tr-both $(sep q.sep) - ?+ -.p.sep "..." - $tank ~(ram re %rose [" " `~] +.p.sep) + %+ tr-both $(sep sep.sep) + ?+ -.tac.sep "..." + $tank ~(ram re %rose [" " `~] +.tac.sep) == :: $exp - (tr-chow 66 '#' ' ' (trip p.sep)) + (tr-chow 66 '#' ' ' (trip exp.sep)) :: $url - =+ ful=(earf p.sep) + =+ ful=(earf url.sep) ?: (gth 64 (lent ful)) ['/' ' ' ful] :+ '/' '_' - =+ hok=r.p.p.p.sep + =+ hok=r.p.p.url.sep ~! hok =- (swag [a=(sub (max 64 (lent -)) 64) b=64] -) ^- tape @@ -2080,8 +2082,8 @@ (welp b '.' (trip a)) :: $lin - =+ txt=(trip q.sep) - ?: p.sep + =+ txt=(trip msg.sep) + ?: pat.sep =+ pal=tr-pals =. pal ?: =(who our.bol) pal ::TODO =? (~(del in pal) [%& who (main who)]) @@ -2090,13 +2092,13 @@ :: $inv %+ weld - ?: p.sep + ?: inv.sep " invited you to " " banished you from " - ~(sr-phat sr q.sep) + ~(cr-phat cr sat.sep) :: $app - (tr-chow 64 "[{(trip p.sep)}]: {(trip q.sep)}") + (tr-chow 64 "[{(trip app.sep)}]: {(trip msg.sep)}") :: $api %+ tr-chow 64 diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 112e5b37cb..1bbe1fa63c 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -3,8 +3,10 @@ :: :: :: :: ::TODO master changes +::TODO char57 comments as line comments when regarding code. ::TODO avoid lark where possible ::TODO maybe rename wires. repeat & friend -> message & follower +::TODO put printfs properly through console/mailbox ::TODO think about what printfs we want to keep for the user to see. ::TODO document what user-facing printfs actually mean! ::TODO ::> to :> etc. @@ -44,8 +46,8 @@ outbox/(pair @ud (map @ud thought)) ::< urbit outbox log/(map knot @ud) ::< logged to clay folks/(map ship human) ::< human identities - nik/(map (set partner) char) ::< bound station glyphs - nak/(jug char (set partner)) ::< station glyph lookup + nik/(map (set partner) char) ::< bound circle glyphs + nak/(jug char (set partner)) ::< circle glyph lookup == :: ++ story ::> wire content $: count/@ud ::< (lent grams) @@ -53,7 +55,7 @@ locals/atlas ::< local presence remotes/(map partner atlas) ::< remote presence shape/config ::< configuration - mirrors/(map station config) ::< remote config + mirrors/(map circle config) ::< remote config ::TODO never gets updated. :: sequence/(map partner @ud) ::< partners heard known/(map serial @ud) ::< messages heard @@ -85,7 +87,7 @@ == :: ++ weir ::> parsed wire $% {$repeat p/@ud q/@p r/knot} ::< messaging wire - {$friend p/knot q/station} ::< subscription wire + {$friend p/knot q/circle} ::< subscription wire == :: -- :: @@ -197,7 +199,7 @@ ::> a story core. if it doesn't, does nothing. :: |= nom/knot - |* fun/$-(_so _+>) + |= fun/$-(_so _ta) ^+ +>+> =+ pur=(~(get by stories) nom) ?~ pur @@ -242,7 +244,7 @@ |= {src/ship cod/command} ^+ +> ?- -.cod - ::> %review commands prompt us (as a station host) + ::> %review commands prompt us (as a circle host) ::> to verify and distribute messages. $review (ta-think | src +.cod) @@ -268,7 +270,7 @@ ++ work ::< perform action ^+ ..ta-action ?- -.act - :: station configuration + :: circle configuration $create (action-create +.act) $source (action-source +.act) $depict (action-depict +.act) @@ -291,7 +293,7 @@ ::> if it doesn't, reacts accordingly. :: |= nom/knot - |* fec/$-(_so _ta) + |= fec/$-({_so story} _ta) ^+ ta =+ pur=(~(get by stories) nom) ?^ pur @@ -299,7 +301,7 @@ %+ ta-react red [%fail (crip "no story {(trip nom)}") `act] :: - ::> || %station-configuration + ::> || %circle-configuration ::+| ++ action-create ::< create story ::> creates a story with the specified parameters. @@ -316,11 +318,11 @@ |= {nom/knot sub/? pas/(set partner)} ^+ ..ta-action %- (affect nom) |= {sor/_so soy/story} - =. sources.shape.soy + =. src.shape.soy %. pas ?: sub - ~(uni in sources.shape.soy) - ~(dif in sources.shape.soy) + ~(uni in src.shape.soy) + ~(dif in src.shape.soy) (ta-config nom shape.soy) :: ++ action-depict ::< change description @@ -329,7 +331,7 @@ |= {nom/knot des/cord} ^+ ..ta-action %- (affect nom) |= {sor/_so soy/story} - =. caption.shape.soy des + =. cap.shape.soy des (ta-config nom shape.soy) :: ++ action-permit ::< invite/banish @@ -403,12 +405,12 @@ ^+ ..ta-action ?. =((~(get by folks) sip) `nic) ..ta-action ::< no change =. folks - ?~ hand.nic (~(del by folks) sip) + ?~ han.nic (~(del by folks) sip) (~(put by folks) sip nic) %+ ta-inform %names ::TODO think long and hard, do we need unit for delition or is a human :: with [~ ~] good enough? if the latter, agent's $names will change. - (strap sip ?~(hand.nic ~ `nic)) + (strap sip ?~(han.nic ~ `nic)) :: ++ action-glyph ::< bind a glyph ::> un/bind glyph {lif} to partners {pas}. @@ -440,7 +442,7 @@ ++ ta-diff-report ::< subscription update ::> process a talk report from {sat} into story {nom}. :: - |= {nom/knot sat/station ret/report} + |= {nom/knot sat/circle ret/report} %- (ta-know nom) |= sor/_so =< so-done (so-diff-report:sor sat ret) :: @@ -527,14 +529,14 @@ ++ ta-retry ::< subscription resend ::> re-subscribes {sat} to story {nom}. :: - |= {nom/knot sat/station} + |= {nom/knot sat/circle} %- (ta-know nom) |= sor/_so =< so-done (so-acquire:sor [%& sat]~) :: ++ ta-quit ::< subscription failed ::> removes {sat} from story {nom}'s followers. :: - |= {nom/knot sat/station} + |= {nom/knot sat/circle} %- (ta-know nom) |= sor/_so =< so-done (so-quit:sor %& sat) :: @@ -674,17 +676,17 @@ :: ++ ta-sane ::< sanitize ::> sanitize %lin speech, enforce lowercase and no special characters. - ::TODO make configurable per-station. + ::TODO make configurable per-circle. :: |= tot/thought ^- thought - ?. ?=({$lin *} r.r.tot) tot - %_ tot - q.r.r + ?. ?=({$lin *} sep.sam.tot) tot + %_ tot + msg.sep.sam %- crip %+ scag 64 %- tufa - %+ turn (tuba (trip q.r.r.tot)) + %+ turn (tuba (trip msg.sep.sam.tot)) |= a/@c ?: &((gte a 'A') (lte a 'Z')) (add a 32) @@ -698,7 +700,7 @@ :: |= {pub/? aut/ship tot/thought} =. tot (ta-sane tot) - =+ aud=(~(tap by q.tot)) + =+ aud=(~(tap by aud.tot)) |- ^+ +>.^$ ?~ aud +>.^$ $(aud t.aud, +>.^$ (ta-conduct pub aut p.i.aud tot)) @@ -709,16 +711,16 @@ |= {pub/? aut/ship pan/partner tot/thought} ^+ +> ?- -.pan - $& ::< station partner + $& ::< circle partner ?: pub ?. (team our.bol aut) ~&([%talk-strange-author aut] +>) =. aut our.bol - ?: =(aut p.p.pan) - (ta-record q.p.pan p.p.pan tot) + ?: =(aut hos.p.pan) + (ta-record nom.p.pan hos.p.pan tot) (ta-transmit p.pan tot) - ?. =(our.bol p.p.pan) +> - (ta-record q.p.pan aut tot) + ?. =(our.bol hos.p.pan) +> + (ta-record nom.p.pan aut tot) :: $| !! ::< passport partner == @@ -734,13 +736,13 @@ ::> sends thought {tot} to {sat}. ::> stores it to the outbox to await confirmation. :: - |= {sat/station tot/thought} + |= {sat/circle tot/thought} ^+ +> =. +> %+ ta-emit ost.bol :* %poke - /repeat/(scot %ud p.outbox)/(scot %p p.sat)/[q.sat] - [p.sat %talk-guardian] + /repeat/(scot %ud p.outbox)/(scot %p hos.sat)/[nom.sat] + [hos.sat %talk-guardian] [%talk-command [%review tot ~]] == +>(p.outbox +(p.outbox), q.outbox (~(put by q.outbox) p.outbox tot)) @@ -760,9 +762,9 @@ =+ oot=(~(get by q.outbox) num) ?~ oot ~|([%ta-repeat-none num] !!) =. q.outbox (~(del by q.outbox) num) - =. q.u.oot - =+ olg=(~(got by q.u.oot) pan) - %+ ~(put by q.u.oot) pan + =. aud.u.oot + =+ olg=(~(got by aud.u.oot) pan) + %+ ~(put by aud.u.oot) pan :- -.olg ?~ fal %received ~> %slog.[0 u.fal] @@ -787,10 +789,10 @@ ::> wyt: will be white =+ :+ neu=!(~(has by stories) nom) pur=(fall (~(get by stories) nom) *story) - wyt=?=(?($white $green) p.cordon.con) - =. q.cordon.con ::TODO =? + wyt=?=(?($white $green) sec.con.con) + =. ses.con.con ::TODO =? ?: &(neu wyt) [our.bol ~ ~] - q.cordon.con + ses.con.con so-done:(~(so-reform so nom ~ pur) con) :: ++ ta-unconfig ::< delete story @@ -922,8 +924,8 @@ %- ~(urn by remotes) :: XX performance |= {pan/partner atl/atlas} ^- atlas - ?. &(?=($& -.pan) =(our.bol p.p.pan)) atl - =+ soy=(~(get by stories) q.p.pan) + ?. &(?=($& -.pan) =(our.bol hos.p.pan)) atl + =+ soy=(~(get by stories) nom.p.pan) ?~ soy atl locals.u.soy :: @@ -937,22 +939,22 @@ ::> process a talk report from {sat}. ::> if we didn't expect it, ignore. :: - |= {sat/station ret/report} + |= {sat/circle ret/report} ^+ +> - ?. (~(has in sources.shape) [%& sat]) + ?. (~(has in src.shape) [%& sat]) ~& [%talk-so-diff-unexpected sat -.ret] +> ?- -.ret $cabal (so-cabal sat +.ret) $group (so-remind [%& sat] +.ret) - $grams (so-lesson q.+.ret) + $grams (so-lesson gaz.ret) == :: ++ so-cabal ::< update config - ::> add station's config to our remote config map. + ::> add circle's config to our remote config map. :: - ::TODO when do we care about ham? - |= {sat/station con/config ham/(map station config)} + ::TODO when do we care about rem? + |= {sat/circle con/config rem/(map circle config)} ^+ +> =+ old=mirrors =. mirrors (~(put by mirrors) sat con) @@ -986,7 +988,7 @@ ::+| :: ++ so-reform ::< reconfigure - ::> changes the config of this story and notify + ::> changes the config of this story and notify:: ::> our followers. ::> subscribes to new sources, unsubs from removed ::> ones. @@ -994,10 +996,10 @@ |= cof/config =. +>.$ (so-inform %confs `cof ~) =/ dif/(pair (list partner) (list partner)) - =+ old=`(list partner)`(~(tap in sources.shape) ~) - =+ new=`(list partner)`(~(tap in sources.cof) ~) - :- (skip new |=(a/partner (~(has in sources.shape) a))) - (skip old |=(a/partner (~(has in sources.cof) a))) + =+ old=`(list partner)`(~(tap in src.shape) ~) + =+ new=`(list partner)`(~(tap in src.cof) ~) + :- (skip new |=(a/partner (~(has in src.shape) a))) + (skip old |=(a/partner (~(has in src.cof) a))) =. +>.$ (so-acquire p.dif) =. +>.$ (so-abjure q.dif) =. shape cof @@ -1005,22 +1007,22 @@ :: ++ so-reform-gone ::< delete story ::> deletes this story. removes it from {stories} - ::> and unsubscribes from all sources. + ::> and unsubscribes from all src. :: =. stories (~(del by stories) nom) =. . (so-inform %confs ~ ~) =. . (so-report-cabal so-followers) - (so-abjure (~(tap in sources.shape))) + (so-abjure (~(tap in src.shape))) :: ++ so-notify ::< local presence ::> add {her} status to this story's presence map. ::> if this changes it, send a report. :: - |= {her/ship sas/status} + |= {her/ship sat/status} ^+ +> - =/ nol (~(put by locals) her sas) + =/ nol (~(put by locals) her sat) ?: =(nol locals) +>.$ - =. +>.$ (so-inform %precs (strap her sas) ~) + =. +>.$ (so-inform %precs (strap her sat) ~) (so-report-group(locals nol) so-followers) :: ::> || @@ -1047,12 +1049,12 @@ ?- -.pan $| !! ::< passport partner :: - $& ::< station partner + $& ::< circle partner :_ ~ :* %peer - /friend/show/[nom]/(scot %p p.p.pan)/[q.p.pan] - [p.p.pan %talk-guardian] - /[q.p.pan]/[ini] + /friend/show/[nom]/(scot %p hos.p.pan)/[nom.p.pan] + [hos.p.pan %talk-guardian] + /[nom.p.pan]/[ini] == == :: @@ -1068,11 +1070,11 @@ ?- -.pan $| !! ::< passport partner :: - $& ::< station partner + $& ::< circle partner :_ ~ :* %pull - /friend/show/[nom]/(scot %p p.p.pan)/[q.p.pan] - [p.p.pan %talk-guardian] + /friend/show/[nom]/(scot %p hos.p.pan)/[nom.p.pan] + [hos.p.pan %talk-guardian] ~ == == @@ -1083,8 +1085,8 @@ :: |= pan/partner ^+ +> - ?. (~(has in sources.shape) pan) +> - =. sources.shape (~(del in sources.shape) pan) + ?. (~(has in src.shape) pan) +> + =. src.shape (~(del in src.shape) pan) =. +> (so-inform %confs `shape ~) (so-report-cabal so-followers) :: @@ -1131,13 +1133,13 @@ ?~ gaz [dun end zeg] ?: ?- -.q.riv :: after the end $ud (lte p.q.riv end) - $da (lte p.q.riv p.r.q.i.gaz) + $da (lte p.q.riv wen.sam.tot.i.gaz) == :: if past the river, continue back, mark as done. $(end (dec end), gaz t.gaz, dun &) ?: ?- -.p.riv :: before the start $ud (lth end p.p.riv) - $da (lth p.r.q.i.gaz p.p.riv) + $da (lth wen.sam.tot.i.gaz p.p.riv) == :: if before the river, we're done searching. [dun end zeg] @@ -1188,12 +1190,12 @@ =+ old=[p=(welp p.lef p.rit) q=(welp q.lef q.rit)] ?: ?- -.q.q.n.followers :: after the end $ud (lte p.q.q.n.followers num) - $da (lte p.q.q.n.followers p.r.q.gam) + $da (lte p.q.q.n.followers wen.sam.tot.gam) == [[p.n.followers p.old] [[p.n.followers %quit ~] q.old]] ?: ?- -.p.q.n.followers :: before the start $ud (gth p.p.q.n.followers num) - $da (gth p.p.q.n.followers p.r.q.gam) + $da (gth p.p.q.n.followers wen.sam.tot.gam) == old :- p.old @@ -1217,22 +1219,22 @@ :: |= gam/telegram ^+ +> - ?. (so-admire p.gam) ::< write permissions + ?. (so-admire aut.gam) ::< write permissions +>.$ - =. q.q.gam + =. aud.tot.gam ::> if we are in the audience, mark as received. - =+ ole=(~(get by q.q.gam) [%& our.bol nom]) - ?^ ole (~(put by q.q.gam) [%& our.bol nom] -.u.ole %received) - ::> federated stations need to pretend ~src/nom + =+ ole=(~(get by aud.tot.gam) [%& our.bol nom]) + ?^ ole (~(put by aud.tot.gam) [%& our.bol nom] -.u.ole %received) + ::> federated circles need to pretend ~src/nom ::> is also ~our/nom. ::TODO pass src through explicitly instead of - :: relying on src.bol. - =+ ole=(~(get by q.q.gam) [%& src.bol nom]) - ?~ ole q.q.gam + :: relying on src.bol. : + =+ ole=(~(get by aud.tot.gam) [%& src.bol nom]) + ?~ ole aud.tot.gam ::> as described above, fake src into our. - =. q.q.gam (~(del by q.q.gam) [%& src.bol nom]) - (~(put by q.q.gam) [%& our.bol nom] -.u.ole %received) - =+ old=(~(get by known) p.q.gam) + =. aud.tot.gam (~(del by aud.tot.gam) [%& src.bol nom]) + (~(put by aud.tot.gam) [%& our.bol nom] -.u.ole %received) + =+ old=(~(get by known) uid.tot.gam) ?~ old (so-append gam) ::< add (so-revise u.old gam) ::< modify @@ -1245,7 +1247,7 @@ %+ %= so-refresh grams [gam grams] count +(count) - known (~(put by known) p.q.gam count) + known (~(put by known) uid.tot.gam count) == count gam @@ -1276,7 +1278,7 @@ ^+ +> ::> wyt: whitelist? ::> add: add to list? - =/ wyt/? ?=(?($white $green) p.cordon.shape) + =/ wyt/? ?=(?($white $green) sec.con.shape) =/ add/? =(inv wyt) =. +>.$ ::TODO =? ?: inv +>.$ @@ -1290,11 +1292,11 @@ [[%inv inv [our.bol nom]] t] %- so-reform %= shape - q.cordon + ses.con %. sis ?: add - ~(uni in q.cordon.shape) - ~(dif in q.cordon.shape) + ~(uni in ses.con.shape) + ~(dif in ses.con.shape) == :: ++ so-admire ::< accept from @@ -1302,11 +1304,11 @@ :: |= her/ship ^- ? - ?- p.cordon.shape - $black !(~(has in q.cordon.shape) her) ::< channel, blacklist - $white (~(has in q.cordon.shape) her) ::< village, whitelist - $green (~(has in q.cordon.shape) her) ::< journal, whitelist - $brown !(~(has in q.cordon.shape) her) ::< mailbox, blacklist + ?- sec.con.shape + $black !(~(has in ses.con.shape) her) ::< channel, blacklist + $white (~(has in ses.con.shape) her) ::< village, whitelist + $green (~(has in ses.con.shape) her) ::< journal, whitelist + $brown !(~(has in ses.con.shape) her) ::< mailbox, blacklist == :: ++ so-visible ::< display to @@ -1314,9 +1316,9 @@ :: |= her/ship ^- ? - ?- p.cordon.shape - $black !(~(has in q.cordon.shape) her) ::< channel, blacklist - $white (~(has in q.cordon.shape) her) ::< village, whitelist + ?- sec.con.shape + $black !(~(has in ses.con.shape) her) ::< channel, blacklist + $white (~(has in ses.con.shape) her) ::< village, whitelist $green & ::< journal, all $brown (team our.bol her) ::< mailbox, our team == @@ -1330,7 +1332,7 @@ :: ++ etch ::< parse wire ::> parses {wir}} to obtain either %friend with story - ::> and station or %repeat with message number, + ::> and circle or %repeat with message number, ::> source ship and story. :: |= wir/wire @@ -1356,7 +1358,7 @@ :: |= $: wir/wire $= fun - $- {nom/knot sat/station} + $- {nom/knot sat/circle} {(list move) _.} == =+ wer=(etch wir) @@ -1425,7 +1427,7 @@ ^- (quip move +>) =^ mos +>.$ %+ etch-friend wir - |= {nom/knot sat/station} + |= {nom/knot sat/circle} ta-done:(ta-diff-report:ta nom sat ret) =^ mow +>.$ log-all-to-file @@ -1456,7 +1458,7 @@ ^- (quip move +>) ?~ fal [~ +>] %+ etch-friend [%friend wir] - |= {nom/knot sat/station} + |= {nom/knot sat/circle} =. u.fal [>%reap-friend-fail nom sat< u.fal] %- (slog (flop u.fal)) ta-done:(ta-quit:ta nom sat) @@ -1467,7 +1469,7 @@ |= wir/wire ^- (quip move +>) %+ etch-friend [%friend wir] - |= {nom/knot sat/station} + |= {nom/knot sat/circle} ta-done:(ta-retry:ta nom sat) :: ++ coup-repeat ::< message n/ack diff --git a/sur/talk.hoon b/sur/talk.hoon index 07f6760d35..cc498b2945 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -3,8 +3,6 @@ !: |% :: -::TODO station -> circle -:: ::> || ::> || %reader-communication ::> || @@ -12,32 +10,35 @@ ::+| :: ++ action ::> user action - $% :: station configuration :: - {$create (trel knot cord posture)} ::< create station - {$source (trel knot ? (set partner))} ::< un/sub p to/from r - {$depict (pair knot cord)} ::< change description - {$permit (trel knot ? (set ship))} ::< invite/banish - {$delete (pair knot (unit cord))} ::< delete + announce + $% :: circle configuration :: + {$create nom/knot des/cord sec/posture} ::< create circle + {$source nom/knot sub/? src/(set partner)} ::< un/sub p to/from r + {$depict nom/knot des/cord} ::< change description + {$permit nom/knot inv/? sis/(set ship)} ::< invite/banish + {$delete nom/knot ano/(unit cord)} ::< delete + announce :: messaging :: - {$convey (list thought)} ::< post exact - {$phrase (pair (set partner) (list speech))} ::< post easy + {$convey tos/(list thought)} ::< post exact + {$phrase aud/(set partner) ses/(list speech)} ::< post easy :: personal metadata :: - ::TODO change to target partners, not only our stations. - {$status (pair (set knot) status)} ::< our status update + ::TODO change to target partners, not only our circles. + {$status nos/(set knot) sat/status} ::< our status update :: changing shared ui :: - {$human (pair ship human)} ::< new identity - {$glyph (trel char (set partner) ?)} ::< un/bind a glyph + {$human sip/ship man/human} ::< new identity + {$glyph gyf/char pas/(set partner) bin/?} ::< un/bind a glyph == :: ++ reaction ::> user information - $: kind/?($info $fail) ::< result - what/@t ::< explain + $: res/?($info $fail) ::< result + wat/@t ::< explain why/(unit action) ::< cause == :: ++ lowdown ::> new/changed state $% :: story state :: - {$confs (unit config) (map station (unit config))}::< configs - {$precs register} ::< presences - {$grams (pair @ud (list telegram))} ::< messages + $: $confs ::< configs + loc/(unit config) ::< local config + rem/(map circle (unit config)) ::< remote configs + == :: + {$precs reg/register} ::< presences + {$grams num/@ud gaz/(list telegram)} ::< messages :: ui state :: {$glyph (jug char (set partner))} ::< glyph bindings {$names (map ship (unit human))} ::< nicknames @@ -50,12 +51,12 @@ ::+| :: ++ command ::> effect on story - $% {$review (list thought)} ::< deliver + $% {$review tos/(list thought)} ::< deliver == :: ++ report ::> update - $% {$cabal cabal} ::< config neighborhood - {$group register} ::< presence - {$grams (pair @ud (list telegram))} ::< thoughts + $% {$cabal cab/cabal} ::< config neighborhood + {$group reg/register} ::< presence + {$grams num/@ud gaz/(list telegram)} ::< thoughts == :: :: ::> || @@ -64,22 +65,22 @@ ::> messaging targets and their metadata. ::+| :: -++ partner (each station passport) ::< message target -++ station (pair ship knot) ::< native target +++ partner (each circle passport) ::< message target +++ circle {hos/ship nom/knot} ::< native target ++ passport ::> foreign target $% {$twitter p/@t} ::< twitter handle == :: ::> circle configurations. ++ cabal ::> metaconfiguration $: loc/config ::< local config - ham/(map station config) ::< neighborhood configs + rem/(map circle config) ::< neighborhood configs == :: -++ config ::> station config - $: sources/(set partner) ::< pulls from - caption/cord ::< description - cordon/control ::< restrictions +++ config ::> circle config + $: src/(set partner) ::< pulls from + cap/cord ::< description + con/control ::< restrictions == :: -++ control (pair posture (set ship)) ::< access control +++ control {sec/posture ses/(set ship)} ::< access control ++ posture ::> security kind $? $black ::< channel, blacklist $white ::< village, whitelist @@ -87,13 +88,18 @@ $brown ::< mailbox, our r, bl w == :: ::> participant metadata. -++ register (pair atlas (map partner atlas)) ::< our & srcs presences +++ register {loc/atlas rem/(map partner atlas)} ::< our & srcs presences ++ atlas (map ship status) ::< presence map -++ status (pair presence human) ::< participant -++ presence ?($gone $hear $talk) ::< status type +++ status {pec/presence man/human} ::< participant +++ presence ::> status type + $? $gone ::< left + $idle ::< idle + $hear ::< present + $talk ::< typing + == ++ human ::> human identifier - $: true/(unit (trel @t (unit @t) @t)) :: || @@ -102,21 +108,21 @@ ::> structures for containing main message data. ::+| :: -++ telegram (pair ship thought) ::< who thought -++ thought (trel serial audience statement) ::< which whom what -++ statement (trel @da bouquet speech) ::< when this +++ telegram {aut/ship tot/thought} ::< who thought +++ thought {uid/serial aud/audience sam/statement} ::< which whom what +++ statement {wen/@da boq/bouquet sep/speech} ::< when this ++ speech ::> narrative action $% {$non $~} ::< no content (yo) - {$lin p/? q/@t} ::< no/@ text line - {$ire p/serial q/speech} ::< in-reply-to - {$url p/purf} ::< parsed url - {$exp p/@t} ::< hoon line - {$fat p/torso q/speech} ::< attachment - {$lan p/knot q/@t} ::< local announce - {$inv p/? q/station} ::< inv/ban for station - {$mor p/(list speech)} ::< multiplex - {$ext p/@tas q/*} ::< extended action - {$app p/@tas q/@t} ::< app message + {$lin pat/? msg/@t} ::< no/@ text line + {$ire tos/serial sep/speech} ::< in-reply-to + {$url url/purf} ::< parsed url + {$exp exp/@t} ::< hoon line + {$fat tac/torso sep/speech} ::< attachment + {$lan nom/knot msg/@t} ::< local announce + {$inv inv/? sat/circle} ::< inv/ban for circle + {$mor ses/(list speech)} ::< multiplex + {$ext nom/@tas dat/*} ::< extended action + {$app app/@tas msg/@t} ::< app message $: $api ::< api message service/@tas ::< service name id/@t ::< id on the service @@ -128,7 +134,7 @@ == :: == :: ++ torso ::> attachment - $% {$name (pair @t torso)} ::< named attachment + $% {$name nom/@t tac/torso} ::< named attachment {$text (list @t)} ::< text lines {$tank (list tank)} ::< tank list == :: @@ -141,7 +147,7 @@ :: ++ serial @uvH ::< unique identifier ++ audience (map partner (pair envelope delivery)) ::< destination + state -++ envelope (pair ? (unit partner)) ::< visible sender +++ envelope {vis/? sen/(unit partner)} ::< visible sender ++ delivery ::> delivery state $? $pending ::< undelivered $received ::< delivered From 7c385e720320511da7c36ffcfd83392718d0ba44 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 25 Apr 2017 13:33:02 +0200 Subject: [PATCH 080/303] Printfs now get sent to the default mailbox instead. --- app/talk-guardian.hoon | 93 +++++++++++++++++++++++++++++------------- 1 file changed, 64 insertions(+), 29 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 1bbe1fa63c..b8dbb72efc 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -180,6 +180,15 @@ %- ta-emit [red %diff %talk-reaction rac] :: + ++ ta-note ::< tell user + ::> sends {msg} as an %app message to the user's + ::> inbox. + :: + |= msg/cord + %^ ta-action ost.bol %phrase ::TODO ost.bol vs 0 ? + :- [[%& our.bol (main our.bol)] ~ ~] + [%app %talk-guardian msg]~ + :: ++ ta-evil ::< emit error ::> tracing printf and crash. :: @@ -203,8 +212,9 @@ ^+ +>+> =+ pur=(~(get by stories) nom) ?~ pur - ~& [%talk-ta-know-not nom] :: XX should crash - +>+>.$ + ::TODO crash instead? + %- ta-note + (crip "unknown story '{(trip nom)}'") (fun ~(. so nom ~ u.pur)) :: ++ ta-human ::< look up person @@ -464,16 +474,16 @@ :: reader subscription. ?: ?=({$reader *} pax) ?. (team our.bol her) - ~& [%talk-foreign-reader her] - +> + %- ta-note + (crip "foreign reader {(scow %p her)}") (ta-welcome ost.bol t.pax) :: weird subscription path. ?. ?=({@ *} pax) (ta-evil %bad-path) =+ pur=(~(get by stories) i.pax) ?~ pur - ~& [%talk-bad-subscribe-story i.pax] - (ta-evil %no-story) + %- ta-note + (crip "bad subscribe story '{(trip i.pax)}'") =+ soy=~(. so i.pax `(list action)`~ u.pur) :: nest-fail if no cast :: she needs read permissions to subscribe. ?. (so-visible:soy her) @@ -557,7 +567,8 @@ +>.$(readers (~(put by readers) ost.bol nes)) :: weird subscription path. ?. ?=({@ @ *} pax) - ~&([%talk-ta-cancel-weird-path pax] +>) + %- ta-note + (crip "ta-cancel weird path {~(ram re >pax<)}") :: remove a regular subscription, set ship status to %gone. %- (ta-know i.pax) |= sor/_so =< so-done (so-notify:so-cancel:sor src %gone *human) @@ -714,7 +725,8 @@ $& ::< circle partner ?: pub ?. (team our.bol aut) - ~&([%talk-strange-author aut] +>) + %- ta-note + (crip "strange author {(scow %p aut)}") =. aut our.bol ?: =(aut hos.p.pan) (ta-record nom.p.pan hos.p.pan tot) @@ -849,6 +861,16 @@ ^+ +> +>(acs [act acs]) :: + ++ so-note ::< tell user + ::> sends {msg} as an %app message to the user's + ::> inbox. + :: + |= msg/cord + ^+ +> + %+ so-act %phrase + :- [[%& our.bol (main our.bol)] ~ ~] + [%app %talk-guardian msg]~ + :: ++ so-inform ::< send lowdown ::> sends lowdown to all interested readers. :: @@ -942,8 +964,12 @@ |= {sat/circle ret/report} ^+ +> ?. (~(has in src.shape) [%& sat]) - ~& [%talk-so-diff-unexpected sat -.ret] - +> + %- so-note + %- crip ;: weld + "so-diff unexpected " + (scow %p hos.sat) "/" (trip nom.sat) + " %" (scow %tas -.ret) + == ?- -.ret $cabal (so-cabal sat +.ret) $group (so-remind [%& sat] +.ret) @@ -1097,23 +1123,32 @@ :: |= {her/ship pax/path} ^+ +> - ?. (so-visible her) :: read permissions - ~& [%talk-so-start-visible ~] - (so-sauce ost.bol [%quit ~]~) - =/ ruv/(unit river) :: find grams range - %+ biff :: collapse unit list - (zl:jo (turn pax ;~(biff slay |=(a/coin `(unit dime)`?~(-.a a ~))))) - |= paf/(list dime) - ?~ paf - $(paf [%ud (sub (max 64 count) 64)]~) - ?~ t.paf - $(t.paf [%da (dec (bex 128))]~) - ?. ?=({{?($ud $da) @} {?($ud $da) @} $~} paf) - ~ - `[[?+(- . $ud .)]:i.paf [?+(- . $ud .)]:i.t.paf] ::XX arvo issue #366 + :: read permissions + ?. (so-visible her) + =. +> + (so-sauce ost.bol [%quit ~]~) + %- so-note %- crip + "so-start permission denied {(scow %p her)}" + :: find grams range + =/ ruv/(unit river) + :: collapse unit list + %+ biff + %- zl:jo + %+ turn pax + ;~(biff slay |=(a/coin `(unit dime)`?~(-.a a ~))) + |= paf/(list dime) + ?~ paf + $(paf [%ud (sub (max 64 count) 64)]~) + ?~ t.paf + $(t.paf [%da (dec (bex 128))]~) + ?. ?=({{?($ud $da) @} {?($ud $da) @} $~} paf) + ~ + `[[?+(- . $ud .)]:i.paf [?+(- . $ud .)]:i.t.paf] ::XX arvo issue #366 ?~ ruv - ~& [%talk-so-start-malformed pax] - (so-sauce ost.bol [%quit ~]~) + =. +>.$ + (so-sauce ost.bol [%quit ~]~) + %- so-note %- crip + "so-start malformed path {~(ram re >pax<)}" (so-first-grams u.ruv) :: ++ so-first-grams ::< beginning of stream @@ -1397,8 +1432,9 @@ |= act/action ^- (quip move +>) ?. (team src.bol our.bol) - ~& [%talk-action-stranger src.bol] - [~ +>] + =< ta-done + %- ta-note:ta %- crip + "talk-action stranger {(scow %p src.bol)}" ta-done:(ta-action:ta ost.bol act) :: ++ poke-talk-comment ::< do comment @@ -1438,7 +1474,6 @@ :: |= pax/path ^- (quip move +>) - ~? !(team src.bol our.bol) [%talk-peer-stranger src.bol] ?: ?=({$sole *} pax) ~&(%talk-broker-no-sole !!) ta-done:(ta-subscribe:ta src.bol pax) :: From 6e7d9c58a8f23550d367b7f6f234346799875572 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 25 Apr 2017 15:40:25 +0200 Subject: [PATCH 081/303] Renaming of talk structure faces now also applied to its report mark. --- mar/talk/report.hoon | 53 +++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/mar/talk/report.hoon b/mar/talk/report.hoon index b293162596..f185b852b9 100644 --- a/mar/talk/report.hoon +++ b/mar/talk/report.hoon @@ -19,16 +19,19 @@ => + |^ %+ joba -.rep ?- -.rep - $cabal (cabl +.rep) - $grams (jobe num+(jone p.rep) tele+[%a (turn q.rep gram)] ~) - $group (jobe local+(grop p.rep) global+%.(q.rep (jome parn grop)) ~) + $cabal (cabl cab.rep) + $grams (jobe num+(jone num.rep) tele+[%a (turn gaz.rep gram)] ~) + $group %^ jobe + local+(grop loc.reg.rep) + global+%.(rem.reg.rep (jome parn grop)) + ~ == ++ joce |=(a/knot [%s a]) :: ++ jove |= {a/envelope b/delivery} %- jobe :~ - envelope+(jobe visible+[%b p.a] sender+?~(q.a ~ s+(parn u.q.a)) ~) + envelope+(jobe visible+[%b vis.a] sender+?~(sen.a ~ s+(parn u.sen.a)) ~) delivery+[%s b] == ++ jope |=(a/ship (jape +:)) ::[%s (crip +:(scow %p a))]) @@ -47,11 +50,11 @@ ++ nack |=(a/(set (set partner)) [%a (turn (~(tap in a)) sorc)]) ++ grop (jome phon stas) :: (map ship status) ++ phon |=(a/ship (scot %p a)) - ++ stas |=(status (jobe presence+(joce p) human+(huma q) ~)) - ++ gram |=(telegram (jobe ship+(jope p) thought+(thot q) ~)) + ++ stas |=(status (jobe presence+(joce pec) human+(huma man) ~)) + ++ gram |=(telegram (jobe ship+(jope aut) thought+(thot tot) ~)) ++ thot |= thought - (jobe serial+(jape

) audience+(audi q) statement+(stam r) ~) + (jobe serial+(jape ) audience+(audi aud) statement+(stam sam) ~) :: ++ audi (jome parn jove) ++ bouq @@ -69,23 +72,23 @@ == :: ++ stat - |= a/station ^- cord - (crip "{}/{(trip q.a)}") + |= a/circle ^- cord + (crip "{}/{(trip nom.a)}") :: ++ stam |= statement - (jobe date+(jode p) bouquet+(bouq q) speech+(spec r) ~) + (jobe date+(jode wen) bouquet+(bouq boq) speech+(spec sep) ~) :: ++ spec |= a/speech %+ joba -.a ?+ -.a ~|(stub+-.a !!) - $lin (jobe txt+[%s q.a] say+[%b p.a] ~) - $url (joba txt+[%s (crip (earf p.a))]) - $exp (joba txt+[%s p.a]) - $app (jobe txt+[%s q.a] src+[%s p.a] ~) - $fat (jobe tor+(tors p.a) taf+$(a q.a) ~) - $mor a+(turn p.a spec) + $lin (jobe txt+[%s msg.a] say+[%b pat.a] ~) + $url (joba txt+[%s (crip (earf url.a))]) + $exp (joba txt+[%s exp.a]) + $fat (jobe tor+(tors tac.a) taf+$(a sep.a) ~) + $mor a+(turn ses.a spec) + $app (jobe txt+[%s msg.a] src+[%s app.a] ~) $api %- jobe :~ service+s+service.a @@ -105,16 +108,16 @@ ?- -.a $text [%s (role +.a)] $tank [%a (turn +.a joke)] - $name (jobe nom+s+p.a mon+$(a q.a) ~) + $name (jobe nom+s+nom.a mon+$(a tac.a) ~) == :: ++ huma |= human %^ jobe - hand+?~(hand ~ [%s u.hand]) + hand+?~(han ~ [%s u.han]) :- %true - ?~ true ~ - =+ u.true + ?~ tru ~ + =+ u.tru (jobe first+[%s p] middle+?~(q ~ [%s u.q]) last+[%s r] ~) ~ :: @@ -122,7 +125,7 @@ |= cabal %- jobe :~ loc+(conf loc) - ham+((jome stat conf) ham) + ham+((jome stat conf) rem) == :: ++ sorc @@ -132,10 +135,10 @@ ++ conf |= config %- jobe :~ - sources+(sorc sources) - caption+[%s caption] - =- cordon+(jobe posture+[%s -.cordon] list+[%a -] ~) - (turn (~(tap in q.cordon)) jope) :: XX jase + sources+(sorc src) + caption+[%s cap] + =- cordon+(jobe posture+[%s -.con] list+[%a -] ~) + (turn (~(tap in ses.con)) jope) :: XX jase == -- -- -- From fb58d2f9a69eaf57ecaf73698a0eb329e9fa1291 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 25 Apr 2017 18:38:05 +0200 Subject: [PATCH 082/303] Renaming of talk structure faces now also applies to its command mark. --- mar/talk/command.hoon | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mar/talk/command.hoon b/mar/talk/command.hoon index b029ded9f6..5e503ed2de 100644 --- a/mar/talk/command.hoon +++ b/mar/talk/command.hoon @@ -78,14 +78,15 @@ %+ sear (soft passport) ;~((glue fas) sym urs:ab) :: XX [a-z0-9_]{1,15} :: - ++ speech-or-eval $?(speech {$eval p/@t} {$mor p/(list speech-or-eval)}) + ++ speech-or-eval $?(speech {$eval p/@t} {$mor ses/(list speech-or-eval)}) ++ eval |= a/(trel @da bouquet speech-or-eval) ^- statement - %= a r ^- speech - |- + %= a + r + |- ^- speech ?: ?=($mor -.r.a) - [%mor (turn p.r.a |=(b/speech-or-eval ^$(r.a b)))] + [%mor (turn ses.r.a |=(b/speech-or-eval ^$(r.a b)))] ?. ?=($eval -.r.a) r.a =- [%fat tank+- %exp p.r.a] =+ pax=[&1:% &2:% (scot %da p.a) |3:%] From 41980ae1de7957ac5760b5fc91bdb0e18f5bf9dc Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 25 Apr 2017 21:09:20 +0200 Subject: [PATCH 083/303] Some TODOs, cleanup in talk apps. --- app/talk-agent.hoon | 92 ++++++++++++------------------------------ app/talk-guardian.hoon | 55 +++++++++++-------------- sur/talk.hoon | 6 +-- 3 files changed, 52 insertions(+), 101 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 0103a33518..5c14616374 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -3,9 +3,12 @@ :: :: :: :: ::TODO guardian's todo's apply here too -::TODO make sure glyphs get unbound when joins etc don't succeed. +::TODO make sure glyphs only get bound when joins succeed +:: ...this is a bit troublesome, because failed joins don't actually +:: unsubscribe us. ::TODO correct/clean up presence/config change notifications :: +::TODO sat/circle -> cir/circle ::TODO maybe keep track of received grams per partner, too? :: ::> This reader implementation makes use of the mailbox @@ -289,8 +292,8 @@ =. +>.$ =< sh-done %+ roll (~(tap by cofs)) - |= {{s/circle c/(unit config)} core/_sh} - %^ ~(sh-low-config core cli) + |= {{s/circle c/(unit config)} cil/_sh} + %^ ~(sh-low-config cil cli) s (~(get by mirrors) s) c :: apply config changes to {mirrors}. =. mirrors @@ -923,8 +926,6 @@ ++ join ::< %join ::> change local mailbox config to include ::> subscriptions to {pas}. - ::TODO only bind glyph *after* we've - :: successfully joined. :: |= pas/(set partner) ^+ ..sh-work @@ -950,9 +951,6 @@ :: |= {por/posture nom/knot txt/cord} ^+ ..sh-work - ::TODO simplify? - ?: (~(has in mirrors) [our.bol nom]) - (sh-lame "{(trip nom)}: already exists") =. ..sh-work (sh-act %create nom txt por) (join [[%& our.bol nom] ~ ~]) @@ -1031,7 +1029,6 @@ ::> prints presence lists for {pas} or all. :: |= pas/(set partner) ^+ ..sh-work - ::TODO clever use of =< and . take note! =< (sh-fact %mor (murn (sort (~(tap by remotes) ~) aor) .)) |= {pon/partner alt/atlas} ^- (unit sole-effect) ?. |(=(~ pas) (~(has in pas) pon)) ~ @@ -1050,7 +1047,6 @@ :: ++ what ::< %what ::> prints binding details. goes both ways. - ::TODO pretty-print :: |= qur/$@(char (set partner)) ^+ ..sh-work @@ -1060,7 +1056,7 @@ =+ pan=(~(tap in (~(get ju nak) qur))) ?: =(~ pan) (sh-fact %txt "~") =< (sh-fact %mor (turn pan .)) - |=(a/(set partner) [%txt ]) :: XX ~(ar-whom ar a) + |=(a/(set partner) [%txt ~(ar-prom ar a)]) :: ++ number ::< %number ::> finds selected message, expand it. @@ -1215,25 +1211,8 @@ $(paz r.paz) == :: - ++ sh-pest ::< report listen - ::> updates audience to be {tay}, only if {tay} is - ::> not a village/%white. - ::TODO why exclude village (invite-only?) audiences from this? - ::TODO only used in config change printing, maybe delete. - :: - |= tay/partner - ^+ +> - ::> if partner is a passport, ignore. - ?. ?=($& -.tay) +> - =+ cof=(~(get by mirrors) +.tay) - ?. |(?=($~ cof) !?=($white sec.con.u.cof)) - +>.$ - (sh-pact [tay ~ ~]) - :: ++ sh-glyf ::< decode glyph ::> finds the partner(s) that match a glyph. - ::TODO should maybe return full set, not latest, - :: if ambiguous. :: |= cha/char ^- (unit (set partner)) =+ lax=(~(get ju nak) cha) @@ -1533,42 +1512,24 @@ :: |= {sat/circle old/(unit config) new/(unit config)} ^+ +> - ?~ old ~&([%new-conf sat] +>) - ?~ new ~&([%del-conf sat] +>) ::TODO tmp + :: new circle + ?~ old + :: ++sh-low-rempe will notice a new partner. + +> + :: removed circle + ?~ new + (sh-note (weld "rip " ~(cr-phat cr sat))) %^ sh-show-config (weld ~(cr-phat cr sat) ": ") u.old u.new :: - ++ sh-low-remco ::TODO delete me - ::> prints changes to remote configs to the cli - :: - |= {ole/(map circle config) neu/(map circle config)} - ^+ +> - =+ (sh-remco-diff ole neu) - =. +>.$ - |- ^+ +>.^$ - ?~ new +>.^$ - =. +>.^$ $(new t.new) - =. +>.^$ (sh-pest [%& p.i.new]) - %+ sh-show-config - (weld ~(cr-phat cr p.i.new) ": ") - [*config q.i.new] - =. +>.$ - |- ^+ +>.^$ - ?~ cha +>.^$ - =. +>.^$ $(cha t.cha) - %+ sh-show-config - (weld ~(cr-phat cr p.i.cha) ": ") - [(~(got by ole) `circle`p.i.cha) q.i.cha] - +>.$ - :: ++ sh-low-rempe ::< show remotes ::> prints remote presence changes to the cli. :: |= {old/(map partner atlas) new/(map partner atlas)} - =+ day=(sh-rempe-diff old new) ?: (~(has in settings.she) %quiet) +>.$ + =+ day=(sh-rempe-diff old new) =. +>.$ |- ^+ +>.^$ ?~ old.day +>.^$ @@ -1641,28 +1602,25 @@ ++ cr-best ::< best to show ::> returns true if one is better to show, false ::> otherwise. prioritizes: our > main > size. - ::TODO maybe simplify. (lth (xeb (xeb hos.one)) (xeb (xeb hos.two))) :: |= two/circle ^- ? :: the circle that's ours is better. ?: =(our.bol hos.one) - ?: =(our.bol hos.two) - ?< =(nom.one nom.two) - :: if both circles are ours, the main story is better. - ?: =((main hos.one) nom.one) %& - ?: =((main hos.two) nom.two) %| - :: if neither are, pick the "larger" one. - (lth nom.one nom.two) - %& + ?. =(our.bol hos.two) %& + ?< =(nom.one nom.two) + :: if both circles are ours, the main story is better. + ?: =((main hos.one) nom.one) %& + ?: =((main hos.two) 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. - ?: =(our.bol hos.two) - %| + ?: =(our.bol hos.two) %| ?: =(hos.one hos.two) :: if they're from the same ship, pick the "larger" one. (lth nom.one nom.two) - :: when in doubt, pick one if its ship is "smaller" than its channel. - (lth hos.one nom.one) + :: if they're from different ships, neither ours, pick hierarchically. + (lth (xeb hos.one) (xeb hos.two)) :: ++ cr-curt ::< render name in 14 ::> prints a ship name in 14 characters. left-pads diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index b8dbb72efc..7e2218fe4d 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -5,10 +5,7 @@ ::TODO master changes ::TODO char57 comments as line comments when regarding code. ::TODO avoid lark where possible -::TODO maybe rename wires. repeat & friend -> message & follower -::TODO put printfs properly through console/mailbox -::TODO think about what printfs we want to keep for the user to see. -::TODO document what user-facing printfs actually mean! +::TODO document what user-facing messages actually mean! ::TODO ::> to :> etc. :: ::TODO we can't do away with the default mailbox because we need it for things @@ -21,8 +18,7 @@ :: server state." :: but we *do* change state on-subscribe! is that a problem? :: -::TODO permission checks should only use team if it's coming from a reader. -::TODO for story permission checks, count moons as their parent identity. +::TODO sat/circle -> cir/circle ::TODO crash on pokes/peers we do not expect ::TODO keep both a folks and nicks maps. (actual profiles and local nicknames.) :: @@ -140,7 +136,6 @@ ::> they are produced in reverse order because ::> ++ta-emil and ++ta-emit add them to the head of ::> the {moves}. - ::TODO maybe squash lowdown %names and %glyphs into single moves. :: ^- (quip move +>) [(flop moves) +>] @@ -185,7 +180,7 @@ ::> inbox. :: |= msg/cord - %^ ta-action ost.bol %phrase ::TODO ost.bol vs 0 ? + %^ ta-action 0 %phrase :- [[%& our.bol (main our.bol)] ~ ~] [%app %talk-guardian msg]~ :: @@ -435,9 +430,6 @@ =/ ole/(set (set partner)) ::< unbind ?. =(pas ~) [pas ~ ~] (~(get ju nak) lif) - ::TODO want to replace these kinds of loops with - :: ++rep:in and ++roll, but doesn't seem to - :: work correctly? |- ^+ ..ta-action ?~ ole ..ta-action =. ..ta-action $(ole l.ole) @@ -482,6 +474,7 @@ (ta-evil %bad-path) =+ pur=(~(get by stories) i.pax) ?~ pur + ::TODO send this to the subscriber! make them unsub! %- ta-note (crip "bad subscribe story '{(trip i.pax)}'") =+ soy=~(. so i.pax `(list action)`~ u.pur) :: nest-fail if no cast @@ -493,7 +486,7 @@ :: send current data to bring her up to date. =. soy (so-report-cabal:soy ost.bol ~ ~) =. soy (so-report-group:soy ost.bol ~ ~) - =. soy (so-start:soy her t.pax) ::< also adds story sub + =. soy (so-start:soy her t.pax) ::< also adds story sub =. soy (so-notify:soy her %hear who) ::< add her status so-done:soy ::< apply story changes :: @@ -1216,25 +1209,25 @@ ::> notify the interested readers. =. +> (so-inform %grams num gam ~) ::> notify only the followers who are currently interested. - ::TODO might be able to refactor using ~(rep in followers)? =/ moy - |- ^- (pair (list bone) (list move)) - ?~ followers [~ ~] - =+ lef=$(followers l.followers) - =+ rit=$(followers r.followers) - =+ old=[p=(welp p.lef p.rit) q=(welp q.lef q.rit)] - ?: ?- -.q.q.n.followers :: after the end - $ud (lte p.q.q.n.followers num) - $da (lte p.q.q.n.followers wen.sam.tot.gam) - == - [[p.n.followers p.old] [[p.n.followers %quit ~] q.old]] - ?: ?- -.p.q.n.followers :: before the start - $ud (gth p.p.q.n.followers num) - $da (gth p.p.q.n.followers wen.sam.tot.gam) - == - old - :- p.old - [[p.n.followers %diff %talk-report %grams num gam ~] q.old] + ^- (pair (list bone) (list move)) + %- ~(rep in followers) + |= {f/(pair bone river) r/(pair (list bone) (list move))} + :: after the end: unsubscribe + ?: ?- -.q.q.f + $ud (lte p.q.q.f num) + $da (lte p.q.q.f wen.sam.tot.gam) + == + [[p.f p.r] [[p.f %quit ~] q.r]] + :: before the start: ignore + ?: ?- -.p.q.f + $ud (gth p.p.q.f num) + $da (gth p.p.q.f wen.sam.tot.gam) + == + r + :: in the river: send gram + :- p.r + [[p.f %diff %talk-report %grams num gam ~] q.r] =. moves (welp q.moy moves) |- ^+ +>.^$ ?~ p.moy +>.^$ @@ -1263,7 +1256,7 @@ ::> federated circles need to pretend ~src/nom ::> is also ~our/nom. ::TODO pass src through explicitly instead of - :: relying on src.bol. : + :: relying on src.bol. =+ ole=(~(get by aud.tot.gam) [%& src.bol nom]) ?~ ole aud.tot.gam ::> as described above, fake src into our. diff --git a/sur/talk.hoon b/sur/talk.hoon index cc498b2945..ce469fc2da 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -70,7 +70,7 @@ ++ passport ::> foreign target $% {$twitter p/@t} ::< twitter handle == :: -::> circle configurations. +:: circle configurations. :: ++ cabal ::> metaconfiguration $: loc/config ::< local config rem/(map circle config) ::< neighborhood configs @@ -87,7 +87,7 @@ $green ::< journal, author list $brown ::< mailbox, our r, bl w == :: -::> participant metadata. +:: participant metadata. :: ++ register {loc/atlas rem/(map partner atlas)} ::< our & srcs presences ++ atlas (map ship status) ::< presence map ++ status {pec/presence man/human} ::< participant @@ -96,7 +96,7 @@ $idle ::< idle $hear ::< present $talk ::< typing - == + == :: ++ human ::> human identifier $: tru/(unit (trel @t (unit @t) @t)) :: Date: Tue, 25 Apr 2017 21:18:14 +0200 Subject: [PATCH 084/303] Patched remnant of station to circle renaming, sat to cir. --- app/talk-agent.hoon | 13 ++++----- app/talk-guardian.hoon | 63 +++++++++++++++++++++--------------------- sur/talk.hoon | 2 +- 3 files changed, 37 insertions(+), 41 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 5c14616374..ca6bcec69b 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -6,9 +6,6 @@ ::TODO make sure glyphs only get bound when joins succeed :: ...this is a bit troublesome, because failed joins don't actually :: unsubscribe us. -::TODO correct/clean up presence/config change notifications -:: -::TODO sat/circle -> cir/circle ::TODO maybe keep track of received grams per partner, too? :: ::> This reader implementation makes use of the mailbox @@ -1510,7 +1507,7 @@ ++ sh-low-config ::< do show config ::> prints a circle's config changes to the cli. :: - |= {sat/circle old/(unit config) new/(unit config)} + |= {cir/circle old/(unit config) new/(unit config)} ^+ +> :: new circle ?~ old @@ -1518,9 +1515,9 @@ +> :: removed circle ?~ new - (sh-note (weld "rip " ~(cr-phat cr sat))) + (sh-note (weld "rip " ~(cr-phat cr cir))) %^ sh-show-config - (weld ~(cr-phat cr sat) ": ") + (weld ~(cr-phat cr cir) ": ") u.old u.new :: ++ sh-low-rempe ::< show remotes @@ -1937,7 +1934,7 @@ ?: inv.sep "you have been invited to " "you have been banished from " - ~(cr-phat cr sat.sep) + ~(cr-phat cr cir.sep) :: $mor mor+(turn ses.sep |=(speech ^$(sep +<))) @@ -2053,7 +2050,7 @@ ?: inv.sep " invited you to " " banished you from " - ~(cr-phat cr sat.sep) + ~(cr-phat cr cir.sep) :: $app (tr-chow 64 "[{(trip app.sep)}]: {(trip msg.sep)}") diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 7e2218fe4d..121a29aa79 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -18,7 +18,6 @@ :: server state." :: but we *do* change state on-subscribe! is that a problem? :: -::TODO sat/circle -> cir/circle ::TODO crash on pokes/peers we do not expect ::TODO keep both a folks and nicks maps. (actual profiles and local nicknames.) :: @@ -37,7 +36,7 @@ :: |% ++ house ::> broker state - $: stories/(map knot story) ::< conversations + $: stories/(map knot story) ::< convercirions readers/(map bone (set knot)) ::< our message readers outbox/(pair @ud (map @ud thought)) ::< urbit outbox log/(map knot @ud) ::< logged to clay @@ -442,11 +441,11 @@ -- :: ++ ta-diff-report ::< subscription update - ::> process a talk report from {sat} into story {nom}. + ::> process a talk report from {cir} into story {nom}. :: - |= {nom/knot sat/circle ret/report} + |= {nom/knot cir/circle ret/report} %- (ta-know nom) |= sor/_so =< so-done - (so-diff-report:sor sat ret) + (so-diff-report:sor cir ret) :: ::> || ::> || %subscription-events @@ -530,18 +529,18 @@ == :: ++ ta-retry ::< subscription resend - ::> re-subscribes {sat} to story {nom}. + ::> re-subscribes {cir} to story {nom}. :: - |= {nom/knot sat/circle} + |= {nom/knot cir/circle} %- (ta-know nom) |= sor/_so =< so-done - (so-acquire:sor [%& sat]~) + (so-acquire:sor [%& cir]~) :: ++ ta-quit ::< subscription failed - ::> removes {sat} from story {nom}'s followers. + ::> removes {cir} from story {nom}'s followers. :: - |= {nom/knot sat/circle} + |= {nom/knot cir/circle} %- (ta-know nom) |= sor/_so =< so-done - (so-quit:sor %& sat) + (so-quit:sor %& cir) :: ++ ta-cancel ::< unsubscribe ::> drops {src}'s subscription. deduce the right way @@ -738,16 +737,16 @@ (so-learn:sor gam) :: ++ ta-transmit ::< send message - ::> sends thought {tot} to {sat}. + ::> sends thought {tot} to {cir}. ::> stores it to the outbox to await confirmation. :: - |= {sat/circle tot/thought} + |= {cir/circle tot/thought} ^+ +> =. +> %+ ta-emit ost.bol :* %poke - /repeat/(scot %ud p.outbox)/(scot %p hos.sat)/[nom.sat] - [hos.sat %talk-guardian] + /repeat/(scot %ud p.outbox)/(scot %p hos.cir)/[nom.cir] + [hos.cir %talk-guardian] [%talk-command [%review tot ~]] == +>(p.outbox +(p.outbox), q.outbox (~(put by q.outbox) p.outbox tot)) @@ -951,21 +950,21 @@ ::+| :: ++ so-diff-report ::< process update - ::> process a talk report from {sat}. + ::> process a talk report from {cir}. ::> if we didn't expect it, ignore. :: - |= {sat/circle ret/report} + |= {cir/circle ret/report} ^+ +> - ?. (~(has in src.shape) [%& sat]) + ?. (~(has in src.shape) [%& cir]) %- so-note %- crip ;: weld "so-diff unexpected " - (scow %p hos.sat) "/" (trip nom.sat) + (scow %p hos.cir) "/" (trip nom.cir) " %" (scow %tas -.ret) == ?- -.ret - $cabal (so-cabal sat +.ret) - $group (so-remind [%& sat] +.ret) + $cabal (so-cabal cir +.ret) + $group (so-remind [%& cir] +.ret) $grams (so-lesson gaz.ret) == :: @@ -973,12 +972,12 @@ ::> add circle's config to our remote config map. :: ::TODO when do we care about rem? - |= {sat/circle con/config rem/(map circle config)} + |= {cir/circle con/config rem/(map circle config)} ^+ +> =+ old=mirrors - =. mirrors (~(put by mirrors) sat con) + =. mirrors (~(put by mirrors) cir con) ?: =(mirrors old) +>.$ - =. +>.$ (so-inform %confs `shape (strap sat `con)) + =. +>.$ (so-inform %confs `shape (strap cir `con)) (so-report-cabal so-followers) :: ++ so-remind ::< remote presence @@ -1386,7 +1385,7 @@ :: |= $: wir/wire $= fun - $- {nom/knot sat/circle} + $- {nom/knot cir/circle} {(list move) _.} == =+ wer=(etch wir) @@ -1456,8 +1455,8 @@ ^- (quip move +>) =^ mos +>.$ %+ etch-friend wir - |= {nom/knot sat/circle} - ta-done:(ta-diff-report:ta nom sat ret) + |= {nom/knot cir/circle} + ta-done:(ta-diff-report:ta nom cir ret) =^ mow +>.$ log-all-to-file [(welp mos mow) +>.$] @@ -1486,10 +1485,10 @@ ^- (quip move +>) ?~ fal [~ +>] %+ etch-friend [%friend wir] - |= {nom/knot sat/circle} - =. u.fal [>%reap-friend-fail nom sat< u.fal] + |= {nom/knot cir/circle} + =. u.fal [>%reap-friend-fail nom cir< u.fal] %- (slog (flop u.fal)) - ta-done:(ta-quit:ta nom sat) + ta-done:(ta-quit:ta nom cir) :: ++ quit-friend ::< dropped subscription ::> gall dropped our subscription. resubscribe. @@ -1497,8 +1496,8 @@ |= wir/wire ^- (quip move +>) %+ etch-friend [%friend wir] - |= {nom/knot sat/circle} - ta-done:(ta-retry:ta nom sat) + |= {nom/knot cir/circle} + ta-done:(ta-retry:ta nom cir) :: ++ coup-repeat ::< message n/ack ::> ack from ++ta-transmit. mark the message as diff --git a/sur/talk.hoon b/sur/talk.hoon index ce469fc2da..a46fbb1e51 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -119,7 +119,7 @@ {$exp exp/@t} ::< hoon line {$fat tac/torso sep/speech} ::< attachment {$lan nom/knot msg/@t} ::< local announce - {$inv inv/? sat/circle} ::< inv/ban for circle + {$inv inv/? cir/circle} ::< inv/ban for circle {$mor ses/(list speech)} ::< multiplex {$ext nom/@tas dat/*} ::< extended action {$app app/@tas msg/@t} ::< app message From 5e02dc7db25e1ef47e3a9a1c197ee523dec5a337 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 25 Apr 2017 21:21:46 +0200 Subject: [PATCH 085/303] Removed trailing spaces from talk lib and marks files. --- lib/talk.hoon | 6 +++--- mar/talk/command.hoon | 33 ++++++++++++++++----------------- mar/talk/comment.hoon | 2 +- mar/talk/fora-post.hoon | 2 +- mar/talk/speeches.hoon | 4 ++-- mar/talk/telegrams.hoon | 36 ++++++++++++++++++------------------ 6 files changed, 41 insertions(+), 42 deletions(-) diff --git a/lib/talk.hoon b/lib/talk.hoon index 3184bd6c13..86c0e36b78 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -1,9 +1,9 @@ :: :::: /hoon/talk/lib - :: + :: :: This file is in the public domain. :: -/? 310 +/? 310 /- talk !: :::: @@ -16,7 +16,7 @@ ?+ can %porch $czar %court $king %floor - == + == :: ++ said-url :: app url |= url/purl diff --git a/mar/talk/command.hoon b/mar/talk/command.hoon index 5e503ed2de..b5ec7e8803 100644 --- a/mar/talk/command.hoon +++ b/mar/talk/command.hoon @@ -10,7 +10,7 @@ ++ grab :: convert from |% ++ noun command :: clam from %noun - ++ json + ++ json => [jo ..command] |= a/json ^- command =- (need ((of -) a)) @@ -18,15 +18,15 @@ == |% ++ op :: parse keys of map - |* {fel/rule wit/fist} - %+ cu malt + |* {fel/rule wit/fist} + %+ cu malt %+ ci |= a/(map cord _(need *wit)) ^- (unit (list _[(wonk *fel) (need *wit)])) (zl (turn (~(tap by a)) (head-rush fel))) (om wit) :: - ++ ke :: callbacks + ++ ke :: callbacks |* {gar/* sef/_|.(fist)} |= jon/json ^- (unit _gar) @@ -34,12 +34,12 @@ ((sef) jon) :: ++ as :: array as set - |* a/fist + |* a/fist (cu ~(gas in *(set _(need *a))) (ar a)) :: ++ peach |* a/{rule rule} - |= tub/nail + |= tub/nail ^- (like (each _(wonk (-.a)) _(wonk (+.a)))) %. tub ;~(pose (stag %& -.a) (stag %| +.a)) @@ -47,16 +47,16 @@ ++ head-rush |* a/rule |* {cord *} - =+ nit=(rush +<- a) + =+ nit=(rush +<- a) ?~ nit ~ - (some [u.nit +>->]) + (some [u.nit +>->]) :: :: ++ thot ^- $-(json (unit thought)) %- ot :~ - serial+ceri - audience+audi + serial+ceri + audience+audi statement+stam == :: @@ -64,12 +64,12 @@ ^- $-(json (unit serial)) (ci (slat %uv) so) :: - ++ audi + ++ audi ^- $-(json (unit audience)) - (op parn memb) + (op parn memb) :: ++ memb (ot [envelope+lope delivery+(ci (soft delivery) so) ~]) - ++ lope (ot [visible+bo sender+(mu (su parn)) ~]) + ++ lope (ot [visible+bo sender+(mu (su parn)) ~]) :: ++ parn ^- $-(nail (like partner)) @@ -80,7 +80,7 @@ :: ++ speech-or-eval $?(speech {$eval p/@t} {$mor ses/(list speech-or-eval)}) ++ eval - |= a/(trel @da bouquet speech-or-eval) + |= a/(trel @da bouquet speech-or-eval) ^- statement %= a r @@ -94,14 +94,14 @@ == :: ++ stam - ^- $-(json (unit statement)) + ^- $-(json (unit statement)) %+ cu eval (ot date+di bouquet+(as (ar so)) speech+spec ~) :: ++ spec %+ ke *speech-or-eval |. %- of - :~ lin+(ot say+bo txt+so ~) + :~ lin+(ot say+bo txt+so ~) url+(su aurf:urlp) eval+so mor+(ar spec) @@ -110,4 +110,3 @@ == -- -- -- - diff --git a/mar/talk/comment.hoon b/mar/talk/comment.hoon index ec965ec003..fef8b05959 100644 --- a/mar/talk/comment.hoon +++ b/mar/talk/comment.hoon @@ -7,7 +7,7 @@ ++ grab |% ++ noun {path spur @t} - ++ json + ++ json (corl need =>(jo (ot pax+(su fel:stab) sup+(su fel:stab) txt+so ~))) -- -- diff --git a/mar/talk/fora-post.hoon b/mar/talk/fora-post.hoon index 9de392ed20..58ca60870b 100644 --- a/mar/talk/fora-post.hoon +++ b/mar/talk/fora-post.hoon @@ -7,7 +7,7 @@ ++ grab |% ++ noun {path spur @t @t} - ++ json + ++ json (corl need =>(jo (ot pax+(su fel:stab) sup+(su fel:stab) hed+so txt+so ~))) -- -- diff --git a/mar/talk/speeches.hoon b/mar/talk/speeches.hoon index 7ed93dc8ae..db8566175b 100644 --- a/mar/talk/speeches.hoon +++ b/mar/talk/speeches.hoon @@ -8,8 +8,8 @@ =+ talk |_ gam/(list speech) :: -++ grab - |% +++ grab + |% ++ noun (list speech) -- :: diff --git a/mar/talk/telegrams.hoon b/mar/talk/telegrams.hoon index 249c60f635..bfc077f9d0 100644 --- a/mar/talk/telegrams.hoon +++ b/mar/talk/telegrams.hoon @@ -8,8 +8,8 @@ =+ talk |_ gam/(list telegram) :: -++ grab - |% +++ grab + |% ++ noun (list telegram) ++ mime |=(^mime (json (rash q.q apex:poja))) ++ json @@ -23,18 +23,18 @@ %. ((of:jo a) b) %- slog ?+ b ~ - {$o *} + {$o *} %+ murn `(list {@tas fist})`a |= {c/term d/fist} ^- (unit tank) =+ (~(get by p.b) c) ?~ - ~ =+ (d u) ?~ - (some >[c u]<) - ~ + ~ == ++ op :: parse keys of map |* {fel/rule wit/fist} - %+ cu malt + %+ cu malt %+ ci |= a/(map cord _(need *wit)) ^- (unit (list _[(wonk *fel) (need *wit)])) @@ -42,7 +42,7 @@ (om wit) :: ++ as :: array as set - |* a/fist + |* a/fist (cu ~(gas in *(set _(need *a))) (ar a)) :: ++ ke :: callbacks @@ -53,29 +53,29 @@ ((sef) jon) :: ++ lake |*(a/_* $-(json (unit a))) - ++ head-rush + ++ head-rush |* a/rule |* {cord *} - =+ nit=(rush +<- a) + =+ nit=(rush +<- a) ?~ nit ~ (some [u.nit +>->]) :: ++ thot ^- $-(json (unit thought)) %- ot :~ - serial+`$-(json (unit serial))`(ci (slat %uv) so) - audience+`$-(json (unit audience))`audi - statement+`$-(json (unit statement))`stam + serial+`$-(json (unit serial))`(ci (slat %uv) so) + audience+`$-(json (unit audience))`audi + statement+`$-(json (unit statement))`stam == :: - ++ audi `$-(json (unit audience))`(op parn memb) - ++ auri (op parn (ci (soft presence) so)) + ++ audi `$-(json (unit audience))`(op parn memb) + ++ auri (op parn (ci (soft presence) so)) ++ memb ^- $-(json (unit (pair envelope delivery))) (ot envelope+lope delivery+(ci (soft delivery) so) ~) ++ lope (ot visible+bo sender+(mu (su parn)) ~) :: ++ parn - ^- $-(nail (like partner)) + ^- $-(nail (like partner)) %+ pick ;~((glue fas) ;~(pfix sig fed:ag) urs:ab) %+ sear (soft passport) @@ -85,7 +85,7 @@ ++ spec %+ ke *speech |. ~+ %- of :~ - lin+(ot say+bo txt+so ~) + lin+(ot say+bo txt+so ~) url+(ot txt+(su aurf:urlp) ~) exp+(ot txt+so ~) app+(ot txt+so src+so ~) @@ -95,10 +95,10 @@ mor+(ar spec) :: inv+(ot ship+(su fed:ag) party+(su urs:ab) ~) == - ++ tors + ++ tors %+ ke *torso |. ~+ %- of :~ - name+(ot nom+so mon+tors ~) + name+(ot nom+so mon+tors ~) text+(cu lore so) tank+(ot dat+(cu (hard (list tank)) blob) ~) == @@ -136,7 +136,7 @@ ++ audi (map-to-json parn jove) ++ bouq |= a/bouquet - a+(turn (~(tap in a)) |=(b/path a+(turn b |=(c/knot s+c)))) + a+(turn (~(tap in a)) |=(b/path a+(turn b |=(c/knot s+c)))) :: ++ parn |= a/partner ^- cord From 04997b5c10b7728d1c388c320cd90a2221d130a0 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 25 Apr 2017 21:32:13 +0200 Subject: [PATCH 086/303] Applied renaming of talk structure faces to report and telegrams marks. --- mar/talk/report.hoon | 6 +++--- mar/talk/telegrams.hoon | 34 +++++++++++++++++----------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/mar/talk/report.hoon b/mar/talk/report.hoon index f185b852b9..b1377ec798 100644 --- a/mar/talk/report.hoon +++ b/mar/talk/report.hoon @@ -64,14 +64,14 @@ ++ parn |= a/partner ^- cord ?- -.a - $& (stat p.a) + $& (circ p.a) $| %- crip ?- -.p.a $twitter "{(trip -.p.a)}/{(trip p.p.a)}" == == :: - ++ stat + ++ circ |= a/circle ^- cord (crip "{}/{(trip nom.a)}") :: @@ -125,7 +125,7 @@ |= cabal %- jobe :~ loc+(conf loc) - ham+((jome stat conf) rem) + ham+((jome circ conf) rem) == :: ++ sorc diff --git a/mar/talk/telegrams.hoon b/mar/talk/telegrams.hoon index bfc077f9d0..8aafaa8ee8 100644 --- a/mar/talk/telegrams.hoon +++ b/mar/talk/telegrams.hoon @@ -116,12 +116,12 @@ :- %a %+ turn gam |= telegram - (jobe ship+(jope p) thought+(thot q) ~) + (jobe ship+(jope aut) thought+(thot tot) ~) :: ++ jove |= {a/envelope b/delivery} %- jobe :~ - envelope+(jobe visible+[%b p.a] sender+?~(q.a ~ s+(parn u.q.a)) ~) + envelope+(jobe visible+[%b vis.a] sender+?~(sen.a ~ s+(parn u.sen.a)) ~) delivery+[%s b] == :: @@ -131,7 +131,7 @@ :: ++ thot |= thought - (jobe serial+(jape

) audience+(audi q) statement+(stam r) ~) + (jobe serial+(jape ) audience+(audi aud) statement+(stam sam) ~) :: ++ audi (map-to-json parn jove) ++ bouq @@ -141,36 +141,36 @@ ++ parn |= a/partner ^- cord ?- -.a - $& (stat p.a) + $& (circ p.a) $| %- crip ?- -.p.a $twitter "{(trip -.p.a)}/{(trip p.p.a)}" == == :: - ++ stat - |= a/station ^- cord - (crip "{}/{(trip q.a)}") + ++ circ + |= a/circle ^- cord + (crip "{}/{(trip nom.a)}") :: ++ stam |= statement - (jobe date+(jode p) bouquet+(bouq q) speech+(spec r) ~) + (jobe date+(jode wen) bouquet+(bouq boq) speech+(spec sep) ~) :: ++ spec |= a/speech %+ joba -.a ?+ -.a ~|(stub+-.a !!) - $lin (jobe txt+[%s q.a] say+[%b p.a] ~) - $url (joba txt+(jape (earf p.a))) - $exp (joba txt+[%s p.a]) - $app (jobe txt+[%s q.a] src+[%s p.a] ~) - $fat (jobe tor+(tors p.a) taf+$(a q.a) ~) - $ext (jobe nom+[%s p.a] txe+(jape (sifo (jam +.a))) ~) $non ~ + $lin (jobe txt+[%s msg.a] say+[%b pat.a] ~) + $url (joba txt+(jape (earf url.a))) + $exp (joba txt+[%s exp.a]) + $fat (jobe tor+(tors tac.a) taf+$(a sep.a) ~) $mor :- %a |- ^- (list json) - ?~ p.a ~ - [^$(a i.p.a) $(p.a t.p.a)] + ?~ ses.a ~ + [^$(a i.ses.a) $(ses.a t.ses.a)] + $ext (jobe nom+[%s nom.a] txe+(jape (sifo (jam +.a))) ~) + $app (jobe txt+[%s msg.a] src+[%s app.a] ~) :: $inv (jobe ship+(jope p.a) party+[%s q.a] ~) == :: @@ -180,7 +180,7 @@ ?- -.a $text [%s (role +.a)] $tank (jobe txt+[%a (turn +.a joke)] dat+(jape (sifo (jam +.a))) ~) - $name (jobe nom+s+p.a mon+$(a q.a) ~) + $name (jobe nom+s+nom.a mon+$(a tac.a) ~) == :: -- From f3533eae4f966b401d8a93d3fb972f4f73bc1ec3 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 26 Apr 2017 23:33:25 +0200 Subject: [PATCH 087/303] More renaming of talk structures. --- app/talk-agent.hoon | 65 +++++++++++++++++++++--------------------- app/talk-guardian.hoon | 50 ++++++++++++++++---------------- mar/talk/report.hoon | 10 +++---- sur/talk.hoon | 27 ++++++++---------- 4 files changed, 75 insertions(+), 77 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index ca6bcec69b..1fe9f4dabc 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -35,7 +35,7 @@ known/(map serial @ud) ::< messages heard sources/(set partner) ::< our subscriptions :: partner details :: - remotes/(map partner atlas) ::< remote presences + remotes/(map partner group) ::< remote presences mirrors/(map circle config) ::< remote configs :: ui state :: folks/(map ship human) ::< human identities @@ -68,7 +68,7 @@ $% :: circle management :: {$join p/where} ::< subscribe to {$leave p/where} ::< unsubscribe from - {$create p/posture q/knot r/cord} ::< create circle + {$create p/security q/knot r/cord} ::< create circle {$delete p/knot q/(unit cord)} ::< delete circle {$depict p/knot q/cord} ::< change description {$source p/knot q/(set partner)} ::< add source @@ -303,17 +303,17 @@ :: ++ ta-low-precs ::< apply changed precs ::> applies new presences. - ::> other clients might care for {tas}, but we're + ::> other clients might care for {gop}, but we're ::> only ever getting this for the mailbox, where ::> we're the only ones present. :: - |= {tas/atlas pas/(map partner atlas)} + |= {gop/group pas/(map partner group)} ^+ +> =/ ner/_remotes :: per-partner uni %- ~(urn by pas) - |= {p/partner a/atlas} + |= {p/partner g/group} =+ o=(~(get by remotes) p) - ?~(o a (~(uni by u.o) a)) + ?~(o g (~(uni by u.o) g)) =. ner (~(uni by remotes) ner) :: fill in the gaps ?: =(remotes ner) +>.$ :: no change =. +>.$ @@ -566,7 +566,7 @@ (stag 0 dem:ag) == :: - ++ pore ::< posture + ++ pore ::< security ;~ pose (cold %black (jest %channel)) (cold %white (jest %village)) @@ -946,10 +946,10 @@ ++ create ::< %create ::> creates circle {nom} with specified config. :: - |= {por/posture nom/knot txt/cord} + |= {sec/security nom/knot txt/cord} ^+ ..sh-work =. ..sh-work - (sh-act %create nom txt por) + (sh-act %create nom txt sec) (join [[%& our.bol nom] ~ ~]) :: ++ delete ::< %delete @@ -1027,10 +1027,10 @@ :: |= pas/(set partner) ^+ ..sh-work =< (sh-fact %mor (murn (sort (~(tap by remotes) ~) aor) .)) - |= {pon/partner alt/atlas} ^- (unit sole-effect) + |= {pon/partner gop/group} ^- (unit sole-effect) ?. |(=(~ pas) (~(has in pas) pon)) ~ =- `[%tan rose+[", " `~]^- leaf+~(pr-full pr pon) ~] - =< (murn (sort (~(tap by alt)) aor) .) + =< (murn (sort (~(tap by gop)) aor) .) |= {a/ship b/presence c/human} ^- (unit tank) =. c ?. =(han.c `(scot %p a)) c @@ -1231,12 +1231,12 @@ ::> arms that calculate differences between datasets. ::+| :: - ++ sh-atlas-diff ::< atlas diff parts + ++ sh-group-diff ::< group diff parts ::> calculates the difference between two presence ::> lists, producing lists of removed, added and ::> changed presences. :: - |= {one/atlas two/atlas} + |= {one/group two/group} =| $= ret $: old/(list (pair ship status)) new/(list (pair ship status)) @@ -1274,11 +1274,11 @@ ::> presence maps, producing a list of removed, ::> added and changed presences maps. :: - |= {one/(map partner atlas) two/(map partner atlas)} + |= {one/(map partner group) two/(map partner group)} =| $= ret - $: old/(list (pair partner atlas)) - new/(list (pair partner atlas)) - cha/(list (pair partner atlas)) + $: old/(list (pair partner group)) + new/(list (pair partner group)) + cha/(list (pair partner group)) == ^+ ret =. ret @@ -1398,10 +1398,11 @@ %+ sh-fact %txt (runt [(sub 13 (lent bun)) '-'] "[{bun}]") :: - ++ sh-puss ::< readable posture - ::> renders a security posture. + ++ sh-cure ::< readable security + ::> renders a security kind. :: - |= a/posture ^- tape + |= a/security + ^- tape ?- a $black "channel" $brown "mailbox" @@ -1416,7 +1417,7 @@ ^- tape ['%' (trip pec.sat)] :: - ++ sh-show-precs ::< print atlas diff + ++ sh-show-precs ::< print group diff ::> prints presence changes to the cli. :: |= $: pre/tape @@ -1449,9 +1450,9 @@ ++ sh-show-permits ::< show permits ::> prints invite/banish effects to the cli. :: - |= {pre/tape por/posture old/(list ship) new/(list ship)} - =+ out=?:(?=(?($black $brown) por) "try " "cut ") - =+ inn=?:(?=(?($black $brown) por) "ban " "add ") + |= {pre/tape sec/security old/(list ship) new/(list ship)} + =+ out=?:(?=(?($black $brown) sec) "try " "cut ") + =+ inn=?:(?=(?($black $brown) sec) "ban " "add ") =. +>.$ |- ^+ +>.^$ ?~ old +>.^$ @@ -1494,7 +1495,7 @@ (weld (trip inbox) ": ") (sh-set-diff src.laz src.loc) ?: !=(sec.con.loc sec.con.laz) - =. +>.$ (sh-note :(weld pre "but " (sh-puss sec.con.loc))) + =. +>.$ (sh-note :(weld pre "but " (sh-cure sec.con.loc))) %^ sh-show-permits (weld (trip inbox) ": ") sec.con.loc @@ -1523,7 +1524,7 @@ ++ sh-low-rempe ::< show remotes ::> prints remote presence changes to the cli. :: - |= {old/(map partner atlas) new/(map partner atlas)} + |= {old/(map partner group) new/(map partner group)} ?: (~(has in settings.she) %quiet) +>.$ =+ day=(sh-rempe-diff old new) @@ -1547,15 +1548,15 @@ (sh-note (weld "for " (~(pr-show pr p.i.cha.day) ~))) =+ yez=(~(got by old) p.i.cha.day) %+ sh-show-precs "--" - (sh-atlas-diff yez q.i.cha.day) + (sh-group-diff yez q.i.cha.day) +>.$ :: ++ sh-low-precs ::< show presence ::> prints presence changes to the cli. :: - |= {old/atlas new/atlas} + |= {old/group new/group} ^+ +> - =+ dif=(sh-atlas-diff old new) + =+ dif=(sh-group-diff old new) (sh-show-precs "" dif) :: ++ sh-low-gram ::< show telegram @@ -1924,7 +1925,7 @@ tan+~[leaf+"# {(trip exp.sep)}"] :: $fat - [%mor $(sep sep.sep) tan+(tr-tors tac.sep) ~] + [%mor $(sep sep.sep) tan+(tr-tach tac.sep) ~] :: $inv :- %tan @@ -1953,10 +1954,10 @@ == == :: - ++ tr-tors ::< attachment + ++ tr-tach ::< attachment ::> renders an attachment. :: - |= a/torso + |= a/attache ^- tang ?- -.a $name (welp $(a tac.a) leaf+"={(trip nom.a)}" ~) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 121a29aa79..4d90749d49 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -47,8 +47,8 @@ ++ story ::> wire content $: count/@ud ::< (lent grams) grams/(list telegram) ::< all messages - locals/atlas ::< local presence - remotes/(map partner atlas) ::< remote presence + locals/group ::< local presence + remotes/(map partner group) ::< remote presence shape/config ::< configuration mirrors/(map circle config) ::< remote config ::TODO never gets updated. :: @@ -234,11 +234,11 @@ ::> creates our default mailbox and journal. :: %+ roll - ^- (list {posture knot cord}) + ^- (list {security knot cord}) :~ [%brown (main our.bol) 'default home'] [%green ~.public 'visible activity'] == - |= {{typ/posture nom/knot des/cord} _ta} + |= {{typ/security nom/knot des/cord} _ta} %+ ta-action ost.bol [%create nom des typ] :: @@ -310,7 +310,7 @@ ++ action-create ::< create story ::> creates a story with the specified parameters. :: - |= {nom/knot des/cord typ/posture} + |= {nom/knot des/cord typ/security} ^+ ..ta-action ?. (~(has in stories) nom) (ta-config nom [[%& our.bol nom] ~ ~] des [typ ~]) @@ -483,7 +483,7 @@ ::TODO? or (so-sauce ost.bol [%quit ~]~) ? =^ who +>.$ (ta-human her) :: send current data to bring her up to date. - =. soy (so-report-cabal:soy ost.bol ~ ~) + =. soy (so-report-lobby:soy ost.bol ~ ~) =. soy (so-report-group:soy ost.bol ~ ~) =. soy (so-start:soy her t.pax) ::< also adds story sub =. soy (so-notify:soy her %hear who) ::< add her status @@ -892,13 +892,13 @@ ::> send local and remote presences in a report. :: |= bos/(set bone) - (so-report bos %group locals so-remotes) + (so-report bos %crowd locals so-remotes) :: - ++ so-report-cabal ::< config update + ++ so-report-lobby ::< config update ::> send local and remote configs in a report. :: |= bos/(set bone) - (so-report bos %cabal shape mirrors) + (so-report bos %lobby shape mirrors) :: ::> || ::> || %data @@ -936,11 +936,11 @@ ::> stories. :: %- ~(urn by remotes) :: XX performance - |= {pan/partner atl/atlas} - ^- atlas - ?. &(?=($& -.pan) =(our.bol hos.p.pan)) atl + |= {pan/partner gop/group} + ^- group + ?. &(?=($& -.pan) =(our.bol hos.p.pan)) gop =+ soy=(~(get by stories) nom.p.pan) - ?~ soy atl + ?~ soy gop locals.u.soy :: ::> || @@ -963,12 +963,12 @@ " %" (scow %tas -.ret) == ?- -.ret - $cabal (so-cabal cir +.ret) - $group (so-remind [%& cir] +.ret) + $lobby (so-lobby cir +.ret) + $crowd (so-remind [%& cir] +.ret) $grams (so-lesson gaz.ret) == :: - ++ so-cabal ::< update config + ++ so-lobby ::< update config ::> add circle's config to our remote config map. :: ::TODO when do we care about rem? @@ -978,14 +978,14 @@ =. mirrors (~(put by mirrors) cir con) ?: =(mirrors old) +>.$ =. +>.$ (so-inform %confs `shape (strap cir `con)) - (so-report-cabal so-followers) + (so-report-lobby so-followers) :: ++ so-remind ::< remote presence - ::> adds tay's loc to our remote presence map, - ::> after merging with rem. + ::> adds {tay}'s {loc} to our remote presence map, + ::> after merging with {rem}. ::> if this changes anything, send a report. :: - |= {pan/partner loc/atlas rem/(map partner atlas)} + |= {pan/partner loc/group rem/(map partner group)} =. rem (~(del by rem) %& our.bol nom) ::< superseded by local =/ buk (~(uni by remotes) rem) =. buk (~(put by buk) pan loc) @@ -994,7 +994,7 @@ %^ so-inform %precs ~ ::> per-partner diff. %- ~(urn by buk) - |= {p/partner a/atlas} + |= {p/partner a/group} =+ o=(~(get by remotes) p) ?~(o a (~(dif in a) u.o)) (so-report-group(remotes buk) so-followers) @@ -1006,7 +1006,7 @@ ::+| :: ++ so-reform ::< reconfigure - ::> changes the config of this story and notify:: + ::> changes the config of this story and notify ::> our followers. ::> subscribes to new sources, unsubs from removed ::> ones. @@ -1021,7 +1021,7 @@ =. +>.$ (so-acquire p.dif) =. +>.$ (so-abjure q.dif) =. shape cof - (so-report-cabal so-followers) + (so-report-lobby so-followers) :: ++ so-reform-gone ::< delete story ::> deletes this story. removes it from {stories} @@ -1029,7 +1029,7 @@ :: =. stories (~(del by stories) nom) =. . (so-inform %confs ~ ~) - =. . (so-report-cabal so-followers) + =. . (so-report-lobby so-followers) (so-abjure (~(tap in src.shape))) :: ++ so-notify ::< local presence @@ -1106,7 +1106,7 @@ ?. (~(has in src.shape) pan) +> =. src.shape (~(del in src.shape) pan) =. +> (so-inform %confs `shape ~) - (so-report-cabal so-followers) + (so-report-lobby so-followers) :: ++ so-start ::< subscribe follower ::> called upon subscribe. deduces the range of diff --git a/mar/talk/report.hoon b/mar/talk/report.hoon index b1377ec798..0fc97f397d 100644 --- a/mar/talk/report.hoon +++ b/mar/talk/report.hoon @@ -19,9 +19,9 @@ => + |^ %+ joba -.rep ?- -.rep - $cabal (cabl cab.rep) + $lobby (loby cab.rep) $grams (jobe num+(jone num.rep) tele+[%a (turn gaz.rep gram)] ~) - $group %^ jobe + $crowd %^ jobe local+(grop loc.reg.rep) global+%.(rem.reg.rep (jome parn grop)) ~ @@ -121,8 +121,8 @@ (jobe first+[%s p] middle+?~(q ~ [%s u.q]) last+[%s r] ~) ~ :: - ++ cabl - |= cabal + ++ loby + |= lobby %- jobe :~ loc+(conf loc) ham+((jome circ conf) rem) @@ -137,7 +137,7 @@ %- jobe :~ sources+(sorc src) caption+[%s cap] - =- cordon+(jobe posture+[%s -.con] list+[%a -] ~) + =- control+(jobe security+[%s -.con] list+[%a -] ~) (turn (~(tap in ses.con)) jope) :: XX jase == -- diff --git a/sur/talk.hoon b/sur/talk.hoon index a46fbb1e51..53e117cdf1 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -11,7 +11,7 @@ :: ++ action ::> user action $% :: circle configuration :: - {$create nom/knot des/cord sec/posture} ::< create circle + {$create nom/knot des/cord sec/security} ::< create circle {$source nom/knot sub/? src/(set partner)} ::< un/sub p to/from r {$depict nom/knot des/cord} ::< change description {$permit nom/knot inv/? sis/(set ship)} ::< invite/banish @@ -37,7 +37,7 @@ loc/(unit config) ::< local config rem/(map circle (unit config)) ::< remote configs == :: - {$precs reg/register} ::< presences + {$precs reg/crowd} ::< presences {$grams num/@ud gaz/(list telegram)} ::< messages :: ui state :: {$glyph (jug char (set partner))} ::< glyph bindings @@ -54,8 +54,8 @@ $% {$review tos/(list thought)} ::< deliver == :: ++ report ::> update - $% {$cabal cab/cabal} ::< config neighborhood - {$group reg/register} ::< presence + $% {$lobby cab/lobby} ::< config neighborhood + {$crowd reg/crowd} ::< presence {$grams num/@ud gaz/(list telegram)} ::< thoughts == :: :: @@ -71,25 +71,22 @@ $% {$twitter p/@t} ::< twitter handle == :: :: circle configurations. :: -++ cabal ::> metaconfiguration - $: loc/config ::< local config - rem/(map circle config) ::< neighborhood configs - == :: +++ lobby {loc/config rem/(map circle config)} ::< our & srcs configs ++ config ::> circle config $: src/(set partner) ::< pulls from cap/cord ::< description con/control ::< restrictions == :: -++ control {sec/posture ses/(set ship)} ::< access control -++ posture ::> security kind +++ control {sec/security ses/(set ship)} ::< access control +++ security ::> security kind $? $black ::< channel, blacklist $white ::< village, whitelist $green ::< journal, author list $brown ::< mailbox, our r, bl w == :: :: participant metadata. :: -++ register {loc/atlas rem/(map partner atlas)} ::< our & srcs presences -++ atlas (map ship status) ::< presence map +++ crowd {loc/group rem/(map partner group)} ::< our & srcs presences +++ group (map ship status) ::< presence map ++ status {pec/presence man/human} ::< participant ++ presence ::> status type $? $gone ::< left @@ -117,7 +114,7 @@ {$ire tos/serial sep/speech} ::< in-reply-to {$url url/purf} ::< parsed url {$exp exp/@t} ::< hoon line - {$fat tac/torso sep/speech} ::< attachment + {$fat tac/attache sep/speech} ::< attachment {$lan nom/knot msg/@t} ::< local announce {$inv inv/? cir/circle} ::< inv/ban for circle {$mor ses/(list speech)} ::< multiplex @@ -133,8 +130,8 @@ meta/json ::< other data for web == :: == :: -++ torso ::> attachment - $% {$name nom/@t tac/torso} ::< named attachment +++ attache ::> attachment + $% {$name nom/@t tac/attache} ::< named attachment {$text (list @t)} ::< text lines {$tank (list tank)} ::< tank list == :: From 790468e28a26e5205f418bf226f583b3e2b33b0c Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 27 Apr 2017 12:15:41 +0200 Subject: [PATCH 088/303] Renamed talk state molds. --- app/talk-agent.hoon | 6 +++--- app/talk-guardian.hoon | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 1fe9f4dabc..b0e93b32e4 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -28,7 +28,7 @@ ::> data structures :: |% - ++ chattel ::> reader state + ++ state ::> reader state $: :: messaging state :: count/@ud ::< (lent grams) grams/(list telegram) ::< all history @@ -100,12 +100,12 @@ ::> || ::> functional cores and arms. :: -|_ {bol/bowl chattel} +|_ {bol/bowl state} :: ++ prep ::< prepare state ::> adapts state. :: - |= old/(unit chattel) + |= old/(unit state) ^- (quip move ..prep) ?~ old ta-done:ta-init:ta diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 4d90749d49..8aa4b12988 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -35,7 +35,7 @@ ::> data structures :: |% - ++ house ::> broker state + ++ state ::> broker state $: stories/(map knot story) ::< convercirions readers/(map bone (set knot)) ::< our message readers outbox/(pair @ud (map @ud thought)) ::< urbit outbox @@ -91,12 +91,12 @@ ::> || ::> functional cores and arms. :: -|_ {bol/bowl house} +|_ {bol/bowl state} :: ++ prep ::< prepare state ::> adapts state. :: - |= old/(unit house) + |= old/(unit state) ^- (quip move ..prep) ?~ old ta-done:ta-init:ta From f8e3ef2edf832bf83360eef85b461eef53ffb203 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 27 Apr 2017 13:21:17 +0200 Subject: [PATCH 089/303] Renamed talk guardian's parsed wire faces. --- app/talk-guardian.hoon | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 8aa4b12988..58e5744334 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -81,8 +81,8 @@ {$quit $~} :: == :: ++ weir ::> parsed wire - $% {$repeat p/@ud q/@p r/knot} ::< messaging wire - {$friend p/knot q/circle} ::< subscription wire + $% {$repeat num/@ud hos/@p nom/knot} ::< messaging wire + {$friend nom/knot cir/circle} ::< subscription wire == :: -- :: @@ -1389,7 +1389,7 @@ {(list move) _.} == =+ wer=(etch wir) - ?>(?=($friend -.wer) (fun p.wer q.wer)) + ?>(?=($friend -.wer) (fun nom.wer cir.wer)) :: ++ etch-repeat ::< parse /repeat wire ::> parses a /repeat wire, call gate with the result. @@ -1400,7 +1400,7 @@ {(list move) _.} == =+ wer=(etch wir) - ?>(?=($repeat -.wer) (fun p.wer q.wer r.wer)) + ?>(?=($repeat -.wer) (fun num.wer hos.wer nom.wer)) :: ::> || ::> || %poke-events From 84026f99807b5e1e16324886663ae3258955fea4 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 27 Apr 2017 17:05:19 +0200 Subject: [PATCH 090/303] Fixed report mark.. again. --- mar/talk/report.hoon | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mar/talk/report.hoon b/mar/talk/report.hoon index 0fc97f397d..ce5e2e5c0a 100644 --- a/mar/talk/report.hoon +++ b/mar/talk/report.hoon @@ -86,7 +86,7 @@ $lin (jobe txt+[%s msg.a] say+[%b pat.a] ~) $url (joba txt+[%s (crip (earf url.a))]) $exp (joba txt+[%s exp.a]) - $fat (jobe tor+(tors tac.a) taf+$(a sep.a) ~) + $fat (jobe tor+(tach tac.a) taf+$(a sep.a) ~) $mor a+(turn ses.a spec) $app (jobe txt+[%s msg.a] src+[%s app.a] ~) $api @@ -102,8 +102,8 @@ :: %inv (jobe ship+(jope p.a) party+[%s q.a] ~) == :: - ++ tors - |= a/torso + ++ tach + |= a/attache %+ joba -.a ?- -.a $text [%s (role +.a)] From 36765e0d14679ba0419b386f5c995c3735287f52 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 28 Apr 2017 19:40:12 +0200 Subject: [PATCH 091/303] Implemented actual federation. %burden and %relief commands have been implemented to facilitate this, for starting and ending federation respectively. --- app/talk-agent.hoon | 35 ++++++- app/talk-guardian.hoon | 225 +++++++++++++++++++++++++++++++++++++++-- sur/talk.hoon | 11 ++ 3 files changed, 260 insertions(+), 11 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index b0e93b32e4..daf597a69f 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -14,7 +14,7 @@ ::> since that's the only thing the reader ever ::> subscribes to. :: -/? 310 ::< hoon version +/? 151 ::< hoon version /- talk, sole ::< structures /+ talk, sole ::< libraries /= seed /~ !>(.) @@ -74,6 +74,9 @@ {$source p/knot q/(set partner)} ::< add source {$invite p/knot q/(set ship)} ::< give permission {$banish p/knot q/(set ship)} ::< deny permission + {$enlist p/knot q/(set ship)} ::< allow federation + {$retire p/knot q/(set ship)} ::< deny federation + {$burden p/circle} ::< help federate :: messaging :: {$say p/(list speech)} ::< send message {$eval p/cord q/twig} ::< send #-message @@ -629,6 +632,12 @@ :: ;~((glue ace) (perk %banish ~) stat shiz) :: + ;~((glue ace) (perk %enlist ~) stat shiz) + :: + ;~((glue ace) (perk %retire ~) stat shiz) + :: + ;~((glue ace) (perk %burden ~) stan) + :: :: displaying info :: ;~(plug (perk %who ~) ;~(pose ;~(pfix ace para) (easy ~))) @@ -817,6 +826,9 @@ $source (source +.job) $invite (invite +.job) $banish (banish +.job) + $enlist (enlist +.job) + $retire (retire +.job) + $burden (burden +.job) :: messaging $say (say +.job) $eval (eval +.job) @@ -988,6 +1000,27 @@ ^+ ..sh-work (sh-act %permit nom | sis) :: + ++ enlist + ::> + :: + |= {nom/knot sis/(set ship)} + ^+ ..sh-work + (sh-act %enlist nom & sis) + :: + ++ retire + ::> + :: + |= {nom/knot sis/(set ship)} + ^+ ..sh-work + (sh-act %enlist nom | sis) + :: + ++ burden + ::> + :: + |= cir/circle + ^+ ..sh-work + (sh-act %burden cir) + :: ::> || ::> || %messaging ::> || diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 58e5744334..7fd47fc149 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -11,7 +11,7 @@ ::TODO we can't do away with the default mailbox because we need it for things :: like invite notifications etc. can we do better than request that apps :: don't use it frivolously? -::TODO federation stuff. +:: ::TODO ".. the importance of the CQRS pattern (command-query separation) behind :: Urbit's separation of %poke and %peer. Pokes (messages) are one-way :: commands, not queries. Peers (subscriptions) have no effect on the @@ -21,7 +21,7 @@ ::TODO crash on pokes/peers we do not expect ::TODO keep both a folks and nicks maps. (actual profiles and local nicknames.) :: -/? 310 ::< hoon version +/? 151 ::< hoon version /- talk ::< structures /+ talk, time-to-id ::< libraries /= seed /~ !>(.) @@ -252,8 +252,32 @@ ::> to verify and distribute messages. $review (ta-think | src +.cod) + ::> %burden commands ask us to add the sender as a + ::> federator for the specified story, taking the + ::> state it sent into account. + $burden + (ta-burden src +.cod) + ::> %relief commands prompt us to relieve the + ::> specified federators of their duty. + $relief + (ta-relieve src +.cod) == :: + ++ ta-burden ::< accept federator + ::> adds {src} as a federator to story {nom}, + ::> integrating its state into the story. + :: + |= {src/ship nom/knot cof/lobby pes/crowd gaz/(list telegram)} + %- (ta-know nom) |= sor/_so =< so-done + (so-burden:sor src cof pes gaz) + :: + ++ ta-relieve ::< remove federator + ::> removes {who} as federators from story {nom}. + :: + |= {src/ship nom/knot who/(set ship)} + %- (ta-know nom) |= sor/_so =< so-done + (so-relieve:sor src who) + :: ++ ta-action ::< apply reader action ::> performs action sent by a reader. :: @@ -280,6 +304,8 @@ $depict (action-depict +.act) $permit (action-permit +.act) $delete (action-delete +.act) + $enlist (action-enlist +.act) + $burden (action-burden +.act) :: messaging $convey (action-convey +.act) $phrase (action-phrase +.act) @@ -313,7 +339,12 @@ |= {nom/knot des/cord typ/security} ^+ ..ta-action ?. (~(has in stories) nom) - (ta-config nom [[%& our.bol nom] ~ ~] des [typ ~]) + %+ ta-config nom + :* [[%& our.bol nom] ~ ~] + des + [typ ~] + [[our.bol ~ ~] [our.bol ~ ~]] + == (ta-react red %fail (crip "{(trip nom)}: already exists") `act) :: ++ action-source ::< un/sub p to/from r @@ -360,6 +391,52 @@ [%lin | u.mes]~ (ta-unconfig nom) :: + ++ action-enlist ::< dis/allow federation + ::> adds {sis} to story {nom}'s list of allowed + ::> federators. + :: + |= {nom/knot fed/? sis/(set ship)} + ^+ ..ta-action + %- (affect nom) |= {sor/_so soy/story} + ::TODO maybe so-enlist, with message note and everything + =. may.fed.shape.soy + %. sis + ?: fed + ~(uni in may.fed.shape.soy) + ~(dif in may.fed.shape.soy) + (ta-config nom shape.soy) + :: + ++ action-burden ::< help federate + ::> starts federating the specified circle. create + ::> it locally if it doesn't yet exist. + :: + |= {hos/ship nom/knot} + ^+ ..ta-action + :: update federation config. + =+ soy=(fall (~(get by stories) nom) *story) + =. may.fed.shape.soy + (~(put in may.fed.shape.soy) hos) + =. fes.fed.shape.soy + (~(put in fes.fed.shape.soy) hos) + =. src.shape.soy + (~(put in src.shape.soy) [%& hos nom]) + =. ..ta-action + (ta-config nom shape.soy) + :: send %burden command with story's current state. + %- ta-emit + :* ost.bol + %poke + /burden + [hos %talk-guardian] + :* %talk-command + %burden + nom + [shape.soy mirrors.soy] + [locals.soy remotes.soy] + grams.soy + == + == + :: ::> || %messaging ::+| ++ action-convey ::< post exact @@ -943,24 +1020,115 @@ ?~ soy gop locals.u.soy :: + ++ so-right ::< is federator? + ::> checks whether partner {pan} has authority + ::> over this story. + :: + |= pan/partner + ?& ?=($& -.pan) + =(nom nom.p.pan) + (~(has in fes.fed.shape) hos.p.pan) + == + :: ::> || ::> || %interaction-events ::> || ::> arms that apply events we received. ::+| :: + ++ so-burden ::< accept federator + ::> if {src} is allowed to, have it federate this + ::> story. + ::> starts by assimilating {src}'s state into our + ::> own (giving priority to local state), removing + ::> redundant data, then sending updated state to + ::> all followers. + :: + |= {src/ship cof/lobby pes/crowd gaz/(list telegram)} + ^+ +> + :: continue if permitted and not yet done. + ?. (~(has in may.fed.shape) src) +> + ?: (~(has in fes.fed.shape) src) +> + :: assimilate config. + =. +> + =+ nec=shape + :: adopt security list if they're similar. + =. ses.con.nec ::TODO =? + ?. .= ?=(?($white $green) sec.con.nec) + ?=(?($white $green) sec.con.loc.cof) + ses.con.nec + (~(uni in ses.con.nec) ses.con.loc.cof) + =. fes.fed.nec + (~(put in fes.fed.nec) src) + =. src.nec + (~(put in src.nec) [%& src nom]) + (so-reform nec) + :: assimilate presence and remotes. + =. locals (~(uni by loc.pes) locals) + =. remotes (~(uni by rem.pes) remotes) + =. mirrors (~(uni by rem.cof) mirrors) + :: remove redundant remotes. + =. remotes + %- ~(gas by *_remotes) + %+ murn (~(tap by remotes)) + |= {p/partner g/group} + ^- (unit {partner group}) + ?: ?& ?=($& -.p) + =(nom.p.p nom) + (~(has in fes.fed.shape) hos.p.p) + == + ~ + `[p g] + :: remove redundant mirrors. + =. mirrors + %- ~(gas by *_mirrors) + %+ murn (~(tap by mirrors)) + |= {c/circle f/config} + ^- (unit {circle config}) + ?: ?& =(nom.c nom) + (~(has in fes.fed.shape) hos.c) + == + ~ + `[c f] + :: send updates to followers. + =. +>.$ (so-report-group so-followers) + =. +>.$ (so-report-lobby so-followers) + :: finally, learn all grams. + (so-lesson gaz) + :: + ++ so-relieve ::< remove federator + ::> if {src} is allowed to, removes {who} as + ::> federators from this story. + :: + |= {src/ship who/(set ship)} + ^+ +> + ?. (~(has in fes.fed.shape) src) +> + =+ nes=shape + =. fes.fed.nes + (~(dif in fes.fed.nes) who) + =. src.nes + %- ~(dif in src.nes) + ^- (set partner) + %- ~(run in who) + |=(s/ship [%& s nom]) + ?: =(nes shape) +>.$ + ::TODO propogate %relief to other federators. + (so-reform nes) + :: ++ so-diff-report ::< process update ::> process a talk report from {cir}. ::> if we didn't expect it, ignore. :: |= {cir/circle ret/report} ^+ +> + ?: =(cir [our.bol nom]) +> ?. (~(has in src.shape) [%& cir]) %- so-note %- crip ;: weld "so-diff unexpected " (scow %p hos.cir) "/" (trip nom.cir) " %" (scow %tas -.ret) + " in " (scow %tas nom) == ?- -.ret $lobby (so-lobby cir +.ret) @@ -974,6 +1142,24 @@ ::TODO when do we care about rem? |= {cir/circle con/config rem/(map circle config)} ^+ +> + :: if they're a federator, set new shape. + =. +> ::TODO =? + ?. ?& =(nom nom.cir) + (~(has in fes.fed.shape) hos.cir) + == + +> + :: to prevent removal of federators during initial setup, only allow + :: federator deletion through explicit action. + =. fes.fed.con (~(uni in fes.fed.con) fes.fed.shape) + =. may.fed.con (~(uni in may.fed.con) may.fed.shape) + =. src.con ::TODO is this needed? + %- ~(uni in src.con) + ^- (set partner) + %- ~(run in fes.fed.con) + |= s/ship + ^- partner + [%& s nom] + (so-reform con) =+ old=mirrors =. mirrors (~(put by mirrors) cir con) ?: =(mirrors old) +>.$ @@ -986,18 +1172,36 @@ ::> if this changes anything, send a report. :: |= {pan/partner loc/group rem/(map partner group)} - =. rem (~(del by rem) %& our.bol nom) ::< superseded by local + :: if they're a federator, set new locals. =/ buk (~(uni by remotes) rem) =. buk (~(put by buk) pan loc) - ?: =(buk remotes) +>.$ - =. +>.$ - %^ so-inform %precs ~ - ::> per-partner diff. - %- ~(urn by buk) + :: seperate federation presences and true remotes. + =/ nep/crowd + %+ roll (~(tap by buk)) + |= {{p/partner g/group} c/crowd} + ?: (so-right p) + [(~(uni by loc.c) g) rem.c] + [loc.c (~(put by rem.c) p g)] + :: ensure we have the latest. + =. loc.nep + ?. (so-right pan) (~(uni by locals) loc.nep) + (~(uni by (~(uni by locals) loc.nep)) loc) + :: if nothing changed, we're done. + ?: ?& =(loc.nep locals) + =(rem.nep remotes) + == + +>.$ + :: reader update. + =. +>.$ ::TODO =? + %^ so-inform %precs + (~(dif in loc.nep) locals) :: locals + :: per-partner diff for remotes. + %- ~(urn by rem.nep) |= {p/partner a/group} =+ o=(~(get by remotes) p) ?~(o a (~(dif in a) u.o)) - (so-report-group(remotes buk) so-followers) + :: subscriber update. + (so-report-group(locals loc.nep, remotes rem.nep) so-followers) :: ::> || ::> || %changes @@ -1012,6 +1216,7 @@ ::> ones. :: |= cof/config + ?: =(cof shape) +> =. +>.$ (so-inform %confs `cof ~) =/ dif/(pair (list partner) (list partner)) =+ old=`(list partner)`(~(tap in src.shape) ~) diff --git a/sur/talk.hoon b/sur/talk.hoon index 53e117cdf1..590ae9a304 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -16,6 +16,8 @@ {$depict nom/knot des/cord} ::< change description {$permit nom/knot inv/? sis/(set ship)} ::< invite/banish {$delete nom/knot ano/(unit cord)} ::< delete + announce + {$enlist nom/knot fed/? sis/(set ship)} ::< dis/allow federation + {$burden circle} ::< help federate :: messaging :: {$convey tos/(list thought)} ::< post exact {$phrase aud/(set partner) ses/(list speech)} ::< post easy @@ -52,6 +54,13 @@ :: ++ command ::> effect on story $% {$review tos/(list thought)} ::< deliver + $: $burden ::< starting fed state + nom/knot + cof/lobby + pes/crowd + gaz/(list telegram) + == + {$relief nom/knot who/(set ship)} ::< federation ended == :: ++ report ::> update $% {$lobby cab/lobby} ::< config neighborhood @@ -76,6 +85,7 @@ $: src/(set partner) ::< pulls from cap/cord ::< description con/control ::< restrictions + fed/federal ::< federators == :: ++ control {sec/security ses/(set ship)} ::< access control ++ security ::> security kind @@ -84,6 +94,7 @@ $green ::< journal, author list $brown ::< mailbox, our r, bl w == :: +++ federal {may/(set ship) fes/(set ship)} ::< federation control :: participant metadata. :: ++ crowd {loc/group rem/(map partner group)} ::< our & srcs presences ++ group (map ship status) ::< presence map From 22538c85933ea4f2b68c1b41ecd402d5dda80e2d Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 1 May 2017 19:34:05 +0200 Subject: [PATCH 092/303] More consistent about naming @t as cord, @p as ship, etc. --- app/talk-agent.hoon | 2 +- app/talk-guardian.hoon | 4 ++-- sur/talk.hoon | 30 +++++++++++++++--------------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index daf597a69f..c88c0cf6f3 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -1407,7 +1407,7 @@ %+ sh-fact %pro :+ & %talk-line ^- tape - =/ rew/(pair (pair @t @t) (set partner)) + =/ rew/(pair (pair cord cord) (set partner)) [['[' ']'] active.she] =+ cha=(~(get by nik) q.rew) ?^ cha ~[u.cha ' '] diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 7fd47fc149..7c296dda12 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -74,14 +74,14 @@ == :: ++ card ::> general card $% {$diff lime} :: - {$info wire @p @tas nori} :: + {$info wire ship term nori} :: {$peer wire dock path} :: {$poke wire dock pear} :: {$pull wire dock $~} :: {$quit $~} :: == :: ++ weir ::> parsed wire - $% {$repeat num/@ud hos/@p nom/knot} ::< messaging wire + $% {$repeat num/@ud hos/ship nom/knot} ::< messaging wire {$friend nom/knot cir/circle} ::< subscription wire == :: -- diff --git a/sur/talk.hoon b/sur/talk.hoon index 590ae9a304..a6a223d26e 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -30,7 +30,7 @@ == :: ++ reaction ::> user information $: res/?($info $fail) ::< result - wat/@t ::< explain + wat/cord ::< explain why/(unit action) ::< cause == :: ++ lowdown ::> new/changed state @@ -77,7 +77,7 @@ ++ partner (each circle passport) ::< message target ++ circle {hos/ship nom/knot} ::< native target ++ passport ::> foreign target - $% {$twitter p/@t} ::< twitter handle + $% {$twitter p/cord} ::< twitter handle == :: :: circle configurations. :: ++ lobby {loc/config rem/(map circle config)} ::< our & srcs configs @@ -106,8 +106,8 @@ $talk ::< typing == :: ++ human ::> human identifier - $: tru/(unit (trel @t (unit @t) @t)) :: || @@ -121,29 +121,29 @@ ++ statement {wen/@da boq/bouquet sep/speech} ::< when this ++ speech ::> narrative action $% {$non $~} ::< no content (yo) - {$lin pat/? msg/@t} ::< no/@ text line + {$lin pat/? msg/cord} ::< no/@ text line {$ire tos/serial sep/speech} ::< in-reply-to {$url url/purf} ::< parsed url - {$exp exp/@t} ::< hoon line + {$exp exp/cord} ::< hoon line {$fat tac/attache sep/speech} ::< attachment - {$lan nom/knot msg/@t} ::< local announce + {$lan nom/knot msg/cord} ::< local announce {$inv inv/? cir/circle} ::< inv/ban for circle {$mor ses/(list speech)} ::< multiplex - {$ext nom/@tas dat/*} ::< extended action - {$app app/@tas msg/@t} ::< app message + {$ext nom/term dat/*} ::< extended action + {$app app/term msg/cord} ::< app message $: $api ::< api message - service/@tas ::< service name - id/@t ::< id on the service + service/term ::< service name + id/cord ::< id on the service id-url/purf ::< link to id - summary/@t ::< summary of event - body/@t ::< body of event + summary/cord ::< summary of event + body/cord ::< body of event url/purf ::< link to event meta/json ::< other data for web == :: == :: ++ attache ::> attachment - $% {$name nom/@t tac/attache} ::< named attachment - {$text (list @t)} ::< text lines + $% {$name nom/cord tac/attache} ::< named attachment + {$text (list cord)} ::< text lines {$tank (list tank)} ::< tank list == :: :: From 73dabbb8307b96dc6b7619db847968daa1b097e7 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 1 May 2017 19:39:21 +0200 Subject: [PATCH 093/303] Renamed cli parsers to match new terminology. --- app/talk-agent.hoon | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index c88c0cf6f3..4bf5347049 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -517,10 +517,10 @@ == == :: - ++ stat ::< local circle + ++ cire ::< local circle ;~(pfix cen sym) :: - ++ stan ::< circle + ++ circ ::< circle ;~ pose (cold [our.bol inbox] col) ;~(pfix cen (stag our.bol sym)) @@ -537,7 +537,7 @@ :: ++ parn ::< partner ;~ pose - (stag %& stan) + (stag %& circ) (stag %| pasp) == :: @@ -612,7 +612,7 @@ :: ;~ (glue ace) (perk %create ~) pore - stat + cire qut == :: @@ -624,19 +624,19 @@ == == :: - ;~((glue ace) (perk %depict ~) stat qut) + ;~((glue ace) (perk %depict ~) cire qut) :: - ;~((glue ace) (perk %source ~) stat parz) + ;~((glue ace) (perk %source ~) cire parz) :: - ;~((glue ace) (perk %invite ~) stat shiz) + ;~((glue ace) (perk %invite ~) cire shiz) :: - ;~((glue ace) (perk %banish ~) stat shiz) + ;~((glue ace) (perk %banish ~) cire shiz) :: - ;~((glue ace) (perk %enlist ~) stat shiz) + ;~((glue ace) (perk %enlist ~) cire shiz) :: - ;~((glue ace) (perk %retire ~) stat shiz) + ;~((glue ace) (perk %retire ~) cire shiz) :: - ;~((glue ace) (perk %burden ~) stan) + ;~((glue ace) (perk %burden ~) circ) :: :: displaying info :: From 3e558bded3ec4909b7bee9b55e0ce6a9c3de9fa5 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 3 May 2017 18:38:41 +0200 Subject: [PATCH 094/303] Shuffled order of talk actions around to be slightly more intuitive. --- app/talk-agent.hoon | 24 ++++++++++++------------ app/talk-guardian.hoon | 42 +++++++++++++++++++++--------------------- sur/talk.hoon | 4 ++-- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 4bf5347049..b6697fee5f 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -68,12 +68,12 @@ $% :: circle management :: {$join p/where} ::< subscribe to {$leave p/where} ::< unsubscribe from - {$create p/security q/knot r/cord} ::< create circle + {$create p/security q/knot r/cord} ::< create circle {$delete p/knot q/(unit cord)} ::< delete circle {$depict p/knot q/cord} ::< change description - {$source p/knot q/(set partner)} ::< add source {$invite p/knot q/(set ship)} ::< give permission {$banish p/knot q/(set ship)} ::< deny permission + {$source p/knot q/(set partner)} ::< add source {$enlist p/knot q/(set ship)} ::< allow federation {$retire p/knot q/(set ship)} ::< deny federation {$burden p/circle} ::< help federate @@ -626,12 +626,12 @@ :: ;~((glue ace) (perk %depict ~) cire qut) :: - ;~((glue ace) (perk %source ~) cire parz) - :: ;~((glue ace) (perk %invite ~) cire shiz) :: ;~((glue ace) (perk %banish ~) cire shiz) :: + ;~((glue ace) (perk %source ~) cire parz) + :: ;~((glue ace) (perk %enlist ~) cire shiz) :: ;~((glue ace) (perk %retire ~) cire shiz) @@ -823,9 +823,9 @@ $create (create +.job) $delete (delete +.job) $depict (depict +.job) - $source (source +.job) $invite (invite +.job) $banish (banish +.job) + $source (source +.job) $enlist (enlist +.job) $retire (retire +.job) $burden (burden +.job) @@ -979,13 +979,6 @@ ^+ ..sh-work (sh-act %depict nom txt) :: - ++ source ::< %source - ::> adds {pas} to {nom}'s src. - :: - |= {nom/knot pas/(set partner)} - ^+ ..sh-work - (sh-act %source nom & pas) - :: ++ invite ::< %invite ::> invites {sis} to our circle {nom}. :: @@ -1000,6 +993,13 @@ ^+ ..sh-work (sh-act %permit nom | sis) :: + ++ source ::< %source + ::> adds {pas} to {nom}'s src. + :: + |= {nom/knot pas/(set partner)} + ^+ ..sh-work + (sh-act %source nom & pas) + :: ++ enlist ::> :: diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 7c296dda12..09bd34f0de 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -347,18 +347,19 @@ == (ta-react red %fail (crip "{(trip nom)}: already exists") `act) :: - ++ action-source ::< un/sub p to/from r - ::> add/remove {pas} as sources for story {nom}. + ++ action-delete ::< delete + announce + ::> delete story {nom}, optionally announcing the + ::> event with message {mes}. :: - |= {nom/knot sub/? pas/(set partner)} + |= {nom/knot mes/(unit cord)} ^+ ..ta-action - %- (affect nom) |= {sor/_so soy/story} - =. src.shape.soy - %. pas - ?: sub - ~(uni in src.shape.soy) - ~(dif in src.shape.soy) - (ta-config nom shape.soy) + %- (affect nom) |= * + =. ..ta-action ::TODO =? + ?~ mes ..ta-action + %+ action-phrase + [[%& our.bol nom] ~ ~] + [%lin | u.mes]~ + (ta-unconfig nom) :: ++ action-depict ::< change description ::> change description of story {nom} to {des}. @@ -377,19 +378,18 @@ %- (affect nom) |= {sor/_so *} =< so-done (so-permit:sor inv sis) :: - ++ action-delete ::< delete + announce - ::> delete story {nom}, optionally announcing the - ::> event with message {mes}. + ++ action-source ::< un/sub p to/from r + ::> add/remove {pas} as sources for story {nom}. :: - |= {nom/knot mes/(unit cord)} + |= {nom/knot sub/? pas/(set partner)} ^+ ..ta-action - %- (affect nom) |= * - =. ..ta-action ::TODO =? - ?~ mes ..ta-action - %+ action-phrase - [[%& our.bol nom] ~ ~] - [%lin | u.mes]~ - (ta-unconfig nom) + %- (affect nom) |= {sor/_so soy/story} + =. src.shape.soy + %. pas + ?: sub + ~(uni in src.shape.soy) + ~(dif in src.shape.soy) + (ta-config nom shape.soy) :: ++ action-enlist ::< dis/allow federation ::> adds {sis} to story {nom}'s list of allowed diff --git a/sur/talk.hoon b/sur/talk.hoon index a6a223d26e..c8d47cd07d 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -12,10 +12,10 @@ ++ action ::> user action $% :: circle configuration :: {$create nom/knot des/cord sec/security} ::< create circle - {$source nom/knot sub/? src/(set partner)} ::< un/sub p to/from r + {$delete nom/knot ano/(unit cord)} ::< delete + announce {$depict nom/knot des/cord} ::< change description {$permit nom/knot inv/? sis/(set ship)} ::< invite/banish - {$delete nom/knot ano/(unit cord)} ::< delete + announce + {$source nom/knot sub/? src/(set partner)} ::< un/sub to/from src {$enlist nom/knot fed/? sis/(set ship)} ::< dis/allow federation {$burden circle} ::< help federate :: messaging :: From 661dcf5100d43d7f6b573d0f65c614868d4e6330 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 3 May 2017 18:39:23 +0200 Subject: [PATCH 095/303] Renamed ++so-report-group to -crowd to match report and type renaming. --- app/talk-guardian.hoon | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 09bd34f0de..9c37be51c6 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -561,7 +561,7 @@ =^ who +>.$ (ta-human her) :: send current data to bring her up to date. =. soy (so-report-lobby:soy ost.bol ~ ~) - =. soy (so-report-group:soy ost.bol ~ ~) + =. soy (so-report-crowd:soy ost.bol ~ ~) =. soy (so-start:soy her t.pax) ::< also adds story sub =. soy (so-notify:soy her %hear who) ::< add her status so-done:soy ::< apply story changes @@ -965,7 +965,7 @@ =. +> $(bos r.bos) (so-sauce n.bos [%diff %talk-report ret]~) :: - ++ so-report-group ::< presence update + ++ so-report-crowd ::< presence update ::> send local and remote presences in a report. :: |= bos/(set bone) @@ -1091,7 +1091,7 @@ ~ `[c f] :: send updates to followers. - =. +>.$ (so-report-group so-followers) + =. +>.$ (so-report-crowd so-followers) =. +>.$ (so-report-lobby so-followers) :: finally, learn all grams. (so-lesson gaz) @@ -1201,7 +1201,7 @@ =+ o=(~(get by remotes) p) ?~(o a (~(dif in a) u.o)) :: subscriber update. - (so-report-group(locals loc.nep, remotes rem.nep) so-followers) + (so-report-crowd(locals loc.nep, remotes rem.nep) so-followers) :: ::> || ::> || %changes @@ -1246,7 +1246,7 @@ =/ nol (~(put by locals) her sat) ?: =(nol locals) +>.$ =. +>.$ (so-inform %precs (strap her sat) ~) - (so-report-group(locals nol) so-followers) + (so-report-crowd(locals nol) so-followers) :: ::> || ::> || %subscriptions From 165b94872ea0ccb2e472c720506ef113057fd5cf Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 9 May 2017 16:57:35 +0200 Subject: [PATCH 096/303] Talk-agent can now properly render messages that are longer than 64 characters. It no longer forcibly splits up messages to fit that width. --- app/talk-agent.hoon | 200 +++++++++++++++++++++----------------------- 1 file changed, 95 insertions(+), 105 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index b6697fee5f..64901e29df 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -96,6 +96,7 @@ == :: ++ where (set partner) ::< non-empty audience ++ glyphs `wall`~[">=+-" "}),." "\"'`^" "$%&@"] ::< circle char pool ' + ++ termwidth 80 ::TODO put in setting or something? -- :: ::> || @@ -690,49 +691,6 @@ == -- :: - ++ sh-sane-chat ::< sanitize chatter - ::> (for chat messages) sanitizes the input buffer - ::> and splits it into multiple lines (by '•'). - :: - |= buf/(list @c) - ^- (list sole-edit) - ?~ buf ~ - =+ isa==(i.buf (turf '@')) - =+ [[pre=*@c cur=i.buf buf=t.buf] inx=0 brk=0 len=0 new=|] - =* txt -< - |^ ^- (list sole-edit) - ?: =(cur (turf '•')) - ?: =(pre (turf '•')) - [[%del inx] ?~(buf ~ $(txt +.txt))] - ?: new - [(fix ' ') $(cur `@c`' ')] - newline - ?: =(cur `@`' ') - =. brk ?:(=(pre `@`' ') brk inx) - ?. =(64 len) advance - :- (fix(inx brk) (turf '•')) - ?: isa - [[%ins +(brk) (turf '@')] newline(new &)] - newline(new &) - ?: =(64 len) - =+ dif=(sub inx brk) - ?: (lth dif 64) - :- (fix(inx brk) (turf '•')) - ?: isa - [[%ins +(brk) (turf '@')] $(len dif, new &)] - $(len dif, new &) - [[%ins inx (turf '•')] $(len 0, inx +(inx), new &)] - ?: |((lth cur 32) (gth cur 126)) - [(fix '?') advance] - ?: &((gte cur 'A') (lte cur 'Z')) - [(fix (add 32 cur)) advance] - advance - :: - ++ advance ?~(buf ~ $(len +(len), inx +(inx), txt +.txt)) - ++ newline ?~(buf ~ $(len 0, inx +(inx), txt +.txt)) - ++ fix |=(cha/@ [%mor [%del inx] [%ins inx `@c`cha] ~]) - -- - :: ++ sh-sane ::< sanitize input ::> parses cli prompt input using ++sh-read and ::> sanitizes when invalid. @@ -750,13 +708,6 @@ :: $target ?~(q.wok ~ $(wok u.q.wok)) - :: - $say - |- :: XX per line - ?~ p.wok ~ - ?: ?=($lin -.i.p.wok) - (sh-sane-chat buf) - $(p.wok t.p.wok) == :: ++ sh-slug ::< edit to sanity @@ -1414,13 +1365,18 @@ =+ por=~(ar-prom ar q.rew) (weld `tape`[p.p.rew por] `tape`[q.p.rew ' ' ~]) :: - ++ sh-rend ::< print on one line - ::> renders a telegram as a single line, adds it - ::> as a console move. + ++ sh-rend ::< print telegram + ::> prints a telegram as rendered by ++tr-rend. :: |= gam/telegram - =+ lin=~(tr-line tr settings.she gam) - (sh-fact %txt lin) + ^+ +> + =+ lis=~(tr-rend tr settings.she gam) + ?~ lis +>.$ + %+ sh-fact %mor + ::TODO? we need to cast, but not if we do =(0 (lent lis)) above instead.. + %+ turn `(list tape)`lis + |= t/tape + [%txt t] :: ++ sh-numb ::< print msg number ::> prints a message number, left-padded by heps. @@ -1892,27 +1848,34 @@ ^- sole-effect ~[%mor [%tan tr-meta] tr-body] :: - ++ tr-line ::< one-line print - ::> crams a telegram into a single line by - ::> displaying a short ship name, a short - ::> representation of the gram, and an optional - ::> timestamp. + ++ tr-rend ::< render telegram + ::> renders a telegram. + ::> the first line will contain the author and + ::> optional timestamp. :: - ^- tape - =+ txt=(tr-text =(who our.bol)) - ?: =(~ txt) "" - =/ baw - :: ?: oug - :: ~(ar-whom ar tr-pals) - ?. (~(has in sef) %noob) - (~(cr-curt cr [who (main who)]) |) - (~(cr-nick cr [who (main who)])) - ?: (~(has in sef) %showtime) + ^- (list tape) + =/ wyd + %+ sub termwidth :: 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) %noob) + (~(cr-nick cr [who (main who)])) + (~(cr-curt cr [who (main who)]) |) + :: regular indent. + =/ den/tape + (reap (lent nom) ' ') + :: timestamp, if desired. + =/ tam/tape + ?. (~(has in sef) %showtime) "" =+ dat=(yore now.bol) =/ t |= a/@ %+ weld - ?: (lth a 10) "0" ~ + ?:((lth a 10) "0" ~) (scow %ud a) =/ time ;: weld @@ -1920,8 +1883,14 @@ "." (t m.t.dat) "." (t s.t.dat) == - :(weld baw txt (reap (sub 67 (lent txt)) ' ') time) - (weld baw txt) + %+ weld + (reap (sub +(wyd) (min wyd (lent 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 @@ -2019,49 +1988,54 @@ |- ?~ txt txt ?: =(' ' i.txt) - |-(['_' ?.(?=({$' ' *} t.txt) t.txt $(txt t.txt))]) + |- + :- '_' + ?. ?=({$' ' *} t.txt) + t.txt + $(txt t.txt) ?~ t.txt "…" [i.txt $(txt t.txt)] :: - ++ tr-both ::< two tapes one line - ::> attempts to fit two tapes into a 64-char line. + ++ tr-text ::< compact contents + ::> renders just the most important data of the + ::> message. if possible, these stay within a single + ::> line. :: - |= {a/tape b/tape} - ^- tape - ?: (gth (lent a) 62) (tr-chow 64 a) - %+ weld a - (tr-chow (sub 64 (lent a)) " {b}") - :: - ++ tr-text ::< one line contents - ::> renders a single-line version of the message. - :: - |= oug/? - ^- tape + |= wyd/@ud + ^- (list tape) ?+ -.sep - ~&(tr-lost+sep "") + ~&(tr-lost+sep ~) :: $mor - ?~ ses.sep ~&(%tr-mor-empty "") - |- ^- tape + ?~ ses.sep ~&(%tr-mor-empty ~) + |- ^- (list tape) ?~ t.ses.sep ^$(sep i.ses.sep) - (tr-both ^$(sep i.ses.sep) $(ses.sep t.ses.sep)) + (weld ^$(sep i.ses.sep) $(ses.sep t.ses.sep)) :: $fat - %+ tr-both $(sep sep.sep) - ?+ -.tac.sep "..." - $tank ~(ram re %rose [" " `~] +.tac.sep) + %+ weld $(sep sep.sep) + ^- (list tape) + ?+ -.tac.sep ["attached: ..." ~] + $name ["attached: {(trip nom.tac.sep)}" ~] == :: $exp - (tr-chow 66 '#' ' ' (trip exp.sep)) + ::TODO separate expr and res in the speech type, + :: then print both on their own line. (still 64) + :_ ~ + (tr-chow wyd '#' ' ' (trip exp.sep)) :: $url + :_ ~ =+ ful=(earf url.sep) - ?: (gth 64 (lent ful)) ['/' ' ' ful] + =. wyd (sub wyd 2) :: account for prefix. + :: if the full url fits, just render it. + ?: (gte wyd (lent ful)) ['/' ' ' ful] + :: if it doesn't, prefix with _ and render just (the tail of) the domain. :+ '/' '_' =+ hok=r.p.p.url.sep ~! hok - =- (swag [a=(sub (max 64 (lent -)) 64) b=64] -) + =- (swag [a=(sub (max wyd (lent -)) wyd) b=wyd] -) ^- tape =< ?: ?=($& -.hok) (reel p.hok .) @@ -2071,15 +2045,29 @@ (welp b '.' (trip a)) :: $lin + :: glyph prefix + =/ pef + ?. pat.sep " " + %~ ar-pref ar + =+ pal=tr-pals + ?: =(who our.bol) pal + (~(del in pal) [%& who (main who)]) + == + =. wyd (sub wyd (lent pef)) =+ txt=(trip msg.sep) - ?: pat.sep - =+ pal=tr-pals - =. pal ?: =(who our.bol) pal ::TODO =? - (~(del in pal) [%& who (main who)]) - (weld ~(ar-pref ar pal) txt) - (weld " " txt) + |- ^- (list tape) + ?~ txt ~ + =/ end + ?: (lte (lent txt) wyd) (lent txt) + =+ ace=(find " " (flop (scag +(wyd) `tape`txt))) + ?~ ace wyd + (sub wyd u.ace) + :- (weld pef (scag end `tape`txt)) + $(txt (slag +(end) `tape`txt), pef (reap (lent pef) ' ')) ::TODO why do we need to cast? :: $inv + :_ ~ + %+ tr-chow wyd %+ weld ?: inv.sep " invited you to " @@ -2087,10 +2075,12 @@ ~(cr-phat cr cir.sep) :: $app - (tr-chow 64 "[{(trip app.sep)}]: {(trip msg.sep)}") + :_ ~ + (tr-chow wyd "[{(trip app.sep)}]: {(trip msg.sep)}") :: $api - %+ tr-chow 64 + :_ ~ + %+ tr-chow wyd %+ weld "[{(trip id.sep)}@{(trip service.sep)}]: " (trip summary.sep) From 076f3a0ac417fe4d6f59127eb7e448cd84bed829 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 9 May 2017 21:43:42 +0200 Subject: [PATCH 097/303] Message sanitization is now configurable on a per-story level. Story configuration includes a filter for specifying sanitization rules: dis/allowing capitals and non-ASCII characters. The agent does not care about these rules, and just sends its message. If more limiting rules becomes available, the agent might want to adjust its message parsing according to the active audience. --- app/talk-agent.hoon | 17 ++++++++++- app/talk-guardian.hoon | 69 +++++++++++++++++++++++++++--------------- sur/talk.hoon | 6 ++++ 3 files changed, 67 insertions(+), 25 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 64901e29df..0f25910057 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -71,6 +71,7 @@ {$create p/security q/knot r/cord} ::< create circle {$delete p/knot q/(unit cord)} ::< delete circle {$depict p/knot q/cord} ::< change description + {$filter p/knot q/? r/?} ::< change message rules {$invite p/knot q/(set ship)} ::< give permission {$banish p/knot q/(set ship)} ::< deny permission {$source p/knot q/(set partner)} ::< add source @@ -578,6 +579,12 @@ (cold %brown (jest %mailbox)) == :: + ++ lobe ::< y/n loob + ;~ pose + (cold %& ;~(pose (jest 'y') (jest '&'))) + (cold %| ;~(pose (jest 'n') (jest '|'))) + == + :: ++ message ::< exp, lin or url msg ;~ pose ;~(plug (cold %eval hax) expr) @@ -592,7 +599,7 @@ == :: ++ nick (cook crip (stun [1 14] low)) ::< nickname - ++ text (cook crip (plus (shim ' ' '~'))) ::< bullets separating + ++ text (cook crip (plus next)) ::< bullets separating ++ glyph (mask "/\\\{( banish {sis} from our circle {nom}. :: diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 9c37be51c6..d9f837c186 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -302,6 +302,7 @@ $create (action-create +.act) $source (action-source +.act) $depict (action-depict +.act) + $filter (action-filter +.act) $permit (action-permit +.act) $delete (action-delete +.act) $enlist (action-enlist +.act) @@ -342,6 +343,7 @@ %+ ta-config nom :* [[%& our.bol nom] ~ ~] des + [| |] [typ ~] [[our.bol ~ ~] [our.bol ~ ~]] == @@ -370,6 +372,16 @@ =. cap.shape.soy des (ta-config nom shape.soy) :: + ++ action-filter ::< change message rules + ::> replaces the story's current filter with the + ::> specified one. + :: + |= {nom/knot fit/filter} + ^+ ..ta-action + %- (affect nom) |= {sor/_so soy/story} + =. fit.shape.soy fit + (ta-config nom shape.soy) + :: ++ action-permit ::< invite/banish ::> invite to/banish from story {nom} all {sis}. :: @@ -754,32 +766,10 @@ ?~ tos +> $(tos t.tos, +> (ta-consume pub aut i.tos)) :: - ++ ta-sane ::< sanitize - ::> sanitize %lin speech, enforce lowercase and no special characters. - ::TODO make configurable per-circle. - :: - |= tot/thought - ^- thought - ?. ?=({$lin *} sep.sam.tot) tot - %_ tot - msg.sep.sam - %- crip - %+ scag 64 - %- tufa - %+ turn (tuba (trip msg.sep.sam.tot)) - |= a/@c - ?: &((gte a 'A') (lte a 'Z')) - (add a 32) - ?: |((lth a 32) (gth a 126)) - `@`'?' - a - == - :: ++ ta-consume ::< to each audience ::> conducts thought {tot} to each partner in its audience. :: |= {pub/? aut/ship tot/thought} - =. tot (ta-sane tot) =+ aud=(~(tap by aud.tot)) |- ^+ +>.^$ ?~ aud +>.^$ @@ -1401,6 +1391,35 @@ ::> arms for adding to this story's messages. ::+| :: + ++ so-sane ::< sanitize + ::> sanitize %lin speech according to our settings. + :: + |= tot/thought + ^- thought + ?. ?=({$lin *} sep.sam.tot) tot + %_ tot + msg.sep.sam + %- crip + %- tufa + %+ turn (tuba (trip msg.sep.sam.tot)) + |= a/@c + :: always replace control characters. + ?: |((lth a 32) =(a `@c`127)) + `@`'?' + :: if desired, remove uppercasing. + ?: ?& !cus.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-refresh ::< update to listeners ::> called when messages get added or changed. ::> calculates the changes and sends them to all @@ -1451,8 +1470,10 @@ :: |= gam/telegram ^+ +> - ?. (so-admire aut.gam) ::< write permissions - +>.$ + :: check for write permissions. + ?. (so-admire aut.gam) +>.$ + :: clean up the message to conform to our rules. + =. tot.gam (so-sane tot.gam) =. aud.tot.gam ::> if we are in the audience, mark as received. =+ ole=(~(get by aud.tot.gam) [%& our.bol nom]) diff --git a/sur/talk.hoon b/sur/talk.hoon index c8d47cd07d..6cc24c8929 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -14,6 +14,7 @@ {$create nom/knot des/cord sec/security} ::< create circle {$delete nom/knot ano/(unit cord)} ::< delete + announce {$depict nom/knot des/cord} ::< change description + {$filter nom/knot fit/filter} ::< change message rules {$permit nom/knot inv/? sis/(set ship)} ::< invite/banish {$source nom/knot sub/? src/(set partner)} ::< un/sub to/from src {$enlist nom/knot fed/? sis/(set ship)} ::< dis/allow federation @@ -84,9 +85,14 @@ ++ config ::> circle config $: src/(set partner) ::< pulls from cap/cord ::< description + fit/filter ::< message rules con/control ::< restrictions fed/federal ::< federators == :: +++ filter ::> content filters + $: cus/? ::< dis/allow capitals + utf/? ::< dis/allow non-ascii + == :: ++ control {sec/security ses/(set ship)} ::< access control ++ security ::> security kind $? $black ::< channel, blacklist From 23cd3ad7586a857d0c92b6f1c8651bb7fed3f81f Mon Sep 17 00:00:00 2001 From: Fang Date: Sat, 13 May 2017 00:05:49 +0200 Subject: [PATCH 098/303] Newly updated in-between commit for delta-model talk. tmp --- app/talk-agent.hoon | 39 + app/talk-guardian.hoon | 1818 ++++++++++++++++++++++------------------ lib/talk.hoon | 113 ++- sur/talk.hoon | 87 +- 4 files changed, 1225 insertions(+), 832 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 0f25910057..a6a93b50c4 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -224,6 +224,37 @@ ^+ +> sh-done:(~(sh-reaction sh cli) rac) :: + ++ ta-change ::< apply change + ::> + :: + |= dif/delta + ^+ +> + ?+ -.dif + ~& [%ignoring-delta -.dif] + +> + :: + $mor + |- ^+ +>.^$ + ?~ mor.dif +>.^$ + $(+>.^$ ^$(dif i.mor.dif), mor.dif t.mor.dif) + :: + $cir + (ta-change-circle +.dif) + == + :: + ++ ta-change-circle ::< apply circle change + ::> + :: + |= {cir/circle dif/delta-circle} + ^+ +> + ?+ -.dif + ~& [%ignoring-delta-circle -.dif] + +> + :: + $put + (ta-low-grams count.cli gaz.dif) + == + :: ++ ta-low ::< apply lowdown ::> processes a talk lowdown :: @@ -2120,6 +2151,14 @@ [~ +>] ta-done:ta-console:ta :: +++ diff-talk-delta ::< accept change + ::> + ::TODO ++feel + :: + |= {way/wire dif/delta} + ^- (quip move +>) + ta-done:(ta-change:ta dif) +:: ++ diff-talk-lowdown ::< accept lowdown ::> incoming talk-lowdown. process it. ::> we *could* use the wire to identify what story diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index d9f837c186..0e0e1a3f30 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -2,24 +2,20 @@ :::: /hoon/talk/app :: :: :: :: :: :: +::TODO rename to hall ::TODO master changes ::TODO char57 comments as line comments when regarding code. ::TODO avoid lark where possible ::TODO document what user-facing messages actually mean! +::TODO maybe have brokers accept reactions as well, redirect them to readers. +:: that way we can have foreign brokers react to our requests! ::TODO ::> to :> etc. :: ::TODO we can't do away with the default mailbox because we need it for things :: like invite notifications etc. can we do better than request that apps :: don't use it frivolously? :: -::TODO ".. the importance of the CQRS pattern (command-query separation) behind -:: Urbit's separation of %poke and %peer. Pokes (messages) are one-way -:: commands, not queries. Peers (subscriptions) have no effect on the -:: server state." -:: but we *do* change state on-subscribe! is that a problem? -:: ::TODO crash on pokes/peers we do not expect -::TODO keep both a folks and nicks maps. (actual profiles and local nicknames.) :: /? 151 ::< hoon version /- talk ::< structures @@ -36,11 +32,10 @@ :: |% ++ state ::> broker state - $: stories/(map knot story) ::< convercirions - readers/(map bone (set knot)) ::< our message readers + $: stories/(map knot story) ::< conversations outbox/(pair @ud (map @ud thought)) ::< urbit outbox log/(map knot @ud) ::< logged to clay - folks/(map ship human) ::< human identities + nicks/(map ship knot) ::< nicknames nik/(map (set partner) char) ::< bound circle glyphs nak/(jug char (set partner)) ::< circle glyph lookup == :: @@ -54,7 +49,6 @@ ::TODO never gets updated. :: sequence/(map partner @ud) ::< partners heard known/(map serial @ud) ::< messages heard - followers/(map bone river) ::< subscribers == :: ++ river (pair point point) ::< stream definition ++ point ::> stream endpoint @@ -63,8 +57,8 @@ == :: ++ move (pair bone card) ::< all actions ++ lime ::> diff fruit - $% {$talk-report report} :: - {$talk-lowdown lowdown} :: + $% {$talk-prize prize} :: + {$talk-rumor rumor} :: {$talk-reaction reaction} :: == :: ++ pear ::> poke fruit @@ -99,6 +93,7 @@ |= old/(unit state) ^- (quip move ..prep) ?~ old + %- f-bake :- %more ta-done:ta-init:ta [~ ..prep(+<+ u.old)] :: @@ -117,27 +112,25 @@ ::+| :: ++ ta ::< per transaction - ::> for every transaction/event (poke, peer, etc.) - ::> talk-guardian receives, the ++ta transaction core - ::> is called. - ::> in processing transactions, ++ta may modify app - ::> state, or create moves. these moves get produced - ::> upon finalizing the core's work with ++ta-done. - ::> when making changes to stories, the ++so core is - ::> used. + ::> thinker core, used for processing pokes into + ::> deltas. :: + ::TODO maybe rewrite all arms to produce (list delta) + :: instead of state? or nah? |_ ::> moves: moves created by core operations. :: - moves/(list move) + deltas/(list delta) :: ++ ta-done ::< resolve core ::> produces the moves stored in ++ta's moves. ::> they are produced in reverse order because ::> ++ta-emil and ++ta-emit add them to the head of ::> the {moves}. + ::> we don't produce any new state, because ++ta + ::> doesn't make any changes to it itself. :: - ^- (quip move +>) - [(flop moves) +>] + ^- (list delta) + (flop deltas) :: ::> || ::> || %emitters @@ -145,34 +138,18 @@ ::> arms that create outward changes. ::+| :: - ++ ta-emil ::< emit move list - ::> adds multiple moves to the head of {moves}. - ::> flops to stay consistent with ++ta-emit. + ++ ta-delta ::< emit a delta + ::> adds a delta to the head of {deltas}. :: - |= mol/(list move) - %_(+> moves (welp (flop mol) moves)) + |= dif/delta + %_(+> deltas [dif deltas]) :: - ++ ta-emit ::< emit a move - ::> adds a move to the head of {moves}. + ++ ta-deltas ::< emit delta list + ::> adds multiple deltas to the haad of {deltas}. + ::> flops to stay consistent with ++ta-delta. :: - |= mov/move - %_(+> moves [mov moves]) - :: - ++ ta-inform ::< broadcast lowdown - ::> sends a talk-lowdown diff to all readers. - :: - |= low/lowdown - %- ta-emil - %- ~(rep by readers) - |= {{b/bone *} l/(list move)} - [[b %diff %talk-lowdown low] l] - :: - ++ ta-react ::< send reaction - ::> sends a talk-reaction diff to a reader. - :: - |= {red/bone rac/reaction} - %- ta-emit - [red %diff %talk-reaction rac] + |= dis/(list delta) + %_(+> deltas (welp (flop dis) deltas)) :: ++ ta-note ::< tell user ::> sends {msg} as an %app message to the user's @@ -196,6 +173,9 @@ ::> utility functions for data retrieval. ::+| :: + ::TODO functions for getting readers or followers of a specific story from + :: the subs in sup.bol. + :: ++ ta-know ::< story monad ::> produces a gill that takes a gate. ::> if the story {nom} exists, calls the gate with @@ -211,18 +191,6 @@ (crip "unknown story '{(trip nom)}'") (fun ~(. so nom ~ u.pur)) :: - ++ ta-human ::< look up person - ::> get {her} identity. if we need to, create one. - :: - |= her/ship - ^- (quid human +>) - =^ who folks - =+ who=(~(get by folks) her) - ?^ who [u.who folks] - =+ who=`human`[~ `(scot %p her)] :: XX do right - [who (~(put by folks) her who)] - [who +>.$] - :: ::> || ::> || %interaction-events ::> || @@ -281,6 +249,7 @@ ++ ta-action ::< apply reader action ::> performs action sent by a reader. :: + ::delta-generation |= {red/bone act/action} ^+ +> =< work @@ -297,6 +266,8 @@ ::+| ++ work ::< perform action ^+ ..ta-action + ::TODO %. +.act + ::TODO require deltas as product? ?- -.act :: circle configuration $create (action-create +.act) @@ -313,25 +284,31 @@ :: personal metadata $status (action-status +.act) :: changing shared ui - $human (action-human +.act) $glyph (action-glyph +.act) + $nick (action-nick +.act) == :: - ++ affect ::< affect story - ::> produces a gill that takes a gate. - ::> if the story {nom} exists, calls the gate with - ::> a story core and the story itself. - ::> if it doesn't, reacts accordingly. + ++ react ::< new reaction + ::> :: - |= nom/knot - |= fec/$-({_so story} _ta) - ^+ ta - =+ pur=(~(get by stories) nom) - ?^ pur - (fec ~(. so nom ~ u.pur) u.pur) - %+ ta-react red + |= rac/reaction + (ta-delta %react red rac) + :: + ++ affect ::< delta to story + ::> + :: + |= {nom/knot dif/diff-story} + ?: (~(has by stories) nom) + (impact nom dif) + %- react [%fail (crip "no story {(trip nom)}") `act] :: + ++ impact ::< delta for story + ::> + :: + |= {nom/knot dif/diff-story} + (ta-delta %story nom dif) + :: ::> || %circle-configuration ::+| ++ action-create ::< create story @@ -340,14 +317,15 @@ |= {nom/knot des/cord typ/security} ^+ ..ta-action ?. (~(has in stories) nom) - %+ ta-config nom + %^ impact nom %new :* [[%& our.bol nom] ~ ~] des [| |] [typ ~] [[our.bol ~ ~] [our.bol ~ ~]] == - (ta-react red %fail (crip "{(trip nom)}: already exists") `act) + %- react + [%fail (crip "{(trip nom)}: already exists") `act] :: ++ action-delete ::< delete + announce ::> delete story {nom}, optionally announcing the @@ -355,99 +333,84 @@ :: |= {nom/knot mes/(unit cord)} ^+ ..ta-action - %- (affect nom) |= * =. ..ta-action ::TODO =? ?~ mes ..ta-action %+ action-phrase [[%& our.bol nom] ~ ~] [%lin | u.mes]~ - (ta-unconfig nom) + (affect nom %remove ~) :: ++ action-depict ::< change description ::> change description of story {nom} to {des}. :: - |= {nom/knot des/cord} - ^+ ..ta-action - %- (affect nom) |= {sor/_so soy/story} - =. cap.shape.soy des - (ta-config nom shape.soy) + |= {nom/knot 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. :: |= {nom/knot fit/filter} - ^+ ..ta-action - %- (affect nom) |= {sor/_so soy/story} - =. fit.shape.soy fit - (ta-config nom shape.soy) + (affect nom %config [our.bol nom] %filter fit) :: ++ action-permit ::< invite/banish ::> invite to/banish from story {nom} all {sis}. :: |= {nom/knot inv/? sis/(set ship)} - ^+ ..ta-action - %- (affect nom) |= {sor/_so *} =< so-done - (so-permit:sor inv sis) + =+ soy=(~(get by stories) nom) + ?~ soy + %^ ta-delta %react red + [%fail (crip "no story {(trip nom)}") `act] + =/ wyt/? ?=(?($white $green) sec.con.shape.u.soy) + =/ add/? =(inv wyt) + (affect nom %config [our.bol nom] %permit add sis) :: ++ action-source ::< un/sub p to/from r ::> add/remove {pas} as sources for story {nom}. :: |= {nom/knot sub/? pas/(set partner)} - ^+ ..ta-action - %- (affect nom) |= {sor/_so soy/story} - =. src.shape.soy - %. pas - ?: sub - ~(uni in src.shape.soy) - ~(dif in src.shape.soy) - (ta-config nom shape.soy) + (affect nom %config [our.bol nom] %source sub pas) :: ++ action-enlist ::< dis/allow federation ::> adds {sis} to story {nom}'s list of allowed ::> federators. :: |= {nom/knot fed/? sis/(set ship)} - ^+ ..ta-action - %- (affect nom) |= {sor/_so soy/story} - ::TODO maybe so-enlist, with message note and everything - =. may.fed.shape.soy - %. sis - ?: fed - ~(uni in may.fed.shape.soy) - ~(dif in may.fed.shape.soy) - (ta-config nom shape.soy) + (affect nom %config [our.bol nom] %federal fed | sis) :: ++ action-burden ::< help federate ::> starts federating the specified circle. create ::> it locally if it doesn't yet exist. :: + ::TODO make deltas instead. + ::TODO ...but we'll still need to broadcast this move??? |= {hos/ship nom/knot} ^+ ..ta-action :: update federation config. - =+ soy=(fall (~(get by stories) nom) *story) - =. may.fed.shape.soy - (~(put in may.fed.shape.soy) hos) - =. fes.fed.shape.soy - (~(put in fes.fed.shape.soy) hos) - =. src.shape.soy - (~(put in src.shape.soy) [%& hos nom]) - =. ..ta-action - (ta-config nom shape.soy) + :: we don't use the specialized so-arms for this because followers will + :: get notified once we receive updates from {hos} anyway. + =+ new=(~(has by stories) nom) + =. ..ta-action ::TODO =? + ?. new ..ta-action + %^ impact nom %new + :* [[%& hos nom] ~ ~] + *cord + *filter + *control + [[hos ~ ~] [hos ~ ~]] + == + =. ..ta-action ::TODO =? + ?: new ..ta-action + (affect nom %config [our.bol nom] %federal & | [hos ~ ~]) + =. ..ta-action ::TODO =? + ?: new ..ta-action + (affect nom %config [our.bol nom] %federal & & [hos ~ ~]) + ::TODO shouldn't src-adding be included in %fed & & application? + =. ..ta-action ::TODO =? + ?: new ..ta-action + (affect nom %config [our.bol nom] %source & [[%& hos nom] ~ ~]) :: send %burden command with story's current state. - %- ta-emit - :* ost.bol - %poke - /burden - [hos %talk-guardian] - :* %talk-command - %burden - nom - [shape.soy mirrors.soy] - [locals.soy remotes.soy] - grams.soy - == - == + (ta-delta %bear [hos nom]) :: ::> || %messaging ::+| @@ -455,7 +418,6 @@ ::> sends the messages provided in the action. :: |= tos/(list thought) - ^+ ..ta-action (ta-think & our.bol tos) :: ++ action-phrase ::< post easy @@ -480,62 +442,35 @@ ::+| ++ action-status ::< our status update ::> for every story in the set, update our status. + ::TODO accept (set circle). for locals, do directly. + :: for remotes, send command. + ::TODO split interface into action-presence and + :: action-human. :: |= {nos/(set knot) sat/status} ^+ ..ta-action %- ~(rep in nos) |= {k/knot _ta} - %- (affect k) |= {sor/_so *} - so-done:(so-notify:sor our.bol sat) + (affect k %status [%& our.bol k] our.bol %full sat) :: ::> || %changing-shared-ui ::+| - ++ action-human ::< new identity + ++ action-nick ::< new identity ::> assigns a new local identity ("nickname") to the ::> target ship. :: - |= {sip/ship nic/human} + |= {who/ship nic/cord} ^+ ..ta-action - ?. =((~(get by folks) sip) `nic) ..ta-action ::< no change - =. folks - ?~ han.nic (~(del by folks) sip) - (~(put by folks) sip nic) - %+ ta-inform %names - ::TODO think long and hard, do we need unit for delition or is a human - :: with [~ ~] good enough? if the latter, agent's $names will change. - (strap sip ?~(han.nic ~ `nic)) + ?. =((~(get by nicks) who) `nic) ..ta-action ::< no change + (ta-delta %nick who nic) :: ++ action-glyph ::< bind a glyph ::> un/bind glyph {lif} to partners {pas}. :: |= {lif/char pas/(set partner) bin/?} - =. ..ta-action - ?: bin - %= ..ta-action ::< bind - nik (~(put by nik) pas lif) - nak (~(put ju nak) lif pas) - == - =/ ole/(set (set partner)) ::< unbind - ?. =(pas ~) [pas ~ ~] - (~(get ju nak) lif) - |- ^+ ..ta-action - ?~ ole ..ta-action - =. ..ta-action $(ole l.ole) - =. ..ta-action $(ole r.ole) - %= ..ta-action - nik (~(del by nik) pas) - nak (~(del ju nak) lif pas) - == - (ta-inform %glyph nak) + (ta-delta %glyph bin lif pas) -- :: - ++ ta-diff-report ::< subscription update - ::> process a talk report from {cir} into story {nom}. - :: - |= {nom/knot cir/circle ret/report} - %- (ta-know nom) |= sor/_so =< so-done - (so-diff-report:sor cir ret) - :: ::> || ::> || %subscription-events ::> || @@ -543,93 +478,23 @@ ::+| :: ++ ta-subscribe ::< listen to - ::> start {her} susbcription on {pax}. - ::> for readers, we forward to ++ta-welcome. - ::> for foreign brokers, we check if their desired - ::> story exists and if they have permission to - ::> subscribe to it, before sending them all data. + ::> add her to a presence list if applicable. :: |= {her/ship pax/path} ^+ +> - :: reader subscription. - ?: ?=({$reader *} pax) - ?. (team our.bol her) - %- ta-note - (crip "foreign reader {(scow %p her)}") - (ta-welcome ost.bol t.pax) :: weird subscription path. - ?. ?=({@ *} pax) - (ta-evil %bad-path) - =+ pur=(~(get by stories) i.pax) - ?~ pur - ::TODO send this to the subscriber! make them unsub! - %- ta-note - (crip "bad subscribe story '{(trip i.pax)}'") - =+ soy=~(. so i.pax `(list action)`~ u.pur) :: nest-fail if no cast - :: she needs read permissions to subscribe. - ?. (so-visible:soy her) - (ta-evil %no-story) - ::TODO? or (so-sauce ost.bol [%quit ~]~) ? - =^ who +>.$ (ta-human her) - :: send current data to bring her up to date. - =. soy (so-report-lobby:soy ost.bol ~ ~) - =. soy (so-report-crowd:soy ost.bol ~ ~) - =. soy (so-start:soy her t.pax) ::< also adds story sub - =. soy (so-notify:soy her %hear who) ::< add her status - so-done:soy ::< apply story changes + ::TODO catch earlier, just pass nom instead of path? + :: also check story existence earlier maybe? + ?. ?=({$circle @ta *} pax) +> + %- (ta-know i.pax) |= sor/_so =< so-done + (so-attend:sor her %hear [~ ~]) :: - ++ ta-welcome ::< reader subscription - ::> brings new reader up to date. susbcribes it to the specified story, - ::TODO or shared ui state if no story was specified. - ::TODO maybe also send a list of knots again? (basically a %house lowdown) - :: - |= {new/bone pax/path} - =/ sor/knot - ?: ?=({@tas *} pax) i.pax - (main our.bol) :: default to mailbox - ::> new reader? send shared ui state. - =. +>.$ ::TODO =? - ?: (~(has by readers) new) +>.$ - %- ta-emil - :~ ::> bound glyphs - [new %diff %talk-lowdown %glyph nak] - ::> nicknames - [new %diff %talk-lowdown %names (~(run by folks) some)] - == - ::> send story state. - =. +>.$ ::TODO =? - ?. (~(has by stories) sor) +>.$ - =+ soy=(~(got by stories) sor) - %- ta-emil - :~ ::> configurations - :* new %diff %talk-lowdown %confs - `shape.soy (~(run by mirrors.soy) some) - == - ::> presences - [new %diff %talk-lowdown %precs locals.soy remotes.soy] - ::> messages - [new %diff %talk-lowdown %grams 0 grams.soy] - == - ::> add this subscription to {readers}. - %= +>.$ - readers - %+ ~(put by readers) new - (~(put in (fall (~(get by readers) new) ~)) sor) - == - :: - ++ ta-retry ::< subscription resend - ::> re-subscribes {cir} to story {nom}. - :: - |= {nom/knot cir/circle} - %- (ta-know nom) |= sor/_so =< so-done - (so-acquire:sor [%& cir]~) - :: - ++ ta-quit ::< subscription failed + ++ ta-leave ::< subscription failed ::> removes {cir} from story {nom}'s followers. :: |= {nom/knot cir/circle} %- (ta-know nom) |= sor/_so =< so-done - (so-quit:sor %& cir) + (so-leave:sor %& cir) :: ++ ta-cancel ::< unsubscribe ::> drops {src}'s subscription. deduce the right way @@ -637,119 +502,25 @@ :: |= {src/ship pax/path} ^+ +> - :: remove a reader subscription. - ?: ?=({$reader *} pax) - =/ nom/knot - ?: ?=({@tas *} t.pax) i.pax - (main our.bol) ::TODO change when ++ta-welcome changes. - =/ nes/(set knot) - %. nom - ~(del in (~(got by readers) ost.bol)) - +>.$(readers (~(put by readers) ost.bol nes)) - :: weird subscription path. - ?. ?=({@ @ *} pax) - %- ta-note - (crip "ta-cancel weird path {~(ram re >pax<)}") - :: remove a regular subscription, set ship status to %gone. + ::TODO catch earlier, just pass nom? + ?. ?=({$circle @ta *} pax) +> + :: set ship status to %gone. %- (ta-know i.pax) |= sor/_so =< so-done - (so-notify:so-cancel:sor src %gone *human) + (so-absent:sor src) :: - ::> || %fora - ::> fora things. - ::TODO move outside of guardian... - ::+| - :: - ++ ta-base-hart - ::x produces our ship's host desk's web address as a hart. + ++ ta-hear ::< apply rumor + ::> :: - .^(hart %e /(scot %p our.bol)/host/(scot %da now.bol)) - :: - ++ ta-fora-post - ::x sends a fora post. if we don't have a channel for posts yet, create one - :: - |= {pax/path sup/spur hed/@t txt/@t} - ::x tell %hood to submit a fora post. - =. ..ta-emit - %+ ta-emit ost.bol - :* %poke - /fora-post - [our.bol %hood] - [%write-fora-post sup src.bol hed txt] - == - =+ man=%posts - ::x if we have a %posts story, go ahead and consume. - ?: (~(has by stories) man) - (ta-consume-fora-post man pax hed txt) - ::x if we have no %posts story, first create it, then consume. - =; new (ta-consume-fora-post:new man pax hed txt) - =. ..ta-action - %+ ta-action ost.bol - [%create man 'towards a community' %brown] - ::x send informative message to our mailbox. - %^ ta-consume & our.bol - :^ (shaf %init eny.bol) ::< serial - (my [[%& our.bol (main our.bol)] *envelope %pending] ~) ::< audience - ::> statement - now.bol - [~ %app %tree 'receiving forum posts, ;join %posts for details'] - :: - ++ ta-consume-fora-post - ::x add a message for a fora post to the man story. - :: - |= {man/knot pax/path hed/@t txt/@t} ^+ +> - =. pax (welp pax /posts/(crip "{}~")) - %^ ta-consume | - src.bol - :* (shaf %comt eny.bol) - (my [[%& our.bol man] *envelope %pending] ~) - now.bol - (sy /fora-post eyre+pax ~) - :- %mor :~ - [%fat text+(lore txt) [%url [ta-base-hart `pax ~] ~]] - [%app %tree (crip "forum post: '{(trip hed)}'")] - == - == - :: - ++ ta-comment - ::x sends a comment. if we don't have a channel for them yet, creates one. - :: - |= {pax/path sup/spur txt/@t} - =. ..ta-emit - %+ ta-emit ost.bol - :* %poke - /comment - [our.bol %hood] - [%write-comment sup src.bol txt] - == - =+ man=%comments - ?: (~(has by stories) man) - (ta-consume-comment man pax sup txt) - =; new (ta-consume-comment:new man pax sup txt) - =. ..ta-action - %+ ta-action ost.bol - [%create man 'letters to the editor' %brown] - %^ ta-consume & our.bol - :^ (shaf %init eny.bol) - (my [[%& our.bol (main our.bol)] *envelope %pending] ~) - now.bol - [~ %app %tree 'receiving comments, ;join %comments for details'] - :: - ++ ta-consume-comment - ::x adds a message for a comment to the man story. - :: - |= {man/knot pax/path sup/spur txt/@t} ^+ +> - =+ nam=?~(sup "" (trip i.sup)) :: file name - =+ fra=(crip (time-to-id now.bol)) :: url fragment - %^ ta-consume | - src.bol - :* (shaf %comt eny.bol) - (my [[%& our.bol man] *envelope %pending] ~) - now.bol - (sy /comment eyre+pax ~) - :- %mor :~ - [%fat text+(lore txt) [%url [ta-base-hart `pax ~] `fra]] - [%app %tree (crip "comment on /{nam}")] - == + |= {det/knot src/partner dif/rumor} + ^+ +> + ?+ -.dif + ~&([%ignoring-rumor -.dif] +>) + :: + $circle + ?. ?=($& -.src) + ~&([%unexpected-rumor -.dif src] +>) + %- (ta-know det) |= sor/_so =< so-done + (so-hear-circle:sor p.src dif.dif) == :: ::> || @@ -809,38 +580,7 @@ :: |= {cir/circle tot/thought} ^+ +> - =. +> - %+ ta-emit ost.bol - :* %poke - /repeat/(scot %ud p.outbox)/(scot %p hos.cir)/[nom.cir] - [hos.cir %talk-guardian] - [%talk-command [%review tot ~]] - == - +>(p.outbox +(p.outbox), q.outbox (~(put by q.outbox) p.outbox tot)) - :: - ++ ta-coup-repeat ::< remove from outbox - ::> assemble partner and call ++ta-repeat. - :: - |= {{num/@ud src/ship nom/knot} fal/(unit tang)} - (ta-repeat num [%& src nom] fal) - :: - ++ ta-repeat ::< remove from outbox - ::> take message out of outbox, mark it as received - ::> or rejected, based on the existence of error - ::> message {fal}. - :: - |= {num/@ud pan/partner fal/(unit tang)} - =+ oot=(~(get by q.outbox) num) - ?~ oot ~|([%ta-repeat-none num] !!) - =. q.outbox (~(del by q.outbox) num) - =. aud.u.oot - =+ olg=(~(got by aud.u.oot) pan) - %+ ~(put by aud.u.oot) pan - :- -.olg - ?~ fal %received - ~> %slog.[0 u.fal] - %rejected - (ta-think | our.bol u.oot ~) + (ta-delta %out cir tot ~) :: ::> || ::> || %stories @@ -848,32 +588,6 @@ ::> arms for modifying stories. ::+| :: - ++ ta-config ::< configure story - ::> configures story {nom}, creating it if needed. - ::> if it's a whitelist config, and we're creating - ::> the story, makes sure we're in it. - :: - |= {nom/knot con/config} - ^+ +> - ::> neu: is new story - ::> pur: the story - ::> wyt: will be white - =+ :+ neu=!(~(has by stories) nom) - pur=(fall (~(get by stories) nom) *story) - wyt=?=(?($white $green) sec.con.con) - =. ses.con.con ::TODO =? - ?: &(neu wyt) [our.bol ~ ~] - ses.con.con - so-done:(~(so-reform so nom ~ pur) con) - :: - ++ ta-unconfig ::< delete story - ::> calls the story core to delete story {nom}. - :: - |= nom/knot - ^+ +> - %- (ta-know nom) |= sor/_so =< so-done - so-reform-gone:so - :: ++ so ::< story core ::> story core, used for doing work on a story. :: @@ -891,7 +605,9 @@ ::> actions. :: ^+ +> - =. +> +>(stories (~(put by stories) nom +<+>)) + ::?: =(`+<+> (~(get by stories) nom)) + :: ::TODO tmp + :: ~&(%illegal-change-story !!) =. acs (flop acs) |- ^+ +>+ ?~ acs +>+ @@ -904,15 +620,6 @@ ::> arms that create outward changes. ::+| :: - ++ so-sauce ::< send backward - ::> cards to moves, prepend to {moves} reversed. - :: - |= {ost/bone cub/(list card)} - %_ +>.$ - moves - (welp (flop (turn cub |=(a/card [ost a]))) moves) - == - :: ++ so-act ::< send action ::> stores a talk action. :: @@ -930,42 +637,19 @@ :- [[%& our.bol (main our.bol)] ~ ~] [%app %talk-guardian msg]~ :: - ++ so-inform ::< send lowdown - ::> sends lowdown to all interested readers. + ++ so-delta ::< send delta + ::> :: - |= low/lowdown - =. moves - %+ weld - ^- (list move) - %+ murn (~(tap by readers)) - |= {b/bone s/(set knot)} - ^- (unit move) - ?. (~(has in s) nom) ~ - `[b %diff %talk-lowdown low] - moves - +>.$ - :: - ++ so-report ::< send update - ::> sends report to all bones. - :: - |= {bos/(set bone) ret/report} + |= dif/delta ^+ +> - ?~ bos +> - =. +> $(bos l.bos) - =. +> $(bos r.bos) - (so-sauce n.bos [%diff %talk-report ret]~) + +>(deltas [dif deltas]) :: - ++ so-report-crowd ::< presence update - ::> send local and remote presences in a report. + ++ so-delta-our ::< send delta of us + ::> adds a delta about this story. :: - |= bos/(set bone) - (so-report bos %crowd locals so-remotes) - :: - ++ so-report-lobby ::< config update - ::> send local and remote configs in a report. - :: - |= bos/(set bone) - (so-report bos %lobby shape mirrors) + |= dif/diff-story + ^+ +> + (so-delta %story nom dif) :: ::> || ::> || %data @@ -973,42 +657,8 @@ ::> utility functions for data retrieval. ::+| :: - ++ so-followers ::< follower bones - ::> turns the keys of {followers} into a set. - :: - ^- (set bone) - %- ~(gas in *(set bone)) - %+ turn (~(tap by followers)) - |= {b/bone *} b - :: - ++ so-unearth ::< ships' bones - ::> find the bones in {followers} that belong to - ::> a ship in {sis}. - :: - |= sis/(set ship) - ^- (set bone) - %- ~(rep in sup.bol) - |= {{b/bone s/ship p/path} c/(set bone)} - ?. ?& (~(has in sis) s) - (~(has by followers) b) - ?=({@tas *} p) - =(i.p nom) - == - c - (~(put in c) b) - :: - ++ so-remotes ::< remote presences - ::> produces {remotes}, with all our local - ::> presences replaced by the versions from their - ::> stories. - :: - %- ~(urn by remotes) :: XX performance - |= {pan/partner gop/group} - ^- group - ?. &(?=($& -.pan) =(our.bol hos.p.pan)) gop - =+ soy=(~(get by stories) nom.p.pan) - ?~ soy gop - locals.u.soy + ++ so-pan [%& our.bol nom] ::< us as partner + ++ so-cir [our.bol nom] ::< us as circle :: ++ so-right ::< is federator? ::> checks whether partner {pan} has authority @@ -1026,6 +676,29 @@ ::> arms that apply events we received. ::+| :: + ++ so-hear-circle ::< accept circle rumor + ::> + :: + |= {src/circle dif/diff-story} + ^+ +> + ?. (~(has in src.shape) [%& src]) + ~&([%unexpected-rumor -.dif src] +>) + :: rumor from federator? apply to us. + =. src ::TODO =? + ?: (so-right [%& src]) so-cir + src + ?- -.dif + $new $(dif [%config src %full con.dif]) + $grams (so-lesson gaz.dif) + $config :: ignore foreign mirrors. + ?. |(=(src cir.dif) =(src so-cir)) +> + (so-delta-our dif) + $status :: ignore foreign remotes. + ?. |(=([%& src] pan.dif) =(src so-cir)) +> + (so-delta-our dif) + $remove (so-delta-our %config src %remove ~) + == + :: ++ so-burden ::< accept federator ::> if {src} is allowed to, have it federate this ::> story. @@ -1052,37 +725,38 @@ (~(put in fes.fed.nec) src) =. src.nec (~(put in src.nec) [%& src nom]) - (so-reform nec) + ::TODO maybe do more granular deltas later. + (so-delta-our %config so-cir %full nec) :: assimilate presence and remotes. - =. locals (~(uni by loc.pes) locals) - =. remotes (~(uni by rem.pes) remotes) - =. mirrors (~(uni by rem.cof) mirrors) - :: remove redundant remotes. - =. remotes - %- ~(gas by *_remotes) - %+ murn (~(tap by remotes)) - |= {p/partner g/group} - ^- (unit {partner group}) - ?: ?& ?=($& -.p) - =(nom.p.p nom) - (~(has in fes.fed.shape) hos.p.p) - == - ~ - `[p g] - :: remove redundant mirrors. - =. mirrors - %- ~(gas by *_mirrors) - %+ murn (~(tap by mirrors)) - |= {c/circle f/config} - ^- (unit {circle config}) - ?: ?& =(nom.c nom) - (~(has in fes.fed.shape) hos.c) - == - ~ - `[c f] - :: send updates to followers. - =. +>.$ (so-report-crowd so-followers) - =. +>.$ (so-report-lobby so-followers) + ::TODO!!! just delta my shit up famalam. + ::TODO should totally just make an arm that calculates deltas given + :: old and new inputs. + ::=. locals (~(uni by loc.pes) locals) + ::=. remotes (~(uni by rem.pes) remotes) + ::=. mirrors (~(uni by rem.cof) mirrors) + :::: remove redundant remotes. + ::=. remotes + :: %- ~(gas by *_remotes) + :: %+ murn (~(tap by remotes)) + :: |= {p/partner g/group} + :: ^- (unit {partner group}) + :: ?: ?& ?=($& -.p) + :: =(nom.p.p nom) + :: (~(has in fes.fed.shape) hos.p.p) + :: == + :: ~ + :: `[p g] + :::: remove redundant mirrors. + ::=. mirrors + :: %- ~(gas by *_mirrors) + :: %+ murn (~(tap by mirrors)) + :: |= {c/circle f/config} + :: ^- (unit {circle config}) + :: ?: ?& =(nom.c nom) + :: (~(has in fes.fed.shape) hos.c) + :: == + :: ~ + :: `[c f] :: finally, learn all grams. (so-lesson gaz) :: @@ -1093,105 +767,15 @@ |= {src/ship who/(set ship)} ^+ +> ?. (~(has in fes.fed.shape) src) +> - =+ nes=shape - =. fes.fed.nes - (~(dif in fes.fed.nes) who) - =. src.nes - %- ~(dif in src.nes) - ^- (set partner) - %- ~(run in who) - |=(s/ship [%& s nom]) - ?: =(nes shape) +>.$ - ::TODO propogate %relief to other federators. - (so-reform nes) - :: - ++ so-diff-report ::< process update - ::> process a talk report from {cir}. - ::> if we didn't expect it, ignore. - :: - |= {cir/circle ret/report} - ^+ +> - ?: =(cir [our.bol nom]) +> - ?. (~(has in src.shape) [%& cir]) - %- so-note - %- crip ;: weld - "so-diff unexpected " - (scow %p hos.cir) "/" (trip nom.cir) - " %" (scow %tas -.ret) - " in " (scow %tas nom) - == - ?- -.ret - $lobby (so-lobby cir +.ret) - $crowd (so-remind [%& cir] +.ret) - $grams (so-lesson gaz.ret) - == - :: - ++ so-lobby ::< update config - ::> add circle's config to our remote config map. - :: - ::TODO when do we care about rem? - |= {cir/circle con/config rem/(map circle config)} - ^+ +> - :: if they're a federator, set new shape. - =. +> ::TODO =? - ?. ?& =(nom nom.cir) - (~(has in fes.fed.shape) hos.cir) - == - +> - :: to prevent removal of federators during initial setup, only allow - :: federator deletion through explicit action. - =. fes.fed.con (~(uni in fes.fed.con) fes.fed.shape) - =. may.fed.con (~(uni in may.fed.con) may.fed.shape) - =. src.con ::TODO is this needed? - %- ~(uni in src.con) - ^- (set partner) - %- ~(run in fes.fed.con) - |= s/ship - ^- partner - [%& s nom] - (so-reform con) - =+ old=mirrors - =. mirrors (~(put by mirrors) cir con) - ?: =(mirrors old) +>.$ - =. +>.$ (so-inform %confs `shape (strap cir `con)) - (so-report-lobby so-followers) - :: - ++ so-remind ::< remote presence - ::> adds {tay}'s {loc} to our remote presence map, - ::> after merging with {rem}. - ::> if this changes anything, send a report. - :: - |= {pan/partner loc/group rem/(map partner group)} - :: if they're a federator, set new locals. - =/ buk (~(uni by remotes) rem) - =. buk (~(put by buk) pan loc) - :: seperate federation presences and true remotes. - =/ nep/crowd - %+ roll (~(tap by buk)) - |= {{p/partner g/group} c/crowd} - ?: (so-right p) - [(~(uni by loc.c) g) rem.c] - [loc.c (~(put by rem.c) p g)] - :: ensure we have the latest. - =. loc.nep - ?. (so-right pan) (~(uni by locals) loc.nep) - (~(uni by (~(uni by locals) loc.nep)) loc) - :: if nothing changed, we're done. - ?: ?& =(loc.nep locals) - =(rem.nep remotes) - == - +>.$ - :: reader update. - =. +>.$ ::TODO =? - %^ so-inform %precs - (~(dif in loc.nep) locals) :: locals - :: per-partner diff for remotes. - %- ~(urn by rem.nep) - |= {p/partner a/group} - =+ o=(~(get by remotes) p) - ?~(o a (~(dif in a) u.o)) - :: subscriber update. - (so-report-crowd(locals loc.nep, remotes rem.nep) so-followers) + =+ wos=(~(uni in fes.fed.shape) who) + ?~ wos +>.$ + =. +>.$ + (so-delta-our %config so-cir %federal | & wos) + %- so-delta-our + :+ %config so-cir + :+ %source | + %- ~(run in `(set ship)`wos) ::TODO? why need to cast? + |=(s/ship [%& s nom]) :: ::> || ::> || %changes @@ -1199,44 +783,76 @@ ::> arms that make miscelaneous changes to this story. ::+| :: - ++ so-reform ::< reconfigure - ::> changes the config of this story and notify - ::> our followers. - ::> subscribes to new sources, unsubs from removed - ::> ones. + ++ so-sources ::< change source + ::> adds or removes {pas} from our sources. :: - |= cof/config - ?: =(cof shape) +> - =. +>.$ (so-inform %confs `cof ~) - =/ dif/(pair (list partner) (list partner)) - =+ old=`(list partner)`(~(tap in src.shape) ~) - =+ new=`(list partner)`(~(tap in src.cof) ~) - :- (skip new |=(a/partner (~(has in src.shape) a))) - (skip old |=(a/partner (~(has in src.cof) a))) - =. +>.$ (so-acquire p.dif) - =. +>.$ (so-abjure q.dif) - =. shape cof - (so-report-lobby so-followers) + |= {add/? pas/(set partner)} + ^+ +> + =/ sus/(set partner) + %. src.shape + ?:(add ~(dif in pas) ~(int in pas)) + ?~ sus +>.$ + (so-delta-our %config so-cir %source add sus) :: - ++ so-reform-gone ::< delete story + ++ so-depict ::< change description + ::> modifies our caption. + :: + |= cap/cord + ^+ +> + ?: =(cap cap.shape) +> + (so-delta-our %config so-cir %caption cap) + :: + ++ so-filter ::< change message rules + ::> modifies our filter. + :: + |= fit/filter + ^+ +> + ?: =(fit fit.shape) +> + (so-delta-our %config so-cir %filter fit) + :: + ++ so-federate ::< change federators + ::> adds or removes sis as active/allow + ::> ({fed} y/n) federators. + :: + |= {add/? fed/? sis/(set ship)} + =+ ses=?:(fed fes.fed.shape may.fed.shape) + =/ sus/(set ship) + %. ses + ?:(add ~(dif in sis) ~(int in sis)) + ?~ sus +>.$ + :: we also take care of the %src delta because we + :: want to keep delta application as simple as + :: possible. + =. +>.$ ::TODO =? + ?. fed +>.$ + %- so-delta-our + :+ %config so-cir + :+ %source add + %- ~(run in `(set ship)`sus) ::TODO weird casting need, depends on ?~ + |= s/ship [%& s nom] + (so-delta-our %config so-cir %federal add fed sus) + :: + ++ so-delete ::< delete story ::> deletes this story. removes it from {stories} ::> and unsubscribes from all src. :: - =. stories (~(del by stories) nom) - =. . (so-inform %confs ~ ~) - =. . (so-report-lobby so-followers) - (so-abjure (~(tap in src.shape))) + (so-delta-our %remove ~) :: - ++ so-notify ::< local presence + ++ so-attend ::< add local presence ::> add {her} status to this story's presence map. - ::> if this changes it, send a report. :: |= {her/ship sat/status} ^+ +> - =/ nol (~(put by locals) her sat) - ?: =(nol locals) +>.$ - =. +>.$ (so-inform %precs (strap her sat) ~) - (so-report-crowd(locals nol) so-followers) + ?: =(`sat (~(get by locals) her)) +>.$ + (so-delta-our %status so-pan her %full sat) + :: + ++ so-absent ::< del local presence + ::> + :: + |= her/ship + ^+ +> + ?. (~(has by locals) her) +> + (so-delta-our %status so-pan her %remove ~) :: ::> || ::> || %subscriptions @@ -1244,64 +860,13 @@ ::> arms for starting and ending subscriptions ::+| :: - ++ so-acquire ::< subscribe us - ::> subscribes this story to each partner. - :: - |= pas/(list partner) - %+ so-sauce 0 :: subscription is caused by this app - %- zing - %+ turn pas - |= pan/partner - ^- (list card) - ::> subscribe starting at the last message we got, - ::> or if we haven't gotten any yet, messages - ::> from up to a day ago. - =+ num=(~(get by sequence) pan) - =+ old=(sub now.bol ~d1) :: XX full backlog - =+ ini=?^(num (scot %ud u.num) (scot %da old)) - ?- -.pan - $| !! ::< passport partner - :: - $& ::< circle partner - :_ ~ - :* %peer - /friend/show/[nom]/(scot %p hos.p.pan)/[nom.p.pan] - [hos.p.pan %talk-guardian] - /[nom.p.pan]/[ini] - == - == - :: - ++ so-abjure ::< unsubscribe us - ::> unsubscribes this story from each partner. - :: - |= pas/(list partner) - %+ so-sauce 0 :: subscription is caused by this app - %- zing - %+ turn pas - |= pan/partner - ^- (list card) - ?- -.pan - $| !! ::< passport partner - :: - $& ::< circle partner - :_ ~ - :* %pull - /friend/show/[nom]/(scot %p hos.p.pan)/[nom.p.pan] - [hos.p.pan %talk-guardian] - ~ - == - == - :: - ++ so-quit ::< subscription failed - ::> delete {pan} from our subscriptions, then send - ::> an updated capal report. + ++ so-leave ::< unsub from source + ::> delete {pan} from our sources. :: |= pan/partner ^+ +> ?. (~(has in src.shape) pan) +> - =. src.shape (~(del in src.shape) pan) - =. +> (so-inform %confs `shape ~) - (so-report-lobby so-followers) + (so-delta-our %config so-cir %source | [pan ~ ~]) :: ++ so-start ::< subscribe follower ::> called upon subscribe. deduces the range of @@ -1312,8 +877,7 @@ ^+ +> :: read permissions ?. (so-visible her) - =. +> - (so-sauce ost.bol [%quit ~]~) + =. +> (so-delta %quit ost.bol) %- so-note %- crip "so-start permission denied {(scow %p her)}" :: find grams range @@ -1332,8 +896,7 @@ ~ `[[?+(- . $ud .)]:i.paf [?+(- . $ud .)]:i.t.paf] ::XX arvo issue #366 ?~ ruv - =. +>.$ - (so-sauce ost.bol [%quit ~]~) + =. +>.$ (so-delta %quit ost.bol) %- so-note %- crip "so-start malformed path {~(ram re >pax<)}" (so-first-grams u.ruv) @@ -1345,11 +908,8 @@ |= riv/river ^+ +> =; lab/{dun/? end/@u zeg/(list telegram)} - =. +>.$ - (so-sauce ost.bol [[%diff %talk-report %grams end.lab zeg.lab] ~]) - ?: dun.lab - (so-sauce ost.bol [[%quit ~] ~]) - +>.$(followers (~(put by followers) ost.bol riv)) + ?. dun.lab +>.$ + (so-delta %quit ost.bol) =+ [end=count gaz=grams dun=| zeg=*(list telegram)] |- ^- (trel ? @ud (list telegram)) ?~ gaz [dun end zeg] @@ -1368,23 +928,6 @@ :: if in the river, add this gram and continue. $(end (dec end), gaz t.gaz, zeg [i.gaz zeg]) :: - ++ so-cancel ::< unsubscribe follower - ::> removes {ost.bol} from our followers. - :: - .(followers (~(del by followers) ost.bol)) - :: - ++ so-eject ::< unsubscribe ships - ::> removes ships {sis} from {followers}. - :: - |= sis/(set ship) - %= +> - followers - %- ~(rep in (so-unearth sis)) - |= {b/bone f/_followers} - =. f ?~(f followers f) ::TODO =? - (~(del by f) b) - == - :: ::> || ::> || %messaging ::> || @@ -1420,42 +963,6 @@ a == :: - ++ so-refresh ::< update to listeners - ::> called when messages get added or changed. - ::> calculates the changes and sends them to all - ::> followers. - ::> any followers that are no longer interested - ::> get removed. - :: - |= {num/@ud gam/telegram} - ^+ +> - ::> notify the interested readers. - =. +> (so-inform %grams num gam ~) - ::> notify only the followers who are currently interested. - =/ moy - ^- (pair (list bone) (list move)) - %- ~(rep in followers) - |= {f/(pair bone river) r/(pair (list bone) (list move))} - :: after the end: unsubscribe - ?: ?- -.q.q.f - $ud (lte p.q.q.f num) - $da (lte p.q.q.f wen.sam.tot.gam) - == - [[p.f p.r] [[p.f %quit ~] q.r]] - :: before the start: ignore - ?: ?- -.p.q.f - $ud (gth p.p.q.f num) - $da (gth p.p.q.f wen.sam.tot.gam) - == - r - :: in the river: send gram - :- p.r - [[p.f %diff %talk-report %grams num gam ~] q.r] - =. moves (welp q.moy moves) - |- ^+ +>.^$ - ?~ p.moy +>.^$ - $(p.moy t.p.moy, followers (~(del by followers) i.p.moy)) - :: ++ so-lesson ::< learn messages ::> learn all telegrams in a list. :: @@ -1487,36 +994,7 @@ ::> as described above, fake src into our. =. aud.tot.gam (~(del by aud.tot.gam) [%& src.bol nom]) (~(put by aud.tot.gam) [%& our.bol nom] -.u.ole %received) - =+ old=(~(get by known) uid.tot.gam) - ?~ old - (so-append gam) ::< add - (so-revise u.old gam) ::< modify - :: - ++ so-append ::< append message - ::> add gram to our story, send report to subs. - :: - |= gam/telegram - ^+ +> - %+ %= so-refresh - grams [gam grams] - count +(count) - known (~(put by known) uid.tot.gam count) - == - count - gam - :: - ++ so-revise ::< revise message - ::> modify gram in our story, send report to subs. - :: - |= {num/@ud gam/telegram} - ::> dex: index in grams list to insert message at. - =+ dex=(sub count num) - ?: =(gam (snag (dec dex) grams)) +>.$ ::< no change - =. grams - %+ welp - (scag (dec dex) grams) - [gam (slag dex grams)] - (so-refresh num gam) + (so-delta-our %grams [gam ~]) :: ::> || ::> || %permissions @@ -1524,6 +1002,14 @@ ::> arms relating to story permissions. ::+| :: + ++ so-secure ::< change security mode + ::> changes our security mode. + :: + |= sec/security + ^+ +> + ?: =(sec sec.con.shape) +> + (so-delta-our %config so-cir %secure sec) + :: ++ so-permit ::< invite/banish ::> update config to dis/allow ships permission. :: @@ -1533,24 +1019,14 @@ ::> add: add to list? =/ wyt/? ?=(?($white $green) sec.con.shape) =/ add/? =(inv wyt) - =. +>.$ ::TODO =? - ?: inv +>.$ - (so-eject sis) =. +>.$ %- so-act :- %phrase %- ~(rep in sis) |= {s/ship a/(set partner) t/(list speech)} :- (~(put in a) [%& s (main s)]) - [[%inv inv [our.bol nom]] t] - %- so-reform - %= shape - ses.con - %. sis - ?: add - ~(uni in ses.con.shape) - ~(dif in ses.con.shape) - == + [[%inv inv so-cir] t] + (so-delta-our %config so-cir %permit [add sis]) :: ++ so-admire ::< accept from ::> checks {her} write permissions. @@ -1578,6 +1054,528 @@ -- -- :: +++ 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 moves. those get + ::> produced when finalizing with ++da-done. + :: + |_ ::> moves: moves created by core operations. + :: + moves/(list move) + :: + ++ da-done ::< resolve core + ::> produces the moves stored in ++da's moves. + ::> they are produced in reverse order because + ::> ++da-emil and ++da-emit add them to the head of + ::> the {moves}. + :: + ^- (quip move +>) + [(flop moves) +>] + :: + ::> || + ::> || %emitters + ::> || + ::> arms that create outward changes. + ::+| + :: + ++ da-emil ::< emit move list + ::> adds multiple moves to the head of {moves}. + ::> flops to stay consistent with ++ta-emit. + :: + |= mol/(list move) + %_(+> moves (welp (flop mol) moves)) + :: + ++ da-emit ::< emit a move + ::> adds a move to the head of {moves}. + :: + |= mov/move + %_(+> moves [mov moves]) + :: + ++ da-react ::< send reaction + ::> sends a talk-reaction diff to a reader. + :: + ::TODO send the delta instead! (remove bone from delta: always ost.bol?) + |= {red/bone rac/reaction} + %- da-emit + ::TODO is diff the way to react to a poke? + [red %diff %talk-reaction rac] + :: + ++ da-bear ::< share burden + ::> + :: + |= cir/circle + =+ soy=(~(got by stories) nom.cir) + %- da-emit + :* ost.bol + %poke + /burden + [hos.cir %talk-guardian] + :* %talk-command + %burden + nom.cir + [shape.soy mirrors.soy] + [locals.soy remotes.soy] + grams.soy + == + == + :: + ::> || + ::> || %data + ::> || + ::> utility functions for data retrieval. + ::+| + :: + ::TODO functions for getting readers or followers of a specific story from + :: the subs in sup.bol. + :: but maybe just on the outer core... + :: + ::> || + ::> || %change-application + ::> || + ::> arms that change the application state. + ::+| + :: + ++ da-change ::< apply delta + ::> modifies application state according to the + ::> change specified in {dif}. + :: + |= dif/delta + ^+ +> + ?- -.dif + $more + |- ^+ +>.^$ + ?~ mor.dif +>.^$ + $(+>.^$ ^$(dif i.mor.dif), mor.dif t.mor.dif) + :: + $out (da-change-out +.dif) + $done (da-change-done (~(tap by don.dif))) + $glyph (da-change-glyph +.dif) + $nick (da-change-nick +.dif) + $story (da-change-story +.dif) + $bear (da-bear +.dif) + $react (da-react +.dif) + $quit (da-emit [ost.dif %quit ~]) + == + :: + ++ da-change-out ::< outgoing messages + ::> + :: + |= {cir/circle out/(list thought)} + ^+ +> + ?~ out +> + =. +> + %+ da-emit ost.bol + :* %poke + /repeat/(scot %ud p.outbox)/(scot %p hos.cir)/[nom.cir] + [hos.cir %talk-guardian] + [%talk-command %review i.out ~] + == + $(p.outbox +(p.outbox), q.outbox (~(put by q.outbox) p.outbox i.out)) + :: + ++ da-change-done ::< sent & receives msgs + ::> + :: + |= don/(list {num/@ud who/partner gud/?}) + ^+ +> + ?~ don +> + =+ oot=(~(get by q.outbox) num.i.don) + ?~ oot ~|([%da-change-done-none num.i.don] !!) + =. aud.u.oot + =+ olg=(~(got by aud.u.oot) who.i.don) + %+ ~(put by aud.u.oot) who.i.don + :- -.olg + ?:(gud.i.don %received %rejected) + =. +>.$ + +>.$ ::TODO!!! da-think?????????? + $(q.outbox (~(del by q.outbox) num.i.don)) + ::|= {num/@ud pan/partner fal/(unit tang)} + ::=+ oot=(~(get by q.outbox) num) + ::?~ oot ~|([%ta-repeat-none num] !!) + ::=. q.outbox (~(del by q.outbox) num) + ::=. aud.u.oot + :: =+ olg=(~(got by aud.u.oot) pan) + :: %+ ~(put by aud.u.oot) pan + :: :- -.olg + :: ?~ fal %received + :: ~> %slog.[0 u.fal] + :: %rejected + ::(ta-think | our.bol u.oot ~) + :: + ++ da-change-glyph ::< un/bound glyph + ::> + :: + |= {bin/? gyf/char pas/(set partner)} + ^+ +> + ?: bin + %_ +> + nik (~(put by nik) pas gyf) + nak (~(put ju nak) gyf pas) + == + =/ ole/(list (set partner)) + ?. =(pas ~) [pas ~] + (~(tap in (~(get ju nak) gyf))) + |- ^+ +>.^$ + ?~ ole +>.^$ + %_ $ + nik (~(del by nik) i.ole) + nak (~(del ju nak) gyf i.ole) + ole t.ole + == + :: + ++ da-change-nick ::< changed nickname + ::> + :: + |= {who/ship nic/cord} + ^+ +> + ?: =('' nic) + $(nicks (~(del by nicks) who)) + $(nicks (~(put by nicks) who nic)) + :: + ::> || + ::> || %stories + ::> || + ::> arms for modifying stories. + ::+| + :: + ++ da-change-story ::< apply circle delta + ::> + :: + |= {nom/knot dif/diff-story} + ^+ +> + ::TODO just ~(got by stories) everywhere in ++da, the + :: relevant checks should be made when constructing + :: the deltas. + ?+ -.dif + sa-done:(~(sa-change sa nom (~(got by stories) nom)) dif) + :: + $new (da-create nom +.dif) + $remove (da-delete nom) + == + :: + ++ da-create ::< configure story + ::> creates story {nom} with config {con}. + :: + |= {nom/knot con/config} + ^+ +> + :: if it's a whitelisted circle, put us in it. + =. ses.con.con ::TODO =? + ?: ?=(?($white $green) sec.con.con) + [our.bol ~ ~] + ses.con.con + :: also ensure we're listed as a federator. + =. may.fed.con + (~(put in may.fed.con) our.bol) + =. fes.fed.con + (~(put in fes.fed.con) our.bol) + =< sa-done + %- ~(sa-change sa nom *story) + [%config [our.bol nom] %full con] + :: + ++ da-delete ::< delete story + ::> calls the story core to delete story {nom}. + :: + |= nom/knot + ^+ +> + =. +> + %- 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. + :: + |_ ::> nom: story name in {stories}. + ::> story is faceless to ease data access. + :: + $: nom/knot + story + == + :: + ++ 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 move list + ::> adds multiple moves to the head of {moves}. + ::> flops to stay consistent with ++ta-emit. + :: + |= mol/(list move) + %_(+> moves (welp (flop mol) moves)) + :: + ++ sa-emit ::< emit a move + ::> adds a move to the head of {moves}. + :: + |= mov/move + %_(+> moves [mov moves]) + :: + ++ sa-sauce ::< play cards + ::> cards to moves. + :: + |= {ost/bone cub/(list card)} + ^- (list move) + (flop (turn cub |=(a/card [ost a]))) + :: + ::> || + ::> || %delta-application + ::> || + ::> arms for applying deltas. + ::+| + :: + ++ sa-delete ::< deletion of story + ::> + :: + (sa-abjure (~(tap in src.shape))) + :: + ++ sa-change ::< apply circle delta + ::> + ::> we don't do checks for federation here, this + ::> should have happened during delta generation. + :: + |= dif/diff-story + ^+ +> + %. dif + ?+ -.dif + sa-change-local + :: + $config + ?: =(cir.dif [our.bol nom]) + sa-change-local + sa-change-remote + :: + $status + ?: =(pan.dif [%& our.bol nom]) + sa-change-local + sa-change-remote + == + :: + ++ sa-change-local ::< apply our delta + ::> + :: + |= dif/diff-story + ^+ +> + ?+ -.dif + ~&([%unexpected-delta-local -.dif] !!) + :: + $grams + |- ^+ +>.^$ + ?~ gaz.dif +>.^$ + =. +>.^$ (sa-change-grams i.gaz.dif) + $(gaz.dif t.gaz.dif) + :: + $config + =. +> + %- sa-emil + (sa-config-effects shape dif.dif) + +>(shape (change-config shape dif.dif)) + :: + $status + %_ +> + locals + %+ ~(put by locals) who.dif + %+ change-status + (fall (~(get by locals) who.dif) *status) + dif.dif + == + == + :: + ++ sa-change-grams ::< save/update message + ::> + :: + |= gam/telegram + ^+ +> + =+ old=(~(get by known) uid.tot.gam) + ?~ old + :: new message + %_ +>.$ + grams [gam grams] + count +(count) + known (~(put by known) uid.tot.gam count) + == + :: changed message + =+ dex=(sub count u.old) + %_ +>.$ + grams %+ welp + (scag (dec dex) grams) + [gam (slag dex grams)] + == + :: + ++ sa-change-remote ::< apply remote's delta + ::> + :: + |= dif/diff-story + ^+ +> + ?+ -.dif + ~&([%unexpected-delta-remote -.dif] !!) + :: + $config + ?: ?=($remove -.dif.dif) + +>(mirrors (~(del by mirrors) cir.dif)) + =/ new/config + %+ change-config + (fall (~(get by mirrors) cir.dif) *config) + dif.dif + +>.$(mirrors (~(put by mirrors) cir.dif new)) + :: + $status + %_ +>.$ + remotes + %+ ~(put by remotes) pan.dif + =+ ole=(fall (~(get by remotes) pan.dif) *group) + ?: ?=($remove -.dif.dif) (~(del by ole) who.dif) + =+ old=(fall (~(get by ole) who.dif) *status) + (~(put by ole) who.dif (change-status old dif.dif)) + == + == + :: + ++ sa-config-effects ::< config side-effects + ::> + :: + |= {old/config dif/diff-config} + ^- (list move) + ?+ -.dif ~ + $source (sa-source-effects src.old +.dif) + $permit (sa-permit-effects sec.con.old ses.con.old +.dif) + :: + $federal + ?. fed.dif ~ + %^ sa-source-effects src.old add.dif + %- ~(run in sis.dif) + |= s/ship [%& s nom] + :: + $full + =* new cof.dif + :: deal with subscription changes. + =/ sem + .= ?=(?($white $green) sec.con.new) + ?=(?($white $green) sec.con.old) + ;: weld + (sa-source-effects src.old | (~(dif in src.old) src.new)) + (sa-source-effects src.old & (~(dif in src.new) src.old)) + ?. sem ~ + %^ sa-permit-effects sec.con.new ses.con.old + [| (~(dif in ses.con.old) ses.con.new)] + ?. sem ~ + %^ sa-permit-effects sec.con.new ses.con.old + [& (~(dif in ses.con.new) ses.con.old)] + ::TODO maybe do federal source changes, but also take above source + :: changes into account: don't do doubles! + == + == + :: + ++ sa-source-effects ::< un/subscribe + ::> + :: + |= {old/(set partner) add/? pas/(set partner)} + ^- (list move) + =/ sus/(set partner) + %. old + ?:(add ~(dif in pas) ~(int in pas)) + %. (~(tap in `(set partner)`sus)) ::TODO *need* to cast? + ?:(add sa-acquire sa-abjure) + :: + ++ sa-permit-effects ::< notify permitted + ::> + :: + |= {sec/security old/(set ship) add/? sis/(set ship)} + ^- (list move) + =/ wyt ?=(?($white $green) sec) + =/ inv =(wyt add) + ?: inv + ::TODO %inv & speeches + ~ + ::TODO %inv | speeches + (sa-eject sis) + :: + ::> || + ::> || %subscriptions + ::> || + ::> arms for starting and ending subscriptions + ::+| + :: + ++ sa-acquire ::< subscribe us + ::> subscribes this story to each partner. + :: + |= pas/(list partner) + %+ sa-sauce 0 :: subscription is caused by this app + %- zing + %+ turn pas + |= pan/partner + ^- (list card) + ::> subscribe starting at the last message we got, + ::> or if we haven't gotten any yet, messages + ::> from up to a day ago. + =+ num=(~(get by sequence) pan) + =+ old=(sub now.bol ~d1) :: XX full backlog + =+ ini=?^(num (scot %ud u.num) (scot %da old)) + ?- -.pan + $| !! ::< passport partner + :: + $& ::< circle partner + :_ ~ + :* %peer + /circle/[nom]/(scot %p hos.p.pan)/[nom.p.pan] + [hos.p.pan %talk-guardian] + /circle/[nom.p.pan]/[ini] + == + == + :: + ++ sa-abjure ::< unsubscribe us + ::> unsubscribes this story from each partner. + :: + |= pas/(list partner) + %+ sa-sauce 0 :: subscription is caused by this app + %- zing + %+ turn pas + |= pan/partner + ^- (list card) + ?- -.pan + $| !! ::< passport partner + :: + $& ::< circle partner + :_ ~ + :* %pull + /friend/show/[nom]/(scot %p hos.p.pan)/[nom.p.pan] + [hos.p.pan %talk-guardian] + ~ + == + == + :: + ++ sa-eject ::< unsubscribe ships + ::> removes ships {sis} from {followers}. + :: + |= sis/(set ship) + ^- (list move) + %+ turn (~(tap in (sa-unearth sis))) + |= {b/bone} + [b %quit ~] + :: + ++ sa-unearth ::< ships' bones + ::> find the bones in {followers} that belong to + ::> a ship in {sis}. + :: + |= sis/(set ship) + ^- (set bone) + %- ~(rep in sup.bol) + |= {{b/bone s/ship p/path} c/(set bone)} + ?. ?& (~(has in sis) s) + ?=({@tas *} p) + =(i.p nom) + == + c + (~(put in c) b) + -- +-- +:: +:: ::> || ::> || %wire-parsing ::> || @@ -1629,6 +1627,159 @@ ?>(?=($repeat -.wer) (fun num.wer hos.wer nom.wer)) :: ::> || +::> || %new-events +::> || +::+| +::TODO make use of ++prey for filtering subs? +++ f-bake ::< apply state delta + ::> applies a change to the application state, + ::> producing side-effects. + :: + |= dif/delta + ^- (quip move +>) + =^ mos +>.$ + da-done:(da-change:da dif) + :_ +>.$ + :(welp mos (affection dif)) +:: +++ g-query ::< query on state + ::> + :: + |= weg/(list coin) + ::TODO how would the system know how to parse the path? + :: should we define that ourselves? + :: ...i just want to cast to ++query if i can. + ::TODO should return (unit prize)? ie for /circle/non-existing + ^- prize + ?~ weg ~&(%empty-query !!) + ?: =(i.weg [%$ %tas %reader]) + [%reader nak nicks] + ?: =(i.weg [%$ %tas %friend]) + :- %friend + %- ~(gas in *(set circle)) + %+ murn + =- (~(tap in src.shape.-)) + (~(got by stories) (main our.bol)) + |= p/partner + ^- (unit circle) + ?. ?=($& -.p) ~ + [~ p.p] + ?: ?& =(i.weg [%$ %tas %circle]) + ?=(^ t.weg) + ?=({$$ p/$ta q/@ta} i.t.weg) + == + :- %circle + =+ soy=(~(got by stories) +>.i.t.weg) + :+ grams.soy ::TODO get using specified range. + [shape.soy mirrors.soy] + [locals.soy remotes.soy] + ~&(%invalid-query !!) +:: +++ i-change ::< delta to rumor + ::> + :: + ::TODO probably want to do "affected by" checks for every bone, + :: and just construct the rumor once. + |= {weg/(list coin) dif/delta} + ^- (unit rumor) + ?~ weg ~&(%empty-query !!) + ?: =(i.weg [%$ %tas %reader]) + :: changes to shared ui state apply. + ?+ -.dif ~ + $glyph `[%reader dif] + $nick `[%reader dif] + == + ?: =(i.weg [%$ %tas %friend]) + :: new or removed local stories apply. + ::TODO include mailbox sources. check privacy flags. + ?. ?=($story -.dif) ~ + =/ add/(unit ?) + ?+ -.dif.dif ~ + $new `& + $remove `| + == + ?~ add ~ + `[%friend u.add [our.bol nom.dif]] + ?: ?& =(i.weg [%$ %tas %circle]) + ?=(^ t.weg) + ?=({$$ p/$ta q/@ta} i.t.weg) + == + ?. ?=($story -.dif) ~ + ?. =(+>.i.t.weg nom.dif) ~ + `[%circle dif.dif] + ~&(%invalid-query !!) +:: +++ affection ::< rumors to interested + ::> + :: + ::TODO probably want to do "affected by" checks for every bone, + :: and just construct the rumor once. + |= dif/delta + ^- (list move) + %+ murn (~(tap by sup.bol)) + |= {b/bone s/ship p/path} + ^- (unit move) + =+ rum=(i-change (tmp-parse-path p) dif) + ::TODO %quit bones that are done with their subscription. + :: ...but that would also require a ta-cancel call to remove + :: them from the presence list! how do? + ?~ rum ~ + `[b %diff %talk-rumor u.rum] +:: +++ tmp-parse-path ::< ... + ::> + :: + |= pax/path + ^- (list coin) + ?~ pax ~ + :- [%$ %tas `@tas`i.pax] + ?. =(%circle `@tas`i.pax) ~ + ?~ t.pax ~&(%invalid-circle-path !!) + :- [%$ %ta `@ta`i.t.pax] + ~ + ::=+ tmp=((hard range) t.t.pax) + ::?~ tmp ~ + :::- hed.u.tmp + ::?~ t.u.tmp ~ + ::[tal.u.t.u.tmp ~] +:: +++ tmp-parse-peer-path ::< ... + ::> + :: + |= pax/path + ^- (pair knot circle) + ?. ?=({$circle @ta @ta @ta *} pax) + ~&(%invalid-peer-path !!) + :- i.t.pax + :- (slav %p i.t.t.pax) + i.t.t.t.pax +:: +++ leak ::< visible to + ::> + :: + |= {who/ship weg/(list coin)} + ^- ? + ::TODO + ::?: ?=({$reader *} pax) + :: ?. (team our.bol her) + :: %- ta-note + :: (crip "foreign reader {(scow %p her)}") + :: (ta-welcome ost.bol t.pax) + :::: weird subscription path. + ::?. ?=({@ *} pax) + :: (ta-evil %bad-path) + ::=+ pur=(~(get by stories) i.pax) + ::?~ pur + :: ::TODO send this to the subscriber! make them unsub! + :: %- ta-note + :: (crip "bad subscribe story '{(trip i.pax)}'") + ::=+ soy=~(. so i.pax `(list action)`~ u.pur) :: nest-fail if no cast + :::: she needs read permissions to subscribe. + ::?. (so-visible:soy her) + :: (ta-evil %no-story) + & +:: +::> || ::> || %poke-events ::> || ::+| @@ -1639,6 +1790,7 @@ |= cod/command ^- (quip move +>) =^ mos +>.$ + %- f-bake :- %more ta-done:(ta-apply:ta src.bol cod) =^ mow +>.$ log-all-to-file @@ -1650,39 +1802,28 @@ |= act/action ^- (quip move +>) ?. (team src.bol our.bol) + %- f-bake :- %more =< ta-done %- ta-note:ta %- crip "talk-action stranger {(scow %p src.bol)}" + %- f-bake :- %more ta-done:(ta-action:ta ost.bol act) :: -++ poke-talk-comment ::< do comment - ::> sends a comment. - :: - |= {pax/path sup/spur txt/@t} - ^- (quip move +>) - ta-done:(ta-comment:ta pax sup txt) -:: -++ poke-talk-fora-post ::< do fora post - ::> sends a fora post. - :: - |= {pax/path sup/spur hed/@t txt/@t} - ^- (quip move +>) - ta-done:(ta-fora-post:ta pax sup hed txt) -:: ::> || ::> || %subscription-events ::> || ::+| :: -++ diff-talk-report ::< accept report - ::> incoming talk-report. process it and update logs. +++ diff-talk-rumor ::< accept rumor + ::> :: - |= {wir/wire ret/report} + |= {wir/wire dif/rumor} ^- (quip move +>) =^ mos +>.$ - %+ etch-friend wir - |= {nom/knot cir/circle} - ta-done:(ta-diff-report:ta nom cir ret) + %- f-bake :- %more + ::TODO parse wire to get source and target of change + =+ res=(tmp-parse-peer-path wir) + ta-done:(ta-hear:ta p.res [%& q.res] dif) =^ mow +>.$ log-all-to-file [(welp mos mow) +>.$] @@ -1693,13 +1834,22 @@ |= pax/path ^- (quip move +>) ?: ?=({$sole *} pax) ~&(%talk-broker-no-sole !!) - ta-done:(ta-subscribe:ta src.bol pax) + =+ qer=(tmp-parse-path pax) + ?. (leak src.bol qer) ~&(%peer-invisible !!) + =^ mos +>.$ + %- f-bake :- %more + ta-done:(ta-subscribe:ta src.bol pax) + :_ +>.$ + :_ mos + [ost.bol %diff %talk-prize (g-query qer)] + :: ++ pull ::< unsubscribe ::> unsubscribes. :: |= pax/path ^- (quip move +>) + %- f-bake :- %more ta-done:(ta-cancel:ta src.bol pax) :: ++ reap-friend ::< subscription n/ack @@ -1714,7 +1864,8 @@ |= {nom/knot cir/circle} =. u.fal [>%reap-friend-fail nom cir< u.fal] %- (slog (flop u.fal)) - ta-done:(ta-quit:ta nom cir) + %- f-bake :- %more + ta-done:(ta-leave:ta nom cir) :: ++ quit-friend ::< dropped subscription ::> gall dropped our subscription. resubscribe. @@ -1723,7 +1874,14 @@ ^- (quip move +>) %+ etch-friend [%friend wir] |= {nom/knot cir/circle} - ta-done:(ta-retry:ta nom cir) + ::TODO do better + :_ +>.^$ :_ ~ + :* 0 + %peer + /circle/[nom]/(scot %p hos.cir)/[nom.cir] + [hos.cir %talk-guardian] + /circle/[nom.cir]/(sub now.bol ~h1) + == :: ++ coup-repeat ::< message n/ack ::> ack from ++ta-transmit. mark the message as @@ -1733,7 +1891,7 @@ ^- (quip move +>) %+ etch-repeat [%repeat wir] |= {num/@ud src/ship nom/knot} - ta-done:(ta-coup-repeat:ta [num src nom] fal) + (f-bake %done (strap num [%& src nom] ?=($~ fal))) :: ::> || ::> || %logging diff --git a/lib/talk.hoon b/lib/talk.hoon index 86c0e36b78..d991783326 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -42,6 +42,117 @@ :: ++ uniq |= eny/@uvJ - ^- {@uvH _eny} + ^- (quid serial eny) [(shaf %serial eny) (shax eny)] +:: +++ change-glyphs ::< ... + ::> + :: + |= {gys/(jug char (set partner)) bin/? gyf/char pas/(set partner)} + ^+ gys + :: simple bind. + ?: bin (~(put ju gys) gyf pas) + :: unbind all of glyph. + ?~ pas (~(del by gys) gyf) + :: unbind single. + (~(del ju gys) gyf pas) +:: +++ change-nicks ::< ... + ::> + :: + |= {nis/(map ship cord) who/ship nic/cord} + ^+ nis + ?: =(nic '') + (~(del by nis) who) + (~(put by nis) who nic) +:: +++ change-friends ::< ... + ::> + :: + |= {cis/(set circle) add/? cir/circle} + ^+ cis + %. cir + ?: add + ~(put in cis) + ~(del in cis) +:: +++ change-config ::< ... + ::> + :: + |= {cof/config dif/diff-config} + ^+ cof + ?- -.dif + $full cof.dif + $caption cof(cap cap.dif) + $filter cof(fit fit.dif) + $remove cof + :: + $source + %= cof + src + %. `(set partner)`pas.dif ::TODO? why do we *need* to cast? + ?: add.dif + ~(uni in src.cof) + ~(dif in src.cof) + == + :: + $permit + %= cof + ses.con + %. sis.dif + ?: add.dif + ~(uni in ses.con.cof) + ~(dif in ses.con.cof) + == + :: + $secure + %= cof + sec.con + sec.dif + :: + ses.con + ?. .= ?=(?($white $green) sec.dif) + ?=(?($white $green) sec.con.cof) + ~ + ses.con.cof + == + :: + $federal + %= cof + fes.fed + ?. fed.dif fes.fed.cof + %. sis.dif + ?: add.dif + ~(uni in fes.fed.cof) + ~(dif in fes.fed.cof) + :: + may.fed + ?: fed.dif may.fed.cof + %. sis.dif + ?: add.dif + ~(uni in may.fed.cof) + ~(dif in may.fed.cof) + == + == +:: +++ change-status ::< ... + ::> + :: + |= {sat/status dif/diff-status} + ^+ sat + ?- -.dif + $full sat.dif + $presence sat(pec pec.dif) + $remove sat + :: + $human + %= sat + man + ?- -.dif.dif + $full man.dif.dif + $true [tru.dif.dif han.man.sat] + $handle [tru.man.sat han.dif.dif] + == + == + == -- diff --git a/sur/talk.hoon b/sur/talk.hoon index 6cc24c8929..4baf6d96f3 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -4,6 +4,91 @@ |% :: ::> || +::> || %query-models +::> || +::> models relating to queries, their results and updates. +::+| +:: +::TODO path parsing/casting: ;;(query pax) or ((hard query) pax) +:: or (raid /~zod/5 /[%p]/[%ud]) +:: ...but it's still shit. +++ query ::> query paths + $% {$reader $~} ::< shared ui state + {$friend $~} ::< publicly joined + {$circle nom/knot ran/range} ::< story query + == :: +++ range (unit {hed/@ t/(unit {tal/@ $~})}) ::< msg range, @ud/@da +++ prize ::> query result + $% $: $reader ::< /reader + gys/(jug char (set partner)) ::< glyph bindings + nis/(map ship cord) ::< nicknames + == :: + {$friend cis/(set circle)} ::< /friend + $: $circle ::< /circle + gaz/(list telegram) ::< queried messages + cos/lobby ::< configs + pes/crowd ::< presences + == :: + == :: +++ rumor ::< query result change + $% $: $reader ::< /reader + $= dif :: + $% {$glyph diff-glyph} :: + {$nick diff-nick} :: + == :: + == :: + {$friend add/? cir/circle} ::< /friend + {$circle dif/diff-story} ::< /circle + == :: +::TODO deltas into app +++ delta :: + $% ::TODO no more %more, just produce/take list instead! + {$more mor/(list delta)} ::< multiple changes + :: messaging state :: + {$out cir/circle out/(list thought)} ::< msgs into outbox + {$done don/(map @ud {partner ?})} ::< msgs delivered + :: shared ui state :: + {$glyph diff-glyph} ::< un/bound glyph + {$nick diff-nick} ::< changed nickname + :: story state :: + {$story nom/knot dif/diff-story} ::< change to story + :: side-effects :: + {$bear cir/circle} ::< %burden command + {$react ost/bone rac/reaction} ::TODO ost.bol? ::< reaction to action + {$quit ost/bone} ::< force unsubscribe + == :: +++ diff-glyph {bin/? gyf/char pas/(set partner)} ::< un/bound glyph +++ diff-nick {who/ship nic/cord} ::< changed nickname +++ diff-story :: + $% {$new con/config} ::< new story + {$grams gaz/(list telegram)} ::< new/changed msgs + {$config cir/circle dif/diff-config} ::< new/changed config + {$status pan/partner who/ship dif/diff-status} ::< new/changed status + {$remove $~} ::< removed story + == :: +++ diff-config ::> config change + $% {$full cof/config} ::< fully changed config + {$source add/? pas/(set partner)} ::< add/rem sources + {$caption cap/cord} ::< changed description + {$filter fit/filter} ::< changed filter + {$permit add/? sis/(set ship)} ::< add/rem to b/w-list + {$secure sec/security} ::< changed security + {$federal add/? fed/? sis/(set ship)} ::< add/rem may/fes + {$remove $~} ::< removed config + == :: +++ diff-status ::> status change + $% {$full sat/status} ::< fully changed status + {$presence pec/presence} ::< changed presence + {$human dif/diff-human} ::< changed name + {$remove $~} ::< removed config + == :: +++ diff-human ::> name change + $% {$full man/human} ::< fully changed name + {$true tru/(unit (trel cord (unit cord) cord))} ::< changed true name + {$handle han/(unit cord)} ::< changed handle + == :: +:: +::> || ::> || %reader-communication ::> || ::> broker interfaces for readers. @@ -26,8 +111,8 @@ ::TODO change to target partners, not only our circles. {$status nos/(set knot) sat/status} ::< our status update :: changing shared ui :: - {$human sip/ship man/human} ::< new identity {$glyph gyf/char pas/(set partner) bin/?} ::< un/bind a glyph + {$nick who/ship nic/knot} ::< new identity == :: ++ reaction ::> user information $: res/?($info $fail) ::< result From 563aa0102e14c1dbf169ec82d088c5c1980234ec Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 12 Jun 2017 15:19:45 -0700 Subject: [PATCH 099/303] Mostly functional federation & delta model. --- app/talk-agent.hoon | 457 +++---- app/talk-guardian.hoon | 894 +++++++------ app/talk.hoon | 2894 ---------------------------------------- lib/talk.hoon | 109 +- mar/talk/command.hoon | 3 +- mar/talk/prize.hoon | 14 + mar/talk/rumor.hoon | 14 + sur/talk.hoon | 71 +- 8 files changed, 855 insertions(+), 3601 deletions(-) delete mode 100644 app/talk.hoon create mode 100644 mar/talk/prize.hoon create mode 100644 mar/talk/rumor.hoon diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index a6a93b50c4..15b3d9604f 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -2,15 +2,19 @@ :::: /hoon/talk-agent/app :: :: :: :: :: :: +::TODO master changes, incl %notify ::TODO guardian's todo's apply here too ::TODO make sure glyphs only get bound when joins succeed :: ...this is a bit troublesome, because failed joins don't actually :: unsubscribe us. ::TODO maybe keep track of received grams per partner, too? :: +::TODO for delta model: +:: 3) split into delta creation and application, as with hall. +:: ::> This reader implementation makes use of the mailbox ::> for all its subscriptions and messaging. All -::> lowdowns received are exclusively about the mailbox, +::> rumors received are exclusively about the mailbox, ::> since that's the only thing the reader ever ::> subscribes to. :: @@ -38,22 +42,21 @@ remotes/(map partner group) ::< remote presences mirrors/(map circle config) ::< remote configs :: ui state :: - folks/(map ship human) ::< human identities + nicks/(map ship cord) ::< human identities nik/(map (set partner) char) ::< bound circle glyphs nak/(jug char (set partner)) ::< circle glyph lookup cli/shell ::< interaction state == :: ++ shell ::> console session $: id/bone ::< identifier - count/@ud ::< messages shown + latest/@ud ::< latest shown msg num say/sole-share ::< console state active/(set partner) ::< active targets settings/(set knot) ::< frontend settings == :: ++ move (pair bone card) ::< all actions ++ lime ::> diff fruit - $% {$talk-report report} :: - {$sole-effect sole-effect} :: + $% {$sole-effect sole-effect} :: == :: ++ pear ::> poke fruit $% {$talk-command command} :: @@ -75,9 +78,8 @@ {$invite p/knot q/(set ship)} ::< give permission {$banish p/knot q/(set ship)} ::< deny permission {$source p/knot q/(set partner)} ::< add source - {$enlist p/knot q/(set ship)} ::< allow federation - {$retire p/knot q/(set ship)} ::< deny federation - {$burden p/circle} ::< help federate + :: personal metadata + {$status p/knot q/presence} ::TODO better interface ::< set status :: messaging :: {$say p/(list speech)} ::< send message {$eval p/cord q/twig} ::< send #-message @@ -123,17 +125,39 @@ ::+| :: ++ broker ::< broker ship + name - |= our/ship + ^- dock :_ %talk-guardian - ?. =((clan our) %earl) - our - (sein our) + (true-self our.bol) :: -++ inbox ::< reader's circle +++ inbox ::< reader's circle name ::> produces the name of the circle used by this ::> reader for all its operations + ^- knot (main our.bol) :: +++ incir ::< reader's circle + ::> ++inbox, except a full circle. + ^- circle + :_ inbox + (true-self our.bol) +:: +++ inpan ::< reader's partner + ::> ++inbox, except a full partner. + ^- partner + [%& incir] +:: +++ nik-from-nak ::< nik from nak + ::> + :: + ::TODO ...we really should rename these. + |= nek/_nak + ^+ nik + %- ~(gas by *(map (set partner) char)) + =- (zing -) + %+ turn (~(tap by nek)) + |= {a/char b/(set (set partner))} + (turn (~(tap by b)) |=(c/(set partner) [c a])) +:: ::> || ::> || %engines ::> || @@ -209,12 +233,20 @@ ++ ta-init ::< initialize app ::> subscribes to our broker. :: - %- ta-emit - :* ost.bol - %peer - / ::< return/diff path - (broker our.bol) - /reader/[inbox] ::< peer path + %- ta-emil + ^- (list move) + :~ :* ost.bol + %peer + / + broker + /reader + == + :* ost.bol + %peer + / + broker + /circle/[inbox] + == == :: ++ ta-reaction ::< apply reaction @@ -224,148 +256,115 @@ ^+ +> sh-done:(~(sh-reaction sh cli) rac) :: - ++ ta-change ::< apply change + ++ ta-take ::< accept prize ::> :: - |= dif/delta + |= piz/prize + ^+ +> + ?+ -.piz + ~&([%ignoring-prize -.piz] +>) + :: + $reader + %= +> + nak gys.piz + nik (nik-from-nak gys.piz) + nicks nis.piz + == + :: + $circle + %. gaz.piz + %= ta-change-grams + sources sre.loc.cos.piz + mirrors (~(put by rem.cos.piz) incir loc.cos.piz) + remotes (~(put by rem.pes.piz) inpan loc.pes.piz) + == + == + :: + ++ ta-hear ::< apply change + ::> + :: + |= dif/rumor ^+ +> ?+ -.dif - ~& [%ignoring-delta -.dif] - +> + ~&([%ignoring-rumor -.dif] +>) :: - $mor - |- ^+ +>.^$ - ?~ mor.dif +>.^$ - $(+>.^$ ^$(dif i.mor.dif), mor.dif t.mor.dif) + $reader + ?- -.dif.dif + $glyph + (ta-change-glyph +.dif.dif) + :: + $nick + +>(nicks (change-nicks nicks who.dif.dif nic.dif.dif)) + == :: - $cir - (ta-change-circle +.dif) + $circle + (ta-change-circle dif.dif) == :: ++ ta-change-circle ::< apply circle change ::> :: - |= {cir/circle dif/delta-circle} + |= dif/diff-story ^+ +> ?+ -.dif - ~& [%ignoring-delta-circle -.dif] - +> + ~&([%unexpected-circle-rumor -.dif] +>) :: - $put - (ta-low-grams count.cli gaz.dif) + $grams + (ta-change-grams gaz.dif) + :: + $config + %= +> + sources + ?. ?& ?=($sourcee -.dif.dif) + =(cir.dif incir) + == + sources + %. pas.dif.dif + ?: add.dif.dif + ~(uni in sources) + ~(dif in sources) + :: + mirrors + ?: ?=($remove -.dif.dif) (~(del by mirrors) cir.dif) + %+ ~(put by mirrors) cir.dif + %+ change-config + (fall (~(get by mirrors) cir.dif) *config) + dif.dif + == + :: + $status + %= +> + remotes + %+ ~(put by remotes) pan.dif + =+ rem=(fall (~(get by remotes) pan.dif) *group) + ?: ?=($remove -.dif.dif) (~(del by rem) who.dif) + %+ ~(put by rem) who.dif + %+ change-status + (fall (~(get by rem) who.dif) *status) + dif.dif + == == :: - ++ ta-low ::< apply lowdown - ::> processes a talk lowdown - :: - |= low/lowdown - ^+ +> - ?- -.low - $glyph (ta-low-glyph +.low) - $names (ta-low-names +.low) - $confs (ta-low-confs +.low) - $precs (ta-low-precs +.low) - $grams (ta-low-grams +.low) - == - :: - ++ ta-low-glyph ::< apply changed glyphs + ++ ta-change-glyph ::< apply changed glyphs ::> applies new set of glyph bindings. :: - |= nek/_nak + |= {bin/? gyf/char pas/(set partner)} ^+ +> - ?: =(nek nak) +> :: no change + =+ nek=(change-glyphs nak bin gyf pas) + ?: =(nek nak) +>.$ :: no change =. nak nek - =. nik - %- ~(gas by *(map (set partner) char)) - =- (zing -) - %+ turn (~(tap by nek)) - |= {a/char b/(set (set partner))} - (turn (~(tap by b)) |=(c/(set partner) [c a])) + =. nik (nik-from-nak nek) sh-done:~(sh-prod sh cli) :: - ++ ta-low-names ::< apply changed names - ::> applies new local identities. - :: - |= nas/(map ship (unit human)) - ^+ +> - %= +> - folks - %- ~(gas by *(map ship human)) - %+ murn - =< $ - %~ tap by - %. nas - ~(uni by `_nas`(~(run by folks) some)) - == - |= {s/ship h/(unit human)} - ?~(h ~ (some [s u.h])) - == - :: - ++ ta-low-confs ::< apply changed confs - ::> applies new circle configurations. - ::> because of how this reader only subscribes to - ::> the main mailbox, {coy} is always the mailbox's - ::> config. - :: - |= {coy/(unit config) cofs/(map circle (unit config))} - ^+ +> - ::> if possible, update {sources}. if we do, and we - ::> gain new ones, update the prompt. (this is to - ::> remove the mailbox from the audience after - ::> creating or joining a new circle.) - ?~ coy ~&(%mailbox-gone !!) - =. +> ::TODO =? - ?~ (~(dif in src.u.coy) sources) +>.$ - =< sh-done - %- ~(sh-pact sh(sources src.u.coy) cli) - (~(dif in src.u.coy) sources) - =. sources src.u.coy - =. cofs (~(put by cofs) [our.bol inbox] coy) - :: print changes for each config. - =. +>.$ - =< sh-done - %+ roll (~(tap by cofs)) - |= {{s/circle c/(unit config)} cil/_sh} - %^ ~(sh-low-config cil cli) - s (~(get by mirrors) s) c - :: apply config changes to {mirrors}. - =. mirrors - %- ~(gas by *_mirrors) - %+ murn (~(tap by cofs)) - |= {s/circle c/(unit config)} - ^- (unit (pair circle config)) - ?~(c ~ `[s u.c]) - +>.$ - :: - ++ ta-low-precs ::< apply changed precs - ::> applies new presences. - ::> other clients might care for {gop}, but we're - ::> only ever getting this for the mailbox, where - ::> we're the only ones present. - :: - |= {gop/group pas/(map partner group)} - ^+ +> - =/ ner/_remotes :: per-partner uni - %- ~(urn by pas) - |= {p/partner g/group} - =+ o=(~(get by remotes) p) - ?~(o g (~(uni by u.o) g)) - =. ner (~(uni by remotes) ner) :: fill in the gaps - ?: =(remotes ner) +>.$ :: no change - =. +>.$ - =< sh-done - %+ ~(sh-low-rempe sh cli) - remotes ner - +>.$(remotes ner) - :: - ++ ta-low-grams ::< apply messages + ++ ta-change-grams ::< apply messages ::> applies new or changed telegrams. :: - |= {num/@ud gams/(list telegram)} + |= gaz/(list telegram) ^+ +> - =. +>.$ (ta-lesson gams) + =. +>.$ (ta-lesson gaz) + ::TODO maybe move to ta-learn and pass num? =< sh-done - (~(sh-low-grams sh cli) num gams) + (~(sh-grams sh cli) gaz) :: ::> || ::> || %messages @@ -424,7 +423,7 @@ :: ^+ . =/ she/shell - %*(. *shell id ost.bol, active (sy [%& our.bol inbox] ~)) + %*(. *shell id ost.bol, active (sy inpan ~)) sh-done:~(sh-prod sh she) :: ++ ta-sole ::< apply sole input @@ -477,7 +476,7 @@ :* ost.bol %poke /reader/action - (broker our.bol) + broker [%talk-action act] == == @@ -555,7 +554,7 @@ :: ++ circ ::< circle ;~ pose - (cold [our.bol inbox] col) + (cold incir col) ;~(pfix cen (stag our.bol sym)) ;~(pfix fas (stag (sein our.bol) sym)) :: @@ -621,9 +620,10 @@ ;~(plug (cold %eval hax) expr) :: %+ stag %say - %+ most (jest '•') + %+ most (jest '•') ::TODO why is this not breaking msgs up? ;~ pose (stag %url aurf:urlp) + ::TODO maybe reverse loobs. at least document properly! confusing. :(stag %lin | ;~(pfix pat text)) :(stag %lin & ;~(less sem hax text)) == @@ -634,7 +634,7 @@ ++ glyph (mask "/\\\{( finds all ships whose handle matches {nym}. :: |= nym/knot ^- (list ship) - %+ murn (~(tap by folks)) - |= {p/ship q/human} - ?~ han.q ~ - ?. =(u.han.q nym) ~ + %+ murn (~(tap by nicks)) + |= {p/ship q/knot} + ?. =(q nym) ~ [~ u=p] :: ++ twig-head ::< eval data @@ -997,26 +994,17 @@ ^+ ..sh-work (sh-act %source nom & pas) :: - ++ enlist - ::> - :: - |= {nom/knot sis/(set ship)} - ^+ ..sh-work - (sh-act %enlist nom & sis) + ::> || + ::> || %personal-metadata + ::> || + ::+| :: - ++ retire + ++ status ::< set status ::> :: - |= {nom/knot sis/(set ship)} + |= {nom/knot pec/presence} ^+ ..sh-work - (sh-act %enlist nom | sis) - :: - ++ burden - ::> - :: - |= cir/circle - ^+ ..sh-work - (sh-act %burden cir) + (sh-act %status [nom ~ ~] [pec [~ ~]]) :: ::> || ::> || %messaging @@ -1141,34 +1129,31 @@ ::> no arguments, show all ?: ?=({$~ $~} +<) %+ sh-fact %mor - %+ turn (~(tap by folks)) - |= {p/ship q/human} + %+ turn (~(tap by nicks)) + |= {p/ship q/knot} :- %txt - ?~ han.q - "{

}:" - "{

}: {}" + "{

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

}: {}"] - %. [%human u.her [true=~ hand=nym]] + %. [%nick u.her (fall nym '')] %= sh-act - folks + nicks ?~ u.nym ::> unset nickname - (~(del by folks) u.her) + (~(del by nicks) u.her) ::> set nickname - (~(put by folks) u.her [true=~ hand=nym]) + (~(put by nicks) u.her u.nym) == :: ++ wo-set ::< %set @@ -1224,7 +1209,7 @@ :: |= paz/(set partner) ?: (sh-pear paz) paz - (~(put in paz) [%& our.bol inbox]) + (~(put in paz) inpan) :: ++ sh-pear ::< hearback ::> produces true if any partner is included in @@ -1528,7 +1513,7 @@ =. +>.$ %+ sh-show-sources (weld (trip inbox) ": ") - (sh-set-diff src.laz src.loc) + (sh-set-diff sre.laz sre.loc) ?: !=(sec.con.loc sec.con.laz) =. +>.$ (sh-note :(weld pre "but " (sh-cure sec.con.loc))) %^ sh-show-permits @@ -1540,14 +1525,14 @@ sec.con.loc (sh-set-diff ses.con.laz ses.con.loc) :: - ++ sh-low-config ::< do show config + ++ sh-config ::< do show config ::> prints a circle's config changes to the cli. :: |= {cir/circle old/(unit config) new/(unit config)} ^+ +> :: new circle ?~ old - :: ++sh-low-rempe will notice a new partner. + :: ++sh-show-rempe will notice a new partner. +> :: removed circle ?~ new @@ -1556,65 +1541,30 @@ (weld ~(cr-phat cr cir) ": ") u.old u.new :: - ++ sh-low-rempe ::< show remotes - ::> prints remote presence changes to the cli. - :: - |= {old/(map partner group) new/(map partner group)} - ?: (~(has in settings.she) %quiet) - +>.$ - =+ day=(sh-rempe-diff old new) - =. +>.$ - |- ^+ +>.^$ - ?~ old.day +>.^$ - =. +>.^$ $(old.day t.old.day) - (sh-note (weld "not " (~(pr-show pr p.i.old.day) ~))) - =. +>.$ - |- ^+ +>.^$ - ?~ new.day +>.^$ - =. +>.^$ $(new.day t.new.day) - =. +>.^$ - (sh-note (weld "new " (~(pr-show pr p.i.new.day) ~))) - (sh-show-precs "--" ~ (~(tap by q.i.new.day)) ~) - =. +>.$ - |- ^+ +>.^$ - ?~ cha.day +>.^$ - =. +>.^$ $(cha.day t.cha.day) - =. +>.^$ - (sh-note (weld "for " (~(pr-show pr p.i.cha.day) ~))) - =+ yez=(~(got by old) p.i.cha.day) - %+ sh-show-precs "--" - (sh-group-diff yez q.i.cha.day) - +>.$ - :: - ++ sh-low-precs ::< show presence - ::> prints presence changes to the cli. - :: - |= {old/group new/group} - ^+ +> - =+ dif=(sh-group-diff old new) - (sh-show-precs "" dif) - :: - ++ sh-low-gram ::< show telegram + ++ sh-gram ::< show telegram ::> prints the telegram. every fifth message, ::> print the message number also. :: - |= {num/@ud gam/telegram} + |= gam/telegram ^+ +> - ?: =(num count.she) - =. +> ?:(=(0 (mod num 5)) (sh-numb num) +>) - (sh-rend(count.she +(num)) gam) - ?: (gth num count.she) - =. +> (sh-numb num) - (sh-rend(count.she +(num)) gam) - +> + ::TODO is it cool to just assume all messages we print are already stored? + =+ num=(~(got by known) uid.tot.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-low-grams ::< do show telegrams + ++ sh-grams ::< do show telegrams ::> prints multiple telegrams. :: - |= {num/@ud gaz/(list telegram)} + |= gaz/(list telegram) ^+ +> ?~ gaz +> - $(gaz t.gaz, num +(num), +> (sh-low-gram num i.gaz)) + $(gaz t.gaz, +> (sh-gram i.gaz)) :: -- -- @@ -1670,12 +1620,10 @@ ::> left-pads with spaces. :: |. ^- tape - =+ nym=(~(get by folks) hos.one) + =+ nym=(~(get by nicks) hos.one) ?~ nym (cr-curt |) - ?~ han.u.nym - (cr-curt |) - =+ raw=(trip u.han.u.nym) + =+ raw=(trip u.nym) =+ len=(sub 14 (lent raw)) (weld (reap len ' ') raw) :: @@ -1691,11 +1639,11 @@ ?: =(nom.one inbox) ":" ['%' (trip nom.one)] - ?: =(hos.one (sein our.bol)) - ['/' (trip nom.one)] =+ wun=(scow %p hos.one) ?: =(nom.one (main hos.one)) wun + ?: =(hos.one (sein our.bol)) + ['/' (trip nom.one)] :(welp wun "/" (trip nom.one)) -- :: @@ -1756,6 +1704,7 @@ ++ pr-show ::< render partner ::> renders a partner as text. :: + ::> moy: multiple partners in audience? |= moy/(unit ?) ^- tape ?- -.one @@ -1804,7 +1753,7 @@ ::> remove ourselves from the audience. :: ^+ . - .(lix (~(del in lix) `partner`[%& our.bol inbox])) + .(lix (~(del in lix) `partner`inpan)) :: ++ ar-maud ::< multiple audience ::> checks if there's multiple partners in the @@ -2109,7 +2058,7 @@ ?~ ace wyd (sub wyd u.ace) :- (weld pef (scag end `tape`txt)) - $(txt (slag +(end) `tape`txt), pef (reap (lent pef) ' ')) ::TODO why do we need to cast? + $(txt (slag +(end) `tape`txt), pef (reap (lent pef) ' ')) ::TODO? why do we need to cast? :: $inv :_ ~ @@ -2151,29 +2100,25 @@ [~ +>] ta-done:ta-console:ta :: -++ diff-talk-delta ::< accept change +++ diff-talk-prize ::< accept query answer ::> - ::TODO ++feel :: - |= {way/wire dif/delta} + |= {way/wire piz/prize} ^- (quip move +>) - ta-done:(ta-change:ta dif) + ta-done:(ta-take:ta piz) :: -++ diff-talk-lowdown ::< accept lowdown - ::> incoming talk-lowdown. process it. - ::> we *could* use the wire to identify what story - ::> subscription our lowdown is coming from, but - ::> since we only ever subscribe to a single story, - ::> we don't bother. +++ diff-talk-rumor ::< accept query change + ::> :: - |= {way/wire low/lowdown} - ta-done:(ta-low:ta low) + |= {way/wire dif/rumor} + ^- (quip move +>) + ta-done:(ta-hear:ta dif) :: ++ diff-talk-reaction ::< accept reaction ::> incoming talk reaction. process it. :: |= {way/wire rac/reaction} - ?. =(src.bol -:(broker our.bol)) + ?. =(src.bol -:broker) ~& [%diff-reaction-stranger src.bol] [~ +>] ta-done:(ta-reaction:ta rac) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 0e0e1a3f30..7491def55e 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -17,6 +17,19 @@ :: ::TODO crash on pokes/peers we do not expect :: +::TODO federation should not be present at all in delta-application cores. the +:: way changes are to be applied should be figured out by the delta- +:: geenration cores entirely. +:: +::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. +:: +::TODO we need to have something for upward changes on burdens as well. we +:: could use entirely new query for this. to do so, we'd need to add +:: a new code path in front of changes that checks if it's not a config +:: change, and then redirects it to existing arms. +:: /? 151 ::< hoon version /- talk ::< structures /+ talk, time-to-id ::< libraries @@ -36,7 +49,6 @@ outbox/(pair @ud (map @ud thought)) ::< urbit outbox log/(map knot @ud) ::< logged to clay nicks/(map ship knot) ::< nicknames - nik/(map (set partner) char) ::< bound circle glyphs nak/(jug char (set partner)) ::< circle glyph lookup == :: ++ story ::> wire content @@ -49,6 +61,8 @@ ::TODO never gets updated. :: sequence/(map partner @ud) ::< partners heard known/(map serial @ud) ::< messages heard + burden/? ::< from parent? + ::TODO send changes to herited story changes up. == :: ++ river (pair point point) ::< stream definition ++ point ::> stream endpoint @@ -93,7 +107,7 @@ |= old/(unit state) ^- (quip move ..prep) ?~ old - %- f-bake :- %more + %- pre-bake ta-done:ta-init:ta [~ ..prep(+<+ u.old)] :: @@ -103,6 +117,7 @@ ::> small utility functions. ::+| :: +::TODO remove, only used once. ++ strap |*({k/* v/*} (~(put by *(map _k _v)) k v)) ::< map key-value pair :: ::> || @@ -173,9 +188,6 @@ ::> utility functions for data retrieval. ::+| :: - ::TODO functions for getting readers or followers of a specific story from - :: the subs in sup.bol. - :: ++ ta-know ::< story monad ::> produces a gill that takes a gate. ::> if the story {nom} exists, calls the gate with @@ -201,6 +213,8 @@ ::> populate state on first boot. ::> creates our default mailbox and journal. :: + ::TODO but now init it spread out over two arms? ugly! + =< (ta-delta %init ~) :: side-effects %+ roll ^- (list {security knot cord}) :~ [%brown (main our.bol) 'default home'] @@ -216,36 +230,13 @@ |= {src/ship cod/command} ^+ +> ?- -.cod - ::> %review commands prompt us (as a circle host) + ::> %publish commands prompt us (as a circle host) ::> to verify and distribute messages. - $review - (ta-think | src +.cod) - ::> %burden commands ask us to add the sender as a - ::> federator for the specified story, taking the - ::> state it sent into account. - $burden - (ta-burden src +.cod) - ::> %relief commands prompt us to relieve the - ::> specified federators of their duty. - $relief - (ta-relieve src +.cod) + $publish (ta-think | src +.cod) + ::TODO document + $bearing (ta-observe src) == :: - ++ ta-burden ::< accept federator - ::> adds {src} as a federator to story {nom}, - ::> integrating its state into the story. - :: - |= {src/ship nom/knot cof/lobby pes/crowd gaz/(list telegram)} - %- (ta-know nom) |= sor/_so =< so-done - (so-burden:sor src cof pes gaz) - :: - ++ ta-relieve ::< remove federator - ::> removes {who} as federators from story {nom}. - :: - |= {src/ship nom/knot who/(set ship)} - %- (ta-know nom) |= sor/_so =< so-done - (so-relieve:sor src who) - :: ++ ta-action ::< apply reader action ::> performs action sent by a reader. :: @@ -266,7 +257,6 @@ ::+| ++ work ::< perform action ^+ ..ta-action - ::TODO %. +.act ::TODO require deltas as product? ?- -.act :: circle configuration @@ -276,8 +266,6 @@ $filter (action-filter +.act) $permit (action-permit +.act) $delete (action-delete +.act) - $enlist (action-enlist +.act) - $burden (action-burden +.act) :: messaging $convey (action-convey +.act) $phrase (action-phrase +.act) @@ -322,7 +310,6 @@ des [| |] [typ ~] - [[our.bol ~ ~] [our.bol ~ ~]] == %- react [%fail (crip "{(trip nom)}: already exists") `act] @@ -369,48 +356,7 @@ ::> add/remove {pas} as sources for story {nom}. :: |= {nom/knot sub/? pas/(set partner)} - (affect nom %config [our.bol nom] %source sub pas) - :: - ++ action-enlist ::< dis/allow federation - ::> adds {sis} to story {nom}'s list of allowed - ::> federators. - :: - |= {nom/knot fed/? sis/(set ship)} - (affect nom %config [our.bol nom] %federal fed | sis) - :: - ++ action-burden ::< help federate - ::> starts federating the specified circle. create - ::> it locally if it doesn't yet exist. - :: - ::TODO make deltas instead. - ::TODO ...but we'll still need to broadcast this move??? - |= {hos/ship nom/knot} - ^+ ..ta-action - :: update federation config. - :: we don't use the specialized so-arms for this because followers will - :: get notified once we receive updates from {hos} anyway. - =+ new=(~(has by stories) nom) - =. ..ta-action ::TODO =? - ?. new ..ta-action - %^ impact nom %new - :* [[%& hos nom] ~ ~] - *cord - *filter - *control - [[hos ~ ~] [hos ~ ~]] - == - =. ..ta-action ::TODO =? - ?: new ..ta-action - (affect nom %config [our.bol nom] %federal & | [hos ~ ~]) - =. ..ta-action ::TODO =? - ?: new ..ta-action - (affect nom %config [our.bol nom] %federal & & [hos ~ ~]) - ::TODO shouldn't src-adding be included in %fed & & application? - =. ..ta-action ::TODO =? - ?: new ..ta-action - (affect nom %config [our.bol nom] %source & [[%& hos nom] ~ ~]) - :: send %burden command with story's current state. - (ta-delta %bear [hos nom]) + (affect nom %follow sub pas) :: ::> || %messaging ::+| @@ -444,6 +390,8 @@ ::> for every story in the set, update our status. ::TODO accept (set circle). for locals, do directly. :: for remotes, send command. + :: on getting such a command, first check if + :: the sender actually is in our presende map. ::TODO split interface into action-presence and :: action-human. :: @@ -477,26 +425,37 @@ ::> arms that react to subscription events. ::+| :: + ++ ta-observe ::< watch burden bearer + ::> + :: + |= who/ship + ^+ +> + ?. =(our.bol (sein who)) + ~&([%not-our-bearer who] +>) + ~& [%gonna-observe who] + (ta-delta %observe who) + :: ++ ta-subscribe ::< listen to ::> add her to a presence list if applicable. :: + ::TODO change interface to not include path, + :: only call for /circle queries. |= {her/ship pax/path} ^+ +> - :: weird subscription path. - ::TODO catch earlier, just pass nom instead of path? - :: also check story existence earlier maybe? - ?. ?=({$circle @ta *} pax) +> - %- (ta-know i.pax) |= sor/_so =< so-done - (so-attend:sor her %hear [~ ~]) + ?. ?=({@ta *} pax) +> + ?+ -.pax + +> + :: + $burden + (ta-observe her) + :: + $circle + ?. ?=({@ta *} t.pax) +> + %- (ta-know i.t.pax) |= sor/_so =< so-done + (so-attend:sor her %hear [~ ~]) + == :: - ++ ta-leave ::< subscription failed - ::> removes {cir} from story {nom}'s followers. - :: - |= {nom/knot cir/circle} - %- (ta-know nom) |= sor/_so =< so-done - (so-leave:sor %& cir) - :: - ++ ta-cancel ::< unsubscribe + ++ ta-cancel ::< forget ::> drops {src}'s subscription. deduce the right way ::> to do this from the subscription path {pax}. :: @@ -505,22 +464,78 @@ ::TODO catch earlier, just pass nom? ?. ?=({$circle @ta *} pax) +> :: set ship status to %gone. - %- (ta-know i.pax) |= sor/_so =< so-done + %- (ta-know i.t.pax) |= sor/_so =< so-done (so-absent:sor src) :: + ++ ta-greet ::< subscription success + ::> + :: + |= {nom/knot cir/circle} + %- (ta-know nom) |= sor/_so =< so-done + (so-greet:sor %& cir) + :: + ++ ta-leave ::< subscription failed + ::> removes {cir} from story {nom}'s followers. + :: + |= {nom/knot cir/circle} + %- (ta-know nom) |= sor/_so =< so-done + (so-leave:sor %& cir) + :: + ++ ta-take ::< apply prize + ::> + :: + |= {wir/wire piz/prize} + ^+ +> + ?+ -.piz + ~&([%ignoring-prize -.piz] +>) + :: + $burden + %- ta-deltas + %+ roll (~(tap by sos.piz)) + |= {{n/knot b/burden} d/(list delta)} + =- [[%story n %bear b(gaz -)] d] + ::TODO change audiences of messages from (sein our)/n into our/n + %+ turn gaz.b + |= t/telegram + =- t(aud.tot -) + =/ oud + (~(get by aud.tot.t) [%& (sein our.bol) n]) + ?~ oud ::TODO seems like it should never occur? + ~& %unexpected-parent-not-audience + aud.tot.t + =. aud.tot.t + (~(del by aud.tot.t) [%& (sein our.bol) n]) + (~(put by aud.tot.t) [%& our.bol n] u.oud) + :: + $circle + =+ res=(tmp-parse-diff-path wir) + %- (ta-know p.res) |= sor/_so =< so-done + (so-take:sor q.res +.piz) + == + :: ++ ta-hear ::< apply rumor ::> :: - |= {det/knot src/partner dif/rumor} + |= {wir/wire dif/rumor} ^+ +> ?+ -.dif ~&([%ignoring-rumor -.dif] +>) + :: + $burden + ~& [%hear-burden -.dif.dif] + ?+ -.dif.dif + %- (ta-know nom.dif) |= sor/_so =< so-done + (so-hear:sor & [our.bol nom.dif] dif.dif) + :: + $new + ::TODO we make a %bear delta with just the config set. + (ta-delta %story nom.dif %bear ~ [con.dif.dif ~] [~ ~]) + == :: $circle - ?. ?=($& -.src) - ~&([%unexpected-rumor -.dif src] +>) - %- (ta-know det) |= sor/_so =< so-done - (so-hear-circle:sor p.src dif.dif) + =+ res=(tmp-parse-diff-path wir) + %- (ta-know p.res) |= sor/_so =< so-done + (so-hear:sor | q.res dif.dif) == :: ::> || @@ -644,6 +659,12 @@ ^+ +> +>(deltas [dif deltas]) :: + ++ so-deltas ::< send delta list + ::> + :: + |= dis/(list delta) + %_(+> deltas (welp (flop dis) deltas)) + :: ++ so-delta-our ::< send delta of us ::> adds a delta about this story. :: @@ -660,122 +681,60 @@ ++ so-pan [%& our.bol nom] ::< us as partner ++ so-cir [our.bol nom] ::< us as circle :: - ++ so-right ::< is federator? - ::> checks whether partner {pan} has authority - ::> over this story. - :: - |= pan/partner - ?& ?=($& -.pan) - =(nom nom.p.pan) - (~(has in fes.fed.shape) hos.p.pan) - == - :: ::> || ::> || %interaction-events ::> || ::> arms that apply events we received. ::+| :: - ++ so-hear-circle ::< accept circle rumor + ++ so-take ::< accept circle prize ::> :: - |= {src/circle dif/diff-story} + |= {src/circle gaz/(list telegram) cos/lobby pes/crowd} ^+ +> - ?. (~(has in src.shape) [%& src]) - ~&([%unexpected-rumor -.dif src] +>) - :: rumor from federator? apply to us. - =. src ::TODO =? - ?: (so-right [%& src]) so-cir - src - ?- -.dif - $new $(dif [%config src %full con.dif]) - $grams (so-lesson gaz.dif) - $config :: ignore foreign mirrors. - ?. |(=(src cir.dif) =(src so-cir)) +> - (so-delta-our dif) - $status :: ignore foreign remotes. - ?. |(=([%& src] pan.dif) =(src so-cir)) +> - (so-delta-our dif) - $remove (so-delta-our %config src %remove ~) - == - :: - ++ so-burden ::< accept federator - ::> if {src} is allowed to, have it federate this - ::> story. - ::> starts by assimilating {src}'s state into our - ::> own (giving priority to local state), removing - ::> redundant data, then sending updated state to - ::> all followers. - :: - |= {src/ship cof/lobby pes/crowd gaz/(list telegram)} - ^+ +> - :: continue if permitted and not yet done. - ?. (~(has in may.fed.shape) src) +> - ?: (~(has in fes.fed.shape) src) +> - :: assimilate config. - =. +> - =+ nec=shape - :: adopt security list if they're similar. - =. ses.con.nec ::TODO =? - ?. .= ?=(?($white $green) sec.con.nec) - ?=(?($white $green) sec.con.loc.cof) - ses.con.nec - (~(uni in ses.con.nec) ses.con.loc.cof) - =. fes.fed.nec - (~(put in fes.fed.nec) src) - =. src.nec - (~(put in src.nec) [%& src nom]) - ::TODO maybe do more granular deltas later. - (so-delta-our %config so-cir %full nec) - :: assimilate presence and remotes. - ::TODO!!! just delta my shit up famalam. - ::TODO should totally just make an arm that calculates deltas given - :: old and new inputs. - ::=. locals (~(uni by loc.pes) locals) - ::=. remotes (~(uni by rem.pes) remotes) - ::=. mirrors (~(uni by rem.cof) mirrors) - :::: remove redundant remotes. - ::=. remotes - :: %- ~(gas by *_remotes) - :: %+ murn (~(tap by remotes)) - :: |= {p/partner g/group} - :: ^- (unit {partner group}) - :: ?: ?& ?=($& -.p) - :: =(nom.p.p nom) - :: (~(has in fes.fed.shape) hos.p.p) - :: == - :: ~ - :: `[p g] - :::: remove redundant mirrors. - ::=. mirrors - :: %- ~(gas by *_mirrors) - :: %+ murn (~(tap by mirrors)) - :: |= {c/circle f/config} - :: ^- (unit {circle config}) - :: ?: ?& =(nom.c nom) - :: (~(has in fes.fed.shape) hos.c) - :: == - :: ~ - :: `[c f] - :: finally, learn all grams. + =. +>.$ + (so-hear | src %config src %full loc.cos) + ::TODO we'd need a %precs diff-story for this if we don't want to urn... + =. +>.$ + %- ~(rep in loc.pes) + |= {{w/ship s/status} _+>.$} + (so-hear | src %status [%& src] w %full s) (so-lesson gaz) :: - ++ so-relieve ::< remove federator - ::> if {src} is allowed to, removes {who} as - ::> federators from this story. + ++ so-hear ::< accept circle rumor + ::> :: - |= {src/ship who/(set ship)} + |= {bur/? src/circle dif/diff-story} ^+ +> - ?. (~(has in fes.fed.shape) src) +> - =+ wos=(~(uni in fes.fed.shape) who) - ?~ wos +>.$ - =. +>.$ - (so-delta-our %config so-cir %federal | & wos) - %- so-delta-our - :+ %config so-cir - :+ %source | - %- ~(run in `(set ship)`wos) ::TODO? why need to cast? - |=(s/ship [%& s nom]) + ::TODO? these checks are still important, because + :: when things are slow we may get diffs from + :: things we already unsubscribed from, right? + ::TODO account for federation. + ~? ?! ?| (~(has in sre.shape) [%& src]) + =(src so-cir) + == + [%unexpected-rumor-source nom -.dif src] + ?- -.dif + ::TODO we check for foreigns here, but they should just not get sent + :: in the first place. update ++-change or whatever! + :: (we don't care for remote remotes, etc.) + $new $(dif [%config src %full con.dif]) + $bear ~&(%so-hear-unexpected-bear +>) + $grams (so-lesson gaz.dif) + $config ::TODO accept burden change by parents. + :: ignore foreign mirrors. + ?. |(=(src cir.dif) =(src so-cir)) + ~& %unexpected-ignoring-remote-config + +> + (so-delta-our dif) + $status :: ignore foreign remotes. + ?. |(=([%& src] pan.dif) =(src so-cir)) + ~& %unexpected-ignoring-remote-status + +> + (so-delta-our dif) + $follow ~&(%follow-not-rumor +>) ::TODO crash? + $remove (so-delta-our %config src %remove ~) + == :: ::> || ::> || %changes @@ -789,10 +748,10 @@ |= {add/? pas/(set partner)} ^+ +> =/ sus/(set partner) - %. src.shape + %. sre.shape ?:(add ~(dif in pas) ~(int in pas)) ?~ sus +>.$ - (so-delta-our %config so-cir %source add sus) + (so-delta-our %follow & sus) :: ++ so-depict ::< change description ::> modifies our caption. @@ -810,28 +769,6 @@ ?: =(fit fit.shape) +> (so-delta-our %config so-cir %filter fit) :: - ++ so-federate ::< change federators - ::> adds or removes sis as active/allow - ::> ({fed} y/n) federators. - :: - |= {add/? fed/? sis/(set ship)} - =+ ses=?:(fed fes.fed.shape may.fed.shape) - =/ sus/(set ship) - %. ses - ?:(add ~(dif in sis) ~(int in sis)) - ?~ sus +>.$ - :: we also take care of the %src delta because we - :: want to keep delta application as simple as - :: possible. - =. +>.$ ::TODO =? - ?. fed +>.$ - %- so-delta-our - :+ %config so-cir - :+ %source add - %- ~(run in `(set ship)`sus) ::TODO weird casting need, depends on ?~ - |= s/ship [%& s nom] - (so-delta-our %config so-cir %federal add fed sus) - :: ++ so-delete ::< delete story ::> deletes this story. removes it from {stories} ::> and unsubscribes from all src. @@ -860,13 +797,21 @@ ::> arms for starting and ending subscriptions ::+| :: - ++ so-leave ::< unsub from source + ++ so-greet ::< subscription started + ::> + :: + |= pan/partner + ^+ +> + ?: (~(has in sre.shape) pan) +> + (so-delta-our %config so-cir %sourcee & [pan ~ ~]) + :: + ++ so-leave ::< subscription ended ::> delete {pan} from our sources. :: |= pan/partner ^+ +> - ?. (~(has in src.shape) pan) +> - (so-delta-our %config so-cir %source | [pan ~ ~]) + ?. (~(has in sre.shape) pan) +> + (so-delta-our %config so-cir %sourcee | [pan ~ ~]) :: ++ so-start ::< subscribe follower ::> called upon subscribe. deduces the range of @@ -978,22 +923,23 @@ |= gam/telegram ^+ +> :: check for write permissions. - ?. (so-admire aut.gam) +>.$ + ?. (so-admire aut.gam) +> :: clean up the message to conform to our rules. =. tot.gam (so-sane tot.gam) =. aud.tot.gam ::> if we are in the audience, mark as received. - =+ ole=(~(get by aud.tot.gam) [%& our.bol nom]) - ?^ ole (~(put by aud.tot.gam) [%& our.bol nom] -.u.ole %received) - ::> federated circles need to pretend ~src/nom - ::> is also ~our/nom. + =+ ole=(~(get by aud.tot.gam) so-pan) + ?^ ole (~(put by aud.tot.gam) so-pan -.u.ole %received) + ::TODO can we delete the below? seems old federation? ::TODO pass src through explicitly instead of :: relying on src.bol. + ::TODO? ^ why? =+ ole=(~(get by aud.tot.gam) [%& src.bol nom]) ?~ ole aud.tot.gam - ::> as described above, fake src into our. + ::TODO below line is old federation, but should work for our current + :: use case, right? why doesn't it? =. aud.tot.gam (~(del by aud.tot.gam) [%& src.bol nom]) - (~(put by aud.tot.gam) [%& our.bol nom] -.u.ole %received) + (~(put by aud.tot.gam) so-pan -.u.ole %received) (so-delta-our %grams [gam ~]) :: ::> || @@ -1046,8 +992,8 @@ |= her/ship ^- ? ?- sec.con.shape - $black !(~(has in ses.con.shape) her) ::< channel, blacklist - $white (~(has in ses.con.shape) her) ::< village, whitelist + $black !(~(has in ses.con.shape) her) ::< channel, blacklist + $white (~(has in ses.con.shape) her) ::< village, whitelist $green & ::< journal, all $brown (team our.bol her) ::< mailbox, our team == @@ -1096,41 +1042,19 @@ ++ da-react ::< send reaction ::> sends a talk-reaction diff to a reader. :: - ::TODO send the delta instead! (remove bone from delta: always ost.bol?) + ::TODO argument always ost.bol? seems to be that way |= {red/bone rac/reaction} %- da-emit + ~? !=(red ost.bol) %react-different-bones ::TODO is diff the way to react to a poke? [red %diff %talk-reaction rac] :: - ++ da-bear ::< share burden - ::> - :: - |= cir/circle - =+ soy=(~(got by stories) nom.cir) - %- da-emit - :* ost.bol - %poke - /burden - [hos.cir %talk-guardian] - :* %talk-command - %burden - nom.cir - [shape.soy mirrors.soy] - [locals.soy remotes.soy] - grams.soy - == - == - :: ::> || ::> || %data ::> || ::> utility functions for data retrieval. ::+| :: - ::TODO functions for getting readers or followers of a specific story from - :: the subs in sup.bol. - :: but maybe just on the outer core... - :: ::> || ::> || %change-application ::> || @@ -1154,11 +1078,43 @@ $glyph (da-change-glyph +.dif) $nick (da-change-nick +.dif) $story (da-change-story +.dif) - $bear (da-bear +.dif) + $init da-init + $observe (da-observe +.dif) $react (da-react +.dif) $quit (da-emit [ost.dif %quit ~]) == :: + ++ da-init ::< startup side-effects + ::> + :: + =+ sen=(sein our.bol) + ::TODO move this logic to ta-init + ?: ?| !=(%czar (clan sen)) + =(sen our.bol) + =(%pawn (clan our.bol)) + == + ..da-init + %- da-emit + :* 0 + %peer + /burden + [sen %talk-guardian] + /burden + == + :: + ++ da-observe ::< watch burden bearer + ::> + :: + |= who/ship + ~& [%peering-report who] + %- da-emit + :* 0 + %peer + /report + [who %talk-guardian] + /report + == + :: ++ da-change-out ::< outgoing messages ::> :: @@ -1170,25 +1126,31 @@ :* %poke /repeat/(scot %ud p.outbox)/(scot %p hos.cir)/[nom.cir] [hos.cir %talk-guardian] - [%talk-command %review i.out ~] + [%talk-command %publish i.out ~] == - $(p.outbox +(p.outbox), q.outbox (~(put by q.outbox) p.outbox i.out)) + %= $ + p.outbox +(p.outbox) + q.outbox (~(put by q.outbox) p.outbox i.out) + out t.out + == :: ++ da-change-done ::< sent & receives msgs ::> :: - |= don/(list {num/@ud who/partner gud/?}) + ::TODO this needs a lot of work, maybe? + :: make this dumber, make the ++ta equivalent smarter! + |= don/(list {num/@ud who/partner fal/(unit tang)}) ^+ +> ?~ don +> =+ oot=(~(get by q.outbox) num.i.don) - ?~ oot ~|([%da-change-done-none num.i.don] !!) + ?~ oot ~&([%da-change-done-none num.i.don] +>.$) ::TODO crash? =. aud.u.oot =+ olg=(~(got by aud.u.oot) who.i.don) %+ ~(put by aud.u.oot) who.i.don :- -.olg - ?:(gud.i.don %received %rejected) + ?~(fal.i.don %received ~>(%slog.[0 u.fal.i.don] %rejected)) =. +>.$ - +>.$ ::TODO!!! da-think?????????? + +>.$ ::TODO!!! da-think??? $(q.outbox (~(del by q.outbox) num.i.don)) ::|= {num/@ud pan/partner fal/(unit tang)} ::=+ oot=(~(get by q.outbox) num) @@ -1210,7 +1172,6 @@ ^+ +> ?: bin %_ +> - nik (~(put by nik) pas gyf) nak (~(put ju nak) gyf pas) == =/ ole/(list (set partner)) @@ -1219,7 +1180,6 @@ |- ^+ +>.^$ ?~ ole +>.^$ %_ $ - nik (~(del by nik) i.ole) nak (~(del ju nak) gyf i.ole) ole t.ole == @@ -1244,34 +1204,40 @@ :: |= {nom/knot dif/diff-story} ^+ +> - ::TODO just ~(got by stories) everywhere in ++da, the - :: relevant checks should be made when constructing - :: the deltas. ?+ -.dif sa-done:(~(sa-change sa nom (~(got by stories) nom)) dif) :: $new (da-create nom +.dif) + $bear (da-bear nom +.dif) $remove (da-delete nom) == :: ++ da-create ::< configure story ::> creates story {nom} with config {con}. :: - |= {nom/knot con/config} + |= {nom/knot cof/config} ^+ +> :: if it's a whitelisted circle, put us in it. - =. ses.con.con ::TODO =? - ?: ?=(?($white $green) sec.con.con) + =. ses.con.cof ::TODO =? + ?: ?=(?($white $green) sec.con.cof) [our.bol ~ ~] - ses.con.con - :: also ensure we're listed as a federator. - =. may.fed.con - (~(put in may.fed.con) our.bol) - =. fes.fed.con - (~(put in fes.fed.con) our.bol) + ses.con.cof + :: make sure it's its own source. + ::TODO? is this... necessary? probably, for other circle's reference... + =. sre.cof + (~(put in sre.cof) [%& our.bol nom]) =< sa-done - %- ~(sa-change sa nom *story) - [%config [our.bol nom] %full con] + :: default for ? is &, so we manually set to | now. + %- ~(sa-change sa nom %*(. *story burden |)) + [%config [our.bol nom] %full cof] + :: + ++ da-bear ::< accept new burden + ::> + :: + |= {nom/knot bur/burden} + ^+ +> + =+ soy=(fall (~(get by stories) nom) *story) + sa-done:(~(sa-bear sa nom soy) bur) :: ++ da-delete ::< delete story ::> calls the story core to delete story {nom}. @@ -1325,6 +1291,14 @@ (flop (turn cub |=(a/card [ost a]))) :: ::> || + ::> || %data ::TODO consistent naming! + ::> || + ::+| + :: + ++ sa-cir [our.bol nom] + ++ sa-pan [%& our.bol nom] + :: + ::> || ::> || %delta-application ::> || ::> arms for applying deltas. @@ -1333,12 +1307,48 @@ ++ sa-delete ::< deletion of story ::> :: - (sa-abjure (~(tap in src.shape))) + (sa-abjure (~(tap in sre.shape))) + :: + ++ sa-bear ::< ... + ::> + ::> for now, just overwrite all existing state. + :: + ::TODO should we calculate these changes in + :: ++so instead? the change to burden is + :: distinct, but everything else is just + :: more of the same deltas. + |= {gaz/(list telegram) cos/lobby pes/crowd} + ^+ +> + :: local config + =. +> + (sa-change-local %config sa-cir %full loc.cos) + :: remote config + =. +> + %+ roll (~(tap by rem.cos)) + |= {{r/circle c/config} _..sa-bear} + (sa-change-remote %config r %full c) + :: local presence + =. +> + %+ roll (~(tap by loc.pes)) + |= {{w/ship s/status} _..sa-bear} + (sa-change-local %status sa-pan w %full s) + :: remote presence + =. +> + %+ roll (~(tap by rem.pes)) + |= {{p/partner g/group} _..sa-bear} + %+ roll (~(tap by g)) + |= {{w/ship s/status} _..sa-bear} + (sa-change-remote %status p w %full s) + :: telegrams + =. +> + %+ roll gaz + |= {g/telegram _..sa-bear} + (sa-change-gram g) + :: burden flag + +>(burden &) :: ++ sa-change ::< apply circle delta ::> - ::> we don't do checks for federation here, this - ::> should have happened during delta generation. :: |= dif/diff-story ^+ +> @@ -1347,7 +1357,7 @@ sa-change-local :: $config - ?: =(cir.dif [our.bol nom]) + ?: =(cir.dif sa-cir) sa-change-local sa-change-remote :: @@ -1368,7 +1378,7 @@ $grams |- ^+ +>.^$ ?~ gaz.dif +>.^$ - =. +>.^$ (sa-change-grams i.gaz.dif) + =. +>.^$ (sa-change-gram i.gaz.dif) $(gaz.dif t.gaz.dif) :: $config @@ -1385,9 +1395,23 @@ (fall (~(get by locals) who.dif) *status) dif.dif == + :: + $follow + :: we have to do the effects first, because it + :: checks for new sub targets using sre.shape. + ~& [%sa-change-follow nom sub.dif pas.dif] + =. +> + (sa-emil (sa-follow-effects sub.dif pas.dif)) + %_ +> ::TODO delete, only done once success + sre.shape ::TODO =? + %. pas.dif + ?: sub.dif + ~(uni in sre.shape) + ~(dif in sre.shape) + == == :: - ++ sa-change-grams ::< save/update message + ++ sa-change-gram ::< save/update message ::> :: |= gam/telegram @@ -1439,61 +1463,62 @@ ++ sa-config-effects ::< config side-effects ::> :: + ::TODO we shouldn't even be applying %full diffs, only their results! |= {old/config dif/diff-config} ^- (list move) ?+ -.dif ~ - $source (sa-source-effects src.old +.dif) $permit (sa-permit-effects sec.con.old ses.con.old +.dif) - :: - $federal - ?. fed.dif ~ - %^ sa-source-effects src.old add.dif - %- ~(run in sis.dif) - |= s/ship [%& s nom] :: $full + ~& %full-config-changes =* new cof.dif :: deal with subscription changes. =/ sem .= ?=(?($white $green) sec.con.new) ?=(?($white $green) sec.con.old) ;: weld - (sa-source-effects src.old | (~(dif in src.old) src.new)) - (sa-source-effects src.old & (~(dif in src.new) src.old)) + ::TODO but these needs to be treated as %sourcee, right? + ::(sa-follow-effects | (~(dif in sre.old) sre.new)) + ::(sa-follow-effects & (~(dif in src.new) src.old)) + :: ?. sem ~ %^ sa-permit-effects sec.con.new ses.con.old [| (~(dif in ses.con.old) ses.con.new)] + :: ?. sem ~ %^ sa-permit-effects sec.con.new ses.con.old [& (~(dif in ses.con.new) ses.con.old)] - ::TODO maybe do federal source changes, but also take above source - :: changes into account: don't do doubles! == == :: - ++ sa-source-effects ::< un/subscribe + ++ sa-follow-effects ::< un/subscribe ::> :: - |= {old/(set partner) add/? pas/(set partner)} + |= {sub/? pas/(set partner)} ^- (list move) =/ sus/(set partner) - %. old - ?:(add ~(dif in pas) ~(int in pas)) - %. (~(tap in `(set partner)`sus)) ::TODO *need* to cast? - ?:(add sa-acquire sa-abjure) + %. sre.shape + ?:(sub ~(dif in pas) ~(int in pas)) + %. (~(tap in sus)) + ?:(sub sa-acquire sa-abjure) :: ++ sa-permit-effects ::< notify permitted ::> :: + ::TODO this seems to also be done in the action, + :: there makes more sense because logic goes into ta. |= {sec/security old/(set ship) add/? sis/(set ship)} ^- (list move) + =/ sus/(set ship) + %. ses.con.shape + ?:(add ~(dif in sis) ~(int in sis)) =/ wyt ?=(?($white $green) sec) =/ inv =(wyt add) ?: inv ::TODO %inv & speeches ~ ::TODO %inv | speeches - (sa-eject sis) + (sa-eject sus) :: ::> || ::> || %subscriptions @@ -1510,6 +1535,7 @@ %+ turn pas |= pan/partner ^- (list card) + ?: =(pan [%& our.bol nom]) ~ :: ignore self-subs ::TODO also abjure? ::> subscribe starting at the last message we got, ::> or if we haven't gotten any yet, messages ::> from up to a day ago. @@ -1543,6 +1569,7 @@ $& ::< circle partner :_ ~ :* %pull + ::TODO update path /friend/show/[nom]/(scot %p hos.p.pan)/[nom.p.pan] [hos.p.pan %talk-guardian] ~ @@ -1559,7 +1586,7 @@ [b %quit ~] :: ++ sa-unearth ::< ships' bones - ::> find the bones in {followers} that belong to + ::> find the bones in {sup.bol} that belong to ::> a ship in {sis}. :: |= sis/(set ship) @@ -1642,54 +1669,112 @@ :_ +>.$ :(welp mos (affection dif)) :: +++ pre-bake ::< apply more deltas + ::> + :: + |= dis/(list delta) + ^- (quip move +>) + %+ roll dis + |= {d/delta m/(list move) _+>.$} ::TODO ^$ nest-fails, is this correct? + =^ mos +>.^$ (f-bake d) + [(welp m mos) +>.^$] +:: ++ g-query ::< query on state ::> :: |= weg/(list coin) - ::TODO how would the system know how to parse the path? - :: should we define that ourselves? - :: ...i just want to cast to ++query if i can. ::TODO should return (unit prize)? ie for /circle/non-existing ^- prize - ?~ weg ~&(%empty-query !!) - ?: =(i.weg [%$ %tas %reader]) + =+ qer=(coins-to-query weg) + ?- -.qer + $reader [%reader nak nicks] - ?: =(i.weg [%$ %tas %friend]) + :: + $friend :- %friend %- ~(gas in *(set circle)) %+ murn - =- (~(tap in src.shape.-)) + =- (~(tap in sre.shape.-)) (~(got by stories) (main our.bol)) |= p/partner ^- (unit circle) ?. ?=($& -.p) ~ [~ p.p] - ?: ?& =(i.weg [%$ %tas %circle]) - ?=(^ t.weg) - ?=({$$ p/$ta q/@ta} i.t.weg) - == + :: + $burden + :- %burden + %- ~(gas in *(map knot burden)) + %+ murn (~(tap by stories)) + |= {n/knot s/story} + ^- (unit (pair knot burden)) + :: only auto-federate channels for now. + ?. ?=($black sec.con.shape.s) ~ + :+ ~ n + :+ grams.s + [shape.s mirrors.s] + [locals.s remotes.s] + :: + $report + ::TODO want to return no prize + [%friend ~] + :: + $circle :- %circle - =+ soy=(~(got by stories) +>.i.t.weg) + =+ soy=(~(got by stories) nom.qer) :+ grams.soy ::TODO get using specified range. [shape.soy mirrors.soy] [locals.soy remotes.soy] - ~&(%invalid-query !!) + == +:: +++ tmp-their-change ::< diff-story to theirs + ::> + :: + |= {who/ship dif/diff-story} + ^- diff-story + ?+ -.dif + dif + :: + $config + ?. =(hos.cir.dif our.bol) dif + dif(cir [who nom.cir.dif]) + :: + $status + ?. &(?=($& -.pan.dif) =(hos.p.pan.dif our.bol)) dif + dif(pan [%& who nom.p.pan.dif]) + == +:: +++ tmp-clean-change ::< remove remotes + ::> + :: + |= {nom/knot dif/diff-story} + ^- (unit diff-story) + ?+ -.dif + `dif + :: + $config + ?. =(cir.dif [our.bol nom]) ~ + `dif + :: + $status + ?. =(pan.dif [%& our.bol nom]) ~ + `dif + == :: ++ i-change ::< delta to rumor ::> :: - ::TODO probably want to do "affected by" checks for every bone, - :: and just construct the rumor once. - |= {weg/(list coin) dif/delta} + |= {who/ship weg/(list coin) dif/delta} ^- (unit rumor) - ?~ weg ~&(%empty-query !!) - ?: =(i.weg [%$ %tas %reader]) + =+ qer=(coins-to-query weg) + ?- -.qer + $reader :: changes to shared ui state apply. ?+ -.dif ~ $glyph `[%reader dif] $nick `[%reader dif] == - ?: =(i.weg [%$ %tas %friend]) + :: + $friend :: new or removed local stories apply. ::TODO include mailbox sources. check privacy flags. ?. ?=($story -.dif) ~ @@ -1700,50 +1785,91 @@ == ?~ add ~ `[%friend u.add [our.bol nom.dif]] - ?: ?& =(i.weg [%$ %tas %circle]) - ?=(^ t.weg) - ?=({$$ p/$ta q/@ta} i.t.weg) - == + :: + $burden + ::TODO only avoid src.bol when they sent a burden or similar? + ::TODO shouldn't this prevent senders from getting their message echoed + :: to them? + ?: =(who src.bol) ~ ?. ?=($story -.dif) ~ - ?. =(+>.i.t.weg nom.dif) ~ + :: only burden channels for now. + ?. =(%black sec.con.shape:(~(got by stories) nom.dif)) ~ + ~& [%sending-burden nom.dif -.dif.dif who] + `[%burden nom.dif (tmp-their-change who dif.dif)] + :: + $report + :: only send changes we didn't get from above. + ?: =(src.bol (sein our.bol)) ~ + :: only send story reports about grams and status. + ?. ?=($story -.dif) ~ + ?. ?=(?($grams $status) -.dif.dif) ~ + =+ soy=(~(got by stories) nom.dif) + :: and only if the story is inherited. + ?. burden.soy ~ + :: only burden channels for now. + ?. =(%black sec.con.shape.soy) ~ + ~& [%sending-report nom.dif -.dif.dif who] + `[%burden nom.dif (tmp-their-change who dif.dif)] + :: + $circle + ?. ?=($story -.dif) ~ + ?. =(nom.qer nom.dif) ~ + ?: ?=($follow -.dif.dif) ~ :: internal-only delta + ~& [%sending-circle nom.dif -.dif.dif who] `[%circle dif.dif] - ~&(%invalid-query !!) + == :: ++ affection ::< rumors to interested ::> :: ::TODO probably want to do "affected by" checks for every bone, - :: and just construct the rumor once. + :: and just construct the rumor once. |= dif/delta ^- (list move) %+ murn (~(tap by sup.bol)) |= {b/bone s/ship p/path} ^- (unit move) - =+ rum=(i-change (tmp-parse-path p) dif) + =+ rum=(i-change s (path-to-coins p) dif) ::TODO %quit bones that are done with their subscription. :: ...but that would also require a ta-cancel call to remove :: them from the presence list! how do? ?~ rum ~ `[b %diff %talk-rumor u.rum] :: -++ tmp-parse-path ::< ... +++ path-to-query ::< ... + ::> + :: + |= pax/path + (coins-to-query (path-to-coins pax)) +:: +++ path-to-coins ::< ... ::> :: |= pax/path ^- (list coin) - ?~ pax ~ - :- [%$ %tas `@tas`i.pax] - ?. =(%circle `@tas`i.pax) ~ - ?~ t.pax ~&(%invalid-circle-path !!) - :- [%$ %ta `@ta`i.t.pax] - ~ - ::=+ tmp=((hard range) t.t.pax) - ::?~ tmp ~ - :::- hed.u.tmp - ::?~ t.u.tmp ~ - ::[tal.u.t.u.tmp ~] + %+ turn `path`pax + |= a/@ta + (need (slay a)) :: -++ tmp-parse-peer-path ::< ... +++ coins-to-query ::< ... + ::> + :: + ^- $-((list coin) query) + ::TODO silently crashes, make it loud! + => depa + |^ %- af :~ + [%reader ul] + [%friend ul] + [%burden ul] + [%report ul] + [%circle (al knot rang)] + == + ++ knot (do %tas) + ++ rang (mu (al plac (mu (un plac)))) + ++ plac (or %da %ud) + -- +:: +++ tmp-parse-diff-path ::< ... ::> :: |= pax/path @@ -1759,25 +1885,18 @@ :: |= {who/ship weg/(list coin)} ^- ? - ::TODO - ::?: ?=({$reader *} pax) - :: ?. (team our.bol her) - :: %- ta-note - :: (crip "foreign reader {(scow %p her)}") - :: (ta-welcome ost.bol t.pax) - :::: weird subscription path. - ::?. ?=({@ *} pax) - :: (ta-evil %bad-path) - ::=+ pur=(~(get by stories) i.pax) - ::?~ pur - :: ::TODO send this to the subscriber! make them unsub! - :: %- ta-note - :: (crip "bad subscribe story '{(trip i.pax)}'") - ::=+ soy=~(. so i.pax `(list action)`~ u.pur) :: nest-fail if no cast - :::: she needs read permissions to subscribe. - ::?. (so-visible:soy her) - :: (ta-evil %no-story) - & + =+ qer=(coins-to-query weg) + ?- -.qer + $reader (team our.bol who) + $friend & + $burden =(our.bol (sein who)) + $report =(who (sein our.bol)) + :: + $circle + ?. (~(has by stories) nom.qer) | + %. who + ~(so-visible so:ta nom.qer ~ (~(got by stories) nom.qer)) + == :: ::> || ::> || %poke-events @@ -1790,7 +1909,7 @@ |= cod/command ^- (quip move +>) =^ mos +>.$ - %- f-bake :- %more + %- pre-bake ta-done:(ta-apply:ta src.bol cod) =^ mow +>.$ log-all-to-file @@ -1802,11 +1921,11 @@ |= act/action ^- (quip move +>) ?. (team src.bol our.bol) - %- f-bake :- %more + %- pre-bake =< ta-done %- ta-note:ta %- crip "talk-action stranger {(scow %p src.bol)}" - %- f-bake :- %more + %- pre-bake ta-done:(ta-action:ta ost.bol act) :: ::> || @@ -1814,16 +1933,26 @@ ::> || ::+| :: +++ diff-talk-prize ::< accept prize + ::> + :: + |= {wir/wire piz/prize} + ^- (quip move +>) + =^ mos +>.$ + %- pre-bake + ta-done:(ta-take:ta wir piz) + =^ mow +>.$ + log-all-to-file + [(welp mos mow) +>.$] +:: ++ diff-talk-rumor ::< accept rumor ::> :: |= {wir/wire dif/rumor} ^- (quip move +>) =^ mos +>.$ - %- f-bake :- %more - ::TODO parse wire to get source and target of change - =+ res=(tmp-parse-peer-path wir) - ta-done:(ta-hear:ta p.res [%& q.res] dif) + %- pre-bake + ta-done:(ta-hear:ta wir dif) =^ mow +>.$ log-all-to-file [(welp mos mow) +>.$] @@ -1834,22 +1963,21 @@ |= pax/path ^- (quip move +>) ?: ?=({$sole *} pax) ~&(%talk-broker-no-sole !!) - =+ qer=(tmp-parse-path pax) + =+ qer=(path-to-coins pax) ?. (leak src.bol qer) ~&(%peer-invisible !!) =^ mos +>.$ - %- f-bake :- %more + %- pre-bake ta-done:(ta-subscribe:ta src.bol pax) :_ +>.$ :_ mos [ost.bol %diff %talk-prize (g-query qer)] - :: ++ pull ::< unsubscribe ::> unsubscribes. :: |= pax/path ^- (quip move +>) - %- f-bake :- %more + %- pre-bake ta-done:(ta-cancel:ta src.bol pax) :: ++ reap-friend ::< subscription n/ack @@ -1859,12 +1987,14 @@ ::TODO this should deal with /reader subscriptions too. |= {wir/wire fal/(unit tang)} ^- (quip move +>) - ?~ fal [~ +>] %+ etch-friend [%friend wir] |= {nom/knot cir/circle} + ?~ fal + %- pre-bake + ta-done:(ta-greet:ta nom cir) =. u.fal [>%reap-friend-fail nom cir< u.fal] %- (slog (flop u.fal)) - %- f-bake :- %more + %- pre-bake ta-done:(ta-leave:ta nom cir) :: ++ quit-friend ::< dropped subscription @@ -1891,7 +2021,7 @@ ^- (quip move +>) %+ etch-repeat [%repeat wir] |= {num/@ud src/ship nom/knot} - (f-bake %done (strap num [%& src nom] ?=($~ fal))) + (f-bake %done (strap num [%& src nom] fal)) :: ::> || ::> || %logging diff --git a/app/talk.hoon b/app/talk.hoon deleted file mode 100644 index c7452a07f6..0000000000 --- a/app/talk.hoon +++ /dev/null @@ -1,2894 +0,0 @@ -:: :: :: -:::: /hoon/talk/app :: :: - :: :: :: -:: -::TODO master changes -::TODO =/ instead of =+ ^= where possible -::TODO avoid lark where possible -::TODO remove old/unused code -::TODO improve naming -::TODO tidiness -:: -/? 310 :: hoon version -/- talk, sole :: structures -/+ talk, sole, time-to-id, twitter :: libraries -/= seed /~ !>(.) -:: -:::: - :: -::x include talk and sole cores from the /+ include into our subject, -::x so we can do some-arm instead of some-arm:talk. -[. talk sole] -=> |% :: data structures - ++ house {$6 house-6} :: full state - ++ house-any :: app history - $% {$3 house-3} :: 3: talk - {$4 house-4} :: 4: talk - {$5 house-5} :: 5: talk - {$6 house-6} :: 5: talk - == :: - ++ house-3 :: - %+ cork house-4 |= house-4 :: modern house with - +<(stories (~(run by stories) story-3)) :: old stories - ++ house-4 :: - %+ cork house-5 |= house-5 :: modern house with - +<(shells (~(run by shells) shell-4)) :: no settings - ++ house-5 :: - %+ cork house-6 |= house-6 :: modern house with - +<(shells (~(run by shells) shell-5)) :: auto-audience - ++ house-6 :: - $: stories/(map knot story) :: conversations - general/(set bone) :: meta-subscribe - outbox/(pair @ud (map @ud thought)) :: urbit outbox - folks/(map ship human) :: human identities - shells/(map bone shell) :: interaction state - log/(map knot @ud) :: logged to clay - nik/(map (set partner) char) :: bound station glyphs - nak/(jug char (set partner)) :: station glyph lookup - == :: - ++ story-3 (cork story |=(story +<(|10 &11.+<))) :: missing glyphers - ++ story :: wire content - $: count/@ud :: (lent grams) - grams/(list telegram) :: all history - locals/(map ship (pair @da status)) :: local presence - remotes/(map partner atlas) :: remote presence - mirrors/(map station config) :: remote config - sequence/(map partner @ud) :: partners heard - shape/config :: configuration - known/(map serial @ud) :: messages heard - gramsers/(map bone river) :: message followers - groupers/(set bone) :: presence followers - cabalers/(set bone) :: config followers - glyphers/(set bone) :: glyph followers - == :: - ++ shell :: console session - $: her/ship :: client identity - man/knot :: mailbox - count/@ud :: messages shown - say/sole-share :: console state - active/{$~ u/(set partner)} :: active targets - $passive-deprecated :: passive targets - owners/register :: presence mirror - harbor/(map knot (pair posture cord)) :: stations mirror - system/cabal :: config mirror - settings/(set knot) :: frontend settings - == :: - ++ shell-5 :: has passive - %+ cork shell |= shell :: - %= +< :: - &6 passive=*(set partner) :: - active *(unit (set partner)) :: - == :: - ++ shell-4 (cork shell-5 |=(shell-5 +<(|8 &9.+<))):: missing settings - ++ river (pair point point) :: stream definition - ++ point :: stream endpoint - $% {$ud p/@ud} :: by number - {$da p/@da} :: by date - == :: - ++ move (pair bone card) :: all actions - ++ lime :: diff fruit - $% {$talk-report report} :: - {$sole-effect sole-effect} :: - == :: - ++ pear :: poke fruit - $% {$talk-command command} :: - {$write-comment spur ship cord} :: - {$write-fora-post spur ship cord cord} :: - == :: - ++ card :: general card - $% {$diff lime} :: - {$info wire @p @tas nori} :: - {$peer wire dock path} :: - {$poke wire dock pear} :: - {$pull wire dock $~} :: - {$quit $~} :: - == :: - ++ weir :: parsed wire - $% {$repeat p/@ud q/@p r/knot} :: - {$friend p/knot q/station} :: - == :: - ++ work :: interface action - $% {$number p/$@(@ud {@u @ud})} :: relative/absolute - {$help $~} :: print usage info - {$who p/where} :: presence - {$what p/$@(char (set partner))} :: show bound glyph - {$bind p/char q/(unit where)} :: - {$join p/where} :: - {$leave p/where} :: - {$say p/(list speech)} :: - {$eval p/cord q/twig} :: - {$invite p/knot q/(list partner)} :: whitelist add - {$banish p/knot q/(list partner)} :: blacklist add - {$block p/knot q/(list partner)} :: blacklist add - {$author p/knot q/(list partner)} :: whitelist add - {$nick p/(unit ship) q/(unit cord)} :: - {$set p/knot} :: - {$unset p/knot} :: - {$target p/where q/(unit work)} :: set active targets - :: {$destroy p/knot} :: - {$create p/posture q/knot r/cord} :: - {$probe p/station} :: - == :: - ++ where (set partner) :: non-empty audience - ++ sigh :: assemble label - ::x? why is this not in ++ta? - :: - |= {len/@ud pre/tape yiz/cord} - ^- tape - =+ nez=(trip yiz) - =+ lez=(lent nez) - ?> (gth len (lent pre)) - =. len (sub len (lent pre)) - ?. (gth lez len) - =. nez (welp pre nez) - ?. (lth lez len) nez - (runt [(sub len lez) '-'] nez) - :(welp pre (scag (dec len) nez) "+") - ++ glyphs `wall`~[">=+-" "}),." "\"'`^" "$%&@"] :: station char pool' - ++ peer-type :: stream requests - ::x helper functions for determining/specifying from/in a path, what kind - ::x of subscription our peer wants/what they're interested in. - :: - =< apex - |% - ++ apex ?($a-group $f-grams $v-glyph $x-cabal) :: options - ++ encode |=(a/apex ^-(char (end 3 1 a))) :: by first char - ++ decode :: discriminate - |= a/char ^- apex - ?+ a ~|(bad-subscription-designator+a !!) - $a %a-group - $f %f-grams - $v %v-glyph - $x %x-cabal - == - -- - -- -|% -:: old protocol workaround door -++ timed - ::x? seems hacky. if old, should be removed in "new talk", right? - ::x? seems like it's used for adding/dealing with "fake"/workaround ships - ::x? with datetimes in their status. but why? - ::x looking at ++pa-remind, this can safely be deleted when breaching state. - :: - ::x a: stations with ships and their status. - |_ a/(map partner atlas) :: XX (map partner (pair @da atlas)) - ++ strip - ::x removes workaround ships from all partner's status lists. - :: - (~(run by a) |=(b/atlas (~(del by b) `@p`%timed-sub))) - :: - ++ put :: XX put:by - ::x adds workaround ship to d with pretty-printed date c in its status, - ::x then adds it to a with key/partner b. - :: - |= {b/partner c/@da d/atlas} - =/ sta/status [%gone [~ (some (scot %da c))]] - (~(put by a) b (~(put by d) `@p`%timed-sub sta)) - :: - ++ decode-status - ::x attempts to retrieve datetime from status (as inserted by put:timed). - :: - |= a/status ^- (unit @da) - ?. ?=({$gone $~ $~ tym/@t} a) ~ - => .(a `{$gone $~ $~ tym/@t}`a) - (slaw %da tym.a) - :: - ++ uni - ::x union of two station-shipstatus maps. - :: - |= b/_a ^+ a - :: XX efficiency - %- ~(uni by a) - %- ~(urn by b) - |= nb/{p/partner q/atlas} - ?. (~(has by a) p.nb) q.nb - =/ qna (~(got by a) p.nb) - :: XX p.qna p.q.nb - =/ pqna (biff (~(get by qna) `@p`%timed-sub) decode-status) - ?~ pqna q.nb - =/ pqnb (biff (~(get by q.nb) `@p`%timed-sub) decode-status) - ?~ pqnb qna - ?: (gth u.pqna u.pqnb) qna - ?: (gth u.pqnb u.pqna) q.nb - :: unfortunately, multiple reports on the same channel can - :: be sent on the same event, necessitating last-wins - :: ~| uni-timed+[n.a n.b] - :: ?> =(n.a n.b) - q.nb - -- --- -|_ {hid/bowl house} -++ ra :: per transaction - ::x gets called when talk gets poked or otherwise prompted/needs to perform - ::x an action. - ::x arms generally modify state, and store moves in ++ra's moves. these get - ::x produced when calling ++ra-abet. - ::x in applying commands and making reports, it uses ++pa for story work. - :: - ::x moves: moves storage, added to by ++ra-emit and -emil, produced by -abed. - |_ moves/(list move) - ++ sh :: per console - ::x shell core, responsible for doing things with console sessions, - ::x like parsing input, acting based on input, showing output, keeping - ::x track of settings and other frontend state. - ::x important arms include ++sh-repo which is used to apply reports, and - ::x ++sh-sole which gets called upon cli prompt interaction. - ::x any talk commands the core's arms want to have executed get put into - ::x coz. the stored commands get applied upon calling ++sh-abet. - :: - |_ $: ::x coz: talk commands storage, applied by ++sh-abet. - ::x she: console session state used in this core. - :: - coz/(list command) :: talk actions - she/shell - == - ++ sh-scad :: command parser - ::x builds a core with parsers for talk-cli, and produces its work arm. - ::x ++work uses those parsers to parse the current talk-cli prompt input - ::x and produce a work item to be executed by ++sh-work. - :: - =< work - |% - ++ expr :: [cord twig] - |= tub/nail %. tub - %+ stag (crip q.tub) - wide:(vang & [&1:% &2:% (scot %da now.hid) |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) - :: - ++ pasp :: passport - ;~ pfix pat - ;~ pose - (stag %twitter ;~(pfix (jest 't') col urs:ab)) - == - == - :: - ++ stan :: station - ;~ pose - (cold [our.hid man.she] col) - ;~(pfix cen (stag our.hid sym)) - ;~(pfix fas (stag (sein our.hid) sym)) - :: - %+ cook - |= {a/@p b/(unit term)} - [a ?^(b u.b (main a))] - ;~ plug - ship - (punt ;~(pfix fas urs:ab)) - == - == - :: - ++ parn :: partner - ;~ pose - (stag %& stan) - (stag %| pasp) - == - ++ partners-flat :: collapse mixed list - |= a/(list (each partner (set partner))) - ^- (set partner) - ?~ a ~ - ?- -.i.a - $& (~(put in $(a t.a)) p.i.a) - $| (~(uni in $(a t.a)) p.i.a) - == - :: - ++ para :: partners alias - %+ cook partners-flat - %+ most ;~(plug com (star ace)) - (pick parn (sear sh-glyf glyph)) - :: - ++ parz :: non-empty partners - %+ cook ~(gas in *(set partner)) - (most ;~(plug com (star ace)) parn) - :: - ++ nump :: number reference - ;~ pose - ;~(pfix hep dem:ag) - ;~ plug - (cook lent (plus (just '0'))) - ;~(pose dem:ag (easy 0)) - == - (stag 0 dem:ag) - == - :: - ++ pore :: posture - ;~ pose - (cold %black (jest %channel)) - (cold %white (jest %village)) - (cold %green (jest %journal)) - (cold %brown (jest %mailbox)) - == - :: - ++ message - ;~ pose - ;~(plug (cold %eval hax) expr) - :: - %+ stag %say - %+ most (jest '•') - ;~ pose - (stag %url aurf:urlp) - :(stag %lin | ;~(pfix pat text)) - :(stag %lin & ;~(less sem hax text)) - == - == - :: - ++ nick (cook crip (stun [1 14] low)) :: nickname - ++ text (cook crip (plus (shim ' ' '~'))) :: bullets separating - ++ glyph (mask "/\\\{( ::x points to ++sh's |_ core's context. - =+ zoc=(flop coz) - |- ^+ +>+> ::x +> would point to |-'s context. +>+> goes to ++sh |_'s. - ::x produce context with this shell updated. - ?~ zoc +>+>.$(shells (~(put by shells) ost.hid she)) - ::x recurse, with context (of |-?) modified. - $(zoc t.zoc, +>.$ (sh-deal i.zoc)) - :: - ++ sh-deal :: apply from shell - ::x used by ++sh-abet, applies an individual talk command. - :: - |= cod/command - ^+ +> - ?- -.cod - ::x the $design command is used for modifying channel configs, - ::x which is done when joining, leaving or creating channels. - $design - ?~ q.cod - ::x updates context with new config state. - =. +>+>.$ (ra-config p.cod *config) - ::x produces context with story p.cod deleted. - +>.$(stories (~(del by stories) p.cod)) - ::x produces +> with its +> (so, +>+>) updated by ++ra-think. - +>(+> (ra-config p.cod u.q.cod)) - :: - ::x used for relaying messages (as a station host). - $review +>(+> (ra-think | her.she +.cod)) - ::x used for sending messages (as their author). - $publish +>(+> (ra-think & her.she +.cod)) - == - :: - ++ sh-fact :: send console effect - ::x adds a console effect to ++ra's moves. - :: - |= fec/sole-effect - ^+ +> - +>(moves :_(moves [ost.hid %diff %sole-effect fec])) - :: - ++ sh-peep :: peer to path - ::x? unused? - :: - |= pax/path - ^+ +> - +>(+> (ra-subscribe her.she pax)) - :: - ++ sh-peer :: subscribe shell - ::x create a shell, subscribe to default stories. - :: - =< sh-prod - %_ . - +> - =/ typ - =+ (ly ~[%a-group %f-grams %x-cabal]) - (rap 3 (turn - encode:peer-type)) - ::x subscriptions to the shell's ship's default channels. - (ra-subscribe:(ra-subscribe her.she ~) her.she [typ man.she ~]) - == - :: - ++ sh-prod :: show prompt - ::x make and store a move to modify the cli prompt, displaying audience. - :: - ^+ . - %+ sh-fact %pro - :+ & %talk-line - ^- tape - =/ rew/(pair (pair @t @t) (set partner)) - [['[' ']'] u.active.she] - =+ cha=(~(get by nik) q.rew) - ?^ cha ~[u.cha ' '] - :: ~& [rew nik nak] - =+ por=~(te-prom te man.she q.rew) - (weld `tape`[p.p.rew por] `tape`[q.p.rew ' ' ~]) - :: - ++ sh-pact :: update active aud - ::x change currently selected audience to lix, updating prompt. - :: - |= lix/(set partner) - ^+ +> - =+ act=(sh-pare lix) ::x ensure we can see what we send. - ?~ act ~|(%no-audience !!) ::x? this can't actually happen, right? - ?: =(active.she `act) +>.$ - sh-prod(active.she `act) - :: - ++ sh-pare :: adjust target list - ::x if the audience paz does not contain a partner we're subscribed to, - ::x add our mailbox to the audience (so that we can see our own message). - :: - |= paz/(set partner) - ?: (sh-pear paz) paz - (~(put in paz) [%& our.hid man.she]) - :: - ++ sh-pear :: hearback - ::x produces true if any partner is included in our subscriptions, - ::x aka, if we hear messages sent to paz. - :: - |= paz/(set partner) - ?~ paz | - ?| $(paz l.paz) - $(paz r.paz) - (~(has in sources.shape:(~(got by stories) man.she)) `partner`n.paz) - == - :: - ++ sh-pest :: report listen - ::x updates audience to be tay, only if tay is not a village/%white. - ::x? why exclude village (invite-only?) audiences from this? - :: - |= tay/partner - ^+ +> - ?. ?=($& -.tay) +> ::x if partner is a passport, do nothing. - =+ sib=(~(get by ham.system.she) `station`p.tay) ::x get config for tay - ?. |(?=($~ sib) !?=($white p.cordon.u.sib)) - +>.$ - (sh-pact [tay ~ ~]) - :: - ++ sh-rend :: print on one line - ::x renders a telegram as a single line, adds it as a console move, - ::x and updates the selected audience to match the telegram's. - :: - |= gam/telegram - =+ lin=~(tr-line tr man.she settings.she gam) - (sh-fact %txt lin) - :: - ++ sh-numb :: print msg number - ::x does as it says on the box. - :: - |= num/@ud - ^+ +> - =+ bun=(scow %ud num) - %+ sh-fact %txt - (runt [(sub 13 (lent bun)) '-'] "[{bun}]") - :: - ++ sh-glyf :: decode glyph - ::x gets the partner(s) that match a glyph. - ::x? why (set partner)? it seems like it only ever returns a single one. - ::TODO should produce a set when ambiguous. - :: - |= cha/char ^- (unit (set partner)) - =+ lax=(~(get ju nak) cha) - ?: =(~ lax) ~ ::x no partner. - ?: ?=({* $~ $~} lax) `n.lax ::x single partner. - ::x in case of multiple partners, pick the most recently active one. - =+ grams=grams:(~(got by stories) man.she) - |- ^- (unit (set partner)) - ?~ grams ~ - ::x get first partner from a telegram's audience. - =+ pan=(silt (turn (~(tap by q.q.i.grams)) head)) - ?: (~(has in lax) pan) `pan - $(grams t.grams) - :: - ::TODO we have a stdlib set diff now! - ++ sh-repo-house-diff - ::x calculates difference between two shelves (channel definitions). - :: - |= {one/shelf two/shelf} - =| $= ret - $: old/(list (pair knot (pair posture cord))) - new/(list (pair knot (pair posture cord))) - cha/(list (pair knot (pair posture cord))) - == - ^+ 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-repo-atlas-diff - ::x calculates the difference between two atlasses (presence lists). - :: - |= {one/atlas two/atlas} - =| $= 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 p.q.i.eno) ret - =+ unt=(~(get by two) p.i.eno) - ?~ unt - ret(old [i.eno old.ret]) - ?: =(%gone p.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 p.q.i.owt) ret - ?. (~(has by one) p.i.owt) - ret(new [i.owt new.ret]) - ?: =(%gone p:(~(got by one) p.i.owt)) - ret(new [i.owt new.ret]) - ret - ret - :: - ++ sh-repo-cabal-diff - ::x calculates the difference between two cabals (station configurations) - :: - |= {one/(map station config) two/(map station config)} - =| $= ret - $: old/(list (pair station config)) - new/(list (pair station config)) - cha/(list (pair station 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-repo-rogue-diff - ::x calculates the difference between two maps of stations and their - ::x presence lists. - :: - |= {one/(map partner atlas) two/(map partner atlas)} - =| $= ret - $: old/(list (pair partner atlas)) - new/(list (pair partner atlas)) - cha/(list (pair partner atlas)) - == - =. one ~(strip timed one) - =. two ~(strip timed two) - ^+ 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-repo-whom-diff - ::x calculates the difference between two partner sets. - :: - |= {one/(set partner) two/(set partner)} - =| $= ret - $: old/(list partner) - new/(list partner) - == - ^+ ret - =. ret - =+ eno=(~(tap by one)) - |- ^+ ret - ?~ eno ret - =. ret $(eno t.eno) - ?: (~(has in two) i.eno) - ret - ret(old [i.eno old.ret]) - =. ret - =+ owt=(~(tap by two)) - |- ^+ ret - ?~ owt ret - =. ret $(owt t.owt) - ?: (~(has in one) i.owt) - ret - ret(new [i.owt new.ret]) - ret - :: - ++ sh-repo-ship-diff - ::x calculates the difference between two ship sets. - :: - |= {one/(set ship) two/(set ship)} - =| $= ret - $: old/(list ship) - new/(list ship) - == - ^+ ret - =. ret - =+ eno=(~(tap by one)) - |- ^+ ret - ?~ eno ret - =. ret $(eno t.eno) - ?: (~(has in two) i.eno) - ret - ret(old [i.eno old.ret]) - =. ret - =+ owt=(~(tap by two)) - |- ^+ ret - ?~ owt ret - =. ret $(owt t.owt) - ?: (~(has in one) i.owt) - ret - ret(new [i.owt new.ret]) - ret - :: - ++ sh-puss - ::x posture as text. - :: - |= a/posture ^- tape - ?- a - $black "channel" - $brown "mailbox" - $white "village" - $green "journal" - == - :: - ++ sh-repo-config-exceptions - ::x used by ++sh-repo-config-show to aid in printing info to cli. - :: - |= {pre/tape por/posture old/(list ship) new/(list ship)} - =+ out=?:(?=(?($black $brown) por) "try " "cut ") - =+ inn=?:(?=(?($black $brown) por) "ban " "add ") - =. +>.$ - |- ^+ +>.^$ - ?~ old +>.^$ - =. +>.^$ $(old t.old) - (sh-note :(weld pre out " " (scow %p i.old))) - =. +>.$ - |- ^+ +>.^$ - ?~ new +>.^$ - =. +>.^$ $(new t.new) - (sh-note :(weld pre out " " (scow %p i.new))) - +>.$ - :: - ++ sh-repo-config-sources - ::x used by ++sh-repo-config-show to aid in printing info to cli, - ::x pertaining to the un/subscribing to partners. - :: - |= {pre/tape old/(list partner) new/(list partner)} - ^+ +> - =. +>.$ - |- ^+ +>.^$ - ?~ old +>.^$ - =. +>.^$ $(old t.old) - (sh-note (weld pre "off {~(ta-full ta man.she i.old)}")) - =. +>.$ - |- ^+ +>.^$ - ?~ new +>.^$ - =. +>.^$ $(new t.new) - (sh-note (weld pre "hey {~(ta-full ta man.she i.new)}")) - +>.$ - :: - ++ sh-repo-config-show - ::x prints config changes to the cli. - :: - |= {pre/tape laz/config loc/config} - ^+ +> - =. +>.$ - ?: =(caption.loc caption.laz) +>.$ - (sh-note :(weld pre "cap " (trip caption.loc))) - =. +>.$ - %+ sh-repo-config-sources - (weld (trip man.she) ": ") - (sh-repo-whom-diff sources.laz sources.loc) - ?: !=(p.cordon.loc p.cordon.laz) - =. +>.$ (sh-note :(weld pre "but " (sh-puss p.cordon.loc))) - %^ sh-repo-config-exceptions - (weld (trip man.she) ": ") - p.cordon.loc - [~ (~(tap in q.cordon.loc))] - %^ sh-repo-config-exceptions - (weld (trip man.she) ": ") - p.cordon.loc - (sh-repo-ship-diff q.cordon.laz q.cordon.loc) - :: - ++ sh-repo-cabal-changes - ::x used by ++sh-repo-cabal for printing cabal config changes to cli. - :: - |= $: laz/(map station config) - old/(list (pair station config)) - new/(list (pair station config)) - cha/(list (pair station config)) - == - =. +>.$ - |- ^+ +>.^$ - ?~ new +>.^$ - =. +>.^$ $(new t.new) - =. +>.^$ (sh-pest [%& p.i.new]) - %+ sh-repo-config-show - (weld ~(sn-phat sn man.she p.i.new) ": ") - [*config q.i.new] - =. +>.$ - |- ^+ +>.^$ - ?~ cha +>.^$ - =. +>.^$ $(cha t.cha) - %+ sh-repo-config-show - (weld ~(sn-phat sn man.she p.i.cha) ": ") - [(~(got by laz) `station`p.i.cha) q.i.cha] - +>.$ - :: - ++ sh-repo-cabal - ::x updates the current shell's cabal and prints changes to cli. - :: - |= bal/cabal - ^+ +> - =+ laz=system.she - =. system.she bal - =. +>.$ - %+ sh-repo-cabal-changes ham.laz - (sh-repo-cabal-diff ham.laz ham.bal) - (sh-repo-config-show "" loc.laz loc.bal) - :: - ++ sh-repo-house - ::x applies new shelf ("house"?) and prints changes to cli. - :: - |= awl/(map knot (pair posture cord)) - ^+ +> - =+ dif=(sh-repo-house-diff harbor.she awl) - =. harbor.she awl - =. +>.$ - |- ^+ +>.^$ - ?~ old.dif +>.^$ - =. +>.^$ $(old.dif t.old.dif) - (sh-note "cut {(sh-puss p.q.i.old.dif)} %{(trip p.i.old.dif)}") - =. +>.$ - |- ^+ +>.^$ - ?~ new.dif +>.^$ - =. +>.^$ $(new.dif t.new.dif) - =+ :* nam=(trip p.i.new.dif) - por=(sh-puss p.q.i.new.dif) - des=(trip q.q.i.new.dif) - == - (sh-note "new {por} %{nam}: {des}") - =. +>.$ - |- ^+ +>.^$ - ?~ cha.dif +>.^$ - =. +>.^$ $(cha.dif t.cha.dif) - =+ :* nam=(trip p.i.cha.dif) - por=(sh-puss p.q.i.cha.dif) - des=(trip q.q.i.cha.dif) - == - (sh-note "mod %{nam}: {por}, {des}") - +>.$ - :: - ++ sh-note :: shell message - ::x prints a txt to cli in talk's format. - :: - |= txt/tape - ^+ +> - (sh-fact %txt (runt [14 '-'] `tape`['|' ' ' (scag 64 txt)])) - :: - ++ sh-spaz :: print status - ::x gets the presence of a status. - :: - |= saz/status - ^- tape - ['%' (trip p.saz)] - :: - ++ sh-repo-group-diff-here :: print atlas diff - ::x prints presence notifications. - :: - |= $: pre/tape - $= cul - $: old/(list (pair ship status)) - new/(list (pair ship status)) - cha/(list (pair ship status)) - == - == - ?: (~(has in settings.she) %quiet) - +>.$ - =. +>.$ - |- ^+ +>.^$ - ?~ old.cul +>.^$ - =. +>.^$ $(old.cul t.old.cul) - (sh-note (weld pre "bye {(scow %p p.i.old.cul)}")) - =. +>.$ - |- ^+ +>.^$ - ?~ new.cul +>.^$ - =. +>.^$ $(new.cul t.new.cul) - %- sh-note - (weld pre "met {(scow %p p.i.new.cul)} {(sh-spaz q.i.new.cul)}") - =. +>.$ - |- ^+ +>.^$ - ?~ cha.cul +>.^$ - %- sh-note - (weld pre "set {(scow %p p.i.cha.cul)} {(sh-spaz q.i.cha.cul)}") - +>.$ - :: - ++ sh-repo-group-here :: update local - ::x updates local presence store and prints changes. - :: - |= loc/atlas - ^+ +> - =+ cul=(sh-repo-atlas-diff p.owners.she loc) - =. p.owners.she loc - (sh-repo-group-diff-here "" cul) - :: - ++ sh-repo-group-there :: update foreign - ::x updates remote presences(?) and prints changes. - :: - |= yid/(map partner atlas) - =+ day=(sh-repo-rogue-diff q.owners.she yid) - =+ dun=q.owners.she - =. q.owners.she yid - ?: (~(has in settings.she) %quiet) - +>.$ - =. +>.$ - |- ^+ +>.^$ - ?~ old.day +>.^$ - =. +>.^$ $(old.day t.old.day) - (sh-note (weld "not " (~(ta-show ta man.she p.i.old.day) ~))) - =. +>.$ - |- ^+ +>.^$ - ?~ new.day +>.^$ - =. +>.^$ $(new.day t.new.day) - =. +>.^$ - (sh-note (weld "new " (~(ta-show ta man.she p.i.new.day) ~))) - (sh-repo-group-diff-here "--" ~ (~(tap by q.i.new.day)) ~) - =. +>.$ - |- ^+ +>.^$ - ?~ cha.day +>.^$ - =. +>.^$ $(cha.day t.cha.day) - =. +>.^$ - (sh-note (weld "for " (~(ta-show ta man.she p.i.cha.day) ~))) - =+ yez=(~(got by dun) p.i.cha.day) - %+ sh-repo-group-diff-here "--" - (sh-repo-atlas-diff yez q.i.cha.day) - +>.$ - :: - ++ sh-repo-group - ::x update local and remote presences. - :: - |= ges/register - ^+ +> - =. +> (sh-repo-group-here p.ges) - =. +> (sh-repo-group-there q.ges) - +> - :: - ++ sh-repo-gram - ::x renders telegram: increase gram count and print the gram. - ::x every fifth gram, prints the number. - :: - |= {num/@ud gam/telegram} - ^+ +> - ?: =(num count.she) - =. +> ?:(=(0 (mod num 5)) (sh-numb num) +>) - (sh-rend(count.she +(num)) gam) - ?: (gth num count.she) - =. +> (sh-numb num) - (sh-rend(count.she +(num)) gam) - +> - :: - ++ sh-repo-grams :: apply telegrams - ::x renders telegrams. - :: - |= {num/@ud gaz/(list telegram)} - ^+ +> - ?~ gaz +> - $(gaz t.gaz, num +(num), +> (sh-repo-gram num i.gaz)) - :: - ++ sh-repo-glyph :: apply binding - ::x updates glyph bindings and lookup, and updates selected audience. - :: - |= nac/(jug char (set partner)) - ^+ +> - %_ sh-prod - nak nac - nik %- ~(gas by *(map (set partner) char)) - =- (zing `(list (list {(set partner) char}))`-) - %+ turn (~(tap by nac)) - |= {a/char b/(set (set partner))} - (turn (~(tap by b)) |=(c/(set partner) [c a])) - == - :: - ++ sh-repo :: apply report - ::x applies the different kinds of reports using their handler arms above - :: - |= rad/report - ^+ +> - :: ~& [%sh-repo rad] - ?- -.rad - $cabal (sh-repo-cabal +.rad) - $grams (sh-repo-grams +.rad) - $glyph (sh-repo-glyph +.rad) :: XX ever happens? - $group (sh-repo-group +.rad) - $house (sh-repo-house +.rad) - == - :: - ++ sh-sane-chat :: sanitize chatter - ::x (for chat messages) sanitizes the input buffer and splits it into - ::x multiple lines ('•'). - :: - |= buf/(list @c) - ^- (list sole-edit) - ?~ buf ~ - =+ isa==(i.buf (turf '@')) - =+ [[pre=*@c cur=i.buf buf=t.buf] inx=0 brk=0 len=0 new=|] - =* txt -< - |^ ^- (list sole-edit) - ?: =(cur (turf '•')) - ?: =(pre (turf '•')) - [[%del inx] ?~(buf ~ $(txt +.txt))] - ?: new - [(fix ' ') $(cur `@c`' ')] - newline - ?: =(cur `@`' ') - =. brk ?:(=(pre `@`' ') brk inx) - ?. =(64 len) advance - :- (fix(inx brk) (turf '•')) - ?: isa - [[%ins +(brk) (turf '@')] newline(new &)] - newline(new &) - ?: =(64 len) - =+ dif=(sub inx brk) - ?: (lth dif 64) - :- (fix(inx brk) (turf '•')) - ?: isa - [[%ins +(brk) (turf '@')] $(len dif, new &)] - $(len dif, new &) - [[%ins inx (turf '•')] $(len 0, inx +(inx), new &)] - ?: |((lth cur 32) (gth cur 126)) - [(fix '?') advance] - ?: &((gte cur 'A') (lte cur 'Z')) - [(fix (add 32 cur)) advance] - advance - :: - ++ advance ?~(buf ~ $(len +(len), inx +(inx), txt +.txt)) - ++ newline ?~(buf ~ $(len 0, inx +(inx), txt +.txt)) - ++ fix |=(cha/@ [%mor [%del inx] [%ins inx `@c`cha] ~]) - -- - :: - ++ sh-sane :: sanitize input - ::x parses cli prompt input using ++sh-scad and sanitizes when invalid. - :: - |= {inv/sole-edit buf/(list @c)} - ^- {lit/(list sole-edit) err/(unit @u)} - =+ res=(rose (tufa buf) sh-scad) - ?: ?=($| -.res) [[inv]~ `p.res] - :_ ~ - ?~ p.res ~ - =+ wok=u.p.res - |- ^- (list sole-edit) - ?+ -.wok ~ - $target ?~(q.wok ~ $(wok u.q.wok)) - $say |- :: XX per line - ?~ p.wok ~ - ?: ?=($lin -.i.p.wok) - (sh-sane-chat buf) - $(p.wok t.p.wok) - == - :: - ++ sh-slug :: edit to sanity - ::x corrects invalid prompt input. - :: - |= {lit/(list sole-edit) err/(unit @u)} - ^+ +> - ?~ lit +> - =^ lic say.she - (~(transmit sole say.she) `sole-edit`?~(t.lit i.lit [%mor lit])) - (sh-fact [%mor [%det lic] ?~(err ~ [%err u.err]~)]) - :: - ++ sh-stir :: apply edit - ::x called when typing into the talk prompt. applies the change and does - ::x sanitizing. - :: - |= cal/sole-change - ^+ +> - =^ inv say.she (~(transceive sole say.she) cal) - =+ fix=(sh-sane inv buf.say.she) - ?~ lit.fix - +>.$ - ?~ err.fix - (sh-slug fix) :: just capital correction - ?. &(?=($del -.inv) =(+(p.inv) (lent buf.say.she))) - +>.$ :: allow interior edits, deletes - (sh-slug fix) - :: - ++ sh-lame :: send error - ::x just puts some text into the cli. - :: - |= txt/tape - (sh-fact [%txt txt]) - :: - ++ sh-whom :: current audience - ::x produces the currently selected audience for this shell. - :: - ^- audience - %- ~(gas by *audience) - %+ turn (~(tap in u.active.she)) - |=(a/partner [a *envelope %pending]) - :: - ++ sh-tell :: add command - ::x adds talk command to core state. these get applied with ++sh-abet. - :: - |= cod/command - %_(+> coz [cod coz]) - :: - ++ sh-twig-head ^- vase :: eval data - ::x makes a vase of environment data to evaluate against (#-messages). - :: - !>(`{our/@p now/@da eny/@uvI}`[our.hid now.hid (shas %eny eny.hid)]) - :: - ++ sh-work :: do work - ::x implements worker arms for different talk commands. - ::x all worker arms must produce updated state/context. - :: - |= job/work - ^+ +> - =+ roy=(~(got by stories) man.she) - =< work - |% - ++ work - ?- -.job - $number (number +.job) - $leave (leave +.job) - $join (join +.job) - $eval (eval +.job) - $who (who +.job) - $what (what +.job) - $bind (bind +.job) - $invite (invite +.job) - $banish (banish +.job) - $author (author +.job) - $block (block +.job) - $create (create +.job) - $nick (nick +.job) - $set (wo-set +.job) - $unset (unset +.job) - $target (target +.job) - $probe (probe +.job) - $help help - $say (say +.job) - == - :: - ++ activate :: from %number - |= gam/telegram - ^+ ..sh-work - =+ tay=~(. tr man.she settings.she gam) - =. ..sh-work (sh-fact tr-fact:tay) - sh-prod(active.she `tr-pals:tay) - :: - ++ help - (sh-fact %txt "see http://urbit.org/docs/using/messaging/") - :: - ++ glyph - |= idx/@ - =< cha - %+ reel glyphs - |= {all/tape ole/{cha/char num/@}} - =+ new=(snag (mod idx (lent all)) all) - =+ num=~(wyt in (~(get ju nak) new)) - ?~ cha.ole [new num] - ?: (lth num.ole num) - ole - [new num] - :: - ++ set-glyph - |= {cha/char lix/(set partner)} - =: nik (~(put by nik) lix cha) - nak (~(put ju nak) cha lix) - == - %_ ..sh-work - ..pa - %- (ra-know man.she) - |=(_pa pa-abet:(pa-report glyphers %glyph nak)) - == - :: - ++ join :: %join - |= pan/(set partner) - ^+ ..sh-work - =. ..sh-work - =+ (~(get by nik) pan) - ?^ - (sh-note "has glyph {}") - =+ cha=(glyph (mug pan)) - (sh-note:(set-glyph cha pan) "new glyph {}") - =+ loc=loc.system.she - ::x change local mailbox config to include subscription to pan. - %^ sh-tell %design man.she - `loc(sources (~(uni in sources.loc) pan)) - :: - ++ leave :: %leave - |= pan/(set partner) - ^+ ..sh-work - =+ loc=loc.system.she - ::x change local mailbox config to exclude subscription to pan. - %^ sh-tell %design man.she - `loc(sources (~(dif in sources.loc) pan)) - :: - ++ what :: %what - |= qur/$@(char (set partner)) ^+ ..sh-work - ?^ qur - =+ cha=(~(get by nik) qur) - (sh-fact %txt ?~(cha "none" [u.cha]~)) - =+ pan=(~(tap in (~(get ju nak) qur))) - ?: =(~ pan) (sh-fact %txt "~") - =< (sh-fact %mor (turn pan .)) - |=(a/(set partner) [%txt ]) :: XX ~(te-whom te man.she a) - :: - ++ who :: %who - |= pan/(set partner) ^+ ..sh-work - =< (sh-fact %mor (murn (sort (~(tap by q.owners.she) ~) aor) .)) - |= {pon/partner alt/atlas} ^- (unit sole-effect) - ?. |(=(~ pan) (~(has in pan) pon)) ~ - =- `[%tan rose+[", " `~]^- leaf+~(ta-full ta man.she pon) ~] - =< (murn (sort (~(tap by alt)) aor) .) - |= {a/ship b/presence c/human} ^- (unit tank) :: XX names - ?- b - $gone ~ - $hear `>a< - $talk `>a< :: XX difference - == - :: - ++ bind :: %bind - |= {cha/char pan/(unit (set partner))} ^+ ..sh-work - ?~ pan $(pan [~ u.active.she]) - =+ ole=(~(get by nik) u.pan) - ?: =(ole [~ cha]) ..sh-work - (sh-note:(set-glyph cha u.pan) "bound {} {}") - :: - ++ invite :: %invite - |= {nom/knot tal/(list partner)} - ^+ ..sh-work - !! - :: - ++ block :: %block - |= {nom/knot tal/(list partner)} - ^+ ..sh-work - !! - :: - ++ author :: %author - |= {nom/knot tal/(list partner)} - ^+ ..sh-work - !! - :: - ++ banish :: %banish - |= {nom/knot tal/(list partner)} - ^+ ..sh-work - !! - :: - ++ create :: %create - |= {por/posture nom/knot txt/cord} - ^+ ..sh-work - ?: (~(has in stories) nom) - (sh-lame "{(trip nom)}: already exists") - =. ..sh-work - ::x create new config for channel. - %^ sh-tell %design nom - :- ~ - :+ *(set partner) - (end 3 64 txt) - [por ~] - (join [[%& our.hid nom] ~ ~]) - :: - ++ reverse-folks - |= nym/knot - ^- (list ship) - %+ murn (~(tap by folks)) - |= {p/ship q/human} - ?~ hand.q ~ - ?. =(u.hand.q nym) ~ - [~ u=p] - :: - ++ nick :: %nick - |= {her/(unit ship) nym/(unit cord)} - ^+ ..sh-work - ?: ?=({$~ $~} +<) - %+ sh-fact %mor - %+ turn (~(tap by folks)) - |= {p/ship q/human} - :- %txt - ?~ hand.q - "{

}:" - "{

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

}: {}"] - %= ..sh-work - folks ?~ u.nym - (~(del by folks) u.her) - (~(put by folks) u.her [true=~ hand=nym]) - == - :: - ++ wo-set :: %set - |= seg/knot - ^+ ..sh-work - ?~ seg - %+ sh-fact %mor - %+ turn (~(tap in settings.she)) - |= s/knot - [%txt (trip s)] - %= ..sh-work - settings.she (~(put in settings.she) seg) - == - :: - ++ unset :: %unset - |= neg/knot - ^+ ..sh-work - %= ..sh-work - settings.she (~(del in settings.she) neg) - == - :: - ++ target :: %target - |= {pan/(set partner) woe/(unit ^work)} - ^+ ..sh-work - =. ..sh-pact (sh-pact pan) - ?~(woe ..sh-work work(job u.woe)) - :: - ++ number :: %number - |= num/$@(@ud {p/@u q/@ud}) - ^+ ..sh-work - =+ roy=(~(got by stories) man.she) - |- - ?@ num - ?: (gte num count.roy) - (sh-lame "{(scow %s (new:si | +(num)))}: no such telegram") - =. ..sh-fact (sh-fact %txt "? {(scow %s (new:si | +(num)))}") - (activate (snag num grams.roy)) - ?. (gth q.num count.roy) - ?~ count.roy - (sh-lame "0: no messages") - =+ msg=(deli (dec count.roy) num) - =. ..sh-fact (sh-fact %txt "? {(scow %ud msg)}") - (activate (snag (sub count.roy +(msg)) grams.roy)) - (sh-lame "…{(reap p.num '0')}{(scow %ud q.num)}: no such telegram") - :: - ++ deli :: find number - |= {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))) - :: - ++ probe :: inquire - |= cuz/station - ^+ ..sh-work - ~& [%probe cuz] - ..sh-work - :: - ++ eval :: run - |= {txt/cord exe/twig} - => |.([(sell (slap (slop sh-twig-head seed) exe))]~) - =+ tan=p:(mule .) - (say [%fat tank+tan exp+txt] ~) - :: - ++ say :: publish - |= sep/(list speech) - ^+ ..sh-work - =- ..sh-work(coz ?~(tot coz :_(coz [%publish tot]))) - |- ^- tot/(list thought) - ?~ sep ~ - =^ sir ..sh-work sh-uniq - [[sir sh-whom [now.hid ~ i.sep]] $(sep t.sep)] - -- - :: - ++ sh-done :: apply result - ::x called upon hitting return in the prompt. if input is invalid, - ::x ++sh-slug is called. otherwise, the appropriate work is done - ::x 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-scad) - ?~ jub (sh-fact %bel ~) - %. u.jub - =< sh-work - =+ buf=buf.say.she - =^ cal say.she (~(transmit sole say.she) [%set ~]) - %- sh-fact - :* %mor - [%nex ~] - [%det cal] - ?. ?=({$';' *} buf) ~ - :_ ~ - [%txt (runt [14 '-'] `tape`['|' ' ' (tufa `(list @)`buf)])] - == - :: - ++ sh-sole :: apply edit - ::x applies sole action. - :: - |= act/sole-action - ^+ +> - ?- -.act - $det (sh-stir +.act) - $clr ..sh-sole :: (sh-pact ~) :: XX clear to PM-to-self? - $ret sh-done - == - :: - ++ sh-uniq - ::x generates a new serial. - :: - ^- {serial _.} - [(shaf %serial eny.hid) .(eny.hid (shax eny.hid))] - -- - ++ ra-abed :: resolve core - ::x produces the moves stored in ++ra's moves. - ::x sole-effects get special treatment to become a single move. - :: - ^+ [*(list move) +>] - :_ +> - ::x seperate our sole-effects from other moves. - =+ ^= yop - |- ^- (pair (list move) (list sole-effect)) - ?~ moves [~ ~] - =+ mor=$(moves t.moves) - ?: ?& =(ost.hid p.i.moves) - ?=({$diff $sole-effect *} q.i.moves) - == - [p.mor [+>.q.i.moves q.mor]] - [[i.moves p.mor] q.mor] - ::x flop moves, flop and squash sole-effects into a %mor. - =+ :* moz=(flop p.yop) - ^= foc ^- (unit sole-effect) - ?~ q.yop ~ - ?~(t.q.yop `i.q.yop `[%mor (flop `(list sole-effect)`q.yop)]) - == - ::x produce moves or sole-effects and moves. - ?~(foc moz [[ost.hid %diff %sole-effect u.foc] moz]) - :: - ++ ra-abet :: complete core - ::x applies talk reports, then produces moves and updated state. - :: - ra-abed:ra-axel - :: - ++ ra-axel :: rebound reports - ::x extracts and applies the talk-reports in moves. - :: - ^+ . - ::x separate our talk-reports from other moves. - =+ ^= rey - |- ^- (pair (list move) (list (pair bone report))) - ?~ moves - [~ ~] - =+ mor=$(moves t.moves) - ?. ?& (~(has by shells) `bone`p.i.moves) - ?=({$diff $talk-report *} q.i.moves) - == - [[i.moves p.mor] q.mor] - [p.mor [[p.i.moves +>.q.i.moves] q.mor]] - ::x update moves to exclude talk-reports. - =. moves p.rey - =. q.rey (flop q.rey) - ?: =(q.rey ~) + - |- ^+ +> - ?~ q.rey ra-axel - ::x apply reports. - =+ bak=(ra-back(ost.hid p.i.q.rey) q.i.q.rey) - $(q.rey t.q.rey, +> bak(ost.hid ost.hid)) - :: - ++ ra-back - ::x applies report. - :: - |= rad/report - ^+ +> - sh-abet:(~(sh-repo sh ~ (~(got by shells) ost.hid)) rad) - :: - ++ ra-sole - ::x applies sole-action. - :: - |= act/sole-action - ^+ +> - =+ shu=(~(get by shells) ost.hid) - ?~ shu - ~| :+ %ra-console-broken ost.hid - ?:((~(has by sup.hid) ost.hid) %lost %unknown) - !! - sh-abet:(~(sh-sole sh ~ u.shu) act) - :: - ++ ra-emil :: ra-emit move list - ::x adds multiple moves to the core's list. flops to emulate ++ra-emit. - :: - |= mol/(list move) - %_(+> moves (welp (flop mol) moves)) - :: - ++ ra-emit :: emit a move - ::x adds a move to the core's list. - :: - |= mov/move - %_(+> moves [mov moves]) - :: - ++ ra-evil :: emit error - ::x stack trace and crash. - :: - |= msg/cord - ~| [%ra-evil msg] - !! - :: - ++ ra-house :: emit partners - ::x emits a talk-report move containing all our stories? - ::x? this is for showing people what they can subscribe to, right? - ::x? but this also shows invite-only stories, aren't they secret clubs? - :: - |= ost/bone - %+ ra-emit ost.hid - :+ %diff %talk-report - :- %house - %- ~(gas in *(map knot (pair posture cord))) - %+ turn (~(tap by stories)) - |=({a/knot b/story} [a p.cordon.shape.b caption.shape.b]) - :: - ++ ra-homes :: update partners - ::x send a list of our stories to all general subscribers. - :: - =+ gel=general - |- ^+ +> - ?~ gel +> - =. +> $(gel l.gel) - =. +> $(gel r.gel) - (ra-house n.gel) - :: - ++ ra-init :: initialize talk - ::x populate state on first boot. creates our main and public stories. - :: - %+ roll - ^- (list {posture knot cord}) - :~ [%brown (main our.hid) 'default home'] - [%green ~.public 'visible activity'] - == - |: [[typ=*posture man=*knot des=*cord] ..ra-init] ^+ ..ra-init - %+ ra-apply our.hid - :+ %design man - :- ~ :- ~ - [des [typ ~]] - :: - ++ ra-apply :: apply command - ::x applies the command sent by her. - :: - |= {her/ship cod/command} - ^+ +> - ?- -.cod - ::x the $design command is used for modifying channel configs, - ::x which is done when joining, leaving or creating channels. - ::x this may only be done by ourselves. - ::x? shouldn't this be team-only too? - $design - ?. =(her our.hid) - (ra-evil %talk-no-owner) - ?~ q.cod - ?. (~(has by stories) p.cod) - (ra-evil %talk-no-story) - ::x? why delete story if we got no config? can't we overwrite? - (ra-config(stories (~(del by stories) p.cod)) p.cod *config) - (ra-config p.cod u.q.cod) - :: - ::x used for relaying messages (as a station host). - $review (ra-think | her +.cod) - :: - ::x used for sending messages (as their author). - $publish - ?. (team our.hid her) +>.$ - (ra-think & her +.cod) - == - :: - ++ ra-config :: configure story - ::x (re)configures story man. if it's a new story, emit our stories. - :: - |= {man/knot con/config} - ^+ +> - =+ :- neu=(~(has by stories) man) - pur=(fall (~(get by stories) man) *story) - =. +>.$ pa-abet:(~(pa-reform pa man pur) con) - ?:(neu +>.$ ra-homes) - :: - ++ ra-base-hart - ::x produces our ship's host desk's web address as a hart. - :: - .^(hart %e /(scot %p our.hid)/host/(scot %da now.hid)) - :: - ++ ra-fora-post - ::x sends a fora post. if we don't have a channel for posts yet, create one - :: - |= {pax/path sup/spur hed/@t txt/@t} - ::x tell %hood to submit a fora post. - =. ..ra-emit - %+ ra-emit ost.hid - :* %poke - /fora-post - [our.hid %hood] - [%write-fora-post sup src.hid hed txt] - == - =+ man=%posts - ::x if we have a %posts story, go ahead and consume. - ?: (~(has by stories) man) - (ra-consume-fora-post man pax hed txt) - ::x if we have no %posts story, first create it, then consume. - =; new (ra-consume-fora-post:new man pax hed txt) - =. ..ra-apply - %+ ra-apply our.hid - :+ %design man - :- ~ :- ~ ::x sources - :- 'towards a community' ::x caption - [%brown ~] ::x cordon - ::x send informative message to our mailbox. - %^ ra-consume & our.hid - :^ (shaf %init eny.hid) ::x serial - (my [[%& our.hid (main our.hid)] *envelope %pending] ~) ::x audience - ::x statement - now.hid - [~ %app %tree 'receiving forum posts, ;join %posts for details'] - :: - ++ ra-consume-fora-post - ::x add a message for a fora post to the man story. - :: - |= {man/knot pax/path hed/@t txt/@t} ^+ +> - =. pax (welp pax /posts/(crip "{}~")) - %^ ra-consume | - src.hid - :* (shaf %comt eny.hid) - (my [[%& our.hid man] *envelope %pending] ~) - now.hid - (sy /fora-post eyre+pax ~) - :- %mor :~ - [%fat text+(lore txt) [%url [ra-base-hart `pax ~] ~]] - [%app %tree (crip "forum post: '{(trip hed)}'")] - == - == - :: - ++ ra-comment - ::x sends a comment. if we don't have a channel for them yet, creates one. - :: - |= {pax/path sup/spur txt/@t} - =. ..ra-emit - %+ ra-emit ost.hid - :* %poke - /comment - [our.hid %hood] - [%write-comment sup src.hid txt] - == - =+ man=%comments - ?: (~(has by stories) man) - (ra-consume-comment man pax sup txt) - =; new (ra-consume-comment:new man pax sup txt) - =. ..ra-apply - %+ ra-apply our.hid - :+ %design man - :- ~ :- ~ - :- 'letters to the editor' - [%brown ~] - %^ ra-consume & our.hid - :^ (shaf %init eny.hid) - (my [[%& our.hid (main our.hid)] *envelope %pending] ~) - now.hid - [~ %app %tree 'receiving comments, ;join %comments for details'] - :: - ++ ra-consume-comment - ::x adds a message for a comment to the man story. - :: - |= {man/knot pax/path sup/spur txt/@t} ^+ +> - =+ nam=?~(sup "" (trip i.sup)) :: file name - =+ fra=(crip (time-to-id now.hid)) :: url fragment - %^ ra-consume | - src.hid - :* (shaf %comt eny.hid) - (my [[%& our.hid man] *envelope %pending] ~) - now.hid - (sy /comment eyre+pax ~) - :- %mor :~ - [%fat text+(lore txt) [%url [ra-base-hart `pax ~] `fra]] - [%app %tree (crip "comment on /{nam}")] - == - == - :: - ++ ra-know :: story monad - ::x produces a wet core that takes a gate that takes a story core and - ::x produces updated state. - :: - |= man/knot - |* fun/$-(_pa _+>) - ^+ +>+> - =+ pur=(~(get by stories) man) - ?~ pur - ~& [%ra-know-not man] :: XX should crash - +>+>.$ - ::x call the sample gate with a ++pa core. - (fun ~(. pa man u.pur)) - :: - ++ ra-diff-talk-report :: subscription update - ::x process a talk report from cuz into story man. - :: - |= {man/knot cuz/station rad/report} - %- (ra-know man) |= par/_pa =< pa-abet - (pa-diff-talk-report:par cuz rad) - :: - ++ ra-quit :: subscription quit - ::x removes cuz from the subscribers of story man. - :: - |= {man/knot cuz/station} - %- (ra-know man) |= par/_pa =< pa-abet - (pa-quit:par %& cuz) - :: - ++ ra-retry :: subscription resend - ::x produce a %peer/subscribe move for cuz to story man. - :: - |= {man/knot cuz/station} - %- (ra-know man) |= par/_pa =< pa-abet - (pa-acquire:par [%& cuz]~) - :: - ++ ra-coup-repeat :: - ::x assemble partner and call ++ra-repeat. - :: - |= {{num/@ud her/@p man/knot} saw/(unit tang)} - (ra-repeat num [%& her man] saw) - :: - ++ ra-repeat :: remove from outbox - ::x take message out of outbox, mark it as received or rejected. - ::x crashes if pan is not in message's audience. - :: - |= {num/@ud pan/partner saw/(unit tang)} - =+ oot=(~(get by q.outbox) num) - ?~ oot ~|([%ra-repeat-none num] !!) - =. q.outbox (~(del by q.outbox) num) - =. q.u.oot - =+ olg=(~(got by q.u.oot) pan) - %+ ~(put by q.u.oot) pan - :- -.olg - ?~ saw %received - ~> %slog.[0 u.saw] - %rejected - (ra-think | our.hid u.oot ~) - :: - ++ ra-cancel :: drop a bone - ::x removes a bone from the story in pax. - :: - |= {src/ship pax/path} - ^+ +> - ?. ?=({@ @ *} pax) - ::x if story is not in path, just delete the bone from general. - +>(general (~(del in general) ost.hid)) - %- (ra-know i.t.pax) |= par/_pa =< pa-abet - ::x delete bone from all follower groups and set src's status to %gone. - (pa-notify:pa-cancel:par src %gone *human) - :: - ++ ra-human :: look up person - ::x get her identity. if she has none, make her one. - :: - |= her/ship - ^- {human _+>} - =^ who folks - =+ who=(~(get by folks) her) - ?^ who [u.who folks] - =+ who=`human`[~ `(scot %p her)] :: XX do right - [who (~(put by folks) her who)] - [who +>.$] - :: - ++ ra-console :: console subscribe - ::x make a shell for her, subscribe her to it. - :: - |= {her/ship pax/path} - ^+ +> - ::x get story from the path, default to standard mailbox. - =/ man/knot - ?+ pax !! - $~ (main her) - {@ta $~} i.pax - == - =/ she/shell - %*(. *shell her her, man man, active `(sy [%& our.hid man] ~)) - sh-abet:~(sh-peer sh ~ `shell`she) - :: - ++ ra-subscribe :: listen to - ::x subscribe her at pax. - :: - |= {her/ship pax/path} - ^+ +> - :: ~& [%ra-subscribe ost.hid her pax] - ::x empty path, meta-subscribe and send report with all our stories. - ?: ?=($~ pax) - (ra-house(general (~(put in general) ost.hid)) ost.hid) - ?. ?=({@ @ *} pax) - (ra-evil %talk-bad-path) - =+ vab=(~(gas in *(set peer-type)) (turn (rip 3 i.pax) decode:peer-type)) - =+ pur=(~(get by stories) i.t.pax) - ?~ pur - ~& [%bad-subscribe-story-c i.t.pax] - (ra-evil %talk-no-story) - =+ soy=~(. pa i.t.pax u.pur) - ::x check her read permissions. - ?. (pa-visible:soy her) - (ra-evil %talk-no-story) - =^ who +>.$ (ra-human her) - ::x for each stream type she is interested in, add her to the followers. - =. soy ?.((~(has in vab) %a-group) soy (pa-watch-group:soy her)) - =. soy ?.((~(has in vab) %v-glyph) soy (pa-watch-glyph:soy her)) - =. soy ?.((~(has in vab) %x-cabal) soy (pa-watch-cabal:soy her)) - =. soy ?.((~(has in vab) %f-grams) soy (pa-watch-grams:soy her t.t.pax)) - ::x add her status to presence map. - =. soy (pa-notify:soy her %hear who) - ::x apply changes to story. - pa-abet:soy - :: - ++ ra-think :: publish+review - ::x consumes each thought. - :: - |= {pub/? her/ship tiz/(list thought)} - ^+ +> - ?~ tiz +> - $(tiz t.tiz, +> (ra-consume pub her i.tiz)) - :: - ++ ra-normal :: normalize - ::x sanitize %lin speech, enforce lowercase and no special characters. - :: - |= tip/thought - ^- thought - ?. ?=({$lin *} r.r.tip) tip - %_ tip - q.r.r - %- crip - %+ scag 64 - %- tufa - %+ turn (tuba (trip q.r.r.tip)) - |= a/@c - ?: &((gte a 'A') (lte a 'Z')) - (add a 32) - ?: |((lth a 32) (gth a 126)) - `@`'?' - a - == - :: - ++ ra-consume :: consume thought - ::x if pub is true, sends the thought to each partner in the audience. - ::x if false, updates the thought in our store. - :: - |= {pub/? her/ship tip/thought} - =. tip (ra-normal tip) - =+ aud=(~(tap by q.tip) ~) ::x why ~ ? - |- ^+ +>.^$ - ?~ aud +>.^$ - $(aud t.aud, +>.^$ (ra-conduct pub her p.i.aud tip)) - :: - ++ ra-conduct :: thought to partner - ::x record a message or sends it. - :: - |= {pub/? her/ship tay/partner tip/thought} - ^+ +> - :: ~& [%ra-conduct pub her tay] - ?- -.tay - $& ?: pub - =. her our.hid :: XX security! - ?: =(her p.p.tay) - (ra-record q.p.tay p.p.tay tip) - (ra-transmit p.tay tip) - ?. =(our.hid p.p.tay) - +> - (ra-record q.p.tay her tip) - $| !! - == - :: - ++ ra-record :: add to story - ::x add or update a telegram in story man. - :: - |= {man/knot gam/telegram} - %- (ra-know man) |= par/_pa =< pa-abet - (pa-learn:par gam) - :: - ++ ra-transmit :: send to neighbor - ::x sends a thought to a station, adds it to the outbox. - :: - |= {cuz/station tip/thought} - ^+ +> - =. +> - %+ ra-emit ost.hid - :* %poke - /repeat/(scot %ud p.outbox)/(scot %p p.cuz)/[q.cuz] - [p.cuz %talk] - [%talk-command `command`[%review tip ~]] - == - +>(p.outbox +(p.outbox), q.outbox (~(put by q.outbox) p.outbox tip)) - :: - ++ pa :: story core - ::x story core, used for doing work on a story. - ::x as always, an -abet arms is used for applying changes to the state. - ::x ++pa-watch- arms get called by ++ra-subscribe to add a subscriber. - ::x bones are used to identify subscribers (source event identifiers) - :: - |_ ::x man: the knot identifying the story in stories. - ::x story doesn't get a face because ease of use - :: - $: man/knot - story - == - ++ pa-abet - ::x apply/fold changes back into the stories map. - :: - ^+ +> - +>(stories (~(put by stories) man `story`+<+)) - :: - ++ pa-admire :: accept from - ::x should be checking her write permissions, but defaults to allowed. - ::x commented code seems to use an older control structure. - ::x? this seems like an easy fix, why was this ever disabled? - :: - |= her/ship - ^- ? - ::?- -.cordon.shape - :: %& (~(has in p.cordon.shape) her) - :: %| !(~(has in p.cordon.shape) her) - ::== - & - :: - ++ pa-visible :: display to - ::x checks her read permissions. - :: - |= her/ship - ^- ? - ?- p.cordon.shape - $black & ::x channel, all - $green & ::x journal, all - $brown (team our.hid her) ::x mailbox, our - $white (~(has in q.cordon.shape) her) ::x village, invite - == - :: - ++ pa-report :: update - ::x sends report to all bones. - :: - |= {wac/(set bone) caw/report} - :: ~& [%pa-report man -.caw] - ^+ +> - ?~ wac +> - =. +> $(wac l.wac) - =. +> $(wac r.wac) - :: ~& [%pa-report-cabal man shape] - (pa-sauce n.wac [%diff %talk-report caw]~) - :: - ++ pa-watch-group :: subscribe presence - ::x if she may, add her bone to presence followers and send her a group - ::x (presence) report. - :: - |= her/ship - ?. (pa-admire her) - (pa-sauce ost.hid [%quit ~]~) - =. groupers (~(put in groupers) ost.hid) - (pa-report-group ost.hid ~ ~) - :: - ++ pa-watch-cabal :: subscribe config - ::x if she may, add her bone to config followers and send her an updated - ::x cabal (config) report. - :: - |= her/ship - ?. (pa-admire her) - ~& [%pa-admire-not her] - (pa-sauce ost.hid [%quit ~]~) - =. cabalers (~(put in cabalers) ost.hid) - :: ~& [%pa-watch-cabal her man shape] - (pa-sauce ost.hid [[%diff %talk-report %cabal shape mirrors] ~]) - :: - ++ pa-watch-glyph :: subscribe config - ::x if she may, add her bone to glyph followers and send an updated glyph - ::x report. - :: - |= her/ship - ?. (pa-admire her) - ~& [%pa-admire-not her] - (pa-sauce ost.hid [%quit ~]~) - =. glyphers (~(put in glyphers) ost.hid) - (pa-report [ost.hid ~ ~] %glyph nak) - :: - ++ pa-report-group :: update presence - ::x build a group report, containing our different presence maps, and - ::x send it to all bones. - ::x? why should we be responsible for sending remotes presences? - :: - |= vew/(set bone) - %^ pa-report vew %group - :- %- ~(run by locals) - |=({@ a/status} a) - %- ~(urn by remotes) :: XX preformance - |= {pan/partner atl/atlas} ^- atlas - ?. &(?=($& -.pan) =(our.hid p.p.pan)) atl - =+ (~(get by stories) q.p.pan) - ?~ - atl - %- ~(run by locals.u) - |=({@ a/status} a) - :: - ++ pa-report-cabal :: update config - ::x a cabal report, containing our and remote configs, to all config - ::x followers. - :: - (pa-report cabalers %cabal shape mirrors) - :: - ++ pa-cabal - ::x add station's config to our remote config map. - ::x? ham is unused, not even when calling this. - :: - |= {cuz/station con/config ham/(map station config)} - ^+ +> - =+ old=mirrors - =. mirrors (~(put by mirrors) cuz con) - ?: =(mirrors old) - +>.$ - pa-report-cabal - :: - ++ pa-diff-talk-report :: subscribed update - ::x process a talk report from cuz. - :: - |= {cuz/station rad/report} - ^+ +> - ::x verify we are supposed to receive reports from cuz. - ?. (~(has in sources.shape) [%& cuz]) - ~& [%pa-diff-unexpected cuz rad] - +> - ?+ -.rad ~|([%talk-odd-friend rad] !!) - $cabal (pa-cabal cuz +.rad) - $group (pa-remind [%& cuz] +.rad) - $grams (pa-lesson q.+.rad) - == - :: - ++ pa-quit :: stop subscription - ::x delete tay from our subscriptions, then send an updated capal report. - :: - |= tay/partner - pa-report-cabal(sources.shape (~(del in sources.shape) tay)) - :: - ++ pa-sauce :: send backward - ::x turns cards into moves, reverse order, prepend to existing moves. - :: - |= {ost/bone cub/(list card)} - %_ +>.$ - moves - (welp (flop (turn cub |=(a/card [ost a]))) moves) - == - :: - ++ pa-abjure :: unsubscribe move - ::x for each partner, produce a %pull/unsubscribe move. - :: - |= tal/(list partner) - %+ pa-sauce 0 ::x why bone 0? - %- zing - %+ turn tal - |= tay/partner - ^- (list card) - ?- -.tay - $| ~& tweet-abjure+p.p.tay - !! - :: - $& ~& [%pa-abjure [our.hid man] [p.p.tay q.p.tay]] - :_ ~ - :* %pull - /friend/show/[man]/(scot %p p.p.tay)/[q.p.tay] - [p.p.tay %talk] - ~ - == - == - :: - ++ pa-acquire :: subscribe to - ::x for each partner, produce a %peer/subscribe move. - :: - |= tal/(list partner) - %+ pa-sauce 0 - %- zing - %+ turn tal - |= tay/partner - ^- (list card) - =+ num=(~(get by sequence) tay) - =+ old=(sub now.hid ~d1) :: XX full backlog - ::x subscribe starting at the last message we read, - ::x or if we haven't read any yet, messages from up to a day ago. - =+ ini=?^(num (scot %ud u.num) (scot %da old)) - =/ typ - =+ (ly ~[%a-group %f-grams %x-cabal]) - (rap 3 (turn - encode:peer-type)) - ?- -.tay - $| !! - $& :: ~& [%pa-acquire [our.hid man] [p.p.tay q.p.tay]] - :_ ~ - :* %peer - /friend/show/[man]/(scot %p p.p.tay)/[q.p.tay] - [p.p.tay %talk] - /[typ]/[q.p.tay]/[ini] - == - == - :: - ++ pa-reform :: reconfigure, ugly - ::x change config of current story, subscribe/unsubscribe to/from the - ::x partners we gained/lost, and send out an updated cabal report. - :: - |= cof/config - =+ ^= dif ^- (pair (list partner) (list partner)) - =+ old=`(list partner)`(~(tap in sources.shape) ~) - =+ new=`(list partner)`(~(tap in sources.cof) ~) - :- (skip new |=(a/partner (~(has in sources.shape) a))) - (skip old |=(a/partner (~(has in sources.cof) a))) - =. +>.$ (pa-acquire p.dif) - =. +>.$ (pa-abjure q.dif) - =. shape cof - pa-report-cabal - :: - ++ pa-cancel :: unsubscribe from - ::x deletes the current ost.hid from all follower groups. - :: - :: ~& [%pa-cancel ost.hid] - %_ . - gramsers (~(del by gramsers) ost.hid) - groupers (~(del in groupers) ost.hid) - glyphers (~(del in glyphers) ost.hid) - cabalers (~(del in cabalers) ost.hid) - == - :: - ++ pa-notify :: local presence - ::x add her status to our presence map. if this changes it, send report. - :: - |= {her/ship saz/status} - ^+ +> - =/ nol (~(put by locals) her now.hid saz) - ?: =(nol locals) +>.$ - (pa-report-group(locals nol) groupers) - :: - ++ pa-remind :: remote presence - ::x adds tay's loc to our remote presence map, after merging with rem. - ::x if this changes anything, send update report. - :: - |= {tay/partner loc/atlas rem/(map partner atlas)} - ::x remove this story from the presence map, since it's in local already. - =. rem (~(del by rem) %& our.hid man) :: superceded by local data - =/ buk (~(uni timed remotes) rem) :: XX drop? - =. buk (~(put timed buk) tay now.hid loc) - ?: =(~(strip timed buk) ~(strip timed remotes)) +>.$ - (pa-report-group(remotes buk) groupers) - :: - ++ pa-start :: start stream - ::x grab all telegrams that fall within the river and send them in a - ::x grams report to ost.hid. - :: - |= riv/river - ^+ +> - =- :: ~& [%pa-start riv lab] - =. +>.$ - (pa-sauce ost.hid [[%diff %talk-report %grams q.lab r.lab] ~]) - ?: p.lab ::x? dun never gets changed, so always | ? - (pa-sauce ost.hid [[%quit ~] ~]) - +>.$(gramsers (~(put by gramsers) ost.hid riv)) - ^= lab - =+ [end=count gaz=grams dun=| zeg=*(list telegram)] - |- ^- (trel ? @ud (list telegram)) - ?~ gaz [dun end zeg] - ?: ?- -.q.riv :: after the end - $ud (lte p.q.riv end) - $da (lte p.q.riv p.r.q.i.gaz) - == - ::x if we're past the river, continue browsing back. - $(end (dec end), gaz t.gaz) - ?: ?- -.p.riv :: before the start - $ud (lth end p.p.riv) - $da (lth p.r.q.i.gaz p.p.riv) - == - ::x if we're before the river, we're done. - [dun end zeg] - ::x if we're in the river, add this gram and continue. - $(end (dec end), gaz t.gaz, zeg [i.gaz zeg]) - :: - ++ pa-watch-grams :: subscribe messages - ::x (called upon subscribe) send backlog of grams to her. - ::x deduces which messages to send from pax. - :: - |= {her/ship pax/path} - ^+ +> - ?. (pa-admire her) - ~& [%pa-watch-grams-admire ~] - (pa-sauce ost.hid [%quit ~]~) - ::x find the range of grams to send. - =+ ^= ruv ^- (unit river) - %+ biff ::x collapse unit list. - (zl:jo (turn pax ;~(biff slay |=(a/coin `(unit dime)`?~(-.a a ~))))) - |= paf/(list dime) - ?~ paf - $(paf [%ud (sub (max 64 count) 64)]~) - ?~ t.paf - $(t.paf [%da (dec (bex 128))]~) - ?. ?=({{?($ud $da) @} {?($ud $da) @} $~} paf) - ~ - ::x? the switches, they do nothing! - `[[?+(- . $ud .)]:i.paf [?+(- . $ud .)]:i.t.paf] :: XX types - :: ~& [%pa-watch-grams her pax ruv] - ?~ ruv - ~& [%pa-watch-grams-malformed pax] - (pa-sauce ost.hid [%quit ~]~) - (pa-start u.ruv) - :: - ++ pa-refresh :: update to listeners - ::x called when grams get added or changed. calculates the changes and - ::x sends them to all message followers. if we run into any followers - ::x that are no longer interested in this story, remove them. - :: - |= {num/@ud gam/telegram} - ^+ +> - =+ ^= moy - |- ^- (pair (list bone) (list move)) - ?~ gramsers [~ ~] - :: ~& [%pa-refresh num n.gramsers] - =+ lef=$(gramsers l.gramsers) - =+ rit=$(gramsers r.gramsers) - =+ old=[p=(welp p.lef p.rit) q=(welp q.lef q.rit)] - ?: ?- -.q.q.n.gramsers :: after the end - $ud (lte p.q.q.n.gramsers num) - $da (lte p.q.q.n.gramsers p.r.q.gam) - == - [[p.n.gramsers p.old] [[p.n.gramsers %quit ~] q.old]] - ?: ?- -.p.q.n.gramsers :: before the start - $ud (gth p.p.q.n.gramsers num) - $da (gth p.p.q.n.gramsers p.r.q.gam) - == - old - :- p.old - [[p.n.gramsers %diff %talk-report %grams num gam ~] q.old] - =. moves (welp q.moy moves) - |- ^+ +>.^$ - ?~ p.moy +>.^$ - $(p.moy t.p.moy, gramsers (~(del by gramsers) i.p.moy)) - :: - ++ pa-lesson :: learn multiple - ::x learn all telegrams in a list. - :: - |= gaz/(list telegram) - ^+ +> - ?~ gaz +> - $(gaz t.gaz, +> (pa-learn i.gaz)) - :: - ++ pa-learn :: learn message - ::x store an incoming telegram, modifying audience to say we received it. - ::x update existing telegram if it already exists. - :: - |= gam/telegram - ^+ +> - ::x if author isn't allowed to write here, reject. - ?. (pa-admire p.gam) - ~& %pa-admire-rejected - +>.$ - =. q.q.gam - ::x if we are in the audience, mark us as having received it. - =+ ole=(~(get by q.q.gam) [%& our.hid man]) - ?^ ole (~(put by q.q.gam) [%& our.hid man] -.u.ole %received) - :: for fedearted stations, pretend station src/foo is also our/foo - :: XX pass src through explicitly instead of relying on implicit - :: value in hid from the subscription to src/foo - =+ ole=(~(get by q.q.gam) [%& src.hid man]) - ?~ ole q.q.gam - ::x as described above, fake src into our. - =. q.q.gam (~(del by q.q.gam) [%& src.hid man]) - (~(put by q.q.gam) [%& our.hid man] -.u.ole %received) - =+ old=(~(get by known) p.q.gam) - ?~ old - (pa-append gam) ::x add - (pa-revise u.old gam) ::x modify - :: - ++ pa-append :: append new - ::x add gram to our story, and update our subscribers. - :: - |= gam/telegram - ^+ +> - %+ %= pa-refresh - grams [gam grams] - count +(count) - known (~(put by known) p.q.gam count) - == - count - gam - :: - ++ pa-revise :: revise existing - ::x modify a gram in our story, and update our subscribers. - :: - |= {num/@ud gam/telegram} - =+ way=(sub count num) - ?: =(gam (snag (dec way) grams)) - +>.$ :: no change - =. grams (welp (scag (dec way) grams) [gam (slag way grams)]) - (pa-refresh num gam) - -- - -- -:: -++ sn :: station render core - ::x used in both station and ship rendering. - :: - ::x man: mailbox. - ::x one: the station. - |_ {man/knot one/station} - ++ sn-best :: best to show - ::x returns true if one is better to show, false otherwise. - ::x prioritizes: our > main > size. - :: - |= two/station - ^- ? - ::x the station that's ours is better. - ?: =(our.hid p.one) - ?: =(our.hid p.two) - ?< =(q.one q.two) - ::x if both stations are ours, the main story is better. - ?: =((main p.one) q.one) %& - ?: =((main p.two) q.two) %| - ::x if neither are, pick the "larger" one. - (lth q.one q.two) - %& - ::x if one isn't ours but two is, two is better. - ?: =(our.hid p.two) - %| - ?: =(p.one p.two) - ::x if they're from the same ship, pick the "larger" one. - (lth q.one q.two) - ::x when in doubt, pick one if its ship is "smaller" than its channel. - ::x? i guess you want this to be consistent across (a b) and (b a), but - ::x this still seems pretty arbitrary. - (lth p.one q.one) - :: - ++ sn-curt :: render name in 14 - ::x prints a ship name in 14 characters. left-pads with spaces. - ::x? mup is unused, what is it even for? ++ta-show still uses it. - :: - |= mup/? - ^- tape - =+ raw=(cite p.one) - (runt [(sub 14 (lent raw)) ' '] raw) - :: - ++ sn-nick - ::x get nick for ship, or shortname if no nick. left-pads with spaces. - :: - |. ^- tape - =+ nym=(~(get by folks) p.one) - ?~ nym - (sn-curt |) - ?~ hand.u.nym - (sn-curt |) - =+ raw=(trip u.hand.u.nym) - =+ len=(sub 14 (lent raw)) - (weld (reap len ' ') raw) - :: - ++ sn-phat :: render accurately - ::x prints a station fully, but still taking "shortcuts" where possible: - ::x ":" for local mailbox, "~ship" for foreign mailbox, - ::x "%channel" for local station, "/channel" for parent station. - :: - ^- tape - ?: =(p.one our.hid) - ?: =(q.one man) - ":" - ['%' (trip q.one)] - ?: =(p.one (sein our.hid)) - ['/' (trip q.one)] - =+ wun=(scow %p p.one) - ?: =(q.one (main p.one)) - wun - :(welp wun "/" (trip q.one)) - -- -:: -++ ta :: partner core - ::x used primarily for printing partners. - :: - ::x man: mailbox. - ::x one: the partner. - |_ {man/knot one/partner} - ++ ta-beat :: more relevant - ::x returns true if one is better to show, false otherwise. - ::x prefers stations over passports. if both are stations, sn-best. if both - ::x are passports, pick the "larger" one, if they're equal, content hash. - :: - |= two/partner ^- ? - ?- -.one - $& - ?- -.two - $| %& - $& (~(sn-best sn man p.one) p.two) - == - :: - $| - ?- -.two - $& %| - $| ?: =(-.p.two -.p.one) - (lth (mug +.p.one) (mug +.p.two)) - (lth -.p.two -.p.one) - == - == - ++ ta-best :: most relevant - ::x picks the most relevant partner. - :: - |=(two/partner ?:((ta-beat two) two one)) - :: - ++ ta-full (ta-show ~) :: render full width - ++ ta-show :: render partner - ::x renders a partner as text. - :: - |= moy/(unit ?) - ^- tape - ?- -.one - ::x render station as glyph if we can. - $& - ?~ moy - =+ cha=(~(get by nik) one ~ ~) - =- ?~(cha - "'{u.cha ~}' {-}") - ~(sn-phat sn man p.one) - (~(sn-curt sn man p.one) u.moy) - :: - ::x render passport. - $| - =+ ^= pre ^- tape - ?- -.p.one - $twitter "@t:" - == - ?~ moy - (weld pre (trip p.p.one)) - =. pre ?.(=(& u.moy) pre ['*' pre]) - (sigh 14 pre p.p.one) - == - -- -:: -++ te :: audience renderer - ::x used for representing audiences (sets of partners) as tapes. - :: - :: man: mailbox. - :: lix: members of the audience. - |_ {man/knot lix/(set partner)} - ++ te-best ^- (unit partner) - ::x pick the most relevant partner. - :: - ?~ lix ~ - :- ~ - |- ^- partner - =+ lef=`(unit partner)`te-best(lix l.lix) - =+ rit=`(unit partner)`te-best(lix r.lix) - =. n.lix ?~(lef n.lix (~(ta-best ta man n.lix) u.lef)) - =. n.lix ?~(rit n.lix (~(ta-best ta man n.lix) u.rit)) - n.lix - :: - ++ te-deaf ^+ . :: except for self - ::x remove ourselves from the audience. - :: - .(lix (~(del in lix) `partner`[%& our.hid man])) - :: - ++ te-maud ^- ? :: multiple audience - ::x checks if there's multiple partners in the audience via pattern match. - :: - =. . te-deaf - !?=($@($~ {* $~ $~}) lix) - :: - ++ te-prom ^- tape :: render targets - ::x render all partners, ordered by relevance. - :: - =. . te-deaf - =+ ^= all - %+ sort `(list partner)`(~(tap in lix)) - |= {a/partner b/partner} - (~(ta-beat ta man a) b) - =+ fir=& - |- ^- tape - ?~ all ~ - ;: welp - ?:(fir "" " ") - (~(ta-show ta man i.all) ~) - $(all t.all, fir |) - == - :: - ++ te-whom :: render sender - ::x render sender as the most relevant partner. - :: - (~(ta-show ta man (need te-best)) ~ te-maud) - :: - ++ ta-dire :: direct message - ::x returns true if partner is a mailbox of ours. - :: - |= pan/partner ^- ? - ?& ?=($& -.pan) - =(p.p.pan our.hid) - :: - =+ sot=(~(get by stories) q.p.pan) - &(?=(^ sot) ?=($brown p.cordon.shape.u.sot)) - == - :: - ++ te-pref :: audience glyph - ::x get the glyph that corresponds to the audience, with a space appended. - ::x if it's a dm to us, use :. if it's a dm by us, use ;. complex, use *. - :: - ^- tape - =+ cha=(~(get by nik) lix) - ?^ cha ~[u.cha ' '] - ?. (lien (~(tap by lix)) ta-dire) - "* " - ?: ?=({{$& ^} $~ $~} lix) - ": " - "; " - -- -:: -++ tr :: telegram renderer - ::x responsible for converting telegrams and everything relating to them to - ::x text to be displayed in the cli. - :: - |_ $: ::x man: story. - ::x sef: settings flags. - ::x telegram: - ::x who: author. - ::x thought: - ::x sen: unique identifier. - ::x aud: audience. - ::x statement: - ::x wen: timestamp. - ::x bou: complete aroma. - ::x sep: message contents. - :: - man/knot - sef/(set knot) - who/ship - sen/serial - aud/audience - wen/@da - bou/bouquet - sep/speech - == - ++ tr-fact ^- sole-effect :: activate effect - ::x produce sole-effect for printing message details. - :: - ~[%mor [%tan tr-meta] tr-body] - :: - ++ tr-line ^- tape :: one-line print - ::x crams a telegram into a single line by displaying a short ship name, - ::x a short representation of the gram, and an optional timestamp. - :: - =+ txt=(tr-text =(who our.hid)) - ?: =(~ txt) "" - =+ ^= baw - :: ?: oug - :: ~(te-whom te man tr-pals) - ?. (~(has in sef) %noob) - (~(sn-curt sn man [who (main who)]) |) - (~(sn-nick sn man [who (main who)])) - ?: (~(has in sef) %showtime) - =+ dat=(yore now.hid) - =+ ^= t - |= a/@ ^- tape - %+ weld - ?: (lth a 10) "0" ~ - (scow %ud a) - =+ ^= time :(weld "~" (t h.t.dat) "." (t m.t.dat) "." (t s.t.dat)) - :(weld baw txt (reap (sub 67 (lent txt)) ' ') time) - (weld baw txt) - :: - ++ tr-meta ^- tang - ::x build strings that display metadata, including message serial, - ::x timestamp, author and audience. - :: - =. wen (sub wen (mod wen (div wen ~s0..0001))) :: round - =+ hed=leaf+"{(scow %uv sen)} at {(scow %da wen)}" - =+ =< paz=(turn (~(tap by aud)) .) - |=({a/partner *} leaf+~(ta-full ta man a)) - =+ bok=(turn (sort (~(tap in bou)) aor) smyt) - [%rose [" " ~ ~] [hed >who< [%rose [", " "to " ~] paz] bok]]~ - :: - ++ tr-body - ::x long-form display of message contents, specific to each speech type. - :: - |- ^- sole-effect - ?+ -.sep tan+[>sep<]~ - $exp tan+~[leaf+"# {(trip p.sep)}"] - $lin tan+~[leaf+"{?:(p.sep "" "@ ")}{(trip q.sep)}"] - $non tan+~ - $app tan+~[rose+[": " ~ ~]^~[leaf+"[{(trip p.sep)}]" leaf+(trip q.sep)]] - $url url+(crip (earf p.sep)) - $mor mor+(turn p.sep |=(speech ^$(sep +<))) - $fat [%mor $(sep q.sep) tan+(tr-rend-tors p.sep) ~] - $api - :- %tan - :_ ~ - :+ %rose - [": " ~ ~] - :~ leaf+"[{(trip id.sep)} on {(trip service.sep)}]" - leaf+(trip body.sep) - leaf+(earf url.sep) - == - == - :: - ++ tr-rend-tors - ::x render an attachment. - :: - |= a/torso ^- tang - ?- -.a - $name (welp $(a q.a) leaf+"={(trip p.a)}" ~) - $tank +.a - $text (turn (flop +.a) |=(b/cord leaf+(trip b))) - == - :: - ++ tr-pals - ::x strip delivery info from audience, producing a set of partners. - :: - ^- (set partner) - %- ~(gas in *(set partner)) - (turn (~(tap by aud)) |=({a/partner *} a)) - :: - ++ tr-chow - ::x truncate the txt to be of max len characters. if it does truncate, - ::x indicates it did so by appending a character. - :: - |= {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-both - ::x try to fit two tapes into a single line. - :: - |= {a/tape b/tape} ^- tape - ?: (gth (lent a) 62) (tr-chow 64 a) - %+ weld a - (tr-chow (sub 64 (lent a)) " {b}") - :: - ++ tr-text - ::x gets a tape representation of a message that fits within a single line. - :: - |= oug/? - ^- tape - ?+ -.sep ~&(tr-lost+sep "") - $mor - ?~ p.sep ~&(%tr-mor-empty "") - |- ^- tape - ?~ t.p.sep ^$(sep i.p.sep) - (tr-both ^$(sep i.p.sep) $(p.sep t.p.sep)) - :: - $fat - %+ tr-both $(sep q.sep) - ?+ -.p.sep "..." - $tank ~(ram re %rose [" " `~] +.p.sep) - == - :: - $exp (tr-chow 66 '#' ' ' (trip p.sep)) - $url =+ ful=(earf p.sep) - ?: (gth 64 (lent ful)) ['/' ' ' ful] - :+ '/' '_' - =+ hok=r.p.p.p.sep - ~! hok - =- (swag [a=(sub (max 64 (lent -)) 64) b=64] -) - ^- tape - =< ?:(?=($& -.hok) (reel p.hok .) +:(scow %if p.hok)) - |=({a/knot b/tape} ?~(b (trip a) (welp b '.' (trip a)))) - :: - $lin - =+ txt=(trip q.sep) - ?: p.sep - =+ pal=tr-pals - =. pal ?: =(who our.hid) pal - (~(del in pal) [%& who (main who)]) - (weld ~(te-pref te man pal) txt) - (weld " " txt) - :: - $app - (tr-chow 64 "[{(trip p.sep)}]: {(trip q.sep)}") - :: - $api - (tr-chow 64 "[{(trip id.sep)}@{(trip service.sep)}]: {(trip summary.sep)}") - == - -- -:: -++ peer :: accept subscription - ::x incoming subscription on pax. - :: - |= pax/path - ^+ [*(list move) +>] - ~? !=(src.hid our.hid) [%peer-talk-stranger src.hid] - :: ~& [%talk-peer src.hid ost.hid pax] - ?: ?=({$sole *} pax) - ?> (team our.hid src.hid) - ~? (~(has by shells) ost.hid) [%talk-peer-replaced ost.hid pax] - ra-abet:(ra-console:ra src.hid t.pax) - :: ~& [%talk-peer-data ost.hid src.hid pax] - ra-abet:(ra-subscribe:ra src.hid pax) -:: -++ poke-talk-command :: accept command - ::x incoming talk command. process it and update logs. - :: - |= cod/command - ^+ [*(list move) +>] - :: ~& [%talk-poke-command src.hid cod] - =^ mos +>.$ - ra-abet:(ra-apply:ra src.hid cod) - =^ mow +>.$ log-all-to-file - [(welp mos mow) +>.$] -:: -++ poke-sole-action :: accept console - ::x incoming sole action. process it. - :: - |= act/sole-action - ra-abet:(ra-sole:ra act) -:: -++ diff-talk-report :: - ::x incoming talk-report. process it and update logs. - :: - |= {way/wire rad/report} - ^- (quip move +>) - =^ mos +>.$ - %+ etch-friend way |= {man/knot cuz/station} - ra-abet:(ra-diff-talk-report:ra man cuz rad) - =^ mow +>.$ log-all-to-file - [(welp mos mow) +>.$] -:: -++ coup-repeat :: - ::x ack from ++ra-transmit. mark the message as received or rejected. - :: - |= {way/wire saw/(unit tang)} - %+ etch-repeat [%repeat way] |= {num/@ud src/@p man/knot} - ra-abet:(ra-coup-repeat:ra [num src man] saw) -:: -++ etch :: parse wire - ::x parse wire to obtain either %friend with story and station or %repeat - ::x with message number, source ship and story. - :: - |= way/wire - ^- weir - ?+ -.way !! - $friend - ?> ?=({$show @ @ @ $~} t.way) - [%friend i.t.t.way (slav %p i.t.t.t.way) i.t.t.t.t.way] - :: - $repeat - ?> ?=({@ @ @ $~} t.way) - [%repeat (slav %ud i.t.way) (slav %p i.t.t.way) i.t.t.t.way] - == -:: -++ etch-friend :: - ::x parse a /friend wire, call gate with resulting data. - :: - |= {way/wire fun/$-({man/knot cuz/station} {(list move) _.})} - =+ wer=(etch way) - ?>(?=($friend -.wer) (fun p.wer q.wer)) -:: -++ etch-repeat :: - ::x parse a /repeat wire, call gate with resulting data. - :: - |= {way/wire fun/$-({num/@ud src/@p man/knot} {(list move) _.})} - =+ wer=(etch way) - ?>(?=($repeat -.wer) (fun p.wer q.wer r.wer)) -:: -++ reap-friend :: - ::x subscription n/ack. if it failed, remove their subscription from state. - :: - |= {way/wire saw/(unit tang)} - ^- (quip move +>) - ?~ saw [~ +>] - %+ etch-friend [%friend way] |= {man/knot cuz/station} - =. u.saw [>%reap-friend-fail man cuz< u.saw] - %- (slog (flop u.saw)) - ra-abet:(ra-quit:ra man cuz) -:: -++ quit-friend :: - ::x resubscribe. - :: - |= way/wire - %+ etch-friend [%friend way] |= {man/knot cuz/station} - ra-abet:(ra-retry:ra man cuz) -:: -++ pull :: - ::x unsubscribe. remove from story and shells. - :: - |= pax/path - ^+ [*(list move) +>] - :: ~& [%talk-pull src.hid ost.hid pax] - =^ moz +>.$ ra-abet:(ra-cancel:ra src.hid pax) - [moz +>.$(shells (~(del by shells) ost.hid))] -:: -++ log-all-to-file - ::x for every story we're logging, (over)write all their grams to log files, - ::x if new ones have arrived. - :: - ^- (quip move .) - ?: & [~ .] :: XXX!!!! - :_ %_ . - log %- ~(urn by log) - |=({man/knot len/@ud} count:(~(got by stories) man)) - == - %+ murn (~(tap by log)) - |= {man/knot len/@ud} - ^- (unit move) - ?: (gte len count:(~(got by stories) man)) - ~ - `(log-to-file man) -:: -++ log-to-file - ::x log all grams of story man to a file. - :: - |= man/knot - ^- move - =+ ^- paf/path - =+ day=(year %*(. (yore now.hid) +.t +:*tarp)) - %+ tope [our.hid %home da+now.hid] - /talk-telegrams/(scot %da day)/[man]/talk - =+ grams:(~(got by stories) man) - [ost.hid %info /jamfile our.hid (foal paf [%talk-telegrams !>(-)])] -:: -++ poke-talk-comment - ::x send a comment. - :: - |= {pax/path sup/spur txt/@t} ^- (quip move +>) - ra-abet:(ra-comment:ra pax sup txt) -:: -++ poke-talk-fora-post - ::x send a fora post. - :: - |= {pax/path sup/spur hed/@t txt/@t} ^- (quip move +>) - ra-abet:(ra-fora-post:ra pax sup hed txt) -:: -++ poke-talk-save - ::x store the talk telegrams of story man in a log file. - :: - |= man/knot - ^- (quip move +>) - =+ paf=/(scot %p our.hid)/home/(scot %da now.hid)/talk/[man]/talk-telegrams - =+ grams:(~(got by stories) man) - [[ost.hid %info /jamfile our.hid (foal paf [%talk-telegrams !>(-)])]~ +>.$] -:: -++ poke-talk-load - ::x load/update the story man into our state, as saved in ++poke-talk-save. - :: - |= man/knot - =+ ^= grams - .^ (list telegram) - %cx - /(scot %p our.hid)/home/(scot %da now.hid)/talk/[man]/talk-telegrams - == - =+ toy=(~(got by stories) man) - [~ +>.$(stories (~(put by stories) man toy(grams grams, count (lent grams))))] -:: -++ poke-talk-log - ::x start logging story man. - :: - |= man/knot - ~& %poke-log - ^- (quip move +>) - :- [(log-to-file man) ~] - +>.$(log (~(put by log) man count:(~(got by stories) man))) -:: -++ poke-talk-unlog - ::x stop logging story man. - :: - |= man/knot - ^- (quip move +>) - :- ~ - +>.$(log (~(del by log) man)) -:: -++ prep - ::x state adapter. - :: - |= old/(unit house-any) - ^- (quip move ..prep) - ?~ old - ra-abet:ra-init:ra - |- - ?- -.u.old - $6 [~ ..prep(+<+ u.old)] - $5 =< ^$(-.u.old %6, shells.u.old (~(run by shells.u.old) .)) - |= shell-5 ^- shell - +<(passive %passive-deprecated, active ?^(active active `passive)) - $4 =< ^$(-.u.old %5, shells.u.old (~(run by shells.u.old) .)) - |=(shell-4 `shell-5`+<(system [system settings=*(set knot)])) - $3 =< ^$(-.u.old %4, stories.u.old (~(run by stories.u.old) .)) - |=(story-3 `story`+<(cabalers [cabalers glyphers=*(set bone)])) - == --- diff --git a/lib/talk.hoon b/lib/talk.hoon index d991783326..d6c319a341 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -11,13 +11,19 @@ [. ^talk] |_ bol/bowl ++ main :: main story - |= our/ship ^- cord - =+ can=(clan our) + |= who/ship ^- cord + =+ can=(clan who) ?+ can %porch $czar %court $king %floor == :: +::TODO add to zuse? +++ true-self + |= who/ship + ?. ?=($earl (clan who)) who + (sein who) +:: ++ said-url :: app url |= url/purl :^ ost.bol %poke /said-url @@ -87,13 +93,14 @@ $filter cof(fit fit.dif) $remove cof :: - $source + $sourcee %= cof - src + sre %. `(set partner)`pas.dif ::TODO? why do we *need* to cast? + ~& [%doing-sourcee add.dif pas.dif] ?: add.dif - ~(uni in src.cof) - ~(dif in src.cof) + ~(uni in sre.cof) + ~(dif in sre.cof) == :: $permit @@ -116,23 +123,6 @@ ~ ses.con.cof == - :: - $federal - %= cof - fes.fed - ?. fed.dif fes.fed.cof - %. sis.dif - ?: add.dif - ~(uni in fes.fed.cof) - ~(dif in fes.fed.cof) - :: - may.fed - ?: fed.dif may.fed.cof - %. sis.dif - ?: add.dif - ~(uni in may.fed.cof) - ~(dif in may.fed.cof) - == == :: ++ change-status ::< ... @@ -155,4 +145,77 @@ == == == +:: +++ depa :: de-pathing core + => |% ++ grub * :: result + ++ weir (list coin) :: parsed wire + ++ fist $-(weir grub) :: reparser instance + -- + |% + :: + ++ al + |* {hed/$-(coin *) tal/fist} + |= wir/weir ^+ [*hed *tal] + ?~ wir !! + [(hed i.wir) (tal t.wir)] + :: + ++ at + |* typ/{@tas (pole @tas)} + =+ [i-typ t-typ]=typ + |= wer/weir + ^- (tup:dray i-typ t-typ) ::< ie, (tup %p %tas ~) is {@p @tas} + ?~ wer !! + ?~ t-typ + ?^ t.wer !! + ((do i-typ) i.wer) + :- ((do i-typ) i.wer) + (^$(typ t-typ) t.wer) + :: + ++ mu :: true unit + |* wit/fist + |= wer/weir + ?~(wer ~ (some (wit wer))) + :: + ++ af :: object as frond + |* buk/(pole {cord fist}) + |= wer/weir + ?> ?=({{$$ $tas @tas} *} wer) + ?~ buk !! + =+ [[tag wit] t-buk]=buk + ?: =(tag q.p.i.wer) + [tag ~|(tag+`@tas`tag (wit t.wer))] + ?~ t-buk ~|(bad-tag+q.p.i.wer !!) + (^$(buk t-buk) wer) + :: + ++ or + |* typ/|-($@(@tas {@tas $})) + |= con/coin + ::^- _(snag *@ (turn (limo typ) |*(a/@tas [a (odo:raid a)]))) + ?> ?=($$ -.con) + =/ i-typ ?@(typ typ -.typ) + ?: =(i-typ p.p.con) + :- i-typ + ^- (odo:raid i-typ) + q.p.con + ?@ typ ~|(%bad-odor !!) + (^$(typ +.typ) con) + :: + ++ do + |* typ/@tas + |= con/coin + ^- (odo:raid typ) + ?. ?=($$ -.con) ~|(%not-dime !!) + ?. =(typ p.p.con) ~|(bad-odor+`@tas`p.p.con !!) + q.p.con + :: + ++ ul :: null + |=(wer/weir ?~(wer ~ !!)) + :: + ++ un + |* wit/$-(coin *) + |= wir/weir ^+ *wit + ?~ wir !! + ?^ t.wir !! + (wit i.wir) + -- -- diff --git a/mar/talk/command.hoon b/mar/talk/command.hoon index b5ec7e8803..3806d1058c 100644 --- a/mar/talk/command.hoon +++ b/mar/talk/command.hoon @@ -14,7 +14,8 @@ => [jo ..command] |= a/json ^- command =- (need ((of -) a)) - =< :~ review+(ar thot) + =< :~ publish+(ar thot) + bearing+ul == |% ++ op :: parse keys of map diff --git a/mar/talk/prize.hoon b/mar/talk/prize.hoon new file mode 100644 index 0000000000..aa7b3bc1f0 --- /dev/null +++ b/mar/talk/prize.hoon @@ -0,0 +1,14 @@ +:: +:::: /hoon/prize/talk/mar + :: +/? 310 +/- talk +!: +[talk .] +|_ piz/prize +:: +++ grab :: convert from + |% + ++ noun prize :: clam from %noun + -- +-- diff --git a/mar/talk/rumor.hoon b/mar/talk/rumor.hoon new file mode 100644 index 0000000000..4fc0164ce9 --- /dev/null +++ b/mar/talk/rumor.hoon @@ -0,0 +1,14 @@ +:: +:::: /hoon/rumor/talk/mar + :: +/? 310 +/- talk +!: +[talk .] +|_ dif/rumor +:: +++ grab :: convert from + |% + ++ noun rumor :: clam from %noun + -- +-- diff --git a/sur/talk.hoon b/sur/talk.hoon index 4baf6d96f3..07397ad5da 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -9,26 +9,23 @@ ::> models relating to queries, their results and updates. ::+| :: -::TODO path parsing/casting: ;;(query pax) or ((hard query) pax) -:: or (raid /~zod/5 /[%p]/[%ud]) -:: ...but it's still shit. ++ query ::> query paths $% {$reader $~} ::< shared ui state {$friend $~} ::< publicly joined + {$burden $~} ::< duties to share + {$report $~} ::< duty reports {$circle nom/knot ran/range} ::< story query == :: -++ range (unit {hed/@ t/(unit {tal/@ $~})}) ::< msg range, @ud/@da +++ range (unit {hed/place tal/(unit place)}) ::< msg range, @ud/@da +++ place $%({$da @da} {$ud @ud}) ::< point for range ++ prize ::> query result $% $: $reader ::< /reader gys/(jug char (set partner)) ::< glyph bindings nis/(map ship cord) ::< nicknames == :: {$friend cis/(set circle)} ::< /friend - $: $circle ::< /circle - gaz/(list telegram) ::< queried messages - cos/lobby ::< configs - pes/crowd ::< presences - == :: + {$burden sos/(map knot burden)} ::< /burden + {$circle burden} ::< /circle == :: ++ rumor ::< query result change $% $: $reader ::< /reader @@ -38,22 +35,29 @@ == :: == :: {$friend add/? cir/circle} ::< /friend + {$burden nom/knot dif/diff-story} ::< /burden {$circle dif/diff-story} ::< /circle == :: +++ burden ::< full story state + $: gaz/(list telegram) ::< all messages + cos/lobby ::< loc & rem configs + pes/crowd ::< loc & rem presences + == :: ::TODO deltas into app ++ delta :: $% ::TODO no more %more, just produce/take list instead! {$more mor/(list delta)} ::< multiple changes :: messaging state :: {$out cir/circle out/(list thought)} ::< msgs into outbox - {$done don/(map @ud {partner ?})} ::< msgs delivered + {$done don/(map @ud {partner (unit tang)})} ::< msgs delivered :: shared ui state :: {$glyph diff-glyph} ::< un/bound glyph {$nick diff-nick} ::< changed nickname :: story state :: {$story nom/knot dif/diff-story} ::< change to story :: side-effects :: - {$bear cir/circle} ::< %burden command + {$init $~} ::< initialize + {$observe who/ship} ::< watch burden bearer {$react ost/bone rac/reaction} ::TODO ost.bol? ::< reaction to action {$quit ost/bone} ::< force unsubscribe == :: @@ -61,19 +65,21 @@ ++ diff-nick {who/ship nic/cord} ::< changed nickname ++ diff-story :: $% {$new con/config} ::< new story + {$bear bur/burden} ::< new inherited story {$grams gaz/(list telegram)} ::< new/changed msgs {$config cir/circle dif/diff-config} ::< new/changed config {$status pan/partner who/ship dif/diff-status} ::< new/changed status + {$follow sub/? pas/(set partner)} ::TODO range ::< un/subscribe {$remove $~} ::< removed story == :: ++ diff-config ::> config change $% {$full cof/config} ::< fully changed config - {$source add/? pas/(set partner)} ::< add/rem sources + ::TODO maybe just single partner, since we prob always do that + {$sourcee add/? pas/(set partner)} ::< add/rem sources {$caption cap/cord} ::< changed description {$filter fit/filter} ::< changed filter {$permit add/? sis/(set ship)} ::< add/rem to b/w-list {$secure sec/security} ::< changed security - {$federal add/? fed/? sis/(set ship)} ::< add/rem may/fes {$remove $~} ::< removed config == :: ++ diff-status ::> status change @@ -102,8 +108,6 @@ {$filter nom/knot fit/filter} ::< change message rules {$permit nom/knot inv/? sis/(set ship)} ::< invite/banish {$source nom/knot sub/? src/(set partner)} ::< un/sub to/from src - {$enlist nom/knot fed/? sis/(set ship)} ::< dis/allow federation - {$burden circle} ::< help federate :: messaging :: {$convey tos/(list thought)} ::< post exact {$phrase aud/(set partner) ses/(list speech)} ::< post easy @@ -119,18 +123,6 @@ wat/cord ::< explain why/(unit action) ::< cause == :: -++ lowdown ::> new/changed state - $% :: story state :: - $: $confs ::< configs - loc/(unit config) ::< local config - rem/(map circle (unit config)) ::< remote configs - == :: - {$precs reg/crowd} ::< presences - {$grams num/@ud gaz/(list telegram)} ::< messages - :: ui state :: - {$glyph (jug char (set partner))} ::< glyph bindings - {$names (map ship (unit human))} ::< nicknames - == :: :: ::> || ::> || %broker-communication @@ -139,19 +131,8 @@ ::+| :: ++ command ::> effect on story - $% {$review tos/(list thought)} ::< deliver - $: $burden ::< starting fed state - nom/knot - cof/lobby - pes/crowd - gaz/(list telegram) - == - {$relief nom/knot who/(set ship)} ::< federation ended - == :: -++ report ::> update - $% {$lobby cab/lobby} ::< config neighborhood - {$crowd reg/crowd} ::< presence - {$grams num/@ud gaz/(list telegram)} ::< thoughts + $% {$publish tos/(list thought)} ::< deliver + {$bearing $~} ::< prompt to listen == :: :: ::> || @@ -168,24 +149,25 @@ :: circle configurations. :: ++ lobby {loc/config rem/(map circle config)} ::< our & srcs configs ++ config ::> circle config - $: src/(set partner) ::< pulls from + $: sre/(set partner) ::< active sources cap/cord ::< description fit/filter ::< message rules con/control ::< restrictions - fed/federal ::< federators + :: so: only change src on success of peer/pull (√) + :: and: when gaining a fed, do a %peer (√) == :: ++ filter ::> content filters $: cus/? ::< dis/allow capitals + ::TODO rename cus to cas? (capitals/case instead of cuss) utf/? ::< dis/allow non-ascii == :: ++ control {sec/security ses/(set ship)} ::< access control -++ security ::> security kind +++ security ::> security mode $? $black ::< channel, blacklist $white ::< village, whitelist $green ::< journal, author list $brown ::< mailbox, our r, bl w == :: -++ federal {may/(set ship) fes/(set ship)} ::< federation control :: participant metadata. :: ++ crowd {loc/group rem/(map partner group)} ::< our & srcs presences ++ group (map ship status) ::< presence map @@ -254,7 +236,6 @@ $released ::< sent one-way $accepted ::< fully processed == :: -::TODO what is ++bouquet even for? not yet used... ++ bouquet (set flavor) ::< complete aroma ++ flavor path ::< content flavor -- From 975f07f2d15ab5ded34d9ecfde633a1eee76357d Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 12 Jun 2017 18:09:00 -0700 Subject: [PATCH 100/303] Burden subscriptions now specify the bearer, delivering "customized" rumors. --- app/talk-guardian.hoon | 12 ++++++------ sur/talk.hoon | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 7491def55e..d8ad2d18d7 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -1099,7 +1099,7 @@ %peer /burden [sen %talk-guardian] - /burden + /burden/(scot %p our.bol) == :: ++ da-observe ::< watch burden bearer @@ -1790,12 +1790,12 @@ ::TODO only avoid src.bol when they sent a burden or similar? ::TODO shouldn't this prevent senders from getting their message echoed :: to them? - ?: =(who src.bol) ~ + ?: =(who.qer src.bol) ~ ?. ?=($story -.dif) ~ :: only burden channels for now. ?. =(%black sec.con.shape:(~(got by stories) nom.dif)) ~ ~& [%sending-burden nom.dif -.dif.dif who] - `[%burden nom.dif (tmp-their-change who dif.dif)] + `[%burden nom.dif (tmp-their-change who.qer dif.dif)] :: $report :: only send changes we didn't get from above. @@ -1809,7 +1809,7 @@ :: only burden channels for now. ?. =(%black sec.con.shape.soy) ~ ~& [%sending-report nom.dif -.dif.dif who] - `[%burden nom.dif (tmp-their-change who dif.dif)] + `[%burden nom.dif (tmp-their-change (sein our.bol) dif.dif)] :: $circle ?. ?=($story -.dif) ~ @@ -1860,7 +1860,7 @@ |^ %- af :~ [%reader ul] [%friend ul] - [%burden ul] + [%burden (at /[%p])] [%report ul] [%circle (al knot rang)] == @@ -1889,7 +1889,7 @@ ?- -.qer $reader (team our.bol who) $friend & - $burden =(our.bol (sein who)) + $burden &(=(our.bol (sein who)) =(who who.qer)) $report =(who (sein our.bol)) :: $circle diff --git a/sur/talk.hoon b/sur/talk.hoon index 07397ad5da..800222f0ed 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -12,7 +12,7 @@ ++ query ::> query paths $% {$reader $~} ::< shared ui state {$friend $~} ::< publicly joined - {$burden $~} ::< duties to share + {$burden who/ship} ::< duties to share {$report $~} ::< duty reports {$circle nom/knot ran/range} ::< story query == :: From ef5bfcd6d686f5cc575eaeaaa1b0c3020b4877c6 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 12 Jun 2017 18:10:55 -0700 Subject: [PATCH 101/303] Implemented catch-all ++reap. --- app/talk-guardian.hoon | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index d8ad2d18d7..03b6a4be8b 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -1855,7 +1855,6 @@ ::> :: ^- $-((list coin) query) - ::TODO silently crashes, make it loud! => depa |^ %- af :~ [%reader ul] @@ -1980,6 +1979,15 @@ %- pre-bake ta-done:(ta-cancel:ta src.bol pax) :: +++ reap ::< catch-all reap + ::> + :: + |= {wir/wire fal/(unit tang)} + ^- (quip move +>) + ?~ fal [~ +>] + ~| reap-fail+wir + (mean u.fal) +:: ++ reap-friend ::< subscription n/ack ::> if subscribing failed, update state to reflect ::> that. From 2c96e87060ee6a30c10dc8d715d429f23d500715 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 13 Jun 2017 11:14:13 -0700 Subject: [PATCH 102/303] Moved %done delta logic upstream. Now actually stores message with updated audience. --- app/talk-guardian.hoon | 51 ++++++++++++++++++------------------------ sur/talk.hoon | 2 +- 2 files changed, 23 insertions(+), 30 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 03b6a4be8b..99257e0ac2 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -538,6 +538,22 @@ (so-hear:sor | q.res dif.dif) == :: + ++ ta-repeat ::< message delivered + ::> + :: + |= {num/@ud who/partner fal/(unit tang)} + ^+ +> + =+ oot=(~(get by q.outbox) num) + ?~ oot ~&([%ta-repeat-none num] +>.$) ::TODO crash? + =. aud.u.oot + =+ olg=(~(got by aud.u.oot) who) + %+ ~(put by aud.u.oot) who + :- -.olg + ?~(fal %received ~>(%slog.[0 u.fal] %rejected)) + =. +>.$ + (ta-think | our.bol u.oot ~) + (ta-delta %done num) + :: ::> || ::> || %messaging ::> || @@ -1074,7 +1090,7 @@ $(+>.^$ ^$(dif i.mor.dif), mor.dif t.mor.dif) :: $out (da-change-out +.dif) - $done (da-change-done (~(tap by don.dif))) + $done (da-change-done +.dif) $glyph (da-change-glyph +.dif) $nick (da-change-nick +.dif) $story (da-change-story +.dif) @@ -1134,36 +1150,12 @@ out t.out == :: - ++ da-change-done ::< sent & receives msgs + ++ da-change-done ::< delivered messages ::> :: - ::TODO this needs a lot of work, maybe? - :: make this dumber, make the ++ta equivalent smarter! - |= don/(list {num/@ud who/partner fal/(unit tang)}) + |= num/@ud ^+ +> - ?~ don +> - =+ oot=(~(get by q.outbox) num.i.don) - ?~ oot ~&([%da-change-done-none num.i.don] +>.$) ::TODO crash? - =. aud.u.oot - =+ olg=(~(got by aud.u.oot) who.i.don) - %+ ~(put by aud.u.oot) who.i.don - :- -.olg - ?~(fal.i.don %received ~>(%slog.[0 u.fal.i.don] %rejected)) - =. +>.$ - +>.$ ::TODO!!! da-think??? - $(q.outbox (~(del by q.outbox) num.i.don)) - ::|= {num/@ud pan/partner fal/(unit tang)} - ::=+ oot=(~(get by q.outbox) num) - ::?~ oot ~|([%ta-repeat-none num] !!) - ::=. q.outbox (~(del by q.outbox) num) - ::=. aud.u.oot - :: =+ olg=(~(got by aud.u.oot) pan) - :: %+ ~(put by aud.u.oot) pan - :: :- -.olg - :: ?~ fal %received - :: ~> %slog.[0 u.fal] - :: %rejected - ::(ta-think | our.bol u.oot ~) + +>(q.outbox (~(del by q.outbox) num)) :: ++ da-change-glyph ::< un/bound glyph ::> @@ -2029,7 +2021,8 @@ ^- (quip move +>) %+ etch-repeat [%repeat wir] |= {num/@ud src/ship nom/knot} - (f-bake %done (strap num [%& src nom] fal)) + %- pre-bake + ta-done:(ta-repeat:ta num [%& src nom] fal) :: ::> || ::> || %logging diff --git a/sur/talk.hoon b/sur/talk.hoon index 800222f0ed..cf502f4664 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -49,7 +49,7 @@ {$more mor/(list delta)} ::< multiple changes :: messaging state :: {$out cir/circle out/(list thought)} ::< msgs into outbox - {$done don/(map @ud {partner (unit tang)})} ::< msgs delivered + {$done num/@ud} ::< msgs delivered :: shared ui state :: {$glyph diff-glyph} ::< un/bound glyph {$nick diff-nick} ::< changed nickname From 82ed507338a792f5ae363971b88351ef64006c51 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 13 Jun 2017 11:16:19 -0700 Subject: [PATCH 103/303] Weaved agent's message printing into ++ta-learn and friends. No longer reprints messages if only audience/delivery changed. --- app/talk-agent.hoon | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 15b3d9604f..d49be83bb8 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -273,7 +273,7 @@ :: $circle %. gaz.piz - %= ta-change-grams + %= ta-lesson sources sre.loc.cos.piz mirrors (~(put by rem.cos.piz) incir loc.cos.piz) remotes (~(put by rem.pes.piz) inpan loc.pes.piz) @@ -310,7 +310,7 @@ ~&([%unexpected-circle-rumor -.dif] +>) :: $grams - (ta-change-grams gaz.dif) + (ta-lesson gaz.dif) :: $config %= +> @@ -356,16 +356,6 @@ =. nik (nik-from-nak nek) sh-done:~(sh-prod sh cli) :: - ++ ta-change-grams ::< apply messages - ::> applies new or changed telegrams. - :: - |= gaz/(list telegram) - ^+ +> - =. +>.$ (ta-lesson gaz) - ::TODO maybe move to ta-learn and pass num? - =< sh-done - (~(sh-grams sh cli) gaz) - :: ::> || ::> || %messages ::> || @@ -396,21 +386,24 @@ :: |= gam/telegram ^+ +> - %= +> - grams [gam grams] - count +(count) - known (~(put by known) uid.tot.gam count) + =: grams [gam grams] + count +(count) + known (~(put by known) uid.tot.gam count) == + =< sh-done + (~(sh-gram sh cli) gam) :: ++ ta-revise ::< revise message ::> modify a telegram we know. :: |= {num/@ud gam/telegram} =+ way=(sub count num) - ?: =(gam (snag (dec way) grams)) - +>.$ :: no change + =+ old=(snag (dec way) grams) + ?: =(gam old) +>.$ :: no change =. grams (welp (scag (dec way) grams) [gam (slag way grams)]) - +>.$ + ?: =(sam.tot.gam sam.tot.old) +>.$ :: just audience change + =< sh-done + (~(sh-gram sh cli) gam) :: ::> || ::> || %console From 5a6112d8876b01a57e76d4a56b6434f316cfdff6 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 13 Jun 2017 17:18:04 -0700 Subject: [PATCH 104/303] Fixed issue where messages got stored in the wrong order. --- app/talk-guardian.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 99257e0ac2..2f1f52af76 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -1412,7 +1412,7 @@ ?~ old :: new message %_ +>.$ - grams [gam grams] + grams (welp grams [gam ~]) count +(count) known (~(put by known) uid.tot.gam count) == From ccfd01bb67c632b73014cc8cc1d47695b6a1d5c8 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 13 Jun 2017 17:28:16 -0700 Subject: [PATCH 105/303] Touched up burden logic and moved it upstream, into delta generation. --- app/talk-guardian.hoon | 203 ++++++++++++++++++++--------------------- sur/talk.hoon | 5 +- 2 files changed, 101 insertions(+), 107 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 2f1f52af76..611db63a2e 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -309,7 +309,9 @@ :* [[%& our.bol nom] ~ ~] des [| |] - [typ ~] + :- typ + ?. ?=(?($white $green) typ) ~ + [our.bol ~ ~] == %- react [%fail (crip "{(trip nom)}: already exists") `act] @@ -490,22 +492,10 @@ ~&([%ignoring-prize -.piz] +>) :: $burden - %- ta-deltas %+ roll (~(tap by sos.piz)) - |= {{n/knot b/burden} d/(list delta)} - =- [[%story n %bear b(gaz -)] d] - ::TODO change audiences of messages from (sein our)/n into our/n - %+ turn gaz.b - |= t/telegram - =- t(aud.tot -) - =/ oud - (~(get by aud.tot.t) [%& (sein our.bol) n]) - ?~ oud ::TODO seems like it should never occur? - ~& %unexpected-parent-not-audience - aud.tot.t - =. aud.tot.t - (~(del by aud.tot.t) [%& (sein our.bol) n]) - (~(put by aud.tot.t) [%& our.bol n] u.oud) + |= {{n/knot b/burden} _..ta-take} + =< so-done + (~(so-bear so n ~ (fall (~(get by stories) n) *story)) b) :: $circle =+ res=(tmp-parse-diff-path wir) @@ -528,8 +518,9 @@ (so-hear:sor & [our.bol nom.dif] dif.dif) :: $new - ::TODO we make a %bear delta with just the config set. - (ta-delta %story nom.dif %bear ~ [con.dif.dif ~] [~ ~]) + =< so-done + %- ~(so-hear so nom.dif ~ (fall (~(get by stories) nom.dif) *story)) + [& [our.bol nom.dif] %bear ~ [cof.dif.dif ~] [~ ~]] == :: $circle @@ -688,6 +679,31 @@ ^+ +> (so-delta %story nom dif) :: + ++ so-config-full ::< split full config + ::> + :: + |= {old/(unit config) cof/config} + ^+ +> + ~& %so-config-full + %- so-deltas + %+ turn + %+ weld + ^- (list diff-story) + ?~ old ~ + ::TODO? what to do about sre? + :~ ::[%follow | sre.u.old] + [%config so-cir %permit | ses.con.u.old] + == + ^- (list diff-story) + :~ ::[%follow & sre.cof] ::TODO double-check da-$follow checks existing sre + [%config so-cir %caption cap.cof] + [%config so-cir %filter fit.cof] + [%config so-cir %secure sec.con.cof] + [%config so-cir %permit & ses.con.cof] + == + |= d/diff-story + [%story nom d] + :: ::> || ::> || %data ::> || @@ -734,15 +750,24 @@ ::TODO we check for foreigns here, but they should just not get sent :: in the first place. update ++-change or whatever! :: (we don't care for remote remotes, etc.) - $new $(dif [%config src %full con.dif]) - $bear ~&(%so-hear-unexpected-bear +>) + $new ?: =(src so-cir) + ~& %new-by-us + (so-config-full ~ cof.dif) + ~& %new-by-other + $(dif [%config src %full cof.dif]) + $bear ~&(%so-bear (so-bear bur.dif)) + $burden ~&(%burden-not-rumor +>) $grams (so-lesson gaz.dif) - $config ::TODO accept burden change by parents. - :: ignore foreign mirrors. - ?. |(=(src cir.dif) =(src so-cir)) - ~& %unexpected-ignoring-remote-config - +> - (so-delta-our dif) + $config :: full changes to us need to get split up. + ?: &(=(cir.dif so-cir) ?=($full -.dif.dif)) + (so-config-full `shape cof.dif.dif) + :: remotes are fine. + ?: =(src cir.dif) + (so-delta-our dif) + :: remotes of remotes are not. + ~& %unexpected-ignoring-remote-config + ~? =(src so-cir) %but-src-is-us + +> $status :: ignore foreign remotes. ?. |(=([%& src] pan.dif) =(src so-cir)) ~& %unexpected-ignoring-remote-status @@ -752,6 +777,48 @@ $remove (so-delta-our %config src %remove ~) == :: + ++ so-bear ::< accept burden + ::> + :: + |= {gaz/(list telegram) cos/lobby pes/crowd} + ^+ +> + :: local config + =. ..so-bear + (so-config-full `shape loc.cos) + :: remote config + =. ..so-bear + %+ roll (~(tap by rem.cos)) + |= {{r/circle c/config} _..so-bear} + (so-delta-our %config r %full c) + :: local presence + =. ..so-bear + %+ roll (~(tap by loc.pes)) + |= {{w/ship s/status} _..so-bear} + (so-delta-our %status so-pan w %full s) + :: remote presence + =. ..so-bear + %+ roll (~(tap by rem.pes)) + |= {{p/partner g/group} _..so-bear} + %+ roll (~(tap by g)) + |= {{w/ship s/status} _..so-bear} + (so-delta-our %status p w %full s) + :: telegrams + =. ..so-bear + %+ so-delta-our %grams + %+ turn gaz + |= t/telegram + =- t(aud.tot -) + =/ oud + (~(get by aud.tot.t) [%& (sein our.bol) nom]) + ?~ oud ::TODO seems like it should never occur? + ~& %unexpected-parent-not-audience + aud.tot.t + =. aud.tot.t + (~(del by aud.tot.t) [%& (sein our.bol) nom]) + (~(put by aud.tot.t) [%& our.bol nom] u.oud) + :: burden flag + (so-delta-our %burden &) + :: ::> || ::> || %changes ::> || @@ -1197,10 +1264,10 @@ |= {nom/knot dif/diff-story} ^+ +> ?+ -.dif - sa-done:(~(sa-change sa nom (~(got by stories) nom)) dif) + sa-done:(~(sa-change sa nom (fall (~(get by stories) nom) *story)) dif) :: $new (da-create nom +.dif) - $bear (da-bear nom +.dif) + $bear ~&(%unexpected-unsplit-bear +>) $remove (da-delete nom) == :: @@ -1209,28 +1276,11 @@ :: |= {nom/knot cof/config} ^+ +> - :: if it's a whitelisted circle, put us in it. - =. ses.con.cof ::TODO =? - ?: ?=(?($white $green) sec.con.cof) - [our.bol ~ ~] - ses.con.cof - :: make sure it's its own source. - ::TODO? is this... necessary? probably, for other circle's reference... - =. sre.cof - (~(put in sre.cof) [%& our.bol nom]) =< sa-done :: default for ? is &, so we manually set to | now. %- ~(sa-change sa nom %*(. *story burden |)) [%config [our.bol nom] %full cof] :: - ++ da-bear ::< accept new burden - ::> - :: - |= {nom/knot bur/burden} - ^+ +> - =+ soy=(fall (~(get by stories) nom) *story) - sa-done:(~(sa-bear sa nom soy) bur) - :: ++ da-delete ::< delete story ::> calls the story core to delete story {nom}. :: @@ -1301,44 +1351,6 @@ :: (sa-abjure (~(tap in sre.shape))) :: - ++ sa-bear ::< ... - ::> - ::> for now, just overwrite all existing state. - :: - ::TODO should we calculate these changes in - :: ++so instead? the change to burden is - :: distinct, but everything else is just - :: more of the same deltas. - |= {gaz/(list telegram) cos/lobby pes/crowd} - ^+ +> - :: local config - =. +> - (sa-change-local %config sa-cir %full loc.cos) - :: remote config - =. +> - %+ roll (~(tap by rem.cos)) - |= {{r/circle c/config} _..sa-bear} - (sa-change-remote %config r %full c) - :: local presence - =. +> - %+ roll (~(tap by loc.pes)) - |= {{w/ship s/status} _..sa-bear} - (sa-change-local %status sa-pan w %full s) - :: remote presence - =. +> - %+ roll (~(tap by rem.pes)) - |= {{p/partner g/group} _..sa-bear} - %+ roll (~(tap by g)) - |= {{w/ship s/status} _..sa-bear} - (sa-change-remote %status p w %full s) - :: telegrams - =. +> - %+ roll gaz - |= {g/telegram _..sa-bear} - (sa-change-gram g) - :: burden flag - +>(burden &) - :: ++ sa-change ::< apply circle delta ::> :: @@ -1366,6 +1378,9 @@ ^+ +> ?+ -.dif ~&([%unexpected-delta-local -.dif] !!) + :: + $burden + +>(burden bur.dif) :: $grams |- ^+ +>.^$ @@ -1455,32 +1470,10 @@ ++ sa-config-effects ::< config side-effects ::> :: - ::TODO we shouldn't even be applying %full diffs, only their results! |= {old/config dif/diff-config} ^- (list move) ?+ -.dif ~ $permit (sa-permit-effects sec.con.old ses.con.old +.dif) - :: - $full - ~& %full-config-changes - =* new cof.dif - :: deal with subscription changes. - =/ sem - .= ?=(?($white $green) sec.con.new) - ?=(?($white $green) sec.con.old) - ;: weld - ::TODO but these needs to be treated as %sourcee, right? - ::(sa-follow-effects | (~(dif in sre.old) sre.new)) - ::(sa-follow-effects & (~(dif in src.new) src.old)) - :: - ?. sem ~ - %^ sa-permit-effects sec.con.new ses.con.old - [| (~(dif in ses.con.old) ses.con.new)] - :: - ?. sem ~ - %^ sa-permit-effects sec.con.new ses.con.old - [& (~(dif in ses.con.new) ses.con.old)] - == == :: ++ sa-follow-effects ::< un/subscribe diff --git a/sur/talk.hoon b/sur/talk.hoon index cf502f4664..6d759e0a96 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -64,8 +64,9 @@ ++ diff-glyph {bin/? gyf/char pas/(set partner)} ::< un/bound glyph ++ diff-nick {who/ship nic/cord} ::< changed nickname ++ diff-story :: - $% {$new con/config} ::< new story + $% {$new cof/config} ::< new story {$bear bur/burden} ::< new inherited story + {$burden bur/?} ::< burden flag {$grams gaz/(list telegram)} ::< new/changed msgs {$config cir/circle dif/diff-config} ::< new/changed config {$status pan/partner who/ship dif/diff-status} ::< new/changed status @@ -73,7 +74,7 @@ {$remove $~} ::< removed story == :: ++ diff-config ::> config change - $% {$full cof/config} ::< fully changed config + $% {$full cof/config} ::< set w/o side-effects ::TODO maybe just single partner, since we prob always do that {$sourcee add/? pas/(set partner)} ::< add/rem sources {$caption cap/cord} ::< changed description From 09a155f1c6fab6d6e29fc62d9878d01538f25e1e Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 13 Jun 2017 17:51:10 -0700 Subject: [PATCH 106/303] Fixed federation across galaxies. --- app/talk-guardian.hoon | 18 ++++++++++-------- lib/talk.hoon | 5 +++++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 611db63a2e..7d98f5b164 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -432,7 +432,7 @@ :: |= who/ship ^+ +> - ?. =(our.bol (sein who)) + ?. =(our.bol (above who)) ~&([%not-our-bearer who] +>) ~& [%gonna-observe who] (ta-delta %observe who) @@ -809,12 +809,12 @@ |= t/telegram =- t(aud.tot -) =/ oud - (~(get by aud.tot.t) [%& (sein our.bol) nom]) + (~(get by aud.tot.t) [%& (above our.bol) nom]) ?~ oud ::TODO seems like it should never occur? ~& %unexpected-parent-not-audience aud.tot.t =. aud.tot.t - (~(del by aud.tot.t) [%& (sein our.bol) nom]) + (~(del by aud.tot.t) [%& (above our.bol) nom]) (~(put by aud.tot.t) [%& our.bol nom] u.oud) :: burden flag (so-delta-our %burden &) @@ -1170,7 +1170,7 @@ ++ da-init ::< startup side-effects ::> :: - =+ sen=(sein our.bol) + =+ sen=(above our.bol) ::TODO move this logic to ta-init ?: ?| !=(%czar (clan sen)) =(sen our.bol) @@ -1784,7 +1784,7 @@ :: $report :: only send changes we didn't get from above. - ?: =(src.bol (sein our.bol)) ~ + ?: =(src.bol (above our.bol)) ~ :: only send story reports about grams and status. ?. ?=($story -.dif) ~ ?. ?=(?($grams $status) -.dif.dif) ~ @@ -1794,7 +1794,7 @@ :: only burden channels for now. ?. =(%black sec.con.shape.soy) ~ ~& [%sending-report nom.dif -.dif.dif who] - `[%burden nom.dif (tmp-their-change (sein our.bol) dif.dif)] + `[%burden nom.dif (tmp-their-change (above our.bol) dif.dif)] :: $circle ?. ?=($story -.dif) ~ @@ -1873,8 +1873,10 @@ ?- -.qer $reader (team our.bol who) $friend & - $burden &(=(our.bol (sein who)) =(who who.qer)) - $report =(who (sein our.bol)) + $burden ?& =(who who.qer) + =(our.bol (above who)) + == + $report =(who (above our.bol)) :: $circle ?. (~(has by stories) nom.qer) | diff --git a/lib/talk.hoon b/lib/talk.hoon index d6c319a341..3748dc552a 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -24,6 +24,11 @@ ?. ?=($earl (clan who)) who (sein who) :: +++ above + |= who/ship + ?: ?=($czar (clan who)) ~zod + (sein who) +:: ++ said-url :: app url |= url/purl :^ ost.bol %poke /said-url From 9dbdd3f89fb8a81171d74f7fb79053ddd24d77ed Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 13 Jun 2017 18:06:38 -0700 Subject: [PATCH 107/303] Tiny changes, comments & cleanup. --- app/talk-guardian.hoon | 17 ++++++++--------- lib/talk.hoon | 13 ++++++++----- sur/talk.hoon | 2 +- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 7d98f5b164..21bbcd337e 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -719,21 +719,20 @@ ::> arms that apply events we received. ::+| :: - ++ so-take ::< accept circle prize + ++ so-take ::< accept circle prize ::> :: |= {src/circle gaz/(list telegram) cos/lobby pes/crowd} ^+ +> =. +>.$ (so-hear | src %config src %full loc.cos) - ::TODO we'd need a %precs diff-story for this if we don't want to urn... =. +>.$ %- ~(rep in loc.pes) |= {{w/ship s/status} _+>.$} (so-hear | src %status [%& src] w %full s) (so-lesson gaz) :: - ++ so-hear ::< accept circle rumor + ++ so-hear ::< accept circle rumor ::> :: |= {bur/? src/circle dif/diff-story} @@ -741,7 +740,6 @@ ::TODO? these checks are still important, because :: when things are slow we may get diffs from :: things we already unsubscribed from, right? - ::TODO account for federation. ~? ?! ?| (~(has in sre.shape) [%& src]) =(src so-cir) == @@ -1193,7 +1191,7 @@ %- da-emit :* 0 %peer - /report + /report/(scot %p who) [who %talk-guardian] /report == @@ -1748,6 +1746,7 @@ ++ i-change ::< delta to rumor ::> :: + ::TODO remove who from sample |= {who/ship weg/(list coin) dif/delta} ^- (unit rumor) =+ qer=(coins-to-query weg) @@ -1772,9 +1771,8 @@ `[%friend u.add [our.bol nom.dif]] :: $burden - ::TODO only avoid src.bol when they sent a burden or similar? - ::TODO shouldn't this prevent senders from getting their message echoed - :: to them? + ::TODO keep an eye on this, maybe only avoid src.bol when they sent a + :: burden rumor. ?: =(who.qer src.bol) ~ ?. ?=($story -.dif) ~ :: only burden channels for now. @@ -1979,7 +1977,7 @@ ::> if subscribing failed, update state to reflect ::> that. :: - ::TODO this should deal with /reader subscriptions too. + ::TODO update to handle all subscription kinds. |= {wir/wire fal/(unit tang)} ^- (quip move +>) %+ etch-friend [%friend wir] @@ -1995,6 +1993,7 @@ ++ quit-friend ::< dropped subscription ::> gall dropped our subscription. resubscribe. :: + ::TODO update for all subscription kinds. |= wir/wire ^- (quip move +>) %+ etch-friend [%friend wir] diff --git a/lib/talk.hoon b/lib/talk.hoon index 3748dc552a..b6b948df5f 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -11,7 +11,8 @@ [. ^talk] |_ bol/bowl ++ main :: main story - |= who/ship ^- cord + |= who/ship + ^- cord =+ can=(clan who) ?+ can %porch $czar %court @@ -151,6 +152,7 @@ == == :: +::TODO annotate all! ++ depa :: de-pathing core => |% ++ grub * :: result ++ weir (list coin) :: parsed wire @@ -207,6 +209,7 @@ :: ++ do |* typ/@tas + =/ typecheck `@tas`typ |= con/coin ^- (odo:raid typ) ?. ?=($$ -.con) ~|(%not-dime !!) @@ -218,9 +221,9 @@ :: ++ un |* wit/$-(coin *) - |= wir/weir ^+ *wit - ?~ wir !! - ?^ t.wir !! - (wit i.wir) + |= wer/weir ^+ *wit + ?~ wer !! + ?^ t.wer !! + (wit i.wer) -- -- diff --git a/sur/talk.hoon b/sur/talk.hoon index 6d759e0a96..01a2a9ec43 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -79,8 +79,8 @@ {$sourcee add/? pas/(set partner)} ::< add/rem sources {$caption cap/cord} ::< changed description {$filter fit/filter} ::< changed filter - {$permit add/? sis/(set ship)} ::< add/rem to b/w-list {$secure sec/security} ::< changed security + {$permit add/? sis/(set ship)} ::< add/rem to b/w-list {$remove $~} ::< removed config == :: ++ diff-status ::> status change From d5e052daaa3b8ed5e339865dca5dd4bc85f0e7bc Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 13 Jun 2017 18:46:02 -0700 Subject: [PATCH 108/303] Moved init logic upstream. --- app/talk-guardian.hoon | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 21bbcd337e..330dfe5dca 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -213,8 +213,14 @@ ::> populate state on first boot. ::> creates our default mailbox and journal. :: - ::TODO but now init it spread out over two arms? ugly! - =< (ta-delta %init ~) :: side-effects + =< %- ta-deltas :: side-effects + =+ sen=(above our.bol) + ?: ?| !=(%czar (clan sen)) + =(sen our.bol) + =(%pawn (clan our.bol)) + == + ~ + [%init ~]~ %+ roll ^- (list {security knot cord}) :~ [%brown (main our.bol) 'default home'] @@ -1168,18 +1174,11 @@ ++ da-init ::< startup side-effects ::> :: - =+ sen=(above our.bol) - ::TODO move this logic to ta-init - ?: ?| !=(%czar (clan sen)) - =(sen our.bol) - =(%pawn (clan our.bol)) - == - ..da-init %- da-emit :* 0 %peer /burden - [sen %talk-guardian] + [(above our.bol) %talk-guardian] /burden/(scot %p our.bol) == :: From 23927ece3611c9a5ce05c1d80cea585fcdf23386 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 13 Jun 2017 18:49:45 -0700 Subject: [PATCH 109/303] Made ++da-change-story cleaner. --- app/talk-guardian.hoon | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 330dfe5dca..28f5590d4c 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -1261,7 +1261,13 @@ |= {nom/knot dif/diff-story} ^+ +> ?+ -.dif - sa-done:(~(sa-change sa nom (fall (~(get by stories) nom) *story)) dif) + =< sa-done + %. dif + %~ sa-change sa nom + %+ fall + (~(get by stories) nom) + %*(. *story burden |) + == :: $new (da-create nom +.dif) $bear ~&(%unexpected-unsplit-bear +>) From fa9c55b530f3ce310d830decee25e567885052d3 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 13 Jun 2017 19:40:59 -0700 Subject: [PATCH 110/303] Fixed issue with rare case where federator messages parent directly, in which messages don't get propagates down that parent's branch. --- app/talk-guardian.hoon | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 28f5590d4c..1ec71efc59 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -1776,9 +1776,7 @@ `[%friend u.add [our.bol nom.dif]] :: $burden - ::TODO keep an eye on this, maybe only avoid src.bol when they sent a - :: burden rumor. - ?: =(who.qer src.bol) ~ + ::?: &(=(who.qer src.bol) did-they-send-a-burden) ~ ?. ?=($story -.dif) ~ :: only burden channels for now. ?. =(%black sec.con.shape:(~(got by stories) nom.dif)) ~ From 9378edf56351f2953533138000748d27f20a9662 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 13 Jun 2017 20:09:48 -0700 Subject: [PATCH 111/303] Made invite/banish send notifications again. --- app/talk-guardian.hoon | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 1ec71efc59..3184eac0ff 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -356,9 +356,7 @@ ?~ soy %^ ta-delta %react red [%fail (crip "no story {(trip nom)}") `act] - =/ wyt/? ?=(?($white $green) sec.con.shape.u.soy) - =/ add/? =(inv wyt) - (affect nom %config [our.bol nom] %permit add sis) + so-done:(~(so-permit so nom ~ u.soy) inv sis) :: ++ action-source ::< un/sub p to/from r ::> add/remove {pas} as sources for story {nom}. @@ -1035,14 +1033,6 @@ ::> arms relating to story permissions. ::+| :: - ++ so-secure ::< change security mode - ::> changes our security mode. - :: - |= sec/security - ^+ +> - ?: =(sec sec.con.shape) +> - (so-delta-our %config so-cir %secure sec) - :: ++ so-permit ::< invite/banish ::> update config to dis/allow ships permission. :: @@ -1052,14 +1042,17 @@ ::> add: add to list? =/ wyt/? ?=(?($white $green) sec.con.shape) =/ add/? =(inv wyt) + =/ sus/(set ship) + %. ses.con.shape + ?:(add ~(dif in sis) ~(int in sis)) =. +>.$ %- so-act :- %phrase - %- ~(rep in sis) + %- ~(rep in sus) |= {s/ship a/(set partner) t/(list speech)} :- (~(put in a) [%& s (main s)]) [[%inv inv so-cir] t] - (so-delta-our %config so-cir %permit [add sis]) + (so-delta-our %config so-cir %permit [add sus]) :: ++ so-admire ::< accept from ::> checks {her} write permissions. @@ -1477,6 +1470,7 @@ ^- (list move) ?+ -.dif ~ $permit (sa-permit-effects sec.con.old ses.con.old +.dif) + ::TODO $secure ? == :: ++ sa-follow-effects ::< un/subscribe @@ -1493,8 +1487,6 @@ ++ sa-permit-effects ::< notify permitted ::> :: - ::TODO this seems to also be done in the action, - :: there makes more sense because logic goes into ta. |= {sec/security old/(set ship) add/? sis/(set ship)} ^- (list move) =/ sus/(set ship) @@ -1502,10 +1494,7 @@ ?:(add ~(dif in sis) ~(int in sis)) =/ wyt ?=(?($white $green) sec) =/ inv =(wyt add) - ?: inv - ::TODO %inv & speeches - ~ - ::TODO %inv | speeches + ?: inv ~ (sa-eject sus) :: ::> || From 532de2520b6888734b04487cb95c0439ea603312 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 13 Jun 2017 20:13:47 -0700 Subject: [PATCH 112/303] Minor cleanup and cleanup TODOs. --- app/talk-guardian.hoon | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 3184eac0ff..59f0fec792 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -516,7 +516,6 @@ ~&([%ignoring-rumor -.dif] +>) :: $burden - ~& [%hear-burden -.dif.dif] ?+ -.dif.dif %- (ta-know nom.dif) |= sor/_so =< so-done (so-hear:sor & [our.bol nom.dif] dif.dif) @@ -1512,7 +1511,7 @@ %+ turn pas |= pan/partner ^- (list card) - ?: =(pan [%& our.bol nom]) ~ :: ignore self-subs ::TODO also abjure? + ?: =(pan [%& our.bol nom]) ~ :: ignore self-subs ::> subscribe starting at the last message we got, ::> or if we haven't gotten any yet, messages ::> from up to a day ago. @@ -1546,8 +1545,7 @@ $& ::< circle partner :_ ~ :* %pull - ::TODO update path - /friend/show/[nom]/(scot %p hos.p.pan)/[nom.p.pan] + /circle/[nom]/(scot %p hos.p.pan)/[nom.p.pan] [hos.p.pan %talk-guardian] ~ == @@ -1740,8 +1738,7 @@ ++ i-change ::< delta to rumor ::> :: - ::TODO remove who from sample - |= {who/ship weg/(list coin) dif/delta} + |= {weg/(list coin) dif/delta} ^- (unit rumor) =+ qer=(coins-to-query weg) ?- -.qer @@ -1769,7 +1766,6 @@ ?. ?=($story -.dif) ~ :: only burden channels for now. ?. =(%black sec.con.shape:(~(got by stories) nom.dif)) ~ - ~& [%sending-burden nom.dif -.dif.dif who] `[%burden nom.dif (tmp-their-change who.qer dif.dif)] :: $report @@ -1783,14 +1779,12 @@ ?. burden.soy ~ :: only burden channels for now. ?. =(%black sec.con.shape.soy) ~ - ~& [%sending-report nom.dif -.dif.dif who] `[%burden nom.dif (tmp-their-change (above our.bol) dif.dif)] :: $circle ?. ?=($story -.dif) ~ ?. =(nom.qer nom.dif) ~ ?: ?=($follow -.dif.dif) ~ :: internal-only delta - ~& [%sending-circle nom.dif -.dif.dif who] `[%circle dif.dif] == :: @@ -1804,7 +1798,7 @@ %+ murn (~(tap by sup.bol)) |= {b/bone s/ship p/path} ^- (unit move) - =+ rum=(i-change s (path-to-coins p) dif) + =+ rum=(i-change (path-to-coins p) dif) ::TODO %quit bones that are done with their subscription. :: ...but that would also require a ta-cancel call to remove :: them from the presence list! how do? From 90c0ccdad0eb0e49dc1cc15f4a8180b6e72b1502 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 15 Jun 2017 18:53:47 -0700 Subject: [PATCH 113/303] Renamed sre and sourcee back to src and source. --- app/talk-agent.hoon | 6 +++--- app/talk-guardian.hoon | 32 ++++++++++++++++---------------- lib/talk.hoon | 10 +++++----- sur/talk.hoon | 4 ++-- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index d49be83bb8..27b45c57c8 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -274,7 +274,7 @@ $circle %. gaz.piz %= ta-lesson - sources sre.loc.cos.piz + sources src.loc.cos.piz mirrors (~(put by rem.cos.piz) incir loc.cos.piz) remotes (~(put by rem.pes.piz) inpan loc.pes.piz) == @@ -315,7 +315,7 @@ $config %= +> sources - ?. ?& ?=($sourcee -.dif.dif) + ?. ?& ?=($source -.dif.dif) =(cir.dif incir) == sources @@ -1506,7 +1506,7 @@ =. +>.$ %+ sh-show-sources (weld (trip inbox) ": ") - (sh-set-diff sre.laz sre.loc) + (sh-set-diff src.laz src.loc) ?: !=(sec.con.loc sec.con.laz) =. +>.$ (sh-note :(weld pre "but " (sh-cure sec.con.loc))) %^ sh-show-permits diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 59f0fec792..9aa94db596 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -693,12 +693,12 @@ %+ weld ^- (list diff-story) ?~ old ~ - ::TODO? what to do about sre? - :~ ::[%follow | sre.u.old] + ::TODO? what to do about src? + :~ ::[%follow | src.u.old] [%config so-cir %permit | ses.con.u.old] == ^- (list diff-story) - :~ ::[%follow & sre.cof] ::TODO double-check da-$follow checks existing sre + :~ ::[%follow & src.cof] ::TODO double-check da-$follow checks existing src [%config so-cir %caption cap.cof] [%config so-cir %filter fit.cof] [%config so-cir %secure sec.con.cof] @@ -743,7 +743,7 @@ ::TODO? these checks are still important, because :: when things are slow we may get diffs from :: things we already unsubscribed from, right? - ~? ?! ?| (~(has in sre.shape) [%& src]) + ~? ?! ?| (~(has in src.shape) [%& src]) =(src so-cir) == [%unexpected-rumor-source nom -.dif src] @@ -832,7 +832,7 @@ |= {add/? pas/(set partner)} ^+ +> =/ sus/(set partner) - %. sre.shape + %. src.shape ?:(add ~(dif in pas) ~(int in pas)) ?~ sus +>.$ (so-delta-our %follow & sus) @@ -886,16 +886,16 @@ :: |= pan/partner ^+ +> - ?: (~(has in sre.shape) pan) +> - (so-delta-our %config so-cir %sourcee & [pan ~ ~]) + ?: (~(has in src.shape) pan) +> + (so-delta-our %config so-cir %source & [pan ~ ~]) :: ++ so-leave ::< subscription ended ::> delete {pan} from our sources. :: |= pan/partner ^+ +> - ?. (~(has in sre.shape) pan) +> - (so-delta-our %config so-cir %sourcee | [pan ~ ~]) + ?. (~(has in src.shape) pan) +> + (so-delta-our %config so-cir %source | [pan ~ ~]) :: ++ so-start ::< subscribe follower ::> called upon subscribe. deduces the range of @@ -1344,7 +1344,7 @@ ++ sa-delete ::< deletion of story ::> :: - (sa-abjure (~(tap in sre.shape))) + (sa-abjure (~(tap in src.shape))) :: ++ sa-change ::< apply circle delta ::> @@ -1400,16 +1400,16 @@ :: $follow :: we have to do the effects first, because it - :: checks for new sub targets using sre.shape. + :: checks for new sub targets using src.shape. ~& [%sa-change-follow nom sub.dif pas.dif] =. +> (sa-emil (sa-follow-effects sub.dif pas.dif)) %_ +> ::TODO delete, only done once success - sre.shape ::TODO =? + src.shape ::TODO =? %. pas.dif ?: sub.dif - ~(uni in sre.shape) - ~(dif in sre.shape) + ~(uni in src.shape) + ~(dif in src.shape) == == :: @@ -1478,7 +1478,7 @@ |= {sub/? pas/(set partner)} ^- (list move) =/ sus/(set partner) - %. sre.shape + %. src.shape ?:(sub ~(dif in pas) ~(int in pas)) %. (~(tap in sus)) ?:(sub sa-acquire sa-abjure) @@ -1669,7 +1669,7 @@ :- %friend %- ~(gas in *(set circle)) %+ murn - =- (~(tap in sre.shape.-)) + =- (~(tap in src.shape.-)) (~(got by stories) (main our.bol)) |= p/partner ^- (unit circle) diff --git a/lib/talk.hoon b/lib/talk.hoon index b6b948df5f..a17343072a 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -99,14 +99,14 @@ $filter cof(fit fit.dif) $remove cof :: - $sourcee + $source %= cof - sre + src %. `(set partner)`pas.dif ::TODO? why do we *need* to cast? - ~& [%doing-sourcee add.dif pas.dif] + ~& [%doing-source add.dif pas.dif] ?: add.dif - ~(uni in sre.cof) - ~(dif in sre.cof) + ~(uni in src.cof) + ~(dif in src.cof) == :: $permit diff --git a/sur/talk.hoon b/sur/talk.hoon index 01a2a9ec43..ed8e1b16a2 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -76,7 +76,7 @@ ++ diff-config ::> config change $% {$full cof/config} ::< set w/o side-effects ::TODO maybe just single partner, since we prob always do that - {$sourcee add/? pas/(set partner)} ::< add/rem sources + {$source add/? pas/(set partner)} ::< add/rem sources {$caption cap/cord} ::< changed description {$filter fit/filter} ::< changed filter {$secure sec/security} ::< changed security @@ -150,7 +150,7 @@ :: circle configurations. :: ++ lobby {loc/config rem/(map circle config)} ::< our & srcs configs ++ config ::> circle config - $: sre/(set partner) ::< active sources + $: src/(set partner) ::< active sources cap/cord ::< description fit/filter ::< message rules con/control ::< restrictions From 60f5ed19d173e7d45a5ab28e2543ff8e9b39c4b9 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 15 Jun 2017 20:29:35 -0700 Subject: [PATCH 114/303] Renamed cus in filter to cas. --- app/talk-guardian.hoon | 2 +- sur/talk.hoon | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 9aa94db596..dbd16ec327 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -979,7 +979,7 @@ ?: |((lth a 32) =(a `@c`127)) `@`'?' :: if desired, remove uppercasing. - ?: ?& !cus.fit.shape + ?: ?& !cas.fit.shape (gte a 'A') (lte a 'Z') == diff --git a/sur/talk.hoon b/sur/talk.hoon index ed8e1b16a2..9140b95c37 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -158,8 +158,7 @@ :: and: when gaining a fed, do a %peer (√) == :: ++ filter ::> content filters - $: cus/? ::< dis/allow capitals - ::TODO rename cus to cas? (capitals/case instead of cuss) + $: cas/? ::< dis/allow capitals utf/? ::< dis/allow non-ascii == :: ++ control {sec/security ses/(set ship)} ::< access control From 29cff5f815a8a5faed0c91c8db425cb9dd82a1cd Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 20 Jun 2017 17:52:44 -0700 Subject: [PATCH 115/303] Refactored ++work's ++react to always supply the relevant action. --- app/talk-guardian.hoon | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index dbd16ec327..154b5c55b3 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -285,8 +285,8 @@ ++ react ::< new reaction ::> :: - |= rac/reaction - (ta-delta %react red rac) + |= {res/?($info $fail) wat/cord} + (ta-delta %react red [res wat `act]) :: ++ affect ::< delta to story ::> @@ -294,8 +294,7 @@ |= {nom/knot dif/diff-story} ?: (~(has by stories) nom) (impact nom dif) - %- react - [%fail (crip "no story {(trip nom)}") `act] + (react %fail (crip "no story {(trip nom)}")) :: ++ impact ::< delta for story ::> @@ -319,8 +318,7 @@ ?. ?=(?($white $green) typ) ~ [our.bol ~ ~] == - %- react - [%fail (crip "{(trip nom)}: already exists") `act] + (react %fail (crip "{(trip nom)}: already exists")) :: ++ action-delete ::< delete + announce ::> delete story {nom}, optionally announcing the @@ -354,8 +352,7 @@ |= {nom/knot inv/? sis/(set ship)} =+ soy=(~(get by stories) nom) ?~ soy - %^ ta-delta %react red - [%fail (crip "no story {(trip nom)}") `act] + (react %fail (crip "no story {(trip nom)}")) so-done:(~(so-permit so nom ~ u.soy) inv sis) :: ++ action-source ::< un/sub p to/from r From 87350712be4e391623f1f67950cd69cf4ca57ed6 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 21 Jun 2017 13:48:47 -0700 Subject: [PATCH 116/303] Completed and cleaned up inline documentation. --- app/talk-guardian.hoon | 134 ++++++++++++++++++++++++----------------- sur/talk.hoon | 12 ++-- 2 files changed, 84 insertions(+), 62 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 154b5c55b3..badad2a3e9 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -283,13 +283,14 @@ == :: ++ react ::< new reaction - ::> + ::> send reaction to this action. :: |= {res/?($info $fail) wat/cord} (ta-delta %react red [res wat `act]) :: ++ affect ::< delta to story - ::> + ::> store a delta about a story. if the story + ::> does not exist, react. :: |= {nom/knot dif/diff-story} ?: (~(has by stories) nom) @@ -297,7 +298,7 @@ (react %fail (crip "no story {(trip nom)}")) :: ++ impact ::< delta for story - ::> + ::> Store a delta about a story. :: |= {nom/knot dif/diff-story} (ta-delta %story nom dif) @@ -429,7 +430,7 @@ ::+| :: ++ ta-observe ::< watch burden bearer - ::> + ::> subscribe to a child who is bearing our burden. :: |= who/ship ^+ +> @@ -471,7 +472,7 @@ (so-absent:sor src) :: ++ ta-greet ::< subscription success - ::> + ::> store a started subscription as source. :: |= {nom/knot cir/circle} %- (ta-know nom) |= sor/_so =< so-done @@ -485,7 +486,9 @@ (so-leave:sor %& cir) :: ++ 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. :: |= {wir/wire piz/prize} ^+ +> @@ -505,7 +508,10 @@ == :: ++ 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. :: |= {wir/wire dif/rumor} ^+ +> @@ -530,7 +536,8 @@ == :: ++ ta-repeat ::< message delivered - ::> + ::> message got delivered. if an error was returned + ::> mark the message as rejected. if not, received. :: |= {num/@ud who/partner fal/(unit tang)} ^+ +> @@ -660,14 +667,14 @@ [%app %talk-guardian msg]~ :: ++ so-delta ::< send delta - ::> + ::> store delta in ++ta core. :: |= dif/delta ^+ +> +>(deltas [dif deltas]) :: ++ so-deltas ::< send delta list - ::> + ::> store multiple deltas in ++ta core. :: |= dis/(list delta) %_(+> deltas (welp (flop dis) deltas)) @@ -680,7 +687,8 @@ (so-delta %story nom dif) :: ++ so-config-full ::< split full config - ::> + ::> split a %full config delta up into multiple + ::> smaller ones, for easier application. :: |= {old/(unit config) cof/config} ^+ +> @@ -720,7 +728,7 @@ ::+| :: ++ so-take ::< accept circle prize - ::> + ::> apply the prize as if it were rumors. :: |= {src/circle gaz/(list telegram) cos/lobby pes/crowd} ^+ +> @@ -733,7 +741,7 @@ (so-lesson gaz) :: ++ so-hear ::< accept circle rumor - ::> + ::> apply changes from a rumor to this story. :: |= {bur/? src/circle dif/diff-story} ^+ +> @@ -776,7 +784,9 @@ == :: ++ so-bear ::< accept burden - ::> + ::> add what was pushed down from above to our + ::> state. in case of conflict, existing data is + ::> overwritten. :: |= {gaz/(list telegram) cos/lobby pes/crowd} ^+ +> @@ -865,7 +875,7 @@ (so-delta-our %status so-pan her %full sat) :: ++ so-absent ::< del local presence - ::> + ::> remove {her} from our presence map. :: |= her/ship ^+ +> @@ -879,7 +889,7 @@ ::+| :: ++ so-greet ::< subscription started - ::> + ::> store a started subscription as source. :: |= pan/partner ^+ +> @@ -1126,12 +1136,6 @@ [red %diff %talk-reaction rac] :: ::> || - ::> || %data - ::> || - ::> utility functions for data retrieval. - ::+| - :: - ::> || ::> || %change-application ::> || ::> arms that change the application state. @@ -1161,7 +1165,8 @@ == :: ++ da-init ::< startup side-effects - ::> + ::> apply %init delta, querying the /burden of the + ::> ship above us. :: %- da-emit :* 0 @@ -1172,7 +1177,8 @@ == :: ++ da-observe ::< watch burden bearer - ::> + ::> apply %observe delta, querying the /report of + ::> {who} below us. :: |= who/ship ~& [%peering-report who] @@ -1185,7 +1191,8 @@ == :: ++ da-change-out ::< outgoing messages - ::> + ::> apply an %out delta, sending a message and + ::> adding it to our outbox. :: |= {cir/circle out/(list thought)} ^+ +> @@ -1204,14 +1211,16 @@ == :: ++ da-change-done ::< delivered messages - ::> + ::> apply a %done delta, removing a delivered + ::> message from our outbox. :: |= num/@ud ^+ +> +>(q.outbox (~(del by q.outbox) num)) :: ++ da-change-glyph ::< un/bound glyph - ::> + ::> apply a %glyph delta, un/binding a glyph to/from + ::> a set of partners. :: |= {bin/? gyf/char pas/(set partner)} ^+ +> @@ -1230,7 +1239,8 @@ == :: ++ da-change-nick ::< changed nickname - ::> + ::> apply a %nick delta, setting a nickname for a + ::> ship. :: |= {who/ship nic/cord} ^+ +> @@ -1245,7 +1255,10 @@ ::+| :: ++ 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. :: |= {nom/knot dif/diff-story} ^+ +> @@ -1339,12 +1352,14 @@ ::+| :: ++ sa-delete ::< deletion of story - ::> + ::> apply a %remove story delta, unsubscribing + ::> this story from all its active sources. :: (sa-abjure (~(tap in src.shape))) :: ++ sa-change ::< apply circle delta - ::> + ::> figure out whether to apply a %story delta to + ::> local or remote data. :: |= dif/diff-story ^+ +> @@ -1364,7 +1379,7 @@ == :: ++ sa-change-local ::< apply our delta - ::> + ::> apply a %story delta to local data. :: |= dif/diff-story ^+ +> @@ -1410,8 +1425,9 @@ == == :: - ++ sa-change-gram ::< save/update message - ::> + ++ sa-change-gram ::< save/update message + ::> apply a %grams delta, either appending or + ::> updating a message. :: |= gam/telegram ^+ +> @@ -1432,7 +1448,7 @@ == :: ++ sa-change-remote ::< apply remote's delta - ::> + ::> apply a story diff to remote data. :: |= dif/diff-story ^+ +> @@ -1460,7 +1476,7 @@ == :: ++ sa-config-effects ::< config side-effects - ::> + ::> apply side-effects for a %config delta. :: |= {old/config dif/diff-config} ^- (list move) @@ -1470,7 +1486,8 @@ == :: ++ sa-follow-effects ::< un/subscribe - ::> + ::> apply side-effects for a %follow delta, + ::> un/subscribing this story to/from {pas}. :: |= {sub/? pas/(set partner)} ^- (list move) @@ -1481,7 +1498,9 @@ ?:(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. :: |= {sec/security old/(set ship) add/? sis/(set ship)} ^- (list move) @@ -1642,7 +1661,7 @@ :(welp mos (affection dif)) :: ++ pre-bake ::< apply more deltas - ::> + ::> bake a list of deltas. :: |= dis/(list delta) ^- (quip move +>) @@ -1652,7 +1671,7 @@ [(welp m mos) +>.^$] :: ++ g-query ::< query on state - ::> + ::> find the result (if any) for a given query. :: |= weg/(list coin) ::TODO should return (unit prize)? ie for /circle/non-existing @@ -1699,7 +1718,8 @@ == :: ++ tmp-their-change ::< diff-story to theirs - ::> + ::> modify a %story delta to make it about their ship + ::> instead of ours. :: |= {who/ship dif/diff-story} ^- diff-story @@ -1733,7 +1753,8 @@ == :: ++ i-change ::< delta to rumor - ::> + ::> if the given delta changes the result of the given + ::> query, produce the relevant rumor. :: |= {weg/(list coin) dif/delta} ^- (unit rumor) @@ -1786,7 +1807,8 @@ == :: ++ affection ::< rumors to interested - ::> + ::> for a given delta, send rumors to all queries it + ::> affects. :: ::TODO probably want to do "affected by" checks for every bone, :: and just construct the rumor once. @@ -1802,14 +1824,15 @@ ?~ rum ~ `[b %diff %talk-rumor u.rum] :: -++ path-to-query ::< ... - ::> +++ path-to-query ::< path, coins, query + ::> parse a path into a (list coin), then parse that + ::> into a query structure. :: |= pax/path (coins-to-query (path-to-coins pax)) :: -++ path-to-coins ::< ... - ::> +++ path-to-coins ::< path to coin list + ::> parse a path into a list of coins. :: |= pax/path ^- (list coin) @@ -1817,8 +1840,8 @@ |= a/@ta (need (slay a)) :: -++ coins-to-query ::< ... - ::> +++ coins-to-query ::< coin list to query + ::> parse a list of coins into a query structure. :: ^- $-((list coin) query) => depa @@ -1834,8 +1857,8 @@ ++ plac (or %da %ud) -- :: -++ tmp-parse-diff-path ::< ... - ::> +++ tmp-parse-diff-path ::< find target story + ::> "parses" a path to determine the target story :: |= pax/path ^- (pair knot circle) @@ -1846,7 +1869,8 @@ i.t.t.t.pax :: ++ leak ::< visible to - ::> + ::> determine if the given query is visible to the + ::> ship. :: |= {who/ship weg/(list coin)} ^- ? @@ -1901,7 +1925,7 @@ ::+| :: ++ diff-talk-prize ::< accept prize - ::> + ::> accept a query result. :: |= {wir/wire piz/prize} ^- (quip move +>) @@ -1913,7 +1937,7 @@ [(welp mos mow) +>.$] :: ++ diff-talk-rumor ::< accept rumor - ::> + ::> accept a query result change. :: |= {wir/wire dif/rumor} ^- (quip move +>) @@ -1948,7 +1972,7 @@ ta-done:(ta-cancel:ta src.bol pax) :: ++ reap ::< catch-all reap - ::> + ::> handle all remote errors. :: |= {wir/wire fal/(unit tang)} ^- (quip move +>) diff --git a/sur/talk.hoon b/sur/talk.hoon index 9140b95c37..a9a5dadf76 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -154,8 +154,6 @@ cap/cord ::< description fit/filter ::< message rules con/control ::< restrictions - :: so: only change src on success of peer/pull (√) - :: and: when gaining a fed, do a %peer (√) == :: ++ filter ::> content filters $: cas/? ::< dis/allow capitals @@ -173,13 +171,13 @@ ++ group (map ship status) ::< presence map ++ status {pec/presence man/human} ::< participant ++ presence ::> status type - $? $gone ::< left + $? $gone ::< absent $idle ::< idle $hear ::< present $talk ::< typing == :: ++ human ::> human identifier - $: tru/(unit (trel cord (unit cord) cord)) :: narrative action +++ thought {uid/serial aud/audience sam/statement} ::< which whom this +++ statement {wen/@da boq/bouquet sep/speech} ::< when what body +++ speech ::> content body $% {$non $~} ::< no content (yo) {$lin pat/? msg/cord} ::< no/@ text line {$ire tos/serial sep/speech} ::< in-reply-to From 121e50333225d859528cb03c1f48330845a9a38c Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 21 Jun 2017 17:15:13 -0700 Subject: [PATCH 117/303] Changed inbox to have a fully permissive filter by default, for display purposes. --- app/talk-guardian.hoon | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index badad2a3e9..812c9233fe 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -213,22 +213,28 @@ ::> populate state on first boot. ::> creates our default mailbox and journal. :: - =< %- ta-deltas :: side-effects - =+ sen=(above our.bol) - ?: ?| !=(%czar (clan sen)) - =(sen our.bol) - =(%pawn (clan our.bol)) + :: create default circles. + => %+ roll + ^- (list {security knot cord}) + :~ [%brown (main our.bol) 'default home'] + [%green ~.public 'visible activity'] == - ~ - [%init ~]~ - %+ roll - ^- (list {security knot cord}) - :~ [%brown (main our.bol) 'default home'] - [%green ~.public 'visible activity'] - == - |= {{typ/security nom/knot des/cord} _ta} - %+ ta-action ost.bol - [%create nom des typ] + |= {{typ/security nom/knot des/cord} _ta} + %+ ta-action ost.bol + [%create nom des typ] + %- ta-deltas + :: change inbox filter to allow everything. + :- :+ %story (main our.bol) + :+ %config [our.bol (main our.bol)] + [%filter [& &]] + :: if needed, subscribe to our parent's /burden. + =+ sen=(above our.bol) + ?: ?| !=(%czar (clan sen)) + =(sen our.bol) + =(%pawn (clan our.bol)) + == + ~ + [%init ~]~ :: ++ ta-apply ::< apply command ::> applies the command sent by {src}. From 0642ee5f16eaf813b581658ae62f7ad289e76456 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 21 Jun 2017 17:16:22 -0700 Subject: [PATCH 118/303] Cleanup of inline docs and comments. --- app/talk-guardian.hoon | 129 ++++++++++++++++------------------------- lib/talk.hoon | 26 +++------ sur/talk.hoon | 2 +- 3 files changed, 59 insertions(+), 98 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 812c9233fe..938e494a74 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -62,7 +62,6 @@ sequence/(map partner @ud) ::< partners heard known/(map serial @ud) ::< messages heard burden/? ::< from parent? - ::TODO send changes to herited story changes up. == :: ++ river (pair point point) ::< stream definition ++ point ::> stream endpoint @@ -160,7 +159,7 @@ %_(+> deltas [dif deltas]) :: ++ ta-deltas ::< emit delta list - ::> adds multiple deltas to the haad of {deltas}. + ::> adds multiple deltas to the head of {deltas}. ::> flops to stay consistent with ++ta-delta. :: |= dis/(list delta) @@ -245,14 +244,15 @@ ::> %publish commands prompt us (as a circle host) ::> to verify and distribute messages. $publish (ta-think | src +.cod) - ::TODO document + ::> %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) == :: ++ ta-action ::< apply reader action ::> performs action sent by a reader. :: - ::delta-generation |= {red/bone act/action} ^+ +> =< work @@ -442,7 +442,6 @@ ^+ +> ?. =(our.bol (above who)) ~&([%not-our-bearer who] +>) - ~& [%gonna-observe who] (ta-delta %observe who) :: ++ ta-subscribe ::< listen to @@ -530,6 +529,7 @@ (so-hear:sor & [our.bol nom.dif] dif.dif) :: $new + ::TODO shouldn't this act the same as $burden in ++ta-take? =< so-done %- ~(so-hear so nom.dif ~ (fall (~(get by stories) nom.dif) *story)) [& [our.bol nom.dif] %bear ~ [cof.dif.dif ~] [~ ~]] @@ -640,9 +640,6 @@ ::> actions. :: ^+ +> - ::?: =(`+<+> (~(get by stories) nom)) - :: ::TODO tmp - :: ~&(%illegal-change-story !!) =. acs (flop acs) |- ^+ +>+ ?~ acs +>+ @@ -692,32 +689,6 @@ ^+ +> (so-delta %story nom dif) :: - ++ so-config-full ::< split full config - ::> split a %full config delta up into multiple - ::> smaller ones, for easier application. - :: - |= {old/(unit config) cof/config} - ^+ +> - ~& %so-config-full - %- so-deltas - %+ turn - %+ weld - ^- (list diff-story) - ?~ old ~ - ::TODO? what to do about src? - :~ ::[%follow | src.u.old] - [%config so-cir %permit | ses.con.u.old] - == - ^- (list diff-story) - :~ ::[%follow & src.cof] ::TODO double-check da-$follow checks existing src - [%config so-cir %caption cap.cof] - [%config so-cir %filter fit.cof] - [%config so-cir %secure sec.con.cof] - [%config so-cir %permit & ses.con.cof] - == - |= d/diff-story - [%story nom d] - :: ::> || ::> || %data ::> || @@ -749,6 +720,7 @@ ++ so-hear ::< accept circle rumor ::> apply changes from a rumor to this story. :: + ::TODO cleanup |= {bur/? src/circle dif/diff-story} ^+ +> ::TODO? these checks are still important, because @@ -763,9 +735,7 @@ :: in the first place. update ++-change or whatever! :: (we don't care for remote remotes, etc.) $new ?: =(src so-cir) - ~& %new-by-us (so-config-full ~ cof.dif) - ~& %new-by-other $(dif [%config src %full cof.dif]) $bear ~&(%so-bear (so-bear bur.dif)) $burden ~&(%burden-not-rumor +>) @@ -839,6 +809,31 @@ ::> arms that make miscelaneous changes to this story. ::+| :: + ++ so-config-full ::< split full config + ::> split a %full config delta up into multiple + ::> smaller ones, for easier application. + :: + |= {old/(unit config) cof/config} + ^+ +> + %- so-deltas + %+ turn + %+ weld + ^- (list diff-story) + ?~ old ~ + ::TODO? what to do about src? + :~ ::[%follow | src.u.old] + [%config so-cir %permit | ses.con.u.old] + == + ^- (list diff-story) + :~ ::[%follow & src.cof] + [%config so-cir %caption cap.cof] + [%config so-cir %filter fit.cof] + [%config so-cir %secure sec.con.cof] + [%config so-cir %permit & ses.con.cof] + == + |= d/diff-story + [%story nom d] + :: ++ so-sources ::< change source ::> adds or removes {pas} from our sources. :: @@ -1072,10 +1067,10 @@ |= her/ship ^- ? ?- sec.con.shape - $black !(~(has in ses.con.shape) her) ::< channel, blacklist - $white (~(has in ses.con.shape) her) ::< village, whitelist - $green (~(has in ses.con.shape) her) ::< journal, whitelist - $brown !(~(has in ses.con.shape) her) ::< mailbox, blacklist + $black !(~(has in ses.con.shape) her) ::< channel, blacklist + $white (~(has in ses.con.shape) her) ::< village, whitelist + $green (~(has in ses.con.shape) her) ::< journal, whitelist + $brown !(~(has in ses.con.shape) her) ::< mailbox, blacklist == :: ++ so-visible ::< display to @@ -1203,6 +1198,7 @@ |= {cir/circle out/(list thought)} ^+ +> ?~ out +> + ::TODO just send the list at once? =. +> %+ da-emit ost.bol :* %poke @@ -1250,9 +1246,7 @@ :: |= {who/ship nic/cord} ^+ +> - ?: =('' nic) - $(nicks (~(del by nicks) who)) - $(nicks (~(put by nicks) who nic)) + +>(nicks (change-nicks nicks who nic)) :: ::> || ::> || %stories @@ -1344,8 +1338,9 @@ (flop (turn cub |=(a/card [ost a]))) :: ::> || - ::> || %data ::TODO consistent naming! + ::> || %data ::> || + ::> utility functions for data retrieval. ::+| :: ++ sa-cir [our.bol nom] @@ -1387,6 +1382,7 @@ ++ sa-change-local ::< apply our delta ::> apply a %story delta to local data. :: + ::TODO split? |= dif/diff-story ^+ +> ?+ -.dif @@ -1417,18 +1413,7 @@ == :: $follow - :: we have to do the effects first, because it - :: checks for new sub targets using src.shape. - ~& [%sa-change-follow nom sub.dif pas.dif] - =. +> - (sa-emil (sa-follow-effects sub.dif pas.dif)) - %_ +> ::TODO delete, only done once success - src.shape ::TODO =? - %. pas.dif - ?: sub.dif - ~(uni in src.shape) - ~(dif in src.shape) - == + (sa-emil (sa-follow-effects sub.dif pas.dif)) == :: ++ sa-change-gram ::< save/update message @@ -1446,6 +1431,7 @@ known (~(put by known) uid.tot.gam count) == :: changed message + ::TODO shouldn't overwrite audience maybe? at least keep delivery? =+ dex=(sub count u.old) %_ +>.$ grams %+ welp @@ -1456,6 +1442,7 @@ ++ sa-change-remote ::< apply remote's delta ::> apply a story diff to remote data. :: + ::TODO split? |= dif/diff-story ^+ +> ?+ -.dif @@ -1488,7 +1475,7 @@ ^- (list move) ?+ -.dif ~ $permit (sa-permit-effects sec.con.old ses.con.old +.dif) - ::TODO $secure ? + ::TODO $secure ? not here, logic should go up-stream. == :: ++ sa-follow-effects ::< un/subscribe @@ -1510,12 +1497,12 @@ :: |= {sec/security old/(set ship) add/? sis/(set ship)} ^- (list move) - =/ sus/(set ship) - %. ses.con.shape - ?:(add ~(dif in sis) ~(int in sis)) =/ wyt ?=(?($white $green) sec) =/ inv =(wyt add) ?: inv ~ + =/ sus/(set ship) + %. ses.con.shape + ?:(add ~(dif in sis) ~(int in sis)) (sa-eject sus) :: ::> || @@ -1680,7 +1667,7 @@ ::> find the result (if any) for a given query. :: |= weg/(list coin) - ::TODO should return (unit prize)? ie for /circle/non-existing + ::TODO (unit (unit prize)) ^- prize =+ qer=(coins-to-query weg) ?- -.qer @@ -1741,23 +1728,6 @@ dif(pan [%& who nom.p.pan.dif]) == :: -++ tmp-clean-change ::< remove remotes - ::> - :: - |= {nom/knot dif/diff-story} - ^- (unit diff-story) - ?+ -.dif - `dif - :: - $config - ?. =(cir.dif [our.bol nom]) ~ - `dif - :: - $status - ?. =(pan.dif [%& our.bol nom]) ~ - `dif - == -:: ++ i-change ::< delta to rumor ::> if the given delta changes the result of the given ::> query, produce the relevant rumor. @@ -1866,10 +1836,11 @@ ++ tmp-parse-diff-path ::< find target story ::> "parses" a path to determine the target story :: + ::TODO merge with etch? |= pax/path ^- (pair knot circle) ?. ?=({$circle @ta @ta @ta *} pax) - ~&(%invalid-peer-path !!) + ~&(%invalid-diff-path !!) :- i.t.pax :- (slav %p i.t.t.pax) i.t.t.t.pax diff --git a/lib/talk.hoon b/lib/talk.hoon index a17343072a..3be5c93730 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -69,8 +69,9 @@ :: unbind single. (~(del ju gys) gyf pas) :: -++ change-nicks ::< ... - ::> +++ change-nicks ::< change nick map + ::> changes a nickname in a map, adding if it doesn't + ::> yet exist, removing if the nickname is empty. :: |= {nis/(map ship cord) who/ship nic/cord} ^+ nis @@ -78,18 +79,8 @@ (~(del by nis) who) (~(put by nis) who nic) :: -++ change-friends ::< ... - ::> - :: - |= {cis/(set circle) add/? cir/circle} - ^+ cis - %. cir - ?: add - ~(put in cis) - ~(del in cis) -:: -++ change-config ::< ... - ::> +++ change-config ::< apply config diff + ::> applies a config diff to the given config. :: |= {cof/config dif/diff-config} ^+ cof @@ -102,8 +93,7 @@ $source %= cof src - %. `(set partner)`pas.dif ::TODO? why do we *need* to cast? - ~& [%doing-source add.dif pas.dif] + %. pas.dif ?: add.dif ~(uni in src.cof) ~(dif in src.cof) @@ -131,8 +121,8 @@ == == :: -++ change-status ::< ... - ::> +++ change-status ::< apply status diff + ::> applies a status diff to the given status. :: |= {sat/status dif/diff-status} ^+ sat diff --git a/sur/talk.hoon b/sur/talk.hoon index a9a5dadf76..2e96286cb0 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -104,7 +104,7 @@ ++ action ::> user action $% :: circle configuration :: {$create nom/knot des/cord sec/security} ::< create circle - {$delete nom/knot ano/(unit cord)} ::< delete + announce + {$delete nom/knot why/(unit cord)} ::< delete + announce {$depict nom/knot des/cord} ::< change description {$filter nom/knot fit/filter} ::< change message rules {$permit nom/knot inv/? sis/(set ship)} ::< invite/banish From a7db6dd2eab487ada680e784e9df268c8e448f33 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 22 Jun 2017 12:33:12 -0700 Subject: [PATCH 119/303] Improved querying code, renamed to ++peek. --- app/talk-guardian.hoon | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 938e494a74..93b038ed1f 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -1663,18 +1663,18 @@ =^ mos +>.^$ (f-bake d) [(welp m mos) +>.^$] :: -++ g-query ::< query on state +++ peek ::< query on state ::> find the result (if any) for a given query. :: |= weg/(list coin) - ::TODO (unit (unit prize)) - ^- prize + ^- (unit (unit prize)) =+ qer=(coins-to-query weg) ?- -.qer $reader - [%reader nak nicks] + ``[%reader nak nicks] :: $friend + :+ ~ ~ :- %friend %- ~(gas in *(set circle)) %+ murn @@ -1686,6 +1686,7 @@ [~ p.p] :: $burden + :+ ~ ~ :- %burden %- ~(gas in *(map knot burden)) %+ murn (~(tap by stories)) @@ -1699,15 +1700,16 @@ [locals.s remotes.s] :: $report - ::TODO want to return no prize - [%friend ~] + ~ ::TODO? we just don't have a prize. or do we need [%report ~] ? :: $circle + =+ soy=(~(get by stories) nom.qer) + ?~ soy ~ + :+ ~ ~ :- %circle - =+ soy=(~(got by stories) nom.qer) - :+ grams.soy ::TODO get using specified range. - [shape.soy mirrors.soy] - [locals.soy remotes.soy] + :+ grams.u.soy ::TODO get using specified range. + [shape.u.soy mirrors.u.soy] + [locals.u.soy remotes.u.soy] == :: ++ tmp-their-change ::< diff-story to theirs @@ -1937,8 +1939,11 @@ %- pre-bake ta-done:(ta-subscribe:ta src.bol pax) :_ +>.$ + =+ piz=(peek qer) + ?~ piz ~&([%query-unavailable pax] mos) + ?~ u.piz ~&([%query-invalid pax] mos) :_ mos - [ost.bol %diff %talk-prize (g-query qer)] + [ost.bol %diff %talk-prize u.u.piz] :: ++ pull ::< unsubscribe ::> unsubscribes. From fe2246066e3e30d1e460fc64a44d9a78ec1d4691 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 22 Jun 2017 13:48:10 -0700 Subject: [PATCH 120/303] Removed unused %more delta. --- app/talk-guardian.hoon | 5 ----- sur/talk.hoon | 4 +--- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 93b038ed1f..44bdd34418 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -1149,11 +1149,6 @@ |= dif/delta ^+ +> ?- -.dif - $more - |- ^+ +>.^$ - ?~ mor.dif +>.^$ - $(+>.^$ ^$(dif i.mor.dif), mor.dif t.mor.dif) - :: $out (da-change-out +.dif) $done (da-change-done +.dif) $glyph (da-change-glyph +.dif) diff --git a/sur/talk.hoon b/sur/talk.hoon index 2e96286cb0..3354262275 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -45,9 +45,7 @@ == :: ::TODO deltas into app ++ delta :: - $% ::TODO no more %more, just produce/take list instead! - {$more mor/(list delta)} ::< multiple changes - :: messaging state :: + $% :: messaging state :: {$out cir/circle out/(list thought)} ::< msgs into outbox {$done num/@ud} ::< msgs delivered :: shared ui state :: From 1acc72ee3161fc9b6bb8c14719b27f1003d04611 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 22 Jun 2017 14:13:29 -0700 Subject: [PATCH 121/303] Renamed new Gall arms to proper names. --- app/talk-guardian.hoon | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 44bdd34418..48315b234e 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -1637,7 +1637,7 @@ ::> || ::+| ::TODO make use of ++prey for filtering subs? -++ f-bake ::< apply state delta +++ bake ::< apply state delta ::> applies a change to the application state, ::> producing side-effects. :: @@ -1646,7 +1646,8 @@ =^ mos +>.$ da-done:(da-change:da dif) :_ +>.$ - :(welp mos (affection dif)) + ::TODO move affection to pre-bake, but then station creation doesn't happen? + (welp mos (affection dif)) :: ++ pre-bake ::< apply more deltas ::> bake a list of deltas. @@ -1654,8 +1655,8 @@ |= dis/(list delta) ^- (quip move +>) %+ roll dis - |= {d/delta m/(list move) _+>.$} ::TODO ^$ nest-fails, is this correct? - =^ mos +>.^$ (f-bake d) + |= {d/delta m/(list move) _+>.$} ::TODO? ^$ find-fails, how is this correct? + =^ mos +>.^$ (bake d) [(welp m mos) +>.^$] :: ++ peek ::< query on state @@ -1707,7 +1708,7 @@ [locals.u.soy remotes.u.soy] == :: -++ tmp-their-change ::< diff-story to theirs +++ dedicate ::< diff-story to theirs ::> modify a %story delta to make it about their ship ::> instead of ours. :: @@ -1725,7 +1726,7 @@ dif(pan [%& who nom.p.pan.dif]) == :: -++ i-change ::< delta to rumor +++ feel ::< delta to rumor ::> if the given delta changes the result of the given ::> query, produce the relevant rumor. :: @@ -1757,7 +1758,7 @@ ?. ?=($story -.dif) ~ :: only burden channels for now. ?. =(%black sec.con.shape:(~(got by stories) nom.dif)) ~ - `[%burden nom.dif (tmp-their-change who.qer dif.dif)] + `[%burden nom.dif (dedicate who.qer dif.dif)] :: $report :: only send changes we didn't get from above. @@ -1770,7 +1771,7 @@ ?. burden.soy ~ :: only burden channels for now. ?. =(%black sec.con.shape.soy) ~ - `[%burden nom.dif (tmp-their-change (above our.bol) dif.dif)] + `[%burden nom.dif (dedicate (above our.bol) dif.dif)] :: $circle ?. ?=($story -.dif) ~ @@ -1783,17 +1784,19 @@ ::> for a given delta, send rumors to all queries it ::> affects. :: - ::TODO probably want to do "affected by" checks for every bone, - :: and just construct the rumor once. + ::TODO? probably want to do "affected by" checks for + :: every bone, and just construct the rumor once. + :: ^ gall need to do this for you. |= dif/delta ^- (list move) %+ murn (~(tap by sup.bol)) |= {b/bone s/ship p/path} ^- (unit move) - =+ rum=(i-change (path-to-coins p) dif) - ::TODO %quit bones that are done with their subscription. + =+ rum=(feel (path-to-coins p) dif) + ::TODO? %quit bones that are done with their subscription. :: ...but that would also require a ta-cancel call to remove :: them from the presence list! how do? + :: should there be an ++away arm for gall to call? ?~ rum ~ `[b %diff %talk-rumor u.rum] :: From 785b2b7715b4e6f9697ca84f530c18575ebf4f21 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 22 Jun 2017 15:34:03 -0700 Subject: [PATCH 122/303] Now using ++etch for wire parsing again. --- app/talk-guardian.hoon | 73 ++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 41 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 48315b234e..8526c46b92 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -88,8 +88,8 @@ {$quit $~} :: == :: ++ weir ::> parsed wire - $% {$repeat num/@ud hos/ship nom/knot} ::< messaging wire - {$friend nom/knot cir/circle} ::< subscription wire + $% {$repeat num/@ud cir/circle} ::< messaging wire + {$circle nom/knot cir/circle} ::< subscription wire == :: -- :: @@ -507,9 +507,10 @@ (~(so-bear so n ~ (fall (~(get by stories) n) *story)) b) :: $circle - =+ res=(tmp-parse-diff-path wir) - %- (ta-know p.res) |= sor/_so =< so-done - (so-take:sor q.res +.piz) + =+ wer=(etch wir) + ?> ?=($circle -.wer) + %- (ta-know nom.wer) |= sor/_so =< so-done + (so-take:sor cir.wer +.piz) == :: ++ ta-hear ::< apply rumor @@ -536,9 +537,10 @@ == :: $circle - =+ res=(tmp-parse-diff-path wir) - %- (ta-know p.res) |= sor/_so =< so-done - (so-hear:sor | q.res dif.dif) + =+ wer=(etch wir) + ?> ?=($circle -.wer) + %- (ta-know nom.wer) |= sor/_so =< so-done + (so-hear:sor | cir.wer dif.dif) == :: ++ ta-repeat ::< message delivered @@ -1588,19 +1590,19 @@ ::+| :: ++ etch ::< parse wire - ::> parses {wir}} to obtain either %friend with story - ::> and circle or %repeat with message number, - ::> source ship and story. + ::> parses {wir}} to obtain either %circle with story + ::> and circle or %repeat with message number, source + ::> ship and story. :: |= wir/wire ^- weir ?+ -.wir !! - $friend - ?> ?=({$show @ @ @ $~} t.wir) - :^ %friend - i.t.t.wir - (slav %p i.t.t.t.wir) - i.t.t.t.t.wir + $circle + ?> ?=({@ @ @ *} t.wir) + :^ %circle + i.t.wir + (slav %p i.t.t.wir) + i.t.t.t.wir :: $repeat ?> ?=({@ @ @ $~} t.wir) @@ -1610,8 +1612,9 @@ i.t.t.t.wir == :: -++ etch-friend ::< parse /friend wire - ::> parses a /friend wire, call a gate with the result. +++ etch-circle ::< parse /circle wire + ::> parses a /circle wire, call a gate with the + ::> result. :: |= $: wir/wire $= fun @@ -1619,18 +1622,18 @@ {(list move) _.} == =+ wer=(etch wir) - ?>(?=($friend -.wer) (fun nom.wer cir.wer)) + ?>(?=($circle -.wer) (fun nom.wer cir.wer)) :: ++ etch-repeat ::< parse /repeat wire ::> parses a /repeat wire, call gate with the result. :: |= $: wir/wire $= fun - $- {num/@ud src/ship nom/knot} + $- {num/@ud cir/circle} {(list move) _.} == =+ wer=(etch wir) - ?>(?=($repeat -.wer) (fun num.wer hos.wer nom.wer)) + ?>(?=($repeat -.wer) (fun num.wer cir.wer)) :: ::> || ::> || %new-events @@ -1833,18 +1836,6 @@ ++ plac (or %da %ud) -- :: -++ tmp-parse-diff-path ::< find target story - ::> "parses" a path to determine the target story - :: - ::TODO merge with etch? - |= pax/path - ^- (pair knot circle) - ?. ?=({$circle @ta @ta @ta *} pax) - ~&(%invalid-diff-path !!) - :- i.t.pax - :- (slav %p i.t.t.pax) - i.t.t.t.pax -:: ++ leak ::< visible to ::> determine if the given query is visible to the ::> ship. @@ -1960,14 +1951,14 @@ ~| reap-fail+wir (mean u.fal) :: -++ reap-friend ::< subscription n/ack +++ reap-circle ::< subscription n/ack ::> if subscribing failed, update state to reflect ::> that. :: ::TODO update to handle all subscription kinds. |= {wir/wire fal/(unit tang)} ^- (quip move +>) - %+ etch-friend [%friend wir] + %+ etch-circle [%circle wir] |= {nom/knot cir/circle} ?~ fal %- pre-bake @@ -1977,20 +1968,20 @@ %- pre-bake ta-done:(ta-leave:ta nom cir) :: -++ quit-friend ::< dropped subscription +++ quit-circle ::< dropped subscription ::> gall dropped our subscription. resubscribe. :: ::TODO update for all subscription kinds. |= wir/wire ^- (quip move +>) - %+ etch-friend [%friend wir] + %+ etch-circle [%circle wir] |= {nom/knot cir/circle} ::TODO do better :_ +>.^$ :_ ~ :* 0 %peer /circle/[nom]/(scot %p hos.cir)/[nom.cir] - [hos.cir %talk-guardian] + [hos.cir %hall] /circle/[nom.cir]/(sub now.bol ~h1) == :: @@ -2001,9 +1992,9 @@ |= {wir/wire fal/(unit tang)} ^- (quip move +>) %+ etch-repeat [%repeat wir] - |= {num/@ud src/ship nom/knot} + |= {num/@ud cir/circle} %- pre-bake - ta-done:(ta-repeat:ta num [%& src nom] fal) + ta-done:(ta-repeat:ta num [%& cir] fal) :: ::> || ::> || %logging From 8c82fa00e678d0753f8e925a203d6f3c83b7f17d Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 22 Jun 2017 18:03:37 -0700 Subject: [PATCH 123/303] Passing query instead of path or coins. --- app/talk-guardian.hoon | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 8526c46b92..397d4049f3 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -447,20 +447,16 @@ ++ ta-subscribe ::< listen to ::> add her to a presence list if applicable. :: - ::TODO change interface to not include path, - :: only call for /circle queries. - |= {her/ship pax/path} + |= {her/ship qer/query} ^+ +> - ?. ?=({@ta *} pax) +> - ?+ -.pax + ?+ -.qer +> :: $burden (ta-observe her) :: $circle - ?. ?=({@ta *} t.pax) +> - %- (ta-know i.t.pax) |= sor/_so =< so-done + %- (ta-know nom.qer) |= sor/_so =< so-done (so-attend:sor her %hear [~ ~]) == :: @@ -468,12 +464,10 @@ ::> drops {src}'s subscription. deduce the right way ::> to do this from the subscription path {pax}. :: - |= {src/ship pax/path} + |= {src/ship nom/knot} ^+ +> - ::TODO catch earlier, just pass nom? - ?. ?=({$circle @ta *} pax) +> :: set ship status to %gone. - %- (ta-know i.t.pax) |= sor/_so =< so-done + %- (ta-know nom) |= sor/_so =< so-done (so-absent:sor src) :: ++ ta-greet ::< subscription success @@ -1665,9 +1659,8 @@ ++ peek ::< query on state ::> find the result (if any) for a given query. :: - |= weg/(list coin) + |= qer/query ^- (unit (unit prize)) - =+ qer=(coins-to-query weg) ?- -.qer $reader ``[%reader nak nicks] @@ -1733,9 +1726,8 @@ ::> if the given delta changes the result of the given ::> query, produce the relevant rumor. :: - |= {weg/(list coin) dif/delta} + |= {qer/query dif/delta} ^- (unit rumor) - =+ qer=(coins-to-query weg) ?- -.qer $reader :: changes to shared ui state apply. @@ -1795,7 +1787,7 @@ %+ murn (~(tap by sup.bol)) |= {b/bone s/ship p/path} ^- (unit move) - =+ rum=(feel (path-to-coins p) dif) + =+ rum=(feel (path-to-query p) dif) ::TODO? %quit bones that are done with their subscription. :: ...but that would also require a ta-cancel call to remove :: them from the presence list! how do? @@ -1840,9 +1832,8 @@ ::> determine if the given query is visible to the ::> ship. :: - |= {who/ship weg/(list coin)} + |= {who/ship qer/query} ^- ? - =+ qer=(coins-to-query weg) ?- -.qer $reader (team our.bol who) $friend & @@ -1922,11 +1913,11 @@ |= pax/path ^- (quip move +>) ?: ?=({$sole *} pax) ~&(%talk-broker-no-sole !!) - =+ qer=(path-to-coins pax) + =+ qer=(path-to-query pax) ?. (leak src.bol qer) ~&(%peer-invisible !!) =^ mos +>.$ %- pre-bake - ta-done:(ta-subscribe:ta src.bol pax) + ta-done:(ta-subscribe:ta src.bol qer) :_ +>.$ =+ piz=(peek qer) ?~ piz ~&([%query-unavailable pax] mos) @@ -1939,8 +1930,10 @@ :: |= pax/path ^- (quip move +>) + =+ qer=(path-to-query pax) + ?. ?=($circle -.qer) [~ +>.$] %- pre-bake - ta-done:(ta-cancel:ta src.bol pax) + ta-done:(ta-cancel:ta src.bol nom.qer) :: ++ reap ::< catch-all reap ::> handle all remote errors. From f04b142bee26e74c1e3db03699541f16345019bd Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 22 Jun 2017 18:04:22 -0700 Subject: [PATCH 124/303] Reactions now always send to ost.bol. --- app/talk-guardian.hoon | 9 +++------ sur/talk.hoon | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 397d4049f3..5ffff37aa2 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -292,7 +292,7 @@ ::> send reaction to this action. :: |= {res/?($info $fail) wat/cord} - (ta-delta %react red [res wat `act]) + (ta-delta %react [res wat `act]) :: ++ affect ::< delta to story ::> store a delta about a story. if the story @@ -1125,12 +1125,9 @@ ++ da-react ::< send reaction ::> sends a talk-reaction diff to a reader. :: - ::TODO argument always ost.bol? seems to be that way - |= {red/bone rac/reaction} + |= rac/reaction %- da-emit - ~? !=(red ost.bol) %react-different-bones - ::TODO is diff the way to react to a poke? - [red %diff %talk-reaction rac] + [ost.bol %diff %talk-reaction rac] :: ::> || ::> || %change-application diff --git a/sur/talk.hoon b/sur/talk.hoon index 3354262275..894b356728 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -56,7 +56,7 @@ :: side-effects :: {$init $~} ::< initialize {$observe who/ship} ::< watch burden bearer - {$react ost/bone rac/reaction} ::TODO ost.bol? ::< reaction to action + {$react rac/reaction} ::< reaction to action {$quit ost/bone} ::< force unsubscribe == :: ++ diff-glyph {bin/? gyf/char pas/(set partner)} ::< un/bound glyph From 4aed59fd144bf87fab9c39346788e1daa8f34231 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 22 Jun 2017 18:08:14 -0700 Subject: [PATCH 125/303] Removal of old TODOs and code, rewording of TODOs. --- app/talk-guardian.hoon | 45 ++++++++++-------------------------------- 1 file changed, 10 insertions(+), 35 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 5ffff37aa2..d8e7b2a406 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -111,15 +111,6 @@ [~ ..prep(+<+ u.old)] :: ::> || -::> || %utility -::> || -::> small utility functions. -::+| -:: -::TODO remove, only used once. -++ strap |*({k/* v/*} (~(put by *(map _k _v)) k v)) ::< map key-value pair -:: -::> || ::> || %engines ::> || ::> main cores. @@ -524,7 +515,7 @@ (so-hear:sor & [our.bol nom.dif] dif.dif) :: $new - ::TODO shouldn't this act the same as $burden in ++ta-take? + ::TODO? shouldn't this act the same as $burden in ++ta-take? =< so-done %- ~(so-hear so nom.dif ~ (fall (~(get by stories) nom.dif) *story)) [& [our.bol nom.dif] %bear ~ [cof.dif.dif ~] [~ ~]] @@ -544,7 +535,7 @@ |= {num/@ud who/partner fal/(unit tang)} ^+ +> =+ oot=(~(get by q.outbox) num) - ?~ oot ~&([%ta-repeat-none num] +>.$) ::TODO crash? + ?~ oot ~&([%ta-repeat-none num] +>.$) ::TODO? crash? =. aud.u.oot =+ olg=(~(got by aud.u.oot) who) %+ ~(put by aud.u.oot) who @@ -719,7 +710,7 @@ ::TODO cleanup |= {bur/? src/circle dif/diff-story} ^+ +> - ::TODO? these checks are still important, because + ::TODO? are these checks still important? :: when things are slow we may get diffs from :: things we already unsubscribed from, right? ~? ?! ?| (~(has in src.shape) [%& src]) @@ -727,9 +718,6 @@ == [%unexpected-rumor-source nom -.dif src] ?- -.dif - ::TODO we check for foreigns here, but they should just not get sent - :: in the first place. update ++-change or whatever! - :: (we don't care for remote remotes, etc.) $new ?: =(src so-cir) (so-config-full ~ cof.dif) $(dif [%config src %full cof.dif]) @@ -743,15 +731,15 @@ ?: =(src cir.dif) (so-delta-our dif) :: remotes of remotes are not. - ~& %unexpected-ignoring-remote-config + ~& %ignoring-remote-config ~? =(src so-cir) %but-src-is-us +> $status :: ignore foreign remotes. ?. |(=([%& src] pan.dif) =(src so-cir)) - ~& %unexpected-ignoring-remote-status + ~& %ignoring-remote-status +> (so-delta-our dif) - $follow ~&(%follow-not-rumor +>) ::TODO crash? + $follow ~&(%follow-not-rumor +>) ::TODO? crash? $remove (so-delta-our %config src %remove ~) == :: @@ -789,13 +777,9 @@ |= t/telegram =- t(aud.tot -) =/ oud - (~(get by aud.tot.t) [%& (above our.bol) nom]) - ?~ oud ::TODO seems like it should never occur? - ~& %unexpected-parent-not-audience - aud.tot.t - =. aud.tot.t - (~(del by aud.tot.t) [%& (above our.bol) nom]) - (~(put by aud.tot.t) [%& our.bol nom] u.oud) + (~(got by aud.tot.t) [%& (above our.bol) nom]) + =+ (~(del by aud.tot.t) [%& (above our.bol) nom]) + (~(put by -) [%& our.bol nom] oud) :: burden flag (so-delta-our %burden &) :: @@ -1017,17 +1001,8 @@ =. aud.tot.gam ::> if we are in the audience, mark as received. =+ ole=(~(get by aud.tot.gam) so-pan) - ?^ ole (~(put by aud.tot.gam) so-pan -.u.ole %received) - ::TODO can we delete the below? seems old federation? - ::TODO pass src through explicitly instead of - :: relying on src.bol. - ::TODO? ^ why? - =+ ole=(~(get by aud.tot.gam) [%& src.bol nom]) ?~ ole aud.tot.gam - ::TODO below line is old federation, but should work for our current - :: use case, right? why doesn't it? - =. aud.tot.gam (~(del by aud.tot.gam) [%& src.bol nom]) - (~(put by aud.tot.gam) so-pan -.u.ole %received) + (~(put by aud.tot.gam) so-pan p.u.ole %received) (so-delta-our %grams [gam ~]) :: ::> || From e3eeb10f53994ab80907e131b0105701603cebf8 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 23 Jun 2017 16:29:45 -0700 Subject: [PATCH 126/303] Now using ++circle-peer for the creation of /circle peer moves, to ensure consistency. --- app/talk-guardian.hoon | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index d8e7b2a406..0b8333d6da 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -1488,18 +1488,14 @@ ::> or if we haven't gotten any yet, messages ::> from up to a day ago. =+ num=(~(get by sequence) pan) - =+ old=(sub now.bol ~d1) :: XX full backlog - =+ ini=?^(num (scot %ud u.num) (scot %da old)) + =+ old=(sub now.bol ~d1) ::TODO? full backlog + =+ ini=?^(num [%ud u.num] [%da old]) ?- -.pan $| !! ::< passport partner :: $& ::< circle partner :_ ~ - :* %peer - /circle/[nom]/(scot %p hos.p.pan)/[nom.p.pan] - [hos.p.pan %talk-guardian] - /circle/[nom.p.pan]/[ini] - == + (circle-peer nom p.pan `[ini ~]) == :: ++ sa-abjure ::< unsubscribe us @@ -1601,6 +1597,23 @@ =+ wer=(etch wir) ?>(?=($repeat -.wer) (fun num.wer cir.wer)) :: +++ circle-peer ::< /circle peer card + ::> constructs a %peer move to subscribe {nom} to + ::> {cir}. + :: + |= {nom/cord cir/circle wen/range} + ^- card + :* %peer + /circle/[nom]/(scot %p hos.cir)/[nom.cir] + [hos.cir %talk-guardian] + %+ welp /circle/[nom.cir] + ?~ wen ~ + %+ welp + /(scot -.hed.u.wen +.hed.u.wen) + ?~ tal.u.wen ~ + /(scot -.u.tal.u.wen +.u.tal.u.wen) + == +:: ::> || ::> || %new-events ::> || @@ -1941,14 +1954,8 @@ ^- (quip move +>) %+ etch-circle [%circle wir] |= {nom/knot cir/circle} - ::TODO do better :_ +>.^$ :_ ~ - :* 0 - %peer - /circle/[nom]/(scot %p hos.cir)/[nom.cir] - [hos.cir %hall] - /circle/[nom.cir]/(sub now.bol ~h1) - == + [0 (circle-peer nom cir `[[%da (sub now.bol ~m5)] ~])] :: ++ coup-repeat ::< message n/ack ::> ack from ++ta-transmit. mark the message as From ee4883d91bb82e8822c082a8bd16a3c71af120f8 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 26 Jun 2017 16:49:46 -0700 Subject: [PATCH 127/303] tmp function in lib/talk.hoon. --- lib/talk.hoon | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/talk.hoon b/lib/talk.hoon index 3be5c93730..0ac36fa530 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -30,6 +30,14 @@ ?: ?=($czar (clan who)) ~zod (sein who) :: +::TODO remove when on master, use +- key:by instead +++ key-by + |* m/(map) + =| b/(set _?>(?=(^ m) p.n.m)) + |- ^+ b + ?~ m b + $(m r.m, b $(m l.m, b (~(put in b) p.n.m))) +:: ++ said-url :: app url |= url/purl :^ ost.bol %poke /said-url From 679ef2a6d3cfcd9994836f76e341b82e628aa792 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 26 Jun 2017 16:56:03 -0700 Subject: [PATCH 128/303] Ranges specified in subscriptions now actually do something. Does not yet quit ended subscriptions. --- app/talk-agent.hoon | 52 +++++++++--- app/talk-guardian.hoon | 185 +++++++++++++++++++++-------------------- sur/talk.hoon | 7 +- 3 files changed, 140 insertions(+), 104 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 27b45c57c8..1856a9ce95 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -69,7 +69,7 @@ == :: ++ work ::> interface action $% :: circle management :: - {$join p/where} ::< subscribe to + {$join p/(map partner range)} ::< subscribe to {$leave p/where} ::< unsubscribe from {$create p/security q/knot r/cord} ::< create circle {$delete p/knot q/(unit cord)} ::< delete circle @@ -77,7 +77,7 @@ {$filter p/knot q/? r/?} ::< change message rules {$invite p/knot q/(set ship)} ::< give permission {$banish p/knot q/(set ship)} ::< deny permission - {$source p/knot q/(set partner)} ::< add source + {$source p/knot q/(map partner range)} ::< add source :: personal metadata {$status p/knot q/presence} ::TODO better interface ::< set status :: messaging :: @@ -584,6 +584,34 @@ %+ cook ~(gas in *(set partner)) (most ;~(plug com (star ace)) parn) :: + ++ pont ::< point for range + ;~ pose + ::TODO support entering of @da and @dr, + :: convert all to @da. use sear with crub? + :: also allow "now"? + (stag %ud dem:ag) + == + :: + ++ rang ::< subscription range + =+ ;~ pose + (cook some ;~(pfix fas pont)) + (easy ~) + == + ;~ pose + (cook some ;~(plug ;~(pfix fas pont) -)) + (easy ~) + == + :: + ++ sorc ::< partner + range + ;~ pose + ;~(plug (stag %& circ) rang) + ;~(plug (stag %| pasp) (easy ~)) + == + :: + ++ sorz ::< non-empty sources + %+ cook ~(gas by *(map partner range)) + (most ;~(plug com (star ace)) sorc) + :: ++ nump ::< number reference ;~ pose ;~(pfix hep dem:ag) @@ -638,7 +666,7 @@ :: :: circle management :: - ;~((glue ace) (perk %join ~) para) + ;~((glue ace) (perk %join ~) sorz) :: ;~((glue ace) (perk %leave ~) para) :: @@ -664,7 +692,7 @@ :: ;~((glue ace) (perk %banish ~) cire shiz) :: - ;~((glue ace) (perk %source ~) cire parz) + ;~((glue ace) (perk %source ~) cire sorz) :: :: personal metadata :: @@ -918,8 +946,9 @@ ::> change local mailbox config to include ::> subscriptions to {pas}. :: - |= pas/(set partner) + |= pos/(map partner range) ^+ ..sh-work + =+ pas=(key-by pos) =. ..sh-work =+ (~(get by nik) pas) ?^ - (sh-note "has glyph {}") @@ -927,7 +956,7 @@ (sh-note:(set-glyph cha pas) "new glyph {}") =. ..sh-work sh-prod(active.she pas) - (sh-act %source inbox & pas) + (sh-act %source inbox & pos) :: ++ leave ::< %leave ::> change local mailbox config to exclude @@ -935,7 +964,10 @@ :: |= pas/(set partner) ^+ ..sh-work - (sh-act %source inbox | pas) + =/ pos + %- ~(run in pas) + |=(p/partner [p ~]) + (sh-act %source inbox | pos) :: ++ create ::< %create ::> creates circle {nom} with specified config. @@ -944,7 +976,7 @@ ^+ ..sh-work =. ..sh-work (sh-act %create nom txt sec) - (join [[%& our.bol nom] ~ ~]) + (join [[[%& our.bol nom] ~] ~ ~]) :: ++ delete ::< %delete ::> deletes our circle {nom}, after optionally @@ -983,9 +1015,9 @@ ++ source ::< %source ::> adds {pas} to {nom}'s src. :: - |= {nom/knot pas/(set partner)} + |= {nom/knot pos/(map partner range)} ^+ ..sh-work - (sh-act %source nom & pas) + (sh-act %source nom & pos) :: ::> || ::> || %personal-metadata diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 0b8333d6da..d8381b0f93 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -63,11 +63,6 @@ known/(map serial @ud) ::< messages heard burden/? ::< from parent? == :: - ++ river (pair point point) ::< stream definition - ++ point ::> stream endpoint - $% {$ud p/@ud} ::< by number - {$da p/@da} ::< by date - == :: ++ move (pair bone card) ::< all actions ++ lime ::> diff fruit $% {$talk-prize prize} :: @@ -356,8 +351,11 @@ ++ action-source ::< un/sub p to/from r ::> add/remove {pas} as sources for story {nom}. :: - |= {nom/knot sub/? pas/(set partner)} - (affect nom %follow sub pas) + |= {nom/knot sub/? pos/(map partner range)} + =+ soy=(~(get by stories) nom) + ?~ soy + (react %fail (crip "no story {(trip nom)}")) + so-done:(~(so-sources so nom ~ u.soy) sub pos) :: ::> || %messaging ::+| @@ -817,13 +815,18 @@ ++ so-sources ::< change source ::> adds or removes {pas} from our sources. :: - |= {add/? pas/(set partner)} + ::TODO should ++action-source make use of this, + :: because of the {sus} logic? + |= {add/? pos/(map partner range)} ^+ +> - =/ sus/(set partner) - %. src.shape - ?:(add ~(dif in pas) ~(int in pas)) - ?~ sus +>.$ - (so-delta-our %follow & sus) + ::TODO for new sources, follow. + :: for existing sources, unfollow and refollow + :: with new range? + ::=/ sus/(set partner) + :: %. src.shape + :: ?:(add ~(dif in pas) ~(int in pas)) + ::?~ sus +>.$ + (so-delta-our %follow & pos) :: ++ so-depict ::< change description ::> modifies our caption. @@ -885,65 +888,58 @@ ?. (~(has in src.shape) pan) +> (so-delta-our %config so-cir %source | [pan ~ ~]) :: - ++ so-start ::< subscribe follower - ::> called upon subscribe. deduces the range of - ::> {her} subscription from {pax}, then sends - ::> the currently available part of it. - :: - |= {her/ship pax/path} - ^+ +> - :: read permissions - ?. (so-visible her) - =. +> (so-delta %quit ost.bol) - %- so-note %- crip - "so-start permission denied {(scow %p her)}" - :: find grams range - =/ ruv/(unit river) - :: collapse unit list - %+ biff - %- zl:jo - %+ turn pax - ;~(biff slay |=(a/coin `(unit dime)`?~(-.a a ~))) - |= paf/(list dime) - ?~ paf - $(paf [%ud (sub (max 64 count) 64)]~) - ?~ t.paf - $(t.paf [%da (dec (bex 128))]~) - ?. ?=({{?($ud $da) @} {?($ud $da) @} $~} paf) - ~ - `[[?+(- . $ud .)]:i.paf [?+(- . $ud .)]:i.t.paf] ::XX arvo issue #366 - ?~ ruv - =. +>.$ (so-delta %quit ost.bol) - %- so-note %- crip - "so-start malformed path {~(ram re >pax<)}" - (so-first-grams u.ruv) - :: ++ so-first-grams ::< beginning of stream - ::> find all grams that fall within the river and - ::> send them in a grams report to {ost.bol}. + ::> find all grams that fall within the range. :: - |= riv/river - ^+ +> - =; lab/{dun/? end/@u zeg/(list telegram)} - ?. dun.lab +>.$ - (so-delta %quit ost.bol) - =+ [end=count gaz=grams dun=| zeg=*(list telegram)] - |- ^- (trel ? @ud (list telegram)) - ?~ gaz [dun end zeg] - ?: ?- -.q.riv :: after the end - $ud (lte p.q.riv end) - $da (lte p.q.riv wen.sam.tot.i.gaz) + ::TODO strip unused vars. + |= ran/range + ^- (list telegram) + =+ [num=0 gaz=grams zeg=*(list telegram)] + :: fill in empty ranges to select all grams. + =. ran + ?~ ran `[[%ud 0] `[%ud count]] + ?~ tal.u.ran `[hed.u.ran `[%ud count]] + ran + :: never fails, but compiler needs it. + ?> &(?=(^ ran) ?=(^ 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.sam.tot.i.gaz) == - :: if past the river, continue back, mark as done. - $(end (dec end), gaz t.gaz, dun &) - ?: ?- -.p.riv :: before the start - $ud (lth end p.p.riv) - $da (lth wen.sam.tot.i.gaz p.p.riv) + :: if past the river, we're done searching. + zeg + ?: ?- -.hed.u.ran :: before the start + $ud (lth num +.hed.u.ran) + $da (lth wen.sam.tot.i.gaz +.hed.u.ran) == - :: if before the river, we're done searching. - [dun end zeg] + :: if before the river, continue onward. + $(num +(num), gaz t.gaz) :: if in the river, add this gram and continue. - $(end (dec end), gaz t.gaz, zeg [i.gaz zeg]) + $(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. + :: + |= ran/range + ^- {in/? done/?} + ?~ ran [& |] + =/ min + ?- -.hed.u.ran + $ud (gth count +.hed.u.ran) + $da (gth now.bol +.hed.u.ran) + == + ?~ tal.u.ran + [min |] + =- [&(min -) !-] + ?- -.u.tal.u.ran + $ud (gte +(+.u.tal.u.ran) count) + $da (gte +.u.tal.u.ran now.bol) + == :: ::> || ::> || %messaging @@ -1445,13 +1441,11 @@ ::> apply side-effects for a %follow delta, ::> un/subscribing this story to/from {pas}. :: - |= {sub/? pas/(set partner)} + |= {sub/? pos/(map partner range)} ^- (list move) - =/ sus/(set partner) - %. src.shape - ?:(sub ~(dif in pas) ~(int in pas)) - %. (~(tap in sus)) - ?:(sub sa-acquire sa-abjure) + ?: sub + (sa-acquire (~(tap by pos))) + (sa-abjure (~(tap in (key-by pos)))) :: ++ sa-permit-effects ::< notify permitted ::> apply side-effects for a %permit delta, @@ -1477,25 +1471,26 @@ ++ sa-acquire ::< subscribe us ::> subscribes this story to each partner. :: - |= pas/(list partner) + |= pas/(list (pair partner range)) %+ sa-sauce 0 :: subscription is caused by this app %- zing %+ turn pas - |= pan/partner + |= {pan/partner ran/range} ^- (list card) ?: =(pan [%& our.bol nom]) ~ :: ignore self-subs - ::> subscribe starting at the last message we got, - ::> or if we haven't gotten any yet, messages - ::> from up to a day ago. - =+ num=(~(get by sequence) pan) - =+ old=(sub now.bol ~d1) ::TODO? full backlog - =+ ini=?^(num [%ud u.num] [%da old]) + :: unless otherwise specified, subscribe starting + :: at the last message we heard. + =. ran ::TODO =? + ?^ ran ran + =+ num=(~(get by sequence) pan) + ?~ num `[[%ud 0] ~] + `[[%ud u.num] ~] ?- -.pan $| !! ::< passport partner :: $& ::< circle partner :_ ~ - (circle-peer nom p.pan `[ini ~]) + (circle-peer nom p.pan ran) == :: ++ sa-abjure ::< unsubscribe us @@ -1603,15 +1598,16 @@ :: |= {nom/cord cir/circle wen/range} ^- card + =/ ran + ?~ wen ~ + %+ welp + /(scot -.hed.u.wen +.hed.u.wen) + ?~ tal.u.wen ~ + /(scot -.u.tal.u.wen +.u.tal.u.wen) :* %peer - /circle/[nom]/(scot %p hos.cir)/[nom.cir] + (welp /circle/[nom]/(scot %p hos.cir)/[nom.cir] ran) [hos.cir %talk-guardian] - %+ welp /circle/[nom.cir] - ?~ wen ~ - %+ welp - /(scot -.hed.u.wen +.hed.u.wen) - ?~ tal.u.wen ~ - /(scot -.u.tal.u.wen +.u.tal.u.wen) + (welp /circle/[nom.cir] ran) == :: ::> || @@ -1679,12 +1675,16 @@ $report ~ ::TODO? we just don't have a prize. or do we need [%report ~] ? :: - $circle + $circle ::REVIEW should we send precs & config to out of range subs? + :: we can either be: + :: - before range: send precs, config + :: - in range: send precs, config, msgs + :: - after range: send msgs =+ soy=(~(get by stories) nom.qer) ?~ soy ~ :+ ~ ~ :- %circle - :+ grams.u.soy ::TODO get using specified range. + :+ (~(so-first-grams so:ta nom.qer ~ u.soy) ran.qer) [shape.u.soy mirrors.u.soy] [locals.u.soy remotes.u.soy] == @@ -1757,6 +1757,9 @@ ?. ?=($story -.dif) ~ ?. =(nom.qer nom.dif) ~ ?: ?=($follow -.dif.dif) ~ :: internal-only delta + =+ ren=(~(so-in-range so:ta nom.qer ~ (~(got by stories) nom.qer)) ran.qer) + ::TODO if done.ren, %quit bone + ?. in.ren ~ `[%circle dif.dif] == :: diff --git a/sur/talk.hoon b/sur/talk.hoon index 894b356728..923b25af32 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -16,8 +16,8 @@ {$report $~} ::< duty reports {$circle nom/knot ran/range} ::< story query == :: -++ range (unit {hed/place tal/(unit place)}) ::< msg range, @ud/@da -++ place $%({$da @da} {$ud @ud}) ::< point for range +++ range (unit {hed/place tal/(unit place)}) ::< inclusive msg range +++ place $%({$da @da} {$ud @ud}) ::< @ud/@da for range ++ prize ::> query result $% $: $reader ::< /reader gys/(jug char (set partner)) ::< glyph bindings @@ -68,7 +68,7 @@ {$grams gaz/(list telegram)} ::< new/changed msgs {$config cir/circle dif/diff-config} ::< new/changed config {$status pan/partner who/ship dif/diff-status} ::< new/changed status - {$follow sub/? pas/(set partner)} ::TODO range ::< un/subscribe + {$follow sub/? pas/(map partner range)} ::< un/subscribe {$remove $~} ::< removed story == :: ++ diff-config ::> config change @@ -149,6 +149,7 @@ ++ lobby {loc/config rem/(map circle config)} ::< our & srcs configs ++ config ::> circle config $: src/(set partner) ::< active sources + ::TODO ^ include range? cap/cord ::< description fit/filter ::< message rules con/control ::< restrictions From 3f314b8bb21a1a53a666780740bb7c0c6a762847 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 27 Jun 2017 12:40:58 -0700 Subject: [PATCH 129/303] Now sending all outward thoughts towards a circle as a single talk-command. --- app/talk-guardian.hoon | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index d8381b0f93..674d15f66b 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -1156,15 +1156,15 @@ :: |= {cir/circle out/(list thought)} ^+ +> - ?~ out +> - ::TODO just send the list at once? =. +> %+ da-emit ost.bol :* %poke /repeat/(scot %ud p.outbox)/(scot %p hos.cir)/[nom.cir] [hos.cir %talk-guardian] - [%talk-command %publish i.out ~] + [%talk-command %publish out] == + |- ^+ +>.^$ + ?~ out +>.^$ %= $ p.outbox +(p.outbox) q.outbox (~(put by q.outbox) p.outbox i.out) From 7928998e9b7488b4eb36e7d783590b5161bee0aa Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 27 Jun 2017 12:43:48 -0700 Subject: [PATCH 130/303] Missing change in sur to allow range specification in the %source action. --- sur/talk.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sur/talk.hoon b/sur/talk.hoon index 923b25af32..6d5656691f 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -106,7 +106,7 @@ {$depict nom/knot des/cord} ::< change description {$filter nom/knot fit/filter} ::< change message rules {$permit nom/knot inv/? sis/(set ship)} ::< invite/banish - {$source nom/knot sub/? src/(set partner)} ::< un/sub to/from src + {$source nom/knot sub/? src/(map partner range)} ::< un/sub to/from src :: messaging :: {$convey tos/(list thought)} ::< post exact {$phrase aud/(set partner) ses/(list speech)} ::< post easy From 3e32f78ac133b2e95d785f5b6c0a61b23c1c7646 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 27 Jun 2017 16:45:56 -0700 Subject: [PATCH 131/303] Can now set presence or status for specific circles, even foreign ones. --- app/talk-agent.hoon | 50 +++++++++++++++++++---- app/talk-guardian.hoon | 93 ++++++++++++++++++++++++++++++++---------- lib/talk.hoon | 4 +- sur/talk.hoon | 10 +++-- 4 files changed, 122 insertions(+), 35 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 1856a9ce95..54dc17e6b2 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -79,7 +79,8 @@ {$banish p/knot q/(set ship)} ::< deny permission {$source p/knot q/(map partner range)} ::< add source :: personal metadata - {$status p/knot q/presence} ::TODO better interface ::< set status + {$attend p/(set circle) q/presence} ::< set our presence + {$name p/(set circle) q/human} ::< set our name :: messaging :: {$say p/(list speech)} ::< send message {$eval p/cord q/twig} ::< send #-message @@ -560,6 +561,10 @@ == == :: + ++ cirs ::< non-empty circles + %+ cook ~(gas in *(set circle)) + (most ;~(plug com (star ace)) circ) + :: ++ parn ::< partner ;~ pose (stag %& circ) @@ -696,7 +701,28 @@ :: :: personal metadata :: - ;~((glue ace) (perk %status ~) cire (perk %gone %idle %hear %talk ~)) + ;~ (glue ace) + (perk %attend ~) + cirs + (perk %gone %idle %hear %talk ~) + == + :: + ;~ plug + (perk %name ~) + ;~(pfix ace cirs) + ;~(pfix ace ;~(pose (cook some qut) (cold ~ sig))) + ;~ pose + ;~ pfix ace + %+ cook some + ;~ pose + ;~((glue ace) qut (cook some qut) qut) + ;~(plug qut (cold ~ ace) qut) + == + == + ;~(pfix ace (cold ~ sig)) + (easy ~) + == + == :: :: displaying info :: @@ -839,7 +865,8 @@ $banish (banish +.job) $source (source +.job) :: personal metadata - $status (status +.job) + $attend (attend +.job) + $name (name +.job) :: messaging $say (say +.job) $eval (eval +.job) @@ -1024,12 +1051,19 @@ ::> || ::+| :: - ++ status ::< set status - ::> + ++ attend ::< set our presence + ::> sets our presence to {pec} in circles {cis}. :: - |= {nom/knot pec/presence} + |= {cis/(set circle) pec/presence} ^+ ..sh-work - (sh-act %status [nom ~ ~] [pec [~ ~]]) + (sh-act %notify cis pec) + :: + ++ name ::< set our name + ::> sets our name to {man} in circles {cis}. + :: + |= {cis/(set circle) man/human} + ^+ ..sh-work + (sh-act %naming cis man) :: ::> || ::> || %messaging @@ -1077,7 +1111,7 @@ |= {a/ship b/presence c/human} ^- (unit tank) =. c ?. =(han.c `(scot %p a)) c - [tru.c ~] + [~ tru.c] ?- b $gone ~ $idle `leaf+:(weld "idle " (scow %p a) " " (trip (fall han.c ''))) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 674d15f66b..e6ecce80a8 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -230,12 +230,26 @@ ::> %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) == :: + ++ ta-present ::< update a status + ::> + :: + |= {who/ship nos/(set knot) dif/diff-status} + ^+ +> + %- ta-deltas + %- ~(rep in nos) + |= {n/knot l/(list delta)} + :_ l + [%story n %status [%& our.bol n] who dif] + :: ++ ta-action ::< apply reader action ::> performs action sent by a reader. :: @@ -268,7 +282,8 @@ $convey (action-convey +.act) $phrase (action-phrase +.act) :: personal metadata - $status (action-status +.act) + $notify (action-notify +.act) + $naming (action-naming +.act) :: changing shared ui $glyph (action-glyph +.act) $nick (action-nick +.act) @@ -295,6 +310,28 @@ |= {nom/knot dif/diff-story} (ta-delta %story nom dif) :: + ++ present ::< send status update + ::> + :: + |= {cis/(set circle) dif/diff-status} + ^+ ..ta-action + =/ cic + ^- (jug ship knot) + %- ~(rep in cis) + |= {c/circle m/(jug ship knot)} + (~(put ju m) hos.c nom.c) + =. ..ta-action ::TODO =? + ?. (~(has by cic) our.bol) ..ta-action + %- ~(rep in (~(get ju cic) our.bol)) + |= {n/knot _ta} + (affect n %status [%& our.bol n] our.bol dif) + =. cic (~(del by cic) our.bol) + %- ta-deltas + %- ~(rep by cic) + |= {{h/ship s/(set knot)} l/(list delta)} + :_ l + [%present h s dif] + :: ::> || %circle-configuration ::+| ++ action-create ::< create story @@ -385,20 +422,20 @@ :: ::> || %personal-metadata ::+| - ++ action-status ::< our status update - ::> for every story in the set, update our status. - ::TODO accept (set circle). for locals, do directly. - :: for remotes, send command. - :: on getting such a command, first check if - :: the sender actually is in our presende map. - ::TODO split interface into action-presence and - :: action-human. + :: + ++ action-notify ::< our presence update + ::> :: - |= {nos/(set knot) sat/status} + |= {cis/(set circle) pes/presence} ^+ ..ta-action - %- ~(rep in nos) - |= {k/knot _ta} - (affect k %status [%& our.bol k] our.bol %full sat) + (present cis %presence pes) + :: + ++ action-naming ::< our name update + ::> + :: + |= {cis/(set circle) man/human} + ^+ ..ta-action + (present cis %human %full man) :: ::> || %changing-shared-ui ::+| @@ -1100,6 +1137,19 @@ %- da-emit [ost.bol %diff %talk-reaction rac] :: + ++ da-present ::< send %present cmd + ::> + :: + |= {hos/ship nos/(set knot) dif/diff-status} + ^+ +> + %- da-emit + :* ost.bol + %poke + /present + [hos %talk-guardian] + [%talk-command %present nos dif] + == + :: ::> || ::> || %change-application ::> || @@ -1113,15 +1163,16 @@ |= dif/delta ^+ +> ?- -.dif - $out (da-change-out +.dif) - $done (da-change-done +.dif) - $glyph (da-change-glyph +.dif) - $nick (da-change-nick +.dif) - $story (da-change-story +.dif) - $init da-init + $out (da-change-out +.dif) + $done (da-change-done +.dif) + $glyph (da-change-glyph +.dif) + $nick (da-change-nick +.dif) + $story (da-change-story +.dif) + $init da-init $observe (da-observe +.dif) - $react (da-react +.dif) - $quit (da-emit [ost.dif %quit ~]) + $react (da-react +.dif) + $present (da-present +.dif) + $quit (da-emit [ost.dif %quit ~]) == :: ++ da-init ::< startup side-effects diff --git a/lib/talk.hoon b/lib/talk.hoon index 0ac36fa530..3ac7260024 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -144,8 +144,8 @@ man ?- -.dif.dif $full man.dif.dif - $true [tru.dif.dif han.man.sat] - $handle [tru.man.sat han.dif.dif] + $true [han.man.sat tru.dif.dif] + $handle [han.dif.dif tru.man.sat] == == == diff --git a/sur/talk.hoon b/sur/talk.hoon index 6d5656691f..f9cc1b6cfe 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -57,6 +57,7 @@ {$init $~} ::< initialize {$observe who/ship} ::< watch burden bearer {$react rac/reaction} ::< reaction to action + {$present hos/ship nos/(set knot) dif/diff-status}::< send %present cmd {$quit ost/bone} ::< force unsubscribe == :: ++ diff-glyph {bin/? gyf/char pas/(set partner)} ::< un/bound glyph @@ -111,8 +112,8 @@ {$convey tos/(list thought)} ::< post exact {$phrase aud/(set partner) ses/(list speech)} ::< post easy :: personal metadata :: - ::TODO change to target partners, not only our circles. - {$status nos/(set knot) sat/status} ::< our status update + {$notify cis/(set circle) pes/presence} ::< our presence update + {$naming cis/(set circle) man/human} ::< our name update :: changing shared ui :: {$glyph gyf/char pas/(set partner) bin/?} ::< un/bind a glyph {$nick who/ship nic/knot} ::< new identity @@ -131,6 +132,7 @@ :: ++ command ::> effect on story $% {$publish tos/(list thought)} ::< deliver + {$present nos/(set knot) dif/diff-status} ::< status update {$bearing $~} ::< prompt to listen == :: :: @@ -176,8 +178,8 @@ $talk ::< typing == :: ++ human ::> human identifier - $: tru/(unit (trel cord (unit cord) cord)) ::< true name - han/(unit cord) ::< handle + $: han/(unit cord) ::< handle + tru/(unit (trel cord (unit cord) cord)) ::< true name == :: :: ::> || From 30a93c38b526ac49f1f8150506873800af12522b Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 27 Jun 2017 17:36:01 -0700 Subject: [PATCH 132/303] %new story diffs over /burden now get treated as burdens. --- app/talk-guardian.hoon | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index e6ecce80a8..e91c4912fe 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -550,10 +550,9 @@ (so-hear:sor & [our.bol nom.dif] dif.dif) :: $new - ::TODO? shouldn't this act the same as $burden in ++ta-take? =< so-done - %- ~(so-hear so nom.dif ~ (fall (~(get by stories) nom.dif) *story)) - [& [our.bol nom.dif] %bear ~ [cof.dif.dif ~] [~ ~]] + %- ~(so-bear so nom.dif ~ (fall (~(get by stories) nom.dif) *story)) + [~ [cof.dif.dif ~] [~ ~]] == :: $circle From ee3c0aa10fb7772b2e859c530a6dfeba99bfba39 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 27 Jun 2017 17:37:46 -0700 Subject: [PATCH 133/303] No longer sending internal-only diffs outward. --- app/talk-guardian.hoon | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index e91c4912fe..86c75642e4 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -1786,6 +1786,7 @@ $burden ::?: &(=(who.qer src.bol) did-they-send-a-burden) ~ ?. ?=($story -.dif) ~ + ?: ?=(?($follow $burden) -.dif.dif) ~ :: only burden channels for now. ?. =(%black sec.con.shape:(~(got by stories) nom.dif)) ~ `[%burden nom.dif (dedicate who.qer dif.dif)] @@ -1806,7 +1807,7 @@ $circle ?. ?=($story -.dif) ~ ?. =(nom.qer nom.dif) ~ - ?: ?=($follow -.dif.dif) ~ :: internal-only delta + ?: ?=(?($follow $burden) -.dif.dif) ~ :: internal-only delta =+ ren=(~(so-in-range so:ta nom.qer ~ (~(got by stories) nom.qer)) ran.qer) ::TODO if done.ren, %quit bone ?. in.ren ~ From f33dd1b86ce197a86723e72ae50db715d3d69143 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 27 Jun 2017 17:42:58 -0700 Subject: [PATCH 134/303] Now using self-as-partner arms wherever appropriate. --- app/talk-guardian.hoon | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 86c75642e4..d1f3623217 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -813,7 +813,7 @@ =/ oud (~(got by aud.tot.t) [%& (above our.bol) nom]) =+ (~(del by aud.tot.t) [%& (above our.bol) nom]) - (~(put by -) [%& our.bol nom] oud) + (~(put by -) so-pan oud) :: burden flag (so-delta-our %burden &) :: @@ -1383,7 +1383,7 @@ sa-change-remote :: $status - ?: =(pan.dif [%& our.bol nom]) + ?: =(pan.dif sa-pan) sa-change-local sa-change-remote == @@ -1527,7 +1527,7 @@ %+ turn pas |= {pan/partner ran/range} ^- (list card) - ?: =(pan [%& our.bol nom]) ~ :: ignore self-subs + ?: =(pan sa-pan) ~ :: ignore self-subs :: unless otherwise specified, subscribe starting :: at the last message we heard. =. ran ::TODO =? From 2852b71070deb7f5846288dc0fb444dbe10214cf Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 28 Jun 2017 11:12:12 -0700 Subject: [PATCH 135/303] %source config diff now only takes a single partner, since it never gets done for multiple. --- app/talk-agent.hoon | 6 +++--- app/talk-guardian.hoon | 4 ++-- lib/talk.hoon | 6 +++--- sur/talk.hoon | 3 +-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 54dc17e6b2..6250ba0855 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -320,10 +320,10 @@ =(cir.dif incir) == sources - %. pas.dif.dif + %. pan.dif.dif ?: add.dif.dif - ~(uni in sources) - ~(dif in sources) + ~(put in sources) + ~(del in sources) :: mirrors ?: ?=($remove -.dif.dif) (~(del by mirrors) cir.dif) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index d1f3623217..46f85631db 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -914,7 +914,7 @@ |= pan/partner ^+ +> ?: (~(has in src.shape) pan) +> - (so-delta-our %config so-cir %source & [pan ~ ~]) + (so-delta-our %config so-cir %source & pan) :: ++ so-leave ::< subscription ended ::> delete {pan} from our sources. @@ -922,7 +922,7 @@ |= pan/partner ^+ +> ?. (~(has in src.shape) pan) +> - (so-delta-our %config so-cir %source | [pan ~ ~]) + (so-delta-our %config so-cir %source | pan) :: ++ so-first-grams ::< beginning of stream ::> find all grams that fall within the range. diff --git a/lib/talk.hoon b/lib/talk.hoon index 3ac7260024..053abbfcf1 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -101,10 +101,10 @@ $source %= cof src - %. pas.dif + %. pan.dif ?: add.dif - ~(uni in src.cof) - ~(dif in src.cof) + ~(put in src.cof) + ~(del in src.cof) == :: $permit diff --git a/sur/talk.hoon b/sur/talk.hoon index f9cc1b6cfe..647b2c7281 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -74,8 +74,7 @@ == :: ++ diff-config ::> config change $% {$full cof/config} ::< set w/o side-effects - ::TODO maybe just single partner, since we prob always do that - {$source add/? pas/(set partner)} ::< add/rem sources + {$source add/? pan/partner} ::< add/rem sources {$caption cap/cord} ::< changed description {$filter fit/filter} ::< changed filter {$secure sec/security} ::< changed security From 556a5a97e830cd4d4188e9e317e37e82135a01d8 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 28 Jun 2017 12:09:35 -0700 Subject: [PATCH 136/303] ++affection now caches rumor results for specific paths. --- app/talk-guardian.hoon | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 46f85631db..bda2cb6642 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -1818,19 +1818,23 @@ ::> for a given delta, send rumors to all queries it ::> affects. :: - ::TODO? probably want to do "affected by" checks for - :: every bone, and just construct the rumor once. - :: ^ gall need to do this for you. - |= dif/delta - ^- (list move) - %+ murn (~(tap by sup.bol)) - |= {b/bone s/ship p/path} - ^- (unit move) - =+ rum=(feel (path-to-query p) dif) ::TODO? %quit bones that are done with their subscription. :: ...but that would also require a ta-cancel call to remove :: them from the presence list! how do? :: should there be an ++away arm for gall to call? + |= dif/delta + ^- (list move) + :: cache results for paths. + =| res/(map path (unit rumor)) + %+ murn (~(tap by sup.bol)) + |= {b/bone s/ship p/path} + ^- (unit move) + =+ mur=(~(get by res) p) + ?^ mur + ?~ u.mur ~ + `[b %diff %talk-rumor u.u.mur] + =+ rum=(feel (path-to-query p) dif) + =. res (~(put by res) p rum) ?~ rum ~ `[b %diff %talk-rumor u.rum] :: From 583edfa15339b1d1ebe5a6174976d12c1fa111d5 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 30 Jun 2017 17:23:41 -0700 Subject: [PATCH 137/303] Audiences now get properly set to the ship the change is ++dedicated to. --- app/talk-guardian.hoon | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index bda2cb6642..7b9425ddc9 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -1747,6 +1747,23 @@ ^- diff-story ?+ -.dif dif + :: + $grams + %= dif + gaz + %+ turn gaz.dif + |= gam/telegram + =. aud.tot.gam + %- ~(run in aud.tot.gam) + |= {p/partner s/(pair envelope delivery)} + ::TODO it probably isn't safe to do this for + :: all audience members hosted by us, even + :: if this is only called for burdens. + :_ s + ?. &(?=($& -.p) =(hos.p.p our.bol)) p + [%& who nom.p.p] + gam + == :: $config ?. =(hos.cir.dif our.bol) dif From 4f7cf0485045847f70dfc98fdd61577e281ad299 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 30 Jun 2017 17:24:32 -0700 Subject: [PATCH 138/303] Patched up some TODO comments. --- app/talk-guardian.hoon | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 7b9425ddc9..6538a0cae5 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -37,7 +37,7 @@ !: :::: :: -[. talk] +[. talk] ::TODO =, => ::> || ::> || %arch ::> || @@ -46,6 +46,7 @@ |% ++ state ::> broker state $: stories/(map knot story) ::< conversations + ::TODO outbox not needed outbox/(pair @ud (map @ud thought)) ::< urbit outbox log/(map knot @ud) ::< logged to clay nicks/(map ship knot) ::< nicknames @@ -58,7 +59,7 @@ remotes/(map partner group) ::< remote presence shape/config ::< configuration mirrors/(map circle config) ::< remote config - ::TODO never gets updated. :: + ::TODO? never gets updated. still needed? :: sequence/(map partner @ud) ::< partners heard known/(map serial @ud) ::< messages heard burden/? ::< from parent? @@ -117,7 +118,7 @@ :: ::TODO maybe rewrite all arms to produce (list delta) :: instead of state? or nah? - |_ ::> moves: moves created by core operations. + |_ ::> deltas: deltas created by core operations. :: deltas/(list delta) :: @@ -741,7 +742,6 @@ ++ so-hear ::< accept circle rumor ::> apply changes from a rumor to this story. :: - ::TODO cleanup |= {bur/? src/circle dif/diff-story} ^+ +> ::TODO? are these checks still important? @@ -773,7 +773,7 @@ ~& %ignoring-remote-status +> (so-delta-our dif) - $follow ~&(%follow-not-rumor +>) ::TODO? crash? + $follow ~&(%follow-not-rumor +>) ::REVIEW $remove (so-delta-our %config src %remove ~) == :: @@ -1484,7 +1484,8 @@ ^- (list move) ?+ -.dif ~ $permit (sa-permit-effects sec.con.old ses.con.old +.dif) - ::TODO $secure ? not here, logic should go up-stream. + ::NOTE when doing a lone %secure, calculate the + :: necessary %permit deltas alongside it. == :: ++ sa-follow-effects ::< un/subscribe @@ -1664,7 +1665,6 @@ ::> || %new-events ::> || ::+| -::TODO make use of ++prey for filtering subs? ++ bake ::< apply state delta ::> applies a change to the application state, ::> producing side-effects. @@ -1683,7 +1683,7 @@ |= dis/(list delta) ^- (quip move +>) %+ roll dis - |= {d/delta m/(list move) _+>.$} ::TODO? ^$ find-fails, how is this correct? + |= {d/delta m/(list move) _+>.$} ::REVIEW ^$ find-fails, how is this correct? =^ mos +>.^$ (bake d) [(welp m mos) +>.^$] :: @@ -1715,7 +1715,7 @@ %+ murn (~(tap by stories)) |= {n/knot s/story} ^- (unit (pair knot burden)) - :: only auto-federate channels for now. + :: only auto-federate channels for now. ::REVIEW ?. ?=($black sec.con.shape.s) ~ :+ ~ n :+ grams.s @@ -1723,13 +1723,11 @@ [locals.s remotes.s] :: $report - ~ ::TODO? we just don't have a prize. or do we need [%report ~] ? + ::REVIEW we just don't have a prize... but do have rumors. + :: or do we need [%report ~] ? + ~ :: $circle ::REVIEW should we send precs & config to out of range subs? - :: we can either be: - :: - before range: send precs, config - :: - in range: send precs, config, msgs - :: - after range: send msgs =+ soy=(~(get by stories) nom.qer) ?~ soy ~ :+ ~ ~ @@ -2025,6 +2023,7 @@ ::> gall dropped our subscription. resubscribe. :: ::TODO update for all subscription kinds. + ::TODO? does new gall still drop subscriptions? |= wir/wire ^- (quip move +>) %+ etch-circle [%circle wir] From 4aa069c9f88b8b60c44febfc4ee5fc7c217b627b Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 30 Jun 2017 17:37:28 -0700 Subject: [PATCH 139/303] Removed bouquet for now. --- app/talk-agent.hoon | 4 +--- app/talk-guardian.hoon | 2 +- lib/talk.hoon | 2 +- mar/talk/command.hoon | 2 +- mar/talk/telegrams.hoon | 2 +- sur/talk.hoon | 4 +--- 6 files changed, 6 insertions(+), 10 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 6250ba0855..8f857dd5a0 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -1891,7 +1891,6 @@ sen/serial aud/audience wen/@da - bou/bouquet sep/speech == :: @@ -1957,8 +1956,7 @@ %+ turn (~(tap by aud)) |= {a/partner *} leaf+~(pr-full pr a) - =+ bok=(turn (sort (~(tap in bou)) aor) smyt) - [%rose [" " ~ ~] [hed >who< [%rose [", " "to " ~] paz] bok]]~ + [%rose [" " ~ ~] [hed >who< [%rose [", " "to " ~] paz] ~]]~ :: ++ tr-body ::< message content ::> long-form display of message contents, specific diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 6538a0cae5..3a08f5264d 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -419,7 +419,7 @@ %- ~(gas by *audience) %+ turn (~(tap in pas)) |=(p/partner [p *envelope %pending]) - [now.bol ~ i.ses] + [now.bol i.ses] :: ::> || %personal-metadata ::+| diff --git a/lib/talk.hoon b/lib/talk.hoon index 053abbfcf1..eacb2c74ba 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -58,7 +58,7 @@ ^- thought :+ (shaf %thot eny) [[[%& our (main our)] [*envelope %pending]] ~ ~] - [now *bouquet [%app dap (crip ~(ram re i.mes))]] + [now [%app dap (crip ~(ram re i.mes))]] :: ++ uniq |= eny/@uvJ diff --git a/mar/talk/command.hoon b/mar/talk/command.hoon index 3806d1058c..bb638cc2fd 100644 --- a/mar/talk/command.hoon +++ b/mar/talk/command.hoon @@ -97,7 +97,7 @@ ++ stam ^- $-(json (unit statement)) %+ cu eval - (ot date+di bouquet+(as (ar so)) speech+spec ~) + (ot date+di speech+spec ~) :: ++ spec %+ ke *speech-or-eval |. diff --git a/mar/talk/telegrams.hoon b/mar/talk/telegrams.hoon index 8aafaa8ee8..250434e8f5 100644 --- a/mar/talk/telegrams.hoon +++ b/mar/talk/telegrams.hoon @@ -81,7 +81,7 @@ %+ sear (soft passport) ;~((glue fas) sym urs:ab) :: XX [a-z0-9_]{1,15} :: - ++ stam (ot date+di bouquet+(as (ar so)) speech+spec ~) + ++ stam (ot date+di speech+spec ~) ++ spec %+ ke *speech |. ~+ %- of :~ diff --git a/sur/talk.hoon b/sur/talk.hoon index 647b2c7281..8cc473db00 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -189,7 +189,7 @@ :: ++ telegram {aut/ship tot/thought} ::< who thought ++ thought {uid/serial aud/audience sam/statement} ::< which whom this -++ statement {wen/@da boq/bouquet sep/speech} ::< when what body +++ statement {wen/@da sep/speech} ::< when what body ++ speech ::> content body $% {$non $~} ::< no content (yo) {$lin pat/? msg/cord} ::< no/@ text line @@ -234,6 +234,4 @@ $released ::< sent one-way $accepted ::< fully processed == :: -++ bouquet (set flavor) ::< complete aroma -++ flavor path ::< content flavor -- From f694d71d56babf06aae5f8f42e9e82812d430d56 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 30 Jun 2017 18:44:37 -0700 Subject: [PATCH 140/303] Removed unused message types. Changed %exp to include expression results. --- app/talk-agent.hoon | 44 +++++--------------------------------------- sur/talk.hoon | 18 ++---------------- 2 files changed, 7 insertions(+), 55 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 8f857dd5a0..b87b376d3d 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -1084,7 +1084,7 @@ |= {txt/cord exe/twig} => |.([(sell (slap (slop twig-head seed) exe))]~) =+ tan=p:(mule .) - (say [%fat tank+tan exp+txt] ~) + (say [%exp txt tan] ~) :: ++ target ::< %target ::> sets messaging target, then execute {woe}. @@ -1963,12 +1963,7 @@ ::> to each speech type. :: |- ^- sole-effect - ?+ -.sep - tan+[>sep<]~ - :: - $non - tan+~ - :: + ?- -.sep $lin tan+~[leaf+"{?:(pat.sep "" "@ ")}{(trip msg.sep)}"] :: @@ -1976,7 +1971,7 @@ url+(crip (earf url.sep)) :: $exp - tan+~[leaf+"# {(trip exp.sep)}"] + tan+~[rose+[" " ~ ~]^[leaf+"# {(trip exp.sep)}" res.sep]] :: $fat [%mor $(sep sep.sep) tan+(tr-tach tac.sep) ~] @@ -1990,22 +1985,9 @@ "you have been invited to " "you have been banished from " ~(cr-phat cr cir.sep) - :: - $mor - mor+(turn ses.sep |=(speech ^$(sep +<))) :: $app tan+~[rose+[": " ~ ~]^~[leaf+"[{(trip app.sep)}]" leaf+(trip msg.sep)]] - :: - $api - :- %tan - :_ ~ - :+ %rose - [": " ~ ~] - :~ leaf+"[{(trip id.sep)} on {(trip service.sep)}]" - leaf+(trip body.sep) - leaf+(earf url.sep) - == == :: ++ tr-tach ::< attachment @@ -2055,15 +2037,7 @@ :: |= wyd/@ud ^- (list tape) - ?+ -.sep - ~&(tr-lost+sep ~) - :: - $mor - ?~ ses.sep ~&(%tr-mor-empty ~) - |- ^- (list tape) - ?~ t.ses.sep ^$(sep i.ses.sep) - (weld ^$(sep i.ses.sep) $(ses.sep t.ses.sep)) - :: + ?- -.sep $fat %+ weld $(sep sep.sep) ^- (list tape) @@ -2072,8 +2046,7 @@ == :: $exp - ::TODO separate expr and res in the speech type, - :: then print both on their own line. (still 64) + ::TODO print truncated res on its own line. :_ ~ (tr-chow wyd '#' ' ' (trip exp.sep)) :: @@ -2129,13 +2102,6 @@ $app :_ ~ (tr-chow wyd "[{(trip app.sep)}]: {(trip msg.sep)}") - :: - $api - :_ ~ - %+ tr-chow wyd - %+ weld - "[{(trip id.sep)}@{(trip service.sep)}]: " - (trip summary.sep) == -- :: diff --git a/sur/talk.hoon b/sur/talk.hoon index 8cc473db00..bb9a7c8bd7 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -191,26 +191,12 @@ ++ thought {uid/serial aud/audience sam/statement} ::< which whom this ++ statement {wen/@da sep/speech} ::< when what body ++ speech ::> content body - $% {$non $~} ::< no content (yo) - {$lin pat/? msg/cord} ::< no/@ text line - {$ire tos/serial sep/speech} ::< in-reply-to + $% {$lin pat/? msg/cord} ::< no/@ text line {$url url/purf} ::< parsed url - {$exp exp/cord} ::< hoon line + {$exp exp/cord res/(list tank)} ::< hoon line {$fat tac/attache sep/speech} ::< attachment - {$lan nom/knot msg/cord} ::< local announce {$inv inv/? cir/circle} ::< inv/ban for circle - {$mor ses/(list speech)} ::< multiplex - {$ext nom/term dat/*} ::< extended action {$app app/term msg/cord} ::< app message - $: $api ::< api message - service/term ::< service name - id/cord ::< id on the service - id-url/purf ::< link to id - summary/cord ::< summary of event - body/cord ::< body of event - url/purf ::< link to event - meta/json ::< other data for web - == :: == :: ++ attache ::> attachment $% {$name nom/cord tac/attache} ::< named attachment From 35d057f4204aaaf7354bb40d6b52fcd14cc2093b Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 6 Jul 2017 13:38:36 -0700 Subject: [PATCH 141/303] TODOs based on code review. --- app/talk-guardian.hoon | 23 +++++++++++++++-------- sur/talk.hoon | 20 +++++++++++++++++++- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 3a08f5264d..bb017fd321 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -9,6 +9,7 @@ ::TODO document what user-facing messages actually mean! ::TODO maybe have brokers accept reactions as well, redirect them to readers. :: that way we can have foreign brokers react to our requests! +::TODO document gate samples fully. ::TODO ::> to :> etc. :: ::TODO we can't do away with the default mailbox because we need it for things @@ -184,7 +185,7 @@ ^+ +>+> =+ pur=(~(get by stories) nom) ?~ pur - ::TODO crash instead? + ::TODO crash instead! %- ta-note (crip "unknown story '{(trip nom)}'") (fun ~(. so nom ~ u.pur)) @@ -270,7 +271,7 @@ ::+| ++ work ::< perform action ^+ ..ta-action - ::TODO require deltas as product? + ::TODO require deltas as product! ?- -.act :: circle configuration $create (action-create +.act) @@ -660,6 +661,8 @@ ++ so-done ::< apply changes ::> put changed story back into the map and apply ::> actions. + ::TODO update inline docs + ::TODO maybe produce list of actions, apply in ++ta :: ^+ +> =. acs (flop acs) @@ -694,6 +697,7 @@ ++ so-delta ::< send delta ::> store delta in ++ta core. :: + ::TODO maybe keep our own list of deltas, produce in done |= dif/delta ^+ +> +>(deltas [dif deltas]) @@ -744,9 +748,9 @@ :: |= {bur/? src/circle dif/diff-story} ^+ +> - ::TODO? are these checks still important? - :: when things are slow we may get diffs from - :: things we already unsubscribed from, right? + :: check that we're still subscribed to this story + :: this is a small %gall bug, we shouldn't get these + :: ~? ?! ?| (~(has in src.shape) [%& src]) =(src so-cir) == @@ -784,6 +788,7 @@ :: |= {gaz/(list telegram) cos/lobby pes/crowd} ^+ +> + ::TODO =* self +> :: local config =. ..so-bear (so-config-full `shape loc.cos) @@ -820,12 +825,13 @@ ::> || ::> || %changes ::> || - ::> arms that make miscelaneous changes to this story. + ::> arms that make miscellaneous changes to this story. ::+| :: ++ so-config-full ::< split full config ::> split a %full config delta up into multiple ::> smaller ones, for easier application. + ::TODO mention side-effects :: |= {old/(unit config) cof/config} ^+ +> @@ -1391,7 +1397,6 @@ ++ sa-change-local ::< apply our delta ::> apply a %story delta to local data. :: - ::TODO split? |= dif/diff-story ^+ +> ?+ -.dif @@ -1598,7 +1603,7 @@ ::+| :: ++ etch ::< parse wire - ::> parses {wir}} to obtain either %circle with story + ::> parses {wir} to obtain either %circle with story ::> and circle or %repeat with message number, source ::> ship and story. :: @@ -1725,6 +1730,8 @@ $report ::REVIEW we just don't have a prize... but do have rumors. :: or do we need [%report ~] ? + ::TODO gall note: need to be able to subscirbe to just changes... or just + :: data etc. ~ :: $circle ::REVIEW should we send precs & config to out of range subs? diff --git a/sur/talk.hoon b/sur/talk.hoon index bb9a7c8bd7..767c7b3e1e 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -3,6 +3,9 @@ !: |% :: +::TODO wrappers around knot for story name, nickname, +::TODO use different words for different kinds of burdens +:: ::> || ::> || %query-models ::> || @@ -15,7 +18,10 @@ {$burden who/ship} ::< duties to share {$report $~} ::< duty reports {$circle nom/knot ran/range} ::< story query + ::TODO separate stream for just msgs? what about just configs? presences? + :: yes! == :: + ::TODO more newlines ++ range (unit {hed/place tal/(unit place)}) ::< inclusive msg range ++ place $%({$da @da} {$ud @ud}) ::< @ud/@da for range ++ prize ::> query result @@ -25,8 +31,10 @@ == :: {$friend cis/(set circle)} ::< /friend {$burden sos/(map knot burden)} ::< /burden + ::TODO do we ever use remote things from remote circles? {$circle burden} ::< /circle == :: + ::TODO ++prize-reader {gys nis} etc. ++ rumor ::< query result change $% $: $reader ::< /reader $= dif :: @@ -62,6 +70,11 @@ == :: ++ diff-glyph {bin/? gyf/char pas/(set partner)} ::< un/bound glyph ++ diff-nick {who/ship nic/cord} ::< changed nickname +::TODO separate remote-only diffs, like so: +::++ diff-foobar +:: $? diff-story +:: $% {$other-thing ...} +:: == ++ diff-story :: $% {$new cof/config} ::< new story {$bear bur/burden} ::< new inherited story @@ -73,6 +86,7 @@ {$remove $~} ::< removed story == :: ++ diff-config ::> config change + ::TODO maybe just full? think. $% {$full cof/config} ::< set w/o side-effects {$source add/? pan/partner} ::< add/rem sources {$caption cap/cord} ::< changed description @@ -117,6 +131,7 @@ {$glyph gyf/char pas/(set partner) bin/?} ::< un/bind a glyph {$nick who/ship nic/knot} ::< new identity == :: +::TODO don't send reactions, just crash! ++ reaction ::> user information $: res/?($info $fail) ::< result wat/cord ::< explain @@ -150,7 +165,7 @@ ++ lobby {loc/config rem/(map circle config)} ::< our & srcs configs ++ config ::> circle config $: src/(set partner) ::< active sources - ::TODO ^ include range? + ::TODO ^ include range? just remove! cap/cord ::< description fit/filter ::< message rules con/control ::< restrictions @@ -158,6 +173,7 @@ ++ filter ::> content filters $: cas/? ::< dis/allow capitals utf/? ::< dis/allow non-ascii + ::TODO maybe message length == :: ++ control {sec/security ses/(set ship)} ::< access control ++ security ::> security mode @@ -167,6 +183,7 @@ $brown ::< mailbox, our r, bl w == :: :: participant metadata. :: +::TODO think about naming more ++ crowd {loc/group rem/(map partner group)} ::< our & srcs presences ++ group (map ship status) ::< presence map ++ status {pec/presence man/human} ::< participant @@ -211,6 +228,7 @@ ::+| :: ++ serial @uvH ::< unique identifier +::TODO move delivery state out of audience, into local state ++ audience (map partner (pair envelope delivery)) ::< destination + state ++ envelope {vis/? sen/(unit partner)} ::< visible sender ++ delivery ::> delivery state From 7a91a9721d72411c89eaf7da6bb0067144d4dbd0 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 6 Jul 2017 14:45:38 -0700 Subject: [PATCH 142/303] Replaced frequent use of ..arm with self. --- app/talk-guardian.hoon | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index bb017fd321..122f611b7b 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -788,29 +788,29 @@ :: |= {gaz/(list telegram) cos/lobby pes/crowd} ^+ +> - ::TODO =* self +> + =* self +> :: local config - =. ..so-bear + =. self (so-config-full `shape loc.cos) :: remote config - =. ..so-bear + =. self %+ roll (~(tap by rem.cos)) - |= {{r/circle c/config} _..so-bear} + |= {{r/circle c/config} _self} (so-delta-our %config r %full c) :: local presence - =. ..so-bear + =. self %+ roll (~(tap by loc.pes)) - |= {{w/ship s/status} _..so-bear} + |= {{w/ship s/status} _self} (so-delta-our %status so-pan w %full s) :: remote presence - =. ..so-bear + =. self %+ roll (~(tap by rem.pes)) - |= {{p/partner g/group} _..so-bear} + |= {{p/partner g/group} _self} %+ roll (~(tap by g)) - |= {{w/ship s/status} _..so-bear} + |= {{w/ship s/status} _self} (so-delta-our %status p w %full s) :: telegrams - =. ..so-bear + =. self %+ so-delta-our %grams %+ turn gaz |= t/telegram From 8ceb9312d12c04746e94d4da0cb822dfb5fdaf28 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 6 Jul 2017 18:16:17 -0700 Subject: [PATCH 143/303] Removed delivery state from telegram audiences. --- app/talk-agent.hoon | 22 ++++++---------------- app/talk-guardian.hoon | 39 +++++++++++---------------------------- lib/talk.hoon | 2 +- sur/talk.hoon | 11 +---------- 4 files changed, 19 insertions(+), 55 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index b87b376d3d..1dd5278ae1 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -892,7 +892,7 @@ ^+ ..sh-work =+ tay=~(. tr settings.she gam) =. ..sh-work (sh-fact tr-fact:tay) - sh-prod(active.she tr-pals:tay) + sh-prod(active.she aud.tot.gam) :: ++ deli ::< find number ::> gets absolute message number from relative. @@ -1295,7 +1295,7 @@ |- ^- (unit (set partner)) ?~ grams ~ ::> get first partner from a telegram's audience. - =+ pan=(silt (turn (~(tap by aud.tot.i.grams)) head)) + =+ pan=(silt (~(tap in aud.tot.i.grams))) ?: (~(has in lax) pan) `pan $(grams t.grams) :: @@ -1953,8 +1953,8 @@ =. wen (sub wen (mod wen (div wen ~s0..0001))) :: round =+ hed=leaf+"{(scow %uv sen)} at {(scow %da wen)}" =/ paz - %+ turn (~(tap by aud)) - |= {a/partner *} + %+ turn (~(tap in aud)) + |= a/partner leaf+~(pr-full pr a) [%rose [" " ~ ~] [hed >who< [%rose [", " "to " ~] paz] ~]]~ :: @@ -2001,15 +2001,6 @@ $text (turn (flop +.a) |=(b/cord leaf+(trip b))) == :: - ++ tr-pals ::< aud w/o delivery - ::> strip delivery info from audience, producing a - ::> plain set of partners. - :: - ^- (set partner) - %- ~(gas in *(set partner)) - %+ turn (~(tap by aud)) - |=({a/partner *} a) - :: ++ tr-chow ::< truncate ::> truncates the {txt} to be of max {len} ::> characters. if it does truncate, indicates it @@ -2074,9 +2065,8 @@ =/ pef ?. pat.sep " " %~ ar-pref ar - =+ pal=tr-pals - ?: =(who our.bol) pal - (~(del in pal) [%& who (main who)]) + ?: =(who our.bol) aud + (~(del in aud) [%& who (main who)]) == =. wyd (sub wyd (lent pef)) =+ txt=(trip msg.sep) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 122f611b7b..644e94c4af 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -406,8 +406,8 @@ :: ++ action-phrase ::< post easy ::> sends the message contents provided in the - ::> action, constructing the audience, generating a - ::> serial and setting a timestamp. + ::> action generating a serial and setting a + ::> timestamp. :: |= {pas/(set partner) ses/(list speech)} ^+ ..ta-action @@ -416,11 +416,7 @@ ?~ ses ~ =^ sir eny.bol (uniq eny.bol) :_ $(ses t.ses) - :+ sir - %- ~(gas by *audience) - %+ turn (~(tap in pas)) - |=(p/partner [p *envelope %pending]) - [now.bol i.ses] + [sir pas [now.bol i.ses]] :: ::> || %personal-metadata ::+| @@ -572,13 +568,8 @@ ^+ +> =+ oot=(~(get by q.outbox) num) ?~ oot ~&([%ta-repeat-none num] +>.$) ::TODO? crash? - =. aud.u.oot - =+ olg=(~(got by aud.u.oot) who) - %+ ~(put by aud.u.oot) who - :- -.olg - ?~(fal %received ~>(%slog.[0 u.fal] %rejected)) - =. +>.$ - (ta-think | our.bol u.oot ~) + ::TODO store delivery state locally + ::?~(fal %received ~>(%slog.[0 u.fal] %rejected)) (ta-delta %done num) :: ::> || @@ -599,10 +590,10 @@ ::> conducts thought {tot} to each partner in its audience. :: |= {pub/? aut/ship tot/thought} - =+ aud=(~(tap by aud.tot)) + =+ aud=(~(tap in aud.tot)) |- ^+ +>.^$ ?~ aud +>.^$ - $(aud t.aud, +>.^$ (ta-conduct pub aut p.i.aud tot)) + $(aud t.aud, +>.^$ (ta-conduct pub aut i.aud tot)) :: ++ ta-conduct ::< thought to partner ::> either publishes or records a thought. @@ -814,11 +805,10 @@ %+ so-delta-our %grams %+ turn gaz |= t/telegram + :: in audience, replace above with us. =- t(aud.tot -) - =/ oud - (~(got by aud.tot.t) [%& (above our.bol) nom]) - =+ (~(del by aud.tot.t) [%& (above our.bol) nom]) - (~(put by -) so-pan oud) + =+ (~(del in aud.tot.t) [%& (above our.bol) nom]) + (~(put in -) so-pan) :: burden flag (so-delta-our %burden &) :: @@ -1036,11 +1026,6 @@ ?. (so-admire aut.gam) +> :: clean up the message to conform to our rules. =. tot.gam (so-sane tot.gam) - =. aud.tot.gam - ::> if we are in the audience, mark as received. - =+ ole=(~(get by aud.tot.gam) so-pan) - ?~ ole aud.tot.gam - (~(put by aud.tot.gam) so-pan p.u.ole %received) (so-delta-our %grams [gam ~]) :: ::> || @@ -1445,7 +1430,6 @@ known (~(put by known) uid.tot.gam count) == :: changed message - ::TODO shouldn't overwrite audience maybe? at least keep delivery? =+ dex=(sub count u.old) %_ +>.$ grams %+ welp @@ -1760,11 +1744,10 @@ |= gam/telegram =. aud.tot.gam %- ~(run in aud.tot.gam) - |= {p/partner s/(pair envelope delivery)} + |= p/partner ::TODO it probably isn't safe to do this for :: all audience members hosted by us, even :: if this is only called for burdens. - :_ s ?. &(?=($& -.p) =(hos.p.p our.bol)) p [%& who nom.p.p] gam diff --git a/lib/talk.hoon b/lib/talk.hoon index eacb2c74ba..0e05b0700a 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -57,7 +57,7 @@ :_ $(mes t.mes, eny (sham eny mes)) ^- thought :+ (shaf %thot eny) - [[[%& our (main our)] [*envelope %pending]] ~ ~] + [[%& our (main our)] ~ ~] [now [%app dap (crip ~(ram re i.mes))]] :: ++ uniq diff --git a/sur/talk.hoon b/sur/talk.hoon index 767c7b3e1e..7753090830 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -228,14 +228,5 @@ ::+| :: ++ serial @uvH ::< unique identifier -::TODO move delivery state out of audience, into local state -++ audience (map partner (pair envelope delivery)) ::< destination + state -++ envelope {vis/? sen/(unit partner)} ::< visible sender -++ delivery ::> delivery state - $? $pending ::< undelivered - $received ::< delivered - $rejected ::< undeliverable - $released ::< sent one-way - $accepted ::< fully processed - == :: +++ audience (set partner) ::< destinations -- From 02502d758ea88fc3016046215dda019c5905fd90 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 6 Jul 2017 19:59:23 -0700 Subject: [PATCH 144/303] Fixed the talk command mark to be cool with recent changes to the structures. --- mar/talk/command.hoon | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/mar/talk/command.hoon b/mar/talk/command.hoon index bb638cc2fd..8cc5c6c7ad 100644 --- a/mar/talk/command.hoon +++ b/mar/talk/command.hoon @@ -67,10 +67,7 @@ :: ++ audi ^- $-(json (unit audience)) - (op parn memb) - :: - ++ memb (ot [envelope+lope delivery+(ci (soft delivery) so) ~]) - ++ lope (ot [visible+bo sender+(mu (su parn)) ~]) + (as (su parn)) :: ++ parn ^- $-(nail (like partner)) @@ -81,17 +78,19 @@ :: ++ speech-or-eval $?(speech {$eval p/@t} {$mor ses/(list speech-or-eval)}) ++ eval - |= a/(trel @da bouquet speech-or-eval) + |= a/(pair @da speech-or-eval) ^- statement %= a - r + q |- ^- speech - ?: ?=($mor -.r.a) - [%mor (turn ses.r.a |=(b/speech-or-eval ^$(r.a b)))] - ?. ?=($eval -.r.a) r.a - =- [%fat tank+- %exp p.r.a] + ?: ?=($mor -.q.a) + ::[%mor (turn ses.q.a |=(b/speech-or-eval ^$(q.a b)))] + ~& %todo-talk-command-mark ::TODO fix + *speech + ?. ?=($eval -.q.a) q.a + =- [%exp p.q.a -] =+ pax=[&1:% &2:% (scot %da p.a) |3:%] - p:(mule |.([(sell (slap !>(..zuse) (rain pax p.r.a)))]~)) + p:(mule |.([(sell (slap !>(..zuse) (rain pax p.q.a)))]~)) == :: ++ stam From 9075373db7d747c3f9c8da4f6b99a5cd8264ba95 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 6 Jul 2017 20:01:08 -0700 Subject: [PATCH 145/303] Removed outbox. --- app/talk-guardian.hoon | 60 +++++++++++++----------------------------- sur/talk.hoon | 1 - 2 files changed, 19 insertions(+), 42 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 644e94c4af..63e4968181 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -47,8 +47,6 @@ |% ++ state ::> broker state $: stories/(map knot story) ::< conversations - ::TODO outbox not needed - outbox/(pair @ud (map @ud thought)) ::< urbit outbox log/(map knot @ud) ::< logged to clay nicks/(map ship knot) ::< nicknames nak/(jug char (set partner)) ::< circle glyph lookup @@ -85,7 +83,7 @@ {$quit $~} :: == :: ++ weir ::> parsed wire - $% {$repeat num/@ud cir/circle} ::< messaging wire + $% {$repeat cir/circle} ::< messaging wire {$circle nom/knot cir/circle} ::< subscription wire == :: -- @@ -564,13 +562,12 @@ ::> message got delivered. if an error was returned ::> mark the message as rejected. if not, received. :: - |= {num/@ud who/partner fal/(unit tang)} + |= {who/partner fal/(unit tang)} ^+ +> - =+ oot=(~(get by q.outbox) num) - ?~ oot ~&([%ta-repeat-none num] +>.$) ::TODO? crash? + ~? ?=(^ fal) u.fal ::TODO store delivery state locally ::?~(fal %received ~>(%slog.[0 u.fal] %rejected)) - (ta-delta %done num) + +> :: ::> || ::> || %messaging @@ -625,7 +622,6 @@ :: ++ ta-transmit ::< send message ::> sends thought {tot} to {cir}. - ::> stores it to the outbox to await confirmation. :: |= {cir/circle tot/thought} ^+ +> @@ -1154,7 +1150,6 @@ ^+ +> ?- -.dif $out (da-change-out +.dif) - $done (da-change-done +.dif) $glyph (da-change-glyph +.dif) $nick (da-change-nick +.dif) $story (da-change-story +.dif) @@ -1192,34 +1187,18 @@ == :: ++ da-change-out ::< outgoing messages - ::> apply an %out delta, sending a message and - ::> adding it to our outbox. + ::> apply an %out delta, sending a message. :: |= {cir/circle out/(list thought)} ^+ +> - =. +> - %+ da-emit ost.bol - :* %poke - /repeat/(scot %ud p.outbox)/(scot %p hos.cir)/[nom.cir] - [hos.cir %talk-guardian] - [%talk-command %publish out] - == - |- ^+ +>.^$ - ?~ out +>.^$ - %= $ - p.outbox +(p.outbox) - q.outbox (~(put by q.outbox) p.outbox i.out) - out t.out + ~& [%da-change-out hos.cir] + %+ da-emit ost.bol + :* %poke + /repeat/(scot %p hos.cir)/[nom.cir] + [hos.cir %talk-guardian] + [%talk-command %publish out] == :: - ++ da-change-done ::< delivered messages - ::> apply a %done delta, removing a delivered - ::> message from our outbox. - :: - |= num/@ud - ^+ +> - +>(q.outbox (~(del by q.outbox) num)) - :: ++ da-change-glyph ::< un/bound glyph ::> apply a %glyph delta, un/binding a glyph to/from ::> a set of partners. @@ -1602,11 +1581,10 @@ i.t.t.t.wir :: $repeat - ?> ?=({@ @ @ $~} t.wir) - :^ %repeat - (slav %ud i.t.wir) - (slav %p i.t.t.wir) - i.t.t.t.wir + ?> ?=({@ @ $~} t.wir) + :+ %repeat + (slav %p i.t.wir) + i.t.t.wir == :: ++ etch-circle ::< parse /circle wire @@ -1626,11 +1604,11 @@ :: |= $: wir/wire $= fun - $- {num/@ud cir/circle} + $- cir/circle {(list move) _.} == =+ wer=(etch wir) - ?>(?=($repeat -.wer) (fun num.wer cir.wer)) + ?>(?=($repeat -.wer) (fun cir.wer)) :: ++ circle-peer ::< /circle peer card ::> constructs a %peer move to subscribe {nom} to @@ -2028,9 +2006,9 @@ |= {wir/wire fal/(unit tang)} ^- (quip move +>) %+ etch-repeat [%repeat wir] - |= {num/@ud cir/circle} + |= cir/circle %- pre-bake - ta-done:(ta-repeat:ta num [%& cir] fal) + ta-done:(ta-repeat:ta [%& cir] fal) :: ::> || ::> || %logging diff --git a/sur/talk.hoon b/sur/talk.hoon index 7753090830..99d9e04899 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -55,7 +55,6 @@ ++ delta :: $% :: messaging state :: {$out cir/circle out/(list thought)} ::< msgs into outbox - {$done num/@ud} ::< msgs delivered :: shared ui state :: {$glyph diff-glyph} ::< un/bound glyph {$nick diff-nick} ::< changed nickname From ab7f7d47a50f7fb04531a95b277a7b39308cdbda Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 7 Jul 2017 16:21:13 -0700 Subject: [PATCH 146/303] Removed /friend query for now. --- app/talk-guardian.hoon | 28 +--------------------------- sur/talk.hoon | 1 - 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 63e4968181..0efebac0e3 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -1662,18 +1662,6 @@ ?- -.qer $reader ``[%reader nak nicks] - :: - $friend - :+ ~ ~ - :- %friend - %- ~(gas in *(set circle)) - %+ murn - =- (~(tap in src.shape.-)) - (~(got by stories) (main our.bol)) - |= p/partner - ^- (unit circle) - ?. ?=($& -.p) ~ - [~ p.p] :: $burden :+ ~ ~ @@ -1753,18 +1741,6 @@ $glyph `[%reader dif] $nick `[%reader dif] == - :: - $friend - :: new or removed local stories apply. - ::TODO include mailbox sources. check privacy flags. - ?. ?=($story -.dif) ~ - =/ add/(unit ?) - ?+ -.dif.dif ~ - $new `& - $remove `| - == - ?~ add ~ - `[%friend u.add [our.bol nom.dif]] :: $burden ::?: &(=(who.qer src.bol) did-they-send-a-burden) ~ @@ -1844,7 +1820,6 @@ => depa |^ %- af :~ [%reader ul] - [%friend ul] [%burden (at /[%p])] [%report ul] [%circle (al knot rang)] @@ -1862,7 +1837,6 @@ ^- ? ?- -.qer $reader (team our.bol who) - $friend & $burden ?& =(who who.qer) =(our.bol (above who)) == @@ -1982,7 +1956,7 @@ ?~ fal %- pre-bake ta-done:(ta-greet:ta nom cir) - =. u.fal [>%reap-friend-fail nom cir< u.fal] + =. u.fal [>%reap-circle-fail nom cir< u.fal] %- (slog (flop u.fal)) %- pre-bake ta-done:(ta-leave:ta nom cir) diff --git a/sur/talk.hoon b/sur/talk.hoon index 99d9e04899..89e65efdb4 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -14,7 +14,6 @@ :: ++ query ::> query paths $% {$reader $~} ::< shared ui state - {$friend $~} ::< publicly joined {$burden who/ship} ::< duties to share {$report $~} ::< duty reports {$circle nom/knot ran/range} ::< story query From 90c70cc916084b4aa251c38cc4c8060c9a81e502 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 7 Jul 2017 17:01:56 -0700 Subject: [PATCH 147/303] Removed reactions. Now just crash instead of neatly informing the user. --- app/talk-agent.hoon | 31 +++++++++---------------------- app/talk-guardian.hoon | 32 ++++++++------------------------ sur/talk.hoon | 7 ------- 3 files changed, 17 insertions(+), 53 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 1dd5278ae1..20fb778fb2 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -250,13 +250,6 @@ == == :: - ++ ta-reaction ::< apply reaction - ::> processes a talk reaction. - :: - |= rac/reaction - ^+ +> - sh-done:(~(sh-reaction sh cli) rac) - :: ++ ta-take ::< accept prize ::> :: @@ -1421,12 +1414,6 @@ ::> arms for printing data to the cli. ::+| :: - ++ sh-reaction ::< apply reaction - ::> renders a reaction to the cli. - :: - |= rac/reaction - (sh-lame (trip wat.rac)) - :: ++ sh-lame ::< send error ::> just puts some text into the cli as-is. :: @@ -2127,18 +2114,18 @@ ^- (quip move +>) ta-done:(ta-hear:ta dif) :: -++ diff-talk-reaction ::< accept reaction - ::> incoming talk reaction. process it. - :: - |= {way/wire rac/reaction} - ?. =(src.bol -:broker) - ~& [%diff-reaction-stranger src.bol] - [~ +>] - ta-done:(ta-reaction:ta rac) -:: ++ poke-sole-action ::< accept console ::> incoming sole action. process it. :: |= act/sole-action ta-done:(ta-sole:ta act) +:: +++ coup-reader-action ::< accept n/ack + ::> + :: + |= {wir/wire fal/(unit tang)} + ^- (quip move +>) + ?~ fal [~ +>] + %- (slog leaf+"action failed: " u.fal) + [~ +>] -- diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 0efebac0e3..12ba27078c 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -67,7 +67,6 @@ ++ lime ::> diff fruit $% {$talk-prize prize} :: {$talk-rumor rumor} :: - {$talk-reaction reaction} :: == :: ++ pear ::> poke fruit $% {$talk-command command} :: @@ -183,9 +182,8 @@ ^+ +>+> =+ pur=(~(get by stories) nom) ?~ pur - ::TODO crash instead! - %- ta-note - (crip "unknown story '{(trip nom)}'") + %- ta-evil + (crip "no story '{(trip nom)}'") (fun ~(. so nom ~ u.pur)) :: ::> || @@ -263,7 +261,7 @@ ::> ::> ++work calls the appropriate action processing ::> arm. most use ++affect to retrieve the affected - ::> story, reacting if it doesn't exist. + ::> story, crashing if it doesn't exist. |% :: || %utility ::+| @@ -289,20 +287,14 @@ $nick (action-nick +.act) == :: - ++ react ::< new reaction - ::> send reaction to this action. - :: - |= {res/?($info $fail) wat/cord} - (ta-delta %react [res wat `act]) - :: ++ affect ::< delta to story ::> store a delta about a story. if the story - ::> does not exist, react. + ::> does not exist, crash. :: |= {nom/knot dif/diff-story} ?: (~(has by stories) nom) (impact nom dif) - (react %fail (crip "no story {(trip nom)}")) + (ta-evil (crip "no story {(trip nom)}")) :: ++ impact ::< delta for story ::> Store a delta about a story. @@ -348,7 +340,7 @@ ?. ?=(?($white $green) typ) ~ [our.bol ~ ~] == - (react %fail (crip "{(trip nom)}: already exists")) + (ta-evil (crip "{(trip nom)}: already exists")) :: ++ action-delete ::< delete + announce ::> delete story {nom}, optionally announcing the @@ -382,7 +374,7 @@ |= {nom/knot inv/? sis/(set ship)} =+ soy=(~(get by stories) nom) ?~ soy - (react %fail (crip "no story {(trip nom)}")) + (ta-evil (crip "no story {(trip nom)}")) so-done:(~(so-permit so nom ~ u.soy) inv sis) :: ++ action-source ::< un/sub p to/from r @@ -391,7 +383,7 @@ |= {nom/knot sub/? pos/(map partner range)} =+ soy=(~(get by stories) nom) ?~ soy - (react %fail (crip "no story {(trip nom)}")) + (ta-evil (crip "no story {(trip nom)}")) so-done:(~(so-sources so nom ~ u.soy) sub pos) :: ::> || %messaging @@ -1116,13 +1108,6 @@ |= mov/move %_(+> moves [mov moves]) :: - ++ da-react ::< send reaction - ::> sends a talk-reaction diff to a reader. - :: - |= rac/reaction - %- da-emit - [ost.bol %diff %talk-reaction rac] - :: ++ da-present ::< send %present cmd ::> :: @@ -1155,7 +1140,6 @@ $story (da-change-story +.dif) $init da-init $observe (da-observe +.dif) - $react (da-react +.dif) $present (da-present +.dif) $quit (da-emit [ost.dif %quit ~]) == diff --git a/sur/talk.hoon b/sur/talk.hoon index 89e65efdb4..56edcea307 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -62,7 +62,6 @@ :: side-effects :: {$init $~} ::< initialize {$observe who/ship} ::< watch burden bearer - {$react rac/reaction} ::< reaction to action {$present hos/ship nos/(set knot) dif/diff-status}::< send %present cmd {$quit ost/bone} ::< force unsubscribe == :: @@ -129,12 +128,6 @@ {$glyph gyf/char pas/(set partner) bin/?} ::< un/bind a glyph {$nick who/ship nic/knot} ::< new identity == :: -::TODO don't send reactions, just crash! -++ reaction ::> user information - $: res/?($info $fail) ::< result - wat/cord ::< explain - why/(unit action) ::< cause - == :: :: ::> || ::> || %broker-communication From fa193ca559b09228b148a43cefe6d6eb45a4e8e7 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 7 Jul 2017 17:21:40 -0700 Subject: [PATCH 148/303] Now have separate structures for inward & outward diffs (deltas vs diffs/rumors). --- app/talk-guardian.hoon | 25 +++++++++++-------------- sur/talk.hoon | 16 +++++++--------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 12ba27078c..42fbf1c7a0 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -291,7 +291,7 @@ ::> store a delta about a story. if the story ::> does not exist, crash. :: - |= {nom/knot dif/diff-story} + |= {nom/knot dif/delta-story} ?: (~(has by stories) nom) (impact nom dif) (ta-evil (crip "no story {(trip nom)}")) @@ -299,7 +299,7 @@ ++ impact ::< delta for story ::> Store a delta about a story. :: - |= {nom/knot dif/diff-story} + |= {nom/knot dif/delta-story} (ta-delta %story nom dif) :: ++ present ::< send status update @@ -690,7 +690,7 @@ ++ so-delta-our ::< send delta of us ::> adds a delta about this story. :: - |= dif/diff-story + |= dif/delta-story ^+ +> (so-delta %story nom dif) :: @@ -739,7 +739,6 @@ (so-config-full ~ cof.dif) $(dif [%config src %full cof.dif]) $bear ~&(%so-bear (so-bear bur.dif)) - $burden ~&(%burden-not-rumor +>) $grams (so-lesson gaz.dif) $config :: full changes to us need to get split up. ?: &(=(cir.dif so-cir) ?=($full -.dif.dif)) @@ -756,7 +755,6 @@ ~& %ignoring-remote-status +> (so-delta-our dif) - $follow ~&(%follow-not-rumor +>) ::REVIEW $remove (so-delta-our %config src %remove ~) == :: @@ -816,20 +814,20 @@ %- so-deltas %+ turn %+ weld - ^- (list diff-story) + ^- (list delta-story) ?~ old ~ ::TODO? what to do about src? :~ ::[%follow | src.u.old] [%config so-cir %permit | ses.con.u.old] == - ^- (list diff-story) + ^- (list delta-story) :~ ::[%follow & src.cof] [%config so-cir %caption cap.cof] [%config so-cir %filter fit.cof] [%config so-cir %secure sec.con.cof] [%config so-cir %permit & ses.con.cof] == - |= d/diff-story + |= d/delta-story [%story nom d] :: ++ so-sources ::< change source @@ -1223,7 +1221,7 @@ ::> in case of a new or deleted story, specialized ::> arms are called. :: - |= {nom/knot dif/diff-story} + |= {nom/knot dif/delta-story} ^+ +> ?+ -.dif =< sa-done @@ -1325,7 +1323,7 @@ ::> figure out whether to apply a %story delta to ::> local or remote data. :: - |= dif/diff-story + |= dif/delta-story ^+ +> %. dif ?+ -.dif @@ -1345,7 +1343,7 @@ ++ sa-change-local ::< apply our delta ::> apply a %story delta to local data. :: - |= dif/diff-story + |= dif/delta-story ^+ +> ?+ -.dif ~&([%unexpected-delta-local -.dif] !!) @@ -1403,8 +1401,7 @@ ++ sa-change-remote ::< apply remote's delta ::> apply a story diff to remote data. :: - ::TODO split? - |= dif/diff-story + |= dif/delta-story ^+ +> ?+ -.dif ~&([%unexpected-delta-remote -.dif] !!) @@ -1679,7 +1676,7 @@ == :: ++ dedicate ::< diff-story to theirs - ::> modify a %story delta to make it about their ship + ::> modify a %story diff to make it about their ship ::> instead of ours. :: |= {who/ship dif/diff-story} diff --git a/sur/talk.hoon b/sur/talk.hoon index 56edcea307..5607519662 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -58,7 +58,7 @@ {$glyph diff-glyph} ::< un/bound glyph {$nick diff-nick} ::< changed nickname :: story state :: - {$story nom/knot dif/diff-story} ::< change to story + {$story nom/knot dif/delta-story} ::< change to story :: side-effects :: {$init $~} ::< initialize {$observe who/ship} ::< watch burden bearer @@ -67,19 +67,17 @@ == :: ++ diff-glyph {bin/? gyf/char pas/(set partner)} ::< un/bound glyph ++ diff-nick {who/ship nic/cord} ::< changed nickname -::TODO separate remote-only diffs, like so: -::++ diff-foobar -:: $? diff-story -:: $% {$other-thing ...} -:: == -++ diff-story :: +++ delta-story ::< story delta + $? diff-story ::< both in & outward + $% {$burden bur/?} ::< burden flag + {$follow sub/? pas/(map partner range)} ::< un/subscribe + == == :: +++ diff-story ::< story rumor $% {$new cof/config} ::< new story {$bear bur/burden} ::< new inherited story - {$burden bur/?} ::< burden flag {$grams gaz/(list telegram)} ::< new/changed msgs {$config cir/circle dif/diff-config} ::< new/changed config {$status pan/partner who/ship dif/diff-status} ::< new/changed status - {$follow sub/? pas/(map partner range)} ::< un/subscribe {$remove $~} ::< removed story == :: ++ diff-config ::> config change From 1daf2f547fe710a8ae31b41f760c89df56947150 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 10 Jul 2017 14:09:59 -0700 Subject: [PATCH 149/303] Pulled /reader diffs and rumors into their own structures. --- sur/talk.hoon | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/sur/talk.hoon b/sur/talk.hoon index 5607519662..2190369b88 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -24,27 +24,26 @@ ++ range (unit {hed/place tal/(unit place)}) ::< inclusive msg range ++ place $%({$da @da} {$ud @ud}) ::< @ud/@da for range ++ prize ::> query result - $% $: $reader ::< /reader - gys/(jug char (set partner)) ::< glyph bindings - nis/(map ship cord) ::< nicknames - == :: + $% {$reader prize-reader} ::< /reader {$friend cis/(set circle)} ::< /friend {$burden sos/(map knot burden)} ::< /burden ::TODO do we ever use remote things from remote circles? {$circle burden} ::< /circle == :: - ::TODO ++prize-reader {gys nis} etc. +++ prize-reader :: + $: gys/(jug char (set partner)) ::< glyph bindings + nis/(map ship cord) ::< nicknames + == :: ++ rumor ::< query result change - $% $: $reader ::< /reader - $= dif :: - $% {$glyph diff-glyph} :: - {$nick diff-nick} :: - == :: - == :: + $% {$reader dif/rumor-reader} ::< /reader {$friend add/? cir/circle} ::< /friend {$burden nom/knot dif/diff-story} ::< /burden {$circle dif/diff-story} ::< /circle == :: +++ rumor-reader ::< changed ui state + $% {$glyph diff-glyph} ::< un/bound glyph + {$nick diff-nick} ::< changed nickname + == :: ++ burden ::< full story state $: gaz/(list telegram) ::< all messages cos/lobby ::< loc & rem configs From caac4c89132c4294e67c93fbea8bccde2255f4bd Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 10 Jul 2017 16:41:47 -0700 Subject: [PATCH 150/303] Removed ++partner. Everything is now ++circles. --- app/talk-agent.hoon | 293 +++++++++++++++------------------------- app/talk-guardian.hoon | 214 +++++++++++++---------------- lib/talk.hoon | 14 +- mar/talk/command.hoon | 12 +- mar/talk/telegrams.hoon | 50 ++----- sur/talk.hoon | 23 ++-- 6 files changed, 236 insertions(+), 370 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 20fb778fb2..4774becfc1 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -7,7 +7,7 @@ ::TODO make sure glyphs only get bound when joins succeed :: ...this is a bit troublesome, because failed joins don't actually :: unsubscribe us. -::TODO maybe keep track of received grams per partner, too? +::TODO maybe keep track of received grams per circle, too? :: ::TODO for delta model: :: 3) split into delta creation and application, as with hall. @@ -37,21 +37,21 @@ count/@ud ::< (lent grams) grams/(list telegram) ::< all history known/(map serial @ud) ::< messages heard - sources/(set partner) ::< our subscriptions - :: partner details :: - remotes/(map partner group) ::< remote presences + sources/(set circle) ::< our subscriptions + :: circle details :: + remotes/(map circle group) ::< remote presences mirrors/(map circle config) ::< remote configs :: ui state :: nicks/(map ship cord) ::< human identities - nik/(map (set partner) char) ::< bound circle glyphs - nak/(jug char (set partner)) ::< circle glyph lookup + nik/(map (set circle) char) ::< bound circle glyphs + nak/(jug char (set circle)) ::< circle glyph lookup cli/shell ::< interaction state == :: ++ shell ::> console session $: id/bone ::< identifier latest/@ud ::< latest shown msg num say/sole-share ::< console state - active/(set partner) ::< active targets + active/(set circle) ::< active targets settings/(set knot) ::< frontend settings == :: ++ move (pair bone card) ::< all actions @@ -69,7 +69,7 @@ == :: ++ work ::> interface action $% :: circle management :: - {$join p/(map partner range)} ::< subscribe to + {$join p/(map circle range)} ::< subscribe to {$leave p/where} ::< unsubscribe from {$create p/security q/knot r/cord} ::< create circle {$delete p/knot q/(unit cord)} ::< delete circle @@ -77,7 +77,7 @@ {$filter p/knot q/? r/?} ::< change message rules {$invite p/knot q/(set ship)} ::< give permission {$banish p/knot q/(set ship)} ::< deny permission - {$source p/knot q/(map partner range)} ::< add source + {$source p/knot q/(map circle range)} ::< add source :: personal metadata {$attend p/(set circle) q/presence} ::< set our presence {$name p/(set circle) q/human} ::< set our name @@ -88,7 +88,7 @@ :: displaying info :: {$number p/$@(@ud {@u @ud})} ::< relative/absolute {$who p/where} ::< presence - {$what p/$@(char (set partner))} ::< show bound glyph + {$what p/$@(char (set circle))} ::< show bound glyph :: ui settings :: {$bind p/char q/(unit where)} ::< bind glyph {$unbind p/char q/(unit where)} ::< unbind glyph @@ -98,7 +98,7 @@ :: miscellaneous :: {$help $~} ::< print usage info == :: - ++ where (set partner) ::< non-empty audience + ++ where (set circle) ::< non-empty audience ++ glyphs `wall`~[">=+-" "}),." "\"'`^" "$%&@"] ::< circle char pool ' ++ termwidth 80 ::TODO put in setting or something? -- @@ -142,22 +142,17 @@ :_ inbox (true-self our.bol) :: -++ inpan ::< reader's partner - ::> ++inbox, except a full partner. - ^- partner - [%& incir] -:: ++ nik-from-nak ::< nik from nak ::> :: ::TODO ...we really should rename these. |= nek/_nak ^+ nik - %- ~(gas by *(map (set partner) char)) + %- ~(gas by *(map (set circle) char)) =- (zing -) %+ turn (~(tap by nek)) - |= {a/char b/(set (set partner))} - (turn (~(tap by b)) |=(c/(set partner) [c a])) + |= {a/char b/(set (set circle))} + (turn (~(tap by b)) |=(c/(set circle) [c a])) :: ::> || ::> || %engines @@ -270,7 +265,7 @@ %= ta-lesson sources src.loc.cos.piz mirrors (~(put by rem.cos.piz) incir loc.cos.piz) - remotes (~(put by rem.pes.piz) inpan loc.pes.piz) + remotes (~(put by rem.pes.piz) incir loc.pes.piz) == == :: @@ -313,7 +308,7 @@ =(cir.dif incir) == sources - %. pan.dif.dif + %. cir.dif.dif ?: add.dif.dif ~(put in sources) ~(del in sources) @@ -329,8 +324,8 @@ $status %= +> remotes - %+ ~(put by remotes) pan.dif - =+ rem=(fall (~(get by remotes) pan.dif) *group) + %+ ~(put by remotes) cir.dif + =+ rem=(fall (~(get by remotes) cir.dif) *group) ?: ?=($remove -.dif.dif) (~(del by rem) who.dif) %+ ~(put by rem) who.dif %+ change-status @@ -342,7 +337,7 @@ ++ ta-change-glyph ::< apply changed glyphs ::> applies new set of glyph bindings. :: - |= {bin/? gyf/char pas/(set partner)} + |= {bin/? gyf/char pas/(set circle)} ^+ +> =+ nek=(change-glyphs nak bin gyf pas) ?: =(nek nak) +>.$ :: no change @@ -410,7 +405,7 @@ :: ^+ . =/ she/shell - %*(. *shell id ost.bol, active (sy inpan ~)) + %*(. *shell id ost.bol, active (sy incir ~)) sh-done:~(sh-prod sh she) :: ++ ta-sole ::< apply sole input @@ -529,13 +524,6 @@ |=(a/(list ^ship) (~(gas in *(set ^ship)) a)) (most ;~(plug com (star ace)) ship) :: - ++ pasp ::< passport - ;~ pfix pat - ;~ pose - (stag %twitter ;~(pfix (jest 't') col urs:ab)) - == - == - :: ++ cire ::< local circle ;~(pfix cen sym) :: @@ -558,30 +546,6 @@ %+ cook ~(gas in *(set circle)) (most ;~(plug com (star ace)) circ) :: - ++ parn ::< partner - ;~ pose - (stag %& circ) - (stag %| pasp) - == - :: - ++ partners-flat ::< collapse mixed list - |= a/(list (each partner (set partner))) - ^- (set partner) - ?~ a ~ - ?- -.i.a - $& (~(put in $(a t.a)) p.i.a) - $| (~(uni in $(a t.a)) p.i.a) - == - :: - ++ para ::< partners alias - %+ cook partners-flat - %+ most ;~(plug com (star ace)) - (pick parn (sear sh-glyf glyph)) - :: - ++ parz ::< non-empty partners - %+ cook ~(gas in *(set partner)) - (most ;~(plug com (star ace)) parn) - :: ++ pont ::< point for range ;~ pose ::TODO support entering of @da and @dr, @@ -600,15 +564,9 @@ (easy ~) == :: - ++ sorc ::< partner + range - ;~ pose - ;~(plug (stag %& circ) rang) - ;~(plug (stag %| pasp) (easy ~)) - == - :: ++ sorz ::< non-empty sources - %+ cook ~(gas by *(map partner range)) - (most ;~(plug com (star ace)) sorc) + %+ cook ~(gas by *(map circle range)) + (most ;~(plug com (star ace)) ;~(plug circ rang)) :: ++ nump ::< number reference ;~ pose @@ -666,7 +624,7 @@ :: ;~((glue ace) (perk %join ~) sorz) :: - ;~((glue ace) (perk %leave ~) para) + ;~((glue ace) (perk %leave ~) cirs) :: ;~ (glue ace) (perk %create ~) pore @@ -719,15 +677,15 @@ :: :: displaying info :: - ;~(plug (perk %who ~) ;~(pose ;~(pfix ace para) (easy ~))) + ;~(plug (perk %who ~) ;~(pose ;~(pfix ace cirs) (easy ~))) :: - ;~((glue ace) (perk %what ~) ;~(pose parz glyph)) + ;~((glue ace) (perk %what ~) ;~(pose cirs glyph)) :: :: ui settings :: - ;~(plug (perk %bind ~) ;~(pfix ace glyph) (punt ;~(pfix ace para))) + ;~(plug (perk %bind ~) ;~(pfix ace glyph) (punt ;~(pfix ace cirs))) :: - ;~(plug (perk %unbind ~) ;~(pfix ace glyph) (punt ;~(pfix ace para))) + ;~(plug (perk %unbind ~) ;~(pfix ace glyph) (punt ;~(pfix ace cirs))) :: ;~ plug (perk %nick ~) ;~ pose @@ -760,7 +718,7 @@ :: :: messaging :: - (stag %target ;~(plug para (punt ;~(pfix ace message)))) + (stag %target ;~(plug cirs (punt ;~(pfix ace message)))) :: :: displaying info :: @@ -915,7 +873,7 @@ ::> applies glyph binding to our state and sends ::> an action. :: - |= {cha/char pas/(set partner)} + |= {cha/char pas/(set circle)} =: nik (~(put by nik) pas cha) nak (~(put ju nak) cha pas) == @@ -925,8 +883,8 @@ ::> removes either {pas} or all bindings on a ::> glyph and sends an action. :: - |= {cha/char pas/(unit (set partner))} - =/ ole/(set (set partner)) + |= {cha/char pas/(unit (set circle))} + =/ ole/(set (set circle)) ?^ pas [u.pas ~ ~] (~(get ju nak) cha) =. ..sh-work (sh-act %glyph cha (fall pas ~) |) @@ -966,7 +924,7 @@ ::> change local mailbox config to include ::> subscriptions to {pas}. :: - |= pos/(map partner range) + |= pos/(map circle range) ^+ ..sh-work =+ pas=(key-by pos) =. ..sh-work @@ -982,11 +940,11 @@ ::> change local mailbox config to exclude ::> subscriptions to {pas}. :: - |= pas/(set partner) + |= pas/(set circle) ^+ ..sh-work =/ pos %- ~(run in pas) - |=(p/partner [p ~]) + |=(p/circle [p ~]) (sh-act %source inbox | pos) :: ++ create ::< %create @@ -996,7 +954,7 @@ ^+ ..sh-work =. ..sh-work (sh-act %create nom txt sec) - (join [[[%& our.bol nom] ~] ~ ~]) + (join [[[our.bol nom] ~] ~ ~]) :: ++ delete ::< %delete ::> deletes our circle {nom}, after optionally @@ -1035,7 +993,7 @@ ++ source ::< %source ::> adds {pas} to {nom}'s src. :: - |= {nom/knot pos/(map partner range)} + |= {nom/knot pos/(map circle range)} ^+ ..sh-work (sh-act %source nom & pos) :: @@ -1082,7 +1040,7 @@ ++ target ::< %target ::> sets messaging target, then execute {woe}. :: - |= {pan/(set partner) woe/(unit ^work)} + |= {pan/(set circle) woe/(unit ^work)} ^+ ..sh-work =. ..sh-pact (sh-pact pan) ?~(woe ..sh-work work(job u.woe)) @@ -1095,9 +1053,9 @@ ++ who ::< %who ::> prints presence lists for {pas} or all. :: - |= pas/(set partner) ^+ ..sh-work + |= pas/(set circle) ^+ ..sh-work =< (sh-fact %mor (murn (sort (~(tap by remotes) ~) aor) .)) - |= {pon/partner gop/group} ^- (unit sole-effect) + |= {pon/circle gop/group} ^- (unit sole-effect) ?. |(=(~ pas) (~(has in pas) pon)) ~ =- `[%tan rose+[", " `~]^- leaf+~(pr-full pr pon) ~] =< (murn (sort (~(tap by gop)) aor) .) @@ -1115,7 +1073,7 @@ ++ what ::< %what ::> prints binding details. goes both ways. :: - |= qur/$@(char (set partner)) + |= qur/$@(char (set circle)) ^+ ..sh-work ?^ qur =+ cha=(~(get by nik) qur) @@ -1123,7 +1081,7 @@ =+ pan=(~(tap in (~(get ju nak) qur))) ?: =(~ pan) (sh-fact %txt "~") =< (sh-fact %mor (turn pan .)) - |=(a/(set partner) [%txt ~(ar-prom ar a)]) + |=(a/(set circle) [%txt ~(ar-prom ar a)]) :: ++ number ::< %number ::> finds selected message, expand it. @@ -1152,7 +1110,7 @@ ++ bind ::< %bind ::> binds targets {pas} to the glyph {cha}. :: - |= {cha/char pas/(unit (set partner))} + |= {cha/char pas/(unit (set circle))} ^+ ..sh-work ?~ pas $(pas `active.she) =+ ole=(~(get by nik) u.pas) @@ -1163,7 +1121,7 @@ ++ unbind ::< %unbind ::> unbinds targets {pas} to glyph {cha}. :: - |= {cha/char pan/(unit (set partner))} + |= {cha/char pan/(unit (set circle))} ^+ ..sh-work ?. ?| &(?=(^ pan) (~(has by nik) u.pan)) &(?=($~ pan) (~(has by nak) cha)) @@ -1246,7 +1204,7 @@ ::> change currently selected audience to {lix} ::> and update the prompt. :: - |= lix/(set partner) + |= lix/(set circle) ^+ +> ::> ensure we can see what we send. =+ act=(sh-pare lix) @@ -1254,40 +1212,40 @@ sh-prod(active.she act) :: ++ sh-pare ::< adjust target list - ::> if the audience {paz} does not contain a - ::> partner we're subscribed to, add our mailbox + ::> if the audience {cis} does not contain a + ::> circle we're subscribed to, add our mailbox ::> to the audience (so that we can see our own ::> message). :: - |= paz/(set partner) - ?: (sh-pear paz) paz - (~(put in paz) inpan) + |= cis/(set circle) + ?: (sh-pear cis) cis + (~(put in cis) incir) :: ++ sh-pear ::< hearback - ::> produces true if any partner is included in + ::> produces true if any circle is included in ::> our subscriptions, meaning, we hear messages - ::> sent to {paz}. + ::> sent to {cis}. :: - |= paz/(set partner) - ?~ paz | - ?| (~(has in sources) `partner`n.paz) - $(paz l.paz) - $(paz r.paz) + |= cis/(set circle) + ?~ cis | + ?| (~(has in sources) `circle`n.cis) + $(cis l.cis) + $(cis r.cis) == :: ++ sh-glyf ::< decode glyph - ::> finds the partner(s) that match a glyph. + ::> finds the circle(s) that match a glyph. :: - |= cha/char ^- (unit (set partner)) + |= cha/char ^- (unit (set circle)) =+ lax=(~(get ju nak) cha) - ::> no partner. + ::> no circle. ?: =(~ lax) ~ - ::> single partner. + ::> single circle. ?: ?=({* $~ $~} lax) `n.lax - ::> in case of multiple partners, pick the most recently active one. - |- ^- (unit (set partner)) + ::> in case of multiple circles, pick the most recently active one. + |- ^- (unit (set circle)) ?~ grams ~ - ::> get first partner from a telegram's audience. + ::> get first circle from a telegram's audience. =+ pan=(silt (~(tap in aud.tot.i.grams))) ?: (~(has in lax) pan) `pan $(grams t.grams) @@ -1341,11 +1299,11 @@ ::> presence maps, producing a list of removed, ::> added and changed presences maps. :: - |= {one/(map partner group) two/(map partner group)} + |= {one/(map circle group) two/(map circle group)} =| $= ret - $: old/(list (pair partner group)) - new/(list (pair partner group)) - cha/(list (pair partner group)) + $: old/(list (pair circle group)) + new/(list (pair circle group)) + cha/(list (pair circle group)) == ^+ ret =. ret @@ -1435,7 +1393,7 @@ %+ sh-fact %pro :+ & %talk-line ^- tape - =/ rew/(pair (pair cord cord) (set partner)) + =/ rew/(pair (pair cord cord) (set circle)) [['[' ']'] active.she] =+ cha=(~(get by nik) q.rew) ?^ cha ~[u.cha ' '] @@ -1476,7 +1434,7 @@ $green "journal" == :: - ++ sh-spaz ::< render status + ++ sh-scis ::< render status ::> gets the presence of {saz} as a tape. :: |= sat/status @@ -1505,12 +1463,12 @@ ?~ new.cul +>.^$ =. +>.^$ $(new.cul t.new.cul) %- sh-note - (weld pre "met {(scow %p p.i.new.cul)} {(sh-spaz q.i.new.cul)}") + (weld pre "met {(scow %p p.i.new.cul)} {(sh-scis q.i.new.cul)}") =. +>.$ |- ^+ +>.^$ ?~ cha.cul +>.^$ %- sh-note - (weld pre "set {(scow %p p.i.cha.cul)} {(sh-spaz q.i.cha.cul)}") + (weld pre "set {(scow %p p.i.cha.cul)} {(sh-scis q.i.cha.cul)}") +>.$ :: ++ sh-show-permits ::< show permits @@ -1534,7 +1492,7 @@ ++ sh-show-sources ::< show sources ::> prints subscription changes to the cli. :: - |= {pre/tape old/(list partner) new/(list partner)} + |= {pre/tape old/(list circle) new/(list circle)} ^+ +> =. +>.$ |- ^+ +>.^$ @@ -1578,7 +1536,7 @@ ^+ +> :: new circle ?~ old - :: ++sh-show-rempe will notice a new partner. + :: ++sh-show-rempe will notice a new circle. +> :: removed circle ?~ new @@ -1693,12 +1651,13 @@ :(welp wun "/" (trip nom.one)) -- :: -++ pr ::< partner renderer - ::> used primarily for printing partners. +::TODO maybe merge with cr? +++ pr ::< circle renderer + ::> used primarily for printing circles. :: - |_ ::> one: the partner + |_ ::> one: the circle :: - one/partner + one/circle :: ++ pr-beat ::< more relevant ::> returns true if one is better to show, false @@ -1707,27 +1666,13 @@ ::> if both are passports, pick the "larger" one. ::> if they're equal, content hash. :: - |= two/partner ^- ? - ?- -.one - $& - ?- -.two - $| %& - $& (~(cr-best cr p.one) p.two) - == - :: - $| - ?- -.two - $& %| - $| ?: =(-.p.two -.p.one) - (lth (mug +.p.one) (mug +.p.two)) - (lth -.p.two -.p.one) - == - == + |= two/circle ^- ? + (~(cr-best cr one) two) :: ++ pr-best ::< most relevant - ::> picks the most relevant partner. + ::> picks the most relevant circle. :: - |=(two/partner ?:((pr-beat two) two one)) + |=(two/circle ?:((pr-beat two) two one)) :: ++ pr-sigh ::< assemble label ::> prepend {pre} to {yiz}, omitting characters of @@ -1747,50 +1692,37 @@ :: ++ pr-full (pr-show ~) ::< render full width :: - ++ pr-show ::< render partner - ::> renders a partner as text. + ++ pr-show ::< render circle + ::> renders a circle as text. :: - ::> moy: multiple partners in audience? + ::> moy: multiple circles in audience? |= moy/(unit ?) ^- tape - ?- -.one - :: render circle (as glyph if we can). - $& - ?~ moy - =+ cha=(~(get by nik) one ~ ~) - =- ?~(cha - "'{u.cha ~}' {-}") - ~(cr-phat cr p.one) - (~(cr-curt cr p.one) u.moy) - :: render passport. - $| - =/ pre ^- tape - ?- -.p.one - $twitter "@t:" - == - ?~ moy - (weld pre (trip p.p.one)) - =. pre ?.(u.moy pre ['*' pre]) - (pr-sigh 14 pre p.p.one) - == + :: render circle (as glyph if we can). + ?~ moy + =+ cha=(~(get by nik) one ~ ~) + =- ?~(cha - "'{u.cha ~}' {-}") + ~(cr-phat cr one) + (~(cr-curt cr one) u.moy) -- :: ++ ar ::< audience renderer - ::> used for representing audiences (sets of partners) + ::> used for representing audiences (sets of circles) ::> as tapes. :: |_ ::> lix: members of the audience. :: - lix/(set partner) + lix/(set circle) :: ++ ar-best ::< most relevant - ::> find the most relevant partner in the set. + ::> find the most relevant circle in the set. :: - ^- (unit partner) + ^- (unit circle) ?~ lix ~ :- ~ - |- ^- partner - =+ lef=`(unit partner)`ar-best(lix l.lix) - =+ rit=`(unit partner)`ar-best(lix r.lix) + |- ^- circle + =+ lef=`(unit circle)`ar-best(lix l.lix) + =+ rit=`(unit circle)`ar-best(lix r.lix) =. n.lix ?~(lef n.lix (~(pr-best pr n.lix) u.lef)) =. n.lix ?~(rit n.lix (~(pr-best pr n.lix) u.rit)) n.lix @@ -1799,10 +1731,10 @@ ::> remove ourselves from the audience. :: ^+ . - .(lix (~(del in lix) `partner`inpan)) + .(lix (~(del in lix) `circle`incir)) :: ++ ar-maud ::< multiple audience - ::> checks if there's multiple partners in the + ::> checks if there's multiple circles in the ::> audience via pattern matching. :: ^- ? @@ -1810,13 +1742,13 @@ !?=($@($~ {* $~ $~}) lix) :: ++ ar-prom ::< render targets - ::> render all partners, ordered by relevance. + ::> render all circles, ordered by relevance. :: ^- tape =. . ar-deaf =/ all - %+ sort `(list partner)`(~(tap in lix)) - |= {a/partner b/partner} + %+ sort `(list circle)`(~(tap in lix)) + |= {a/circle b/circle} (~(pr-beat pr a) b) =+ fir=& |- ^- tape @@ -1828,17 +1760,16 @@ == :: ++ ar-whom ::< render sender - ::> render sender as the most relevant partner. + ::> render sender as the most relevant circle. :: (~(pr-show pr (need ar-best)) ~ ar-maud) :: ++ ar-dire ::< direct message - ::> returns true if partner is a mailbox of ours. + ::> returns true if circle is a mailbox of ours. :: - |= pan/partner ^- ? - ?& ?=($& -.pan) - =(hos.p.pan our.bol) - =+ sot=(~(get by mirrors) +.pan) + |= cir/circle ^- ? + ?& =(hos.cir our.bol) + =+ sot=(~(get by mirrors) cir) &(?=(^ sot) ?=($brown sec.con.u.sot)) == :: @@ -1852,7 +1783,7 @@ ?^ cha ~[u.cha ' '] ?. (lien (~(tap by lix)) ar-dire) "* " - ?: ?=({{$& ^} $~ $~} lix) + ?: ?=({^ $~ $~} lix) ": " "; " -- @@ -1939,11 +1870,11 @@ ^- tang =. wen (sub wen (mod wen (div wen ~s0..0001))) :: round =+ hed=leaf+"{(scow %uv sen)} at {(scow %da wen)}" - =/ paz + =/ cis %+ turn (~(tap in aud)) - |= a/partner + |= a/circle leaf+~(pr-full pr a) - [%rose [" " ~ ~] [hed >who< [%rose [", " "to " ~] paz] ~]]~ + [%rose [" " ~ ~] [hed >who< [%rose [", " "to " ~] cis] ~]]~ :: ++ tr-body ::< message content ::> long-form display of message contents, specific diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 42fbf1c7a0..aebf607284 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -49,17 +49,17 @@ $: stories/(map knot story) ::< conversations log/(map knot @ud) ::< logged to clay nicks/(map ship knot) ::< nicknames - nak/(jug char (set partner)) ::< circle glyph lookup + nak/(jug char (set circle)) ::< circle glyph lookup == :: ++ story ::> wire content $: count/@ud ::< (lent grams) grams/(list telegram) ::< all messages locals/group ::< local presence - remotes/(map partner group) ::< remote presence + remotes/(map circle group) ::< remote presence shape/config ::< configuration mirrors/(map circle config) ::< remote config ::TODO? never gets updated. still needed? :: - sequence/(map partner @ud) ::< partners heard + sequence/(map circle @ud) ::< circles heard known/(map serial @ud) ::< messages heard burden/? ::< from parent? == :: @@ -156,7 +156,7 @@ :: |= msg/cord %^ ta-action 0 %phrase - :- [[%& our.bol (main our.bol)] ~ ~] + :- [[our.bol (main our.bol)] ~ ~] [%app %talk-guardian msg]~ :: ++ ta-evil ::< emit error @@ -246,7 +246,7 @@ %- ~(rep in nos) |= {n/knot l/(list delta)} :_ l - [%story n %status [%& our.bol n] who dif] + [%story n %status [our.bol n] who dif] :: ++ ta-action ::< apply reader action ::> performs action sent by a reader. @@ -316,7 +316,7 @@ ?. (~(has by cic) our.bol) ..ta-action %- ~(rep in (~(get ju cic) our.bol)) |= {n/knot _ta} - (affect n %status [%& our.bol n] our.bol dif) + (affect n %status [our.bol n] our.bol dif) =. cic (~(del by cic) our.bol) %- ta-deltas %- ~(rep by cic) @@ -333,7 +333,7 @@ ^+ ..ta-action ?. (~(has in stories) nom) %^ impact nom %new - :* [[%& our.bol nom] ~ ~] + :* [[our.bol nom] ~ ~] des [| |] :- typ @@ -351,7 +351,7 @@ =. ..ta-action ::TODO =? ?~ mes ..ta-action %+ action-phrase - [[%& our.bol nom] ~ ~] + [[our.bol nom] ~ ~] [%lin | u.mes]~ (affect nom %remove ~) :: @@ -378,9 +378,9 @@ so-done:(~(so-permit so nom ~ u.soy) inv sis) :: ++ action-source ::< un/sub p to/from r - ::> add/remove {pas} as sources for story {nom}. + ::> add/remove {pos} as sources for story {nom}. :: - |= {nom/knot sub/? pos/(map partner range)} + |= {nom/knot sub/? pos/(map circle range)} =+ soy=(~(get by stories) nom) ?~ soy (ta-evil (crip "no story {(trip nom)}")) @@ -399,14 +399,14 @@ ::> action generating a serial and setting a ::> timestamp. :: - |= {pas/(set partner) ses/(list speech)} + |= {cis/(set circle) ses/(list speech)} ^+ ..ta-action =- (ta-think & our.bol tos) |- ^- tos/(list thought) ?~ ses ~ =^ sir eny.bol (uniq eny.bol) :_ $(ses t.ses) - [sir pas [now.bol i.ses]] + [sir cis [now.bol i.ses]] :: ::> || %personal-metadata ::+| @@ -437,10 +437,10 @@ (ta-delta %nick who nic) :: ++ action-glyph ::< bind a glyph - ::> un/bind glyph {lif} to partners {pas}. + ::> un/bind glyph {lif} to circles {cis}. :: - |= {lif/char pas/(set partner) bin/?} - (ta-delta %glyph bin lif pas) + |= {lif/char cis/(set circle) bin/?} + (ta-delta %glyph bin lif cis) -- :: ::> || @@ -489,14 +489,14 @@ :: |= {nom/knot cir/circle} %- (ta-know nom) |= sor/_so =< so-done - (so-greet:sor %& cir) + (so-greet:sor cir) :: ++ ta-leave ::< subscription failed ::> removes {cir} from story {nom}'s followers. :: |= {nom/knot cir/circle} %- (ta-know nom) |= sor/_so =< so-done - (so-leave:sor %& cir) + (so-leave:sor cir) :: ++ ta-take ::< apply prize ::> for a %burden prize, bear the burden in a new @@ -554,7 +554,7 @@ ::> message got delivered. if an error was returned ::> mark the message as rejected. if not, received. :: - |= {who/partner fal/(unit tang)} + |= {who/circle fal/(unit tang)} ^+ +> ~? ?=(^ fal) u.fal ::TODO store delivery state locally @@ -576,7 +576,7 @@ $(tos t.tos, +> (ta-consume pub aut i.tos)) :: ++ ta-consume ::< to each audience - ::> conducts thought {tot} to each partner in its audience. + ::> conducts thought {tot} to each circle in its audience. :: |= {pub/? aut/ship tot/thought} =+ aud=(~(tap in aud.tot)) @@ -584,26 +584,21 @@ ?~ aud +>.^$ $(aud t.aud, +>.^$ (ta-conduct pub aut i.aud tot)) :: - ++ ta-conduct ::< thought to partner + ++ ta-conduct ::< thought to circle ::> either publishes or records a thought. :: - |= {pub/? aut/ship pan/partner tot/thought} + |= {pub/? aut/ship cir/circle tot/thought} ^+ +> - ?- -.pan - $& ::< circle partner - ?: pub - ?. (team our.bol aut) - %- ta-note - (crip "strange author {(scow %p aut)}") - =. aut our.bol - ?: =(aut hos.p.pan) - (ta-record nom.p.pan hos.p.pan tot) - (ta-transmit p.pan tot) - ?. =(our.bol hos.p.pan) +> - (ta-record nom.p.pan aut tot) - :: - $| !! ::< passport partner - == + ?: pub + ?. (team our.bol aut) + %- ta-note + (crip "strange author {(scow %p aut)}") + =. aut our.bol + ?: =(aut hos.cir) + (ta-record nom.cir hos.cir tot) + (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}. @@ -670,7 +665,7 @@ |= msg/cord ^+ +> %+ so-act %phrase - :- [[%& our.bol (main our.bol)] ~ ~] + :- [[our.bol (main our.bol)] ~ ~] [%app %talk-guardian msg]~ :: ++ so-delta ::< send delta @@ -700,7 +695,6 @@ ::> utility functions for data retrieval. ::+| :: - ++ so-pan [%& our.bol nom] ::< us as partner ++ so-cir [our.bol nom] ::< us as circle :: ::> || @@ -719,7 +713,7 @@ =. +>.$ %- ~(rep in loc.pes) |= {{w/ship s/status} _+>.$} - (so-hear | src %status [%& src] w %full s) + (so-hear | src %status src w %full s) (so-lesson gaz) :: ++ so-hear ::< accept circle rumor @@ -729,8 +723,7 @@ ^+ +> :: check that we're still subscribed to this story :: this is a small %gall bug, we shouldn't get these - :: - ~? ?! ?| (~(has in src.shape) [%& src]) + ~? ?! ?| (~(has in src.shape) src) =(src so-cir) == [%unexpected-rumor-source nom -.dif src] @@ -751,7 +744,7 @@ ~? =(src so-cir) %but-src-is-us +> $status :: ignore foreign remotes. - ?. |(=([%& src] pan.dif) =(src so-cir)) + ?. =(src so-cir) ~& %ignoring-remote-status +> (so-delta-our dif) @@ -778,14 +771,14 @@ =. self %+ roll (~(tap by loc.pes)) |= {{w/ship s/status} _self} - (so-delta-our %status so-pan w %full s) + (so-delta-our %status so-cir w %full s) :: remote presence =. self %+ roll (~(tap by rem.pes)) - |= {{p/partner g/group} _self} + |= {{c/circle g/group} _self} %+ roll (~(tap by g)) |= {{w/ship s/status} _self} - (so-delta-our %status p w %full s) + (so-delta-our %status c w %full s) :: telegrams =. self %+ so-delta-our %grams @@ -793,8 +786,8 @@ |= t/telegram :: in audience, replace above with us. =- t(aud.tot -) - =+ (~(del in aud.tot.t) [%& (above our.bol) nom]) - (~(put in -) so-pan) + =+ (~(del in aud.tot.t) [(above our.bol) nom]) + (~(put in -) so-cir) :: burden flag (so-delta-our %burden &) :: @@ -831,20 +824,20 @@ [%story nom d] :: ++ so-sources ::< change source - ::> adds or removes {pas} from our sources. + ::> adds or removes {cos} from our sources. :: ::TODO should ++action-source make use of this, :: because of the {sus} logic? - |= {add/? pos/(map partner range)} + |= {add/? cos/(map circle range)} ^+ +> ::TODO for new sources, follow. :: for existing sources, unfollow and refollow :: with new range? - ::=/ sus/(set partner) + ::=/ sus/(set circle) :: %. src.shape :: ?:(add ~(dif in pas) ~(int in pas)) ::?~ sus +>.$ - (so-delta-our %follow & pos) + (so-delta-our %follow & cos) :: ++ so-depict ::< change description ::> modifies our caption. @@ -874,7 +867,7 @@ |= {her/ship sat/status} ^+ +> ?: =(`sat (~(get by locals) her)) +>.$ - (so-delta-our %status so-pan her %full sat) + (so-delta-our %status so-cir her %full sat) :: ++ so-absent ::< del local presence ::> remove {her} from our presence map. @@ -882,7 +875,7 @@ |= her/ship ^+ +> ?. (~(has by locals) her) +> - (so-delta-our %status so-pan her %remove ~) + (so-delta-our %status so-cir her %remove ~) :: ::> || ::> || %subscriptions @@ -893,18 +886,18 @@ ++ so-greet ::< subscription started ::> store a started subscription as source. :: - |= pan/partner + |= cir/circle ^+ +> - ?: (~(has in src.shape) pan) +> - (so-delta-our %config so-cir %source & pan) + ?: (~(has in src.shape) cir) +> + (so-delta-our %config so-cir %source & cir) :: ++ so-leave ::< subscription ended - ::> delete {pan} from our sources. + ::> delete {cir} from our sources. :: - |= pan/partner + |= cir/circle ^+ +> - ?. (~(has in src.shape) pan) +> - (so-delta-our %config so-cir %source | pan) + ?. (~(has in src.shape) cir) +> + (so-delta-our %config so-cir %source | cir) :: ++ so-first-grams ::< beginning of stream ::> find all grams that fall within the range. @@ -1036,8 +1029,8 @@ %- so-act :- %phrase %- ~(rep in sus) - |= {s/ship a/(set partner) t/(list speech)} - :- (~(put in a) [%& s (main s)]) + |= {s/ship a/(set circle) t/(list speech)} + :- (~(put in a) [s (main s)]) [[%inv inv so-cir] t] (so-delta-our %config so-cir %permit [add sus]) :: @@ -1183,16 +1176,16 @@ :: ++ da-change-glyph ::< un/bound glyph ::> apply a %glyph delta, un/binding a glyph to/from - ::> a set of partners. + ::> a set of circles. :: - |= {bin/? gyf/char pas/(set partner)} + |= {bin/? gyf/char cis/(set circle)} ^+ +> ?: bin %_ +> - nak (~(put ju nak) gyf pas) + nak (~(put ju nak) gyf cis) == - =/ ole/(list (set partner)) - ?. =(pas ~) [pas ~] + =/ ole/(list (set circle)) + ?. =(cis ~) [cis ~] (~(tap in (~(get ju nak) gyf))) |- ^+ +>.^$ ?~ ole +>.^$ @@ -1305,7 +1298,6 @@ ::+| :: ++ sa-cir [our.bol nom] - ++ sa-pan [%& our.bol nom] :: ::> || ::> || %delta-application @@ -1326,19 +1318,11 @@ |= dif/delta-story ^+ +> %. dif - ?+ -.dif - sa-change-local - :: - $config - ?: =(cir.dif sa-cir) - sa-change-local + ?: ?& ?=(?($config $status) -.dif) + !=(cir.dif sa-cir) + == sa-change-remote - :: - $status - ?: =(pan.dif sa-pan) - sa-change-local - sa-change-remote - == + sa-change-local :: ++ sa-change-local ::< apply our delta ::> apply a %story delta to local data. @@ -1373,7 +1357,7 @@ == :: $follow - (sa-emil (sa-follow-effects sub.dif pas.dif)) + (sa-emil (sa-follow-effects sub.dif cos.dif)) == :: ++ sa-change-gram ::< save/update message @@ -1418,8 +1402,8 @@ $status %_ +>.$ remotes - %+ ~(put by remotes) pan.dif - =+ ole=(fall (~(get by remotes) pan.dif) *group) + %+ ~(put by remotes) cir.dif + =+ ole=(fall (~(get by remotes) cir.dif) *group) ?: ?=($remove -.dif.dif) (~(del by ole) who.dif) =+ old=(fall (~(get by ole) who.dif) *status) (~(put by ole) who.dif (change-status old dif.dif)) @@ -1439,13 +1423,13 @@ :: ++ sa-follow-effects ::< un/subscribe ::> apply side-effects for a %follow delta, - ::> un/subscribing this story to/from {pas}. + ::> un/subscribing this story to/from {cos}. :: - |= {sub/? pos/(map partner range)} + |= {sub/? cos/(map circle range)} ^- (list move) ?: sub - (sa-acquire (~(tap by pos))) - (sa-abjure (~(tap in (key-by pos)))) + (sa-acquire (~(tap by cos))) + (sa-abjure (~(tap in (key-by cos)))) :: ++ sa-permit-effects ::< notify permitted ::> apply side-effects for a %permit delta, @@ -1469,49 +1453,39 @@ ::+| :: ++ sa-acquire ::< subscribe us - ::> subscribes this story to each partner. + ::> subscribes this story to each circle. :: - |= pas/(list (pair partner range)) + |= cos/(list (pair circle range)) %+ sa-sauce 0 :: subscription is caused by this app %- zing - %+ turn pas - |= {pan/partner ran/range} + %+ turn cos + |= {cir/circle ran/range} ^- (list card) - ?: =(pan sa-pan) ~ :: ignore self-subs + ?: =(cir sa-cir) ~ :: ignore self-subs :: unless otherwise specified, subscribe starting :: at the last message we heard. =. ran ::TODO =? ?^ ran ran - =+ num=(~(get by sequence) pan) + =+ num=(~(get by sequence) cir) ?~ num `[[%ud 0] ~] `[[%ud u.num] ~] - ?- -.pan - $| !! ::< passport partner - :: - $& ::< circle partner - :_ ~ - (circle-peer nom p.pan ran) - == + :_ ~ + (circle-peer nom cir ran) :: ++ sa-abjure ::< unsubscribe us - ::> unsubscribes this story from each partner. + ::> unsubscribes this story from each circle. :: - |= pas/(list partner) + |= cis/(list circle) %+ sa-sauce 0 :: subscription is caused by this app %- zing - %+ turn pas - |= pan/partner + %+ turn cis + |= cir/circle ^- (list card) - ?- -.pan - $| !! ::< passport partner - :: - $& ::< circle partner - :_ ~ - :* %pull - /circle/[nom]/(scot %p hos.p.pan)/[nom.p.pan] - [hos.p.pan %talk-guardian] - ~ - == + :_ ~ + :* %pull + /circle/[nom]/(scot %p hos.cir)/[nom.cir] + [hos.cir %talk-guardian] + ~ == :: ++ sa-eject ::< unsubscribe ships @@ -1691,12 +1665,12 @@ |= gam/telegram =. aud.tot.gam %- ~(run in aud.tot.gam) - |= p/partner + |= c/circle ::TODO it probably isn't safe to do this for :: all audience members hosted by us, even :: if this is only called for burdens. - ?. &(?=($& -.p) =(hos.p.p our.bol)) p - [%& who nom.p.p] + ?. =(hos.c our.bol) c + [who nom.c] gam == :: @@ -1705,8 +1679,8 @@ dif(cir [who nom.cir.dif]) :: $status - ?. &(?=($& -.pan.dif) =(hos.p.pan.dif our.bol)) dif - dif(pan [%& who nom.p.pan.dif]) + ?. =(hos.cir.dif our.bol) dif + dif(cir [who nom.cir.dif]) == :: ++ feel ::< delta to rumor @@ -1963,7 +1937,7 @@ %+ etch-repeat [%repeat wir] |= cir/circle %- pre-bake - ta-done:(ta-repeat:ta [%& cir] fal) + ta-done:(ta-repeat:ta cir fal) :: ::> || ::> || %logging diff --git a/lib/talk.hoon b/lib/talk.hoon index 0e05b0700a..856dfa4c0b 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -44,7 +44,7 @@ :+ [our.bol %talk] %talk-action ^- action :+ %phrase - [[%& our.bol (main our.bol)] ~ ~] + [[our.bol (main our.bol)] ~ ~] [%app dap.bol (crip (earn url))]~ :: XX :: ++ said :: app message @@ -57,7 +57,7 @@ :_ $(mes t.mes, eny (sham eny mes)) ^- thought :+ (shaf %thot eny) - [[%& our (main our)] ~ ~] + [[our (main our)] ~ ~] [now [%app dap (crip ~(ram re i.mes))]] :: ++ uniq @@ -68,14 +68,14 @@ ++ change-glyphs ::< ... ::> :: - |= {gys/(jug char (set partner)) bin/? gyf/char pas/(set partner)} + |= {gys/(jug char (set circle)) bin/? gyf/char cis/(set circle)} ^+ gys :: simple bind. - ?: bin (~(put ju gys) gyf pas) + ?: bin (~(put ju gys) gyf cis) :: unbind all of glyph. - ?~ pas (~(del by gys) gyf) + ?~ cis (~(del by gys) gyf) :: unbind single. - (~(del ju gys) gyf pas) + (~(del ju gys) gyf cis) :: ++ change-nicks ::< change nick map ::> changes a nickname in a map, adding if it doesn't @@ -101,7 +101,7 @@ $source %= cof src - %. pan.dif + %. cir.dif ?: add.dif ~(put in src.cof) ~(del in src.cof) diff --git a/mar/talk/command.hoon b/mar/talk/command.hoon index 8cc5c6c7ad..a62a3c8f4d 100644 --- a/mar/talk/command.hoon +++ b/mar/talk/command.hoon @@ -52,7 +52,6 @@ ?~ nit ~ (some [u.nit +>->]) :: - :: ++ thot ^- $-(json (unit thought)) %- ot :~ @@ -67,14 +66,11 @@ :: ++ audi ^- $-(json (unit audience)) - (as (su parn)) + (as (su circ)) :: - ++ parn - ^- $-(nail (like partner)) - %+ peach - ;~((glue fas) ;~(pfix sig fed:ag) urs:ab) - %+ sear (soft passport) - ;~((glue fas) sym urs:ab) :: XX [a-z0-9_]{1,15} + ++ circ + ^- $-(nail (like circle)) + ;~((glue fas) ;~(pfix sig fed:ag) urs:ab) :: ++ speech-or-eval $?(speech {$eval p/@t} {$mor ses/(list speech-or-eval)}) ++ eval diff --git a/mar/talk/telegrams.hoon b/mar/talk/telegrams.hoon index 250434e8f5..e6c2bafc4d 100644 --- a/mar/talk/telegrams.hoon +++ b/mar/talk/telegrams.hoon @@ -68,18 +68,13 @@ statement+`$-(json (unit statement))`stam == :: - ++ audi `$-(json (unit audience))`(op parn memb) - ++ auri (op parn (ci (soft presence) so)) - ++ memb ^- $-(json (unit (pair envelope delivery))) - (ot envelope+lope delivery+(ci (soft delivery) so) ~) - ++ lope (ot visible+bo sender+(mu (su parn)) ~) + ++ audi `$-(json (unit audience))`circ + ++ auri (op circ (ci (soft presence) so)) + ++ lope (ot visible+bo sender+(mu (su circ)) ~) :: - ++ parn - ^- $-(nail (like partner)) - %+ pick - ;~((glue fas) ;~(pfix sig fed:ag) urs:ab) - %+ sear (soft passport) - ;~((glue fas) sym urs:ab) :: XX [a-z0-9_]{1,15} + ++ circ + ^- $-(nail (like circle)) + ;~((glue fas) ;~(pfix sig fed:ag) urs:ab) :: ++ stam (ot date+di speech+spec ~) ++ spec @@ -90,9 +85,6 @@ exp+(ot txt+so ~) app+(ot txt+so src+so ~) fat+(ot tor+tors taf+spec ~) - ext+(ot nom+so txe+blob ~) - non+ul - mor+(ar spec) :: inv+(ot ship+(su fed:ag) party+(su urs:ab) ~) == ++ tors @@ -118,13 +110,6 @@ |= telegram (jobe ship+(jope aut) thought+(thot tot) ~) :: - ++ jove - |= {a/envelope b/delivery} - %- jobe :~ - envelope+(jobe visible+[%b vis.a] sender+?~(sen.a ~ s+(parn u.sen.a)) ~) - delivery+[%s b] - == - :: ++ jope |=(a/ship (jape +:)) ::[%s (crip +:(scow %p a))]) ++ joke |=(a/tank [%s (role (turn (wash 0^80 a) crip))]) ++ jode |=(a/time (jone (div (mul (sub a ~1970.1.1) 1.000) ~s1))) @@ -133,20 +118,7 @@ |= thought (jobe serial+(jape ) audience+(audi aud) statement+(stam sam) ~) :: - ++ audi (map-to-json parn jove) - ++ bouq - |= a/bouquet - a+(turn (~(tap in a)) |=(b/path a+(turn b |=(c/knot s+c)))) - :: - ++ parn - |= a/partner ^- cord - ?- -.a - $& (circ p.a) - $| %- crip - ?- -.p.a - $twitter "{(trip -.p.a)}/{(trip p.p.a)}" - == - == + ++ audi (set-to-json circ) :: ++ circ |= a/circle ^- cord @@ -154,22 +126,16 @@ :: ++ stam |= statement - (jobe date+(jode wen) bouquet+(bouq boq) speech+(spec sep) ~) + (jobe date+(jode wen) speech+(spec sep) ~) :: ++ spec |= a/speech %+ joba -.a ?+ -.a ~|(stub+-.a !!) - $non ~ $lin (jobe txt+[%s msg.a] say+[%b pat.a] ~) $url (joba txt+(jape (earf url.a))) $exp (joba txt+[%s exp.a]) $fat (jobe tor+(tors tac.a) taf+$(a sep.a) ~) - $mor :- %a - |- ^- (list json) - ?~ ses.a ~ - [^$(a i.ses.a) $(ses.a t.ses.a)] - $ext (jobe nom+[%s nom.a] txe+(jape (sifo (jam +.a))) ~) $app (jobe txt+[%s msg.a] src+[%s app.a] ~) :: $inv (jobe ship+(jope p.a) party+[%s q.a] ~) == diff --git a/sur/talk.hoon b/sur/talk.hoon index 2190369b88..9607e4d580 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -31,7 +31,7 @@ {$circle burden} ::< /circle == :: ++ prize-reader :: - $: gys/(jug char (set partner)) ::< glyph bindings + $: gys/(jug char (set circle)) ::< glyph bindings nis/(map ship cord) ::< nicknames == :: ++ rumor ::< query result change @@ -64,25 +64,25 @@ {$present hos/ship nos/(set knot) dif/diff-status}::< send %present cmd {$quit ost/bone} ::< force unsubscribe == :: -++ diff-glyph {bin/? gyf/char pas/(set partner)} ::< un/bound glyph +++ diff-glyph {bin/? gyf/char pas/(set circle)} ::< un/bound glyph ++ diff-nick {who/ship nic/cord} ::< changed nickname ++ delta-story ::< story delta $? diff-story ::< both in & outward $% {$burden bur/?} ::< burden flag - {$follow sub/? pas/(map partner range)} ::< un/subscribe + {$follow sub/? cos/(map circle range)} ::< un/subscribe == == :: ++ diff-story ::< story rumor $% {$new cof/config} ::< new story {$bear bur/burden} ::< new inherited story {$grams gaz/(list telegram)} ::< new/changed msgs {$config cir/circle dif/diff-config} ::< new/changed config - {$status pan/partner who/ship dif/diff-status} ::< new/changed status + {$status cir/circle who/ship dif/diff-status} ::< new/changed status {$remove $~} ::< removed story == :: ++ diff-config ::> config change ::TODO maybe just full? think. $% {$full cof/config} ::< set w/o side-effects - {$source add/? pan/partner} ::< add/rem sources + {$source add/? cir/circle} ::< add/rem sources {$caption cap/cord} ::< changed description {$filter fit/filter} ::< changed filter {$secure sec/security} ::< changed security @@ -114,15 +114,15 @@ {$depict nom/knot des/cord} ::< change description {$filter nom/knot fit/filter} ::< change message rules {$permit nom/knot inv/? sis/(set ship)} ::< invite/banish - {$source nom/knot sub/? src/(map partner range)} ::< un/sub to/from src + {$source nom/knot sub/? src/(map circle range)} ::< un/sub to/from src :: messaging :: {$convey tos/(list thought)} ::< post exact - {$phrase aud/(set partner) ses/(list speech)} ::< post easy + {$phrase aud/(set circle) ses/(list speech)} ::< post easy :: personal metadata :: {$notify cis/(set circle) pes/presence} ::< our presence update {$naming cis/(set circle) man/human} ::< our name update :: changing shared ui :: - {$glyph gyf/char pas/(set partner) bin/?} ::< un/bind a glyph + {$glyph gyf/char pas/(set circle) bin/?} ::< un/bind a glyph {$nick who/ship nic/knot} ::< new identity == :: :: @@ -144,7 +144,6 @@ ::> messaging targets and their metadata. ::+| :: -++ partner (each circle passport) ::< message target ++ circle {hos/ship nom/knot} ::< native target ++ passport ::> foreign target $% {$twitter p/cord} ::< twitter handle @@ -152,7 +151,7 @@ :: circle configurations. :: ++ lobby {loc/config rem/(map circle config)} ::< our & srcs configs ++ config ::> circle config - $: src/(set partner) ::< active sources + $: src/(set circle) ::< active sources ::TODO ^ include range? just remove! cap/cord ::< description fit/filter ::< message rules @@ -172,7 +171,7 @@ == :: :: participant metadata. :: ::TODO think about naming more -++ crowd {loc/group rem/(map partner group)} ::< our & srcs presences +++ crowd {loc/group rem/(map circle group)} ::< our & srcs presences ++ group (map ship status) ::< presence map ++ status {pec/presence man/human} ::< participant ++ presence ::> status type @@ -216,5 +215,5 @@ ::+| :: ++ serial @uvH ::< unique identifier -++ audience (set partner) ::< destinations +++ audience (set circle) ::< destinations -- From a43c99859b8d3f48a20240f7df7605052e623fad Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 10 Jul 2017 17:23:12 -0700 Subject: [PATCH 151/303] Merged ++statement into ++thought, removed tot face from ++telegram. --- app/talk-agent.hoon | 12 ++++++------ app/talk-guardian.hoon | 32 ++++++++++++++++---------------- sur/talk.hoon | 10 +++++++--- 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 4774becfc1..c9fd1a62be 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -365,7 +365,7 @@ :: |= gam/telegram ^+ +> - =+ old=(~(get by known) uid.tot.gam) + =+ old=(~(get by known) uid.gam) ?~ old (ta-append gam) ::< add (ta-revise u.old gam) ::< modify @@ -377,7 +377,7 @@ ^+ +> =: grams [gam grams] count +(count) - known (~(put by known) uid.tot.gam count) + known (~(put by known) uid.gam count) == =< sh-done (~(sh-gram sh cli) gam) @@ -390,7 +390,7 @@ =+ old=(snag (dec way) grams) ?: =(gam old) +>.$ :: no change =. grams (welp (scag (dec way) grams) [gam (slag way grams)]) - ?: =(sam.tot.gam sam.tot.old) +>.$ :: just audience change + ?: =(sep.gam sep.old) +>.$ :: no worthy change =< sh-done (~(sh-gram sh cli) gam) :: @@ -843,7 +843,7 @@ ^+ ..sh-work =+ tay=~(. tr settings.she gam) =. ..sh-work (sh-fact tr-fact:tay) - sh-prod(active.she aud.tot.gam) + sh-prod(active.she aud.gam) :: ++ deli ::< find number ::> gets absolute message number from relative. @@ -1246,7 +1246,7 @@ |- ^- (unit (set circle)) ?~ grams ~ ::> get first circle from a telegram's audience. - =+ pan=(silt (~(tap in aud.tot.i.grams))) + =+ pan=(silt (~(tap in aud.i.grams))) ?: (~(has in lax) pan) `pan $(grams t.grams) :: @@ -1552,7 +1552,7 @@ |= gam/telegram ^+ +> ::TODO is it cool to just assume all messages we print are already stored? - =+ num=(~(got by known) uid.tot.gam) + =+ num=(~(got by known) uid.gam) =. +>.$ :: if the number isn't directly after latest, print it always. ?. =(num +(latest.she)) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index aebf607284..0df2d7eead 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -744,7 +744,7 @@ ~? =(src so-cir) %but-src-is-us +> $status :: ignore foreign remotes. - ?. =(src so-cir) + ?. |(=(src cir.dif) =(src so-cir)) ~& %ignoring-remote-status +> (so-delta-our dif) @@ -785,8 +785,8 @@ %+ turn gaz |= t/telegram :: in audience, replace above with us. - =- t(aud.tot -) - =+ (~(del in aud.tot.t) [(above our.bol) nom]) + =- t(aud -) + =+ (~(del in aud.t) [(above our.bol) nom]) (~(put in -) so-cir) :: burden flag (so-delta-our %burden &) @@ -918,13 +918,13 @@ ?~ gaz zeg ?: ?- -.u.tal.u.ran :: after the end $ud (lth +.u.tal.u.ran num) - $da (lth +.u.tal.u.ran wen.sam.tot.i.gaz) + $da (lth +.u.tal.u.ran wen.i.gaz) == :: if past the river, we're done searching. zeg ?: ?- -.hed.u.ran :: before the start $ud (lth num +.hed.u.ran) - $da (lth wen.sam.tot.i.gaz +.hed.u.ran) + $da (lth wen.i.gaz +.hed.u.ran) == :: if before the river, continue onward. $(num +(num), gaz t.gaz) @@ -961,14 +961,14 @@ ++ so-sane ::< sanitize ::> sanitize %lin speech according to our settings. :: - |= tot/thought - ^- thought - ?. ?=({$lin *} sep.sam.tot) tot - %_ tot - msg.sep.sam + |= sep/speech + ^- speech + ?. ?=($lin -.sep) sep + %_ sep + msg %- crip %- tufa - %+ turn (tuba (trip msg.sep.sam.tot)) + %+ turn (tuba (trip msg.sep)) |= a/@c :: always replace control characters. ?: |((lth a 32) =(a `@c`127)) @@ -1004,7 +1004,7 @@ :: check for write permissions. ?. (so-admire aut.gam) +> :: clean up the message to conform to our rules. - =. tot.gam (so-sane tot.gam) + =. sep.gam (so-sane sep.gam) (so-delta-our %grams [gam ~]) :: ::> || @@ -1366,13 +1366,13 @@ :: |= gam/telegram ^+ +> - =+ old=(~(get by known) uid.tot.gam) + =+ old=(~(get by known) uid.gam) ?~ old :: new message %_ +>.$ grams (welp grams [gam ~]) count +(count) - known (~(put by known) uid.tot.gam count) + known (~(put by known) uid.gam count) == :: changed message =+ dex=(sub count u.old) @@ -1663,8 +1663,8 @@ gaz %+ turn gaz.dif |= gam/telegram - =. aud.tot.gam - %- ~(run in aud.tot.gam) + =. aud.gam + %- ~(run in aud.gam) |= c/circle ::TODO it probably isn't safe to do this for :: all audience members hosted by us, even diff --git a/sur/talk.hoon b/sur/talk.hoon index 9607e4d580..4c1039a6ac 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -191,9 +191,13 @@ ::> structures for containing main message data. ::+| :: -++ telegram {aut/ship tot/thought} ::< who thought -++ thought {uid/serial aud/audience sam/statement} ::< which whom this -++ statement {wen/@da sep/speech} ::< when what body +++ telegram {aut/ship thought} ::< whose message +++ thought ::> inner message + $: uid/serial ::< unique identifier + aud/audience ::< destinations + wen/@da ::< timestamp + sep/speech ::< content + == :: ++ speech ::> content body $% {$lin pat/? msg/cord} ::< no/@ text line {$url url/purf} ::< parsed url From 5d566cd77fc60ddf8e58779f302bff51c6c05f1f Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 10 Jul 2017 17:39:03 -0700 Subject: [PATCH 152/303] Better formatting for ++range and ++place definitions. --- sur/talk.hoon | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sur/talk.hoon b/sur/talk.hoon index 4c1039a6ac..92f66c907a 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -20,9 +20,15 @@ ::TODO separate stream for just msgs? what about just configs? presences? :: yes! == :: - ::TODO more newlines -++ range (unit {hed/place tal/(unit place)}) ::< inclusive msg range -++ place $%({$da @da} {$ud @ud}) ::< @ud/@da for range +++ range ::> inclusive msg range + %- unit ::< ~ means everything + $: hed/place ::< start of range + tal/(unit place) ::< opt end of range + == :: +++ place ::> range indicators + $% {$da @da} ::< date + {$ud @ud} ::< message number + == :: ++ prize ::> query result $% {$reader prize-reader} ::< /reader {$friend cis/(set circle)} ::< /friend From 54e865f27fcee20ab7e0fed6b80eea7d3e9dd40c Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 10 Jul 2017 18:41:50 -0700 Subject: [PATCH 153/303] Renamed inherited flag and made it default to false. --- app/talk-guardian.hoon | 25 +++++++++++-------------- sur/talk.hoon | 2 +- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 0df2d7eead..1b7fb96107 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -61,7 +61,7 @@ ::TODO? never gets updated. still needed? :: sequence/(map circle @ud) ::< circles heard known/(map serial @ud) ::< messages heard - burden/? ::< from parent? + inherited/?($| $&) ::< from parent? == :: ++ move (pair bone card) ::< all actions ++ lime ::> diff fruit @@ -788,8 +788,8 @@ =- t(aud -) =+ (~(del in aud.t) [(above our.bol) nom]) (~(put in -) so-cir) - :: burden flag - (so-delta-our %burden &) + :: inherited flag + (so-delta-our %inherited &) :: ::> || ::> || %changes @@ -1219,11 +1219,8 @@ ?+ -.dif =< sa-done %. dif - %~ sa-change sa nom - %+ fall - (~(get by stories) nom) - %*(. *story burden |) - == + =+ (fall (~(get by stories) nom) *story) + ~(sa-change sa nom -) :: $new (da-create nom +.dif) $bear ~&(%unexpected-unsplit-bear +>) @@ -1236,8 +1233,7 @@ |= {nom/knot cof/config} ^+ +> =< sa-done - :: default for ? is &, so we manually set to | now. - %- ~(sa-change sa nom %*(. *story burden |)) + %- ~(sa-change sa nom *story) [%config [our.bol nom] %full cof] :: ++ da-delete ::< delete story @@ -1332,8 +1328,8 @@ ?+ -.dif ~&([%unexpected-delta-local -.dif] !!) :: - $burden - +>(burden bur.dif) + $inherited + +>(inherited ihr.dif) :: $grams |- ^+ +>.^$ @@ -1700,7 +1696,7 @@ $burden ::?: &(=(who.qer src.bol) did-they-send-a-burden) ~ ?. ?=($story -.dif) ~ - ?: ?=(?($follow $burden) -.dif.dif) ~ + ?: ?=(?($follow $inherited) -.dif.dif) ~ ::REVIEW ?= diff-story fishloop :: only burden channels for now. ?. =(%black sec.con.shape:(~(got by stories) nom.dif)) ~ `[%burden nom.dif (dedicate who.qer dif.dif)] @@ -1713,7 +1709,7 @@ ?. ?=(?($grams $status) -.dif.dif) ~ =+ soy=(~(got by stories) nom.dif) :: and only if the story is inherited. - ?. burden.soy ~ + ?. inherited.soy ~ :: only burden channels for now. ?. =(%black sec.con.shape.soy) ~ `[%burden nom.dif (dedicate (above our.bol) dif.dif)] @@ -1725,6 +1721,7 @@ =+ ren=(~(so-in-range so:ta nom.qer ~ (~(got by stories) nom.qer)) ran.qer) ::TODO if done.ren, %quit bone ?. in.ren ~ + ?: ?=(?($follow $inherited) -.dif.dif) ~ ::REVIEW ^ `[%circle dif.dif] == :: diff --git a/sur/talk.hoon b/sur/talk.hoon index 92f66c907a..e10c594a0c 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -74,7 +74,7 @@ ++ diff-nick {who/ship nic/cord} ::< changed nickname ++ delta-story ::< story delta $? diff-story ::< both in & outward - $% {$burden bur/?} ::< burden flag + $% {$inherited ihr/?} ::< inherited flag {$follow sub/? cos/(map circle range)} ::< un/subscribe == == :: ++ diff-story ::< story rumor From 7b980e3a8022271cf89e6b4656cd19966ad2d959 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 11 Jul 2017 13:11:17 -0700 Subject: [PATCH 154/303] Renamed nak to binds. --- app/talk-guardian.hoon | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 1b7fb96107..b7d61fa617 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -49,7 +49,7 @@ $: stories/(map knot story) ::< conversations log/(map knot @ud) ::< logged to clay nicks/(map ship knot) ::< nicknames - nak/(jug char (set circle)) ::< circle glyph lookup + binds/(jug char (set circle)) ::< circle glyph lookup == :: ++ story ::> wire content $: count/@ud ::< (lent grams) @@ -1182,15 +1182,15 @@ ^+ +> ?: bin %_ +> - nak (~(put ju nak) gyf cis) + binds (~(put ju binds) gyf cis) == =/ ole/(list (set circle)) ?. =(cis ~) [cis ~] - (~(tap in (~(get ju nak) gyf))) + (~(tap in (~(get ju binds) gyf))) |- ^+ +>.^$ ?~ ole +>.^$ %_ $ - nak (~(del ju nak) gyf i.ole) + binds (~(del ju binds) gyf i.ole) ole t.ole == :: @@ -1612,7 +1612,7 @@ ^- (unit (unit prize)) ?- -.qer $reader - ``[%reader nak nicks] + ``[%reader binds nicks] :: $burden :+ ~ ~ From e3467bfd668cc5b212aa8a453b04ad47ac228b6d Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 11 Jul 2017 15:12:29 -0700 Subject: [PATCH 155/303] Wrapper molds for nicknames and story names. --- app/talk-guardian.hoon | 94 +++++++++++++++++++++--------------------- sur/talk.hoon | 46 ++++++++++++--------- 2 files changed, 73 insertions(+), 67 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index b7d61fa617..031ffce797 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -46,9 +46,9 @@ :: |% ++ state ::> broker state - $: stories/(map knot story) ::< conversations - log/(map knot @ud) ::< logged to clay - nicks/(map ship knot) ::< nicknames + $: stories/(map naem story) ::< conversations + log/(map naem @ud) ::< logged to clay + nicks/(map ship nick) ::< local nicknames binds/(jug char (set circle)) ::< circle glyph lookup == :: ++ story ::> wire content @@ -83,7 +83,7 @@ == :: ++ weir ::> parsed wire $% {$repeat cir/circle} ::< messaging wire - {$circle nom/knot cir/circle} ::< subscription wire + {$circle nom/naem cir/circle} ::< subscription wire == :: -- :: @@ -177,7 +177,7 @@ ::> if the story {nom} exists, calls the gate with ::> a story core. if it doesn't, does nothing. :: - |= nom/knot + |= nom/naem |= fun/$-(_so _ta) ^+ +>+> =+ pur=(~(get by stories) nom) @@ -198,11 +198,11 @@ :: :: create default circles. => %+ roll - ^- (list {security knot cord}) + ^- (list {security naem cord}) :~ [%brown (main our.bol) 'default home'] [%green ~.public 'visible activity'] == - |= {{typ/security nom/knot des/cord} _ta} + |= {{typ/security nom/naem des/cord} _ta} %+ ta-action ost.bol [%create nom des typ] %- ta-deltas @@ -240,11 +240,11 @@ ++ ta-present ::< update a status ::> :: - |= {who/ship nos/(set knot) dif/diff-status} + |= {who/ship nos/(set naem) dif/diff-status} ^+ +> %- ta-deltas %- ~(rep in nos) - |= {n/knot l/(list delta)} + |= {n/naem l/(list delta)} :_ l [%story n %status [our.bol n] who dif] :: @@ -291,7 +291,7 @@ ::> store a delta about a story. if the story ::> does not exist, crash. :: - |= {nom/knot dif/delta-story} + |= {nom/naem dif/delta-story} ?: (~(has by stories) nom) (impact nom dif) (ta-evil (crip "no story {(trip nom)}")) @@ -299,7 +299,7 @@ ++ impact ::< delta for story ::> Store a delta about a story. :: - |= {nom/knot dif/delta-story} + |= {nom/naem dif/delta-story} (ta-delta %story nom dif) :: ++ present ::< send status update @@ -308,19 +308,19 @@ |= {cis/(set circle) dif/diff-status} ^+ ..ta-action =/ cic - ^- (jug ship knot) + ^- (jug ship naem) %- ~(rep in cis) - |= {c/circle m/(jug ship knot)} + |= {c/circle m/(jug ship naem)} (~(put ju m) hos.c nom.c) =. ..ta-action ::TODO =? ?. (~(has by cic) our.bol) ..ta-action %- ~(rep in (~(get ju cic) our.bol)) - |= {n/knot _ta} + |= {n/naem _ta} (affect n %status [our.bol n] our.bol dif) =. cic (~(del by cic) our.bol) %- ta-deltas %- ~(rep by cic) - |= {{h/ship s/(set knot)} l/(list delta)} + |= {{h/ship s/(set naem)} l/(list delta)} :_ l [%present h s dif] :: @@ -329,7 +329,7 @@ ++ action-create ::< create story ::> creates a story with the specified parameters. :: - |= {nom/knot des/cord typ/security} + |= {nom/naem des/cord typ/security} ^+ ..ta-action ?. (~(has in stories) nom) %^ impact nom %new @@ -346,7 +346,7 @@ ::> delete story {nom}, optionally announcing the ::> event with message {mes}. :: - |= {nom/knot mes/(unit cord)} + |= {nom/naem mes/(unit cord)} ^+ ..ta-action =. ..ta-action ::TODO =? ?~ mes ..ta-action @@ -358,20 +358,20 @@ ++ action-depict ::< change description ::> change description of story {nom} to {des}. :: - |= {nom/knot cap/cord} + |= {nom/naem 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. :: - |= {nom/knot fit/filter} + |= {nom/naem fit/filter} (affect nom %config [our.bol nom] %filter fit) :: ++ action-permit ::< invite/banish ::> invite to/banish from story {nom} all {sis}. :: - |= {nom/knot inv/? sis/(set ship)} + |= {nom/naem inv/? sis/(set ship)} =+ soy=(~(get by stories) nom) ?~ soy (ta-evil (crip "no story {(trip nom)}")) @@ -380,7 +380,7 @@ ++ action-source ::< un/sub p to/from r ::> add/remove {pos} as sources for story {nom}. :: - |= {nom/knot sub/? pos/(map circle range)} + |= {nom/naem sub/? pos/(map circle range)} =+ soy=(~(get by stories) nom) ?~ soy (ta-evil (crip "no story {(trip nom)}")) @@ -431,7 +431,7 @@ ::> assigns a new local identity ("nickname") to the ::> target ship. :: - |= {who/ship nic/cord} + |= {who/ship nic/nick} ^+ ..ta-action ?. =((~(get by nicks) who) `nic) ..ta-action ::< no change (ta-delta %nick who nic) @@ -478,7 +478,7 @@ ::> drops {src}'s subscription. deduce the right way ::> to do this from the subscription path {pax}. :: - |= {src/ship nom/knot} + |= {src/ship nom/naem} ^+ +> :: set ship status to %gone. %- (ta-know nom) |= sor/_so =< so-done @@ -487,14 +487,14 @@ ++ ta-greet ::< subscription success ::> store a started subscription as source. :: - |= {nom/knot cir/circle} + |= {nom/naem cir/circle} %- (ta-know nom) |= sor/_so =< so-done (so-greet:sor cir) :: ++ ta-leave ::< subscription failed ::> removes {cir} from story {nom}'s followers. :: - |= {nom/knot cir/circle} + |= {nom/naem cir/circle} %- (ta-know nom) |= sor/_so =< so-done (so-leave:sor cir) :: @@ -510,7 +510,7 @@ :: $burden %+ roll (~(tap by sos.piz)) - |= {{n/knot b/burden} _..ta-take} + |= {{n/naem b/burden} _..ta-take} =< so-done (~(so-bear so n ~ (fall (~(get by stories) n) *story)) b) :: @@ -603,7 +603,7 @@ ++ ta-record ::< add to story ::> add or update telegram {gam} in story {nom}. :: - |= {nom/knot gam/telegram} + |= {nom/naem gam/telegram} %- (ta-know nom) |= sor/_so =< so-done (so-learn:sor gam) :: @@ -627,7 +627,7 @@ ::> acs: talk actions issued due to changes. ::> story is faceless to ease data access. :: - $: nom/knot + $: nom/naem acs/(list action) story == @@ -1102,7 +1102,7 @@ ++ da-present ::< send %present cmd ::> :: - |= {hos/ship nos/(set knot) dif/diff-status} + |= {hos/ship nos/(set naem) dif/diff-status} ^+ +> %- da-emit :* ost.bol @@ -1198,7 +1198,7 @@ ::> apply a %nick delta, setting a nickname for a ::> ship. :: - |= {who/ship nic/cord} + |= {who/ship nic/nick} ^+ +> +>(nicks (change-nicks nicks who nic)) :: @@ -1214,7 +1214,7 @@ ::> in case of a new or deleted story, specialized ::> arms are called. :: - |= {nom/knot dif/delta-story} + |= {nom/naem dif/delta-story} ^+ +> ?+ -.dif =< sa-done @@ -1230,7 +1230,7 @@ ++ da-create ::< configure story ::> creates story {nom} with config {con}. :: - |= {nom/knot cof/config} + |= {nom/naem cof/config} ^+ +> =< sa-done %- ~(sa-change sa nom *story) @@ -1239,7 +1239,7 @@ ++ da-delete ::< delete story ::> calls the story core to delete story {nom}. :: - |= nom/knot + |= nom/naem ^+ +> =. +> %- da-emil @@ -1252,7 +1252,7 @@ |_ ::> nom: story name in {stories}. ::> story is faceless to ease data access. :: - $: nom/knot + $: nom/naem story == :: @@ -1544,7 +1544,7 @@ :: |= $: wir/wire $= fun - $- {nom/knot cir/circle} + $- {nom/naem cir/circle} {(list move) _.} == =+ wer=(etch wir) @@ -1617,10 +1617,10 @@ $burden :+ ~ ~ :- %burden - %- ~(gas in *(map knot burden)) + %- ~(gas in *(map naem burden)) %+ murn (~(tap by stories)) - |= {n/knot s/story} - ^- (unit (pair knot burden)) + |= {n/naem s/story} + ^- (unit (pair naem burden)) :: only auto-federate channels for now. ::REVIEW ?. ?=($black sec.con.shape.s) ~ :+ ~ n @@ -1904,7 +1904,7 @@ |= {wir/wire fal/(unit tang)} ^- (quip move +>) %+ etch-circle [%circle wir] - |= {nom/knot cir/circle} + |= {nom/naem cir/circle} ?~ fal %- pre-bake ta-done:(ta-greet:ta nom cir) @@ -1921,7 +1921,7 @@ |= wir/wire ^- (quip move +>) %+ etch-circle [%circle wir] - |= {nom/knot cir/circle} + |= {nom/naem cir/circle} :_ +>.^$ :_ ~ [0 (circle-peer nom cir `[[%da (sub now.bol ~m5)] ~])] :: @@ -1945,7 +1945,7 @@ ::> stores the telegrams of story {nom} in a log file, ::> to be re-loaded by ++poke-talk-load. :: - |= nom/knot + |= nom/naem ^- (quip move +>) =/ paf/path /(scot %p our.bol)/home/(scot %da now.bol)/talk/[nom]/talk-telegrams @@ -1963,7 +1963,7 @@ ::> loads the telegrams of story {nom} into our state, ::> as saved in ++poke-talk-save. :: - |= nom/knot + |= nom/naem ^- (quip move +>) =/ grams .^ (list telegram) @@ -1981,7 +1981,7 @@ ++ poke-talk-log ::< start logging ::> starts logging story {nom}'s messages. :: - |= nom/knot + |= nom/naem ~& %talk-poke-log ^- (quip move +>) :- [(log-to-file nom) ~] @@ -1994,7 +1994,7 @@ ++ poke-talk-unlog ::< stop logging ::> stops logging story {nom}'s messages. :: - |= nom/knot + |= nom/naem ^- (quip move +>) :- ~ +>.$(log (~(del by log) nom)) @@ -2009,11 +2009,11 @@ :_ %_ . log %- ~(urn by log) - |= {nom/knot len/@ud} + |= {nom/naem len/@ud} count:(~(got by stories) nom) == %+ murn (~(tap by log)) - |= {nom/knot len/@ud} + |= {nom/naem len/@ud} ^- (unit move) ?: (gte len count:(~(got by stories) nom)) ~ @@ -2022,7 +2022,7 @@ ++ log-to-file ::< update story log ::> logs all grams of story {nom} to a file. :: - |= nom/knot + |= nom/naem ^- move =+ ^- paf/path =+ day=(year %*(. (yore now.bol) +.t +:*tarp)) diff --git a/sur/talk.hoon b/sur/talk.hoon index e10c594a0c..25a9705f19 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -3,10 +3,19 @@ !: |% :: -::TODO wrappers around knot for story name, nickname, ::TODO use different words for different kinds of burdens :: ::> || +::> || %wrappers +::> || +::> wrapper molds, for semantic clarity. +::+| +:: +::TODO term & rename +++ naem knot ::< circle name +++ nick cord ::< local nickname +:: +::> || ::> || %query-models ::> || ::> models relating to queries, their results and updates. @@ -16,7 +25,7 @@ $% {$reader $~} ::< shared ui state {$burden who/ship} ::< duties to share {$report $~} ::< duty reports - {$circle nom/knot ran/range} ::< story query + {$circle nom/naem ran/range} ::< story query ::TODO separate stream for just msgs? what about just configs? presences? :: yes! == :: @@ -32,18 +41,18 @@ ++ prize ::> query result $% {$reader prize-reader} ::< /reader {$friend cis/(set circle)} ::< /friend - {$burden sos/(map knot burden)} ::< /burden + {$burden sos/(map naem burden)} ::< /burden ::TODO do we ever use remote things from remote circles? {$circle burden} ::< /circle == :: ++ prize-reader :: $: gys/(jug char (set circle)) ::< glyph bindings - nis/(map ship cord) ::< nicknames + nis/(map ship nick) ::< local nicknames == :: ++ rumor ::< query result change $% {$reader dif/rumor-reader} ::< /reader {$friend add/? cir/circle} ::< /friend - {$burden nom/knot dif/diff-story} ::< /burden + {$burden nom/naem dif/diff-story} ::< /burden {$circle dif/diff-story} ::< /circle == :: ++ rumor-reader ::< changed ui state @@ -63,15 +72,15 @@ {$glyph diff-glyph} ::< un/bound glyph {$nick diff-nick} ::< changed nickname :: story state :: - {$story nom/knot dif/delta-story} ::< change to story + {$story nom/naem dif/delta-story} ::< change to story :: side-effects :: {$init $~} ::< initialize {$observe who/ship} ::< watch burden bearer - {$present hos/ship nos/(set knot) dif/diff-status}::< send %present cmd + {$present hos/ship nos/(set naem) dif/diff-status}::< send %present cmd {$quit ost/bone} ::< force unsubscribe == :: ++ diff-glyph {bin/? gyf/char pas/(set circle)} ::< un/bound glyph -++ diff-nick {who/ship nic/cord} ::< changed nickname +++ diff-nick {who/ship nic/nick} ::< changed nickname ++ delta-story ::< story delta $? diff-story ::< both in & outward $% {$inherited ihr/?} ::< inherited flag @@ -115,12 +124,12 @@ :: ++ action ::> user action $% :: circle configuration :: - {$create nom/knot des/cord sec/security} ::< create circle - {$delete nom/knot why/(unit cord)} ::< delete + announce - {$depict nom/knot des/cord} ::< change description - {$filter nom/knot fit/filter} ::< change message rules - {$permit nom/knot inv/? sis/(set ship)} ::< invite/banish - {$source nom/knot sub/? src/(map circle range)} ::< un/sub to/from src + {$create nom/naem des/cord sec/security} ::< create circle + {$delete nom/naem why/(unit cord)} ::< delete + announce + {$depict nom/naem des/cord} ::< change description + {$filter nom/naem fit/filter} ::< change message rules + {$permit nom/naem inv/? sis/(set ship)} ::< invite/banish + {$source nom/naem sub/? src/(map circle range)} ::< un/sub to/from src :: messaging :: {$convey tos/(list thought)} ::< post exact {$phrase aud/(set circle) ses/(list speech)} ::< post easy @@ -129,7 +138,7 @@ {$naming cis/(set circle) man/human} ::< our name update :: changing shared ui :: {$glyph gyf/char pas/(set circle) bin/?} ::< un/bind a glyph - {$nick who/ship nic/knot} ::< new identity + {$nick who/ship nic/nick} ::< new identity == :: :: ::> || @@ -140,7 +149,7 @@ :: ++ command ::> effect on story $% {$publish tos/(list thought)} ::< deliver - {$present nos/(set knot) dif/diff-status} ::< status update + {$present nos/(set naem) dif/diff-status} ::< status update {$bearing $~} ::< prompt to listen == :: :: @@ -150,10 +159,7 @@ ::> messaging targets and their metadata. ::+| :: -++ circle {hos/ship nom/knot} ::< native target -++ passport ::> foreign target - $% {$twitter p/cord} ::< twitter handle - == :: +++ circle {hos/ship nom/naem} ::< native target :: circle configurations. :: ++ lobby {loc/config rem/(map circle config)} ::< our & srcs configs ++ config ::> circle config From 830200265c72db58a77efdca03292eb06a6a086c Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 11 Jul 2017 15:30:00 -0700 Subject: [PATCH 156/303] Circle names are now terms instead of knots. --- app/talk-guardian.hoon | 6 +++--- sur/talk.hoon | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 031ffce797..de42140cfc 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -200,7 +200,7 @@ => %+ roll ^- (list {security naem cord}) :~ [%brown (main our.bol) 'default home'] - [%green ~.public 'visible activity'] + [%green %public 'visible activity'] == |= {{typ/security nom/naem des/cord} _ta} %+ ta-action ost.bol @@ -1774,9 +1774,9 @@ [%reader ul] [%burden (at /[%p])] [%report ul] - [%circle (al knot rang)] + [%circle (al term rang)] == - ++ knot (do %tas) + ++ term (do %tas) ++ rang (mu (al plac (mu (un plac)))) ++ plac (or %da %ud) -- diff --git a/sur/talk.hoon b/sur/talk.hoon index 25a9705f19..3096525c5f 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -11,8 +11,8 @@ ::> wrapper molds, for semantic clarity. ::+| :: -::TODO term & rename -++ naem knot ::< circle name +::TODO rename +++ naem term ::< circle name ++ nick cord ::< local nickname :: ::> || From 8c2afd57d6270d42b6c71afb74078b4574161b26 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 11 Jul 2017 15:50:39 -0700 Subject: [PATCH 157/303] Applied new wrapper types to talk-agent. --- app/talk-agent.hoon | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index c9fd1a62be..f518a60ea7 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -42,7 +42,7 @@ remotes/(map circle group) ::< remote presences mirrors/(map circle config) ::< remote configs :: ui state :: - nicks/(map ship cord) ::< human identities + nicks/(map ship nick) ::< human identities nik/(map (set circle) char) ::< bound circle glyphs nak/(jug char (set circle)) ::< circle glyph lookup cli/shell ::< interaction state @@ -52,7 +52,7 @@ latest/@ud ::< latest shown msg num say/sole-share ::< console state active/(set circle) ::< active targets - settings/(set knot) ::< frontend settings + settings/(set knot) ::TODO term ::< frontend settings == :: ++ move (pair bone card) ::< all actions ++ lime ::> diff fruit @@ -71,13 +71,13 @@ $% :: circle management :: {$join p/(map circle range)} ::< subscribe to {$leave p/where} ::< unsubscribe from - {$create p/security q/knot r/cord} ::< create circle - {$delete p/knot q/(unit cord)} ::< delete circle - {$depict p/knot q/cord} ::< change description - {$filter p/knot q/? r/?} ::< change message rules - {$invite p/knot q/(set ship)} ::< give permission - {$banish p/knot q/(set ship)} ::< deny permission - {$source p/knot q/(map circle range)} ::< add source + {$create p/security q/naem r/cord} ::< create circle + {$delete p/naem q/(unit cord)} ::< delete circle + {$depict p/naem q/cord} ::< change description + {$filter p/naem q/? r/?} ::< change message rules + {$invite p/naem q/(set ship)} ::< give permission + {$banish p/naem q/(set ship)} ::< deny permission + {$source p/naem q/(map circle range)} ::< add source :: personal metadata {$attend p/(set circle) q/presence} ::< set our presence {$name p/(set circle) q/human} ::< set our name @@ -133,7 +133,7 @@ ++ inbox ::< reader's circle name ::> produces the name of the circle used by this ::> reader for all its operations - ^- knot + ^- naem (main our.bol) :: ++ incir ::< reader's circle @@ -900,10 +900,10 @@ ++ reverse-nicks ::< find by handle ::> finds all ships whose handle matches {nym}. :: - |= nym/knot + |= nym/^nick ^- (list ship) %+ murn (~(tap by nicks)) - |= {p/ship q/knot} + |= {p/ship q/^nick} ?. =(q nym) ~ [~ u=p] :: @@ -950,7 +950,7 @@ ++ create ::< %create ::> creates circle {nom} with specified config. :: - |= {sec/security nom/knot txt/cord} + |= {sec/security nom/naem txt/cord} ^+ ..sh-work =. ..sh-work (sh-act %create nom txt sec) @@ -960,40 +960,40 @@ ::> deletes our circle {nom}, after optionally ::> sending a last announce message {say}. :: - |= {nom/knot say/(unit cord)} + |= {nom/naem say/(unit cord)} ^+ ..sh-work (sh-act %delete nom say) :: ++ depict ::< %depict ::> changes the description of {nom} to {txt}. :: - |= {nom/knot txt/cord} + |= {nom/naem txt/cord} ^+ ..sh-work (sh-act %depict nom txt) :: ++ invite ::< %invite ::> invites {sis} to our circle {nom}. :: - |= {nom/knot sis/(set ship)} + |= {nom/naem sis/(set ship)} ^+ ..sh-work (sh-act %permit nom & sis) :: ++ filter - |= {nom/knot cus/? utf/?} + |= {nom/naem cus/? utf/?} ^+ ..sh-work (sh-act %filter nom cus utf) :: ++ banish ::< %banish ::> banish {sis} from our circle {nom}. :: - |= {nom/knot sis/(set ship)} + |= {nom/naem sis/(set ship)} ^+ ..sh-work (sh-act %permit nom | sis) :: ++ source ::< %source ::> adds {pas} to {nom}'s src. :: - |= {nom/knot pos/(map circle range)} + |= {nom/naem pos/(map circle range)} ^+ ..sh-work (sh-act %source nom & pos) :: @@ -1134,13 +1134,13 @@ ::> either shows, sets or unsets nicknames ::> depending on arguments. :: - |= {her/(unit ship) nym/(unit cord)} + |= {her/(unit ship) nym/(unit ^nick)} ^+ ..sh-work ::> no arguments, show all ?: ?=({$~ $~} +<) %+ sh-fact %mor %+ turn (~(tap by nicks)) - |= {p/ship q/knot} + |= {p/ship q/^nick} :- %txt "{

}: {}" ::> show her nick From 4860d51405379d8b67c24808efe234df02f66dcb Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 12 Jul 2017 15:32:07 -0700 Subject: [PATCH 158/303] No longer uses incorrect message index when changing messages. --- app/talk-guardian.hoon | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index de42140cfc..c47d7f718c 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -1371,11 +1371,10 @@ known (~(put by known) uid.gam count) == :: changed message - =+ dex=(sub count u.old) %_ +>.$ grams %+ welp - (scag (dec dex) grams) - [gam (slag dex grams)] + (scag (dec u.old) grams) + [gam (slag u.old grams)] == :: ++ sa-change-remote ::< apply remote's delta From 4022ecd70eda97c4830efbbe07470d53d933172d Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 17 Jul 2017 14:30:52 -0700 Subject: [PATCH 159/303] Agent now uses terms instead of knots for settings. --- app/talk-agent.hoon | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index f518a60ea7..e4363e0647 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -52,7 +52,7 @@ latest/@ud ::< latest shown msg num say/sole-share ::< console state active/(set circle) ::< active targets - settings/(set knot) ::TODO term ::< frontend settings + settings/(set term) ::< frontend settings == :: ++ move (pair bone card) ::< all actions ++ lime ::> diff fruit @@ -93,8 +93,8 @@ {$bind p/char q/(unit where)} ::< bind glyph {$unbind p/char q/(unit where)} ::< unbind glyph {$nick p/(unit ship) q/(unit cord)} ::< un/set/show nick - {$set p/knot} ::< enable setting - {$unset p/knot} ::< disable setting + {$set p/term} ::< enable setting + {$unset p/term} ::< disable setting :: miscellaneous :: {$help $~} ::< print usage info == :: @@ -1169,12 +1169,12 @@ ++ wo-set ::< %set ::> enables ui setting flag. :: - |= seg/knot + |= seg/term ^+ ..sh-work ?~ seg %+ sh-fact %mor %+ turn (~(tap in settings.she)) - |= s/knot + |= s/term [%txt (trip s)] %= ..sh-work settings.she (~(put in settings.she) seg) @@ -1183,7 +1183,7 @@ ++ unset ::< %unset ::> disables ui setting flag. :: - |= neg/knot + |= neg/term ^+ ..sh-work %= ..sh-work settings.she (~(del in settings.she) neg) @@ -1804,7 +1804,7 @@ ::> bou: complete aroma. ::> sep: message contents. :: - sef/(set knot) + sef/(set term) who/ship sen/serial aud/audience From 4664756dac89df1b3fdd3e3501b3bc7b9250287d Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 17 Jul 2017 14:41:57 -0700 Subject: [PATCH 160/303] Comments now properly refer to status instead of presence. --- app/talk-guardian.hoon | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index c47d7f718c..cc1dbb32b4 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -54,8 +54,8 @@ ++ story ::> wire content $: count/@ud ::< (lent grams) grams/(list telegram) ::< all messages - locals/group ::< local presence - remotes/(map circle group) ::< remote presence + locals/group ::< local status + remotes/(map circle group) ::< remote status shape/config ::< configuration mirrors/(map circle config) ::< remote config ::TODO? never gets updated. still needed? :: @@ -459,7 +459,7 @@ (ta-delta %observe who) :: ++ ta-subscribe ::< listen to - ::> add her to a presence list if applicable. + ::> add her to a status list if applicable. :: |= {her/ship qer/query} ^+ +> @@ -767,12 +767,12 @@ %+ roll (~(tap by rem.cos)) |= {{r/circle c/config} _self} (so-delta-our %config r %full c) - :: local presence + :: local status =. self %+ roll (~(tap by loc.pes)) |= {{w/ship s/status} _self} (so-delta-our %status so-cir w %full s) - :: remote presence + :: remote status =. self %+ roll (~(tap by rem.pes)) |= {{c/circle g/group} _self} @@ -861,16 +861,16 @@ :: (so-delta-our %remove ~) :: - ++ so-attend ::< add local presence - ::> add {her} status to this story's presence map. + ++ so-attend ::< add local status + ::> add {her} status to this story's status map. :: |= {her/ship sat/status} ^+ +> ?: =(`sat (~(get by locals) her)) +>.$ (so-delta-our %status so-cir her %full sat) :: - ++ so-absent ::< del local presence - ::> remove {her} from our presence map. + ++ so-absent ::< del local status + ::> remove {her} from our status map. :: |= her/ship ^+ +> @@ -1730,7 +1730,7 @@ :: ::TODO? %quit bones that are done with their subscription. :: ...but that would also require a ta-cancel call to remove - :: them from the presence list! how do? + :: them from the status list! how do? :: should there be an ++away arm for gall to call? |= dif/delta ^- (list move) From 63609a4994b0aaa64acaae41f3eebcc1cb8c06e8 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 18 Jul 2017 17:08:08 -0700 Subject: [PATCH 161/303] Now allow capitals & utf8 by default. --- app/talk-guardian.hoon | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index cc1dbb32b4..86c59c9def 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -206,10 +206,6 @@ %+ ta-action ost.bol [%create nom des typ] %- ta-deltas - :: change inbox filter to allow everything. - :- :+ %story (main our.bol) - :+ %config [our.bol (main our.bol)] - [%filter [& &]] :: if needed, subscribe to our parent's /burden. =+ sen=(above our.bol) ?: ?| !=(%czar (clan sen)) @@ -335,7 +331,7 @@ %^ impact nom %new :* [[our.bol nom] ~ ~] des - [| |] + *filter :- typ ?. ?=(?($white $green) typ) ~ [our.bol ~ ~] From 16e96a3c75ffcb532d00c1bbdf6721b000c7805f Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 18 Jul 2017 17:22:45 -0700 Subject: [PATCH 162/303] Updated TODO & REVIEW comments. --- app/talk-guardian.hoon | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 86c59c9def..77769460d8 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -12,24 +12,13 @@ ::TODO document gate samples fully. ::TODO ::> to :> etc. :: -::TODO we can't do away with the default mailbox because we need it for things -:: like invite notifications etc. can we do better than request that apps -:: don't use it frivolously? -:: ::TODO crash on pokes/peers we do not expect :: -::TODO federation should not be present at all in delta-application cores. the -:: way changes are to be applied should be figured out by the delta- -:: geenration cores entirely. -:: ::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. :: -::TODO we need to have something for upward changes on burdens as well. we -:: could use entirely new query for this. to do so, we'd need to add -:: a new code path in front of changes that checks if it's not a config -:: change, and then redirects it to existing arms. +::TODO/REVIEW rename porch/floor/court to inbox? :: /? 151 ::< hoon version /- talk ::< structures @@ -58,7 +47,7 @@ remotes/(map circle group) ::< remote status shape/config ::< configuration mirrors/(map circle config) ::< remote config - ::TODO? never gets updated. still needed? :: + ::TODO update & use. sequence/(map circle @ud) ::< circles heard known/(map serial @ud) ::< messages heard inherited/?($| $&) ::< from parent? @@ -931,6 +920,8 @@ ::> 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. :: |= ran/range ^- {in/? done/?} @@ -1358,6 +1349,8 @@ :: |= 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 @@ -1596,7 +1589,7 @@ |= dis/(list delta) ^- (quip move +>) %+ roll dis - |= {d/delta m/(list move) _+>.$} ::REVIEW ^$ find-fails, how is this correct? + |= {d/delta m/(list move) _+>.$} =^ mos +>.^$ (bake d) [(welp m mos) +>.^$] :: @@ -1616,7 +1609,7 @@ %+ murn (~(tap by stories)) |= {n/naem s/story} ^- (unit (pair naem burden)) - :: only auto-federate channels for now. ::REVIEW + :: only auto-federate channels for now. ?. ?=($black sec.con.shape.s) ~ :+ ~ n :+ grams.s @@ -1912,7 +1905,6 @@ ::> gall dropped our subscription. resubscribe. :: ::TODO update for all subscription kinds. - ::TODO? does new gall still drop subscriptions? |= wir/wire ^- (quip move +>) %+ etch-circle [%circle wir] From bf5d81e00b37ed882dba04da4538fd731b389a75 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 19 Jul 2017 15:32:07 -0700 Subject: [PATCH 163/303] Now sending message nrs along with message rumors themselves. Separated full story state (++burden) from potentially partial story state (++package). --- app/talk-agent.hoon | 6 +-- app/talk-guardian.hoon | 103 ++++++++++++++++++++++++++++------------- sur/talk.hoon | 25 +++++++--- 3 files changed, 91 insertions(+), 43 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index e4363e0647..3df6c5911a 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -261,7 +261,7 @@ == :: $circle - %. gaz.piz + %. gaz.nev.piz %= ta-lesson sources src.loc.cos.piz mirrors (~(put by rem.cos.piz) incir loc.cos.piz) @@ -293,13 +293,13 @@ ++ ta-change-circle ::< apply circle change ::> :: - |= dif/diff-story + |= dif/rumor-story ^+ +> ?+ -.dif ~&([%unexpected-circle-rumor -.dif] +>) :: $grams - (ta-lesson gaz.dif) + (ta-lesson gaz.nev.dif) :: $config %= +> diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 77769460d8..de4c323b13 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -48,7 +48,7 @@ shape/config ::< configuration mirrors/(map circle config) ::< remote config ::TODO update & use. - sequence/(map circle @ud) ::< circles heard + sequence/(map circle @ud) ::< last-heard p circle known/(map serial @ud) ::< messages heard inherited/?($| $&) ::< from parent? == :: @@ -691,7 +691,7 @@ ++ so-take ::< accept circle prize ::> apply the prize as if it were rumors. :: - |= {src/circle gaz/(list telegram) cos/lobby pes/crowd} + |= {src/circle nev/envelope cos/lobby pes/crowd} ^+ +> =. +>.$ (so-hear | src %config src %full loc.cos) @@ -699,12 +699,12 @@ %- ~(rep in loc.pes) |= {{w/ship s/status} _+>.$} (so-hear | src %status src w %full s) - (so-lesson gaz) + (so-unpack src nev) :: ++ so-hear ::< accept circle rumor ::> apply changes from a rumor to this story. :: - |= {bur/? src/circle dif/diff-story} + |= {bur/? src/circle dif/rumor-story} ^+ +> :: check that we're still subscribed to this story :: this is a small %gall bug, we shouldn't get these @@ -717,7 +717,7 @@ (so-config-full ~ cof.dif) $(dif [%config src %full cof.dif]) $bear ~&(%so-bear (so-bear bur.dif)) - $grams (so-lesson gaz.dif) + $grams (so-unpack src nev.dif) $config :: full changes to us need to get split up. ?: &(=(cir.dif so-cir) ?=($full -.dif.dif)) (so-config-full `shape cof.dif.dif) @@ -974,6 +974,17 @@ a == :: + ++ so-unpack ::< process envelope + ::> learn telegrams from envelope and update the + ::> sequence of the source. + :: + |= {src/circle nev/envelope} + ^+ +> + ?~ gaz.nev +> + =. +> (so-lesson gaz.nev) + %^ so-delta-our %sequent src + (add num.nev (dec (lent gaz.nev))) + :: ++ so-lesson ::< learn messages ::> learn all telegrams in a list. :: @@ -1317,6 +1328,13 @@ :: $inherited +>(inherited ihr.dif) + :: + $follow + (sa-emil (sa-follow-effects sub.dif cos.dif)) + :: + $sequent + +>(sequence (~(put by sequence) cir.dif num.dif)) + :: :: $grams |- ^+ +>.^$ @@ -1338,9 +1356,6 @@ (fall (~(get by locals) who.dif) *status) dif.dif == - :: - $follow - (sa-emil (sa-follow-effects sub.dif cos.dif)) == :: ++ sa-change-gram ::< save/update message @@ -1628,35 +1643,39 @@ ?~ soy ~ :+ ~ ~ :- %circle - :+ (~(so-first-grams so:ta nom.qer ~ u.soy) ran.qer) + :+ %+ grams-to-envelope nom.qer + (~(so-first-grams so:ta nom.qer ~ u.soy) ran.qer) [shape.u.soy mirrors.u.soy] [locals.u.soy remotes.u.soy] == :: -++ dedicate ::< diff-story to theirs +++ dedicate ::< rumor-story to theirs ::> modify a %story diff to make it about their ship ::> instead of ours. :: - |= {who/ship dif/diff-story} - ^- diff-story - ?+ -.dif - dif + |= {who/ship nom/naem dif/delta-story} + ^- rumor-story + ?+ -.dif dif + :: + ::TODO ... + $follow !! + $inherited !! + $sequent !! :: $grams - %= dif - gaz - %+ turn gaz.dif - |= gam/telegram - =. aud.gam - %- ~(run in aud.gam) - |= c/circle - ::TODO it probably isn't safe to do this for - :: all audience members hosted by us, even - :: if this is only called for burdens. - ?. =(hos.c our.bol) c - [who nom.c] - gam - == + :- %grams + %+ grams-to-envelope nom + %+ turn gaz.dif + |= gam/telegram + =. aud.gam + %- ~(run in aud.gam) + |= c/circle + ::TODO it probably isn't safe to do this for + :: all audience members hosted by us, even + :: if this is only called for burdens. + ?. =(hos.c our.bol) c + [who nom.c] + gam :: $config ?. =(hos.cir.dif our.bol) dif @@ -1667,6 +1686,18 @@ dif(cir [who nom.cir.dif]) == :: +++ grams-to-envelope ::< wrap grams with nr + ::> deduce the initial msg number from a list of + ::> telegrams for a given story. + :: + |= {nom/naem gaz/(list telegram)} + ^- envelope + ?: =((lent gaz) 0) [0 ~] ::TODO? ?~ nest-fails: + ~? (gth (lent gaz) 1) %multi-msg + :_ gaz + %. uid:(snag 0 gaz) + ~(got by known:(~(got by stories) nom)) +:: ++ feel ::< delta to rumor ::> if the given delta changes the result of the given ::> query, produce the relevant rumor. @@ -1684,10 +1715,10 @@ $burden ::?: &(=(who.qer src.bol) did-they-send-a-burden) ~ ?. ?=($story -.dif) ~ - ?: ?=(?($follow $inherited) -.dif.dif) ~ ::REVIEW ?= diff-story fishloop + ?: ?=(?($follow $inherited $sequent) -.dif.dif) ~ :: only burden channels for now. ?. =(%black sec.con.shape:(~(got by stories) nom.dif)) ~ - `[%burden nom.dif (dedicate who.qer dif.dif)] + `[%burden nom.dif (dedicate who.qer nom.dif dif.dif)] :: $report :: only send changes we didn't get from above. @@ -1700,7 +1731,7 @@ ?. inherited.soy ~ :: only burden channels for now. ?. =(%black sec.con.shape.soy) ~ - `[%burden nom.dif (dedicate (above our.bol) dif.dif)] + `[%burden nom.dif (dedicate (above our.bol) nom.dif dif.dif)] :: $circle ?. ?=($story -.dif) ~ @@ -1709,8 +1740,14 @@ =+ ren=(~(so-in-range so:ta nom.qer ~ (~(got by stories) nom.qer)) ran.qer) ::TODO if done.ren, %quit bone ?. in.ren ~ - ?: ?=(?($follow $inherited) -.dif.dif) ~ ::REVIEW ^ - `[%circle dif.dif] + ::TODO move up? we also check for $follow above, why? + ?: ?=(?($follow $inherited $sequent) -.dif.dif) ~ + =/ rdif/rumor-story + ?+ -.dif.dif dif.dif + $grams + [%grams (grams-to-envelope nom.dif gaz.dif.dif)] + == + `[%circle rdif] == :: ++ affection ::< rumors to interested diff --git a/sur/talk.hoon b/sur/talk.hoon index 3096525c5f..62b2eafe3a 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -43,7 +43,7 @@ {$friend cis/(set circle)} ::< /friend {$burden sos/(map naem burden)} ::< /burden ::TODO do we ever use remote things from remote circles? - {$circle burden} ::< /circle + {$circle package} ::< /circle == :: ++ prize-reader :: $: gys/(jug char (set circle)) ::< glyph bindings @@ -52,8 +52,8 @@ ++ rumor ::< query result change $% {$reader dif/rumor-reader} ::< /reader {$friend add/? cir/circle} ::< /friend - {$burden nom/naem dif/diff-story} ::< /burden - {$circle dif/diff-story} ::< /circle + {$burden nom/naem dif/rumor-story} ::< /burden + {$circle dif/rumor-story} ::< /circle == :: ++ rumor-reader ::< changed ui state $% {$glyph diff-glyph} ::< un/bound glyph @@ -64,10 +64,15 @@ cos/lobby ::< loc & rem configs pes/crowd ::< loc & rem presences == :: +++ package ::< story state + $: nev/envelope ::< messages + cos/lobby ::< loc & rem configs + pes/crowd ::< loc & rem presences + == :: ::TODO deltas into app ++ delta :: $% :: messaging state :: - {$out cir/circle out/(list thought)} ::< msgs into outbox + {$out cir/circle out/(list thought)} ::< send msgs to circle :: shared ui state :: {$glyph diff-glyph} ::< un/bound glyph {$nick diff-nick} ::< changed nickname @@ -81,19 +86,24 @@ == :: ++ diff-glyph {bin/? gyf/char pas/(set circle)} ::< un/bound glyph ++ diff-nick {who/ship nic/nick} ::< changed nickname -++ delta-story ::< story delta +++ delta-story ::> story delta $? diff-story ::< both in & outward $% {$inherited ihr/?} ::< inherited flag {$follow sub/? cos/(map circle range)} ::< un/subscribe + {$sequent cir/circle num/@ud} ::< update last-heard + {$grams gaz/(list telegram)} ::< new/changed msgs == == :: -++ diff-story ::< story rumor +++ diff-story ::> story change $% {$new cof/config} ::< new story {$bear bur/burden} ::< new inherited story - {$grams gaz/(list telegram)} ::< new/changed msgs {$config cir/circle dif/diff-config} ::< new/changed config {$status cir/circle who/ship dif/diff-status} ::< new/changed status {$remove $~} ::< removed story == :: +++ rumor-story ::> story rumor + $? diff-story ::< both in & outward + $% {$grams nev/envelope} ::< new/changed msgs + == == :: ++ diff-config ::> config change ::TODO maybe just full? think. $% {$full cof/config} ::< set w/o side-effects @@ -203,6 +213,7 @@ ::> structures for containing main message data. ::+| :: +++ envelope {num/@ud gaz/(list telegram)} ::< outward messages ++ telegram {aut/ship thought} ::< whose message ++ thought ::> inner message $: uid/serial ::< unique identifier From f19891d48879954ec28446027ec8a0555287b532 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 20 Jul 2017 16:57:53 -0700 Subject: [PATCH 164/303] Message diffs are now always about a single message, rather than being "maybe multiple messages but practically always just one". --- app/talk-agent.hoon | 15 +++++-- app/talk-guardian.hoon | 99 ++++++++++++++++++++++++++---------------- sur/talk.hoon | 8 ++-- 3 files changed, 76 insertions(+), 46 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 3df6c5911a..967b8f8343 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -261,8 +261,8 @@ == :: $circle - %. gaz.nev.piz - %= ta-lesson + %. nes.piz + %= ta-unpack sources src.loc.cos.piz mirrors (~(put by rem.cos.piz) incir loc.cos.piz) remotes (~(put by rem.pes.piz) incir loc.pes.piz) @@ -298,8 +298,8 @@ ?+ -.dif ~&([%unexpected-circle-rumor -.dif] +>) :: - $grams - (ta-lesson gaz.nev.dif) + $gram + (ta-learn gam.nev.dif) :: $config %= +> @@ -351,6 +351,13 @@ ::> storing and updating messages. ::+| :: + ++ ta-unpack ::< open envelopes + ::> the reader currently doesn't care about nums. + :: + |= nes/(list envelope) + ^+ +> + (ta-lesson (turn nes tail)) + :: ++ ta-lesson ::< learn messages ::> learn all telegrams in a list. :: diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index de4c323b13..20c5aab71b 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -674,6 +674,16 @@ ^+ +> (so-delta %story nom dif) :: + ++ so-deltas-our ::< send deltas of us + ::> adds multiple deltas about this story. + :: + |= dis/(list delta-story) + ^+ +> + %- so-deltas + %+ turn dis + |= d/delta-story + [%story nom d] + :: ::> || ::> || %data ::> || @@ -691,7 +701,7 @@ ++ so-take ::< accept circle prize ::> apply the prize as if it were rumors. :: - |= {src/circle nev/envelope cos/lobby pes/crowd} + |= {src/circle nes/(list envelope) cos/lobby pes/crowd} ^+ +> =. +>.$ (so-hear | src %config src %full loc.cos) @@ -699,7 +709,7 @@ %- ~(rep in loc.pes) |= {{w/ship s/status} _+>.$} (so-hear | src %status src w %full s) - (so-unpack src nev) + (so-unpack src nes) :: ++ so-hear ::< accept circle rumor ::> apply changes from a rumor to this story. @@ -717,7 +727,7 @@ (so-config-full ~ cof.dif) $(dif [%config src %full cof.dif]) $bear ~&(%so-bear (so-bear bur.dif)) - $grams (so-unpack src nev.dif) + $gram (so-open src nev.dif) $config :: full changes to us need to get split up. ?: &(=(cir.dif so-cir) ?=($full -.dif.dif)) (so-config-full `shape cof.dif.dif) @@ -766,9 +776,11 @@ (so-delta-our %status c w %full s) :: telegrams =. self - %+ so-delta-our %grams + %- so-deltas-our %+ turn gaz |= t/telegram + ^- delta-story + :- %gram :: in audience, replace above with us. =- t(aud -) =+ (~(del in aud.t) [(above our.bol) nom]) @@ -974,16 +986,31 @@ a == :: - ++ so-unpack ::< process envelope - ::> learn telegrams from envelope and update the - ::> sequence of the source. + ++ so-unpack ::< process envelopes + ::> learn telegrams from list of envelopes and + ::> update the sequence of the source if needed. + :: + |= {src/circle nes/(list envelope)} + ^+ +> + =. +> (so-lesson (turn nes tail)) + =/ num + %+ roll nes + |= {nev/envelope max/@ud} + ?:((gth num.nev max) num.nev max) + ?. (gth num (fall (~(get 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. :: |= {src/circle nev/envelope} ^+ +> - ?~ gaz.nev +> - =. +> (so-lesson gaz.nev) - %^ so-delta-our %sequent src - (add num.nev (dec (lent gaz.nev))) + =. +> (so-learn gam.nev) + ?. (gth num.nev (fall (~(get by sequence) src) 0)) + +> + (so-delta-our %sequent src num.nev) :: ++ so-lesson ::< learn messages ::> learn all telegrams in a list. @@ -1003,7 +1030,7 @@ ?. (so-admire aut.gam) +> :: clean up the message to conform to our rules. =. sep.gam (so-sane sep.gam) - (so-delta-our %grams [gam ~]) + (so-delta-our %gram gam) :: ::> || ::> || %permissions @@ -1336,11 +1363,8 @@ +>(sequence (~(put by sequence) cir.dif num.dif)) :: :: - $grams - |- ^+ +>.^$ - ?~ gaz.dif +>.^$ - =. +>.^$ (sa-change-gram i.gaz.dif) - $(gaz.dif t.gaz.dif) + $gram + (sa-change-gram gam.dif) :: $config =. +> @@ -1359,7 +1383,7 @@ == :: ++ sa-change-gram ::< save/update message - ::> apply a %grams delta, either appending or + ::> apply a %gram delta, either appending or ::> updating a message. :: |= gam/telegram @@ -1643,8 +1667,9 @@ ?~ soy ~ :+ ~ ~ :- %circle - :+ %+ grams-to-envelope nom.qer - (~(so-first-grams so:ta nom.qer ~ u.soy) ran.qer) + :+ %+ turn + (~(so-first-grams so:ta nom.qer ~ u.soy) ran.qer) + (cury gram-to-envelope nom.qer) [shape.u.soy mirrors.u.soy] [locals.u.soy remotes.u.soy] == @@ -1662,20 +1687,19 @@ $inherited !! $sequent !! :: - $grams - :- %grams - %+ grams-to-envelope nom - %+ turn gaz.dif - |= gam/telegram - =. aud.gam - %- ~(run in aud.gam) + $gram + :- %gram + %+ gram-to-envelope nom + %_ gam.dif + aud + %- ~(run in aud.gam.dif) |= c/circle ::TODO it probably isn't safe to do this for :: all audience members hosted by us, even :: if this is only called for burdens. ?. =(hos.c our.bol) c [who nom.c] - gam + == :: $config ?. =(hos.cir.dif our.bol) dif @@ -1686,16 +1710,15 @@ dif(cir [who nom.cir.dif]) == :: -++ grams-to-envelope ::< wrap grams with nr - ::> deduce the initial msg number from a list of - ::> telegrams for a given story. +++ 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. :: - |= {nom/naem gaz/(list telegram)} + |= {nom/naem gam/telegram} ^- envelope - ?: =((lent gaz) 0) [0 ~] ::TODO? ?~ nest-fails: - ~? (gth (lent gaz) 1) %multi-msg - :_ gaz - %. uid:(snag 0 gaz) + :_ gam + %. uid.gam ~(got by known:(~(got by stories) nom)) :: ++ feel ::< delta to rumor @@ -1744,8 +1767,8 @@ ?: ?=(?($follow $inherited $sequent) -.dif.dif) ~ =/ rdif/rumor-story ?+ -.dif.dif dif.dif - $grams - [%grams (grams-to-envelope nom.dif gaz.dif.dif)] + $gram + [%gram (gram-to-envelope nom.dif gam.dif.dif)] == `[%circle rdif] == diff --git a/sur/talk.hoon b/sur/talk.hoon index 62b2eafe3a..bd05c7ec42 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -65,7 +65,7 @@ pes/crowd ::< loc & rem presences == :: ++ package ::< story state - $: nev/envelope ::< messages + $: nes/(list envelope) ::< messages cos/lobby ::< loc & rem configs pes/crowd ::< loc & rem presences == :: @@ -91,7 +91,7 @@ $% {$inherited ihr/?} ::< inherited flag {$follow sub/? cos/(map circle range)} ::< un/subscribe {$sequent cir/circle num/@ud} ::< update last-heard - {$grams gaz/(list telegram)} ::< new/changed msgs + {$gram gam/telegram} ::< new/changed msgs == == :: ++ diff-story ::> story change $% {$new cof/config} ::< new story @@ -102,7 +102,7 @@ == :: ++ rumor-story ::> story rumor $? diff-story ::< both in & outward - $% {$grams nev/envelope} ::< new/changed msgs + $% {$gram nev/envelope} ::< new/changed msgs == == :: ++ diff-config ::> config change ::TODO maybe just full? think. @@ -213,7 +213,7 @@ ::> structures for containing main message data. ::+| :: -++ envelope {num/@ud gaz/(list telegram)} ::< outward messages +++ envelope {num/@ud gam/telegram} ::< outward message ++ telegram {aut/ship thought} ::< whose message ++ thought ::> inner message $: uid/serial ::< unique identifier From fe08209ff61f0337f4cbb6c7445095c97d3a3d20 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 21 Jul 2017 15:16:41 -0700 Subject: [PATCH 165/303] Agent now properly counts unicode characters as a single character. --- app/talk-agent.hoon | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 967b8f8343..887fb2538e 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -1862,7 +1862,7 @@ "." (t s.t.dat) == %+ weld - (reap (sub +(wyd) (min wyd (lent i.txs))) ' ') + (reap (sub +(wyd) (min wyd (lent (tuba i.txs)))) ' ') time %- flop %+ roll `(list tape)`txs @@ -1994,16 +1994,16 @@ (~(del in aud) [%& who (main who)]) == =. wyd (sub wyd (lent pef)) - =+ txt=(trip msg.sep) + =/ txt (tuba (trip msg.sep)) |- ^- (list tape) ?~ txt ~ =/ end ?: (lte (lent txt) wyd) (lent txt) - =+ ace=(find " " (flop (scag +(wyd) `tape`txt))) + =+ ace=(find " " (flop (scag +(wyd) `(list @c)`txt))) ?~ ace wyd (sub wyd u.ace) - :- (weld pef (scag end `tape`txt)) - $(txt (slag +(end) `tape`txt), pef (reap (lent pef) ' ')) ::TODO? why do we need to cast? + :- (weld pef (tufa (scag end `(list @c)`txt))) + $(txt (slag +(end) `(list @c)`txt), pef (reap (lent pef) ' ')) :: $inv :_ ~ From fc9386c5335c6e3ed65f5205535decfa69ff7bf0 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 21 Jul 2017 15:53:24 -0700 Subject: [PATCH 166/303] Renamed some dif/delta* to det and some dif/rumor* to rum, to remove ambiguity. --- app/talk-agent.hoon | 54 +++++----- app/talk-guardian.hoon | 234 ++++++++++++++++++++--------------------- sur/talk.hoon | 8 +- 3 files changed, 148 insertions(+), 148 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 887fb2538e..94fd23ad8f 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -272,65 +272,65 @@ ++ ta-hear ::< apply change ::> :: - |= dif/rumor + |= rum/rumor ^+ +> - ?+ -.dif - ~&([%ignoring-rumor -.dif] +>) + ?+ -.rum + ~&([%ignoring-rumor -.rum] +>) :: $reader - ?- -.dif.dif + ?- -.rum.rum $glyph - (ta-change-glyph +.dif.dif) + (ta-change-glyph +.rum.rum) :: $nick - +>(nicks (change-nicks nicks who.dif.dif nic.dif.dif)) + +>(nicks (change-nicks nicks who.rum.rum nic.rum.rum)) == :: $circle - (ta-change-circle dif.dif) + (ta-change-circle rum.rum) == :: ++ ta-change-circle ::< apply circle change ::> :: - |= dif/rumor-story + |= rum/rumor-story ^+ +> - ?+ -.dif - ~&([%unexpected-circle-rumor -.dif] +>) + ?+ -.rum + ~&([%unexpected-circle-rumor -.rum] +>) :: $gram - (ta-learn gam.nev.dif) + (ta-learn gam.nev.rum) :: $config %= +> sources - ?. ?& ?=($source -.dif.dif) - =(cir.dif incir) + ?. ?& ?=($source -.dif.rum) + =(cir.rum incir) == sources - %. cir.dif.dif - ?: add.dif.dif + %. cir.dif.rum + ?: add.dif.rum ~(put in sources) ~(del in sources) :: mirrors - ?: ?=($remove -.dif.dif) (~(del by mirrors) cir.dif) - %+ ~(put by mirrors) cir.dif + ?: ?=($remove -.dif.rum) (~(del by mirrors) cir.rum) + %+ ~(put by mirrors) cir.rum %+ change-config - (fall (~(get by mirrors) cir.dif) *config) - dif.dif + (fall (~(get by mirrors) cir.rum) *config) + dif.rum == :: $status %= +> remotes - %+ ~(put by remotes) cir.dif - =+ rem=(fall (~(get by remotes) cir.dif) *group) - ?: ?=($remove -.dif.dif) (~(del by rem) who.dif) - %+ ~(put by rem) who.dif + %+ ~(put by remotes) cir.rum + =+ rem=(fall (~(get by remotes) cir.rum) *group) + ?: ?=($remove -.dif.rum) (~(del by rem) who.rum) + %+ ~(put by rem) who.rum %+ change-status - (fall (~(get by rem) who.dif) *status) - dif.dif + (fall (~(get by rem) who.rum) *status) + dif.rum == == :: @@ -2048,9 +2048,9 @@ ++ diff-talk-rumor ::< accept query change ::> :: - |= {way/wire dif/rumor} + |= {way/wire rum/rumor} ^- (quip move +>) - ta-done:(ta-hear:ta dif) + ta-done:(ta-hear:ta rum) :: ++ poke-sole-action ::< accept console ::> incoming sole action. process it. diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 20c5aab71b..5136347757 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -129,15 +129,15 @@ ++ ta-delta ::< emit a delta ::> adds a delta to the head of {deltas}. :: - |= dif/delta - %_(+> deltas [dif deltas]) + |= det/delta + %_(+> deltas [det deltas]) :: ++ ta-deltas ::< emit delta list ::> adds multiple deltas to the head of {deltas}. ::> flops to stay consistent with ++ta-delta. :: - |= dis/(list delta) - %_(+> deltas (welp (flop dis) deltas)) + |= des/(list delta) + %_(+> deltas (welp (flop des) deltas)) :: ++ ta-note ::< tell user ::> sends {msg} as an %app message to the user's @@ -276,16 +276,16 @@ ::> store a delta about a story. if the story ::> does not exist, crash. :: - |= {nom/naem dif/delta-story} + |= {nom/naem det/delta-story} ?: (~(has by stories) nom) - (impact nom dif) + (impact nom det) (ta-evil (crip "no story {(trip nom)}")) :: ++ impact ::< delta for story ::> Store a delta about a story. :: - |= {nom/naem dif/delta-story} - (ta-delta %story nom dif) + |= {nom/naem det/delta-story} + (ta-delta %story nom det) :: ++ present ::< send status update ::> @@ -512,27 +512,27 @@ ::> diff. if it's a new one, bear it. ::> for %circle, apply the story diff normally. :: - |= {wir/wire dif/rumor} + |= {wir/wire rum/rumor} ^+ +> - ?+ -.dif - ~&([%ignoring-rumor -.dif] +>) + ?+ -.rum + ~&([%ignoring-rumor -.rum] +>) :: $burden - ?+ -.dif.dif - %- (ta-know nom.dif) |= sor/_so =< so-done - (so-hear:sor & [our.bol nom.dif] dif.dif) + ?+ -.rum.rum + %- (ta-know nom.rum) |= sor/_so =< so-done + (so-hear:sor & [our.bol nom.rum] rum.rum) :: $new =< so-done - %- ~(so-bear so nom.dif ~ (fall (~(get by stories) nom.dif) *story)) - [~ [cof.dif.dif ~] [~ ~]] + %- ~(so-bear so nom.rum ~ (fall (~(get 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.wer dif.dif) + (so-hear:sor | cir.wer rum.rum) == :: ++ ta-repeat ::< message delivered @@ -657,30 +657,30 @@ ::> store delta in ++ta core. :: ::TODO maybe keep our own list of deltas, produce in done - |= dif/delta + |= det/delta ^+ +> - +>(deltas [dif deltas]) + +>(deltas [det deltas]) :: ++ so-deltas ::< send delta list ::> store multiple deltas in ++ta core. :: - |= dis/(list delta) - %_(+> deltas (welp (flop dis) deltas)) + |= des/(list delta) + %_(+> deltas (welp (flop des) deltas)) :: ++ so-delta-our ::< send delta of us ::> adds a delta about this story. :: - |= dif/delta-story + |= det/delta-story ^+ +> - (so-delta %story nom dif) + (so-delta %story nom det) :: ++ so-deltas-our ::< send deltas of us ::> adds multiple deltas about this story. :: - |= dis/(list delta-story) + |= des/(list delta-story) ^+ +> %- so-deltas - %+ turn dis + %+ turn des |= d/delta-story [%story nom d] :: @@ -714,35 +714,35 @@ ++ so-hear ::< accept circle rumor ::> apply changes from a rumor to this story. :: - |= {bur/? src/circle dif/rumor-story} + |= {bur/? src/circle rum/rumor-story} ^+ +> :: check that we're still subscribed to this story :: this is a small %gall bug, we shouldn't get these ~? ?! ?| (~(has in src.shape) src) =(src so-cir) == - [%unexpected-rumor-source nom -.dif src] - ?- -.dif + [%unexpected-rumor-source nom -.rum src] + ?- -.rum $new ?: =(src so-cir) - (so-config-full ~ cof.dif) - $(dif [%config src %full cof.dif]) - $bear ~&(%so-bear (so-bear bur.dif)) - $gram (so-open src nev.dif) + (so-config-full ~ cof.rum) + $(rum [%config src %full cof.rum]) + $bear ~&(%so-bear (so-bear bur.rum)) + $gram (so-open src nev.rum) $config :: full changes to us need to get split up. - ?: &(=(cir.dif so-cir) ?=($full -.dif.dif)) - (so-config-full `shape cof.dif.dif) + ?: &(=(cir.rum so-cir) ?=($full -.dif.rum)) + (so-config-full `shape cof.dif.rum) :: remotes are fine. - ?: =(src cir.dif) - (so-delta-our dif) + ?: =(src cir.rum) + (so-delta-our rum) :: remotes of remotes are not. ~& %ignoring-remote-config ~? =(src so-cir) %but-src-is-us +> $status :: ignore foreign remotes. - ?. |(=(src cir.dif) =(src so-cir)) + ?. |(=(src cir.rum) =(src so-cir)) ~& %ignoring-remote-status +> - (so-delta-our dif) + (so-delta-our rum) $remove (so-delta-our %config src %remove ~) == :: @@ -1147,17 +1147,17 @@ ::> modifies application state according to the ::> change specified in {dif}. :: - |= dif/delta + |= det/delta ^+ +> - ?- -.dif - $out (da-change-out +.dif) - $glyph (da-change-glyph +.dif) - $nick (da-change-nick +.dif) - $story (da-change-story +.dif) + ?- -.det + $out (da-change-out +.det) + $glyph (da-change-glyph +.det) + $nick (da-change-nick +.det) + $story (da-change-story +.det) $init da-init - $observe (da-observe +.dif) - $present (da-present +.dif) - $quit (da-emit [ost.dif %quit ~]) + $observe (da-observe +.det) + $present (da-present +.det) + $quit (da-emit [ost.det %quit ~]) == :: ++ da-init ::< startup side-effects @@ -1239,15 +1239,15 @@ ::> in case of a new or deleted story, specialized ::> arms are called. :: - |= {nom/naem dif/delta-story} + |= {nom/naem det/delta-story} ^+ +> - ?+ -.dif + ?+ -.det =< sa-done - %. dif + %. det =+ (fall (~(get by stories) nom) *story) ~(sa-change sa nom -) :: - $new (da-create nom +.dif) + $new (da-create nom +.det) $bear ~&(%unexpected-unsplit-bear +>) $remove (da-delete nom) == @@ -1336,11 +1336,11 @@ ::> figure out whether to apply a %story delta to ::> local or remote data. :: - |= dif/delta-story + |= det/delta-story ^+ +> - %. dif - ?: ?& ?=(?($config $status) -.dif) - !=(cir.dif sa-cir) + %. det + ?: ?& ?=(?($config $status) -.det) + !=(cir.det sa-cir) == sa-change-remote sa-change-local @@ -1348,37 +1348,37 @@ ++ sa-change-local ::< apply our delta ::> apply a %story delta to local data. :: - |= dif/delta-story + |= det/delta-story ^+ +> - ?+ -.dif - ~&([%unexpected-delta-local -.dif] !!) + ?+ -.det + ~&([%unexpected-delta-local -.det] !!) :: $inherited - +>(inherited ihr.dif) + +>(inherited ihr.det) :: $follow - (sa-emil (sa-follow-effects sub.dif cos.dif)) + (sa-emil (sa-follow-effects sub.det cos.det)) :: $sequent - +>(sequence (~(put by sequence) cir.dif num.dif)) + +>(sequence (~(put by sequence) cir.det num.det)) :: :: $gram - (sa-change-gram gam.dif) + (sa-change-gram gam.det) :: $config =. +> %- sa-emil - (sa-config-effects shape dif.dif) - +>(shape (change-config shape dif.dif)) + (sa-config-effects shape dif.det) + +>(shape (change-config shape dif.det)) :: $status %_ +> locals - %+ ~(put by locals) who.dif + %+ ~(put by locals) who.det %+ change-status - (fall (~(get by locals) who.dif) *status) - dif.dif + (fall (~(get by locals) who.det) *status) + dif.det == == :: @@ -1408,28 +1408,28 @@ ++ sa-change-remote ::< apply remote's delta ::> apply a story diff to remote data. :: - |= dif/delta-story + |= det/delta-story ^+ +> - ?+ -.dif - ~&([%unexpected-delta-remote -.dif] !!) + ?+ -.det + ~&([%unexpected-delta-remote -.det] !!) :: $config - ?: ?=($remove -.dif.dif) - +>(mirrors (~(del by mirrors) cir.dif)) + ?: ?=($remove -.dif.det) + +>(mirrors (~(del by mirrors) cir.det)) =/ new/config %+ change-config - (fall (~(get by mirrors) cir.dif) *config) - dif.dif - +>.$(mirrors (~(put by mirrors) cir.dif new)) + (fall (~(get by mirrors) cir.det) *config) + dif.det + +>.$(mirrors (~(put by mirrors) cir.det new)) :: $status %_ +>.$ remotes - %+ ~(put by remotes) cir.dif - =+ ole=(fall (~(get by remotes) cir.dif) *group) - ?: ?=($remove -.dif.dif) (~(del by ole) who.dif) - =+ old=(fall (~(get by ole) who.dif) *status) - (~(put by ole) who.dif (change-status old dif.dif)) + %+ ~(put by remotes) cir.det + =+ ole=(fall (~(get by remotes) cir.det) *group) + ?: ?=($remove -.dif.det) (~(del by ole) who.det) + =+ old=(fall (~(get by ole) who.det) *status) + (~(put by ole) who.det (change-status old dif.det)) == == :: @@ -1614,20 +1614,20 @@ ::> applies a change to the application state, ::> producing side-effects. :: - |= dif/delta + |= det/delta ^- (quip move +>) =^ mos +>.$ - da-done:(da-change:da dif) + da-done:(da-change:da det) :_ +>.$ ::TODO move affection to pre-bake, but then station creation doesn't happen? - (welp mos (affection dif)) + (welp mos (affection det)) :: ++ pre-bake ::< apply more deltas ::> bake a list of deltas. :: - |= dis/(list delta) + |= des/(list delta) ^- (quip move +>) - %+ roll dis + %+ roll des |= {d/delta m/(list move) _+>.$} =^ mos +>.^$ (bake d) [(welp m mos) +>.^$] @@ -1678,9 +1678,9 @@ ::> modify a %story diff to make it about their ship ::> instead of ours. :: - |= {who/ship nom/naem dif/delta-story} + |= {who/ship nom/naem det/delta-story} ^- rumor-story - ?+ -.dif dif + ?+ -.det det :: ::TODO ... $follow !! @@ -1690,9 +1690,9 @@ $gram :- %gram %+ gram-to-envelope nom - %_ gam.dif + %_ gam.det aud - %- ~(run in aud.gam.dif) + %- ~(run in aud.gam.det) |= c/circle ::TODO it probably isn't safe to do this for :: all audience members hosted by us, even @@ -1702,12 +1702,12 @@ == :: $config - ?. =(hos.cir.dif our.bol) dif - dif(cir [who nom.cir.dif]) + ?. =(hos.cir.det our.bol) det + det(cir [who nom.cir.det]) :: $status - ?. =(hos.cir.dif our.bol) dif - dif(cir [who nom.cir.dif]) + ?. =(hos.cir.det our.bol) det + det(cir [who nom.cir.det]) == :: ++ gram-to-envelope ::< wrap gram with nr @@ -1725,52 +1725,52 @@ ::> if the given delta changes the result of the given ::> query, produce the relevant rumor. :: - |= {qer/query dif/delta} + |= {qer/query det/delta} ^- (unit rumor) ?- -.qer $reader :: changes to shared ui state apply. - ?+ -.dif ~ - $glyph `[%reader dif] - $nick `[%reader dif] + ?+ -.det ~ + $glyph `[%reader det] + $nick `[%reader det] == :: $burden ::?: &(=(who.qer src.bol) did-they-send-a-burden) ~ - ?. ?=($story -.dif) ~ - ?: ?=(?($follow $inherited $sequent) -.dif.dif) ~ + ?. ?=($story -.det) ~ + ?: ?=(?($follow $inherited $sequent) -.det.det) ~ :: only burden channels for now. - ?. =(%black sec.con.shape:(~(got by stories) nom.dif)) ~ - `[%burden nom.dif (dedicate who.qer nom.dif dif.dif)] + ?. =(%black 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 our.bol)) ~ :: only send story reports about grams and status. - ?. ?=($story -.dif) ~ - ?. ?=(?($grams $status) -.dif.dif) ~ - =+ soy=(~(got by stories) nom.dif) + ?. ?=($story -.det) ~ + ?. ?=(?($grams $status) -.det.det) ~ + =+ soy=(~(got by stories) nom.det) :: and only if the story is inherited. ?. inherited.soy ~ :: only burden channels for now. ?. =(%black sec.con.shape.soy) ~ - `[%burden nom.dif (dedicate (above our.bol) nom.dif dif.dif)] + `[%burden nom.det (dedicate (above our.bol) nom.det det.det)] :: $circle - ?. ?=($story -.dif) ~ - ?. =(nom.qer nom.dif) ~ - ?: ?=(?($follow $burden) -.dif.dif) ~ :: internal-only delta + ?. ?=($story -.det) ~ + ?. =(nom.qer nom.det) ~ + ?: ?=(?($follow $burden) -.det.det) ~ :: internal-only delta =+ ren=(~(so-in-range so:ta nom.qer ~ (~(got by stories) nom.qer)) ran.qer) ::TODO if done.ren, %quit bone ?. in.ren ~ ::TODO move up? we also check for $follow above, why? - ?: ?=(?($follow $inherited $sequent) -.dif.dif) ~ - =/ rdif/rumor-story - ?+ -.dif.dif dif.dif + ?: ?=(?($follow $inherited $sequent) -.det.det) ~ + =/ rum/rumor-story + ?+ -.det.det det.det $gram - [%gram (gram-to-envelope nom.dif gam.dif.dif)] + [%gram (gram-to-envelope nom.det gam.det.det)] == - `[%circle rdif] + `[%circle rum] == :: ++ affection ::< rumors to interested @@ -1781,7 +1781,7 @@ :: ...but that would also require a ta-cancel call to remove :: them from the status list! how do? :: should there be an ++away arm for gall to call? - |= dif/delta + |= det/delta ^- (list move) :: cache results for paths. =| res/(map path (unit rumor)) @@ -1792,7 +1792,7 @@ ?^ mur ?~ u.mur ~ `[b %diff %talk-rumor u.u.mur] - =+ rum=(feel (path-to-query p) dif) + =+ rum=(feel (path-to-query p) det) =. res (~(put by res) p rum) ?~ rum ~ `[b %diff %talk-rumor u.rum] @@ -1898,11 +1898,11 @@ ++ diff-talk-rumor ::< accept rumor ::> accept a query result change. :: - |= {wir/wire dif/rumor} + |= {wir/wire rum/rumor} ^- (quip move +>) =^ mos +>.$ %- pre-bake - ta-done:(ta-hear:ta wir dif) + ta-done:(ta-hear:ta wir rum) =^ mow +>.$ log-all-to-file [(welp mos mow) +>.$] diff --git a/sur/talk.hoon b/sur/talk.hoon index bd05c7ec42..4db5f286e1 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -50,10 +50,10 @@ nis/(map ship nick) ::< local nicknames == :: ++ rumor ::< query result change - $% {$reader dif/rumor-reader} ::< /reader + $% {$reader rum/rumor-reader} ::< /reader {$friend add/? cir/circle} ::< /friend - {$burden nom/naem dif/rumor-story} ::< /burden - {$circle dif/rumor-story} ::< /circle + {$burden nom/naem rum/rumor-story} ::< /burden + {$circle rum/rumor-story} ::< /circle == :: ++ rumor-reader ::< changed ui state $% {$glyph diff-glyph} ::< un/bound glyph @@ -77,7 +77,7 @@ {$glyph diff-glyph} ::< un/bound glyph {$nick diff-nick} ::< changed nickname :: story state :: - {$story nom/naem dif/delta-story} ::< change to story + {$story nom/naem det/delta-story} ::< change to story :: side-effects :: {$init $~} ::< initialize {$observe who/ship} ::< watch burden bearer From 79c82edae7b2c820b949ca8de122f64da75b932a Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 31 Jul 2017 12:09:44 -0700 Subject: [PATCH 167/303] Slightly cleaner default-false loobean for inherited flag. --- app/talk-guardian.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 5136347757..a0c35106e8 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -50,7 +50,7 @@ ::TODO update & use. sequence/(map circle @ud) ::< last-heard p circle known/(map serial @ud) ::< messages heard - inherited/?($| $&) ::< from parent? + inherited/_| ::< from parent? == :: ++ move (pair bone card) ::< all actions ++ lime ::> diff fruit From cdcdd82021fe362265c4febe603143cb57ce8a6c Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 2 Aug 2017 21:43:56 -0700 Subject: [PATCH 168/303] Sent messages now get their delivery state tracked locally. (Interface for accessing this state yet to be exposed.) --- app/talk-guardian.hoon | 57 +++++++++++++++++++++++++++++++----------- sur/talk.hoon | 7 ++++++ 2 files changed, 50 insertions(+), 14 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index a0c35106e8..4f2a51935d 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -36,6 +36,7 @@ |% ++ state ::> broker state $: stories/(map naem story) ::< conversations + outbox/(map serial tracking) ::< sent messages log/(map naem @ud) ::< logged to clay nicks/(map ship nick) ::< local nicknames binds/(jug char (set circle)) ::< circle glyph lookup @@ -71,7 +72,7 @@ {$quit $~} :: == :: ++ weir ::> parsed wire - $% {$repeat cir/circle} ::< messaging wire + $% {$repeat cir/circle ses/(list serial)} ::< messaging wire {$circle nom/naem cir/circle} ::< subscription wire == :: -- @@ -539,12 +540,13 @@ ::> message got delivered. if an error was returned ::> mark the message as rejected. if not, received. :: - |= {who/circle fal/(unit tang)} + |= {who/circle ses/(list serial) fal/(unit tang)} ^+ +> ~? ?=(^ fal) u.fal - ::TODO store delivery state locally - ::?~(fal %received ~>(%slog.[0 u.fal] %rejected)) - +> + ~& [%outbox-was outbox] + =- (ta-delta %done who ses -) + ?~ fal %accepted + ~>(%slog.[0 u.fal] %rejected) :: ::> || ::> || %messaging @@ -1151,6 +1153,7 @@ ^+ +> ?- -.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) @@ -1192,13 +1195,39 @@ |= {cir/circle out/(list thought)} ^+ +> ~& [%da-change-out hos.cir] + =+ ses=(turn out head) + =. outbox + :: for every serial, add %pending state. + %+ roll ses + |= {s/serial o/_outbox} + =. o ?~(o outbox o) ::TODO =? + =+ t=(fall (~(get by o) s) *tracking) + %+ ~(put by o) s + (~(put by t) cir %pending) %+ da-emit ost.bol :* %poke - /repeat/(scot %p hos.cir)/[nom.cir] + /repeat/(scot %p hos.cir)/[nom.cir]/(scot %ud (jam ses)) [hos.cir %talk-guardian] [%talk-command %publish out] == :: + ++ da-change-done ::< delivered messages + ::> apply a %done delta, setting new delivery state + ::> for messages. + :: + |= {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 ::> a set of circles. @@ -1546,7 +1575,7 @@ ++ etch ::< parse wire ::> parses {wir} to obtain either %circle with story ::> and circle or %repeat with message number, source - ::> ship and story. + ::> ship, story and serials. :: |= wir/wire ^- weir @@ -1559,10 +1588,10 @@ i.t.t.t.wir :: $repeat - ?> ?=({@ @ $~} t.wir) + ?> ?=({@ @ @ $~} t.wir) :+ %repeat - (slav %p i.t.wir) - i.t.t.wir + [(slav %p i.t.wir) i.t.t.wir] + ((list serial) (cue (slav %ud i.t.t.t.wir))) == :: ++ etch-circle ::< parse /circle wire @@ -1582,11 +1611,11 @@ :: |= $: wir/wire $= fun - $- cir/circle + $- {cir/circle ses/(list serial)} {(list move) _.} == =+ wer=(etch wir) - ?>(?=($repeat -.wer) (fun cir.wer)) + ?>(?=($repeat -.wer) (fun cir.wer ses.wer)) :: ++ circle-peer ::< /circle peer card ::> constructs a %peer move to subscribe {nom} to @@ -1979,9 +2008,9 @@ |= {wir/wire fal/(unit tang)} ^- (quip move +>) %+ etch-repeat [%repeat wir] - |= cir/circle + |= {cir/circle ses/(list serial)} %- pre-bake - ta-done:(ta-repeat:ta cir fal) + ta-done:(ta-repeat:ta cir ses fal) :: ::> || ::> || %logging diff --git a/sur/talk.hoon b/sur/talk.hoon index 4db5f286e1..2919d4f3fd 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -73,6 +73,7 @@ ++ delta :: $% :: messaging state :: {$out cir/circle out/(list thought)} ::< send msgs to circle + {$done cir/circle ses/(list serial) res/delivery} ::< set delivery state :: shared ui state :: {$glyph diff-glyph} ::< un/bound glyph {$nick diff-nick} ::< changed nickname @@ -243,4 +244,10 @@ :: ++ serial @uvH ::< unique identifier ++ audience (set circle) ::< destinations +++ tracking (map circle delivery) ::> delivery per target +++ delivery ::> delivery state + $? $pending ::< undelivered + $accepted ::< received + $rejected ::< denied + == :: -- From 01da92c7cf317629b4d616ee97af7d08eeb37159 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 2 Aug 2017 21:45:29 -0700 Subject: [PATCH 169/303] Updated talk command mark to reflect recent removal of ++statement. --- mar/talk/command.hoon | 39 ++++++++------------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/mar/talk/command.hoon b/mar/talk/command.hoon index a62a3c8f4d..d51528f863 100644 --- a/mar/talk/command.hoon +++ b/mar/talk/command.hoon @@ -57,7 +57,8 @@ %- ot :~ serial+ceri audience+audi - statement+stam + date+di + speech+spec == :: ++ ceri @@ -72,37 +73,13 @@ ^- $-(nail (like circle)) ;~((glue fas) ;~(pfix sig fed:ag) urs:ab) :: - ++ speech-or-eval $?(speech {$eval p/@t} {$mor ses/(list speech-or-eval)}) - ++ eval - |= a/(pair @da speech-or-eval) - ^- statement - %= a - q - |- ^- speech - ?: ?=($mor -.q.a) - ::[%mor (turn ses.q.a |=(b/speech-or-eval ^$(q.a b)))] - ~& %todo-talk-command-mark ::TODO fix - *speech - ?. ?=($eval -.q.a) q.a - =- [%exp p.q.a -] - =+ pax=[&1:% &2:% (scot %da p.a) |3:%] - p:(mule |.([(sell (slap !>(..zuse) (rain pax p.q.a)))]~)) - == - :: - ++ stam - ^- $-(json (unit statement)) - %+ cu eval - (ot date+di speech+spec ~) - :: ++ spec - %+ ke *speech-or-eval |. - %- of - :~ lin+(ot say+bo txt+so ~) - url+(su aurf:urlp) - eval+so - mor+(ar spec) - :: exp+(cu |=(a=cord [a ~]) so) - :: inv+(ot ship+(su fed:ag) party+(su urs:ab) ~) + ^- $-(json (unit speech)) + %- of :~ + lin+(ot say+bo txt+so ~) + url+(su aurf:urlp) + :: exp+(cu |=(a=cord [a ~]) so) + :: inv+(ot ship+(su fed:ag) party+(su urs:ab) ~) == -- -- -- From e30e2508ea246a6f33fea58a57bd69a5b93f2b23 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 5 Oct 2017 19:18:22 +0200 Subject: [PATCH 170/303] Guardian now uses `dap.bol` instead of its hardcoded app name. --- app/talk-guardian.hoon | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 4f2a51935d..3f60d84cc1 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -147,7 +147,7 @@ |= msg/cord %^ ta-action 0 %phrase :- [[our.bol (main our.bol)] ~ ~] - [%app %talk-guardian msg]~ + [%app dap.bol msg]~ :: ++ ta-evil ::< emit error ::> tracing printf and crash. @@ -653,7 +653,7 @@ ^+ +> %+ so-act %phrase :- [[our.bol (main our.bol)] ~ ~] - [%app %talk-guardian msg]~ + [%app dap.bol msg]~ :: ++ so-delta ::< send delta ::> store delta in ++ta core. @@ -1135,7 +1135,7 @@ :* ost.bol %poke /present - [hos %talk-guardian] + [hos dap.bol] [%talk-command %present nos dif] == :: @@ -1171,7 +1171,7 @@ :* 0 %peer /burden - [(above our.bol) %talk-guardian] + [(above our.bol) dap.bol] /burden/(scot %p our.bol) == :: @@ -1185,7 +1185,7 @@ :* 0 %peer /report/(scot %p who) - [who %talk-guardian] + [who dap.bol] /report == :: @@ -1207,7 +1207,7 @@ %+ da-emit ost.bol :* %poke /repeat/(scot %p hos.cir)/[nom.cir]/(scot %ud (jam ses)) - [hos.cir %talk-guardian] + [hos.cir dap.bol] [%talk-command %publish out] == :: @@ -1536,7 +1536,7 @@ :_ ~ :* %pull /circle/[nom]/(scot %p hos.cir)/[nom.cir] - [hos.cir %talk-guardian] + [hos.cir dap.bol] ~ == :: @@ -1631,7 +1631,7 @@ /(scot -.u.tal.u.wen +.u.tal.u.wen) :* %peer (welp /circle/[nom]/(scot %p hos.cir)/[nom.cir] ran) - [hos.cir %talk-guardian] + [hos.cir dap.bol] (welp /circle/[nom.cir] ran) == :: From 2f6a7e3916add1eb772baf287f4610b5df456169 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 6 Oct 2017 00:02:59 +0200 Subject: [PATCH 171/303] Properly implemented `%ire`, the reply speech type. Refactored how known messages are accessed. --- app/talk-agent.hoon | 84 +++++++++++++++++++++++++++++++++++++-------- sur/talk.hoon | 1 + 2 files changed, 70 insertions(+), 15 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 94fd23ad8f..040497997c 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -85,6 +85,7 @@ {$say p/(list speech)} ::< send message {$eval p/cord q/twig} ::< send #-message {$target p/where q/(unit work)} ::< set active targets + {$reply p/$@(@ud {@u @ud}) q/(list speech)} ::< reply to :: displaying info :: {$number p/$@(@ud {@u @ud})} ::< relative/absolute {$who p/where} ::< presence @@ -142,6 +143,22 @@ :_ inbox (true-self our.bol) :: +++ renum ::< gram i# by serial + ::> find the grams list index for gram with serial. + |= ser/serial + ^- (unit @ud) + =+ num=(~(get by known) ser) + ?~ num ~ + `(sub count +(u.num)) +:: +++ recall ::< gram by serial + ::> find a known gram with serial {ser}. + |= ser/serial + ^- (unit telegram) + =+ num=(renum ser) + ?~ num ~ + `(snag u.num grams) +:: ++ nik-from-nak ::< nik from nak ::> :: @@ -372,7 +389,7 @@ :: |= gam/telegram ^+ +> - =+ old=(~(get by known) uid.gam) + =+ old=(renum uid.gam) ?~ old (ta-append gam) ::< add (ta-revise u.old gam) ::< modify @@ -393,10 +410,9 @@ ::> modify a telegram we know. :: |= {num/@ud gam/telegram} - =+ way=(sub count num) - =+ old=(snag (dec way) grams) + =+ old=(snag num grams) ?: =(gam old) +>.$ :: no change - =. grams (welp (scag (dec way) grams) [gam (slag way grams)]) + =. grams (welp (scag num grams) [gam (slag +(num) grams)]) ?: =(sep.gam sep.old) +>.$ :: no worthy change =< sh-done (~(sh-gram sh cli) gam) @@ -575,6 +591,9 @@ %+ cook ~(gas by *(map circle range)) (most ;~(plug com (star ace)) ;~(plug circ rang)) :: + ++ pick ::< message reference + ;~(pose nump (cook lent (star sem))) + :: ++ nump ::< number reference ;~ pose ;~(pfix hep dem:ag) @@ -602,15 +621,16 @@ ++ message ::< exp, lin or url msg ;~ pose ;~(plug (cold %eval hax) expr) - :: - %+ stag %say - %+ most (jest '•') ::TODO why is this not breaking msgs up? - ;~ pose - (stag %url aurf:urlp) - ::TODO maybe reverse loobs. at least document properly! confusing. - :(stag %lin | ;~(pfix pat text)) - :(stag %lin & ;~(less sem hax text)) - == + (stag %say speeches) + == + :: + ++ speeches ::< lin or url msgs + %+ most (jest '•') ::TODO why is this not breaking msgs up? + ;~ pose + (stag %url aurf:urlp) + ::TODO maybe reverse loobs. at least document properly! confusing. + :(stag %lin | ;~(pfix pat text)) + :(stag %lin & ;~(less sem hax text)) == :: ++ nick (cook crip (stun [1 14] low)) ::< nickname @@ -727,10 +747,11 @@ :: (stag %target ;~(plug cirs (punt ;~(pfix ace message)))) :: + (stag %reply ;~(plug pick ;~(pfix ace speeches))) + :: :: displaying info :: - (stag %number nump) - (stag %number (cook lent (star sem))) + (stag %number pick) == -- :: @@ -829,6 +850,7 @@ $say (say +.job) $eval (eval +.job) $target (target +.job) + $reply (reply +.job) :: displaying info $number (number +.job) $who (who +.job) @@ -1052,6 +1074,23 @@ =. ..sh-pact (sh-pact pan) ?~(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 + ::TODO =- (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 `serial`ser s]))) + :: ::> || ::> || %displaying-info ::> || @@ -1897,6 +1936,18 @@ :: $exp tan+~[rose+[" " ~ ~]^[leaf+"# {(trip exp.sep)}" res.sep]] + :: + $ire + =+ gam=(recall top.sep) + ?~ gam $(sep sep.sep) + :- %mor + =- [- $(sep sep.sep) ~] + :- %tan + ::TODO in "wrong" order because they get printed in reverse... + :~ :+ %rose [" " ~ ~] + (turn (~(tr-text tr sef u.gam) termwidth) |=(t/tape [%leaf t])) + [%leaf :(weld "in reply to: " (cite aut.u.gam) ": ")] + == :: $fat [%mor $(sep sep.sep) tan+(tr-tach tac.sep) ~] @@ -1965,6 +2016,9 @@ ::TODO print truncated res on its own line. :_ ~ (tr-chow wyd '#' ' ' (trip exp.sep)) + :: + $ire + $(sep sep.sep) :: $url :_ ~ diff --git a/sur/talk.hoon b/sur/talk.hoon index 2919d4f3fd..9dfbb25fef 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -226,6 +226,7 @@ $% {$lin pat/? msg/cord} ::< no/@ text line {$url url/purf} ::< parsed url {$exp exp/cord res/(list tank)} ::< hoon line + {$ire top/serial sep/speech} ::< in reply to {$fat tac/attache sep/speech} ::< attachment {$inv inv/? cir/circle} ::< inv/ban for circle {$app app/term msg/cord} ::< app message From 301b1f37ec43679c803fa252452ae47011c1bf05 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 6 Oct 2017 00:08:47 +0200 Subject: [PATCH 172/303] =?UTF-8?q?Fixed=20issue=20where=20=E2=80=A2=20was?= =?UTF-8?q?n't=20breaking=20up=20messages=20properly.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/talk-agent.hoon | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 040497997c..b898b69f7f 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -625,7 +625,7 @@ == :: ++ speeches ::< lin or url msgs - %+ most (jest '•') ::TODO why is this not breaking msgs up? + %+ most (jest '•') ;~ pose (stag %url aurf:urlp) ::TODO maybe reverse loobs. at least document properly! confusing. @@ -633,8 +633,11 @@ :(stag %lin & ;~(less sem hax text)) == :: + ++ text ::< msg without break + %+ cook crip + (plus ;~(less (jest '•') next)) + :: ++ nick (cook crip (stun [1 14] low)) ::< nickname - ++ text (cook crip (plus next)) ::< bullets separating ++ glyph (mask "/\\\{( Date: Fri, 6 Oct 2017 13:22:12 +0200 Subject: [PATCH 173/303] Changed "true" in %lin's pat.speech to mean "yes, has @/is action" instead of that being "false". --- app/talk-agent.hoon | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index b898b69f7f..ea4ffe9c4a 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -628,9 +628,8 @@ %+ most (jest '•') ;~ pose (stag %url aurf:urlp) - ::TODO maybe reverse loobs. at least document properly! confusing. - :(stag %lin | ;~(pfix pat text)) - :(stag %lin & ;~(less sem hax text)) + :(stag %lin & ;~(pfix pat text)) + :(stag %lin | ;~(less sem hax text)) == :: ++ text ::< msg without break @@ -1932,7 +1931,7 @@ |- ^- sole-effect ?- -.sep $lin - tan+~[leaf+"{?:(pat.sep "" "@ ")}{(trip msg.sep)}"] + tan+~[leaf+"{?:(pat.sep "@ " "")}{(trip msg.sep)}"] :: $url url+(crip (earf url.sep)) @@ -2045,7 +2044,7 @@ $lin :: glyph prefix =/ pef - ?. pat.sep " " + ?: pat.sep " " %~ ar-pref ar ?: =(who our.bol) aud (~(del in aud) [%& who (main who)]) From 5cf7e0971c1da472826eaafeef659179f6d340e8 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 6 Oct 2017 13:29:15 +0200 Subject: [PATCH 174/303] Misc. cleanup, comments, ideas. --- app/talk-agent.hoon | 4 ++-- app/talk-guardian.hoon | 11 +++++++++-- lib/talk.hoon | 2 +- sur/talk.hoon | 38 ++++++++++++++++++++++++++++++++++++-- 4 files changed, 48 insertions(+), 7 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index ea4ffe9c4a..47e9a2840d 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -743,7 +743,7 @@ :: ;~(plug (perk %help ~) (easy ~)) :: - :: (parsers below come last because they're easy to match) + :: (parsers below come last because they match quickly) :: :: messaging :: @@ -1098,7 +1098,7 @@ ::> || ::+| :: - ++ who ::< %who + ++ who ::< %who ::> prints presence lists for {pas} or all. :: |= pas/(set circle) ^+ ..sh-work diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 3f60d84cc1..205d1e4ec8 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -5,7 +5,6 @@ ::TODO rename to hall ::TODO master changes ::TODO char57 comments as line comments when regarding code. -::TODO avoid lark where possible ::TODO document what user-facing messages actually mean! ::TODO maybe have brokers accept reactions as well, redirect them to readers. :: that way we can have foreign brokers react to our requests! @@ -48,7 +47,6 @@ remotes/(map circle group) ::< remote status shape/config ::< configuration mirrors/(map circle config) ::< remote config - ::TODO update & use. sequence/(map circle @ud) ::< last-heard p circle known/(map serial @ud) ::< messages heard inherited/_| ::< from parent? @@ -717,6 +715,15 @@ ::> apply changes from a rumor to this story. :: |= {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 + :: == ^+ +> :: check that we're still subscribed to this story :: this is a small %gall bug, we shouldn't get these diff --git a/lib/talk.hoon b/lib/talk.hoon index 856dfa4c0b..99c15a317a 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -189,7 +189,7 @@ =+ [[tag wit] t-buk]=buk ?: =(tag q.p.i.wer) [tag ~|(tag+`@tas`tag (wit t.wer))] - ?~ t-buk ~|(bad-tag+q.p.i.wer !!) + ?~ t-buk ~|(bad-tag+`@tas`q.p.i.wer !!) (^$(buk t-buk) wer) :: ++ or diff --git a/sur/talk.hoon b/sur/talk.hoon index 9dfbb25fef..34a9cbdf01 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -26,9 +26,36 @@ {$burden who/ship} ::< duties to share {$report $~} ::< duty reports {$circle nom/naem ran/range} ::< story query - ::TODO separate stream for just msgs? what about just configs? presences? - :: yes! + ::{$circle nom/naem wat/circle-data} ::< story query + :: okay, the problem here is that we want to have + :: separate subscriptions for the different kinds + :: of story data. we can do that, but then if we + :: want all data and a specific range for the + :: messages (very common) then we need to do + :: three separate subscriptions. + :: possible solution would be adding range to all + :: story queries, but that feels weird irt + :: presence and configs. + :: (also, that would make for poor query design: + :: having a ~ halfway through is ugly.) + :: + :: /circle/name/range + :: /circle/name/all + :: /circle/name/grams/range + :: /circle/name/crowd/local + :: /circle/name/grams&crowd/range/local + :: /circle/name/grams + :: /circle/name/crowd + :: + ::TODO look at graphql and think about doing + :: multiple queries in a single %peer. == :: +::++ circle-data ::> queried data +:: $% {$all $~} ::< everything, always +:: {$grams ran/range} ::< messages (in range) +:: {$crowd wer/where} ::< presence +:: {$lobby wer/where} ::< configurations +:: == :: ++ range ::> inclusive msg range %- unit ::< ~ means everything $: hed/place ::< start of range @@ -38,6 +65,10 @@ $% {$da @da} ::< date {$ud @ud} ::< message number == :: +::TODO overlaps with agent's ++where +::++ where ::> data from +:: %- unit ::< ~ means everywhere +:: ?($local $remote) ::< local or remote only ++ prize ::> query result $% {$reader prize-reader} ::< /reader {$friend cis/(set circle)} ::< /friend @@ -214,6 +245,9 @@ ::> structures for containing main message data. ::+| :: +::TODO some structure for extra message state +:: local (to readers): delivery state, read flags +:: remote (to halls): sequence nr ++ envelope {num/@ud gam/telegram} ::< outward message ++ telegram {aut/ship thought} ::< whose message ++ thought ::> inner message From 5c7e045495b653b6148941f3461d0890fcf2d049 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 6 Oct 2017 19:35:25 +0200 Subject: [PATCH 175/303] Talk files now compile. Guardian doesn't yet init properly. --- app/talk-agent.hoon | 75 ++++++++++++++++---------------- app/talk-guardian.hoon | 99 ++++++++++++++++++++++-------------------- lib/talk.hoon | 29 +++++-------- sur/talk.hoon | 2 +- 4 files changed, 102 insertions(+), 103 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 47e9a2840d..fb9a9f79c0 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -25,7 +25,8 @@ !: :::: :: -[. talk sole] +=, talk +=, sole => ::> || ::> || %arch ::> || @@ -109,13 +110,13 @@ ::> || ::> functional cores and arms. :: -|_ {bol/bowl state} +|_ {bol/bowl:gall state} :: ++ prep ::< prepare state ::> adapts state. :: |= old/(unit state) - ^- (quip move ..prep) + ^- (quip move _..prep) ?~ old ta-done:ta-init:ta [~ ..prep(+<+ u.old)] @@ -167,9 +168,9 @@ ^+ nik %- ~(gas by *(map (set circle) char)) =- (zing -) - %+ turn (~(tap by nek)) + %+ turn ~(tap by nek) |= {a/char b/(set (set circle))} - (turn (~(tap by b)) |=(c/(set circle) [c a])) + (turn ~(tap by b) |=(c/(set circle) [c a])) :: ::> || ::> || %engines @@ -554,7 +555,7 @@ ;~ pose (cold incir col) ;~(pfix cen (stag our.bol sym)) - ;~(pfix fas (stag (sein our.bol) sym)) + ;~(pfix fas (stag (sein:title our.bol) sym)) :: %+ cook |= {a/@p b/(unit term)} @@ -627,7 +628,7 @@ ++ speeches ::< lin or url msgs %+ most (jest '•') ;~ pose - (stag %url aurf:urlp) + (stag %url aurf:de-purl:html) :(stag %lin & ;~(pfix pat text)) :(stag %lin | ;~(less sem hax text)) == @@ -933,7 +934,7 @@ :: |= nym/^nick ^- (list ship) - %+ murn (~(tap by nicks)) + %+ murn ~(tap by nicks) |= {p/ship q/^nick} ?. =(q nym) ~ [~ u=p] @@ -957,7 +958,7 @@ :: |= pos/(map circle range) ^+ ..sh-work - =+ pas=(key-by pos) + =+ pas=~(key by pos) =. ..sh-work =+ (~(get by nik) pas) ?^ - (sh-note "has glyph {}") @@ -1102,11 +1103,11 @@ ::> prints presence lists for {pas} or all. :: |= pas/(set circle) ^+ ..sh-work - =< (sh-fact %mor (murn (sort (~(tap by remotes) ~) aor) .)) + =< (sh-fact %mor (murn (sort ~(tap by remotes) aor) .)) |= {pon/circle gop/group} ^- (unit sole-effect) ?. |(=(~ pas) (~(has in pas) pon)) ~ =- `[%tan rose+[", " `~]^- leaf+~(pr-full pr pon) ~] - =< (murn (sort (~(tap by gop)) aor) .) + =< (murn (sort ~(tap by gop) aor) .) |= {a/ship b/presence c/human} ^- (unit tank) =. c ?. =(han.c `(scot %p a)) c @@ -1126,7 +1127,7 @@ ?^ qur =+ cha=(~(get by nik) qur) (sh-fact %txt ?~(cha "none" [u.cha]~)) - =+ pan=(~(tap in (~(get ju nak) qur))) + =+ pan=~(tap in (~(get ju nak) qur)) ?: =(~ pan) (sh-fact %txt "~") =< (sh-fact %mor (turn pan .)) |=(a/(set circle) [%txt ~(ar-prom ar a)]) @@ -1187,7 +1188,7 @@ ::> no arguments, show all ?: ?=({$~ $~} +<) %+ sh-fact %mor - %+ turn (~(tap by nicks)) + %+ turn ~(tap by nicks) |= {p/ship q/^nick} :- %txt "{

}: {}" @@ -1221,7 +1222,7 @@ ^+ ..sh-work ?~ seg %+ sh-fact %mor - %+ turn (~(tap in settings.she)) + %+ turn ~(tap in settings.she) |= s/term [%txt (trip s)] %= ..sh-work @@ -1294,7 +1295,7 @@ |- ^- (unit (set circle)) ?~ grams ~ ::> get first circle from a telegram's audience. - =+ pan=(silt (~(tap in aud.i.grams))) + =+ pan=(silt ~(tap in aud.i.grams)) ?: (~(has in lax) pan) `pan $(grams t.grams) :: @@ -1317,7 +1318,7 @@ == ^+ ret =. ret - =+ eno=(~(tap by one)) + =+ eno=~(tap by one) |- ^+ ret ?~ eno ret =. ret $(eno t.eno) @@ -1330,7 +1331,7 @@ ?: =(q.i.eno u.unt) ret ret(cha [[p.i.eno u.unt] cha.ret]) =. ret - =+ owt=(~(tap by two)) + =+ owt=~(tap by two) |- ^+ ret ?~ owt ret =. ret $(owt t.owt) @@ -1355,7 +1356,7 @@ == ^+ ret =. ret - =+ eno=(~(tap by one)) + =+ eno=~(tap by one) |- ^+ ret ?~ eno ret =. ret $(eno t.eno) @@ -1365,7 +1366,7 @@ ?: =(q.i.eno u.unt) ret ret(cha [[p.i.eno u.unt] cha.ret]) =. ret - =+ owt=(~(tap by two)) + =+ owt=~(tap by two) |- ^+ ret ?~ owt ret =. ret $(owt t.owt) @@ -1387,7 +1388,7 @@ == ^+ ret =. ret - =+ eno=(~(tap by one)) + =+ eno=~(tap by one) |- ^+ ret ?~ eno ret =. ret $(eno t.eno) @@ -1397,7 +1398,7 @@ ?: =(q.i.eno u.unt) ret ret(cha [[p.i.eno u.unt] cha.ret]) =. ret - =+ owt=(~(tap by two)) + =+ owt=~(tap by two) |- ^+ ret ?~ owt ret =. ret $(owt t.owt) @@ -1411,8 +1412,8 @@ ::> 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))) + :- ^= old ~(tap in (~(dif in one) two)) + ^= new ~(tap in (~(dif in two) one)) :: ::> || ::> || %printers @@ -1571,7 +1572,7 @@ %^ sh-show-permits (weld (trip inbox) ": ") sec.con.loc - [~ (~(tap in ses.con.loc))] + [~ ~(tap in ses.con.loc)] %^ sh-show-permits (weld (trip inbox) ": ") sec.con.loc @@ -1664,7 +1665,7 @@ :: |= mup/? ^- tape - =+ raw=(cite hos.one) + =+ raw=(cite:title hos.one) (runt [(sub 14 (lent raw)) ' '] raw) :: ++ cr-nick ::< nick or name in 14 @@ -1694,7 +1695,7 @@ =+ wun=(scow %p hos.one) ?: =(nom.one (main hos.one)) wun - ?: =(hos.one (sein our.bol)) + ?: =(hos.one (sein:title our.bol)) ['/' (trip nom.one)] :(welp wun "/" (trip nom.one)) -- @@ -1795,7 +1796,7 @@ ^- tape =. . ar-deaf =/ all - %+ sort `(list circle)`(~(tap in lix)) + %+ sort `(list circle)`~(tap in lix) |= {a/circle b/circle} (~(pr-beat pr a) b) =+ fir=& @@ -1829,7 +1830,7 @@ ^- tape =+ cha=(~(get by nik) lix) ?^ cha ~[u.cha ' '] - ?. (lien (~(tap by lix)) ar-dire) + ?. (lien ~(tap by lix) ar-dire) "* " ?: ?=({^ $~ $~} lix) ": " @@ -1919,7 +1920,7 @@ =. wen (sub wen (mod wen (div wen ~s0..0001))) :: round =+ hed=leaf+"{(scow %uv sen)} at {(scow %da wen)}" =/ cis - %+ turn (~(tap in aud)) + %+ turn ~(tap in aud) |= a/circle leaf+~(pr-full pr a) [%rose [" " ~ ~] [hed >who< [%rose [", " "to " ~] cis] ~]]~ @@ -1934,7 +1935,7 @@ tan+~[leaf+"{?:(pat.sep "@ " "")}{(trip msg.sep)}"] :: $url - url+(crip (earf url.sep)) + url+(crip (apix:en-purl:html url.sep)) :: $exp tan+~[rose+[" " ~ ~]^[leaf+"# {(trip exp.sep)}" res.sep]] @@ -1948,7 +1949,7 @@ ::TODO in "wrong" order because they get printed in reverse... :~ :+ %rose [" " ~ ~] (turn (~(tr-text tr sef u.gam) termwidth) |=(t/tape [%leaf t])) - [%leaf :(weld "in reply to: " (cite aut.u.gam) ": ")] + [%leaf :(weld "in reply to: " (cite:title aut.u.gam) ": ")] == :: $fat @@ -2024,7 +2025,7 @@ :: $url :_ ~ - =+ ful=(earf url.sep) + =+ ful=(apix:en-purl:html url.sep) =. wyd (sub wyd 2) :: account for prefix. :: if the full url fits, just render it. ?: (gte wyd (lent ful)) ['/' ' ' ful] @@ -2085,8 +2086,8 @@ ::> incoming subscription on pax. :: |= pax/path - ^- (quip move +>) - ?. (team src.bol our.bol) + ^- (quip move _+>) + ?. (team:title src.bol our.bol) ~& [%peer-talk-reader-stranger src.bol] [~ +>] ?. ?=({$sole *} pax) @@ -2098,14 +2099,14 @@ ::> :: |= {way/wire piz/prize} - ^- (quip move +>) + ^- (quip move _+>) ta-done:(ta-take:ta piz) :: ++ diff-talk-rumor ::< accept query change ::> :: |= {way/wire rum/rumor} - ^- (quip move +>) + ^- (quip move _+>) ta-done:(ta-hear:ta rum) :: ++ poke-sole-action ::< accept console @@ -2118,7 +2119,7 @@ ::> :: |= {wir/wire fal/(unit tang)} - ^- (quip move +>) + ^- (quip move _+>) ?~ fal [~ +>] %- (slog leaf+"action failed: " u.fal) [~ +>] diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 205d1e4ec8..cd943f2535 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -26,7 +26,7 @@ !: :::: :: -[. talk] ::TODO =, +=, talk => ::> || ::> || %arch ::> || @@ -63,7 +63,7 @@ == :: ++ card ::> general card $% {$diff lime} :: - {$info wire ship term nori} :: + {$info wire ship term nori:clay} :: {$peer wire dock path} :: {$poke wire dock pear} :: {$pull wire dock $~} :: @@ -80,17 +80,17 @@ ::> || ::> functional cores and arms. :: -|_ {bol/bowl state} +|_ {bol/bowl:gall state} :: ++ prep ::< prepare state ::> adapts state. :: |= old/(unit state) - ^- (quip move ..prep) - ?~ old + ^- (quip move _..prep) + ::?~ old %- pre-bake ta-done:ta-init:ta - [~ ..prep(+<+ u.old)] + ::[~ ..prep(+<+ u.old)] :: ::> || ::> || %engines @@ -196,9 +196,9 @@ %- ta-deltas :: if needed, subscribe to our parent's /burden. =+ sen=(above our.bol) - ?: ?| !=(%czar (clan sen)) + ?: ?| !=(%czar (clan:title sen)) =(sen our.bol) - =(%pawn (clan our.bol)) + =(%pawn (clan:title our.bol)) == ~ [%init ~]~ @@ -493,7 +493,7 @@ ~&([%ignoring-prize -.piz] +>) :: $burden - %+ roll (~(tap by sos.piz)) + %+ roll ~(tap by sos.piz) |= {{n/naem b/burden} _..ta-take} =< so-done (~(so-bear so n ~ (fall (~(get by stories) n) *story)) b) @@ -564,7 +564,7 @@ ::> conducts thought {tot} to each circle in its audience. :: |= {pub/? aut/ship tot/thought} - =+ aud=(~(tap in aud.tot)) + =+ aud=~(tap in aud.tot) |- ^+ +>.^$ ?~ aud +>.^$ $(aud t.aud, +>.^$ (ta-conduct pub aut i.aud tot)) @@ -575,7 +575,7 @@ |= {pub/? aut/ship cir/circle tot/thought} ^+ +> ?: pub - ?. (team our.bol aut) + ?. (team:title our.bol aut) %- ta-note (crip "strange author {(scow %p aut)}") =. aut our.bol @@ -768,19 +768,19 @@ (so-config-full `shape loc.cos) :: remote config =. self - %+ roll (~(tap by rem.cos)) + %+ roll ~(tap by rem.cos) |= {{r/circle c/config} _self} (so-delta-our %config r %full c) :: local status =. self - %+ roll (~(tap by loc.pes)) + %+ roll ~(tap by loc.pes) |= {{w/ship s/status} _self} (so-delta-our %status so-cir w %full s) :: remote status =. self - %+ roll (~(tap by rem.pes)) + %+ roll ~(tap by rem.pes) |= {{c/circle g/group} _self} - %+ roll (~(tap by g)) + %+ roll ~(tap by g) |= {{w/ship s/status} _self} (so-delta-our %status c w %full s) :: telegrams @@ -1089,7 +1089,7 @@ $black !(~(has in ses.con.shape) her) ::< channel, blacklist $white (~(has in ses.con.shape) her) ::< village, whitelist $green & ::< journal, all - $brown (team our.bol her) ::< mailbox, our team + $brown (team:title our.bol her) ::< mailbox, our team == -- -- @@ -1111,7 +1111,7 @@ ::> ++da-emil and ++da-emit add them to the head of ::> the {moves}. :: - ^- (quip move +>) + ^- (quip move _+>) [(flop moves) +>] :: ::> || @@ -1247,7 +1247,7 @@ == =/ ole/(list (set circle)) ?. =(cis ~) [cis ~] - (~(tap in (~(get ju binds) gyf))) + ~(tap in (~(get ju binds) gyf)) |- ^+ +>.^$ ?~ ole +>.^$ %_ $ @@ -1366,7 +1366,7 @@ ::> apply a %remove story delta, unsubscribing ::> this story from all its active sources. :: - (sa-abjure (~(tap in src.shape))) + (sa-abjure ~(tap in src.shape)) :: ++ sa-change ::< apply circle delta ::> figure out whether to apply a %story delta to @@ -1487,8 +1487,8 @@ |= {sub/? cos/(map circle range)} ^- (list move) ?: sub - (sa-acquire (~(tap by cos))) - (sa-abjure (~(tap in (key-by cos)))) + (sa-acquire ~(tap by cos)) + (sa-abjure ~(tap in ~(key by cos))) :: ++ sa-permit-effects ::< notify permitted ::> apply side-effects for a %permit delta, @@ -1552,7 +1552,7 @@ :: |= sis/(set ship) ^- (list move) - %+ turn (~(tap in (sa-unearth sis))) + %+ turn ~(tap in (sa-unearth sis)) |= {b/bone} [b %quit ~] :: @@ -1651,7 +1651,7 @@ ::> producing side-effects. :: |= det/delta - ^- (quip move +>) + ^- (quip move _+>) =^ mos +>.$ da-done:(da-change:da det) :_ +>.$ @@ -1662,7 +1662,7 @@ ::> bake a list of deltas. :: |= des/(list delta) - ^- (quip move +>) + ^- (quip move _+>) %+ roll des |= {d/delta m/(list move) _+>.$} =^ mos +>.^$ (bake d) @@ -1681,7 +1681,7 @@ :+ ~ ~ :- %burden %- ~(gas in *(map naem burden)) - %+ murn (~(tap by stories)) + %+ murn ~(tap by stories) |= {n/naem s/story} ^- (unit (pair naem burden)) :: only auto-federate channels for now. @@ -1821,7 +1821,7 @@ ^- (list move) :: cache results for paths. =| res/(map path (unit rumor)) - %+ murn (~(tap by sup.bol)) + %+ murn ~(tap by sup.bol) |= {b/bone s/ship p/path} ^- (unit move) =+ mur=(~(get by res) p) @@ -1872,7 +1872,7 @@ |= {who/ship qer/query} ^- ? ?- -.qer - $reader (team our.bol who) + $reader (team:title our.bol who) $burden ?& =(who who.qer) =(our.bol (above who)) == @@ -1893,7 +1893,7 @@ ::> incoming talk command. process it and update logs. :: |= cod/command - ^- (quip move +>) + ^- (quip move _+>) =^ mos +>.$ %- pre-bake ta-done:(ta-apply:ta src.bol cod) @@ -1905,8 +1905,8 @@ ::> incoming talk action. process it. :: |= act/action - ^- (quip move +>) - ?. (team src.bol our.bol) + ^- (quip move _+>) + ?. (team:title src.bol our.bol) %- pre-bake =< ta-done %- ta-note:ta %- crip @@ -1923,7 +1923,7 @@ ::> accept a query result. :: |= {wir/wire piz/prize} - ^- (quip move +>) + ^- (quip move _+>) =^ mos +>.$ %- pre-bake ta-done:(ta-take:ta wir piz) @@ -1935,7 +1935,7 @@ ::> accept a query result change. :: |= {wir/wire rum/rumor} - ^- (quip move +>) + ^- (quip move _+>) =^ mos +>.$ %- pre-bake ta-done:(ta-hear:ta wir rum) @@ -1947,7 +1947,7 @@ ::> incoming subscription on {pax}. :: |= pax/path - ^- (quip move +>) + ^- (quip move _+>) ?: ?=({$sole *} pax) ~&(%talk-broker-no-sole !!) =+ qer=(path-to-query pax) ?. (leak src.bol qer) ~&(%peer-invisible !!) @@ -1965,7 +1965,7 @@ ::> unsubscribes. :: |= pax/path - ^- (quip move +>) + ^- (quip move _+>) =+ qer=(path-to-query pax) ?. ?=($circle -.qer) [~ +>.$] %- pre-bake @@ -1975,7 +1975,7 @@ ::> handle all remote errors. :: |= {wir/wire fal/(unit tang)} - ^- (quip move +>) + ^- (quip move _+>) ?~ fal [~ +>] ~| reap-fail+wir (mean u.fal) @@ -1986,7 +1986,7 @@ :: ::TODO update to handle all subscription kinds. |= {wir/wire fal/(unit tang)} - ^- (quip move +>) + ^- (quip move _+>) %+ etch-circle [%circle wir] |= {nom/naem cir/circle} ?~ fal @@ -2002,7 +2002,7 @@ :: ::TODO update for all subscription kinds. |= wir/wire - ^- (quip move +>) + ^- (quip move _+>) %+ etch-circle [%circle wir] |= {nom/naem cir/circle} :_ +>.^$ :_ ~ @@ -2013,7 +2013,7 @@ ::> received or rejected. :: |= {wir/wire fal/(unit tang)} - ^- (quip move +>) + ^- (quip move _+>) %+ etch-repeat [%repeat wir] |= {cir/circle ses/(list serial)} %- pre-bake @@ -2029,7 +2029,7 @@ ::> to be re-loaded by ++poke-talk-load. :: |= nom/naem - ^- (quip move +>) + ^- (quip move _+>) =/ paf/path /(scot %p our.bol)/home/(scot %da now.bol)/talk/[nom]/talk-telegrams =+ grams:(~(got by stories) nom) @@ -2039,7 +2039,7 @@ %info /jamfile our.bol - (foal paf [%talk-telegrams !>(-)]) + (foal:space:userlib paf [%talk-telegrams !>(-)]) == :: ++ poke-talk-load ::< load from log @@ -2047,7 +2047,7 @@ ::> as saved in ++poke-talk-save. :: |= nom/naem - ^- (quip move +>) + ^- (quip move _+>) =/ grams .^ (list telegram) %cx @@ -2066,7 +2066,7 @@ :: |= nom/naem ~& %talk-poke-log - ^- (quip move +>) + ^- (quip move _+>) :- [(log-to-file nom) ~] %= +>.$ log @@ -2078,7 +2078,7 @@ ::> stops logging story {nom}'s messages. :: |= nom/naem - ^- (quip move +>) + ^- (quip move _+>) :- ~ +>.$(log (~(del by log) nom)) :: @@ -2087,7 +2087,7 @@ ::> their grams to log files if new ones have arrived. :: ::TODO re-enable and test. - ^- (quip move .) + ^- (quip move _.) ?: & [~ .] :: XXX!!!! :_ %_ . log @@ -2095,7 +2095,7 @@ |= {nom/naem len/@ud} count:(~(got by stories) nom) == - %+ murn (~(tap by log)) + %+ murn ~(tap by log) |= {nom/naem len/@ud} ^- (unit move) ?: (gte len count:(~(got by stories) nom)) @@ -2109,8 +2109,13 @@ ^- move =+ ^- paf/path =+ day=(year %*(. (yore now.bol) +.t +:*tarp)) - %+ tope [our.bol %home da+now.bol] + %+ en-beam:format [our.bol %home da+now.bol] /talk-telegrams/(scot %da day)/[nom]/talk =+ grams:(~(got by stories) nom) - [ost.bol %info /jamfile our.bol (foal paf [%talk-telegrams !>(-)])] + :* ost.bol + %info + /jamfile + our.bol + (foal:space:userlib paf [%talk-telegrams !>(-)]) + == -- diff --git a/lib/talk.hoon b/lib/talk.hoon index e8015b1cbd..853e9486fa 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -22,21 +22,13 @@ ::TODO add to zuse? ++ true-self |= who/ship - ?. ?=($earl (clan who)) who - (sein who) + ?. ?=($earl (clan:title who)) who + (sein:title who) :: ++ above |= who/ship - ?: ?=($czar (clan who)) ~zod - (sein who) -:: -::TODO remove when on master, use +- key:by instead -++ key-by - |* m/(map) - =| b/(set _?>(?=(^ m) p.n.m)) - |- ^+ b - ?~ m b - $(m r.m, b $(m l.m, b (~(put in b) p.n.m))) + ?: ?=($czar (clan:title who)) ~zod + (sein:title who) :: ++ said-url :: app url |= url/purl:eyre @@ -62,7 +54,7 @@ :: ++ uniq |= eny/@uvJ - ^- (quid serial eny) + ^- {serial _eny} [(shaf %serial eny) (shax eny)] :: ++ change-glyphs ::< ... @@ -168,7 +160,7 @@ |* typ/{@tas (pole @tas)} =+ [i-typ t-typ]=typ |= wer/weir - ^- (tup:dray i-typ t-typ) ::< ie, (tup %p %tas ~) is {@p @tas} + ^- (tup:dray:wired i-typ t-typ) ::< ie, (tup %p %tas ~) is {@p @tas} ?~ wer !! ?~ t-typ ?^ t.wer !! @@ -193,14 +185,15 @@ (^$(buk t-buk) wer) :: ++ or - |* typ/|-($@(@tas {@tas $})) + =+ tmp=|-($@(@tas {@tas $})) ::TODO typ/that syntax-errors... + |* typ/tmp |= con/coin - ::^- _(snag *@ (turn (limo typ) |*(a/@tas [a (odo:raid a)]))) + ::^- _(snag *@ (turn (limo typ) |*(a/@tas [a (odo:raid:wired a)]))) ?> ?=($$ -.con) =/ i-typ ?@(typ typ -.typ) ?: =(i-typ p.p.con) :- i-typ - ^- (odo:raid i-typ) + ^- (odo:raid:wired i-typ) q.p.con ?@ typ ~|(%bad-odor !!) (^$(typ +.typ) con) @@ -209,7 +202,7 @@ |* typ/@tas =/ typecheck `@tas`typ |= con/coin - ^- (odo:raid typ) + ^- (odo:raid:wired typ) ?. ?=($$ -.con) ~|(%not-dime !!) ?. =(typ p.p.con) ~|(bad-odor+`@tas`p.p.con !!) q.p.con diff --git a/sur/talk.hoon b/sur/talk.hoon index 34a9cbdf01..cfbd95e935 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -258,7 +258,7 @@ == :: ++ speech ::> content body $% {$lin pat/? msg/cord} ::< no/@ text line - {$url url/purf} ::< parsed url + {$url url/purf:eyre} ::< parsed url {$exp exp/cord res/(list tank)} ::< hoon line {$ire top/serial sep/speech} ::< in reply to {$fat tac/attache sep/speech} ::< attachment From 0a1bc4ee7368b60157cda3e02b775ecf3915844e Mon Sep 17 00:00:00 2001 From: Fang Date: Sun, 8 Oct 2017 15:20:02 +0200 Subject: [PATCH 176/303] "Fixed" weird %ap-lame errors in new talk. --- app/talk-guardian.hoon | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index cd943f2535..07ea933f3f 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -706,9 +706,16 @@ =. +>.$ (so-hear | src %config src %full loc.cos) =. +>.$ - %- ~(rep in loc.pes) - |= {{w/ship s/status} _+>.$} - (so-hear | src %status src w %full s) + =+ 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 ::< accept circle rumor @@ -1663,10 +1670,16 @@ :: |= des/(list delta) ^- (quip move _+>) - %+ roll des - |= {d/delta m/(list move) _+>.$} - =^ mos +>.^$ (bake d) - [(welp m mos) +>.^$] + =| moz/(list move) + |- ^- (quip move _+>.^$) + ?~ des [moz +>.^$] + =^ mos +>.^$ (bake i.des) + $(moz (welp moz mos), des t.des) + ::TODO ideally you'd just do this, but that runtime errors on "bake"... + ::%+ roll des + ::|= {d/delta m/(list move) _+>.$} + ::=^ mos +>.^$ (bake d) + ::[(welp m mos) +>.^$] :: ++ peek ::< query on state ::> find the result (if any) for a given query. From 61ae8c747ae7874ac9f542cd4f9ec93151fcc086 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 9 Oct 2017 11:57:36 +0200 Subject: [PATCH 177/303] Removed unnecessary printfs. --- app/talk-agent.hoon | 6 ++---- app/talk-guardian.hoon | 14 ++++---------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index fb9a9f79c0..29adb0ccbd 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -268,8 +268,7 @@ :: |= piz/prize ^+ +> - ?+ -.piz - ~&([%ignoring-prize -.piz] +>) + ?+ -.piz +> :: $reader %= +> @@ -292,8 +291,7 @@ :: |= rum/rumor ^+ +> - ?+ -.rum - ~&([%ignoring-rumor -.rum] +>) + ?+ -.rum +> :: $reader ?- -.rum.rum diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 07ea933f3f..8d8b2b1940 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -87,10 +87,10 @@ :: |= old/(unit state) ^- (quip move _..prep) - ::?~ old + ?~ old %- pre-bake ta-done:ta-init:ta - ::[~ ..prep(+<+ u.old)] + [~ ..prep(+<+ u.old)] :: ::> || ::> || %engines @@ -541,7 +541,6 @@ |= {who/circle ses/(list serial) fal/(unit tang)} ^+ +> ~? ?=(^ fal) u.fal - ~& [%outbox-was outbox] =- (ta-delta %done who ses -) ?~ fal %accepted ~>(%slog.[0 u.fal] %rejected) @@ -742,7 +741,7 @@ $new ?: =(src so-cir) (so-config-full ~ cof.rum) $(rum [%config src %full cof.rum]) - $bear ~&(%so-bear (so-bear bur.rum)) + $bear (so-bear bur.rum) $gram (so-open src nev.rum) $config :: full changes to us need to get split up. ?: &(=(cir.rum so-cir) ?=($full -.dif.rum)) @@ -751,13 +750,10 @@ ?: =(src cir.rum) (so-delta-our rum) :: remotes of remotes are not. - ~& %ignoring-remote-config ~? =(src so-cir) %but-src-is-us +> $status :: ignore foreign remotes. - ?. |(=(src cir.rum) =(src so-cir)) - ~& %ignoring-remote-status - +> + ?. |(=(src cir.rum) =(src so-cir)) +> (so-delta-our rum) $remove (so-delta-our %config src %remove ~) == @@ -1194,7 +1190,6 @@ ::> {who} below us. :: |= who/ship - ~& [%peering-report who] %- da-emit :* 0 %peer @@ -1208,7 +1203,6 @@ :: |= {cir/circle out/(list thought)} ^+ +> - ~& [%da-change-out hos.cir] =+ ses=(turn out head) =. outbox :: for every serial, add %pending state. From 9d6c3eca7d2127c5cf9479fc9ce33b2b66ede229 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 9 Oct 2017 12:02:28 +0200 Subject: [PATCH 178/303] Use shortened comet names in talk audience prompt. --- app/talk-agent.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 29adb0ccbd..477006e88f 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -1690,7 +1690,7 @@ ?: =(nom.one inbox) ":" ['%' (trip nom.one)] - =+ wun=(scow %p hos.one) + =+ wun=(cite:title hos.one) ?: =(nom.one (main hos.one)) wun ?: =(hos.one (sein:title our.bol)) From 5586807f2cf47dda49156d2167367b595bb95afa Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 9 Oct 2017 12:59:23 +0200 Subject: [PATCH 179/303] Fixed issue with talk command mark. --- mar/talk/command.hoon | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mar/talk/command.hoon b/mar/talk/command.hoon index e02d9ec33e..1b4acb1b59 100644 --- a/mar/talk/command.hoon +++ b/mar/talk/command.hoon @@ -3,7 +3,6 @@ :: /? 310 /- talk -/+ old-zuse :: =, talk |_ cod/command @@ -12,8 +11,7 @@ |% ++ noun command :: clam from %noun ++ json - =, old-zuse - =, jo + =, dejs-soft:format |= a/json ^- command =- (need ((of -) a)) =< :~ publish+(ar thot) @@ -80,7 +78,7 @@ ^- $-(json (unit speech)) %- of :~ lin+(ot say+bo txt+so ~) - url+(su aurf:urlp) + url+(su aurf:de-purl:html) :: exp+(cu |=(a=cord [a ~]) so) :: inv+(ot ship+(su fed:ag) party+(su urs:ab) ~) == From 911ee0335440a25c988e7aa6f97efbeeb6348447 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 9 Oct 2017 13:00:46 +0200 Subject: [PATCH 180/303] "Fixed" another weird %ap-lame. --- app/talk-guardian.hoon | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 8d8b2b1940..509012fb02 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -1932,8 +1932,16 @@ |= {wir/wire piz/prize} ^- (quip move _+>) =^ mos +>.$ + :: this shouldn't be necessary, but see the TODO below. + ?: ?=($burden -.piz) + %- pre-bake + =< ta-done + %+ roll ~(tap by sos.piz) + |= {{n/naem b/burden} _ta} + =< so-done + (~(so-bear so n ~ (fall (~(get by stories) n) *story)) b) %- pre-bake - ta-done:(ta-take:ta wir piz) + ta-done:(ta-take:ta wir piz) ::TODO %ap-lame for %burden prize... =^ mow +>.$ log-all-to-file [(welp mos mow) +>.$] From 0d72c1d2c424a3bd3edbb7039c998bd0e810f1c4 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 9 Oct 2017 22:50:17 +0200 Subject: [PATCH 181/303] Made range a first-class citizen of sources/subscriptions. FIXME side-effect: agent can't unsub from sources with specified ranges. --- app/talk-agent.hoon | 10 +-- app/talk-guardian.hoon | 160 ++++++++++++++++++++--------------------- lib/talk.hoon | 31 +++++++- sur/talk.hoon | 10 +-- 4 files changed, 120 insertions(+), 91 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 477006e88f..712e9f7e8f 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -280,7 +280,7 @@ $circle %. nes.piz %= ta-unpack - sources src.loc.cos.piz + 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) == @@ -324,7 +324,7 @@ =(cir.rum incir) == sources - %. cir.dif.rum + %. cir.src.dif.rum ?: add.dif.rum ~(put in sources) ~(del in sources) @@ -1539,18 +1539,18 @@ ++ sh-show-sources ::< show sources ::> prints subscription changes to the cli. :: - |= {pre/tape old/(list circle) new/(list circle)} + |= {pre/tape old/(list source) new/(list source)} ^+ +> =. +>.$ |- ^+ +>.^$ ?~ old +>.^$ =. +>.^$ $(old t.old) - (sh-note (weld pre "off {~(pr-full pr i.old)}")) + (sh-note (weld pre "off {~(pr-full pr cir.i.old)}")) =. +>.$ |- ^+ +>.^$ ?~ new +>.^$ =. +>.^$ $(new t.new) - (sh-note (weld pre "hey {~(pr-full pr i.new)}")) + (sh-note (weld pre "hey {~(pr-full pr cir.i.new)}")) +>.$ :: ++ sh-show-config ::< show config diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 509012fb02..5f651b137e 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -71,7 +71,7 @@ == :: ++ weir ::> parsed wire $% {$repeat cir/circle ses/(list serial)} ::< messaging wire - {$circle nom/naem cir/circle} ::< subscription wire + {$circle nom/naem src/source} ::< subscription wire == :: -- :: @@ -317,7 +317,7 @@ ^+ ..ta-action ?. (~(has in stories) nom) %^ impact nom %new - :* [[our.bol nom] ~ ~] + :* [[[our.bol nom] ~] ~ ~] des *filter :- typ @@ -364,11 +364,11 @@ ++ action-source ::< un/sub p to/from r ::> add/remove {pos} as sources for story {nom}. :: - |= {nom/naem sub/? pos/(map circle range)} + |= {nom/naem 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 pos) + so-done:(~(so-sources so nom ~ u.soy) sub srs) :: ::> || %messaging ::+| @@ -471,16 +471,16 @@ ++ ta-greet ::< subscription success ::> store a started subscription as source. :: - |= {nom/naem cir/circle} + |= {nom/naem src/source} %- (ta-know nom) |= sor/_so =< so-done - (so-greet:sor cir) + (so-greet:sor src) :: ++ ta-leave ::< subscription failed - ::> removes {cir} from story {nom}'s followers. + ::> removes {src} from story {nom}'s sources. :: - |= {nom/naem cir/circle} + |= {nom/naem src/source} %- (ta-know nom) |= sor/_so =< so-done - (so-leave:sor cir) + (so-leave:sor src) :: ++ ta-take ::< apply prize ::> for a %burden prize, bear the burden in a new @@ -502,7 +502,7 @@ =+ wer=(etch wir) ?> ?=($circle -.wer) %- (ta-know nom.wer) |= sor/_so =< so-done - (so-take:sor cir.wer +.piz) + (so-take:sor cir.src.wer +.piz) == :: ++ ta-hear ::< apply rumor @@ -531,7 +531,7 @@ =+ wer=(etch wir) ?> ?=($circle -.wer) %- (ta-know nom.wer) |= sor/_so =< so-done - (so-hear:sor | cir.wer rum.rum) + (so-hear:sor | cir.src.wer rum.rum) == :: ++ ta-repeat ::< message delivered @@ -545,6 +545,15 @@ ?~ fal %accepted ~>(%slog.[0 u.fal] %rejected) :: + ++ ta-resub ::< subscription dropped + ::> when a subscription gets dropped by gall, we + ::> resubscribe. + :: + |= {nom/naem src/source} + ^+ +> + %- (ta-know nom) |= sor/_so =< so-done + (so-resub:sor src) + :: ::> || ::> || %messaging ::> || @@ -731,12 +740,6 @@ :: rum/rumor-story :: == ^+ +> - :: check that we're still subscribed to this story - :: this is a small %gall bug, we shouldn't get these - ~? ?! ?| (~(has in src.shape) src) - =(src so-cir) - == - [%unexpected-rumor-source nom -.rum src] ?- -.rum $new ?: =(src so-cir) (so-config-full ~ cof.rum) @@ -833,20 +836,16 @@ [%story nom d] :: ++ so-sources ::< change source - ::> adds or removes {cos} from our sources. + ::> adds or removes {srs} from our sources, + ::> skipping over ones we already (don't) have. :: - ::TODO should ++action-source make use of this, - :: because of the {sus} logic? - |= {add/? cos/(map circle range)} + |= {add/? srs/(set source)} ^+ +> - ::TODO for new sources, follow. - :: for existing sources, unfollow and refollow - :: with new range? - ::=/ sus/(set circle) - :: %. src.shape - :: ?:(add ~(dif in pas) ~(int in pas)) - ::?~ sus +>.$ - (so-delta-our %follow & cos) + =/ sus/(set source) + %. src.shape + ?:(add ~(dif in srs) ~(int in srs)) + ?~ sus +>.$ + (so-delta-our %follow add srs) :: ++ so-depict ::< change description ::> modifies our caption. @@ -895,18 +894,32 @@ ++ so-greet ::< subscription started ::> store a started subscription as source. :: - |= cir/circle + |= src/source ^+ +> - ?: (~(has in src.shape) cir) +> - (so-delta-our %config so-cir %source & cir) + ?: (~(has in src.shape) src) +> + (so-delta-our %config so-cir %source & src) :: ++ so-leave ::< subscription ended - ::> delete {cir} from our sources. + ::> delete {src} from our sources. :: - |= cir/circle + |= src/source ^+ +> - ?. (~(has in src.shape) cir) +> - (so-delta-our %config so-cir %source | cir) + ?. (~(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. + :: + |= src/source + ^+ +> + =- (so-delta-our %follow & [[cir.src -] ~ ~]) + ^- range + ?. (~(has by sequence) cir.src) ran.src + =- `[[%ud (~(got by sequence) cir.src)] -] + ?~ ran.src ~ + tal.u.ran.src :: ++ so-first-grams ::< beginning of stream ::> find all grams that fall within the range. @@ -1367,7 +1380,7 @@ ::> apply a %remove story delta, unsubscribing ::> this story from all its active sources. :: - (sa-abjure ~(tap in src.shape)) + (sa-abjure src.shape) :: ++ sa-change ::< apply circle delta ::> figure out whether to apply a %story delta to @@ -1394,7 +1407,7 @@ +>(inherited ihr.det) :: $follow - (sa-emil (sa-follow-effects sub.det cos.det)) + (sa-emil (sa-follow-effects sub.det srs.det)) :: $sequent +>(sequence (~(put by sequence) cir.det num.det)) @@ -1485,11 +1498,10 @@ ::> apply side-effects for a %follow delta, ::> un/subscribing this story to/from {cos}. :: - |= {sub/? cos/(map circle range)} + |= {sub/? srs/(set source)} ^- (list move) - ?: sub - (sa-acquire ~(tap by cos)) - (sa-abjure ~(tap in ~(key by cos))) + %. srs + ?:(sub sa-acquire sa-abjure) :: ++ sa-permit-effects ::< notify permitted ::> apply side-effects for a %permit delta, @@ -1515,35 +1527,28 @@ ++ sa-acquire ::< subscribe us ::> subscribes this story to each circle. :: - |= cos/(list (pair circle range)) + |= srs/(set source) %+ sa-sauce 0 :: subscription is caused by this app %- zing - %+ turn cos + %+ turn ~(tap in srs) |= {cir/circle ran/range} - ^- (list card) + ^- (list card) ::TODO just (unit card) is enough. ?: =(cir sa-cir) ~ :: ignore self-subs - :: unless otherwise specified, subscribe starting - :: at the last message we heard. - =. ran ::TODO =? - ?^ ran ran - =+ num=(~(get by sequence) cir) - ?~ num `[[%ud 0] ~] - `[[%ud u.num] ~] - :_ ~ - (circle-peer nom cir ran) + [(circle-peer nom cir ran) ~] :: ++ sa-abjure ::< unsubscribe us ::> unsubscribes this story from each circle. :: - |= cis/(list circle) + |= srs/(set source) %+ sa-sauce 0 :: subscription is caused by this app %- zing - %+ turn cis - |= cir/circle + %+ turn ~(tap in srs) + |= {cir/circle ran/range} ^- (list card) :_ ~ + =+ rap=(range-to-path ran) :* %pull - /circle/[nom]/(scot %p hos.cir)/[nom.cir] + (welp /circle/[nom]/(scot %p hos.cir)/[nom.cir] rap) [hos.cir dap.bol] ~ == @@ -1592,8 +1597,8 @@ ?> ?=({@ @ @ *} t.wir) :^ %circle i.t.wir - (slav %p i.t.t.wir) - i.t.t.t.wir + [(slav %p i.t.t.wir) i.t.t.t.wir] + (path-to-range t.t.t.t.wir) :: $repeat ?> ?=({@ @ @ $~} t.wir) @@ -1608,11 +1613,11 @@ :: |= $: wir/wire $= fun - $- {nom/naem cir/circle} + $- {nom/naem src/source} {(list move) _.} == =+ wer=(etch wir) - ?>(?=($circle -.wer) (fun nom.wer cir.wer)) + ?>(?=($circle -.wer) (fun nom.wer src.wer)) :: ++ etch-repeat ::< parse /repeat wire ::> parses a /repeat wire, call gate with the result. @@ -1626,21 +1631,16 @@ ?>(?=($repeat -.wer) (fun cir.wer ses.wer)) :: ++ circle-peer ::< /circle peer card - ::> constructs a %peer move to subscribe {nom} to - ::> {cir}. + ::> constructs a %peer move to subscribe {nom} to a + ::> source. :: - |= {nom/cord cir/circle wen/range} + |= {nom/naem source} ^- card - =/ ran - ?~ wen ~ - %+ welp - /(scot -.hed.u.wen +.hed.u.wen) - ?~ tal.u.wen ~ - /(scot -.u.tal.u.wen +.u.tal.u.wen) + =+ rap=(range-to-path ran) :* %peer - (welp /circle/[nom]/(scot %p hos.cir)/[nom.cir] ran) + (welp /circle/[nom]/(scot %p hos.cir)/[nom.cir] rap) [hos.cir dap.bol] - (welp /circle/[nom.cir] ran) + (welp /circle/[nom.cir] rap) == :: ::> || @@ -2003,14 +2003,14 @@ |= {wir/wire fal/(unit tang)} ^- (quip move _+>) %+ etch-circle [%circle wir] - |= {nom/naem cir/circle} + |= {nom/naem src/source} ?~ fal %- pre-bake - ta-done:(ta-greet:ta nom cir) - =. u.fal [>%reap-circle-fail nom cir< u.fal] + ta-done:(ta-greet:ta nom src) + =. u.fal [>%reap-circle-fail nom src< u.fal] %- (slog (flop u.fal)) %- pre-bake - ta-done:(ta-leave:ta nom cir) + ta-done:(ta-leave:ta nom src) :: ++ quit-circle ::< dropped subscription ::> gall dropped our subscription. resubscribe. @@ -2019,9 +2019,9 @@ |= wir/wire ^- (quip move _+>) %+ etch-circle [%circle wir] - |= {nom/naem cir/circle} - :_ +>.^$ :_ ~ - [0 (circle-peer nom cir `[[%da (sub now.bol ~m5)] ~])] + |= {nom/naem src/source} + %- pre-bake + ta-done:(ta-resub:ta nom src) :: ++ coup-repeat ::< message n/ack ::> ack from ++ta-transmit. mark the message as diff --git a/lib/talk.hoon b/lib/talk.hoon index 853e9486fa..3914a946ec 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -57,6 +57,35 @@ ^- {serial _eny} [(shaf %serial eny) (shax eny)] :: +++ range-to-path ::< msg range to path + ::> turns a range structure into a path used for + ::> subscriptions. + :: + |= ran/range + ^- path + ?~ ran ~ + %+ welp + /(scot -.hed.u.ran +.hed.u.ran) + ?~ tal.u.ran ~ + /(scot -.u.tal.u.ran +.u.tal.u.ran) +:: +++ path-to-range ::< path to msg range + ::> turns the tail of a subscription path into a + ::> range structure. + :: + |= pax/path + ^- range + ?~ pax ~ + :+ ~ + =+ hed=(slaw %da i.pax) + ?^ hed [%da u.hed] + [%ud (slav %ud i.pax)] + ?~ t.pax ~ + :- ~ + =+ tal=(slaw %da i.t.pax) + ?^ tal [%da u.tal] + [%ud (slav %ud i.t.pax)] +:: ++ change-glyphs ::< ... ::> :: @@ -93,7 +122,7 @@ $source %= cof src - %. cir.dif + %. src.dif ?: add.dif ~(put in src.cof) ~(del in src.cof) diff --git a/sur/talk.hoon b/sur/talk.hoon index cfbd95e935..e4c7eca5d7 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -121,7 +121,7 @@ ++ delta-story ::> story delta $? diff-story ::< both in & outward $% {$inherited ihr/?} ::< inherited flag - {$follow sub/? cos/(map circle range)} ::< un/subscribe + {$follow sub/? srs/(set source)} ::TODO set y/n?::< un/subscribe {$sequent cir/circle num/@ud} ::< update last-heard {$gram gam/telegram} ::< new/changed msgs == == :: @@ -139,7 +139,7 @@ ++ diff-config ::> config change ::TODO maybe just full? think. $% {$full cof/config} ::< set w/o side-effects - {$source add/? cir/circle} ::< add/rem sources + {$source add/? src/source} ::< add/rem sources {$caption cap/cord} ::< changed description {$filter fit/filter} ::< changed filter {$secure sec/security} ::< changed security @@ -171,7 +171,7 @@ {$depict nom/naem des/cord} ::< change description {$filter nom/naem fit/filter} ::< change message rules {$permit nom/naem inv/? sis/(set ship)} ::< invite/banish - {$source nom/naem sub/? src/(map circle range)} ::< un/sub to/from src + {$source nom/naem sub/? srs/(set source)} ::< un/sub to/from src :: messaging :: {$convey tos/(list thought)} ::< post exact {$phrase aud/(set circle) ses/(list speech)} ::< post easy @@ -205,12 +205,12 @@ :: circle configurations. :: ++ lobby {loc/config rem/(map circle config)} ::< our & srcs configs ++ config ::> circle config - $: src/(set circle) ::< active sources - ::TODO ^ include range? just remove! + $: src/(set source) ::< active sources cap/cord ::< description fit/filter ::< message rules con/control ::< restrictions == :: +++ source {cir/circle ran/range} ::< subscription target ++ filter ::> content filters $: cas/? ::< dis/allow capitals utf/? ::< dis/allow non-ascii From 611e2e60bf876986ab5a860a8905305594b66506 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 10 Oct 2017 15:59:15 +0200 Subject: [PATCH 182/303] Sources now get properly removed from the circle's config. --- app/talk-guardian.hoon | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 5f651b137e..8c7530fe22 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -844,8 +844,24 @@ =/ sus/(set source) %. src.shape ?:(add ~(dif in srs) ~(int in srs)) + ~& [%sources src.shape] + ~& [%change add sus] + :: 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 srs) + (so-delta-our %follow add sus) :: ++ so-depict ::< change description ::> modifies our caption. From e96b7d5fa330c42398c2de44cd7d33b06f416ed1 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 10 Oct 2017 15:59:47 +0200 Subject: [PATCH 183/303] ;who only shows members of currently joined circles. --- app/talk-agent.hoon | 1 + 1 file changed, 1 insertion(+) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 712e9f7e8f..7149c6c19b 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -1104,6 +1104,7 @@ =< (sh-fact %mor (murn (sort ~(tap by remotes) aor) .)) |= {pon/circle gop/group} ^- (unit sole-effect) ?. |(=(~ pas) (~(has in pas) pon)) ~ + ?. (~(has in sources) pon) ~ =- `[%tan rose+[", " `~]^- leaf+~(pr-full pr pon) ~] =< (murn (sort ~(tap by gop) aor) .) |= {a/ship b/presence c/human} ^- (unit tank) From 3248b0437d6586b2475fd7f70c74796585585bd7 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 10 Oct 2017 16:30:27 +0200 Subject: [PATCH 184/303] Moved deltas out of /sur, into /app. --- app/talk-guardian.hoon | 36 ++++++++++++++++++++++++++++++++++++ sur/talk.hoon | 23 ----------------------- 2 files changed, 36 insertions(+), 23 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 8c7530fe22..25f0a1cba8 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -33,6 +33,8 @@ ::> data structures :: |% + ::> || %state :: + ::> state data structures :: ++ state ::> broker state $: stories/(map naem story) ::< conversations outbox/(map serial tracking) ::< sent messages @@ -51,6 +53,40 @@ known/(map serial @ud) ::< messages heard inherited/_| ::< from parent? == :: + ::> || %deltas :: + ::> changes to state :: + ++ delta :: + $% :: 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/naem det/delta-story} ::< change to story + :: side-effects :: + {$init $~} ::< initialize + {$observe who/ship} ::< watch burden bearer + $: $present ::> send %present cmd + hos/ship :: + nos/(set naem) :: + dif/diff-status :: + == :: + {$quit ost/bone} ::< force unsubscribe + == :: + ++ delta-story ::> story delta + $? diff-story ::< both in & outward + $% {$inherited ihr/?} ::< inherited flag + {$follow sub/? srs/(set source)} ::TODO set?::< un/subscribe + {$sequent cir/circle num/@ud} ::< update last-heard + {$gram gam/telegram} ::< new/changed msgs + == == :: + ::> || %out :: + ::> outgoing data :: ++ move (pair bone card) ::< all actions ++ lime ::> diff fruit $% {$talk-prize prize} :: diff --git a/sur/talk.hoon b/sur/talk.hoon index e4c7eca5d7..108912b70d 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -100,31 +100,8 @@ cos/lobby ::< loc & rem configs pes/crowd ::< loc & rem presences == :: -::TODO deltas into app -++ delta :: - $% :: messaging state :: - {$out cir/circle out/(list thought)} ::< send msgs to circle - {$done cir/circle ses/(list serial) res/delivery} ::< set delivery state - :: shared ui state :: - {$glyph diff-glyph} ::< un/bound glyph - {$nick diff-nick} ::< changed nickname - :: story state :: - {$story nom/naem det/delta-story} ::< change to story - :: side-effects :: - {$init $~} ::< initialize - {$observe who/ship} ::< watch burden bearer - {$present hos/ship nos/(set naem) dif/diff-status}::< send %present cmd - {$quit ost/bone} ::< force unsubscribe - == :: ++ diff-glyph {bin/? gyf/char pas/(set circle)} ::< un/bound glyph ++ diff-nick {who/ship nic/nick} ::< changed nickname -++ delta-story ::> story delta - $? diff-story ::< both in & outward - $% {$inherited ihr/?} ::< inherited flag - {$follow sub/? srs/(set source)} ::TODO set y/n?::< un/subscribe - {$sequent cir/circle num/@ud} ::< update last-heard - {$gram gam/telegram} ::< new/changed msgs - == == :: ++ diff-story ::> story change $% {$new cof/config} ::< new story {$bear bur/burden} ::< new inherited story From 4d7a4b94fea558e08ad4ab671046474df0bdd17d Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 10 Oct 2017 16:44:37 +0200 Subject: [PATCH 185/303] =?UTF-8?q?Now=20using=20=3D=3F=20where=20appropri?= =?UTF-8?q?ate.?= --- app/talk-agent.hoon | 8 +++----- app/talk-guardian.hoon | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 7149c6c19b..dd50657137 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -1108,9 +1108,7 @@ =- `[%tan rose+[", " `~]^- leaf+~(pr-full pr pon) ~] =< (murn (sort ~(tap by gop) aor) .) |= {a/ship b/presence c/human} ^- (unit tank) - =. c - ?. =(han.c `(scot %p a)) c - [~ tru.c] + =? c =(han.c `(scot %p a)) [~ tru.c] ?- b $gone ~ $idle `leaf+:(weld "idle " (scow %p a) " " (trip (fall han.c ''))) @@ -1771,8 +1769,8 @@ |- ^- circle =+ lef=`(unit circle)`ar-best(lix l.lix) =+ rit=`(unit circle)`ar-best(lix r.lix) - =. n.lix ?~(lef n.lix (~(pr-best pr n.lix) u.lef)) - =. n.lix ?~(rit n.lix (~(pr-best pr n.lix) u.rit)) + =? n.lix ?=(^ lef) (~(pr-best pr n.lix) u.lef) + =? n.lix ?=(^ rit) (~(pr-best pr n.lix) u.rit) n.lix :: ++ ar-deaf ::< except for self diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 25f0a1cba8..747c4acaca 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -332,8 +332,7 @@ %- ~(rep in cis) |= {c/circle m/(jug ship naem)} (~(put ju m) hos.c nom.c) - =. ..ta-action ::TODO =? - ?. (~(has by cic) our.bol) ..ta-action + =? ..ta-action (~(has by cic) our.bol) %- ~(rep in (~(get ju cic) our.bol)) |= {n/naem _ta} (affect n %status [our.bol n] our.bol dif) @@ -368,8 +367,7 @@ :: |= {nom/naem mes/(unit cord)} ^+ ..ta-action - =. ..ta-action ::TODO =? - ?~ mes ..ta-action + =? ..ta-action ?=(^ mes) %+ action-phrase [[our.bol nom] ~ ~] [%lin | u.mes]~ @@ -1273,7 +1271,7 @@ :: for every serial, add %pending state. %+ roll ses |= {s/serial o/_outbox} - =. o ?~(o outbox o) ::TODO =? + =? o ?=($~ o) outbox =+ t=(fall (~(get by o) s) *tracking) %+ ~(put by o) s (~(put by t) cir %pending) From 58a5b87fcf8981ec93afc78be9c18fa98a7e6cdd Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 10 Oct 2017 17:17:10 +0200 Subject: [PATCH 186/303] Renamed the %noob setting flag to %nicks. --- app/talk-agent.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index dd50657137..3117efbb31 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -639,7 +639,7 @@ ++ glyph (mask "/\\\{( Date: Tue, 10 Oct 2017 17:40:38 +0200 Subject: [PATCH 187/303] Ported over the %notify setting flag from urbit/arvo#318. --- app/talk-agent.hoon | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 3117efbb31..57400fc83f 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -641,6 +641,7 @@ %- perk :~ %nicks %quiet + %notify %showtime == ++ work ::< full input @@ -1456,8 +1457,13 @@ %+ sh-fact %mor ::TODO? we need to cast, but not if we do =(0 (lent lis)) above instead.. %+ turn `(list tape)`lis + =+ nom=(scag 7 (cite:title our.bol)) |= t/tape - [%txt t] + ?. ?& (~(has in settings.she) %notify) + ?=(^ (find nom (slag 15 t))) + == + [%txt t] + [%mor [%txt t] [%bel ~] ~] :: ++ sh-numb ::< print msg number ::> prints a message number, left-padded by heps. From 24e6873a5c9a006357ada135931e2ba9edbc1cbd Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 11 Oct 2017 23:47:50 +0200 Subject: [PATCH 188/303] Slightly improved sur/talk wrt true names. --- sur/talk.hoon | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sur/talk.hoon b/sur/talk.hoon index 108912b70d..911e9b8a1d 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -131,8 +131,8 @@ == :: ++ diff-human ::> name change $% {$full man/human} ::< fully changed name - {$true tru/(unit (trel cord (unit cord) cord))} ::< changed true name {$handle han/(unit cord)} ::< changed handle + {$true tru/(unit truename)} ::< changed true name == :: :: ::> || @@ -213,8 +213,9 @@ == :: ++ human ::> human identifier $: han/(unit cord) ::< handle - tru/(unit (trel cord (unit cord) cord)) ::< true name + tru/(unit truename) ::< true name == :: +++ truename {fir/cord mid/(unit cord) las/cord} ::< real-life name :: ::> || ::> || %message-data From 082ebfc8ae5b64887cafe97d72813129736005cf Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 12 Oct 2017 12:29:56 +0200 Subject: [PATCH 189/303] Misc cleanup --- app/talk-guardian.hoon | 3 --- lib/talk.hoon | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 747c4acaca..348f2d98e2 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -878,8 +878,6 @@ =/ sus/(set source) %. src.shape ?:(add ~(dif in srs) ~(int in srs)) - ~& [%sources src.shape] - ~& [%change add sus] :: we only make a delta for removals here, :: because we don't need to wait for ++reap when :: pulling subscriptions. @@ -974,7 +972,6 @@ ++ so-first-grams ::< beginning of stream ::> find all grams that fall within the range. :: - ::TODO strip unused vars. |= ran/range ^- (list telegram) =+ [num=0 gaz=grams zeg=*(list telegram)] diff --git a/lib/talk.hoon b/lib/talk.hoon index 3914a946ec..1eb7676580 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -8,7 +8,7 @@ :: :::: :: -[. ^talk] +=, ^talk |_ bol/bowl:gall ++ main :: main story |= who/ship From c14970c228b57fb824f3ee5931f86d7c31074105 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 12 Oct 2017 12:30:16 +0200 Subject: [PATCH 190/303] tmp progress on talk-json lib & marks --- lib/talk-json.hoon | 130 ++++++++++++++++++++++++++++++++++++++++ mar/talk/action.hoon | 26 ++++++++ mar/talk/command.hoon | 77 +----------------------- mar/talk/report.hoon | 6 +- mar/talk/telegrams.hoon | 4 +- 5 files changed, 164 insertions(+), 79 deletions(-) create mode 100644 lib/talk-json.hoon create mode 100644 mar/talk/action.hoon diff --git a/lib/talk-json.hoon b/lib/talk-json.hoon new file mode 100644 index 0000000000..ed78b10991 --- /dev/null +++ b/lib/talk-json.hoon @@ -0,0 +1,130 @@ +:: +:::: /lib/talk-json/hoon + :: +/- talk +:: +::> rules for sur-json conversion: (proposal, adhered to below) +::> 1. to save the devs from having to learn multiple interfaces, try to match +::> the hoon structure as closely as possible, including attribute names. +::> 2. if these names are p/q/r, slightly more semantic naming is preferred. +::> 2. when dealing with $%, the tag is the variable name. ie `{$x ...}` -> `x` +::> for tagged unions with one piece of data, `x` holds that value. +::> for tagged unions with multiple pieces of data, `x` is an object. +::> 3. ... +:: +=, talk +|% +++ en-json ::> sur to json + |% + ++ spec ::> speech + -- +:: +++ de-json ::> json to sur + =, dejs-soft:format + |% + ::TODO these first few should maybe make their way + :: into the stdlib... + ++ as ::> array as set + |* a/fist + (cu ~(gas in *(set _(need *a))) (ar a)) + :: + ++ dank ::> tank + ^- $-(json (unit tank)) + %- of :~ + leaf+sa + palm+(ot style+(ot mid+sa cap+sa open+sa close+sa ~) lines+(ar dank) ~) + rose+(ot style+(ot mid+sa open+sa close+sa ~) lines+(ar dank) ~) + == + :: + :: + ++ dist + ^- $-(json (unit diff-status)) + %- of :~ + full+(ot pec+(su pres) man+huma ~) + presence+(su pres) + human+dihu + remove+ul + == + :: + ++ dihu + ^- $-(json (unit diff-human)) + %- of :~ + full+huma + handle+(mu so) + true+ + == + :: + ::> || + ::> || %circles + ::> || + ::> messaging targets and their metadata. + ::+| + :: + ++ circ ::> circle + ^- $-(nail (like circle)) + ;~((glue fas) ;~(pfix sig fed:ag) urt:ab) + :: + ++ pres ::> presence + ^- $-(nail (like presence)) + (perk %gone %idle %hear %talk ~) + :: + ++ huma ::> human + ^- $-(json (unit human)) + %- ot :~ + han+(mu so) + tru+(mu true) + == + :: + ++ true ::> truename + ^- $-(json (unit truename)) + (ot fir+so mid+(mu so) las+so ~) + :: + ::> || + ::> || %message-data + ::> || + ::> structures for containing main message data. + ::+| + :: + ++ thot ::> thought + ^- $-(json (unit thought)) + %- ot :~ + uid+seri + aud+audi + wen+di + sep+spec + == + :: + ++ spec ::> speech + ^- $-(json (unit speech)) + %- of :~ + lin+(ot pat+bo txt+so ~) + url+(su aurf:de-purl:html) + exp+(ot exp+so res+(ar dank) ~) + ire+(ot top+seri sep+spec ~) + fat+(ot tac+atta sep+spec ~) + inv+(ot inv+bo cir+(su circ) ~) + == + :: + ++ atta ::> attache + ^- $-(json (unit attache)) + %- of :~ + name+(ot nom+so tac+atta ~) + text+(ar so) + tank+(ar dank) + == + :: + ::> || + ::> || %message-metadata + ::> || + :: structures for containing message metadata. + ::+| + :: + ++ seri ::> serial + ^- $-(json (unit serial)) + (ci (slat %uv) so) + :: + ++ audi ::> audience + ^- $-(json (unit audience)) + (as (su circ)) + -- +-- diff --git a/mar/talk/action.hoon b/mar/talk/action.hoon new file mode 100644 index 0000000000..8ca423cfd4 --- /dev/null +++ b/mar/talk/action.hoon @@ -0,0 +1,26 @@ +:: +:::: /mar/talk/rumor/hoon + :: +/- talk +/+ talk-json +:: +=, talk +|_ dif/action +:: +++ grab ::> convert from + |% + ++ noun action ::< from %noun + ++ json ::> from %json + =, dejs-soft:format + =, talk-json:de-json + |= a/json ^- action + =- (need ((of -) a)) + :~ create+ul + == + -- +:: +++ grow ::> convert to + |% + ++ json ::> to %json + -- +-- diff --git a/mar/talk/command.hoon b/mar/talk/command.hoon index 1b4acb1b59..40ec26ad85 100644 --- a/mar/talk/command.hoon +++ b/mar/talk/command.hoon @@ -3,84 +3,13 @@ :: /? 310 /- talk +/+ talk-json :: =, talk |_ cod/command :: ++ grab :: convert from |% - ++ noun command :: clam from %noun - ++ json - =, dejs-soft:format - |= a/json ^- command - =- (need ((of -) a)) - =< :~ publish+(ar thot) - bearing+ul - == - |% - ++ op :: parse keys of map - |* {fel/rule wit/fist} - %+ cu malt - %+ ci - |= a/(map cord _(need *wit)) - =, unity - ^- (unit (list _[(wonk *fel) (need *wit)])) - (drop-list (turn ~(tap by a) (head-rush fel))) - (om wit) - :: - ++ ke :: callbacks - |* {gar/* sef/_|.(fist)} - |= jon/json - ^- (unit _gar) - =- ~! gar ~! (need -) - - ((sef) jon) - :: - ++ as :: array as set - |* a/fist - (cu ~(gas in *(set _(need *a))) (ar a)) - :: - ++ peach - |* a/{rule rule} - |= tub/nail - ^- (like (each _(wonk (-.a)) _(wonk (+.a)))) - %. tub - ;~(pose (stag %& -.a) (stag %| +.a)) - :: - ++ head-rush - |* a/rule - |* {cord *} - =+ nit=(rush +<- a) - ?~ nit ~ - (some [u.nit +>->]) - :: - ++ thot - ^- $-(json (unit thought)) - %- ot :~ - serial+ceri - audience+audi - date+di - speech+spec - == - :: - ++ ceri - ^- $-(json (unit serial)) - (ci (slat %uv) so) - :: - ++ audi - ^- $-(json (unit audience)) - (as (su circ)) - :: - ++ circ - ^- $-(nail (like circle)) - ;~((glue fas) ;~(pfix sig fed:ag) urs:ab) - :: - ++ spec - ^- $-(json (unit speech)) - %- of :~ - lin+(ot say+bo txt+so ~) - url+(su aurf:de-purl:html) - :: exp+(cu |=(a=cord [a ~]) so) - :: inv+(ot ship+(su fed:ag) party+(su urs:ab) ~) - == + ++ noun command :: from %noun -- --- -- +-- diff --git a/mar/talk/report.hoon b/mar/talk/report.hoon index 6de9db1d5c..bb2ba94b7f 100644 --- a/mar/talk/report.hoon +++ b/mar/talk/report.hoon @@ -1,6 +1,6 @@ :: :::: /hoon/report/talk/mar - :: + ::TODO deleteme /? 310 /- talk /+ talk, old-zuse @@ -118,11 +118,11 @@ ++ huma |= human %^ jobe - hand+?~(han ~ [%s u.han]) + han+?~(han ~ [%s u.han]) :- %true ?~ tru ~ =+ u.tru - (jobe first+[%s p] middle+?~(q ~ [%s u.q]) last+[%s r] ~) + (jobe fir+[%s fir] mid+?~(mid ~ [%s u.mid]) las+[%s las] ~) ~ :: ++ loby diff --git a/mar/talk/telegrams.hoon b/mar/talk/telegrams.hoon index 106e05c6b0..d95942b08c 100644 --- a/mar/talk/telegrams.hoon +++ b/mar/talk/telegrams.hoon @@ -12,7 +12,7 @@ =, old-zuse |_ gam/(list telegram) :: -++ grab +++ grab :: convert from |% ++ noun (list telegram) ++ mime |=(^mime (json (rash q.q apex:de-json))) @@ -102,7 +102,7 @@ -- -- :: -++ grow +++ grow :: convert to |% ++ mime [/text/json (as-octs (crip (en-json json)))] ++ json From 3454c2e9165f410a71906eb95ffe21353e070ce5 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 19 Oct 2017 01:59:51 +0200 Subject: [PATCH 191/303] Reverted change that broke /lib/talk.hoon --- lib/talk.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/talk.hoon b/lib/talk.hoon index 1eb7676580..3914a946ec 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -8,7 +8,7 @@ :: :::: :: -=, ^talk +[. ^talk] |_ bol/bowl:gall ++ main :: main story |= who/ship From 7fdcf344e3bdbdedce51cf6ff609f967ac22312f Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 19 Oct 2017 02:05:53 +0200 Subject: [PATCH 192/303] Now using audience instead of (set circle) where appropriate. --- app/talk-agent.hoon | 155 ++++++++++++++++++++--------------------- app/talk-guardian.hoon | 36 +++++----- lib/talk.hoon | 8 +-- sur/talk.hoon | 12 ++-- 4 files changed, 105 insertions(+), 106 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 57400fc83f..b9998d0164 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -44,15 +44,15 @@ mirrors/(map circle config) ::< remote configs :: ui state :: nicks/(map ship nick) ::< human identities - nik/(map (set circle) char) ::< bound circle glyphs - nak/(jug char (set circle)) ::< circle glyph lookup + nik/(map audience char) ::< bound circle glyphs + nak/(jug char audience) ::< circle glyph lookup cli/shell ::< interaction state == :: ++ shell ::> console session $: id/bone ::< identifier latest/@ud ::< latest shown msg num say/sole-share ::< console state - active/(set circle) ::< active targets + active/audience ::< active targets settings/(set term) ::< frontend settings == :: ++ move (pair bone card) ::< all actions @@ -71,7 +71,7 @@ ++ work ::> interface action $% :: circle management :: {$join p/(map circle range)} ::< subscribe to - {$leave p/where} ::< unsubscribe from + {$leave p/audience} ::< unsubscribe from {$create p/security q/naem r/cord} ::< create circle {$delete p/naem q/(unit cord)} ::< delete circle {$depict p/naem q/cord} ::< change description @@ -80,27 +80,26 @@ {$banish p/naem q/(set ship)} ::< deny permission {$source p/naem q/(map circle range)} ::< add source :: personal metadata - {$attend p/(set circle) q/presence} ::< set our presence - {$name p/(set circle) q/human} ::< set our name + {$attend p/audience q/presence} ::< set our presence + {$name p/audience q/human} ::< set our name :: messaging :: {$say p/(list speech)} ::< send message {$eval p/cord q/twig} ::< send #-message - {$target p/where q/(unit work)} ::< set active targets + {$target p/audience q/(unit work)} ::< set active targets {$reply p/$@(@ud {@u @ud}) q/(list speech)} ::< reply to :: displaying info :: {$number p/$@(@ud {@u @ud})} ::< relative/absolute - {$who p/where} ::< presence - {$what p/$@(char (set circle))} ::< show bound glyph + {$who p/audience} ::< presence + {$what p/$@(char audience)} ::< show bound glyph :: ui settings :: - {$bind p/char q/(unit where)} ::< bind glyph - {$unbind p/char q/(unit where)} ::< unbind glyph + {$bind p/char q/(unit audience)} ::< bind glyph + {$unbind p/char q/(unit audience)} ::< unbind glyph {$nick p/(unit ship) q/(unit cord)} ::< un/set/show nick {$set p/term} ::< enable setting {$unset p/term} ::< disable setting :: miscellaneous :: {$help $~} ::< print usage info == :: - ++ where (set circle) ::< non-empty audience ++ glyphs `wall`~[">=+-" "}),." "\"'`^" "$%&@"] ::< circle char pool ' ++ termwidth 80 ::TODO put in setting or something? -- @@ -166,11 +165,11 @@ ::TODO ...we really should rename these. |= nek/_nak ^+ nik - %- ~(gas by *(map (set circle) char)) + %- ~(gas by *(map audience char)) =- (zing -) %+ turn ~(tap by nek) - |= {a/char b/(set (set circle))} - (turn ~(tap by b) |=(c/(set circle) [c a])) + |= {a/char b/(set audience)} + (turn ~(tap by b) |=(c/audience [c a])) :: ::> || ::> || %engines @@ -353,9 +352,9 @@ ++ ta-change-glyph ::< apply changed glyphs ::> applies new set of glyph bindings. :: - |= {bin/? gyf/char pas/(set circle)} + |= {bin/? gyf/char aud/audience} ^+ +> - =+ nek=(change-glyphs nak bin gyf pas) + =+ nek=(change-glyphs nak bin gyf aud) ?: =(nek nak) +>.$ :: no change =. nak nek =. nik (nik-from-nak nek) @@ -904,21 +903,21 @@ ::> applies glyph binding to our state and sends ::> an action. :: - |= {cha/char pas/(set circle)} - =: nik (~(put by nik) pas cha) - nak (~(put ju nak) cha pas) + |= {cha/char aud/audience} + =: nik (~(put by nik) aud cha) + nak (~(put ju nak) cha aud) == - (sh-act %glyph cha pas &) + (sh-act %glyph cha aud &) :: ++ unset-glyph ::< old glyph binding - ::> removes either {pas} or all bindings on a + ::> removes either {aud} or all bindings on a ::> glyph and sends an action. :: - |= {cha/char pas/(unit (set circle))} - =/ ole/(set (set circle)) - ?^ pas [u.pas ~ ~] + |= {cha/char aud/(unit audience)} + =/ ole/(set audience) + ?^ aud [u.aud ~ ~] (~(get ju nak) cha) - =. ..sh-work (sh-act %glyph cha (fall pas ~) |) + =. ..sh-work (sh-act %glyph cha (fall aud ~) |) |- ^+ ..sh-work ?~ ole ..sh-work =. ..sh-work $(ole l.ole) @@ -1034,18 +1033,18 @@ ::+| :: ++ attend ::< set our presence - ::> sets our presence to {pec} in circles {cis}. + ::> sets our presence to {pec} for {aud}. :: - |= {cis/(set circle) pec/presence} + |= {aud/audience pec/presence} ^+ ..sh-work - (sh-act %notify cis pec) + (sh-act %notify aud pec) :: ++ name ::< set our name - ::> sets our name to {man} in circles {cis}. + ::> sets our name to {man} for {aud}. :: - |= {cis/(set circle) man/human} + |= {aud/audience man/human} ^+ ..sh-work - (sh-act %naming cis man) + (sh-act %naming aud man) :: ::> || ::> || %messaging @@ -1071,9 +1070,9 @@ ++ target ::< %target ::> sets messaging target, then execute {woe}. :: - |= {pan/(set circle) woe/(unit ^work)} + |= {aud/audience woe/(unit ^work)} ^+ ..sh-work - =. ..sh-pact (sh-pact pan) + =. ..sh-pact (sh-pact aud) ?~(woe ..sh-work work(job u.woe)) :: ++ reply ::< %reply @@ -1120,7 +1119,7 @@ ++ what ::< %what ::> prints binding details. goes both ways. :: - |= qur/$@(char (set circle)) + |= qur/$@(char audience) ^+ ..sh-work ?^ qur =+ cha=(~(get by nik) qur) @@ -1128,7 +1127,7 @@ =+ pan=~(tap in (~(get ju nak) qur)) ?: =(~ pan) (sh-fact %txt "~") =< (sh-fact %mor (turn pan .)) - |=(a/(set circle) [%txt ~(ar-prom ar a)]) + |=(a/audience [%txt ~(ar-prom ar a)]) :: ++ number ::< %number ::> finds selected message, expand it. @@ -1155,27 +1154,27 @@ ::+| :: ++ bind ::< %bind - ::> binds targets {pas} to the glyph {cha}. + ::> binds targets {aud} to the glyph {cha}. :: - |= {cha/char pas/(unit (set circle))} + |= {cha/char aud/(unit audience)} ^+ ..sh-work - ?~ pas $(pas `active.she) - =+ ole=(~(get by nik) u.pas) + ?~ aud $(aud `active.she) + =+ ole=(~(get by nik) u.aud) ?: =(ole [~ cha]) ..sh-work - %. "bound {} {}" - sh-note:sh-prod:(set-glyph cha u.pas) + %. "bound {} {}" + sh-note:sh-prod:(set-glyph cha u.aud) :: ++ unbind ::< %unbind - ::> unbinds targets {pas} to glyph {cha}. + ::> unbinds targets {aud} to glyph {cha}. :: - |= {cha/char pan/(unit (set circle))} + |= {cha/char aud/(unit audience)} ^+ ..sh-work - ?. ?| &(?=(^ pan) (~(has by nik) u.pan)) - &(?=($~ pan) (~(has by nak) cha)) + ?. ?| &(?=(^ aud) (~(has by nik) u.aud)) + &(?=($~ aud) (~(has by nak) cha)) == ..sh-work %. "unbound {}" - sh-note:sh-prod:(unset-glyph cha pan) + sh-note:sh-prod:(unset-glyph cha aud) :: ++ nick ::< %nick ::> either shows, sets or unsets nicknames @@ -1248,49 +1247,49 @@ -- :: ++ sh-pact ::< update active aud - ::> change currently selected audience to {lix} + ::> change currently selected audience to {aud} ::> and update the prompt. :: - |= lix/(set circle) + |= aud/audience ^+ +> ::> ensure we can see what we send. - =+ act=(sh-pare lix) + =+ act=(sh-pare aud) ?: =(active.she act) +>.$ sh-prod(active.she act) :: ++ sh-pare ::< adjust target list - ::> if the audience {cis} does not contain a + ::> 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). :: - |= cis/(set circle) - ?: (sh-pear cis) cis - (~(put in cis) incir) + |= 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 {cis}. + ::> sent to {aud}. :: - |= cis/(set circle) - ?~ cis | - ?| (~(has in sources) `circle`n.cis) - $(cis l.cis) - $(cis r.cis) + |= 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 (set circle)) + |= cha/char ^- (unit audience) =+ lax=(~(get ju nak) cha) ::> no circle. ?: =(~ lax) ~ ::> single circle. ?: ?=({* $~ $~} lax) `n.lax - ::> in case of multiple circles, pick the most recently active one. - |- ^- (unit (set circle)) + ::> 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)) @@ -1440,7 +1439,7 @@ %+ sh-fact %pro :+ & %talk-line ^- tape - =/ rew/(pair (pair cord cord) (set circle)) + =/ rew/(pair (pair cord cord) audience) [['[' ']'] active.she] =+ cha=(~(get by nik) q.rew) ?^ cha ~[u.cha ' '] @@ -1762,28 +1761,28 @@ ::> used for representing audiences (sets of circles) ::> as tapes. :: - |_ ::> lix: members of the audience. + |_ ::> aud: members of the audience. :: - lix/(set circle) + aud/audience :: ++ ar-best ::< most relevant ::> find the most relevant circle in the set. :: ^- (unit circle) - ?~ lix ~ + ?~ aud ~ :- ~ |- ^- circle - =+ lef=`(unit circle)`ar-best(lix l.lix) - =+ rit=`(unit circle)`ar-best(lix r.lix) - =? n.lix ?=(^ lef) (~(pr-best pr n.lix) u.lef) - =? n.lix ?=(^ rit) (~(pr-best pr n.lix) u.rit) - n.lix + =+ lef=`(unit circle)`ar-best(aud l.aud) + =+ rit=`(unit circle)`ar-best(aud r.aud) + =? n.aud ?=(^ lef) (~(pr-best pr n.aud) u.lef) + =? n.aud ?=(^ rit) (~(pr-best pr n.aud) u.rit) + n.aud :: ++ ar-deaf ::< except for self ::> remove ourselves from the audience. :: ^+ . - .(lix (~(del in lix) `circle`incir)) + .(aud (~(del in aud) `circle`incir)) :: ++ ar-maud ::< multiple audience ::> checks if there's multiple circles in the @@ -1791,7 +1790,7 @@ :: ^- ? =. . ar-deaf - !?=($@($~ {* $~ $~}) lix) + !?=($@($~ {* $~ $~}) aud) :: ++ ar-prom ::< render targets ::> render all circles, ordered by relevance. @@ -1799,7 +1798,7 @@ ^- tape =. . ar-deaf =/ all - %+ sort `(list circle)`~(tap in lix) + %+ sort `(list circle)`~(tap in aud) |= {a/circle b/circle} (~(pr-beat pr a) b) =+ fir=& @@ -1831,11 +1830,11 @@ ::> complex audiences, use reserved "glyphs". :: ^- tape - =+ cha=(~(get by nik) lix) + =+ cha=(~(get by nik) aud) ?^ cha ~[u.cha ' '] - ?. (lien ~(tap by lix) ar-dire) + ?. (lien ~(tap by aud) ar-dire) "* " - ?: ?=({^ $~ $~} lix) + ?: ?=({^ $~ $~} aud) ": " "; " -- diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 348f2d98e2..d1e9c9e736 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -40,7 +40,7 @@ outbox/(map serial tracking) ::< sent messages log/(map naem @ud) ::< logged to clay nicks/(map ship nick) ::< local nicknames - binds/(jug char (set circle)) ::< circle glyph lookup + binds/(jug char audience) ::< circle glyph lookup == :: ++ story ::> wire content $: count/@ud ::< (lent grams) @@ -325,11 +325,11 @@ ++ present ::< send status update ::> :: - |= {cis/(set circle) dif/diff-status} + |= {aud/audience dif/diff-status} ^+ ..ta-action =/ cic ^- (jug ship naem) - %- ~(rep in cis) + %- ~(rep in aud) |= {c/circle m/(jug ship naem)} (~(put ju m) hos.c nom.c) =? ..ta-action (~(has by cic) our.bol) @@ -417,14 +417,14 @@ ::> action generating a serial and setting a ::> timestamp. :: - |= {cis/(set circle) ses/(list speech)} + |= {aud/audience ses/(list speech)} ^+ ..ta-action =- (ta-think & our.bol tos) |- ^- tos/(list thought) ?~ ses ~ =^ sir eny.bol (uniq eny.bol) :_ $(ses t.ses) - [sir cis [now.bol i.ses]] + [sir aud [now.bol i.ses]] :: ::> || %personal-metadata ::+| @@ -432,16 +432,16 @@ ++ action-notify ::< our presence update ::> :: - |= {cis/(set circle) pes/presence} + |= {aud/audience pes/presence} ^+ ..ta-action - (present cis %presence pes) + (present aud %presence pes) :: ++ action-naming ::< our name update ::> :: - |= {cis/(set circle) man/human} + |= {aud/audience man/human} ^+ ..ta-action - (present cis %human %full man) + (present aud %human %full man) :: ::> || %changing-shared-ui ::+| @@ -455,10 +455,10 @@ (ta-delta %nick who nic) :: ++ action-glyph ::< bind a glyph - ::> un/bind glyph {lif} to circles {cis}. + ::> un/bind glyph {lif} to audience {aud}. :: - |= {lif/char cis/(set circle) bin/?} - (ta-delta %glyph bin lif cis) + |= {lif/char aud/audience bin/?} + (ta-delta %glyph bin lif aud) -- :: ::> || @@ -1126,7 +1126,7 @@ %- so-act :- %phrase %- ~(rep in sus) - |= {s/ship a/(set circle) t/(list speech)} + |= {s/ship a/audience t/(list speech)} :- (~(put in a) [s (main s)]) [[%inv inv so-cir] t] (so-delta-our %config so-cir %permit [add sus]) @@ -1298,16 +1298,16 @@ :: ++ da-change-glyph ::< un/bound glyph ::> apply a %glyph delta, un/binding a glyph to/from - ::> a set of circles. + ::> an audience. :: - |= {bin/? gyf/char cis/(set circle)} + |= {bin/? gyf/char aud/audience} ^+ +> ?: bin %_ +> - binds (~(put ju binds) gyf cis) + binds (~(put ju binds) gyf aud) == - =/ ole/(list (set circle)) - ?. =(cis ~) [cis ~] + =/ ole/(list audience) + ?. =(aud ~) [aud ~] ~(tap in (~(get ju binds) gyf)) |- ^+ +>.^$ ?~ ole +>.^$ diff --git a/lib/talk.hoon b/lib/talk.hoon index 3914a946ec..f654794031 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -89,14 +89,14 @@ ++ change-glyphs ::< ... ::> :: - |= {gys/(jug char (set circle)) bin/? gyf/char cis/(set circle)} + |= {gys/(jug char audience) bin/? gyf/char aud/audience} ^+ gys :: simple bind. - ?: bin (~(put ju gys) gyf cis) + ?: bin (~(put ju gys) gyf aud) :: unbind all of glyph. - ?~ cis (~(del by gys) gyf) + ?~ aud (~(del by gys) gyf) :: unbind single. - (~(del ju gys) gyf cis) + (~(del ju gys) gyf aud) :: ++ change-nicks ::< change nick map ::> changes a nickname in a map, adding if it doesn't diff --git a/sur/talk.hoon b/sur/talk.hoon index 911e9b8a1d..8fc8042751 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -77,7 +77,7 @@ {$circle package} ::< /circle == :: ++ prize-reader :: - $: gys/(jug char (set circle)) ::< glyph bindings + $: gys/(jug char audience) ::< glyph bindings nis/(map ship nick) ::< local nicknames == :: ++ rumor ::< query result change @@ -100,7 +100,7 @@ cos/lobby ::< loc & rem configs pes/crowd ::< loc & rem presences == :: -++ diff-glyph {bin/? gyf/char pas/(set circle)} ::< un/bound glyph +++ diff-glyph {bin/? gyf/char aud/audience} ::< un/bound glyph ++ diff-nick {who/ship nic/nick} ::< changed nickname ++ diff-story ::> story change $% {$new cof/config} ::< new story @@ -151,12 +151,12 @@ {$source nom/naem sub/? srs/(set source)} ::< un/sub to/from src :: messaging :: {$convey tos/(list thought)} ::< post exact - {$phrase aud/(set circle) ses/(list speech)} ::< post easy + {$phrase aud/audience ses/(list speech)} ::< post easy :: personal metadata :: - {$notify cis/(set circle) pes/presence} ::< our presence update - {$naming cis/(set circle) man/human} ::< our name update + {$notify aud/audience pes/presence} ::< our presence update + {$naming aud/audience man/human} ::< our name update :: changing shared ui :: - {$glyph gyf/char pas/(set circle) bin/?} ::< un/bind a glyph + {$glyph gyf/char aud/audience bin/?} ::< un/bind a glyph {$nick who/ship nic/nick} ::< new identity == :: :: From 7d4e0512cf975d1cae00cb9c3a1043cb38d54e8d Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 19 Oct 2017 23:58:18 +0200 Subject: [PATCH 193/303] Largely complete /lib/talk-json (still missing diffs), /mar/talk/action. --- lib/talk-json.hoon | 211 +++++++++++++++++++++++++++++++++++++------ mar/talk/action.hoon | 50 ++++++++-- 2 files changed, 226 insertions(+), 35 deletions(-) diff --git a/lib/talk-json.hoon b/lib/talk-json.hoon index ed78b10991..30093b3616 100644 --- a/lib/talk-json.hoon +++ b/lib/talk-json.hoon @@ -3,23 +3,155 @@ :: /- talk :: -::> rules for sur-json conversion: (proposal, adhered to below) +::> proposed rules for sur-json conversion, adhered to below: ::> 1. to save the devs from having to learn multiple interfaces, try to match ::> the hoon structure as closely as possible, including attribute names. -::> 2. if these names are p/q/r, slightly more semantic naming is preferred. +::> 2. if these names are p/q/r, ~slightly more semantic naming is preferred~ +::> fix that in the sur file. ::> 2. when dealing with $%, the tag is the variable name. ie `{$x ...}` -> `x` ::> for tagged unions with one piece of data, `x` holds that value. ::> for tagged unions with multiple pieces of data, `x` is an object. -::> 3. ... +::> 3. lists and sets become arrays. maps become objects. +::> 4. stringify cells only when/in a way such that it benefits the majority of +::> foreseen usecases. :: -=, talk |% -++ en-json ::> sur to json +++ en-tape ::> sur to tape + =, talk |% + ++ circ ::> circle + |= a/circle + :(weld (scow %p hos.a) "/" (trip nom.a)) + :: + ++ rang ::> range + |= a/range + ?~ a ~ + ;: weld + "/" (scow hed.u.a) + ?~ tal.u.a ~ + (scow u.tal.u.a) + == + :: + ++ sorc ::> source + |= a/source + (weld (circ cir.a) (rang ran.a)) + -- +:: +++ de-tape ::> tape to sur (parse) + =, talk + |% + ++ circ ::> circle + ;~((glue fas) ;~(pfix sig fed:ag) urt:ab) + :: + ++ rang ::> range + =/ pont + ;~ pose + (stag %ud dim:ag) + %+ stag %da + %+ sear + |= a/coin + ^- (unit @da) + ?. ?=({$$ $da @da} a) ~ + `q.p.a + nuck:so + == + =+ ;~ pose + (cook some ;~(pfix fas pont)) + (easy ~) + == + ;~ pose + (cook some ;~(plug ;~(pfix fas pont) -)) + (easy ~) + == + :: + ++ sorc ::> source + ;~(plug circ rang) + -- +:: +++ en-json ::> sur to json + =, talk + =, enjs:format + |% + ::TODO these first few should probably make their way + :: into the stdlib... + ++ sa ::> set as array + |* {a/(set) b/$-(* json)} + ^- json + [%a ~(tap in (~(run in a) b))] + :: + ++ dank ::> tank + |= a/tank + ?: ?=($leaf -.a) (frond %leaf (tape p.a)) + %+ frond -.a + %- pairs + ?- -.a + $palm + :+ :- %style + %- pairs :~ + mid+(tape p.p.a) + cap+(tape q.p.a) + open+(tape r.p.a) + close+(tape s.p.a) + == + lines+a+(turn q.a dank) + ~ + $rose + :+ :- %style + %- pairs :~ + mid+(tape p.p.a) + open+(tape q.p.a) + close+(tape r.p.a) + == + lines+a+(turn q.a dank) + ~ + == + :: + :: + ++ circ ::> circle + |= a/circle + ^- json + s+(crip (circ:en-tape a)) + :: + ++ filt ::> filter + |= a/filter + ^- json + (pairs cas+b+cas.a utf+b+utf.a ~) + :: + ++ sorc ::> source + |= a/source + ^- json + s+(crip (sorc:en-tape a)) + :: ++ spec ::> speech + |= a/speech + ^- json + :: only %url has just a single piece of data. + ?: ?=($url -.a) + (frond %url s+(crip (apix:en-purl:html url.a))) + %+ frond -.a + %- pairs + ?- -.a + $lin ~[pat+b+pat.a msg+s+msg.a] + $exp ~[exp+s+exp.a res+a+(turn res.a dank)] + $ire ~[top+s+(scot %uv top.a) sep+(spec sep.a)] ::TODO @uv as number? + $fat ~[tac+(atta tac.a) sep+(spec sep.a)] + $inv ~[inv+b+inv.a cir+(circ cir.a)] + $app ~[app+s+app.a msg+s+msg.a] + == + :: + ++ atta ::> attache + |= a/attache + ^- json + %+ frond -.a + ?- -.a + $name (pairs nom+s+nom.a tac+(atta tac.a) ~) + $text s+(of-wain:format +.a) + $tank a+(turn +.a dank) + == -- :: ++ de-json ::> json to sur + =, talk =, dejs-soft:format |% ::TODO these first few should maybe make their way @@ -40,8 +172,8 @@ ++ dist ^- $-(json (unit diff-status)) %- of :~ - full+(ot pec+(su pres) man+huma ~) - presence+(su pres) + full+(ot pec+pres man+huma ~) + presence+pres human+dihu remove+ul == @@ -51,7 +183,7 @@ %- of :~ full+huma handle+(mu so) - true+ + true+(mu trun) == :: ::> || @@ -60,22 +192,29 @@ ::> messaging targets and their metadata. ::+| :: + ::TODO maybe just an object? ++ circ ::> circle - ^- $-(nail (like circle)) - ;~((glue fas) ;~(pfix sig fed:ag) urt:ab) + ^- $-(json (unit circle)) + (su circ:de-tape) + :: + ::TODO maybe just an object? + ++ sorc ::> source + ^- $-(json (unit source)) + (su sorc:de-tape) + :: + ++ filt ::> filter + ^- $-(json (unit filter)) + (ot cas+bo utf+bo ~) :: ++ pres ::> presence - ^- $-(nail (like presence)) - (perk %gone %idle %hear %talk ~) + ^- $-(json (unit presence)) + (su (perk %gone %idle %hear %talk ~)) :: ++ huma ::> human ^- $-(json (unit human)) - %- ot :~ - han+(mu so) - tru+(mu true) - == + (ot han+(mu so) tru+(mu trun) ~) :: - ++ true ::> truename + ++ trun ::> truename ^- $-(json (unit truename)) (ot fir+so mid+(mu so) las+so ~) :: @@ -85,6 +224,21 @@ ::> structures for containing main message data. ::+| :: + ::++ enve ::> envelope + :: ^- $-(json (unit thought)) + :: (ot num+ni gam+gram ~) + :: + ++ gram ::> telegram + ^- $-(json (unit telegram)) + %- ot :~ + aut+(su fed:ag) + ::TODO can we do anything about this duplication? + uid+seri + aud+audi + wen+di + sep+spec + == + :: ++ thot ::> thought ^- $-(json (unit thought)) %- ot :~ @@ -95,21 +249,22 @@ == :: ++ spec ::> speech - ^- $-(json (unit speech)) - %- of :~ - lin+(ot pat+bo txt+so ~) - url+(su aurf:de-purl:html) - exp+(ot exp+so res+(ar dank) ~) - ire+(ot top+seri sep+spec ~) - fat+(ot tac+atta sep+spec ~) - inv+(ot inv+bo cir+(su circ) ~) - == + ::^- $-(json (unit speech)) + (of lin+(ot pat+bo txt+so ~) ~) + ::%- of :~ + :: lin+(ot pat+bo txt+so ~) + :: url+(su aurf:de-purl:html) + :: exp+(ot exp+so res+(ar dank) ~) + :: ire+(ot top+seri sep+spec ~) + :: fat+(ot tac+atta sep+spec ~) + :: inv+(ot inv+bo cir+circ ~) + ::== :: ++ atta ::> attache ^- $-(json (unit attache)) %- of :~ name+(ot nom+so tac+atta ~) - text+(ar so) + text+(cu to-wain:format so) tank+(ar dank) == :: @@ -125,6 +280,6 @@ :: ++ audi ::> audience ^- $-(json (unit audience)) - (as (su circ)) + (as circ) -- -- diff --git a/mar/talk/action.hoon b/mar/talk/action.hoon index 8ca423cfd4..4803a31843 100644 --- a/mar/talk/action.hoon +++ b/mar/talk/action.hoon @@ -1,26 +1,62 @@ :: -:::: /mar/talk/rumor/hoon +:::: /mar/talk/action/hoon :: /- talk /+ talk-json :: -=, talk -|_ dif/action +|_ act/action:talk :: ++ grab ::> convert from |% - ++ noun action ::< from %noun + ++ noun action:talk ::< from %noun ++ json ::> from %json + =, de-json:talk-json =, dejs-soft:format - =, talk-json:de-json - |= a/json ^- action + |= a/json + ^- action:talk =- (need ((of -) a)) - :~ create+ul + :~ create+(ot nom+so des+so sec+pres ~) + delete+(ot nom+so why+(mu so) ~) + depict+(ot nom+so des+so ~) + filter+(ot nom+so fit+filt ~) + permit+(ot nom+so inv+bo sis+audi ~) + source+(ot nom+so aub+bo srs+(as sorc) ~) + :: + convey+(ar thot) + phrase+(ot aud+audi ses+(ar spec) ~) + :: + notify+(ot aud+audi pes+prec ~) + naming+(ot aud+audi man+huma ~) + :: + glyph+(ot gyf+so aud+audi bin+bo ~) + nick+(ot who+ship nic+so ~) == -- :: ++ grow ::> convert to |% ++ json ::> to %json + =, en-json:talk-json + =, enjs:format + %+ frond -.act + ::> only %convey has just a single piece of data. + ?: ?=($convey -.act) a+(turn tos.act thot) + %- pairs + ?- -.act + $create ~[nom+s+nom.act des+s+des.act sec+s+sec.act] + $delete ~[nom+s+nom.act why+?~(why.sec ~ s+why.sec)] + $depict ~[nom+s+nom.act des+s+des.act] + $filter ~[nom+s+nom.act fit+(filt fit.act)] + $permit ~[nom+s+nom.act inv+b+inv.act sis+(sa sis.act ship)] + $source ~[nom+s+nom.act sub+b+sub.act srs+(sa srs.act sorc)] + :: + $phrase ~[aud+(sa aud.act circ) ses+a+(turn ses.act spec)] + :: + $notify ~[aud+(sa cis.act circ) pes+(prec pes.act)] + $naming ~[aud+(sa cis.act circ) man+(huma man.act)] + :: + $glyph ~[gyf+s+gyf.act aud+(sa circ) bin+b+bin.act] + $nick ~[who+s+(ship who.act) nic+s+nic.act] + == -- -- From b6df30e006361ff441ff7fc9f9c6f58857c27f27 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 20 Oct 2017 17:42:07 +0200 Subject: [PATCH 194/303] /mar/talk/action to json works. From json currently dig-overs. --- lib/talk-json.hoon | 61 ++++++++++++++++++++++++++++++++++++-------- mar/talk/action.hoon | 44 ++++++++++++++++---------------- 2 files changed, 72 insertions(+), 33 deletions(-) diff --git a/lib/talk-json.hoon b/lib/talk-json.hoon index 30093b3616..b44fa57afe 100644 --- a/lib/talk-json.hoon +++ b/lib/talk-json.hoon @@ -14,6 +14,8 @@ ::> 3. lists and sets become arrays. maps become objects. ::> 4. stringify cells only when/in a way such that it benefits the majority of ::> foreseen usecases. +::> +::> q: should parsing be strict or forgiving? ie, accept "ship" and/or "~ship"? :: |% ++ en-tape ::> sur to tape @@ -77,7 +79,7 @@ ++ sa ::> set as array |* {a/(set) b/$-(* json)} ^- json - [%a ~(tap in (~(run in a) b))] + [%a ~(tap in `(set json)`(~(run in a) b))] :: ++ dank ::> tank |= a/tank @@ -106,6 +108,15 @@ ~ == :: + ++ cord ::> string from cord + |= a/@t + s+a + :: + ++ mabe ::> null or value + |* {a/(unit) b/$-(* json)} + ^- json + ?~(a ~ (b u.a)) + :: :: ++ circ ::> circle |= a/circle @@ -122,6 +133,26 @@ ^- json s+(crip (sorc:en-tape a)) :: + ++ huma ::> human + |= a/human + ^- json + (pairs han+(mabe han.a cord) tru+(mabe tru.a trun) ~) + :: + ++ trun ::> truename + |= a/truename + ^- json + (pairs fir+s+fir.a mid+(mabe mid.a cord) las+s+las.a ~) + :: + ++ thot ::> thought + |= a/thought + ^- json + %- pairs :~ + uid+s+(scot %uv uid.a) + aud+(audi aud.a) + wen+(time wen.a) + sep+(spec sep.a) + == + :: ++ spec ::> speech |= a/speech ^- json @@ -148,6 +179,11 @@ $text s+(of-wain:format +.a) $tank a+(turn +.a dank) == + :: + ++ audi ::> audience + |= a/audience + ^- json + (sa a circ) -- :: ++ de-json ::> json to sur @@ -206,6 +242,10 @@ ^- $-(json (unit filter)) (ot cas+bo utf+bo ~) :: + ++ secu ::> security + ^- $-(json (unit security)) + (su (perk %black %white %green %brown ~)) + :: ++ pres ::> presence ^- $-(json (unit presence)) (su (perk %gone %idle %hear %talk ~)) @@ -249,16 +289,15 @@ == :: ++ spec ::> speech - ::^- $-(json (unit speech)) - (of lin+(ot pat+bo txt+so ~) ~) - ::%- of :~ - :: lin+(ot pat+bo txt+so ~) - :: url+(su aurf:de-purl:html) - :: exp+(ot exp+so res+(ar dank) ~) - :: ire+(ot top+seri sep+spec ~) - :: fat+(ot tac+atta sep+spec ~) - :: inv+(ot inv+bo cir+circ ~) - ::== + ^- $-(json (unit speech)) + %- of :~ + lin+(ot pat+bo txt+so ~) + url+(su aurf:de-purl:html) + exp+(ot exp+so res+(ar dank) ~) + ire+(ot top+seri sep+spec ~) + fat+(ot tac+atta sep+spec ~) + inv+(ot inv+bo cir+circ ~) + == :: ++ atta ::> attache ^- $-(json (unit attache)) diff --git a/mar/talk/action.hoon b/mar/talk/action.hoon index 4803a31843..bf9f055e8d 100644 --- a/mar/talk/action.hoon +++ b/mar/talk/action.hoon @@ -10,53 +10,53 @@ |% ++ noun action:talk ::< from %noun ++ json ::> from %json - =, de-json:talk-json + ::=, de-json:talk-json =, dejs-soft:format |= a/json ^- action:talk =- (need ((of -) a)) - :~ create+(ot nom+so des+so sec+pres ~) + :~ create+(ot nom+so des+so sec+secu:de-json:talk-json ~) delete+(ot nom+so why+(mu so) ~) depict+(ot nom+so des+so ~) - filter+(ot nom+so fit+filt ~) - permit+(ot nom+so inv+bo sis+audi ~) - source+(ot nom+so aub+bo srs+(as sorc) ~) + filter+(ot nom+so fit+filt:de-json:talk-json ~) + permit+(ot nom+so inv+bo sis+(as:de-json:talk-json (su fed:ag)) ~) + source+(ot nom+so aub+bo srs+(as:de-json:talk-json sorc:de-json:talk-json) ~) :: - convey+(ar thot) - phrase+(ot aud+audi ses+(ar spec) ~) + convey+(ar thot:de-json:talk-json) + phrase+(ot aud+audi:de-json:talk-json ses+(ar spec:de-json:talk-json) ~) :: - notify+(ot aud+audi pes+prec ~) - naming+(ot aud+audi man+huma ~) + notify+(ot aud+audi pes+pres ~):de-json:talk-json + naming+(ot aud+audi man+huma ~):de-json:talk-json :: - glyph+(ot gyf+so aud+audi bin+bo ~) - nick+(ot who+ship nic+so ~) + glyph+(ot gyf+so aud+audi:de-json:talk-json bin+bo ~) + nick+(ot who+(su fed:ag) nic+so ~) == -- :: ++ grow ::> convert to |% ++ json ::> to %json - =, en-json:talk-json + ::=, en-json:talk-json =, enjs:format %+ frond -.act ::> only %convey has just a single piece of data. - ?: ?=($convey -.act) a+(turn tos.act thot) + ?: ?=($convey -.act) a+(turn tos.act thot:en-json:talk-json) %- pairs ?- -.act $create ~[nom+s+nom.act des+s+des.act sec+s+sec.act] - $delete ~[nom+s+nom.act why+?~(why.sec ~ s+why.sec)] + $delete ~[nom+s+nom.act why+(mabe:en-json:talk-json why.act cord:en-json:talk-json)] $depict ~[nom+s+nom.act des+s+des.act] - $filter ~[nom+s+nom.act fit+(filt fit.act)] - $permit ~[nom+s+nom.act inv+b+inv.act sis+(sa sis.act ship)] - $source ~[nom+s+nom.act sub+b+sub.act srs+(sa srs.act sorc)] + $filter ~[nom+s+nom.act fit+(filt:en-json:talk-json fit.act)] + $permit ~[nom+s+nom.act inv+b+inv.act sis+(sa:en-json:talk-json sis.act ship)] + $source ~[nom+s+nom.act sub+b+sub.act srs+(sa:en-json:talk-json srs.act sorc:en-json:talk-json)] :: - $phrase ~[aud+(sa aud.act circ) ses+a+(turn ses.act spec)] + $phrase ~[aud+(audi:en-json:talk-json aud.act) ses+a+(turn ses.act spec:en-json:talk-json)] :: - $notify ~[aud+(sa cis.act circ) pes+(prec pes.act)] - $naming ~[aud+(sa cis.act circ) man+(huma man.act)] + $notify ~[aud+(audi:en-json:talk-json aud.act) pes+s+pes.act] + $naming ~[aud+(audi:en-json:talk-json aud.act) man+(huma:en-json:talk-json man.act)] :: - $glyph ~[gyf+s+gyf.act aud+(sa circ) bin+b+bin.act] - $nick ~[who+s+(ship who.act) nic+s+nic.act] + $glyph ~[gyf+s+gyf.act aud+(sa:en-json:talk-json aud.act circ:en-json:talk-json) bin+b+bin.act] + $nick ~[who+(ship who.act) nic+s+nic.act] == -- -- From 65ed4c988481a39341f851774dc33771c2a9dc40 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 20 Oct 2017 19:45:24 +0200 Subject: [PATCH 195/303] Fixed recursive reparsers to not dig: over. --- lib/talk-json.hoon | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/talk-json.hoon b/lib/talk-json.hoon index b44fa57afe..02dc0983f7 100644 --- a/lib/talk-json.hoon +++ b/lib/talk-json.hoon @@ -192,12 +192,20 @@ |% ::TODO these first few should maybe make their way :: into the stdlib... + ++ re ::> recursive reparsers + |* {gar/* sef/_|.(fist)} + |= jon/json + ^- (unit _gar) + =- ~! gar ~! (need -) - + ((sef) jon) + :: ++ as ::> array as set |* a/fist (cu ~(gas in *(set _(need *a))) (ar a)) :: ++ dank ::> tank ^- $-(json (unit tank)) + %+ re *tank |. ~+ %- of :~ leaf+sa palm+(ot style+(ot mid+sa cap+sa open+sa close+sa ~) lines+(ar dank) ~) @@ -290,6 +298,7 @@ :: ++ spec ::> speech ^- $-(json (unit speech)) + %+ re *speech |. ~+ %- of :~ lin+(ot pat+bo txt+so ~) url+(su aurf:de-purl:html) From e990975c39cca74d3524718c99b5c9c235198ee6 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 20 Oct 2017 19:46:02 +0200 Subject: [PATCH 196/303] Some cleanup. /mar/talk/action now fully functional (but untested). --- lib/talk-json.hoon | 4 ++-- mar/talk/action.hoon | 40 ++++++++++++++++++++-------------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/talk-json.hoon b/lib/talk-json.hoon index 02dc0983f7..7eac09051e 100644 --- a/lib/talk-json.hoon +++ b/lib/talk-json.hoon @@ -70,7 +70,7 @@ ;~(plug circ rang) -- :: -++ en-json ::> sur to json +++ enjs ::> sur to json =, talk =, enjs:format |% @@ -186,7 +186,7 @@ (sa a circ) -- :: -++ de-json ::> json to sur +++ dejs ::> json to sur =, talk =, dejs-soft:format |% diff --git a/mar/talk/action.hoon b/mar/talk/action.hoon index bf9f055e8d..abbbabc0ba 100644 --- a/mar/talk/action.hoon +++ b/mar/talk/action.hoon @@ -10,25 +10,25 @@ |% ++ noun action:talk ::< from %noun ++ json ::> from %json - ::=, de-json:talk-json + => [. dejs:talk-json] ::TODO =, =, dejs-soft:format |= a/json ^- action:talk =- (need ((of -) a)) - :~ create+(ot nom+so des+so sec+secu:de-json:talk-json ~) + :~ create+(ot nom+so des+so sec+secu ~) delete+(ot nom+so why+(mu so) ~) depict+(ot nom+so des+so ~) - filter+(ot nom+so fit+filt:de-json:talk-json ~) - permit+(ot nom+so inv+bo sis+(as:de-json:talk-json (su fed:ag)) ~) - source+(ot nom+so aub+bo srs+(as:de-json:talk-json sorc:de-json:talk-json) ~) + filter+(ot nom+so fit+filt ~) + permit+(ot nom+so inv+bo sis+(as (su fed:ag)) ~) + source+(ot nom+so aub+bo srs+(as sorc) ~) :: - convey+(ar thot:de-json:talk-json) - phrase+(ot aud+audi:de-json:talk-json ses+(ar spec:de-json:talk-json) ~) + convey+(ar thot) + phrase+(ot aud+audi ses+(ar spec:dejs:talk-json) ~) :: - notify+(ot aud+audi pes+pres ~):de-json:talk-json - naming+(ot aud+audi man+huma ~):de-json:talk-json + notify+(ot aud+audi pes+pres ~) + naming+(ot aud+audi man+huma ~) :: - glyph+(ot gyf+so aud+audi:de-json:talk-json bin+bo ~) + glyph+(ot gyf+so aud+audi bin+bo ~) nick+(ot who+(su fed:ag) nic+so ~) == -- @@ -36,26 +36,26 @@ ++ grow ::> convert to |% ++ json ::> to %json - ::=, en-json:talk-json + => [. enjs:talk-json] ::TODO =, =, enjs:format %+ frond -.act ::> only %convey has just a single piece of data. - ?: ?=($convey -.act) a+(turn tos.act thot:en-json:talk-json) + ?: ?=($convey -.act) a+(turn tos.act thot) %- pairs ?- -.act $create ~[nom+s+nom.act des+s+des.act sec+s+sec.act] - $delete ~[nom+s+nom.act why+(mabe:en-json:talk-json why.act cord:en-json:talk-json)] + $delete ~[nom+s+nom.act why+(mabe why.act cord:enjs)] $depict ~[nom+s+nom.act des+s+des.act] - $filter ~[nom+s+nom.act fit+(filt:en-json:talk-json fit.act)] - $permit ~[nom+s+nom.act inv+b+inv.act sis+(sa:en-json:talk-json sis.act ship)] - $source ~[nom+s+nom.act sub+b+sub.act srs+(sa:en-json:talk-json srs.act sorc:en-json:talk-json)] + $filter ~[nom+s+nom.act fit+(filt fit.act)] + $permit ~[nom+s+nom.act inv+b+inv.act sis+(sa sis.act ship)] + $source ~[nom+s+nom.act sub+b+sub.act srs+(sa srs.act sorc)] :: - $phrase ~[aud+(audi:en-json:talk-json aud.act) ses+a+(turn ses.act spec:en-json:talk-json)] + $phrase ~[aud+(audi aud.act) ses+a+(turn ses.act spec:enjs)] :: - $notify ~[aud+(audi:en-json:talk-json aud.act) pes+s+pes.act] - $naming ~[aud+(audi:en-json:talk-json aud.act) man+(huma:en-json:talk-json man.act)] + $notify ~[aud+(audi aud.act) pes+s+pes.act] + $naming ~[aud+(audi aud.act) man+(huma man.act)] :: - $glyph ~[gyf+s+gyf.act aud+(sa:en-json:talk-json aud.act circ:en-json:talk-json) bin+b+bin.act] + $glyph ~[gyf+s+gyf.act aud+(sa aud.act circ) bin+b+bin.act] $nick ~[who+(ship who.act) nic+s+nic.act] == -- From fddfe88d2b0e4785ad75139b534a8f326463c799 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 24 Oct 2017 15:19:41 +0200 Subject: [PATCH 197/303] Implemented /mar/talk/prize and all necessary additions to /lib/talk-json. Requires small change in zuse to compile. Under investigation. --- lib/talk-json.hoon | 146 +++++++++++++++++++++++++++++++++++++++++--- mar/talk/prize.hoon | 36 +++++++++-- 2 files changed, 169 insertions(+), 13 deletions(-) diff --git a/lib/talk-json.hoon b/lib/talk-json.hoon index 7eac09051e..9e1e1594ed 100644 --- a/lib/talk-json.hoon +++ b/lib/talk-json.hoon @@ -79,7 +79,13 @@ ++ sa ::> set as array |* {a/(set) b/$-(* json)} ^- json - [%a ~(tap in `(set json)`(~(run in a) b))] + [%a (turn ~(tap in a) b)] + :: + ++ mo ::> map as object + |* {a/(map) b/$-(* @t) c/$-(* json)} + ^- json + =- (pairs (turn ~(tap by a) -)) + |* {k/* v/*} [(b k) (c v)] :: ++ dank ::> tank |= a/tank @@ -118,20 +124,85 @@ ?~(a ~ (b u.a)) :: :: + ++ pire ::> prize-reader + |= a/prize-reader + ^- json + %- pairs :~ + :- %gys + =- (pairs ~(tap by (~(run by gys.a) -))) + |=((set (set circle)) (sa +< audi)) + :: + nis+(mo nis.a (cury scot %p) cord) + == + :: + ++ pack ::> package + |= a/package + ^- json + %- pairs :~ + nes+a+(turn nes.a enve) ::TODO maybe map + cos+(loby cos.a) + pes+(crow pes.a) + == + :: ++ circ ::> circle |= a/circle ^- json s+(crip (circ:en-tape a)) :: + ++ loby ::> lobby + |= a/lobby + %- pairs :~ + loc+(conf loc.a) + rem+(mo rem.a (cork circ:en-tape crip) conf) + == + :: + ++ conf ::> config + |= a/config + ^- json + %- pairs :~ + src+(sa src.a sorc) + cap+s+cap.a + fit+(filt fit.a) + con+(cont con.a) + == + :: + ++ sorc ::> source + |= a/source + ^- json + s+(crip (sorc:en-tape a)) + :: ++ filt ::> filter |= a/filter ^- json (pairs cas+b+cas.a utf+b+utf.a ~) :: - ++ sorc ::> source - |= a/source + ++ cont ::> control + |= a/control ^- json - s+(crip (sorc:en-tape a)) + (pairs sec+s+sec.a ses+(sa ses.a ship) ~) + :: + ++ crow ::> crowd + |= a/crowd + ^- json + %- pairs :~ + loc+(grop loc.a) + rem+(mo rem.a tmp grop) + == + :: + ++ tmp + |= a/circle + ^- @t + (crip (circ:en-tape a)) + :: + ++ grop ::> group + |= a/group + ^- json + (mo a (cury scot %p) `stat) + :: + ++ stat ::> status + |= a/status + ^- json + (pairs pec+s+pec.a man+(huma man.a) ~) :: ++ huma ::> human |= a/human @@ -143,6 +214,23 @@ ^- json (pairs fir+s+fir.a mid+(mabe mid.a cord) las+s+las.a ~) :: + ++ enve ::> envelope + |= a/envelope + ^- json + (pairs num+(numb num.a) gam+(gram gam.a) ~) + :: + ++ gram ::> telegram + |= a/telegram + ^- json + %- pairs :~ + ::aut+ship + ::TODO can we avoid this code duplication somehow? + uid+s+(scot %uv uid.a) + aud+(audi aud.a) + wen+(time wen.a) + sep+(spec sep.a) + == + :: ++ thot ::> thought |= a/thought ^- json @@ -213,6 +301,21 @@ == :: :: + ++ pire ::> prize-reader + ^- $-(json (unit prize-reader)) + %- ot :~ + gys+(om (as (as circ))) + nis+(op fed:ag so) + == + :: + ++ pack ::> package + ^- $-(json (unit package)) + %- ot :~ + nes+(ar enve) + cos+loby + pes+crow + == + :: ++ dist ^- $-(json (unit diff-status)) %- of :~ @@ -241,6 +344,19 @@ ^- $-(json (unit circle)) (su circ:de-tape) :: + ++ loby ::> lobby + ^- $-(json (unit lobby)) + (ot loc+conf rem+(op circ:de-tape conf) ~) + :: + ++ conf ::> config + ^- $-(json (unit config)) + %- ot :~ + src+(as sorc) + cap+so + fit+filt + con+cont + == + :: ::TODO maybe just an object? ++ sorc ::> source ^- $-(json (unit source)) @@ -250,10 +366,26 @@ ^- $-(json (unit filter)) (ot cas+bo utf+bo ~) :: + ++ cont ::> control + ^- $-(json (unit control)) + (ot sec+secu ses+(as (su fed:ag)) ~) + :: ++ secu ::> security ^- $-(json (unit security)) (su (perk %black %white %green %brown ~)) :: + ++ crow ::> crowd + ^- $-(json (unit crowd)) + (ot loc+grop rem+(op circ:de-tape grop) ~) + :: + ++ grop ::> group + ^- $-(json (unit group)) + (op fed:ag stat) + :: + ++ stat ::> status + ^- $-(json (unit status)) + (ot pec+pres man+huma ~) + :: ++ pres ::> presence ^- $-(json (unit presence)) (su (perk %gone %idle %hear %talk ~)) @@ -272,9 +404,9 @@ ::> structures for containing main message data. ::+| :: - ::++ enve ::> envelope - :: ^- $-(json (unit thought)) - :: (ot num+ni gam+gram ~) + ++ enve ::> envelope + ^- $-(json (unit envelope)) + (ot num+ni gam+gram ~) :: ++ gram ::> telegram ^- $-(json (unit telegram)) diff --git a/mar/talk/prize.hoon b/mar/talk/prize.hoon index aa7b3bc1f0..b89d99c280 100644 --- a/mar/talk/prize.hoon +++ b/mar/talk/prize.hoon @@ -1,14 +1,38 @@ :: :::: /hoon/prize/talk/mar :: -/? 310 /- talk -!: -[talk .] -|_ piz/prize +/+ talk-json :: -++ grab :: convert from +|_ piz/prize:talk +:: +++ grab ::> convert from |% - ++ noun prize :: clam from %noun + ++ noun prize:talk ::< from %noun + ++ json ::> from %json + => [. dejs:talk-json] ::TODO =, + =, dejs-soft:format + |= a/json + ^- prize:talk + =- (need ((of -) a)) + :~ reader+pire + friend+(as circ) + :: burden not needed + circle+pack + == + -- +:: +++ grow ::> convert to + |% + ++ json ::> to %json + => [. enjs:talk-json] ::TODO =, + =, enjs:format + %+ frond -.piz + ?+ -.piz !! + $reader (pire +.piz) + $friend (sa cis.piz circ) + :: burden not needed + $circle (pack +.piz) + == -- -- From 6c7146f988c515321ae3329a3500a573a11be6c1 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 24 Oct 2017 17:24:04 +0200 Subject: [PATCH 198/303] Implemented /mar/talk/rumor. --- lib/talk-json.hoon | 117 +++++++++++++++++++++++++++++++++++++++++++- mar/talk/rumor.hoon | 36 +++++++++++--- 2 files changed, 145 insertions(+), 8 deletions(-) diff --git a/lib/talk-json.hoon b/lib/talk-json.hoon index 9e1e1594ed..1093140179 100644 --- a/lib/talk-json.hoon +++ b/lib/talk-json.hoon @@ -135,6 +135,81 @@ nis+(mo nis.a (cury scot %p) cord) == :: + ++ rure ::> rumor-reader + |= a/rumor-reader + ^- json + %+ frond -.a + ?- -.a + $glyph (digy +.a) + $nick (dini +.a) + == + :: + ++ digy ::> diff-glyph + |= a/diff-glyph + ^- json + %- pairs :~ + bin+b+bin.a + gyf+s+gyf.a + aud+(audi aud.a) + == + :: + ++ dini ::> diff-nick + |= a/diff-nick + ^- json + (pairs who+(ship who.a) nic+s+nic.a ~) + :: + ++ ruso ::> rumor-story + |= a/rumor-story + ^- json + %+ frond -.a + ?+ -.a !! + $new (conf cof.a) + :: $bear not needed + $config (pairs cir+(circ cir.a) dif+(dico dif.a) ~) + $status %- pairs :~ + cir+(circ cir.a) + who+(ship who.a) + dif+(disa dif.a) + == + $remove b+& + $gram (enve nev.a) + == + :: + ++ dico ::> diff-config + |= a/diff-config + ^- json + %+ frond -.a + ?- -.a + $full (conf cof.a) + $source (pairs add+b+add.a src+(sorc src.a) ~) + $caption s+cap.a + $filter (filt fit.a) + $secure s+sec.a + $permit (pairs add+b+add.a sis+(sa sis.a ship) ~) + $remove b+& + == + :: + ++ disa ::> diff-status + |= a/diff-status + ^- json + %+ frond -.a + ?- -.a + $full (stat sat.a) + $presence s+pec.a + $human (dihu dif.a) + $remove b+& + == + :: + ++ dihu ::> diff-human + |= a/diff-human + ^- json + %+ frond -.a + ?- -.a + $full (huma man.a) + $handle (frond %han (mabe han.a cord)) + $true (frond %tru (mabe tru.a trun)) + == + :: ++ pack ::> package |= a/package ^- json @@ -308,6 +383,13 @@ nis+(op fed:ag so) == :: + ++ rure ::> rumor-reader + ^- $-(json (unit rumor-reader)) + %- of :~ + glyph+digy + nick+dini + == + :: ++ pack ::> package ^- $-(json (unit package)) %- ot :~ @@ -316,7 +398,38 @@ pes+crow == :: - ++ dist + ++ digy ::> diff-glyph + ^- $-(json (unit diff-glyph)) + (ot bin+bo gyf+so aud+audi ~) + :: + ++ dini ::> diff-nick + ^- $-(json (unit diff-nick)) + (ot who+(su fed:ag) nic+so ~) + :: + ++ ruso ::> rumor-story + ^- $-(json (unit rumor-story)) + %- of :~ + new+conf + :: bear not needed + config+(ot cir+circ dif+dico ~) + status+(ot cir+circ who+(su fed:ag) dif+disa ~) + remove+ul + gram+enve + == + :: + ++ dico ::> diff-config + ^- $-(json (unit diff-config)) + %- of :~ + full+conf + source+(ot add+bo src+sorc ~) + caption+so + filter+filt + secure+secu + permit+(ot add+bo sis+(as (su fed:ag)) ~) + remove+ul + == + :: + ++ disa ::> diff-status ^- $-(json (unit diff-status)) %- of :~ full+(ot pec+pres man+huma ~) @@ -325,7 +438,7 @@ remove+ul == :: - ++ dihu + ++ dihu ::> diff-human ^- $-(json (unit diff-human)) %- of :~ full+huma diff --git a/mar/talk/rumor.hoon b/mar/talk/rumor.hoon index 4fc0164ce9..bdbf71e156 100644 --- a/mar/talk/rumor.hoon +++ b/mar/talk/rumor.hoon @@ -1,14 +1,38 @@ :: :::: /hoon/rumor/talk/mar :: -/? 310 /- talk -!: -[talk .] -|_ dif/rumor +/+ talk-json :: -++ grab :: convert from +|_ rum/rumor:talk +:: +++ grab ::> convert from |% - ++ noun rumor :: clam from %noun + ++ noun rumor:talk ::< from %noun + ++ json ::> from %json + => [. dejs:talk-json] ::TODO =, + =, dejs-soft:format + |= a/json + ^- rumor:talk + =- (need ((of -) a)) + :~ reader+rure + friend+(ot add+bo cir+circ ~) + :: burden not needed + circle+ruso + == + -- +:: +++ grow ::> convert to + |% + ++ json ::> to %json + => [. enjs:talk-json] ::TODO =, + =, enjs:format + %+ frond -.rum + ?+ -.rum !! + $reader (rure rum.rum) + $friend (pairs add+b+add.rum cir+(circ cir.rum) ~) + :: burden not needed + $circle (ruso rum.rum) + == -- -- From 720bc6113520ce961624a1f807503ff1518c5db1 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 24 Oct 2017 17:59:27 +0200 Subject: [PATCH 199/303] Updated /mar/talk/telegrams --- mar/talk/telegrams.hoon | 175 +++++----------------------------------- 1 file changed, 21 insertions(+), 154 deletions(-) diff --git a/mar/talk/telegrams.hoon b/mar/talk/telegrams.hoon index d95942b08c..e671e27488 100644 --- a/mar/talk/telegrams.hoon +++ b/mar/talk/telegrams.hoon @@ -1,165 +1,32 @@ :: :::: /hoon/telegrams/talk/mar :: -/? 310 -/- talk -/+ talk, map-to-json, old-zuse +/- talk +/+ talk-json :: -=, talk -=, mimes:html -=, format -=, html -=, old-zuse -|_ gam/(list telegram) +|_ gaz/(list telegram:talk) :: -++ grab :: convert from +++ grab ::> convert from |% - ++ noun (list telegram) - ++ mime |=(^mime (json (rash q.q apex:de-json))) - ++ json - => [dejs talk old-zuse] - |= a/json ^- (list telegram) - =- (need ((ar (ot ship+(su fed:ag) thought+thot ~)) a)) - |% - ++ of - |* a/(pole {@tas fist}) - |= b/json - %. ((of:jo a) b) - %- slog - ?+ b ~ - {$o *} - %+ murn `(list {@tas fist})`a - |= {c/term d/fist} ^- (unit tank) - =+ (~(get by p.b) c) - ?~ - ~ - =+ (d u) - ?~ - (some >[c u]<) - ~ - == - ++ op :: parse keys of map - |* {fel/rule wit/fist} - %+ cu malt - %+ ci - |= a/(map cord _(need *wit)) - ^- (unit (list _[(wonk *fel) (need *wit)])) - (zl (turn (~(tap by a)) (head-rush fel))) - (om wit) - :: - ++ as :: array as set - |* a/fist - (cu ~(gas in *(set _(need *a))) (ar a)) - :: - ++ ke :: callbacks - |* {gar/* sef/_|.(fist)} - |= jon/json - ^+ gar - =- ~! gar ~! (need -) - - ((sef) jon) - :: - ++ head-rush - |* a/rule - |* {cord *} - =+ nit=(rush +<- a) - ?~ nit ~ - (some [u.nit +>->]) - :: - ++ thot - ^- $-(json thought) - %- ot :~ - serial+`$-(json (unit serial))`(ci (slat %uv) so) - audience+`$-(json (unit audience))`audi - statement+`$-(json (unit statement))`stam - == - :: - ++ audi `$-(json (unit audience))`circ - ++ auri (op circ (ci (soft presence) so)) - ++ lope (ot visible+bo sender+(mu (su circ)) ~) - :: - ++ circ - ^- $-(nail (like circle)) - ;~((glue fas) ;~(pfix sig fed:ag) urs:ab) - :: - ++ stam (ot date+di speech+spec ~) - ++ spec - %+ ke *speech |. ~+ - %- of :~ - lin+(ot say+bo txt+so ~) - url+(ot txt+(su aurf:urlp) ~) - exp+(ot txt+so ~) - app+(ot txt+so src+so ~) - fat+(ot tor+tors taf+spec ~) - :: inv+(ot ship+(su fed:ag) party+(su urs:ab) ~) - == - ++ tors - %+ ke *torso |. ~+ - %- of :~ - name+(ot nom+so mon+tors ~) - text+(cu to-wain so) - tank+(ot dat+(cu (hard (list tank)) blob) ~) - == - :: - ++ blob (cu cue (su fel:ofis)) - -- + ++ noun (list telegram:talk) ::< from %noun + :: + ++ mime ::> from %mime + |= ^mime + (json (rash q.q apex:de-json:html)) + :: + ++ json ::> from %json + =, dejs-soft:format + |= a/json + ^- (list telegram:talk) + (need ((ar gram:dejs:talk-json) a)) -- :: -++ grow :: convert to +++ grow ::> convert to |% - ++ mime [/text/json (as-octs (crip (en-json json)))] - ++ json - => + - |^ - :- %a - %+ turn gam - |= telegram - (jobe ship+(jope aut) thought+(thot tot) ~) - :: - ++ jope |=(a/ship (jape +:)) ::[%s (crip +:(scow %p a))]) - ++ joke |=(a/tank (jape (of-wall (wash 0^80 a)))) - ++ jode |=(a/time (jone (div (mul (sub a ~1970.1.1) 1.000) ~s1))) - :: - ++ thot - |= thought - (jobe serial+(jape ) audience+(audi aud) statement+(stam sam) ~) - :: - ++ audi (set-to-json circ) - :: - ++ circ - |= a/circle ^- cord - (crip "{}/{(trip nom.a)}") - :: - ++ stam - |= statement - (jobe date+(jode wen) speech+(spec sep) ~) - :: - ++ spec - |= a/speech - %+ joba -.a - ?+ -.a ~|(stub+-.a !!) - $lin (jobe txt+[%s msg.a] say+[%b pat.a] ~) - $url (joba txt+(jape (earf url.a))) - $exp (joba txt+[%s exp.a]) - $fat (jobe tor+(tors tac.a) taf+$(a sep.a) ~) - $app (jobe txt+[%s msg.a] src+[%s app.a] ~) - :: $inv (jobe ship+(jope p.a) party+[%s q.a] ~) - == - :: - ++ tors - |= a/torso - %+ joba -.a - ?- -.a - $text [%s (of-wain +.a)] - $tank (jobe txt+[%a (turn +.a joke)] dat+(jape (sifo (jam +.a))) ~) - $name (jobe nom+s+nom.a mon+$(a tac.a) ~) - == - :: - -- - -- -:: -++ grad - |% - ++ form %talk-telegrams - ++ diff |=((list telegram) +<) - ++ pact |=((list telegram) +<) - ++ join |=({(list telegram) (list telegram)} `(unit mime)`~) + ++ mime ::> to %mime + :- /text/json + (as-octs:mimes:html (crip (en-json:html json))) + :: + ++ json a+(turn gaz gram:enjs:talk-json) ::< to %json -- -- From 4bcd81c34e00797fa96532d1ac0f17db88bce9f7 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 24 Oct 2017 22:15:58 +0200 Subject: [PATCH 200/303] Some cleanup & ordering in /lib/talk-json --- lib/talk-json.hoon | 54 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/lib/talk-json.hoon b/lib/talk-json.hoon index 1093140179..f716901e0e 100644 --- a/lib/talk-json.hoon +++ b/lib/talk-json.hoon @@ -14,6 +14,9 @@ ::> 3. lists and sets become arrays. maps become objects. ::> 4. stringify cells only when/in a way such that it benefits the majority of ::> foreseen usecases. +::> x. avoid dashes in json names. +::> x. for {$empty $~} fronds, use (frond 'empty' b+&). +::> x. for {$frond abc/(unit *)}, use (frond 'frond' (frond 'abc' (mabe abc))) ::> ::> q: should parsing be strict or forgiving? ie, accept "ship" and/or "~ship"? :: @@ -123,6 +126,11 @@ ^- json ?~(a ~ (b u.a)) :: + ::> || + ::> || %query-models + ::> || + ::> models relating to queries, their results and updates. + ::+| :: ++ pire ::> prize-reader |= a/prize-reader @@ -144,6 +152,15 @@ $nick (dini +.a) == :: + ++ pack ::> package + |= a/package + ^- json + %- pairs :~ + nes+a+(turn nes.a enve) ::TODO maybe map + cos+(loby cos.a) + pes+(crow pes.a) + == + :: ++ digy ::> diff-glyph |= a/diff-glyph ^- json @@ -210,14 +227,11 @@ $true (frond %tru (mabe tru.a trun)) == :: - ++ pack ::> package - |= a/package - ^- json - %- pairs :~ - nes+a+(turn nes.a enve) ::TODO maybe map - cos+(loby cos.a) - pes+(crow pes.a) - == + ::> || + ::> || %circles + ::> || + ::> messaging targets and their metadata + ::+| :: ++ circ ::> circle |= a/circle @@ -264,11 +278,6 @@ rem+(mo rem.a tmp grop) == :: - ++ tmp - |= a/circle - ^- @t - (crip (circ:en-tape a)) - :: ++ grop ::> group |= a/group ^- json @@ -289,6 +298,12 @@ ^- json (pairs fir+s+fir.a mid+(mabe mid.a cord) las+s+las.a ~) :: + ::> || + ::> || %message-data + ::> || + ::> structures for containing main message data + ::+| + :: ++ enve ::> envelope |= a/envelope ^- json @@ -298,7 +313,7 @@ |= a/telegram ^- json %- pairs :~ - ::aut+ship + aut+(ship aut.a) ::TODO can we avoid this code duplication somehow? uid+s+(scot %uv uid.a) aud+(audi aud.a) @@ -343,6 +358,12 @@ $tank a+(turn +.a dank) == :: + ::> || + ::> || %message-metadata + ::> || + ::> structures for containing message metadata + ::+| + :: ++ audi ::> audience |= a/audience ^- json @@ -375,6 +396,11 @@ rose+(ot style+(ot mid+sa open+sa close+sa ~) lines+(ar dank) ~) == :: + ::> || + ::> || %query-models + ::> || + ::> models relating to queries, their results and updates. + ::+| :: ++ pire ::> prize-reader ^- $-(json (unit prize-reader)) From a72dbd78bbf0d9925b07cacf6ad5ad71151b036c Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 25 Oct 2017 16:54:32 +0200 Subject: [PATCH 201/303] Small fixes in ++crow:enjs and ++atta:dejs --- lib/talk-json.hoon | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/talk-json.hoon b/lib/talk-json.hoon index f716901e0e..d725a39153 100644 --- a/lib/talk-json.hoon +++ b/lib/talk-json.hoon @@ -275,7 +275,7 @@ ^- json %- pairs :~ loc+(grop loc.a) - rem+(mo rem.a tmp grop) + rem+(mo rem.a (cork circ:en-tape crip) grop) == :: ++ grop ::> group @@ -581,6 +581,7 @@ :: ++ atta ::> attache ^- $-(json (unit attache)) + %+ re *attache |. ~+ %- of :~ name+(ot nom+so tac+atta ~) text+(cu to-wain:format so) From 6a14db7e202df04e6892b8f0fef3c8ead05bb3ec Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 25 Oct 2017 16:55:10 +0200 Subject: [PATCH 202/303] When a json %exp speech doesn't contain a result, the expression is evaluated to fill it in. --- lib/talk-json.hoon | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/talk-json.hoon b/lib/talk-json.hoon index d725a39153..63038d212b 100644 --- a/lib/talk-json.hoon +++ b/lib/talk-json.hoon @@ -2,6 +2,7 @@ :::: /lib/talk-json/hoon :: /- talk +/+ old-zuse :: ::> proposed rules for sur-json conversion, adhered to below: ::> 1. to save the devs from having to learn multiple interfaces, try to match @@ -20,7 +21,7 @@ ::> ::> q: should parsing be strict or forgiving? ie, accept "ship" and/or "~ship"? :: -|% +|_ bol/bowl:gall ++ en-tape ::> sur to tape =, talk |% @@ -573,12 +574,25 @@ %- of :~ lin+(ot pat+bo txt+so ~) url+(su aurf:de-purl:html) - exp+(ot exp+so res+(ar dank) ~) + exp+eval ire+(ot top+seri sep+spec ~) fat+(ot tac+atta sep+spec ~) inv+(ot inv+bo cir+circ ~) == :: + ++ eval ::> %exp speech + ::> extract contents of an %exp speech, evaluating + ::> the {exp} if there is no {res} yet. + :: + |= a/json + ^- (unit {cord (list tank)}) + =+ exp=((ot exp+so ~) a) + ?~ exp ~ + :+ ~ u.exp + =+ res=((ot res+(ar dank) ~) a) + ?^ res u.res + p:(mule |.([(sell (slap !>(..zuse:old-zuse) (ream u.exp)))]~)) ::TODO oldz + :: ++ atta ::> attache ^- $-(json (unit attache)) %+ re *attache |. ~+ From 7c52f0518a71dcf8178488816d61d448b8f6045e Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 25 Oct 2017 20:37:39 +0200 Subject: [PATCH 203/303] Small fixes & changes for better usability (tank as line list). --- lib/talk-json.hoon | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/talk-json.hoon b/lib/talk-json.hoon index 63038d212b..c9b5ea8f55 100644 --- a/lib/talk-json.hoon +++ b/lib/talk-json.hoon @@ -91,6 +91,11 @@ =- (pairs (turn ~(tap by a) -)) |* {k/* v/*} [(b k) (c v)] :: + ++ lank ::> tank as string arr + |= a/tank + ^- json + a+(turn (wash [0 1.024] a) tape) + :: ++ dank ::> tank |= a/tank ?: ?=($leaf -.a) (frond %leaf (tape p.a)) @@ -282,7 +287,7 @@ ++ grop ::> group |= a/group ^- json - (mo a (cury scot %p) `stat) + (mo a (cury scot %p) stat) :: ++ stat ::> status |= a/status @@ -342,7 +347,7 @@ %- pairs ?- -.a $lin ~[pat+b+pat.a msg+s+msg.a] - $exp ~[exp+s+exp.a res+a+(turn res.a dank)] + $exp ~[exp+s+exp.a res+a+(turn res.a lank)] $ire ~[top+s+(scot %uv top.a) sep+(spec sep.a)] ::TODO @uv as number? $fat ~[tac+(atta tac.a) sep+(spec sep.a)] $inv ~[inv+b+inv.a cir+(circ cir.a)] @@ -356,7 +361,7 @@ ?- -.a $name (pairs nom+s+nom.a tac+(atta tac.a) ~) $text s+(of-wain:format +.a) - $tank a+(turn +.a dank) + $tank a+(turn +.a lank) == :: ::> || @@ -572,7 +577,7 @@ ^- $-(json (unit speech)) %+ re *speech |. ~+ %- of :~ - lin+(ot pat+bo txt+so ~) + lin+(ot pat+bo msg+so ~) url+(su aurf:de-purl:html) exp+eval ire+(ot top+seri sep+spec ~) From 9aa932e03712af1bbbb2ec15154d1a0027e9de40 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 25 Oct 2017 22:07:36 +0200 Subject: [PATCH 204/303] Improved rendering of %exp speeches in talk-agent. --- app/talk-agent.hoon | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index b9998d0164..c451f05103 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -1940,7 +1940,7 @@ url+(crip (apix:en-purl:html url.sep)) :: $exp - tan+~[rose+[" " ~ ~]^[leaf+"# {(trip exp.sep)}" res.sep]] + mor+~[txt+"# {(trip exp.sep)}" tan+res.sep] :: $ire =+ gam=(recall top.sep) @@ -2018,9 +2018,10 @@ == :: $exp - ::TODO print truncated res on its own line. - :_ ~ - (tr-chow wyd '#' ' ' (trip exp.sep)) + :- (tr-chow wyd '#' ' ' (trip exp.sep)) + ?~ res.sep ~ + =- [[' ' ' ' (snag 0 -)] ~] + (wash [0 wyd] (snag 0 `(list tank)`res.sep)) :: $ire $(sep sep.sep) From 3f8e03890226f85b0ffbf6ce34c73463729a15de Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 27 Oct 2017 21:09:36 +0200 Subject: [PATCH 205/303] Fixed audience selection by glyph. --- app/talk-agent.hoon | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index c451f05103..827e1ab7f7 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -8,6 +8,8 @@ :: ...this is a bit troublesome, because failed joins don't actually :: unsubscribe us. ::TODO maybe keep track of received grams per circle, too? +::TODO [type query] => [press tab to cycle search results, newest-first] +:: => [escape to clear] :: ::TODO for delta model: :: 3) split into delta creation and application, as with hall. @@ -563,9 +565,19 @@ == == :: + ++ 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 ~(gas in *(set circle)) - (most ;~(plug com (star ace)) circ) + %+ cook circles-flat + %+ most ;~(plug com (star ace)) + (^pick circ (sear sh-glyf glyph)) :: ++ pont ::< point for range ;~ pose From 311037c06172d0296927b8aa965440c18eba3966 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 27 Oct 2017 22:58:10 +0200 Subject: [PATCH 206/303] Don't print presence lists for mailboxes. --- app/talk-agent.hoon | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 827e1ab7f7..d18add643a 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -1110,14 +1110,15 @@ ::+| :: ++ who ::< %who - ::> prints presence lists for {pas} or all. + ::> prints presence lists for {cis} or all. :: - |= pas/(set circle) ^+ ..sh-work + |= cis/(set circle) ^+ ..sh-work =< (sh-fact %mor (murn (sort ~(tap by remotes) aor) .)) - |= {pon/circle gop/group} ^- (unit sole-effect) - ?. |(=(~ pas) (~(has in pas) pon)) ~ - ?. (~(has in sources) pon) ~ - =- `[%tan rose+[", " `~]^- leaf+~(pr-full pr pon) ~] + |= {cir/circle gop/group} ^- (unit sole-effect) + ?. |(=(~ cis) (~(has in cis) cir)) ~ + ?: =(%brown sec.con:(fall (~(get by mirrors) cir) *config)) ~ + ?. (~(has in sources) cir) ~ + =- `[%tan rose+[", " `~]^- leaf+~(pr-full pr cir) ~] =< (murn (sort ~(tap by gop) aor) .) |= {a/ship b/presence c/human} ^- (unit tank) =? c =(han.c `(scot %p a)) [~ tru.c] From 45afbf900d4bea2c8ed159ad71617ba3555cee1a Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 30 Oct 2017 15:23:17 +0100 Subject: [PATCH 207/303] Don't fail to send when one story in the audience doesn't exist. Print to inbox instead of throwing stacktrace. --- app/talk-guardian.hoon | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index d1e9c9e736..e134b01487 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -622,6 +622,8 @@ (crip "strange author {(scow %p aut)}") =. aut our.bol ?: =(aut hos.cir) + ?. (~(has by stories) nom.cir) + (ta-note (crip "have no story {(scow %tas nom.cir)}")) (ta-record nom.cir hos.cir tot) (ta-transmit cir tot) ?. =(our.bol hos.cir) +> From 387c097758a3ef28db7cc1e080bc7ffef6a5faac Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 31 Oct 2017 17:09:24 +0100 Subject: [PATCH 208/303] Continuation of fix in 45afbf90 --- app/talk-guardian.hoon | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index e134b01487..a3949ca4da 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -622,9 +622,10 @@ (crip "strange author {(scow %p aut)}") =. aut our.bol ?: =(aut hos.cir) - ?. (~(has by stories) nom.cir) - (ta-note (crip "have no story {(scow %tas nom.cir)}")) + ?: (~(has by stories) nom.cir) (ta-record nom.cir hos.cir tot) + %- ta-note ::TODO avenue for abuse? + (crip "have no story {(scow %tas nom.cir)}") (ta-transmit cir tot) ?. =(our.bol hos.cir) +> (ta-record nom.cir aut tot) From 926b8a1f696671f54f634ed66959f4d95e29636d Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 31 Oct 2017 17:10:44 +0100 Subject: [PATCH 209/303] Explicitly mention runtime error cases. --- app/talk-guardian.hoon | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index a3949ca4da..7c3c713d90 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -819,6 +819,7 @@ %+ roll ~(tap by loc.pes) |= {{w/ship s/status} _self} (so-delta-our %status so-cir w %full s) + ::TODO ^ runtime when accepting burden :: remote status =. self %+ roll ~(tap by rem.pes) @@ -1991,7 +1992,7 @@ =< so-done (~(so-bear so n ~ (fall (~(get by stories) n) *story)) b) %- pre-bake - ta-done:(ta-take:ta wir piz) ::TODO %ap-lame for %burden prize... + ta-done:(ta-take:ta wir piz) ::TODO runtime for %burden prize... =^ mow +>.$ log-all-to-file [(welp mos mow) +>.$] From 140c847271c9bf71219b2c7d7f48c75ecd8fa4c0 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 31 Oct 2017 19:56:56 +0100 Subject: [PATCH 210/303] Updated /sur/talk.hoon to be more clear and consistent. --- app/talk-agent.hoon | 24 +++++++---------------- app/talk-guardian.hoon | 44 +++++++++++++++++++++--------------------- lib/talk-json.hoon | 6 +++--- sur/talk.hoon | 22 +++++++++++---------- 4 files changed, 44 insertions(+), 52 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index d18add643a..c3257eae19 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -615,12 +615,7 @@ == :: ++ pore ::< security - ;~ pose - (cold %black (jest %channel)) - (cold %white (jest %village)) - (cold %green (jest %journal)) - (cold %brown (jest %mailbox)) - == + (perk %channel %village %journal %mailbox ~) :: ++ lobe ::< y/n loob ;~ pose @@ -1116,7 +1111,7 @@ =< (sh-fact %mor (murn (sort ~(tap by remotes) aor) .)) |= {cir/circle gop/group} ^- (unit sole-effect) ?. |(=(~ cis) (~(has in cis) cir)) ~ - ?: =(%brown sec.con:(fall (~(get by mirrors) cir) *config)) ~ + ?: =(%mailbox sec.con:(fall (~(get by mirrors) cir) *config)) ~ ?. (~(has in sources) cir) ~ =- `[%tan rose+[", " `~]^- leaf+~(pr-full pr cir) ~] =< (murn (sort ~(tap by gop) aor) .) @@ -1491,12 +1486,7 @@ :: |= a/security ^- tape - ?- a - $black "channel" - $brown "mailbox" - $white "village" - $green "journal" - == + (scow %tas a) :: ++ sh-scis ::< render status ::> gets the presence of {saz} as a tape. @@ -1539,8 +1529,8 @@ ::> prints invite/banish effects to the cli. :: |= {pre/tape sec/security old/(list ship) new/(list ship)} - =+ out=?:(?=(?($black $brown) sec) "try " "cut ") - =+ inn=?:(?=(?($black $brown) sec) "ban " "add ") + =+ out=?:(?=(?($channel $mailbox) sec) "try " "cut ") + =+ inn=?:(?=(?($channel $mailbox) sec) "ban " "add ") =. +>.$ |- ^+ +>.^$ ?~ old +>.^$ @@ -1583,7 +1573,7 @@ (weld (trip inbox) ": ") (sh-set-diff src.laz src.loc) ?: !=(sec.con.loc sec.con.laz) - =. +>.$ (sh-note :(weld pre "but " (sh-cure sec.con.loc))) + =. +>.$ (sh-note :(weld pre "but " (scow %tas sec.con.loc))) %^ sh-show-permits (weld (trip inbox) ": ") sec.con.loc @@ -1834,7 +1824,7 @@ |= cir/circle ^- ? ?& =(hos.cir our.bol) =+ sot=(~(get by mirrors) cir) - &(?=(^ sot) ?=($brown sec.con.u.sot)) + &(?=(^ sot) ?=($mailbox sec.con.u.sot)) == :: ++ ar-pref ::< audience glyph diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 7c3c713d90..8ad7c4d72e 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -223,8 +223,8 @@ :: create default circles. => %+ roll ^- (list {security naem cord}) - :~ [%brown (main our.bol) 'default home'] - [%green %public 'visible activity'] + :~ [%mailbox (main our.bol) 'default home'] ::TODO %inbox? + [%journal %public 'visible activity'] == |= {{typ/security nom/naem des/cord} _ta} %+ ta-action ost.bol @@ -356,7 +356,7 @@ des *filter :- typ - ?. ?=(?($white $green) typ) ~ + ?. ?=(?($village $journal) typ) ~ [our.bol ~ ~] == (ta-evil (crip "{(trip nom)}: already exists")) @@ -623,7 +623,7 @@ =. aut our.bol ?: =(aut hos.cir) ?: (~(has by stories) nom.cir) - (ta-record nom.cir hos.cir tot) + (ta-record nom.cir hos.cir tot) %- ta-note ::TODO avenue for abuse? (crip "have no story {(scow %tas nom.cir)}") (ta-transmit cir tot) @@ -861,14 +861,14 @@ ?~ old ~ ::TODO? what to do about src? :~ ::[%follow | src.u.old] - [%config so-cir %permit | ses.con.u.old] + [%config so-cir %permit | sis.con.u.old] == ^- (list delta-story) :~ ::[%follow & src.cof] [%config so-cir %caption cap.cof] [%config so-cir %filter fit.cof] [%config so-cir %secure sec.con.cof] - [%config so-cir %permit & ses.con.cof] + [%config so-cir %permit & sis.con.cof] == |= d/delta-story [%story nom d] @@ -1121,10 +1121,10 @@ ^+ +> ::> wyt: whitelist? ::> add: add to list? - =/ wyt/? ?=(?($white $green) sec.con.shape) + =/ wyt/? ?=(?($village $journal) sec.con.shape) =/ add/? =(inv wyt) =/ sus/(set ship) - %. ses.con.shape + %. sis.con.shape ?:(add ~(dif in sis) ~(int in sis)) =. +>.$ %- so-act @@ -1141,10 +1141,10 @@ |= her/ship ^- ? ?- sec.con.shape - $black !(~(has in ses.con.shape) her) ::< channel, blacklist - $white (~(has in ses.con.shape) her) ::< village, whitelist - $green (~(has in ses.con.shape) her) ::< journal, whitelist - $brown !(~(has in ses.con.shape) her) ::< mailbox, blacklist + $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 == :: ++ so-visible ::< display to @@ -1153,10 +1153,10 @@ |= her/ship ^- ? ?- sec.con.shape - $black !(~(has in ses.con.shape) her) ::< channel, blacklist - $white (~(has in ses.con.shape) her) ::< village, whitelist - $green & ::< journal, all - $brown (team:title our.bol her) ::< mailbox, our team + $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 == -- -- @@ -1540,7 +1540,7 @@ |= {old/config dif/diff-config} ^- (list move) ?+ -.dif ~ - $permit (sa-permit-effects sec.con.old ses.con.old +.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. == @@ -1561,11 +1561,11 @@ :: |= {sec/security old/(set ship) add/? sis/(set ship)} ^- (list move) - =/ wyt ?=(?($white $green) sec) + =/ wyt ?=(?($village $journal) sec) =/ inv =(wyt add) ?: inv ~ =/ sus/(set ship) - %. ses.con.shape + %. sis.con.shape ?:(add ~(dif in sis) ~(int in sis)) (sa-eject sus) :: @@ -1743,7 +1743,7 @@ |= {n/naem s/story} ^- (unit (pair naem burden)) :: only auto-federate channels for now. - ?. ?=($black sec.con.shape.s) ~ + ?. ?=($channel sec.con.shape.s) ~ :+ ~ n :+ grams.s [shape.s mirrors.s] @@ -1834,7 +1834,7 @@ ?. ?=($story -.det) ~ ?: ?=(?($follow $inherited $sequent) -.det.det) ~ :: only burden channels for now. - ?. =(%black sec.con.shape:(~(got by stories) nom.det)) ~ + ?. =(%channel sec.con.shape:(~(got by stories) nom.det)) ~ `[%burden nom.det (dedicate who.qer nom.det det.det)] :: $report @@ -1847,7 +1847,7 @@ :: and only if the story is inherited. ?. inherited.soy ~ :: only burden channels for now. - ?. =(%black sec.con.shape.soy) ~ + ?. =(%channel sec.con.shape.soy) ~ `[%burden nom.det (dedicate (above our.bol) nom.det det.det)] :: $circle diff --git a/lib/talk-json.hoon b/lib/talk-json.hoon index c9b5ea8f55..7f73e93c39 100644 --- a/lib/talk-json.hoon +++ b/lib/talk-json.hoon @@ -274,7 +274,7 @@ ++ cont ::> control |= a/control ^- json - (pairs sec+s+sec.a ses+(sa ses.a ship) ~) + (pairs sec+s+sec.a sis+(sa ses.a ship) ~) :: ++ crow ::> crowd |= a/crowd @@ -513,11 +513,11 @@ :: ++ cont ::> control ^- $-(json (unit control)) - (ot sec+secu ses+(as (su fed:ag)) ~) + (ot sec+secu sis+(as (su fed:ag)) ~) :: ++ secu ::> security ^- $-(json (unit security)) - (su (perk %black %white %green %brown ~)) + (su (perk %channel %village %journal %mailbox ~)) :: ++ crow ::> crowd ^- $-(json (unit crowd)) diff --git a/sur/talk.hoon b/sur/talk.hoon index 8fc8042751..77e2982b42 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -90,15 +90,17 @@ $% {$glyph diff-glyph} ::< un/bound glyph {$nick diff-nick} ::< changed nickname == :: -++ burden ::< full story state - $: gaz/(list telegram) ::< all messages - cos/lobby ::< loc & rem configs +++ shipment ::> standard payload + $: cos/lobby ::< loc & rem configs pes/crowd ::< loc & rem presences == :: +++ burden ::< full story state + $: gaz/(list telegram) ::TODO envelope? ::< all messages + shipment + == :: ++ package ::< story state $: nes/(list envelope) ::< messages - cos/lobby ::< loc & rem configs - pes/crowd ::< loc & rem presences + shipment == :: ++ diff-glyph {bin/? gyf/char aud/audience} ::< un/bound glyph ++ diff-nick {who/ship nic/nick} ::< changed nickname @@ -193,12 +195,12 @@ utf/? ::< dis/allow non-ascii ::TODO maybe message length == :: -++ control {sec/security ses/(set ship)} ::< access control +++ control {sec/security sis/(set ship)} ::< access control ++ security ::> security mode - $? $black ::< channel, blacklist - $white ::< village, whitelist - $green ::< journal, author list - $brown ::< mailbox, our r, bl w + $? $channel ::< channel, blacklist + $village ::< village, whitelist + $journal ::< journal, author list + $mailbox ::< mailbox, our r, bl w == :: :: participant metadata. :: ::TODO think about naming more From 4506f4ca5cb34bb4d8a154c6e7b3b4d8dcc22227 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 1 Nov 2017 13:30:49 +0100 Subject: [PATCH 211/303] Fixes relating to /sur/talk change --- app/talk-agent.hoon | 4 ++-- lib/talk.hoon | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index c3257eae19..5d829f2e9a 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -1577,11 +1577,11 @@ %^ sh-show-permits (weld (trip inbox) ": ") sec.con.loc - [~ ~(tap in ses.con.loc)] + [~ ~(tap in sis.con.loc)] %^ sh-show-permits (weld (trip inbox) ": ") sec.con.loc - (sh-set-diff ses.con.laz ses.con.loc) + (sh-set-diff sis.con.laz sis.con.loc) :: ++ sh-config ::< do show config ::> prints a circle's config changes to the cli. diff --git a/lib/talk.hoon b/lib/talk.hoon index f654794031..246b8817f2 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -130,11 +130,11 @@ :: $permit %= cof - ses.con + sis.con %. sis.dif ?: add.dif - ~(uni in ses.con.cof) - ~(dif in ses.con.cof) + ~(uni in sis.con.cof) + ~(dif in sis.con.cof) == :: $secure @@ -142,11 +142,11 @@ sec.con sec.dif :: - ses.con + sis.con ?. .= ?=(?($white $green) sec.dif) ?=(?($white $green) sec.con.cof) ~ - ses.con.cof + sis.con.cof == == :: From a284e31a4fc2fb78e78b78fba66678c554f374db Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 1 Nov 2017 18:35:06 +0100 Subject: [PATCH 212/303] All default mailboxes are now called %inbox, regardless of ship class. --- app/talk-agent.hoon | 16 ++++++++-------- app/talk-guardian.hoon | 9 ++++----- lib/talk.hoon | 12 ++---------- 3 files changed, 14 insertions(+), 23 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 5d829f2e9a..2fe5e67be0 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -137,7 +137,7 @@ ::> produces the name of the circle used by this ::> reader for all its operations ^- naem - (main our.bol) + %inbox :: ++ incir ::< reader's circle ::> ++inbox, except a full circle. @@ -558,7 +558,7 @@ :: %+ cook |= {a/@p b/(unit term)} - [a ?^(b u.b (main a))] + [a ?^(b u.b %inbox)] ;~ plug ship (punt ;~(pfix fas urs:ab)) @@ -1651,8 +1651,8 @@ ?. =(our.bol hos.two) %& ?< =(nom.one nom.two) :: if both circles are ours, the main story is better. - ?: =((main hos.one) nom.one) %& - ?: =((main hos.two) nom.two) %| + ?: =(%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. @@ -1698,7 +1698,7 @@ ":" ['%' (trip nom.one)] =+ wun=(cite:title hos.one) - ?: =(nom.one (main hos.one)) + ?: =(nom.one %inbox) wun ?: =(hos.one (sein:title our.bol)) ['/' (trip nom.one)] @@ -1888,8 +1888,8 @@ :: render the author. =/ nom/tape ?: (~(has in sef) %nicks) - (~(cr-nick cr [who (main who)])) - (~(cr-curt cr [who (main who)]) |) + (~(cr-nick cr [who %inbox])) + (~(cr-curt cr [who %inbox]) |) :: regular indent. =/ den/tape (reap (lent nom) ' ') @@ -2054,7 +2054,7 @@ ?: pat.sep " " %~ ar-pref ar ?: =(who our.bol) aud - (~(del in aud) [%& who (main who)]) + (~(del in aud) [%& who %inbox]) == =. wyd (sub wyd (lent pef)) =/ txt (tuba (trip msg.sep)) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 8ad7c4d72e..def06a7314 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -17,7 +17,6 @@ :: 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. :: -::TODO/REVIEW rename porch/floor/court to inbox? :: /? 151 ::< hoon version /- talk ::< structures @@ -180,7 +179,7 @@ :: |= msg/cord %^ ta-action 0 %phrase - :- [[our.bol (main our.bol)] ~ ~] + :- [[our.bol %inbox] ~ ~] [%app dap.bol msg]~ :: ++ ta-evil ::< emit error @@ -223,7 +222,7 @@ :: create default circles. => %+ roll ^- (list {security naem cord}) - :~ [%mailbox (main our.bol) 'default home'] ::TODO %inbox? + :~ [%mailbox %inbox 'default home'] [%journal %public 'visible activity'] == |= {{typ/security nom/naem des/cord} _ta} @@ -695,7 +694,7 @@ |= msg/cord ^+ +> %+ so-act %phrase - :- [[our.bol (main our.bol)] ~ ~] + :- [[our.bol %inbox] ~ ~] [%app dap.bol msg]~ :: ++ so-delta ::< send delta @@ -1131,7 +1130,7 @@ :- %phrase %- ~(rep in sus) |= {s/ship a/audience t/(list speech)} - :- (~(put in a) [s (main s)]) + :- (~(put in a) [s %inbox]) [[%inv inv so-cir] t] (so-delta-our %config so-cir %permit [add sus]) :: diff --git a/lib/talk.hoon b/lib/talk.hoon index 246b8817f2..f4674c06de 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -10,14 +10,6 @@ :: [. ^talk] |_ bol/bowl:gall -++ main :: main story - |= who/ship - ^- cord - =+ can=(clan:title who) - ?+ can %porch - $czar %court - $king %floor - == :: ::TODO add to zuse? ++ true-self @@ -36,7 +28,7 @@ :+ [our.bol %talk] %talk-action ^- action :+ %phrase - [[our.bol (main our.bol)] ~ ~] + [[our.bol %inbox] ~ ~] [%app dap.bol (crip (en-purl:html url))]~ :: XX :: ++ said :: app message @@ -49,7 +41,7 @@ :_ $(mes t.mes, eny (sham eny mes)) ^- thought :+ (shaf %thot eny) - [[our (main our)] ~ ~] + [[our %inbox] ~ ~] [now [%app dap (crip ~(ram re i.mes))]] :: ++ uniq From 8158a63e9bd5e8a20fbb9afb003d31c8648f703b Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 1 Nov 2017 18:55:57 +0100 Subject: [PATCH 213/303] Fixed /app/twit to use the talk lib correctly. --- app/twit.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/twit.hoon b/app/twit.hoon index 450b6c638c..d6020b83ba 100644 --- a/app/twit.hoon +++ b/app/twit.hoon @@ -47,7 +47,7 @@ ++ api-call {response-mark $twit-req {endpoint quay}} :: full hiss payload ++ response-mark ?($twit-post $twit-feed $twit-cred) :: sigh options ++ app-message - $? {{ship $talk} $talk-command command:talk} :: chat message + $? {{ship $talk} $talk-action action:talk} :: chat message {{ship $hood} $write-plan-account user:eyre plan-acct} :: registration == :: ++ sign :: arvo response From e359bb496872594cf5fe74a053ca6446bc8ec591 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 1 Nov 2017 19:05:38 +0100 Subject: [PATCH 214/303] Changed /lib/talk to actually make us of the bowl as originally intended. --- app/talk-guardian.hoon | 2 +- lib/talk.hoon | 20 +++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index def06a7314..484a6fda8c 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -421,7 +421,7 @@ =- (ta-think & our.bol tos) |- ^- tos/(list thought) ?~ ses ~ - =^ sir eny.bol (uniq eny.bol) + =^ sir eny.bol ~(uniq talk bol) :_ $(ses t.ses) [sir aud [now.bol i.ses]] :: diff --git a/lib/talk.hoon b/lib/talk.hoon index f4674c06de..204eb1e050 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -32,22 +32,20 @@ [%app dap.bol (crip (en-purl:html url))]~ :: XX :: ++ said :: app message - |= {our/@p dap/term now/@da eny/@uvJ mes/(list tank)} + |= mes/(list tank) :- %talk-action ^- action - :- %convey - |- ^- (list thought) + :- %phrase + :- [[our.bol %inbox] ~ ~] + |- ^- (list speech) ?~ mes ~ - :_ $(mes t.mes, eny (sham eny mes)) - ^- thought - :+ (shaf %thot eny) - [[our %inbox] ~ ~] - [now [%app dap (crip ~(ram re i.mes))]] + :_ $(mes t.mes) + ^- speech + [%app dap.bol (crip ~(ram re i.mes))] :: ++ uniq - |= eny/@uvJ - ^- {serial _eny} - [(shaf %serial eny) (shax eny)] + ^- {serial _eny.bol} + [(shaf %serial eny.bol) (shax eny.bol)] :: ++ range-to-path ::< msg range to path ::> turns a range structure into a path used for From 8e86fbebea08e9070a49c1c3aac3cef0553b9def Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 1 Nov 2017 19:32:21 +0100 Subject: [PATCH 215/303] Now automatically kill subscriptions that are past their range. --- app/talk-guardian.hoon | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 484a6fda8c..bbec2faba5 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -1854,7 +1854,6 @@ ?. =(nom.qer nom.det) ~ ?: ?=(?($follow $burden) -.det.det) ~ :: internal-only delta =+ ren=(~(so-in-range so:ta nom.qer ~ (~(got by stories) nom.qer)) ran.qer) - ::TODO if done.ren, %quit bone ?. in.ren ~ ::TODO move up? we also check for $follow above, why? ?: ?=(?($follow $inherited $sequent) -.det.det) ~ @@ -1870,25 +1869,30 @@ ::> for a given delta, send rumors to all queries it ::> affects. :: - ::TODO? %quit bones that are done with their subscription. - :: ...but that would also require a ta-cancel call to remove - :: them from the status list! how do? - :: should there be an ++away arm for gall to call? |= det/delta ^- (list move) :: cache results for paths. - =| res/(map path (unit rumor)) - %+ murn ~(tap by sup.bol) + =| res/(map path (list move)) + %- zing + %+ turn ~(tap by sup.bol) |= {b/bone s/ship p/path} - ^- (unit move) + ^- (list move) =+ mur=(~(get by res) p) - ?^ mur - ?~ u.mur ~ - `[b %diff %talk-rumor u.u.mur] - =+ rum=(feel (path-to-query p) det) - =. res (~(put by res) p rum) - ?~ rum ~ - `[b %diff %talk-rumor u.rum] + ?^ mur u.mur + =- =. res (~(put by res) p -) + - + =+ qer=(path-to-query p) + %+ welp + =+ rum=(feel qer det) + ?~ rum ~ + [b %diff %talk-rumor u.rum]~ + ?. ?=($circle -.qer) ~ + :: kill the subscription if it's past its range. + ::TODO does not remove subscribers from status list. need ta-cancel? + =- ?:(done:- [b %quit ~]~ ~) + %. 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 From e7de37b3831a58d7146902b91bebc40add31b63e Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 1 Nov 2017 20:20:25 +0100 Subject: [PATCH 216/303] When dedicating story changes, only do so for the affected story. --- app/talk-guardian.hoon | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index bbec2faba5..386b1a9baf 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -1787,20 +1787,19 @@ aud %- ~(run in aud.gam.det) |= c/circle - ::TODO it probably isn't safe to do this for - :: all audience members hosted by us, even - :: if this is only called for burdens. - ?. =(hos.c our.bol) c - [who nom.c] + ?. &(=(hos.c our.bol) =(nom.c nom)) c + [who nom] == :: $config - ?. =(hos.cir.det our.bol) det - det(cir [who nom.cir.det]) + ?. &(=(hos.cir.det our.bol) =(nom.cir.det nom)) + det + det(cir [who nom]) :: $status - ?. =(hos.cir.det our.bol) det - det(cir [who nom.cir.det]) + ?. &(=(hos.cir.det our.bol) =(nom.cir.det nom)) + det + det(cir [who nom]) == :: ++ gram-to-envelope ::< wrap gram with nr From 3746ab02fb4957044b5a846722844915acb4b66e Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 1 Nov 2017 20:24:11 +0100 Subject: [PATCH 217/303] Trivial TODOs & cleanup. --- app/talk-guardian.hoon | 50 +++++++++++++++++++++--------------------- lib/talk-json.hoon | 2 +- sur/talk.hoon | 5 ++++- 3 files changed, 30 insertions(+), 27 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 386b1a9baf..e5594d99a5 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -3,20 +3,23 @@ :: :: :: :: ::TODO rename to hall -::TODO master changes ::TODO char57 comments as line comments when regarding code. ::TODO document what user-facing messages actually mean! -::TODO maybe have brokers accept reactions as well, redirect them to readers. -:: that way we can have foreign brokers react to our requests! +::TODO maybe have hall accept reactions as well, redirect them to readers. +:: that way we can have foreign halls react to our requests! ::TODO document gate samples fully. ::TODO ::> to :> etc. :: ::TODO crash on pokes/peers we do not expect +::TODO ++poke-reset. first call: warning. second call: reset state. :: ::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. :: +::TODO uncouple presence from subscription state. have hall send an initial +:: presence when we sub to someplace, and remove that when we unsub, but +:: don't make the target source do that. :: /? 151 ::< hoon version /- talk ::< structures @@ -80,7 +83,7 @@ ++ delta-story ::> story delta $? diff-story ::< both in & outward $% {$inherited ihr/?} ::< inherited flag - {$follow sub/? srs/(set source)} ::TODO set?::< un/subscribe + {$follow sub/? srs/(set source)} ::< un/subscribe {$sequent cir/circle num/@ud} ::< update last-heard {$gram gam/telegram} ::< new/changed msgs == == :: @@ -137,8 +140,6 @@ ::> thinker core, used for processing pokes into ::> deltas. :: - ::TODO maybe rewrite all arms to produce (list delta) - :: instead of state? or nah? |_ ::> deltas: deltas created by core operations. :: deltas/(list delta) @@ -253,7 +254,7 @@ ::> %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) + $bearing (ta-observe src) ::TODO isn't this redundant with ta-subscribe? == :: ++ ta-present ::< update a status @@ -286,7 +287,6 @@ ::+| ++ work ::< perform action ^+ ..ta-action - ::TODO require deltas as product! ?- -.act :: circle configuration $create (action-create +.act) @@ -468,6 +468,7 @@ :: ++ 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. :: |= who/ship ^+ +> @@ -662,9 +663,7 @@ == :: ++ so-done ::< apply changes - ::> put changed story back into the map and apply - ::> actions. - ::TODO update inline docs + ::> apply actions generated by story operations. ::TODO maybe produce list of actions, apply in ++ta :: ^+ +> @@ -700,7 +699,6 @@ ++ so-delta ::< send delta ::> store delta in ++ta core. :: - ::TODO maybe keep our own list of deltas, produce in done |= det/delta ^+ +> +>(deltas [det deltas]) @@ -849,10 +847,11 @@ ++ so-config-full ::< split full config ::> split a %full config delta up into multiple ::> smaller ones, for easier application. - ::TODO mention side-effects :: |= {old/(unit config) cof/config} ^+ +> + ~? &(?=(^ old) !=(src.u.old src.cof)) + %maybe-missing-src-changes %- so-deltas %+ turn %+ weld @@ -1579,12 +1578,12 @@ :: |= srs/(set source) %+ sa-sauce 0 :: subscription is caused by this app - %- zing + =- (murn - same) %+ turn ~(tap in srs) |= {cir/circle ran/range} - ^- (list card) ::TODO just (unit card) is enough. + ^- (unit card) ?: =(cir sa-cir) ~ :: ignore self-subs - [(circle-peer nom cir ran) ~] + `(circle-peer nom cir ran) :: ++ sa-abjure ::< unsubscribe us ::> unsubscribes this story from each circle. @@ -1703,11 +1702,7 @@ :: |= det/delta ^- (quip move _+>) - =^ mos +>.$ - da-done:(da-change:da det) - :_ +>.$ - ::TODO move affection to pre-bake, but then station creation doesn't happen? - (welp mos (affection det)) + da-done:(da-change:da det) :: ++ pre-bake ::< apply more deltas ::> bake a list of deltas. @@ -1718,12 +1713,12 @@ |- ^- (quip move _+>.^$) ?~ des [moz +>.^$] =^ mos +>.^$ (bake i.des) - $(moz (welp moz mos), des t.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 move) _+>.$} ::=^ mos +>.^$ (bake d) - ::[(welp m mos) +>.^$] + ::[:(welp m mos (affection i.des)) +>.^$] :: ++ peek ::< query on state ::> find the result (if any) for a given query. @@ -1775,7 +1770,7 @@ ^- rumor-story ?+ -.det det :: - ::TODO ... + ::> internal-only changes. $follow !! $inherited !! $sequent !! @@ -1852,7 +1847,10 @@ ?. ?=($story -.det) ~ ?. =(nom.qer nom.det) ~ ?: ?=(?($follow $burden) -.det.det) ~ :: internal-only delta - =+ ren=(~(so-in-range so:ta nom.qer ~ (~(got by stories) nom.qer)) ran.qer) + =/ ren + %. ran.qer + =- ~(so-in-range so:ta nom.qer ~ -) + (~(got by stories) nom.qer) ?. in.ren ~ ::TODO move up? we also check for $follow above, why? ?: ?=(?($follow $inherited $sequent) -.det.det) ~ @@ -2037,6 +2035,8 @@ =+ qer=(path-to-query pax) ?. ?=($circle -.qer) [~ +>.$] %- pre-bake + ::TODO but we don't want to remove from group when a + :: web client pulls! uncouple presence from subs? ta-done:(ta-cancel:ta src.bol nom.qer) :: ++ reap ::< catch-all reap diff --git a/lib/talk-json.hoon b/lib/talk-json.hoon index 7f73e93c39..224c4fe703 100644 --- a/lib/talk-json.hoon +++ b/lib/talk-json.hoon @@ -274,7 +274,7 @@ ++ cont ::> control |= a/control ^- json - (pairs sec+s+sec.a sis+(sa ses.a ship) ~) + (pairs sec+s+sec.a sis+(sa sis.a ship) ~) :: ++ crow ::> crowd |= a/crowd diff --git a/sur/talk.hoon b/sur/talk.hoon index 77e2982b42..35b83c6968 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -49,6 +49,9 @@ :: ::TODO look at graphql and think about doing :: multiple queries in a single %peer. + ::TODO being able to specify desired message + :: types may or may not also be nice to have. + :: ie just %app msgs, for a dashboard display. == :: ::++ circle-data ::> queried data :: $% {$all $~} ::< everything, always @@ -129,7 +132,7 @@ $% {$full sat/status} ::< fully changed status {$presence pec/presence} ::< changed presence {$human dif/diff-human} ::< changed name - {$remove $~} ::< removed config + {$remove $~} ::< removed status == :: ++ diff-human ::> name change $% {$full man/human} ::< fully changed name From f996aad7f37df53e5a550f03039c2f28207e12ea Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 1 Nov 2017 21:53:00 +0100 Subject: [PATCH 218/303] Made inline rendering of %exp speeches a bit more consistent. --- app/talk-agent.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 2fe5e67be0..d4de7319ca 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -2023,8 +2023,8 @@ $exp :- (tr-chow wyd '#' ' ' (trip exp.sep)) ?~ res.sep ~ - =- [[' ' ' ' (snag 0 -)] ~] - (wash [0 wyd] (snag 0 `(list tank)`res.sep)) + =- [' ' (tr-chow (dec wyd) ' ' -)]~ + ~(ram re (snag 0 `(list tank)`res.sep)) :: $ire $(sep sep.sep) From de061524cfaf7416fe6c3563a7c16c64ee259795 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 2 Nov 2017 00:44:13 +0100 Subject: [PATCH 219/303] Uncoupled presence from subscriptions. To gain/remove a status in a circle, it now has to un/set by the reader. --- app/talk-agent.hoon | 17 ++++++++++---- app/talk-guardian.hoon | 53 +++++++----------------------------------- mar/talk/action.hoon | 4 ++-- sur/talk.hoon | 2 +- 4 files changed, 23 insertions(+), 53 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index d4de7319ca..52549756ce 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -82,7 +82,7 @@ {$banish p/naem q/(set ship)} ::< deny permission {$source p/naem q/(map circle range)} ::< add source :: personal metadata - {$attend p/audience q/presence} ::< set our presence + {$attend p/audience q/(unit presence)} ::< set our presence {$name p/audience q/human} ::< set our name :: messaging :: {$say p/(list speech)} ::< send message @@ -690,7 +690,10 @@ ;~ (glue ace) (perk %attend ~) cirs - (perk %gone %idle %hear %talk ~) + ;~ pose + (cold ~ sig) + (cook some (perk %gone %idle %hear %talk ~)) + == == :: ;~ plug @@ -971,7 +974,9 @@ (sh-note:(set-glyph cha pas) "new glyph {}") =. ..sh-work sh-prod(active.she pas) - (sh-act %source inbox & pos) + =. ..sh-work + (sh-act %source inbox & pos) + (sh-act %notify ~(key by pos) `%hear) :: ++ leave ::< %leave ::> change local mailbox config to exclude @@ -982,7 +987,9 @@ =/ pos %- ~(run in pas) |=(p/circle [p ~]) - (sh-act %source inbox | pos) + =. ..sh-work + (sh-act %source inbox | pos) + (sh-act %notify pas ~) :: ++ create ::< %create ::> creates circle {nom} with specified config. @@ -1042,7 +1049,7 @@ ++ attend ::< set our presence ::> sets our presence to {pec} for {aud}. :: - |= {aud/audience pec/presence} + |= {aud/audience pec/(unit presence)} ^+ ..sh-work (sh-act %notify aud pec) :: diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index e5594d99a5..d5a38208cc 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -429,11 +429,13 @@ ::+| :: ++ action-notify ::< our presence update - ::> + ::> notify the audience of our new presence state, + ::> or tell them to remove us if {pes} is ~. :: - |= {aud/audience pes/presence} + |= {aud/audience pes/(unit presence)} ^+ ..ta-action - (present aud %presence pes) + ?~ pes (present aud %remove ~) + (present aud %presence u.pes) :: ++ action-naming ::< our name update ::> @@ -481,27 +483,10 @@ :: |= {her/ship qer/query} ^+ +> - ?+ -.qer - +> - :: - $burden - (ta-observe her) - :: - $circle - %- (ta-know nom.qer) |= sor/_so =< so-done - (so-attend:sor her %hear [~ ~]) + ?+ -.qer +> + $burden (ta-observe her) == :: - ++ ta-cancel ::< forget - ::> drops {src}'s subscription. deduce the right way - ::> to do this from the subscription path {pax}. - :: - |= {src/ship nom/naem} - ^+ +> - :: set ship status to %gone. - %- (ta-know nom) |= sor/_so =< so-done - (so-absent:sor src) - :: ++ ta-greet ::< subscription success ::> store a started subscription as source. :: @@ -919,22 +904,6 @@ :: (so-delta-our %remove ~) :: - ++ so-attend ::< add local status - ::> add {her} status to this story's status map. - :: - |= {her/ship sat/status} - ^+ +> - ?: =(`sat (~(get by locals) her)) +>.$ - (so-delta-our %status so-cir her %full sat) - :: - ++ so-absent ::< del local status - ::> remove {her} from our status map. - :: - |= her/ship - ^+ +> - ?. (~(has by locals) her) +> - (so-delta-our %status so-cir her %remove ~) - :: ::> || ::> || %subscriptions ::> || @@ -1885,7 +1854,6 @@ [b %diff %talk-rumor u.rum]~ ?. ?=($circle -.qer) ~ :: kill the subscription if it's past its range. - ::TODO does not remove subscribers from status list. need ta-cancel? =- ?:(done:- [b %quit ~]~ ~) %. ran.qer =- ~(so-in-range so:ta nom.qer ~ -) @@ -2032,12 +2000,7 @@ :: |= pax/path ^- (quip move _+>) - =+ qer=(path-to-query pax) - ?. ?=($circle -.qer) [~ +>.$] - %- pre-bake - ::TODO but we don't want to remove from group when a - :: web client pulls! uncouple presence from subs? - ta-done:(ta-cancel:ta src.bol nom.qer) + [~ +>] :: ++ reap ::< catch-all reap ::> handle all remote errors. diff --git a/mar/talk/action.hoon b/mar/talk/action.hoon index abbbabc0ba..8370c9c641 100644 --- a/mar/talk/action.hoon +++ b/mar/talk/action.hoon @@ -25,7 +25,7 @@ convey+(ar thot) phrase+(ot aud+audi ses+(ar spec:dejs:talk-json) ~) :: - notify+(ot aud+audi pes+pres ~) + notify+(ot aud+audi pes+(mu pres) ~) naming+(ot aud+audi man+huma ~) :: glyph+(ot gyf+so aud+audi bin+bo ~) @@ -52,7 +52,7 @@ :: $phrase ~[aud+(audi aud.act) ses+a+(turn ses.act spec:enjs)] :: - $notify ~[aud+(audi aud.act) pes+s+pes.act] + $notify ~[aud+(audi aud.act) pes+(mabe pes.act cord:enjs)] $naming ~[aud+(audi aud.act) man+(huma man.act)] :: $glyph ~[gyf+s+gyf.act aud+(sa aud.act circ) bin+b+bin.act] diff --git a/sur/talk.hoon b/sur/talk.hoon index 35b83c6968..3c8513f0f7 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -158,7 +158,7 @@ {$convey tos/(list thought)} ::< post exact {$phrase aud/audience ses/(list speech)} ::< post easy :: personal metadata :: - {$notify aud/audience pes/presence} ::< our presence update + {$notify aud/audience pes/(unit presence)} ::< our presence update {$naming aud/audience man/human} ::< our name update :: changing shared ui :: {$glyph gyf/char aud/audience bin/?} ::< un/bind a glyph From 80b427855476eb250d80a02825665327db2e2619 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 2 Nov 2017 16:19:50 +0100 Subject: [PATCH 220/303] Fixed off-by-one error when doing %lin wrapping. --- app/talk-agent.hoon | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 52549756ce..cbd14b55ae 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -2067,13 +2067,13 @@ =/ txt (tuba (trip msg.sep)) |- ^- (list tape) ?~ txt ~ - =/ end - ?: (lte (lent txt) wyd) (lent txt) + =+ ^- {end/@ud nex/?} + ?: (lte (lent txt) wyd) [(lent txt) &] =+ ace=(find " " (flop (scag +(wyd) `(list @c)`txt))) - ?~ ace wyd - (sub wyd u.ace) + ?~ ace [wyd |] + [(sub wyd u.ace) &] :- (weld pef (tufa (scag end `(list @c)`txt))) - $(txt (slag +(end) `(list @c)`txt), pef (reap (lent pef) ' ')) + $(txt (slag ?:(nex +(end) end) `(list @c)`txt), pef (reap (lent pef) ' ')) :: $inv :_ ~ From 6b88de73d3a5c494a1fefbc87f0cee7093ba55bb Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 2 Nov 2017 16:20:30 +0100 Subject: [PATCH 221/303] Made talk-agent render width configurable. --- app/talk-agent.hoon | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index cbd14b55ae..2943842b8a 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -56,6 +56,7 @@ say/sole-share ::< console state active/audience ::< active targets settings/(set term) ::< frontend settings + width/@ud ::< display width == :: ++ move (pair bone card) ::< all actions ++ lime ::> diff fruit @@ -99,11 +100,11 @@ {$nick p/(unit ship) q/(unit cord)} ::< un/set/show nick {$set p/term} ::< enable setting {$unset p/term} ::< disable setting + {$width p/@ud} ::< change display width :: miscellaneous :: {$help $~} ::< print usage info == :: ++ glyphs `wall`~[">=+-" "}),." "\"'`^" "$%&@"] ::< circle char pool ' - ++ termwidth 80 ::TODO put in setting or something? -- :: ::> || @@ -428,7 +429,7 @@ :: ^+ . =/ she/shell - %*(. *shell id ost.bol, active (sy incir ~)) + %*(. *shell id ost.bol, active (sy incir ~), width 80) sh-done:~(sh-prod sh she) :: ++ ta-sole ::< apply sole input @@ -744,6 +745,8 @@ == == :: + ;~(plug (cold %width (jest 'set width ')) dem:ag) + :: ;~(plug (perk %set ~) ;~(pose ;~(pfix ace setting) (easy %$))) :: ;~(plug (perk %unset ~) ;~(pfix ace setting)) @@ -872,6 +875,7 @@ $nick (nick +.job) $set (wo-set +.job) $unset (unset +.job) + $width (width +.job) :: miscelaneous $help help == @@ -1250,6 +1254,13 @@ 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)) + :: ::> || ::> || %miscellaneous ::> || @@ -1887,7 +1898,7 @@ :: ^- (list tape) =/ wyd - %+ sub termwidth :: termwidth, + %+ sub width.cli :: termwidth, %+ add 14 :: minus author, ?:((~(has in sef) %showtime) 10 0) :: minus timestamp. =+ txs=(tr-text wyd) @@ -1960,8 +1971,10 @@ :- %tan ::TODO in "wrong" order because they get printed in reverse... :~ :+ %rose [" " ~ ~] - (turn (~(tr-text tr sef u.gam) termwidth) |=(t/tape [%leaf t])) - [%leaf :(weld "in reply to: " (cite:title aut.u.gam) ": ")] + %+ turn (~(tr-text tr sef u.gam) width.cli) + |=(t/tape [%leaf t]) + :: + [%leaf "in reply to: {(cite:title aut.u.gam)}: "] == :: $fat From 89c8ed605b16dcd30f444fff05bdc3caf979be82 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 2 Nov 2017 16:36:23 +0100 Subject: [PATCH 222/303] Renamed nik/nak to be slightly more descriptive. --- app/talk-agent.hoon | 60 ++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 2943842b8a..45edbe81f6 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -46,8 +46,8 @@ mirrors/(map circle config) ::< remote configs :: ui state :: nicks/(map ship nick) ::< human identities - nik/(map audience char) ::< bound circle glyphs - nak/(jug char audience) ::< circle glyph lookup + bound/(map audience char) ::< bound circle glyphs + binds/(jug char audience) ::< circle glyph lookup cli/shell ::< interaction state == :: ++ shell ::> console session @@ -162,15 +162,15 @@ ?~ num ~ `(snag u.num grams) :: -++ nik-from-nak ::< nik from nak - ::> +++ bound-from-binds ::< bound from binds + ::> using a mapping of character to audiences, create + ::> a mapping of audience to character. :: - ::TODO ...we really should rename these. - |= nek/_nak - ^+ nik + |= bin/_binds + ^+ bound %- ~(gas by *(map audience char)) =- (zing -) - %+ turn ~(tap by nek) + %+ turn ~(tap by bin) |= {a/char b/(set audience)} (turn ~(tap by b) |=(c/audience [c a])) :: @@ -274,8 +274,8 @@ :: $reader %= +> - nak gys.piz - nik (nik-from-nak gys.piz) + binds gys.piz + bound (bound-from-binds gys.piz) nicks nis.piz == :: @@ -357,10 +357,10 @@ :: |= {bin/? gyf/char aud/audience} ^+ +> - =+ nek=(change-glyphs nak bin gyf aud) - ?: =(nek nak) +>.$ :: no change - =. nak nek - =. nik (nik-from-nak nek) + =+ nek=(change-glyphs binds bin gyf aud) + ?: =(nek binds) +>.$ :: no change + =. binds nek + =. bound (bound-from-binds nek) sh-done:~(sh-prod sh cli) :: ::> || @@ -907,7 +907,7 @@ %+ reel glyphs |= {all/tape ole/{cha/char num/@}} =+ new=(snag (mod idx (lent all)) all) - =+ num=~(wyt in (~(get ju nak) new)) + =+ num=~(wyt in (~(get ju binds) new)) ?~ cha.ole [new num] ?: (lth num.ole num) ole @@ -918,8 +918,8 @@ ::> an action. :: |= {cha/char aud/audience} - =: nik (~(put by nik) aud cha) - nak (~(put ju nak) cha aud) + =: bound (~(put by bound) aud cha) + binds (~(put ju binds) cha aud) == (sh-act %glyph cha aud &) :: @@ -930,15 +930,15 @@ |= {cha/char aud/(unit audience)} =/ ole/(set audience) ?^ aud [u.aud ~ ~] - (~(get ju nak) cha) + (~(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 - nik (~(del by nik) n.ole) - nak (~(del ju nak) cha n.ole) + bound (~(del by bound) n.ole) + binds (~(del ju binds) cha n.ole) == :: ++ reverse-nicks ::< find by handle @@ -972,7 +972,7 @@ ^+ ..sh-work =+ pas=~(key by pos) =. ..sh-work - =+ (~(get by nik) pas) + =+ (~(get by bound) pas) ?^ - (sh-note "has glyph {}") =+ cha=(glyph (mug pas)) (sh-note:(set-glyph cha pas) "new glyph {}") @@ -1141,9 +1141,9 @@ |= qur/$@(char audience) ^+ ..sh-work ?^ qur - =+ cha=(~(get by nik) qur) + =+ cha=(~(get by bound) qur) (sh-fact %txt ?~(cha "none" [u.cha]~)) - =+ pan=~(tap in (~(get ju nak) qur)) + =+ pan=~(tap in (~(get ju binds) qur)) ?: =(~ pan) (sh-fact %txt "~") =< (sh-fact %mor (turn pan .)) |=(a/audience [%txt ~(ar-prom ar a)]) @@ -1178,7 +1178,7 @@ |= {cha/char aud/(unit audience)} ^+ ..sh-work ?~ aud $(aud `active.she) - =+ ole=(~(get by nik) u.aud) + =+ ole=(~(get by bound) u.aud) ?: =(ole [~ cha]) ..sh-work %. "bound {} {}" sh-note:sh-prod:(set-glyph cha u.aud) @@ -1188,8 +1188,8 @@ :: |= {cha/char aud/(unit audience)} ^+ ..sh-work - ?. ?| &(?=(^ aud) (~(has by nik) u.aud)) - &(?=($~ aud) (~(has by nak) cha)) + ?. ?| &(?=(^ aud) (~(has by bound) u.aud)) + &(?=($~ aud) (~(has by binds) cha)) == ..sh-work %. "unbound {}" @@ -1309,7 +1309,7 @@ ::> finds the circle(s) that match a glyph. :: |= cha/char ^- (unit audience) - =+ lax=(~(get ju nak) cha) + =+ lax=(~(get ju binds) cha) ::> no circle. ?: =(~ lax) ~ ::> single circle. @@ -1467,7 +1467,7 @@ ^- tape =/ rew/(pair (pair cord cord) audience) [['[' ']'] active.she] - =+ cha=(~(get by nik) q.rew) + =+ 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 ' ' ~]) @@ -1772,7 +1772,7 @@ ^- tape :: render circle (as glyph if we can). ?~ moy - =+ cha=(~(get by nik) one ~ ~) + =+ cha=(~(get by bound) one ~ ~) =- ?~(cha - "'{u.cha ~}' {-}") ~(cr-phat cr one) (~(cr-curt cr one) u.moy) @@ -1851,7 +1851,7 @@ ::> complex audiences, use reserved "glyphs". :: ^- tape - =+ cha=(~(get by nik) aud) + =+ cha=(~(get by bound) aud) ?^ cha ~[u.cha ' '] ?. (lien ~(tap by aud) ar-dire) "* " From 82fbe1456e4a25a53ae7d64e62994e84f671cc83 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 2 Nov 2017 16:53:19 +0100 Subject: [PATCH 223/303] Cleaned up code relating to ++work. --- app/talk-agent.hoon | 69 ++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 38 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 45edbe81f6..c91094d9a0 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -73,34 +73,34 @@ == :: ++ work ::> interface action $% :: circle management :: - {$join p/(map circle range)} ::< subscribe to - {$leave p/audience} ::< unsubscribe from - {$create p/security q/naem r/cord} ::< create circle - {$delete p/naem q/(unit cord)} ::< delete circle - {$depict p/naem q/cord} ::< change description - {$filter p/naem q/? r/?} ::< change message rules - {$invite p/naem q/(set ship)} ::< give permission - {$banish p/naem q/(set ship)} ::< deny permission - {$source p/naem q/(map circle range)} ::< add source - :: personal metadata - {$attend p/audience q/(unit presence)} ::< set our presence - {$name p/audience q/human} ::< set our name + {$join (map circle range)} ::< subscribe to + {$leave audience} ::< unsubscribe from + {$create security naem cord} ::< create circle + {$delete naem (unit cord)} ::< delete circle + {$depict naem cord} ::< change description + {$filter naem ? ?} ::< change message rules + {$invite naem (set ship)} ::< give permission + {$banish naem (set ship)} ::< deny permission + {$source naem (map circle range)} ::< add source + :: personal metadata :: + {$attend audience (unit presence)} ::< set our presence + {$name audience human} ::< set our name :: messaging :: - {$say p/(list speech)} ::< send message - {$eval p/cord q/twig} ::< send #-message + {$say (list speech)} ::< send message + {$eval cord twig} ::< send #-message {$target p/audience q/(unit work)} ::< set active targets - {$reply p/$@(@ud {@u @ud}) q/(list speech)} ::< reply to + {$reply $@(@ud {@u @ud}) (list speech)} ::< reply to :: displaying info :: - {$number p/$@(@ud {@u @ud})} ::< relative/absolute - {$who p/audience} ::< presence - {$what p/$@(char audience)} ::< show bound glyph + {$number $@(@ud {@u @ud})} ::< relative/absolute + {$who audience} ::< presence + {$what $@(char audience)} ::< show bound glyph :: ui settings :: - {$bind p/char q/(unit audience)} ::< bind glyph - {$unbind p/char q/(unit audience)} ::< unbind glyph - {$nick p/(unit ship) q/(unit cord)} ::< un/set/show nick - {$set p/term} ::< enable setting - {$unset p/term} ::< disable setting - {$width p/@ud} ::< change display width + {$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 :: miscellaneous :: {$help $~} ::< print usage info == :: @@ -846,7 +846,6 @@ :: ++ work ::< call correct worker ?- -.job - ::TODO for inv/ban, enl/ret etc, set bools here? :: circle management $join (join +.job) $leave (leave +.job) @@ -854,8 +853,8 @@ $delete (delete +.job) $depict (depict +.job) $filter (filter +.job) - $invite (invite +.job) - $banish (banish +.job) + $invite (permit & +.job) + $banish (permit | +.job) $source (source +.job) :: personal metadata $attend (attend +.job) @@ -1019,25 +1018,19 @@ ^+ ..sh-work (sh-act %depict nom txt) :: - ++ invite ::< %invite - ::> invites {sis} to our circle {nom}. + ++ permit ::< %invite / %banish + ::> invites or banishes {sis} to/from our + ::> circle {nom}. :: - |= {nom/naem sis/(set ship)} + |= {inv/? nom/naem sis/(set ship)} ^+ ..sh-work - (sh-act %permit nom & sis) + (sh-act %permit nom inv sis) :: ++ filter |= {nom/naem cus/? utf/?} ^+ ..sh-work (sh-act %filter nom cus utf) :: - ++ banish ::< %banish - ::> banish {sis} from our circle {nom}. - :: - |= {nom/naem sis/(set ship)} - ^+ ..sh-work - (sh-act %permit nom | sis) - :: ++ source ::< %source ::> adds {pas} to {nom}'s src. :: From 945544e92d48b6b44887b5ef4c854327d639bec6 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 2 Nov 2017 17:14:57 +0100 Subject: [PATCH 224/303] Consolidated ++pr (formerly passport rendered) into ++cr (circle renderer). --- app/talk-agent.hoon | 78 +++++++++++++-------------------------------- 1 file changed, 22 insertions(+), 56 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index c91094d9a0..2d1aa8de80 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -1117,7 +1117,7 @@ ?. |(=(~ cis) (~(has in cis) cir)) ~ ?: =(%mailbox sec.con:(fall (~(get by mirrors) cir) *config)) ~ ?. (~(has in sources) cir) ~ - =- `[%tan rose+[", " `~]^- leaf+~(pr-full pr 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] @@ -1563,12 +1563,12 @@ |- ^+ +>.^$ ?~ old +>.^$ =. +>.^$ $(old t.old) - (sh-note (weld pre "off {~(pr-full pr cir.i.old)}")) + (sh-note (weld pre "off {~(cr-full cr cir.i.old)}")) =. +>.$ |- ^+ +>.^$ ?~ new +>.^$ =. +>.^$ $(new t.new) - (sh-note (weld pre "hey {~(pr-full pr cir.i.new)}")) + (sh-note (weld pre "hey {~(cr-full cr cir.i.new)}")) +>.$ :: ++ sh-show-config ::< show config @@ -1651,7 +1651,7 @@ :: one/circle :: - ++ cr-best ::< best to show + ++ cr-beat ::< {one} more relevant? ::> returns true if one is better to show, false ::> otherwise. prioritizes: our > main > size. :: @@ -1659,21 +1659,27 @@ ^- ? :: the circle that's ours is better. ?: =(our.bol hos.one) - ?. =(our.bol hos.two) %& + ?. =(our.bol hos.two) & ?< =(nom.one nom.two) :: if both circles are ours, the main story is better. - ?: =(%inbox nom.one) %& - ?: =(%inbox nom.two) %| + ?: =(%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. - ?: =(our.bol hos.two) %| + ?: =(our.bol 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 ::< get most relevant + ::> returns the most relevant circle. + :: + |= two/circle + ?:((cr-beat two) one two) + :: ++ cr-curt ::< render name in 14 ::> prints a ship name in 14 characters. left-pads ::> with spaces. {mup} signifies "are there other @@ -1714,50 +1720,10 @@ ?: =(hos.one (sein:title our.bol)) ['/' (trip nom.one)] :(welp wun "/" (trip nom.one)) - -- -:: -::TODO maybe merge with cr? -++ pr ::< circle renderer - ::> used primarily for printing circles. :: - |_ ::> one: the circle - :: - one/circle + ++ cr-full (cr-show ~) ::< render full width :: - ++ pr-beat ::< more relevant - ::> returns true if one is better to show, false - ::> otherwise. prefers circles over passports. - ::> if both are circles, ++cr-best. - ::> if both are passports, pick the "larger" one. - ::> if they're equal, content hash. - :: - |= two/circle ^- ? - (~(cr-best cr one) two) - :: - ++ pr-best ::< most relevant - ::> picks the most relevant circle. - :: - |=(two/circle ?:((pr-beat two) two one)) - :: - ++ pr-sigh ::< assemble label - ::> prepend {pre} to {yiz}, omitting characters of - ::> {yiz} to stay within {len} characters. - :: - |= {len/@ud pre/tape yiz/cord} - ^- tape - =+ nez=(trip yiz) - =+ lez=(lent nez) - ?> (gth len (lent pre)) - =. len (sub len (lent pre)) - ?. (gth lez len) - =. nez (welp pre nez) - ?. (lth lez len) nez - (runt [(sub len lez) '-'] nez) - :(welp pre (scag (dec len) nez) "+") - :: - ++ pr-full (pr-show ~) ::< render full width - :: - ++ pr-show ::< render circle + ++ cr-show ::< render circle ::> renders a circle as text. :: ::> moy: multiple circles in audience? @@ -1788,8 +1754,8 @@ |- ^- circle =+ lef=`(unit circle)`ar-best(aud l.aud) =+ rit=`(unit circle)`ar-best(aud r.aud) - =? n.aud ?=(^ lef) (~(pr-best pr n.aud) u.lef) - =? n.aud ?=(^ rit) (~(pr-best pr n.aud) u.rit) + =? n.aud ?=(^ lef) (~(cr-best cr n.aud) u.lef) + =? n.aud ?=(^ rit) (~(cr-best cr n.aud) u.rit) n.aud :: ++ ar-deaf ::< except for self @@ -1814,20 +1780,20 @@ =/ all %+ sort `(list circle)`~(tap in aud) |= {a/circle b/circle} - (~(pr-beat pr a) b) + (~(cr-beat cr a) b) =+ fir=& |- ^- tape ?~ all ~ ;: welp ?:(fir "" " ") - (~(pr-show pr i.all) ~) + (~(cr-show cr i.all) ~) $(all t.all, fir |) == :: ++ ar-whom ::< render sender ::> render sender as the most relevant circle. :: - (~(pr-show pr (need ar-best)) ~ ar-maud) + (~(cr-show cr (need ar-best)) ~ ar-maud) :: ++ ar-dire ::< direct message ::> returns true if circle is a mailbox of ours. @@ -1938,7 +1904,7 @@ =/ cis %+ turn ~(tap in aud) |= a/circle - leaf+~(pr-full pr a) + leaf+~(cr-full cr a) [%rose [" " ~ ~] [hed >who< [%rose [", " "to " ~] cis] ~]]~ :: ++ tr-body ::< message content From 0b0b6ccf274e2032d7158f10898e60695f4500c4 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 2 Nov 2017 18:23:59 +0100 Subject: [PATCH 225/303] Allow for entering of @da and @dr into a source's range. --- app/talk-agent.hoon | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 2d1aa8de80..59e6877298 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -580,21 +580,35 @@ %+ 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 - ::TODO support entering of @da and @dr, - :: convert all to @da. use sear with crub? - :: also allow "now"? + (cold [%da now.bol] (jest 'now')) + (stag %da (drat hed)) (stag %ud dem:ag) == :: ++ rang ::< subscription range =+ ;~ pose - (cook some ;~(pfix fas pont)) + (cook some ;~(pfix fas (pont |))) (easy ~) == ;~ pose - (cook some ;~(plug ;~(pfix fas pont) -)) + (cook some ;~(plug ;~(pfix fas (pont &)) -)) (easy ~) == :: From cda08d5d62ea1f758b54a450b065838e1203ba16 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 2 Nov 2017 18:30:25 +0100 Subject: [PATCH 226/303] Trivial changes & cleanup in talk-agent. --- app/talk-agent.hoon | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 59e6877298..2405430fe7 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -2,8 +2,6 @@ :::: /hoon/talk-agent/app :: :: :: :: :: :: -::TODO master changes, incl %notify -::TODO guardian's todo's apply here too ::TODO make sure glyphs only get bound when joins succeed :: ...this is a bit troublesome, because failed joins don't actually :: unsubscribe us. @@ -833,6 +831,7 @@ [%nex ~] [%det cal] ?. ?=({$';' *} buf) ~ + ?: ?=($reply -.u.jub) ~ :_ ~ [%txt (runt [14 '-'] `tape`['|' ' ' (tufa `(list @)`buf)])] == @@ -1105,7 +1104,7 @@ :: |= {num/$@(@ud {p/@u q/@ud}) sep/(list speech)} ^+ ..sh-work - ::TODO =- (say (turn ... [%ire - s])) nest-fails on the - ??? + :: =- (say (turn ... [%ire - s])) nest-fails on the - ??? ::TODO what's friendlier, reply-to-null or error? =/ ser/serial ?@ num @@ -1115,7 +1114,7 @@ ?: =(count 0) 0v0 =+ msg=(deli (dec count) num) uid:(snag (sub count +(msg)) grams) - (say (turn sep |=(s/speech [%ire `serial`ser s]))) + (say (turn sep |=(s/speech [%ire ser s]))) :: ::> || ::> || %displaying-info @@ -1487,7 +1486,6 @@ =+ lis=~(tr-rend tr settings.she gam) ?~ lis +>.$ %+ sh-fact %mor - ::TODO? we need to cast, but not if we do =(0 (lent lis)) above instead.. %+ turn `(list tape)`lis =+ nom=(scag 7 (cite:title our.bol)) |= t/tape @@ -1630,7 +1628,6 @@ :: |= gam/telegram ^+ +> - ::TODO is it cool to just assume all messages we print are already stored? =+ num=(~(got by known) uid.gam) =. +>.$ :: if the number isn't directly after latest, print it always. @@ -1939,16 +1936,11 @@ $ire =+ gam=(recall top.sep) ?~ gam $(sep sep.sep) - :- %mor - =- [- $(sep sep.sep) ~] - :- %tan - ::TODO in "wrong" order because they get printed in reverse... - :~ :+ %rose [" " ~ ~] - %+ turn (~(tr-text tr sef u.gam) width.cli) - |=(t/tape [%leaf t]) - :: - [%leaf "in reply to: {(cite:title aut.u.gam)}: "] - == + =- mor+[tan+- $(sep sep.sep) ~] + %- flop %+ weld + [%leaf "in reply to: {(cite:title aut.u.gam)}: "]~ + %+ turn (~(tr-text tr sef u.gam) width.cli) + |=(t/tape [%leaf t]) :: $fat [%mor $(sep sep.sep) tan+(tr-tach tac.sep) ~] From 58268b784cf0b2fcc9aea9b8713a9c3bf5b5a319 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 2 Nov 2017 20:22:15 +0100 Subject: [PATCH 227/303] Fixed primary reproduction case for runtime error bug. --- app/talk-guardian.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index d5a38208cc..341e43179b 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -1687,7 +1687,7 @@ ::%+ roll des ::|= {d/delta m/(list move) _+>.$} ::=^ mos +>.^$ (bake d) - ::[:(welp m mos (affection i.des)) +>.^$] + ::[:(welp m mos (affection d)) +>.^$] :: ++ peek ::< query on state ::> find the result (if any) for a given query. From 6e4b9fe6b7ff255db78a0f24ece78167dd0b62c1 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 3 Nov 2017 15:54:25 +0100 Subject: [PATCH 228/303] Updated circle query paths to be slightly more flexible in the data they subscribe to. Internal %peer paths in the guardian got a bit messy. --- app/talk-agent.hoon | 2 +- app/talk-guardian.hoon | 178 +++++++++++++++++++++++++++-------------- lib/talk.hoon | 5 +- sur/talk.hoon | 43 +++------- 4 files changed, 135 insertions(+), 93 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 2405430fe7..4d1b028035 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -259,7 +259,7 @@ %peer / broker - /circle/[inbox] + /circle/[inbox]/grams/config/group == == :: diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 341e43179b..308a11b5dc 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -768,15 +768,16 @@ $config :: full changes to us need to get split up. ?: &(=(cir.rum so-cir) ?=($full -.dif.rum)) (so-config-full `shape cof.dif.rum) - :: remotes are fine. + :: we only subscribe to remotes' configs. ?: =(src cir.rum) (so-delta-our rum) - :: remotes of remotes are not. - ~? =(src so-cir) %but-src-is-us - +> - $status :: ignore foreign remotes. - ?. |(=(src cir.rum) =(src so-cir)) +> - (so-delta-our rum) + ~! %unexpected-remote-config-from-remote + !! + $status :: we only subscribe to remotes' locals. + ?: |(=(src cir.rum) =(src so-cir)) + (so-delta-our rum) + ~! %unexpected-remote-status-from-remote + !! $remove (so-delta-our %config src %remove ~) == :: @@ -1551,8 +1552,9 @@ %+ turn ~(tap in srs) |= {cir/circle ran/range} ^- (unit card) - ?: =(cir sa-cir) ~ :: ignore self-subs - `(circle-peer nom cir ran) + ?: =(cir sa-cir) ~ :: ignore self-subs + =+ wat=[%grams %config-l %group-l ~] + `(circle-peer nom wat cir ran) :: ++ sa-abjure ::< unsubscribe us ::> unsubscribes this story from each circle. @@ -1566,7 +1568,12 @@ :_ ~ =+ rap=(range-to-path ran) :* %pull - (welp /circle/[nom]/(scot %p hos.cir)/[nom.cir] rap) + ;: welp + /[nom]/(scot %p hos.cir) + /circle/[nom.cir] + /grams/config-l/group-l + rap + == [hos.cir dap.bol] ~ == @@ -1603,6 +1610,23 @@ ::> || ::+| :: +++ target ::< ship+path from wire + ::> parses {wir} to obtain the target ship and the + ::> query path. + :: + |= wir/wire + ^- (pair ship path) + ?+ wir !! + {@ @ $circle *} + [(slav %p i.t.wir) t.t.wir] + :: + {$burden *} + [(above our.bol) wir] + :: + {@ $report *} + [(slav %p i.wir) t.wir] + == +:: ++ etch ::< parse wire ::> parses {wir} to obtain either %circle with story ::> and circle or %repeat with message number, source @@ -1610,16 +1634,15 @@ :: |= wir/wire ^- weir - ?+ -.wir !! - $circle - ?> ?=({@ @ @ *} t.wir) + ?+ wir !! + {@ @ $circle @ *} + :: us, host, $circle, target :^ %circle - i.t.wir - [(slav %p i.t.t.wir) i.t.t.t.wir] + i.wir + [(slav %p i.t.wir) i.t.t.t.wir] (path-to-range t.t.t.t.wir) :: - $repeat - ?> ?=({@ @ @ $~} t.wir) + {$repeat @ @ @ $~} :+ %repeat [(slav %p i.t.wir) i.t.t.wir] ((list serial) (cue (slav %ud i.t.t.t.wir))) @@ -1652,13 +1675,13 @@ ::> constructs a %peer move to subscribe {nom} to a ::> source. :: - |= {nom/naem source} + |= {nom/naem wat/(list circle-data) source} ^- card - =+ rap=(range-to-path ran) + =+ pax=:(welp /circle/[nom.cir] wat (range-to-path ran)) :* %peer - (welp /circle/[nom]/(scot %p hos.cir)/[nom.cir] rap) + (welp /[nom]/(scot %p hos.cir) pax) [hos.cir dap.bol] - (welp /circle/[nom.cir] rap) + pax == :: ::> || @@ -1727,8 +1750,12 @@ :+ %+ turn (~(so-first-grams so:ta nom.qer ~ u.soy) ran.qer) (cury gram-to-envelope nom.qer) - [shape.u.soy mirrors.u.soy] - [locals.u.soy remotes.u.soy] + :- 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 @@ -1777,6 +1804,22 @@ %. uid.gam ~(got by known:(~(got by stories) nom)) :: +++ circle-feel-story ::< + ::> + :: + |= {wat/(set circle-data) nom/naem det/delta-story} + ^- ? + ?: =(wat ~) & + %- ~(has in wat) + ?+ -.det %hasnot + $gram %grams + $new %config-l + $config ?: =(cir.det [our.bol nom]) + %config-l %config-r + $status ?: =(cir.det [our.bol nom]) + %group-l %group-r + == +:: ++ feel ::< delta to rumor ::> if the given delta changes the result of the given ::> query, produce the relevant rumor. @@ -1813,22 +1856,17 @@ `[%burden nom.det (dedicate (above our.bol) nom.det det.det)] :: $circle - ?. ?=($story -.det) ~ - ?. =(nom.qer nom.det) ~ - ?: ?=(?($follow $burden) -.det.det) ~ :: internal-only delta - =/ ren - %. ran.qer - =- ~(so-in-range so:ta nom.qer ~ -) - (~(got by stories) nom.qer) - ?. in.ren ~ - ::TODO move up? we also check for $follow above, why? - ?: ?=(?($follow $inherited $sequent) -.det.det) ~ - =/ rum/rumor-story - ?+ -.det.det det.det - $gram - [%gram (gram-to-envelope nom.det gam.det.det)] - == - `[%circle rum] + ?. ?=($story -.det) ~ + ?. =(nom.qer nom.det) ~ + ?. (circle-feel-story wat.qer nom.det det.det) ~ + =/ sor (~(got by stories) nom.qer) + ?. in:(~(so-in-range so:ta nom.qer ~ sor)) ~ + ?. ?=(?($gram $new $config $status) -.det.det) ~ + :+ ~ %circle + ?+ det.det det.det + {$gram *} + [%gram (gram-to-envelope nom.det gam.det.det)] + == == :: ++ affection ::< rumors to interested @@ -1864,7 +1902,31 @@ ::> into a query structure. :: |= pax/path - (coins-to-query (path-to-coins pax)) + ?. ?=({$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 + ?~ pax qer + ::TODO can probably do this a bit better... + ?+ i.pax + qer(ran (path-to-range 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 + (sy %group-l %group-r ~) + == + $config %_ $ pax t.pax + wat.qer %- ~(uni in wat.qer) + ^+ wat.qer + (sy %config-l %config-r ~) + == + == :: ++ path-to-coins ::< path to coin list ::> parse a path into a list of coins. @@ -1884,7 +1946,6 @@ [%reader ul] [%burden (at /[%p])] [%report ul] - [%circle (al term rang)] == ++ term (do %tas) ++ rang (mu (al plac (mu (un plac)))) @@ -2002,23 +2063,16 @@ ^- (quip move _+>) [~ +>] :: -++ reap ::< catch-all reap - ::> handle all remote errors. - :: +++ reap ::< subscription n/ack + ::> update state to reflect subscription success + ::: |= {wir/wire fal/(unit tang)} ^- (quip move _+>) - ?~ fal [~ +>] - ~| reap-fail+wir - (mean u.fal) -:: -++ reap-circle ::< subscription n/ack - ::> if subscribing failed, update state to reflect - ::> that. - :: - ::TODO update to handle all subscription kinds. - |= {wir/wire fal/(unit tang)} - ^- (quip move _+>) - %+ etch-circle [%circle wir] + ?. ?=({@ @ $circle *} wir) + ?~ fal [~ +>] + ~| reap-fail+wir + (mean u.fal) + %+ etch-circle wir |= {nom/naem src/source} ?~ fal %- pre-bake @@ -2028,10 +2082,18 @@ %- pre-bake ta-done:(ta-leave:ta nom src) :: -++ quit-circle ::< dropped subscription +++ quit ::< dropped subscription + ::> gall dropped out subscription. resubscribe. + :: + |= wir/wire + ^- (quip move _+>) + :_ +> + =+ tar=(target wir) + [0 %peer wir [p.tar dap.bol] q.tar]~ +:: +++ quit-circle ::< dropped circle sub ::> gall dropped our subscription. resubscribe. :: - ::TODO update for all subscription kinds. |= wir/wire ^- (quip move _+>) %+ etch-circle [%circle wir] diff --git a/lib/talk.hoon b/lib/talk.hoon index 204eb1e050..4303762641 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -61,11 +61,14 @@ :: ++ path-to-range ::< path to msg range ::> turns the tail of a subscription path into a - ::> range structure. + ::> range structure, skipping over non-range terms. :: |= pax/path ^- range ?~ pax ~ + :: skip past non-number parts of path. + ?: ?=({$~ $~} [(slaw %da i.pax) (slaw %ud i.pax)]) + $(pax t.pax) :+ ~ =+ hed=(slaw %da i.pax) ?^ hed [%da u.hed] diff --git a/sur/talk.hoon b/sur/talk.hoon index 3c8513f0f7..16cc1da376 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -25,40 +25,17 @@ $% {$reader $~} ::< shared ui state {$burden who/ship} ::< duties to share {$report $~} ::< duty reports - {$circle nom/naem ran/range} ::< story query - ::{$circle nom/naem wat/circle-data} ::< story query - :: okay, the problem here is that we want to have - :: separate subscriptions for the different kinds - :: of story data. we can do that, but then if we - :: want all data and a specific range for the - :: messages (very common) then we need to do - :: three separate subscriptions. - :: possible solution would be adding range to all - :: story queries, but that feels weird irt - :: presence and configs. - :: (also, that would make for poor query design: - :: having a ~ halfway through is ugly.) - :: - :: /circle/name/range - :: /circle/name/all - :: /circle/name/grams/range - :: /circle/name/crowd/local - :: /circle/name/grams&crowd/range/local - :: /circle/name/grams - :: /circle/name/crowd - :: - ::TODO look at graphql and think about doing - :: multiple queries in a single %peer. - ::TODO being able to specify desired message - :: types may or may not also be nice to have. - :: ie just %app msgs, for a dashboard display. + {$circle nom/naem wat/(set circle-data) ran/range}::< story query + ::TODO in the future, we may want much more :: + :: detailed querying abilities. :: + == :: +++ circle-data ::> kinds of circle data + $? $grams ::< messages + $group-l ::< local presence + $group-r ::< remote presences + $config-l ::< local config + $config-r ::< remote configs == :: -::++ circle-data ::> queried data -:: $% {$all $~} ::< everything, always -:: {$grams ran/range} ::< messages (in range) -:: {$crowd wer/where} ::< presence -:: {$lobby wer/where} ::< configurations -:: == :: ++ range ::> inclusive msg range %- unit ::< ~ means everything $: hed/place ::< start of range From 3bb8df9e01a09a77d6a17d4025abfc159e7ba2ee Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 3 Nov 2017 20:00:11 +0100 Subject: [PATCH 229/303] Added an indicator (^) to %ire %lins. --- app/talk-agent.hoon | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 4d1b028035..c29f42256a 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -1815,19 +1815,19 @@ &(?=(^ sot) ?=($mailbox sec.con.u.sot)) == :: - ++ ar-pref ::< audience glyph - ::> get the glyph that corresponds to the audience, - ::> with a space appended. for mailbox messages and - ::> complex audiences, use reserved "glyphs". + ++ ar-glyf ::< 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 ' '] + ?^ cha ~[u.cha] ?. (lien ~(tap by aud) ar-dire) - "* " + "*" ?: ?=({^ $~ $~} aud) - ": " - "; " + ":" + ";" -- :: ++ tr ::< telegram renderer @@ -1995,6 +1995,8 @@ ::> message. if possible, these stay within a single ::> line. :: + ::> rep: is reply? + =| rep/_| |= wyd/@ud ^- (list tape) ?- -.sep @@ -2012,7 +2014,7 @@ ~(ram re (snag 0 `(list tank)`res.sep)) :: $ire - $(sep sep.sep) + $(sep sep.sep, rep &) :: $url :_ ~ @@ -2037,7 +2039,8 @@ :: glyph prefix =/ pef ?: pat.sep " " - %~ ar-pref ar + =- (weld - ?:(rep "^ " " ")) + %~ ar-glyf ar ?: =(who our.bol) aud (~(del in aud) [%& who %inbox]) == From ba7b4c47e4c3223b55162b05b569ffef5232bb2c Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 3 Nov 2017 20:31:16 +0100 Subject: [PATCH 230/303] Changed ++ta-note to accept a tape. --- app/talk-guardian.hoon | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 308a11b5dc..a716ff88cc 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -178,10 +178,10 @@ ::> sends {msg} as an %app message to the user's ::> inbox. :: - |= msg/cord + |= msg/tape %^ ta-action 0 %phrase :- [[our.bol %inbox] ~ ~] - [%app dap.bol msg]~ + [%app dap.bol (crip msg)]~ :: ++ ta-evil ::< emit error ::> tracing printf and crash. @@ -603,14 +603,13 @@ ^+ +> ?: pub ?. (team:title our.bol aut) - %- ta-note - (crip "strange author {(scow %p 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) - %- ta-note ::TODO avenue for abuse? - (crip "have no story {(scow %tas nom.cir)}") + ::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) @@ -1996,7 +1995,7 @@ ?. (team:title src.bol our.bol) %- pre-bake =< ta-done - %- ta-note:ta %- crip + %- ta-note:ta "talk-action stranger {(scow %p src.bol)}" %- pre-bake ta-done:(ta-action:ta ost.bol act) From 11a9f9151e545e1b36ada8dcf9b7868521edf5bb Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 3 Nov 2017 20:32:16 +0100 Subject: [PATCH 231/303] Changed some internal %peer paths as required for 6e4b9fe6. --- app/talk-guardian.hoon | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index a716ff88cc..9dc18c5e5f 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -1209,11 +1209,12 @@ ::> ship above us. :: %- da-emit + =+ pax=/burden/(scot %p our.bol) :* 0 %peer - /burden + pax [(above our.bol) dap.bol] - /burden/(scot %p our.bol) + pax == :: ++ da-observe ::< watch burden bearer @@ -1224,7 +1225,7 @@ %- da-emit :* 0 %peer - /report/(scot %p who) + /(scot %p who)/report [who dap.bol] /report == From 061d9326e1f6b15aafec89b6e5b1d61c56961d0b Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 3 Nov 2017 21:36:42 +0100 Subject: [PATCH 232/303] Implemented a "public membership" list. Users can add circles they've joined to this list. Others can query it. This should allow for circle discovery functionality. --- app/talk-agent.hoon | 15 +++++++++++ app/talk-guardian.hoon | 56 +++++++++++++++++++++++++++++++++++++++++- sur/talk.hoon | 7 ++++-- 3 files changed, 75 insertions(+), 3 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index c29f42256a..be8a482903 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -100,6 +100,8 @@ {$unset term} ::< disable setting {$width @ud} ::< change display width :: miscellaneous :: + {$show circle} ::< show membership + {$hide circle} ::< hide membership {$help $~} ::< print usage info == :: ++ glyphs `wall`~[">=+-" "}),." "\"'`^" "$%&@"] ::< circle char pool ' @@ -732,6 +734,10 @@ :: ;~((glue ace) (perk %what ~) ;~(pose cirs glyph)) :: + ;~((glue ace) (perk %show ~) circ) + :: + ;~((glue ace) (perk %hide ~) circ) + :: :: ui settings :: ;~(plug (perk %bind ~) ;~(pfix ace glyph) (punt ;~(pfix ace cirs))) @@ -889,6 +895,8 @@ $unset (unset +.job) $width (width +.job) :: miscelaneous + $show (public & +.job) + $hide (public | +.job) $help help == :: @@ -1272,6 +1280,13 @@ ::> || ::+| :: + ++ 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 :: diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 9dc18c5e5f..0ae01bf412 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -43,6 +43,7 @@ log/(map naem @ud) ::< logged to clay nicks/(map ship nick) ::< local nicknames binds/(jug char audience) ::< circle glyph lookup + public/(set circle) ::< publicly member of == :: ++ story ::> wire content $: count/@ud ::< (lent grams) @@ -58,7 +59,9 @@ ::> || %deltas :: ::> changes to state :: ++ delta :: - $% :: messaging state :: + $% :: 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 :: @@ -304,6 +307,8 @@ :: changing shared ui $glyph (action-glyph +.act) $nick (action-nick +.act) + :: misc changes + $public (action-public +.act) == :: ++ affect ::< delta to story @@ -398,6 +403,20 @@ ::> add/remove {pos} as sources for story {nom}. :: |= {nom/naem sub/? srs/(set source)} + :: when removing sources from %inbox, we may need + :: to remove them from {public} too. + =? ..ta-action &(=(nom %inbox) !sub) + ^+ ..ta-action + %- ~(rep in srs) + |= {src/source _..ta-action} + ^+ ..ta-action + :: delete from public if it's the last source. + =; last/? ?:(last (action-public | cir.src) ..ta-action) + %- ~(rep in src.shape:(~(got by stories) nom)) + |= {s/source l/?} + ?. l | + ?. =(cir.s cir.src) & + =(ran.s ran.src) =+ soy=(~(get by stories) nom) ?~ soy (ta-evil (crip "no story {(trip nom)}")) @@ -460,6 +479,21 @@ :: |= {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. + :: + |= {add/? cir/circle} + =/ has/? + %- ~(rep in src.shape:(~(got by stories) %inbox)) + |= {src/source has/?} + ?: has & + =(cir cir.src) + ?. has + %- ta-note + "currently not in {(scow %p hos.cir)}/{(trip nom.cir)}" + (ta-delta %public add cir) -- :: ::> || @@ -1193,6 +1227,7 @@ |= det/delta ^+ +> ?- -.det + $public (da-change-public +.det) $out (da-change-out +.det) $done (da-change-done +.det) $glyph (da-change-glyph +.det) @@ -1230,6 +1265,16 @@ /report == :: + ++ da-change-public ::< show/hide membership + ::> add/remove a circle to/from the public + ::> membership list. + :: + |= {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. :: @@ -1720,6 +1765,9 @@ ?- -.qer $reader ``[%reader binds nicks] + :: + $public + ``[%public public] :: $burden :+ ~ ~ @@ -1833,6 +1881,10 @@ $glyph `[%reader det] $nick `[%reader det] == + :: + $public + ?. ?=($public -.det) ~ + `det :: $burden ::?: &(=(who.qer src.bol) did-they-send-a-burden) ~ @@ -1944,6 +1996,7 @@ => depa |^ %- af :~ [%reader ul] + [%public ul] [%burden (at /[%p])] [%report ul] == @@ -1960,6 +2013,7 @@ ^- ? ?- -.qer $reader (team:title our.bol who) + $public & $burden ?& =(who who.qer) =(our.bol (above who)) == diff --git a/sur/talk.hoon b/sur/talk.hoon index 16cc1da376..ee9939a709 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -24,6 +24,7 @@ ++ query ::> query paths $% {$reader $~} ::< shared ui state {$burden who/ship} ::< duties to share + {$public $~} ::< public memberships {$report $~} ::< duty reports {$circle nom/naem wat/(set circle-data) ran/range}::< story query ::TODO in the future, we may want much more :: @@ -51,7 +52,7 @@ :: ?($local $remote) ::< local or remote only ++ prize ::> query result $% {$reader prize-reader} ::< /reader - {$friend cis/(set circle)} ::< /friend + {$public cis/(set circle)} ::< /public {$burden sos/(map naem burden)} ::< /burden ::TODO do we ever use remote things from remote circles? {$circle package} ::< /circle @@ -62,7 +63,7 @@ == :: ++ rumor ::< query result change $% {$reader rum/rumor-reader} ::< /reader - {$friend add/? cir/circle} ::< /friend + {$public add/? cir/circle} ::< /public {$burden nom/naem rum/rumor-story} ::< /burden {$circle rum/rumor-story} ::< /circle == :: @@ -140,6 +141,8 @@ :: changing shared ui :: {$glyph gyf/char aud/audience bin/?} ::< un/bind a glyph {$nick who/ship nic/nick} ::< new identity + :: misc changes :: + {$public add/? cir/circle} ::< show/hide membership == :: :: ::> || From 9c57a675169f262f68edfa8d0fdc80f5fa5c10d3 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 6 Nov 2017 17:21:50 +0100 Subject: [PATCH 233/303] Expanded %app speech to be more than just a cord. --- app/talk-agent.hoon | 15 +++++++-------- app/talk-guardian.hoon | 4 ++-- lib/talk-json.hoon | 3 ++- lib/talk.hoon | 4 ++-- sur/talk.hoon | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index be8a482903..3ff0fc3bef 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -1971,7 +1971,7 @@ ~(cr-phat cr cir.sep) :: $app - tan+~[rose+[": " ~ ~]^~[leaf+"[{(trip app.sep)}]" leaf+(trip msg.sep)]] + [%mor tan+~[leaf+"[{(trip app.sep)}]: "] $(sep sep.sep) ~] == :: ++ tr-tach ::< attachment @@ -2010,8 +2010,8 @@ ::> message. if possible, these stay within a single ::> line. :: - ::> rep: is reply? - =| rep/_| + ::> pre: line prefix + =| pre/(unit tape) |= wyd/@ud ^- (list tape) ?- -.sep @@ -2029,7 +2029,7 @@ ~(ram re (snag 0 `(list tank)`res.sep)) :: $ire - $(sep sep.sep, rep &) + $(sep sep.sep, pre `"^ ") :: $url :_ ~ @@ -2052,9 +2052,9 @@ :: $lin :: glyph prefix - =/ pef + =/ pef/tape ?: pat.sep " " - =- (weld - ?:(rep "^ " " ")) + =- (weld - (fall pre " ")) %~ ar-glyf ar ?: =(who our.bol) aud (~(del in aud) [%& who %inbox]) @@ -2081,8 +2081,7 @@ ~(cr-phat cr cir.sep) :: $app - :_ ~ - (tr-chow wyd "[{(trip app.sep)}]: {(trip msg.sep)}") + $(sep sep.sep, pre `"[{(trip app.sep)}]: ") == -- :: diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 0ae01bf412..77b32c72bb 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -184,7 +184,7 @@ |= msg/tape %^ ta-action 0 %phrase :- [[our.bol %inbox] ~ ~] - [%app dap.bol (crip msg)]~ + [%app dap.bol %lin | (crip msg)]~ :: ++ ta-evil ::< emit error ::> tracing printf and crash. @@ -712,7 +712,7 @@ ^+ +> %+ so-act %phrase :- [[our.bol %inbox] ~ ~] - [%app dap.bol msg]~ + [%app dap.bol %lin | msg]~ :: ++ so-delta ::< send delta ::> store delta in ++ta core. diff --git a/lib/talk-json.hoon b/lib/talk-json.hoon index 224c4fe703..59b288b97e 100644 --- a/lib/talk-json.hoon +++ b/lib/talk-json.hoon @@ -351,7 +351,7 @@ $ire ~[top+s+(scot %uv top.a) sep+(spec sep.a)] ::TODO @uv as number? $fat ~[tac+(atta tac.a) sep+(spec sep.a)] $inv ~[inv+b+inv.a cir+(circ cir.a)] - $app ~[app+s+app.a msg+s+msg.a] + $app ~[app+s+app.a sep+(spec sep.a)] == :: ++ atta ::> attache @@ -583,6 +583,7 @@ ire+(ot top+seri sep+spec ~) fat+(ot tac+atta sep+spec ~) inv+(ot inv+bo cir+circ ~) + app+(ot app+so sep+spec ~) == :: ++ eval ::> %exp speech diff --git a/lib/talk.hoon b/lib/talk.hoon index 4303762641..bd95bf44dc 100644 --- a/lib/talk.hoon +++ b/lib/talk.hoon @@ -29,7 +29,7 @@ ^- action :+ %phrase [[our.bol %inbox] ~ ~] - [%app dap.bol (crip (en-purl:html url))]~ :: XX + [%app dap.bol %lin | (crip (en-purl:html url))]~ :: XX :: ++ said :: app message |= mes/(list tank) @@ -41,7 +41,7 @@ ?~ mes ~ :_ $(mes t.mes) ^- speech - [%app dap.bol (crip ~(ram re i.mes))] + [%app dap.bol %lin | (crip ~(ram re i.mes))] :: ++ uniq ^- {serial _eny.bol} diff --git a/sur/talk.hoon b/sur/talk.hoon index ee9939a709..a85ae5945a 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -225,8 +225,8 @@ {$exp exp/cord res/(list tank)} ::< hoon line {$ire top/serial sep/speech} ::< in reply to {$fat tac/attache sep/speech} ::< attachment + {$app app/term sep/speech} ::< app message {$inv inv/? cir/circle} ::< inv/ban for circle - {$app app/term msg/cord} ::< app message == :: ++ attache ::> attachment $% {$name nom/cord tac/attache} ::< named attachment From 6c6e1921120d695bf230057cfd920f1c5049697f Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 6 Nov 2017 19:26:36 +0100 Subject: [PATCH 234/303] Improved rendering of %app and %fat speeches. --- app/talk-agent.hoon | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/talk-agent.hoon b/app/talk-agent.hoon index 3ff0fc3bef..4a0e4bfd5c 100644 --- a/app/talk-agent.hoon +++ b/app/talk-agent.hoon @@ -1980,7 +1980,7 @@ |= a/attache ^- tang ?- -.a - $name (welp $(a tac.a) leaf+"={(trip nom.a)}" ~) + $name (welp $(a tac.a) leaf+"= {(trip nom.a)}" ~) $tank +.a $text (turn (flop +.a) |=(b/cord leaf+(trip b))) == @@ -2018,8 +2018,8 @@ $fat %+ weld $(sep sep.sep) ^- (list tape) - ?+ -.tac.sep ["attached: ..." ~] - $name ["attached: {(trip nom.tac.sep)}" ~] + ?+ -.tac.sep [" attached: ..." ~] + $name [(scag wyd " attached: {(trip nom.tac.sep)}") ~] == :: $exp @@ -2034,13 +2034,13 @@ $url :_ ~ =+ ful=(apix:en-purl:html url.sep) - =. wyd (sub wyd 2) :: account for prefix. + =+ pef=(weld (fall pre "") "/") + =. wyd (sub wyd +((lent pef))) :: account for prefix. :: if the full url fits, just render it. - ?: (gte wyd (lent ful)) ['/' ' ' ful] + ?: (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 - ~! hok =- (swag [a=(sub (max wyd (lent -)) wyd) b=wyd] -) ^- tape =< ?: ?=($& -.hok) @@ -2081,7 +2081,7 @@ ~(cr-phat cr cir.sep) :: $app - $(sep sep.sep, pre `"[{(trip app.sep)}]: ") + $(sep sep.sep, pre `"[{(trip app.sep)}]:") == -- :: From 608533532b84919aae7c8fc7aa912b19a46e1c95 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 6 Nov 2017 19:35:32 +0100 Subject: [PATCH 235/303] Fora is now a standalone app. Posts notifications to journals %fora-posts and %fora-comments. --- app/fora.hoon | 91 +++++++++++++++++++++ mar/{talk => fora}/comment.hoon | 0 mar/{talk/fora-post.hoon => fora/post.hoon} | 0 3 files changed, 91 insertions(+) create mode 100644 app/fora.hoon rename mar/{talk => fora}/comment.hoon (100%) rename mar/{talk/fora-post.hoon => fora/post.hoon} (100%) diff --git a/app/fora.hoon b/app/fora.hoon new file mode 100644 index 0000000000..a236c0669c --- /dev/null +++ b/app/fora.hoon @@ -0,0 +1,91 @@ +:: +:: /app/fora/hoon +:: +::TODO maybe stop relying on %hood one day. +:: +/- talk +/+ talk, write, time-to-id +=, format +=, title +:: +|% +++ move (pair bone card) +++ card + $% {$poke wire dock poke} + {$exec wire @p $~ {beak silk:ford}} + {$info wire @p toro:clay} + == +++ poke + $% {$talk-action action:talk} + {$write-fora-post spur ship cord cord} + {$write-comment spur ship cord} + == +-- +:: +|_ {bol/bowl:gall $~} +:: +++ prep + |= old/(unit $~) + ^- (quip move _..prep) + ?^ old [~ ..prep(+<+ u.old)] + :_ ..prep + :~ (act %create %fora-posts 'fora posts' %journal) + (act %create %fora-comments 'fora comments' %journal) + == +:: +++ act + |= a/action:talk + ^- move + [ost.bol %poke / [our.bol %talk-guardian] %talk-action a] +:: +++ ra-base-hart .^(hart:eyre %e /(scot %p our.bol)/host/(scot %da now.bol)) +:: +++ poke-fora-post + |= {pax/path sup/spur hed/@t txt/@t} + ^- (quip move _+>) + :_ +> + :~ %- act + :+ %phrase [[our.bol %fora-posts] ~ ~] + :_ ~ + :+ %app dap.bol + :+ %fat + :+ %name + (crip "post by {(cite src.bol)}: {(trip hed)}") + text+(to-wain txt) + =. pax (welp pax /posts/(crip "{}~")) + [%url [ra-base-hart `pax ~] ~] + :: + :* ost.bol + %poke + /fora-post + [our.bol %hood] + [%write-fora-post sup src.bol hed txt] + == + == +:: +++ poke-fora-comment + |= {pax/path sup/spur txt/@t} + ^- (quip move _+>) + :_ +> + :~ ^- move + %- act + :+ %phrase [[our.bol %fora-comments] ~ ~] + :_ ~ + :+ %app dap.bol + ^- speech:talk + :+ %fat + :+ %name + =+ nam=?~(sup "" (trip i.sup)) + (crip "comment by {(cite src.bol)} on /{nam}") + text+(to-wain txt) + =+ fra=(crip (time-to-id now.bol)) + [%url [ra-base-hart `pax ~] `fra] + :: + :* ost.bol + %poke + /fora-comment + [our.bol %hood] + [%write-comment sup src.bol txt] + == + == +-- diff --git a/mar/talk/comment.hoon b/mar/fora/comment.hoon similarity index 100% rename from mar/talk/comment.hoon rename to mar/fora/comment.hoon diff --git a/mar/talk/fora-post.hoon b/mar/fora/post.hoon similarity index 100% rename from mar/talk/fora-post.hoon rename to mar/fora/post.hoon From 0f276a5e4af9870f1471b726a242042ea507d093 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 6 Nov 2017 21:20:33 +0100 Subject: [PATCH 236/303] Updated marks to include $public, irt the public membership list. --- mar/talk/action.hoon | 4 ++++ mar/talk/prize.hoon | 4 ++-- mar/talk/rumor.hoon | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/mar/talk/action.hoon b/mar/talk/action.hoon index 8370c9c641..264b3699b6 100644 --- a/mar/talk/action.hoon +++ b/mar/talk/action.hoon @@ -30,6 +30,8 @@ :: glyph+(ot gyf+so aud+audi bin+bo ~) nick+(ot who+(su fed:ag) nic+so ~) + :: + public+(ot add+bo cir+circ ~) == -- :: @@ -57,6 +59,8 @@ :: $glyph ~[gyf+s+gyf.act aud+(sa aud.act circ) bin+b+bin.act] $nick ~[who+(ship who.act) nic+s+nic.act] + :: + $public ~[add+b+add.act cir+(circ cir.act)] == -- -- diff --git a/mar/talk/prize.hoon b/mar/talk/prize.hoon index b89d99c280..a470d6e10c 100644 --- a/mar/talk/prize.hoon +++ b/mar/talk/prize.hoon @@ -16,7 +16,7 @@ ^- prize:talk =- (need ((of -) a)) :~ reader+pire - friend+(as circ) + public+(as circ) :: burden not needed circle+pack == @@ -30,7 +30,7 @@ %+ frond -.piz ?+ -.piz !! $reader (pire +.piz) - $friend (sa cis.piz circ) + $public (sa cis.piz circ) :: burden not needed $circle (pack +.piz) == diff --git a/mar/talk/rumor.hoon b/mar/talk/rumor.hoon index bdbf71e156..b593d1a493 100644 --- a/mar/talk/rumor.hoon +++ b/mar/talk/rumor.hoon @@ -16,7 +16,7 @@ ^- rumor:talk =- (need ((of -) a)) :~ reader+rure - friend+(ot add+bo cir+circ ~) + public+(ot add+bo cir+circ ~) :: burden not needed circle+ruso == @@ -30,7 +30,7 @@ %+ frond -.rum ?+ -.rum !! $reader (rure rum.rum) - $friend (pairs add+b+add.rum cir+(circ cir.rum) ~) + $public (pairs add+b+add.rum cir+(circ cir.rum) ~) :: burden not needed $circle (ruso rum.rum) == From f045a1035b5e3e3bec8443c1cc0c372cabd6d68a Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 7 Nov 2017 17:05:51 +0100 Subject: [PATCH 237/303] Fixed decrement-underflow occurring when editing the first ever message. --- app/talk-guardian.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 77b32c72bb..87c1873819 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -1515,7 +1515,7 @@ :: changed message %_ +>.$ grams %+ welp - (scag (dec u.old) grams) + (scag (dec (max u.old 1)) grams) [gam (slag u.old grams)] == :: From 40f01f9aad5ab85856051b1dff1b723411970719 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 7 Nov 2017 17:11:32 +0100 Subject: [PATCH 238/303] Made it possible to load in telegrams exported from old talk. --- app/talk-guardian.hoon | 19 +++- gen/talk/load-legacy.hoon | 13 +++ lib/talk-legacy.hoon | 200 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 231 insertions(+), 1 deletion(-) create mode 100644 gen/talk/load-legacy.hoon create mode 100644 lib/talk-legacy.hoon diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 87c1873819..886b8e0984 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -23,7 +23,7 @@ :: /? 151 ::< hoon version /- talk ::< structures -/+ talk, time-to-id ::< libraries +/+ talk, talk-legacy ::< libraries /= seed /~ !>(.) !: :::: @@ -2189,6 +2189,23 @@ (foal:space:userlib paf [%talk-telegrams !>(-)]) == :: +++ poke-load-legacy ::< load old talk grams + ::> loads legacy talk messages into the story {nom}. + :: + |= nom/naem + ^- (quip move _+>) + =/ jams/json + .^ json + %cx + /(scot %p our.bol)/home/(scot %da now.bol)/hall/legacy-telegrams/json + == + =+ grams=(from-json:talk-legacy jams) + ~& [%loaded (lent grams)] + %- pre-bake + %+ turn (flop grams) + |= t/telegram + [%story nom %gram t] +:: ++ poke-talk-load ::< load from log ::> loads the telegrams of story {nom} into our state, ::> as saved in ++poke-talk-save. diff --git a/gen/talk/load-legacy.hoon b/gen/talk/load-legacy.hoon new file mode 100644 index 0000000000..4f27d57ff8 --- /dev/null +++ b/gen/talk/load-legacy.hoon @@ -0,0 +1,13 @@ +:: Load legacy messages from backup +:: +:::: /gen/talk/load-old/hoon + :: +/? 310 +:: +:::: + :: +:- %say +|= $: {now/@da eny/@uvJ byk/beak} + {{man/knot $~} $~} + == +[%load-legacy man] diff --git a/lib/talk-legacy.hoon b/lib/talk-legacy.hoon new file mode 100644 index 0000000000..0d89c4dce8 --- /dev/null +++ b/lib/talk-legacy.hoon @@ -0,0 +1,200 @@ +:: +/? 310 +/- talk +/+ old-zuse +[old-zuse .] +=> +|% +++ audience (map partner (pair envelope delivery)) :: destination+state +++ bouquet (set flavor) :: complete aroma +++ delivery :: delivery state + $? $pending :: undelivered + $received :: delivered + $rejected :: undeliverable + $released :: sent one-way + $accepted :: fully processed + == :: +++ envelope (pair ? (unit partner)) :: visible sender +++ flavor path :: content flavor +++ passport :: foreign flow + $% {$twitter p/@t} :: twitter + == :: +++ presence ?($gone $hear $talk) :: status type +++ speech :: narrative action + $% {$lan p/knot q/@t} :: local announce + {$exp p/@t} :: hoon line + {$non $~} :: no content (yo) + {$ext p/@tas q/*} :: extended action + {$fat p/torso q/speech} :: attachment + {$url p/purf} :: parsed url + {$ire p/serial q/speech} :: in-reply-to + {$lin p/? q/@t} :: no/@ text line + {$mor p/(list speech)} :: multiplex + {$app p/@tas q/@t} :: app message + $: $api :: api message + service/@tas :: service name + id/@t :: id on the service + id-url/purf :: link to id + summary/@t :: summary of event + body/@t :: body of event + url/purf :: link to event + meta/json :: other data for web + == :: + == :: +++ serial @uvH :: unique identity +++ partner (each station passport) :: interlocutor +++ statement (trel @da bouquet speech) :: when this +++ station (pair ship knot) :: domestic flow +++ telegram (pair ship thought) :: who which whom what +++ thought (trel serial audience statement) :: which whom what +++ torso :: attachment + $% {$name (pair @t torso)} :: named attachment + {$text (list @t)} :: text lines + {$tank (list tank)} :: tank list + == :: +-- +|% +++ from-json + => [jo ..telegram] + |= a/^json ^- (list telegram:talk) + =- %- zing + %+ turn + (need ((ar (ot ship+(su fed:ag) thought+thot ~)) a)) + convert-telegram + |% + ++ of + |* a/(pole {@tas fist}) + |= b/^json + %. ((of:jo a) b) + %- slog + ?+ b ~ + {$o *} + %+ murn `(list {@tas fist})`a + |= {c/term d/fist} ^- (unit tank) + =+ (~(get by p.b) c) + ?~ - ~ + =+ (d u) + ?~ - (some >[c u]<) + ~ + == + ++ op :: parse keys of map + |* {fel/rule wit/fist} + %+ cu malt + %+ ci + |= a/(map cord _(need *wit)) + ^- (unit (list _[(wonk *fel) (need *wit)])) + (zl (turn ~(tap by a) (head-rush fel))) + (om wit) + :: + ++ as :: array as set + |* a/fist + (cu ~(gas in *(set _(need *a))) (ar a)) + :: + ++ ke :: callbacks + |* {gar/* sef/_|.(fist)} + |= jon/^json + ^- (unit _gar) + =- ~! gar ~! (need -) - + ((sef) jon) + :: + ++ lake |*(a/_* $-(^json (unit a))) + ++ head-rush + |* a/rule + |* {cord *} + =+ nit=(rush +<- a) + ?~ nit ~ + (some [u.nit +>->]) + :: + ++ thot + ^- $-(^json (unit thought)) + %- ot :~ + serial+`$-(^json (unit serial))`(ci (slat %uv) so) + audience+`$-(^json (unit audience))`audi + statement+`$-(^json (unit statement))`stam + == + :: + ++ audi `$-(^json (unit audience))`(op parn memb) + ++ auri (op parn (ci (soft presence) so)) + ++ memb ^- $-(^json (unit (pair envelope delivery))) + (ot envelope+lope delivery+(ci (soft delivery) so) ~) + ++ lope (ot visible+bo sender+(mu (su parn)) ~) + :: + ++ parn + ^- $-(nail (like partner)) + %+ pick + ;~((glue fas) ;~(pfix sig fed:ag) urs:ab) + %+ sear (soft passport) + ;~((glue fas) sym urs:ab) :: XX [a-z0-9_]{1,15} + :: + ++ stam (ot date+di bouquet+(as (ar so)) speech+spec ~) + ++ spec + %+ ke *speech |. ~+ + %- of :~ + lin+(ot say+bo txt+so ~) + url+(ot txt+(su aurf:urlp) ~) + exp+(ot txt+so ~) + app+(ot txt+so src+so ~) + fat+(ot tor+tors taf+spec ~) + ext+(ot nom+so txe+blob ~) + non+ul + mor+(ar spec) + :: inv+(ot ship+(su fed:ag) party+(su urs:ab) ~) + == + ++ tors + %+ ke *torso |. ~+ + %- of :~ + name+(ot nom+so mon+tors ~) + text+(cu to-wain:format so) + tank+(ot dat+(cu (hard (list tank)) blob) ~) + == + :: + ++ blob (cu cue (su fel:ofis)) + :: + :: + ++ convert-telegram + |= t/telegram + ^- (list telegram:talk) + =+ aud=(convert-audience q.q.t) + %+ turn (convert-speech r.r.q.t) + |= s/speech:talk + [p.t p.q.t aud p.r.q.t s] + :: + ++ convert-audience + |= a/audience + ^- audience:talk + %- sy + ^- (list circle:talk) + %+ murn ~(tap in ~(key by a)) + |= p/partner + ^- (unit circle:talk) + ?- -.p + $& :+ ~ p.p.p + ?: ?| =(q.p.p 'porch') + =(q.p.p 'court') + =(q.p.p 'floor') + == + %inbox + q.p.p + $| ~ + == + :: + ++ convert-speech + |= s/speech + ^- (list speech:talk) + ?+ -.s ~&([%ignoring -.s] ~) + $lin [%lin !p.s q.s]~ + $url [%url p.s]~ + $exp [%exp p.s ~]~ + $ire %+ turn (convert-speech q.s) + |= i/speech:talk + [%ire p.s i] + $app [%app p.s [%lin | q.s]]~ + $fat ?: &(?=($exp -.q.s) ?=($tank -.p.s)) + [%exp p.q.s +.p.s]~ + =+ ses=(convert-speech q.s) + =? ses =(0 (lent ses)) [%lin | '']~ + [[%fat p.s (snag 0 ses)] (slag 1 ses)] + $mor (zing (turn p.s convert-speech)) + == + -- +-- From da996e0ec2e8de5a8079d2087aefdaf36cecc16d Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 7 Nov 2017 20:00:42 +0100 Subject: [PATCH 239/303] Updated saving, loading and logging functionality. --- app/talk-guardian.hoon | 28 +++++++++++++--------------- mar/talk/telegrams.hoon | 9 +++++++++ 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index 886b8e0984..e83564dcfb 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -2052,8 +2052,12 @@ =< ta-done %- ta-note:ta "talk-action stranger {(scow %p src.bol)}" - %- pre-bake - ta-done:(ta-action:ta ost.bol act) + =^ mos +>.$ + %- pre-bake + ta-done:(ta-action:ta ost.bol act) + =^ mow +>.$ + log-all-to-file + [(welp mos mow) +>.$] :: ::> || ::> || %subscription-events @@ -2178,7 +2182,7 @@ |= nom/naem ^- (quip move _+>) =/ paf/path - /(scot %p our.bol)/home/(scot %da now.bol)/talk/[nom]/talk-telegrams + /(scot %p our.bol)/home/(scot %da now.bol)/hall/[nom]/talk-telegrams =+ grams:(~(got by stories) nom) :_ +>.$ :_ ~ @@ -2215,21 +2219,17 @@ =/ grams .^ (list telegram) %cx - /(scot %p our.bol)/home/(scot %da now.bol)/talk/[nom]/talk-telegrams + /(scot %p our.bol)/home/(scot %da now.bol)/hall/[nom]/talk-telegrams == - =+ soy=(~(got by stories) nom) - :- ~ - %= +>.$ - stories - %+ ~(put by stories) nom - soy(grams grams, count (lent grams)) - == + %- pre-bake + %+ turn grams + |= t/telegram + [%story nom %gram t] :: ++ poke-talk-log ::< start logging ::> starts logging story {nom}'s messages. :: |= nom/naem - ~& %talk-poke-log ^- (quip move _+>) :- [(log-to-file nom) ~] %= +>.$ @@ -2250,9 +2250,7 @@ ::> for every story we're logging, (over)writes all ::> their grams to log files if new ones have arrived. :: - ::TODO re-enable and test. ^- (quip move _.) - ?: & [~ .] :: XXX!!!! :_ %_ . log %- ~(urn by log) @@ -2274,7 +2272,7 @@ =+ ^- paf/path =+ day=(year %*(. (yore now.bol) +.t +:*tarp)) %+ en-beam:format [our.bol %home da+now.bol] - /talk-telegrams/(scot %da day)/[nom]/talk + /talk-telegrams/(scot %da day)/[nom]/hall =+ grams:(~(got by stories) nom) :* ost.bol %info diff --git a/mar/talk/telegrams.hoon b/mar/talk/telegrams.hoon index e671e27488..0989468ea3 100644 --- a/mar/talk/telegrams.hoon +++ b/mar/talk/telegrams.hoon @@ -29,4 +29,13 @@ :: ++ json a+(turn gaz gram:enjs:talk-json) ::< to %json -- +:: +++ grad + |% + ++ form %talk-telegrams + ++ diff |=((list telegram:talk) +<) + ++ pact |=((list telegram:talk) +<) + ++ join |= {(list telegram:talk) (list telegram:talk)} + `(unit mime)`~ + -- -- From f623d83667a46095d15337e51607ab5a64eb7d29 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 7 Nov 2017 20:20:42 +0100 Subject: [PATCH 240/303] Minor cleanup. --- app/talk-guardian.hoon | 2 -- sur/talk.hoon | 12 +++++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/app/talk-guardian.hoon b/app/talk-guardian.hoon index e83564dcfb..8d92918692 100644 --- a/app/talk-guardian.hoon +++ b/app/talk-guardian.hoon @@ -99,8 +99,6 @@ == :: ++ pear ::> poke fruit $% {$talk-command command} :: - {$write-comment spur ship cord} :: - {$write-fora-post spur ship cord cord} :: == :: ++ card ::> general card $% {$diff lime} :: diff --git a/sur/talk.hoon b/sur/talk.hoon index a85ae5945a..2ac2465509 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -4,6 +4,8 @@ |% :: ::TODO use different words for different kinds of burdens +::TODO rename det/delta in most place? they may be (different kinds of) deltas, +:: but location in control flow already indicates delta-ness. :: ::> || ::> || %wrappers @@ -23,8 +25,8 @@ :: ++ query ::> query paths $% {$reader $~} ::< shared ui state - {$burden who/ship} ::< duties to share {$public $~} ::< public memberships + {$burden who/ship} ::TODO eventually, nom/naem. ::< duties to share {$report $~} ::< duty reports {$circle nom/naem wat/(set circle-data) ran/range}::< story query ::TODO in the future, we may want much more :: @@ -34,8 +36,8 @@ $? $grams ::< messages $group-l ::< local presence $group-r ::< remote presences - $config-l ::< local config - $config-r ::< remote configs + $config-l ::< local config + $config-r ::< remote configs == :: ++ range ::> inclusive msg range %- unit ::< ~ means everything @@ -46,10 +48,6 @@ $% {$da @da} ::< date {$ud @ud} ::< message number == :: -::TODO overlaps with agent's ++where -::++ where ::> data from -:: %- unit ::< ~ means everywhere -:: ?($local $remote) ::< local or remote only ++ prize ::> query result $% {$reader prize-reader} ::< /reader {$public cis/(set circle)} ::< /public From ee1ca40f340fef510d50d06aa1124107990ba3c4 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 7 Nov 2017 22:05:52 +0100 Subject: [PATCH 241/303] Renamed %talk-guardian to %hall, %talk-agent to %talk. In /sur, /gen, /mar, /lib renamed files/folders from "talk" to "hall". --- app/fora.hoon | 12 +- app/{talk-guardian.hoon => hall.hoon} | 75 ++++++----- app/hood.hoon | 8 +- app/pipe.hoon | 18 +-- app/{talk-agent.hoon => talk.hoon} | 26 ++-- app/twit.hoon | 14 +- gen/{talk => hall}/load-legacy.hoon | 2 +- gen/{talk => hall}/load.hoon | 4 +- gen/{talk => hall}/log.hoon | 4 +- gen/{talk => hall}/save.hoon | 4 +- gen/{talk => hall}/unlog.hoon | 4 +- gen/help.hoon | 2 +- gen/talk/federate.hoon | 10 -- lib/drum.hoon | 34 ++--- lib/{talk-json.hoon => hall-json.hoon} | 12 +- lib/{talk-legacy.hoon => hall-legacy.hoon} | 18 +-- lib/{talk.hoon => hall.hoon} | 10 +- lib/kiln.hoon | 4 +- lib/womb.hoon | 6 +- mar/fora/comment.hoon | 2 +- mar/fora/post.hoon | 2 +- mar/gh/issue-comment.hoon | 6 +- mar/gh/issues.hoon | 8 +- mar/{talk => hall}/action.hoon | 20 +-- mar/{talk => hall}/command.hoon | 8 +- mar/{talk => hall}/prize.hoon | 16 +-- mar/{talk => hall}/rumor.hoon | 16 +-- mar/{talk => hall}/speeches.hoon | 10 +- mar/{talk => hall}/telegrams.hoon | 24 ++-- mar/talk/report.hoon | 148 --------------------- mar/twit/feed.hoon | 6 +- sur/{talk.hoon => hall.hoon} | 5 +- 32 files changed, 189 insertions(+), 349 deletions(-) rename app/{talk-guardian.hoon => hall.hoon} (97%) rename app/{talk-agent.hoon => talk.hoon} (99%) rename gen/{talk => hall}/load-legacy.hoon (84%) rename gen/{talk => hall}/load.hoon (77%) rename gen/{talk => hall}/log.hoon (77%) rename gen/{talk => hall}/save.hoon (77%) rename gen/{talk => hall}/unlog.hoon (76%) delete mode 100644 gen/talk/federate.hoon rename lib/{talk-json.hoon => hall-json.hoon} (99%) rename lib/{talk-legacy.hoon => hall-legacy.hoon} (96%) rename lib/{talk.hoon => hall.hoon} (98%) rename mar/{talk => hall}/action.hoon (84%) rename mar/{talk => hall}/command.hoon (75%) rename mar/{talk => hall}/prize.hoon (74%) rename mar/{talk => hall}/rumor.hoon (75%) rename mar/{talk => hall}/speeches.hoon (71%) rename mar/{talk => hall}/telegrams.hoon (58%) delete mode 100644 mar/talk/report.hoon rename sur/{talk.hoon => hall.hoon} (99%) diff --git a/app/fora.hoon b/app/fora.hoon index a236c0669c..8d2a03bae2 100644 --- a/app/fora.hoon +++ b/app/fora.hoon @@ -3,8 +3,8 @@ :: ::TODO maybe stop relying on %hood one day. :: -/- talk -/+ talk, write, time-to-id +/- hall +/+ hall, write, time-to-id =, format =, title :: @@ -16,7 +16,7 @@ {$info wire @p toro:clay} == ++ poke - $% {$talk-action action:talk} + $% {$hall-action action:hall} {$write-fora-post spur ship cord cord} {$write-comment spur ship cord} == @@ -34,9 +34,9 @@ == :: ++ act - |= a/action:talk + |= a/action:hall ^- move - [ost.bol %poke / [our.bol %talk-guardian] %talk-action a] + [ost.bol %poke / [our.bol %hall] %hall-action a] :: ++ ra-base-hart .^(hart:eyre %e /(scot %p our.bol)/host/(scot %da now.bol)) :: @@ -72,7 +72,7 @@ :+ %phrase [[our.bol %fora-comments] ~ ~] :_ ~ :+ %app dap.bol - ^- speech:talk + ^- speech:hall :+ %fat :+ %name =+ nam=?~(sup "" (trip i.sup)) diff --git a/app/talk-guardian.hoon b/app/hall.hoon similarity index 97% rename from app/talk-guardian.hoon rename to app/hall.hoon index 8d92918692..dc9916b6d7 100644 --- a/app/talk-guardian.hoon +++ b/app/hall.hoon @@ -1,8 +1,7 @@ :: :: :: -:::: /hoon/talk/app :: :: +:::: /app/hall/hoon :: :: :: :: :: :: -::TODO rename to hall ::TODO char57 comments as line comments when regarding code. ::TODO document what user-facing messages actually mean! ::TODO maybe have hall accept reactions as well, redirect them to readers. @@ -22,13 +21,13 @@ :: don't make the target source do that. :: /? 151 ::< hoon version -/- talk ::< structures -/+ talk, talk-legacy ::< libraries +/- hall ::< structures +/+ hall, hall-legacy ::< libraries /= seed /~ !>(.) !: :::: :: -=, talk +=, hall => ::> || ::> || %arch ::> || @@ -94,11 +93,11 @@ ::> outgoing data :: ++ move (pair bone card) ::< all actions ++ lime ::> diff fruit - $% {$talk-prize prize} :: - {$talk-rumor rumor} :: + $% {$hall-prize prize} :: + {$hall-rumor rumor} :: == :: ++ pear ::> poke fruit - $% {$talk-command command} :: + $% {$hall-command command} :: == :: ++ card ::> general card $% {$diff lime} :: @@ -188,7 +187,7 @@ ::> tracing printf and crash. :: |= msg/cord - ~| [%talk-ta-evil msg] + ~| [%hall-ta-evil msg] !! :: ::> || @@ -438,7 +437,7 @@ =- (ta-think & our.bol tos) |- ^- tos/(list thought) ?~ ses ~ - =^ sir eny.bol ~(uniq talk bol) + =^ sir eny.bol ~(uniq hall bol) :_ $(ses t.ses) [sir aud [now.bol i.ses]] :: @@ -670,7 +669,7 @@ ::> story core, used for doing work on a story. :: |_ ::> nom: story name in {stories}. - ::> acs: talk actions issued due to changes. + ::> acs: hall actions issued due to changes. ::> story is faceless to ease data access. :: $: nom/naem @@ -696,7 +695,7 @@ ::+| :: ++ so-act ::< send action - ::> stores a talk action. + ::> stores a hall action. :: |= act/action ^+ +> @@ -1209,7 +1208,7 @@ %poke /present [hos dap.bol] - [%talk-command %present nos dif] + [%hall-command %present nos dif] == :: ::> || @@ -1291,7 +1290,7 @@ :* %poke /repeat/(scot %p hos.cir)/[nom.cir]/(scot %ud (jam ses)) [hos.cir dap.bol] - [%talk-command %publish out] + [%hall-command %publish out] == :: ++ da-change-done ::< delivered messages @@ -1939,7 +1938,7 @@ %+ welp =+ rum=(feel qer det) ?~ rum ~ - [b %diff %talk-rumor u.rum]~ + [b %diff %hall-rumor u.rum]~ ?. ?=($circle -.qer) ~ :: kill the subscription if it's past its range. =- ?:(done:- [b %quit ~]~ ~) @@ -2028,8 +2027,8 @@ ::> || ::+| :: -++ poke-talk-command ::< accept command - ::> incoming talk command. process it and update logs. +++ poke-hall-command ::< accept command + ::> incoming hall command. process it and update logs. :: |= cod/command ^- (quip move _+>) @@ -2040,8 +2039,8 @@ log-all-to-file [(welp mos mow) +>.$] :: -++ poke-talk-action ::< accept action - ::> incoming talk action. process it. +++ poke-hall-action ::< accept action + ::> incoming hall action. process it. :: |= act/action ^- (quip move _+>) @@ -2049,7 +2048,7 @@ %- pre-bake =< ta-done %- ta-note:ta - "talk-action stranger {(scow %p src.bol)}" + "hall-action stranger {(scow %p src.bol)}" =^ mos +>.$ %- pre-bake ta-done:(ta-action:ta ost.bol act) @@ -2062,7 +2061,7 @@ ::> || ::+| :: -++ diff-talk-prize ::< accept prize +++ diff-hall-prize ::< accept prize ::> accept a query result. :: |= {wir/wire piz/prize} @@ -2082,7 +2081,7 @@ log-all-to-file [(welp mos mow) +>.$] :: -++ diff-talk-rumor ::< accept rumor +++ diff-hall-rumor ::< accept rumor ::> accept a query result change. :: |= {wir/wire rum/rumor} @@ -2099,7 +2098,7 @@ :: |= pax/path ^- (quip move _+>) - ?: ?=({$sole *} pax) ~&(%talk-broker-no-sole !!) + ?: ?=({$sole *} pax) ~&(%hall-no-sole !!) =+ qer=(path-to-query pax) ?. (leak src.bol qer) ~&(%peer-invisible !!) =^ mos +>.$ @@ -2110,7 +2109,7 @@ ?~ piz ~&([%query-unavailable pax] mos) ?~ u.piz ~&([%query-invalid pax] mos) :_ mos - [ost.bol %diff %talk-prize u.u.piz] + [ost.bol %diff %hall-prize u.u.piz] :: ++ pull ::< unsubscribe ::> unsubscribes. @@ -2173,14 +2172,14 @@ ::> || ::+| :: -++ poke-talk-save ::< save as log +++ poke-hall-save ::< save as log ::> stores the telegrams of story {nom} in a log file, - ::> to be re-loaded by ++poke-talk-load. + ::> to be re-loaded by ++poke-hall-load. :: |= nom/naem ^- (quip move _+>) =/ paf/path - /(scot %p our.bol)/home/(scot %da now.bol)/hall/[nom]/talk-telegrams + /(scot %p our.bol)/home/(scot %da now.bol)/hall/[nom]/hall-telegrams =+ grams:(~(got by stories) nom) :_ +>.$ :_ ~ @@ -2188,11 +2187,11 @@ %info /jamfile our.bol - (foal:space:userlib paf [%talk-telegrams !>(-)]) + (foal:space:userlib paf [%hall-telegrams !>(-)]) == :: -++ poke-load-legacy ::< load old talk grams - ::> loads legacy talk messages into the story {nom}. +++ poke-load-legacy ::< load legacy grams + ::> loads legacy messages into the story {nom}. :: |= nom/naem ^- (quip move _+>) @@ -2201,30 +2200,30 @@ %cx /(scot %p our.bol)/home/(scot %da now.bol)/hall/legacy-telegrams/json == - =+ grams=(from-json:talk-legacy jams) + =+ grams=(from-json:hall-legacy jams) ~& [%loaded (lent grams)] %- pre-bake %+ turn (flop grams) |= t/telegram [%story nom %gram t] :: -++ poke-talk-load ::< load from log +++ poke-hall-load ::< load from log ::> loads the telegrams of story {nom} into our state, - ::> as saved in ++poke-talk-save. + ::> as saved in ++poke-hall-save. :: |= nom/naem ^- (quip move _+>) =/ grams .^ (list telegram) %cx - /(scot %p our.bol)/home/(scot %da now.bol)/hall/[nom]/talk-telegrams + /(scot %p our.bol)/home/(scot %da now.bol)/hall/[nom]/hall-telegrams == %- pre-bake %+ turn grams |= t/telegram [%story nom %gram t] :: -++ poke-talk-log ::< start logging +++ poke-hall-log ::< start logging ::> starts logging story {nom}'s messages. :: |= nom/naem @@ -2236,7 +2235,7 @@ count:(~(got by stories) nom) == :: -++ poke-talk-unlog ::< stop logging +++ poke-hall-unlog ::< stop logging ::> stops logging story {nom}'s messages. :: |= nom/naem @@ -2270,12 +2269,12 @@ =+ ^- paf/path =+ day=(year %*(. (yore now.bol) +.t +:*tarp)) %+ en-beam:format [our.bol %home da+now.bol] - /talk-telegrams/(scot %da day)/[nom]/hall + /hall-telegrams/(scot %da day)/[nom]/hall =+ grams:(~(got by stories) nom) :* ost.bol %info /jamfile our.bol - (foal:space:userlib paf [%talk-telegrams !>(-)]) + (foal:space:userlib paf [%hall-telegrams !>(-)]) == -- diff --git a/app/hood.hoon b/app/hood.hoon index 23a4ab3131..af3d974e6b 100644 --- a/app/hood.hoon +++ b/app/hood.hoon @@ -2,15 +2,15 @@ :::: /hoon/hood/app :: :: :: :: :: /? 310 :: zuse version -/+ sole, talk, helm, kiln, drum, write, womb :: libraries -[. helm kiln drum] +/+ sole, helm, kiln, drum, write, womb :: libraries +[. helm kiln drum] :: :: :: :::: :: :: :: :: :: !: => |% :: module boilerplate - ++ hood-old :: - {?($0 $1) lac/(map @tas hood-part-old)} :: + ++ hood-old :: + {?($0 $1) lac/(map @tas hood-part-old)} :: ++ hood-1 :: {$1 lac/(map @tas hood-part)} :: ++ hood-good :: diff --git a/app/pipe.hoon b/app/pipe.hoon index 7355887285..b404f30185 100644 --- a/app/pipe.hoon +++ b/app/pipe.hoon @@ -1,10 +1,10 @@ -/+ talk +/+ hall :: => |% ++ move (pair bone card) ++ card $% {$peel wire dock mark path} - {$poke wire dock $talk-command command:talk} + {$poke wire dock $hall-command command:hall} == -- :: @@ -52,11 +52,11 @@ :_ ~ ~& [%peeling app source station] :* ost.hid %peel [%subscribe app station source] - [our.hid app] %talk-speeches source + [our.hid app] %hall-speeches source == :: -++ diff-talk-speeches - |= {way/wire speeches/(list speech:talk)} +++ diff-hall-speeches + |= {way/wire speeches/(list speech:hall)} ^- {(list move) _+>.$} ?> ?=({$subscribe @ @ *} way) =+ app=(slav %tas i.t.way) @@ -70,15 +70,15 @@ [~ +>.$] :_ +>.$ :_ ~ :* ost.hid %poke [%relay app station source] - [our.hid %talk] %talk-command + [our.hid %hall] %hall-command %publish - |- ^- (list thought:talk) + |- ^- (list thought:hall) ?~ speeches ~ :_ $(speeches t.speeches, eny.hid (shax (cat 3 %pipe eny.hid))) :* `@uvH`(end (sub 'H' 'A') 1 eny.hid) - [[[%& our.hid station] *envelope:talk %pending] ~ ~] - now.hid *(set flavor:talk) i.speeches + [[[%& our.hid station] *envelope:hall %pending] ~ ~] + now.hid *(set flavor:hall) i.speeches == == :: diff --git a/app/talk-agent.hoon b/app/talk.hoon similarity index 99% rename from app/talk-agent.hoon rename to app/talk.hoon index 4a0e4bfd5c..7249ed1faa 100644 --- a/app/talk-agent.hoon +++ b/app/talk.hoon @@ -1,5 +1,5 @@ :: :: :: -:::: /hoon/talk-agent/app :: :: +:::: /app/talk/hoon :: :: :: :: :: :: ::TODO make sure glyphs only get bound when joins succeed @@ -19,13 +19,13 @@ ::> subscribes to. :: /? 151 ::< hoon version -/- talk, sole ::< structures -/+ talk, sole ::< libraries +/- hall, sole ::< structures +/+ hall, sole ::< libraries /= seed /~ !>(.) !: :::: :: -=, talk +=, hall =, sole => ::> || ::> || %arch @@ -61,8 +61,8 @@ $% {$sole-effect sole-effect} :: == :: ++ pear ::> poke fruit - $% {$talk-command command} :: - {$talk-action action} :: + $% {$hall-command command} :: + {$hall-action action} :: == :: ++ card ::> general card $% {$diff lime} :: @@ -131,7 +131,7 @@ :: ++ broker ::< broker ship + name ^- dock - :_ %talk-guardian + :_ %hall (true-self our.bol) :: ++ inbox ::< reader's circle name @@ -182,7 +182,7 @@ :: ++ ta :: per transaction ::> for every transaction/event (poke, peer etc.) - ::> talk-agent receives, the ++ta transaction core is + ::> talk receives, the ++ta transaction core is ::> called. ::> in processing transactions, ++ta may modify app ::> state, or create moves. these moves get produced @@ -483,7 +483,7 @@ %poke /reader/action broker - [%talk-action act] + [%hall-action act] == == :: @@ -2096,21 +2096,21 @@ |= pax/path ^- (quip move _+>) ?. (team:title src.bol our.bol) - ~& [%peer-talk-reader-stranger src.bol] + ~& [%peer-talk-stranger src.bol] [~ +>] ?. ?=({$sole *} pax) - ~& [%peer-talk-reader-strange pax] + ~& [%peer-talk-strange pax] [~ +>] ta-done:ta-console:ta :: -++ diff-talk-prize ::< accept query answer +++ diff-hall-prize ::< accept query answer ::> :: |= {way/wire piz/prize} ^- (quip move _+>) ta-done:(ta-take:ta piz) :: -++ diff-talk-rumor ::< accept query change +++ diff-hall-rumor ::< accept query change ::> :: |= {way/wire rum/rumor} diff --git a/app/twit.hoon b/app/twit.hoon index d6020b83ba..d829cd2efa 100644 --- a/app/twit.hoon +++ b/app/twit.hoon @@ -3,7 +3,7 @@ :::: /hoon/twit/app :: /- plan-acct -/+ twitter, talk +/+ twitter, hall :: :::: ~fyr :: @@ -29,7 +29,7 @@ $% {$quit $~} :: terminate {$diff gilt} :: send data == -++ gilt +++ gilt $% {$twit-feed p/(list stat)} :: posts in feed {$twit-post p/stat} :: tweet accepted {$ares term (list tank)} :: error @@ -47,7 +47,7 @@ ++ api-call {response-mark $twit-req {endpoint quay}} :: full hiss payload ++ response-mark ?($twit-post $twit-feed $twit-cred) :: sigh options ++ app-message - $? {{ship $talk} $talk-action action:talk} :: chat message + $? {{ship $hall} $hall-action action:hall} :: chat message {{ship $hood} $write-plan-account user:eyre plan-acct} :: registration == :: ++ sign :: arvo response @@ -97,7 +97,7 @@ |= {pax/path mof/(list move)} ^+ done =^ tym ran (dely pax) :_ +>.$ - ?~ tym + ?~ tym :: ~& no-wait/ran mof :: ~& will-wait/u.tym @@ -124,7 +124,7 @@ pus=(~(gas ju *(jug path bone)) (turn ~(tap by sup) .)) ?~ (~(get ju pus) pax) ~ - ~& peer-again+[pax ran] + ~& peer-again+[pax ran] (pear | `~. pax) ::(user-from-path pax)) :: ++ sigh-recoverable-error :: Rate-limit @@ -223,7 +223,7 @@ =+ hiz=(pear-hiss pax) ?~ hiz ~ :: already in flight ::?> (compat usr -.u.hiz) :: XX better auth - [ost %hiss scry+pax usr +.u.hiz]~ + [ost %hiss scry+pax usr +.u.hiz]~ :: ++ peer |=(pax/path :_(+> (pear & `~. pax))) :: accept subscription ++ pear :: poll, possibly returning current data @@ -315,5 +315,5 @@ ?. =(pax a) ~ (turn b |=(c/gift [ost c])) :: -++ show-url ~(said-url talk `bowl:gall`+<-) +++ show-url ~(said-url hall `bowl:gall`+<-) -- diff --git a/gen/talk/load-legacy.hoon b/gen/hall/load-legacy.hoon similarity index 84% rename from gen/talk/load-legacy.hoon rename to gen/hall/load-legacy.hoon index 4f27d57ff8..82c2c27762 100644 --- a/gen/talk/load-legacy.hoon +++ b/gen/hall/load-legacy.hoon @@ -1,6 +1,6 @@ :: Load legacy messages from backup :: -:::: /gen/talk/load-old/hoon +:::: /gen/hall/load-old/hoon :: /? 310 :: diff --git a/gen/talk/load.hoon b/gen/hall/load.hoon similarity index 77% rename from gen/talk/load.hoon rename to gen/hall/load.hoon index c4c52ae4aa..38909a5297 100644 --- a/gen/talk/load.hoon +++ b/gen/hall/load.hoon @@ -1,6 +1,6 @@ :: Load channel messages from backup :: -:::: /hoon/load/talk/gen +:::: /hoon/load/hall/gen :: /? 310 :: @@ -10,4 +10,4 @@ |= $: {now/@da eny/@uvJ byk/beak} {{man/knot $~} $~} == -[%talk-load man] +[%hall-load man] diff --git a/gen/talk/log.hoon b/gen/hall/log.hoon similarity index 77% rename from gen/talk/log.hoon rename to gen/hall/log.hoon index 8d6682a9cf..9a381d8597 100644 --- a/gen/talk/log.hoon +++ b/gen/hall/log.hoon @@ -1,6 +1,6 @@ :: Enable channel logging to clay :: -:::: /hoon/log/talk/gen +:::: /hoon/log/hall/gen :: /? 310 :: @@ -10,4 +10,4 @@ |= $: {now/@da eny/@uvJ byk/beak} {{man/knot $~} $~} == -[%talk-log man] +[%hall-log man] diff --git a/gen/talk/save.hoon b/gen/hall/save.hoon similarity index 77% rename from gen/talk/save.hoon rename to gen/hall/save.hoon index 8eaf3a301c..75e0601165 100644 --- a/gen/talk/save.hoon +++ b/gen/hall/save.hoon @@ -1,6 +1,6 @@ :: Save channel messages to backup :: -:::: /hoon/save/talk/gen +:::: /hoon/save/hall/gen :: /? 310 :: @@ -10,4 +10,4 @@ |= $: {now/@da eny/@uvJ byk/beak} {{man/knot $~} $~} == -[%talk-save man] +[%hall-save man] diff --git a/gen/talk/unlog.hoon b/gen/hall/unlog.hoon similarity index 76% rename from gen/talk/unlog.hoon rename to gen/hall/unlog.hoon index e28d582692..b38dc688dd 100644 --- a/gen/talk/unlog.hoon +++ b/gen/hall/unlog.hoon @@ -1,6 +1,6 @@ :: Disable channel logging to clay :: -:::: /hoon/unlog/talk/gen +:::: /hoon/unlog/hall/gen :: /? 310 :: @@ -10,4 +10,4 @@ |= $: {now/@da eny/@uvJ byk/beak} {{man/knot $~} $~} == -[%talk-unlog man] +[%hall-unlog man] diff --git a/gen/help.hoon b/gen/help.hoon index 097d585896..610f687022 100644 --- a/gen/help.hoon +++ b/gen/help.hoon @@ -23,7 +23,7 @@ :- ?- b $~ "/" :: XX !! maybe? {$hood ^} "|{(path-heps t.b)}" - ^ "+{(path-heps b)}" :: XX deal with :talk|foo + ^ "+{(path-heps b)}" :: XX deal with :hall|foo == =/ c (to-wain:format a) ?~ c "~" diff --git a/gen/talk/federate.hoon b/gen/talk/federate.hoon deleted file mode 100644 index 1cb9d42942..0000000000 --- a/gen/talk/federate.hoon +++ /dev/null @@ -1,10 +0,0 @@ -:: Set upstream sources for channel -:: -:::: /hoon/federate/talk/gen - :: -/? 310 -/- talk -:- %say -|= {^ {dest/knot sources/(list station:talk)} $~} -:- %talk-command -[%design dest ~ (silt (turn sources |=(station:talk [%& +<]))) '' %black ~] diff --git a/lib/drum.hoon b/lib/drum.hoon index b6896cd144..8c27ee3789 100644 --- a/lib/drum.hoon +++ b/lib/drum.hoon @@ -2,7 +2,7 @@ :::: /hoon/drum/lib :: :: :: :: :: /? 310 :: version -/- sole +/- sole, hall /+ sole [. ^sole] :: :: :: @@ -60,8 +60,8 @@ == :: ++ target :: application target $: $= blt :: curr & prev belts - %+ pair - (unit dill-belt:dill) + %+ pair + (unit dill-belt:dill) (unit dill-belt:dill) ris/(unit search) :: reverse-i-search hit/history :: all past input @@ -105,7 +105,7 @@ == :: :: ++ drum-path :: encode path - |= gyl/gill:gall + |= gyl/gill:gall ^- wire [%drum %phat (scot %p p.gyl) q.gyl ~] :: @@ -122,7 +122,7 @@ => |% :: arvo structures ++ pear :: request $% {$sole-action p/sole-action} :: - {$talk-command command:talk} :: + {$hall-command command:hall} :: == :: ++ lime :: update $% {$dill-blit dill-blit:dill} :: @@ -172,7 +172,7 @@ (se-klin gyl) :: ++ poke-exit :: shutdown - |= $~ + |= $~ se-abet:(se-blit-sys `dill-blit:dill`[%qit ~]) :: ++ poke-put :: write file @@ -353,7 +353,7 @@ ++ se-dump :: print tanks |= tac/(list tank) ^+ +> - ?. se-ably (se-talk tac) + ?. se-ably (se-hall tac) =/ wol/wall (zing (turn (flop tac) |=(a/tank (~(win re a) [0 edg])))) |- ^+ +>.^$ @@ -387,7 +387,7 @@ |= bil/dill-blit:dill +>(biz [bil biz]) :: -++ se-blit-sys :: output to system +++ se-blit-sys :: output to system |= bil/dill-blit:dill ^+ +> ?~ sys ~&(%se-blit-no-sys +>) (se-emit [u.sys %diff %dill-blit bil]) @@ -430,13 +430,13 @@ |= mov/move %_(+> moz [mov moz]) :: -++ se-talk +++ se-hall |= tac/(list tank) ^+ +> - :: XX talk should be usable for stack traces, see urbit#584 which this change + :: 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/talk [our.hid %talk] (said:talk our.hid %drum now.hid eny.hid 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 @@ -444,7 +444,7 @@ ?. ((sane %t) (crip txt)) :: XX upstream validation ~& bad-text+<`*`txt> +> - ?. se-ably (se-talk [%leaf txt]~) + ?. se-ably (se-hall [%leaf txt]~) (se-blit %out (tuba txt)) :: ++ se-poke :: send a poke @@ -472,7 +472,7 @@ :: ++ ta :: per target |_ {gyl/gill:gall target} :: app and state - ++ ta-abet :: resolve + ++ ta-abet :: resolve ^+ ..ta ..ta(fug (~(put by fug) gyl ``target`+<+)) :: @@ -806,12 +806,12 @@ %_ pom cad ;: welp - ?. ?=($earl (clan:title p.gyl)) - (cite:title p.gyl) + ?. ?=($earl (clan:title p.gyl)) + (cite:title p.gyl) (scow %p p.gyl) :: - ":" - (trip q.gyl) + ":" + (trip q.gyl) cad.pom == == diff --git a/lib/talk-json.hoon b/lib/hall-json.hoon similarity index 99% rename from lib/talk-json.hoon rename to lib/hall-json.hoon index 59b288b97e..d66332fdbb 100644 --- a/lib/talk-json.hoon +++ b/lib/hall-json.hoon @@ -1,7 +1,7 @@ :: -:::: /lib/talk-json/hoon +:::: /lib/hall-json/hoon :: -/- talk +/- hall /+ old-zuse :: ::> proposed rules for sur-json conversion, adhered to below: @@ -23,7 +23,7 @@ :: |_ bol/bowl:gall ++ en-tape ::> sur to tape - =, talk + =, hall |% ++ circ ::> circle |= a/circle @@ -44,7 +44,7 @@ -- :: ++ de-tape ::> tape to sur (parse) - =, talk + =, hall |% ++ circ ::> circle ;~((glue fas) ;~(pfix sig fed:ag) urt:ab) @@ -75,7 +75,7 @@ -- :: ++ enjs ::> sur to json - =, talk + =, hall =, enjs:format |% ::TODO these first few should probably make their way @@ -377,7 +377,7 @@ -- :: ++ dejs ::> json to sur - =, talk + =, hall =, dejs-soft:format |% ::TODO these first few should maybe make their way diff --git a/lib/talk-legacy.hoon b/lib/hall-legacy.hoon similarity index 96% rename from lib/talk-legacy.hoon rename to lib/hall-legacy.hoon index 0d89c4dce8..9bb117f0a4 100644 --- a/lib/talk-legacy.hoon +++ b/lib/hall-legacy.hoon @@ -1,6 +1,6 @@ :: /? 310 -/- talk +/- hall /+ old-zuse [old-zuse .] => @@ -56,7 +56,7 @@ |% ++ from-json => [jo ..telegram] - |= a/^json ^- (list telegram:talk) + |= a/^json ^- (list telegram:hall) =- %- zing %+ turn (need ((ar (ot ship+(su fed:ag) thought+thot ~)) a)) @@ -153,20 +153,20 @@ :: ++ convert-telegram |= t/telegram - ^- (list telegram:talk) + ^- (list telegram:hall) =+ aud=(convert-audience q.q.t) %+ turn (convert-speech r.r.q.t) - |= s/speech:talk + |= s/speech:hall [p.t p.q.t aud p.r.q.t s] :: ++ convert-audience |= a/audience - ^- audience:talk + ^- audience:hall %- sy - ^- (list circle:talk) + ^- (list circle:hall) %+ murn ~(tap in ~(key by a)) |= p/partner - ^- (unit circle:talk) + ^- (unit circle:hall) ?- -.p $& :+ ~ p.p.p ?: ?| =(q.p.p 'porch') @@ -180,13 +180,13 @@ :: ++ convert-speech |= s/speech - ^- (list speech:talk) + ^- (list speech:hall) ?+ -.s ~&([%ignoring -.s] ~) $lin [%lin !p.s q.s]~ $url [%url p.s]~ $exp [%exp p.s ~]~ $ire %+ turn (convert-speech q.s) - |= i/speech:talk + |= i/speech:hall [%ire p.s i] $app [%app p.s [%lin | q.s]]~ $fat ?: &(?=($exp -.q.s) ?=($tank -.p.s)) diff --git a/lib/talk.hoon b/lib/hall.hoon similarity index 98% rename from lib/talk.hoon rename to lib/hall.hoon index bd95bf44dc..3dc541f15f 100644 --- a/lib/talk.hoon +++ b/lib/hall.hoon @@ -1,14 +1,14 @@ :: -:::: /hoon/talk/lib +:::: /lib/hall/hoon :: :: This file is in the public domain. :: /? 310 -/- talk +/- hall :: :::: :: -[. ^talk] +[. ^hall] |_ bol/bowl:gall :: ::TODO add to zuse? @@ -25,7 +25,7 @@ ++ said-url :: app url |= url/purl:eyre :^ ost.bol %poke /said-url - :+ [our.bol %talk] %talk-action + :+ [our.bol %hall] %hall-action ^- action :+ %phrase [[our.bol %inbox] ~ ~] @@ -33,7 +33,7 @@ :: ++ said :: app message |= mes/(list tank) - :- %talk-action + :- %hall-action ^- action :- %phrase :- [[our.bol %inbox] ~ ~] diff --git a/lib/kiln.hoon b/lib/kiln.hoon index c9c322a40d..a02a5db397 100644 --- a/lib/kiln.hoon +++ b/lib/kiln.hoon @@ -73,7 +73,7 @@ {$warp wire sock riff} :: == :: ++ pear :: poke fruit - $% {$talk-command command:talk} :: + $% {$hall-command command:hall} :: {$kiln-merge kiln-merge} :: {$helm-reload (list term)} :: {$helm-reset $~} :: @@ -315,7 +315,7 @@ |= mes/(list tank) ((slog mes) ..spam) :: %- emit :: XX not displayed/immediately -:: [%poke /kiln/spam [our %talk] (said our %kiln now eny mes)] +:: [%poke /kiln/spam [our %hall] (said our %kiln now eny mes)] :: ++ auto |= kiln-sync diff --git a/lib/womb.hoon b/lib/womb.hoon index 647301fa37..345c791831 100644 --- a/lib/womb.hoon +++ b/lib/womb.hoon @@ -2,7 +2,7 @@ :::: /hoon/womb/lib :: :: :: :: :: /? 310 :: version -/+ talk, old-phon +/+ hall, old-phon =, wired =, title :: :: :: @@ -75,7 +75,7 @@ == :: ++ welcome :: welcome message $: intro/tape :: in invite email - hello/tape :: as talk message + hello/tape :: as hall message == :: ++ reference :: affiliate credit (unit (each @p mail)) :: ship or email @@ -845,7 +845,7 @@ ++ release-star :: subdivide %king =+ [who=*@p res=.] |. ^+ res - =. res + =. res %- emit.res [%poke /womb/tick [(sein who) %hood] [%womb-do-ticket who]] %+ mod-managed-star:res who diff --git a/mar/fora/comment.hoon b/mar/fora/comment.hoon index 1ee6fb0d48..63e2166f73 100644 --- a/mar/fora/comment.hoon +++ b/mar/fora/comment.hoon @@ -1,5 +1,5 @@ :: -:::: /hoon/comment/talk/mar +:::: /mar/fora/comment/hoon :: /? 310 /+ old-zuse diff --git a/mar/fora/post.hoon b/mar/fora/post.hoon index afa26499b1..80d7398dd3 100644 --- a/mar/fora/post.hoon +++ b/mar/fora/post.hoon @@ -1,5 +1,5 @@ :: -:::: /hoon/fora-post/talk/mar +:::: /mar/fora/post/hoon :: /? 310 /+ old-zuse diff --git a/mar/gh/issue-comment.hoon b/mar/gh/issue-comment.hoon index a9eb81ee01..3395e80fbc 100644 --- a/mar/gh/issue-comment.hoon +++ b/mar/gh/issue-comment.hoon @@ -1,12 +1,12 @@ :: Converts the result of an 'issues' event into a issues:gh. /- gh -/+ gh-parse, talk, old-zuse +/+ gh-parse, hall, old-zuse =, old-zuse |_ issue-comment/issue-comment:gh ++ grow |% - ++ talk-speeches - ^- (list speech:talk) + ++ hall-speeches + ^- (list speech:hall) :_ ~ =+ ^= txt ;: (cury cat 3) diff --git a/mar/gh/issues.hoon b/mar/gh/issues.hoon index 53d484d5db..a5adc0ae22 100644 --- a/mar/gh/issues.hoon +++ b/mar/gh/issues.hoon @@ -1,12 +1,12 @@ :: Converts the result of an 'issues' event into a issues:gh. /- gh -/+ gh-parse, talk, old-zuse +/+ gh-parse, hall, old-zuse =, old-zuse |_ issues/issues:gh ++ grow |% - ++ talk-speeches - ^- (list speech:talk) + ++ hall-speeches + ^- (list speech:hall) :_ ~ =+ ^= txt ?- -.action.issues @@ -78,7 +78,7 @@ title.issue.issues == == - ^- speech:talk + ^- speech:hall :* %api %github login.sender.issues (rash html-url.sender.issues aurf:urlp) diff --git a/mar/talk/action.hoon b/mar/hall/action.hoon similarity index 84% rename from mar/talk/action.hoon rename to mar/hall/action.hoon index 264b3699b6..24ae2dcab7 100644 --- a/mar/talk/action.hoon +++ b/mar/hall/action.hoon @@ -1,29 +1,29 @@ :: -:::: /mar/talk/action/hoon +:::: /mar/hall/action/hoon :: -/- talk -/+ talk-json +/- hall +/+ hall-json :: -|_ act/action:talk +|_ act/action:hall :: ++ grab ::> convert from |% - ++ noun action:talk ::< from %noun + ++ noun action:hall ::< from %noun ++ json ::> from %json - => [. dejs:talk-json] ::TODO =, + => [. dejs:hall-json] ::TODO =, =, dejs-soft:format |= a/json - ^- action:talk + ^- action:hall =- (need ((of -) a)) :~ create+(ot nom+so des+so sec+secu ~) delete+(ot nom+so why+(mu so) ~) depict+(ot nom+so des+so ~) filter+(ot nom+so fit+filt ~) permit+(ot nom+so inv+bo sis+(as (su fed:ag)) ~) - source+(ot nom+so aub+bo srs+(as sorc) ~) + source+(ot nom+so sub+bo srs+(as sorc) ~) :: convey+(ar thot) - phrase+(ot aud+audi ses+(ar spec:dejs:talk-json) ~) + phrase+(ot aud+audi ses+(ar spec:dejs:hall-json) ~) :: notify+(ot aud+audi pes+(mu pres) ~) naming+(ot aud+audi man+huma ~) @@ -38,7 +38,7 @@ ++ grow ::> convert to |% ++ json ::> to %json - => [. enjs:talk-json] ::TODO =, + => [. enjs:hall-json] ::TODO =, =, enjs:format %+ frond -.act ::> only %convey has just a single piece of data. diff --git a/mar/talk/command.hoon b/mar/hall/command.hoon similarity index 75% rename from mar/talk/command.hoon rename to mar/hall/command.hoon index 40ec26ad85..3e7106db86 100644 --- a/mar/talk/command.hoon +++ b/mar/hall/command.hoon @@ -1,11 +1,11 @@ :: -:::: /hoon/command/talk/mar +:::: /mar/hall/command/hoon :: /? 310 -/- talk -/+ talk-json +/- hall +/+ hall-json :: -=, talk +=, hall |_ cod/command :: ++ grab :: convert from diff --git a/mar/talk/prize.hoon b/mar/hall/prize.hoon similarity index 74% rename from mar/talk/prize.hoon rename to mar/hall/prize.hoon index a470d6e10c..1aeb4431bd 100644 --- a/mar/talk/prize.hoon +++ b/mar/hall/prize.hoon @@ -1,19 +1,19 @@ :: -:::: /hoon/prize/talk/mar +:::: /mar/hall/prize/hoon :: -/- talk -/+ talk-json +/- hall +/+ hall-json :: -|_ piz/prize:talk +|_ piz/prize:hall :: ++ grab ::> convert from |% - ++ noun prize:talk ::< from %noun + ++ noun prize:hall ::< from %noun ++ json ::> from %json - => [. dejs:talk-json] ::TODO =, + => [. dejs:hall-json] ::TODO =, =, dejs-soft:format |= a/json - ^- prize:talk + ^- prize:hall =- (need ((of -) a)) :~ reader+pire public+(as circ) @@ -25,7 +25,7 @@ ++ grow ::> convert to |% ++ json ::> to %json - => [. enjs:talk-json] ::TODO =, + => [. enjs:hall-json] ::TODO =, =, enjs:format %+ frond -.piz ?+ -.piz !! diff --git a/mar/talk/rumor.hoon b/mar/hall/rumor.hoon similarity index 75% rename from mar/talk/rumor.hoon rename to mar/hall/rumor.hoon index b593d1a493..baf7c416b1 100644 --- a/mar/talk/rumor.hoon +++ b/mar/hall/rumor.hoon @@ -1,19 +1,19 @@ :: -:::: /hoon/rumor/talk/mar +:::: /mar/hall/rumor/hoon :: -/- talk -/+ talk-json +/- hall +/+ hall-json :: -|_ rum/rumor:talk +|_ rum/rumor:hall :: ++ grab ::> convert from |% - ++ noun rumor:talk ::< from %noun + ++ noun rumor:hall ::< from %noun ++ json ::> from %json - => [. dejs:talk-json] ::TODO =, + => [. dejs:hall-json] ::TODO =, =, dejs-soft:format |= a/json - ^- rumor:talk + ^- rumor:hall =- (need ((of -) a)) :~ reader+rure public+(ot add+bo cir+circ ~) @@ -25,7 +25,7 @@ ++ grow ::> convert to |% ++ json ::> to %json - => [. enjs:talk-json] ::TODO =, + => [. enjs:hall-json] ::TODO =, =, enjs:format %+ frond -.rum ?+ -.rum !! diff --git a/mar/talk/speeches.hoon b/mar/hall/speeches.hoon similarity index 71% rename from mar/talk/speeches.hoon rename to mar/hall/speeches.hoon index 1a5be4c853..a2353df399 100644 --- a/mar/talk/speeches.hoon +++ b/mar/hall/speeches.hoon @@ -1,11 +1,11 @@ :: -:::: /hoon/speeches/talk/mar +:::: /mar/hall/speeches/hoon :: /? 310 -/- talk -/+ talk,map-to-json +/- hall +/+ hall,map-to-json :: -=+ talk +=+ hall |_ gam/(list speech) :: ++ grab @@ -15,7 +15,7 @@ :: ++ grad |% - ++ form %talk-speeches + ++ form %hall-speeches ++ diff |=((list speech) +<) ++ pact |=((list speech) +<) ++ join |=({(list speech) (list speech)} `(unit mime)`~) diff --git a/mar/talk/telegrams.hoon b/mar/hall/telegrams.hoon similarity index 58% rename from mar/talk/telegrams.hoon rename to mar/hall/telegrams.hoon index 0989468ea3..cfc5786a40 100644 --- a/mar/talk/telegrams.hoon +++ b/mar/hall/telegrams.hoon @@ -1,14 +1,14 @@ :: -:::: /hoon/telegrams/talk/mar +:::: /mar/hall/telegrams/hoon :: -/- talk -/+ talk-json +/- hall +/+ hall-json :: -|_ gaz/(list telegram:talk) +|_ gaz/(list telegram:hall) :: ++ grab ::> convert from |% - ++ noun (list telegram:talk) ::< from %noun + ++ noun (list telegram:hall) ::< from %noun :: ++ mime ::> from %mime |= ^mime @@ -17,8 +17,8 @@ ++ json ::> from %json =, dejs-soft:format |= a/json - ^- (list telegram:talk) - (need ((ar gram:dejs:talk-json) a)) + ^- (list telegram:hall) + (need ((ar gram:dejs:hall-json) a)) -- :: ++ grow ::> convert to @@ -27,15 +27,15 @@ :- /text/json (as-octs:mimes:html (crip (en-json:html json))) :: - ++ json a+(turn gaz gram:enjs:talk-json) ::< to %json + ++ json a+(turn gaz gram:enjs:hall-json) ::< to %json -- :: ++ grad |% - ++ form %talk-telegrams - ++ diff |=((list telegram:talk) +<) - ++ pact |=((list telegram:talk) +<) - ++ join |= {(list telegram:talk) (list telegram:talk)} + ++ form %hall-telegrams + ++ diff |=((list telegram:hall) +<) + ++ pact |=((list telegram:hall) +<) + ++ join |= {(list telegram:hall) (list telegram:hall)} `(unit mime)`~ -- -- diff --git a/mar/talk/report.hoon b/mar/talk/report.hoon deleted file mode 100644 index bb2ba94b7f..0000000000 --- a/mar/talk/report.hoon +++ /dev/null @@ -1,148 +0,0 @@ -:: -:::: /hoon/report/talk/mar - ::TODO deleteme -/? 310 -/- talk -/+ talk, old-zuse -:: -=, talk -=, mimes:html -=, html -=, format -=, old-zuse -|_ rep/report -:: -++ grab :: convert from - |% - ++ noun report :: clam from %noun - -- -++ grow - |% - ++ mime [/text/json (as-octs (crip (en-json json)))] - ++ json - => + - |^ %+ joba -.rep - ?- -.rep - $lobby (loby cab.rep) - $grams (jobe num+(jone num.rep) tele+[%a (turn gaz.rep gram)] ~) - $crowd %^ jobe - local+(grop loc.reg.rep) - global+%.(rem.reg.rep (jome parn grop)) - ~ - == - ++ joce |=(a/knot [%s a]) - :: - ++ jove - |= {a/envelope b/delivery} - %- jobe :~ - envelope+(jobe visible+[%b vis.a] sender+?~(sen.a ~ s+(parn u.sen.a)) ~) - delivery+[%s b] - == - ++ jope |=(a/ship (jape +:)) ::[%s (crip +:(scow %p a))]) - ++ joke |=(a/tank (jape (of-wall (wash 0^80 a)))) - ++ jode |=(a/time (jone (div (mul (sub a ~1970.1.1) 1.000) ~s1))) - ++ jome :: stringify keys - |* {a/_cord b/_json} - |= c/(map _+<.a _+<.b) - (jobe (turn ~(tap by c) (both a b))) - :: - ++ both :: cons two gates - |* {a/_* b/_*} - |=(c/_[+<.a +<.b] [(a -.c) (b +.c)]) - :: - :: - ++ nack |=(a/(set (set partner)) [%a (turn ~(tap in a) sorc)]) - ++ grop (jome phon stas) :: (map ship status) - ++ phon |=(a/ship (scot %p a)) - ++ stas |=(status (jobe presence+(joce pec) human+(huma man) ~)) - ++ gram |=(telegram (jobe ship+(jope aut) thought+(thot tot) ~)) - ++ thot - |= thought - (jobe serial+(jape ) audience+(audi aud) statement+(stam sam) ~) - :: - ++ audi (jome parn jove) - ++ bouq - |= a/bouquet - a+(turn ~(tap in a) |=(b/path a+(turn b |=(c/knot s+c)))) - :: - ++ parn - |= a/partner ^- cord - ?- -.a - $& (circ p.a) - $| %- crip - ?- -.p.a - $twitter "{(trip -.p.a)}/{(trip p.p.a)}" - == - == - :: - ++ circ - |= a/circle ^- cord - (crip "{}/{(trip nom.a)}") - :: - ++ stam - |= statement - (jobe date+(jode wen) bouquet+(bouq boq) speech+(spec sep) ~) - :: - ++ spec - |= a/speech - %+ joba -.a - ?+ -.a ~|(stub+-.a !!) - $lin (jobe txt+[%s msg.a] say+[%b pat.a] ~) - $url (joba txt+[%s (crip (earf url.a))]) - $exp (joba txt+[%s exp.a]) - $fat (jobe tor+(tach tac.a) taf+$(a sep.a) ~) - $mor a+(turn ses.a spec) - $app (jobe txt+[%s msg.a] src+[%s app.a] ~) - $api - %- jobe :~ - service+s+service.a - id+s+id.a - id-url+s+(crip (earf id-url.a)) - summary+s+summary.a - body+s+body.a - url+s+(crip (earf url.a)) - meta+meta.a - == - :: %inv (jobe ship+(jope p.a) party+[%s q.a] ~) - == - :: - ++ tach - |= a/attache - %+ joba -.a - ?- -.a - $text [%s (of-wain +.a)] - $tank [%a (turn +.a joke)] - $name (jobe nom+s+nom.a mon+$(a tac.a) ~) - == - :: - ++ huma - |= human - %^ jobe - han+?~(han ~ [%s u.han]) - :- %true - ?~ tru ~ - =+ u.tru - (jobe fir+[%s fir] mid+?~(mid ~ [%s u.mid]) las+[%s las] ~) - ~ - :: - ++ loby - |= lobby - %- jobe :~ - loc+(conf loc) - ham+((jome circ conf) rem) - == - :: - ++ sorc - |= a/(set partner) ^- json - [%a (turn ~(tap in a) |=(b/partner s+(parn b)))] - :: - ++ conf - |= config - %- jobe :~ - sources+(sorc src) - caption+[%s cap] - =- control+(jobe security+[%s -.con] list+[%a -] ~) - (turn (~(tap in ses.con)) jope) :: XX jase - == - -- --- -- diff --git a/mar/twit/feed.hoon b/mar/twit/feed.hoon index a2c5edf27a..c8d406c01b 100644 --- a/mar/twit/feed.hoon +++ b/mar/twit/feed.hoon @@ -2,7 +2,7 @@ :: :::: /hoon/feed/twit/mar :: -/- talk +/- hall /+ twitter, httr-to-json, old-zuse =, old-zuse =, format @@ -16,10 +16,10 @@ ++ grow |% ++ tank >[fed]< - ++ talk-speeches + ++ hall-speeches =+ r=render:twitter %+ turn fed - |= a/post:twitter ^- speech:talk + |= a/post:twitter ^- speech:hall :* %api %twitter who.a (user-url.r who.a) diff --git a/sur/talk.hoon b/sur/hall.hoon similarity index 99% rename from sur/talk.hoon rename to sur/hall.hoon index 2ac2465509..0f96ed58a5 100644 --- a/sur/talk.hoon +++ b/sur/hall.hoon @@ -1,6 +1,6 @@ :: -:::: /hoon/talk/sur - !: +:::: /sur/hall/hoon + :: |% :: ::TODO use different words for different kinds of burdens @@ -52,7 +52,6 @@ $% {$reader prize-reader} ::< /reader {$public cis/(set circle)} ::< /public {$burden sos/(map naem burden)} ::< /burden - ::TODO do we ever use remote things from remote circles? {$circle package} ::< /circle == :: ++ prize-reader :: From 220840b1d2321f812574d2b53e0dcb953671e2c3 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 7 Nov 2017 22:14:40 +0100 Subject: [PATCH 242/303] Updated tree/main.js to the version in commit 858f1eb. Includes changes to use the %fora app rather than %talk. --- web/tree/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/tree/main.js b/web/tree/main.js index c486548b48..c270afb596 100644 --- a/web/tree/main.js +++ b/web/tree/main.js @@ -78,7 +78,7 @@ module.exports = { pax: pax, sup: sup, txt: txt - }, "talk-comment", "talk", (function(_this) { + }, "fora-comment", "fora", (function(_this) { return function(err, res) { if (err == null) { return _this.clearData(); @@ -92,7 +92,7 @@ module.exports = { sup: sup, hed: hed, txt: txt - }, "talk-fora-post", "talk", (function(_this) { + }, "fora-post", "fora", (function(_this) { return function(err, res) { if (err == null) { _this.clearData(); From d3dabed6ced67939ad05a088b27ab9b8c2447259 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 7 Nov 2017 22:18:28 +0100 Subject: [PATCH 243/303] Updated webtalk files to the version in commit f7b5595. Includes changes to make it compatible with %hall. --- web/talk/main.css | 8 +- web/talk/main.js | 1118 +++++++++++++-------------------------------- 2 files changed, 324 insertions(+), 802 deletions(-) diff --git a/web/talk/main.css b/web/talk/main.css index 1f6c76818e..3366239f2f 100644 --- a/web/talk/main.css +++ b/web/talk/main.css @@ -3,8 +3,8 @@ font-family: 'scp'; } div.input.valid-false { - color: #E20B0B; - border-color: #E20B0B; } + color: #FF0808; + border-color: #FF0808; } .grams { list-style-type: none; @@ -138,7 +138,7 @@ input.action { font-size: .8rem; } input.action.valid-false { - color: #E20B0B; } + color: #FF0808; } input.action::-webkit-input-placeholder { color: #000; @@ -196,7 +196,7 @@ input.action:focus:-ms-input-placeholder { margin-left: .6rem; font-weight: 600; font-size: .8rem; - color: #E20B0B; } + color: #FF0808; } .menu .room:hover .close { display: inline; } .menu .room.disabled { diff --git a/web/talk/main.js b/web/talk/main.js index 29781559ba..b128f2f6f5 100644 --- a/web/talk/main.js +++ b/web/talk/main.js @@ -57,73 +57,43 @@ Persistence = _persistence({ return Persistence.get(station, start, end); }, sendMessage: function(txt, audience, global) { - var _audi, j, k, len, message, messageType, ref, ref1, results, say, serial, speech, speeches, v; + var message, speech; if (global == null) { global = urb.user === urb.ship; } - serial = util.uuid32(); audience = _.uniq(audience); - _audi = {}; - for (k in audience) { - v = audience[k]; - _audi[v] = { - envelope: { - visible: true, - sender: null - }, - delivery: "pending" - }; - } speech = { lin: { - txt: txt, - say: true + msg: txt, + pat: false } }; if (txt[0] === "@") { - speech.lin.txt = speech.lin.txt.slice(1).trim(); - speech.lin.say = false; + speech.lin.msg = speech.lin.msg.slice(1).trim(); + speech.lin.pat = true; } else if (txt[0] === "#") { speech = { - "eval": speech.lin.txt.slice(1).trim() + exp: { + exp: speech.lin.msg.slice(1).trim() + } }; } else if (window.urb.util.isURL(txt)) { speech = { url: txt }; } - speeches = !(((ref = speech.lin) != null ? ref.txt.length : void 0) > 64) ? [speech] : ((ref1 = speech.lin, say = ref1.say, txt = ref1.txt, ref1), txt.match(/(.{1,64}$|.{0,64} |.{64}|.+$)/g).map(function(s, i) { - say || (say = i !== 0); - return { - lin: { - say: say, - txt: s.slice(-1 !== " ") ? s : s.slice(0, -1) - } - }; - })); - results = []; - for (j = 0, len = speeches.length; j < len; j++) { - speech = speeches[j]; - message = { - ship: window.urb.user, - thought: { - serial: util.uuid32(), - audience: _audi, - statement: { - bouquet: [], - speech: speech, - date: Date.now() - } - } - }; - Dispatcher.handleViewAction({ - message: message, - type: "message-send" - }); - messageType = (global ? "publish" : "review"); - results.push(Persistence.sendMessage(messageType, message.thought)); - } - return results; + message = { + aut: window.urb.user, + uid: util.uuid32(), + aud: audience, + wen: Date.now(), + sep: speech + }; + Dispatcher.handleViewAction({ + message: message, + type: "message-send" + }); + return Persistence.sendMessage(message); } } }); @@ -213,11 +183,20 @@ Persistence = _persistence({ }; }), createStation: function(station) { - Dispatcher.handleViewAction({ + addStation(station); + return Persistence.createStation(station); + }, + addStation: function(station) { + return Dispatcher.handleViewAction({ station: station, type: "station-create" }); - return Persistence.createStation(station); + }, + remStation: function(station) { + return Dispatcher.handleViewAction({ + station: station, + type: "station-remove" + }); }, listen: function() { return Persistence.listen(); @@ -235,15 +214,14 @@ Persistence = _persistence({ 'cabal': 'cabal' }); }, - createStation: function(station) { - Dispatcher.handleViewAction({ - station: station, - type: "station-create" - }); - return Persistence.createStation(station); + createStation: function(name) { + return Persistence.createStation(name); }, - setSources: function(station, sources) { - return Persistence.setSources(station, window.urb.ship, sources); + addSources: function(station, sources) { + return Persistence.addSources(station, sources); + }, + remSources: function(station, sources) { + return Persistence.remSources(station, sources); } } }); @@ -320,7 +298,7 @@ module.exports = recl({ },{}],5:[function(require,module,exports){ -var Member, a, clas, div, h2, h3, label, pre, recl, ref, rele, util, +var Member, a, clas, div, h2, h3, label, pre, recl, ref, util, indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; util = require('../util.coffee'); @@ -329,8 +307,6 @@ clas = require('classnames'); recl = React.createClass; -rele = React.createElement; - ref = React.DOM, div = ref.div, pre = ref.pre, a = ref.a, label = ref.label, h2 = ref.h2, h3 = ref.h3; Member = require('./MemberComponent.coffee'); @@ -355,7 +331,7 @@ module.exports = recl({ _handleAudi: function(e) { var audi; audi = _.map($(e.target).closest('.path').find('div'), function(div) { - return "~" + $(div).text(); + return $(div).text(); }); return this.props._handleAudi(audi); }, @@ -373,39 +349,36 @@ module.exports = recl({ } return this.props._handlePm(user); }, - abbreviate: function(s) { - if (s.length <= 80) { - return s; - } else { - return (s.slice(0, 77)) + "..."; - } - }, renderSpeech: function(arg) { - var app, comment, exp, fat, lin, mor, post, tax, url, x; - lin = arg.lin, app = arg.app, exp = arg.exp, tax = arg.tax, url = arg.url, mor = arg.mor, fat = arg.fat, comment = arg.comment, post = arg.post; + var app, exp, fat, inv, ire, lin, prex, ref1, url, x; + lin = arg.lin, url = arg.url, exp = arg.exp, ire = arg.ire, fat = arg.fat, inv = arg.inv, app = arg.app; switch (false) { - case !(lin || app || exp || tax): - return (lin || app || exp || tax).txt; + case !lin: + return lin.msg; case !url: return a({ - href: url.txt, + href: url, target: "_blank", + rel: "noopener", key: "speech" - }, url.txt); - case !comment: - return div({}, a({ - href: comment.url - }, this.abbreviate(comment.txt))); - case !post: - return div({}, a({ - href: post.url - }, post.title)); - case !mor: - return mor.map(this.renderSpeech); - case !fat: - return div({}, this.renderSpeech(fat.taf), div({ + }, url); + case !exp: + return div({}, exp.exp, div({ className: "fat" - }, this.renderTorso(fat.tor))); + }, pre({}, exp.res.join("\n")))); + case !ire: + return this.renderSpeech(ire.sep); + case !fat: + return div({}, this.renderSpeech(fat.sep), div({ + className: "fat" + }, this.renderAttache(fat.tac))); + case !inv: + prex = (ref1 = inv.inv) != null ? ref1 : { + "invited you to ": "banished you from " + }; + return prex + inv.cir; + case !app: + return this.renderSpeech(app.sep); default: return "Unknown speech type:" + ((function() { var results; @@ -417,123 +390,79 @@ module.exports = recl({ }).apply(this, arguments)).join(''); } }, - renderTorso: function(arg) { - var name, tank, text, x; + renderAttache: function(arg) { + var name, tank, text; text = arg.text, tank = arg.tank, name = arg.name; switch (false) { case text == null: - return text; + return pre({}, text); case tank == null: return pre({}, tank.join("\n")); case name == null: - return div({}, name.nom, ": ", this.renderTorso(name.mon)); - default: - return "Unknown torso:" + ((function() { - var results; - results = []; - for (x in arguments[0]) { - results.push(" %" + x); - } - return results; - }).apply(this, arguments)).join(''); + return pre({}, name.nom, ":\n", this.renderAttache(name.tac)); } }, classesInSpeech: function(arg) { - var app, exp, fat, lin, mor, url; - url = arg.url, exp = arg.exp, app = arg.app, lin = arg.lin, mor = arg.mor, fat = arg.fat; + var app, exp, fat, inv, ire, lin, url; + lin = arg.lin, url = arg.url, exp = arg.exp, ire = arg.ire, fat = arg.fat, inv = arg.inv, app = arg.app; switch (false) { + case !lin: + return { + say: lin.pat + }; case !url: return "url"; case !exp: return "exp"; - case !app: - return "say"; - case !lin: - return { - say: lin.say === false - }; - case !mor: - return mor != null ? mor.map(this.classesInSpeech) : void 0; + case !ire: + return this.classesInSpeech(ire.sep); case !fat: - return this.classesInSpeech(fat.taf); + return this.classesInSpeech(fat.sep); + case !inv: + return { + say: true + }; + case !app: + return "exp"; } }, render: function() { - var aude, audi, bouquet, className, comment, delivery, glyph, k, mainStation, name, path, post, ref1, ref2, speech, style, thought, title, txt, type, url, v; - thought = this.props.thought; - delivery = _.uniq(_.pluck(thought.audience, "delivery")); - speech = thought.statement.speech; - bouquet = thought.statement.bouquet; + var audi, className, gam, heard, mainStation, name, speech, style, type; + gam = this.props; + heard = gam.heard; + speech = gam.sep; if (speech == null) { - return null; + return; } name = this.props.name ? this.props.name : ""; - aude = _.keys(thought.audience); - audi = util.clipAudi(aude).map(function(_audi) { + audi = util.clipAudi(gam.aud).map(function(_audi) { return div({ key: _audi }, _audi); }); mainStation = util.mainStationPath(window.urb.user); - type = indexOf.call(aude, mainStation) >= 0 ? 'private' : 'public'; - if (_.filter(bouquet, ["comment"]).length > 0) { - comment = true; - ref1 = speech.mor; - for (k in ref1) { - v = ref1[k]; - if (v.fat) { - url = v.fat.taf.url.txt; - txt = v.fat.tor.text; - } - if (v.app) { - path = v.app.txt.replace("comment on ", ""); - } - } - audi = a({ - href: url - }, path); - speech = { - comment: { - txt: txt, - url: url - } - }; - } - if (_.filter(bouquet, ["fora-post"]).length > 0) { - post = true; - ref2 = speech.mor; - for (k in ref2) { - v = ref2[k]; - if (v.fat) { - url = v.fat.taf.url.txt; - txt = v.fat.tor.text; - } - if (v.app) { - title = v.app.txt.replace("forum post: ", ""); - } - } - audi = a({ - href: url - }, title); - speech = { - post: { - txt: txt, - url: url, - title: title - } - }; - } - className = clas('gram', (this.props.sameAs ? "same" : "first"), ((indexOf.call(delivery, "received") >= 0) ? "received" : "pending"), { + type = indexOf.call(gam.aud, mainStation) >= 0 ? 'private' : 'public'; + + /* + if(_.filter(bouquet, ["comment"]).length > 0) + comment = true + for k,v of speech.mor + if v.fat + url = v.fat.taf.url.txt + txt = v.fat.tor.text + if v.app then path = v.app.txt.replace "comment on ", "" + audi = (a {href:url}, path) + speech = {com:{txt,url}} + */ + className = clas('gram', (this.props.sameAs ? "same" : "first"), (heard ? "received" : "pending"), { 'new': this.props.unseen }, { - comment: comment, - post: post + comment: false }, this.classesInSpeech(speech)); style = { height: this.props.height, marginTop: this.props.marginTop }; - glyph = this.props.glyph || "*"; return div({ className: className, 'data-index': this.props.index, @@ -544,12 +473,12 @@ module.exports = recl({ key: "meta" }, label({ className: "type " + type, - "data-glyph": glyph + "data-glyph": this.props.glyph || "*" }), h2({ className: 'author planet', onClick: this._handlePm, key: "member" - }, rele(Member, { + }, React.createElement(Member, { ship: this.props.ship, glyph: this.props.glyph, key: "member" @@ -560,10 +489,10 @@ module.exports = recl({ }, audi), h3({ className: "time", key: "time" - }, this.convTime(thought.statement.date))), div({ + }, this.convTime(gam.wen))), div({ className: "speech", key: "speech" - }, this.renderSpeech(speech, bouquet))); + }, this.renderSpeech(speech))); } }); @@ -646,11 +575,10 @@ module.exports = recl({ var end; if (this.atScrollEdge() && this.state.fetching === false && this.state.last && this.state.last > 0) { end = this.state.last - this.pageSize; - if (end < 0) { - end = 0; - } this.lastLength = this.length; - return MessageActions.getMore(this.state.station, this.state.last + 1, end); + if (end >= 0) { + return MessageActions.getMore(this.state.station, this.state.last + 1, end); + } } }, setAudience: function() { @@ -658,18 +586,19 @@ module.exports = recl({ if (this.state.typing || !this.last) { return; } - laudi = _.keys(this.last.thought.audience); + laudi = this.last.aud; if ((_.isEmpty(laudi)) || !_(laudi).difference(this.state.audi).isEmpty()) { - return StationActions.setAudience(_.keys(this.last.thought.audience)); + return StationActions.setAudience(this.last.aud); } }, sortedMessages: function(messages) { var station; station = this.state.station; - return _.sortBy(messages, function(message) { - message.pending = message.thought.audience[station]; - return message.key; - }); + return _.sortBy(messages, (function(_this) { + return function(message) { + return message.key; + }; + })(this)); }, componentWillMount: function() { return Infinite = window.Infinite; @@ -740,12 +669,27 @@ module.exports = recl({ _handleAudi: function(audi) { return StationActions.setAudience(audi); }, + _getSpeechArr: function(spec) { + if (spec.lin != null) { + return spec.lin.msg.split(/(\s|-)/); + } else if (spec.url != null) { + return spec.url.split(/(\s|-)/); + } else if (spec.exp != null) { + return [spec.exp.exp]; + } else if (spec.app != null) { + return this._getSpeechArr(spec.app.sep); + } else if (spec.fat != null) { + return this._getSpeechArr(spec.fat.sep); + } else { + return []; + } + }, render: function() { - var _messageGroups, _messages, audience, body, canvas, context, fetching, height, i, index, lastIndex, lastSaid, len, lineNums, marginTop, message, messageHeights, messages, mez, nowSaid, ref, sameAs, speech, speechArr, speechLength, station; + var _messageGroups, _messages, aud, body, canvas, context, fetching, height, i, index, lastIndex, lastSaid, len, lineNums, marginTop, message, messageHeights, messages, mez, nowSaid, ref, sameAs, speechArr, speechLength, station; station = this.state.station; messages = this.sortedMessages(this.state.messages); this.last = messages[messages.length - 1]; - if (((ref = this.last) != null ? ref.ship : void 0) && this.last.ship === window.urb.user) { + if (((ref = this.last) != null ? ref.aut : void 0) && this.last.aut === window.urb.user) { this.lastSeen = this.last; } this.length = messages.length; @@ -765,27 +709,15 @@ module.exports = recl({ _messageGroups = [[]]; for (index = i = 0, len = messages.length; i < len; index = ++i) { message = messages[index]; - nowSaid = [message.ship, _.keys(message.thought.audience)]; + if (message.sep.app) { + message.aut = message.sep.app.app; + } + nowSaid = [message.aut, message.aud]; sameAs = _.isEqual(lastSaid, nowSaid); lastSaid = nowSaid; lineNums = 1; - speech = message.thought.statement.speech; - context.font = speech.fat == null ? (FONT_SIZE * 0.9) + 'px scp' : FONT_SIZE + 'px bau'; - speechArr = (function() { - switch (false) { - case speech.lin == null: - return speechArr = speech.lin.txt.split(/(\s|-)/); - case speech.url == null: - return speechArr = speech.url.txt.split(/(\s|-)/); - case speech.fat == null: - if (typeof speech.fat.taf.exp !== 'undefined') { return speech.fat.taf.exp.txt.split(/(\s|-)/); } - if (typeof speech.fat.taf.app !== 'undefined') { return speech.fat.taf.app.txt; } - if (typeof speech.fat.taf.lin !== 'undefined') { return speech.fat.taf.lin.txt; } - return "unsupported fat speech"; - default: - return []; - } - })(); + speechArr = this._getSpeechArr(message.sep); + context.font = FONT_SIZE + 'px bau'; _.reduce(_.tail(speechArr), function(base, word) { if (context.measureText(base + word).width > speechLength) { lineNums += 1; @@ -812,7 +744,7 @@ module.exports = recl({ height = null; marginTop = null; } - audience = (_.keys(message.thought.audience)).join(" "); + aud = message.aud.join(" "); mez = rele(Message, _.extend({}, message, { station: station, sameAs: sameAs, @@ -822,8 +754,8 @@ module.exports = recl({ marginTop: marginTop, index: message.key, key: "message-" + message.key, - ship: (speech != null ? speech.app : void 0) ? "system" : message.ship, - glyph: this.state.glyph[audience] || this.props['default-glyph'], + ship: message.aut, + glyph: this.state.glyph[aud] || this.props['default-glyph'], unseen: lastIndex && lastIndex === index })); mez.computedHeight = height + marginTop; @@ -917,19 +849,19 @@ module.exports = recl({ return this.setState(this.stateFromStore()); }, componentWillReceiveProps: function(nextProps) { - if (this.props.open && nextProps.open === false) { + if (this.props.open === true && nextProps.open === false) { return this.setState({ open: null }); } }, validateSource: function(s) { - var sources; - sources = this.state.configs[this.state.station].sources; - return indexOf.call(sources, s) < 0 && indexOf.call(s, "/") >= 0 && s[0] === "~" && s.length >= 5; + var src; + src = this.state.configs[this.state.station].src; + return indexOf.call(src, s) < 0 && indexOf.call(s, "/") >= 0 && s[0] === "~" && s.length >= 5; }, onKeyUp: function(e) { - var $input, _sources, v; + var $input, v; $('.menu.depth-1 .add').removeClass('valid-false'); if (e.keyCode === 13) { $input = $(e.target); @@ -938,9 +870,7 @@ module.exports = recl({ v = "~" + v; } if (this.validateSource(v)) { - _sources = _.clone(this.state.configs[this.state.station].sources); - _sources.push(v); - StationActions.setSources(this.state.station, _sources); + StationActions.addSources(this.state.station, [v]); $input.val(''); return $input.blur(); } else { @@ -968,13 +898,11 @@ module.exports = recl({ } }, _remove: function(e) { - var _sources, _station; + var _station; e.stopPropagation(); e.preventDefault(); _station = $(e.target).attr("data-station"); - _sources = _.clone(this.state.configs[this.state.station].sources); - _sources.splice(_sources.indexOf(_station), 1); - return StationActions.setSources(this.state.station, _sources); + return StationActions.remSources(this.state.station, [_station]); }, render: function() { var _clas, member, members, parts, source, sources, sourcesSum, station; @@ -1025,7 +953,7 @@ module.exports = recl({ if (this.state.station && this.state.configs[this.state.station]) { sources = (function() { var i, len, ref1, results; - ref1 = this.state.configs[this.state.station].sources; + ref1 = this.state.configs[this.state.station].src; results = []; for (i = 0, len = ref1.length; i < len; i++) { source = ref1[i]; @@ -1054,7 +982,7 @@ module.exports = recl({ placeholder: "+ Listen", onKeyUp: this.onKeyUp })); - sourcesSum = this.state.configs[this.state.station].sources.length; + sourcesSum = this.state.configs[this.state.station].src.length; } else { sources = ""; sourcesSum = 0; @@ -1136,7 +1064,7 @@ Audience = recl({ } }, _autoCompleteAudience: function() { - var aud, g, i, j, len, len1, modulo, ref1, ref2, s, stations, txt; + var aud, g, i, j, len, len1, ref1, ref2, s, stations, txt; txt = $('#audience .input').text().trim(); if (this.tabAudList == null) { this.tabAudList = []; @@ -1169,10 +1097,7 @@ Audience = recl({ } else { this.tabAudIndex++; } - modulo = function(a, b) { - return ((a % b) + a) % b; - }; - this.tabAudIndex = modulo(this.tabAudIndex, this.tabAudList.length); + this.tabAudIndex = (this.tabAudIndex % this.tabAudList.length + this.tabAudList.length) % this.tabAudList.length; } else { this.tabAudIndex = 0; } @@ -1225,8 +1150,12 @@ module.exports = recl({ station: StationStore.getStation(), valid: StationStore.getValidAudience() }; - s.audi = _.without(s.audi, util.mainStationPath(window.urb.user)); - s.ludi = _.without(s.ludi, util.mainStationPath(window.urb.user)); + if (s.audi.length > 1) { + s.audi = _.without(s.audi, util.mainStationPath(window.urb.user)); + } + if (s.ludi.length > 1) { + s.ludi = _.without(s.ludi, util.mainStationPath(window.urb.user)); + } return s; }, getInitialState: function() { @@ -1255,7 +1184,7 @@ module.exports = recl({ if (urb.user !== urb.ship) { return audi; } - listening = (ref1 = (ref2 = this.state.config[this.props.station]) != null ? ref2.sources : void 0) != null ? ref1 : []; + listening = (ref1 = (ref2 = this.state.config[this.props.station]) != null ? ref2.src : void 0) != null ? ref1 : []; if (_.isEmpty(_.intersection(audi, listening))) { audi.push("~" + window.urb.user + "/" + this.props.station); } @@ -1326,7 +1255,7 @@ module.exports = recl({ return this.set(); }, _autoComplete: function() { - var i, modulo, msg, name, obj, ptxt, ref1, ref2, tindex, txt; + var i, msg, name, obj, ptxt, ref1, ref2, tindex, txt; txt = this.$message.text(); tindex = txt.lastIndexOf('~'); if (tindex === -1) { @@ -1339,7 +1268,7 @@ module.exports = recl({ ref1 = MessageStore.getAll(); for (i = ref1.length - 1; i >= 0; i += -1) { msg = ref1[i]; - this._processAutoCompleteName(ptxt, msg.ship); + this._processAutoCompleteName(ptxt, msg.aut); } ref2 = this.state.members[this.state.ludi[0]]; for (name in ref2) { @@ -1356,10 +1285,7 @@ module.exports = recl({ } else { this.tabIndex++; } - modulo = function(a, b) { - return ((a % b) + a) % b; - }; - this.tabIndex = modulo(this.tabIndex, this.tabList.length); + this.tabIndex = (this.tabIndex % this.tabList.length + this.tabList.length) % this.tabList.length; } else { this.tabIndex = 0; } @@ -1514,15 +1440,12 @@ module.exports = recl({ dangerouslySetInnerHTML: { __html: "" } - })), div({ - className: 'length', - key: 'length' - }, this.state.length + "/64 (" + (Math.ceil(this.state.length / 64)) + ")")); + }))); } }); -},{"../actions/MessageActions.coffee":1,"../actions/StationActions.coffee":2,"../stores/MessageStore.coffee":13,"../stores/StationStore.coffee":14,"../util.coffee":15,"./MemberComponent.coffee":4,"husl":17}],9:[function(require,module,exports){ +},{"../actions/MessageActions.coffee":1,"../actions/StationActions.coffee":2,"../stores/MessageStore.coffee":13,"../stores/StationStore.coffee":14,"../util.coffee":15,"./MemberComponent.coffee":4,"husl":18}],9:[function(require,module,exports){ module.exports = _.extend(new Flux.Dispatcher(), { handleServerAction: function(action) { return this.dispatch({ @@ -1619,11 +1542,11 @@ var send, util; util = require('../util.coffee'); -window.urb.appl = "talk"; +window.urb.appl = "hall"; send = function(data, cb) { return window.urb.send(data, { - mark: "talk-command" + mark: "hall-action" }, cb); }; @@ -1633,14 +1556,10 @@ module.exports = function(arg) { return { listenStation: function(station, since) { var $this, path; - console.log('listen station'); - console.log(arguments); $this = this; - path = util.talkPath({ - 'f_grams': 'f_grams' - }, station, since); + path = util.talkPath('circle', station, 'grams', since); return window.urb.bind(path, function(err, res) { - var num, ref, ref1, ref2, ref3, tele; + var ref, ref1, ref2, ref3; if (err || !res.data) { console.log(path, 'err!'); console.log(err); @@ -1648,14 +1567,19 @@ module.exports = function(arg) { $this.listenStation(station, since); return; } - console.log(path); - console.log(res.data); if (res.data.ok === true) { MessageActions.listeningStation(station); } - if ((ref = res.data) != null ? (ref1 = ref.grams) != null ? ref1.tele : void 0 : void 0) { - ref3 = (ref2 = res.data) != null ? ref2.grams : void 0, tele = ref3.tele, num = ref3.num; - return MessageActions.loadMessages(tele, num); + if ((ref = res.data) != null ? (ref1 = ref.circle) != null ? ref1.nes : void 0 : void 0) { + res.data.circle.nes.map(function(env) { + env.gam.heard = true; + return env; + }); + MessageActions.loadMessages(res.data.circle.nes); + } + if ((ref2 = res.data) != null ? (ref3 = ref2.circle) != null ? ref3.gram : void 0 : void 0) { + res.data.circle.gram.gam.heard = true; + return MessageActions.loadMessages([res.data.circle.gram]); } }); }, @@ -1663,21 +1587,16 @@ module.exports = function(arg) { var path; end = window.urb.util.numDot(end); start = window.urb.util.numDot(start); - path = util.talkPath({ - 'f_grams': 'f_grams' - }, station, end, start); + path = util.talkPath('circle', station, 'grams', end, start); return window.urb.bind(path, function(err, res) { - var num, ref, ref1, ref2, ref3, tele; + var ref, ref1; if (err || !res.data) { - console.log(path, '/e/s err'); + console.log(path, '/circle err'); console.log(err); return; } - console.log(path, '/e/s'); - console.log(res); - if ((ref = res.data) != null ? (ref1 = ref.grams) != null ? ref1.tele : void 0 : void 0) { - ref3 = (ref2 = res.data) != null ? ref2.grams : void 0, tele = ref3.tele, num = ref3.num; - MessageActions.loadMessages(tele, num, true); + if ((ref = res.data) != null ? (ref1 = ref.circle) != null ? ref1.nes : void 0 : void 0) { + MessageActions.loadMessages(res.data.circle.nes); return window.urb.drop(path, function(err, res) { console.log('done'); return console.log(res); @@ -1685,13 +1604,10 @@ module.exports = function(arg) { } }); }, - sendMessage: function(messageType, message, cb) { - var obj; - return send(( - obj = {}, - obj["" + messageType] = [message], - obj - ), function(err, res) { + sendMessage: function(message, cb) { + return send({ + convey: [message] + }, function(err, res) { console.log('sent'); console.log(arguments); if (cb) { @@ -1704,23 +1620,43 @@ module.exports = function(arg) { },{"../util.coffee":15}],12:[function(require,module,exports){ -var design, send, subscribed, util; +var create, remove, send, source, subscribed, util; util = require('../util.coffee'); -window.urb.appl = "talk"; +window.urb.appl = "hall"; send = function(data, cb) { return window.urb.send(data, { - mark: "talk-command" + mark: "hall-action" }, cb); }; -design = function(party, config, cb) { +create = function(nom, des, sec, cb) { return send({ - design: { - party: party, - config: config + create: { + nom: nom, + des: des, + sec: sec + } + }, cb); +}; + +remove = function(nom, why, cb) { + return send({ + "delete": { + nom: nom, + why: why + } + }, cb); +}; + +source = function(nom, sub, srs, cb) { + return send({ + source: { + nom: nom, + sub: sub, + srs: srs } }, cb); }; @@ -1732,91 +1668,70 @@ module.exports = function(arg) { StationActions = arg.StationActions; return { createStation: function(name, cb) { - return design(name, { - sources: [], - caption: "", - cordon: { - posture: "white", - list: [] - } - }, cb); + return create(name, "", "black", cb); }, removeStation: function(name, cb) { - return design(name, null, cb); + return remove(name, 'deleted through webtalk', cb); }, - setSources: function(station, ship, sources) { - var cordon; - cordon = { - posture: "black", - list: [] - }; - return design(station, { - sources: sources, - cordon: cordon, - caption: "" - }, function(err, res) { - console.log('talk-command'); + modSources: function(station, sub, sources) { + return source(station, sub, sources, function(err, res) { + console.log('hall-action source'); return console.log(arguments); }); }, + addSources: function(station, sources) { + return this.modSources(station, true, sources); + }, + remSources: function(station, sources) { + return this.modSources(station, false, sources); + }, listen: function() { - return window.urb.bind("/", function(err, res) { - var house; + var date; + date = window.urb.util.toDate(new Date()); + return window.urb.bind('/reader', function(err, res) { + var gys, nis, ref; if (err || !res.data) { - console.log('/ err'); + console.log('sp err'); console.log(err); return; } - console.log('/'); - console.log(res.data); - house = res.data.house; - if (house) { - return StationActions.loadStations(res.data.house); - } + ref = res.data.reader, gys = ref.gys, nis = ref.nis; + return StationActions.loadGlyphs(gys); }); }, - listenStation: function(station, arg1) { - var cabal, glyph, group, k, path, types; - group = arg1.group, glyph = arg1.glyph, cabal = arg1.cabal; + listenStation: function(station) { + var path; if (subscribed[station] == null) { subscribed[station] = {}; } - types = { - a_group: group, - v_glyph: glyph, - x_cabal: cabal - }; - for (k in types) { - if (subscribed[station][k]) { - delete types[k]; - } else { - subscribed[station][k] = types[k]; - } - } - if (_.isEmpty(types)) { - return; - } - path = util.talkPath(types, station); + path = util.talkPath('circle', station, 'config-l', 'group-r', '0'); return window.urb.bind(path, function(err, res) { - var ok, ref; + var config, cos, pes, ref, status; if (err || !res) { console.log(path, 'err'); console.log(err); return; } - console.log(path); - console.log(res.data); - ref = res.data, ok = ref.ok, group = ref.group, cabal = ref.cabal, glyph = ref.glyph; + ref = res.data.circle, cos = ref.cos, pes = ref.pes, config = ref.config, status = ref.status; + if (res.data.ok) { + StationActions.listeningStation(station); + } switch (false) { - case !ok: - return StationActions.listeningStation(station); - case !group: - group.global[util.mainStationPath(window.urb.user)] = group.local; - return StationActions.loadMembers(group.global); - case !(cabal != null ? cabal.loc : void 0): - return StationActions.loadConfig(station, cabal.loc); - case !glyph: - return StationActions.loadGlyphs(glyph); + case !cos: + return StationActions.loadConfig(station, cos.loc); + case !pes: + return StationActions.loadMembers(station, pes.loc); + case !config: + if (config.dif.source != null) { + if (config.dif.source.add) { + return StationActions.addStation(config.dif.source.src); + } else { + return StationActions.remStation(config.dif.source.src); + } + } + break; + case !status: + break; } }); } @@ -1865,14 +1780,13 @@ MessageStore = _.merge(new EventEmitter, { } }, convertDate: function(time) { - var date, t; + var d; time = time.substr(1).split("."); time[1] = this.leadingZero(time[1]); time[2] = this.leadingZero(time[2]); - t = time; - date = new moment(t[0] + "-" + t[1] + "-" + t[2] + "T" + t[4] + ":" + t[5] + ":" + t[6] + "Z"); - date.tz("Europe/London"); - return date; + d = new moment(time[0] + "-" + time[1] + "-" + time[2] + "T" + time[4] + ":" + time[5] + ":" + time[6] + "Z"); + d.tz("Europe/London"); + return d; }, getListening: function() { return _listening; @@ -1885,12 +1799,10 @@ MessageStore = _.merge(new EventEmitter, { if (_.keys(_messages).length === 0) { return []; } - messages = _.sortBy(_messages, function(arg) { - var time; - time = arg.thought.statement.time; - return time; + messages = _.sortBy(_messages, function(_message) { + return _message.wen; }); - return _.keys(messages[messages.length - 1].thought.audience); + return messages[messages.length - 1].aud; }, setTyping: function(state) { return _typing = state; @@ -1915,19 +1827,23 @@ MessageStore = _.merge(new EventEmitter, { return _filter = null; }, sendMessage: function(message) { - return _messages[message.thought.serial] = message; + return _messages[message.uid] = message; }, - loadMessages: function(messages, last, get) { - var i, key, len, serial, v; - key = last; + loadMessages: function(messages, get) { + var i, len, max, serial, v; + max = 0; for (i = 0, len = messages.length; i < len; i++) { v = messages[i]; - serial = v.thought.serial; - v.key = key++; + v.gam.key = v.num; + if (v.num > max) { + max = v.num; + } + v = v.gam || v; + serial = v.uid; _messages[serial] = v; } - if (last < _last || _last === null || get === true) { - _last = last; + if (max < _last || _last === null || get === true) { + _last = max; } return _fetching = false; }, @@ -1938,13 +1854,7 @@ MessageStore = _.merge(new EventEmitter, { return mess; } else { return _.filter(mess, function(mess) { - var audi; - audi = _.keys(mess.thought.audience); - if (audi.indexOf(_filter) !== -1) { - return true; - } else { - return false; - } + return mess.aud.indexOf(_filter) !== -1; }); } }, @@ -2006,7 +1916,7 @@ MessageStore.dispatchToken = MessageDispatcher.register(function(payload) { module.exports = MessageStore; -},{"../dispatcher/Dispatcher.coffee":9,"events":18}],14:[function(require,module,exports){ +},{"../dispatcher/Dispatcher.coffee":9,"events":17}],14:[function(require,module,exports){ var EventEmitter, StationDispatcher, StationStore, _audience, _config, _glyphs, _listening, _members, _shpylg, _station, _stations, _typing, _validAudience; EventEmitter = require('events').EventEmitter; @@ -2089,11 +1999,11 @@ StationStore = _.merge(new EventEmitter, { ship: ship }; }, - loadMembers: function(members) { - return _members = members; + loadMembers: function(station, members) { + return _members[station] = members; }, - getMembers: function() { - return _members; + getMembers: function(station) { + return _members[station]; }, getListening: function() { return _listening; @@ -2110,6 +2020,13 @@ StationStore = _.merge(new EventEmitter, { return _stations.push(station); } }, + removeStation: function(station) { + var i; + i = _stations.indexOf(station); + if (i > -1) { + return _stations.splice(i, 1); + } + }, loadStations: function(stations) { return _stations = stations; }, @@ -2121,10 +2038,10 @@ StationStore = _.merge(new EventEmitter, { for (char in glyphs) { auds = glyphs[char]; results.push((function() { - var i, len, results1; + var j, len, results1; results1 = []; - for (i = 0, len = auds.length; i < len; i++) { - aud = auds[i]; + for (j = 0, len = auds.length; j < len; j++) { + aud = auds[j]; results1.push(_shpylg[aud.join(" ")] = char); } return results1; @@ -2216,6 +2133,10 @@ StationStore.dispatchToken = StationDispatcher.register(function(payload) { StationStore.createStation(action.station); StationStore.emitChange(); break; + case "station-remove": + StationStore.removeStation(action.station); + StationStore.emitChange(); + break; case "members-load": StationStore.loadMembers(action.members); StationStore.emitChange(); @@ -2230,7 +2151,7 @@ StationStore.dispatchToken = StationDispatcher.register(function(payload) { module.exports = StationStore; -},{"../dispatcher/Dispatcher.coffee":9,"events":18}],15:[function(require,module,exports){ +},{"../dispatcher/Dispatcher.coffee":9,"events":17}],15:[function(require,module,exports){ var util, slice = [].slice; @@ -2239,34 +2160,20 @@ module.exports = util = { var station; if (document.location.search) { station = document.location.search.replace(/^\?/, ''); - if (station.indexOf('dbg.') !== -1) { + if (station.indexOf('dbg.nopack') !== -1) { return station = util.mainStation(); } } else { return util.mainStation(); } }, - mainStations: ["court", "floor", "porch"], mainStationPath: function(user) { if (user) { - return "~" + user + "/" + (util.mainStation(user)); + return "~" + user + "/inbox"; } }, mainStation: function(user) { - if (!user) { - user = window.urb.user; - } - if (!user) { - return; - } - switch (user.length) { - case 3: - return "court"; - case 6: - return "floor"; - default: - return "porch"; - } + return "inbox"; }, clipAudi: function(audi) { var ms, regx; @@ -2350,25 +2257,9 @@ module.exports = util = { return $(window).scrollTop() + $('.writing').outerHeight() < util.writingPosition; }, talkPath: function() { - var components, encodedTypes, key, types, val; - types = arguments[0], components = 2 <= arguments.length ? slice.call(arguments, 1) : []; - encodedTypes = ((function() { - var results; - results = []; - for (key in types) { - val = types[key]; - if (key !== 'a_group' && key !== 'f_grams' && key !== 'v_glyph' && key !== 'x_cabal') { - throw new Error("Weird type: '" + key + "'"); - } - if (val) { - results.push(key[0]); - } else { - results.push(void 0); - } - } - return results; - })()).join(''); - return ['', encodedTypes].concat(slice.call(components)).join('/'); + var components; + components = 1 <= arguments.length ? slice.call(arguments, 0) : []; + return [''].concat(slice.call(components)).join('/'); } }; @@ -2424,390 +2315,6 @@ module.exports = util = { }()); },{}],17:[function(require,module,exports){ -// Generated by CoffeeScript 1.9.3 -(function() { - var L_to_Y, Y_to_L, conv, distanceFromPole, dotProduct, epsilon, fromLinear, getBounds, intersectLineLine, kappa, lengthOfRayUntilIntersect, m, m_inv, maxChromaForLH, maxSafeChromaForL, refU, refV, root, toLinear; - - m = { - R: [3.2409699419045214, -1.5373831775700935, -0.49861076029300328], - G: [-0.96924363628087983, 1.8759675015077207, 0.041555057407175613], - B: [0.055630079696993609, -0.20397695888897657, 1.0569715142428786] - }; - - m_inv = { - X: [0.41239079926595948, 0.35758433938387796, 0.18048078840183429], - Y: [0.21263900587151036, 0.71516867876775593, 0.072192315360733715], - Z: [0.019330818715591851, 0.11919477979462599, 0.95053215224966058] - }; - - refU = 0.19783000664283681; - - refV = 0.468319994938791; - - kappa = 903.2962962962963; - - epsilon = 0.0088564516790356308; - - getBounds = function(L) { - var bottom, channel, j, k, len1, len2, m1, m2, m3, ref, ref1, ref2, ret, sub1, sub2, t, top1, top2; - sub1 = Math.pow(L + 16, 3) / 1560896; - sub2 = sub1 > epsilon ? sub1 : L / kappa; - ret = []; - ref = ['R', 'G', 'B']; - for (j = 0, len1 = ref.length; j < len1; j++) { - channel = ref[j]; - ref1 = m[channel], m1 = ref1[0], m2 = ref1[1], m3 = ref1[2]; - ref2 = [0, 1]; - for (k = 0, len2 = ref2.length; k < len2; k++) { - t = ref2[k]; - top1 = (284517 * m1 - 94839 * m3) * sub2; - top2 = (838422 * m3 + 769860 * m2 + 731718 * m1) * L * sub2 - 769860 * t * L; - bottom = (632260 * m3 - 126452 * m2) * sub2 + 126452 * t; - ret.push([top1 / bottom, top2 / bottom]); - } - } - return ret; - }; - - intersectLineLine = function(line1, line2) { - return (line1[1] - line2[1]) / (line2[0] - line1[0]); - }; - - distanceFromPole = function(point) { - return Math.sqrt(Math.pow(point[0], 2) + Math.pow(point[1], 2)); - }; - - lengthOfRayUntilIntersect = function(theta, line) { - var b1, len, m1; - m1 = line[0], b1 = line[1]; - len = b1 / (Math.sin(theta) - m1 * Math.cos(theta)); - if (len < 0) { - return null; - } - return len; - }; - - maxSafeChromaForL = function(L) { - var b1, j, len1, lengths, m1, ref, ref1, x; - lengths = []; - ref = getBounds(L); - for (j = 0, len1 = ref.length; j < len1; j++) { - ref1 = ref[j], m1 = ref1[0], b1 = ref1[1]; - x = intersectLineLine([m1, b1], [-1 / m1, 0]); - lengths.push(distanceFromPole([x, b1 + x * m1])); - } - return Math.min.apply(Math, lengths); - }; - - maxChromaForLH = function(L, H) { - var hrad, j, l, len1, lengths, line, ref; - hrad = H / 360 * Math.PI * 2; - lengths = []; - ref = getBounds(L); - for (j = 0, len1 = ref.length; j < len1; j++) { - line = ref[j]; - l = lengthOfRayUntilIntersect(hrad, line); - if (l !== null) { - lengths.push(l); - } - } - return Math.min.apply(Math, lengths); - }; - - dotProduct = function(a, b) { - var i, j, ref, ret; - ret = 0; - for (i = j = 0, ref = a.length - 1; 0 <= ref ? j <= ref : j >= ref; i = 0 <= ref ? ++j : --j) { - ret += a[i] * b[i]; - } - return ret; - }; - - fromLinear = function(c) { - if (c <= 0.0031308) { - return 12.92 * c; - } else { - return 1.055 * Math.pow(c, 1 / 2.4) - 0.055; - } - }; - - toLinear = function(c) { - var a; - a = 0.055; - if (c > 0.04045) { - return Math.pow((c + a) / (1 + a), 2.4); - } else { - return c / 12.92; - } - }; - - conv = { - 'xyz': {}, - 'luv': {}, - 'lch': {}, - 'husl': {}, - 'huslp': {}, - 'rgb': {}, - 'hex': {} - }; - - conv.xyz.rgb = function(tuple) { - var B, G, R; - R = fromLinear(dotProduct(m.R, tuple)); - G = fromLinear(dotProduct(m.G, tuple)); - B = fromLinear(dotProduct(m.B, tuple)); - return [R, G, B]; - }; - - conv.rgb.xyz = function(tuple) { - var B, G, R, X, Y, Z, rgbl; - R = tuple[0], G = tuple[1], B = tuple[2]; - rgbl = [toLinear(R), toLinear(G), toLinear(B)]; - X = dotProduct(m_inv.X, rgbl); - Y = dotProduct(m_inv.Y, rgbl); - Z = dotProduct(m_inv.Z, rgbl); - return [X, Y, Z]; - }; - - Y_to_L = function(Y) { - if (Y <= epsilon) { - return Y * kappa; - } else { - return 116 * Math.pow(Y, 1 / 3) - 16; - } - }; - - L_to_Y = function(L) { - if (L <= 8) { - return L / kappa; - } else { - return Math.pow((L + 16) / 116, 3); - } - }; - - conv.xyz.luv = function(tuple) { - var L, U, V, X, Y, Z, varU, varV; - X = tuple[0], Y = tuple[1], Z = tuple[2]; - if (Y === 0) { - return [0, 0, 0]; - } - L = Y_to_L(Y); - varU = (4 * X) / (X + (15 * Y) + (3 * Z)); - varV = (9 * Y) / (X + (15 * Y) + (3 * Z)); - U = 13 * L * (varU - refU); - V = 13 * L * (varV - refV); - return [L, U, V]; - }; - - conv.luv.xyz = function(tuple) { - var L, U, V, X, Y, Z, varU, varV; - L = tuple[0], U = tuple[1], V = tuple[2]; - if (L === 0) { - return [0, 0, 0]; - } - varU = U / (13 * L) + refU; - varV = V / (13 * L) + refV; - Y = L_to_Y(L); - X = 0 - (9 * Y * varU) / ((varU - 4) * varV - varU * varV); - Z = (9 * Y - (15 * varV * Y) - (varV * X)) / (3 * varV); - return [X, Y, Z]; - }; - - conv.luv.lch = function(tuple) { - var C, H, Hrad, L, U, V; - L = tuple[0], U = tuple[1], V = tuple[2]; - C = Math.sqrt(Math.pow(U, 2) + Math.pow(V, 2)); - if (C < 0.00000001) { - H = 0; - } else { - Hrad = Math.atan2(V, U); - H = Hrad * 360 / 2 / Math.PI; - if (H < 0) { - H = 360 + H; - } - } - return [L, C, H]; - }; - - conv.lch.luv = function(tuple) { - var C, H, Hrad, L, U, V; - L = tuple[0], C = tuple[1], H = tuple[2]; - Hrad = H / 360 * 2 * Math.PI; - U = Math.cos(Hrad) * C; - V = Math.sin(Hrad) * C; - return [L, U, V]; - }; - - conv.husl.lch = function(tuple) { - var C, H, L, S, max; - H = tuple[0], S = tuple[1], L = tuple[2]; - if (L > 99.9999999 || L < 0.00000001) { - C = 0; - } else { - max = maxChromaForLH(L, H); - C = max / 100 * S; - } - return [L, C, H]; - }; - - conv.lch.husl = function(tuple) { - var C, H, L, S, max; - L = tuple[0], C = tuple[1], H = tuple[2]; - if (L > 99.9999999 || L < 0.00000001) { - S = 0; - } else { - max = maxChromaForLH(L, H); - S = C / max * 100; - } - return [H, S, L]; - }; - - conv.huslp.lch = function(tuple) { - var C, H, L, S, max; - H = tuple[0], S = tuple[1], L = tuple[2]; - if (L > 99.9999999 || L < 0.00000001) { - C = 0; - } else { - max = maxSafeChromaForL(L); - C = max / 100 * S; - } - return [L, C, H]; - }; - - conv.lch.huslp = function(tuple) { - var C, H, L, S, max; - L = tuple[0], C = tuple[1], H = tuple[2]; - if (L > 99.9999999 || L < 0.00000001) { - S = 0; - } else { - max = maxSafeChromaForL(L); - S = C / max * 100; - } - return [H, S, L]; - }; - - conv.rgb.hex = function(tuple) { - var ch, hex, j, len1; - hex = "#"; - for (j = 0, len1 = tuple.length; j < len1; j++) { - ch = tuple[j]; - ch = Math.round(ch * 1e6) / 1e6; - if (ch < 0 || ch > 1) { - throw new Error("Illegal rgb value: " + ch); - } - ch = Math.round(ch * 255).toString(16); - if (ch.length === 1) { - ch = "0" + ch; - } - hex += ch; - } - return hex; - }; - - conv.hex.rgb = function(hex) { - var b, g, j, len1, n, r, ref, results; - if (hex.charAt(0) === "#") { - hex = hex.substring(1, 7); - } - r = hex.substring(0, 2); - g = hex.substring(2, 4); - b = hex.substring(4, 6); - ref = [r, g, b]; - results = []; - for (j = 0, len1 = ref.length; j < len1; j++) { - n = ref[j]; - results.push(parseInt(n, 16) / 255); - } - return results; - }; - - conv.lch.rgb = function(tuple) { - return conv.xyz.rgb(conv.luv.xyz(conv.lch.luv(tuple))); - }; - - conv.rgb.lch = function(tuple) { - return conv.luv.lch(conv.xyz.luv(conv.rgb.xyz(tuple))); - }; - - conv.husl.rgb = function(tuple) { - return conv.lch.rgb(conv.husl.lch(tuple)); - }; - - conv.rgb.husl = function(tuple) { - return conv.lch.husl(conv.rgb.lch(tuple)); - }; - - conv.huslp.rgb = function(tuple) { - return conv.lch.rgb(conv.huslp.lch(tuple)); - }; - - conv.rgb.huslp = function(tuple) { - return conv.lch.huslp(conv.rgb.lch(tuple)); - }; - - root = {}; - - root.fromRGB = function(R, G, B) { - return conv.rgb.husl([R, G, B]); - }; - - root.fromHex = function(hex) { - return conv.rgb.husl(conv.hex.rgb(hex)); - }; - - root.toRGB = function(H, S, L) { - return conv.husl.rgb([H, S, L]); - }; - - root.toHex = function(H, S, L) { - return conv.rgb.hex(conv.husl.rgb([H, S, L])); - }; - - root.p = {}; - - root.p.toRGB = function(H, S, L) { - return conv.xyz.rgb(conv.luv.xyz(conv.lch.luv(conv.huslp.lch([H, S, L])))); - }; - - root.p.toHex = function(H, S, L) { - return conv.rgb.hex(conv.xyz.rgb(conv.luv.xyz(conv.lch.luv(conv.huslp.lch([H, S, L]))))); - }; - - root.p.fromRGB = function(R, G, B) { - return conv.lch.huslp(conv.luv.lch(conv.xyz.luv(conv.rgb.xyz([R, G, B])))); - }; - - root.p.fromHex = function(hex) { - return conv.lch.huslp(conv.luv.lch(conv.xyz.luv(conv.rgb.xyz(conv.hex.rgb(hex))))); - }; - - root._conv = conv; - - root._getBounds = getBounds; - - root._maxChromaForLH = maxChromaForLH; - - root._maxSafeChromaForL = maxSafeChromaForL; - - if (!((typeof module !== "undefined" && module !== null) || (typeof jQuery !== "undefined" && jQuery !== null) || (typeof requirejs !== "undefined" && requirejs !== null))) { - this.HUSL = root; - } - - if (typeof module !== "undefined" && module !== null) { - module.exports = root; - } - - if (typeof jQuery !== "undefined" && jQuery !== null) { - jQuery.husl = root; - } - - if ((typeof requirejs !== "undefined" && requirejs !== null) && (typeof define !== "undefined" && define !== null)) { - define(root); - } - -}).call(this); - -},{}],18:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -2867,8 +2374,12 @@ EventEmitter.prototype.emit = function(type) { er = arguments[1]; if (er instanceof Error) { throw er; // Unhandled 'error' event + } else { + // At least give some kind of context to the user + var err = new Error('Uncaught, unspecified "error" event. (' + er + ')'); + err.context = er; + throw err; } - throw TypeError('Uncaught, unspecified "error" event.'); } } @@ -3107,4 +2618,15 @@ function isUndefined(arg) { return arg === void 0; } +},{}],18:[function(require,module,exports){ +(function(){function b(){}function h(){}function n(){}function k(){}function f(){}function e(a){return function(b,c,l){return a([b,c,l])}}f.j=function(a){a=a.charCodeAt(1);if(a==a)return a};f.substr=function(a,b,c){if(null==c)c=a.length;else if(0>c)if(0==b)c=a.length+c;else return"";return a.substr(b,c)};k.parseInt=function(a){var b=parseInt(a,10);0!=b||120!=f.j(a)&&88!=f.j(a)||(b=parseInt(a));return isNaN(b)?null:b};n.L=function(a){for(var b="";b="0123456789ABCDEF".charAt(a&15)+b,a>>>=4,0 +b.length;)b="0"+b;return b};h.K=function(a){return Math.abs(a.v)/Math.sqrt(Math.pow(a.J,2)+1)};h.X=function(a,b){return b.v/(Math.sin(a)-b.J*Math.cos(a))};b.m=function(a){for(var d=[],c=Math.pow(a+16,3)/1560896,c=c>b.l?c:a/b.g,l=0;3>l;)for(var g=l++,p=b.b[g][0],f=b.b[g][1],g=b.b[g][2],e=0;2>e;){var h=e++,k=(632260*g-126452*f)*c+126452*h;d.push({J:(284517*p-94839*g)*c/k,v:((838422*g+769860*f+731718*p)*a*c-769860*h*a)/k})}return d};b.B=function(a){a=b.m(a);for(var d=1.7976931348623157E308,c=0;2>c;)d= +Math.min(d,h.K(a[c++]));return d};b.A=function(a,d){for(var c=d/360*Math.PI*2,l=b.m(a),g=1.7976931348623157E308,f=0;f=a?12.92*a:1.055*Math.pow(a,.4166666666666667)-.055};b.i=function(a){return.04045=a?b.c*a/b.g:b.c*Math.pow((a+16)/116,3)};b.aa=function(a){var d=a[0],c=a[1];a=d+15*c+3*a[2];0!=a?(d=4*d/a,a=9*c/a):a=d=NaN;c=b.ca(c);return 0==c?[0,0,0]:[c,13*c*(d-b.C),13*c*(a-b.D)]};b.Z=function(a){var d=a[0];if(0==d)return[0,0,0];var c=a[1]/(13*d)+b.C;a=a[2]/(13*d)+b.D;d=b.T(d);c=0- +9*d*c/((c-4)*a-c*a);return[c,d,(9*d-15*a*d-a*c)/(3*a)]};b.Y=function(a){var b=a[0],c=a[1],e=a[2];a=Math.sqrt(c*c+e*e);1E-8>a?c=0:(c=180*Math.atan2(e,c)/3.141592653589793,0>c&&(c=360+c));return[b,a,c]};b.W=function(a){var b=a[1],c=a[2]/360*2*Math.PI;return[a[0],Math.cos(c)*b,Math.sin(c)*b]};b.P=function(a){var d=a[0],c=a[1];a=a[2];return 99.9999999a?[0,0,d]:[a,b.A(a,d)/100*c,d]};b.U=function(a){var d=a[0],c=a[2];return 99.9999999d?[c,0,0]:[c,a[1]/b.A(d,c)*100,d]}; +b.S=function(a){var d=a[0],c=a[1];a=a[2];return 99.9999999a?[0,0,d]:[a,b.B(a)/100*c,d]};b.V=function(a){var d=a[0],c=a[2];return 99.9999999d?[c,0,0]:[c,a[1]/b.B(d)*100,d]};b.F=function(a){for(var b="#",c=0,e=a.length;c Date: Tue, 7 Nov 2017 22:37:32 +0100 Subject: [PATCH 244/303] %hall and %talk now start on boot. --- lib/drum.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/drum.hoon b/lib/drum.hoon index 8c27ee3789..4a054f7bd1 100644 --- a/lib/drum.hoon +++ b/lib/drum.hoon @@ -79,10 +79,10 @@ ^- (list well:gall) =+ myr=(clan:title our) ?: ?=($pawn myr) - [[%base %talk] [%base %dojo] ~] + [[%base %hall] [%base %talk] [%base %dojo] ~] ?: ?=($earl myr) [[%home %dojo] ~] - [[%home %talk] [%home %dojo] ~] + [[%home %hall] [%home %talk] [%home %dojo] ~] :: ++ deft-fish :: default connects |= our/ship From 698e7386a0883046c53bfaedd79cf6ede5e67d86 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 8 Nov 2017 17:11:59 +0100 Subject: [PATCH 245/303] Temporarily worked around runtime errors in hall that occur when federation happens. --- app/hall.hoon | 108 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 77 insertions(+), 31 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index dc9916b6d7..3eed044744 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -543,10 +543,23 @@ ~&([%ignoring-prize -.piz] +>) :: $burden - %+ roll ~(tap by sos.piz) - |= {{n/naem b/burden} _..ta-take} - =< so-done - (~(so-bear so n ~ (fall (~(get by stories) n) *story)) b) + =+ sos=~(tap by sos.piz) + |- ^+ ..ta-take + ?~ sos ..ta-take + =. ..ta-take + =+ (fall (~(get 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 ost.bol i.acs) + $(acs t.acs) + $(sos t.sos) + ::TODO runtime error + ::%+ roll ~(tap by sos.piz) + ::|= {{n/naem b/burden} _..ta-take} + ::=+ (fall (~(get by stories) n) *story) + ::so-done:(~(so-bear so n ~ -) b) :: $circle =+ wer=(etch wir) @@ -572,9 +585,18 @@ (so-hear:sor & [our.bol nom.rum] rum.rum) :: $new - =< so-done - %- ~(so-bear so nom.rum ~ (fall (~(get by stories) nom.rum) *story)) - [~ [cof.rum.rum ~] [~ ~]] + => =+ (fall (~(get by stories) nom.rum) *story) + %- ~(so-bear so nom.rum ~ -) + [~ [cof.rum.rum ~] [~ ~]] + =. acs (flop acs) + |- ^+ +>+ + ?~ acs +>+ + =. +>+ (ta-action ost.bol i.acs) + $(acs t.acs) + ::TODO runtime error + ::=< so-done + ::%- ~(so-bear so nom.rum ~ (fall (~(get by stories) nom.rum) *story)) + ::[~ [cof.rum.rum ~] [~ ~]] == :: $circle @@ -829,10 +851,18 @@ (so-delta-our %config r %full c) :: local status =. self - %+ roll ~(tap by loc.pes) - |= {{w/ship s/status} _self} - (so-delta-our %status so-cir w %full s) - ::TODO ^ runtime when accepting burden + =+ sas=~(tap by loc.pes) + |- ^+ self + ?~ sas self + =. deltas + :_ deltas + :^ %story nom %status + [[our.bol nom] p.i.sas %full q.i.sas] + $(sas t.sas) + ::TODO ideally do below, but runtime error at so-delta-our + ::%+ roll ~(tap by loc.pes) + ::|= {{w/ship s/status} _self} + ::(so-delta-our %status so-cir w %full s) :: remote status =. self %+ roll ~(tap by rem.pes) @@ -842,17 +872,34 @@ (so-delta-our %status c w %full s) :: telegrams =. self - %- so-deltas-our - %+ turn gaz - |= t/telegram - ^- delta-story - :- %gram - :: in audience, replace above with us. - =- t(aud -) - =+ (~(del in aud.t) [(above our.bol) nom]) - (~(put in -) so-cir) + %_ self + deltas + %+ welp deltas + %- flop + %+ turn gaz + |= t/telegram + ^- delta + :+ %story nom + :- %gram + :: in audience, replace above with us. + =- t(aud -) + =+ (~(del in aud.t) [(above our.bol) nom]) + (~(put in -) so-cir) + == + ::TODO ideally do below, but runtime error + ::%- so-deltas-our + ::%+ turn gaz + ::|= t/telegram + ::^- delta-story + :::- %gram + :::: in audience, replace above with us. + ::=- t(aud -) + ::=+ (~(del in aud.t) [(above our.bol) nom]) + ::(~(put in -) so-cir) :: inherited flag - (so-delta-our %inherited &) + %_(self deltas [[%story nom %inherited &] deltas]) + ::TODO runtime error + ::(so-delta-our %inherited &) :: ::> || ::> || %changes @@ -2067,16 +2114,12 @@ |= {wir/wire piz/prize} ^- (quip move _+>) =^ mos +>.$ - :: this shouldn't be necessary, but see the TODO below. - ?: ?=($burden -.piz) - %- pre-bake - =< ta-done - %+ roll ~(tap by sos.piz) - |= {{n/naem b/burden} _ta} - =< so-done - (~(so-bear so n ~ (fall (~(get by stories) n) *story)) b) %- pre-bake - ta-done:(ta-take:ta wir piz) ::TODO runtime for %burden prize... + => (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) +>.$] @@ -2088,7 +2131,10 @@ ^- (quip move _+>) =^ mos +>.$ %- pre-bake - ta-done:(ta-hear:ta wir rum) + => (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) +>.$] From cf3e4eecb0451d950c09d0db997e9ed6d6892559 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 9 Nov 2017 18:25:26 +0100 Subject: [PATCH 246/303] Fixed some flaws in federation-related code. New circles can now propagate more than a single level down, changes get applied properly. --- app/hall.hoon | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index 3eed044744..8777223f31 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -585,6 +585,8 @@ (so-hear:sor & [our.bol nom.rum] rum.rum) :: $new + =? +> !(~(has by stories) nom.rum) + (ta-delta %story +.rum) => =+ (fall (~(get by stories) nom.rum) *story) %- ~(so-bear so nom.rum ~ -) [~ [cof.rum.rum ~] [~ ~]] @@ -846,9 +848,16 @@ (so-config-full `shape loc.cos) :: remote config =. self - %+ roll ~(tap by rem.cos) - |= {{r/circle c/config} _self} - (so-delta-our %config r %full c) + =+ rem=~(tap by rem.cos) + |- ^+ self + ?~ rem self + =. self + (so-delta-our %config p.i.rem %full q.i.rem) + $(rem t.rem) + ::TODO eats previous change? + ::%+ roll ~(tap by rem.cos) + ::|= {{r/circle c/config} _self} + ::(so-delta-our %config r %full c) :: local status =. self =+ sas=~(tap by loc.pes) @@ -865,11 +874,24 @@ ::(so-delta-our %status so-cir w %full s) :: remote status =. self - %+ roll ~(tap by rem.pes) - |= {{c/circle g/group} _self} - %+ roll ~(tap by g) - |= {{w/ship s/status} _self} - (so-delta-our %status c w %full s) + =+ rem=~(tap by rem.pes) + |- ^+ self + ?~ rem self + =. deltas + %+ welp deltas + =+ gop=~(tap by q.i.rem) + =| l/(list delta) + |- ^+ l + ?~ gop l + =. l [[%story nom %status p.i.rem p.i.gop %full q.i.gop] l] + $(gop t.gop) + $(rem t.rem) + :: + ::%+ roll ~(tap by rem.pes) + ::|= {{c/circle g/group} _self} + ::%+ roll ~(tap by g) + ::|= {{w/ship s/status} _self} + ::(so-delta-our %status c w %full s) ::TODO fixme :: telegrams =. self %_ self @@ -1943,7 +1965,7 @@ ?: =(src.bol (above our.bol)) ~ :: only send story reports about grams and status. ?. ?=($story -.det) ~ - ?. ?=(?($grams $status) -.det.det) ~ + ?. ?=(?($gram $status) -.det.det) ~ =+ soy=(~(got by stories) nom.det) :: and only if the story is inherited. ?. inherited.soy ~ From 664a97b0e80123c2ddc2b05aa5753c441f8eff55 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 9 Nov 2017 18:26:26 +0100 Subject: [PATCH 247/303] Added a %report prize so it no longer looks like the query's unavailable. --- app/hall.hoon | 4 +--- mar/hall/prize.hoon | 2 ++ sur/hall.hoon | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index 8777223f31..74bcf0dd52 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -1850,11 +1850,9 @@ [locals.s remotes.s] :: $report - ::REVIEW we just don't have a prize... but do have rumors. - :: or do we need [%report ~] ? ::TODO gall note: need to be able to subscirbe to just changes... or just :: data etc. - ~ + ``[%report ~] :: $circle ::REVIEW should we send precs & config to out of range subs? =+ soy=(~(get by stories) nom.qer) diff --git a/mar/hall/prize.hoon b/mar/hall/prize.hoon index 1aeb4431bd..6a389219e1 100644 --- a/mar/hall/prize.hoon +++ b/mar/hall/prize.hoon @@ -18,6 +18,7 @@ :~ reader+pire public+(as circ) :: burden not needed + :: report not needed circle+pack == -- @@ -32,6 +33,7 @@ $reader (pire +.piz) $public (sa cis.piz circ) :: burden not needed + :: report not needed $circle (pack +.piz) == -- diff --git a/sur/hall.hoon b/sur/hall.hoon index 0f96ed58a5..d14d02a37d 100644 --- a/sur/hall.hoon +++ b/sur/hall.hoon @@ -52,6 +52,7 @@ $% {$reader prize-reader} ::< /reader {$public cis/(set circle)} ::< /public {$burden sos/(map naem burden)} ::< /burden + {$report ~} ::< /report {$circle package} ::< /circle == :: ++ prize-reader :: From 3392f80ce3fbb38b66cc7c7dfb16d323ba53d9f5 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 9 Nov 2017 19:05:58 +0100 Subject: [PATCH 248/303] Can now also remove circle sources from within %talk. --- app/talk.hoon | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/talk.hoon b/app/talk.hoon index 7249ed1faa..cd2b178253 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -80,6 +80,7 @@ {$invite naem (set ship)} ::< give permission {$banish naem (set ship)} ::< deny permission {$source naem (map circle range)} ::< add source + {$unsource naem (map circle range)} ::< remove source :: personal metadata :: {$attend audience (unit presence)} ::< set our presence {$name audience human} ::< set our name @@ -700,6 +701,9 @@ :: ;~((glue ace) (perk %source ~) cire sorz) :: + ;~((glue ace) (perk %unsource ~) cire sorz) + ::TODO why do these nest-fail when doing perk with multiple? + :: :: personal metadata :: ;~ (glue ace) @@ -874,7 +878,8 @@ $filter (filter +.job) $invite (permit & +.job) $banish (permit | +.job) - $source (source +.job) + $source (source & +.job) + $unsource (source | +.job) :: personal metadata $attend (attend +.job) $name (name +.job) @@ -1055,9 +1060,9 @@ ++ source ::< %source ::> adds {pas} to {nom}'s src. :: - |= {nom/naem pos/(map circle range)} + |= {sub/? nom/naem pos/(map circle range)} ^+ ..sh-work - (sh-act %source nom & pos) + (sh-act %source nom sub pos) :: ::> || ::> || %personal-metadata From 12e954c35205d236ab1a3ae941fd3852297e3be9 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 9 Nov 2017 19:08:05 +0100 Subject: [PATCH 249/303] Fixed another problematic accumulator call. --- app/hall.hoon | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index 74bcf0dd52..143b5eb424 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -404,16 +404,29 @@ :: to remove them from {public} too. =? ..ta-action &(=(nom %inbox) !sub) ^+ ..ta-action - %- ~(rep in srs) - |= {src/source _..ta-action} - ^+ ..ta-action - :: delete from public if it's the last source. - =; last/? ?:(last (action-public | cir.src) ..ta-action) + =+ srs=~(tap in srs) + |- ^+ ..ta-action + ?~ srs ..ta-action + =; last/? + =? ..ta-action last + (action-public | cir.i.srs) + $(srs t.srs) %- ~(rep in src.shape:(~(got by stories) nom)) |= {s/source l/?} ?. l | - ?. =(cir.s cir.src) & - =(ran.s ran.src) + ?. =(cir.s cir.i.srs) & + =(ran.s ran.i.srs) + :: below eats state + ::%- ~(rep in srs) + ::|= {src/source _..ta-action} + ::^+ ..ta-action + :::: delete from public if it's the last source. + ::=; last/? ?:(last (action-public | cir.src) ..ta-action) + ::%- ~(rep in src.shape:(~(got by stories) nom)) + ::|= {s/source l/?} + ::?. l | + ::?. =(cir.s cir.src) & + ::=(ran.s ran.src) =+ soy=(~(get by stories) nom) ?~ soy (ta-evil (crip "no story {(trip nom)}")) From 1865c9df70964e666f71cc9f342d1ae33a233837 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 9 Nov 2017 19:08:30 +0100 Subject: [PATCH 250/303] Comments. --- app/hall.hoon | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index 143b5eb424..4dd79bde1a 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -335,7 +335,7 @@ (~(put ju m) hos.c nom.c) =? ..ta-action (~(has by cic) our.bol) %- ~(rep in (~(get ju cic) our.bol)) - |= {n/naem _ta} + |= {n/naem _ta} :: beware, urbit/arvo#447 (affect n %status [our.bol n] our.bol dif) =. cic (~(del by cic) our.bol) %- ta-deltas @@ -899,12 +899,12 @@ =. l [[%story nom %status p.i.rem p.i.gop %full q.i.gop] l] $(gop t.gop) $(rem t.rem) - :: + ::TODO below eats state? ::%+ roll ~(tap by rem.pes) ::|= {{c/circle g/group} _self} ::%+ roll ~(tap by g) ::|= {{w/ship s/status} _self} - ::(so-delta-our %status c w %full s) ::TODO fixme + ::(so-delta-our %status c w %full s) :: telegrams =. self %_ self From 0b5071843962ee6fb322fcb96341a880c444410b Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 9 Nov 2017 22:35:24 +0100 Subject: [PATCH 251/303] Removed outdated comments. --- app/hall.hoon | 7 +------ app/talk.hoon | 9 +++++---- lib/hall-json.hoon | 17 ----------------- 3 files changed, 6 insertions(+), 27 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index 4dd79bde1a..225f5f893c 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -2,15 +2,10 @@ :::: /app/hall/hoon :: :: :: :: :: :: -::TODO char57 comments as line comments when regarding code. -::TODO document what user-facing messages actually mean! ::TODO maybe have hall accept reactions as well, redirect them to readers. :: that way we can have foreign halls react to our requests! -::TODO document gate samples fully. -::TODO ::> to :> etc. :: -::TODO crash on pokes/peers we do not expect -::TODO ++poke-reset. first call: warning. second call: reset state. +::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" diff --git a/app/talk.hoon b/app/talk.hoon index cd2b178253..add46bbe78 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -5,16 +5,17 @@ ::TODO make sure glyphs only get bound when joins succeed :: ...this is a bit troublesome, because failed joins don't actually :: unsubscribe us. +:: ::TODO maybe keep track of received grams per circle, too? +:: ::TODO [type query] => [press tab to cycle search results, newest-first] :: => [escape to clear] :: -::TODO for delta model: -:: 3) split into delta creation and application, as with hall. +::TODO ;what without args :: -::> This reader implementation makes use of the mailbox +::> This reader implementation makes use of the %inbox ::> for all its subscriptions and messaging. All -::> rumors received are exclusively about the mailbox, +::> rumors received are exclusively about the %inbox, ::> since that's the only thing the reader ever ::> subscribes to. :: diff --git a/lib/hall-json.hoon b/lib/hall-json.hoon index d66332fdbb..06d7c45f0a 100644 --- a/lib/hall-json.hoon +++ b/lib/hall-json.hoon @@ -4,23 +4,6 @@ /- hall /+ old-zuse :: -::> proposed rules for sur-json conversion, adhered to below: -::> 1. to save the devs from having to learn multiple interfaces, try to match -::> the hoon structure as closely as possible, including attribute names. -::> 2. if these names are p/q/r, ~slightly more semantic naming is preferred~ -::> fix that in the sur file. -::> 2. when dealing with $%, the tag is the variable name. ie `{$x ...}` -> `x` -::> for tagged unions with one piece of data, `x` holds that value. -::> for tagged unions with multiple pieces of data, `x` is an object. -::> 3. lists and sets become arrays. maps become objects. -::> 4. stringify cells only when/in a way such that it benefits the majority of -::> foreseen usecases. -::> x. avoid dashes in json names. -::> x. for {$empty $~} fronds, use (frond 'empty' b+&). -::> x. for {$frond abc/(unit *)}, use (frond 'frond' (frond 'abc' (mabe abc))) -::> -::> q: should parsing be strict or forgiving? ie, accept "ship" and/or "~ship"? -:: |_ bol/bowl:gall ++ en-tape ::> sur to tape =, hall From 57f08f7d7292c788b973bbaea25511476ee5cda0 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 10 Nov 2017 00:01:50 +0100 Subject: [PATCH 252/303] Can now do ;what in talk without arguments to list all bound glyphs. --- app/talk.hoon | 47 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/app/talk.hoon b/app/talk.hoon index add46bbe78..265809d94f 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -93,7 +93,7 @@ :: displaying info :: {$number $@(@ud {@u @ud})} ::< relative/absolute {$who audience} ::< presence - {$what $@(char audience)} ::< show bound glyph + {$what (unit $@(char audience))} ::< show bound glyph :: ui settings :: {$bind char (unit audience)} ::< bind glyph {$unbind char (unit audience)} ::< unbind glyph @@ -737,7 +737,13 @@ :: ;~(plug (perk %who ~) ;~(pose ;~(pfix ace cirs) (easy ~))) :: - ;~((glue ace) (perk %what ~) ;~(pose cirs glyph)) + ;~ plug + (perk %what ~) + ;~ pose + ;~(pfix ace (cook some ;~(pose glyph cirs))) + (easy ~) + == + == :: ;~((glue ace) (perk %show ~) circ) :: @@ -1158,15 +1164,28 @@ ++ what ::< %what ::> prints binding details. goes both ways. :: - |= qur/$@(char audience) + |= qur/(unit $@(char audience)) ^+ ..sh-work ?^ qur - =+ cha=(~(get by bound) qur) - (sh-fact %txt ?~(cha "none" [u.cha]~)) - =+ pan=~(tap in (~(get ju binds) qur)) - ?: =(~ pan) (sh-fact %txt "~") - =< (sh-fact %mor (turn pan .)) - |=(a/audience [%txt ~(ar-prom ar a)]) + ?^ u.qur + =+ cha=(~(get by bound) u.qur) + (sh-fact %txt ?~(cha "none" [u.cha]~)) + =+ pan=~(tap in (~(get ju binds) 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) + == + %+ weld lis + ^- (list sole-effect) + %- ~(rep in aus) + |= {a/audience l/(list sole-effect)} + %+ weld l + ^- (list sole-effect) + [%txt [gyf ' ' ~(ar-phat ar a)]]~ :: ++ number ::< %number ::> finds selected message, expand it. @@ -1804,6 +1823,16 @@ =. . ar-deaf !?=($@($~ {* $~ $~}) aud) :: + ++ ar-phat ::< render full-size + ::> 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 targets ::> render all circles, ordered by relevance. :: From 65383f57090a7ab91b90c57b83a517f5bfe3146e Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 10 Nov 2017 00:04:07 +0100 Subject: [PATCH 253/303] Removed !: from hall and talk. --- app/hall.hoon | 2 +- app/talk.hoon | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index 225f5f893c..3c15bc04a5 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -19,7 +19,7 @@ /- hall ::< structures /+ hall, hall-legacy ::< libraries /= seed /~ !>(.) -!: +:: :::: :: =, hall diff --git a/app/talk.hoon b/app/talk.hoon index 265809d94f..284ed34af4 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -11,8 +11,6 @@ ::TODO [type query] => [press tab to cycle search results, newest-first] :: => [escape to clear] :: -::TODO ;what without args -:: ::> This reader implementation makes use of the %inbox ::> for all its subscriptions and messaging. All ::> rumors received are exclusively about the %inbox, @@ -23,7 +21,7 @@ /- hall, sole ::< structures /+ hall, sole ::< libraries /= seed /~ !>(.) -!: +:: :::: :: =, hall From 5dab28235a1b4ca863235d4ef7d1e213f7314d8d Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 10 Nov 2017 13:08:54 +0100 Subject: [PATCH 254/303] Moved =, in /lib/hall-json to the top level. --- lib/hall-json.hoon | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/hall-json.hoon b/lib/hall-json.hoon index 06d7c45f0a..5b0a1991eb 100644 --- a/lib/hall-json.hoon +++ b/lib/hall-json.hoon @@ -3,10 +3,10 @@ :: /- hall /+ old-zuse +=, hall :: |_ bol/bowl:gall ++ en-tape ::> sur to tape - =, hall |% ++ circ ::> circle |= a/circle @@ -27,7 +27,6 @@ -- :: ++ de-tape ::> tape to sur (parse) - =, hall |% ++ circ ::> circle ;~((glue fas) ;~(pfix sig fed:ag) urt:ab) @@ -58,7 +57,6 @@ -- :: ++ enjs ::> sur to json - =, hall =, enjs:format |% ::TODO these first few should probably make their way @@ -360,7 +358,6 @@ -- :: ++ dejs ::> json to sur - =, hall =, dejs-soft:format |% ::TODO these first few should maybe make their way From 98302245d6aa57a98fd216ac3cbdaeac2e1a2a70 Mon Sep 17 00:00:00 2001 From: Fang Date: Sat, 11 Nov 2017 22:11:45 +0100 Subject: [PATCH 255/303] Fixed rendering of %ire %url speeches to be slightly more consistent with regular %url. --- app/talk.hoon | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/talk.hoon b/app/talk.hoon index 284ed34af4..09c0c763d2 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -2067,7 +2067,11 @@ $url :_ ~ =+ ful=(apix:en-purl:html url.sep) - =+ pef=(weld (fall pre "") "/") + =+ pef=(fall pre "") + :: 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) From b1e79be3fd4212d329fb286b3d77229649682aaa Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 13 Nov 2017 16:00:22 +0100 Subject: [PATCH 256/303] Fixed bug that caused DMs to always render with the ; glyph. --- app/talk.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/talk.hoon b/app/talk.hoon index 09c0c763d2..6f8cda7050 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -2094,7 +2094,7 @@ =- (weld - (fall pre " ")) %~ ar-glyf ar ?: =(who our.bol) aud - (~(del in aud) [%& who %inbox]) + (~(del in aud) [who %inbox]) == =. wyd (sub wyd (lent pef)) =/ txt (tuba (trip msg.sep)) From f110edef79873e928b2e19df55f4dc0c3a7bb61d Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 13 Nov 2017 16:00:50 +0100 Subject: [PATCH 257/303] Can now also say "true"/"false" in place of "&"/"|" and "y"/"n". --- app/talk.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/talk.hoon b/app/talk.hoon index 6f8cda7050..6091ce9529 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -634,8 +634,8 @@ :: ++ lobe ::< y/n loob ;~ pose - (cold %& ;~(pose (jest 'y') (jest '&'))) - (cold %| ;~(pose (jest 'n') (jest '|'))) + (cold %& ;~(pose (jest 'y') (jest '&') (just 'true'))) + (cold %| ;~(pose (jest 'n') (jest '|') (just 'false'))) == :: ++ message ::< exp, lin or url msg From df53e1d6f85aa1e6d35b08423ab452784d1ea915 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 13 Nov 2017 16:27:36 +0100 Subject: [PATCH 258/303] Removed limitations on local nicknames. --- app/talk.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/talk.hoon b/app/talk.hoon index 6091ce9529..aa65b50325 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -656,7 +656,7 @@ %+ cook crip (plus ;~(less (jest '•') next)) :: - ++ nick (cook crip (stun [1 14] low)) ::< nickname + ++ nick (cook crip (plus next)) ::< nickname ++ glyph (mask "/\\\{( Date: Mon, 13 Nov 2017 19:41:42 +0100 Subject: [PATCH 259/303] Now also displays handles if there is no local nickname for a ship. (Only if ;set nicks) --- app/talk.hoon | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/app/talk.hoon b/app/talk.hoon index aa65b50325..1c39d3c615 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -1743,11 +1743,19 @@ ::> get nick for ship, or shortname if no nick. ::> left-pads with spaces. :: - |. ^- tape - =+ nym=(~(get by nicks) hos.one) - ?~ nym - (cr-curt |) - =+ raw=(scag 14 (trip u.nym)) + |= 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:(fall (~(get by u.gop) hos.one) *status) + ?~ nic (cr-curt |) + =+ raw=(scag 14 (trip u.nic)) =+ len=(sub 14 (lent raw)) (weld (reap len ' ') raw) :: @@ -1924,7 +1932,7 @@ :: render the author. =/ nom/tape ?: (~(has in sef) %nicks) - (~(cr-nick cr [who %inbox])) + (~(cr-nick cr [who %inbox]) aud) (~(cr-curt cr [who %inbox]) |) :: regular indent. =/ den/tape From e3c9ccb96842ade952165931b7807610f168c101 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 13 Nov 2017 22:25:05 +0100 Subject: [PATCH 260/303] Talk now renders a notification when someone's status changes. --- app/talk.hoon | 70 ++++++++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 32 deletions(-) diff --git a/app/talk.hoon b/app/talk.hoon index 1c39d3c615..f14306635f 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -340,15 +340,18 @@ == :: $status - %= +> + =+ rem=(fall (~(get by remotes) cir.rum) *group) + =+ cur=(fall (~(get 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 - =+ rem=(fall (~(get by remotes) cir.rum) *group) ?: ?=($remove -.dif.rum) (~(del by rem) who.rum) %+ ~(put by rem) who.rum - %+ change-status - (fall (~(get by rem) who.rum) *status) - dif.rum + (change-status cur dif.rum) == == :: @@ -1556,35 +1559,38 @@ ^- tape ['%' (trip pec.sat)] :: - ++ sh-show-precs ::< print group diff + ++ sh-show-status ::< print status diff ::> prints presence changes to the cli. :: - |= $: pre/tape - $= cul - $: old/(list (pair ship status)) - new/(list (pair ship status)) - cha/(list (pair ship status)) - == - == - ?: (~(has in settings.she) %quiet) - +>.$ - =. +>.$ - |- ^+ +>.^$ - ?~ old.cul +>.^$ - =. +>.^$ $(old.cul t.old.cul) - (sh-note (weld pre "bye {(scow %p p.i.old.cul)}")) - =. +>.$ - |- ^+ +>.^$ - ?~ new.cul +>.^$ - =. +>.^$ $(new.cul t.new.cul) - %- sh-note - (weld pre "met {(scow %p p.i.new.cul)} {(sh-scis q.i.new.cul)}") - =. +>.$ - |- ^+ +>.^$ - ?~ cha.cul +>.^$ - %- sh-note - (weld pre "set {(scow %p p.i.cha.cul)} {(sh-scis q.i.cha.cul)}") - +>.$ + |= {cir/circle who/ship cur/status dif/diff-status} + ^+ +> + ?: (~(has in settings.she) %quiet) +> + =. +> + %- sh-note + %+ weld "for " + (~(cr-show cr cir) ~) + %- sh-note + ?- -.dif + $full + "met {(scow %p who)} {(scow %tas pec.sat.dif)}" + :: + $presence + "set {(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-permits ::< show permits ::> prints invite/banish effects to the cli. From 40d570aaae50e9d177b846fe60d1bfb54b7632f3 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 13 Nov 2017 23:44:44 +0100 Subject: [PATCH 261/303] Talk now renders a notification when a circle's config changes. --- app/talk.hoon | 119 +++++++++++++++++++------------------------------- 1 file changed, 46 insertions(+), 73 deletions(-) diff --git a/app/talk.hoon b/app/talk.hoon index f14306635f..6c1d50fbc3 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -320,7 +320,12 @@ (ta-learn gam.nev.rum) :: $config - %= +> + =+ cur=(fall (~(get by mirrors) cir.rum) *config) + =. +>.$ + =< sh-done + %- ~(sh-show-config sh cli) + [cir.rum cur dif.rum] + %= +>.$ sources ?. ?& ?=($source -.dif.rum) =(cir.rum incir) @@ -334,9 +339,7 @@ mirrors ?: ?=($remove -.dif.rum) (~(del by mirrors) cir.rum) %+ ~(put by mirrors) cir.rum - %+ change-config - (fall (~(get by mirrors) cir.rum) *config) - dif.rum + (change-config cur dif.rum) == :: $status @@ -1592,79 +1595,49 @@ "bye {(scow %p who)}" == :: - ++ sh-show-permits ::< show permits - ::> prints invite/banish effects to the cli. - :: - |= {pre/tape sec/security old/(list ship) new/(list ship)} - =+ out=?:(?=(?($channel $mailbox) sec) "try " "cut ") - =+ inn=?:(?=(?($channel $mailbox) sec) "ban " "add ") - =. +>.$ - |- ^+ +>.^$ - ?~ old +>.^$ - =. +>.^$ $(old t.old) - (sh-note :(weld pre out " " (scow %p i.old))) - =. +>.$ - |- ^+ +>.^$ - ?~ new +>.^$ - =. +>.^$ $(new t.new) - (sh-note :(weld pre out " " (scow %p i.new))) - +>.$ - :: - ++ sh-show-sources ::< show sources - ::> prints subscription changes to the cli. - :: - |= {pre/tape old/(list source) new/(list source)} - ^+ +> - =. +>.$ - |- ^+ +>.^$ - ?~ old +>.^$ - =. +>.^$ $(old t.old) - (sh-note (weld pre "off {~(cr-full cr cir.i.old)}")) - =. +>.$ - |- ^+ +>.^$ - ?~ new +>.^$ - =. +>.^$ $(new t.new) - (sh-note (weld pre "hey {~(cr-full cr cir.i.new)}")) - +>.$ - :: ++ sh-show-config ::< show config ::> prints config changes to the cli. :: - |= {pre/tape laz/config loc/config} + |= {cir/circle cur/config dif/diff-config} ^+ +> - =. +>.$ - ?: =(cap.loc cap.laz) +>.$ - (sh-note :(weld pre "cap " (trip cap.loc))) - =. +>.$ - %+ sh-show-sources - (weld (trip inbox) ": ") - (sh-set-diff src.laz src.loc) - ?: !=(sec.con.loc sec.con.laz) - =. +>.$ (sh-note :(weld pre "but " (scow %tas sec.con.loc))) - %^ sh-show-permits - (weld (trip inbox) ": ") - sec.con.loc - [~ ~(tap in sis.con.loc)] - %^ sh-show-permits - (weld (trip inbox) ": ") - sec.con.loc - (sh-set-diff sis.con.laz sis.con.loc) - :: - ++ sh-config ::< do show config - ::> prints a circle's config changes to the cli. - :: - |= {cir/circle old/(unit config) new/(unit config)} - ^+ +> - :: new circle - ?~ old - :: ++sh-show-rempe will notice a new circle. - +> - :: removed circle - ?~ new - (sh-note (weld "rip " ~(cr-phat cr cir))) - %^ sh-show-config - (weld ~(cr-phat cr cir) ": ") - u.old u.new + ?: ?=($full -.dif) + (sh-note (weld "new " (~(cr-show cr cir) ~))) + ?: ?=($remove -.dif) + (sh-note (weld "rip " (~(cr-show cr cir) ~))) + =. +> + (sh-note (weld "for " (~(cr-show cr cir) ~))) + %- sh-note + ?- -.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, From ca61503876b2d7c12249adabd4411e8b080d624c Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 13 Nov 2017 23:45:55 +0100 Subject: [PATCH 262/303] Don't create a %permit delta if there is no change. --- app/hall.hoon | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/hall.hoon b/app/hall.hoon index 3c15bc04a5..443c18646b 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -1201,10 +1201,11 @@ =/ sus/(set ship) %. sis.con.shape ?:(add ~(dif in sis) ~(int in sis)) + ?~ sus +>.$ =. +>.$ %- so-act :- %phrase - %- ~(rep in sus) + %- ~(rep in `(set ship)`sus) |= {s/ship a/audience t/(list speech)} :- (~(put in a) [s %inbox]) [[%inv inv so-cir] t] From 89f73aced80fb973f1029c9ff2e5562566c0ebf5 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 14 Nov 2017 00:55:03 +0100 Subject: [PATCH 263/303] If we got changes from a /report, don't send those same changes back to them. --- app/hall.hoon | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/hall.hoon b/app/hall.hoon index 443c18646b..2c162b1fa4 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -38,6 +38,7 @@ 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) @@ -1960,7 +1961,7 @@ `det :: $burden - ::?: &(=(who.qer src.bol) did-they-send-a-burden) ~ + ?: &(=(who.qer src.bol) =(rir /(scot %p src.bol)/report)) ~ ?. ?=($story -.det) ~ ?: ?=(?($follow $inherited $sequent) -.det.det) ~ :: only burden channels for now. @@ -2158,6 +2159,14 @@ :: |= {wir/wire rum/rumor} ^- (quip move _+>) + ::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) From 9aa32d7de712dfed94e880c53a32ddc11310a9ff Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 14 Nov 2017 00:55:18 +0100 Subject: [PATCH 264/303] Subscriptions now get ended if we no longer know their story. --- app/hall.hoon | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/hall.hoon b/app/hall.hoon index 2c162b1fa4..3f99fdc454 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -2017,8 +2017,11 @@ ?~ rum ~ [b %diff %hall-rumor u.rum]~ ?. ?=($circle -.qer) ~ + =+ qit=[b %quit ~]~ + :: kill the subscription if we forgot the story. + ?. (~(has by stories) nom.qer) qit :: kill the subscription if it's past its range. - =- ?:(done:- [b %quit ~]~ ~) + =- ?:(done:- qit ~) %. ran.qer =- ~(so-in-range so:ta nom.qer ~ -) (~(got by stories) nom.qer) From de025889a313bf5d3f6d83d74e0583a83ec5ed2c Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 14 Nov 2017 00:56:04 +0100 Subject: [PATCH 265/303] Lightly tweaked status and config change notifications. Config notifications now also obey the %quiet flag. --- app/talk.hoon | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/talk.hoon b/app/talk.hoon index 6c1d50fbc3..58a708d84c 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -1570,15 +1570,15 @@ ?: (~(has in settings.she) %quiet) +> =. +> %- sh-note - %+ weld "for " + %+ weld " in " (~(cr-show cr cir) ~) %- sh-note ?- -.dif $full - "met {(scow %p who)} {(scow %tas pec.sat.dif)}" + "hey {(scow %p who)} {(scow %tas pec.sat.dif)}" :: $presence - "set {(scow %p who)} {(scow %tas pec.dif)}" + "see {(scow %p who)} {(scow %tas pec.dif)}" :: $human %+ weld "nom {(scow %p who)}" @@ -1600,12 +1600,13 @@ :: |= {cir/circle cur/config dif/diff-config} ^+ +> + ?: (~(has in settings.she) %quiet) +> ?: ?=($full -.dif) (sh-note (weld "new " (~(cr-show cr cir) ~))) ?: ?=($remove -.dif) (sh-note (weld "rip " (~(cr-show cr cir) ~))) =. +> - (sh-note (weld "for " (~(cr-show cr cir) ~))) + (sh-note (weld " in " (~(cr-show cr cir) ~))) %- sh-note ?- -.dif $source From 0cdbb33e1cf6d37bc2aaa0862ace2333517f96bd Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 14 Nov 2017 15:16:28 +0100 Subject: [PATCH 266/303] Fixed %app speeches to look identical to the way they do in old talk. --- app/talk.hoon | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/talk.hoon b/app/talk.hoon index 58a708d84c..fd45b7b15c 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -2030,9 +2030,10 @@ ::> renders just the most important data of the ::> message. if possible, these stay within a single ::> line. + ::TODO this should probably be redone someday. :: - ::> pre: line prefix - =| pre/(unit tape) + ::> pre: replace/append line prefix + =| pre/(unit (pair ? tape)) |= wyd/@ud ^- (list tape) ?- -.sep @@ -2050,12 +2051,12 @@ ~(ram re (snag 0 `(list tank)`res.sep)) :: $ire - $(sep sep.sep, pre `"^ ") + $(sep sep.sep, pre `[| "^ "]) :: $url :_ ~ =+ ful=(apix:en-purl:html url.sep) - =+ pef=(fall pre "") + =+ pef=q:(fall pre [p=| q=""]) :: clean up prefix if needed. =? pef =((scag 1 (flop pef)) " ") (scag (dec (lent pef)) pef) @@ -2078,8 +2079,9 @@ $lin :: glyph prefix =/ pef/tape + ?: &(?=(^ pre) p.u.pre) q.u.pre ?: pat.sep " " - =- (weld - (fall pre " ")) + =- (weld - q:(fall pre [p=| q=" "])) %~ ar-glyf ar ?: =(who our.bol) aud (~(del in aud) [who %inbox]) @@ -2106,7 +2108,7 @@ ~(cr-phat cr cir.sep) :: $app - $(sep sep.sep, pre `"[{(trip app.sep)}]:") + $(sep sep.sep, pre `[& "[{(trip app.sep)}]: "]) == -- :: From 0cece6a04cd471dcb58369222c377b9d4ede6a70 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 14 Nov 2017 15:32:42 +0100 Subject: [PATCH 267/303] Prevent decrement underflow when rendering messages with long prefixes on small terms. --- app/talk.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/talk.hoon b/app/talk.hoon index fd45b7b15c..4645aa083e 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -2086,7 +2086,7 @@ ?: =(who our.bol) aud (~(del in aud) [who %inbox]) == - =. wyd (sub wyd (lent pef)) + =. wyd (sub wyd (min (div wyd 2) (lent pef))) =/ txt (tuba (trip msg.sep)) |- ^- (list tape) ?~ txt ~ From aa35774190a9d478825e679096b331f84d0e3993 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 16 Nov 2017 00:48:56 +0100 Subject: [PATCH 268/303] Minor styling and cleanup. --- app/hall.hoon | 3 --- sur/hall.hoon | 20 ++++++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index 3f99fdc454..8db123df28 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -2,9 +2,6 @@ :::: /app/hall/hoon :: :: :: :: :: :: -::TODO maybe have hall accept reactions as well, redirect them to readers. -:: that way we can have foreign halls react to our requests! -:: ::TODO document gate samples fully. :: ::TODO for using moons as tmp identities for friends: stories may want to keep diff --git a/sur/hall.hoon b/sur/hall.hoon index d14d02a37d..09d656ed0d 100644 --- a/sur/hall.hoon +++ b/sur/hall.hoon @@ -28,7 +28,11 @@ {$public $~} ::< public memberships {$burden who/ship} ::TODO eventually, nom/naem. ::< duties to share {$report $~} ::< duty reports - {$circle nom/naem wat/(set circle-data) ran/range}::< story query + $: $circle ::> story query + nom/naem ::< circle name + wat/(set circle-data) ::< data to get + ran/range ::< query duration + == :: ::TODO in the future, we may want much more :: :: detailed querying abilities. :: == :: @@ -73,13 +77,13 @@ $: cos/lobby ::< loc & rem configs pes/crowd ::< loc & rem presences == :: -++ burden ::< full story state +++ burden ::> full story state $: gaz/(list telegram) ::TODO envelope? ::< all messages - shipment + shipment ::< metadata == :: ++ package ::< story state $: nes/(list envelope) ::< messages - shipment + shipment ::< metadata == :: ++ diff-glyph {bin/? gyf/char aud/audience} ::< un/bound glyph ++ diff-nick {who/ship nic/nick} ::< changed nickname @@ -178,10 +182,10 @@ == :: ++ control {sec/security sis/(set ship)} ::< access control ++ security ::> security mode - $? $channel ::< channel, blacklist - $village ::< village, whitelist - $journal ::< journal, author list - $mailbox ::< mailbox, our r, bl w + $? $channel ::< blacklist + $village ::< whitelist + $journal ::< pub r, whitelist w + $mailbox ::< our r, blacklist w == :: :: participant metadata. :: ::TODO think about naming more From b416535408b201466a11a7e4b41b0d8020a7b495 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 16 Nov 2017 00:56:33 +0100 Subject: [PATCH 269/303] Renamed "reader" to "client". More immediately obvious terminology. --- app/hall.hoon | 20 ++++++++++---------- app/talk.hoon | 38 +++++++++++++++++++------------------- sur/hall.hoon | 20 ++++++++++---------- 3 files changed, 39 insertions(+), 39 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index 8db123df28..74ac1a4eae 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -28,7 +28,7 @@ |% ::> || %state :: ::> state data structures :: - ++ state ::> broker state + ++ state ::> application state $: stories/(map naem story) ::< conversations outbox/(map serial tracking) ::< sent messages log/(map naem @ud) ::< logged to clay @@ -261,8 +261,8 @@ :_ l [%story n %status [our.bol n] who dif] :: - ++ ta-action ::< apply reader action - ::> performs action sent by a reader. + ++ ta-action ::< apply client action + ::> performs action sent by a client. :: |= {red/bone act/action} ^+ +> @@ -1836,8 +1836,8 @@ |= qer/query ^- (unit (unit prize)) ?- -.qer - $reader - ``[%reader binds nicks] + $client + ``[%client binds nicks] :: $public ``[%public public] @@ -1946,11 +1946,11 @@ |= {qer/query det/delta} ^- (unit rumor) ?- -.qer - $reader + $client :: changes to shared ui state apply. ?+ -.det ~ - $glyph `[%reader det] - $nick `[%reader det] + $glyph `[%client det] + $nick `[%client det] == :: $public @@ -2069,7 +2069,7 @@ ^- $-((list coin) query) => depa |^ %- af :~ - [%reader ul] + [%client ul] [%public ul] [%burden (at /[%p])] [%report ul] @@ -2086,7 +2086,7 @@ |= {who/ship qer/query} ^- ? ?- -.qer - $reader (team:title our.bol who) + $client (team:title our.bol who) $public & $burden ?& =(who who.qer) =(our.bol (above who)) diff --git a/app/talk.hoon b/app/talk.hoon index 4645aa083e..a433df559e 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -11,10 +11,10 @@ ::TODO [type query] => [press tab to cycle search results, newest-first] :: => [escape to clear] :: -::> This reader implementation makes use of the %inbox +::> 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 reader ever +::> since that's the only thing the client ever ::> subscribes to. :: /? 151 ::< hoon version @@ -32,7 +32,7 @@ ::> data structures :: |% - ++ state ::> reader state + ++ state ::> application state $: :: messaging state :: count/@ud ::< (lent grams) grams/(list telegram) ::< all history @@ -129,18 +129,18 @@ ::> small utility functions. ::+| :: -++ broker ::< broker ship + name +++ server ::< our hall instance ^- dock :_ %hall (true-self our.bol) :: -++ inbox ::< reader's circle name +++ inbox ::< client's circle name ::> produces the name of the circle used by this - ::> reader for all its operations + ::> client for all its operations ^- naem %inbox :: -++ incir ::< reader's circle +++ incir ::< client's circle ::> ++inbox, except a full circle. ^- circle :_ inbox @@ -218,7 +218,7 @@ `[%mor (flop q.yop)] ::< more sole-effects :: produce moves or sole-effects and moves. ?~ foc moz - ?~ id.cli ~&(%reader-no-sole moz) + ?~ id.cli ~&(%client-no-sole moz) [[id.cli %diff %sole-effect u.foc] moz] :: ::> || @@ -247,20 +247,20 @@ ::+| :: ++ ta-init ::< initialize app - ::> subscribes to our broker. + ::> subscribes to our hall. :: %- ta-emil ^- (list move) :~ :* ost.bol %peer / - broker - /reader + server + /client == :* ost.bol %peer / - broker + server /circle/[inbox]/grams/config/group == == @@ -272,7 +272,7 @@ ^+ +> ?+ -.piz +> :: - $reader + $client %= +> binds gys.piz bound (bound-from-binds gys.piz) @@ -295,7 +295,7 @@ ^+ +> ?+ -.rum +> :: - $reader + $client ?- -.rum.rum $glyph (ta-change-glyph +.rum.rum) @@ -376,7 +376,7 @@ ::+| :: ++ ta-unpack ::< open envelopes - ::> the reader currently doesn't care about nums. + ::> the client currently doesn't care about nums. :: |= nes/(list envelope) ^+ +> @@ -431,7 +431,7 @@ ::+| :: ++ ta-console ::< initialize shell - ::> initialize the shell of this reader. + ::> initialize the shell of this client. :: ^+ . =/ she/shell @@ -487,8 +487,8 @@ :_ moves :* ost.bol %poke - /reader/action - broker + /client/action + server [%hall-action act] == == @@ -2150,7 +2150,7 @@ |= act/sole-action ta-done:(ta-sole:ta act) :: -++ coup-reader-action ::< accept n/ack +++ coup-client-action ::< accept n/ack ::> :: |= {wir/wire fal/(unit tang)} diff --git a/sur/hall.hoon b/sur/hall.hoon index 09d656ed0d..4ee557db4f 100644 --- a/sur/hall.hoon +++ b/sur/hall.hoon @@ -24,7 +24,7 @@ ::+| :: ++ query ::> query paths - $% {$reader $~} ::< shared ui state + $% {$client $~} ::< shared ui state {$public $~} ::< public memberships {$burden who/ship} ::TODO eventually, nom/naem. ::< duties to share {$report $~} ::< duty reports @@ -53,23 +53,23 @@ {$ud @ud} ::< message number == :: ++ prize ::> query result - $% {$reader prize-reader} ::< /reader + $% {$client prize-client} ::< /client {$public cis/(set circle)} ::< /public {$burden sos/(map naem burden)} ::< /burden {$report ~} ::< /report {$circle package} ::< /circle == :: -++ prize-reader :: +++ prize-client :: $: gys/(jug char audience) ::< glyph bindings nis/(map ship nick) ::< local nicknames == :: ++ rumor ::< query result change - $% {$reader rum/rumor-reader} ::< /reader + $% {$client rum/rumor-client} ::< /client {$public add/? cir/circle} ::< /public {$burden nom/naem rum/rumor-story} ::< /burden {$circle rum/rumor-story} ::< /circle == :: -++ rumor-reader ::< changed ui state +++ rumor-client ::< changed ui state $% {$glyph diff-glyph} ::< un/bound glyph {$nick diff-nick} ::< changed nickname == :: @@ -121,9 +121,9 @@ == :: :: ::> || -::> || %reader-communication +::> || %client-communication ::> || -::> broker interfaces for readers. +::> hall interfaces for clients. ::+| :: ++ action ::> user action @@ -148,9 +148,9 @@ == :: :: ::> || -::> || %broker-communication +::> || %hall-communication ::> || -::> structures for communicating between brokers. +::> structures for communicating between halls. ::+| :: ++ command ::> effect on story @@ -211,7 +211,7 @@ ::+| :: ::TODO some structure for extra message state -:: local (to readers): delivery state, read flags +:: local (to clients): delivery state, read flags :: remote (to halls): sequence nr ++ envelope {num/@ud gam/telegram} ::< outward message ++ telegram {aut/ship thought} ::< whose message From 27d3867951f39b99fb016b752b77a894f1527549 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 16 Nov 2017 01:21:25 +0100 Subject: [PATCH 270/303] Changed ?-/?+ separation comments to adhere more closely to the standard. --- app/hall.hoon | 61 +++++++++++++++++++++++++-------------------------- app/talk.hoon | 56 +++++++++++++++++++++++----------------------- lib/hall.hoon | 10 ++++----- 3 files changed, 62 insertions(+), 65 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index 74ac1a4eae..4ebe3508cf 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -547,7 +547,7 @@ ^+ +> ?+ -.piz ~&([%ignoring-prize -.piz] +>) - :: + :: $burden =+ sos=~(tap by sos.piz) |- ^+ ..ta-take @@ -566,7 +566,7 @@ ::|= {{n/naem b/burden} _..ta-take} ::=+ (fall (~(get by stories) n) *story) ::so-done:(~(so-bear so n ~ -) b) - :: + :: $circle =+ wer=(etch wir) ?> ?=($circle -.wer) @@ -584,12 +584,12 @@ ^+ +> ?+ -.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) @@ -606,7 +606,7 @@ ::%- ~(so-bear so nom.rum ~ (fall (~(get by stories) nom.rum) *story)) ::[~ [cof.rum.rum ~] [~ ~]] == - :: + :: $circle =+ wer=(etch wir) ?> ?=($circle -.wer) @@ -1433,7 +1433,7 @@ %. det =+ (fall (~(get by stories) nom) *story) ~(sa-change sa nom -) - :: + :: $new (da-create nom +.det) $bear ~&(%unexpected-unsplit-bear +>) $remove (da-delete nom) @@ -1539,26 +1539,25 @@ ^+ +> ?+ -.det ~&([%unexpected-delta-local -.det] !!) - :: + :: $inherited +>(inherited ihr.det) - :: + :: $follow (sa-emil (sa-follow-effects sub.det srs.det)) - :: + :: $sequent +>(sequence (~(put by sequence) cir.det num.det)) - :: - :: + :: $gram (sa-change-gram gam.det) - :: + :: $config =. +> %- sa-emil (sa-config-effects shape dif.det) +>(shape (change-config shape dif.det)) - :: + :: $status %_ +> locals @@ -1599,7 +1598,7 @@ ^+ +> ?+ -.det ~&([%unexpected-delta-remote -.det] !!) - :: + :: $config ?: ?=($remove -.dif.det) +>(mirrors (~(del by mirrors) cir.det)) @@ -1608,7 +1607,7 @@ (fall (~(get by mirrors) cir.det) *config) dif.det +>.$(mirrors (~(put by mirrors) cir.det new)) - :: + :: $status %_ +>.$ remotes @@ -1737,10 +1736,10 @@ ?+ wir !! {@ @ $circle *} [(slav %p i.t.wir) t.t.wir] - :: + :: {$burden *} [(above our.bol) wir] - :: + :: {@ $report *} [(slav %p i.wir) t.wir] == @@ -1759,7 +1758,7 @@ i.wir [(slav %p i.t.wir) i.t.t.t.wir] (path-to-range t.t.t.t.wir) - :: + :: {$repeat @ @ @ $~} :+ %repeat [(slav %p i.t.wir) i.t.t.wir] @@ -1838,10 +1837,10 @@ ?- -.qer $client ``[%client binds nicks] - :: + :: $public ``[%public public] - :: + :: $burden :+ ~ ~ :- %burden @@ -1855,12 +1854,12 @@ :+ 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 ~] - :: + :: $circle ::REVIEW should we send precs & config to out of range subs? =+ soy=(~(get by stories) nom.qer) ?~ soy ~ @@ -1889,7 +1888,7 @@ $follow !! $inherited !! $sequent !! - :: + :: $gram :- %gram %+ gram-to-envelope nom @@ -1900,12 +1899,12 @@ ?. &(=(hos.c our.bol) =(nom.c nom)) c [who nom] == - :: + :: $config ?. &(=(hos.cir.det our.bol) =(nom.cir.det nom)) det det(cir [who nom]) - :: + :: $status ?. &(=(hos.cir.det our.bol) =(nom.cir.det nom)) det @@ -1952,11 +1951,11 @@ $glyph `[%client det] $nick `[%client det] == - :: + :: $public ?. ?=($public -.det) ~ `det - :: + :: $burden ?: &(=(who.qer src.bol) =(rir /(scot %p src.bol)/report)) ~ ?. ?=($story -.det) ~ @@ -1964,7 +1963,7 @@ :: only burden channels for now. ?. =(%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 our.bol)) ~ @@ -1977,7 +1976,7 @@ :: only burden channels for now. ?. =(%channel sec.con.shape.soy) ~ `[%burden nom.det (dedicate (above our.bol) nom.det det.det)] - :: + :: $circle ?. ?=($story -.det) ~ ?. =(nom.qer nom.det) ~ @@ -2038,7 +2037,7 @@ ::TODO can probably do this a bit better... ?+ i.pax qer(ran (path-to-range pax)) - :: + :: circle-data %_ $ pax t.pax wat.qer (~(put in wat.qer) i.pax) == @@ -2092,7 +2091,7 @@ =(our.bol (above who)) == $report =(who (above our.bol)) - :: + :: $circle ?. (~(has by stories) nom.qer) | %. who diff --git a/app/talk.hoon b/app/talk.hoon index a433df559e..3f26cd6cc0 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -271,14 +271,13 @@ |= piz/prize ^+ +> ?+ -.piz +> - :: $client %= +> binds gys.piz bound (bound-from-binds gys.piz) nicks nis.piz == - :: + :: $circle %. nes.piz %= ta-unpack @@ -294,16 +293,15 @@ |= 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) == @@ -315,10 +313,10 @@ ^+ +> ?+ -.rum ~&([%unexpected-circle-rumor -.rum] +>) - :: + :: $gram (ta-learn gam.nev.rum) - :: + :: $config =+ cur=(fall (~(get by mirrors) cir.rum) *config) =. +>.$ @@ -335,13 +333,13 @@ ?: 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=(fall (~(get by remotes) cir.rum) *group) =+ cur=(fall (~(get by rem) who.rum) *status) @@ -816,7 +814,7 @@ |- ^- (list sole-edit) ?+ -.wok ~ - :: + :: $target ?~(q.wok ~ $(wok u.q.wok)) == @@ -1576,10 +1574,10 @@ ?- -.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) ~ @@ -1590,7 +1588,7 @@ $full han.man.dif.dif $handle han.dif.dif == - :: + :: $remove "bye {(scow %p who)}" == @@ -1612,10 +1610,10 @@ $source %+ weld ?:(add.dif "onn " "off ") ~(cr-full cr cir.src.dif) - :: + :: $caption "cap {(trip cap.dif)}" - :: + :: $filter ;: weld "fit: caps:" @@ -1623,10 +1621,10 @@ " unic:" ?:(utf.fit.dif "✔" "n") == - :: + :: $secure "sec {(trip sec.con.cur)} -> {(trip sec.dif)}" - :: + :: $permit %+ weld =? add.dif @@ -1962,13 +1960,13 @@ ?- -.sep $lin tan+~[leaf+"{?:(pat.sep "@ " "")}{(trip msg.sep)}"] - :: + :: $url url+(crip (apix:en-purl:html url.sep)) - :: + :: $exp mor+~[txt+"# {(trip exp.sep)}" tan+res.sep] - :: + :: $ire =+ gam=(recall top.sep) ?~ gam $(sep sep.sep) @@ -1977,10 +1975,10 @@ [%leaf "in reply to: {(cite:title aut.u.gam)}: "]~ %+ turn (~(tr-text tr sef u.gam) width.cli) |=(t/tape [%leaf t]) - :: + :: $fat [%mor $(sep sep.sep) tan+(tr-tach tac.sep) ~] - :: + :: $inv :- %tan :_ ~ @@ -1990,7 +1988,7 @@ "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) ~] == @@ -2043,16 +2041,16 @@ ?+ -.tac.sep [" attached: ..." ~] $name [(scag wyd " attached: {(trip nom.tac.sep)}") ~] == - :: + :: $exp :- (tr-chow wyd '#' ' ' (trip exp.sep)) ?~ 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) @@ -2075,7 +2073,7 @@ |= {a/knot b/tape} ?~ b (trip a) (welp b '.' (trip a)) - :: + :: $lin :: glyph prefix =/ pef/tape @@ -2097,7 +2095,7 @@ [(sub wyd u.ace) &] :- (weld pef (tufa (scag end `(list @c)`txt))) $(txt (slag ?:(nex +(end) end) `(list @c)`txt), pef (reap (lent pef) ' ')) - :: + :: $inv :_ ~ %+ tr-chow wyd @@ -2106,7 +2104,7 @@ " invited you to " " banished you from " ~(cr-phat cr cir.sep) - :: + :: $app $(sep sep.sep, pre `[& "[{(trip app.sep)}]: "]) == diff --git a/lib/hall.hoon b/lib/hall.hoon index 3dc541f15f..e559773a33 100644 --- a/lib/hall.hoon +++ b/lib/hall.hoon @@ -111,7 +111,7 @@ $caption cof(cap cap.dif) $filter cof(fit fit.dif) $remove cof - :: + :: $source %= cof src @@ -120,7 +120,7 @@ ~(put in src.cof) ~(del in src.cof) == - :: + :: $permit %= cof sis.con @@ -129,12 +129,12 @@ ~(uni in sis.con.cof) ~(dif in sis.con.cof) == - :: + :: $secure %= cof sec.con sec.dif - :: + :: sis.con ?. .= ?=(?($white $green) sec.dif) ?=(?($white $green) sec.con.cof) @@ -152,7 +152,7 @@ $full sat.dif $presence sat(pec pec.dif) $remove sat - :: + :: $human %= sat man From 7739bfb8558047352fe81218983a340a69ac9c31 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 16 Nov 2017 16:36:34 +0100 Subject: [PATCH 271/303] Further renaming "reader" to "client". --- lib/hall-json.hoon | 16 ++++++++-------- mar/hall/prize.hoon | 4 ++-- mar/hall/rumor.hoon | 4 ++-- web/talk/main.js | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/hall-json.hoon b/lib/hall-json.hoon index 5b0a1991eb..90521e3f49 100644 --- a/lib/hall-json.hoon +++ b/lib/hall-json.hoon @@ -119,8 +119,8 @@ ::> models relating to queries, their results and updates. ::+| :: - ++ pire ::> prize-reader - |= a/prize-reader + ++ pici ::> prize-client + |= a/prize-client ^- json %- pairs :~ :- %gys @@ -130,8 +130,8 @@ nis+(mo nis.a (cury scot %p) cord) == :: - ++ rure ::> rumor-reader - |= a/rumor-reader + ++ ruci ::> rumor-client + |= a/rumor-client ^- json %+ frond -.a ?- -.a @@ -388,15 +388,15 @@ ::> models relating to queries, their results and updates. ::+| :: - ++ pire ::> prize-reader - ^- $-(json (unit prize-reader)) + ++ pici ::> prize-client + ^- $-(json (unit prize-client)) %- ot :~ gys+(om (as (as circ))) nis+(op fed:ag so) == :: - ++ rure ::> rumor-reader - ^- $-(json (unit rumor-reader)) + ++ ruci ::> rumor-client + ^- $-(json (unit rumor-client)) %- of :~ glyph+digy nick+dini diff --git a/mar/hall/prize.hoon b/mar/hall/prize.hoon index 6a389219e1..468e2729a1 100644 --- a/mar/hall/prize.hoon +++ b/mar/hall/prize.hoon @@ -15,7 +15,7 @@ |= a/json ^- prize:hall =- (need ((of -) a)) - :~ reader+pire + :~ client+pici public+(as circ) :: burden not needed :: report not needed @@ -30,7 +30,7 @@ =, enjs:format %+ frond -.piz ?+ -.piz !! - $reader (pire +.piz) + $client (pici +.piz) $public (sa cis.piz circ) :: burden not needed :: report not needed diff --git a/mar/hall/rumor.hoon b/mar/hall/rumor.hoon index baf7c416b1..c100df639b 100644 --- a/mar/hall/rumor.hoon +++ b/mar/hall/rumor.hoon @@ -15,7 +15,7 @@ |= a/json ^- rumor:hall =- (need ((of -) a)) - :~ reader+rure + :~ client+ruci public+(ot add+bo cir+circ ~) :: burden not needed circle+ruso @@ -29,7 +29,7 @@ =, enjs:format %+ frond -.rum ?+ -.rum !! - $reader (rure rum.rum) + $client (ruci rum.rum) $public (pairs add+b+add.rum cir+(circ cir.rum) ~) :: burden not needed $circle (ruso rum.rum) diff --git a/web/talk/main.js b/web/talk/main.js index b128f2f6f5..7fbd397cad 100644 --- a/web/talk/main.js +++ b/web/talk/main.js @@ -1688,14 +1688,14 @@ module.exports = function(arg) { listen: function() { var date; date = window.urb.util.toDate(new Date()); - return window.urb.bind('/reader', function(err, res) { + return window.urb.bind('/client', function(err, res) { var gys, nis, ref; if (err || !res.data) { console.log('sp err'); console.log(err); return; } - ref = res.data.reader, gys = ref.gys, nis = ref.nis; + ref = res.data.client, gys = ref.gys, nis = ref.nis; return StationActions.loadGlyphs(gys); }); }, From a784b2513b97d1d61dfdcedace35be3c5aad42e2 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 16 Nov 2017 21:31:17 +0100 Subject: [PATCH 272/303] Made notifications slightly less obnoxious. --- app/talk.hoon | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/talk.hoon b/app/talk.hoon index 3f26cd6cc0..10963d6906 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -1566,11 +1566,9 @@ |= {cir/circle who/ship cur/status dif/diff-status} ^+ +> ?: (~(has in settings.she) %quiet) +> - =. +> - %- sh-note - %+ weld " in " - (~(cr-show cr cir) ~) %- sh-note + %+ weld + (weld ~(cr-phat cr cir) ": ") ?- -.dif $full "hey {(scow %p who)} {(scow %tas pec.sat.dif)}" From c05ca4a10340b76888e27322af55af6ecb88436d Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 16 Nov 2017 21:32:09 +0100 Subject: [PATCH 273/303] Hall now silently ignores (the data-less) %report prizes, so it doesn't seem like something's wrong. --- app/hall.hoon | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index 4ebe3508cf..cab2536e54 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -542,11 +542,13 @@ ::> 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. :: |= {wir/wire piz/prize} ^+ +> - ?+ -.piz - ~&([%ignoring-prize -.piz] +>) + ?+ -.piz ~&([%ignoring-prize -.piz] +>) + $report + +> :: $burden =+ sos=~(tap by sos.piz) From f6c574647da5dd14e7135fbdbea9dd71ccba7742 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 17 Nov 2017 13:47:16 +0100 Subject: [PATCH 274/303] Config notifications now also smaller. --- app/talk.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/talk.hoon b/app/talk.hoon index 10963d6906..680eb17845 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -1601,9 +1601,9 @@ (sh-note (weld "new " (~(cr-show cr cir) ~))) ?: ?=($remove -.dif) (sh-note (weld "rip " (~(cr-show cr cir) ~))) - =. +> - (sh-note (weld " in " (~(cr-show cr cir) ~))) %- sh-note + %+ weld + (weld ~(cr-phat cr cir) ": ") ?- -.dif $source %+ weld ?:(add.dif "onn " "off ") From 0a610d64190c2f8c467cedb8ba023a6c73ec834c Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 17 Nov 2017 18:41:08 +0100 Subject: [PATCH 275/303] Cleaned up %peer and %pull move wires and logic. --- app/hall.hoon | 123 +++++++++++++++++++++++++------------------------- 1 file changed, 61 insertions(+), 62 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index cab2536e54..917fe8044a 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -1041,6 +1041,19 @@ :: |= src/source ^+ +> + =+ seq=(~(get by sequence) cir.src) + :: if we're past the range, don't resubscribe. + ?: ?& ?=(^ ran.src) + ?=(^ tal.u.ran.src) + :: + ?- -.u.tal.u.ran.src + $da (gte now.bol +.u.tal.u.ran.src) + $ud ?& ?=(^ seq) + (gte u.seq +.u.tal.u.ran.src) + == + == + == + (so-delta-our %follow | [src ~ ~]) =- (so-delta-our %follow & [[cir.src -] ~ ~]) ^- range ?. (~(has by sequence) cir.src) ran.src @@ -1318,27 +1331,14 @@ ::> apply %init delta, querying the /burden of the ::> ship above us. :: - %- da-emit - =+ pax=/burden/(scot %p our.bol) - :* 0 - %peer - pax - [(above our.bol) dap.bol] - pax - == + (da-emit (wire-to-peer /burden)) :: ++ da-observe ::< watch burden bearer ::> apply %observe delta, querying the /report of ::> {who} below us. :: |= who/ship - %- da-emit - :* 0 - %peer - /(scot %p who)/report - [who dap.bol] - /report - == + (da-emit (wire-to-peer /report/(scot %p who))) :: ++ da-change-public ::< show/hide membership ::> add/remove a circle to/from the public @@ -1666,36 +1666,26 @@ ::> subscribes this story to each circle. :: |= srs/(set source) - %+ sa-sauce 0 :: subscription is caused by this app =- (murn - same) %+ turn ~(tap in srs) |= {cir/circle ran/range} - ^- (unit card) + ^- (unit move) ?: =(cir sa-cir) ~ :: ignore self-subs - =+ wat=[%grams %config-l %group-l ~] - `(circle-peer nom wat cir ran) + =+ wat=~[%grams %config-l %group-l] + `(wire-to-peer (sa-circle-wire wat cir ran)) :: ++ sa-abjure ::< unsubscribe us ::> unsubscribes this story from each circle. :: |= srs/(set source) - %+ sa-sauce 0 :: subscription is caused by this app - %- zing %+ turn ~(tap in srs) |= {cir/circle ran/range} - ^- (list card) - :_ ~ - =+ rap=(range-to-path ran) - :* %pull - ;: welp - /[nom]/(scot %p hos.cir) - /circle/[nom.cir] - /grams/config-l/group-l - rap - == - [hos.cir dap.bol] - ~ - == + ^- move + =/ wir + %+ sa-circle-wire + ~[%grams %config-l %group-l] + [cir ran] + [0 %pull wir [hos.cir dap.bol] ~] :: ++ sa-eject ::< unsubscribe ships ::> removes ships {sis} from {followers}. @@ -1720,30 +1710,53 @@ == c (~(put in c) b) + :: + ++ sa-circle-wire ::< /circle peer wire + ::> constructs a /circle %peer path for subscribing + ::> {nom} to a source. + :: + |= {wat/(list circle-data) source} + ^- wire + ;: weld + /circle/[nom]/(scot %p hos.cir)/[nom.cir] + wat + (range-to-path ran) + == -- -- :: :: ::> || -::> || %wire-parsing +::> || %wire-utility ::> || ::+| :: -++ target ::< ship+path from wire +++ wire-to-peer ::< peer move from wire + ::> builds the peer move associated with the wire. + :: + |= wir/wire + ^- move + =+ tar=(wire-to-target wir) + [0 %peer wir [p.tar dap.bol] q.tar] +:: +++ wire-to-target ::< ship+path from wire ::> parses {wir} to obtain the target ship and the ::> query path. :: |= wir/wire ^- (pair ship path) - ?+ wir !! - {@ @ $circle *} - [(slav %p i.t.wir) t.t.wir] + ?+ wir ~&(wir !!) + {$circle @ @ *} + :- (slav %p i.t.t.wir) + (welp /circle t.t.t.wir) :: {$burden *} - [(above our.bol) wir] + :- (above our.bol) + /burden/(scot %p our.bol) :: - {@ $report *} - [(slav %p i.wir) t.wir] + {$report @ *} + :- (slav %p i.t.wir) + /report == :: ++ etch ::< parse wire @@ -1754,11 +1767,11 @@ |= wir/wire ^- weir ?+ wir !! - {@ @ $circle @ *} - :: us, host, $circle, target + {$circle @ @ @ *} + :: $circle, us, host, target :^ %circle - i.wir - [(slav %p i.t.wir) i.t.t.t.wir] + i.t.wir + [(slav %p i.t.t.wir) i.t.t.t.wir] (path-to-range t.t.t.t.wir) :: {$repeat @ @ @ $~} @@ -1790,19 +1803,6 @@ =+ wer=(etch wir) ?>(?=($repeat -.wer) (fun cir.wer ses.wer)) :: -++ circle-peer ::< /circle peer card - ::> constructs a %peer move to subscribe {nom} to a - ::> source. - :: - |= {nom/naem wat/(list circle-data) source} - ^- card - =+ pax=:(welp /circle/[nom.cir] wat (range-to-path ran)) - :* %peer - (welp /[nom]/(scot %p hos.cir) pax) - [hos.cir dap.bol] - pax - == -:: ::> || ::> || %new-events ::> || @@ -2208,7 +2208,7 @@ ::: |= {wir/wire fal/(unit tang)} ^- (quip move _+>) - ?. ?=({@ @ $circle *} wir) + ?. ?=($circle -.wir) ?~ fal [~ +>] ~| reap-fail+wir (mean u.fal) @@ -2228,8 +2228,7 @@ |= wir/wire ^- (quip move _+>) :_ +> - =+ tar=(target wir) - [0 %peer wir [p.tar dap.bol] q.tar]~ + [(wire-to-peer wir) ~] :: ++ quit-circle ::< dropped circle sub ::> gall dropped our subscription. resubscribe. From c16269de6f684ce91aef4766d243d1df73030bd4 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 17 Nov 2017 20:09:40 +0100 Subject: [PATCH 276/303] Stories now track which ships are actually subscribed to them. Can be queried using /peers/[circle-name]. --- app/hall.hoon | 48 ++++++++++++++++++++++++++++++++++++++++++++---- sur/hall.hoon | 4 ++++ 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index 917fe8044a..212bed52fa 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -46,6 +46,7 @@ mirrors/(map circle config) ::< remote config sequence/(map circle @ud) ::< last-heard p circle known/(map serial @ud) ::< messages heard + peers/(jar ship query) ::< subscribers inherited/_| ::< from parent? == :: ::> || %deltas :: @@ -516,12 +517,14 @@ (ta-delta %observe who) :: ++ ta-subscribe ::< listen to - ::> add her to a status list if applicable. + ::> reaction to incoming subscriptions. :: |= {her/ship qer/query} ^+ +> ?+ -.qer +> - $burden (ta-observe her) + $burden (ta-observe her) + $circle %+ ta-delta %story + [nom.qer %peer & her qer] == :: ++ ta-greet ::< subscription success @@ -826,6 +829,7 @@ (so-config-full ~ cof.rum) $(rum [%config src %full cof.rum]) $bear (so-bear bur.rum) + $peer (so-delta-our rum) $gram (so-open src nev.rum) $config :: full changes to us need to get split up. ?: &(=(cir.rum so-cir) ?=($full -.dif.rum)) @@ -1544,6 +1548,17 @@ :: $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)) @@ -1861,6 +1876,11 @@ ::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) @@ -1969,15 +1989,21 @@ $report :: only send changes we didn't get from above. ?: =(src.bol (above our.bol)) ~ - :: only send story reports about grams and status. + :: only send story reports about grams, status and peers. ?. ?=($story -.det) ~ - ?. ?=(?($gram $status) -.det.det) ~ + ?. ?=(?($gram $status $peer) -.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 our.bol) nom.det det.det)] + :: + $peers + ?. ?=($story -.det) ~ + ?. =(nom.qer nom.det) ~ + ?. ?=($peer -.det.det) ~ + `[%peers +.det.det] :: $circle ?. ?=($story -.det) ~ @@ -2092,6 +2118,7 @@ $burden ?& =(who who.qer) =(our.bol (above who)) == + $peers =(who our.bol) ::TODO or so-visible? $report =(who (above our.bol)) :: $circle @@ -2203,6 +2230,19 @@ ^- (quip move _+>) [~ +>] :: +++ pull-circle ::< circle unsubscribe + ::> someone ends a /circle subscription. + :: + |= pax/path + ~& [%got-pull-circle pax] + ^- (quip move _+>) + %- pre-bake + :_ ~ + =+ qer=(path-to-query %circle pax) + ?> ?=($circle -.qer) + :+ %story nom.qer + [%peer | src.bol qer] +:: ++ reap ::< subscription n/ack ::> update state to reflect subscription success ::: diff --git a/sur/hall.hoon b/sur/hall.hoon index 4ee557db4f..937cf18cf4 100644 --- a/sur/hall.hoon +++ b/sur/hall.hoon @@ -28,6 +28,7 @@ {$public $~} ::< public memberships {$burden who/ship} ::TODO eventually, nom/naem. ::< duties to share {$report $~} ::< duty reports + {$peers nom/naem} ::< readers of story $: $circle ::> story query nom/naem ::< circle name wat/(set circle-data) ::< data to get @@ -57,6 +58,7 @@ {$public cis/(set circle)} ::< /public {$burden sos/(map naem burden)} ::< /burden {$report ~} ::< /report + {$peers pes/(jar ship query)} ::< /peers {$circle package} ::< /circle == :: ++ prize-client :: @@ -67,6 +69,7 @@ $% {$client rum/rumor-client} ::< /client {$public add/? cir/circle} ::< /public {$burden nom/naem rum/rumor-story} ::< /burden + {$peers add/? who/ship qer/query} ::< /peers {$circle rum/rumor-story} ::< /circle == :: ++ rumor-client ::< changed ui state @@ -90,6 +93,7 @@ ++ diff-story ::> story change $% {$new cof/config} ::< new story {$bear bur/burden} ::< new inherited story + {$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 From 5cd9f12ae3cc8649646eadb340189513ddcb2ec3 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 17 Nov 2017 20:10:23 +0100 Subject: [PATCH 277/303] Tiny fixes & todo's cleanup. --- app/hall.hoon | 4 ++-- app/talk.hoon | 2 +- sur/hall.hoon | 6 ++---- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index 212bed52fa..bd624acdaa 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -40,12 +40,12 @@ ++ story ::> wire content $: count/@ud ::< (lent grams) grams/(list telegram) ::< all messages + known/(map serial @ud) ::< messages heard + 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 - sequence/(map circle @ud) ::< last-heard p circle - known/(map serial @ud) ::< messages heard peers/(jar ship query) ::< subscribers inherited/_| ::< from parent? == :: diff --git a/app/talk.hoon b/app/talk.hoon index 680eb17845..52dc547a5f 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -417,7 +417,7 @@ |= {num/@ud gam/telegram} =+ old=(snag num grams) ?: =(gam old) +>.$ :: no change - =. grams (welp (scag num grams) [gam (slag +(num) grams)]) + =. grams (oust [num 1] grams) ?: =(sep.gam sep.old) +>.$ :: no worthy change =< sh-done (~(sh-gram sh cli) gam) diff --git a/sur/hall.hoon b/sur/hall.hoon index 937cf18cf4..3cba83ff49 100644 --- a/sur/hall.hoon +++ b/sur/hall.hoon @@ -57,7 +57,7 @@ $% {$client prize-client} ::< /client {$public cis/(set circle)} ::< /public {$burden sos/(map naem burden)} ::< /burden - {$report ~} ::< /report + {$report $~} ::< /report {$peers pes/(jar ship query)} ::< /peers {$circle package} ::< /circle == :: @@ -81,7 +81,7 @@ pes/crowd ::< loc & rem presences == :: ++ burden ::> full story state - $: gaz/(list telegram) ::TODO envelope? ::< all messages + $: gaz/(list telegram) ::< all messages shipment ::< metadata == :: ++ package ::< story state @@ -103,7 +103,6 @@ $% {$gram nev/envelope} ::< new/changed msgs == == :: ++ diff-config ::> config change - ::TODO maybe just full? think. $% {$full cof/config} ::< set w/o side-effects {$source add/? src/source} ::< add/rem sources {$caption cap/cord} ::< changed description @@ -192,7 +191,6 @@ $mailbox ::< our r, blacklist w == :: :: participant metadata. :: -::TODO think about naming more ++ crowd {loc/group rem/(map circle group)} ::< our & srcs presences ++ group (map ship status) ::< presence map ++ status {pec/presence man/human} ::< participant From 6d4db0d0177c8f8666c5a4c430c3658d40f048f7 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 17 Nov 2017 21:14:42 +0100 Subject: [PATCH 278/303] Proper backstepped separator comments for the main talk parser. --- app/talk.hoon | 84 +++++++++++++++++++++++++-------------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/app/talk.hoon b/app/talk.hoon index 52dc547a5f..e5a6dd6512 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -673,19 +673,19 @@ %+ knee *^work |. ~+ =- ;~(pose ;~(pfix sem -) message) ;~ pose - :: - :: circle management - :: + :: + :: circle management + :: ;~((glue ace) (perk %join ~) sorz) - :: + :: ;~((glue ace) (perk %leave ~) cirs) - :: + :: ;~ (glue ace) (perk %create ~) pore cire qut == - :: + :: ;~ plug (perk %delete ~) ;~(pfix ;~(plug ace cen) sym) ;~ pose @@ -693,22 +693,22 @@ (easy ~) == == - :: + :: ;~((glue ace) (perk %depict ~) cire qut) - :: + :: ;~((glue ace) (perk %filter ~) cire lobe lobe) - :: + :: ;~((glue ace) (perk %invite ~) cire shiz) - :: + :: ;~((glue ace) (perk %banish ~) cire shiz) - :: + :: ;~((glue ace) (perk %source ~) cire sorz) - :: + :: ;~((glue ace) (perk %unsource ~) cire sorz) ::TODO why do these nest-fail when doing perk with multiple? - :: - :: personal metadata - :: + :: + :: personal metadata + :: ;~ (glue ace) (perk %attend ~) cirs @@ -717,7 +717,7 @@ (cook some (perk %gone %idle %hear %talk ~)) == == - :: + :: ;~ plug (perk %name ~) ;~(pfix ace cirs) @@ -734,11 +734,11 @@ (easy ~) == == - :: - :: displaying info - :: + :: + :: displaying info + :: ;~(plug (perk %who ~) ;~(pose ;~(pfix ace cirs) (easy ~))) - :: + :: ;~ plug (perk %what ~) ;~ pose @@ -746,17 +746,17 @@ (easy ~) == == - :: + :: ;~((glue ace) (perk %show ~) circ) - :: + :: ;~((glue ace) (perk %hide ~) circ) - :: - :: ui settings - :: + :: + :: ui settings + :: ;~(plug (perk %bind ~) ;~(pfix ace glyph) (punt ;~(pfix ace cirs))) - :: + :: ;~(plug (perk %unbind ~) ;~(pfix ace glyph) (punt ;~(pfix ace cirs))) - :: + :: ;~ plug (perk %nick ~) ;~ pose ;~ plug @@ -775,27 +775,27 @@ == == == - :: + :: ;~(plug (cold %width (jest 'set width ')) dem:ag) - :: + :: ;~(plug (perk %set ~) ;~(pose ;~(pfix ace setting) (easy %$))) - :: + :: ;~(plug (perk %unset ~) ;~(pfix ace setting)) - :: - :: miscellaneous - :: + :: + :: miscellaneous + :: ;~(plug (perk %help ~) (easy ~)) - :: - :: (parsers below come last because they match quickly) - :: - :: messaging - :: + :: + :: (parsers below come last because they match quickly) + :: + :: messaging + :: (stag %target ;~(plug cirs (punt ;~(pfix ace message)))) - :: + :: (stag %reply ;~(plug pick ;~(pfix ace speeches))) - :: - :: displaying info - :: + :: + :: displaying info + :: (stag %number pick) == -- From 115ac3eb4261e4062450c2735f44a1b7cba398ad Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 17 Nov 2017 21:32:44 +0100 Subject: [PATCH 279/303] Can now adjust printed timestamps using ;set timezone +/-hours (Also, now uses message timestamp instead of now.) --- app/talk.hoon | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/app/talk.hoon b/app/talk.hoon index e5a6dd6512..7ed0c33214 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -54,6 +54,7 @@ active/audience ::< active targets settings/(set term) ::< frontend settings width/@ud ::< display width + timez/(pair ? @ud) ::< timezone adjustment == :: ++ move (pair bone card) ::< all actions ++ lime ::> diff fruit @@ -99,6 +100,7 @@ {$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 @@ -777,6 +779,22 @@ == :: ;~(plug (cold %width (jest 'set width ')) dem:ag) + :: + ;~ plug + (cold %timez (jest 'set timezone ')) + :: + ;~ pose + (cold %| (just '-')) + (cold %& (just '+')) + == + :: + %+ sear + |= a/@ud + ^- (unit @ud) + ?: &((gte a 0) (lte a 14)) + `a ~ + dem:ag + == :: ;~(plug (perk %set ~) ;~(pose ;~(pfix ace setting) (easy %$))) :: @@ -908,6 +926,7 @@ $set (wo-set +.job) $unset (unset +.job) $width (width +.job) + $timez (timez +.job) :: miscelaneous $show (public & +.job) $hide (public | +.job) @@ -1302,6 +1321,13 @@ ^+ ..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 ::> || @@ -1916,7 +1942,10 @@ :: timestamp, if desired. =/ tam/tape ?. (~(has in sef) %showtime) "" - =+ dat=(yore now.bol) + =. wen + %. [wen (mul q.timez.cli ~h1)] + ?:(p.timez.cli add sub) + =+ dat=(yore wen) =/ t |= a/@ %+ weld From 5436f71bce24b85ee29b5d127bf1da9ac62a2bf2 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 20 Nov 2017 14:44:00 +0100 Subject: [PATCH 280/303] Removed unnecessary operations in ++so-resub. --- app/hall.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index bd624acdaa..cf08c1f48e 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -1060,8 +1060,8 @@ (so-delta-our %follow | [src ~ ~]) =- (so-delta-our %follow & [[cir.src -] ~ ~]) ^- range - ?. (~(has by sequence) cir.src) ran.src - =- `[[%ud (~(got by sequence) cir.src)] -] + ?~ seq ran.src + =- `[[%ud u.seq] -] ?~ ran.src ~ tal.u.ran.src :: From 909d8665f3b3bf604c4a25a371dcc582b4d20a36 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 20 Nov 2017 16:45:28 +0100 Subject: [PATCH 281/303] Simplify unnecessarily verbose checks in ++dedicate. --- app/hall.hoon | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index cf08c1f48e..fde31b5b8c 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -1918,17 +1918,17 @@ aud %- ~(run in aud.gam.det) |= c/circle - ?. &(=(hos.c our.bol) =(nom.c nom)) c + ?. =(c [our.bol nom]) c [who nom] == :: $config - ?. &(=(hos.cir.det our.bol) =(nom.cir.det nom)) + ?. =(cir.det [our.bol nom]) det det(cir [who nom]) :: $status - ?. &(=(hos.cir.det our.bol) =(nom.cir.det nom)) + ?. =(cir.det [our.bol nom]) det det(cir [who nom]) == From afa6b7552c63e65fe4b56bca3464c78265b4ff08 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 20 Nov 2017 20:23:02 +0100 Subject: [PATCH 282/303] Now *actually* checks if a message is in a subscriber's range. Fixes omitted sample caused by changes in 6e4b9fe. --- app/hall.hoon | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/hall.hoon b/app/hall.hoon index fde31b5b8c..277b21cba0 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -2010,7 +2010,8 @@ ?. =(nom.qer nom.det) ~ ?. (circle-feel-story wat.qer nom.det det.det) ~ =/ sor (~(got by stories) nom.qer) - ?. in:(~(so-in-range so:ta nom.qer ~ sor)) ~ + ?. =< in %. ran.qer + ~(so-in-range so:ta nom.qer ~ sor) ~ ?. ?=(?($gram $new $config $status) -.det.det) ~ :+ ~ %circle ?+ det.det det.det From 5fbb7599cb6d5dca39cdd5c9adac5da9c8a71bc9 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 20 Nov 2017 20:48:54 +0100 Subject: [PATCH 283/303] Hall stories now also track where messages were received from. Stories can be queried for messages originating exclusively from a specific source. --- app/hall.hoon | 101 ++++++++++++++++++++++++++++++++------------- lib/hall-json.hoon | 2 +- sur/hall.hoon | 3 +- 3 files changed, 76 insertions(+), 30 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index 277b21cba0..b01b7fe5bc 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -41,6 +41,7 @@ $: count/@ud ::< (lent grams) grams/(list telegram) ::< all messages known/(map serial @ud) ::< messages heard + sourced/(map circle (list @ud)) ::< messages by circle sequence/(map circle @ud) ::< last-heard p circle locals/group ::< local status remotes/(map circle group) ::< remote status @@ -81,7 +82,7 @@ $% {$inherited ihr/?} ::< inherited flag {$follow sub/? srs/(set source)} ::< un/subscribe {$sequent cir/circle num/@ud} ::< update last-heard - {$gram gam/telegram} ::< new/changed msgs + {$gram src/circle gam/telegram} ::< new/changed msgs == == :: ::> || %out :: ::> outgoing data :: @@ -685,7 +686,7 @@ :: |= {nom/naem gam/telegram} %- (ta-know nom) |= sor/_so =< so-done - (so-learn:sor gam) + (so-learn:sor [our.bol nom] gam) :: ++ ta-transmit ::< send message ::> sends thought {tot} to {cir}. @@ -914,7 +915,9 @@ |= t/telegram ^- delta :+ %story nom - :- %gram + ::TODO this really should have sent us the message + :: src as well but that's not an easy fix. + :+ %gram [(above our.bol) nom] :: in audience, replace above with us. =- t(aud -) =+ (~(del in aud.t) [(above our.bol) nom]) @@ -1160,7 +1163,7 @@ :: |= {src/circle nes/(list envelope)} ^+ +> - =. +> (so-lesson (turn nes tail)) + =. +> (so-lesson src (turn nes tail)) =/ num %+ roll nes |= {nev/envelope max/@ud} @@ -1175,7 +1178,7 @@ :: |= {src/circle nev/envelope} ^+ +> - =. +> (so-learn gam.nev) + =. +> (so-learn src gam.nev) ?. (gth num.nev (fall (~(get by sequence) src) 0)) +> (so-delta-our %sequent src num.nev) @@ -1183,22 +1186,22 @@ ++ so-lesson ::< learn messages ::> learn all telegrams in a list. :: - |= gaz/(list telegram) + |= {src/circle gaz/(list telegram)} ^+ +> ?~ gaz +> - $(gaz t.gaz, +> (so-learn i.gaz)) + $(gaz t.gaz, +> (so-learn src i.gaz)) :: ++ so-learn ::< save/update message ::> store an incoming telegram, updating if it ::> already exists. :: - |= gam/telegram + |= {src/circle gam/telegram} ^+ +> :: check for write permissions. ?. (so-admire aut.gam) +> :: clean up the message to conform to our rules. =. sep.gam (so-sane sep.gam) - (so-delta-our %gram gam) + (so-delta-our %gram src gam) :: ::> || ::> || %permissions @@ -1567,7 +1570,7 @@ +>(sequence (~(put by sequence) cir.det num.det)) :: $gram - (sa-change-gram gam.det) + (sa-change-gram +.det) :: $config =. +> @@ -1589,11 +1592,18 @@ ::> apply a %gram delta, either appending or ::> updating a message. :: - |= gam/telegram + |= {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) + =. sourced + =+ sed=(fall (~(get by sourced) src) ~) + ?~ old (~(put by sourced) src [count sed]) + ?^ (find ~[u.old] sed) sourced + %+ ~(put by sourced) src + :- count + (fall (~(get by sourced) src) ~) ?~ old :: new message %_ +>.$ @@ -1888,7 +1898,16 @@ :+ ~ ~ :- %circle :+ %+ turn - (~(so-first-grams so:ta nom.qer ~ u.soy) ran.qer) + =- (~(so-first-grams so:ta nom.qer ~ -) ran.qer) + ::TODO this can be done more efficiently. + ?~ wer.qer u.soy + %_ u.soy + grams + ?. (~(has by sourced.u.soy) u.wer.qer) ~ + %+ turn (~(got by sourced.u.soy) u.wer.qer) + |= n/@ud + (snag (sub count.u.soy +(n)) grams.u.soy) + == (cury gram-to-envelope nom.qer) :- shape.u.soy ?. (~(has in wat.qer) %config-r) ~ @@ -1912,7 +1931,10 @@ $sequent !! :: $gram - :- %gram + :+ %gram + ?. =(src.det [our.bol nom]) + src.det + [who nom] %+ gram-to-envelope nom %_ gam.det aud @@ -1947,17 +1969,30 @@ ++ circle-feel-story ::< ::> :: - |= {wat/(set circle-data) nom/naem det/delta-story} + |= $: wer/(unit circle) + wat/(set circle-data) + nom/naem + det/delta-story + == ^- ? - ?: =(wat ~) & - %- ~(has in wat) - ?+ -.det %hasnot - $gram %grams - $new %config-l - $config ?: =(cir.det [our.bol nom]) - %config-l %config-r - $status ?: =(cir.det [our.bol nom]) - %group-l %group-r + ?& + ?~ wer & + ?+ -.det & + $gram =(src.det u.wer) + $config =(cir.det u.wer) + $status =(cir.det u.wer) + == + :: + ?: =(wat ~) & + %- ~(has in wat) + ?+ -.det %hasnot + $gram %grams + $new %config-l + $config ?: =(cir.det [our.bol nom]) + %config-l %config-r + $status ?: =(cir.det [our.bol nom]) + %group-l %group-r + == == :: ++ feel ::< delta to rumor @@ -2008,7 +2043,8 @@ $circle ?. ?=($story -.det) ~ ?. =(nom.qer nom.det) ~ - ?. (circle-feel-story wat.qer nom.det det.det) ~ + ?. %- circle-feel-story + [wer.qer wat.qer nom.det det.det] ~ =/ sor (~(got by stories) nom.qer) ?. =< in %. ran.qer ~(so-in-range so:ta nom.qer ~ sor) ~ @@ -2016,7 +2052,8 @@ :+ ~ %circle ?+ det.det det.det {$gram *} - [%gram (gram-to-envelope nom.det gam.det.det)] + :+ %gram src.det.det + (gram-to-envelope nom.det gam.det.det) == == :: @@ -2058,9 +2095,16 @@ |= pax/path ?. ?=({$circle @tas *} pax) (coins-to-query (path-to-coins pax)) - =/ qer/query [%circle i.t.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... @@ -2300,6 +2344,7 @@ ++ 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. :: |= nom/naem ^- (quip move _+>) @@ -2330,7 +2375,7 @@ %- pre-bake %+ turn (flop grams) |= t/telegram - [%story nom %gram t] + [%story nom %gram [our.bol nom] t] :: ++ poke-hall-load ::< load from log ::> loads the telegrams of story {nom} into our state, @@ -2346,7 +2391,7 @@ %- pre-bake %+ turn grams |= t/telegram - [%story nom %gram t] + [%story nom %gram [our.bol nom] t] :: ++ poke-hall-log ::< start logging ::> starts logging story {nom}'s messages. diff --git a/lib/hall-json.hoon b/lib/hall-json.hoon index 90521e3f49..78065687c2 100644 --- a/lib/hall-json.hoon +++ b/lib/hall-json.hoon @@ -426,7 +426,7 @@ config+(ot cir+circ dif+dico ~) status+(ot cir+circ who+(su fed:ag) dif+disa ~) remove+ul - gram+enve + gram+(ot src+circ nev+enve ~) == :: ++ dico ::> diff-config diff --git a/sur/hall.hoon b/sur/hall.hoon index 3cba83ff49..50405c2702 100644 --- a/sur/hall.hoon +++ b/sur/hall.hoon @@ -31,6 +31,7 @@ {$peers nom/naem} ::< readers of story $: $circle ::> story query nom/naem ::< circle name + wer/(unit circle) ::< including target wat/(set circle-data) ::< data to get ran/range ::< query duration == :: @@ -100,7 +101,7 @@ == :: ++ rumor-story ::> story rumor $? diff-story ::< both in & outward - $% {$gram nev/envelope} ::< new/changed msgs + $% {$gram src/circle nev/envelope} ::< new/changed message == == :: ++ diff-config ::> config change $% {$full cof/config} ::< set w/o side-effects From caac75dc65821176408256fb78ef94e2483d1eea Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 20 Nov 2017 21:44:22 +0100 Subject: [PATCH 284/303] No longer require %inbox membership to be able to list a circle in one's public memberships. --- app/hall.hoon | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index b01b7fe5bc..c64e5ffeca 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -395,33 +395,6 @@ ::> add/remove {pos} as sources for story {nom}. :: |= {nom/naem sub/? srs/(set source)} - :: when removing sources from %inbox, we may need - :: to remove them from {public} too. - =? ..ta-action &(=(nom %inbox) !sub) - ^+ ..ta-action - =+ srs=~(tap in srs) - |- ^+ ..ta-action - ?~ srs ..ta-action - =; last/? - =? ..ta-action last - (action-public | cir.i.srs) - $(srs t.srs) - %- ~(rep in src.shape:(~(got by stories) nom)) - |= {s/source l/?} - ?. l | - ?. =(cir.s cir.i.srs) & - =(ran.s ran.i.srs) - :: below eats state - ::%- ~(rep in srs) - ::|= {src/source _..ta-action} - ::^+ ..ta-action - :::: delete from public if it's the last source. - ::=; last/? ?:(last (action-public | cir.src) ..ta-action) - ::%- ~(rep in src.shape:(~(got by stories) nom)) - ::|= {s/source l/?} - ::?. l | - ::?. =(cir.s cir.src) & - ::=(ran.s ran.src) =+ soy=(~(get by stories) nom) ?~ soy (ta-evil (crip "no story {(trip nom)}")) @@ -490,14 +463,6 @@ ::> membership list. :: |= {add/? cir/circle} - =/ has/? - %- ~(rep in src.shape:(~(got by stories) %inbox)) - |= {src/source has/?} - ?: has & - =(cir cir.src) - ?. has - %- ta-note - "currently not in {(scow %p hos.cir)}/{(trip nom.cir)}" (ta-delta %public add cir) -- :: From afa8402f2fc6b0f2fc964656992c4715782a346a Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 22 Nov 2017 18:51:12 +0100 Subject: [PATCH 285/303] Updated ++sa-unearth to correctly work with current subscription paths. --- app/hall.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index c64e5ffeca..274775da27 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -1695,8 +1695,8 @@ %- ~(rep in sup.bol) |= {{b/bone s/ship p/path} c/(set bone)} ?. ?& (~(has in sis) s) - ?=({@tas *} p) - =(i.p nom) + ?=({$circle @tas *} p) + =(i.t.p nom) == c (~(put in c) b) From a03a5d2feb96407ee7c588e111e4b4d811054f79 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 22 Nov 2017 20:22:08 +0100 Subject: [PATCH 286/303] Now need write permission to indicate presence. --- app/hall.hoon | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index 274775da27..90718935e9 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -253,15 +253,20 @@ == :: ++ ta-present ::< update a status - ::> + ::> sets status for the indicated stories, + ::> but only if they have write permission there. :: |= {who/ship nos/(set naem) dif/diff-status} ^+ +> %- ta-deltas - %- ~(rep in nos) - |= {n/naem l/(list delta)} - :_ l - [%story n %status [our.bol n] who dif] + %+ murn ~(tap in nos) + |= n/naem + ^- (unit delta) + ?. (~(has by stories) n) ~ + :: only have presence if you have write permission. + ?. (~(so-admire so n ~ (~(got by stories) n)) who) + ~ + `[%story n %status [our.bol n] who dif] :: ++ ta-action ::< apply client action ::> performs action sent by a client. From 974d1e1026ae3e80cf7992645842841f2586a701 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 22 Nov 2017 20:40:20 +0100 Subject: [PATCH 287/303] No longer send out multiple messages when inviting multiple people. --- app/hall.hoon | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index 90718935e9..7bba00dfd3 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -1193,12 +1193,10 @@ ?:(add ~(dif in sis) ~(int in sis)) ?~ sus +>.$ =. +>.$ - %- so-act - :- %phrase + =- (so-act [%phrase - [%inv inv so-cir]~]) %- ~(rep in `(set ship)`sus) - |= {s/ship a/audience t/(list speech)} - :- (~(put in a) [s %inbox]) - [[%inv inv so-cir] t] + |= {s/ship a/audience} + (~(put in a) [s %inbox]) (so-delta-our %config so-cir %permit [add sus]) :: ++ so-admire ::< accept from From 1771a56e367471adc44320d550f00836629af0b7 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 22 Nov 2017 20:56:04 +0100 Subject: [PATCH 288/303] Now also send invite messages to people who have already been invited. To allow for hosts to notify/remind people they can join. --- app/hall.hoon | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index 7bba00dfd3..a0cc0e3143 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -1191,12 +1191,15 @@ =/ sus/(set ship) %. sis.con.shape ?:(add ~(dif in sis) ~(int in sis)) - ?~ sus +>.$ =. +>.$ + :: if banishing: notify only those affected. + :: if inviting: notify all targets. + =? sis !inv sus =- (so-act [%phrase - [%inv inv so-cir]~]) - %- ~(rep in `(set ship)`sus) + %- ~(rep in `(set ship)`sis) |= {s/ship a/audience} (~(put in a) [s %inbox]) + ?~ sus +>.$ (so-delta-our %config so-cir %permit [add sus]) :: ++ so-admire ::< accept from From 52c6805879bb5463c4232fdc50c78c55196742e9 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 22 Nov 2017 23:23:16 +0100 Subject: [PATCH 289/303] Now remove people's presence when they get banished. --- app/hall.hoon | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/hall.hoon b/app/hall.hoon index a0cc0e3143..8bbcee0092 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -1200,6 +1200,13 @@ |= {s/ship a/audience} (~(put in a) [s %inbox]) ?~ 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 From 7d13f01633c98635f988d68174028e1ed65ba0e0 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 23 Nov 2017 13:31:59 +0100 Subject: [PATCH 290/303] Removed unused delta %quit. --- app/hall.hoon | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index 8bbcee0092..e7e9940110 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -75,7 +75,6 @@ nos/(set naem) :: dif/diff-status :: == :: - {$quit ost/bone} ::< force unsubscribe == :: ++ delta-story ::> story delta $? diff-story ::< both in & outward @@ -1309,7 +1308,6 @@ $init da-init $observe (da-observe +.det) $present (da-present +.det) - $quit (da-emit [ost.det %quit ~]) == :: ++ da-init ::< startup side-effects From a2cf78a51076a5563c3a40c2e86b5e0a2e60e8a0 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 24 Nov 2017 00:43:16 +0100 Subject: [PATCH 291/303] Made situations where forced unsubscribes occur (;banish, ;delete) actually work. We no longer resubscribe when a foreign source quits our subscription. We don't always want to do this for local quits either, but can't differentiate. So for now, we pull local subs instead of quitting them. Depends on urbit/arvo#459 --- app/hall.hoon | 89 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 68 insertions(+), 21 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index e7e9940110..b828b7a843 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -92,6 +92,7 @@ == :: ++ pear ::> poke fruit $% {$hall-command command} :: + {$hall-action action} ::TODO see ++gentle-quit == :: ++ card ::> general card $% {$diff lime} :: @@ -1502,7 +1503,9 @@ ::> apply a %remove story delta, unsubscribing ::> this story from all its active sources. :: - (sa-abjure src.shape) + %+ weld + (sa-abjure src.shape) + (sa-eject ~(key by peers)) :: ++ sa-change ::< apply circle delta ::> figure out whether to apply a %story delta to @@ -1673,17 +1676,18 @@ ^- (unit move) ?: =(cir sa-cir) ~ :: ignore self-subs =+ wat=~[%grams %config-l %group-l] - `(wire-to-peer (sa-circle-wire wat cir ran)) + `(wire-to-peer (circle-wire nom wat cir ran)) :: ++ sa-abjure ::< unsubscribe us ::> unsubscribes this story from each circle. :: |= srs/(set source) + ^- (list move) %+ turn ~(tap in srs) |= {cir/circle ran/range} ^- move =/ wir - %+ sa-circle-wire + %^ circle-wire nom ~[%grams %config-l %group-l] [cir ran] [0 %pull wir [hos.cir dap.bol] ~] @@ -1693,9 +1697,16 @@ :: |= sis/(set ship) ^- (list move) - %+ turn ~(tap in (sa-unearth sis)) - |= {b/bone} - [b %quit ~] + %- zing + %+ turn ~(tap in sup.bol) + |= {b/bone s/ship p/path} + ^- (list move) + ?. ?& (~(has in sis) s) + ?=({$circle @tas *} p) + =(i.t.p nom) + == + ~ + (gentle-quit b s (path-to-query p)) :: ++ sa-unearth ::< ships' bones ::> find the bones in {sup.bol} that belong to @@ -1711,18 +1722,6 @@ == c (~(put in c) b) - :: - ++ sa-circle-wire ::< /circle peer wire - ::> constructs a /circle %peer path for subscribing - ::> {nom} to a source. - :: - |= {wat/(list circle-data) source} - ^- wire - ;: weld - /circle/[nom]/(scot %p hos.cir)/[nom.cir] - wat - (range-to-path ran) - == -- -- :: @@ -1732,6 +1731,18 @@ ::> || ::+| :: +++ circle-wire ::< /circle peer wire + ::> constructs a /circle %peer path for subscribing + ::> {nom} to a source. + :: + |= {nom/naem wat/(list circle-data) source} + ^- wire + ;: weld + /circle/[nom]/(scot %p hos.cir)/[nom.cir] + (sort wat gth) :: consistence + (range-to-path ran) + == +:: ++ wire-to-peer ::< peer move from wire ::> builds the peer move associated with the wire. :: @@ -1804,6 +1815,38 @@ =+ 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) + :: + |= {bon/bone who/ship qer/query} + ^- (list move) + ?. ?=($circle -.qer) ~ + ?. =(who our.bol) [bon %quit ~]~ + %- zing + %+ turn ~(tap in ~(key by stories)) + |= n/naem + ^- (list move) + :~ :^ 0 %poke / + :+ [our.bol dap.bol] %hall-action + :^ %source n | + [[[our.bol nom.qer] ran.qer] ~ ~] + :: + :^ 0 %pull + %^ circle-wire n ~(tap in wat.qer) + [[our.bol nom.qer] ran.qer] + [[our.bol dap.bol] ~] + == +:: ::> || ::> || %new-events ::> || @@ -1994,6 +2037,7 @@ ?. ?=($story -.det) ~ ?: ?=(?($follow $inherited $sequent) -.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)] :: @@ -2055,11 +2099,10 @@ ?~ rum ~ [b %diff %hall-rumor u.rum]~ ?. ?=($circle -.qer) ~ - =+ qit=[b %quit ~]~ :: kill the subscription if we forgot the story. - ?. (~(has by stories) nom.qer) qit + ?. (~(has by stories) nom.qer) (gentle-quit b s qer) :: kill the subscription if it's past its range. - =- ?:(done:- qit ~) + =- ?:(done:- (gentle-quit b s qer) ~) %. ran.qer =- ~(so-in-range so:ta nom.qer ~ -) (~(got by stories) nom.qer) @@ -2289,6 +2332,7 @@ |= wir/wire ^- (quip move _+>) :_ +> + ?. =(src.bol our.bol) ~ [(wire-to-peer wir) ~] :: ++ quit-circle ::< dropped circle sub @@ -2299,6 +2343,9 @@ %+ etch-circle [%circle wir] |= {nom/naem src/source} %- pre-bake + :: when we got kicked, don't resub, remove source. + ?. =(src.bol our.bol) + ta-done:(ta-action:ta 0 %source nom | [src ~ ~]) ta-done:(ta-resub:ta nom src) :: ++ coup-repeat ::< message n/ack From f13979d1f2363f1de08da597c3784e158ad8d590 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 24 Nov 2017 00:46:00 +0100 Subject: [PATCH 292/303] ++ta-action no longer requires a bone it doesn't even use. --- app/hall.hoon | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index b828b7a843..6393307f6d 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -174,7 +174,7 @@ ::> inbox. :: |= msg/tape - %^ ta-action 0 %phrase + %+ ta-action %phrase :- [[our.bol %inbox] ~ ~] [%app dap.bol %lin | (crip msg)]~ :: @@ -222,8 +222,7 @@ [%journal %public 'visible activity'] == |= {{typ/security nom/naem des/cord} _ta} - %+ ta-action ost.bol - [%create nom des typ] + (ta-action [%create nom des typ]) %- ta-deltas :: if needed, subscribe to our parent's /burden. =+ sen=(above our.bol) @@ -271,7 +270,7 @@ ++ ta-action ::< apply client action ::> performs action sent by a client. :: - |= {red/bone act/action} + |= act/action ^+ +> =< work ::> || @@ -534,7 +533,7 @@ =. acs (flop acs) |- ^+ ..ta-take ?~ acs ..ta-take - =. ..ta-take (ta-action ost.bol i.acs) + =. ..ta-take (ta-action i.acs) $(acs t.acs) $(sos t.sos) ::TODO runtime error @@ -575,7 +574,7 @@ =. acs (flop acs) |- ^+ +>+ ?~ acs +>+ - =. +>+ (ta-action ost.bol i.acs) + =. +>+ (ta-action i.acs) $(acs t.acs) ::TODO runtime error ::=< so-done @@ -691,7 +690,7 @@ =. acs (flop acs) |- ^+ +>+ ?~ acs +>+ - =. +>+ (ta-action ost.bol i.acs) + =. +>+ (ta-action i.acs) $(acs t.acs) :: ::> || @@ -2220,7 +2219,7 @@ "hall-action stranger {(scow %p src.bol)}" =^ mos +>.$ %- pre-bake - ta-done:(ta-action:ta ost.bol act) + ta-done:(ta-action:ta act) =^ mow +>.$ log-all-to-file [(welp mos mow) +>.$] @@ -2345,7 +2344,7 @@ %- pre-bake :: when we got kicked, don't resub, remove source. ?. =(src.bol our.bol) - ta-done:(ta-action:ta 0 %source nom | [src ~ ~]) + ta-done:(ta-action:ta %source nom | [src ~ ~]) ta-done:(ta-resub:ta nom src) :: ++ coup-repeat ::< message n/ack From e14e9dfea572487bc4ecbf2cfcdc0df8ad091fa4 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 24 Nov 2017 00:46:41 +0100 Subject: [PATCH 293/303] Comments, minor cleanup. --- app/hall.hoon | 5 ++--- sur/hall.hoon | 10 +++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index 6393307f6d..cf7a9e0f01 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -2297,7 +2297,6 @@ ::> someone ends a /circle subscription. :: |= pax/path - ~& [%got-pull-circle pax] ^- (quip move _+>) %- pre-bake :_ ~ @@ -2308,7 +2307,7 @@ :: ++ reap ::< subscription n/ack ::> update state to reflect subscription success - ::: + :: |= {wir/wire fal/(unit tang)} ^- (quip move _+>) ?. ?=($circle -.wir) @@ -2320,7 +2319,7 @@ ?~ fal %- pre-bake ta-done:(ta-greet:ta nom src) - =. u.fal [>%reap-circle-fail nom src< u.fal] + =. u.fal [>%failed-subscribe nom src< u.fal] %- (slog (flop u.fal)) %- pre-bake ta-done:(ta-leave:ta nom src) diff --git a/sur/hall.hoon b/sur/hall.hoon index 50405c2702..f8fa5c812b 100644 --- a/sur/hall.hoon +++ b/sur/hall.hoon @@ -31,7 +31,7 @@ {$peers nom/naem} ::< readers of story $: $circle ::> story query nom/naem ::< circle name - wer/(unit circle) ::< including target + wer/(unit circle) ::< from source wat/(set circle-data) ::< data to get ran/range ::< query duration == :: @@ -62,18 +62,18 @@ {$peers pes/(jar ship query)} ::< /peers {$circle package} ::< /circle == :: -++ prize-client :: +++ prize-client ::> shared ui state $: gys/(jug char audience) ::< glyph bindings nis/(map ship nick) ::< local nicknames == :: -++ rumor ::< query result change +++ rumor ::> query result change $% {$client rum/rumor-client} ::< /client {$public add/? cir/circle} ::< /public {$burden nom/naem rum/rumor-story} ::< /burden {$peers add/? who/ship qer/query} ::< /peers {$circle rum/rumor-story} ::< /circle == :: -++ rumor-client ::< changed ui state +++ rumor-client ::> changed ui state $% {$glyph diff-glyph} ::< un/bound glyph {$nick diff-nick} ::< changed nickname == :: @@ -85,7 +85,7 @@ $: gaz/(list telegram) ::< all messages shipment ::< metadata == :: -++ package ::< story state +++ package ::> story state $: nes/(list envelope) ::< messages shipment ::< metadata == :: From 1b7aae8631cc23132363e5193a7427d43fffa040 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 24 Nov 2017 20:34:46 +0100 Subject: [PATCH 294/303] Implemented /circles, for querying visible circles on ships. --- app/hall.hoon | 32 ++++++++++++++++++++++++++++++++ mar/hall/prize.hoon | 8 +++++--- mar/hall/rumor.hoon | 8 +++++--- sur/hall.hoon | 3 +++ 4 files changed, 45 insertions(+), 6 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index cf7a9e0f01..8bdc58d97c 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -1882,6 +1882,14 @@ ?- -.qer $client ``[%client binds nicks] + :: + $circles + =- ``[%circles -] + %- ~(gas in *(set naem)) + %+ murn ~(tap by stories) + |= {n/naem s/story} + ^- (unit naem) + ?:((~(so-visible so:ta n ~ s) who.qer) `n ~) :: $public ``[%public public] @@ -2026,6 +2034,28 @@ $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.. + ?: ?=($remove -.det.det) `| + =+ soy=(~(got by stories) 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) + == + == + ~ + `(~(so-visible so:ta nom.det ~ soy) who.qer) :: $public ?. ?=($public -.det) ~ @@ -2160,6 +2190,7 @@ => depa |^ %- af :~ [%client ul] + [%circles (at /[%p])] [%public ul] [%burden (at /[%p])] [%report ul] @@ -2177,6 +2208,7 @@ ^- ? ?- -.qer $client (team:title our.bol who) + $circles =(who who.qer) $public & $burden ?& =(who who.qer) =(our.bol (above who)) diff --git a/mar/hall/prize.hoon b/mar/hall/prize.hoon index 468e2729a1..6b92157fe2 100644 --- a/mar/hall/prize.hoon +++ b/mar/hall/prize.hoon @@ -16,6 +16,7 @@ ^- prize:hall =- (need ((of -) a)) :~ client+pici + circles+(as so) public+(as circ) :: burden not needed :: report not needed @@ -30,11 +31,12 @@ =, enjs:format %+ frond -.piz ?+ -.piz !! - $client (pici +.piz) - $public (sa cis.piz circ) + $client (pici +.piz) + $circles (sa cis.piz cord:enjs:hall-json) + $public (sa cis.piz circ) :: burden not needed :: report not needed - $circle (pack +.piz) + $circle (pack +.piz) == -- -- diff --git a/mar/hall/rumor.hoon b/mar/hall/rumor.hoon index c100df639b..a354713bb1 100644 --- a/mar/hall/rumor.hoon +++ b/mar/hall/rumor.hoon @@ -16,6 +16,7 @@ ^- rumor:hall =- (need ((of -) a)) :~ client+ruci + circles+(ot add+bo cir+so ~) public+(ot add+bo cir+circ ~) :: burden not needed circle+ruso @@ -29,10 +30,11 @@ =, enjs:format %+ frond -.rum ?+ -.rum !! - $client (ruci rum.rum) - $public (pairs add+b+add.rum cir+(circ cir.rum) ~) + $client (ruci rum.rum) + $circles (pairs add+b+add.rum cir+s+cir.rum ~) + $public (pairs add+b+add.rum cir+(circ cir.rum) ~) :: burden not needed - $circle (ruso rum.rum) + $circle (ruso rum.rum) == -- -- diff --git a/sur/hall.hoon b/sur/hall.hoon index f8fa5c812b..6887c32911 100644 --- a/sur/hall.hoon +++ b/sur/hall.hoon @@ -25,6 +25,7 @@ :: ++ query ::> query paths $% {$client $~} ::< shared ui state + {$circles who/ship} ::< readable circles {$public $~} ::< public memberships {$burden who/ship} ::TODO eventually, nom/naem. ::< duties to share {$report $~} ::< duty reports @@ -56,6 +57,7 @@ == :: ++ prize ::> query result $% {$client prize-client} ::< /client + {$circles cis/(set naem)} ::< /circles {$public cis/(set circle)} ::< /public {$burden sos/(map naem burden)} ::< /burden {$report $~} ::< /report @@ -68,6 +70,7 @@ == :: ++ rumor ::> query result change $% {$client rum/rumor-client} ::< /client + {$circles add/? cir/naem} ::< /circles {$public add/? cir/circle} ::< /public {$burden nom/naem rum/rumor-story} ::< /burden {$peers add/? who/ship qer/query} ::< /peers From ed257a9df7633635ec2b736c3c561bf86cd7281b Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 24 Nov 2017 23:05:12 +0100 Subject: [PATCH 295/303] Talk now only assigns a glyph and sends presence when ;joins succeed. --- app/talk.hoon | 62 ++++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/app/talk.hoon b/app/talk.hoon index 7ed0c33214..fcc13382f0 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -2,10 +2,6 @@ :::: /app/talk/hoon :: :: :: :: :: :: -::TODO make sure glyphs only get bound when joins succeed -:: ...this is a bit troublesome, because failed joins don't actually -:: unsubscribe us. -:: ::TODO maybe keep track of received grams per circle, too? :: ::TODO [type query] => [press tab to cycle search results, newest-first] @@ -176,6 +172,20 @@ |= {a/char b/(set audience)} (turn ~(tap by b) |=(c/audience [c a])) :: +++ glyph ::< grab 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] +:: ::> || ::> || %engines ::> || @@ -325,11 +335,24 @@ =< sh-done %- ~(sh-show-config sh cli) [cir.rum cur dif.rum] + =? +>.$ &(?=($source -.dif.rum) add.dif.rum) + =* cir cir.src.dif.rum + =+ ren=~(cr-phat cr cir) + =+ gyf=(~(get by bound) [cir ~ ~]) + =< sh-done + => :_ . + %- ~(sh-act sh cli) + [%notify [cir ~ ~] `%hear] + ?^ gyf + (sh-note "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 %bind cha `[cir ~ ~]) %= +>.$ sources - ?. ?& ?=($source -.dif.rum) - =(cir.rum incir) - == + ?. &(?=($source -.dif.rum) =(cir.rum incir)) sources %. cir.src.dif.rum ?: add.dif.rum @@ -952,20 +975,6 @@ =- ?:((lte - max) - (sub - dog)) (add fin (sub max (mod max dog))) :: - ++ glyph ::< grab 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] - :: ++ set-glyph ::< new glyph binding ::> applies glyph binding to our state and sends ::> an action. @@ -974,7 +983,7 @@ =: bound (~(put by bound) aud cha) binds (~(put ju binds) cha aud) == - (sh-act %glyph cha aud &) + sh-prod:(sh-act %glyph cha aud &) :: ++ unset-glyph ::< old glyph binding ::> removes either {aud} or all bindings on a @@ -1024,16 +1033,9 @@ |= pos/(map circle range) ^+ ..sh-work =+ pas=~(key by pos) - =. ..sh-work - =+ (~(get by bound) pas) - ?^ - (sh-note "has glyph {}") - =+ cha=(glyph (mug pas)) - (sh-note:(set-glyph cha pas) "new glyph {}") =. ..sh-work sh-prod(active.she pas) - =. ..sh-work - (sh-act %source inbox & pos) - (sh-act %notify ~(key by pos) `%hear) + (sh-act %source inbox & pos) :: ++ leave ::< %leave ::> change local mailbox config to exclude From 87ba3ef47269b82b6b37b919ec0d71ce4753b2da Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 24 Nov 2017 23:05:41 +0100 Subject: [PATCH 296/303] Less ugly glyph rendering in ++cr-show. --- app/talk.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/talk.hoon b/app/talk.hoon index fcc13382f0..05d4d220ec 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -1793,7 +1793,7 @@ :: render circle (as glyph if we can). ?~ moy =+ cha=(~(get by bound) one ~ ~) - =- ?~(cha - "'{u.cha ~}' {-}") + =- ?~(cha - "{u.cha ~} {-}") ~(cr-phat cr one) (~(cr-curt cr one) u.moy) -- From 07885a3c988e8ee264b0f32a7624550fe2fe057b Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 5 Dec 2017 22:32:55 +0100 Subject: [PATCH 297/303] Removed version requirements from hall and talk. Also small comment cleanup. --- app/hall.hoon | 1 - app/talk.hoon | 3 +-- lib/hall.hoon | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/app/hall.hoon b/app/hall.hoon index 8bdc58d97c..a483642c92 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -12,7 +12,6 @@ :: presence when we sub to someplace, and remove that when we unsub, but :: don't make the target source do that. :: -/? 151 ::< hoon version /- hall ::< structures /+ hall, hall-legacy ::< libraries /= seed /~ !>(.) diff --git a/app/talk.hoon b/app/talk.hoon index a39c8b3d48..34bc813334 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -13,7 +13,6 @@ ::> since that's the only thing the client ever ::> subscribes to. :: -/? 151 ::< hoon version /- hall, sole ::< structures /+ hall, sole ::< libraries /= seed /~ !>(.) @@ -501,7 +500,7 @@ +>(moves [[id.she %diff %sole-effect fec] moves]) :: ++ sh-act ::< send action - ::> adds an aaction to ++ta's moves. + ::> adds an action to ++ta's moves. :: |= act/action ^+ +> diff --git a/lib/hall.hoon b/lib/hall.hoon index e559773a33..f626b840d9 100644 --- a/lib/hall.hoon +++ b/lib/hall.hoon @@ -3,7 +3,6 @@ :: :: This file is in the public domain. :: -/? 310 /- hall :: :::: From 122362e732a3f5f29a89196c88de2de5a01733cd Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 6 Dec 2017 00:19:56 +0100 Subject: [PATCH 298/303] Fixed syntax error introduced into hood.hoon. --- app/hood.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/hood.hoon b/app/hood.hoon index 1961ad9738..0dfdbd2266 100644 --- a/app/hood.hoon +++ b/app/hood.hoon @@ -2,7 +2,7 @@ :::: /hoon/hood/app :: :: :: :: :: /? 310 :: zuse version -/+ sole :: libraries +/+ 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 From 3ecd88517721765f9f7a8393ca574331b3297b5e Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 6 Dec 2017 12:30:19 +0100 Subject: [PATCH 299/303] Now properly avoids sending burden updates to the reporter again. --- app/hall.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/hall.hoon b/app/hall.hoon index a483642c92..7c61b45eaf 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -2061,8 +2061,8 @@ `det :: $burden - ?: &(=(who.qer src.bol) =(rir /(scot %p src.bol)/report)) ~ ?. ?=($story -.det) ~ + ?: &(=(who.qer src.bol) =(rir /report/(scot %p src.bol))) ~ ?: ?=(?($follow $inherited $sequent) -.det.det) ~ :: only burden channels for now. ?. (~(has by stories) nom.det) ~ From 27db17d1a4bf1e45bb70eac8c1e7b0494915babf Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 6 Dec 2017 16:54:08 +0100 Subject: [PATCH 300/303] Fixed incorrect usage of ++team:title. --- app/hall.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/hall.hoon b/app/hall.hoon index 7c61b45eaf..4d2ac28875 100644 --- a/app/hall.hoon +++ b/app/hall.hoon @@ -2243,7 +2243,7 @@ :: |= act/action ^- (quip move _+>) - ?. (team:title src.bol our.bol) + ?. (team:title our.bol src.bol) %- pre-bake =< ta-done %- ta-note:ta From 1287c044431fbb8881485df926f452472d918dfb Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 6 Dec 2017 17:09:59 +0100 Subject: [PATCH 301/303] The talk interface now properly pretends to be the planet when run on a moon. --- app/talk.hoon | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/app/talk.hoon b/app/talk.hoon index 34bc813334..26919c0716 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -126,10 +126,12 @@ ::> small utility functions. ::+| :: +++ our + (true-self our.bol) +:: ++ server ::< our hall instance ^- dock - :_ %hall - (true-self our.bol) + [our %hall] :: ++ inbox ::< client's circle name ::> produces the name of the circle used by this @@ -140,8 +142,7 @@ ++ incir ::< client's circle ::> ++inbox, except a full circle. ^- circle - :_ inbox - (true-self our.bol) + [our inbox] :: ++ renum ::< gram i# by serial ::> find the grams list index for gram with serial. @@ -582,8 +583,8 @@ ++ circ ::< circle ;~ pose (cold incir col) - ;~(pfix cen (stag our.bol sym)) - ;~(pfix fas (stag (sein:title our.bol) sym)) + ;~(pfix cen (stag our sym)) + ;~(pfix fas (stag (sein:title our) sym)) :: %+ cook |= {a/@p b/(unit term)} @@ -1018,7 +1019,7 @@ :: ^- vase !> ^- {our/@p now/@da eny/@uvI} - [our.bol now.bol (shas %eny eny.bol)] + [our now.bol (shas %eny eny.bol)] :: ::> || ::> || %circle-management @@ -1056,7 +1057,7 @@ ^+ ..sh-work =. ..sh-work (sh-act %create nom txt sec) - (join [[[our.bol nom] ~] ~ ~]) + (join [[[our nom] ~] ~ ~]) :: ++ delete ::< %delete ::> deletes our circle {nom}, after optionally @@ -1556,7 +1557,7 @@ ?~ lis +>.$ %+ sh-fact %mor %+ turn `(list tape)`lis - =+ nom=(scag 7 (cite:title our.bol)) + =+ nom=(scag 7 (cite:title our)) |= t/tape ?. ?& (~(has in settings.she) %notify) ?=(^ (find nom (slag 15 t))) @@ -1710,8 +1711,8 @@ |= two/circle ^- ? :: the circle that's ours is better. - ?: =(our.bol hos.one) - ?. =(our.bol hos.two) & + ?: =(our hos.one) + ?. =(our hos.two) & ?< =(nom.one nom.two) :: if both circles are ours, the main story is better. ?: =(%inbox nom.one) & @@ -1719,7 +1720,7 @@ :: if neither are, pick the "larger" one. (lth nom.one nom.two) :: if one isn't ours but two is, two is better. - ?: =(our.bol hos.two) | + ?: =(our hos.two) | ?: =(hos.one hos.two) :: if they're from the same ship, pick the "larger" one. (lth nom.one nom.two) @@ -1770,14 +1771,14 @@ ::> "/channel" for parent circle. :: ^- tape - ?: =(hos.one our.bol) + ?: =(hos.one our) ?: =(nom.one inbox) ":" ['%' (trip nom.one)] =+ wun=(cite:title hos.one) ?: =(nom.one %inbox) wun - ?: =(hos.one (sein:title our.bol)) + ?: =(hos.one (sein:title our)) ['/' (trip nom.one)] :(welp wun "/" (trip nom.one)) :: @@ -1869,7 +1870,7 @@ ::> returns true if circle is a mailbox of ours. :: |= cir/circle ^- ? - ?& =(hos.cir our.bol) + ?& =(hos.cir our) =+ sot=(~(get by mirrors) cir) &(?=(^ sot) ?=($mailbox sec.con.u.sot)) == @@ -2109,7 +2110,7 @@ ?: pat.sep " " =- (weld - q:(fall pre [p=| q=" "])) %~ ar-glyf ar - ?: =(who our.bol) aud + ?: =(who our) aud (~(del in aud) [who %inbox]) == =. wyd (sub wyd (min (div wyd 2) (lent pef))) From 2a2f2a22119c7984ebecb2d5884972c812c0d4f2 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 6 Dec 2017 17:10:24 +0100 Subject: [PATCH 302/303] Removed public domain notice. --- lib/hall.hoon | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/hall.hoon b/lib/hall.hoon index f626b840d9..dbde94209d 100644 --- a/lib/hall.hoon +++ b/lib/hall.hoon @@ -1,8 +1,6 @@ :: :::: /lib/hall/hoon :: - :: This file is in the public domain. - :: /- hall :: :::: From 33ef3928dd528daee5c74d9fbb926d2a519bd0d6 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 6 Dec 2017 14:24:24 -0800 Subject: [PATCH 303/303] fix fora import --- app/fora.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/fora.hoon b/app/fora.hoon index 8d2a03bae2..f91932e1ed 100644 --- a/app/fora.hoon +++ b/app/fora.hoon @@ -4,7 +4,7 @@ ::TODO maybe stop relying on %hood one day. :: /- hall -/+ hall, write, time-to-id +/+ hall, time-to-id =, format =, title ::