Repository navigation
feat: agent page actions (0.2.0) - #4
Merged
Merged
Conversation
- widget: registerActions/unregisterAction, actions/confirm/getPageContext options and React/Vue props - agent calls actions with fenced dewee-action blocks; the widget validates args (JSON Schema subset), gates mutate/destructive calls behind an accessible confirm dialog or a host hook, shows status chips, and sends dewee-action-result follow-ups, bounded by maxActionRounds - backends (Node and PHP) validate the manifest, prepend a delimited page block to the gateway message, and only resend the manifest when its hash changes; history hides the block - dewee:action event, docs, README section with security notes, React example - bump to 0.2.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Host pages can register typed page actions that the Dewee agent calls from chat. The gateway is unchanged: actions travel as text.
chat.registerActions(actions),chat.unregisterAction(name), optionsactions,confirm,getPageContext,maxActionRounds(5),actionTimeoutMs(30s); React/Vueactionsprop andonAction/@action.```dewee-action {"id","name","args"}blocks. The widget hides them, validates args against the action's JSON Schema subset, asks for approval onmutate/destructive(built-in accessible dialog or hostconfirmhook; only a resolvedtrueapproves), runs the handler, shows status chips and sends a hidden```dewee-action-resultfollow-up. Automatic turns are bounded per visitor message.actions(≤32, 16 KB) andpageContext(≤4 KB), prepend a[[dewee-page v1]]block to the gateway message, returnactionsHashinstart, and skip the full manifest once the widget acknowledges the hash. History hides the block. New errors:400 invalid_actions,413 actions_too_large,413 context_too_large.dewee:actionevent (start/result) for telemetry.docs/http-contract.md#page-actions), README "Agent page actions" with security notes, React example (navigate + confirmed mutate).VERSION).Tests
test/page-actions.test.ts: directive parsing (malformed, oversized, unclosed, duplicate, too many), result formatting/truncation, schema validation, the confirmation gate (handler never runs withouttrue), cancel/timeout, registry limits, manifest hashing and page block.test/server.test.ts: message assembly, hash ack, error codes, backward compatibility, history stripping.test/widget-page-actions.test.ts(happy-dom): auto-turn bound, host denial, page context, old wire format without actions.test/php-parity.test.ts: PHP and TS build identical blocks, hashes and errors (runs in CI's php job).