@integrity-labs/agt-cli 0.28.404 → 0.28.406
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-V5CRVBVC.js → chunk-RD7MIR3G.js} +12 -1
- package/dist/{chunk-V5CRVBVC.js.map → chunk-RD7MIR3G.js.map} +1 -1
- package/dist/{chunk-SW3FOBHR.js → chunk-UTFTZ4WD.js} +30 -7
- package/dist/{chunk-SW3FOBHR.js.map → chunk-UTFTZ4WD.js.map} +1 -1
- package/dist/{claude-pair-runtime-HDSV7CKE.js → claude-pair-runtime-W5Z4K7XK.js} +2 -2
- package/dist/lib/manager-worker.js +146 -93
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/direct-chat-channel.js +63 -3
- package/dist/mcp/origami.js +11 -0
- package/dist/mcp/slack-channel.js +70 -10
- package/dist/mcp/telegram-channel.js +68 -8
- package/dist/{persistent-session-GRCJPRH5.js → persistent-session-2AC3P5DJ.js} +2 -2
- package/dist/{responsiveness-probe-DNM5APN5.js → responsiveness-probe-LGJNUSPU.js} +2 -2
- package/package.json +1 -1
- /package/dist/{claude-pair-runtime-HDSV7CKE.js.map → claude-pair-runtime-W5Z4K7XK.js.map} +0 -0
- /package/dist/{persistent-session-GRCJPRH5.js.map → persistent-session-2AC3P5DJ.js.map} +0 -0
- /package/dist/{responsiveness-probe-DNM5APN5.js.map → responsiveness-probe-LGJNUSPU.js.map} +0 -0
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
resolveEffectivePinRaw,
|
|
46
46
|
safeWriteJsonAtomic,
|
|
47
47
|
setConfigHash
|
|
48
|
-
} from "../chunk-
|
|
48
|
+
} from "../chunk-UTFTZ4WD.js";
|
|
49
49
|
import {
|
|
50
50
|
getProjectDir as getProjectDir2,
|
|
51
51
|
getReadyTasks,
|
|
@@ -147,16 +147,16 @@ import {
|
|
|
147
147
|
toOpencodeModel,
|
|
148
148
|
transcriptActivityAgeSeconds,
|
|
149
149
|
writeEgressAllowlist
|
|
150
|
-
} from "../chunk-
|
|
150
|
+
} from "../chunk-RD7MIR3G.js";
|
|
151
151
|
import {
|
|
152
152
|
reapOrphanChannelMcps
|
|
153
153
|
} from "../chunk-XWVM4KPK.js";
|
|
154
154
|
|
|
155
155
|
// src/lib/manager-worker.ts
|
|
156
|
-
import { createHash as
|
|
157
|
-
import { readFileSync as readFileSync18, writeFileSync as writeFileSync12, mkdirSync as
|
|
156
|
+
import { createHash as createHash14 } from "crypto";
|
|
157
|
+
import { readFileSync as readFileSync18, writeFileSync as writeFileSync12, mkdirSync as mkdirSync10, existsSync as existsSync11, rmSync as rmSync5, readdirSync as readdirSync6, statSync as statSync4, copyFileSync } from "fs";
|
|
158
158
|
import { execFileSync as syncExecFile } from "child_process";
|
|
159
|
-
import { join as join22, dirname as
|
|
159
|
+
import { join as join22, dirname as dirname7, delimiter as pathDelimiter } from "path";
|
|
160
160
|
import { homedir as homedir10 } from "os";
|
|
161
161
|
import { fileURLToPath } from "url";
|
|
162
162
|
|
|
@@ -5015,10 +5015,35 @@ function closeScheduledRunsForCode(codeName, outcome, reason) {
|
|
|
5015
5015
|
}
|
|
5016
5016
|
|
|
5017
5017
|
// src/lib/manager/scheduler/kanban-route.ts
|
|
5018
|
-
import { createHash as
|
|
5019
|
-
import { writeFileSync as writeFileSync8, renameSync } from "fs";
|
|
5018
|
+
import { createHash as createHash9 } from "crypto";
|
|
5019
|
+
import { writeFileSync as writeFileSync8, renameSync, mkdirSync as mkdirSync6 } from "fs";
|
|
5020
5020
|
import { homedir as homedir7 } from "os";
|
|
5021
|
-
import { join as join17 } from "path";
|
|
5021
|
+
import { join as join17, dirname as dirname5 } from "path";
|
|
5022
|
+
|
|
5023
|
+
// src/lib/manager/scheduler/notify.ts
|
|
5024
|
+
import { createHash as createHash8 } from "crypto";
|
|
5025
|
+
async function enqueueScheduledTaskNotice(opts) {
|
|
5026
|
+
try {
|
|
5027
|
+
const res = await api.post(
|
|
5028
|
+
"/host/scheduled-task/notify",
|
|
5029
|
+
{
|
|
5030
|
+
agent_id: opts.agentId,
|
|
5031
|
+
task_id: opts.taskId,
|
|
5032
|
+
card_id: opts.cardId,
|
|
5033
|
+
content: opts.content,
|
|
5034
|
+
run_id: opts.runId ?? void 0
|
|
5035
|
+
}
|
|
5036
|
+
);
|
|
5037
|
+
return res.ok === true;
|
|
5038
|
+
} catch (err) {
|
|
5039
|
+
const errText = err instanceof Error ? err.message : String(err);
|
|
5040
|
+
const errId = createHash8("sha256").update(errText).digest("hex").slice(0, 12);
|
|
5041
|
+
log(
|
|
5042
|
+
`[scheduled-kanban] notice enqueue failed for agent_id=${opts.agentId} task_id=${opts.taskId} error_id=${errId}`
|
|
5043
|
+
);
|
|
5044
|
+
return false;
|
|
5045
|
+
}
|
|
5046
|
+
}
|
|
5022
5047
|
|
|
5023
5048
|
// src/lib/manager/delivery/scheduled-output.ts
|
|
5024
5049
|
async function deliverScheduledTaskOutput(agentCodeName, agentId, rawTarget, body, taskId) {
|
|
@@ -5331,7 +5356,7 @@ function stampScheduledTurnMarker(codeName, taskId, target) {
|
|
|
5331
5356
|
log(`[scheduled-kanban] scheduled-turn marker write failed for '${codeName}': ${err.message}`);
|
|
5332
5357
|
}
|
|
5333
5358
|
}
|
|
5334
|
-
async function routeScheduledTaskViaKanban(codeName, agentId, task, prompt) {
|
|
5359
|
+
async function routeScheduledTaskViaKanban(codeName, agentId, task, prompt, durableDelivery = false) {
|
|
5335
5360
|
const priorRuns = await fetchPriorScheduledRuns(agentId, task.taskId);
|
|
5336
5361
|
const contextBlocks = buildScheduledTaskContextBlocks({ priorRuns, timezone: task.timezone });
|
|
5337
5362
|
const cardDescription = contextBlocks + (TOOL_DELIVERED_TEMPLATES.has(task.templateId) ? prompt + SCHEDULED_CARD_TOOL_DELIVERY_INSTRUCTION : PLAN_TEMPLATES.has(task.templateId) ? prompt + SCHEDULED_CARD_PLAN_INSTRUCTION : prompt + SCHEDULED_CARD_DELIVERY_CONTRACT);
|
|
@@ -5364,31 +5389,53 @@ async function routeScheduledTaskViaKanban(codeName, agentId, task, prompt) {
|
|
|
5364
5389
|
` + formatRunMarker(run_id) : `A scheduled task just fired and it is now a card on YOUR board that YOU work. The schedule only controls WHEN this card arrives, not who executes it: nothing else runs it for you, so do the work yourself now. Card: id=${kanban_item_id} title=${JSON.stringify(task.name)}. Call kanban_move("${kanban_item_id}", "in_progress"), do the work described on the card, then write the finished result onto the card and mark it done. Do NOT send, post, or message the result to anyone yourself \u2014 the result you write on the card IS the message that will be delivered to the user; delivery happens automatically from the card.
|
|
5365
5390
|
` + suppressionTeaching + formatRunMarker(run_id);
|
|
5366
5391
|
stampScheduledTurnMarker(codeName, task.taskId, resolveScheduledSlackTarget(task));
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5392
|
+
if (durableDelivery) {
|
|
5393
|
+
const enqueued = await enqueueScheduledTaskNotice({
|
|
5394
|
+
agentId,
|
|
5395
|
+
taskId: task.taskId,
|
|
5396
|
+
cardId: kanban_item_id,
|
|
5397
|
+
content: nudge,
|
|
5398
|
+
runId: run_id
|
|
5399
|
+
});
|
|
5400
|
+
if (!enqueued) {
|
|
5401
|
+
log(`[scheduled-kanban] durable nudge enqueue failed for task '${task.name}' on '${codeName}' \u2014 closing card + run`);
|
|
5402
|
+
void finishRun(run_id, "failed", { outcomeMessage: "scheduled-task durable nudge enqueue failed", completeKanbanItemId: kanban_item_id });
|
|
5403
|
+
return false;
|
|
5404
|
+
}
|
|
5405
|
+
try {
|
|
5406
|
+
const doorbell = directChatDoorbellPath(agentId, homedir7());
|
|
5407
|
+
mkdirSync6(dirname5(doorbell), { recursive: true });
|
|
5408
|
+
writeFileSync8(doorbell, String(Date.now()));
|
|
5409
|
+
} catch (err) {
|
|
5410
|
+
log(`[scheduled-kanban] doorbell ring failed for '${codeName}': ${err.message} (notice still queued)`);
|
|
5411
|
+
}
|
|
5412
|
+
} else {
|
|
5413
|
+
let injectStatus;
|
|
5414
|
+
try {
|
|
5415
|
+
injectStatus = await injectMessageWithStatus(codeName, "task", nudge, { task_name: "scheduled-task-do-now" }, log);
|
|
5416
|
+
} catch (err) {
|
|
5417
|
+
log(`[scheduled-kanban] nudge injection threw for task '${task.name}' on '${codeName}': ${err.message} \u2014 closing card + falling back to claude -p`);
|
|
5418
|
+
void finishRun(run_id, "failed", { outcomeMessage: "scheduled-task nudge delivery threw", completeKanbanItemId: kanban_item_id });
|
|
5419
|
+
return false;
|
|
5420
|
+
}
|
|
5421
|
+
const { delivered, fallbackUsed } = injectStatus;
|
|
5422
|
+
if (!delivered && !fallbackUsed) {
|
|
5423
|
+
log(`[scheduled-kanban] nudge delivery failed for task '${task.name}' on '${codeName}' \u2014 closing card + falling back to claude -p`);
|
|
5424
|
+
void finishRun(run_id, "failed", { outcomeMessage: "scheduled-task nudge delivery failed", completeKanbanItemId: kanban_item_id });
|
|
5425
|
+
return false;
|
|
5426
|
+
}
|
|
5427
|
+
if (!delivered && fallbackUsed) {
|
|
5428
|
+
log(`[scheduled-kanban] nudge sent via send-keys (unverified) for task '${task.name}' on '${codeName}' \u2014 proceeding without oneshot fallback`);
|
|
5429
|
+
}
|
|
5383
5430
|
}
|
|
5384
5431
|
trackScheduledRun(codeName, kanban_item_id, run_id);
|
|
5385
5432
|
log(`[scheduled-kanban] Routed task '${task.name}' for '${codeName}' via todo card ${kanban_item_id} run_id=${run_id}`);
|
|
5386
5433
|
return true;
|
|
5387
5434
|
}
|
|
5388
|
-
async function fireScheduledTaskViaKanban(codeName, agentId, task, prompt) {
|
|
5435
|
+
async function fireScheduledTaskViaKanban(codeName, agentId, task, prompt, durableDelivery = false) {
|
|
5389
5436
|
let routed = false;
|
|
5390
5437
|
try {
|
|
5391
|
-
routed = await routeScheduledTaskViaKanban(codeName, agentId, task, prompt);
|
|
5438
|
+
routed = await routeScheduledTaskViaKanban(codeName, agentId, task, prompt, durableDelivery);
|
|
5392
5439
|
} catch (err) {
|
|
5393
5440
|
log(`[scheduled-kanban] route threw for '${task.name}' on '${codeName}': ${err.message}`);
|
|
5394
5441
|
routed = false;
|
|
@@ -5424,24 +5471,24 @@ async function processClaudeTaskResult(codeName, agentId, templateId, rawOutput,
|
|
|
5424
5471
|
const assertion = parseDeliverAssertion(rawOutput);
|
|
5425
5472
|
if (!assertion.deliver) {
|
|
5426
5473
|
const trimmed = (rawOutput ?? "").trim();
|
|
5427
|
-
const outputHash = trimmed.length === 0 ? "empty" :
|
|
5474
|
+
const outputHash = trimmed.length === 0 ? "empty" : createHash9("sha256").update(trimmed).digest("hex").slice(0, 12);
|
|
5428
5475
|
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}`);
|
|
5429
5476
|
if (delivery?.mode === "announce" && delivery.to) {
|
|
5430
5477
|
await reportDeliveryStatus(agentId, delivery.taskId, { status: "skipped", error_code: "SUPPRESSED_BY_POLICY" });
|
|
5431
5478
|
}
|
|
5432
5479
|
return { ok: true };
|
|
5433
5480
|
}
|
|
5434
|
-
const reasonHash =
|
|
5481
|
+
const reasonHash = createHash9("sha256").update(assertion.reason ?? "").digest("hex").slice(0, 12);
|
|
5435
5482
|
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})`);
|
|
5436
5483
|
rawOutput = assertion.deliverable;
|
|
5437
5484
|
}
|
|
5438
5485
|
const classification = classifyOutput(rawOutput);
|
|
5439
5486
|
if (classification.action === "suppress") {
|
|
5440
5487
|
const trimmed = (rawOutput ?? "").trim();
|
|
5441
|
-
const outputHash = trimmed.length === 0 ? "empty" :
|
|
5488
|
+
const outputHash = trimmed.length === 0 ? "empty" : createHash9("sha256").update(trimmed).digest("hex").slice(0, 12);
|
|
5442
5489
|
log(`[claude-scheduler] Suppressing delivery for '${codeName}' (template=${templateId}, task=${delivery?.taskId ?? "n/a"}) \u2014 output_len=${trimmed.length} output_hash=${outputHash}`);
|
|
5443
5490
|
if (classification.suppressedNotes) {
|
|
5444
|
-
const notesHash =
|
|
5491
|
+
const notesHash = createHash9("sha256").update(classification.suppressedNotes).digest("hex").slice(0, 12);
|
|
5445
5492
|
log(`[claude-scheduler] Suppressed notes for '${codeName}' (task=${delivery?.taskId ?? "n/a"}) \u2014 notes_len=${classification.suppressedNotes.length} notes_hash=${notesHash}`);
|
|
5446
5493
|
}
|
|
5447
5494
|
if (delivery?.mode === "announce" && delivery.to) {
|
|
@@ -5507,7 +5554,7 @@ async function processClaudeTaskResult(codeName, agentId, templateId, rawOutput,
|
|
|
5507
5554
|
}
|
|
5508
5555
|
|
|
5509
5556
|
// src/lib/manager/scheduler/execution.ts
|
|
5510
|
-
import { createHash as
|
|
5557
|
+
import { createHash as createHash10 } from "crypto";
|
|
5511
5558
|
import { homedir as homedir8 } from "os";
|
|
5512
5559
|
import { join as join18 } from "path";
|
|
5513
5560
|
function claudePidFilePath() {
|
|
@@ -5531,10 +5578,10 @@ function unregisterClaudeSpawn(pid) {
|
|
|
5531
5578
|
}
|
|
5532
5579
|
async function syncAndCheckClaudeScheduler(agent, tasks, boardItems, refreshData) {
|
|
5533
5580
|
const codeName = agent.code_name;
|
|
5534
|
-
const stableTasksHash =
|
|
5535
|
-
const boardHash = boardItems.length > 0 ?
|
|
5581
|
+
const stableTasksHash = createHash10("sha256").update(JSON.stringify(tasks)).digest("hex").slice(0, 16);
|
|
5582
|
+
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";
|
|
5536
5583
|
const resolvedModels = resolveModelChain(refreshData);
|
|
5537
|
-
const modelsHash =
|
|
5584
|
+
const modelsHash = createHash10("sha256").update(JSON.stringify(resolvedModels)).digest("hex").slice(0, 16);
|
|
5538
5585
|
const combinedHash = `${stableTasksHash}:${boardHash}:${modelsHash}`;
|
|
5539
5586
|
const prevHash = agentState.knownTasksHashes.get(agent.agent_id);
|
|
5540
5587
|
if (combinedHash !== prevHash) {
|
|
@@ -5572,7 +5619,7 @@ async function syncAndCheckClaudeScheduler(agent, tasks, boardItems, refreshData
|
|
|
5572
5619
|
}
|
|
5573
5620
|
|
|
5574
5621
|
// src/lib/opencode-slack-ingest.ts
|
|
5575
|
-
import { createHash as
|
|
5622
|
+
import { createHash as createHash11 } from "crypto";
|
|
5576
5623
|
|
|
5577
5624
|
// ../../packages/core/dist/channels/slack-rich-text.js
|
|
5578
5625
|
var MAX_DEPTH = 12;
|
|
@@ -6508,7 +6555,7 @@ function startSlackIngest(config2) {
|
|
|
6508
6555
|
// src/lib/opencode-slack-ingest.ts
|
|
6509
6556
|
var ingests = /* @__PURE__ */ new Map();
|
|
6510
6557
|
function fingerprint(params) {
|
|
6511
|
-
return
|
|
6558
|
+
return createHash11("sha256").update(
|
|
6512
6559
|
JSON.stringify({
|
|
6513
6560
|
appToken: params.appToken,
|
|
6514
6561
|
botToken: params.botToken,
|
|
@@ -6589,7 +6636,7 @@ function stopAllOpencodeSlackIngests(log2) {
|
|
|
6589
6636
|
}
|
|
6590
6637
|
|
|
6591
6638
|
// src/lib/manager/opencode-scheduler.ts
|
|
6592
|
-
import { createHash as
|
|
6639
|
+
import { createHash as createHash12 } from "crypto";
|
|
6593
6640
|
var MAX_OPENCODE_SCHED_CONCURRENCY = 2;
|
|
6594
6641
|
var opencodeSchedulerStates = /* @__PURE__ */ new Map();
|
|
6595
6642
|
var inFlightOpencodeTasks = /* @__PURE__ */ new Set();
|
|
@@ -6603,7 +6650,7 @@ function shouldDeliver(task, reply) {
|
|
|
6603
6650
|
}
|
|
6604
6651
|
async function syncAndCheckOpencodeScheduler(agent, tasks, refreshData) {
|
|
6605
6652
|
const codeName = agent.code_name;
|
|
6606
|
-
const tasksHash =
|
|
6653
|
+
const tasksHash = createHash12("sha256").update(JSON.stringify(tasks)).digest("hex").slice(0, 16);
|
|
6607
6654
|
if (knownOpencodeTaskHashes.get(agent.agent_id) !== tasksHash) {
|
|
6608
6655
|
const taskInputs = tasks.map((t) => buildSchedulerTaskInput(t));
|
|
6609
6656
|
const state8 = syncTasksToScheduler(codeName, agent.agent_id, taskInputs);
|
|
@@ -6681,8 +6728,8 @@ async function fireOpencodeScheduledTask(agent, task) {
|
|
|
6681
6728
|
}
|
|
6682
6729
|
|
|
6683
6730
|
// src/lib/opencode-telegram-ingest.ts
|
|
6684
|
-
import { createHash as
|
|
6685
|
-
import { existsSync as existsSync9, mkdirSync as
|
|
6731
|
+
import { createHash as createHash13 } from "crypto";
|
|
6732
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync7, readFileSync as readFileSync15, renameSync as renameSync2, unlinkSync, writeFileSync as writeFileSync9 } from "fs";
|
|
6686
6733
|
import { randomUUID } from "crypto";
|
|
6687
6734
|
import { join as join19 } from "path";
|
|
6688
6735
|
|
|
@@ -7217,7 +7264,7 @@ function anySignal(signals) {
|
|
|
7217
7264
|
// src/lib/opencode-telegram-ingest.ts
|
|
7218
7265
|
var ingests2 = /* @__PURE__ */ new Map();
|
|
7219
7266
|
function fingerprint2(params) {
|
|
7220
|
-
return
|
|
7267
|
+
return createHash13("sha256").update(
|
|
7221
7268
|
JSON.stringify({
|
|
7222
7269
|
botToken: params.botToken,
|
|
7223
7270
|
allowedChats: [...params.allowedChats].sort(),
|
|
@@ -7259,7 +7306,7 @@ function createFileOffsetStore(codeName, log2, currentBotId) {
|
|
|
7259
7306
|
if (!filePath || !dir) return;
|
|
7260
7307
|
const tmpPath = `${filePath}.${process.pid}.${randomUUID()}.tmp`;
|
|
7261
7308
|
try {
|
|
7262
|
-
|
|
7309
|
+
mkdirSync7(dir, { recursive: true, mode: 448 });
|
|
7263
7310
|
writeFileSync9(
|
|
7264
7311
|
tmpPath,
|
|
7265
7312
|
JSON.stringify({
|
|
@@ -7491,7 +7538,7 @@ function partitionActionableByPoison(actionable, states, config2) {
|
|
|
7491
7538
|
}
|
|
7492
7539
|
|
|
7493
7540
|
// src/lib/restart-flags.ts
|
|
7494
|
-
import { existsSync as existsSync10, mkdirSync as
|
|
7541
|
+
import { existsSync as existsSync10, mkdirSync as mkdirSync8, readdirSync as readdirSync4, readFileSync as readFileSync16, renameSync as renameSync3, rmSync as rmSync4, writeFileSync as writeFileSync10 } from "fs";
|
|
7495
7542
|
import { homedir as homedir9 } from "os";
|
|
7496
7543
|
import { join as join20 } from "path";
|
|
7497
7544
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
@@ -7626,8 +7673,8 @@ async function sendError(flag, opts, text) {
|
|
|
7626
7673
|
}
|
|
7627
7674
|
|
|
7628
7675
|
// src/lib/restart-context.ts
|
|
7629
|
-
import { readdirSync as readdirSync5, readFileSync as readFileSync17, writeFileSync as writeFileSync11, mkdirSync as
|
|
7630
|
-
import { dirname as
|
|
7676
|
+
import { readdirSync as readdirSync5, readFileSync as readFileSync17, writeFileSync as writeFileSync11, mkdirSync as mkdirSync9, unlinkSync as unlinkSync2 } from "fs";
|
|
7677
|
+
import { dirname as dirname6, join as join21 } from "path";
|
|
7631
7678
|
var SLACK_PENDING_INBOUND_DIRNAME = "slack-pending-inbound";
|
|
7632
7679
|
var SLACK_RESTART_CONTEXT_DIRNAME = "slack-restart-context";
|
|
7633
7680
|
var MAX_TOPIC_CHARS = 140;
|
|
@@ -7636,7 +7683,7 @@ var RECONSTRUCT_WINDOW_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
|
7636
7683
|
var WINDOW_PAD_MS3 = 5 * 6e4;
|
|
7637
7684
|
var DEFAULT_MAX_MARKERS_PER_AGENT = 25;
|
|
7638
7685
|
function augmentedAgentDir(codeName) {
|
|
7639
|
-
return
|
|
7686
|
+
return dirname6(getProjectDir(codeName));
|
|
7640
7687
|
}
|
|
7641
7688
|
function slackPendingInboundDir(codeName) {
|
|
7642
7689
|
return join21(augmentedAgentDir(codeName), SLACK_PENDING_INBOUND_DIRNAME);
|
|
@@ -7693,7 +7740,7 @@ function readStrandedMarker(path) {
|
|
|
7693
7740
|
return null;
|
|
7694
7741
|
}
|
|
7695
7742
|
function writeHintFile(path, dir, hint) {
|
|
7696
|
-
|
|
7743
|
+
mkdirSync9(dir, { recursive: true, mode: 448 });
|
|
7697
7744
|
writeFileSync11(path, JSON.stringify(hint), { mode: 384 });
|
|
7698
7745
|
}
|
|
7699
7746
|
function pruneHintsExcept(codeName, freshFilenames) {
|
|
@@ -8902,7 +8949,7 @@ var sessionLaunchManagedStructure = /* @__PURE__ */ new Map();
|
|
|
8902
8949
|
function projectMcpHash(_codeName, projectDir) {
|
|
8903
8950
|
try {
|
|
8904
8951
|
const raw = readFileSync18(join22(projectDir, ".mcp.json"), "utf-8");
|
|
8905
|
-
return
|
|
8952
|
+
return createHash14("sha256").update(canonicalJson(JSON.parse(raw))).digest("hex");
|
|
8906
8953
|
} catch {
|
|
8907
8954
|
return null;
|
|
8908
8955
|
}
|
|
@@ -9255,7 +9302,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
|
|
|
9255
9302
|
var lastVersionCheckAt = 0;
|
|
9256
9303
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
9257
9304
|
var lastResponsivenessProbeAt = 0;
|
|
9258
|
-
var agtCliVersion = true ? "0.28.
|
|
9305
|
+
var agtCliVersion = true ? "0.28.406" : "dev";
|
|
9259
9306
|
function resolveBrewPath(execFileSync2) {
|
|
9260
9307
|
try {
|
|
9261
9308
|
const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -9350,7 +9397,7 @@ async function ensureToolkitCli(toolkitSlug) {
|
|
|
9350
9397
|
toolkitCliEnsured.add(toolkitSlug);
|
|
9351
9398
|
return;
|
|
9352
9399
|
}
|
|
9353
|
-
brewBinDir =
|
|
9400
|
+
brewBinDir = dirname7(brewPath);
|
|
9354
9401
|
const isRoot = typeof process.getuid === "function" && process.getuid() === 0;
|
|
9355
9402
|
log(`[toolkit-install] ${toolkitSlug}: installing via brew (${pkg})\u2026`);
|
|
9356
9403
|
if (isRoot) {
|
|
@@ -9560,7 +9607,7 @@ function ensureClaudeManagedSettings(path = claudeManagedSettingsPath()) {
|
|
|
9560
9607
|
}
|
|
9561
9608
|
if (settings.channelsEnabled === true) return "ok";
|
|
9562
9609
|
settings.channelsEnabled = true;
|
|
9563
|
-
|
|
9610
|
+
mkdirSync10(dirname7(path), { recursive: true });
|
|
9564
9611
|
writeFileSync12(path, `${JSON.stringify(settings, null, 2)}
|
|
9565
9612
|
`);
|
|
9566
9613
|
log(`[managed-settings] set channelsEnabled:true in ${path} (ENG-5786 \u2014 unblocks Claude Code channels)`);
|
|
@@ -9656,7 +9703,7 @@ async function ensureFrameworkBinary(frameworkId) {
|
|
|
9656
9703
|
log(`Claude Code install failed: ${err.message}`);
|
|
9657
9704
|
return;
|
|
9658
9705
|
}
|
|
9659
|
-
const brewBinDir =
|
|
9706
|
+
const brewBinDir = dirname7(brewPath);
|
|
9660
9707
|
if (!process.env.PATH?.split(":").includes(brewBinDir)) {
|
|
9661
9708
|
process.env.PATH = `${brewBinDir}:${process.env.PATH ?? ""}`;
|
|
9662
9709
|
}
|
|
@@ -10090,7 +10137,7 @@ function ensureEvalEmptyMcpConfig() {
|
|
|
10090
10137
|
if (evalEmptyMcpConfigPath && existsSync11(evalEmptyMcpConfigPath)) return evalEmptyMcpConfigPath;
|
|
10091
10138
|
const dir = join22(homedir10(), ".augmented");
|
|
10092
10139
|
try {
|
|
10093
|
-
|
|
10140
|
+
mkdirSync10(dir, { recursive: true });
|
|
10094
10141
|
} catch {
|
|
10095
10142
|
}
|
|
10096
10143
|
const p = join22(dir, ".eval-empty-mcp.json");
|
|
@@ -10387,7 +10434,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
|
|
|
10387
10434
|
if (codeNames.length === 0) return;
|
|
10388
10435
|
void (async () => {
|
|
10389
10436
|
try {
|
|
10390
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
10437
|
+
const { collectDiagnostics } = await import("../persistent-session-2AC3P5DJ.js");
|
|
10391
10438
|
await api.post("/host/heartbeat", {
|
|
10392
10439
|
host_id: hostId,
|
|
10393
10440
|
agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor)
|
|
@@ -10486,7 +10533,7 @@ async function pollCycle() {
|
|
|
10486
10533
|
}
|
|
10487
10534
|
try {
|
|
10488
10535
|
const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
|
|
10489
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
10536
|
+
const { collectDiagnostics } = await import("../persistent-session-2AC3P5DJ.js");
|
|
10490
10537
|
const diagCodeNames = [...agentState.persistentSessionAgents];
|
|
10491
10538
|
const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor) : void 0;
|
|
10492
10539
|
let tailscaleHostname;
|
|
@@ -10516,7 +10563,7 @@ async function pollCycle() {
|
|
|
10516
10563
|
claudeAuth = await detectClaudeAuth();
|
|
10517
10564
|
} catch (err) {
|
|
10518
10565
|
const errText = err instanceof Error ? err.message : String(err);
|
|
10519
|
-
const errId =
|
|
10566
|
+
const errId = createHash14("sha256").update(errText).digest("hex").slice(0, 12);
|
|
10520
10567
|
log(`Claude auth detection failed (error_id=${errId})`);
|
|
10521
10568
|
}
|
|
10522
10569
|
const hostHasClaudeCode = state6.agents.some(
|
|
@@ -10641,7 +10688,7 @@ async function pollCycle() {
|
|
|
10641
10688
|
const {
|
|
10642
10689
|
collectResponsivenessProbes,
|
|
10643
10690
|
getResponsivenessIntervalMs
|
|
10644
|
-
} = await import("../responsiveness-probe-
|
|
10691
|
+
} = await import("../responsiveness-probe-LGJNUSPU.js");
|
|
10645
10692
|
const probeIntervalMs = getResponsivenessIntervalMs();
|
|
10646
10693
|
if (now - lastResponsivenessProbeAt > probeIntervalMs) {
|
|
10647
10694
|
const probeCodeNames = [...agentState.persistentSessionAgents];
|
|
@@ -10673,7 +10720,7 @@ async function pollCycle() {
|
|
|
10673
10720
|
collectResponsivenessProbes,
|
|
10674
10721
|
livePendingInboundOldestAgeSeconds,
|
|
10675
10722
|
parkPendingInbound
|
|
10676
|
-
} = await import("../responsiveness-probe-
|
|
10723
|
+
} = await import("../responsiveness-probe-LGJNUSPU.js");
|
|
10677
10724
|
const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-HYOOQV4A.js");
|
|
10678
10725
|
const wedgeNow = /* @__PURE__ */ new Date();
|
|
10679
10726
|
const liveAgents = agentState.persistentSessionAgents;
|
|
@@ -11497,7 +11544,7 @@ async function processAgent(agent, agentStates) {
|
|
|
11497
11544
|
try {
|
|
11498
11545
|
const artifacts = generateArtifacts(agent, refreshData, frameworkAdapter);
|
|
11499
11546
|
const changedFiles = [];
|
|
11500
|
-
|
|
11547
|
+
mkdirSync10(agentDir, { recursive: true });
|
|
11501
11548
|
for (const artifact of artifacts) {
|
|
11502
11549
|
const filePath = join22(agentDir, artifact.relativePath);
|
|
11503
11550
|
let existingHash;
|
|
@@ -11575,7 +11622,7 @@ async function processAgent(agent, agentStates) {
|
|
|
11575
11622
|
log(`${verb} '${agent.code_name}': ${fileNames}`);
|
|
11576
11623
|
for (const file of changedFiles) {
|
|
11577
11624
|
const filePath = join22(agentDir, file.relativePath);
|
|
11578
|
-
|
|
11625
|
+
mkdirSync10(dirname7(filePath), { recursive: true });
|
|
11579
11626
|
if (file.relativePath === ".mcp.json") {
|
|
11580
11627
|
safeWriteJsonAtomic(filePath, file.content, { mode: 384 });
|
|
11581
11628
|
} else {
|
|
@@ -11907,7 +11954,7 @@ async function processAgent(agent, agentStates) {
|
|
|
11907
11954
|
const writeDmNoticeMarkers = isChannelAddRestart ? () => {
|
|
11908
11955
|
try {
|
|
11909
11956
|
const agentAugmentedDir = join22(homedir10(), ".augmented", agent.code_name);
|
|
11910
|
-
|
|
11957
|
+
mkdirSync10(agentAugmentedDir, { recursive: true });
|
|
11911
11958
|
const markerJson = JSON.stringify({
|
|
11912
11959
|
version: 1,
|
|
11913
11960
|
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -11990,7 +12037,7 @@ async function processAgent(agent, agentStates) {
|
|
|
11990
12037
|
const behaviourSubset = extractMsTeamsBehaviourSubset(
|
|
11991
12038
|
msteamsEntry?.config
|
|
11992
12039
|
);
|
|
11993
|
-
const behaviourHash =
|
|
12040
|
+
const behaviourHash = createHash14("sha256").update(canonicalJson(behaviourSubset)).digest("hex");
|
|
11994
12041
|
const prevBehaviourHash = agentState.knownMsTeamsBehaviourHashes.get(agent.agent_id);
|
|
11995
12042
|
const msteamsBehaviourRestrictive = isMsTeamsBehaviourRestrictive(behaviourSubset);
|
|
11996
12043
|
const behaviourDecision = decideSenderPolicyRestart({
|
|
@@ -12046,7 +12093,7 @@ async function processAgent(agent, agentStates) {
|
|
|
12046
12093
|
const slackBehaviourSubset = extractSlackBehaviourSubset(
|
|
12047
12094
|
slackEntry?.config
|
|
12048
12095
|
);
|
|
12049
|
-
const slackBehaviourHash =
|
|
12096
|
+
const slackBehaviourHash = createHash14("sha256").update(canonicalJson(slackBehaviourSubset)).digest("hex");
|
|
12050
12097
|
const prevSlackBehaviourHash = agentState.knownSlackBehaviourHashes.get(agent.agent_id);
|
|
12051
12098
|
const slackBehaviourRestrictive = isSlackBehaviourRestrictive(slackBehaviourSubset);
|
|
12052
12099
|
const slackBehaviourDecision = decideSenderPolicyRestart({
|
|
@@ -12104,8 +12151,8 @@ async function processAgent(agent, agentStates) {
|
|
|
12104
12151
|
try {
|
|
12105
12152
|
const agentProvisionDir = agentDir;
|
|
12106
12153
|
const projectDir = join22(homedir10(), ".augmented", agent.code_name, "project");
|
|
12107
|
-
|
|
12108
|
-
|
|
12154
|
+
mkdirSync10(agentProvisionDir, { recursive: true });
|
|
12155
|
+
mkdirSync10(projectDir, { recursive: true });
|
|
12109
12156
|
const provisionMcpPath = join22(agentProvisionDir, ".mcp.json");
|
|
12110
12157
|
const projectMcpPath = join22(projectDir, ".mcp.json");
|
|
12111
12158
|
let mcpConfig = { mcpServers: {} };
|
|
@@ -12468,10 +12515,10 @@ async function processAgent(agent, agentStates) {
|
|
|
12468
12515
|
desiredEntries.push({ serverId, url, headers: mcpHeaders, name: tk.toolkit_name });
|
|
12469
12516
|
}
|
|
12470
12517
|
const hashBasis = desiredEntries.slice().sort((a, b) => a.serverId.localeCompare(b.serverId)).map((e) => {
|
|
12471
|
-
const headersHash =
|
|
12518
|
+
const headersHash = createHash14("sha256").update(canonicalJson(e.headers ?? {})).digest("hex").slice(0, 16);
|
|
12472
12519
|
return `${e.serverId}|${e.url}|${headersHash}`;
|
|
12473
12520
|
}).join("\n");
|
|
12474
|
-
const mcpHash =
|
|
12521
|
+
const mcpHash = createHash14("sha256").update(hashBasis).digest("hex").slice(0, 16);
|
|
12475
12522
|
const prevMcpHash = agentState.knownManagedMcpHashes.get(agent.agent_id);
|
|
12476
12523
|
const structureHash = managedMcpStructureHash(desiredEntries);
|
|
12477
12524
|
const prevStructureHash = agentState.knownManagedMcpStructure.get(agent.agent_id);
|
|
@@ -12486,7 +12533,7 @@ async function processAgent(agent, agentStates) {
|
|
|
12486
12533
|
if (mcpHash !== prevMcpHash) {
|
|
12487
12534
|
for (const e of desiredEntries) {
|
|
12488
12535
|
frameworkAdapter.writeMcpServer(agent.code_name, e.serverId, { url: e.url, headers: e.headers });
|
|
12489
|
-
const urlHash =
|
|
12536
|
+
const urlHash = createHash14("sha256").update(e.url).digest("hex").slice(0, 12);
|
|
12490
12537
|
log(`[managed-toolkit] ${agent.code_name}: wrote '${e.name}' (serverId=${e.serverId}, url_hash=${urlHash})`);
|
|
12491
12538
|
}
|
|
12492
12539
|
if (frameworkAdapter.removeMcpServer && frameworkAdapter.getMcpPath) {
|
|
@@ -12595,7 +12642,7 @@ async function processAgent(agent, agentStates) {
|
|
|
12595
12642
|
if (frameworkAdapter.installSkillFiles) {
|
|
12596
12643
|
const currentIntegrationSkillIds = /* @__PURE__ */ new Set();
|
|
12597
12644
|
const installedIntegrationSkills = [];
|
|
12598
|
-
const { createHash:
|
|
12645
|
+
const { createHash: createHash15 } = await import("crypto");
|
|
12599
12646
|
const refreshAny = refreshData;
|
|
12600
12647
|
const contexts = refreshAny.integration_contexts ?? refreshAny.plugin_contexts ?? [];
|
|
12601
12648
|
const contextBySlug = /* @__PURE__ */ new Map();
|
|
@@ -12624,7 +12671,7 @@ async function processAgent(agent, agentStates) {
|
|
|
12624
12671
|
)
|
|
12625
12672
|
}));
|
|
12626
12673
|
const bundle = buildIntegrationBundle(renderedScopes);
|
|
12627
|
-
const contentHash =
|
|
12674
|
+
const contentHash = createHash15("sha256").update(bundleFingerprint(bundle.files)).digest("hex").slice(0, 12);
|
|
12628
12675
|
const hashKey = `plugin-skill:${agent.agent_id}:${integrationSkillId}`;
|
|
12629
12676
|
if (agentState.knownSkillHashes.get(hashKey) === contentHash) continue;
|
|
12630
12677
|
frameworkAdapter.installSkillFiles(agent.code_name, integrationSkillId, bundle.files);
|
|
@@ -12691,7 +12738,7 @@ async function processAgent(agent, agentStates) {
|
|
|
12691
12738
|
const plan = planGlobalSkillSync(
|
|
12692
12739
|
[...globalSkillsPayload ?? [], ...sharedSkillsPayload ?? []],
|
|
12693
12740
|
prevIds,
|
|
12694
|
-
(content) =>
|
|
12741
|
+
(content) => createHash15("sha256").update(content).digest("hex").slice(0, 12),
|
|
12695
12742
|
(skillId) => agentState.knownSkillHashes.get(`global-skill:${agent.agent_id}:${skillId}`),
|
|
12696
12743
|
{ desiredResolved }
|
|
12697
12744
|
);
|
|
@@ -12742,7 +12789,7 @@ async function processAgent(agent, agentStates) {
|
|
|
12742
12789
|
const slug = hook.integration_slug ?? hook.plugin_slug;
|
|
12743
12790
|
if (!slug) continue;
|
|
12744
12791
|
try {
|
|
12745
|
-
const scriptHash =
|
|
12792
|
+
const scriptHash = createHash15("sha256").update(hook.script).digest("hex").slice(0, 12);
|
|
12746
12793
|
const hookKey = `${agent.agent_id}:${frameworkAdapter.id}:plugin-hook:${slug}:on_install`;
|
|
12747
12794
|
if (agentState.knownSkillHashes.get(hookKey) === scriptHash) continue;
|
|
12748
12795
|
const result = await frameworkAdapter.executePluginHook({
|
|
@@ -12757,9 +12804,9 @@ async function processAgent(agent, agentStates) {
|
|
|
12757
12804
|
} else if (result.timedOut) {
|
|
12758
12805
|
log(`Integration hook on_install '${slug}' TIMED OUT for '${agent.code_name}' after ${result.durationMs}ms`);
|
|
12759
12806
|
} else {
|
|
12760
|
-
const stderrHash =
|
|
12807
|
+
const stderrHash = createHash15("sha256").update(result.stderr).digest("hex").slice(0, 12);
|
|
12761
12808
|
const missingCmd = result.exitCode === 127 ? extractCommandNotFound(result.stderr) : null;
|
|
12762
|
-
const missingCmdHash = missingCmd ?
|
|
12809
|
+
const missingCmdHash = missingCmd ? createHash15("sha256").update(missingCmd).digest("hex").slice(0, 8) : null;
|
|
12763
12810
|
log(
|
|
12764
12811
|
`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}]`
|
|
12765
12812
|
);
|
|
@@ -13575,7 +13622,7 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
|
|
|
13575
13622
|
const ctx = getLastFailureContext(codeName);
|
|
13576
13623
|
const recovery = prepareForRespawn(codeName);
|
|
13577
13624
|
const tailSummary = !ctx.tail ? "" : KNOWN_SAFE_TAIL_SIGNATURES.has(ctx.signature) ? `; last pane output (${PANE_TAIL_PREVIEW_LINES} of ~20 lines):
|
|
13578
|
-
${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${
|
|
13625
|
+
${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash14("sha256").update(ctx.tail).digest("hex").slice(0, 12)} (raw at ~/.augmented/${codeName}/pane.log)`;
|
|
13579
13626
|
const sigSummary = ctx.signature !== "unknown" ? `; signature=${ctx.signature}` : "";
|
|
13580
13627
|
const recoverySummary = recovery ? `; recovery=${recovery}` : "";
|
|
13581
13628
|
log(
|
|
@@ -13589,7 +13636,7 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash13("sha256")
|
|
|
13589
13636
|
);
|
|
13590
13637
|
getHostId().then((hostId) => {
|
|
13591
13638
|
if (!hostId) return;
|
|
13592
|
-
const paneTailHash = zombie.paneTail ? `sha256:${
|
|
13639
|
+
const paneTailHash = zombie.paneTail ? `sha256:${createHash14("sha256").update(zombie.paneTail).digest("hex").slice(0, 12)}` : null;
|
|
13593
13640
|
return api.post("/host/events", {
|
|
13594
13641
|
host_id: hostId,
|
|
13595
13642
|
agent_code_name: codeName,
|
|
@@ -13738,7 +13785,7 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash13("sha256")
|
|
|
13738
13785
|
if (!claudeAuthTupleBySession.has(codeName)) {
|
|
13739
13786
|
claudeAuthTupleBySession.set(codeName, currentAuthTuple);
|
|
13740
13787
|
}
|
|
13741
|
-
const stableTasksHash =
|
|
13788
|
+
const stableTasksHash = createHash14("sha256").update(JSON.stringify(tasks)).digest("hex").slice(0, 16);
|
|
13742
13789
|
const prevHash = agentState.knownTasksHashes.get(agent.agent_id);
|
|
13743
13790
|
if (stableTasksHash !== prevHash) {
|
|
13744
13791
|
const taskInputs = tasks.map((t) => buildSchedulerTaskInput(t));
|
|
@@ -13775,7 +13822,13 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash13("sha256")
|
|
|
13775
13822
|
}
|
|
13776
13823
|
inFlightClaudeTasks.add(task.taskId);
|
|
13777
13824
|
claudeTaskConcurrency.set(codeName, (claudeTaskConcurrency.get(codeName) ?? 0) + 1);
|
|
13778
|
-
await fireScheduledTaskViaKanban(
|
|
13825
|
+
await fireScheduledTaskViaKanban(
|
|
13826
|
+
codeName,
|
|
13827
|
+
agent.agent_id,
|
|
13828
|
+
task,
|
|
13829
|
+
prompt,
|
|
13830
|
+
hostFlagStore().getBoolean("scheduled-task-nudge-durable")
|
|
13831
|
+
);
|
|
13779
13832
|
inFlightClaudeTasks.delete(task.taskId);
|
|
13780
13833
|
claudeTaskConcurrency.set(codeName, Math.max(0, (claudeTaskConcurrency.get(codeName) ?? 1) - 1));
|
|
13781
13834
|
break;
|
|
@@ -13955,7 +14008,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
|
|
|
13955
14008
|
void api.post("/host/restart-ack", { host_id: hostId, agent_id: agentId, restart_requested_at: requestedAt }).catch((err) => log(`[restart-lane] ack failed for '${codeName}': ${err.message}`));
|
|
13956
14009
|
void (async () => {
|
|
13957
14010
|
try {
|
|
13958
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
14011
|
+
const { collectDiagnostics } = await import("../persistent-session-2AC3P5DJ.js");
|
|
13959
14012
|
await api.post("/host/heartbeat", {
|
|
13960
14013
|
host_id: hostId,
|
|
13961
14014
|
agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor)
|
|
@@ -14005,7 +14058,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
|
|
|
14005
14058
|
}
|
|
14006
14059
|
try {
|
|
14007
14060
|
const hostId = await getHostId();
|
|
14008
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
14061
|
+
const { collectDiagnostics } = await import("../persistent-session-2AC3P5DJ.js");
|
|
14009
14062
|
await api.post("/host/heartbeat", {
|
|
14010
14063
|
host_id: hostId,
|
|
14011
14064
|
agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor)
|
|
@@ -14291,7 +14344,7 @@ async function processDirectChatMessage(agent, msg) {
|
|
|
14291
14344
|
if (useDoorbell) {
|
|
14292
14345
|
try {
|
|
14293
14346
|
const doorbell = directChatDoorbellPath(agent.agentId, homedir10());
|
|
14294
|
-
|
|
14347
|
+
mkdirSync10(dirname7(doorbell), { recursive: true });
|
|
14295
14348
|
writeFileSync12(doorbell, String(Date.now()));
|
|
14296
14349
|
log(`[direct-chat] Doorbell rung for '${agent.codeName}' (msg=${msg.id}) \u2014 in-session MCP will pull via the cursor`);
|
|
14297
14350
|
return;
|
|
@@ -14401,7 +14454,7 @@ ${formatRunMarker(run_id)}` : KANBAN_CHECK_COMMAND;
|
|
|
14401
14454
|
if (run_id) openInjectedRunByCode.set(codeName, run_id);
|
|
14402
14455
|
try {
|
|
14403
14456
|
const doorbell = directChatDoorbellPath(agentId, homedir10());
|
|
14404
|
-
|
|
14457
|
+
mkdirSync10(dirname7(doorbell), { recursive: true });
|
|
14405
14458
|
writeFileSync12(doorbell, String(Date.now()));
|
|
14406
14459
|
} catch (err) {
|
|
14407
14460
|
log(`[kanban] doorbell ring failed for '${codeName}': ${err.message} (notice still queued)`);
|
|
@@ -14458,7 +14511,7 @@ async function processClaudePairSessions(agents) {
|
|
|
14458
14511
|
killPairSession,
|
|
14459
14512
|
pairTmuxSession,
|
|
14460
14513
|
finalizeClaudePairOnboarding
|
|
14461
|
-
} = await import("../claude-pair-runtime-
|
|
14514
|
+
} = await import("../claude-pair-runtime-W5Z4K7XK.js");
|
|
14462
14515
|
for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
|
|
14463
14516
|
log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
|
|
14464
14517
|
const killed = await killPairSession(pairTmuxSession(pairId));
|
|
@@ -14728,7 +14781,7 @@ async function syncMemories(agent, configDir, log2) {
|
|
|
14728
14781
|
if (!file.endsWith(".md")) continue;
|
|
14729
14782
|
try {
|
|
14730
14783
|
const raw = readFileSync18(join22(memoryDir, file), "utf-8");
|
|
14731
|
-
const fileHash =
|
|
14784
|
+
const fileHash = createHash14("sha256").update(raw).digest("hex").slice(0, 16);
|
|
14732
14785
|
currentHashes.set(file, fileHash);
|
|
14733
14786
|
if (prevHashes.get(file) === fileHash) continue;
|
|
14734
14787
|
const parsed = parseMemoryFile(raw, file.replace(/\.md$/, ""));
|
|
@@ -14766,21 +14819,21 @@ async function syncMemories(agent, configDir, log2) {
|
|
|
14766
14819
|
}
|
|
14767
14820
|
async function downloadMemories(agent, memoryDir, log2, { force }) {
|
|
14768
14821
|
const localFiles = existsSync11(memoryDir) ? readdirSync6(memoryDir).filter((f) => f.endsWith(".md")).sort() : [];
|
|
14769
|
-
const localListHash =
|
|
14822
|
+
const localListHash = createHash14("sha256").update(localFiles.join(",")).digest("hex").slice(0, 16);
|
|
14770
14823
|
const prevLocalHash = lastLocalFileHash.get(agent.agent_id);
|
|
14771
14824
|
const prevDownload = lastDownloadHash.get(agent.agent_id);
|
|
14772
14825
|
try {
|
|
14773
14826
|
const dbMemories = await api.post("/host/memories", {
|
|
14774
14827
|
agent_id: agent.agent_id
|
|
14775
14828
|
});
|
|
14776
|
-
const responseHash =
|
|
14829
|
+
const responseHash = createHash14("sha256").update(JSON.stringify(dbMemories.memories ?? [])).digest("hex").slice(0, 16);
|
|
14777
14830
|
if (!force && prevDownload && prevLocalHash === localListHash && lastDownloadHash.get(agent.agent_id) === responseHash) {
|
|
14778
14831
|
return true;
|
|
14779
14832
|
}
|
|
14780
14833
|
lastDownloadHash.set(agent.agent_id, responseHash);
|
|
14781
14834
|
lastLocalFileHash.set(agent.agent_id, localListHash);
|
|
14782
14835
|
if (dbMemories.memories?.length) {
|
|
14783
|
-
|
|
14836
|
+
mkdirSync10(memoryDir, { recursive: true });
|
|
14784
14837
|
let written = 0;
|
|
14785
14838
|
let overwritten = 0;
|
|
14786
14839
|
for (let i = 0; i < dbMemories.memories.length; i++) {
|
|
@@ -14812,7 +14865,7 @@ ${mem.content}
|
|
|
14812
14865
|
}
|
|
14813
14866
|
if (written > 0 || overwritten > 0) {
|
|
14814
14867
|
const updatedFiles = readdirSync6(memoryDir).filter((f) => f.endsWith(".md")).sort();
|
|
14815
|
-
lastLocalFileHash.set(agent.agent_id,
|
|
14868
|
+
lastLocalFileHash.set(agent.agent_id, createHash14("sha256").update(updatedFiles.join(",")).digest("hex").slice(0, 16));
|
|
14816
14869
|
log2(`Memory download for '${agent.code_name}': wrote ${written} new, overwrote ${overwritten} stale`);
|
|
14817
14870
|
}
|
|
14818
14871
|
}
|
|
@@ -15215,8 +15268,8 @@ function restartRunningChannelMcps(basenames) {
|
|
|
15215
15268
|
}
|
|
15216
15269
|
function deployMcpAssets() {
|
|
15217
15270
|
const targetDir = join22(homedir10(), ".augmented", "_mcp");
|
|
15218
|
-
|
|
15219
|
-
const moduleDir =
|
|
15271
|
+
mkdirSync10(targetDir, { recursive: true });
|
|
15272
|
+
const moduleDir = dirname7(fileURLToPath(import.meta.url));
|
|
15220
15273
|
let mcpSourceDir = "";
|
|
15221
15274
|
let dir = moduleDir;
|
|
15222
15275
|
for (let i = 0; i < 6; i++) {
|
|
@@ -15225,7 +15278,7 @@ function deployMcpAssets() {
|
|
|
15225
15278
|
mcpSourceDir = candidate;
|
|
15226
15279
|
break;
|
|
15227
15280
|
}
|
|
15228
|
-
const parent =
|
|
15281
|
+
const parent = dirname7(dir);
|
|
15229
15282
|
if (parent === dir) break;
|
|
15230
15283
|
dir = parent;
|
|
15231
15284
|
}
|
|
@@ -15237,7 +15290,7 @@ function deployMcpAssets() {
|
|
|
15237
15290
|
const fileHash = (p) => {
|
|
15238
15291
|
try {
|
|
15239
15292
|
if (!existsSync11(p)) return null;
|
|
15240
|
-
return
|
|
15293
|
+
return createHash14("sha256").update(readFileSync18(p)).digest("hex");
|
|
15241
15294
|
} catch {
|
|
15242
15295
|
return null;
|
|
15243
15296
|
}
|