mirror of
https://github.com/urbit/shrub.git
synced 2024-12-01 22:55:03 +03:00
Implemented %action and %reaction types for better reader-broker comms.
Opens up new possibilities for refactoring.
This commit is contained in:
parent
0e850fc8bd
commit
2a3dffc8c4
@ -47,6 +47,7 @@
|
||||
== ::
|
||||
++ pear :: poke fruit
|
||||
$% {$talk-command command} ::
|
||||
{$talk-action action} ::
|
||||
{$talk-update update} ::
|
||||
== ::
|
||||
++ card :: general card
|
||||
@ -132,6 +133,13 @@
|
||||
::x produce moves or sole-effects and moves.
|
||||
[[id.cli %diff %sole-effect u.foc] moz]
|
||||
::
|
||||
++ ra-reaction
|
||||
::x process a talk reaction.
|
||||
::
|
||||
|= rac/reaction
|
||||
^+ +>
|
||||
sh-abet:(~(sh-reaction sh ~ ~ cli (main our.hid)) rac)
|
||||
::
|
||||
++ ra-low
|
||||
::x process a talk lowdown
|
||||
::
|
||||
@ -160,7 +168,7 @@
|
||||
%+ turn (~(tap by nek))
|
||||
|= {a/char b/(set (set partner))}
|
||||
(turn (~(tap by b)) |=(c/(set partner) [c a]))
|
||||
sh-abet:~(sh-prod sh ~ cli (main our.hid))
|
||||
sh-abet:~(sh-prod sh ~ ~ cli (main our.hid))
|
||||
::
|
||||
++ ra-low-names
|
||||
::x apply new local identities.
|
||||
@ -187,13 +195,13 @@
|
||||
^+ +>
|
||||
?~ cof +>(tales (~(del by tales) man))
|
||||
=+ tal=(fall (~(get by tales) man) *tale)
|
||||
=. +>.$ sh-abet:(~(sh-low-config sh ~ cli man) shape.tal (fall cof *config))
|
||||
=. +>.$ sh-abet:(~(sh-low-config sh ~ ~ cli man) shape.tal (fall cof *config))
|
||||
+>.$(tales (~(put by tales) man tal(shape u.cof)))
|
||||
::
|
||||
++ ra-low-remco
|
||||
|= cofs/(map station config)
|
||||
^+ +>
|
||||
=. +> sh-abet:(~(sh-low-remco sh ~ cli (main our.hid)) mirrors cofs)
|
||||
=. +> sh-abet:(~(sh-low-remco sh ~ ~ cli (main our.hid)) mirrors cofs)
|
||||
+>(mirrors (~(uni by mirrors) cofs))
|
||||
::
|
||||
++ ra-low-precs
|
||||
@ -206,7 +214,7 @@
|
||||
=+ nel=(~(uni by locals.u.tal) pes)
|
||||
=. +>.$
|
||||
?: =(locals.u.tal nel) +>.$
|
||||
sh-abet:(~(sh-low-precs sh ~ cli man) locals.u.tal nel)
|
||||
sh-abet:(~(sh-low-precs sh ~ ~ cli man) locals.u.tal nel)
|
||||
+>.$(tales (~(put by tales) man u.tal(locals nel)))
|
||||
::
|
||||
++ ra-low-rempe
|
||||
@ -215,7 +223,7 @@
|
||||
=+ ner=(~(uni by remotes) pas) ::TODO better uni.
|
||||
?: =(remotes ner) +>.$
|
||||
=. remotes ner
|
||||
sh-abet:(~(sh-low-rempe sh ~ cli (main our.hid)) remotes ner)
|
||||
sh-abet:(~(sh-low-rempe sh ~ ~ cli (main our.hid)) remotes ner)
|
||||
::
|
||||
++ ra-low-grams
|
||||
::x apply new grams
|
||||
@ -224,7 +232,7 @@
|
||||
^+ +>
|
||||
=+ tal=(~(get by tales) man)
|
||||
?~ tal ~&([%know-no-tale man] +>.$)
|
||||
=. +>.$ sh-abet:(~(sh-low-grams sh ~ cli man) num gams)
|
||||
=. +>.$ sh-abet:(~(sh-low-grams sh ~ ~ cli man) num gams)
|
||||
pa-abet:(~(pa-lesson pa man u.tal) gams)
|
||||
::
|
||||
++ ra-emil :: ra-emit move list
|
||||
@ -247,7 +255,7 @@
|
||||
?. =(id.cli ost.hid)
|
||||
~& %strange-sole
|
||||
!!
|
||||
sh-abet:(~(sh-sole sh ~ cli (main our.hid)) act)
|
||||
sh-abet:(~(sh-sole sh ~ ~ cli (main our.hid)) act)
|
||||
::
|
||||
++ ra-console
|
||||
::x make a shell for her.
|
||||
@ -263,7 +271,7 @@
|
||||
==
|
||||
=/ she/shell
|
||||
%*(. *shell id ost.hid, active (sy [%& our.hid man] ~))
|
||||
sh-abet:~(sh-prod sh ~ she man)
|
||||
sh-abet:~(sh-prod sh ~ ~ she man)
|
||||
::
|
||||
++ ra-init
|
||||
::x populate state on first boot. subscribes to our broker.
|
||||
@ -365,6 +373,7 @@
|
||||
::x she: console session state used in this core.
|
||||
::
|
||||
coz/(list command)
|
||||
acs/(list action)
|
||||
she/shell
|
||||
man/knot
|
||||
==
|
||||
@ -528,7 +537,17 @@
|
||||
::x [coz new]). produces an updated context for the ++sh core.
|
||||
::
|
||||
^+ +> ::x points to ++sh's |_ core's context.
|
||||
%. ^- (list move)
|
||||
%. %+ weld
|
||||
%- flop
|
||||
%+ turn acs
|
||||
|= a/action
|
||||
^- move
|
||||
:* ost.hid
|
||||
%poke
|
||||
/reader/action
|
||||
(broker our.hid)
|
||||
[%talk-action a]
|
||||
==
|
||||
%- flop
|
||||
%+ turn coz
|
||||
|= c/command
|
||||
@ -654,6 +673,12 @@
|
||||
?: (~(has in lax) pan) `pan
|
||||
$(grams t.grams)
|
||||
::
|
||||
++ sh-reaction
|
||||
::x renders a reaction.
|
||||
::
|
||||
|= rac/reaction
|
||||
(sh-lame (trip what.rac))
|
||||
::
|
||||
++ sh-low-atlas-diff
|
||||
::x calculates the difference between two atlasses (presence lists).
|
||||
::
|
||||
@ -1072,6 +1097,12 @@
|
||||
|= cod/command
|
||||
%_(+> coz [cod coz])
|
||||
::
|
||||
++ sh-act
|
||||
::x adds an action to the core state.
|
||||
::
|
||||
|= act/action
|
||||
%_(+> acs [act acs])
|
||||
::
|
||||
++ sh-twig-head ^- vase :: eval data
|
||||
::x makes a vase of environment data to evaluate against (#-messages).
|
||||
::
|
||||
@ -1806,6 +1837,15 @@
|
||||
|= {way/wire low/lowdown}
|
||||
ra-abet:(ra-low:ra low)
|
||||
::
|
||||
++ diff-talk-reaction :: accept reaction
|
||||
::x incoming talk reaction. process it.
|
||||
::
|
||||
|= {way/wire rac/reaction}
|
||||
?. =(src.hid -:(broker our.hid))
|
||||
~& [%diff-reaction-stranger src.hid]
|
||||
[~ +>]
|
||||
ra-abet:(ra-reaction:ra rac)
|
||||
::
|
||||
++ poke-sole-action :: accept console
|
||||
::x incoming sole action. process it.
|
||||
::
|
||||
|
@ -59,6 +59,7 @@
|
||||
++ lime :: diff fruit
|
||||
$% {$talk-report report} ::
|
||||
{$talk-lowdown lowdown} ::
|
||||
{$talk-reaction reaction} ::
|
||||
{$sole-effect sole-effect} ::
|
||||
== ::
|
||||
++ pear :: poke fruit
|
||||
@ -193,6 +194,31 @@
|
||||
|= {b/bone l/(list move)}
|
||||
[[b %diff %talk-lowdown low] l]
|
||||
::
|
||||
++ ra-react
|
||||
::x send a talk-reaction to a reader.
|
||||
::
|
||||
|= {red/bone rac/reaction}
|
||||
%- ra-emit
|
||||
[red %diff %talk-reaction rac]
|
||||
::
|
||||
++ ra-action
|
||||
::x peforms action sent by a reader.
|
||||
::
|
||||
|= {red/bone act/action}
|
||||
^+ +>
|
||||
?- -.act
|
||||
$create
|
||||
~&(%talk-action-create !!)
|
||||
$permit
|
||||
=+ soy=(~(get by stories) p.act)
|
||||
?~ soy
|
||||
%+ ra-react red
|
||||
[%fail (crip (weld "no story " (trip p.act))) `act]
|
||||
pa-abet:(~(pa-permit pa p.act ~ u.soy) q.act r.act)
|
||||
$say
|
||||
~&(%talk-action-say !!)
|
||||
==
|
||||
::
|
||||
++ ra-update
|
||||
::x applies update sent by her.
|
||||
::
|
||||
@ -210,7 +236,7 @@
|
||||
::x uses our because status is per identity, not per client.
|
||||
::TODO check if this can crash or not.
|
||||
=< pa-abet
|
||||
(~(pa-notify pa n.p.dup (~(got by stories) n.p.dup)) our.hid q.dup)
|
||||
(~(pa-notify pa n.p.dup ~ (~(got by stories) n.p.dup)) our.hid q.dup)
|
||||
::
|
||||
$human ::x change an identity.
|
||||
?. =((~(get by folks) her) `q.dup)
|
||||
@ -235,7 +261,7 @@
|
||||
|= {man/knot con/config}
|
||||
^+ +>
|
||||
=+ pur=(fall (~(get by stories) man) *story)
|
||||
pa-abet:(~(pa-reform pa man pur) con)
|
||||
pa-abet:(~(pa-reform pa man ~ pur) con)
|
||||
::
|
||||
++ ra-unconfig
|
||||
|= man/knot
|
||||
@ -243,7 +269,7 @@
|
||||
=+ soy=(~(get by stories) man)
|
||||
?~ soy +>.$
|
||||
=. stories (~(del by stories) man)
|
||||
pa-abet:~(pa-reform-gone pa man u.soy)
|
||||
pa-abet:~(pa-reform-gone pa man ~ u.soy)
|
||||
::
|
||||
++ ra-base-hart
|
||||
::x produces our ship's host desk's web address as a hart.
|
||||
@ -356,7 +382,7 @@
|
||||
~& [%ra-know-not man] :: XX should crash
|
||||
+>+>.$
|
||||
::x call the sample gate with a ++pa core.
|
||||
(fun ~(. pa man u.pur))
|
||||
(fun ~(. pa man ~ u.pur))
|
||||
::
|
||||
++ ra-diff-talk-report :: subscription update
|
||||
::x process a talk report from cuz into story man.
|
||||
@ -444,7 +470,7 @@
|
||||
?~ pur
|
||||
~& [%bad-subscribe-story-c i.pax]
|
||||
(ra-evil %talk-no-story)
|
||||
=+ soy=~(. pa i.pax u.pur)
|
||||
=+ soy=~(. pa i.pax `(list command)`~ u.pur) ::TODO nest-fail if no cast
|
||||
::x she needs read permissions to subscribe.
|
||||
?. (pa-visible:soy her)
|
||||
(ra-evil %talk-no-story)
|
||||
@ -979,6 +1005,15 @@
|
||||
=^ mow +>.$ log-all-to-file
|
||||
[(welp mos mow) +>.$]
|
||||
::
|
||||
++ poke-talk-action :: accept action
|
||||
::x incoming talk action. process it.
|
||||
::
|
||||
|= act/action
|
||||
?. (team src.hid our.hid)
|
||||
~& [%talk-action-stranger src.hid]
|
||||
[~ +>]
|
||||
ra-abet:(ra-action:ra ost.hid act)
|
||||
::
|
||||
++ poke-talk-update :: accept update
|
||||
::x incoming talk update. process it.
|
||||
::
|
||||
|
@ -10,6 +10,17 @@
|
||||
{$publish (list thought)} :: originate
|
||||
{$review (list thought)} :: deliver
|
||||
== ::
|
||||
++ action :: user action
|
||||
$% {$create (pair knot (pair cord posture))} :: configure + destroy
|
||||
{$permit (trel knot ? (set ship))} :: invite/banish
|
||||
{$say (list (pair audience statement))} :: originate
|
||||
::TODO probably include ++update in this. ::
|
||||
== ::
|
||||
++ reaction :: user information
|
||||
$: kind/?($info $fail) :: result
|
||||
what/@t :: explain
|
||||
why/(unit action) :: cause
|
||||
== ::
|
||||
++ update :: change shared state
|
||||
$% {$status (pair (set knot) status)} :: our status update
|
||||
{$human (pair ship human)} :: new identity
|
||||
|
Loading…
Reference in New Issue
Block a user