@parcha/agentrun-harness-acp 0.1.0-beta.46 → 0.1.0-beta.47
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 +20 -0
- package/NOTICE +2 -0
- package/dist/adapter.d.ts +43 -0
- package/dist/adapter.js +198 -0
- package/dist/calls.d.ts +39 -0
- package/dist/calls.js +138 -0
- package/dist/cursor-facts.d.ts +27 -0
- package/dist/cursor-facts.js +55 -0
- package/dist/cursor.d.ts +36 -0
- package/dist/cursor.js +80 -0
- package/dist/facts.d.ts +39 -0
- package/dist/facts.js +34 -0
- package/dist/goose-facts.d.ts +6 -0
- package/dist/goose-facts.js +32 -0
- package/dist/goose.d.ts +29 -0
- package/dist/goose.js +67 -0
- package/dist/harness.d.ts +80 -0
- package/dist/harness.js +779 -0
- package/dist/host/agent.d.ts +32 -0
- package/dist/host/agent.js +57 -0
- package/dist/host/child.d.ts +14 -0
- package/dist/host/child.js +32 -0
- package/dist/host/goose-proxy.d.ts +57 -0
- package/dist/host/goose-proxy.js +332 -0
- package/dist/host/mcp-stdio.d.ts +1 -0
- package/dist/host/mcp-stdio.js +76 -0
- package/dist/host/mcp.d.ts +40 -0
- package/dist/host/mcp.js +210 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +12 -0
- package/dist/pinned-binary.d.ts +63 -0
- package/dist/pinned-binary.js +152 -0
- package/dist/recipe.d.ts +75 -0
- package/dist/recipe.js +71 -0
- package/dist/state.d.ts +33 -0
- package/dist/state.js +157 -0
- package/package.json +2 -2
- package/recipes/cursor.json +21 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ClientConnection, type RequestPermissionRequest, type RequestPermissionResponse, type SessionNotification } from "@agentclientprotocol/sdk";
|
|
2
|
+
import { type ParentWatch } from "@parcha/agentrun-kernel/host";
|
|
3
|
+
import { type ConfineChild } from "./child.js";
|
|
4
|
+
export interface AgentProcessOptions {
|
|
5
|
+
command: string;
|
|
6
|
+
args: readonly string[];
|
|
7
|
+
cwd: string;
|
|
8
|
+
/** What the child gets beyond the allowlist. */
|
|
9
|
+
env: Record<string, string>;
|
|
10
|
+
/** The environment the allowlist reads. Default `process.env`. */
|
|
11
|
+
from?: Readonly<Record<string, string | undefined>>;
|
|
12
|
+
confine?: ConfineChild;
|
|
13
|
+
parentWatch?: ParentWatch;
|
|
14
|
+
signal: AbortSignal;
|
|
15
|
+
/** Each session/update the agent sends, in the order it sent them. */
|
|
16
|
+
onUpdate(update: SessionNotification): void;
|
|
17
|
+
/** The agent asks permission for a tool call: the answer, or a rejection while `signal` (the connection's) aborts. */
|
|
18
|
+
onPermission(request: RequestPermissionRequest, signal: AbortSignal): Promise<RequestPermissionResponse>;
|
|
19
|
+
}
|
|
20
|
+
export interface AgentProcess {
|
|
21
|
+
readonly connection: ClientConnection;
|
|
22
|
+
readonly pid: number | undefined;
|
|
23
|
+
readonly exited: Promise<{
|
|
24
|
+
code: number | null;
|
|
25
|
+
signal: string | null;
|
|
26
|
+
}>;
|
|
27
|
+
alive(): boolean;
|
|
28
|
+
stderrTail(): string;
|
|
29
|
+
kill(): void;
|
|
30
|
+
}
|
|
31
|
+
/** Start the agent and open the client connection over its stdio. */
|
|
32
|
+
export declare function startAgent(options: AgentProcessOptions): AgentProcess;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// One ACP agent process, and the client connection the adapter speaks to it with over its stdio (newline-delimited
|
|
2
|
+
// JSON-RPC, the official SDK's ndJsonStream). Written for AgentRun.
|
|
3
|
+
// - It starts with the environment allowlist (child.ts), in its own process group, watched by this process
|
|
4
|
+
// (parentWatched) inside the host's confinement: a SIGKILLed host leaves no agent behind.
|
|
5
|
+
// - Its stderr is kept, its tail only, for a failure's words; nothing it prints reaches the log whole.
|
|
6
|
+
// - kill() ends its whole group; so does an abort of `signal`.
|
|
7
|
+
import { spawn } from "node:child_process";
|
|
8
|
+
import { Readable, Writable } from "node:stream";
|
|
9
|
+
import { client, ndJsonStream } from "@agentclientprotocol/sdk";
|
|
10
|
+
import { parentWatched } from "@parcha/agentrun-kernel/host";
|
|
11
|
+
import { childEnv, confined } from "./child.js";
|
|
12
|
+
const STDERR_TAIL = 8 * 1024;
|
|
13
|
+
/** Start the agent and open the client connection over its stdio. */
|
|
14
|
+
export function startAgent(options) {
|
|
15
|
+
const run = confined(parentWatched({ command: options.command, args: [...options.args] }, options.parentWatch), options.confine);
|
|
16
|
+
const child = spawn(run.command, run.args, { cwd: options.cwd, env: childEnv(options.from ?? process.env, options.env), detached: true, stdio: ["pipe", "pipe", "pipe"] });
|
|
17
|
+
let stderr = "";
|
|
18
|
+
child.stderr.setEncoding("utf8");
|
|
19
|
+
child.stderr.on("data", (chunk) => void (stderr = (stderr + chunk).slice(-STDERR_TAIL)));
|
|
20
|
+
// A write to a stdin the agent closed is its exit's to report, never an unhandled error.
|
|
21
|
+
child.stdin.on("error", () => { });
|
|
22
|
+
let done = false;
|
|
23
|
+
const exited = new Promise((resolve) => {
|
|
24
|
+
child.once("error", (err) => {
|
|
25
|
+
stderr = (stderr + `\n${String(err.message)}`).slice(-STDERR_TAIL);
|
|
26
|
+
done = true;
|
|
27
|
+
resolve({ code: null, signal: null });
|
|
28
|
+
});
|
|
29
|
+
child.once("close", (code, signal) => {
|
|
30
|
+
done = true;
|
|
31
|
+
resolve({ code, signal });
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
const kill = () => {
|
|
35
|
+
if (done || child.pid === undefined)
|
|
36
|
+
return;
|
|
37
|
+
try {
|
|
38
|
+
process.kill(-child.pid, "SIGKILL");
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
try {
|
|
42
|
+
child.kill("SIGKILL");
|
|
43
|
+
}
|
|
44
|
+
catch { /* gone */ }
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
if (options.signal.aborted)
|
|
48
|
+
kill();
|
|
49
|
+
else
|
|
50
|
+
options.signal.addEventListener("abort", kill, { once: true });
|
|
51
|
+
const app = client({ name: "agentrun" })
|
|
52
|
+
.onNotification("session/update", ({ params }) => options.onUpdate(params))
|
|
53
|
+
.onRequest("session/request_permission", ({ params, signal }) => options.onPermission(params, signal));
|
|
54
|
+
const connection = app.connect(ndJsonStream(Writable.toWeb(child.stdin), Readable.toWeb(child.stdout)));
|
|
55
|
+
void exited.then(() => connection.close(new Error(`the agent's process ended: ${stderr.trim().slice(-300) || "it printed nothing"}`)));
|
|
56
|
+
return { connection, pid: child.pid, exited, alive: () => !done, stderrTail: () => stderr, kill };
|
|
57
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** The variables a child takes from this process, when they are set. */
|
|
2
|
+
export declare const INHERITED_ENV: readonly ["PATH", "LANG", "TZ"];
|
|
3
|
+
/** A command and its arguments, as the drive starts it. */
|
|
4
|
+
export interface ChildCommand {
|
|
5
|
+
command: string;
|
|
6
|
+
args: string[];
|
|
7
|
+
}
|
|
8
|
+
/** The host's confinement of a child: the same command and arguments, started under the host's own (a
|
|
9
|
+
* `setpriv --no-new-privs` prefix, say). It may only add in front, and never sees or changes the child's environment. */
|
|
10
|
+
export type ConfineChild = (child: Readonly<ChildCommand>) => ChildCommand;
|
|
11
|
+
/** The command `confine` makes of `child`, refused unless it ends with the child's command and arguments unchanged. */
|
|
12
|
+
export declare function confined(child: ChildCommand, confine: ConfineChild | undefined): ChildCommand;
|
|
13
|
+
/** The child's environment: the allowlist from `from`, then what the caller names. */
|
|
14
|
+
export declare function childEnv(from: Readonly<Record<string, string | undefined>>, extra?: Readonly<Record<string, string>>): Record<string, string>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// The agent's process: its environment and its confinement. Copied from OpenCode's (packages/serve/src/harness-opencode/
|
|
2
|
+
// host/server.ts, `INHERITED_ENV`, `confined`, `childEnv`), not shared: each harness keeps its own copy, so neither moves
|
|
3
|
+
// when the other changes. Written for AgentRun.
|
|
4
|
+
// - The child's environment is an allowlist: PATH, LANG and TZ from this process, then what the drive names (its private
|
|
5
|
+
// HOME and directories, the recipe's own variables). Nothing else is inherited, so no provider key, token or host secret
|
|
6
|
+
// reaches it.
|
|
7
|
+
// - It runs in its own process group, which a kill ends whole, and dies with this process: started with a watch on its
|
|
8
|
+
// parent (the kernel host's parentWatched), inside the host's confinement.
|
|
9
|
+
/** The variables a child takes from this process, when they are set. */
|
|
10
|
+
export const INHERITED_ENV = Object.freeze(["PATH", "LANG", "TZ"]);
|
|
11
|
+
/** The command `confine` makes of `child`, refused unless it ends with the child's command and arguments unchanged. */
|
|
12
|
+
export function confined(child, confine) {
|
|
13
|
+
if (!confine)
|
|
14
|
+
return child;
|
|
15
|
+
const out = confine({ command: child.command, args: [...child.args] });
|
|
16
|
+
const argv = [out?.command, ...(Array.isArray(out?.args) ? out.args : [])];
|
|
17
|
+
const tail = argv.slice(argv.length - child.args.length - 1);
|
|
18
|
+
const kept = argv.length > child.args.length + 1 && tail.length === child.args.length + 1 && tail.every((a, i) => a === (i === 0 ? child.command : child.args[i - 1]));
|
|
19
|
+
if (typeof out?.command !== "string" || !argv.every((a) => typeof a === "string") || !kept)
|
|
20
|
+
throw new Error("acp: the host's confinement must start the child's own command and arguments, after its own");
|
|
21
|
+
return { command: out.command, args: out.args };
|
|
22
|
+
}
|
|
23
|
+
/** The child's environment: the allowlist from `from`, then what the caller names. */
|
|
24
|
+
export function childEnv(from, extra = {}) {
|
|
25
|
+
const env = {};
|
|
26
|
+
for (const name of INHERITED_ENV) {
|
|
27
|
+
const value = from[name];
|
|
28
|
+
if (typeof value === "string")
|
|
29
|
+
env[name] = value;
|
|
30
|
+
}
|
|
31
|
+
return { ...env, ...extra };
|
|
32
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type ModelProxyOptions, type ProviderPolicy, type ProxyRoute, type ProxyUsage } from "@parcha/agentrun-kernel/host";
|
|
2
|
+
import type { AcpProxy } from "../adapter.js";
|
|
3
|
+
/** Goose's own tools that stay on with every bundled extension off: `load_skill`, which its agent always offers and which
|
|
4
|
+
* reads skill files only. */
|
|
5
|
+
export declare const GOOSE_OWN_TOOLS: readonly string[];
|
|
6
|
+
/** A host tool's name as Goose offers it to its model: the MCP server's name, two underscores, the tool's. */
|
|
7
|
+
export declare const gooseToolName: (name: string) => string;
|
|
8
|
+
/** The `anthropic-beta` value Goose 1.59.2 sends with each Messages request, recorded behind a fake origin (the package's
|
|
9
|
+
* Goose test records it again on every run with the binary). */
|
|
10
|
+
export declare const GOOSE_BETAS: ReadonlySet<string>;
|
|
11
|
+
/** The routes, the models list answered with `model` alone. */
|
|
12
|
+
export declare function gooseRoutes(model: string): readonly ProxyRoute[];
|
|
13
|
+
export interface GoosePolicyOptions {
|
|
14
|
+
/** The session's model. */
|
|
15
|
+
model: string;
|
|
16
|
+
/** The session's host tools, by their names (`spec.tools`). */
|
|
17
|
+
tools: readonly string[];
|
|
18
|
+
/** The most output tokens one request may ask for. Default 128 000, what Goose asks for. */
|
|
19
|
+
maxOutputTokens?: number;
|
|
20
|
+
/** How the provider takes its credential. Default `x-api-key` (Anthropic's API). */
|
|
21
|
+
auth?: "x-api-key" | "bearer";
|
|
22
|
+
}
|
|
23
|
+
/** The body the provider gets: checked, its model the session's, its `max_tokens` clamped. */
|
|
24
|
+
export declare function applyGoose(body: unknown, options: GoosePolicyOptions): Record<string, unknown>;
|
|
25
|
+
/** `body` with its output limited to `max` tokens, thinking included; only numbers get smaller, so it is never longer. */
|
|
26
|
+
export declare function limitGooseOutput(body: Record<string, unknown>, max: number): Record<string, unknown>;
|
|
27
|
+
/** The usage a Messages answer reports: a whole body's `usage`, or a stream's `message_start` usage with its last
|
|
28
|
+
* `message_delta` usage over it. A stream that never stopped (no `message_stop` or `error`) is unknown. */
|
|
29
|
+
export declare function gooseUsage(text: string): ProxyUsage | undefined;
|
|
30
|
+
/** Goose's provider policy for one session. */
|
|
31
|
+
export declare function goosePolicy(options: GoosePolicyOptions): ProviderPolicy;
|
|
32
|
+
/** The provider Goose's requests go to through the proxy. */
|
|
33
|
+
export interface GooseProvider {
|
|
34
|
+
/** Its base (`https://api.anthropic.com`, or a gateway's): the proxy forwards to its `/v1/messages` only. */
|
|
35
|
+
origin: string;
|
|
36
|
+
/** The provider key, read per request in this process. It never reaches Goose. */
|
|
37
|
+
credential: () => Promise<string | undefined> | string | undefined;
|
|
38
|
+
/** How the provider takes it. Default `x-api-key`. */
|
|
39
|
+
auth?: "x-api-key" | "bearer";
|
|
40
|
+
/** Headers sent with every model request (a gateway's spend tags): Goose can neither set nor override them. */
|
|
41
|
+
headers?: Readonly<Record<string, string>>;
|
|
42
|
+
}
|
|
43
|
+
export interface GooseProxyOptions {
|
|
44
|
+
/** The run's model, as the provider names it. */
|
|
45
|
+
model: string;
|
|
46
|
+
provider: GooseProvider;
|
|
47
|
+
/** The price of a response; null (or no function) records its cost as unknown. */
|
|
48
|
+
price?: ModelProxyOptions["price"];
|
|
49
|
+
maxOutputTokens?: number;
|
|
50
|
+
log?: (message: string, fields?: Record<string, unknown>) => void;
|
|
51
|
+
/** For tests: the fetch the proxy forwards with. */
|
|
52
|
+
fetch?: typeof fetch;
|
|
53
|
+
}
|
|
54
|
+
/** The proxy option for a Goose adapter (`acpAdapter`'s `proxy`): each Goose process gets a model proxy of its own, on the
|
|
55
|
+
* session's booking, and is pointed at it with ANTHROPIC_HOST (plain http on loopback) and ANTHROPIC_API_KEY, the
|
|
56
|
+
* proxy's own key for the session, never the provider's. A provider stop on its content filter ends the drive. */
|
|
57
|
+
export declare function gooseProxy(options: GooseProxyOptions): AcpProxy;
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
// What Goose's model requests may carry through the session's model proxy (@parcha/agentrun-kernel/host), and the proxy
|
|
2
|
+
// each Goose process is pointed at. Written for AgentRun.
|
|
3
|
+
//
|
|
4
|
+
// Goose (1.59.2, provider `anthropic`) speaks Anthropic's Messages API to ANTHROPIC_HOST, with ANTHROPIC_API_KEY as its
|
|
5
|
+
// `x-api-key`. Measured behind a recording origin, with session naming off and its model catalog's fetch blocked (the
|
|
6
|
+
// recipe), it sends:
|
|
7
|
+
// - `GET /v1/models` as it starts, headers accept, accept-encoding, anthropic-version and x-api-key: answered here with
|
|
8
|
+
// the session's model alone, never forwarded (the provider's whole list is not the session's to read);
|
|
9
|
+
// - then only the turn's `POST /v1/messages` (streamed), which adds anthropic-beta, content-type and `agent-session-id`,
|
|
10
|
+
// Goose's own session id: that one is never forwarded.
|
|
11
|
+
// The one anthropic-beta value it sends (GOOSE_BETAS) passes; any other is refused, so a Goose that starts sending a new
|
|
12
|
+
// one is seen before it is trusted.
|
|
13
|
+
//
|
|
14
|
+
// A body may carry only the Messages API's own keys. Its model is the session's. The tools it offers are the session's
|
|
15
|
+
// own, as Goose names them (`agentrun__<name>`), and Goose's `load_skill`, which it always offers (GOOSE_OWN_TOOLS): any
|
|
16
|
+
// other tool is refused, never trimmed, so a Goose whose bundled extensions came back on fails loudly. A provider-hosted
|
|
17
|
+
// tool, or a content block the API would run or fetch on its own, is refused. `max_tokens` is clamped. Usage is read from
|
|
18
|
+
// the stream's `message_start` and its last `message_delta`.
|
|
19
|
+
//
|
|
20
|
+
// The proxy asks the session's booking (`AcpProxySession.models`, the runner's) before each paid request and books it
|
|
21
|
+
// once it answers, priced by the host's `price`: the same hooks every proxy-billed harness's proxy takes, so the run's
|
|
22
|
+
// cap and books hold for Goose as for the others.
|
|
23
|
+
import { randomBytes } from "node:crypto";
|
|
24
|
+
import { messagesImagesIn, messagesInputAfter, messagesLocalInputTokens, providerInputOverhead, ProxyRefusal, startModelProxy } from "@parcha/agentrun-kernel/host";
|
|
25
|
+
import { MCP_SERVER } from "../calls.js";
|
|
26
|
+
/** Goose's own tools that stay on with every bundled extension off: `load_skill`, which its agent always offers and which
|
|
27
|
+
* reads skill files only. */
|
|
28
|
+
export const GOOSE_OWN_TOOLS = Object.freeze(["load_skill"]);
|
|
29
|
+
/** A host tool's name as Goose offers it to its model: the MCP server's name, two underscores, the tool's. */
|
|
30
|
+
export const gooseToolName = (name) => `${MCP_SERVER}__${name}`;
|
|
31
|
+
/** The `anthropic-beta` value Goose 1.59.2 sends with each Messages request, recorded behind a fake origin (the package's
|
|
32
|
+
* Goose test records it again on every run with the binary). */
|
|
33
|
+
export const GOOSE_BETAS = new Set(["thinking-binding-controls-2026-08-01"]);
|
|
34
|
+
/** The request headers forwarded with a Messages request: the API's version and betas. Goose's `agent-session-id` is not
|
|
35
|
+
* among them. */
|
|
36
|
+
const MESSAGES_HEADERS = ["anthropic-version", "anthropic-beta"];
|
|
37
|
+
/** The routes, the models list answered with `model` alone. */
|
|
38
|
+
export function gooseRoutes(model) {
|
|
39
|
+
const listed = JSON.stringify({ data: [{ type: "model", id: model, display_name: model, created_at: "1970-01-01T00:00:00Z" }], has_more: false, first_id: model, last_id: model });
|
|
40
|
+
return Object.freeze([
|
|
41
|
+
{ method: "GET", path: "/v1/models", local: 200, localJson: listed },
|
|
42
|
+
{ method: "POST", path: "/v1/messages", headers: MESSAGES_HEADERS },
|
|
43
|
+
]);
|
|
44
|
+
}
|
|
45
|
+
/** The keys a Messages request may carry: the API's own client-side ones. */
|
|
46
|
+
const MESSAGES_KEYS = new Set(["model", "messages", "system", "max_tokens", "metadata", "stop_sequences", "stream", "temperature", "top_k", "top_p", "tools", "tool_choice", "thinking", "output_config"]);
|
|
47
|
+
const OUTPUT_CONFIG_KEYS = new Set(["effort", "format"]);
|
|
48
|
+
/** The content blocks a Goose session sends: text, its model's thinking, tool calls and their results. */
|
|
49
|
+
const BLOCKS = new Set(["text", "thinking", "redacted_thinking", "tool_use", "tool_result"]);
|
|
50
|
+
/** The image types the API takes, which a host tool's image may be, inside its result. */
|
|
51
|
+
const IMAGE_TYPES = new Set(["image/jpeg", "image/png", "image/gif", "image/webp"]);
|
|
52
|
+
/** The tokens a request keeps for its answer when its output is limited, and the least thinking budget the provider takes. */
|
|
53
|
+
const ANSWER_TOKENS_LEAST = 1024;
|
|
54
|
+
const THINKING_BUDGET_LEAST = 1024;
|
|
55
|
+
const isPlain = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
56
|
+
const refuse = (status, message) => {
|
|
57
|
+
throw new ProxyRefusal(status, message);
|
|
58
|
+
};
|
|
59
|
+
/** A content list (a message's, the system prompt's, a tool result's): only the block types a Goose session sends, and an
|
|
60
|
+
* image only inline inside a tool result, of a type the API takes (never one the provider would fetch). */
|
|
61
|
+
function blocks(content, where, inResult = false) {
|
|
62
|
+
if (content === undefined || typeof content === "string")
|
|
63
|
+
return;
|
|
64
|
+
if (!Array.isArray(content))
|
|
65
|
+
return refuse(400, `${where} must be a string or a list of blocks`);
|
|
66
|
+
for (const block of content) {
|
|
67
|
+
if (!isPlain(block) || typeof block.type !== "string")
|
|
68
|
+
return refuse(400, `a block in ${where} must be an object with a type`);
|
|
69
|
+
if (inResult && block.type === "image") {
|
|
70
|
+
const source = block.source;
|
|
71
|
+
if (!isPlain(source) || source.type !== "base64" || typeof source.media_type !== "string" || !IMAGE_TYPES.has(source.media_type) || typeof source.data !== "string")
|
|
72
|
+
refuse(403, `${where} holds a block of a type this session does not send`);
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if (!BLOCKS.has(block.type))
|
|
76
|
+
refuse(403, `${where} holds a block of a type this session does not send`);
|
|
77
|
+
if (block.type === "tool_result")
|
|
78
|
+
blocks(block.content, "a tool result's content", true);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/** The output tokens a Messages body asks for at most: its `max_tokens`. */
|
|
82
|
+
const outputAsked = (body) => (typeof body.max_tokens === "number" && Number.isSafeInteger(body.max_tokens) && body.max_tokens > 0 ? body.max_tokens : undefined);
|
|
83
|
+
/** The body the provider gets: checked, its model the session's, its `max_tokens` clamped. */
|
|
84
|
+
export function applyGoose(body, options) {
|
|
85
|
+
if (!isPlain(body))
|
|
86
|
+
return refuse(400, "the body is not an object");
|
|
87
|
+
for (const key of Object.keys(body))
|
|
88
|
+
if (!MESSAGES_KEYS.has(key))
|
|
89
|
+
refuse(403, "messages: a key outside the API's own is not allowed");
|
|
90
|
+
if (body.output_config !== undefined) {
|
|
91
|
+
if (!isPlain(body.output_config))
|
|
92
|
+
refuse(400, "output_config must be an object");
|
|
93
|
+
for (const key of Object.keys(body.output_config))
|
|
94
|
+
if (!OUTPUT_CONFIG_KEYS.has(key))
|
|
95
|
+
refuse(403, "output_config: a key outside the API's own is not allowed");
|
|
96
|
+
}
|
|
97
|
+
if (body.model !== options.model)
|
|
98
|
+
refuse(403, "the model is not this session's");
|
|
99
|
+
if (!Array.isArray(body.messages))
|
|
100
|
+
refuse(400, "messages must be a list");
|
|
101
|
+
for (const message of body.messages) {
|
|
102
|
+
if (!isPlain(message))
|
|
103
|
+
refuse(400, "a message must be an object");
|
|
104
|
+
blocks(message.content, "a message's content");
|
|
105
|
+
}
|
|
106
|
+
blocks(body.system, "system");
|
|
107
|
+
const allowed = new Set([...options.tools.map(gooseToolName), ...GOOSE_OWN_TOOLS]);
|
|
108
|
+
if (body.tools !== undefined) {
|
|
109
|
+
if (!Array.isArray(body.tools))
|
|
110
|
+
refuse(400, "tools is not a list");
|
|
111
|
+
for (const tool of body.tools) {
|
|
112
|
+
if (!isPlain(tool))
|
|
113
|
+
refuse(400, "a tool must be an object");
|
|
114
|
+
const t = tool;
|
|
115
|
+
if (t.type !== undefined && t.type !== "custom")
|
|
116
|
+
refuse(403, "a provider-hosted tool is not offered to this session's model");
|
|
117
|
+
if (typeof t.name !== "string" || !allowed.has(t.name))
|
|
118
|
+
refuse(403, "a tool this session does not have is offered: Goose's own tools must stay off");
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const choice = body.tool_choice;
|
|
122
|
+
if (isPlain(choice) && choice.type === "tool" && !(typeof choice.name === "string" && allowed.has(choice.name)))
|
|
123
|
+
refuse(403, "tool_choice names a tool this session does not have");
|
|
124
|
+
const most = options.maxOutputTokens ?? 128_000;
|
|
125
|
+
const max = Math.min(outputAsked(body) ?? most, most);
|
|
126
|
+
const out = { ...body, max_tokens: max };
|
|
127
|
+
const thinking = body.thinking;
|
|
128
|
+
// Extended thinking's budget stays below max_tokens (as clamped); the provider takes no budget below 1024.
|
|
129
|
+
if (isPlain(thinking) && thinking.type === "enabled") {
|
|
130
|
+
const budget = thinking.budget_tokens;
|
|
131
|
+
if (typeof budget !== "number" || !Number.isSafeInteger(budget) || budget <= 0)
|
|
132
|
+
refuse(400, "thinking.budget_tokens must be a positive integer");
|
|
133
|
+
if (budget >= max) {
|
|
134
|
+
if (max <= THINKING_BUDGET_LEAST)
|
|
135
|
+
refuse(400, `thinking.budget_tokens must be below max_tokens (${max} once clamped) and at least ${THINKING_BUDGET_LEAST}`);
|
|
136
|
+
out.thinking = { ...thinking, budget_tokens: max - 1 };
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return out;
|
|
140
|
+
}
|
|
141
|
+
/** The least output a Messages body may be limited to and still answer: 1,024 tokens, and with a thinking budget the
|
|
142
|
+
* provider's least budget beside them. */
|
|
143
|
+
const outputLeast = (body) => (isPlain(body.thinking) && body.thinking.type === "enabled" ? ANSWER_TOKENS_LEAST + THINKING_BUDGET_LEAST : ANSWER_TOKENS_LEAST);
|
|
144
|
+
/** `body` with its output limited to `max` tokens, thinking included; only numbers get smaller, so it is never longer. */
|
|
145
|
+
export function limitGooseOutput(body, max) {
|
|
146
|
+
const asked = outputAsked(body);
|
|
147
|
+
const limited = asked === undefined ? max : Math.min(asked, max);
|
|
148
|
+
const out = { ...body, max_tokens: limited };
|
|
149
|
+
const thought = body.thinking;
|
|
150
|
+
if (isPlain(thought) && thought.type === "enabled" && typeof thought.budget_tokens === "number" && thought.budget_tokens > limited - ANSWER_TOKENS_LEAST) {
|
|
151
|
+
const budget = Math.max(THINKING_BUDGET_LEAST, limited - ANSWER_TOKENS_LEAST);
|
|
152
|
+
if (budget >= limited)
|
|
153
|
+
refuse(400, `max_tokens ${limited} leaves no room for the least thinking budget (${THINKING_BUDGET_LEAST}) and an answer`);
|
|
154
|
+
out.thinking = { ...thought, budget_tokens: budget };
|
|
155
|
+
}
|
|
156
|
+
return out;
|
|
157
|
+
}
|
|
158
|
+
/** The thinking tokens a request may bill that its stream never shows (Claude streams a summary of its thinking): its
|
|
159
|
+
* budget, or its `max_tokens` when its thinking is adaptive; none with thinking off. */
|
|
160
|
+
const reasoningHidden = (body) => {
|
|
161
|
+
const thinking = body.thinking;
|
|
162
|
+
if (!isPlain(thinking))
|
|
163
|
+
return 0;
|
|
164
|
+
if (thinking.type === "enabled")
|
|
165
|
+
return typeof thinking.budget_tokens === "number" && thinking.budget_tokens > 0 ? thinking.budget_tokens : outputAsked(body) ?? 0;
|
|
166
|
+
return thinking.type === "adaptive" ? outputAsked(body) ?? 0 : 0;
|
|
167
|
+
};
|
|
168
|
+
/** One stream event's data, parsed, or undefined. */
|
|
169
|
+
function eventData(event) {
|
|
170
|
+
const data = event.split("\n").filter((line) => line.startsWith("data:")).map((line) => line.slice(5).trimStart()).join("\n");
|
|
171
|
+
if (!data.startsWith("{"))
|
|
172
|
+
return undefined;
|
|
173
|
+
try {
|
|
174
|
+
const parsed = JSON.parse(data);
|
|
175
|
+
return isPlain(parsed) ? parsed : undefined;
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
return undefined;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/** The bytes of a delta's piece in one stream event: of thinking alone (`thinking`), or of text, thinking and tool input. */
|
|
182
|
+
function deltaBytes(event, thinkingOnly) {
|
|
183
|
+
const parsed = eventData(event);
|
|
184
|
+
const delta = parsed?.type === "content_block_delta" && isPlain(parsed.delta) ? parsed.delta : undefined;
|
|
185
|
+
if (!delta)
|
|
186
|
+
return 0;
|
|
187
|
+
const piece = delta.type === "thinking_delta" ? delta.thinking : thinkingOnly ? undefined : delta.type === "text_delta" ? delta.text : delta.type === "input_json_delta" ? delta.partial_json : undefined;
|
|
188
|
+
return typeof piece === "string" ? Buffer.byteLength(piece, "utf8") : 0;
|
|
189
|
+
}
|
|
190
|
+
const tokenCount = (value) => (typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : undefined);
|
|
191
|
+
/** A Messages `usage` object as the proxy books it, or undefined when it says no input or output count. */
|
|
192
|
+
function bookedUsage(usage) {
|
|
193
|
+
if (!isPlain(usage))
|
|
194
|
+
return undefined;
|
|
195
|
+
const input = tokenCount(usage.input_tokens);
|
|
196
|
+
const output = tokenCount(usage.output_tokens);
|
|
197
|
+
if (input === undefined || output === undefined)
|
|
198
|
+
return undefined;
|
|
199
|
+
return { input, output, cacheRead: tokenCount(usage.cache_read_input_tokens) ?? 0, cacheWrite: tokenCount(usage.cache_creation_input_tokens) ?? 0 };
|
|
200
|
+
}
|
|
201
|
+
/** The data lines of a stream, parsed; each on its own, one that does not parse skipped (the proxy keeps only the head
|
|
202
|
+
* and tail of a long answer). Undefined for a whole JSON body. */
|
|
203
|
+
function streamEvents(text) {
|
|
204
|
+
const lines = text.split(/\r?\n/);
|
|
205
|
+
if (!lines.some((line) => line.startsWith("data:") || line.startsWith("event:")))
|
|
206
|
+
return undefined;
|
|
207
|
+
const events = [];
|
|
208
|
+
for (const line of lines) {
|
|
209
|
+
if (!line.startsWith("data:"))
|
|
210
|
+
continue;
|
|
211
|
+
try {
|
|
212
|
+
const event = JSON.parse(line.slice(5));
|
|
213
|
+
if (isPlain(event))
|
|
214
|
+
events.push(event);
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
/* cut at the kept window's edge, or not JSON */
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return events;
|
|
221
|
+
}
|
|
222
|
+
/** The usage a Messages answer reports: a whole body's `usage`, or a stream's `message_start` usage with its last
|
|
223
|
+
* `message_delta` usage over it. A stream that never stopped (no `message_stop` or `error`) is unknown. */
|
|
224
|
+
export function gooseUsage(text) {
|
|
225
|
+
const events = streamEvents(text);
|
|
226
|
+
if (!events) {
|
|
227
|
+
try {
|
|
228
|
+
const body = JSON.parse(text);
|
|
229
|
+
return isPlain(body) ? bookedUsage(body.usage) : undefined;
|
|
230
|
+
}
|
|
231
|
+
catch {
|
|
232
|
+
return undefined;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
if (!events.some((e) => e.type === "message_stop" || e.type === "error"))
|
|
236
|
+
return undefined;
|
|
237
|
+
const started = events.find((e) => e.type === "message_start")?.message;
|
|
238
|
+
const startUsage = isPlain(started) && isPlain(started.usage) ? started.usage : {};
|
|
239
|
+
const lastDelta = events.filter((e) => e.type === "message_delta").at(-1)?.usage;
|
|
240
|
+
return bookedUsage({ ...startUsage, ...(isPlain(lastDelta) ? lastDelta : {}) });
|
|
241
|
+
}
|
|
242
|
+
/** Whether a Messages answer ended on the provider's refusal (`stop_reason: "refusal"`). */
|
|
243
|
+
function filtered(text) {
|
|
244
|
+
const events = streamEvents(text);
|
|
245
|
+
if (!events) {
|
|
246
|
+
try {
|
|
247
|
+
const body = JSON.parse(text);
|
|
248
|
+
return isPlain(body) && body.stop_reason === "refusal";
|
|
249
|
+
}
|
|
250
|
+
catch {
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
const stop = events.filter((e) => e.type === "message_delta" && isPlain(e.delta) && "stop_reason" in e.delta).at(-1)?.delta;
|
|
255
|
+
return stop?.stop_reason === "refusal";
|
|
256
|
+
}
|
|
257
|
+
/** `body` with `text` as a note the model reads after everything Goose sent: a text block at the end of the last user
|
|
258
|
+
* message, or a user message of its own after a last message that is not one. It carries no cache marker. */
|
|
259
|
+
function addNote(body, text) {
|
|
260
|
+
const messages = Array.isArray(body.messages) ? body.messages : [];
|
|
261
|
+
const note = { type: "text", text: `<system-reminder>${text}</system-reminder>` };
|
|
262
|
+
const last = messages.at(-1);
|
|
263
|
+
if (isPlain(last) && last.role === "user") {
|
|
264
|
+
const content = typeof last.content === "string" ? [{ type: "text", text: last.content }] : Array.isArray(last.content) ? last.content : [];
|
|
265
|
+
return { ...body, messages: [...messages.slice(0, -1), { ...last, content: [...content, note] }] };
|
|
266
|
+
}
|
|
267
|
+
return { ...body, messages: [...messages, { role: "user", content: [note] }] };
|
|
268
|
+
}
|
|
269
|
+
/** The input tokens the provider bills for `body` beyond its bytes: the tool-use system prompt when it has tools, and each
|
|
270
|
+
* image at what it is billed as in place of its base64. */
|
|
271
|
+
function serverInputOverhead(body) {
|
|
272
|
+
const choice = isPlain(body.tool_choice) ? body.tool_choice.type : undefined;
|
|
273
|
+
const shape = {
|
|
274
|
+
tools: Array.isArray(body.tools) && body.tools.length > 0,
|
|
275
|
+
...(choice === "auto" || choice === "none" || choice === "any" || choice === "tool" ? { toolChoice: choice } : {}),
|
|
276
|
+
images: messagesImagesIn(body.messages),
|
|
277
|
+
...(typeof body.model === "string" ? { model: body.model } : {}),
|
|
278
|
+
};
|
|
279
|
+
return providerInputOverhead("anthropic-messages", shape);
|
|
280
|
+
}
|
|
281
|
+
/** Goose's provider policy for one session. */
|
|
282
|
+
export function goosePolicy(options) {
|
|
283
|
+
return {
|
|
284
|
+
id: "goose-anthropic",
|
|
285
|
+
routes: gooseRoutes(options.model),
|
|
286
|
+
keyOf: (headers) => String(headers["x-api-key"] ?? ""),
|
|
287
|
+
authHeaders: (credential) => (options.auth === "bearer" ? { authorization: `Bearer ${credential}` } : { "x-api-key": credential }),
|
|
288
|
+
header: (name, value) => {
|
|
289
|
+
if (name !== "anthropic-beta")
|
|
290
|
+
return value;
|
|
291
|
+
const unknown = value.split(",").map((v) => v.trim()).filter((v) => v && !GOOSE_BETAS.has(v));
|
|
292
|
+
if (unknown.length)
|
|
293
|
+
refuse(403, "an anthropic-beta value is not one the pinned Goose sends");
|
|
294
|
+
return value;
|
|
295
|
+
},
|
|
296
|
+
apply: (body) => applyGoose(body, options),
|
|
297
|
+
modelOf: (body) => (typeof body.model === "string" ? body.model : undefined),
|
|
298
|
+
serverInputOverhead,
|
|
299
|
+
countInputLocally: (body) => messagesLocalInputTokens(body),
|
|
300
|
+
inputAfter: (earlier, body) => messagesInputAfter(earlier, body),
|
|
301
|
+
outputAsked,
|
|
302
|
+
outputLeast,
|
|
303
|
+
effortOf: (body) => (isPlain(body.output_config) && typeof body.output_config.effort === "string" && body.output_config.effort ? body.output_config.effort : undefined),
|
|
304
|
+
reasoningHidden,
|
|
305
|
+
reasoningBytesOf: (event) => deltaBytes(event, true),
|
|
306
|
+
contentBytesOf: (event) => deltaBytes(event, false),
|
|
307
|
+
limitOutput: limitGooseOutput,
|
|
308
|
+
addNote,
|
|
309
|
+
usageOf: gooseUsage,
|
|
310
|
+
filtered,
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
/** The proxy option for a Goose adapter (`acpAdapter`'s `proxy`): each Goose process gets a model proxy of its own, on the
|
|
314
|
+
* session's booking, and is pointed at it with ANTHROPIC_HOST (plain http on loopback) and ANTHROPIC_API_KEY, the
|
|
315
|
+
* proxy's own key for the session, never the provider's. A provider stop on its content filter ends the drive. */
|
|
316
|
+
export function gooseProxy(options) {
|
|
317
|
+
return async (session) => {
|
|
318
|
+
const proxy = await startModelProxy({
|
|
319
|
+
policy: goosePolicy({ model: options.model, tools: session.tools, ...(options.maxOutputTokens ? { maxOutputTokens: options.maxOutputTokens } : {}), ...(options.provider.auth ? { auth: options.provider.auth } : {}) }),
|
|
320
|
+
hooks: session.models,
|
|
321
|
+
model: options.model,
|
|
322
|
+
origin: options.provider.origin,
|
|
323
|
+
credential: async () => (await options.provider.credential()) ?? "",
|
|
324
|
+
...(options.price ? { price: options.price } : {}),
|
|
325
|
+
...(options.provider.headers ? { headers: options.provider.headers } : {}),
|
|
326
|
+
...(options.log ? { log: options.log } : {}),
|
|
327
|
+
...(options.fetch ? { fetch: options.fetch } : {}),
|
|
328
|
+
onFiltered: (message) => session.halt(new Error(message)),
|
|
329
|
+
}, randomBytes(32).toString("base64url"));
|
|
330
|
+
return { env: { ANTHROPIC_HOST: proxy.url, ANTHROPIC_API_KEY: proxy.key }, close: () => proxy.close() };
|
|
331
|
+
};
|
|
332
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// The MCP server over stdio, for an ACP agent that takes no MCP over HTTP: a bridge the agent starts as its stdio MCP
|
|
2
|
+
// server, which forwards each JSON-RPC line to the adapter's loopback HTTP server (mcp.ts) and writes back what it
|
|
3
|
+
// answers, its progress notifications among them. Written for AgentRun.
|
|
4
|
+
// - Its endpoint and key come in its environment (AGENTRUN_MCP_URL, AGENTRUN_MCP_KEY), which the adapter gives the agent
|
|
5
|
+
// for it in session/new; nothing else is read.
|
|
6
|
+
// - `notifications/cancelled` aborts the request it names, so a call the agent gave up on is aborted on the server too.
|
|
7
|
+
// - It ends when its stdin does.
|
|
8
|
+
import { createInterface } from "node:readline";
|
|
9
|
+
const url = process.env.AGENTRUN_MCP_URL ?? "";
|
|
10
|
+
const key = process.env.AGENTRUN_MCP_KEY ?? "";
|
|
11
|
+
const inFlight = new Map();
|
|
12
|
+
const write = (message) => void process.stdout.write(`${JSON.stringify(message)}\n`);
|
|
13
|
+
async function forward(message) {
|
|
14
|
+
const controller = new AbortController();
|
|
15
|
+
if (message.id !== undefined)
|
|
16
|
+
inFlight.set(message.id, controller);
|
|
17
|
+
try {
|
|
18
|
+
const response = await fetch(url, {
|
|
19
|
+
method: "POST",
|
|
20
|
+
headers: { authorization: `Bearer ${key}`, "content-type": "application/json", accept: "application/json, text/event-stream" },
|
|
21
|
+
body: JSON.stringify(message),
|
|
22
|
+
signal: controller.signal,
|
|
23
|
+
});
|
|
24
|
+
if (response.status === 202 || message.id === undefined) {
|
|
25
|
+
await response.body?.cancel();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (!(response.headers.get("content-type") ?? "").includes("text/event-stream")) {
|
|
29
|
+
const text = await response.text();
|
|
30
|
+
write(text ? JSON.parse(text) : { jsonrpc: "2.0", id: message.id, error: { code: -32603, message: `the server answered ${response.status}` } });
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
// An event stream: each event's data is one message, written as it comes.
|
|
34
|
+
let buffer = "";
|
|
35
|
+
const decoder = new TextDecoder();
|
|
36
|
+
for await (const chunk of response.body) {
|
|
37
|
+
buffer += decoder.decode(chunk, { stream: true });
|
|
38
|
+
for (let at = buffer.indexOf("\n\n"); at >= 0; at = buffer.indexOf("\n\n")) {
|
|
39
|
+
const event = buffer.slice(0, at);
|
|
40
|
+
buffer = buffer.slice(at + 2);
|
|
41
|
+
const data = event.split("\n").filter((line) => line.startsWith("data:")).map((line) => line.slice(line.startsWith("data: ") ? 6 : 5)).join("\n");
|
|
42
|
+
if (data)
|
|
43
|
+
write(JSON.parse(data));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
if (message.id !== undefined && !controller.signal.aborted)
|
|
49
|
+
write({ jsonrpc: "2.0", id: message.id, error: { code: -32603, message: String(error?.message ?? error).slice(0, 300) } });
|
|
50
|
+
}
|
|
51
|
+
finally {
|
|
52
|
+
if (message.id !== undefined)
|
|
53
|
+
inFlight.delete(message.id);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const lines = createInterface({ input: process.stdin, crlfDelay: Infinity });
|
|
57
|
+
lines.on("line", (line) => {
|
|
58
|
+
if (!line.trim())
|
|
59
|
+
return;
|
|
60
|
+
let message;
|
|
61
|
+
try {
|
|
62
|
+
message = JSON.parse(line);
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
write({ jsonrpc: "2.0", id: null, error: { code: -32700, message: "the line is not JSON" } });
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (message.method === "notifications/cancelled")
|
|
69
|
+
inFlight.get(message.params?.requestId)?.abort();
|
|
70
|
+
void forward(message);
|
|
71
|
+
});
|
|
72
|
+
lines.on("close", () => {
|
|
73
|
+
for (const controller of inFlight.values())
|
|
74
|
+
controller.abort();
|
|
75
|
+
process.exit(0);
|
|
76
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** A tool as the MCP server lists it. */
|
|
2
|
+
export interface McpTool {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: Record<string, unknown>;
|
|
6
|
+
}
|
|
7
|
+
/** A call's answer, as the bridge gives it. */
|
|
8
|
+
export interface McpAnswer {
|
|
9
|
+
text: string;
|
|
10
|
+
isError: boolean;
|
|
11
|
+
images?: readonly {
|
|
12
|
+
mimeType: string;
|
|
13
|
+
data: string;
|
|
14
|
+
}[];
|
|
15
|
+
}
|
|
16
|
+
export interface McpServerOptions {
|
|
17
|
+
tools: readonly McpTool[];
|
|
18
|
+
/** The key the agent sends (`Authorization: Bearer <key>`). */
|
|
19
|
+
key: string;
|
|
20
|
+
/** Run one call: the host tool's own name, the arguments the agent sent, and a signal that aborts when the client goes. */
|
|
21
|
+
call(name: string, args: Record<string, unknown>, signal: AbortSignal): Promise<McpAnswer>;
|
|
22
|
+
/** How often a running call reports progress. Default 15 s. */
|
|
23
|
+
progressMs?: number;
|
|
24
|
+
log?: (message: string, fields?: Record<string, unknown>) => void;
|
|
25
|
+
}
|
|
26
|
+
export interface McpServer {
|
|
27
|
+
/** The endpoint: `/mcp` on the loopback interface, on the port the system chose. */
|
|
28
|
+
readonly url: string;
|
|
29
|
+
/** Waits, at most `ms`, for the calls under way to settle (a host tool's own run, whatever became of its client):
|
|
30
|
+
* true when none is left. */
|
|
31
|
+
settle(ms: number): Promise<boolean>;
|
|
32
|
+
/** Stops the server: the calls under way are aborted, then waited for, at most CLOSE_SETTLE_MS, so none outlives the
|
|
33
|
+
* drive that started it unless it ignores its abort that long. One still running then is let go: its timer stopped,
|
|
34
|
+
* no longer counted by settle(), and its answer, if it ever comes, written nowhere. */
|
|
35
|
+
close(): Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
/** How long close() waits for the calls it aborted to settle. */
|
|
38
|
+
export declare const CLOSE_SETTLE_MS = 5000;
|
|
39
|
+
/** Start the server on the loopback interface, on a port of the system's choosing. */
|
|
40
|
+
export declare function startMcpServer(options: McpServerOptions): Promise<McpServer>;
|