@staff0rd/assist 0.852.0 → 0.853.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/commands/sessions/web/bundle.js +398 -398
- package/dist/index.js +48 -7
- package/package.json +1 -1
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.
|
|
9
|
+
version: "0.853.0",
|
|
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();
|
|
@@ -48162,6 +48195,7 @@ function setSessionTitle(sessions, id, title) {
|
|
|
48162
48195
|
if (!s || !normalised) return false;
|
|
48163
48196
|
s.title = normalised;
|
|
48164
48197
|
daemonLog(`session ${id} renamed: ${normalised}`);
|
|
48198
|
+
rememberSessionTitle(s);
|
|
48165
48199
|
return true;
|
|
48166
48200
|
}
|
|
48167
48201
|
|
|
@@ -48282,6 +48316,11 @@ async function discoverHistoryEntries() {
|
|
|
48282
48316
|
})
|
|
48283
48317
|
);
|
|
48284
48318
|
entries.push(...await discoverCodexHistoryEntries());
|
|
48319
|
+
const titles2 = loadSessionTitles();
|
|
48320
|
+
for (const { session } of entries) {
|
|
48321
|
+
const title = titles2[session.sessionId];
|
|
48322
|
+
if (title) session.title = title;
|
|
48323
|
+
}
|
|
48285
48324
|
entries.sort(
|
|
48286
48325
|
(a, b) => new Date(b.session.timestamp).getTime() - new Date(a.session.timestamp).getTime()
|
|
48287
48326
|
);
|
|
@@ -49631,8 +49670,11 @@ function matchTexts(texts, pattern2) {
|
|
|
49631
49670
|
}
|
|
49632
49671
|
return null;
|
|
49633
49672
|
}
|
|
49673
|
+
function queryPattern(query) {
|
|
49674
|
+
return new RegExp(escapeRegExp(query), "i");
|
|
49675
|
+
}
|
|
49634
49676
|
async function findTranscriptMatch(filePath, harness, query) {
|
|
49635
|
-
const pattern2 =
|
|
49677
|
+
const pattern2 = queryPattern(query);
|
|
49636
49678
|
const mayMatch = rawLinePrefilter(query);
|
|
49637
49679
|
const stream = fs55.createReadStream(filePath, { encoding: "utf8" });
|
|
49638
49680
|
const reader = readline5.createInterface({
|
|
@@ -49653,6 +49695,9 @@ async function findTranscriptMatch(filePath, harness, query) {
|
|
|
49653
49695
|
stream.destroy();
|
|
49654
49696
|
}
|
|
49655
49697
|
}
|
|
49698
|
+
function findTitleMatch(title, query) {
|
|
49699
|
+
return title ? matchTexts([title], queryPattern(query)) : null;
|
|
49700
|
+
}
|
|
49656
49701
|
|
|
49657
49702
|
// src/commands/sessions/daemon/historySearch/searchHistory.ts
|
|
49658
49703
|
var BATCH_SIZE = 16;
|
|
@@ -49668,11 +49713,7 @@ function inRepo(cwd) {
|
|
|
49668
49713
|
async function matchBatch(batch, query) {
|
|
49669
49714
|
const matches = await Promise.all(
|
|
49670
49715
|
batch.map(async ({ session, filePath }) => {
|
|
49671
|
-
const snippet = await findTranscriptMatch(
|
|
49672
|
-
filePath,
|
|
49673
|
-
session.harness,
|
|
49674
|
-
query
|
|
49675
|
-
);
|
|
49716
|
+
const snippet = findTitleMatch(session.title, query) ?? await findTranscriptMatch(filePath, session.harness, query);
|
|
49676
49717
|
return snippet ? { ...session, snippet } : null;
|
|
49677
49718
|
})
|
|
49678
49719
|
);
|