teapot-coding-agent 0.37.16 → 0.37.17
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/master.js +4 -5
- package/dist/migrations/session-titles.js +20 -4
- package/package.json +1 -1
- package/public/assets/{index-CxTEPeTm.js → index-LTvn2Be9.js} +4 -4
- package/public/assets/{index-CxTEPeTm.js.map → index-LTvn2Be9.js.map} +1 -1
- package/public/assets/{shiki-CKT56XTC.js → shiki--crGONDM.js} +2 -2
- package/public/assets/{shiki-CKT56XTC.js.map → shiki--crGONDM.js.map} +1 -1
- package/public/index.html +1 -1
package/dist/master.js
CHANGED
|
@@ -1741,7 +1741,7 @@ When this task is done (or truly blocked), call finish() with a summary for @${p
|
|
|
1741
1741
|
const a = this.config.agents.find((x) => x.id === agentId);
|
|
1742
1742
|
if (!a || a.session !== sessionId)
|
|
1743
1743
|
return undefined; // the label belongs to the CURRENT session
|
|
1744
|
-
const t = a.sessionTitle
|
|
1744
|
+
const t = typeof a.sessionTitle === "string" ? a.sessionTitle.trim() : "";
|
|
1745
1745
|
return t ? t : undefined;
|
|
1746
1746
|
}
|
|
1747
1747
|
/**
|
|
@@ -1758,10 +1758,9 @@ When this task is done (or truly blocked), call finish() with a summary for @${p
|
|
|
1758
1758
|
if (a.sessionTitle?.trim())
|
|
1759
1759
|
return;
|
|
1760
1760
|
const dir = path.join(this.sessionsRoot(), sessionId);
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
a.sessionTitle = title;
|
|
1761
|
+
// the session id when nothing is derivable — see the migration: it never changes, so this
|
|
1762
|
+
// cannot leave the field unset and have the derivation re-run on every boot
|
|
1763
|
+
a.sessionTitle = this.sessionTitleOf(dir) ?? sessionId;
|
|
1765
1764
|
this.saveConfig();
|
|
1766
1765
|
}
|
|
1767
1766
|
sessionTitleOf(dirPath) {
|
|
@@ -33,9 +33,16 @@ export const sessionTitles = {
|
|
|
33
33
|
if (session.includes("/") || session.includes(".."))
|
|
34
34
|
continue; // never a path segment
|
|
35
35
|
const title = firstUserPromptText(path.join(ctx.dataDir, "sessions", session, "chat.jsonl"));
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
/**
|
|
37
|
+
* The SESSION ID is the fallback, not a marker.
|
|
38
|
+
*
|
|
39
|
+
* A sub-agent session receives only harness prompts, so no title can ever be derived from it —
|
|
40
|
+
* and a session id does not change either, so there is nothing to retry for. Writing the id
|
|
41
|
+
* makes the field ALWAYS present, which is what makes the pass idempotent without an extra
|
|
42
|
+
* flag: the next boot sees a title and skips. The sidebar already shows the id in this case,
|
|
43
|
+
* so nothing visible changes.
|
|
44
|
+
*/
|
|
45
|
+
a.sessionTitle = title ?? session;
|
|
39
46
|
changed = true;
|
|
40
47
|
}
|
|
41
48
|
if (changed)
|
|
@@ -49,13 +56,22 @@ export const sessionTitles = {
|
|
|
49
56
|
* Bounded (256KB) and stops at the first prompt, so one enormous log cannot dominate boot. A torn
|
|
50
57
|
* final line at a chunk boundary is skipped rather than aborting the read.
|
|
51
58
|
*/
|
|
59
|
+
/**
|
|
60
|
+
* ONE reusable read buffer for the whole pass.
|
|
61
|
+
*
|
|
62
|
+
* `Buffer.alloc` per session is what made the first boot spike: 830 sessions x 16KB of short-lived
|
|
63
|
+
* buffer, MEASURED as heap 28.2MB → 108.5MB during `start()` (33.4MB after GC). The scan is a
|
|
64
|
+
* single-threaded loop, so sharing one buffer is safe and removes the churn entirely.
|
|
65
|
+
*/
|
|
66
|
+
let scanBuffer;
|
|
52
67
|
function firstUserPromptText(file) {
|
|
53
68
|
let fd;
|
|
54
69
|
try {
|
|
55
70
|
fd = openSync(file, "r");
|
|
56
71
|
const CHUNK = 16 * 1024;
|
|
57
72
|
const CAP = 256 * 1024;
|
|
58
|
-
|
|
73
|
+
scanBuffer ??= Buffer.alloc(CHUNK);
|
|
74
|
+
const buf = scanBuffer;
|
|
59
75
|
let offset = 0;
|
|
60
76
|
let carry = "";
|
|
61
77
|
while (offset < CAP) {
|