@a-dray/aglib 0.6.7 → 0.7.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 +2 -1
- package/dist/harness/adapters/claude-agent-sdk/index.d.ts +55 -0
- package/dist/harness/adapters/claude-agent-sdk/index.js +267 -0
- package/dist/harness/adapters/claude-agent-sdk/index.js.map +1 -0
- package/dist/harness/adapters/codex/index.d.ts +80 -0
- package/dist/harness/adapters/codex/index.js +373 -0
- package/dist/harness/adapters/codex/index.js.map +1 -0
- package/dist/harness/adapters/vendor.d.ts +98 -0
- package/dist/harness/adapters/vendor.js +217 -0
- package/dist/harness/adapters/vendor.js.map +1 -0
- package/dist/model/adapters/openai-compatible/index.js +7 -3
- package/dist/model/adapters/openai-compatible/index.js.map +1 -1
- package/dist/model/adapters/openai-responses/index.d.ts +2 -0
- package/dist/model/adapters/openai-responses/index.js +5 -4
- package/dist/model/adapters/openai-responses/index.js.map +1 -1
- package/dist/run.js +62 -13
- package/dist/run.js.map +1 -1
- package/dist/store/adapters/sqlite.js +42 -6
- package/dist/store/adapters/sqlite.js.map +1 -1
- package/dist/store/conformance.d.ts +1 -1
- package/dist/store/conformance.js +19 -0
- package/dist/store/conformance.js.map +1 -1
- package/dist/store/store.d.ts +26 -12
- package/dist/store/store.js.map +1 -1
- package/package.json +16 -3
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ runnable programs that each answer one production question. An export needs a
|
|
|
47
47
|
consumer: a recipe that composes it, or a conformance suite run against an
|
|
48
48
|
implementation here. A surface with neither fails `bun run check`.
|
|
49
49
|
|
|
50
|
-
##
|
|
50
|
+
## Four recipes
|
|
51
51
|
|
|
52
52
|
One per answer to "who does the reasoning". Each is the smallest thing that
|
|
53
53
|
still makes its point, and between them they exercise every seam.
|
|
@@ -57,6 +57,7 @@ still makes its point, and between them they exercise every seam.
|
|
|
57
57
|
| [`native-agent`](recipes/native-agent/README.md) | ours | The whole surface in one program — memory, skills, subagents, a sandbox you choose — and the one thing only our own loop offers: a message reaching a busy session mid-turn. |
|
|
58
58
|
| [`vendored-agent`](recipes/vendored-agent/README.md) | a vendor's, from its library | What a vendor library must expose for the log to stay the state. Pi's tools are values you re-point at your sandbox and its transcript is a field you assign, so an interrupted run continues — `recovery: "history"`. Its README says what the tiers below that get you. |
|
|
59
59
|
| [`coding-agent`](recipes/coding-agent/README.md) | a vendor's, over a protocol | The cheapest containment on offer: any ACP agent started *inside* your sandbox, its work arriving as your entries, for one row of argv. |
|
|
60
|
+
| [`subscription-agent`](recipes/subscription-agent/README.md) | a vendor's program, with only our tools | A Claude or ChatGPT plan spent by your own agent: Claude Code or Codex runs the loop with its built-ins off, and our instructions, tools, sandbox and log are everything else. |
|
|
60
61
|
|
|
61
62
|
## Where to read next
|
|
62
63
|
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { query as sdkQuery } from "@anthropic-ai/claude-agent-sdk";
|
|
2
|
+
import type { Harness } from "../../harness.js";
|
|
3
|
+
export interface ClaudeAgentSdkHarnessOptions {
|
|
4
|
+
/** Claude Code's model id or alias. */
|
|
5
|
+
model: string;
|
|
6
|
+
effort?: "low" | "medium" | "high" | "xhigh" | "max";
|
|
7
|
+
/**
|
|
8
|
+
* The Claude Code process's whole environment. It replaces the server's
|
|
9
|
+
* rather than adding to it, so a secret the server holds for something else
|
|
10
|
+
* never reaches the agent process. Put the credential here —
|
|
11
|
+
* `CLAUDE_CODE_OAUTH_TOKEN` from `claude setup-token` for a subscription, or
|
|
12
|
+
* `ANTHROPIC_API_KEY` — with `PATH`, `HOME` and `CLAUDE_CONFIG_DIR`, which is
|
|
13
|
+
* where the process keeps the sessions a later activation resumes.
|
|
14
|
+
*/
|
|
15
|
+
env: Readonly<Record<string, string>>;
|
|
16
|
+
/** The process's working directory. It runs no tools of its own, so this only needs to exist. */
|
|
17
|
+
cwd: string;
|
|
18
|
+
/** The `claude` binary, when the SDK's bundled one is not the one to run. */
|
|
19
|
+
executable?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Let the model use the connectors on the signed-in Claude account — Slack,
|
|
22
|
+
* Notion, whatever the account has connected — beside our tools. Off, they
|
|
23
|
+
* are not even fetched. On, a connector call runs in Anthropic's cloud, not
|
|
24
|
+
* through our executor, and is recorded as a note; nothing else of Claude
|
|
25
|
+
* Code's is allowed either way.
|
|
26
|
+
*/
|
|
27
|
+
connectors?: boolean;
|
|
28
|
+
/** Injectable for tests; the default is the SDK's own. */
|
|
29
|
+
query?: typeof sdkQuery;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Anthropic's agent loop, running our tools and nothing of its own.
|
|
33
|
+
*
|
|
34
|
+
* The Claude Agent SDK starts the unmodified Claude Code binary, so the
|
|
35
|
+
* credential is whatever that binary accepts: an API key, or the token a
|
|
36
|
+
* subscriber gets from `claude setup-token`. That second one is the reason this
|
|
37
|
+
* adapter exists. A Claude subscription is sold for Claude Code, and the only
|
|
38
|
+
* way to spend one from an agent of your own is to let Claude Code run the loop.
|
|
39
|
+
* See `recipes/subscription-agent` for what that costs.
|
|
40
|
+
*
|
|
41
|
+
* What it keeps: our instructions as the whole system prompt, our tools as the
|
|
42
|
+
* whole tool list (served in-process over MCP, so the model sees them as
|
|
43
|
+
* `mcp__tools__<name>`), every call through our executor and into our log. Its
|
|
44
|
+
* built-in tools are switched off, not merely refused, so nothing runs on the
|
|
45
|
+
* host this process runs on.
|
|
46
|
+
*
|
|
47
|
+
* What it gives up: the context is Claude Code's. It compacts on its own
|
|
48
|
+
* schedule, and an activation interrupted mid-turn is over (`recovery: "none"`);
|
|
49
|
+
* the next one resumes the vendor's session where the log says it was, or, if
|
|
50
|
+
* another model has spoken since, starts a new one from a transcript. Usage is
|
|
51
|
+
* the turn's token counts on its final entry. The SDK also states a cost, which
|
|
52
|
+
* it computes from API list prices whatever the credential is; for a
|
|
53
|
+
* subscription that is not money anyone spent, so it is not recorded.
|
|
54
|
+
*/
|
|
55
|
+
export declare function createClaudeAgentSdkHarness(options: ClaudeAgentSdkHarnessOptions): Harness;
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { createSdkMcpServer, query as sdkQuery } from "@anthropic-ai/claude-agent-sdk";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { textOf } from "../../../content.js";
|
|
4
|
+
import { addUsage, arrivals, createToolRunner, opening, openingInputs, sessionState } from "../vendor.js";
|
|
5
|
+
const provider = "claude-agent-sdk";
|
|
6
|
+
const server = "tools";
|
|
7
|
+
/**
|
|
8
|
+
* Anthropic's agent loop, running our tools and nothing of its own.
|
|
9
|
+
*
|
|
10
|
+
* The Claude Agent SDK starts the unmodified Claude Code binary, so the
|
|
11
|
+
* credential is whatever that binary accepts: an API key, or the token a
|
|
12
|
+
* subscriber gets from `claude setup-token`. That second one is the reason this
|
|
13
|
+
* adapter exists. A Claude subscription is sold for Claude Code, and the only
|
|
14
|
+
* way to spend one from an agent of your own is to let Claude Code run the loop.
|
|
15
|
+
* See `recipes/subscription-agent` for what that costs.
|
|
16
|
+
*
|
|
17
|
+
* What it keeps: our instructions as the whole system prompt, our tools as the
|
|
18
|
+
* whole tool list (served in-process over MCP, so the model sees them as
|
|
19
|
+
* `mcp__tools__<name>`), every call through our executor and into our log. Its
|
|
20
|
+
* built-in tools are switched off, not merely refused, so nothing runs on the
|
|
21
|
+
* host this process runs on.
|
|
22
|
+
*
|
|
23
|
+
* What it gives up: the context is Claude Code's. It compacts on its own
|
|
24
|
+
* schedule, and an activation interrupted mid-turn is over (`recovery: "none"`);
|
|
25
|
+
* the next one resumes the vendor's session where the log says it was, or, if
|
|
26
|
+
* another model has spoken since, starts a new one from a transcript. Usage is
|
|
27
|
+
* the turn's token counts on its final entry. The SDK also states a cost, which
|
|
28
|
+
* it computes from API list prices whatever the credential is; for a
|
|
29
|
+
* subscription that is not money anyone spent, so it is not recorded.
|
|
30
|
+
*/
|
|
31
|
+
export function createClaudeAgentSdkHarness(options) {
|
|
32
|
+
return {
|
|
33
|
+
id: `${provider}:${options.model}`,
|
|
34
|
+
recovery: "none",
|
|
35
|
+
async run(context) {
|
|
36
|
+
const first = await runTurn(options, context, opening(context, provider));
|
|
37
|
+
// A session the log names but the process no longer has — a new machine, a
|
|
38
|
+
// cleared config directory — is a fresh start from the transcript, once.
|
|
39
|
+
if (first.status === "failed" && first.error.code === "session-missing") {
|
|
40
|
+
return runTurn(options, context, opening(context, provider, { fresh: true }));
|
|
41
|
+
}
|
|
42
|
+
return first;
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
async function runTurn(options, context, start) {
|
|
47
|
+
const runner = createToolRunner(context);
|
|
48
|
+
const shown = openingInputs(context);
|
|
49
|
+
const startedAt = new Date().toISOString();
|
|
50
|
+
const inputs = createInputs();
|
|
51
|
+
const waiting = new Map();
|
|
52
|
+
const connectorCalls = new Map();
|
|
53
|
+
const outstanding = new Set();
|
|
54
|
+
let session = start.resume ?? "";
|
|
55
|
+
let served;
|
|
56
|
+
const send = (content) => {
|
|
57
|
+
const uuid = crypto.randomUUID();
|
|
58
|
+
outstanding.add(uuid);
|
|
59
|
+
inputs.push({ type: "user", uuid, parent_tool_use_id: null, message: { role: "user", content: encodeContent(content) } });
|
|
60
|
+
};
|
|
61
|
+
const tools = (context.tools?.list() ?? []).map((spec) => ({
|
|
62
|
+
name: spec.name,
|
|
63
|
+
description: spec.description,
|
|
64
|
+
inputSchema: z.fromJSONSchema(spec.parameters).shape,
|
|
65
|
+
handler: async (args) => {
|
|
66
|
+
const callId = waiting.get(spec.name)?.shift() ?? `call_${crypto.randomUUID()}`;
|
|
67
|
+
const result = await runner.run({ callId, name: spec.name, arguments: JSON.stringify(args ?? {}) });
|
|
68
|
+
// The boundary the native loop drains at: a batch's results are in, and
|
|
69
|
+
// nothing is half-done. What arrived is queued behind this call's result.
|
|
70
|
+
if (await context.drain?.())
|
|
71
|
+
for (const input of arrivals(context, shown))
|
|
72
|
+
send(input);
|
|
73
|
+
return encodeResult(result);
|
|
74
|
+
},
|
|
75
|
+
}));
|
|
76
|
+
const abort = new AbortController();
|
|
77
|
+
const cancel = () => abort.abort();
|
|
78
|
+
context.signal.addEventListener("abort", cancel, { once: true });
|
|
79
|
+
send(start.prompt);
|
|
80
|
+
const query = options.query ?? sdkQuery;
|
|
81
|
+
let usage;
|
|
82
|
+
// What the process said on its way out: an exit code alone names no reason.
|
|
83
|
+
let stderr = "";
|
|
84
|
+
const said = (message) => stderr.trim() ? `${message}: ${stderr.trim().slice(-1_000)}` : message;
|
|
85
|
+
try {
|
|
86
|
+
const messages = query({
|
|
87
|
+
prompt: inputs,
|
|
88
|
+
options: {
|
|
89
|
+
model: options.model,
|
|
90
|
+
...(options.effort ? { effort: options.effort } : {}),
|
|
91
|
+
systemPrompt: [textOf(context.instructions), ...(context.context?.run ? [context.context.run] : [])],
|
|
92
|
+
tools: [],
|
|
93
|
+
mcpServers: { [server]: createSdkMcpServer({ name: server, version: "1", alwaysLoad: true, tools }) },
|
|
94
|
+
allowedTools: tools.map((tool) => `mcp__${server}__${tool.name}`),
|
|
95
|
+
...(options.connectors
|
|
96
|
+
? {
|
|
97
|
+
// Asked per call, so a connector — and only a connector — is allowed.
|
|
98
|
+
permissionMode: "default",
|
|
99
|
+
canUseTool: async (name, _input, about) => about.mcpServer?.source === "claudeai" || name.startsWith(`mcp__${server}__`)
|
|
100
|
+
? { behavior: "allow" }
|
|
101
|
+
: { behavior: "deny", message: `${name} is not available here.` },
|
|
102
|
+
}
|
|
103
|
+
: { permissionMode: "dontAsk", settings: { disableClaudeAiConnectors: true } }),
|
|
104
|
+
settingSources: [],
|
|
105
|
+
includePartialMessages: true,
|
|
106
|
+
persistSession: true,
|
|
107
|
+
cwd: options.cwd,
|
|
108
|
+
env: { ...options.env },
|
|
109
|
+
abortController: abort,
|
|
110
|
+
stderr: (data) => { stderr = `${stderr}${data}`.slice(-2_000); },
|
|
111
|
+
...(options.executable ? { pathToClaudeCodeExecutable: options.executable } : {}),
|
|
112
|
+
...(start.resume ? { resume: start.resume } : {}),
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
for await (const message of messages) {
|
|
116
|
+
if (message.session_id)
|
|
117
|
+
session = message.session_id;
|
|
118
|
+
if (message.type === "stream_event") {
|
|
119
|
+
emitDelta(context, message.event);
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
if (message.type === "assistant" && message.parent_tool_use_id === null) {
|
|
123
|
+
served = message.message.model;
|
|
124
|
+
for (const block of message.message.content) {
|
|
125
|
+
if (block.type === "text")
|
|
126
|
+
runner.say(block.text);
|
|
127
|
+
if (block.type === "tool_use" && block.name.startsWith(`mcp__${server}__`)) {
|
|
128
|
+
const name = block.name.slice(`mcp__${server}__`.length);
|
|
129
|
+
waiting.set(name, [...(waiting.get(name) ?? []), block.id]);
|
|
130
|
+
}
|
|
131
|
+
else if (block.type === "tool_use")
|
|
132
|
+
connectorCalls.set(block.id, { name: block.name, input: block.input });
|
|
133
|
+
}
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
// A connector's result comes back as the vendor's own tool result; ours were committed as they ran.
|
|
137
|
+
if (message.type === "user" && message.parent_tool_use_id === null && Array.isArray(message.message.content)) {
|
|
138
|
+
for (const block of message.message.content) {
|
|
139
|
+
const call = block.type === "tool_result" && block.tool_use_id ? connectorCalls.get(block.tool_use_id) : undefined;
|
|
140
|
+
if (!call)
|
|
141
|
+
continue;
|
|
142
|
+
connectorCalls.delete(block.tool_use_id);
|
|
143
|
+
await runner.note({ name: call.name, arguments: call.input, result: resultText(block.content), ...(block.is_error ? { isError: true } : {}) });
|
|
144
|
+
}
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
if (message.type !== "result")
|
|
148
|
+
continue;
|
|
149
|
+
usage = addUsage(usage, decodeUsage(message.usage));
|
|
150
|
+
for (const uuid of [message.user_message_uuid, ...(message.user_message_uuids ?? [])])
|
|
151
|
+
if (uuid)
|
|
152
|
+
outstanding.delete(uuid);
|
|
153
|
+
// A refused request — a bad token, a spent plan — is a "success" that says it is an error.
|
|
154
|
+
if (message.subtype !== "success" || message.is_error) {
|
|
155
|
+
inputs.close();
|
|
156
|
+
const said = message.subtype === "success" ? message.result || "Claude Code reported an error." : message.errors.join("; ") || message.subtype;
|
|
157
|
+
if (start.resume && /no conversation found/i.test(said)) {
|
|
158
|
+
return { status: "failed", error: { code: "session-missing", message: said, retryable: true } };
|
|
159
|
+
}
|
|
160
|
+
return { status: "failed", error: { code: "provider", message: `Claude Code stopped: ${said}`, retryable: false } };
|
|
161
|
+
}
|
|
162
|
+
// A message we queued mid-turn may have been answered in this turn or be
|
|
163
|
+
// the next one's; the turn is over when every one has been consumed.
|
|
164
|
+
if (!outstanding.size)
|
|
165
|
+
inputs.close();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
inputs.close();
|
|
170
|
+
if (context.signal.aborted)
|
|
171
|
+
return { status: "cancelled" };
|
|
172
|
+
const message = said(error instanceof Error ? error.message : String(error));
|
|
173
|
+
if (start.resume && /no conversation found/i.test(message)) {
|
|
174
|
+
return { status: "failed", error: { code: "session-missing", message, retryable: true } };
|
|
175
|
+
}
|
|
176
|
+
return { status: "failed", error: { code: "provider", message, retryable: false } };
|
|
177
|
+
}
|
|
178
|
+
finally {
|
|
179
|
+
context.signal.removeEventListener("abort", cancel);
|
|
180
|
+
}
|
|
181
|
+
if (context.signal.aborted)
|
|
182
|
+
return { status: "cancelled" };
|
|
183
|
+
if (usage)
|
|
184
|
+
runner.spent(usage);
|
|
185
|
+
const output = await runner.finish(sessionState(provider, session), {
|
|
186
|
+
id: crypto.randomUUID(), startedAt, ...(served ? { model: served } : {}),
|
|
187
|
+
});
|
|
188
|
+
return { status: "completed", output };
|
|
189
|
+
}
|
|
190
|
+
function resultText(content) {
|
|
191
|
+
if (typeof content === "string")
|
|
192
|
+
return content;
|
|
193
|
+
if (!Array.isArray(content))
|
|
194
|
+
return "";
|
|
195
|
+
return content.map((part) => part.type === "text" ? part.text ?? "" : `[${part.type ?? "part"}]`).join("\n");
|
|
196
|
+
}
|
|
197
|
+
function emitDelta(context, event) {
|
|
198
|
+
const delta = event.delta;
|
|
199
|
+
if (event.type !== "content_block_delta" || !delta)
|
|
200
|
+
return;
|
|
201
|
+
if (delta.type === "text_delta" && delta.text)
|
|
202
|
+
context.emit({ type: "text.delta", text: delta.text, runId: context.runId });
|
|
203
|
+
if (delta.type === "thinking_delta" && delta.thinking)
|
|
204
|
+
context.emit({ type: "reasoning.delta", text: delta.thinking, runId: context.runId });
|
|
205
|
+
}
|
|
206
|
+
/** An input stream the process reads from for as long as the turn lasts. */
|
|
207
|
+
function createInputs() {
|
|
208
|
+
const queue = [];
|
|
209
|
+
let wake;
|
|
210
|
+
let closed = false;
|
|
211
|
+
return {
|
|
212
|
+
push(message) { queue.push(message); wake?.(); },
|
|
213
|
+
close() { closed = true; wake?.(); },
|
|
214
|
+
async *[Symbol.asyncIterator]() {
|
|
215
|
+
while (true) {
|
|
216
|
+
while (queue.length)
|
|
217
|
+
yield queue.shift();
|
|
218
|
+
if (closed)
|
|
219
|
+
return;
|
|
220
|
+
await new Promise((resolve) => { wake = resolve; });
|
|
221
|
+
wake = undefined;
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
function encodeContent(content) {
|
|
227
|
+
if (typeof content === "string")
|
|
228
|
+
return content;
|
|
229
|
+
return content.flatMap((part) => {
|
|
230
|
+
if (part.type === "text")
|
|
231
|
+
return [{ type: "text", text: part.text }];
|
|
232
|
+
if (part.type === "image")
|
|
233
|
+
return [{ type: "image", source: part.source.kind === "inline" ? { type: "base64", media_type: part.mediaType, data: part.source.data } : { type: "url", url: part.source.url } }];
|
|
234
|
+
if (part.type === "file" && part.mediaType === "application/pdf")
|
|
235
|
+
return [{ type: "document", source: part.source.kind === "inline" ? { type: "base64", media_type: part.mediaType, data: part.source.data } : { type: "url", url: part.source.url }, ...(part.name ? { title: part.name } : {}) }];
|
|
236
|
+
if (part.type === "file")
|
|
237
|
+
return [{ type: "text", text: `[file ${part.name ?? ""} ${part.mediaType}]` }];
|
|
238
|
+
return [];
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
function encodeResult(result) {
|
|
242
|
+
const content = typeof result.content === "string"
|
|
243
|
+
? [{ type: "text", text: result.content }]
|
|
244
|
+
: result.content.flatMap((part) => {
|
|
245
|
+
if (part.type === "text")
|
|
246
|
+
return [{ type: "text", text: part.text }];
|
|
247
|
+
if (part.type === "image" && part.source.kind === "inline")
|
|
248
|
+
return [{ type: "image", data: part.source.data, mimeType: part.mediaType }];
|
|
249
|
+
if (part.type === "image" || part.type === "file")
|
|
250
|
+
return [{ type: "text", text: `[${part.type} ${part.mediaType}]` }];
|
|
251
|
+
return [];
|
|
252
|
+
});
|
|
253
|
+
return { content: content.length ? content : [{ type: "text", text: "" }], ...(result.isError ? { isError: true } : {}) };
|
|
254
|
+
}
|
|
255
|
+
function decodeUsage(raw) {
|
|
256
|
+
const usage = {};
|
|
257
|
+
if (typeof raw?.input_tokens === "number")
|
|
258
|
+
usage.inputTokens = raw.input_tokens;
|
|
259
|
+
if (typeof raw?.output_tokens === "number")
|
|
260
|
+
usage.outputTokens = raw.output_tokens;
|
|
261
|
+
if (typeof raw?.cache_read_input_tokens === "number")
|
|
262
|
+
usage.cacheReadTokens = raw.cache_read_input_tokens;
|
|
263
|
+
if (typeof raw?.cache_creation_input_tokens === "number")
|
|
264
|
+
usage.cacheWriteTokens = raw.cache_creation_input_tokens;
|
|
265
|
+
return usage;
|
|
266
|
+
}
|
|
267
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/harness/adapters/claude-agent-sdk/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,IAAI,QAAQ,EAAwC,MAAM,gCAAgC,CAAC;AAC7H,OAAO,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,GAAG,EAAE,2BAA2B,KAAK,QAAQ;QAAE,KAAK,CAAC,gBAAgB,GAAG,GAAG,CAAC,2BAA2B,CAAC;IACnH,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { createSdkMcpServer, query as sdkQuery, type SDKMessage, type SDKUserMessage } from \"@anthropic-ai/claude-agent-sdk\";\nimport { z } from \"zod\";\nimport type { Harness, HarnessContext, HarnessResult } from \"../../harness.js\";\nimport type { Content } from \"../../../content.js\";\nimport { textOf } from \"../../../content.js\";\nimport type { ToolResult, Usage } from \"../../../session/entry.js\";\nimport { addUsage, arrivals, createToolRunner, opening, openingInputs, sessionState } from \"../vendor.js\";\n\nexport interface ClaudeAgentSdkHarnessOptions {\n /** Claude Code's model id or alias. */\n model: string;\n effort?: \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n /**\n * The Claude Code process's whole environment. It replaces the server's\n * rather than adding to it, so a secret the server holds for something else\n * never reaches the agent process. Put the credential here —\n * `CLAUDE_CODE_OAUTH_TOKEN` from `claude setup-token` for a subscription, or\n * `ANTHROPIC_API_KEY` — with `PATH`, `HOME` and `CLAUDE_CONFIG_DIR`, which is\n * where the process keeps the sessions a later activation resumes.\n */\n env: Readonly<Record<string, string>>;\n /** The process's working directory. It runs no tools of its own, so this only needs to exist. */\n cwd: string;\n /** The `claude` binary, when the SDK's bundled one is not the one to run. */\n executable?: string;\n /**\n * Let the model use the connectors on the signed-in Claude account — Slack,\n * Notion, whatever the account has connected — beside our tools. Off, they\n * are not even fetched. On, a connector call runs in Anthropic's cloud, not\n * through our executor, and is recorded as a note; nothing else of Claude\n * Code's is allowed either way.\n */\n connectors?: boolean;\n /** Injectable for tests; the default is the SDK's own. */\n query?: typeof sdkQuery;\n}\n\nconst provider = \"claude-agent-sdk\";\nconst server = \"tools\";\n\n/**\n * Anthropic's agent loop, running our tools and nothing of its own.\n *\n * The Claude Agent SDK starts the unmodified Claude Code binary, so the\n * credential is whatever that binary accepts: an API key, or the token a\n * subscriber gets from `claude setup-token`. That second one is the reason this\n * adapter exists. A Claude subscription is sold for Claude Code, and the only\n * way to spend one from an agent of your own is to let Claude Code run the loop.\n * See `recipes/subscription-agent` for what that costs.\n *\n * What it keeps: our instructions as the whole system prompt, our tools as the\n * whole tool list (served in-process over MCP, so the model sees them as\n * `mcp__tools__<name>`), every call through our executor and into our log. Its\n * built-in tools are switched off, not merely refused, so nothing runs on the\n * host this process runs on.\n *\n * What it gives up: the context is Claude Code's. It compacts on its own\n * schedule, and an activation interrupted mid-turn is over (`recovery: \"none\"`);\n * the next one resumes the vendor's session where the log says it was, or, if\n * another model has spoken since, starts a new one from a transcript. Usage is\n * the turn's token counts on its final entry. The SDK also states a cost, which\n * it computes from API list prices whatever the credential is; for a\n * subscription that is not money anyone spent, so it is not recorded.\n */\nexport function createClaudeAgentSdkHarness(options: ClaudeAgentSdkHarnessOptions): Harness {\n return {\n id: `${provider}:${options.model}`,\n recovery: \"none\",\n async run(context) {\n const first = await runTurn(options, context, opening(context, provider));\n // A session the log names but the process no longer has — a new machine, a\n // cleared config directory — is a fresh start from the transcript, once.\n if (first.status === \"failed\" && first.error.code === \"session-missing\") {\n return runTurn(options, context, opening(context, provider, { fresh: true }));\n }\n return first;\n },\n };\n}\n\nasync function runTurn(options: ClaudeAgentSdkHarnessOptions, context: HarnessContext, start: { resume?: string; prompt: Content }): Promise<HarnessResult> {\n const runner = createToolRunner(context);\n const shown = openingInputs(context);\n const startedAt = new Date().toISOString();\n const inputs = createInputs();\n const waiting = new Map<string, string[]>();\n const connectorCalls = new Map<string, { name: string; input: unknown }>();\n const outstanding = new Set<string>();\n let session = start.resume ?? \"\";\n let served: string | undefined;\n\n const send = (content: Content) => {\n const uuid = crypto.randomUUID();\n outstanding.add(uuid);\n inputs.push({ type: \"user\", uuid, parent_tool_use_id: null, message: { role: \"user\", content: encodeContent(content) } } as SDKUserMessage);\n };\n\n const tools = (context.tools?.list() ?? []).map((spec) => ({\n name: spec.name,\n description: spec.description,\n inputSchema: (z.fromJSONSchema(spec.parameters as never) as z.ZodObject).shape,\n handler: async (args: unknown) => {\n const callId = waiting.get(spec.name)?.shift() ?? `call_${crypto.randomUUID()}`;\n const result = await runner.run({ callId, name: spec.name, arguments: JSON.stringify(args ?? {}) });\n // The boundary the native loop drains at: a batch's results are in, and\n // nothing is half-done. What arrived is queued behind this call's result.\n if (await context.drain?.()) for (const input of arrivals(context, shown)) send(input);\n return encodeResult(result);\n },\n }));\n\n const abort = new AbortController();\n const cancel = () => abort.abort();\n context.signal.addEventListener(\"abort\", cancel, { once: true });\n send(start.prompt);\n\n const query = options.query ?? sdkQuery;\n let usage: Usage | undefined;\n // What the process said on its way out: an exit code alone names no reason.\n let stderr = \"\";\n const said = (message: string) => stderr.trim() ? `${message}: ${stderr.trim().slice(-1_000)}` : message;\n try {\n const messages = query({\n prompt: inputs,\n options: {\n model: options.model,\n ...(options.effort ? { effort: options.effort } : {}),\n systemPrompt: [textOf(context.instructions), ...(context.context?.run ? [context.context.run] : [])],\n tools: [],\n mcpServers: { [server]: createSdkMcpServer({ name: server, version: \"1\", alwaysLoad: true, tools }) },\n allowedTools: tools.map((tool) => `mcp__${server}__${tool.name}`),\n ...(options.connectors\n ? {\n // Asked per call, so a connector — and only a connector — is allowed.\n permissionMode: \"default\" as const,\n canUseTool: async (name: string, _input: Record<string, unknown>, about: { mcpServer?: { name: string; source: string } }) =>\n about.mcpServer?.source === \"claudeai\" || name.startsWith(`mcp__${server}__`)\n ? { behavior: \"allow\" as const }\n : { behavior: \"deny\" as const, message: `${name} is not available here.` },\n }\n : { permissionMode: \"dontAsk\" as const, settings: { disableClaudeAiConnectors: true } }),\n settingSources: [],\n includePartialMessages: true,\n persistSession: true,\n cwd: options.cwd,\n env: { ...options.env },\n abortController: abort,\n stderr: (data: string) => { stderr = `${stderr}${data}`.slice(-2_000); },\n ...(options.executable ? { pathToClaudeCodeExecutable: options.executable } : {}),\n ...(start.resume ? { resume: start.resume } : {}),\n },\n });\n for await (const message of messages as AsyncIterable<SDKMessage>) {\n if (message.session_id) session = message.session_id;\n if (message.type === \"stream_event\") { emitDelta(context, message.event); continue; }\n if (message.type === \"assistant\" && message.parent_tool_use_id === null) {\n served = message.message.model;\n for (const block of message.message.content) {\n if (block.type === \"text\") runner.say(block.text);\n if (block.type === \"tool_use\" && block.name.startsWith(`mcp__${server}__`)) {\n const name = block.name.slice(`mcp__${server}__`.length);\n waiting.set(name, [...(waiting.get(name) ?? []), block.id]);\n } else if (block.type === \"tool_use\") connectorCalls.set(block.id, { name: block.name, input: block.input });\n }\n continue;\n }\n // A connector's result comes back as the vendor's own tool result; ours were committed as they ran.\n if (message.type === \"user\" && message.parent_tool_use_id === null && Array.isArray(message.message.content)) {\n for (const block of message.message.content as { type?: string; tool_use_id?: string; content?: unknown; is_error?: boolean }[]) {\n const call = block.type === \"tool_result\" && block.tool_use_id ? connectorCalls.get(block.tool_use_id) : undefined;\n if (!call) continue;\n connectorCalls.delete(block.tool_use_id!);\n await runner.note({ name: call.name, arguments: call.input, result: resultText(block.content), ...(block.is_error ? { isError: true } : {}) });\n }\n continue;\n }\n if (message.type !== \"result\") continue;\n usage = addUsage(usage, decodeUsage(message.usage));\n for (const uuid of [message.user_message_uuid, ...(message.user_message_uuids ?? [])]) if (uuid) outstanding.delete(uuid);\n // A refused request — a bad token, a spent plan — is a \"success\" that says it is an error.\n if (message.subtype !== \"success\" || message.is_error) {\n inputs.close();\n const said = message.subtype === \"success\" ? message.result || \"Claude Code reported an error.\" : message.errors.join(\"; \") || message.subtype;\n if (start.resume && /no conversation found/i.test(said)) {\n return { status: \"failed\", error: { code: \"session-missing\", message: said, retryable: true } };\n }\n return { status: \"failed\", error: { code: \"provider\", message: `Claude Code stopped: ${said}`, retryable: false } };\n }\n // A message we queued mid-turn may have been answered in this turn or be\n // the next one's; the turn is over when every one has been consumed.\n if (!outstanding.size) inputs.close();\n }\n } catch (error) {\n inputs.close();\n if (context.signal.aborted) return { status: \"cancelled\" };\n const message = said(error instanceof Error ? error.message : String(error));\n if (start.resume && /no conversation found/i.test(message)) {\n return { status: \"failed\", error: { code: \"session-missing\", message, retryable: true } };\n }\n return { status: \"failed\", error: { code: \"provider\", message, retryable: false } };\n } finally {\n context.signal.removeEventListener(\"abort\", cancel);\n }\n if (context.signal.aborted) return { status: \"cancelled\" };\n if (usage) runner.spent(usage);\n const output = await runner.finish(sessionState(provider, session), {\n id: crypto.randomUUID(), startedAt, ...(served ? { model: served } : {}),\n });\n return { status: \"completed\", output };\n}\n\nfunction resultText(content: unknown): string {\n if (typeof content === \"string\") return content;\n if (!Array.isArray(content)) return \"\";\n return content.map((part: { type?: string; text?: string }) => part.type === \"text\" ? part.text ?? \"\" : `[${part.type ?? \"part\"}]`).join(\"\\n\");\n}\n\nfunction emitDelta(context: HarnessContext, event: unknown): void {\n const delta = (event as { type?: string; delta?: { type?: string; text?: string; thinking?: string } }).delta;\n if ((event as { type?: string }).type !== \"content_block_delta\" || !delta) return;\n if (delta.type === \"text_delta\" && delta.text) context.emit({ type: \"text.delta\", text: delta.text, runId: context.runId });\n if (delta.type === \"thinking_delta\" && delta.thinking) context.emit({ type: \"reasoning.delta\", text: delta.thinking, runId: context.runId });\n}\n\n/** An input stream the process reads from for as long as the turn lasts. */\nfunction createInputs() {\n const queue: SDKUserMessage[] = [];\n let wake: (() => void) | undefined;\n let closed = false;\n return {\n push(message: SDKUserMessage) { queue.push(message); wake?.(); },\n close() { closed = true; wake?.(); },\n async *[Symbol.asyncIterator](): AsyncGenerator<SDKUserMessage> {\n while (true) {\n while (queue.length) yield queue.shift()!;\n if (closed) return;\n await new Promise<void>((resolve) => { wake = resolve; });\n wake = undefined;\n }\n },\n };\n}\n\ntype Block = { type: \"text\"; text: string } | { type: \"image\"; source: { type: \"base64\"; media_type: string; data: string } | { type: \"url\"; url: string } }\n | { type: \"document\"; source: { type: \"base64\"; media_type: string; data: string } | { type: \"url\"; url: string }; title?: string };\n\nfunction encodeContent(content: Content): string | Block[] {\n if (typeof content === \"string\") return content;\n return content.flatMap((part): Block[] => {\n if (part.type === \"text\") return [{ type: \"text\", text: part.text }];\n if (part.type === \"image\") return [{ type: \"image\", source: part.source.kind === \"inline\" ? { type: \"base64\", media_type: part.mediaType, data: part.source.data } : { type: \"url\", url: part.source.url } }];\n if (part.type === \"file\" && part.mediaType === \"application/pdf\") return [{ type: \"document\", source: part.source.kind === \"inline\" ? { type: \"base64\", media_type: part.mediaType, data: part.source.data } : { type: \"url\", url: part.source.url }, ...(part.name ? { title: part.name } : {}) }];\n if (part.type === \"file\") return [{ type: \"text\", text: `[file ${part.name ?? \"\"} ${part.mediaType}]` }];\n return [];\n });\n}\n\ntype ResultBlock = { type: \"text\"; text: string } | { type: \"image\"; data: string; mimeType: string };\n\nfunction encodeResult(result: ToolResult): { content: ResultBlock[]; isError?: boolean } {\n const content: ResultBlock[] = typeof result.content === \"string\"\n ? [{ type: \"text\", text: result.content }]\n : result.content.flatMap((part): ResultBlock[] => {\n if (part.type === \"text\") return [{ type: \"text\", text: part.text }];\n if (part.type === \"image\" && part.source.kind === \"inline\") return [{ type: \"image\", data: part.source.data, mimeType: part.mediaType }];\n if (part.type === \"image\" || part.type === \"file\") return [{ type: \"text\", text: `[${part.type} ${part.mediaType}]` }];\n return [];\n });\n return { content: content.length ? content : [{ type: \"text\", text: \"\" }], ...(result.isError ? { isError: true } : {}) };\n}\n\nfunction decodeUsage(raw: { input_tokens?: number | null; output_tokens?: number | null; cache_read_input_tokens?: number | null; cache_creation_input_tokens?: number | null } | undefined): Usage {\n const usage: Usage = {};\n if (typeof raw?.input_tokens === \"number\") usage.inputTokens = raw.input_tokens;\n if (typeof raw?.output_tokens === \"number\") usage.outputTokens = raw.output_tokens;\n if (typeof raw?.cache_read_input_tokens === \"number\") usage.cacheReadTokens = raw.cache_read_input_tokens;\n if (typeof raw?.cache_creation_input_tokens === \"number\") usage.cacheWriteTokens = raw.cache_creation_input_tokens;\n return usage;\n}\n"]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { Harness } from "../../harness.js";
|
|
2
|
+
import { type Failure, type Result } from "../../../result.js";
|
|
3
|
+
import type { JsonValue } from "../../../json.js";
|
|
4
|
+
/** How to start Codex's app server: argv and its whole environment. */
|
|
5
|
+
export interface CodexProcess {
|
|
6
|
+
/** Defaults to `["codex", "app-server"]`. */
|
|
7
|
+
command?: readonly string[];
|
|
8
|
+
/**
|
|
9
|
+
* The process's whole environment, which replaces the server's. `CODEX_HOME`
|
|
10
|
+
* is where Codex keeps its sign-in and the threads a later activation
|
|
11
|
+
* resumes; `PATH` and `HOME` it needs as any program does.
|
|
12
|
+
*/
|
|
13
|
+
env: Readonly<Record<string, string>>;
|
|
14
|
+
/** Further `-c key=value` overrides, the value in TOML. */
|
|
15
|
+
config?: Readonly<Record<string, string>>;
|
|
16
|
+
/**
|
|
17
|
+
* Leave Codex's apps on: the connectors on the signed-in ChatGPT account,
|
|
18
|
+
* beside our tools. A connector call runs in OpenAI's cloud, not through our
|
|
19
|
+
* executor, and is recorded as a note. Every other tool of Codex's own stays
|
|
20
|
+
* off, and still fails the turn if one appears.
|
|
21
|
+
*/
|
|
22
|
+
connectors?: boolean;
|
|
23
|
+
/** Injectable for tests; the default spawns `command`. */
|
|
24
|
+
connect?: (argv: readonly string[], env: Readonly<Record<string, string>>) => CodexConnection;
|
|
25
|
+
}
|
|
26
|
+
export interface CodexHarnessOptions extends CodexProcess {
|
|
27
|
+
model: string;
|
|
28
|
+
effort?: "low" | "medium" | "high" | "xhigh" | "max";
|
|
29
|
+
/** The thread's working directory. Codex runs no tools of its own here, so this only needs to exist. */
|
|
30
|
+
cwd: string;
|
|
31
|
+
}
|
|
32
|
+
/** One JSON-RPC peer over newline-delimited JSON. */
|
|
33
|
+
export interface CodexConnection {
|
|
34
|
+
send(message: JsonValue): void;
|
|
35
|
+
readonly messages: AsyncIterable<JsonValue>;
|
|
36
|
+
close(): void;
|
|
37
|
+
/** The last of what the process wrote to stderr, said when it exits: the reason is there. */
|
|
38
|
+
stderr?(): string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* OpenAI's Codex loop, running our tools and nothing of its own.
|
|
42
|
+
*
|
|
43
|
+
* Codex is the program a ChatGPT plan is sold for, and its app server is the
|
|
44
|
+
* protocol its own clients speak, so this is how a subscriber spends their plan
|
|
45
|
+
* from an agent of their own: sign Codex in (`signInToCodex`), and let it run
|
|
46
|
+
* the loop. An API key works the same way, through Codex's own configuration.
|
|
47
|
+
*
|
|
48
|
+
* What it keeps: our instructions as the thread's base instructions, our tools
|
|
49
|
+
* as its whole tool list (declared as dynamic tools, which Codex calls back for
|
|
50
|
+
* rather than running), every call through our executor and into our log. What
|
|
51
|
+
* it gives up is what `createClaudeAgentSdkHarness` gives up: the context is
|
|
52
|
+
* Codex's and is compacted by Codex, an interrupted activation is over, and a
|
|
53
|
+
* later one resumes the thread the log names or starts a new one from a
|
|
54
|
+
* transcript. Codex fixes a thread's tools when it starts, so a thread is
|
|
55
|
+
* resumed only while the tool list is the one it was started with.
|
|
56
|
+
*/
|
|
57
|
+
export declare function createCodexHarness(options: CodexHarnessOptions): Harness;
|
|
58
|
+
/** Whether Codex is signed in, and as whom. */
|
|
59
|
+
export declare function codexAccount(process_: CodexProcess): Promise<Result<{
|
|
60
|
+
signedIn: false;
|
|
61
|
+
} | {
|
|
62
|
+
signedIn: true;
|
|
63
|
+
kind: string;
|
|
64
|
+
email?: string;
|
|
65
|
+
plan?: string;
|
|
66
|
+
}, Failure>>;
|
|
67
|
+
/**
|
|
68
|
+
* Sign Codex in to a ChatGPT plan with a device code: the person opens
|
|
69
|
+
* `verificationUrl`, signs in to OpenAI there, and enters `userCode`.
|
|
70
|
+
*
|
|
71
|
+
* OpenAI's own flow, run by Codex itself, so no credential passes through the
|
|
72
|
+
* caller; Codex keeps the grant in `CODEX_HOME` and refreshes it. The process
|
|
73
|
+
* stays up until `completed` settles or `cancel` is called.
|
|
74
|
+
*/
|
|
75
|
+
export declare function signInToCodex(process_: CodexProcess): Promise<Result<{
|
|
76
|
+
verificationUrl: string;
|
|
77
|
+
userCode: string;
|
|
78
|
+
completed: Promise<Result<void, Failure>>;
|
|
79
|
+
cancel(): void;
|
|
80
|
+
}, Failure>>;
|