@staff0rd/assist 0.851.0 → 0.852.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.851.0",
9
+ version: "0.852.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -464,7 +464,14 @@ import { existsSync as existsSync5, readFileSync as readFileSync5 } from "fs";
464
464
  import { join as join4 } from "path";
465
465
 
466
466
  // src/shared/loadJson.ts
467
- import { existsSync as existsSync4, mkdirSync, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
467
+ import {
468
+ existsSync as existsSync4,
469
+ mkdirSync,
470
+ readFileSync as readFileSync4,
471
+ renameSync,
472
+ rmSync,
473
+ writeFileSync as writeFileSync2
474
+ } from "fs";
468
475
  import { homedir } from "os";
469
476
  import { join as join3 } from "path";
470
477
  function getStoreDir() {
@@ -489,7 +496,15 @@ function saveJson(filename, data) {
489
496
  if (!existsSync4(dir)) {
490
497
  mkdirSync(dir, { recursive: true });
491
498
  }
492
- writeFileSync2(getStorePath(filename), JSON.stringify(data, null, 2));
499
+ const path109 = getStorePath(filename);
500
+ const tmp = `${path109}.${process.pid}.tmp`;
501
+ try {
502
+ writeFileSync2(tmp, JSON.stringify(data, null, 2));
503
+ renameSync(tmp, path109);
504
+ } catch (error) {
505
+ rmSync(tmp, { force: true });
506
+ throw error;
507
+ }
493
508
  }
494
509
 
495
510
  // src/shared/readRepoConfigCache.ts
@@ -5064,7 +5079,7 @@ import { join as join24 } from "path";
5064
5079
  import chalk31 from "chalk";
5065
5080
 
5066
5081
  // src/commands/backlog/backupLocalBacklogFiles.ts
5067
- import { existsSync as existsSync22, renameSync } from "fs";
5082
+ import { existsSync as existsSync22, renameSync as renameSync2 } from "fs";
5068
5083
  import { join as join23 } from "path";
5069
5084
  var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
5070
5085
  function backupLocalBacklogFiles(dir) {
@@ -5072,7 +5087,7 @@ function backupLocalBacklogFiles(dir) {
5072
5087
  for (const name of LOCAL_FILES) {
5073
5088
  const path109 = join23(dir, ".assist", name);
5074
5089
  if (existsSync22(path109)) {
5075
- renameSync(path109, `${path109}.bak`);
5090
+ renameSync2(path109, `${path109}.bak`);
5076
5091
  moved.push(`${name} \u2192 ${name}.bak`);
5077
5092
  }
5078
5093
  }
@@ -8657,7 +8672,7 @@ import {
8657
8672
  existsSync as existsSync28,
8658
8673
  mkdirSync as mkdirSync8,
8659
8674
  readFileSync as readFileSync20,
8660
- rmSync,
8675
+ rmSync as rmSync2,
8661
8676
  writeFileSync as writeFileSync19
8662
8677
  } from "fs";
8663
8678
  import { homedir as homedir10 } from "os";
@@ -8685,7 +8700,7 @@ function readSignalOwner(itemId2) {
8685
8700
  function clearSignalOwner(itemId2) {
8686
8701
  const path109 = getOwnerPath(itemId2);
8687
8702
  try {
8688
- rmSync(path109);
8703
+ rmSync2(path109);
8689
8704
  } catch {
8690
8705
  }
8691
8706
  }
@@ -8910,7 +8925,7 @@ async function persistPhaseSessionId(itemId2, phaseIdx, claudeSessionId) {
8910
8925
  }
8911
8926
 
8912
8927
  // src/shared/emitActivity.ts
8913
- import { mkdirSync as mkdirSync10, readFileSync as readFileSync22, rmSync as rmSync2, writeFileSync as writeFileSync21 } from "fs";
8928
+ import { mkdirSync as mkdirSync10, readFileSync as readFileSync22, rmSync as rmSync3, writeFileSync as writeFileSync21 } from "fs";
8914
8929
  import { homedir as homedir12 } from "os";
8915
8930
  import { dirname as dirname18, join as join34 } from "path";
8916
8931
  import { z as z8 } from "zod";
@@ -8955,7 +8970,7 @@ function reconcileActivity(sessionId, activity2) {
8955
8970
  }
8956
8971
  function removeActivity(sessionId) {
8957
8972
  try {
8958
- rmSync2(activityPath(sessionId));
8973
+ rmSync3(activityPath(sessionId));
8959
8974
  } catch {
8960
8975
  }
8961
8976
  }
@@ -8997,57 +9012,10 @@ function reportPhaseActivity(item, phaseNumber, totalPhases, phase, claudeSessio
8997
9012
  import chalk69 from "chalk";
8998
9013
 
8999
9014
  // src/commands/sessions/shared/findSessionJsonlPath.ts
9000
- import * as path25 from "path";
9001
-
9002
- // src/commands/sessions/shared/discoverSessions.ts
9003
- import * as fs15 from "fs";
9004
- import * as os4 from "os";
9005
- import * as path24 from "path";
9015
+ import * as path22 from "path";
9006
9016
 
9007
- // src/commands/sessions/shared/codex/discoverCodexRolloutPaths.ts
9017
+ // src/commands/sessions/shared/parseSessionFile.ts
9008
9018
  import * as fs11 from "fs";
9009
- import * as path21 from "path";
9010
-
9011
- // src/commands/sessions/shared/codex/codexSessionsDir.ts
9012
- import { existsSync as existsSync32 } from "fs";
9013
- import * as path20 from "path";
9014
- function codexSessionsDir() {
9015
- return path20.join(harnesses.codex.homeDir, "sessions");
9016
- }
9017
- function hasCodexSessions() {
9018
- return existsSync32(codexSessionsDir());
9019
- }
9020
-
9021
- // src/commands/sessions/shared/codex/discoverCodexRolloutPaths.ts
9022
- var DATE_DEPTH = 3;
9023
- function isCodexRolloutFile(name) {
9024
- return name.startsWith("rollout-") && name.endsWith(".jsonl");
9025
- }
9026
- async function discoverCodexRolloutPaths() {
9027
- if (!hasCodexSessions()) return [];
9028
- return collect(codexSessionsDir(), DATE_DEPTH);
9029
- }
9030
- async function collect(dir, depth) {
9031
- let entries;
9032
- try {
9033
- entries = await fs11.promises.readdir(dir, { withFileTypes: true });
9034
- } catch {
9035
- return [];
9036
- }
9037
- const nested = await Promise.all(
9038
- entries.map((entry) => collectEntry(dir, entry, depth))
9039
- );
9040
- return nested.flat();
9041
- }
9042
- async function collectEntry(dir, entry, depth) {
9043
- const full = path21.join(dir, entry.name);
9044
- if (entry.isDirectory()) return depth > 0 ? collect(full, depth - 1) : [];
9045
- return isCodexRolloutFile(entry.name) ? [full] : [];
9046
- }
9047
-
9048
- // src/commands/sessions/shared/codex/parseCodexSessionFile.ts
9049
- import * as fs13 from "fs";
9050
- import * as path22 from "path";
9051
9019
 
9052
9020
  // src/commands/sessions/shared/deriveHistoryFields.ts
9053
9021
  var KNOWN = [
@@ -9078,119 +9046,14 @@ function deriveSessionType(commandName, name) {
9078
9046
  return void 0;
9079
9047
  }
9080
9048
 
9081
- // src/commands/sessions/shared/codex/parseRolloutEntry.ts
9082
- function parseRolloutEntry(line) {
9083
- try {
9084
- const parsed = JSON.parse(line);
9085
- return parsed && typeof parsed === "object" ? parsed : null;
9086
- } catch {
9087
- return null;
9088
- }
9089
- }
9090
- function rolloutPayload(entry) {
9091
- return entry.payload && typeof entry.payload === "object" ? entry.payload : {};
9092
- }
9093
- function rolloutString(value) {
9094
- return typeof value === "string" ? value : "";
9095
- }
9096
-
9097
- // src/commands/sessions/shared/codex/codexRolloutMeta.ts
9098
- var MAX_FIRST_MESSAGE = 2e3;
9099
- function codexRolloutMeta(lines2) {
9100
- const meta = {
9101
- sessionId: "",
9102
- cwd: "",
9103
- timestamp: "",
9104
- firstMessage: ""
9105
- };
9106
- for (const line of lines2) {
9107
- const entry = parseRolloutEntry(line);
9108
- if (!entry) continue;
9109
- applySessionMeta(meta, entry);
9110
- meta.firstMessage ||= firstUserMessage(entry);
9111
- if (meta.sessionId && meta.firstMessage) break;
9112
- }
9113
- return meta;
9114
- }
9115
- function applySessionMeta(meta, entry) {
9116
- if (entry.type !== "session_meta") return;
9117
- const payload = rolloutPayload(entry);
9118
- meta.sessionId ||= rolloutString(payload.session_id);
9119
- meta.cwd ||= rolloutString(payload.cwd);
9120
- meta.timestamp ||= rolloutString(payload.timestamp);
9121
- }
9122
- function firstUserMessage(entry) {
9123
- if (entry.type !== "event_msg") return "";
9124
- const payload = rolloutPayload(entry);
9125
- if (payload.type !== "user_message") return "";
9126
- return rolloutString(payload.message).trim().slice(0, MAX_FIRST_MESSAGE);
9127
- }
9128
-
9129
- // src/commands/sessions/shared/codex/readCodexHeadLines.ts
9130
- import * as fs12 from "fs";
9131
- import * as readline3 from "readline";
9132
- var DEFAULT_MAX_LINES = 80;
9133
- async function readCodexHeadLines(filePath, maxLines = DEFAULT_MAX_LINES) {
9134
- const stream = fs12.createReadStream(filePath, { encoding: "utf8" });
9135
- const reader = readline3.createInterface({ input: stream });
9136
- const lines2 = [];
9137
- try {
9138
- for await (const line of reader) {
9139
- if (line) lines2.push(line);
9140
- if (lines2.length >= maxLines) break;
9141
- }
9142
- } catch {
9143
- return lines2;
9144
- } finally {
9145
- reader.close();
9146
- stream.destroy();
9147
- }
9148
- return lines2;
9149
- }
9150
-
9151
- // src/commands/sessions/shared/codex/parseCodexSessionFile.ts
9152
- async function parseCodexSessionFile(filePath) {
9153
- try {
9154
- const meta = codexRolloutMeta(await readCodexHeadLines(filePath));
9155
- if (!meta.sessionId) return null;
9156
- const name = meta.firstMessage.slice(0, 80);
9157
- const markers = backlogRunMarkers(meta.firstMessage);
9158
- return {
9159
- sessionId: meta.sessionId,
9160
- name: name || `Session ${meta.sessionId.slice(0, 8)}`,
9161
- project: meta.cwd ? path22.basename(meta.cwd) : "",
9162
- cwd: meta.cwd,
9163
- timestamp: meta.timestamp || await mtime(filePath),
9164
- origin: "wsl",
9165
- harness: "codex",
9166
- ...deriveHistoryFields(markers.commandName, markers.commandArgs, name)
9167
- };
9168
- } catch {
9169
- return null;
9170
- }
9171
- }
9172
- async function mtime(filePath) {
9173
- return (await fs13.promises.stat(filePath)).mtime.toISOString();
9174
- }
9175
-
9176
- // src/commands/sessions/shared/codex/discoverCodexSessions.ts
9177
- async function discoverCodexSessions() {
9178
- const paths = await discoverCodexRolloutPaths();
9179
- const parsed = await Promise.all(paths.map(parseCodexSessionFile));
9180
- return parsed.filter((session) => session !== null);
9181
- }
9182
-
9183
- // src/commands/sessions/shared/parseSessionFile.ts
9184
- import * as fs14 from "fs";
9185
-
9186
9049
  // src/commands/sessions/shared/deriveProject.ts
9187
- import * as path23 from "path";
9050
+ import * as path20 from "path";
9188
9051
  function deriveProject(cwd, filePath, origin) {
9189
9052
  if (!cwd) return dirNameToProject(filePath);
9190
- return origin === "windows" ? path23.win32.basename(cwd) : path23.basename(cwd);
9053
+ return origin === "windows" ? path20.win32.basename(cwd) : path20.basename(cwd);
9191
9054
  }
9192
9055
  function dirNameToProject(filePath) {
9193
- const dirName = path23.basename(path23.dirname(filePath));
9056
+ const dirName = path20.basename(path20.dirname(filePath));
9194
9057
  const parts = dirName.split("--");
9195
9058
  return parts[parts.length - 1].replace(/-/g, "/");
9196
9059
  }
@@ -9199,10 +9062,10 @@ function dirNameToProject(filePath) {
9199
9062
  async function parseSessionFile(filePath, origin = "wsl") {
9200
9063
  let handle;
9201
9064
  try {
9202
- handle = await fs14.promises.open(filePath, "r");
9065
+ handle = await fs11.promises.open(filePath, "r");
9203
9066
  const meta = extractSessionMeta(await readHeadLines(handle));
9204
9067
  if (!meta.sessionId) return null;
9205
- const timestamp6 = meta.timestamp || (await fs14.promises.stat(filePath)).mtime.toISOString();
9068
+ const timestamp6 = meta.timestamp || (await fs11.promises.stat(filePath)).mtime.toISOString();
9206
9069
  return {
9207
9070
  sessionId: meta.sessionId,
9208
9071
  name: meta.name || `Session ${meta.sessionId.slice(0, 8)}`,
@@ -9224,34 +9087,32 @@ async function readHeadLines(handle) {
9224
9087
  return buf.toString("utf8", 0, bytesRead).split("\n").filter(Boolean);
9225
9088
  }
9226
9089
 
9227
- // src/commands/sessions/shared/discoverSessions.ts
9228
- function sessionRoots() {
9229
- return [
9230
- { dir: path24.join(os4.homedir(), ".claude", "projects"), origin: "wsl" }
9231
- ];
9232
- }
9090
+ // src/commands/sessions/shared/discoverSessionJsonlPaths.ts
9091
+ import * as fs12 from "fs";
9092
+ import * as os4 from "os";
9093
+ import * as path21 from "path";
9233
9094
  async function discoverSessionJsonlPaths() {
9234
9095
  const results = [];
9235
9096
  await Promise.all(
9236
9097
  sessionRoots().map(async ({ dir, origin }) => {
9237
9098
  let projectDirs;
9238
9099
  try {
9239
- projectDirs = await fs15.promises.readdir(dir);
9100
+ projectDirs = await fs12.promises.readdir(dir);
9240
9101
  } catch {
9241
9102
  return;
9242
9103
  }
9243
9104
  await Promise.all(
9244
9105
  projectDirs.map(async (dirName) => {
9245
- const dirPath = path24.join(dir, dirName);
9106
+ const dirPath = path21.join(dir, dirName);
9246
9107
  let entries;
9247
9108
  try {
9248
- entries = await fs15.promises.readdir(dirPath);
9109
+ entries = await fs12.promises.readdir(dirPath);
9249
9110
  } catch {
9250
9111
  return;
9251
9112
  }
9252
9113
  for (const file of entries) {
9253
9114
  if (file.endsWith(".jsonl"))
9254
- results.push({ path: path24.join(dirPath, file), origin });
9115
+ results.push({ path: path21.join(dirPath, file), origin });
9255
9116
  }
9256
9117
  })
9257
9118
  );
@@ -9259,30 +9120,17 @@ async function discoverSessionJsonlPaths() {
9259
9120
  );
9260
9121
  return results;
9261
9122
  }
9262
- async function discoverSessionFiles() {
9263
- return (await discoverSessionJsonlPaths()).map((p) => p.path);
9264
- }
9265
- async function discoverSessions() {
9266
- const paths = await discoverSessionJsonlPaths();
9267
- const sessions = [];
9268
- await Promise.all(
9269
- paths.map(async ({ path: filePath, origin }) => {
9270
- const session = await parseSessionFile(filePath, origin);
9271
- if (session) sessions.push(session);
9272
- })
9273
- );
9274
- sessions.push(...await discoverCodexSessions());
9275
- sessions.sort(
9276
- (a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime()
9277
- );
9278
- return sessions;
9123
+ function sessionRoots() {
9124
+ return [
9125
+ { dir: path21.join(os4.homedir(), ".claude", "projects"), origin: "wsl" }
9126
+ ];
9279
9127
  }
9280
9128
 
9281
9129
  // src/commands/sessions/shared/findSessionJsonlPath.ts
9282
9130
  async function findSessionJsonlPath(sessionId) {
9283
9131
  const paths = await discoverSessionJsonlPaths();
9284
9132
  const direct = paths.find(
9285
- (p) => path25.basename(p.path, ".jsonl") === sessionId
9133
+ (p) => path22.basename(p.path, ".jsonl") === sessionId
9286
9134
  );
9287
9135
  if (direct) return direct.path;
9288
9136
  for (const p of paths) {
@@ -10782,14 +10630,14 @@ async function updatePhase(id, phase, options2) {
10782
10630
  }
10783
10631
 
10784
10632
  // src/commands/backlog/registerUpdatePhaseCommand.ts
10785
- function collect2(value, previous) {
10633
+ function collect(value, previous) {
10786
10634
  return [...previous, value];
10787
10635
  }
10788
10636
  function registerUpdatePhaseCommand(cmd) {
10789
- cmd.command("update-phase <id> <phase>").alias("edit-phase").description("Modify a plan phase on a backlog item").option("--name <name>", "New phase name").option("--task <task...>", "Replace tasks (repeatable)").option("--manual-check <check...>", "Replace manual checks (repeatable)").option("--add-task <text>", "Append one task (repeatable)", collect2, []).option("--edit-task <n> <text...>", "Replace task n (1-based) in place").option("--remove-task <n>", "Remove task n (1-based)").option(
10637
+ cmd.command("update-phase <id> <phase>").alias("edit-phase").description("Modify a plan phase on a backlog item").option("--name <name>", "New phase name").option("--task <task...>", "Replace tasks (repeatable)").option("--manual-check <check...>", "Replace manual checks (repeatable)").option("--add-task <text>", "Append one task (repeatable)", collect, []).option("--edit-task <n> <text...>", "Replace task n (1-based) in place").option("--remove-task <n>", "Remove task n (1-based)").option(
10790
10638
  "--add-check <text>",
10791
10639
  "Append one manual check (repeatable)",
10792
- collect2,
10640
+ collect,
10793
10641
  []
10794
10642
  ).option(
10795
10643
  "--edit-check <n> <text...>",
@@ -11174,7 +11022,7 @@ async function updatePlan(id, options2) {
11174
11022
  }
11175
11023
 
11176
11024
  // src/commands/backlog/registerUpdateCommands.ts
11177
- function collect3(value, previous) {
11025
+ function collect2(value, previous) {
11178
11026
  return [...previous, value];
11179
11027
  }
11180
11028
  function registerUpdateCommands(cmd) {
@@ -11184,7 +11032,7 @@ function registerUpdateCommands(cmd) {
11184
11032
  ).option("--type <type>", "New type (story or bug)").option("--ac <criterion...>", "Replace acceptance criteria (repeatable)").option(
11185
11033
  "--add-ac <text>",
11186
11034
  "Append one acceptance criterion (repeatable)",
11187
- collect3,
11035
+ collect2,
11188
11036
  []
11189
11037
  ).option(
11190
11038
  "--edit-ac <n> <text...>",
@@ -11232,13 +11080,13 @@ function isGitRepo(dir) {
11232
11080
  }
11233
11081
 
11234
11082
  // src/shared/sweepStagedAttachments.ts
11235
- import { readdirSync as readdirSync4, rmSync as rmSync3, statSync as statSync3 } from "fs";
11236
- import { join as join39 } from "path";
11083
+ import { readdirSync as readdirSync4, rmSync as rmSync4, statSync as statSync3 } from "fs";
11084
+ import { join as join37 } from "path";
11237
11085
 
11238
11086
  // src/shared/stagedAttachmentsDir.ts
11239
11087
  import { homedir as homedir14 } from "os";
11240
- import { join as join38 } from "path";
11241
- var stagedAttachmentsDir = join38(homedir14(), ".assist", "attachments");
11088
+ import { join as join36 } from "path";
11089
+ var stagedAttachmentsDir = join36(homedir14(), ".assist", "attachments");
11242
11090
 
11243
11091
  // src/shared/sweepStagedAttachments.ts
11244
11092
  var PANE_PERSIST_TTL_MS = 24 * 60 * 60 * 1e3;
@@ -11251,10 +11099,10 @@ function sweepStagedAttachments(dir = stagedAttachmentsDir, now = Date.now()) {
11251
11099
  }
11252
11100
  for (const name of entries) {
11253
11101
  if (!name.startsWith("upload-")) continue;
11254
- const path109 = join39(dir, name);
11102
+ const path109 = join37(dir, name);
11255
11103
  try {
11256
11104
  if (now - statSync3(path109).mtimeMs > PANE_PERSIST_TTL_MS)
11257
- rmSync3(path109, { recursive: true, force: true });
11105
+ rmSync4(path109, { recursive: true, force: true });
11258
11106
  } catch {
11259
11107
  }
11260
11108
  }
@@ -11483,7 +11331,7 @@ function delay(ms) {
11483
11331
 
11484
11332
  // src/commands/sessions/nodes/tailscaleStatus.ts
11485
11333
  import { execFile as execFile3 } from "child_process";
11486
- import { existsSync as existsSync33 } from "fs";
11334
+ import { existsSync as existsSync32 } from "fs";
11487
11335
  import { promisify as promisify2 } from "util";
11488
11336
  var execFileAsync2 = promisify2(execFile3);
11489
11337
  var STATUS_TIMEOUT_MS = 1e4;
@@ -11495,7 +11343,7 @@ var INSTALLED_CLI = {
11495
11343
  function tailscaleCli() {
11496
11344
  const platform = detectPlatform();
11497
11345
  const installed = INSTALLED_CLI[platform];
11498
- if (installed && existsSync33(installed)) return installed;
11346
+ if (installed && existsSync32(installed)) return installed;
11499
11347
  return platform === "wsl" ? "tailscale.exe" : "tailscale";
11500
11348
  }
11501
11349
  async function tailscaleStatus() {
@@ -11612,7 +11460,7 @@ async function ensureTailscaleServe(port, deps2 = {}) {
11612
11460
  import { WebSocketServer } from "ws";
11613
11461
 
11614
11462
  // src/commands/sessions/web/handleSocket.ts
11615
- import { createInterface as createInterface4 } from "readline";
11463
+ import { createInterface as createInterface3 } from "readline";
11616
11464
 
11617
11465
  // src/commands/sessions/daemon/links/isLinkCreate.ts
11618
11466
  var CREATE_TYPES = /* @__PURE__ */ new Set([
@@ -11695,7 +11543,7 @@ async function openDaemonConnection(ws, ctx) {
11695
11543
  }
11696
11544
  }
11697
11545
  function relayDaemonLines(conn, ws, repoCwd) {
11698
- const lines2 = createInterface4({ input: conn });
11546
+ const lines2 = createInterface3({ input: conn });
11699
11547
  lines2.on("error", () => {
11700
11548
  });
11701
11549
  lines2.on("line", (line) => {
@@ -11771,38 +11619,6 @@ function attachSessionSocket(server, ctx) {
11771
11619
  });
11772
11620
  }
11773
11621
 
11774
- // src/shared/createBundleHandler.ts
11775
- import { createHash } from "crypto";
11776
- import { readFileSync as readFileSync23, statSync as statSync5 } from "fs";
11777
- import { dirname as dirname21, join as join40 } from "path";
11778
- import { fileURLToPath as fileURLToPath4 } from "url";
11779
- function createBundleHandler(importMetaUrl, bundlePath, contentType = "application/javascript") {
11780
- const file = join40(dirname21(fileURLToPath4(importMetaUrl)), bundlePath);
11781
- let cache6;
11782
- return (req, res) => {
11783
- const mtimeMs = statSync5(file).mtimeMs;
11784
- if (cache6?.mtimeMs !== mtimeMs) {
11785
- const body = readFileSync23(file);
11786
- const etag = `"${createHash("sha256").update(body).digest("hex").slice(0, 16)}"`;
11787
- cache6 = { body, etag, mtimeMs };
11788
- }
11789
- const headers = {
11790
- ETag: cache6.etag,
11791
- "Cache-Control": "no-cache"
11792
- };
11793
- if (req.headers["if-none-match"] === cache6.etag) {
11794
- res.writeHead(304, headers);
11795
- res.end();
11796
- return;
11797
- }
11798
- res.writeHead(200, {
11799
- "Content-Type": contentType,
11800
- ...headers
11801
- });
11802
- res.end(cache6.body);
11803
- };
11804
- }
11805
-
11806
11622
  // src/shared/createFallbackHandler.ts
11807
11623
  function createFallbackHandler(routes3, htmlHandler2, extra) {
11808
11624
  const baseHandler = createRouteHandler(routes3);
@@ -11822,12 +11638,12 @@ function createFallbackHandler(routes3, htmlHandler2, extra) {
11822
11638
  }
11823
11639
 
11824
11640
  // src/commands/backlog/resolveRepoLocation.ts
11825
- import { existsSync as existsSync34 } from "fs";
11641
+ import { existsSync as existsSync33 } from "fs";
11826
11642
  function resolveRepoLocation(origin, knownCwd, baseDir) {
11827
11643
  if (knownCwd) return { cwd: knownCwd };
11828
11644
  const target = cloneTargetDir(origin, baseDir);
11829
11645
  if (!target) return {};
11830
- if (existsSync34(target) && getCurrentOrigin(target) === origin)
11646
+ if (existsSync33(target) && getCurrentOrigin(target) === origin)
11831
11647
  return { cwd: target };
11832
11648
  return { cloneTarget: target };
11833
11649
  }
@@ -11897,6 +11713,148 @@ function applyCwdFromReq(req) {
11897
11713
 
11898
11714
  // src/commands/sessions/shared/lookupSessionsById.ts
11899
11715
  import * as path26 from "path";
11716
+
11717
+ // src/commands/sessions/shared/codex/discoverCodexRolloutPaths.ts
11718
+ import * as fs13 from "fs";
11719
+ import * as path24 from "path";
11720
+
11721
+ // src/commands/sessions/shared/codex/codexSessionsDir.ts
11722
+ import { existsSync as existsSync34 } from "fs";
11723
+ import * as path23 from "path";
11724
+ function codexSessionsDir() {
11725
+ return path23.join(harnesses.codex.homeDir, "sessions");
11726
+ }
11727
+ function hasCodexSessions() {
11728
+ return existsSync34(codexSessionsDir());
11729
+ }
11730
+
11731
+ // src/commands/sessions/shared/codex/discoverCodexRolloutPaths.ts
11732
+ var DATE_DEPTH = 3;
11733
+ function isCodexRolloutFile(name) {
11734
+ return name.startsWith("rollout-") && name.endsWith(".jsonl");
11735
+ }
11736
+ async function discoverCodexRolloutPaths() {
11737
+ if (!hasCodexSessions()) return [];
11738
+ return collect3(codexSessionsDir(), DATE_DEPTH);
11739
+ }
11740
+ async function collect3(dir, depth) {
11741
+ let entries;
11742
+ try {
11743
+ entries = await fs13.promises.readdir(dir, { withFileTypes: true });
11744
+ } catch {
11745
+ return [];
11746
+ }
11747
+ const nested = await Promise.all(
11748
+ entries.map((entry) => collectEntry(dir, entry, depth))
11749
+ );
11750
+ return nested.flat();
11751
+ }
11752
+ async function collectEntry(dir, entry, depth) {
11753
+ const full = path24.join(dir, entry.name);
11754
+ if (entry.isDirectory()) return depth > 0 ? collect3(full, depth - 1) : [];
11755
+ return isCodexRolloutFile(entry.name) ? [full] : [];
11756
+ }
11757
+
11758
+ // src/commands/sessions/shared/codex/parseCodexSessionFile.ts
11759
+ import * as fs15 from "fs";
11760
+ import * as path25 from "path";
11761
+
11762
+ // src/commands/sessions/shared/codex/parseRolloutEntry.ts
11763
+ function parseRolloutEntry(line) {
11764
+ try {
11765
+ const parsed = JSON.parse(line);
11766
+ return parsed && typeof parsed === "object" ? parsed : null;
11767
+ } catch {
11768
+ return null;
11769
+ }
11770
+ }
11771
+ function rolloutPayload(entry) {
11772
+ return entry.payload && typeof entry.payload === "object" ? entry.payload : {};
11773
+ }
11774
+ function rolloutString(value) {
11775
+ return typeof value === "string" ? value : "";
11776
+ }
11777
+
11778
+ // src/commands/sessions/shared/codex/codexRolloutMeta.ts
11779
+ var MAX_FIRST_MESSAGE = 2e3;
11780
+ function codexRolloutMeta(lines2) {
11781
+ const meta = {
11782
+ sessionId: "",
11783
+ cwd: "",
11784
+ timestamp: "",
11785
+ firstMessage: ""
11786
+ };
11787
+ for (const line of lines2) {
11788
+ const entry = parseRolloutEntry(line);
11789
+ if (!entry) continue;
11790
+ applySessionMeta(meta, entry);
11791
+ meta.firstMessage ||= firstUserMessage(entry);
11792
+ if (meta.sessionId && meta.firstMessage) break;
11793
+ }
11794
+ return meta;
11795
+ }
11796
+ function applySessionMeta(meta, entry) {
11797
+ if (entry.type !== "session_meta") return;
11798
+ const payload = rolloutPayload(entry);
11799
+ meta.sessionId ||= rolloutString(payload.session_id);
11800
+ meta.cwd ||= rolloutString(payload.cwd);
11801
+ meta.timestamp ||= rolloutString(payload.timestamp);
11802
+ }
11803
+ function firstUserMessage(entry) {
11804
+ if (entry.type !== "event_msg") return "";
11805
+ const payload = rolloutPayload(entry);
11806
+ if (payload.type !== "user_message") return "";
11807
+ return rolloutString(payload.message).trim().slice(0, MAX_FIRST_MESSAGE);
11808
+ }
11809
+
11810
+ // src/commands/sessions/shared/codex/readCodexHeadLines.ts
11811
+ import * as fs14 from "fs";
11812
+ import * as readline3 from "readline";
11813
+ var DEFAULT_MAX_LINES = 80;
11814
+ async function readCodexHeadLines(filePath, maxLines = DEFAULT_MAX_LINES) {
11815
+ const stream = fs14.createReadStream(filePath, { encoding: "utf8" });
11816
+ const reader = readline3.createInterface({ input: stream });
11817
+ const lines2 = [];
11818
+ try {
11819
+ for await (const line of reader) {
11820
+ if (line) lines2.push(line);
11821
+ if (lines2.length >= maxLines) break;
11822
+ }
11823
+ } catch {
11824
+ return lines2;
11825
+ } finally {
11826
+ reader.close();
11827
+ stream.destroy();
11828
+ }
11829
+ return lines2;
11830
+ }
11831
+
11832
+ // src/commands/sessions/shared/codex/parseCodexSessionFile.ts
11833
+ async function parseCodexSessionFile(filePath) {
11834
+ try {
11835
+ const meta = codexRolloutMeta(await readCodexHeadLines(filePath));
11836
+ if (!meta.sessionId) return null;
11837
+ const name = meta.firstMessage.slice(0, 80);
11838
+ const markers = backlogRunMarkers(meta.firstMessage);
11839
+ return {
11840
+ sessionId: meta.sessionId,
11841
+ name: name || `Session ${meta.sessionId.slice(0, 8)}`,
11842
+ project: meta.cwd ? path25.basename(meta.cwd) : "",
11843
+ cwd: meta.cwd,
11844
+ timestamp: meta.timestamp || await mtime(filePath),
11845
+ origin: "wsl",
11846
+ harness: "codex",
11847
+ ...deriveHistoryFields(markers.commandName, markers.commandArgs, name)
11848
+ };
11849
+ } catch {
11850
+ return null;
11851
+ }
11852
+ }
11853
+ async function mtime(filePath) {
11854
+ return (await fs15.promises.stat(filePath)).mtime.toISOString();
11855
+ }
11856
+
11857
+ // src/commands/sessions/shared/lookupSessionsById.ts
11900
11858
  var CODEX_ROLLOUT_ID_LENGTH = 36;
11901
11859
  async function lookupSessionsById(ids) {
11902
11860
  const wanted = new Set(ids);
@@ -14107,20 +14065,20 @@ function handleServerRuns(req, res) {
14107
14065
 
14108
14066
  // src/commands/sessions/web/getReviewSynthesis.ts
14109
14067
  import { execFile as execFile6 } from "child_process";
14110
- import { readFileSync as readFileSync24 } from "fs";
14068
+ import { readFileSync as readFileSync23 } from "fs";
14111
14069
  import { homedir as homedir15 } from "os";
14112
- import { basename as basename12, join as join42 } from "path";
14070
+ import { basename as basename12, join as join41 } from "path";
14113
14071
  import { promisify as promisify5 } from "util";
14114
14072
 
14115
14073
  // src/commands/sessions/web/findSynthesisForBranch.ts
14116
- import { existsSync as existsSync35, readdirSync as readdirSync5, statSync as statSync6 } from "fs";
14117
- import { basename as basename11, dirname as dirname22, join as join41 } from "path";
14074
+ import { existsSync as existsSync35, readdirSync as readdirSync5, statSync as statSync5 } from "fs";
14075
+ import { basename as basename11, dirname as dirname21, join as join40 } from "path";
14118
14076
  function findSynthesisForBranch(repoReviewsDir, branch2) {
14119
- const branchKeyPath = join41(repoReviewsDir, `${branch2}-`);
14120
- const parent = dirname22(branchKeyPath);
14077
+ const branchKeyPath = join40(repoReviewsDir, `${branch2}-`);
14078
+ const parent = dirname21(branchKeyPath);
14121
14079
  const branchPrefix = basename11(branchKeyPath);
14122
14080
  if (!existsSync35(parent)) return null;
14123
- const synthesisFiles = readdirSync5(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join41(parent, name, "synthesis.md")).filter((path109) => existsSync35(path109)).map((path109) => ({ path: path109, mtime: statSync6(path109).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
14081
+ const synthesisFiles = readdirSync5(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join40(parent, name, "synthesis.md")).filter((path109) => existsSync35(path109)).map((path109) => ({ path: path109, mtime: statSync5(path109).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
14124
14082
  return synthesisFiles[0]?.path ?? null;
14125
14083
  }
14126
14084
 
@@ -14138,7 +14096,7 @@ async function resolveSynthesisPath(cwd) {
14138
14096
  runGit2(cwd, ["rev-parse", "--show-toplevel"]),
14139
14097
  runGit2(cwd, ["rev-parse", "--abbrev-ref", "HEAD"])
14140
14098
  ]);
14141
- const repoReviewsDir = join42(
14099
+ const repoReviewsDir = join41(
14142
14100
  homedir15(),
14143
14101
  ".assist",
14144
14102
  "reviews",
@@ -14155,7 +14113,7 @@ async function getReviewSynthesis(req, res) {
14155
14113
  respondJson(res, 404, { error: "No synthesis found" });
14156
14114
  return;
14157
14115
  }
14158
- respondJson(res, 200, { synthesis: readFileSync24(path109, "utf8") });
14116
+ respondJson(res, 200, { synthesis: readFileSync23(path109, "utf8") });
14159
14117
  } catch {
14160
14118
  respondJson(res, 404, { error: "No synthesis found" });
14161
14119
  }
@@ -14381,7 +14339,7 @@ function describeProtocolGap(node, msg) {
14381
14339
  // src/commands/sessions/daemon/requestDaemonReply.ts
14382
14340
  import { createInterface as createInterface5 } from "readline";
14383
14341
  var QUERY_TIMEOUT_MS = 3e3;
14384
- async function requestDaemonReply(request, replyType) {
14342
+ async function requestDaemonReply(request, replyType, timeoutMs = QUERY_TIMEOUT_MS) {
14385
14343
  let socket;
14386
14344
  try {
14387
14345
  socket = await connectToDaemon();
@@ -14394,7 +14352,7 @@ async function requestDaemonReply(request, replyType) {
14394
14352
  socket.destroy();
14395
14353
  resolve30(result);
14396
14354
  };
14397
- const timer = setTimeout(() => finish2(void 0), QUERY_TIMEOUT_MS);
14355
+ const timer = setTimeout(() => finish2(void 0), timeoutMs);
14398
14356
  const lines2 = createInterface5({ input: socket });
14399
14357
  lines2.on("error", () => {
14400
14358
  });
@@ -14431,6 +14389,35 @@ async function health(_req, res) {
14431
14389
  });
14432
14390
  }
14433
14391
 
14392
+ // src/commands/sessions/web/getCwdAndQuery.ts
14393
+ function getCwdAndQuery(req, res) {
14394
+ const cwd = getCwdParam(req, res);
14395
+ if (!cwd) return null;
14396
+ const query = new URL(req.url ?? "/", "http://localhost").searchParams.get("q") ?? "";
14397
+ return { cwd, query };
14398
+ }
14399
+
14400
+ // src/commands/sessions/web/historySearch.ts
14401
+ var SEARCH_TIMEOUT_MS = 15e3;
14402
+ async function historySearch(req, res) {
14403
+ const params = getCwdAndQuery(req, res);
14404
+ if (!params) return;
14405
+ const reply2 = await requestDaemonReply(
14406
+ { type: "search-history", ...params },
14407
+ "history-search",
14408
+ SEARCH_TIMEOUT_MS
14409
+ );
14410
+ if (!reply2) {
14411
+ respondJson(res, 504, { error: "Daemon did not answer the search" });
14412
+ return;
14413
+ }
14414
+ if (reply2.error) {
14415
+ respondJson(res, 500, { error: reply2.error });
14416
+ return;
14417
+ }
14418
+ respondJson(res, 200, { sessions: reply2.sessions ?? [] });
14419
+ }
14420
+
14434
14421
  // src/shared/hotkeys/resolveHotkeys.ts
14435
14422
  function resolveHotkeys(overrides) {
14436
14423
  const bindings = { ...defaultHotkeys };
@@ -14520,9 +14507,9 @@ async function repoFiles(cwd) {
14520
14507
  return files;
14521
14508
  }
14522
14509
  async function listFiles(req, res) {
14523
- const cwd = getCwdParam(req, res);
14524
- if (!cwd) return;
14525
- const query = new URL(req.url ?? "/", "http://localhost").searchParams.get("q") ?? "";
14510
+ const params = getCwdAndQuery(req, res);
14511
+ if (!params) return;
14512
+ const { cwd, query } = params;
14526
14513
  try {
14527
14514
  const files = await repoFiles(cwd);
14528
14515
  respondJson(res, 200, { files: rankFilePaths(files, query, MAX_RESULTS) });
@@ -15434,7 +15421,7 @@ async function nextPickup(req, res) {
15434
15421
  import path29 from "path";
15435
15422
 
15436
15423
  // src/commands/rules/readScopedRules.ts
15437
- import { existsSync as existsSync37, readFileSync as readFileSync25 } from "fs";
15424
+ import { existsSync as existsSync37, readFileSync as readFileSync24 } from "fs";
15438
15425
  import path28 from "path";
15439
15426
 
15440
15427
  // src/commands/rules/rulesSectionRange.ts
@@ -15483,11 +15470,11 @@ function parseRulesSection(content) {
15483
15470
  }
15484
15471
 
15485
15472
  // src/commands/rules/scopeDirectory.ts
15486
- import { existsSync as existsSync36, statSync as statSync7 } from "fs";
15473
+ import { existsSync as existsSync36, statSync as statSync6 } from "fs";
15487
15474
  import path27 from "path";
15488
15475
  function scopeDirectory(target) {
15489
15476
  const resolved = path27.resolve(target);
15490
- return existsSync36(resolved) && statSync7(resolved).isDirectory() ? resolved : path27.dirname(resolved);
15477
+ return existsSync36(resolved) && statSync6(resolved).isDirectory() ? resolved : path27.dirname(resolved);
15491
15478
  }
15492
15479
 
15493
15480
  // src/commands/rules/readScopedRules.ts
@@ -15506,7 +15493,7 @@ function scopedClaudeFiles(target) {
15506
15493
  }
15507
15494
  function readScopedRules(target) {
15508
15495
  return scopedClaudeFiles(target).flatMap(
15509
- (source) => parseRulesSection(readFileSync25(source, "utf8")).map((rule) => ({
15496
+ (source) => parseRulesSection(readFileSync24(source, "utf8")).map((rule) => ({
15510
15497
  ...rule,
15511
15498
  source
15512
15499
  }))
@@ -16840,13 +16827,13 @@ import { existsSync as existsSync39 } from "fs";
16840
16827
  // src/commands/run/resolveCommand.ts
16841
16828
  import { execFileSync as execFileSync4 } from "child_process";
16842
16829
  import { existsSync as existsSync38 } from "fs";
16843
- import { dirname as dirname23, join as join43, resolve as resolve14 } from "path";
16830
+ import { dirname as dirname22, join as join42, resolve as resolve14 } from "path";
16844
16831
  function resolveCommand(command) {
16845
16832
  if (process.platform !== "win32" || command !== "bash") return command;
16846
16833
  try {
16847
16834
  const gitPath = execFileSync4("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
16848
- const gitRoot = resolve14(dirname23(gitPath), "..");
16849
- const gitBash = join43(gitRoot, "bin", "bash.exe");
16835
+ const gitRoot = resolve14(dirname22(gitPath), "..");
16836
+ const gitBash = join42(gitRoot, "bin", "bash.exe");
16850
16837
  if (existsSync38(gitBash)) return gitBash;
16851
16838
  } catch {
16852
16839
  return command;
@@ -17705,18 +17692,18 @@ async function saveRepoConfig(orm, repoKey, config) {
17705
17692
  }
17706
17693
 
17707
17694
  // src/shared/writeRepoConfigCache.ts
17708
- import { mkdirSync as mkdirSync12, renameSync as renameSync2, writeFileSync as writeFileSync22 } from "fs";
17709
- import { dirname as dirname24 } from "path";
17695
+ import { mkdirSync as mkdirSync12, renameSync as renameSync3, writeFileSync as writeFileSync22 } from "fs";
17696
+ import { dirname as dirname23 } from "path";
17710
17697
  function writeRepoConfigCache(repos2) {
17711
17698
  const path109 = repoConfigCachePath();
17712
- mkdirSync12(dirname24(path109), { recursive: true });
17699
+ mkdirSync12(dirname23(path109), { recursive: true });
17713
17700
  const cache6 = {
17714
17701
  refreshedAt: (/* @__PURE__ */ new Date()).toISOString(),
17715
17702
  repos: repos2
17716
17703
  };
17717
17704
  const tmp = `${path109}.${process.pid}.tmp`;
17718
17705
  writeFileSync22(tmp, JSON.stringify(cache6, null, 2));
17719
- renameSync2(tmp, path109);
17706
+ renameSync3(tmp, path109);
17720
17707
  }
17721
17708
 
17722
17709
  // src/shared/refreshRepoConfigCache.ts
@@ -18024,11 +18011,11 @@ function changedPaths(from, cwd) {
18024
18011
  }
18025
18012
 
18026
18013
  // src/commands/watch/readBuiltVersion.ts
18027
- import { join as join44 } from "path";
18014
+ import { join as join43 } from "path";
18028
18015
  function readBuiltVersion(cwd) {
18029
18016
  try {
18030
18017
  const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
18031
- return readPackageJson(join44(root2, "package.json")).version ?? "unknown";
18018
+ return readPackageJson(join43(root2, "package.json")).version ?? "unknown";
18032
18019
  } catch {
18033
18020
  return "unknown";
18034
18021
  }
@@ -18079,9 +18066,9 @@ function stripAnsi(text18) {
18079
18066
  }
18080
18067
 
18081
18068
  // src/commands/sessions/daemon/worktree/watcherLogPath.ts
18082
- import { createHash as createHash2 } from "crypto";
18069
+ import { createHash } from "crypto";
18083
18070
  import { homedir as homedir16 } from "os";
18084
- import { basename as basename13, join as join45 } from "path";
18071
+ import { basename as basename13, join as join44 } from "path";
18085
18072
 
18086
18073
  // src/commands/sessions/daemon/worktree/canonicalTreePath.ts
18087
18074
  import { realpathSync as realpathSync2 } from "fs";
@@ -18097,9 +18084,9 @@ function canonicalTreePath(path109) {
18097
18084
  // src/commands/sessions/daemon/worktree/watcherLogPath.ts
18098
18085
  function watcherLogPath(cwd) {
18099
18086
  const clone = canonicalTreePath(cwd);
18100
- const key = createHash2("sha1").update(clone).digest("hex").slice(0, 8);
18101
- const dir = process.env.ASSIST_WATCHER_LOG_DIR ?? join45(homedir16(), ".assist", "watchers");
18102
- return join45(dir, `${basename13(clone) || "root"}-${key}.log`);
18087
+ const key = createHash("sha1").update(clone).digest("hex").slice(0, 8);
18088
+ const dir = process.env.ASSIST_WATCHER_LOG_DIR ?? join44(homedir16(), ".assist", "watchers");
18089
+ return join44(dir, `${basename13(clone) || "root"}-${key}.log`);
18103
18090
  }
18104
18091
 
18105
18092
  // src/commands/sessions/web/updates/readUpdateHistory.ts
@@ -18214,7 +18201,7 @@ async function readRequestBuffer(req, limit) {
18214
18201
 
18215
18202
  // src/commands/sessions/web/stageAttachment.ts
18216
18203
  import { mkdir as mkdir4, mkdtemp, writeFile as writeFile2 } from "fs/promises";
18217
- import { extname as extname2, join as join46 } from "path";
18204
+ import { extname as extname2, join as join45 } from "path";
18218
18205
 
18219
18206
  // src/commands/sessions/web/ghAttachableExtensions.ts
18220
18207
  var ghAttachableExtensions = /* @__PURE__ */ new Set([
@@ -18246,9 +18233,9 @@ function safeBaseName(name) {
18246
18233
  async function stageAttachment(name, contentType, body) {
18247
18234
  const ext = pickExtension(name, contentType);
18248
18235
  await mkdir4(stagedAttachmentsDir, { recursive: true });
18249
- const dir = await mkdtemp(join46(stagedAttachmentsDir, "upload-"));
18236
+ const dir = await mkdtemp(join45(stagedAttachmentsDir, "upload-"));
18250
18237
  const alt = safeBaseName(name);
18251
- const filePath = join46(dir, `${alt}.${ext}`);
18238
+ const filePath = join45(dir, `${alt}.${ext}`);
18252
18239
  await writeFile2(filePath, body);
18253
18240
  return { dir, filePath, alt };
18254
18241
  }
@@ -18298,16 +18285,16 @@ import { readFile as readFile3, stat as stat4, writeFile as writeFile3 } from "f
18298
18285
  // src/commands/sessions/web/formatWithOxfmt.ts
18299
18286
  import { execFile as execFile10 } from "child_process";
18300
18287
  import { existsSync as existsSync40 } from "fs";
18301
- import { dirname as dirname25, join as join47 } from "path";
18288
+ import { dirname as dirname24, join as join46 } from "path";
18302
18289
  import { promisify as promisify10 } from "util";
18303
18290
  var execFileAsync9 = promisify10(execFile10);
18304
18291
  var TIMEOUT_MS = 15e3;
18305
18292
  function findOxfmtScript(root2) {
18306
18293
  let dir = root2;
18307
18294
  for (; ; ) {
18308
- const candidate = join47(dir, "node_modules", "oxfmt", "bin", "oxfmt");
18295
+ const candidate = join46(dir, "node_modules", "oxfmt", "bin", "oxfmt");
18309
18296
  if (existsSync40(candidate)) return candidate;
18310
- const parent = dirname25(dir);
18297
+ const parent = dirname24(dir);
18311
18298
  if (parent === dir) return void 0;
18312
18299
  dir = parent;
18313
18300
  }
@@ -18375,6 +18362,38 @@ async function writeFileContent(req, res) {
18375
18362
  }
18376
18363
  }
18377
18364
 
18365
+ // src/shared/createBundleHandler.ts
18366
+ import { createHash as createHash2 } from "crypto";
18367
+ import { readFileSync as readFileSync25, statSync as statSync7 } from "fs";
18368
+ import { dirname as dirname25, join as join47 } from "path";
18369
+ import { fileURLToPath as fileURLToPath4 } from "url";
18370
+ function createBundleHandler(importMetaUrl, bundlePath, contentType = "application/javascript") {
18371
+ const file = join47(dirname25(fileURLToPath4(importMetaUrl)), bundlePath);
18372
+ let cache6;
18373
+ return (req, res) => {
18374
+ const mtimeMs = statSync7(file).mtimeMs;
18375
+ if (cache6?.mtimeMs !== mtimeMs) {
18376
+ const body = readFileSync25(file);
18377
+ const etag = `"${createHash2("sha256").update(body).digest("hex").slice(0, 16)}"`;
18378
+ cache6 = { body, etag, mtimeMs };
18379
+ }
18380
+ const headers = {
18381
+ ETag: cache6.etag,
18382
+ "Cache-Control": "no-cache"
18383
+ };
18384
+ if (req.headers["if-none-match"] === cache6.etag) {
18385
+ res.writeHead(304, headers);
18386
+ res.end();
18387
+ return;
18388
+ }
18389
+ res.writeHead(200, {
18390
+ "Content-Type": contentType,
18391
+ ...headers
18392
+ });
18393
+ res.end(cache6.body);
18394
+ };
18395
+ }
18396
+
18378
18397
  // src/commands/sessions/web/createCssHandler.ts
18379
18398
  import { createHash as createHash3 } from "crypto";
18380
18399
  import { readFileSync as readFileSync26 } from "fs";
@@ -18400,15 +18419,13 @@ function createCssHandler(packageEntry) {
18400
18419
  };
18401
18420
  }
18402
18421
 
18403
- // src/commands/sessions/web/handleRequest.ts
18404
- var htmlHandler = createHtmlHandler(getHtml);
18422
+ // src/commands/sessions/web/staticRoutes.ts
18405
18423
  var faviconHandler = (size) => createBundleHandler(
18406
18424
  import.meta.url,
18407
18425
  `commands/extension/extension/icons/assist-${size}.png`,
18408
18426
  "image/png"
18409
18427
  );
18410
- var routes2 = {
18411
- "GET /": htmlHandler,
18428
+ var staticRoutes = {
18412
18429
  "GET /bundle.js": createBundleHandler(
18413
18430
  import.meta.url,
18414
18431
  "commands/sessions/web/bundle.js"
@@ -18434,7 +18451,14 @@ var routes2 = {
18434
18451
  ),
18435
18452
  "GET /favicon-16.png": faviconHandler(16),
18436
18453
  "GET /favicon-32.png": faviconHandler(32),
18437
- "GET /favicon-128.png": faviconHandler(128),
18454
+ "GET /favicon-128.png": faviconHandler(128)
18455
+ };
18456
+
18457
+ // src/commands/sessions/web/handleRequest.ts
18458
+ var htmlHandler = createHtmlHandler(getHtml);
18459
+ var routes2 = {
18460
+ "GET /": htmlHandler,
18461
+ ...staticRoutes,
18438
18462
  "GET /api/health": health,
18439
18463
  "GET /api/daemon-log": daemonLogTail,
18440
18464
  "GET /api/items": listItems,
@@ -18459,6 +18483,7 @@ var routes2 = {
18459
18483
  "GET /api/file": fileContent,
18460
18484
  "POST /api/file": writeFileContent,
18461
18485
  "GET /api/files": listFiles,
18486
+ "GET /api/history/search": historySearch,
18462
18487
  "GET /api/rules": listScopedRules,
18463
18488
  "GET /api/jira-site": jiraSite,
18464
18489
  "GET /api/harness": harnessCapabilities,
@@ -26277,13 +26302,13 @@ import { execFileSync as execFileSync10 } from "child_process";
26277
26302
  import { basename as basename18 } from "path";
26278
26303
 
26279
26304
  // src/shared/removeStagedAttachments.ts
26280
- import { rmSync as rmSync4 } from "fs";
26305
+ import { rmSync as rmSync5 } from "fs";
26281
26306
  import { dirname as dirname29 } from "path";
26282
26307
  function removeStagedAttachments(attachments) {
26283
26308
  for (const { path: path109 } of attachments) {
26284
26309
  const dir = dirname29(path109);
26285
26310
  if (!isStagedAttachmentPath(dir)) continue;
26286
- rmSync4(dir, { recursive: true, force: true });
26311
+ rmSync5(dir, { recursive: true, force: true });
26287
26312
  }
26288
26313
  }
26289
26314
 
@@ -40830,7 +40855,7 @@ function list3() {
40830
40855
  }
40831
40856
 
40832
40857
  // src/commands/transcript/move.ts
40833
- import { existsSync as existsSync79, mkdirSync as mkdirSync33, renameSync as renameSync3, writeFileSync as writeFileSync51 } from "fs";
40858
+ import { existsSync as existsSync79, mkdirSync as mkdirSync33, renameSync as renameSync4, writeFileSync as writeFileSync51 } from "fs";
40834
40859
  import { basename as basename29, join as join101 } from "path";
40835
40860
 
40836
40861
  // src/commands/transcript/convertVttToMarkdown.ts
@@ -40843,7 +40868,7 @@ var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
40843
40868
  function archiveRawVtt(vttDir, sourcePath, filename) {
40844
40869
  const processedDir = join101(vttDir, "processed");
40845
40870
  mkdirSync33(processedDir, { recursive: true });
40846
- renameSync3(sourcePath, join101(processedDir, filename));
40871
+ renameSync4(sourcePath, join101(processedDir, filename));
40847
40872
  }
40848
40873
  function move(file, options2) {
40849
40874
  const { date, client } = options2;
@@ -42439,11 +42464,11 @@ ${buildWatchReport(from)}`);
42439
42464
  }
42440
42465
 
42441
42466
  // src/commands/watch/consumeMarker.ts
42442
- import { existsSync as existsSync83, rmSync as rmSync8 } from "fs";
42467
+ import { existsSync as existsSync83, rmSync as rmSync9 } from "fs";
42443
42468
  function consumeMarker(path109) {
42444
42469
  try {
42445
42470
  if (!existsSync83(path109)) return false;
42446
- rmSync8(path109);
42471
+ rmSync9(path109);
42447
42472
  return true;
42448
42473
  } catch {
42449
42474
  return false;
@@ -44310,13 +44335,13 @@ function createRunSession(id, { runName, runArgs, cwd, meta }) {
44310
44335
  }
44311
44336
 
44312
44337
  // src/commands/sessions/daemon/autoUpdate/autoUpdateControl.ts
44313
- import { existsSync as existsSync88, rmSync as rmSync9, writeFileSync as writeFileSync56 } from "fs";
44338
+ import { existsSync as existsSync88, rmSync as rmSync10, writeFileSync as writeFileSync56 } from "fs";
44314
44339
  var paused;
44315
44340
  var wake;
44316
44341
  function persist2(value) {
44317
44342
  try {
44318
44343
  if (value) writeFileSync56(daemonPaths.autoUpdatePaused, "");
44319
- else rmSync9(daemonPaths.autoUpdatePaused, { force: true });
44344
+ else rmSync10(daemonPaths.autoUpdatePaused, { force: true });
44320
44345
  } catch {
44321
44346
  }
44322
44347
  }
@@ -44640,12 +44665,12 @@ function noteAutoUpdate(installDir, text18) {
44640
44665
 
44641
44666
  // src/commands/sessions/daemon/autoUpdate/runUpdateLap.ts
44642
44667
  import { spawn as spawn11 } from "child_process";
44643
- import { rmSync as rmSync10 } from "fs";
44668
+ import { rmSync as rmSync11 } from "fs";
44644
44669
  function clearLapSignals(cwd) {
44645
44670
  const control = watchControlPaths(cwd);
44646
44671
  if (!control) return;
44647
44672
  for (const path109 of [control.check, control.stop])
44648
- rmSync10(path109, { force: true });
44673
+ rmSync11(path109, { force: true });
44649
44674
  }
44650
44675
  function runUpdateLap(cwd, onOutput) {
44651
44676
  clearLapSignals(cwd);
@@ -48234,6 +48259,43 @@ var VerifyTracker = class {
48234
48259
  }
48235
48260
  };
48236
48261
 
48262
+ // src/commands/sessions/shared/codex/discoverCodexHistoryEntries.ts
48263
+ async function discoverCodexHistoryEntries() {
48264
+ const paths = await discoverCodexRolloutPaths();
48265
+ const parsed = await Promise.all(
48266
+ paths.map(async (filePath) => {
48267
+ const session = await parseCodexSessionFile(filePath);
48268
+ return session ? { session, filePath } : null;
48269
+ })
48270
+ );
48271
+ return parsed.filter((entry) => entry !== null);
48272
+ }
48273
+
48274
+ // src/commands/sessions/shared/discoverHistoryEntries.ts
48275
+ async function discoverHistoryEntries() {
48276
+ const paths = await discoverSessionJsonlPaths();
48277
+ const entries = [];
48278
+ await Promise.all(
48279
+ paths.map(async ({ path: filePath, origin }) => {
48280
+ const session = await parseSessionFile(filePath, origin);
48281
+ if (session) entries.push({ session, filePath });
48282
+ })
48283
+ );
48284
+ entries.push(...await discoverCodexHistoryEntries());
48285
+ entries.sort(
48286
+ (a, b) => new Date(b.session.timestamp).getTime() - new Date(a.session.timestamp).getTime()
48287
+ );
48288
+ return entries;
48289
+ }
48290
+
48291
+ // src/commands/sessions/shared/discoverSessions.ts
48292
+ async function discoverSessionFiles() {
48293
+ return (await discoverSessionJsonlPaths()).map((p) => p.path);
48294
+ }
48295
+ async function discoverSessions() {
48296
+ return (await discoverHistoryEntries()).map((entry) => entry.session);
48297
+ }
48298
+
48237
48299
  // src/commands/sessions/daemon/withRepoGroups.ts
48238
48300
  function withRepoGroups(sessions) {
48239
48301
  const existence = /* @__PURE__ */ new Map();
@@ -49379,7 +49441,7 @@ function exitAfterFlush(code) {
49379
49441
  }
49380
49442
 
49381
49443
  // src/commands/sessions/daemon/handleConnection.ts
49382
- import { createInterface as createInterface10 } from "readline";
49444
+ import { createInterface as createInterface11 } from "readline";
49383
49445
 
49384
49446
  // src/commands/sessions/daemon/autoUpdate/autoUpdateReply.ts
49385
49447
  function autoUpdateReply() {
@@ -49392,7 +49454,7 @@ function autoUpdateReply() {
49392
49454
  }
49393
49455
 
49394
49456
  // src/commands/sessions/daemon/autoUpdate/applyAutoUpdateAction.ts
49395
- import { rmSync as rmSync11, writeFileSync as writeFileSync58 } from "fs";
49457
+ import { rmSync as rmSync12, writeFileSync as writeFileSync58 } from "fs";
49396
49458
  function signalLap(installDir, marker2) {
49397
49459
  const control = watchControlPaths(installDir);
49398
49460
  if (control) writeFileSync58(control[marker2], "");
@@ -49403,7 +49465,7 @@ function applyAutoUpdateAction(action) {
49403
49465
  if (action === "resume") {
49404
49466
  if (!autoUpdateControl.paused()) return void 0;
49405
49467
  const control = watchControlPaths(installDir);
49406
- if (control) rmSync11(control.stop, { force: true });
49468
+ if (control) rmSync12(control.stop, { force: true });
49407
49469
  autoUpdateControl.setPaused(false);
49408
49470
  noteAutoUpdate(installDir, "resumed from Updates");
49409
49471
  return void 0;
@@ -49453,6 +49515,197 @@ var handleHelloRequest = (client, m, d) => {
49453
49515
  m.replayLocal(client);
49454
49516
  };
49455
49517
 
49518
+ // src/commands/sessions/daemon/historySearch/findTranscriptMatch.ts
49519
+ import * as fs55 from "fs";
49520
+ import * as readline5 from "readline";
49521
+
49522
+ // src/commands/sessions/daemon/historySearch/historySnippet.ts
49523
+ var CONTEXT_CHARS = 60;
49524
+ function collapse(text18) {
49525
+ return text18.replace(/\s+/g, " ");
49526
+ }
49527
+ function historySnippet(text18, index2, length) {
49528
+ const start2 = Math.max(0, index2 - CONTEXT_CHARS);
49529
+ const end = Math.min(text18.length, index2 + length + CONTEXT_CHARS);
49530
+ const before = collapse(text18.slice(start2, index2)).trimStart();
49531
+ const after = collapse(text18.slice(index2 + length, end)).trimEnd();
49532
+ return {
49533
+ before: start2 > 0 ? `\u2026${before}` : before,
49534
+ match: collapse(text18.slice(index2, index2 + length)),
49535
+ after: end < text18.length ? `${after}\u2026` : after
49536
+ };
49537
+ }
49538
+
49539
+ // src/commands/sessions/shared/codex/codexToolTarget.ts
49540
+ function codexToolTarget(payload) {
49541
+ const args = parseArguments(payload.arguments);
49542
+ const target = args ? commandText(args) || toolTarget(args) || rolloutString(args.input) : rolloutString(payload.input);
49543
+ return condense(target);
49544
+ }
49545
+ function commandText(args) {
49546
+ const command = args.cmd ?? args.command;
49547
+ if (Array.isArray(command)) return command.map(rolloutString).join(" ");
49548
+ return rolloutString(command);
49549
+ }
49550
+ function parseArguments(value) {
49551
+ if (typeof value !== "string") return null;
49552
+ try {
49553
+ const parsed = JSON.parse(value);
49554
+ return parsed && typeof parsed === "object" ? parsed : null;
49555
+ } catch {
49556
+ return null;
49557
+ }
49558
+ }
49559
+ function condense(value) {
49560
+ return value.replace(/\s+/g, " ").trim().slice(0, 120);
49561
+ }
49562
+
49563
+ // src/commands/sessions/shared/codex/parseCodexTranscriptLines.ts
49564
+ function parseCodexTranscriptLines(lines2) {
49565
+ const messages = [];
49566
+ for (const line of lines2) {
49567
+ const entry = line.trim() ? parseRolloutEntry(line) : null;
49568
+ if (entry) messages.push(...rolloutMessages(entry));
49569
+ }
49570
+ return messages;
49571
+ }
49572
+ function rolloutMessages(entry) {
49573
+ const payload = rolloutPayload(entry);
49574
+ if (entry.type === "event_msg") return chatMessages(payload);
49575
+ if (entry.type === "response_item") return toolMessages(payload);
49576
+ return [];
49577
+ }
49578
+ function chatMessages(payload) {
49579
+ if (payload.type === "user_message")
49580
+ return text17("user", rolloutString(payload.message));
49581
+ if (payload.type === "agent_message")
49582
+ return text17("assistant", rolloutString(payload.message));
49583
+ return [];
49584
+ }
49585
+ function toolMessages(payload) {
49586
+ if (payload.type !== "function_call" && payload.type !== "custom_tool_call")
49587
+ return [];
49588
+ return [
49589
+ {
49590
+ role: "tool",
49591
+ tool: rolloutString(payload.name) || "tool",
49592
+ target: codexToolTarget(payload)
49593
+ }
49594
+ ];
49595
+ }
49596
+ function text17(role, value) {
49597
+ const trimmed = value.trim();
49598
+ return trimmed ? [{ role, text: trimmed }] : [];
49599
+ }
49600
+
49601
+ // src/commands/sessions/daemon/historySearch/transcriptLineTexts.ts
49602
+ function transcriptLineTexts(line, harness) {
49603
+ const messages = harness === "codex" ? parseCodexTranscriptLines([line]) : claudeMessages(line);
49604
+ return messages.flatMap((m) => m.role === "tool" ? [] : [m.text]);
49605
+ }
49606
+ function claudeMessages(line) {
49607
+ try {
49608
+ const entry = JSON.parse(line);
49609
+ return entry && typeof entry === "object" ? entryMessages(entry) : [];
49610
+ } catch {
49611
+ return [];
49612
+ }
49613
+ }
49614
+
49615
+ // src/commands/sessions/daemon/historySearch/findTranscriptMatch.ts
49616
+ function escapeRegExp(text18) {
49617
+ return text18.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
49618
+ }
49619
+ function encodesVerbatimInJson(query) {
49620
+ return JSON.stringify(query) === `"${query}"`;
49621
+ }
49622
+ function rawLinePrefilter(query) {
49623
+ if (!encodesVerbatimInJson(query)) return () => true;
49624
+ const lower = query.toLowerCase();
49625
+ return (line) => line.toLowerCase().includes(lower);
49626
+ }
49627
+ function matchTexts(texts, pattern2) {
49628
+ for (const text18 of texts) {
49629
+ const found = pattern2.exec(text18);
49630
+ if (found) return historySnippet(text18, found.index, found[0].length);
49631
+ }
49632
+ return null;
49633
+ }
49634
+ async function findTranscriptMatch(filePath, harness, query) {
49635
+ const pattern2 = new RegExp(escapeRegExp(query), "i");
49636
+ const mayMatch = rawLinePrefilter(query);
49637
+ const stream = fs55.createReadStream(filePath, { encoding: "utf8" });
49638
+ const reader = readline5.createInterface({
49639
+ input: stream,
49640
+ crlfDelay: Infinity
49641
+ });
49642
+ try {
49643
+ for await (const line of reader) {
49644
+ if (!line || !mayMatch(line)) continue;
49645
+ const snippet = matchTexts(transcriptLineTexts(line, harness), pattern2);
49646
+ if (snippet) return snippet;
49647
+ }
49648
+ return null;
49649
+ } catch {
49650
+ return null;
49651
+ } finally {
49652
+ reader.close();
49653
+ stream.destroy();
49654
+ }
49655
+ }
49656
+
49657
+ // src/commands/sessions/daemon/historySearch/searchHistory.ts
49658
+ var BATCH_SIZE = 16;
49659
+ var MAX_RESULTS2 = 100;
49660
+ function inRepo(cwd) {
49661
+ const selectedKey = repoGroupForCwd(cwd)?.origin || cwd;
49662
+ return ({ session }) => {
49663
+ const group = repoGroupForCwd(session.cwd);
49664
+ const key = group?.origin || session.cwd;
49665
+ return key === selectedKey || (group?.clone || session.cwd) === cwd;
49666
+ };
49667
+ }
49668
+ async function matchBatch(batch, query) {
49669
+ const matches = await Promise.all(
49670
+ batch.map(async ({ session, filePath }) => {
49671
+ const snippet = await findTranscriptMatch(
49672
+ filePath,
49673
+ session.harness,
49674
+ query
49675
+ );
49676
+ return snippet ? { ...session, snippet } : null;
49677
+ })
49678
+ );
49679
+ return matches.filter((hit) => hit !== null);
49680
+ }
49681
+ async function searchHistory(cwd, query) {
49682
+ const candidates = (await discoverHistoryEntries()).filter(inRepo(cwd));
49683
+ const hits = [];
49684
+ for (let i = 0; i < candidates.length && hits.length < MAX_RESULTS2; i += BATCH_SIZE)
49685
+ hits.push(
49686
+ ...await matchBatch(candidates.slice(i, i + BATCH_SIZE), query)
49687
+ );
49688
+ return withRepoGroups(hits.slice(0, MAX_RESULTS2));
49689
+ }
49690
+
49691
+ // src/commands/sessions/daemon/historySearch/handleSearchHistory.ts
49692
+ async function handleSearchHistory(client, data) {
49693
+ const cwd = typeof data.cwd === "string" ? data.cwd : "";
49694
+ const query = typeof data.query === "string" ? data.query.trim() : "";
49695
+ const started = Date.now();
49696
+ try {
49697
+ const sessions = cwd && query ? await searchHistory(cwd, query) : [];
49698
+ daemonLog(
49699
+ `history search cwd=${cwd} chars=${query.length}: ${sessions.length} match(es) in ${Date.now() - started}ms`
49700
+ );
49701
+ sendTo(client, { type: "history-search", sessions });
49702
+ } catch (error) {
49703
+ const message3 = error instanceof Error ? error.message : String(error);
49704
+ daemonLog(`history search cwd=${cwd} failed: ${message3}`);
49705
+ sendTo(client, { type: "history-search", error: message3 });
49706
+ }
49707
+ }
49708
+
49456
49709
  // src/commands/sessions/daemon/creator.ts
49457
49710
  function creator(isNew, spawn12) {
49458
49711
  return (client, m, d) => {
@@ -49467,7 +49720,7 @@ function creator(isNew, spawn12) {
49467
49720
  }
49468
49721
 
49469
49722
  // src/commands/sessions/shared/codex/codexRolloutUsage.ts
49470
- import * as fs55 from "fs";
49723
+ import * as fs56 from "fs";
49471
49724
 
49472
49725
  // src/commands/sessions/shared/codex/applyTokenInfo.ts
49473
49726
  function applyTokenInfo(usage, byId, conversationId, rawInfo) {
@@ -49530,7 +49783,7 @@ function codexRolloutUsage(lines2) {
49530
49783
  return usage;
49531
49784
  }
49532
49785
  async function readCodexRolloutUsage(rolloutPath) {
49533
- const content = await fs55.promises.readFile(rolloutPath, "utf8");
49786
+ const content = await fs56.promises.readFile(rolloutPath, "utf8");
49534
49787
  return codexRolloutUsage(content.split("\n"));
49535
49788
  }
49536
49789
  function sessionMetaId(entry) {
@@ -49678,7 +49931,7 @@ function handleSetStatus(client, m, d) {
49678
49931
  }
49679
49932
 
49680
49933
  // src/commands/sessions/shared/parseTranscript.ts
49681
- import * as fs56 from "fs";
49934
+ import * as fs57 from "fs";
49682
49935
 
49683
49936
  // src/commands/sessions/shared/codex/findCodexRolloutPath.ts
49684
49937
  import * as path108 from "path";
@@ -49689,68 +49942,6 @@ async function findCodexRolloutPath(sessionId) {
49689
49942
  return paths.find((file) => path108.basename(file).endsWith(suffix)) ?? null;
49690
49943
  }
49691
49944
 
49692
- // src/commands/sessions/shared/codex/codexToolTarget.ts
49693
- function codexToolTarget(payload) {
49694
- const args = parseArguments(payload.arguments);
49695
- const target = args ? commandText(args) || toolTarget(args) || rolloutString(args.input) : rolloutString(payload.input);
49696
- return condense(target);
49697
- }
49698
- function commandText(args) {
49699
- const command = args.cmd ?? args.command;
49700
- if (Array.isArray(command)) return command.map(rolloutString).join(" ");
49701
- return rolloutString(command);
49702
- }
49703
- function parseArguments(value) {
49704
- if (typeof value !== "string") return null;
49705
- try {
49706
- const parsed = JSON.parse(value);
49707
- return parsed && typeof parsed === "object" ? parsed : null;
49708
- } catch {
49709
- return null;
49710
- }
49711
- }
49712
- function condense(value) {
49713
- return value.replace(/\s+/g, " ").trim().slice(0, 120);
49714
- }
49715
-
49716
- // src/commands/sessions/shared/codex/parseCodexTranscriptLines.ts
49717
- function parseCodexTranscriptLines(lines2) {
49718
- const messages = [];
49719
- for (const line of lines2) {
49720
- const entry = line.trim() ? parseRolloutEntry(line) : null;
49721
- if (entry) messages.push(...rolloutMessages(entry));
49722
- }
49723
- return messages;
49724
- }
49725
- function rolloutMessages(entry) {
49726
- const payload = rolloutPayload(entry);
49727
- if (entry.type === "event_msg") return chatMessages(payload);
49728
- if (entry.type === "response_item") return toolMessages(payload);
49729
- return [];
49730
- }
49731
- function chatMessages(payload) {
49732
- if (payload.type === "user_message")
49733
- return text17("user", rolloutString(payload.message));
49734
- if (payload.type === "agent_message")
49735
- return text17("assistant", rolloutString(payload.message));
49736
- return [];
49737
- }
49738
- function toolMessages(payload) {
49739
- if (payload.type !== "function_call" && payload.type !== "custom_tool_call")
49740
- return [];
49741
- return [
49742
- {
49743
- role: "tool",
49744
- tool: rolloutString(payload.name) || "tool",
49745
- target: codexToolTarget(payload)
49746
- }
49747
- ];
49748
- }
49749
- function text17(role, value) {
49750
- const trimmed = value.trim();
49751
- return trimmed ? [{ role, text: trimmed }] : [];
49752
- }
49753
-
49754
49945
  // src/commands/sessions/shared/parseTranscript.ts
49755
49946
  async function parseTranscript(sessionId) {
49756
49947
  const filePath = await findSessionJsonlPath(sessionId);
@@ -49761,7 +49952,7 @@ async function parseTranscript(sessionId) {
49761
49952
  }
49762
49953
  async function readMessages(filePath, parse5) {
49763
49954
  try {
49764
- const raw = await fs56.promises.readFile(filePath, "utf8");
49955
+ const raw = await fs57.promises.readFile(filePath, "utf8");
49765
49956
  return parse5(raw.split("\n"));
49766
49957
  } catch {
49767
49958
  return [];
@@ -49996,6 +50187,7 @@ var messageHandlers = {
49996
50187
  nodes: (client, m) => m.links.sendNodes(client),
49997
50188
  "auto-update": (client) => sendTo(client, autoUpdateReply()),
49998
50189
  "auto-update-control": handleAutoUpdateControl,
50190
+ "search-history": (client, _m, d) => handleSearchHistory(client, d),
49999
50191
  "reload-links": (client, m) => {
50000
50192
  daemonLog("reload-links received");
50001
50193
  m.links.reload();
@@ -50085,7 +50277,7 @@ function handleConnection(socket, manager) {
50085
50277
  };
50086
50278
  manager.addClient(client);
50087
50279
  manager.clients.greet(client);
50088
- const lines2 = createInterface10({ input: socket });
50280
+ const lines2 = createInterface11({ input: socket });
50089
50281
  lines2.on("error", () => {
50090
50282
  });
50091
50283
  lines2.on("line", (line) => {
@@ -50705,14 +50897,14 @@ function registerNodes(sessions) {
50705
50897
  }
50706
50898
 
50707
50899
  // src/commands/sessions/daemon/requestSessionOutput.ts
50708
- import { createInterface as createInterface11 } from "readline";
50900
+ import { createInterface as createInterface12 } from "readline";
50709
50901
  var OUTPUT_TIMEOUT_MS = 5e3;
50710
50902
  async function requestSessionOutput(target) {
50711
50903
  const socket = await connectToDaemon().catch(() => {
50712
50904
  throw new Error("No sessions daemon is running");
50713
50905
  });
50714
50906
  try {
50715
- const lines2 = createInterface11({ input: socket });
50907
+ const lines2 = createInterface12({ input: socket });
50716
50908
  lines2.on("error", () => {
50717
50909
  });
50718
50910
  const reply2 = readDaemonMessage(
@@ -50814,17 +51006,17 @@ async function renameSession(title) {
50814
51006
  }
50815
51007
 
50816
51008
  // src/commands/sessions/summarise.ts
50817
- import * as fs58 from "fs";
51009
+ import * as fs59 from "fs";
50818
51010
  import chalk268 from "chalk";
50819
51011
 
50820
51012
  // src/commands/sessions/summarise/shared.ts
50821
- import * as fs57 from "fs";
51013
+ import * as fs58 from "fs";
50822
51014
  function writeSummary(jsonlPath2, summary) {
50823
- fs57.writeFileSync(summaryPathFor(jsonlPath2), `${summary.trim()}
51015
+ fs58.writeFileSync(summaryPathFor(jsonlPath2), `${summary.trim()}
50824
51016
  `, "utf8");
50825
51017
  }
50826
51018
  function hasSummary(jsonlPath2) {
50827
- return fs57.existsSync(summaryPathFor(jsonlPath2));
51019
+ return fs58.existsSync(summaryPathFor(jsonlPath2));
50828
51020
  }
50829
51021
  function summaryPathFor(jsonlPath2) {
50830
51022
  return jsonlPath2.replace(/\.jsonl$/, ".summary");
@@ -50896,7 +51088,7 @@ function selectCandidates(files, options2) {
50896
51088
  const candidates = options2.force ? files : files.filter((f) => !hasSummary(f));
50897
51089
  candidates.sort((a, b) => {
50898
51090
  try {
50899
- return fs58.statSync(b).mtimeMs - fs58.statSync(a).mtimeMs;
51091
+ return fs59.statSync(b).mtimeMs - fs59.statSync(a).mtimeMs;
50900
51092
  } catch {
50901
51093
  return 0;
50902
51094
  }