diff --git a/pkg/arvo/app/chat-cli.hoon b/pkg/arvo/app/chat-cli.hoon index 6ff7667a5..d5cef8823 100644 --- a/pkg/arvo/app/chat-cli.hoon +++ b/pkg/arvo/app/chat-cli.hoon @@ -10,7 +10,7 @@ :: and trust it to take care of the rest. :: /- view=chat-view, hook=chat-hook, *group, - *permission-store, *group-store, *invite-store, + *permission-store, *group-store, inv=invite-store, sole /+ shoe, default-agent, verb, dbug, store=chat-store, group-store, grpl=group, resource @@ -27,7 +27,7 @@ +$ state-2 $: %2 grams=(list mail) :: all messages - known=(set [target serial]) :: known message lookup + known=(set [target serial:store]) :: known message lookup count=@ud :: (lent grams) bound=(map target glyph) :: bound circle glyphs binds=(jug glyph target) :: circle glyph lookup @@ -54,7 +54,7 @@ :: +$ state-0 $: grams=(list [[=ship =path] envelope:store]) :: all messages - known=(set [[=ship =path] serial]) :: known message lookup + known=(set [[=ship =path] serial:store]) :: known message lookup count=@ud :: (lent grams) bound=(map [=ship =path] glyph) :: bound circle glyphs binds=(jug glyph [=ship =path]) :: circle glyph lookup @@ -161,7 +161,7 @@ %fact ?+ p.cage.sign ~|([%chat-cli-bad-sub-mark wire p.cage.sign] !!) %chat-update (diff-chat-update:tc wire !<(update:store q.cage.sign)) - %invite-update (handle-invite-update:tc !<(invite-update q.cage.sign)) + %invite-update (handle-invite-update:tc !<(update:inv q.cage.sign)) == == [cards this] @@ -224,9 +224,9 @@ grams ~ ::NOTE this only impacts historic message lookup in chat-cli :: known - ^- (set [target serial]) + ^- (set [target serial:store]) %- ~(run in known.u.old) - |= [t=[ship path] s=serial] + |= [t=[ship path] s=serial:store] [`target`[| t] s] :: bound @@ -324,7 +324,7 @@ :: +handle-invite-update: get new invites :: ++ handle-invite-update - |= upd=invite-update + |= upd=update:inv ^- (quip card _state) ?+ -.upd [~ state] %invite [[(show-invite:sh-out invite.upd) ~] state] @@ -534,10 +534,10 @@ :: ;~(pfix ace ;~(plug i.opt $(opt t.opt))) :: -- :: - ++ group ;~((glue net) ship sym) + ++ group ;~((glue fas) ship sym) ++ tag |*(a=@tas (cold a (jest a))) ::TODO into stdlib ++ ship ;~(pfix sig fed:ag) - ++ path ;~(pfix net ;~(plug urs:ab (easy ~))) ::NOTE short only, tmp + ++ path ;~(pfix fas ;~(plug urs:ab (easy ~))) ::NOTE short only, tmp :: +mang: un/managed indicator prefix :: :: deprecated, as sig prefix is no longer used @@ -619,7 +619,7 @@ ++ letter ;~ pose (stag %url turl) - (stag %me ;~(pfix vat text)) + (stag %me ;~(pfix pat text)) (stag %text ;~(less mic hax text)) == :: +turl: url parser @@ -722,12 +722,11 @@ %poke %invite-action :: - !> - ^- invite-action - :^ %invite /chat + !> ^- action:inv + :^ %invite %chat (shax (jam [our-self where] who)) - ^- invite - [our-self %chat-hook where who ''] + ^- invite:inv + [our-self %chat-hook (de-path:resource where) who ''] == :: +set-target: set audience, update prompt :: @@ -865,7 +864,7 @@ |= =letter:store ^- (quip card _state) ~! bowl - =/ =serial (shaf %msg-uid eny.bowl) + =/ =serial:store (shaf %msg-uid eny.bowl) :_ state ^- (list card) %+ turn ~(tap in audience) @@ -1132,11 +1131,9 @@ :: +show-invite: print incoming invite notification :: ++ show-invite - |= invite + |= invite:inv ^- card - %- note - %+ weld "invited to: " - ~(phat tr (path-to-target path)) + (note "invited to: {(scow %p entity.resource)} {(trip name.resource)}") -- :: :: +tr: render targets diff --git a/pkg/arvo/app/chat-hook.hoon b/pkg/arvo/app/chat-hook.hoon index 3dff6c5d6..340d1e6c1 100644 --- a/pkg/arvo/app/chat-hook.hoon +++ b/pkg/arvo/app/chat-hook.hoon @@ -2,7 +2,7 @@ :: mirror chat data from foreign to local based on read permissions :: allow sending chat messages to foreign paths based on write perms :: -/- *permission-store, *invite-store, *metadata-store, +/- *permission-store, inv=invite-store, *metadata-store, *permission-hook, *group-store, *permission-group-hook, ::TMP for upgrade hook=chat-hook, view=chat-view, @@ -52,7 +52,7 @@ +$ poke $% [%chat-action action:store] [%permission-action permission-action] - [%invite-action invite-action] + [%invite-action action:inv] [%chat-view-action action:view] == :: @@ -77,7 +77,7 @@ ++ on-init ^- (quip card _this) :_ this(invite-created %.y) - :~ (invite-poke:cc [%create /chat]) + :~ (invite-poke:cc [%create %chat]) [%pass /invites %agent [our.bol %invite-store] %watch /invitatory/chat] watch-groups:cc == @@ -406,7 +406,7 @@ :: %invite-update =^ cards state - (fact-invite-update:cc wire !<(invite-update q.cage.sign)) + (fact-invite-update:cc wire !<(update:inv q.cage.sign)) [cards this] :: %group-update @@ -719,15 +719,18 @@ == :: ++ fact-invite-update - |= [wir=wire fact=invite-update] + |= [wir=wire fact=update:inv] ^- (quip card _state) :_ state ?+ -.fact ~ %accepted - =/ ask-history ?~((chat-scry path.invite.fact) %.y %.n) - =* shp ship.invite.fact - =* app-path path.invite.fact - ~[(chat-view-poke [%join shp app-path ask-history])] + =* resource resource.invite.fact + =/ =path [(scot %p entity.resource) name.resource ~] + :_ ~ + %- chat-view-poke + :^ %join ship.invite.fact + path + ?=(~ (chat-scry path)) == :: ++ fact-group-update @@ -919,9 +922,9 @@ [%pass / %agent [our.bol %chat-view] %poke %chat-view-action !>(act)] :: ++ invite-poke - |= act=invite-action + |= =action:inv ^- card - [%pass / %agent [our.bol %invite-store] %poke %invite-action !>(act)] + [%pass / %agent [our.bol %invite-store] %poke %invite-action !>(action)] :: ++ sec-to-perm |= [pax=path =kind] @@ -936,9 +939,9 @@ [%mailbox pax] :: ++ invite-scry - |= uid=serial - ^- (unit invite) - %^ scry (unit invite) + |= uid=serial:inv + ^- (unit invite:inv) + %^ scry (unit invite:inv) %invite-store /invite/chat/(scot %uv uid) :: diff --git a/pkg/arvo/app/chat-view.hoon b/pkg/arvo/app/chat-view.hoon index f12a64edb..648f42082 100644 --- a/pkg/arvo/app/chat-view.hoon +++ b/pkg/arvo/app/chat-view.hoon @@ -6,7 +6,7 @@ /- *permission-store, *permission-hook, *group, - *invite-store, + inv=invite-store, *metadata-store, group-hook, *permission-group-hook, @@ -220,8 +220,7 @@ ~& %chat-already-exists ~ %- zing - :~ (create-chat app-path.act allow-history.act) - %- create-group + :~ %- create-group :* group-path.act app-path.act policy.act @@ -231,6 +230,7 @@ managed.act == (create-metadata title.act description.act group-path.act app-path.act) + (create-chat app-path.act allow-history.act) == :: %delete @@ -407,13 +407,14 @@ ^- card =/ managed=? !=(ship+app-path group-path) - =/ =invite + =/ =invite:inv :* our.bol ?:(managed %contact-hook %chat-hook) - ?:(managed group-path app-path) + (de-path:resource ?:(managed group-path ship+app-path)) ship '' == - =/ act=invite-action [%invite ?:(managed /contacts /chat) (shaf %msg-uid eny.bol) invite] + =/ act=action:inv + [%invite ?:(managed %contacts %chat) (shaf %msg-uid eny.bol) invite] [%pass / %agent [our.bol %invite-hook] %poke %invite-action !>(act)] :: ++ chat-scry @@ -487,8 +488,8 @@ (en-path:resource rid) ?> ?=(^ path) :~ (group-pull-hook-poke %add ship rid) - (chat-hook-poke %add-synced ship t.path ask-history) (metadata-hook-poke %add-synced ship path) + (chat-hook-poke %add-synced ship t.path ask-history) == :: ++ diff-chat-update diff --git a/pkg/arvo/app/contact-hook.hoon b/pkg/arvo/app/contact-hook.hoon index ccdb41010..087120183 100644 --- a/pkg/arvo/app/contact-hook.hoon +++ b/pkg/arvo/app/contact-hook.hoon @@ -4,7 +4,7 @@ /- group-hook, *contact-hook, *contact-view, - *invite-store, + inv=invite-store, *metadata-hook, *metadata-store, *group @@ -44,7 +44,7 @@ ++ on-init ^- (quip card _this) :_ this(invite-created %.y) - :~ (invite-poke:cc [%create /contacts]) + :~ (invite-poke:cc [%create %contacts]) [%pass /inv %agent [our.bol %invite-store] %watch /invitatory/contacts] [%pass /group %agent [our.bol %group-store] %watch /groups] == @@ -467,20 +467,10 @@ (contact-poke [%delete path]) (contact-poke [%remove path ship]) == - :: - ++ send-invite-poke - |= [=path =ship] - ^- card - =/ =invite - :* our.bol %contact-hook - path ship '' - == - =/ act=invite-action [%invite /contacts (shaf %msg-uid eny.bol) invite] - [%pass / %agent [our.bol %invite-hook] %poke %invite-action !>(act)] -- :: ++ invite-poke - |= act=invite-action + |= act=action:inv ^- card [%pass / %agent [our.bol %invite-store] %poke %invite-action !>(act)] :: diff --git a/pkg/arvo/app/contact-view.hoon b/pkg/arvo/app/contact-view.hoon index 9fab4648c..2abbbb0f6 100644 --- a/pkg/arvo/app/contact-view.hoon +++ b/pkg/arvo/app/contact-view.hoon @@ -5,7 +5,7 @@ :: /- group-hook, - *invite-store, + inv=invite-store, *contact-hook, *metadata-store, *metadata-hook, @@ -161,27 +161,22 @@ %+ turn ~(tap in pending.policy.act) |= =ship - (send-invite our.bol %contacts path ship '') + (send-invite our.bol %contacts rid ship '') == :: %join - =/ =path - (en-path:resource resource.act) =/ =cage :- %group-update !> ^- update:group-store [%add-members resource.act (sy our.bol ~)] =/ =wire - [%join-group path] + [%join-group (en-path:resource resource.act)] [%pass wire %agent [entity.resource.act %group-push-hook] %poke cage]~ :: %invite =* rid resource.act - =/ =path - (en-path:resource rid) - =/ =group - (need (scry-group:grp rid)) - :- (send-invite entity.rid %contacts path ship.act text.act) + =/ =group (need (scry-group:grp rid)) + :- (send-invite entity.rid %contacts rid ship.act text.act) ?. ?=(%invite -.policy.group) ~ ~[(add-pending rid ship.act)] :: @@ -276,12 +271,12 @@ [%pass / %agent [entity.rid app] %poke cage] :: ++ send-invite - |= =invite + |= =invite:inv ^- card =/ =cage :- %invite-action - !> ^- invite-action - [%invite /contacts (shaf %invite-uid eny.bol) invite] + !> ^- action:inv + [%invite %contacts (shaf %invite-uid eny.bol) invite] [%pass / %agent [recipient.invite %invite-hook] %poke cage] :: ++ contact-poke diff --git a/pkg/arvo/app/dojo.hoon b/pkg/arvo/app/dojo.hoon index d225ef9e0..5e54034a7 100644 --- a/pkg/arvo/app/dojo.hoon +++ b/pkg/arvo/app/dojo.hoon @@ -165,7 +165,7 @@ == == :: - ;~ pfix net + ;~ pfix fas ;~ pose (parse-variable (cold %sur hep) ;~(pfix gap parse-cables)) (parse-variable (cold %lib lus) ;~(pfix gap parse-cables)) @@ -179,8 +179,8 @@ ++ parse-sink ;~ pose ;~(plug (cold %file tar) parse-beam) - ;~(plug (cold %flat vat) (most net sym)) - ;~(plug (cold %pill dot) (most net sym)) + ;~(plug (cold %flat pat) (most fas sym)) + ;~(plug (cold %pill dot) (most fas sym)) ;~(plug (cold %http lus) (stag %post parse-url)) ;~(plug (cold %http hep) (stag %put parse-url)) (stag %show (cook $?($1 $2 $3 $4 $5) (cook lent (stun [1 5] wut)))) @@ -218,6 +218,7 @@ ;~(plug (cold %ur lus) parse-url) ;~(plug (cold %ge lus) parse-model) ;~(plug (cold %te hep) sym (star ;~(pfix ace parse-source))) + ;~(plug (cold %as pam) sym ;~(pfix ace parse-source)) ;~(plug (cold %do cab) parse-hoon ;~(pfix ace parse-source)) parse-value == @@ -227,7 +228,7 @@ ;~ pose ;~ plug ;~(pfix sig fed:ag) - ;~(pose ;~(pfix net sym) (easy default-app)) + ;~(pose ;~(pfix fas sym) (easy default-app)) == %+ stag our ;~(pose sym (easy default-app)) @@ -262,7 +263,7 @@ auri:de-purl:html :: ++ parse-model ;~(plug parse-server parse-config) - ++ parse-server (stag 0 (most net sym)) + ++ parse-server (stag 0 (most fas sym)) ++ parse-hoon tall:hoon-parser :: ++ parse-rood @@ -283,10 +284,10 @@ == ++ parse-value ;~ pose - ;~(plug (cold %as pad) sym ;~(pfix ace parse-source)) - (stag %sa ;~(pfix tar pad sym)) + ;~(plug (cold %as pam) sym ;~(pfix ace parse-source)) + (stag %sa ;~(pfix tar pam sym)) (stag %ex parse-hoon) - (stag %tu (ifix [lac rac] (most ace parse-source))) + (stag %tu (ifix [sel ser] (most ace parse-source))) == :: ++ parse-config diff --git a/pkg/arvo/app/glob.hoon b/pkg/arvo/app/glob.hoon index c031faa9b..472f93833 100644 --- a/pkg/arvo/app/glob.hoon +++ b/pkg/arvo/app/glob.hoon @@ -5,7 +5,7 @@ /- glob /+ default-agent, verb, dbug |% -++ hash 0v2.1vtfh.0l23v.30s7f.n57l9.dpjvi +++ hash 0v4.fpa4r.s6dtc.h8tps.62jv0.qn0fj +$ state-0 [%0 hash=@uv glob=(unit (each glob:glob tid=@ta))] +$ all-states $% state-0 @@ -89,7 +89,7 @@ =+ .^(=map=tube:clay %cc (weld home /map/mime)) =+ .^(arch %cy (weld home /app/landscape/js/bundle)) =/ bundle-hash=@t - %- need + %- need ^- (unit @t) %- ~(rep by dir) |= [[file=@t ~] out=(unit @t)] diff --git a/pkg/arvo/app/graph-pull-hook.hoon b/pkg/arvo/app/graph-pull-hook.hoon index 5971ef948..70ed3e22e 100644 --- a/pkg/arvo/app/graph-pull-hook.hoon +++ b/pkg/arvo/app/graph-pull-hook.hoon @@ -20,6 +20,7 @@ +* this . def ~(. (default-agent this %|) bowl) dep ~(. (default:pull-hook this config) bowl) + gra ~(. graph bowl) :: ++ on-init on-init:def ++ on-save !>(~) @@ -35,6 +36,7 @@ |= [=resource =tang] ^- (quip card _this) :_ this + ?. (~(has in get-keys:gra) resource) ~ =- [%pass /pull-nack %agent [our.bowl %graph-store] %poke %graph-update -]~ !> ^- update:store [%0 now.bowl [%archive-graph resource]] @@ -42,7 +44,7 @@ ++ on-pull-kick |= =resource ^- (unit path) - =/ maybe-time (peek-update-log:graph resource) + =/ maybe-time (peek-update-log:gra resource) ?~ maybe-time `/ `/(scot %da u.maybe-time) -- diff --git a/pkg/arvo/app/graph-push-hook.hoon b/pkg/arvo/app/graph-push-hook.hoon index 5b4ea54b3..e4d409754 100644 --- a/pkg/arvo/app/graph-push-hook.hoon +++ b/pkg/arvo/app/graph-push-hook.hoon @@ -32,6 +32,22 @@ ?| (is-member:grp src.bowl i.group-paths) (is-admin:grp src.bowl i.group-paths) == +:: +++ is-allowed-remove + |= [=resource:res indices=(set index:store) =bowl:gall] + ^- ? + =/ gra ~(. graph bowl) + ?. (is-allowed resource bowl %.n) + %.n + %+ levy + ~(tap in indices) + |= =index:store + ^- ? + =/ =node:store + (got-node:gra resource index) + ?| =(author.post.node src.bowl) + (is-allowed resource bowl %.y) + == -- :: %- agent:dbug @@ -63,7 +79,7 @@ %add-graph (is-allowed resource.q.update bowl %.y) %remove-graph (is-allowed resource.q.update bowl %.y) %add-nodes (is-allowed resource.q.update bowl %.n) - %remove-nodes (is-allowed resource.q.update bowl %.y) + %remove-nodes (is-allowed-remove resource.q.update indices.q.update bowl) %add-signatures (is-allowed resource.uid.q.update bowl %.n) %remove-signatures (is-allowed resource.uid.q.update bowl %.y) %archive-graph (is-allowed resource.q.update bowl %.y) @@ -108,6 +124,8 @@ (get-graph:gra resource) :: resubscribe :: + ?~ (get-update-log:gra resource) + (get-graph:gra resource) =/ =time (slav %da i.path) =/ =update-log:store (get-update-log-subset:gra resource time) [%0 now.bowl [%run-updates resource update-log]] diff --git a/pkg/arvo/app/graph-store.hoon b/pkg/arvo/app/graph-store.hoon index 34f4d9040..ae47b6158 100644 --- a/pkg/arvo/app/graph-store.hoon +++ b/pkg/arvo/app/graph-store.hoon @@ -7,14 +7,20 @@ +$ card card:agent:gall +$ versioned-state $% state-0 + state-1 + state-2 == :: +$ state-0 [%0 network:store] ++$ state-1 [%1 network:store] ++$ state-2 [%2 network:store] +:: ++ orm orm:store ++ orm-log orm-log:store ++$ debug-input [%validate-graph =resource:store] -- :: -=| state-0 +=| state-2 =* state - :: %- agent:dbug @@ -27,9 +33,160 @@ ++ on-init [~ this] ++ on-save !>(state) ++ on-load - |= old=vase + |= =old=vase ^- (quip card _this) - [~ this(state !<(state-0 old))] + =+ !<(old=versioned-state old-vase) + =| cards=(list card) + |^ + ?- -.old + %0 + %_ $ + -.old %1 + :: + validators.old + (~(put in validators.old) %graph-validator-link) + :: + cards + %+ weld cards + %+ turn + ~(tap in (~(put in validators.old) %graph-validator-link)) + |= validator=@t + ^- card + =/ =wire /validator/[validator] + =/ =rave:clay [%sing %b [%da now.bowl] /[validator]] + [%pass wire %arvo %c %warp our.bowl [%home `rave]] + :: + graphs.old + %- ~(run by graphs.old) + |= [=graph:store q=(unit mark)] + ^- [graph:store (unit mark)] + :- (convert-unix-timestamped-graph graph) + ?^ q q + `%graph-validator-link + :: + update-logs.old + %- ~(run by update-logs.old) + |=(a=* *update-log:store) + == + :: + %1 + %_ $ + -.old %2 + graphs.old (~(run by graphs.old) change-revision-graph) + :: + update-logs.old + %- ~(run by update-logs.old) + |=(a=* *update-log:store) + == + :: + %2 [cards this(state old)] + == + :: + ++ change-revision-graph + |= [=graph:store q=(unit mark)] + ^- [graph:store (unit mark)] + |^ + :_ q + ?+ q graph + [~ %graph-validator-link] convert-links + [~ %graph-validator-publish] convert-publish + == + :: + ++ convert-links + %+ gas:orm *graph:store + %+ turn (tap:orm graph) + |= [=atom =node:store] + ^- [^atom node:store] + :: top-level + :: + :+ atom post.node + ?: ?=(%empty -.children.node) + [%empty ~] + :- %graph + %+ gas:orm *graph:store + %+ turn (tap:orm p.children.node) + |= [=^atom =node:store] + ^- [^^atom node:store] + :: existing comments get turned into containers for revisions + :: + :^ atom + post.node(contents ~, hash ~) + %graph + %+ gas:orm *graph:store + :_ ~ :- %1 + :_ [%empty ~] + post.node(index (snoc index.post.node atom), hash ~) + :: + ++ convert-publish + %+ gas:orm *graph:store + %+ turn (tap:orm graph) + |= [=atom =node:store] + ^- [^atom node:store] + :: top-level + :: + :+ atom post.node + ?: ?=(%empty -.children.node) + [%empty ~] + :- %graph + %+ gas:orm *graph:store + %+ turn (tap:orm p.children.node) + |= [=^atom =node:store] + ^- [^^atom node:store] + :: existing container for publish note revisions + :: + ?+ atom !! + %1 [atom node] + %2 + :+ atom post.node + ?: ?=(%empty -.children.node) + [%empty ~] + :- %graph + %+ gas:orm *graph:store + %+ turn (tap:orm p.children.node) + |= [=^^atom =node:store] + ^- [^^^atom node:store] + :+ atom post.node(contents ~, hash ~) + :- %graph + %+ gas:orm *graph:store + :_ ~ :- %1 + :_ [%empty ~] + post.node(index (snoc index.post.node atom), hash ~) + == + -- + :: + ++ maybe-unix-to-da + |= =atom + ^- @ + :: (bex 127) is roughly 226AD + ?. (lte atom (bex 127)) + atom + (add ~1970.1.1 (div (mul ~s1 atom) 1.000)) + :: + ++ convert-unix-timestamped-node + |= =node:store + ^- node:store + =. index.post.node + (convert-unix-timestamped-index index.post.node) + ?. ?=(%graph -.children.node) + node + :+ post.node + %graph + (convert-unix-timestamped-graph p.children.node) + :: + ++ convert-unix-timestamped-index + |= =index:store + (turn index maybe-unix-to-da) + :: + ++ convert-unix-timestamped-graph + |= =graph:store + %+ gas:orm *graph:store + %+ turn + (tap:orm graph) + |= [=atom =node:store] + ^- [^atom node:store] + :- (maybe-unix-to-da atom) + (convert-unix-timestamped-node node) + -- :: ++ on-watch ~/ %graph-store-watch @@ -60,6 +217,7 @@ =^ cards state ?+ mark (on-poke:def mark vase) %graph-update (graph-update !<(update:store vase)) + %noun (debug !<(debug-input vase)) == [cards this] :: @@ -68,6 +226,7 @@ ^- (quip card _state) |^ ?> ?=(%0 -.update) + =? p.update =(p.update *time) now.bowl ?- -.q.update %add-graph (add-graph +.q.update) %remove-graph (remove-graph +.q.update) @@ -86,23 +245,30 @@ == :: ++ add-graph - |= [=resource:store =graph:store mark=(unit mark:store)] + |= $: =resource:store + =graph:store + mark=(unit mark:store) + overwrite=? + == ^- (quip card _state) - ?< (~(has by archive) resource) - ?< (~(has by graphs) resource) + ?> ?| overwrite + ?& !(~(has by archive) resource) + !(~(has by graphs) resource) + == == ?> (validate-graph graph mark) :_ %_ state graphs (~(put by graphs) resource [graph mark]) update-logs (~(put by update-logs) resource (gas:orm-log ~ ~)) + archive (~(del by archive) resource) validators ?~ mark validators (~(put in validators) u.mark) == %- zing - :~ (give [/updates /keys ~] [%add-graph resource graph mark]) + :~ (give [/updates /keys ~] [%add-graph resource graph mark overwrite]) ?~ mark ~ ?: (~(has in validators) u.mark) ~ - =/ wire (weld /graph (en-path:res resource)) + =/ wire /validator/[u.mark] =/ =rave:clay [%sing %b [%da now.bowl] /[u.mark]] [%pass wire %arvo %c %warp our.bowl [%home `rave]]~ == @@ -395,52 +561,57 @@ ^- (quip card _state) ?< (~(has by archive) resource) ?> (~(has by graphs) resource) - :_ state - %+ turn (tap:orm-log update-log) - |= [=time update=logged-update:store] - ^- card - ?> ?=(%0 -.update) - :* %pass - /run-updates/(scot %da time) - %agent - [our.bowl %graph-store] - %poke - :- %graph-update - !> - ^- update:store - ?- -.q.update - %add-nodes update(resource.q resource) - %remove-nodes update(resource.q resource) - %add-signatures update(resource.uid.q resource) - %remove-signatures update(resource.uid.q resource) - == - == - :: - ++ validate-graph - |= [=graph:store mark=(unit mark:store)] - ^- ? - ?~ mark %.y - ?~ graph %.y - =/ =dais:clay - .^ =dais:clay - %cb - /(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/[u.mark] + =/ updates=(list [=time upd=logged-update:store]) + (tap:orm-log update-log) + =| cards=(list card) + |- ^- (quip card _state) + ?~ updates + [cards state] + =* update upd.i.updates + =^ crds state + %- graph-update + ^- update:store + ?- -.q.update + %add-nodes update(resource.q resource) + %remove-nodes update(resource.q resource) + %add-signatures update(resource.uid.q resource) + %remove-signatures update(resource.uid.q resource) == - %+ roll (tap:orm graph) - |= [[=atom =node:store] out=?] - ?& out - =(%& -:(mule |.((vale:dais [atom post.node])))) - ?- -.children.node - %empty %.y - %graph ^$(graph p.children.node) - == - == + $(cards (weld cards crds), updates t.updates) :: ++ give |= [paths=(list path) update=update-0:store] ^- (list card) [%give %fact paths [%graph-update !>([%0 now.bowl update])]]~ -- + :: + ++ debug + |= =debug-input + ^- (quip card _state) + =/ [=graph:store mark=(unit mark:store)] + (~(got by graphs) resource.debug-input) + ?> (validate-graph graph mark) + [~ state] + :: + ++ validate-graph + |= [=graph:store mark=(unit mark:store)] + ^- ? + ?~ mark %.y + ?~ graph %.y + =/ =dais:clay + .^ =dais:clay + %cb + /(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/[u.mark] + == + %+ roll (tap:orm graph) + |= [[=atom =node:store] out=?] + ?& out + =(%& -:(mule |.((vale:dais [atom post.node])))) + ?- -.children.node + %empty %.y + %graph ^$(graph p.children.node) + == + == -- :: ++ on-peek @@ -450,6 +621,14 @@ |^ ?> (team:title our.bowl src.bowl) ?+ path (on-peek:def path) + [%x %graph-mark @ @ ~] + =/ =ship (slav %p i.t.t.path) + =/ =term i.t.t.t.path + =/ result=(unit marked-graph:store) + (~(get by graphs) [ship term]) + ?~ result [~ ~] + ``noun+!>(q.u.result) + :: [%x %keys ~] :- ~ :- ~ :- %graph-update !>(`update:store`[%0 now.bowl [%keys ~(key by graphs)]]) @@ -472,7 +651,7 @@ !> ^- update:store :+ %0 now.bowl - [%add-graph [ship term] `graph:store`p.u.result q.u.result] + [%add-graph [ship term] `graph:store`p.u.result q.u.result %.y] :: :: note: near-duplicate of /x/graph :: @@ -488,7 +667,7 @@ !> ^- update:store :+ %0 now.bowl - [%add-graph [ship term] `graph:store`p.u.result q.u.result] + [%add-graph [ship term] `graph:store`p.u.result q.u.result %.y] :: [%x %graph-subset @ @ @ @ ~] =/ =ship (slav %p i.t.t.path) @@ -513,7 +692,7 @@ =/ =ship (slav %p i.t.t.path) =/ =term i.t.t.t.path =/ =index:store - (turn t.t.t.t.path |=(=cord (slav %ud cord))) + (turn t.t.t.t.path (cury slav %ud)) =/ node=(unit node:store) (get-node ship term index) ?~ node [~ ~] :- ~ :- ~ :- %graph-update @@ -543,7 +722,7 @@ :+ %add-nodes [ship term] %- ~(gas by *(map index:store node:store)) - %+ turn (tap:orm `graph:store`(subset:orm p.children.u.node start end)) + %+ turn (tap:orm `graph:store`(subset:orm p.children.u.node end start)) |= [=atom =node:store] ^- [index:store node:store] [(snoc index atom) node] @@ -556,7 +735,8 @@ =/ end=(unit time) (slaw %da i.t.t.t.t.t.path) =/ update-log=(unit update-log:store) (~(get by update-logs) [ship term]) ?~ update-log [~ ~] - ``noun+!>((subset:orm-log u.update-log start end)) + :: orm-log is ordered backwards, so swap start and end + ``noun+!>((subset:orm-log u.update-log end start)) :: [%x %update-log @ @ ~] =/ =ship (slav %p i.t.t.path) @@ -600,15 +780,15 @@ ++ on-arvo |= [=wire =sign-arvo] ^- (quip card _this) - ?+ -.sign-arvo (on-arvo:def wire sign-arvo) - %c + ?+ wire (on-arvo:def wire sign-arvo) + :: + :: old wire, do nothing + [%graph *] [~ this] + :: + [%validator @ ~] :_ this - ?> ?=([%graph @ *] wire) - =/ =resource:store (de-path:res t.wire) - =/ gra=(unit marked-graph:store) (~(get by graphs) resource) - ?~ gra ~ - ?~ q.u.gra ~ - =/ =rave:clay [%next %b [%da now.bowl] /[u.q.u.gra]] + =* validator i.t.wire + =/ =rave:clay [%next %b [%da now.bowl] /[validator]] [%pass wire %arvo %c %warp our.bowl [%home `rave]]~ == :: diff --git a/pkg/arvo/app/hark-chat-hook.hoon b/pkg/arvo/app/hark-chat-hook.hoon new file mode 100644 index 000000000..dcd1449ab --- /dev/null +++ b/pkg/arvo/app/hark-chat-hook.hoon @@ -0,0 +1,214 @@ +:: hark-chat-hook: notifications for chat-store [landscape] +:: +/- store=hark-store, post, group-store, metadata-store, hook=hark-chat-hook +/+ resource, metadata, default-agent, dbug, chat-store, grpl=group +:: +~% %hark-chat-hook-top ..is ~ +|% ++$ card card:agent:gall ++$ versioned-state + $% state-0 + == +:: ++$ state-0 + $: %0 + watching=(set path) + mentions=_& + == +:: +-- +:: +=| state-0 +=* state - +:: +=> + |_ =bowl:gall + :: + ++ give + |= [paths=(list path) =update:hook] + ^- (list card) + [%give %fact paths hark-chat-hook-update+!>(update)]~ + :: + ++ watch-chat + ^- card + [%pass /chat %agent [our.bowl %chat-store] %watch /all] + -- +%- agent:dbug +^- agent:gall +~% %hark-chat-hook-agent ..card ~ +|_ =bowl:gall ++* this . + ha ~(. +> bowl) + def ~(. (default-agent this %|) bowl) + met ~(. metadata bowl) + grp ~(. grpl bowl) +:: +++ on-init + :_ this + ~[watch-chat:ha] +:: +++ on-save !>(state) +++ on-load + |= old=vase + ^- (quip card _this) + :_ this(state !<(state-0 old)) + ?: (~(has by wex.bowl) [/chat our.bowl %chat-store]) + ~ + ~[watch-chat:ha] +:: +++ on-watch + |= =path + ^- (quip card _this) + =^ cards state + ?+ path (on-watch:def path) + :: + [%updates ~] + :_ state + %+ give:ha ~ + :* %initial + watching + == + == + [cards this] +:: +++ on-poke + ~/ %hark-chat-hook-poke + |= [=mark =vase] + ^- (quip card _this) + |^ + ?> (team:title our.bowl src.bowl) + =^ cards state + ?+ mark (on-poke:def mark vase) + %hark-chat-hook-action + (hark-chat-hook-action !<(action:hook vase)) + == + [cards this] + :: + ++ hark-chat-hook-action + |= =action:hook + ^- (quip card _state) + |^ + :- (give:ha ~[/updates] action) + ?- -.action + %listen (listen +.action) + %ignore (ignore +.action) + %set-mentions (set-mentions +.action) + == + ++ listen + |= chat=path + ^+ state + state(watching (~(put in watching) chat)) + :: + ++ ignore + |= chat=path + ^+ state + state(watching (~(del in watching) chat)) + :: + ++ set-mentions + |= ment=? + ^+ state + state(mentions ment) + -- + -- +:: +++ on-agent + ~/ %hark-chat-hook-agent + |= [=wire =sign:agent:gall] + ^- (quip card _this) + |^ + ?+ -.sign (on-agent:def wire sign) + %kick + :_ this + ?. ?=([%chat ~] wire) + ~ + ~[watch-chat:ha] + :: + %fact + ?. ?=(%chat-update p.cage.sign) + (on-agent:def wire sign) + =^ cards state + (chat-update !<(update:chat-store q.cage.sign)) + [cards this] + == + :: + ++ chat-update + |= =update:chat-store + ^- (quip card _state) + ?+ -.update `state + %initial (process-initial +.update) + %create (process-new +.update) + :: + %message + :_ state + (process-envelope path.update envelope.update) + :: + %messages + :_ state + %- zing + (turn envelopes.update (cury process-envelope path.update)) + == + ++ process-initial + |= =inbox:chat-store + ^- (quip card _state) + =/ keys=(list path) + ~(tap in ~(key by inbox)) + =| cards=(list card) + |- + ?~ keys + [cards state] + =* path i.keys + =^ cs state + (process-new path) + $(cards (weld cards cs), keys t.keys) + :: + ++ process-new + |= chat=path + ^- (quip card _state) + =/ groups=(list path) + (groups-from-resource:met %chat chat) + ?~ groups + `state + ?: (is-managed-path:grp i.groups) + `state + `state(watching (~(put in watching) chat)) + :: + ++ is-mention + |= =envelope:chat-store + ?. ?=(%text -.letter.envelope) %.n + ?& mentions + ?= ^ + (find (scow %p our.bowl) (trip text.letter.envelope)) + == + :: + ++ is-notification + |= [=path =envelope:chat-store] + ?& (~(has in watching) path) + !=(author.envelope our.bowl) + == + :: + ++ process-envelope + |= [=path =envelope:chat-store] + ^- (list card) + =/ mention=? + (is-mention envelope) + ?. ?|(mention (is-notification path envelope)) + ~ + =/ =index:store + [%chat path mention] + =/ =contents:store + [%chat ~[envelope]] + ~[(poke-store %add index when.envelope %.n contents)] + :: + ++ poke-store + |= =action:store + ^- card + =- [%pass /store %agent [our.bowl %hark-store] %poke -] + hark-action+!>(action) + -- +:: +++ on-peek on-peek:def +:: +++ on-leave on-leave:def +++ on-arvo on-arvo:def +++ on-fail on-fail:def +-- diff --git a/pkg/arvo/app/hark-graph-hook.hoon b/pkg/arvo/app/hark-graph-hook.hoon new file mode 100644 index 000000000..edf87a6f8 --- /dev/null +++ b/pkg/arvo/app/hark-graph-hook.hoon @@ -0,0 +1,267 @@ +:: hark-graph-hook: notifications for graph-store [landscape] +:: +/- store=hark-store, post, group-store, metadata-store, hook=hark-graph-hook +/+ resource, metadata, default-agent, dbug, graph-store +:: +~% %hark-graph-hook-top ..is ~ +|% ++$ card card:agent:gall ++$ versioned-state + $% state-0 + == +:: ++$ state-0 + $: %0 + watching=(set [resource index:post]) + mentions=_& + watch-on-self=_& + == +:: +-- +:: +=| state-0 +=* state - +:: +=> + |_ =bowl:gall + :: + ++ scry + |* [=mold p=path] + ?> ?=(^ p) + ?> ?=(^ t.p) + .^(mold i.p (scot %p our.bowl) i.t.p (scot %da now.bowl) t.t.p) + :: + ++ give + |= [paths=(list path) =update:hook] + ^- (list card) + [%give %fact paths hark-graph-hook-update+!>(update)]~ + :: + ++ watch-graph + ^- card + [%pass /graph %agent [our.bowl %graph-store] %watch /updates] + -- +%- agent:dbug +^- agent:gall +~% %hark-graph-hook-agent ..card ~ +|_ =bowl:gall ++* this . + ha ~(. +> bowl) + def ~(. (default-agent this %|) bowl) + met ~(. metadata bowl) +:: +++ on-init + :_ this + ~[watch-graph:ha] +:: +++ on-save !>(state) +++ on-load + |= old=vase + ^- (quip card _this) + `this(state !<(state-0 old)) +:: +++ on-watch + |= =path + ^- (quip card _this) + =^ cards state + ?+ path (on-watch:def path) + :: + [%updates ~] + :_ state + %+ give:ha ~ + :* %initial + watching + mentions + watch-on-self + == + == + [cards this] +:: +++ on-poke + ~/ %hark-graph-hook-poke + |= [=mark =vase] + ^- (quip card _this) + |^ + ?> (team:title our.bowl src.bowl) + =^ cards state + ?+ mark (on-poke:def mark vase) + %hark-graph-hook-action + (hark-graph-hook-action !<(action:hook vase)) + == + [cards this] + :: + ++ hark-graph-hook-action + |= =action:hook + ^- (quip card _state) + |^ + :- (give:ha ~[/updates] action) + ?- -.action + %listen (listen +.action) + %ignore (ignore +.action) + %set-mentions (set-mentions +.action) + %set-watch-on-self (set-watch-on-self +.action) + == + ++ listen + |= [graph=resource =index:post] + ^+ state + state(watching (~(put in watching) [graph index])) + :: + ++ ignore + |= [graph=resource =index:post] + ^+ state + state(watching (~(del in watching) [graph index])) + :: + ++ set-mentions + |= ment=? + ^+ state + state(mentions ment) + :: + ++ set-watch-on-self + |= self=? + ^+ state + state(watch-on-self self) + -- + -- +:: +++ on-agent + ~/ %hark-graph-hook-agent + |= [=wire =sign:agent:gall] + ^- (quip card _this) + |^ + ?+ -.sign (on-agent:def wire sign) + %kick + :_ this + ?. ?=([%graph ~] wire) + ~ + ~[watch-graph:ha] + :: + %fact + ?. ?=(%graph-update p.cage.sign) + (on-agent:def wire sign) + =^ cards state + (graph-update !<(update:graph-store q.cage.sign)) + [cards this] + == + ++ add-graph + |= rid=resource + ^- (quip card _state) + ?. &(watch-on-self =(our.bowl entity.rid)) + [~ state] + `state(watching (~(put in watching) [rid ~])) + :: + ++ graph-update + |= =update:graph-store + ^- (quip card _state) + ?: ?=(%add-graph -.q.update) + (add-graph resource.q.update) + ?. ?=(%add-nodes -.q.update) + [~ state] + =/ group=resource + (need (group-from-app-resource:met %graph resource.q.update)) + =/ =metadata:metadata-store + (need (peek-metadata:met %graph group resource.q.update)) + =* rid resource.q.update + =+ %+ scry:ha + ,mark=(unit mark) + /gx/graph-store/graph-mark/(scot %p entity.rid)/[name.rid]/noun + =+ %+ scry:ha + ,=tube:clay + /cc/[q.byk.bowl]/[(fall mark %graph-validator-link)]/notification-kind + =/ nodes=(list [p=index:graph-store q=node:graph-store]) + ~(tap by nodes.q.update) + =| cards=(list card) + |^ + ?~ nodes + [cards state] + =* index p.i.nodes + =* node q.i.nodes + =^ node-cards state + (check-node node tube) + %_ $ + nodes t.nodes + cards (weld node-cards cards) + == + :: + ++ check-node-children + |= [=node:graph-store =tube:clay] + ^- (quip card _state) + ?: ?=(%empty -.children.node) + [~ state] + =/ children=(list [=atom =node:graph-store]) + (tap:orm:graph-store p.children.node) + =| cards=(list card) + |- ^- (quip card _state) + ?~ children + [cards state] + =^ new-cards state + (check-node node.i.children tube) + %_ $ + cards (weld cards new-cards) + children t.children + == + :: + ++ check-node + |= [=node:graph-store =tube:clay] + ^- (quip card _state) + =^ child-cards state + (check-node-children node tube) + ?: =(our.bowl author.post.node) + =^ self-cards state + (self-post node) + :_ state + (weld child-cards self-cards) + =+ !< notif-kind=(unit [name=@t parent-lent=@ud]) + (tube !>([0 post.node])) + ?~ notif-kind + [child-cards state] + =/ desc=@t + ?: (is-mention contents.post.node) + %mention + name.u.notif-kind + =/ parent=index:post + (scag parent-lent.u.notif-kind index.post.node) + ?. ?| =(desc %mention) + (~(has in watching) [rid parent]) + == + [child-cards state] + =/ notif-index=index:store + [%graph group rid module.metadata desc] + =/ =contents:store + [%graph (limo post.node ~)] + :_ state + %+ snoc child-cards + (add-unread notif-index [time-sent.post.node %.n contents]) + :: + ++ is-mention + |= contents=(list content:post) + ^- ? + ?. mentions %.n + ?~ contents %.n + ?. ?=(%mention -.i.contents) + $(contents t.contents) + ?: =(our.bowl ship.i.contents) + %.y + $(contents t.contents) + :: + ++ self-post + |= =node:graph-store + ^- (quip card _state) + ?. ?=(%.y watch-on-self) + [~ state] + `state(watching (~(put in watching) [rid index.post.node])) + :: + ++ add-unread + |= [=index:store =notification:store] + ^- card + =- [%pass / %agent [our.bowl %hark-store] %poke -] + hark-action+!>([%add index notification]) + :: + -- + -- +:: +++ on-peek on-peek:def +:: +++ on-leave on-leave:def +++ on-arvo on-arvo:def +++ on-fail on-fail:def +-- + diff --git a/pkg/arvo/app/hark-group-hook.hoon b/pkg/arvo/app/hark-group-hook.hoon new file mode 100644 index 000000000..4b685c938 --- /dev/null +++ b/pkg/arvo/app/hark-group-hook.hoon @@ -0,0 +1,169 @@ +:: hark-group-hook: notifications for groups [landscape] +:: +/- store=hark-store, post, group-store, metadata-store, hook=hark-group-hook +/+ resource, metadata, default-agent, dbug, graph-store +:: +~% %hark-group-hook-top ..is ~ +|% ++$ card card:agent:gall ++$ versioned-state + $% state-0 + == +:: ++$ state-0 + $: %0 + watching=(set resource) + == +:: +-- +:: +=| state-0 +=* state - +:: +=< +%- agent:dbug +^- agent:gall +~% %hark-group-hook-agent ..card ~ +|_ =bowl:gall ++* this . + ha ~(. +> bowl) + def ~(. (default-agent this %|) bowl) + met ~(. metadata bowl) +:: +++ on-init + :_ this + :~ watch-metadata:ha + watch-groups:ha + == +:: +++ on-save !>(state) +++ on-load + |= old=vase + ^- (quip card _this) + `this(state !<(state-0 old)) +:: +++ on-watch + |= =path + ?. ?=([%updates ~] path) + (on-watch:def path) + :_ this + =; =cage + [%give %fact ~ cage]~ + :- %hark-group-hook-update + !> ^- update:hook + [%initial watching] +:: +++ on-poke + ~/ %hark-group-hook-poke + |= [=mark =vase] + ^- (quip card _this) + |^ + ?> (team:title our.bowl src.bowl) + =^ cards state + ?+ mark (on-poke:def mark vase) + %hark-group-hook-action + (hark-group-hook-action !<(action:hook vase)) + == + [cards this] + :: + ++ hark-group-hook-action + |= =action:hook + ^- (quip card _state) + |^ + ?- -.action + %listen (listen +.action) + %ignore (ignore +.action) + == + ++ listen + |= group=resource + ^- (quip card _state) + :- (give %listen group) + state(watching (~(put in watching) group)) + :: + ++ ignore + |= group=resource + ^- (quip card _state) + :- (give %ignore group) + state(watching (~(del in watching) group)) + :: + ++ give + |= =update:hook + ^- (list card) + [%give %fact ~[/updates] %hark-group-hook-update !>(update)]~ + -- + -- +:: +++ on-agent + ~/ %hark-group-hook-agent + |= [=wire =sign:agent:gall] + ^- (quip card _this) + |^ + ?+ -.sign (on-agent:def wire sign) + %kick + :_ this + ?+ wire ~ + [%group ~] ~[watch-groups:ha] + [%metadata ~] ~[watch-metadata:ha] + == + :: + %fact + ?+ p.cage.sign (on-agent:def wire sign) + %group-update + =^ cards state + (group-update !<(update:group-store q.cage.sign)) + [cards this] + :: + %metadata-update + =^ cards state + (metadata-update !<(metadata-update:metadata-store q.cage.sign)) + [cards this] + == + == + :: + ++ group-update + |= =update:group-store + ^- (quip card _state) + ?. ?=(?(%add-members %remove-members) -.update) + [~ state] + ?. (~(has in watching) resource.update) + [~ state] + =/ =contents:store + [%group ~[update]] + =/ =notification:store [now.bowl %.n contents] + =/ =index:store + [%group resource.update -.update] + :_ state + ~[(add-unread index notification)] + :: +metadata-update is stubbed for now, for the following reasons + :: - There's no semantic difference in metadata-store between + :: adding and editing a channel + :: - We have no way of retrieving old metadata to e.g. get a + :: channel's old name when it is renamed + ++ metadata-update + |= update=metadata-update:metadata-store + ^- (quip card _state) + [~ state] + :: + ++ add-unread + |= [=index:store =notification:store] + ^- card + =- [%pass / %agent [our.bowl %hark-store] %poke -] + hark-action+!>([%add index notification]) + -- +:: +++ on-peek on-peek:def +++ on-leave on-leave:def +++ on-arvo on-arvo:def +++ on-fail on-fail:def +-- +|_ =bowl:gall ++* met ~(. metadata bowl) +:: +++ watch-groups + ^- card + [%pass /group %agent [our.bowl %group-store] %watch /groups] +:: +++ watch-metadata + ^- card + [%pass /metadata %agent [our.bowl %metadata-store] %watch /updates] +-- diff --git a/pkg/arvo/app/hark-store.hoon b/pkg/arvo/app/hark-store.hoon new file mode 100644 index 000000000..476ea8d92 --- /dev/null +++ b/pkg/arvo/app/hark-store.hoon @@ -0,0 +1,363 @@ +:: hark-store: notifications [landscape] +:: +/- store=hark-store, post, group-store, metadata-store +/+ resource, metadata, default-agent, dbug, graph-store +:: +~% %hark-store-top ..is ~ +|% ++$ card card:agent:gall ++$ versioned-state + $% state-0 + == +:: ++$ state-0 + $: %0 + =notifications:store + archive=notifications:store + last-seen=@da + dnd=_| + == ++$ inflated-state + $: state-0 + cache + == +:: $cache: useful to have precalculated, but can be derived from state +:: albeit expensively ++$ cache + $: unread-count=@ud + by-index=(jug index:store @da) + ~ + == +:: +++ orm ((ordered-map @da timebox:store) gth) +-- +:: +=| inflated-state +=* state - +:: +=< +%- agent:dbug +^- agent:gall +~% %hark-store-agent ..card ~ +|_ =bowl:gall ++* this . + ha ~(. +> bowl) + def ~(. (default-agent this %|) bowl) + met ~(. metadata bowl) +:: +++ on-init + :_ this + ~[autoseen-timer] +:: +++ on-save !>(-.state) +++ on-load + |= =old=vase + ^- (quip card _this) + =/ old + !<(state-0 old-vase) + =. notifications.old + (gas:orm *notifications:store (tap:orm notifications.old)) + =. archive.old + (gas:orm *notifications:store (tap:orm archive.old)) + `this(-.state old, +.state (inflate-cache old)) +:: +++ on-watch + |= =path + ^- (quip card _this) + |^ + ?+ path (on-watch:def path) + :: + [%updates ~] + :_ this + [%give %fact ~ hark-update+!>(initial-updates)]~ + == + :: + ++ initial-updates + ^- update:store + :- %more + ^- (list update:store) + :- unreads + :+ [%set-dnd dnd] + [%count unread-count] + %+ weld + %+ turn + %+ scag 3 + (tap-nonempty:ha archive) + (timebox-update &) + %+ turn + %+ scag 3 + (tap-nonempty:ha notifications) + (timebox-update |) + :: + ++ unreads + ^- update:store + :- %unreads + ^- (list [index:store @ud]) + %+ turn + ~(tap by by-index) + |=([=index:store =(set @da)] [index ~(wyt in set)]) + :: + ++ timebox-update + |= archived=? + |= [time=@da =timebox:store] + ^- update:store + [%timebox time archived ~(tap by timebox)] + -- +:: +++ on-peek + |= =path + ^- (unit (unit cage)) + ?+ path (on-peek:def path) + :: + [%x %recent ?(%archive %inbox) @ @ ~] + =/ is-archive + =(%archive i.t.t.path) + =/ offset=@ud + (slav %ud i.t.t.t.path) + =/ length=@ud + (slav %ud i.t.t.t.t.path) + :^ ~ ~ %hark-update + !> ^- update:store + :- %more + %+ turn + %+ scag length + %+ slag offset + %- tap-nonempty:ha + ?:(is-archive archive notifications) + |= [time=@da =timebox:store] + ^- update:store + :^ %timebox time is-archive + ~(tap by timebox) + == +:: +++ on-poke + ~/ %hark-store-poke + |= [=mark =vase] + ^- (quip card _this) + |^ + ?> (team:title our.bowl src.bowl) + =^ cards state + ?+ mark (on-poke:def mark vase) + %hark-action (hark-action !<(action:store vase)) + == + [cards this] + :: + ++ hark-action + |= =action:store + ^- (quip card _state) + |^ + ?- -.action + %add (add +.action) + %archive (do-archive +.action) + %seen seen + %read (read +.action) + %read-index (read-index +.action) + %unread (unread +.action) + %set-dnd (set-dnd +.action) + == + ++ add + |= [=index:store =notification:store] + ^- (quip card _state) + =/ =timebox:store + (gut-orm:ha notifications last-seen) + =/ existing-notif + (~(get by timebox) index) + =/ new=notification:store + ?~ existing-notif + notification + (merge-notification:ha u.existing-notif notification) + =/ new-timebox=timebox:store + (~(put by timebox) index new) + :- (give:ha [/updates]~ %added last-seen index new) + %_ state + + ?~(existing-notif (upd-unreads:ha index last-seen %.n) +.state) + notifications (put:orm notifications last-seen new-timebox) + == + ++ read-index + |= =index:store + ^- (quip card _state) + =/ times=(list @da) + ~(tap in (~(gut by by-index) index ~)) + =| cards=(list card) + |- + ?~ times + [cards state] + =* time i.times + =^ crds state + (read time index) + $(cards (weld cards crds), times t.times) + :: + ++ do-archive + |= [time=@da =index:store] + ^- (quip card _state) + =/ =timebox:store + (gut-orm:ha notifications time) + =/ =notification:store + (~(got by timebox) index) + =/ new-timebox=timebox:store + (~(del by timebox) index) + :- (give:ha [/updates]~ %archive time index) + %_ state + + ?.(read.notification (upd-unreads:ha index time %.y) +.state) + :: + notifications + (put:orm notifications time new-timebox) + :: + archive + %^ jub-orm:ha archive time + |= archive-box=timebox:store + ^- timebox:store + (~(put by archive-box) index notification(read %.y)) + == + :: + ++ read + |= [time=@da =index:store] + ^- (quip card _state) + :- (give:ha [/updates]~ %read time index) + %_ state + + (upd-unreads:ha index time %.y) + unread-count (dec unread-count) + notifications (change-read-status:ha time index %.y) + == + :: + ++ unread + |= [time=@da =index:store] + ^- (quip card _state) + :- (give:ha [/updates]~ %unread time index) + %_ state + + (upd-unreads:ha index time %.n) + unread-count +(unread-count) + notifications (change-read-status:ha time index %.n) + == + :: + ++ seen + ^- (quip card _state) + :_ state(last-seen now.bowl) + :~ cancel-autoseen:ha + autoseen-timer:ha + == + :: + ++ set-dnd + |= d=? + ^- (quip card _state) + :_ state(dnd d) + (give:ha [/updates]~ %set-dnd d) + -- + -- +:: +++ on-agent on-agent:def +:: +++ on-leave on-leave:def +++ on-arvo + |= [=wire =sign-arvo] + ^- (quip card _this) + ?. ?=([%autoseen ~] wire) + (on-arvo:def wire sign-arvo) + ?> ?=([%b %wake *] sign-arvo) + :_ this(last-seen now.bowl) + ~[autoseen-timer:ha] +:: +++ on-fail on-fail:def +-- +|_ =bowl:gall ++* met ~(. metadata bowl) +:: +++ tap-nonempty + |= =notifications:store + ^- (list [@da timebox:store]) + %+ skip (tap:orm notifications) + |=([@da =timebox:store] =(0 ~(wyt by timebox))) +:: +++ merge-notification + |= [existing=notification:store new=notification:store] + ^- notification:store + ?- -.contents.existing + :: + %chat + ?> ?=(%chat -.contents.new) + existing(list.contents (weld list.contents.existing list.contents.new)) + :: + %graph + ?> ?=(%graph -.contents.new) + existing(list.contents (weld list.contents.existing list.contents.new)) + :: + %group + ?> ?=(%group -.contents.new) + existing(list.contents (weld list.contents.existing list.contents.new)) + == +:: +++ change-read-status + |= [time=@da =index:store read=?] + ^+ notifications + %^ jub-orm notifications time + |= =timebox:store + %+ ~(jab by timebox) index + |= =notification:store + ?> !=(read read.notification) + notification(read read) +:: +key-orm: +key:by for ordered maps +++ key-orm + |= =notifications:store + ^- (list @da) + (turn (tap:orm notifications) |=([key=@da =timebox:store] key)) +:: +jub-orm: combo +jab/+gut for ordered maps +:: TODO: move to zuse.hoon +++ jub-orm + |= [=notifications:store time=@da fun=$-(timebox:store timebox:store)] + ^- notifications:store + =/ =timebox:store + (fun (gut-orm notifications time)) + (put:orm notifications time timebox) +:: +gut-orm: +gut:by for ordered maps +:: TODO: move to zuse.hoon +++ gut-orm + |= [=notifications:store time=@da] + ^- timebox:store + (fall (get:orm notifications time) ~) +:: +++ autoseen-interval ~h3 +++ cancel-autoseen + ^- card + [%pass /autoseen %arvo %b %rest (add last-seen autoseen-interval)] +:: +++ autoseen-timer + ^- card + [%pass /autoseen %arvo %b %wait (add now.bowl autoseen-interval)] +:: +++ give + |= [paths=(list path) update=update:store] + ^- (list card) + [%give %fact paths [%hark-update !>(update)]]~ +:: +++ upd-unreads + |= [=index:store time=@da read=?] + ^+ +.state + %_ +.state + :: + by-index + %. [index time] + ?: read + ~(del ju by-index) + ~(put ju by-index) + == +:: +++ inflate-cache + |= state-0 + ^+ +.state + =/ nots=(list [p=@da =timebox:store]) + (tap:orm notifications) + |- =* outer $ + ?~ nots + +.state + =/ unreads ~(tap by timebox.i.nots) + |- =* inner $ + ?~ unreads + outer(nots t.nots) + =* notification q.i.unreads + =* index p.i.unreads + ?: read.notification + inner(unreads t.unreads) + =. +.state + (upd-unreads index p.i.nots %.n) + inner(unreads t.unreads) +-- diff --git a/pkg/arvo/app/herm.hoon b/pkg/arvo/app/herm.hoon new file mode 100644 index 000000000..4434685c3 --- /dev/null +++ b/pkg/arvo/app/herm.hoon @@ -0,0 +1,101 @@ +:: herm: stand-in for term.c with http interface +:: +/+ default-agent, dbug, verb +=, able:jael +|% ++$ state-0 [%0 ~] +-- +:: +=| state-0 +=* state - +%+ verb | +%- agent:dbug +^- agent:gall +=> |% + ++ request-tube + |= [bowl:gall from=mark to=mark next=?] + ^- card:agent:gall + :* %pass /tube/[from]/[to] + %arvo %c %warp + our q.byk ~ + :: + ?: next + [%next %c da+now /[from]/[to]] + [%sing %c da+now /[from]/[to]] + == + -- +|_ =bowl:gall ++* this . + def ~(. (default-agent this %|) bowl) +:: +++ on-init + ^- (quip card:agent:gall _this) + :_ this + :: set up dill session subscription, + :: and ensure the tubes we use are in cache + :: + :~ [%pass [%view %$ ~] %arvo %d %view ~] + (request-tube bowl %blit %json |) + (request-tube bowl %json %belt |) + == +:: +++ on-save !>([%0 ~]) +++ on-load + |= old=vase + ^- (quip card:agent:gall _this) + [~ this(state [%0 ~])] +:: +++ on-watch + |= =path + ^- (quip card:agent:gall _this) + ?> ?=([%session @ ~] path) + :_ this + :: scry prompt and cursor position out of dill for initial response + :: + =/ base=^path + /dx/(scot %p our.bowl)//(scot %da now.bowl)/sessions + :~ [%give %fact ~ %blit !>(.^(blit:dill (weld base //line)))] + [%give %fact ~ %blit !>(`blit:dill`hop+.^(@ud (weld base //cursor)))] + == +:: +++ on-arvo + |= [=wire =sign-arvo] + ^- (quip card:agent:gall _this) + ?+ wire !! + :: pass on dill blits for the session + :: + [%view %$ ~] + ?. ?=([%d %blit *] sign-arvo) + ~| [%unexpected-sign [- +<]:sign-arvo] + !! + :_ this + %+ turn p.sign-arvo + |= =blit:dill + [%give %fact [%session %$ ~]~ %blit !>(blit)] + :: + :: ensure the tubes we need remain in cache + :: + [%tube @ @ ~] + =* from i.t.wire + =* to i.t.t.wire + ?. ?=([%c %writ *] sign-arvo) + ~| [%unexpected-sign [- +<]:sign-arvo] + !! + :_ this + [(request-tube bowl from to &)]~ + == +:: +++ on-poke + |= [=mark =vase] + ^- (quip card:agent:gall _this) + ?. ?=(%belt mark) + ~| [%unexpected-mark mark] + !! + :_ this + [%pass [%belt %$ ~] %arvo %d %belt !<(belt:dill vase)]~ +:: +++ on-leave on-leave:def +++ on-peek on-peek:def +++ on-agent on-agent:def +++ on-fail on-fail:def +-- diff --git a/pkg/arvo/app/hood.hoon b/pkg/arvo/app/hood.hoon index 433ccb2e4..7ea33fe6b 100644 --- a/pkg/arvo/app/hood.hoon +++ b/pkg/arvo/app/hood.hoon @@ -2,7 +2,7 @@ /+ drum=hood-drum, helm=hood-helm, kiln=hood-kiln |% +$ state - $: %10 + $: %11 drum=state:drum helm=state:helm kiln=state:kiln @@ -13,6 +13,7 @@ [%7 drum=state:drum helm=state:helm kiln=state:kiln] [%8 drum=state:drum helm=state:helm kiln=state:kiln] [%9 drum=state:drum helm=state:helm kiln=state:kiln] + [%10 drum=state:drum helm=state:helm kiln=state:kiln] == +$ any-state-tuple $: drum=any-state:drum diff --git a/pkg/arvo/app/invite-hook.hoon b/pkg/arvo/app/invite-hook.hoon index 0e7b93d97..8cde26eb6 100644 --- a/pkg/arvo/app/invite-hook.hoon +++ b/pkg/arvo/app/invite-hook.hoon @@ -1,123 +1,121 @@ -:: invite-hook [landscape]: +:: invite-hook [landscape]: receive invites from any source :: -:: receive invites from any source +:: only handles %invite actions: +:: - can be poked by the host team to send an invite out to someone. +:: - can be poked by foreign ships to send an invite to us. :: -:: only handles %invite actions. accepts json, but only from the host team. -:: can be poked by the host team to send an invite out to someone. -:: can be poked by foreign ships to send an invite to us. -:: -/+ *invite-json, default-agent, verb, dbug +/- *invite-store +/+ default-agent, dbug :: |% +$ state-0 [%0 ~] -:: +$ card card:agent:gall -- :: =| state-0 =* state - -:: -%+ verb | %- agent:dbug ^- agent:gall -=< - |_ =bowl:gall - +* this . - do ~(. +> bowl) - def ~(. (default-agent this %|) bowl) - :: - ++ on-init - ^- (quip card _this) - [~ this] - :: - ++ on-save !>(state) - ++ on-load - |= old=vase - ^- (quip card _this) - [~ this(state !<(state-0 old))] - :: - ++ on-poke - |= [=mark =vase] - ^- (quip card _this) - :_ this - ?+ mark (on-poke:def mark vase) - %json - :: only accept json from ourselves. +:: +|_ =bowl:gall ++* this . + def ~(. (default-agent this %|) bowl) +:: +++ on-init [~ this] +++ on-save !>(state) +++ on-load + |= old=vase + ^- (quip card _this) + [~ this(state !<(state-0 old))] +:: +++ on-poke + |= [=mark =vase] + ^- (quip card _this) + |^ + :_ this + ?+ mark (on-poke:def mark vase) + %invite-action + =/ act=action !<(action vase) + ?+ -.act ~ + %invites + ?. (team:title [our src]:bowl) ~ + :: outgoing. we must be inviting other ships. send them each an invite :: - ?> (team:title our.bowl src.bowl) - =/ act (json-to-action !<(json vase)) - ?> ?=(%invite -.act) - [(invite-hook-poke:do recipient.invite.act act)]~ + %+ turn ~(tap in recipients.invites.act) + |= recipient=ship + ^- card + ?< (team:title our.bowl recipient) + %+ invite-hook-poke recipient + :^ %invite term.act uid.act + ^- invite + :* ship.invites.act + app.invites.act + resource.invites.act + recipient + text.invites.act + == :: - %invite-action - =/ act=invite-action !<(invite-action vase) - ?. ?=(%invite -.act) ~ - ?: (team:title our.bowl src.bowl) + %invite + ?: (team:title [our src]:bowl) :: outgoing. we must be inviting another ship. send them the invite. :: ?< (team:title our.bowl recipient.invite.act) - [(invite-hook-poke:do recipient.invite.act act)]~ + [(invite-hook-poke recipient.invite.act act)]~ :: else incoming. ensure invitatory exists and invite is not a duplicate. :: - ?> ?=(^ (invitatory-scry:do path.act)) - ?> ?=(~ (invite-scry:do path.act uid.act)) - [(invite-poke:do path.act act)]~ + ?> ?=(^ (invitatory-scry term.act)) + ?> ?=(~ (invite-scry term.act uid.act)) + [(invite-poke term.act act)]~ + == + == + :: + ++ invite-hook-poke + |= [=ship =action] + ^- card + :* %pass + /invite-hook + %agent + [ship %invite-hook] + %poke + %invite-action + !>(action) == :: - ++ on-peek on-peek:def - ++ on-watch on-watch:def - ++ on-leave on-leave:def - ++ on-agent on-agent:def - ++ on-arvo on-arvo:def - ++ on-fail on-fail:def + ++ invite-poke + |= [=term =action] + ^- card + :* %pass + /[term] + %agent + [our.bowl %invite-store] + %poke + %invite-action + !>(action) + == + :: + ++ invitatory-scry + |= =term + .^ (unit invitatory) + %gx + %+ weld + /(scot %p our.bowl)/invite-store/(scot %da now.bowl)/invitatory + /[term]/noun + == + :: + ++ invite-scry + |= [=term uid=serial] + .^ (unit invite) + %gx + %+ weld + /(scot %p our.bowl)/invite-store/(scot %da now.bowl)/invite + /[term]/(scot %uv uid)/noun + == -- :: -|_ =bowl:gall -:: -++ invite-hook-poke - |= [=ship action=invite-action] - ^- card - :* %pass - /invite-hook - %agent - [ship %invite-hook] - %poke - %invite-action - !>(action) - == -:: -++ invite-poke - |= [=path action=invite-action] - ^- card - :* %pass - path - %agent - [our.bowl %invite-store] - %poke - %invite-action - !>(action) - == -:: -++ invitatory-scry - |= pax=path - ^- (unit invitatory) - =. pax - ;: weld - /(scot %p our.bowl)/invite-store/(scot %da now.bowl)/invitatory - pax - /noun - == - .^((unit invitatory) %gx pax) -:: -++ invite-scry - |= [pax=path uid=serial] - ^- (unit invite) - =. pax - ;: weld - /(scot %p our.bowl)/invite-store/(scot %da now.bowl)/invite - pax - /(scot %uv uid)/noun - == - .^((unit invite) %gx pax) +++ on-peek on-peek:def +++ on-watch on-watch:def +++ on-leave on-leave:def +++ on-agent on-agent:def +++ on-arvo on-arvo:def +++ on-fail on-fail:def -- - diff --git a/pkg/arvo/app/invite-store.hoon b/pkg/arvo/app/invite-store.hoon index c09bd4cba..258f61a4c 100644 --- a/pkg/arvo/app/invite-store.hoon +++ b/pkg/arvo/app/invite-store.hoon @@ -1,184 +1,209 @@ :: invite-store [landscape] -/+ *invite-json, default-agent, dbug +/- store=invite-store +/+ res=resource, default-agent, dbug |% +$ card card:agent:gall -:: +$ versioned-state - $% state-zero + $% state-0 + state-1 == :: -+$ state-zero - $: %0 - =invites ++$ invitatory-0 (map serial:store invite-0) ++$ invite-0 + $: =ship :: ship to subscribe to upon accepting invite + app=@tas :: app to subscribe to upon accepting invite + =path :: path to subscribe to upon accepting invite + recipient=ship :: recipient to receive invite + text=cord :: text to describe the invite == +:: ++$ state-0 [%0 invites=(map path invitatory-0)] ++$ state-1 [%1 =invites:store] -- :: -=| state-zero +=| state-1 =* state - %- agent:dbug ^- agent:gall -=< - |_ bol=bowl:gall - +* this . - inv-core +> - ic ~(. inv-core bol) - def ~(. (default-agent this %|) bol) - ++ on-init on-init:def - ++ on-save !>(state) - ++ on-load - |= old=vase - `this(state !<(state-zero old)) +:: +|_ =bowl:gall ++* this . + def ~(. (default-agent this %|) bowl) +:: +++ on-init + ^- (quip card _this) + :- ~ + %_ this + invites.state + %- ~(gas by *invites:store) + [%graph *invitatory:store]~ + == +:: +++ on-save !>(state) +++ on-load + |= old-vase=vase + =/ old !<(versioned-state old-vase) + ?: ?=(%1 -.old) + `this(state old) + :- =- [%pass / %agent [our.bowl %invite-store] %poke %invite-action -]~ + !> ^- action:store + [%create %graph] + %= this + state + :- %1 + %- ~(gas by *invites:store) + %+ murn ~(tap by invites.old) + |= [=path =invitatory-0] + ^- (unit [term invitatory:store]) + ?. ?=([@ ~] path) ~ + :- ~ + :- i.path + %- ~(gas by *invitatory:store) + %+ murn ~(tap by invitatory-0) + |= [=serial:store =invite-0] + ^- (unit [serial:store invite:store]) + =/ resource=(unit resource:res) (de-path-soft:res path.invite-0) + ?~ resource ~ + :- ~ + :- serial + ^- invite:store + :* ship.invite-0 + app.invite-0 + u.resource + recipient.invite-0 + text.invite-0 + == + == +:: +++ on-agent on-agent:def +++ on-arvo on-arvo:def +++ on-leave on-leave:def +++ on-fail on-fail:def +:: +++ on-watch + |= =path + ^- (quip card _this) + ?> (team:title our.bowl src.bowl) + =/ cards=(list card) + ?+ path (on-watch:def path) + [%all ~] [%give %fact ~ %invite-update !>([%initial invites])]~ + [%updates ~] ~ + [%invitatory @ ~] + =/ inv=invitatory:store (~(got by invites) i.t.path) + [%give %fact ~ %invite-update !>([%invitatory inv])]~ + == + [cards this] +:: +++ on-poke + |= [=mark =vase] + ^- (quip card _this) + |^ + ?> (team:title our.bowl src.bowl) + =^ cards state + ?+ mark (on-poke:def mark vase) + %invite-action (poke-invite-action !<(action:store vase)) + == + [cards this] :: - ++ on-poke - |= [=mark =vase] - ^- (quip card _this) - ?> (team:title our.bol src.bol) - =^ cards state - ?+ mark (on-poke:def mark vase) - %json (poke-invite-action:ic (json-to-action !<(json vase))) - %invite-action (poke-invite-action:ic !<(invite-action vase)) - == - [cards this] - :: - ++ on-watch - |= =path - ^- (quip card _this) - =/ cards=(list card) - ?+ path (on-watch:def path) - [%all ~] [%give %fact ~ %invite-update !>([%initial invites])]~ - [%updates ~] ~ - [%invitatory *] - =/ inv=invitatory (~(got by invites) t.path) - [%give %fact ~ %invite-update !>([%invitatory inv])]~ - == - [cards this] - :: - ++ on-leave on-leave:def - ++ on-peek - |= =path - ^- (unit (unit cage)) - ?+ path (on-peek:def path) - [%x %all ~] (peek-x-all:ic t.t.path) - [%x %invitatory *] (peek-x-invitatory:ic t.t.path) - [%x %invite *] (peek-x-invite:ic t.t.path) + ++ poke-invite-action + |= =action:store + ^- (quip card _state) + ?- -.action + %create (handle-create +.action) + %delete (handle-delete +.action) + %invite (handle-invite +.action) + %accept (handle-accept +.action) + %decline (handle-decline +.action) + %invites ~|('only send this to %invite-hook' !!) == :: - ++ on-agent on-agent:def - ++ on-arvo on-arvo:def - ++ on-fail on-fail:def + ++ handle-create + |= =term + ^- (quip card _state) + ?: (~(has by invites) term) + [~ state] + :- (send-diff term [%create term]) + state(invites (~(put by invites) term *invitatory:store)) + :: + ++ handle-delete + |= =term + ^- (quip card _state) + ?. (~(has by invites) term) + [~ state] + :- (send-diff term [%delete term]) + state(invites (~(del by invites) term)) + :: + ++ handle-invite + |= [=term =serial:store =invite:store] + ^- (quip card _state) + ?. (~(has by invites) term) + [~ state] + =/ container (~(got by invites) term) + =. serial (sham eny.bowl) + =. container (~(put by container) serial invite) + :- (send-diff term [%invite term serial invite]) + state(invites (~(put by invites) term container)) + :: + ++ handle-accept + |= [=term =serial:store] + ^- (quip card _state) + ?. (~(has by invites) term) + [~ state] + =/ container (~(got by invites) term) + =/ invite (~(get by container) serial) + ?~ invite + [~ state] + =. container (~(del by container) serial) + :- (send-diff term [%accepted term serial u.invite]) + state(invites (~(put by invites) term container)) + :: + ++ handle-decline + |= [=term =serial:store] + ^- (quip card _state) + ?. (~(has by invites) term) + [~ state] + =/ container (~(got by invites) term) + =/ invite (~(get by container) serial) + ?~ invite + [~ state] + =. container (~(del by container) serial) + :- (send-diff term [%decline term serial]) + state(invites (~(put by invites) term container)) + :: + ++ update-subscribers + |= [=path =update:store] + ^- card + [%give %fact ~[path] %invite-update !>(update)] + :: + ++ send-diff + |= [=term =update:store] + ^- (list card) + :~ (update-subscribers /all update) + (update-subscribers /updates update) + (update-subscribers /invitatory/[term] update) + == -- :: -|_ bol=bowl:gall -:: -++ peek-x-all - |= pax=path +++ on-peek + |= =path ^- (unit (unit cage)) - [~ ~ %noun !>(invites)] -:: -++ peek-x-invitatory - |= pax=path - ^- (unit (unit cage)) - ?~ pax - ~ - =/ invitatory=(unit invitatory) (~(get by invites) pax) - [~ ~ %noun !>(invitatory)] -:: -++ peek-x-invite - |= pax=path - ^- (unit (unit cage)) - :: /:path/:uid - =/ pas (flop pax) - ?~ pas - ~ - =/ uid=serial (slav %uv i.pas) - =. pax (scag (dec (lent pax)) `(list @ta)`pax) - =/ invitatory=(unit invitatory) (~(get by invites) pax) - ?~ invitatory - ~ - =/ invite=(unit invite) (~(get by u.invitatory) uid) - [~ ~ %noun !>(invite)] -:: -++ poke-invite-action - |= action=invite-action - ^- (quip card _state) - ?> (team:title our.bol src.bol) - ?- -.action - %create (handle-create action) - %delete (handle-delete action) - %invite (handle-invite action) - %accept (handle-accept action) - %decline (handle-decline action) + ?+ path (on-peek:def path) + [%x %all ~] + ``noun+!>(invites) + :: + [%x %invitatory @ ~] + :^ ~ ~ %noun + !> ^- (unit invitatory:store) + (~(get by invites) i.t.t.path) + :: + [%x %invite @ @ ~] + =* term i.t.t.path + =/ =serial:store (slav %uv i.t.t.t.path) + ?. (~(has by invites) term) + ~ + =/ =invitatory:store (~(got by invites) term) + :^ ~ ~ %noun + !> ^- (unit invite:store) + (~(get by invitatory) serial) == -:: -++ handle-create - |= act=invite-action - ^- (quip card _state) - ?> ?=(%create -.act) - ?: (~(has by invites) path.act) - [~ state] - :- (send-diff path.act act) - state(invites (~(put by invites) path.act *invitatory)) -:: -++ handle-delete - |= act=invite-action - ^- (quip card _state) - ?> ?=(%delete -.act) - ?. (~(has by invites) path.act) - [~ state] - :- (send-diff path.act act) - state(invites (~(del by invites) path.act)) -:: -++ handle-invite - |= act=invite-action - ^- (quip card _state) - ?> ?=(%invite -.act) - ?. (~(has by invites) path.act) - [~ state] - =/ container (~(got by invites) path.act) - =. uid.act (sham eny.bol) - =. container (~(put by container) uid.act invite.act) - :- (send-diff path.act act) - state(invites (~(put by invites) path.act container)) -:: -++ handle-accept - |= act=invite-action - ^- (quip card _state) - ?> ?=(%accept -.act) - ?. (~(has by invites) path.act) - [~ state] - =/ container (~(got by invites) path.act) - =/ invite (~(get by container) uid.act) - ?~ invite - [~ state] - =. container (~(del by container) uid.act) - :- (send-diff path.act [%accepted path.act uid.act u.invite]) - state(invites (~(put by invites) path.act container)) -:: -++ handle-decline - |= act=invite-action - ^- (quip card _state) - ?> ?=(%decline -.act) - ?. (~(has by invites) path.act) - [~ state] - =/ container (~(got by invites) path.act) - =/ invite (~(get by container) uid.act) - ?~ invite - [~ state] - =. container (~(del by container) uid.act) - :- (send-diff path.act act) - state(invites (~(put by invites) path.act container)) -:: -++ update-subscribers - |= [pax=path upd=invite-update] - ^- card - [%give %fact ~[pax] %invite-update !>(upd)] -:: -++ send-diff - |= [pax=path upd=invite-update] - ^- (list card) - :~ (update-subscribers /all upd) - (update-subscribers /updates upd) - (update-subscribers [%invitatory pax] upd) - == -:: -- diff --git a/pkg/arvo/app/landscape/img/chat.png b/pkg/arvo/app/landscape/img/chat.png deleted file mode 100644 index 58223a5d6..000000000 Binary files a/pkg/arvo/app/landscape/img/chat.png and /dev/null differ diff --git a/pkg/arvo/app/landscape/img/chatswitcherclosed.png b/pkg/arvo/app/landscape/img/chatswitcherclosed.png deleted file mode 100644 index 2009b319b..000000000 Binary files a/pkg/arvo/app/landscape/img/chatswitcherclosed.png and /dev/null differ diff --git a/pkg/arvo/app/landscape/img/chatswitcherlink.png b/pkg/arvo/app/landscape/img/chatswitcherlink.png deleted file mode 100644 index 9b47164dd..000000000 Binary files a/pkg/arvo/app/landscape/img/chatswitcherlink.png and /dev/null differ diff --git a/pkg/arvo/app/landscape/img/chevron.png b/pkg/arvo/app/landscape/img/chevron.png deleted file mode 100644 index 79eada831..000000000 Binary files a/pkg/arvo/app/landscape/img/chevron.png and /dev/null differ diff --git a/pkg/arvo/app/landscape/img/codeeval.png b/pkg/arvo/app/landscape/img/codeeval.png deleted file mode 100644 index 8bcb81ca6..000000000 Binary files a/pkg/arvo/app/landscape/img/codeeval.png and /dev/null differ diff --git a/pkg/arvo/app/landscape/img/dojo.png b/pkg/arvo/app/landscape/img/dojo.png deleted file mode 100644 index d6b651bc5..000000000 Binary files a/pkg/arvo/app/landscape/img/dojo.png and /dev/null differ diff --git a/pkg/arvo/app/landscape/img/link.png b/pkg/arvo/app/landscape/img/link.png deleted file mode 100644 index d83bb877c..000000000 Binary files a/pkg/arvo/app/landscape/img/link.png and /dev/null differ diff --git a/pkg/arvo/app/landscape/img/links.png b/pkg/arvo/app/landscape/img/links.png deleted file mode 100644 index d83bb877c..000000000 Binary files a/pkg/arvo/app/landscape/img/links.png and /dev/null differ diff --git a/pkg/arvo/app/landscape/img/popout.png b/pkg/arvo/app/landscape/img/popout.png deleted file mode 100644 index 712c2ab2f..000000000 Binary files a/pkg/arvo/app/landscape/img/popout.png and /dev/null differ diff --git a/pkg/arvo/app/landscape/img/publish.png b/pkg/arvo/app/landscape/img/publish.png deleted file mode 100644 index df16b2647..000000000 Binary files a/pkg/arvo/app/landscape/img/publish.png and /dev/null differ diff --git a/pkg/arvo/app/landscape/img/search.png b/pkg/arvo/app/landscape/img/search.png deleted file mode 100644 index 7ac218304..000000000 Binary files a/pkg/arvo/app/landscape/img/search.png and /dev/null differ diff --git a/pkg/arvo/app/landscape/img/send.png b/pkg/arvo/app/landscape/img/send.png deleted file mode 100644 index 6c13772b9..000000000 Binary files a/pkg/arvo/app/landscape/img/send.png and /dev/null differ diff --git a/pkg/arvo/app/landscape/img/spinner.png b/pkg/arvo/app/landscape/img/spinner.png deleted file mode 100644 index 8fddc7895..000000000 Binary files a/pkg/arvo/app/landscape/img/spinner.png and /dev/null differ diff --git a/pkg/arvo/app/landscape/index.html b/pkg/arvo/app/landscape/index.html index cab16a450..a2a06dea1 100644 --- a/pkg/arvo/app/landscape/index.html +++ b/pkg/arvo/app/landscape/index.html @@ -24,6 +24,6 @@
- +