feat(provider): add onPermissionRequest callback option#17
Draft
DaniAkash wants to merge 1 commit into
Draft
Conversation
Hosts can now intercept the agent's per-call permission requests with their own UI by passing onPermissionRequest to createAcpxProvider. Returning undefined falls through to the existing mode-based resolver, so existing consumers see no behavior change. Driven by downstream BrowserOS chat work that wants inline approve/deny CTA cards instead of an up-front mode gate. The mode gate is too coarse for that flow — approve-reads silently denies writes (codex's apply_patch aborts with no signal), approve-all skips approval entirely. The provider's job is plumbing only: pass the option through to createAcpRuntime, the runtime owns the wire-level resolution and decision-to-optionId mapping. - src/types.ts: re-export AcpPermissionRequest + AcpPermissionDecision from acpx/runtime; add onPermissionRequest to AcpxProviderSettings with the documented signature - src/provider.ts: thread the option through buildRuntimeOptions() - src/index.ts: re-export the two new types - README.md: replace the mode-only limitation bullet with a fall-through explanation; add a new Per-call permissions section with the full callback contract - test/unit/provider.test.ts: three tests covering callback forwarding, the omitted case, and the documented pre-built-runtime no-op - package.json: bump to 0.1.0; bump acpx peer-dep + dev-dep to >=0.8.0 to require the runtime release that exposes the callback Blocked on upstream openclaw/acpx#299 + a corresponding acpx release. Typecheck fails until then because the new types don't exist in acpx@0.7.0; runtime / lint / fallow / build / tests all green.
This was referenced May 7, 2026
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.
This PR is pre-implementation against the documented upstream shape. It will not pass typecheck until openclaw/acpx#299 merges and a corresponding `acpx` release ships (expected as `0.8.0` based on the documented type signatures).
Do not mark ready / merge until:
Summary
Hosts can now intercept the agent's per-call permission requests with their own UI by passing `onPermissionRequest` to `createAcpxProvider`. Returning `undefined` falls through to the existing mode-based resolver, so existing consumers see no behavior change.
Driven by downstream BrowserOS chat work that wants inline approve/deny CTA cards instead of an up-front mode gate. The mode gate is too coarse for that flow — `approve-reads` silently denies writes (codex's `apply_patch` aborts with no signal), `approve-all` skips approval entirely. A per-call callback is the right primitive.
Files changed
Test plan
Known issue: dev-dep won't resolve from a clean install
The dev-dep range `acpx >=0.8.0` doesn't have a matching version published yet. `bun install` from a fresh checkout of this branch will fail. This is expected for the draft phase. Branch exists for review, not for fresh installs.
When upstream lands, the resolver will pick up `acpx@0.8.0` automatically and everything goes green.