@integrity-labs/agt-cli 0.28.31 → 0.28.33
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 +4 -4
- package/dist/{chunk-EJIU6AD6.js → chunk-7V2NY5F6.js} +12 -3
- package/dist/{chunk-EJIU6AD6.js.map → chunk-7V2NY5F6.js.map} +1 -1
- package/dist/{chunk-SR6RHUAV.js → chunk-HTRILMXV.js} +2 -2
- package/dist/{chunk-VIIPFWE4.js → chunk-R5CP4WAO.js} +2 -1
- package/dist/{claude-pair-runtime-RLIUZRLZ.js → claude-pair-runtime-LP4W56RT.js} +2 -2
- package/dist/lib/manager-worker.js +109 -49
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/{persistent-session-JHBXSNVW.js → persistent-session-RNALQ7JD.js} +3 -3
- package/dist/{responsiveness-probe-SKVWT5CO.js → responsiveness-probe-DRP2PPVE.js} +3 -3
- package/package.json +1 -1
- /package/dist/{chunk-SR6RHUAV.js.map → chunk-HTRILMXV.js.map} +0 -0
- /package/dist/{chunk-VIIPFWE4.js.map → chunk-R5CP4WAO.js.map} +0 -0
- /package/dist/{claude-pair-runtime-RLIUZRLZ.js.map → claude-pair-runtime-LP4W56RT.js.map} +0 -0
- /package/dist/{persistent-session-JHBXSNVW.js.map → persistent-session-RNALQ7JD.js.map} +0 -0
- /package/dist/{responsiveness-probe-SKVWT5CO.js.map → responsiveness-probe-DRP2PPVE.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
claudeModelAlias,
|
|
3
3
|
isClaudeFastMode
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-R5CP4WAO.js";
|
|
5
5
|
import {
|
|
6
6
|
reapOrphanChannelMcps
|
|
7
7
|
} from "./chunk-XWVM4KPK.js";
|
|
@@ -1487,4 +1487,4 @@ export {
|
|
|
1487
1487
|
stopAllSessionsAndWait,
|
|
1488
1488
|
getProjectDir
|
|
1489
1489
|
};
|
|
1490
|
-
//# sourceMappingURL=chunk-
|
|
1490
|
+
//# sourceMappingURL=chunk-HTRILMXV.js.map
|
|
@@ -5299,10 +5299,11 @@ export {
|
|
|
5299
5299
|
isEmptyTotals,
|
|
5300
5300
|
attributeTranscriptUsageByRun,
|
|
5301
5301
|
KANBAN_CHECK_COMMAND,
|
|
5302
|
+
FLAG_REGISTRY,
|
|
5302
5303
|
getFlagDefinition,
|
|
5303
5304
|
listFlagDefinitions,
|
|
5304
5305
|
normalizeFlagValue,
|
|
5305
5306
|
coerceEnvValue,
|
|
5306
5307
|
FLAGS_SCHEMA_VERSION
|
|
5307
5308
|
};
|
|
5308
|
-
//# sourceMappingURL=chunk-
|
|
5309
|
+
//# sourceMappingURL=chunk-R5CP4WAO.js.map
|
|
@@ -100,7 +100,7 @@ async function spawnPairSession(session) {
|
|
|
100
100
|
return { ok: true };
|
|
101
101
|
} catch {
|
|
102
102
|
}
|
|
103
|
-
const { resolveClaudeBinary } = await import("./persistent-session-
|
|
103
|
+
const { resolveClaudeBinary } = await import("./persistent-session-RNALQ7JD.js");
|
|
104
104
|
const claudeBin = resolveClaudeBinary();
|
|
105
105
|
const pairEnv = {
|
|
106
106
|
...process.env,
|
|
@@ -373,4 +373,4 @@ export {
|
|
|
373
373
|
startClaudePair,
|
|
374
374
|
submitClaudePairCode
|
|
375
375
|
};
|
|
376
|
-
//# sourceMappingURL=claude-pair-runtime-
|
|
376
|
+
//# sourceMappingURL=claude-pair-runtime-LP4W56RT.js.map
|
|
@@ -21,8 +21,9 @@ import {
|
|
|
21
21
|
provisionSessionStateHook,
|
|
22
22
|
provisionStopHook,
|
|
23
23
|
requireHost,
|
|
24
|
-
safeWriteJsonAtomic
|
|
25
|
-
|
|
24
|
+
safeWriteJsonAtomic,
|
|
25
|
+
setConfigHash
|
|
26
|
+
} from "../chunk-7V2NY5F6.js";
|
|
26
27
|
import {
|
|
27
28
|
getProjectDir as getProjectDir2,
|
|
28
29
|
getReadyTasks,
|
|
@@ -64,9 +65,10 @@ import {
|
|
|
64
65
|
takeWatchdogGiveUpCount,
|
|
65
66
|
takeZombieDetection,
|
|
66
67
|
transcriptActivityAgeSeconds
|
|
67
|
-
} from "../chunk-
|
|
68
|
+
} from "../chunk-HTRILMXV.js";
|
|
68
69
|
import {
|
|
69
70
|
FLAGS_SCHEMA_VERSION,
|
|
71
|
+
FLAG_REGISTRY,
|
|
70
72
|
KANBAN_CHECK_COMMAND,
|
|
71
73
|
MAX_AVATAR_ENV_URL_BYTES,
|
|
72
74
|
SUPPRESS_SENTINEL,
|
|
@@ -97,14 +99,14 @@ import {
|
|
|
97
99
|
sumTranscriptUsageInWindow,
|
|
98
100
|
worseConnectivityOutcome,
|
|
99
101
|
wrapScheduledTaskPrompt
|
|
100
|
-
} from "../chunk-
|
|
102
|
+
} from "../chunk-R5CP4WAO.js";
|
|
101
103
|
import {
|
|
102
104
|
parsePsRows,
|
|
103
105
|
reapOrphanChannelMcps
|
|
104
106
|
} from "../chunk-XWVM4KPK.js";
|
|
105
107
|
|
|
106
108
|
// src/lib/manager-worker.ts
|
|
107
|
-
import { createHash as
|
|
109
|
+
import { createHash as createHash5 } from "crypto";
|
|
108
110
|
import { readFileSync as readFileSync12, writeFileSync as writeFileSync4, mkdirSync as mkdirSync4, existsSync as existsSync8, rmSync as rmSync3, readdirSync as readdirSync5, statSync as statSync4, unlinkSync, copyFileSync } from "fs";
|
|
109
111
|
import { execFileSync as syncExecFile } from "child_process";
|
|
110
112
|
import { join as join14, dirname as dirname3 } from "path";
|
|
@@ -1693,6 +1695,32 @@ var DirectChatSpawnGate = class {
|
|
|
1693
1695
|
}
|
|
1694
1696
|
};
|
|
1695
1697
|
|
|
1698
|
+
// ../../packages/core/dist/host-config/capture.js
|
|
1699
|
+
import { createHash as createHash3 } from "crypto";
|
|
1700
|
+
var NON_SECRET_ENV_GATES = [
|
|
1701
|
+
"AGT_MEMORY_EXTRACTION_ENABLED",
|
|
1702
|
+
"AGT_CHANNEL_REPLAY_ENABLED",
|
|
1703
|
+
"AGT_DISABLE_MSTEAMS_HOST_ROUTES",
|
|
1704
|
+
"AGT_DEPLOY_CRONS",
|
|
1705
|
+
"AGT_CONV_EVAL_BACKEND",
|
|
1706
|
+
"AGT_CLI_RELEASE_CHANNEL"
|
|
1707
|
+
];
|
|
1708
|
+
var SECRET_NAME_PATTERN = /(KEY|SECRET|TOKEN|PASSWORD|PASSWD|CREDENTIAL|PRIVATE|SIGNING|WEBHOOK)/i;
|
|
1709
|
+
function listCapturableEnvGateNames() {
|
|
1710
|
+
const fromRegistry = FLAG_REGISTRY.map((f) => f.envVar).filter((v) => typeof v === "string" && v.length > 0);
|
|
1711
|
+
return [.../* @__PURE__ */ new Set([...fromRegistry, ...NON_SECRET_ENV_GATES])].filter((name) => !SECRET_NAME_PATTERN.test(name)).sort();
|
|
1712
|
+
}
|
|
1713
|
+
function collectEnvGates(env) {
|
|
1714
|
+
const out = {};
|
|
1715
|
+
for (const name of listCapturableEnvGateNames()) {
|
|
1716
|
+
const value = env[name];
|
|
1717
|
+
if (typeof value === "string" && value.length > 0) {
|
|
1718
|
+
out[name] = value.length > 128 ? value.slice(0, 128) : value;
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
return out;
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1696
1724
|
// src/lib/artifact-stream.ts
|
|
1697
1725
|
import { join as join3 } from "path";
|
|
1698
1726
|
import { homedir } from "os";
|
|
@@ -3605,7 +3633,7 @@ function planGlobalSkillSync(globalSkills, prevIds, hashOf, knownHash) {
|
|
|
3605
3633
|
}
|
|
3606
3634
|
|
|
3607
3635
|
// src/lib/manager/runtime.ts
|
|
3608
|
-
import { createHash as
|
|
3636
|
+
import { createHash as createHash4 } from "crypto";
|
|
3609
3637
|
import { readFileSync as readFileSync9, appendFileSync, mkdirSync as mkdirSync2, chmodSync, existsSync as existsSync4 } from "fs";
|
|
3610
3638
|
import { join as join10, dirname as dirname2 } from "path";
|
|
3611
3639
|
import { homedir as homedir4 } from "os";
|
|
@@ -3654,7 +3682,7 @@ function log(msg) {
|
|
|
3654
3682
|
}
|
|
3655
3683
|
}
|
|
3656
3684
|
function sha256(content) {
|
|
3657
|
-
return
|
|
3685
|
+
return createHash4("sha256").update(content, "utf8").digest("hex");
|
|
3658
3686
|
}
|
|
3659
3687
|
function hashFile(filePath) {
|
|
3660
3688
|
try {
|
|
@@ -5489,6 +5517,8 @@ var AUTO_RESUME_SELF_WINDOW_MS = 12e4;
|
|
|
5489
5517
|
var autoResumeLoggedSkips = /* @__PURE__ */ new Map();
|
|
5490
5518
|
var autoResumeStandDowns = /* @__PURE__ */ new Set();
|
|
5491
5519
|
var dependencyRecoveryLedger = new DependencyRecoveryLedger();
|
|
5520
|
+
var unstableLatchUnreported = /* @__PURE__ */ new Set();
|
|
5521
|
+
var unstableLatchReportInFlight = /* @__PURE__ */ new Set();
|
|
5492
5522
|
var killPausedCodeNames = /* @__PURE__ */ new Set();
|
|
5493
5523
|
var BACK_ONLINE_GREETING_GUIDANCE = " When you reconnect, if you tell anyone you are back, start that message with a \u{1F44B} wave emoji and do not use a \u{1F7E2} green-light emoji.";
|
|
5494
5524
|
function maybeAutoResume(agent) {
|
|
@@ -5556,13 +5586,34 @@ function logResumeReconcileHoldOnce(codeName, trippedAt, reason, detail) {
|
|
|
5556
5586
|
log(`[resume-reconciler] agent=${codeName} decision=hold reason=${reason}${detail ? ` (${detail})` : ""} (ENG-6383)`);
|
|
5557
5587
|
}
|
|
5558
5588
|
}
|
|
5589
|
+
function reportUnstableLatch(agent, trippedAt, standDownKey) {
|
|
5590
|
+
if (unstableLatchReportInFlight.has(standDownKey)) return;
|
|
5591
|
+
unstableLatchReportInFlight.add(standDownKey);
|
|
5592
|
+
void api.post("/host/circuit-breaker/unstable-latch", {
|
|
5593
|
+
agent_id: agent.agent_id,
|
|
5594
|
+
tripped_at: new Date(trippedAt).toISOString()
|
|
5595
|
+
}).then(() => {
|
|
5596
|
+
unstableLatchUnreported.delete(standDownKey);
|
|
5597
|
+
}).catch((err) => {
|
|
5598
|
+
log(
|
|
5599
|
+
`[resume-reconciler] agent=${agent.code_name} unstable-latch report failed (will retry next poll): ${err.message} (ENG-6392)`
|
|
5600
|
+
);
|
|
5601
|
+
}).finally(() => {
|
|
5602
|
+
unstableLatchReportInFlight.delete(standDownKey);
|
|
5603
|
+
});
|
|
5604
|
+
}
|
|
5559
5605
|
async function maybeResumeReconcile(agent) {
|
|
5560
5606
|
const codeName = agent.code_name;
|
|
5561
5607
|
if (autoResumeInFlight.has(codeName)) return;
|
|
5562
5608
|
const trip = restartBreaker.getTrip(codeName);
|
|
5563
5609
|
if (!trip) return;
|
|
5564
5610
|
const standDownKey = `${codeName}:${trip.trippedAt}`;
|
|
5565
|
-
if (autoResumeStandDowns.has(standDownKey))
|
|
5611
|
+
if (autoResumeStandDowns.has(standDownKey)) {
|
|
5612
|
+
if (unstableLatchUnreported.has(standDownKey)) {
|
|
5613
|
+
reportUnstableLatch(agent, trip.trippedAt, standDownKey);
|
|
5614
|
+
}
|
|
5615
|
+
return;
|
|
5616
|
+
}
|
|
5566
5617
|
autoResumeInFlight.add(codeName);
|
|
5567
5618
|
try {
|
|
5568
5619
|
const config2 = { ...readResumeReconcilerConfig(), enabled: hostFlagStore().getBoolean("resume-reconciler") };
|
|
@@ -5605,6 +5656,8 @@ async function maybeResumeReconcile(agent) {
|
|
|
5605
5656
|
`[resume-reconciler] agent=${codeName} decision=latch-unstable \u2014 auto-resumed once then re-tripped within the backoff window; latching to mandatory-manual (NOT resuming; restart counter untouched; agent stays paused with its circuit-breaker alert open) (ENG-6383)`
|
|
5606
5657
|
);
|
|
5607
5658
|
}
|
|
5659
|
+
unstableLatchUnreported.add(standDownKey);
|
|
5660
|
+
reportUnstableLatch(agent, trippedAt, standDownKey);
|
|
5608
5661
|
return;
|
|
5609
5662
|
}
|
|
5610
5663
|
log(
|
|
@@ -5787,7 +5840,7 @@ var runningChannelSecretHashes = /* @__PURE__ */ new Map();
|
|
|
5787
5840
|
function projectMcpHash(_codeName, projectDir) {
|
|
5788
5841
|
try {
|
|
5789
5842
|
const raw = readFileSync12(join14(projectDir, ".mcp.json"), "utf-8");
|
|
5790
|
-
return
|
|
5843
|
+
return createHash5("sha256").update(canonicalJson(JSON.parse(raw))).digest("hex");
|
|
5791
5844
|
} catch {
|
|
5792
5845
|
return null;
|
|
5793
5846
|
}
|
|
@@ -6146,7 +6199,7 @@ var cachedMaintenanceWindow = null;
|
|
|
6146
6199
|
var lastVersionCheckAt = 0;
|
|
6147
6200
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
6148
6201
|
var lastResponsivenessProbeAt = 0;
|
|
6149
|
-
var agtCliVersion = true ? "0.28.
|
|
6202
|
+
var agtCliVersion = true ? "0.28.33" : "dev";
|
|
6150
6203
|
function resolveBrewPath(execFileSync4) {
|
|
6151
6204
|
try {
|
|
6152
6205
|
const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -7274,7 +7327,7 @@ async function pollCycle() {
|
|
|
7274
7327
|
}
|
|
7275
7328
|
try {
|
|
7276
7329
|
const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
|
|
7277
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
7330
|
+
const { collectDiagnostics } = await import("../persistent-session-RNALQ7JD.js");
|
|
7278
7331
|
const diagCodeNames = [...agentState.persistentSessionAgents];
|
|
7279
7332
|
const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
|
|
7280
7333
|
let tailscaleHostname;
|
|
@@ -7304,7 +7357,7 @@ async function pollCycle() {
|
|
|
7304
7357
|
claudeAuth = await detectClaudeAuth();
|
|
7305
7358
|
} catch (err) {
|
|
7306
7359
|
const errText = err instanceof Error ? err.message : String(err);
|
|
7307
|
-
const errId =
|
|
7360
|
+
const errId = createHash5("sha256").update(errText).digest("hex").slice(0, 12);
|
|
7308
7361
|
log(`Claude auth detection failed (error_id=${errId})`);
|
|
7309
7362
|
}
|
|
7310
7363
|
const hostHasClaudeCode = state6.agents.some(
|
|
@@ -7341,7 +7394,12 @@ async function pollCycle() {
|
|
|
7341
7394
|
// ENG-6251: capability advertisement — the flags schema version this
|
|
7342
7395
|
// CLI compiled with, so the admin UI can show flip reach across a
|
|
7343
7396
|
// mixed-CLI fleet (an older CLI sends an older fingerprint).
|
|
7344
|
-
flags_schema_version: FLAGS_SCHEMA_VERSION
|
|
7397
|
+
flags_schema_version: FLAGS_SCHEMA_VERSION,
|
|
7398
|
+
// ENG-6412: the host's allowlisted, non-secret env gates. The API
|
|
7399
|
+
// combines these with the org's server-resolved flags + versions into a
|
|
7400
|
+
// host_config_snapshots row (on change) so bugs correlate with config.
|
|
7401
|
+
// Allowlist-only by construction — no raw env / secrets ever sent.
|
|
7402
|
+
env_gates: collectEnvGates(process.env)
|
|
7345
7403
|
});
|
|
7346
7404
|
if (hbResp?.maintenance_window) {
|
|
7347
7405
|
cachedMaintenanceWindow = hbResp.maintenance_window;
|
|
@@ -7349,6 +7407,7 @@ async function pollCycle() {
|
|
|
7349
7407
|
if (hbResp?.feature_flags) {
|
|
7350
7408
|
hostFlagStore().applyHeartbeat(hbResp.feature_flags, hbResp.flags_schema_version);
|
|
7351
7409
|
}
|
|
7410
|
+
setConfigHash(hbResp?.config_hash ?? null);
|
|
7352
7411
|
try {
|
|
7353
7412
|
if (decideMaintenanceWindowGate({ window: cachedMaintenanceWindow, now: /* @__PURE__ */ new Date() }) === "proceed") {
|
|
7354
7413
|
const { maybeUpdateClaudeCode } = await import("../claude-code-updater-4E5T2X3Z.js");
|
|
@@ -7362,13 +7421,14 @@ async function pollCycle() {
|
|
|
7362
7421
|
log(`Claude Code updater error: ${err.message}`);
|
|
7363
7422
|
}
|
|
7364
7423
|
} catch (err) {
|
|
7424
|
+
setConfigHash(null);
|
|
7365
7425
|
log(`Heartbeat failed: ${err.message}`);
|
|
7366
7426
|
}
|
|
7367
7427
|
try {
|
|
7368
7428
|
const {
|
|
7369
7429
|
collectResponsivenessProbes,
|
|
7370
7430
|
getResponsivenessIntervalMs
|
|
7371
|
-
} = await import("../responsiveness-probe-
|
|
7431
|
+
} = await import("../responsiveness-probe-DRP2PPVE.js");
|
|
7372
7432
|
const probeIntervalMs = getResponsivenessIntervalMs();
|
|
7373
7433
|
if (now - lastResponsivenessProbeAt > probeIntervalMs) {
|
|
7374
7434
|
const probeCodeNames = [...agentState.persistentSessionAgents];
|
|
@@ -7400,7 +7460,7 @@ async function pollCycle() {
|
|
|
7400
7460
|
collectResponsivenessProbes,
|
|
7401
7461
|
livePendingInboundOldestAgeSeconds,
|
|
7402
7462
|
parkPendingInbound
|
|
7403
|
-
} = await import("../responsiveness-probe-
|
|
7463
|
+
} = await import("../responsiveness-probe-DRP2PPVE.js");
|
|
7404
7464
|
const { getProjectDir: wedgeProjectDir } = await import("../claude-scheduler-FATCLHDM.js");
|
|
7405
7465
|
const wedgeNow = /* @__PURE__ */ new Date();
|
|
7406
7466
|
const liveAgents = agentState.persistentSessionAgents;
|
|
@@ -8382,7 +8442,7 @@ async function processAgent(agent, agentStates) {
|
|
|
8382
8442
|
const sessionModeForHash = refreshData.agent.session_mode;
|
|
8383
8443
|
const senderPolicyForHash = refreshData.sender_policy ?? null;
|
|
8384
8444
|
const CHANNEL_WRITE_VERSION = 9;
|
|
8385
|
-
const configHash =
|
|
8445
|
+
const configHash = createHash5("sha256").update(
|
|
8386
8446
|
canonicalJson({
|
|
8387
8447
|
writeVersion: CHANNEL_WRITE_VERSION,
|
|
8388
8448
|
config: entry.config,
|
|
@@ -8496,7 +8556,7 @@ async function processAgent(agent, agentStates) {
|
|
|
8496
8556
|
if (channelConfigConverged) {
|
|
8497
8557
|
const hasSenderPolicyChannel = currentChannelIds.has("slack") || currentChannelIds.has("msteams");
|
|
8498
8558
|
const senderPolicyForRestartHash = refreshData.sender_policy ?? null;
|
|
8499
|
-
const senderPolicyHash =
|
|
8559
|
+
const senderPolicyHash = createHash5("sha256").update(canonicalJson({ senderPolicy: senderPolicyForRestartHash })).digest("hex");
|
|
8500
8560
|
const prevSenderPolicyHash = agentState.knownSenderPolicyHashes.get(agent.agent_id);
|
|
8501
8561
|
const senderPolicyDecision = hasSenderPolicyChannel ? decideSenderPolicyRestart({
|
|
8502
8562
|
previousHash: prevSenderPolicyHash,
|
|
@@ -8538,7 +8598,7 @@ async function processAgent(agent, agentStates) {
|
|
|
8538
8598
|
const behaviourSubset = extractMsTeamsBehaviourSubset(
|
|
8539
8599
|
msteamsEntry?.config
|
|
8540
8600
|
);
|
|
8541
|
-
const behaviourHash =
|
|
8601
|
+
const behaviourHash = createHash5("sha256").update(canonicalJson(behaviourSubset)).digest("hex");
|
|
8542
8602
|
const prevBehaviourHash = agentState.knownMsTeamsBehaviourHashes.get(agent.agent_id);
|
|
8543
8603
|
const behaviourDecision = decideSenderPolicyRestart({
|
|
8544
8604
|
previousHash: prevBehaviourHash,
|
|
@@ -8585,7 +8645,7 @@ async function processAgent(agent, agentStates) {
|
|
|
8585
8645
|
const slackBehaviourSubset = extractSlackBehaviourSubset(
|
|
8586
8646
|
slackEntry?.config
|
|
8587
8647
|
);
|
|
8588
|
-
const slackBehaviourHash =
|
|
8648
|
+
const slackBehaviourHash = createHash5("sha256").update(canonicalJson(slackBehaviourSubset)).digest("hex");
|
|
8589
8649
|
const prevSlackBehaviourHash = agentState.knownSlackBehaviourHashes.get(agent.agent_id);
|
|
8590
8650
|
const slackBehaviourDecision = decideSenderPolicyRestart({
|
|
8591
8651
|
previousHash: prevSlackBehaviourHash,
|
|
@@ -8829,10 +8889,10 @@ async function processAgent(agent, agentStates) {
|
|
|
8829
8889
|
desiredEntries.push({ serverId, url, headers: mcpHeaders, name: tk.toolkit_name });
|
|
8830
8890
|
}
|
|
8831
8891
|
const hashBasis = desiredEntries.slice().sort((a, b) => a.serverId.localeCompare(b.serverId)).map((e) => {
|
|
8832
|
-
const headersHash =
|
|
8892
|
+
const headersHash = createHash5("sha256").update(canonicalJson(e.headers ?? {})).digest("hex").slice(0, 16);
|
|
8833
8893
|
return `${e.serverId}|${e.url}|${headersHash}`;
|
|
8834
8894
|
}).join("\n");
|
|
8835
|
-
const mcpHash =
|
|
8895
|
+
const mcpHash = createHash5("sha256").update(hashBasis).digest("hex").slice(0, 16);
|
|
8836
8896
|
const prevMcpHash = agentState.knownManagedMcpHashes.get(agent.agent_id);
|
|
8837
8897
|
const structureHash = managedMcpStructureHash(desiredEntries);
|
|
8838
8898
|
const prevStructureHash = agentState.knownManagedMcpStructure.get(agent.agent_id);
|
|
@@ -8847,7 +8907,7 @@ async function processAgent(agent, agentStates) {
|
|
|
8847
8907
|
if (mcpHash !== prevMcpHash) {
|
|
8848
8908
|
for (const e of desiredEntries) {
|
|
8849
8909
|
frameworkAdapter.writeMcpServer(agent.code_name, e.serverId, { url: e.url, headers: e.headers });
|
|
8850
|
-
const urlHash =
|
|
8910
|
+
const urlHash = createHash5("sha256").update(e.url).digest("hex").slice(0, 12);
|
|
8851
8911
|
log(`[managed-toolkit] ${agent.code_name}: wrote '${e.name}' (serverId=${e.serverId}, url_hash=${urlHash})`);
|
|
8852
8912
|
}
|
|
8853
8913
|
if (frameworkAdapter.removeMcpServer && frameworkAdapter.getMcpPath) {
|
|
@@ -8981,7 +9041,7 @@ async function processAgent(agent, agentStates) {
|
|
|
8981
9041
|
if (frameworkAdapter.installSkillFiles) {
|
|
8982
9042
|
const currentIntegrationSkillIds = /* @__PURE__ */ new Set();
|
|
8983
9043
|
const installedIntegrationSkills = [];
|
|
8984
|
-
const { createHash:
|
|
9044
|
+
const { createHash: createHash6 } = await import("crypto");
|
|
8985
9045
|
const refreshAny = refreshData;
|
|
8986
9046
|
const contexts = refreshAny.integration_contexts ?? refreshAny.plugin_contexts ?? [];
|
|
8987
9047
|
const contextBySlug = /* @__PURE__ */ new Map();
|
|
@@ -9010,7 +9070,7 @@ async function processAgent(agent, agentStates) {
|
|
|
9010
9070
|
)
|
|
9011
9071
|
}));
|
|
9012
9072
|
const bundle = buildIntegrationBundle(renderedScopes);
|
|
9013
|
-
const contentHash =
|
|
9073
|
+
const contentHash = createHash6("sha256").update(bundleFingerprint(bundle.files)).digest("hex").slice(0, 12);
|
|
9014
9074
|
const hashKey = `plugin-skill:${agent.agent_id}:${integrationSkillId}`;
|
|
9015
9075
|
if (agentState.knownSkillHashes.get(hashKey) === contentHash) continue;
|
|
9016
9076
|
frameworkAdapter.installSkillFiles(agent.code_name, integrationSkillId, bundle.files);
|
|
@@ -9069,7 +9129,7 @@ async function processAgent(agent, agentStates) {
|
|
|
9069
9129
|
const plan = planGlobalSkillSync(
|
|
9070
9130
|
refreshAny.global_skills ?? [],
|
|
9071
9131
|
agentState.knownGlobalSkillIds.get(agent.agent_id) ?? /* @__PURE__ */ new Set(),
|
|
9072
|
-
(content) =>
|
|
9132
|
+
(content) => createHash6("sha256").update(content).digest("hex").slice(0, 12),
|
|
9073
9133
|
(skillId) => agentState.knownSkillHashes.get(`global-skill:${agent.agent_id}:${skillId}`)
|
|
9074
9134
|
);
|
|
9075
9135
|
for (const { skillId, content, hash } of plan.installs) {
|
|
@@ -9113,7 +9173,7 @@ async function processAgent(agent, agentStates) {
|
|
|
9113
9173
|
const slug = hook.integration_slug ?? hook.plugin_slug;
|
|
9114
9174
|
if (!slug) continue;
|
|
9115
9175
|
try {
|
|
9116
|
-
const scriptHash =
|
|
9176
|
+
const scriptHash = createHash6("sha256").update(hook.script).digest("hex").slice(0, 12);
|
|
9117
9177
|
const hookKey = `${agent.agent_id}:${frameworkAdapter.id}:plugin-hook:${slug}:on_install`;
|
|
9118
9178
|
if (agentState.knownSkillHashes.get(hookKey) === scriptHash) continue;
|
|
9119
9179
|
const result = await frameworkAdapter.executePluginHook({
|
|
@@ -9128,9 +9188,9 @@ async function processAgent(agent, agentStates) {
|
|
|
9128
9188
|
} else if (result.timedOut) {
|
|
9129
9189
|
log(`Integration hook on_install '${slug}' TIMED OUT for '${agent.code_name}' after ${result.durationMs}ms`);
|
|
9130
9190
|
} else {
|
|
9131
|
-
const stderrHash =
|
|
9191
|
+
const stderrHash = createHash6("sha256").update(result.stderr).digest("hex").slice(0, 12);
|
|
9132
9192
|
const missingCmd = result.exitCode === 127 ? extractCommandNotFound(result.stderr) : null;
|
|
9133
|
-
const missingCmdHash = missingCmd ?
|
|
9193
|
+
const missingCmdHash = missingCmd ? createHash6("sha256").update(missingCmd).digest("hex").slice(0, 8) : null;
|
|
9134
9194
|
log(
|
|
9135
9195
|
`Integration hook on_install '${slug}' exited ${result.exitCode} for '${agent.code_name}' ` + (missingCmdHash ? `[missing_command_hash=${missingCmdHash}] ` : "") + `[stderr_hash=${stderrHash} stderr_len=${result.stderr.length}]`
|
|
9136
9196
|
);
|
|
@@ -9399,10 +9459,10 @@ async function processAgent(agent, agentStates) {
|
|
|
9399
9459
|
} else if (agentFw === "claude-code" && tasks.length > 0) {
|
|
9400
9460
|
await syncAndCheckClaudeScheduler(agent, tasks, boardItems, refreshData);
|
|
9401
9461
|
} else if (frameworkAdapter.syncScheduledTasks && gatewayRunning && gatewayPort) {
|
|
9402
|
-
const stableTasksHash =
|
|
9403
|
-
const boardHash = boardItems.length > 0 ?
|
|
9462
|
+
const stableTasksHash = createHash5("sha256").update(JSON.stringify(tasks)).digest("hex").slice(0, 16);
|
|
9463
|
+
const boardHash = boardItems.length > 0 ? createHash5("sha256").update(JSON.stringify(boardItems.map((b) => ({ id: b.id, title: b.title, status: b.status, priority: b.priority, deliverable: b.deliverable })))).digest("hex").slice(0, 16) : "empty";
|
|
9404
9464
|
const resolvedModels = resolveModelChain(refreshData);
|
|
9405
|
-
const modelsHash =
|
|
9465
|
+
const modelsHash = createHash5("sha256").update(JSON.stringify(resolvedModels)).digest("hex").slice(0, 16);
|
|
9406
9466
|
const combinedHash = `${stableTasksHash}:${boardHash}:${modelsHash}`;
|
|
9407
9467
|
const prevTasksHash = agentState.knownTasksHashes.get(agent.agent_id);
|
|
9408
9468
|
if (combinedHash !== prevTasksHash) {
|
|
@@ -9814,10 +9874,10 @@ function unregisterClaudeSpawn(pid) {
|
|
|
9814
9874
|
var claudeSchedulerStates = /* @__PURE__ */ new Map();
|
|
9815
9875
|
async function syncAndCheckClaudeScheduler(agent, tasks, boardItems, refreshData) {
|
|
9816
9876
|
const codeName = agent.code_name;
|
|
9817
|
-
const stableTasksHash =
|
|
9818
|
-
const boardHash = boardItems.length > 0 ?
|
|
9877
|
+
const stableTasksHash = createHash5("sha256").update(JSON.stringify(tasks)).digest("hex").slice(0, 16);
|
|
9878
|
+
const boardHash = boardItems.length > 0 ? createHash5("sha256").update(JSON.stringify(boardItems.map((b) => ({ id: b.id, title: b.title, status: b.status, priority: b.priority, deliverable: b.deliverable })))).digest("hex").slice(0, 16) : "empty";
|
|
9819
9879
|
const resolvedModels = resolveModelChain(refreshData);
|
|
9820
|
-
const modelsHash =
|
|
9880
|
+
const modelsHash = createHash5("sha256").update(JSON.stringify(resolvedModels)).digest("hex").slice(0, 16);
|
|
9821
9881
|
const combinedHash = `${stableTasksHash}:${boardHash}:${modelsHash}`;
|
|
9822
9882
|
const prevHash = agentState.knownTasksHashes.get(agent.agent_id);
|
|
9823
9883
|
if (combinedHash !== prevHash) {
|
|
@@ -9883,7 +9943,7 @@ async function startRun(opts) {
|
|
|
9883
9943
|
return { run_id: res.run_id ?? null, kanban_item_id: res.kanban_item_id ?? null };
|
|
9884
9944
|
} catch (err) {
|
|
9885
9945
|
const errText = err instanceof Error ? err.message : String(err);
|
|
9886
|
-
const errId =
|
|
9946
|
+
const errId = createHash5("sha256").update(errText).digest("hex").slice(0, 12);
|
|
9887
9947
|
log(`[runs] start failed for agent_id=${opts.agent_id} source_type=${opts.source_type} error_id=${errId}`);
|
|
9888
9948
|
return { run_id: null, kanban_item_id: null };
|
|
9889
9949
|
}
|
|
@@ -9900,7 +9960,7 @@ async function finishRun(runId, outcome, options = {}) {
|
|
|
9900
9960
|
});
|
|
9901
9961
|
} catch (err) {
|
|
9902
9962
|
const errText = err instanceof Error ? err.message : String(err);
|
|
9903
|
-
const errId =
|
|
9963
|
+
const errId = createHash5("sha256").update(errText).digest("hex").slice(0, 12);
|
|
9904
9964
|
log(`[runs] finish failed for run_id=${runId} outcome=${outcome} error_id=${errId}`);
|
|
9905
9965
|
}
|
|
9906
9966
|
}
|
|
@@ -9917,7 +9977,7 @@ async function fetchPriorScheduledRuns(agentId, taskId) {
|
|
|
9917
9977
|
return rows.filter((r) => typeof r.output_text === "string" && r.output_text.length > 0).map((r) => ({ startedAt: r.started_at, output: r.output_text }));
|
|
9918
9978
|
} catch (err) {
|
|
9919
9979
|
const errText = err instanceof Error ? err.message : String(err);
|
|
9920
|
-
const errId =
|
|
9980
|
+
const errId = createHash5("sha256").update(errText).digest("hex").slice(0, 12);
|
|
9921
9981
|
log(`[runs] prior-runs lookup failed for task_id=${taskId} error_id=${errId}`);
|
|
9922
9982
|
return [];
|
|
9923
9983
|
}
|
|
@@ -10273,10 +10333,10 @@ async function processClaudeTaskResult(codeName, agentId, templateId, rawOutput,
|
|
|
10273
10333
|
const classification = classifyOutput(rawOutput);
|
|
10274
10334
|
if (classification.action === "suppress") {
|
|
10275
10335
|
const trimmed = (rawOutput ?? "").trim();
|
|
10276
|
-
const outputHash = trimmed.length === 0 ? "empty" :
|
|
10336
|
+
const outputHash = trimmed.length === 0 ? "empty" : createHash5("sha256").update(trimmed).digest("hex").slice(0, 12);
|
|
10277
10337
|
log(`[claude-scheduler] Suppressing delivery for '${codeName}' (template=${templateId}, task=${delivery?.taskId ?? "n/a"}) \u2014 output_len=${trimmed.length} output_hash=${outputHash}`);
|
|
10278
10338
|
if (classification.suppressedNotes) {
|
|
10279
|
-
const notesHash =
|
|
10339
|
+
const notesHash = createHash5("sha256").update(classification.suppressedNotes).digest("hex").slice(0, 12);
|
|
10280
10340
|
log(`[claude-scheduler] Suppressed notes for '${codeName}' (task=${delivery?.taskId ?? "n/a"}) \u2014 notes_len=${classification.suppressedNotes.length} notes_hash=${notesHash}`);
|
|
10281
10341
|
}
|
|
10282
10342
|
if (delivery?.mode === "announce" && delivery.to) {
|
|
@@ -10461,7 +10521,7 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
|
|
|
10461
10521
|
const ctx = getLastFailureContext(codeName);
|
|
10462
10522
|
const recovery = prepareForRespawn(codeName);
|
|
10463
10523
|
const tailSummary = !ctx.tail ? "" : KNOWN_SAFE_TAIL_SIGNATURES.has(ctx.signature) ? `; last pane output (${PANE_TAIL_PREVIEW_LINES} of ~20 lines):
|
|
10464
|
-
${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${
|
|
10524
|
+
${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash5("sha256").update(ctx.tail).digest("hex").slice(0, 12)} (raw at ~/.augmented/${codeName}/pane.log)`;
|
|
10465
10525
|
const sigSummary = ctx.signature !== "unknown" ? `; signature=${ctx.signature}` : "";
|
|
10466
10526
|
const recoverySummary = recovery ? `; recovery=${recovery}` : "";
|
|
10467
10527
|
log(
|
|
@@ -10475,7 +10535,7 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash4("sha256").
|
|
|
10475
10535
|
);
|
|
10476
10536
|
getHostId().then((hostId) => {
|
|
10477
10537
|
if (!hostId) return;
|
|
10478
|
-
const paneTailHash = zombie.paneTail ? `sha256:${
|
|
10538
|
+
const paneTailHash = zombie.paneTail ? `sha256:${createHash5("sha256").update(zombie.paneTail).digest("hex").slice(0, 12)}` : null;
|
|
10479
10539
|
return api.post("/host/events", {
|
|
10480
10540
|
host_id: hostId,
|
|
10481
10541
|
agent_code_name: codeName,
|
|
@@ -10554,7 +10614,7 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash4("sha256").
|
|
|
10554
10614
|
if (!claudeAuthTupleBySession.has(codeName)) {
|
|
10555
10615
|
claudeAuthTupleBySession.set(codeName, currentAuthTuple);
|
|
10556
10616
|
}
|
|
10557
|
-
const stableTasksHash =
|
|
10617
|
+
const stableTasksHash = createHash5("sha256").update(JSON.stringify(tasks)).digest("hex").slice(0, 16);
|
|
10558
10618
|
const prevHash = agentState.knownTasksHashes.get(agent.agent_id);
|
|
10559
10619
|
if (stableTasksHash !== prevHash) {
|
|
10560
10620
|
const taskInputs = tasks.map((t) => buildSchedulerTaskInput(t));
|
|
@@ -11080,7 +11140,7 @@ ${escapeXml(msg.content)}
|
|
|
11080
11140
|
log(`[direct-chat] Reply sent for '${agent.codeName}'`);
|
|
11081
11141
|
} catch (err) {
|
|
11082
11142
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
11083
|
-
const errorId =
|
|
11143
|
+
const errorId = createHash5("sha256").update(errMsg).digest("hex").slice(0, 12);
|
|
11084
11144
|
log(`[direct-chat] Failed to process message for '${agent.codeName}': error_id=${errorId} error=${errMsg.slice(0, 500)}`);
|
|
11085
11145
|
try {
|
|
11086
11146
|
await api.post("/host/direct-chat/reply", {
|
|
@@ -11372,7 +11432,7 @@ async function processClaudePairSessions(agents) {
|
|
|
11372
11432
|
killPairSession,
|
|
11373
11433
|
pairTmuxSession,
|
|
11374
11434
|
finalizeClaudePairOnboarding
|
|
11375
|
-
} = await import("../claude-pair-runtime-
|
|
11435
|
+
} = await import("../claude-pair-runtime-LP4W56RT.js");
|
|
11376
11436
|
for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
|
|
11377
11437
|
log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
|
|
11378
11438
|
const killed = await killPairSession(pairTmuxSession(pairId));
|
|
@@ -11636,7 +11696,7 @@ async function syncMemories(agent, configDir, log2) {
|
|
|
11636
11696
|
if (!file.endsWith(".md")) continue;
|
|
11637
11697
|
try {
|
|
11638
11698
|
const raw = readFileSync12(join14(memoryDir, file), "utf-8");
|
|
11639
|
-
const fileHash =
|
|
11699
|
+
const fileHash = createHash5("sha256").update(raw).digest("hex").slice(0, 16);
|
|
11640
11700
|
currentHashes.set(file, fileHash);
|
|
11641
11701
|
if (prevHashes.get(file) === fileHash) continue;
|
|
11642
11702
|
const parsed = parseMemoryFile(raw, file.replace(/\.md$/, ""));
|
|
@@ -11674,14 +11734,14 @@ async function syncMemories(agent, configDir, log2) {
|
|
|
11674
11734
|
}
|
|
11675
11735
|
async function downloadMemories(agent, memoryDir, log2, { force }) {
|
|
11676
11736
|
const localFiles = existsSync8(memoryDir) ? readdirSync5(memoryDir).filter((f) => f.endsWith(".md")).sort() : [];
|
|
11677
|
-
const localListHash =
|
|
11737
|
+
const localListHash = createHash5("sha256").update(localFiles.join(",")).digest("hex").slice(0, 16);
|
|
11678
11738
|
const prevLocalHash = lastLocalFileHash.get(agent.agent_id);
|
|
11679
11739
|
const prevDownload = lastDownloadHash.get(agent.agent_id);
|
|
11680
11740
|
try {
|
|
11681
11741
|
const dbMemories = await api.post("/host/memories", {
|
|
11682
11742
|
agent_id: agent.agent_id
|
|
11683
11743
|
});
|
|
11684
|
-
const responseHash =
|
|
11744
|
+
const responseHash = createHash5("sha256").update(JSON.stringify(dbMemories.memories ?? [])).digest("hex").slice(0, 16);
|
|
11685
11745
|
if (!force && prevDownload && prevLocalHash === localListHash && lastDownloadHash.get(agent.agent_id) === responseHash) {
|
|
11686
11746
|
return true;
|
|
11687
11747
|
}
|
|
@@ -11720,7 +11780,7 @@ ${mem.content}
|
|
|
11720
11780
|
}
|
|
11721
11781
|
if (written > 0 || overwritten > 0) {
|
|
11722
11782
|
const updatedFiles = readdirSync5(memoryDir).filter((f) => f.endsWith(".md")).sort();
|
|
11723
|
-
lastLocalFileHash.set(agent.agent_id,
|
|
11783
|
+
lastLocalFileHash.set(agent.agent_id, createHash5("sha256").update(updatedFiles.join(",")).digest("hex").slice(0, 16));
|
|
11724
11784
|
log2(`Memory download for '${agent.code_name}': wrote ${written} new, overwrote ${overwritten} stale`);
|
|
11725
11785
|
}
|
|
11726
11786
|
}
|
|
@@ -12157,7 +12217,7 @@ function deployMcpAssets() {
|
|
|
12157
12217
|
const fileHash = (p) => {
|
|
12158
12218
|
try {
|
|
12159
12219
|
if (!existsSync8(p)) return null;
|
|
12160
|
-
return
|
|
12220
|
+
return createHash5("sha256").update(readFileSync12(p)).digest("hex");
|
|
12161
12221
|
} catch {
|
|
12162
12222
|
return null;
|
|
12163
12223
|
}
|