@agntn/harnesses 0.1.0 → 0.2.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.
@@ -1,7 +1,7 @@
1
1
  import { AgentsSyncReport, AvailableModel, HarnessCapabilities, HarnessDetection, HarnessId, HarnessInvocationModes, McpConfigListing, McpServerConfig, PathCandidate, ResolvedPaths, StorageDescriptor, SyncReport } from "./_chunks/agents-sync.mjs";
2
2
  import { HARNESS_INFO_MAX_ITEMS } from "./_chunks/tool-schemas.mjs";
3
3
  /** Text for the model plus details for the harness, shared by every tool surface. */
4
- interface ToolResult<Details> {
4
+ export interface ToolResult<Details> {
5
5
  content: Array<{
6
6
  type: "text";
7
7
  text: string;
@@ -11,18 +11,18 @@ interface ToolResult<Details> {
11
11
  isError?: boolean;
12
12
  }
13
13
  /** Install state of one harness on this machine. */
14
- interface HarnessStatus {
14
+ export interface HarnessStatus {
15
15
  id: HarnessId;
16
16
  name: string;
17
17
  installed: boolean;
18
18
  version: string | null;
19
19
  }
20
20
  /** Every registered harness with its install state, as scanned by {@link detectHarnesses}. */
21
- interface HarnessListing {
21
+ export interface HarnessListing {
22
22
  harnesses: HarnessStatus[];
23
23
  }
24
24
  /** Full metadata for one harness, including paths resolved for this platform. */
25
- interface HarnessMetadata {
25
+ export interface HarnessMetadata {
26
26
  id: HarnessId;
27
27
  name: string;
28
28
  binaries: string[];
@@ -41,35 +41,35 @@ interface HarnessMetadata {
41
41
  resolved: ResolvedPaths;
42
42
  }
43
43
  /** Returned when the requested harness id is not registered. */
44
- interface UnknownHarness {
44
+ export interface UnknownHarness {
45
45
  error: string;
46
46
  known: HarnessId[];
47
47
  }
48
48
  /** Returned when a direct batch call bypasses the tool schema limits. */
49
- interface HarnessInfoInputError {
49
+ export interface HarnessInfoInputError {
50
50
  error: string;
51
51
  }
52
52
  /** One harness lookup result. */
53
- type HarnessInfoResult = HarnessMetadata | UnknownHarness;
53
+ export type HarnessInfoResult = HarnessMetadata | UnknownHarness;
54
54
  /** Scalar, batch, or rejected batch details from {@link harnessInfo}. */
55
- type HarnessInfoDetails = HarnessInfoResult | HarnessInfoResult[] | HarnessInfoInputError;
55
+ export type HarnessInfoDetails = HarnessInfoResult | HarnessInfoResult[] | HarnessInfoInputError;
56
56
  /** Default wall-clock budget for one harness run, in seconds. */
57
- declare const RUN_DEFAULT_TIMEOUT_SECONDS = 600;
57
+ export declare const RUN_DEFAULT_TIMEOUT_SECONDS = 600;
58
58
  /** The run tool's per-stream cap: harness output is unbounded, model context is not. */
59
- declare const RUN_MAX_OUTPUT_CHARS = 8000;
59
+ export declare const RUN_MAX_OUTPUT_CHARS = 8000;
60
60
  /**
61
61
  * Scans every registered harness for its binaries and version.
62
62
  *
63
63
  * @returns {ToolResult<HarnessListing>} The complete installation listing.
64
64
  */
65
- declare function detectHarnesses(): ToolResult<HarnessListing>;
65
+ export declare function detectHarnesses(): ToolResult<HarnessListing>;
66
66
  /** Full metadata for one harness, with paths resolved for the current platform. */
67
- declare function harnessInfo(id: string): ToolResult<HarnessInfoResult>;
67
+ export declare function harnessInfo(id: string): ToolResult<HarnessInfoResult>;
68
68
  /** Full metadata for several harnesses, preserving input order and errors for each item. */
69
- declare function harnessInfo(ids: readonly string[]): ToolResult<HarnessInfoResult[] | HarnessInfoInputError>;
70
- declare function harnessInfo(input: string | readonly string[]): ToolResult<HarnessInfoDetails>;
69
+ export declare function harnessInfo(ids: readonly string[]): ToolResult<HarnessInfoResult[] | HarnessInfoInputError>;
70
+ export declare function harnessInfo(input: string | readonly string[]): ToolResult<HarnessInfoDetails>;
71
71
  /** Options accepted by {@link listHarnessModels}. */
72
- interface ModelsOptions {
72
+ export interface ModelsOptions {
73
73
  search?: string;
74
74
  cwd?: string;
75
75
  /** Wall-clock budget in seconds; defaults to {@link RUN_DEFAULT_TIMEOUT_SECONDS}. */
@@ -78,7 +78,7 @@ interface ModelsOptions {
78
78
  signal?: AbortSignal;
79
79
  }
80
80
  /** One completed native model-listing query. */
81
- interface ModelsOutcome {
81
+ export interface ModelsOutcome {
82
82
  id: HarnessId;
83
83
  command: string;
84
84
  args: string[];
@@ -96,9 +96,9 @@ interface ModelsOutcome {
96
96
  * @param options - Search, working-directory, and timeout options.
97
97
  * @returns {Promise<ToolResult<ModelsOutcome | RunFailure>>} The model listing or failure.
98
98
  */
99
- declare function listHarnessModels(id: string, options?: ModelsOptions): Promise<ToolResult<ModelsOutcome | RunFailure>>;
99
+ export declare function listHarnessModels(id: string, options?: ModelsOptions): Promise<ToolResult<ModelsOutcome | RunFailure>>;
100
100
  /** Options accepted by {@link runHarness}. */
101
- interface RunOptions {
101
+ export interface RunOptions {
102
102
  cwd?: string;
103
103
  /** Harness-native model id or selector. */
104
104
  model?: string;
@@ -114,9 +114,10 @@ interface RunOptions {
114
114
  readOnly?: boolean;
115
115
  }
116
116
  /** One completed (or failed) harness run, with output capped for the model. */
117
- interface RunOutcome {
117
+ export interface RunOutcome {
118
118
  id: HarnessId;
119
119
  command: string;
120
+ /** Expanded arguments; the model's text keeps "{prompt}" instead, it wrote the prompt itself. */
120
121
  args: string[];
121
122
  model?: string;
122
123
  structured: boolean;
@@ -129,7 +130,7 @@ interface RunOutcome {
129
130
  stderr: string;
130
131
  }
131
132
  /** Returned when the harness cannot be run at all. */
132
- interface RunFailure {
133
+ export interface RunFailure {
133
134
  error: string;
134
135
  known?: HarnessId[];
135
136
  /** Modes accepted by the selected harness when invocation mode caused the failure. */
@@ -148,30 +149,30 @@ interface RunFailure {
148
149
  * Tool use defaults to a native advisor without tools invocation. Harnesses that
149
150
  * cannot disable tools reject that mode; setting `tools` selects their full
150
151
  * agent invocation. `model` is translated through the harness-specific recipe.
151
- * This layer also closes stdin, enforces the timeout, and
152
- * caps the echoed output.
152
+ * This layer also closes stdin, enforces the timeout, caps the echoed output,
153
+ * and leaves the prompt out of the echoed invocation.
153
154
  *
154
155
  * @param id - Harness id to run.
155
156
  * @param prompt - Prompt sent to the selected harness.
156
157
  * @param options - Model, mode, working-directory, and timeout options.
157
158
  * @returns {Promise<ToolResult<RunOutcome | RunFailure>>} The capped run outcome or failure.
158
159
  */
159
- declare function runHarness(id: string, prompt: string, options?: RunOptions): Promise<ToolResult<RunOutcome | RunFailure>>;
160
+ export declare function runHarness(id: string, prompt: string, options?: RunOptions): Promise<ToolResult<RunOutcome | RunFailure>>;
160
161
  /** MCP server listings for one harness or all of them. */
161
- interface McpListing {
162
+ export interface McpListing {
162
163
  harnesses: Array<{
163
164
  id: HarnessId;
164
165
  configs: McpConfigListing[];
165
166
  }>;
166
167
  }
167
168
  /** Result of one MCP config mutation. */
168
- interface McpMutation {
169
+ export interface McpMutation {
169
170
  id: HarnessId;
170
171
  path: string;
171
172
  action: "added" | "replaced" | "removed" | "noop";
172
173
  }
173
174
  /** Flat tool parameters describing one MCP server, shared by every surface. */
174
- interface McpServerParams {
175
+ export interface McpServerParams {
175
176
  name: string;
176
177
  transport?: McpServerConfig["transport"];
177
178
  command?: string;
@@ -186,14 +187,14 @@ interface McpServerParams {
186
187
  * @param params - Flat MCP server parameters.
187
188
  * @returns {McpServerConfig} The normalized server configuration.
188
189
  */
189
- declare function toMcpServerConfig(params: McpServerParams): McpServerConfig;
190
+ export declare function toMcpServerConfig(params: McpServerParams): McpServerConfig;
190
191
  /**
191
192
  * Lists configured MCP servers, normalized across harness config dialects.
192
193
  *
193
194
  * @param id - Optional harness id; omission lists every harness.
194
195
  * @returns {ToolResult<McpListing | UnknownHarness>} The normalized listing or id error.
195
196
  */
196
- declare function mcpList(id?: string): ToolResult<McpListing | UnknownHarness>;
197
+ export declare function mcpList(id?: string): ToolResult<McpListing | UnknownHarness>;
197
198
  /**
198
199
  * Adds or replaces one MCP server in a harness's config.
199
200
  *
@@ -202,7 +203,7 @@ declare function mcpList(id?: string): ToolResult<McpListing | UnknownHarness>;
202
203
  * @param scope - User or project config scope.
203
204
  * @returns {ToolResult<McpMutation | RunFailure>} The mutation outcome or failure.
204
205
  */
205
- declare function mcpAdd(id: string, params: McpServerParams, scope?: "user" | "project"): ToolResult<McpMutation | RunFailure>;
206
+ export declare function mcpAdd(id: string, params: McpServerParams, scope?: "user" | "project"): ToolResult<McpMutation | RunFailure>;
206
207
  /**
207
208
  * Removes one MCP server from a harness's config.
208
209
  *
@@ -211,14 +212,14 @@ declare function mcpAdd(id: string, params: McpServerParams, scope?: "user" | "p
211
212
  * @param scope - User or project config scope.
212
213
  * @returns {ToolResult<McpMutation | RunFailure>} The mutation outcome or failure.
213
214
  */
214
- declare function mcpRemove(id: string, name: string, scope?: "user" | "project"): ToolResult<McpMutation | RunFailure>;
215
+ export declare function mcpRemove(id: string, name: string, scope?: "user" | "project"): ToolResult<McpMutation | RunFailure>;
215
216
  /**
216
217
  * Pushes the master MCP list from ~/.config/agntn/mcp.jsonc into harness configs.
217
218
  *
218
219
  * @param id - Optional harness id; omission targets every harness.
219
220
  * @returns {ToolResult<SyncReport | RunFailure>} The sync report or failure.
220
221
  */
221
- declare function mcpSync(id?: string): ToolResult<SyncReport | RunFailure>;
222
+ export declare function mcpSync(id?: string): ToolResult<SyncReport | RunFailure>;
222
223
  /**
223
224
  * Links every harness's global instructions file to the master AGENTS.md.
224
225
  *
@@ -226,6 +227,6 @@ declare function mcpSync(id?: string): ToolResult<SyncReport | RunFailure>;
226
227
  * @param check - Report intended changes without writing them.
227
228
  * @returns {ToolResult<AgentsSyncReport | RunFailure>} The sync report or failure.
228
229
  */
229
- declare function agentsSync(id?: string, check?: boolean): ToolResult<AgentsSyncReport | RunFailure>;
230
- export { type AgentsSyncReport, HARNESS_INFO_MAX_ITEMS, HarnessInfoDetails, HarnessInfoInputError, HarnessInfoResult, type HarnessInvocationModes, HarnessListing, HarnessMetadata, HarnessStatus, McpListing, McpMutation, McpServerParams, ModelsOptions, ModelsOutcome, RUN_DEFAULT_TIMEOUT_SECONDS, RUN_MAX_OUTPUT_CHARS, RunFailure, RunOptions, RunOutcome, type SyncReport, ToolResult, UnknownHarness, agentsSync, detectHarnesses, harnessInfo, listHarnessModels, mcpAdd, mcpList, mcpRemove, mcpSync, runHarness, toMcpServerConfig };
230
+ export declare function agentsSync(id?: string, check?: boolean): ToolResult<AgentsSyncReport | RunFailure>;
231
+ export { type AgentsSyncReport, HARNESS_INFO_MAX_ITEMS, type HarnessInvocationModes, type SyncReport };
231
232
  //# sourceMappingURL=tool-operations.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tool-operations.d.mts","names":[],"sources":["../src/tool-operations.ts"],"mappings":";;;UAsCiB,WAAW;EAC1B,SAAS;IAAQ;IAAc;;EAC/B,SAAS;;EAET;;;UAIe;EACf,IAAI;EACJ;EACA;EACA;;;UAIe;EACf,WAAW;;;UAII;EACf,IAAI;EACJ;EACA;EACA,cAAc;EACd,iBAAiB;EACjB;EACA;EACA,QAAQ;EACR,UAAU;EACV,cAAc;EACd,QAAQ;EACR,UAAU;EACV,OAAO;EACP,aAAa;EACb,WAAW;EACX,UAAU;;;UAIK;EACf;EACA,OAAO;;;UAIQ;EACf;;;KAIU,oBAAoB,kBAAkB;;KAGtC,qBAAqB,oBAAoB,sBAAsB;;cAM9D;;cAGA;;;;;;iBAgIG,mBAAmB,WAAW;;iBAyC9B,YAAY,aAAa,WAAW;;iBAEpC,YACd,yBACC,WAAW,sBAAsB;iBACpB,YAAY,oCAAoC,WAAW;;UAuB1D;EACf;EACA;;EAEA;;EAEA,SAAS;;;UAIM;EACf,IAAI;EACJ;EACA;EACA;EACA,QAAQ;EACR;EACA;EACA;EACA;;;;;;;;;iBAUoB,kBACpB,YACA,UAAS,gBACR,QAAQ,WAAW,gBAAgB;;UA4CrB;EACf;;EAEA;;EAEA;;EAEA,SAAS;;EAET;;EAEA;;EAEA;;;UAIe;EACf,IAAI;EACJ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;UAIe;EACf;EACA,QAAQ;;EAER,kBAAkB;;EAElB;IAAU;IAAmB;;IAAsB;;;;;;;;;;;;;;;;;iBAyB/B,WACpB,YACA,gBACA,UAAS,aACR,QAAQ,WAAW,aAAa;;UAiClB;EACf,WAAW;IAAQ,IAAI;IAAW,SAAS;;;;UAY5B;EACf,IAAI;EACJ;EACA;;;UAIe;EACf;EACA,YAAY;EACZ;EACA;EACA,MAAM;EACN;EACA,UAAU;;;;;;;;iBASI,kBAAkB,QAAQ,kBAAkB;;;;;;;iBAmB5C,QAAQ,cAAc,WAAW,aAAa;;;;;;;;;iBAgD9C,OACd,YACA,QAAQ,iBACR,6BACC,WAAW,cAAc;;;;;;;;;iBAeZ,UACd,YACA,cACA,6BACC,WAAW,cAAc;;;;;;;iBAaZ,QAAQ,cAAc,WAAW,aAAa;;;;;;;;iBA+B9C,WAAW,aAAa,kBAAgB,WAAW,mBAAmB"}
1
+ {"version":3,"file":"tool-operations.d.mts","names":[],"sources":["../src/tool-operations.ts"],"mappings":";;;iBAsCiB,WAAW;EAC1B,SAAS;IAAQ;IAAc;;EAC/B,SAAS;;EAET;;;iBAIe;EACf,IAAI;EACJ;EACA;EACA;;;iBAIe;EACf,WAAW;;;iBAII;EACf,IAAI;EACJ;EACA;EACA,cAAc;EACd,iBAAiB;EACjB;EACA;EACA,QAAQ;EACR,UAAU;EACV,cAAc;EACd,QAAQ;EACR,UAAU;EACV,OAAO;EACP,aAAa;EACb,WAAW;EACX,UAAU;;;iBAIK;EACf;EACA,OAAO;;;iBAIQ;EACf;;;YAIU,oBAAoB,kBAAkB;;YAGtC,qBAAqB,oBAAoB,sBAAsB;;qBAM9D;;qBAGA;;;;;;wBAqIG,mBAAmB,WAAW;;wBAiF9B,YAAY,aAAa,WAAW;;wBAEpC,YACd,yBACC,WAAW,sBAAsB;wBACpB,YAAY,oCAAoC,WAAW;;iBA2B1D;EACf;EACA;;EAEA;;EAEA,SAAS;;;iBAIM;EACf,IAAI;EACJ;EACA;EACA;EACA,QAAQ;EACR;EACA;EACA;EACA;;;;;;;;;wBAUoB,kBACpB,YACA,UAAS,gBACR,QAAQ,WAAW,gBAAgB;;iBA4CrB;EACf;;EAEA;;EAEA;;EAEA,SAAS;;EAET;;EAEA;;EAEA;;;iBAIe;EACf,IAAI;EACJ;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;iBAIe;EACf;EACA,QAAQ;;EAER,kBAAkB;;EAElB;IAAU;IAAmB;;IAAsB;;;;;;;;;;;;;;;;;wBAyB/B,WACpB,YACA,gBACA,UAAS,aACR,QAAQ,WAAW,aAAa;;iBAkClB;EACf,WAAW;IAAQ,IAAI;IAAW,SAAS;;;;iBAY5B;EACf,IAAI;EACJ;EACA;;;iBAIe;EACf;EACA,YAAY;EACZ;EACA;EACA,MAAM;EACN;EACA,UAAU;;;;;;;;wBASI,kBAAkB,QAAQ,kBAAkB;;;;;;;wBAmB5C,QAAQ,cAAc,WAAW,aAAa;;;;;;;;;wBAgD9C,OACd,YACA,QAAQ,iBACR,6BACC,WAAW,cAAc;;;;;;;;;wBAeZ,UACd,YACA,cACA,6BACC,WAAW,cAAc;;;;;;;wBAaZ,QAAQ,cAAc,WAAW,aAAa;;;;;;;;wBA+B9C,WAAW,aAAa,kBAAgB,WAAW,mBAAmB"}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@agntn/harnesses",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
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)",
@@ -36,41 +36,30 @@
36
36
  "publishConfig": {
37
37
  "access": "public"
38
38
  },
39
- "scripts": {
40
- "build": "obuild",
41
- "dev": "obuild --stub",
42
- "docs": "pnpm --dir docs dev",
43
- "lint": "pnpm build && oxlint . && oxfmt --check .",
44
- "lint:fix": "pnpm build && oxlint . --fix && oxfmt . && pnpm build",
45
- "typecheck": "tsgo --noEmit --skipLibCheck && pnpm build && tsgo --noEmit --skipLibCheck -p tsconfig.extensions.json",
46
- "test": "vitest",
47
- "test:run": "vitest --run",
48
- "prepack": "pnpm run build",
49
- "release": "pnpm test:run && pnpm build && changelogen --release --push"
50
- },
51
39
  "dependencies": {
52
40
  "@modelcontextprotocol/sdk": "1.30.0",
53
41
  "@toon-format/toon": "^4.1.1",
54
42
  "citty": "^0.2.2",
55
43
  "consola": "^3.4.2",
56
44
  "smol-toml": "^1.8.0",
57
- "typebox": "^1.3.19"
45
+ "typebox": "^1.3.33"
58
46
  },
59
47
  "devDependencies": {
60
48
  "@agntn/ox": "^0.1.0",
61
- "@earendil-works/pi-coding-agent": "0.84.3",
62
- "@earendil-works/pi-tui": "0.84.3",
63
- "@oh-my-pi/omptype": "18.0.4",
64
- "@oh-my-pi/pi-ai": "18.0.4",
65
- "@oh-my-pi/pi-coding-agent": "18.0.4",
49
+ "@earendil-works/pi-coding-agent": "0.85.1",
50
+ "@earendil-works/pi-tui": "0.85.1",
51
+ "@oh-my-pi/omptype": "18.2.5",
52
+ "@oh-my-pi/pi-ai": "18.2.5",
53
+ "@oh-my-pi/pi-coding-agent": "18.2.5",
66
54
  "@types/node": "latest",
67
55
  "@typescript/native-preview": "latest",
68
56
  "changelogen": "^0.6.2",
69
- "obuild": "^0.4.38",
70
- "oxfmt": "^0.65.0",
71
- "oxlint": "^1.80.0",
72
- "oxlint-tsgolint": "^7.0.2001",
73
- "vitest": "^4.1.11"
57
+ "obuild": "^0.4.40",
58
+ "oxfmt": "^0.68.0",
59
+ "oxlint": "^1.83.0",
60
+ "oxlint-tsgolint": "^7.0.2002",
61
+ "typescript": "6.0.3",
62
+ "vitest": "^5.0.1"
74
63
  },
75
64
  "peerDependencies": {
76
65
  "@earendil-works/pi-coding-agent": ">=0.84.2 <1",
@@ -89,9 +78,8 @@
89
78
  }
90
79
  },
91
80
  "engines": {
92
- "node": ">=22"
81
+ "node": ">=24"
93
82
  },
94
- "packageManager": "pnpm@11.24.0",
95
83
  "omp": {
96
84
  "extensions": [
97
85
  "./packages/omp/extensions/harnesses.ts"
@@ -101,5 +89,16 @@
101
89
  "extensions": [
102
90
  "./packages/pi/extensions/harnesses.ts"
103
91
  ]
92
+ },
93
+ "scripts": {
94
+ "build": "obuild",
95
+ "dev": "obuild --stub",
96
+ "docs": "pnpm --dir docs dev",
97
+ "lint": "pnpm build && oxlint . && oxfmt --check .",
98
+ "lint:fix": "pnpm build && oxlint . --fix && oxfmt . && pnpm build",
99
+ "typecheck": "tsgo --noEmit --skipLibCheck && pnpm build && tsgo --noEmit --skipLibCheck -p tsconfig.extensions.json",
100
+ "test": "vitest",
101
+ "test:run": "vitest --run",
102
+ "release": "pnpm test:run && pnpm build && changelogen --release --push"
104
103
  }
105
- }
104
+ }
@@ -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>> {