feat(provider): forward sessionOptions (systemPrompt, model, allowedTools, maxTurns) to runtime#23
Merged
Merged
Conversation
Surfaces sessionOptions on AcpxProviderSettings and threads it through ensureHandle into AcpRuntime.ensureSession. Lets AI SDK consumers set a per-session systemPrompt (or model/allowedTools/maxTurns) on a fresh ACP session without bypassing the runtime. System prompts are applied at session/new time and persisted onto the underlying record. Reusing an existing persistent session ignores sessionOptions by design; callers who want a different prompt should use a distinct sessionKey or close the prior session first. Re-exports SessionAgentOptions and SystemPromptOption from acpx/runtime. Drive-by: export RuntimeMcpServer type from mcp-servers.ts so the exported toRuntimeMcpServers signature no longer references a same-file private type (fixes a fallow regression introduced in #22). Bumps acpx peer-dep floor to >=0.8.0 and bumps the package to 0.1.0. Requires the matching runtime change from openclaw/acpx#309.
7 tasks
Resolves package.json version conflict: keep this branch's 0.1.0 bump (main is at 0.0.4; this PR ships new public API). provider.ts auto-merged cleanly, including the markSessionKeyUsed() pattern that landed on main in PR #26. Resyncs bun.lock against acpx@0.8.0 — now published with AcpRuntimeEnsureInput.sessionOptions, SessionAgentOptions, and SystemPromptOption that this PR forwards / re-exports.
This was referenced May 17, 2026
There was a problem hiding this comment.
Pull request overview
This PR adds support in acpx-ai-provider for passing per-session agent configuration (sessionOptions) through the provider into acpx/runtime.ensureSession(...), enabling callers to set systemPrompt (and related options) when creating a fresh ACP session.
Changes:
- Add
sessionOptions?: SessionAgentOptionstoAcpxProviderSettingsand re-export related runtime types. - Forward
sessionOptionsintoruntime.ensureSession(...)during handle/session initialization. - Document the feature and add unit tests validating the forwarded payload.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/acpx-ai-provider/test/unit/session-options.test.ts | Adds unit tests asserting sessionOptions forwarding behavior. |
| packages/acpx-ai-provider/src/types.ts | Adds sessionOptions to provider settings; re-exports SessionAgentOptions/SystemPromptOption. |
| packages/acpx-ai-provider/src/provider.ts | Threads sessionOptions into runtime.ensureSession(...). |
| packages/acpx-ai-provider/src/index.ts | Re-exports the new types from the package entrypoint. |
| packages/acpx-ai-provider/README.md | Documents system prompt / per-session options behavior and semantics. |
| packages/acpx-ai-provider/package.json | Bumps version and raises acpx dependency constraints. |
| bun.lock | Updates lockfile for new acpx version and workspace metadata. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…n record The 'close the prior session first' guidance was misleading: AcpxProvider.close() passes discardPersistentState: false, so the next ensureSession for the same sessionKey reloads the record and ignores the new sessionOptions. A distinct sessionKey is the only way to apply a different systemPrompt for the same workspace.
Brings acpx-ai-provider in line with the sibling acp-probe package which uses a caret-pin on acpx. Peer dep stays at >=0.8.0 to express the minimum supported runtime version.
…-options # Conflicts: # bun.lock # packages/acpx-ai-provider/package.json
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
Upstream: openclaw/acpx#309 — the runtime PR this provider change consumes.
Surfaces
sessionOptionsonAcpxProviderSettingsand threads it throughensureHandleintoruntime.ensureSession(...). Lets AI-SDK consumers set a per-sessionsystemPrompt(ormodel/allowedTools/maxTurns) on a fresh ACP session without bypassing the runtime.System prompts are applied on
newSession; changing them later requires a new session (use a distinctsessionKeyor close the prior record first). This matches the upstream runtime contract added in openclaw/acpx#309.What changed
package.json0.0.4→0.0.5.acpxpeer-dep + dev-dep raised to>=0.8.0(the upstream version that shipsAcpRuntimeEnsureInput.sessionOptions+SessionAgentOptions+SystemPromptOptionvia openclaw/acpx#309).src/types.tssessionOptions?: SessionAgentOptionstoAcpxProviderSettings; re-exportSessionAgentOptions+SystemPromptOptionfromacpx/runtime.src/provider.tsthis.settings.sessionOptionsfromensureHandleintoruntime.ensureSession(...)(one line).src/index.tsREADME.md### System promptssnippet under "Persistent sessions" explainingstringvs{ append }forms and the "fresh session only" semantics.test/unit/session-options.test.tsMockAcpRuntime: (1)systemPromptstring flows through toensureSession.sessionOptions, (2){ append }form + all four agent-option fields (model/allowedTools/maxTurns/systemPrompt) round-trip without mutation, (3) absent when not configured.Test plan
bun run lintclean.bun run typecheckclean (passes against the now-publishedacpx@0.8.0).bun run fallowclean.bun test— 266 pass / 24 skip / 0 fail across the monorepo (290 tests, 30 files; the three new tests are part of the 266).bun run buildclean (ESM + .d.ts).Coordination
Ships alongside two sibling provider features that all target
0.0.5:onPermissionRequestcallbackgetModels()helperWhichever lands first wins
0.0.5; the other two will need a follow-up bump (0.0.5→0.0.6→0.0.7) and a one-linepackage.jsonrebase to resolve the version conflict. All three are independent on the code side.