acpx-ai-provider-v0.0.6
Pre-releaseFirst combined release after v0.0.4 — four feature PRs land in one version since v0.0.5 was bumped but never tagged or published.
Features
-
onPermissionRequestcallback onAcpxProviderSettings(#17). Hosts can intercept per-call permission requests (write, shell, delete, …) with their own UI instead of relying on the up-frontpermissionMode. Returningundefinedfalls through to the existing mode resolver — zero behavior change for consumers that don't opt in. Driven by the BrowserOS chat flow that wanted inline approve/deny CTA cards.createAcpxProvider({ agent: 'codex', permissionMode: 'approve-reads', // fallback for unhandled cases onPermissionRequest: async (req) => { const decision = await myUi.prompt({ title: req.raw.toolCall.title, kind: req.inferredKind, // 'edit' | 'shell' | 'delete' | … }) return decision // undefined falls through to the mode resolver }, })
-
AcpxProvider.getModels()helper (#19). Typed access to the agent's advertised model list without reaching into the untypedruntime.getStatus().detailsbag. Returns{ currentModelId, availableModelIds }for agents that advertise models (claude, codex), orundefinedfor those that don't (gemini, custom adapters).const provider = createAcpxProvider({ agent: 'claude-code', cwd }) const models = await provider.getModels() // → { currentModelId: 'claude-opus-4-7', // availableModelIds: ['claude-haiku-4-5', 'claude-sonnet-4-6', 'claude-opus-4-7'] }
-
sessionOptionsforwarded intoruntime.ensureSession(#23). Set per-sessionsystemPrompt/model/allowedTools/maxTurnson a fresh ACP session without bypassing the runtime. System prompts are applied atsession/newtime; changing them later requires a distinctsessionKey(callingprovider.close()keeps the persistent record by default and won't help here).createAcpxProvider({ agent: 'claude-code', sessionOptions: { systemPrompt: 'You are an expert Rust reviewer. Be terse.', // or { append: 'When you finish, also propose tests.' } }, })
-
fullStreamnow emits anerrorpart on failed turns (#32, #34). When an ACP turn ends with a failed result (model rejected, agent internal error, network blip, auth expired), the stream now emits{ type: 'error', error: AcpxError }immediately before the terminalfinishpart. Previously the only signal wasfinishReason: "error"onfinishplus diagnostic data stashed onproviderMetadata.acpx— invisible to astreamTextconsumer iteratingfullStream, which saw a completely silent empty assistant turn. The new error part carries the agent's actualcode/messageand the underlyingAcpRuntimeTurnResultErrorascause.
Behavior change — doGenerate / generateText throw on failed turns
The new error stream part is treated as throwable by doGenerate's accumulator (already the contract for ACP-thrown errors). On a failed-turn result, doGenerate and AI SDK's generateText now reject with an AcpxError instead of resolving with { finishReason: "error", providerMetadata: { acpx: { errorCode, errorMessage } } }. Aligns the three failure paths (thrown ACP error, mid-stream error event, failed result) on a single contract.
- Consumers that read
providerMetadata.acpx.{errorCode,errorMessage}onfinishkeep working — that field is preserved verbatim on thefinishpart for the streaming path. streamTextcallers that iteratefullStream(or use theonErrorhook) automatically receive the new diagnostic. No code change required — they just stop seeing silent empty turns.
Compatibility
- Peer dependency
acpxis now>=0.8.0(upstream contract changes that ship the new permission callback, session-options threading, andgetStatus().modelsshape). - Public API: three new settings (
onPermissionRequest,sessionOptions) and one new method (getModels()); no removals or renames. - Re-exports added:
AcpPermissionRequest,AcpPermissionDecision,SessionAgentOptions,SystemPromptOption,AcpRuntimeSessionModels,AcpRuntimeStatus.
Internal
EventTranslator.errorPartIfFailed(result)new helper sitting alongsidefinish().createTranslatingStreamcalls it betweenflush()andfinish().- Real-codex e2e contract test for the permission callback round-trip (gated behind
SMOKE_AGENTS=codex). - Unit + integration coverage across all four PRs uses the existing
MockAcpRuntimeharness; full provider suite is 186 pass / 0 fail.
⚠️ Alpha software
Both this package and its underlying runtime (acpx) are pre-1.0. Public APIs may change in any minor release. Pin exact versions. Bug reports + design feedback welcome on DaniAkash/acpx.
Full Changelog: acpx-ai-provider-v0.0.4...acpx-ai-provider-v0.0.6