@songsid/agend 2.4.0-beta.11 → 2.4.0-beta.12

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.
Files changed (165) hide show
  1. package/dist/accounts-view.d.ts +29 -0
  2. package/dist/accounts-view.js +2 -14
  3. package/dist/accounts-view.js.map +1 -1
  4. package/dist/agent-endpoint.d.ts +1 -0
  5. package/dist/agent-endpoint.js +4 -2
  6. package/dist/agent-endpoint.js.map +1 -1
  7. package/dist/auth-api.d.ts +2 -0
  8. package/dist/auth-api.js +28 -2
  9. package/dist/auth-api.js.map +1 -1
  10. package/dist/build-provenance.json +1 -1
  11. package/dist/channel/mcp-server.js +1 -1
  12. package/dist/channel/mcp-server.js.map +1 -1
  13. package/dist/channel/mcp-tools.js +3 -1
  14. package/dist/channel/mcp-tools.js.map +1 -1
  15. package/dist/claude-install-kind.d.ts +19 -0
  16. package/dist/claude-install-kind.js +54 -0
  17. package/dist/claude-install-kind.js.map +1 -0
  18. package/dist/daemon.d.ts +5 -0
  19. package/dist/daemon.js +20 -2
  20. package/dist/daemon.js.map +1 -1
  21. package/dist/fleet-manager.d.ts +105 -1
  22. package/dist/fleet-manager.js +366 -24
  23. package/dist/fleet-manager.js.map +1 -1
  24. package/dist/general-knowledge/skills/hub/SKILL.md +25 -0
  25. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +6 -0
  26. package/dist/hub/agent-intro-model.d.ts +38 -0
  27. package/dist/hub/agent-intro-model.js +14 -0
  28. package/dist/hub/agent-intro-model.js.map +1 -0
  29. package/dist/hub/agent-intro-tool.d.ts +35 -0
  30. package/dist/hub/agent-intro-tool.js +83 -0
  31. package/dist/hub/agent-intro-tool.js.map +1 -0
  32. package/dist/hub/client.d.ts +1 -0
  33. package/dist/hub/client.js +26 -0
  34. package/dist/hub/client.js.map +1 -1
  35. package/dist/hub/compose/member.d.ts +13 -5
  36. package/dist/hub/compose/member.js +28 -5
  37. package/dist/hub/compose/member.js.map +1 -1
  38. package/dist/hub/compose/server.d.ts +1 -0
  39. package/dist/hub/compose/server.js +5 -1
  40. package/dist/hub/compose/server.js.map +1 -1
  41. package/dist/hub/http/compose.d.ts +1 -0
  42. package/dist/hub/http/compose.js +28 -5
  43. package/dist/hub/http/compose.js.map +1 -1
  44. package/dist/hub/http/schema.js +6 -0
  45. package/dist/hub/http/schema.js.map +1 -1
  46. package/dist/hub/member/agent-intro.d.ts +28 -0
  47. package/dist/hub/member/agent-intro.js +66 -0
  48. package/dist/hub/member/agent-intro.js.map +1 -0
  49. package/dist/hub/member/room-ask.d.ts +10 -0
  50. package/dist/hub/member/room-ask.js +70 -7
  51. package/dist/hub/member/room-ask.js.map +1 -1
  52. package/dist/hub/member/room-notification.d.ts +1 -1
  53. package/dist/hub/member/room-post.d.ts +6 -3
  54. package/dist/hub/member/room-post.js +9 -3
  55. package/dist/hub/member/room-post.js.map +1 -1
  56. package/dist/hub/protocol.d.ts +172 -4
  57. package/dist/hub/protocol.js +10 -5
  58. package/dist/hub/protocol.js.map +1 -1
  59. package/dist/hub/room-answer-status-model.d.ts +3 -0
  60. package/dist/hub/room-answer-status-model.js +4 -0
  61. package/dist/hub/room-answer-status-model.js.map +1 -0
  62. package/dist/hub/room-brief-model.d.ts +30 -0
  63. package/dist/hub/room-brief-model.js +37 -0
  64. package/dist/hub/room-brief-model.js.map +1 -0
  65. package/dist/hub/room-context-model.d.ts +2 -0
  66. package/dist/hub/room-context-model.js +2 -2
  67. package/dist/hub/room-context-model.js.map +1 -1
  68. package/dist/hub/room-members-model.d.ts +63 -0
  69. package/dist/hub/room-members-model.js +7 -0
  70. package/dist/hub/room-members-model.js.map +1 -0
  71. package/dist/hub/rooms/agents.js +50 -10
  72. package/dist/hub/rooms/agents.js.map +1 -1
  73. package/dist/hub/rooms/brief.d.ts +18 -0
  74. package/dist/hub/rooms/brief.js +39 -0
  75. package/dist/hub/rooms/brief.js.map +1 -0
  76. package/dist/hub/rooms/members-page.d.ts +33 -0
  77. package/dist/hub/rooms/members-page.js +37 -0
  78. package/dist/hub/rooms/members-page.js.map +1 -0
  79. package/dist/hub/rooms/purpose.d.ts +7 -0
  80. package/dist/hub/rooms/purpose.js +14 -0
  81. package/dist/hub/rooms/purpose.js.map +1 -0
  82. package/dist/hub/rooms/service.d.ts +11 -0
  83. package/dist/hub/rooms/service.js +56 -12
  84. package/dist/hub/rooms/service.js.map +1 -1
  85. package/dist/hub/rooms/types.d.ts +6 -2
  86. package/dist/hub/runtime.d.ts +1 -1
  87. package/dist/hub/server.js +27 -1
  88. package/dist/hub/server.js.map +1 -1
  89. package/dist/hub/types.d.ts +9 -5
  90. package/dist/hub-room-reply-warning.d.ts +2 -0
  91. package/dist/hub-room-reply-warning.js +16 -0
  92. package/dist/hub-room-reply-warning.js.map +1 -0
  93. package/dist/instance-lifecycle.d.ts +15 -0
  94. package/dist/instance-lifecycle.js +36 -1
  95. package/dist/instance-lifecycle.js.map +1 -1
  96. package/dist/locale.js +20 -0
  97. package/dist/locale.js.map +1 -1
  98. package/dist/login-controller.d.ts +26 -0
  99. package/dist/login-controller.js +72 -2
  100. package/dist/login-controller.js.map +1 -1
  101. package/dist/native-mcp.js +1 -1
  102. package/dist/native-mcp.js.map +1 -1
  103. package/dist/needs-you-hub.js +1 -1
  104. package/dist/needs-you-hub.js.map +1 -1
  105. package/dist/needs-you.d.ts +8 -1
  106. package/dist/needs-you.js +5 -0
  107. package/dist/needs-you.js.map +1 -1
  108. package/dist/outbound-handlers.d.ts +2 -1
  109. package/dist/outbound-handlers.js +17 -4
  110. package/dist/outbound-handlers.js.map +1 -1
  111. package/dist/outbound-schemas.d.ts +10 -0
  112. package/dist/outbound-schemas.js +3 -1
  113. package/dist/outbound-schemas.js.map +1 -1
  114. package/dist/public-web-gateway.js +5 -1
  115. package/dist/public-web-gateway.js.map +1 -1
  116. package/dist/restart-progress.d.ts +6 -0
  117. package/dist/restart-progress.js +5 -0
  118. package/dist/restart-progress.js.map +1 -1
  119. package/dist/settings-effect.js +17 -1
  120. package/dist/settings-effect.js.map +1 -1
  121. package/dist/tool-permissions.js +3 -3
  122. package/dist/tool-permissions.js.map +1 -1
  123. package/dist/ui/chat-quote.js +3 -261
  124. package/dist/ui/host-install.js +77 -3
  125. package/dist/ui/hub-agent-intro.js +15 -6
  126. package/dist/ui/hub-attachments.js +81 -3
  127. package/dist/ui/hub-client.js +4 -0
  128. package/dist/ui/hub-intro-notice.js +16 -0
  129. package/dist/ui/hub-my-agents.js +5 -2
  130. package/dist/ui/hub-room-composer.js +10 -2
  131. package/dist/ui/hub-room-list.js +1 -1
  132. package/dist/ui/hub-room-members.js +2 -0
  133. package/dist/ui/hub-room-new.js +7 -4
  134. package/dist/ui/hub-room-purpose.js +19 -0
  135. package/dist/ui/hub-room-search.js +1 -1
  136. package/dist/ui/hub-room-settings.js +9 -0
  137. package/dist/ui/hub-room-strings.js +6 -4
  138. package/dist/ui/hub-room-thread.js +68 -17
  139. package/dist/ui/panel-chat.js +19 -5
  140. package/dist/ui/panel-hub.js +61 -18
  141. package/dist/ui/shared/app-i18n.js +2 -2
  142. package/dist/ui/shared/app-shell.js +6 -0
  143. package/dist/ui/shared/app.js +3 -1
  144. package/dist/ui/shared/chat-msg-actions.js +3 -1
  145. package/dist/ui/shared/chat-quote.js +261 -0
  146. package/dist/ui/shared/hub-chat.css +28 -0
  147. package/dist/ui/shared/hub-rooms-u2.css +5 -0
  148. package/dist/ui/shared/module-warm.d.ts +3 -0
  149. package/dist/ui/shared/module-warm.js +39 -0
  150. package/dist/web-api.d.ts +17 -4
  151. package/dist/web-api.js +83 -6
  152. package/dist/web-api.js.map +1 -1
  153. package/dist/web-asset-version.d.ts +65 -0
  154. package/dist/web-asset-version.js +259 -0
  155. package/dist/web-asset-version.js.map +1 -0
  156. package/dist/web-host-guard.js +3 -1
  157. package/dist/web-host-guard.js.map +1 -1
  158. package/dist/web-host-install.d.ts +30 -3
  159. package/dist/web-host-install.js +50 -4
  160. package/dist/web-host-install.js.map +1 -1
  161. package/dist/web-terminal.d.ts +5 -0
  162. package/dist/web-terminal.js +11 -0
  163. package/dist/web-terminal.js.map +1 -1
  164. package/launcher/agend-install.cjs +48 -7
  165. package/package.json +1 -1
@@ -0,0 +1,261 @@
1
+ // M-2789 (the user, 11-09): answer a long, multi-part message passage by passage. Select text in ONE message of the thread
2
+ // → a small 「引用」 pill → the passage goes into the composer as a Markdown quote ("> …") at the caret, on its own lines,
3
+ // the caret left on the next line for the answer. Repeatable: quote, answer, quote the next passage, answer…
4
+ //
5
+ // - Desktop: the pill is anchored to where the selection ends (a pointer at the exact spot), below that line — clear of
6
+ // the browser's own menu above a selection (Edge's mini menu sits there, and a page can't turn it off; M-2872) — and
7
+ // above it only when there is no room below in the thread's visible box. After a quote the composer takes the focus.
8
+ // - Phone (a coarse pointer): the pill 「引用選取的文字」 docks above the composer's whole box inside the 16-px gutter — clear
9
+ // of the system's own copy toolbar (above a selection) and of the finger — or at the top of the thread when the
10
+ // passage sits there. The keyboard does NOT open after a quote (the user's choice): more passages can be selected;
11
+ // the composer's own scroller shows the caret and the newest quote.
12
+ // - No pill for a selection across messages, outside the thread, or on a page that can't send; no keyboard shortcut
13
+ // (the user's choice). The whole-message Reply (#2272) is unchanged, and so is the browser's menu on selected text.
14
+ // - What is sent is the composer's text as typed: the agent reads the "> " lines as written; the web renders them as
15
+ // blockquotes (chat-render.js); Discord's mirror shows them as quotes, Telegram's as the same plain lines.
16
+ //
17
+ // Its own words and drawing (a page that loaded an older chat-strings.js or ui-icons.js still draws it), CSSOM only
18
+ // (no style attribute: #1300), the shared popover look (.msg-menu) with the shared border and shadow tokens.
19
+ import { register, t } from "/assets/app-i18n.js";
20
+
21
+ register("chatQuote", {
22
+ en: { quote: "Quote", quotePhone: "Quote selection", label: "Quote the selected text in your message" },
23
+ "zh-TW": { quote: "引用", quotePhone: "引用選取的文字", label: "把選取的文字引用到你的訊息裡" },
24
+ });
25
+ const tq = (k) => t(`chatQuote.${k}`);
26
+
27
+ /**
28
+ * Where the person's caret was in the composer when it last lost the focus — what a quote goes in at. A field's own
29
+ * selectionStart can't be trusted after the page's selection moved into the thread (Chrome resets it), so it is kept
30
+ * here, with the text it belongs to (a caret for another text is no caret).
31
+ */
32
+ const remembered = new WeakMap();
33
+ export function composerCaret(field, value) {
34
+ if (!field) return value.length;
35
+ const r = remembered.get(field);
36
+ if (r && r.value === value) return r.caret;
37
+ const doc = field.ownerDocument;
38
+ if (doc && doc.activeElement === field && field.value === value) return field.selectionStart ?? value.length;
39
+ return value.length;
40
+ }
41
+
42
+ /** The passage as Markdown quote lines: each line "> line" (an empty one "> " keeps the quote one block). */
43
+ export function quoteBlock(text) {
44
+ const lines = String(text ?? "").replace(/\r\n?/g, "\n").replace(/ /g, " ").split("\n").map((l) => l.replace(/\s+$/, ""));
45
+ while (lines.length && !lines[0].trim()) lines.shift();
46
+ while (lines.length && !lines[lines.length - 1].trim()) lines.pop();
47
+ // A run of empty lines inside the passage becomes one quoted empty line.
48
+ const out = [];
49
+ for (const l of lines) { if (!l.trim() && out.length && out[out.length - 1] === ">") continue; out.push(l.trim() ? `> ${l}` : ">"); }
50
+ return out.join("\n");
51
+ }
52
+
53
+ /**
54
+ * Put the passage into `value` at `caret`, on its own lines: a blank line before it when text precedes on the line or
55
+ * just above, the caret on the line after it (for the answer), and a line break before any text that follows.
56
+ * Returns { value, caret }, or null for a passage with nothing to quote.
57
+ */
58
+ export function insertQuote(value, caret, text) {
59
+ const block = quoteBlock(text);
60
+ if (!block) return null;
61
+ const v = String(value ?? "");
62
+ const at = Math.max(0, Math.min(Number.isInteger(caret) ? caret : v.length, v.length));
63
+ const before = v.slice(0, at), after = v.slice(at);
64
+ const lead = !before ? "" : before.endsWith("\n\n") ? "" : before.endsWith("\n") ? "\n" : "\n\n";
65
+ const head = before + lead + block + "\n";
66
+ // Text after the caret starts its own line below the answer's (its leading spaces dropped with the break).
67
+ const tail = after && !after.startsWith("\n") ? "\n" + after.replace(/^[ \t]+/, "") : after;
68
+ return { value: head + tail, caret: head.length };
69
+ }
70
+
71
+ /** The selected passage when it lies inside one message's text of `list`, else null. { text, el, rects }. */
72
+ export function selectedPassage(list, sel) {
73
+ if (!sel || sel.isCollapsed || !sel.rangeCount) return null;
74
+ const text = String(sel.toString() || "");
75
+ if (!text.trim()) return null;
76
+ const msg = (n) => { const e = n && (n.nodeType === 1 ? n : n.parentElement); return e && e.closest ? e.closest(".msg[data-key]") : null; };
77
+ // The message's own words, not its header (sender, time) or its action strip.
78
+ const inBody = (n) => { const e = n && (n.nodeType === 1 ? n : n.parentElement); return !!(e && e.closest && e.closest(".body, .md") && !e.closest(".meta, .msg-actions")); };
79
+ // Every range of the selection (a browser may keep several: #3555 review P3) in the same message's words — what is
80
+ // quoted is the whole selection's text.
81
+ const range = sel.getRangeAt(0), a = msg(range.startContainer);
82
+ if (!a || !list.contains(a)) return null;
83
+ for (let i = 0; i < sel.rangeCount; i++) {
84
+ const rg = sel.getRangeAt(i);
85
+ if (msg(rg.startContainer) !== a || msg(rg.endContainer) !== a || !inBody(rg.startContainer) || !inBody(rg.endContainer)) return null;
86
+ }
87
+ return { text, el: a, range };
88
+ }
89
+
90
+ /**
91
+ * Where the composer's caret sits, in px from the top of its text (a mirror of the field's text box up to the caret).
92
+ * Used to show the caret without focusing the field (a phone: the keyboard stays down).
93
+ */
94
+ export function caretTop(field, pos) {
95
+ const doc = field.ownerDocument, win = doc.defaultView;
96
+ if (!win || !win.getComputedStyle) return 0;
97
+ const cs = win.getComputedStyle(field);
98
+ const m = doc.createElement("div");
99
+ for (const p of ["box-sizing", "width", "padding-top", "padding-right", "padding-bottom", "padding-left", "border-top-width", "border-right-width",
100
+ "border-bottom-width", "border-left-width", "font-family", "font-size", "font-weight", "font-style", "line-height", "letter-spacing", "word-spacing", "tab-size"]) {
101
+ m.style.setProperty(p, cs.getPropertyValue(p));
102
+ }
103
+ for (const [k, v] of [["position", "absolute"], ["visibility", "hidden"], ["top", "0"], ["left", "-9999px"], ["white-space", "pre-wrap"], ["overflow-wrap", "break-word"], ["height", "auto"]]) m.style.setProperty(k, v);
104
+ m.textContent = field.value.slice(0, pos);
105
+ const mark = doc.createElement("span"); mark.textContent = "​"; m.append(mark);
106
+ doc.body.append(m);
107
+ const y = mark.offsetTop, h = mark.offsetHeight;
108
+ m.remove();
109
+ return { y, h };
110
+ }
111
+
112
+ /** Scroll the field's own scroller so the caret (and the lines just above it: the newest quote) are in view. */
113
+ export function showCaret(field, pos) {
114
+ // At the end (the usual case: the newest quote is the last thing in the box): the bottom.
115
+ if (pos >= field.value.length) { field.scrollTop = field.scrollHeight; return; }
116
+ const c = caretTop(field, pos);
117
+ if (!c || typeof c !== "object") { field.scrollTop = field.scrollHeight; return; }
118
+ const view = field.clientHeight;
119
+ if (c.y + c.h > field.scrollTop + view) field.scrollTop = Math.max(0, c.y + c.h - view + 4);
120
+ else if (c.y < field.scrollTop) field.scrollTop = Math.max(0, c.y - 4);
121
+ }
122
+
123
+ // The quote mark: two marks on the shared 24-px grid, 2-px stroke, currentColor (as ui-icons.js draws).
124
+ const ICON = "M4 11h5v6H4v-6zm0 0c0-3 1.5-5 4-6M14 11h5v6h-5v-6zm0 0c0-3 1.5-5 4-6";
125
+ function iconEl(doc) {
126
+ const NS = "http://www.w3.org/2000/svg";
127
+ const svg = doc.createElementNS(NS, "svg");
128
+ for (const [k, v] of [["class", "icon"], ["width", "16"], ["height", "16"], ["viewBox", "0 0 24 24"], ["fill", "none"], ["stroke", "currentColor"], ["stroke-width", "2"],
129
+ ["stroke-linecap", "round"], ["stroke-linejoin", "round"], ["aria-hidden", "true"], ["focusable", "false"]]) svg.setAttribute(k, v);
130
+ const p = doc.createElementNS(NS, "path"); p.setAttribute("d", ICON); svg.append(p);
131
+ return svg;
132
+ }
133
+
134
+ const overlap = (a, z) => Math.max(0, Math.min(a.right, z.right) - Math.max(a.left, z.left)) * Math.max(0, Math.min(a.bottom, z.bottom) - Math.max(a.top, z.top));
135
+
136
+ /**
137
+ * Install the pill on `list` (the thread element). `deps`:
138
+ * field() → the composer's text field (marked data-touched once it has had the focus: its caret is the person's);
139
+ * canQuote() → boolean (a page that can send); insert(text) (the composer's side: see panel-chat.js);
140
+ * phone() → boolean (a coarse pointer); composerBox() → the composer's whole box (Element) or null; threadBox() → Element.
141
+ * Returns a function that removes everything.
142
+ */
143
+ export function installQuoteSelection(list, deps) {
144
+ const doc = list.ownerDocument, win = doc.defaultView;
145
+ let pop = null, timer = null, down = false, current = null, drawnFor = "";
146
+
147
+ function hide() {
148
+ current = null; drawnFor = "";
149
+ if (!pop) return;
150
+ pop.remove(); pop = null;
151
+ }
152
+ function place(passage) {
153
+ const phone = !!deps.phone?.();
154
+ if (!pop) {
155
+ pop = doc.createElement("div");
156
+ pop.className = "msg-menu quote-pop";
157
+ pop.setAttribute("role", "toolbar"); pop.setAttribute("data-trust", "menu"); pop.setAttribute("aria-label", tq("label"));
158
+ const b = doc.createElement("button");
159
+ b.type = "button"; b.className = "menu-item quote-pick";
160
+ b.append(iconEl(doc));
161
+ const span = doc.createElement("span"); b.append(span);
162
+ // A press on the pill must not collapse the selection it is about (mousedown's default does, pointerdown's
163
+ // preventDefault alone doesn't); the passage is the one the pill was drawn for, whatever the selection did since.
164
+ b.addEventListener("pointerdown", (e) => { e.preventDefault(); });
165
+ b.addEventListener("mousedown", (e) => { e.preventDefault(); });
166
+ b.addEventListener("click", (e) => { e.preventDefault(); const text = drawnFor; hide(); if (text) { deps.insert(text); doc.getSelection?.()?.removeAllRanges?.(); } });
167
+ pop.append(b);
168
+ doc.body.append(pop);
169
+ }
170
+ pop.classList.toggle("is-phone", phone);
171
+ const label = pop.querySelector(".quote-pick span"); label.textContent = tq(phone ? "quotePhone" : "quote");
172
+ for (const old of pop.querySelectorAll(".quote-other")) old.remove();
173
+ for (const target of deps.targets?.() || []) {
174
+ const b = doc.createElement("button"); b.type = "button"; b.className = "menu-item quote-pick quote-other";
175
+ b.append(iconEl(doc));
176
+ const span = doc.createElement("span"); span.textContent = target.label; b.append(span); b.title = target.label;
177
+ b.addEventListener("pointerdown", e => e.preventDefault()); b.addEventListener("mousedown", e => e.preventDefault());
178
+ b.addEventListener("click", e => { e.preventDefault(); const text = drawnFor; hide(); if (text) target.insert(text); });
179
+ pop.append(b);
180
+ }
181
+ pop.querySelector(".quote-tip")?.remove();
182
+ const pr = pop.getBoundingClientRect();
183
+ const vw = win?.innerWidth ?? 1024;
184
+ const rects = [...(passage.range.getClientRects?.() ?? [])].filter((x) => x.width > 0);
185
+ if (!rects.length) { hide(); return; }
186
+ const last = rects[rects.length - 1];
187
+ let left, top, tip = null;
188
+ if (!phone) {
189
+ // Room is the thread's visible box (the chat scroller, above the composer), within the window.
190
+ const th = deps.threadBox?.()?.getBoundingClientRect?.();
191
+ const vh = win?.innerHeight ?? 800;
192
+ const box = th && th.bottom > th.top ? th : { top: 0, bottom: vh };
193
+ const floor = Math.min(vh, box.bottom) - 4, ceil = Math.max(0, box.top) + 4;
194
+ left = Math.max(8, Math.min(last.right - pr.width / 2, vw - pr.width - 8));
195
+ const aboveTop = last.top - pr.height - 10, belowTop = last.bottom + 10;
196
+ // Below unless it would run out of the box and above fits (with no room either side, below).
197
+ const under = belowTop + pr.height <= floor || aboveTop < ceil;
198
+ top = under ? belowTop : aboveTop;
199
+ tip = { side: under ? "up" : "down", x: Math.max(10, Math.min(last.right - left - 5, pr.width - 20)) };
200
+ } else {
201
+ const box = deps.composerBox?.()?.getBoundingClientRect?.();
202
+ left = Math.max(16, vw - 16 - pr.width);
203
+ top = box ? box.top - pr.height - 12 : (win?.innerHeight ?? 800) - pr.height - 120;
204
+ const at = { left, right: left + pr.width, top: top - 8, bottom: top + pr.height + 8 };
205
+ if (rects.some((q) => overlap(at, q) > 0)) {
206
+ const th = deps.threadBox?.()?.getBoundingClientRect?.();
207
+ top = Math.max(th ? th.top : 0, 0) + 12;
208
+ }
209
+ }
210
+ if (tip) {
211
+ const s = doc.createElement("span"); s.className = `quote-tip ${tip.side}`; s.setAttribute("aria-hidden", "true");
212
+ s.style.setProperty("left", `${tip.x}px`);
213
+ pop.append(s);
214
+ }
215
+ pop.style.setProperty("left", `${Math.round(left)}px`);
216
+ pop.style.setProperty("top", `${Math.round(top)}px`);
217
+ }
218
+ function check() {
219
+ timer = null;
220
+ if (down || deps.canQuote?.() === false) { hide(); return; }
221
+ const passage = selectedPassage(list, doc.getSelection?.());
222
+ if (!passage) { hide(); return; }
223
+ current = passage; drawnFor = passage.text;
224
+ place(passage);
225
+ }
226
+ function soon() { if (timer) clearTimeout(timer); timer = setTimeout(check, 120); }
227
+ const onSelection = () => soon();
228
+ const onDown = (e) => { if (pop && pop.contains(e.target)) return; down = true; hide(); };
229
+ // A gesture the browser took over (a touch scroll: pointerdown → pointercancel, no pointerup — #3555 review P2-1)
230
+ // ends the press as a pointerup does; the selection then decides.
231
+ const onUp = () => { if (!down) return; down = false; soon(); };
232
+ const onKey = (e) => { if (e.key === "Escape" && pop) { hide(); } };
233
+ const onScroll = () => { if (pop && current) place(current); };
234
+ const onFocusIn = (e) => { const f = deps.field?.(); if (f && e.target === f) f.dataset.touched = "1"; };
235
+ // The caret as the person leaves it: kept on every move inside the composer and when it loses the focus.
236
+ const keep = (e) => { const f = deps.field?.(); if (f && e.target === f) remembered.set(f, { value: f.value, caret: f.selectionStart ?? f.value.length }); };
237
+ const KEEP = ["focusout", "input", "keyup", "mouseup", "select"];
238
+ doc.addEventListener("focusin", onFocusIn);
239
+ for (const k of KEEP) doc.addEventListener(k, keep, true);
240
+ doc.addEventListener("selectionchange", onSelection);
241
+ list.addEventListener("pointerdown", onDown);
242
+ doc.addEventListener("pointerup", onUp);
243
+ doc.addEventListener("pointercancel", onUp);
244
+ doc.addEventListener("keydown", onKey);
245
+ win?.addEventListener("scroll", onScroll, true);
246
+ win?.addEventListener("resize", onScroll);
247
+ return () => {
248
+ if (timer) clearTimeout(timer);
249
+ hide();
250
+ doc.removeEventListener("focusin", onFocusIn);
251
+ for (const k of KEEP) doc.removeEventListener(k, keep, true);
252
+ doc.removeEventListener("selectionchange", onSelection);
253
+ list.removeEventListener("pointerdown", onDown);
254
+ doc.removeEventListener("pointerup", onUp);
255
+ doc.removeEventListener("pointercancel", onUp);
256
+ doc.removeEventListener("keydown", onKey);
257
+ win?.removeEventListener("scroll", onScroll, true);
258
+ win?.removeEventListener("resize", onScroll);
259
+ };
260
+ }
261
+ installQuoteSelection.workspaceVersion = 1;
@@ -175,3 +175,31 @@ a.hub-launch-pill { border: 1px solid var(--border); background: transparent; co
175
175
 
176
176
  /* Room context H1: a short public introduction stays readable on narrow screens. */
177
177
  .hub-chat-title .hub-agent-intro-line{white-space:normal;overflow-wrap:anywhere;text-overflow:clip}
178
+
179
+ /* M-3311 (1): the Fleet chat's drop card over a Hub conversation, shown while files are dragged over it (app.css's
180
+ .p-chat.dragging .drop-overlay; .drop-overlay is hidden and .drop-card drawn there). */
181
+ .hub-chat-main.dragging { position: relative; }
182
+ .hub-chat-main.dragging .drop-overlay {
183
+ display: flex; position: absolute; inset: var(--s-2); z-index: 20; align-items: center; justify-content: center; pointer-events: none;
184
+ border: 2px dashed var(--accent); border-radius: var(--r-lg); background: color-mix(in srgb, var(--bg) 85%, transparent);
185
+ }
186
+
187
+ /* M-3311 (3): the Fleet chat's 「全寬」 for a Hub conversation (app.css .p-chat[data-width="full"]), on a desk; and the lines
188
+ under the box: the Enter hint, then the conversation's own note on a line of its own (side by side, a phone squeezed the
189
+ first to nothing). */
190
+ @media (min-width: 900px) and (pointer: fine), (min-width: 900px) and (pointer: none), (min-width: 900px) and (min-height: 501px), (min-width: 1024px) {
191
+ .hub-chat[data-width="full"] .thread, .hub-chat[data-width="full"] .dock-col { max-width: none; }
192
+ }
193
+ .composer-row.hub-hints { flex-direction: column; align-items: flex-start; gap: 0; }
194
+ .composer-row.hub-hints > .hint { flex-shrink: 0; max-width: 100%; }
195
+
196
+ /* M-3311 (4): a phone's room header is one row, as the Fleet chat's — back, the room (its name, then one line of counts), the
197
+ members and ⋯. The purpose is in the members sheet there (hub-room-members.js), and text size and Notify are in ⋯; the name
198
+ no longer sits on the top edge (the header has room above and below), and the counts are no longer cut to "2 人 · 0 個 …". */
199
+ @media (max-width: 899px), (pointer: coarse) and (max-height: 500px) and (max-width: 1023px) {
200
+ .hub-room-page .hub-chat-head { padding-block: var(--s-1); }
201
+ .hub-room-page .hub-chat-head .hub-chat-title .hub-room-purpose-trigger { display: none; }
202
+ .hub-room-page .hub-chat-head .hub-head-tools { display: none; }
203
+ /* …and its members and ⋯ are full tap targets, as its back is (S-150). */
204
+ .hub-room-page .hub-chat-head .hub-room-menu > .icon-btn, .hub-room-page .hub-chat-head .hub-room-rail-toggle { min-width: var(--tap); min-height: var(--tap); }
205
+ }
@@ -74,3 +74,8 @@
74
74
  .hub-source-trigger { min-height: var(--tap); min-width: var(--tap); }
75
75
  .hub-room-page .msg .meta { align-items: center; }
76
76
  }
77
+
78
+ /* Purpose stays one line in the header; tapping reads the complete room content. */
79
+ .hub-room-purpose-trigger{display:block;max-width:100%;min-height:24px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:start;border:0;background:none;padding:0;color:var(--text-3);font:inherit;font-size:var(--fs-xs);cursor:pointer}
80
+ .hub-room-purpose-full,.hub-room-purpose-panel p{white-space:pre-wrap;overflow-wrap:anywhere}
81
+ @media(max-width:640px),(pointer:coarse){.hub-room-purpose-trigger{min-height:var(--tap)}}
@@ -0,0 +1,3 @@
1
+ export function closureOf(graph: Record<string, string[]> | null, entry: string): string[];
2
+ export function createWarmer(opts?: { doc?: Document; url?: string }): (entry: string) => number;
3
+ export const warmModules: (entry: string) => number;
@@ -0,0 +1,39 @@
1
+ // M-3314: a panel opened after the page loaded (Settings, Fleet…) asks for its whole module graph at once, not one
2
+ // import level at a time over a slow link. The shell carries the served modules' static imports (#agend-modules, a
3
+ // signed-in admin's page only) and loads this file under its version (/assets/v-<V>/); a preload names the same
4
+ // versioned URL the import map gives the import, so the browser fetches each file once. Anywhere else (no graph, a
5
+ // plain path) it does nothing and the import loads as before.
6
+
7
+ const VERSIONED = /\/assets\/(v-[0-9a-f]{12})\/module-warm\.js(?:[?#]|$)/;
8
+
9
+ function readGraph(doc) {
10
+ try { const el = doc && doc.getElementById("agend-modules"); return el ? JSON.parse(el.textContent || "null") : null; } catch { return null; }
11
+ }
12
+
13
+ /** The module URLs (plain) `entry` imports statically, itself included. */
14
+ export function closureOf(graph, entry) {
15
+ const seen = new Set(), stack = [entry];
16
+ while (stack.length) { const u = stack.pop(); if (seen.has(u) || !graph || !Object.prototype.hasOwnProperty.call(graph, u)) continue; seen.add(u); for (const d of graph[u]) stack.push(d); }
17
+ return [...seen];
18
+ }
19
+
20
+ /** A warmer over this page: `warm(entry)` adds one modulepreload per module of the entry's graph not asked for yet. */
21
+ export function createWarmer({ doc = globalThis.document, url = import.meta.url } = {}) {
22
+ const m = VERSIONED.exec(url);
23
+ const graph = m ? readGraph(doc) : null;
24
+ const version = m ? m[1] : null;
25
+ return function warm(entry) {
26
+ if (!graph || !version || !doc || !doc.head) return 0;
27
+ let added = 0;
28
+ for (const u of closureOf(graph, entry)) {
29
+ const href = u.replace(/^\/(assets|ui\/js)\//, `/$1/${version}/`);
30
+ if (doc.head.querySelector(`link[rel="modulepreload"][href="${href}"]`)) continue;
31
+ const link = doc.createElement("link");
32
+ link.setAttribute("rel", "modulepreload"); link.setAttribute("href", href);
33
+ doc.head.appendChild(link); added++;
34
+ }
35
+ return added;
36
+ };
37
+ }
38
+
39
+ export const warmModules = createWarmer();
package/dist/web-api.d.ts CHANGED
@@ -17,6 +17,7 @@ import type { WebUpdateHost } from "./web-update.js";
17
17
  import type { SendOpts } from "./channel/types.js";
18
18
  import { type WebModelAction } from "./web-commands.js";
19
19
  import type { IncomingMessage, ServerResponse } from "node:http";
20
+ import { type ModuleGraph } from "./web-asset-version.js";
20
21
  import type { LifecycleCreateArgs } from "./instance-lifecycle.js";
21
22
  import { type Actor as BoardActor, type TaskBoard } from "./scheduler/task-board.js";
22
23
  import { type PreviewAvailability } from "./web-preview.js";
@@ -238,6 +239,13 @@ export interface WebApiContext {
238
239
  webMessageInChannel?(instance: string, messageId: string, copies?: readonly import("./web-reactions.js").WebEchoCopy[]): void;
239
240
  /** false: definitely not delivered (the instance's IPC is gone, or it was restarted meanwhile). */
240
241
  generalLocationDeliveryHold?(instanceName: string): string | null;
242
+ /** #4145: `text` with this fleet's sign-in access token hidden (`live`: the live one was in it); null when there is none. */
243
+ screenLoginToken?(text: string): {
244
+ text: string;
245
+ live: boolean;
246
+ } | null;
247
+ /** #4145: take a pasted access token back and send a new one; the line for the chat, or null. */
248
+ loginTokenPasted?(): Promise<string | null>;
241
249
  deliverToInstance(instanceName: string, payload: Record<string, unknown>, options?: {
242
250
  stillCurrent?: () => boolean;
243
251
  authorityCurrent?: () => boolean;
@@ -700,12 +708,17 @@ export declare function serveHubWorkspaceShell(res: ServerResponse, hub: {
700
708
  name: string;
701
709
  preview?: Readonly<import("./hub/preview.js").HubPreviewView>;
702
710
  }): void;
703
- /** The app shell page for one entry, under the panels' CSP; it may frame exactly <preview origin>/frame, and only
704
- * when this load chose one. */
711
+ /** M-3314: the served modules' static imports, read once per process (its files do not change under it). */
712
+ export declare function appModuleGraph(): ModuleGraph;
713
+ /** M-3314: the module each panel's route loads (app.js's own dynamic imports). */
714
+ export declare const PANEL_MODULES: Readonly<Record<string, string>>;
705
715
  /**
706
- * The app shell page. `opts.hubWorkspace`: the page is a Hub's own workspace (slice 1's Hub listener only — the fleet's
707
- * listener never passes it), so it is drawn as the Hub shell.
716
+ * M-3314: what this load of the shell imports, statically or as app.js boots it, so it can be asked for in one wave:
717
+ * app.js; for a signed-in page the chat (always booted) and the panel of the route; for an admin's page also what
718
+ * app.js loads for every admin (backend sign-in, agent proposals) and, with the chat workspace, its modules. Nothing a
719
+ * page of that kind would not load anyway — a guest's or a reader's page preloads only what it imports itself.
708
720
  */
721
+ export declare function shellPreload(mode: AppShellMode, guest: boolean, path: string, workspace: boolean): string[];
709
722
  export declare function serveAppShell(req: IncomingMessage, res: ServerResponse, ctx: AppShellContext, mode: AppShellMode, opts?: {
710
723
  hubWorkspace?: {
711
724
  name: string;
package/dist/web-api.js CHANGED
@@ -40,7 +40,9 @@ import { MAX_COMMAND_ARGS } from "./web-commands.js";
40
40
  import { ROUTE_WORKER_CSP, ROUTE_WORKER_PATH, sendPanelHtml } from "./web-host-guard.js";
41
41
  import { libavoidFile } from "./web-libavoid.js";
42
42
  import { shellRoute } from "./web-shell-routes.js";
43
- import { createReadStream, createWriteStream, readFileSync } from "node:fs";
43
+ import { createReadStream, createWriteStream, existsSync, readFileSync } from "node:fs";
44
+ import { servedAssets } from "./auth-api.js";
45
+ import { assetIntact, assetsUnchanged, assetVersion, assetVersionMark, answerStaleAsset, buildModuleGraph, staticClosure, versionShell, IMMUTABLE_PRIVATE } from "./web-asset-version.js";
44
46
  import { join, dirname } from "node:path";
45
47
  import { fileURLToPath } from "node:url";
46
48
  import { createHash, createHmac, randomUUID } from "node:crypto";
@@ -1704,7 +1706,8 @@ function handleBackendLogin(req, res, url, ctx, path, method) {
1704
1706
  * after it). `GET` reads the current install; `POST` `{ backend }` starts one — the browser names a CLI, the server looks up the registry's command, nothing it sends
1705
1707
  * is ever run; `POST …/cancel` `{}` stops the running one. Every answer is no-store.
1706
1708
  */
1707
- const HOST_INSTALL_STATUS = { not_allowed: 403, unsupported: 400, already: 409, not_installed: 409, up_to_date: 409, version_unreadable: 409, busy: 409, shutting_down: 503, failed: 500 };
1709
+ const HOST_INSTALL_STATUS = { not_allowed: 403, unsupported: 400, already: 409, not_installed: 409, up_to_date: 409, version_unreadable: 409, cli_self_updating: 409,
1710
+ not_npm: 409, still_npm: 409, no_npm_copy: 409, busy: 409, shutting_down: 503, failed: 500 };
1708
1711
  function handleHostInstall(req, res, url, ctx, path, method) {
1709
1712
  res.setHeader("Cache-Control", "private, no-store");
1710
1713
  res.setHeader("X-Content-Type-Options", "nosniff");
@@ -1801,7 +1804,9 @@ function handleHostInstall(req, res, url, ctx, path, method) {
1801
1804
  }
1802
1805
  }
1803
1806
  // AGEND-136: `POST /ui/host-update { backend }` is the same request for an update: the server picks the command and the audited release; the page sends only the CLI's id.
1804
- const result = await installs.begin(now, parsed.data.backend, settingsRequestExecution(req), path === "/ui/host-update" ? "update" : "install");
1807
+ // M-3307: `/ui/host-native-switch` and `/ui/host-npm-remove` are the switch to Claude's native install and the npm copy's removal (web-host-install.ts modes).
1808
+ const mode = path === "/ui/host-update" ? "update" : path === "/ui/host-native-switch" ? "native" : path === "/ui/host-npm-remove" ? "remove-npm" : "install";
1809
+ const result = await installs.begin(now, parsed.data.backend, settingsRequestExecution(req), mode);
1805
1810
  if ("error" in result)
1806
1811
  json(res, HOST_INSTALL_STATUS[result.error] ?? 409, { error: result.error, ...(result.message ? { message: result.message } : {}) });
1807
1812
  else
@@ -2674,9 +2679,27 @@ export function handleWebRequest(req, res, url, ctx) {
2674
2679
  json(res, 400, { error: "Invalid file name" });
2675
2680
  return true;
2676
2681
  }
2682
+ // M-3314: /ui/js/v-<V>/… (rewritten to this path before the gate): this process's <V> is kept for good, privately; an
2683
+ // older tab's gets the stale-tab answer — once the gate above let the session through, as the plain path.
2684
+ const mark = assetVersionMark(req);
2685
+ if (mark && !mark.current) {
2686
+ if (!existsSync(join(__dirname, "ui", fileName))) {
2687
+ json(res, 404, { error: "File not found" });
2688
+ return true;
2689
+ }
2690
+ answerStaleAsset(res, path);
2691
+ return true;
2692
+ }
2677
2693
  try {
2678
2694
  const js = readFileSync(join(__dirname, "ui", fileName), "utf-8");
2695
+ // A file rewritten under this running process is not what <V> named (an update or a rollback before its restart).
2696
+ if (mark && !assetIntact(fileName, js)) {
2697
+ answerStaleAsset(res, path);
2698
+ return true;
2699
+ }
2679
2700
  res.setHeader("Content-Type", "application/javascript; charset=utf-8");
2701
+ if (mark)
2702
+ res.setHeader("Cache-Control", IMMUTABLE_PRIVATE);
2680
2703
  // #2182: the route worker's own, narrower-reaching policy (ROUTE_WORKER_CSP); every other file keeps the page's.
2681
2704
  if (path === ROUTE_WORKER_PATH)
2682
2705
  res.setHeader("Content-Security-Policy", ROUTE_WORKER_CSP);
@@ -4245,7 +4268,7 @@ export function handleWebRequest(req, res, url, ctx) {
4245
4268
  return handleBrowserBackendSignIns(req, res, url, ctx);
4246
4269
  if (path === "/ui/backend-login" || path.startsWith("/ui/backend-login/"))
4247
4270
  return handleBackendLogin(req, res, url, ctx, path, method);
4248
- if (path === "/ui/host-install" || path === "/ui/host-install/cancel" || path === "/ui/host-update")
4271
+ if (path === "/ui/host-install" || path === "/ui/host-install/cancel" || HOST_CLI_PATHS.has(path))
4249
4272
  return handleHostInstall(req, res, url, ctx, path, method);
4250
4273
  // #3292: before the accounts prefix — its Add pattern (`POST /ui/accounts/<backend>`) would read "keep-alive" as a backend.
4251
4274
  if (path === "/ui/accounts/keep-alive")
@@ -5822,6 +5845,7 @@ function handleSendMessage(req, res, ctx) {
5822
5845
  // A claimed clientId is settled however this ends: with the messageId once accepted, else forgotten.
5823
5846
  let claim;
5824
5847
  let acceptedId = null;
5848
+ let tellPasted; // #4145: the pasted-token line, after this message's own (whatever the send's end)
5825
5849
  try {
5826
5850
  const raw = JSON.parse(body);
5827
5851
  const parsed = SendMessageSchema.safeParse(raw);
@@ -5830,7 +5854,17 @@ function handleSendMessage(req, res, ctx) {
5830
5854
  json(res, 400, { error: `${issue.path.join(".") || "body"}: ${issue.message}` });
5831
5855
  return;
5832
5856
  }
5833
- const { instance, message: typed, attachments = [], replyTo, clientId } = parsed.data;
5857
+ const { instance, message: sent, attachments = [], replyTo, clientId } = parsed.data;
5858
+ // #4145: this fleet's sign-in access token pasted here is hidden before it goes anywhere (the agent, the chat's
5859
+ // history, the topic's copy, the activity log), and taken back at once — a new one goes privately.
5860
+ const pasted = ctx.screenLoginToken?.(sent) ?? null;
5861
+ const typed = pasted?.text ?? sent;
5862
+ const pastedNotice = pasted?.live ? (ctx.loginTokenPasted?.() ?? Promise.resolve(null)).catch(() => null) : null;
5863
+ if (pastedNotice)
5864
+ tellPasted = () => void pastedNotice.then(notice => {
5865
+ if (notice)
5866
+ ctx.emitSseEvent("message", { instance, role: "status", sender: "AgEnD", text: notice, ts: new Date().toISOString(), messageId: newWebMessageId() });
5867
+ });
5834
5868
  const native = isWindowsInstance(ctx.fleetConfig?.instances[instance]);
5835
5869
  if (native && !nativeCliAuthorization(req, new URL(req.url ?? "/", "http://localhost"), ctx)) {
5836
5870
  json(res, 403, { error: "Windows runtime requires an administrator on the local dashboard" });
@@ -6074,6 +6108,7 @@ function handleSendMessage(req, res, ctx) {
6074
6108
  }
6075
6109
  finally {
6076
6110
  claim?.settle(acceptedId);
6111
+ tellPasted?.();
6077
6112
  }
6078
6113
  });
6079
6114
  }
@@ -6566,6 +6601,40 @@ export function serveHubWorkspaceShell(res, hub) {
6566
6601
  * The app shell page. `opts.hubWorkspace`: the page is a Hub's own workspace (slice 1's Hub listener only — the fleet's
6567
6602
  * listener never passes it), so it is drawn as the Hub shell.
6568
6603
  */
6604
+ let moduleGraphMemo = null;
6605
+ /** M-3314: the served modules' static imports, read once per process (its files do not change under it). */
6606
+ export function appModuleGraph() { return moduleGraphMemo ??= buildModuleGraph(join(__dirname, "ui"), servedAssets()); }
6607
+ /** M-3314: the module each panel's route loads (app.js's own dynamic imports). */
6608
+ export const PANEL_MODULES = {
6609
+ chat: "/ui/js/panel-chat.js", fleet: "/ui/js/panel-fleet.js", settings: "/ui/js/panel-settings.js", needs: "/ui/js/panel-needs.js",
6610
+ details: "/ui/js/panel-details.js", log: "/ui/js/panel-log.js", notices: "/ui/js/panel-notices.js", "windows-agent": "/ui/js/panel-windows-agent.js",
6611
+ view: "/assets/panel-view.js",
6612
+ };
6613
+ /**
6614
+ * M-3314: what this load of the shell imports, statically or as app.js boots it, so it can be asked for in one wave:
6615
+ * app.js; for a signed-in page the chat (always booted) and the panel of the route; for an admin's page also what
6616
+ * app.js loads for every admin (backend sign-in, agent proposals) and, with the chat workspace, its modules. Nothing a
6617
+ * page of that kind would not load anyway — a guest's or a reader's page preloads only what it imports itself.
6618
+ */
6619
+ export function shellPreload(mode, guest, path, workspace) {
6620
+ const graph = appModuleGraph();
6621
+ const entries = ["/assets/app.js"];
6622
+ const route = shellRoute("GET", path);
6623
+ const panel = route?.kind === "shell" ? route.route.panel : null;
6624
+ if (panel === "view")
6625
+ entries.push(PANEL_MODULES.view);
6626
+ if (mode === "full") {
6627
+ entries.push(PANEL_MODULES.chat);
6628
+ if (!guest) {
6629
+ if (panel && panel !== "chat" && panel !== "view" && PANEL_MODULES[panel])
6630
+ entries.push(PANEL_MODULES[panel]);
6631
+ entries.push("/ui/js/backend-signin.js", "/ui/js/agent-proposals.js");
6632
+ if (workspace)
6633
+ entries.push("/ui/js/chat-workspace.js", PANEL_MODULES.details, PANEL_MODULES.log, PANEL_MODULES.view);
6634
+ }
6635
+ }
6636
+ return staticClosure(graph, entries);
6637
+ }
6569
6638
  export function serveAppShell(req, res, ctx, mode, opts = {}) {
6570
6639
  // A Hub workspace is drawn from nothing of this fleet's: no fleet cookie, session, preference or preview is read.
6571
6640
  if (opts.hubWorkspace) {
@@ -6592,7 +6661,15 @@ export function serveAppShell(req, res, ctx, mode, opts = {}) {
6592
6661
  const fileViewer = own ? evaluateWebRequest(req, new URL(req.url ?? "/", "http://localhost"), ctx.webToken ?? null, ctx.webSessions, { touch: false }) : null;
6593
6662
  const fileFrame = own && fileViewer?.kind === "allow" && fileViewer.via === "session" && fileViewer.session.tier === "admin" ? `${own}/ui/reply-preview` : null;
6594
6663
  const frameSrc = [previewFrames, fileFrame].filter(Boolean).join(" ");
6595
- sendPanelHtml(res, withAppIconLinks(html).replace('<html lang="en">', shellHtmlTag(ctx, mode, viewer)).replace("<body>", shellBodyTag(req, ctx, mode, viewer)), 200, {}, { ...(frameSrc ? { frameSrc } : {}), mediaSrc });
6664
+ const bodyTag = shellBodyTag(req, ctx, mode, viewer);
6665
+ const page = withAppIconLinks(html).replace('<html lang="en">', shellHtmlTag(ctx, mode, viewer)).replace("<body>", bodyTag);
6666
+ // M-3314: the shell's files under this version, and the modules this load will import preloaded at once.
6667
+ const guest = mode === "full" && !!viewer?.guest;
6668
+ const preload = shellPreload(mode, guest, new URL(req.url ?? "/", "http://localhost").pathname, bodyTag.includes('data-chat-workspace="1"'));
6669
+ // Only while the files are still the ones <V> names: between an update's install and its restart the shell is the
6670
+ // plain one (no-store files, as before this change), never one that names <V> over files it does not describe.
6671
+ const shell = assetsUnchanged() ? versionShell(page, assetVersion(), preload, mode === "full" && !guest ? appModuleGraph() : undefined) : page;
6672
+ sendPanelHtml(res, shell, 200, {}, { ...(frameSrc ? { frameSrc } : {}), mediaSrc });
6596
6673
  }
6597
6674
  catch {
6598
6675
  json(res, 500, { error: "app.html not found" });