@agntn/harnesses 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -13
- package/dist/_chunks/agents.mjs +2 -30
- package/dist/_chunks/agents.mjs.map +1 -1
- package/dist/_chunks/libs/typebox.mjs +11 -8
- package/dist/_chunks/libs/typebox.mjs.map +1 -1
- package/dist/_chunks/mcp-servers.mjs +5 -34
- package/dist/_chunks/mcp-servers.mjs.map +1 -1
- package/dist/_chunks/mcp.mjs +13 -163
- package/dist/_chunks/mcp.mjs.map +1 -1
- package/dist/_chunks/output.mjs +28 -0
- package/dist/_chunks/output.mjs.map +1 -0
- package/dist/_chunks/{agents-sync.d.mts → prompt-sync.d.mts} +51 -3
- package/dist/_chunks/prompt-sync.d.mts.map +1 -0
- package/dist/_chunks/{agents-sync.mjs → prompt-sync.mjs} +517 -21
- package/dist/_chunks/prompt-sync.mjs.map +1 -0
- package/dist/_chunks/prompts.mjs +28 -0
- package/dist/_chunks/prompts.mjs.map +1 -0
- package/dist/_chunks/tool-operations.mjs +43 -10
- package/dist/_chunks/tool-operations.mjs.map +1 -1
- package/dist/_chunks/tool-schemas.d.mts +5 -0
- package/dist/_chunks/tool-schemas.d.mts.map +1 -1
- package/dist/_chunks/tool-schemas.mjs +4 -0
- package/dist/_chunks/tool-schemas.mjs.map +1 -1
- package/dist/_chunks/types.mjs +1 -1
- package/dist/_chunks/types.mjs.map +1 -1
- package/dist/cli.mjs +6 -2
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +16 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/mcp.d.mts.map +1 -1
- package/dist/mcp.mjs +176 -1
- package/dist/mcp.mjs.map +1 -0
- package/dist/tool-operations.d.mts +12 -2
- package/dist/tool-operations.d.mts.map +1 -1
- package/dist/tool-operations.mjs +2 -2
- package/dist/tool-schemas.d.mts +2 -2
- package/package.json +16 -14
- package/packages/omp/extensions/harnesses.ts +19 -1
- package/packages/pi/extensions/harnesses.ts +23 -1
- package/packages/shared/tui.ts +22 -1
- package/dist/_chunks/agents-sync.d.mts.map +0 -1
- package/dist/_chunks/agents-sync.mjs.map +0 -1
- package/dist/_chunks/mcp2.mjs +0 -17
- package/dist/_chunks/mcp2.mjs.map +0 -1
|
@@ -1,38 +1,8 @@
|
|
|
1
|
-
import { isHarnessId, listHarnesses } from "./
|
|
1
|
+
import { isHarnessId, listHarnesses } from "./prompt-sync.mjs";
|
|
2
2
|
import { mcpAdd, mcpList, mcpRemove, mcpSync } from "./tool-operations.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { formatArgs, report } from "./output.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
import { consola } from "consola";
|
|
6
|
-
import { encode } from "@toon-format/toon";
|
|
7
|
-
const formatArgs = {
|
|
8
|
-
json: {
|
|
9
|
-
type: "boolean",
|
|
10
|
-
description: "Output as JSON"
|
|
11
|
-
},
|
|
12
|
-
toon: {
|
|
13
|
-
type: "boolean",
|
|
14
|
-
description: "Output as TOON"
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
const UNSAFE_TERMINAL_CONTROLS = /[\u0000-\u0008\u000B-\u001F\u007F-\u009F]/g;
|
|
18
|
-
function sanitize(text) {
|
|
19
|
-
return stripVTControlCharacters(text ?? "").replace(UNSAFE_TERMINAL_CONTROLS, " ");
|
|
20
|
-
}
|
|
21
|
-
function report(result, args) {
|
|
22
|
-
if (result.isError) {
|
|
23
|
-
consola.error(sanitize(result.content[0]?.text));
|
|
24
|
-
process.exit(1);
|
|
25
|
-
}
|
|
26
|
-
if (args.json) {
|
|
27
|
-
console.log(JSON.stringify(result.details, null, 2));
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
if (args.toon) {
|
|
31
|
-
console.log(encode(result.details));
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
console.log(sanitize(result.content[0]?.text));
|
|
35
|
-
}
|
|
36
6
|
function requireHarnessId(id) {
|
|
37
7
|
if (!isHarnessId(id)) {
|
|
38
8
|
consola.error(`Unknown harness: ${id}\nKnown: ${listHarnesses().join(", ")}`);
|
|
@@ -95,13 +65,14 @@ var mcp_servers_default = defineCommand({
|
|
|
95
65
|
},
|
|
96
66
|
run({ args }) {
|
|
97
67
|
const env = args.env ? Object.fromEntries(args.env.split(",").map((pair) => pair.split(/=(.*)/s)).filter((pair) => pair[0]).map((pair) => [pair[0], pair[1] ?? ""])) : void 0;
|
|
98
|
-
|
|
68
|
+
const result = mcpAdd(requireHarnessId(args.id), {
|
|
99
69
|
name: args.name,
|
|
100
70
|
...args.command ? { command: args.command } : {},
|
|
101
71
|
...args.args ? { args: args.args.split(" ").filter(Boolean) } : {},
|
|
102
72
|
...env ? { env } : {},
|
|
103
73
|
...args.url ? { url: args.url } : {}
|
|
104
|
-
}, args.scope === "project" ? "project" : "user")
|
|
74
|
+
}, args.scope === "project" ? "project" : "user");
|
|
75
|
+
report(result, args);
|
|
105
76
|
}
|
|
106
77
|
}),
|
|
107
78
|
sync: defineCommand({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-servers.mjs","names":[
|
|
1
|
+
{"version":3,"file":"mcp-servers.mjs","names":[],"sources":["../../src/commands/mcp-servers.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { consola } from \"consola\";\nimport { isHarnessId, listHarnesses } from \"../registry.ts\";\nimport { mcpAdd, mcpList, mcpRemove, mcpSync } from \"../tool-operations.ts\";\nimport { formatArgs, report } from \"./output.ts\";\n\nfunction requireHarnessId(id: string): string {\n if (!isHarnessId(id)) {\n consola.error(`Unknown harness: ${id}\\nKnown: ${listHarnesses().join(\", \")}`);\n process.exit(1);\n }\n return id;\n}\n\nexport default defineCommand({\n meta: { description: \"Manage MCP servers across harness configs\" },\n subCommands: {\n list: defineCommand({\n meta: { description: \"List configured MCP servers, normalized\" },\n args: {\n id: { type: \"positional\" as const, description: \"Harness id\", required: false },\n ...formatArgs,\n },\n run({ args }) {\n const id = args.id === undefined ? undefined : requireHarnessId(args.id as string);\n report(mcpList(id), args);\n },\n }),\n add: defineCommand({\n meta: { description: \"Add or replace one MCP server in a harness config\" },\n args: {\n id: { type: \"positional\" as const, description: \"Harness id\", required: true },\n name: { type: \"positional\" as const, description: \"Server name\", required: true },\n command: { type: \"string\" as const, description: \"Binary for a stdio server\" },\n args: {\n type: \"string\" as const,\n description: \"Space-separated arguments for a stdio server\",\n },\n env: { type: \"string\" as const, description: \"Comma-separated K=V environment variables\" },\n url: { type: \"string\" as const, description: \"URL for an http/sse server\" },\n scope: { type: \"string\" as const, description: \"user (default) or project\" },\n ...formatArgs,\n },\n run({ args }) {\n const env = args.env\n ? Object.fromEntries(\n args.env\n .split(\",\")\n .map((pair) => pair.split(/=(.*)/s))\n .filter((pair) => pair[0])\n .map((pair) => [pair[0] as string, pair[1] ?? \"\"]),\n )\n : undefined;\n const result = mcpAdd(\n requireHarnessId(args.id as string),\n {\n name: args.name as string,\n ...(args.command ? { command: args.command } : {}),\n ...(args.args ? { args: args.args.split(\" \").filter(Boolean) } : {}),\n ...(env ? { env } : {}),\n ...(args.url ? { url: args.url } : {}),\n },\n args.scope === \"project\" ? \"project\" : \"user\",\n );\n report(result, args);\n },\n }),\n sync: defineCommand({\n meta: {\n description: \"Reset harness configs to the master list from ~/.config/agntn/mcp.jsonc\",\n },\n args: {\n id: { type: \"positional\" as const, description: \"Harness id\", required: false },\n ...formatArgs,\n },\n run({ args }) {\n const id = args.id === undefined ? undefined : requireHarnessId(args.id as string);\n report(mcpSync(id), args);\n },\n }),\n remove: defineCommand({\n meta: { description: \"Remove one MCP server from a harness config\" },\n args: {\n id: { type: \"positional\" as const, description: \"Harness id\", required: true },\n name: { type: \"positional\" as const, description: \"Server name\", required: true },\n scope: { type: \"string\" as const, description: \"user (default) or project\" },\n ...formatArgs,\n },\n run({ args }) {\n report(\n mcpRemove(\n requireHarnessId(args.id as string),\n args.name as string,\n args.scope === \"project\" ? \"project\" : \"user\",\n ),\n args,\n );\n },\n }),\n },\n});\n"],"mappings":";;;;;AAMA,SAAS,iBAAiB,IAAoB;CAC5C,IAAI,CAAC,YAAY,EAAE,GAAG;EACpB,QAAQ,MAAM,oBAAoB,GAAG,WAAW,cAAc,CAAC,CAAC,KAAK,IAAI,GAAG;EAC5E,QAAQ,KAAK,CAAC;CAChB;CACA,OAAO;AACT;AAEA,IAAA,sBAAe,cAAc;CAC3B,MAAM,EAAE,aAAa,4CAA4C;CACjE,aAAa;EACX,MAAM,cAAc;GAClB,MAAM,EAAE,aAAa,0CAA0C;GAC/D,MAAM;IACJ,IAAI;KAAE,MAAM;KAAuB,aAAa;KAAc,UAAU;IAAM;IAC9E,GAAG;GACL;GACA,IAAI,EAAE,QAAQ;IACZ,MAAM,KAAK,KAAK,OAAO,KAAA,IAAY,KAAA,IAAY,iBAAiB,KAAK,EAAY;IACjF,OAAO,QAAQ,EAAE,GAAG,IAAI;GAC1B;EACF,CAAC;EACD,KAAK,cAAc;GACjB,MAAM,EAAE,aAAa,oDAAoD;GACzE,MAAM;IACJ,IAAI;KAAE,MAAM;KAAuB,aAAa;KAAc,UAAU;IAAK;IAC7E,MAAM;KAAE,MAAM;KAAuB,aAAa;KAAe,UAAU;IAAK;IAChF,SAAS;KAAE,MAAM;KAAmB,aAAa;IAA4B;IAC7E,MAAM;KACJ,MAAM;KACN,aAAa;IACf;IACA,KAAK;KAAE,MAAM;KAAmB,aAAa;IAA4C;IACzF,KAAK;KAAE,MAAM;KAAmB,aAAa;IAA6B;IAC1E,OAAO;KAAE,MAAM;KAAmB,aAAa;IAA4B;IAC3E,GAAG;GACL;GACA,IAAI,EAAE,QAAQ;IACZ,MAAM,MAAM,KAAK,MACb,OAAO,YACL,KAAK,IACF,MAAM,GAAG,CAAC,CACV,KAAK,SAAS,KAAK,MAAM,QAAQ,CAAC,CAAC,CACnC,QAAQ,SAAS,K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|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
const EXEC_READ = {
|
|
14
|
-
readOnlyHint: false,
|
|
15
|
-
destructiveHint: false,
|
|
16
|
-
idempotentHint: false,
|
|
17
|
-
openWorldHint: true
|
|
18
|
-
};
|
|
19
|
-
const CONFIG_WRITE = {
|
|
20
|
-
readOnlyHint: false,
|
|
21
|
-
destructiveHint: true,
|
|
22
|
-
idempotentHint: true,
|
|
23
|
-
openWorldHint: false
|
|
24
|
-
};
|
|
25
|
-
const schemas = harnessToolSchemas(typebox_exports);
|
|
26
|
-
const tools = [
|
|
27
|
-
{
|
|
28
|
-
name: "harnesses_detect",
|
|
29
|
-
title: "Harnesses Detect",
|
|
30
|
-
description: "List every known AI coding harness with its install state and version.",
|
|
31
|
-
inputSchema: schemas.detect,
|
|
32
|
-
annotations: READ_ONLY,
|
|
33
|
-
execute: () => detectHarnesses()
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
name: "harnesses_info",
|
|
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, hooks, and resolved paths.",
|
|
39
|
-
inputSchema: schemas.info,
|
|
40
|
-
annotations: READ_ONLY,
|
|
41
|
-
execute: (args) => harnessInfo(args.id)
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: "harnesses_models",
|
|
45
|
-
title: "Harnesses Models",
|
|
46
|
-
description: "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.",
|
|
47
|
-
inputSchema: schemas.models,
|
|
48
|
-
annotations: EXEC_READ,
|
|
49
|
-
execute: (args, signal) => listHarnessModels(args.id, {
|
|
50
|
-
search: args.search,
|
|
51
|
-
cwd: args.cwd,
|
|
52
|
-
timeoutSeconds: args.timeoutSeconds,
|
|
53
|
-
signal
|
|
54
|
-
})
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
name: "harnesses_run",
|
|
58
|
-
title: "Harnesses Run",
|
|
59
|
-
description: "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.",
|
|
60
|
-
inputSchema: schemas.run,
|
|
61
|
-
annotations: {
|
|
62
|
-
readOnlyHint: false,
|
|
63
|
-
destructiveHint: true,
|
|
64
|
-
idempotentHint: false,
|
|
65
|
-
openWorldHint: true
|
|
66
|
-
},
|
|
67
|
-
execute: (args, signal) => runHarness(args.id, args.prompt, {
|
|
68
|
-
cwd: args.cwd,
|
|
69
|
-
model: args.model,
|
|
70
|
-
timeoutSeconds: args.timeoutSeconds,
|
|
71
|
-
signal,
|
|
72
|
-
structured: args.structured,
|
|
73
|
-
tools: args.tools,
|
|
74
|
-
readOnly: args.readOnly
|
|
75
|
-
})
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
name: "harnesses_mcp_list",
|
|
79
|
-
title: "Harnesses MCP List",
|
|
80
|
-
description: "List the MCP servers configured in each harness's config files, normalized across dialects. Omit id to scan every harness.",
|
|
81
|
-
inputSchema: schemas.mcpList,
|
|
82
|
-
annotations: READ_ONLY,
|
|
83
|
-
execute: (args) => mcpList(args.id)
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
name: "harnesses_mcp_add",
|
|
87
|
-
title: "Harnesses MCP Add",
|
|
88
|
-
description: "Add or replace one MCP server in a harness config. JSON configs are rewritten; TOML configs get a surgical, comment-preserving edit.",
|
|
89
|
-
inputSchema: schemas.mcpAdd,
|
|
90
|
-
annotations: CONFIG_WRITE,
|
|
91
|
-
execute: (args) => mcpAdd(args.id, args, args.scope ?? "user")
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
name: "harnesses_mcp_sync",
|
|
95
|
-
title: "Harnesses MCP Sync",
|
|
96
|
-
description: "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.",
|
|
97
|
-
inputSchema: schemas.mcpSync,
|
|
98
|
-
annotations: CONFIG_WRITE,
|
|
99
|
-
execute: (args) => mcpSync(args.id)
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
name: "harnesses_agents_sync",
|
|
103
|
-
title: "Harnesses Agents Sync",
|
|
104
|
-
description: "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.",
|
|
105
|
-
inputSchema: schemas.agentsSync,
|
|
106
|
-
annotations: CONFIG_WRITE,
|
|
107
|
-
execute: (args) => agentsSync(args.id, args.check === true)
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
name: "harnesses_mcp_remove",
|
|
111
|
-
title: "Harnesses MCP Remove",
|
|
112
|
-
description: "Remove one MCP server from a harness config. JSON configs are rewritten; TOML configs get a surgical, comment-preserving edit.",
|
|
113
|
-
inputSchema: schemas.mcpRemove,
|
|
114
|
-
annotations: CONFIG_WRITE,
|
|
115
|
-
execute: (args) => mcpRemove(args.id, args.name, args.scope ?? "user")
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
import { LogLevels, consola } from "consola";
|
|
3
|
+
var mcp_default = defineCommand({
|
|
4
|
+
meta: {
|
|
5
|
+
name: "mcp",
|
|
6
|
+
description: "Run the harnesses MCP server over stdio"
|
|
7
|
+
},
|
|
8
|
+
async run() {
|
|
9
|
+
consola.level = LogLevels.warn;
|
|
10
|
+
const [{ createMcpServer }, { StdioServerTransport }] = await Promise.all([import("../mcp.mjs"), import("@modelcontextprotocol/sdk/server/stdio.js")]);
|
|
11
|
+
await createMcpServer().connect(new StdioServerTransport());
|
|
116
12
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
const first = Errors(schema, value)[0];
|
|
120
|
-
if (!first) return "Invalid arguments";
|
|
121
|
-
return `Invalid arguments at ${first.instancePath || "/"}: ${first.message}`;
|
|
122
|
-
}
|
|
123
|
-
function errorResult(text) {
|
|
124
|
-
return {
|
|
125
|
-
content: [{
|
|
126
|
-
type: "text",
|
|
127
|
-
text: text.replaceAll(/\p{Cc}/gu, " ")
|
|
128
|
-
}],
|
|
129
|
-
isError: true
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
function toCallToolResult(result) {
|
|
133
|
-
return {
|
|
134
|
-
content: result.content,
|
|
135
|
-
...result.isError === void 0 ? {} : { isError: result.isError }
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
function createMcpServer() {
|
|
139
|
-
const toolsByName = new Map(tools.map((tool) => [tool.name, tool]));
|
|
140
|
-
const server = new Server({
|
|
141
|
-
name: "harnesses",
|
|
142
|
-
version
|
|
143
|
-
}, { capabilities: { tools: {} } });
|
|
144
|
-
server.setRequestHandler(ListToolsRequestSchema, () => ({ tools: tools.map((tool) => ({
|
|
145
|
-
name: tool.name,
|
|
146
|
-
title: tool.title,
|
|
147
|
-
description: tool.description,
|
|
148
|
-
inputSchema: tool.inputSchema,
|
|
149
|
-
annotations: tool.annotations
|
|
150
|
-
})) }));
|
|
151
|
-
server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
|
|
152
|
-
const tool = toolsByName.get(request.params.name);
|
|
153
|
-
if (!tool) return errorResult(`Unknown harnesses tool: ${JSON.stringify(request.params.name)}`);
|
|
154
|
-
const args = request.params.arguments ?? {};
|
|
155
|
-
if (!Check(tool.inputSchema, args)) return errorResult(validationError(tool.inputSchema, args));
|
|
156
|
-
try {
|
|
157
|
-
return toCallToolResult(await tool.execute(args, extra.signal));
|
|
158
|
-
} catch (error) {
|
|
159
|
-
return errorResult(`${tool.name} failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
return server;
|
|
163
|
-
}
|
|
164
|
-
export { createMcpServer };
|
|
13
|
+
});
|
|
14
|
+
export { mcp_default as default };
|
|
165
15
|
|
|
166
16
|
//# sourceMappingURL=mcp.mjs.map
|
package/dist/_chunks/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 {\n detectHarnesses,\n harnessInfo,\n listHarnessModels,\n mcpAdd,\n mcpList,\n mcpRemove,\n mcpSync,\n agentsSync,\n runHarness,\n type McpServerParams,\n type ToolResult,\n} 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 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);\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(),\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, hooks, and resolved paths.\",\n inputSchema: schemas.info,\n annotations: READ_ONLY,\n execute: (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: (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: (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: (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: (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: (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: (args) => agentsSync(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: (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 return toCallToolResult(await tool.execute(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":"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"}
|
|
1
|
+
{"version":3,"file":"mcp.mjs","names":[],"sources":["../../src/commands/mcp.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { consola, LogLevels } from \"consola\";\n\nexport default defineCommand({\n meta: {\n name: \"mcp\",\n description: \"Run the harnesses MCP server over stdio\",\n },\n /**\n * The server and the SDK load here, because citty resolves every subcommand\n * to print `harnesses --help` and to look for an alias of an unknown command.\n *\n * stdout carries the JSON-RPC frames. consola's default reporter sends\n * anything at log level or below to that same descriptor, and `DEBUG` in the\n * environment raises the level on import, so one stray line would corrupt\n * the stream. Warnings and errors still reach stderr.\n */\n async run() {\n consola.level = LogLevels.warn;\n\n const [{ createMcpServer }, { StdioServerTransport }] = await Promise.all([\n import(\"../mcp.ts\"),\n import(\"@modelcontextprotocol/sdk/server/stdio.js\"),\n ]);\n await createMcpServer().connect(new StdioServerTransport());\n },\n});\n"],"mappings":";;AAGA,IAAA,cAAe,cAAc;CAC3B,MAAM;EACJ,MAAM;EACN,aAAa;CACf"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { stripVTControlCharacters } from "node:util";
|
|
2
|
+
import { consola } from "consola";
|
|
3
|
+
import { encode } from "@toon-format/toon";
|
|
4
|
+
const formatArgs = {
|
|
5
|
+
json: {
|
|
6
|
+
type: "boolean",
|
|
7
|
+
description: "Output as JSON"
|
|
8
|
+
},
|
|
9
|
+
toon: {
|
|
10
|
+
type: "boolean",
|
|
11
|
+
description: "Output as TOON"
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const UNSAFE_TERMINAL_CONTROLS = /[\u0000-\u0008\u000B-\u001F\u007F-\u009F]/g;
|
|
15
|
+
const UNSAFE_UNICODE_FORMATTING = /[\p{Cf}\p{Zl}\p{Zp}]/gu;
|
|
16
|
+
function sanitize(text) {
|
|
17
|
+
return stripVTControlCharacters(text ?? "").replace(UNSAFE_TERMINAL_CONTROLS, " ").replace(UNSAFE_UNICODE_FORMATTING, " ");
|
|
18
|
+
}
|
|
19
|
+
function report(result, args) {
|
|
20
|
+
if (args.json) console.log(JSON.stringify(result.details, null, 2));
|
|
21
|
+
else if (args.toon) console.log(encode(result.details));
|
|
22
|
+
else if (result.isError) consola.error(sanitize(result.content[0]?.text));
|
|
23
|
+
else console.log(sanitize(result.content[0]?.text));
|
|
24
|
+
if (result.isError) process.exitCode = 1;
|
|
25
|
+
}
|
|
26
|
+
export { formatArgs, report };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=output.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.mjs","names":["toToon"],"sources":["../../src/commands/output.ts"],"sourcesContent":["import { stripVTControlCharacters } from \"node:util\";\nimport { encode as toToon } from \"@toon-format/toon\";\nimport { consola } from \"consola\";\nimport type { ToolResult } from \"../tool-operations.ts\";\n\nexport const formatArgs = {\n json: { type: \"boolean\" as const, description: \"Output as JSON\" },\n toon: { type: \"boolean\" as const, description: \"Output as TOON\" },\n};\n\ntype OutputFormat = Readonly<{ json?: boolean; toon?: boolean }>;\n\n/** Control bytes removed from reports because they can echo untrusted configuration values. */\n/* oxlint-disable-next-line no-control-regex */\nconst UNSAFE_TERMINAL_CONTROLS = /[\\u0000-\\u0008\\u000B-\\u001F\\u007F-\\u009F]/g;\nconst UNSAFE_UNICODE_FORMATTING = /[\\p{Cf}\\p{Zl}\\p{Zp}]/gu;\n\nfunction sanitize(text: string | undefined): string {\n return stripVTControlCharacters(text ?? \"\")\n .replace(UNSAFE_TERMINAL_CONTROLS, \" \")\n .replace(UNSAFE_UNICODE_FORMATTING, \" \");\n}\n\n/**\n * Emits one tool result in the selected machine or human format.\n *\n * @param result - Shared executor result to emit.\n * @param args - Selected output format.\n */\nexport function report(result: ToolResult<unknown>, args: OutputFormat): void {\n if (args.json) console.log(JSON.stringify(result.details, null, 2));\n else if (args.toon) console.log(toToon(result.details));\n else if (result.isError) consola.error(sanitize(result.content[0]?.text));\n else console.log(sanitize(result.content[0]?.text));\n\n if (result.isError) process.exitCode = 1;\n}\n"],"mappings":";;;AAKA,MAAa,aAAa;CACxB,MAAM;EAAE,MAAM;EAAoB,aAAa;CAAiB;CAChE,MAAM;EAAE,MAAM;EAAoB,aAAa;CAAiB;AAClE;AAMA,MAAM,2BAA2B;AACjC,MAAM,4BAA4B;AAElC,SAAS,SAAS,MAAkC;CAClD,OAAO,yBAAyB,QAAQ,EAAE,CAAC,CACxC,QAAQ,0BAA0B,GAAG,CAAC,CACtC,QAAQ,2BAA2B,GAAG;AAC3C;;;;;;CAQA,IAAA,OAAgB,SAAO,QAA6B,WAA0B;AAC5E;AAEK,SAAA,YAAW"}
|
|
@@ -9,6 +9,11 @@ export interface PathCandidate {
|
|
|
9
9
|
platforms?: Platform[];
|
|
10
10
|
note?: string;
|
|
11
11
|
}
|
|
12
|
+
/** One stable user-scope destination used by prompt template synchronization. */
|
|
13
|
+
export interface PromptTemplateSyncTarget extends PathCandidate {
|
|
14
|
+
scope: "user";
|
|
15
|
+
format: "markdown" | "gemini-toml";
|
|
16
|
+
}
|
|
12
17
|
export interface StorageDescriptor {
|
|
13
18
|
format: string;
|
|
14
19
|
level: EvidenceLevel;
|
|
@@ -140,9 +145,10 @@ export interface McpConfigFile extends PathCandidate {
|
|
|
140
145
|
key: string[];
|
|
141
146
|
/**
|
|
142
147
|
* Shape of individual entries; "standard" is the {command, args, env, url}
|
|
143
|
-
* family
|
|
148
|
+
* family, "prime" is that family with env values as {"env": "NAME"} references
|
|
149
|
+
* and "mastracode" is that family read by its keys alone, type ignored.
|
|
144
150
|
*/
|
|
145
|
-
dialect: "standard" | "antigravity" | "opencode" | "prime" | "vscode";
|
|
151
|
+
dialect: "standard" | "antigravity" | "mastracode" | "opencode" | "prime" | "vscode";
|
|
146
152
|
}
|
|
147
153
|
export interface HarnessDetection {
|
|
148
154
|
/** Environment variables that indicate running inside this agent. */
|
|
@@ -161,6 +167,8 @@ export interface ResolvedPaths {
|
|
|
161
167
|
instructions: PathCandidate[];
|
|
162
168
|
skills: PathCandidate[];
|
|
163
169
|
commands: PathCandidate[];
|
|
170
|
+
promptTemplates: PathCandidate[];
|
|
171
|
+
promptTemplateSyncTarget: PromptTemplateSyncTarget | null;
|
|
164
172
|
hooks: PathCandidate[];
|
|
165
173
|
}
|
|
166
174
|
type InvocationOptions = Readonly<{
|
|
@@ -179,6 +187,10 @@ export declare abstract class Harness {
|
|
|
179
187
|
abstract readonly instructions: PathCandidate[];
|
|
180
188
|
abstract readonly skills: PathCandidate[];
|
|
181
189
|
abstract readonly commands: PathCandidate[];
|
|
190
|
+
/** Reusable prompt files; empty when no CLI template location is verified. */
|
|
191
|
+
readonly promptTemplates: PathCandidate[];
|
|
192
|
+
/** Stable user-scope destination used by prompt template synchronization. */
|
|
193
|
+
readonly promptTemplateSyncTarget: PromptTemplateSyncTarget | null;
|
|
182
194
|
abstract readonly hooks: PathCandidate[];
|
|
183
195
|
abstract readonly capabilities: HarnessCapabilities;
|
|
184
196
|
abstract readonly detection: HarnessDetection;
|
|
@@ -444,4 +456,40 @@ export declare function readAgentsConfig(options?: ResolveOptions): AgentsConfig
|
|
|
444
456
|
* @returns {AgentsSyncReport} Per-harness synchronization outcomes.
|
|
445
457
|
*/
|
|
446
458
|
export declare function syncAgentsFiles(harnesses: readonly Harness[], check?: boolean, options?: ResolveOptions): AgentsSyncReport;
|
|
447
|
-
|
|
459
|
+
export type PromptSyncAction = "linked" | "generated" | "relinked" | "replaced" | "adopted" | "removed" | "unchanged" | "skipped";
|
|
460
|
+
/** One prompt template's outcome at a harness destination. */
|
|
461
|
+
export interface PromptTemplateTargetResult {
|
|
462
|
+
readonly name: string;
|
|
463
|
+
readonly source?: string;
|
|
464
|
+
readonly path: string;
|
|
465
|
+
readonly action: PromptSyncAction;
|
|
466
|
+
/** Backup path, skip reason, or a check-mode note. */
|
|
467
|
+
readonly detail?: string;
|
|
468
|
+
}
|
|
469
|
+
/** One harness's outcome of a prompt template sync run. */
|
|
470
|
+
export interface PromptSyncTargetResult {
|
|
471
|
+
readonly id: string;
|
|
472
|
+
readonly path?: string;
|
|
473
|
+
readonly format?: PromptTemplateSyncTarget["format"];
|
|
474
|
+
readonly detail?: string;
|
|
475
|
+
readonly templates: readonly PromptTemplateTargetResult[];
|
|
476
|
+
}
|
|
477
|
+
/** Outcome of one prompt template sync run. */
|
|
478
|
+
export interface PromptSyncReport {
|
|
479
|
+
readonly source: string;
|
|
480
|
+
readonly check: boolean;
|
|
481
|
+
readonly templates: readonly string[];
|
|
482
|
+
readonly targets: readonly PromptSyncTargetResult[];
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Synchronizes canonical Markdown prompt templates into each harness's stable
|
|
486
|
+
* user-scope destination. Markdown harnesses receive symlinks; Gemini receives
|
|
487
|
+
* generated TOML commands. In check mode nothing is written.
|
|
488
|
+
*
|
|
489
|
+
* @param harnesses - Harnesses to inspect or update.
|
|
490
|
+
* @param check - Report intended changes without writing them.
|
|
491
|
+
* @param options - Path-resolution overrides.
|
|
492
|
+
* @returns {PromptSyncReport} Per-harness synchronization outcomes.
|
|
493
|
+
*/
|
|
494
|
+
export declare function syncPromptTemplates(harnesses: readonly Harness[], check?: boolean, options?: ResolveOptions): PromptSyncReport;
|
|
495
|
+
//# sourceMappingURL=prompt-sync.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-sync.d.mts","names":[],"sources":["../../src/types.ts","../../src/harness.ts","../../src/mcp-servers.ts","../../src/agents-sync.ts","../../src/prompt-sync.ts"],"mappings":"AAEA,qBAAa;YAED;YAcA;YACA;iBAEK;EACf;EACA;EACA,OAAO;EACP,YAAY;EACZ;;;iBAIe,iCAAiC;EAChD;EACA;;iBAGe;EACf;EACA,OAAO;EACP;;iBAGe;EACf;EACA;;EAEA;;EAEA;EACA;EACA;;;iBAIe;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA,OAAO;EACP;;;iBAIe;EACf;EACA;EACA;EACA;EACA;EACA;;;iBAIe;;EAEf;;EAEA;EACA,OAAO;EACP;;;iBAIe;EACf;EACA;EACA;EACA;EACA;EACA;;;iBAIe;EACf;EACA;EACA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