@integrity-labs/agt-cli 0.28.251 → 0.28.252
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
CHANGED
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
success,
|
|
39
39
|
table,
|
|
40
40
|
warn
|
|
41
|
-
} from "../chunk-
|
|
41
|
+
} from "../chunk-U2VQQ2UK.js";
|
|
42
42
|
import {
|
|
43
43
|
CHANNEL_REGISTRY,
|
|
44
44
|
DEFAULT_FRAMEWORK,
|
|
@@ -4826,7 +4826,7 @@ import { execFileSync, execSync } from "child_process";
|
|
|
4826
4826
|
import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
|
|
4827
4827
|
import chalk18 from "chalk";
|
|
4828
4828
|
import ora16 from "ora";
|
|
4829
|
-
var cliVersion = true ? "0.28.
|
|
4829
|
+
var cliVersion = true ? "0.28.252" : "dev";
|
|
4830
4830
|
async function fetchLatestVersion() {
|
|
4831
4831
|
const host2 = getHost();
|
|
4832
4832
|
if (!host2) return null;
|
|
@@ -5840,7 +5840,7 @@ function handleError(err) {
|
|
|
5840
5840
|
}
|
|
5841
5841
|
|
|
5842
5842
|
// src/bin/agt.ts
|
|
5843
|
-
var cliVersion2 = true ? "0.28.
|
|
5843
|
+
var cliVersion2 = true ? "0.28.252" : "dev";
|
|
5844
5844
|
var program = new Command();
|
|
5845
5845
|
program.name("agt").description("Augmented CLI \u2014 agent provisioning and management").version(cliVersion2).option("--json", "Emit machine-readable JSON output (suppress spinners and colors)").option("--skip-update-check", "Skip the automatic update check on startup");
|
|
5846
5846
|
program.hook("preAction", async (thisCommand, actionCommand) => {
|
|
@@ -5832,7 +5832,7 @@ function requireHost() {
|
|
|
5832
5832
|
}
|
|
5833
5833
|
|
|
5834
5834
|
// src/lib/api-client.ts
|
|
5835
|
-
var agtCliVersion = true ? "0.28.
|
|
5835
|
+
var agtCliVersion = true ? "0.28.252" : "dev";
|
|
5836
5836
|
var lastConfigHash = null;
|
|
5837
5837
|
function setConfigHash(hash) {
|
|
5838
5838
|
lastConfigHash = hash && hash.length > 0 ? hash : null;
|
|
@@ -8102,4 +8102,4 @@ export {
|
|
|
8102
8102
|
managerInstallSystemUnitCommand,
|
|
8103
8103
|
managerUninstallSystemUnitCommand
|
|
8104
8104
|
};
|
|
8105
|
-
//# sourceMappingURL=chunk-
|
|
8105
|
+
//# sourceMappingURL=chunk-U2VQQ2UK.js.map
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
requireHost,
|
|
38
38
|
safeWriteJsonAtomic,
|
|
39
39
|
setConfigHash
|
|
40
|
-
} from "../chunk-
|
|
40
|
+
} from "../chunk-U2VQQ2UK.js";
|
|
41
41
|
import {
|
|
42
42
|
getProjectDir as getProjectDir2,
|
|
43
43
|
getReadyTasks,
|
|
@@ -128,7 +128,7 @@ import {
|
|
|
128
128
|
} from "../chunk-XWVM4KPK.js";
|
|
129
129
|
|
|
130
130
|
// src/lib/manager-worker.ts
|
|
131
|
-
import { createHash as
|
|
131
|
+
import { createHash as createHash11 } from "crypto";
|
|
132
132
|
import { readFileSync as readFileSync14, writeFileSync as writeFileSync6, mkdirSync as mkdirSync6, existsSync as existsSync8, rmSync as rmSync4, readdirSync as readdirSync5, statSync as statSync4, copyFileSync } from "fs";
|
|
133
133
|
import { execFileSync as syncExecFile } from "child_process";
|
|
134
134
|
import { join as join16, dirname as dirname5 } from "path";
|
|
@@ -318,6 +318,49 @@ function decideSenderPolicyRestart(input) {
|
|
|
318
318
|
return { restart: true, firstPoll: false, changed: true };
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
+
// src/lib/sender-policy-normalize.ts
|
|
322
|
+
import { createHash as createHash3 } from "crypto";
|
|
323
|
+
|
|
324
|
+
// src/lib/canonical-json.ts
|
|
325
|
+
function canonicalJson(value) {
|
|
326
|
+
return JSON.stringify(normalize(value));
|
|
327
|
+
}
|
|
328
|
+
function normalize(value) {
|
|
329
|
+
if (value === null || typeof value !== "object") return value;
|
|
330
|
+
if (Array.isArray(value)) return value.map(normalize);
|
|
331
|
+
const sorted = {};
|
|
332
|
+
const keys = Object.keys(value).sort();
|
|
333
|
+
for (const k of keys) {
|
|
334
|
+
sorted[k] = normalize(value[k]);
|
|
335
|
+
}
|
|
336
|
+
return sorted;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// src/lib/sender-policy-normalize.ts
|
|
340
|
+
var PRINCIPAL_ID_LIST_KEYS = [
|
|
341
|
+
"slack_user_ids",
|
|
342
|
+
"telegram_chat_ids",
|
|
343
|
+
"teams_aad_object_ids"
|
|
344
|
+
];
|
|
345
|
+
function normalizeSenderPolicyForHash(policy) {
|
|
346
|
+
if (policy === null || typeof policy !== "object") return policy;
|
|
347
|
+
const p = policy;
|
|
348
|
+
const tp = p.team_principals;
|
|
349
|
+
if (tp === null || typeof tp !== "object") return policy;
|
|
350
|
+
const src = tp;
|
|
351
|
+
const normalizedTeamPrincipals = { ...src };
|
|
352
|
+
for (const key of PRINCIPAL_ID_LIST_KEYS) {
|
|
353
|
+
const list = src[key];
|
|
354
|
+
if (Array.isArray(list)) {
|
|
355
|
+
normalizedTeamPrincipals[key] = [...list].sort();
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return { ...p, team_principals: normalizedTeamPrincipals };
|
|
359
|
+
}
|
|
360
|
+
function computeSenderPolicyRestartHash(policy) {
|
|
361
|
+
return createHash3("sha256").update(canonicalJson({ senderPolicy: normalizeSenderPolicyForHash(policy) })).digest("hex");
|
|
362
|
+
}
|
|
363
|
+
|
|
321
364
|
// src/lib/msteams-behaviour-restart.ts
|
|
322
365
|
function extractMsTeamsBehaviourSubset(config2) {
|
|
323
366
|
const adaptiveCardsEnabled = config2?.["adaptive_cards_enabled"] === true;
|
|
@@ -1405,7 +1448,7 @@ function isDirectChatMessageExpired(createdAt, nowMs, maxAgeMs) {
|
|
|
1405
1448
|
}
|
|
1406
1449
|
|
|
1407
1450
|
// ../../packages/core/dist/host-config/capture.js
|
|
1408
|
-
import { createHash as
|
|
1451
|
+
import { createHash as createHash4 } from "crypto";
|
|
1409
1452
|
var NON_SECRET_ENV_GATES = [
|
|
1410
1453
|
"AGT_MEMORY_EXTRACTION_ENABLED",
|
|
1411
1454
|
"AGT_CHANNEL_REPLAY_ENABLED",
|
|
@@ -2977,26 +3020,11 @@ function parseExpiresAt(raw) {
|
|
|
2977
3020
|
return null;
|
|
2978
3021
|
}
|
|
2979
3022
|
|
|
2980
|
-
// src/lib/canonical-json.ts
|
|
2981
|
-
function canonicalJson(value) {
|
|
2982
|
-
return JSON.stringify(normalize(value));
|
|
2983
|
-
}
|
|
2984
|
-
function normalize(value) {
|
|
2985
|
-
if (value === null || typeof value !== "object") return value;
|
|
2986
|
-
if (Array.isArray(value)) return value.map(normalize);
|
|
2987
|
-
const sorted = {};
|
|
2988
|
-
const keys = Object.keys(value).sort();
|
|
2989
|
-
for (const k of keys) {
|
|
2990
|
-
sorted[k] = normalize(value[k]);
|
|
2991
|
-
}
|
|
2992
|
-
return sorted;
|
|
2993
|
-
}
|
|
2994
|
-
|
|
2995
3023
|
// src/lib/channel-config-hash.ts
|
|
2996
|
-
import { createHash as
|
|
3024
|
+
import { createHash as createHash5 } from "crypto";
|
|
2997
3025
|
var CHANNEL_WRITE_VERSION = 9;
|
|
2998
3026
|
function computeChannelConfigHash(input) {
|
|
2999
|
-
return
|
|
3027
|
+
return createHash5("sha256").update(
|
|
3000
3028
|
canonicalJson({
|
|
3001
3029
|
writeVersion: CHANNEL_WRITE_VERSION,
|
|
3002
3030
|
cliVersion: input.cliVersion,
|
|
@@ -3004,7 +3032,9 @@ function computeChannelConfigHash(input) {
|
|
|
3004
3032
|
team: input.team,
|
|
3005
3033
|
peers: input.peers,
|
|
3006
3034
|
sessionMode: input.sessionMode ?? null,
|
|
3007
|
-
|
|
3035
|
+
// ENG-7435: value-blind on the team_principals id SETS so a reorder of
|
|
3036
|
+
// the same principals can't oscillate this hash into a false rewrite.
|
|
3037
|
+
senderPolicy: normalizeSenderPolicyForHash(input.senderPolicy)
|
|
3008
3038
|
})
|
|
3009
3039
|
).digest("hex");
|
|
3010
3040
|
}
|
|
@@ -3421,7 +3451,7 @@ function planGlobalSkillSync(globalSkills, prevIds, hashOf, knownHash) {
|
|
|
3421
3451
|
}
|
|
3422
3452
|
|
|
3423
3453
|
// src/lib/manager/runtime.ts
|
|
3424
|
-
import { createHash as
|
|
3454
|
+
import { createHash as createHash6 } from "crypto";
|
|
3425
3455
|
import { readFileSync as readFileSync11, appendFileSync, mkdirSync as mkdirSync4, chmodSync, existsSync as existsSync4 } from "fs";
|
|
3426
3456
|
import { join as join11, dirname as dirname4 } from "path";
|
|
3427
3457
|
import { homedir as homedir5 } from "os";
|
|
@@ -3470,7 +3500,7 @@ function log(msg) {
|
|
|
3470
3500
|
}
|
|
3471
3501
|
}
|
|
3472
3502
|
function sha256(content) {
|
|
3473
|
-
return
|
|
3503
|
+
return createHash6("sha256").update(content, "utf8").digest("hex");
|
|
3474
3504
|
}
|
|
3475
3505
|
function hashFile(filePath) {
|
|
3476
3506
|
try {
|
|
@@ -3934,7 +3964,7 @@ function formatBoardForPrompt(items, template) {
|
|
|
3934
3964
|
}
|
|
3935
3965
|
|
|
3936
3966
|
// src/lib/manager/kanban/notify.ts
|
|
3937
|
-
import { createHash as
|
|
3967
|
+
import { createHash as createHash7 } from "crypto";
|
|
3938
3968
|
async function enqueueKanbanNotice(opts) {
|
|
3939
3969
|
try {
|
|
3940
3970
|
const res = await api.post(
|
|
@@ -3949,7 +3979,7 @@ async function enqueueKanbanNotice(opts) {
|
|
|
3949
3979
|
return res.ok === true;
|
|
3950
3980
|
} catch (err) {
|
|
3951
3981
|
const errText = err instanceof Error ? err.message : String(err);
|
|
3952
|
-
const errId =
|
|
3982
|
+
const errId = createHash7("sha256").update(errText).digest("hex").slice(0, 12);
|
|
3953
3983
|
log(`[kanban] notice enqueue failed for agent_id=${opts.agentId} error_id=${errId}`);
|
|
3954
3984
|
return false;
|
|
3955
3985
|
}
|
|
@@ -4316,7 +4346,7 @@ function deriveScheduledTaskNotify(task) {
|
|
|
4316
4346
|
}
|
|
4317
4347
|
|
|
4318
4348
|
// src/lib/manager/scheduler/runs.ts
|
|
4319
|
-
import { createHash as
|
|
4349
|
+
import { createHash as createHash8 } from "crypto";
|
|
4320
4350
|
async function startRun(opts) {
|
|
4321
4351
|
try {
|
|
4322
4352
|
const res = await api.post(
|
|
@@ -4326,7 +4356,7 @@ async function startRun(opts) {
|
|
|
4326
4356
|
return { run_id: res.run_id ?? null, kanban_item_id: res.kanban_item_id ?? null };
|
|
4327
4357
|
} catch (err) {
|
|
4328
4358
|
const errText = err instanceof Error ? err.message : String(err);
|
|
4329
|
-
const errId =
|
|
4359
|
+
const errId = createHash8("sha256").update(errText).digest("hex").slice(0, 12);
|
|
4330
4360
|
log(`[runs] start failed for agent_id=${opts.agent_id} source_type=${opts.source_type} error_id=${errId}`);
|
|
4331
4361
|
return { run_id: null, kanban_item_id: null };
|
|
4332
4362
|
}
|
|
@@ -4343,7 +4373,7 @@ async function finishRun(runId, outcome, options = {}) {
|
|
|
4343
4373
|
});
|
|
4344
4374
|
} catch (err) {
|
|
4345
4375
|
const errText = err instanceof Error ? err.message : String(err);
|
|
4346
|
-
const errId =
|
|
4376
|
+
const errId = createHash8("sha256").update(errText).digest("hex").slice(0, 12);
|
|
4347
4377
|
log(`[runs] finish failed for run_id=${runId} outcome=${outcome} error_id=${errId}`);
|
|
4348
4378
|
}
|
|
4349
4379
|
}
|
|
@@ -4360,7 +4390,7 @@ async function fetchPriorScheduledRuns(agentId, taskId) {
|
|
|
4360
4390
|
return rows.filter((r) => typeof r.output_text === "string" && r.output_text.length > 0).map((r) => ({ startedAt: r.started_at, output: r.output_text }));
|
|
4361
4391
|
} catch (err) {
|
|
4362
4392
|
const errText = err instanceof Error ? err.message : String(err);
|
|
4363
|
-
const errId =
|
|
4393
|
+
const errId = createHash8("sha256").update(errText).digest("hex").slice(0, 12);
|
|
4364
4394
|
log(`[runs] prior-runs lookup failed for task_id=${taskId} error_id=${errId}`);
|
|
4365
4395
|
return [];
|
|
4366
4396
|
}
|
|
@@ -4409,7 +4439,7 @@ function closeScheduledRunsForCode(codeName, outcome, reason) {
|
|
|
4409
4439
|
}
|
|
4410
4440
|
|
|
4411
4441
|
// src/lib/manager/scheduler/kanban-route.ts
|
|
4412
|
-
import { createHash as
|
|
4442
|
+
import { createHash as createHash9 } from "crypto";
|
|
4413
4443
|
|
|
4414
4444
|
// src/lib/delivery-schedule-link.ts
|
|
4415
4445
|
function envSuffixFor2(codeName) {
|
|
@@ -4841,24 +4871,24 @@ async function processClaudeTaskResult(codeName, agentId, templateId, rawOutput,
|
|
|
4841
4871
|
const assertion = parseDeliverAssertion(rawOutput);
|
|
4842
4872
|
if (!assertion.deliver) {
|
|
4843
4873
|
const trimmed = (rawOutput ?? "").trim();
|
|
4844
|
-
const outputHash = trimmed.length === 0 ? "empty" :
|
|
4874
|
+
const outputHash = trimmed.length === 0 ? "empty" : createHash9("sha256").update(trimmed).digest("hex").slice(0, 12);
|
|
4845
4875
|
log(`[claude-scheduler] Suppressed by delivery_policy=conditional for '${codeName}' (template=${templateId}, task=${delivery?.taskId ?? "n/a"}) \u2014 ${assertion.vacuous ? "deliver marker had a vacuous reason" : "no deliver marker"}; output_len=${trimmed.length} output_hash=${outputHash}`);
|
|
4846
4876
|
if (delivery?.mode === "announce" && delivery.to) {
|
|
4847
4877
|
await reportDeliveryStatus(agentId, delivery.taskId, { status: "skipped", error_code: "SUPPRESSED_BY_POLICY" });
|
|
4848
4878
|
}
|
|
4849
4879
|
return { ok: true };
|
|
4850
4880
|
}
|
|
4851
|
-
const reasonHash =
|
|
4881
|
+
const reasonHash = createHash9("sha256").update(assertion.reason ?? "").digest("hex").slice(0, 12);
|
|
4852
4882
|
log(`[claude-scheduler] Delivering conditional run for '${codeName}' (template=${templateId}, task=${delivery?.taskId ?? "n/a"}) \u2014 agent asserted a concrete trigger (reason_len=${(assertion.reason ?? "").length} reason_hash=${reasonHash})`);
|
|
4853
4883
|
rawOutput = assertion.deliverable;
|
|
4854
4884
|
}
|
|
4855
4885
|
const classification = classifyOutput(rawOutput);
|
|
4856
4886
|
if (classification.action === "suppress") {
|
|
4857
4887
|
const trimmed = (rawOutput ?? "").trim();
|
|
4858
|
-
const outputHash = trimmed.length === 0 ? "empty" :
|
|
4888
|
+
const outputHash = trimmed.length === 0 ? "empty" : createHash9("sha256").update(trimmed).digest("hex").slice(0, 12);
|
|
4859
4889
|
log(`[claude-scheduler] Suppressing delivery for '${codeName}' (template=${templateId}, task=${delivery?.taskId ?? "n/a"}) \u2014 output_len=${trimmed.length} output_hash=${outputHash}`);
|
|
4860
4890
|
if (classification.suppressedNotes) {
|
|
4861
|
-
const notesHash =
|
|
4891
|
+
const notesHash = createHash9("sha256").update(classification.suppressedNotes).digest("hex").slice(0, 12);
|
|
4862
4892
|
log(`[claude-scheduler] Suppressed notes for '${codeName}' (task=${delivery?.taskId ?? "n/a"}) \u2014 notes_len=${classification.suppressedNotes.length} notes_hash=${notesHash}`);
|
|
4863
4893
|
}
|
|
4864
4894
|
if (delivery?.mode === "announce" && delivery.to) {
|
|
@@ -4924,7 +4954,7 @@ async function processClaudeTaskResult(codeName, agentId, templateId, rawOutput,
|
|
|
4924
4954
|
}
|
|
4925
4955
|
|
|
4926
4956
|
// src/lib/manager/scheduler/execution.ts
|
|
4927
|
-
import { createHash as
|
|
4957
|
+
import { createHash as createHash10 } from "crypto";
|
|
4928
4958
|
import { homedir as homedir7 } from "os";
|
|
4929
4959
|
import { join as join14 } from "path";
|
|
4930
4960
|
function claudePidFilePath() {
|
|
@@ -4948,10 +4978,10 @@ function unregisterClaudeSpawn(pid) {
|
|
|
4948
4978
|
}
|
|
4949
4979
|
async function syncAndCheckClaudeScheduler(agent, tasks, boardItems, refreshData) {
|
|
4950
4980
|
const codeName = agent.code_name;
|
|
4951
|
-
const stableTasksHash =
|
|
4952
|
-
const boardHash = boardItems.length > 0 ?
|
|
4981
|
+
const stableTasksHash = createHash10("sha256").update(JSON.stringify(tasks)).digest("hex").slice(0, 16);
|
|
4982
|
+
const boardHash = boardItems.length > 0 ? createHash10("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";
|
|
4953
4983
|
const resolvedModels = resolveModelChain(refreshData);
|
|
4954
|
-
const modelsHash =
|
|
4984
|
+
const modelsHash = createHash10("sha256").update(JSON.stringify(resolvedModels)).digest("hex").slice(0, 16);
|
|
4955
4985
|
const combinedHash = `${stableTasksHash}:${boardHash}:${modelsHash}`;
|
|
4956
4986
|
const prevHash = agentState.knownTasksHashes.get(agent.agent_id);
|
|
4957
4987
|
if (combinedHash !== prevHash) {
|
|
@@ -6325,7 +6355,7 @@ var runningChannelSecretHashes = /* @__PURE__ */ new Map();
|
|
|
6325
6355
|
function projectMcpHash(_codeName, projectDir) {
|
|
6326
6356
|
try {
|
|
6327
6357
|
const raw = readFileSync14(join16(projectDir, ".mcp.json"), "utf-8");
|
|
6328
|
-
return
|
|
6358
|
+
return createHash11("sha256").update(canonicalJson(JSON.parse(raw))).digest("hex");
|
|
6329
6359
|
} catch {
|
|
6330
6360
|
return null;
|
|
6331
6361
|
}
|
|
@@ -6639,7 +6669,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
|
|
|
6639
6669
|
var lastVersionCheckAt = 0;
|
|
6640
6670
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
6641
6671
|
var lastResponsivenessProbeAt = 0;
|
|
6642
|
-
var agtCliVersion = true ? "0.28.
|
|
6672
|
+
var agtCliVersion = true ? "0.28.252" : "dev";
|
|
6643
6673
|
function resolveBrewPath(execFileSync2) {
|
|
6644
6674
|
try {
|
|
6645
6675
|
const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -7617,7 +7647,7 @@ async function pollCycle() {
|
|
|
7617
7647
|
claudeAuth = await detectClaudeAuth();
|
|
7618
7648
|
} catch (err) {
|
|
7619
7649
|
const errText = err instanceof Error ? err.message : String(err);
|
|
7620
|
-
const errId =
|
|
7650
|
+
const errId = createHash11("sha256").update(errText).digest("hex").slice(0, 12);
|
|
7621
7651
|
log(`Claude auth detection failed (error_id=${errId})`);
|
|
7622
7652
|
}
|
|
7623
7653
|
const hostHasClaudeCode = state6.agents.some(
|
|
@@ -8944,7 +8974,7 @@ async function processAgent(agent, agentStates) {
|
|
|
8944
8974
|
if (channelConfigConverged) {
|
|
8945
8975
|
const hasSenderPolicyChannel = currentChannelIds.has("slack") || currentChannelIds.has("msteams");
|
|
8946
8976
|
const senderPolicyForRestartHash = refreshData.sender_policy ?? null;
|
|
8947
|
-
const senderPolicyHash =
|
|
8977
|
+
const senderPolicyHash = computeSenderPolicyRestartHash(senderPolicyForRestartHash);
|
|
8948
8978
|
const prevSenderPolicyHash = agentState.knownSenderPolicyHashes.get(agent.agent_id);
|
|
8949
8979
|
const senderPolicyDecision = hasSenderPolicyChannel ? decideSenderPolicyRestart({
|
|
8950
8980
|
previousHash: prevSenderPolicyHash,
|
|
@@ -8986,7 +9016,7 @@ async function processAgent(agent, agentStates) {
|
|
|
8986
9016
|
const behaviourSubset = extractMsTeamsBehaviourSubset(
|
|
8987
9017
|
msteamsEntry?.config
|
|
8988
9018
|
);
|
|
8989
|
-
const behaviourHash =
|
|
9019
|
+
const behaviourHash = createHash11("sha256").update(canonicalJson(behaviourSubset)).digest("hex");
|
|
8990
9020
|
const prevBehaviourHash = agentState.knownMsTeamsBehaviourHashes.get(agent.agent_id);
|
|
8991
9021
|
const behaviourDecision = decideSenderPolicyRestart({
|
|
8992
9022
|
previousHash: prevBehaviourHash,
|
|
@@ -9033,7 +9063,7 @@ async function processAgent(agent, agentStates) {
|
|
|
9033
9063
|
const slackBehaviourSubset = extractSlackBehaviourSubset(
|
|
9034
9064
|
slackEntry?.config
|
|
9035
9065
|
);
|
|
9036
|
-
const slackBehaviourHash =
|
|
9066
|
+
const slackBehaviourHash = createHash11("sha256").update(canonicalJson(slackBehaviourSubset)).digest("hex");
|
|
9037
9067
|
const prevSlackBehaviourHash = agentState.knownSlackBehaviourHashes.get(agent.agent_id);
|
|
9038
9068
|
const slackBehaviourDecision = decideSenderPolicyRestart({
|
|
9039
9069
|
previousHash: prevSlackBehaviourHash,
|
|
@@ -9332,10 +9362,10 @@ async function processAgent(agent, agentStates) {
|
|
|
9332
9362
|
desiredEntries.push({ serverId, url, headers: mcpHeaders, name: tk.toolkit_name });
|
|
9333
9363
|
}
|
|
9334
9364
|
const hashBasis = desiredEntries.slice().sort((a, b) => a.serverId.localeCompare(b.serverId)).map((e) => {
|
|
9335
|
-
const headersHash =
|
|
9365
|
+
const headersHash = createHash11("sha256").update(canonicalJson(e.headers ?? {})).digest("hex").slice(0, 16);
|
|
9336
9366
|
return `${e.serverId}|${e.url}|${headersHash}`;
|
|
9337
9367
|
}).join("\n");
|
|
9338
|
-
const mcpHash =
|
|
9368
|
+
const mcpHash = createHash11("sha256").update(hashBasis).digest("hex").slice(0, 16);
|
|
9339
9369
|
const prevMcpHash = agentState.knownManagedMcpHashes.get(agent.agent_id);
|
|
9340
9370
|
const structureHash = managedMcpStructureHash(desiredEntries);
|
|
9341
9371
|
const prevStructureHash = agentState.knownManagedMcpStructure.get(agent.agent_id);
|
|
@@ -9350,7 +9380,7 @@ async function processAgent(agent, agentStates) {
|
|
|
9350
9380
|
if (mcpHash !== prevMcpHash) {
|
|
9351
9381
|
for (const e of desiredEntries) {
|
|
9352
9382
|
frameworkAdapter.writeMcpServer(agent.code_name, e.serverId, { url: e.url, headers: e.headers });
|
|
9353
|
-
const urlHash =
|
|
9383
|
+
const urlHash = createHash11("sha256").update(e.url).digest("hex").slice(0, 12);
|
|
9354
9384
|
log(`[managed-toolkit] ${agent.code_name}: wrote '${e.name}' (serverId=${e.serverId}, url_hash=${urlHash})`);
|
|
9355
9385
|
}
|
|
9356
9386
|
if (frameworkAdapter.removeMcpServer && frameworkAdapter.getMcpPath) {
|
|
@@ -9452,7 +9482,7 @@ async function processAgent(agent, agentStates) {
|
|
|
9452
9482
|
if (frameworkAdapter.installSkillFiles) {
|
|
9453
9483
|
const currentIntegrationSkillIds = /* @__PURE__ */ new Set();
|
|
9454
9484
|
const installedIntegrationSkills = [];
|
|
9455
|
-
const { createHash:
|
|
9485
|
+
const { createHash: createHash12 } = await import("crypto");
|
|
9456
9486
|
const refreshAny = refreshData;
|
|
9457
9487
|
const contexts = refreshAny.integration_contexts ?? refreshAny.plugin_contexts ?? [];
|
|
9458
9488
|
const contextBySlug = /* @__PURE__ */ new Map();
|
|
@@ -9481,7 +9511,7 @@ async function processAgent(agent, agentStates) {
|
|
|
9481
9511
|
)
|
|
9482
9512
|
}));
|
|
9483
9513
|
const bundle = buildIntegrationBundle(renderedScopes);
|
|
9484
|
-
const contentHash =
|
|
9514
|
+
const contentHash = createHash12("sha256").update(bundleFingerprint(bundle.files)).digest("hex").slice(0, 12);
|
|
9485
9515
|
const hashKey = `plugin-skill:${agent.agent_id}:${integrationSkillId}`;
|
|
9486
9516
|
if (agentState.knownSkillHashes.get(hashKey) === contentHash) continue;
|
|
9487
9517
|
frameworkAdapter.installSkillFiles(agent.code_name, integrationSkillId, bundle.files);
|
|
@@ -9538,7 +9568,7 @@ async function processAgent(agent, agentStates) {
|
|
|
9538
9568
|
const plan = planGlobalSkillSync(
|
|
9539
9569
|
[...refreshAny.global_skills ?? [], ...refreshAny.shared_skills ?? []],
|
|
9540
9570
|
agentState.knownGlobalSkillIds.get(agent.agent_id) ?? /* @__PURE__ */ new Set(),
|
|
9541
|
-
(content) =>
|
|
9571
|
+
(content) => createHash12("sha256").update(content).digest("hex").slice(0, 12),
|
|
9542
9572
|
(skillId) => agentState.knownSkillHashes.get(`global-skill:${agent.agent_id}:${skillId}`)
|
|
9543
9573
|
);
|
|
9544
9574
|
for (const { skillId, content, hash } of plan.installs) {
|
|
@@ -9581,7 +9611,7 @@ async function processAgent(agent, agentStates) {
|
|
|
9581
9611
|
const slug = hook.integration_slug ?? hook.plugin_slug;
|
|
9582
9612
|
if (!slug) continue;
|
|
9583
9613
|
try {
|
|
9584
|
-
const scriptHash =
|
|
9614
|
+
const scriptHash = createHash12("sha256").update(hook.script).digest("hex").slice(0, 12);
|
|
9585
9615
|
const hookKey = `${agent.agent_id}:${frameworkAdapter.id}:plugin-hook:${slug}:on_install`;
|
|
9586
9616
|
if (agentState.knownSkillHashes.get(hookKey) === scriptHash) continue;
|
|
9587
9617
|
const result = await frameworkAdapter.executePluginHook({
|
|
@@ -9596,9 +9626,9 @@ async function processAgent(agent, agentStates) {
|
|
|
9596
9626
|
} else if (result.timedOut) {
|
|
9597
9627
|
log(`Integration hook on_install '${slug}' TIMED OUT for '${agent.code_name}' after ${result.durationMs}ms`);
|
|
9598
9628
|
} else {
|
|
9599
|
-
const stderrHash =
|
|
9629
|
+
const stderrHash = createHash12("sha256").update(result.stderr).digest("hex").slice(0, 12);
|
|
9600
9630
|
const missingCmd = result.exitCode === 127 ? extractCommandNotFound(result.stderr) : null;
|
|
9601
|
-
const missingCmdHash = missingCmd ?
|
|
9631
|
+
const missingCmdHash = missingCmd ? createHash12("sha256").update(missingCmd).digest("hex").slice(0, 8) : null;
|
|
9602
9632
|
log(
|
|
9603
9633
|
`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}]`
|
|
9604
9634
|
);
|
|
@@ -10226,7 +10256,7 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
|
|
|
10226
10256
|
const ctx = getLastFailureContext(codeName);
|
|
10227
10257
|
const recovery = prepareForRespawn(codeName);
|
|
10228
10258
|
const tailSummary = !ctx.tail ? "" : KNOWN_SAFE_TAIL_SIGNATURES.has(ctx.signature) ? `; last pane output (${PANE_TAIL_PREVIEW_LINES} of ~20 lines):
|
|
10229
|
-
${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${
|
|
10259
|
+
${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash11("sha256").update(ctx.tail).digest("hex").slice(0, 12)} (raw at ~/.augmented/${codeName}/pane.log)`;
|
|
10230
10260
|
const sigSummary = ctx.signature !== "unknown" ? `; signature=${ctx.signature}` : "";
|
|
10231
10261
|
const recoverySummary = recovery ? `; recovery=${recovery}` : "";
|
|
10232
10262
|
log(
|
|
@@ -10240,7 +10270,7 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash10("sha256")
|
|
|
10240
10270
|
);
|
|
10241
10271
|
getHostId().then((hostId) => {
|
|
10242
10272
|
if (!hostId) return;
|
|
10243
|
-
const paneTailHash = zombie.paneTail ? `sha256:${
|
|
10273
|
+
const paneTailHash = zombie.paneTail ? `sha256:${createHash11("sha256").update(zombie.paneTail).digest("hex").slice(0, 12)}` : null;
|
|
10244
10274
|
return api.post("/host/events", {
|
|
10245
10275
|
host_id: hostId,
|
|
10246
10276
|
agent_code_name: codeName,
|
|
@@ -10376,7 +10406,7 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash10("sha256")
|
|
|
10376
10406
|
if (!claudeAuthTupleBySession.has(codeName)) {
|
|
10377
10407
|
claudeAuthTupleBySession.set(codeName, currentAuthTuple);
|
|
10378
10408
|
}
|
|
10379
|
-
const stableTasksHash =
|
|
10409
|
+
const stableTasksHash = createHash11("sha256").update(JSON.stringify(tasks)).digest("hex").slice(0, 16);
|
|
10380
10410
|
const prevHash = agentState.knownTasksHashes.get(agent.agent_id);
|
|
10381
10411
|
if (stableTasksHash !== prevHash) {
|
|
10382
10412
|
const taskInputs = tasks.map((t) => buildSchedulerTaskInput(t));
|
|
@@ -11297,7 +11327,7 @@ async function syncMemories(agent, configDir, log2) {
|
|
|
11297
11327
|
if (!file.endsWith(".md")) continue;
|
|
11298
11328
|
try {
|
|
11299
11329
|
const raw = readFileSync14(join16(memoryDir, file), "utf-8");
|
|
11300
|
-
const fileHash =
|
|
11330
|
+
const fileHash = createHash11("sha256").update(raw).digest("hex").slice(0, 16);
|
|
11301
11331
|
currentHashes.set(file, fileHash);
|
|
11302
11332
|
if (prevHashes.get(file) === fileHash) continue;
|
|
11303
11333
|
const parsed = parseMemoryFile(raw, file.replace(/\.md$/, ""));
|
|
@@ -11335,14 +11365,14 @@ async function syncMemories(agent, configDir, log2) {
|
|
|
11335
11365
|
}
|
|
11336
11366
|
async function downloadMemories(agent, memoryDir, log2, { force }) {
|
|
11337
11367
|
const localFiles = existsSync8(memoryDir) ? readdirSync5(memoryDir).filter((f) => f.endsWith(".md")).sort() : [];
|
|
11338
|
-
const localListHash =
|
|
11368
|
+
const localListHash = createHash11("sha256").update(localFiles.join(",")).digest("hex").slice(0, 16);
|
|
11339
11369
|
const prevLocalHash = lastLocalFileHash.get(agent.agent_id);
|
|
11340
11370
|
const prevDownload = lastDownloadHash.get(agent.agent_id);
|
|
11341
11371
|
try {
|
|
11342
11372
|
const dbMemories = await api.post("/host/memories", {
|
|
11343
11373
|
agent_id: agent.agent_id
|
|
11344
11374
|
});
|
|
11345
|
-
const responseHash =
|
|
11375
|
+
const responseHash = createHash11("sha256").update(JSON.stringify(dbMemories.memories ?? [])).digest("hex").slice(0, 16);
|
|
11346
11376
|
if (!force && prevDownload && prevLocalHash === localListHash && lastDownloadHash.get(agent.agent_id) === responseHash) {
|
|
11347
11377
|
return true;
|
|
11348
11378
|
}
|
|
@@ -11381,7 +11411,7 @@ ${mem.content}
|
|
|
11381
11411
|
}
|
|
11382
11412
|
if (written > 0 || overwritten > 0) {
|
|
11383
11413
|
const updatedFiles = readdirSync5(memoryDir).filter((f) => f.endsWith(".md")).sort();
|
|
11384
|
-
lastLocalFileHash.set(agent.agent_id,
|
|
11414
|
+
lastLocalFileHash.set(agent.agent_id, createHash11("sha256").update(updatedFiles.join(",")).digest("hex").slice(0, 16));
|
|
11385
11415
|
log2(`Memory download for '${agent.code_name}': wrote ${written} new, overwrote ${overwritten} stale`);
|
|
11386
11416
|
}
|
|
11387
11417
|
}
|
|
@@ -11794,7 +11824,7 @@ function deployMcpAssets() {
|
|
|
11794
11824
|
const fileHash = (p) => {
|
|
11795
11825
|
try {
|
|
11796
11826
|
if (!existsSync8(p)) return null;
|
|
11797
|
-
return
|
|
11827
|
+
return createHash11("sha256").update(readFileSync14(p)).digest("hex");
|
|
11798
11828
|
} catch {
|
|
11799
11829
|
return null;
|
|
11800
11830
|
}
|