chat: expose types with libs

This commit is contained in:
Liam Fitzgerald 2020-04-30 09:04:29 +10:00
parent 531efa82a9
commit d7a5499b9a
16 changed files with 64 additions and 80 deletions

View File

@ -9,10 +9,10 @@
:: we concat the ship onto the head of the path, :: we concat the ship onto the head of the path,
:: and trust it to take care of the rest. :: 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, *permission-store, *group-store, *invite-store,
*rw-security, sole-sur=sole *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 auto=language-server-complete
:: ::
|% |%
@ -978,7 +978,7 @@
:: ::
++ eval ++ eval
|= [txt=cord exe=hoon] |= [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: print glyph info for all, glyph or target
:: ::
++ lookup-glyph ++ lookup-glyph

View File

@ -5,9 +5,8 @@
/- *permission-store, *invite-store, *metadata-store, /- *permission-store, *invite-store, *metadata-store,
*permission-hook, *group-store, *permission-group-hook, ::TMP for upgrade *permission-hook, *group-store, *permission-group-hook, ::TMP for upgrade
hook=chat-hook, hook=chat-hook,
store=chat-store,
view=chat-view view=chat-view
/+ *chat-eval, default-agent, verb, dbug, store-lib=chat-store /+ default-agent, verb, dbug, store=chat-store
~% %chat-hook-top ..is ~ ~% %chat-hook-top ..is ~
|% |%
+$ card card:agent:gall +$ card card:agent:gall
@ -301,7 +300,7 @@
++ poke-json ++ poke-json
|= jon=json |= jon=json
^- (quip card _state) ^- (quip card _state)
(poke-chat-action (action:dejs:store-lib jon)) (poke-chat-action (action:dejs:store jon))
:: ::
++ poke-chat-action ++ poke-chat-action
|= act=action:store |= act=action:store
@ -315,7 +314,7 @@
=* letter letter.envelope.act =* letter letter.envelope.act
=? letter &(?=(%code -.letter) ?=(~ output.letter)) =? letter &(?=(%code -.letter) ?=(~ output.letter))
=/ =hoon (ream expression.letter) =/ =hoon (ream expression.letter)
letter(output (eval bol hoon)) letter(output (eval:store bol hoon))
=/ ship (~(got by synced) path.act) =/ ship (~(got by synced) path.act)
=/ appl ?:(=(ship our.bol) %chat-store %chat-hook) =/ appl ?:(=(ship our.bol) %chat-store %chat-hook)
[%pass / %agent [ship appl] %poke %chat-action !>(act)]~ [%pass / %agent [ship appl] %poke %chat-action !>(act)]~

View File

@ -1,7 +1,6 @@
:: chat-store: data store that holds linear sequences of chat messages :: chat-store: data store that holds linear sequences of chat messages
:: ::
/- store=chat-store /+ store=chat-store, default-agent, verb, dbug
/+ store-lib=chat-store, *chat-eval, default-agent, verb, dbug
~% %chat-store-top ..is ~ ~% %chat-store-top ..is ~
|% |%
+$ card card:agent:gall +$ card card:agent:gall
@ -72,7 +71,7 @@
?+ path (on-watch:def path) ?+ path (on-watch:def path)
[%keys ~] (give %chat-update !>([%keys ~(key by inbox)])) [%keys ~] (give %chat-update !>([%keys ~(key by inbox)]))
[%all ~] (give %chat-initial !>(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 ~] ~ [%updates ~] ~
[%mailbox @ *] [%mailbox @ *]
?> (~(has by inbox) t.path) ?> (~(has by inbox) t.path)
@ -93,7 +92,7 @@
^- (unit (unit cage)) ^- (unit (unit cage))
?+ path (on-peek:def path) ?+ path (on-peek:def path)
[%x %all ~] ``noun+!>(inbox) [%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 %keys ~] ``noun+!>(~(key by inbox))
[%x %envelopes *] (peek-x-envelopes:cc t.t.path) [%x %envelopes *] (peek-x-envelopes:cc t.t.path)
[%x %mailbox *] [%x %mailbox *]
@ -160,7 +159,7 @@
++ poke-json ++ poke-json
|= jon=json |= jon=json
^- (quip card _state) ^- (quip card _state)
(poke-chat-action (action:dejs:store-lib jon)) (poke-chat-action (action:dejs:store jon))
:: ::
++ poke-chat-action ++ poke-chat-action
|= =action:store |= =action:store
@ -249,7 +248,7 @@
(team:title our.bol author) (team:title our.bol author)
== ==
=/ =hoon (ream expression.letter) =/ =hoon (ream expression.letter)
letter(output (eval bol hoon)) letter(output (eval:store bol hoon))
letter letter
:: ::
++ prepend-envelope ++ prepend-envelope

View File

@ -10,12 +10,10 @@
*chat-hook, *chat-hook,
*metadata-hook, *metadata-hook,
*rw-security, *rw-security,
store=chat-store, hook=chat-hook
hook=chat-hook,
view=chat-view
/+ *server, default-agent, verb, dbug, /+ *server, default-agent, verb, dbug,
store-lib=chat-store, store=chat-store,
view-lib=chat-view view=chat-view
/= index /= index
/^ octs /^ octs
/; as-octs:mimes:html /; as-octs:mimes:html
@ -95,7 +93,7 @@
:: ::
%json %json
:_ this :_ 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 %chat-view-action
:_ this :_ this
@ -114,7 +112,7 @@
:: create inbox with 20 messages max per mailbox and send that along :: create inbox with 20 messages max per mailbox and send that along
:: then quit the subscription :: then quit the subscription
:_ this :_ this
[%give %fact ~ %json !>((inbox:enjs:store-lib truncated-inbox-scry))]~ [%give %fact ~ %json !>((inbox:enjs:store truncated-inbox-scry))]~
?: =(/configs path) ?: =(/configs path)
[[%give %fact ~ %json !>(*json)]~ this] [[%give %fact ~ %json !>(*json)]~ this]
(on-watch:def path) (on-watch:def path)
@ -190,7 +188,7 @@
=/ envelopes (envelope-scry [(scot %ud start) (scot %ud end) pax]) =/ envelopes (envelope-scry [(scot %ud start) (scot %ud end) pax])
%- json-response:gen %- json-response:gen
%- json-to-octs %- json-to-octs
%- update:enjs:store-lib %- update:enjs:store
[%messages pax start end envelopes] [%messages pax start end envelopes]
:: ::
[%'~chat' *] (html-response:gen index) [%'~chat' *] (html-response:gen index)
@ -200,7 +198,7 @@
|= jon=json |= jon=json
^- (list card) ^- (list card)
?> (team:title our.bol src.bol) ?> (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 ++ poke-chat-view-action
|= act=action:view |= act=action:view
@ -487,8 +485,8 @@
++ diff-chat-update ++ diff-chat-update
|= upd=update:store |= upd=update:store
^- (list card) ^- (list card)
=/ updates-json (update:enjs:store-lib upd) =/ updates-json (update:enjs:store upd)
=/ configs-json (configs:enjs:store-lib configs-scry) =/ configs-json (configs:enjs:store configs-scry)
:~ [%give %fact ~[/primary] %json !>(updates-json)] :~ [%give %fact ~[/primary] %json !>(updates-json)]
[%give %fact ~[/configs] %json !>(configs-json)] [%give %fact ~[/configs] %json !>(configs-json)]
== ==

View File

@ -1,5 +1,4 @@
/- *chat-hook /- *chat-hook
^?
|% |%
:: ::
++ enjs ++ enjs

View File

@ -1,32 +1,31 @@
/- *chat-store /- *chat-store
^?
|% |%
++ enjs ++ enjs
=, enjs:format =, enjs:format
|% |%
:: ::
++ letter ++ letter
|= =^letter |= =^letter
^- json ^- json
=, enjs:format =, enjs:format
?- -.letter ?- -.letter
%text %text
(frond %text s+text.letter) (frond %text s+text.letter)
:: ::
%url %url
(frond %url s+url.letter) (frond %url s+url.letter)
:: ::
%code %code
%+ frond %code %+ frond %code
%- pairs %- pairs
:~ [%expression s+expression.letter] :~ [%expression s+expression.letter]
[%output a+(turn output.letter tank)] [%output a+(turn output.letter tank)]
== ==
:: ::
%me %me
(frond %me s+narrative.letter) (frond %me s+narrative.letter)
:: ::
== ==
:: ::
++ envelope ++ envelope
|= =^envelope |= =^envelope
@ -200,6 +199,7 @@
:: ::
-- --
-- --
::
++ inbox-to-configs ++ inbox-to-configs
|= =inbox |= =inbox
^- configs ^- configs
@ -207,4 +207,26 @@
|= =mailbox |= =mailbox
^- config ^- config
config.mailbox 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]
==
-- --

View File

@ -1,5 +1,4 @@
/- *chat-view, *rw-security /- *chat-view, *rw-security
^?
|% |%
++ dejs ++ dejs
|% |%

View File

@ -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]
==
--

View File

@ -1,6 +1,4 @@
/- *chat-store
/+ *chat-store /+ *chat-store
=, dejs:format
|_ act=action |_ act=action
++ grab ++ grab
|% |%

View File

@ -1,4 +1,3 @@
/- *chat-store
/+ *chat-store /+ *chat-store
|_ cfg=config |_ cfg=config
:: ::

View File

@ -1,4 +1,3 @@
/- *chat-store
/+ *chat-store /+ *chat-store
|_ cfg=configs |_ cfg=configs
:: ::

View File

@ -1,4 +1,3 @@
/- *chat-hook
/+ *chat-hook /+ *chat-hook
|_ act=action |_ act=action
++ grab ++ grab

View File

@ -1,4 +1,3 @@
/- *chat-hook
/+ *chat-hook /+ *chat-hook
|_ upd=update |_ upd=update
++ grow ++ grow

View File

@ -1,4 +1,3 @@
/- *chat-store
/+ *chat-store /+ *chat-store
|_ box=inbox |_ box=inbox
:: ::

View File

@ -1,4 +1,3 @@
/- *chat-store
/+ *chat-store /+ *chat-store
|_ upd=update |_ upd=update
++ grow ++ grow

View File

@ -1,4 +1,3 @@
/- *chat-view
/+ *chat-view /+ *chat-view
|_ act=action |_ act=action
++ grab ++ grab