@integrity-labs/agt-cli 0.14.0 → 0.14.2
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.
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
resolveChannels,
|
|
19
19
|
resolveDmTarget,
|
|
20
20
|
wrapScheduledTaskPrompt
|
|
21
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-HGPRV76J.js";
|
|
22
22
|
import {
|
|
23
23
|
findTaskByTemplate,
|
|
24
24
|
getProjectDir,
|
|
@@ -452,6 +452,21 @@ function parseExpiresAt(raw) {
|
|
|
452
452
|
return null;
|
|
453
453
|
}
|
|
454
454
|
|
|
455
|
+
// src/lib/canonical-json.ts
|
|
456
|
+
function canonicalJson(value) {
|
|
457
|
+
return JSON.stringify(normalize(value));
|
|
458
|
+
}
|
|
459
|
+
function normalize(value) {
|
|
460
|
+
if (value === null || typeof value !== "object") return value;
|
|
461
|
+
if (Array.isArray(value)) return value.map(normalize);
|
|
462
|
+
const sorted = {};
|
|
463
|
+
const keys = Object.keys(value).sort();
|
|
464
|
+
for (const k of keys) {
|
|
465
|
+
sorted[k] = normalize(value[k]);
|
|
466
|
+
}
|
|
467
|
+
return sorted;
|
|
468
|
+
}
|
|
469
|
+
|
|
455
470
|
// src/lib/channel-sweep.ts
|
|
456
471
|
import { execFileSync } from "child_process";
|
|
457
472
|
var CHANNEL_BASENAMES = [
|
|
@@ -2240,7 +2255,7 @@ async function processAgent(agent, agentStates) {
|
|
|
2240
2255
|
activeChannels.set(channelId, /* @__PURE__ */ new Set());
|
|
2241
2256
|
}
|
|
2242
2257
|
activeChannels.get(channelId).add(agent.code_name);
|
|
2243
|
-
const configHash = createHash("sha256").update(
|
|
2258
|
+
const configHash = createHash("sha256").update(canonicalJson(entry.config)).digest("hex");
|
|
2244
2259
|
const cacheKey = `${agent.agent_id}:${channelId}`;
|
|
2245
2260
|
let onDiskPresent = true;
|
|
2246
2261
|
try {
|
|
@@ -2252,7 +2267,9 @@ async function processAgent(agent, agentStates) {
|
|
|
2252
2267
|
if (knownChannelConfigHashes.get(cacheKey) === configHash && onDiskPresent) {
|
|
2253
2268
|
continue;
|
|
2254
2269
|
}
|
|
2255
|
-
|
|
2270
|
+
const prevHash = knownChannelConfigHashes.get(cacheKey);
|
|
2271
|
+
const reason = !prevHash ? "first-write" : !onDiskPresent ? "on-disk-missing" : "content-changed";
|
|
2272
|
+
if (!onDiskPresent && prevHash) {
|
|
2256
2273
|
log(`Cached hash for '${agent.code_name}/${channelId}' but on-disk entry missing \u2014 re-writing credentials`);
|
|
2257
2274
|
knownChannelConfigHashes.delete(cacheKey);
|
|
2258
2275
|
}
|
|
@@ -2260,7 +2277,7 @@ async function processAgent(agent, agentStates) {
|
|
|
2260
2277
|
const sessionMode2 = refreshData.agent.session_mode;
|
|
2261
2278
|
frameworkAdapter.writeChannelCredentials(agent.code_name, channelId, entry.config, { sessionMode: sessionMode2 });
|
|
2262
2279
|
knownChannelConfigHashes.set(cacheKey, configHash);
|
|
2263
|
-
log(`Channel credentials written for '${agent.code_name}/${channelId}'`);
|
|
2280
|
+
log(`Channel credentials written for '${agent.code_name}/${channelId}' (reason=${reason}, hash=${configHash.slice(0, 8)}${prevHash ? `, prev=${prevHash.slice(0, 8)}` : ""})`);
|
|
2264
2281
|
} catch (err) {
|
|
2265
2282
|
log(`Failed to write channel credentials for '${agent.code_name}/${channelId}': ${err.message}`);
|
|
2266
2283
|
}
|
|
@@ -3209,7 +3226,9 @@ async function executeAndProcessClaudeTask(codeName, agentId, task, prompt) {
|
|
|
3209
3226
|
async function processClaudeTaskResult(codeName, agentId, templateId, output, delivery) {
|
|
3210
3227
|
try {
|
|
3211
3228
|
if (isSuppressOutput(output)) {
|
|
3212
|
-
|
|
3229
|
+
const trimmed = (output ?? "").trim();
|
|
3230
|
+
const outputSummary = trimmed.length === 0 ? "<empty>" : trimmed.length > 80 ? `${trimmed.slice(0, 77)}...` : trimmed;
|
|
3231
|
+
log(`[claude-scheduler] Suppressing delivery for '${codeName}' (template=${templateId}, task=${delivery?.taskId ?? "n/a"}) \u2014 output was: ${outputSummary}`);
|
|
3213
3232
|
if (delivery?.mode === "announce" && delivery.to) {
|
|
3214
3233
|
await reportDeliveryStatus(agentId, delivery.taskId, {
|
|
3215
3234
|
status: "skipped",
|