@staff0rd/assist 0.1019.0 → 0.1020.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.1019.0",
9
+ version: "0.1020.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -1054,25 +1054,25 @@ var MODIFIER_ORDER = [
1054
1054
  "Shift",
1055
1055
  "Meta"
1056
1056
  ];
1057
- function parseModifiers(tokens, text18) {
1057
+ function parseModifiers(tokens, text19) {
1058
1058
  const modifiers = /* @__PURE__ */ new Set();
1059
1059
  for (const token of tokens) {
1060
1060
  const modifier = MODIFIER_ALIASES[token.toLowerCase()];
1061
1061
  if (!modifier)
1062
- return { ok: false, error: `"${token}" is not a modifier in "${text18}"` };
1062
+ return { ok: false, error: `"${token}" is not a modifier in "${text19}"` };
1063
1063
  if (modifiers.has(modifier))
1064
- return { ok: false, error: `"${token}" is repeated in "${text18}"` };
1064
+ return { ok: false, error: `"${token}" is repeated in "${text19}"` };
1065
1065
  modifiers.add(modifier);
1066
1066
  }
1067
1067
  if (![...modifiers].some((modifier) => modifier !== "Shift"))
1068
1068
  return {
1069
1069
  ok: false,
1070
- error: `"${text18}" needs at least one of Mod, Ctrl, Alt or Meta`
1070
+ error: `"${text19}" needs at least one of Mod, Ctrl, Alt or Meta`
1071
1071
  };
1072
1072
  if (modifiers.has("Mod") && (modifiers.has("Ctrl") || modifiers.has("Meta")))
1073
1073
  return {
1074
1074
  ok: false,
1075
- error: `"${text18}" combines Mod with Ctrl or Meta, which Mod already means`
1075
+ error: `"${text19}" combines Mod with Ctrl or Meta, which Mod already means`
1076
1076
  };
1077
1077
  return {
1078
1078
  ok: true,
@@ -1081,16 +1081,16 @@ function parseModifiers(tokens, text18) {
1081
1081
  }
1082
1082
 
1083
1083
  // src/shared/hotkeys/parseChord.ts
1084
- function parseChord(text18, { modifiersOnly = false } = {}) {
1085
- const tokens = text18.split("+").map((token) => token.trim());
1084
+ function parseChord(text19, { modifiersOnly = false } = {}) {
1085
+ const tokens = text19.split("+").map((token) => token.trim());
1086
1086
  const keyToken = modifiersOnly ? void 0 : tokens.pop();
1087
- const parsed = parseModifiers(tokens, text18);
1087
+ const parsed = parseModifiers(tokens, text19);
1088
1088
  if (!parsed.ok) return parsed;
1089
1089
  const { modifiers } = parsed;
1090
1090
  if (keyToken === void 0) return { ok: true, chord: { modifiers } };
1091
1091
  const key = hotkeyKeyCode(keyToken);
1092
1092
  if (!key)
1093
- return { ok: false, error: `"${keyToken}" is not a key in "${text18}"` };
1093
+ return { ok: false, error: `"${keyToken}" is not a key in "${text19}"` };
1094
1094
  return { ok: true, chord: { modifiers, key } };
1095
1095
  }
1096
1096
 
@@ -3866,7 +3866,7 @@ async function loadDocsRefreshStories(orm, ids) {
3866
3866
  return rows.map((r) => ({
3867
3867
  id: r.id,
3868
3868
  name: r.name,
3869
- summaries: summaries.filter((s) => s.itemId === r.id).map(({ phase, text: text18 }) => ({ phase, text: text18 })),
3869
+ summaries: summaries.filter((s) => s.itemId === r.id).map(({ phase, text: text19 }) => ({ phase, text: text19 })),
3870
3870
  commits: commits2.filter((c) => c.itemId === r.id).map((c) => c.ref)
3871
3871
  }));
3872
3872
  }
@@ -4224,7 +4224,7 @@ async function readJsonBody(req) {
4224
4224
  // src/commands/sessions/web/browser/parseBrowserRequest.ts
4225
4225
  function parseBrowserRequest(body) {
4226
4226
  const fields = body ?? {};
4227
- const { op, url, selector, text: text18, code } = fields;
4227
+ const { op, url, selector, text: text19, code } = fields;
4228
4228
  if (!optionalString(url)) return void 0;
4229
4229
  if (op === "status" || op === "snapshot") return { op, url };
4230
4230
  if (op === "console") return parseConsoleRequest(url, fields);
@@ -4232,7 +4232,7 @@ function parseBrowserRequest(body) {
4232
4232
  return typeof code === "string" && code.trim() ? { op, url, code } : void 0;
4233
4233
  if (op !== "inspect") return void 0;
4234
4234
  if (typeof selector === "string" && selector) return { op, url, selector };
4235
- if (typeof text18 === "string" && text18) return { op, url, text: text18 };
4235
+ if (typeof text19 === "string" && text19) return { op, url, text: text19 };
4236
4236
  return void 0;
4237
4237
  }
4238
4238
  function optionalString(value) {
@@ -4381,8 +4381,8 @@ async function connectMobile(req, res) {
4381
4381
  // src/commands/sessions/shared/readLogTail.ts
4382
4382
  import { closeSync as closeSync2, fstatSync, openSync as openSync2, readSync } from "fs";
4383
4383
  var MAX_TAIL_BYTES = 4 * 1024 * 1024;
4384
- function completeLines(text18, windowIsPartial) {
4385
- const all = text18.split("\n");
4384
+ function completeLines(text19, windowIsPartial) {
4385
+ const all = text19.split("\n");
4386
4386
  if (all.at(-1) === "") all.pop();
4387
4387
  if (windowIsPartial) all.shift();
4388
4388
  return all;
@@ -4878,10 +4878,10 @@ var docsFeedbackSchema = z9.object({
4878
4878
 
4879
4879
  // src/commands/sessions/web/docsFeedback/docsFeedback.ts
4880
4880
  var DOCS_DIR = "docs/src/";
4881
- function respond(res, text18, status2, message3) {
4881
+ function respond(res, text19, status2, message3) {
4882
4882
  recordPromptJournal({
4883
4883
  event: "outcome",
4884
- text: text18,
4884
+ text: text19,
4885
4885
  message: `${status2} ${message3}`
4886
4886
  });
4887
4887
  respondJson(res, status2, status2 === 200 ? { message: message3 } : { error: message3 });
@@ -4895,19 +4895,19 @@ async function docsFeedback(req, res) {
4895
4895
  respondJson(res, 400, { error: "Invalid docs feedback body" });
4896
4896
  return;
4897
4897
  }
4898
- const text18 = docsFeedbackPrompt(parsed.data);
4899
- recordPromptJournal({ event: "received", text: text18 });
4898
+ const text19 = docsFeedbackPrompt(parsed.data);
4899
+ recordPromptJournal({ event: "received", text: text19 });
4900
4900
  const reply2 = await requestDaemonReply(
4901
4901
  {
4902
4902
  type: "type-prompt-to-writer",
4903
4903
  file: parsed.data.source,
4904
4904
  within: DOCS_DIR,
4905
- text: text18
4905
+ text: text19
4906
4906
  },
4907
4907
  "type-prompt-result"
4908
4908
  );
4909
- if (!reply2) respond(res, text18, 504, "assist daemon did not answer");
4910
- else respond(res, text18, reply2.ok ? 200 : 404, reply2.message);
4909
+ if (!reply2) respond(res, text19, 504, "assist daemon did not answer");
4910
+ else respond(res, text19, reply2.ok ? 200 : 404, reply2.message);
4911
4911
  }
4912
4912
 
4913
4913
  // src/commands/sessions/web/fileContent.ts
@@ -5475,13 +5475,13 @@ function segmentText(segment) {
5475
5475
  return "[]";
5476
5476
  }
5477
5477
  function formatConfigPath(path109) {
5478
- let text18 = "";
5478
+ let text19 = "";
5479
5479
  for (const segment of path109) {
5480
5480
  const dotted = segment.kind === "key" || segment.kind === "entry";
5481
5481
  const rendered = segmentText(segment);
5482
- text18 += dotted && text18 ? `.${rendered}` : rendered;
5482
+ text19 += dotted && text19 ? `.${rendered}` : rendered;
5483
5483
  }
5484
- return text18;
5484
+ return text19;
5485
5485
  }
5486
5486
 
5487
5487
  // src/shared/unwrapSchemaNode.ts
@@ -5883,25 +5883,25 @@ function bracketSegment(inner) {
5883
5883
  function nameSegment(name) {
5884
5884
  return name === RECORD_ENTRY_TOKEN ? { kind: "entry" } : { kind: "key", name };
5885
5885
  }
5886
- function parseConfigPath(text18) {
5886
+ function parseConfigPath(text19) {
5887
5887
  const path109 = [];
5888
5888
  let at2 = 0;
5889
- while (at2 < text18.length) {
5890
- if (text18[at2] === "[") {
5891
- const close = text18.indexOf("]", at2);
5892
- const segment = close === -1 ? void 0 : bracketSegment(text18.slice(at2 + 1, close));
5889
+ while (at2 < text19.length) {
5890
+ if (text19[at2] === "[") {
5891
+ const close = text19.indexOf("]", at2);
5892
+ const segment = close === -1 ? void 0 : bracketSegment(text19.slice(at2 + 1, close));
5893
5893
  if (!segment) return void 0;
5894
5894
  path109.push(segment);
5895
5895
  at2 = close + 1;
5896
5896
  continue;
5897
5897
  }
5898
- if (text18[at2] === ".") {
5898
+ if (text19[at2] === ".") {
5899
5899
  if (path109.length === 0) return void 0;
5900
5900
  at2 += 1;
5901
5901
  }
5902
5902
  const start2 = at2;
5903
- while (at2 < text18.length && text18[at2] !== "." && text18[at2] !== "[") at2 += 1;
5904
- const name = text18.slice(start2, at2);
5903
+ while (at2 < text19.length && text19[at2] !== "." && text19[at2] !== "[") at2 += 1;
5904
+ const name = text19.slice(start2, at2);
5905
5905
  if (!name) return void 0;
5906
5906
  path109.push(nameSegment(name));
5907
5907
  }
@@ -7369,11 +7369,11 @@ async function deleteItemComment(res, itemId2, commentId) {
7369
7369
 
7370
7370
  // src/commands/backlog/appendComment.ts
7371
7371
  import { sql as sql16 } from "drizzle-orm";
7372
- async function appendComment(orm, itemId2, text18, opts = {}) {
7372
+ async function appendComment(orm, itemId2, text19, opts = {}) {
7373
7373
  await orm.insert(comments).values({
7374
7374
  itemId: itemId2,
7375
7375
  idx: sql16`(SELECT COALESCE(MAX(${comments.idx}) + 1, 0) FROM ${comments} WHERE ${comments.itemId} = ${itemId2})`,
7376
- text: text18,
7376
+ text: text19,
7377
7377
  phase: opts.phase ?? null,
7378
7378
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
7379
7379
  type: opts.type ?? "comment"
@@ -7809,8 +7809,8 @@ import * as fs3 from "fs";
7809
7809
  import * as path5 from "path";
7810
7810
 
7811
7811
  // src/commands/sessions/shared/backlogRunMarkers.ts
7812
- function backlogRunMarkers(text18) {
7813
- const match = text18.match(/backlog item a(\d+):[ \t]*([^\n]*)/);
7812
+ function backlogRunMarkers(text19) {
7813
+ const match = text19.match(/backlog item a(\d+):[ \t]*([^\n]*)/);
7814
7814
  if (!match) return { commandName: "", commandArgs: "" };
7815
7815
  const title = match[2].trim();
7816
7816
  return {
@@ -7991,11 +7991,11 @@ function messageText(entry) {
7991
7991
  const content = msg?.content;
7992
7992
  return typeof content === "string" ? content : Array.isArray(content) ? content.find((c) => c.type === "text")?.text ?? "" : "";
7993
7993
  }
7994
- function stripMarkers(text18) {
7995
- return text18.replace(/<command-[^>]*>[^<]*<\/command-[^>]*>/g, "").trim().slice(0, 80);
7994
+ function stripMarkers(text19) {
7995
+ return text19.replace(/<command-[^>]*>[^<]*<\/command-[^>]*>/g, "").trim().slice(0, 80);
7996
7996
  }
7997
- function matchMarker(text18, tag) {
7998
- const match = text18.match(new RegExp(`<${tag}>([\\s\\S]*?)</${tag}>`));
7997
+ function matchMarker(text19, tag) {
7998
+ const match = text19.match(new RegExp(`<${tag}>([\\s\\S]*?)</${tag}>`));
7999
7999
  return match ? match[1].trim() : "";
8000
8000
  }
8001
8001
 
@@ -8630,14 +8630,14 @@ var BOUNDARY_BONUS = 10;
8630
8630
  var CONSECUTIVE_BONUS = 8;
8631
8631
  var MAX_GAP_PENALTY = 6;
8632
8632
  var MAX_LENGTH_PENALTY = 100;
8633
- function isBoundary(text18, index2) {
8633
+ function isBoundary(text19, index2) {
8634
8634
  if (index2 === 0) return true;
8635
- const previous = text18[index2 - 1] ?? "";
8635
+ const previous = text19[index2 - 1] ?? "";
8636
8636
  if (!/[A-Za-z0-9]/.test(previous)) return true;
8637
- return /[a-z0-9]/.test(previous) && /[A-Z]/.test(text18[index2] ?? "");
8637
+ return /[a-z0-9]/.test(previous) && /[A-Z]/.test(text19[index2] ?? "");
8638
8638
  }
8639
- function subsequenceScore(text18, query) {
8640
- const lower = text18.toLowerCase();
8639
+ function subsequenceScore(text19, query) {
8640
+ const lower = text19.toLowerCase();
8641
8641
  let score = 0;
8642
8642
  let cursor = 0;
8643
8643
  let previous = -1;
@@ -8645,13 +8645,13 @@ function subsequenceScore(text18, query) {
8645
8645
  const at2 = lower.indexOf(char, cursor);
8646
8646
  if (at2 === -1) return null;
8647
8647
  if (at2 === previous + 1) score += CONSECUTIVE_BONUS;
8648
- if (isBoundary(text18, at2)) score += BOUNDARY_BONUS;
8648
+ if (isBoundary(text19, at2)) score += BOUNDARY_BONUS;
8649
8649
  if (at2 === 0) score += START_BONUS;
8650
8650
  score -= Math.min(at2 - cursor, MAX_GAP_PENALTY);
8651
8651
  previous = at2;
8652
8652
  cursor = at2 + 1;
8653
8653
  }
8654
- return score - Math.min(text18.length, MAX_LENGTH_PENALTY);
8654
+ return score - Math.min(text19.length, MAX_LENGTH_PENALTY);
8655
8655
  }
8656
8656
  function scoreFilePath(path109, query) {
8657
8657
  const needle = query.trim().toLowerCase();
@@ -8746,9 +8746,9 @@ function excerpt(xml, ...tags) {
8746
8746
  for (const tag of tags) {
8747
8747
  const raw = extractText(xml, tag);
8748
8748
  if (!raw) continue;
8749
- const text18 = stripHtml(raw);
8750
- if (text18.length <= MAX_EXCERPT) return text18;
8751
- return `${text18.slice(0, MAX_EXCERPT)}\u2026`;
8749
+ const text19 = stripHtml(raw);
8750
+ if (text19.length <= MAX_EXCERPT) return text19;
8751
+ return `${text19.slice(0, MAX_EXCERPT)}\u2026`;
8752
8752
  }
8753
8753
  return "";
8754
8754
  }
@@ -9132,10 +9132,10 @@ function ghErrorText(error) {
9132
9132
 
9133
9133
  // src/commands/sessions/web/next/projectErrorText.ts
9134
9134
  function projectErrorText(error) {
9135
- const text18 = ghErrorText(error);
9136
- if (/read:project|required scopes/i.test(text18))
9135
+ const text19 = ghErrorText(error);
9136
+ if (/read:project|required scopes/i.test(text19))
9137
9137
  return "The gh token has no project scope, so the project cannot be read. Run: gh auth refresh -h github.com -s project";
9138
- return text18;
9138
+ return text19;
9139
9139
  }
9140
9140
 
9141
9141
  // src/commands/sessions/web/next/pickupsQuery.ts
@@ -9639,8 +9639,8 @@ function splitTitle(rest) {
9639
9639
  const match = RULE_TITLE.exec(rest);
9640
9640
  if (!match) return { text: rest };
9641
9641
  const title = match[1].trim();
9642
- const text18 = match[2].trim();
9643
- return title === "" || text18 === "" ? { text: rest } : { title, text: text18 };
9642
+ const text19 = match[2].trim();
9643
+ return title === "" || text19 === "" ? { text: rest } : { title, text: text19 };
9644
9644
  }
9645
9645
  function parseRulesSection(content) {
9646
9646
  const lines2 = content.split(/\r?\n/);
@@ -10560,8 +10560,8 @@ async function latestRun(cwd, repo, workflow) {
10560
10560
  }
10561
10561
 
10562
10562
  // src/commands/sessions/web/releases/releaseJobTokens.ts
10563
- function normaliseJobName(text18) {
10564
- return ` ${text18.toLowerCase().replaceAll(/[^a-z0-9]+/g, " ").trim()} `;
10563
+ function normaliseJobName(text19) {
10564
+ return ` ${text19.toLowerCase().replaceAll(/[^a-z0-9]+/g, " ").trim()} `;
10565
10565
  }
10566
10566
  function releaseJobTokens(node) {
10567
10567
  const candidates = [node.environment, node.label, node.id].filter(
@@ -11552,7 +11552,7 @@ function scrubConfigSecrets(messages, value, node) {
11552
11552
  if (needles.length === 0) return messages;
11553
11553
  return messages.map(
11554
11554
  (message3) => needles.reduce(
11555
- (text18, needle) => text18.split(needle).join(SECRET_MASK),
11555
+ (text19, needle) => text19.split(needle).join(SECRET_MASK),
11556
11556
  message3
11557
11557
  )
11558
11558
  );
@@ -12325,8 +12325,8 @@ var ANSI = new RegExp(
12325
12325
  `${String.fromCharCode(27)}\\[[0-9;?]*[ -/]*[@-~]`,
12326
12326
  "g"
12327
12327
  );
12328
- function stripAnsi(text18) {
12329
- return text18.replace(ANSI, "");
12328
+ function stripAnsi(text19) {
12329
+ return text19.replace(ANSI, "");
12330
12330
  }
12331
12331
 
12332
12332
  // src/commands/sessions/daemon/worktree/watcherLogPath.ts
@@ -15106,7 +15106,7 @@ ${extra}`);
15106
15106
  sections.push(
15107
15107
  `## Your rules
15108
15108
 
15109
- ${rules2.map(({ title, text: text18 }) => `- **${title}** \u2014 ${text18}`).join("\n")}`
15109
+ ${rules2.map(({ title, text: text19 }) => `- **${title}** \u2014 ${text19}`).join("\n")}`
15110
15110
  );
15111
15111
  if (sections.length === 0) return "";
15112
15112
  return [heading, ...sections].join("\n\n");
@@ -15462,28 +15462,61 @@ function registerAsk(program) {
15462
15462
  );
15463
15463
  }
15464
15464
 
15465
- // src/commands/askQuestion.ts
15465
+ // src/commands/askCheck.ts
15466
15466
  import { randomUUID as randomUUID4 } from "crypto";
15467
15467
 
15468
- // src/commands/askQuestion/formatAskQuestionAnswers.ts
15469
- function formatAskQuestionAnswers(questions, answers) {
15470
- const pairs = questions.map(({ question }) => `"${question}"="${answers[question] ?? ""}"`).join(", ");
15471
- return `User has answered your questions: ${pairs}. You can now continue with the user's answers in mind.`;
15472
- }
15473
-
15474
- // src/commands/askQuestion/rejectLongQuestions.ts
15475
- var MAX_QUESTION_WORDS = 30;
15476
- function countWords(text18) {
15477
- return text18.split(/\s+/).filter(Boolean).length;
15468
+ // src/commands/sessions/shared/askCheckInputSchema.ts
15469
+ import { z as z10 } from "zod";
15470
+ var text16 = z10.string().trim().min(1);
15471
+ var askCheckInputSchema = z10.object({
15472
+ title: text16,
15473
+ steps: z10.array(text16).min(1, "Give at least 1 step"),
15474
+ before: z10.array(text16).optional(),
15475
+ changed: text16.optional()
15476
+ });
15477
+ var CHECK_RESULT_KEY = "result";
15478
+ var CHECK_NOTE_KEY = "note";
15479
+
15480
+ // src/commands/askCheck/formatAskCheckAnswer.ts
15481
+ function formatAskCheckAnswer(title, answers) {
15482
+ const result = answers[CHECK_RESULT_KEY] ?? "";
15483
+ const note = answers[CHECK_NOTE_KEY]?.trim();
15484
+ const line = `Manual check "${title}": ${result}`;
15485
+ return note ? `${line}
15486
+ Note: ${note}` : line;
15487
+ }
15488
+
15489
+ // src/commands/askCheck/rejectLongCheck.ts
15490
+ var MAX_TITLE = 60;
15491
+ var MAX_STEPS = 4;
15492
+ var MAX_STEP = 90;
15493
+ var MAX_BEFORE = 4;
15494
+ var MAX_CHANGED = 160;
15495
+ function overLength(field, value, max) {
15496
+ return value.length > max ? [`- ${field}: ${value.length} characters (max ${max})`] : [];
15497
+ }
15498
+ function overCount(field, values, max) {
15499
+ return values.length > max ? [`- ${field}: ${values.length} items (max ${max})`] : [];
15500
+ }
15501
+ function checkLimitViolations(check2) {
15502
+ return [
15503
+ ...overLength("title", check2.title, MAX_TITLE),
15504
+ ...overCount("steps", check2.steps, MAX_STEPS),
15505
+ ...check2.steps.flatMap(
15506
+ (step3, i) => overLength(`steps[${i + 1}]`, step3, MAX_STEP)
15507
+ ),
15508
+ ...overCount("before", check2.before ?? [], MAX_BEFORE),
15509
+ ...overLength("changed", check2.changed ?? "", MAX_CHANGED)
15510
+ ];
15478
15511
  }
15479
- function rejectLongQuestions(questions) {
15480
- const longQuestions = questions.map((q) => ({ header: q.header, words: countWords(q.question) })).filter((q) => q.words > MAX_QUESTION_WORDS);
15481
- if (longQuestions.length === 0) return;
15512
+ function rejectLongCheck(check2) {
15513
+ const violations = checkLimitViolations(check2);
15514
+ if (violations.length === 0) return;
15482
15515
  console.error(
15483
15516
  [
15484
- `Error: questions must be ${MAX_QUESTION_WORDS} words or fewer:`,
15485
- ...longQuestions.map((q) => `- ${q.header}: ${q.words} words`),
15486
- "Shorten these questions and re-run assist ask-question."
15517
+ "Error: the check is over its limits:",
15518
+ ...violations,
15519
+ "Shorten these fields and re-run assist ask-check."
15487
15520
  ].join("\n")
15488
15521
  );
15489
15522
  process.exit(1);
@@ -15526,29 +15559,6 @@ ${issues}`);
15526
15559
  return parsed.data;
15527
15560
  }
15528
15561
 
15529
- // src/commands/sessions/shared/askQuestionInputSchema.ts
15530
- import { z as z10 } from "zod";
15531
- var askQuestionOptionSchema = z10.object({
15532
- label: z10.string().min(1),
15533
- description: z10.string(),
15534
- preview: z10.string().optional()
15535
- });
15536
- var askQuestionSchema = z10.object({
15537
- question: z10.string().min(1),
15538
- header: z10.string().min(1),
15539
- multiSelect: z10.boolean(),
15540
- options: z10.array(askQuestionOptionSchema).min(2, "Each question needs at least 2 options").max(4, "Each question allows at most 4 options").refine(
15541
- (options2) => new Set(options2.map((option) => option.label)).size === options2.length,
15542
- "Option labels must be unique within a question"
15543
- )
15544
- });
15545
- var askQuestionInputSchema = z10.object({
15546
- questions: z10.array(askQuestionSchema).min(1, "Ask at least 1 question").max(4, "Ask at most 4 questions").refine(
15547
- (questions) => new Set(questions.map((q) => q.question)).size === questions.length,
15548
- "Question texts must be unique"
15549
- )
15550
- });
15551
-
15552
15562
  // src/commands/sessions/shared/isLiveDaemonSession.ts
15553
15563
  var LIVE_TIMEOUT_MS = 1e3;
15554
15564
  async function isLiveDaemonSession(sessionId) {
@@ -15560,6 +15570,116 @@ async function isLiveDaemonSession(sessionId) {
15560
15570
  return reply2?.live === true;
15561
15571
  }
15562
15572
 
15573
+ // src/commands/askCheck.ts
15574
+ function askInChat(reason4) {
15575
+ console.error(
15576
+ `Error: ${reason4}; ask the user to perform the check in chat instead.`
15577
+ );
15578
+ process.exit(1);
15579
+ }
15580
+ async function askCheck(options2) {
15581
+ const check2 = await readJsonPayload(
15582
+ options2.json,
15583
+ askCheckInputSchema,
15584
+ "manual check"
15585
+ );
15586
+ rejectLongCheck(check2);
15587
+ const sessionId = process.env.ASSIST_SESSION_ID;
15588
+ if (process.env.ASSIST_SESSION !== "1" || !sessionId)
15589
+ askInChat("not running in an assist session");
15590
+ if (!loadConfig().sessions?.askQuestion)
15591
+ askInChat("assist ask-check is disabled (sessions.askQuestion)");
15592
+ if (!await isLiveDaemonSession(sessionId))
15593
+ askInChat(
15594
+ `session ${sessionId} is not live in the assist daemon, so no preview pane can show the check`
15595
+ );
15596
+ const decision = await awaitPreviewApproval(
15597
+ check2.title,
15598
+ {
15599
+ sessionId,
15600
+ requestId: randomUUID4(),
15601
+ title: check2.title,
15602
+ body: JSON.stringify(check2),
15603
+ prNumber: null,
15604
+ kind: "check"
15605
+ },
15606
+ { rejectIsOutcome: true }
15607
+ );
15608
+ if (decision.decision === "reject") {
15609
+ console.error(
15610
+ "The user dismissed the manual check without a result. Do not assume it passed; ask in chat if the result is essential."
15611
+ );
15612
+ process.exit(1);
15613
+ }
15614
+ console.log(formatAskCheckAnswer(check2.title, decision.answers ?? {}));
15615
+ }
15616
+
15617
+ // src/commands/registerAskCheck.ts
15618
+ function registerAskCheck(program) {
15619
+ internalCommand(
15620
+ configHelp(
15621
+ program.command("ask-check").description(
15622
+ "Ask the user to perform a manual check in the session's web preview pane and wait for Works / Doesn't work plus an optional note"
15623
+ ).requiredOption(
15624
+ "--json <file|->",
15625
+ "Check JSON ({title, steps, before?, changed?}): title \u226460 chars, 1-4 steps \u226490 chars each, \u22644 before chips, changed \u2264160 chars; or - for stdin"
15626
+ ).action(askCheck),
15627
+ askQuestionConfigHelp
15628
+ ),
15629
+ "Claude when asking the user to test a change"
15630
+ );
15631
+ }
15632
+
15633
+ // src/commands/askQuestion.ts
15634
+ import { randomUUID as randomUUID5 } from "crypto";
15635
+
15636
+ // src/commands/askQuestion/formatAskQuestionAnswers.ts
15637
+ function formatAskQuestionAnswers(questions, answers) {
15638
+ const pairs = questions.map(({ question }) => `"${question}"="${answers[question] ?? ""}"`).join(", ");
15639
+ return `User has answered your questions: ${pairs}. You can now continue with the user's answers in mind.`;
15640
+ }
15641
+
15642
+ // src/commands/askQuestion/rejectLongQuestions.ts
15643
+ var MAX_QUESTION_WORDS = 30;
15644
+ function countWords(text19) {
15645
+ return text19.split(/\s+/).filter(Boolean).length;
15646
+ }
15647
+ function rejectLongQuestions(questions) {
15648
+ const longQuestions = questions.map((q) => ({ header: q.header, words: countWords(q.question) })).filter((q) => q.words > MAX_QUESTION_WORDS);
15649
+ if (longQuestions.length === 0) return;
15650
+ console.error(
15651
+ [
15652
+ `Error: questions must be ${MAX_QUESTION_WORDS} words or fewer:`,
15653
+ ...longQuestions.map((q) => `- ${q.header}: ${q.words} words`),
15654
+ "Shorten these questions and re-run assist ask-question."
15655
+ ].join("\n")
15656
+ );
15657
+ process.exit(1);
15658
+ }
15659
+
15660
+ // src/commands/sessions/shared/askQuestionInputSchema.ts
15661
+ import { z as z11 } from "zod";
15662
+ var askQuestionOptionSchema = z11.object({
15663
+ label: z11.string().min(1),
15664
+ description: z11.string(),
15665
+ preview: z11.string().optional()
15666
+ });
15667
+ var askQuestionSchema = z11.object({
15668
+ question: z11.string().min(1),
15669
+ header: z11.string().min(1),
15670
+ multiSelect: z11.boolean(),
15671
+ options: z11.array(askQuestionOptionSchema).min(2, "Each question needs at least 2 options").max(4, "Each question allows at most 4 options").refine(
15672
+ (options2) => new Set(options2.map((option) => option.label)).size === options2.length,
15673
+ "Option labels must be unique within a question"
15674
+ )
15675
+ });
15676
+ var askQuestionInputSchema = z11.object({
15677
+ questions: z11.array(askQuestionSchema).min(1, "Ask at least 1 question").max(4, "Ask at most 4 questions").refine(
15678
+ (questions) => new Set(questions.map((q) => q.question)).size === questions.length,
15679
+ "Question texts must be unique"
15680
+ )
15681
+ });
15682
+
15563
15683
  // src/commands/askQuestion.ts
15564
15684
  function useBuiltIn(reason4) {
15565
15685
  console.error(`Error: ${reason4}; use the built-in AskUserQuestion tool.`);
@@ -15586,7 +15706,7 @@ async function askQuestion(options2) {
15586
15706
  title,
15587
15707
  {
15588
15708
  sessionId,
15589
- requestId: randomUUID4(),
15709
+ requestId: randomUUID5(),
15590
15710
  title,
15591
15711
  body: JSON.stringify({ questions }),
15592
15712
  prNumber: null,
@@ -16549,10 +16669,10 @@ function registerCloneCommand(cmd) {
16549
16669
 
16550
16670
  // src/commands/backlog/comment.ts
16551
16671
  import chalk49 from "chalk";
16552
- async function comment(id, text18) {
16672
+ async function comment(id, text19) {
16553
16673
  const found = await findOneItem(id);
16554
16674
  if (!found) process.exit(1);
16555
- await appendComment(found.orm, found.item.id, text18);
16675
+ await appendComment(found.orm, found.item.id, text19);
16556
16676
  console.log(
16557
16677
  chalk49.green(`Comment added to item ${formatItemId(found.item.id)}.`)
16558
16678
  );
@@ -16673,9 +16793,9 @@ function readLine(dump, start2) {
16673
16793
  return { text: dump.subarray(start2, eol).toString("utf8"), next: eol + 1 };
16674
16794
  }
16675
16795
  function parseHeader(dump) {
16676
- const { text: text18, next: next3 } = readLine(dump, 0);
16796
+ const { text: text19, next: next3 } = readLine(dump, 0);
16677
16797
  try {
16678
- return { header: JSON.parse(text18), bodyStart: next3 };
16798
+ return { header: JSON.parse(text19), bodyStart: next3 };
16679
16799
  } catch {
16680
16800
  return invalid("header is not valid JSON.");
16681
16801
  }
@@ -16684,9 +16804,9 @@ function parseSections(dump, bodyStart) {
16684
16804
  const sections = /* @__PURE__ */ new Map();
16685
16805
  let cursor = bodyStart;
16686
16806
  while (cursor < dump.length) {
16687
- const { text: text18, next: next3 } = readLine(dump, cursor);
16688
- const match = text18.match(/^@table (\S+) (\d+)$/);
16689
- if (!match) invalid(`malformed table marker "${text18}".`);
16807
+ const { text: text19, next: next3 } = readLine(dump, cursor);
16808
+ const match = text19.match(/^@table (\S+) (\d+)$/);
16809
+ if (!match) invalid(`malformed table marker "${text19}".`);
16690
16810
  const [, name, bytes] = match;
16691
16811
  const end = next3 + Number(bytes);
16692
16812
  if (end > dump.length) invalid(`section "${name}" overruns the dump.`);
@@ -16799,8 +16919,8 @@ async function replaceData(client, parsed) {
16799
16919
  await copyTableIn(client, table, data);
16800
16920
  }
16801
16921
  for (const col of await introspectIdentityColumns(client)) {
16802
- const { text: text18, values } = resyncIdentitySql(col);
16803
- await client.query(text18, values);
16922
+ const { text: text19, values } = resyncIdentitySql(col);
16923
+ await client.query(text19, values);
16804
16924
  }
16805
16925
  }
16806
16926
  async function restore(client, parsed) {
@@ -17021,7 +17141,7 @@ async function resolveInsertPosition(orm, itemId2, position) {
17021
17141
  }
17022
17142
 
17023
17143
  // src/commands/backlog/addPhase/reviewProposedPhase.ts
17024
- import { randomUUID as randomUUID5 } from "crypto";
17144
+ import { randomUUID as randomUUID6 } from "crypto";
17025
17145
 
17026
17146
  // src/commands/backlog/renderPhaseSection.ts
17027
17147
  function renderPhaseSection(phase, idx) {
@@ -17045,7 +17165,7 @@ async function reviewProposedPhase(item, phaseIdx, phase) {
17045
17165
  return;
17046
17166
  await awaitPreviewApproval("Backlog phase preview", {
17047
17167
  sessionId,
17048
- requestId: randomUUID5(),
17168
+ requestId: randomUUID6(),
17049
17169
  title: `Add a phase to ${formatItemId(item.id)}: ${item.name}`,
17050
17170
  body: renderPhaseSection(phase, phaseIdx),
17051
17171
  prNumber: null,
@@ -17187,21 +17307,21 @@ async function list(options2) {
17187
17307
  import chalk63 from "chalk";
17188
17308
 
17189
17309
  // src/commands/backlog/propose/proposedItemSchema.ts
17190
- import { z as z11 } from "zod";
17191
- var proposedPhaseSchema = z11.strictObject({
17192
- name: z11.string().trim().min(1, "phase name is required").refine(
17310
+ import { z as z12 } from "zod";
17311
+ var proposedPhaseSchema = z12.strictObject({
17312
+ name: z12.string().trim().min(1, "phase name is required").refine(
17193
17313
  (name) => name.toLowerCase() !== REVIEW_PHASE_NAME.toLowerCase(),
17194
17314
  `"${REVIEW_PHASE_NAME}" is owned by the runner and appended to every plan automatically \u2014 remove this phase`
17195
17315
  ),
17196
- tasks: z11.array(z11.string().trim().min(1)).min(1, "a phase needs at least one task"),
17197
- manualChecks: z11.array(z11.string().trim().min(1)).default([])
17316
+ tasks: z12.array(z12.string().trim().min(1)).min(1, "a phase needs at least one task"),
17317
+ manualChecks: z12.array(z12.string().trim().min(1)).default([])
17198
17318
  });
17199
- var proposedItemSchema = z11.strictObject({
17200
- name: z11.string().trim().min(1, "name is required"),
17201
- type: z11.enum(["story", "bug"]),
17202
- description: z11.string().optional(),
17203
- acceptanceCriteria: z11.array(z11.string().trim().min(1)).default([]),
17204
- phases: z11.array(proposedPhaseSchema).default([])
17319
+ var proposedItemSchema = z12.strictObject({
17320
+ name: z12.string().trim().min(1, "name is required"),
17321
+ type: z12.enum(["story", "bug"]),
17322
+ description: z12.string().optional(),
17323
+ acceptanceCriteria: z12.array(z12.string().trim().min(1)).default([]),
17324
+ phases: z12.array(proposedPhaseSchema).default([])
17205
17325
  });
17206
17326
 
17207
17327
  // src/commands/backlog/propose/readProposedItem.ts
@@ -17210,13 +17330,13 @@ function readProposedItem(source) {
17210
17330
  }
17211
17331
 
17212
17332
  // src/commands/backlog/propose/reviewProposal.ts
17213
- import { randomUUID as randomUUID6 } from "crypto";
17333
+ import { randomUUID as randomUUID7 } from "crypto";
17214
17334
  import chalk61 from "chalk";
17215
17335
 
17216
17336
  // src/shared/renderMarkdownTerminal.ts
17217
17337
  import { Marked } from "marked";
17218
17338
  import { markedTerminal } from "marked-terminal";
17219
- function renderMarkdownTerminal(text18) {
17339
+ function renderMarkdownTerminal(text19) {
17220
17340
  const width2 = process.stdout.columns || 80;
17221
17341
  const marked = new Marked(markedTerminal({ width: width2, reflowText: true }));
17222
17342
  marked.use({
@@ -17229,7 +17349,7 @@ function renderMarkdownTerminal(text18) {
17229
17349
  }
17230
17350
  }
17231
17351
  });
17232
- return marked.parse(text18).trimEnd();
17352
+ return marked.parse(text19).trimEnd();
17233
17353
  }
17234
17354
 
17235
17355
  // src/commands/backlog/propose/renderProposedItem.ts
@@ -17252,7 +17372,7 @@ async function reviewProposal(item, sessionId, confirmed, revises) {
17252
17372
  if (sessionId) {
17253
17373
  const decision = await awaitPreviewApproval("Backlog item preview", {
17254
17374
  sessionId,
17255
- requestId: randomUUID6(),
17375
+ requestId: randomUUID7(),
17256
17376
  title: revises === void 0 ? item.name : `Update ${formatItemId(revises)}: ${item.name}`,
17257
17377
  body,
17258
17378
  prNumber: null,
@@ -17375,7 +17495,7 @@ function startProposedRun(id) {
17375
17495
  }
17376
17496
 
17377
17497
  // src/commands/backlog/propose/trackProposal.ts
17378
- import { randomUUID as randomUUID7 } from "crypto";
17498
+ import { randomUUID as randomUUID8 } from "crypto";
17379
17499
 
17380
17500
  // src/commands/backlog/propose/mutateLedger.ts
17381
17501
  import { mkdirSync as mkdirSync10, readFileSync as readFileSync23, renameSync as renameSync4, writeFileSync as writeFileSync19 } from "fs";
@@ -17431,7 +17551,7 @@ function proposalLedgerPath(sessionId) {
17431
17551
  var STALE_OPEN_MS = 60 * 6e4;
17432
17552
  function trackProposal(sessionId) {
17433
17553
  const path109 = proposalLedgerPath(sessionId);
17434
- const token = randomUUID7();
17554
+ const token = randomUUID8();
17435
17555
  const startedAt = Date.now();
17436
17556
  mutateLedger(path109, (ledger) => {
17437
17557
  ledger.open = ledger.open.filter(
@@ -18059,11 +18179,11 @@ import { promisify as promisify11 } from "util";
18059
18179
  // src/shared/withSpinner.ts
18060
18180
  var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
18061
18181
  var TICK_MS = 80;
18062
- async function withSpinner(text18, task) {
18182
+ async function withSpinner(text19, task) {
18063
18183
  if (!process.stderr.isTTY) return task();
18064
18184
  let frame = 0;
18065
18185
  const render2 = () => {
18066
- process.stderr.write(`\r${SPINNER_FRAMES[frame]} ${text18}`);
18186
+ process.stderr.write(`\r${SPINNER_FRAMES[frame]} ${text19}`);
18067
18187
  };
18068
18188
  render2();
18069
18189
  const timer = setInterval(() => {
@@ -18809,7 +18929,7 @@ Phase ${phaseNumber} completed.`));
18809
18929
  }
18810
18930
 
18811
18931
  // src/commands/backlog/preparePhaseSession.ts
18812
- import { randomUUID as randomUUID8 } from "crypto";
18932
+ import { randomUUID as randomUUID9 } from "crypto";
18813
18933
 
18814
18934
  // src/commands/backlog/persistPhaseSession.ts
18815
18935
  import os4 from "os";
@@ -18869,20 +18989,20 @@ async function persistPhaseSessionId(itemId2, phaseIdx, claudeSessionId) {
18869
18989
  import { mkdirSync as mkdirSync14, readFileSync as readFileSync27, rmSync as rmSync4, writeFileSync as writeFileSync23 } from "fs";
18870
18990
  import { homedir as homedir17 } from "os";
18871
18991
  import { dirname as dirname28, join as join51 } from "path";
18872
- import { z as z12 } from "zod";
18873
- var activitySchema = z12.object({
18874
- kind: z12.enum(["command", "backlog"]),
18875
- harness: z12.enum(["claude", "codex", "pi"]).optional(),
18876
- name: z12.string().optional(),
18877
- itemId: z12.number().optional(),
18878
- itemName: z12.string().optional(),
18879
- itemIds: z12.array(z12.number()).optional(),
18880
- phase: z12.number().optional(),
18881
- phaseName: z12.string().optional(),
18882
- totalPhases: z12.number().optional(),
18883
- claudeSessionId: z12.string().optional(),
18884
- watchState: z12.enum(["waiting", "updating"]).optional(),
18885
- startedAt: z12.number()
18992
+ import { z as z13 } from "zod";
18993
+ var activitySchema = z13.object({
18994
+ kind: z13.enum(["command", "backlog"]),
18995
+ harness: z13.enum(["claude", "codex", "pi"]).optional(),
18996
+ name: z13.string().optional(),
18997
+ itemId: z13.number().optional(),
18998
+ itemName: z13.string().optional(),
18999
+ itemIds: z13.array(z13.number()).optional(),
19000
+ phase: z13.number().optional(),
19001
+ phaseName: z13.string().optional(),
19002
+ totalPhases: z13.number().optional(),
19003
+ claudeSessionId: z13.string().optional(),
19004
+ watchState: z13.enum(["waiting", "updating"]).optional(),
19005
+ startedAt: z13.number()
18886
19006
  });
18887
19007
  function activityPath(sessionId) {
18888
19008
  return join51(homedir17(), ".assist", "activity", `activity-${sessionId}.json`);
@@ -18981,7 +19101,7 @@ async function verifyPhaseResume(itemId2, resumeSessionId, phaseLabel2) {
18981
19101
  // src/commands/backlog/preparePhaseSession.ts
18982
19102
  async function preparePhaseSession(item, phase, phaseIndex, phaseNumber, totalPhases, phaseLabel2, spawnOptions) {
18983
19103
  const resumeSessionId = spawnOptions?.resumeSessionId;
18984
- const claudeSessionId = resumeSessionId ?? randomUUID8();
19104
+ const claudeSessionId = resumeSessionId ?? randomUUID9();
18985
19105
  if (resumeSessionId && !await verifyPhaseResume(item.id, resumeSessionId, phaseLabel2)) {
18986
19106
  return void 0;
18987
19107
  }
@@ -19325,7 +19445,7 @@ import chalk86 from "chalk";
19325
19445
  import enquirer7 from "enquirer";
19326
19446
 
19327
19447
  // src/commands/backlog/launchMode.ts
19328
- import { randomUUID as randomUUID9 } from "crypto";
19448
+ import { randomUUID as randomUUID10 } from "crypto";
19329
19449
 
19330
19450
  // src/commands/backlog/handleLaunchSignal.ts
19331
19451
  import chalk85 from "chalk";
@@ -19447,7 +19567,7 @@ async function launchMode(slashCommand, options2) {
19447
19567
  const resumeSessionId = options2?.resumeSessionId;
19448
19568
  if (!resumeSessionId) pullIfConfigured();
19449
19569
  process.env.ASSIST_SESSION_ID ??= String(process.pid);
19450
- const claudeSessionId = resumeSessionId ?? randomUUID9();
19570
+ const claudeSessionId = resumeSessionId ?? randomUUID10();
19451
19571
  const harness = options2?.harness ?? "claude";
19452
19572
  reportLaunchActivity(slashCommand, claudeSessionId, harness, options2);
19453
19573
  const prompt = resumeSessionId ? resumeNudge() : buildSlashCommand(slashCommand, options2?.description);
@@ -20265,9 +20385,9 @@ function registerUpdateFieldCommand(cmd) {
20265
20385
  import chalk108 from "chalk";
20266
20386
 
20267
20387
  // src/commands/backlog/updatePlan/planUpdateSchema.ts
20268
- import { z as z13 } from "zod";
20269
- var planUpdateSchema = z13.strictObject({
20270
- phases: z13.array(proposedPhaseSchema).min(1, "a plan needs at least one phase")
20388
+ import { z as z14 } from "zod";
20389
+ var planUpdateSchema = z14.strictObject({
20390
+ phases: z14.array(proposedPhaseSchema).min(1, "a plan needs at least one phase")
20271
20391
  });
20272
20392
 
20273
20393
  // src/commands/backlog/updatePlan/readPlanUpdate.ts
@@ -20276,7 +20396,7 @@ function readPlanUpdate(source) {
20276
20396
  }
20277
20397
 
20278
20398
  // src/commands/backlog/updatePlan/reviewPlanUpdate.ts
20279
- import { randomUUID as randomUUID10 } from "crypto";
20399
+ import { randomUUID as randomUUID11 } from "crypto";
20280
20400
  import chalk107 from "chalk";
20281
20401
 
20282
20402
  // src/commands/backlog/updatePlan/isCompleted.ts
@@ -20433,7 +20553,7 @@ async function reviewPlanUpdate(item, phases) {
20433
20553
  if (process.env.ASSIST_SESSION === "1" && sessionId) {
20434
20554
  const decision = await awaitPreviewApproval("Plan update preview", {
20435
20555
  sessionId,
20436
- requestId: randomUUID10(),
20556
+ requestId: randomUUID11(),
20437
20557
  title: `Update the plan for ${formatItemId(item.id)}: ${item.name}`,
20438
20558
  body,
20439
20559
  prNumber: null,
@@ -21211,16 +21331,16 @@ var BRANCH_CREATION_REGEXES = [
21211
21331
  var builtinDenyRules = [
21212
21332
  ...PATTERN_DENIES.map((rule) => ({
21213
21333
  message: rule.message,
21214
- matches: (text18) => text18.includes(rule.pattern),
21334
+ matches: (text19) => text19.includes(rule.pattern),
21215
21335
  enabled: rule.enabled
21216
21336
  })),
21217
21337
  ...BRANCH_CREATION_REGEXES.map((regex) => ({
21218
21338
  message: BRANCH_CREATION_MESSAGE,
21219
- matches: (text18) => regex.test(text18)
21339
+ matches: (text19) => regex.test(text19)
21220
21340
  })),
21221
21341
  {
21222
21342
  message: CLOSE_WITH_COMMENT_MESSAGE,
21223
- matches: (text18) => CLOSE_WITH_COMMENT_REGEX.test(text18)
21343
+ matches: (text19) => CLOSE_WITH_COMMENT_REGEX.test(text19)
21224
21344
  },
21225
21345
  {
21226
21346
  message: GH_ISSUE_API_MESSAGE,
@@ -21229,11 +21349,11 @@ var builtinDenyRules = [
21229
21349
  ];
21230
21350
 
21231
21351
  // src/commands/cliHook/findBuiltinDeny.ts
21232
- function normaliseWhitespace(text18) {
21233
- return text18.replace(/\\\n/g, " ").replace(/\s+/g, " ");
21352
+ function normaliseWhitespace(text19) {
21353
+ return text19.replace(/\\\n/g, " ").replace(/\s+/g, " ");
21234
21354
  }
21235
- function matchBuiltinDeny(text18) {
21236
- const normalised = normaliseWhitespace(text18);
21355
+ function matchBuiltinDeny(text19) {
21356
+ const normalised = normaliseWhitespace(text19);
21237
21357
  return builtinDenyRules.find(
21238
21358
  (rule) => rule.matches(normalised) && (rule.enabled?.() ?? true)
21239
21359
  );
@@ -22209,8 +22329,8 @@ function formatHuman(cli, commands) {
22209
22329
  `];
22210
22330
  for (const cmd of sorted2) {
22211
22331
  const full = `${cli} ${cmd.path.join(" ")}`;
22212
- const text18 = cmd.description ? `${full} \u2014 ${cmd.description}` : full;
22213
- lines2.push(`${prefix(classifyVerb(cmd.path))}${text18}`);
22332
+ const text19 = cmd.description ? `${full} \u2014 ${cmd.description}` : full;
22333
+ lines2.push(`${prefix(classifyVerb(cmd.path))}${text19}`);
22214
22334
  }
22215
22335
  return lines2.join("\n");
22216
22336
  }
@@ -22507,26 +22627,26 @@ import chalk119 from "chalk";
22507
22627
  // src/commands/codeComment/validateCommentText.ts
22508
22628
  var MAX_COMMENT_LENGTH = 50;
22509
22629
  function validateCommentText(raw, isHash = false) {
22510
- const text18 = isHash ? raw.replace(/^#\s?/, "") : raw.replace(/^\/\/\s?/, "");
22511
- if (/[\r\n]/.test(text18)) {
22630
+ const text19 = isHash ? raw.replace(/^#\s?/, "") : raw.replace(/^\/\/\s?/, "");
22631
+ if (/[\r\n]/.test(text19)) {
22512
22632
  return {
22513
22633
  ok: false,
22514
22634
  reason: "Comment must be a single line \u2014 multi-line comments are not allowed."
22515
22635
  };
22516
22636
  }
22517
- if (!isHash && (text18.includes("/*") || text18.includes("*/"))) {
22637
+ if (!isHash && (text19.includes("/*") || text19.includes("*/"))) {
22518
22638
  return {
22519
22639
  ok: false,
22520
22640
  reason: "Block comments (/* */) are not allowed \u2014 only single-line // comments."
22521
22641
  };
22522
22642
  }
22523
- if (text18.length > MAX_COMMENT_LENGTH) {
22643
+ if (text19.length > MAX_COMMENT_LENGTH) {
22524
22644
  return {
22525
22645
  ok: false,
22526
- reason: `Comment text is ${text18.length} chars; the cap is ${MAX_COMMENT_LENGTH}. Make it shorter or, better, make the code self-documenting.`
22646
+ reason: `Comment text is ${text19.length} chars; the cap is ${MAX_COMMENT_LENGTH}. Make it shorter or, better, make the code self-documenting.`
22527
22647
  };
22528
22648
  }
22529
- return { ok: true, text: text18 };
22649
+ return { ok: true, text: text19 };
22530
22650
  }
22531
22651
 
22532
22652
  // src/commands/codeComment/issuePin.ts
@@ -22589,13 +22709,13 @@ function showNotification(options2) {
22589
22709
  }
22590
22710
 
22591
22711
  // src/commands/codeComment/issuePin.ts
22592
- function issuePin(file, lineNumber, text18) {
22712
+ function issuePin(file, lineNumber, text19) {
22593
22713
  const pin2 = generatePin();
22594
22714
  mkdirSync17(getRestrictedDir(), { recursive: true });
22595
22715
  sweepRestrictedDir();
22596
22716
  writeFileSync27(
22597
22717
  getPinStatePath(pin2),
22598
- JSON.stringify({ pin: pin2, file, line: lineNumber, text: text18 })
22718
+ JSON.stringify({ pin: pin2, file, line: lineNumber, text: text19 })
22599
22719
  );
22600
22720
  return showNotification({
22601
22721
  title: "assist code-comment pin",
@@ -22607,7 +22727,7 @@ function generatePin() {
22607
22727
  }
22608
22728
 
22609
22729
  // src/commands/codeComment/codeCommentSet.ts
22610
- function codeCommentSet(file, line, text18) {
22730
+ function codeCommentSet(file, line, text19) {
22611
22731
  const lineNumber = Number.parseInt(line, 10);
22612
22732
  if (!Number.isInteger(lineNumber) || lineNumber < 1) {
22613
22733
  console.error(chalk119.red(`Invalid line number: ${line}`));
@@ -22616,7 +22736,7 @@ function codeCommentSet(file, line, text18) {
22616
22736
  }
22617
22737
  const hash = isHashCommentFile(file);
22618
22738
  const marker2 = hash ? "#" : "//";
22619
- const validation = validateCommentText(text18, hash);
22739
+ const validation = validateCommentText(text19, hash);
22620
22740
  if (!validation.ok) {
22621
22741
  console.error(chalk119.red(`Refused: ${validation.reason}`));
22622
22742
  console.error(chalk119.red("No pin issued."));
@@ -23106,16 +23226,16 @@ function parseUserLine(line) {
23106
23226
  if (entry.type !== "user") return void 0;
23107
23227
  const msg = entry.message;
23108
23228
  const c = msg?.content;
23109
- let text18;
23229
+ let text19;
23110
23230
  if (typeof c === "string") {
23111
- text18 = c;
23231
+ text19 = c;
23112
23232
  } else if (Array.isArray(c)) {
23113
23233
  const collected = c.filter((b) => b.type === "text").map((b) => b.text ?? "").join("\n");
23114
- text18 = collected || void 0;
23234
+ text19 = collected || void 0;
23115
23235
  }
23116
- if (!text18) return void 0;
23236
+ if (!text19) return void 0;
23117
23237
  return {
23118
- text: text18,
23238
+ text: text19,
23119
23239
  entrypoint: typeof entry.entrypoint === "string" ? entry.entrypoint : void 0
23120
23240
  };
23121
23241
  }
@@ -23132,29 +23252,29 @@ function* iterateUserMessages(filePath, maxBytes = 65536) {
23132
23252
  }
23133
23253
 
23134
23254
  // src/commands/sessions/summarise/scanSessionBacklogRefs.ts
23135
- function extractBacklogIds(text18) {
23255
+ function extractBacklogIds(text19) {
23136
23256
  const ids = [];
23137
- for (const m of text18.matchAll(/backlog\s+run\s+a(\d+)/gi)) {
23257
+ for (const m of text19.matchAll(/backlog\s+run\s+a(\d+)/gi)) {
23138
23258
  ids.push(Number.parseInt(m[1], 10));
23139
23259
  }
23140
- for (const m of text18.matchAll(/backlog\s+(?:item\s+)?a(\d+)/gi)) {
23260
+ for (const m of text19.matchAll(/backlog\s+(?:item\s+)?a(\d+)/gi)) {
23141
23261
  ids.push(Number.parseInt(m[1], 10));
23142
23262
  }
23143
- for (const m of text18.matchAll(/backlog\s+phase-done\s+a(\d+)/gi)) {
23263
+ for (const m of text19.matchAll(/backlog\s+phase-done\s+a(\d+)/gi)) {
23144
23264
  ids.push(Number.parseInt(m[1], 10));
23145
23265
  }
23146
- for (const m of text18.matchAll(/backlog\s+comment\s+a(\d+)/gi)) {
23266
+ for (const m of text19.matchAll(/backlog\s+comment\s+a(\d+)/gi)) {
23147
23267
  ids.push(Number.parseInt(m[1], 10));
23148
23268
  }
23149
- for (const m of text18.matchAll(/(?:^|[\s(])a(\d{1,4})(?=[\s).,;:!?]|$)/gm)) {
23269
+ for (const m of text19.matchAll(/(?:^|[\s(])a(\d{1,4})(?=[\s).,;:!?]|$)/gm)) {
23150
23270
  ids.push(Number.parseInt(m[1], 10));
23151
23271
  }
23152
23272
  return ids;
23153
23273
  }
23154
23274
 
23155
23275
  // src/shared/findBacklogRefs.ts
23156
- function findBacklogRefs(text18) {
23157
- return [...new Set(extractBacklogIds(text18))];
23276
+ function findBacklogRefs(text19) {
23277
+ return [...new Set(extractBacklogIds(text19))];
23158
23278
  }
23159
23279
  function backlogRefError(subject, context, ids) {
23160
23280
  const refs = ids.map((id) => `a${id}`).join(", ");
@@ -24651,7 +24771,7 @@ function formatTime(time) {
24651
24771
  const date = new Date(time);
24652
24772
  return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}.${pad(date.getMilliseconds(), 3)}`;
24653
24773
  }
24654
- var indent = (text18, prefix2) => text18.split("\n").map((line) => `${prefix2}${line}`);
24774
+ var indent = (text19, prefix2) => text19.split("\n").map((line) => `${prefix2}${line}`);
24655
24775
  function formatConsoleEntries({
24656
24776
  recording,
24657
24777
  entries
@@ -25673,18 +25793,18 @@ import { dirname as dirname31, join as join70 } from "path";
25673
25793
  import chalk163 from "chalk";
25674
25794
 
25675
25795
  // src/commands/devlog/write/devEntryInputSchema.ts
25676
- import { z as z14 } from "zod";
25677
- var oneLine = z14.string().trim().min(1).refine((value) => !value.includes("\n"), "must be a single line");
25678
- var changeItems = z14.array(z14.object({ text: oneLine, version: oneLine.optional() }).strict()).default([]);
25679
- var devEntryInputSchema = z14.object({
25680
- week: z14.string().refine(isValidWeek, "must be an ISO week like 2026-W33"),
25796
+ import { z as z15 } from "zod";
25797
+ var oneLine = z15.string().trim().min(1).refine((value) => !value.includes("\n"), "must be a single line");
25798
+ var changeItems = z15.array(z15.object({ text: oneLine, version: oneLine.optional() }).strict()).default([]);
25799
+ var devEntryInputSchema = z15.object({
25800
+ week: z15.string().refine(isValidWeek, "must be an ISO week like 2026-W33"),
25681
25801
  title: oneLine,
25682
- versions: z14.object({ first: oneLine, last: oneLine }).strict().optional(),
25802
+ versions: z15.object({ first: oneLine, last: oneLine }).strict().optional(),
25683
25803
  aiGenerated: oneLine,
25684
25804
  added: changeItems,
25685
25805
  changed: changeItems,
25686
25806
  fixed: changeItems,
25687
- lede: z14.string().trim().min(1)
25807
+ lede: z15.string().trim().min(1)
25688
25808
  }).strict();
25689
25809
 
25690
25810
  // src/commands/devlog/write/formatDevEntry.ts
@@ -25896,10 +26016,10 @@ function registerDevlog(program) {
25896
26016
  import chalk166 from "chalk";
25897
26017
 
25898
26018
  // src/commands/notify/forwardPinConfirm.ts
25899
- import { randomUUID as randomUUID11 } from "crypto";
26019
+ import { randomUUID as randomUUID12 } from "crypto";
25900
26020
  var CONFIRM_TIMEOUT_MS = 15e3;
25901
26021
  async function forwardPinConfirm(area, pin2) {
25902
- const requestId = randomUUID11();
26022
+ const requestId = randomUUID12();
25903
26023
  const reply2 = await requestDaemonReply(
25904
26024
  { type: "confirm-pin", requestId, area, pin: pin2 },
25905
26025
  "confirm-pin-result",
@@ -25998,12 +26118,12 @@ import { mkdirSync as mkdirSync21, unlinkSync as unlinkSync11, writeFileSync as
25998
26118
  import chalk167 from "chalk";
25999
26119
 
26000
26120
  // src/commands/notify/deliverPinNotification.ts
26001
- import { randomUUID as randomUUID12 } from "crypto";
26121
+ import { randomUUID as randomUUID13 } from "crypto";
26002
26122
  var ROUTE_TIMEOUT_MS = 1e4;
26003
26123
  async function relayToViewerNode(notification) {
26004
26124
  const sessionId = process.env.ASSIST_SESSION_ID;
26005
26125
  if (!sessionId) return void 0;
26006
- const requestId = randomUUID12();
26126
+ const requestId = randomUUID13();
26007
26127
  const reply2 = await requestDaemonReply(
26008
26128
  { type: "notify-pin", sessionId, requestId, ...notification },
26009
26129
  "notify-pin-result",
@@ -26805,8 +26925,8 @@ var MACHINE_DIRECTIVES = [
26805
26925
  "<auto-generated",
26806
26926
  MAINTAINABILITY_OVERRIDE_MARKER
26807
26927
  ];
26808
- function isCommentExempt(text18) {
26809
- const lower = text18.toLowerCase();
26928
+ function isCommentExempt(text19) {
26929
+ const lower = text19.toLowerCase();
26810
26930
  return MACHINE_DIRECTIVES.some((d) => lower.includes(d));
26811
26931
  }
26812
26932
 
@@ -26827,12 +26947,12 @@ function isSourceFile(filePath) {
26827
26947
  if (!filePath) return false;
26828
26948
  return SOURCE_EXTENSIONS.some((ext) => filePath.endsWith(ext));
26829
26949
  }
26830
- function blankNonNewline(text18) {
26831
- return text18.replace(/[^\n]/g, " ");
26950
+ function blankNonNewline(text19) {
26951
+ return text19.replace(/[^\n]/g, " ");
26832
26952
  }
26833
- function extractComments(text18) {
26953
+ function extractComments(text19) {
26834
26954
  const comments3 = [];
26835
- let work = text18.replace(
26955
+ let work = text19.replace(
26836
26956
  /"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|`(?:[^`\\]|\\.)*`/g,
26837
26957
  blankNonNewline
26838
26958
  );
@@ -27008,8 +27128,8 @@ function commentTexts(comments3) {
27008
27128
  }
27009
27129
 
27010
27130
  // src/commands/editHook/extractCsharpCommentTexts.ts
27011
- function extractCsharpCommentTexts(text18) {
27012
- return commentTexts(extractCsharpComments(text18));
27131
+ function extractCsharpCommentTexts(text19) {
27132
+ return commentTexts(extractCsharpComments(text19));
27013
27133
  }
27014
27134
 
27015
27135
  // src/shared/readRazorComment.ts
@@ -27181,8 +27301,8 @@ function extractRazorComments(content) {
27181
27301
  }
27182
27302
 
27183
27303
  // src/commands/editHook/extractRazorCommentTexts.ts
27184
- function extractRazorCommentTexts(text18) {
27185
- return commentTexts(extractRazorComments(text18));
27304
+ function extractRazorCommentTexts(text19) {
27305
+ return commentTexts(extractRazorComments(text19));
27186
27306
  }
27187
27307
 
27188
27308
  // src/shared/readRustComment.ts
@@ -27275,16 +27395,16 @@ function extractRustComments(content) {
27275
27395
  }
27276
27396
 
27277
27397
  // src/commands/editHook/extractRustCommentTexts.ts
27278
- function extractRustCommentTexts(text18) {
27279
- return commentTexts(extractRustComments(text18));
27398
+ function extractRustCommentTexts(text19) {
27399
+ return commentTexts(extractRustComments(text19));
27280
27400
  }
27281
27401
 
27282
27402
  // src/commands/editHook/extractYamlComments.ts
27283
- function blankNonNewline2(text18) {
27284
- return text18.replace(/[^\n]/g, " ");
27403
+ function blankNonNewline2(text19) {
27404
+ return text19.replace(/[^\n]/g, " ");
27285
27405
  }
27286
- function extractYamlComments(text18) {
27287
- const work = text18.replace(
27406
+ function extractYamlComments(text19) {
27407
+ const work = text19.replace(
27288
27408
  /"(?:[^"\\]|\\.)*"|'(?:[^']|'')*'/g,
27289
27409
  blankNonNewline2
27290
27410
  );
@@ -27300,8 +27420,8 @@ function isHeaderLine(line) {
27300
27420
  const trimmed = line.trim();
27301
27421
  return trimmed === "" || trimmed.startsWith("#");
27302
27422
  }
27303
- function extractShellComments(text18) {
27304
- const lines2 = text18.split("\n");
27423
+ function extractShellComments(text19) {
27424
+ const lines2 = text19.split("\n");
27305
27425
  let firstCodeLine = 0;
27306
27426
  while (firstCodeLine < lines2.length && isHeaderLine(lines2[firstCodeLine])) {
27307
27427
  firstCodeLine++;
@@ -27677,12 +27797,12 @@ function updateIssueType(issueId, issueTypeId) {
27677
27797
  // src/commands/github/issue/fixStructure/writeLineNow.ts
27678
27798
  import { writeSync as writeSync2 } from "fs";
27679
27799
  function writeLineNow(line) {
27680
- const text18 = `${line}
27800
+ const text19 = `${line}
27681
27801
  `;
27682
27802
  try {
27683
- writeSync2(1, text18);
27803
+ writeSync2(1, text19);
27684
27804
  } catch {
27685
- process.stdout.write(text18);
27805
+ process.stdout.write(text19);
27686
27806
  }
27687
27807
  }
27688
27808
 
@@ -28224,13 +28344,13 @@ function validateProposedContent(labels, title, body) {
28224
28344
  }
28225
28345
 
28226
28346
  // src/commands/github/issue/reviewProposedIssueComment.ts
28227
- import { randomUUID as randomUUID13 } from "crypto";
28347
+ import { randomUUID as randomUUID14 } from "crypto";
28228
28348
  async function reviewProposedIssueComment(title, body) {
28229
28349
  const sessionId = process.env.ASSIST_SESSION_ID;
28230
28350
  if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
28231
28351
  await awaitPreviewApproval("GitHub issue comment preview", {
28232
28352
  sessionId,
28233
- requestId: randomUUID13(),
28353
+ requestId: randomUUID14(),
28234
28354
  title,
28235
28355
  body,
28236
28356
  prNumber: null,
@@ -28303,8 +28423,8 @@ function screenshotReference({ path: path109, alt }) {
28303
28423
 
28304
28424
  // src/commands/prs/renderScreenshotBlock.ts
28305
28425
  var VIDEO_EXTENSIONS = /* @__PURE__ */ new Set([".mp4", ".webm", ".mov"]);
28306
- function cell(text18) {
28307
- return text18.replaceAll("|", String.raw`\|`);
28426
+ function cell(text19) {
28427
+ return text19.replaceAll("|", String.raw`\|`);
28308
28428
  }
28309
28429
  function row(cells2) {
28310
28430
  return `| ${cells2.join(" | ")} |`;
@@ -28748,13 +28868,13 @@ function resolveCreateIssueMetadata(options2) {
28748
28868
  }
28749
28869
 
28750
28870
  // src/commands/github/issue/reviewProposedIssue.ts
28751
- import { randomUUID as randomUUID14 } from "crypto";
28871
+ import { randomUUID as randomUUID15 } from "crypto";
28752
28872
  async function reviewProposedIssue(title, body, metadata2 = []) {
28753
28873
  const sessionId = process.env.ASSIST_SESSION_ID;
28754
28874
  if (process.env.ASSIST_SESSION !== "1" || !sessionId) return void 0;
28755
28875
  return await awaitPreviewApproval("GitHub issue preview", {
28756
28876
  sessionId,
28757
- requestId: randomUUID14(),
28877
+ requestId: randomUUID15(),
28758
28878
  title,
28759
28879
  body,
28760
28880
  prNumber: null,
@@ -29054,7 +29174,7 @@ function pushUnchangedIssue(number, repo, target, fetchedAt, bodyPath) {
29054
29174
  }
29055
29175
 
29056
29176
  // src/commands/github/issue/reviewProposedIssueEdit.ts
29057
- import { randomUUID as randomUUID15 } from "crypto";
29177
+ import { randomUUID as randomUUID16 } from "crypto";
29058
29178
  async function reviewProposedIssueEdit(title, body, working) {
29059
29179
  const sessionId = process.env.ASSIST_SESSION_ID;
29060
29180
  if (process.env.ASSIST_SESSION !== "1" || !sessionId) return body;
@@ -29062,7 +29182,7 @@ async function reviewProposedIssueEdit(title, body, working) {
29062
29182
  "GitHub issue edit preview",
29063
29183
  {
29064
29184
  sessionId,
29065
- requestId: randomUUID15(),
29185
+ requestId: randomUUID16(),
29066
29186
  title,
29067
29187
  body,
29068
29188
  prNumber: null,
@@ -29505,7 +29625,7 @@ async function writeInboxLastScan(orm, at2) {
29505
29625
 
29506
29626
  // src/commands/inbox/runInboxScanClaude.ts
29507
29627
  import { spawn as spawn6 } from "child_process";
29508
- import { z as z16 } from "zod";
29628
+ import { z as z17 } from "zod";
29509
29629
 
29510
29630
  // src/commands/review/attachLineParser.ts
29511
29631
  function flushBuffer(buffer, onLine) {
@@ -29595,8 +29715,8 @@ function describeInboxScanTool(name, input) {
29595
29715
 
29596
29716
  // src/commands/inbox/assistantScanEvents.ts
29597
29717
  var MAX_TEXT = 500;
29598
- function truncate(text18) {
29599
- const trimmed = text18.trim();
29718
+ function truncate(text19) {
29719
+ const trimmed = text19.trim();
29600
29720
  return trimmed.length <= MAX_TEXT ? trimmed : `${trimmed.slice(0, MAX_TEXT - 1)}\u2026`;
29601
29721
  }
29602
29722
  function blockEvent(block) {
@@ -29686,17 +29806,17 @@ function createScanUsageTracker() {
29686
29806
  }
29687
29807
 
29688
29808
  // src/commands/inbox/inboxScanSchema.ts
29689
- import { z as z15 } from "zod";
29690
- var flaggedMessageSchema = z15.object({
29691
- source: z15.enum(["gmail", "slack"]),
29692
- messageId: z15.string().min(1),
29693
- sender: z15.string().min(1),
29694
- summary: z15.string().min(1),
29695
- link: z15.string().min(1),
29696
- receivedAt: z15.string().optional()
29809
+ import { z as z16 } from "zod";
29810
+ var flaggedMessageSchema = z16.object({
29811
+ source: z16.enum(["gmail", "slack"]),
29812
+ messageId: z16.string().min(1),
29813
+ sender: z16.string().min(1),
29814
+ summary: z16.string().min(1),
29815
+ link: z16.string().min(1),
29816
+ receivedAt: z16.string().optional()
29697
29817
  });
29698
- var inboxScanSchema = z15.object({
29699
- messages: z15.array(flaggedMessageSchema)
29818
+ var inboxScanSchema = z16.object({
29819
+ messages: z16.array(flaggedMessageSchema)
29700
29820
  });
29701
29821
 
29702
29822
  // src/commands/inbox/parseInboxScanOutput.ts
@@ -29815,7 +29935,7 @@ function buildInboxScanArgs(since) {
29815
29935
  "stream-json",
29816
29936
  "--verbose",
29817
29937
  "--json-schema",
29818
- JSON.stringify(z16.toJSONSchema(inboxScanSchema, { target: "draft-07" })),
29938
+ JSON.stringify(z17.toJSONSchema(inboxScanSchema, { target: "draft-07" })),
29819
29939
  "--",
29820
29940
  buildInboxScanPrompt(since)
29821
29941
  ];
@@ -29894,9 +30014,9 @@ import chalk185 from "chalk";
29894
30014
 
29895
30015
  // src/commands/jira/adfToText.ts
29896
30016
  function renderInline(node) {
29897
- const text18 = node.text ?? "";
29898
- if (node.marks?.some((m) => m.type === "code")) return `\`${text18}\``;
29899
- return text18;
30017
+ const text19 = node.text ?? "";
30018
+ if (node.marks?.some((m) => m.type === "code")) return `\`${text19}\``;
30019
+ return text19;
29900
30020
  }
29901
30021
  function renderChildren(node, indent4) {
29902
30022
  return renderNodes(node.content ?? [], indent4);
@@ -29938,8 +30058,8 @@ function isListNode(node) {
29938
30058
  function renderListChild(child, indent4, pad3, marker2, isFirst) {
29939
30059
  if (isListNode(child)) return renderNodes([child], indent4 + 1);
29940
30060
  if (child.type !== "paragraph") return renderNode(child, indent4);
29941
- const text18 = renderChildren(child, indent4);
29942
- return isFirst ? `${pad3}${marker2} ${text18}` : `${pad3} ${text18}`;
30061
+ const text19 = renderChildren(child, indent4);
30062
+ return isFirst ? `${pad3}${marker2} ${text19}` : `${pad3} ${text19}`;
29943
30063
  }
29944
30064
  function renderListItem(node, indent4, marker2) {
29945
30065
  const pad3 = " ".repeat(indent4);
@@ -30075,7 +30195,7 @@ function registerRefineLaunch(program, resumeFlag) {
30075
30195
  }
30076
30196
 
30077
30197
  // src/commands/fixConflict.ts
30078
- import { randomUUID as randomUUID16 } from "crypto";
30198
+ import { randomUUID as randomUUID17 } from "crypto";
30079
30199
 
30080
30200
  // src/commands/review/checkoutPr.ts
30081
30201
  import { execFileSync as execFileSync16 } from "child_process";
@@ -30271,39 +30391,39 @@ function stringOrUndefined(value) {
30271
30391
  }
30272
30392
 
30273
30393
  // src/commands/sessions/daemon/persistedSessionSchema.ts
30274
- import { z as z17 } from "zod";
30275
- var persistedSessionSchema = z17.object({
30276
- id: z17.string().optional(),
30277
- name: z17.string(),
30278
- title: z17.string().optional(),
30279
- generatedTitle: z17.string().optional(),
30280
- subtitle: z17.string().optional(),
30281
- commandType: z17.enum(["claude", "run", "assist"]),
30282
- harness: z17.enum(["claude", "codex", "pi"]).optional(),
30283
- status: z17.enum(["running", "waiting", "done", "error", "stopped"]).optional(),
30284
- cwd: z17.string(),
30285
- startedAt: z17.number(),
30286
- runningMs: z17.number().optional(),
30287
- claudeSessionId: z17.string().optional(),
30288
- harnessSessionId: z17.string().optional(),
30289
- initialPrompt: z17.string().optional(),
30290
- runName: z17.string().optional(),
30291
- runArgs: z17.array(z17.string()).optional(),
30292
- assistArgs: z17.array(z17.string()).optional(),
30394
+ import { z as z18 } from "zod";
30395
+ var persistedSessionSchema = z18.object({
30396
+ id: z18.string().optional(),
30397
+ name: z18.string(),
30398
+ title: z18.string().optional(),
30399
+ generatedTitle: z18.string().optional(),
30400
+ subtitle: z18.string().optional(),
30401
+ commandType: z18.enum(["claude", "run", "assist"]),
30402
+ harness: z18.enum(["claude", "codex", "pi"]).optional(),
30403
+ status: z18.enum(["running", "waiting", "done", "error", "stopped"]).optional(),
30404
+ cwd: z18.string(),
30405
+ startedAt: z18.number(),
30406
+ runningMs: z18.number().optional(),
30407
+ claudeSessionId: z18.string().optional(),
30408
+ harnessSessionId: z18.string().optional(),
30409
+ initialPrompt: z18.string().optional(),
30410
+ runName: z18.string().optional(),
30411
+ runArgs: z18.array(z18.string()).optional(),
30412
+ assistArgs: z18.array(z18.string()).optional(),
30293
30413
  activity: activitySchema.optional(),
30294
- starred: z17.boolean().optional(),
30295
- watcher: z17.boolean().optional(),
30296
- divergenceEscalation: z17.boolean().optional(),
30297
- design: z17.boolean().optional(),
30298
- auto: z17.boolean().optional(),
30299
- autoAdvance: z17.boolean().optional(),
30300
- autoApprove: z17.boolean().optional(),
30301
- reviewStarted: z17.boolean().optional(),
30302
- launchedFrom: z17.string().optional(),
30303
- pendingPrompts: z17.array(z17.string()).optional(),
30304
- interrupted: z17.object({ reason: z17.string(), at: z17.number() }).optional(),
30305
- awaitingSeed: z17.boolean().optional(),
30306
- undurable: z17.object({ reason: z17.string(), removesTree: z17.boolean().optional() }).optional()
30414
+ starred: z18.boolean().optional(),
30415
+ watcher: z18.boolean().optional(),
30416
+ divergenceEscalation: z18.boolean().optional(),
30417
+ design: z18.boolean().optional(),
30418
+ auto: z18.boolean().optional(),
30419
+ autoAdvance: z18.boolean().optional(),
30420
+ autoApprove: z18.boolean().optional(),
30421
+ reviewStarted: z18.boolean().optional(),
30422
+ launchedFrom: z18.string().optional(),
30423
+ pendingPrompts: z18.array(z18.string()).optional(),
30424
+ interrupted: z18.object({ reason: z18.string(), at: z18.number() }).optional(),
30425
+ awaitingSeed: z18.boolean().optional(),
30426
+ undurable: z18.object({ reason: z18.string(), removesTree: z18.boolean().optional() }).optional()
30307
30427
  });
30308
30428
 
30309
30429
  // src/commands/sessions/daemon/toPersistedSession.ts
@@ -30860,7 +30980,7 @@ function buildPrompt2(rebase) {
30860
30980
  async function fixConflict(number, options2 = {}) {
30861
30981
  const { resumeSessionId } = options2;
30862
30982
  if (number && !resumeSessionId) await checkoutPr(number);
30863
- const claudeSessionId = resumeSessionId ?? randomUUID16();
30983
+ const claudeSessionId = resumeSessionId ?? randomUUID17();
30864
30984
  emitActivity({
30865
30985
  kind: "command",
30866
30986
  name: "fix-conflict",
@@ -30888,7 +31008,7 @@ function registerFixConflict(program, resumeFlag) {
30888
31008
  }
30889
31009
 
30890
31010
  // src/commands/reviewPrComments.ts
30891
- import { randomUUID as randomUUID17 } from "crypto";
31011
+ import { randomUUID as randomUUID18 } from "crypto";
30892
31012
  function buildPrompt3(number, announce, options2) {
30893
31013
  const args = [
30894
31014
  "/review-pr-comments",
@@ -30914,7 +31034,7 @@ async function reviewPrComments(number, options2 = {}) {
30914
31034
  validateAnnounce(number, announce);
30915
31035
  validateMode(options2);
30916
31036
  if (number && !resumeSessionId) await checkoutPr(number);
30917
- const claudeSessionId = resumeSessionId ?? randomUUID17();
31037
+ const claudeSessionId = resumeSessionId ?? randomUUID18();
30918
31038
  emitActivity({
30919
31039
  kind: "command",
30920
31040
  name: "review-pr-comments",
@@ -30964,9 +31084,9 @@ function registerDescriptionLaunch(program, name, slashCommand, description, ali
30964
31084
  "[description]",
30965
31085
  `Text to forward to the /${slashCommand} slash command`
30966
31086
  ).description(description).option("--once", "Exit when the initial task completes").option("--resume-session <id>", RESUME_SESSION_FLAG).action(
30967
- (text18, opts) => launchMode(slashCommand, {
31087
+ (text19, opts) => launchMode(slashCommand, {
30968
31088
  once: opts.once,
30969
- description: text18,
31089
+ description: text19,
30970
31090
  resumeSessionId: opts.resumeSession
30971
31091
  })
30972
31092
  );
@@ -31302,7 +31422,7 @@ function applyIgnore(texts, ignore3) {
31302
31422
  const dropped = new Set(ignore3);
31303
31423
  const present = new Set(texts);
31304
31424
  return {
31305
- texts: texts.filter((text18) => !dropped.has(text18)),
31425
+ texts: texts.filter((text19) => !dropped.has(text19)),
31306
31426
  unmatched: [...new Set(ignore3)].filter((entry) => !present.has(entry))
31307
31427
  };
31308
31428
  }
@@ -31456,7 +31576,7 @@ async function offerSaveExtract(extract2, options2, paths = {}) {
31456
31576
  }
31457
31577
 
31458
31578
  // src/commands/miro/pickAnchors.ts
31459
- import { randomUUID as randomUUID18 } from "crypto";
31579
+ import { randomUUID as randomUUID19 } from "crypto";
31460
31580
 
31461
31581
  // src/commands/miro/isBox.ts
31462
31582
  var boxTypes = /* @__PURE__ */ new Set(["shape", "sticky_note"]);
@@ -31477,7 +31597,7 @@ async function pickAnchors(sessionId, items2) {
31477
31597
  "Miro anchor selection",
31478
31598
  {
31479
31599
  sessionId,
31480
- requestId: randomUUID18(),
31600
+ requestId: randomUUID19(),
31481
31601
  title: "Pick the top-left then the bottom-right box",
31482
31602
  body: encodeMiroBoardPreview(items2),
31483
31603
  prNumber: null,
@@ -31496,9 +31616,9 @@ async function pickAnchors(sessionId, items2) {
31496
31616
 
31497
31617
  // src/commands/miro/readMiroItems.ts
31498
31618
  import { readFileSync as readFileSync46 } from "fs";
31499
- function tryParse(text18) {
31619
+ function tryParse(text19) {
31500
31620
  try {
31501
- return JSON.parse(text18);
31621
+ return JSON.parse(text19);
31502
31622
  } catch {
31503
31623
  return void 0;
31504
31624
  }
@@ -32058,8 +32178,8 @@ function dedupeLinks(links2) {
32058
32178
  }
32059
32179
 
32060
32180
  // src/commands/netcap/linkifyMentions.ts
32061
- function linkifyMentions(text18, mentions) {
32062
- let out = text18;
32181
+ function linkifyMentions(text19, mentions) {
32182
+ let out = text19;
32063
32183
  for (const m of mentions) {
32064
32184
  if (m.name && out.includes(m.name)) {
32065
32185
  out = out.replace(m.name, `[${m.name}](${m.url})`);
@@ -32086,13 +32206,13 @@ function resolveAuthor(mentionMap, author) {
32086
32206
  return mentionMap.get(author) ?? { slug: author, url: profileUrl(author) };
32087
32207
  }
32088
32208
  function buildPost(raw, mentionMap, author) {
32089
- const text18 = joinText(raw.text);
32090
- if (!text18) return void 0;
32209
+ const text19 = joinText(raw.text);
32210
+ if (!text19) return void 0;
32091
32211
  const mentions = resolveMentions(raw, mentionMap, author);
32092
32212
  const relatedPosts = [...new Set(raw.related)];
32093
32213
  return {
32094
- text: text18,
32095
- markdown: linkifyMentions(text18, mentions),
32214
+ text: text19,
32215
+ markdown: linkifyMentions(text19, mentions),
32096
32216
  mentions,
32097
32217
  hashtags: [...new Set(raw.hashtags)],
32098
32218
  links: dedupeLinks(raw.links),
@@ -32233,8 +32353,8 @@ function activityUrnOf(update4) {
32233
32353
  return typeof urn === "string" ? urn : void 0;
32234
32354
  }
32235
32355
  function buildVoyagerPost(update4, profiles) {
32236
- const text18 = commentaryText(update4);
32237
- if (!text18) return void 0;
32356
+ const text19 = commentaryText(update4);
32357
+ if (!text19) return void 0;
32238
32358
  const author = resolveVoyagerAuthor(update4);
32239
32359
  const { mentions, hashtags, links: links2 } = collectVoyagerAttributes(
32240
32360
  update4,
@@ -32243,8 +32363,8 @@ function buildVoyagerPost(update4, profiles) {
32243
32363
  );
32244
32364
  const activityUrn = activityUrnOf(update4);
32245
32365
  return {
32246
- text: text18,
32247
- markdown: linkifyMentions(text18, mentions),
32366
+ text: text19,
32367
+ markdown: linkifyMentions(text19, mentions),
32248
32368
  mentions,
32249
32369
  hashtags,
32250
32370
  links: links2,
@@ -32708,13 +32828,13 @@ function postReviewComment(vars) {
32708
32828
  }
32709
32829
 
32710
32830
  // src/commands/prs/reviewProposedPrComment.ts
32711
- import { randomUUID as randomUUID19 } from "crypto";
32831
+ import { randomUUID as randomUUID20 } from "crypto";
32712
32832
  async function reviewProposedPrComment(title, body, prNumber) {
32713
32833
  const sessionId = process.env.ASSIST_SESSION_ID;
32714
32834
  if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
32715
32835
  await awaitPreviewApproval("PR comment preview", {
32716
32836
  sessionId,
32717
- requestId: randomUUID19(),
32837
+ requestId: randomUUID20(),
32718
32838
  title,
32719
32839
  body,
32720
32840
  prNumber,
@@ -33150,7 +33270,7 @@ function agentFooter(unresolvedCount) {
33150
33270
 
33151
33271
  // src/commands/prs/listComments/commentStyle.ts
33152
33272
  import chalk203 from "chalk";
33153
- var plain = (text18) => text18;
33273
+ var plain = (text19) => text19;
33154
33274
  function colouredState(state) {
33155
33275
  const label = `[${state}]`;
33156
33276
  if (state === "APPROVED") return chalk203.green(label);
@@ -33218,8 +33338,8 @@ function renderResolvedIndex(threads, style) {
33218
33338
  }
33219
33339
 
33220
33340
  // src/commands/prs/listComments/renderThreadBlock.ts
33221
- function indent2(text18) {
33222
- return text18.split("\n").map((line) => line ? ` ${line}` : line).join("\n");
33341
+ function indent2(text19) {
33342
+ return text19.split("\n").map((line) => line ? ` ${line}` : line).join("\n");
33223
33343
  }
33224
33344
  function renderThreadBlock(thread, style) {
33225
33345
  const first = thread.comments[0];
@@ -33749,7 +33869,7 @@ function parseScreenshotSpecs(specs) {
33749
33869
  }
33750
33870
 
33751
33871
  // src/commands/prs/previewAndApplyEdit.ts
33752
- import { randomUUID as randomUUID20 } from "crypto";
33872
+ import { randomUUID as randomUUID21 } from "crypto";
33753
33873
 
33754
33874
  // src/commands/prs/stageScreenshots.ts
33755
33875
  import { readFile as readFile8 } from "fs/promises";
@@ -33771,7 +33891,7 @@ function stageScreenshots(screenshots = []) {
33771
33891
  async function previewAndApplyEdit(args) {
33772
33892
  const decision = await awaitPreviewApproval("PR preview", {
33773
33893
  sessionId: args.sessionId,
33774
- requestId: randomUUID20(),
33894
+ requestId: randomUUID21(),
33775
33895
  title: args.title ?? args.currentTitle,
33776
33896
  body: args.body,
33777
33897
  prNumber: args.number,
@@ -33824,8 +33944,8 @@ function isWallOfText(lines2) {
33824
33944
  if (lines2.some(isListLine)) {
33825
33945
  return false;
33826
33946
  }
33827
- const text18 = lines2.join(" ").trim();
33828
- return text18.length > MAX_PARAGRAPH_CHARS || countSentences(text18) > MAX_PARAGRAPH_SENTENCES;
33947
+ const text19 = lines2.join(" ").trim();
33948
+ return text19.length > MAX_PARAGRAPH_CHARS || countSentences(text19) > MAX_PARAGRAPH_SENTENCES;
33829
33949
  }
33830
33950
  function countSentences(paragraph) {
33831
33951
  return paragraph.match(/[.!?]+(\s|$)/g)?.length ?? 0;
@@ -34106,7 +34226,7 @@ async function placePr(prNumber, title, body, options2, attachments = []) {
34106
34226
  }
34107
34227
 
34108
34228
  // src/commands/prs/previewAndPlace.ts
34109
- import { randomUUID as randomUUID21 } from "crypto";
34229
+ import { randomUUID as randomUUID22 } from "crypto";
34110
34230
 
34111
34231
  // src/commands/review/announcePr.ts
34112
34232
  function announcePr(prNumber) {
@@ -34182,7 +34302,7 @@ function enableAutoMerge() {
34182
34302
  async function previewAndPlace(args) {
34183
34303
  const decision = await awaitPreviewApproval("PR preview", {
34184
34304
  sessionId: args.sessionId,
34185
- requestId: randomUUID21(),
34305
+ requestId: randomUUID22(),
34186
34306
  title: args.title,
34187
34307
  body: args.body,
34188
34308
  prNumber: args.prNumber,
@@ -34462,8 +34582,8 @@ function countUnresolvedThreads(org, repo, prNumber) {
34462
34582
  }
34463
34583
 
34464
34584
  // src/commands/prs/status/describeFetchError.ts
34465
- function firstLine2(text18) {
34466
- const line = text18.split("\n").map((candidate) => candidate.trim()).find((candidate) => candidate.length > 0);
34585
+ function firstLine2(text19) {
34586
+ const line = text19.split("\n").map((candidate) => candidate.trim()).find((candidate) => candidate.length > 0);
34467
34587
  return line ?? null;
34468
34588
  }
34469
34589
  function stderrText(error) {
@@ -34783,8 +34903,8 @@ function countProseWords(line) {
34783
34903
  }
34784
34904
  return singles + countTokens(remaining);
34785
34905
  }
34786
- function countTokens(text18) {
34787
- return text18.split(/\s+/).filter((token) => /[A-Za-z0-9]/.test(token)).length;
34906
+ function countTokens(text19) {
34907
+ return text19.split(/\s+/).filter((token) => /[A-Za-z0-9]/.test(token)).length;
34788
34908
  }
34789
34909
 
34790
34910
  // src/commands/readTime/estimateReadSeconds.ts
@@ -37086,7 +37206,7 @@ function matchNamedImports(importDecl, neededNames) {
37086
37206
  }
37087
37207
  function formatNamedImports(matched, collapseToTypeOnly) {
37088
37208
  return matched.map(
37089
- ({ text: text18, isTypeOnly }) => isTypeOnly && !collapseToTypeOnly ? `type ${text18}` : text18
37209
+ ({ text: text19, isTypeOnly }) => isTypeOnly && !collapseToTypeOnly ? `type ${text19}` : text19
37090
37210
  );
37091
37211
  }
37092
37212
  function matchOptionalImport(node, neededNames) {
@@ -37164,9 +37284,9 @@ function resolveImports(target, dependencies, sourceFile, statements = []) {
37164
37284
  function extractTexts(target, allFunctions, statements) {
37165
37285
  const stmtTexts = statements.map((v) => v.getFullText().trim());
37166
37286
  const fnTexts = allFunctions.map((fn) => {
37167
- const text18 = fn.getFullText().trim();
37168
- if (fn === target && !text18.startsWith("export ")) return `export ${text18}`;
37169
- return text18;
37287
+ const text19 = fn.getFullText().trim();
37288
+ if (fn === target && !text19.startsWith("export ")) return `export ${text19}`;
37289
+ return text19;
37170
37290
  });
37171
37291
  return [...stmtTexts, ...fnTexts];
37172
37292
  }
@@ -38709,10 +38829,10 @@ function registerRefactor(program) {
38709
38829
  }
38710
38830
 
38711
38831
  // src/commands/review/checkoutPrSession.ts
38712
- import { randomUUID as randomUUID22 } from "crypto";
38832
+ import { randomUUID as randomUUID23 } from "crypto";
38713
38833
  async function checkoutPrSession(number, prompt = "") {
38714
38834
  await checkoutPr(number);
38715
- const claudeSessionId = randomUUID22();
38835
+ const claudeSessionId = randomUUID23();
38716
38836
  emitActivity({ kind: "command", name: "review", claudeSessionId });
38717
38837
  const { done: done2 } = spawnClaude(prompt, {
38718
38838
  permissionMode: "auto",
@@ -39227,8 +39347,8 @@ function shownForm(test) {
39227
39347
  );
39228
39348
  return excerptLines <= MAX_TEST_SOURCE_LINES ? { lines: excerptLines, shown: { ...rest, excerpts } } : void 0;
39229
39349
  }
39230
- function lineCount(text18) {
39231
- return text18.split("\n").length;
39350
+ function lineCount(text19) {
39351
+ return text19.split("\n").length;
39232
39352
  }
39233
39353
 
39234
39354
  // src/commands/review/highLevel/capHighLevelTestSources.ts
@@ -39307,9 +39427,9 @@ function testName(call) {
39307
39427
 
39308
39428
  // src/commands/review/highLevel/dedentedSource.ts
39309
39429
  function dedentedSource(call) {
39310
- const text18 = call.getSourceFile().getFullText();
39311
- const lineStart = text18.lastIndexOf("\n", call.getStart()) + 1;
39312
- const indent4 = /^\s*/.exec(text18.slice(lineStart, call.getStart()))?.[0] ?? "";
39430
+ const text19 = call.getSourceFile().getFullText();
39431
+ const lineStart = text19.lastIndexOf("\n", call.getStart()) + 1;
39432
+ const indent4 = /^\s*/.exec(text19.slice(lineStart, call.getStart()))?.[0] ?? "";
39313
39433
  return call.getText().split("\n").map((line) => line.startsWith(indent4) ? line.slice(indent4.length) : line).join("\n");
39314
39434
  }
39315
39435
 
@@ -39369,12 +39489,12 @@ function visit(node, context) {
39369
39489
  }
39370
39490
  ];
39371
39491
  }
39372
- function extractTestHierarchy(path109, text18, changed) {
39492
+ function extractTestHierarchy(path109, text19, changed) {
39373
39493
  const project = new Project5({
39374
39494
  useInMemoryFileSystem: true,
39375
39495
  compilerOptions: { allowJs: true }
39376
39496
  });
39377
- const source = project.createSourceFile(`/${path109}`, text18);
39497
+ const source = project.createSourceFile(`/${path109}`, text19);
39378
39498
  return collect7(source, { path: path109, ...changed ? { changed } : {} });
39379
39499
  }
39380
39500
 
@@ -39819,7 +39939,7 @@ function gatherHighLevelSubject(prNumber, force) {
39819
39939
  }
39820
39940
 
39821
39941
  // src/commands/review/highLevel/openHighLevelOverlay.ts
39822
- import { randomUUID as randomUUID24 } from "crypto";
39942
+ import { randomUUID as randomUUID25 } from "crypto";
39823
39943
 
39824
39944
  // src/commands/review/highLevel/highLevelProgress.ts
39825
39945
  function toItem2(check2, decision) {
@@ -40078,7 +40198,7 @@ function splitQueuedComments(record) {
40078
40198
  }
40079
40199
 
40080
40200
  // src/commands/review/highLevel/previewHighLevelReview.ts
40081
- import { randomUUID as randomUUID23 } from "crypto";
40201
+ import { randomUUID as randomUUID24 } from "crypto";
40082
40202
 
40083
40203
  // src/commands/review/highLevel/formatHighLevelReviewPreview.ts
40084
40204
  function formatHighLevelReviewPreview(lineLevel, body) {
@@ -40105,7 +40225,7 @@ async function previewHighLevelReview(sessionId, record, submission) {
40105
40225
  "Review",
40106
40226
  {
40107
40227
  sessionId,
40108
- requestId: randomUUID23(),
40228
+ requestId: randomUUID24(),
40109
40229
  title: `${LABELS[submission.event]} ${record.repo}#${record.prNumber}`,
40110
40230
  body: formatHighLevelReviewPreview(submission.comments, submission.body),
40111
40231
  prNumber: record.prNumber,
@@ -40156,7 +40276,7 @@ async function openHighLevelOverlay(sessionId, subject) {
40156
40276
  "High-level review",
40157
40277
  {
40158
40278
  sessionId,
40159
- requestId: randomUUID24(),
40279
+ requestId: randomUUID25(),
40160
40280
  title: `${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`,
40161
40281
  body: JSON.stringify(highLevelPreviewPayload(subject)),
40162
40282
  prNumber: subject.prNumber,
@@ -40956,9 +41076,9 @@ var MultiSpinner = class {
40956
41076
  elapsedPrefix: prefix2
40957
41077
  });
40958
41078
  }
40959
- failRemaining(text18) {
41079
+ failRemaining(text19) {
40960
41080
  for (const entry of this.entries) {
40961
- if (entry.state === "running") this.resolve(entry, "failed", text18);
41081
+ if (entry.state === "running") this.resolve(entry, "failed", text19);
40962
41082
  }
40963
41083
  }
40964
41084
  add(entry) {
@@ -40971,14 +41091,14 @@ var MultiSpinner = class {
40971
41091
  set text(value) {
40972
41092
  entry.text = value;
40973
41093
  },
40974
- succeed: (text18) => this.resolve(entry, "succeeded", text18),
40975
- fail: (text18) => this.resolve(entry, "failed", text18)
41094
+ succeed: (text19) => this.resolve(entry, "succeeded", text19),
41095
+ fail: (text19) => this.resolve(entry, "failed", text19)
40976
41096
  };
40977
41097
  }
40978
- resolve(entry, state, text18) {
41098
+ resolve(entry, state, text19) {
40979
41099
  if (entry.state !== "running") return;
40980
41100
  entry.state = state;
40981
- if (text18 !== void 0) entry.text = text18;
41101
+ if (text19 !== void 0) entry.text = text19;
40982
41102
  entry.elapsedStart = void 0;
40983
41103
  appendReviewLog(renderEntry(entry, 0));
40984
41104
  this.render();
@@ -41319,12 +41439,12 @@ function attachStdoutTail(child, maxBytes = 8192) {
41319
41439
  // src/commands/review/formatReviewerFailure.ts
41320
41440
  var FAST_FAIL_MS = 1e3;
41321
41441
  var STDOUT_TAIL_LINES = 20;
41322
- function indent3(text18) {
41323
- return text18.split(/\r?\n/).map((line) => ` ${line}`);
41442
+ function indent3(text19) {
41443
+ return text19.split(/\r?\n/).map((line) => ` ${line}`);
41324
41444
  }
41325
- function tailLines(text18, maxLines) {
41326
- const lines2 = text18.split(/\r?\n/);
41327
- return lines2.length <= maxLines ? text18 : lines2.slice(-maxLines).join("\n");
41445
+ function tailLines(text19, maxLines) {
41446
+ const lines2 = text19.split(/\r?\n/);
41447
+ return lines2.length <= maxLines ? text19 : lines2.slice(-maxLines).join("\n");
41328
41448
  }
41329
41449
  function isFastFail(input) {
41330
41450
  return input.exitCode !== 0 && input.elapsedMs !== void 0 && input.elapsedMs < FAST_FAIL_MS;
@@ -42899,8 +43019,8 @@ import path90 from "path";
42899
43019
  import chalk261 from "chalk";
42900
43020
 
42901
43021
  // src/commands/rules/insertRuleBullet.ts
42902
- function ruleBullet({ code, title, text: text18 }) {
42903
- return title ? `- **${code}** \u2014 **${title}** \u2014 ${text18}` : `- **${code}** \u2014 ${text18}`;
43022
+ function ruleBullet({ code, title, text: text19 }) {
43023
+ return title ? `- **${code}** \u2014 **${title}** \u2014 ${text19}` : `- **${code}** \u2014 ${text19}`;
42904
43024
  }
42905
43025
  function insertRuleBullet(content, rule) {
42906
43026
  const bullet = ruleBullet(rule);
@@ -42952,8 +43072,8 @@ function resolveRuleScope(target) {
42952
43072
  function read2(file) {
42953
43073
  return existsSync73(file) ? readFileSync59(file, "utf8") : "";
42954
43074
  }
42955
- function addRule(text18, options2) {
42956
- const rule = text18.trim();
43075
+ function addRule(text19, options2) {
43076
+ const rule = text19.trim();
42957
43077
  if (rule === "") {
42958
43078
  console.error(chalk261.red("Rule text is required"));
42959
43079
  process.exitCode = 1;
@@ -43015,10 +43135,10 @@ function addToUserNode(rule, globalConfigPath) {
43015
43135
  `Added ${chalk262.cyan(rule.title)} to advice.rules in user (node) (${globalConfigFileLabel(globalConfigPath)})`
43016
43136
  );
43017
43137
  }
43018
- async function addUserRule(text18, options2, globalConfigPath = getGlobalConfigPath()) {
43138
+ async function addUserRule(text19, options2, globalConfigPath = getGlobalConfigPath()) {
43019
43139
  const error = optionsError(options2);
43020
43140
  if (error) return fail9(error);
43021
- const rule = { title: options2.title?.trim() ?? "", text: text18.trim() };
43141
+ const rule = { title: options2.title?.trim() ?? "", text: text19.trim() };
43022
43142
  if (rule.text === "" || rule.title === "")
43023
43143
  return fail9("User rules need both rule text and --title");
43024
43144
  if (options2.user) return addToUserDb(rule);
@@ -43043,7 +43163,7 @@ function registerRulesAdd(rulesCommand) {
43043
43163
  "--node",
43044
43164
  "As --user, but append to advice.rules in user (node), this node's ~/.assist.yml"
43045
43165
  ).action(
43046
- (text18, options2) => options2.user || options2.node ? addUserRule(text18, options2) : addRule(text18, options2)
43166
+ (text19, options2) => options2.user || options2.node ? addUserRule(text19, options2) : addRule(text19, options2)
43047
43167
  ),
43048
43168
  "/add-rule and /fix-rules"
43049
43169
  );
@@ -43395,7 +43515,7 @@ function registerSeq(program) {
43395
43515
  }
43396
43516
 
43397
43517
  // src/commands/show.ts
43398
- import { randomUUID as randomUUID25 } from "crypto";
43518
+ import { randomUUID as randomUUID26 } from "crypto";
43399
43519
 
43400
43520
  // src/commands/sessions/shared/sendShowPreview.ts
43401
43521
  async function sendShowPreview(request) {
@@ -43441,8 +43561,8 @@ var NOT_BEFORE_RELATIVE = String.raw`(?<=^|[^\w.\-/~]|(?:^|[^\w.\-/~])\./)`;
43441
43561
  function normalise(path109) {
43442
43562
  return path109.replaceAll("\\", "/").replace(/\/+$/, "");
43443
43563
  }
43444
- function escapeRegExp2(text18) {
43445
- return text18.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
43564
+ function escapeRegExp2(text19) {
43565
+ return text19.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
43446
43566
  }
43447
43567
  function within(path109, dir) {
43448
43568
  return dir && path109.startsWith(`${dir}/`) ? path109.slice(dir.length + 1) : void 0;
@@ -43466,9 +43586,9 @@ function referencePatterns(path109, { home, cwd }) {
43466
43586
  return patterns;
43467
43587
  }
43468
43588
  function findShownSessionFiles(body, writtenPaths, locations) {
43469
- const text18 = body.replaceAll("\\", "/");
43589
+ const text19 = body.replaceAll("\\", "/");
43470
43590
  return writtenPaths.filter(
43471
- (path109) => referencePatterns(path109, locations).some((pattern2) => pattern2.test(text18))
43591
+ (path109) => referencePatterns(path109, locations).some((pattern2) => pattern2.test(text19))
43472
43592
  );
43473
43593
  }
43474
43594
 
@@ -43499,14 +43619,14 @@ function writtenFilePaths(entry) {
43499
43619
 
43500
43620
  // src/commands/show/sessionWrittenPaths.ts
43501
43621
  function sessionWrittenPaths(transcriptPath2) {
43502
- let text18;
43622
+ let text19;
43503
43623
  try {
43504
- text18 = readFileSync60(transcriptPath2, "utf8");
43624
+ text19 = readFileSync60(transcriptPath2, "utf8");
43505
43625
  } catch {
43506
43626
  return [];
43507
43627
  }
43508
43628
  const paths = /* @__PURE__ */ new Set();
43509
- for (const line of text18.split("\n")) {
43629
+ for (const line of text19.split("\n")) {
43510
43630
  if (!line.includes('"tool_use"')) continue;
43511
43631
  try {
43512
43632
  for (const path109 of writtenFilePaths(JSON.parse(line))) paths.add(path109);
@@ -43554,7 +43674,7 @@ async function show3(options2) {
43554
43674
  try {
43555
43675
  await sendShowPreview({
43556
43676
  sessionId,
43557
- requestId: randomUUID25(),
43677
+ requestId: randomUUID26(),
43558
43678
  title: options2.title ?? "Show",
43559
43679
  body
43560
43680
  });
@@ -43640,7 +43760,7 @@ function readSlackParts(files) {
43640
43760
  }
43641
43761
 
43642
43762
  // src/commands/slack/reviewProposedSlackMessage.ts
43643
- import { randomUUID as randomUUID26 } from "crypto";
43763
+ import { randomUUID as randomUUID27 } from "crypto";
43644
43764
  async function reviewProposedSlackMessage(target, body, workingPath) {
43645
43765
  const sessionId = process.env.ASSIST_SESSION_ID;
43646
43766
  if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
@@ -43650,7 +43770,7 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
43650
43770
  part ? `Slack message ${part.index} of ${part.total}` : "Slack message preview",
43651
43771
  {
43652
43772
  sessionId,
43653
- requestId: randomUUID26(),
43773
+ requestId: randomUUID27(),
43654
43774
  title: part ? `${destination} (${part.index}/${part.total})` : destination,
43655
43775
  body,
43656
43776
  prNumber: null,
@@ -44507,8 +44627,8 @@ function formatClock(ms) {
44507
44627
  }
44508
44628
 
44509
44629
  // src/commands/transcript/cleanText.ts
44510
- function cleanText(text18) {
44511
- const words = text18.split(/\s+/);
44630
+ function cleanText(text19) {
44631
+ const words = text19.split(/\s+/);
44512
44632
  const cleaned = [];
44513
44633
  for (let i = 0; i < words.length; i++) {
44514
44634
  let isRepeat = false;
@@ -44528,8 +44648,8 @@ function cleanText(text18) {
44528
44648
  }
44529
44649
 
44530
44650
  // src/commands/transcript/convert/parseVtt/deduplicateCues/removeSubstringDuplicates.ts
44531
- function normalizeText(text18) {
44532
- return text18.toLowerCase().trim();
44651
+ function normalizeText(text19) {
44652
+ return text19.toLowerCase().trim();
44533
44653
  }
44534
44654
  function checkSubstringRelation(textI, textJ) {
44535
44655
  if (textI.includes(textJ) && textI.length > textJ.length)
@@ -44635,8 +44755,8 @@ function parseTimestamp(ts10) {
44635
44755
  }
44636
44756
  function extractSpeaker(fullText) {
44637
44757
  const match = fullText.match(/^<v\s+([^>]+)>/);
44638
- const text18 = fullText.replace(/<v\s+[^>]+>|<\/v>/g, "").trim();
44639
- return { speaker: match ? match[1] : null, text: text18 };
44758
+ const text19 = fullText.replace(/<v\s+[^>]+>|<\/v>/g, "").trim();
44759
+ return { speaker: match ? match[1] : null, text: text19 };
44640
44760
  }
44641
44761
  function isTextLine(line) {
44642
44762
  return !!line.trim() && !line.includes("-->");
@@ -44655,13 +44775,13 @@ function parseTimestampLine(line) {
44655
44775
  return { startMs: parseTimestamp(startStr), endMs: parseTimestamp(endStr) };
44656
44776
  }
44657
44777
  function buildCue(startMs, endMs, fullText) {
44658
- const { speaker, text: text18 } = extractSpeaker(fullText);
44659
- return text18 ? { startMs, endMs, speaker, text: text18 } : null;
44778
+ const { speaker, text: text19 } = extractSpeaker(fullText);
44779
+ return text19 ? { startMs, endMs, speaker, text: text19 } : null;
44660
44780
  }
44661
44781
  function parseCueLine(lines2, i) {
44662
44782
  const { startMs, endMs } = parseTimestampLine(lines2[i]);
44663
- const { text: text18, nextIndex: nextIndex2 } = collectTextLines(lines2, i + 1);
44664
- return { cue: buildCue(startMs, endMs, text18), nextIndex: nextIndex2 };
44783
+ const { text: text19, nextIndex: nextIndex2 } = collectTextLines(lines2, i + 1);
44784
+ return { cue: buildCue(startMs, endMs, text19), nextIndex: nextIndex2 };
44665
44785
  }
44666
44786
  function isCueSeparator(line) {
44667
44787
  return line.trim().includes("-->");
@@ -44712,9 +44832,9 @@ function formatChatLog(messages, options2 = {}) {
44712
44832
  // src/commands/transcript/convert/formatVtt.ts
44713
44833
  function formatCue(cue) {
44714
44834
  const timing = `${formatTimestamp2(cue.startMs)} --> ${formatTimestamp2(cue.endMs)}`;
44715
- const text18 = cue.speaker ? `<v ${cue.speaker}>${cue.text}` : cue.text;
44835
+ const text19 = cue.speaker ? `<v ${cue.speaker}>${cue.text}` : cue.text;
44716
44836
  return `${timing}
44717
- ${text18}`;
44837
+ ${text19}`;
44718
44838
  }
44719
44839
  function formatNoteBlock(lines2) {
44720
44840
  return lines2.length ? [lines2.map((line) => `NOTE ${line}`).join("\n")] : [];
@@ -45014,28 +45134,28 @@ function selectPassages(sources, selection) {
45014
45134
  }
45015
45135
 
45016
45136
  // src/commands/transcript/selectionSchema.ts
45017
- import { z as z18 } from "zod";
45018
- var selectionSchema = z18.strictObject({
45019
- keep: z18.array(
45020
- z18.strictObject({
45021
- file: z18.string().trim().min(1, "file is required"),
45022
- from: z18.string().trim().min(1, "from is required"),
45023
- to: z18.string().trim().min(1, "to is required")
45137
+ import { z as z19 } from "zod";
45138
+ var selectionSchema = z19.strictObject({
45139
+ keep: z19.array(
45140
+ z19.strictObject({
45141
+ file: z19.string().trim().min(1, "file is required"),
45142
+ from: z19.string().trim().min(1, "from is required"),
45143
+ to: z19.string().trim().min(1, "to is required")
45024
45144
  })
45025
45145
  ).min(1, "a selection needs at least one keep range"),
45026
- removed: z18.array(z18.string().trim().min(1)).default([])
45146
+ removed: z19.array(z19.string().trim().min(1)).default([])
45027
45147
  });
45028
45148
 
45029
45149
  // src/commands/transcript/widenAudienceInText.ts
45030
45150
  var INTERJECTION = /(?<=^|["',;:.!?—–…])\s*(?:oh,?\s+)?(?:fucking hell|bloody hell|fucking|fuck|shit)(?:\s*[.!?,…]+|\s*$)/gi;
45031
45151
  var WH_EMPHASIS = /\b(whatever|whoever|wherever|whenever|however|what|who|whom|where|when|why|how|which)\s+the\s+(?:fuck|hell|heck)\b/gi;
45032
45152
  var INTENSIFIER = /\b(?:fucking|fuckin'?|(?:god)?damn(?:ed)?)\s+(?=[a-z0-9])(?!(?:it|if|around|about|with|up|off|over|out)\b)/gi;
45033
- function tidy(text18) {
45034
- return text18.replace(/\s+/g, " ").replace(/\s+([,.;:!?])/g, "$1").replace(/,(?=\s*[.!?])/g, "").replace(/^[\s,;:]+/, "").replace(/[\s,;:]+$/, "");
45153
+ function tidy(text19) {
45154
+ return text19.replace(/\s+/g, " ").replace(/\s+([,.;:!?])/g, "$1").replace(/,(?=\s*[.!?])/g, "").replace(/^[\s,;:]+/, "").replace(/[\s,;:]+$/, "");
45035
45155
  }
45036
- function widenAudienceInText(text18) {
45037
- const stripped = text18.replace(INTERJECTION, " ").replace(WH_EMPHASIS, "$1").replace(INTENSIFIER, "");
45038
- return stripped === text18 ? text18 : tidy(stripped);
45156
+ function widenAudienceInText(text19) {
45157
+ const stripped = text19.replace(INTERJECTION, " ").replace(WH_EMPHASIS, "$1").replace(INTENSIFIER, "");
45158
+ return stripped === text19 ? text19 : tidy(stripped);
45039
45159
  }
45040
45160
 
45041
45161
  // src/commands/transcript/widenAudience.ts
@@ -45215,8 +45335,8 @@ function isBicepFile(filePath) {
45215
45335
  }
45216
45336
 
45217
45337
  // src/commands/verify/blockCodeComments/collectBicepComments.ts
45218
- function blankNonNewline3(text18) {
45219
- return text18.replace(/[^\n]/g, " ");
45338
+ function blankNonNewline3(text19) {
45339
+ return text19.replace(/[^\n]/g, " ");
45220
45340
  }
45221
45341
  var STRING_LITERAL = /'''[\s\S]*?'''|'(?:[^'\\]|\\.)*'/g;
45222
45342
  var BLOCK_COMMENT = /\/\*[\s\S]*?\*[/]/g;
@@ -45268,8 +45388,8 @@ function collectCsharpComments(content) {
45268
45388
  }
45269
45389
 
45270
45390
  // src/commands/verify/blockCodeComments/collectHashComments.ts
45271
- function blankNonNewline4(text18) {
45272
- return text18.replace(/[^\n]/g, " ");
45391
+ function blankNonNewline4(text19) {
45392
+ return text19.replace(/[^\n]/g, " ");
45273
45393
  }
45274
45394
  function isHeaderLine2(line) {
45275
45395
  const trimmed = line.trim();
@@ -45314,17 +45434,17 @@ function collectComments(sourceFile) {
45314
45434
  }
45315
45435
 
45316
45436
  // src/commands/verify/blockCodeComments/collectSourceFindings.ts
45317
- function toSingleLine(text18) {
45318
- return text18.replace(/\s+/g, " ").trim();
45437
+ function toSingleLine(text19) {
45438
+ return text19.replace(/\s+/g, " ").trim();
45319
45439
  }
45320
45440
  function collectSourceFindings(file, lines2, project) {
45321
45441
  const findings = [];
45322
45442
  const sourceFile = project.addSourceFileAtPath(file);
45323
- for (const { pos, text: text18 } of collectComments(sourceFile)) {
45443
+ for (const { pos, text: text19 } of collectComments(sourceFile)) {
45324
45444
  const { line } = sourceFile.getLineAndColumnAtPos(pos);
45325
45445
  if (!lines2.has(line)) continue;
45326
- if (isCommentExempt(text18)) continue;
45327
- findings.push({ file, line, text: toSingleLine(text18) });
45446
+ if (isCommentExempt(text19)) continue;
45447
+ findings.push({ file, line, text: toSingleLine(text19) });
45328
45448
  }
45329
45449
  return findings;
45330
45450
  }
@@ -45344,10 +45464,10 @@ function collectYamlComments(content) {
45344
45464
  // src/commands/verify/blockCodeComments/toFindings.ts
45345
45465
  function toFindings(file, lines2, raw, exempt) {
45346
45466
  const findings = [];
45347
- for (const { line, text: text18 } of raw) {
45467
+ for (const { line, text: text19 } of raw) {
45348
45468
  if (!lines2.has(line)) continue;
45349
- if (exempt && isCommentExempt(text18)) continue;
45350
- findings.push({ file, line, text: text18.replace(/\s+/g, " ").trim() });
45469
+ if (exempt && isCommentExempt(text19)) continue;
45470
+ findings.push({ file, line, text: text19.replace(/\s+/g, " ").trim() });
45351
45471
  }
45352
45472
  return findings;
45353
45473
  }
@@ -45465,8 +45585,8 @@ function blockCodeComments() {
45465
45585
  process.exit(0);
45466
45586
  }
45467
45587
  console.log("Comments on changed lines:\n");
45468
- for (const { file, line, text: text18 } of findings) {
45469
- console.log(`${file}:${line} \u2192 ${text18}`);
45588
+ for (const { file, line, text: text19 } of findings) {
45589
+ console.log(`${file}:${line} \u2192 ${text19}`);
45470
45590
  }
45471
45591
  console.log(`
45472
45592
  Total: ${findings.length} comment(s)`);
@@ -46008,7 +46128,7 @@ function readRecentCommits(count10 = 10, cwd) {
46008
46128
  }
46009
46129
 
46010
46130
  // src/commands/watch/renderWatchReport.ts
46011
- var escapeCell = (text18) => text18.replaceAll("|", String.raw`\|`);
46131
+ var escapeCell = (text19) => text19.replaceAll("|", String.raw`\|`);
46012
46132
  function renderWatchReport({
46013
46133
  version: version2,
46014
46134
  commits: commits2,
@@ -46153,8 +46273,8 @@ function markSyncPending(from) {
46153
46273
  function gitFailureReason(error) {
46154
46274
  const streams = error;
46155
46275
  for (const stream of [streams?.stderr, streams?.stdout]) {
46156
- const text18 = stream == null ? "" : String(stream).trim();
46157
- if (text18) return text18;
46276
+ const text19 = stream == null ? "" : String(stream).trim();
46277
+ if (text19) return text19;
46158
46278
  }
46159
46279
  const message3 = error instanceof Error ? error.message : String(error);
46160
46280
  return message3.trim() || "git failed without reporting a reason";
@@ -47848,9 +47968,9 @@ async function refreshRepoConfigCacheOnStart() {
47848
47968
  }
47849
47969
 
47850
47970
  // src/commands/sessions/daemon/loadActiveSelection.ts
47851
- import { z as z19 } from "zod";
47971
+ import { z as z20 } from "zod";
47852
47972
  var ACTIVE_FILE = "active.json";
47853
- var activeSelectionSchema = z19.record(z19.string(), z19.string());
47973
+ var activeSelectionSchema = z20.record(z20.string(), z20.string());
47854
47974
  function loadActiveSelection() {
47855
47975
  const parsed = activeSelectionSchema.safeParse(
47856
47976
  loadJson(ACTIVE_FILE)
@@ -48076,9 +48196,9 @@ function latest(current, at2) {
48076
48196
  return current === void 0 || at2 > current ? at2 : current;
48077
48197
  }
48078
48198
  async function lastWriteTimes(transcriptPath2, target) {
48079
- const text18 = await readFile9(transcriptPath2, "utf8").catch(() => "");
48199
+ const text19 = await readFile9(transcriptPath2, "utf8").catch(() => "");
48080
48200
  const result = {};
48081
- for (const line of text18.split("\n")) {
48201
+ for (const line of text19.split("\n")) {
48082
48202
  if (!line.includes('"tool_use"')) continue;
48083
48203
  let entry;
48084
48204
  try {
@@ -48313,14 +48433,14 @@ var ESC3 = String.fromCharCode(27);
48313
48433
  var PASTE_START = `${ESC3}[200~`;
48314
48434
  var PASTE_END = `${ESC3}[201~`;
48315
48435
  var SUBMIT = "\r";
48316
- function bracketedPaste(text18) {
48317
- return `${PASTE_START}${text18.replace(/\r?\n/g, SUBMIT)}${PASTE_END}`;
48436
+ function bracketedPaste(text19) {
48437
+ return `${PASTE_START}${text19.replace(/\r?\n/g, SUBMIT)}${PASTE_END}`;
48318
48438
  }
48319
48439
 
48320
48440
  // src/commands/sessions/shared/pasteAndSubmit.ts
48321
48441
  var SUBMIT_DELAY_MS = 150;
48322
- function pasteAndSubmit(sendInput, sessionId, text18) {
48323
- sendInput(sessionId, bracketedPaste(text18));
48442
+ function pasteAndSubmit(sendInput, sessionId, text19) {
48443
+ sendInput(sessionId, bracketedPaste(text19));
48324
48444
  setTimeout(() => sendInput(sessionId, SUBMIT), SUBMIT_DELAY_MS);
48325
48445
  }
48326
48446
 
@@ -48329,30 +48449,30 @@ function flushPendingPrompts(session, write2) {
48329
48449
  if (!session?.pendingPrompts?.length || session.permissionActive)
48330
48450
  return false;
48331
48451
  if (session.status === "done" || !session.pty) return false;
48332
- const text18 = session.pendingPrompts.join("\n\n");
48452
+ const text19 = session.pendingPrompts.join("\n\n");
48333
48453
  daemonLog(
48334
48454
  `session ${session.id} typed ${session.pendingPrompts.length} queued prompt(s)`
48335
48455
  );
48336
48456
  session.pendingPrompts = void 0;
48337
- pasteAndSubmit(write2, session.id, text18);
48457
+ pasteAndSubmit(write2, session.id, text19);
48338
48458
  return true;
48339
48459
  }
48340
48460
 
48341
48461
  // src/commands/sessions/daemon/typePromptIntoSession.ts
48342
- function typePromptIntoSession(sessions, id, text18, write2) {
48462
+ function typePromptIntoSession(sessions, id, text19, write2) {
48343
48463
  const session = sessions.get(id);
48344
48464
  if (!session) return { refused: `assist session ${id} was not found` };
48345
48465
  if (session.status === "done" || !session.pty)
48346
48466
  return { refused: `assist session ${id} has ended` };
48347
48467
  if (session.permissionActive) {
48348
- session.pendingPrompts = [...session.pendingPrompts ?? [], text18];
48468
+ session.pendingPrompts = [...session.pendingPrompts ?? [], text19];
48349
48469
  daemonLog(
48350
- `session ${id} queued prompt behind open permission prompt: ${JSON.stringify(text18)}`
48470
+ `session ${id} queued prompt behind open permission prompt: ${JSON.stringify(text19)}`
48351
48471
  );
48352
48472
  return { queued: true };
48353
48473
  }
48354
- pasteAndSubmit(write2, id, text18);
48355
- daemonLog(`session ${id} typed prompt: ${JSON.stringify(text18)}`);
48474
+ pasteAndSubmit(write2, id, text19);
48475
+ daemonLog(`session ${id} typed prompt: ${JSON.stringify(text19)}`);
48356
48476
  return { queued: false };
48357
48477
  }
48358
48478
 
@@ -48599,24 +48719,24 @@ var SessionIo = class {
48599
48719
  onClaim: this.notify
48600
48720
  });
48601
48721
  }
48602
- typePrompt(id, text18) {
48722
+ typePrompt(id, text19) {
48603
48723
  const result = typePromptIntoSession(
48604
48724
  this.sessions,
48605
48725
  id,
48606
- text18,
48726
+ text19,
48607
48727
  this.writeAsDaemon
48608
48728
  );
48609
48729
  if ("queued" in result && result.queued) this.notify();
48610
48730
  return typePromptReply(id, result);
48611
48731
  }
48612
- async typePromptToLastWriter(target, text18) {
48732
+ async typePromptToLastWriter(target, text19) {
48613
48733
  const id = await findDocsSession(this.sessions, target);
48614
48734
  if (!id)
48615
48735
  return {
48616
48736
  ok: false,
48617
48737
  message: `No live Claude session shares a directory with the server for ${target.file} or has written anything in ${target.within}`
48618
48738
  };
48619
- return this.typePrompt(id, text18);
48739
+ return this.typePrompt(id, text19);
48620
48740
  }
48621
48741
  flushPendingPrompts(id) {
48622
48742
  if (flushPendingPrompts(this.sessions.get(id), this.writeAsDaemon))
@@ -48751,7 +48871,7 @@ var ClientHub = class extends Set {
48751
48871
  };
48752
48872
 
48753
48873
  // src/commands/sessions/daemon/createSession.ts
48754
- import { randomUUID as randomUUID27 } from "crypto";
48874
+ import { randomUUID as randomUUID28 } from "crypto";
48755
48875
 
48756
48876
  // src/commands/sessions/daemon/sessionBase.ts
48757
48877
  function sessionBase(id, status2) {
@@ -48974,7 +49094,7 @@ function spawnRun(opts) {
48974
49094
  function createSession(id, { prompt, cwd, design, auto, harness, holdPty } = {}) {
48975
49095
  if (harness && harness !== "claude")
48976
49096
  return createHarnessSession(id, harness, prompt, cwd, holdPty);
48977
- const claudeSessionId = randomUUID27();
49097
+ const claudeSessionId = randomUUID28();
48978
49098
  return {
48979
49099
  ...sessionBase(id, prompt ? "running" : "waiting"),
48980
49100
  name: `Session ${id}`,
@@ -49115,9 +49235,9 @@ async function holdForEscalation(sessionId, deps2) {
49115
49235
  var OUTPUT_TAIL = 16 * 1024;
49116
49236
  async function runLapCapturingTail(deps2) {
49117
49237
  let tail = "";
49118
- const end = await deps2.runLap((text18) => {
49119
- tail = (tail + text18).slice(-OUTPUT_TAIL);
49120
- deps2.record(text18);
49238
+ const end = await deps2.runLap((text19) => {
49239
+ tail = (tail + text19).slice(-OUTPUT_TAIL);
49240
+ deps2.record(text19);
49121
49241
  });
49122
49242
  return { end, tail };
49123
49243
  }
@@ -49419,8 +49539,8 @@ function escalateDivergence(ctx, cwd, output) {
49419
49539
  // src/commands/sessions/daemon/autoUpdate/lineRecorder.ts
49420
49540
  function lineRecorder(onLine) {
49421
49541
  let pending = "";
49422
- return (text18) => {
49423
- const lines2 = (pending + text18).split(/\r?\n|\r/);
49542
+ return (text19) => {
49543
+ const lines2 = (pending + text19).split(/\r?\n|\r/);
49424
49544
  pending = lines2.pop() ?? "";
49425
49545
  for (const line of lines2) {
49426
49546
  const clean2 = stripAnsi(line).trimEnd();
@@ -49430,16 +49550,16 @@ function lineRecorder(onLine) {
49430
49550
  }
49431
49551
 
49432
49552
  // src/commands/sessions/daemon/watcherNote.ts
49433
- function watcherNote(text18) {
49553
+ function watcherNote(text19) {
49434
49554
  return `\r
49435
- \x1B[2m\u2500\u2500 ${text18} \u2500\u2500\x1B[0m\r
49555
+ \x1B[2m\u2500\u2500 ${text19} \u2500\u2500\x1B[0m\r
49436
49556
  `;
49437
49557
  }
49438
49558
 
49439
49559
  // src/commands/sessions/daemon/autoUpdate/noteAutoUpdate.ts
49440
- function noteAutoUpdate(installDir, text18) {
49441
- appendWatcherLog(installDir, watcherNote(text18));
49442
- daemonLog(`auto-update: ${text18}`);
49560
+ function noteAutoUpdate(installDir, text19) {
49561
+ appendWatcherLog(installDir, watcherNote(text19));
49562
+ daemonLog(`auto-update: ${text19}`);
49443
49563
  }
49444
49564
 
49445
49565
  // src/commands/sessions/daemon/autoUpdate/runUpdateLap.ts
@@ -49488,11 +49608,11 @@ function loopDeps(installDir, ctx) {
49488
49608
  const logLine = lineRecorder((line) => daemonLog(`auto-update: ${line}`));
49489
49609
  return {
49490
49610
  runLap: (onOutput) => runUpdateLap(installDir, onOutput),
49491
- record: (text18) => {
49492
- appendWatcherLog(installDir, text18);
49493
- logLine(text18);
49611
+ record: (text19) => {
49612
+ appendWatcherLog(installDir, text19);
49613
+ logLine(text19);
49494
49614
  },
49495
- note: (text18) => noteAutoUpdate(installDir, text18),
49615
+ note: (text19) => noteAutoUpdate(installDir, text19),
49496
49616
  enter: autoUpdateState.enter,
49497
49617
  liveEscalation: () => liveEscalationIn(ctx().sessions, clone)?.id,
49498
49618
  escalate: (output) => escalateDivergence(ctx(), installDir, output),
@@ -49777,14 +49897,14 @@ function reportUndeliveredPrompts(session, why) {
49777
49897
  const pending = session.pendingPrompts;
49778
49898
  if (!pending?.length) return;
49779
49899
  session.pendingPrompts = void 0;
49780
- for (const text18 of pending) {
49900
+ for (const text19 of pending) {
49781
49901
  daemonLog(
49782
- `session ${session.id} ${why}; queued prompt undelivered: ${JSON.stringify(text18)}`
49902
+ `session ${session.id} ${why}; queued prompt undelivered: ${JSON.stringify(text19)}`
49783
49903
  );
49784
49904
  recordPromptJournal({
49785
49905
  event: "undelivered",
49786
49906
  sessionId: session.id,
49787
- text: text18,
49907
+ text: text19,
49788
49908
  message: why
49789
49909
  });
49790
49910
  }
@@ -50242,12 +50362,12 @@ function parsePreviewMetadata(value) {
50242
50362
  const items2 = value.flatMap((entry) => {
50243
50363
  const {
50244
50364
  label,
50245
- value: text18,
50365
+ value: text19,
50246
50366
  url
50247
50367
  } = entry ?? {};
50248
- if (typeof label !== "string" || typeof text18 !== "string") return [];
50368
+ if (typeof label !== "string" || typeof text19 !== "string") return [];
50249
50369
  return [
50250
- typeof url === "string" ? { label, value: text18, url } : { label, value: text18 }
50370
+ typeof url === "string" ? { label, value: text19, url } : { label, value: text19 }
50251
50371
  ];
50252
50372
  });
50253
50373
  return items2.length > 0 ? items2 : void 0;
@@ -50283,7 +50403,8 @@ var PREVIEW_KINDS = [
50283
50403
  "high-level-review",
50284
50404
  "show",
50285
50405
  "ask",
50286
- "question"
50406
+ "question",
50407
+ "check"
50287
50408
  ];
50288
50409
  function isPreviewKind(value) {
50289
50410
  return PREVIEW_KINDS.includes(value);
@@ -50301,6 +50422,7 @@ function previewTargetLabel(kind, itemType, prNumber, draft) {
50301
50422
  if (kind === "show") return "show";
50302
50423
  if (kind === "ask") return "ask";
50303
50424
  if (kind === "question") return "question";
50425
+ if (kind === "check") return "check";
50304
50426
  if (kind === "backlog-item") return `backlog ${itemType}`;
50305
50427
  if (prNumber !== null) return `edit #${prNumber}`;
50306
50428
  return draft ? "create draft" : "create";
@@ -50475,12 +50597,12 @@ function sessionTitlePrompt(session) {
50475
50597
  }
50476
50598
  function assistPromptArg(args) {
50477
50599
  const rest = args?.slice(1).filter((a) => !a.startsWith("--"));
50478
- const text18 = rest?.[rest.length - 1]?.trim();
50479
- if (!text18 || isBacklogItemId(text18)) return void 0;
50480
- return text18;
50600
+ const text19 = rest?.[rest.length - 1]?.trim();
50601
+ if (!text19 || isBacklogItemId(text19)) return void 0;
50602
+ return text19;
50481
50603
  }
50482
- function isBacklogItemId(text18) {
50483
- return /^\d+$/.test(text18);
50604
+ function isBacklogItemId(text19) {
50605
+ return /^\d+$/.test(text19);
50484
50606
  }
50485
50607
 
50486
50608
  // src/commands/sessions/daemon/generateSessionTitle.ts
@@ -50517,9 +50639,9 @@ function buildPrompt5(prompt) {
50517
50639
  }
50518
50640
 
50519
50641
  // src/commands/sessions/shared/loadSessionTitles.ts
50520
- import { z as z20 } from "zod";
50642
+ import { z as z21 } from "zod";
50521
50643
  var TITLES_FILE = "session-titles.json";
50522
- var sessionTitlesSchema = z20.record(z20.string(), z20.string());
50644
+ var sessionTitlesSchema = z21.record(z21.string(), z21.string());
50523
50645
  function loadSessionTitles() {
50524
50646
  const parsed = sessionTitlesSchema.safeParse(
50525
50647
  loadJson(TITLES_FILE)
@@ -51012,9 +51134,9 @@ function normalizeUser(entry) {
51012
51134
  function asRecord2(value) {
51013
51135
  return value && typeof value === "object" ? value : null;
51014
51136
  }
51015
- function normalizeUserText(text18) {
51016
- if (isInterruptText(text18)) return { kind: "interrupt" };
51017
- if (typeof text18 === "string" && text18.trimStart().startsWith(TASK_NOTIFICATION))
51137
+ function normalizeUserText(text19) {
51138
+ if (isInterruptText(text19)) return { kind: "interrupt" };
51139
+ if (typeof text19 === "string" && text19.trimStart().startsWith(TASK_NOTIFICATION))
51018
51140
  return { kind: "taskNotification" };
51019
51141
  return { kind: "user" };
51020
51142
  }
@@ -51075,8 +51197,8 @@ function extractLastAssistantMessage(entries) {
51075
51197
  for (let i = entries.length - 1; i >= 0; i--) {
51076
51198
  const entry = entries[i];
51077
51199
  if (entry.isSidechain || entry.type !== "assistant") continue;
51078
- const text18 = assistantText(entry);
51079
- if (text18) return cap(text18);
51200
+ const text19 = assistantText(entry);
51201
+ if (text19) return cap(text19);
51080
51202
  }
51081
51203
  return void 0;
51082
51204
  }
@@ -51091,8 +51213,8 @@ function assistantText(entry) {
51091
51213
  }
51092
51214
  return parts.join("\n");
51093
51215
  }
51094
- function cap(text18) {
51095
- return text18.length <= MAX_LENGTH ? text18 : `${text18.slice(0, MAX_LENGTH).trimEnd()}\u2026`;
51216
+ function cap(text19) {
51217
+ return text19.length <= MAX_LENGTH ? text19 : `${text19.slice(0, MAX_LENGTH).trimEnd()}\u2026`;
51096
51218
  }
51097
51219
  function asRecord4(value) {
51098
51220
  return value && typeof value === "object" ? value : null;
@@ -51140,9 +51262,9 @@ function promptTextOrNull(entry) {
51140
51262
  for (const block of content) {
51141
51263
  const b = asRecord5(block);
51142
51264
  if (b?.type !== "text") continue;
51143
- const text18 = typeof b.text === "string" ? b.text : "";
51144
- if (isInterrupt(text18)) return null;
51145
- parts.push(text18);
51265
+ const text19 = typeof b.text === "string" ? b.text : "";
51266
+ if (isInterrupt(text19)) return null;
51267
+ parts.push(text19);
51146
51268
  }
51147
51269
  return parts.length === 0 ? null : parts.join("\n");
51148
51270
  }
@@ -51232,17 +51354,17 @@ function entryMessages(entry) {
51232
51354
  return [];
51233
51355
  }
51234
51356
  function userMessages(content) {
51235
- if (typeof content === "string") return text16("user", cleanUserText(content));
51357
+ if (typeof content === "string") return text17("user", cleanUserText(content));
51236
51358
  if (!Array.isArray(content)) return [];
51237
- return content.filter((c) => c.type === "text").flatMap((c) => text16("user", cleanUserText(c.text ?? "")));
51359
+ return content.filter((c) => c.type === "text").flatMap((c) => text17("user", cleanUserText(c.text ?? "")));
51238
51360
  }
51239
51361
  function assistantMessages(content) {
51240
- if (typeof content === "string") return text16("assistant", content.trim());
51362
+ if (typeof content === "string") return text17("assistant", content.trim());
51241
51363
  if (!Array.isArray(content)) return [];
51242
51364
  return content.flatMap((c) => assistantItem(c));
51243
51365
  }
51244
51366
  function assistantItem(c) {
51245
- if (c.type === "text") return text16("assistant", (c.text ?? "").trim());
51367
+ if (c.type === "text") return text17("assistant", (c.text ?? "").trim());
51246
51368
  if (c.type === "tool_use")
51247
51369
  return [
51248
51370
  {
@@ -51253,7 +51375,7 @@ function assistantItem(c) {
51253
51375
  ];
51254
51376
  return [];
51255
51377
  }
51256
- function text16(role, value) {
51378
+ function text17(role, value) {
51257
51379
  return value ? [{ role, text: value }] : [];
51258
51380
  }
51259
51381
  function cleanUserText(value) {
@@ -51268,10 +51390,10 @@ function extractContextAfterReference(filePath) {
51268
51390
  if (head === void 0) return void 0;
51269
51391
  const parts = [];
51270
51392
  let length = 0;
51271
- for (const text18 of conversationText(head)) {
51272
- if (parts.length === 0 && isBareReferencePrompt(text18)) continue;
51273
- parts.push(text18);
51274
- length += text18.length;
51393
+ for (const text19 of conversationText(head)) {
51394
+ if (parts.length === 0 && isBareReferencePrompt(text19)) continue;
51395
+ parts.push(text19);
51396
+ length += text19.length;
51275
51397
  if (length >= MAX_CONTEXT_CHARS) break;
51276
51398
  }
51277
51399
  if (length < MIN_CONTEXT_CHARS) return void 0;
@@ -51282,8 +51404,8 @@ function* conversationText(head) {
51282
51404
  if (!line) continue;
51283
51405
  const entry = parseEntry(line);
51284
51406
  if (!entry || entry.isSidechain || entry.isMeta) continue;
51285
- for (const text18 of entryText(entry)) {
51286
- const trimmed = text18.trim();
51407
+ for (const text19 of entryText(entry)) {
51408
+ const trimmed = text19.trim();
51287
51409
  if (trimmed) yield trimmed;
51288
51410
  }
51289
51411
  }
@@ -51318,13 +51440,13 @@ function parseEntry(line) {
51318
51440
 
51319
51441
  // src/commands/sessions/summarise/extractFirstUserMessage.ts
51320
51442
  function extractFirstUserMessage(filePath) {
51321
- for (const text18 of iterateUserMessages(filePath)) {
51322
- return truncate4(text18);
51443
+ for (const text19 of iterateUserMessages(filePath)) {
51444
+ return truncate4(text19);
51323
51445
  }
51324
51446
  return void 0;
51325
51447
  }
51326
- function truncate4(text18, maxChars = 500) {
51327
- const trimmed = text18.trim();
51448
+ function truncate4(text19, maxChars = 500) {
51449
+ const trimmed = text19.trim();
51328
51450
  if (trimmed.length <= maxChars) return trimmed;
51329
51451
  return `${trimmed.slice(0, maxChars)}\u2026`;
51330
51452
  }
@@ -52143,7 +52265,7 @@ function codexRespawnPlan(session) {
52143
52265
  }
52144
52266
 
52145
52267
  // src/commands/sessions/daemon/interactiveRespawnPlan.ts
52146
- import { randomUUID as randomUUID28 } from "crypto";
52268
+ import { randomUUID as randomUUID29 } from "crypto";
52147
52269
 
52148
52270
  // src/commands/sessions/daemon/hasTranscriptOnDisk.ts
52149
52271
  function hasTranscriptOnDisk(session) {
@@ -52170,7 +52292,7 @@ function interactiveRespawnPlan(session, resumes) {
52170
52292
  return null;
52171
52293
  }
52172
52294
  function freshClaudePlan(session, prompt, cwd) {
52173
- const claudeSessionId = randomUUID28();
52295
+ const claudeSessionId = randomUUID29();
52174
52296
  return {
52175
52297
  spawn: () => {
52176
52298
  session.claudeSessionId = claudeSessionId;
@@ -52581,10 +52703,10 @@ var NOTIFICATION = /<task-notification>([\s\S]*?)<\/task-notification>/g;
52581
52703
  var TASK_ID = /<task-id>([^<]+)<\/task-id>/;
52582
52704
  var STATUS = /<status>([^<]+)<\/status>/;
52583
52705
  function notifiedTasks(entry) {
52584
- const text18 = taskNotificationText(entry);
52585
- if (!text18) return [];
52706
+ const text19 = taskNotificationText(entry);
52707
+ if (!text19) return [];
52586
52708
  const tasks = [];
52587
- for (const [, body] of text18.matchAll(NOTIFICATION)) {
52709
+ for (const [, body] of text19.matchAll(NOTIFICATION)) {
52588
52710
  const id = body.match(TASK_ID)?.[1];
52589
52711
  if (id) tasks.push({ id, status: body.match(STATUS)?.[1]?.trim() });
52590
52712
  }
@@ -52627,7 +52749,7 @@ function selfFinishedTaskIds(entry) {
52627
52749
  }
52628
52750
 
52629
52751
  // src/commands/sessions/shared/pendingAskQuestionTasks.ts
52630
- var ASK_QUESTION_COMMAND = /\bassist ask-question\b/;
52752
+ var ASK_QUESTION_COMMAND = /\bassist ask-(question|check)\b/;
52631
52753
  function pendingAskQuestionTasks(entries) {
52632
52754
  const askQuestionToolUses = /* @__PURE__ */ new Set();
52633
52755
  const askQuestionTasks = /* @__PURE__ */ new Set();
@@ -52767,7 +52889,7 @@ function pendingQuestionPrompt(backgroundTaskIds) {
52767
52889
  const preamble = "A restart interrupted this conversation while your question was waiting for an answer. The user never saw it and it is no longer on screen.";
52768
52890
  if (backgroundTaskIds.length === 0)
52769
52891
  return `${preamble} Ask the same question again with AskUserQuestion.`;
52770
- return `${preamble} It killed ${backgroundTaskIds.length} background task(s) that were still running (${backgroundTaskIds.join(", ")}). If you asked with assist ask-question, run the same assist ask-question again as a background task; otherwise ask again with AskUserQuestion. Restart any other killed task that should still be running.`;
52892
+ return `${preamble} It killed ${backgroundTaskIds.length} background task(s) that were still running (${backgroundTaskIds.join(", ")}). If you asked with assist ask-question or assist ask-check, run that same command again as a background task; otherwise ask again with AskUserQuestion. Restart any other killed task that should still be running.`;
52771
52893
  }
52772
52894
 
52773
52895
  // src/commands/sessions/daemon/restoreResumePlan.ts
@@ -53726,12 +53848,6 @@ function createRelayState(node, { viewers, onSessionsChanged, onHistoryChanged }
53726
53848
  function broadcastToViewers(state, msg) {
53727
53849
  broadcast(state.viewers(), msg);
53728
53850
  }
53729
- function takePendingCreator(state) {
53730
- const pending = state.pendingCreators.shift();
53731
- if (!pending) return void 0;
53732
- clearTimeout(pending.timer);
53733
- return pending.client;
53734
- }
53735
53851
  function failPendingCreators(state, message3) {
53736
53852
  for (const { client, timer } of state.pendingCreators) {
53737
53853
  clearTimeout(timer);
@@ -53827,7 +53943,7 @@ function createTimeoutMs(ctx, data) {
53827
53943
  const base = ctx.deps.createTimeoutMs;
53828
53944
  return data.transfer ? Math.max(base, TRANSFER_CREATE_TIMEOUT_MS) : base;
53829
53945
  }
53830
- function armCreateTimeout(ctx, client, data) {
53946
+ function armCreateTimeout(ctx, client, data, traceId) {
53831
53947
  const node = ctx.spec.name;
53832
53948
  const timer = setTimeout(
53833
53949
  () => {
@@ -53844,7 +53960,7 @@ function armCreateTimeout(ctx, client, data) {
53844
53960
  createTimeoutMs(ctx, data)
53845
53961
  );
53846
53962
  timer.unref?.();
53847
- ctx.relay.pendingCreators.push({ client, timer });
53963
+ ctx.relay.pendingCreators.push({ client, timer, traceId });
53848
53964
  }
53849
53965
  function forwardLinkCreate(ctx, client, data) {
53850
53966
  const node = ctx.spec.name;
@@ -53861,7 +53977,7 @@ function forwardLinkCreate(ctx, client, data) {
53861
53977
  daemonLog(
53862
53978
  `link ${node} ws: routing ${data.type} (cwd=${data.cwd ?? "default"}) trace=${traceId}`
53863
53979
  );
53864
- armCreateTimeout(ctx, client, data);
53980
+ armCreateTimeout(ctx, client, data, traceId);
53865
53981
  sendToLink(ctx, { ...toPeerMessage(data), traceId });
53866
53982
  }
53867
53983
 
@@ -53945,6 +54061,20 @@ function relayLinkSessions(state, msg) {
53945
54061
  state.onSessionsChanged();
53946
54062
  }
53947
54063
 
54064
+ // src/commands/sessions/daemon/links/takePendingCreator.ts
54065
+ function takePendingCreator(state, traceId) {
54066
+ const index2 = pendingIndex(state, traceId);
54067
+ if (index2 === -1) return void 0;
54068
+ const [pending] = state.pendingCreators.splice(index2, 1);
54069
+ if (!pending) return void 0;
54070
+ clearTimeout(pending.timer);
54071
+ return pending.client;
54072
+ }
54073
+ function pendingIndex(state, traceId) {
54074
+ if (typeof traceId !== "string") return 0;
54075
+ return state.pendingCreators.findIndex((p) => p.traceId === traceId);
54076
+ }
54077
+
53948
54078
  // src/commands/sessions/daemon/links/relayRunConflict.ts
53949
54079
  function relayRunConflict(state, msg) {
53950
54080
  const ns = (id) => typeof id === "string" ? toNodeSessionId(state.node, id) : id;
@@ -53961,6 +54091,24 @@ function relayRunConflict(state, msg) {
53961
54091
  else broadcastToViewers(state, namespaced);
53962
54092
  }
53963
54093
 
54094
+ // src/commands/sessions/daemon/links/relayToCreator.ts
54095
+ function relayToCreator(label) {
54096
+ return (state, msg) => {
54097
+ daemonLog(
54098
+ `link ${state.node} ws: ${label} ${msg.sessionId ?? msg.message}`
54099
+ );
54100
+ const client = takePendingCreator(state, msg.traceId);
54101
+ const reply2 = msg.type === "created" ? {
54102
+ ...msg,
54103
+ sessionId: toNodeSessionId(state.node, msg.sessionId)
54104
+ } : msg;
54105
+ if (client) sendTo(client, reply2);
54106
+ else if (msg.type === "error") broadcastToViewers(state, reply2);
54107
+ else
54108
+ daemonLog(`link ${state.node} ws: ${msg.type} with no pending creator`);
54109
+ };
54110
+ }
54111
+
53964
54112
  // src/commands/sessions/daemon/links/relayLinkMessage.ts
53965
54113
  var nsId = (state, msg) => toNodeSessionId(state.node, msg.sessionId);
53966
54114
  var relayOutput = (state, msg) => {
@@ -53968,17 +54116,6 @@ var relayOutput = (state, msg) => {
53968
54116
  appendScrollback(state, sessionId, msg.data);
53969
54117
  broadcastToViewers(state, { type: "output", sessionId, data: msg.data });
53970
54118
  };
53971
- var relayToCreator = (label) => (state, msg) => {
53972
- daemonLog(
53973
- `link ${state.node} ws: ${label} ${msg.sessionId ?? msg.message}`
53974
- );
53975
- const client = takePendingCreator(state);
53976
- const reply2 = msg.type === "created" ? { ...msg, sessionId: nsId(state, msg) } : msg;
53977
- if (client) sendTo(client, reply2);
53978
- else if (msg.type === "error") broadcastToViewers(state, reply2);
53979
- else
53980
- daemonLog(`link ${state.node} ws: ${msg.type} with no pending creator`);
53981
- };
53982
54119
  var relayHistory = (state, msg) => {
53983
54120
  const sessions = (msg.sessions ?? []).map((s) => ({
53984
54121
  ...s,
@@ -54857,18 +54994,18 @@ import * as readline5 from "readline";
54857
54994
 
54858
54995
  // src/commands/sessions/daemon/historySearch/historySnippet.ts
54859
54996
  var CONTEXT_CHARS = 60;
54860
- function collapse(text18) {
54861
- return text18.replace(/\s+/g, " ");
54997
+ function collapse(text19) {
54998
+ return text19.replace(/\s+/g, " ");
54862
54999
  }
54863
- function historySnippet(text18, index2, length) {
55000
+ function historySnippet(text19, index2, length) {
54864
55001
  const start2 = Math.max(0, index2 - CONTEXT_CHARS);
54865
- const end = Math.min(text18.length, index2 + length + CONTEXT_CHARS);
54866
- const before = collapse(text18.slice(start2, index2)).trimStart();
54867
- const after = collapse(text18.slice(index2 + length, end)).trimEnd();
55002
+ const end = Math.min(text19.length, index2 + length + CONTEXT_CHARS);
55003
+ const before = collapse(text19.slice(start2, index2)).trimStart();
55004
+ const after = collapse(text19.slice(index2 + length, end)).trimEnd();
54868
55005
  return {
54869
55006
  before: start2 > 0 ? `\u2026${before}` : before,
54870
- match: collapse(text18.slice(index2, index2 + length)),
54871
- after: end < text18.length ? `${after}\u2026` : after
55007
+ match: collapse(text19.slice(index2, index2 + length)),
55008
+ after: end < text19.length ? `${after}\u2026` : after
54872
55009
  };
54873
55010
  }
54874
55011
 
@@ -54913,9 +55050,9 @@ function rolloutMessages(entry) {
54913
55050
  }
54914
55051
  function chatMessages(payload) {
54915
55052
  if (payload.type === "user_message")
54916
- return text17("user", rolloutString(payload.message));
55053
+ return text18("user", rolloutString(payload.message));
54917
55054
  if (payload.type === "agent_message")
54918
- return text17("assistant", rolloutString(payload.message));
55055
+ return text18("assistant", rolloutString(payload.message));
54919
55056
  return [];
54920
55057
  }
54921
55058
  function toolMessages(payload) {
@@ -54929,7 +55066,7 @@ function toolMessages(payload) {
54929
55066
  }
54930
55067
  ];
54931
55068
  }
54932
- function text17(role, value) {
55069
+ function text18(role, value) {
54933
55070
  const trimmed = value.trim();
54934
55071
  return trimmed ? [{ role, text: trimmed }] : [];
54935
55072
  }
@@ -54949,8 +55086,8 @@ function claudeMessages(line) {
54949
55086
  }
54950
55087
 
54951
55088
  // src/commands/sessions/daemon/historySearch/findTranscriptMatch.ts
54952
- function escapeRegExp3(text18) {
54953
- return text18.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
55089
+ function escapeRegExp3(text19) {
55090
+ return text19.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
54954
55091
  }
54955
55092
  function encodesVerbatimInJson(query) {
54956
55093
  return JSON.stringify(query) === `"${query}"`;
@@ -54961,9 +55098,9 @@ function rawLinePrefilter(query) {
54961
55098
  return (line) => line.toLowerCase().includes(lower);
54962
55099
  }
54963
55100
  function matchTexts(texts, pattern2) {
54964
- for (const text18 of texts) {
54965
- const found = pattern2.exec(text18);
54966
- if (found) return historySnippet(text18, found.index, found[0].length);
55101
+ for (const text19 of texts) {
55102
+ const found = pattern2.exec(text19);
55103
+ if (found) return historySnippet(text19, found.index, found[0].length);
54967
55104
  }
54968
55105
  return null;
54969
55106
  }
@@ -55046,26 +55183,27 @@ async function handleSearchHistory(client, data) {
55046
55183
 
55047
55184
  // src/commands/sessions/daemon/creator.ts
55048
55185
  function creator(isNew, spawn13) {
55049
- const reply2 = (client, result) => {
55186
+ const reply2 = (client, d, result) => {
55187
+ const traceId = typeof d.traceId === "string" ? d.traceId : void 0;
55050
55188
  if (typeof result !== "string") {
55051
- sendTo(client, { type: "error", message: result.error });
55189
+ sendTo(client, { type: "error", message: result.error, traceId });
55052
55190
  return;
55053
55191
  }
55054
- sendTo(client, { type: "created", sessionId: result, isNew });
55192
+ sendTo(client, { type: "created", sessionId: result, isNew, traceId });
55055
55193
  };
55056
55194
  return (client, m, d) => {
55057
55195
  if (m.links.route(client, d)) return;
55058
55196
  const result = spawn13(m, d);
55059
55197
  if (result instanceof Promise)
55060
55198
  result.then(
55061
- (resolved) => reply2(client, resolved),
55199
+ (resolved) => reply2(client, d, resolved),
55062
55200
  (error) => {
55063
55201
  const reason4 = error instanceof Error ? error.message : String(error);
55064
55202
  daemonLog(`${d.type} failed: ${reason4}`);
55065
- reply2(client, { error: `${d.type} failed: ${reason4}` });
55203
+ reply2(client, d, { error: `${d.type} failed: ${reason4}` });
55066
55204
  }
55067
55205
  );
55068
- else reply2(client, result);
55206
+ else reply2(client, d, result);
55069
55207
  };
55070
55208
  }
55071
55209
 
@@ -56818,6 +56956,7 @@ var programRegistrars = [
56818
56956
  registerShow,
56819
56957
  registerAsk,
56820
56958
  registerAskQuestion,
56959
+ registerAskCheck,
56821
56960
  registerSlack,
56822
56961
  registerSql,
56823
56962
  registerTranscript,