@staff0rd/assist 0.852.0 → 0.853.1

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.852.0",
9
+ version: "0.853.1",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -45643,6 +45643,37 @@ function buildPrompt5(prompt) {
45643
45643
  ].join("\n");
45644
45644
  }
45645
45645
 
45646
+ // src/commands/sessions/shared/loadSessionTitles.ts
45647
+ import { z as z13 } from "zod";
45648
+ var TITLES_FILE = "session-titles.json";
45649
+ var sessionTitlesSchema = z13.record(z13.string(), z13.string());
45650
+ function loadSessionTitles() {
45651
+ const parsed = sessionTitlesSchema.safeParse(
45652
+ loadJson(TITLES_FILE)
45653
+ );
45654
+ return parsed.success ? parsed.data : {};
45655
+ }
45656
+ function saveSessionTitle(harnessSessionId, title) {
45657
+ const titles2 = loadSessionTitles();
45658
+ if (titles2[harnessSessionId] === title) return false;
45659
+ titles2[harnessSessionId] = title;
45660
+ saveJson(TITLES_FILE, titles2);
45661
+ return true;
45662
+ }
45663
+
45664
+ // src/commands/sessions/daemon/rememberSessionTitle.ts
45665
+ function rememberSessionTitle(session) {
45666
+ const harnessSessionId = session.harness === "codex" ? session.harnessSessionId : session.claudeSessionId;
45667
+ const title = session.title ?? session.generatedTitle;
45668
+ if (!harnessSessionId || !title) return;
45669
+ try {
45670
+ if (saveSessionTitle(harnessSessionId, title))
45671
+ daemonLog(`session ${session.id} title kept for ${harnessSessionId}`);
45672
+ } catch (error) {
45673
+ daemonLog(`session ${session.id} title not saved: ${error}`);
45674
+ }
45675
+ }
45676
+
45646
45677
  // src/commands/sessions/daemon/runSessionTitleGeneration.ts
45647
45678
  function runSessionTitleGeneration(session, prompt, notify2, fallback) {
45648
45679
  if (session.generatedTitle || session.titleGenerationStarted) return;
@@ -45659,6 +45690,7 @@ function runSessionTitleGeneration(session, prompt, notify2, fallback) {
45659
45690
  daemonLog(
45660
45691
  generated ? `session ${session.id} generated title: ${generated}` : `session ${session.id} title generation failed; falling back to "${title}"`
45661
45692
  );
45693
+ rememberSessionTitle(session);
45662
45694
  notify2();
45663
45695
  }).catch((error) => {
45664
45696
  daemonLog(`session ${session.id} title generation errored: ${error}`);
@@ -46025,6 +46057,7 @@ function bindCodexSession(session, notify2) {
46025
46057
  }
46026
46058
  session.harnessSessionId = sessionId;
46027
46059
  daemonLog(`session ${session.id} bound to codex conversation ${sessionId}`);
46060
+ rememberSessionTitle(session);
46028
46061
  notify2();
46029
46062
  };
46030
46063
  schedule();
@@ -46898,6 +46931,7 @@ function rebindClaudeSession(session, claudeSessionId, notify2, onStatusChange)
46898
46931
  `session ${session.id} claude session moved: ${session.claudeSessionId ?? "none"} -> ${claudeSessionId}`
46899
46932
  );
46900
46933
  session.claudeSessionId = claudeSessionId;
46934
+ rememberSessionTitle(session);
46901
46935
  watchTranscript(session, notify2, onStatusChange);
46902
46936
  }
46903
46937
 
@@ -47045,6 +47079,7 @@ function freshClaudePlan(session, prompt, cwd) {
47045
47079
  return {
47046
47080
  spawn: () => {
47047
47081
  session.claudeSessionId = claudeSessionId;
47082
+ rememberSessionTitle(session);
47048
47083
  return spawnClaude2({
47049
47084
  prompt,
47050
47085
  cwd,
@@ -48162,6 +48197,7 @@ function setSessionTitle(sessions, id, title) {
48162
48197
  if (!s || !normalised) return false;
48163
48198
  s.title = normalised;
48164
48199
  daemonLog(`session ${id} renamed: ${normalised}`);
48200
+ rememberSessionTitle(s);
48165
48201
  return true;
48166
48202
  }
48167
48203
 
@@ -48282,6 +48318,11 @@ async function discoverHistoryEntries() {
48282
48318
  })
48283
48319
  );
48284
48320
  entries.push(...await discoverCodexHistoryEntries());
48321
+ const titles2 = loadSessionTitles();
48322
+ for (const { session } of entries) {
48323
+ const title = titles2[session.sessionId];
48324
+ if (title) session.title = title;
48325
+ }
48285
48326
  entries.sort(
48286
48327
  (a, b) => new Date(b.session.timestamp).getTime() - new Date(a.session.timestamp).getTime()
48287
48328
  );
@@ -49631,8 +49672,11 @@ function matchTexts(texts, pattern2) {
49631
49672
  }
49632
49673
  return null;
49633
49674
  }
49675
+ function queryPattern(query) {
49676
+ return new RegExp(escapeRegExp(query), "i");
49677
+ }
49634
49678
  async function findTranscriptMatch(filePath, harness, query) {
49635
- const pattern2 = new RegExp(escapeRegExp(query), "i");
49679
+ const pattern2 = queryPattern(query);
49636
49680
  const mayMatch = rawLinePrefilter(query);
49637
49681
  const stream = fs55.createReadStream(filePath, { encoding: "utf8" });
49638
49682
  const reader = readline5.createInterface({
@@ -49653,6 +49697,9 @@ async function findTranscriptMatch(filePath, harness, query) {
49653
49697
  stream.destroy();
49654
49698
  }
49655
49699
  }
49700
+ function findTitleMatch(title, query) {
49701
+ return title ? matchTexts([title], queryPattern(query)) : null;
49702
+ }
49656
49703
 
49657
49704
  // src/commands/sessions/daemon/historySearch/searchHistory.ts
49658
49705
  var BATCH_SIZE = 16;
@@ -49668,11 +49715,7 @@ function inRepo(cwd) {
49668
49715
  async function matchBatch(batch, query) {
49669
49716
  const matches = await Promise.all(
49670
49717
  batch.map(async ({ session, filePath }) => {
49671
- const snippet = await findTranscriptMatch(
49672
- filePath,
49673
- session.harness,
49674
- query
49675
- );
49718
+ const snippet = findTitleMatch(session.title, query) ?? await findTranscriptMatch(filePath, session.harness, query);
49676
49719
  return snippet ? { ...session, snippet } : null;
49677
49720
  })
49678
49721
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.852.0",
3
+ "version": "0.853.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {