@agntn/harnesses 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":["toToon"],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { defineCommand, runMain } from \"citty\";\nimport { consola } from \"consola\";\nimport { encode as toToon } from \"@toon-format/toon\";\nimport { version, type AvailableModel, type InvokeResult } from \"./types.ts\";\nimport { getAllHarnesses, getHarness, isHarnessId, listHarnesses } from \"./registry.ts\";\nimport { listHarnessModels, type ModelsOutcome, type RunFailure } from \"./tool-operations.ts\";\n\nconst s = {\n cyan: (t: string) => `\\x1B[36m${t}\\x1B[0m`,\n hi: (t: string) => `\\x1B[96m${t}\\x1B[0m`,\n green: (t: string) => `\\x1B[32m${t}\\x1B[0m`,\n red: (t: string) => `\\x1B[31m${t}\\x1B[0m`,\n dim: (t: string) => `\\x1B[90m${t}\\x1B[0m`,\n bold: (t: string) => `\\x1B[1m${t}\\x1B[0m`,\n white: (t: string) => `\\x1B[97m${t}\\x1B[0m`,\n};\n\nfunction header(title: string) {\n return `\\n ${s.bold(s.cyan(title))}`;\n}\n\nfunction section(title: string) {\n return `\\n ${s.cyan(\"▸\")} ${s.white(title)}`;\n}\n\nfunction entry(content: string) {\n return ` ${content}`;\n}\n\nfunction renderPathSection(\n title: string,\n entries: readonly {\n readonly path: string;\n readonly scope: string;\n readonly platforms?: readonly string[];\n readonly note?: string;\n }[],\n) {\n if (!entries.length) return;\n consola.log(section(title));\n for (const e of entries) {\n const tags = [s.dim(e.scope)];\n if (e.platforms) tags.push(s.dim(e.platforms.join(\", \")));\n consola.log(entry(`${s.hi(e.path)} ${tags.join(s.dim(\" · \"))}`));\n if (e.note) consola.log(entry(`${s.dim(` ${e.note}`)}`));\n }\n}\n\nconst formatArgs = {\n json: { type: \"boolean\" as const, description: \"Output as JSON\" },\n toon: { type: \"boolean\" as const, description: \"Output as TOON\" },\n};\n\nconst harnessArg = {\n type: \"positional\" as const,\n description: \"Harness id\",\n required: true,\n};\n\nfunction emit(data: unknown, args: Readonly<{ json?: boolean; toon?: boolean }>) {\n if (args.json) {\n console.log(JSON.stringify(data, null, 2));\n return true;\n }\n if (args.toon) {\n console.log(toToon(data));\n return true;\n }\n return false;\n}\n\nfunction resolveHarness(id: string): ReturnType<typeof getHarness> {\n if (!isHarnessId(id)) {\n consola.error(`Unknown harness: ${id}\\nKnown: ${listHarnesses().join(\", \")}`);\n process.exit(1);\n }\n return getHarness(id);\n}\n\nfunction renderResolvedPathSection(\n title: string,\n entries: readonly { readonly path: string }[],\n): void {\n if (entries.length === 0) return;\n consola.log(section(title));\n for (const item of entries) consola.log(entry(s.hi(item.path)));\n}\n\nfunction parsePositiveTimeout(raw: string | undefined): number | null | undefined {\n if (!raw) return undefined;\n const value = Number(raw);\n return Number.isFinite(value) && value > 0 ? value : null;\n}\n\nfunction modelFailureMessage(details: ModelsOutcome | RunFailure): string {\n return \"error\" in details ? details.error : \"Failed to list models\";\n}\n\nfunction modelDescription(model: Readonly<AvailableModel>): string {\n const features: string[] = [];\n if (model.thinking) features.push(\"thinking\");\n if (model.images) features.push(\"images\");\n const suffix = features.length > 0 ? ` · ${features.join(\", \")}` : \"\";\n return `${model.contextWindow} context · ${model.maxOutputTokens} max-out${suffix}`;\n}\n\nfunction renderModels(details: ModelsOutcome): void {\n consola.log(header(`${details.id} models`));\n consola.log(\"\");\n for (const model of details.models) {\n consola.log(\n entry(`${s.hi(`${model.provider}/${model.id}`)} ${s.dim(modelDescription(model))}`),\n );\n }\n if (details.models.length === 0) consola.log(entry(s.dim(\"No models found\")));\n consola.log(\"\");\n}\n\nfunction finishInvocation(result: InvokeResult, timeoutSeconds: number | undefined): never {\n if (result.stdout) process.stdout.write(result.stdout);\n if (result.stderr) process.stderr.write(result.stderr);\n if (result.timedOut) {\n consola.error(`Timed out after ${timeoutSeconds}s`);\n process.exit(124);\n }\n process.exit(result.exitCode ?? 1);\n}\n\nconst list = defineCommand({\n meta: { description: \"List all known harnesses\" },\n args: { ...formatArgs },\n run({ args }) {\n const harnesses = getAllHarnesses();\n const data = harnesses.map((harness) => ({ id: harness.id, name: harness.name }));\n\n if (emit(data, args)) return;\n\n consola.log(header(\"Harnesses\"));\n consola.log(\"\");\n const maxId = Math.max(...data.map((r) => r.id.length));\n for (const { id, name } of data) {\n consola.log(entry(`${s.hi(id.padEnd(maxId))} ${name}`));\n }\n consola.log(\"\");\n },\n});\n\nconst detect = defineCommand({\n meta: { description: \"Detect installed harnesses and versions\" },\n args: { ...formatArgs },\n run({ args }) {\n const harnesses = getAllHarnesses();\n const results = harnesses.map((harness) => {\n const installed = harness.isInstalled();\n const v = installed ? harness.version : null;\n return { id: harness.id, name: harness.name, installed, version: v };\n });\n\n if (emit(results, args)) return;\n\n consola.log(header(\"System Scan\"));\n consola.log(\"\");\n const maxId = Math.max(...results.map((r) => r.id.length));\n for (const r of results) {\n if (r.installed) {\n const ver = r.version ? ` ${s.dim(`v${r.version}`)}` : \"\";\n consola.log(entry(`${s.green(\"●\")} ${s.hi(r.id.padEnd(maxId))} ${r.name}${ver}`));\n } else {\n consola.log(entry(`${s.dim(\"○\")} ${s.dim(r.id.padEnd(maxId))} ${s.dim(r.name)}`));\n }\n }\n consola.log(\"\");\n },\n});\n\nconst info = defineCommand({\n meta: { description: \"Show metadata for a harness\" },\n args: { id: harnessArg, ...formatArgs },\n run({ args }) {\n const harness = resolveHarness(args.id as string);\n\n if (\n emit(\n {\n id: harness.id,\n name: harness.name,\n binaries: harness.binaries,\n capabilities: harness.capabilities,\n invocationModes: harness.invocationModes,\n modelListing: harness.modelListing !== null,\n modelSelection: harness.invocation?.modelArgs !== undefined,\n config: harness.config,\n sessions: harness.sessions,\n instructions: harness.instructions,\n skills: harness.skills,\n commands: harness.commands,\n promptTemplates: harness.promptTemplates,\n hooks: harness.hooks,\n persistence: harness.persistence,\n detection: harness.detection,\n },\n args,\n )\n )\n return;\n\n consola.log(header(`${harness.name} ${s.dim(harness.id)}`));\n\n consola.log(section(\"Binaries\"));\n for (const b of harness.binaries) consola.log(entry(s.white(b)));\n\n consola.log(section(\"Capabilities\"));\n const caps = Object.entries(harness.capabilities)\n .map(([k, v]) => (v ? s.green(k) : s.dim(k)))\n .join(s.dim(\" · \"));\n consola.log(entry(caps));\n\n consola.log(section(\"Invocation modes\"));\n const modes = Object.entries(harness.invocationModes)\n .map(([k, v]) => (v ? s.green(k) : s.dim(k)))\n .join(s.dim(\" · \"));\n consola.log(entry(modes));\n\n consola.log(section(\"Models\"));\n const modelFeatures = {\n listing: harness.modelListing !== null,\n selection: harness.invocation?.modelArgs !== undefined,\n };\n consola.log(\n entry(\n Object.entries(modelFeatures)\n .map(([k, v]) => (v ? s.green(k) : s.dim(k)))\n .join(s.dim(\" · \")),\n ),\n );\n\n renderPathSection(\"Config\", harness.config);\n renderPathSection(\"Sessions\", harness.sessions);\n renderPathSection(\"Instructions\", harness.instructions);\n renderPathSection(\"Skills\", harness.skills);\n renderPathSection(\"Commands\", harness.commands);\n renderPathSection(\"Prompt templates\", harness.promptTemplates);\n renderPathSection(\"Hooks\", harness.hooks);\n\n if (harness.persistence.length) {\n consola.log(section(\"Persistence\"));\n for (const e of harness.persistence) {\n const note = e.note ? ` ${s.dim(e.note)}` : \"\";\n consola.log(entry(`${s.white(e.format)}${note}`));\n }\n }\n\n consola.log(\"\");\n },\n});\n\nconst paths = defineCommand({\n meta: { description: \"Show resolved paths for current platform\" },\n args: { id: harnessArg, ...formatArgs },\n run({ args }) {\n const harness = resolveHarness(args.id as string);\n const resolved = harness.resolve();\n\n if (emit(resolved, args)) return;\n\n consola.log(header(`${harness.name} ${s.dim(process.platform)}`));\n\n renderResolvedPathSection(\"Config\", resolved.config);\n renderResolvedPathSection(\"Sessions\", resolved.sessions);\n renderResolvedPathSection(\"Instructions\", resolved.instructions);\n renderResolvedPathSection(\"Skills\", resolved.skills);\n renderResolvedPathSection(\"Commands\", resolved.commands);\n renderResolvedPathSection(\"Prompt templates\", resolved.promptTemplates);\n renderResolvedPathSection(\"Hooks\", resolved.hooks);\n\n consola.log(\"\");\n },\n});\n\nconst models = defineCommand({\n meta: { description: \"List models available to a harness\" },\n args: {\n id: harnessArg,\n search: {\n type: \"positional\" as const,\n description: \"Optional native model search filter\",\n required: false,\n },\n cwd: {\n type: \"string\" as const,\n description: \"Working directory used while loading harness configuration\",\n },\n timeout: { type: \"string\" as const, description: \"Wall-clock budget in seconds\" },\n ...formatArgs,\n },\n async run({ args }) {\n const timeoutSeconds = parsePositiveTimeout(args.timeout);\n if (timeoutSeconds === null) {\n consola.error(`Invalid timeout: ${args.timeout}`);\n process.exitCode = 1;\n return;\n }\n\n const result = await listHarnessModels(args.id as string, {\n search: args.search as string | undefined,\n cwd: args.cwd,\n timeoutSeconds,\n });\n if (emit(result.details, args)) {\n if (result.isError) process.exitCode = 1;\n return;\n }\n if (result.isError || !(\"models\" in result.details)) {\n consola.error(modelFailureMessage(result.details));\n process.exitCode = 1;\n return;\n }\n\n renderModels(result.details);\n },\n});\n\nconst run = defineCommand({\n meta: { description: \"Run one prompt through a harness's non-interactive mode\" },\n args: {\n id: harnessArg,\n prompt: {\n type: \"positional\" as const,\n description: \"Prompt to send to the harness\",\n required: true,\n },\n cwd: { type: \"string\" as const, description: \"Working directory for the run\" },\n model: { type: \"string\" as const, description: \"Harness-native model id or selector\" },\n timeout: { type: \"string\" as const, description: \"Wall-clock budget in seconds\" },\n json: {\n type: \"boolean\" as const,\n description: \"Use the harness's structured (JSON) output mode\",\n },\n tools: {\n type: \"boolean\" as const,\n description: \"Enable tools; default false uses native advisor without tools mode\",\n },\n \"read-only\": {\n type: \"boolean\" as const,\n description: \"Require native read-only tool enforcement; implies --tools\",\n },\n },\n async run({ args }) {\n const harness = resolveHarness(args.id as string);\n const structured = args.json === true;\n const readOnly = args[\"read-only\"] === true;\n const tools = readOnly || args.tools === true;\n\n const invocationOptions = { model: args.model, structured, tools, readOnly };\n if (!harness.buildInvocation(\"\", invocationOptions)) {\n consola.error(harness.invocationError(invocationOptions) ?? \"Invalid invocation\");\n process.exit(1);\n }\n\n const timeoutSeconds = parsePositiveTimeout(args.timeout);\n if (timeoutSeconds === null) {\n consola.error(`Invalid timeout: ${args.timeout}`);\n process.exit(1);\n }\n\n const result = await harness.invoke(args.prompt as string, {\n cwd: args.cwd,\n model: args.model,\n timeoutMs: timeoutSeconds === undefined ? undefined : timeoutSeconds * 1000,\n structured,\n tools,\n readOnly,\n });\n\n finishInvocation(result, timeoutSeconds);\n },\n});\n\nconst main = defineCommand({\n meta: {\n name: \"harnesses\",\n version,\n description: \"Metadata toolkit for AI coding harnesses\",\n },\n subCommands: {\n list,\n detect,\n info,\n paths,\n models,\n run,\n \"mcp-servers\": () => import(\"./commands/mcp-servers.ts\").then((m) => m.default),\n agents: () => import(\"./commands/agents.ts\").then((m) => m.default),\n prompts: () => import(\"./commands/prompts.ts\").then((m) => m.default),\n mcp: () => import(\"./commands/mcp.ts\").then((m) => m.default),\n },\n});\n\nawait runMain(main);\n"],"mappings":";;;;;;;AASA,MAAM,IAAI;CACR,OAAO,MAAc,WAAW,EAAE;CAClC,KAAK,MAAc,WAAW,EAAE;CAChC,QAAQ,MAAc,WAAW,EAAE;CACnC,MAAM,MAAc,WAAW,EAAE;CACjC,MAAM,MAAc,WAAW,EAAE;CACjC,OAAO,MAAc,UAAU,EAAE;CACjC,QAAQ,MAAc,WAAW,EAAE;AACrC;AAEA,SAAS,OAAO,OAAe;CAC7B,OAAO,OAAO,EAAE,KAAK,EAAE,KAAK,KAAK,CAAC;AACpC;AAEA,SAAS,QAAQ,OAAe;CAC9B,OAAO,OAAO,EAAE,KAAK,GAAG,EAAE,GAAG,EAAE,MAAM,KAAK;AAC5C;AAEA,SAAS,MAAM,SAAiB;CAC9B,OAAO,OAAO;AAChB;AAEA,SAAS,kBACP,OACA,SAMA;CACA,IAAI,CAAC,Q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qB,OAAO,4BAA4B,CAAC,MAAM,MAAM,EAAE,OAAO;EAC9E,cAAc,OAAO,uBAAuB,CAAC,MAAM,MAAM,EAAE,OAAO;EAClE,eAAe,OAAO,wBAAwB,CAAC,MAAM,MAAM,EAAE,OAAO;EACpE,WAAW,OAAO,oBAAoB,CAAC,MAAM,MAAM,EAAE,OAAO;CAC9D;AACF,CAAC;AAED,MAAM,QAAQ,IAAI"}
1
+ {"version":3,"file":"cli.mjs","names":["toToon"],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { defineCommand, runMain } from \"citty\";\nimport { consola } from \"consola\";\nimport { encode as toToon } from \"@toon-format/toon\";\nimport { version, type AvailableModel, type InvokeResult } from \"./types.ts\";\nimport { getAllHarnesses, getHarness, isHarnessId, listHarnesses } from \"./registry.ts\";\nimport { listHarnessModels, type ModelsOutcome, type RunFailure } from \"./tool-operations.ts\";\n\nconst s = {\n cyan: (t: string) => `\\x1B[36m${t}\\x1B[0m`,\n hi: (t: string) => `\\x1B[96m${t}\\x1B[0m`,\n green: (t: string) => `\\x1B[32m${t}\\x1B[0m`,\n red: (t: string) => `\\x1B[31m${t}\\x1B[0m`,\n dim: (t: string) => `\\x1B[90m${t}\\x1B[0m`,\n bold: (t: string) => `\\x1B[1m${t}\\x1B[0m`,\n white: (t: string) => `\\x1B[97m${t}\\x1B[0m`,\n};\n\nfunction header(title: string) {\n return `\\n ${s.bold(s.cyan(title))}`;\n}\n\nfunction section(title: string) {\n return `\\n ${s.cyan(\"▸\")} ${s.white(title)}`;\n}\n\nfunction entry(content: string) {\n return ` ${content}`;\n}\n\nfunction renderPathSection(\n title: string,\n entries: readonly {\n readonly path: string;\n readonly scope: string;\n readonly platforms?: readonly string[];\n readonly note?: string;\n }[],\n) {\n if (!entries.length) return;\n consola.log(section(title));\n for (const e of entries) {\n const tags = [s.dim(e.scope)];\n if (e.platforms) tags.push(s.dim(e.platforms.join(\", \")));\n consola.log(entry(`${s.hi(e.path)} ${tags.join(s.dim(\" · \"))}`));\n if (e.note) consola.log(entry(`${s.dim(` ${e.note}`)}`));\n }\n}\n\nconst formatArgs = {\n json: { type: \"boolean\" as const, description: \"Output as JSON\" },\n toon: { type: \"boolean\" as const, description: \"Output as TOON\" },\n};\n\nconst harnessArg = {\n type: \"positional\" as const,\n description: \"Harness id\",\n required: true,\n};\n\nfunction emit(data: unknown, args: Readonly<{ json?: boolean; toon?: boolean }>) {\n if (args.json) {\n console.log(JSON.stringify(data, null, 2));\n return true;\n }\n if (args.toon) {\n console.log(toToon(data));\n return true;\n }\n return false;\n}\n\nfunction resolveHarness(id: string): ReturnType<typeof getHarness> {\n if (!isHarnessId(id)) {\n consola.error(`Unknown harness: ${id}\\nKnown: ${listHarnesses().join(\", \")}`);\n process.exit(1);\n }\n return getHarness(id);\n}\n\nfunction renderResolvedPathSection(\n title: string,\n entries: readonly { readonly path: string }[],\n): void {\n if (entries.length === 0) return;\n consola.log(section(title));\n for (const item of entries) consola.log(entry(s.hi(item.path)));\n}\n\nfunction parsePositiveTimeout(raw: string | undefined): number | null | undefined {\n if (!raw) return undefined;\n const value = Number(raw);\n return Number.isFinite(value) && value > 0 ? value : null;\n}\n\nfunction modelFailureMessage(details: ModelsOutcome | RunFailure): string {\n return \"error\" in details ? details.error : \"Failed to list models\";\n}\n\nfunction modelDescription(model: Readonly<AvailableModel>): string {\n const parts: string[] = [];\n if (model.default) parts.push(\"default\");\n if (model.contextWindow !== undefined) parts.push(`${model.contextWindow} context`);\n if (model.maxOutputTokens !== undefined) parts.push(`${model.maxOutputTokens} max-out`);\n const features: string[] = [];\n if (model.thinking) features.push(\"thinking\");\n if (model.images) features.push(\"images\");\n if (features.length > 0) parts.push(features.join(\", \"));\n return parts.join(\" · \");\n}\n\nfunction renderModels(details: ModelsOutcome): void {\n const harness = getHarness(details.id);\n consola.log(header(`${details.id} models`));\n consola.log(\"\");\n for (const model of details.models) {\n consola.log(entry(`${s.hi(harness.modelSelector(model))} ${s.dim(modelDescription(model))}`));\n }\n if (details.models.length === 0) consola.log(entry(s.dim(\"No models found\")));\n consola.log(\"\");\n}\n\nfunction finishInvocation(result: InvokeResult, timeoutSeconds: number | undefined): never {\n if (result.stdout) process.stdout.write(result.stdout);\n if (result.stderr) process.stderr.write(result.stderr);\n if (result.timedOut) {\n const idle =\n result.idleMs === undefined\n ? \"\"\n : `; last output ${Math.round(result.idleMs / 1000)}s before`;\n consola.error(`Timed out after ${timeoutSeconds}s${idle}`);\n process.exit(124);\n }\n process.exit(result.exitCode ?? 1);\n}\n\nconst list = defineCommand({\n meta: { description: \"List all known harnesses\" },\n args: { ...formatArgs },\n run({ args }) {\n const harnesses = getAllHarnesses();\n const data = harnesses.map((harness) => ({ id: harness.id, name: harness.name }));\n\n if (emit(data, args)) return;\n\n consola.log(header(\"Harnesses\"));\n consola.log(\"\");\n const maxId = Math.max(...data.map((r) => r.id.length));\n for (const { id, name } of data) {\n consola.log(entry(`${s.hi(id.padEnd(maxId))} ${name}`));\n }\n consola.log(\"\");\n },\n});\n\nconst detect = defineCommand({\n meta: { description: \"Detect installed harnesses and versions\" },\n args: { ...formatArgs },\n run({ args }) {\n const harnesses = getAllHarnesses();\n const results = harnesses.map((harness) => {\n const installed = harness.isInstalled();\n const v = installed ? harness.version : null;\n return { id: harness.id, name: harness.name, installed, version: v };\n });\n\n if (emit(results, args)) return;\n\n consola.log(header(\"System Scan\"));\n consola.log(\"\");\n const maxId = Math.max(...results.map((r) => r.id.length));\n for (const r of results) {\n if (r.installed) {\n const ver = r.version ? ` ${s.dim(`v${r.version}`)}` : \"\";\n consola.log(entry(`${s.green(\"●\")} ${s.hi(r.id.padEnd(maxId))} ${r.name}${ver}`));\n } else {\n consola.log(entry(`${s.dim(\"○\")} ${s.dim(r.id.padEnd(maxId))} ${s.dim(r.name)}`));\n }\n }\n consola.log(\"\");\n },\n});\n\nconst info = defineCommand({\n meta: { description: \"Show metadata for a harness\" },\n args: { id: harnessArg, ...formatArgs },\n run({ args }) {\n const harness = resolveHarness(args.id as string);\n\n if (\n emit(\n {\n id: harness.id,\n name: harness.name,\n binaries: harness.binaries,\n capabilities: harness.capabilities,\n invocationModes: harness.invocationModes,\n modelListing: harness.modelListing !== null,\n modelSelection: harness.invocation?.modelArgs !== undefined,\n config: harness.config,\n sessions: harness.sessions,\n instructions: harness.instructions,\n skills: harness.skills,\n commands: harness.commands,\n promptTemplates: harness.promptTemplates,\n hooks: harness.hooks,\n temp: harness.temp,\n envOverrides: harness.envOverrides,\n persistence: harness.persistence,\n detection: harness.detection,\n },\n args,\n )\n )\n return;\n\n consola.log(header(`${harness.name} ${s.dim(harness.id)}`));\n\n consola.log(section(\"Binaries\"));\n for (const b of harness.binaries) consola.log(entry(s.white(b)));\n\n consola.log(section(\"Capabilities\"));\n const caps = Object.entries(harness.capabilities)\n .map(([k, v]) => (v ? s.green(k) : s.dim(k)))\n .join(s.dim(\" · \"));\n consola.log(entry(caps));\n\n consola.log(section(\"Invocation modes\"));\n const modes = Object.entries(harness.invocationModes)\n .map(([k, v]) => (v ? s.green(k) : s.dim(k)))\n .join(s.dim(\" · \"));\n consola.log(entry(modes));\n\n consola.log(section(\"Models\"));\n const modelFeatures = {\n listing: harness.modelListing !== null,\n selection: harness.invocation?.modelArgs !== undefined,\n };\n consola.log(\n entry(\n Object.entries(modelFeatures)\n .map(([k, v]) => (v ? s.green(k) : s.dim(k)))\n .join(s.dim(\" · \")),\n ),\n );\n\n renderPathSection(\"Config\", harness.config);\n renderPathSection(\"Sessions\", harness.sessions);\n renderPathSection(\"Instructions\", harness.instructions);\n renderPathSection(\"Skills\", harness.skills);\n renderPathSection(\"Commands\", harness.commands);\n renderPathSection(\"Prompt templates\", harness.promptTemplates);\n renderPathSection(\"Hooks\", harness.hooks);\n renderPathSection(\"Temp\", harness.temp);\n renderPathSection(\n \"Env overrides\",\n harness.envOverrides.map((e) => ({\n ...e,\n path: `${e.variable} ${s.dim(`${e.path} → ${e.relocates.join(\", \")}`)}`,\n })),\n );\n\n if (harness.persistence.length) {\n consola.log(section(\"Persistence\"));\n for (const e of harness.persistence) {\n const note = e.note ? ` ${s.dim(e.note)}` : \"\";\n consola.log(entry(`${s.white(e.format)}${note}`));\n }\n }\n\n consola.log(\"\");\n },\n});\n\nconst paths = defineCommand({\n meta: { description: \"Show resolved paths for current platform\" },\n args: { id: harnessArg, ...formatArgs },\n run({ args }) {\n const harness = resolveHarness(args.id as string);\n const resolved = harness.resolve();\n\n if (emit(resolved, args)) return;\n\n consola.log(header(`${harness.name} ${s.dim(process.platform)}`));\n\n renderResolvedPathSection(\"Config\", resolved.config);\n renderResolvedPathSection(\"Sessions\", resolved.sessions);\n renderResolvedPathSection(\"Instructions\", resolved.instructions);\n renderResolvedPathSection(\"Skills\", resolved.skills);\n renderResolvedPathSection(\"Commands\", resolved.commands);\n renderResolvedPathSection(\"Prompt templates\", resolved.promptTemplates);\n renderResolvedPathSection(\"Hooks\", resolved.hooks);\n renderResolvedPathSection(\"Temp\", resolved.temp);\n\n consola.log(\"\");\n },\n});\n\nconst models = defineCommand({\n meta: { description: \"List models available to a harness\" },\n args: {\n id: harnessArg,\n search: {\n type: \"positional\" as const,\n description: \"Optional native model search filter\",\n required: false,\n },\n cwd: {\n type: \"string\" as const,\n description: \"Working directory used while loading harness configuration\",\n },\n timeout: { type: \"string\" as const, description: \"Wall-clock budget in seconds\" },\n ...formatArgs,\n },\n async run({ args }) {\n const timeoutSeconds = parsePositiveTimeout(args.timeout);\n if (timeoutSeconds === null) {\n consola.error(`Invalid timeout: ${args.timeout}`);\n process.exitCode = 1;\n return;\n }\n\n const result = await listHarnessModels(args.id as string, {\n search: args.search as string | undefined,\n cwd: args.cwd,\n timeoutSeconds,\n });\n if (emit(result.details, args)) {\n if (result.isError) process.exitCode = 1;\n return;\n }\n if (result.isError || !(\"models\" in result.details)) {\n consola.error(modelFailureMessage(result.details));\n process.exitCode = 1;\n return;\n }\n\n renderModels(result.details);\n },\n});\n\nconst run = defineCommand({\n meta: { description: \"Run one prompt through a harness's non-interactive mode\" },\n args: {\n id: harnessArg,\n prompt: {\n type: \"positional\" as const,\n description: \"Prompt to send to the harness\",\n required: true,\n },\n cwd: { type: \"string\" as const, description: \"Working directory for the run\" },\n model: { type: \"string\" as const, description: \"Harness-native model id or selector\" },\n timeout: { type: \"string\" as const, description: \"Wall-clock budget in seconds\" },\n json: {\n type: \"boolean\" as const,\n description: \"Use the harness's structured (JSON) output mode\",\n },\n tools: {\n type: \"boolean\" as const,\n description: \"Enable tools; default false uses native advisor without tools mode\",\n },\n \"read-only\": {\n type: \"boolean\" as const,\n description:\n \"Require native read-only tool enforcement; implies --tools, rejected with --no-tools\",\n },\n },\n async run({ args }) {\n const harness = resolveHarness(args.id as string);\n const structured = args.json === true;\n const readOnly = args[\"read-only\"] === true;\n const tools = args.tools ?? readOnly;\n\n const invocationOptions = { model: args.model, structured, tools, readOnly };\n if (!harness.buildInvocation(\"\", invocationOptions)) {\n consola.error(harness.invocationError(invocationOptions) ?? \"Invalid invocation\");\n process.exit(1);\n }\n\n const timeoutSeconds = parsePositiveTimeout(args.timeout);\n if (timeoutSeconds === null) {\n consola.error(`Invalid timeout: ${args.timeout}`);\n process.exit(1);\n }\n\n const result = await harness.invoke(args.prompt as string, {\n cwd: args.cwd,\n model: args.model,\n timeoutMs: timeoutSeconds === undefined ? undefined : timeoutSeconds * 1000,\n structured,\n tools,\n readOnly,\n });\n\n finishInvocation(result, timeoutSeconds);\n },\n});\n\nconst main = defineCommand({\n meta: {\n name: \"harnesses\",\n version,\n description: \"Metadata toolkit for AI coding harnesses\",\n },\n subCommands: {\n list,\n detect,\n info,\n paths,\n models,\n run,\n \"mcp-servers\": () => import(\"./commands/mcp-servers.ts\").then((m) => m.default),\n agents: () => import(\"./commands/agents.ts\").then((m) => m.default),\n prompts: () => import(\"./commands/prompts.ts\").then((m) => m.default),\n mcp: () => import(\"./commands/mcp.ts\").then((m) => m.default),\n },\n});\n\nawait runMain(main);\n"],"mappings":";;;;;;;AASA,MAAM,IA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C,MAAM,MAAM,EAAE,OAAO;EACpE,WAAW,OAAO,oBAAoB,CAAC,MAAM,MAAM,EAAE,OAAO;CAC9D;AACF,CAAC;AAED,MAAM,QAAQ,IAAI"}
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { AgentsCompanionTargetResult, AgentsConfig, AgentsSyncAction, AgentsSyncReport, AgentsTargetResult, AvailableModel, EvidenceLevel, Harness, HarnessCapabilities, HarnessConstructor, HarnessDetection, HarnessId, HarnessInvocation, HarnessInvocationModes, HarnessModelListing, InvokeOptions, InvokeResult, ListModelsOptions, ListModelsResult, McpConfigFile, McpConfigListing, McpEnvError, McpServerConfig, PathCandidate, Platform, PromptSyncAction, PromptSyncReport, PromptSyncTargetResult, PromptTemplateSyncTarget, PromptTemplateTargetResult, ResolveOptions, ResolvedPaths, StorageDescriptor, SyncReport, SyncTargetResult, addMcpServer, listMcpServers, masterMcpPath, parseJsonc, readAgentsConfig, readMasterMcpServers, removeMcpServer, syncAgentsFiles, syncMcpServers, syncPromptTemplates, version } from "./_chunks/prompt-sync.mjs";
1
+ import { AgentsCompanionTargetResult, AgentsConfig, AgentsSyncAction, AgentsSyncReport, AgentsTargetResult, AvailableModel, EnvOverride, EvidenceLevel, Harness, HarnessCapabilities, HarnessConstructor, HarnessDetection, HarnessId, HarnessInvocation, HarnessInvocationModes, HarnessModelListing, InvokeOptions, InvokeResult, ListModelsOptions, ListModelsResult, McpConfigFile, McpConfigListing, McpEnvError, McpServerConfig, PathCandidate, PathCategory, Platform, PromptSyncAction, PromptSyncReport, PromptSyncTargetResult, PromptTemplateSyncTarget, PromptTemplateTargetResult, ResolveOptions, ResolvedPaths, StorageDescriptor, SyncReport, SyncTargetResult, addMcpServer, listMcpServers, masterMcpPath, parseJsonc, readAgentsConfig, readMasterMcpServers, removeMcpServer, syncAgentsFiles, syncMcpServers, syncPromptTemplates, version } from "./_chunks/prompt-sync.mjs";
2
2
  export declare function registerHarness(HarnessClass: HarnessConstructor): Harness;
3
3
  export declare function getHarness(id: HarnessId): Harness;
4
4
  export declare function listHarnesses(): HarnessId[];
@@ -310,5 +310,5 @@ interface OpenCodeProject {
310
310
  name: string | null;
311
311
  }
312
312
  export declare const harnessIds: readonly HarnessId[];
313
- export { type AgentsCompanionTargetResult, type AgentsConfig, type AgentsSyncAction, type AgentsSyncReport, type AgentsTargetResult, type AvailableModel, type ClaudeAssistantEntry, type ClaudeBaseEntry, type ClaudeContentBlock, type ClaudeHistoryEntry, type ClaudeSessionEntry, type ClaudeSummaryEntry, type ClaudeTextBlock, type ClaudeThinkingBlock, type ClaudeToolResultBlock, type ClaudeToolUseBlock, type ClaudeUsage, type ClaudeUserEntry, type CodexHistoryEntry, type CodexLogEntry, type CodexThread, type EvidenceLevel, type GeminiConversationRecord, type GeminiMessageRecord, type GeminiThought, type GeminiTokensSummary, type GeminiToolCallRecord, Harness, type HarnessCapabilities, type HarnessConstructor, type HarnessDetection, type HarnessId, type HarnessInvocation, type HarnessInvocationModes, type HarnessModelListing, type InvokeOptions, type InvokeResult, type ListModelsOptions, type ListModelsResult, type McpConfigFile, type McpConfigListing, McpEnvError, type McpServerConfig, type OpenCodeAgentPart, type OpenCodeCompactionPart, type OpenCodeFilePart, type OpenCodeMessage, type OpenCodePart, type OpenCodePatchPart, type OpenCodeProject, type OpenCodeReasoningPart, type OpenCodeRetryPart, type OpenCodeSession, type OpenCodeSnapshotPart, type OpenCodeStepFinishPart, type OpenCodeStepStartPart, type OpenCodeSubtaskPart, type OpenCodeTextPart, type OpenCodeTodo, type OpenCodeToolPart, type PathCandidate, type Platform, type PromptSyncAction, type PromptSyncReport, type PromptSyncTargetResult, type PromptTemplateSyncTarget, type PromptTemplateTargetResult, type ResolveOptions, type ResolvedPaths, type StorageDescriptor, type SyncReport, type SyncTargetResult, addMcpServer, listMcpServers, masterMcpPath, parseJsonc, readAgentsConfig, readMasterMcpServers, removeMcpServer, syncAgentsFiles, syncMcpServers, syncPromptTemplates, version };
313
+ export { type AgentsCompanionTargetResult, type AgentsConfig, type AgentsSyncAction, type AgentsSyncReport, type AgentsTargetResult, type AvailableModel, type ClaudeAssistantEntry, type ClaudeBaseEntry, type ClaudeContentBlock, type ClaudeHistoryEntry, type ClaudeSessionEntry, type ClaudeSummaryEntry, type ClaudeTextBlock, type ClaudeThinkingBlock, type ClaudeToolResultBlock, type ClaudeToolUseBlock, type ClaudeUsage, type ClaudeUserEntry, type CodexHistoryEntry, type CodexLogEntry, type CodexThread, type EnvOverride, type EvidenceLevel, type GeminiConversationRecord, type GeminiMessageRecord, type GeminiThought, type GeminiTokensSummary, type GeminiToolCallRecord, Harness, type HarnessCapabilities, type HarnessConstructor, type HarnessDetection, type HarnessId, type HarnessInvocation, type HarnessInvocationModes, type HarnessModelListing, type InvokeOptions, type InvokeResult, type ListModelsOptions, type ListModelsResult, type McpConfigFile, type McpConfigListing, McpEnvError, type McpServerConfig, type OpenCodeAgentPart, type OpenCodeCompactionPart, type OpenCodeFilePart, type OpenCodeMessage, type OpenCodePart, type OpenCodePatchPart, type OpenCodeProject, type OpenCodeReasoningPart, type OpenCodeRetryPart, type OpenCodeSession, type OpenCodeSnapshotPart, type OpenCodeStepFinishPart, type OpenCodeStepStartPart, type OpenCodeSubtaskPart, type OpenCodeTextPart, type OpenCodeTodo, type OpenCodeToolPart, type PathCandidate, type PathCategory, type Platform, type PromptSyncAction, type PromptSyncReport, type PromptSyncTargetResult, type PromptTemplateSyncTarget, type PromptTemplateTargetResult, type ResolveOptions, type ResolvedPaths, type StorageDescriptor, type SyncReport, type SyncTargetResult, addMcpServer, listMcpServers, masterMcpPath, parseJsonc, readAgentsConfig, readMasterMcpServers, removeMcpServer, syncAgentsFiles, syncMcpServers, syncPromptTemplates, version };
314
314
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/registry.ts","../src/resolve.ts","../src/schemas/claude.ts","../src/schemas/gemini.ts","../src/schemas/codex.ts","../src/schemas/opencode.ts","../src/index.ts"],"mappings":";wBAiBgB,gBAAgB,cAAc,qBAAqB;wBAMnD,WAAW,IAAI,YAAY;wBAM3B,iBAAiB;wBAIjB,YAAY,aAAa,MAAM;wBAI/B,mBAAmB;;;;;;;wBAUnB,wBAAwB;;;;;;;;wBAcxB,uBAAuB,eAAe;;;;;;;;;;wBAatC,cAAc,eAAe;wBChE7B,oBAAoB,kBAAkB,UAAS;;;;;;;wBAiB/C,eAAe,UAAS;;;;;;;wBAcxB,aAAa,UAAS;UCzCrB;EACf;EACA;;UAGe;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;;KAGU,qBACR,kBACA,sBACA,qBACA;UAEa;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe,wBAAwB;EACvC;EACA;IACE;IACA,kBAAkB;;EAEpB;EACA;IACE;IACA;IACA;IACA;;;UAIa,6BAA6B;EAC5C;EACA;EACA;IACE;IACA;IACA;IACA;IACA,SAAS;IACT;IACA;IACA,OAAO;;;UAIM;EACf;EACA;EACA;;KAGU,qBAAqB,kBAAkB,uBAAuB;UAEzD;EACf;EACA;EACA;EACA;EACA,gBAAgB;IAGZ;IACA;IACA;;;UClGW;EACf;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA,MAAM;EACN;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA,SAAS;EACT,WAAW;EACX,YAAY;;UAGG;EACf;EACA;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;;UC9Ce;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;UC7Be;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;;KAGU,eACR,mBACA,wBACA,mBACA,mBACA,sBACA,wBACA,yBACA,uBACA,oBACA,oBACA,oBACA;UAEa;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;;qBC3BW,qBAAqB"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/registry.ts","../src/resolve.ts","../src/schemas/claude.ts","../src/schemas/gemini.ts","../src/schemas/codex.ts","../src/schemas/opencode.ts","../src/index.ts"],"mappings":";wBAiBgB,gBAAgB,cAAc,qBAAqB;wBAMnD,WAAW,IAAI,YAAY;wBAM3B,iBAAiB;wBAIjB,YAAY,aAAa,MAAM;wBAI/B,mBAAmB;;;;;;;wBAUnB,wBAAwB;;;;;;;;wBAcxB,uBAAuB,eAAe;;;;;;;;;;wBAatC,cAAc,eAAe;wBChE7B,oBAAoB,kBAAkB,UAAS;;;;;;;wBAkB/C,eAAe,UAAS;;;;;;;wBAcxB,aAAa,UAAS;UC1CrB;EACf;EACA;;UAGe;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;;KAGU,qBACR,kBACA,sBACA,qBACA;UAEa;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe,wBAAwB;EACvC;EACA;IACE;IACA,kBAAkB;;EAEpB;EACA;IACE;IACA;IACA;IACA;;;UAIa,6BAA6B;EAC5C;EACA;EACA;IACE;IACA;IACA;IACA;IACA,SAAS;IACT;IACA;IACA,OAAO;;;UAIM;EACf;EACA;EACA;;KAGU,qBAAqB,kBAAkB,uBAAuB;UAEzD;EACf;EACA;EACA;EACA;EACA,gBAAgB;IAGZ;IACA;IACA;;;UClGW;EACf;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA,MAAM;EACN;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA,SAAS;EACT,WAAW;EACX,YAAY;;UAGG;EACf;EACA;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;;UC9Ce;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;UC7Be;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;;KAGU,eACR,mBACA,wBACA,mBACA,mBACA,sBACA,wBACA,yBACA,uBACA,oBACA,oBACA,oBACA;UAEa;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;;qBCzBW,qBAAqB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["export { version } from \"./types.ts\";\nexport type {\n HarnessId,\n EvidenceLevel,\n Platform,\n PathCandidate,\n PromptTemplateSyncTarget,\n StorageDescriptor,\n HarnessCapabilities,\n HarnessDetection,\n HarnessInvocation,\n HarnessInvocationModes,\n HarnessModelListing,\n AvailableModel,\n ListModelsOptions,\n ListModelsResult,\n InvokeOptions,\n InvokeResult,\n McpServerConfig,\n McpConfigFile,\n ResolveOptions,\n ResolvedPaths,\n} from \"./types.ts\";\n\nexport { Harness } from \"./harness.ts\";\nexport type { HarnessConstructor } from \"./harness.ts\";\nexport {\n registerHarness,\n getHarness,\n isHarnessId,\n listHarnesses,\n getAllHarnesses,\n detectHarness,\n detectHarnessFromEnv,\n detectProjectHarnesses,\n} from \"./registry.ts\";\nexport { agntnDataDir, agntnConfigDir, resolvePathTemplate } from \"./resolve.ts\";\nexport {\n listMcpServers,\n addMcpServer,\n removeMcpServer,\n syncMcpServers,\n readMasterMcpServers,\n masterMcpPath,\n parseJsonc,\n McpEnvError,\n} from \"./mcp-servers.ts\";\nexport type { McpConfigListing, SyncReport, SyncTargetResult } from \"./mcp-servers.ts\";\nexport { syncAgentsFiles, readAgentsConfig } from \"./agents-sync.ts\";\nexport type {\n AgentsConfig,\n AgentsSyncAction,\n AgentsCompanionTargetResult,\n AgentsSyncReport,\n AgentsTargetResult,\n} from \"./agents-sync.ts\";\nexport { syncPromptTemplates } from \"./prompt-sync.ts\";\nexport type {\n PromptSyncAction,\n PromptSyncReport,\n PromptSyncTargetResult,\n PromptTemplateTargetResult,\n} from \"./prompt-sync.ts\";\n\nexport type {\n ClaudeContentBlock,\n ClaudeTextBlock,\n ClaudeThinkingBlock,\n ClaudeToolUseBlock,\n ClaudeToolResultBlock,\n ClaudeUsage,\n ClaudeBaseEntry,\n ClaudeUserEntry,\n ClaudeAssistantEntry,\n ClaudeSummaryEntry,\n ClaudeSessionEntry,\n ClaudeHistoryEntry,\n GeminiTokensSummary,\n GeminiToolCallRecord,\n GeminiThought,\n GeminiMessageRecord,\n GeminiConversationRecord,\n CodexHistoryEntry,\n CodexThread,\n CodexLogEntry,\n OpenCodeSession,\n OpenCodeMessage,\n OpenCodeTextPart,\n OpenCodeReasoningPart,\n OpenCodeToolPart,\n OpenCodeFilePart,\n OpenCodeSubtaskPart,\n OpenCodeStepStartPart,\n OpenCodeStepFinishPart,\n OpenCodeSnapshotPart,\n OpenCodePatchPart,\n OpenCodeAgentPart,\n OpenCodeRetryPart,\n OpenCodeCompactionPart,\n OpenCodePart,\n OpenCodeTodo,\n OpenCodeProject,\n} from \"./schemas/index.ts\";\n\nimport type { HarnessId } from \"./types.ts\";\nimport { listHarnesses } from \"./registry.ts\";\n\nexport const harnessIds: readonly HarnessId[] = Object.freeze(listHarnesses());\n"],"mappings":";;AA2GA,MAAa,aAAmC,OAAO,OAAO,cAAc,CAAC"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["export { version } from \"./types.ts\";\nexport type {\n HarnessId,\n EvidenceLevel,\n Platform,\n PathCandidate,\n PathCategory,\n EnvOverride,\n PromptTemplateSyncTarget,\n StorageDescriptor,\n HarnessCapabilities,\n HarnessDetection,\n HarnessInvocation,\n HarnessInvocationModes,\n HarnessModelListing,\n AvailableModel,\n ListModelsOptions,\n ListModelsResult,\n InvokeOptions,\n InvokeResult,\n McpServerConfig,\n McpConfigFile,\n ResolveOptions,\n ResolvedPaths,\n} from \"./types.ts\";\n\nexport { Harness } from \"./harness.ts\";\nexport type { HarnessConstructor } from \"./harness.ts\";\nexport {\n registerHarness,\n getHarness,\n isHarnessId,\n listHarnesses,\n getAllHarnesses,\n detectHarness,\n detectHarnessFromEnv,\n detectProjectHarnesses,\n} from \"./registry.ts\";\nexport { agntnDataDir, agntnConfigDir, resolvePathTemplate } from \"./resolve.ts\";\nexport {\n listMcpServers,\n addMcpServer,\n removeMcpServer,\n syncMcpServers,\n readMasterMcpServers,\n masterMcpPath,\n parseJsonc,\n McpEnvError,\n} from \"./mcp-servers.ts\";\nexport type { McpConfigListing, SyncReport, SyncTargetResult } from \"./mcp-servers.ts\";\nexport { syncAgentsFiles, readAgentsConfig } from \"./agents-sync.ts\";\nexport type {\n AgentsConfig,\n AgentsSyncAction,\n AgentsCompanionTargetResult,\n AgentsSyncReport,\n AgentsTargetResult,\n} from \"./agents-sync.ts\";\nexport { syncPromptTemplates } from \"./prompt-sync.ts\";\nexport type {\n PromptSyncAction,\n PromptSyncReport,\n PromptSyncTargetResult,\n PromptTemplateTargetResult,\n} from \"./prompt-sync.ts\";\n\nexport type {\n ClaudeContentBlock,\n ClaudeTextBlock,\n ClaudeThinkingBlock,\n ClaudeToolUseBlock,\n ClaudeToolResultBlock,\n ClaudeUsage,\n ClaudeBaseEntry,\n ClaudeUserEntry,\n ClaudeAssistantEntry,\n ClaudeSummaryEntry,\n ClaudeSessionEntry,\n ClaudeHistoryEntry,\n GeminiTokensSummary,\n GeminiToolCallRecord,\n GeminiThought,\n GeminiMessageRecord,\n GeminiConversationRecord,\n CodexHistoryEntry,\n CodexThread,\n CodexLogEntry,\n OpenCodeSession,\n OpenCodeMessage,\n OpenCodeTextPart,\n OpenCodeReasoningPart,\n OpenCodeToolPart,\n OpenCodeFilePart,\n OpenCodeSubtaskPart,\n OpenCodeStepStartPart,\n OpenCodeStepFinishPart,\n OpenCodeSnapshotPart,\n OpenCodePatchPart,\n OpenCodeAgentPart,\n OpenCodeRetryPart,\n OpenCodeCompactionPart,\n OpenCodePart,\n OpenCodeTodo,\n OpenCodeProject,\n} from \"./schemas/index.ts\";\n\nimport type { HarnessId } from \"./types.ts\";\nimport { listHarnesses } from \"./registry.ts\";\n\nexport const harnessIds: readonly HarnessId[] = Object.freeze(listHarnesses());\n"],"mappings":";;AA6GA,MAAa,aAAmC,OAAO,OAAO,cAAc,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.d.mts","names":[],"sources":["../src/mcp.ts"],"mappings":";;;;;;;;;;;;wBAwOgB,mBAAmB"}
1
+ {"version":3,"file":"mcp.d.mts","names":[],"sources":["../src/mcp.ts"],"mappings":";;;;;;;;;;;;wBA4OgB,mBAAmB"}
package/dist/mcp.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { Check, Errors, typebox_exports } from "./_chunks/libs/typebox.mjs";
1
+ import { Check, Errors, IsObject, typebox_exports } from "./_chunks/libs/typebox.mjs";
2
2
  import { version } from "./_chunks/types.mjs";
3
3
  import { harnessToolSchemas } from "./_chunks/tool-schemas.mjs";
4
4
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
@@ -35,7 +35,7 @@ const tools = [
35
35
  {
36
36
  name: "harnesses_info",
37
37
  title: "Harnesses Info",
38
- description: "Full metadata for one or more AI coding harnesses, including supported invocation and model operations, configuration, sessions, instructions, skills, commands, prompt templates, hooks, and resolved paths.",
38
+ description: "Full metadata for one or more AI coding harnesses, including supported invocation and model operations, configuration, sessions, instructions, skills, commands, prompt templates, hooks, temp directories, the env variables that move them, and resolved paths.",
39
39
  inputSchema: schemas.info,
40
40
  annotations: READ_ONLY,
41
41
  execute: ({ harnessInfo }, args) => harnessInfo(args.id)
@@ -109,7 +109,7 @@ const tools = [
109
109
  {
110
110
  name: "harnesses_prompts_sync",
111
111
  title: "Harnesses Prompts Sync",
112
- description: "Sync canonical Markdown prompt templates from the agntn XDG data directory into every supported harness. Markdown targets use links; Gemini receives generated TOML. Diverged files are backed up. Pass check to only report.",
112
+ description: "Sync canonical Markdown prompt templates from the agntn XDG data directory into every supported harness. Each Markdown target directory becomes one link to the canonical directory; Gemini's directory holds only generated TOML. Anything else there is backed up first. Pass check to only report.",
113
113
  inputSchema: schemas.promptsSync,
114
114
  annotations: CONFIG_WRITE,
115
115
  execute: ({ promptsSync }, args) => promptsSync(args.id, args.check === true)
@@ -124,6 +124,9 @@ const tools = [
124
124
  }
125
125
  ];
126
126
  function validationError(schema, value) {
127
+ const declared = IsObject(schema) ? schema.properties : {};
128
+ const unknown = Object.keys(value).filter((key) => !Object.hasOwn(declared, key));
129
+ if (unknown.length > 0) return `Invalid arguments at /: unknown property ${unknown.join(", ")}`;
127
130
  const first = Errors(schema, value)[0];
128
131
  if (!first) return "Invalid arguments";
129
132
  return `Invalid arguments at ${first.instancePath || "/"}: ${first.message}`;
package/dist/mcp.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.mjs","names":["Type","Value.Errors","Value.Check"],"sources":["../src/mcp.ts"],"sourcesContent":["import { Server } from \"@modelcontextprotocol/sdk/server/index.js\";\nimport {\n CallToolRequestSchema,\n ListToolsRequestSchema,\n type CallToolResult,\n type Tool,\n} from \"@modelcontextprotocol/sdk/types.js\";\nimport { Type, type TSchema } from \"typebox\";\nimport { Value } from \"typebox/value\";\nimport type { McpServerParams, ToolResult } from \"./tool-operations.ts\";\nimport { harnessToolSchemas } from \"./tool-schemas.ts\";\nimport { version } from \"./types.ts\";\n\ninterface ToolDefinition {\n name: string;\n title: string;\n description: string;\n inputSchema: TSchema;\n annotations: Tool[\"annotations\"];\n execute(\n operations: Readonly<typeof import(\"./tool-operations.ts\")>,\n args: Readonly<Record<string, unknown>>,\n signal: AbortSignal,\n ): ToolResult<unknown> | Promise<ToolResult<unknown>>;\n}\n\nconst READ_ONLY: Tool[\"annotations\"] = {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n};\n\nconst EXEC_READ: Tool[\"annotations\"] = {\n readOnlyHint: false,\n destructiveHint: false,\n idempotentHint: false,\n openWorldHint: true,\n};\n\nconst CONFIG_WRITE: Tool[\"annotations\"] = {\n readOnlyHint: false,\n destructiveHint: true,\n idempotentHint: true,\n openWorldHint: false,\n};\n\nconst schemas = harnessToolSchemas<TSchema, TSchema>(Type);\nlet operationsPromise: Promise<typeof import(\"./tool-operations.ts\")> | undefined;\n\nconst tools: ToolDefinition[] = [\n {\n name: \"harnesses_detect\",\n title: \"Harnesses Detect\",\n description: \"List every known AI coding harness with its install state and version.\",\n inputSchema: schemas.detect,\n annotations: READ_ONLY,\n execute: ({ detectHarnesses }) => detectHarnesses(),\n },\n {\n name: \"harnesses_info\",\n title: \"Harnesses Info\",\n description:\n \"Full metadata for one or more AI coding harnesses, including supported invocation and model operations, configuration, sessions, instructions, skills, commands, prompt templates, hooks, and resolved paths.\",\n inputSchema: schemas.info,\n annotations: READ_ONLY,\n execute: ({ harnessInfo }, args) => harnessInfo(args.id as string | string[]),\n },\n {\n name: \"harnesses_models\",\n title: \"Harnesses Models\",\n description:\n \"List the models currently available to one AI coding harness through its native CLI, normalized across providers. An optional search filter is passed to harnesses that support it. The command may load project configuration and extensions.\",\n inputSchema: schemas.models,\n annotations: EXEC_READ,\n execute: ({ listHarnessModels }, args, signal) =>\n listHarnessModels(args.id as string, {\n search: args.search as string | undefined,\n cwd: args.cwd as string | undefined,\n timeoutSeconds: args.timeoutSeconds as number | undefined,\n signal,\n }),\n },\n {\n name: \"harnesses_run\",\n title: \"Harnesses Run\",\n description:\n \"Run one prompt through an AI coding harness's normalized non-interactive invocation and return its output. Pass tools=true whenever the task needs harness tools, including Grok native X search. Add readOnly=true to require native read-only tool enforcement. Pass tools=false only for an advisor without tools. Unsupported modes never widen access.\",\n inputSchema: schemas.run,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n idempotentHint: false,\n openWorldHint: true,\n },\n execute: ({ runHarness }, args, signal) =>\n runHarness(args.id as string, args.prompt as string, {\n cwd: args.cwd as string | undefined,\n model: args.model as string | undefined,\n timeoutSeconds: args.timeoutSeconds as number | undefined,\n signal,\n structured: args.structured as boolean | undefined,\n tools: args.tools as boolean | undefined,\n readOnly: args.readOnly as boolean | undefined,\n }),\n },\n {\n name: \"harnesses_mcp_list\",\n title: \"Harnesses MCP List\",\n description:\n \"List the MCP servers configured in each harness's config files, normalized across dialects. Omit id to scan every harness.\",\n inputSchema: schemas.mcpList,\n annotations: READ_ONLY,\n execute: ({ mcpList }, args) => mcpList(args.id as string | undefined),\n },\n {\n name: \"harnesses_mcp_add\",\n title: \"Harnesses MCP Add\",\n description:\n \"Add or replace one MCP server in a harness config. JSON configs are rewritten; TOML configs get a surgical, comment-preserving edit.\",\n inputSchema: schemas.mcpAdd,\n annotations: CONFIG_WRITE,\n execute: ({ mcpAdd }, args) =>\n mcpAdd(\n args.id as string,\n args as unknown as McpServerParams,\n (args.scope as \"user\" | \"project\") ?? \"user\",\n ),\n },\n {\n name: \"harnesses_mcp_sync\",\n title: \"Harnesses MCP Sync\",\n description:\n \"Reset every harness's user-scope MCP config to exactly the master list from ~/.config/agntn/mcp.jsonc: servers are added, replaced, and extras removed. Excluded harnesses keep their own servers, but master-listed names are withdrawn from them.\",\n inputSchema: schemas.mcpSync,\n annotations: CONFIG_WRITE,\n execute: ({ mcpSync }, args) => mcpSync(args.id as string | undefined),\n },\n {\n name: \"harnesses_agents_sync\",\n title: \"Harnesses Agents Sync\",\n description:\n \"Link every harness's global instructions file and declared companions to the master bundle, so edits made through any harness land in one place. Diverged copies are backed up and relinked. Pass check to only report.\",\n inputSchema: schemas.agentsSync,\n annotations: CONFIG_WRITE,\n execute: ({ agentsSync }, args) =>\n agentsSync(args.id as string | undefined, args.check === true),\n },\n {\n name: \"harnesses_prompts_sync\",\n title: \"Harnesses Prompts Sync\",\n description:\n \"Sync canonical Markdown prompt templates from the agntn XDG data directory into every supported harness. Markdown targets use links; Gemini receives generated TOML. Diverged files are backed up. Pass check to only report.\",\n inputSchema: schemas.promptsSync,\n annotations: CONFIG_WRITE,\n execute: ({ promptsSync }, args) =>\n promptsSync(args.id as string | undefined, args.check === true),\n },\n {\n name: \"harnesses_mcp_remove\",\n title: \"Harnesses MCP Remove\",\n description:\n \"Remove one MCP server from a harness config. JSON configs are rewritten; TOML configs get a surgical, comment-preserving edit.\",\n inputSchema: schemas.mcpRemove,\n annotations: CONFIG_WRITE,\n execute: ({ mcpRemove }, args) =>\n mcpRemove(\n args.id as string,\n args.name as string,\n (args.scope as \"user\" | \"project\") ?? \"user\",\n ),\n },\n];\n\n/**\n * Formats the first TypeBox validation failure for an MCP client.\n *\n * @param schema - Schema that rejected the value.\n * @param value - Rejected input value.\n * @returns {string} A client-facing validation message.\n */\nfunction validationError(schema: TSchema, value: unknown): string {\n const first = Value.Errors(schema, value)[0];\n if (!first) return \"Invalid arguments\";\n return `Invalid arguments at ${first.instancePath || \"/\"}: ${first.message}`;\n}\n\n/**\n * Wraps error text for the MCP client, replacing control bytes with spaces.\n *\n * Every error branch goes through here because parts of these messages echo\n * client-controlled values (a tool name, an argument) or downstream error\n * messages: one raw newline or escape byte would forge extra lines that read\n * as the server's own answer.\n *\n * @param text - Untrusted error text.\n * @returns {CallToolResult} A sanitized MCP error result.\n */\nfunction errorResult(text: string): CallToolResult {\n return {\n content: [{ type: \"text\", text: text.replaceAll(/\\p{Cc}/gu, \" \") }],\n isError: true,\n };\n}\n\n/**\n * Converts a shared tool result to the MCP text-result contract.\n *\n * `details` is dropped and `structuredContent` is never set: clients that see\n * structured output prefer it over `content` and would hide the readable answer.\n *\n * @param result - Shared tool result to adapt.\n * @returns {CallToolResult} The MCP text-result envelope.\n */\nfunction toCallToolResult(result: ToolResult<unknown>): CallToolResult {\n return {\n content: result.content,\n ...(result.isError === undefined ? {} : { isError: result.isError }),\n };\n}\n\n/**\n * Creates an unconnected MCP server exposing the harness registry tools.\n *\n * Built on the low-level `Server` even though the SDK marks it `@deprecated`,\n * because `McpServer.registerTool` accepts Standard Schema (Zod) only. TypeBox 1.x\n * does not implement Standard Schema, and this package's tool schemas are TypeBox,\n * shared with the Pi and OMP extensions. The high-level API would force a second\n * definition of every parameter.\n *\n * @returns {Server} An unconnected MCP server.\n */\nexport function createMcpServer(): Server {\n const toolsByName = new Map(tools.map((tool) => [tool.name, tool]));\n const server = new Server({ name: \"harnesses\", version }, { capabilities: { tools: {} } });\n\n server.setRequestHandler(ListToolsRequestSchema, () => ({\n tools: tools.map((tool): Tool => ({\n name: tool.name,\n title: tool.title,\n description: tool.description,\n inputSchema: tool.inputSchema as Tool[\"inputSchema\"],\n annotations: tool.annotations,\n })),\n }));\n\n server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {\n const tool = toolsByName.get(request.params.name);\n if (!tool) {\n return errorResult(`Unknown harnesses tool: ${JSON.stringify(request.params.name)}`);\n }\n\n const args = request.params.arguments ?? {};\n if (!Value.Check(tool.inputSchema, args)) {\n return errorResult(validationError(tool.inputSchema, args));\n }\n\n try {\n operationsPromise ??= import(\"./tool-operations.ts\");\n const operations = await operationsPromise;\n extra.signal.throwIfAborted();\n return toCallToolResult(await tool.execute(operations, args, extra.signal));\n } catch (error) {\n return errorResult(\n `${tool.name} failed: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n });\n\n return server;\n}\n"],"mappings":";;;;;AA0BA,MAAM,YAAiC;CACrC,cAAc;CACd,iBAAiB;CACjB,gBAAgB;CAChB,eAAe;AACjB;AAEA,MAAM,YAAiC;CACrC,cAAc;CACd,iBAAiB;CACjB,gBAAgB;CAChB,eAAe;AACjB;AAEA,MAAM,eAAoC;CACxC,cAAc;CACd,iBAAiB;CACjB,gBAAgB;CAChB,eAAe;AACjB;AAEA,MAAM,UAAU,mBAAqCA,eAAI;AACzD,IAAI;AAEJ,MAAM,QAA0B;CAC9B;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,aAAa,QAAQ;EACrB,aAAa;EACb,UAAU,EAAE,sBAAsB,gBAAgB;CACpD;CACA;EACE,MAAM;EACN,OAAO;EACP,aACE;EACF,aAAa,QAAQ;EACrB,aAAa;EACb,UAAU,EAAE,eAAe,SAAS,YAAY,KAAK,EAAuB;CAC9E;CACA;EACE,MAAM;EACN,OAAO;EACP,aACE;EACF,aAAa,QAAQ;EACrB,aAAa;EACb,UAAU,EAAE,qBAAqB,MAAM,WACrC,kBAAkB,KAAK,IAAc;GACnC,QAAQ,KAAK;GACb,KAAK,KAAK;GACV,gBAAgB,KAAK;GACrB;EACF,CAAC;CACL;CACA;EACE,MAAM;EACN,OAAO;EACP,aACE;EACF,aAAa,QAAQ;EACrB,aAAa;GACX,cAAc;GACd,iBAAiB;GACjB,gBAAgB;GAChB,eAAe;EACjB;EAC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E,MAAA,SAAM,IAAA,OAAA;EAAQ,MAAA;EAAuC;CACjE,GAAA,EAAA,cAAS,EAAA,OAAA,CAAA,EAAA,EAAA,CAAA;CACX,OAAA,kBAAA,+BAAA,EAAA,OAAA,MAAA,KAAA,UAAA;EACF,MAAA,KAAA;;;;;;;;;;EAWA,IAAA,CAAA,MAAS,KAAA,aAAiB,IAA6C,GAAA,OAAA,YAAA,gBAAA,KAAA,aAAA,IAAA,CAAA;EACrE,IAAA;GACE,sBAAgB,OAAA;GAChB,MAAI,aAAO,MAAY;GACzB,MAAA,OAAA,eAAA;GACF,OAAA,iBAAA,MAAA,KAAA,QAAA,YAAA,MAAA,MAAA,MAAA,CAAA"}
1
+ {"version":3,"file":"mcp.mjs","names":["Type","Value.Errors","Value.Check"],"sources":["../src/mcp.ts"],"sourcesContent":["import { Server } from \"@modelcontextprotocol/sdk/server/index.js\";\nimport {\n CallToolRequestSchema,\n ListToolsRequestSchema,\n type CallToolResult,\n type Tool,\n} from \"@modelcontextprotocol/sdk/types.js\";\nimport { IsObject, Type, type TSchema } from \"typebox\";\nimport { Value } from \"typebox/value\";\nimport type { McpServerParams, ToolResult } from \"./tool-operations.ts\";\nimport { harnessToolSchemas } from \"./tool-schemas.ts\";\nimport { version } from \"./types.ts\";\n\ninterface ToolDefinition {\n name: string;\n title: string;\n description: string;\n inputSchema: TSchema;\n annotations: Tool[\"annotations\"];\n execute(\n operations: Readonly<typeof import(\"./tool-operations.ts\")>,\n args: Readonly<Record<string, unknown>>,\n signal: AbortSignal,\n ): ToolResult<unknown> | Promise<ToolResult<unknown>>;\n}\n\nconst READ_ONLY: Tool[\"annotations\"] = {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n};\n\nconst EXEC_READ: Tool[\"annotations\"] = {\n readOnlyHint: false,\n destructiveHint: false,\n idempotentHint: false,\n openWorldHint: true,\n};\n\nconst CONFIG_WRITE: Tool[\"annotations\"] = {\n readOnlyHint: false,\n destructiveHint: true,\n idempotentHint: true,\n openWorldHint: false,\n};\n\nconst schemas = harnessToolSchemas<TSchema, TSchema>(Type);\nlet operationsPromise: Promise<typeof import(\"./tool-operations.ts\")> | undefined;\n\nconst tools: ToolDefinition[] = [\n {\n name: \"harnesses_detect\",\n title: \"Harnesses Detect\",\n description: \"List every known AI coding harness with its install state and version.\",\n inputSchema: schemas.detect,\n annotations: READ_ONLY,\n execute: ({ detectHarnesses }) => detectHarnesses(),\n },\n {\n name: \"harnesses_info\",\n title: \"Harnesses Info\",\n description:\n \"Full metadata for one or more AI coding harnesses, including supported invocation and model operations, configuration, sessions, instructions, skills, commands, prompt templates, hooks, temp directories, the env variables that move them, and resolved paths.\",\n inputSchema: schemas.info,\n annotations: READ_ONLY,\n execute: ({ harnessInfo }, args) => harnessInfo(args.id as string | string[]),\n },\n {\n name: \"harnesses_models\",\n title: \"Harnesses Models\",\n description:\n \"List the models currently available to one AI coding harness through its native CLI, normalized across providers. An optional search filter is passed to harnesses that support it. The command may load project configuration and extensions.\",\n inputSchema: schemas.models,\n annotations: EXEC_READ,\n execute: ({ listHarnessModels }, args, signal) =>\n listHarnessModels(args.id as string, {\n search: args.search as string | undefined,\n cwd: args.cwd as string | undefined,\n timeoutSeconds: args.timeoutSeconds as number | undefined,\n signal,\n }),\n },\n {\n name: \"harnesses_run\",\n title: \"Harnesses Run\",\n description:\n \"Run one prompt through an AI coding harness's normalized non-interactive invocation and return its output. Pass tools=true whenever the task needs harness tools, including Grok native X search. Add readOnly=true to require native read-only tool enforcement. Pass tools=false only for an advisor without tools. Unsupported modes never widen access.\",\n inputSchema: schemas.run,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n idempotentHint: false,\n openWorldHint: true,\n },\n execute: ({ runHarness }, args, signal) =>\n runHarness(args.id as string, args.prompt as string, {\n cwd: args.cwd as string | undefined,\n model: args.model as string | undefined,\n timeoutSeconds: args.timeoutSeconds as number | undefined,\n signal,\n structured: args.structured as boolean | undefined,\n tools: args.tools as boolean | undefined,\n readOnly: args.readOnly as boolean | undefined,\n }),\n },\n {\n name: \"harnesses_mcp_list\",\n title: \"Harnesses MCP List\",\n description:\n \"List the MCP servers configured in each harness's config files, normalized across dialects. Omit id to scan every harness.\",\n inputSchema: schemas.mcpList,\n annotations: READ_ONLY,\n execute: ({ mcpList }, args) => mcpList(args.id as string | undefined),\n },\n {\n name: \"harnesses_mcp_add\",\n title: \"Harnesses MCP Add\",\n description:\n \"Add or replace one MCP server in a harness config. JSON configs are rewritten; TOML configs get a surgical, comment-preserving edit.\",\n inputSchema: schemas.mcpAdd,\n annotations: CONFIG_WRITE,\n execute: ({ mcpAdd }, args) =>\n mcpAdd(\n args.id as string,\n args as unknown as McpServerParams,\n (args.scope as \"user\" | \"project\") ?? \"user\",\n ),\n },\n {\n name: \"harnesses_mcp_sync\",\n title: \"Harnesses MCP Sync\",\n description:\n \"Reset every harness's user-scope MCP config to exactly the master list from ~/.config/agntn/mcp.jsonc: servers are added, replaced, and extras removed. Excluded harnesses keep their own servers, but master-listed names are withdrawn from them.\",\n inputSchema: schemas.mcpSync,\n annotations: CONFIG_WRITE,\n execute: ({ mcpSync }, args) => mcpSync(args.id as string | undefined),\n },\n {\n name: \"harnesses_agents_sync\",\n title: \"Harnesses Agents Sync\",\n description:\n \"Link every harness's global instructions file and declared companions to the master bundle, so edits made through any harness land in one place. Diverged copies are backed up and relinked. Pass check to only report.\",\n inputSchema: schemas.agentsSync,\n annotations: CONFIG_WRITE,\n execute: ({ agentsSync }, args) =>\n agentsSync(args.id as string | undefined, args.check === true),\n },\n {\n name: \"harnesses_prompts_sync\",\n title: \"Harnesses Prompts Sync\",\n description:\n \"Sync canonical Markdown prompt templates from the agntn XDG data directory into every supported harness. Each Markdown target directory becomes one link to the canonical directory; Gemini's directory holds only generated TOML. Anything else there is backed up first. Pass check to only report.\",\n inputSchema: schemas.promptsSync,\n annotations: CONFIG_WRITE,\n execute: ({ promptsSync }, args) =>\n promptsSync(args.id as string | undefined, args.check === true),\n },\n {\n name: \"harnesses_mcp_remove\",\n title: \"Harnesses MCP Remove\",\n description:\n \"Remove one MCP server from a harness config. JSON configs are rewritten; TOML configs get a surgical, comment-preserving edit.\",\n inputSchema: schemas.mcpRemove,\n annotations: CONFIG_WRITE,\n execute: ({ mcpRemove }, args) =>\n mcpRemove(\n args.id as string,\n args.name as string,\n (args.scope as \"user\" | \"project\") ?? \"user\",\n ),\n },\n];\n\n/**\n * Formats the first TypeBox validation failure for an MCP client. A stray key is\n * named from the schema itself, since TypeBox reports it as `schema is false`.\n *\n * @param schema - Schema that rejected the value.\n * @param value - Rejected input value.\n * @returns {string} A client-facing validation message.\n */\nfunction validationError(schema: TSchema, value: object): string {\n const declared = IsObject(schema) ? schema.properties : {};\n const unknown = Object.keys(value).filter((key) => !Object.hasOwn(declared, key));\n if (unknown.length > 0) return `Invalid arguments at /: unknown property ${unknown.join(\", \")}`;\n const first = Value.Errors(schema, value)[0];\n if (!first) return \"Invalid arguments\";\n return `Invalid arguments at ${first.instancePath || \"/\"}: ${first.message}`;\n}\n\n/**\n * Wraps error text for the MCP client, replacing control bytes with spaces.\n *\n * Every error branch goes through here because parts of these messages echo\n * client-controlled values (a tool name, an argument) or downstream error\n * messages: one raw newline or escape byte would forge extra lines that read\n * as the server's own answer.\n *\n * @param text - Untrusted error text.\n * @returns {CallToolResult} A sanitized MCP error result.\n */\nfunction errorResult(text: string): CallToolResult {\n return {\n content: [{ type: \"text\", text: text.replaceAll(/\\p{Cc}/gu, \" \") }],\n isError: true,\n };\n}\n\n/**\n * Converts a shared tool result to the MCP text-result contract.\n *\n * `details` is dropped and `structuredContent` is never set: clients that see\n * structured output prefer it over `content` and would hide the readable answer.\n *\n * @param result - Shared tool result to adapt.\n * @returns {CallToolResult} The MCP text-result envelope.\n */\nfunction toCallToolResult(result: ToolResult<unknown>): CallToolResult {\n return {\n content: result.content,\n ...(result.isError === undefined ? {} : { isError: result.isError }),\n };\n}\n\n/**\n * Creates an unconnected MCP server exposing the harness registry tools.\n *\n * Built on the low-level `Server` even though the SDK marks it `@deprecated`,\n * because `McpServer.registerTool` accepts Standard Schema (Zod) only. TypeBox 1.x\n * does not implement Standard Schema, and this package's tool schemas are TypeBox,\n * shared with the Pi and OMP extensions. The high-level API would force a second\n * definition of every parameter.\n *\n * @returns {Server} An unconnected MCP server.\n */\nexport function createMcpServer(): Server {\n const toolsByName = new Map(tools.map((tool) => [tool.name, tool]));\n const server = new Server({ name: \"harnesses\", version }, { capabilities: { tools: {} } });\n\n server.setRequestHandler(ListToolsRequestSchema, () => ({\n tools: tools.map((tool): Tool => ({\n name: tool.name,\n title: tool.title,\n description: tool.description,\n inputSchema: tool.inputSchema as Tool[\"inputSchema\"],\n annotations: tool.annotations,\n })),\n }));\n\n server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {\n const tool = toolsByName.get(request.params.name);\n if (!tool) {\n return errorResult(`Unknown harnesses tool: ${JSON.stringify(request.params.name)}`);\n }\n\n const args = request.params.arguments ?? {};\n if (!Value.Check(tool.inputSchema, args)) {\n return errorResult(validationError(tool.inputSchema, args));\n }\n\n try {\n operationsPromise ??= import(\"./tool-operations.ts\");\n const operations = await operationsPromise;\n extra.signal.throwIfAborted();\n return toCallToolResult(await tool.execute(operations, args, extra.signal));\n } catch (error) {\n return errorResult(\n `${tool.name} failed: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n });\n\n return server;\n}\n"],"mappings":";;;;;AA0BA,MAAM,YAAiC;CACrC,cAAc;CACd,iBAAiB;CACjB,gBAAgB;CAChB,eAAe;AACjB;AAEA,MAAM,YAAiC;CACrC,cAAc;CACd,iBAAiB;CACjB,gBAAgB;CAChB,eAAe;AACjB;AAEA,MAAM,eAAoC;CACxC,cAAc;CACd,iBAAiB;CACjB,gBAAgB;CAChB,eAAe;AACjB;AAEA,MAAM,UAAU,mBAAqCA,eAAI;AACzD,IAAI;AAEJ,MAAM,QAA0B;CAC9B;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,aAAa,QA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MAAM;EACN,OAAO;EACP,aACE;EACF,aAAa,QAAQ;EACrB,aAAa;EACb,UAAU,EAAE,eAAe,SACzB,YAAY,KAAK,IAA0B,KAAK,UAAU,IAAI;CAClE;CACA;EACE,MAAM;EACN,OAAO;EACP,aACE;EACF,aAAa,QAAQ;EACrB,aAAa;EACb,UAAU,EAAE,aAAa,SACvB,UACE,KAAK,IACL,KAAK,MACJ,KAAK,SAAgC,MACxC;CACJ;AACF;;;;;;;;AAUA;AAEE,SAAM,YAAU,MAAO;CACvB,OAAI;EACJ,SAAM,CAAA;GACN,MAAK;GACL,MAAO,KAAA,WAAA,YAAwB,GAAM;EACvC,CAAA;;;;;;;;;;AAaA,SAAS,kBAA0C;CACjD,MAAA,cAAO,IAAA,IAAA,MAAA,KAAA,SAAA,CAAA,KAAA,MAAA,IAAA,CAAA,CAAA;CACL,MAAA,SAAU,IAAA,OAAA;EAAE,MAAA;EAAc;CAAuC,GAAC,EAAA,cAAA,EAAA,OAAA,CAAA,EAAA,EAAA,CAAA;CAClE,OAAA,kBAAS,+BAAA,EAAA,OAAA,MAAA,KAAA,UAAA;EACX,MAAA,KAAA;EACF,OAAA,KAAA;;;;;;;;;;EAWA,IAAA;GACE,sBAAO,OAAA;GACL,MAAA,aAAgB,MAAA;GAChB,MAAI,OAAO,eAAY;GACzB,OAAA,iBAAA,MAAA,KAAA,QAAA,YAAA,MAAA,MAAA,MAAA,CAAA;EACF,SAAA,OAAA"}
@@ -1,4 +1,4 @@
1
- import { AgentsSyncReport, AvailableModel, HarnessCapabilities, HarnessDetection, HarnessId, HarnessInvocationModes, McpConfigListing, McpServerConfig, PathCandidate, PromptSyncReport, PromptTemplateSyncTarget, ResolvedPaths, StorageDescriptor, SyncReport } from "./_chunks/prompt-sync.mjs";
1
+ import { AgentsSyncReport, AvailableModel, EnvOverride, HarnessCapabilities, HarnessDetection, HarnessId, HarnessInvocationModes, McpConfigListing, McpServerConfig, PathCandidate, PromptSyncReport, PromptTemplateSyncTarget, ResolvedPaths, StorageDescriptor, SyncReport } from "./_chunks/prompt-sync.mjs";
2
2
  import { HARNESS_INFO_MAX_ITEMS } from "./_chunks/tool-schemas.mjs";
3
3
  /** Text for the model plus details for the harness, shared by every tool surface. */
4
4
  export interface ToolResult<Details> {
@@ -38,6 +38,8 @@ export interface HarnessMetadata {
38
38
  promptTemplates: PathCandidate[];
39
39
  promptTemplateSyncTarget: PromptTemplateSyncTarget | null;
40
40
  hooks: PathCandidate[];
41
+ temp: PathCandidate[];
42
+ envOverrides: EnvOverride[];
41
43
  persistence: StorageDescriptor[];
42
44
  detection: HarnessDetection;
43
45
  resolved: ResolvedPaths;
@@ -89,6 +91,8 @@ export interface ModelsOutcome {
89
91
  exitCode: number | null;
90
92
  timedOut: boolean;
91
93
  aborted: boolean;
94
+ /** Milliseconds without output before the listing was stopped; absent when it exited on its own. */
95
+ idleMs?: number;
92
96
  stderr: string;
93
97
  }
94
98
  /**
@@ -112,7 +116,7 @@ export interface RunOptions {
112
116
  structured?: boolean;
113
117
  /** Enable tools; defaults to a native advisor without tools invocation. */
114
118
  tools?: boolean;
115
- /** Require native enforcement of read-only tool access. Implies tools. */
119
+ /** Require native enforcement of read-only tool access. Implies tools when `tools` is omitted; `tools: false` rejects the run. */
116
120
  readOnly?: boolean;
117
121
  }
118
122
  /** One completed (or failed) harness run, with output capped for the model. */
@@ -128,6 +132,8 @@ export interface RunOutcome {
128
132
  exitCode: number | null;
129
133
  timedOut: boolean;
130
134
  aborted: boolean;
135
+ /** Milliseconds without output before the run was stopped; absent when it exited on its own. */
136
+ idleMs?: number;
131
137
  stdout: string;
132
138
  stderr: string;
133
139
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tool-operations.d.mts","names":[],"sources":["../src/tool-operations.ts"],"mappings":";;;iBA4CiB,WAAW;EAC1B,SAAS;IAAQ;IAAc;;EAC/B,SAAS;;EAET;;;iBAIe;EACf,IAAI;EACJ;EACA;EACA;;;iBAIe;EACf,WAAW;;;iBAII;EACf,IAAI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Ac,WAAW,aAAa;;;;;;;;wBA+B9C,WAAW,aAAa,kBAAgB,WAAW,mBAAmB;;;;;;;;wBAgCtE,YAAY,aAAa,kBAAgB,WAAW,mBAAmB"}
1
+ {"version":3,"file":"tool-operations.d.mts","names":[],"sources":["../src/tool-operations.ts"],"mappings":";;;iBA6CiB,WAAW;EAC1B,SAAS;IAAQ;IAAc;;EAC/B,SAAS;;EAET;;;iBAIe;EACf,IAAI;EACJ;EACA;EACA;;;iBAIe;EACf,WAAW;;;iBAII;EACf,IAAI;EACJ;EACA;EACA,cAAc;EACd,iBAAiB;EACjB;EACA;EACA,QAAQ;EACR,UAAU;EACV,cAAc;EACd,QAAQ;EACR,UAAU;EACV,iBAAiB;EACjB,0BAA0B;EAC1B,OAAO;EACP,MAAM;EACN,cAAc;EACd,aAAa;EACb,WAAW;EACX,UAAU;;;iBAIK;EACf;EACA,OAAO;;;iBAIQ;EACf;;;YAIU,oBAAoB,kBAAkB;;YAGtC,qBAAqB,oBAAoB,sBAAsB;;qBAM9D;;qBAGA;;;;;;wBAoKG,mBAAmB,WAAW;;wBAuG9B,YAAY,aAAa,WAAW;;wBAEpC,YACd,yBACC,WAAW,sBAAsB;wBACpB,YAAY,oCAAoC,WAAW;;iBA2B1D;EACf;EACA;;EAEA;;EAEA,SAAS;;;iBAIM;EACf,IAAI;EACJ;EACA;EACA;EACA,QAAQ;EACR;EACA;EACA;;EAEA;EACA;;;;;;;;;wBAUoB,kBACpB,YACA,UAAS,gBACR,QAAQ,WAAW,gBAAgB;;iBAsDrB;EACf;;EAEA;;EAEA;;EAEA,SAAS;;EAET;;EAEA;;EAEA;;;iBAIe;EACf,IAAI;EACJ;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;;;iBAIe;EACf;EACA,QAAQ;;EAER,kBAAkB;;EAElB;IAAU;IAAmB;;IAAsB;;;;;;;;;;;;;;;;;wBAyB/B,WACpB,YACA,gBACA,UAAS,aACR,QAAQ,WAAW,aAAa;;iBAkClB;EACf,WAAW;IAAQ,IAAI;IAAW,SAAS;;;;iBAY5B;EACf,IAAI;EACJ;EACA;;;iBAIe;EACf;EACA,YAAY;EACZ;EACA;EACA,MAAM;EACN;EACA,UAAU;;;;;;;;wBASI,kBAAkB,QAAQ,kBAAkB;;;;;;;wBAmB5C,QAAQ,cAAc,WAAW,aAAa;;;;;;;;;wBAgD9C,OACd,YACA,QAAQ,iBACR,6BACC,WAAW,cAAc;;;;;;;;;wBAeZ,UACd,YACA,cACA,6BACC,WAAW,cAAc;;;;;;;wBAaZ,QAAQ,cAAc,WAAW,aAAa;;;;;;;;wBA+B9C,WAAW,aAAa,kBAAgB,WAAW,mBAAmB;;;;;;;;wBAgCtE,YAAY,aAAa,kBAAgB,WAAW,mBAAmB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agntn/harnesses",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Metadata registry for AI coding harnesses: binaries, configs, sessions, and capabilities.",
5
5
  "homepage": "https://harnesses.agntn.dev",
6
6
  "bugs": "https://github.com/agntn/harnesses/issues",
@@ -82,7 +82,7 @@ export default function harnessesExtension(pi: ExtensionAPI): void {
82
82
  name: "harnesses_info",
83
83
  label: HARNESS_TOOL_LABELS.harnesses_info,
84
84
  description:
85
- "Full metadata for one or more AI coding harnesses, including supported invocation and model operations, configuration, sessions, instructions, skills, commands, prompt templates, hooks, and resolved paths",
85
+ "Full metadata for one or more AI coding harnesses, including supported invocation and model operations, configuration, sessions, instructions, skills, commands, prompt templates, hooks, temp directories, the env variables that move them, and resolved paths",
86
86
  parameters: schemas.info,
87
87
  approval: HARNESS_TOOL_APPROVALS.harnesses_info,
88
88
  async execute(
@@ -97,7 +97,7 @@ export default function harnessesExtension(pi: ExtensionAPI): void {
97
97
  name: "harnesses_info",
98
98
  label: HARNESS_TOOL_LABELS.harnesses_info,
99
99
  description:
100
- "Full metadata for one or more AI coding harnesses, including supported invocation and model operations, configuration, sessions, instructions, skills, commands, prompt templates, hooks, and resolved paths",
100
+ "Full metadata for one or more AI coding harnesses, including supported invocation and model operations, configuration, sessions, instructions, skills, commands, prompt templates, hooks, temp directories, the env variables that move them, and resolved paths",
101
101
  promptSnippet: "Use harnesses_info to look up where coding harnesses store their data.",
102
102
  promptGuidelines: [
103
103
  "Pass one harness id from harnesses_detect, or batch several ids in one call.",