mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-28 19:55:53 +03:00
chat: expose types with libs
This commit is contained in:
parent
531efa82a9
commit
d7a5499b9a
@ -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
|
||||
|
@ -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)]~
|
||||
|
@ -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
|
||||
|
@ -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)]
|
||||
==
|
||||
|
@ -1,5 +1,4 @@
|
||||
/- *chat-hook
|
||||
^?
|
||||
|%
|
||||
::
|
||||
++ enjs
|
||||
|
@ -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]
|
||||
==
|
||||
--
|
||||
|
@ -1,5 +1,4 @@
|
||||
/- *chat-view, *rw-security
|
||||
^?
|
||||
|%
|
||||
++ dejs
|
||||
|%
|
||||
|
@ -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]
|
||||
==
|
||||
--
|
@ -1,6 +1,4 @@
|
||||
/- *chat-store
|
||||
/+ *chat-store
|
||||
=, dejs:format
|
||||
|_ act=action
|
||||
++ grab
|
||||
|%
|
||||
|
@ -1,4 +1,3 @@
|
||||
/- *chat-store
|
||||
/+ *chat-store
|
||||
|_ cfg=config
|
||||
::
|
||||
|
@ -1,4 +1,3 @@
|
||||
/- *chat-store
|
||||
/+ *chat-store
|
||||
|_ cfg=configs
|
||||
::
|
||||
|
@ -1,4 +1,3 @@
|
||||
/- *chat-hook
|
||||
/+ *chat-hook
|
||||
|_ act=action
|
||||
++ grab
|
||||
|
@ -1,4 +1,3 @@
|
||||
/- *chat-hook
|
||||
/+ *chat-hook
|
||||
|_ upd=update
|
||||
++ grow
|
||||
|
@ -1,4 +1,3 @@
|
||||
/- *chat-store
|
||||
/+ *chat-store
|
||||
|_ box=inbox
|
||||
::
|
||||
|
@ -1,4 +1,3 @@
|
||||
/- *chat-store
|
||||
/+ *chat-store
|
||||
|_ upd=update
|
||||
++ grow
|
||||
|
@ -1,4 +1,3 @@
|
||||
/- *chat-view
|
||||
/+ *chat-view
|
||||
|_ act=action
|
||||
++ grab
|
||||
|
Loading…
Reference in New Issue
Block a user