verb: tweak $event-plus type

Include the mug for poke data, mark for facts, separate out the on-agent
sign explicitly.
This commit is contained in:
fang 2024-03-28 21:48:48 +01:00
parent 17ed42f24f
commit bf863b5ac7
No known key found for this signature in database
GPG Key ID: EB035760C1BBA972
3 changed files with 59 additions and 21 deletions

View File

@ -28,11 +28,7 @@
?> ?=(^ events)
(sub now.i.events (mod now.i.events write-interval))
=/ vex=@
%- en:json:html
:- %a
%+ roll events ::NOTE we +roll to +turn & +flop simultaneously
|= [event=event-plus:verb out=(list json)]
[(event:enjs event) out]
(en:json:html (events:enjs our dude events))
[%pass /write/[dude] %agent [our %hood] %poke %drum-put !>([pax vex])]~
::
++ ingest-event
@ -54,42 +50,70 @@
++ enjs
=, enjs:format
|%
++ events
|= [our=@p =dude:gall events=(list event-plus:verb)] :: latest-first
=/ first=event-plus:verb (rear events)
%- pairs
:~ 'ship'^s+(scot %p our)
'dude'^s+dude
'from'^(time now.first)
::
:- 'events'
:- %a
%+ roll events ::NOTE we +roll to +turn & +flop simultaneously
|= [event=event-plus:verb out=(list json)]
[(event:enjs event) out]
==
++ event
|= event-plus:verb
%- pairs
:~ 'act'^(numb act)
'now'^(time now) :: ms timestamp, lossy-ness is fine here
'src'^s+(scot %p src)
'cause'^(^cause cause)
'kind'^s+-.cause
'deets'^(^cause cause)
'effects'^a+(turn effects effect)
==
::
++ cause
|= =cause:verb
%+ frond -.cause
^- json
?- -.cause
%on-init b+&
%on-load b+&
%on-poke s+mark.cause
%on-poke (pairs 'mark'^s+mark.cause 'mug'^(mug mug.cause) ~)
%on-watch (path path.cause)
%on-leave (path path.cause)
%on-agent %- pairs
:~ 'wire'^(path wire.cause)
'sign'^s+sign.cause
'mug'^(mug mug.cause)
==
:~ 'wire'^(path wire.cause)
'sign'^s+-.sign.cause
::
:- 'deets'
?- -.sign.cause
%poke-ack b+ack.sign.cause
%watch-ack b+ack.sign.cause
%kick ~
%fact %- pairs
:~ 'mark'^s+mark.sign.cause
'mug'^(mug mug.sign.cause)
==
==
==
%on-arvo %- pairs
:~ 'wire'^(path wire.cause)
'vane'^s+vane.cause
'sign'^s+sign.cause
==
:~ 'wire'^(path wire.cause)
'vane'^s+vane.cause
'sign'^s+sign.cause
==
%on-fail s+term.cause
==
::
++ effect
|= effect:verb
^- json
%+ frond +<-
%- pairs
:- 'kind'^s++<-
:_ ~
:- 'deets'
%- pairs
^- (list [@t json])
?- +<-

View File

@ -47,7 +47,7 @@
:_ this
:_ :_ cards
(emit-event %on-poke mark)
(emit-event-plus bowl [%on-poke mark] cards)
(emit-event-plus bowl [%on-poke mark (mug q.vase)] cards)
::
++ on-watch
|= =path
@ -88,7 +88,14 @@
:_ this
:_ :_ cards
(emit-event %on-agent wire -.sign)
(emit-event-plus bowl [%on-agent wire -.sign (mug +.sign)] cards)
=; =^sign
(emit-event-plus bowl [%on-agent wire sign] cards)
?- -.sign
%poke-ack [%poke-ack ?=(~ p.sign)]
%watch-ack [%watch-ack ?=(~ p.sign)]
%kick [%kick ~]
%fact [%fact p.cage.sign (mug q.q.cage.sign)]
==
::
++ on-arvo
|= [=wire =sign-arvo]

View File

@ -21,14 +21,21 @@
+$ cause
$% [%on-init ~]
[%on-load ~]
[%on-poke =mark]
[%on-poke =mark mug=@ux]
[%on-watch =path]
[%on-leave =path]
[%on-agent =wire sign=term mug=@ux] ::TODO %fact should show mark?
[%on-agent =wire =sign]
[%on-arvo =wire vane=term sign=term]
[%on-fail =term]
==
::
+$ sign
$% [%poke-ack ack=?]
[%watch-ack ack=?]
[%kick ~]
[%fact =mark mug=@ux]
==
::
+$ effect
$% [%poke =wire =gill:gall =mark mug=@ux]
[%watch =wire =gill:gall =path]