From 5f4fc28bc9b7dda7b323a925572b0f8909cd98fe Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Sat, 25 Apr 2020 13:51:28 +1000 Subject: [PATCH 1/6] chat: improve namespacing of chat-* types Improved the namespacing by dropping the app prefix on types, e.g. chat-hook-action -> action. Compensated for shadowing by importing the /sur files behind a face. End result is that a chat-hook-action becomes an action:hook. Splits chat-json into lib/chat-{hook,store,view}. Uses ^? on changes files in /lib and /sur to discourage deeply nested importing. --- pkg/arvo/app/chat-cli.hoon | 42 ++--- pkg/arvo/app/chat-hook.hoon | 98 +++++----- pkg/arvo/app/chat-store.hoon | 88 ++++----- pkg/arvo/app/chat-view.hoon | 63 ++++--- pkg/arvo/lib/chat-hook.hoon | 49 +++++ pkg/arvo/lib/chat-json.hoon | 294 ----------------------------- pkg/arvo/lib/chat-store.hoon | 210 +++++++++++++++++++++ pkg/arvo/lib/chat-view.hoon | 51 +++++ pkg/arvo/mar/chat/action.hoon | 9 +- pkg/arvo/mar/chat/config.hoon | 5 +- pkg/arvo/mar/chat/configs.hoon | 9 +- pkg/arvo/mar/chat/hook-action.hoon | 9 +- pkg/arvo/mar/chat/hook-update.hoon | 9 +- pkg/arvo/mar/chat/initial.hoon | 5 +- pkg/arvo/mar/chat/update.hoon | 9 +- pkg/arvo/mar/chat/view-action.hoon | 10 +- pkg/arvo/sur/chat-hook.hoon | 5 +- pkg/arvo/sur/chat-store.hoon | 13 +- pkg/arvo/sur/chat-view.hoon | 3 +- 19 files changed, 511 insertions(+), 470 deletions(-) create mode 100644 pkg/arvo/lib/chat-hook.hoon delete mode 100644 pkg/arvo/lib/chat-json.hoon create mode 100644 pkg/arvo/lib/chat-store.hoon create mode 100644 pkg/arvo/lib/chat-view.hoon diff --git a/pkg/arvo/app/chat-cli.hoon b/pkg/arvo/app/chat-cli.hoon index e8351d856..5ae875d6c 100644 --- a/pkg/arvo/app/chat-cli.hoon +++ b/pkg/arvo/app/chat-cli.hoon @@ -9,9 +9,9 @@ :: we concat the ship onto the head of the path, :: and trust it to take care of the rest. :: -/- *chat-store, *chat-view, *chat-hook, +/- store=chat-store, view=chat-view, hook=chat-hook, *permission-store, *group-store, *invite-store, - sole-sur=sole + *rw-security, sole-sur=sole /+ sole-lib=sole, chat-eval, default-agent, verb, dbug, auto=language-server-complete :: @@ -26,7 +26,7 @@ +$ state-1 $: %1 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 @@ -39,7 +39,7 @@ == :: +$ state-0 - $: grams=(list [[=ship =path] envelope]) :: all messages + $: grams=(list [[=ship =path] envelope:store]) :: all messages known=(set [[=ship =path] serial]) :: known message lookup count=@ud :: (lent grams) bound=(map [=ship =path] glyph) :: bound circle glyphs @@ -52,7 +52,7 @@ eny=@uvJ :: entropy == :: -+$ mail [source=target envelope] ++$ mail [source=target envelope:store] +$ target [in-group=? =ship =path] :: +$ glyph char @@ -62,7 +62,7 @@ :: +$ command $% [%target (set target)] :: set messaging target - [%say letter] :: send message + [%say letter:store] :: send message [%eval cord hoon] :: send #-message :: :: @@ -153,7 +153,7 @@ :: %fact ?+ p.cage.sign ~|([%chat-cli-bad-sub-mark wire p.cage.sign] !!) - %chat-update (diff-chat-update:tc wire !<(chat-update q.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)) == == @@ -228,8 +228,8 @@ ^- (quip card _state) ?. .^(? %gu /(scot %p our.bowl)/chat-store/(scot %da now.bowl)) [~ state] - =/ =inbox - (scry-for inbox %chat-store /all) + =/ =inbox:store + (scry-for inbox:store %chat-store /all) |- ^- (quip card _state) ?~ inbox [~ state] =* path p.n.inbox @@ -317,7 +317,7 @@ :: +diff-chat-update: get new mailboxes & messages :: ++ diff-chat-update - |= [=wire upd=chat-update] + |= [=wire upd=update:store] ^- (quip card _state) ?+ -.upd [~ state] %create (notice-create (path-to-target path.upd)) @@ -327,7 +327,7 @@ == :: ++ read-envelopes - |= [=target envs=(list envelope)] + |= [=target envs=(list envelope:store)] ^- (quip card _state) ?~ envs [~ state] =^ cards-i state (read-envelope target i.envs) @@ -413,7 +413,7 @@ :: +read-envelope: add envelope to state and show it to user :: ++ read-envelope - |= [=target =envelope] + |= [=target =envelope:store] ^- (quip card _state) ?: (~(has in known) [target uid.envelope]) ::NOTE we no-op only because edits aren't possible @@ -853,7 +853,7 @@ %channel %channel ?(%village %village-with-group) %village == - ?^ (scry-for (unit mailbox) %chat-store [%mailbox real-path]) + ?^ (scry-for (unit mailbox:store) %chat-store [%mailbox real-path]) =- [[- ~] state] %- print:sh-out "{(spud path)} already exists!" @@ -864,7 +864,7 @@ =- [[- moz] state] %^ act %do-create %chat-view :- %chat-view-action - !> ^- chat-view-action + !> ^- action:view :* %create (rsh 3 1 (spat path)) '' @@ -882,7 +882,7 @@ =- [[- ~] state] %^ act %do-delete %chat-view :- %chat-view-action - !> ^- chat-view-action + !> ^- action:view [%delete (target-to-path | our-self path)] :: +change-permission: modify permissions on a local chat :: @@ -941,7 +941,7 @@ :: gives ugly %chat-hook-reap %^ act %do-join %chat-view :- %chat-view-action - !> ^- chat-view-action + !> ^- action:view [%join ship.target (target-to-path target) (fall ask-history %.y)] :: +leave: unsync & destroy mailbox :: @@ -954,12 +954,12 @@ "can't ;leave local chats, maybe use ;delete instead" %^ act %do-leave %chat-hook :- %chat-hook-action - !> ^- chat-hook-action + !> ^- action:hook [%remove (target-to-path target)] :: +say: send messages :: ++ say - |= =letter + |= =letter:store ^- (quip card _state) ~! bowl =/ =serial (shaf %msg-uid eny.bowl) @@ -969,7 +969,7 @@ |= =target %^ act %out-message %chat-hook :- %chat-action - !> ^- chat-action + !> ^- action:store :+ %message (target-to-path target) [serial *@ our-self now.bowl letter] :: +eval: run hoon, send code and result as message @@ -1190,7 +1190,7 @@ :: and the %notify flag is set, emit a bell. :: ++ show-envelope - |= [=target =envelope] + |= [=target =envelope:store] ^- (list card) %+ weld ^- (list card) @@ -1311,7 +1311,7 @@ :: ++ mr |_ $: source=target - envelope + envelope:store == :: +activate: produce sole-effect for printing message details :: diff --git a/pkg/arvo/app/chat-hook.hoon b/pkg/arvo/app/chat-hook.hoon index 8ecc82eb0..50cb3194b 100644 --- a/pkg/arvo/app/chat-hook.hoon +++ b/pkg/arvo/app/chat-hook.hoon @@ -3,8 +3,11 @@ :: allow sending chat messages to foreign paths based on write perms :: /- *permission-store, *chat-hook, *invite-store, *metadata-store, - *permission-hook, *group-store, *permission-group-hook ::TMP for upgrade -/+ *chat-json, *chat-eval, default-agent, verb, dbug + *permission-hook, *group-store, *permission-group-hook, ::TMP for upgrade + hook=chat-hook, + store=chat-store, + view=chat-view +/+ *chat-eval, default-agent, verb, dbug, store-lib=chat-store ~% %chat-hook-top ..is ~ |% +$ card card:agent:gall @@ -27,14 +30,14 @@ == :: +$ poke - $% [%chat-action chat-action] + $% [%chat-action action:store] [%permission-action permission-action] [%invite-action invite-action] - [%chat-view-action chat-view-action] + [%chat-view-action action:view] == :: +$ fact - $% [%chat-update chat-update] + $% [%chat-update update:store] == -- =| state-1 @@ -108,8 +111,8 @@ ++ recreate-chat |= [host=ship chat=path new-chat=path] ^- (list card) - =/ old-mailbox=mailbox - (need (scry:cc (unit mailbox) %chat-store [%mailbox chat])) + =/ old-mailbox=mailbox:store + (need (scry:cc (unit mailbox:store) %chat-store [%mailbox chat])) =* enves envelopes.old-mailbox :~ (chat-poke:cc [%delete new-chat]) (chat-poke:cc [%delete chat]) @@ -117,7 +120,7 @@ (chat-poke:cc [%messages new-chat enves]) (chat-poke:cc [%read new-chat]) %^ make-poke %chat-hook %chat-hook-action - !> ^- chat-hook-action + !> ^- action:hook ?: =(our.bol host) [%add-owned new-chat %.y] [%add-synced host new-chat %.y] == @@ -230,14 +233,14 @@ =^ cards state ?+ mark (on-poke:def mark vase) %json (poke-json:cc !<(json vase)) - %chat-action (poke-chat-action:cc !<(chat-action vase)) + %chat-action (poke-chat-action:cc !<(action:store vase)) %noun ?: =(%store-load q.vase) [loaded-cards.state state(loaded-cards ~)] [~ state] :: %chat-hook-action - (poke-chat-hook-action:cc !<(chat-hook-action vase)) + (poke-chat-hook-action:cc !<(action:hook vase)) == [cards this] :: @@ -270,7 +273,7 @@ ?+ p.cage.sign (on-agent:def wire sign) %chat-update =^ cards state - (fact-chat-update:cc wire !<(chat-update q.cage.sign)) + (fact-chat-update:cc wire !<(update:store q.cage.sign)) [cards this] :: %invite-update @@ -298,10 +301,10 @@ ++ poke-json |= jon=json ^- (quip card _state) - (poke-chat-action (json-to-action jon)) + (poke-chat-action (action:dejs:store-lib jon)) :: ++ poke-chat-action - |= act=chat-action + |= act=action:store ^- (quip card _state) ?> ?=(%message -.act) :: local @@ -328,7 +331,7 @@ [%pass / %agent [our.bol %chat-store] %poke %chat-action !>(act)]~ :: ++ poke-chat-hook-action - |= act=chat-hook-action + |= act=action:hook ^- (quip card _state) ?- -.act %add-owned @@ -352,7 +355,7 @@ =/ chat-path [%mailbox path.act] :_ state [%pass chat-path %agent [ship.act %chat-hook] %watch chat-path]~ - =/ mailbox=(unit mailbox) (chat-scry path.act) + =/ mailbox=(unit mailbox:store) (chat-scry path.act) =/ chat-history=path :- %backlog %+ weld path.act @@ -484,72 +487,72 @@ -- :: ++ fact-chat-update - |= [wir=wire fact=chat-update] + |= [wir=wire =update:store] ^- (quip card _state) ?: (team:title our.bol src.bol) - (handle-local fact) - (handle-foreign fact) + (handle-local update) + (handle-foreign update) :: ++ handle-local - |= fact=chat-update + |= =update:store ^- (quip card _state) - ?+ -.fact [~ state] + ?+ -.update [~ state] %delete - ?. (~(has by synced) path.fact) [~ state] - =. synced (~(del by synced) path.fact) + ?. (~(has by synced) path.update) [~ state] + =. synced (~(del by synced) path.update) :_ state - :~ [%pass [%mailbox path.fact] %agent [our.bol %chat-store] %leave ~] + :~ [%pass [%mailbox path.update] %agent [our.bol %chat-store] %leave ~] [%give %fact [/synced]~ %chat-hook-update !>([%initial synced])] == :: %message :_ state - [%give %fact [%mailbox path.fact]~ %chat-update !>(fact)]~ + [%give %fact [%mailbox path.update]~ %chat-update !>(update)]~ :: %messages :_ state - [%give %fact [%mailbox path.fact]~ %chat-update !>(fact)]~ + [%give %fact [%mailbox path.update]~ %chat-update !>(update)]~ == :: ++ handle-foreign - |= fact=chat-update + |= =update:store ^- (quip card _state) - ?+ -.fact [~ state] + ?+ -.update [~ state] %create :_ state - ?> ?=([* ^] path.fact) - =/ shp (~(get by synced) path.fact) + ?> ?=([* ^] path.update) + =/ shp (~(get by synced) path.update) ?~ shp ~ ?. =(src.bol u.shp) ~ - [(chat-poke [%create path.fact])]~ + [(chat-poke [%create path.update])]~ :: %delete - ?> ?=([* ^] path.fact) - =/ shp (~(get by synced) path.fact) + ?> ?=([* ^] path.update) + =/ shp (~(get by synced) path.update) ?~ shp [~ state] ?. =(u.shp src.bol) [~ state] - =. synced (~(del by synced) path.fact) + =. synced (~(del by synced) path.update) :_ state - :- (chat-poke [%delete path.fact]) - :~ [%pass [%mailbox path.fact] %agent [src.bol %chat-hook] %leave ~] + :- (chat-poke [%delete path.update]) + :~ [%pass [%mailbox path.update] %agent [src.bol %chat-hook] %leave ~] [%give %fact [/synced]~ %chat-hook-update !>([%initial synced])] == :: %message :_ state - ?> ?=([* ^] path.fact) - =/ shp (~(get by synced) path.fact) + ?> ?=([* ^] path.update) + =/ shp (~(get by synced) path.update) ?~ shp ~ ?. =(src.bol u.shp) ~ - [(chat-poke [%message path.fact envelope.fact])]~ + [(chat-poke [%message path.update envelope.update])]~ :: %messages :_ state - ?> ?=([* ^] path.fact) - =/ shp (~(get by synced) path.fact) + ?> ?=([* ^] path.update) + =/ shp (~(get by synced) path.update) ?~ shp ~ ?. =(src.bol u.shp) ~ - [(chat-poke [%messages path.fact envelopes.fact])]~ + [(chat-poke [%messages path.update envelopes.update])]~ == :: ++ kick @@ -564,7 +567,8 @@ ~& store-kick+wir ?. (~(has by synced) t.wir) [~ state] ~& %chat-store-resubscribe - =/ mailbox=(unit mailbox) (chat-scry t.wir) + =/ mailbox=(unit mailbox:store) + (chat-scry t.wir) :_ state [%pass wir %agent [our.bol %chat-store] %watch [%mailbox t.wir]]~ :: @@ -573,7 +577,7 @@ ?. (~(has by synced) t.wir) [~ state] ~& %chat-hook-resubscribe =/ =ship (~(got by synced) t.wir) - =/ mailbox=(unit mailbox) (chat-scry t.wir) + =/ mailbox=(unit mailbox:store) (chat-scry t.wir) =/ chat-history %+ welp backlog+t.wir ?~(mailbox /0 /(scot %ud (lent envelopes.u.mailbox))) @@ -612,12 +616,12 @@ == :: ++ chat-poke - |= act=chat-action + |= act=action:store ^- card [%pass / %agent [our.bol %chat-store] %poke %chat-action !>(act)] :: ++ chat-view-poke - |= act=chat-view-action + |= act=action:view ^- card [%pass / %agent [our.bol %chat-view] %poke %chat-view-action !>(act)] :: @@ -633,8 +637,8 @@ :: ++ chat-scry |= pax=path - ^- (unit mailbox) - %^ scry (unit mailbox) + ^- (unit mailbox:store) + %^ scry (unit mailbox:store) %chat-store [%mailbox pax] :: diff --git a/pkg/arvo/app/chat-store.hoon b/pkg/arvo/app/chat-store.hoon index 16cb2990a..ca8d62e51 100644 --- a/pkg/arvo/app/chat-store.hoon +++ b/pkg/arvo/app/chat-store.hoon @@ -1,6 +1,7 @@ :: chat-store: data store that holds linear sequences of chat messages :: -/+ *chat-json, *chat-eval, default-agent, verb, dbug +/- store=chat-store +/+ store-lib=chat-store, *chat-eval, default-agent, verb, dbug ~% %chat-store-top ..is ~ |% +$ card card:agent:gall @@ -10,14 +11,14 @@ state-two == :: -+$ state-zero [%0 =inbox] -+$ state-one [%1 =inbox] -+$ state-two [%2 =inbox] ++$ state-zero [%0 =inbox:store] ++$ state-one [%1 =inbox:store] ++$ state-two [%2 =inbox:store] :: +$ diff - $% [%chat-initial inbox] - [%chat-configs chat-configs] - [%chat-update chat-update] + $% [%chat-initial inbox:store] + [%chat-configs configs:store] + [%chat-update update:store] == -- :: @@ -42,10 +43,10 @@ =/ old !<(versioned-state old-vase) ?: ?=(%2 -.old) [~ this(state old)] - =/ reversed-inbox=^inbox + =/ reversed-inbox=inbox:store %- ~(run by inbox.old) - |= =mailbox - ^- ^mailbox + |= =mailbox:store + ^- mailbox:store [config.mailbox (flop envelopes.mailbox)] [~ this(state [%2 reversed-inbox])] :: @@ -57,7 +58,7 @@ =^ cards state ?+ mark (on-poke:def mark vase) %json (poke-json:cc !<(json vase)) - %chat-action (poke-chat-action:cc !<(chat-action vase)) + %chat-action (poke-chat-action:cc !<(action:store vase)) == [cards this] :: @@ -71,7 +72,7 @@ ?+ path (on-watch:def path) [%keys ~] (give %chat-update !>([%keys ~(key by inbox)])) [%all ~] (give %chat-initial !>(inbox)) - [%configs ~] (give %chat-configs !>((inbox-to-configs inbox))) + [%configs ~] (give %chat-configs !>((inbox-to-configs:store-lib inbox))) [%updates ~] ~ [%mailbox @ *] ?> (~(has by inbox) t.path) @@ -92,7 +93,7 @@ ^- (unit (unit cage)) ?+ path (on-peek:def path) [%x %all ~] ``noun+!>(inbox) - [%x %configs ~] ``noun+!>((inbox-to-configs inbox)) + [%x %configs ~] ``noun+!>((inbox-to-configs:store-lib inbox)) [%x %keys ~] ``noun+!>(~(key by inbox)) [%x %envelopes *] (peek-x-envelopes:cc t.t.path) [%x %mailbox *] @@ -159,10 +160,10 @@ ++ poke-json |= jon=json ^- (quip card _state) - (poke-chat-action (json-to-action jon)) + (poke-chat-action (action:dejs:store-lib jon)) :: ++ poke-chat-action - |= action=chat-action + |= =action:store ^- (quip card _state) ?- -.action %create (handle-create action) @@ -178,43 +179,46 @@ == :: ++ handle-create - |= act=chat-action + |= =action:store ^- (quip card _state) - ?> ?=(%create -.act) - ?: (~(has by inbox) path.act) [~ state] - :- (send-diff path.act act) - state(inbox (~(put by inbox) path.act *mailbox)) + ?> ?=(%create -.action) + ?: (~(has by inbox) path.action) [~ state] + :- (send-diff path.action action) + state(inbox (~(put by inbox) path.action *mailbox:store)) :: ++ handle-delete - |= act=chat-action + |= =action:store ^- (quip card _state) - ?> ?=(%delete -.act) - =/ mailbox=(unit mailbox) (~(get by inbox) path.act) + ?> ?=(%delete -.action) + =/ mailbox=(unit mailbox:store) + (~(get by inbox) path.action) ?~ mailbox [~ state] - :- (send-diff path.act act) - state(inbox (~(del by inbox) path.act)) + :- (send-diff path.action action) + state(inbox (~(del by inbox) path.action)) :: ++ handle-message - |= act=chat-action + |= =action:store ^- (quip card _state) - ?> ?=(%message -.act) - =/ mailbox=(unit mailbox) (~(get by inbox) path.act) + ?> ?=(%message -.action) + =/ mailbox=(unit mailbox:store) + (~(get by inbox) path.action) ?~ mailbox [~ state] - =. letter.envelope.act (evaluate-letter [author letter]:envelope.act) - =^ envelope u.mailbox (prepend-envelope u.mailbox envelope.act) - :- (send-diff path.act act(envelope envelope)) - state(inbox (~(put by inbox) path.act u.mailbox)) + =. letter.envelope.action (evaluate-letter [author letter]:envelope.action) + =^ envelope u.mailbox (prepend-envelope u.mailbox envelope.action) + :- (send-diff path.action action(envelope envelope)) + state(inbox (~(put by inbox) path.action u.mailbox)) :: ++ handle-messages - |= act=chat-action + |= act=action:store ^- (quip card _state) ?> ?=(%messages -.act) - =/ mailbox=(unit mailbox) (~(get by inbox) path.act) + =/ mailbox=(unit mailbox:store) + (~(get by inbox) path.act) ?~ mailbox [~ state] =. envelopes.act (flop envelopes.act) - =/ evaluated-envelopes=(list envelope) ~ + =| evaluated-envelopes=(list envelope:store) |- ^- (quip card _state) ?~ envelopes.act :_ state(inbox (~(put by inbox) path.act u.mailbox)) @@ -226,10 +230,10 @@ $(envelopes.act t.envelopes.act) :: ++ handle-read - |= act=chat-action + |= act=action:store ^- (quip card _state) ?> ?=(%read -.act) - =/ mailbox=(unit mailbox) (~(get by inbox) path.act) + =/ mailbox=(unit mailbox:store) (~(get by inbox) path.act) ?~ mailbox [~ state] =. read.config.u.mailbox length.config.u.mailbox @@ -237,8 +241,8 @@ state(inbox (~(put by inbox) path.act u.mailbox)) :: ++ evaluate-letter - |= [author=ship =letter] - ^- ^letter + |= [author=ship =letter:store] + ^- letter:store =? letter ?& ?=(%code -.letter) ?=(~ output.letter) @@ -249,7 +253,7 @@ letter :: ++ prepend-envelope - |= [=mailbox =envelope] + |= [=mailbox:store =envelope:store] ^+ [envelope mailbox] =. number.envelope +(length.config.mailbox) =: length.config.mailbox +(length.config.mailbox) @@ -258,12 +262,12 @@ [envelope mailbox] :: ++ update-subscribers - |= [pax=path update=chat-update] + |= [pax=path =update:store] ^- (list card) [%give %fact ~[pax] %chat-update !>(update)]~ :: ++ send-diff - |= [pax=path upd=chat-update] + |= [pax=path upd=update:store] ^- (list card) %- zing :~ (update-subscribers /all upd) diff --git a/pkg/arvo/app/chat-view.hoon b/pkg/arvo/app/chat-view.hoon index a967f791b..a13bd6565 100644 --- a/pkg/arvo/app/chat-view.hoon +++ b/pkg/arvo/app/chat-view.hoon @@ -8,8 +8,14 @@ *metadata-store, *permission-group-hook, *chat-hook, - *metadata-hook -/+ *server, *chat-json, default-agent, verb, dbug + *metadata-hook, + *rw-security, + store=chat-store, + hook=chat-hook, + view=chat-view +/+ *server, default-agent, verb, dbug, + store-lib=chat-store, + view-lib=chat-view /= index /^ octs /; as-octs:mimes:html @@ -48,9 +54,9 @@ :: +$ poke $% [%launch-action [@tas path @t]] - [%chat-action chat-action] + [%chat-action action:store] [%group-action group-action] - [%chat-hook-action chat-hook-action] + [%chat-hook-action action:hook] [%permission-hook-action permission-hook-action] [%permission-group-hook-action permission-group-hook-action] == @@ -89,11 +95,11 @@ :: %json :_ this - (poke-chat-view-action:cc (json-to-view-action !<(json vase))) + (poke-chat-view-action:cc (action:dejs:view-lib !<(json vase))) :: %chat-view-action :_ this - (poke-chat-view-action:cc !<(chat-view-action vase)) + (poke-chat-view-action:cc !<(action:view vase)) == :: ++ on-watch @@ -108,7 +114,7 @@ :: create inbox with 20 messages max per mailbox and send that along :: then quit the subscription :_ this - [%give %fact ~ %json !>((inbox-to-json truncated-inbox-scry))]~ + [%give %fact ~ %json !>((inbox:enjs:store-lib truncated-inbox-scry))]~ ?: =(/configs path) [[%give %fact ~ %json !>(*json)]~ this] (on-watch:def path) @@ -116,11 +122,12 @@ ++ message-limit 20 :: ++ truncated-inbox-scry - ^- inbox - =/ =inbox .^(inbox %gx /=chat-store/(scot %da now.bol)/all/noun) + ^- inbox:store + =/ =inbox:store + .^(inbox:store %gx /=chat-store/(scot %da now.bol)/all/noun) %- ~(run by inbox) - |= =mailbox - ^- ^mailbox + |= =mailbox:store + ^- mailbox:store [config.mailbox (scag message-limit envelopes.mailbox)] -- :: @@ -137,7 +144,7 @@ ?+ p.cage.sign (on-agent:def wire sign) %chat-update :_ this - (diff-chat-update:cc !<(chat-update q.cage.sign)) + (diff-chat-update:cc !<(update:store q.cage.sign)) == == :: @@ -183,7 +190,7 @@ =/ envelopes (envelope-scry [(scot %ud start) (scot %ud end) pax]) %- json-response:gen %- json-to-octs - %- update-to-json + %- update:enjs:store-lib [%messages pax start end envelopes] :: [%'~chat' *] (html-response:gen index) @@ -193,10 +200,10 @@ |= jon=json ^- (list card) ?> (team:title our.bol src.bol) - (poke-chat-view-action (json-to-view-action jon)) + (poke-chat-view-action (action:dejs:view-lib jon)) :: ++ poke-chat-view-action - |= act=chat-view-action + |= act=action:view ^- (list card) |^ ?> (team:title our.bol src.bol) @@ -260,8 +267,8 @@ ?> ?=([%'~' ^] app-path.act) :: retrieve old data :: - =/ data=(unit mailbox) - (scry-for (unit mailbox) %chat-store [%mailbox app-path.act]) + =/ data=(unit mailbox:store) + (scry-for (unit mailbox:store) %chat-store [%mailbox app-path.act]) ?~ data ~& [%cannot-groupify-nonexistent app-path.act] ~ @@ -421,9 +428,9 @@ :: ++ chat-scry |= pax=path - ^- (unit mailbox) + ^- (unit mailbox:store) =. pax ;:(weld /=chat-store/(scot %da now.bol)/mailbox pax /noun) - .^((unit mailbox) %gx pax) + .^((unit mailbox:store) %gx pax) :: ++ maybe-group-from-chat |= app-path=path @@ -478,10 +485,10 @@ -- :: ++ diff-chat-update - |= upd=chat-update + |= upd=update:store ^- (list card) - =/ updates-json (update-to-json upd) - =/ configs-json (configs-to-json configs-scry) + =/ updates-json (update:enjs:store-lib upd) + =/ configs-json (configs:enjs:store-lib configs-scry) :~ [%give %fact ~[/primary] %json !>(updates-json)] [%give %fact ~[/configs] %json !>(configs-json)] == @@ -489,7 +496,7 @@ :: +utilities :: ++ chat-poke - |= act=chat-action + |= act=action:store ^- card [%pass / %agent [our.bol %chat-store] %poke %chat-action !>(act)] :: @@ -504,7 +511,7 @@ [%pass / %agent [our.bol %permission-store] %poke %permission-action !>(act)] :: ++ chat-hook-poke - |= act=chat-hook-action + |= act=action:hook ^- card [%pass / %agent [our.bol %chat-hook] %poke %chat-hook-action !>(act)] :: @@ -524,12 +531,12 @@ :: ++ envelope-scry |= pax=path - ^- (list envelope) - (scry-for (list envelope) %chat-store [%envelopes pax]) + ^- (list envelope:store) + (scry-for (list envelope:store) %chat-store [%envelopes pax]) :: ++ configs-scry - ^- chat-configs - (scry-for chat-configs %chat-store /configs) + ^- configs:store + (scry-for configs:store %chat-store /configs) :: ++ group-scry |= pax=path diff --git a/pkg/arvo/lib/chat-hook.hoon b/pkg/arvo/lib/chat-hook.hoon new file mode 100644 index 000000000..ce2fb9858 --- /dev/null +++ b/pkg/arvo/lib/chat-hook.hoon @@ -0,0 +1,49 @@ +/- *chat-hook +^? +|% +:: +++ enjs + |% + ++ update + |= upd=^update + =, enjs:format + ^- json + %+ frond %chat-hook-update + %- pairs + %+ turn ~(tap by synced.upd) + |= [pax=^path shp=^ship] + ^- [cord json] + [(spat pax) s+(scot %p shp)] + -- +++ dejs + |% + :: + ++ action + |= jon=json + ^- ^action + =, dejs:format + =< (parse-json jon) + |% + :: + ++ parse-json + %- of + :~ [%add-owned add-owned] + [%add-synced add-synced] + [%remove pa] + == + :: + ++ add-owned + %- ot + :~ [%path pa] + [%allow-history bo] + == + :: + ++ add-synced + %- ot + :~ [%ship (su ;~(pfix sig fed:ag))] + [%path pa] + [%ask-history bo] + == + -- + -- +-- diff --git a/pkg/arvo/lib/chat-json.hoon b/pkg/arvo/lib/chat-json.hoon deleted file mode 100644 index 349d3de88..000000000 --- a/pkg/arvo/lib/chat-json.hoon +++ /dev/null @@ -1,294 +0,0 @@ -/- *chat-store, *chat-hook, *chat-view -/+ chat-eval -|% -:: -++ slan |=(mod/@tas |=(txt/@ta (need (slaw mod txt)))) -:: -++ seri ::: serial - =, dejs:format - ^- $-(json serial) - (cu (slan %uv) so) -:: -++ re :: recursive reparsers - |* {gar/* sef/_|.(fist:dejs-soft:format)} - |= jon/json - ^- (unit _gar) - =- ~! gar ~! (need -) - - ((sef) jon) -:: -++ dank :: tank - ^- $-(json (unit tank)) - =, ^? dejs-soft:format - %+ re *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) ~) - == -:: -++ eval ::: %exp speech - ::: extract contents of an %exp speech, evaluating - ::: the {exp} if there is no {res} yet. - :: - |= a=json - ^- [cord (list tank)] - =, ^? dejs-soft:format - =+ exp=((ot expression+so ~) a) - %- need - ?~ exp [~ '' ~] - :+ ~ u.exp - ::NOTE when sending, if output is an empty list, chat-store will evaluate - (fall ((ot output+(ar dank) ~) a) ~) -:: -++ lett - |= =letter - ^- json - =, enjs:format - ?- -.letter - %text - (frond %text s+text.letter) - :: - %url - (frond %url s+url.letter) - :: - %code - %+ frond %code - %- pairs - :~ [%expression s+expression.letter] - [%output a+(turn output.letter tank)] - == - :: - %me - (frond %me s+narrative.letter) - :: - == -:: -++ enve - |= =envelope - ^- json - =, enjs:format - %- pairs - :~ [%uid s+(scot %uv uid.envelope)] - [%number (numb number.envelope)] - [%author (ship author.envelope)] - [%when (time when.envelope)] - [%letter (lett letter.envelope)] - == -:: -++ conf - |= =config - ^- json - =, enjs:format - %- pairs - :~ [%length (numb length.config)] - [%read (numb read.config)] - == -:: -++ inbox-to-configs - |= =inbox - ^- chat-configs - %- ~(run by inbox) - |= =mailbox - ^- config - config.mailbox -:: -++ configs-to-json - |= cfg=chat-configs - =, enjs:format - ^- json - %+ frond %chat-configs - %- pairs - %+ turn ~(tap by cfg) - |= [pax=^path =config] - ^- [cord json] - [(spat pax) (conf config)] -:: -++ inbox-to-json - |= box=inbox - =, enjs:format - ^- json - %+ frond %chat-initial - %- pairs - %+ turn ~(tap by box) - |= [pax=^path =mailbox] - ^- [cord json] - :- (spat pax) - %- pairs - :~ [%envelopes [%a (turn envelopes.mailbox enve)]] - [%config (conf config.mailbox)] - == -:: -++ hook-update-to-json - |= upd=chat-hook-update - =, enjs:format - ^- json - %+ frond %chat-hook-update - %- pairs - %+ turn ~(tap by synced.upd) - |= [pax=^path shp=^ship] - ^- [cord json] - [(spat pax) s+(scot %p shp)] -:: -++ update-to-json - |= upd=chat-update - =, enjs:format - ^- json - %+ frond %chat-update - %- pairs - :~ - ?: ?=(%message -.upd) - :- %message - %- pairs - :~ [%path (path path.upd)] - [%envelope (enve envelope.upd)] - == - ?: ?=(%messages -.upd) - :- %messages - %- pairs - :~ [%path (path path.upd)] - [%start (numb start.upd)] - [%end (numb end.upd)] - [%envelopes [%a (turn envelopes.upd enve)]] - == - ?: ?=(%read -.upd) - [%read (pairs [%path (path path.upd)]~)] - ?: ?=(%create -.upd) - [%create (pairs [%path (path path.upd)]~)] - ?: ?=(%delete -.upd) - [%delete (pairs [%path (path path.upd)]~)] - ?: ?=(%config -.upd) - :- %config - %- pairs - :~ [%path (path path.upd)] - [%config (conf config.upd)] - == - [*@t *^json] - == -:: -++ json-to-action - |= jon=json - ^- chat-action - =, dejs:format - =< (parse-json jon) - |% - ++ parse-json - %- of - :~ [%create create] - [%delete delete] - [%message message] - [%messages messages] - [%read read] - == - :: - ++ create - (ot [%path pa]~) - :: - ++ delete - (ot [%path pa]~) - :: - ++ message - %- ot - :~ [%path pa] - [%envelope envelope] - == - :: - ++ messages - %- ot - :~ [%path pa] - [%envelopes (ar envelope)] - == - :: - ++ read - (ot [%path pa] ~) - :: - ++ envelope - %- ot - :~ [%uid seri] - [%number ni] - [%author (su ;~(pfix sig fed:ag))] - [%when di] - [%letter letter] - == - :: - ++ letter - %- of - :~ [%text so] - [%url so] - [%code eval] - [%me so] - == - :: - -- -:: -++ json-to-hook-action - |= jon=json - ^- chat-hook-action - =, dejs:format - =< (parse-json jon) - |% - ++ parse-json - %- of - :~ [%add-owned add-owned] - [%add-synced add-synced] - [%remove pa] - == - :: - ++ add-owned - %- ot - :~ [%path pa] - [%allow-history bo] - == - :: - ++ add-synced - %- ot - :~ [%ship (su ;~(pfix sig fed:ag))] - [%path pa] - [%ask-history bo] - == - -- -:: -++ json-to-view-action - |= jon=json - ^- chat-view-action - =, dejs:format - =< (parse-json jon) - |% - ++ parse-json - %- of - :~ [%create create] - [%delete delete] - [%join join] - [%groupify groupify] - == - :: - ++ create - %- ot - :~ [%title so] - [%description so] - [%app-path pa] - [%group-path pa] - [%security sec] - [%members (as (su ;~(pfix sig fed:ag)))] - [%allow-history bo] - == - :: - ++ delete - (ot [%app-path pa]~) - :: - ++ join - %- ot - :~ [%ship (su ;~(pfix sig fed:ag))] - [%app-path pa] - [%ask-history bo] - == - :: - ++ groupify - =- (ot [%app-path pa] [%existing -] ~) - (mu (ot [%group-path pa] [%inclusive bo] ~)) - :: - ++ sec - =, dejs:format - ^- $-(json rw-security) - (su (perk %channel %village %journal %mailbox ~)) - -- --- diff --git a/pkg/arvo/lib/chat-store.hoon b/pkg/arvo/lib/chat-store.hoon new file mode 100644 index 000000000..4dba0eabd --- /dev/null +++ b/pkg/arvo/lib/chat-store.hoon @@ -0,0 +1,210 @@ +/- *chat-store +^? +|% +++ enjs + =, enjs:format + |% + :: + ++ letter + |= =^letter + ^- json + =, enjs:format + ?- -.letter + %text + (frond %text s+text.letter) + :: + %url + (frond %url s+url.letter) + :: + %code + %+ frond %code + %- pairs + :~ [%expression s+expression.letter] + [%output a+(turn output.letter tank)] + == + :: + %me + (frond %me s+narrative.letter) + :: + == + :: + ++ envelope + |= =^envelope + ^- json + %- pairs + :~ [%uid s+(scot %uv uid.envelope)] + [%number (numb number.envelope)] + [%author (ship author.envelope)] + [%when (time when.envelope)] + [%letter (letter letter.envelope)] + == + :: + ++ config + |= =^config + ^- json + =, enjs:format + %- pairs + :~ [%length (numb length.config)] + [%read (numb read.config)] + == + :: + ++ configs + |= cfg=^configs + ^- json + %+ frond %chat-configs + %- pairs + %+ turn ~(tap by cfg) + |= [pax=^path =^config] + ^- [cord json] + [(spat pax) (^config config)] + :: + ++ inbox + |= box=^inbox + ^- json + %+ frond %chat-initial + %- pairs + %+ turn ~(tap by box) + |= [pax=^path =mailbox] + ^- [cord json] + :- (spat pax) + %- pairs + :~ [%envelopes [%a (turn envelopes.mailbox envelope)]] + [%config (config config.mailbox)] + == + :: + ++ update + |= upd=^update + ^- json + %+ frond %chat-update + %- pairs + :~ + ?: ?=(%message -.upd) + :- %message + %- pairs + :~ [%path (path path.upd)] + [%envelope (envelope envelope.upd)] + == + ?: ?=(%messages -.upd) + :- %messages + %- pairs + :~ [%path (path path.upd)] + [%start (numb start.upd)] + [%end (numb end.upd)] + [%envelopes [%a (turn envelopes.upd envelope)]] + == + ?: ?=(%read -.upd) + [%read (pairs [%path (path path.upd)]~)] + ?: ?=(%create -.upd) + [%create (pairs [%path (path path.upd)]~)] + ?: ?=(%delete -.upd) + [%delete (pairs [%path (path path.upd)]~)] + ?: ?=(%config -.upd) + :- %config + %- pairs + :~ [%path (path path.upd)] + [%config (config config.upd)] + == + [*@t *json] + == + -- +++ dejs + =, dejs:format + |% + :: + ++ action + |= jon=json + ^- ^action + =< (parse-json jon) + |% + ++ parse-json + %- of + :~ [%create create] + [%delete delete] + [%message message] + [%messages messages] + [%read read] + == + :: + ++ create + (ot [%path pa]~) + :: + ++ delete + (ot [%path pa]~) + :: + ++ message + %- ot + :~ [%path pa] + [%envelope envelope] + == + :: + ++ messages + %- ot + :~ [%path pa] + [%envelopes (ar envelope)] + == + :: + ++ read + (ot [%path pa] ~) + :: + ++ envelope + %- ot + :~ [%uid serial] + [%number ni] + [%author (su ;~(pfix sig fed:ag))] + [%when di] + [%letter letter] + == + :: + ++ letter + %- of + :~ [%text so] + [%url so] + [%code eval] + [%me so] + == + :: + ++ serial + ^- $-(json ^serial) + (cu (cury slav %uv) so) + :: + ++ re :: recursive reparsers + |* {gar/* sef/_|.(fist:dejs-soft:format)} + |= jon/json + ^- (unit _gar) + =- ~! gar ~! (need -) - + ((sef) jon) + :: + ++ dank :: tank + ^- $-(json (unit tank)) + =, ^? dejs-soft:format + %+ re *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) ~) + == + :: %exp speech + ++ eval + ::: extract contents of an %exp speech, evaluating + ::: the {exp} if there is no {res} yet. + :: + |= a=json + ^- [cord (list tank)] + =, ^? dejs-soft:format + =+ exp=((ot expression+so ~) a) + %- need + ?~ exp [~ '' ~] + :+ ~ u.exp + ::NOTE when sending, if output is an empty list, chat-store will evaluate + (fall ((ot output+(ar dank) ~) a) ~) + :: + -- + -- +++ inbox-to-configs + |= =inbox + ^- configs + %- ~(run by inbox) + |= =mailbox + ^- config + config.mailbox +-- diff --git a/pkg/arvo/lib/chat-view.hoon b/pkg/arvo/lib/chat-view.hoon new file mode 100644 index 000000000..ab59bbcee --- /dev/null +++ b/pkg/arvo/lib/chat-view.hoon @@ -0,0 +1,51 @@ +/- *chat-view, *rw-security +^? +|% +++ dejs + |% + ++ action + |= jon=json + ^- ^action + =, dejs:format + =< (parse-json jon) + |% + ++ parse-json + %- of + :~ [%create create] + [%delete delete] + [%join join] + [%groupify groupify] + == + :: + ++ create + %- ot + :~ [%title so] + [%description so] + [%app-path pa] + [%group-path pa] + [%security sec] + [%members (as (su ;~(pfix sig fed:ag)))] + [%allow-history bo] + == + :: + ++ delete + (ot [%app-path pa]~) + :: + ++ join + %- ot + :~ [%ship (su ;~(pfix sig fed:ag))] + [%app-path pa] + [%ask-history bo] + == + :: + ++ groupify + =- (ot [%app-path pa] [%existing -] ~) + (mu (ot [%group-path pa] [%inclusive bo] ~)) + :: + ++ sec + =, dejs:format + ^- $-(json rw-security) + (su (perk %channel %village %journal %mailbox ~)) + -- + -- +-- diff --git a/pkg/arvo/mar/chat/action.hoon b/pkg/arvo/mar/chat/action.hoon index 7d1b7a985..760e79b3b 100644 --- a/pkg/arvo/mar/chat/action.hoon +++ b/pkg/arvo/mar/chat/action.hoon @@ -1,11 +1,12 @@ -/+ *chat-json +/- *chat-store +/+ *chat-store =, dejs:format -|_ act=chat-action +|_ act=action ++ grab |% - ++ noun chat-action + ++ noun action ++ json |= jon=^json - (json-to-action jon) + (action:dejs jon) -- -- diff --git a/pkg/arvo/mar/chat/config.hoon b/pkg/arvo/mar/chat/config.hoon index 3ee5c1cd1..4bdeff05a 100644 --- a/pkg/arvo/mar/chat/config.hoon +++ b/pkg/arvo/mar/chat/config.hoon @@ -1,9 +1,10 @@ -/+ *chat-json +/- *chat-store +/+ *chat-store |_ cfg=config :: ++ grow |% - ++ json (conf cfg) + ++ json (config:enjs cfg) -- :: ++ grab diff --git a/pkg/arvo/mar/chat/configs.hoon b/pkg/arvo/mar/chat/configs.hoon index aaf682e9a..2a3583fcd 100644 --- a/pkg/arvo/mar/chat/configs.hoon +++ b/pkg/arvo/mar/chat/configs.hoon @@ -1,14 +1,15 @@ -/+ *chat-json -|_ cfg=(map path config) +/- *chat-store +/+ *chat-store +|_ cfg=configs :: ++ grow |% - ++ json (configs-to-json cfg) + ++ json (configs:dejs cfg) -- :: ++ grab |% - ++ noun chat-configs + ++ noun configs -- :: -- diff --git a/pkg/arvo/mar/chat/hook-action.hoon b/pkg/arvo/mar/chat/hook-action.hoon index 77e5b247b..309449ab7 100644 --- a/pkg/arvo/mar/chat/hook-action.hoon +++ b/pkg/arvo/mar/chat/hook-action.hoon @@ -1,11 +1,12 @@ -/+ *chat-json -|_ act=chat-hook-action +/- *chat-hook +/+ *chat-hook +|_ act=action ++ grab |% - ++ noun chat-hook-action + ++ noun action ++ json |= jon=^json - (json-to-hook-action jon) + (action:dejs jon) -- -- diff --git a/pkg/arvo/mar/chat/hook-update.hoon b/pkg/arvo/mar/chat/hook-update.hoon index 71d117ee4..61a13dfe0 100644 --- a/pkg/arvo/mar/chat/hook-update.hoon +++ b/pkg/arvo/mar/chat/hook-update.hoon @@ -1,13 +1,14 @@ -/+ *chat-json -|_ upd=chat-hook-update +/- *chat-hook +/+ *chat-hook +|_ upd=update ++ grow |% - ++ json (hook-update-to-json upd) + ++ json (update:enjs upd) -- :: ++ grab |% - ++ noun chat-hook-update + ++ noun update -- :: -- diff --git a/pkg/arvo/mar/chat/initial.hoon b/pkg/arvo/mar/chat/initial.hoon index d19b0884f..7e4b0b389 100644 --- a/pkg/arvo/mar/chat/initial.hoon +++ b/pkg/arvo/mar/chat/initial.hoon @@ -1,9 +1,10 @@ -/+ *chat-json +/- *chat-store +/+ *chat-store |_ box=inbox :: ++ grow |% - ++ json (inbox-to-json box) + ++ json (inbox:enjs box) -- :: ++ grab diff --git a/pkg/arvo/mar/chat/update.hoon b/pkg/arvo/mar/chat/update.hoon index 9a6a3d49f..eb4a9eaf0 100644 --- a/pkg/arvo/mar/chat/update.hoon +++ b/pkg/arvo/mar/chat/update.hoon @@ -1,13 +1,14 @@ -/+ *chat-json -|_ upd=chat-update +/- *chat-store +/+ *chat-store +|_ upd=update ++ grow |% - ++ json (update-to-json upd) + ++ json (update:enjs upd) -- :: ++ grab |% - ++ noun chat-update + ++ noun update -- :: -- diff --git a/pkg/arvo/mar/chat/view-action.hoon b/pkg/arvo/mar/chat/view-action.hoon index a87889eda..8ff03f8a9 100644 --- a/pkg/arvo/mar/chat/view-action.hoon +++ b/pkg/arvo/mar/chat/view-action.hoon @@ -1,11 +1,11 @@ -/+ *chat-json -=, dejs:format -|_ act=chat-action +/- *chat-view +/+ *chat-view +|_ act=action ++ grab |% - ++ noun chat-view-action + ++ noun action ++ json |= jon=^json - (json-to-view-action jon) + (action:dejs jon) -- -- diff --git a/pkg/arvo/sur/chat-hook.hoon b/pkg/arvo/sur/chat-hook.hoon index 29202a5f8..5697b2045 100644 --- a/pkg/arvo/sur/chat-hook.hoon +++ b/pkg/arvo/sur/chat-hook.hoon @@ -1,7 +1,8 @@ /- *rw-security +^? |% +$ synced (map path ship) -+$ chat-hook-action ++$ action $% :: %add-owned: make a chatroom accessible to foreign ships :: [%add-owned =path allow-history=?] @@ -14,5 +15,5 @@ [%remove =path] == :: -+$ chat-hook-update [%initial =synced] ++$ update [%initial =synced] -- diff --git a/pkg/arvo/sur/chat-store.hoon b/pkg/arvo/sur/chat-store.hoon index 1dbca693d..1bae255dc 100644 --- a/pkg/arvo/sur/chat-store.hoon +++ b/pkg/arvo/sur/chat-store.hoon @@ -1,3 +1,4 @@ +^? |% +$ serial @uvH :: @@ -28,26 +29,26 @@ :: +$ inbox (map path mailbox) :: -+$ chat-configs (map path config) ++$ configs (map path config) :: -+$ chat-base ++$ diff $% [%create =path] :: %create: create a mailbox at path [%delete =path] :: %delete: delete a mailbox at path [%message =path =envelope] :: %message: append a message to mailbox [%read =path] :: %read: set mailbox to read == :: -+$ chat-action ++$ action $% :: %messages: append a list of messages to mailbox :: [%messages =path envelopes=(list envelope)] - chat-base + diff == :: -+$ chat-update ++$ update $% [%keys keys=(set path)] [%config =path =config] [%messages =path start=@ud end=@ud envelopes=(list envelope)] - chat-base + diff == -- diff --git a/pkg/arvo/sur/chat-view.hoon b/pkg/arvo/sur/chat-view.hoon index 73b4d0d1a..d92eafb75 100644 --- a/pkg/arvo/sur/chat-view.hoon +++ b/pkg/arvo/sur/chat-view.hoon @@ -1,6 +1,7 @@ /- *rw-security +^? |% -+$ chat-view-action ++$ action $% :: %create: create a new chat :: :: if :app-path and :group-path are different, :members must be empty, From 531efa82a9a43ab9c19851e03678d381d76f74d6 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Wed, 29 Apr 2020 18:36:12 +1000 Subject: [PATCH 2/6] chat: address review comments --- pkg/arvo/app/chat-hook.hoon | 4 +- pkg/arvo/lib/chat-store.hoon | 138 ++++++++++++++--------------- pkg/arvo/lib/chat-view.hoon | 52 +++++------ pkg/arvo/mar/chat/action.hoon | 4 +- pkg/arvo/mar/chat/hook-action.hoon | 4 +- pkg/arvo/mar/chat/view-action.hoon | 4 +- 6 files changed, 100 insertions(+), 106 deletions(-) diff --git a/pkg/arvo/app/chat-hook.hoon b/pkg/arvo/app/chat-hook.hoon index 50cb3194b..81455d46f 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, *chat-hook, *invite-store, *metadata-store, +/- *permission-store, *invite-store, *metadata-store, *permission-hook, *group-store, *permission-group-hook, ::TMP for upgrade hook=chat-hook, store=chat-store, @@ -24,7 +24,7 @@ == +$ state-0 [%0 state-base] +$ state-base - $: =synced + $: =synced:hook invite-created=_| allow-history=(map path ?) == diff --git a/pkg/arvo/lib/chat-store.hoon b/pkg/arvo/lib/chat-store.hoon index 4dba0eabd..f136cdeba 100644 --- a/pkg/arvo/lib/chat-store.hoon +++ b/pkg/arvo/lib/chat-store.hoon @@ -29,83 +29,83 @@ == :: ++ envelope - |= =^envelope - ^- json - %- pairs - :~ [%uid s+(scot %uv uid.envelope)] - [%number (numb number.envelope)] - [%author (ship author.envelope)] - [%when (time when.envelope)] - [%letter (letter letter.envelope)] - == + |= =^envelope + ^- json + %- pairs + :~ [%uid s+(scot %uv uid.envelope)] + [%number (numb number.envelope)] + [%author (ship author.envelope)] + [%when (time when.envelope)] + [%letter (letter letter.envelope)] + == :: ++ config - |= =^config - ^- json - =, enjs:format - %- pairs - :~ [%length (numb length.config)] - [%read (numb read.config)] - == + |= =^config + ^- json + =, enjs:format + %- pairs + :~ [%length (numb length.config)] + [%read (numb read.config)] + == :: ++ configs - |= cfg=^configs - ^- json - %+ frond %chat-configs - %- pairs - %+ turn ~(tap by cfg) - |= [pax=^path =^config] - ^- [cord json] - [(spat pax) (^config config)] + |= cfg=^configs + ^- json + %+ frond %chat-configs + %- pairs + %+ turn ~(tap by cfg) + |= [pax=^path =^config] + ^- [cord json] + [(spat pax) (^config config)] :: ++ inbox - |= box=^inbox - ^- json - %+ frond %chat-initial - %- pairs - %+ turn ~(tap by box) - |= [pax=^path =mailbox] - ^- [cord json] - :- (spat pax) - %- pairs - :~ [%envelopes [%a (turn envelopes.mailbox envelope)]] - [%config (config config.mailbox)] - == + |= box=^inbox + ^- json + %+ frond %chat-initial + %- pairs + %+ turn ~(tap by box) + |= [pax=^path =mailbox] + ^- [cord json] + :- (spat pax) + %- pairs + :~ [%envelopes [%a (turn envelopes.mailbox envelope)]] + [%config (config config.mailbox)] + == :: ++ update - |= upd=^update - ^- json - %+ frond %chat-update - %- pairs - :~ - ?: ?=(%message -.upd) - :- %message - %- pairs - :~ [%path (path path.upd)] - [%envelope (envelope envelope.upd)] - == - ?: ?=(%messages -.upd) - :- %messages - %- pairs - :~ [%path (path path.upd)] - [%start (numb start.upd)] - [%end (numb end.upd)] - [%envelopes [%a (turn envelopes.upd envelope)]] - == - ?: ?=(%read -.upd) - [%read (pairs [%path (path path.upd)]~)] - ?: ?=(%create -.upd) - [%create (pairs [%path (path path.upd)]~)] - ?: ?=(%delete -.upd) - [%delete (pairs [%path (path path.upd)]~)] - ?: ?=(%config -.upd) - :- %config - %- pairs - :~ [%path (path path.upd)] - [%config (config config.upd)] - == - [*@t *json] - == + |= upd=^update + ^- json + %+ frond %chat-update + %- pairs + :~ + ?: ?=(%message -.upd) + :- %message + %- pairs + :~ [%path (path path.upd)] + [%envelope (envelope envelope.upd)] + == + ?: ?=(%messages -.upd) + :- %messages + %- pairs + :~ [%path (path path.upd)] + [%start (numb start.upd)] + [%end (numb end.upd)] + [%envelopes [%a (turn envelopes.upd envelope)]] + == + ?: ?=(%read -.upd) + [%read (pairs [%path (path path.upd)]~)] + ?: ?=(%create -.upd) + [%create (pairs [%path (path path.upd)]~)] + ?: ?=(%delete -.upd) + [%delete (pairs [%path (path path.upd)]~)] + ?: ?=(%config -.upd) + :- %config + %- pairs + :~ [%path (path path.upd)] + [%config (config config.upd)] + == + [*@t *json] + == -- ++ dejs =, dejs:format diff --git a/pkg/arvo/lib/chat-view.hoon b/pkg/arvo/lib/chat-view.hoon index ab59bbcee..bcbdd9e4c 100644 --- a/pkg/arvo/lib/chat-view.hoon +++ b/pkg/arvo/lib/chat-view.hoon @@ -10,42 +10,42 @@ =< (parse-json jon) |% ++ parse-json - %- of - :~ [%create create] - [%delete delete] - [%join join] - [%groupify groupify] - == + %- of + :~ [%create create] + [%delete delete] + [%join join] + [%groupify groupify] + == :: ++ create - %- ot - :~ [%title so] - [%description so] - [%app-path pa] - [%group-path pa] - [%security sec] - [%members (as (su ;~(pfix sig fed:ag)))] - [%allow-history bo] - == + %- ot + :~ [%title so] + [%description so] + [%app-path pa] + [%group-path pa] + [%security sec] + [%members (as (su ;~(pfix sig fed:ag)))] + [%allow-history bo] + == :: ++ delete - (ot [%app-path pa]~) + (ot [%app-path pa]~) :: ++ join - %- ot - :~ [%ship (su ;~(pfix sig fed:ag))] - [%app-path pa] - [%ask-history bo] - == + %- ot + :~ [%ship (su ;~(pfix sig fed:ag))] + [%app-path pa] + [%ask-history bo] + == :: ++ groupify - =- (ot [%app-path pa] [%existing -] ~) - (mu (ot [%group-path pa] [%inclusive bo] ~)) + =- (ot [%app-path pa] [%existing -] ~) + (mu (ot [%group-path pa] [%inclusive bo] ~)) :: ++ sec - =, dejs:format - ^- $-(json rw-security) - (su (perk %channel %village %journal %mailbox ~)) + =, dejs:format + ^- $-(json rw-security) + (su (perk %channel %village %journal %mailbox ~)) -- -- -- diff --git a/pkg/arvo/mar/chat/action.hoon b/pkg/arvo/mar/chat/action.hoon index 760e79b3b..96a009bab 100644 --- a/pkg/arvo/mar/chat/action.hoon +++ b/pkg/arvo/mar/chat/action.hoon @@ -5,8 +5,6 @@ ++ grab |% ++ noun action - ++ json - |= jon=^json - (action:dejs jon) + ++ json action:dejs -- -- diff --git a/pkg/arvo/mar/chat/hook-action.hoon b/pkg/arvo/mar/chat/hook-action.hoon index 309449ab7..72caa1196 100644 --- a/pkg/arvo/mar/chat/hook-action.hoon +++ b/pkg/arvo/mar/chat/hook-action.hoon @@ -4,9 +4,7 @@ ++ grab |% ++ noun action - ++ json - |= jon=^json - (action:dejs jon) + ++ json action:dejs -- -- diff --git a/pkg/arvo/mar/chat/view-action.hoon b/pkg/arvo/mar/chat/view-action.hoon index 8ff03f8a9..402411333 100644 --- a/pkg/arvo/mar/chat/view-action.hoon +++ b/pkg/arvo/mar/chat/view-action.hoon @@ -4,8 +4,6 @@ ++ grab |% ++ noun action - ++ json - |= jon=^json - (action:dejs jon) + ++ json action:dejs -- -- From d7a5499b9a2be5fe9679a1ba73d6e5ea877db8ba Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Thu, 30 Apr 2020 09:04:29 +1000 Subject: [PATCH 3/6] chat: expose types with libs --- pkg/arvo/app/chat-cli.hoon | 6 +-- pkg/arvo/app/chat-hook.hoon | 7 ++-- pkg/arvo/app/chat-store.hoon | 11 +++-- pkg/arvo/app/chat-view.hoon | 20 ++++----- pkg/arvo/lib/chat-hook.hoon | 1 - pkg/arvo/lib/chat-store.hoon | 66 ++++++++++++++++++++---------- pkg/arvo/lib/chat-view.hoon | 1 - pkg/arvo/lib/chat/eval.hoon | 23 ----------- pkg/arvo/mar/chat/action.hoon | 2 - pkg/arvo/mar/chat/config.hoon | 1 - pkg/arvo/mar/chat/configs.hoon | 1 - pkg/arvo/mar/chat/hook-action.hoon | 1 - pkg/arvo/mar/chat/hook-update.hoon | 1 - pkg/arvo/mar/chat/initial.hoon | 1 - pkg/arvo/mar/chat/update.hoon | 1 - pkg/arvo/mar/chat/view-action.hoon | 1 - 16 files changed, 64 insertions(+), 80 deletions(-) delete mode 100644 pkg/arvo/lib/chat/eval.hoon diff --git a/pkg/arvo/app/chat-cli.hoon b/pkg/arvo/app/chat-cli.hoon index 5ae875d6c..2d3db35b8 100644 --- a/pkg/arvo/app/chat-cli.hoon +++ b/pkg/arvo/app/chat-cli.hoon @@ -9,10 +9,10 @@ :: we concat the ship onto the head of the path, :: and trust it to take care of the rest. :: -/- store=chat-store, view=chat-view, hook=chat-hook, +/- view=chat-view, hook=chat-hook, *permission-store, *group-store, *invite-store, *rw-security, sole-sur=sole -/+ sole-lib=sole, chat-eval, default-agent, verb, dbug, +/+ sole-lib=sole, default-agent, verb, dbug, store=chat-store, auto=language-server-complete :: |% @@ -978,7 +978,7 @@ :: ++ eval |= [txt=cord exe=hoon] - (say %code txt (eval:chat-eval bowl exe)) + (say %code txt (eval:store bowl exe)) :: +lookup-glyph: print glyph info for all, glyph or target :: ++ lookup-glyph diff --git a/pkg/arvo/app/chat-hook.hoon b/pkg/arvo/app/chat-hook.hoon index 81455d46f..c582ea550 100644 --- a/pkg/arvo/app/chat-hook.hoon +++ b/pkg/arvo/app/chat-hook.hoon @@ -5,9 +5,8 @@ /- *permission-store, *invite-store, *metadata-store, *permission-hook, *group-store, *permission-group-hook, ::TMP for upgrade hook=chat-hook, - store=chat-store, view=chat-view -/+ *chat-eval, default-agent, verb, dbug, store-lib=chat-store +/+ default-agent, verb, dbug, store=chat-store ~% %chat-hook-top ..is ~ |% +$ card card:agent:gall @@ -301,7 +300,7 @@ ++ poke-json |= jon=json ^- (quip card _state) - (poke-chat-action (action:dejs:store-lib jon)) + (poke-chat-action (action:dejs:store jon)) :: ++ poke-chat-action |= act=action:store @@ -315,7 +314,7 @@ =* letter letter.envelope.act =? letter &(?=(%code -.letter) ?=(~ output.letter)) =/ =hoon (ream expression.letter) - letter(output (eval bol hoon)) + letter(output (eval:store bol hoon)) =/ ship (~(got by synced) path.act) =/ appl ?:(=(ship our.bol) %chat-store %chat-hook) [%pass / %agent [ship appl] %poke %chat-action !>(act)]~ diff --git a/pkg/arvo/app/chat-store.hoon b/pkg/arvo/app/chat-store.hoon index ca8d62e51..ab4d3e6a6 100644 --- a/pkg/arvo/app/chat-store.hoon +++ b/pkg/arvo/app/chat-store.hoon @@ -1,7 +1,6 @@ :: chat-store: data store that holds linear sequences of chat messages :: -/- store=chat-store -/+ store-lib=chat-store, *chat-eval, default-agent, verb, dbug +/+ store=chat-store, default-agent, verb, dbug ~% %chat-store-top ..is ~ |% +$ card card:agent:gall @@ -72,7 +71,7 @@ ?+ path (on-watch:def path) [%keys ~] (give %chat-update !>([%keys ~(key by inbox)])) [%all ~] (give %chat-initial !>(inbox)) - [%configs ~] (give %chat-configs !>((inbox-to-configs:store-lib inbox))) + [%configs ~] (give %chat-configs !>((inbox-to-configs:store inbox))) [%updates ~] ~ [%mailbox @ *] ?> (~(has by inbox) t.path) @@ -93,7 +92,7 @@ ^- (unit (unit cage)) ?+ path (on-peek:def path) [%x %all ~] ``noun+!>(inbox) - [%x %configs ~] ``noun+!>((inbox-to-configs:store-lib inbox)) + [%x %configs ~] ``noun+!>((inbox-to-configs:store inbox)) [%x %keys ~] ``noun+!>(~(key by inbox)) [%x %envelopes *] (peek-x-envelopes:cc t.t.path) [%x %mailbox *] @@ -160,7 +159,7 @@ ++ poke-json |= jon=json ^- (quip card _state) - (poke-chat-action (action:dejs:store-lib jon)) + (poke-chat-action (action:dejs:store jon)) :: ++ poke-chat-action |= =action:store @@ -249,7 +248,7 @@ (team:title our.bol author) == =/ =hoon (ream expression.letter) - letter(output (eval bol hoon)) + letter(output (eval:store bol hoon)) letter :: ++ prepend-envelope diff --git a/pkg/arvo/app/chat-view.hoon b/pkg/arvo/app/chat-view.hoon index a13bd6565..19145afae 100644 --- a/pkg/arvo/app/chat-view.hoon +++ b/pkg/arvo/app/chat-view.hoon @@ -10,12 +10,10 @@ *chat-hook, *metadata-hook, *rw-security, - store=chat-store, - hook=chat-hook, - view=chat-view + hook=chat-hook /+ *server, default-agent, verb, dbug, - store-lib=chat-store, - view-lib=chat-view + store=chat-store, + view=chat-view /= index /^ octs /; as-octs:mimes:html @@ -95,7 +93,7 @@ :: %json :_ this - (poke-chat-view-action:cc (action:dejs:view-lib !<(json vase))) + (poke-chat-view-action:cc (action:dejs:view !<(json vase))) :: %chat-view-action :_ this @@ -114,7 +112,7 @@ :: create inbox with 20 messages max per mailbox and send that along :: then quit the subscription :_ this - [%give %fact ~ %json !>((inbox:enjs:store-lib truncated-inbox-scry))]~ + [%give %fact ~ %json !>((inbox:enjs:store truncated-inbox-scry))]~ ?: =(/configs path) [[%give %fact ~ %json !>(*json)]~ this] (on-watch:def path) @@ -190,7 +188,7 @@ =/ envelopes (envelope-scry [(scot %ud start) (scot %ud end) pax]) %- json-response:gen %- json-to-octs - %- update:enjs:store-lib + %- update:enjs:store [%messages pax start end envelopes] :: [%'~chat' *] (html-response:gen index) @@ -200,7 +198,7 @@ |= jon=json ^- (list card) ?> (team:title our.bol src.bol) - (poke-chat-view-action (action:dejs:view-lib jon)) + (poke-chat-view-action (action:dejs:view jon)) :: ++ poke-chat-view-action |= act=action:view @@ -487,8 +485,8 @@ ++ diff-chat-update |= upd=update:store ^- (list card) - =/ updates-json (update:enjs:store-lib upd) - =/ configs-json (configs:enjs:store-lib configs-scry) + =/ updates-json (update:enjs:store upd) + =/ configs-json (configs:enjs:store configs-scry) :~ [%give %fact ~[/primary] %json !>(updates-json)] [%give %fact ~[/configs] %json !>(configs-json)] == diff --git a/pkg/arvo/lib/chat-hook.hoon b/pkg/arvo/lib/chat-hook.hoon index ce2fb9858..11ed66009 100644 --- a/pkg/arvo/lib/chat-hook.hoon +++ b/pkg/arvo/lib/chat-hook.hoon @@ -1,5 +1,4 @@ /- *chat-hook -^? |% :: ++ enjs diff --git a/pkg/arvo/lib/chat-store.hoon b/pkg/arvo/lib/chat-store.hoon index f136cdeba..8c21d8d45 100644 --- a/pkg/arvo/lib/chat-store.hoon +++ b/pkg/arvo/lib/chat-store.hoon @@ -1,32 +1,31 @@ /- *chat-store -^? |% ++ enjs =, enjs:format |% :: ++ letter - |= =^letter - ^- json - =, enjs:format - ?- -.letter - %text - (frond %text s+text.letter) - :: - %url - (frond %url s+url.letter) - :: - %code - %+ frond %code - %- pairs - :~ [%expression s+expression.letter] - [%output a+(turn output.letter tank)] - == - :: - %me - (frond %me s+narrative.letter) - :: - == + |= =^letter + ^- json + =, enjs:format + ?- -.letter + %text + (frond %text s+text.letter) + :: + %url + (frond %url s+url.letter) + :: + %code + %+ frond %code + %- pairs + :~ [%expression s+expression.letter] + [%output a+(turn output.letter tank)] + == + :: + %me + (frond %me s+narrative.letter) + :: + == :: ++ envelope |= =^envelope @@ -200,6 +199,7 @@ :: -- -- +:: ++ inbox-to-configs |= =inbox ^- configs @@ -207,4 +207,26 @@ |= =mailbox ^- config config.mailbox +:: +++ eval + |= [=bowl:gall =hoon] + ^- (list tank) + =/ fowl=[our=@p now=@da eny=@uvJ] + :+ our.bowl + now.bowl + (shaz (cat 3 (mix [now eny]:bowl) %eny)) + :: + =/ subject [fowl ..zuse] + =/ minted=(each [=type =nock] (list tank)) + %- mule |. + (~(mint ut -:!>(subject)) %noun hoon) + ?: ?=(%| -.minted) p.minted + =/ =toon + (mock [subject nock.p.minted] |=(^ ~)) + ?- -.toon + %0 [(sell type.p.minted p.toon) ~] + %1 :- leaf+".^ unsupported in chat eval" + (turn ;;((list path) p.toon) smyt) + %2 [leaf+"crash!" p.toon] + == -- diff --git a/pkg/arvo/lib/chat-view.hoon b/pkg/arvo/lib/chat-view.hoon index bcbdd9e4c..2b4cdc96e 100644 --- a/pkg/arvo/lib/chat-view.hoon +++ b/pkg/arvo/lib/chat-view.hoon @@ -1,5 +1,4 @@ /- *chat-view, *rw-security -^? |% ++ dejs |% diff --git a/pkg/arvo/lib/chat/eval.hoon b/pkg/arvo/lib/chat/eval.hoon deleted file mode 100644 index 456d1d6fa..000000000 --- a/pkg/arvo/lib/chat/eval.hoon +++ /dev/null @@ -1,23 +0,0 @@ -|% -++ eval - |= [=bowl:gall =hoon] - ^- (list tank) - =/ fowl=[our=@p now=@da eny=@uvJ] - :+ our.bowl - now.bowl - (shaz (cat 3 (mix [now eny]:bowl) %eny)) - :: - =/ subject [fowl ..zuse] - =/ minted=(each [=type =nock] (list tank)) - %- mule |. - (~(mint ut -:!>(subject)) %noun hoon) - ?: ?=(%| -.minted) p.minted - =/ =toon - (mock [subject nock.p.minted] |=(^ ~)) - ?- -.toon - %0 [(sell type.p.minted p.toon) ~] - %1 :- leaf+".^ unsupported in chat eval" - (turn ;;((list path) p.toon) smyt) - %2 [leaf+"crash!" p.toon] - == --- diff --git a/pkg/arvo/mar/chat/action.hoon b/pkg/arvo/mar/chat/action.hoon index 96a009bab..1f6f8cc5b 100644 --- a/pkg/arvo/mar/chat/action.hoon +++ b/pkg/arvo/mar/chat/action.hoon @@ -1,6 +1,4 @@ -/- *chat-store /+ *chat-store -=, dejs:format |_ act=action ++ grab |% diff --git a/pkg/arvo/mar/chat/config.hoon b/pkg/arvo/mar/chat/config.hoon index 4bdeff05a..7f28d43cc 100644 --- a/pkg/arvo/mar/chat/config.hoon +++ b/pkg/arvo/mar/chat/config.hoon @@ -1,4 +1,3 @@ -/- *chat-store /+ *chat-store |_ cfg=config :: diff --git a/pkg/arvo/mar/chat/configs.hoon b/pkg/arvo/mar/chat/configs.hoon index 2a3583fcd..2b5717a3d 100644 --- a/pkg/arvo/mar/chat/configs.hoon +++ b/pkg/arvo/mar/chat/configs.hoon @@ -1,4 +1,3 @@ -/- *chat-store /+ *chat-store |_ cfg=configs :: diff --git a/pkg/arvo/mar/chat/hook-action.hoon b/pkg/arvo/mar/chat/hook-action.hoon index 72caa1196..19e80101c 100644 --- a/pkg/arvo/mar/chat/hook-action.hoon +++ b/pkg/arvo/mar/chat/hook-action.hoon @@ -1,4 +1,3 @@ -/- *chat-hook /+ *chat-hook |_ act=action ++ grab diff --git a/pkg/arvo/mar/chat/hook-update.hoon b/pkg/arvo/mar/chat/hook-update.hoon index 61a13dfe0..7a52fa154 100644 --- a/pkg/arvo/mar/chat/hook-update.hoon +++ b/pkg/arvo/mar/chat/hook-update.hoon @@ -1,4 +1,3 @@ -/- *chat-hook /+ *chat-hook |_ upd=update ++ grow diff --git a/pkg/arvo/mar/chat/initial.hoon b/pkg/arvo/mar/chat/initial.hoon index 7e4b0b389..1455aee18 100644 --- a/pkg/arvo/mar/chat/initial.hoon +++ b/pkg/arvo/mar/chat/initial.hoon @@ -1,4 +1,3 @@ -/- *chat-store /+ *chat-store |_ box=inbox :: diff --git a/pkg/arvo/mar/chat/update.hoon b/pkg/arvo/mar/chat/update.hoon index eb4a9eaf0..59a14653e 100644 --- a/pkg/arvo/mar/chat/update.hoon +++ b/pkg/arvo/mar/chat/update.hoon @@ -1,4 +1,3 @@ -/- *chat-store /+ *chat-store |_ upd=update ++ grow diff --git a/pkg/arvo/mar/chat/view-action.hoon b/pkg/arvo/mar/chat/view-action.hoon index 402411333..1306f2562 100644 --- a/pkg/arvo/mar/chat/view-action.hoon +++ b/pkg/arvo/mar/chat/view-action.hoon @@ -1,4 +1,3 @@ -/- *chat-view /+ *chat-view |_ act=action ++ grab From c62140e4d63adf80a00f4244b04cdd84dc6900b5 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Thu, 30 Apr 2020 13:29:06 +1000 Subject: [PATCH 4/6] chat: use ^? on libs correctly --- pkg/arvo/lib/chat-hook.hoon | 5 ++++- pkg/arvo/lib/chat-store.hoon | 5 ++++- pkg/arvo/lib/chat-view.hoon | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/lib/chat-hook.hoon b/pkg/arvo/lib/chat-hook.hoon index 11ed66009..4cf6ffcd9 100644 --- a/pkg/arvo/lib/chat-hook.hoon +++ b/pkg/arvo/lib/chat-hook.hoon @@ -1,4 +1,7 @@ -/- *chat-hook +/- sur=chat-hook +^? +=< [sur .] +=, sur |% :: ++ enjs diff --git a/pkg/arvo/lib/chat-store.hoon b/pkg/arvo/lib/chat-store.hoon index 8c21d8d45..5a77df7d3 100644 --- a/pkg/arvo/lib/chat-store.hoon +++ b/pkg/arvo/lib/chat-store.hoon @@ -1,4 +1,7 @@ -/- *chat-store +/- sur=chat-store +^? +=< [sur .] +=, sur |% ++ enjs =, enjs:format diff --git a/pkg/arvo/lib/chat-view.hoon b/pkg/arvo/lib/chat-view.hoon index 2b4cdc96e..062c2d165 100644 --- a/pkg/arvo/lib/chat-view.hoon +++ b/pkg/arvo/lib/chat-view.hoon @@ -1,4 +1,7 @@ -/- *chat-view, *rw-security +/- sur=chat-view, *rw-security +^? +=< [sur .] +=, sur |% ++ dejs |% From 1faf35928cb0b2d61eb1ba4b1b57f6081824e32a Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Fri, 1 May 2020 14:11:49 +1000 Subject: [PATCH 5/6] chat: fix indenting --- pkg/arvo/lib/chat-store.hoon | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/arvo/lib/chat-store.hoon b/pkg/arvo/lib/chat-store.hoon index 5a77df7d3..bea3c0aea 100644 --- a/pkg/arvo/lib/chat-store.hoon +++ b/pkg/arvo/lib/chat-store.hoon @@ -13,20 +13,20 @@ =, enjs:format ?- -.letter %text - (frond %text s+text.letter) + (frond %text s+text.letter) :: %url - (frond %url s+url.letter) + (frond %url s+url.letter) :: %code - %+ frond %code - %- pairs - :~ [%expression s+expression.letter] - [%output a+(turn output.letter tank)] - == + %+ frond %code + %- pairs + :~ [%expression s+expression.letter] + [%output a+(turn output.letter tank)] + == :: %me - (frond %me s+narrative.letter) + (frond %me s+narrative.letter) :: == :: From d7d07b014b7e7947bb92f51ab2a5d1c4bb9470f4 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Thu, 7 May 2020 10:56:24 +1000 Subject: [PATCH 6/6] chat-store: remove redundant tiscom --- pkg/arvo/lib/chat-store.hoon | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkg/arvo/lib/chat-store.hoon b/pkg/arvo/lib/chat-store.hoon index bea3c0aea..b980577bb 100644 --- a/pkg/arvo/lib/chat-store.hoon +++ b/pkg/arvo/lib/chat-store.hoon @@ -10,7 +10,6 @@ ++ letter |= =^letter ^- json - =, enjs:format ?- -.letter %text (frond %text s+text.letter) @@ -44,7 +43,6 @@ ++ config |= =^config ^- json - =, enjs:format %- pairs :~ [%length (numb length.config)] [%read (numb read.config)]