@songsid/agend 2.4.0-beta.22 → 2.4.0-beta.24

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 (284) hide show
  1. package/dist/agent-cli-instructions.md +4 -3
  2. package/dist/agent-cli.js +32 -2
  3. package/dist/agent-cli.js.map +1 -1
  4. package/dist/agent-file-read.js +2 -2
  5. package/dist/agent-file-read.js.map +1 -1
  6. package/dist/agent-whats-new.js +17 -1
  7. package/dist/agent-whats-new.js.map +1 -1
  8. package/dist/auth-api.d.ts +2 -0
  9. package/dist/auth-api.js +5 -2
  10. package/dist/auth-api.js.map +1 -1
  11. package/dist/authority/web-authority.d.ts +17 -3
  12. package/dist/authority/web-authority.js +56 -3
  13. package/dist/authority/web-authority.js.map +1 -1
  14. package/dist/backend/claude-code.d.ts +15 -0
  15. package/dist/backend/claude-code.js +8 -3
  16. package/dist/backend/claude-code.js.map +1 -1
  17. package/dist/backend/claude-mcp-carry.d.ts +63 -0
  18. package/dist/backend/claude-mcp-carry.js +242 -0
  19. package/dist/backend/claude-mcp-carry.js.map +1 -0
  20. package/dist/build-provenance.json +1 -1
  21. package/dist/channel/mcp-tools.js +15 -7
  22. package/dist/channel/mcp-tools.js.map +1 -1
  23. package/dist/classic-channel-manager.d.ts +1 -1
  24. package/dist/classic-channel-manager.js +2 -2
  25. package/dist/classic-channel-manager.js.map +1 -1
  26. package/dist/config-validator.js +6 -0
  27. package/dist/config-validator.js.map +1 -1
  28. package/dist/contact-auth-api.js +3 -1
  29. package/dist/contact-auth-api.js.map +1 -1
  30. package/dist/contact-auth-service.js +1 -1
  31. package/dist/contact-auth-service.js.map +1 -1
  32. package/dist/contact-auth-store.d.ts +28 -2
  33. package/dist/contact-auth-store.js +72 -4
  34. package/dist/contact-auth-store.js.map +1 -1
  35. package/dist/contact-change-proposals.d.ts +18 -1
  36. package/dist/contact-change-proposals.js +38 -4
  37. package/dist/contact-change-proposals.js.map +1 -1
  38. package/dist/contact-state-view.d.ts +103 -0
  39. package/dist/contact-state-view.js +80 -0
  40. package/dist/contact-state-view.js.map +1 -0
  41. package/dist/daemon.d.ts +11 -0
  42. package/dist/daemon.js +66 -15
  43. package/dist/daemon.js.map +1 -1
  44. package/dist/dashboard-permissions.d.ts +8 -0
  45. package/dist/dashboard-permissions.js +8 -0
  46. package/dist/dashboard-permissions.js.map +1 -1
  47. package/dist/delivery-outbox.d.ts +15 -1
  48. package/dist/delivery-outbox.js +60 -2
  49. package/dist/delivery-outbox.js.map +1 -1
  50. package/dist/fleet-manager.d.ts +157 -15
  51. package/dist/fleet-manager.js +522 -78
  52. package/dist/fleet-manager.js.map +1 -1
  53. package/dist/general-knowledge/skills/admin/SKILL.md +52 -0
  54. package/dist/general-knowledge/skills/concepts/SKILL.md +31 -21
  55. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +6 -0
  56. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +6 -3
  57. package/dist/general-knowledge/skills/fleet-config/SKILL.md +3 -3
  58. package/dist/general-knowledge/skills/hub/SKILL.md +6 -1
  59. package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +1 -1
  60. package/dist/general-knowledge/skills/task-board/SKILL.md +17 -0
  61. package/dist/general-knowledge/skills/web-appearance/SKILL.md +4 -0
  62. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +75 -12
  63. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +1 -1
  64. package/dist/general-role.d.ts +1 -1
  65. package/dist/general-role.js +1 -0
  66. package/dist/general-role.js.map +1 -1
  67. package/dist/hub/client.js +6 -1
  68. package/dist/hub/client.js.map +1 -1
  69. package/dist/hub/compose/member.d.ts +2 -1
  70. package/dist/hub/compose/member.js +3 -2
  71. package/dist/hub/compose/member.js.map +1 -1
  72. package/dist/hub/compose/server.js +2 -1
  73. package/dist/hub/compose/server.js.map +1 -1
  74. package/dist/hub/http/compose.js +5 -0
  75. package/dist/hub/http/compose.js.map +1 -1
  76. package/dist/hub/protocol.d.ts +21 -0
  77. package/dist/hub/protocol.js +3 -0
  78. package/dist/hub/protocol.js.map +1 -1
  79. package/dist/hub/question-close-model.d.ts +17 -0
  80. package/dist/hub/question-close-model.js +7 -0
  81. package/dist/hub/question-close-model.js.map +1 -0
  82. package/dist/hub/representative.d.ts +5 -0
  83. package/dist/hub/representative.js +51 -1
  84. package/dist/hub/representative.js.map +1 -1
  85. package/dist/hub/rooms/direct-view.js +1 -0
  86. package/dist/hub/rooms/direct-view.js.map +1 -1
  87. package/dist/hub/rooms/types.d.ts +1 -1
  88. package/dist/hub/rooms.d.ts +3 -0
  89. package/dist/hub/rooms.js +27 -1
  90. package/dist/hub/rooms.js.map +1 -1
  91. package/dist/hub/server.js +6 -1
  92. package/dist/hub/server.js.map +1 -1
  93. package/dist/hub/types.d.ts +2 -2
  94. package/dist/human-delivery-receipts.d.ts +12 -2
  95. package/dist/human-delivery-receipts.js +19 -4
  96. package/dist/human-delivery-receipts.js.map +1 -1
  97. package/dist/instance-lifecycle.d.ts +2 -0
  98. package/dist/instance-lifecycle.js +29 -1
  99. package/dist/instance-lifecycle.js.map +1 -1
  100. package/dist/instructions.d.ts +1 -1
  101. package/dist/instructions.js +1 -1
  102. package/dist/instructions.js.map +1 -1
  103. package/dist/locale.js +110 -12
  104. package/dist/locale.js.map +1 -1
  105. package/dist/needs-you-hub.d.ts +3 -0
  106. package/dist/needs-you-hub.js +31 -5
  107. package/dist/needs-you-hub.js.map +1 -1
  108. package/dist/needs-you.d.ts +16 -1
  109. package/dist/needs-you.js +7 -1
  110. package/dist/needs-you.js.map +1 -1
  111. package/dist/office-share-page.js +2 -2
  112. package/dist/office-share-page.js.map +1 -1
  113. package/dist/office-share.js +2 -1
  114. package/dist/office-share.js.map +1 -1
  115. package/dist/outbound-handlers.d.ts +4 -0
  116. package/dist/outbound-handlers.js +69 -11
  117. package/dist/outbound-handlers.js.map +1 -1
  118. package/dist/outbound-schemas.d.ts +5 -1
  119. package/dist/outbound-schemas.js +10 -7
  120. package/dist/outbound-schemas.js.map +1 -1
  121. package/dist/public-web-gateway.js +21 -0
  122. package/dist/public-web-gateway.js.map +1 -1
  123. package/dist/reply-buttons-controller.d.ts +2 -1
  124. package/dist/reply-buttons-controller.js +1 -1
  125. package/dist/reply-buttons-controller.js.map +1 -1
  126. package/dist/request-context-compatibility.d.ts +20 -0
  127. package/dist/request-context-compatibility.js +74 -0
  128. package/dist/request-context-compatibility.js.map +1 -0
  129. package/dist/request-context-protocol.d.ts +137 -0
  130. package/dist/request-context-protocol.js +38 -0
  131. package/dist/request-context-protocol.js.map +1 -0
  132. package/dist/request-context-store.d.ts +25 -0
  133. package/dist/request-context-store.js +137 -0
  134. package/dist/request-context-store.js.map +1 -0
  135. package/dist/scheduler/db.js +26 -0
  136. package/dist/scheduler/db.js.map +1 -1
  137. package/dist/scheduler/task-board-text.d.ts +2 -0
  138. package/dist/scheduler/task-board-text.js +12 -0
  139. package/dist/scheduler/task-board-text.js.map +1 -1
  140. package/dist/scheduler/task-board.d.ts +102 -2
  141. package/dist/scheduler/task-board.js +242 -24
  142. package/dist/scheduler/task-board.js.map +1 -1
  143. package/dist/scheduler/task-files.d.ts +80 -0
  144. package/dist/scheduler/task-files.js +357 -0
  145. package/dist/scheduler/task-files.js.map +1 -0
  146. package/dist/settings-api.d.ts +2 -0
  147. package/dist/settings-api.js +6 -1
  148. package/dist/settings-api.js.map +1 -1
  149. package/dist/settings-baseline.d.ts +1 -0
  150. package/dist/settings-baseline.js +1 -1
  151. package/dist/settings-baseline.js.map +1 -1
  152. package/dist/settings-effect.d.ts +2 -0
  153. package/dist/settings-effect.js +5 -1
  154. package/dist/settings-effect.js.map +1 -1
  155. package/dist/task-attach-client.d.ts +43 -0
  156. package/dist/task-attach-client.js +125 -0
  157. package/dist/task-attach-client.js.map +1 -0
  158. package/dist/task-board-tool.d.ts +12 -0
  159. package/dist/task-board-tool.js +107 -6
  160. package/dist/task-board-tool.js.map +1 -1
  161. package/dist/task-file-limits.d.ts +15 -0
  162. package/dist/task-file-limits.js +21 -0
  163. package/dist/task-file-limits.js.map +1 -0
  164. package/dist/tool-permissions.d.ts +32 -0
  165. package/dist/tool-permissions.js +64 -1
  166. package/dist/tool-permissions.js.map +1 -1
  167. package/dist/types.d.ts +6 -0
  168. package/dist/ui/accounts-keepalive.js +2 -1
  169. package/dist/ui/agent-details-settings.js +7 -5
  170. package/dist/ui/agent-who-can-use-strings.js +125 -0
  171. package/dist/ui/agent-who-can-use.js +238 -0
  172. package/dist/ui/chat-activity.js +2 -1
  173. package/dist/ui/chat-pins.js +2 -1
  174. package/dist/ui/claude-credentials.js +2 -1
  175. package/dist/ui/contact-auth-strings.js +28 -17
  176. package/dist/ui/contact-authorizations.js +6 -4
  177. package/dist/ui/contact-needs.js +6 -1
  178. package/dist/ui/contact-permissions.js +6 -4
  179. package/dist/ui/contact-tool-groups.js +1 -1
  180. package/dist/ui/contact-verify-need.js +46 -0
  181. package/dist/ui/fleet-cache.js +2 -1
  182. package/dist/ui/fleet-office-card.js +23 -5
  183. package/dist/ui/fleet-office-editor.js +5 -5
  184. package/dist/ui/fleet-office-pack.d.ts +10 -0
  185. package/dist/ui/fleet-office-pack.js +65 -2
  186. package/dist/ui/fleet-office-skin.js +52 -14
  187. package/dist/ui/fleet-office-store.js +33 -2
  188. package/dist/ui/fleet-office-vehicles.js +130 -0
  189. package/dist/ui/fleet-office-zones.js +27 -10
  190. package/dist/ui/fleet-office.js +128 -40
  191. package/dist/ui/fleet-org.js +6 -1
  192. package/dist/ui/fleet-tab-icons.js +19 -0
  193. package/dist/ui/fleet-task-activity.js +11 -83
  194. package/dist/ui/fleet-task-archive.js +111 -0
  195. package/dist/ui/fleet-task-card.js +6 -4
  196. package/dist/ui/fleet-task-common.js +2 -2
  197. package/dist/ui/fleet-task-edit.js +8 -1
  198. package/dist/ui/fleet-task-files.js +196 -0
  199. package/dist/ui/fleet-task-md.js +98 -0
  200. package/dist/ui/fleet-task-menu.js +1 -1
  201. package/dist/ui/fleet-task-stats.js +2 -2
  202. package/dist/ui/fleet-task-view.js +14 -9
  203. package/dist/ui/fleet-tasks.js +42 -18
  204. package/dist/ui/fleet-usage.js +2 -1
  205. package/dist/ui/hub-admin-overview.js +2 -1
  206. package/dist/ui/hub-agent-intro.js +2 -1
  207. package/dist/ui/hub-assistant-admin.js +2 -1
  208. package/dist/ui/hub-directory-notices.js +2 -1
  209. package/dist/ui/hub-enrolment-code.js +2 -1
  210. package/dist/ui/hub-my-agents.js +2 -1
  211. package/dist/ui/hub-quick-pairing.js +2 -1
  212. package/dist/ui/hub-role-audit.js +2 -1
  213. package/dist/ui/hub-role-forms.js +3 -2
  214. package/dist/ui/hub-role-view.js +3 -2
  215. package/dist/ui/hub-roles.js +2 -1
  216. package/dist/ui/hub-room-agent-strings.js +2 -1
  217. package/dist/ui/hub-room-list.js +2 -1
  218. package/dist/ui/hub-room-owner-requests.js +2 -1
  219. package/dist/ui/hub-room-pins.js +2 -1
  220. package/dist/ui/hub-room-strings.js +2 -2
  221. package/dist/ui/hub-room-thread.js +1 -1
  222. package/dist/ui/log-row.js +4 -3
  223. package/dist/ui/office-share-dialog.js +2 -1
  224. package/dist/ui/office-share-page.js +2 -1
  225. package/dist/ui/page-share-dialog.js +3 -2
  226. package/dist/ui/panel-chat.js +2 -1
  227. package/dist/ui/panel-details.js +5 -2
  228. package/dist/ui/panel-fleet.js +10 -5
  229. package/dist/ui/panel-hub.js +2 -1
  230. package/dist/ui/panel-needs.js +34 -6
  231. package/dist/ui/panel-notices.js +2 -1
  232. package/dist/ui/panel-runtimes.js +2 -1
  233. package/dist/ui/panel-settings.js +15 -1
  234. package/dist/ui/panel-windows-cli.js +3 -2
  235. package/dist/ui/runtime-cli-install.js +2 -1
  236. package/dist/ui/settings-appearance.js +2 -1
  237. package/dist/ui/settings-guests.js +4 -3
  238. package/dist/ui/settings-hub-member-address.js +2 -1
  239. package/dist/ui/settings-hub-setup.js +2 -1
  240. package/dist/ui/settings-hub-web-address.js +2 -1
  241. package/dist/ui/settings-hub.js +2 -1
  242. package/dist/ui/settings-registry.js +1 -0
  243. package/dist/ui/settings-shared-strings.js +9 -0
  244. package/dist/ui/settings-shared.js +6 -1
  245. package/dist/ui/settings-update.js +2 -1
  246. package/dist/ui/settings-web-authority.js +2 -1
  247. package/dist/ui/shared/agent-sheet.js +2 -1
  248. package/dist/ui/shared/app-i18n.js +2 -2
  249. package/dist/ui/shared/app-needs.js +8 -1
  250. package/dist/ui/shared/app-session.js +4 -3
  251. package/dist/ui/shared/app-shell.js +6 -2
  252. package/dist/ui/shared/app.css +93 -11
  253. package/dist/ui/shared/chat-strings.js +4 -4
  254. package/dist/ui/shared/chat-time.js +7 -4
  255. package/dist/ui/shared/clock-text.js +57 -0
  256. package/dist/ui/shared/device-roles.js +6 -5
  257. package/dist/ui/shared/instance-nav.js +17 -22
  258. package/dist/ui/shared/task-board.css +64 -0
  259. package/dist/ui/shared/usage-dialog.js +2 -1
  260. package/dist/ui/shared/view-strings.js +0 -14
  261. package/dist/ui/shared/web-authorize.js +3 -2
  262. package/dist/ui/subagent-row.js +2 -1
  263. package/dist/web-api.d.ts +18 -2
  264. package/dist/web-api.js +159 -27
  265. package/dist/web-api.js.map +1 -1
  266. package/dist/web-login.d.ts +6 -1
  267. package/dist/web-login.js +8 -3
  268. package/dist/web-login.js.map +1 -1
  269. package/dist/web-office-acts.d.ts +16 -0
  270. package/dist/web-office-acts.js +27 -9
  271. package/dist/web-office-acts.js.map +1 -1
  272. package/dist/web-office-pack-read.js +1 -1
  273. package/dist/web-office-pack-read.js.map +1 -1
  274. package/dist/web-office-skins.d.ts +5 -3
  275. package/dist/web-office-skins.js +20 -16
  276. package/dist/web-office-skins.js.map +1 -1
  277. package/dist/web-session-authorization.d.ts +3 -0
  278. package/dist/web-session-authorization.js +1 -1
  279. package/dist/web-session-authorization.js.map +1 -1
  280. package/dist/web-settings-patch.d.ts +27 -0
  281. package/dist/web-settings-patch.js +67 -0
  282. package/dist/web-settings-patch.js.map +1 -1
  283. package/dist/workflow-templates/default.md +1 -0
  284. package/package.json +1 -1
@@ -10,6 +10,8 @@
10
10
  import { html, useEffect, useState } from "/assets/app-html.js";
11
11
  import { detailsPath } from "/assets/app-route.js";
12
12
  import { Icon } from "/assets/ui-icons.js";
13
+ import { appStore, useStore } from "/assets/app-store.js";
14
+ import { labelOf } from "/assets/instance-nav.js";
13
15
  import { toast } from "/assets/ui-toast.js";
14
16
  import { confirmDialog } from "/assets/ui-confirm.js";
15
17
  import { ca } from "./contact-auth-strings.js";
@@ -22,12 +24,15 @@ const ID = /^[A-Za-z0-9_-]{1,64}$/;
22
24
  function RequestNeed({ item }) {
23
25
  const ref = item.contactTicket || {};
24
26
  const [tk, setTk] = useState(null);
27
+ // M-3680: the agents by the names the page shows them (the request card below does the same).
28
+ const { instances } = useStore(appStore);
29
+ const agent = (name) => (name ? labelOf((instances || []).find((i) => i.name === name) || { name }) : "");
25
30
  useEffect(() => {
26
31
  let live = true;
27
32
  if (ID.test(String(ref.id || ""))) void getTicket(ref.id).then((r) => { if (live && r.ok) setTk(r.data); });
28
33
  return () => { live = false; };
29
34
  }, [ref.id]);
30
- return html`<div class="n-title"><strong>${ca("needsTitle", ref.source || "", ref.target || "")}</strong></div>
35
+ return html`<div class="n-title"><strong>${ca("needsTitle", agent(ref.source), agent(ref.target))}</strong></div>
31
36
  ${tk ? html`<${TicketCard} ticket=${tk} onChange=${setTk} />` : null}
32
37
  <div class="n-actions">${ID.test(String(ref.id || "")) ? html`<a class="btn btn-sm btn-ghost" href=${`/ui/fleet/authorizations?ticket=${encodeURIComponent(ref.id)}`}>${ca("needsOpen")}</a>` : null}</div>`;
33
38
  }
@@ -19,8 +19,9 @@ import { labelOf } from "/assets/instance-nav.js";
19
19
  import { ContactGrantEditor } from "./contact-grant-editor.js";
20
20
  import { REASONS } from "./contact-authorizations.js";
21
21
  import { groupWouldDisable } from "./contact-tool-groups.js";
22
+ import { dateTimeText } from "/assets/clock-text.js";
22
23
 
23
- const when = (iso) => { const d = new Date(iso); return Number.isFinite(d.getTime()) ? d.toLocaleString([], { dateStyle: "medium", timeStyle: "short" }) : ""; };
24
+ const when = (iso) => { const d = new Date(iso); return Number.isFinite(d.getTime()) ? dateTimeText(d, { dateStyle: "medium", timeStyle: "short" }, []) : ""; };
24
25
  /** A3's guard reason codes (ContactGuardStatus.reason), each said in words (contact-auth-strings.js guardReason_<code>). */
25
26
  const GUARD_REASONS = new Set(["legacy-mode", "unsupported-backend", "unsupported-platform", "unsupported-version", "cli-mode", "load-not-verified", "stale-policy",
26
27
  "stale-launch", "not-running", "invalid-policy", "missing-bound-mcp", "missing-selected-mcp", "guard-files-changed", "invalid-load-receipt", "guard-unavailable", "binary-changed"]);
@@ -105,7 +106,8 @@ export function ContactPermissionsPanel({ name }) {
105
106
  const p = perm.data;
106
107
  useEffect(() => { setEditing(null); }, [name, p?.revision]);
107
108
  if (!p && perm.loading !== false && !perm.error) return html`<${Skeleton} lines=${5} label=${ca("loading")} />`;
108
- if (!p) return perm.error === "forbidden" ? html`<p class="note contact-forbidden">${ca("forbidden")}</p>`
109
+ if (!p) return perm.error === "verification-required" ? html`<p class="note contact-verify">${ca("verifyFirst")}</p>`
110
+ : perm.error === "forbidden" ? html`<p class="note contact-forbidden">${ca("forbidden")}</p>`
109
111
  : html`<${ErrorState} message=${ca(perm.error === "unavailable" ? "unavailable" : "loadFailed")} onRetry=${() => void perm.read()} />`;
110
112
  // Who may change what (the server says; Sentinel's seam): the source room's admins its mode and tools (canSetMode); the
111
113
  // target's approvers its approvers and allowed contacts (canManage).
@@ -119,7 +121,7 @@ export function ContactPermissionsPanel({ name }) {
119
121
  setBusy(false);
120
122
  if (r.ok) { perm.setData(r.data); toast(ca("saved"), true); return true; }
121
123
  if (r.code === "conflict") { await perm.read(); toast(ca("stale"), false); return false; }
122
- toast(ca(r.code === "forbidden" ? "forbidden" : r.code === "unavailable" ? "unavailable" : r.code === "invalid-approver" ? "invalidApprover" : "saveFailed"), false);
124
+ toast(ca(r.code === "verification-required" ? "verifyFirst" : r.code === "forbidden" ? "forbidden" : r.code === "unavailable" ? "unavailable" : r.code === "invalid-approver" ? "invalidApprover" : "saveFailed"), false);
123
125
  return false;
124
126
  };
125
127
  const switchMode = async (mode) => {
@@ -140,7 +142,7 @@ export function ContactPermissionsPanel({ name }) {
140
142
  setBusy(false);
141
143
  if (r.ok) { perm.setData(r.data); toast(ca("originCleared"), true); return; }
142
144
  if (r.code === "conflict") { await perm.read(); toast(ca("stale"), false); return; }
143
- toast(ca(r.code === "forbidden" ? "forbidden" : r.code === "unavailable" ? "unavailable" : "saveFailed"), false);
145
+ toast(ca(r.code === "verification-required" ? "verifyFirst" : r.code === "forbidden" ? "forbidden" : r.code === "unavailable" ? "unavailable" : "saveFailed"), false);
144
146
  };
145
147
  const tools = p.roomTools || { publicRead: false, allowedMcpTools: [], wouldDisable: [] };
146
148
  const setTools = (next) => write({ roomTools: { publicRead: next.publicRead, allowedMcpTools: next.allowedMcpTools } });
@@ -11,7 +11,7 @@
11
11
  /** The kinds of AgEnD tools a restricted room loses, in the order they are shown; each tool in exactly one. */
12
12
  export const TOOL_GROUPS = Object.freeze([
13
13
  { id: "fleet", tools: ["get_fleet_status", "get_fleet_config", "validate_config", "get_effort", "list_models", "kiro_engine_status",
14
- "update_instance_config", "update_fleet_defaults", "migrate_kiro_instance", "reconcile_kiro_instance", "get_web_settings", "set_web_settings", "propose_contact_change"] },
14
+ "update_instance_config", "update_fleet_defaults", "migrate_kiro_instance", "reconcile_kiro_instance", "get_web_settings", "set_web_settings", "propose_contact_change", "contact_state"] },
15
15
  { id: "agents", tools: ["create_instance", "delete_instance", "replace_instance", "start_instance", "stop_instance", "restart_instance",
16
16
  "pause_instance", "wake_instance", "create_team", "update_team", "delete_team"] },
17
17
  { id: "usage", tools: ["get_usage", "get_usage_report", "get_cache_report", "get_instance_logs"] },
@@ -0,0 +1,46 @@
1
+ // M-3710 (R21079937, 11-25: a pending contact request was in no list, not even on this computer). Needs you's line for an
2
+ // admin session with no verified person behind it: how many requests wait (the server sends the count only —
3
+ // reason "contact_verify_needed", contactVerify { count }; never which, who or what), and this browser's own
4
+ // "Authorize this browser" (web-authorize.js: the button, or why it can't be authorized here and where to fix that).
5
+ // Once the account confirms, the server sends Needs you again and the requests themselves replace this line.
6
+ // A module of its own, with its own words (#4447 review): a page still holding an older contact-needs.js or
7
+ // contact-auth-strings.js keeps working and says these words, never their keys.
8
+ import { html } from "/assets/app-html.js";
9
+ import { register, t } from "/assets/app-i18n.js";
10
+ import { Icon } from "/assets/ui-icons.js";
11
+ import { AuthorizeChip } from "/assets/web-authorize.js";
12
+
13
+ register("contactVerifyNeed", {
14
+ en: {
15
+ one: "1 contact request needs a verified browser", many: "{0} contact requests need a verified browser",
16
+ body: "Authorize this browser to see who is asking, and to approve or decline.",
17
+ },
18
+ "zh-TW": {
19
+ one: "有 1 個聯絡申請需要已驗證的瀏覽器", many: "有 {0} 個聯絡申請需要已驗證的瀏覽器",
20
+ body: "授權這個瀏覽器後,才能看到是誰提出,並核准或拒絕。",
21
+ },
22
+ });
23
+ const tv = (k, ...a) => t(`contactVerifyNeed.${k}`, ...a);
24
+ /** The line's title for `count` waiting requests (at least 1). */
25
+ export const verifyNeedTitle = (count) => (count === 1 ? tv("one") : tv("many", count));
26
+ export const verifyNeedBody = () => tv("body");
27
+
28
+ /** A Needs you item that says contact requests wait for a verified browser. */
29
+ export const isContactVerify = (item) => item?.type === "contact" && item.reason === "contact_verify_needed";
30
+ /** How many requests the line stands for: what Needs you's counts add for it (#4447 capture check). */
31
+ export const contactVerifyCount = (item) => Math.max(1, Math.floor(Number(item?.contactVerify?.count) || 1));
32
+
33
+ export function ContactVerifyNeed({ item }) {
34
+ const count = contactVerifyCount(item);
35
+ const title = verifyNeedTitle(count);
36
+ return html`<section class="n-group n-contact-verify" aria-label=${title}>
37
+ <article data-trust="permission" class="n-item contact-need contact-verify-need" data-reason="contact_verify_needed">
38
+ <span class="n-icon"><${Icon} name="key" size=${18} /></span>
39
+ <div class="n-body">
40
+ <div class="n-title"><strong>${title}</strong></div>
41
+ <p class="n-detail">${verifyNeedBody()}</p>
42
+ <${AuthorizeChip} />
43
+ </div>
44
+ </article>
45
+ </section>`;
46
+ }
@@ -8,6 +8,7 @@ import { html } from "/assets/app-html.js";
8
8
  import { t, register } from "/assets/app-i18n.js";
9
9
  import { Empty } from "/assets/ui-states.js";
10
10
  import { Icon } from "/assets/ui-icons.js";
11
+ import { unitText } from "/assets/clock-text.js";
11
12
 
12
13
  register("cache", {
13
14
  en: {
@@ -82,7 +83,7 @@ export function tokens(n) {
82
83
  return String(Math.round(n));
83
84
  }
84
85
  export function bytes(n) { return n >= 1e9 ? `${(n / 1e9).toFixed(1)} GB` : n >= 1e6 ? `${Math.round(n / 1e6)} MB` : `${Math.max(1, Math.round(n / 1e3))} KB`; }
85
- export function ttlText(sec) { return sec >= 3600 ? `${sec / 3600} h` : `${Math.round(sec / 60)} min`; }
86
+ export function ttlText(sec) { return sec >= 3600 ? unitText(sec / 3600, "h") : unitText(Math.round(sec / 60), "min"); }
86
87
  const pct = (x) => `${x >= 0.1 ? Math.round(x * 100) : (x * 100).toFixed(1)}%`;
87
88
 
88
89
  /** The one line under an instance's recommendation. */
@@ -24,19 +24,20 @@ import { backendLabel, modelText, namesOf } from "/assets/instance-nav.js";
24
24
  import { badgeText, fixedOf, tierOf, titleOf, tokens, xpOf } from "./fleet-office-levels.js";
25
25
  import { CARD_ROWS, CARD_SECTIONS, contrastRatio, relativeLuminance } from "./fleet-office-pack.js";
26
26
  import { nineSlice } from "./fleet-office-dialogue.js";
27
+ import { RENAME_LEN } from "./fleet-office-store.js";
27
28
 
28
29
  register("ocard", {
29
30
  en: {
30
31
  card: "{0}'s card", level: "Lv {0}", work: "{0} work tokens", estimated: "estimated", toNext: "{0} to Lv {1}", office: "Office", model: "Model", backend: "Backend",
31
32
  today: "Today", todayN: "{0} work tokens · {1} requests", firstSeen: "First seen", day: "Day {0}", now: "Now", nowLabel: "Now: ", find: "Find in office", chat: "Chat", pat: "Pat", feed: "Feed", tell: "Tell {0} (with their next message)", tellNote: "Off: only you see it. On: a line like “[Office] <your name> patted your head ×3” rides the next message they get anyway — it never wakes them.",
32
33
  chatWindow: "Open {0}’s chat in a new window",
33
- close: "Close", xp: "Progress to Lv {0}",
34
+ close: "Close", xp: "Progress to Lv {0}", rename: "Rename (only you see it)", renameField: "Name you see",
34
35
  },
35
36
  "zh-TW": {
36
37
  card: "{0} 的名片", level: "Lv {0}", work: "{0} 工作 token", estimated: "估算", toNext: "再 {0} 到 Lv {1}", office: "辦公室", model: "模型", backend: "後端",
37
38
  today: "今天", todayN: "{0} 工作 token · {1} 次請求", firstSeen: "首次出現", day: "第 {0} 天", now: "現在", nowLabel: "現在:", find: "在辦公室找它", chat: "聊天", pat: "摸頭", feed: "餵點心", tell: "讓 {0} 知道(隨下一則訊息)", tellNote: "關閉:只有你看得到。開啟:下一則本來就會送給它的訊息會附上一行,例如「[Office] <你的名字> patted your head ×3」,不會叫醒它。",
38
39
  chatWindow: "在新視窗開啟 {0} 的聊天",
39
- close: "關閉", xp: "升到 Lv {0} 的進度",
40
+ close: "關閉", xp: "升到 Lv {0} 的進度", rename: "改名(只有你看得到)", renameField: "你看到的名字",
40
41
  },
41
42
  });
42
43
  const tc = (k, ...v) => t(`ocard.${k}`, ...v);
@@ -334,7 +335,24 @@ function drawPortraitAvatar(cv, im, W) {
334
335
  * M-3533 R2b: `photo` (src) the agent's identity-card picture (a Hub room's), drawn as the pack portrait is, in place of
335
336
  * the figure once it loads; the figure while it loads or when it fails.
336
337
  */
337
- export function OfficeCard({ model: m, avatar, sheet, place, onChat, onFind, onClose, onReact = null, tell = null, packCard = null, picture = null, portrait = null, packScale = 2, action = null, photo = null }) {
338
+ /**
339
+ * The card's name, and with `rename` ({ value, save }) a pencil beside it: a field for the name this browser shows
340
+ * (Enter or leaving it keeps it, Escape does not; empty gives back their own).
341
+ */
342
+ function CardName({ name, rename }) {
343
+ const [editing, setEditing] = useState(false);
344
+ const field = useRef(null);
345
+ // Filled once, as the field appears: a `value` prop would put the name back over what is typed at each redraw.
346
+ useLayoutEffect(() => { if (editing && field.current) { field.current.value = (rename && rename.value) || name; field.current.focus(); field.current.select(); } }, [editing]);
347
+ if (!rename) return html`<strong class="oo-card-name">${name}</strong>`;
348
+ const done = (keep) => { if (!editing) return; setEditing(false); if (keep && field.current) rename.save(field.current.value.trim()); };
349
+ if (editing) return html`<input ref=${field} class="oo-card-rename" maxlength=${RENAME_LEN} aria-label=${tc("renameField")}
350
+ onKeyDown=${(e) => { if (e.key === "Enter") { e.preventDefault(); done(true); } else if (e.key === "Escape") { e.preventDefault(); e.stopPropagation(); done(false); } }} onBlur=${() => done(true)} />`;
351
+ return html`<span class="oo-card-name-row"><strong class="oo-card-name">${name}</strong><button type="button" class="icon-btn oo-card-rename-btn"
352
+ aria-label=${tc("rename")} title=${tc("rename")} onClick=${() => setEditing(true)}>✎</button></span>`;
353
+ }
354
+
355
+ export function OfficeCard({ model: m, avatar, sheet, place, onChat, onFind, onClose, onReact = null, tell = null, rename = null, packCard = null, picture = null, portrait = null, packScale = 2, action = null, photo = null }) {
338
356
  // `action`: one, or a list (M-3565: a Hub room's "@ it" and "Chat with it one-to-one"); the first is the primary button.
339
357
  const actions = Array.isArray(action) ? action.filter(Boolean) : action ? [action] : [];
340
358
  const actionButtons = actions.map((a, i) => html`<button key=${i} type="button" class=${`btn btn-sm ${i === 0 ? "btn-primary " : ""}oo-card-action`} title=${a.title || undefined} aria-label=${a.title || undefined} onClick=${a.run}>${a.label}</button>`);
@@ -449,7 +467,7 @@ export function OfficeCard({ model: m, avatar, sheet, place, onChat, onFind, onC
449
467
  <div class="oo-card-avatar"><canvas ref=${canvas} width="56" height="56" aria-hidden="true"></canvas>
450
468
  ${m.badge ? html`<span class=${`oo-badge tier-${m.badge.tier}${m.badge.mark ? " mark" : ""}`} aria-hidden="true">${m.badge.mark ? "" : m.badge.text}</span>` : null}</div>
451
469
  <div class="oo-card-names">
452
- <strong class="oo-card-name">${m.name}</strong>
470
+ <${CardName} name=${m.name} rename=${rename} />
453
471
  ${m.instance ? html`<div class="oo-card-instance mono" title=${m.instance}>${m.instance}</div>` : null}
454
472
  <div class="oo-card-state">${m.stateLine}</div>
455
473
  </div>
@@ -493,7 +511,7 @@ export function OfficeCard({ model: m, avatar, sheet, place, onChat, onFind, onC
493
511
  <div class="oo-card-avatar"><canvas ref=${canvas} width=${avatarPx} height=${avatarPx} aria-hidden="true"></canvas>
494
512
  ${m.badge && !hide.has("badge") ? html`<span class=${`oo-badge tier-${m.badge.tier}${m.badge.mark ? " mark" : ""}`} aria-hidden="true">${m.badge.mark ? "" : m.badge.text}</span>` : null}</div>
495
513
  <div class="oo-card-names">
496
- <strong class="oo-card-name">${m.name}</strong>
514
+ <${CardName} name=${m.name} rename=${rename} />
497
515
  ${!hide.has("instance") && m.instance ? html`<div class="oo-card-instance mono" title=${m.instance}>${m.instance}</div>` : null}
498
516
  <div class="oo-card-state">${stateLine}</div>
499
517
  </div>
@@ -3,7 +3,7 @@
3
3
  // whole teams or one instance at a time, or #2752 nobody: its style's NPCs only) and deletes one — then saves the whole list with the rev it read
4
4
  // (PUT /ui/offices; a change made meanwhile is a 409: read again, nothing overwritten). A stored office's layout (seats,
5
5
  // paths) and its layout overrides (Edit layout, fleet-office-layout.js) are kept as they are. Skin packs (#2513): the
6
- // packs the host keeps are styles to choose; an admin uploads one here (its manifest.json and its PNGs, picked together
6
+ // packs the host keeps are styles to choose; an admin uploads one here (its manifest.json and its PNG or WebP pictures, picked together
7
7
  // or as a folder — sent at once, checked by the host, which keeps it whole) or deletes one; #2692: which agents may change
8
8
  // packs, whether their changes need the admin's yes, those waiting for it, and the newest log entries. Never offered to a guest,
9
9
  // the public link or a read-only session (the host refuses them too).
@@ -30,7 +30,7 @@ register("orge", {
30
30
  failed: "The offices were not saved ({0}).", layoutKept: "Its seats and paths are kept.",
31
31
  stayInArea: "Idle people stay in their own area", stayInAreaNote: "They stroll only within the area they sit in and never go to sit in another area.",
32
32
  styleUnknown: "{0} (not available here: drawn as Desks)",
33
- packs: "Skin packs", packsLead: "Styles drawn from an artist's pictures. Pick a pack's manifest.json and all its PNG files together (or its folder).",
33
+ packs: "Skin packs", packsLead: "Styles drawn from an artist's pictures. Pick a pack's manifest.json and all its PNG or WebP files together (or its folder).",
34
34
  packsNone: "No skin packs yet.", upload: "Upload a skin pack", uploadFolder: "Upload a folder", uploading: "Uploading…", uploaded: "Skin pack “{0}” uploaded.",
35
35
  uploadFailed: "The skin pack was not uploaded: {0}", noManifest: "no manifest.json among the files", badManifest: "manifest.json is not JSON",
36
36
  removePack: "Delete {0}", removedPack: "Skin pack “{0}” deleted.", removeFailed: "The skin pack was not deleted ({0}).",
@@ -54,7 +54,7 @@ register("orge", {
54
54
  failed: "辦公室沒有儲存({0})。", layoutKept: "它的座位與路徑會保留。",
55
55
  stayInArea: "待命只在自己的區域走動", stayInAreaNote: "待命的人只在自己座位所在的區域裡走動,不會到其他區域去坐。",
56
56
  styleUnknown: "{0}(這裡沒有:以辦公桌顯示)",
57
- packs: "外觀包", packsLead: "用畫師的圖片畫出的風格。請把外觀包的 manifest.json 和所有 PNG 檔一起選取(或選整個資料夾)。",
57
+ packs: "外觀包", packsLead: "用畫師的圖片畫出的風格。請把外觀包的 manifest.json 和所有 PNG 或 WebP 檔一起選取(或選整個資料夾)。",
58
58
  packsNone: "還沒有外觀包。", upload: "上傳外觀包", uploadFolder: "上傳資料夾", uploading: "上傳中…", uploaded: "已上傳外觀包「{0}」。",
59
59
  uploadFailed: "外觀包沒有上傳:{0}", noManifest: "檔案中沒有 manifest.json", badManifest: "manifest.json 不是 JSON",
60
60
  removePack: "刪除 {0}", removedPack: "已刪除外觀包「{0}」。", removeFailed: "外觀包沒有刪除({0})。",
@@ -91,7 +91,7 @@ export async function packUpload(files) {
91
91
  try { manifest = JSON.parse(await man.file.text()); } catch { return { error: te("badManifest") }; }
92
92
  const out = {};
93
93
  for (const x of named) {
94
- if (x === man || !/\.png$/i.test(x.name)) continue;
94
+ if (x === man || !/\.(png|webp)$/i.test(x.name)) continue;
95
95
  out[x.name] = base64Of(new Uint8Array(await x.file.arrayBuffer()));
96
96
  }
97
97
  return { body: { manifest, files: out } };
@@ -126,7 +126,7 @@ function Packs({ packs, store }) {
126
126
  <span>${pk.name}</span>${pk.name !== pk.id ? html` <span class="muted mono">${pk.id}</span>` : null}
127
127
  <button type="button" class="btn btn-sm btn-danger oe-pack-remove" onClick=${() => remove(pk)} aria-label=${te("removePack", pk.name)}>${te("remove")}</button></li>`)}</ul>`
128
128
  : html`<p class="note" id="oePacksNone">${te("packsNone")}</p>`}
129
- <label class="btn btn-sm oe-upload">${te("upload")}<input type="file" class="sr-only oe-upload-files" multiple accept=".json,.png,application/json,image/png" onChange=${send} /></label>
129
+ <label class="btn btn-sm oe-upload">${te("upload")}<input type="file" class="sr-only oe-upload-files" multiple accept=".json,.png,.webp,application/json,image/png,image/webp" onChange=${send} /></label>
130
130
  <label class="btn btn-sm oe-upload">${te("uploadFolder")}<input type="file" class="sr-only oe-upload-dir" webkitdirectory="" multiple onChange=${send} /></label>
131
131
  ${msg ? html`<p class="note oe-pack-msg" role="status">${msg}</p>` : null}
132
132
  </fieldset>`;
@@ -50,6 +50,8 @@ export interface CheckedPack {
50
50
  idleVisits?: Array<{ area: string; weight: number; minSeconds: number; maxSeconds: number }>;
51
51
  /** M-3432 (#4255): optional custom snacks the viewer may drag-to-feed or place on the floor. */
52
52
  snacks?: PackSnack[];
53
+ /** A train on a loop of track (fleet-office-vehicles.js); agents ride by office_set `ride`. */
54
+ vehicles?: PackVehicle[];
53
55
  }
54
56
  /** M-3432 (#4255): one custom snack item from a pack's `snacks` list. */
55
57
  export interface PackSnack {
@@ -149,3 +151,11 @@ export function overridesBetween(pack: CheckedPack, edited: CheckedPack): Layout
149
151
  export function poseStrip(set: Record<string, PackStrip> | null | undefined, pose: string, heading?: { dx: number; dy: number } | null): { strip: PackStrip; mirror: boolean } | null;
150
152
  export function walkStrip(f: { walk?: Record<string, PackStrip> | null; walking?: boolean; heading?: { dx: number; dy: number } | null } | null | undefined): { strip: PackStrip; mirror: boolean } | null;
151
153
  export function stripBox(st: PackStrip, x: number, y: number, mirror?: boolean): { x: number; y: number; w: number; h: number };
154
+
155
+ /** A pack's vehicle, checked: round its closed `path` at `speed` units a second, waiting at each stop; riders sit at `seats`. */
156
+ export interface PackVehicle {
157
+ id: string; label?: string; sprite: PackStrip | null; sprites?: Partial<Record<"right" | "left" | "up" | "down", PackStrip>>;
158
+ fronts?: Partial<Record<"right" | "left" | "up" | "down", PackStrip>>;
159
+ path: PackPoint[]; speed: number; stops: Array<{ at: number; seconds: number; platform: PackPoint }>; seats: Array<{ dx: number; dy: number }>;
160
+ }
161
+ export const VEHICLE_LIMITS: { vehicles: number; path: number; stops: number; seats: number; minSpeed: number; maxSpeed: number; defaultSpeed: number; maxSeconds: number; defaultSeconds: number; offset: number };
@@ -693,6 +693,63 @@ function snackLabelOf(v, at) {
693
693
  return out;
694
694
  }
695
695
 
696
+ /**
697
+ * A pack's `vehicles` (a train on a loop of track): each runs round its closed `path` (logical points; the last joins
698
+ * the first) at `speed` logical units a second, and waits `seconds` at each of its `stops` (a path point's index, with
699
+ * the `platform` point people board from). `seats`: where riders sit, offsets from the vehicle's anchor as drawn
700
+ * heading right (`dx` along the car, `dy` across it; fleet-office-vehicles.js seatAt places them for each heading).
701
+ * `sprite` (its picture heading right; mirrored going left), or `sprites` by heading (`right`, `left`, `up`, `down`),
702
+ * each a strip; `fronts` the same by heading, drawn over the riders (the car's front edge hiding their lower half). Who
703
+ * rides is the agents' own choice (office_set `ride`), not the pack's.
704
+ */
705
+ export const VEHICLE_LIMITS = { vehicles: 4, path: 64, stops: 8, seats: 16, minSpeed: 5, maxSpeed: 600, defaultSpeed: 80, maxSeconds: 600, defaultSeconds: 8, offset: 2000 };
706
+ const HEADINGS = ["right", "left", "up", "down"];
707
+ function vehiclesOf(v, scale) {
708
+ if (v === undefined) return [];
709
+ const seen = new Set();
710
+ return list(v, VEHICLE_LIMITS.vehicles, "vehicles").map((x, i) => {
711
+ const at = `vehicles[${i}]`;
712
+ obj(x, at); keys(x, ["id", "label", "sprite", "sprites", "fronts", "path", "speed", "stops", "seats"], at);
713
+ if (!nameOk(x.id) || seen.has(x.id)) throw new Refused(`${at}.id`, "a new name of letters, digits, _ or - (not an inherited one)");
714
+ seen.add(x.id);
715
+ if (x.label !== undefined && (typeof x.label !== "string" || !x.label.trim() || [...x.label].length > LIMIT.line || /[\u0000-\u001f\u007f]/.test(x.label))) throw new Refused(`${at}.label`, `1–${LIMIT.line} characters`);
716
+ if (x.sprite === undefined && x.sprites === undefined) throw new Refused(at, "a sprite, or sprites by heading");
717
+ let sprites = null;
718
+ if (x.sprites !== undefined) {
719
+ obj(x.sprites, `${at}.sprites`); keys(x.sprites, HEADINGS, `${at}.sprites`);
720
+ sprites = {};
721
+ for (const h of HEADINGS) if (x.sprites[h] !== undefined) sprites[h] = checkStrip(x.sprites[h], `${at}.sprites.${h}`, scale);
722
+ if (!Object.keys(sprites).length) throw new Refused(`${at}.sprites`, "at least one heading");
723
+ }
724
+ let fronts = null;
725
+ if (x.fronts !== undefined) {
726
+ obj(x.fronts, `${at}.fronts`); keys(x.fronts, HEADINGS, `${at}.fronts`);
727
+ fronts = {};
728
+ for (const h of HEADINGS) if (x.fronts[h] !== undefined) fronts[h] = checkStrip(x.fronts[h], `${at}.fronts.${h}`, scale);
729
+ }
730
+ const path = list(x.path, VEHICLE_LIMITS.path, `${at}.path`).map((p, j) => point(p, `${at}.path[${j}]`));
731
+ if (path.length < 3) throw new Refused(`${at}.path`, "at least 3 points (a loop)");
732
+ const speed = x.speed === undefined ? VEHICLE_LIMITS.defaultSpeed : num(x.speed, VEHICLE_LIMITS.minSpeed, VEHICLE_LIMITS.maxSpeed, `${at}.speed`);
733
+ const taken = new Set();
734
+ const stops = list(x.stops ?? [], VEHICLE_LIMITS.stops, `${at}.stops`).map((s, j) => {
735
+ const here = `${at}.stops[${j}]`;
736
+ obj(s, here); keys(s, ["at", "seconds", "platform"], here);
737
+ const k = int(s.at, 0, path.length - 1, `${here}.at`);
738
+ if (taken.has(k)) throw new Refused(`${here}.at`, "a path point no other stop has");
739
+ taken.add(k);
740
+ return { at: k, seconds: s.seconds === undefined ? VEHICLE_LIMITS.defaultSeconds : num(s.seconds, 1, VEHICLE_LIMITS.maxSeconds, `${here}.seconds`), platform: point(s.platform, `${here}.platform`) };
741
+ });
742
+ const seats = list(x.seats ?? [], VEHICLE_LIMITS.seats, `${at}.seats`).map((s, j) => {
743
+ const here = `${at}.seats[${j}]`;
744
+ obj(s, here); keys(s, ["dx", "dy"], here);
745
+ return { dx: num(s.dx ?? 0, -VEHICLE_LIMITS.offset, VEHICLE_LIMITS.offset, `${here}.dx`), dy: num(s.dy ?? 0, -VEHICLE_LIMITS.offset, VEHICLE_LIMITS.offset, `${here}.dy`) };
746
+ });
747
+ if (seats.length && !stops.length) throw new Refused(`${at}.stops`, "at least one stop, for its seats to be boarded");
748
+ return { id: x.id, ...(x.label !== undefined ? { label: x.label.trim() } : {}), sprite: x.sprite === undefined ? null : checkStrip(x.sprite, `${at}.sprite`, scale),
749
+ ...(sprites ? { sprites } : {}), ...(fronts && Object.keys(fronts).length ? { fronts } : {}), path, speed, stops, seats };
750
+ });
751
+ }
752
+
696
753
  /** M-3432 (#4255): a pack's optional `snacks` list — 1–12 snack items with sprites, optional eat overlay, and attraction radius. */
697
754
  function snacksOf(v, scale) {
698
755
  if (v === undefined) return [];
@@ -742,7 +799,7 @@ export function checkLevels(v) {
742
799
  export function checkSkinPack(x, { kept = false } = {}) {
743
800
  try {
744
801
  obj(x, "pack");
745
- keys(x, ["format", "id", "scale", "canvas", "background", "foreground", "matte", "areas", "stateZones", "door", "mailDrop", "waypoints", "edges", "straight", "furniture", "characters", "byInstance", "props", "bubbles", "bubblesByInstance", "room", "desk", "levels", "portraits", "dialogBox", "idleVisits", "snacks", "card"], "pack");
802
+ keys(x, ["format", "id", "scale", "canvas", "background", "foreground", "matte", "areas", "stateZones", "door", "mailDrop", "waypoints", "edges", "straight", "furniture", "characters", "byInstance", "props", "bubbles", "bubblesByInstance", "room", "desk", "levels", "portraits", "dialogBox", "idleVisits", "snacks", "card", "vehicles"], "pack");
746
803
  if (x.format !== 1) throw new Refused("format", "1");
747
804
  if (typeof x.id !== "string" || !ID.test(x.id)) throw new Refused("id", "1–40 letters, digits, _ or -");
748
805
  if (BUILT_IN.has(x.id) || (!kept && RESERVED.has(x.id))) throw new Refused("id", "a built-in skin's id");
@@ -850,6 +907,7 @@ export function checkSkinPack(x, { kept = false } = {}) {
850
907
  const levels = levelsOf(x.levels);
851
908
  const portraits = portraitsOf(x.portraits, fids), dialogBox = dialogBoxOf(x.dialogBox), card = cardOf(x.card);
852
909
  const snacks = snacksOf(x.snacks, scale);
910
+ const vehicles = vehiclesOf(x.vehicles, scale);
853
911
  const room = x.room === undefined ? {} : obj(x.room, "room"), desk = x.desk === undefined ? {} : obj(x.desk, "desk");
854
912
  keys(room, ["floor", "wall"], "room"); keys(desk, ["back", "front", "lit"], "desk");
855
913
  const opt = (v, at) => (v === undefined ? undefined : src(v, at));
@@ -863,7 +921,7 @@ export function checkSkinPack(x, { kept = false } = {}) {
863
921
  room: { floor: opt(room.floor, "room.floor"), wall: opt(room.wall, "room.wall") }, desk: { back: opt(desk.back, "desk.back"), front: opt(desk.front, "desk.front"), lit: opt(desk.lit, "desk.lit") },
864
922
  ...(levels ? { levels } : {}), ...(idleVisits.length ? { idleVisits } : {}),
865
923
  ...(portraits ? { portraits } : {}), ...(dialogBox ? { dialogBox } : {}),
866
- ...(snacks.length ? { snacks } : {}), ...(card ? { card } : {}),
924
+ ...(snacks.length ? { snacks } : {}), ...(card ? { card } : {}), ...(vehicles.length ? { vehicles } : {}),
867
925
  } };
868
926
  } catch (err) {
869
927
  if (err instanceof Refused) return { ok: false, error: err.message };
@@ -908,6 +966,11 @@ export function packStrips(pack) {
908
966
  if (sn.sprite) out.push({ at: `snacks.${sn.id}.sprite`, strip: sn.sprite });
909
967
  if (sn.eat) out.push({ at: `snacks.${sn.id}.eat`, strip: sn.eat });
910
968
  }
969
+ for (const v of pack.vehicles || []) {
970
+ if (v.sprite) out.push({ at: `vehicles.${v.id}.sprite`, strip: v.sprite });
971
+ for (const [h, st] of Object.entries(v.sprites || {})) out.push({ at: `vehicles.${v.id}.sprites.${h}`, strip: st });
972
+ for (const [h, st] of Object.entries(v.fronts || {})) out.push({ at: `vehicles.${v.id}.fronts.${h}`, strip: st });
973
+ }
911
974
  return out;
912
975
  }
913
976
 
@@ -38,7 +38,7 @@
38
38
  // @property {(look, at) => {x, y, w, h}} [charBox] zones: the box drawCharacter covers with the feet at `at`
39
39
  // ({ x, y, walking, heading }): what hover and click hit (fleet-office-zones.js personAt)
40
40
  // @property {(ctx, prop, ms, env) => void} drawProp a traffic item in the air: { kind, hue, x, y, t }
41
- // @property {(ctx, x, y, text, env, lift?) => void} drawBubble a speech bubble whose tail points at (x, y), its box `lift` px higher
41
+ // @property {(ctx, x, y, text, env, lift?, flip?) => void} drawBubble a speech bubble whose tail points at (x, y), its box `lift` px higher (`flip`: on the tail's left)
42
42
  // @property {(env) => string} matte #2540: the colour around the scene (the Office fills the panel; the scene is 16:9)
43
43
  // @property {object|null} [backdrop] a pack's loaded background picture (the page samples its edges for the matte)
44
44
  // The desks layout's back and front layers change only when the fleet (or the zoom) does: the renderer keeps them as
@@ -48,6 +48,7 @@
48
48
  import { t } from "/assets/app-i18n.js";
49
49
  import { frameAt, nameHash } from "./fleet-office-model.js";
50
50
  import { CHAR_DEPTH, LOGICAL, canvasOf, checkSkinPack, own, packPortraitImages, packSceneImages, poseStrip, stripBox, stripCell, stripFrameAt, stripImages, walkStrip } from "./fleet-office-pack.js";
51
+ import { facing } from "./fleet-office-vehicles.js";
51
52
  import { tierColours } from "./fleet-office-levels.js";
52
53
  import { assetUrl } from "/assets/asset-url.js";
53
54
 
@@ -343,19 +344,23 @@ const BUBBLE_FONT = "600 11px system-ui, sans-serif";
343
344
  * The box a speech bubble with its tail at (x, y) takes for `text` (its tail excluded): what drawBubble draws, and what
344
345
  * the Office places so no two overlap (#2431: two neighbours' bubbles covered each other on a phone).
345
346
  */
346
- export function bubbleBox(ctx, x, y, text, lift = 0) {
347
+ export function bubbleBox(ctx, x, y, text, lift = 0, flip = false) {
347
348
  ctx.save();
348
349
  ctx.font = BUBBLE_FONT;
349
350
  const t = fitText(ctx, text, 150), w = Math.ceil((ctx.measureText ? ctx.measureText(t).width : t.length * 6) + 14), h = 19;
350
351
  ctx.restore();
351
- const bx = Math.round(x - 10), by = Math.round(y - h - 6 - lift);
352
+ // M-3722: `flip` puts the box on the tail's left (its tail still under it), for a call whose usual place covers a name.
353
+ const bx = Math.round(flip ? x - w + 14 : x - 10), by = Math.round(y - h - 6 - lift);
352
354
  return { x: bx, y: by, w, h, text: t };
353
355
  }
354
356
 
355
- /** A speech bubble, its tail at (x, y): short words on light paper in either theme; `lift` raises the box (its tail longer). */
356
- function drawBubble(ctx, x, y, text, env, lift = 0) {
357
+ /**
358
+ * A speech bubble, its tail at (x, y): short words on light paper in either theme; `lift` raises the box (its tail
359
+ * longer); `flip` (M-3722) draws the box on the tail's left.
360
+ */
361
+ function drawBubble(ctx, x, y, text, env, lift = 0, flip = false) {
357
362
  if (!text) return;
358
- const { x: bx, y: by, w, h, text: t } = bubbleBox(ctx, x, y, text, lift);
363
+ const { x: bx, y: by, w, h, text: t } = bubbleBox(ctx, x, y, text, lift, flip);
359
364
  ctx.save();
360
365
  ctx.font = BUBBLE_FONT;
361
366
  ctx.fillStyle = "#fffdf6"; ctx.strokeStyle = env.mode === "light" ? "rgba(0, 0, 0, 0.35)" : "rgba(0, 0, 0, 0.6)"; ctx.lineWidth = 1;
@@ -377,13 +382,19 @@ const TAG_FONT = "600 10px system-ui, sans-serif";
377
382
  const COMPACT = { font: "500 9px system-ui, sans-serif", textW: 48, pad: 6, top: 2, h: 11 };
378
383
  const NORMAL = { font: TAG_FONT, textW: TAG_TEXT_W, pad: 10, top: 3, h: 14 };
379
384
  /** The box a name tag under feet at (x, y) takes (what drawTag draws; bubbles keep clear of it, #2513). */
385
+ const tagSizes = new Map();
380
386
  export function tagBox(ctx, x, y, label, compact = false, fit = null) {
381
- const k = compact ? COMPACT : NORMAL;
382
- ctx.save();
383
- ctx.font = k.font;
384
- const t = fitText(ctx, label, k.textW, fit), w = Math.ceil((ctx.measureText ? ctx.measureText(t).width : t.length * 6) + k.pad);
385
- ctx.restore();
386
- return { x: Math.round(x - w / 2), y: y + k.top, w, h: k.h, text: t };
387
+ const k = compact ? COMPACT : NORMAL, key = `${compact ? 1 : 0}${label}`, keep = !!ctx.measureText && !fit; // a fit of its own: measured each time
388
+ let m = keep ? tagSizes.get(key) : null;
389
+ if (!m) {
390
+ ctx.save();
391
+ ctx.font = k.font;
392
+ const t = fitText(ctx, label, k.textW, fit);
393
+ m = { t, w: Math.ceil((ctx.measureText ? ctx.measureText(t).width : t.length * 6) + k.pad) };
394
+ ctx.restore();
395
+ if (keep) { if (tagSizes.size > 500) tagSizes.clear(); tagSizes.set(key, m); }
396
+ }
397
+ return { x: Math.round(x - m.w / 2), y: y + k.top, w: m.w, h: k.h, text: m.t };
387
398
  }
388
399
  /** #2860: what a tag covers with its level badge: on a full tag's top-left corner (clear of the first letter); left of a compact one. */
389
400
  export function tagFootprint(ctx, box, badge, compact = false) {
@@ -654,6 +665,19 @@ export function styleSeats(id) {
654
665
 
655
666
  // ── Skin packs ──
656
667
 
668
+ /**
669
+ * A whole-scene picture (`im`, drawn `w` logical units wide): unsmoothed at 1 device px per picture px or more (pixel
670
+ * art), smoothed (high) when shrunk below that — nearest-neighbour there drops most of its thin lines and keeps others
671
+ * in uneven clusters (a big pack's fit on a phone). Read from the canvas's transform (none: unsmoothed, as before).
672
+ */
673
+ export function sceneSmoothing(ctx, im, w) {
674
+ const t = typeof ctx.getTransform === "function" ? ctx.getTransform() : null;
675
+ const shrunk = !!t && !!im.width && Math.hypot(t.a, t.b) * w < im.width;
676
+ ctx.imageSmoothingEnabled = shrunk;
677
+ if (shrunk) ctx.imageSmoothingQuality = "high";
678
+ return shrunk;
679
+ }
680
+
657
681
  /**
658
682
  * An OfficeSkin from a checked pack (fleet-office-pack.js checkSkinPack) and its loaded pictures (`images`: src → a
659
683
  * drawable image). What it lacks, or a picture not loaded, is drawn by the built-in skins.
@@ -745,12 +769,26 @@ export function spriteSkin(pack, images, base = pixelSkin) {
745
769
  drawBackground(ctx, L, env) {
746
770
  const im = img(pack.background);
747
771
  if (!im) { drawBackground(ctx, L, env); return; }
748
- ctx.save(); ctx.imageSmoothingEnabled = false; ctx.drawImage(im, 0, 0, canvasOf(pack).w, canvasOf(pack).h); ctx.restore();
772
+ ctx.save(); sceneSmoothing(ctx, im, canvasOf(pack).w); ctx.drawImage(im, 0, 0, canvasOf(pack).w, canvasOf(pack).h); ctx.restore();
749
773
  },
750
774
  drawForeground(ctx, L, env) {
751
775
  const im = img(pack.foreground);
752
776
  if (!im) return;
753
- ctx.save(); ctx.imageSmoothingEnabled = false; ctx.drawImage(im, 0, 0, canvasOf(pack).w, canvasOf(pack).h); ctx.restore();
777
+ ctx.save(); sceneSmoothing(ctx, im, canvasOf(pack).w); ctx.drawImage(im, 0, 0, canvasOf(pack).w, canvasOf(pack).h); ctx.restore();
778
+ },
779
+ /** A pack's vehicle where it is (`at`, fleet-office-vehicles.js vehicleAt): its picture for the way it faces
780
+ * (`sprites` by heading; else `sprite`, mirrored going left), playing while it moves, its first frame at a stop. */
781
+ drawVehicle(ctx, v, at, ms, env) {
782
+ const dir = facing(at.heading), by = v.sprites || {};
783
+ const st = by[dir] || (dir === "left" && by.right) || v.sprite || by.right || by.left || by.down || by.up;
784
+ if (!st) return;
785
+ const mirror = !by[dir] && dir === "left";
786
+ strip(ctx, st, at.stop === null ? clipMs(env, `v:${v.id}`, st, ms) : 0, at.x, at.y, at.stop === null ? null : 0, mirror);
787
+ },
788
+ /** Its front edge (`fronts` for the way it faces; going left, `right`'s mirrored), over the riders. */
789
+ drawVehicleFront(ctx, v, at, ms, env) {
790
+ const dir = facing(at.heading), by = v.fronts || {}, st = by[dir] || (dir === "left" && by.right) || null;
791
+ if (st) strip(ctx, st, 0, at.x, at.y, 0, !by[dir] && dir === "left");
754
792
  },
755
793
  drawFurniture(ctx, f, active, ms, env) {
756
794
  if (f.shape) { drawFurniture(ctx, f, active, ms, env); return; }
@@ -26,6 +26,19 @@ const CHOICE_KEY = "agend_org_office", FILTER_KEY = "agend_org_office_filter", S
26
26
  const PLAY_KEY = "agend_org_office_play";
27
27
  /** M-3293: the agents told about their pats and feeds, from this device (a list of names; default: none). */
28
28
  const TELL_KEY = "agend_org_office_tell";
29
+ const MINI_OFF_KEY = "agend_org_office_hide_minimap", NAMES_OFF_KEY = "agend_org_office_hide_names", RENAME_KEY = "agend_org_office_names";
30
+ /** A name this browser gives a person: at most this long; at most RENAME_MAX of them kept. */
31
+ export const RENAME_LEN = 24, RENAME_MAX = 200;
32
+ /** The names this browser gives people ({ instance: name }), kept only when each is a short one-line string. */
33
+ export function renamesOk(v) {
34
+ if (!v || typeof v !== "object" || Array.isArray(v)) return {};
35
+ const out = {};
36
+ for (const [k, n] of Object.entries(v).slice(0, RENAME_MAX)) {
37
+ const s = typeof n === "string" ? n.replace(/[\u0000-\u001f\u007f]/g, "").trim() : "";
38
+ if (k && k.length <= 200 && s && s.length <= RENAME_LEN) out[k] = s;
39
+ }
40
+ return out;
41
+ }
29
42
  const TELL_MAX = 200;
30
43
  /** #2554: "0" when All offices leaves the lobby tile out (default: shown). */
31
44
  const LOBBY_KEY = "agend_org_office_lobby";
@@ -100,10 +113,11 @@ export function actsOk(list, now) {
100
113
  const str = (v) => typeof v === "string" && v.length > 0 && v.length <= 200, num = (v) => typeof v === "number" && Number.isFinite(v);
101
114
  return (Array.isArray(list) ? list : []).filter((a) => a && typeof a === "object" && str(a.instance) && str(a.office) && num(a.until)
102
115
  && (a.x === undefined || num(a.x)) && (a.y === undefined || num(a.y)) && (a.person === undefined || str(a.person))
103
- && (a.say === undefined || (typeof a.say === "string" && a.say.length <= 40)) && (a.pose === undefined || ["idle", "working", "needs", "paused"].includes(a.pose)))
116
+ && (a.say === undefined || (typeof a.say === "string" && a.say.length <= 40)) && (a.pose === undefined || ["idle", "working", "needs", "paused"].includes(a.pose))
117
+ && (a.ride === undefined || str(a.ride)))
104
118
  .map((a) => ({ instance: a.instance, office: a.office, until: a.until - skew, ...(num(a.since) ? { since: a.since } : {}), ...(str(a.state) ? { state: a.state } : {}),
105
119
  ...(num(a.x) && num(a.y) ? { x: a.x, y: a.y } : {}),
106
- ...(a.person ? { person: a.person } : {}), ...(a.say ? { say: a.say } : {}), ...(a.pose ? { pose: a.pose } : {}) }));
120
+ ...(a.person ? { person: a.person } : {}), ...(a.say ? { say: a.say } : {}), ...(a.pose ? { pose: a.pose } : {}), ...(a.ride ? { ride: a.ride } : {}) }));
107
121
  }
108
122
  export function createOfficeStore({ fetch: get = globalThis.fetch, storage } = {}) {
109
123
  const st = () => { try { return storage || globalThis.localStorage || null; } catch { return null; } };
@@ -243,6 +257,23 @@ export function createOfficeStore({ fetch: get = globalThis.fetch, storage } = {
243
257
  /** Whether paused and stopped people are left out of the Office here (default: shown). */
244
258
  hideAsleep: () => read(ASLEEP_KEY) === "1",
245
259
  saveHideAsleep: (v) => write(ASLEEP_KEY, v ? "1" : "0"),
260
+ /** Whether the name tags (and their level badges) are left out of the scene here (default: shown). */
261
+ namesOff: () => read(NAMES_OFF_KEY) === "1",
262
+ saveNamesOff: (v) => write(NAMES_OFF_KEY, v ? "1" : "0"),
263
+ /** Whether the minimap is left out here (default: shown). */
264
+ miniOff: () => read(MINI_OFF_KEY) === "1",
265
+ saveMiniOff: (v) => write(MINI_OFF_KEY, v ? "1" : "0"),
266
+ /** The names this browser gives people ({ instance: name }); only this browser sees them. */
267
+ renames: () => { try { return renamesOk(JSON.parse(read(RENAME_KEY) || "{}")); } catch { return {}; } },
268
+ /** Give `instance` a name here ("" gives back its own); the names as they are now. */
269
+ saveRename: (instance, name) => {
270
+ let all = {};
271
+ try { all = renamesOk(JSON.parse(read(RENAME_KEY) || "{}")); } catch { /* none */ }
272
+ delete all[instance];
273
+ const next = renamesOk(name ? { ...all, [instance]: name } : all);
274
+ write(RENAME_KEY, JSON.stringify(next));
275
+ return next;
276
+ },
246
277
  /** #2568: whether the idle go to bed at night (00:00–06:00 on this device's clock) here (default: off). */
247
278
  nightOn: () => read(NIGHT_KEY) === "1",
248
279
  saveNightOn: (v) => write(NIGHT_KEY, v ? "1" : "0"),