@integrity-labs/agt-cli 0.19.4 → 0.19.6
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/dist/bin/agt.js +3 -3
- package/dist/{chunk-MC3SMG4A.js → chunk-QKLXUYAR.js} +1 -1
- package/dist/lib/manager-worker.js +45 -11
- package/dist/lib/manager-worker.js.map +1 -1
- package/mcp/index.js +134 -0
- package/package.json +1 -1
- /package/dist/{chunk-MC3SMG4A.js.map → chunk-QKLXUYAR.js.map} +0 -0
package/mcp/index.js
CHANGED
|
@@ -20985,6 +20985,43 @@ var StdioServerTransport = class {
|
|
|
20985
20985
|
}
|
|
20986
20986
|
};
|
|
20987
20987
|
|
|
20988
|
+
// src/json-schema-to-zod-shape.ts
|
|
20989
|
+
function jsonSchemaToZodShape(schema) {
|
|
20990
|
+
if (!schema || schema["type"] !== "object") return {};
|
|
20991
|
+
const properties = schema["properties"] ?? {};
|
|
20992
|
+
const required2 = new Set(schema["required"] ?? []);
|
|
20993
|
+
const shape = {};
|
|
20994
|
+
for (const [key, prop] of Object.entries(properties)) {
|
|
20995
|
+
let field = jsonSchemaPropertyToZod(prop);
|
|
20996
|
+
const desc = typeof prop["description"] === "string" ? prop["description"] : void 0;
|
|
20997
|
+
if (desc) field = field.describe(desc);
|
|
20998
|
+
if (!required2.has(key)) field = field.optional();
|
|
20999
|
+
shape[key] = field;
|
|
21000
|
+
}
|
|
21001
|
+
return shape;
|
|
21002
|
+
}
|
|
21003
|
+
function jsonSchemaPropertyToZod(prop) {
|
|
21004
|
+
const t = prop["type"];
|
|
21005
|
+
if (t === "string") {
|
|
21006
|
+
const e = prop["enum"];
|
|
21007
|
+
if (Array.isArray(e) && e.every((v) => typeof v === "string")) {
|
|
21008
|
+
return external_exports.enum(e);
|
|
21009
|
+
}
|
|
21010
|
+
return external_exports.string();
|
|
21011
|
+
}
|
|
21012
|
+
if (t === "number" || t === "integer") return external_exports.number();
|
|
21013
|
+
if (t === "boolean") return external_exports.boolean();
|
|
21014
|
+
if (t === "array") {
|
|
21015
|
+
const items = prop["items"];
|
|
21016
|
+
return external_exports.array(items ? jsonSchemaPropertyToZod(items) : external_exports.unknown());
|
|
21017
|
+
}
|
|
21018
|
+
if (t === "object") {
|
|
21019
|
+
const nested = jsonSchemaToZodShape(prop);
|
|
21020
|
+
return external_exports.object(nested).passthrough();
|
|
21021
|
+
}
|
|
21022
|
+
return external_exports.unknown();
|
|
21023
|
+
}
|
|
21024
|
+
|
|
20988
21025
|
// src/token-refresh-selection.ts
|
|
20989
21026
|
var REFRESH_WINDOW_MS = 10 * 6e4;
|
|
20990
21027
|
function selectIntegrationsToRefresh(input) {
|
|
@@ -22168,7 +22205,104 @@ function statusLabel(status) {
|
|
|
22168
22205
|
function priorityLabel(priority) {
|
|
22169
22206
|
return priority === 1 ? "HIGH" : priority === 3 ? "LOW" : "MED";
|
|
22170
22207
|
}
|
|
22208
|
+
async function discoverApiTools() {
|
|
22209
|
+
if (!AGT_AGENT_CODE_NAME) return [];
|
|
22210
|
+
const path = `/agents/${encodeURIComponent(AGT_AGENT_CODE_NAME)}/mcp`;
|
|
22211
|
+
const body = { jsonrpc: "2.0", id: 1, method: "tools/list" };
|
|
22212
|
+
try {
|
|
22213
|
+
const res = await apiPost(path, body);
|
|
22214
|
+
if (res.error) {
|
|
22215
|
+
console.error(`augmented-mcp: tools/list returned error ${res.error.code}: ${res.error.message}`);
|
|
22216
|
+
return [];
|
|
22217
|
+
}
|
|
22218
|
+
return res.result?.tools ?? [];
|
|
22219
|
+
} catch (err) {
|
|
22220
|
+
console.error(`augmented-mcp: tools/list failed: ${err.message}`);
|
|
22221
|
+
return [];
|
|
22222
|
+
}
|
|
22223
|
+
}
|
|
22224
|
+
async function forwardToolCall(toolName, args) {
|
|
22225
|
+
if (!AGT_AGENT_CODE_NAME) {
|
|
22226
|
+
throw new Error("Cannot forward tool call: AGT_AGENT_CODE_NAME is not set");
|
|
22227
|
+
}
|
|
22228
|
+
const path = `/agents/${encodeURIComponent(AGT_AGENT_CODE_NAME)}/mcp`;
|
|
22229
|
+
const body = {
|
|
22230
|
+
jsonrpc: "2.0",
|
|
22231
|
+
id: Date.now(),
|
|
22232
|
+
method: "tools/call",
|
|
22233
|
+
params: { name: toolName, arguments: args }
|
|
22234
|
+
};
|
|
22235
|
+
const res = await apiPost(path, body);
|
|
22236
|
+
if (res.error) {
|
|
22237
|
+
throw new Error(`API tool ${toolName} returned ${res.error.code}: ${res.error.message}`);
|
|
22238
|
+
}
|
|
22239
|
+
return res.result;
|
|
22240
|
+
}
|
|
22241
|
+
async function registerForwardedApiTools() {
|
|
22242
|
+
const apiTools = await discoverApiTools();
|
|
22243
|
+
const localToolNames = /* @__PURE__ */ new Set([
|
|
22244
|
+
"kanban.list",
|
|
22245
|
+
"kanban.add",
|
|
22246
|
+
"kanban.move",
|
|
22247
|
+
"kanban.update",
|
|
22248
|
+
"kanban.done",
|
|
22249
|
+
"status.standup",
|
|
22250
|
+
"status.update",
|
|
22251
|
+
"drift.report",
|
|
22252
|
+
"token.refresh",
|
|
22253
|
+
"acpx.prompt",
|
|
22254
|
+
"acpx.exec",
|
|
22255
|
+
"acpx.spawn",
|
|
22256
|
+
"acpx.cancel",
|
|
22257
|
+
"knowledge.list",
|
|
22258
|
+
"knowledge.search",
|
|
22259
|
+
"knowledge.read",
|
|
22260
|
+
"knowledge.add",
|
|
22261
|
+
"knowledge.update",
|
|
22262
|
+
"knowledge.delete",
|
|
22263
|
+
"plugin.list",
|
|
22264
|
+
"plugin.improve"
|
|
22265
|
+
]);
|
|
22266
|
+
let registered = 0;
|
|
22267
|
+
let skipped = 0;
|
|
22268
|
+
for (const tool of apiTools) {
|
|
22269
|
+
if (localToolNames.has(tool.name)) {
|
|
22270
|
+
skipped++;
|
|
22271
|
+
continue;
|
|
22272
|
+
}
|
|
22273
|
+
try {
|
|
22274
|
+
const shape = jsonSchemaToZodShape(tool.inputSchema);
|
|
22275
|
+
server.registerTool(
|
|
22276
|
+
tool.name,
|
|
22277
|
+
{
|
|
22278
|
+
description: tool.description ?? `Forwarded API tool: ${tool.name}`,
|
|
22279
|
+
inputSchema: shape
|
|
22280
|
+
},
|
|
22281
|
+
async (args) => {
|
|
22282
|
+
const result = await forwardToolCall(tool.name, args ?? {});
|
|
22283
|
+
return result;
|
|
22284
|
+
}
|
|
22285
|
+
);
|
|
22286
|
+
registered++;
|
|
22287
|
+
} catch (err) {
|
|
22288
|
+
console.error(
|
|
22289
|
+
`augmented-mcp: failed to register forwarded tool '${tool.name}': ${err.message}`
|
|
22290
|
+
);
|
|
22291
|
+
}
|
|
22292
|
+
}
|
|
22293
|
+
return { registered, skipped };
|
|
22294
|
+
}
|
|
22171
22295
|
async function main() {
|
|
22296
|
+
try {
|
|
22297
|
+
const result = await registerForwardedApiTools();
|
|
22298
|
+
if (result.registered > 0 || result.skipped > 0) {
|
|
22299
|
+
console.error(
|
|
22300
|
+
`augmented-mcp: forwarded ${result.registered} API tool(s), skipped ${result.skipped} local override(s)`
|
|
22301
|
+
);
|
|
22302
|
+
}
|
|
22303
|
+
} catch (err) {
|
|
22304
|
+
console.error(`augmented-mcp: tool discovery threw: ${err.message}`);
|
|
22305
|
+
}
|
|
22172
22306
|
const transport = new StdioServerTransport();
|
|
22173
22307
|
await server.connect(transport);
|
|
22174
22308
|
}
|
package/package.json
CHANGED
|
File without changes
|