zcode-acp-server 0.80.0 → 0.80.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/README.md +1 -1
- package/dist/code-fingerprint.json +1 -1
- package/dist/handlers/session-titles.d.ts +38 -5
- package/dist/handlers/session-titles.d.ts.map +1 -1
- package/dist/handlers/session-titles.js +114 -7
- package/dist/handlers/session-titles.js.map +1 -1
- package/dist/handlers/session.d.ts.map +1 -1
- package/dist/handlers/session.js +72 -4
- package/dist/handlers/session.js.map +1 -1
- package/dist/handlers/slash.d.ts.map +1 -1
- package/dist/handlers/slash.js +12 -0
- package/dist/handlers/slash.js.map +1 -1
- package/dist/i18n.d.ts +3 -0
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +6 -0
- package/dist/i18n.js.map +1 -1
- package/dist/remote/session-rename-endpoint.d.ts +5 -4
- package/dist/remote/session-rename-endpoint.d.ts.map +1 -1
- package/dist/remote/session-rename-endpoint.js +11 -33
- package/dist/remote/session-rename-endpoint.js.map +1 -1
- package/dist/server.d.ts +9 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +9 -0
- package/dist/server.js.map +1 -1
- package/dist/tasks-index.d.ts +18 -0
- package/dist/tasks-index.d.ts.map +1 -1
- package/dist/tasks-index.js +42 -4
- package/dist/tasks-index.js.map +1 -1
- package/dist/utils.d.ts +6 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +5 -0
- package/dist/utils.js.map +1 -1
- package/docs/PROTOCOL.md +22 -7
- package/docs/REMOTE-CLIENTS.md +18 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -353,7 +353,7 @@ Thanks to everyone who has contributed (updated automatically from the
|
|
|
353
353
|
<a href="https://github.com/william0wang/zcode-acp/graphs/contributors">
|
|
354
354
|
<!-- release-please re-stamps &v= on every release: the new URL busts the
|
|
355
355
|
contrib.rocks and GitHub camo image caches. -->
|
|
356
|
-
<img src="https://contrib.rocks/image?repo=william0wang/zcode-acp&v=0.80.
|
|
356
|
+
<img src="https://contrib.rocks/image?repo=william0wang/zcode-acp&v=0.80.1" alt="Contributors" /> <!-- x-release-please-version -->
|
|
357
357
|
</a>
|
|
358
358
|
|
|
359
359
|
## Related Projects
|
|
@@ -14,11 +14,14 @@
|
|
|
14
14
|
* the authoritative pushes:
|
|
15
15
|
*
|
|
16
16
|
* - `generated` — the backend's LLM-generated title; replaces the
|
|
17
|
-
* provisional seed.
|
|
18
|
-
* `server.
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
17
|
+
* provisional seed. This is the ONE allowed automatic rename: after the
|
|
18
|
+
* first adopted `generated` push (`server.autoTitleFinalized`) every later
|
|
19
|
+
* one is ignored. A manual user rename still wins at any time: sessions
|
|
20
|
+
* marked in `server.titleUserSetBy` (the remote rename endpoint and
|
|
21
|
+
* /rename mark them) are left untouched, and the durable
|
|
22
|
+
* `title_overridden` flag in tasks-index.sqlite is consulted for renames
|
|
23
|
+
* that predate this bridge process (the in-memory pin does not survive a
|
|
24
|
+
* restart).
|
|
22
25
|
* - `custom` — a title set by another surface (the desktop app over the
|
|
23
26
|
* same session store); adopted so every window stays consistent, and
|
|
24
27
|
* marked user-set so later `generated` pushes cannot override it.
|
|
@@ -36,6 +39,36 @@
|
|
|
36
39
|
import type { EventListener } from "../backend/client.js";
|
|
37
40
|
import type { ZcodeEvent } from "../backend/types.js";
|
|
38
41
|
import type { ZcodeAcpServer } from "../server.js";
|
|
42
|
+
/**
|
|
43
|
+
* Unified manual rename — the single write path behind the remote rename
|
|
44
|
+
* endpoint and the /rename slash command. A rename is the ONLY title change
|
|
45
|
+
* allowed after the one-shot auto title, and it must reach EVERY surface:
|
|
46
|
+
*
|
|
47
|
+
* - this bridge: `sessionTitles` + `titleUserSetBy` pin + discovery summary
|
|
48
|
+
* for the FULL alias group (`sessionAliases` — clients hold different
|
|
49
|
+
* acpSids for one conversation), and the terminal tab title;
|
|
50
|
+
* - the backend: v4 `renameSession` command → `titleSource=custom` (sticky
|
|
51
|
+
* — the backend never auto-generates over it again). Without this the
|
|
52
|
+
* backend store keeps the old title and resurrects it through
|
|
53
|
+
* `session/list` adoption and resume title re-emission. AWAITED (bounded
|
|
54
|
+
* by the 10s command budget): the gateway cold-resumes non-resident
|
|
55
|
+
* sessions, and the caller's response must not beat the store — the
|
|
56
|
+
* client's immediate re-read of the list would otherwise flip the fresh
|
|
57
|
+
* title back (older backends without the command degrade to warn + the
|
|
58
|
+
* bridge-side pins);
|
|
59
|
+
* - the App's tasks-index: `renameSessionTask` pins `title_overridden=1`,
|
|
60
|
+
* which `adoptStoredTitle` consults to survive bridge restarts;
|
|
61
|
+
* - attached clients: a `session_info_update` broadcast per alias (the
|
|
62
|
+
* backend's own `custom` push for the same title is deduped by the
|
|
63
|
+
* listener's equality guard).
|
|
64
|
+
*
|
|
65
|
+
* A placeholder session (no backend id yet) is pinned in memory only; its
|
|
66
|
+
* materialization re-runs this core to persist the rename (see
|
|
67
|
+
* `ensureRealSession`).
|
|
68
|
+
*/
|
|
69
|
+
export declare function renameSessionCore(server: ZcodeAcpServer, acpSid: string, rawTitle: string): Promise<{
|
|
70
|
+
title: string;
|
|
71
|
+
}>;
|
|
39
72
|
export declare class SessionTitleListener implements EventListener {
|
|
40
73
|
private readonly server;
|
|
41
74
|
readonly zcodeSid: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-titles.d.ts","sourceRoot":"","sources":["../../src/handlers/session-titles.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"session-titles.d.ts","sourceRoot":"","sources":["../../src/handlers/session-titles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AA0DnD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CA+C5B;AAED,qBAAa,oBAAqB,YAAW,aAAa;IACxD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;IACxC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;gBAEd,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM;IAKpD,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;YAWtB,cAAc;CA+E7B"}
|
|
@@ -14,11 +14,14 @@
|
|
|
14
14
|
* the authoritative pushes:
|
|
15
15
|
*
|
|
16
16
|
* - `generated` — the backend's LLM-generated title; replaces the
|
|
17
|
-
* provisional seed.
|
|
18
|
-
* `server.
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
17
|
+
* provisional seed. This is the ONE allowed automatic rename: after the
|
|
18
|
+
* first adopted `generated` push (`server.autoTitleFinalized`) every later
|
|
19
|
+
* one is ignored. A manual user rename still wins at any time: sessions
|
|
20
|
+
* marked in `server.titleUserSetBy` (the remote rename endpoint and
|
|
21
|
+
* /rename mark them) are left untouched, and the durable
|
|
22
|
+
* `title_overridden` flag in tasks-index.sqlite is consulted for renames
|
|
23
|
+
* that predate this bridge process (the in-memory pin does not survive a
|
|
24
|
+
* restart).
|
|
22
25
|
* - `custom` — a title set by another surface (the desktop app over the
|
|
23
26
|
* same session store); adopted so every window stays consistent, and
|
|
24
27
|
* marked user-set so later `generated` pushes cannot override it.
|
|
@@ -33,9 +36,10 @@
|
|
|
33
36
|
* Best-effort throughout: failures are logged and never thrown into the
|
|
34
37
|
* event loop.
|
|
35
38
|
*/
|
|
36
|
-
import {
|
|
39
|
+
import { randomUUID } from "node:crypto";
|
|
40
|
+
import { isTitleOverridden, renameSessionTask, updateSessionTitle } from "../tasks-index.js";
|
|
37
41
|
import { refreshTerminalTabTitle } from "../terminal-title.js";
|
|
38
|
-
import { log } from "../utils.js";
|
|
42
|
+
import { log, warn } from "../utils.js";
|
|
39
43
|
import { sendSessionUpdate } from "./io.js";
|
|
40
44
|
/** Mirror the auto-title/rename normalization: single line, trimmed, 80 chars. */
|
|
41
45
|
function normalizeTitle(raw) {
|
|
@@ -44,6 +48,99 @@ function normalizeTitle(raw) {
|
|
|
44
48
|
.trim()
|
|
45
49
|
.slice(0, 80);
|
|
46
50
|
}
|
|
51
|
+
/** v4/command budget — the gateway may cold-resume an idle session first. */
|
|
52
|
+
const RENAME_COMMAND_TIMEOUT_MS = 10_000;
|
|
53
|
+
/** Best-effort notify: never throws, never blocks the caller's response. */
|
|
54
|
+
async function sendBackendRename(server, zcodeSid, title) {
|
|
55
|
+
try {
|
|
56
|
+
const backend = await server.ensureBackend();
|
|
57
|
+
const resp = await backend.request(server.nextId(), "v4/command", {
|
|
58
|
+
commandId: randomUUID(),
|
|
59
|
+
clientId: "zcode-acp-server",
|
|
60
|
+
sessionId: zcodeSid,
|
|
61
|
+
type: "renameSession",
|
|
62
|
+
payload: { title },
|
|
63
|
+
issuedAt: Date.now(),
|
|
64
|
+
}, RENAME_COMMAND_TIMEOUT_MS);
|
|
65
|
+
if (resp.error) {
|
|
66
|
+
warn(`rename: backend v4 renameSession rejected (non-fatal): ` +
|
|
67
|
+
`${resp.error.message ?? "unknown error"}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
warn(`rename: backend v4 renameSession failed (non-fatal): ` +
|
|
72
|
+
`${e instanceof Error ? e.message : String(e)}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Unified manual rename — the single write path behind the remote rename
|
|
77
|
+
* endpoint and the /rename slash command. A rename is the ONLY title change
|
|
78
|
+
* allowed after the one-shot auto title, and it must reach EVERY surface:
|
|
79
|
+
*
|
|
80
|
+
* - this bridge: `sessionTitles` + `titleUserSetBy` pin + discovery summary
|
|
81
|
+
* for the FULL alias group (`sessionAliases` — clients hold different
|
|
82
|
+
* acpSids for one conversation), and the terminal tab title;
|
|
83
|
+
* - the backend: v4 `renameSession` command → `titleSource=custom` (sticky
|
|
84
|
+
* — the backend never auto-generates over it again). Without this the
|
|
85
|
+
* backend store keeps the old title and resurrects it through
|
|
86
|
+
* `session/list` adoption and resume title re-emission. AWAITED (bounded
|
|
87
|
+
* by the 10s command budget): the gateway cold-resumes non-resident
|
|
88
|
+
* sessions, and the caller's response must not beat the store — the
|
|
89
|
+
* client's immediate re-read of the list would otherwise flip the fresh
|
|
90
|
+
* title back (older backends without the command degrade to warn + the
|
|
91
|
+
* bridge-side pins);
|
|
92
|
+
* - the App's tasks-index: `renameSessionTask` pins `title_overridden=1`,
|
|
93
|
+
* which `adoptStoredTitle` consults to survive bridge restarts;
|
|
94
|
+
* - attached clients: a `session_info_update` broadcast per alias (the
|
|
95
|
+
* backend's own `custom` push for the same title is deduped by the
|
|
96
|
+
* listener's equality guard).
|
|
97
|
+
*
|
|
98
|
+
* A placeholder session (no backend id yet) is pinned in memory only; its
|
|
99
|
+
* materialization re-runs this core to persist the rename (see
|
|
100
|
+
* `ensureRealSession`).
|
|
101
|
+
*/
|
|
102
|
+
export async function renameSessionCore(server, acpSid, rawTitle) {
|
|
103
|
+
const title = normalizeTitle(rawTitle);
|
|
104
|
+
if (!title)
|
|
105
|
+
throw new Error("rename: empty title");
|
|
106
|
+
const zcodeSid = server.resolveSid(acpSid);
|
|
107
|
+
for (const sid of server.sessionAliases(acpSid)) {
|
|
108
|
+
server.sessionTitles.set(sid, title);
|
|
109
|
+
// Wins over every later automatic path: generated pushes (this pin and
|
|
110
|
+
// the freeze set), the first-prompt auto-title gate (sessionTitles.has).
|
|
111
|
+
server.titleUserSetBy.add(sid);
|
|
112
|
+
server.titleEligibleSessions.delete(sid);
|
|
113
|
+
// A rename must not resurrect an alias retired by a remote close
|
|
114
|
+
// (ADR-0006) — same guard as the listener's adoption loop.
|
|
115
|
+
if (!server.discoveryRetiredAt.has(sid))
|
|
116
|
+
server.touchSessionSummary(sid, title);
|
|
117
|
+
refreshTerminalTabTitle(server, sid);
|
|
118
|
+
}
|
|
119
|
+
if (zcodeSid) {
|
|
120
|
+
// Manual intent finalizes the auto-title phase regardless of whether a
|
|
121
|
+
// generated push was ever seen.
|
|
122
|
+
server.autoTitleFinalized.add(zcodeSid);
|
|
123
|
+
// AWAIT both persists: the response must not beat the backend store.
|
|
124
|
+
// The phone/editor re-reads the session list right after a rename, and
|
|
125
|
+
// `listSessions` serves backend titles — answering before the v4 command
|
|
126
|
+
// landed flipped the fresh title back to the stale one (the command may
|
|
127
|
+
// cold-resume an idle session first, hence the 10s budget). Both are
|
|
128
|
+
// best-effort: on failure the bridge-side pins above still hold and the
|
|
129
|
+
// listing overlay (overriddenTaskTitles) covers the read side.
|
|
130
|
+
await sendBackendRename(server, zcodeSid, title);
|
|
131
|
+
await renameSessionTask(zcodeSid, title).catch((e) => warn(`rename: tasks-index persist failed (non-fatal): ` +
|
|
132
|
+
`${e instanceof Error ? e.message : String(e)}`));
|
|
133
|
+
}
|
|
134
|
+
for (const sid of server.sessionAliases(acpSid)) {
|
|
135
|
+
void sendSessionUpdate(server.clients.broadcast(), sid, {
|
|
136
|
+
sessionUpdate: "session_info_update",
|
|
137
|
+
title,
|
|
138
|
+
updatedAt: new Date().toISOString(),
|
|
139
|
+
}).catch((e) => log(`rename: session_info_update broadcast failed: ${e instanceof Error ? e.message : String(e)}`));
|
|
140
|
+
}
|
|
141
|
+
log(`rename: session ${acpSid.slice(0, 8)} → "${title}"`);
|
|
142
|
+
return { title };
|
|
143
|
+
}
|
|
47
144
|
export class SessionTitleListener {
|
|
48
145
|
server;
|
|
49
146
|
zcodeSid;
|
|
@@ -71,6 +168,14 @@ export class SessionTitleListener {
|
|
|
71
168
|
if (!primary)
|
|
72
169
|
return; // no ACP alias attached yet — nothing to update
|
|
73
170
|
const aliases = this.server.sessionAliases(primary);
|
|
171
|
+
// Auto naming happens EXACTLY ONCE: the first `generated` push (replacing
|
|
172
|
+
// the provisional seed) is the only automatic title change a conversation
|
|
173
|
+
// ever gets. Later pushes — deferred sidecar results, resume re-emission
|
|
174
|
+
// after the stored event rotated out of the retention window — must not
|
|
175
|
+
// retitle a conversation mid-flight. Checked BEFORE the durable pin
|
|
176
|
+
// consult so a repeat push costs no sqlite read.
|
|
177
|
+
if (source === "generated" && this.server.autoTitleFinalized.has(this.zcodeSid))
|
|
178
|
+
return;
|
|
74
179
|
// A manual rename is the strongest title intent; a generated push must
|
|
75
180
|
// not override it. The in-memory pin covers renames made through THIS
|
|
76
181
|
// bridge; the durable tasks-index flag covers renames that predate the
|
|
@@ -96,6 +201,8 @@ export class SessionTitleListener {
|
|
|
96
201
|
for (const sid of aliases)
|
|
97
202
|
this.server.titleUserSetBy.add(sid);
|
|
98
203
|
}
|
|
204
|
+
// Either adoption finalizes the auto-title phase for good.
|
|
205
|
+
this.server.autoTitleFinalized.add(this.zcodeSid);
|
|
99
206
|
if (aliases.every((sid) => this.server.sessionTitles.get(sid) === title))
|
|
100
207
|
return;
|
|
101
208
|
for (const sid of aliases) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-titles.js","sourceRoot":"","sources":["../../src/handlers/session-titles.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"session-titles.js","sourceRoot":"","sources":["../../src/handlers/session-titles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIzC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EAAE,uBAAuB,EAA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AQ,EAAE,mBAAmB,EAC7B,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,gBAAgB,EACxB,EAAE,EAAE,GAAG,CAAC,YAAY,EACpB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,WAAW,EACjB,SAAS,EAAE,OAAO,GACjB,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAoqB7B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iCAAiC,CAC/C,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EACpB,WAAW,EAAE,OAAO,EACpB,SAAS,EAAE,OAAO,GACjB,OAAO,CAET;AA2DD;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,OAAO,EAAE,GAAG,SAAS,EAC5B,UAAU,EAAE,KAAK,CAAC;IAAE,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,EAAE,CAAA;CAAE,CAAC,GAAG,SAAS,GACxE,OAAO,EAAE,CASX;AA0BD;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,cAAc,EACtB,EAAE,EAAE,GAAG,CAAC,YAAY,EACpB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAmBf;AA0ED,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,cAAc,EACtB,EAAE,EAAE,GAAG,CAAC,YAAY,EACpB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,gBAAgB,EACxB,UAAU,EAAE,MAAM,EAClB,OAAO,UAAO,GACb,OAAO,CAAC,IAAI,CAAC,CAiCf"}
|
package/dist/handlers/session.js
CHANGED
|
@@ -787,6 +787,17 @@ export async function ensureRealSession(server, acpSid, opts = {}) {
|
|
|
787
787
|
title: session.title ?? "",
|
|
788
788
|
traceId: session.traceId,
|
|
789
789
|
});
|
|
790
|
+
// A rename made while this was still a placeholder (no backend id) could
|
|
791
|
+
// only pin in memory — re-run the shared core now that the session exists
|
|
792
|
+
// so the backend (v4 renameSession, titleSource=custom) and tasks-index
|
|
793
|
+
// catch up. Idempotent (same title, equality-guarded downstream).
|
|
794
|
+
if (server.titleUserSetBy.has(acpSid)) {
|
|
795
|
+
const placeholderTitle = server.sessionTitles.get(acpSid);
|
|
796
|
+
if (placeholderTitle) {
|
|
797
|
+
const { renameSessionCore } = await import("./session-titles.js");
|
|
798
|
+
void renameSessionCore(server, acpSid, placeholderTitle).catch(() => undefined);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
790
801
|
return sid;
|
|
791
802
|
})();
|
|
792
803
|
pending.creating = creating;
|
|
@@ -849,22 +860,79 @@ export async function listSessions(server, params) {
|
|
|
849
860
|
catch {
|
|
850
861
|
// tasks-index unavailable — show everything.
|
|
851
862
|
}
|
|
863
|
+
// User renames are the title truth: the backend store can lag the v4
|
|
864
|
+
// renameSession command (an idle session cold-resumes first), so overlay
|
|
865
|
+
// the durable `title_overridden` titles — a rename must be visible in
|
|
866
|
+
// every read the moment it returns, or the client's next list pull flips
|
|
867
|
+
// the fresh title back to the stale one ("改名被弹回"). Own try (a partially
|
|
868
|
+
// mocked tasks-index must only skip the overlay, never fail the listing).
|
|
869
|
+
try {
|
|
870
|
+
const { overriddenTaskTitles } = await import("../tasks-index.js");
|
|
871
|
+
const renamed = await overriddenTaskTitles();
|
|
872
|
+
if (renamed.size > 0) {
|
|
873
|
+
sessions = sessions.map((s) => renamed.has(s.sessionId) ? { ...s, title: renamed.get(s.sessionId) } : s);
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
catch {
|
|
877
|
+
// overlay unavailable — backend titles as-is.
|
|
878
|
+
}
|
|
852
879
|
log(`session/list → ${sessions.length} sessions`);
|
|
853
880
|
return { sessions };
|
|
854
881
|
}
|
|
855
882
|
/**
|
|
856
|
-
* Adopt
|
|
883
|
+
* Adopt a title for a loaded/resumed session, pin-first:
|
|
884
|
+
* 1. a sibling alias's already-known title (same conversation, another id
|
|
885
|
+
* spelling);
|
|
886
|
+
* 2. the durable user rename from the App's tasks-index
|
|
887
|
+
* (`title_overridden=1` — survives bridge restarts);
|
|
888
|
+
* 3. the backend's `session/list` stored title.
|
|
857
889
|
*
|
|
858
890
|
* The prompt loop's auto-title only fires for freshly created sessions
|
|
859
891
|
* (`titleEligibleSessions`), so a session resumed across a bridge restart
|
|
860
892
|
* would otherwise appear title-less in the hub's discovery API — remote
|
|
861
|
-
* clients have no editor-side session storage to fall back on.
|
|
862
|
-
*
|
|
863
|
-
* bridge lifetime. Best-effort: failures log and leave the session untitled.
|
|
893
|
+
* clients have no editor-side session storage to fall back on. Best-effort:
|
|
894
|
+
* failures log and leave the session untitled.
|
|
864
895
|
*/
|
|
865
896
|
async function adoptStoredTitle(server, acpSid, zcodeSid) {
|
|
866
897
|
if (server.sessionTitles.has(acpSid))
|
|
867
898
|
return;
|
|
899
|
+
// Tier 1 — sibling alias: a rename or adoption under another spelling of
|
|
900
|
+
// the same conversation already knows the title. Copy it instead of asking
|
|
901
|
+
// the backend, whose store may lag a bridge-side rename (a rename through
|
|
902
|
+
// one alias used to be invisible here, so a load via a second alias reset
|
|
903
|
+
// the title).
|
|
904
|
+
const sibling = server
|
|
905
|
+
.sessionAliases(acpSid)
|
|
906
|
+
.map((sid) => server.sessionTitles.get(sid))
|
|
907
|
+
.find((t) => t !== undefined);
|
|
908
|
+
if (sibling !== undefined) {
|
|
909
|
+
server.sessionTitles.set(acpSid, sibling);
|
|
910
|
+
server.touchSessionSummary(acpSid, sibling);
|
|
911
|
+
refreshTerminalTabTitle(server, acpSid);
|
|
912
|
+
return;
|
|
913
|
+
}
|
|
914
|
+
// Tier 2 — durable user rename: `title_overridden=1` in the App's
|
|
915
|
+
// tasks-index survives bridge restarts (the in-memory pin does not). The
|
|
916
|
+
// backend store may never have been told (pre-v4 rename, command failure),
|
|
917
|
+
// so its session/list answer can be stale — the user's title wins.
|
|
918
|
+
try {
|
|
919
|
+
const { readTaskTitle } = await import("../tasks-index.js");
|
|
920
|
+
const task = await readTaskTitle(zcodeSid);
|
|
921
|
+
if (task?.overridden && task.title) {
|
|
922
|
+
server.sessionTitles.set(acpSid, task.title);
|
|
923
|
+
for (const sid of server.sessionAliases(acpSid))
|
|
924
|
+
server.titleUserSetBy.add(sid);
|
|
925
|
+
server.touchSessionSummary(acpSid, task.title);
|
|
926
|
+
refreshTerminalTabTitle(server, acpSid);
|
|
927
|
+
log(`adopted user-renamed title for ${acpSid.slice(0, 8)}: ${task.title}`);
|
|
928
|
+
return;
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
catch {
|
|
932
|
+
// Best-effort consult — fall through to the backend's stored title.
|
|
933
|
+
}
|
|
934
|
+
// Tier 3 — the backend's session/list: the only title source for sessions
|
|
935
|
+
// born in a previous bridge lifetime.
|
|
868
936
|
try {
|
|
869
937
|
const backend = await server.ensureBackend();
|
|
870
938
|
const resp = await backend.request(server.nextId(), "session/list", {}, 15000);
|