@integrity-labs/agt-cli 0.28.89 → 0.28.90
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
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
success,
|
|
38
38
|
table,
|
|
39
39
|
warn
|
|
40
|
-
} from "../chunk-
|
|
40
|
+
} from "../chunk-BNQ5JQGO.js";
|
|
41
41
|
import {
|
|
42
42
|
CHANNEL_REGISTRY,
|
|
43
43
|
DEPLOYMENT_TEMPLATES,
|
|
@@ -4777,7 +4777,7 @@ import { execFileSync, execSync } from "child_process";
|
|
|
4777
4777
|
import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
|
|
4778
4778
|
import chalk18 from "chalk";
|
|
4779
4779
|
import ora16 from "ora";
|
|
4780
|
-
var cliVersion = true ? "0.28.
|
|
4780
|
+
var cliVersion = true ? "0.28.90" : "dev";
|
|
4781
4781
|
async function fetchLatestVersion() {
|
|
4782
4782
|
const host2 = getHost();
|
|
4783
4783
|
if (!host2) return null;
|
|
@@ -5791,7 +5791,7 @@ function handleError(err) {
|
|
|
5791
5791
|
}
|
|
5792
5792
|
|
|
5793
5793
|
// src/bin/agt.ts
|
|
5794
|
-
var cliVersion2 = true ? "0.28.
|
|
5794
|
+
var cliVersion2 = true ? "0.28.90" : "dev";
|
|
5795
5795
|
var program = new Command();
|
|
5796
5796
|
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");
|
|
5797
5797
|
program.hook("preAction", async (thisCommand, actionCommand) => {
|
|
@@ -7533,7 +7533,7 @@ function requireHost() {
|
|
|
7533
7533
|
}
|
|
7534
7534
|
|
|
7535
7535
|
// src/lib/api-client.ts
|
|
7536
|
-
var agtCliVersion = true ? "0.28.
|
|
7536
|
+
var agtCliVersion = true ? "0.28.90" : "dev";
|
|
7537
7537
|
var lastConfigHash = null;
|
|
7538
7538
|
function setConfigHash(hash) {
|
|
7539
7539
|
lastConfigHash = hash && hash.length > 0 ? hash : null;
|
|
@@ -8830,4 +8830,4 @@ export {
|
|
|
8830
8830
|
managerInstallSystemUnitCommand,
|
|
8831
8831
|
managerUninstallSystemUnitCommand
|
|
8832
8832
|
};
|
|
8833
|
-
//# sourceMappingURL=chunk-
|
|
8833
|
+
//# sourceMappingURL=chunk-BNQ5JQGO.js.map
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
requireHost,
|
|
29
29
|
safeWriteJsonAtomic,
|
|
30
30
|
setConfigHash
|
|
31
|
-
} from "../chunk-
|
|
31
|
+
} from "../chunk-BNQ5JQGO.js";
|
|
32
32
|
import {
|
|
33
33
|
getProjectDir as getProjectDir2,
|
|
34
34
|
getReadyTasks,
|
|
@@ -108,7 +108,7 @@ import {
|
|
|
108
108
|
} from "../chunk-XWVM4KPK.js";
|
|
109
109
|
|
|
110
110
|
// src/lib/manager-worker.ts
|
|
111
|
-
import { createHash as
|
|
111
|
+
import { createHash as createHash9 } from "crypto";
|
|
112
112
|
import { readFileSync as readFileSync15, writeFileSync as writeFileSync6, mkdirSync as mkdirSync6, existsSync as existsSync9, rmSync as rmSync4, readdirSync as readdirSync5, statSync as statSync4, unlinkSync, copyFileSync } from "fs";
|
|
113
113
|
import { execFileSync as syncExecFile } from "child_process";
|
|
114
114
|
import { join as join16, dirname as dirname5 } from "path";
|
|
@@ -3380,6 +3380,23 @@ function normalize(value) {
|
|
|
3380
3380
|
return sorted;
|
|
3381
3381
|
}
|
|
3382
3382
|
|
|
3383
|
+
// src/lib/channel-config-hash.ts
|
|
3384
|
+
import { createHash as createHash4 } from "crypto";
|
|
3385
|
+
var CHANNEL_WRITE_VERSION = 9;
|
|
3386
|
+
function computeChannelConfigHash(input) {
|
|
3387
|
+
return createHash4("sha256").update(
|
|
3388
|
+
canonicalJson({
|
|
3389
|
+
writeVersion: CHANNEL_WRITE_VERSION,
|
|
3390
|
+
cliVersion: input.cliVersion,
|
|
3391
|
+
config: input.config,
|
|
3392
|
+
team: input.team,
|
|
3393
|
+
peers: input.peers,
|
|
3394
|
+
sessionMode: input.sessionMode ?? null,
|
|
3395
|
+
senderPolicy: input.senderPolicy
|
|
3396
|
+
})
|
|
3397
|
+
).digest("hex");
|
|
3398
|
+
}
|
|
3399
|
+
|
|
3383
3400
|
// src/lib/channel-hash-cache.ts
|
|
3384
3401
|
import { existsSync as existsSync3, readFileSync as readFileSync10, writeFileSync as writeFileSync4 } from "fs";
|
|
3385
3402
|
import { join as join10 } from "path";
|
|
@@ -3792,7 +3809,7 @@ function planGlobalSkillSync(globalSkills, prevIds, hashOf, knownHash) {
|
|
|
3792
3809
|
}
|
|
3793
3810
|
|
|
3794
3811
|
// src/lib/manager/runtime.ts
|
|
3795
|
-
import { createHash as
|
|
3812
|
+
import { createHash as createHash5 } from "crypto";
|
|
3796
3813
|
import { readFileSync as readFileSync11, appendFileSync, mkdirSync as mkdirSync4, chmodSync, existsSync as existsSync4 } from "fs";
|
|
3797
3814
|
import { join as join11, dirname as dirname4 } from "path";
|
|
3798
3815
|
import { homedir as homedir5 } from "os";
|
|
@@ -3841,7 +3858,7 @@ function log(msg) {
|
|
|
3841
3858
|
}
|
|
3842
3859
|
}
|
|
3843
3860
|
function sha256(content) {
|
|
3844
|
-
return
|
|
3861
|
+
return createHash5("sha256").update(content, "utf8").digest("hex");
|
|
3845
3862
|
}
|
|
3846
3863
|
function hashFile(filePath) {
|
|
3847
3864
|
try {
|
|
@@ -4609,7 +4626,7 @@ function isScheduledViaKanbanEnabled() {
|
|
|
4609
4626
|
}
|
|
4610
4627
|
|
|
4611
4628
|
// src/lib/manager/scheduler/runs.ts
|
|
4612
|
-
import { createHash as
|
|
4629
|
+
import { createHash as createHash6 } from "crypto";
|
|
4613
4630
|
async function startRun(opts) {
|
|
4614
4631
|
try {
|
|
4615
4632
|
const res = await api.post(
|
|
@@ -4619,7 +4636,7 @@ async function startRun(opts) {
|
|
|
4619
4636
|
return { run_id: res.run_id ?? null, kanban_item_id: res.kanban_item_id ?? null };
|
|
4620
4637
|
} catch (err) {
|
|
4621
4638
|
const errText = err instanceof Error ? err.message : String(err);
|
|
4622
|
-
const errId =
|
|
4639
|
+
const errId = createHash6("sha256").update(errText).digest("hex").slice(0, 12);
|
|
4623
4640
|
log(`[runs] start failed for agent_id=${opts.agent_id} source_type=${opts.source_type} error_id=${errId}`);
|
|
4624
4641
|
return { run_id: null, kanban_item_id: null };
|
|
4625
4642
|
}
|
|
@@ -4636,7 +4653,7 @@ async function finishRun(runId, outcome, options = {}) {
|
|
|
4636
4653
|
});
|
|
4637
4654
|
} catch (err) {
|
|
4638
4655
|
const errText = err instanceof Error ? err.message : String(err);
|
|
4639
|
-
const errId =
|
|
4656
|
+
const errId = createHash6("sha256").update(errText).digest("hex").slice(0, 12);
|
|
4640
4657
|
log(`[runs] finish failed for run_id=${runId} outcome=${outcome} error_id=${errId}`);
|
|
4641
4658
|
}
|
|
4642
4659
|
}
|
|
@@ -4653,7 +4670,7 @@ async function fetchPriorScheduledRuns(agentId, taskId) {
|
|
|
4653
4670
|
return rows.filter((r) => typeof r.output_text === "string" && r.output_text.length > 0).map((r) => ({ startedAt: r.started_at, output: r.output_text }));
|
|
4654
4671
|
} catch (err) {
|
|
4655
4672
|
const errText = err instanceof Error ? err.message : String(err);
|
|
4656
|
-
const errId =
|
|
4673
|
+
const errId = createHash6("sha256").update(errText).digest("hex").slice(0, 12);
|
|
4657
4674
|
log(`[runs] prior-runs lookup failed for task_id=${taskId} error_id=${errId}`);
|
|
4658
4675
|
return [];
|
|
4659
4676
|
}
|
|
@@ -4702,7 +4719,7 @@ function closeScheduledRunsForCode(codeName, outcome, reason) {
|
|
|
4702
4719
|
}
|
|
4703
4720
|
|
|
4704
4721
|
// src/lib/manager/scheduler/kanban-route.ts
|
|
4705
|
-
import { createHash as
|
|
4722
|
+
import { createHash as createHash7 } from "crypto";
|
|
4706
4723
|
|
|
4707
4724
|
// src/lib/delivery-schedule-link.ts
|
|
4708
4725
|
function envSuffixFor2(codeName) {
|
|
@@ -5117,10 +5134,10 @@ async function processClaudeTaskResult(codeName, agentId, templateId, rawOutput,
|
|
|
5117
5134
|
const classification = classifyOutput(rawOutput);
|
|
5118
5135
|
if (classification.action === "suppress") {
|
|
5119
5136
|
const trimmed = (rawOutput ?? "").trim();
|
|
5120
|
-
const outputHash = trimmed.length === 0 ? "empty" :
|
|
5137
|
+
const outputHash = trimmed.length === 0 ? "empty" : createHash7("sha256").update(trimmed).digest("hex").slice(0, 12);
|
|
5121
5138
|
log(`[claude-scheduler] Suppressing delivery for '${codeName}' (template=${templateId}, task=${delivery?.taskId ?? "n/a"}) \u2014 output_len=${trimmed.length} output_hash=${outputHash}`);
|
|
5122
5139
|
if (classification.suppressedNotes) {
|
|
5123
|
-
const notesHash =
|
|
5140
|
+
const notesHash = createHash7("sha256").update(classification.suppressedNotes).digest("hex").slice(0, 12);
|
|
5124
5141
|
log(`[claude-scheduler] Suppressed notes for '${codeName}' (task=${delivery?.taskId ?? "n/a"}) \u2014 notes_len=${classification.suppressedNotes.length} notes_hash=${notesHash}`);
|
|
5125
5142
|
}
|
|
5126
5143
|
if (delivery?.mode === "announce" && delivery.to) {
|
|
@@ -5186,7 +5203,7 @@ async function processClaudeTaskResult(codeName, agentId, templateId, rawOutput,
|
|
|
5186
5203
|
}
|
|
5187
5204
|
|
|
5188
5205
|
// src/lib/manager/scheduler/execution.ts
|
|
5189
|
-
import { createHash as
|
|
5206
|
+
import { createHash as createHash8 } from "crypto";
|
|
5190
5207
|
import { readFileSync as readFileSync13, existsSync as existsSync7 } from "fs";
|
|
5191
5208
|
import { homedir as homedir7 } from "os";
|
|
5192
5209
|
import { join as join14 } from "path";
|
|
@@ -5211,10 +5228,10 @@ function unregisterClaudeSpawn(pid) {
|
|
|
5211
5228
|
}
|
|
5212
5229
|
async function syncAndCheckClaudeScheduler(agent, tasks, boardItems, refreshData) {
|
|
5213
5230
|
const codeName = agent.code_name;
|
|
5214
|
-
const stableTasksHash =
|
|
5215
|
-
const boardHash = boardItems.length > 0 ?
|
|
5231
|
+
const stableTasksHash = createHash8("sha256").update(JSON.stringify(tasks)).digest("hex").slice(0, 16);
|
|
5232
|
+
const boardHash = boardItems.length > 0 ? createHash8("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";
|
|
5216
5233
|
const resolvedModels = resolveModelChain(refreshData);
|
|
5217
|
-
const modelsHash =
|
|
5234
|
+
const modelsHash = createHash8("sha256").update(JSON.stringify(resolvedModels)).digest("hex").slice(0, 16);
|
|
5218
5235
|
const combinedHash = `${stableTasksHash}:${boardHash}:${modelsHash}`;
|
|
5219
5236
|
const prevHash = agentState.knownTasksHashes.get(agent.agent_id);
|
|
5220
5237
|
if (combinedHash !== prevHash) {
|
|
@@ -6640,7 +6657,7 @@ var runningChannelSecretHashes = /* @__PURE__ */ new Map();
|
|
|
6640
6657
|
function projectMcpHash(_codeName, projectDir) {
|
|
6641
6658
|
try {
|
|
6642
6659
|
const raw = readFileSync15(join16(projectDir, ".mcp.json"), "utf-8");
|
|
6643
|
-
return
|
|
6660
|
+
return createHash9("sha256").update(canonicalJson(JSON.parse(raw))).digest("hex");
|
|
6644
6661
|
} catch {
|
|
6645
6662
|
return null;
|
|
6646
6663
|
}
|
|
@@ -6893,7 +6910,7 @@ var cachedMaintenanceWindow = null;
|
|
|
6893
6910
|
var lastVersionCheckAt = 0;
|
|
6894
6911
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
6895
6912
|
var lastResponsivenessProbeAt = 0;
|
|
6896
|
-
var agtCliVersion = true ? "0.28.
|
|
6913
|
+
var agtCliVersion = true ? "0.28.90" : "dev";
|
|
6897
6914
|
function resolveBrewPath(execFileSync4) {
|
|
6898
6915
|
try {
|
|
6899
6916
|
const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -8034,7 +8051,7 @@ async function pollCycle() {
|
|
|
8034
8051
|
claudeAuth = await detectClaudeAuth();
|
|
8035
8052
|
} catch (err) {
|
|
8036
8053
|
const errText = err instanceof Error ? err.message : String(err);
|
|
8037
|
-
const errId =
|
|
8054
|
+
const errId = createHash9("sha256").update(errText).digest("hex").slice(0, 12);
|
|
8038
8055
|
log(`Claude auth detection failed (error_id=${errId})`);
|
|
8039
8056
|
}
|
|
8040
8057
|
const hostHasClaudeCode = state6.agents.some(
|
|
@@ -9118,17 +9135,14 @@ async function processAgent(agent, agentStates) {
|
|
|
9118
9135
|
const peersForHash = channelId === "telegram" ? extractCharterTelegramPeers(refreshData.charter?.raw_content ?? "", gateContext) : channelId === "slack" ? extractCharterSlackPeers(refreshData.charter?.raw_content ?? "", gateContext) : null;
|
|
9119
9136
|
const sessionModeForHash = refreshData.agent.session_mode;
|
|
9120
9137
|
const senderPolicyForHash = refreshData.sender_policy ?? null;
|
|
9121
|
-
const
|
|
9122
|
-
|
|
9123
|
-
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
|
|
9129
|
-
senderPolicy: senderPolicyForHash
|
|
9130
|
-
})
|
|
9131
|
-
).digest("hex");
|
|
9138
|
+
const configHash = computeChannelConfigHash({
|
|
9139
|
+
cliVersion: agtCliVersion,
|
|
9140
|
+
config: entry.config,
|
|
9141
|
+
team: teamSettingsForHash,
|
|
9142
|
+
peers: peersForHash,
|
|
9143
|
+
sessionMode: sessionModeForHash,
|
|
9144
|
+
senderPolicy: senderPolicyForHash
|
|
9145
|
+
});
|
|
9132
9146
|
const cacheKey = `${agent.agent_id}:${channelId}`;
|
|
9133
9147
|
let onDiskPresent = true;
|
|
9134
9148
|
try {
|
|
@@ -9257,7 +9271,7 @@ async function processAgent(agent, agentStates) {
|
|
|
9257
9271
|
if (channelConfigConverged) {
|
|
9258
9272
|
const hasSenderPolicyChannel = currentChannelIds.has("slack") || currentChannelIds.has("msteams");
|
|
9259
9273
|
const senderPolicyForRestartHash = refreshData.sender_policy ?? null;
|
|
9260
|
-
const senderPolicyHash =
|
|
9274
|
+
const senderPolicyHash = createHash9("sha256").update(canonicalJson({ senderPolicy: senderPolicyForRestartHash })).digest("hex");
|
|
9261
9275
|
const prevSenderPolicyHash = agentState.knownSenderPolicyHashes.get(agent.agent_id);
|
|
9262
9276
|
const senderPolicyDecision = hasSenderPolicyChannel ? decideSenderPolicyRestart({
|
|
9263
9277
|
previousHash: prevSenderPolicyHash,
|
|
@@ -9299,7 +9313,7 @@ async function processAgent(agent, agentStates) {
|
|
|
9299
9313
|
const behaviourSubset = extractMsTeamsBehaviourSubset(
|
|
9300
9314
|
msteamsEntry?.config
|
|
9301
9315
|
);
|
|
9302
|
-
const behaviourHash =
|
|
9316
|
+
const behaviourHash = createHash9("sha256").update(canonicalJson(behaviourSubset)).digest("hex");
|
|
9303
9317
|
const prevBehaviourHash = agentState.knownMsTeamsBehaviourHashes.get(agent.agent_id);
|
|
9304
9318
|
const behaviourDecision = decideSenderPolicyRestart({
|
|
9305
9319
|
previousHash: prevBehaviourHash,
|
|
@@ -9346,7 +9360,7 @@ async function processAgent(agent, agentStates) {
|
|
|
9346
9360
|
const slackBehaviourSubset = extractSlackBehaviourSubset(
|
|
9347
9361
|
slackEntry?.config
|
|
9348
9362
|
);
|
|
9349
|
-
const slackBehaviourHash =
|
|
9363
|
+
const slackBehaviourHash = createHash9("sha256").update(canonicalJson(slackBehaviourSubset)).digest("hex");
|
|
9350
9364
|
const prevSlackBehaviourHash = agentState.knownSlackBehaviourHashes.get(agent.agent_id);
|
|
9351
9365
|
const slackBehaviourDecision = decideSenderPolicyRestart({
|
|
9352
9366
|
previousHash: prevSlackBehaviourHash,
|
|
@@ -9590,10 +9604,10 @@ async function processAgent(agent, agentStates) {
|
|
|
9590
9604
|
desiredEntries.push({ serverId, url, headers: mcpHeaders, name: tk.toolkit_name });
|
|
9591
9605
|
}
|
|
9592
9606
|
const hashBasis = desiredEntries.slice().sort((a, b) => a.serverId.localeCompare(b.serverId)).map((e) => {
|
|
9593
|
-
const headersHash =
|
|
9607
|
+
const headersHash = createHash9("sha256").update(canonicalJson(e.headers ?? {})).digest("hex").slice(0, 16);
|
|
9594
9608
|
return `${e.serverId}|${e.url}|${headersHash}`;
|
|
9595
9609
|
}).join("\n");
|
|
9596
|
-
const mcpHash =
|
|
9610
|
+
const mcpHash = createHash9("sha256").update(hashBasis).digest("hex").slice(0, 16);
|
|
9597
9611
|
const prevMcpHash = agentState.knownManagedMcpHashes.get(agent.agent_id);
|
|
9598
9612
|
const structureHash = managedMcpStructureHash(desiredEntries);
|
|
9599
9613
|
const prevStructureHash = agentState.knownManagedMcpStructure.get(agent.agent_id);
|
|
@@ -9608,7 +9622,7 @@ async function processAgent(agent, agentStates) {
|
|
|
9608
9622
|
if (mcpHash !== prevMcpHash) {
|
|
9609
9623
|
for (const e of desiredEntries) {
|
|
9610
9624
|
frameworkAdapter.writeMcpServer(agent.code_name, e.serverId, { url: e.url, headers: e.headers });
|
|
9611
|
-
const urlHash =
|
|
9625
|
+
const urlHash = createHash9("sha256").update(e.url).digest("hex").slice(0, 12);
|
|
9612
9626
|
log(`[managed-toolkit] ${agent.code_name}: wrote '${e.name}' (serverId=${e.serverId}, url_hash=${urlHash})`);
|
|
9613
9627
|
}
|
|
9614
9628
|
if (frameworkAdapter.removeMcpServer && frameworkAdapter.getMcpPath) {
|
|
@@ -9742,7 +9756,7 @@ async function processAgent(agent, agentStates) {
|
|
|
9742
9756
|
if (frameworkAdapter.installSkillFiles) {
|
|
9743
9757
|
const currentIntegrationSkillIds = /* @__PURE__ */ new Set();
|
|
9744
9758
|
const installedIntegrationSkills = [];
|
|
9745
|
-
const { createHash:
|
|
9759
|
+
const { createHash: createHash10 } = await import("crypto");
|
|
9746
9760
|
const refreshAny = refreshData;
|
|
9747
9761
|
const contexts = refreshAny.integration_contexts ?? refreshAny.plugin_contexts ?? [];
|
|
9748
9762
|
const contextBySlug = /* @__PURE__ */ new Map();
|
|
@@ -9771,7 +9785,7 @@ async function processAgent(agent, agentStates) {
|
|
|
9771
9785
|
)
|
|
9772
9786
|
}));
|
|
9773
9787
|
const bundle = buildIntegrationBundle(renderedScopes);
|
|
9774
|
-
const contentHash =
|
|
9788
|
+
const contentHash = createHash10("sha256").update(bundleFingerprint(bundle.files)).digest("hex").slice(0, 12);
|
|
9775
9789
|
const hashKey = `plugin-skill:${agent.agent_id}:${integrationSkillId}`;
|
|
9776
9790
|
if (agentState.knownSkillHashes.get(hashKey) === contentHash) continue;
|
|
9777
9791
|
frameworkAdapter.installSkillFiles(agent.code_name, integrationSkillId, bundle.files);
|
|
@@ -9830,7 +9844,7 @@ async function processAgent(agent, agentStates) {
|
|
|
9830
9844
|
const plan = planGlobalSkillSync(
|
|
9831
9845
|
refreshAny.global_skills ?? [],
|
|
9832
9846
|
agentState.knownGlobalSkillIds.get(agent.agent_id) ?? /* @__PURE__ */ new Set(),
|
|
9833
|
-
(content) =>
|
|
9847
|
+
(content) => createHash10("sha256").update(content).digest("hex").slice(0, 12),
|
|
9834
9848
|
(skillId) => agentState.knownSkillHashes.get(`global-skill:${agent.agent_id}:${skillId}`)
|
|
9835
9849
|
);
|
|
9836
9850
|
for (const { skillId, content, hash } of plan.installs) {
|
|
@@ -9874,7 +9888,7 @@ async function processAgent(agent, agentStates) {
|
|
|
9874
9888
|
const slug = hook.integration_slug ?? hook.plugin_slug;
|
|
9875
9889
|
if (!slug) continue;
|
|
9876
9890
|
try {
|
|
9877
|
-
const scriptHash =
|
|
9891
|
+
const scriptHash = createHash10("sha256").update(hook.script).digest("hex").slice(0, 12);
|
|
9878
9892
|
const hookKey = `${agent.agent_id}:${frameworkAdapter.id}:plugin-hook:${slug}:on_install`;
|
|
9879
9893
|
if (agentState.knownSkillHashes.get(hookKey) === scriptHash) continue;
|
|
9880
9894
|
const result = await frameworkAdapter.executePluginHook({
|
|
@@ -9889,9 +9903,9 @@ async function processAgent(agent, agentStates) {
|
|
|
9889
9903
|
} else if (result.timedOut) {
|
|
9890
9904
|
log(`Integration hook on_install '${slug}' TIMED OUT for '${agent.code_name}' after ${result.durationMs}ms`);
|
|
9891
9905
|
} else {
|
|
9892
|
-
const stderrHash =
|
|
9906
|
+
const stderrHash = createHash10("sha256").update(result.stderr).digest("hex").slice(0, 12);
|
|
9893
9907
|
const missingCmd = result.exitCode === 127 ? extractCommandNotFound(result.stderr) : null;
|
|
9894
|
-
const missingCmdHash = missingCmd ?
|
|
9908
|
+
const missingCmdHash = missingCmd ? createHash10("sha256").update(missingCmd).digest("hex").slice(0, 8) : null;
|
|
9895
9909
|
log(
|
|
9896
9910
|
`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}]`
|
|
9897
9911
|
);
|
|
@@ -10166,10 +10180,10 @@ async function processAgent(agent, agentStates) {
|
|
|
10166
10180
|
} else if (agentFw === "claude-code" && tasks.length > 0) {
|
|
10167
10181
|
await syncAndCheckClaudeScheduler(agent, tasks, boardItems, refreshData);
|
|
10168
10182
|
} else if (frameworkAdapter.syncScheduledTasks && gatewayRunning && gatewayPort) {
|
|
10169
|
-
const stableTasksHash =
|
|
10170
|
-
const boardHash = boardItems.length > 0 ?
|
|
10183
|
+
const stableTasksHash = createHash9("sha256").update(JSON.stringify(tasks)).digest("hex").slice(0, 16);
|
|
10184
|
+
const boardHash = boardItems.length > 0 ? createHash9("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";
|
|
10171
10185
|
const resolvedModels = resolveModelChain(refreshData);
|
|
10172
|
-
const modelsHash =
|
|
10186
|
+
const modelsHash = createHash9("sha256").update(JSON.stringify(resolvedModels)).digest("hex").slice(0, 16);
|
|
10173
10187
|
const combinedHash = `${stableTasksHash}:${boardHash}:${modelsHash}`;
|
|
10174
10188
|
const prevTasksHash = agentState.knownTasksHashes.get(agent.agent_id);
|
|
10175
10189
|
if (combinedHash !== prevTasksHash) {
|
|
@@ -10695,7 +10709,7 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
|
|
|
10695
10709
|
const ctx = getLastFailureContext(codeName);
|
|
10696
10710
|
const recovery = prepareForRespawn(codeName);
|
|
10697
10711
|
const tailSummary = !ctx.tail ? "" : KNOWN_SAFE_TAIL_SIGNATURES.has(ctx.signature) ? `; last pane output (${PANE_TAIL_PREVIEW_LINES} of ~20 lines):
|
|
10698
|
-
${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${
|
|
10712
|
+
${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash9("sha256").update(ctx.tail).digest("hex").slice(0, 12)} (raw at ~/.augmented/${codeName}/pane.log)`;
|
|
10699
10713
|
const sigSummary = ctx.signature !== "unknown" ? `; signature=${ctx.signature}` : "";
|
|
10700
10714
|
const recoverySummary = recovery ? `; recovery=${recovery}` : "";
|
|
10701
10715
|
log(
|
|
@@ -10709,7 +10723,7 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash8("sha256").
|
|
|
10709
10723
|
);
|
|
10710
10724
|
getHostId().then((hostId) => {
|
|
10711
10725
|
if (!hostId) return;
|
|
10712
|
-
const paneTailHash = zombie.paneTail ? `sha256:${
|
|
10726
|
+
const paneTailHash = zombie.paneTail ? `sha256:${createHash9("sha256").update(zombie.paneTail).digest("hex").slice(0, 12)}` : null;
|
|
10713
10727
|
return api.post("/host/events", {
|
|
10714
10728
|
host_id: hostId,
|
|
10715
10729
|
agent_code_name: codeName,
|
|
@@ -10793,7 +10807,7 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash8("sha256").
|
|
|
10793
10807
|
if (!claudeAuthTupleBySession.has(codeName)) {
|
|
10794
10808
|
claudeAuthTupleBySession.set(codeName, currentAuthTuple);
|
|
10795
10809
|
}
|
|
10796
|
-
const stableTasksHash =
|
|
10810
|
+
const stableTasksHash = createHash9("sha256").update(JSON.stringify(tasks)).digest("hex").slice(0, 16);
|
|
10797
10811
|
const prevHash = agentState.knownTasksHashes.get(agent.agent_id);
|
|
10798
10812
|
if (stableTasksHash !== prevHash) {
|
|
10799
10813
|
const taskInputs = tasks.map((t) => buildSchedulerTaskInput(t));
|
|
@@ -11319,7 +11333,7 @@ ${escapeXml(msg.content)}
|
|
|
11319
11333
|
log(`[direct-chat] Reply sent for '${agent.codeName}'`);
|
|
11320
11334
|
} catch (err) {
|
|
11321
11335
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
11322
|
-
const errorId =
|
|
11336
|
+
const errorId = createHash9("sha256").update(errMsg).digest("hex").slice(0, 12);
|
|
11323
11337
|
log(`[direct-chat] Failed to process message for '${agent.codeName}': error_id=${errorId} error=${errMsg.slice(0, 500)}`);
|
|
11324
11338
|
try {
|
|
11325
11339
|
await api.post("/host/direct-chat/reply", {
|
|
@@ -11875,7 +11889,7 @@ async function syncMemories(agent, configDir, log2) {
|
|
|
11875
11889
|
if (!file.endsWith(".md")) continue;
|
|
11876
11890
|
try {
|
|
11877
11891
|
const raw = readFileSync15(join16(memoryDir, file), "utf-8");
|
|
11878
|
-
const fileHash =
|
|
11892
|
+
const fileHash = createHash9("sha256").update(raw).digest("hex").slice(0, 16);
|
|
11879
11893
|
currentHashes.set(file, fileHash);
|
|
11880
11894
|
if (prevHashes.get(file) === fileHash) continue;
|
|
11881
11895
|
const parsed = parseMemoryFile(raw, file.replace(/\.md$/, ""));
|
|
@@ -11913,14 +11927,14 @@ async function syncMemories(agent, configDir, log2) {
|
|
|
11913
11927
|
}
|
|
11914
11928
|
async function downloadMemories(agent, memoryDir, log2, { force }) {
|
|
11915
11929
|
const localFiles = existsSync9(memoryDir) ? readdirSync5(memoryDir).filter((f) => f.endsWith(".md")).sort() : [];
|
|
11916
|
-
const localListHash =
|
|
11930
|
+
const localListHash = createHash9("sha256").update(localFiles.join(",")).digest("hex").slice(0, 16);
|
|
11917
11931
|
const prevLocalHash = lastLocalFileHash.get(agent.agent_id);
|
|
11918
11932
|
const prevDownload = lastDownloadHash.get(agent.agent_id);
|
|
11919
11933
|
try {
|
|
11920
11934
|
const dbMemories = await api.post("/host/memories", {
|
|
11921
11935
|
agent_id: agent.agent_id
|
|
11922
11936
|
});
|
|
11923
|
-
const responseHash =
|
|
11937
|
+
const responseHash = createHash9("sha256").update(JSON.stringify(dbMemories.memories ?? [])).digest("hex").slice(0, 16);
|
|
11924
11938
|
if (!force && prevDownload && prevLocalHash === localListHash && lastDownloadHash.get(agent.agent_id) === responseHash) {
|
|
11925
11939
|
return true;
|
|
11926
11940
|
}
|
|
@@ -11959,7 +11973,7 @@ ${mem.content}
|
|
|
11959
11973
|
}
|
|
11960
11974
|
if (written > 0 || overwritten > 0) {
|
|
11961
11975
|
const updatedFiles = readdirSync5(memoryDir).filter((f) => f.endsWith(".md")).sort();
|
|
11962
|
-
lastLocalFileHash.set(agent.agent_id,
|
|
11976
|
+
lastLocalFileHash.set(agent.agent_id, createHash9("sha256").update(updatedFiles.join(",")).digest("hex").slice(0, 16));
|
|
11963
11977
|
log2(`Memory download for '${agent.code_name}': wrote ${written} new, overwrote ${overwritten} stale`);
|
|
11964
11978
|
}
|
|
11965
11979
|
}
|
|
@@ -12396,7 +12410,7 @@ function deployMcpAssets() {
|
|
|
12396
12410
|
const fileHash = (p) => {
|
|
12397
12411
|
try {
|
|
12398
12412
|
if (!existsSync9(p)) return null;
|
|
12399
|
-
return
|
|
12413
|
+
return createHash9("sha256").update(readFileSync15(p)).digest("hex");
|
|
12400
12414
|
} catch {
|
|
12401
12415
|
return null;
|
|
12402
12416
|
}
|