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

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 (80) hide show
  1. package/dist/auth-api.js +5 -0
  2. package/dist/auth-api.js.map +1 -1
  3. package/dist/backend/codex.js +11 -0
  4. package/dist/backend/codex.js.map +1 -1
  5. package/dist/backend/types.d.ts +1 -1
  6. package/dist/build-provenance.json +1 -1
  7. package/dist/daemon.d.ts +8 -1
  8. package/dist/daemon.js +34 -7
  9. package/dist/daemon.js.map +1 -1
  10. package/dist/dispatcher-liveness.js +2 -2
  11. package/dist/dispatcher-liveness.js.map +1 -1
  12. package/dist/fleet-manager.d.ts +5 -0
  13. package/dist/fleet-manager.js +21 -1
  14. package/dist/fleet-manager.js.map +1 -1
  15. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +7 -0
  16. package/dist/instance-lifecycle.d.ts +3 -0
  17. package/dist/instance-lifecycle.js +7 -3
  18. package/dist/instance-lifecycle.js.map +1 -1
  19. package/dist/locale.js +6 -0
  20. package/dist/locale.js.map +1 -1
  21. package/dist/needs-you.d.ts +5 -1
  22. package/dist/needs-you.js +4 -0
  23. package/dist/needs-you.js.map +1 -1
  24. package/dist/office-share-page.js +1 -1
  25. package/dist/office-share-page.js.map +1 -1
  26. package/dist/outbound-handlers.js +2 -0
  27. package/dist/outbound-handlers.js.map +1 -1
  28. package/dist/pause-marker.d.ts +1 -1
  29. package/dist/pause-marker.js +1 -1
  30. package/dist/pause-marker.js.map +1 -1
  31. package/dist/public-web-gateway.d.ts +20 -0
  32. package/dist/public-web-gateway.js +61 -4
  33. package/dist/public-web-gateway.js.map +1 -1
  34. package/dist/ui/accounts-keepalive.js +2 -1
  35. package/dist/ui/accounts-view.js +2 -1
  36. package/dist/ui/fleet-canvas.js +3 -1
  37. package/dist/ui/fleet-office-skin.js +4 -3
  38. package/dist/ui/fleet-route.js +44 -6
  39. package/dist/ui/fleet-task-view.js +2 -1
  40. package/dist/ui/host-install.js +5 -2
  41. package/dist/ui/hub-ai-apps.js +2 -1
  42. package/dist/ui/hub-chat-strings.js +2 -1
  43. package/dist/ui/hub-grant-picker.js +2 -1
  44. package/dist/ui/hub-group-strings.js +2 -1
  45. package/dist/ui/hub-my-agents.js +2 -1
  46. package/dist/ui/hub-owner-strings.js +2 -1
  47. package/dist/ui/hub-personal-agent.js +2 -1
  48. package/dist/ui/hub-quota.js +2 -1
  49. package/dist/ui/hub-roles-strings.js +2 -1
  50. package/dist/ui/hub-room-new-strings.js +2 -1
  51. package/dist/ui/hub-room-source.js +2 -1
  52. package/dist/ui/hub-strings.js +2 -1
  53. package/dist/ui/hub-teams.js +2 -1
  54. package/dist/ui/model-picker.js +3 -2
  55. package/dist/ui/panel-chat.js +6 -2
  56. package/dist/ui/panel-hub.js +7 -3
  57. package/dist/ui/panel-needs.js +3 -2
  58. package/dist/ui/panel-runtimes.js +2 -1
  59. package/dist/ui/reply-file-preview.js +2 -1
  60. package/dist/ui/settings-access-overview.js +2 -1
  61. package/dist/ui/settings-connector.js +2 -1
  62. package/dist/ui/shared/agent-sheet.js +2 -1
  63. package/dist/ui/shared/app-i18n.js +2 -2
  64. package/dist/ui/shared/app-shell.js +33 -9
  65. package/dist/ui/shared/app.css +11 -0
  66. package/dist/ui/shared/asset-url.d.ts +2 -0
  67. package/dist/ui/shared/asset-url.js +20 -0
  68. package/dist/ui/shared/chat-table-select.js +175 -0
  69. package/dist/ui/shared/image-annotate.js +2 -1
  70. package/dist/ui/shared/ui-states.js +3 -2
  71. package/dist/ui/shared/view-history.js +2 -1
  72. package/dist/ui/subagent-row.js +3 -2
  73. package/dist/ui/usage-pool.js +2 -1
  74. package/dist/ui/workspace-panel.js +2 -1
  75. package/dist/wake-coordinator.js +3 -2
  76. package/dist/wake-coordinator.js.map +1 -1
  77. package/dist/web-api.js +1 -1
  78. package/dist/web-api.js.map +1 -1
  79. package/dist/web-host-install.d.ts +1 -1
  80. package/package.json +1 -1
@@ -3,6 +3,7 @@ import { html, render } from "/assets/app-html.js";
3
3
  import { Icon } from "/assets/ui-icons.js";
4
4
  import { toast } from "/assets/ui-toast.js";
5
5
  import { hsource } from "./hub-room-source-strings.js";
6
+ import { assetUrl } from "/assets/asset-url.js";
6
7
 
7
8
  export function roomSource(author) {
8
9
  if (!author) return null;
@@ -18,7 +19,7 @@ export function RoomSourceMark({ source, decorative = false }) {
18
19
  if (!source) return null;
19
20
  return html`<span class="hub-source-mark" data-room-source=${source.kind} role=${decorative ? undefined : "img"}
20
21
  aria-hidden=${decorative ? "true" : undefined} aria-label=${decorative ? undefined : source.label} title=${source.label}>
21
- ${source.kind === "agend" ? html`<img src="/assets/agend-mark.svg" width="16" height="16" alt="" aria-hidden="true" />` : html`<${Icon} name="view" size=${16} />`}
22
+ ${source.kind === "agend" ? html`<img src=${assetUrl("/assets/agend-mark.svg")} width="16" height="16" alt="" aria-hidden="true" />` : html`<${Icon} name="view" size=${16} />`}
22
23
  </span>`;
23
24
  }
24
25
 
@@ -2,6 +2,7 @@
2
2
  // A lazy module of its own: loaded only with a Hub page or card, never while the Hub is off. It imports only names every
3
3
  // shell has had since #1408 (register / t), so a tab opened before an upgrade loads it as fresh as the rest.
4
4
  import { register, t } from "/assets/app-i18n.js";
5
+ import { assetUrl } from "/assets/asset-url.js";
5
6
 
6
7
  register("hub", {
7
8
  en: {
@@ -172,7 +173,7 @@ export function linkHubCss(doc = typeof document !== "undefined" ? document : nu
172
173
  try {
173
174
  if (!doc || !doc.head || doc.querySelector('link[data-hub-css="1"]')) return;
174
175
  const link = doc.createElement("link");
175
- link.setAttribute("rel", "stylesheet"); link.setAttribute("href", "/assets/hub.css"); link.setAttribute("data-hub-css", "1");
176
+ link.setAttribute("rel", "stylesheet"); link.setAttribute("href", assetUrl("/assets/hub.css")); link.setAttribute("data-hub-css", "1");
176
177
  doc.head.appendChild(link);
177
178
  } catch { /* the pages still work without it */ }
178
179
  }
@@ -3,6 +3,7 @@ import { html, useEffect, useRef, useState } from "/assets/app-html.js";
3
3
  import { Icon } from "/assets/ui-icons.js";
4
4
  import { navigate } from "/assets/app-nav.js";
5
5
  import { ht } from "./hub-teams-strings.js";
6
+ import { assetUrl } from "/assets/asset-url.js";
6
7
 
7
8
  const changes = new Set();
8
9
  const changed = () => { for (const fn of changes) fn(); };
@@ -18,7 +19,7 @@ export function linkHubTeamsCss(doc = typeof document === "undefined" ? null : d
18
19
  if (!doc?.head) return Promise.resolve(false);
19
20
  if (cssLoads.has(doc)) return cssLoads.get(doc);
20
21
  const promise = new Promise(resolve => {
21
- const link = doc.createElement("link"); link.setAttribute("rel", "stylesheet"); link.setAttribute("href", "/assets/hub-teams.css");
22
+ const link = doc.createElement("link"); link.setAttribute("rel", "stylesheet"); link.setAttribute("href", assetUrl("/assets/hub-teams.css"));
22
23
  link.setAttribute("data-hub-teams-css", "1");
23
24
  link.addEventListener("load", () => resolve(true), { once: true });
24
25
  link.addEventListener("error", () => { link.remove(); cssLoads.delete(doc); resolve(false); }, { once: true });
@@ -4,14 +4,15 @@ import { register, t } from "/assets/app-i18n.js";
4
4
  import { Icon } from "/assets/ui-icons.js";
5
5
  import { ErrorState } from "/assets/ui-states.js";
6
6
  import * as catalogStore from "./settings-catalog.js";
7
+ import { assetUrl } from "/assets/asset-url.js";
7
8
  register("modelPicker", {
8
9
  en: { refresh: "Refresh models", refreshing: "Refreshing models…", refreshed: "Model list refreshed.", failed: "Could not refresh models. The previous list and selection are kept.", more: "More models…", backend: "Choose backend", model: "Choose model", next: "Choose a backend; next choose its model and reasoning effort.", current: "Selected", nativeFailed: "Could not refresh models on this computer. Update its Runtime if needed and check that its owner allows account access. The previous list and selection are kept.", keep: "Refreshing keeps the selected model.", selectionHint: "Refresh keeps your selection; choose a model to apply it.", accountSource: "Source: selected account’s model listing.", effort: "Choose reasoning effort", effortFor: "Choose the effort for {0}", effortAuto: "Auto" },
9
10
  "zh-TW": { refresh: "重新整理模型", refreshing: "正在重新整理模型…", refreshed: "模型清單已更新。", failed: "無法重新整理模型。已保留原清單與選擇。", more: "更多模型…", backend: "選擇後端", model: "選擇模型", next: "選擇後端;下一步選模型與推理強度", current: "已選擇", nativeFailed: "無法在這台電腦重新整理模型。請確認 Runtime 已更新,且電腦擁有者允許存取帳號;已保留原清單與選擇。", keep: "重新整理會保留已選模型。", selectionHint: "重新整理只更新清單;選擇模型才會套用。", accountSource: "來源:已選帳號的模型清單。", effort: "選擇推理強度", effortFor: "選擇 {0} 的推理強度", effortAuto: "自動" },
10
11
  });
11
12
  export const mw = (key, ...args) => t(`modelPicker.${key}`, ...args);
12
13
  export function modelPickerStyles() {
13
- if (typeof document === "undefined" || !document.head || document.querySelector('link[href="/assets/model-picker.css"]')) return;
14
- const link = document.createElement("link"); link.setAttribute("rel", "stylesheet"); link.setAttribute("href", "/assets/model-picker.css"); document.head.appendChild(link);
14
+ if (typeof document === "undefined" || !document.head || document.querySelector(`link[href="${assetUrl("/assets/model-picker.css")}"]`)) return;
15
+ const link = document.createElement("link"); link.setAttribute("rel", "stylesheet"); link.setAttribute("href", assetUrl("/assets/model-picker.css")); document.head.appendChild(link);
15
16
  }
16
17
  const answers = new Map(); // share only in-flight passive reads; the server owns catalog freshness
17
18
  export function forgetModelPickerCatalogs() { answers.clear(); catalogStore.forgetCatalogs?.(); }
@@ -60,6 +60,7 @@ import { applyTheme, clearAmbient, resolvedMode, themeFor, themeImageUrl, themeM
60
60
  import { colorMenuItem } from "/assets/identity-color.js";
61
61
  import { brokenPictures, cardFoldable, IdentityCard, useCard } from "/assets/identity-card.js";
62
62
  import { AgentWidget, instanceBinds, widgetFor } from "/assets/agent-widget.js";
63
+ import { assetUrl } from "/assets/asset-url.js";
63
64
  // #1629 r4 §1: the identity card under the chat's header — hidden by default; shown or not is this device's choice.
64
65
  // #2217 (the user, 2026-10-19): no row of its own; its picture and bio can be folded away (the banner stays) — this
65
66
  // device's choice too, kept the same way. The user (2026-10-20): no control on the card — one card button in the header
@@ -164,6 +165,7 @@ import { createThread, msgKey } from "/assets/chat-thread.js";
164
165
  import { ComposerInput, WorkBarView, touchScreen } from "/assets/chat-composer.js";
165
166
  import { installMessageActions } from "/assets/chat-msg-actions.js";
166
167
  import { composerCaret, insertQuote, installQuoteSelection, showCaret } from "./chat-quote.js";
168
+ import { installTableSelection } from "/assets/chat-table-select.js";
167
169
  import { createEmojiIndex } from "./chat-emojis.js";
168
170
  import { pollPublicPreview } from "./preview-status.js";
169
171
  import { createMentionIndex } from "./chat-mentions.js";
@@ -187,7 +189,7 @@ export function linkWorkBarCss(doc = typeof document !== "undefined" ? document
187
189
  try {
188
190
  if (!doc || !doc.head || doc.querySelector('link[data-chat-work-bar-css="1"]')) return;
189
191
  const link = doc.createElement("link");
190
- link.setAttribute("rel", "stylesheet"); link.setAttribute("href", "/assets/chat-work-bar.css"); link.setAttribute("data-chat-work-bar-css", "1");
192
+ link.setAttribute("rel", "stylesheet"); link.setAttribute("href", assetUrl("/assets/chat-work-bar.css")); link.setAttribute("data-chat-work-bar-css", "1");
191
193
  doc.head.appendChild(link);
192
194
  } catch { /* Stop still works without it */ }
193
195
  }
@@ -877,6 +879,8 @@ function Thread({ name, label = name, th, bindings }) {
877
879
  pinned: (x) => isPinned(name, msgKey(x)),
878
880
  canPin: (x) => !guestPage() && pinOffered(name) && (x.role === "agent" || x.role === "user") && /^[0-9a-f]{1,32}-\d{1,15}$/.test(msgKey(x)),
879
881
  });
882
+ // M-3326: a table's cells selected as a spreadsheet's (a desk: drag down a column or across a block; Ctrl/Cmd+C as TSV).
883
+ const offCells = installTableSelection(ls, { phone: () => typeof matchMedia === "function" && matchMedia("(pointer: coarse)").matches });
880
884
  // M-2789: select a passage in a message → 「引用」 → it goes into the composer as a quote at the caret, repeatable.
881
885
  const offQuote = installQuoteSelection(ls, {
882
886
  field: () => bindings.input.current,
@@ -923,7 +927,7 @@ function Thread({ name, label = name, th, bindings }) {
923
927
  return () => {
924
928
  window.removeEventListener("hashchange", onHash);
925
929
  unfollow();
926
- offActions(); offQuote();
930
+ offActions(); offQuote(); offCells();
927
931
  sc.removeEventListener("scroll", onScroll);
928
932
  ls.removeEventListener("click", thread.onClick);
929
933
  if (mountedThreads.get(name) === owner) mountedThreads.delete(name);
@@ -58,6 +58,8 @@ import { PageHead } from "/assets/page-head.js";
58
58
  import { bindRoomFeedback, bootHubPreview, downloadHtml, draftWithLine, panelOpenFor, roomPanelKey, roomPanelOpts, setHubPreviewOptIn } from "./hub-preview.js";
59
59
  import { DropOverlay, MAX_FILES, PendingFiles, hf, pageCarriesFiles, pasteToAttach, putBackText, roomTakesFiles, uploadChosen, useFileDrop } from "./hub-attachments.js";
60
60
  import { composerCaret, insertQuote, installQuoteSelection, showCaret } from "/assets/chat-quote.js";
61
+ import { installTableSelection } from "/assets/chat-table-select.js";
62
+ import { assetUrl } from "/assets/asset-url.js";
61
63
  register("hubAccess", {
62
64
  en: { tag: "Access needs checking", refused: "Asking was refused. Check your access before trying again.", check: "Check access", limited: "Asking was refused; the previous access information needs checking." },
63
65
  "zh-TW": { tag: "需要確認權限", refused: "提問遭到拒絕。請先重新檢查權限,再試一次。", check: "重新檢查權限", limited: "提問遭到拒絕,先前的權限資訊需要重新確認。" },
@@ -261,7 +263,7 @@ function linkHubSigninCss(doc = typeof document !== "undefined" ? document : nul
261
263
  try {
262
264
  if (!doc || !doc.head || doc.querySelector('link[data-hub-signin-css="1"]')) return;
263
265
  const link = doc.createElement("link");
264
- link.setAttribute("rel", "stylesheet"); link.setAttribute("href", "/assets/hub-signin.css"); link.setAttribute("data-hub-signin-css", "1");
266
+ link.setAttribute("rel", "stylesheet"); link.setAttribute("href", assetUrl("/assets/hub-signin.css")); link.setAttribute("data-hub-signin-css", "1");
265
267
  doc.head.appendChild(link);
266
268
  } catch { /* the page still works without it */ }
267
269
  }
@@ -935,8 +937,10 @@ function HubThread({ store, name, panelKey, threadRef, extra = null, emptyView =
935
937
  }, 0);
936
938
  },
937
939
  }) : () => {};
940
+ // M-3326: the Fleet chat's table cell selection (a desk; chat-table-select.js), in every Hub conversation.
941
+ const offCells = installTableSelection(list, { phone });
938
942
  return () => {
939
- offActions(); offQuote();
943
+ offActions(); offQuote(); offCells();
940
944
  paging = false;
941
945
  off(); offOpt(); offPanel(); sc.removeEventListener("scroll", onScroll); list.removeEventListener("click", thread.onClick);
942
946
  thread.dispose(true); list.remove(); th.current = null; if (threadRef && threadRef.current === thread) threadRef.current = null;
@@ -1008,7 +1012,7 @@ function HubMine() {
1008
1012
  useEffect(() => {
1009
1013
  linkHubChatCss(); linkHubOwnerCss();
1010
1014
  if (!document.querySelector('link[data-hub-sharing-css="1"]')) {
1011
- const link = document.createElement("link"); link.rel = "stylesheet"; link.href = "/assets/hub-sharing.css";
1015
+ const link = document.createElement("link"); link.rel = "stylesheet"; link.href = assetUrl("/assets/hub-sharing.css");
1012
1016
  link.setAttribute("data-hub-sharing-css", "1"); document.head.appendChild(link);
1013
1017
  }
1014
1018
  }, []);
@@ -32,8 +32,8 @@ import { HostDirectoryNotices, hostDirectoryNoticesOffered } from "./hub-host-se
32
32
 
33
33
  // A pre-upgrade tab retains app-i18n.js. Register these reasons when the updated panel is loaded, too.
34
34
  register("app", {
35
- en: { needs_reason_hub_proposal: "Hub action proposed: review locally", needs_reason_hub_execution_hold: "Hub work held: review locally", needs_reason_hub_unavailable: "Hub not running", needs_reason_tmux_hold: "Held: an old tmux server or window" },
36
- "zh-TW": { needs_reason_hub_proposal: "Hub 提議操作:請在本機檢視", needs_reason_hub_execution_hold: "Hub 工作已暫停:請在本機檢視", needs_reason_hub_unavailable: "Hub 未在執行", needs_reason_tmux_hold: "已暫停:舊的 tmux 伺服器或視窗" },
35
+ en: { needs_reason_stale_auth: "Codex needs a restart", needs_stale_auth_detail: "Codex cannot refresh this agent’s current sign-in. Restart the agent; sign in again only if Codex asks.", needs_reason_hub_proposal: "Hub action proposed: review locally", needs_reason_hub_execution_hold: "Hub work held: review locally", needs_reason_hub_unavailable: "Hub not running", needs_reason_tmux_hold: "Held: an old tmux server or window" },
36
+ "zh-TW": { needs_reason_stale_auth: "Codex 需要重新啟動", needs_stale_auth_detail: "Codex 無法更新這個 Agent 執行中使用的登入。請重新啟動 Agent;只有 Codex 要求時才需要重新登入。", needs_reason_hub_proposal: "Hub 提議操作:請在本機檢視", needs_reason_hub_execution_hold: "Hub 工作已暫停:請在本機檢視", needs_reason_hub_unavailable: "Hub 未在執行", needs_reason_tmux_hold: "已暫停:舊的 tmux 伺服器或視窗" },
37
37
  });
38
38
 
39
39
  register("needs", {
@@ -141,6 +141,7 @@ const BAD = new Set(["crashed", "delivery_failed", "hang", "exited"]);
141
141
  * its question or what it lacks; anything else is the server's own words.
142
142
  */
143
143
  function detailOf(item) {
144
+ if (item.reason === "stale_auth") return t("app.needs_stale_auth_detail");
144
145
  if (item.modelSwitch) return modelSwitchText(item.modelSwitch);
145
146
  const c = item.type === "task" ? item.card : null;
146
147
  if (!c || !c.title) return configDetail(item);
@@ -17,13 +17,14 @@ import { credentialProfileView, credentialProfileState } from "./credential-prof
17
17
  import { identityText } from "./account-identity.js";
18
18
  import { CliInstall, offersCliInstall } from "./runtime-cli-install.js";
19
19
  import { useWindowsCliCatalog, refreshWindowsCliCatalog, useWindowsCliCatalogSnapshot } from "./windows-cli-catalog.js";
20
+ import { assetUrl } from "/assets/asset-url.js";
20
21
 
21
22
  /** The install tabs', command cards' and account list's stylesheet, linked once by this lazy page (a tab opened before an upgrade has an app.css without these rules). */
22
23
  export function linkRuntimeInstallCss(doc = typeof document !== "undefined" ? document : null) {
23
24
  try {
24
25
  if (!doc || !doc.head || doc.querySelector('link[data-runtime-install-css="1"]')) return;
25
26
  const link = doc.createElement("link");
26
- link.setAttribute("rel", "stylesheet"); link.setAttribute("href", "/assets/runtime-install.css"); link.setAttribute("data-runtime-install-css", "1");
27
+ link.setAttribute("rel", "stylesheet"); link.setAttribute("href", assetUrl("/assets/runtime-install.css")); link.setAttribute("data-runtime-install-css", "1");
27
28
  doc.head.appendChild(link);
28
29
  } catch { /* the page still works, only plainer, without it */ }
29
30
  }
@@ -6,13 +6,14 @@ import { Skeleton } from "/assets/ui-states.js";
6
6
  import { WorkspaceFileViewer, linkWorkspaceCss } from "./workspace-panel.js";
7
7
  import { openReplyPreviewImage } from "/assets/image-lightbox.js";
8
8
  import { openReplyFile, openMarkdown, panelStore, closePanel } from "/assets/preview-panel.js";
9
+ import { assetUrl } from "/assets/asset-url.js";
9
10
  register("replyPreview", {
10
11
  en: { button: "Preview {0}", title: "File preview", loading: "Loading file", unoffered: "File previews are not available for this agent.", missing: "This file is no longer in the agent's working folder.", denied: "This preview needs an administrator session and a file inside this agent's working folder.", changed: "The session or working folder changed. Open the preview again.", failed: "The file could not be loaded. Try opening the preview again.", remote: "Previews of files on a paired Windows computer aren't available yet.", lines: "Requested lines: {0}–{1}", readonly: "Read only · current file in this agent's working folder", pdf: "PDF preview" },
11
12
  "zh-TW": { button: "預覽 {0}", title: "檔案預覽", loading: "正在載入檔案", unoffered: "這個 Agent 無法提供檔案預覽。", missing: "這個檔案已不在 Agent 的工作資料夾裡。", denied: "需要管理員登入,且檔案必須在這個 Agent 的工作資料夾裡,才能預覽。", changed: "登入或工作資料夾已變更,請重新開啟預覽。", failed: "無法載入檔案,請重新開啟預覽再試一次。", remote: "目前還無法預覽已配對 Windows 電腦上的檔案。", lines: "指定行數:{0}–{1}", readonly: "唯讀 · 這個 Agent 工作資料夾裡的目前檔案", pdf: "PDF 預覽" },
12
13
  });
13
14
  function linkReplyCss() {
14
15
  if (typeof document === "undefined" || document.querySelector('link[data-reply-preview-css]')) return;
15
- const link = document.createElement("link"); link.rel = "stylesheet"; link.href = "/assets/reply-previews.css"; link.dataset.replyPreviewCss = "1"; document.head.append(link);
16
+ const link = document.createElement("link"); link.rel = "stylesheet"; link.href = assetUrl("/assets/reply-previews.css"); link.dataset.replyPreviewCss = "1"; document.head.append(link);
16
17
  }
17
18
  linkReplyCss();
18
19
  export const replyPreviewLabel = p => t("replyPreview.button", p.path + (p.line ? `:${p.line}${p.endLine && p.endLine !== p.line ? `–${p.endLine}` : ""}` : ""));
@@ -14,6 +14,7 @@ import { sectionPath } from "/assets/app-route.js";
14
14
  import { api } from "./settings-confirm.js";
15
15
  import { agoWords } from "./settings-devices.js";
16
16
  import { roleName } from "/assets/device-roles.js";
17
+ import { assetUrl } from "/assets/asset-url.js";
17
18
 
18
19
  register("accessov", {
19
20
  en: {
@@ -67,7 +68,7 @@ export function linkAccessOverviewCss(doc = typeof document !== "undefined" ? do
67
68
  try {
68
69
  if (!doc || !doc.head || doc.querySelector('link[data-access-overview-css="1"]')) return;
69
70
  const link = doc.createElement("link");
70
- link.setAttribute("rel", "stylesheet"); link.setAttribute("href", "/assets/access-overview.css"); link.setAttribute("data-access-overview-css", "1");
71
+ link.setAttribute("rel", "stylesheet"); link.setAttribute("href", assetUrl("/assets/access-overview.css")); link.setAttribute("data-access-overview-css", "1");
71
72
  doc.head.appendChild(link);
72
73
  } catch { /* the page still works without it */ }
73
74
  }
@@ -3,6 +3,7 @@ import { t } from "/assets/app-i18n.js";
3
3
  import { useLease } from "/assets/app-ctx.js";
4
4
  import { connectorPrompt } from "/assets/connector-prompt.js";
5
5
  import "./settings-connector-strings.js";
6
+ import { assetUrl } from "/assets/asset-url.js";
6
7
  const tr = key => t(`connector.${key}`);
7
8
  export function SettingsConnector() {
8
9
  const lease = useLease("settings-connector");
@@ -23,7 +24,7 @@ export function SettingsConnector() {
23
24
  try { await navigator.clipboard.writeText(prompt); if (lease.current()) setNotice("copied"); }
24
25
  catch { if (lease.current()) setNotice("failed"); }
25
26
  };
26
- return html`<section class="card s-group s-connector" id="connector"><link rel="stylesheet" href="/assets/settings-connector.css" /><div><h3>${tr("title")}</h3><p class="note">${tr("hint")}</p></div>
27
+ return html`<section class="card s-group s-connector" id="connector"><link rel="stylesheet" href=${assetUrl("/assets/settings-connector.css")} /><div><h3>${tr("title")}</h3><p class="note">${tr("hint")}</p></div>
27
28
  <p class="note">${tr("scope")}</p>
28
29
  ${error ? html`<button class="btn s-connector-action" type="button" onClick=${read}>${tr("retry")}</button>`
29
30
  : !info ? html`<p role="status">${tr("loading")}</p>`
@@ -20,6 +20,7 @@ import { Icon } from "./ui-icons.js";
20
20
  import { setTextSize, textSizeStore, TEXT_SIZES, usageOffered } from "./header-tools.js";
21
21
  import { UsageDialog } from "./usage-dialog.js";
22
22
  import { supportsInstanceFeature } from "./instance-nav.js";
23
+ import { assetUrl } from "./asset-url.js";
23
24
 
24
25
  register("agentSheet", {
25
26
  en: { sheet: "{0}: more", search: "Search", files: "Files & changes", card: "Card", usage: "Usage", model: "Model & effort", backend: "CLI backend",
@@ -36,7 +37,7 @@ register("agentSheet", {
36
37
  try {
37
38
  if (typeof document === "undefined" || !document.head || document.querySelector('link[data-chat-work-bar-css="1"]')) return;
38
39
  const link = document.createElement("link");
39
- link.setAttribute("rel", "stylesheet"); link.setAttribute("href", "/assets/chat-work-bar.css"); link.setAttribute("data-chat-work-bar-css", "1");
40
+ link.setAttribute("rel", "stylesheet"); link.setAttribute("href", assetUrl("/assets/chat-work-bar.css")); link.setAttribute("data-chat-work-bar-css", "1");
40
41
  document.head.appendChild(link);
41
42
  } catch { /* the header keeps its desk look */ }
42
43
  })();
@@ -119,7 +119,7 @@ register("app", {
119
119
  confirmTitle: "Please confirm", confirmOk: "Continue", cancel: "Cancel",
120
120
  sidePanelLeave: "Leave {0} without saving? Your changes there will be lost.", sidePanelDiscard: "Discard changes",
121
121
  // The server's own wording (src/locale.ts needs.reason.*), so the web says what Discord says.
122
- needs_reason_kiro_choice: "Kiro needs your decision", needs_reason_hang: "Not responding", needs_reason_exited: "Exited", needs_reason_assist: "Waiting at its terminal", needs_reason_question: "Asking you a question", needs_reason_permission: "Permission needed", needs_reason_dangerous_command: "Dangerous command waiting", needs_reason_login: "Waiting to connect its AI account", needs_reason_dialog: "Waiting at a dialog", needs_reason_terminal_input: "May be waiting for input", needs_reason_auth_paused: "Paused: AI account not connected", needs_reason_backend_signin: "AI account needs connecting", needs_reason_config_invalid: "Configuration file needs attention", needs_reason_hub_proposal: "Hub action proposed: review locally", needs_reason_hub_execution_hold: "Hub work held: review locally", needs_reason_hub_unavailable: "Hub not running", needs_reason_config_fallback: "Running on stored configuration", config_history_edit: "{0}, line {1}, column {2}: {3}. AgEnD is still running on the previous settings. The next restart would use the stored valid copy from {4}. Correct the YAML error; the file has not been changed by AgEnD.", config_history_no_history: "{0}, line {1}, column {2}: {3}. AgEnD is still running on the previous settings. No stored valid copy is available, so the next restart cannot recover automatically. Correct the YAML error before restarting; the file has not been changed by AgEnD.", config_history_fallback: "{0}, line {1}, column {2}: {3}. AgEnD started using the stored valid copy from {4}. Correct the YAML error and reload the settings. The file on disk has not been changed by AgEnD.", needs_reason_general_windows_offline: "General’s Windows PC is offline", needs_reason_general_location_hold: "Run General on", needs_reason_native_pane_hold: "Windows agent needs attention", needs_reason_model_switch: "Claude model switched", needs_reason_crashed: "Crashed", needs_reason_backend_missing: "AI CLI not installed", needs_reason_usage_limit: "Usage limit reached · reset time unknown", needs_reason_delivery_uncertain: "Could not confirm delivery", needs_reason_delivery_failed: "Delivery failed", needs_reason_missed_offline: "Missed while AgEnD was offline", needs_reason_task_review: "Waiting for your confirmation", needs_reason_task_blocked: "Blocked: asks you", needs_reason_task_stalled: "Its assignee went quiet",
122
+ needs_reason_kiro_choice: "Kiro needs your decision", needs_reason_hang: "Not responding", needs_reason_exited: "Exited", needs_reason_assist: "Waiting at its terminal", needs_reason_question: "Asking you a question", needs_reason_permission: "Permission needed", needs_reason_dangerous_command: "Dangerous command waiting", needs_reason_login: "Waiting to connect its AI account", needs_reason_dialog: "Waiting at a dialog", needs_reason_terminal_input: "May be waiting for input", needs_reason_auth_paused: "Paused: AI account not connected", needs_reason_stale_auth: "Codex needs a restart", needs_stale_auth_detail: "Codex cannot refresh this agent’s current sign-in. Restart the agent; sign in again only if Codex asks.", needs_reason_backend_signin: "AI account needs connecting", needs_reason_config_invalid: "Configuration file needs attention", needs_reason_hub_proposal: "Hub action proposed: review locally", needs_reason_hub_execution_hold: "Hub work held: review locally", needs_reason_hub_unavailable: "Hub not running", needs_reason_config_fallback: "Running on stored configuration", config_history_edit: "{0}, line {1}, column {2}: {3}. AgEnD is still running on the previous settings. The next restart would use the stored valid copy from {4}. Correct the YAML error; the file has not been changed by AgEnD.", config_history_no_history: "{0}, line {1}, column {2}: {3}. AgEnD is still running on the previous settings. No stored valid copy is available, so the next restart cannot recover automatically. Correct the YAML error before restarting; the file has not been changed by AgEnD.", config_history_fallback: "{0}, line {1}, column {2}: {3}. AgEnD started using the stored valid copy from {4}. Correct the YAML error and reload the settings. The file on disk has not been changed by AgEnD.", needs_reason_general_windows_offline: "General’s Windows PC is offline", needs_reason_general_location_hold: "Run General on", needs_reason_native_pane_hold: "Windows agent needs attention", needs_reason_model_switch: "Claude model switched", needs_reason_crashed: "Crashed", needs_reason_backend_missing: "AI CLI not installed", needs_reason_usage_limit: "Usage limit reached · reset time unknown", needs_reason_delivery_uncertain: "Could not confirm delivery", needs_reason_delivery_failed: "Delivery failed", needs_reason_missed_offline: "Missed while AgEnD was offline", needs_reason_task_review: "Waiting for your confirmation", needs_reason_task_blocked: "Blocked: asks you", needs_reason_task_stalled: "Its assignee went quiet",
123
123
  },
124
124
  "zh-TW": {
125
125
  brand: "AgEnD", fleet: "Fleet", fleetOverview: "Fleet 概覽", view: "檢視", settings: "設定", instances: "Agent", newInstance: "新增 Agent", newAgent: "新增 Agent",
@@ -167,6 +167,6 @@ register("app", {
167
167
  search: "搜尋", searchTitle: "搜尋聊天、agent 之間的訊息與任務({0})",
168
168
  confirmTitle: "請確認", confirmOk: "繼續", cancel: "取消",
169
169
  sidePanelLeave: "不儲存就離開「{0}」?你在那裡的修改會遺失。", sidePanelDiscard: "捨棄修改",
170
- needs_reason_kiro_choice: "Kiro 需要你決定", needs_reason_hang: "沒有回應", needs_reason_exited: "已結束", needs_reason_assist: "在終端機上等待", needs_reason_question: "正在問你問題", needs_reason_permission: "需要權限", needs_reason_dangerous_command: "危險指令待確認", needs_reason_login: "等待連接 AI 帳號", needs_reason_dialog: "停在對話框", needs_reason_terminal_input: "可能在等輸入", needs_reason_auth_paused: "已暫停:AI 帳號未連接", needs_reason_backend_signin: "需要連接 AI 帳號", needs_reason_config_invalid: "設定檔需要處理", needs_reason_hub_proposal: "Hub 提議操作:請在本機檢視", needs_reason_hub_execution_hold: "Hub 工作已暫停:請在本機檢視", needs_reason_hub_unavailable: "Hub 未在執行", needs_reason_config_fallback: "正在使用儲存的設定副本", config_history_edit: "{0} 第 {1} 行、第 {2} 欄:{3}。AgEnD 仍使用先前的設定執行。下次重新啟動會改用 {4} 儲存的有效副本。請修正 YAML 錯誤;AgEnD 未更動此檔案。", config_history_no_history: "{0} 第 {1} 行、第 {2} 欄:{3}。AgEnD 仍使用先前的設定執行。沒有可用的有效副本,下次重新啟動將無法自動恢復。請在重新啟動前修正 YAML 錯誤;AgEnD 未更動此檔案。", config_history_fallback: "{0} 第 {1} 行、第 {2} 欄:{3}。AgEnD 已使用 {4} 儲存的有效副本啟動。請修正 YAML 錯誤並重新載入設定。AgEnD 未更動磁碟上的檔案。", needs_reason_general_windows_offline: "General 所在的 Windows 電腦已離線", needs_reason_general_location_hold: "General 執行位置", needs_reason_native_pane_hold: "Windows Agent 需要處理", needs_reason_model_switch: "Claude 模型已切換", needs_reason_crashed: "已崩潰", needs_reason_backend_missing: "AI CLI 沒有安裝", needs_reason_usage_limit: "用量已達上限 · 恢復時間未知", needs_reason_delivery_uncertain: "無法確認是否送達", needs_reason_delivery_failed: "傳送失敗", needs_reason_missed_offline: "AgEnD 離線時錯過", needs_reason_task_review: "等你確認", needs_reason_task_blocked: "卡住,在問你", needs_reason_task_stalled: "接手者很久沒有動靜",
170
+ needs_reason_kiro_choice: "Kiro 需要你決定", needs_reason_hang: "沒有回應", needs_reason_exited: "已結束", needs_reason_assist: "在終端機上等待", needs_reason_question: "正在問你問題", needs_reason_permission: "需要權限", needs_reason_dangerous_command: "危險指令待確認", needs_reason_login: "等待連接 AI 帳號", needs_reason_dialog: "停在對話框", needs_reason_terminal_input: "可能在等輸入", needs_reason_auth_paused: "已暫停:AI 帳號未連接", needs_reason_stale_auth: "Codex 需要重新啟動", needs_stale_auth_detail: "Codex 無法更新這個 Agent 執行中使用的登入。請重新啟動 Agent;只有 Codex 要求時才需要重新登入。", needs_reason_backend_signin: "需要連接 AI 帳號", needs_reason_config_invalid: "設定檔需要處理", needs_reason_hub_proposal: "Hub 提議操作:請在本機檢視", needs_reason_hub_execution_hold: "Hub 工作已暫停:請在本機檢視", needs_reason_hub_unavailable: "Hub 未在執行", needs_reason_config_fallback: "正在使用儲存的設定副本", config_history_edit: "{0} 第 {1} 行、第 {2} 欄:{3}。AgEnD 仍使用先前的設定執行。下次重新啟動會改用 {4} 儲存的有效副本。請修正 YAML 錯誤;AgEnD 未更動此檔案。", config_history_no_history: "{0} 第 {1} 行、第 {2} 欄:{3}。AgEnD 仍使用先前的設定執行。沒有可用的有效副本,下次重新啟動將無法自動恢復。請在重新啟動前修正 YAML 錯誤;AgEnD 未更動此檔案。", config_history_fallback: "{0} 第 {1} 行、第 {2} 欄:{3}。AgEnD 已使用 {4} 儲存的有效副本啟動。請修正 YAML 錯誤並重新載入設定。AgEnD 未更動磁碟上的檔案。", needs_reason_general_windows_offline: "General 所在的 Windows 電腦已離線", needs_reason_general_location_hold: "General 執行位置", needs_reason_native_pane_hold: "Windows Agent 需要處理", needs_reason_model_switch: "Claude 模型已切換", needs_reason_crashed: "已崩潰", needs_reason_backend_missing: "AI CLI 沒有安裝", needs_reason_usage_limit: "用量已達上限 · 恢復時間未知", needs_reason_delivery_uncertain: "無法確認是否送達", needs_reason_delivery_failed: "傳送失敗", needs_reason_missed_offline: "AgEnD 離線時錯過", needs_reason_task_review: "等你確認", needs_reason_task_blocked: "卡住,在問你", needs_reason_task_stalled: "接手者很久沒有動靜",
171
171
  },
172
172
  });
@@ -1317,7 +1317,22 @@ export function Shell({ panels, onNewInstance, viewOnly = false }) {
1317
1317
  let composedAt = -Infinity, pendH = 0, pendTop = 0;
1318
1318
  const now = () => (typeof performance !== "undefined" ? performance.now() : Date.now());
1319
1319
  const frame = typeof requestAnimationFrame === "function" ? requestAnimationFrame : null;
1320
- const unfit = (el) => { if (el?.style) { el.style.removeProperty("height"); el.style.removeProperty("transform"); } };
1320
+ // M-3327 (the user's iPhone recording, beta.11): the shell no longer chases the browser's pan with translateY(offsetTop).
1321
+ // iOS animates its pan (to show the box) and takes it back once the shell is the view's height; the transform followed
1322
+ // the readings, not the pan on screen, so the header dropped to mid-screen over a black band, the box was pushed under
1323
+ // the keyboard (which panned again: a runaway), then everything snapped back. The shell stays at the top, the view's
1324
+ // height, and a pan is undone (scrollTo 0) — the box is in view without one.
1325
+ const unpan = (top) => { if (top > 0 && typeof window.scrollTo === "function") { try { window.scrollTo(0, 0); } catch { /* not scrollable */ } } };
1326
+ // M-3327: the keyboard going away (the field left for something that is not a text field): iOS reports the taller view
1327
+ // only once the keyboard has gone (~350 ms), so following the view held the box mid-air over the page's background, then
1328
+ // dropped it in one frame. Now the shell takes its full height (the tallest view at this width) at the focusout, easing
1329
+ // down (data-kb-closing: app.css) while the keyboard slides away over it (the keyboard state is down already: no field).
1330
+ // The ease lasts its own time once started (CLOSE_MS ≥ app.css's 0.26 s), whenever iOS's late reading comes: taking the
1331
+ // attribute away mid-way would cut the transition short (a snap) — so the result never depends on the event order.
1332
+ const CLOSE_MS = 320;
1333
+ let leaving = false, closingUntil = 0;
1334
+ const closing = (el, on) => { if (el?.setAttribute) { if (on) el.setAttribute("data-kb-closing", ""); else el.removeAttribute("data-kb-closing"); } };
1335
+ const unfit = (el) => { if (el?.style) { el.style.removeProperty("height"); el.style.removeProperty("transform"); } closing(el, false); closingUntil = 0; };
1321
1336
  const fit = () => {
1322
1337
  const el = root.current;
1323
1338
  if (!el?.style) return;
@@ -1335,16 +1350,15 @@ export function Shell({ panels, onNewInstance, viewOnly = false }) {
1335
1350
  const h = composingNow && fitH && w === fitW && seen > fitH ? fitH : seen;
1336
1351
  const settled = fitH && typingNow && w === fitW && now() >= followUntil;
1337
1352
  if (settled && Math.abs(h - fitH) <= NUDGE_PX && Math.abs(top - fitTop) <= NUDGE_PX) { moveSince = 0; return; } // a nudge
1338
- if (settled && (h !== fitH || top !== fitTop) && !(fitH - h > KEYBOARD_MIN_PX)) {
1353
+ // M-3327: a pan of a keyboard's height is the keyboard coming up (a tap on a box that already had the focus: no focus
1354
+ // event, so no follow window), never a key's nudge — undone at once, like the keyboard's own height.
1355
+ if (settled && (h !== fitH || top !== fitTop) && !(fitH - h > KEYBOARD_MIN_PX) && !(top - fitTop > KEYBOARD_MIN_PX)) {
1339
1356
  if (!moveSince || Math.abs(h - pendH) > NUDGE_PX || Math.abs(top - pendTop) > NUDGE_PX) { moveSince = now(); pendH = h; pendTop = top; }
1340
1357
  const held = DOWN_HOLD_MS - (now() - moveSince);
1341
1358
  const growWait = h > fitH && h - fitH <= KEYBOARD_MIN_PX ? composedAt + IME_GROW_HOLD_MS - now() : 0;
1342
1359
  if (held > 0 || growWait > 0) { // not held yet: the shell stays as it is
1343
1360
  // Held, but a grow after a composition still waits: the place (a pan) is followed now, the height later.
1344
- if (held <= 0 && Math.abs(top - fitTop) > NUDGE_PX) {
1345
- fitTop = top;
1346
- if (top) el.style.setProperty("transform", `translateY(${top}px)`); else el.style.removeProperty("transform");
1347
- }
1361
+ if (held <= 0 && Math.abs(top - fitTop) > NUDGE_PX) { fitTop = top; unpan(top); }
1348
1362
  const left = held > 0 ? held : growWait;
1349
1363
  if (!moveTimer && typeof setTimeout === "function") moveTimer = setTimeout(() => { moveTimer = 0; fit(); }, left + 20);
1350
1364
  return;
@@ -1354,10 +1368,19 @@ export function Shell({ panels, onNewInstance, viewOnly = false }) {
1354
1368
  // A reading that says "down" while the field keeps focus is on hold (below): until it holds, the shell keeps the height
1355
1369
  // it had, so the box does not drop under a keyboard that is still there.
1356
1370
  const pending = downSince && now() - downSince < DOWN_HOLD_MS && fitH;
1357
- fitH = pending ? fitH : h;
1371
+ // Leaving the field: the full height at once (not the view, which is still the keyboard's for a while).
1372
+ // Leaving the field: the full height whatever the view says. Eased only while the view still says keyboard (iOS's
1373
+ // reading comes once it has gone: then the keyboard is still on screen, sliding away over the shell); a view already
1374
+ // grown (its reading came first) means the keyboard has gone — at once.
1375
+ const left = leaving && !typingNow && !composingNow;
1376
+ const gone = left && tallest > h;
1377
+ if (gone && !(now() < closingUntil) && tallest - fitH > KEYBOARD_MIN_PX) closingUntil = now() + CLOSE_MS;
1378
+ fitH = gone ? tallest : left ? h : pending ? fitH : h;
1358
1379
  fitTop = top; fitW = w;
1380
+ closing(el, now() < closingUntil);
1359
1381
  el.style.setProperty("height", `${fitH}px`);
1360
- if (top) el.style.setProperty("transform", `translateY(${top}px)`); else el.style.removeProperty("transform");
1382
+ el.style.removeProperty("transform");
1383
+ unpan(top);
1361
1384
  };
1362
1385
  const follow = () => {
1363
1386
  if (!frame || !coarse()) return;
@@ -1394,7 +1417,8 @@ export function Shell({ panels, onNewInstance, viewOnly = false }) {
1394
1417
  if (up !== was) shellStore.set({ keyboard: up });
1395
1418
  fit();
1396
1419
  };
1397
- const focusChanged = () => { check(); follow(); };
1420
+ // M-3327: a focusout whose focus goes to another text field is not the keyboard going away (it stays up).
1421
+ const focusChanged = (e) => { leaving = e?.type === "focusout" && !isTextEntry(e.relatedTarget); check(); follow(); };
1398
1422
  const start = (e) => { composing = (e && e.target) || document.activeElement || null; };
1399
1423
  const end = () => { composing = null; composedAt = now(); check(); };
1400
1424
  check();
@@ -62,6 +62,10 @@ a { color: inherit; text-decoration: none; }
62
62
  inside it (an .sr-only label), so its overflow: hidden clips it — an absolute element whose containing block is the
63
63
  viewport escapes every scroll container and made the whole page scroll (alpha.2: two scrollbars on /ui/chat). */
64
64
  .shell { display: flex; height: 100vh; height: 100dvh; overflow: hidden; position: relative; }
65
+ /* M-3327: the keyboard going away — the shell takes its full height at the focusout and eases down with the keyboard
66
+ (app-shell.js sets data-kb-closing only then), instead of hanging at the keyboard's height and dropping in one frame. */
67
+ .shell[data-kb-closing] { transition: height 0.26s cubic-bezier(0.32, 0.72, 0, 1); }
68
+ @media (prefers-reduced-motion: reduce) { .shell[data-kb-closing] { transition: none; } }
65
69
  html:has(.shell), html:has(.shell) body { overflow: hidden; }
66
70
  .skip { position: absolute; left: var(--s-2); top: -60px; z-index: 100; background: var(--accent-fill); color: var(--on-accent); padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); }
67
71
  .skip:focus { top: var(--s-2); }
@@ -1049,6 +1053,13 @@ html.lb-open .scroller { overflow: hidden; }
1049
1053
  wrapper instead. A column keeps at least 5em: CJK text can break between any two characters. */
1050
1054
  .msg .md th, .msg .md td, .text-card .tc-table th, .text-card .tc-table td { overflow-wrap: break-word; word-break: normal; min-width: 5em; }
1051
1055
  .msg .md .al-c { text-align: center; } .msg .md .al-r { text-align: right; }
1056
+ /* M-3326: a table's cells selected as a spreadsheet's (chat-table-select.js): while cells are selected the browser's own
1057
+ text selection stays off the table, and the selected cells show the selection's tint over their own background. */
1058
+ .msg .md table.cells-on, .msg .tc-table.cells-on { -webkit-user-select: none; user-select: none; }
1059
+ .msg .md td.cell-sel, .msg .md th.cell-sel, .msg .tc-table td.cell-sel, .msg .tc-table th.cell-sel {
1060
+ background-image: linear-gradient(var(--accent-dim), var(--accent-dim)), linear-gradient(var(--accent-dim), var(--accent-dim));
1061
+ box-shadow: inset 0 0 0 1px var(--accent);
1062
+ }
1052
1063
  .msg .md h3, .msg .md h4, .msg .md h5, .msg .md h6 { margin: var(--s-3) 0 var(--s-2); font-size: var(--fs-md); font-weight: var(--fw-semibold); }
1053
1064
  .msg .md .tk-k { color: var(--tk-k); } .msg .md .tk-s { color: var(--tk-s); } .msg .md .tk-n { color: var(--tk-n); } .msg .md .tk-c { color: var(--tk-c); font-style: italic; }
1054
1065
  .codeblock { margin: var(--s-2) 0; border-radius: var(--r-md); overflow: hidden; background: var(--code-bg); position: relative; }
@@ -0,0 +1,2 @@
1
+ export function createAssetUrl(url: string): (path: string) => string;
2
+ export const assetUrl: (path: string) => string;
@@ -0,0 +1,20 @@
1
+ // M-3328 (measured in M-3316): a stylesheet or picture a module adds to the page later (a panel's own CSS, the office
2
+ // backgrounds) under the same version as the module itself. The import map (M-3314) versions only imports, so a
3
+ // `<link href="/assets/hub.css">` or `<img src="/assets/office-cozy.png">` stayed a plain, `no-store` request on every
4
+ // open — and, after an update, a newer stylesheet in an older tab. This module is loaded through the import map, so its
5
+ // own URL carries the page's version (`/assets/v-<V>/asset-url.js`): assetUrl() puts the same <V> in front of an
6
+ // `/assets/<name>`. A tab older than the server then asks for its own <V> and gets a 404, never a newer file. Anywhere
7
+ // it is loaded by its plain path (the Hub's pages, the office share page, tests) it changes nothing.
8
+
9
+ const VERSIONED = /\/(?:assets|ui\/js)\/(v-[0-9a-f]{12})\/[^/?#]+(?:[?#].*)?$/;
10
+ const PLAIN_ASSET = /^\/assets\/[A-Za-z0-9._-]+$/;
11
+
12
+ /** assetUrl for a module loaded at `url`: `/assets/<name>` under that URL's version, or unchanged when it has none. */
13
+ export function createAssetUrl(url) {
14
+ const m = VERSIONED.exec(String(url || ""));
15
+ const version = m ? m[1] : null;
16
+ return (path) => (version && PLAIN_ASSET.test(path) ? `/assets/${version}/${path.slice("/assets/".length)}` : path);
17
+ }
18
+
19
+ /** `/assets/<name>` under this page's version (unchanged where there is none). */
20
+ export const assetUrl = createAssetUrl(import.meta.url);