dbug: attempt to scry for state

If the underlying app implements a /x/dbug/state endpoint in +on-peek,
dbug will now use that for %state evaluation. Falls back to the vase
provided by +on-save if the peek fails.

This allows apps and (perhaps more usefully) wrapper agents to provide
customized vases to /lib/dbug.

Updates /lib/shoe to make use of this, properly prepending the wrapped
app's vase to shoe's own, instead of including it as-is.
This commit is contained in:
Fang 2020-09-07 15:55:45 +02:00
parent 31e8ad7bd1
commit c109111ff9
No known key found for this signature in database
GPG Key ID: EB035760C1BBA972
2 changed files with 15 additions and 3 deletions

View File

@ -41,9 +41,17 @@
::
%state
=? grab.dbug =('' grab.dbug) '-'
=- [(sell -)]~
=; product=^vase
[(sell product)]~
=/ state=^vase
:: if the underlying app has implemented a /dbug/state scry endpoint,
:: use that vase in place of +on-save's.
::
=/ result=(each ^vase tang)
(mule |.(q:(need (need (on-peek:ag /x/dbug/state)))))
?:(?=(%& -.result) p.result on-save:ag)
%+ slap
(slop on-save:ag !>([bowl=bowl ..zuse]))
(slop state !>([bowl=bowl ..zuse]))
(ream grab.dbug)
::
%incoming

View File

@ -325,7 +325,11 @@
=^ cards shoe (on-leave:og path)
[(deal cards) this]
::
++ on-peek on-peek:og
++ on-peek
|= =path
^- (unit (unit cage))
?. =(/x/dbug/state path) ~
``noun+(slop on-save:og !>(shoe=state))
::
++ on-agent
|= [=wire =sign:agent:gall]