@integrity-labs/agt-cli 0.28.1274 → 0.28.1276
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/{api-client-GIY2I6DY.js → api-client-LXSFEHBG.js} +3 -3
- package/dist/bin/agt.js +7 -7
- package/dist/{chunk-HG46MG2F.js → chunk-2JILRR4Y.js} +51 -8
- package/dist/{chunk-HG46MG2F.js.map → chunk-2JILRR4Y.js.map} +1 -1
- package/dist/{chunk-UTWVB3MI.js → chunk-C3NM6OTP.js} +2 -2
- package/dist/{chunk-END74F3P.js → chunk-HISRTLZ3.js} +3 -3
- package/dist/{chunk-6ZGAF4SD.js → chunk-IDLNB6GR.js} +17 -10
- package/dist/chunk-IDLNB6GR.js.map +1 -0
- package/dist/{chunk-YHTQMJE3.js → chunk-IEXBHI4X.js} +2 -2
- package/dist/{chunk-MXCJUNEP.js → chunk-ZQVYTNLA.js} +52 -1
- package/dist/{chunk-MXCJUNEP.js.map → chunk-ZQVYTNLA.js.map} +1 -1
- package/dist/{claude-code-updater-U6ESCPIL.js → claude-code-updater-GADHFGSY.js} +3 -3
- package/dist/{claude-pair-runtime-GZHUPW2V.js → claude-pair-runtime-TUWLJ7TS.js} +3 -3
- package/dist/lib/manager-worker.js +22 -21
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/direct-chat-channel.js +52 -1
- package/dist/mcp/index.js +282 -10
- package/dist/mcp/origami.js +51 -0
- package/dist/mcp/slack-channel.js +52 -1
- package/dist/mcp/telegram-channel.js +52 -1
- package/dist/{persistent-session-C62TH4M6.js → persistent-session-VII4LBJ2.js} +6 -4
- package/dist/{responsiveness-probe-FMFTIMHU.js → responsiveness-probe-GX3TEW2E.js} +4 -4
- package/dist/{session-auth-dead-B6UDTSKE.js → session-auth-dead-7NXTFGDV.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-6ZGAF4SD.js.map +0 -1
- /package/dist/{api-client-GIY2I6DY.js.map → api-client-LXSFEHBG.js.map} +0 -0
- /package/dist/{chunk-UTWVB3MI.js.map → chunk-C3NM6OTP.js.map} +0 -0
- /package/dist/{chunk-END74F3P.js.map → chunk-HISRTLZ3.js.map} +0 -0
- /package/dist/{chunk-YHTQMJE3.js.map → chunk-IEXBHI4X.js.map} +0 -0
- /package/dist/{claude-code-updater-U6ESCPIL.js.map → claude-code-updater-GADHFGSY.js.map} +0 -0
- /package/dist/{claude-pair-runtime-GZHUPW2V.js.map → claude-pair-runtime-TUWLJ7TS.js.map} +0 -0
- /package/dist/{persistent-session-C62TH4M6.js.map → persistent-session-VII4LBJ2.js.map} +0 -0
- /package/dist/{responsiveness-probe-FMFTIMHU.js.map → responsiveness-probe-GX3TEW2E.js.map} +0 -0
- /package/dist/{session-auth-dead-B6UDTSKE.js.map → session-auth-dead-7NXTFGDV.js.map} +0 -0
|
@@ -37549,6 +37549,57 @@ var integration_metadata_v1_default = {
|
|
|
37549
37549
|
type: "array",
|
|
37550
37550
|
items: { type: "string", minLength: 1 },
|
|
37551
37551
|
description: "Keys removed from the snapshot before hashing, matched by name at any depth (timestamps, statistics)."
|
|
37552
|
+
},
|
|
37553
|
+
view_lookups: {
|
|
37554
|
+
type: "array",
|
|
37555
|
+
maxItems: 4,
|
|
37556
|
+
description: "CS-2540: extra reads shown on the approval card ONLY (never hashed, never refuse the call), so an approver sees what the snapshot's ids refer to, e.g. a campaign's segment names and subscriber counts. Each takes ids from `ids_from` (a dot path into the snapshot JSON: a string or an array of strings), reads at most 5, and GETs `http.path_template` with `{lookup_id}` filled from each. Run when the request is filed, not on the approve-time re-read.",
|
|
37557
|
+
items: {
|
|
37558
|
+
type: "object",
|
|
37559
|
+
additionalProperties: false,
|
|
37560
|
+
required: ["label", "ids_from", "http"],
|
|
37561
|
+
properties: {
|
|
37562
|
+
label: { type: "string", minLength: 1 },
|
|
37563
|
+
ids_from: { type: "string", pattern: "^[A-Za-z0-9_]+(\\.[A-Za-z0-9_]+)*$" },
|
|
37564
|
+
http: {
|
|
37565
|
+
type: "object",
|
|
37566
|
+
additionalProperties: false,
|
|
37567
|
+
required: ["method", "path_template"],
|
|
37568
|
+
properties: {
|
|
37569
|
+
method: { const: "GET" },
|
|
37570
|
+
path_template: { type: "string", pattern: "\\{lookup_id\\}" },
|
|
37571
|
+
headers_template: {
|
|
37572
|
+
type: "object",
|
|
37573
|
+
propertyNames: { pattern: "^[A-Za-z0-9!#$%&'*+.^_`|~-]+$" },
|
|
37574
|
+
additionalProperties: { type: "string" }
|
|
37575
|
+
}
|
|
37576
|
+
}
|
|
37577
|
+
},
|
|
37578
|
+
ignore_keys: { type: "array", items: { type: "string", minLength: 1 } },
|
|
37579
|
+
show_keys: { type: "array", items: { type: "string", minLength: 1 } },
|
|
37580
|
+
empty_text: { type: "string", minLength: 1 }
|
|
37581
|
+
}
|
|
37582
|
+
}
|
|
37583
|
+
},
|
|
37584
|
+
refused_effect: {
|
|
37585
|
+
type: "string",
|
|
37586
|
+
minLength: 1,
|
|
37587
|
+
maxLength: 80,
|
|
37588
|
+
description: "CS-2540: what a refusal says did NOT happen, for a tool that is not a send (e.g. `the schedule was NOT saved`). Absent: `it was NOT sent`."
|
|
37589
|
+
},
|
|
37590
|
+
view_fields: {
|
|
37591
|
+
type: "array",
|
|
37592
|
+
maxItems: 8,
|
|
37593
|
+
description: "CS-2540: snapshot fields shown first on the card, labelled (they are part of the snapshot, so covered by the hash). `path` is a dot path into the snapshot JSON.",
|
|
37594
|
+
items: {
|
|
37595
|
+
type: "object",
|
|
37596
|
+
additionalProperties: false,
|
|
37597
|
+
required: ["label", "path"],
|
|
37598
|
+
properties: {
|
|
37599
|
+
label: { type: "string", minLength: 1 },
|
|
37600
|
+
path: { type: "string", pattern: "^[A-Za-z0-9_]+(\\.[A-Za-z0-9_]+)*$" }
|
|
37601
|
+
}
|
|
37602
|
+
}
|
|
37552
37603
|
}
|
|
37553
37604
|
}
|
|
37554
37605
|
}
|
|
@@ -49182,7 +49233,7 @@ function tmuxSessionTarget(session) {
|
|
|
49182
49233
|
if (n.endsWith(":")) n = n.slice(0, -1);
|
|
49183
49234
|
return `=${n}`;
|
|
49184
49235
|
}
|
|
49185
|
-
var TMUX_SESSION_ABSENT = /can't find session|no server running
|
|
49236
|
+
var TMUX_SESSION_ABSENT = /can't find session|no server running/i;
|
|
49186
49237
|
function probeTmuxSession(tmuxSession) {
|
|
49187
49238
|
try {
|
|
49188
49239
|
execFileSync("tmux", ["has-session", "-t", tmuxSessionTarget(tmuxSession)], {
|
package/dist/mcp/index.js
CHANGED
|
@@ -23524,6 +23524,57 @@ var integration_metadata_v1_default = {
|
|
|
23524
23524
|
type: "array",
|
|
23525
23525
|
items: { type: "string", minLength: 1 },
|
|
23526
23526
|
description: "Keys removed from the snapshot before hashing, matched by name at any depth (timestamps, statistics)."
|
|
23527
|
+
},
|
|
23528
|
+
view_lookups: {
|
|
23529
|
+
type: "array",
|
|
23530
|
+
maxItems: 4,
|
|
23531
|
+
description: "CS-2540: extra reads shown on the approval card ONLY (never hashed, never refuse the call), so an approver sees what the snapshot's ids refer to, e.g. a campaign's segment names and subscriber counts. Each takes ids from `ids_from` (a dot path into the snapshot JSON: a string or an array of strings), reads at most 5, and GETs `http.path_template` with `{lookup_id}` filled from each. Run when the request is filed, not on the approve-time re-read.",
|
|
23532
|
+
items: {
|
|
23533
|
+
type: "object",
|
|
23534
|
+
additionalProperties: false,
|
|
23535
|
+
required: ["label", "ids_from", "http"],
|
|
23536
|
+
properties: {
|
|
23537
|
+
label: { type: "string", minLength: 1 },
|
|
23538
|
+
ids_from: { type: "string", pattern: "^[A-Za-z0-9_]+(\\.[A-Za-z0-9_]+)*$" },
|
|
23539
|
+
http: {
|
|
23540
|
+
type: "object",
|
|
23541
|
+
additionalProperties: false,
|
|
23542
|
+
required: ["method", "path_template"],
|
|
23543
|
+
properties: {
|
|
23544
|
+
method: { const: "GET" },
|
|
23545
|
+
path_template: { type: "string", pattern: "\\{lookup_id\\}" },
|
|
23546
|
+
headers_template: {
|
|
23547
|
+
type: "object",
|
|
23548
|
+
propertyNames: { pattern: "^[A-Za-z0-9!#$%&'*+.^_`|~-]+$" },
|
|
23549
|
+
additionalProperties: { type: "string" }
|
|
23550
|
+
}
|
|
23551
|
+
}
|
|
23552
|
+
},
|
|
23553
|
+
ignore_keys: { type: "array", items: { type: "string", minLength: 1 } },
|
|
23554
|
+
show_keys: { type: "array", items: { type: "string", minLength: 1 } },
|
|
23555
|
+
empty_text: { type: "string", minLength: 1 }
|
|
23556
|
+
}
|
|
23557
|
+
}
|
|
23558
|
+
},
|
|
23559
|
+
refused_effect: {
|
|
23560
|
+
type: "string",
|
|
23561
|
+
minLength: 1,
|
|
23562
|
+
maxLength: 80,
|
|
23563
|
+
description: "CS-2540: what a refusal says did NOT happen, for a tool that is not a send (e.g. `the schedule was NOT saved`). Absent: `it was NOT sent`."
|
|
23564
|
+
},
|
|
23565
|
+
view_fields: {
|
|
23566
|
+
type: "array",
|
|
23567
|
+
maxItems: 8,
|
|
23568
|
+
description: "CS-2540: snapshot fields shown first on the card, labelled (they are part of the snapshot, so covered by the hash). `path` is a dot path into the snapshot JSON.",
|
|
23569
|
+
items: {
|
|
23570
|
+
type: "object",
|
|
23571
|
+
additionalProperties: false,
|
|
23572
|
+
required: ["label", "path"],
|
|
23573
|
+
properties: {
|
|
23574
|
+
label: { type: "string", minLength: 1 },
|
|
23575
|
+
path: { type: "string", pattern: "^[A-Za-z0-9_]+(\\.[A-Za-z0-9_]+)*$" }
|
|
23576
|
+
}
|
|
23577
|
+
}
|
|
23527
23578
|
}
|
|
23528
23579
|
}
|
|
23529
23580
|
}
|
|
@@ -48383,6 +48434,18 @@ function cachedBoolean(key, path) {
|
|
|
48383
48434
|
return void 0;
|
|
48384
48435
|
}
|
|
48385
48436
|
}
|
|
48437
|
+
function readHostToolCatalogVersion(opts) {
|
|
48438
|
+
try {
|
|
48439
|
+
const path = opts?.cachePath ?? defaultFlagsCachePath(opts?.env);
|
|
48440
|
+
if (!existsSync2(path)) return void 0;
|
|
48441
|
+
const parsed = JSON.parse(readFileSync4(path, "utf8"));
|
|
48442
|
+
if (!parsed || typeof parsed !== "object") return void 0;
|
|
48443
|
+
const value = parsed.tool_catalog_version;
|
|
48444
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
48445
|
+
} catch {
|
|
48446
|
+
return void 0;
|
|
48447
|
+
}
|
|
48448
|
+
}
|
|
48386
48449
|
function resolveHostBooleanFlag(opts) {
|
|
48387
48450
|
const env2 = opts.env ?? process.env;
|
|
48388
48451
|
const envValue = envBoolean(env2[opts.envVar]);
|
|
@@ -49732,6 +49795,132 @@ function startForwardedToolRediscovery(initial, deps) {
|
|
|
49732
49795
|
};
|
|
49733
49796
|
}
|
|
49734
49797
|
|
|
49798
|
+
// src/tool-catalog-watch.ts
|
|
49799
|
+
var TOOL_CATALOG_POLL_MS = 6e4;
|
|
49800
|
+
var TOOL_CATALOG_REDISCOVERY_MAX_DELAY_MS = 12e4;
|
|
49801
|
+
var TOOL_CATALOG_RETRY_BASE_MS = 12e4;
|
|
49802
|
+
var TOOL_CATALOG_RETRY_MAX_MS = 30 * 6e4;
|
|
49803
|
+
function retryDelayMs(failures, random = Math.random) {
|
|
49804
|
+
const base = Math.min(TOOL_CATALOG_RETRY_BASE_MS * 2 ** Math.max(0, failures - 1), TOOL_CATALOG_RETRY_MAX_MS);
|
|
49805
|
+
return base + rediscoveryDelayMs(random);
|
|
49806
|
+
}
|
|
49807
|
+
function rediscoveryDelayMs(random = Math.random) {
|
|
49808
|
+
const r = random();
|
|
49809
|
+
const clamped = Number.isFinite(r) ? Math.min(Math.max(r, 0), 1) : 0;
|
|
49810
|
+
return Math.floor(clamped * TOOL_CATALOG_REDISCOVERY_MAX_DELAY_MS);
|
|
49811
|
+
}
|
|
49812
|
+
function startToolCatalogWatch(deps) {
|
|
49813
|
+
const setTimer = deps.setTimer ?? ((fn, ms) => {
|
|
49814
|
+
const timer = setTimeout(fn, ms);
|
|
49815
|
+
timer.unref?.();
|
|
49816
|
+
return timer;
|
|
49817
|
+
});
|
|
49818
|
+
const log = deps.log ?? (() => {
|
|
49819
|
+
});
|
|
49820
|
+
const pollMs = deps.pollMs ?? TOOL_CATALOG_POLL_MS;
|
|
49821
|
+
let baseline = deps.initialVerified === false ? void 0 : deps.initialVersion;
|
|
49822
|
+
let unverified = deps.initialVerified === false;
|
|
49823
|
+
let waiting = false;
|
|
49824
|
+
let stopped = false;
|
|
49825
|
+
const read = () => {
|
|
49826
|
+
try {
|
|
49827
|
+
const v = deps.readVersion();
|
|
49828
|
+
return typeof v === "string" && v.length > 0 ? v : void 0;
|
|
49829
|
+
} catch {
|
|
49830
|
+
return void 0;
|
|
49831
|
+
}
|
|
49832
|
+
};
|
|
49833
|
+
let failures = 0;
|
|
49834
|
+
const run = async () => {
|
|
49835
|
+
waiting = false;
|
|
49836
|
+
if (stopped) return;
|
|
49837
|
+
let ok = false;
|
|
49838
|
+
try {
|
|
49839
|
+
const outcome = await deps.rediscover(baseline);
|
|
49840
|
+
if (typeof outcome === "boolean") {
|
|
49841
|
+
ok = outcome;
|
|
49842
|
+
} else if (outcome && outcome.ok === true) {
|
|
49843
|
+
ok = outcome.servedVersion !== void 0 && outcome.servedVersion === baseline;
|
|
49844
|
+
if (!ok) {
|
|
49845
|
+
log(
|
|
49846
|
+
`augmented-mcp: tool catalog re-discovery listed version ${outcome.servedVersion ?? "(none reported)"}, expected ${baseline}; an API task still on the old catalog answered`
|
|
49847
|
+
);
|
|
49848
|
+
}
|
|
49849
|
+
}
|
|
49850
|
+
} catch (err) {
|
|
49851
|
+
log(`augmented-mcp: tool catalog re-discovery failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
49852
|
+
}
|
|
49853
|
+
if (ok) {
|
|
49854
|
+
failures = 0;
|
|
49855
|
+
return;
|
|
49856
|
+
}
|
|
49857
|
+
if (stopped) return;
|
|
49858
|
+
if (waiting) return;
|
|
49859
|
+
failures += 1;
|
|
49860
|
+
const delay = retryDelayMs(failures, deps.random);
|
|
49861
|
+
log(`augmented-mcp: tool catalog re-discovery (version ${baseline}) did not complete; retry ${failures} in ${delay}ms`);
|
|
49862
|
+
waiting = true;
|
|
49863
|
+
setTimer(() => void run(), delay);
|
|
49864
|
+
};
|
|
49865
|
+
const poll2 = () => {
|
|
49866
|
+
if (stopped) return;
|
|
49867
|
+
const current = read();
|
|
49868
|
+
if (current !== void 0 && current !== baseline) {
|
|
49869
|
+
if (baseline === void 0 && !unverified) {
|
|
49870
|
+
log(`augmented-mcp: tool catalog version ${current} adopted as baseline`);
|
|
49871
|
+
} else if (waiting) {
|
|
49872
|
+
log(`augmented-mcp: tool catalog version ${baseline} -> ${current}; re-discovery already scheduled`);
|
|
49873
|
+
} else {
|
|
49874
|
+
const delay = rediscoveryDelayMs(deps.random);
|
|
49875
|
+
log(`augmented-mcp: tool catalog version ${baseline} -> ${current}; re-discovering in ${delay}ms`);
|
|
49876
|
+
waiting = true;
|
|
49877
|
+
failures = 0;
|
|
49878
|
+
setTimer(() => void run(), delay);
|
|
49879
|
+
}
|
|
49880
|
+
baseline = current;
|
|
49881
|
+
unverified = false;
|
|
49882
|
+
}
|
|
49883
|
+
setTimer(poll2, pollMs);
|
|
49884
|
+
};
|
|
49885
|
+
setTimer(poll2, pollMs);
|
|
49886
|
+
return () => {
|
|
49887
|
+
stopped = true;
|
|
49888
|
+
};
|
|
49889
|
+
}
|
|
49890
|
+
|
|
49891
|
+
// src/forwarded-tool-definitions.ts
|
|
49892
|
+
import { createHash } from "crypto";
|
|
49893
|
+
function canonicalJson(value) {
|
|
49894
|
+
if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`;
|
|
49895
|
+
if (value && typeof value === "object") {
|
|
49896
|
+
const obj = value;
|
|
49897
|
+
const keys = Object.keys(obj).filter((k) => obj[k] !== void 0).sort();
|
|
49898
|
+
return `{${keys.map((k) => `${JSON.stringify(k)}:${canonicalJson(obj[k])}`).join(",")}}`;
|
|
49899
|
+
}
|
|
49900
|
+
return value === void 0 ? "null" : JSON.stringify(value);
|
|
49901
|
+
}
|
|
49902
|
+
function forwardedToolDefinitionHash(tool) {
|
|
49903
|
+
return createHash("sha256").update(canonicalJson({ description: tool.description ?? null, inputSchema: tool.inputSchema ?? null })).digest("hex");
|
|
49904
|
+
}
|
|
49905
|
+
function rememberForwardedTool(registry2, tool, handle) {
|
|
49906
|
+
registry2.set(tool.name, { handle, hash: forwardedToolDefinitionHash(tool) });
|
|
49907
|
+
}
|
|
49908
|
+
function updateForwardedTool(registry2, tool, toUpdate, log = () => {
|
|
49909
|
+
}) {
|
|
49910
|
+
const entry = registry2.get(tool.name);
|
|
49911
|
+
if (!entry) return "unknown";
|
|
49912
|
+
const hash = forwardedToolDefinitionHash(tool);
|
|
49913
|
+
if (hash === entry.hash) return "unchanged";
|
|
49914
|
+
try {
|
|
49915
|
+
entry.handle.update(toUpdate(tool));
|
|
49916
|
+
} catch (err) {
|
|
49917
|
+
log(`augmented-mcp: failed to update forwarded tool '${tool.name}', keeping its previous definition: ${err instanceof Error ? err.message : String(err)}`);
|
|
49918
|
+
return "failed";
|
|
49919
|
+
}
|
|
49920
|
+
entry.hash = hash;
|
|
49921
|
+
return "updated";
|
|
49922
|
+
}
|
|
49923
|
+
|
|
49735
49924
|
// src/in-container.ts
|
|
49736
49925
|
function isInContainer(env2 = process.env) {
|
|
49737
49926
|
const raw = (env2.AGT_IN_CONTAINER ?? "").trim().toLowerCase();
|
|
@@ -53971,17 +54160,21 @@ async function discoverApiTools() {
|
|
|
53971
54160
|
return { tools: [], status: "failed", degradedBrokers: [] };
|
|
53972
54161
|
}
|
|
53973
54162
|
const degradedBrokers = res.degraded_brokers ?? [];
|
|
54163
|
+
const served = res.tool_catalog_version;
|
|
53974
54164
|
return {
|
|
53975
54165
|
tools: res.tools ?? [],
|
|
53976
54166
|
status: degradedBrokers.length > 0 ? "degraded" : "ok",
|
|
53977
|
-
degradedBrokers
|
|
54167
|
+
degradedBrokers,
|
|
54168
|
+
catalogVersion: typeof served === "string" && served.length > 0 ? served : void 0
|
|
53978
54169
|
};
|
|
53979
54170
|
} catch (err) {
|
|
53980
54171
|
console.error(`augmented-mcp: tools/list failed: ${err.message}`);
|
|
53981
54172
|
return { tools: [], status: "failed", degradedBrokers: [] };
|
|
53982
54173
|
}
|
|
53983
54174
|
}
|
|
53984
|
-
var registeredForwardedTools = /* @__PURE__ */ new
|
|
54175
|
+
var registeredForwardedTools = /* @__PURE__ */ new Map();
|
|
54176
|
+
var forwardedToolUpdates = 0;
|
|
54177
|
+
var staleForwardedTools = /* @__PURE__ */ new Set();
|
|
53985
54178
|
var lateRegisteredForwardedTools = /* @__PURE__ */ new Set();
|
|
53986
54179
|
var unresolvedForwardedTools = /* @__PURE__ */ new Set();
|
|
53987
54180
|
function canonicalAgentDir(dir) {
|
|
@@ -54244,12 +54437,26 @@ var LOCAL_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
|
54244
54437
|
// direct-chat (button_click). Always registered; no API tool shares this name.
|
|
54245
54438
|
"request_buttons"
|
|
54246
54439
|
]);
|
|
54247
|
-
async function registerForwardedApiTools(isStartup = true) {
|
|
54248
|
-
const { tools: apiTools, status, degradedBrokers } = await discoverApiTools();
|
|
54440
|
+
async function registerForwardedApiTools(isStartup = true, updateChanged = false, expectedCatalogVersion) {
|
|
54441
|
+
const { tools: apiTools, status, degradedBrokers, catalogVersion } = await discoverApiTools();
|
|
54442
|
+
if (updateChanged && status !== "failed" && expectedCatalogVersion !== void 0 && catalogVersion !== expectedCatalogVersion) {
|
|
54443
|
+
return {
|
|
54444
|
+
expected: apiTools.length,
|
|
54445
|
+
registered: 0,
|
|
54446
|
+
skipped: 0,
|
|
54447
|
+
failed: [],
|
|
54448
|
+
updateFailed: [],
|
|
54449
|
+
status,
|
|
54450
|
+
degradedBrokers,
|
|
54451
|
+
catalogVersion,
|
|
54452
|
+
versionMismatch: true
|
|
54453
|
+
};
|
|
54454
|
+
}
|
|
54249
54455
|
const localToolNames = LOCAL_TOOL_NAMES;
|
|
54250
54456
|
let registered = 0;
|
|
54251
54457
|
let skipped = 0;
|
|
54252
54458
|
const failed = [];
|
|
54459
|
+
const updateFailed = [];
|
|
54253
54460
|
for (const tool of apiTools) {
|
|
54254
54461
|
if (localToolNames.has(tool.name)) {
|
|
54255
54462
|
skipped++;
|
|
@@ -54257,11 +54464,21 @@ async function registerForwardedApiTools(isStartup = true) {
|
|
|
54257
54464
|
}
|
|
54258
54465
|
if (registeredForwardedTools.has(tool.name)) {
|
|
54259
54466
|
registered++;
|
|
54467
|
+
if (updateChanged) {
|
|
54468
|
+
const outcome = updateForwardedTool(registeredForwardedTools, tool, forwardedToolUpdate, (line2) => console.error(line2));
|
|
54469
|
+
if (outcome === "updated") forwardedToolUpdates++;
|
|
54470
|
+
if (outcome === "failed") {
|
|
54471
|
+
updateFailed.push(tool.name);
|
|
54472
|
+
staleForwardedTools.add(tool.name);
|
|
54473
|
+
} else {
|
|
54474
|
+
staleForwardedTools.delete(tool.name);
|
|
54475
|
+
}
|
|
54476
|
+
}
|
|
54260
54477
|
continue;
|
|
54261
54478
|
}
|
|
54262
54479
|
try {
|
|
54263
54480
|
const shape = jsonSchemaToZodShape(tool.inputSchema);
|
|
54264
|
-
server.registerTool(
|
|
54481
|
+
const handle = server.registerTool(
|
|
54265
54482
|
tool.name,
|
|
54266
54483
|
{
|
|
54267
54484
|
description: tool.description ?? `Forwarded API tool: ${tool.name}`,
|
|
@@ -54272,7 +54489,7 @@ async function registerForwardedApiTools(isStartup = true) {
|
|
|
54272
54489
|
return result;
|
|
54273
54490
|
}
|
|
54274
54491
|
);
|
|
54275
|
-
registeredForwardedTools
|
|
54492
|
+
rememberForwardedTool(registeredForwardedTools, tool, handle);
|
|
54276
54493
|
unresolvedForwardedTools.delete(tool.name);
|
|
54277
54494
|
if (!isStartup) lateRegisteredForwardedTools.add(tool.name);
|
|
54278
54495
|
registered++;
|
|
@@ -54284,7 +54501,23 @@ async function registerForwardedApiTools(isStartup = true) {
|
|
|
54284
54501
|
);
|
|
54285
54502
|
}
|
|
54286
54503
|
}
|
|
54287
|
-
|
|
54504
|
+
if (updateChanged && status === "ok") {
|
|
54505
|
+
const served = new Set(apiTools.map((t) => t.name));
|
|
54506
|
+
for (const name of [...staleForwardedTools]) if (!served.has(name)) staleForwardedTools.delete(name);
|
|
54507
|
+
}
|
|
54508
|
+
return { expected: apiTools.length, registered, skipped, failed, updateFailed, status, degradedBrokers, catalogVersion, versionMismatch: false };
|
|
54509
|
+
}
|
|
54510
|
+
function forwardedToolUpdate(tool) {
|
|
54511
|
+
return {
|
|
54512
|
+
description: tool.description ?? `Forwarded API tool: ${tool.name}`,
|
|
54513
|
+
paramsSchema: jsonSchemaToZodShape(tool.inputSchema)
|
|
54514
|
+
};
|
|
54515
|
+
}
|
|
54516
|
+
var forwardedRegistrationQueue = Promise.resolve();
|
|
54517
|
+
function registerForwardedApiToolsSerially(isStartup, updateChanged, expectedCatalogVersion) {
|
|
54518
|
+
const run = forwardedRegistrationQueue.then(() => registerForwardedApiTools(isStartup, updateChanged, expectedCatalogVersion));
|
|
54519
|
+
forwardedRegistrationQueue = run.catch(() => void 0);
|
|
54520
|
+
return run;
|
|
54288
54521
|
}
|
|
54289
54522
|
async function listPublishedArtefactsText(params) {
|
|
54290
54523
|
const data = await apiPost(
|
|
@@ -55012,7 +55245,7 @@ if (isSelfRestartEnabled(process.env) && AGT_AGENT_CODE_NAME) {
|
|
|
55012
55245
|
}
|
|
55013
55246
|
var lastReportedSignature = null;
|
|
55014
55247
|
function forwardedReportSignature(result) {
|
|
55015
|
-
return reportSignature({ status: result.status, degradedBrokers: result.degradedBrokers, failed: unresolvedForwardedTools });
|
|
55248
|
+
return reportSignature({ status: result.status, degradedBrokers: result.degradedBrokers, failed: /* @__PURE__ */ new Set([...unresolvedForwardedTools, ...staleForwardedTools]) });
|
|
55016
55249
|
}
|
|
55017
55250
|
function reportForwardedTools(result) {
|
|
55018
55251
|
if (!AGT_AGENT_CODE_NAME) return;
|
|
@@ -55021,7 +55254,9 @@ function reportForwardedTools(result) {
|
|
|
55021
55254
|
// ENG-11708: what this session holds, which a failed retry cannot reduce.
|
|
55022
55255
|
registered: registeredForwardedTools.size,
|
|
55023
55256
|
skipped: result.skipped,
|
|
55024
|
-
|
|
55257
|
+
// ENG-12180: a tool still on its old definition after a failed update is
|
|
55258
|
+
// reported with the unregistered ones (CodeRabbit, #7691).
|
|
55259
|
+
failed: [.../* @__PURE__ */ new Set([...unresolvedForwardedTools, ...staleForwardedTools])],
|
|
55025
55260
|
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
55026
55261
|
discovery: result.status,
|
|
55027
55262
|
degradedBrokers: result.degradedBrokers,
|
|
@@ -55036,8 +55271,11 @@ function reportForwardedTools(result) {
|
|
|
55036
55271
|
async function main() {
|
|
55037
55272
|
let startupDiscovery = "failed";
|
|
55038
55273
|
let hadCleanDiscovery = false;
|
|
55274
|
+
const startupCatalogVersion = readHostToolCatalogVersion();
|
|
55275
|
+
let startupServedVersion;
|
|
55039
55276
|
try {
|
|
55040
55277
|
const result = await registerForwardedApiTools();
|
|
55278
|
+
startupServedVersion = result.catalogVersion;
|
|
55041
55279
|
startupDiscovery = retryStatusFor(result.status, unresolvedForwardedTools.size);
|
|
55042
55280
|
hadCleanDiscovery = result.status === "ok";
|
|
55043
55281
|
if (result.expected > 0) {
|
|
@@ -55059,7 +55297,7 @@ async function main() {
|
|
|
55059
55297
|
startForwardedToolRediscovery(startupDiscovery, {
|
|
55060
55298
|
attempt: async () => {
|
|
55061
55299
|
const before = registeredForwardedTools.size;
|
|
55062
|
-
const result = await
|
|
55300
|
+
const result = await registerForwardedApiToolsSerially(false, false);
|
|
55063
55301
|
const added = registeredForwardedTools.size - before;
|
|
55064
55302
|
if (added > 0) {
|
|
55065
55303
|
console.error(`augmented-mcp: registered ${added} forwarded tool(s) after startup`);
|
|
@@ -55083,6 +55321,40 @@ async function main() {
|
|
|
55083
55321
|
}),
|
|
55084
55322
|
log: (line2) => console.error(line2)
|
|
55085
55323
|
});
|
|
55324
|
+
startToolCatalogWatch({
|
|
55325
|
+
initialVersion: startupServedVersion ?? startupCatalogVersion,
|
|
55326
|
+
// CodeRabbit (#7691 ba189e7f57): a startup list with no served version is
|
|
55327
|
+
// unverified, so the first cached version schedules a gated re-list.
|
|
55328
|
+
initialVerified: startupServedVersion !== void 0,
|
|
55329
|
+
readVersion: () => readHostToolCatalogVersion(),
|
|
55330
|
+
rediscover: async (targetVersion) => {
|
|
55331
|
+
const before = registeredForwardedTools.size;
|
|
55332
|
+
const updatesBefore = forwardedToolUpdates;
|
|
55333
|
+
const result = await registerForwardedApiToolsSerially(false, true, targetVersion);
|
|
55334
|
+
if (result.versionMismatch) {
|
|
55335
|
+
console.error(
|
|
55336
|
+
`augmented-mcp: tool catalog re-discovery answered by catalog ${result.catalogVersion ?? "(none reported)"}, expected ${targetVersion}; nothing applied, will retry`
|
|
55337
|
+
);
|
|
55338
|
+
return { ok: false, servedVersion: result.catalogVersion };
|
|
55339
|
+
}
|
|
55340
|
+
const added = registeredForwardedTools.size - before;
|
|
55341
|
+
const updated = forwardedToolUpdates - updatesBefore;
|
|
55342
|
+
console.error(
|
|
55343
|
+
`augmented-mcp: tool catalog re-discovery (${result.status}, version ${result.catalogVersion ?? "unreported"}): ${added} added, ${updated} updated, ${result.updateFailed.length} update(s) failed, ${result.registered} of ${result.expected} API tool(s) forwarded`
|
|
55344
|
+
);
|
|
55345
|
+
if (added > 0 || result.failed.length > 0 || result.updateFailed.length > 0 || result.status !== "ok" || forwardedReportSignature(result) !== lastReportedSignature) {
|
|
55346
|
+
reportForwardedTools(result);
|
|
55347
|
+
}
|
|
55348
|
+
if (result.status === "ok") hadCleanDiscovery = true;
|
|
55349
|
+
return {
|
|
55350
|
+
// THIS pass's failures (CodeRabbit, #7691): a tool that failed earlier and
|
|
55351
|
+
// is no longer served must not keep a healthy catalog retrying forever.
|
|
55352
|
+
ok: result.status === "ok" && result.failed.length === 0 && staleForwardedTools.size === 0,
|
|
55353
|
+
servedVersion: result.catalogVersion
|
|
55354
|
+
};
|
|
55355
|
+
},
|
|
55356
|
+
log: (line2) => console.error(line2)
|
|
55357
|
+
});
|
|
55086
55358
|
}
|
|
55087
55359
|
main().catch((err) => {
|
|
55088
55360
|
console.error("augmented-mcp: Fatal error:", err);
|
package/dist/mcp/origami.js
CHANGED
|
@@ -37389,6 +37389,57 @@ var integration_metadata_v1_default = {
|
|
|
37389
37389
|
type: "array",
|
|
37390
37390
|
items: { type: "string", minLength: 1 },
|
|
37391
37391
|
description: "Keys removed from the snapshot before hashing, matched by name at any depth (timestamps, statistics)."
|
|
37392
|
+
},
|
|
37393
|
+
view_lookups: {
|
|
37394
|
+
type: "array",
|
|
37395
|
+
maxItems: 4,
|
|
37396
|
+
description: "CS-2540: extra reads shown on the approval card ONLY (never hashed, never refuse the call), so an approver sees what the snapshot's ids refer to, e.g. a campaign's segment names and subscriber counts. Each takes ids from `ids_from` (a dot path into the snapshot JSON: a string or an array of strings), reads at most 5, and GETs `http.path_template` with `{lookup_id}` filled from each. Run when the request is filed, not on the approve-time re-read.",
|
|
37397
|
+
items: {
|
|
37398
|
+
type: "object",
|
|
37399
|
+
additionalProperties: false,
|
|
37400
|
+
required: ["label", "ids_from", "http"],
|
|
37401
|
+
properties: {
|
|
37402
|
+
label: { type: "string", minLength: 1 },
|
|
37403
|
+
ids_from: { type: "string", pattern: "^[A-Za-z0-9_]+(\\.[A-Za-z0-9_]+)*$" },
|
|
37404
|
+
http: {
|
|
37405
|
+
type: "object",
|
|
37406
|
+
additionalProperties: false,
|
|
37407
|
+
required: ["method", "path_template"],
|
|
37408
|
+
properties: {
|
|
37409
|
+
method: { const: "GET" },
|
|
37410
|
+
path_template: { type: "string", pattern: "\\{lookup_id\\}" },
|
|
37411
|
+
headers_template: {
|
|
37412
|
+
type: "object",
|
|
37413
|
+
propertyNames: { pattern: "^[A-Za-z0-9!#$%&'*+.^_`|~-]+$" },
|
|
37414
|
+
additionalProperties: { type: "string" }
|
|
37415
|
+
}
|
|
37416
|
+
}
|
|
37417
|
+
},
|
|
37418
|
+
ignore_keys: { type: "array", items: { type: "string", minLength: 1 } },
|
|
37419
|
+
show_keys: { type: "array", items: { type: "string", minLength: 1 } },
|
|
37420
|
+
empty_text: { type: "string", minLength: 1 }
|
|
37421
|
+
}
|
|
37422
|
+
}
|
|
37423
|
+
},
|
|
37424
|
+
refused_effect: {
|
|
37425
|
+
type: "string",
|
|
37426
|
+
minLength: 1,
|
|
37427
|
+
maxLength: 80,
|
|
37428
|
+
description: "CS-2540: what a refusal says did NOT happen, for a tool that is not a send (e.g. `the schedule was NOT saved`). Absent: `it was NOT sent`."
|
|
37429
|
+
},
|
|
37430
|
+
view_fields: {
|
|
37431
|
+
type: "array",
|
|
37432
|
+
maxItems: 8,
|
|
37433
|
+
description: "CS-2540: snapshot fields shown first on the card, labelled (they are part of the snapshot, so covered by the hash). `path` is a dot path into the snapshot JSON.",
|
|
37434
|
+
items: {
|
|
37435
|
+
type: "object",
|
|
37436
|
+
additionalProperties: false,
|
|
37437
|
+
required: ["label", "path"],
|
|
37438
|
+
properties: {
|
|
37439
|
+
label: { type: "string", minLength: 1 },
|
|
37440
|
+
path: { type: "string", pattern: "^[A-Za-z0-9_]+(\\.[A-Za-z0-9_]+)*$" }
|
|
37441
|
+
}
|
|
37442
|
+
}
|
|
37392
37443
|
}
|
|
37393
37444
|
}
|
|
37394
37445
|
}
|
|
@@ -32085,6 +32085,57 @@ var integration_metadata_v1_default = {
|
|
|
32085
32085
|
type: "array",
|
|
32086
32086
|
items: { type: "string", minLength: 1 },
|
|
32087
32087
|
description: "Keys removed from the snapshot before hashing, matched by name at any depth (timestamps, statistics)."
|
|
32088
|
+
},
|
|
32089
|
+
view_lookups: {
|
|
32090
|
+
type: "array",
|
|
32091
|
+
maxItems: 4,
|
|
32092
|
+
description: "CS-2540: extra reads shown on the approval card ONLY (never hashed, never refuse the call), so an approver sees what the snapshot's ids refer to, e.g. a campaign's segment names and subscriber counts. Each takes ids from `ids_from` (a dot path into the snapshot JSON: a string or an array of strings), reads at most 5, and GETs `http.path_template` with `{lookup_id}` filled from each. Run when the request is filed, not on the approve-time re-read.",
|
|
32093
|
+
items: {
|
|
32094
|
+
type: "object",
|
|
32095
|
+
additionalProperties: false,
|
|
32096
|
+
required: ["label", "ids_from", "http"],
|
|
32097
|
+
properties: {
|
|
32098
|
+
label: { type: "string", minLength: 1 },
|
|
32099
|
+
ids_from: { type: "string", pattern: "^[A-Za-z0-9_]+(\\.[A-Za-z0-9_]+)*$" },
|
|
32100
|
+
http: {
|
|
32101
|
+
type: "object",
|
|
32102
|
+
additionalProperties: false,
|
|
32103
|
+
required: ["method", "path_template"],
|
|
32104
|
+
properties: {
|
|
32105
|
+
method: { const: "GET" },
|
|
32106
|
+
path_template: { type: "string", pattern: "\\{lookup_id\\}" },
|
|
32107
|
+
headers_template: {
|
|
32108
|
+
type: "object",
|
|
32109
|
+
propertyNames: { pattern: "^[A-Za-z0-9!#$%&'*+.^_`|~-]+$" },
|
|
32110
|
+
additionalProperties: { type: "string" }
|
|
32111
|
+
}
|
|
32112
|
+
}
|
|
32113
|
+
},
|
|
32114
|
+
ignore_keys: { type: "array", items: { type: "string", minLength: 1 } },
|
|
32115
|
+
show_keys: { type: "array", items: { type: "string", minLength: 1 } },
|
|
32116
|
+
empty_text: { type: "string", minLength: 1 }
|
|
32117
|
+
}
|
|
32118
|
+
}
|
|
32119
|
+
},
|
|
32120
|
+
refused_effect: {
|
|
32121
|
+
type: "string",
|
|
32122
|
+
minLength: 1,
|
|
32123
|
+
maxLength: 80,
|
|
32124
|
+
description: "CS-2540: what a refusal says did NOT happen, for a tool that is not a send (e.g. `the schedule was NOT saved`). Absent: `it was NOT sent`."
|
|
32125
|
+
},
|
|
32126
|
+
view_fields: {
|
|
32127
|
+
type: "array",
|
|
32128
|
+
maxItems: 8,
|
|
32129
|
+
description: "CS-2540: snapshot fields shown first on the card, labelled (they are part of the snapshot, so covered by the hash). `path` is a dot path into the snapshot JSON.",
|
|
32130
|
+
items: {
|
|
32131
|
+
type: "object",
|
|
32132
|
+
additionalProperties: false,
|
|
32133
|
+
required: ["label", "path"],
|
|
32134
|
+
properties: {
|
|
32135
|
+
label: { type: "string", minLength: 1 },
|
|
32136
|
+
path: { type: "string", pattern: "^[A-Za-z0-9_]+(\\.[A-Za-z0-9_]+)*$" }
|
|
32137
|
+
}
|
|
32138
|
+
}
|
|
32088
32139
|
}
|
|
32089
32140
|
}
|
|
32090
32141
|
}
|
|
@@ -42757,7 +42808,7 @@ function tmuxSessionTarget(session) {
|
|
|
42757
42808
|
if (n.endsWith(":")) n = n.slice(0, -1);
|
|
42758
42809
|
return `=${n}`;
|
|
42759
42810
|
}
|
|
42760
|
-
var TMUX_SESSION_ABSENT = /can't find session|no server running
|
|
42811
|
+
var TMUX_SESSION_ABSENT = /can't find session|no server running/i;
|
|
42761
42812
|
function probeTmuxSession(tmuxSession) {
|
|
42762
42813
|
try {
|
|
42763
42814
|
execFileSync("tmux", ["has-session", "-t", tmuxSessionTarget(tmuxSession)], {
|
|
@@ -32562,6 +32562,57 @@ var integration_metadata_v1_default = {
|
|
|
32562
32562
|
type: "array",
|
|
32563
32563
|
items: { type: "string", minLength: 1 },
|
|
32564
32564
|
description: "Keys removed from the snapshot before hashing, matched by name at any depth (timestamps, statistics)."
|
|
32565
|
+
},
|
|
32566
|
+
view_lookups: {
|
|
32567
|
+
type: "array",
|
|
32568
|
+
maxItems: 4,
|
|
32569
|
+
description: "CS-2540: extra reads shown on the approval card ONLY (never hashed, never refuse the call), so an approver sees what the snapshot's ids refer to, e.g. a campaign's segment names and subscriber counts. Each takes ids from `ids_from` (a dot path into the snapshot JSON: a string or an array of strings), reads at most 5, and GETs `http.path_template` with `{lookup_id}` filled from each. Run when the request is filed, not on the approve-time re-read.",
|
|
32570
|
+
items: {
|
|
32571
|
+
type: "object",
|
|
32572
|
+
additionalProperties: false,
|
|
32573
|
+
required: ["label", "ids_from", "http"],
|
|
32574
|
+
properties: {
|
|
32575
|
+
label: { type: "string", minLength: 1 },
|
|
32576
|
+
ids_from: { type: "string", pattern: "^[A-Za-z0-9_]+(\\.[A-Za-z0-9_]+)*$" },
|
|
32577
|
+
http: {
|
|
32578
|
+
type: "object",
|
|
32579
|
+
additionalProperties: false,
|
|
32580
|
+
required: ["method", "path_template"],
|
|
32581
|
+
properties: {
|
|
32582
|
+
method: { const: "GET" },
|
|
32583
|
+
path_template: { type: "string", pattern: "\\{lookup_id\\}" },
|
|
32584
|
+
headers_template: {
|
|
32585
|
+
type: "object",
|
|
32586
|
+
propertyNames: { pattern: "^[A-Za-z0-9!#$%&'*+.^_`|~-]+$" },
|
|
32587
|
+
additionalProperties: { type: "string" }
|
|
32588
|
+
}
|
|
32589
|
+
}
|
|
32590
|
+
},
|
|
32591
|
+
ignore_keys: { type: "array", items: { type: "string", minLength: 1 } },
|
|
32592
|
+
show_keys: { type: "array", items: { type: "string", minLength: 1 } },
|
|
32593
|
+
empty_text: { type: "string", minLength: 1 }
|
|
32594
|
+
}
|
|
32595
|
+
}
|
|
32596
|
+
},
|
|
32597
|
+
refused_effect: {
|
|
32598
|
+
type: "string",
|
|
32599
|
+
minLength: 1,
|
|
32600
|
+
maxLength: 80,
|
|
32601
|
+
description: "CS-2540: what a refusal says did NOT happen, for a tool that is not a send (e.g. `the schedule was NOT saved`). Absent: `it was NOT sent`."
|
|
32602
|
+
},
|
|
32603
|
+
view_fields: {
|
|
32604
|
+
type: "array",
|
|
32605
|
+
maxItems: 8,
|
|
32606
|
+
description: "CS-2540: snapshot fields shown first on the card, labelled (they are part of the snapshot, so covered by the hash). `path` is a dot path into the snapshot JSON.",
|
|
32607
|
+
items: {
|
|
32608
|
+
type: "object",
|
|
32609
|
+
additionalProperties: false,
|
|
32610
|
+
required: ["label", "path"],
|
|
32611
|
+
properties: {
|
|
32612
|
+
label: { type: "string", minLength: 1 },
|
|
32613
|
+
path: { type: "string", pattern: "^[A-Za-z0-9_]+(\\.[A-Za-z0-9_]+)*$" }
|
|
32614
|
+
}
|
|
32615
|
+
}
|
|
32565
32616
|
}
|
|
32566
32617
|
}
|
|
32567
32618
|
}
|
|
@@ -43665,7 +43716,7 @@ function tmuxSessionTarget(session) {
|
|
|
43665
43716
|
if (n.endsWith(":")) n = n.slice(0, -1);
|
|
43666
43717
|
return `=${n}`;
|
|
43667
43718
|
}
|
|
43668
|
-
var TMUX_SESSION_ABSENT = /can't find session|no server running
|
|
43719
|
+
var TMUX_SESSION_ABSENT = /can't find session|no server running/i;
|
|
43669
43720
|
function probeTmuxSession(tmuxSession) {
|
|
43670
43721
|
try {
|
|
43671
43722
|
execFileSync("tmux", ["has-session", "-t", tmuxSessionTarget(tmuxSession)], {
|