@integrity-labs/agt-cli 0.28.382 → 0.28.384

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.
@@ -100,7 +100,7 @@ async function spawnPairSession(session) {
100
100
  return { ok: true };
101
101
  } catch {
102
102
  }
103
- const { resolveClaudeBinary } = await import("./persistent-session-FZF7EPUW.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-MDQVHXKX.js");
104
104
  const claudeBin = resolveClaudeBinary();
105
105
  const pairEnv = {
106
106
  ...process.env,
@@ -373,4 +373,4 @@ export {
373
373
  startClaudePair,
374
374
  submitClaudePairCode
375
375
  };
376
- //# sourceMappingURL=claude-pair-runtime-YF3ZEFKV.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-OIK6HKPS.js.map
@@ -43,7 +43,7 @@ import {
43
43
  resolveEffectivePinRaw,
44
44
  safeWriteJsonAtomic,
45
45
  setConfigHash
46
- } from "../chunk-DXFM62EZ.js";
46
+ } from "../chunk-IXN2AFOX.js";
47
47
  import {
48
48
  getProjectDir as getProjectDir2,
49
49
  getReadyTasks,
@@ -145,16 +145,16 @@ import {
145
145
  toOpencodeModel,
146
146
  transcriptActivityAgeSeconds,
147
147
  writeEgressAllowlist
148
- } from "../chunk-EP6TURK5.js";
148
+ } from "../chunk-MQHDPJZD.js";
149
149
  import {
150
150
  reapOrphanChannelMcps
151
151
  } from "../chunk-XWVM4KPK.js";
152
152
 
153
153
  // src/lib/manager-worker.ts
154
- import { createHash as createHash14 } from "crypto";
155
- import { readFileSync as readFileSync17, writeFileSync as writeFileSync11, mkdirSync as mkdirSync9, existsSync as existsSync11, rmSync as rmSync5, readdirSync as readdirSync5, statSync as statSync4, copyFileSync } from "fs";
154
+ import { createHash as createHash13 } from "crypto";
155
+ import { readFileSync as readFileSync17, writeFileSync as writeFileSync11, mkdirSync as mkdirSync8, existsSync as existsSync11, rmSync as rmSync5, readdirSync as readdirSync5, statSync as statSync4, copyFileSync } from "fs";
156
156
  import { execFileSync as syncExecFile } from "child_process";
157
- import { join as join21, dirname as dirname6, delimiter as pathDelimiter } from "path";
157
+ import { join as join21, dirname as dirname5, delimiter as pathDelimiter } from "path";
158
158
  import { homedir as homedir10 } from "os";
159
159
  import { fileURLToPath } from "url";
160
160
 
@@ -4987,35 +4987,10 @@ function closeScheduledRunsForCode(codeName, outcome, reason) {
4987
4987
  }
4988
4988
 
4989
4989
  // src/lib/manager/scheduler/kanban-route.ts
4990
- import { createHash as createHash9 } from "crypto";
4991
- import { writeFileSync as writeFileSync8, renameSync, mkdirSync as mkdirSync6 } from "fs";
4992
- import { homedir as homedir7 } from "os";
4993
- import { join as join17, dirname as dirname5 } from "path";
4994
-
4995
- // src/lib/manager/scheduler/notify.ts
4996
4990
  import { createHash as createHash8 } from "crypto";
4997
- async function enqueueScheduledTaskNotice(opts) {
4998
- try {
4999
- const res = await api.post(
5000
- "/host/scheduled-task/notify",
5001
- {
5002
- agent_id: opts.agentId,
5003
- task_id: opts.taskId,
5004
- card_id: opts.cardId,
5005
- content: opts.content,
5006
- run_id: opts.runId ?? void 0
5007
- }
5008
- );
5009
- return res.ok === true;
5010
- } catch (err) {
5011
- const errText = err instanceof Error ? err.message : String(err);
5012
- const errId = createHash8("sha256").update(errText).digest("hex").slice(0, 12);
5013
- log(
5014
- `[scheduled-kanban] notice enqueue failed for agent_id=${opts.agentId} task_id=${opts.taskId} error_id=${errId}`
5015
- );
5016
- return false;
5017
- }
5018
- }
4991
+ import { writeFileSync as writeFileSync8, renameSync } from "fs";
4992
+ import { homedir as homedir7 } from "os";
4993
+ import { join as join17 } from "path";
5019
4994
 
5020
4995
  // src/lib/manager/delivery/scheduled-output.ts
5021
4996
  async function deliverScheduledTaskOutput(agentCodeName, agentId, rawTarget, body, taskId) {
@@ -5361,24 +5336,22 @@ async function routeScheduledTaskViaKanban(codeName, agentId, task, prompt) {
5361
5336
  ` + 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.
5362
5337
  ` + suppressionTeaching + formatRunMarker(run_id);
5363
5338
  stampScheduledTurnMarker(codeName, task.taskId, resolveScheduledSlackTarget(task));
5364
- const enqueued = await enqueueScheduledTaskNotice({
5365
- agentId,
5366
- taskId: task.taskId,
5367
- cardId: kanban_item_id,
5368
- content: nudge,
5369
- runId: run_id
5370
- });
5371
- if (!enqueued) {
5372
- log(`[scheduled-kanban] durable nudge enqueue failed for task '${task.name}' on '${codeName}' - closing card + run`);
5373
- void finishRun(run_id, "failed", { outcomeMessage: "scheduled-task durable nudge enqueue failed", completeKanbanItemId: kanban_item_id });
5374
- return false;
5375
- }
5339
+ let injectStatus;
5376
5340
  try {
5377
- const doorbell = directChatDoorbellPath(agentId, homedir7());
5378
- mkdirSync6(dirname5(doorbell), { recursive: true });
5379
- writeFileSync8(doorbell, String(Date.now()));
5341
+ injectStatus = await injectMessageWithStatus(codeName, "task", nudge, { task_name: "scheduled-task-do-now" }, log);
5380
5342
  } catch (err) {
5381
- log(`[scheduled-kanban] doorbell ring failed for '${codeName}': ${err.message} (notice still queued)`);
5343
+ log(`[scheduled-kanban] nudge injection threw for task '${task.name}' on '${codeName}': ${err.message} \u2014 closing card + falling back to claude -p`);
5344
+ void finishRun(run_id, "failed", { outcomeMessage: "scheduled-task nudge delivery threw", completeKanbanItemId: kanban_item_id });
5345
+ return false;
5346
+ }
5347
+ const { delivered, fallbackUsed } = injectStatus;
5348
+ if (!delivered && !fallbackUsed) {
5349
+ log(`[scheduled-kanban] nudge delivery failed for task '${task.name}' on '${codeName}' \u2014 closing card + falling back to claude -p`);
5350
+ void finishRun(run_id, "failed", { outcomeMessage: "scheduled-task nudge delivery failed", completeKanbanItemId: kanban_item_id });
5351
+ return false;
5352
+ }
5353
+ if (!delivered && fallbackUsed) {
5354
+ log(`[scheduled-kanban] nudge sent via send-keys (unverified) for task '${task.name}' on '${codeName}' \u2014 proceeding without oneshot fallback`);
5382
5355
  }
5383
5356
  trackScheduledRun(codeName, kanban_item_id, run_id);
5384
5357
  log(`[scheduled-kanban] Routed task '${task.name}' for '${codeName}' via todo card ${kanban_item_id} run_id=${run_id}`);
@@ -5423,24 +5396,24 @@ async function processClaudeTaskResult(codeName, agentId, templateId, rawOutput,
5423
5396
  const assertion = parseDeliverAssertion(rawOutput);
5424
5397
  if (!assertion.deliver) {
5425
5398
  const trimmed = (rawOutput ?? "").trim();
5426
- const outputHash = trimmed.length === 0 ? "empty" : createHash9("sha256").update(trimmed).digest("hex").slice(0, 12);
5399
+ const outputHash = trimmed.length === 0 ? "empty" : createHash8("sha256").update(trimmed).digest("hex").slice(0, 12);
5427
5400
  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}`);
5428
5401
  if (delivery?.mode === "announce" && delivery.to) {
5429
5402
  await reportDeliveryStatus(agentId, delivery.taskId, { status: "skipped", error_code: "SUPPRESSED_BY_POLICY" });
5430
5403
  }
5431
5404
  return { ok: true };
5432
5405
  }
5433
- const reasonHash = createHash9("sha256").update(assertion.reason ?? "").digest("hex").slice(0, 12);
5406
+ const reasonHash = createHash8("sha256").update(assertion.reason ?? "").digest("hex").slice(0, 12);
5434
5407
  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})`);
5435
5408
  rawOutput = assertion.deliverable;
5436
5409
  }
5437
5410
  const classification = classifyOutput(rawOutput);
5438
5411
  if (classification.action === "suppress") {
5439
5412
  const trimmed = (rawOutput ?? "").trim();
5440
- const outputHash = trimmed.length === 0 ? "empty" : createHash9("sha256").update(trimmed).digest("hex").slice(0, 12);
5413
+ const outputHash = trimmed.length === 0 ? "empty" : createHash8("sha256").update(trimmed).digest("hex").slice(0, 12);
5441
5414
  log(`[claude-scheduler] Suppressing delivery for '${codeName}' (template=${templateId}, task=${delivery?.taskId ?? "n/a"}) \u2014 output_len=${trimmed.length} output_hash=${outputHash}`);
5442
5415
  if (classification.suppressedNotes) {
5443
- const notesHash = createHash9("sha256").update(classification.suppressedNotes).digest("hex").slice(0, 12);
5416
+ const notesHash = createHash8("sha256").update(classification.suppressedNotes).digest("hex").slice(0, 12);
5444
5417
  log(`[claude-scheduler] Suppressed notes for '${codeName}' (task=${delivery?.taskId ?? "n/a"}) \u2014 notes_len=${classification.suppressedNotes.length} notes_hash=${notesHash}`);
5445
5418
  }
5446
5419
  if (delivery?.mode === "announce" && delivery.to) {
@@ -5506,7 +5479,7 @@ async function processClaudeTaskResult(codeName, agentId, templateId, rawOutput,
5506
5479
  }
5507
5480
 
5508
5481
  // src/lib/manager/scheduler/execution.ts
5509
- import { createHash as createHash10 } from "crypto";
5482
+ import { createHash as createHash9 } from "crypto";
5510
5483
  import { homedir as homedir8 } from "os";
5511
5484
  import { join as join18 } from "path";
5512
5485
  function claudePidFilePath() {
@@ -5530,10 +5503,10 @@ function unregisterClaudeSpawn(pid) {
5530
5503
  }
5531
5504
  async function syncAndCheckClaudeScheduler(agent, tasks, boardItems, refreshData) {
5532
5505
  const codeName = agent.code_name;
5533
- const stableTasksHash = createHash10("sha256").update(JSON.stringify(tasks)).digest("hex").slice(0, 16);
5534
- 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";
5506
+ const stableTasksHash = createHash9("sha256").update(JSON.stringify(tasks)).digest("hex").slice(0, 16);
5507
+ 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";
5535
5508
  const resolvedModels = resolveModelChain(refreshData);
5536
- const modelsHash = createHash10("sha256").update(JSON.stringify(resolvedModels)).digest("hex").slice(0, 16);
5509
+ const modelsHash = createHash9("sha256").update(JSON.stringify(resolvedModels)).digest("hex").slice(0, 16);
5537
5510
  const combinedHash = `${stableTasksHash}:${boardHash}:${modelsHash}`;
5538
5511
  const prevHash = agentState.knownTasksHashes.get(agent.agent_id);
5539
5512
  if (combinedHash !== prevHash) {
@@ -5571,7 +5544,7 @@ async function syncAndCheckClaudeScheduler(agent, tasks, boardItems, refreshData
5571
5544
  }
5572
5545
 
5573
5546
  // src/lib/opencode-slack-ingest.ts
5574
- import { createHash as createHash11 } from "crypto";
5547
+ import { createHash as createHash10 } from "crypto";
5575
5548
 
5576
5549
  // ../../packages/core/dist/channels/slack-rich-text.js
5577
5550
  var MAX_DEPTH = 12;
@@ -6507,7 +6480,7 @@ function startSlackIngest(config2) {
6507
6480
  // src/lib/opencode-slack-ingest.ts
6508
6481
  var ingests = /* @__PURE__ */ new Map();
6509
6482
  function fingerprint(params) {
6510
- return createHash11("sha256").update(
6483
+ return createHash10("sha256").update(
6511
6484
  JSON.stringify({
6512
6485
  appToken: params.appToken,
6513
6486
  botToken: params.botToken,
@@ -6588,7 +6561,7 @@ function stopAllOpencodeSlackIngests(log2) {
6588
6561
  }
6589
6562
 
6590
6563
  // src/lib/manager/opencode-scheduler.ts
6591
- import { createHash as createHash12 } from "crypto";
6564
+ import { createHash as createHash11 } from "crypto";
6592
6565
  var MAX_OPENCODE_SCHED_CONCURRENCY = 2;
6593
6566
  var opencodeSchedulerStates = /* @__PURE__ */ new Map();
6594
6567
  var inFlightOpencodeTasks = /* @__PURE__ */ new Set();
@@ -6602,7 +6575,7 @@ function shouldDeliver(task, reply) {
6602
6575
  }
6603
6576
  async function syncAndCheckOpencodeScheduler(agent, tasks, refreshData) {
6604
6577
  const codeName = agent.code_name;
6605
- const tasksHash = createHash12("sha256").update(JSON.stringify(tasks)).digest("hex").slice(0, 16);
6578
+ const tasksHash = createHash11("sha256").update(JSON.stringify(tasks)).digest("hex").slice(0, 16);
6606
6579
  if (knownOpencodeTaskHashes.get(agent.agent_id) !== tasksHash) {
6607
6580
  const taskInputs = tasks.map((t) => buildSchedulerTaskInput(t));
6608
6581
  const state8 = syncTasksToScheduler(codeName, agent.agent_id, taskInputs);
@@ -6680,8 +6653,8 @@ async function fireOpencodeScheduledTask(agent, task) {
6680
6653
  }
6681
6654
 
6682
6655
  // src/lib/opencode-telegram-ingest.ts
6683
- import { createHash as createHash13 } from "crypto";
6684
- import { existsSync as existsSync9, mkdirSync as mkdirSync7, readFileSync as readFileSync15, renameSync as renameSync2, unlinkSync, writeFileSync as writeFileSync9 } from "fs";
6656
+ import { createHash as createHash12 } from "crypto";
6657
+ import { existsSync as existsSync9, mkdirSync as mkdirSync6, readFileSync as readFileSync15, renameSync as renameSync2, unlinkSync, writeFileSync as writeFileSync9 } from "fs";
6685
6658
  import { randomUUID } from "crypto";
6686
6659
  import { join as join19 } from "path";
6687
6660
 
@@ -7216,7 +7189,7 @@ function anySignal(signals) {
7216
7189
  // src/lib/opencode-telegram-ingest.ts
7217
7190
  var ingests2 = /* @__PURE__ */ new Map();
7218
7191
  function fingerprint2(params) {
7219
- return createHash13("sha256").update(
7192
+ return createHash12("sha256").update(
7220
7193
  JSON.stringify({
7221
7194
  botToken: params.botToken,
7222
7195
  allowedChats: [...params.allowedChats].sort(),
@@ -7258,7 +7231,7 @@ function createFileOffsetStore(codeName, log2, currentBotId) {
7258
7231
  if (!filePath || !dir) return;
7259
7232
  const tmpPath = `${filePath}.${process.pid}.${randomUUID()}.tmp`;
7260
7233
  try {
7261
- mkdirSync7(dir, { recursive: true, mode: 448 });
7234
+ mkdirSync6(dir, { recursive: true, mode: 448 });
7262
7235
  writeFileSync9(
7263
7236
  tmpPath,
7264
7237
  JSON.stringify({
@@ -7490,7 +7463,7 @@ function partitionActionableByPoison(actionable, states, config2) {
7490
7463
  }
7491
7464
 
7492
7465
  // src/lib/restart-flags.ts
7493
- import { existsSync as existsSync10, mkdirSync as mkdirSync8, readdirSync as readdirSync4, readFileSync as readFileSync16, renameSync as renameSync3, rmSync as rmSync4, writeFileSync as writeFileSync10 } from "fs";
7466
+ import { existsSync as existsSync10, mkdirSync as mkdirSync7, readdirSync as readdirSync4, readFileSync as readFileSync16, renameSync as renameSync3, rmSync as rmSync4, writeFileSync as writeFileSync10 } from "fs";
7494
7467
  import { homedir as homedir9 } from "os";
7495
7468
  import { join as join20 } from "path";
7496
7469
  import { randomUUID as randomUUID2 } from "crypto";
@@ -8772,7 +8745,7 @@ var sessionLaunchManagedStructure = /* @__PURE__ */ new Map();
8772
8745
  function projectMcpHash(_codeName, projectDir) {
8773
8746
  try {
8774
8747
  const raw = readFileSync17(join21(projectDir, ".mcp.json"), "utf-8");
8775
- return createHash14("sha256").update(canonicalJson(JSON.parse(raw))).digest("hex");
8748
+ return createHash13("sha256").update(canonicalJson(JSON.parse(raw))).digest("hex");
8776
8749
  } catch {
8777
8750
  return null;
8778
8751
  }
@@ -9120,7 +9093,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
9120
9093
  var lastVersionCheckAt = 0;
9121
9094
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
9122
9095
  var lastResponsivenessProbeAt = 0;
9123
- var agtCliVersion = true ? "0.28.382" : "dev";
9096
+ var agtCliVersion = true ? "0.28.384" : "dev";
9124
9097
  function resolveBrewPath(execFileSync2) {
9125
9098
  try {
9126
9099
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -9215,7 +9188,7 @@ async function ensureToolkitCli(toolkitSlug) {
9215
9188
  toolkitCliEnsured.add(toolkitSlug);
9216
9189
  return;
9217
9190
  }
9218
- brewBinDir = dirname6(brewPath);
9191
+ brewBinDir = dirname5(brewPath);
9219
9192
  const isRoot = typeof process.getuid === "function" && process.getuid() === 0;
9220
9193
  log(`[toolkit-install] ${toolkitSlug}: installing via brew (${pkg})\u2026`);
9221
9194
  if (isRoot) {
@@ -9425,7 +9398,7 @@ function ensureClaudeManagedSettings(path = claudeManagedSettingsPath()) {
9425
9398
  }
9426
9399
  if (settings.channelsEnabled === true) return "ok";
9427
9400
  settings.channelsEnabled = true;
9428
- mkdirSync9(dirname6(path), { recursive: true });
9401
+ mkdirSync8(dirname5(path), { recursive: true });
9429
9402
  writeFileSync11(path, `${JSON.stringify(settings, null, 2)}
9430
9403
  `);
9431
9404
  log(`[managed-settings] set channelsEnabled:true in ${path} (ENG-5786 \u2014 unblocks Claude Code channels)`);
@@ -9521,7 +9494,7 @@ async function ensureFrameworkBinary(frameworkId) {
9521
9494
  log(`Claude Code install failed: ${err.message}`);
9522
9495
  return;
9523
9496
  }
9524
- const brewBinDir = dirname6(brewPath);
9497
+ const brewBinDir = dirname5(brewPath);
9525
9498
  if (!process.env.PATH?.split(":").includes(brewBinDir)) {
9526
9499
  process.env.PATH = `${brewBinDir}:${process.env.PATH ?? ""}`;
9527
9500
  }
@@ -9955,7 +9928,7 @@ function ensureEvalEmptyMcpConfig() {
9955
9928
  if (evalEmptyMcpConfigPath && existsSync11(evalEmptyMcpConfigPath)) return evalEmptyMcpConfigPath;
9956
9929
  const dir = join21(homedir10(), ".augmented");
9957
9930
  try {
9958
- mkdirSync9(dir, { recursive: true });
9931
+ mkdirSync8(dir, { recursive: true });
9959
9932
  } catch {
9960
9933
  }
9961
9934
  const p = join21(dir, ".eval-empty-mcp.json");
@@ -10249,7 +10222,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
10249
10222
  if (codeNames.length === 0) return;
10250
10223
  void (async () => {
10251
10224
  try {
10252
- const { collectDiagnostics } = await import("../persistent-session-FZF7EPUW.js");
10225
+ const { collectDiagnostics } = await import("../persistent-session-MDQVHXKX.js");
10253
10226
  await api.post("/host/heartbeat", {
10254
10227
  host_id: hostId,
10255
10228
  agent_diagnostics: collectDiagnostics(codeNames)
@@ -10348,7 +10321,7 @@ async function pollCycle() {
10348
10321
  }
10349
10322
  try {
10350
10323
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
10351
- const { collectDiagnostics } = await import("../persistent-session-FZF7EPUW.js");
10324
+ const { collectDiagnostics } = await import("../persistent-session-MDQVHXKX.js");
10352
10325
  const diagCodeNames = [...agentState.persistentSessionAgents];
10353
10326
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
10354
10327
  let tailscaleHostname;
@@ -10378,7 +10351,7 @@ async function pollCycle() {
10378
10351
  claudeAuth = await detectClaudeAuth();
10379
10352
  } catch (err) {
10380
10353
  const errText = err instanceof Error ? err.message : String(err);
10381
- const errId = createHash14("sha256").update(errText).digest("hex").slice(0, 12);
10354
+ const errId = createHash13("sha256").update(errText).digest("hex").slice(0, 12);
10382
10355
  log(`Claude auth detection failed (error_id=${errId})`);
10383
10356
  }
10384
10357
  const hostHasClaudeCode = state6.agents.some(
@@ -10503,7 +10476,7 @@ async function pollCycle() {
10503
10476
  const {
10504
10477
  collectResponsivenessProbes,
10505
10478
  getResponsivenessIntervalMs
10506
- } = await import("../responsiveness-probe-JYF7XPI2.js");
10479
+ } = await import("../responsiveness-probe-CG7XM7GL.js");
10507
10480
  const probeIntervalMs = getResponsivenessIntervalMs();
10508
10481
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
10509
10482
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -10535,7 +10508,7 @@ async function pollCycle() {
10535
10508
  collectResponsivenessProbes,
10536
10509
  livePendingInboundOldestAgeSeconds,
10537
10510
  parkPendingInbound
10538
- } = await import("../responsiveness-probe-JYF7XPI2.js");
10511
+ } = await import("../responsiveness-probe-CG7XM7GL.js");
10539
10512
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-HYOOQV4A.js");
10540
10513
  const wedgeNow = /* @__PURE__ */ new Date();
10541
10514
  const liveAgents = agentState.persistentSessionAgents;
@@ -11337,7 +11310,7 @@ async function processAgent(agent, agentStates) {
11337
11310
  try {
11338
11311
  const artifacts = generateArtifacts(agent, refreshData, frameworkAdapter);
11339
11312
  const changedFiles = [];
11340
- mkdirSync9(agentDir, { recursive: true });
11313
+ mkdirSync8(agentDir, { recursive: true });
11341
11314
  for (const artifact of artifacts) {
11342
11315
  const filePath = join21(agentDir, artifact.relativePath);
11343
11316
  let existingHash;
@@ -11415,7 +11388,7 @@ async function processAgent(agent, agentStates) {
11415
11388
  log(`${verb} '${agent.code_name}': ${fileNames}`);
11416
11389
  for (const file of changedFiles) {
11417
11390
  const filePath = join21(agentDir, file.relativePath);
11418
- mkdirSync9(dirname6(filePath), { recursive: true });
11391
+ mkdirSync8(dirname5(filePath), { recursive: true });
11419
11392
  if (file.relativePath === ".mcp.json") {
11420
11393
  safeWriteJsonAtomic(filePath, file.content, { mode: 384 });
11421
11394
  } else {
@@ -11747,7 +11720,7 @@ async function processAgent(agent, agentStates) {
11747
11720
  const writeDmNoticeMarkers = isChannelAddRestart ? () => {
11748
11721
  try {
11749
11722
  const agentAugmentedDir = join21(homedir10(), ".augmented", agent.code_name);
11750
- mkdirSync9(agentAugmentedDir, { recursive: true });
11723
+ mkdirSync8(agentAugmentedDir, { recursive: true });
11751
11724
  const markerJson = JSON.stringify({
11752
11725
  version: 1,
11753
11726
  at: (/* @__PURE__ */ new Date()).toISOString(),
@@ -11830,7 +11803,7 @@ async function processAgent(agent, agentStates) {
11830
11803
  const behaviourSubset = extractMsTeamsBehaviourSubset(
11831
11804
  msteamsEntry?.config
11832
11805
  );
11833
- const behaviourHash = createHash14("sha256").update(canonicalJson(behaviourSubset)).digest("hex");
11806
+ const behaviourHash = createHash13("sha256").update(canonicalJson(behaviourSubset)).digest("hex");
11834
11807
  const prevBehaviourHash = agentState.knownMsTeamsBehaviourHashes.get(agent.agent_id);
11835
11808
  const msteamsBehaviourRestrictive = isMsTeamsBehaviourRestrictive(behaviourSubset);
11836
11809
  const behaviourDecision = decideSenderPolicyRestart({
@@ -11886,7 +11859,7 @@ async function processAgent(agent, agentStates) {
11886
11859
  const slackBehaviourSubset = extractSlackBehaviourSubset(
11887
11860
  slackEntry?.config
11888
11861
  );
11889
- const slackBehaviourHash = createHash14("sha256").update(canonicalJson(slackBehaviourSubset)).digest("hex");
11862
+ const slackBehaviourHash = createHash13("sha256").update(canonicalJson(slackBehaviourSubset)).digest("hex");
11890
11863
  const prevSlackBehaviourHash = agentState.knownSlackBehaviourHashes.get(agent.agent_id);
11891
11864
  const slackBehaviourRestrictive = isSlackBehaviourRestrictive(slackBehaviourSubset);
11892
11865
  const slackBehaviourDecision = decideSenderPolicyRestart({
@@ -11944,8 +11917,8 @@ async function processAgent(agent, agentStates) {
11944
11917
  try {
11945
11918
  const agentProvisionDir = agentDir;
11946
11919
  const projectDir = join21(homedir10(), ".augmented", agent.code_name, "project");
11947
- mkdirSync9(agentProvisionDir, { recursive: true });
11948
- mkdirSync9(projectDir, { recursive: true });
11920
+ mkdirSync8(agentProvisionDir, { recursive: true });
11921
+ mkdirSync8(projectDir, { recursive: true });
11949
11922
  const provisionMcpPath = join21(agentProvisionDir, ".mcp.json");
11950
11923
  const projectMcpPath = join21(projectDir, ".mcp.json");
11951
11924
  let mcpConfig = { mcpServers: {} };
@@ -12270,10 +12243,10 @@ async function processAgent(agent, agentStates) {
12270
12243
  desiredEntries.push({ serverId, url, headers: mcpHeaders, name: tk.toolkit_name });
12271
12244
  }
12272
12245
  const hashBasis = desiredEntries.slice().sort((a, b) => a.serverId.localeCompare(b.serverId)).map((e) => {
12273
- const headersHash = createHash14("sha256").update(canonicalJson(e.headers ?? {})).digest("hex").slice(0, 16);
12246
+ const headersHash = createHash13("sha256").update(canonicalJson(e.headers ?? {})).digest("hex").slice(0, 16);
12274
12247
  return `${e.serverId}|${e.url}|${headersHash}`;
12275
12248
  }).join("\n");
12276
- const mcpHash = createHash14("sha256").update(hashBasis).digest("hex").slice(0, 16);
12249
+ const mcpHash = createHash13("sha256").update(hashBasis).digest("hex").slice(0, 16);
12277
12250
  const prevMcpHash = agentState.knownManagedMcpHashes.get(agent.agent_id);
12278
12251
  const structureHash = managedMcpStructureHash(desiredEntries);
12279
12252
  const prevStructureHash = agentState.knownManagedMcpStructure.get(agent.agent_id);
@@ -12288,7 +12261,7 @@ async function processAgent(agent, agentStates) {
12288
12261
  if (mcpHash !== prevMcpHash) {
12289
12262
  for (const e of desiredEntries) {
12290
12263
  frameworkAdapter.writeMcpServer(agent.code_name, e.serverId, { url: e.url, headers: e.headers });
12291
- const urlHash = createHash14("sha256").update(e.url).digest("hex").slice(0, 12);
12264
+ const urlHash = createHash13("sha256").update(e.url).digest("hex").slice(0, 12);
12292
12265
  log(`[managed-toolkit] ${agent.code_name}: wrote '${e.name}' (serverId=${e.serverId}, url_hash=${urlHash})`);
12293
12266
  }
12294
12267
  if (frameworkAdapter.removeMcpServer && frameworkAdapter.getMcpPath) {
@@ -12397,7 +12370,7 @@ async function processAgent(agent, agentStates) {
12397
12370
  if (frameworkAdapter.installSkillFiles) {
12398
12371
  const currentIntegrationSkillIds = /* @__PURE__ */ new Set();
12399
12372
  const installedIntegrationSkills = [];
12400
- const { createHash: createHash15 } = await import("crypto");
12373
+ const { createHash: createHash14 } = await import("crypto");
12401
12374
  const refreshAny = refreshData;
12402
12375
  const contexts = refreshAny.integration_contexts ?? refreshAny.plugin_contexts ?? [];
12403
12376
  const contextBySlug = /* @__PURE__ */ new Map();
@@ -12426,7 +12399,7 @@ async function processAgent(agent, agentStates) {
12426
12399
  )
12427
12400
  }));
12428
12401
  const bundle = buildIntegrationBundle(renderedScopes);
12429
- const contentHash = createHash15("sha256").update(bundleFingerprint(bundle.files)).digest("hex").slice(0, 12);
12402
+ const contentHash = createHash14("sha256").update(bundleFingerprint(bundle.files)).digest("hex").slice(0, 12);
12430
12403
  const hashKey = `plugin-skill:${agent.agent_id}:${integrationSkillId}`;
12431
12404
  if (agentState.knownSkillHashes.get(hashKey) === contentHash) continue;
12432
12405
  frameworkAdapter.installSkillFiles(agent.code_name, integrationSkillId, bundle.files);
@@ -12493,7 +12466,7 @@ async function processAgent(agent, agentStates) {
12493
12466
  const plan = planGlobalSkillSync(
12494
12467
  [...globalSkillsPayload ?? [], ...sharedSkillsPayload ?? []],
12495
12468
  prevIds,
12496
- (content) => createHash15("sha256").update(content).digest("hex").slice(0, 12),
12469
+ (content) => createHash14("sha256").update(content).digest("hex").slice(0, 12),
12497
12470
  (skillId) => agentState.knownSkillHashes.get(`global-skill:${agent.agent_id}:${skillId}`),
12498
12471
  { desiredResolved }
12499
12472
  );
@@ -12544,7 +12517,7 @@ async function processAgent(agent, agentStates) {
12544
12517
  const slug = hook.integration_slug ?? hook.plugin_slug;
12545
12518
  if (!slug) continue;
12546
12519
  try {
12547
- const scriptHash = createHash15("sha256").update(hook.script).digest("hex").slice(0, 12);
12520
+ const scriptHash = createHash14("sha256").update(hook.script).digest("hex").slice(0, 12);
12548
12521
  const hookKey = `${agent.agent_id}:${frameworkAdapter.id}:plugin-hook:${slug}:on_install`;
12549
12522
  if (agentState.knownSkillHashes.get(hookKey) === scriptHash) continue;
12550
12523
  const result = await frameworkAdapter.executePluginHook({
@@ -12559,9 +12532,9 @@ async function processAgent(agent, agentStates) {
12559
12532
  } else if (result.timedOut) {
12560
12533
  log(`Integration hook on_install '${slug}' TIMED OUT for '${agent.code_name}' after ${result.durationMs}ms`);
12561
12534
  } else {
12562
- const stderrHash = createHash15("sha256").update(result.stderr).digest("hex").slice(0, 12);
12535
+ const stderrHash = createHash14("sha256").update(result.stderr).digest("hex").slice(0, 12);
12563
12536
  const missingCmd = result.exitCode === 127 ? extractCommandNotFound(result.stderr) : null;
12564
- const missingCmdHash = missingCmd ? createHash15("sha256").update(missingCmd).digest("hex").slice(0, 8) : null;
12537
+ const missingCmdHash = missingCmd ? createHash14("sha256").update(missingCmd).digest("hex").slice(0, 8) : null;
12565
12538
  log(
12566
12539
  `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}]`
12567
12540
  );
@@ -13350,7 +13323,7 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
13350
13323
  const ctx = getLastFailureContext(codeName);
13351
13324
  const recovery = prepareForRespawn(codeName);
13352
13325
  const tailSummary = !ctx.tail ? "" : KNOWN_SAFE_TAIL_SIGNATURES.has(ctx.signature) ? `; last pane output (${PANE_TAIL_PREVIEW_LINES} of ~20 lines):
13353
- ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash14("sha256").update(ctx.tail).digest("hex").slice(0, 12)} (raw at ~/.augmented/${codeName}/pane.log)`;
13326
+ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash13("sha256").update(ctx.tail).digest("hex").slice(0, 12)} (raw at ~/.augmented/${codeName}/pane.log)`;
13354
13327
  const sigSummary = ctx.signature !== "unknown" ? `; signature=${ctx.signature}` : "";
13355
13328
  const recoverySummary = recovery ? `; recovery=${recovery}` : "";
13356
13329
  log(
@@ -13364,7 +13337,7 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash14("sha256")
13364
13337
  );
13365
13338
  getHostId().then((hostId) => {
13366
13339
  if (!hostId) return;
13367
- const paneTailHash = zombie.paneTail ? `sha256:${createHash14("sha256").update(zombie.paneTail).digest("hex").slice(0, 12)}` : null;
13340
+ const paneTailHash = zombie.paneTail ? `sha256:${createHash13("sha256").update(zombie.paneTail).digest("hex").slice(0, 12)}` : null;
13368
13341
  return api.post("/host/events", {
13369
13342
  host_id: hostId,
13370
13343
  agent_code_name: codeName,
@@ -13513,7 +13486,7 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash14("sha256")
13513
13486
  if (!claudeAuthTupleBySession.has(codeName)) {
13514
13487
  claudeAuthTupleBySession.set(codeName, currentAuthTuple);
13515
13488
  }
13516
- const stableTasksHash = createHash14("sha256").update(JSON.stringify(tasks)).digest("hex").slice(0, 16);
13489
+ const stableTasksHash = createHash13("sha256").update(JSON.stringify(tasks)).digest("hex").slice(0, 16);
13517
13490
  const prevHash = agentState.knownTasksHashes.get(agent.agent_id);
13518
13491
  if (stableTasksHash !== prevHash) {
13519
13492
  const taskInputs = tasks.map((t) => buildSchedulerTaskInput(t));
@@ -13730,7 +13703,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
13730
13703
  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}`));
13731
13704
  void (async () => {
13732
13705
  try {
13733
- const { collectDiagnostics } = await import("../persistent-session-FZF7EPUW.js");
13706
+ const { collectDiagnostics } = await import("../persistent-session-MDQVHXKX.js");
13734
13707
  await api.post("/host/heartbeat", {
13735
13708
  host_id: hostId,
13736
13709
  agent_diagnostics: collectDiagnostics([codeName])
@@ -13780,7 +13753,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
13780
13753
  }
13781
13754
  try {
13782
13755
  const hostId = await getHostId();
13783
- const { collectDiagnostics } = await import("../persistent-session-FZF7EPUW.js");
13756
+ const { collectDiagnostics } = await import("../persistent-session-MDQVHXKX.js");
13784
13757
  await api.post("/host/heartbeat", {
13785
13758
  host_id: hostId,
13786
13759
  agent_diagnostics: collectDiagnostics([codeName])
@@ -14066,7 +14039,7 @@ async function processDirectChatMessage(agent, msg) {
14066
14039
  if (useDoorbell) {
14067
14040
  try {
14068
14041
  const doorbell = directChatDoorbellPath(agent.agentId, homedir10());
14069
- mkdirSync9(dirname6(doorbell), { recursive: true });
14042
+ mkdirSync8(dirname5(doorbell), { recursive: true });
14070
14043
  writeFileSync11(doorbell, String(Date.now()));
14071
14044
  log(`[direct-chat] Doorbell rung for '${agent.codeName}' (msg=${msg.id}) \u2014 in-session MCP will pull via the cursor`);
14072
14045
  return;
@@ -14176,7 +14149,7 @@ ${formatRunMarker(run_id)}` : KANBAN_CHECK_COMMAND;
14176
14149
  if (run_id) openInjectedRunByCode.set(codeName, run_id);
14177
14150
  try {
14178
14151
  const doorbell = directChatDoorbellPath(agentId, homedir10());
14179
- mkdirSync9(dirname6(doorbell), { recursive: true });
14152
+ mkdirSync8(dirname5(doorbell), { recursive: true });
14180
14153
  writeFileSync11(doorbell, String(Date.now()));
14181
14154
  } catch (err) {
14182
14155
  log(`[kanban] doorbell ring failed for '${codeName}': ${err.message} (notice still queued)`);
@@ -14233,7 +14206,7 @@ async function processClaudePairSessions(agents) {
14233
14206
  killPairSession,
14234
14207
  pairTmuxSession,
14235
14208
  finalizeClaudePairOnboarding
14236
- } = await import("../claude-pair-runtime-YF3ZEFKV.js");
14209
+ } = await import("../claude-pair-runtime-OIK6HKPS.js");
14237
14210
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
14238
14211
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
14239
14212
  const killed = await killPairSession(pairTmuxSession(pairId));
@@ -14503,7 +14476,7 @@ async function syncMemories(agent, configDir, log2) {
14503
14476
  if (!file.endsWith(".md")) continue;
14504
14477
  try {
14505
14478
  const raw = readFileSync17(join21(memoryDir, file), "utf-8");
14506
- const fileHash = createHash14("sha256").update(raw).digest("hex").slice(0, 16);
14479
+ const fileHash = createHash13("sha256").update(raw).digest("hex").slice(0, 16);
14507
14480
  currentHashes.set(file, fileHash);
14508
14481
  if (prevHashes.get(file) === fileHash) continue;
14509
14482
  const parsed = parseMemoryFile(raw, file.replace(/\.md$/, ""));
@@ -14541,21 +14514,21 @@ async function syncMemories(agent, configDir, log2) {
14541
14514
  }
14542
14515
  async function downloadMemories(agent, memoryDir, log2, { force }) {
14543
14516
  const localFiles = existsSync11(memoryDir) ? readdirSync5(memoryDir).filter((f) => f.endsWith(".md")).sort() : [];
14544
- const localListHash = createHash14("sha256").update(localFiles.join(",")).digest("hex").slice(0, 16);
14517
+ const localListHash = createHash13("sha256").update(localFiles.join(",")).digest("hex").slice(0, 16);
14545
14518
  const prevLocalHash = lastLocalFileHash.get(agent.agent_id);
14546
14519
  const prevDownload = lastDownloadHash.get(agent.agent_id);
14547
14520
  try {
14548
14521
  const dbMemories = await api.post("/host/memories", {
14549
14522
  agent_id: agent.agent_id
14550
14523
  });
14551
- const responseHash = createHash14("sha256").update(JSON.stringify(dbMemories.memories ?? [])).digest("hex").slice(0, 16);
14524
+ const responseHash = createHash13("sha256").update(JSON.stringify(dbMemories.memories ?? [])).digest("hex").slice(0, 16);
14552
14525
  if (!force && prevDownload && prevLocalHash === localListHash && lastDownloadHash.get(agent.agent_id) === responseHash) {
14553
14526
  return true;
14554
14527
  }
14555
14528
  lastDownloadHash.set(agent.agent_id, responseHash);
14556
14529
  lastLocalFileHash.set(agent.agent_id, localListHash);
14557
14530
  if (dbMemories.memories?.length) {
14558
- mkdirSync9(memoryDir, { recursive: true });
14531
+ mkdirSync8(memoryDir, { recursive: true });
14559
14532
  let written = 0;
14560
14533
  let overwritten = 0;
14561
14534
  for (let i = 0; i < dbMemories.memories.length; i++) {
@@ -14587,7 +14560,7 @@ ${mem.content}
14587
14560
  }
14588
14561
  if (written > 0 || overwritten > 0) {
14589
14562
  const updatedFiles = readdirSync5(memoryDir).filter((f) => f.endsWith(".md")).sort();
14590
- lastLocalFileHash.set(agent.agent_id, createHash14("sha256").update(updatedFiles.join(",")).digest("hex").slice(0, 16));
14563
+ lastLocalFileHash.set(agent.agent_id, createHash13("sha256").update(updatedFiles.join(",")).digest("hex").slice(0, 16));
14591
14564
  log2(`Memory download for '${agent.code_name}': wrote ${written} new, overwrote ${overwritten} stale`);
14592
14565
  }
14593
14566
  }
@@ -14982,8 +14955,8 @@ function restartRunningChannelMcps(basenames) {
14982
14955
  }
14983
14956
  function deployMcpAssets() {
14984
14957
  const targetDir = join21(homedir10(), ".augmented", "_mcp");
14985
- mkdirSync9(targetDir, { recursive: true });
14986
- const moduleDir = dirname6(fileURLToPath(import.meta.url));
14958
+ mkdirSync8(targetDir, { recursive: true });
14959
+ const moduleDir = dirname5(fileURLToPath(import.meta.url));
14987
14960
  let mcpSourceDir = "";
14988
14961
  let dir = moduleDir;
14989
14962
  for (let i = 0; i < 6; i++) {
@@ -14992,7 +14965,7 @@ function deployMcpAssets() {
14992
14965
  mcpSourceDir = candidate;
14993
14966
  break;
14994
14967
  }
14995
- const parent = dirname6(dir);
14968
+ const parent = dirname5(dir);
14996
14969
  if (parent === dir) break;
14997
14970
  dir = parent;
14998
14971
  }
@@ -15004,7 +14977,7 @@ function deployMcpAssets() {
15004
14977
  const fileHash = (p) => {
15005
14978
  try {
15006
14979
  if (!existsSync11(p)) return null;
15007
- return createHash14("sha256").update(readFileSync17(p)).digest("hex");
14980
+ return createHash13("sha256").update(readFileSync17(p)).digest("hex");
15008
14981
  } catch {
15009
14982
  return null;
15010
14983
  }