@agntn/harnesses 0.2.0 → 0.3.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 +47 -15
- package/dist/_chunks/agents.mjs +2 -30
- package/dist/_chunks/agents.mjs.map +1 -1
- package/dist/_chunks/libs/typebox.mjs +12 -9
- package/dist/_chunks/libs/typebox.mjs.map +1 -1
- package/dist/_chunks/mcp-servers.mjs +5 -34
- package/dist/_chunks/mcp-servers.mjs.map +1 -1
- package/dist/_chunks/mcp.mjs +13 -163
- package/dist/_chunks/mcp.mjs.map +1 -1
- package/dist/_chunks/output.mjs +28 -0
- package/dist/_chunks/output.mjs.map +1 -0
- package/dist/_chunks/{agents-sync.d.mts → prompt-sync.d.mts} +122 -10
- package/dist/_chunks/prompt-sync.d.mts.map +1 -0
- package/dist/_chunks/{agents-sync.mjs → prompt-sync.mjs} +863 -50
- package/dist/_chunks/prompt-sync.mjs.map +1 -0
- package/dist/_chunks/prompts.mjs +28 -0
- package/dist/_chunks/prompts.mjs.map +1 -0
- package/dist/_chunks/tool-operations.mjs +57 -19
- package/dist/_chunks/tool-operations.mjs.map +1 -1
- package/dist/_chunks/tool-schemas.d.mts +6 -0
- package/dist/_chunks/tool-schemas.d.mts.map +1 -1
- package/dist/_chunks/tool-schemas.mjs +14 -9
- package/dist/_chunks/tool-schemas.mjs.map +1 -1
- package/dist/_chunks/types.mjs +1 -1
- package/dist/_chunks/types.mjs.map +1 -1
- package/dist/cli.mjs +26 -8
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +16 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/mcp.d.mts.map +1 -1
- package/dist/mcp.mjs +179 -1
- package/dist/mcp.mjs.map +1 -0
- package/dist/tool-operations.d.mts +19 -3
- package/dist/tool-operations.d.mts.map +1 -1
- package/dist/tool-operations.mjs +2 -2
- package/dist/tool-schemas.d.mts +2 -2
- package/package.json +16 -14
- package/packages/omp/extensions/harnesses.ts +19 -1
- package/packages/pi/extensions/harnesses.ts +23 -1
- package/packages/shared/tui.ts +22 -1
- package/dist/_chunks/agents-sync.d.mts.map +0 -1
- package/dist/_chunks/agents-sync.mjs.map +0 -1
- package/dist/_chunks/mcp2.mjs +0 -17
- package/dist/_chunks/mcp2.mjs.map +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { promptsSync } from "./tool-operations.mjs";
|
|
2
|
+
import { formatArgs, report } from "./output.mjs";
|
|
3
|
+
import { defineCommand } from "citty";
|
|
4
|
+
var prompts_default = defineCommand({
|
|
5
|
+
meta: { description: "Manage shared prompt templates across harnesses" },
|
|
6
|
+
subCommands: { sync: defineCommand({
|
|
7
|
+
meta: { description: "Sync Markdown templates from the agntn XDG data directory into harness destinations" },
|
|
8
|
+
args: {
|
|
9
|
+
id: {
|
|
10
|
+
type: "positional",
|
|
11
|
+
description: "Harness id",
|
|
12
|
+
required: false
|
|
13
|
+
},
|
|
14
|
+
check: {
|
|
15
|
+
type: "boolean",
|
|
16
|
+
description: "Report what would change without writing anything"
|
|
17
|
+
},
|
|
18
|
+
...formatArgs
|
|
19
|
+
},
|
|
20
|
+
run({ args }) {
|
|
21
|
+
const id = args.id === void 0 ? void 0 : args.id;
|
|
22
|
+
report(promptsSync(id, args.check === true), args);
|
|
23
|
+
}
|
|
24
|
+
}) }
|
|
25
|
+
});
|
|
26
|
+
export { prompts_default as default };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=prompts.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.mjs","names":[],"sources":["../../src/commands/prompts.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { promptsSync } from \"../tool-operations.ts\";\nimport { formatArgs, report } from \"./output.ts\";\n\nexport default defineCommand({\n meta: { description: \"Manage shared prompt templates across harnesses\" },\n subCommands: {\n sync: defineCommand({\n meta: {\n description:\n \"Sync Markdown templates from the agntn XDG data directory into harness destinations\",\n },\n args: {\n id: { type: \"positional\" as const, description: \"Harness id\", required: false },\n check: {\n type: \"boolean\" as const,\n description: \"Report what would change without writing anything\",\n },\n ...formatArgs,\n },\n run({ args }) {\n const id = args.id === undefined ? undefined : (args.id as string);\n report(promptsSync(id, args.check === true), args);\n },\n }),\n },\n});\n"],"mappings":";;;AAIA,IAAA,kBAAe,cAAc;CAC3B,MAAM,EAAE,aAAa,kDAAkD;CACvE,aAAa,EACX,MAAM,cAAc;EAClB,MAAM,EACJ,aACE,sFACJ;EACA,MAAM;GACJ,IAAI;IAAE,MAAM;IAAuB,aAAa;IAAc,UAAU;GAAM;GAC9E,OAAO;IACL,MAAM;IACN,aAAa;GACf;GACA,GAAG;EACL;EACA,IAAI,EAAE,QAAQ;GACZ,MAAM,KAAK,KAAK,OAAO,KAAA,IAAY,KAAA,IAAa,KAAK;GACrD,OAAO,YAAY,IAAI,KAAK,UAAU,IAAI,GAAG,IAAI;EACnD;CACF,CAAC,EACH;AACF,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { addMcpServer, getAllHarnesses, getHarness, isHarnessId, listHarnesses, listMcpServers, readAgentsConfig, readMasterMcpServers, removeMcpServer, syncAgentsFiles, syncMcpServers } from "./
|
|
1
|
+
import { addMcpServer, getAllHarnesses, getHarness, isHarnessId, listHarnesses, listMcpServers, readAgentsConfig, readMasterMcpServers, removeMcpServer, syncAgentsFiles, syncMcpServers, syncPromptTemplates } from "./prompt-sync.mjs";
|
|
2
2
|
import "./tool-schemas.mjs";
|
|
3
|
+
import { stripVTControlCharacters } from "node:util";
|
|
3
4
|
import { encode } from "@toon-format/toon";
|
|
4
5
|
const RUN_DEFAULT_TIMEOUT_SECONDS = 600;
|
|
5
6
|
const RUN_MAX_OUTPUT_CHARS = 8e3;
|
|
@@ -27,9 +28,6 @@ function truncate(output) {
|
|
|
27
28
|
if (output.length <= 8e3) return output;
|
|
28
29
|
return `${output.slice(0, RUN_MAX_OUTPUT_CHARS)}\n[truncated ${output.length - RUN_MAX_OUTPUT_CHARS} of ${output.length} characters]`;
|
|
29
30
|
}
|
|
30
|
-
function modelListingUnavailable(harness, id) {
|
|
31
|
-
return { error: harness.modelListing ? `Harness ${id} does not support filtering its model listing` : `Harness ${id} does not support model listing` };
|
|
32
|
-
}
|
|
33
31
|
const ALTERNATE_INVOCATION_MODE = {
|
|
34
32
|
advisor: "agent",
|
|
35
33
|
advisorStructured: "agentStructured",
|
|
@@ -54,6 +52,21 @@ function invocationRetry(invocationModes, mode, options) {
|
|
|
54
52
|
const alternateMode = ALTERNATE_INVOCATION_MODE[mode];
|
|
55
53
|
return alternateMode !== void 0 && invocationModes[alternateMode] ? { tools: !options.tools } : void 0;
|
|
56
54
|
}
|
|
55
|
+
const OUTPUT_CONTROLS = /[\u0000-\u0008\u000B-\u001F\u007F-\u009F]/g;
|
|
56
|
+
function plainOutput(output) {
|
|
57
|
+
return stripVTControlCharacters(output).replaceAll("\r\n", "\n").replace(OUTPUT_CONTROLS, " ");
|
|
58
|
+
}
|
|
59
|
+
function runText(outcome, streams) {
|
|
60
|
+
const blocks = [encode(outcome)];
|
|
61
|
+
for (const name of ["stdout", "stderr"]) {
|
|
62
|
+
const output = streams[name];
|
|
63
|
+
if (output !== void 0 && output.length > 0) blocks.push(`${name}:\n${plainOutput(output)}`);
|
|
64
|
+
}
|
|
65
|
+
return [{
|
|
66
|
+
type: "text",
|
|
67
|
+
text: blocks.join("\n\n")
|
|
68
|
+
}];
|
|
69
|
+
}
|
|
57
70
|
function completedRun(harness, result, options, templateArgs) {
|
|
58
71
|
const contentOutcome = {
|
|
59
72
|
id: harness.id,
|
|
@@ -66,27 +79,26 @@ function completedRun(harness, result, options, templateArgs) {
|
|
|
66
79
|
exitCode: result.exitCode,
|
|
67
80
|
timedOut: result.timedOut,
|
|
68
81
|
aborted: result.aborted,
|
|
69
|
-
|
|
82
|
+
...result.idleMs === void 0 ? {} : { idleMs: result.idleMs }
|
|
70
83
|
};
|
|
84
|
+
const stdout = truncate(result.stdout);
|
|
71
85
|
const stderr = truncate(result.stderr);
|
|
72
86
|
const details = {
|
|
73
87
|
...contentOutcome,
|
|
74
88
|
args: result.args,
|
|
89
|
+
stdout,
|
|
75
90
|
stderr
|
|
76
91
|
};
|
|
77
92
|
if (result.timedOut || result.exitCode !== 0) return {
|
|
78
|
-
content:
|
|
79
|
-
|
|
93
|
+
content: runText(contentOutcome, {
|
|
94
|
+
stdout,
|
|
80
95
|
stderr
|
|
81
96
|
}),
|
|
82
97
|
details,
|
|
83
98
|
isError: true
|
|
84
99
|
};
|
|
85
100
|
return {
|
|
86
|
-
content:
|
|
87
|
-
...contentOutcome,
|
|
88
|
-
stderr
|
|
89
|
-
}),
|
|
101
|
+
content: runText(contentOutcome, stdout.length > 0 ? { stdout } : { stderr }),
|
|
90
102
|
details
|
|
91
103
|
};
|
|
92
104
|
}
|
|
@@ -146,7 +158,11 @@ function harnessInfoResult(id) {
|
|
|
146
158
|
instructions: harness.instructions,
|
|
147
159
|
skills: harness.skills,
|
|
148
160
|
commands: harness.commands,
|
|
161
|
+
promptTemplates: harness.promptTemplates,
|
|
162
|
+
promptTemplateSyncTarget: harness.promptTemplateSyncTarget,
|
|
149
163
|
hooks: harness.hooks,
|
|
164
|
+
temp: harness.temp,
|
|
165
|
+
envOverrides: harness.envOverrides,
|
|
150
166
|
persistence: harness.persistence,
|
|
151
167
|
detection: harness.detection,
|
|
152
168
|
resolved: harness.resolve()
|
|
@@ -154,7 +170,7 @@ function harnessInfoResult(id) {
|
|
|
154
170
|
}
|
|
155
171
|
function harnessInfoText(result) {
|
|
156
172
|
if ("error" in result) return result;
|
|
157
|
-
const { id, name, binaries, capabilities, invocationModes, modelListing, modelSelection, persistence, detection, resolved } = result;
|
|
173
|
+
const { id, name, binaries, capabilities, invocationModes, modelListing, modelSelection, envOverrides, persistence, detection, resolved } = result;
|
|
158
174
|
return {
|
|
159
175
|
id,
|
|
160
176
|
name,
|
|
@@ -163,6 +179,7 @@ function harnessInfoText(result) {
|
|
|
163
179
|
invocationModes,
|
|
164
180
|
modelListing,
|
|
165
181
|
modelSelection,
|
|
182
|
+
envOverrides: getHarness(id).resolveCandidates(envOverrides),
|
|
166
183
|
persistence,
|
|
167
184
|
detection,
|
|
168
185
|
resolved
|
|
@@ -196,7 +213,7 @@ async function listHarnessModels(id, options = {}) {
|
|
|
196
213
|
if (!isHarnessId(id)) return unknownHarness(id);
|
|
197
214
|
const harness = getHarness(id);
|
|
198
215
|
if (!harness.buildModelListInvocation(options.search)) {
|
|
199
|
-
const details =
|
|
216
|
+
const details = { error: `Harness ${id} does not support model listing` };
|
|
200
217
|
return {
|
|
201
218
|
content: text(details),
|
|
202
219
|
details,
|
|
@@ -220,15 +237,19 @@ async function listHarnessModels(id, options = {}) {
|
|
|
220
237
|
isError: true
|
|
221
238
|
};
|
|
222
239
|
}
|
|
240
|
+
return completedListing(harness.id, result, result.models, options.search);
|
|
241
|
+
}
|
|
242
|
+
function completedListing(id, result, models, search) {
|
|
223
243
|
const details = {
|
|
224
|
-
id
|
|
244
|
+
id,
|
|
225
245
|
command: result.command,
|
|
226
|
-
args: result.args,
|
|
227
|
-
...
|
|
228
|
-
models:
|
|
246
|
+
args: [...result.args],
|
|
247
|
+
...search === void 0 ? {} : { search },
|
|
248
|
+
models: [...models],
|
|
229
249
|
exitCode: result.exitCode,
|
|
230
250
|
timedOut: result.timedOut,
|
|
231
251
|
aborted: result.aborted,
|
|
252
|
+
...result.idleMs === void 0 ? {} : { idleMs: result.idleMs },
|
|
232
253
|
stderr: truncate(result.stderr)
|
|
233
254
|
};
|
|
234
255
|
return {
|
|
@@ -241,7 +262,7 @@ function normalizedRunAccess(options) {
|
|
|
241
262
|
const readOnly = options.readOnly ?? false;
|
|
242
263
|
return {
|
|
243
264
|
readOnly,
|
|
244
|
-
tools:
|
|
265
|
+
tools: options.tools ?? readOnly
|
|
245
266
|
};
|
|
246
267
|
}
|
|
247
268
|
async function runHarness(id, prompt, options = {}) {
|
|
@@ -414,6 +435,23 @@ function agentsSync(id, check = false) {
|
|
|
414
435
|
};
|
|
415
436
|
}
|
|
416
437
|
}
|
|
417
|
-
|
|
438
|
+
function promptsSync(id, check = false) {
|
|
439
|
+
if (id !== void 0 && !isHarnessId(id)) return unknownHarness(id);
|
|
440
|
+
try {
|
|
441
|
+
const details = syncPromptTemplates(id !== void 0 && isHarnessId(id) ? [getHarness(id)] : getAllHarnesses(), check);
|
|
442
|
+
return {
|
|
443
|
+
content: text(details),
|
|
444
|
+
details
|
|
445
|
+
};
|
|
446
|
+
} catch (error) {
|
|
447
|
+
const details = { error: errorMessage(error) };
|
|
448
|
+
return {
|
|
449
|
+
content: text(details),
|
|
450
|
+
details,
|
|
451
|
+
isError: true
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
export { RUN_DEFAULT_TIMEOUT_SECONDS, RUN_MAX_OUTPUT_CHARS, agentsSync, detectHarnesses, harnessInfo, listHarnessModels, mcpAdd, mcpList, mcpRemove, mcpSync, promptsSync, runHarness, toMcpServerConfig };
|
|
418
456
|
|
|
419
457
|
//# sourceMappingURL=tool-operations.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-operations.mjs","names":["toToon"],"sources":["../../src/tool-operations.ts"],"sourcesContent":["/**\n * Tool executors behind the agent extensions.\n *\n * Each executor returns the text a caller reads plus the structured details a\n * harness can attach to the call. The text is TOON-encoded so the model sees\n * the same compact shape the CLI's --toon flag prints.\n */\nimport { encode as toToon } from \"@toon-format/toon\";\nimport { getAllHarnesses, getHarness, isHarnessId, listHarnesses } from \"./registry.ts\";\nimport {\n addMcpServer,\n listMcpServers,\n readMasterMcpServers,\n removeMcpServer,\n syncMcpServers,\n} from \"./mcp-servers.ts\";\nimport type { McpConfigListing, SyncReport } from \"./mcp-servers.ts\";\nimport { readAgentsConfig, syncAgentsFiles } from \"./agents-sync.ts\";\nimport type { AgentsSyncReport } from \"./agents-sync.ts\";\nexport type { AgentsSyncReport } from \"./agents-sync.ts\";\nexport type { SyncReport } from \"./mcp-servers.ts\";\nexport type { HarnessInvocationModes } from \"./types.ts\";\nimport type { Harness } from \"./harness.ts\";\nimport type {\n AvailableModel,\n HarnessCapabilities,\n HarnessDetection,\n HarnessId,\n HarnessInvocationModes,\n InvokeResult,\n ListModelsResult,\n McpServerConfig,\n PathCandidate,\n ResolvedPaths,\n StorageDescriptor,\n} from \"./types.ts\";\n\n/** Text for the model plus details for the harness, shared by every tool surface. */\nexport interface ToolResult<Details> {\n content: Array<{ type: \"text\"; text: string }>;\n details: Details;\n /** Set when the tool could not answer. */\n isError?: boolean;\n}\n\n/** Install state of one harness on this machine. */\nexport interface HarnessStatus {\n id: HarnessId;\n name: string;\n installed: boolean;\n version: string | null;\n}\n\n/** Every registered harness with its install state, as scanned by {@link detectHarnesses}. */\nexport interface HarnessListing {\n harnesses: HarnessStatus[];\n}\n\n/** Full metadata for one harness, including paths resolved for this platform. */\nexport interface HarnessMetadata {\n id: HarnessId;\n name: string;\n binaries: string[];\n capabilities: HarnessCapabilities;\n invocationModes: HarnessInvocationModes;\n modelListing: boolean;\n modelSelection: boolean;\n config: PathCandidate[];\n sessions: PathCandidate[];\n instructions: PathCandidate[];\n skills: PathCandidate[];\n commands: PathCandidate[];\n hooks: PathCandidate[];\n persistence: StorageDescriptor[];\n detection: HarnessDetection;\n resolved: ResolvedPaths;\n}\n\n/** Returned when the requested harness id is not registered. */\nexport interface UnknownHarness {\n error: string;\n known: HarnessId[];\n}\n\n/** Returned when a direct batch call bypasses the tool schema limits. */\nexport interface HarnessInfoInputError {\n error: string;\n}\n\n/** One harness lookup result. */\nexport type HarnessInfoResult = HarnessMetadata | UnknownHarness;\n\n/** Scalar, batch, or rejected batch details from {@link harnessInfo}. */\nexport type HarnessInfoDetails = HarnessInfoResult | HarnessInfoResult[] | HarnessInfoInputError;\n\nimport { HARNESS_INFO_MAX_ITEMS, RUN_TIMEOUT_DEFAULT_SECONDS } from \"./tool-schemas.ts\";\nexport { HARNESS_INFO_MAX_ITEMS } from \"./tool-schemas.ts\";\n\n/** Default wall-clock budget for one harness run, in seconds. */\nexport const RUN_DEFAULT_TIMEOUT_SECONDS = RUN_TIMEOUT_DEFAULT_SECONDS;\n\n/** The run tool's per-stream cap: harness output is unbounded, model context is not. */\nexport const RUN_MAX_OUTPUT_CHARS = 8000;\n\nfunction text(data: unknown): Array<{ type: \"text\"; text: string }> {\n return [{ type: \"text\", text: toToon(data) }];\n}\n\nfunction unknownHarness(id: string): ToolResult<UnknownHarness> {\n const details: UnknownHarness = { error: `Unknown harness: ${id}`, known: listHarnesses() };\n return { content: text(details), details, isError: true };\n}\n\nfunction errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\nfunction truncate(output: string): string {\n if (output.length <= RUN_MAX_OUTPUT_CHARS) return output;\n return `${output.slice(0, RUN_MAX_OUTPUT_CHARS)}\\n[truncated ${output.length - RUN_MAX_OUTPUT_CHARS} of ${output.length} characters]`;\n}\n\nfunction modelListingUnavailable(harness: Harness, id: string): RunFailure {\n return {\n error: harness.modelListing\n ? `Harness ${id} does not support filtering its model listing`\n : `Harness ${id} does not support model listing`,\n };\n}\n\ntype RunInvocationOptions = Readonly<{\n model?: string;\n structured: boolean;\n tools: boolean;\n readOnly: boolean;\n}>;\n\ntype InvocationMode = keyof HarnessInvocationModes;\n\nconst ALTERNATE_INVOCATION_MODE: Partial<Record<InvocationMode, InvocationMode>> = {\n advisor: \"agent\",\n advisorStructured: \"agentStructured\",\n agent: \"advisor\",\n agentStructured: \"advisorStructured\",\n};\n\nfunction selectedInvocationMode(\n structured: boolean,\n tools: boolean,\n readOnly: boolean,\n): InvocationMode {\n if (readOnly) return structured ? \"readOnlyStructured\" : \"readOnly\";\n if (tools) return structured ? \"agentStructured\" : \"agent\";\n return structured ? \"advisorStructured\" : \"advisor\";\n}\n\nfunction invocationRetry(\n invocationModes: Readonly<HarnessInvocationModes>,\n mode: InvocationMode,\n options: RunInvocationOptions,\n): RunFailure[\"retry\"] {\n const withoutStructured = selectedInvocationMode(false, options.tools, options.readOnly);\n if (options.structured) {\n if (invocationModes[withoutStructured]) return { structured: false };\n const alternateWithoutStructured = ALTERNATE_INVOCATION_MODE[withoutStructured];\n if (alternateWithoutStructured && invocationModes[alternateWithoutStructured]) {\n return { structured: false, tools: !options.tools };\n }\n }\n\n const alternateMode = ALTERNATE_INVOCATION_MODE[mode];\n return alternateMode !== undefined && invocationModes[alternateMode]\n ? { tools: !options.tools }\n : undefined;\n}\n\nfunction completedRun(\n harness: Harness,\n result: InvokeResult,\n options: RunInvocationOptions,\n templateArgs: readonly string[],\n): ToolResult<RunOutcome> {\n const contentOutcome: Omit<RunOutcome, \"stderr\"> = {\n id: harness.id,\n command: result.command,\n args: [...templateArgs],\n ...(options.model === undefined ? {} : { model: options.model }),\n structured: options.structured,\n tools: options.tools,\n readOnly: options.readOnly,\n exitCode: result.exitCode,\n timedOut: result.timedOut,\n aborted: result.aborted,\n stdout: truncate(result.stdout),\n };\n const stderr = truncate(result.stderr);\n const details: RunOutcome = { ...contentOutcome, args: result.args, stderr };\n if (result.timedOut || result.exitCode !== 0) {\n return { content: text({ ...contentOutcome, stderr }), details, isError: true };\n }\n return {\n content: text(result.stdout.length > 0 ? contentOutcome : { ...contentOutcome, stderr }),\n details,\n };\n}\n\nfunction unsupportedInvocation(\n harness: Harness,\n id: string,\n options: RunInvocationOptions,\n): ToolResult<RunFailure> {\n const error = harness.invocationError(options) ?? `Invalid ${id} invocation`;\n const invocationModes = harness.invocationModes;\n const mode = selectedInvocationMode(options.structured, options.tools, options.readOnly);\n const modelUnsupported =\n options.model !== undefined && harness.invocation?.modelArgs === undefined;\n if (invocationModes[mode] || harness.invocation === null || modelUnsupported) {\n const details: RunFailure = { error };\n return { content: text(details), details, isError: true };\n }\n\n const retry = invocationRetry(invocationModes, mode, options);\n const details: RunFailure = {\n error,\n invocationModes,\n ...(retry === undefined ? {} : { retry }),\n };\n return { content: text(details), details, isError: true };\n}\n\n/**\n * Scans every registered harness for its binaries and version.\n *\n * @returns {ToolResult<HarnessListing>} The complete installation listing.\n */\nexport function detectHarnesses(): ToolResult<HarnessListing> {\n const details: HarnessListing = {\n harnesses: getAllHarnesses().map((harness) => {\n const installed = harness.isInstalled();\n return {\n id: harness.id,\n name: harness.name,\n installed,\n version: installed ? harness.version : null,\n };\n }),\n };\n\n return { content: text(details), details };\n}\n\nfunction harnessInfoResult(id: string): HarnessInfoResult {\n if (!isHarnessId(id)) return unknownHarness(id).details;\n\n const harness = getHarness(id);\n return {\n id: harness.id,\n name: harness.name,\n binaries: harness.binaries,\n capabilities: harness.capabilities,\n invocationModes: harness.invocationModes,\n modelListing: harness.modelListing !== null,\n modelSelection: harness.invocation?.modelArgs !== undefined,\n config: harness.config,\n sessions: harness.sessions,\n instructions: harness.instructions,\n skills: harness.skills,\n commands: harness.commands,\n hooks: harness.hooks,\n persistence: harness.persistence,\n detection: harness.detection,\n resolved: harness.resolve(),\n };\n}\n\n/** One lookup as the model reads it: every path list once, in {@link HarnessMetadata.resolved}. */\ntype HarnessInfoText =\n | Omit<HarnessMetadata, \"config\" | \"sessions\" | \"instructions\" | \"skills\" | \"commands\" | \"hooks\">\n | UnknownHarness;\n\n/**\n * Leaves the path templates out of the text: `resolved` already carries each\n * of them for this machine, so they only doubled every answer.\n *\n * @param result - One lookup result.\n * @returns {HarnessInfoText} The lookup with its path lists shown once.\n */\nfunction harnessInfoText(result: HarnessInfoResult): HarnessInfoText {\n if (\"error\" in result) return result;\n const {\n id,\n name,\n binaries,\n capabilities,\n invocationModes,\n modelListing,\n modelSelection,\n persistence,\n detection,\n resolved,\n } = result;\n return {\n id,\n name,\n binaries,\n capabilities,\n invocationModes,\n modelListing,\n modelSelection,\n persistence,\n detection,\n resolved,\n };\n}\n\n/** Full metadata for one harness, with paths resolved for the current platform. */\nexport function harnessInfo(id: string): ToolResult<HarnessInfoResult>;\n/** Full metadata for several harnesses, preserving input order and errors for each item. */\nexport function harnessInfo(\n ids: readonly string[],\n): ToolResult<HarnessInfoResult[] | HarnessInfoInputError>;\nexport function harnessInfo(input: string | readonly string[]): ToolResult<HarnessInfoDetails>;\nexport function harnessInfo(input: string | readonly string[]): ToolResult<HarnessInfoDetails> {\n if (typeof input === \"string\") {\n const details = harnessInfoResult(input);\n return {\n content: text(harnessInfoText(details)),\n details,\n ...(\"error\" in details ? { isError: true } : {}),\n };\n }\n\n if (input.length < 1 || input.length > HARNESS_INFO_MAX_ITEMS) {\n const details: HarnessInfoInputError = {\n error: `harnesses_info accepts between 1 and ${HARNESS_INFO_MAX_ITEMS} ids`,\n };\n return { content: text(details), details, isError: true };\n }\n\n const details = input.map(harnessInfoResult);\n return {\n content: text(details.map(harnessInfoText)),\n details,\n ...(details.some((result) => \"error\" in result) ? { isError: true } : {}),\n };\n}\n\n/** Options accepted by {@link listHarnessModels}. */\nexport interface ModelsOptions {\n search?: string;\n cwd?: string;\n /** Wall-clock budget in seconds; defaults to {@link RUN_DEFAULT_TIMEOUT_SECONDS}. */\n timeoutSeconds?: number;\n /** Cancel the owned command through the host request signal. */\n signal?: AbortSignal;\n}\n\n/** One completed native model-listing query. */\nexport interface ModelsOutcome {\n id: HarnessId;\n command: string;\n args: string[];\n search?: string;\n models: AvailableModel[];\n exitCode: number | null;\n timedOut: boolean;\n aborted: boolean;\n stderr: string;\n}\n\n/**\n * Lists the models currently available to one harness through its native CLI.\n *\n * @param id - Harness id to query.\n * @param options - Search, working-directory, and timeout options.\n * @returns {Promise<ToolResult<ModelsOutcome | RunFailure>>} The model listing or failure.\n */\nexport async function listHarnessModels(\n id: string,\n options: ModelsOptions = {},\n): Promise<ToolResult<ModelsOutcome | RunFailure>> {\n if (!isHarnessId(id)) return unknownHarness(id);\n\n const harness = getHarness(id);\n const built = harness.buildModelListInvocation(options.search);\n if (!built) {\n const details = modelListingUnavailable(harness, id);\n return { content: text(details), details, isError: true };\n }\n\n const timeoutSeconds = options.timeoutSeconds ?? RUN_DEFAULT_TIMEOUT_SECONDS;\n let result: ListModelsResult;\n try {\n result = await harness.listModels({\n search: options.search,\n cwd: options.cwd,\n timeoutMs: timeoutSeconds * 1000,\n signal: options.signal,\n });\n } catch (error) {\n const details: RunFailure = { error: `Failed to list ${id} models: ${errorMessage(error)}` };\n return { content: text(details), details, isError: true };\n }\n\n const details: ModelsOutcome = {\n id: harness.id,\n command: result.command,\n args: result.args,\n ...(options.search === undefined ? {} : { search: options.search }),\n models: result.models,\n exitCode: result.exitCode,\n timedOut: result.timedOut,\n aborted: result.aborted,\n stderr: truncate(result.stderr),\n };\n\n return {\n content: text(details),\n details,\n ...(result.timedOut || result.exitCode !== 0 ? { isError: true } : {}),\n };\n}\n\n/** Options accepted by {@link runHarness}. */\nexport interface RunOptions {\n cwd?: string;\n /** Harness-native model id or selector. */\n model?: string;\n /** Wall-clock budget in seconds; defaults to {@link RUN_DEFAULT_TIMEOUT_SECONDS}. */\n timeoutSeconds?: number;\n /** Cancel the owned command through the host request signal. */\n signal?: AbortSignal;\n /** Use the harness's structured (JSON) output mode instead of plain text. */\n structured?: boolean;\n /** Enable tools; defaults to a native advisor without tools invocation. */\n tools?: boolean;\n /** Require native enforcement of read-only tool access. Implies tools. */\n readOnly?: boolean;\n}\n\n/** One completed (or failed) harness run, with output capped for the model. */\nexport interface RunOutcome {\n id: HarnessId;\n command: string;\n /** Expanded arguments; the model's text keeps \"{prompt}\" instead, it wrote the prompt itself. */\n args: string[];\n model?: string;\n structured: boolean;\n tools: boolean;\n readOnly: boolean;\n exitCode: number | null;\n timedOut: boolean;\n aborted: boolean;\n stdout: string;\n stderr: string;\n}\n\n/** Returned when the harness cannot be run at all. */\nexport interface RunFailure {\n error: string;\n known?: HarnessId[];\n /** Modes accepted by the selected harness when invocation mode caused the failure. */\n invocationModes?: HarnessInvocationModes;\n /** Explicit mode change that makes the same invocation shape executable. */\n retry?: { structured: false; tools?: boolean } | { tools: boolean };\n}\n\nfunction normalizedRunAccess(options: Readonly<RunOptions>): {\n tools: boolean;\n readOnly: boolean;\n} {\n const readOnly = options.readOnly ?? false;\n return { readOnly, tools: readOnly ? true : (options.tools ?? false) };\n}\n\n/**\n * Runs one prompt through a harness's normalized non-interactive invocation.\n *\n * Tool use defaults to a native advisor without tools invocation. Harnesses that\n * cannot disable tools reject that mode; setting `tools` selects their full\n * agent invocation. `model` is translated through the harness-specific recipe.\n * This layer also closes stdin, enforces the timeout, caps the echoed output,\n * and leaves the prompt out of the echoed invocation.\n *\n * @param id - Harness id to run.\n * @param prompt - Prompt sent to the selected harness.\n * @param options - Model, mode, working-directory, and timeout options.\n * @returns {Promise<ToolResult<RunOutcome | RunFailure>>} The capped run outcome or failure.\n */\nexport async function runHarness(\n id: string,\n prompt: string,\n options: RunOptions = {},\n): Promise<ToolResult<RunOutcome | RunFailure>> {\n if (!isHarnessId(id)) return unknownHarness(id);\n\n const harness = getHarness(id);\n const structured = options.structured ?? false;\n const { tools, readOnly } = normalizedRunAccess(options);\n const invocationOptions = { model: options.model, structured, tools, readOnly };\n const template = harness.buildInvocation(\"{prompt}\", invocationOptions);\n if (!template) {\n return unsupportedInvocation(harness, id, invocationOptions);\n }\n\n const timeoutSeconds = options.timeoutSeconds ?? RUN_DEFAULT_TIMEOUT_SECONDS;\n\n let result: InvokeResult;\n try {\n result = await harness.invoke(prompt, {\n cwd: options.cwd,\n model: options.model,\n timeoutMs: timeoutSeconds * 1000,\n signal: options.signal,\n structured,\n tools,\n readOnly,\n });\n } catch (error) {\n const details: RunFailure = { error: `Failed to run ${id}: ${errorMessage(error)}` };\n return { content: text(details), details, isError: true };\n }\n\n return completedRun(harness, result, invocationOptions, template.args);\n}\n\n/** MCP server listings for one harness or all of them. */\nexport interface McpListing {\n harnesses: Array<{ id: HarnessId; configs: McpConfigListing[] }>;\n}\n\n/** Marker used only at the tool and CLI boundary, leaving config reads lossless for edits. */\nconst MCP_REDACTED_VALUE = \"<redacted>\";\nconst MCP_CONFIG_ERROR = \"Unable to read or parse MCP config\";\n\nfunction redactMcpValues(values: Readonly<Record<string, string>>): Record<string, string> {\n return Object.fromEntries(Object.keys(values).map((key) => [key, MCP_REDACTED_VALUE]));\n}\n\n/** Result of one MCP config mutation. */\nexport interface McpMutation {\n id: HarnessId;\n path: string;\n action: \"added\" | \"replaced\" | \"removed\" | \"noop\";\n}\n\n/** Flat tool parameters describing one MCP server, shared by every surface. */\nexport interface McpServerParams {\n name: string;\n transport?: McpServerConfig[\"transport\"];\n command?: string;\n args?: string[];\n env?: Record<string, string>;\n url?: string;\n headers?: Record<string, string>;\n}\n\n/**\n * Builds the normalized server shape from flat tool parameters.\n *\n * @param params - Flat MCP server parameters.\n * @returns {McpServerConfig} The normalized server configuration.\n */\nexport function toMcpServerConfig(params: McpServerParams): McpServerConfig {\n const server: McpServerConfig = {\n name: params.name,\n transport: params.transport ?? (params.url ? \"http\" : \"stdio\"),\n };\n if (params.command !== undefined) server.command = params.command;\n if (params.args !== undefined) server.args = params.args;\n if (params.env !== undefined) server.env = params.env;\n if (params.url !== undefined) server.url = params.url;\n if (params.headers !== undefined) server.headers = params.headers;\n return server;\n}\n\n/**\n * Lists configured MCP servers, normalized across harness config dialects.\n *\n * @param id - Optional harness id; omission lists every harness.\n * @returns {ToolResult<McpListing | UnknownHarness>} The normalized listing or id error.\n */\nexport function mcpList(id?: string): ToolResult<McpListing | UnknownHarness> {\n if (id !== undefined && !isHarnessId(id)) return unknownHarness(id);\n\n const targets = id !== undefined && isHarnessId(id) ? [getHarness(id)] : getAllHarnesses();\n const details: McpListing = {\n harnesses: targets\n .map((harness) => ({\n id: harness.id,\n configs: listMcpServers(harness).map((listing) => ({\n ...listing,\n ...(listing.error === undefined ? {} : { error: MCP_CONFIG_ERROR }),\n servers: listing.servers.map((server) => ({\n ...server,\n ...(server.env === undefined ? {} : { env: redactMcpValues(server.env) }),\n ...(server.headers === undefined ? {} : { headers: redactMcpValues(server.headers) }),\n })),\n })),\n }))\n .filter((entry) => entry.configs.length > 0),\n };\n\n return { content: text(details), details };\n}\n\nfunction mcpMutate(\n id: string,\n mutate: (harness: Harness) => { path: string; action: McpMutation[\"action\"] },\n): ToolResult<McpMutation | RunFailure> {\n if (!isHarnessId(id)) return unknownHarness(id);\n\n try {\n const { path, action } = mutate(getHarness(id));\n const details: McpMutation = { id, path, action };\n return { content: text(details), details, ...(action === \"noop\" ? { isError: true } : {}) };\n } catch (error) {\n const details: RunFailure = { error: errorMessage(error) };\n return { content: text(details), details, isError: true };\n }\n}\n\n/**\n * Adds or replaces one MCP server in a harness's config.\n *\n * @param id - Target harness id.\n * @param params - Server parameters to normalize and write.\n * @param scope - User or project config scope.\n * @returns {ToolResult<McpMutation | RunFailure>} The mutation outcome or failure.\n */\nexport function mcpAdd(\n id: string,\n params: McpServerParams,\n scope: \"user\" | \"project\" = \"user\",\n): ToolResult<McpMutation | RunFailure> {\n return mcpMutate(id, (harness) => {\n const { path, replaced } = addMcpServer(harness, toMcpServerConfig(params), scope);\n return { path, action: replaced ? \"replaced\" : \"added\" };\n });\n}\n\n/**\n * Removes one MCP server from a harness's config.\n *\n * @param id - Target harness id.\n * @param name - Server name to remove.\n * @param scope - User or project config scope.\n * @returns {ToolResult<McpMutation | RunFailure>} The mutation outcome or failure.\n */\nexport function mcpRemove(\n id: string,\n name: string,\n scope: \"user\" | \"project\" = \"user\",\n): ToolResult<McpMutation | RunFailure> {\n return mcpMutate(id, (harness) => {\n const { path, removed } = removeMcpServer(harness, name, scope);\n return { path, action: removed ? \"removed\" : \"noop\" };\n });\n}\n\n/**\n * Pushes the master MCP list from ~/.config/agntn/mcp.jsonc into harness configs.\n *\n * @param id - Optional harness id; omission targets every harness.\n * @returns {ToolResult<SyncReport | RunFailure>} The sync report or failure.\n */\nexport function mcpSync(id?: string): ToolResult<SyncReport | RunFailure> {\n if (id !== undefined && !isHarnessId(id)) return unknownHarness(id);\n\n try {\n // Preflight before any write: a typo in excludes must fail the whole run,\n // not silently leave the misspelled harness unprotected.\n const unknown = readMasterMcpServers().excludes.filter((entry) => !isHarnessId(entry));\n if (unknown.length > 0) {\n const details: RunFailure = {\n error: `Master MCP list excludes unknown harnesses: ${unknown.join(\", \")}`,\n known: listHarnesses(),\n };\n return { content: text(details), details, isError: true };\n }\n const details = syncMcpServers(\n id !== undefined && isHarnessId(id) ? [getHarness(id)] : getAllHarnesses(),\n );\n return { content: text(details), details };\n } catch (error) {\n const details: RunFailure = { error: errorMessage(error) };\n return { content: text(details), details, isError: true };\n }\n}\n\n/**\n * Links every harness's global instructions file to the master AGENTS.md.\n *\n * @param id - Optional harness id; omission targets every harness.\n * @param check - Report intended changes without writing them.\n * @returns {ToolResult<AgentsSyncReport | RunFailure>} The sync report or failure.\n */\nexport function agentsSync(id?: string, check = false): ToolResult<AgentsSyncReport | RunFailure> {\n if (id !== undefined && !isHarnessId(id)) return unknownHarness(id);\n\n try {\n // Preflight before any write: a typo in excludes must fail the whole run,\n // not silently adopt the harness it was meant to protect.\n const unknown = readAgentsConfig().excludes.filter((entry) => !isHarnessId(entry));\n if (unknown.length > 0) {\n const details: RunFailure = {\n error: `Agents config excludes unknown harnesses: ${unknown.join(\", \")}`,\n known: listHarnesses(),\n };\n return { content: text(details), details, isError: true };\n }\n const details = syncAgentsFiles(\n id !== undefined && isHarnessId(id) ? [getHarness(id)] : getAllHarnesses(),\n check,\n );\n return { content: text(details), details };\n } catch (error) {\n const details: RunFailure = { error: errorMessage(error) };\n return { content: text(details), details, isError: true };\n }\n}\n"],"mappings":";;;;;;;;EAmGA,MAAa,OAAA,IAAA;;AAGb;AAEA,SAAS,eAA2D,IAAA;CAClE,MAAA,UAAQ;EAAE,OAAM,oBAAA;EAAQ,OAAMA,cAAW;CAAE;CAC7C,OAAA;EAEA,SAAS,KAAA,OAAA;EACP;EAAkC,SAAO;CAA0B;AAAuB;AAC1F,SAAO,aAAA,OAAA;CAAE,OAAA,iBAAqB,QAAA,MAAA,UAAA,OAAA,KAAA;AAAG;AAAS,SAAA,SAAS,QAAA;CAA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A,CAAA,IAAA,gBAAA,CAAA;EACd,OAAM;GACN,SAAO,KAAA,OAAA;GAAE;EAAwB;CAAS,SAAA,OAAS;EAAK,MAAA,UAAA,EAAA,OAAA,aAAA,KAAA,EAAA;EAC1D,OAAA;GACF,SAAA,KAAA,OAAA;;;;;;;;CAUA,IAAA;EAKE,MAAO,UAAU,iBAAiB,CAAA,CAAA,SAAA,QAAA,UAAA,CAAA,YAAA,KAAA,CAAA;EAChC,IAAA,QAAQ,SAAM,GAAA;GACd,MAAO,UAAA;IAAE,OAAA,6CAAA,QAAA,KAAA,IAAA;IAAM,OAAQ,cAAW;GAAqB;GACxD,OAAA;IACH,SAAA,KAAA,OAAA;;;;;;;;;EAUA;CAKE,SAAO,OAAA;EACL,MAAM,UAAQ,EAAA,OAAA,aAAY,KAAgB,EAAA;EAC1C,OAAO;GAAE,SAAA,KAAA,OAAA;GAAM;GAAqC,SAAA;EACrD;CACH"}
|
|
1
|
+
{"version":3,"file":"tool-operations.mjs","names":["toToon"],"sources":["../../src/tool-operations.ts"],"sourcesContent":["/**\n * Tool executors behind the agent extensions.\n *\n * Each executor returns the text a caller reads plus the structured details a\n * harness can attach to the call. The text is TOON-encoded so the model sees\n * the same compact shape the CLI's --toon flag prints. A run's output is the\n * exception: it follows the status block as plain text, not as one TOON string.\n */\nimport { stripVTControlCharacters } from \"node:util\";\nimport { encode as toToon } from \"@toon-format/toon\";\nimport { getAllHarnesses, getHarness, isHarnessId, listHarnesses } from \"./registry.ts\";\nimport {\n addMcpServer,\n listMcpServers,\n readMasterMcpServers,\n removeMcpServer,\n syncMcpServers,\n} from \"./mcp-servers.ts\";\nimport type { McpConfigListing, SyncReport } from \"./mcp-servers.ts\";\nimport { readAgentsConfig, syncAgentsFiles } from \"./agents-sync.ts\";\nimport type { AgentsSyncReport } from \"./agents-sync.ts\";\nexport type { AgentsSyncReport } from \"./agents-sync.ts\";\nexport type { SyncReport } from \"./mcp-servers.ts\";\nexport type { PromptSyncReport } from \"./prompt-sync.ts\";\nexport type { HarnessInvocationModes } from \"./types.ts\";\nimport { syncPromptTemplates } from \"./prompt-sync.ts\";\nimport type { PromptSyncReport } from \"./prompt-sync.ts\";\nimport type { Harness } from \"./harness.ts\";\nimport type {\n AvailableModel,\n EnvOverride,\n HarnessCapabilities,\n HarnessDetection,\n HarnessId,\n HarnessInvocationModes,\n InvokeResult,\n ListModelsResult,\n McpServerConfig,\n PathCandidate,\n PromptTemplateSyncTarget,\n ResolvedPaths,\n StorageDescriptor,\n} from \"./types.ts\";\n\n/** Text for the model plus details for the harness, shared by every tool surface. */\nexport interface ToolResult<Details> {\n content: Array<{ type: \"text\"; text: string }>;\n details: Details;\n /** Set when the tool could not answer. */\n isError?: boolean;\n}\n\n/** Install state of one harness on this machine. */\nexport interface HarnessStatus {\n id: HarnessId;\n name: string;\n installed: boolean;\n version: string | null;\n}\n\n/** Every registered harness with its install state, as scanned by {@link detectHarnesses}. */\nexport interface HarnessListing {\n harnesses: HarnessStatus[];\n}\n\n/** Full metadata for one harness, including paths resolved for this platform. */\nexport interface HarnessMetadata {\n id: HarnessId;\n name: string;\n binaries: string[];\n capabilities: HarnessCapabilities;\n invocationModes: HarnessInvocationModes;\n modelListing: boolean;\n modelSelection: boolean;\n config: PathCandidate[];\n sessions: PathCandidate[];\n instructions: PathCandidate[];\n skills: PathCandidate[];\n commands: PathCandidate[];\n promptTemplates: PathCandidate[];\n promptTemplateSyncTarget: PromptTemplateSyncTarget | null;\n hooks: PathCandidate[];\n temp: PathCandidate[];\n envOverrides: EnvOverride[];\n persistence: StorageDescriptor[];\n detection: HarnessDetection;\n resolved: ResolvedPaths;\n}\n\n/** Returned when the requested harness id is not registered. */\nexport interface UnknownHarness {\n error: string;\n known: HarnessId[];\n}\n\n/** Returned when a direct batch call bypasses the tool schema limits. */\nexport interface HarnessInfoInputError {\n error: string;\n}\n\n/** One harness lookup result. */\nexport type HarnessInfoResult = HarnessMetadata | UnknownHarness;\n\n/** Scalar, batch, or rejected batch details from {@link harnessInfo}. */\nexport type HarnessInfoDetails = HarnessInfoResult | HarnessInfoResult[] | HarnessInfoInputError;\n\nimport { HARNESS_INFO_MAX_ITEMS, RUN_TIMEOUT_DEFAULT_SECONDS } from \"./tool-schemas.ts\";\nexport { HARNESS_INFO_MAX_ITEMS } from \"./tool-schemas.ts\";\n\n/** Default wall-clock budget for one harness run, in seconds. */\nexport const RUN_DEFAULT_TIMEOUT_SECONDS = RUN_TIMEOUT_DEFAULT_SECONDS;\n\n/** The run tool's per-stream cap: harness output is unbounded, model context is not. */\nexport const RUN_MAX_OUTPUT_CHARS = 8000;\n\nfunction text(data: unknown): Array<{ type: \"text\"; text: string }> {\n return [{ type: \"text\", text: toToon(data) }];\n}\n\nfunction unknownHarness(id: string): ToolResult<UnknownHarness> {\n const details: UnknownHarness = { error: `Unknown harness: ${id}`, known: listHarnesses() };\n return { content: text(details), details, isError: true };\n}\n\nfunction errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\nfunction truncate(output: string): string {\n if (output.length <= RUN_MAX_OUTPUT_CHARS) return output;\n return `${output.slice(0, RUN_MAX_OUTPUT_CHARS)}\\n[truncated ${output.length - RUN_MAX_OUTPUT_CHARS} of ${output.length} characters]`;\n}\n\ntype RunInvocationOptions = Readonly<{\n model?: string;\n structured: boolean;\n tools: boolean;\n readOnly: boolean;\n}>;\n\ntype InvocationMode = keyof HarnessInvocationModes;\n\nconst ALTERNATE_INVOCATION_MODE: Partial<Record<InvocationMode, InvocationMode>> = {\n advisor: \"agent\",\n advisorStructured: \"agentStructured\",\n agent: \"advisor\",\n agentStructured: \"advisorStructured\",\n};\n\nfunction selectedInvocationMode(\n structured: boolean,\n tools: boolean,\n readOnly: boolean,\n): InvocationMode {\n if (readOnly) return structured ? \"readOnlyStructured\" : \"readOnly\";\n if (tools) return structured ? \"agentStructured\" : \"agent\";\n return structured ? \"advisorStructured\" : \"advisor\";\n}\n\nfunction invocationRetry(\n invocationModes: Readonly<HarnessInvocationModes>,\n mode: InvocationMode,\n options: RunInvocationOptions,\n): RunFailure[\"retry\"] {\n const withoutStructured = selectedInvocationMode(false, options.tools, options.readOnly);\n if (options.structured) {\n if (invocationModes[withoutStructured]) return { structured: false };\n const alternateWithoutStructured = ALTERNATE_INVOCATION_MODE[withoutStructured];\n if (alternateWithoutStructured && invocationModes[alternateWithoutStructured]) {\n return { structured: false, tools: !options.tools };\n }\n }\n\n const alternateMode = ALTERNATE_INVOCATION_MODE[mode];\n return alternateMode !== undefined && invocationModes[alternateMode]\n ? { tools: !options.tools }\n : undefined;\n}\n\n/** The run as its status block shows it: everything but the two streams. */\ntype RunStatus = Readonly<Omit<RunOutcome, \"args\" | \"stdout\" | \"stderr\">> & {\n readonly args: readonly string[];\n};\n\ntype RunStreams = Readonly<Partial<Pick<RunOutcome, \"stdout\" | \"stderr\">>>;\n\n// oxlint-disable-next-line no-control-regex -- Terminal control bytes are precisely what this boundary removes.\nconst OUTPUT_CONTROLS = /[\\u0000-\\u0008\\u000B-\\u001F\\u007F-\\u009F]/g;\n\n/**\n * Strips what TOON quoting used to escape: terminal sequences and control bytes; CRLF becomes LF.\n *\n * @param output - One capped stream.\n * @returns {string} The stream as plain text.\n */\nfunction plainOutput(output: string): string {\n return stripVTControlCharacters(output).replaceAll(\"\\r\\n\", \"\\n\").replace(OUTPUT_CONTROLS, \" \");\n}\n\n/**\n * Lays the run out for the model: the TOON status block, then each stream under\n * its name as plain text, since quoting a markdown answer into one TOON string\n * escaped every code block and cost about a tenth more tokens.\n *\n * @param outcome - The run without its output.\n * @param streams - The capped streams; empty ones are left out.\n * @returns {Array<{ type: \"text\"; text: string }>} The text handed to the model.\n */\nfunction runText(outcome: RunStatus, streams: RunStreams): Array<{ type: \"text\"; text: string }> {\n const blocks = [toToon(outcome)];\n for (const name of [\"stdout\", \"stderr\"] as const) {\n const output = streams[name];\n if (output !== undefined && output.length > 0) blocks.push(`${name}:\\n${plainOutput(output)}`);\n }\n return [{ type: \"text\", text: blocks.join(\"\\n\\n\") }];\n}\n\nfunction completedRun(\n harness: Harness,\n result: InvokeResult,\n options: RunInvocationOptions,\n templateArgs: readonly string[],\n): ToolResult<RunOutcome> {\n const contentOutcome: Omit<RunOutcome, \"stdout\" | \"stderr\"> = {\n id: harness.id,\n command: result.command,\n args: [...templateArgs],\n ...(options.model === undefined ? {} : { model: options.model }),\n structured: options.structured,\n tools: options.tools,\n readOnly: options.readOnly,\n exitCode: result.exitCode,\n timedOut: result.timedOut,\n aborted: result.aborted,\n ...(result.idleMs === undefined ? {} : { idleMs: result.idleMs }),\n };\n const stdout = truncate(result.stdout);\n const stderr = truncate(result.stderr);\n const details: RunOutcome = { ...contentOutcome, args: result.args, stdout, stderr };\n if (result.timedOut || result.exitCode !== 0) {\n return { content: runText(contentOutcome, { stdout, stderr }), details, isError: true };\n }\n return {\n content: runText(contentOutcome, stdout.length > 0 ? { stdout } : { stderr }),\n details,\n };\n}\n\nfunction unsupportedInvocation(\n harness: Harness,\n id: string,\n options: RunInvocationOptions,\n): ToolResult<RunFailure> {\n const error = harness.invocationError(options) ?? `Invalid ${id} invocation`;\n const invocationModes = harness.invocationModes;\n const mode = selectedInvocationMode(options.structured, options.tools, options.readOnly);\n const modelUnsupported =\n options.model !== undefined && harness.invocation?.modelArgs === undefined;\n if (invocationModes[mode] || harness.invocation === null || modelUnsupported) {\n const details: RunFailure = { error };\n return { content: text(details), details, isError: true };\n }\n\n const retry = invocationRetry(invocationModes, mode, options);\n const details: RunFailure = {\n error,\n invocationModes,\n ...(retry === undefined ? {} : { retry }),\n };\n return { content: text(details), details, isError: true };\n}\n\n/**\n * Scans every registered harness for its binaries and version.\n *\n * @returns {ToolResult<HarnessListing>} The complete installation listing.\n */\nexport function detectHarnesses(): ToolResult<HarnessListing> {\n const details: HarnessListing = {\n harnesses: getAllHarnesses().map((harness) => {\n const installed = harness.isInstalled();\n return {\n id: harness.id,\n name: harness.name,\n installed,\n version: installed ? harness.version : null,\n };\n }),\n };\n\n return { content: text(details), details };\n}\n\nfunction harnessInfoResult(id: string): HarnessInfoResult {\n if (!isHarnessId(id)) return unknownHarness(id).details;\n\n const harness = getHarness(id);\n return {\n id: harness.id,\n name: harness.name,\n binaries: harness.binaries,\n capabilities: harness.capabilities,\n invocationModes: harness.invocationModes,\n modelListing: harness.modelListing !== null,\n modelSelection: harness.invocation?.modelArgs !== undefined,\n config: harness.config,\n sessions: harness.sessions,\n instructions: harness.instructions,\n skills: harness.skills,\n commands: harness.commands,\n promptTemplates: harness.promptTemplates,\n promptTemplateSyncTarget: harness.promptTemplateSyncTarget,\n hooks: harness.hooks,\n temp: harness.temp,\n envOverrides: harness.envOverrides,\n persistence: harness.persistence,\n detection: harness.detection,\n resolved: harness.resolve(),\n };\n}\n\n/**\n * One lookup as the model reads it: every path list once, in\n * {@link HarnessMetadata.resolved}, and the env overrides with their default\n * roots resolved the same way.\n */\ntype HarnessInfoText =\n | Omit<\n HarnessMetadata,\n | \"config\"\n | \"sessions\"\n | \"instructions\"\n | \"skills\"\n | \"commands\"\n | \"promptTemplates\"\n | \"promptTemplateSyncTarget\"\n | \"hooks\"\n | \"temp\"\n >\n | UnknownHarness;\n\n/**\n * Leaves the path templates out of the text: `resolved` already carries each\n * of them for this machine, so they only doubled every answer. Env overrides\n * have no resolved copy, so their own roots are resolved in place.\n *\n * @param result - One lookup result.\n * @returns {HarnessInfoText} The lookup with its path lists shown once.\n */\nfunction harnessInfoText(result: HarnessInfoResult): HarnessInfoText {\n if (\"error\" in result) return result;\n const {\n id,\n name,\n binaries,\n capabilities,\n invocationModes,\n modelListing,\n modelSelection,\n envOverrides,\n persistence,\n detection,\n resolved,\n } = result;\n return {\n id,\n name,\n binaries,\n capabilities,\n invocationModes,\n modelListing,\n modelSelection,\n envOverrides: getHarness(id).resolveCandidates(envOverrides),\n persistence,\n detection,\n resolved,\n };\n}\n\n/** Full metadata for one harness, with paths resolved for the current platform. */\nexport function harnessInfo(id: string): ToolResult<HarnessInfoResult>;\n/** Full metadata for several harnesses, preserving input order and errors for each item. */\nexport function harnessInfo(\n ids: readonly string[],\n): ToolResult<HarnessInfoResult[] | HarnessInfoInputError>;\nexport function harnessInfo(input: string | readonly string[]): ToolResult<HarnessInfoDetails>;\nexport function harnessInfo(input: string | readonly string[]): ToolResult<HarnessInfoDetails> {\n if (typeof input === \"string\") {\n const details = harnessInfoResult(input);\n return {\n content: text(harnessInfoText(details)),\n details,\n ...(\"error\" in details ? { isError: true } : {}),\n };\n }\n\n if (input.length < 1 || input.length > HARNESS_INFO_MAX_ITEMS) {\n const details: HarnessInfoInputError = {\n error: `harnesses_info accepts between 1 and ${HARNESS_INFO_MAX_ITEMS} ids`,\n };\n return { content: text(details), details, isError: true };\n }\n\n const details = input.map(harnessInfoResult);\n return {\n content: text(details.map(harnessInfoText)),\n details,\n ...(details.some((result) => \"error\" in result) ? { isError: true } : {}),\n };\n}\n\n/** Options accepted by {@link listHarnessModels}. */\nexport interface ModelsOptions {\n search?: string;\n cwd?: string;\n /** Wall-clock budget in seconds; defaults to {@link RUN_DEFAULT_TIMEOUT_SECONDS}. */\n timeoutSeconds?: number;\n /** Cancel the owned command through the host request signal. */\n signal?: AbortSignal;\n}\n\n/** One completed native model-listing query. */\nexport interface ModelsOutcome {\n id: HarnessId;\n command: string;\n args: string[];\n search?: string;\n models: AvailableModel[];\n exitCode: number | null;\n timedOut: boolean;\n aborted: boolean;\n /** Milliseconds without output before the listing was stopped; absent when it exited on its own. */\n idleMs?: number;\n stderr: string;\n}\n\n/**\n * Lists the models currently available to one harness through its native CLI.\n *\n * @param id - Harness id to query.\n * @param options - Search, working-directory, and timeout options.\n * @returns {Promise<ToolResult<ModelsOutcome | RunFailure>>} The model listing or failure.\n */\nexport async function listHarnessModels(\n id: string,\n options: ModelsOptions = {},\n): Promise<ToolResult<ModelsOutcome | RunFailure>> {\n if (!isHarnessId(id)) return unknownHarness(id);\n\n const harness = getHarness(id);\n const built = harness.buildModelListInvocation(options.search);\n if (!built) {\n const details: RunFailure = { error: `Harness ${id} does not support model listing` };\n return { content: text(details), details, isError: true };\n }\n\n const timeoutSeconds = options.timeoutSeconds ?? RUN_DEFAULT_TIMEOUT_SECONDS;\n let result: ListModelsResult;\n try {\n result = await harness.listModels({\n search: options.search,\n cwd: options.cwd,\n timeoutMs: timeoutSeconds * 1000,\n signal: options.signal,\n });\n } catch (error) {\n const details: RunFailure = { error: `Failed to list ${id} models: ${errorMessage(error)}` };\n return { content: text(details), details, isError: true };\n }\n\n return completedListing(harness.id, result, result.models, options.search);\n}\n\nfunction completedListing(\n id: HarnessId,\n result: InvokeResult,\n models: readonly Readonly<AvailableModel>[],\n search: string | undefined,\n): ToolResult<ModelsOutcome> {\n const details: ModelsOutcome = {\n id,\n command: result.command,\n args: [...result.args],\n ...(search === undefined ? {} : { search }),\n models: [...models],\n exitCode: result.exitCode,\n timedOut: result.timedOut,\n aborted: result.aborted,\n ...(result.idleMs === undefined ? {} : { idleMs: result.idleMs }),\n stderr: truncate(result.stderr),\n };\n\n return {\n content: text(details),\n details,\n ...(result.timedOut || result.exitCode !== 0 ? { isError: true } : {}),\n };\n}\n\n/** Options accepted by {@link runHarness}. */\nexport interface RunOptions {\n cwd?: string;\n /** Harness-native model id or selector. */\n model?: string;\n /** Wall-clock budget in seconds; defaults to {@link RUN_DEFAULT_TIMEOUT_SECONDS}. */\n timeoutSeconds?: number;\n /** Cancel the owned command through the host request signal. */\n signal?: AbortSignal;\n /** Use the harness's structured (JSON) output mode instead of plain text. */\n structured?: boolean;\n /** Enable tools; defaults to a native advisor without tools invocation. */\n tools?: boolean;\n /** Require native enforcement of read-only tool access. Implies tools when `tools` is omitted; `tools: false` rejects the run. */\n readOnly?: boolean;\n}\n\n/** One completed (or failed) harness run, with output capped for the model. */\nexport interface RunOutcome {\n id: HarnessId;\n command: string;\n /** Expanded arguments; the model's text keeps \"{prompt}\" instead, it wrote the prompt itself. */\n args: string[];\n model?: string;\n structured: boolean;\n tools: boolean;\n readOnly: boolean;\n exitCode: number | null;\n timedOut: boolean;\n aborted: boolean;\n /** Milliseconds without output before the run was stopped; absent when it exited on its own. */\n idleMs?: number;\n stdout: string;\n stderr: string;\n}\n\n/** Returned when the harness cannot be run at all. */\nexport interface RunFailure {\n error: string;\n known?: HarnessId[];\n /** Modes accepted by the selected harness when invocation mode caused the failure. */\n invocationModes?: HarnessInvocationModes;\n /** Explicit mode change that makes the same invocation shape executable. */\n retry?: { structured: false; tools?: boolean } | { tools: boolean };\n}\n\nfunction normalizedRunAccess(options: Readonly<RunOptions>): {\n tools: boolean;\n readOnly: boolean;\n} {\n const readOnly = options.readOnly ?? false;\n return { readOnly, tools: options.tools ?? readOnly };\n}\n\n/**\n * Runs one prompt through a harness's normalized non-interactive invocation.\n *\n * Tool use defaults to a native advisor without tools invocation. Harnesses that\n * cannot disable tools reject that mode; setting `tools` selects their full\n * agent invocation. `model` is translated through the harness-specific recipe.\n * This layer also closes stdin, enforces the timeout, caps the echoed output,\n * and leaves the prompt out of the echoed invocation.\n *\n * @param id - Harness id to run.\n * @param prompt - Prompt sent to the selected harness.\n * @param options - Model, mode, working-directory, and timeout options.\n * @returns {Promise<ToolResult<RunOutcome | RunFailure>>} The capped run outcome or failure.\n */\nexport async function runHarness(\n id: string,\n prompt: string,\n options: RunOptions = {},\n): Promise<ToolResult<RunOutcome | RunFailure>> {\n if (!isHarnessId(id)) return unknownHarness(id);\n\n const harness = getHarness(id);\n const structured = options.structured ?? false;\n const { tools, readOnly } = normalizedRunAccess(options);\n const invocationOptions = { model: options.model, structured, tools, readOnly };\n const template = harness.buildInvocation(\"{prompt}\", invocationOptions);\n if (!template) {\n return unsupportedInvocation(harness, id, invocationOptions);\n }\n\n const timeoutSeconds = options.timeoutSeconds ?? RUN_DEFAULT_TIMEOUT_SECONDS;\n\n let result: InvokeResult;\n try {\n result = await harness.invoke(prompt, {\n cwd: options.cwd,\n model: options.model,\n timeoutMs: timeoutSeconds * 1000,\n signal: options.signal,\n structured,\n tools,\n readOnly,\n });\n } catch (error) {\n const details: RunFailure = { error: `Failed to run ${id}: ${errorMessage(error)}` };\n return { content: text(details), details, isError: true };\n }\n\n return completedRun(harness, result, invocationOptions, template.args);\n}\n\n/** MCP server listings for one harness or all of them. */\nexport interface McpListing {\n harnesses: Array<{ id: HarnessId; configs: McpConfigListing[] }>;\n}\n\n/** Marker used only at the tool and CLI boundary, leaving config reads lossless for edits. */\nconst MCP_REDACTED_VALUE = \"<redacted>\";\nconst MCP_CONFIG_ERROR = \"Unable to read or parse MCP config\";\n\nfunction redactMcpValues(values: Readonly<Record<string, string>>): Record<string, string> {\n return Object.fromEntries(Object.keys(values).map((key) => [key, MCP_REDACTED_VALUE]));\n}\n\n/** Result of one MCP config mutation. */\nexport interface McpMutation {\n id: HarnessId;\n path: string;\n action: \"added\" | \"replaced\" | \"removed\" | \"noop\";\n}\n\n/** Flat tool parameters describing one MCP server, shared by every surface. */\nexport interface McpServerParams {\n name: string;\n transport?: McpServerConfig[\"transport\"];\n command?: string;\n args?: string[];\n env?: Record<string, string>;\n url?: string;\n headers?: Record<string, string>;\n}\n\n/**\n * Builds the normalized server shape from flat tool parameters.\n *\n * @param params - Flat MCP server parameters.\n * @returns {McpServerConfig} The normalized server configuration.\n */\nexport function toMcpServerConfig(params: McpServerParams): McpServerConfig {\n const server: McpServerConfig = {\n name: params.name,\n transport: params.transport ?? (params.url ? \"http\" : \"stdio\"),\n };\n if (params.command !== undefined) server.command = params.command;\n if (params.args !== undefined) server.args = params.args;\n if (params.env !== undefined) server.env = params.env;\n if (params.url !== undefined) server.url = params.url;\n if (params.headers !== undefined) server.headers = params.headers;\n return server;\n}\n\n/**\n * Lists configured MCP servers, normalized across harness config dialects.\n *\n * @param id - Optional harness id; omission lists every harness.\n * @returns {ToolResult<McpListing | UnknownHarness>} The normalized listing or id error.\n */\nexport function mcpList(id?: string): ToolResult<McpListing | UnknownHarness> {\n if (id !== undefined && !isHarnessId(id)) return unknownHarness(id);\n\n const targets = id !== undefined && isHarnessId(id) ? [getHarness(id)] : getAllHarnesses();\n const details: McpListing = {\n harnesses: targets\n .map((harness) => ({\n id: harness.id,\n configs: listMcpServers(harness).map((listing) => ({\n ...listing,\n ...(listing.error === undefined ? {} : { error: MCP_CONFIG_ERROR }),\n servers: listing.servers.map((server) => ({\n ...server,\n ...(server.env === undefined ? {} : { env: redactMcpValues(server.env) }),\n ...(server.headers === undefined ? {} : { headers: redactMcpValues(server.headers) }),\n })),\n })),\n }))\n .filter((entry) => entry.configs.length > 0),\n };\n\n return { content: text(details), details };\n}\n\nfunction mcpMutate(\n id: string,\n mutate: (harness: Harness) => { path: string; action: McpMutation[\"action\"] },\n): ToolResult<McpMutation | RunFailure> {\n if (!isHarnessId(id)) return unknownHarness(id);\n\n try {\n const { path, action } = mutate(getHarness(id));\n const details: McpMutation = { id, path, action };\n return { content: text(details), details, ...(action === \"noop\" ? { isError: true } : {}) };\n } catch (error) {\n const details: RunFailure = { error: errorMessage(error) };\n return { content: text(details), details, isError: true };\n }\n}\n\n/**\n * Adds or replaces one MCP server in a harness's config.\n *\n * @param id - Target harness id.\n * @param params - Server parameters to normalize and write.\n * @param scope - User or project config scope.\n * @returns {ToolResult<McpMutation | RunFailure>} The mutation outcome or failure.\n */\nexport function mcpAdd(\n id: string,\n params: McpServerParams,\n scope: \"user\" | \"project\" = \"user\",\n): ToolResult<McpMutation | RunFailure> {\n return mcpMutate(id, (harness) => {\n const { path, replaced } = addMcpServer(harness, toMcpServerConfig(params), scope);\n return { path, action: replaced ? \"replaced\" : \"added\" };\n });\n}\n\n/**\n * Removes one MCP server from a harness's config.\n *\n * @param id - Target harness id.\n * @param name - Server name to remove.\n * @param scope - User or project config scope.\n * @returns {ToolResult<McpMutation | RunFailure>} The mutation outcome or failure.\n */\nexport function mcpRemove(\n id: string,\n name: string,\n scope: \"user\" | \"project\" = \"user\",\n): ToolResult<McpMutation | RunFailure> {\n return mcpMutate(id, (harness) => {\n const { path, removed } = removeMcpServer(harness, name, scope);\n return { path, action: removed ? \"removed\" : \"noop\" };\n });\n}\n\n/**\n * Pushes the master MCP list from ~/.config/agntn/mcp.jsonc into harness configs.\n *\n * @param id - Optional harness id; omission targets every harness.\n * @returns {ToolResult<SyncReport | RunFailure>} The sync report or failure.\n */\nexport function mcpSync(id?: string): ToolResult<SyncReport | RunFailure> {\n if (id !== undefined && !isHarnessId(id)) return unknownHarness(id);\n\n try {\n // Preflight before any write: a typo in excludes must fail the whole run,\n // not silently leave the misspelled harness unprotected.\n const unknown = readMasterMcpServers().excludes.filter((entry) => !isHarnessId(entry));\n if (unknown.length > 0) {\n const details: RunFailure = {\n error: `Master MCP list excludes unknown harnesses: ${unknown.join(\", \")}`,\n known: listHarnesses(),\n };\n return { content: text(details), details, isError: true };\n }\n const details = syncMcpServers(\n id !== undefined && isHarnessId(id) ? [getHarness(id)] : getAllHarnesses(),\n );\n return { content: text(details), details };\n } catch (error) {\n const details: RunFailure = { error: errorMessage(error) };\n return { content: text(details), details, isError: true };\n }\n}\n\n/**\n * Links every harness's global instructions file to the master AGENTS.md.\n *\n * @param id - Optional harness id; omission targets every harness.\n * @param check - Report intended changes without writing them.\n * @returns {ToolResult<AgentsSyncReport | RunFailure>} The sync report or failure.\n */\nexport function agentsSync(id?: string, check = false): ToolResult<AgentsSyncReport | RunFailure> {\n if (id !== undefined && !isHarnessId(id)) return unknownHarness(id);\n\n try {\n // Preflight before any write: a typo in excludes must fail the whole run,\n // not silently adopt the harness it was meant to protect.\n const unknown = readAgentsConfig().excludes.filter((entry) => !isHarnessId(entry));\n if (unknown.length > 0) {\n const details: RunFailure = {\n error: `Agents config excludes unknown harnesses: ${unknown.join(\", \")}`,\n known: listHarnesses(),\n };\n return { content: text(details), details, isError: true };\n }\n const details = syncAgentsFiles(\n id !== undefined && isHarnessId(id) ? [getHarness(id)] : getAllHarnesses(),\n check,\n );\n return { content: text(details), details };\n } catch (error) {\n const details: RunFailure = { error: errorMessage(error) };\n return { content: text(details), details, isError: true };\n }\n}\n\n/**\n * Synchronizes canonical Markdown prompt templates into harness destinations.\n *\n * @param id - Optional harness id; omission targets every harness.\n * @param check - Report intended changes without writing them.\n * @returns {ToolResult<PromptSyncReport | RunFailure>} The sync report or failure.\n */\nexport function promptsSync(id?: string, check = false): ToolResult<PromptSyncReport | RunFailure> {\n if (id !== undefined && !isHarnessId(id)) return unknownHarness(id);\n\n try {\n const details = syncPromptTemplates(\n id !== undefined && isHarnessId(id) ? [getHarness(id)] : getAllHarnesses(),\n check,\n );\n return { content: text(details), details };\n } catch (error) {\n const details: RunFailure = { error: errorMessage(error) };\n return { content: text(details), details, isError: true };\n }\n}\n"],"mappings":";;;;;;;;;;CA8GA,CAAA;;AAGA,SAAa,eAAA,IAAA;CAEb,MAAA,UAAc;EACZ,OAAQ,oBAAA;EAAE,OAAM,cAAA;CAAQ;CAAmB,OAAC;EAC9C,SAAA,KAAA,OAAA;EAEA;EACE,SAAM;CAA4B;AAAiC;AAAuB,SAAA,aAAA,OAAA;CAC1F,OAAO,iBAAA,QAAA,MAAA,UAAA,OAAA,KAAA;AAAE;AAAwB,SAAA,SAAA,QAAA;CAAS,IAAA,OAAS,UAAA,KAAA,OAAA;CAAK,OAAA,GAAA,OAAA,MAAA,GAAA,oBAAA,EAAA,eAAA,OAAA,SAAA,qBAAA,MAAA,OAAA,OAAA;AAC1D;AAEA,MAAA,4BAA8C;CAC5C,SAAO;CACT,mBAAA;CAEA,OAAA;CACE,iBAAW;AACX;AACF,SAAA,uBAAA,YAAA,OAAA,UAAA;CAWA,IAAA,UAAM,OAAA,aAA6E,uBAAA;CACjF,IAAA,OAAS,OAAA,aAAA,oBAAA;CACT,OAAA,aAAmB,sBAAA;AACnB;AACA,SAAA,gBAAiB,iBAAA,MAAA,SAAA;CACnB,MAAA,oBAAA,uBAAA,OAAA,QAAA,OAAA,QAAA,QAAA;CAEA,IAAA,QAAS,YAAA;EAKP,IAAI,gBAAiB,oBAAa,OAAA,EAAA,YAAuB,MAAA;EACzD,MAAI,6BAA2B,0BAAoB;EACnD,IAAA,8BAAoB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KAAA,OAAA;GACxD;GACH,SAAA;;;;;;;;EAUA,OAAgB;GAKd,SAAO,KAAA,OAAe;GACpB;EACA;CAAS,SAAA,OAAA;EAAM,MAAA,UAAQ,EAAA,OAAU,aAAY,KAAA,EAAA;EAAO,OAAA;GACrD,SAAA,KAAA,OAAA;GACH"}
|
|
@@ -30,6 +30,7 @@ export declare const RUN_TIMEOUT_DEFAULT_SECONDS = 600;
|
|
|
30
30
|
* @returns {Record<string, S>} Schemas keyed by harness tool operation.
|
|
31
31
|
*/
|
|
32
32
|
export declare function harnessToolSchemas<I, S>(Type: McpSchemaBuilder<I, S>): {
|
|
33
|
+
/** Open on purpose: nothing to misread, and some models send a placeholder `_` here. */
|
|
33
34
|
detect: S;
|
|
34
35
|
info: S;
|
|
35
36
|
models: S;
|
|
@@ -37,6 +38,7 @@ export declare function harnessToolSchemas<I, S>(Type: McpSchemaBuilder<I, S>):
|
|
|
37
38
|
mcpList: S;
|
|
38
39
|
mcpSync: S;
|
|
39
40
|
agentsSync: S;
|
|
41
|
+
promptsSync: S;
|
|
40
42
|
mcpAdd: S;
|
|
41
43
|
mcpRemove: S;
|
|
42
44
|
};
|
|
@@ -74,6 +76,10 @@ export interface AgentsSyncParams {
|
|
|
74
76
|
id?: string;
|
|
75
77
|
check?: boolean;
|
|
76
78
|
}
|
|
79
|
+
export interface PromptsSyncParams {
|
|
80
|
+
id?: string;
|
|
81
|
+
check?: boolean;
|
|
82
|
+
}
|
|
77
83
|
export interface McpAddParams {
|
|
78
84
|
id: string;
|
|
79
85
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-schemas.d.mts","names":[],"sources":["../../src/tool-schemas.ts"],"mappings":"AAaA;;;;;;;;;;;;iBAAiB,iBAAiB,GAAG;EACnC,OAAO,YAAY,SAAS,eAAe,KAAK,mBAAmB;EACnE,OAAO,mBAAmB;EAC1B,QAAQ,mBAAmB;EAC3B,QAAQ,mBAAmB;EAC3B,MAAM,MAAM,GAAG,mBAAmB;EAClC,OAAO,KAAK,GAAG,OAAO,GAAG,mBAAmB;EAC5C,MAAM,kBAAkB,KAAK,mBAAmB;EAChD,QAAQ,eAAe,mBAAmB;EAC1C,SAAS,QAAQ,IAAI;;qBAGV;qBACA;;;;;;;wBAQG,mBAAmB,GAAG,GAAG,MAAM,iBAAiB,GAAG
|
|
1
|
+
{"version":3,"file":"tool-schemas.d.mts","names":[],"sources":["../../src/tool-schemas.ts"],"mappings":"AAaA;;;;;;;;;;;;iBAAiB,iBAAiB,GAAG;EACnC,OAAO,YAAY,SAAS,eAAe,KAAK,mBAAmB;EACnE,OAAO,mBAAmB;EAC1B,QAAQ,mBAAmB;EAC3B,QAAQ,mBAAmB;EAC3B,MAAM,MAAM,GAAG,mBAAmB;EAClC,OAAO,KAAK,GAAG,OAAO,GAAG,mBAAmB;EAC5C,MAAM,kBAAkB,KAAK,mBAAmB;EAChD,QAAQ,eAAe,mBAAmB;EAC1C,SAAS,QAAQ,IAAI;;qBAGV;qBACA;;;;;;;wBAQG,mBAAmB,GAAG,GAAG,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;iBA4KlD;EACf;;iBAGe;EACf;EACA;EACA;EACA;;iBAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe;EACf;;iBAGe;EACf;;iBAGe;EACf;EACA;;iBAGe;EACf;EACA;;iBAGe;EACf;EACA;EACA;EACA;EACA,MAAM;EACN;EACA;EACA,UAAU;EACV;;iBAGe;EACf;EACA;EACA"}
|
|
@@ -8,17 +8,18 @@ function harnessToolSchemas(Type) {
|
|
|
8
8
|
pattern: "^[a-z][a-z0-9-]*$"
|
|
9
9
|
});
|
|
10
10
|
const stringRecord = (description) => Type.Record(Type.String({ maxLength: 256 }), Type.String({ maxLength: 4096 }), { description });
|
|
11
|
+
const closed = (properties) => Type.Object(properties, { additionalProperties: false });
|
|
11
12
|
const scope = Type.Optional(Type.Union([Type.Literal("user"), Type.Literal("project")], { description: "Which config file to target (default user)" }));
|
|
12
13
|
return {
|
|
13
14
|
detect: Type.Object({}),
|
|
14
|
-
info:
|
|
15
|
+
info: closed({ id: Type.Union([harnessId("Harness id"), Type.Array(harnessId("Harness id"), {
|
|
15
16
|
minItems: 1,
|
|
16
17
|
maxItems: 20
|
|
17
18
|
})], { description: "Harness id, or a list of ids to inspect in one call" }) }),
|
|
18
|
-
models:
|
|
19
|
+
models: closed({
|
|
19
20
|
id: harnessId("Harness id"),
|
|
20
21
|
search: Type.Optional(Type.String({
|
|
21
|
-
description: "Optional
|
|
22
|
+
description: "Optional model search filter; without a native one, ids match ignoring case",
|
|
22
23
|
minLength: 1,
|
|
23
24
|
maxLength: 1024
|
|
24
25
|
})),
|
|
@@ -33,7 +34,7 @@ function harnessToolSchemas(Type) {
|
|
|
33
34
|
maximum: 3600
|
|
34
35
|
}))
|
|
35
36
|
}),
|
|
36
|
-
run:
|
|
37
|
+
run: closed({
|
|
37
38
|
id: harnessId("Harness id"),
|
|
38
39
|
prompt: Type.String({
|
|
39
40
|
description: "Prompt to send to the harness",
|
|
@@ -59,13 +60,17 @@ function harnessToolSchemas(Type) {
|
|
|
59
60
|
tools: Type.Boolean({ description: "Explicit execution mode. Set true when the task needs any harness tools, including Grok native X search. Set false only for an advisor without tools." }),
|
|
60
61
|
readOnly: Type.Optional(Type.Boolean({ description: "Set with tools=true to require native read-only tool enforcement. Unsupported harnesses reject the run instead of widening access." }))
|
|
61
62
|
}),
|
|
62
|
-
mcpList:
|
|
63
|
-
mcpSync:
|
|
64
|
-
agentsSync:
|
|
63
|
+
mcpList: closed({ id: Type.Optional(harnessId("Harness id; omit to list every harness")) }),
|
|
64
|
+
mcpSync: closed({ id: Type.Optional(harnessId("Harness id; omit to sync every harness")) }),
|
|
65
|
+
agentsSync: closed({
|
|
65
66
|
id: Type.Optional(harnessId("Harness id; omit to sync every harness")),
|
|
66
67
|
check: Type.Optional(Type.Boolean({ description: "Report what would change without writing anything" }))
|
|
67
68
|
}),
|
|
68
|
-
|
|
69
|
+
promptsSync: closed({
|
|
70
|
+
id: Type.Optional(harnessId("Harness id; omit to sync every harness")),
|
|
71
|
+
check: Type.Optional(Type.Boolean({ description: "Report what would change without writing anything" }))
|
|
72
|
+
}),
|
|
73
|
+
mcpAdd: closed({
|
|
69
74
|
id: harnessId("Harness id"),
|
|
70
75
|
name: Type.String({
|
|
71
76
|
description: "Server name",
|
|
@@ -96,7 +101,7 @@ function harnessToolSchemas(Type) {
|
|
|
96
101
|
headers: Type.Optional(stringRecord("Headers for an http/sse server")),
|
|
97
102
|
scope
|
|
98
103
|
}),
|
|
99
|
-
mcpRemove:
|
|
104
|
+
mcpRemove: closed({
|
|
100
105
|
id: harnessId("Harness id"),
|
|
101
106
|
name: Type.String({
|
|
102
107
|
description: "Server name",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-schemas.mjs","names":[],"sources":["../../src/tool-schemas.ts"],"sourcesContent":["/**\n * Tool parameter schemas shared by every surface (MCP server, Pi and OMP\n * extensions). Each surface owns a different TypeBox build (the extensions\n * must use their host's facade), so the schemas are a factory over a minimal\n * structural builder instead of importing typebox here.\n */\n\n/**\n * The subset of the TypeBox builder the tool schemas need. `I` is the schema\n * type the builder accepts as input, `S` the (possibly narrower) type it\n * returns; OMP's facade accepts its own `AnySchema` while producing schemas\n * that satisfy the host's stricter `TSchema`.\n */\nexport interface McpSchemaBuilder<I, S> {\n Object(properties: Readonly<Record<string, I>>, options?: object): S;\n String(options?: object): I;\n Integer(options?: object): I;\n Boolean(options?: object): I;\n Array(item: I, options?: object): I;\n Record(key: I, value: I, options?: object): I;\n Union(schemas: readonly I[], options?: object): I;\n Literal(value: string, options?: object): I;\n Optional(schema: I): I;\n}\n\nexport const HARNESS_INFO_MAX_ITEMS = 20;\nexport const RUN_TIMEOUT_DEFAULT_SECONDS = 600;\n\n/**\n * Builds the parameter schemas for all harness tools with the host's TypeBox.\n *\n * @param Type - Host-provided TypeBox-compatible schema builder.\n * @returns {Record<string, S>} Schemas keyed by harness tool operation.\n */\nexport function harnessToolSchemas<I, S>(Type: McpSchemaBuilder<I, S>) {\n const harnessId = (description: string) =>\n Type.String({ description, minLength: 1, maxLength: 50, pattern: \"^[a-z][a-z0-9-]*$\" });\n\n const stringRecord = (description: string) =>\n Type.Record(Type.String({ maxLength: 256 }), Type.String({ maxLength: 4096 }), {\n description,\n });\n\n const scope = Type.Optional(\n Type.Union([Type.Literal(\"user\"), Type.Literal(\"project\")], {\n description: \"Which config file to target (default user)\",\n }),\n );\n\n return {\n detect: Type.Object({}),\n info: Type.Object({\n id: Type.Union(\n [\n harnessId(\"Harness id\"),\n Type.Array(harnessId(\"Harness id\"), {\n minItems: 1,\n maxItems: HARNESS_INFO_MAX_ITEMS,\n }),\n ],\n { description: \"Harness id, or a list of ids to inspect in one call\" },\n ),\n }),\n models: Type.Object({\n id: harnessId(\"Harness id\"),\n search: Type.Optional(\n Type.String({\n description: \"Optional native model search filter\",\n minLength: 1,\n maxLength: 1024,\n }),\n ),\n cwd: Type.Optional(\n Type.String({\n description: \"Working directory used while loading harness configuration\",\n minLength: 1,\n maxLength: 4096,\n }),\n ),\n timeoutSeconds: Type.Optional(\n Type.Integer({\n description: `Wall-clock budget in seconds (default ${RUN_TIMEOUT_DEFAULT_SECONDS})`,\n minimum: 1,\n maximum: 3600,\n }),\n ),\n }),\n run: Type.Object({\n id: harnessId(\"Harness id\"),\n prompt: Type.String({\n description: \"Prompt to send to the harness\",\n minLength: 1,\n maxLength: 100000,\n }),\n cwd: Type.Optional(\n Type.String({\n description: \"Working directory for the run\",\n minLength: 1,\n maxLength: 4096,\n }),\n ),\n model: Type.Optional(\n Type.String({\n description: \"Harness-native model id or selector\",\n minLength: 1,\n maxLength: 512,\n }),\n ),\n timeoutSeconds: Type.Optional(\n Type.Integer({\n description: `Wall-clock budget in seconds (default ${RUN_TIMEOUT_DEFAULT_SECONDS})`,\n minimum: 1,\n maximum: 3600,\n }),\n ),\n structured: Type.Optional(\n Type.Boolean({\n description: \"Use the harness's structured (JSON) output mode instead of plain text\",\n }),\n ),\n tools: Type.Boolean({\n description:\n \"Explicit execution mode. Set true when the task needs any harness tools, including Grok native X search. Set false only for an advisor without tools.\",\n }),\n readOnly: Type.Optional(\n Type.Boolean({\n description:\n \"Set with tools=true to require native read-only tool enforcement. Unsupported harnesses reject the run instead of widening access.\",\n }),\n ),\n }),\n mcpList: Type.Object({\n id: Type.Optional(harnessId(\"Harness id; omit to list every harness\")),\n }),\n mcpSync: Type.Object({\n id: Type.Optional(harnessId(\"Harness id; omit to sync every harness\")),\n }),\n agentsSync: Type.Object({\n id: Type.Optional(harnessId(\"Harness id; omit to sync every harness\")),\n check: Type.Optional(\n Type.Boolean({ description: \"Report what would change without writing anything\" }),\n ),\n }),\n mcpAdd: Type.Object({\n id: harnessId(\"Harness id\"),\n name: Type.String({\n description: \"Server name\",\n minLength: 1,\n maxLength: 100,\n pattern: \"^[A-Za-z0-9][A-Za-z0-9_-]*$\",\n }),\n command: Type.Optional(\n Type.String({ description: \"Binary for a stdio server\", minLength: 1, maxLength: 4096 }),\n ),\n args: Type.Optional(\n Type.Array(Type.String({ maxLength: 4096 }), {\n description: \"Arguments for a stdio server\",\n maxItems: 64,\n }),\n ),\n env: Type.Optional(stringRecord(\"Environment variables for a stdio server\")),\n url: Type.Optional(\n Type.String({ description: \"URL for an http/sse server\", minLength: 1, maxLength: 4096 }),\n ),\n transport: Type.Optional(\n Type.Union([Type.Literal(\"stdio\"), Type.Literal(\"http\"), Type.Literal(\"sse\")], {\n description: \"Transport; inferred from url/command when omitted\",\n }),\n ),\n headers: Type.Optional(stringRecord(\"Headers for an http/sse server\")),\n scope,\n }),\n mcpRemove: Type.Object({\n id: harnessId(\"Harness id\"),\n name: Type.String({\n description: \"Server name\",\n minLength: 1,\n maxLength: 100,\n }),\n scope,\n }),\n };\n}\n\n/**\n * Parameter types matching the schemas above. The generic factory erases the\n * builders' literal types, so hosts annotate their execute callbacks with\n * these instead of TypeBox Static inference.\n */\nexport interface InfoParams {\n id: string | string[];\n}\n\nexport interface ModelsParams {\n id: string;\n search?: string;\n cwd?: string;\n timeoutSeconds?: number;\n}\n\nexport interface RunParams {\n id: string;\n prompt: string;\n cwd?: string;\n model?: string;\n timeoutSeconds?: number;\n structured?: boolean;\n tools: boolean;\n readOnly?: boolean;\n}\n\nexport interface McpListParams {\n id?: string;\n}\n\nexport interface McpSyncParams {\n id?: string;\n}\n\nexport interface AgentsSyncParams {\n id?: string;\n check?: boolean;\n}\n\nexport interface McpAddParams {\n id: string;\n name: string;\n command?: string;\n args?: string[];\n env?: Record<string, string>;\n url?: string;\n transport?: \"stdio\" | \"http\" | \"sse\";\n headers?: Record<string, string>;\n scope?: \"user\" | \"project\";\n}\n\nexport interface McpRemoveParams {\n id: string;\n name: string;\n scope?: \"user\" | \"project\";\n}\n"],"mappings":"AAyBA,MAAa,yBAAyB;AACtC,MAAa,8BAA8B;;;;;;EAQ3C,SAAgB;CACd,CAAA;CACgB,MAAA,gBAAA,gBAAA,KAAA,OAAA,KAAA,OAAA,EAAA,WAAA,IAAA,CAAA,GAAA,KAAA,OAAA,EAAA,WAAA,KAAA,CAAA,GAAA,EAAA,YAAA,CAAA;CAAa,MAAA,QAAW,KAAA,SAAA,KAAA,MAAA,CAAA,KAAA,QAAA,MAAA,GAAA,KAAA,QAAA,SAAA,CAAA,GAAA,EAAA,aAAA,6CAAA,CAAA,CAAA;CAAG,OAAA;EAAe,QAAA,KAAS,OAAA,CAAA,CAAA;EAAqB,MAAA,KAAA,OAAA,EAAA,IAAA,KAAA,MAAA,CAAA,UAAA,YAAA,GAAA,KAAA,MAAA,UAAA,YAAA,GAAA;GAExF,UAAM;GAKN,UAAM;EAMN,CAAA,CAAA,GAAA,EAAO,aAAA,sDAAA,CAAA,EAAA,CAAA;EACL,QAAQ,KAAK,OAAO;GACpB,IAAA,UAAW,YACL;GAIE,QAAA,KAAU,SAAA,KAAA,OAAA;IACV,aAAA;IAEJ,WACE;IAGN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W;IACX,WAAW;IACX,WAAS;GACX,CAAC,CAAA;GACD,MAAA,KAAS,SAAK,KACZ,MAAK,KAAO,OAAA,EAAA,WAAA,KAAA,CAAA,GAAA;IAAE,aAAa;IAA6B,UAAA;GAAc,CAAA,CAAA;GAAgB,KACxF,KAAA,SAAA,aAAA,0CAAA,CAAA;GACA,KAAA,KAAM,SAAK,KACT,OAAW;IACT,aAAa;IACb,WAAU;IACX,WACH;GACA,CAAA,CAAA;GACA,WAAU,KAAA,SACH,KAAA,MAAO;IAAE,KAAA,QAAa,OAAA;IAA8B,KAAA,QAAW,MAAA;IAAG,KAAA,QAAW,KAAA;GAAK,GACzF,EAAA,aAAA,oDAAA,CAAA,CAAA;GACA,SAAA,KAAW,SAAK,aACH,gCAAA,CAAA;GAAC;EAAuB,CAAA;EAAsB,WAAK,KAAQ,OAAK;GAAC,IAAG,UAC7E,YAAa;GAGjB,MAAA,KAAS,OAAK;IACd,aAAA;IACD,WAAA;IACD,WAAW;GACT,CAAA;GACA;EACE,CAAA;CACA;AACA;AAEF,SAAA,wBAAA,6BAAA"}
|
|
1
|
+
{"version":3,"file":"tool-schemas.mjs","names":[],"sources":["../../src/tool-schemas.ts"],"sourcesContent":["/**\n * Tool parameter schemas shared by every surface (MCP server, Pi and OMP\n * extensions). Each surface owns a different TypeBox build (the extensions\n * must use their host's facade), so the schemas are a factory over a minimal\n * structural builder instead of importing typebox here.\n */\n\n/**\n * The subset of the TypeBox builder the tool schemas need. `I` is the schema\n * type the builder accepts as input, `S` the (possibly narrower) type it\n * returns; OMP's facade accepts its own `AnySchema` while producing schemas\n * that satisfy the host's stricter `TSchema`.\n */\nexport interface McpSchemaBuilder<I, S> {\n Object(properties: Readonly<Record<string, I>>, options?: object): S;\n String(options?: object): I;\n Integer(options?: object): I;\n Boolean(options?: object): I;\n Array(item: I, options?: object): I;\n Record(key: I, value: I, options?: object): I;\n Union(schemas: readonly I[], options?: object): I;\n Literal(value: string, options?: object): I;\n Optional(schema: I): I;\n}\n\nexport const HARNESS_INFO_MAX_ITEMS = 20;\nexport const RUN_TIMEOUT_DEFAULT_SECONDS = 600;\n\n/**\n * Builds the parameter schemas for all harness tools with the host's TypeBox.\n *\n * @param Type - Host-provided TypeBox-compatible schema builder.\n * @returns {Record<string, S>} Schemas keyed by harness tool operation.\n */\nexport function harnessToolSchemas<I, S>(Type: McpSchemaBuilder<I, S>) {\n const harnessId = (description: string) =>\n Type.String({ description, minLength: 1, maxLength: 50, pattern: \"^[a-z][a-z0-9-]*$\" });\n\n const stringRecord = (description: string) =>\n Type.Record(Type.String({ maxLength: 256 }), Type.String({ maxLength: 4096 }), {\n description,\n });\n\n /**\n * A closed object rejects a stray `read_only` instead of quietly running with every tool.\n *\n * @param properties - Declared tool arguments.\n * @returns {S} An object schema that refuses undeclared keys.\n */\n const closed = (properties: Readonly<Record<string, I>>) =>\n Type.Object(properties, { additionalProperties: false });\n\n const scope = Type.Optional(\n Type.Union([Type.Literal(\"user\"), Type.Literal(\"project\")], {\n description: \"Which config file to target (default user)\",\n }),\n );\n\n return {\n /** Open on purpose: nothing to misread, and some models send a placeholder `_` here. */\n detect: Type.Object({}),\n info: closed({\n id: Type.Union(\n [\n harnessId(\"Harness id\"),\n Type.Array(harnessId(\"Harness id\"), {\n minItems: 1,\n maxItems: HARNESS_INFO_MAX_ITEMS,\n }),\n ],\n { description: \"Harness id, or a list of ids to inspect in one call\" },\n ),\n }),\n models: closed({\n id: harnessId(\"Harness id\"),\n search: Type.Optional(\n Type.String({\n description:\n \"Optional model search filter; without a native one, ids match ignoring case\",\n minLength: 1,\n maxLength: 1024,\n }),\n ),\n cwd: Type.Optional(\n Type.String({\n description: \"Working directory used while loading harness configuration\",\n minLength: 1,\n maxLength: 4096,\n }),\n ),\n timeoutSeconds: Type.Optional(\n Type.Integer({\n description: `Wall-clock budget in seconds (default ${RUN_TIMEOUT_DEFAULT_SECONDS})`,\n minimum: 1,\n maximum: 3600,\n }),\n ),\n }),\n run: closed({\n id: harnessId(\"Harness id\"),\n prompt: Type.String({\n description: \"Prompt to send to the harness\",\n minLength: 1,\n maxLength: 100000,\n }),\n cwd: Type.Optional(\n Type.String({\n description: \"Working directory for the run\",\n minLength: 1,\n maxLength: 4096,\n }),\n ),\n model: Type.Optional(\n Type.String({\n description: \"Harness-native model id or selector\",\n minLength: 1,\n maxLength: 512,\n }),\n ),\n timeoutSeconds: Type.Optional(\n Type.Integer({\n description: `Wall-clock budget in seconds (default ${RUN_TIMEOUT_DEFAULT_SECONDS})`,\n minimum: 1,\n maximum: 3600,\n }),\n ),\n structured: Type.Optional(\n Type.Boolean({\n description: \"Use the harness's structured (JSON) output mode instead of plain text\",\n }),\n ),\n tools: Type.Boolean({\n description:\n \"Explicit execution mode. Set true when the task needs any harness tools, including Grok native X search. Set false only for an advisor without tools.\",\n }),\n readOnly: Type.Optional(\n Type.Boolean({\n description:\n \"Set with tools=true to require native read-only tool enforcement. Unsupported harnesses reject the run instead of widening access.\",\n }),\n ),\n }),\n mcpList: closed({\n id: Type.Optional(harnessId(\"Harness id; omit to list every harness\")),\n }),\n mcpSync: closed({\n id: Type.Optional(harnessId(\"Harness id; omit to sync every harness\")),\n }),\n agentsSync: closed({\n id: Type.Optional(harnessId(\"Harness id; omit to sync every harness\")),\n check: Type.Optional(\n Type.Boolean({ description: \"Report what would change without writing anything\" }),\n ),\n }),\n promptsSync: closed({\n id: Type.Optional(harnessId(\"Harness id; omit to sync every harness\")),\n check: Type.Optional(\n Type.Boolean({ description: \"Report what would change without writing anything\" }),\n ),\n }),\n mcpAdd: closed({\n id: harnessId(\"Harness id\"),\n name: Type.String({\n description: \"Server name\",\n minLength: 1,\n maxLength: 100,\n pattern: \"^[A-Za-z0-9][A-Za-z0-9_-]*$\",\n }),\n command: Type.Optional(\n Type.String({ description: \"Binary for a stdio server\", minLength: 1, maxLength: 4096 }),\n ),\n args: Type.Optional(\n Type.Array(Type.String({ maxLength: 4096 }), {\n description: \"Arguments for a stdio server\",\n maxItems: 64,\n }),\n ),\n env: Type.Optional(stringRecord(\"Environment variables for a stdio server\")),\n url: Type.Optional(\n Type.String({ description: \"URL for an http/sse server\", minLength: 1, maxLength: 4096 }),\n ),\n transport: Type.Optional(\n Type.Union([Type.Literal(\"stdio\"), Type.Literal(\"http\"), Type.Literal(\"sse\")], {\n description: \"Transport; inferred from url/command when omitted\",\n }),\n ),\n headers: Type.Optional(stringRecord(\"Headers for an http/sse server\")),\n scope,\n }),\n mcpRemove: closed({\n id: harnessId(\"Harness id\"),\n name: Type.String({\n description: \"Server name\",\n minLength: 1,\n maxLength: 100,\n }),\n scope,\n }),\n };\n}\n\n/**\n * Parameter types matching the schemas above. The generic factory erases the\n * builders' literal types, so hosts annotate their execute callbacks with\n * these instead of TypeBox Static inference.\n */\nexport interface InfoParams {\n id: string | string[];\n}\n\nexport interface ModelsParams {\n id: string;\n search?: string;\n cwd?: string;\n timeoutSeconds?: number;\n}\n\nexport interface RunParams {\n id: string;\n prompt: string;\n cwd?: string;\n model?: string;\n timeoutSeconds?: number;\n structured?: boolean;\n tools: boolean;\n readOnly?: boolean;\n}\n\nexport interface McpListParams {\n id?: string;\n}\n\nexport interface McpSyncParams {\n id?: string;\n}\n\nexport interface AgentsSyncParams {\n id?: string;\n check?: boolean;\n}\n\nexport interface PromptsSyncParams {\n id?: string;\n check?: boolean;\n}\n\nexport interface McpAddParams {\n id: string;\n name: string;\n command?: string;\n args?: string[];\n env?: Record<string, string>;\n url?: string;\n transport?: \"stdio\" | \"http\" | \"sse\";\n headers?: Record<string, string>;\n scope?: \"user\" | \"project\";\n}\n\nexport interface McpRemoveParams {\n id: string;\n name: string;\n scope?: \"user\" | \"project\";\n}\n"],"mappings":"AAyBA,MAAa,yBAAyB;AACtC,MAAa,8BAA8B;;;;;;EAQ3C,SAAgB;CACd,CAAA;CACgB,MAAA,gBAAA,gBAAA,KAAA,OAAA,KAAA,OAAA,EAAA,WAAA,IAAA,CAAA,GAAA,KAAA,OAAA,EAAA,WAAA,KAAA,CAAA,GA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,YAAA,OAAa;GACb,IAAA,KAAA,SAAS,UAAA,wCAAA,CAAA;GACT,OAAA,KAAS,SAAA,KAAA,QAAA,EAAA,aAAA,oDAAA,CAAA,CAAA;EACX,CAAA;EAEF,aAAY,OAAK;GAKjB,IAAA,KAAO,SAAK,UACV,wCACE,CAAA;GAEJ,OAAA,KAAU,SAAK,KACb,QAAK,EAAA,aACH,oDACE,CAAA,CAAA;EAGR,CAAC;EACD,QAAA,OAAS;GAGT,IAAA,UAAS,YACE;GAEX,MAAA,KAAY,OAAO;IACjB,aAAS;IACT,WAAY;IAGb,WAAA;IACD,SAAA;GACE,CAAA;GACA,SAAO,KAAK,SACV,KAAK,OAAQ;IAEhB,aAAA;IACD,WAAQ;IACN,WAAI;GACJ,CAAA,CAAA;GACE,MAAA,KAAA,SAAa,KAAA,MAAA,KAAA,OAAA,EAAA,WAAA,KAAA,CAAA,GAAA;IACb,aAAW;IACX,UAAA;GACA,CAAA,CAAA;GACF,KAAC,KAAA,SAAA,aAAA,0CAAA,CAAA;GACD,KAAA,KAAS,SAAK,KACZ,OAAK;IAAS,aAAa;IAA6B,WAAW;IAAG,WAAW;GAAK,CAAC,CACzF;GACA,WAAW,KAAA,SACJ,KAAA,MAAW;IACd,KAAA,QAAa,OAAA;IACb,KAAA,QAAU,MAAA;IACX,KACH,QAAA,KAAA;GACA,GAAA,EAAK,aAAK,oDAAsB,CAAA,CAAA;GAChC,SAAK,KAAK,SACR,aAAY,gCAAA,CAAA;GAAE;EAA2C,CAAA;EAAc,WAAA,OAAW;GAAK,IACzF,UAAA,YAAA;GACA,MAAA,KAAW,OAAK;IACF,aAAa;IAAU,WAAK;IAAiB,WAAK;GAAc,CAAA;GAI9E;EACA,CAAA;CACF;AACA;AAEE,SAAM,wBAAY,6BAAA"}
|
package/dist/_chunks/types.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","names":["pkg.version"],"sources":["../../package.json","../../src/types.ts"],"sourcesContent":["","import pkg from \"../package.json\" with { type: \"json\" };\n\nexport const version: string = pkg.version;\n\nexport type HarnessId =\n | \"antigravity\"\n | \"codex\"\n | \"gemini\"\n | \"grok\"\n | \"claude\"\n | \"opencode\"\n | \"cursor\"\n | \"freebuff\"\n | \"github-copilot\"\n | \"mastracode\"\n | \"omp\"\n | \"pi\"\n | \"prime-agent\";\nexport type EvidenceLevel = \"official\" | \"community\" | \"inferred\";\nexport type Platform = \"linux\" | \"darwin\" | \"win32\";\n\nexport interface PathCandidate {\n path: string;\n scope: \"user\" | \"project\" | \"system\" | \"data\";\n level: EvidenceLevel;\n platforms?: Platform[];\n note?: string;\n}\n\nexport interface StorageDescriptor {\n format: string;\n level: EvidenceLevel;\n note?: string;\n}\n\nexport interface HarnessCapabilities {\n mcp: boolean;\n vision: boolean;\n /** Audio reaches the model without conversion or MCP. */\n audio: boolean;\n /** Video reaches the model without conversion or MCP. */\n video: boolean;\n tools: boolean;\n streaming: boolean;\n}\n\n/** How to run one prompt through the harness non-interactively. */\nexport interface HarnessInvocation {\n /** Binary to spawn; defaults to the harness's first `binaries` entry. */\n binary?: string;\n /** Full agent argument template; every \"{prompt}\" is replaced with the prompt text. */\n args: string[];\n /** Structured full agent argument template. */\n jsonArgs?: string[];\n /** Advisor argument template without tools; absent when the CLI cannot disable tools. */\n noToolsArgs?: string[];\n /** Structured advisor argument template without tools. */\n noToolsJsonArgs?: string[];\n /** Agent argument template whose native sandbox enforces read-only tool access. */\n readOnlyArgs?: string[];\n /** Structured agent argument template with read-only tool access. */\n readOnlyJsonArgs?: string[];\n /** Lowest CLI version whose read-only enforcement was verified; older or unknown versions reject read-only runs. */\n readOnlyMinVersion?: string;\n /** Arguments appended when a model is selected; every \"{model}\" is replaced. */\n modelArgs?: string[];\n level: EvidenceLevel;\n note?: string;\n}\n\n/** Invocation modes a harness supports without fallback or prompt-only restrictions. */\nexport interface HarnessInvocationModes {\n advisor: boolean;\n advisorStructured: boolean;\n readOnly: boolean;\n readOnlyStructured: boolean;\n agent: boolean;\n agentStructured: boolean;\n}\n\n/** How to ask one harness CLI for the models currently available to it. */\nexport interface HarnessModelListing {\n /** Arguments used when no search filter is supplied. */\n args: string[];\n
|
|
1
|
+
{"version":3,"file":"types.mjs","names":["pkg.version"],"sources":["../../package.json","../../src/types.ts"],"sourcesContent":["","import pkg from \"../package.json\" with { type: \"json\" };\n\nexport const version: string = pkg.version;\n\nexport type HarnessId =\n | \"antigravity\"\n | \"codex\"\n | \"gemini\"\n | \"grok\"\n | \"claude\"\n | \"opencode\"\n | \"cursor\"\n | \"freebuff\"\n | \"github-copilot\"\n | \"mastracode\"\n | \"omp\"\n | \"pi\"\n | \"prime-agent\";\nexport type EvidenceLevel = \"official\" | \"community\" | \"inferred\";\nexport type Platform = \"linux\" | \"darwin\" | \"win32\";\n\nexport interface PathCandidate {\n path: string;\n scope: \"user\" | \"project\" | \"system\" | \"data\";\n level: EvidenceLevel;\n platforms?: Platform[];\n note?: string;\n}\n\n/** The path lists of a harness descriptor, as named in {@link ResolvedPaths}. */\nexport type PathCategory =\n | \"config\"\n | \"sessions\"\n | \"instructions\"\n | \"skills\"\n | \"commands\"\n | \"promptTemplates\"\n | \"hooks\"\n | \"temp\";\n\n/**\n * An environment variable the harness reads to move one of its roots. `path`\n * is the default root, used while the variable is unset or empty.\n */\nexport interface EnvOverride extends PathCandidate {\n variable: string;\n /** Categories with entries under this root, which move with it. */\n relocates: PathCategory[];\n}\n\n/** One stable user-scope destination used by prompt template synchronization. */\nexport interface PromptTemplateSyncTarget extends PathCandidate {\n scope: \"user\";\n format: \"markdown\" | \"gemini-toml\";\n}\n\nexport interface StorageDescriptor {\n format: string;\n level: EvidenceLevel;\n note?: string;\n}\n\nexport interface HarnessCapabilities {\n mcp: boolean;\n vision: boolean;\n /** Audio reaches the model without conversion or MCP. */\n audio: boolean;\n /** Video reaches the model without conversion or MCP. */\n video: boolean;\n tools: boolean;\n streaming: boolean;\n}\n\n/** How to run one prompt through the harness non-interactively. */\nexport interface HarnessInvocation {\n /** Binary to spawn; defaults to the harness's first `binaries` entry. */\n binary?: string;\n /** Full agent argument template; every \"{prompt}\" is replaced with the prompt text. */\n args: string[];\n /** Structured full agent argument template. */\n jsonArgs?: string[];\n /** Advisor argument template without tools; absent when the CLI cannot disable tools. */\n noToolsArgs?: string[];\n /** Structured advisor argument template without tools. */\n noToolsJsonArgs?: string[];\n /** Agent argument template whose native sandbox enforces read-only tool access. */\n readOnlyArgs?: string[];\n /** Structured agent argument template with read-only tool access. */\n readOnlyJsonArgs?: string[];\n /** Lowest CLI version whose read-only enforcement was verified; older or unknown versions reject read-only runs. */\n readOnlyMinVersion?: string;\n /** Arguments appended when a model is selected; every \"{model}\" is replaced. */\n modelArgs?: string[];\n /**\n * Arguments appended to a plain text run so a CLI that holds its answer until\n * the end reports it as events instead; `invoke` folds them back into that text,\n * so a stopped run keeps what the model had already written.\n */\n streamArgs?: string[];\n level: EvidenceLevel;\n note?: string;\n}\n\n/** Invocation modes a harness supports without fallback or prompt-only restrictions. */\nexport interface HarnessInvocationModes {\n advisor: boolean;\n advisorStructured: boolean;\n readOnly: boolean;\n readOnlyStructured: boolean;\n agent: boolean;\n agentStructured: boolean;\n}\n\n/** How to ask one harness CLI for the models currently available to it. */\nexport interface HarnessModelListing {\n /** Arguments used when no search filter is supplied. */\n args: string[];\n /**\n * Optional argument template for a native search filter; every \"{search}\" is replaced.\n * Without it, a search runs `args` and keeps the ids containing the filter, ignoring case.\n */\n searchArgs?: string[];\n level: EvidenceLevel;\n note?: string;\n}\n\n/** One model normalized from a harness's native model-listing output. */\nexport interface AvailableModel {\n provider: string;\n id: string;\n /** Absent when the native listing prints only ids, like Grok's. */\n contextWindow?: number;\n maxOutputTokens?: number;\n thinking?: boolean;\n images?: boolean;\n /** Set on the model the harness picks when no model is given, when the listing marks one. */\n default?: boolean;\n}\n\n/** Options for querying the models available to one harness. */\nexport interface ListModelsOptions {\n search?: string;\n cwd?: string;\n env?: Record<string, string>;\n /** Milliseconds before cleanup starts. Unset or 0 disables the deadline. */\n timeoutMs?: number;\n /** Cancel with the same process cleanup as a timeout. */\n signal?: AbortSignal;\n}\n\nexport interface InvokeOptions {\n cwd?: string;\n env?: Record<string, string>;\n /** Harness-native model id or selector. */\n model?: string;\n /** Enable the spawned harness's tools; defaults to advisor without tools mode. */\n tools?: boolean;\n /** Require native enforcement of read-only tool access. Implies `tools: true` when `tools` is omitted; `tools: false` rejects the run. */\n readOnly?: boolean;\n /** Milliseconds before cleanup starts. Unset or 0 disables the deadline. */\n timeoutMs?: number;\n /** Cancel with the same process cleanup as a timeout. */\n signal?: AbortSignal;\n /** Use the harness's structured (JSON) output mode instead of plain text. */\n structured?: boolean;\n}\n\nexport interface InvokeResult {\n command: string;\n args: string[];\n stdout: string;\n stderr: string;\n /** Process exit code; null when terminated by a signal, timeout, or cancellation. */\n exitCode: number | null;\n timedOut: boolean;\n /** True when caller cancellation wins over the deadline or completion. */\n aborted: boolean;\n /** Milliseconds without output on either stream before a deadline or cancellation stopped the process. */\n idleMs?: number;\n}\n\n/** Result of one native model-listing command. */\nexport interface ListModelsResult extends InvokeResult {\n /** Empty on a successful no-match response or when the command itself failed. */\n models: AvailableModel[];\n}\n\n/** Normalized MCP server entry, shared across every harness dialect. */\nexport interface McpServerConfig {\n name: string;\n transport: \"stdio\" | \"http\" | \"sse\";\n command?: string;\n args?: string[];\n /**\n * Environment for stdio servers. A value that is exactly \"${NAME}\" refers to\n * the variable NAME of the harness environment: dialects with native\n * references keep it, the others resolve it when the entry is written.\n */\n env?: Record<string, string>;\n url?: string;\n headers?: Record<string, string>;\n /** Present only when the harness tracks an on/off state per server. */\n enabled?: boolean;\n}\n\n/** How one harness config file stores its MCP servers. */\nexport interface McpConfigFile extends PathCandidate {\n format: \"json\" | \"toml\";\n /** Object path to the server map inside the file, e.g. [\"mcpServers\"]. */\n key: string[];\n /**\n * Shape of individual entries; \"standard\" is the {command, args, env, url}\n * family, \"prime\" is that family with env values as {\"env\": \"NAME\"} references\n * and \"mastracode\" is that family read by its keys alone, type ignored.\n */\n dialect: \"standard\" | \"antigravity\" | \"mastracode\" | \"opencode\" | \"prime\" | \"vscode\";\n}\n\nexport interface HarnessDetection {\n /** Environment variables that indicate running inside this agent. */\n envVars: string[];\n /** Project-level files or directories whose presence indicates this agent. */\n projectMarkers: string[];\n}\n\nexport interface ResolveOptions {\n homeDir?: string;\n projectRoot?: string;\n platform?: Platform;\n /** Replaces `os.tmpdir()` as the value of `${TMPDIR}`. */\n tempDir?: string;\n}\n\nexport interface ResolvedPaths {\n config: PathCandidate[];\n sessions: PathCandidate[];\n instructions: PathCandidate[];\n skills: PathCandidate[];\n commands: PathCandidate[];\n promptTemplates: PathCandidate[];\n promptTemplateSyncTarget: PromptTemplateSyncTarget | null;\n hooks: PathCandidate[];\n /** Temp roots, moved by a set `temp` override from {@link EnvOverride}. */\n temp: PathCandidate[];\n}\n"],"mappings":"ACEA,MAAa,UAAkBA"}
|