@staff0rd/assist 0.1004.1 → 0.1006.0

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/index.js CHANGED
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@staff0rd/assist",
9
- version: "0.1004.1",
9
+ version: "0.1006.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -8548,7 +8548,8 @@ async function inboxStatus(_req, res) {
8548
8548
  scanning: reply2.scanning,
8549
8549
  intervalMinutes: reply2.intervalMinutes,
8550
8550
  lastError: reply2.lastError,
8551
- lastScanAt: lastScanAt?.toISOString() ?? null
8551
+ lastScanAt: lastScanAt?.toISOString() ?? null,
8552
+ run: reply2.run ?? null
8552
8553
  });
8553
8554
  }
8554
8555
 
@@ -20848,7 +20849,10 @@ async function hasOpenDocsUnlock(itemId2) {
20848
20849
  and20(
20849
20850
  eq49(itemGitRefs.itemId, itemId2),
20850
20851
  eq49(itemGitRefs.kind, "docs-unlock"),
20851
- eq49(itemGitRefs.ref, sql24`'phase-' || ${items.currentPhase}`),
20852
+ eq49(
20853
+ itemGitRefs.ref,
20854
+ sql24`'phase-' || coalesce(${items.currentPhase}, 1)`
20855
+ ),
20852
20856
  notInArray2(items.status, ["done", "wontdo"])
20853
20857
  )
20854
20858
  ).limit(1);
@@ -25807,7 +25811,7 @@ async function docsConfirm(pin2) {
25807
25811
  return;
25808
25812
  }
25809
25813
  const label = `${formatItemId(state.itemId)} ${found.item.name}`;
25810
- if (found.item.currentPhase !== state.phase) {
25814
+ if ((found.item.currentPhase ?? 1) !== state.phase) {
25811
25815
  console.error(
25812
25816
  chalk165.red(
25813
25817
  `${label} has moved on from phase ${state.phase} since the unlock was requested. Nothing was approved; request a new unlock from the current phase.`
@@ -25845,13 +25849,7 @@ async function docsUnlock() {
25845
25849
  process.exitCode = 1;
25846
25850
  return;
25847
25851
  }
25848
- const phase = found.item.currentPhase;
25849
- if (!phase) {
25850
- fail7(
25851
- `${formatItemId(itemId2)} has no current phase. Docs unlock applies to the phase a session is running.`
25852
- );
25853
- return;
25854
- }
25852
+ const phase = found.item.currentPhase ?? 1;
25855
25853
  const label = `${formatItemId(itemId2)} ${found.item.name} (phase ${phase})`;
25856
25854
  const pin2 = randomInt3(0, 1e3).toString().padStart(3, "0");
25857
25855
  mkdirSync20(getRestrictedDir(), { recursive: true });
@@ -29277,6 +29275,29 @@ async function list3() {
29277
29275
  // src/commands/inbox/scan.ts
29278
29276
  import chalk183 from "chalk";
29279
29277
 
29278
+ // src/shared/formatTokens.ts
29279
+ function formatTokens(n) {
29280
+ if (n < 1e3) return String(n);
29281
+ if (n < 1e6) return `${(n / 1e3).toFixed(1)}k`;
29282
+ return `${(n / 1e6).toFixed(1)}M`;
29283
+ }
29284
+
29285
+ // src/commands/inbox/formatScanCost.ts
29286
+ function formatScanCost(costUsd) {
29287
+ return `$${costUsd.toFixed(2)}`;
29288
+ }
29289
+
29290
+ // src/commands/inbox/scanUsageTokens.ts
29291
+ function scanUsageTokens(usage) {
29292
+ return usage.input + usage.output + usage.cacheRead + (usage.cacheWrite ?? 0);
29293
+ }
29294
+
29295
+ // src/commands/inbox/formatScanUsage.ts
29296
+ function formatScanUsage(usage) {
29297
+ const tokens = `${formatTokens(scanUsageTokens(usage))} tokens`;
29298
+ return usage.costUsd === null ? tokens : `${tokens} \xB7 ${formatScanCost(usage.costUsd)}`;
29299
+ }
29300
+
29280
29301
  // src/shared/db/upsertInboxMessages.ts
29281
29302
  async function upsertInboxMessages(orm, messages) {
29282
29303
  if (messages.length === 0) return 0;
@@ -29293,10 +29314,40 @@ async function writeInboxLastScan(orm, at2) {
29293
29314
  }
29294
29315
 
29295
29316
  // src/commands/inbox/runInboxScanClaude.ts
29296
- import { execFile as execFile12 } from "child_process";
29297
- import { promisify as promisify12 } from "util";
29317
+ import { spawn as spawn6 } from "child_process";
29298
29318
  import { z as z15 } from "zod";
29299
29319
 
29320
+ // src/commands/review/attachLineParser.ts
29321
+ function flushBuffer(buffer, onLine) {
29322
+ let remaining = buffer;
29323
+ while (true) {
29324
+ const idx = remaining.indexOf("\n");
29325
+ if (idx === -1) return remaining;
29326
+ const line = remaining.slice(0, idx);
29327
+ remaining = remaining.slice(idx + 1);
29328
+ if (line.trim()) onLine(line);
29329
+ }
29330
+ }
29331
+ function attachLineParser(child, onLine) {
29332
+ let buffer = "";
29333
+ child.stdout?.on("data", (chunk) => {
29334
+ buffer += chunk.toString("utf8");
29335
+ buffer = flushBuffer(buffer, onLine);
29336
+ });
29337
+ return () => {
29338
+ if (buffer.trim()) onLine(buffer);
29339
+ };
29340
+ }
29341
+
29342
+ // src/commands/review/attachStderrCollector.ts
29343
+ function attachStderrCollector(child) {
29344
+ const state = { value: "" };
29345
+ child.stderr?.on("data", (chunk) => {
29346
+ state.value += chunk.toString("utf8");
29347
+ });
29348
+ return state;
29349
+ }
29350
+
29300
29351
  // src/commands/inbox/buildInboxScanPrompt.ts
29301
29352
  function buildInboxScanPrompt(since) {
29302
29353
  const sinceUnix = Math.floor(since.getTime() / 1e3);
@@ -29330,6 +29381,120 @@ function buildInboxScanPrompt(since) {
29330
29381
  ].join("\n");
29331
29382
  }
29332
29383
 
29384
+ // src/commands/inbox/describeInboxScanTool.ts
29385
+ function pick(input, keys) {
29386
+ return keys.map((key) => input[key]).filter(
29387
+ (value) => typeof value === "string" || typeof value === "number"
29388
+ ).map(String);
29389
+ }
29390
+ function toolLabel(name) {
29391
+ const match = name.match(/^mcp__claude_ai_([^_]+)__(?:slack_)?(.+)$/);
29392
+ return match ? `${match[1]} ${match[2]}` : name;
29393
+ }
29394
+ function describeInboxScanTool(name, input) {
29395
+ const record = input && typeof input === "object" ? input : {};
29396
+ const detail = pick(record, [
29397
+ "query",
29398
+ "thread_id",
29399
+ "threadId",
29400
+ "channel_id",
29401
+ "message_ts"
29402
+ ]).join(" ");
29403
+ return { label: toolLabel(name), detail };
29404
+ }
29405
+
29406
+ // src/commands/inbox/assistantScanEvents.ts
29407
+ var MAX_TEXT = 500;
29408
+ function truncate(text18) {
29409
+ const trimmed = text18.trim();
29410
+ return trimmed.length <= MAX_TEXT ? trimmed : `${trimmed.slice(0, MAX_TEXT - 1)}\u2026`;
29411
+ }
29412
+ function blockEvent(block) {
29413
+ if (block.type === "tool_use") {
29414
+ const name = typeof block.name === "string" ? block.name : "tool";
29415
+ return { kind: "tool", ...describeInboxScanTool(name, block.input) };
29416
+ }
29417
+ if (block.type === "text" && typeof block.text === "string" && block.text.trim())
29418
+ return { kind: "text", label: "Assistant", detail: truncate(block.text) };
29419
+ return void 0;
29420
+ }
29421
+ function assistantScanEvents(content) {
29422
+ if (!Array.isArray(content)) return [];
29423
+ const at2 = (/* @__PURE__ */ new Date()).toISOString();
29424
+ return content.map(blockEvent).filter((event) => event !== void 0).map((event) => ({ at: at2, ...event }));
29425
+ }
29426
+
29427
+ // src/commands/review/parseTokenUsage.ts
29428
+ function count8(value) {
29429
+ return typeof value === "number" ? value : 0;
29430
+ }
29431
+ function parseTokenUsage(usage, keys) {
29432
+ if (typeof usage !== "object" || usage === null) return void 0;
29433
+ const raw = usage;
29434
+ const parsed = {
29435
+ input: count8(raw.input_tokens),
29436
+ output: count8(raw.output_tokens),
29437
+ cacheRead: count8(raw[keys.cacheRead])
29438
+ };
29439
+ if (keys.cacheWrite) parsed.cacheWrite = count8(raw[keys.cacheWrite]);
29440
+ return parsed;
29441
+ }
29442
+
29443
+ // src/commands/review/parseClaudeUsage.ts
29444
+ function parseClaudeUsage(usage) {
29445
+ return parseTokenUsage(usage, {
29446
+ cacheRead: "cache_read_input_tokens",
29447
+ cacheWrite: "cache_creation_input_tokens"
29448
+ });
29449
+ }
29450
+
29451
+ // src/commands/inbox/emptyScanUsage.ts
29452
+ function emptyScanUsage() {
29453
+ return {
29454
+ input: 0,
29455
+ output: 0,
29456
+ cacheRead: 0,
29457
+ cacheWrite: 0,
29458
+ costUsd: null,
29459
+ durationMs: null
29460
+ };
29461
+ }
29462
+
29463
+ // src/commands/inbox/createScanUsageTracker.ts
29464
+ var numberOrNull = (value) => typeof value === "number" ? value : null;
29465
+ function createScanUsageTracker() {
29466
+ const usage = emptyScanUsage();
29467
+ const turns = /* @__PURE__ */ new Map();
29468
+ let unsettled = 0;
29469
+ return {
29470
+ current: () => ({ ...usage }),
29471
+ // stream-json repeats a message's usage on every content-block line, so
29472
+ // each turn is counted once by message id, applying only the change.
29473
+ addTurn(id, raw) {
29474
+ const parsed = parseClaudeUsage(raw);
29475
+ if (!parsed) return false;
29476
+ const key = typeof id === "string" ? id : `turn-${turns.size}`;
29477
+ const previous = turns.get(key);
29478
+ turns.set(key, parsed);
29479
+ usage.input += parsed.input - (previous?.input ?? 0);
29480
+ usage.output += parsed.output - (previous?.output ?? 0);
29481
+ usage.cacheRead += parsed.cacheRead - (previous?.cacheRead ?? 0);
29482
+ usage.cacheWrite += (parsed.cacheWrite ?? 0) - (previous?.cacheWrite ?? 0);
29483
+ unsettled += scanUsageTokens(parsed) - (previous ? scanUsageTokens(previous) : 0);
29484
+ return true;
29485
+ },
29486
+ takeTurnTokens() {
29487
+ const tokens = unsettled;
29488
+ unsettled = 0;
29489
+ return tokens > 0 ? tokens : void 0;
29490
+ },
29491
+ finish(result) {
29492
+ usage.costUsd = numberOrNull(result.total_cost_usd);
29493
+ usage.durationMs = numberOrNull(result.duration_ms);
29494
+ }
29495
+ };
29496
+ }
29497
+
29333
29498
  // src/commands/inbox/inboxScanSchema.ts
29334
29499
  import { z as z14 } from "zod";
29335
29500
  var flaggedMessageSchema = z14.object({
@@ -29344,6 +29509,56 @@ var inboxScanSchema = z14.object({
29344
29509
  messages: z14.array(flaggedMessageSchema)
29345
29510
  });
29346
29511
 
29512
+ // src/commands/inbox/parseInboxScanOutput.ts
29513
+ function parseInboxScanOutput(stdout) {
29514
+ const result = JSON.parse(stdout);
29515
+ if (result.is_error)
29516
+ throw new Error(`Inbox scan failed: ${result.result ?? "unknown error"}`);
29517
+ return inboxScanSchema.parse(result.structured_output).messages;
29518
+ }
29519
+
29520
+ // src/commands/inbox/createInboxScanParser.ts
29521
+ function createInboxScanParser({
29522
+ onEvent = () => {
29523
+ },
29524
+ onUsage = () => {
29525
+ }
29526
+ } = {}) {
29527
+ const usage = createScanUsageTracker();
29528
+ let resultLine;
29529
+ const onAssistant = (message3) => {
29530
+ const counted = usage.addTurn(message3?.id, message3?.usage);
29531
+ for (const scanEvent of assistantScanEvents(message3?.content)) {
29532
+ const tokens = usage.takeTurnTokens();
29533
+ onEvent(tokens === void 0 ? scanEvent : { ...scanEvent, tokens });
29534
+ }
29535
+ if (counted) onUsage(usage.current());
29536
+ };
29537
+ return {
29538
+ onLine(line) {
29539
+ let event;
29540
+ try {
29541
+ event = JSON.parse(line);
29542
+ } catch {
29543
+ return;
29544
+ }
29545
+ if (event.type === "assistant") onAssistant(event.message);
29546
+ else if (event.type === "result") {
29547
+ resultLine = line;
29548
+ usage.finish(event);
29549
+ onUsage(usage.current());
29550
+ }
29551
+ },
29552
+ finish(failure) {
29553
+ if (!resultLine) throw new Error(`Inbox scan failed: ${failure}`);
29554
+ return {
29555
+ messages: parseInboxScanOutput(resultLine),
29556
+ usage: usage.current()
29557
+ };
29558
+ }
29559
+ };
29560
+ }
29561
+
29347
29562
  // src/commands/inbox/inboxScanTools.ts
29348
29563
  var gmail = (tool) => `mcp__claude_ai_Gmail__${tool}`;
29349
29564
  var slack = (tool) => `mcp__claude_ai_Slack__${tool}`;
@@ -29394,7 +29609,6 @@ var inboxScanTools = {
29394
29609
  };
29395
29610
 
29396
29611
  // src/commands/inbox/runInboxScanClaude.ts
29397
- var execFileAsync11 = promisify12(execFile12);
29398
29612
  function buildInboxScanArgs(since) {
29399
29613
  return [
29400
29614
  "-p",
@@ -29408,29 +29622,33 @@ function buildInboxScanArgs(since) {
29408
29622
  ...inboxScanTools.denied,
29409
29623
  "--no-session-persistence",
29410
29624
  "--output-format",
29411
- "json",
29625
+ "stream-json",
29626
+ "--verbose",
29412
29627
  "--json-schema",
29413
29628
  JSON.stringify(z15.toJSONSchema(inboxScanSchema, { target: "draft-07" })),
29414
29629
  "--",
29415
29630
  buildInboxScanPrompt(since)
29416
29631
  ];
29417
29632
  }
29418
- function parseInboxScanOutput(stdout) {
29419
- const result = JSON.parse(stdout);
29420
- if (result.is_error)
29421
- throw new Error(`Inbox scan failed: ${result.result ?? "unknown error"}`);
29422
- return inboxScanSchema.parse(result.structured_output).messages;
29633
+ function describeExit(code, signal) {
29634
+ return signal ? `claude was killed (${signal})` : `claude exited ${code}`;
29423
29635
  }
29424
- async function runInboxScanClaude(since) {
29425
- const run4 = execFileAsync11("claude", buildInboxScanArgs(since), {
29426
- encoding: "utf8",
29636
+ async function runInboxScanClaude(since, listener = {}) {
29637
+ const child = spawn6("claude", buildInboxScanArgs(since), {
29638
+ stdio: ["ignore", "pipe", "pipe"],
29427
29639
  windowsHide: true,
29428
- timeout: 20 * 6e4,
29429
- maxBuffer: 64 * 1024 * 1024
29640
+ timeout: 20 * 6e4
29641
+ });
29642
+ const parser = createInboxScanParser(listener);
29643
+ const flush = attachLineParser(child, parser.onLine);
29644
+ const stderr = attachStderrCollector(child);
29645
+ const exit = await new Promise((resolve32, reject) => {
29646
+ child.on("error", reject);
29647
+ child.on("close", (code, signal) => resolve32(describeExit(code, signal)));
29430
29648
  });
29431
- run4.child.stdin?.end();
29432
- const { stdout } = await run4;
29433
- return parseInboxScanOutput(stdout);
29649
+ flush();
29650
+ const tail = stderr.value.trim().slice(-500);
29651
+ return parser.finish(tail ? `${exit}: ${tail}` : exit);
29434
29652
  }
29435
29653
 
29436
29654
  // src/commands/inbox/runInboxScan.ts
@@ -29446,26 +29664,28 @@ function toRow2(message3) {
29446
29664
  receivedAt: receivedAt && !Number.isNaN(receivedAt.getTime()) ? receivedAt : null
29447
29665
  };
29448
29666
  }
29449
- async function runInboxScan(orm, wrap = (_since, run4) => run4()) {
29667
+ async function runInboxScan(orm, { wrap = (_since, run4) => run4(), ...listener } = {}) {
29450
29668
  const startedAt = /* @__PURE__ */ new Date();
29451
29669
  const since = await readInboxLastScan(orm) ?? new Date(startedAt.getTime() - FIRST_SCAN_LOOKBACK_MS);
29452
- const flagged = await wrap(since, () => runInboxScanClaude(since));
29453
- const added = await upsertInboxMessages(orm, flagged.map(toRow2));
29670
+ const { messages, usage } = await wrap(
29671
+ since,
29672
+ () => runInboxScanClaude(since, listener)
29673
+ );
29674
+ const added = await upsertInboxMessages(orm, messages.map(toRow2));
29454
29675
  await writeInboxLastScan(orm, startedAt);
29455
- return { flagged: flagged.length, added };
29676
+ return { flagged: messages.length, added, usage };
29456
29677
  }
29457
29678
 
29458
29679
  // src/commands/inbox/scan.ts
29459
29680
  async function scan() {
29460
- const { flagged, added } = await runInboxScan(
29461
- await getDb(),
29462
- (since, run4) => withSpinner(
29681
+ const { flagged, added, usage } = await runInboxScan(await getDb(), {
29682
+ wrap: (since, run4) => withSpinner(
29463
29683
  `Scanning Gmail and Slack (Slack since ${since.toISOString()})`,
29464
29684
  run4
29465
29685
  )
29466
- );
29686
+ });
29467
29687
  console.log(
29468
- `Flagged ${flagged} message(s) needing a reply, ${chalk183.bold(added)} new.`
29688
+ `Flagged ${flagged} message(s) needing a reply, ${chalk183.bold(added)} new. ${chalk183.dim(formatScanUsage(usage))}`
29469
29689
  );
29470
29690
  }
29471
29691
 
@@ -30020,7 +30240,7 @@ function resolveInstallCommand(repoRoot2, install) {
30020
30240
  }
30021
30241
 
30022
30242
  // src/commands/sessions/daemon/worktree/spawnInstall.ts
30023
- import { spawn as spawn6 } from "child_process";
30243
+ import { spawn as spawn7 } from "child_process";
30024
30244
 
30025
30245
  // src/commands/sessions/daemon/worktree/installInvocation.ts
30026
30246
  function installInvocation(worktreePath, command) {
@@ -30046,7 +30266,7 @@ function quoteForPosixShell(value) {
30046
30266
  }
30047
30267
 
30048
30268
  // src/commands/sessions/daemon/worktree/stopInstall.ts
30049
- import { execFile as execFile13 } from "child_process";
30269
+ import { execFile as execFile12 } from "child_process";
30050
30270
  var running2 = /* @__PURE__ */ new Map();
30051
30271
  function trackInstall(worktreePath, child) {
30052
30272
  running2.set(worktreePath, child);
@@ -30067,7 +30287,7 @@ function stopInstall(worktreePath) {
30067
30287
  }
30068
30288
  function killTree(pid) {
30069
30289
  if (process.platform === "win32") {
30070
- execFile13(
30290
+ execFile12(
30071
30291
  "taskkill",
30072
30292
  ["/T", "/F", "/PID", String(pid)],
30073
30293
  { windowsHide: true },
@@ -30090,7 +30310,7 @@ function killTree(pid) {
30090
30310
  var STDERR_TAIL = 2e3;
30091
30311
  function spawnInstall(worktreePath, cwd, command, where, onDone) {
30092
30312
  daemonLog(`worktree ${worktreePath} installing deps${where}: ${command}`);
30093
- const child = spawn6(...installInvocation(cwd, command));
30313
+ const child = spawn7(...installInvocation(cwd, command));
30094
30314
  trackInstall(worktreePath, child);
30095
30315
  let stderr = "";
30096
30316
  child.stderr?.on("data", (chunk) => {
@@ -32089,7 +32309,7 @@ function registerPiHook(program) {
32089
32309
 
32090
32310
  // src/commands/prompts/printPromptsTable.ts
32091
32311
  import chalk200 from "chalk";
32092
- function truncate(str, max) {
32312
+ function truncate2(str, max) {
32093
32313
  if (str.length <= max) return str;
32094
32314
  return `${str.slice(0, max - 1)}\u2026`;
32095
32315
  }
@@ -32098,7 +32318,7 @@ function printPromptsTable(rows) {
32098
32318
  const toolWidth = Math.max(4, ...rows.map((r) => r.tool.length));
32099
32319
  const commandWidth = Math.max(
32100
32320
  7,
32101
- ...rows.map((r) => truncate(r.command, 60).length)
32321
+ ...rows.map((r) => truncate2(r.command, 60).length)
32102
32322
  );
32103
32323
  const header = [
32104
32324
  "#".padStart(countWidth),
@@ -32111,7 +32331,7 @@ function printPromptsTable(rows) {
32111
32331
  for (const row3 of rows) {
32112
32332
  const count10 = String(row3.count).padStart(countWidth);
32113
32333
  const tool = row3.tool.padEnd(toolWidth);
32114
- const command = truncate(row3.command, 60).padEnd(commandWidth);
32334
+ const command = truncate2(row3.command, 60).padEnd(commandWidth);
32115
32335
  console.log(
32116
32336
  `${chalk200.yellow(count10)} ${tool} ${command} ${chalk200.dim(row3.repos)}`
32117
32337
  );
@@ -36131,7 +36351,7 @@ function registerRootCommands(program) {
36131
36351
  }
36132
36352
 
36133
36353
  // src/commands/refactor/check.ts
36134
- import { spawn as spawn7 } from "child_process";
36354
+ import { spawn as spawn8 } from "child_process";
36135
36355
  import * as path48 from "path";
36136
36356
 
36137
36357
  // src/commands/refactor/logViolations.ts
@@ -36279,7 +36499,7 @@ function getViolations(pattern2, options2 = {}, maxLines = DEFAULT_MAX_LINES2) {
36279
36499
  // src/commands/refactor/check.ts
36280
36500
  function runScript(script, cwd) {
36281
36501
  return new Promise((resolve32) => {
36282
- const child = spawn7("npm", ["run", script], {
36502
+ const child = spawn8("npm", ["run", script], {
36283
36503
  stdio: "pipe",
36284
36504
  shell: true,
36285
36505
  cwd
@@ -40320,8 +40540,8 @@ function cells(usage) {
40320
40540
  format(usage.cacheWrite)
40321
40541
  ];
40322
40542
  }
40323
- function sumOf(reported, pick) {
40324
- const values = reported.map(pick).filter((v) => v !== void 0);
40543
+ function sumOf(reported, pick2) {
40544
+ const values = reported.map(pick2).filter((v) => v !== void 0);
40325
40545
  return values.length === 0 ? void 0 : values.reduce((a, b) => a + b, 0);
40326
40546
  }
40327
40547
  function total(usages) {
@@ -40741,7 +40961,7 @@ function buildCodexModelArgs() {
40741
40961
  import { writeFileSync as writeFileSync43 } from "fs";
40742
40962
 
40743
40963
  // src/commands/review/formatToolSummary.ts
40744
- function truncate2(value, max = 80) {
40964
+ function truncate3(value, max = 80) {
40745
40965
  const collapsed = value.replace(/\s+/g, " ").trim();
40746
40966
  if (collapsed.length <= max) return collapsed;
40747
40967
  return `${collapsed.slice(0, max - 1)}\u2026`;
@@ -40761,43 +40981,19 @@ function formatToolSummary(input) {
40761
40981
  const filePath = getString(record, "file_path") ?? getString(record, "path");
40762
40982
  if (filePath) return filePath;
40763
40983
  const command = getString(record, "command");
40764
- if (command) return truncate2(command);
40984
+ if (command) return truncate3(command);
40765
40985
  const url = getString(record, "url");
40766
40986
  if (url) return url;
40767
40987
  const query = getString(record, "query");
40768
- if (query) return truncate2(query);
40988
+ if (query) return truncate3(query);
40769
40989
  const description = getString(record, "description");
40770
- if (description) return truncate2(description);
40990
+ if (description) return truncate3(description);
40771
40991
  return "";
40772
40992
  }
40773
40993
  function simplifyShellCommand(command) {
40774
40994
  const wrapped = command.match(/^\/bin\/bash\s+-lc\s+"(.*)"\s*$/s);
40775
40995
  const inner = wrapped ? wrapped[1].replace(/\\"/g, '"') : command;
40776
- return truncate2(inner);
40777
- }
40778
-
40779
- // src/commands/review/parseTokenUsage.ts
40780
- function count8(value) {
40781
- return typeof value === "number" ? value : 0;
40782
- }
40783
- function parseTokenUsage(usage, keys) {
40784
- if (typeof usage !== "object" || usage === null) return void 0;
40785
- const raw = usage;
40786
- const parsed = {
40787
- input: count8(raw.input_tokens),
40788
- output: count8(raw.output_tokens),
40789
- cacheRead: count8(raw[keys.cacheRead])
40790
- };
40791
- if (keys.cacheWrite) parsed.cacheWrite = count8(raw[keys.cacheWrite]);
40792
- return parsed;
40793
- }
40794
-
40795
- // src/commands/review/parseClaudeUsage.ts
40796
- function parseClaudeUsage(usage) {
40797
- return parseTokenUsage(usage, {
40798
- cacheRead: "cache_read_input_tokens",
40799
- cacheWrite: "cache_creation_input_tokens"
40800
- });
40996
+ return truncate3(inner);
40801
40997
  }
40802
40998
 
40803
40999
  // src/commands/review/parseClaudeEvent.ts
@@ -40916,38 +41112,7 @@ function finaliseReviewerRun(spec, spinner, result) {
40916
41112
  }
40917
41113
 
40918
41114
  // src/commands/review/runStreamingChild.ts
40919
- import { spawn as spawn8 } from "child_process";
40920
-
40921
- // src/commands/review/attachLineParser.ts
40922
- function flushBuffer(buffer, onLine) {
40923
- let remaining = buffer;
40924
- while (true) {
40925
- const idx = remaining.indexOf("\n");
40926
- if (idx === -1) return remaining;
40927
- const line = remaining.slice(0, idx);
40928
- remaining = remaining.slice(idx + 1);
40929
- if (line.trim()) onLine(line);
40930
- }
40931
- }
40932
- function attachLineParser(child, onLine) {
40933
- let buffer = "";
40934
- child.stdout?.on("data", (chunk) => {
40935
- buffer += chunk.toString("utf8");
40936
- buffer = flushBuffer(buffer, onLine);
40937
- });
40938
- return () => {
40939
- if (buffer.trim()) onLine(buffer);
40940
- };
40941
- }
40942
-
40943
- // src/commands/review/attachStderrCollector.ts
40944
- function attachStderrCollector(child) {
40945
- const state = { value: "" };
40946
- child.stderr?.on("data", (chunk) => {
40947
- state.value += chunk.toString("utf8");
40948
- });
40949
- return state;
40950
- }
41115
+ import { spawn as spawn9 } from "child_process";
40951
41116
 
40952
41117
  // src/commands/review/attachStdoutTail.ts
40953
41118
  function attachStdoutTail(child, maxBytes = 8192) {
@@ -41120,7 +41285,7 @@ function writeStdinSafely(child, payload) {
41120
41285
  }
41121
41286
  }
41122
41287
  function startChild(spec) {
41123
- const child = spawn8(spec.command, spec.args, {
41288
+ const child = spawn9(spec.command, spec.args, {
41124
41289
  stdio: ["pipe", "pipe", "pipe"],
41125
41290
  shell: process.platform === "win32",
41126
41291
  ...spec.env ? { env: { ...process.env, ...spec.env } } : {}
@@ -46139,11 +46304,11 @@ function decideLap(end, interrupted) {
46139
46304
  }
46140
46305
 
46141
46306
  // src/commands/watch/runWatchLap.ts
46142
- import { spawn as spawn9 } from "child_process";
46307
+ import { spawn as spawn10 } from "child_process";
46143
46308
  var WATCH_LAP_ARGS = ["watch", "wait", "--pull", "--build"];
46144
46309
  function runWatchLap() {
46145
46310
  return new Promise((resolve32, reject) => {
46146
- const assistFromPath = spawn9("assist", WATCH_LAP_ARGS, {
46311
+ const assistFromPath = spawn10("assist", WATCH_LAP_ARGS, {
46147
46312
  stdio: "inherit",
46148
46313
  shell: process.platform === "win32"
46149
46314
  });
@@ -46494,12 +46659,12 @@ function parseEnvPairs(pairs) {
46494
46659
  if (pairs.length === 0) return void 0;
46495
46660
  const env = {};
46496
46661
  for (const pair of pairs) {
46497
- const eq53 = pair.indexOf("=");
46498
- if (eq53 <= 0) {
46662
+ const eq54 = pair.indexOf("=");
46663
+ if (eq54 <= 0) {
46499
46664
  console.error(`--env must be KEY=VALUE, got "${pair}"`);
46500
46665
  process.exit(1);
46501
46666
  }
46502
- env[pair.slice(0, eq53)] = pair.slice(eq53 + 1);
46667
+ env[pair.slice(0, eq54)] = pair.slice(eq54 + 1);
46503
46668
  }
46504
46669
  return env;
46505
46670
  }
@@ -46512,11 +46677,11 @@ function fail10(spec) {
46512
46677
  process.exit(1);
46513
46678
  }
46514
46679
  function parseParamSpec(spec) {
46515
- const eq53 = spec.indexOf("=");
46516
- const name = eq53 === -1 ? spec : spec.slice(0, eq53);
46517
- if (eq53 !== -1) {
46518
- if (eq53 === 0 || name.endsWith("!")) fail10(spec);
46519
- return { name, default: spec.slice(eq53 + 1) };
46680
+ const eq54 = spec.indexOf("=");
46681
+ const name = eq54 === -1 ? spec : spec.slice(0, eq54);
46682
+ if (eq54 !== -1) {
46683
+ if (eq54 === 0 || name.endsWith("!")) fail10(spec);
46684
+ return { name, default: spec.slice(eq54 + 1) };
46520
46685
  }
46521
46686
  if (name.endsWith("!")) {
46522
46687
  if (name.length === 1) fail10(spec);
@@ -47053,10 +47218,114 @@ function createAutoExit(exit, graceMs = DEFAULT_GRACE_MS) {
47053
47218
  };
47054
47219
  }
47055
47220
 
47056
- // src/commands/sessions/daemon/inbox/isInboxScanDue.ts
47057
- async function isInboxScanDue(intervalMinutes) {
47058
- const last = await readInboxLastScan(await getDb());
47059
- return !last || Date.now() - last.getTime() >= intervalMinutes * 6e4;
47221
+ // src/commands/sessions/daemon/inbox/createActivityThrottle.ts
47222
+ var ACTIVITY_THROTTLE_MS = 1e3;
47223
+ function createActivityThrottle(onActivity) {
47224
+ let pending;
47225
+ return {
47226
+ schedule() {
47227
+ pending ??= setTimeout(() => {
47228
+ pending = void 0;
47229
+ onActivity();
47230
+ }, ACTIVITY_THROTTLE_MS);
47231
+ },
47232
+ cancel() {
47233
+ clearTimeout(pending);
47234
+ pending = void 0;
47235
+ }
47236
+ };
47237
+ }
47238
+
47239
+ // src/shared/db/readInboxLastRun.ts
47240
+ import { eq as eq51 } from "drizzle-orm";
47241
+ var INBOX_LAST_RUN_KEY = "inbox.lastRun";
47242
+ async function readInboxLastRun(orm) {
47243
+ const [row3] = await orm.select().from(metadata).where(eq51(metadata.key, INBOX_LAST_RUN_KEY));
47244
+ return row3 ? JSON.parse(row3.value) : void 0;
47245
+ }
47246
+
47247
+ // src/commands/sessions/daemon/inbox/loadScanRun.ts
47248
+ async function loadScanRun() {
47249
+ try {
47250
+ const saved = await readInboxLastRun(await getDb());
47251
+ if (saved) daemonLog(`inbox: restored last scan run (${saved.status})`);
47252
+ return saved;
47253
+ } catch (error) {
47254
+ daemonLog(`inbox: reading the last scan run failed: ${String(error)}`);
47255
+ return void 0;
47256
+ }
47257
+ }
47258
+
47259
+ // src/commands/sessions/daemon/inbox/outcomeEvent.ts
47260
+ function outcomeEvent(outcome) {
47261
+ const at2 = (/* @__PURE__ */ new Date()).toISOString();
47262
+ return outcome.ok ? {
47263
+ at: at2,
47264
+ kind: "result",
47265
+ label: "Result",
47266
+ detail: `Flagged ${outcome.flagged} message(s), ${outcome.added} new`
47267
+ } : { at: at2, kind: "error", label: "Failed", detail: outcome.error };
47268
+ }
47269
+
47270
+ // src/shared/db/writeInboxLastRun.ts
47271
+ async function writeInboxLastRun(orm, run4) {
47272
+ const value = JSON.stringify(run4);
47273
+ await orm.insert(metadata).values({ key: INBOX_LAST_RUN_KEY, value }).onConflictDoUpdate({ target: metadata.key, set: { value } });
47274
+ }
47275
+
47276
+ // src/commands/sessions/daemon/inbox/saveScanRun.ts
47277
+ async function saveScanRun(run4) {
47278
+ try {
47279
+ await writeInboxLastRun(await getDb(), run4);
47280
+ daemonLog(
47281
+ `inbox: saved last scan run (${run4.status}, ${run4.events.length} event(s))`
47282
+ );
47283
+ } catch (error) {
47284
+ daemonLog(`inbox: saving the last scan run failed: ${String(error)}`);
47285
+ }
47286
+ }
47287
+
47288
+ // src/commands/sessions/daemon/inbox/createScanRunLog.ts
47289
+ var MAX_EVENTS = 1e3;
47290
+ function createScanRunLog(onActivity) {
47291
+ let run4;
47292
+ const throttle = createActivityThrottle(onActivity);
47293
+ return {
47294
+ current: () => run4,
47295
+ begin() {
47296
+ run4 = {
47297
+ status: "scanning",
47298
+ startedAt: (/* @__PURE__ */ new Date()).toISOString(),
47299
+ finishedAt: null,
47300
+ events: [],
47301
+ usage: emptyScanUsage()
47302
+ };
47303
+ },
47304
+ onEvent(event) {
47305
+ if (!run4 || run4.events.length >= MAX_EVENTS) return;
47306
+ run4.events.push(event);
47307
+ throttle.schedule();
47308
+ },
47309
+ onUsage(usage) {
47310
+ if (!run4) return;
47311
+ run4.usage = usage;
47312
+ throttle.schedule();
47313
+ },
47314
+ async end(outcome) {
47315
+ throttle.cancel();
47316
+ if (!run4) return;
47317
+ run4.events.push(outcomeEvent(outcome));
47318
+ run4.status = outcome.ok ? "finished" : "failed";
47319
+ run4.finishedAt = (/* @__PURE__ */ new Date()).toISOString();
47320
+ await saveScanRun(run4);
47321
+ },
47322
+ async restore() {
47323
+ const saved = await loadScanRun();
47324
+ if (run4 || !saved) return;
47325
+ run4 = saved;
47326
+ onActivity();
47327
+ }
47328
+ };
47060
47329
  }
47061
47330
 
47062
47331
  // src/commands/inbox/readInboxIntervalMinutes.ts
@@ -47083,17 +47352,53 @@ function readInboxSchedule() {
47083
47352
  };
47084
47353
  }
47085
47354
 
47355
+ // src/commands/sessions/daemon/inbox/createScheduleTracker.ts
47356
+ function createScheduleTracker() {
47357
+ let schedule = { description: "not started" };
47358
+ return {
47359
+ current: () => schedule,
47360
+ refresh() {
47361
+ const next3 = readInboxSchedule();
47362
+ if (next3.description !== schedule.description)
47363
+ daemonLog(`inbox: scheduled scans ${next3.description}`);
47364
+ schedule = next3;
47365
+ return schedule;
47366
+ }
47367
+ };
47368
+ }
47369
+
47370
+ // src/commands/sessions/daemon/inbox/isInboxScanDue.ts
47371
+ async function isInboxScanDue(intervalMinutes) {
47372
+ const last = await readInboxLastScan(await getDb());
47373
+ return !last || Date.now() - last.getTime() >= intervalMinutes * 6e4;
47374
+ }
47375
+
47376
+ // src/commands/sessions/daemon/inbox/isScheduledScanDue.ts
47377
+ async function isScheduledScanDue(intervalMinutes) {
47378
+ try {
47379
+ return await isInboxScanDue(intervalMinutes);
47380
+ } catch (error) {
47381
+ daemonLog(`inbox: reading the last scan time failed: ${String(error)}`);
47382
+ return false;
47383
+ }
47384
+ }
47385
+
47086
47386
  // src/commands/sessions/daemon/inbox/runLoggedInboxScan.ts
47087
- async function runLoggedInboxScan(reason4) {
47387
+ async function runLoggedInboxScan(reason4, listener) {
47088
47388
  daemonLog(`inbox: scan started (${reason4})`);
47089
47389
  try {
47090
- const { flagged, added } = await runInboxScan(await getDb());
47091
- daemonLog(`inbox: scan flagged ${flagged} message(s), ${added} new`);
47092
- return void 0;
47390
+ const { flagged, added, usage } = await runInboxScan(
47391
+ await getDb(),
47392
+ listener
47393
+ );
47394
+ daemonLog(
47395
+ `inbox: scan flagged ${flagged} message(s), ${added} new (${formatScanUsage(usage)})`
47396
+ );
47397
+ return { ok: true, flagged, added };
47093
47398
  } catch (error) {
47094
47399
  const message3 = error instanceof Error ? error.message : String(error);
47095
47400
  daemonLog(`inbox: scan failed: ${message3}`);
47096
- return message3;
47401
+ return { ok: false, error: message3 };
47097
47402
  }
47098
47403
  }
47099
47404
 
@@ -47102,32 +47407,29 @@ var CHECK_MS = 6e4;
47102
47407
  function createInboxScanner() {
47103
47408
  let scanning = false;
47104
47409
  let lastError;
47105
- let schedule = { description: "not started" };
47106
47410
  let notify2 = () => {
47107
47411
  };
47412
+ const schedule = createScheduleTracker();
47413
+ const runLog = createScanRunLog(() => notify2("inbox-activity"));
47108
47414
  const scan2 = async (reason4) => {
47109
47415
  scanning = true;
47110
- notify2();
47111
- lastError = await runLoggedInboxScan(reason4);
47416
+ runLog.begin();
47417
+ notify2("inbox");
47418
+ const outcome = await runLoggedInboxScan(reason4, runLog);
47419
+ lastError = outcome.ok ? void 0 : outcome.error;
47420
+ await runLog.end(outcome);
47112
47421
  scanning = false;
47113
- notify2();
47422
+ notify2("inbox");
47114
47423
  };
47115
47424
  const tick = async () => {
47116
- const next3 = readInboxSchedule();
47117
- if (next3.description !== schedule.description)
47118
- daemonLog(`inbox: scheduled scans ${next3.description}`);
47119
- schedule = next3;
47120
- if (!schedule.intervalMinutes || scanning) return;
47121
- try {
47122
- if (await isInboxScanDue(schedule.intervalMinutes))
47123
- await scan2("scheduled");
47124
- } catch (error) {
47125
- daemonLog(`inbox: reading the last scan time failed: ${String(error)}`);
47126
- }
47425
+ const { intervalMinutes } = schedule.refresh();
47426
+ if (!intervalMinutes || scanning) return;
47427
+ if (await isScheduledScanDue(intervalMinutes)) await scan2("scheduled");
47127
47428
  };
47128
47429
  return {
47129
47430
  start(onChange) {
47130
47431
  notify2 = onChange;
47432
+ void runLog.restore();
47131
47433
  void tick();
47132
47434
  const timer = setInterval(() => void tick(), CHECK_MS);
47133
47435
  timer.unref();
@@ -47141,8 +47443,9 @@ function createInboxScanner() {
47141
47443
  status() {
47142
47444
  return {
47143
47445
  scanning,
47144
- intervalMinutes: schedule.intervalMinutes ?? null,
47145
- lastError: lastError ?? null
47446
+ intervalMinutes: schedule.current().intervalMinutes ?? null,
47447
+ lastError: lastError ?? null,
47448
+ run: runLog.current() ?? null
47146
47449
  };
47147
47450
  }
47148
47451
  };
@@ -48806,7 +49109,7 @@ function noteAutoUpdate(installDir, text18) {
48806
49109
  }
48807
49110
 
48808
49111
  // src/commands/sessions/daemon/autoUpdate/runUpdateLap.ts
48809
- import { spawn as spawn11 } from "child_process";
49112
+ import { spawn as spawn12 } from "child_process";
48810
49113
  import { rmSync as rmSync13 } from "fs";
48811
49114
  function clearLapSignals(cwd) {
48812
49115
  const control = watchControlPaths(cwd);
@@ -48818,7 +49121,7 @@ function runUpdateLap(cwd, onOutput) {
48818
49121
  clearLapSignals(cwd);
48819
49122
  return new Promise((resolve32, reject) => {
48820
49123
  const { ASSIST_ACTIVITY_ID: _activity, ...env } = process.env;
48821
- const child = spawn11(
49124
+ const child = spawn12(
48822
49125
  process.execPath,
48823
49126
  [process.argv[1], ...WATCH_LAP_ARGS],
48824
49127
  {
@@ -49847,13 +50150,13 @@ function isBacklogItemId(text18) {
49847
50150
  }
49848
50151
 
49849
50152
  // src/commands/sessions/daemon/generateSessionTitle.ts
49850
- import { execFile as execFile14 } from "child_process";
49851
- import { promisify as promisify13 } from "util";
49852
- var execFileAsync12 = promisify13(execFile14);
50153
+ import { execFile as execFile13 } from "child_process";
50154
+ import { promisify as promisify12 } from "util";
50155
+ var execFileAsync11 = promisify12(execFile13);
49853
50156
  var SESSION_TITLE_MAX_LENGTH = 48;
49854
50157
  async function generateSessionTitle(prompt) {
49855
50158
  try {
49856
- const { stdout } = await execFileAsync12(
50159
+ const { stdout } = await execFileAsync11(
49857
50160
  "claude",
49858
50161
  ["-p", "--model", "haiku", buildPrompt5(prompt)],
49859
50162
  { encoding: "utf8", windowsHide: true, timeout: 3e4 }
@@ -50095,10 +50398,10 @@ function applyReviewPause(session, activity2) {
50095
50398
  }
50096
50399
 
50097
50400
  // src/shared/db/getPhaseActiveMs.ts
50098
- import { and as and21, eq as eq51 } from "drizzle-orm";
50401
+ import { and as and21, eq as eq52 } from "drizzle-orm";
50099
50402
  async function getPhaseActiveMs(db, itemId2, phaseIdx) {
50100
50403
  const [row3] = await db.select({ activeMs: phaseUsage.activeMs }).from(phaseUsage).where(
50101
- and21(eq51(phaseUsage.itemId, itemId2), eq51(phaseUsage.phaseIdx, phaseIdx))
50404
+ and21(eq52(phaseUsage.itemId, itemId2), eq52(phaseUsage.phaseIdx, phaseIdx))
50102
50405
  );
50103
50406
  return row3?.activeMs ?? 0;
50104
50407
  }
@@ -50682,11 +50985,11 @@ function parseEntry(line) {
50682
50985
  // src/commands/sessions/summarise/extractFirstUserMessage.ts
50683
50986
  function extractFirstUserMessage(filePath) {
50684
50987
  for (const text18 of iterateUserMessages(filePath)) {
50685
- return truncate3(text18);
50988
+ return truncate4(text18);
50686
50989
  }
50687
50990
  return void 0;
50688
50991
  }
50689
- function truncate3(text18, maxChars = 500) {
50992
+ function truncate4(text18, maxChars = 500) {
50690
50993
  const trimmed = text18.trim();
50691
50994
  if (trimmed.length <= maxChars) return trimmed;
50692
50995
  return `${trimmed.slice(0, maxChars)}\u2026`;
@@ -50911,7 +51214,7 @@ async function recordPhaseTranscriptUsage(db, itemId2, phaseIdx, responses) {
50911
51214
  }
50912
51215
 
50913
51216
  // src/shared/db/recordWindowTokens.ts
50914
- import { and as and22, eq as eq52, sql as sql30 } from "drizzle-orm";
51217
+ import { and as and22, eq as eq53, sql as sql30 } from "drizzle-orm";
50915
51218
  async function recordWindowTokens(db, window, resetsAt, tokensUp, tokensDown) {
50916
51219
  if (tokensUp <= 0 && tokensDown <= 0) return;
50917
51220
  await db.update(usagePeaks).set({
@@ -50919,9 +51222,9 @@ async function recordWindowTokens(db, window, resetsAt, tokensUp, tokensDown) {
50919
51222
  tokensDown: sql30`${usagePeaks.tokensDown} + ${tokensDown}`
50920
51223
  }).where(
50921
51224
  and22(
50922
- eq52(usagePeaks.window, window),
50923
- eq52(usagePeaks.resetsAt, resetsAt),
50924
- eq52(usagePeaks.segment, 0)
51225
+ eq53(usagePeaks.window, window),
51226
+ eq53(usagePeaks.resetsAt, resetsAt),
51227
+ eq53(usagePeaks.segment, 0)
50925
51228
  )
50926
51229
  );
50927
51230
  }
@@ -52421,10 +52724,10 @@ function restoreAllSessions(spawner, deps2) {
52421
52724
 
52422
52725
  // src/commands/sessions/daemon/retrySession.ts
52423
52726
  function retrySession(session, clients, onStatusChange) {
52424
- const spawn12 = respawnThunk(session);
52425
- if (!spawn12) return false;
52727
+ const spawn13 = respawnThunk(session);
52728
+ if (!spawn13) return false;
52426
52729
  const respawn = () => {
52427
- respawnSession(session, spawn12, "running", clients, onStatusChange);
52730
+ respawnSession(session, spawn13, "running", clients, onStatusChange);
52428
52731
  daemonLog(`session ${session.id} retried: ${session.name}`);
52429
52732
  };
52430
52733
  const pty2 = session.pty;
@@ -54031,7 +54334,7 @@ async function handleSearchHistory(client, data) {
54031
54334
  }
54032
54335
 
54033
54336
  // src/commands/sessions/daemon/creator.ts
54034
- function creator(isNew, spawn12) {
54337
+ function creator(isNew, spawn13) {
54035
54338
  const reply2 = (client, result) => {
54036
54339
  if (typeof result !== "string") {
54037
54340
  sendTo(client, { type: "error", message: result.error });
@@ -54041,7 +54344,7 @@ function creator(isNew, spawn12) {
54041
54344
  };
54042
54345
  return (client, m, d) => {
54043
54346
  if (m.links.route(client, d)) return;
54044
- const result = spawn12(m, d);
54347
+ const result = spawn13(m, d);
54045
54348
  if (result instanceof Promise)
54046
54349
  result.then(
54047
54350
  (resolved) => reply2(client, resolved),
@@ -54530,12 +54833,12 @@ function isPrCheckoutArgs(args) {
54530
54833
  }
54531
54834
 
54532
54835
  // src/commands/sessions/daemon/worktree/prCheckoutHolder.ts
54533
- import { execFile as execFile15 } from "child_process";
54836
+ import { execFile as execFile14 } from "child_process";
54534
54837
  import { existsSync as existsSync103 } from "fs";
54535
54838
  function prHeadBranch2(number, cwd) {
54536
54839
  const { headBranch } = prCliCommands(number, cwd);
54537
54840
  return new Promise((resolve32) => {
54538
- execFile15(
54841
+ execFile14(
54539
54842
  headBranch.file,
54540
54843
  headBranch.args,
54541
54844
  { cwd, encoding: "utf8", windowsHide: true },
@@ -54562,7 +54865,7 @@ function spawnAssistCreate(m, d) {
54562
54865
  const assistArgs = d.assistArgs ?? [];
54563
54866
  const cwd = d.cwd;
54564
54867
  const inPlace = d.inPlace === true;
54565
- const spawn12 = (holder) => m.spawnAssist(
54868
+ const spawn13 = (holder) => m.spawnAssist(
54566
54869
  assistArgs,
54567
54870
  holder ?? cwd,
54568
54871
  {
@@ -54572,8 +54875,8 @@ function spawnAssistCreate(m, d) {
54572
54875
  },
54573
54876
  spawnContextFrom(d)
54574
54877
  );
54575
- if (inPlace || !isPrCheckoutArgs(assistArgs)) return spawn12();
54576
- return prCheckoutHolder(assistArgs, cwd).then(spawn12);
54878
+ if (inPlace || !isPrCheckoutArgs(assistArgs)) return spawn13();
54879
+ return prCheckoutHolder(assistArgs, cwd).then(spawn13);
54577
54880
  }
54578
54881
 
54579
54882
  // src/commands/sessions/daemon/spawnCreate.ts
@@ -54855,7 +55158,7 @@ async function runDaemon() {
54855
55158
  setDaemonLogSink(manager.clients.emitLog);
54856
55159
  startDaemonLogTrimmer();
54857
55160
  pollRepoConfigCache();
54858
- inboxScanner.start(() => broadcast(manager.clients, { type: "inbox" }));
55161
+ inboxScanner.start((type) => broadcast(manager.clients, { type }));
54859
55162
  await startDaemonServer(manager, checkAutoExit);
54860
55163
  await refreshRepoConfigCacheOnStart();
54861
55164
  }