@agntn/harnesses 0.0.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/LICENSE +21 -0
- package/README.md +142 -0
- package/dist/THIRD-PARTY-LICENSES.md +36 -0
- package/dist/_chunks/agents-sync.d.mts +417 -0
- package/dist/_chunks/agents-sync.d.mts.map +1 -0
- package/dist/_chunks/agents-sync.mjs +2719 -0
- package/dist/_chunks/agents-sync.mjs.map +1 -0
- package/dist/_chunks/agents.mjs +62 -0
- package/dist/_chunks/agents.mjs.map +1 -0
- package/dist/_chunks/libs/typebox.mjs +5512 -0
- package/dist/_chunks/libs/typebox.mjs.map +1 -0
- package/dist/_chunks/mcp-servers.mjs +149 -0
- package/dist/_chunks/mcp-servers.mjs.map +1 -0
- package/dist/_chunks/mcp.mjs +164 -0
- package/dist/_chunks/mcp.mjs.map +1 -0
- package/dist/_chunks/mcp2.mjs +17 -0
- package/dist/_chunks/mcp2.mjs.map +1 -0
- package/dist/_chunks/tool-operations.mjs +361 -0
- package/dist/_chunks/tool-operations.mjs.map +1 -0
- package/dist/_chunks/tool-schemas.d.mts +94 -0
- package/dist/_chunks/tool-schemas.d.mts.map +1 -0
- package/dist/_chunks/tool-schemas.mjs +112 -0
- package/dist/_chunks/tool-schemas.mjs.map +1 -0
- package/dist/_chunks/types.mjs +4 -0
- package/dist/_chunks/types.mjs.map +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +350 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/index.d.mts +300 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +6 -0
- package/dist/index.mjs.map +1 -0
- package/dist/mcp.d.mts +15 -0
- package/dist/mcp.d.mts.map +1 -0
- package/dist/mcp.mjs +2 -0
- package/dist/tool-operations.d.mts +222 -0
- package/dist/tool-operations.d.mts.map +1 -0
- package/dist/tool-operations.mjs +3 -0
- package/dist/tool-schemas.d.mts +2 -0
- package/dist/tool-schemas.mjs +2 -0
- package/package.json +102 -0
- package/packages/omp/extensions/AGENTS.md +7 -0
- package/packages/omp/extensions/harnesses.ts +253 -0
- package/packages/pi/extensions/AGENTS.md +7 -0
- package/packages/pi/extensions/harnesses.ts +265 -0
- package/packages/shared/AGENTS.md +7 -0
- package/packages/shared/tui.ts +346 -0
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
import { addMcpServer, getAllHarnesses, getHarness, isHarnessId, listHarnesses, listMcpServers, readAgentsConfig, readMasterMcpServers, removeMcpServer, syncAgentsFiles, syncMcpServers } from "./agents-sync.mjs";
|
|
2
|
+
import "./tool-schemas.mjs";
|
|
3
|
+
import { encode } from "@toon-format/toon";
|
|
4
|
+
const RUN_DEFAULT_TIMEOUT_SECONDS = 600;
|
|
5
|
+
const RUN_MAX_OUTPUT_CHARS = 8e3;
|
|
6
|
+
function text(data) {
|
|
7
|
+
return [{
|
|
8
|
+
type: "text",
|
|
9
|
+
text: encode(data)
|
|
10
|
+
}];
|
|
11
|
+
}
|
|
12
|
+
function unknownHarness(id) {
|
|
13
|
+
const details = {
|
|
14
|
+
error: `Unknown harness: ${id}`,
|
|
15
|
+
known: listHarnesses()
|
|
16
|
+
};
|
|
17
|
+
return {
|
|
18
|
+
content: text(details),
|
|
19
|
+
details,
|
|
20
|
+
isError: true
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function errorMessage(error) {
|
|
24
|
+
return error instanceof Error ? error.message : String(error);
|
|
25
|
+
}
|
|
26
|
+
function truncate(output) {
|
|
27
|
+
if (output.length <= 8e3) return output;
|
|
28
|
+
return `${output.slice(0, RUN_MAX_OUTPUT_CHARS)}\n[truncated ${output.length - RUN_MAX_OUTPUT_CHARS} of ${output.length} characters]`;
|
|
29
|
+
}
|
|
30
|
+
function modelListingUnavailable(harness, id) {
|
|
31
|
+
return { error: harness.modelListing ? `Harness ${id} does not support filtering its model listing` : `Harness ${id} does not support model listing` };
|
|
32
|
+
}
|
|
33
|
+
const ALTERNATE_INVOCATION_MODE = {
|
|
34
|
+
advisor: "agent",
|
|
35
|
+
advisorStructured: "agentStructured",
|
|
36
|
+
agent: "advisor",
|
|
37
|
+
agentStructured: "advisorStructured"
|
|
38
|
+
};
|
|
39
|
+
function selectedInvocationMode(structured, tools, readOnly) {
|
|
40
|
+
if (readOnly) return structured ? "readOnlyStructured" : "readOnly";
|
|
41
|
+
if (tools) return structured ? "agentStructured" : "agent";
|
|
42
|
+
return structured ? "advisorStructured" : "advisor";
|
|
43
|
+
}
|
|
44
|
+
function completedRun(harness, result, options) {
|
|
45
|
+
const details = {
|
|
46
|
+
id: harness.id,
|
|
47
|
+
command: result.command,
|
|
48
|
+
args: result.args,
|
|
49
|
+
...options.model === void 0 ? {} : { model: options.model },
|
|
50
|
+
structured: options.structured,
|
|
51
|
+
tools: options.tools,
|
|
52
|
+
readOnly: options.readOnly,
|
|
53
|
+
exitCode: result.exitCode,
|
|
54
|
+
timedOut: result.timedOut,
|
|
55
|
+
stdout: truncate(result.stdout),
|
|
56
|
+
stderr: truncate(result.stderr)
|
|
57
|
+
};
|
|
58
|
+
if (result.timedOut || result.exitCode !== 0) return {
|
|
59
|
+
content: text(details),
|
|
60
|
+
details,
|
|
61
|
+
isError: true
|
|
62
|
+
};
|
|
63
|
+
return {
|
|
64
|
+
content: text(details),
|
|
65
|
+
details
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function unsupportedInvocation(harness, id, options) {
|
|
69
|
+
const error = harness.invocationError(options) ?? `Invalid ${id} invocation`;
|
|
70
|
+
const invocationModes = harness.invocationModes;
|
|
71
|
+
const mode = selectedInvocationMode(options.structured, options.tools, options.readOnly);
|
|
72
|
+
const modelUnsupported = options.model !== void 0 && harness.invocation?.modelArgs === void 0;
|
|
73
|
+
if (invocationModes[mode] || harness.invocation === null || modelUnsupported) {
|
|
74
|
+
const details = { error };
|
|
75
|
+
return {
|
|
76
|
+
content: text(details),
|
|
77
|
+
details,
|
|
78
|
+
isError: true
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
const alternateMode = ALTERNATE_INVOCATION_MODE[mode];
|
|
82
|
+
const details = {
|
|
83
|
+
error,
|
|
84
|
+
invocationModes,
|
|
85
|
+
...(alternateMode === void 0 ? false : invocationModes[alternateMode]) ? { retry: { tools: !options.tools } } : {}
|
|
86
|
+
};
|
|
87
|
+
return {
|
|
88
|
+
content: text(details),
|
|
89
|
+
details,
|
|
90
|
+
isError: true
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function detectHarnesses() {
|
|
94
|
+
const details = { harnesses: getAllHarnesses().map((harness) => {
|
|
95
|
+
const installed = harness.isInstalled();
|
|
96
|
+
return {
|
|
97
|
+
id: harness.id,
|
|
98
|
+
name: harness.name,
|
|
99
|
+
installed,
|
|
100
|
+
version: installed ? harness.version : null
|
|
101
|
+
};
|
|
102
|
+
}) };
|
|
103
|
+
return {
|
|
104
|
+
content: text(details),
|
|
105
|
+
details
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function harnessInfoResult(id) {
|
|
109
|
+
if (!isHarnessId(id)) return unknownHarness(id).details;
|
|
110
|
+
const harness = getHarness(id);
|
|
111
|
+
return {
|
|
112
|
+
id: harness.id,
|
|
113
|
+
name: harness.name,
|
|
114
|
+
binaries: harness.binaries,
|
|
115
|
+
capabilities: harness.capabilities,
|
|
116
|
+
invocationModes: harness.invocationModes,
|
|
117
|
+
modelListing: harness.modelListing !== null,
|
|
118
|
+
modelSelection: harness.invocation?.modelArgs !== void 0,
|
|
119
|
+
config: harness.config,
|
|
120
|
+
sessions: harness.sessions,
|
|
121
|
+
instructions: harness.instructions,
|
|
122
|
+
skills: harness.skills,
|
|
123
|
+
commands: harness.commands,
|
|
124
|
+
hooks: harness.hooks,
|
|
125
|
+
persistence: harness.persistence,
|
|
126
|
+
detection: harness.detection,
|
|
127
|
+
resolved: harness.resolve()
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function harnessInfo(input) {
|
|
131
|
+
if (typeof input === "string") {
|
|
132
|
+
const details = harnessInfoResult(input);
|
|
133
|
+
return {
|
|
134
|
+
content: text(details),
|
|
135
|
+
details,
|
|
136
|
+
..."error" in details ? { isError: true } : {}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
if (input.length < 1 || input.length > 20) {
|
|
140
|
+
const details = { error: `harnesses_info accepts between 1 and 20 ids` };
|
|
141
|
+
return {
|
|
142
|
+
content: text(details),
|
|
143
|
+
details,
|
|
144
|
+
isError: true
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
const details = input.map(harnessInfoResult);
|
|
148
|
+
return {
|
|
149
|
+
content: text(details),
|
|
150
|
+
details,
|
|
151
|
+
...details.some((result) => "error" in result) ? { isError: true } : {}
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
async function listHarnessModels(id, options = {}) {
|
|
155
|
+
if (!isHarnessId(id)) return unknownHarness(id);
|
|
156
|
+
const harness = getHarness(id);
|
|
157
|
+
if (!harness.buildModelListInvocation(options.search)) {
|
|
158
|
+
const details = modelListingUnavailable(harness, id);
|
|
159
|
+
return {
|
|
160
|
+
content: text(details),
|
|
161
|
+
details,
|
|
162
|
+
isError: true
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
const timeoutSeconds = options.timeoutSeconds ?? RUN_DEFAULT_TIMEOUT_SECONDS;
|
|
166
|
+
let result;
|
|
167
|
+
try {
|
|
168
|
+
result = await harness.listModels({
|
|
169
|
+
search: options.search,
|
|
170
|
+
cwd: options.cwd,
|
|
171
|
+
timeoutMs: timeoutSeconds * 1e3
|
|
172
|
+
});
|
|
173
|
+
} catch (error) {
|
|
174
|
+
const details = { error: `Failed to list ${id} models: ${errorMessage(error)}` };
|
|
175
|
+
return {
|
|
176
|
+
content: text(details),
|
|
177
|
+
details,
|
|
178
|
+
isError: true
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
const details = {
|
|
182
|
+
id: harness.id,
|
|
183
|
+
command: result.command,
|
|
184
|
+
args: result.args,
|
|
185
|
+
...options.search === void 0 ? {} : { search: options.search },
|
|
186
|
+
models: result.models,
|
|
187
|
+
exitCode: result.exitCode,
|
|
188
|
+
timedOut: result.timedOut,
|
|
189
|
+
stderr: truncate(result.stderr)
|
|
190
|
+
};
|
|
191
|
+
return {
|
|
192
|
+
content: text(details),
|
|
193
|
+
details,
|
|
194
|
+
...result.timedOut || result.exitCode !== 0 ? { isError: true } : {}
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
function normalizedRunAccess(options) {
|
|
198
|
+
const readOnly = options.readOnly ?? false;
|
|
199
|
+
return {
|
|
200
|
+
readOnly,
|
|
201
|
+
tools: readOnly ? true : options.tools ?? false
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
async function runHarness(id, prompt, options = {}) {
|
|
205
|
+
if (!isHarnessId(id)) return unknownHarness(id);
|
|
206
|
+
const harness = getHarness(id);
|
|
207
|
+
const structured = options.structured ?? false;
|
|
208
|
+
const { tools, readOnly } = normalizedRunAccess(options);
|
|
209
|
+
const invocationOptions = {
|
|
210
|
+
model: options.model,
|
|
211
|
+
structured,
|
|
212
|
+
tools,
|
|
213
|
+
readOnly
|
|
214
|
+
};
|
|
215
|
+
if (!harness.buildInvocation(prompt, invocationOptions)) return unsupportedInvocation(harness, id, invocationOptions);
|
|
216
|
+
const timeoutSeconds = options.timeoutSeconds ?? RUN_DEFAULT_TIMEOUT_SECONDS;
|
|
217
|
+
let result;
|
|
218
|
+
try {
|
|
219
|
+
result = await harness.invoke(prompt, {
|
|
220
|
+
cwd: options.cwd,
|
|
221
|
+
model: options.model,
|
|
222
|
+
timeoutMs: timeoutSeconds * 1e3,
|
|
223
|
+
structured,
|
|
224
|
+
tools,
|
|
225
|
+
readOnly
|
|
226
|
+
});
|
|
227
|
+
} catch (error) {
|
|
228
|
+
const details = { error: `Failed to run ${id}: ${errorMessage(error)}` };
|
|
229
|
+
return {
|
|
230
|
+
content: text(details),
|
|
231
|
+
details,
|
|
232
|
+
isError: true
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
return completedRun(harness, result, invocationOptions);
|
|
236
|
+
}
|
|
237
|
+
function toMcpServerConfig(params) {
|
|
238
|
+
const server = {
|
|
239
|
+
name: params.name,
|
|
240
|
+
transport: params.transport ?? (params.url ? "http" : "stdio")
|
|
241
|
+
};
|
|
242
|
+
if (params.command !== void 0) server.command = params.command;
|
|
243
|
+
if (params.args !== void 0) server.args = params.args;
|
|
244
|
+
if (params.env !== void 0) server.env = params.env;
|
|
245
|
+
if (params.url !== void 0) server.url = params.url;
|
|
246
|
+
if (params.headers !== void 0) server.headers = params.headers;
|
|
247
|
+
return server;
|
|
248
|
+
}
|
|
249
|
+
function mcpList(id) {
|
|
250
|
+
if (id !== void 0 && !isHarnessId(id)) return unknownHarness(id);
|
|
251
|
+
const details = { harnesses: (id !== void 0 && isHarnessId(id) ? [getHarness(id)] : getAllHarnesses()).map((harness) => ({
|
|
252
|
+
id: harness.id,
|
|
253
|
+
configs: listMcpServers(harness)
|
|
254
|
+
})).filter((entry) => entry.configs.length > 0) };
|
|
255
|
+
return {
|
|
256
|
+
content: text(details),
|
|
257
|
+
details
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
function mcpMutate(id, mutate) {
|
|
261
|
+
if (!isHarnessId(id)) return unknownHarness(id);
|
|
262
|
+
try {
|
|
263
|
+
const { path, action } = mutate(getHarness(id));
|
|
264
|
+
const details = {
|
|
265
|
+
id,
|
|
266
|
+
path,
|
|
267
|
+
action
|
|
268
|
+
};
|
|
269
|
+
return {
|
|
270
|
+
content: text(details),
|
|
271
|
+
details,
|
|
272
|
+
...action === "noop" ? { isError: true } : {}
|
|
273
|
+
};
|
|
274
|
+
} catch (error) {
|
|
275
|
+
const details = { error: errorMessage(error) };
|
|
276
|
+
return {
|
|
277
|
+
content: text(details),
|
|
278
|
+
details,
|
|
279
|
+
isError: true
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
function mcpAdd(id, params, scope = "user") {
|
|
284
|
+
return mcpMutate(id, (harness) => {
|
|
285
|
+
const { path, replaced } = addMcpServer(harness, toMcpServerConfig(params), scope);
|
|
286
|
+
return {
|
|
287
|
+
path,
|
|
288
|
+
action: replaced ? "replaced" : "added"
|
|
289
|
+
};
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
function mcpRemove(id, name, scope = "user") {
|
|
293
|
+
return mcpMutate(id, (harness) => {
|
|
294
|
+
const { path, removed } = removeMcpServer(harness, name, scope);
|
|
295
|
+
return {
|
|
296
|
+
path,
|
|
297
|
+
action: removed ? "removed" : "noop"
|
|
298
|
+
};
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
function mcpSync(id) {
|
|
302
|
+
if (id !== void 0 && !isHarnessId(id)) return unknownHarness(id);
|
|
303
|
+
try {
|
|
304
|
+
const unknown = readMasterMcpServers().excludes.filter((entry) => !isHarnessId(entry));
|
|
305
|
+
if (unknown.length > 0) {
|
|
306
|
+
const details = {
|
|
307
|
+
error: `Master MCP list excludes unknown harnesses: ${unknown.join(", ")}`,
|
|
308
|
+
known: listHarnesses()
|
|
309
|
+
};
|
|
310
|
+
return {
|
|
311
|
+
content: text(details),
|
|
312
|
+
details,
|
|
313
|
+
isError: true
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
const details = syncMcpServers(id !== void 0 && isHarnessId(id) ? [getHarness(id)] : getAllHarnesses());
|
|
317
|
+
return {
|
|
318
|
+
content: text(details),
|
|
319
|
+
details
|
|
320
|
+
};
|
|
321
|
+
} catch (error) {
|
|
322
|
+
const details = { error: errorMessage(error) };
|
|
323
|
+
return {
|
|
324
|
+
content: text(details),
|
|
325
|
+
details,
|
|
326
|
+
isError: true
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
function agentsSync(id, check = false) {
|
|
331
|
+
if (id !== void 0 && !isHarnessId(id)) return unknownHarness(id);
|
|
332
|
+
try {
|
|
333
|
+
const unknown = readAgentsConfig().excludes.filter((entry) => !isHarnessId(entry));
|
|
334
|
+
if (unknown.length > 0) {
|
|
335
|
+
const details = {
|
|
336
|
+
error: `Agents config excludes unknown harnesses: ${unknown.join(", ")}`,
|
|
337
|
+
known: listHarnesses()
|
|
338
|
+
};
|
|
339
|
+
return {
|
|
340
|
+
content: text(details),
|
|
341
|
+
details,
|
|
342
|
+
isError: true
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
const details = syncAgentsFiles(id !== void 0 && isHarnessId(id) ? [getHarness(id)] : getAllHarnesses(), check);
|
|
346
|
+
return {
|
|
347
|
+
content: text(details),
|
|
348
|
+
details
|
|
349
|
+
};
|
|
350
|
+
} catch (error) {
|
|
351
|
+
const details = { error: errorMessage(error) };
|
|
352
|
+
return {
|
|
353
|
+
content: text(details),
|
|
354
|
+
details,
|
|
355
|
+
isError: true
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
export { RUN_DEFAULT_TIMEOUT_SECONDS, RUN_MAX_OUTPUT_CHARS, agentsSync, detectHarnesses, harnessInfo, listHarnessModels, mcpAdd, mcpList, mcpRemove, mcpSync, runHarness, toMcpServerConfig };
|
|
360
|
+
|
|
361
|
+
//# sourceMappingURL=tool-operations.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-operations.mjs","names":["toToon"],"sources":["../../src/tool-operations.ts"],"sourcesContent":["/**\n * Tool executors behind the agent extensions.\n *\n * Each executor returns the text a caller reads plus the structured details a\n * harness can attach to the call. The text is TOON-encoded so the model sees\n * the same compact shape the CLI's --toon flag prints.\n */\nimport { encode as toToon } from \"@toon-format/toon\";\nimport { getAllHarnesses, getHarness, isHarnessId, listHarnesses } from \"./registry.ts\";\nimport {\n addMcpServer,\n listMcpServers,\n readMasterMcpServers,\n removeMcpServer,\n syncMcpServers,\n} from \"./mcp-servers.ts\";\nimport type { McpConfigListing, SyncReport } from \"./mcp-servers.ts\";\nimport { readAgentsConfig, syncAgentsFiles } from \"./agents-sync.ts\";\nimport type { AgentsSyncReport } from \"./agents-sync.ts\";\nexport type { AgentsSyncReport } from \"./agents-sync.ts\";\nexport type { SyncReport } from \"./mcp-servers.ts\";\nexport type { HarnessInvocationModes } from \"./types.ts\";\nimport type { Harness } from \"./harness.ts\";\nimport type {\n AvailableModel,\n HarnessCapabilities,\n HarnessDetection,\n HarnessId,\n HarnessInvocationModes,\n InvokeResult,\n ListModelsResult,\n McpServerConfig,\n PathCandidate,\n ResolvedPaths,\n StorageDescriptor,\n} from \"./types.ts\";\n\n/** Text for the model plus details for the harness, shared by every tool surface. */\nexport interface ToolResult<Details> {\n content: Array<{ type: \"text\"; text: string }>;\n details: Details;\n /** Set when the tool could not answer. */\n isError?: boolean;\n}\n\n/** Install state of one harness on this machine. */\nexport interface HarnessStatus {\n id: HarnessId;\n name: string;\n installed: boolean;\n version: string | null;\n}\n\n/** Every registered harness with its install state, as scanned by {@link detectHarnesses}. */\nexport interface HarnessListing {\n harnesses: HarnessStatus[];\n}\n\n/** Full metadata for one harness, including paths resolved for this platform. */\nexport interface HarnessMetadata {\n id: HarnessId;\n name: string;\n binaries: string[];\n capabilities: HarnessCapabilities;\n invocationModes: HarnessInvocationModes;\n modelListing: boolean;\n modelSelection: boolean;\n config: PathCandidate[];\n sessions: PathCandidate[];\n instructions: PathCandidate[];\n skills: PathCandidate[];\n commands: PathCandidate[];\n hooks: PathCandidate[];\n persistence: StorageDescriptor[];\n detection: HarnessDetection;\n resolved: ResolvedPaths;\n}\n\n/** Returned when the requested harness id is not registered. */\nexport interface UnknownHarness {\n error: string;\n known: HarnessId[];\n}\n\n/** Returned when a direct batch call bypasses the tool schema limits. */\nexport interface HarnessInfoInputError {\n error: string;\n}\n\n/** One harness lookup result. */\nexport type HarnessInfoResult = HarnessMetadata | UnknownHarness;\n\n/** Scalar, batch, or rejected batch details from {@link harnessInfo}. */\nexport type HarnessInfoDetails = HarnessInfoResult | HarnessInfoResult[] | HarnessInfoInputError;\n\nimport { HARNESS_INFO_MAX_ITEMS, RUN_TIMEOUT_DEFAULT_SECONDS } from \"./tool-schemas.ts\";\nexport { HARNESS_INFO_MAX_ITEMS } from \"./tool-schemas.ts\";\n\n/** Default wall-clock budget for one harness run, in seconds. */\nexport const RUN_DEFAULT_TIMEOUT_SECONDS = RUN_TIMEOUT_DEFAULT_SECONDS;\n\n/** The run tool's per-stream cap: harness output is unbounded, model context is not. */\nexport const RUN_MAX_OUTPUT_CHARS = 8000;\n\nfunction text(data: unknown): Array<{ type: \"text\"; text: string }> {\n return [{ type: \"text\", text: toToon(data) }];\n}\n\nfunction unknownHarness(id: string): ToolResult<UnknownHarness> {\n const details: UnknownHarness = { error: `Unknown harness: ${id}`, known: listHarnesses() };\n return { content: text(details), details, isError: true };\n}\n\nfunction errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\nfunction truncate(output: string): string {\n if (output.length <= RUN_MAX_OUTPUT_CHARS) return output;\n return `${output.slice(0, RUN_MAX_OUTPUT_CHARS)}\\n[truncated ${output.length - RUN_MAX_OUTPUT_CHARS} of ${output.length} characters]`;\n}\n\nfunction modelListingUnavailable(harness: Harness, id: string): RunFailure {\n return {\n error: harness.modelListing\n ? `Harness ${id} does not support filtering its model listing`\n : `Harness ${id} does not support model listing`,\n };\n}\n\ntype RunInvocationOptions = Readonly<{\n model?: string;\n structured: boolean;\n tools: boolean;\n readOnly: boolean;\n}>;\n\ntype InvocationMode = keyof HarnessInvocationModes;\n\nconst ALTERNATE_INVOCATION_MODE: Partial<Record<InvocationMode, InvocationMode>> = {\n advisor: \"agent\",\n advisorStructured: \"agentStructured\",\n agent: \"advisor\",\n agentStructured: \"advisorStructured\",\n};\n\nfunction selectedInvocationMode(\n structured: boolean,\n tools: boolean,\n readOnly: boolean,\n): InvocationMode {\n if (readOnly) return structured ? \"readOnlyStructured\" : \"readOnly\";\n if (tools) return structured ? \"agentStructured\" : \"agent\";\n return structured ? \"advisorStructured\" : \"advisor\";\n}\n\nfunction completedRun(\n harness: Harness,\n result: InvokeResult,\n options: RunInvocationOptions,\n): ToolResult<RunOutcome> {\n const details: RunOutcome = {\n id: harness.id,\n command: result.command,\n args: result.args,\n ...(options.model === undefined ? {} : { model: options.model }),\n structured: options.structured,\n tools: options.tools,\n readOnly: options.readOnly,\n exitCode: result.exitCode,\n timedOut: result.timedOut,\n stdout: truncate(result.stdout),\n stderr: truncate(result.stderr),\n };\n if (result.timedOut || result.exitCode !== 0) {\n return { content: text(details), details, isError: true };\n }\n return { content: text(details), details };\n}\n\nfunction unsupportedInvocation(\n harness: Harness,\n id: string,\n options: RunInvocationOptions,\n): ToolResult<RunFailure> {\n const error = harness.invocationError(options) ?? `Invalid ${id} invocation`;\n const invocationModes = harness.invocationModes;\n const mode = selectedInvocationMode(options.structured, options.tools, options.readOnly);\n const modelUnsupported =\n options.model !== undefined && harness.invocation?.modelArgs === undefined;\n if (invocationModes[mode] || harness.invocation === null || modelUnsupported) {\n const details: RunFailure = { error };\n return { content: text(details), details, isError: true };\n }\n\n const alternateMode = ALTERNATE_INVOCATION_MODE[mode];\n const alternateAvailable = alternateMode === undefined ? false : invocationModes[alternateMode];\n const details: RunFailure = {\n error,\n invocationModes,\n ...(alternateAvailable ? { retry: { tools: !options.tools } } : {}),\n };\n return { content: text(details), details, isError: true };\n}\n\n/**\n * Scans every registered harness for its binaries and version.\n *\n * @returns {ToolResult<HarnessListing>} The complete installation listing.\n */\nexport function detectHarnesses(): ToolResult<HarnessListing> {\n const details: HarnessListing = {\n harnesses: getAllHarnesses().map((harness) => {\n const installed = harness.isInstalled();\n return {\n id: harness.id,\n name: harness.name,\n installed,\n version: installed ? harness.version : null,\n };\n }),\n };\n\n return { content: text(details), details };\n}\n\nfunction harnessInfoResult(id: string): HarnessInfoResult {\n if (!isHarnessId(id)) return unknownHarness(id).details;\n\n const harness = getHarness(id);\n return {\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 hooks: harness.hooks,\n persistence: harness.persistence,\n detection: harness.detection,\n resolved: harness.resolve(),\n };\n}\n\n/** Full metadata for one harness, with paths resolved for the current platform. */\nexport function harnessInfo(id: string): ToolResult<HarnessInfoResult>;\n/** Full metadata for several harnesses, preserving input order and errors for each item. */\nexport function harnessInfo(\n ids: readonly string[],\n): ToolResult<HarnessInfoResult[] | HarnessInfoInputError>;\nexport function harnessInfo(input: string | readonly string[]): ToolResult<HarnessInfoDetails>;\nexport function harnessInfo(input: string | readonly string[]): ToolResult<HarnessInfoDetails> {\n if (typeof input === \"string\") {\n const details = harnessInfoResult(input);\n return { content: text(details), details, ...(\"error\" in details ? { isError: true } : {}) };\n }\n\n if (input.length < 1 || input.length > HARNESS_INFO_MAX_ITEMS) {\n const details: HarnessInfoInputError = {\n error: `harnesses_info accepts between 1 and ${HARNESS_INFO_MAX_ITEMS} ids`,\n };\n return { content: text(details), details, isError: true };\n }\n\n const details = input.map(harnessInfoResult);\n return {\n content: text(details),\n details,\n ...(details.some((result) => \"error\" in result) ? { isError: true } : {}),\n };\n}\n\n/** Options accepted by {@link listHarnessModels}. */\nexport interface ModelsOptions {\n search?: string;\n cwd?: string;\n /** Wall-clock budget in seconds; defaults to {@link RUN_DEFAULT_TIMEOUT_SECONDS}. */\n timeoutSeconds?: number;\n}\n\n/** One completed native model-listing query. */\nexport interface ModelsOutcome {\n id: HarnessId;\n command: string;\n args: string[];\n search?: string;\n models: AvailableModel[];\n exitCode: number | null;\n timedOut: boolean;\n stderr: string;\n}\n\n/**\n * Lists the models currently available to one harness through its native CLI.\n *\n * @param id - Harness id to query.\n * @param options - Search, working-directory, and timeout options.\n * @returns {Promise<ToolResult<ModelsOutcome | RunFailure>>} The model listing or failure.\n */\nexport async function listHarnessModels(\n id: string,\n options: ModelsOptions = {},\n): Promise<ToolResult<ModelsOutcome | RunFailure>> {\n if (!isHarnessId(id)) return unknownHarness(id);\n\n const harness = getHarness(id);\n const built = harness.buildModelListInvocation(options.search);\n if (!built) {\n const details = modelListingUnavailable(harness, id);\n return { content: text(details), details, isError: true };\n }\n\n const timeoutSeconds = options.timeoutSeconds ?? RUN_DEFAULT_TIMEOUT_SECONDS;\n let result: ListModelsResult;\n try {\n result = await harness.listModels({\n search: options.search,\n cwd: options.cwd,\n timeoutMs: timeoutSeconds * 1000,\n });\n } catch (error) {\n const details: RunFailure = { error: `Failed to list ${id} models: ${errorMessage(error)}` };\n return { content: text(details), details, isError: true };\n }\n\n const details: ModelsOutcome = {\n id: harness.id,\n command: result.command,\n args: result.args,\n ...(options.search === undefined ? {} : { search: options.search }),\n models: result.models,\n exitCode: result.exitCode,\n timedOut: result.timedOut,\n stderr: truncate(result.stderr),\n };\n\n return {\n content: text(details),\n details,\n ...(result.timedOut || result.exitCode !== 0 ? { isError: true } : {}),\n };\n}\n\n/** Options accepted by {@link runHarness}. */\nexport interface RunOptions {\n cwd?: string;\n /** Harness-native model id or selector. */\n model?: string;\n /** Wall-clock budget in seconds; defaults to {@link RUN_DEFAULT_TIMEOUT_SECONDS}. */\n timeoutSeconds?: number;\n /** Use the harness's structured (JSON) output mode instead of plain text. */\n structured?: boolean;\n /** Enable tools; defaults to a native advisor without tools invocation. */\n tools?: boolean;\n /** Require native enforcement of read-only tool access. Implies tools. */\n readOnly?: boolean;\n}\n\n/** One completed (or failed) harness run, with output capped for the model. */\nexport interface RunOutcome {\n id: HarnessId;\n command: string;\n args: string[];\n model?: string;\n structured: boolean;\n tools: boolean;\n readOnly: boolean;\n exitCode: number | null;\n timedOut: boolean;\n stdout: string;\n stderr: string;\n}\n\n/** Returned when the harness cannot be run at all. */\nexport interface RunFailure {\n error: string;\n known?: HarnessId[];\n /** Modes accepted by the selected harness when invocation mode caused the failure. */\n invocationModes?: HarnessInvocationModes;\n /** Explicit mode change that makes the same invocation shape executable. */\n retry?: { tools: boolean };\n}\n\nfunction normalizedRunAccess(options: Readonly<RunOptions>): {\n tools: boolean;\n readOnly: boolean;\n} {\n const readOnly = options.readOnly ?? false;\n return { readOnly, tools: readOnly ? true : (options.tools ?? false) };\n}\n\n/**\n * Runs one prompt through a harness's normalized non-interactive invocation.\n *\n * Tool use defaults to a native advisor without tools invocation. Harnesses that\n * cannot disable tools reject that mode; setting `tools` selects their full\n * agent invocation. `model` is translated through the harness-specific recipe.\n * This layer also closes stdin, enforces the timeout, and\n * caps the echoed output.\n *\n * @param id - Harness id to run.\n * @param prompt - Prompt sent to the selected harness.\n * @param options - Model, mode, working-directory, and timeout options.\n * @returns {Promise<ToolResult<RunOutcome | RunFailure>>} The capped run outcome or failure.\n */\nexport async function runHarness(\n id: string,\n prompt: string,\n options: RunOptions = {},\n): Promise<ToolResult<RunOutcome | RunFailure>> {\n if (!isHarnessId(id)) return unknownHarness(id);\n\n const harness = getHarness(id);\n const structured = options.structured ?? false;\n const { tools, readOnly } = normalizedRunAccess(options);\n const invocationOptions = { model: options.model, structured, tools, readOnly };\n if (!harness.buildInvocation(prompt, invocationOptions)) {\n return unsupportedInvocation(harness, id, invocationOptions);\n }\n\n const timeoutSeconds = options.timeoutSeconds ?? RUN_DEFAULT_TIMEOUT_SECONDS;\n\n let result: InvokeResult;\n try {\n result = await harness.invoke(prompt, {\n cwd: options.cwd,\n model: options.model,\n timeoutMs: timeoutSeconds * 1000,\n structured,\n tools,\n readOnly,\n });\n } catch (error) {\n const details: RunFailure = { error: `Failed to run ${id}: ${errorMessage(error)}` };\n return { content: text(details), details, isError: true };\n }\n\n return completedRun(harness, result, invocationOptions);\n}\n\n/** MCP server listings for one harness or all of them. */\nexport interface McpListing {\n harnesses: Array<{ id: HarnessId; configs: McpConfigListing[] }>;\n}\n\n/** Result of one MCP config mutation. */\nexport interface McpMutation {\n id: HarnessId;\n path: string;\n action: \"added\" | \"replaced\" | \"removed\" | \"noop\";\n}\n\n/** Flat tool parameters describing one MCP server, shared by every surface. */\nexport interface McpServerParams {\n name: string;\n transport?: McpServerConfig[\"transport\"];\n command?: string;\n args?: string[];\n env?: Record<string, string>;\n url?: string;\n headers?: Record<string, string>;\n}\n\n/**\n * Builds the normalized server shape from flat tool parameters.\n *\n * @param params - Flat MCP server parameters.\n * @returns {McpServerConfig} The normalized server configuration.\n */\nexport function toMcpServerConfig(params: McpServerParams): McpServerConfig {\n const server: McpServerConfig = {\n name: params.name,\n transport: params.transport ?? (params.url ? \"http\" : \"stdio\"),\n };\n if (params.command !== undefined) server.command = params.command;\n if (params.args !== undefined) server.args = params.args;\n if (params.env !== undefined) server.env = params.env;\n if (params.url !== undefined) server.url = params.url;\n if (params.headers !== undefined) server.headers = params.headers;\n return server;\n}\n\n/**\n * Lists configured MCP servers, normalized across harness config dialects.\n *\n * @param id - Optional harness id; omission lists every harness.\n * @returns {ToolResult<McpListing | UnknownHarness>} The normalized listing or id error.\n */\nexport function mcpList(id?: string): ToolResult<McpListing | UnknownHarness> {\n if (id !== undefined && !isHarnessId(id)) return unknownHarness(id);\n\n const targets = id !== undefined && isHarnessId(id) ? [getHarness(id)] : getAllHarnesses();\n const details: McpListing = {\n harnesses: targets\n .map((harness) => ({ id: harness.id, configs: listMcpServers(harness) }))\n .filter((entry) => entry.configs.length > 0),\n };\n\n return { content: text(details), details };\n}\n\nfunction mcpMutate(\n id: string,\n mutate: (harness: Harness) => { path: string; action: McpMutation[\"action\"] },\n): ToolResult<McpMutation | RunFailure> {\n if (!isHarnessId(id)) return unknownHarness(id);\n\n try {\n const { path, action } = mutate(getHarness(id));\n const details: McpMutation = { id, path, action };\n return { content: text(details), details, ...(action === \"noop\" ? { isError: true } : {}) };\n } catch (error) {\n const details: RunFailure = { error: errorMessage(error) };\n return { content: text(details), details, isError: true };\n }\n}\n\n/**\n * Adds or replaces one MCP server in a harness's config.\n *\n * @param id - Target harness id.\n * @param params - Server parameters to normalize and write.\n * @param scope - User or project config scope.\n * @returns {ToolResult<McpMutation | RunFailure>} The mutation outcome or failure.\n */\nexport function mcpAdd(\n id: string,\n params: McpServerParams,\n scope: \"user\" | \"project\" = \"user\",\n): ToolResult<McpMutation | RunFailure> {\n return mcpMutate(id, (harness) => {\n const { path, replaced } = addMcpServer(harness, toMcpServerConfig(params), scope);\n return { path, action: replaced ? \"replaced\" : \"added\" };\n });\n}\n\n/**\n * Removes one MCP server from a harness's config.\n *\n * @param id - Target harness id.\n * @param name - Server name to remove.\n * @param scope - User or project config scope.\n * @returns {ToolResult<McpMutation | RunFailure>} The mutation outcome or failure.\n */\nexport function mcpRemove(\n id: string,\n name: string,\n scope: \"user\" | \"project\" = \"user\",\n): ToolResult<McpMutation | RunFailure> {\n return mcpMutate(id, (harness) => {\n const { path, removed } = removeMcpServer(harness, name, scope);\n return { path, action: removed ? \"removed\" : \"noop\" };\n });\n}\n\n/**\n * Pushes the master MCP list from ~/.config/agntn/mcp.jsonc into harness configs.\n *\n * @param id - Optional harness id; omission targets every harness.\n * @returns {ToolResult<SyncReport | RunFailure>} The sync report or failure.\n */\nexport function mcpSync(id?: string): ToolResult<SyncReport | RunFailure> {\n if (id !== undefined && !isHarnessId(id)) return unknownHarness(id);\n\n try {\n // Preflight before any write: a typo in excludes must fail the whole run,\n // not silently leave the misspelled harness unprotected.\n const unknown = readMasterMcpServers().excludes.filter((entry) => !isHarnessId(entry));\n if (unknown.length > 0) {\n const details: RunFailure = {\n error: `Master MCP list excludes unknown harnesses: ${unknown.join(\", \")}`,\n known: listHarnesses(),\n };\n return { content: text(details), details, isError: true };\n }\n const details = syncMcpServers(\n id !== undefined && isHarnessId(id) ? [getHarness(id)] : getAllHarnesses(),\n );\n return { content: text(details), details };\n } catch (error) {\n const details: RunFailure = { error: errorMessage(error) };\n return { content: text(details), details, isError: true };\n }\n}\n\n/**\n * Links every harness's global instructions file to the master AGENTS.md.\n *\n * @param id - Optional harness id; omission targets every harness.\n * @param check - Report intended changes without writing them.\n * @returns {ToolResult<AgentsSyncReport | RunFailure>} The sync report or failure.\n */\nexport function agentsSync(id?: string, check = false): ToolResult<AgentsSyncReport | RunFailure> {\n if (id !== undefined && !isHarnessId(id)) return unknownHarness(id);\n\n try {\n // Preflight before any write: a typo in excludes must fail the whole run,\n // not silently adopt the harness it was meant to protect.\n const unknown = readAgentsConfig().excludes.filter((entry) => !isHarnessId(entry));\n if (unknown.length > 0) {\n const details: RunFailure = {\n error: `Agents config excludes unknown harnesses: ${unknown.join(\", \")}`,\n known: listHarnesses(),\n };\n return { content: text(details), details, isError: true };\n }\n const details = syncAgentsFiles(\n id !== undefined && isHarnessId(id) ? [getHarness(id)] : getAllHarnesses(),\n check,\n );\n return { content: text(details), details };\n } catch (error) {\n const details: RunFailure = { error: errorMessage(error) };\n return { content: text(details), details, isError: true };\n }\n}\n"],"mappings":";;;;;;;;EAmGA,MAAa,OAAA,IAAA;;AAGb;AAEA,SAAS,eAA2D,IAAA;CAClE,MAAA,UAAQ;EAAE,OAAM,oBAAA;EAAQ,OAAMA,cAAW;CAAE;CAC7C,OAAA;EAEA,SAAS,KAAA,OAAA;EACP;EAAkC,SAAO;CAA0B;AAAuB;AAC1F,SAAO,aAAA,OAAA;CAAE,OAAA,iBAAqB,QAAA,MAAA,UAAA,OAAA,KAAA;AAAG;AAAS,SAAA,SAAS,QAAA;CAAK,IAAA,OAAA,UAAA,KAAA,OAAA;CAC1D,OAAA,GAAA,OAAA,MAAA,GAAA,oBAAA,EAAA,eAAA,OAAA,SAAA,qBAAA,MAAA,OAAA,OAAA;AAEA;AACE,SAAO,wBAAyB,SAAM,IAAA;CACxC,OAAA,EAAA,OAAA,QAAA,eAAA,WAAA,GAAA,iDAAA,WAAA,GAAA,iCAAA;AAEA;AACE,MAAI,4BAA8C;CAClD,SAAO;CACT,mBAAA;CAEA,OAAA;CACE,iBACS;AAIX;AAWA,SAAM,uBAAA,YAA6E,OAAA,UAAA;CACjF,IAAA,UAAS,OAAA,aAAA,uBAAA;CACT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KAAA,OAAA;GAAM;EAAqC;CACtD,SAAC,OAAA;EACH,MAAA,UAAA,EAAA,OAAA,aAAA,KAAA,EAAA;;;;;;;AAQA;AAGE,SAAI,6BAAA,sBAAA,YAAA,iBAAA,aAAA,mBAAA,QAAA,SAAA,WAAA,SAAA,YAAA"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool parameter schemas shared by every surface (MCP server, Pi and OMP
|
|
3
|
+
* extensions). Each surface owns a different TypeBox build (the extensions
|
|
4
|
+
* must use their host's facade), so the schemas are a factory over a minimal
|
|
5
|
+
* structural builder instead of importing typebox here.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* The subset of the TypeBox builder the tool schemas need. `I` is the schema
|
|
9
|
+
* type the builder accepts as input, `S` the (possibly narrower) type it
|
|
10
|
+
* returns; OMP's facade accepts its own `AnySchema` while producing schemas
|
|
11
|
+
* that satisfy the host's stricter `TSchema`.
|
|
12
|
+
*/
|
|
13
|
+
interface McpSchemaBuilder<I, S> {
|
|
14
|
+
Object(properties: Readonly<Record<string, I>>, options?: object): S;
|
|
15
|
+
String(options?: object): I;
|
|
16
|
+
Integer(options?: object): I;
|
|
17
|
+
Boolean(options?: object): I;
|
|
18
|
+
Array(item: I, options?: object): I;
|
|
19
|
+
Record(key: I, value: I, options?: object): I;
|
|
20
|
+
Union(schemas: readonly I[], options?: object): I;
|
|
21
|
+
Literal(value: string, options?: object): I;
|
|
22
|
+
Optional(schema: I): I;
|
|
23
|
+
}
|
|
24
|
+
declare const HARNESS_INFO_MAX_ITEMS = 20;
|
|
25
|
+
declare const RUN_TIMEOUT_DEFAULT_SECONDS = 600;
|
|
26
|
+
/**
|
|
27
|
+
* Builds the parameter schemas for all harness tools with the host's TypeBox.
|
|
28
|
+
*
|
|
29
|
+
* @param Type - Host-provided TypeBox-compatible schema builder.
|
|
30
|
+
* @returns {Record<string, S>} Schemas keyed by harness tool operation.
|
|
31
|
+
*/
|
|
32
|
+
declare function harnessToolSchemas<I, S>(Type: McpSchemaBuilder<I, S>): {
|
|
33
|
+
detect: S;
|
|
34
|
+
info: S;
|
|
35
|
+
models: S;
|
|
36
|
+
run: S;
|
|
37
|
+
mcpList: S;
|
|
38
|
+
mcpSync: S;
|
|
39
|
+
agentsSync: S;
|
|
40
|
+
mcpAdd: S;
|
|
41
|
+
mcpRemove: S;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Parameter types matching the schemas above. The generic factory erases the
|
|
45
|
+
* builders' literal types, so hosts annotate their execute callbacks with
|
|
46
|
+
* these instead of TypeBox Static inference.
|
|
47
|
+
*/
|
|
48
|
+
interface InfoParams {
|
|
49
|
+
id: string | string[];
|
|
50
|
+
}
|
|
51
|
+
interface ModelsParams {
|
|
52
|
+
id: string;
|
|
53
|
+
search?: string;
|
|
54
|
+
cwd?: string;
|
|
55
|
+
timeoutSeconds?: number;
|
|
56
|
+
}
|
|
57
|
+
interface RunParams {
|
|
58
|
+
id: string;
|
|
59
|
+
prompt: string;
|
|
60
|
+
cwd?: string;
|
|
61
|
+
model?: string;
|
|
62
|
+
timeoutSeconds?: number;
|
|
63
|
+
structured?: boolean;
|
|
64
|
+
tools: boolean;
|
|
65
|
+
readOnly?: boolean;
|
|
66
|
+
}
|
|
67
|
+
interface McpListParams {
|
|
68
|
+
id?: string;
|
|
69
|
+
}
|
|
70
|
+
interface McpSyncParams {
|
|
71
|
+
id?: string;
|
|
72
|
+
}
|
|
73
|
+
interface AgentsSyncParams {
|
|
74
|
+
id?: string;
|
|
75
|
+
check?: boolean;
|
|
76
|
+
}
|
|
77
|
+
interface McpAddParams {
|
|
78
|
+
id: string;
|
|
79
|
+
name: string;
|
|
80
|
+
command?: string;
|
|
81
|
+
args?: string[];
|
|
82
|
+
env?: Record<string, string>;
|
|
83
|
+
url?: string;
|
|
84
|
+
transport?: "stdio" | "http" | "sse";
|
|
85
|
+
headers?: Record<string, string>;
|
|
86
|
+
scope?: "user" | "project";
|
|
87
|
+
}
|
|
88
|
+
interface McpRemoveParams {
|
|
89
|
+
id: string;
|
|
90
|
+
name: string;
|
|
91
|
+
scope?: "user" | "project";
|
|
92
|
+
}
|
|
93
|
+
export { AgentsSyncParams, HARNESS_INFO_MAX_ITEMS, InfoParams, McpAddParams, McpListParams, McpRemoveParams, McpSchemaBuilder, McpSyncParams, ModelsParams, RUN_TIMEOUT_DEFAULT_SECONDS, RunParams, harnessToolSchemas };
|
|
94
|
+
//# sourceMappingURL=tool-schemas.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-schemas.d.mts","names":[],"sources":["../../src/tool-schemas.ts"],"mappings":"AAaA;;;;;;;;;;;;UAAiB,iBAAiB,GAAG;EACnC,OAAO,YAAY,SAAS,eAAe,KAAK,mBAAmB;EACnE,OAAO,mBAAmB;EAC1B,QAAQ,mBAAmB;EAC3B,QAAQ,mBAAmB;EAC3B,MAAM,MAAM,GAAG,mBAAmB;EAClC,OAAO,KAAK,GAAG,OAAO,GAAG,mBAAmB;EAC5C,MAAM,kBAAkB,KAAK,mBAAmB;EAChD,QAAQ,eAAe,mBAAmB;EAC1C,SAAS,QAAQ,IAAI;;cAGV;cACA;;;;;;;iBAQG,mBAAmB,GAAG,GAAG,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;UA2JlD;EACf;;UAGe;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;;UAGe;EACf;;UAGe;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA,MAAM;EACN;EACA;EACA,UAAU;EACV;;UAGe;EACf;EACA;EACA"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
const HARNESS_INFO_MAX_ITEMS = 20;
|
|
2
|
+
const RUN_TIMEOUT_DEFAULT_SECONDS = 600;
|
|
3
|
+
function harnessToolSchemas(Type) {
|
|
4
|
+
const harnessId = (description) => Type.String({
|
|
5
|
+
description,
|
|
6
|
+
minLength: 1,
|
|
7
|
+
maxLength: 50,
|
|
8
|
+
pattern: "^[a-z][a-z0-9-]*$"
|
|
9
|
+
});
|
|
10
|
+
const stringRecord = (description) => Type.Record(Type.String({ maxLength: 256 }), Type.String({ maxLength: 4096 }), { description });
|
|
11
|
+
const scope = Type.Optional(Type.Union([Type.Literal("user"), Type.Literal("project")], { description: "Which config file to target (default user)" }));
|
|
12
|
+
return {
|
|
13
|
+
detect: Type.Object({}),
|
|
14
|
+
info: Type.Object({ id: Type.Union([harnessId("Harness id"), Type.Array(harnessId("Harness id"), {
|
|
15
|
+
minItems: 1,
|
|
16
|
+
maxItems: 20
|
|
17
|
+
})], { description: "Harness id, or a list of ids to inspect in one call" }) }),
|
|
18
|
+
models: Type.Object({
|
|
19
|
+
id: harnessId("Harness id"),
|
|
20
|
+
search: Type.Optional(Type.String({
|
|
21
|
+
description: "Optional native model search filter",
|
|
22
|
+
minLength: 1,
|
|
23
|
+
maxLength: 1024
|
|
24
|
+
})),
|
|
25
|
+
cwd: Type.Optional(Type.String({
|
|
26
|
+
description: "Working directory used while loading harness configuration",
|
|
27
|
+
minLength: 1,
|
|
28
|
+
maxLength: 4096
|
|
29
|
+
})),
|
|
30
|
+
timeoutSeconds: Type.Optional(Type.Integer({
|
|
31
|
+
description: `Wall-clock budget in seconds (default 600)`,
|
|
32
|
+
minimum: 1,
|
|
33
|
+
maximum: 3600
|
|
34
|
+
}))
|
|
35
|
+
}),
|
|
36
|
+
run: Type.Object({
|
|
37
|
+
id: harnessId("Harness id"),
|
|
38
|
+
prompt: Type.String({
|
|
39
|
+
description: "Prompt to send to the harness",
|
|
40
|
+
minLength: 1,
|
|
41
|
+
maxLength: 1e5
|
|
42
|
+
}),
|
|
43
|
+
cwd: Type.Optional(Type.String({
|
|
44
|
+
description: "Working directory for the run",
|
|
45
|
+
minLength: 1,
|
|
46
|
+
maxLength: 4096
|
|
47
|
+
})),
|
|
48
|
+
model: Type.Optional(Type.String({
|
|
49
|
+
description: "Harness-native model id or selector",
|
|
50
|
+
minLength: 1,
|
|
51
|
+
maxLength: 512
|
|
52
|
+
})),
|
|
53
|
+
timeoutSeconds: Type.Optional(Type.Integer({
|
|
54
|
+
description: `Wall-clock budget in seconds (default 600)`,
|
|
55
|
+
minimum: 1,
|
|
56
|
+
maximum: 3600
|
|
57
|
+
})),
|
|
58
|
+
structured: Type.Optional(Type.Boolean({ description: "Use the harness's structured (JSON) output mode instead of plain text" })),
|
|
59
|
+
tools: Type.Boolean({ description: "Explicit execution mode. Set true when the task needs any harness tools, including Grok native X search. Set false only for an advisor without tools." }),
|
|
60
|
+
readOnly: Type.Optional(Type.Boolean({ description: "Set with tools=true to require native read-only tool enforcement. Unsupported harnesses reject the run instead of widening access." }))
|
|
61
|
+
}),
|
|
62
|
+
mcpList: Type.Object({ id: Type.Optional(harnessId("Harness id; omit to list every harness")) }),
|
|
63
|
+
mcpSync: Type.Object({ id: Type.Optional(harnessId("Harness id; omit to sync every harness")) }),
|
|
64
|
+
agentsSync: Type.Object({
|
|
65
|
+
id: Type.Optional(harnessId("Harness id; omit to sync every harness")),
|
|
66
|
+
check: Type.Optional(Type.Boolean({ description: "Report what would change without writing anything" }))
|
|
67
|
+
}),
|
|
68
|
+
mcpAdd: Type.Object({
|
|
69
|
+
id: harnessId("Harness id"),
|
|
70
|
+
name: Type.String({
|
|
71
|
+
description: "Server name",
|
|
72
|
+
minLength: 1,
|
|
73
|
+
maxLength: 100,
|
|
74
|
+
pattern: "^[A-Za-z0-9][A-Za-z0-9_-]*$"
|
|
75
|
+
}),
|
|
76
|
+
command: Type.Optional(Type.String({
|
|
77
|
+
description: "Binary for a stdio server",
|
|
78
|
+
minLength: 1,
|
|
79
|
+
maxLength: 4096
|
|
80
|
+
})),
|
|
81
|
+
args: Type.Optional(Type.Array(Type.String({ maxLength: 4096 }), {
|
|
82
|
+
description: "Arguments for a stdio server",
|
|
83
|
+
maxItems: 64
|
|
84
|
+
})),
|
|
85
|
+
env: Type.Optional(stringRecord("Environment variables for a stdio server")),
|
|
86
|
+
url: Type.Optional(Type.String({
|
|
87
|
+
description: "URL for an http/sse server",
|
|
88
|
+
minLength: 1,
|
|
89
|
+
maxLength: 4096
|
|
90
|
+
})),
|
|
91
|
+
transport: Type.Optional(Type.Union([
|
|
92
|
+
Type.Literal("stdio"),
|
|
93
|
+
Type.Literal("http"),
|
|
94
|
+
Type.Literal("sse")
|
|
95
|
+
], { description: "Transport; inferred from url/command when omitted" })),
|
|
96
|
+
headers: Type.Optional(stringRecord("Headers for an http/sse server")),
|
|
97
|
+
scope
|
|
98
|
+
}),
|
|
99
|
+
mcpRemove: Type.Object({
|
|
100
|
+
id: harnessId("Harness id"),
|
|
101
|
+
name: Type.String({
|
|
102
|
+
description: "Server name",
|
|
103
|
+
minLength: 1,
|
|
104
|
+
maxLength: 100
|
|
105
|
+
}),
|
|
106
|
+
scope
|
|
107
|
+
})
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
export { HARNESS_INFO_MAX_ITEMS, RUN_TIMEOUT_DEFAULT_SECONDS, harnessToolSchemas };
|
|
111
|
+
|
|
112
|
+
//# sourceMappingURL=tool-schemas.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-schemas.mjs","names":[],"sources":["../../src/tool-schemas.ts"],"sourcesContent":["/**\n * Tool parameter schemas shared by every surface (MCP server, Pi and OMP\n * extensions). Each surface owns a different TypeBox build (the extensions\n * must use their host's facade), so the schemas are a factory over a minimal\n * structural builder instead of importing typebox here.\n */\n\n/**\n * The subset of the TypeBox builder the tool schemas need. `I` is the schema\n * type the builder accepts as input, `S` the (possibly narrower) type it\n * returns; OMP's facade accepts its own `AnySchema` while producing schemas\n * that satisfy the host's stricter `TSchema`.\n */\nexport interface McpSchemaBuilder<I, S> {\n Object(properties: Readonly<Record<string, I>>, options?: object): S;\n String(options?: object): I;\n Integer(options?: object): I;\n Boolean(options?: object): I;\n Array(item: I, options?: object): I;\n Record(key: I, value: I, options?: object): I;\n Union(schemas: readonly I[], options?: object): I;\n Literal(value: string, options?: object): I;\n Optional(schema: I): I;\n}\n\nexport const HARNESS_INFO_MAX_ITEMS = 20;\nexport const RUN_TIMEOUT_DEFAULT_SECONDS = 600;\n\n/**\n * Builds the parameter schemas for all harness tools with the host's TypeBox.\n *\n * @param Type - Host-provided TypeBox-compatible schema builder.\n * @returns {Record<string, S>} Schemas keyed by harness tool operation.\n */\nexport function harnessToolSchemas<I, S>(Type: McpSchemaBuilder<I, S>) {\n const harnessId = (description: string) =>\n Type.String({ description, minLength: 1, maxLength: 50, pattern: \"^[a-z][a-z0-9-]*$\" });\n\n const stringRecord = (description: string) =>\n Type.Record(Type.String({ maxLength: 256 }), Type.String({ maxLength: 4096 }), {\n description,\n });\n\n const scope = Type.Optional(\n Type.Union([Type.Literal(\"user\"), Type.Literal(\"project\")], {\n description: \"Which config file to target (default user)\",\n }),\n );\n\n return {\n detect: Type.Object({}),\n info: Type.Object({\n id: Type.Union(\n [\n harnessId(\"Harness id\"),\n Type.Array(harnessId(\"Harness id\"), {\n minItems: 1,\n maxItems: HARNESS_INFO_MAX_ITEMS,\n }),\n ],\n { description: \"Harness id, or a list of ids to inspect in one call\" },\n ),\n }),\n models: Type.Object({\n id: harnessId(\"Harness id\"),\n search: Type.Optional(\n Type.String({\n description: \"Optional native model search filter\",\n minLength: 1,\n maxLength: 1024,\n }),\n ),\n cwd: Type.Optional(\n Type.String({\n description: \"Working directory used while loading harness configuration\",\n minLength: 1,\n maxLength: 4096,\n }),\n ),\n timeoutSeconds: Type.Optional(\n Type.Integer({\n description: `Wall-clock budget in seconds (default ${RUN_TIMEOUT_DEFAULT_SECONDS})`,\n minimum: 1,\n maximum: 3600,\n }),\n ),\n }),\n run: Type.Object({\n id: harnessId(\"Harness id\"),\n prompt: Type.String({\n description: \"Prompt to send to the harness\",\n minLength: 1,\n maxLength: 100000,\n }),\n cwd: Type.Optional(\n Type.String({\n description: \"Working directory for the run\",\n minLength: 1,\n maxLength: 4096,\n }),\n ),\n model: Type.Optional(\n Type.String({\n description: \"Harness-native model id or selector\",\n minLength: 1,\n maxLength: 512,\n }),\n ),\n timeoutSeconds: Type.Optional(\n Type.Integer({\n description: `Wall-clock budget in seconds (default ${RUN_TIMEOUT_DEFAULT_SECONDS})`,\n minimum: 1,\n maximum: 3600,\n }),\n ),\n structured: Type.Optional(\n Type.Boolean({\n description: \"Use the harness's structured (JSON) output mode instead of plain text\",\n }),\n ),\n tools: Type.Boolean({\n description:\n \"Explicit execution mode. Set true when the task needs any harness tools, including Grok native X search. Set false only for an advisor without tools.\",\n }),\n readOnly: Type.Optional(\n Type.Boolean({\n description:\n \"Set with tools=true to require native read-only tool enforcement. Unsupported harnesses reject the run instead of widening access.\",\n }),\n ),\n }),\n mcpList: Type.Object({\n id: Type.Optional(harnessId(\"Harness id; omit to list every harness\")),\n }),\n mcpSync: Type.Object({\n id: Type.Optional(harnessId(\"Harness id; omit to sync every harness\")),\n }),\n agentsSync: Type.Object({\n id: Type.Optional(harnessId(\"Harness id; omit to sync every harness\")),\n check: Type.Optional(\n Type.Boolean({ description: \"Report what would change without writing anything\" }),\n ),\n }),\n mcpAdd: Type.Object({\n id: harnessId(\"Harness id\"),\n name: Type.String({\n description: \"Server name\",\n minLength: 1,\n maxLength: 100,\n pattern: \"^[A-Za-z0-9][A-Za-z0-9_-]*$\",\n }),\n command: Type.Optional(\n Type.String({ description: \"Binary for a stdio server\", minLength: 1, maxLength: 4096 }),\n ),\n args: Type.Optional(\n Type.Array(Type.String({ maxLength: 4096 }), {\n description: \"Arguments for a stdio server\",\n maxItems: 64,\n }),\n ),\n env: Type.Optional(stringRecord(\"Environment variables for a stdio server\")),\n url: Type.Optional(\n Type.String({ description: \"URL for an http/sse server\", minLength: 1, maxLength: 4096 }),\n ),\n transport: Type.Optional(\n Type.Union([Type.Literal(\"stdio\"), Type.Literal(\"http\"), Type.Literal(\"sse\")], {\n description: \"Transport; inferred from url/command when omitted\",\n }),\n ),\n headers: Type.Optional(stringRecord(\"Headers for an http/sse server\")),\n scope,\n }),\n mcpRemove: Type.Object({\n id: harnessId(\"Harness id\"),\n name: Type.String({\n description: \"Server name\",\n minLength: 1,\n maxLength: 100,\n }),\n scope,\n }),\n };\n}\n\n/**\n * Parameter types matching the schemas above. The generic factory erases the\n * builders' literal types, so hosts annotate their execute callbacks with\n * these instead of TypeBox Static inference.\n */\nexport interface InfoParams {\n id: string | string[];\n}\n\nexport interface ModelsParams {\n id: string;\n search?: string;\n cwd?: string;\n timeoutSeconds?: number;\n}\n\nexport interface RunParams {\n id: string;\n prompt: string;\n cwd?: string;\n model?: string;\n timeoutSeconds?: number;\n structured?: boolean;\n tools: boolean;\n readOnly?: boolean;\n}\n\nexport interface McpListParams {\n id?: string;\n}\n\nexport interface McpSyncParams {\n id?: string;\n}\n\nexport interface AgentsSyncParams {\n id?: string;\n check?: boolean;\n}\n\nexport interface McpAddParams {\n id: string;\n name: string;\n command?: string;\n args?: string[];\n env?: Record<string, string>;\n url?: string;\n transport?: \"stdio\" | \"http\" | \"sse\";\n headers?: Record<string, string>;\n scope?: \"user\" | \"project\";\n}\n\nexport interface McpRemoveParams {\n id: string;\n name: string;\n scope?: \"user\" | \"project\";\n}\n"],"mappings":"AAyBA,MAAa,yBAAyB;AACtC,MAAa,8BAA8B;;;;;;EAQ3C,SAAgB;CACd,CAAA;CACgB,MAAA,gBAAA,gBAAA,KAAA,OAAA,KAAA,OAAA,EAAA,WAAA,IAAA,CAAA,GAAA,KAAA,OAAA,EAAA,WAAA,KAAA,CAAA,GAAA,EAAA,YAAA,CAAA;CAAa,MAAA,QAAW,KAAA,SAAA,KAAA,MAAA,CAAA,KAAA,QAAA,MAAA,GAAA,KAAA,QAAA,SAAA,CAAA,GAAA,EAAA,aAAA,6CAAA,CAAA,CAAA;CAAG,OAAA;EAAe,QAAA,KAAS,OAAA,CAAA,CAAA;EAAqB,MAAA,KAAA,OAAA,EAAA,IAAA,KAAA,MAAA,CAAA,U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