@parcha/agentrun-harness-claude 0.1.0-beta.30 → 0.1.0-beta.31
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/CHANGELOG.md +4 -0
- package/dist/adapter.js +24 -1
- package/dist/harness.d.ts +14 -0
- package/dist/harness.js +31 -4
- package/dist/host/machine.d.ts +6 -1
- package/dist/host/machine.js +2 -0
- package/dist/host/policy.d.ts +2 -0
- package/dist/host/policy.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## 0.1.0-beta.31 (2026-11-06)
|
|
6
|
+
|
|
7
|
+
- Agents call a saved MCP server's tools on pi and claude-agent: grant `mcp:<server>/<tool>` in `definition.tools`. A save checks the name against the server's saved tools (`422` naming them). A run's first launch pins the granted tools as saved and the server's URL; its credential reaches only runs that grant one of its tools, over the run's secrets pipe. pi binds each tool in the run's process; claude-agent's own MCP client calls it at the session's model proxy (`/mcp/<server>`, behind the session key), so the CLI never holds the credential. A call follows no redirect, a crash-cut call is answered interrupted and never sent again, a moved server is sent nothing, and the timeline reads `<server> · <tool>`. `features.mcp_client.harnesses` lists the harnesses that run them. Every call passes the run's tool gate and its spend cap.
|
|
8
|
+
|
|
5
9
|
## 0.1.0-beta.30 (2026-11-05)
|
|
6
10
|
|
|
7
11
|
- A run whose model provider stops the answer on its content filter now ends `failed` with `error.code` `moderated` and
|
package/dist/adapter.js
CHANGED
|
@@ -16,13 +16,14 @@ import { READ_SKILL_FILE, readSkillFileTool, skillProblems } from "@parcha/agent
|
|
|
16
16
|
import { abortedOutcome, openDrive, pendingSubmissions, Restart, SessionHalt } from "@parcha/agentrun-kernel/kernel";
|
|
17
17
|
import { toolSchemaProblems } from "@parcha/agentrun-kernel";
|
|
18
18
|
import { NativeJournal, recoveryNote, settleTurn, transcriptOf } from "@parcha/agentrun-kernel/process";
|
|
19
|
-
import { checkedOnce, hostHeaderProblems, sha256OfFile } from "@parcha/agentrun-kernel/host";
|
|
19
|
+
import { checkedOnce, hostHeaderProblems, mcpRoute, sha256OfFile } from "@parcha/agentrun-kernel/host";
|
|
20
20
|
import { findClaudeExecutable, platformSuffix } from "./binary.js";
|
|
21
21
|
import { CLAUDE_AGENT_PACKAGE, ClaudeAgentNotInstalled, ClaudeAgentPinMismatch, ClaudeAgentThinkingOff } from "./errors.js";
|
|
22
22
|
import { claudeCodeHarness, lostPrompts } from "./harness.js";
|
|
23
23
|
import { JournalSessionStore } from "./store.js";
|
|
24
24
|
import { localMachine } from "./host/machine.js";
|
|
25
25
|
import { serialWriter } from "./serial.js";
|
|
26
|
+
import { MCP_SERVER } from "./transcript.js";
|
|
26
27
|
import { CLAUDE_AGENT_SDK_INSTALL, CLAUDE_AGENT_SDK_VERSION, CLAUDE_CODE_VERSION, installedVersion } from "./versions.js";
|
|
27
28
|
export { CLAUDE_AGENT_CLI_SKILL_NAMES } from "./cli-names.js";
|
|
28
29
|
/** The pinned CLI's tools the copied harness leaves undecided, off by name in every session (WebSearch unless `webSearch`). */
|
|
@@ -307,6 +308,18 @@ export function claudeAgentAdapter(options) {
|
|
|
307
308
|
const common = toolSchemaProblems(tool.name, tool.inputSchema);
|
|
308
309
|
problems.push(...common, ...(common.length ? [] : claudeSchemaProblems(tool.name, tool.inputSchema)));
|
|
309
310
|
}
|
|
311
|
+
for (const server of spec.mcp?.servers ?? []) {
|
|
312
|
+
if (server.name === MCP_SERVER)
|
|
313
|
+
problems.push(`the MCP server name ${MCP_SERVER} is the adapter's own`);
|
|
314
|
+
for (const tool of server.tools) {
|
|
315
|
+
const name = `mcp__${server.name}__${tool.name}`;
|
|
316
|
+
if (!TOOL_NAME.test(name))
|
|
317
|
+
problems.push(`the MCP tool ${name.slice(0, 80)} is not a name the Claude Agent CLI takes (letters, digits, _ and -, at most 64)`);
|
|
318
|
+
// A remote tool's schema meets the same checks as the host's: the CLI would drop it without a word.
|
|
319
|
+
const common = toolSchemaProblems(name, tool.inputSchema);
|
|
320
|
+
problems.push(...common, ...(common.length ? [] : claudeSchemaProblems(name, tool.inputSchema)));
|
|
321
|
+
}
|
|
322
|
+
}
|
|
310
323
|
return problems;
|
|
311
324
|
},
|
|
312
325
|
async open(spec, io) {
|
|
@@ -319,6 +332,9 @@ export function claudeAgentAdapter(options) {
|
|
|
319
332
|
// With skills, the model also reads their files (read_skill_file), from the session's own copy of them.
|
|
320
333
|
const tools = skills.length ? [...spec.tools, readSkillFileTool(join(dir, "plugin", "skills"), skills.map((skill) => ({ name: skill.name, files: Object.keys(skill.files) })))] : spec.tools;
|
|
321
334
|
const calls = new CallsInFlight();
|
|
335
|
+
// The remote MCP servers' granted tools, as the CLI names them: its own MCP client calls them at the proxy.
|
|
336
|
+
const mcpServers = spec.mcp?.servers ?? [];
|
|
337
|
+
const mcpNames = new Set(mcpServers.flatMap((server) => server.tools.map((tool) => `mcp__${server.name}__${tool.name}`)));
|
|
322
338
|
// The CLI's own tools offered to the model: Skill only when the session has skills, WebSearch only when it is on.
|
|
323
339
|
const builtins = [...(skills.length ? ["Skill"] : []), ...(webSearch ? ["WebSearch"] : [])];
|
|
324
340
|
const acquire = localMachine({
|
|
@@ -337,6 +353,7 @@ export function claudeAgentAdapter(options) {
|
|
|
337
353
|
...(options.provider.headers ? { headers: options.provider.headers } : {}),
|
|
338
354
|
...(options.log ? { log: options.log } : {}),
|
|
339
355
|
...(options.fetch ? { fetch: options.fetch } : {}),
|
|
356
|
+
...(spec.mcp ? { mcp: { handler: mcpRoute(spec.mcp), tools: [...mcpNames] } } : {}),
|
|
340
357
|
},
|
|
341
358
|
});
|
|
342
359
|
// The SDK this session runs on (the host's, or the one installed beside this package, checked above), thinking at
|
|
@@ -358,6 +375,7 @@ export function claudeAgentAdapter(options) {
|
|
|
358
375
|
// decide (test/tool-off.test.mjs pins the CLI's whole tool set against these lists), but WebSearch when it is on.
|
|
359
376
|
disallowedTools: CLAUDE_AGENT_ALSO_OFF.filter((name) => !(webSearch && name === "WebSearch")),
|
|
360
377
|
...(webSearch ? { providerTools: ["web_search"] } : {}),
|
|
378
|
+
...(mcpServers.length ? { mcpServers: mcpServers.map((server) => ({ name: server.name, tools: server.tools.map((tool) => tool.name) })) } : {}),
|
|
361
379
|
model: modelFor(spec),
|
|
362
380
|
...(skills.length ? { skills: { plugin: join(dir, "plugin"), names: writeSkillsPlugin(join(dir, "plugin"), skills) } } : {}),
|
|
363
381
|
...(options.smallModel ? { smallModel: options.smallModel } : {}),
|
|
@@ -372,6 +390,11 @@ export function claudeAgentAdapter(options) {
|
|
|
372
390
|
const e = event;
|
|
373
391
|
if (e?.type === "text" && typeof e.delta === "string")
|
|
374
392
|
io.onEvent({ type: "text", delta: e.delta });
|
|
393
|
+
// An MCP call, recorded as a built-in's: the host hears of it once its intent is in the session's records.
|
|
394
|
+
if (e?.type === "tool_start" && typeof e.callId === "string" && typeof e.name === "string" && mcpNames.has(e.name)) {
|
|
395
|
+
calls.begin(e.callId);
|
|
396
|
+
io.onEvent({ type: "tool_start", callId: e.callId, name: e.name, args: e.args ?? {} });
|
|
397
|
+
}
|
|
375
398
|
// The tool bridge's `tool_end` comes once the call's outcome is in the session's records: only then does the host
|
|
376
399
|
// hear the call ended, with the text recorded.
|
|
377
400
|
if (e?.type === "tool_end" && typeof e.callId === "string" && typeof e.name === "string") {
|
package/dist/harness.d.ts
CHANGED
|
@@ -170,6 +170,18 @@ export interface ClaudeCodeHarnessOptions {
|
|
|
170
170
|
* `claudeBuiltinReplay` (reads safe).
|
|
171
171
|
*/
|
|
172
172
|
builtinReplay?: Record<string, ReplayPolicy> | ((name: string) => ReplayPolicy);
|
|
173
|
+
/**
|
|
174
|
+
* Remote MCP servers the CLI's own MCP client calls, each at the session's
|
|
175
|
+
* model proxy (`<modelUrl>/mcp/<name>`, behind the session's key), with the
|
|
176
|
+
* tools granted on each: those are allowed by name (`mcp__<name>__<tool>`)
|
|
177
|
+
* and each call is recorded as a built-in's. They are set over the CLI's
|
|
178
|
+
* stdin (`setMcpServers`), never in its argv. A server that does not
|
|
179
|
+
* connect fails the turn. Default none.
|
|
180
|
+
*/
|
|
181
|
+
mcpServers?: readonly {
|
|
182
|
+
readonly name: string;
|
|
183
|
+
readonly tools: readonly string[];
|
|
184
|
+
}[];
|
|
173
185
|
/** Provider-hosted tools the model may use; default none. `web_search` turns the CLI's WebSearch on, built-ins off or
|
|
174
186
|
* not: each call recorded as a built-in's (the session's model proxy decides what the provider may run). */
|
|
175
187
|
providerTools?: readonly ProviderTool[];
|
|
@@ -226,6 +238,8 @@ export declare const DEFAULT_MODEL = "claude-sonnet-4-5";
|
|
|
226
238
|
export declare const TOOLS_NOTE = "Your only tools are this app's, the mcp__hands__ tools; you have no shell, file, search or web tools of your own.";
|
|
227
239
|
/** `TOOLS_NOTE` with WebSearch on (`providerTools: ['web_search']`) and the other built-ins off. */
|
|
228
240
|
export declare const WEB_SEARCH_NOTE = "Your only tools are this app's (the mcp__hands__ tools, if it has any) and WebSearch; you have no shell, file or fetch tools of your own.";
|
|
241
|
+
/** `TOOLS_NOTE` with the app's remote MCP servers (`mcpServers`) and the built-ins off. */
|
|
242
|
+
export declare const MCP_NOTE = "Your only tools are this app's: the mcp__hands__ tools, if it has any, and those of its MCP servers (the other mcp__ tools); you have no shell, file, search or web tools of your own.";
|
|
229
243
|
/** `TOOLS_NOTE` for a session with no tools at all (built-ins off, no `tools`). */
|
|
230
244
|
export declare const NO_TOOLS_NOTE = "You have no tools in this session: no shell, file, search or web tools. Answer from the conversation.";
|
|
231
245
|
/** With the built-ins on (docs/workspaces.md §5.6 "Workspace note"): what `/workspace` is. */
|
package/dist/harness.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright 2026 Vercel Inc. Licensed under the Apache License, Version 2.0; see LICENSE in this package.
|
|
2
2
|
// From github.com/vercel-labs/durable-harness, packages/harness-claude-code/src/harness.ts at ea8aa4060c (UPSTREAM.json records its blob and sha256).
|
|
3
|
-
// Changed by Parcha, imports rewritten for AgentRun; patches: 001-gate-always-on, 002-names, 003-comments, 008-tool-description-max, 009-tool-result-barrier-and-refusals, 010-served-tools-with-images, 011-session-skills, 013-recovery-note-system-prompt, 015-web-search, 016-mcp-output-tokens, 017-key-refused, 019-recovery-covers
|
|
3
|
+
// Changed by Parcha, imports rewritten for AgentRun; patches: 001-gate-always-on, 002-names, 003-comments, 008-tool-description-max, 009-tool-result-barrier-and-refusals, 010-served-tools-with-images, 011-session-skills, 013-recovery-note-system-prompt, 015-web-search, 016-mcp-output-tokens, 017-key-refused, 019-recovery-covers, 020-mcp-servers
|
|
4
4
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
5
5
|
import { randomUUID } from 'node:crypto';
|
|
6
6
|
import { mkdtemp, rm } from 'node:fs/promises';
|
|
@@ -23,6 +23,8 @@ export const DEFAULT_MODEL = 'claude-sonnet-4-5';
|
|
|
23
23
|
export const TOOLS_NOTE = `Your only tools are this app's, the mcp__${MCP_SERVER}__ tools; you have no shell, file, search or web tools of your own.`;
|
|
24
24
|
/** `TOOLS_NOTE` with WebSearch on (`providerTools: ['web_search']`) and the other built-ins off. */
|
|
25
25
|
export const WEB_SEARCH_NOTE = `Your only tools are this app's (the mcp__${MCP_SERVER}__ tools, if it has any) and WebSearch; you have no shell, file or fetch tools of your own.`;
|
|
26
|
+
/** `TOOLS_NOTE` with the app's remote MCP servers (`mcpServers`) and the built-ins off. */
|
|
27
|
+
export const MCP_NOTE = `Your only tools are this app's: the mcp__${MCP_SERVER}__ tools, if it has any, and those of its MCP servers (the other mcp__ tools); you have no shell, file, search or web tools of your own.`;
|
|
26
28
|
/** `TOOLS_NOTE` for a session with no tools at all (built-ins off, no `tools`). */
|
|
27
29
|
export const NO_TOOLS_NOTE = 'You have no tools in this session: no shell, file, search or web tools. Answer from the conversation.';
|
|
28
30
|
/** With the built-ins on (docs/workspaces.md §5.6 "Workspace note"): what `/workspace` is. */
|
|
@@ -141,6 +143,23 @@ async function bwrapWorks(machine, signal) {
|
|
|
141
143
|
return false;
|
|
142
144
|
}
|
|
143
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* The session's remote MCP servers, each an http entry at the model proxy's
|
|
148
|
+
* `/mcp/<name>` with the session's key, sent over the CLI's stdin (an entry
|
|
149
|
+
* in `options.mcpServers` would be in its argv). The in-process server
|
|
150
|
+
* (`own`) goes with them, since the call replaces the dynamic set. A server
|
|
151
|
+
* that did not connect throws: the turn fails rather than run without its
|
|
152
|
+
* tools. Each call may take `timeoutMs`, what is left of the invocation.
|
|
153
|
+
*/
|
|
154
|
+
async function connectMcp(q, machine, names, own, timeoutMs) {
|
|
155
|
+
const entry = (name) => ({ type: 'http', url: `${machine.modelUrl}/mcp/${name}`, headers: { authorization: `Bearer ${machine.modelKey}` }, timeout: Math.floor(timeoutMs), alwaysLoad: true });
|
|
156
|
+
const set = await q.setMcpServers({ ...own, ...Object.fromEntries(names.map((name) => [name, entry(name)])) });
|
|
157
|
+
const status = new Map((await q.mcpServerStatus()).map((server) => [server.name, server]));
|
|
158
|
+
const error = (name) => (set.errors && Object.hasOwn(set.errors, name) ? set.errors[name] : undefined);
|
|
159
|
+
const failed = names.filter((name) => error(name) !== undefined || status.get(name)?.status !== 'connected');
|
|
160
|
+
if (failed.length)
|
|
161
|
+
throw new Error(`the MCP server${failed.length > 1 ? 's' : ''} ${failed.join(', ')} did not connect: ${failed.map((name) => error(name) ?? status.get(name)?.error ?? status.get(name)?.status ?? 'no status').join('; ').slice(0, 300)}`);
|
|
162
|
+
}
|
|
144
163
|
export function claudeCodeHarness(options = {}) {
|
|
145
164
|
const tools = options.tools ?? [];
|
|
146
165
|
const allowed = builtinTools(options.builtins);
|
|
@@ -153,6 +172,8 @@ export function claudeCodeHarness(options = {}) {
|
|
|
153
172
|
const replay = typeof options.builtinReplay === 'function' ? options.builtinReplay : options.builtinReplay ? (name) => options.builtinReplay[name] ?? claudeBuiltinReplay(name) : claudeBuiltinReplay;
|
|
154
173
|
const providerTools = options.providerTools ?? [];
|
|
155
174
|
const webSearch = providerTools.includes('web_search');
|
|
175
|
+
const mcpServers = options.mcpServers ?? [];
|
|
176
|
+
const mcpNames = new Set(mcpServers.flatMap((server) => server.tools.map((tool) => `mcp__${server.name}__${tool}`)));
|
|
156
177
|
const log = options.log ?? (() => { });
|
|
157
178
|
let sdk;
|
|
158
179
|
const loadSdk = () => {
|
|
@@ -349,7 +370,8 @@ export function claudeCodeHarness(options = {}) {
|
|
|
349
370
|
return name === asked ? allow() : allow({ ...input, skill: name });
|
|
350
371
|
}
|
|
351
372
|
// WebSearch, when on, takes the built-ins' path below: its intent recorded before it runs.
|
|
352
|
-
|
|
373
|
+
// WebSearch and a granted MCP tool too.
|
|
374
|
+
if (!builtinsOn && !(webSearch && hook.tool_name === 'WebSearch') && !mcpNames.has(hook.tool_name))
|
|
353
375
|
return deny("Not run: this session's only tools are its own.");
|
|
354
376
|
if (ctx.signal.aborted)
|
|
355
377
|
return deny('the session stopped');
|
|
@@ -446,6 +468,9 @@ export function claudeCodeHarness(options = {}) {
|
|
|
446
468
|
// A host tool's result within the host's bound reaches the model whole (each tool is listed with it, too).
|
|
447
469
|
mcpOutputTokens: MCP_OUTPUT_TOKENS,
|
|
448
470
|
});
|
|
471
|
+
// MCP tools are offered whole, never deferred behind the CLI's tool search, which the session's proxy does not carry.
|
|
472
|
+
if (mcpServers.length)
|
|
473
|
+
vmEnv.ENABLE_TOOL_SEARCH = 'false';
|
|
449
474
|
const sdkEnv = { ...vmEnv, CLAUDE_CONFIG_DIR: configDir };
|
|
450
475
|
const disallowed = [...CLAUDE_BUILTINS_OFF, ...(providerTools.includes('web_search') ? [] : ['WebSearch']), ...(options.disallowedTools ?? [])].filter((name) => !(skills && name === 'Skill'));
|
|
451
476
|
const sessionId = uuidFrom(ctx.runId);
|
|
@@ -468,7 +493,7 @@ export function claudeCodeHarness(options = {}) {
|
|
|
468
493
|
hooks,
|
|
469
494
|
...(ownSandbox ? { sandbox: claudeSandboxSettings(machine, sandbox.network) } : {}),
|
|
470
495
|
...(bridge.tools.length ? { mcpServers: { [MCP_SERVER]: server } } : {}),
|
|
471
|
-
allowedTools: bridge.tools.map((t) => `mcp__${MCP_SERVER}__${t.name}`),
|
|
496
|
+
allowedTools: [...bridge.tools.map((t) => `mcp__${MCP_SERVER}__${t.name}`), ...mcpNames],
|
|
472
497
|
permissionMode: 'dontAsk',
|
|
473
498
|
strictMcpConfig: true,
|
|
474
499
|
// No user, project or local settings (and so no CLAUDE.md): a model-planted .claude/ on the Drive is ignored.
|
|
@@ -480,7 +505,7 @@ export function claudeCodeHarness(options = {}) {
|
|
|
480
505
|
systemPrompt: {
|
|
481
506
|
type: 'preset',
|
|
482
507
|
preset: 'claude_code',
|
|
483
|
-
append: [builtinsOn ? DRIVE_NOTE : webSearch ? WEB_SEARCH_NOTE : bridge.tools.length ? TOOLS_NOTE : NO_TOOLS_NOTE, options.instructions, recovered].filter(Boolean).join('\n\n'),
|
|
508
|
+
append: [builtinsOn ? DRIVE_NOTE : webSearch ? WEB_SEARCH_NOTE : mcpServers.length ? MCP_NOTE : bridge.tools.length ? TOOLS_NOTE : NO_TOOLS_NOTE, options.instructions, recovered].filter(Boolean).join('\n\n'),
|
|
484
509
|
snapshot: !recovered,
|
|
485
510
|
},
|
|
486
511
|
...(store.hasSession ? { resume: sessionId } : { sessionId }),
|
|
@@ -502,6 +527,8 @@ export function claudeCodeHarness(options = {}) {
|
|
|
502
527
|
};
|
|
503
528
|
const q = query({ prompt: input, options: queryOptions });
|
|
504
529
|
const messages = q[Symbol.asyncIterator]();
|
|
530
|
+
if (mcpServers.length)
|
|
531
|
+
await connectMcp(q, machine, mcpServers.map((server) => server.name), bridge.tools.length ? { [MCP_SERVER]: server } : {}, Math.max(1_000, deadline - Date.now()));
|
|
505
532
|
const send = async (text, placed, how = {}) => {
|
|
506
533
|
// The drive's first message says, once, what the sandbox told it (a lost Drive).
|
|
507
534
|
if (notes) {
|
package/dist/host/machine.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ChildProcess } from "node:child_process";
|
|
2
|
-
import { type ModelProxyHooks, type ModelProxyOptions, type ParentWatch } from "@parcha/agentrun-kernel/host";
|
|
2
|
+
import { type McpHandler, type ModelProxyHooks, type ModelProxyOptions, type ParentWatch } from "@parcha/agentrun-kernel/host";
|
|
3
3
|
import type { AcquireMachine, MachineSpawn, SessionMachine, SessionProcess } from "./process.js";
|
|
4
4
|
import { type AnthropicPolicyOptions } from "./policy.js";
|
|
5
5
|
/** The variables a child takes from this process, when they are set. */
|
|
@@ -32,6 +32,11 @@ export interface LocalMachineOptions {
|
|
|
32
32
|
builtins?: readonly string[];
|
|
33
33
|
/** Admit Anthropic's web search server tool, the one the CLI's WebSearch asks for. */
|
|
34
34
|
webSearch?: boolean;
|
|
35
|
+
/** The session's remote MCP servers, served at `/mcp/<server>`, and their granted tools as the CLI names them. */
|
|
36
|
+
mcp?: {
|
|
37
|
+
handler: McpHandler;
|
|
38
|
+
tools: readonly string[];
|
|
39
|
+
};
|
|
35
40
|
/** The input a request carrying it may read in beyond its body, for its input bound (anthropicPolicy). */
|
|
36
41
|
webSearchAllowance?: number;
|
|
37
42
|
/** The tokens' price; each web search a response reports is added to it (`withWebSearches`). */
|
package/dist/host/machine.js
CHANGED
|
@@ -130,6 +130,7 @@ export function localMachine(options) {
|
|
|
130
130
|
...(route.models.smallModel ? { smallModel: route.models.smallModel } : {}),
|
|
131
131
|
tools: options.proxy.tools,
|
|
132
132
|
...(options.proxy.builtins?.length ? { builtins: options.proxy.builtins } : {}),
|
|
133
|
+
...(options.proxy.mcp ? { mcpTools: options.proxy.mcp.tools } : {}),
|
|
133
134
|
...(options.proxy.maxOutputTokens ? { maxOutputTokens: options.proxy.maxOutputTokens } : {}),
|
|
134
135
|
...(options.proxy.webSearch ? { webSearch: true, ...(options.proxy.webSearchAllowance !== undefined ? { webSearchAllowance: options.proxy.webSearchAllowance } : {}) } : {}),
|
|
135
136
|
...(options.proxy.auth ? { auth: options.proxy.auth } : {}),
|
|
@@ -141,6 +142,7 @@ export function localMachine(options) {
|
|
|
141
142
|
credential: async () => (await route.credential()) ?? "",
|
|
142
143
|
...(options.proxy.price ? { price: withWebSearches(options.proxy.price) } : {}),
|
|
143
144
|
...(options.proxy.headers ? { headers: options.proxy.headers } : {}),
|
|
145
|
+
...(options.proxy.mcp ? { mcp: options.proxy.mcp.handler } : {}),
|
|
144
146
|
...(options.proxy.log ? { log: options.proxy.log } : {}),
|
|
145
147
|
// The provider stopped the turn's answer on its content filter: no retry of it can pass, so the turn ends at once.
|
|
146
148
|
onFiltered: (message) => ctx.halt?.(new Error(message)),
|
package/dist/host/policy.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ export interface AnthropicPolicyOptions {
|
|
|
28
28
|
tools: readonly string[];
|
|
29
29
|
/** The CLI's own tools the session has, offered by their own names beside its tools (`Skill`, when it has skills). */
|
|
30
30
|
builtins?: readonly string[];
|
|
31
|
+
/** The granted tools of the session's remote MCP servers, as the CLI names them (`mcp__<server>__<tool>`). */
|
|
32
|
+
mcpTools?: readonly string[];
|
|
31
33
|
/** The most output tokens one request may ask for. Default 128 000, what the pinned CLI asks for on current models. */
|
|
32
34
|
maxOutputTokens?: number;
|
|
33
35
|
/** Admit Anthropic's web search server tool (`CLAUDE_WEB_SEARCH_TOOL`), exactly as the pinned CLI asks for it; every
|
package/dist/host/policy.js
CHANGED
|
@@ -255,7 +255,7 @@ export function applyAnthropic(body, route, options) {
|
|
|
255
255
|
blocks(message.content, "a message's content");
|
|
256
256
|
}
|
|
257
257
|
blocks(body.system, "system");
|
|
258
|
-
const allowed = new Set([...options.tools.map((name) => `${OWN_TOOL_PREFIX}${name}`), ...(options.builtins ?? [])]);
|
|
258
|
+
const allowed = new Set([...options.tools.map((name) => `${OWN_TOOL_PREFIX}${name}`), ...(options.builtins ?? []), ...(options.mcpTools ?? [])]);
|
|
259
259
|
const tools = ownTools(body.tools, allowed, options.webSearch);
|
|
260
260
|
const choice = body.tool_choice;
|
|
261
261
|
const chosen = isPlain(choice) && typeof choice.name === "string" && (allowed.has(choice.name) || (options.webSearch === true && choice.name === "web_search"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parcha/agentrun-harness-claude",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.31",
|
|
4
4
|
"description": "The Claude Agent SDK as an AgentRun harness: the host's tools as its only tools, its model behind a loopback proxy, durable in AgentRun's own store.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentrun",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"test": "node --test --test-concurrency=8 'test/*.test.mjs'"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@parcha/agentrun-dsl": "0.1.0-beta.
|
|
48
|
-
"@parcha/agentrun-kernel": "0.1.0-beta.
|
|
47
|
+
"@parcha/agentrun-dsl": "0.1.0-beta.31",
|
|
48
|
+
"@parcha/agentrun-kernel": "0.1.0-beta.31"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@anthropic-ai/claude-agent-sdk": "0.3.286",
|