@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
package/dist/web-api.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type ClaudeCredentialApi } from "./web-claude-credentials.js";
2
2
  import { type ContactApiHost } from "./contact-auth-api.js";
3
- import { type HumanOrigin } from "./human-delivery-receipts.js";
3
+ import { type HumanOrigin, type WebSessionIdentity } from "./human-delivery-receipts.js";
4
4
  import { type HumanAuthority, type WebAuthorityResult, type WebPeer } from "./authority/web-authority.js";
5
5
  import type { CachedImage } from "./web-images.js";
6
6
  import type { SettingsExecution } from "./settings-transaction.js";
@@ -70,6 +70,11 @@ export interface WebApiContext extends ClaudeCredentialApi {
70
70
  decideContactAuthorization?: ContactApiHost["decideContactAuthorization"];
71
71
  contactActor?(req: IncomingMessage, url: URL): import("./contact-auth-types.js").ContactPerson | null;
72
72
  contactNeeds?(actor: import("./contact-auth-types.js").ContactPerson): unknown[];
73
+ /** M-3710: the pending contact requests' count and the oldest one's time — nothing that names them. */
74
+ contactPendingCount?(): {
75
+ count: number;
76
+ since: number;
77
+ };
73
78
  acknowledgeContactSuggestion?(instance: string, actor: import("./contact-auth-types.js").ContactPerson): void;
74
79
  acknowledgeContactSuggestionFromWeb?(instance: string, req: IncomingMessage, url: URL): void;
75
80
  contactSuggestionActor?(req: IncomingMessage, url: URL): import("./contact-auth-types.js").ContactPerson | null;
@@ -157,6 +162,9 @@ export interface WebApiContext extends ClaudeCredentialApi {
157
162
  defaults?: {
158
163
  backend?: string;
159
164
  effort?: string;
165
+ task_board?: {
166
+ archive_after_days?: number;
167
+ };
160
168
  };
161
169
  instances: Record<string, {
162
170
  topic_id?: number | string;
@@ -424,6 +432,7 @@ export interface WebApiContext extends ClaudeCredentialApi {
424
432
  publicLink: boolean;
425
433
  person?: WebPerson;
426
434
  authority?: HumanAuthority;
435
+ identity?: WebSessionIdentity;
427
436
  guest?: boolean;
428
437
  }): Promise<{
429
438
  status: number;
@@ -452,7 +461,9 @@ export interface WebApiContext extends ClaudeCredentialApi {
452
461
  expiresInMs?: number;
453
462
  reason?: string;
454
463
  };
455
- /** #1939 S1: the design's §3 for one request (`instance` once the body names it); absent: web carries no authority. */
464
+ /** Session-account recognition only, independent of verification and action authority. */
465
+ webSessionIdentity?(session: SessionRecord): WebSessionIdentity | undefined;
466
+ /** #1939 S1: authority for one request; absent means no web authority. */
456
467
  webAuthority?(input: {
457
468
  session: SessionRecord | null;
458
469
  gateway: boolean;
@@ -479,6 +490,10 @@ export interface WebApiContext extends ClaudeCredentialApi {
479
490
  message: string;
480
491
  };
481
492
  /** M-3632: Needs you → "Try again" on held Hub work. */
493
+ closeHubHeld?(id: string, actor: import("./contact-auth-types.js").ContactPerson): Promise<{
494
+ status: number;
495
+ code: string;
496
+ }>;
482
497
  retryHubHeld?(id: string): {
483
498
  status: number;
484
499
  code: string;
@@ -555,6 +570,7 @@ export interface WebApiContext extends ClaudeCredentialApi {
555
570
  name: string;
556
571
  guest?: true;
557
572
  authority?: HumanAuthority;
573
+ identity?: WebSessionIdentity;
558
574
  }): Promise<{
559
575
  status: number;
560
576
  error?: string;
package/dist/web-api.js CHANGED
@@ -26,7 +26,7 @@ import { AGENT_WIDGET_SLOTS, checkWidgetData, checkWidgetSpec } from "./web-widg
26
26
  import { checkOwnerCss, ownerCssAssetRefs } from "./web-owner-css.js";
27
27
  import { canonicalText } from "./web-theme.js";
28
28
  import { parsePinKey } from "./web-pin-store.js";
29
- import { SKIN_WIRE_BYTES } from "./web-office-skins.js";
29
+ import { SKIN_WIRE_BYTES, skinPictureType } from "./web-office-skins.js";
30
30
  import { gatewayRequestContext } from "./web-request-context.js";
31
31
  import { crossInstanceVisibility } from "./cross-instance-notice.js";
32
32
  import { permitWebContinuation } from "./web-continuation.js";
@@ -44,7 +44,8 @@ import { MAX_COMMAND_ARGS } from "./web-commands.js";
44
44
  import { ROUTE_WORKER_CSP, ROUTE_WORKER_PATH, sendPanelHtml } from "./web-host-guard.js";
45
45
  import { libavoidFile } from "./web-libavoid.js";
46
46
  import { shellRoute } from "./web-shell-routes.js";
47
- import { createReadStream, createWriteStream, existsSync, readFileSync, closeSync } from "node:fs";
47
+ import { createReadStream, createWriteStream, existsSync, readFileSync, closeSync, constants as fsConstants } from "node:fs";
48
+ import { open as openFile } from "node:fs/promises";
48
49
  import { servedAssets } from "./auth-api.js";
49
50
  import { assetIntact, assetsUnchanged, assetVersion, assetVersionMark, answerStaleAsset, buildModuleGraph, staticClosure, versionShell, IMMUTABLE_PRIVATE } from "./web-asset-version.js";
50
51
  import { join, dirname } from "node:path";
@@ -53,7 +54,7 @@ import { createHash, createHmac, randomUUID } from "node:crypto";
53
54
  import { CreateInstanceArgs, CreateScheduleArgs, UpdateScheduleArgs, validateArgs } from "./outbound-schemas.js";
54
55
  import { scheduleView } from "./web-schedules.js";
55
56
  import { DEFAULT_SCHEDULER_CONFIG } from "./scheduler/index.js";
56
- import { CARD_PRIORITIES, CARD_SIZES, CARD_STATUSES, TaskBoardError, cardCode } from "./scheduler/task-board.js";
57
+ import { CARD_PRIORITIES, CARD_SIZES, CARD_STATUSES, TaskBoardError, archiveAfterDays, cardCode } from "./scheduler/task-board.js";
57
58
  import { TASK_REF_SEPARATOR, cardsForRefs, taskReadWay, taskRefBlock, taskRefCodes, taskRefView } from "./chat-task-refs.js";
58
59
  import { readStatuslineModel, resolveInstanceContext } from "./topic-commands.js";
59
60
  import { z } from "zod";
@@ -241,7 +242,12 @@ function contactNeedsFor(req, url, ctx, base) {
241
242
  // A session identity may see benign room suggestions, never pending approval tickets.
242
243
  const suggestions = observer && ctx.contactNeeds ? ctx.contactNeeds(observer).filter(item => item && typeof item === "object"
243
244
  && item.reason === "contact_restricted_suggestion") : [];
244
- return [...ordinary, ...suggestions];
245
+ // M-3710 (R21079937, 11-25: a pending request was in no list, even on this computer): an admin session with no verified
246
+ // person behind it is told how many requests wait and to authorize this browser — the count only, never which.
247
+ const waiting = admin ? ctx.contactPendingCount?.() : undefined;
248
+ const verify = waiting && waiting.count > 0 ? [{ id: "contact-verify", type: "contact", reason: "contact_verify_needed", instance: "",
249
+ since: waiting.since, detail: "", contactVerify: { count: waiting.count } }] : [];
250
+ return [...ordinary, ...verify, ...suggestions];
245
251
  }
246
252
  /**
247
253
  * The task board's rule over the public link: an instance kept out of sight (cross_instance_visibility: hidden) is not
@@ -269,7 +275,9 @@ function boardHiding(ctx, gateway) {
269
275
  const fleet = ctx.fleetConfig;
270
276
  const hiddenName = (n) => gateway && typeof n === "string" && !!n && !!ctx.fleetConfig?.instances?.[n] && crossInstanceVisibility(fleet, n) === "hidden";
271
277
  const hidden = (c) => [c.assignee, c.createdBy, c.dispatcher?.name].some(hiddenName);
272
- return { hiddenName, hidden };
278
+ /** M-3668 review: the names hiddenName() refuses, for a read that must leave them out before it pages (the Archive). */
279
+ const hiddenNames = () => Object.keys(ctx.fleetConfig?.instances ?? {}).filter(hiddenName);
280
+ return { hiddenName, hidden, hiddenNames };
273
281
  }
274
282
  /**
275
283
  * Chat history as the public link may see it (#2341 review): a status line that names board cards (the daily summary)
@@ -936,7 +944,7 @@ function handlePageShare(req, res, url, ctx, path, method) {
936
944
  }
937
945
  /**
938
946
  * #2716/#3679: an Office-wide setting kept in web-offices.json beside the offices (PUT { <key>: value }): who may save
939
- * the offices may set it — an admin session, never the CLI token or the public link; asked again once the body is in;
947
+ * the offices may set it — an admin session (over the public link too, M-3278), never the CLI token; asked again once the body is in;
940
948
  * counted with the offices' saves (OfficeWriteLimiter); every page hears `offices` and reads again.
941
949
  */
942
950
  function officeSettingPut(req, res, url, ctx, o) {
@@ -1042,7 +1050,7 @@ function handleOfficeSkins(req, res, url, ctx, path, method) {
1042
1050
  json(res, 404, { error: "No such image" });
1043
1051
  return true;
1044
1052
  }
1045
- res.setHeader("Content-Type", "image/png");
1053
+ res.setHeader("Content-Type", skinPictureType(bytes));
1046
1054
  // Keyed by the sha of its bytes: a picture at this URL never changes.
1047
1055
  res.setHeader("Cache-Control", "private, max-age=31536000, immutable");
1048
1056
  res.setHeader("Content-Security-Policy", "default-src 'none'; sandbox");
@@ -2332,6 +2340,11 @@ function webPersonOf(req, url, ctx) {
2332
2340
  const who = webAccountOf(req, url, ctx);
2333
2341
  return who ? ctx.webPerson(who.owner) : null;
2334
2342
  }
2343
+ /** Current session recognition only; no header token, body, display name or voter key supplies an account. */
2344
+ function webIdentityOf(req, url, ctx) {
2345
+ const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
2346
+ return v.kind === "allow" && v.via === "session" ? ctx.webSessionIdentity?.(v.session) : undefined;
2347
+ }
2335
2348
  /**
2336
2349
  * #1939 S1: whether this request carries `web-session` authority, asked as it stands now — on arrival without an instance,
2337
2350
  * after the body with the one it names (then confirmAfterBody joins the two). Never touches the session.
@@ -2540,6 +2553,51 @@ function boardActor(req, url, ctx, p) {
2540
2553
  * A board refusal as the dashboard reads it: the board's sentence, its code and the status that fits, and — when the
2541
2554
  * person can meet it — the key and values the page says it with in its own language.
2542
2555
  */
2556
+ /**
2557
+ * GET /ui/tasks/files/<id> — a file an agent put on a card, sent as a DOWNLOAD. It is read with the card: any
2558
+ * session that may read the card may fetch it, and over the public link a card kept out of sight (or its main task), or a
2559
+ * file one of those instances wrote, is "no such file" — the same answer an unknown id gets. Never sent as a page: an image
2560
+ * as an image, text as plain text, everything else (HTML and SVG included) as an opaque download, under a sandboxing CSP and
2561
+ * `nosniff`; what the dashboard shows of an HTML file it fetches and runs in the preview frame, never from here.
2562
+ */
2563
+ async function serveCardFile(res, board, id, rules) {
2564
+ const miss = () => { if (!res.headersSent)
2565
+ json(res, 404, { error: "No such file" }); };
2566
+ try {
2567
+ const found = board.attachment(id);
2568
+ const store = board.files();
2569
+ if (!found || !store || rules.hidden(found.card) || rules.hiddenName(found.file.author))
2570
+ return miss();
2571
+ const on = store.pathOf(found.card.uuid, id);
2572
+ if (!on || on.size !== found.file.size)
2573
+ return miss();
2574
+ // O_NOFOLLOW is undefined on Windows (the flag is then 0): there the isFile and size checks below stand alone (docs/design/task-board.md).
2575
+ const fh = await openFile(on.path, fsConstants.O_RDONLY | fsConstants.O_NOFOLLOW);
2576
+ let bytes;
2577
+ try {
2578
+ const st = await fh.stat();
2579
+ if (!st.isFile() || st.size !== found.file.size)
2580
+ return miss();
2581
+ bytes = await fh.readFile();
2582
+ }
2583
+ finally {
2584
+ await fh.close().catch(() => { });
2585
+ }
2586
+ const { file } = found;
2587
+ const inline = INLINE_MIME.has(file.mime);
2588
+ res.setHeader("Content-Type", inline ? file.mime : file.mime.startsWith("text/") ? "text/plain; charset=utf-8" : "application/octet-stream");
2589
+ res.setHeader("Content-Disposition", `${inline ? "inline" : "attachment"}; filename*=UTF-8''${encodeURIComponent(wellFormed(file.name))}`);
2590
+ res.setHeader("Content-Length", bytes.length);
2591
+ res.setHeader("X-Content-Type-Options", "nosniff");
2592
+ res.setHeader("Cache-Control", "private, no-store");
2593
+ res.setHeader("Content-Security-Policy", "default-src 'none'; img-src 'self'; style-src 'unsafe-inline'; sandbox");
2594
+ res.writeHead(200);
2595
+ res.end(bytes);
2596
+ }
2597
+ catch {
2598
+ miss();
2599
+ }
2600
+ }
2543
2601
  function boardError(res, err) {
2544
2602
  if (res.headersSent)
2545
2603
  return;
@@ -3909,8 +3967,9 @@ export function handleWebRequest(req, res, url, ctx) {
3909
3967
  // ── Fleet → Org chart → Office: the offices people made (web-offices.json, web-office-store.ts) ──
3910
3968
  // GET /ui/offices: { rev, offices, readable } for whoever may open the org chart (the public link too: it reads the
3911
3969
  // chart; a guest's routes do not include it). PUT /ui/offices { offices, rev? }: a person's change, as a theme's reset
3912
- // or lock is — an admin session only, never the CLI token, never the public link (absent from its manifest, and
3913
- // refused here too); asked again once the body is in. Every page hears `offices` on the stream and reads again.
3970
+ // or lock is — an admin session only (over the public link too since M-3278, decision 7933bf90; a read-only session
3971
+ // there is refused below), never the CLI token; asked again once the body is in. Every page hears `offices` on the
3972
+ // stream and reads again.
3914
3973
  if (method === "GET" && path === "/ui/offices") {
3915
3974
  const store = ctx.officeStore;
3916
3975
  if (!store) {
@@ -3998,7 +4057,7 @@ export function handleWebRequest(req, res, url, ctx) {
3998
4057
  }
3999
4058
  // #2716: PUT /ui/office-style { skin }: the whole-fleet office's style for every viewer, device and share link (a skin
4000
4059
  // id, or null for the default; read back as GET /ui/offices's autoSkin). Who may save the offices may set it, as they
4001
- // would: an admin session, never the CLI token or the public link; asked again once the body is in; counted with the
4060
+ // would: an admin session (over the public link too, M-3278), never the CLI token; asked again once the body is in; counted with the
4002
4061
  // offices' saves. Every page hears `offices` and reads again.
4003
4062
  if (method === "PUT" && path === "/ui/office-style") {
4004
4063
  return officeSettingPut(req, res, url, ctx, { key: "skin", invalid: "office_style_invalid", shape: "{ skin: a skin id, or null }", failed: "Saving the office style failed",
@@ -4278,7 +4337,8 @@ export function handleWebRequest(req, res, url, ctx) {
4278
4337
  return;
4279
4338
  // #1920 review: a guest's choice reaches the agent marked as a guest's, as its typed messages do.
4280
4339
  const { authority } = confirmAfterBody(arrival, webAuthorityOf(req, url, ctx, instance));
4281
- const r = await click(instance, id, index, { key: person.voterKey, userId: person.userId, name: person.name, ...(guest ? { guest: true } : {}), authority });
4340
+ const identity = webIdentityOf(req, url, ctx);
4341
+ const r = await click(instance, id, index, { key: person.voterKey, userId: person.userId, name: person.name, ...(guest ? { guest: true } : {}), authority, ...(identity ? { identity } : {}) });
4282
4342
  json(res, r.status, r.status === 200 ? { answered: true, ...(r.options ? { options: r.options } : {}) } : { error: r.error ?? "Refused", ...(r.status === 409 ? { gone: true } : {}) });
4283
4343
  })().catch(err => {
4284
4344
  ctx.logger.error({ err: err.message }, "Web reply-button click failed");
@@ -4744,12 +4804,48 @@ export function handleWebRequest(req, res, url, ctx) {
4744
4804
  });
4745
4805
  return true;
4746
4806
  }
4807
+ if (method === "POST" && path === "/ui/needs/hub-close") {
4808
+ (async () => {
4809
+ let body;
4810
+ try {
4811
+ body = await parseBody(req);
4812
+ }
4813
+ catch {
4814
+ json(res, 400, { error: "invalid" });
4815
+ return;
4816
+ }
4817
+ if (!permitWebContinuation(req, res, ctx))
4818
+ return;
4819
+ const actor = ctx.contactActor?.(req, url);
4820
+ if (!actor) {
4821
+ json(res, 403, { error: "verification-required", code: "verification-required" });
4822
+ return;
4823
+ }
4824
+ if (typeof body.id !== "string" || body.id.length > 200) {
4825
+ json(res, 400, { error: "invalid" });
4826
+ return;
4827
+ }
4828
+ if (!ctx.closeHubHeld) {
4829
+ json(res, 503, { error: "unavailable", code: "unavailable" });
4830
+ return;
4831
+ }
4832
+ const out = await ctx.closeHubHeld(body.id, actor);
4833
+ json(res, out.status, { code: out.code, ...(out.status === 200 ? { ok: true } : { error: out.code }) });
4834
+ })().catch(() => { if (!res.headersSent)
4835
+ json(res, 503, { error: "unavailable", code: "unavailable" }); });
4836
+ return true;
4837
+ }
4747
4838
  // M-3632: Needs you → "Try again" on held Hub work: back through the Hub's checks, never a blind delivery.
4748
4839
  if (method === "POST" && path === "/ui/needs/hub-retry") {
4749
4840
  if (!ctx.retryHubHeld) {
4750
4841
  json(res, 404, { error: "not-found", code: "not-found" });
4751
4842
  return true;
4752
4843
  }
4844
+ // M-3680: over the public link, an admin session's (decision 7933bf90); a read-only session or a guest there: no.
4845
+ if (linkRestricted(req, url, ctx)) {
4846
+ json(res, 403, { error: "forbidden", code: "forbidden" });
4847
+ return true;
4848
+ }
4753
4849
  const retry = ctx.retryHubHeld.bind(ctx);
4754
4850
  (async () => {
4755
4851
  let body;
@@ -5000,10 +5096,11 @@ export function handleWebRequest(req, res, url, ctx) {
5000
5096
  }
5001
5097
  try {
5002
5098
  const { authority } = confirmAfterBody(arrival, webAuthorityOf(req, url, ctx, instance));
5099
+ const identity = webIdentityOf(req, url, ctx);
5003
5100
  const r = await run({ instance, command, args: str(body.args, MAX_COMMAND_ARGS), confirm: body.confirm, ...(body.action ? { action: body.action } : {}) },
5004
5101
  // M-3278 (decision 7933bf90): `publicLink` is a request over the link by anyone but an admin session — the link's
5005
5102
  // admin runs /save and gets /model and /backend's Sign in, as on the local dashboard.
5006
- { publicLink: !!gatewayRequestContext(req) && !adminAdmissionOf(req, url, ctx), person, authority, ...(guest ? { guest: true } : {}) });
5103
+ { publicLink: !!gatewayRequestContext(req) && !adminAdmissionOf(req, url, ctx), person, authority, ...(identity ? { identity } : {}), ...(guest ? { guest: true } : {}) });
5007
5104
  if (!stillAuthorized(req, res, url, ctx))
5008
5105
  return;
5009
5106
  json(res, r.status, r.body);
@@ -5330,8 +5427,10 @@ export function handleWebRequest(req, res, url, ctx) {
5330
5427
  }
5331
5428
  // ── Task board (scheduler/task-board.ts) ──────────────
5332
5429
  // Reads are the session's; every write is the signed-in person's, through the same rules an instance's tools use.
5333
- if (path === "/ui/tasks/board" || path === "/ui/tasks/search" || path === "/ui/tasks/refs" || path === "/ui/tasks/work" || path.startsWith("/ui/tasks/cards") || path.startsWith("/ui/tasks/projects")) {
5430
+ if (path === "/ui/tasks/board" || path === "/ui/tasks/search" || path === "/ui/tasks/refs" || path === "/ui/tasks/work" || path === "/ui/tasks/archive" || path.startsWith("/ui/tasks/cards") || path.startsWith("/ui/tasks/projects") || path.startsWith("/ui/tasks/files/")) {
5334
5431
  const board = ctx.scheduler?.db.board;
5432
+ // M-3668: how many days after it finished a main task leaves the board (defaults.task_board.archive_after_days).
5433
+ const archiveDays = archiveAfterDays(ctx.fleetConfig?.defaults?.task_board?.archive_after_days);
5335
5434
  if (!board) {
5336
5435
  json(res, 503, { error: "The task board is not available", code: "unavailable", key: "unavailable" });
5337
5436
  return true;
@@ -5345,7 +5444,7 @@ export function handleWebRequest(req, res, url, ctx) {
5345
5444
  return true;
5346
5445
  }
5347
5446
  // …nor shows the cards of instances kept out of sight (cross_instance_visibility: hidden).
5348
- const { hiddenName, hidden } = boardHiding(ctx, !!gateway);
5447
+ const { hiddenName, hidden, hiddenNames } = boardHiding(ctx, !!gateway);
5349
5448
  // #2303 review: what a visible card shows of the cards around it follows the same rule — its children, its main
5350
5449
  // task (a search hit's too) — and so do the words and the history a hidden instance left on it.
5351
5450
  // …and a hidden instance's words on a visible card are not counted, named or found there (#2304 review).
@@ -5422,10 +5521,15 @@ export function handleWebRequest(req, res, url, ctx) {
5422
5521
  try {
5423
5522
  const ref = card ? decodeURIComponent(card[1]) : "";
5424
5523
  if (method === "GET" && path === "/ui/tasks/board") {
5425
- // A page that has this revision already is told so, not sent the board again.
5524
+ // A page that has this revision already is told so, not sent the board again. #4428 review: and only when time
5525
+ // has not moved a card across one of the board's lines (archived, this week, the recent window) since it read:
5526
+ // `epoch` says where they stood (a page that sends none, an older one, always gets the board).
5426
5527
  const rev = board.revision();
5427
- if (url.searchParams.get("rev") === String(rev)) {
5428
- json(res, 200, { rev, unchanged: true });
5528
+ // #4428 review: over the public link the hidden instances' cards move neither the epoch nor any project number.
5529
+ const leaveOut = hiddenNames();
5530
+ const epoch = board.boardEpoch(archiveDays, undefined, leaveOut);
5531
+ if (url.searchParams.get("rev") === String(rev) && url.searchParams.get("epoch") === epoch) {
5532
+ json(res, 200, { rev, epoch, unchanged: true });
5429
5533
  return true;
5430
5534
  }
5431
5535
  const allDone = url.searchParams.get("done") === "all";
@@ -5436,19 +5540,19 @@ export function handleWebRequest(req, res, url, ctx) {
5436
5540
  // The instances with the task board switched off: no card is handed to them (the pickers mark them), and a
5437
5541
  // fleet.yaml edit changes them with the revision unchanged.
5438
5542
  const boardOff = taskBoardOffNames(ctx.fleetConfig).filter((n) => !hiddenName(n));
5439
- const key = gateway ? null : `${rev}:${allDone ? 1 : 0}:${Math.floor(Date.now() / 60_000)}:${board.goneDispatchers(ctx.dispatcherGone)}:${boardOff.join("\u0000")}`;
5543
+ const key = gateway ? null : `${rev}:${allDone ? 1 : 0}:${epoch}:${Math.floor(Date.now() / 60_000)}:${board.goneDispatchers(ctx.dispatcherGone)}:${boardOff.join("\u0000")}`;
5440
5544
  const kept = key ? boardBodies.get(board) : undefined;
5441
5545
  if (kept && kept.key === key) {
5442
5546
  jsonText(res, 200, kept.body);
5443
5547
  return true;
5444
5548
  }
5445
- const cards = board.boardCards(undefined, allDone).filter((c) => !hidden(c));
5549
+ const cards = board.boardCards(undefined, allDone, archiveDays).filter((c) => !hidden(c));
5446
5550
  // #2352: over the public link a hidden lead is not named (the project reads as having none).
5447
5551
  const projects = board.listProjects(true).map((p) => (p.leadInstance && hiddenName(p.leadInstance) ? { ...p, leadInstance: null } : p));
5448
5552
  // #2355 review: the names a project's lead may be — the fleet's instances (a Classic-only room is not one); over the
5449
5553
  // public link, not a hidden one.
5450
5554
  const leads = Object.keys(ctx.fleetConfig?.instances ?? {}).filter((n) => !hiddenName(n)).sort();
5451
- const body = JSON.stringify({ rev, cards: board.views(cards, scope, ctx.dispatcherGone).map(unnumbered), projects, leads, boardOff, stats: board.projectStats(ctx.dispatcherGone) });
5555
+ const body = JSON.stringify({ rev, cards: board.views(cards, scope, ctx.dispatcherGone).map(unnumbered), projects, leads, boardOff, stats: board.projectStats(ctx.dispatcherGone, archiveDays, leaveOut), archiveAfterDays: archiveDays, epoch });
5452
5556
  if (key)
5453
5557
  boardBodies.set(board, { key, body });
5454
5558
  jsonText(res, 200, body);
@@ -5497,6 +5601,8 @@ export function handleWebRequest(req, res, url, ctx) {
5497
5601
  const results = hits.map(({ card: c, match }, i) => ({
5498
5602
  card: views[i],
5499
5603
  match,
5604
+ // M-3668: a card the board has archived says so (its number and this search still open it).
5605
+ ...(board.isArchived(c, archiveDays) ? { archived: true } : {}),
5500
5606
  project: c.projectId === null ? null : names.get(c.projectId) ?? null,
5501
5607
  parentTitle: c.parent && !hiddenRef(c.parent) ? board.findCard(c.parent)?.title ?? null : null,
5502
5608
  }));
@@ -5517,13 +5623,39 @@ export function handleWebRequest(req, res, url, ctx) {
5517
5623
  json(res, 200, { refs: board.suggest((url.searchParams.get("q") ?? "").slice(0, 100), limit, (c) => !hidden(c)).map(taskRefView) });
5518
5624
  return true;
5519
5625
  }
5626
+ // a file on a card, as a download — the gate of reading the card (below), plus the file's own author.
5627
+ const cardFile = method === "GET" ? /^\/ui\/tasks\/files\/([0-9a-f]{32})$/.exec(path) : null;
5628
+ if (cardFile) {
5629
+ void serveCardFile(res, board, cardFile[1], {
5630
+ hidden: (c) => !!gateway && (hidden(c) || (!!c.parent && hiddenRef(c.parent))),
5631
+ hiddenName: (n) => !!gateway && hiddenName(n),
5632
+ });
5633
+ return true;
5634
+ }
5520
5635
  if (method === "GET" && card && !card[2]) {
5521
5636
  const found = board.getCard(ref);
5522
5637
  if (hidden(found)) {
5523
5638
  json(res, 404, { error: "no such card", code: "not_found" });
5524
5639
  return true;
5525
5640
  }
5526
- json(res, 200, shown(board.detail(ref, scope, ctx.dispatcherGone)));
5641
+ json(res, 200, { ...shown(board.detail(ref, scope, ctx.dispatcherGone)), ...(board.isArchived(found, archiveDays) ? { archived: true, archiveAfterDays: archiveDays } : {}) });
5642
+ return true;
5643
+ }
5644
+ if (method === "GET" && path === "/ui/tasks/archive") {
5645
+ // M-3668: a project's archived main tasks (`project`: an id, or "none"), newest first, a page at a time (`before`),
5646
+ // filtered by who had them (`assignee`). Over the public link, not a card that names an instance kept out of sight.
5647
+ const p = url.searchParams.get("project") ?? "none";
5648
+ const project = p === "none" ? null : /^\d{1,9}$/.test(p) ? Number(p) : NaN;
5649
+ if (Number.isNaN(project)) {
5650
+ json(res, 400, { error: "invalid project", code: "invalid" });
5651
+ return true;
5652
+ }
5653
+ const who = url.searchParams.get("assignee");
5654
+ // #4428 review: the hidden ones are left out inside the read, before its page, cursor, total and assignees.
5655
+ const list = board.archiveList(project, archiveDays, { before: url.searchParams.get("before"), limit: Number(url.searchParams.get("limit")) || 50,
5656
+ assignee: who && !hiddenName(who) ? who : null, leaveOut: hiddenNames() });
5657
+ json(res, 200, { cards: board.views(list.cards, scope, ctx.dispatcherGone).map(unnumbered), next: list.next, total: list.total,
5658
+ assignees: list.assignees, archiveAfterDays: archiveDays });
5527
5659
  return true;
5528
5660
  }
5529
5661
  if (method === "POST" && path === "/ui/tasks/cards") {
@@ -5642,7 +5774,7 @@ export function handleWebRequest(req, res, url, ctx) {
5642
5774
  return verdict.kind !== "allow" || (verdict.via === "session" && verdict.session?.tier !== "admin");
5643
5775
  };
5644
5776
  if (method === "POST" && path === "/ui/schedules") {
5645
- // #1724: schedules are not created, edited or deleted over the public link (absent from its manifest too, #1689).
5777
+ // #1724: an admin session's (M-3278, decision 7933bf90: over the public link too).
5646
5778
  if (!ctx.scheduler) {
5647
5779
  json(res, 500, { error: "Scheduler not initialized" });
5648
5780
  return true;
@@ -5890,7 +6022,7 @@ export function handleWebRequest(req, res, url, ctx) {
5890
6022
  return true;
5891
6023
  }
5892
6024
  if (method === "POST" && path === "/ui/teams") {
5893
- // #1689: not over the public link (absent from its manifest too), like editing and deleting a team.
6025
+ // #1689: an admin session's (M-3278, decision 7933bf90: over the public link too), like editing and deleting a team.
5894
6026
  (async () => {
5895
6027
  try {
5896
6028
  const body = await parseBody(req);
@@ -5920,7 +6052,7 @@ export function handleWebRequest(req, res, url, ctx) {
5920
6052
  return true;
5921
6053
  }
5922
6054
  // #1689: edit a team — the same update as the update_team tool (applyTeamUpdate), from the members the page sends:
5923
- // what to add and remove is worked out against the team as it is now. Never over the public link.
6055
+ // what to add and remove is worked out against the team as it is now. An admin session's, over the public link too (M-3278).
5924
6056
  const teamEditMatch = path.match(/^\/ui\/teams\/(.+)$/);
5925
6057
  if ((method === "PATCH" || method === "PUT") && teamEditMatch) {
5926
6058
  const name = decodeURIComponent(teamEditMatch[1]);
@@ -6242,7 +6374,7 @@ async function handleResendMessage(req, res, ctx) {
6242
6374
  } };
6243
6375
  let handedOff = false;
6244
6376
  try {
6245
- const delivered = ctx.deliverHumanToInstance ? await ctx.deliverHumanToInstance(instance, payload, webHumanOrigin(false, authority), row.text, { stillCurrent, ...(native ? { authorityCurrent } : {}) })
6377
+ const delivered = ctx.deliverHumanToInstance ? await ctx.deliverHumanToInstance(instance, payload, webHumanOrigin(false, authority, webIdentityOf(req, new URL(req.url ?? "/", "http://localhost"), ctx)), row.text, { stillCurrent, ...(native ? { authorityCurrent } : {}) })
6246
6378
  : await ctx.deliverToInstance(instance, payload, { stillCurrent, ...(native ? { authorityCurrent } : {}) });
6247
6379
  if (delivered === false)
6248
6380
  throw new Error("delivery changed");
@@ -6494,7 +6626,7 @@ function handleSendMessage(req, res, ctx) {
6494
6626
  const reactions = ctx.pendingReactionsMeta?.(instance) ?? { meta: {}, consume: () => { } };
6495
6627
  try {
6496
6628
  const deliver = (name, payload) => ctx.deliverHumanToInstance
6497
- ? ctx.deliverHumanToInstance(name, payload, webHumanOrigin(false, authority), typed, { stillCurrent, ...(native ? { authorityCurrent } : {}) })
6629
+ ? ctx.deliverHumanToInstance(name, payload, webHumanOrigin(false, authority, webIdentityOf(req, new URL(req.url ?? "/", "http://localhost"), ctx)), typed, { stillCurrent, ...(native ? { authorityCurrent } : {}) })
6498
6630
  : ctx.deliverToInstance(name, payload, { stillCurrent, ...(native ? { authorityCurrent } : {}) });
6499
6631
  delivered = await deliver(instance, {
6500
6632
  type: "fleet_inbound",
@@ -6928,7 +7060,7 @@ function shellOwnerCss(ctx, mode, viewer) {
6928
7060
  /**
6929
7061
  * AgEnD Hub P1 (docs/design/hub.md, docs/design/hub-ui-client.md): the page's Hub mark — presentation only, never
6930
7062
  * authority, set by the listener that serves the page (never a client's choice): `member` on this fleet's listener when
6931
- * `hub_member.enabled`, never over the public link. `hub` is only the Hub listener's own workspace page
7063
+ * `hub_member.enabled` (over the public link, an admin session's only: M-3278). `hub` is only the Hub listener's own workspace page
6932
7064
  * (serveHubWorkspaceShell). Nothing otherwise: no Hub UI is drawn and no Hub module loads.
6933
7065
  */
6934
7066
  function hubBodyAttrs(req, ctx) {