@agntn/harnesses 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -5
- package/dist/_chunks/agents.mjs +5 -3
- package/dist/_chunks/agents.mjs.map +1 -1
- package/dist/_chunks/mcp-servers.mjs +5 -3
- package/dist/_chunks/mcp-servers.mjs.map +1 -1
- package/dist/_chunks/mcp.mjs +10 -1
- package/dist/_chunks/mcp.mjs.map +1 -1
- package/dist/_chunks/output.mjs +7 -1
- package/dist/_chunks/output.mjs.map +1 -1
- package/dist/_chunks/prompts.mjs +4 -2
- package/dist/_chunks/prompts.mjs.map +1 -1
- package/dist/_chunks/{prompt-sync.d.mts → skills-sync.d.mts} +111 -53
- package/dist/_chunks/skills-sync.d.mts.map +1 -0
- package/dist/_chunks/{prompt-sync.mjs → skills-sync.mjs} +392 -100
- package/dist/_chunks/skills-sync.mjs.map +1 -0
- package/dist/_chunks/skills.mjs +30 -0
- package/dist/_chunks/skills.mjs.map +1 -0
- package/dist/_chunks/tool-operations.mjs +36 -8
- package/dist/_chunks/tool-operations.mjs.map +1 -1
- package/dist/_chunks/tool-schemas.d.mts +21 -13
- package/dist/_chunks/tool-schemas.d.mts.map +1 -1
- package/dist/_chunks/tool-schemas.mjs +7 -1
- package/dist/_chunks/tool-schemas.mjs.map +1 -1
- package/dist/_chunks/types.mjs +5 -2
- package/dist/_chunks/types.mjs.map +1 -1
- package/dist/cli.mjs +9 -3
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +16 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -3
- package/dist/index.mjs.map +1 -1
- package/dist/mcp.d.mts +2 -0
- package/dist/mcp.d.mts.map +1 -1
- package/dist/mcp.mjs +6256 -3
- package/dist/mcp.mjs.map +1 -1
- package/dist/tool-operations.d.mts +14 -3
- package/dist/tool-operations.d.mts.map +1 -1
- package/dist/tool-operations.mjs +3 -3
- package/dist/tool-schemas.d.mts +2 -2
- package/dist/tool-schemas.mjs +1 -1
- package/dist/typebox.LICENSE +23 -0
- package/package.json +19 -19
- package/packages/omp/extensions/harnesses.ts +27 -40
- package/packages/pi/extensions/harnesses.ts +26 -45
- package/packages/shared/tui.ts +13 -0
- package/dist/THIRD-PARTY-LICENSES.md +0 -36
- package/dist/_chunks/libs/typebox.mjs +0 -5439
- package/dist/_chunks/libs/typebox.mjs.map +0 -1
- package/dist/_chunks/prompt-sync.d.mts.map +0 -1
- package/dist/_chunks/prompt-sync.mjs.map +0 -1
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 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,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,QAAQ,QAAQ;CACrB,QAAQ,IAAI,QAAQ,KAAK,CAAC;CAC1B,KAAK,MAAM,KAAK,SAAS;EACvB,MAAM,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC;EAC5B,IAAI,EAAE,WAAW,KAAK,KAAK,EAAE,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC,CAAC;EACxD,QAAQ,IAAI,MAAM,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,KAAK,KAAK,EAAE,IAAI,KAAK,CAAC,GAAG,CAAC;EAChE,IAAI,EAAE,MAAM,QAAQ,IAAI,MAAM,GAAG,EAAE,IAAI,KAAK,EAAE,MAAM,GAAG,CAAC;CAC1D;AACF;AAEA,MAAM,aAAa;CACjB,MAAM;EAAE,MAAM;EAAoB,aAAa;CAAiB;CAChE,MAAM;EAAE,MAAM;EAAoB,aAAa;CAAiB;AAClE;AAEA,MAAM,aAAa;CACjB,MAAM;CACN,aAAa;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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\";\nimport { exitOnClosedPipe } from \"./commands/output.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\nprocess.stdout.on(\"error\", exitOnClosedPipe);\nprocess.stderr.on(\"error\", exitOnClosedPipe);\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 skills: () => import(\"./commands/skills.ts\").then((m) => m.default),\n mcp: () => import(\"./commands/mcp.ts\").then((m) => m.default),\n },\n});\n\nawait runMain(main);\n"],"mappings":";;;;;;;;;AAUA,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,QAAQ,QAAQ;CACrB,QAAQ,IAAI,QAAQ,KAAK,CAAC;CAC1B,KAAK,MAAM,KAAK,SAAS;EACvB,MAAM,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC;EAC5B,IAAI,EAAE,WAAW,KAAK,KAAK,EAAE,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC,CAAC;EACxD,QAAQ,IAAI,MAAM,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,KAAK,KAAK,EAAE,IAAI,KAAK,CAAC,GAAG,CAAC;EAChE,IAAI,EAAE,MAAM,QAAQ,IAAI,MAAM,GAAG,EAAE,IAAI,KAAK,EAAE,MAAM,GAAG,CAAC;CAC1D;AACF;AAEA,MAAM,aAAa;CACjB,MAAM;EAAE,MAAM;EAAoB,aAAa;CAAiB;CAChE,MAAM;EAAE,MAAM;EAAoB,aAAa;CAAiB;AAClE;AAEA,MAAM,aAAa;CACjB,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;CACzB,MAAM;EACJ,MAAM;EACN;EACA,aAAa;CACf;CACA,aAAa;EACX;EACA;EACA;EACA;EACA;EACA;EACA,qBAAqB,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,cAAc,OAAO,uBAAuB,CAAC,MAAM,MAAM,EAAE,OAAO;EAClE,WAAW,OAAO,oBAAoB,CAAC,MAAM,MAAM,EAAE,OAAO;CAC9D;AACF,CAAC;AAED,MAAM,QAAQ,IAAI"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as StorageDescriptor, A as HarnessConstructor, B as InvokeOptions, C as listMcpServers, D as removeMcpServer, E as readMasterMcpServers, F as HarnessDetection, G as McpServerConfig, H as ListModelsOptions, I as HarnessId, J as Platform, K as PathCandidate, L as HarnessInvocation, M as EnvOverride, N as EvidenceLevel, O as syncMcpServers, P as HarnessCapabilities, Q as SkillsSyncTarget, R as HarnessInvocationModes, S as addMcpServer, T as parseJsonc, U as ListModelsResult, V as InvokeResult, W as McpConfigFile, X as ResolveOptions, Y as PromptTemplateSyncTarget, Z as ResolvedPaths, _ as McpConfigListing, a as PromptSyncAction, b as SyncReport, c as PromptTemplateTargetResult, d as AgentsConfig, et as version, f as AgentsSyncAction, g as syncAgentsFiles, h as readAgentsConfig, i as syncSkills, j as AvailableModel, k as Harness, l as syncPromptTemplates, m as AgentsTargetResult, n as SkillsSyncReport, o as PromptSyncReport, p as AgentsSyncReport, q as PathCategory, r as SkillsSyncTargetResult, s as PromptSyncTargetResult, t as SkillsSyncAction, u as AgentsCompanionTargetResult, v as McpEnvError, w as masterMcpPath, x as SyncTargetResult, y as McpTransportError, z as HarnessModelListing } from "./_chunks/skills-sync.mjs";
|
|
2
|
+
//#region src/registry.d.ts
|
|
2
3
|
export declare function registerHarness(HarnessClass: HarnessConstructor): Harness;
|
|
3
4
|
export declare function getHarness(id: HarnessId): Harness;
|
|
4
5
|
export declare function listHarnesses(): HarnessId[];
|
|
@@ -29,6 +30,8 @@ export declare function detectProjectHarnesses(cwd?: string): Harness[];
|
|
|
29
30
|
* @returns {Harness | null} The unambiguous active harness, or null.
|
|
30
31
|
*/
|
|
31
32
|
export declare function detectHarness(cwd?: string): Harness | null;
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/resolve.d.ts
|
|
32
35
|
export declare function resolvePathTemplate(template: string, options?: ResolveOptions): string;
|
|
33
36
|
/**
|
|
34
37
|
* The agntn config directory: $XDG_CONFIG_HOME/agntn or ~/.config/agntn.
|
|
@@ -44,6 +47,8 @@ export declare function agntnConfigDir(options?: ResolveOptions): string;
|
|
|
44
47
|
* @returns {string} The resolved agntn data directory.
|
|
45
48
|
*/
|
|
46
49
|
export declare function agntnDataDir(options?: ResolveOptions): string;
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/schemas/claude.d.ts
|
|
47
52
|
interface ClaudeTextBlock {
|
|
48
53
|
type: "text";
|
|
49
54
|
text: string;
|
|
@@ -128,6 +133,8 @@ interface ClaudeHistoryEntry {
|
|
|
128
133
|
content: string;
|
|
129
134
|
}>;
|
|
130
135
|
}
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region src/schemas/gemini.d.ts
|
|
131
138
|
interface GeminiTokensSummary {
|
|
132
139
|
input: number;
|
|
133
140
|
output: number;
|
|
@@ -172,6 +179,8 @@ interface GeminiConversationRecord {
|
|
|
172
179
|
directories?: string[];
|
|
173
180
|
kind?: "main" | "subagent";
|
|
174
181
|
}
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region src/schemas/codex.d.ts
|
|
175
184
|
interface CodexHistoryEntry {
|
|
176
185
|
session_id: string;
|
|
177
186
|
ts: number;
|
|
@@ -201,6 +210,8 @@ interface CodexLogEntry {
|
|
|
201
210
|
thread_id: string | null;
|
|
202
211
|
process_uuid: string;
|
|
203
212
|
}
|
|
213
|
+
//#endregion
|
|
214
|
+
//#region src/schemas/opencode.d.ts
|
|
204
215
|
interface OpenCodeSession {
|
|
205
216
|
id: string;
|
|
206
217
|
project_id: string;
|
|
@@ -309,6 +320,9 @@ interface OpenCodeProject {
|
|
|
309
320
|
vcs: string | null;
|
|
310
321
|
name: string | null;
|
|
311
322
|
}
|
|
323
|
+
//#endregion
|
|
324
|
+
//#region src/index.d.ts
|
|
312
325
|
export declare const harnessIds: readonly HarnessId[];
|
|
313
|
-
|
|
326
|
+
//#endregion
|
|
327
|
+
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, McpTransportError, 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 SkillsSyncAction, type SkillsSyncReport, type SkillsSyncTarget, type SkillsSyncTargetResult, type StorageDescriptor, type SyncReport, type SyncTargetResult, addMcpServer, listMcpServers, masterMcpPath, parseJsonc, readAgentsConfig, readMasterMcpServers, removeMcpServer, syncAgentsFiles, syncMcpServers, syncPromptTemplates, syncSkills, version };
|
|
314
328
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -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":"
|
|
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;;;;qBCrBW,qBAAqB"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { version } from "./_chunks/types.mjs";
|
|
2
|
-
import { Harness,
|
|
1
|
+
import { t as version } from "./_chunks/types.mjs";
|
|
2
|
+
import { C as agntnConfigDir, S as Harness, T as resolvePathTemplate, _ as getAllHarnesses, a as McpEnvError, b as listHarnesses, c as listMcpServers, d as readMasterMcpServers, f as removeMcpServer, g as detectProjectHarnesses, h as detectHarnessFromEnv, i as syncAgentsFiles, l as masterMcpPath, m as detectHarness, n as syncPromptTemplates, o as McpTransportError, p as syncMcpServers, r as readAgentsConfig, s as addMcpServer, t as syncSkills, u as parseJsonc, v as getHarness, w as agntnDataDir, x as registerHarness, y as isHarnessId } from "./_chunks/skills-sync.mjs";
|
|
3
|
+
//#region src/index.ts
|
|
3
4
|
const harnessIds = Object.freeze(listHarnesses());
|
|
4
|
-
|
|
5
|
+
//#endregion
|
|
6
|
+
export { Harness, McpEnvError, McpTransportError, addMcpServer, agntnConfigDir, agntnDataDir, detectHarness, detectHarnessFromEnv, detectProjectHarnesses, getAllHarnesses, getHarness, harnessIds, isHarnessId, listHarnesses, listMcpServers, masterMcpPath, parseJsonc, readAgentsConfig, readMasterMcpServers, registerHarness, removeMcpServer, resolvePathTemplate, syncAgentsFiles, syncMcpServers, syncPromptTemplates, syncSkills, version };
|
|
5
7
|
|
|
6
8
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -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 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":"
|
|
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 SkillsSyncTarget,\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 McpTransportError,\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\";\nexport { syncSkills } from \"./skills-sync.ts\";\nexport type { SkillsSyncAction, SkillsSyncReport, SkillsSyncTargetResult } from \"./skills-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":";;;AAiHA,MAAa,aAAmC,OAAO,OAAO,cAAc,CAAC"}
|
package/dist/mcp.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
2
|
+
//#region src/mcp.d.ts
|
|
2
3
|
/**
|
|
3
4
|
* Creates an unconnected MCP server exposing the harness registry tools.
|
|
4
5
|
*
|
|
@@ -11,4 +12,5 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
|
11
12
|
* @returns {Server} An unconnected MCP server.
|
|
12
13
|
*/
|
|
13
14
|
export declare function createMcpServer(): Server;
|
|
15
|
+
//#endregion
|
|
14
16
|
//# sourceMappingURL=mcp.d.mts.map
|
package/dist/mcp.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.mts","names":[],"sources":["../src/mcp.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"mcp.d.mts","names":[],"sources":["../src/mcp.ts"],"mappings":";;;;;;;;;;;;;wBAsPgB,mBAAmB"}
|