@staff0rd/assist 0.1133.3 → 0.1134.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.1133.3",
9
+ version: "0.1134.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -55,6 +55,7 @@ var package_default = {
55
55
  url: "https://github.com/staff0rd/assist"
56
56
  },
57
57
  dependencies: {
58
+ "@anthropic-ai/claude-agent-sdk": "^0.3.322",
58
59
  "@capacitor/app": "^8.1.2",
59
60
  "@xterm/addon-fit": "^0.11.0",
60
61
  "@xterm/addon-serialize": "^0.14.0",
@@ -556,6 +557,7 @@ var durationSchema = z.string().superRefine((value, ctx) => {
556
557
  // src/shared/harnessKinds.ts
557
558
  var harnessKinds = [
558
559
  "claude",
560
+ "claude-sdk",
559
561
  "codex",
560
562
  "pi"
561
563
  ];
@@ -3990,9 +3992,9 @@ import { eq as eq7 } from "drizzle-orm";
3990
3992
 
3991
3993
  // src/commands/backlog/searchItemIds.ts
3992
3994
  import { and as and3, asc as asc5, eq as eq9, ilike, or, sql as sql16 } from "drizzle-orm";
3993
- async function searchItemIds(orm, query, origin) {
3994
- const pattern2 = `%${query}%`;
3995
- const numberPattern = `%${query.replace(/^#/, "")}%`;
3995
+ async function searchItemIds(orm, query2, origin) {
3996
+ const pattern2 = `%${query2}%`;
3997
+ const numberPattern = `%${query2.replace(/^#/, "")}%`;
3996
3998
  const rows = await orm.selectDistinct({ id: items.id }).from(items).leftJoin(comments, eq9(comments.itemId, items.id)).leftJoin(planPhases, eq9(planPhases.itemId, items.id)).where(
3997
3999
  and3(
3998
4000
  origin ? eq9(items.origin, origin) : void 0,
@@ -4253,10 +4255,10 @@ async function loadBacklog(allRepos = false) {
4253
4255
  const { orm } = await getReady();
4254
4256
  return loadAllItems(orm, allRepos ? void 0 : getOrigin());
4255
4257
  }
4256
- async function searchBacklog(query) {
4258
+ async function searchBacklog(query2) {
4257
4259
  const { orm } = await getReady();
4258
4260
  const origin = getOrigin();
4259
- const ids = await searchItemIds(orm, query, origin);
4261
+ const ids = await searchItemIds(orm, query2, origin);
4260
4262
  const allItems = await loadAllItems(orm, origin);
4261
4263
  return allItems.filter((item) => ids.includes(item.id));
4262
4264
  }
@@ -4641,10 +4643,10 @@ async function loadBacklogSummaries(allRepos = false) {
4641
4643
  const { orm } = await getReady();
4642
4644
  return loadItemSummaries(orm, allRepos ? void 0 : getOrigin());
4643
4645
  }
4644
- async function searchBacklogSummaries(query) {
4646
+ async function searchBacklogSummaries(query2) {
4645
4647
  const { orm } = await getReady();
4646
4648
  const origin = getOrigin();
4647
- const ids = await searchItemIds(orm, query, origin);
4649
+ const ids = await searchItemIds(orm, query2, origin);
4648
4650
  const summaries = await loadItemSummaries(orm, origin);
4649
4651
  return summaries.filter((item) => ids.includes(item.id));
4650
4652
  }
@@ -4954,8 +4956,8 @@ function getConversationParam(req) {
4954
4956
  import { execFile as execFile3 } from "child_process";
4955
4957
  import { promisify as promisify3 } from "util";
4956
4958
  var execFileAsync3 = promisify3(execFile3);
4957
- async function execGit(cwd, args, opts = {}) {
4958
- const { maxBuffer, allowFailure } = opts;
4959
+ async function execGit(cwd, args, opts2 = {}) {
4960
+ const { maxBuffer, allowFailure } = opts2;
4959
4961
  const unquoted = [
4960
4962
  "--no-optional-locks",
4961
4963
  "-c",
@@ -5129,11 +5131,13 @@ async function commitPaths(cwd, sha) {
5129
5131
  // src/shared/harnessAdapters/harnessLabel.ts
5130
5132
  var HARNESS_LABELS = {
5131
5133
  claude: "Claude",
5134
+ "claude-sdk": "Claude (SDK)",
5132
5135
  codex: "Codex",
5133
5136
  pi: "pi"
5134
5137
  };
5135
5138
  var HARNESS_PRODUCT_LABELS = {
5136
5139
  claude: "Claude Code",
5140
+ "claude-sdk": "Claude Code",
5137
5141
  codex: "Codex",
5138
5142
  pi: "pi"
5139
5143
  };
@@ -5311,6 +5315,24 @@ function shellEscape(s) {
5311
5315
  return `'${s.replace(/'/g, String.raw`'\''`)}'`;
5312
5316
  }
5313
5317
 
5318
+ // src/commands/sessions/daemon/sessionChildEnv.ts
5319
+ function sessionChildEnv(base, sessionId2, extraEnv) {
5320
+ const {
5321
+ CLAUDE_CODE_CHILD_SESSION: _childSession,
5322
+ CLAUDECODE: _claudeCode,
5323
+ ...parentEnv
5324
+ } = base;
5325
+ return {
5326
+ ...parentEnv,
5327
+ ASSIST_SESSION: "1",
5328
+ ...sessionId2 && {
5329
+ ASSIST_SESSION_ID: sessionId2,
5330
+ ASSIST_ACTIVITY_ID: sessionId2
5331
+ },
5332
+ ...extraEnv
5333
+ };
5334
+ }
5335
+
5314
5336
  // src/commands/sessions/daemon/viewerSize.ts
5315
5337
  import { readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "fs";
5316
5338
  var DEFAULT_SIZE = { cols: 120, rows: 30 };
@@ -5356,24 +5378,11 @@ function spawnPty(args, cwd, sessionId2, extraEnv) {
5356
5378
  refuseMissingCwd(cwd, sessionId2);
5357
5379
  ensureSpawnHelperExecutable();
5358
5380
  const command = resolvePtyCommand(args);
5359
- const {
5360
- CLAUDE_CODE_CHILD_SESSION: _childSession,
5361
- CLAUDECODE: _claudeCode,
5362
- ...parentEnv
5363
- } = process.env;
5364
5381
  return pty.spawn(command.file, command.args, {
5365
5382
  name: "xterm-256color",
5366
5383
  ...viewerSize(),
5367
5384
  cwd: cwd ?? process.cwd(),
5368
- env: {
5369
- ...parentEnv,
5370
- ASSIST_SESSION: "1",
5371
- ...sessionId2 && {
5372
- ASSIST_SESSION_ID: sessionId2,
5373
- ASSIST_ACTIVITY_ID: sessionId2
5374
- },
5375
- ...extraEnv
5376
- }
5385
+ env: sessionChildEnv(process.env, sessionId2, extraEnv)
5377
5386
  });
5378
5387
  }
5379
5388
  function refuseMissingCwd(cwd, sessionId2) {
@@ -5385,20 +5394,20 @@ function refuseMissingCwd(cwd, sessionId2) {
5385
5394
  }
5386
5395
 
5387
5396
  // src/commands/sessions/daemon/spawnClaude.ts
5388
- function spawnClaude(opts = {}) {
5389
- return spawnPty(buildArgs(opts), opts.cwd, opts.sessionId);
5397
+ function spawnClaude(opts2 = {}) {
5398
+ return spawnPty(buildArgs(opts2), opts2.cwd, opts2.sessionId);
5390
5399
  }
5391
- function buildArgs(opts) {
5400
+ function buildArgs(opts2) {
5392
5401
  const base = ["claude", "--settings", ensureHooksSettings()];
5393
- if (opts.appendSystemPromptFile)
5394
- base.push("--append-system-prompt-file", opts.appendSystemPromptFile);
5395
- if (opts.auto) base.push("--permission-mode", "auto");
5396
- if (opts.model) base.push("--model", opts.model);
5397
- if (opts.resumeSessionId) {
5398
- return opts.prompt ? [...base, "--resume", opts.resumeSessionId, opts.prompt] : [...base, "--resume", opts.resumeSessionId];
5399
- }
5400
- if (opts.claudeSessionId) base.push("--session-id", opts.claudeSessionId);
5401
- if (opts.prompt) return [...base, opts.prompt];
5402
+ if (opts2.appendSystemPromptFile)
5403
+ base.push("--append-system-prompt-file", opts2.appendSystemPromptFile);
5404
+ if (opts2.auto) base.push("--permission-mode", "auto");
5405
+ if (opts2.model) base.push("--model", opts2.model);
5406
+ if (opts2.resumeSessionId) {
5407
+ return opts2.prompt ? [...base, "--resume", opts2.resumeSessionId, opts2.prompt] : [...base, "--resume", opts2.resumeSessionId];
5408
+ }
5409
+ if (opts2.claudeSessionId) base.push("--session-id", opts2.claudeSessionId);
5410
+ if (opts2.prompt) return [...base, opts2.prompt];
5402
5411
  return base;
5403
5412
  }
5404
5413
 
@@ -6000,7 +6009,7 @@ function awaitsQuestionAnswer(entries2) {
6000
6009
 
6001
6010
  // src/commands/sessions/shared/deriveTranscriptStatus.ts
6002
6011
  var TURN_END_STOP_REASONS = /* @__PURE__ */ new Set(["end_turn", "stop_sequence"]);
6003
- function deriveTranscriptStatus(entries2, opts = {}) {
6012
+ function deriveTranscriptStatus(entries2, opts2 = {}) {
6004
6013
  const events = normalizeTranscriptEvents(entries2);
6005
6014
  const lastIdx = lastDecisiveIndex(events);
6006
6015
  if (lastIdx === -1) return null;
@@ -6010,7 +6019,7 @@ function deriveTranscriptStatus(entries2, opts = {}) {
6010
6019
  if (ev.kind === "toolResult" || ev.kind === "taskNotification") return null;
6011
6020
  if (ev.stopReason != null && TURN_END_STOP_REASONS.has(ev.stopReason))
6012
6021
  return "waiting";
6013
- if (opts.permissionActive) return "waiting";
6022
+ if (opts2.permissionActive) return "waiting";
6014
6023
  if (hasPendingAskUserQuestion(events, lastIdx)) return "waiting";
6015
6024
  return "running";
6016
6025
  }
@@ -6317,17 +6326,17 @@ import * as path8 from "path";
6317
6326
  import { execSync as execSync4 } from "child_process";
6318
6327
  function checkCliAvailable(cli) {
6319
6328
  const binary = cli.split(/\s+/)[0];
6320
- const opts = {
6329
+ const opts2 = {
6321
6330
  encoding: "utf8",
6322
6331
  stdio: ["ignore", "pipe", "pipe"],
6323
6332
  windowsHide: true
6324
6333
  };
6325
6334
  try {
6326
- execSync4(`command -v ${binary}`, opts);
6335
+ execSync4(`command -v ${binary}`, opts2);
6327
6336
  return true;
6328
6337
  } catch {
6329
6338
  try {
6330
- execSync4(`where ${binary}`, opts);
6339
+ execSync4(`where ${binary}`, opts2);
6331
6340
  return true;
6332
6341
  } catch {
6333
6342
  return false;
@@ -6336,18 +6345,20 @@ function checkCliAvailable(cli) {
6336
6345
  }
6337
6346
 
6338
6347
  // src/shared/harnesses.ts
6348
+ var claudeHarness = {
6349
+ kind: "claude",
6350
+ command: "claude",
6351
+ homeDir: path8.join(os3.homedir(), ".claude"),
6352
+ sync: {
6353
+ commandDest: (name2) => path8.join("skills", name2, "SKILL.md"),
6354
+ designPromptDest: "design-system-prompt.md",
6355
+ designSkillDest: (name2) => path8.join("skills", `${name2}.md`),
6356
+ nativeDesignSkills: false
6357
+ }
6358
+ };
6339
6359
  var harnesses = {
6340
- claude: {
6341
- kind: "claude",
6342
- command: "claude",
6343
- homeDir: path8.join(os3.homedir(), ".claude"),
6344
- sync: {
6345
- commandDest: (name2) => path8.join("skills", name2, "SKILL.md"),
6346
- designPromptDest: "design-system-prompt.md",
6347
- designSkillDest: (name2) => path8.join("skills", `${name2}.md`),
6348
- nativeDesignSkills: false
6349
- }
6350
- },
6360
+ claude: claudeHarness,
6361
+ "claude-sdk": { ...claudeHarness, kind: "claude-sdk" },
6351
6362
  codex: {
6352
6363
  kind: "codex",
6353
6364
  command: "codex",
@@ -6685,8 +6696,8 @@ function formatToolSummary(input) {
6685
6696
  if (command) return truncate(command);
6686
6697
  const url = getString(record3, "url");
6687
6698
  if (url) return url;
6688
- const query = getString(record3, "query");
6689
- if (query) return truncate(query);
6699
+ const query2 = getString(record3, "query");
6700
+ if (query2) return truncate(query2);
6690
6701
  const description = getString(record3, "description");
6691
6702
  if (description) return truncate(description);
6692
6703
  return "";
@@ -7078,32 +7089,58 @@ function detectHarness(kind) {
7078
7089
  }
7079
7090
 
7080
7091
  // src/shared/harnessAdapters/harnessCapabilityDeclarations.ts
7092
+ var claude = {
7093
+ "skills.native": supported,
7094
+ "launch.terminal": supported,
7095
+ "conversation.resume": supported,
7096
+ "conversation.relocate": supported,
7097
+ "conversation.id": supported,
7098
+ "conversation.preassignId": supported,
7099
+ "systemPrompt.append": supported,
7100
+ "tasks.notifyOnExit": supported,
7101
+ "artifacts.publish": supported,
7102
+ "transcript.read": supported,
7103
+ "oneShot.text": supported,
7104
+ "oneShot.structured": supported,
7105
+ "usage.rateLimits": supported,
7106
+ "tools.restrict": supported,
7107
+ "connector.gmail.read": supported,
7108
+ "connector.slack.read": supported,
7109
+ "intercept.command": supported,
7110
+ "intercept.fileRead": supported,
7111
+ "intercept.fileWrite": supported,
7112
+ "intercept.editDiff": supported,
7113
+ "intercept.question": supported,
7114
+ "slashCommands.suggest": supported
7115
+ };
7081
7116
  var harnessCapabilityDeclarations = {
7082
- claude: {
7083
- "skills.native": supported,
7084
- "conversation.resume": supported,
7085
- "conversation.relocate": supported,
7086
- "conversation.id": supported,
7087
- "conversation.preassignId": supported,
7088
- "systemPrompt.append": supported,
7089
- "tasks.notifyOnExit": supported,
7090
- "artifacts.publish": supported,
7091
- "transcript.read": supported,
7092
- "oneShot.text": supported,
7093
- "oneShot.structured": supported,
7094
- "usage.rateLimits": supported,
7095
- "tools.restrict": supported,
7096
- "connector.gmail.read": supported,
7097
- "connector.slack.read": supported,
7098
- "intercept.command": supported,
7099
- "intercept.fileRead": supported,
7100
- "intercept.fileWrite": supported,
7101
- "intercept.editDiff": supported,
7102
- "intercept.question": supported,
7103
- "slashCommands.suggest": supported
7117
+ claude,
7118
+ "claude-sdk": {
7119
+ ...claude,
7120
+ "launch.terminal": unsupported(
7121
+ "Claude (SDK) sessions have no terminal, and these workflows start an assist command that opens the Claude CLI's terminal UI",
7122
+ "run the workflow with Claude",
7123
+ "a1560"
7124
+ ),
7125
+ "conversation.resume": unsupported(
7126
+ "Claude (SDK) sessions do not resume their conversation yet",
7127
+ "a daemon restart starts a fresh conversation; pick Claude to keep the conversation across restarts",
7128
+ "a1560"
7129
+ ),
7130
+ "conversation.relocate": unsupported(
7131
+ "Claude (SDK) sessions do not resume their conversation yet, so it cannot continue in a replacement worktree",
7132
+ "start a fresh session in the replacement worktree; pick Claude to keep the conversation",
7133
+ "a1560"
7134
+ ),
7135
+ "usage.rateLimits": unsupported(
7136
+ "assist does not yet record usage and rate-limit events from Claude (SDK) sessions",
7137
+ "Claude (SDK) usage is not shown in the status bar; terminal Claude usage still is",
7138
+ "a1560"
7139
+ )
7104
7140
  },
7105
7141
  codex: {
7106
7142
  "skills.native": supported,
7143
+ "launch.terminal": supported,
7107
7144
  "conversation.resume": supported,
7108
7145
  "conversation.relocate": supported,
7109
7146
  "conversation.id": supported,
@@ -7162,6 +7199,7 @@ var harnessCapabilityDeclarations = {
7162
7199
  },
7163
7200
  pi: {
7164
7201
  "skills.native": supported,
7202
+ "launch.terminal": supported,
7165
7203
  "conversation.resume": unsupported(
7166
7204
  "pi sessions cannot be resumed yet",
7167
7205
  "restart starts a fresh pi conversation; pick Claude or Codex to keep the conversation across restarts",
@@ -7308,6 +7346,348 @@ var claudeAdapter = {
7308
7346
  activityIdentity: (conversationId) => ({ claudeSessionId: conversationId })
7309
7347
  };
7310
7348
 
7349
+ // src/commands/sessions/daemon/spawnClaudeSdk.ts
7350
+ import { query } from "@anthropic-ai/claude-agent-sdk";
7351
+
7352
+ // src/commands/sessions/daemon/resolveClaudeExecutable.ts
7353
+ import { execFileSync as execFileSync2 } from "child_process";
7354
+ var opts = {
7355
+ encoding: "utf8",
7356
+ stdio: ["ignore", "pipe", "ignore"],
7357
+ windowsHide: true
7358
+ };
7359
+ function resolveClaudeExecutable() {
7360
+ const found = process.platform === "win32" ? execFileSync2("where", ["claude"], opts) : execFileSync2(
7361
+ process.env.SHELL ?? "bash",
7362
+ ["-l", "-c", "command -v claude"],
7363
+ opts
7364
+ );
7365
+ const lines = found.split(/\r?\n/).map((line) => line.trim()).filter((line) => /^(\/|[A-Za-z]:\\)/.test(line));
7366
+ const path128 = lines.find((line) => line.endsWith(".exe")) ?? lines.at(-1);
7367
+ if (!path128) throw new Error("claude is not on PATH");
7368
+ return path128;
7369
+ }
7370
+
7371
+ // src/commands/sessions/daemon/sdk/createSdkInput.ts
7372
+ function userMessage(text18) {
7373
+ return {
7374
+ type: "user",
7375
+ message: { role: "user", content: text18 },
7376
+ parent_tool_use_id: null
7377
+ };
7378
+ }
7379
+ function createSdkInput() {
7380
+ const queue = [];
7381
+ let wake2;
7382
+ let closed = false;
7383
+ const notify2 = () => {
7384
+ wake2?.();
7385
+ wake2 = void 0;
7386
+ };
7387
+ async function* messages2() {
7388
+ while (true) {
7389
+ const next3 = queue.shift();
7390
+ if (next3) {
7391
+ yield next3;
7392
+ continue;
7393
+ }
7394
+ if (closed) return;
7395
+ await new Promise((resolve36) => {
7396
+ wake2 = resolve36;
7397
+ });
7398
+ }
7399
+ }
7400
+ return {
7401
+ messages: messages2(),
7402
+ push: (text18) => {
7403
+ queue.push(userMessage(text18));
7404
+ notify2();
7405
+ },
7406
+ close: () => {
7407
+ closed = true;
7408
+ notify2();
7409
+ }
7410
+ };
7411
+ }
7412
+
7413
+ // src/commands/sessions/daemon/sdk/killSdkChild.ts
7414
+ function killSdkChild(child2) {
7415
+ if (!child2?.pid || child2.exitCode !== null) return;
7416
+ try {
7417
+ if (process.platform === "win32") child2.kill();
7418
+ else process.kill(-child2.pid, "SIGTERM");
7419
+ } catch {
7420
+ child2.kill();
7421
+ }
7422
+ }
7423
+
7424
+ // src/commands/sessions/daemon/sdk/sdkTerminalStub.ts
7425
+ var noopDisposable = { dispose: () => {
7426
+ } };
7427
+ function sdkTerminalStub(label) {
7428
+ const skip3 = (path128) => () => daemonLog(`${label} ${path128} skipped: Claude (SDK) session has no terminal`);
7429
+ return {
7430
+ cols: 0,
7431
+ rows: 0,
7432
+ write: skip3("input"),
7433
+ resize: skip3("resize"),
7434
+ onData: () => noopDisposable
7435
+ };
7436
+ }
7437
+
7438
+ // src/commands/sessions/daemon/sdk/createSdkSessionProcess.ts
7439
+ function createSdkSessionProcess(sessionId2, abort2) {
7440
+ const label = `session ${sessionId2 ?? "?"}`;
7441
+ const eventListeners = [];
7442
+ const exitListeners = [];
7443
+ let child2;
7444
+ let exited = false;
7445
+ const sessionProcess = {
7446
+ get pid() {
7447
+ return child2?.pid ?? 0;
7448
+ },
7449
+ ...sdkTerminalStub(label),
7450
+ kill: () => {
7451
+ daemonLog(
7452
+ `${label} sdk query ended by kill (child pid ${child2?.pid ?? "none"})`
7453
+ );
7454
+ abort2.abort();
7455
+ killSdkChild(child2);
7456
+ },
7457
+ onExit: (listener) => {
7458
+ exitListeners.push(listener);
7459
+ return noopDisposable;
7460
+ },
7461
+ sdk: { onEvent: (listener) => eventListeners.push(listener) }
7462
+ };
7463
+ return {
7464
+ process: sessionProcess,
7465
+ emit: (event) => {
7466
+ for (const listener of eventListeners) listener(event);
7467
+ },
7468
+ exit: (exitCode) => {
7469
+ if (exited) return;
7470
+ exited = true;
7471
+ killSdkChild(child2);
7472
+ for (const listener of exitListeners) listener({ exitCode });
7473
+ },
7474
+ attach: (spawned) => {
7475
+ child2 = spawned;
7476
+ },
7477
+ aborted: () => abort2.signal.aborted
7478
+ };
7479
+ }
7480
+
7481
+ // src/commands/sessions/daemon/sdk/createSdkTurnTracker.ts
7482
+ function createSdkTurnTracker(label, control) {
7483
+ let status2;
7484
+ let activity2 = null;
7485
+ const setActivity = (next3) => {
7486
+ if (next3 === activity2) return;
7487
+ activity2 = next3;
7488
+ control.emit({ kind: "activity", text: next3 });
7489
+ };
7490
+ const setStatus3 = (next3) => {
7491
+ if (next3 === "waiting") setActivity(null);
7492
+ if (next3 === status2) return;
7493
+ status2 = next3;
7494
+ daemonLog(`${label} sdk status: ${next3}`);
7495
+ control.emit({ kind: "status", status: next3 });
7496
+ };
7497
+ return { setActivity, setStatus: setStatus3 };
7498
+ }
7499
+
7500
+ // src/commands/sessions/daemon/sdk/logSdkMessage.ts
7501
+ function logSdkMessage(label, message4) {
7502
+ if (message4.type === "system" && message4.subtype === "init")
7503
+ daemonLog(
7504
+ `${label} sdk init: claude session ${message4.session_id} model ${message4.model} permission mode ${message4.permissionMode}`
7505
+ );
7506
+ if (message4.type === "result")
7507
+ daemonLog(`${label} sdk turn ended: ${message4.subtype}`);
7508
+ }
7509
+
7510
+ // src/commands/sessions/daemon/sdk/sdkActivityText.ts
7511
+ var TARGET_KEYS = [
7512
+ "command",
7513
+ "file_path",
7514
+ "notebook_path",
7515
+ "path",
7516
+ "pattern",
7517
+ "url",
7518
+ "query",
7519
+ "description",
7520
+ "skill"
7521
+ ];
7522
+ var MAX_TARGET = 80;
7523
+ function toolTarget2(input) {
7524
+ if (!input || typeof input !== "object") return "";
7525
+ const record3 = input;
7526
+ const key = TARGET_KEYS.find((k) => typeof record3[k] === "string");
7527
+ if (!key) return "";
7528
+ const line = record3[key].split("\n")[0].trim();
7529
+ return line.length > MAX_TARGET ? `${line.slice(0, MAX_TARGET - 1)}\u2026` : line;
7530
+ }
7531
+ function sdkActivityText(content) {
7532
+ const tool = [...content].reverse().find((block) => block.type === "tool_use");
7533
+ if (!tool?.name) return "Working";
7534
+ const target = toolTarget2(tool.input);
7535
+ return `Working \xB7 ${tool.name}${target ? ` ${target}` : ""}`;
7536
+ }
7537
+
7538
+ // src/commands/sessions/daemon/sdk/sdkTurnStatus.ts
7539
+ function sdkTurnStatus(message4) {
7540
+ if (message4.type === "assistant" && message4.parent_tool_use_id === null)
7541
+ return "running";
7542
+ if (message4.type === "result") return "waiting";
7543
+ if (message4.type === "system" && message4.subtype === "session_state_changed")
7544
+ return message4.state === "running" ? "running" : "waiting";
7545
+ return void 0;
7546
+ }
7547
+
7548
+ // src/commands/sessions/daemon/sdk/runSdkQuery.ts
7549
+ async function runSdkQuery(messages2, sessionId2, control) {
7550
+ const label = `session ${sessionId2 ?? "?"}`;
7551
+ const turn = createSdkTurnTracker(label, control);
7552
+ try {
7553
+ for await (const message4 of messages2) {
7554
+ logSdkMessage(label, message4);
7555
+ const status2 = sdkTurnStatus(message4);
7556
+ if (status2) turn.setStatus(status2);
7557
+ if (message4.type === "assistant" && message4.parent_tool_use_id === null)
7558
+ turn.setActivity(sdkActivityText(message4.message.content));
7559
+ }
7560
+ daemonLog(`${label} sdk query finished`);
7561
+ control.exit(0);
7562
+ } catch (error) {
7563
+ if (control.aborted()) {
7564
+ daemonLog(`${label} sdk query stopped after kill`);
7565
+ control.exit(0);
7566
+ return;
7567
+ }
7568
+ daemonLog(
7569
+ `${label} sdk query failed: ${error instanceof Error ? error.message : String(error)}`
7570
+ );
7571
+ control.exit(1);
7572
+ }
7573
+ }
7574
+
7575
+ // src/commands/sessions/daemon/sdk/sdkQueryOptions.ts
7576
+ import { readFileSync as readFileSync8 } from "fs";
7577
+
7578
+ // src/commands/sessions/daemon/sdk/spawnSdkChild.ts
7579
+ import { spawn as spawn6 } from "child_process";
7580
+ var MAX_STDERR_LINE = 300;
7581
+ function spawnSdkChild(options2, sessionId2, attach) {
7582
+ const label = `session ${sessionId2 ?? "?"}`;
7583
+ const child2 = spawn6(options2.command, options2.args, {
7584
+ cwd: options2.cwd,
7585
+ env: sessionChildEnv(options2.env, sessionId2),
7586
+ stdio: ["pipe", "pipe", "pipe"],
7587
+ signal: options2.signal,
7588
+ /* why: its own process group, so a kill also reaches the shell commands
7589
+ * claude runs for its tools, as killPtyTree does for terminal sessions. */
7590
+ detached: process.platform !== "win32",
7591
+ windowsHide: true
7592
+ });
7593
+ daemonLog(
7594
+ `${label} sdk child spawned: pid ${child2.pid ?? "none"} ${options2.command}`
7595
+ );
7596
+ child2.stderr.setEncoding("utf8");
7597
+ child2.stderr.on("data", (chunk2) => {
7598
+ for (const line of chunk2.split("\n")) {
7599
+ const trimmed = line.trim();
7600
+ if (trimmed)
7601
+ daemonLog(`${label} sdk stderr: ${trimmed.slice(0, MAX_STDERR_LINE)}`);
7602
+ }
7603
+ });
7604
+ child2.on(
7605
+ "exit",
7606
+ (code, signal) => daemonLog(`${label} sdk child exited: code ${code} signal ${signal}`)
7607
+ );
7608
+ attach(child2);
7609
+ return child2;
7610
+ }
7611
+
7612
+ // src/commands/sessions/daemon/sdk/sdkQueryOptions.ts
7613
+ function sdkQueryOptions(opts2, executable, abort2, control) {
7614
+ const append = opts2.appendSystemPromptFile ? readFileSync8(opts2.appendSystemPromptFile, "utf8") : void 0;
7615
+ return {
7616
+ cwd: opts2.cwd,
7617
+ sessionId: opts2.claudeSessionId,
7618
+ permissionMode: "auto",
7619
+ settings: ensureHooksSettings(),
7620
+ pathToClaudeCodeExecutable: executable,
7621
+ spawnClaudeCodeProcess: (options2) => spawnSdkChild(options2, opts2.sessionId, control.attach),
7622
+ abortController: abort2,
7623
+ model: opts2.model,
7624
+ systemPrompt: { type: "preset", preset: "claude_code", append }
7625
+ };
7626
+ }
7627
+
7628
+ // src/commands/sessions/daemon/spawnClaudeSdk.ts
7629
+ function spawnClaudeSdk(opts2) {
7630
+ refuseMissingCwd(opts2.cwd, opts2.sessionId);
7631
+ const abort2 = new AbortController();
7632
+ const control = createSdkSessionProcess(opts2.sessionId, abort2);
7633
+ const input = createSdkInput();
7634
+ if (opts2.prompt) input.push(opts2.prompt);
7635
+ abort2.signal.addEventListener("abort", input.close);
7636
+ void startQuery(opts2, abort2, control, input.messages);
7637
+ return control.process;
7638
+ }
7639
+ async function startQuery(opts2, abort2, control, prompt) {
7640
+ const label = `session ${opts2.sessionId ?? "?"}`;
7641
+ try {
7642
+ const executable = resolveClaudeExecutable();
7643
+ daemonLog(
7644
+ `${label} sdk query starting: claude ${executable}, claude session ${opts2.claudeSessionId ?? "unassigned"}, permission mode auto, cwd ${opts2.cwd ?? process.cwd()}`
7645
+ );
7646
+ const messages2 = query({
7647
+ prompt,
7648
+ options: sdkQueryOptions(opts2, executable, abort2, control)
7649
+ });
7650
+ await runSdkQuery(messages2, opts2.sessionId, control);
7651
+ } catch (error) {
7652
+ daemonLog(
7653
+ `${label} sdk query not started: ${error instanceof Error ? error.message : String(error)}`
7654
+ );
7655
+ control.exit(1);
7656
+ }
7657
+ }
7658
+
7659
+ // src/shared/harnessAdapters/claudeSdkAdapter.ts
7660
+ var claudeSdkAdapter = {
7661
+ ...claudeAdapter,
7662
+ kind: "claude-sdk",
7663
+ label: harnessLabel("claude-sdk"),
7664
+ capabilities: {
7665
+ ...harnessCapabilityDeclarations["claude-sdk"],
7666
+ "connector.gmail.read": () => claudeConnectorProbe("Gmail"),
7667
+ "connector.slack.read": () => claudeConnectorProbe("Slack")
7668
+ },
7669
+ detect: () => detectHarness("claude-sdk"),
7670
+ interactive: ({
7671
+ sessionId: sessionId2,
7672
+ conversationId,
7673
+ prompt,
7674
+ cwd,
7675
+ appendSystemPromptFile,
7676
+ model
7677
+ }) => spawnClaudeSdk({
7678
+ prompt,
7679
+ cwd,
7680
+ sessionId: sessionId2,
7681
+ claudeSessionId: conversationId,
7682
+ appendSystemPromptFile,
7683
+ model
7684
+ }),
7685
+ activityIdentity: (conversationId) => ({
7686
+ harness: "claude-sdk",
7687
+ claudeSessionId: conversationId
7688
+ })
7689
+ };
7690
+
7311
7691
  // src/commands/litellm/buildCodexProviderArgs.ts
7312
7692
  var API_KEY_ENV = "ASSIST_LITELLM_API_KEY";
7313
7693
  function buildCodexProviderArgs(responsesBaseUrl, apiKey, model) {
@@ -7479,12 +7859,12 @@ function codexDeveloperInstructionsArgs(file) {
7479
7859
  }
7480
7860
 
7481
7861
  // src/shared/trustCodexProject.ts
7482
- import { execFileSync as execFileSync2 } from "child_process";
7862
+ import { execFileSync as execFileSync3 } from "child_process";
7483
7863
  import * as fs7 from "fs";
7484
7864
  import * as path10 from "path";
7485
7865
  function repoRoot(cwd) {
7486
7866
  try {
7487
- const commonDir = execFileSync2(
7867
+ const commonDir = execFileSync3(
7488
7868
  "git",
7489
7869
  ["rev-parse", "--path-format=absolute", "--git-common-dir"],
7490
7870
  { cwd, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }
@@ -7513,15 +7893,15 @@ ${entry}` : entry);
7513
7893
  }
7514
7894
 
7515
7895
  // src/commands/sessions/daemon/spawnCodex.ts
7516
- function spawnCodex(opts = {}) {
7517
- const trusted = trustCodexProject(opts.cwd);
7896
+ function spawnCodex(opts2 = {}) {
7897
+ const trusted = trustCodexProject(opts2.cwd);
7518
7898
  if (trusted) daemonLog(`codex: trusted ${trusted} in config.toml`);
7519
7899
  const untrusted = prepareCodexHookTrust();
7520
7900
  if (untrusted) daemonLog(`codex: ${untrusted}`);
7521
- const override = opts.model ? { args: ["-m", opts.model], env: {} } : buildHarnessCodexArgs();
7901
+ const override = opts2.model ? { args: ["-m", opts2.model], env: {} } : buildHarnessCodexArgs();
7522
7902
  const sessionEnv = codexSessionEnvArgs({
7523
7903
  ASSIST_SESSION: "1",
7524
- ASSIST_SESSION_ID: opts.sessionId,
7904
+ ASSIST_SESSION_ID: opts2.sessionId,
7525
7905
  ASSIST_BACKLOG_ITEM_ID: process.env.ASSIST_BACKLOG_ITEM_ID
7526
7906
  });
7527
7907
  return spawnPty(
@@ -7531,17 +7911,17 @@ function spawnCodex(opts = {}) {
7531
7911
  ...override.args,
7532
7912
  ...sessionEnv,
7533
7913
  ...codexSandboxNetworkArgs,
7534
- ...codexDeveloperInstructionsArgs(opts.appendSystemPromptFile),
7535
- ...codexArgs(opts)
7914
+ ...codexDeveloperInstructionsArgs(opts2.appendSystemPromptFile),
7915
+ ...codexArgs(opts2)
7536
7916
  ],
7537
- opts.cwd,
7538
- opts.sessionId,
7917
+ opts2.cwd,
7918
+ opts2.sessionId,
7539
7919
  override.env
7540
7920
  );
7541
7921
  }
7542
- function codexArgs(opts) {
7543
- const prompt = opts.prompt ? [opts.prompt] : [];
7544
- if (opts.resumeSessionId) return ["resume", opts.resumeSessionId, ...prompt];
7922
+ function codexArgs(opts2) {
7923
+ const prompt = opts2.prompt ? [opts2.prompt] : [];
7924
+ if (opts2.resumeSessionId) return ["resume", opts2.resumeSessionId, ...prompt];
7545
7925
  return prompt;
7546
7926
  }
7547
7927
 
@@ -8274,7 +8654,7 @@ function codexHookProbe() {
8274
8654
  }
8275
8655
 
8276
8656
  // src/shared/readCodexRulePerms.ts
8277
- import { existsSync as existsSync19, readdirSync as readdirSync5, readFileSync as readFileSync12 } from "fs";
8657
+ import { existsSync as existsSync19, readdirSync as readdirSync5, readFileSync as readFileSync13 } from "fs";
8278
8658
  import { join as join25 } from "path";
8279
8659
 
8280
8660
  // src/shared/readPatternList.ts
@@ -8367,7 +8747,7 @@ function readCodexRulePerms(key) {
8367
8747
  ];
8368
8748
  return dirs.flatMap(ruleFiles).flatMap((file) => {
8369
8749
  try {
8370
- return parseCodexRules(readFileSync12(file, "utf8"))[key];
8750
+ return parseCodexRules(readFileSync13(file, "utf8"))[key];
8371
8751
  } catch {
8372
8752
  return [];
8373
8753
  }
@@ -8718,11 +9098,11 @@ var codexAdapter = {
8718
9098
  var piTerminalArgs = ["--tui-mode", "regular"];
8719
9099
 
8720
9100
  // src/commands/sessions/daemon/spawnPi.ts
8721
- function spawnPi(opts = {}) {
9101
+ function spawnPi(opts2 = {}) {
8722
9102
  const args = ["pi", ...piTerminalArgs];
8723
- if (opts.model) args.push("--model", opts.model);
8724
- if (opts.prompt) args.push(opts.prompt);
8725
- return spawnPty(args, opts.cwd, opts.sessionId, { ASSIST_HARNESS: "pi" });
9103
+ if (opts2.model) args.push("--model", opts2.model);
9104
+ if (opts2.prompt) args.push(opts2.prompt);
9105
+ return spawnPty(args, opts2.cwd, opts2.sessionId, { ASSIST_HARNESS: "pi" });
8726
9106
  }
8727
9107
 
8728
9108
  // src/shared/spawnPi.ts
@@ -8855,6 +9235,7 @@ var piAdapter = {
8855
9235
  // src/shared/harnessAdapters/harnessAdapter.ts
8856
9236
  var adapters = {
8857
9237
  claude: claudeAdapter,
9238
+ "claude-sdk": claudeSdkAdapter,
8858
9239
  codex: codexAdapter,
8859
9240
  pi: piAdapter
8860
9241
  };
@@ -9472,12 +9853,12 @@ var editEnforcement = [
9472
9853
  var fixConflictFeature = {
9473
9854
  id: "fixConflict",
9474
9855
  label: "Fix conflicts",
9475
- requires: ["skills.native", ...editEnforcement]
9856
+ requires: ["skills.native", "launch.terminal", ...editEnforcement]
9476
9857
  };
9477
9858
  var reviewPrCommentsFeature = {
9478
9859
  id: "reviewPrComments",
9479
9860
  label: "Address comments",
9480
- requires: ["skills.native", ...editEnforcement]
9861
+ requires: ["skills.native", "launch.terminal", ...editEnforcement]
9481
9862
  };
9482
9863
  var addressCommentsChainFeature = {
9483
9864
  id: "addressCommentsChain",
@@ -9626,27 +10007,32 @@ var reviewSynthesisFeature = {
9626
10007
  var reviewRefineFeature = {
9627
10008
  id: "reviewRefine",
9628
10009
  label: "Review & refine",
9629
- requires: [...editEnforcement]
10010
+ requires: ["launch.terminal", ...editEnforcement]
9630
10011
  };
9631
10012
  var reviewApplyFeature = {
9632
10013
  id: "reviewApply",
9633
10014
  label: "Review & apply",
9634
- requires: [...editEnforcement]
10015
+ requires: ["launch.terminal", ...editEnforcement]
9635
10016
  };
9636
10017
  var reviewBacklogFeature = {
9637
10018
  id: "reviewBacklog",
9638
10019
  label: "Review & backlog",
9639
- requires: ["skills.native", ...editEnforcement]
10020
+ requires: ["skills.native", "launch.terminal", ...editEnforcement]
9640
10021
  };
9641
10022
  var reviewCheckoutFeature = {
9642
10023
  id: "reviewCheckout",
9643
10024
  label: "PR checkout session",
9644
- requires: [...editEnforcement]
10025
+ requires: ["launch.terminal", ...editEnforcement]
9645
10026
  };
9646
10027
  var highLevelReviewFeature = {
9647
10028
  id: "highLevelReview",
9648
10029
  label: "High-level review",
9649
- requires: ["skills.native", "tasks.notifyOnExit", ...editEnforcement]
10030
+ requires: [
10031
+ "skills.native",
10032
+ "launch.terminal",
10033
+ "tasks.notifyOnExit",
10034
+ ...editEnforcement
10035
+ ]
9650
10036
  };
9651
10037
  var highLevelGlobsFeature = {
9652
10038
  id: "highLevelGlobs",
@@ -11554,7 +11940,7 @@ function handleServerRuns(req, res) {
11554
11940
 
11555
11941
  // src/commands/sessions/web/getReviewSynthesis.ts
11556
11942
  import { execFile as execFile6 } from "child_process";
11557
- import { readFileSync as readFileSync13 } from "fs";
11943
+ import { readFileSync as readFileSync14 } from "fs";
11558
11944
  import { homedir as homedir10 } from "os";
11559
11945
  import { basename as basename10, join as join32 } from "path";
11560
11946
  import { promisify as promisify6 } from "util";
@@ -11602,7 +11988,7 @@ async function getReviewSynthesis(req, res) {
11602
11988
  respondJson(res, 404, { error: "No synthesis found" });
11603
11989
  return;
11604
11990
  }
11605
- respondJson(res, 200, { synthesis: readFileSync13(path128, "utf8") });
11991
+ respondJson(res, 200, { synthesis: readFileSync14(path128, "utf8") });
11606
11992
  } catch {
11607
11993
  respondJson(res, 404, { error: "No synthesis found" });
11608
11994
  }
@@ -11926,14 +12312,14 @@ async function deleteItemComment(res, itemId2, commentId) {
11926
12312
 
11927
12313
  // src/commands/backlog/appendComment.ts
11928
12314
  import { sql as sql17 } from "drizzle-orm";
11929
- async function appendComment(orm, itemId2, text18, opts = {}) {
12315
+ async function appendComment(orm, itemId2, text18, opts2 = {}) {
11930
12316
  await orm.insert(comments).values({
11931
12317
  itemId: itemId2,
11932
12318
  idx: sql17`(SELECT COALESCE(MAX(${comments.idx}) + 1, 0) FROM ${comments} WHERE ${comments.itemId} = ${itemId2})`,
11933
12319
  text: text18,
11934
- phase: opts.phase ?? null,
12320
+ phase: opts2.phase ?? null,
11935
12321
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11936
- type: opts.type ?? "comment"
12322
+ type: opts2.type ?? "comment"
11937
12323
  });
11938
12324
  }
11939
12325
 
@@ -12029,22 +12415,22 @@ var transcriptFeatures = [
12029
12415
  var refineFeature = {
12030
12416
  id: "refine",
12031
12417
  label: "Refine",
12032
- requires: ["skills.native", ...editEnforcement]
12418
+ requires: ["skills.native", "launch.terminal", ...editEnforcement]
12033
12419
  };
12034
12420
  var draftFeature = {
12035
12421
  id: "draft",
12036
12422
  label: "Draft",
12037
- requires: ["skills.native", ...editEnforcement]
12423
+ requires: ["skills.native", "launch.terminal", ...editEnforcement]
12038
12424
  };
12039
12425
  var bugFeature = {
12040
12426
  id: "bug",
12041
12427
  label: "Bug filing",
12042
- requires: ["skills.native", ...editEnforcement]
12428
+ requires: ["skills.native", "launch.terminal", ...editEnforcement]
12043
12429
  };
12044
12430
  var buildFeature = {
12045
12431
  id: "build",
12046
12432
  label: "Build",
12047
- requires: [...editEnforcement]
12433
+ requires: ["launch.terminal", ...editEnforcement]
12048
12434
  };
12049
12435
  var sessionFeature = {
12050
12436
  id: "session",
@@ -12064,7 +12450,7 @@ var conversationRecoveryFeature = {
12064
12450
  var divergenceEscalationFeature = {
12065
12451
  id: "divergenceEscalation",
12066
12452
  label: "Divergence escalation",
12067
- requires: [...editEnforcement]
12453
+ requires: ["launch.terminal", ...editEnforcement]
12068
12454
  };
12069
12455
  var previewQuestionsFeature = {
12070
12456
  id: "previewQuestions",
@@ -12463,7 +12849,7 @@ import chalk10 from "chalk";
12463
12849
  import {
12464
12850
  existsSync as existsSync26,
12465
12851
  mkdirSync as mkdirSync8,
12466
- readFileSync as readFileSync14,
12852
+ readFileSync as readFileSync15,
12467
12853
  rmSync as rmSync3,
12468
12854
  writeFileSync as writeFileSync7
12469
12855
  } from "fs";
@@ -12483,7 +12869,7 @@ function readSignalOwner(itemId2) {
12483
12869
  const path128 = getOwnerPath(itemId2);
12484
12870
  if (!existsSync26(path128)) return void 0;
12485
12871
  try {
12486
- const parsed = JSON.parse(readFileSync14(path128, "utf8"));
12872
+ const parsed = JSON.parse(readFileSync15(path128, "utf8"));
12487
12873
  return parsed.sessionId;
12488
12874
  } catch {
12489
12875
  return void 0;
@@ -13102,9 +13488,9 @@ function queryNodes() {
13102
13488
  }
13103
13489
 
13104
13490
  // src/commands/watch/resolveUpstream.ts
13105
- import { execFileSync as execFileSync3 } from "child_process";
13491
+ import { execFileSync as execFileSync4 } from "child_process";
13106
13492
  function runGit3(args, cwd) {
13107
- return execFileSync3("git", args, {
13493
+ return execFileSync4("git", args, {
13108
13494
  encoding: "utf8",
13109
13495
  stdio: ["pipe", "pipe", "pipe"],
13110
13496
  cwd,
@@ -13180,8 +13566,8 @@ async function health(_req, res) {
13180
13566
  function getCwdAndQuery(req, res) {
13181
13567
  const cwd = getCwdParam(req, res);
13182
13568
  if (!cwd) return null;
13183
- const query = new URL(req.url ?? "/", "http://localhost").searchParams.get("q") ?? "";
13184
- return { cwd, query };
13569
+ const query2 = new URL(req.url ?? "/", "http://localhost").searchParams.get("q") ?? "";
13570
+ return { cwd, query: query2 };
13185
13571
  }
13186
13572
 
13187
13573
  // src/commands/sessions/web/historySearch.ts
@@ -13354,11 +13740,11 @@ var linkStateCache = {
13354
13740
 
13355
13741
  // src/commands/sessions/web/linkStatus/fetchLinkStateChunks.ts
13356
13742
  var CHUNK_SIZE = 100;
13357
- async function fetchLinkStateChunks(refs, query) {
13743
+ async function fetchLinkStateChunks(refs, query2) {
13358
13744
  const resolved = /* @__PURE__ */ new Map();
13359
13745
  for (let start2 = 0; start2 < refs.length; start2 += CHUNK_SIZE) {
13360
13746
  const chunk2 = refs.slice(start2, start2 + CHUNK_SIZE);
13361
- const states2 = await query(chunk2).catch(() => void 0);
13747
+ const states2 = await query2(chunk2).catch(() => void 0);
13362
13748
  if (!states2) continue;
13363
13749
  chunk2.forEach((ref, i) => {
13364
13750
  const key = linkRefKey(ref);
@@ -13438,9 +13824,9 @@ async function queryLinkStates(refs) {
13438
13824
 
13439
13825
  // src/commands/sessions/web/linkStatus/resolveLinkStates.ts
13440
13826
  var inFlight2 = /* @__PURE__ */ new Map();
13441
- function startFetch(refs, query) {
13827
+ function startFetch(refs, query2) {
13442
13828
  if (refs.length === 0) return;
13443
- const batch = fetchLinkStateChunks(refs, query);
13829
+ const batch = fetchLinkStateChunks(refs, query2);
13444
13830
  for (const ref of refs) {
13445
13831
  const key = linkRefKey(ref);
13446
13832
  const pending = batch.then((resolved) => resolved.get(key) ?? null);
@@ -13450,12 +13836,12 @@ function startFetch(refs, query) {
13450
13836
  });
13451
13837
  }
13452
13838
  }
13453
- async function resolveLinkStates(refs, query = queryLinkStates) {
13839
+ async function resolveLinkStates(refs, query2 = queryLinkStates) {
13454
13840
  const unique = new Map(refs.map((ref) => [linkRefKey(ref), ref]));
13455
13841
  const toFetch = [...unique].filter(
13456
13842
  ([key]) => linkStateCache.get(key) === void 0 && !inFlight2.has(key)
13457
13843
  ).map(([, ref]) => ref);
13458
- startFetch(toFetch, query);
13844
+ startFetch(toFetch, query2);
13459
13845
  const states2 = {};
13460
13846
  await Promise.all(
13461
13847
  [...unique.keys()].map(async (key) => {
@@ -13492,12 +13878,12 @@ function isBoundary(text18, index3) {
13492
13878
  if (!/[A-Za-z0-9]/.test(previous)) return true;
13493
13879
  return /[a-z0-9]/.test(previous) && /[A-Z]/.test(text18[index3] ?? "");
13494
13880
  }
13495
- function subsequenceScore(text18, query) {
13881
+ function subsequenceScore(text18, query2) {
13496
13882
  const lower = text18.toLowerCase();
13497
13883
  let score = 0;
13498
13884
  let cursor = 0;
13499
13885
  let previous = -1;
13500
- for (const char of query) {
13886
+ for (const char of query2) {
13501
13887
  const at2 = lower.indexOf(char, cursor);
13502
13888
  if (at2 === -1) return null;
13503
13889
  if (at2 === previous + 1) score += CONSECUTIVE_BONUS;
@@ -13509,8 +13895,8 @@ function subsequenceScore(text18, query) {
13509
13895
  }
13510
13896
  return score - Math.min(text18.length, MAX_LENGTH_PENALTY);
13511
13897
  }
13512
- function scoreFilePath(path128, query) {
13513
- const needle = query.trim().toLowerCase();
13898
+ function scoreFilePath(path128, query2) {
13899
+ const needle = query2.trim().toLowerCase();
13514
13900
  if (!needle) return 0;
13515
13901
  const basename38 = path128.slice(path128.lastIndexOf("/") + 1);
13516
13902
  const inBasename = subsequenceScore(basename38, needle);
@@ -13519,10 +13905,10 @@ function scoreFilePath(path128, query) {
13519
13905
  }
13520
13906
 
13521
13907
  // src/commands/sessions/web/rankFilePaths.ts
13522
- function rankFilePaths(paths, query, limit) {
13908
+ function rankFilePaths(paths, query2, limit) {
13523
13909
  const scored = [];
13524
13910
  for (const path128 of paths) {
13525
- const score = scoreFilePath(path128, query);
13911
+ const score = scoreFilePath(path128, query2);
13526
13912
  if (score !== null) scored.push({ path: path128, score });
13527
13913
  }
13528
13914
  scored.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path));
@@ -13549,10 +13935,10 @@ async function repoFiles(cwd) {
13549
13935
  async function listFiles(req, res) {
13550
13936
  const params = getCwdAndQuery(req, res);
13551
13937
  if (!params) return;
13552
- const { cwd, query } = params;
13938
+ const { cwd, query: query2 } = params;
13553
13939
  try {
13554
13940
  const files = await repoFiles(cwd);
13555
- respondJson(res, 200, { files: rankFilePaths(files, query, MAX_RESULTS) });
13941
+ respondJson(res, 200, { files: rankFilePaths(files, query2, MAX_RESULTS) });
13556
13942
  } catch {
13557
13943
  respondJson(res, 500, { error: "Failed to list files" });
13558
13944
  }
@@ -14284,10 +14670,10 @@ function assertProjectScope() {
14284
14670
  }
14285
14671
 
14286
14672
  // src/shared/runGhOrThrow.ts
14287
- import { execFileSync as execFileSync4 } from "child_process";
14673
+ import { execFileSync as execFileSync5 } from "child_process";
14288
14674
  function runGhOrThrow(args, fallbackMessage, input) {
14289
14675
  try {
14290
- execFileSync4("gh", args, {
14676
+ execFileSync5("gh", args, {
14291
14677
  stdio: [input === void 0 ? "ignore" : "pipe", "ignore", "pipe"],
14292
14678
  encoding: "utf8",
14293
14679
  ...input === void 0 ? {} : { input }
@@ -14329,11 +14715,11 @@ function throwOnGraphqlErrors(stdout) {
14329
14715
  }
14330
14716
 
14331
14717
  // src/shared/runGhGraphqlJson.ts
14332
- function runGhGraphqlJson(query, vars = {}) {
14718
+ function runGhGraphqlJson(query2, vars = {}) {
14333
14719
  const result = spawnSync4("gh", ["api", "graphql", "--input", "-"], {
14334
14720
  encoding: "utf8",
14335
14721
  windowsHide: true,
14336
- input: JSON.stringify({ query, variables: vars }),
14722
+ input: JSON.stringify({ query: query2, variables: vars }),
14337
14723
  maxBuffer: 64 * 1024 * 1024
14338
14724
  });
14339
14725
  if (result.status !== 0) throw new Error(result.stderr || result.stdout);
@@ -14466,7 +14852,7 @@ async function nextPickup(req, res) {
14466
14852
  import path22 from "path";
14467
14853
 
14468
14854
  // src/commands/rules/readScopedRules.ts
14469
- import { existsSync as existsSync28, readFileSync as readFileSync15 } from "fs";
14855
+ import { existsSync as existsSync28, readFileSync as readFileSync16 } from "fs";
14470
14856
  import path21 from "path";
14471
14857
 
14472
14858
  // src/commands/rules/rulesSectionRange.ts
@@ -14538,7 +14924,7 @@ function scopedClaudeFiles(target) {
14538
14924
  }
14539
14925
  function readScopedRules(target) {
14540
14926
  return scopedClaudeFiles(target).flatMap(
14541
- (source) => parseRulesSection(readFileSync15(source, "utf8")).map((rule) => ({
14927
+ (source) => parseRulesSection(readFileSync16(source, "utf8")).map((rule) => ({
14542
14928
  ...rule,
14543
14929
  source
14544
14930
  }))
@@ -14671,7 +15057,7 @@ function avgContextPerCycle(db) {
14671
15057
  // src/shared/db/listUsagePeaks.ts
14672
15058
  async function listUsagePeaks(db, options2) {
14673
15059
  const avgContext = avgContextPerCycle(db);
14674
- const query = db.select({
15060
+ const query2 = db.select({
14675
15061
  ...getTableColumns(usagePeaks),
14676
15062
  avgContextPct: avgContext.avgContextPct,
14677
15063
  phaseCount: avgContext.phaseCount
@@ -14688,14 +15074,15 @@ async function listUsagePeaks(db, options2) {
14688
15074
  desc4(usagePeaks.segment)
14689
15075
  );
14690
15076
  if (options2?.limit !== void 0) {
14691
- return query.limit(options2.limit).offset(options2.offset ?? 0);
15077
+ return query2.limit(options2.limit).offset(options2.offset ?? 0);
14692
15078
  }
14693
- return query;
15079
+ return query2;
14694
15080
  }
14695
15081
 
14696
15082
  // src/shared/harnessAdapters/harnessUsageAccounts.ts
14697
15083
  var harnessUsageAccounts = {
14698
15084
  claude: {},
15085
+ "claude-sdk": {},
14699
15086
  codex: { windowPrefix: "codex" },
14700
15087
  pi: { windowPrefix: "pi" }
14701
15088
  };
@@ -14863,7 +15250,7 @@ async function listItemUsageSummaries(db, options2) {
14863
15250
  const totals = phaseUsageTotals(db);
14864
15251
  const planned = planPhaseCounts(db);
14865
15252
  const lastPhase = lastPhaseActivity(db);
14866
- const query = db.select({
15253
+ const query2 = db.select({
14867
15254
  id: items.id,
14868
15255
  origin: items.origin,
14869
15256
  type: items.type,
@@ -14879,7 +15266,7 @@ async function listItemUsageSummaries(db, options2) {
14879
15266
  }).from(items).innerJoin(totals, eq27(totals.itemId, items.id)).leftJoin(planned, eq27(planned.itemId, items.id)).leftJoin(lastPhase, eq27(lastPhase.itemId, items.id)).where(itemUsageWhere(options2)).orderBy(
14880
15267
  ...itemUsageOrderBy({ totals, planned, lastPhase }, options2?.sort)
14881
15268
  );
14882
- const rows = options2?.limit === void 0 ? await query : await query.limit(options2.limit).offset(options2.offset ?? 0);
15269
+ const rows = options2?.limit === void 0 ? await query2 : await query2.limit(options2.limit).offset(options2.offset ?? 0);
14883
15270
  return rows.map(toItemUsageSummary);
14884
15271
  }
14885
15272
 
@@ -15957,7 +16344,7 @@ async function revertDiffFile(req, res) {
15957
16344
  }
15958
16345
 
15959
16346
  // src/commands/run/runCommandToCompletion.ts
15960
- import { spawn as spawn6 } from "child_process";
16347
+ import { spawn as spawn7 } from "child_process";
15961
16348
  import { existsSync as existsSync30 } from "fs";
15962
16349
 
15963
16350
  // src/shared/expandEnv.ts
@@ -15972,13 +16359,13 @@ function expandEnv(env) {
15972
16359
  }
15973
16360
 
15974
16361
  // src/commands/run/resolveCommand.ts
15975
- import { execFileSync as execFileSync5 } from "child_process";
16362
+ import { execFileSync as execFileSync6 } from "child_process";
15976
16363
  import { existsSync as existsSync29 } from "fs";
15977
16364
  import { dirname as dirname14, join as join35, resolve as resolve10 } from "path";
15978
16365
  function resolveCommand(command) {
15979
16366
  if (process.platform !== "win32" || command !== "bash") return command;
15980
16367
  try {
15981
- const gitPath = execFileSync5("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
16368
+ const gitPath = execFileSync6("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
15982
16369
  const gitRoot = resolve10(dirname14(gitPath), "..");
15983
16370
  const gitBash = join35(gitRoot, "bin", "bash.exe");
15984
16371
  if (existsSync29(gitBash)) return gitBash;
@@ -15998,7 +16385,7 @@ function runCommandToCompletion(command, args, env, cwd, quiet) {
15998
16385
  });
15999
16386
  return;
16000
16387
  }
16001
- const child2 = spawn6(resolveCommand(command), args, {
16388
+ const child2 = spawn7(resolveCommand(command), args, {
16002
16389
  stdio: quiet ? "pipe" : "inherit",
16003
16390
  env: env ? { ...process.env, ...expandEnv(env) } : void 0,
16004
16391
  cwd
@@ -16934,8 +17321,8 @@ async function ascRequest(fetchFn, token, method, path128, body) {
16934
17321
  function createAscClient(token, fetchFn = fetch) {
16935
17322
  return {
16936
17323
  get: (path128, params) => {
16937
- const query = params ? `?${new URLSearchParams(params)}` : "";
16938
- return ascRequest(fetchFn, token, "GET", `${path128}${query}`);
17324
+ const query2 = params ? `?${new URLSearchParams(params)}` : "";
17325
+ return ascRequest(fetchFn, token, "GET", `${path128}${query2}`);
16939
17326
  },
16940
17327
  post: (path128, body) => ascRequest(fetchFn, token, "POST", path128, body)
16941
17328
  };
@@ -18107,12 +18494,12 @@ function readBuiltVersion(cwd) {
18107
18494
  }
18108
18495
 
18109
18496
  // src/commands/watch/readDistVersion.ts
18110
- import { readFileSync as readFileSync17 } from "fs";
18497
+ import { readFileSync as readFileSync18 } from "fs";
18111
18498
  import { join as join40 } from "path";
18112
18499
  function readDistVersion(cwd) {
18113
18500
  try {
18114
18501
  const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
18115
- return readFileSync17(join40(root2, "dist", "built-version"), "utf8").trim();
18502
+ return readFileSync18(join40(root2, "dist", "built-version"), "utf8").trim();
18116
18503
  } catch {
18117
18504
  return void 0;
18118
18505
  }
@@ -18537,7 +18924,7 @@ async function writeFileContent(req, res) {
18537
18924
 
18538
18925
  // src/shared/createBundleHandler.ts
18539
18926
  import { createHash as createHash2 } from "crypto";
18540
- import { readFileSync as readFileSync18, statSync as statSync10 } from "fs";
18927
+ import { readFileSync as readFileSync19, statSync as statSync10 } from "fs";
18541
18928
  import { dirname as dirname19, join as join44 } from "path";
18542
18929
  import { fileURLToPath as fileURLToPath3 } from "url";
18543
18930
  function createBundleHandler(importMetaUrl, bundlePath, contentType = "application/javascript") {
@@ -18546,7 +18933,7 @@ function createBundleHandler(importMetaUrl, bundlePath, contentType = "applicati
18546
18933
  return (req, res) => {
18547
18934
  const mtimeMs = statSync10(file).mtimeMs;
18548
18935
  if (cache7?.mtimeMs !== mtimeMs) {
18549
- const body = readFileSync18(file);
18936
+ const body = readFileSync19(file);
18550
18937
  const etag = `"${createHash2("sha256").update(body).digest("hex").slice(0, 16)}"`;
18551
18938
  cache7 = { body, etag, mtimeMs };
18552
18939
  }
@@ -18569,7 +18956,7 @@ function createBundleHandler(importMetaUrl, bundlePath, contentType = "applicati
18569
18956
 
18570
18957
  // src/commands/sessions/web/createCssHandler.ts
18571
18958
  import { createHash as createHash3 } from "crypto";
18572
- import { readFileSync as readFileSync19 } from "fs";
18959
+ import { readFileSync as readFileSync20 } from "fs";
18573
18960
  import { createRequire as createRequire2 } from "module";
18574
18961
  var require3 = createRequire2(import.meta.url);
18575
18962
  function createCssHandler(packageEntry) {
@@ -18577,7 +18964,7 @@ function createCssHandler(packageEntry) {
18577
18964
  return (req, res) => {
18578
18965
  if (!cache7) {
18579
18966
  const resolved = require3.resolve(packageEntry);
18580
- const body = readFileSync19(resolved, "utf8");
18967
+ const body = readFileSync20(resolved, "utf8");
18581
18968
  const etag = `"${createHash3("sha256").update(body).digest("hex").slice(0, 16)}"`;
18582
18969
  cache7 = { body, etag };
18583
18970
  }
@@ -18984,12 +19371,12 @@ function scheduleReconnect() {
18984
19371
  }
18985
19372
 
18986
19373
  // src/commands/sessions/web/updates/autoRestart/autoRestartAttempts.ts
18987
- import { mkdirSync as mkdirSync11, readFileSync as readFileSync20, writeFileSync as writeFileSync10 } from "fs";
19374
+ import { mkdirSync as mkdirSync11, readFileSync as readFileSync21, writeFileSync as writeFileSync10 } from "fs";
18988
19375
  import { dirname as dirname20, join as join45 } from "path";
18989
19376
  var defaultPath = join45(daemonPaths.dir, "auto-restart-attempts.json");
18990
19377
  function read(path128) {
18991
19378
  try {
18992
- return JSON.parse(readFileSync20(path128, "utf8"));
19379
+ return JSON.parse(readFileSync21(path128, "utf8"));
18993
19380
  } catch {
18994
19381
  return {};
18995
19382
  }
@@ -19215,7 +19602,7 @@ function repoDirExists(cwd) {
19215
19602
  }
19216
19603
 
19217
19604
  // src/commands/sessions/daemon/worktree/git.ts
19218
- import { execFile as execFile14, execFileSync as execFileSync6 } from "child_process";
19605
+ import { execFile as execFile14, execFileSync as execFileSync7 } from "child_process";
19219
19606
  function isWindowsPath(cwd) {
19220
19607
  return /^[A-Za-z]:[\\/]/.test(cwd);
19221
19608
  }
@@ -19270,7 +19657,7 @@ function gitSyncResult(cwd, args) {
19270
19657
  }
19271
19658
  function gitSync(cwd, args) {
19272
19659
  const { file, argv, options: options2 } = gitInvocation(cwd, args);
19273
- return execFileSync6(file, argv, {
19660
+ return execFileSync7(file, argv, {
19274
19661
  ...options2,
19275
19662
  stdio: ["pipe", "pipe", "pipe"]
19276
19663
  }).toString();
@@ -19729,12 +20116,12 @@ import * as path27 from "path";
19729
20116
  import chalk22 from "chalk";
19730
20117
 
19731
20118
  // src/commands/verify/addToKnipIgnoreBinaries.ts
19732
- import { existsSync as existsSync36, readFileSync as readFileSync21, writeFileSync as writeFileSync12 } from "fs";
20119
+ import { existsSync as existsSync36, readFileSync as readFileSync22, writeFileSync as writeFileSync12 } from "fs";
19733
20120
  import { join as join46 } from "path";
19734
20121
  import chalk21 from "chalk";
19735
20122
  function loadKnipConfig(knipJsonPath) {
19736
20123
  if (existsSync36(knipJsonPath)) {
19737
- return JSON.parse(readFileSync21(knipJsonPath, "utf8"));
20124
+ return JSON.parse(readFileSync22(knipJsonPath, "utf8"));
19738
20125
  }
19739
20126
  return { $schema: "https://unpkg.com/knip@5/schema.json" };
19740
20127
  }
@@ -19786,7 +20173,7 @@ import * as path29 from "path";
19786
20173
  import chalk27 from "chalk";
19787
20174
 
19788
20175
  // src/commands/format/init.ts
19789
- import { existsSync as existsSync37, readFileSync as readFileSync22, writeFileSync as writeFileSync13 } from "fs";
20176
+ import { existsSync as existsSync37, readFileSync as readFileSync23, writeFileSync as writeFileSync13 } from "fs";
19790
20177
  import chalk25 from "chalk";
19791
20178
 
19792
20179
  // src/utils/printDiff.ts
@@ -19829,7 +20216,7 @@ async function init() {
19829
20216
  const newContent = `${JSON.stringify(oxfmtrc_template_default, null, " ")}
19830
20217
  `;
19831
20218
  const configPath = ".oxfmtrc.json";
19832
- const oldContent = existsSync37(configPath) ? readFileSync22(configPath, "utf8") : "";
20219
+ const oldContent = existsSync37(configPath) ? readFileSync23(configPath, "utf8") : "";
19833
20220
  if (oldContent === newContent) {
19834
20221
  console.log(".oxfmtrc.json already has the baseline formatter config");
19835
20222
  return;
@@ -19852,12 +20239,12 @@ async function init() {
19852
20239
  }
19853
20240
 
19854
20241
  // src/commands/lint/init.ts
19855
- import { existsSync as existsSync40, readFileSync as readFileSync24, writeFileSync as writeFileSync15 } from "fs";
20242
+ import { existsSync as existsSync40, readFileSync as readFileSync25, writeFileSync as writeFileSync15 } from "fs";
19856
20243
  import chalk26 from "chalk";
19857
20244
 
19858
20245
  // src/shared/removeEslint.ts
19859
20246
  import { execSync as execSync7 } from "child_process";
19860
- import { existsSync as existsSync39, readFileSync as readFileSync23, writeFileSync as writeFileSync14 } from "fs";
20247
+ import { existsSync as existsSync39, readFileSync as readFileSync24, writeFileSync as writeFileSync14 } from "fs";
19861
20248
 
19862
20249
  // src/shared/removeEslint/removeEslintConfigFiles.ts
19863
20250
  import { existsSync as existsSync38, unlinkSync as unlinkSync3 } from "fs";
@@ -19901,7 +20288,7 @@ function removeEslintFromPackageJson(options2) {
19901
20288
  if (!existsSync39(packageJsonPath)) {
19902
20289
  return false;
19903
20290
  }
19904
- const packageJson = JSON.parse(readFileSync23(packageJsonPath, "utf8"));
20291
+ const packageJson = JSON.parse(readFileSync24(packageJsonPath, "utf8"));
19905
20292
  let modified = false;
19906
20293
  modified = removeEslintDeps(packageJson.dependencies) || modified;
19907
20294
  modified = removeEslintDeps(packageJson.devDependencies) || modified;
@@ -19965,7 +20352,7 @@ async function writeOxlintConfig() {
19965
20352
  const newContent = `${JSON.stringify(oxlintrc_template_default, null, " ")}
19966
20353
  `;
19967
20354
  const configPath = ".oxlintrc.json";
19968
- const oldContent = existsSync40(configPath) ? readFileSync24(configPath, "utf8") : "";
20355
+ const oldContent = existsSync40(configPath) ? readFileSync25(configPath, "utf8") : "";
19969
20356
  if (oldContent === newContent) {
19970
20357
  console.log(".oxlintrc.json already has the baseline linter config");
19971
20358
  return;
@@ -20087,7 +20474,7 @@ async function init3(options2 = {}) {
20087
20474
  const setup = detectExistingSetup(pkg);
20088
20475
  const selected = await promptForScripts(getAvailableOptions(setup));
20089
20476
  if (!selected) return;
20090
- const writer = options2.packageJson ? (name2, cmd, opts) => setupVerifyScript(packageJsonPath, name2, cmd, opts) : setupVerifyRunEntry;
20477
+ const writer = options2.packageJson ? (name2, cmd, opts2) => setupVerifyScript(packageJsonPath, name2, cmd, opts2) : setupVerifyRunEntry;
20091
20478
  const handlers = getSetupHandlers(
20092
20479
  setup.hasVite,
20093
20480
  setup.hasTypescript,
@@ -20544,7 +20931,7 @@ function resolveEntries() {
20544
20931
  }
20545
20932
 
20546
20933
  // src/commands/verify/run/spawnCommand.ts
20547
- import { spawn as spawn7 } from "child_process";
20934
+ import { spawn as spawn8 } from "child_process";
20548
20935
 
20549
20936
  // src/lib/isAgentHarness.ts
20550
20937
  function isAgentHarness() {
@@ -20561,7 +20948,7 @@ function shouldSuppress(quiet) {
20561
20948
  return !!quiet || isAgentHarness();
20562
20949
  }
20563
20950
  function spawnCommand(fullCommand, cwd, env, quiet) {
20564
- return spawn7(fullCommand, [], {
20951
+ return spawn8(fullCommand, [], {
20565
20952
  stdio: shouldSuppress(quiet) ? "pipe" : "inherit",
20566
20953
  shell: true,
20567
20954
  cwd: cwd ?? process.cwd(),
@@ -20753,7 +21140,7 @@ async function newCli() {
20753
21140
 
20754
21141
  // src/commands/new/registerNew/newProject.ts
20755
21142
  import { execSync as execSync14 } from "child_process";
20756
- import { existsSync as existsSync45, readFileSync as readFileSync28, writeFileSync as writeFileSync22 } from "fs";
21143
+ import { existsSync as existsSync45, readFileSync as readFileSync29, writeFileSync as writeFileSync22 } from "fs";
20757
21144
 
20758
21145
  // src/commands/deploy/init.ts
20759
21146
  import { execSync as execSync13 } from "child_process";
@@ -20761,7 +21148,7 @@ import chalk37 from "chalk";
20761
21148
  import enquirer3 from "enquirer";
20762
21149
 
20763
21150
  // src/commands/deploy/init/updateWorkflow.ts
20764
- import { existsSync as existsSync44, mkdirSync as mkdirSync14, readFileSync as readFileSync27, writeFileSync as writeFileSync21 } from "fs";
21151
+ import { existsSync as existsSync44, mkdirSync as mkdirSync14, readFileSync as readFileSync28, writeFileSync as writeFileSync21 } from "fs";
20765
21152
  import { dirname as dirname28, join as join53 } from "path";
20766
21153
  import { fileURLToPath as fileURLToPath4 } from "url";
20767
21154
  import chalk36 from "chalk";
@@ -20771,13 +21158,13 @@ function getExistingSiteId() {
20771
21158
  if (!existsSync44(WORKFLOW_PATH)) {
20772
21159
  return null;
20773
21160
  }
20774
- const content = readFileSync27(WORKFLOW_PATH, "utf8");
21161
+ const content = readFileSync28(WORKFLOW_PATH, "utf8");
20775
21162
  const match = content.match(/-s\s+([a-f0-9-]{36})/);
20776
21163
  return match ? match[1] : null;
20777
21164
  }
20778
21165
  function getTemplateContent(siteId) {
20779
21166
  const templatePath = join53(__dirname3, "commands/deploy/build.yml");
20780
- const template = readFileSync27(templatePath, "utf8");
21167
+ const template = readFileSync28(templatePath, "utf8");
20781
21168
  return template.replace("{{NETLIFY_SITE_ID}}", siteId);
20782
21169
  }
20783
21170
  async function updateWorkflow(siteId) {
@@ -20787,7 +21174,7 @@ async function updateWorkflow(siteId) {
20787
21174
  mkdirSync14(workflowDir, { recursive: true });
20788
21175
  }
20789
21176
  if (existsSync44(WORKFLOW_PATH)) {
20790
- const oldContent = readFileSync27(WORKFLOW_PATH, "utf8");
21177
+ const oldContent = readFileSync28(WORKFLOW_PATH, "utf8");
20791
21178
  if (oldContent === newContent) {
20792
21179
  console.log(chalk36.green("build.yml is already up to date"));
20793
21180
  return;
@@ -20885,7 +21272,7 @@ function addViteBaseConfig() {
20885
21272
  console.log("No vite.config.ts found, skipping base config");
20886
21273
  return;
20887
21274
  }
20888
- const content = readFileSync28(viteConfigPath, "utf8");
21275
+ const content = readFileSync29(viteConfigPath, "utf8");
20889
21276
  if (content.includes("base:")) {
20890
21277
  console.log("vite.config.ts already has base config");
20891
21278
  return;
@@ -20963,13 +21350,13 @@ function renderLineChart({
20963
21350
  }
20964
21351
 
20965
21352
  // src/commands/activity/fetchCommitsPerDay.ts
20966
- import { execFileSync as execFileSync7 } from "child_process";
21353
+ import { execFileSync as execFileSync8 } from "child_process";
20967
21354
  function fetchContributions(from, to) {
20968
- const query = `{ viewer { contributionsCollection(from: "${from}T00:00:00Z", to: "${to}T23:59:59Z") { contributionCalendar { weeks { contributionDays { date contributionCount } } } } } }`;
21355
+ const query2 = `{ viewer { contributionsCollection(from: "${from}T00:00:00Z", to: "${to}T23:59:59Z") { contributionCalendar { weeks { contributionDays { date contributionCount } } } } } }`;
20969
21356
  const jq = ".data.viewer.contributionsCollection.contributionCalendar.weeks[].contributionDays[]";
20970
- const raw = execFileSync7(
21357
+ const raw = execFileSync8(
20971
21358
  "gh",
20972
- ["api", "graphql", "-f", `query=${query}`, "--jq", jq],
21359
+ ["api", "graphql", "-f", `query=${query2}`, "--jq", jq],
20973
21360
  { encoding: "utf8" }
20974
21361
  ).trim();
20975
21362
  if (!raw) return [];
@@ -21084,7 +21471,7 @@ function adviceContextFor(cwd, env = process.env) {
21084
21471
  }
21085
21472
 
21086
21473
  // src/commands/advise/loadAdviceFragments.ts
21087
- import { readdirSync as readdirSync10, readFileSync as readFileSync29 } from "fs";
21474
+ import { readdirSync as readdirSync10, readFileSync as readFileSync30 } from "fs";
21088
21475
  import { basename as basename15, join as join55 } from "path";
21089
21476
 
21090
21477
  // src/commands/advise/adviceDir.ts
@@ -21127,7 +21514,7 @@ function loadAdviceFragments(dir = adviceDir()) {
21127
21514
  return readdirSync10(dir).filter((file) => file.endsWith(".md")).sort().map(
21128
21515
  (file) => parseAdviceFragment(
21129
21516
  basename15(file, ".md"),
21130
- readFileSync29(join55(dir, file), "utf8")
21517
+ readFileSync30(join55(dir, file), "utf8")
21131
21518
  )
21132
21519
  );
21133
21520
  }
@@ -21828,7 +22215,7 @@ async function resolveCheckBump(check2) {
21828
22215
  }
21829
22216
 
21830
22217
  // src/commands/backlog/readJsonPayload.ts
21831
- import { readFileSync as readFileSync30 } from "fs";
22218
+ import { readFileSync as readFileSync31 } from "fs";
21832
22219
  import chalk39 from "chalk";
21833
22220
  function fail(message4) {
21834
22221
  console.error(chalk39.red(message4));
@@ -21840,7 +22227,7 @@ function describe2(error) {
21840
22227
  async function readSource(source) {
21841
22228
  try {
21842
22229
  if (source === "-") return (await readStdinBuffer()).toString("utf8");
21843
- return readFileSync30(source, "utf8");
22230
+ return readFileSync31(source, "utf8");
21844
22231
  } catch (error) {
21845
22232
  return fail(
21846
22233
  `Cannot read the payload from ${source === "-" ? "stdin" : source}: ${describe2(error)}`
@@ -23370,7 +23757,7 @@ function ensureRemoteOrigin() {
23370
23757
 
23371
23758
  // src/commands/backlog/add/shared.ts
23372
23759
  import { spawnSync as spawnSync7 } from "child_process";
23373
- import { mkdtempSync, readFileSync as readFileSync31, unlinkSync as unlinkSync4, writeFileSync as writeFileSync23 } from "fs";
23760
+ import { mkdtempSync, readFileSync as readFileSync32, unlinkSync as unlinkSync4, writeFileSync as writeFileSync23 } from "fs";
23374
23761
  import { tmpdir as tmpdir2 } from "os";
23375
23762
  import { join as join59 } from "path";
23376
23763
  import enquirer4 from "enquirer";
@@ -23420,7 +23807,7 @@ function openEditor() {
23420
23807
  unlinkSync4(filePath);
23421
23808
  return void 0;
23422
23809
  }
23423
- const content = readFileSync31(filePath, "utf8").trim();
23810
+ const content = readFileSync32(filePath, "utf8").trim();
23424
23811
  unlinkSync4(filePath);
23425
23812
  return content || void 0;
23426
23813
  }
@@ -23855,11 +24242,11 @@ function startProposedRun(id, startOn, cwd = process.cwd()) {
23855
24242
  import { randomUUID as randomUUID10 } from "crypto";
23856
24243
 
23857
24244
  // src/commands/backlog/propose/mutateLedger.ts
23858
- import { mkdirSync as mkdirSync15, readFileSync as readFileSync32, renameSync as renameSync4, writeFileSync as writeFileSync24 } from "fs";
24245
+ import { mkdirSync as mkdirSync15, readFileSync as readFileSync33, renameSync as renameSync4, writeFileSync as writeFileSync24 } from "fs";
23859
24246
  import { dirname as dirname30 } from "path";
23860
24247
  function readLedger(path128) {
23861
24248
  try {
23862
- const parsed = JSON.parse(readFileSync32(path128, "utf8"));
24249
+ const parsed = JSON.parse(readFileSync33(path128, "utf8"));
23863
24250
  return { open: parsed.open ?? [], created: parsed.created };
23864
24251
  } catch {
23865
24252
  return { open: [] };
@@ -24080,8 +24467,8 @@ async function createsCycle(orm, linkType, fromNum, toNum) {
24080
24467
  );
24081
24468
  return true;
24082
24469
  }
24083
- async function link(fromId, toId, opts) {
24084
- const linkType = parseLinkType(opts.type);
24470
+ async function link(fromId, toId, opts2) {
24471
+ const linkType = parseLinkType(opts2.type);
24085
24472
  if (!linkType) return;
24086
24473
  const fromNum = parseItemId(fromId);
24087
24474
  const toNum = parseItemId(toId);
@@ -24396,7 +24783,7 @@ function hasLocalChanges() {
24396
24783
  import {
24397
24784
  existsSync as existsSync50,
24398
24785
  mkdirSync as mkdirSync16,
24399
- readFileSync as readFileSync34,
24786
+ readFileSync as readFileSync35,
24400
24787
  unlinkSync as unlinkSync5,
24401
24788
  writeFileSync as writeFileSync25
24402
24789
  } from "fs";
@@ -24410,11 +24797,11 @@ function bootedAt() {
24410
24797
  }
24411
24798
 
24412
24799
  // src/commands/backlog/processStartedAt.ts
24413
- import { readFileSync as readFileSync33 } from "fs";
24800
+ import { readFileSync as readFileSync34 } from "fs";
24414
24801
  var clockTicksPerSecond = 100;
24415
24802
  function processStartedAt(pid) {
24416
24803
  try {
24417
- const stat5 = readFileSync33(`/proc/${pid}/stat`, "utf8");
24804
+ const stat5 = readFileSync34(`/proc/${pid}/stat`, "utf8");
24418
24805
  const fields = stat5.slice(stat5.lastIndexOf(")") + 2).split(" ");
24419
24806
  const ticks = Number(fields[19]);
24420
24807
  if (!Number.isFinite(ticks)) return void 0;
@@ -24454,7 +24841,7 @@ function foreignLockHolder(itemId2) {
24454
24841
  const lockPath = getLockPath(itemId2);
24455
24842
  if (!existsSync50(lockPath)) return null;
24456
24843
  try {
24457
- const lock2 = JSON.parse(readFileSync34(lockPath, "utf8"));
24844
+ const lock2 = JSON.parse(readFileSync35(lockPath, "utf8"));
24458
24845
  if (typeof lock2.pid !== "number" || lock2.pid === process.pid) return null;
24459
24846
  if (!isProcessAlive(lock2.pid)) return null;
24460
24847
  if (isStaleLock(lock2.pid, lock2.timestamp)) return null;
@@ -25024,21 +25411,21 @@ function describeError(error) {
25024
25411
 
25025
25412
  // src/commands/sessions/setSessionStatus.ts
25026
25413
  var RELIABLE_ATTEMPTS = 3;
25027
- async function setSessionStatus(status2, opts = {}) {
25414
+ async function setSessionStatus(status2, opts2 = {}) {
25028
25415
  const sessionId2 = process.env.ASSIST_SESSION_ID;
25029
- logHookFired(status2, sessionId2, opts.source);
25416
+ logHookFired(status2, sessionId2, opts2.source);
25030
25417
  if (!sessionId2) return;
25031
25418
  const payload = buildPayload(
25032
25419
  sessionId2,
25033
25420
  status2,
25034
- opts.source,
25035
- opts.readsClaudeHookInput === false ? void 0 : await readHookClaudeSessionId()
25421
+ opts2.source,
25422
+ opts2.readsClaudeHookInput === false ? void 0 : await readHookClaudeSessionId()
25036
25423
  );
25037
25424
  await deliverSetStatus(
25038
25425
  sessionId2,
25039
25426
  status2,
25040
25427
  payload,
25041
- opts.ack ? RELIABLE_ATTEMPTS : 1
25428
+ opts2.ack ? RELIABLE_ATTEMPTS : 1
25042
25429
  );
25043
25430
  }
25044
25431
  function buildPayload(sessionId2, status2, source, claudeSessionId) {
@@ -25062,12 +25449,12 @@ function logHookFired(status2, sessionId2, source) {
25062
25449
  import { existsSync as existsSync53, unwatchFile, watchFile } from "fs";
25063
25450
 
25064
25451
  // src/commands/backlog/readSignal.ts
25065
- import { existsSync as existsSync52, readFileSync as readFileSync35 } from "fs";
25452
+ import { existsSync as existsSync52, readFileSync as readFileSync36 } from "fs";
25066
25453
  function readSignal() {
25067
25454
  const path128 = getSignalPath();
25068
25455
  if (!path128 || !existsSync52(path128)) return void 0;
25069
25456
  try {
25070
- return JSON.parse(readFileSync35(path128, "utf8"));
25457
+ return JSON.parse(readFileSync36(path128, "utf8"));
25071
25458
  } catch {
25072
25459
  return void 0;
25073
25460
  }
@@ -25254,13 +25641,13 @@ async function persistPhaseSessionId(itemId2, phaseIdx, claudeSessionId) {
25254
25641
  }
25255
25642
 
25256
25643
  // src/shared/emitActivity.ts
25257
- import { mkdirSync as mkdirSync18, readFileSync as readFileSync36, rmSync as rmSync4, writeFileSync as writeFileSync27 } from "fs";
25644
+ import { mkdirSync as mkdirSync18, readFileSync as readFileSync37, rmSync as rmSync4, writeFileSync as writeFileSync27 } from "fs";
25258
25645
  import { homedir as homedir18 } from "os";
25259
25646
  import { dirname as dirname31, join as join63 } from "path";
25260
25647
  import { z as z19 } from "zod";
25261
25648
  var activitySchema = z19.object({
25262
25649
  kind: z19.enum(["command", "backlog"]),
25263
- harness: z19.enum(["claude", "codex", "pi"]).optional(),
25650
+ harness: z19.enum(harnessKinds).optional(),
25264
25651
  name: z19.string().optional(),
25265
25652
  itemId: z19.number().optional(),
25266
25653
  itemName: z19.string().optional(),
@@ -25285,7 +25672,7 @@ function emitActivity(activity2) {
25285
25672
  }
25286
25673
  function readActivity(path128) {
25287
25674
  try {
25288
- return JSON.parse(readFileSync36(path128, "utf8"));
25675
+ return JSON.parse(readFileSync37(path128, "utf8"));
25289
25676
  } catch {
25290
25677
  return void 0;
25291
25678
  }
@@ -25639,7 +26026,7 @@ async function next(options2, startId) {
25639
26026
  // src/commands/backlog/registerNextCommand.ts
25640
26027
  function registerNextCommand(cmd) {
25641
26028
  cmd.command("next").argument("[id]", "Backlog item ID to run first").description("Pick and run the next backlog item, or open /draft if none").option("-w, --write", "Run Claude with auto permission mode (default)").option("--no-write", "Run Claude without auto permission mode").option("--once", "Exit after the first completed item run").action(
25642
- (id, opts) => next({ allowEdits: opts.write !== false, once: opts.once }, id)
26029
+ (id, opts2) => next({ allowEdits: opts2.write !== false, once: opts2.once }, id)
25643
26030
  );
25644
26031
  }
25645
26032
 
@@ -25950,9 +26337,9 @@ function registerRefineCommand(cmd) {
25950
26337
  "--harness <kind>",
25951
26338
  "Coding harness to launch (claude|codex|pi); defaults to the configured harness.engine. Exits with the reasons, without launching, when Refine is unavailable on it"
25952
26339
  ).action(
25953
- (id, opts) => refine(id, {
25954
- once: opts.once,
25955
- harness: resolveHarness2(opts.harness)
26340
+ (id, opts2) => refine(id, {
26341
+ once: opts2.once,
26342
+ harness: resolveHarness2(opts2.harness)
25956
26343
  })
25957
26344
  );
25958
26345
  }
@@ -25993,12 +26380,12 @@ function registerRefreshDocsCommand(cmd) {
25993
26380
 
25994
26381
  // src/commands/backlog/rewindPhase.ts
25995
26382
  import chalk93 from "chalk";
25996
- async function rewindPhase(id, phase, opts) {
26383
+ async function rewindPhase(id, phase, opts2) {
25997
26384
  const phaseNumber = Number.parseInt(phase, 10);
25998
26385
  const found = await findOneItem(id);
25999
26386
  if (!found) return;
26000
26387
  const { orm, item } = found;
26001
- const result = await rewindItemToPhase(orm, item, phaseNumber, opts.reason);
26388
+ const result = await rewindItemToPhase(orm, item, phaseNumber, opts2.reason);
26002
26389
  if (!result.ok) {
26003
26390
  console.log(chalk93.red(result.error));
26004
26391
  process.exitCode = 1;
@@ -26036,14 +26423,14 @@ function registerRunCommand(cmd) {
26036
26423
  "--resume-session <id>",
26037
26424
  "Resume an interrupted Claude session for the current phase (used by the sessions daemon on restart)"
26038
26425
  ).action(
26039
- async (id, opts) => {
26040
- if (!opts.resumeSession) await pullIfConfigured();
26041
- const harness = resolveHarness2(opts.harness, "run");
26426
+ async (id, opts2) => {
26427
+ if (!opts2.resumeSession) await pullIfConfigured();
26428
+ const harness = resolveHarness2(opts2.harness, "run");
26042
26429
  await run3(id, {
26043
- allowEdits: opts.write !== false,
26430
+ allowEdits: opts2.write !== false,
26044
26431
  harness,
26045
- model: resolveModel(opts.model, "run", harness),
26046
- resumeSessionId: opts.resumeSession
26432
+ model: resolveModel(opts2.model, "run", harness),
26433
+ resumeSessionId: opts2.resumeSession
26047
26434
  });
26048
26435
  }
26049
26436
  );
@@ -26052,15 +26439,15 @@ function registerRunCommand(cmd) {
26052
26439
 
26053
26440
  // src/commands/backlog/search.ts
26054
26441
  import chalk94 from "chalk";
26055
- async function search(query) {
26056
- const items3 = await searchBacklog(query);
26442
+ async function search(query2) {
26443
+ const items3 = await searchBacklog(query2);
26057
26444
  if (items3.length === 0) {
26058
- console.log(chalk94.dim(`No items matching "${query}".`));
26445
+ console.log(chalk94.dim(`No items matching "${query2}".`));
26059
26446
  return;
26060
26447
  }
26061
26448
  console.log(
26062
26449
  chalk94.dim(
26063
- `${items3.length} item${items3.length === 1 ? "" : "s"} matching "${query}":
26450
+ `${items3.length} item${items3.length === 1 ? "" : "s"} matching "${query2}":
26064
26451
  `
26065
26452
  )
26066
26453
  );
@@ -27666,7 +28053,7 @@ function stripEnvPrefix(parts2) {
27666
28053
  }
27667
28054
 
27668
28055
  // src/commands/cliHook/isGhGraphqlIssueMutation.ts
27669
- import { readFileSync as readFileSync37 } from "fs";
28056
+ import { readFileSync as readFileSync38 } from "fs";
27670
28057
  var ISSUE_MUTATION = /\bmutation\b[\s\S]*(?:issue|comment|review|label|assign|reaction|milestone)/i;
27671
28058
  var FILE_REFERENCE = /(?:=@|--input[\s=]+)["']?([^\s"';&|)]+)/g;
27672
28059
  function isGhGraphqlIssueMutation(command) {
@@ -27678,7 +28065,7 @@ function isGhGraphqlIssueMutation(command) {
27678
28065
  }
27679
28066
  function readOrEmpty(path128) {
27680
28067
  try {
27681
- return readFileSync37(path128, "utf8");
28068
+ return readFileSync38(path128, "utf8");
27682
28069
  } catch {
27683
28070
  return "";
27684
28071
  }
@@ -28033,7 +28420,7 @@ function extractGraphqlQuery(args) {
28033
28420
  }
28034
28421
 
28035
28422
  // src/shared/loadCliReads.ts
28036
- import { existsSync as existsSync55, readFileSync as readFileSync38, writeFileSync as writeFileSync28 } from "fs";
28423
+ import { existsSync as existsSync55, readFileSync as readFileSync39, writeFileSync as writeFileSync28 } from "fs";
28037
28424
  import { dirname as dirname32, resolve as resolve18 } from "path";
28038
28425
  import { fileURLToPath as fileURLToPath6 } from "url";
28039
28426
  var __filename3 = fileURLToPath6(import.meta.url);
@@ -28043,7 +28430,7 @@ function packageRoot() {
28043
28430
  }
28044
28431
  function readLines(path128) {
28045
28432
  if (!existsSync55(path128)) return [];
28046
- return readFileSync38(path128, "utf8").split("\n").filter((line) => line.trim() !== "");
28433
+ return readFileSync39(path128, "utf8").split("\n").filter((line) => line.trim() !== "");
28047
28434
  }
28048
28435
  var cachedReads;
28049
28436
  var cachedWrites;
@@ -28089,7 +28476,7 @@ function findCliWrite(command) {
28089
28476
  }
28090
28477
 
28091
28478
  // src/shared/readSettingsPerms.ts
28092
- import { existsSync as existsSync56, readFileSync as readFileSync39 } from "fs";
28479
+ import { existsSync as existsSync56, readFileSync as readFileSync40 } from "fs";
28093
28480
  import { homedir as homedir19 } from "os";
28094
28481
  import { join as join64 } from "path";
28095
28482
  function readSettingsPerms(key) {
@@ -28110,7 +28497,7 @@ function readSettingsPerms(key) {
28110
28497
  function readPermissionArray(filePath, key) {
28111
28498
  if (!existsSync56(filePath)) return [];
28112
28499
  try {
28113
- const data = JSON.parse(readFileSync39(filePath, "utf8"));
28500
+ const data = JSON.parse(readFileSync40(filePath, "utf8"));
28114
28501
  const arr = data?.permissions?.[key];
28115
28502
  return Array.isArray(arr) ? arr.filter((e) => typeof e === "string") : [];
28116
28503
  } catch {
@@ -28380,14 +28767,14 @@ function findDocsPathDeny(toolName, rawCommand, root2) {
28380
28767
  }
28381
28768
 
28382
28769
  // src/commands/schema/isSchemaPath.ts
28383
- import { readFileSync as readFileSync40 } from "fs";
28770
+ import { readFileSync as readFileSync41 } from "fs";
28384
28771
  import { relative as relative8, resolve as resolve21 } from "path";
28385
28772
  var SCHEMA_LOCK_REASON = "Database schema files (src/shared/db/migrations/migrationNNNN*.ts, src/shared/db/migrations.ts, src/shared/db/schema.ts and any src/shared/db/*.ts that defines a pgTable) are locked: a schema change needs the user's sign-off (see src/shared/db/CLAUDE.md). Confirm the schema change with the user first, then run `assist schema unlock` to request a PIN and wait for the user to confirm it with `assist schema confirm <pin>` before retrying. In a backlog item session the unlock lasts for the current phase on this harness; otherwise it lasts for this conversation only.";
28386
28773
  var FIXED_SCHEMA_PATH = /^src\/shared\/db\/(?:migrations\/migration\d{4}[^/]*\.ts|migrations\.ts|schema\.ts)$/;
28387
28774
  var DB_MODULE = /^src\/shared\/db\/[^/]+\.ts$/;
28388
28775
  function readOrEmpty2(path128) {
28389
28776
  try {
28390
- return readFileSync40(path128, "utf8");
28777
+ return readFileSync41(path128, "utf8");
28391
28778
  } catch {
28392
28779
  return "";
28393
28780
  }
@@ -28462,7 +28849,7 @@ async function decideDocsGuard({
28462
28849
  }
28463
28850
 
28464
28851
  // src/commands/schema/isSchemaLocked.ts
28465
- import { existsSync as existsSync57, readFileSync as readFileSync41 } from "fs";
28852
+ import { existsSync as existsSync57, readFileSync as readFileSync42 } from "fs";
28466
28853
 
28467
28854
  // src/commands/schema/getSchemaSessionApprovalPath.ts
28468
28855
  import { join as join66 } from "path";
@@ -28494,7 +28881,7 @@ function getSchemaSessionApprovalPath(scope) {
28494
28881
  function approvalMatches(path128, identity) {
28495
28882
  try {
28496
28883
  const approval = JSON.parse(
28497
- readFileSync41(path128, "utf8")
28884
+ readFileSync42(path128, "utf8")
28498
28885
  );
28499
28886
  const conversation = approval.conversationId ?? approval.claudeSessionId;
28500
28887
  if (approval.harness !== void 0 && approval.harness !== identity.harness)
@@ -28709,7 +29096,7 @@ ${reasons.join("\n")}`);
28709
29096
  }
28710
29097
 
28711
29098
  // src/commands/permitCliReads.ts
28712
- import { existsSync as existsSync58, mkdirSync as mkdirSync20, readFileSync as readFileSync42, writeFileSync as writeFileSync29 } from "fs";
29099
+ import { existsSync as existsSync58, mkdirSync as mkdirSync20, readFileSync as readFileSync43, writeFileSync as writeFileSync29 } from "fs";
28713
29100
  import { homedir as homedir22 } from "os";
28714
29101
  import { join as join68 } from "path";
28715
29102
 
@@ -28979,7 +29366,7 @@ function logPath(cli) {
28979
29366
  function readCache(cli) {
28980
29367
  const path128 = logPath(cli);
28981
29368
  if (!existsSync58(path128)) return void 0;
28982
- return readFileSync42(path128, "utf8");
29369
+ return readFileSync43(path128, "utf8");
28983
29370
  }
28984
29371
  function writeCache(cli, output) {
28985
29372
  const dir = join68(homedir22(), ".assist");
@@ -29114,7 +29501,7 @@ function registerCliHook(program) {
29114
29501
  }
29115
29502
 
29116
29503
  // src/commands/codeComment/codeCommentConfirm.ts
29117
- import { existsSync as existsSync60, readFileSync as readFileSync44, unlinkSync as unlinkSync9, writeFileSync as writeFileSync30 } from "fs";
29504
+ import { existsSync as existsSync60, readFileSync as readFileSync45, unlinkSync as unlinkSync9, writeFileSync as writeFileSync30 } from "fs";
29118
29505
  import chalk125 from "chalk";
29119
29506
 
29120
29507
  // src/shared/isHashCommentFile.ts
@@ -29169,12 +29556,12 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
29169
29556
  }
29170
29557
 
29171
29558
  // src/commands/codeComment/readPinState.ts
29172
- import { existsSync as existsSync59, readFileSync as readFileSync43 } from "fs";
29559
+ import { existsSync as existsSync59, readFileSync as readFileSync44 } from "fs";
29173
29560
  function readPinState(pin2) {
29174
29561
  const path128 = getPinStatePath(pin2);
29175
29562
  if (!existsSync59(path128)) return void 0;
29176
29563
  try {
29177
- const state = JSON.parse(readFileSync43(path128, "utf8"));
29564
+ const state = JSON.parse(readFileSync44(path128, "utf8"));
29178
29565
  if (state.pin !== pin2) return void 0;
29179
29566
  return state;
29180
29567
  } catch {
@@ -29196,7 +29583,7 @@ function codeCommentConfirm(pin2) {
29196
29583
  process.exitCode = 1;
29197
29584
  return;
29198
29585
  }
29199
- const original = readFileSync44(state.file, "utf8");
29586
+ const original = readFileSync45(state.file, "utf8");
29200
29587
  const lines = original.split("\n");
29201
29588
  const index3 = state.line - 1;
29202
29589
  if (index3 > lines.length) {
@@ -29260,7 +29647,7 @@ import { randomUUID as randomUUID14 } from "crypto";
29260
29647
  import notifier from "node-notifier";
29261
29648
 
29262
29649
  // src/commands/notify/showNotification/showWindowsNotificationFromWsl.ts
29263
- import { spawn as spawn8 } from "child_process";
29650
+ import { spawn as spawn9 } from "child_process";
29264
29651
  import fs26 from "fs";
29265
29652
  import { createRequire as createRequire3 } from "module";
29266
29653
  import path40 from "path";
@@ -29280,7 +29667,7 @@ function showWindowsNotificationFromWsl(options2) {
29280
29667
  if (sound) {
29281
29668
  args.push("-s", "ms-winsoundevent:Notification.Default");
29282
29669
  }
29283
- const child2 = spawn8(snoreToastPath, args, {
29670
+ const child2 = spawn9(snoreToastPath, args, {
29284
29671
  detached: true,
29285
29672
  stdio: "ignore"
29286
29673
  });
@@ -29580,7 +29967,7 @@ async function listCodexHooks(server, cwd) {
29580
29967
  }
29581
29968
 
29582
29969
  // src/commands/sync/openCodexAppServer.ts
29583
- import { spawn as spawn9 } from "child_process";
29970
+ import { spawn as spawn10 } from "child_process";
29584
29971
  import { createInterface as createInterface6 } from "readline";
29585
29972
 
29586
29973
  // src/commands/sync/createCodexRpcClient.ts
@@ -29653,7 +30040,7 @@ function watchCodexAppServer(child2, fail14) {
29653
30040
  // src/commands/sync/openCodexAppServer.ts
29654
30041
  var TIMEOUT_MS3 = 2e4;
29655
30042
  async function openCodexAppServer(homeDir) {
29656
- const child2 = spawn9(harnesses.codex.command, ["app-server"], {
30043
+ const child2 = spawn10(harnesses.codex.command, ["app-server"], {
29657
30044
  env: { ...process.env, CODEX_HOME: homeDir },
29658
30045
  stdio: ["pipe", "pipe", "pipe"]
29659
30046
  });
@@ -31595,8 +31982,8 @@ function registerConfig(program) {
31595
31982
  import chalk153 from "chalk";
31596
31983
 
31597
31984
  // src/commands/browser/formatInspectMatches.ts
31598
- function formatInspectMatches({ matches, total: total2 }, query) {
31599
- if (total2 === 0) return [`no elements match ${query}`];
31985
+ function formatInspectMatches({ matches, total: total2 }, query2) {
31986
+ if (total2 === 0) return [`no elements match ${query2}`];
31600
31987
  const lines = matches.flatMap((match, index3) => [
31601
31988
  `[${index3 + 1}/${total2}] ${match.width}\xD7${match.height} ${JSON.stringify(match.text)}`,
31602
31989
  ...match.chain.map((step3) => ` ${step3}`)
@@ -31665,18 +32052,18 @@ async function browserInspect(selector, options2) {
31665
32052
  );
31666
32053
  process.exit(1);
31667
32054
  }
31668
- const query = options2.text ? { text: options2.text } : { selector };
32055
+ const query2 = options2.text ? { text: options2.text } : { selector };
31669
32056
  const result = await requestTab(options2.server, {
31670
32057
  op: "inspect",
31671
32058
  url: options2.url,
31672
- ...query
32059
+ ...query2
31673
32060
  });
31674
32061
  const label = options2.text ? `text ${JSON.stringify(options2.text)}` : `selector ${selector}`;
31675
32062
  for (const line of formatInspectMatches(result, label)) console.log(line);
31676
32063
  }
31677
32064
 
31678
32065
  // src/commands/browser/browserRun.ts
31679
- import { readFileSync as readFileSync46 } from "fs";
32066
+ import { readFileSync as readFileSync47 } from "fs";
31680
32067
  import chalk154 from "chalk";
31681
32068
 
31682
32069
  // src/commands/browser/formatRunOutcome.ts
@@ -31696,7 +32083,7 @@ function formatRunOutcome(run5) {
31696
32083
  async function browserRun(options2) {
31697
32084
  let code;
31698
32085
  try {
31699
- code = readFileSync46(options2.file, "utf8");
32086
+ code = readFileSync47(options2.file, "utf8");
31700
32087
  } catch (error) {
31701
32088
  console.error(
31702
32089
  chalk154.red(
@@ -32247,7 +32634,7 @@ function registerDb(program) {
32247
32634
  }
32248
32635
 
32249
32636
  // src/commands/deploy/redirect.ts
32250
- import { existsSync as existsSync64, readFileSync as readFileSync47, writeFileSync as writeFileSync33 } from "fs";
32637
+ import { existsSync as existsSync64, readFileSync as readFileSync48, writeFileSync as writeFileSync33 } from "fs";
32251
32638
  import chalk162 from "chalk";
32252
32639
  var TRAILING_SLASH_SCRIPT = ` <script>
32253
32640
  if (!window.location.pathname.endsWith('/')) {
@@ -32260,7 +32647,7 @@ function redirect() {
32260
32647
  console.log(chalk162.yellow("No index.html found"));
32261
32648
  return;
32262
32649
  }
32263
- const content = readFileSync47(indexPath, "utf8");
32650
+ const content = readFileSync48(indexPath, "utf8");
32264
32651
  if (content.includes("window.location.pathname.endsWith('/')")) {
32265
32652
  console.log(chalk162.dim("Trailing slash script already present"));
32266
32653
  return;
@@ -32351,7 +32738,7 @@ function printWeekHeader(week, state) {
32351
32738
  }
32352
32739
 
32353
32740
  // src/commands/devlog/loadDevEntry.ts
32354
- import { readFileSync as readFileSync48 } from "fs";
32741
+ import { readFileSync as readFileSync49 } from "fs";
32355
32742
  import { parse as parseYaml3 } from "yaml";
32356
32743
 
32357
32744
  // src/commands/devlog/devEntryPath.ts
@@ -32366,7 +32753,7 @@ function asString(value) {
32366
32753
  }
32367
32754
  function readFrontmatter(path128) {
32368
32755
  try {
32369
- const match = readFileSync48(path128, "utf8").match(/^---\n([\s\S]*?)\n---/);
32756
+ const match = readFileSync49(path128, "utf8").match(/^---\n([\s\S]*?)\n---/);
32370
32757
  return match ? parseYaml3(match[1]) ?? {} : null;
32371
32758
  } catch {
32372
32759
  return null;
@@ -32404,7 +32791,7 @@ function resolveDevDir() {
32404
32791
  }
32405
32792
 
32406
32793
  // src/commands/devlog/next/fetchCommitsAfter.ts
32407
- import { execFileSync as execFileSync8 } from "child_process";
32794
+ import { execFileSync as execFileSync9 } from "child_process";
32408
32795
  var RECORD_SEPARATOR = "";
32409
32796
  function parseRecord(record3) {
32410
32797
  const [header, ...fileLines] = record3.trim().split("\n");
@@ -32434,7 +32821,7 @@ function parseNameOnlyLog(output, ignore3, afterDate) {
32434
32821
  }
32435
32822
  function fetchCommitsAfter(ignore3, afterDate) {
32436
32823
  const range = afterDate ? [`--since=${afterDate}T00:00:00`] : [];
32437
- const output = execFileSync8(
32824
+ const output = execFileSync9(
32438
32825
  "git",
32439
32826
  [
32440
32827
  "log",
@@ -32469,7 +32856,7 @@ function findTargetWeek(weeks, { lastWeek, skip: skip3, today }) {
32469
32856
  import chalk165 from "chalk";
32470
32857
 
32471
32858
  // src/shared/getRepoName.ts
32472
- import { existsSync as existsSync65, readFileSync as readFileSync49 } from "fs";
32859
+ import { existsSync as existsSync65, readFileSync as readFileSync50 } from "fs";
32473
32860
  import { basename as basename19, join as join80 } from "path";
32474
32861
  function getRepoName() {
32475
32862
  const config = loadConfig();
@@ -32479,7 +32866,7 @@ function getRepoName() {
32479
32866
  const packageJsonPath = join80(process.cwd(), "package.json");
32480
32867
  if (existsSync65(packageJsonPath)) {
32481
32868
  try {
32482
- const content = readFileSync49(packageJsonPath, "utf8");
32869
+ const content = readFileSync50(packageJsonPath, "utf8");
32483
32870
  const pkg = JSON.parse(content);
32484
32871
  if (pkg.name) {
32485
32872
  return pkg.name;
@@ -32576,7 +32963,7 @@ function loadDevWeeks(repoName, devDir) {
32576
32963
  import chalk168 from "chalk";
32577
32964
 
32578
32965
  // src/commands/devlog/resolveVersionSource.ts
32579
- import { execFileSync as execFileSync9 } from "child_process";
32966
+ import { execFileSync as execFileSync10 } from "child_process";
32580
32967
 
32581
32968
  // src/commands/devlog/sortedSemverVersions.ts
32582
32969
  import semver2 from "semver";
@@ -32629,7 +33016,7 @@ function stripToMinor(version2) {
32629
33016
 
32630
33017
  // src/commands/devlog/resolveVersionSource.ts
32631
33018
  function gitTags(...args) {
32632
- return execFileSync9("git", ["tag", "--list", ...args], { encoding: "utf8" }).split("\n").map((t) => t.trim()).filter(Boolean);
33019
+ return execFileSync10("git", ["tag", "--list", ...args], { encoding: "utf8" }).split("\n").map((t) => t.trim()).filter(Boolean);
32633
33020
  }
32634
33021
  function resolveVersionSource() {
32635
33022
  const headVersion = getVersionAtCommit("HEAD");
@@ -32649,9 +33036,9 @@ function resolveVersionSource() {
32649
33036
  }
32650
33037
 
32651
33038
  // src/commands/devlog/next/repoHasTags.ts
32652
- import { execFileSync as execFileSync10 } from "child_process";
33039
+ import { execFileSync as execFileSync11 } from "child_process";
32653
33040
  function repoHasTags() {
32654
- const output = execFileSync10("git", ["tag", "--list"], { encoding: "utf8" });
33041
+ const output = execFileSync11("git", ["tag", "--list"], { encoding: "utf8" });
32655
33042
  return output.trim().length > 0;
32656
33043
  }
32657
33044
 
@@ -32750,7 +33137,7 @@ function next2(options2) {
32750
33137
  }
32751
33138
 
32752
33139
  // src/commands/devlog/posted/posted.ts
32753
- import { readFileSync as readFileSync50, writeFileSync as writeFileSync34 } from "fs";
33140
+ import { readFileSync as readFileSync51, writeFileSync as writeFileSync34 } from "fs";
32754
33141
  import chalk169 from "chalk";
32755
33142
 
32756
33143
  // src/commands/devlog/posted/setFrontmatterSlack.ts
@@ -32772,7 +33159,7 @@ function fail7(message4) {
32772
33159
  }
32773
33160
  function readEntry(path128) {
32774
33161
  try {
32775
- return readFileSync50(path128, "utf8");
33162
+ return readFileSync51(path128, "utf8");
32776
33163
  } catch {
32777
33164
  fail7(`No dev entry at ${path128}`);
32778
33165
  }
@@ -32844,12 +33231,12 @@ import { mkdirSync as mkdirSync24, writeFileSync as writeFileSync36 } from "fs";
32844
33231
  import { mkdirSync as mkdirSync23, writeFileSync as writeFileSync35 } from "fs";
32845
33232
 
32846
33233
  // src/commands/slack/readSlackParts.ts
32847
- import { readFileSync as readFileSync51 } from "fs";
33234
+ import { readFileSync as readFileSync52 } from "fs";
32848
33235
  function readSlackParts(files) {
32849
33236
  return files.map((file) => {
32850
33237
  let contents;
32851
33238
  try {
32852
- contents = readFileSync51(file, "utf8");
33239
+ contents = readFileSync52(file, "utf8");
32853
33240
  } catch {
32854
33241
  console.error(`Error: Part file not found: ${file}`);
32855
33242
  process.exit(1);
@@ -32980,13 +33367,13 @@ function devlogSlackChannel() {
32980
33367
  }
32981
33368
 
32982
33369
  // src/commands/devlog/slack/readDevEntryFile.ts
32983
- import { readFileSync as readFileSync52 } from "fs";
33370
+ import { readFileSync as readFileSync53 } from "fs";
32984
33371
  import { parse as parseYaml4 } from "yaml";
32985
33372
  var FRONTMATTER2 = /^---\n([\s\S]*?)\n---\n?([\s\S]*)$/;
32986
33373
  function readDevEntryFile(path128) {
32987
33374
  let contents;
32988
33375
  try {
32989
- contents = readFileSync52(path128, "utf8");
33376
+ contents = readFileSync53(path128, "utf8");
32990
33377
  } catch {
32991
33378
  return null;
32992
33379
  }
@@ -33440,7 +33827,7 @@ function getDocsUnlockPinPath(pin2) {
33440
33827
  }
33441
33828
 
33442
33829
  // src/commands/docs/readDocsUnlockPinState.ts
33443
- import { existsSync as existsSync66, readFileSync as readFileSync53 } from "fs";
33830
+ import { existsSync as existsSync66, readFileSync as readFileSync54 } from "fs";
33444
33831
  function isPositiveInteger(value) {
33445
33832
  return Number.isInteger(value) && value > 0;
33446
33833
  }
@@ -33448,7 +33835,7 @@ function readDocsUnlockPinState(pin2) {
33448
33835
  const path128 = getDocsUnlockPinPath(pin2);
33449
33836
  if (!existsSync66(path128)) return void 0;
33450
33837
  try {
33451
- const state = JSON.parse(readFileSync53(path128, "utf8"));
33838
+ const state = JSON.parse(readFileSync54(path128, "utf8"));
33452
33839
  if (state.pin !== pin2) return void 0;
33453
33840
  if (!isPositiveInteger(state.itemId)) return void 0;
33454
33841
  if (!isPositiveInteger(state.phase)) return void 0;
@@ -33630,7 +34017,7 @@ function getSchemaUnlockPinPath(pin2) {
33630
34017
  }
33631
34018
 
33632
34019
  // src/commands/schema/readSchemaUnlockPinState.ts
33633
- import { existsSync as existsSync67, readFileSync as readFileSync54 } from "fs";
34020
+ import { existsSync as existsSync67, readFileSync as readFileSync55 } from "fs";
33634
34021
  function isPositiveInteger2(value) {
33635
34022
  return Number.isInteger(value) && value > 0;
33636
34023
  }
@@ -33657,7 +34044,7 @@ function readSchemaUnlockPinState(pin2) {
33657
34044
  const path128 = getSchemaUnlockPinPath(pin2);
33658
34045
  if (!existsSync67(path128)) return void 0;
33659
34046
  try {
33660
- const raw = JSON.parse(readFileSync54(path128, "utf8"));
34047
+ const raw = JSON.parse(readFileSync55(path128, "utf8"));
33661
34048
  if (raw.pin !== pin2) return void 0;
33662
34049
  return toState(raw);
33663
34050
  } catch {
@@ -33844,11 +34231,11 @@ async function checkBuildLocksCommand() {
33844
34231
  }
33845
34232
 
33846
34233
  // src/commands/dotnet/buildTree.ts
33847
- import { readFileSync as readFileSync55 } from "fs";
34234
+ import { readFileSync as readFileSync56 } from "fs";
33848
34235
  import path48 from "path";
33849
34236
  var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
33850
34237
  function getProjectRefs(csprojPath) {
33851
- const content = readFileSync55(csprojPath, "utf8");
34238
+ const content = readFileSync56(csprojPath, "utf8");
33852
34239
  const refs = [];
33853
34240
  for (const match of content.matchAll(PROJECT_REF_RE)) {
33854
34241
  refs.push(match[1].replace(/\\/g, "/"));
@@ -33865,7 +34252,7 @@ function buildTree(csprojPath, repoRoot3, visited = /* @__PURE__ */ new Set()) {
33865
34252
  for (const ref of getProjectRefs(abs)) {
33866
34253
  const childAbs = path48.resolve(dir, ref);
33867
34254
  try {
33868
- readFileSync55(childAbs);
34255
+ readFileSync56(childAbs);
33869
34256
  node.children.push(buildTree(childAbs, repoRoot3, visited));
33870
34257
  } catch {
33871
34258
  node.children.push({
@@ -33890,7 +34277,7 @@ function collectAllDeps(node) {
33890
34277
  }
33891
34278
 
33892
34279
  // src/commands/dotnet/findContainingSolutions.ts
33893
- import { readdirSync as readdirSync15, readFileSync as readFileSync56, statSync as statSync12 } from "fs";
34280
+ import { readdirSync as readdirSync15, readFileSync as readFileSync57, statSync as statSync12 } from "fs";
33894
34281
  import path49 from "path";
33895
34282
  function findSlnFiles(dir, maxDepth, depth = 0) {
33896
34283
  if (depth > maxDepth) return [];
@@ -33925,7 +34312,7 @@ function findContainingSolutions(csprojPath, repoRoot3) {
33925
34312
  const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
33926
34313
  for (const sln of slnFiles) {
33927
34314
  try {
33928
- const content = readFileSync56(sln, "utf8");
34315
+ const content = readFileSync57(sln, "utf8");
33929
34316
  if (pattern2.test(content)) {
33930
34317
  matches.push(path49.relative(repoRoot3, sln));
33931
34318
  }
@@ -34243,7 +34630,7 @@ function parseInspectReport(json) {
34243
34630
 
34244
34631
  // src/commands/dotnet/runInspectCode.ts
34245
34632
  import { execSync as execSync40 } from "child_process";
34246
- import { existsSync as existsSync70, readFileSync as readFileSync57, unlinkSync as unlinkSync13 } from "fs";
34633
+ import { existsSync as existsSync70, readFileSync as readFileSync58, unlinkSync as unlinkSync13 } from "fs";
34247
34634
  import { tmpdir as tmpdir5 } from "os";
34248
34635
  import path52 from "path";
34249
34636
  import chalk189 from "chalk";
@@ -34278,7 +34665,7 @@ function runInspectCode(slnPath, include, swea) {
34278
34665
  console.error(chalk189.red("Report file not generated"));
34279
34666
  process.exit(1);
34280
34667
  }
34281
- const xml = readFileSync57(reportPath, "utf8");
34668
+ const xml = readFileSync58(reportPath, "utf8");
34282
34669
  unlinkSync13(reportPath);
34283
34670
  return xml;
34284
34671
  }
@@ -35928,7 +36315,7 @@ Anything nested below the leaf level fails the run before a single write, naming
35928
36315
  }
35929
36316
 
35930
36317
  // src/commands/github/issue/commentIssue.ts
35931
- import { execFileSync as execFileSync11 } from "child_process";
36318
+ import { execFileSync as execFileSync12 } from "child_process";
35932
36319
 
35933
36320
  // src/shared/validateProposedContent.ts
35934
36321
  var URL_PATTERN3 = /https?:\/\/[^\s<>()[\]"'`]+/gi;
@@ -35995,7 +36382,7 @@ async function commentIssue(numberArg, options2) {
35995
36382
  const args = ["issue", "comment", String(number), "--body", body];
35996
36383
  if (options2.repo) args.push("--repo", options2.repo);
35997
36384
  try {
35998
- execFileSync11("gh", args, { stdio: "inherit" });
36385
+ execFileSync12("gh", args, { stdio: "inherit" });
35999
36386
  } catch {
36000
36387
  process.exit(1);
36001
36388
  }
@@ -36324,12 +36711,12 @@ function resolveIssueMilestone(target, wanted) {
36324
36711
  import { execSync as execSync42 } from "child_process";
36325
36712
 
36326
36713
  // src/commands/prs/currentPrSelector.ts
36327
- import { execFileSync as execFileSync12 } from "child_process";
36714
+ import { execFileSync as execFileSync13 } from "child_process";
36328
36715
  var PULL_REF = /^refs\/pull\/(\d+)\/head$/;
36329
36716
  var HEAD_REF = /^refs\/heads\/(.+)$/;
36330
36717
  function gitOrNull3(args) {
36331
36718
  try {
36332
- return execFileSync12("git", args, {
36719
+ return execFileSync13("git", args, {
36333
36720
  encoding: "utf8",
36334
36721
  stdio: ["pipe", "pipe", "pipe"],
36335
36722
  windowsHide: true
@@ -36529,7 +36916,7 @@ function attachArgs(attachments) {
36529
36916
  }
36530
36917
 
36531
36918
  // src/commands/prs/runGhWithAttachments.ts
36532
- import { execFileSync as execFileSync13 } from "child_process";
36919
+ import { execFileSync as execFileSync14 } from "child_process";
36533
36920
  import { basename as basename20 } from "path";
36534
36921
 
36535
36922
  // src/shared/removeStagedAttachments.ts
@@ -36557,7 +36944,7 @@ function reportPartialFailure(attachments, stderr) {
36557
36944
  function runGhWithAttachments(args, attachments) {
36558
36945
  const attaching = attachments.length > 0;
36559
36946
  try {
36560
- const stdout = execFileSync13("gh", args, {
36947
+ const stdout = execFileSync14("gh", args, {
36561
36948
  encoding: "utf8",
36562
36949
  stdio: ["inherit", "pipe", attaching ? "pipe" : "inherit"]
36563
36950
  });
@@ -36668,7 +37055,7 @@ The project scope is needed for --project: gh auth refresh -h github.com -s proj
36668
37055
  }
36669
37056
 
36670
37057
  // src/commands/github/issue/fetchIssue.ts
36671
- import { execFileSync as execFileSync14 } from "child_process";
37058
+ import { execFileSync as execFileSync15 } from "child_process";
36672
37059
  function fetchIssue2(number, repo) {
36673
37060
  const args = [
36674
37061
  "issue",
@@ -36680,7 +37067,7 @@ function fetchIssue2(number, repo) {
36680
37067
  if (repo) args.push("--repo", repo);
36681
37068
  let raw;
36682
37069
  try {
36683
- raw = execFileSync14("gh", args, { encoding: "utf8" });
37070
+ raw = execFileSync15("gh", args, { encoding: "utf8" });
36684
37071
  } catch {
36685
37072
  console.error(`Could not fetch issue #${number} with gh issue view`);
36686
37073
  process.exit(1);
@@ -36745,14 +37132,14 @@ function fetchIssueToWorkingFile(number, repo) {
36745
37132
  }
36746
37133
 
36747
37134
  // src/commands/github/issue/resumeIssueBody.ts
36748
- import { existsSync as existsSync71, readFileSync as readFileSync58 } from "fs";
37135
+ import { existsSync as existsSync71, readFileSync as readFileSync59 } from "fs";
36749
37136
  function resumeIssueBody(slug2, number, updatedAt) {
36750
37137
  const { bodyPath, metaPath } = issueWorkingFile(slug2, number);
36751
37138
  if (!existsSync71(bodyPath) || !existsSync71(metaPath)) return void 0;
36752
37139
  try {
36753
- const meta = JSON.parse(readFileSync58(metaPath, "utf8"));
37140
+ const meta = JSON.parse(readFileSync59(metaPath, "utf8"));
36754
37141
  if (meta.updatedAt !== updatedAt) return void 0;
36755
- return readFileSync58(bodyPath, "utf8");
37142
+ return readFileSync59(bodyPath, "utf8");
36756
37143
  } catch {
36757
37144
  return void 0;
36758
37145
  }
@@ -36790,12 +37177,12 @@ function prepareIssueEdit(number, repo, fresh, proposed) {
36790
37177
  }
36791
37178
 
36792
37179
  // src/commands/github/issue/pushIssueBody.ts
36793
- import { execFileSync as execFileSync15 } from "child_process";
37180
+ import { execFileSync as execFileSync16 } from "child_process";
36794
37181
  function pushIssueBody(number, repo, bodyPath) {
36795
37182
  const args = ["issue", "edit", String(number), "--body-file", bodyPath];
36796
37183
  if (repo) args.push("--repo", repo);
36797
37184
  try {
36798
- execFileSync15("gh", args, { stdio: "inherit" });
37185
+ execFileSync16("gh", args, { stdio: "inherit" });
36799
37186
  } catch {
36800
37187
  process.exit(1);
36801
37188
  }
@@ -36874,12 +37261,12 @@ function setIssueParent(number, repo, parentArg) {
36874
37261
  }
36875
37262
 
36876
37263
  // src/commands/github/issue/viewIssue.ts
36877
- import { execFileSync as execFileSync16 } from "child_process";
37264
+ import { execFileSync as execFileSync17 } from "child_process";
36878
37265
  function viewIssue(number, repo) {
36879
37266
  const args = ["issue", "view", String(number)];
36880
37267
  if (repo) args.push("--repo", repo);
36881
37268
  try {
36882
- execFileSync16("gh", args, { stdio: "inherit" });
37269
+ execFileSync17("gh", args, { stdio: "inherit" });
36883
37270
  } catch {
36884
37271
  process.exit(1);
36885
37272
  }
@@ -36933,7 +37320,7 @@ function registerEditIssue(issueCommand) {
36933
37320
  }
36934
37321
 
36935
37322
  // src/commands/github/issue/editIssueComment.ts
36936
- import { execFileSync as execFileSync17 } from "child_process";
37323
+ import { execFileSync as execFileSync18 } from "child_process";
36937
37324
  var USAGE5 = "Usage: assist github issue edit-comment <comment-id> --body <body> [-R <owner>/<repo>]";
36938
37325
  async function editIssueComment(commentIdArg, options2) {
36939
37326
  const commentId = Number.parseInt(commentIdArg, 10);
@@ -36960,7 +37347,7 @@ async function editIssueComment(commentIdArg, options2) {
36960
37347
  ];
36961
37348
  let raw;
36962
37349
  try {
36963
- raw = execFileSync17("gh", args, {
37350
+ raw = execFileSync18("gh", args, {
36964
37351
  input: JSON.stringify({ body }),
36965
37352
  encoding: "utf8"
36966
37353
  });
@@ -37842,11 +38229,11 @@ function registerJira(program) {
37842
38229
 
37843
38230
  // src/commands/backlog/registerRefineLaunch.ts
37844
38231
  var HARNESS_FLAG = "Coding harness to launch (claude|codex|pi); defaults to the configured harness.engine. Exits with the reasons, without launching, when Refine is unavailable on it";
37845
- function runRefine(id, opts) {
38232
+ function runRefine(id, opts2) {
37846
38233
  return refine(id, {
37847
- once: opts.once,
37848
- resumeSessionId: opts.resumeSession,
37849
- harness: resolveHarness2(opts.harness)
38234
+ once: opts2.once,
38235
+ resumeSessionId: opts2.resumeSession,
38236
+ harness: resolveHarness2(opts2.harness)
37850
38237
  });
37851
38238
  }
37852
38239
  function registerRefineLaunch(program, resumeFlag) {
@@ -37860,7 +38247,7 @@ function registerRefineLaunch(program, resumeFlag) {
37860
38247
  import chalk202 from "chalk";
37861
38248
 
37862
38249
  // src/commands/review/checkoutPr.ts
37863
- import { execFileSync as execFileSync20 } from "child_process";
38250
+ import { execFileSync as execFileSync21 } from "child_process";
37864
38251
 
37865
38252
  // src/commands/review/clearStalePrBranch.ts
37866
38253
  var tipSetFromRemote = /^branch: (Created from|Reset to)|^fetch\b|: Fast-forward$/;
@@ -38038,7 +38425,7 @@ var persistedSessionSchema = z23.object({
38038
38425
  generatedTitle: z23.string().optional(),
38039
38426
  subtitle: z23.string().optional(),
38040
38427
  commandType: z23.enum(["claude", "run", "assist"]),
38041
- harness: z23.enum(["claude", "codex", "pi"]).optional(),
38428
+ harness: z23.enum(harnessKinds).optional(),
38042
38429
  status: z23.enum(["running", "waiting", "done", "error", "stopped"]).optional(),
38043
38430
  error: z23.string().optional(),
38044
38431
  cwd: z23.string(),
@@ -38210,7 +38597,7 @@ function detectInstallCommand(dir) {
38210
38597
  }
38211
38598
 
38212
38599
  // src/commands/sessions/daemon/worktree/spawnInstall.ts
38213
- import { spawn as spawn10 } from "child_process";
38600
+ import { spawn as spawn11 } from "child_process";
38214
38601
 
38215
38602
  // src/commands/sessions/daemon/worktree/installInvocation.ts
38216
38603
  function installInvocation(worktreePath, command) {
@@ -38285,7 +38672,7 @@ function killTree(pid) {
38285
38672
  var STDERR_TAIL = 2e3;
38286
38673
  function spawnInstall(worktreePath, cwd, command, where, onDone) {
38287
38674
  daemonLog(`worktree ${worktreePath} installing deps${where}: ${command}`);
38288
- const child2 = spawn10(...installInvocation(cwd, command));
38675
+ const child2 = spawn11(...installInvocation(cwd, command));
38289
38676
  trackInstall(worktreePath, child2);
38290
38677
  let stderr = "";
38291
38678
  child2.stderr?.on("data", (chunk2) => {
@@ -38491,13 +38878,13 @@ function prCliCommands(number, cwd) {
38491
38878
  }
38492
38879
 
38493
38880
  // src/commands/review/prHeadBranch.ts
38494
- import { execFileSync as execFileSync18 } from "child_process";
38881
+ import { execFileSync as execFileSync19 } from "child_process";
38495
38882
  function prHeadBranch({
38496
38883
  headBranch
38497
38884
  }) {
38498
38885
  try {
38499
38886
  return headBranch.parse(
38500
- execFileSync18(headBranch.file, headBranch.args, {
38887
+ execFileSync19(headBranch.file, headBranch.args, {
38501
38888
  encoding: "utf8",
38502
38889
  stdio: ["ignore", "pipe", "pipe"]
38503
38890
  })
@@ -38568,7 +38955,7 @@ function worktreeHoldingBranch(cwd, branch2) {
38568
38955
  import chalk201 from "chalk";
38569
38956
 
38570
38957
  // src/commands/review/azCliProblem.ts
38571
- import { execFileSync as execFileSync19 } from "child_process";
38958
+ import { execFileSync as execFileSync20 } from "child_process";
38572
38959
 
38573
38960
  // src/commands/review/azFailureProblem.ts
38574
38961
  var azProblems = {
@@ -38596,7 +38983,7 @@ function azFailureProblem(error) {
38596
38983
  // src/commands/review/azCliProblem.ts
38597
38984
  function runAz(args) {
38598
38985
  try {
38599
- execFileSync19("az", args, { stdio: "ignore" });
38986
+ execFileSync20("az", args, { stdio: "ignore" });
38600
38987
  return "ok";
38601
38988
  } catch (error) {
38602
38989
  return error.code === "ENOENT" ? "missing" : "failed";
@@ -38659,7 +39046,7 @@ async function checkoutPr(number) {
38659
39046
  const from = branch2 === "HEAD" ? gitSyncOrNull(process.cwd(), ["rev-parse", "HEAD"]) : branch2;
38660
39047
  const stale = headRef ? clearStalePrBranch(process.cwd(), headRef) : "absent";
38661
39048
  try {
38662
- execFileSync20(commands.checkout.file, commands.checkout.args, {
39049
+ execFileSync21(commands.checkout.file, commands.checkout.args, {
38663
39050
  stdio: "inherit"
38664
39051
  });
38665
39052
  } catch {
@@ -38765,11 +39152,11 @@ function registerReviewPrComments(program, resumeFlag) {
38765
39152
  "--harness <kind>",
38766
39153
  "Coding harness to launch (claude|codex|pi); defaults to the configured harness.engine. Exits with the reasons, before checking the PR out, when Address comments is unavailable on it"
38767
39154
  ).action(
38768
- (number, opts) => reviewPrComments(number, {
38769
- announce: opts.announce,
38770
- auto: opts.auto,
38771
- resumeSessionId: opts.resumeSession,
38772
- harness: resolveHarness2(opts.harness)
39155
+ (number, opts2) => reviewPrComments(number, {
39156
+ announce: opts2.announce,
39157
+ auto: opts2.auto,
39158
+ resumeSessionId: opts2.resumeSession,
39159
+ harness: resolveHarness2(opts2.harness)
38773
39160
  })
38774
39161
  );
38775
39162
  configHelp(command, harnessConfigHelp);
@@ -38784,14 +39171,14 @@ function registerDescriptionLaunch(program, name2, slashCommand, description, fe
38784
39171
  ).description(description).option("--once", "Exit when the initial task completes").option("--resume-session <id>", resumeFlag).option("--harness <kind>", harnessFlag(feature)).option(
38785
39172
  "--model <model>",
38786
39173
  `Model to launch the harness with; defaults to harness.defaults.${name2}.model while the ${name2} type's harness is used`
38787
- ).option("--no-model", "Launch with the harness's own default model").action((text18, opts) => {
38788
- const harness = resolveHarness2(opts.harness, name2);
39174
+ ).option("--no-model", "Launch with the harness's own default model").action((text18, opts2) => {
39175
+ const harness = resolveHarness2(opts2.harness, name2);
38789
39176
  return launchMode(slashCommand, {
38790
- once: opts.once,
39177
+ once: opts2.once,
38791
39178
  description: text18,
38792
- resumeSessionId: opts.resumeSession,
39179
+ resumeSessionId: opts2.resumeSession,
38793
39180
  harness,
38794
- model: resolveModel(opts.model, name2, harness),
39181
+ model: resolveModel(opts2.model, name2, harness),
38795
39182
  feature
38796
39183
  });
38797
39184
  });
@@ -38803,7 +39190,7 @@ function registerDescriptionLaunch(program, name2, slashCommand, description, fe
38803
39190
  var RESUME_SESSION_FLAG = "Resume an interrupted harness session by its conversation id (used by the sessions daemon on restart)";
38804
39191
  function registerNext(program) {
38805
39192
  program.command("next").argument("[id]", "Backlog item ID to run first").description("Alias for backlog next").option("--once", "Exit after the first completed item run").action(
38806
- (id, opts) => next({ allowEdits: true, once: opts.once }, id)
39193
+ (id, opts2) => next({ allowEdits: true, once: opts2.once }, id)
38807
39194
  );
38808
39195
  }
38809
39196
  function registerLaunch(program) {
@@ -38908,7 +39295,7 @@ import { resolve as resolve24 } from "path";
38908
39295
  import chalk207 from "chalk";
38909
39296
 
38910
39297
  // src/commands/mermaid/exportFile.ts
38911
- import { readFileSync as readFileSync59, writeFileSync as writeFileSync43 } from "fs";
39298
+ import { readFileSync as readFileSync60, writeFileSync as writeFileSync43 } from "fs";
38912
39299
  import { basename as basename23, extname as extname4, resolve as resolve23 } from "path";
38913
39300
  import chalk206 from "chalk";
38914
39301
 
@@ -38934,7 +39321,7 @@ async function renderBlock(krokiUrl, source) {
38934
39321
 
38935
39322
  // src/commands/mermaid/exportFile.ts
38936
39323
  async function exportFile(file, outDir, krokiUrl, onlyIndex) {
38937
- const content = readFileSync59(file, "utf8");
39324
+ const content = readFileSync60(file, "utf8");
38938
39325
  const blocks = extractMermaidBlocks(content);
38939
39326
  const stem = basename23(file, extname4(file));
38940
39327
  if (onlyIndex !== void 0) {
@@ -39146,14 +39533,14 @@ function applyIgnore(texts, ignore3) {
39146
39533
  }
39147
39534
 
39148
39535
  // src/commands/miro/readIgnoreList.ts
39149
- import { existsSync as existsSync75, readFileSync as readFileSync60 } from "fs";
39536
+ import { existsSync as existsSync75, readFileSync as readFileSync61 } from "fs";
39150
39537
  import { parse as parse2 } from "yaml";
39151
39538
  function readIgnoreList(file) {
39152
39539
  if (!existsSync75(file))
39153
39540
  throw new MiroExtractError(
39154
39541
  `No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
39155
39542
  );
39156
- const parsed = parse2(readFileSync60(file, "utf8"));
39543
+ const parsed = parse2(readFileSync61(file, "utf8"));
39157
39544
  if (parsed === null || parsed === void 0) return [];
39158
39545
  if (!Array.isArray(parsed) || parsed.some((entry) => typeof entry !== "string"))
39159
39546
  throw new MiroExtractError(
@@ -39333,7 +39720,7 @@ async function pickAnchors(sessionId2, items3) {
39333
39720
  }
39334
39721
 
39335
39722
  // src/commands/miro/readMiroItems.ts
39336
- import { readFileSync as readFileSync61 } from "fs";
39723
+ import { readFileSync as readFileSync62 } from "fs";
39337
39724
  function tryParse(text18) {
39338
39725
  try {
39339
39726
  return JSON.parse(text18);
@@ -39362,7 +39749,7 @@ function parsePages(raw, file) {
39362
39749
  return Array.isArray(parsed) ? parsed.map(toPage) : [toPage(parsed)];
39363
39750
  }
39364
39751
  function readMiroItems(file) {
39365
- const items3 = parsePages(readFileSync61(file, "utf8"), file).flatMap(
39752
+ const items3 = parsePages(readFileSync62(file, "utf8"), file).flatMap(
39366
39753
  (page) => page.data ?? []
39367
39754
  );
39368
39755
  if (items3.length === 0)
@@ -39761,7 +40148,7 @@ import { join as join96 } from "path";
39761
40148
  import chalk212 from "chalk";
39762
40149
 
39763
40150
  // src/commands/netcap/extractPostsFromCapture.ts
39764
- import { readFileSync as readFileSync62 } from "fs";
40151
+ import { readFileSync as readFileSync63 } from "fs";
39765
40152
 
39766
40153
  // src/commands/netcap/parseRscRows.ts
39767
40154
  var isRscRef = (v) => typeof v === "string" && /^\$[0-9a-fL@]/.test(v);
@@ -40157,7 +40544,7 @@ function extractVoyagerPosts(body) {
40157
40544
 
40158
40545
  // src/commands/netcap/extractPostsFromCapture.ts
40159
40546
  function captureEntries(captureFile) {
40160
- const lines = readFileSync62(captureFile, "utf8").split("\n").filter(Boolean);
40547
+ const lines = readFileSync63(captureFile, "utf8").split("\n").filter(Boolean);
40161
40548
  const entries2 = [];
40162
40549
  for (const line of lines) {
40163
40550
  let entry;
@@ -40616,14 +41003,14 @@ import { dirname as dirname44 } from "path";
40616
41003
  import { stringify as stringify3 } from "yaml";
40617
41004
 
40618
41005
  // src/commands/prs/loadCommentsCache.ts
40619
- import { existsSync as existsSync76, readFileSync as readFileSync63, unlinkSync as unlinkSync15 } from "fs";
41006
+ import { existsSync as existsSync76, readFileSync as readFileSync64, unlinkSync as unlinkSync15 } from "fs";
40620
41007
  import { parse as parse3 } from "yaml";
40621
41008
  function loadCommentsCache(org, repo, prNumber) {
40622
41009
  const cachePath = commentsCachePath(org, repo, prNumber);
40623
41010
  if (!existsSync76(cachePath)) {
40624
41011
  return null;
40625
41012
  }
40626
- const content = readFileSync63(cachePath, "utf8");
41013
+ const content = readFileSync64(cachePath, "utf8");
40627
41014
  return parse3(content);
40628
41015
  }
40629
41016
  function deleteCommentsCache(org, repo, prNumber) {
@@ -40713,9 +41100,9 @@ var azureDevopsThreadRequests = {
40713
41100
  };
40714
41101
 
40715
41102
  // src/commands/prs/azureDevops/currentAzureDevopsPr.ts
40716
- import { execFileSync as execFileSync21 } from "child_process";
41103
+ import { execFileSync as execFileSync22 } from "child_process";
40717
41104
  function findPrForBranch(repo, branch2) {
40718
- const stdout = execFileSync21(
41105
+ const stdout = execFileSync22(
40719
41106
  "az",
40720
41107
  [
40721
41108
  "repos",
@@ -40762,7 +41149,7 @@ function failAzureDevops(error) {
40762
41149
  }
40763
41150
 
40764
41151
  // src/commands/prs/azureDevops/invokeAzDevops.ts
40765
- import { execFileSync as execFileSync22 } from "child_process";
41152
+ import { execFileSync as execFileSync23 } from "child_process";
40766
41153
  import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as writeFileSync47 } from "fs";
40767
41154
  import { tmpdir as tmpdir7 } from "os";
40768
41155
  import { join as join99 } from "path";
@@ -40791,7 +41178,7 @@ function azDevopsInvokeArgs(request, inFile) {
40791
41178
  ];
40792
41179
  }
40793
41180
  function runAz2(args) {
40794
- const stdout = execFileSync22("az", args, {
41181
+ const stdout = execFileSync23("az", args, {
40795
41182
  encoding: "utf8",
40796
41183
  stdio: ["ignore", "pipe", "pipe"],
40797
41184
  windowsHide: true
@@ -40858,10 +41245,10 @@ function listAzureDevopsComments(repo) {
40858
41245
  }
40859
41246
 
40860
41247
  // src/commands/prs/fetchThreadIds.ts
40861
- import { execFileSync as execFileSync23 } from "child_process";
41248
+ import { execFileSync as execFileSync24 } from "child_process";
40862
41249
  var THREAD_QUERY = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { id isResolved comments(first: 100) { nodes { databaseId } } } } } } }`;
40863
41250
  function fetchThreadIds(org, repo, prNumber) {
40864
- const result = execFileSync23(
41251
+ const result = execFileSync24(
40865
41252
  "gh",
40866
41253
  [
40867
41254
  "api",
@@ -41142,7 +41529,7 @@ function printComments2(result) {
41142
41529
  import { execSync as execSync46 } from "child_process";
41143
41530
 
41144
41531
  // src/commands/prs/threadTarget.ts
41145
- import { execFileSync as execFileSync24 } from "child_process";
41532
+ import { execFileSync as execFileSync25 } from "child_process";
41146
41533
 
41147
41534
  // src/commands/prs/azureDevops/azureDevopsThreadActions.ts
41148
41535
  function attempt(run5) {
@@ -41190,7 +41577,7 @@ function replyToComment(org, repo, prNumber, commentId, message4) {
41190
41577
  // src/commands/prs/threadTarget.ts
41191
41578
  function resolveThread(threadId) {
41192
41579
  const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
41193
- execFileSync24(
41580
+ execFileSync25(
41194
41581
  "gh",
41195
41582
  ["api", "graphql", "-f", `query=${mutation}`, "-f", `threadId=${threadId}`],
41196
41583
  { stdio: ["inherit", "pipe", "inherit"] }
@@ -41832,7 +42219,7 @@ function buildValidatedBody(options2, usage) {
41832
42219
  }
41833
42220
 
41834
42221
  // src/commands/prs/placePr.ts
41835
- import { execFileSync as execFileSync25 } from "child_process";
42222
+ import { execFileSync as execFileSync26 } from "child_process";
41836
42223
 
41837
42224
  // src/commands/prs/buildCreateArgs.ts
41838
42225
  function buildCreateArgs(title, body, options2, attachments = []) {
@@ -41918,7 +42305,7 @@ function buildEditArgs(number, title, body, attachments = []) {
41918
42305
  // src/commands/prs/placePr.ts
41919
42306
  function hasUpstream2() {
41920
42307
  try {
41921
- execFileSync25(
42308
+ execFileSync26(
41922
42309
  "git",
41923
42310
  ["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"],
41924
42311
  { stdio: "pipe" }
@@ -41930,7 +42317,7 @@ function hasUpstream2() {
41930
42317
  }
41931
42318
  function ensureBranchPushed() {
41932
42319
  const args = hasUpstream2() ? ["push"] : ["push", "--set-upstream", "origin", "HEAD"];
41933
- execFileSync25("git", args, { stdio: "inherit" });
42320
+ execFileSync26("git", args, { stdio: "inherit" });
41934
42321
  }
41935
42322
  async function placePr(prNumber, title, body, options2, attachments = []) {
41936
42323
  const args = prNumber !== null ? buildEditArgs(prNumber, title, body, attachments) : buildCreateArgs(title, body, options2, attachments);
@@ -42001,10 +42388,10 @@ function warn(reason4) {
42001
42388
  }
42002
42389
 
42003
42390
  // src/commands/prs/enableAutoMerge.ts
42004
- import { execFileSync as execFileSync26 } from "child_process";
42391
+ import { execFileSync as execFileSync27 } from "child_process";
42005
42392
  function enableAutoMerge() {
42006
42393
  try {
42007
- execFileSync26(
42394
+ execFileSync27(
42008
42395
  "gh",
42009
42396
  ["pr", "merge", getCurrentBranch2(), "--auto", "--squash"],
42010
42397
  { stdio: "inherit" }
@@ -42264,10 +42651,10 @@ function prsSlackChannel() {
42264
42651
  }
42265
42652
 
42266
42653
  // src/commands/prs/status/fetchReviewThreads.ts
42267
- import { execFileSync as execFileSync27 } from "child_process";
42654
+ import { execFileSync as execFileSync28 } from "child_process";
42268
42655
  var THREAD_QUERY2 = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { isResolved } } } } }`;
42269
42656
  function fetchReviewThreads(org, repo, prNumber) {
42270
- const output = execFileSync27(
42657
+ const output = execFileSync28(
42271
42658
  "gh",
42272
42659
  [
42273
42660
  "api",
@@ -42589,7 +42976,7 @@ function registerPrsStatus(prsCommand) {
42589
42976
  }
42590
42977
 
42591
42978
  // src/commands/readTime/readTime.ts
42592
- import { readFileSync as readFileSync64 } from "fs";
42979
+ import { readFileSync as readFileSync65 } from "fs";
42593
42980
 
42594
42981
  // src/commands/readTime/countReadingWords.ts
42595
42982
  var FENCE_PATTERN = /^\s*(```|~~~)/;
@@ -42750,7 +43137,7 @@ async function loadBody(target) {
42750
43137
  }
42751
43138
  function readDraftFile(path128) {
42752
43139
  try {
42753
- return readFileSync64(path128, "utf8");
43140
+ return readFileSync65(path128, "utf8");
42754
43141
  } catch {
42755
43142
  console.error(`Error: Could not read \`${path128}\`.`);
42756
43143
  console.error(
@@ -43123,33 +43510,33 @@ import chalk232 from "chalk";
43123
43510
  import chalk231 from "chalk";
43124
43511
 
43125
43512
  // src/commands/ravendb/buildQueryPath.ts
43126
- function buildQueryPath(opts) {
43127
- const db = encodeURIComponent(opts.db);
43513
+ function buildQueryPath(opts2) {
43514
+ const db = encodeURIComponent(opts2.db);
43128
43515
  let path128;
43129
- if (opts.collection) {
43130
- path128 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
43516
+ if (opts2.collection) {
43517
+ path128 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts2.collection)}?start=${opts2.start}&pageSize=${opts2.pageSize}&sort=${encodeURIComponent(opts2.sort)}`;
43131
43518
  } else {
43132
- path128 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
43519
+ path128 = `/databases/${db}/queries?start=${opts2.start}&pageSize=${opts2.pageSize}`;
43133
43520
  }
43134
- if (opts.query) {
43135
- path128 += `&query=${encodeURIComponent(opts.query)}`;
43521
+ if (opts2.query) {
43522
+ path128 += `&query=${encodeURIComponent(opts2.query)}`;
43136
43523
  }
43137
43524
  return path128;
43138
43525
  }
43139
43526
 
43140
43527
  // src/commands/ravendb/fetchAllPages.ts
43141
- async function fetchAllPages(connection, opts) {
43528
+ async function fetchAllPages(connection, opts2) {
43142
43529
  const allResults = [];
43143
43530
  let start2 = 0;
43144
43531
  while (true) {
43145
- const effectivePageSize = opts.limit !== void 0 ? Math.min(opts.pageSize, opts.limit - allResults.length) : opts.pageSize;
43532
+ const effectivePageSize = opts2.limit !== void 0 ? Math.min(opts2.pageSize, opts2.limit - allResults.length) : opts2.pageSize;
43146
43533
  const path128 = buildQueryPath({
43147
43534
  db: connection.database,
43148
- collection: opts.collection,
43535
+ collection: opts2.collection,
43149
43536
  start: start2,
43150
43537
  pageSize: effectivePageSize,
43151
- sort: opts.sort,
43152
- query: opts.query
43538
+ sort: opts2.sort,
43539
+ query: opts2.query
43153
43540
  });
43154
43541
  const data = await ravenFetch(connection, path128);
43155
43542
  const results = data.Results ?? [];
@@ -43161,7 +43548,7 @@ async function fetchAllPages(connection, opts) {
43161
43548
  `\r${chalk231.dim(`Fetched ${allResults.length}/${totalResults}`)}`
43162
43549
  );
43163
43550
  if (start2 >= totalResults) break;
43164
- if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
43551
+ if (opts2.limit !== void 0 && allResults.length >= opts2.limit) break;
43165
43552
  }
43166
43553
  if (allResults.length > 0) {
43167
43554
  process.stderr.write("\n");
@@ -43257,10 +43644,10 @@ function checkStreamGraph(streams) {
43257
43644
  }
43258
43645
 
43259
43646
  // src/commands/releases/readStreamsInput.ts
43260
- import { readFileSync as readFileSync65 } from "fs";
43647
+ import { readFileSync as readFileSync66 } from "fs";
43261
43648
  import { parse as parse4 } from "yaml";
43262
43649
  function readSource2(source) {
43263
- return readFileSync65(source === "-" ? 0 : source, "utf8");
43650
+ return readFileSync66(source === "-" ? 0 : source, "utf8");
43264
43651
  }
43265
43652
  function readStreamsInput(source) {
43266
43653
  let parsed;
@@ -44171,7 +44558,7 @@ function buildLimitsSegment(rateLimits) {
44171
44558
  }
44172
44559
 
44173
44560
  // src/commands/readGitBranch.ts
44174
- import { readFileSync as readFileSync66, statSync as statSync14 } from "fs";
44561
+ import { readFileSync as readFileSync67, statSync as statSync14 } from "fs";
44175
44562
  import { isAbsolute as isAbsolute7, join as join101, resolve as resolve29 } from "path";
44176
44563
  function resolveGitDir(cwd) {
44177
44564
  const dotGit = join101(cwd, ".git");
@@ -44186,7 +44573,7 @@ function resolveGitDir(cwd) {
44186
44573
  }
44187
44574
  let contents;
44188
44575
  try {
44189
- contents = readFileSync66(dotGit, "utf8");
44576
+ contents = readFileSync67(dotGit, "utf8");
44190
44577
  } catch {
44191
44578
  return null;
44192
44579
  }
@@ -44204,7 +44591,7 @@ function readGitBranch(cwd) {
44204
44591
  }
44205
44592
  let head;
44206
44593
  try {
44207
- head = readFileSync66(join101(gitDir, "HEAD"), "utf8");
44594
+ head = readFileSync67(join101(gitDir, "HEAD"), "utf8");
44208
44595
  } catch {
44209
44596
  return null;
44210
44597
  }
@@ -44241,6 +44628,7 @@ import chalk241 from "chalk";
44241
44628
  // src/shared/harnessAdapters/contextLevel.ts
44242
44629
  var THRESHOLDS = {
44243
44630
  claude: { red: 30, yellow: 20 },
44631
+ "claude-sdk": { red: 30, yellow: 20 },
44244
44632
  codex: { red: 75, yellow: 50 },
44245
44633
  pi: { red: 30, yellow: 20 }
44246
44634
  };
@@ -44381,7 +44769,7 @@ function registerRootCommands(program) {
44381
44769
  }
44382
44770
 
44383
44771
  // src/commands/refactor/check.ts
44384
- import { spawn as spawn11 } from "child_process";
44772
+ import { spawn as spawn12 } from "child_process";
44385
44773
  import * as path62 from "path";
44386
44774
 
44387
44775
  // src/commands/refactor/logViolations.ts
@@ -44529,7 +44917,7 @@ function getViolations(pattern2, options2 = {}, maxLines = DEFAULT_MAX_LINES2) {
44529
44917
  // src/commands/refactor/check.ts
44530
44918
  function runScript(script, cwd) {
44531
44919
  return new Promise((resolve36) => {
44532
- const child2 = spawn11("npm", ["run", script], {
44920
+ const child2 = spawn12("npm", ["run", script], {
44533
44921
  stdio: "pipe",
44534
44922
  shell: true,
44535
44923
  cwd
@@ -46749,7 +47137,7 @@ function readGlobs(value) {
46749
47137
  }
46750
47138
 
46751
47139
  // src/commands/review/highLevel/summariseRepoTree.ts
46752
- import { execFileSync as execFileSync28 } from "child_process";
47140
+ import { execFileSync as execFileSync29 } from "child_process";
46753
47141
  import { dirname as dirname46, extname as extname6 } from "path";
46754
47142
  var MAX_DIRECTORIES = 200;
46755
47143
  var MAX_EXTENSIONS_PER_DIRECTORY = 6;
@@ -46765,7 +47153,7 @@ function summariseRepoTree(cwd = process.cwd()) {
46765
47153
  }
46766
47154
  function listTrackedFiles(cwd) {
46767
47155
  try {
46768
- return execFileSync28("git", ["ls-files"], {
47156
+ return execFileSync29("git", ["ls-files"], {
46769
47157
  cwd,
46770
47158
  encoding: "utf8",
46771
47159
  maxBuffer: 64 * 1024 * 1024
@@ -47238,7 +47626,7 @@ function evaluateHighLevelChecks(subject) {
47238
47626
  }
47239
47627
 
47240
47628
  // src/commands/review/highLevel/fetchHighLevelFiles.ts
47241
- import { execFileSync as execFileSync29 } from "child_process";
47629
+ import { execFileSync as execFileSync30 } from "child_process";
47242
47630
  import { createHash as createHash4 } from "crypto";
47243
47631
  var JQ = ".[] | {filename,status,additions,deletions,patch} | @json";
47244
47632
  function toStatus(status2) {
@@ -47251,7 +47639,7 @@ function diffUrl(repo, prNumber, path128) {
47251
47639
  return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
47252
47640
  }
47253
47641
  function fetchHighLevelFiles(prNumber, repo) {
47254
- const out = execFileSync29(
47642
+ const out = execFileSync30(
47255
47643
  "gh",
47256
47644
  ["api", `repos/${repo}/pulls/${prNumber}/files`, "--paginate", "--jq", JQ],
47257
47645
  { encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }
@@ -47318,7 +47706,7 @@ function fetchHighLevelPr(prNumber, repo) {
47318
47706
  }
47319
47707
 
47320
47708
  // src/commands/review/highLevel/gatherHighLevelSlices.ts
47321
- import { readFileSync as readFileSync68 } from "fs";
47709
+ import { readFileSync as readFileSync69 } from "fs";
47322
47710
 
47323
47711
  // src/commands/review/highLevel/formatSlicingRequest.ts
47324
47712
  var RULES = [
@@ -47436,11 +47824,11 @@ function listHighLevelHunks(files) {
47436
47824
  }
47437
47825
 
47438
47826
  // src/commands/review/highLevel/readJsonFile.ts
47439
- import { existsSync as existsSync78, readFileSync as readFileSync67 } from "fs";
47827
+ import { existsSync as existsSync78, readFileSync as readFileSync68 } from "fs";
47440
47828
  function readJsonFile(path128) {
47441
47829
  if (!existsSync78(path128)) return void 0;
47442
47830
  try {
47443
- return JSON.parse(readFileSync67(path128, "utf8"));
47831
+ return JSON.parse(readFileSync68(path128, "utf8"));
47444
47832
  } catch {
47445
47833
  return void 0;
47446
47834
  }
@@ -47531,7 +47919,7 @@ function writeJsonFile(path128, data) {
47531
47919
  // src/commands/review/highLevel/gatherHighLevelSlices.ts
47532
47920
  function readSlicesFile(file) {
47533
47921
  try {
47534
- return JSON.parse(readFileSync68(file, "utf8"));
47922
+ return JSON.parse(readFileSync69(file, "utf8"));
47535
47923
  } catch (error) {
47536
47924
  throw new Error(
47537
47925
  `could not read slices from ${file}: ${error instanceof Error ? error.message : String(error)}`
@@ -47774,11 +48162,11 @@ function collectHighLevelTests(files, testPaths, readSource4) {
47774
48162
  }
47775
48163
 
47776
48164
  // src/commands/review/highLevel/fetchFileAtSha.ts
47777
- import { execFileSync as execFileSync30 } from "child_process";
48165
+ import { execFileSync as execFileSync31 } from "child_process";
47778
48166
  function fetchFileAtSha(repo, sha, path128) {
47779
48167
  const encodedPath = path128.split("/").map(encodeURIComponent).join("/");
47780
48168
  try {
47781
- return execFileSync30(
48169
+ return execFileSync31(
47782
48170
  "gh",
47783
48171
  [
47784
48172
  "api",
@@ -48906,7 +49294,7 @@ async function runReviewers(reviewers, context) {
48906
49294
  import { existsSync as existsSync79, unlinkSync as unlinkSync18 } from "fs";
48907
49295
 
48908
49296
  // src/commands/review/synthesise.ts
48909
- import { readFileSync as readFileSync69 } from "fs";
49297
+ import { readFileSync as readFileSync70 } from "fs";
48910
49298
 
48911
49299
  // src/commands/review/carriedUnanchoredFindings.ts
48912
49300
  function carriedUnanchoredFindings(unanchored) {
@@ -49108,7 +49496,7 @@ Files:
49108
49496
 
49109
49497
  // src/commands/review/synthesise.ts
49110
49498
  function printSummary2(synthesisPath) {
49111
- const markdown = readFileSync69(synthesisPath, "utf8");
49499
+ const markdown = readFileSync70(synthesisPath, "utf8");
49112
49500
  console.log("");
49113
49501
  console.log(buildReviewSummary(markdown));
49114
49502
  console.log("");
@@ -49658,7 +50046,7 @@ function postSynthesisSession(modes) {
49658
50046
  }
49659
50047
 
49660
50048
  // src/commands/review/postReviewToPr.ts
49661
- import { readFileSync as readFileSync70 } from "fs";
50049
+ import { readFileSync as readFileSync71 } from "fs";
49662
50050
 
49663
50051
  // src/commands/review/chainAddressComments.ts
49664
50052
  function chainAddressComments(prNumber, announce, harness) {
@@ -50013,7 +50401,7 @@ async function confirmPost(prNumber, work, options2) {
50013
50401
  return promptConfirm(`Post ${work} to PR #${prNumber}?`, false);
50014
50402
  }
50015
50403
  async function postFindingsToPr(prInfo, synthesisPath, options2) {
50016
- const markdown = readFileSync70(synthesisPath, "utf8");
50404
+ const markdown = readFileSync71(synthesisPath, "utf8");
50017
50405
  const { inDiff, unanchored } = selectPostableFindings(markdown, prInfo);
50018
50406
  const carried = carriedUnanchoredFindings(unanchored);
50019
50407
  if (inDiff.length === 0 && carried.length === 0) return NOTHING_POSTED;
@@ -50312,11 +50700,11 @@ import path101 from "path";
50312
50700
  import chalk276 from "chalk";
50313
50701
 
50314
50702
  // src/commands/rules/updateScopedRulesIndex.ts
50315
- import { existsSync as existsSync81, readFileSync as readFileSync72, writeFileSync as writeFileSync51 } from "fs";
50703
+ import { existsSync as existsSync81, readFileSync as readFileSync73, writeFileSync as writeFileSync51 } from "fs";
50316
50704
  import path100 from "path";
50317
50705
 
50318
50706
  // src/commands/rules/scopedRuleDirectories.ts
50319
- import { readFileSync as readFileSync71 } from "fs";
50707
+ import { readFileSync as readFileSync72 } from "fs";
50320
50708
  import path99 from "path";
50321
50709
 
50322
50710
  // src/commands/rules/findClaudeFiles.ts
@@ -50340,7 +50728,7 @@ function findClaudeFiles(dir) {
50340
50728
  // src/commands/rules/scopedRuleDirectories.ts
50341
50729
  function scopedRuleDirectories(root2) {
50342
50730
  return findClaudeFiles(root2).filter(
50343
- (file) => path99.dirname(file) !== root2 && parseRulesSection(readFileSync71(file, "utf8")).length > 0
50731
+ (file) => path99.dirname(file) !== root2 && parseRulesSection(readFileSync72(file, "utf8")).length > 0
50344
50732
  ).map(
50345
50733
  (file) => `${path99.relative(root2, path99.dirname(file)).split(path99.sep).join("/")}/`
50346
50734
  ).sort();
@@ -50382,7 +50770,7 @@ function upsertScopedRulesPointer(content, directories) {
50382
50770
  function updateScopedRulesIndex(root2) {
50383
50771
  const directories = scopedRuleDirectories(root2);
50384
50772
  const rootFile = path100.join(root2, "CLAUDE.md");
50385
- const before = existsSync81(rootFile) ? readFileSync72(rootFile, "utf8") : "";
50773
+ const before = existsSync81(rootFile) ? readFileSync73(rootFile, "utf8") : "";
50386
50774
  const after = upsertScopedRulesPointer(before, directories);
50387
50775
  if (after !== before) writeFileSync51(rootFile, after);
50388
50776
  return directories;
@@ -50435,7 +50823,7 @@ function listRules(target, options2 = {}) {
50435
50823
  }
50436
50824
 
50437
50825
  // src/commands/rules/addRule.ts
50438
- import { existsSync as existsSync83, readFileSync as readFileSync74, writeFileSync as writeFileSync52 } from "fs";
50826
+ import { existsSync as existsSync83, readFileSync as readFileSync75, writeFileSync as writeFileSync52 } from "fs";
50439
50827
  import path104 from "path";
50440
50828
  import chalk278 from "chalk";
50441
50829
 
@@ -50460,11 +50848,11 @@ function insertRuleBullet(content, rule) {
50460
50848
  }
50461
50849
 
50462
50850
  // src/commands/rules/nextRuleCode.ts
50463
- import { readFileSync as readFileSync73 } from "fs";
50851
+ import { readFileSync as readFileSync74 } from "fs";
50464
50852
  var CODE_PREFIX = "R";
50465
50853
  function nextRuleCode(root2) {
50466
50854
  const numbers = findClaudeFiles(root2).flatMap(
50467
- (file) => parseRulesSection(readFileSync73(file, "utf8")).map(
50855
+ (file) => parseRulesSection(readFileSync74(file, "utf8")).map(
50468
50856
  (rule) => Number(/(\d+)\s*$/.exec(rule.code)?.[1] ?? 0)
50469
50857
  )
50470
50858
  );
@@ -50491,7 +50879,7 @@ function resolveRuleScope(target) {
50491
50879
 
50492
50880
  // src/commands/rules/addRule.ts
50493
50881
  function read3(file) {
50494
- return existsSync83(file) ? readFileSync74(file, "utf8") : "";
50882
+ return existsSync83(file) ? readFileSync75(file, "utf8") : "";
50495
50883
  }
50496
50884
  function addRule(text18, options2) {
50497
50885
  const rule = text18.trim();
@@ -51359,8 +51747,8 @@ function isMutation(sql33) {
51359
51747
  }
51360
51748
 
51361
51749
  // src/commands/sql/sqlMutate.ts
51362
- async function sqlMutate(query, connectionName) {
51363
- if (!isMutation(query)) {
51750
+ async function sqlMutate(query2, connectionName) {
51751
+ if (!isMutation(query2)) {
51364
51752
  console.error(
51365
51753
  chalk292.red(
51366
51754
  "assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
@@ -51371,7 +51759,7 @@ async function sqlMutate(query, connectionName) {
51371
51759
  const conn = resolveConnection3(connectionName);
51372
51760
  const pool = await sqlConnect(conn);
51373
51761
  try {
51374
- const result = await pool.request().query(query);
51762
+ const result = await pool.request().query(query2);
51375
51763
  console.log(chalk292.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
51376
51764
  } finally {
51377
51765
  await pool.close();
@@ -51380,8 +51768,8 @@ async function sqlMutate(query, connectionName) {
51380
51768
 
51381
51769
  // src/commands/sql/sqlQuery.ts
51382
51770
  import chalk293 from "chalk";
51383
- async function sqlQuery(query, connectionName) {
51384
- if (isMutation(query)) {
51771
+ async function sqlQuery(query2, connectionName) {
51772
+ if (isMutation(query2)) {
51385
51773
  console.error(
51386
51774
  chalk293.red(
51387
51775
  "assist sql query refuses mutating statements. Use `assist sql mutate` instead."
@@ -51392,7 +51780,7 @@ async function sqlQuery(query, connectionName) {
51392
51780
  const conn = resolveConnection3(connectionName);
51393
51781
  const pool = await sqlConnect(conn);
51394
51782
  try {
51395
- const result = await pool.request().query(query);
51783
+ const result = await pool.request().query(query2);
51396
51784
  const rows = result.recordset ?? [];
51397
51785
  if (result.recordset) {
51398
51786
  printTable(rows);
@@ -51442,12 +51830,12 @@ function registerSql(program) {
51442
51830
  auth.command("remove <name>").description("Remove a configured connection").action((name2) => sqlAuth.remove(name2));
51443
51831
  cmd.command("set-connection <name>").description("Set the default SQL connection").action((name2) => sqlSetConnection(name2));
51444
51832
  cmd.command("query <sql> [connection]").description("Execute a read-only SQL query (rejects mutating statements)").action(
51445
- (query, connection) => sqlQuery(query, connection)
51833
+ (query2, connection) => sqlQuery(query2, connection)
51446
51834
  );
51447
51835
  cmd.command("mutate <sql> [connection]").description(
51448
51836
  "Execute a mutating SQL statement (rejects non-mutating statements)"
51449
51837
  ).action(
51450
- (query, connection) => sqlMutate(query, connection)
51838
+ (query2, connection) => sqlMutate(query2, connection)
51451
51839
  );
51452
51840
  cmd.command("tables [connection]").description("List tables in the connected database").action((connection) => sqlTables(connection));
51453
51841
  cmd.command("columns <table> [connection]").description(
@@ -51860,16 +52248,16 @@ var retiredSyncNames = {
51860
52248
 
51861
52249
  // src/commands/sync/retiredOwnedPaths.ts
51862
52250
  function retiredOwnedPaths() {
51863
- const { claude, codex, pi } = harnesses;
52251
+ const { claude: claude2, codex, pi } = harnesses;
51864
52252
  const paths = retiredSyncNames.commands.flatMap((name2) => [
51865
- path115.join(claude.homeDir, "commands", `${name2}.md`),
51866
- path115.join(claude.homeDir, claude.sync.commandDest(name2)),
52253
+ path115.join(claude2.homeDir, "commands", `${name2}.md`),
52254
+ path115.join(claude2.homeDir, claude2.sync.commandDest(name2)),
51867
52255
  path115.join(codex.homeDir, codex.sync.commandDest(name2)),
51868
52256
  path115.join(pi.homeDir, pi.sync.commandDest(name2))
51869
52257
  ]);
51870
52258
  for (const name2 of retiredSyncNames.skillDirs)
51871
52259
  paths.push(
51872
- path115.join(claude.homeDir, "skills", name2),
52260
+ path115.join(claude2.homeDir, "skills", name2),
51873
52261
  path115.join(codex.homeDir, "skills", name2)
51874
52262
  );
51875
52263
  return paths.filter((file) => fs62.existsSync(file));
@@ -52528,9 +52916,9 @@ function formatVttPassages(passages, notes = [], { sourceMarks = true } = {}) {
52528
52916
  }
52529
52917
 
52530
52918
  // src/commands/transcript/convert/readCleanedCues.ts
52531
- import { readFileSync as readFileSync83 } from "fs";
52919
+ import { readFileSync as readFileSync84 } from "fs";
52532
52920
  function readCleanedCues(inputPath) {
52533
- return deduplicateCues(parseVtt(readFileSync83(inputPath, "utf8")));
52921
+ return deduplicateCues(parseVtt(readFileSync84(inputPath, "utf8")));
52534
52922
  }
52535
52923
 
52536
52924
  // src/commands/transcript/clean.ts
@@ -53309,7 +53697,7 @@ function configKeys2() {
53309
53697
  }
53310
53698
 
53311
53699
  // src/commands/verify/forbiddenStrings.ts
53312
- import { existsSync as existsSync96, readFileSync as readFileSync84 } from "fs";
53700
+ import { existsSync as existsSync96, readFileSync as readFileSync85 } from "fs";
53313
53701
 
53314
53702
  // src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
53315
53703
  import { minimatch as minimatch10 } from "minimatch";
@@ -53356,7 +53744,7 @@ function forbiddenStrings() {
53356
53744
  }
53357
53745
  let parsed;
53358
53746
  try {
53359
- parsed = JSON.parse(readFileSync84(file, "utf8"));
53747
+ parsed = JSON.parse(readFileSync85(file, "utf8"));
53360
53748
  } catch (error) {
53361
53749
  console.log(`Could not parse ${file}: ${error.message}`);
53362
53750
  process.exit(1);
@@ -53382,13 +53770,13 @@ Total: ${violations.length} forbidden string(s).`);
53382
53770
  }
53383
53771
 
53384
53772
  // src/commands/verify/hardcodedColors.ts
53385
- import { execFileSync as execFileSync31 } from "child_process";
53773
+ import { execFileSync as execFileSync32 } from "child_process";
53386
53774
  import { minimatch as minimatch11 } from "minimatch";
53387
53775
  var pattern = "0x[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,6}";
53388
53776
  function hardcodedColors() {
53389
53777
  const ignoreGlobs = loadConfig().hardcodedColors?.ignore ?? [];
53390
53778
  try {
53391
- const output = execFileSync31("grep", ["-rEnH", "-f", "-", "src/"], {
53779
+ const output = execFileSync32("grep", ["-rEnH", "-f", "-", "src/"], {
53392
53780
  encoding: "utf8",
53393
53781
  input: `${pattern}
53394
53782
  `
@@ -53473,7 +53861,7 @@ async function harnessFollowUps() {
53473
53861
  }
53474
53862
 
53475
53863
  // src/commands/verify/migrations.ts
53476
- import { readFileSync as readFileSync85 } from "fs";
53864
+ import { readFileSync as readFileSync86 } from "fs";
53477
53865
  import path126 from "path";
53478
53866
 
53479
53867
  // src/commands/verify/migrations/checkAppendOnly.ts
@@ -53638,7 +54026,7 @@ function migrations2() {
53638
54026
  if (ref) {
53639
54027
  const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
53640
54028
  const current2 = new Map(
53641
- files.map((file) => [file, readFileSync85(path126.join(dir, file), "utf8")])
54029
+ files.map((file) => [file, readFileSync86(path126.join(dir, file), "utf8")])
53642
54030
  );
53643
54031
  for (const finding of checkAppendOnly(baseline, current2)) {
53644
54032
  problems.push(
@@ -54344,11 +54732,11 @@ function consumeSimulatedDivergence(cwd) {
54344
54732
  }
54345
54733
 
54346
54734
  // src/commands/watch/fetchQuietly.ts
54347
- import { execFileSync as execFileSync32 } from "child_process";
54735
+ import { execFileSync as execFileSync33 } from "child_process";
54348
54736
  var MIN_FETCH_TIMEOUT_MS = 6e4;
54349
54737
  function fetchQuietly(cwd, intervalMs) {
54350
54738
  try {
54351
- execFileSync32("git", ["fetch", "--quiet"], {
54739
+ execFileSync33("git", ["fetch", "--quiet"], {
54352
54740
  stdio: ["pipe", "pipe", "pipe"],
54353
54741
  cwd,
54354
54742
  timeout: Math.max(intervalMs, MIN_FETCH_TIMEOUT_MS)
@@ -54544,11 +54932,11 @@ function decideLap(end, interrupted) {
54544
54932
  }
54545
54933
 
54546
54934
  // src/commands/watch/runWatchLap.ts
54547
- import { spawn as spawn12 } from "child_process";
54935
+ import { spawn as spawn13 } from "child_process";
54548
54936
  var WATCH_LAP_ARGS = ["watch", "wait", "--pull", "--build"];
54549
54937
  function runWatchLap() {
54550
54938
  return new Promise((resolve36, reject) => {
54551
- const assistFromPath = spawn12("assist", WATCH_LAP_ARGS, {
54939
+ const assistFromPath = spawn13("assist", WATCH_LAP_ARGS, {
54552
54940
  stdio: "inherit",
54553
54941
  shell: process.platform === "win32"
54554
54942
  });
@@ -54617,8 +55005,8 @@ function registerWatch(program) {
54617
55005
  }
54618
55006
 
54619
55007
  // src/commands/roam/postRoamActivity.ts
54620
- import { execFileSync as execFileSync33 } from "child_process";
54621
- import { readdirSync as readdirSync27, readFileSync as readFileSync86, statSync as statSync18 } from "fs";
55008
+ import { execFileSync as execFileSync34 } from "child_process";
55009
+ import { readdirSync as readdirSync27, readFileSync as readFileSync87, statSync as statSync18 } from "fs";
54622
55010
  import { join as join123 } from "path";
54623
55011
  function findPortFile(roamDir) {
54624
55012
  let entries2;
@@ -54649,14 +55037,14 @@ function postRoamActivity(app, event) {
54649
55037
  if (!portFile) return;
54650
55038
  let port;
54651
55039
  try {
54652
- port = readFileSync86(portFile, "utf8").trim();
55040
+ port = readFileSync87(portFile, "utf8").trim();
54653
55041
  } catch {
54654
55042
  return;
54655
55043
  }
54656
55044
  const pid = PID_BY_APP[app] ?? 99999;
54657
55045
  const url = `http://127.0.0.1:${port}/api/v1/activity/${app}/${event}?pid=${pid}`;
54658
55046
  try {
54659
- execFileSync33("curl", ["-sf", "--max-time", "0.2", "-X", "POST", url], {
55047
+ execFileSync34("curl", ["-sf", "--max-time", "0.2", "-X", "POST", url], {
54660
55048
  stdio: "ignore"
54661
55049
  });
54662
55050
  } catch {
@@ -55214,7 +55602,7 @@ async function remove2(name2, options2 = {}) {
55214
55602
 
55215
55603
  // src/commands/run/registerRunSubcommands.ts
55216
55604
  function registerRunSubcommands(runCommand) {
55217
- runCommand.command("list").description("List configured run commands").option("-v, --verbose", "Show full command details").action((opts) => listRunConfigs(!!opts.verbose));
55605
+ runCommand.command("list").description("List configured run commands").option("-v, --verbose", "Show full command details").action((opts2) => listRunConfigs(!!opts2.verbose));
55218
55606
  registerRunAdd(runCommand);
55219
55607
  runCommand.command("link").description("Link run configurations from another project's assist.yml").argument("<path>", "Relative path to the linked project").requiredOption("--prefix <prefix>", "Namespace prefix for linked commands").allowUnknownOption().action(() => link2());
55220
55608
  runCommand.command("remove").description(
@@ -55222,7 +55610,7 @@ function registerRunSubcommands(runCommand) {
55222
55610
  ).argument("<name>", "Name of the run configuration to remove").option(
55223
55611
  "--repo [name]",
55224
55612
  "Remove from a repo's override in the shared db instead of assist.yml (defaults to the current repo)"
55225
- ).action((name2, opts) => remove2(name2, opts));
55613
+ ).action((name2, opts2) => remove2(name2, opts2));
55226
55614
  }
55227
55615
 
55228
55616
  // src/commands/run/registerRun.ts
@@ -55252,11 +55640,11 @@ function formatLink(link3) {
55252
55640
  }
55253
55641
 
55254
55642
  // src/commands/sessions/daemon/listDaemonPids.ts
55255
- import { execFileSync as execFileSync34 } from "child_process";
55643
+ import { execFileSync as execFileSync35 } from "child_process";
55256
55644
  function listDaemonPids() {
55257
55645
  if (process.platform === "win32") return [];
55258
55646
  try {
55259
- const out = execFileSync34("ps", ["-eo", "pid=,args="], {
55647
+ const out = execFileSync35("ps", ["-eo", "pid=,args="], {
55260
55648
  encoding: "utf8"
55261
55649
  });
55262
55650
  return out.split("\n").filter((line) => line.includes("assist") && / daemon run\b/.test(line)).map((line) => Number.parseInt(line.trim(), 10)).filter((pid) => Number.isInteger(pid));
@@ -55302,11 +55690,11 @@ function applyLine(result, pending, line) {
55302
55690
  }
55303
55691
 
55304
55692
  // src/commands/sessions/daemon/readDaemonPidFile.ts
55305
- import { readFileSync as readFileSync87 } from "fs";
55693
+ import { readFileSync as readFileSync88 } from "fs";
55306
55694
  function readDaemonPidFile() {
55307
55695
  try {
55308
55696
  const pid = Number.parseInt(
55309
- readFileSync87(daemonPaths.pid, "utf8").trim(),
55697
+ readFileSync88(daemonPaths.pid, "utf8").trim(),
55310
55698
  10
55311
55699
  );
55312
55700
  return Number.isInteger(pid) ? pid : void 0;
@@ -55912,9 +56300,13 @@ function toSessionViewInfo({
55912
56300
  rows,
55913
56301
  activeViewer,
55914
56302
  activeViewerNode,
55915
- transfer
56303
+ transfer,
56304
+ pty: pty2,
56305
+ sdkActivity
55916
56306
  }) {
55917
56307
  return {
56308
+ sdk: pty2?.sdk ? true : void 0,
56309
+ sdkActivity,
55918
56310
  transfer,
55919
56311
  lastUserMessage,
55920
56312
  lastAssistantMessage,
@@ -56138,6 +56530,20 @@ function releaseViewer(sessions, viewerId) {
56138
56530
  return released;
56139
56531
  }
56140
56532
 
56533
+ // src/commands/sessions/daemon/isSdkSession.ts
56534
+ function isSdkSession(session) {
56535
+ return Boolean(session.pty?.sdk);
56536
+ }
56537
+
56538
+ // src/commands/sessions/daemon/skipsTerminalPath.ts
56539
+ function skipsTerminalPath(session, path128) {
56540
+ if (!isSdkSession(session)) return false;
56541
+ daemonLog(
56542
+ `session ${session.id} ${path128} skipped: Claude (SDK) session has no terminal`
56543
+ );
56544
+ return true;
56545
+ }
56546
+
56141
56547
  // src/commands/sessions/daemon/claimViewer.ts
56142
56548
  function claimViewer(session, { viewerId, viewerNode, onClaim }, via) {
56143
56549
  if (!viewerId || session.activeViewer === viewerId) return;
@@ -56197,7 +56603,8 @@ function sendResizeSnapshot(s, send2) {
56197
56603
  // src/commands/sessions/daemon/resizeSession.ts
56198
56604
  function resizeSession(sessions, id, cols, rows, viewer = {}) {
56199
56605
  const s = sessions.get(id);
56200
- if (!s || isInactiveViewer(s, viewer)) return;
56606
+ if (!s || isInactiveViewer(s, viewer) || skipsTerminalPath(s, "resize"))
56607
+ return;
56201
56608
  claimViewer(s, viewer, "resize");
56202
56609
  if (s.status === "done" || !s.pty) return;
56203
56610
  const unchanged = s.cols === cols && s.rows === rows;
@@ -56299,6 +56706,16 @@ var ViewerConnections = class {
56299
56706
  }
56300
56707
  };
56301
56708
 
56709
+ // src/commands/sessions/daemon/dropsInactiveViewerResponse.ts
56710
+ function dropsInactiveViewerResponse(s, response, viewer) {
56711
+ if (!response || !s.activeViewer || viewer.viewerId === s.activeViewer)
56712
+ return false;
56713
+ daemonLog(
56714
+ `session ${s.id} dropped terminal response from inactive viewer ${viewer.viewerId ?? "unknown"} on ${viewer.viewerNode ?? "unknown node"}`
56715
+ );
56716
+ return true;
56717
+ }
56718
+
56302
56719
  // src/commands/sessions/daemon/isTerminalResponse.ts
56303
56720
  var ESC4 = String.raw`\x1b`;
56304
56721
  var ST = String.raw`(?:\x07|${ESC4}\\)`;
@@ -56372,13 +56789,9 @@ function watchPromptSubmit(session, data, onStatusChange) {
56372
56789
  function writeToSession(sessions, id, data, onStatusChange, viewer = {}) {
56373
56790
  const s = sessions.get(id);
56374
56791
  if (!s || s.status === "done") return;
56792
+ if (skipsTerminalPath(s, "input")) return;
56375
56793
  const response = isTerminalResponse(data);
56376
- if (response && s.activeViewer && viewer.viewerId !== s.activeViewer) {
56377
- daemonLog(
56378
- `session ${id} dropped terminal response from inactive viewer ${viewer.viewerId ?? "unknown"} on ${viewer.viewerNode ?? "unknown node"}`
56379
- );
56380
- return;
56381
- }
56794
+ if (dropsInactiveViewerResponse(s, response, viewer)) return;
56382
56795
  s.pty?.write(data);
56383
56796
  watchPromptSubmit(s, data, onStatusChange);
56384
56797
  if (!response) claimViewer(s, viewer, "input");
@@ -56822,14 +57235,14 @@ async function runAutoUpdateLoop(deps2, maxLaps = Number.POSITIVE_INFINITY) {
56822
57235
  }
56823
57236
 
56824
57237
  // src/commands/sessions/daemon/autoUpdate/trimWatcherLog.ts
56825
- import { readFileSync as readFileSync88, writeFileSync as writeFileSync63 } from "fs";
57238
+ import { readFileSync as readFileSync89, writeFileSync as writeFileSync63 } from "fs";
56826
57239
  var KEEP_TAIL = 256 * 1024;
56827
57240
  var MAX_LOG_SIZE = 4 * 1024 * 1024;
56828
57241
  function trimWatcherLog(cwd) {
56829
57242
  const path128 = watcherLogPath(cwd);
56830
57243
  let log2;
56831
57244
  try {
56832
- log2 = readFileSync88(path128, "utf8");
57245
+ log2 = readFileSync89(path128, "utf8");
56833
57246
  } catch {
56834
57247
  return;
56835
57248
  }
@@ -57223,7 +57636,7 @@ function noteAutoUpdate(installDir, text18) {
57223
57636
  }
57224
57637
 
57225
57638
  // src/commands/sessions/daemon/autoUpdate/runUpdateLap.ts
57226
- import { spawn as spawn13 } from "child_process";
57639
+ import { spawn as spawn14 } from "child_process";
57227
57640
  import { rmSync as rmSync17 } from "fs";
57228
57641
  function clearLapSignals(cwd) {
57229
57642
  const control = watchControlPaths(cwd);
@@ -57235,7 +57648,7 @@ function runUpdateLap(cwd, onOutput) {
57235
57648
  clearLapSignals(cwd);
57236
57649
  return new Promise((resolve36, reject) => {
57237
57650
  const { ASSIST_ACTIVITY_ID: _activity, ...env } = process.env;
57238
- const child2 = spawn13(
57651
+ const child2 = spawn14(
57239
57652
  process.execPath,
57240
57653
  [process.argv[1], ...WATCH_LAP_ARGS],
57241
57654
  {
@@ -57586,7 +57999,7 @@ function releaseUndeletableLeftover(session, reason4, notify2) {
57586
57999
 
57587
58000
  // src/commands/sessions/daemon/killPtyTree.ts
57588
58001
  function killPtyTree(pty2) {
57589
- if (process.platform === "win32") {
58002
+ if (pty2.sdk || process.platform === "win32") {
57590
58003
  try {
57591
58004
  pty2.kill();
57592
58005
  } catch {
@@ -57689,10 +58102,10 @@ import { readdirSync as readdirSync29, readlinkSync } from "fs";
57689
58102
  import { sep as sep6 } from "path";
57690
58103
 
57691
58104
  // src/commands/sessions/daemon/worktree/readProc.ts
57692
- import { readFileSync as readFileSync89 } from "fs";
58105
+ import { readFileSync as readFileSync90 } from "fs";
57693
58106
  function readProc(procRoot, pid, file) {
57694
58107
  try {
57695
- return readFileSync89(`${procRoot}/${pid}/${file}`, "utf8");
58108
+ return readFileSync90(`${procRoot}/${pid}/${file}`, "utf8");
57696
58109
  } catch {
57697
58110
  return void 0;
57698
58111
  }
@@ -58949,9 +59362,31 @@ function handlePtyExit(session, exitCode, onStatusChange) {
58949
59362
  onStatusChange(session, "done", exitCode);
58950
59363
  }
58951
59364
 
59365
+ // src/commands/sessions/daemon/wireSdkEvents.ts
59366
+ function wireSdkEvents(session, onStatusChange, notify2) {
59367
+ session.pty?.sdk?.onEvent((event) => {
59368
+ if (session.status === "done" || session.status === "stopped") return;
59369
+ if (event.kind === "activity") {
59370
+ session.sdkActivity = event.text ?? void 0;
59371
+ daemonLog(
59372
+ `session ${session.id} sdk activity: ${event.text ?? "cleared"}`
59373
+ );
59374
+ notify2?.();
59375
+ return;
59376
+ }
59377
+ if (event.status === session.status) return;
59378
+ daemonLog(
59379
+ `session ${session.id} status from sdk: ${session.status} -> ${event.status}`
59380
+ );
59381
+ session.permissionActive = false;
59382
+ onStatusChange(session, event.status);
59383
+ });
59384
+ }
59385
+
58952
59386
  // src/commands/sessions/daemon/wirePtyEvents.ts
58953
- function wirePtyEvents(session, clients, onStatusChange) {
59387
+ function wirePtyEvents(session, clients, onStatusChange, notify2) {
58954
59388
  if (!session.pty) return;
59389
+ wireSdkEvents(session, onStatusChange, notify2);
58955
59390
  session.pty.onData((data) => emitSessionOutput(session, clients, data));
58956
59391
  session.pty.onExit(({ exitCode }) => {
58957
59392
  handlePtyExit(session, exitCode, onStatusChange);
@@ -58960,6 +59395,7 @@ function wirePtyEvents(session, clients, onStatusChange) {
58960
59395
  }
58961
59396
  function reportSilentFailure(session, clients) {
58962
59397
  if (session.status !== "error" || !session.error) return;
59398
+ if (isSdkSession(session)) return;
58963
59399
  if (session.scrollback.length > 0) return;
58964
59400
  emitSessionOutput(
58965
59401
  session,
@@ -59224,7 +59660,7 @@ function wireSessionWatchers(session, notify2, onStatusChange) {
59224
59660
  function registerSpawnedSession(session, sessions, clients, onStatusChange, notify2, context) {
59225
59661
  if (context?.launchedFrom) session.launchedFrom = context.launchedFrom;
59226
59662
  sessions.set(session.id, session);
59227
- wirePtyEvents(session, clients, onStatusChange);
59663
+ wirePtyEvents(session, clients, onStatusChange, notify2);
59228
59664
  notify2();
59229
59665
  wireSessionWatchers(session, notify2, onStatusChange);
59230
59666
  logSpawnedSession(session);
@@ -60107,7 +60543,7 @@ function releaseClient(client, clients, prPreview, verify) {
60107
60543
  }
60108
60544
 
60109
60545
  // src/commands/sessions/daemon/findPortHolderPid.ts
60110
- import { execFileSync as execFileSync35 } from "child_process";
60546
+ import { execFileSync as execFileSync36 } from "child_process";
60111
60547
  var PROBE_TIMEOUT_MS = 3e3;
60112
60548
  function findPortHolderPid(port) {
60113
60549
  try {
@@ -60117,7 +60553,7 @@ function findPortHolderPid(port) {
60117
60553
  }
60118
60554
  }
60119
60555
  function probe2(command, args) {
60120
- return execFileSync35(command, args, {
60556
+ return execFileSync36(command, args, {
60121
60557
  encoding: "utf8",
60122
60558
  timeout: PROBE_TIMEOUT_MS,
60123
60559
  stdio: ["ignore", "pipe", "ignore"]
@@ -60188,7 +60624,7 @@ function startHeldSession(session, sessions, clients, onStatusChange, notify2, t
60188
60624
  session.pty?.resize(session.cols, session.rows);
60189
60625
  } catch {
60190
60626
  }
60191
- wirePtyEvents(session, clients, onStatusChange);
60627
+ wirePtyEvents(session, clients, onStatusChange, notify2);
60192
60628
  daemonLog(
60193
60629
  `session ${session.id} started once ${trigger ?? `worktree ${session.worktree?.path ?? session.cwd} finished seeding`}`
60194
60630
  );
@@ -60636,8 +61072,8 @@ function serverRunMeta(runName, cwd) {
60636
61072
  }
60637
61073
 
60638
61074
  // src/commands/sessions/daemon/spawnRun.ts
60639
- function spawnRun(opts) {
60640
- return spawnPty(["assist", "run", opts.name, ...opts.args ?? []], opts.cwd);
61075
+ function spawnRun(opts2) {
61076
+ return spawnPty(["assist", "run", opts2.name, ...opts2.args ?? []], opts2.cwd);
60641
61077
  }
60642
61078
 
60643
61079
  // src/commands/sessions/daemon/restoreServerRun.ts
@@ -61262,10 +61698,10 @@ function restoreAllSessions(spawner, deps2) {
61262
61698
 
61263
61699
  // src/commands/sessions/daemon/retrySession.ts
61264
61700
  function retrySession(session, clients, onStatusChange) {
61265
- const spawn14 = respawnThunk(session);
61266
- if (!spawn14) return false;
61701
+ const spawn15 = respawnThunk(session);
61702
+ if (!spawn15) return false;
61267
61703
  const respawn = () => {
61268
- respawnSession(session, spawn14, "running", clients, onStatusChange);
61704
+ respawnSession(session, spawn15, "running", clients, onStatusChange);
61269
61705
  daemonLog(`session ${session.id} retried: ${session.name}`);
61270
61706
  };
61271
61707
  const pty2 = session.pty;
@@ -61919,6 +62355,14 @@ function relayToCreator(label) {
61919
62355
  };
61920
62356
  }
61921
62357
 
62358
+ // src/commands/sessions/daemon/links/relayWithNodeSessionId.ts
62359
+ function relayWithNodeSessionId(state, msg) {
62360
+ broadcastToViewers(state, {
62361
+ ...msg,
62362
+ sessionId: toNodeSessionId(state.node, msg.sessionId)
62363
+ });
62364
+ }
62365
+
61922
62366
  // src/commands/sessions/daemon/links/relayLinkMessage.ts
61923
62367
  var nsId = (state, msg) => toNodeSessionId(state.node, msg.sessionId);
61924
62368
  var relayOutput = (state, msg) => {
@@ -61943,7 +62387,7 @@ var relayHistory = (state, msg) => {
61943
62387
  var relays = {
61944
62388
  sessions: relayLinkSessions,
61945
62389
  output: relayOutput,
61946
- clear: (state, msg) => broadcastToViewers(state, { ...msg, sessionId: nsId(state, msg) }),
62390
+ clear: relayWithNodeSessionId,
61947
62391
  created: relayToCreator("created session"),
61948
62392
  error: relayToCreator("peer error:"),
61949
62393
  notice: (state, msg) => broadcastToViewers(state, msg),
@@ -61956,7 +62400,8 @@ var relays = {
61956
62400
  ...msg,
61957
62401
  sessionId: typeof msg.sessionId === "string" ? nsId(state, msg) : void 0
61958
62402
  }),
61959
- "user-messages": (state, msg) => broadcastToViewers(state, { ...msg, sessionId: nsId(state, msg) }),
62403
+ "user-messages": relayWithNodeSessionId,
62404
+ "session-transcript": relayWithNodeSessionId,
61960
62405
  limits: (state, msg) => state.onLimits(
61961
62406
  msg.harness,
61962
62407
  msg.rateLimits
@@ -62302,6 +62747,7 @@ var NodeLinks = class {
62302
62747
  // src/commands/sessions/daemon/replayScrollback.ts
62303
62748
  function replayScrollback(sessions, client) {
62304
62749
  for (const s of sessions.values()) {
62750
+ if (skipsTerminalPath(s, "scrollback replay")) continue;
62305
62751
  if (s.scrollback)
62306
62752
  sendTo(client, {
62307
62753
  type: "output",
@@ -62967,12 +63413,12 @@ function transcriptLineTexts(line, harness) {
62967
63413
  function escapeRegExp3(text18) {
62968
63414
  return text18.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
62969
63415
  }
62970
- function encodesVerbatimInJson(query) {
62971
- return JSON.stringify(query) === `"${query}"`;
63416
+ function encodesVerbatimInJson(query2) {
63417
+ return JSON.stringify(query2) === `"${query2}"`;
62972
63418
  }
62973
- function rawLinePrefilter(query) {
62974
- if (!encodesVerbatimInJson(query)) return () => true;
62975
- const lower = query.toLowerCase();
63419
+ function rawLinePrefilter(query2) {
63420
+ if (!encodesVerbatimInJson(query2)) return () => true;
63421
+ const lower = query2.toLowerCase();
62976
63422
  return (line) => line.toLowerCase().includes(lower);
62977
63423
  }
62978
63424
  function matchTexts(texts, pattern2) {
@@ -62982,12 +63428,12 @@ function matchTexts(texts, pattern2) {
62982
63428
  }
62983
63429
  return null;
62984
63430
  }
62985
- function queryPattern(query) {
62986
- return new RegExp(escapeRegExp3(query), "i");
63431
+ function queryPattern(query2) {
63432
+ return new RegExp(escapeRegExp3(query2), "i");
62987
63433
  }
62988
- async function findTranscriptMatch(filePath, harness, query) {
62989
- const pattern2 = queryPattern(query);
62990
- const mayMatch = rawLinePrefilter(query);
63434
+ async function findTranscriptMatch(filePath, harness, query2) {
63435
+ const pattern2 = queryPattern(query2);
63436
+ const mayMatch = rawLinePrefilter(query2);
62991
63437
  const stream = fs72.createReadStream(filePath, { encoding: "utf8" });
62992
63438
  const reader = readline5.createInterface({
62993
63439
  input: stream,
@@ -63007,8 +63453,8 @@ async function findTranscriptMatch(filePath, harness, query) {
63007
63453
  stream.destroy();
63008
63454
  }
63009
63455
  }
63010
- function findTitleMatch(title, query) {
63011
- return title ? matchTexts([title], queryPattern(query)) : null;
63456
+ function findTitleMatch(title, query2) {
63457
+ return title ? matchTexts([title], queryPattern(query2)) : null;
63012
63458
  }
63013
63459
 
63014
63460
  // src/commands/sessions/daemon/historySearch/searchHistory.ts
@@ -63022,21 +63468,21 @@ function inRepo(cwd) {
63022
63468
  return key === selectedKey || (group?.clone || session.cwd) === cwd;
63023
63469
  };
63024
63470
  }
63025
- async function matchBatch(batch, query) {
63471
+ async function matchBatch(batch, query2) {
63026
63472
  const matches = await Promise.all(
63027
63473
  batch.map(async ({ session, filePath }) => {
63028
- const snippet = findTitleMatch(session.title, query) ?? await findTranscriptMatch(filePath, session.harness, query);
63474
+ const snippet = findTitleMatch(session.title, query2) ?? await findTranscriptMatch(filePath, session.harness, query2);
63029
63475
  return snippet ? { ...session, snippet } : null;
63030
63476
  })
63031
63477
  );
63032
63478
  return matches.filter((hit) => hit !== null);
63033
63479
  }
63034
- async function searchHistory(cwd, query) {
63480
+ async function searchHistory(cwd, query2) {
63035
63481
  const candidates = (await discoverHistoryEntries()).filter(inRepo(cwd));
63036
63482
  const hits = [];
63037
63483
  for (let i = 0; i < candidates.length && hits.length < MAX_RESULTS2; i += BATCH_SIZE2)
63038
63484
  hits.push(
63039
- ...await matchBatch(candidates.slice(i, i + BATCH_SIZE2), query)
63485
+ ...await matchBatch(candidates.slice(i, i + BATCH_SIZE2), query2)
63040
63486
  );
63041
63487
  return withRepoGroups(hits.slice(0, MAX_RESULTS2));
63042
63488
  }
@@ -63044,12 +63490,12 @@ async function searchHistory(cwd, query) {
63044
63490
  // src/commands/sessions/daemon/historySearch/handleSearchHistory.ts
63045
63491
  async function handleSearchHistory(client, data) {
63046
63492
  const cwd = typeof data.cwd === "string" ? data.cwd : "";
63047
- const query = typeof data.query === "string" ? data.query.trim() : "";
63493
+ const query2 = typeof data.query === "string" ? data.query.trim() : "";
63048
63494
  const started2 = Date.now();
63049
63495
  try {
63050
- const sessions = cwd && query ? await searchHistory(cwd, query) : [];
63496
+ const sessions = cwd && query2 ? await searchHistory(cwd, query2) : [];
63051
63497
  daemonLog(
63052
- `history search cwd=${cwd} chars=${query.length}: ${sessions.length} match(es) in ${Date.now() - started2}ms`
63498
+ `history search cwd=${cwd} chars=${query2.length}: ${sessions.length} match(es) in ${Date.now() - started2}ms`
63053
63499
  );
63054
63500
  sendTo(client, { type: "history-search", sessions });
63055
63501
  } catch (error) {
@@ -63060,7 +63506,7 @@ async function handleSearchHistory(client, data) {
63060
63506
  }
63061
63507
 
63062
63508
  // src/commands/sessions/daemon/creator.ts
63063
- function creator(isNew, spawn14) {
63509
+ function creator(isNew, spawn15) {
63064
63510
  const reply2 = (client, d, result) => {
63065
63511
  const traceId = typeof d.traceId === "string" ? d.traceId : void 0;
63066
63512
  if (typeof result !== "string") {
@@ -63078,7 +63524,7 @@ function creator(isNew, spawn14) {
63078
63524
  if (m.links.route(client, d)) return;
63079
63525
  let result;
63080
63526
  try {
63081
- result = spawn14(m, d);
63527
+ result = spawn15(m, d);
63082
63528
  } catch (error) {
63083
63529
  fail14(client, d, error);
63084
63530
  return;
@@ -63343,10 +63789,21 @@ var handleOutputRequest = (client, m, request) => {
63343
63789
  }
63344
63790
  const { sessionId: sessionId2, exited } = target;
63345
63791
  let scrollback;
63792
+ let sdk = false;
63346
63793
  m.update((sessions) => {
63347
- scrollback = sessions.get(sessionId2)?.scrollback;
63794
+ const session = sessions.get(sessionId2);
63795
+ sdk = session ? isSdkSession(session) : false;
63796
+ scrollback = session?.scrollback;
63348
63797
  return false;
63349
63798
  });
63799
+ if (sdk) {
63800
+ const error = `Session ${sessionId2} is a Claude (SDK) session with no terminal output`;
63801
+ daemonLog(
63802
+ `output requested: id=${sessionId2} skipped (Claude SDK session, no terminal)`
63803
+ );
63804
+ sendTo(client, { type: "session-output", sessionId: sessionId2, error, requestId });
63805
+ return;
63806
+ }
63350
63807
  daemonLog(
63351
63808
  `output requested: id=${sessionId2}${exited ? ` (exited: ${exited})` : ""} ${scrollback === void 0 ? "unknown session" : `${scrollback.length} chars`}`
63352
63809
  );
@@ -63452,6 +63909,41 @@ async function parseTranscript(conversationId) {
63452
63909
  }
63453
63910
  }
63454
63911
 
63912
+ // src/commands/sessions/daemon/findSession.ts
63913
+ function findSession(manager, id) {
63914
+ let found;
63915
+ manager.update((sessions) => {
63916
+ found = sessions.get(id);
63917
+ return false;
63918
+ });
63919
+ return found;
63920
+ }
63921
+
63922
+ // src/commands/sessions/daemon/handleFetchSessionTranscript.ts
63923
+ import { readFile as readFile9 } from "fs/promises";
63924
+ async function readMessages(session) {
63925
+ const reader = conversationOf(session)?.reader;
63926
+ const filePath = reader ? await resolveTranscriptPath(session) : null;
63927
+ if (!reader || !filePath) return [];
63928
+ try {
63929
+ return transcriptMessages(
63930
+ reader,
63931
+ (await readFile9(filePath, "utf8")).split("\n")
63932
+ );
63933
+ } catch {
63934
+ return [];
63935
+ }
63936
+ }
63937
+ async function handleFetchSessionTranscript(client, manager, data) {
63938
+ const sessionId2 = data.sessionId;
63939
+ const session = findSession(manager, sessionId2);
63940
+ const messages2 = session ? await readMessages(session) : [];
63941
+ daemonLog(
63942
+ `session ${sessionId2} live transcript: ${session ? `${messages2.length} messages` : "unknown session"}`
63943
+ );
63944
+ sendTo(client, { type: "session-transcript", sessionId: sessionId2, messages: messages2 });
63945
+ }
63946
+
63455
63947
  // src/commands/sessions/shared/userMessageTexts.ts
63456
63948
  var MAX_LENGTH3 = 2048;
63457
63949
  function userMessageTexts(events, maxLength = MAX_LENGTH3) {
@@ -63461,14 +63953,6 @@ function userMessageTexts(events, maxLength = MAX_LENGTH3) {
63461
63953
  }
63462
63954
 
63463
63955
  // src/commands/sessions/daemon/handleFetchUserMessages.ts
63464
- function findSession(manager, id) {
63465
- let found;
63466
- manager.update((sessions) => {
63467
- found = sessions.get(id);
63468
- return false;
63469
- });
63470
- return found;
63471
- }
63472
63956
  async function handleFetchUserMessages(client, manager, data) {
63473
63957
  const sessionId2 = data.sessionId;
63474
63958
  const session = findSession(manager, sessionId2);
@@ -63508,6 +63992,7 @@ var lifecycleHandlers = {
63508
63992
  history: handleHistory,
63509
63993
  "fetch-transcript": handleFetchTranscript,
63510
63994
  "fetch-user-messages": routed(handleFetchUserMessages),
63995
+ "fetch-session-transcript": routed(handleFetchSessionTranscript),
63511
63996
  shutdown: handleShutdown
63512
63997
  };
63513
63998
 
@@ -63595,7 +64080,7 @@ var handleSnapshotRequest = (client, m, d) => {
63595
64080
  let data;
63596
64081
  m.update((sessions) => {
63597
64082
  const s = sessions.get(sessionId2);
63598
- if (s) data = sessionSnapshot(s);
64083
+ if (s && !skipsTerminalPath(s, "snapshot")) data = sessionSnapshot(s);
63599
64084
  return false;
63600
64085
  });
63601
64086
  daemonLog(
@@ -63915,14 +64400,14 @@ function spawnAssistCreate(m, d) {
63915
64400
  },
63916
64401
  spawnContextFrom(d)
63917
64402
  );
63918
- const spawn14 = (holder) => m.spawnAssist(
64403
+ const spawn15 = (holder) => m.spawnAssist(
63919
64404
  assistArgs,
63920
64405
  holder ?? cwd,
63921
64406
  { ...meta, inPlace: inPlace || holder !== void 0 },
63922
64407
  spawnContextFrom(d)
63923
64408
  );
63924
- if (inPlace || !isPrCheckoutArgs(assistArgs)) return spawn14();
63925
- return prCheckoutHolder(assistArgs, cwd).then(spawn14);
64409
+ if (inPlace || !isPrCheckoutArgs(assistArgs)) return spawn15();
64410
+ return prCheckoutHolder(assistArgs, cwd).then(spawn15);
63926
64411
  }
63927
64412
 
63928
64413
  // src/commands/sessions/daemon/sessionBlocker.ts
@@ -64111,7 +64596,7 @@ function handleConnection(socket, manager) {
64111
64596
  import { unlinkSync as unlinkSync21, writeFileSync as writeFileSync65 } from "fs";
64112
64597
 
64113
64598
  // src/commands/sessions/daemon/startPidFileWatchdog.ts
64114
- import { readFileSync as readFileSync90 } from "fs";
64599
+ import { readFileSync as readFileSync91 } from "fs";
64115
64600
  var WATCHDOG_INTERVAL_MS = 5e3;
64116
64601
  function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
64117
64602
  const timer = setInterval(() => {
@@ -64122,7 +64607,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
64122
64607
  }
64123
64608
  function ownsPidFile() {
64124
64609
  try {
64125
- return readFileSync90(daemonPaths.pid, "utf8").trim() === String(process.pid);
64610
+ return readFileSync91(daemonPaths.pid, "utf8").trim() === String(process.pid);
64126
64611
  } catch {
64127
64612
  return false;
64128
64613
  }
@@ -64494,15 +64979,15 @@ function registerLinkCommand(nodes) {
64494
64979
  // src/commands/sessions/nodes/awaitLinkReturn.ts
64495
64980
  var POLL_MS8 = 1e3;
64496
64981
  var wait = (ms) => new Promise((r) => setTimeout(r, ms));
64497
- async function linkStatus2(name2, query = queryNodes) {
64498
- return (await query())?.links.find((l) => l.name === name2);
64982
+ async function linkStatus2(name2, query2 = queryNodes) {
64983
+ return (await query2())?.links.find((l) => l.name === name2);
64499
64984
  }
64500
64985
  async function awaitLinkReturn(name2, options2, deps2 = {}) {
64501
- const { query = queryNodes, sleep: sleep2 = wait, now = Date.now } = deps2;
64986
+ const { query: query2 = queryNodes, sleep: sleep2 = wait, now = Date.now } = deps2;
64502
64987
  const deadline = now() + options2.timeoutMs;
64503
64988
  let sawDown = options2.sawDown;
64504
64989
  while (now() < deadline) {
64505
- const link3 = await linkStatus2(name2, query);
64990
+ const link3 = await linkStatus2(name2, query2);
64506
64991
  if (link3?.state !== "connected") sawDown = true;
64507
64992
  else if (sawDown) return link3;
64508
64993
  await sleep2(POLL_MS8);