@agntn/harnesses 0.3.1 → 0.4.1
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 +16 -16
- package/dist/_chunks/agents.mjs +1 -1
- package/dist/_chunks/mcp-servers.mjs +1 -1
- package/dist/_chunks/output.mjs +1 -1
- package/dist/_chunks/output.mjs.map +1 -1
- package/dist/_chunks/skills-sync.d.mts +16 -4
- package/dist/_chunks/skills-sync.d.mts.map +1 -1
- package/dist/_chunks/skills-sync.mjs +169 -17
- package/dist/_chunks/skills-sync.mjs.map +1 -1
- package/dist/_chunks/tool-operations.mjs +29 -11
- package/dist/_chunks/tool-operations.mjs.map +1 -1
- package/dist/_chunks/tool-schemas.d.mts +1 -0
- package/dist/_chunks/tool-schemas.d.mts.map +1 -1
- package/dist/_chunks/tool-schemas.mjs +6 -0
- 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 +34 -23
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +2 -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 +3 -2
- package/dist/mcp.mjs.map +1 -1
- package/dist/tool-operations.d.mts +14 -4
- package/dist/tool-operations.d.mts.map +1 -1
- package/package.json +2 -2
- package/packages/omp/extensions/harnesses.ts +15 -44
- package/packages/pi/extensions/harnesses.ts +8 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as
|
|
1
|
+
import { C as readOnlyVersionError, _ as getAllHarnesses, b as listHarnesses, c as listMcpServers, d as readMasterMcpServers, f as removeMcpServer, i as syncAgentsFiles, n as syncPromptTemplates, p as syncMcpServers, r as readAgentsConfig, s as addMcpServer, t as syncSkills, v as getHarness, w as selectionError, y as isHarnessId } from "./skills-sync.mjs";
|
|
2
2
|
import "./tool-schemas.mjs";
|
|
3
3
|
import { stripVTControlCharacters } from "node:util";
|
|
4
4
|
import { encode } from "@toon-format/toon";
|
|
@@ -74,6 +74,7 @@ function completedRun(harness, result, options, templateArgs) {
|
|
|
74
74
|
command: result.command,
|
|
75
75
|
args: [...templateArgs],
|
|
76
76
|
...options.model === void 0 ? {} : { model: options.model },
|
|
77
|
+
...options.effort === void 0 ? {} : { effort: options.effort },
|
|
77
78
|
structured: options.structured,
|
|
78
79
|
tools: options.tools,
|
|
79
80
|
readOnly: options.readOnly,
|
|
@@ -107,8 +108,7 @@ function unsupportedInvocation(harness, id, options) {
|
|
|
107
108
|
const error = harness.invocationError(options) ?? `Invalid ${id} invocation`;
|
|
108
109
|
const invocationModes = harness.invocationModes;
|
|
109
110
|
const mode = selectedInvocationMode(options.structured, options.tools, options.readOnly);
|
|
110
|
-
|
|
111
|
-
if (invocationModes[mode] || harness.invocation === null || modelUnsupported) {
|
|
111
|
+
if (invocationModes[mode] || harness.invocation === null || selectionError(harness.id, harness.invocation, options) !== null) {
|
|
112
112
|
const details = { error };
|
|
113
113
|
return {
|
|
114
114
|
content: text(details),
|
|
@@ -131,11 +131,17 @@ function unsupportedInvocation(harness, id, options) {
|
|
|
131
131
|
function detectHarnesses() {
|
|
132
132
|
const details = { harnesses: getAllHarnesses().map((harness) => {
|
|
133
133
|
const installed = harness.isInstalled();
|
|
134
|
+
const version = installed ? harness.version : null;
|
|
135
|
+
const { advisor, readOnly, agent } = harness.invocationModes;
|
|
136
|
+
const belowFloor = installed && readOnlyVersionError(harness.id, harness.invocation, version) !== null;
|
|
134
137
|
return {
|
|
135
138
|
id: harness.id,
|
|
136
139
|
name: harness.name,
|
|
137
140
|
installed,
|
|
138
|
-
version
|
|
141
|
+
version,
|
|
142
|
+
advisor,
|
|
143
|
+
readOnly: readOnly && !belowFloor,
|
|
144
|
+
agent
|
|
139
145
|
};
|
|
140
146
|
}) };
|
|
141
147
|
return {
|
|
@@ -154,6 +160,7 @@ function harnessInfoResult(id) {
|
|
|
154
160
|
invocationModes: harness.invocationModes,
|
|
155
161
|
modelListing: harness.modelListing !== null,
|
|
156
162
|
modelSelection: harness.invocation?.modelArgs !== void 0,
|
|
163
|
+
effortSelection: harness.invocation?.effortArgs !== void 0,
|
|
157
164
|
config: harness.config,
|
|
158
165
|
sessions: harness.sessions,
|
|
159
166
|
instructions: harness.instructions,
|
|
@@ -172,7 +179,7 @@ function harnessInfoResult(id) {
|
|
|
172
179
|
}
|
|
173
180
|
function harnessInfoText(result) {
|
|
174
181
|
if ("error" in result) return result;
|
|
175
|
-
const { id, name, binaries, capabilities, invocationModes, modelListing, modelSelection, envOverrides, persistence, detection, resolved } = result;
|
|
182
|
+
const { id, name, binaries, capabilities, invocationModes, modelListing, modelSelection, effortSelection, envOverrides, persistence, detection, resolved } = result;
|
|
176
183
|
return {
|
|
177
184
|
id,
|
|
178
185
|
name,
|
|
@@ -181,6 +188,7 @@ function harnessInfoText(result) {
|
|
|
181
188
|
invocationModes,
|
|
182
189
|
modelListing,
|
|
183
190
|
modelSelection,
|
|
191
|
+
effortSelection,
|
|
184
192
|
envOverrides: getHarness(id).resolveCandidates(envOverrides),
|
|
185
193
|
persistence,
|
|
186
194
|
detection,
|
|
@@ -242,7 +250,7 @@ async function listHarnessModels(id, options = {}) {
|
|
|
242
250
|
return completedListing(harness.id, result, result.models, options.search);
|
|
243
251
|
}
|
|
244
252
|
function completedListing(id, result, models, search) {
|
|
245
|
-
const
|
|
253
|
+
const contentOutcome = {
|
|
246
254
|
id,
|
|
247
255
|
command: result.command,
|
|
248
256
|
args: [...result.args],
|
|
@@ -251,13 +259,21 @@ function completedListing(id, result, models, search) {
|
|
|
251
259
|
exitCode: result.exitCode,
|
|
252
260
|
timedOut: result.timedOut,
|
|
253
261
|
aborted: result.aborted,
|
|
254
|
-
...result.idleMs === void 0 ? {} : { idleMs: result.idleMs }
|
|
255
|
-
stderr: truncate(result.stderr)
|
|
262
|
+
...result.idleMs === void 0 ? {} : { idleMs: result.idleMs }
|
|
256
263
|
};
|
|
257
|
-
|
|
258
|
-
|
|
264
|
+
const stderr = truncate(result.stderr);
|
|
265
|
+
const details = {
|
|
266
|
+
...contentOutcome,
|
|
267
|
+
stderr
|
|
268
|
+
};
|
|
269
|
+
if (result.timedOut || result.exitCode !== 0) return {
|
|
270
|
+
content: runText(contentOutcome, { stderr }),
|
|
259
271
|
details,
|
|
260
|
-
|
|
272
|
+
isError: true
|
|
273
|
+
};
|
|
274
|
+
return {
|
|
275
|
+
content: runText(contentOutcome, {}),
|
|
276
|
+
details
|
|
261
277
|
};
|
|
262
278
|
}
|
|
263
279
|
function normalizedRunAccess(options) {
|
|
@@ -274,6 +290,7 @@ async function runHarness(id, prompt, options = {}) {
|
|
|
274
290
|
const { tools, readOnly } = normalizedRunAccess(options);
|
|
275
291
|
const invocationOptions = {
|
|
276
292
|
model: options.model,
|
|
293
|
+
effort: options.effort,
|
|
277
294
|
structured,
|
|
278
295
|
tools,
|
|
279
296
|
readOnly
|
|
@@ -286,6 +303,7 @@ async function runHarness(id, prompt, options = {}) {
|
|
|
286
303
|
result = await harness.invoke(prompt, {
|
|
287
304
|
cwd: options.cwd,
|
|
288
305
|
model: options.model,
|
|
306
|
+
effort: options.effort,
|
|
289
307
|
timeoutMs: timeoutSeconds * 1e3,
|
|
290
308
|
signal: options.signal,
|
|
291
309
|
structured,
|
|
@@ -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. 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\";\nexport type { SkillsSyncReport } from \"./skills-sync.ts\";\nimport { syncSkills } from \"./skills-sync.ts\";\nimport type { SkillsSyncReport } from \"./skills-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 SkillsSyncTarget,\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 skillsSyncTarget: SkillsSyncTarget | null;\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 skillsSyncTarget: harness.skillsSyncTarget,\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 | \"skillsSyncTarget\"\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\n/**\n * Links harness skills directories to the canonical skills directory.\n *\n * @param id - Optional harness id; omission targets every harness.\n * @param check - Report intended changes without writing them.\n * @returns {ToolResult<SkillsSyncReport | RunFailure>} The sync report or failure.\n */\nexport function skillsSync(id?: string, check = false): ToolResult<SkillsSyncReport | RunFailure> {\n if (id !== undefined && !isHarnessId(id)) return unknownHarness(id);\n\n try {\n const details = syncSkills(\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 };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AE,SAAS,KAAK,OAAO;GAAG;EAAQ;CAC3C,SAAS,OAAO;EACd,MAAM,UAAsB,EAAE,OAAO,aAAa,KAAK,EAAE;EACzD,OAAO;GAAE,SAAS,KAAK,OAAO;GAAG;GAAS,SAAS;EAAK;CAC1D;AACF"}
|
|
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\";\nexport type { SkillsSyncReport } from \"./skills-sync.ts\";\nimport { syncSkills } from \"./skills-sync.ts\";\nimport type { SkillsSyncReport } from \"./skills-sync.ts\";\nimport { readOnlyVersionError, selectionError } from \"./harness.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 SkillsSyncTarget,\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, plus the runs harnesses_run takes for it. */\nexport interface HarnessStatus {\n id: HarnessId;\n name: string;\n installed: boolean;\n version: string | null;\n /** Takes `tools: false`, an advisor without tools. */\n advisor: boolean;\n /** Takes `tools: true` with `readOnly: true`; false while the installed CLI is too old for it. */\n readOnly: boolean;\n /** Takes `tools: true`, the full agent. */\n agent: boolean;\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 effortSelection: boolean;\n config: PathCandidate[];\n sessions: PathCandidate[];\n instructions: PathCandidate[];\n skills: PathCandidate[];\n skillsSyncTarget: SkillsSyncTarget | null;\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 effort?: 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 ListingStatus = Readonly<Omit<ModelsOutcome, \"args\" | \"models\" | \"stderr\">> & {\n readonly args: readonly string[];\n readonly models: readonly Readonly<AvailableModel>[];\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 a run or listing out as a TOON status block, then each stream as plain text:\n * quoting a markdown answer into TOON escaped every code block and cost a tenth more tokens.\n *\n * @param outcome - The run or listing 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(\n outcome: RunStatus | ListingStatus,\n streams: RunStreams,\n): 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 ...(options.effort === undefined ? {} : { effort: options.effort }),\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 if (\n invocationModes[mode] ||\n harness.invocation === null ||\n selectionError(harness.id, harness.invocation, options) !== null\n ) {\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, next to the modes it runs in.\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 const version = installed ? harness.version : null;\n const { advisor, readOnly, agent } = harness.invocationModes;\n const belowFloor =\n installed && readOnlyVersionError(harness.id, harness.invocation, version) !== null;\n return {\n id: harness.id,\n name: harness.name,\n installed,\n version,\n advisor,\n readOnly: readOnly && !belowFloor,\n agent,\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 effortSelection: harness.invocation?.effortArgs !== undefined,\n config: harness.config,\n sessions: harness.sessions,\n instructions: harness.instructions,\n skills: harness.skills,\n skillsSyncTarget: harness.skillsSyncTarget,\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 | \"skillsSyncTarget\"\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 effortSelection,\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 effortSelection,\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 contentOutcome: Omit<ModelsOutcome, \"stderr\"> = {\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 };\n const stderr = truncate(result.stderr);\n const details: ModelsOutcome = { ...contentOutcome, stderr };\n if (result.timedOut || result.exitCode !== 0) {\n return { content: runText(contentOutcome, { stderr }), details, isError: true };\n }\n return { content: runText(contentOutcome, {}), details };\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 /** Reasoning effort in the harness's own words; rejected where `effortArgs` is missing. */\n effort?: 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 effort?: 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` and `effort` are 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 = {\n model: options.model,\n effort: options.effort,\n structured,\n tools,\n readOnly,\n };\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 effort: options.effort,\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\n/**\n * Links harness skills directories to the canonical skills directory.\n *\n * @param id - Optional harness id; omission targets every harness.\n * @param check - Report intended changes without writing them.\n * @returns {ToolResult<SkillsSyncReport | RunFailure>} The sync report or failure.\n */\nexport function skillsSync(id?: string, check = false): ToolResult<SkillsSyncReport | RunFailure> {\n if (id !== undefined && !isHarnessId(id)) return unknownHarness(id);\n\n try {\n const details = syncSkills(\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) };\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AE,SAAS,KAAK,OAAO;GAAG;EAAQ;CAC3C,SAAS,OAAO;EACd,MAAM,UAAsB,EAAE,OAAO,aAAa,KAAK,EAAE;EACzD,OAAO;GAAE,SAAS,KAAK,OAAO;GAAG;GAAS,SAAS;EAAK;CAC1D;AACF;AASA,SAAgB,WAAW,IAAa,QAAQ,OAAkD;CAChG,IAAI,OAAO,KAAA,KAAa,CAAC,YAAY,EAAE,GAAG,OAAO,eAAe,EAAE;CAElE,IAAI;EACF,MAAM,UAAU,WACd,OAAO,KAAA,KAAa,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI,gBAAgB,GACzE,KACF;EACA,OAAO;GAAE,SAAS,KAAK,OAAO;GAAG;EAAQ;CAC3C,SAAS,OAAO;EACd,MAAM,UAAsB,EAAE,OAAO,aAAa,KAAK,EAAE;EACzD,OAAO;GAAE,SAAS,KAAK,OAAO;GAAG;GAAS,SAAS;EAAK;CAC1D;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-schemas.d.mts","names":[],"sources":["../../src/tool-schemas.ts"],"mappings":";;;;;;;;;;;;;UAaiB,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;;cAGV;cACA;;;;;;;iBAQG,mBAAmB,GAAG,GAAG,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"tool-schemas.d.mts","names":[],"sources":["../../src/tool-schemas.ts"],"mappings":";;;;;;;;;;;;;UAaiB,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;;cAGV;cACA;;;;;;;iBAQG,mBAAmB,GAAG,GAAG,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;UA2LlD;EACf;;UAGe;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;;UAGe;EACf;;UAGe;EACf;EACA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA,MAAM;EACN;EACA;EACA,UAAU;EACV;;UAGe;EACf;EACA;EACA"}
|
|
@@ -52,6 +52,12 @@ function harnessToolSchemas(Type) {
|
|
|
52
52
|
minLength: 1,
|
|
53
53
|
maxLength: 512
|
|
54
54
|
})),
|
|
55
|
+
effort: Type.Optional(Type.String({
|
|
56
|
+
description: "Reasoning effort in the harness's own words, such as low or high. Harnesses without effortSelection in harnesses_info reject it.",
|
|
57
|
+
minLength: 1,
|
|
58
|
+
maxLength: 32,
|
|
59
|
+
pattern: "^[a-z]+$"
|
|
60
|
+
})),
|
|
55
61
|
timeoutSeconds: Type.Optional(Type.Integer({
|
|
56
62
|
description: `Wall-clock budget in seconds (default 600)`,
|
|
57
63
|
minimum: 1,
|
|
@@ -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 /**\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 skillsSync: 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 SkillsSyncParams {\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;AAQ3C,SAAgB,mBAAyB,MAA8B;CACrE,MAAM,aAAa,gBACjB,KAAK,OAAO;EAAE;EAAa,WAAW;EAAG,WAAW;EAAI,SAAS;CAAoB,CAAC;CAExF,MAAM,gBAAgB,gBACpB,KAAK,OAAO,KAAK,OAAO,EAAE,WAAW,IAAI,CAAC,GAAG,KAAK,OAAO,EAAE,WAAW,KAAK,CAAC,GAAG,EAC7E,YACF,CAAC;CAQH,MAAM,UAAU,eACd,KAAK,OAAO,YAAY,EAAE,sBAAsB,MAAM,CAAC;CAEzD,MAAM,QAAQ,KAAK,SACjB,KAAK,MAAM,CAAC,KAAK,QAAQ,MAAM,GAAG,KAAK,QAAQ,SAAS,CAAC,GAAG,EAC1D,aAAa,6CACf,CAAC,CACH;CAEA,OAAO;EAEL,QAAQ,KAAK,OAAO,CAAC,CAAC;EACtB,MAAM,OAAO,EACX,IAAI,KAAK,MACP,CACE,UAAU,YAAY,GACtB,KAAK,MAAM,UAAU,YAAY,GAAG;GAClC,UAAU;GACV,UAAA;EACF,CAAC,CACH,GACA,EAAE,aAAa,sDAAsD,CACvE,EACF,CAAC;EACD,QAAQ,OAAO;GACb,IAAI,UAAU,YAAY;GAC1B,QAAQ,KAAK,SACX,KAAK,OAAO;IACV,aACE;IACF,WAAW;IACX,WAAW;GACb,CAAC,CACH;GACA,KAAK,KAAK,SACR,KAAK,OAAO;IACV,aAAa;IACb,WAAW;IACX,WAAW;G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Q,OAAO;GACb,IAAI,UAAU,YAAY;GAC1B,MAAM,KAAK,OAAO;IAChB,aAAa;IACb,WAAW;IACX,WAAW;IACX,SAAS;GACX,CAAC;GACD,SAAS,KAAK,SACZ,KAAK,OAAO;IAAE,aAAa;IAA6B,WAAW;IAAG,WAAW;GAAK,CAAC,CACzF;GACA,MAAM,KAAK,SACT,KAAK,MAAM,KAAK,OAAO,EAAE,WAAW,KAAK,CAAC,GAAG;IAC3C,aAAa;IACb,UAAU;GACZ,CAAC,CACH;GACA,KAAK,KAAK,SAAS,aAAa,0CAA0C,CAAC;GAC3E,KAAK,KAAK,SACR,KAAK,OAAO;IAAE,aAAa;IAA8B,WAAW;IAAG,WAAW;GAAK,CAAC,CAC1F;GACA,WAAW,KAAK,SACd,KAAK,MAAM;IAAC,KAAK,QAAQ,OAAO;IAAG,KAAK,QAAQ,MAAM;IAAG,KAAK,QAAQ,KAAK;GAAC,GAAG,EAC7E,aAAa,oDACf,CAAC,CACH;GACA,SAAS,KAAK,SAAS,aAAa,gCAAgC,CAAC;GACrE;EACF,CAAC;EACD,WAAW,OAAO;GAChB,IAAI,UAAU,YAAY;GAC1B,MAAM,KAAK,OAAO;IAChB,aAAa;IACb,WAAW;IACX,WAAW;GACb,CAAC;GACD;EACF,CAAC;CACH;AACF"}
|
|
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 effort: Type.Optional(\n Type.String({\n description:\n \"Reasoning effort in the harness's own words, such as low or high. Harnesses without effortSelection in harnesses_info reject it.\",\n minLength: 1,\n maxLength: 32,\n pattern: \"^[a-z]+$\",\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 skillsSync: 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 effort?: 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 SkillsSyncParams {\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;AAQ3C,SAAgB,mBAAyB,MAA8B;CACrE,MAAM,aAAa,gBACjB,KAAK,OAAO;EAAE;EAAa,WAAW;EAAG,WAAW;EAAI,SAAS;CAAoB,CAAC;CAExF,MAAM,gBAAgB,gBACpB,KAAK,OAAO,KAAK,OAAO,EAAE,WAAW,IAAI,CAAC,GAAG,KAAK,OAAO,EAAE,WAAW,KAAK,CAAC,GAAG,EAC7E,YACF,CAAC;CAQH,MAAM,UAAU,eACd,KAAK,OAAO,YAAY,EAAE,sBAAsB,MAAM,CAAC;CAEzD,MAAM,QAAQ,KAAK,SACjB,KAAK,MAAM,CAAC,KAAK,QAAQ,MAAM,GAAG,KAAK,QAAQ,SAAS,CAAC,GAAG,EAC1D,aAAa,6CACf,CAAC,CACH;CAEA,OAAO;EAEL,QAAQ,KAAK,OAAO,CAAC,CAAC;EACtB,MAAM,OAAO,EACX,IAAI,KAAK,MACP,CACE,UAAU,YAAY,GACtB,KAAK,MAAM,UAAU,YAAY,GAAG;GAClC,UAAU;GACV,UAAA;EACF,CAAC,CACH,GACA,EAAE,aAAa,sDAAsD,CACvE,EACF,CAAC;EACD,QAAQ,OAAO;GACb,IAAI,UAAU,YAAY;GAC1B,QAAQ,KAAK,SACX,KAAK,OAAO;IACV,aACE;IACF,WAAW;IACX,WAAW;GACb,CAAC,CACH;GACA,KAAK,KAAK,SACR,KAAK,OAAO;IACV,aAAa;IACb,WAAW;IACX,WAAW;GACb,CAAC,CACH;GACA,gBAAgB,KAAK,SACnB,KAAK,QAAQ;IACX,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oD,CAAC,CACnF;EACF,CAAC;EACD,QAAQ,OAAO;GACb,IAAI,UAAU,YAAY;GAC1B,MAAM,KAAK,OAAO;IAChB,aAAa;IACb,WAAW;IACX,WAAW;IACX,SAAS;GACX,CAAC;GACD,SAAS,KAAK,SACZ,KAAK,OAAO;IAAE,aAAa;IAA6B,WAAW;IAAG,WAAW;GAAK,CAAC,CACzF;GACA,MAAM,KAAK,SACT,KAAK,MAAM,KAAK,OAAO,EAAE,WAAW,KAAK,CAAC,GAAG;IAC3C,aAAa;IACb,UAAU;GACZ,CAAC,CACH;GACA,KAAK,KAAK,SAAS,aAAa,0CAA0C,CAAC;GAC3E,KAAK,KAAK,SACR,KAAK,OAAO;IAAE,aAAa;IAA8B,WAAW;IAAG,WAAW;GAAK,CAAC,CAC1F;GACA,WAAW,KAAK,SACd,KAAK,MAAM;IAAC,KAAK,QAAQ,OAAO;IAAG,KAAK,QAAQ,MAAM;IAAG,KAAK,QAAQ,KAAK;GAAC,GAAG,EAC7E,aAAa,oDACf,CAAC,CACH;GACA,SAAS,KAAK,SAAS,aAAa,gCAAgC,CAAC;GACrE;EACF,CAAC;EACD,WAAW,OAAO;GAChB,IAAI,UAAU,YAAY;GAC1B,MAAM,KAAK,OAAO;IAChB,aAAa;IACb,WAAW;IACX,WAAW;GACb,CAAC;GACD;EACF,CAAC;CACH;AACF"}
|
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\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/** The user-scope skills directory that skill synchronization links to the source. */\nexport interface SkillsSyncTarget extends PathCandidate {\n scope: \"user\";\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
|
|
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/** The user-scope skills directory that skill synchronization links to the source. */\nexport interface SkillsSyncTarget extends PathCandidate {\n scope: \"user\";\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 /** Arguments appended when a reasoning effort is selected; every \"{effort}\" is replaced. */\n effortArgs?: 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 /** Display name, where the adapter reads one from the listing; Codex so far. */\n name?: 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 /** Reasoning effort in the harness's own words (`low`, `high`, `max`), passed through as is. */\n effort?: 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 * \"mastracode\" is that family read by its keys alone, type ignored, and \"pi\"\n * is that family without sse that keeps the entry fields it doesn't manage.\n */\n dialect: \"standard\" | \"antigravity\" | \"mastracode\" | \"opencode\" | \"pi\" | \"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 skillsSyncTarget: SkillsSyncTarget | null;\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"}
|
package/dist/cli.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { t as version } from "./_chunks/types.mjs";
|
|
3
|
-
import { _ as
|
|
4
|
-
import { o as listHarnessModels } from "./_chunks/tool-operations.mjs";
|
|
5
|
-
import { t as exitOnClosedPipe } from "./_chunks/output.mjs";
|
|
3
|
+
import { _ as getAllHarnesses, b as listHarnesses, v as getHarness, y as isHarnessId } from "./_chunks/skills-sync.mjs";
|
|
4
|
+
import { i as detectHarnesses, o as listHarnessModels } from "./_chunks/tool-operations.mjs";
|
|
5
|
+
import { i as sanitize, t as exitOnClosedPipe } from "./_chunks/output.mjs";
|
|
6
6
|
import { defineCommand, runMain } from "citty";
|
|
7
7
|
import { consola } from "consola";
|
|
8
8
|
import { encode } from "@toon-format/toon";
|
|
@@ -83,6 +83,7 @@ function modelFailureMessage(details) {
|
|
|
83
83
|
}
|
|
84
84
|
function modelDescription(model) {
|
|
85
85
|
const parts = [];
|
|
86
|
+
if (model.name !== void 0) parts.push(model.name);
|
|
86
87
|
if (model.default) parts.push("default");
|
|
87
88
|
if (model.contextWindow !== void 0) parts.push(`${model.contextWindow} context`);
|
|
88
89
|
if (model.maxOutputTokens !== void 0) parts.push(`${model.maxOutputTokens} max-out`);
|
|
@@ -92,11 +93,18 @@ function modelDescription(model) {
|
|
|
92
93
|
if (features.length > 0) parts.push(features.join(", "));
|
|
93
94
|
return parts.join(" · ");
|
|
94
95
|
}
|
|
96
|
+
function runModes(status) {
|
|
97
|
+
return [
|
|
98
|
+
"advisor",
|
|
99
|
+
"readOnly",
|
|
100
|
+
"agent"
|
|
101
|
+
].filter((mode) => status[mode]);
|
|
102
|
+
}
|
|
95
103
|
function renderModels(details) {
|
|
96
104
|
const harness = getHarness(details.id);
|
|
97
105
|
consola.log(header(`${details.id} models`));
|
|
98
106
|
consola.log("");
|
|
99
|
-
for (const model of details.models) consola.log(entry(`${s.hi(harness.modelSelector(model))} ${s.dim(modelDescription(model))}`));
|
|
107
|
+
for (const model of details.models) consola.log(entry(`${s.hi(sanitize(harness.modelSelector(model)))} ${s.dim(sanitize(modelDescription(model)))}`));
|
|
100
108
|
if (details.models.length === 0) consola.log(entry(s.dim("No models found")));
|
|
101
109
|
consola.log("");
|
|
102
110
|
}
|
|
@@ -127,26 +135,21 @@ const list = defineCommand({
|
|
|
127
135
|
}
|
|
128
136
|
});
|
|
129
137
|
const detect = defineCommand({
|
|
130
|
-
meta: { description: "Detect installed harnesses and
|
|
138
|
+
meta: { description: "Detect installed harnesses, versions and run modes" },
|
|
131
139
|
args: { ...formatArgs },
|
|
132
140
|
run({ args }) {
|
|
133
|
-
const results =
|
|
134
|
-
const installed = harness.isInstalled();
|
|
135
|
-
const v = installed ? harness.version : null;
|
|
136
|
-
return {
|
|
137
|
-
id: harness.id,
|
|
138
|
-
name: harness.name,
|
|
139
|
-
installed,
|
|
140
|
-
version: v
|
|
141
|
-
};
|
|
142
|
-
});
|
|
141
|
+
const results = detectHarnesses().details.harnesses;
|
|
143
142
|
if (emit(results, args)) return;
|
|
144
143
|
consola.log(header("System Scan"));
|
|
145
144
|
consola.log("");
|
|
146
145
|
const maxId = Math.max(...results.map((r) => r.id.length));
|
|
146
|
+
const installed = results.filter((r) => r.installed);
|
|
147
|
+
const maxName = Math.max(...installed.map((r) => r.name.length));
|
|
148
|
+
const maxVersion = Math.max(...installed.map((r) => r.version ? r.version.length + 1 : 0));
|
|
147
149
|
for (const r of results) if (r.installed) {
|
|
148
|
-
const ver = r.version ? `
|
|
149
|
-
|
|
150
|
+
const ver = (r.version ? `v${r.version}` : "").padEnd(maxVersion);
|
|
151
|
+
const modes = runModes(r).join(" · ") || "no headless mode";
|
|
152
|
+
consola.log(entry(`${s.green("●")} ${s.hi(r.id.padEnd(maxId))} ${r.name.padEnd(maxName)} ${s.dim(ver)} ${s.dim(modes)}`));
|
|
150
153
|
} else consola.log(entry(`${s.dim("○")} ${s.dim(r.id.padEnd(maxId))} ${s.dim(r.name)}`));
|
|
151
154
|
consola.log("");
|
|
152
155
|
}
|
|
@@ -159,14 +162,20 @@ const info = defineCommand({
|
|
|
159
162
|
},
|
|
160
163
|
run({ args }) {
|
|
161
164
|
const harness = resolveHarness(args.id);
|
|
165
|
+
const modelFeatures = {
|
|
166
|
+
listing: harness.modelListing !== null,
|
|
167
|
+
selection: harness.invocation?.modelArgs !== void 0,
|
|
168
|
+
effort: harness.invocation?.effortArgs !== void 0
|
|
169
|
+
};
|
|
162
170
|
if (emit({
|
|
163
171
|
id: harness.id,
|
|
164
172
|
name: harness.name,
|
|
165
173
|
binaries: harness.binaries,
|
|
166
174
|
capabilities: harness.capabilities,
|
|
167
175
|
invocationModes: harness.invocationModes,
|
|
168
|
-
modelListing:
|
|
169
|
-
modelSelection:
|
|
176
|
+
modelListing: modelFeatures.listing,
|
|
177
|
+
modelSelection: modelFeatures.selection,
|
|
178
|
+
effortSelection: modelFeatures.effort,
|
|
170
179
|
config: harness.config,
|
|
171
180
|
sessions: harness.sessions,
|
|
172
181
|
instructions: harness.instructions,
|
|
@@ -189,10 +198,6 @@ const info = defineCommand({
|
|
|
189
198
|
const modes = Object.entries(harness.invocationModes).map(([k, v]) => v ? s.green(k) : s.dim(k)).join(s.dim(" · "));
|
|
190
199
|
consola.log(entry(modes));
|
|
191
200
|
consola.log(section("Models"));
|
|
192
|
-
const modelFeatures = {
|
|
193
|
-
listing: harness.modelListing !== null,
|
|
194
|
-
selection: harness.invocation?.modelArgs !== void 0
|
|
195
|
-
};
|
|
196
201
|
consola.log(entry(Object.entries(modelFeatures).map(([k, v]) => v ? s.green(k) : s.dim(k)).join(s.dim(" · "))));
|
|
197
202
|
renderPathSection("Config", harness.config);
|
|
198
203
|
renderPathSection("Sessions", harness.sessions);
|
|
@@ -298,6 +303,10 @@ const run = defineCommand({
|
|
|
298
303
|
type: "string",
|
|
299
304
|
description: "Harness-native model id or selector"
|
|
300
305
|
},
|
|
306
|
+
effort: {
|
|
307
|
+
type: "string",
|
|
308
|
+
description: "Reasoning effort in the harness's own words (low, high, max)"
|
|
309
|
+
},
|
|
301
310
|
timeout: {
|
|
302
311
|
type: "string",
|
|
303
312
|
description: "Wall-clock budget in seconds"
|
|
@@ -322,6 +331,7 @@ const run = defineCommand({
|
|
|
322
331
|
const tools = args.tools ?? readOnly;
|
|
323
332
|
const invocationOptions = {
|
|
324
333
|
model: args.model,
|
|
334
|
+
effort: args.effort,
|
|
325
335
|
structured,
|
|
326
336
|
tools,
|
|
327
337
|
readOnly
|
|
@@ -338,6 +348,7 @@ const run = defineCommand({
|
|
|
338
348
|
finishInvocation(await harness.invoke(args.prompt, {
|
|
339
349
|
cwd: args.cwd,
|
|
340
350
|
model: args.model,
|
|
351
|
+
effort: args.effort,
|
|
341
352
|
timeoutMs: timeoutSeconds === void 0 ? void 0 : timeoutSeconds * 1e3,
|
|
342
353
|
structured,
|
|
343
354
|
tools,
|