@agntn/harnesses 0.1.1 → 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.
Files changed (47) hide show
  1. package/README.md +152 -117
  2. package/dist/_chunks/agents.mjs +2 -30
  3. package/dist/_chunks/agents.mjs.map +1 -1
  4. package/dist/_chunks/libs/typebox.mjs +535 -608
  5. package/dist/_chunks/libs/typebox.mjs.map +1 -1
  6. package/dist/_chunks/mcp-servers.mjs +5 -34
  7. package/dist/_chunks/mcp-servers.mjs.map +1 -1
  8. package/dist/_chunks/mcp.mjs +13 -163
  9. package/dist/_chunks/mcp.mjs.map +1 -1
  10. package/dist/_chunks/output.mjs +28 -0
  11. package/dist/_chunks/output.mjs.map +1 -0
  12. package/dist/_chunks/{agents-sync.d.mts → prompt-sync.d.mts} +91 -44
  13. package/dist/_chunks/prompt-sync.d.mts.map +1 -0
  14. package/dist/_chunks/{agents-sync.mjs → prompt-sync.mjs} +565 -26
  15. package/dist/_chunks/prompt-sync.mjs.map +1 -0
  16. package/dist/_chunks/prompts.mjs +28 -0
  17. package/dist/_chunks/prompts.mjs.map +1 -0
  18. package/dist/_chunks/tool-operations.mjs +43 -10
  19. package/dist/_chunks/tool-operations.mjs.map +1 -1
  20. package/dist/_chunks/tool-schemas.d.mts +17 -13
  21. package/dist/_chunks/tool-schemas.d.mts.map +1 -1
  22. package/dist/_chunks/tool-schemas.mjs +4 -0
  23. package/dist/_chunks/tool-schemas.mjs.map +1 -1
  24. package/dist/_chunks/types.mjs +1 -1
  25. package/dist/_chunks/types.mjs.map +1 -1
  26. package/dist/cli.mjs +6 -2
  27. package/dist/cli.mjs.map +1 -1
  28. package/dist/index.d.mts +26 -12
  29. package/dist/index.d.mts.map +1 -1
  30. package/dist/index.mjs +2 -2
  31. package/dist/index.mjs.map +1 -1
  32. package/dist/mcp.d.mts +1 -2
  33. package/dist/mcp.d.mts.map +1 -1
  34. package/dist/mcp.mjs +176 -1
  35. package/dist/mcp.mjs.map +1 -0
  36. package/dist/tool-operations.d.mts +42 -32
  37. package/dist/tool-operations.d.mts.map +1 -1
  38. package/dist/tool-operations.mjs +2 -2
  39. package/dist/tool-schemas.d.mts +2 -2
  40. package/package.json +24 -21
  41. package/packages/omp/extensions/harnesses.ts +19 -1
  42. package/packages/pi/extensions/harnesses.ts +26 -2
  43. package/packages/shared/tui.ts +22 -1
  44. package/dist/_chunks/agents-sync.d.mts.map +0 -1
  45. package/dist/_chunks/agents-sync.mjs.map +0 -1
  46. package/dist/_chunks/mcp2.mjs +0 -17
  47. package/dist/_chunks/mcp2.mjs.map +0 -1
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@agntn/harnesses",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
4
4
  "description": "Metadata registry for AI coding harnesses: binaries, configs, sessions, and capabilities.",
5
- "homepage": "https://github.com/agntn/harnesses#readme",
5
+ "homepage": "https://harnesses.agntn.dev",
6
6
  "bugs": "https://github.com/agntn/harnesses/issues",
7
7
  "license": "MIT",
8
8
  "author": "oritwoen (https://github.com/oritwoen)",
@@ -38,27 +38,29 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@modelcontextprotocol/sdk": "1.30.0",
41
- "@toon-format/toon": "^4.1.1",
42
- "citty": "^0.2.2",
43
- "consola": "^3.4.2",
44
- "smol-toml": "^1.8.0",
45
- "typebox": "^1.3.19"
41
+ "@toon-format/toon": "4.1.1",
42
+ "citty": "0.2.2",
43
+ "consola": "3.4.2",
44
+ "smol-toml": "1.8.0",
45
+ "typebox": "1.3.34",
46
+ "yaml": "2.9.1"
46
47
  },
47
48
  "devDependencies": {
48
- "@agntn/ox": "^0.1.0",
49
- "@earendil-works/pi-coding-agent": "0.84.3",
50
- "@earendil-works/pi-tui": "0.84.3",
51
- "@oh-my-pi/omptype": "18.0.4",
52
- "@oh-my-pi/pi-ai": "18.0.4",
53
- "@oh-my-pi/pi-coding-agent": "18.0.4",
49
+ "@agntn/ox": "0.1.0",
50
+ "@earendil-works/pi-coding-agent": "0.85.1",
51
+ "@earendil-works/pi-tui": "0.85.1",
52
+ "@oh-my-pi/omptype": "18.2.5",
53
+ "@oh-my-pi/pi-ai": "18.2.5",
54
+ "@oh-my-pi/pi-coding-agent": "18.2.5",
54
55
  "@types/node": "latest",
55
56
  "@typescript/native-preview": "latest",
56
- "changelogen": "^0.6.2",
57
- "obuild": "^0.4.38",
58
- "oxfmt": "^0.65.0",
59
- "oxlint": "^1.80.0",
60
- "oxlint-tsgolint": "^7.0.2001",
61
- "vitest": "^4.1.11"
57
+ "changelogen": "0.6.2",
58
+ "obuild": "0.4.40",
59
+ "oxfmt": "0.68.0",
60
+ "oxlint": "1.83.0",
61
+ "oxlint-tsgolint": "7.0.2002",
62
+ "typescript": "6.0.3",
63
+ "vitest": "5.0.1"
62
64
  },
63
65
  "peerDependencies": {
64
66
  "@earendil-works/pi-coding-agent": ">=0.84.2 <1",
@@ -77,7 +79,7 @@
77
79
  }
78
80
  },
79
81
  "engines": {
80
- "node": ">=22"
82
+ "node": ">=24"
81
83
  },
82
84
  "omp": {
83
85
  "extensions": [
@@ -87,7 +89,8 @@
87
89
  "pi": {
88
90
  "extensions": [
89
91
  "./packages/pi/extensions/harnesses.ts"
90
- ]
92
+ ],
93
+ "image": "https://harnesses.agntn.dev/image.png"
91
94
  },
92
95
  "scripts": {
93
96
  "build": "obuild",
@@ -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, 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, and resolved paths",
86
86
  parameters: schemas.info,
87
87
  approval: HARNESS_TOOL_APPROVALS.harnesses_info,
88
88
  async execute(
@@ -239,6 +239,24 @@ export default function harnessesExtension(pi: ExtensionAPI): void {
239
239
  ...statusRenderers("harnesses_agents_sync"),
240
240
  });
241
241
 
242
+ pi.registerTool({
243
+ name: "harnesses_prompts_sync",
244
+ label: HARNESS_TOOL_LABELS.harnesses_prompts_sync,
245
+ description:
246
+ "Sync canonical Markdown prompt templates from the agntn XDG data directory into supported harnesses; Gemini receives generated TOML. Diverged files are backed up. Pass check to only report",
247
+ parameters: schemas.promptsSync,
248
+ approval: HARNESS_TOOL_APPROVALS.harnesses_prompts_sync,
249
+ async execute(
250
+ _toolCallId,
251
+ params: Readonly<HarnessSchemas.PromptsSyncParams>,
252
+ ): Promise<AgentToolResult<HarnessTools.PromptSyncReport | HarnessTools.RunFailure>> {
253
+ const { promptsSync } = await loadToolOperations();
254
+ const { content, details, isError } = promptsSync(params.id, params.check === true);
255
+ return { content, details, isError };
256
+ },
257
+ ...statusRenderers("harnesses_prompts_sync"),
258
+ });
259
+
242
260
  pi.registerTool({
243
261
  name: "harnesses_mcp_remove",
244
262
  label: HARNESS_TOOL_LABELS.harnesses_mcp_remove,
@@ -81,7 +81,9 @@ export default function harnessesExtension(pi: ExtensionAPI): void {
81
81
  label: HARNESS_TOOL_LABELS.harnesses_detect,
82
82
  description: "List every known AI coding harness with its install state and version",
83
83
  promptSnippet: "Use harnesses_detect to see which AI coding harnesses are installed.",
84
- promptGuidelines: ["The scan checks each harness's binaries on PATH and reads their versions."],
84
+ promptGuidelines: [
85
+ "The scan checks binaries on PATH. Versions come from native metadata or the CLI.",
86
+ ],
85
87
  parameters: schemas.detect,
86
88
  ...statusRenderers("harnesses_detect"),
87
89
  async execute(_toolCallId, _params): Promise<AgentToolResult<HarnessTools.HarnessListing>> {
@@ -95,7 +97,7 @@ export default function harnessesExtension(pi: ExtensionAPI): void {
95
97
  name: "harnesses_info",
96
98
  label: HARNESS_TOOL_LABELS.harnesses_info,
97
99
  description:
98
- "Full metadata for one or more AI coding harnesses, including supported invocation and model operations, configuration, sessions, instructions, skills, commands, 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, and resolved paths",
99
101
  promptSnippet: "Use harnesses_info to look up where coding harnesses store their data.",
100
102
  promptGuidelines: [
101
103
  "Pass one harness id from harnesses_detect, or batch several ids in one call.",
@@ -268,6 +270,28 @@ export default function harnessesExtension(pi: ExtensionAPI): void {
268
270
  },
269
271
  });
270
272
 
273
+ pi.registerTool({
274
+ name: "harnesses_prompts_sync",
275
+ label: HARNESS_TOOL_LABELS.harnesses_prompts_sync,
276
+ description:
277
+ "Sync canonical Markdown prompt templates from the agntn XDG data directory into supported harnesses; Gemini receives generated TOML. Diverged files are backed up. Pass check to only report",
278
+ parameters: schemas.promptsSync,
279
+ ...statusRenderers("harnesses_prompts_sync"),
280
+ async execute(
281
+ _toolCallId,
282
+ params: Readonly<HarnessSchemas.PromptsSyncParams>,
283
+ ): Promise<AgentToolResult<HarnessTools.PromptSyncReport | HarnessTools.RunFailure>> {
284
+ const { promptsSync } = await loadToolOperations();
285
+ const { content, details, isError } = promptsSync(params.id, params.check === true);
286
+ if (isError) {
287
+ throw new Error(
288
+ "error" in details ? details.error : (content[0]?.text ?? "Prompt sync failed"),
289
+ );
290
+ }
291
+ return { content, details };
292
+ },
293
+ });
294
+
271
295
  pi.registerTool({
272
296
  name: "harnesses_mcp_remove",
273
297
  label: HARNESS_TOOL_LABELS.harnesses_mcp_remove,
@@ -9,6 +9,7 @@ export const HARNESS_TOOL_LABELS = {
9
9
  harnesses_mcp_add: "Harnesses MCP Add",
10
10
  harnesses_mcp_sync: "Harnesses MCP Sync",
11
11
  harnesses_agents_sync: "Harnesses Agents Sync",
12
+ harnesses_prompts_sync: "Harnesses Prompts Sync",
12
13
  harnesses_mcp_remove: "Harnesses MCP Remove",
13
14
  } as const;
14
15
 
@@ -23,6 +24,7 @@ export const HARNESS_TOOL_APPROVALS: Record<HarnessToolName, "read" | "exec" | "
23
24
  harnesses_mcp_add: "write",
24
25
  harnesses_mcp_sync: "write",
25
26
  harnesses_agents_sync: "write",
27
+ harnesses_prompts_sync: "write",
26
28
  harnesses_mcp_remove: "write",
27
29
  };
28
30
 
@@ -93,8 +95,16 @@ function listLength(record: Readonly<Record<string, unknown>>, key: string): num
93
95
 
94
96
  function resultText(result: RenderedToolResult): string {
95
97
  const parts: string[] = [];
98
+ let length = 0;
96
99
  for (const part of result.content ?? []) {
97
- if (isRecord(part) && typeof part.text === "string") parts.push(part.text);
100
+ if (!isRecord(part) || typeof part.text !== "string") continue;
101
+ const separator = parts.length === 0 ? 0 : 1;
102
+ const remaining = RESULT_BODY_LIMIT + 1 - length - separator;
103
+ if (remaining < 0) break;
104
+ const text = part.text.slice(0, remaining);
105
+ parts.push(text);
106
+ length += separator + text.length;
107
+ if (length > RESULT_BODY_LIMIT) break;
98
108
  }
99
109
  return parts.join("\n");
100
110
  }
@@ -150,6 +160,7 @@ const CALL_DESCRIPTIONS: Record<HarnessToolName, CallDescriptionRenderer> = {
150
160
  harnesses_mcp_add: mutationDescription,
151
161
  harnesses_mcp_sync: idDescription,
152
162
  harnesses_agents_sync: agentsDescription,
163
+ harnesses_prompts_sync: agentsDescription,
153
164
  harnesses_mcp_remove: mutationDescription,
154
165
  };
155
166
 
@@ -267,6 +278,15 @@ function agentsSyncMeta(details: ResultDetails): string[] {
267
278
  return [`${changed} targets`];
268
279
  }
269
280
 
281
+ function promptsSyncMeta(details: ResultDetails): string[] {
282
+ const templates = listLength(details, "templates");
283
+ const targets = listLength(details, "targets");
284
+ return compactStrings([
285
+ templates === undefined ? undefined : `${templates} templates`,
286
+ targets === undefined ? undefined : `${targets} harnesses`,
287
+ ]);
288
+ }
289
+
270
290
  const RESULT_META: Record<HarnessToolName, ResultMetaRenderer> = {
271
291
  harnesses_detect: detectMeta,
272
292
  harnesses_info: infoMeta,
@@ -276,6 +296,7 @@ const RESULT_META: Record<HarnessToolName, ResultMetaRenderer> = {
276
296
  harnesses_mcp_add: mutationMeta,
277
297
  harnesses_mcp_sync: mcpSyncMeta,
278
298
  harnesses_agents_sync: agentsSyncMeta,
299
+ harnesses_prompts_sync: promptsSyncMeta,
279
300
  harnesses_mcp_remove: mutationMeta,
280
301
  };
281
302
 
@@ -1 +0,0 @@
1
- {"version":3,"file":"agents-sync.d.mts","names":[],"sources":["../../src/types.ts","../../src/harness.ts","../../src/mcp-servers.ts","../../src/agents-sync.ts"],"mappings":"AAEA,cAAa;KAED;KAcA;KACA;UAEK;EACf;EACA;EACA,OAAO;EACP,YAAY;EACZ;;UAGe;EACf;EACA,OAAO;EACP;;UAGe;EACf;EACA;;EAEA;;EAEA;EACA;EACA;;;UAIe;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA,OAAO;EACP;;;UAIe;EACf;EACA;EACA;EACA;EACA;EACA;;;UAIe;;EAEf;;EAEA;EACA,OAAO;EACP;;;UAIe;EACf;EACA;EACA;EACA;EACA;EACA;;;UAIe;EACf;EACA;EACA,MAAM;;EAEN;;EAEA,SAAS;;UAGM;EACf;EACA,MAAM;;EAEN;;EAEA;;EAEA;;EAEA;;EAEA,SAAS;;EAET;;UAGe;EACf;EACA;EACA;EACA;;EAEA;EACA;;EAEA;;;UAIe,yBAAyB;;EAExC,QAAQ;;;UAIO;EACf;EACA;EACA;EACA;;;;;;EAMA,MAAM;EACN;EACA,UAAU;;EAEV;;;UAIe,sBAAsB;EACrC;;EAEA;;;;;EAKA;;UAGe;;EAEf;;EAEA;;UAGe;EACf;EACA;EACA,WAAW;;UAGI;EACf,QAAQ;EACR,UAAU;EACV,cAAc;EACd,QAAQ;EACR,UAAU;EACV,OAAO;;KC5JJ,oBAAoB;EACvB;EACA;EACA;EACA;;uBA2OoB;oBACF,IAAI;oBACJ;oBACA;oBACA,QAAQ;oBACR,UAAU;oBACV,aAAa;oBACb,cAAc;oBACd,QAAQ;oBACR,UAAU;oBACV,OAAO;oBACP,cAAc;oBACd,WAAW;;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