feat(provider): forward sessionOptions (systemPrompt, model, allowedTools, maxTurns) to runtime#23
Draft
DaniAkash wants to merge 1 commit into
Draft
feat(provider): forward sessionOptions (systemPrompt, model, allowedTools, maxTurns) to runtime#23DaniAkash wants to merge 1 commit into
DaniAkash wants to merge 1 commit into
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
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#309 merges and a corresponding
acpxrelease ships (expected as0.8.0based on the documented type signatures, matching the version assumed by #17 and #19).Do not mark ready / merge until:
acpx@0.8.0(or whatever version lands thesessionOptionsfield) is published to npm.bun installresolves the new acpx, thenbun run typecheckpasses — confirming upstream's published types match the documented shape.runtime.d.tsexposessessionOptions?: SessionAgentOptionsonAcpRuntimeEnsureInputplus theSessionAgentOptions+SystemPromptOptionre-exports. If upstream renamed during review, updatesrc/types.ts,src/provider.ts, andsrc/index.tsto match.Summary
Hosts can now set a per-session
systemPrompt(ormodel/allowedTools/maxTurns) on a fresh ACP session through the provider — no need to bypass the runtime.```ts
const provider = createAcpxProvider({
agent: 'claude',
sessionOptions: {
systemPrompt: 'You are an expert Rust reviewer. Be terse.',
// model: 'claude-opus-4-7',
// allowedTools: ['read', 'edit'],
// maxTurns: 5,
},
})
```
`{ append: '…' }` is also supported when you want to extend the agent's default prompt instead of replacing it. System prompts are fixed at `session/new` time — to switch prompts for the same workspace, use a distinct `sessionKey` or close the prior session first. Reused persistent records ignore `sessionOptions` by design.
This unblocks AI-SDK consumers that want per-conversation system prompts (chat apps, evaluation harnesses, scoped agents). The matching runtime change at openclaw/acpx#309 opens `AcpRuntime.ensureSession` to accept `sessionOptions`; this PR exposes that on `AcpxProviderSettings` and threads it through `ensureHandle`.
Files changed
Test plan
Coordination with #17 and #19
Three drafts now target the same upstream `acpx@0.8.0` release: #17, #19, and this PR. All three bump `version` to `0.1.0` and `acpx` to `>=0.8.0`. Whichever lands second and third needs to bump its version one step further (`0.1.0` → `0.2.0` → `0.3.0`, etc.) and resolve the `package.json` conflict on `version` + the dep range.
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.