@automatalabs/acp-agents 1.2.7 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -11
- package/dist/acp-client.d.ts +26 -6
- package/dist/acp-client.d.ts.map +1 -1
- package/dist/acp-client.js +30 -7
- package/dist/agent/acp-agent.d.ts +141 -0
- package/dist/agent/acp-agent.d.ts.map +1 -0
- package/dist/agent/acp-agent.js +837 -0
- package/dist/agent/errors.d.ts +17 -0
- package/dist/agent/errors.d.ts.map +1 -0
- package/dist/agent/errors.js +37 -0
- package/dist/agent/events.d.ts +26 -0
- package/dist/agent/events.d.ts.map +1 -0
- package/dist/agent/events.js +165 -0
- package/dist/agent/fork.d.ts +27 -0
- package/dist/agent/fork.d.ts.map +1 -0
- package/dist/agent/fork.js +28 -0
- package/dist/agent/probe.d.ts +14 -0
- package/dist/agent/probe.d.ts.map +1 -0
- package/dist/agent/probe.js +87 -0
- package/dist/agent/process-registry.d.ts +9 -0
- package/dist/agent/process-registry.d.ts.map +1 -0
- package/dist/agent/process-registry.js +28 -0
- package/dist/agent/queue.d.ts +19 -0
- package/dist/agent/queue.d.ts.map +1 -0
- package/dist/agent/queue.js +90 -0
- package/dist/agent/routing.d.ts +27 -0
- package/dist/agent/routing.d.ts.map +1 -0
- package/dist/agent/routing.js +87 -0
- package/dist/agent/structured.d.ts +47 -0
- package/dist/agent/structured.d.ts.map +1 -0
- package/dist/agent/structured.js +90 -0
- package/dist/agent/turn.d.ts +65 -0
- package/dist/agent/turn.d.ts.map +1 -0
- package/dist/agent/turn.js +187 -0
- package/dist/agent/types.d.ts +226 -0
- package/dist/agent/types.d.ts.map +1 -0
- package/dist/agent/types.js +9 -0
- package/dist/backend.d.ts +18 -5
- package/dist/backend.d.ts.map +1 -1
- package/dist/backends/claude.d.ts +5 -0
- package/dist/backends/claude.d.ts.map +1 -1
- package/dist/backends/claude.js +45 -17
- package/dist/backends/codex.d.ts +4 -0
- package/dist/backends/codex.d.ts.map +1 -1
- package/dist/backends/codex.js +14 -9
- package/dist/backends/custom.d.ts.map +1 -1
- package/dist/backends/custom.js +3 -2
- package/dist/backends/opencode.d.ts +4 -0
- package/dist/backends/opencode.d.ts.map +1 -1
- package/dist/backends/opencode.js +5 -1
- package/dist/backends/pi.d.ts +5 -2
- package/dist/backends/pi.d.ts.map +1 -1
- package/dist/backends/pi.js +15 -3
- package/dist/config-catalog.d.ts +173 -0
- package/dist/config-catalog.d.ts.map +1 -0
- package/dist/config-catalog.js +408 -0
- package/dist/index.d.ts +11 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -1
- package/dist/interactive.d.ts +4 -5
- package/dist/interactive.d.ts.map +1 -1
- package/dist/protocol-coverage.d.ts +82 -0
- package/dist/protocol-coverage.d.ts.map +1 -1
- package/dist/protocol-coverage.js +76 -0
- package/dist/registry.d.ts +12 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +22 -0
- package/dist/routing.d.ts +14 -0
- package/dist/routing.d.ts.map +1 -0
- package/dist/routing.js +53 -0
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +9 -68
- package/dist/session-ref.d.ts +8 -0
- package/dist/session-ref.d.ts.map +1 -0
- package/dist/session-ref.js +21 -0
- package/dist/structured-tool.d.ts +4 -0
- package/dist/structured-tool.d.ts.map +1 -1
- package/dist/structured-tool.js +5 -0
- package/dist/system-prompt.d.ts +13 -0
- package/dist/system-prompt.d.ts.map +1 -0
- package/dist/system-prompt.js +67 -0
- package/package.json +4 -4
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import type { PromptResponse, SessionConfigOption, SessionModeState, StopReason, ToolCallContent, ToolCallLocation, ToolCallStatus, ToolKind, Usage } from "@agentclientprotocol/sdk";
|
|
2
|
+
import type { AgentHistoryEntry, AgentUsage, McpServerConfig, PromptImage, SystemPromptOptions, WorkflowError } from "@automatalabs/shared-types";
|
|
3
|
+
import type { TSchema } from "typebox";
|
|
4
|
+
import type { AuthStore } from "../auth/auth-store.js";
|
|
5
|
+
import type { ClientHandlers } from "../client-handlers.js";
|
|
6
|
+
import type { HarnessConfigReport, HarnessModelsView } from "../config-catalog.js";
|
|
7
|
+
import type { AcpElicitationEvent, AcpPermissionEvent, AcpRunnerEventMap, AcpSessionUpdate } from "../events.js";
|
|
8
|
+
import type { ElicitationResolver, PermissionResolver, ToolPolicy } from "../permissions.js";
|
|
9
|
+
import type { ProviderStore } from "../provider-store.js";
|
|
10
|
+
import type { CustomBackendConfig } from "../registry.js";
|
|
11
|
+
export type { SessionConfigOption, SessionModeState };
|
|
12
|
+
export interface AcpAgentOptions {
|
|
13
|
+
/** ABSOLUTE path that exists and is a directory. Validated synchronously in the constructor and
|
|
14
|
+
* the statics BEFORE any process spawns (SCRIPT_VALIDATION_ERROR otherwise). Sent as the
|
|
15
|
+
* session/new|fork|resume|load `cwd`. */
|
|
16
|
+
cwd: string;
|
|
17
|
+
/** Model routing spec with the runner's grammar (`resolveModelRoute`): the first `/`-segment
|
|
18
|
+
* routes to a registered custom backend (wins) or a built-in; the remainder is the backend's
|
|
19
|
+
* model id VERBATIM and is sent as `session/set_config_option { configId: "model" }` right after
|
|
20
|
+
* the session opens. An unrouted spec (no known first segment) goes WHOLE to the default backend
|
|
21
|
+
* (`AGENTPRISM_DEFAULT_BACKEND`, else `claude`). Omitted = default backend, no model selection. */
|
|
22
|
+
model?: string;
|
|
23
|
+
/** Session mode. Explicit ids are strict (unadvertised → SCRIPT_VALIDATION_ERROR at open).
|
|
24
|
+
* Omitted = the backend's `defaultModeId` when advertised (claude `auto`, codex `agent`,
|
|
25
|
+
* opencode `build`; pi/custom none). */
|
|
26
|
+
mode?: string;
|
|
27
|
+
/** Applied verbatim via `session/set_config_option` in ascending option-id order after model
|
|
28
|
+
* selection. `"model"` is reserved (SCRIPT_VALIDATION_ERROR in the constructor). Ids not in the
|
|
29
|
+
* advertised catalog fail at open with SCRIPT_VALIDATION_ERROR listing the advertised ids. */
|
|
30
|
+
configOptions?: Record<string, string | boolean>;
|
|
31
|
+
/** Session-level structured-output contract (typebox). Claude: `_meta.claudeCode.options.outputFormat`
|
|
32
|
+
* at session/new|resume|load|fork; Codex: `_meta.outputSchema` on every turn; OpenCode/pi/custom:
|
|
33
|
+
* the client-hosted `StructuredOutput` HTTP MCP tool injected into `mcpServers` when the agent
|
|
34
|
+
* advertises `mcpCapabilities.http`, plus the in-prompt contract. Each turn reports
|
|
35
|
+
* `structured` / `structuredError`; there is no repair ladder. */
|
|
36
|
+
schema?: TSchema;
|
|
37
|
+
/** Client-provided MCP servers (stdio/http/sse/acp). Capability-gated by the connection exactly
|
|
38
|
+
* like the runner. */
|
|
39
|
+
mcpServers?: McpServerConfig[];
|
|
40
|
+
/** Headless permission auto-policy: allow/deny lists + `defaultOutcome` (default "allow"). */
|
|
41
|
+
tools?: ToolPolicy;
|
|
42
|
+
/** Session-scoped async permission resolver; wins over `tools` unless the request matches an
|
|
43
|
+
* explicit list (same precedence as the runner: resolver > policy). */
|
|
44
|
+
onPermissionRequest?: PermissionResolver;
|
|
45
|
+
/** Elicitation responder; its presence is what advertises `elicitation` at initialize. */
|
|
46
|
+
onElicitation?: ElicitationResolver;
|
|
47
|
+
/** Generic session/new `_meta` passthrough. Layered UNDER backend-computed keys (shallow, like
|
|
48
|
+
* the runner) and, when `raw !== false`, OVER `backend.rawMessagesMeta()`. */
|
|
49
|
+
meta?: Record<string, unknown>;
|
|
50
|
+
/** Backend-neutral system prompt instructions: `replace` swaps the backend's built-in system
|
|
51
|
+
* prompt, `append` adds to it. Validated in the constructor (and `fork()` / the statics) against
|
|
52
|
+
* the routed backend's `Backend.systemPrompt` support BEFORE any process spawns — a field the
|
|
53
|
+
* backend cannot carry is SCRIPT_VALIDATION_ERROR, never a silent no-op (Codex and Claude and pi
|
|
54
|
+
* carry both; OpenCode and custom backends carry neither). Sent on `session/new|resume|load`
|
|
55
|
+
* and the reattach of an id-only fork in the backend's dialect: Codex `_meta.baseInstructions`
|
|
56
|
+
* / `_meta.developerInstructions`, Claude `_meta.systemPrompt` (string, or `{ append }`), pi
|
|
57
|
+
* `_meta.systemPrompt` `{ replace?, append? }`. Wins over the same key in `meta`. Inherited by
|
|
58
|
+
* forks (overridable). */
|
|
59
|
+
systemPrompt?: SystemPromptOptions;
|
|
60
|
+
/** Human label stamped on every event context and every WorkflowError `agentLabel`; never on
|
|
61
|
+
* the wire. */
|
|
62
|
+
label?: string;
|
|
63
|
+
/** Custom backend registry merged over `AGENTPRISM_BACKENDS` exactly like
|
|
64
|
+
* `createAcpRunner({ backends })`. Read once in the constructor; malformed →
|
|
65
|
+
* SCRIPT_VALIDATION_ERROR. Forks inherit it and cannot override it. */
|
|
66
|
+
backends?: Record<string, CustomBackendConfig>;
|
|
67
|
+
/** Agent-lifetime abort: rejects queued work with `signal.reason`, cancels an in-flight turn,
|
|
68
|
+
* then closes. Not inherited by forks. */
|
|
69
|
+
signal?: AbortSignal;
|
|
70
|
+
/** Default true: the session log is retained across turns so `history`/`text` are cumulative
|
|
71
|
+
* and a fork can seed its child. `false` maps to `retainSessionLog: false` (history/text hold
|
|
72
|
+
* only the latest turn). */
|
|
73
|
+
retainHistory?: boolean;
|
|
74
|
+
/** Default true: ask the backend to emit its vendor notifications (`_claude/sdkMessage` on
|
|
75
|
+
* Claude) so they reach `on("raw_message")` and `turn.raw`. `false` skips
|
|
76
|
+
* `backend.rawMessagesMeta()` (a schema still turns raw messages on for Claude because the
|
|
77
|
+
* schema channel needs them). */
|
|
78
|
+
raw?: boolean;
|
|
79
|
+
/** Optional shared auth store (default off = each agent's own login). Forks share the parent's. */
|
|
80
|
+
authStore?: AuthStore;
|
|
81
|
+
/** Optional shared provider-intent store. Forks share the parent's. */
|
|
82
|
+
providerStore?: ProviderStore;
|
|
83
|
+
/** Client-side fs/terminal/mcp handlers advertised at initialize (validated with
|
|
84
|
+
* `validateClientHandlers`). */
|
|
85
|
+
clientHandlers?: ClientHandlers;
|
|
86
|
+
}
|
|
87
|
+
export interface AcpAgentPromptOptions {
|
|
88
|
+
/** Appended as image content blocks (validated with `validatePromptImages`; string prompts
|
|
89
|
+
* become `[text, ...images]`). */
|
|
90
|
+
images?: readonly PromptImage[];
|
|
91
|
+
/** Turn `_meta` passthrough, merged UNDER the backend's turn meta (backend keys win direct
|
|
92
|
+
* collisions, exactly like the runner's `mergeTurnMeta`). */
|
|
93
|
+
meta?: Record<string, unknown>;
|
|
94
|
+
/** Applied via `session/set_config_option` BEFORE this turn, inside the FIFO; STICKY for the
|
|
95
|
+
* session. Same validation as the constructor option. */
|
|
96
|
+
configOptions?: Record<string, string | boolean>;
|
|
97
|
+
/** Applied via `session/set_mode` before this turn, inside the FIFO; sticky; strict. */
|
|
98
|
+
mode?: string;
|
|
99
|
+
/** Per-turn schema override. Allowed ONLY when the backend carries the schema on the turn and
|
|
100
|
+
* does not embed it in the prompt (today: Codex). Otherwise SCRIPT_VALIDATION_ERROR naming the
|
|
101
|
+
* backend and pointing at the constructor `schema` option. */
|
|
102
|
+
schema?: TSchema;
|
|
103
|
+
/** Per-call abort: queued, or started but not yet on the wire (the lazy open, the per-turn
|
|
104
|
+
* `configOptions`/`mode`) → rejects with the reason without sending; in flight →
|
|
105
|
+
* `session/cancel`, then rejects with the reason. The one way to stop a turn `cancel()` cannot
|
|
106
|
+
* reach: `cancel()` targets only a turn whose `session/prompt` is on the wire. */
|
|
107
|
+
signal?: AbortSignal;
|
|
108
|
+
}
|
|
109
|
+
export interface AcpAgentSteerOptions {
|
|
110
|
+
images?: readonly PromptImage[];
|
|
111
|
+
meta?: Record<string, unknown>;
|
|
112
|
+
}
|
|
113
|
+
export interface AcpAgentCloseOptions {
|
|
114
|
+
/** true = skip `session/close` so the agent-persisted session stays re-openable via
|
|
115
|
+
* `AcpAgent.resume/load/fork(ref)`. The dedicated process is disposed either way. */
|
|
116
|
+
keep?: boolean;
|
|
117
|
+
}
|
|
118
|
+
/** Everything a fork may override. The backend is fixed by the parent: a `model` override must
|
|
119
|
+
* route to the same backend (poolKey-equal) or SCRIPT_VALIDATION_ERROR. `backends`, `authStore`,
|
|
120
|
+
* `providerStore`, `clientHandlers` are inherited and not overridable. `label` defaults to
|
|
121
|
+
* `<parent label>/fork-<n>` (or `fork-<n>`); `signal` is never inherited. `cwd` defaults to the
|
|
122
|
+
* parent's; a different cwd is rejected on `cwd: "source-only"` backends (`FORK_SESSION_TRAITS`). */
|
|
123
|
+
export type AcpAgentForkOptions = Partial<Omit<AcpAgentOptions, "backends" | "authStore" | "providerStore" | "clientHandlers">>;
|
|
124
|
+
/** Options for the cold statics. `cwd` defaults to `ref.cwd`; `model` must route to `ref.backendId`. */
|
|
125
|
+
export type AcpAgentReopenOptions = Partial<AcpAgentOptions>;
|
|
126
|
+
export interface AcpAgentProbeOptions {
|
|
127
|
+
/** One exact routed spec (`modelSpecs: [model]`): selected before the catalog is read. */
|
|
128
|
+
model?: string;
|
|
129
|
+
/** More exact specs. */
|
|
130
|
+
models?: string[];
|
|
131
|
+
/** Backend-only targets. Default (no `harnesses`, no model specs): every built-in plus every
|
|
132
|
+
* registered custom backend. */
|
|
133
|
+
harnesses?: string[];
|
|
134
|
+
/** Substring or `/regex/` over leaf model ids → `catalog.models[*].matches`. */
|
|
135
|
+
modelFilter?: string;
|
|
136
|
+
backends?: Record<string, CustomBackendConfig>;
|
|
137
|
+
cwd?: string;
|
|
138
|
+
probeTimeoutMs?: number;
|
|
139
|
+
probeConcurrency?: number;
|
|
140
|
+
signal?: AbortSignal;
|
|
141
|
+
}
|
|
142
|
+
export type AcpAgentCatalog = HarnessConfigReport & {
|
|
143
|
+
models: HarnessModelsView[];
|
|
144
|
+
};
|
|
145
|
+
export interface AcpAgentUpdateRecord {
|
|
146
|
+
readonly update: AcpSessionUpdate;
|
|
147
|
+
readonly receivedAt: number;
|
|
148
|
+
}
|
|
149
|
+
export interface AcpAgentRawRecord {
|
|
150
|
+
readonly method: string;
|
|
151
|
+
readonly message: unknown;
|
|
152
|
+
readonly receivedAt: number;
|
|
153
|
+
}
|
|
154
|
+
export interface AcpAgentToolCall {
|
|
155
|
+
readonly toolCallId: string;
|
|
156
|
+
/** SDK UNSTABLE `ToolCall.name` / `ToolCallUpdate.name`, verbatim. */
|
|
157
|
+
readonly name?: string;
|
|
158
|
+
readonly title: string;
|
|
159
|
+
readonly kind?: ToolKind;
|
|
160
|
+
/** Last seen; "pending" when the agent sent none. */
|
|
161
|
+
readonly status: ToolCallStatus;
|
|
162
|
+
readonly rawInput?: unknown;
|
|
163
|
+
readonly rawOutput?: unknown;
|
|
164
|
+
readonly content?: ToolCallContent[];
|
|
165
|
+
readonly locations?: ToolCallLocation[];
|
|
166
|
+
/** Shallow merge of every `_meta` seen for this id. */
|
|
167
|
+
readonly meta?: Record<string, unknown>;
|
|
168
|
+
}
|
|
169
|
+
export interface AcpAgentTurnUsage {
|
|
170
|
+
/** THIS turn's tokens: `response.usage` mapped to `AgentUsage` (every installed adapter reports
|
|
171
|
+
* the turn, not the session — `PROMPT_USAGE_SCOPES`); `cost` = the clamped delta of the
|
|
172
|
+
* cumulative `usage_update` cost gauge across the turn. When the response carries no `usage`,
|
|
173
|
+
* tokens fall back to the context-token gauge delta exactly like `UsageAccumulator.delta()`. */
|
|
174
|
+
readonly turn: AgentUsage;
|
|
175
|
+
/** Running per-field sum of every turn THIS AcpAgent ran (`cost` = the latest gauge value),
|
|
176
|
+
* including this one. Starts at zero at open/fork/resume/load — replayed history and the
|
|
177
|
+
* parent's turns are not counted. */
|
|
178
|
+
readonly session: AgentUsage;
|
|
179
|
+
/** `response.usage` verbatim. */
|
|
180
|
+
readonly response?: Usage;
|
|
181
|
+
}
|
|
182
|
+
export interface AcpAgentTurn {
|
|
183
|
+
/** The wire object, `_meta` intact (no SDK response mapping on session/prompt). */
|
|
184
|
+
readonly response: PromptResponse;
|
|
185
|
+
/** `= response.stopReason`; NEVER thrown on (refusal/max_tokens/cancelled included). */
|
|
186
|
+
readonly stopReason: StopReason;
|
|
187
|
+
/** This turn's assistant messages joined by "\n\n" (`SessionHandle.foldedTurnText()`). */
|
|
188
|
+
readonly text: string;
|
|
189
|
+
/** Every session/update of this turn, structuredClone'd (verbatim objects, `_meta` intact). */
|
|
190
|
+
readonly updates: ReadonlyArray<AcpAgentUpdateRecord>;
|
|
191
|
+
/** Every `raw_message` of this turn (Claude `_claude/sdkMessage`). */
|
|
192
|
+
readonly raw: ReadonlyArray<AcpAgentRawRecord>;
|
|
193
|
+
/** tool_call ⊕ tool_call_update folded by toolCallId, first-seen order. */
|
|
194
|
+
readonly toolCalls: ReadonlyArray<AcpAgentToolCall>;
|
|
195
|
+
readonly permissions: ReadonlyArray<AcpPermissionEvent>;
|
|
196
|
+
readonly elicitations: ReadonlyArray<AcpElicitationEvent>;
|
|
197
|
+
readonly usage: AcpAgentTurnUsage;
|
|
198
|
+
/** Validated (typebox Convert + Check) when a schema was active for the turn. */
|
|
199
|
+
readonly structured?: unknown;
|
|
200
|
+
/** Why `structured` is absent although a schema was active. */
|
|
201
|
+
readonly structuredError?: string;
|
|
202
|
+
/** This turn's accumulator entries (copies). Per CHUNK, not per message: one `assistant`/`text`
|
|
203
|
+
* entry per streamed `agent_message_chunk` and one `tool`/`toolCall` entry per `tool_call`, so
|
|
204
|
+
* `history.length` is not a message count — `text` is the folded, per-message view. */
|
|
205
|
+
readonly history: readonly AgentHistoryEntry[];
|
|
206
|
+
}
|
|
207
|
+
/** A `prompt()` rejection for a turn the agent walled with a typed session failure (codex-acp's
|
|
208
|
+
* negotiated extension): the runner's mapped `WorkflowError` (`mapTypedSessionFailure`, so codes,
|
|
209
|
+
* `recoverable` and `details` keep their tested contract) carrying the COMPLETE turn — verbatim
|
|
210
|
+
* `response` incl. `_meta`, `usage`, `updates`, `raw`, `toolCalls`, `history` — so nothing is
|
|
211
|
+
* stripped. Narrow with `isAcpAgentTurnError`. */
|
|
212
|
+
export type AcpAgentTurnError = WorkflowError & {
|
|
213
|
+
readonly turn: AcpAgentTurn;
|
|
214
|
+
};
|
|
215
|
+
/** Same keys/payloads as the runner bus (no new cross-cutting names); turn boundaries are the
|
|
216
|
+
* `prompt()` promise. */
|
|
217
|
+
export type AcpAgentEventMap = AcpRunnerEventMap;
|
|
218
|
+
export type AcpAgentEventName = keyof AcpAgentEventMap;
|
|
219
|
+
export type AcpAgentEventListener<K extends AcpAgentEventName> = (event: AcpAgentEventMap[K]) => void;
|
|
220
|
+
/** `idle` (constructed, nothing spawned) → `opening` → `ready` ⇄ `busy` (a queued op is executing)
|
|
221
|
+
* → `closed` (set the instant `close()` is called, the constructor signal aborts, or the process
|
|
222
|
+
* dies). */
|
|
223
|
+
export type AcpAgentState = "idle" | "opening" | "ready" | "busy" | "closed";
|
|
224
|
+
/** The all-zero `AgentUsage` every agent starts from (frozen; never mutated in place). */
|
|
225
|
+
export declare const ZERO_USAGE: AgentUsage;
|
|
226
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/agent/types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,KAAK,EACN,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,WAAW,EACX,mBAAmB,EACnB,aAAa,EACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB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MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AACjD,MAAM,MAAM,iBAAiB,GAAG,MAAM,gBAAgB,CAAC;AACvD,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,iBAAiB,IAAI,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;AAEtG;;aAEa;AACb,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE7E,0FAA0F;AAC1F,eAAO,MAAM,UAAU,EAAE,UAOvB,CAAC"}
|
package/dist/backend.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { TSchema } from "typebox";
|
|
2
|
-
import type { ProviderUsageLimitContext } from "@automatalabs/shared-types";
|
|
2
|
+
import type { ProviderUsageLimitContext, SystemPromptOptions } from "@automatalabs/shared-types";
|
|
3
3
|
import type { AuthProfile } from "./auth/auth-profile.js";
|
|
4
|
+
import type { SystemPromptSupport } from "./protocol-coverage.js";
|
|
4
5
|
/** Compatibility type path; the registry table is the only authored built-in identity source. */
|
|
5
6
|
export type { BuiltinBackendId } from "./backends/builtins.js";
|
|
6
7
|
/** A backend id: one of the built-ins, or the registered name of a custom ACP backend
|
|
@@ -26,10 +27,11 @@ export interface StructuredSource {
|
|
|
26
27
|
/** Per-session inputs a backend may fold into its `session/new` `_meta`, beyond the schema.
|
|
27
28
|
* Additive/optional; a backend that doesn't understand a field ignores it. */
|
|
28
29
|
export interface SessionMetaInputs {
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
/** Backend-neutral system prompt instructions, already validated against `Backend.systemPrompt`
|
|
31
|
+
* (`assertSystemPromptSupported`): the backend maps `replace`/`append` onto its own
|
|
32
|
+
* `_meta` dialect — Codex `baseInstructions`/`developerInstructions`, Claude and pi
|
|
33
|
+
* `systemPrompt`. A backend that declares no support never sees a defined value. */
|
|
34
|
+
systemPrompt?: SystemPromptOptions;
|
|
33
35
|
/** Engine run correlation id. Backends may use it to suppress autonomous session work. */
|
|
34
36
|
runId?: string;
|
|
35
37
|
/** Human-readable occurrence label associated with `runId`; never sent unless a backend uses it. */
|
|
@@ -66,6 +68,11 @@ export interface Backend {
|
|
|
66
68
|
* initialized agent strictly advertises HTTP MCP support. Native schema channels leave this
|
|
67
69
|
* unset; custom ACP backends opt in unless their registry entry disables it. */
|
|
68
70
|
readonly injectStructuredOutputTool?: boolean;
|
|
71
|
+
/** Which halves of `SystemPromptOptions` this backend can carry on its session `_meta`
|
|
72
|
+
* (`SYSTEM_PROMPT_SUPPORT` for the built-ins). Undefined = neither: the runner and the AcpAgent
|
|
73
|
+
* SDK reject a `systemPrompt` for such a backend with SCRIPT_VALIDATION_ERROR before a session
|
|
74
|
+
* opens, so instructions are never silently dropped. */
|
|
75
|
+
readonly systemPrompt?: SystemPromptSupport;
|
|
69
76
|
/** OPTIONAL `initialize.clientCapabilities._meta` this backend adds: the namespaced vendor
|
|
70
77
|
* extensions THIS CLIENT implements for that agent, so the agent may turn them on. Backend-scoped
|
|
71
78
|
* on purpose — advertising a capability to an agent that does not implement it is noise, and
|
|
@@ -95,6 +102,12 @@ export interface Backend {
|
|
|
95
102
|
* keys win over the generic user passthrough. `inputs` carries optional per-session extras
|
|
96
103
|
* (e.g. Codex base/developer instructions); a backend that has no use for them ignores it. */
|
|
97
104
|
sessionMeta(schema: TSchema | undefined, inputs?: SessionMetaInputs): Record<string, unknown> | undefined;
|
|
105
|
+
/** OPTIONAL session `_meta` that switches the agent's vendor notification stream on (the
|
|
106
|
+
* `raw_message` events — Claude's `_claude/sdkMessage`). Undefined when the agent has no such
|
|
107
|
+
* stream. The AcpAgent SDK layers it UNDER the caller's `meta` and OVER `sessionMetaDefaults`
|
|
108
|
+
* when `raw` is on; the one-shot runner never sends it (a schema run already enables the stream
|
|
109
|
+
* through `sessionMeta`). */
|
|
110
|
+
rawMessagesMeta?(): Record<string, unknown> | undefined;
|
|
98
111
|
/** Protocol-critical `_meta` for session/prompt (undefined when this backend carries the schema
|
|
99
112
|
* at session/new). These keys win direct collisions with caller prompt metadata; unrelated
|
|
100
113
|
* caller keys are transported unchanged. */
|
package/dist/backend.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAElE,iGAAiG;AACjG,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D;sFACsF;AACtF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;CACxB;AAED,8FAA8F;AAC9F,MAAM,WAAW,gBAAgB;IAC/B,8FAA8F;IAC9F,eAAe,IAAI,MAAM,CAAC;IAC1B;;;4FAGwF;IACxF,gBAAgB,IAAI,MAAM,CAAC;IAC3B,uGAAuG;IACvG,mBAAmB,IAAI,OAAO,CAAC;CAChC;AAED;+EAC+E;AAC/E,MAAM,WAAW,iBAAiB;IAChC;;;yFAGqF;IACrF,YAAY,CAAC,EAAE,mBA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AAS,CAAC;IACtF;;;mGAG+F;IAC/F,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAC1G;;;;kCAI8B;IAC9B,eAAe,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IACxD;;iDAE6C;IAC7C,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAC7E,oGAAoG;IACpG,gBAAgB,CAAC,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC;CACtD;AAED,6FAA6F;AAC7F,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,EAAE,CAE7D"}
|
|
@@ -11,8 +11,13 @@ export declare class ClaudeBackend implements Backend {
|
|
|
11
11
|
classifyProviderError(error: unknown, metadata?: ProviderErrorMetadata): ProviderErrorClassification | undefined;
|
|
12
12
|
spawnConfig(): SpawnConfig;
|
|
13
13
|
sessionMetaDefaults(inputs?: SessionMetaInputs): Record<string, unknown> | undefined;
|
|
14
|
+
/** claude-agent-acp reads `_meta.systemPrompt` at session creation (new, resume, load, and the
|
|
15
|
+
* reattach an id-only fork needs): a string replaces the prompt, `{ append }` extends the
|
|
16
|
+
* `claude_code` preset. */
|
|
17
|
+
readonly systemPrompt: import("../protocol-coverage.js").SystemPromptSupport;
|
|
14
18
|
sessionMeta(schema: TSchema | undefined, inputs?: SessionMetaInputs): Record<string, unknown> | undefined;
|
|
15
19
|
promptMeta(): Record<string, unknown> | undefined;
|
|
20
|
+
rawMessagesMeta(): Record<string, unknown> | undefined;
|
|
16
21
|
nativeStructured(source: StructuredSource): unknown;
|
|
17
22
|
}
|
|
18
23
|
export declare const claudeBackendDefinition: import("./define.js").BuiltinBackendDefinition<"claude">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/backends/claude.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/backends/claude.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAOvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EACV,OAAO,EACP,2BAA2B,EAC3B,qBAAqB,EACrB,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EACjB,MAAM,eAAe,CAAC;AASvB,+FAA+F;AAC/F,eAAO,MAAM,iBAAiB,EAAE,WAK/B,CAAC;AAEF,qBAAa,aAAc,YAAW,OAAO;IAI/B,QAAQ,CAAC,WAAW,EAAE,WAAW;IAH7C,QAAQ,CAAC,EAAE,EAAG,QAAQ,CAAU;IAChC,QAAQ,CAAC,aAAa,EAAG,MAAM,CAAU;gBAEpB,WAAW,GAAE,WAA+B;IAEjE,qBAAqB,CACnB,KAAK,EAAE,OAAO,EACd,QAAQ,CAAC,EAAE,qBAAqB,GAC/B,2BAA2B,GAAG,SAAS;IAa1C,WAAW,IAAI,WAAW;IAgB1B,mBAAmB,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;IAMpF;;gCAE4B;IAC5B,QAAQ,CAAC,YAAY,wDAAiC;IAEtD,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;IAwBzG,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;IAKjD,eAAe,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;IAMtD,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO;CAGpD;AAsBD,eAAO,MAAM,uBAAuB,0DA2BlC,CAAC"}
|
package/dist/backends/claude.js
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
// The parsed object lands on SDKResultSuccess.structured_output, observable ONLY off the raw
|
|
6
6
|
// `_claude/sdkMessage` extension notification (the runner's ACP client captures it).
|
|
7
7
|
import { createRequire } from "node:module";
|
|
8
|
+
import { META_KEYS, } from "@automatalabs/shared-types";
|
|
8
9
|
import { splitArgs } from "../backend.js";
|
|
9
|
-
import { BUILTIN_PROTOCOL_COVERAGE } from "../protocol-coverage.js";
|
|
10
|
+
import { BUILTIN_PROTOCOL_COVERAGE, systemPromptSupport } from "../protocol-coverage.js";
|
|
10
11
|
import { toAnthropicJsonSchema } from "../schema-strict.js";
|
|
11
12
|
import { defineBuiltinBackend } from "./define.js";
|
|
12
13
|
const require = createRequire(import.meta.url);
|
|
@@ -59,37 +60,64 @@ export class ClaudeBackend {
|
|
|
59
60
|
return undefined;
|
|
60
61
|
return { claudeCode: { options: { title } } };
|
|
61
62
|
}
|
|
63
|
+
/** claude-agent-acp reads `_meta.systemPrompt` at session creation (new, resume, load, and the
|
|
64
|
+
* reattach an id-only fork needs): a string replaces the prompt, `{ append }` extends the
|
|
65
|
+
* `claude_code` preset. */
|
|
66
|
+
systemPrompt = systemPromptSupport("claude");
|
|
62
67
|
sessionMeta(schema, inputs) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const meta = {
|
|
75
|
-
claudeCode: {
|
|
68
|
+
const meta = {};
|
|
69
|
+
if (schema) {
|
|
70
|
+
// Anthropic structured outputs accept only a JSON-Schema subset (additionalProperties:false
|
|
71
|
+
// required on every object; numeric/string/array constraints rejected). Normalize the wire
|
|
72
|
+
// copy so the native constraint always engages — an incompatible schema would fail the SDK
|
|
73
|
+
// constraint and silently degrade the run to unconstrained text + the repair ladder.
|
|
74
|
+
// For engine runs, set the SDK session title up front: claude-agent-acp >=0.71 otherwise
|
|
75
|
+
// launches an unobserved background small-model title-generation call after the first
|
|
76
|
+
// turn. Interactive sessions have no runId and retain the adapter's generated-title behavior.
|
|
77
|
+
const title = workflowSessionTitle(inputs);
|
|
78
|
+
meta.claudeCode = {
|
|
76
79
|
options: {
|
|
77
80
|
...(title ? { title } : {}),
|
|
78
81
|
outputFormat: { type: "json_schema", schema: toAnthropicJsonSchema(schema) },
|
|
79
82
|
},
|
|
80
83
|
emitRawSDKMessages: true,
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
const systemPrompt = claudeSystemPromptMeta(inputs?.systemPrompt);
|
|
87
|
+
if (systemPrompt !== undefined)
|
|
88
|
+
meta[META_KEYS.systemPrompt] = systemPrompt;
|
|
89
|
+
return Object.keys(meta).length > 0 ? meta : undefined;
|
|
84
90
|
}
|
|
85
91
|
promptMeta() {
|
|
86
92
|
// Claude's schema is session-scoped (read at session/new); nothing on the turn.
|
|
87
93
|
return undefined;
|
|
88
94
|
}
|
|
95
|
+
rawMessagesMeta() {
|
|
96
|
+
// claude-agent-acp emits `_claude/sdkMessage` only when the session asks for it; a schema
|
|
97
|
+
// session already sets this through sessionMeta (the result rides that stream).
|
|
98
|
+
return { claudeCode: { emitRawSDKMessages: true } };
|
|
99
|
+
}
|
|
89
100
|
nativeStructured(source) {
|
|
90
101
|
return source.rawStructuredOutput();
|
|
91
102
|
}
|
|
92
103
|
}
|
|
104
|
+
/** Fold the neutral instructions into claude-agent-acp's single `systemPrompt` slot. The adapter
|
|
105
|
+
* takes EITHER a full replacement string OR preset options (`{ append }` on the `claude_code`
|
|
106
|
+
* preset) — there is no "custom base plus append" form — so `replace` + `append` together become
|
|
107
|
+
* one replacement string: the replaced prompt followed by the appended text, joined by a blank
|
|
108
|
+
* line (exactly what the caller asked for; the seam documents the join). */
|
|
109
|
+
function claudeSystemPromptMeta(options) {
|
|
110
|
+
if (!options)
|
|
111
|
+
return undefined;
|
|
112
|
+
const { replace, append } = options;
|
|
113
|
+
if (replace !== undefined && append !== undefined)
|
|
114
|
+
return `${replace}\n\n${append}`;
|
|
115
|
+
if (replace !== undefined)
|
|
116
|
+
return replace;
|
|
117
|
+
if (append !== undefined)
|
|
118
|
+
return { append };
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
|
93
121
|
function workflowSessionTitle(inputs) {
|
|
94
122
|
if (!inputs?.runId)
|
|
95
123
|
return undefined;
|
package/dist/backends/codex.d.ts
CHANGED
|
@@ -20,6 +20,10 @@ export declare class CodexBackend implements Backend {
|
|
|
20
20
|
* channel's own equivalents are mapped by `mapTypedSessionFailure`. */
|
|
21
21
|
classifyProviderError(error: unknown, metadata?: ProviderErrorMetadata): ProviderErrorClassification | undefined;
|
|
22
22
|
spawnConfig(): SpawnConfig;
|
|
23
|
+
/** The fork reads bare `_meta.baseInstructions` (replaces Codex's base system prompt) and
|
|
24
|
+
* `_meta.developerInstructions` (developer-role instructions on top of it) at session/new,
|
|
25
|
+
* resume, and load — the reattach an id-only fork needs, so forks carry them too. */
|
|
26
|
+
readonly systemPrompt: import("../protocol-coverage.js").SystemPromptSupport;
|
|
23
27
|
sessionMeta(_schema: TSchema | undefined, inputs?: SessionMetaInputs): Record<string, unknown> | undefined;
|
|
24
28
|
promptMeta(schema: TSchema | undefined): Record<string, unknown> | undefined;
|
|
25
29
|
nativeStructured(source: StructuredSource): unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../src/backends/codex.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,OA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AAO,CAAU;IAC/B,QAAQ,CAAC,aAAa,EAAG,OAAO,CAAU;gBAErB,WAAW,GAAE,WAA8B;IAEhE;;;qGAGiG;IACjG,QAAQ,CAAC,oBAAoB,oCAA2C;IAExE;;;;4EAIwE;IACxE,qBAAqB,CACnB,KAAK,EAAE,OAAO,EACd,QAAQ,CAAC,EAAE,qBAAqB,GAC/B,2BAA2B,GAAG,SAAS;IAW1C,WAAW,IAAI,WAAW;IAe1B;;0FAEsF;IACtF,QAAQ,CAAC,YAAY,wDAAgC;IAErD,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;IAa1G,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;IAK5E,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO;CAMpD;AAED,eAAO,MAAM,sBAAsB,yDAwBjC,CAAC"}
|
package/dist/backends/codex.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import { createRequire } from "node:module";
|
|
12
12
|
import { CODEX_META_KEYS, META_KEYS } from "@automatalabs/shared-types";
|
|
13
13
|
import { splitArgs } from "../backend.js";
|
|
14
|
-
import { BUILTIN_PROTOCOL_COVERAGE } from "../protocol-coverage.js";
|
|
14
|
+
import { BUILTIN_PROTOCOL_COVERAGE, systemPromptSupport } from "../protocol-coverage.js";
|
|
15
15
|
import { toStrictJsonSchema } from "../schema-strict.js";
|
|
16
16
|
import { parseFinalJson } from "../structured-output.js";
|
|
17
17
|
import { TYPED_SESSION_FAILURE_CLIENT_CAPABILITY } from "../typed-failures.js";
|
|
@@ -75,17 +75,22 @@ export class CodexBackend {
|
|
|
75
75
|
const bin = env.AGENTPRISM_CODEX_ACP_BIN ?? require.resolve("@automatalabs/codex-acp");
|
|
76
76
|
return { command: process.execPath, args: [bin], env };
|
|
77
77
|
}
|
|
78
|
+
/** The fork reads bare `_meta.baseInstructions` (replaces Codex's base system prompt) and
|
|
79
|
+
* `_meta.developerInstructions` (developer-role instructions on top of it) at session/new,
|
|
80
|
+
* resume, and load — the reattach an id-only fork needs, so forks carry them too. */
|
|
81
|
+
systemPrompt = systemPromptSupport("codex");
|
|
78
82
|
sessionMeta(_schema, inputs) {
|
|
79
83
|
// Codex carries the SCHEMA on the turn (see promptMeta), so nothing schema-related rides
|
|
80
|
-
// session/new.
|
|
81
|
-
// @automatalabs/codex-acp fork reads
|
|
82
|
-
// thread/start.{baseInstructions,developerInstructions}. Emit them only when set so
|
|
83
|
-
// unconfigured run sends no `_meta` at all (preserving the "Codex default" path).
|
|
84
|
+
// session/new. The neutral system-prompt instructions ARE session-scoped: the
|
|
85
|
+
// @automatalabs/codex-acp fork reads the bare `_meta` keys and threads them into
|
|
86
|
+
// thread/{start,resume}.{baseInstructions,developerInstructions}. Emit them only when set so
|
|
87
|
+
// an unconfigured run sends no `_meta` at all (preserving the "Codex default" path).
|
|
84
88
|
const meta = {};
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
+
const systemPrompt = inputs?.systemPrompt;
|
|
90
|
+
if (systemPrompt?.replace !== undefined)
|
|
91
|
+
meta[CODEX_META_KEYS.baseInstructions] = systemPrompt.replace;
|
|
92
|
+
if (systemPrompt?.append !== undefined)
|
|
93
|
+
meta[CODEX_META_KEYS.developerInstructions] = systemPrompt.append;
|
|
89
94
|
return Object.keys(meta).length > 0 ? meta : undefined;
|
|
90
95
|
}
|
|
91
96
|
promptMeta(schema) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../src/backends/custom.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../src/backends/custom.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAIxD,qBAAa,gBAAiB,YAAW,OAAO;IAWlC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAVnC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB;mGAC+F;IAC/F,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;oFAEgF;IAChF,QAAQ,CAAC,mBAAmB,QAAQ;IACpC,QAAQ,CAAC,0BAA0B,EAAE,OAAO,CAAC;gBAEhB,MAAM,EAAE,iBAAiB;IAWtD,WAAW,IAAI,WAAW;IAS1B,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;IAQ1D,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;IAM9E,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;IAQ5E,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO;CAKpD"}
|
package/dist/backends/custom.js
CHANGED
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
// - config-level `_meta`: the registry entry's static `sessionMeta` rides every session/new
|
|
12
12
|
// (per-call RunOptions.meta merges over it in the ACP client; backend-computed
|
|
13
13
|
// keys and the runId stamp win over both).
|
|
14
|
-
//
|
|
15
|
-
//
|
|
14
|
+
// The neutral `systemPrompt` instructions are NOT carried (`Backend.systemPrompt` undefined): ACP
|
|
15
|
+
// has no standard system-prompt key, so the validators refuse them for a custom backend up front
|
|
16
|
+
// and a custom agent's own knobs travel through the generic meta channels instead.
|
|
16
17
|
import { createHash } from "node:crypto";
|
|
17
18
|
import { META_KEYS } from "@automatalabs/shared-types";
|
|
18
19
|
import { toJsonSchema } from "../schema-strict.js";
|
|
@@ -12,6 +12,10 @@ export declare class OpenCodeBackend implements Backend {
|
|
|
12
12
|
readonly injectStructuredOutputTool = true;
|
|
13
13
|
classifyProviderError(error: unknown, metadata?: ProviderErrorMetadata): ProviderErrorClassification | undefined;
|
|
14
14
|
spawnConfig(): SpawnConfig;
|
|
15
|
+
/** `opencode acp` reads no session `_meta` (its ACP service consults `_meta` only for
|
|
16
|
+
* terminal-auth at initialize); system prompts live in OpenCode's own config and agent
|
|
17
|
+
* definitions. Declared unsupported so a `systemPrompt` is refused, never dropped. */
|
|
18
|
+
readonly systemPrompt: import("../protocol-coverage.js").SystemPromptSupport;
|
|
15
19
|
sessionMeta(): Record<string, unknown> | undefined;
|
|
16
20
|
promptMeta(schema: TSchema | undefined): Record<string, unknown> | undefined;
|
|
17
21
|
nativeStructured(source: StructuredSource): unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opencode.d.ts","sourceRoot":"","sources":["../../src/backends/opencode.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EACV,OAAO,EACP,2BAA2B,EAC3B,qBAAqB,EACrB,WAAW,EACX,gBAAgB,EACjB,MAAM,eAAe,CAAC;AA+DvB,6FAA6F;AAC7F,eAAO,MAAM,mBAAmB,EAAE,WAIjC,CAAC;AAEF,qBAAa,eAAgB,YAAW,OAAO;IAIjC,QAAQ,CAAC,WAAW,EAAE,WAAW;IAH7C,QAAQ,CAAC,EAAE,EAAG,UAAU,CAAU;IAClC,QAAQ,CAAC,aAAa,EAAG,OAAO,CAAU;gBAErB,WAAW,GAAE,WAAiC;IAEnE,QAAQ,CAAC,mBAAmB,QAAQ;IACpC,QAAQ,CA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IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;IAKlD,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;IAO5E,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO;CAKpD;AAED,eAAO,MAAM,yBAAyB,4DAoBpC,CAAC"}
|
|
@@ -8,7 +8,7 @@ import { dirname, join } from "node:path";
|
|
|
8
8
|
import { createRequire } from "node:module";
|
|
9
9
|
import { META_KEYS } from "@automatalabs/shared-types";
|
|
10
10
|
import { splitArgs } from "../backend.js";
|
|
11
|
-
import { BUILTIN_PROTOCOL_COVERAGE } from "../protocol-coverage.js";
|
|
11
|
+
import { BUILTIN_PROTOCOL_COVERAGE, systemPromptSupport } from "../protocol-coverage.js";
|
|
12
12
|
import { toJsonSchema } from "../schema-strict.js";
|
|
13
13
|
import { parseFinalJson } from "../structured-output.js";
|
|
14
14
|
import { defineBuiltinBackend } from "./define.js";
|
|
@@ -118,6 +118,10 @@ export class OpenCodeBackend {
|
|
|
118
118
|
const bin = resolveOpenCodePackageBin();
|
|
119
119
|
return { command: bin ?? "opencode", args: ["acp"], env };
|
|
120
120
|
}
|
|
121
|
+
/** `opencode acp` reads no session `_meta` (its ACP service consults `_meta` only for
|
|
122
|
+
* terminal-auth at initialize); system prompts live in OpenCode's own config and agent
|
|
123
|
+
* definitions. Declared unsupported so a `systemPrompt` is refused, never dropped. */
|
|
124
|
+
systemPrompt = systemPromptSupport("opencode");
|
|
121
125
|
sessionMeta() {
|
|
122
126
|
// OpenCode ignores session _meta today; there is no protocol-critical session channel.
|
|
123
127
|
return undefined;
|
package/dist/backends/pi.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TSchema } from "typebox";
|
|
2
2
|
import type { AuthProfile } from "../auth/auth-profile.js";
|
|
3
|
-
import type { Backend, ProviderErrorClassification, ProviderErrorMetadata, SpawnConfig } from "../backend.js";
|
|
3
|
+
import type { Backend, ProviderErrorClassification, ProviderErrorMetadata, SessionMetaInputs, SpawnConfig } from "../backend.js";
|
|
4
4
|
/** Pi auth adaptation for its ambient credential store (provider environment keys or ~/.pi/agent/auth.json). */
|
|
5
5
|
export declare const piAuthProfile: AuthProfile;
|
|
6
6
|
export declare class PiBackend implements Backend {
|
|
@@ -9,9 +9,12 @@ export declare class PiBackend implements Backend {
|
|
|
9
9
|
constructor(authProfile?: AuthProfile);
|
|
10
10
|
readonly embedSchemaInPrompt = true;
|
|
11
11
|
readonly injectStructuredOutputTool = true;
|
|
12
|
+
/** pi-acp reads `_meta.systemPrompt` `{ replace?, append? }` on session/new, resume, load, and
|
|
13
|
+
* fork and folds it into pi's `DefaultResourceLoader` system-prompt overrides. */
|
|
14
|
+
readonly systemPrompt: import("../protocol-coverage.js").SystemPromptSupport;
|
|
12
15
|
classifyProviderError(error: unknown, metadata?: ProviderErrorMetadata): ProviderErrorClassification | undefined;
|
|
13
16
|
spawnConfig(): SpawnConfig;
|
|
14
|
-
sessionMeta(): Record<string, unknown> | undefined;
|
|
17
|
+
sessionMeta(_schema: TSchema | undefined, inputs?: SessionMetaInputs): Record<string, unknown> | undefined;
|
|
15
18
|
promptMeta(_schema: TSchema | undefined): Record<string, unknown> | undefined;
|
|
16
19
|
}
|
|
17
20
|
export declare const piBackendDefinition: import("./define.js").BuiltinBackendDefinition<"pi">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../../src/backends/pi.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../../src/backends/pi.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EACV,OAAO,EACP,2BAA2B,EAC3B,qBAAqB,EACrB,iBAAiB,EACjB,WAAW,EACZ,MAAM,eAAe,CAAC;AAcvB,gHAAgH;AAChH,eAAO,MAAM,aAAa,EAAE,WAS3B,CAAC;AAEF,qBAAa,SAAU,YAAW,OAAO;IAG3B,QAAQ,CAAC,WAAW,EAAE,WAAW;IAF7C,QAAQ,CAAC,EAAE,EAAG,IAAI,CAAU;gBAEP,WAAW,GAAE,WAA2B;IAE7D,QAAQ,CAAC,mBAAmB,QAAQ;IACpC,QAAQ,CAAC,0BAA0B,QAAQ;IAC3C;uFACmF;IACnF,QAAQ,CAAC,YAAY,wDAA6B;IAElD,qBAAqB,CACnB,KAAK,EAAE,OAAO,EACd,QAAQ,CAAC,EAAE,qBAAqB,GAC/B,2BAA2B,GAAG,SAAS;IAkB1C,WAAW,IAAI,WAAW;IAkB1B,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;IAY1G,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;CAG9E;AAED,eAAO,MAAM,mBAAmB,sDA0B9B,CAAC"}
|