@songsid/agend 2.4.0-beta.3 → 2.4.0-beta.4

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 (274) hide show
  1. package/dist/agent-endpoint.d.ts +1 -1
  2. package/dist/agent-endpoint.js +8 -2
  3. package/dist/agent-endpoint.js.map +1 -1
  4. package/dist/auth-api.d.ts +3 -0
  5. package/dist/auth-api.js +15 -1
  6. package/dist/auth-api.js.map +1 -1
  7. package/dist/backend/agy-model-switch.d.ts +22 -0
  8. package/dist/backend/agy-model-switch.js +62 -0
  9. package/dist/backend/agy-model-switch.js.map +1 -0
  10. package/dist/backend/antigravity.js +50 -1
  11. package/dist/backend/antigravity.js.map +1 -1
  12. package/dist/backend/cli-runtime-switch.d.ts +71 -0
  13. package/dist/backend/cli-runtime-switch.js +176 -0
  14. package/dist/backend/cli-runtime-switch.js.map +1 -0
  15. package/dist/backend/codex-model-switch.d.ts +41 -0
  16. package/dist/backend/codex-model-switch.js +170 -0
  17. package/dist/backend/codex-model-switch.js.map +1 -0
  18. package/dist/backend/grok-model-switch.d.ts +16 -0
  19. package/dist/backend/grok-model-switch.js +45 -0
  20. package/dist/backend/grok-model-switch.js.map +1 -0
  21. package/dist/backend/grok.js +1 -1
  22. package/dist/backend/grok.js.map +1 -1
  23. package/dist/backend/muse.d.ts +2 -0
  24. package/dist/backend/muse.js +7 -3
  25. package/dist/backend/muse.js.map +1 -1
  26. package/dist/build-provenance.json +1 -1
  27. package/dist/channel/mcp-server.js +10 -1
  28. package/dist/channel/mcp-server.js.map +1 -1
  29. package/dist/channel/mcp-tools.js +8 -0
  30. package/dist/channel/mcp-tools.js.map +1 -1
  31. package/dist/cli-audited.js +12 -12
  32. package/dist/cli-audited.js.map +1 -1
  33. package/dist/daemon.d.ts +47 -1
  34. package/dist/daemon.js +301 -20
  35. package/dist/daemon.js.map +1 -1
  36. package/dist/delivery-consumed-watch.js +3 -0
  37. package/dist/delivery-consumed-watch.js.map +1 -1
  38. package/dist/fleet-manager.d.ts +102 -0
  39. package/dist/fleet-manager.js +663 -25
  40. package/dist/fleet-manager.js.map +1 -1
  41. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +2 -0
  42. package/dist/general-knowledge/skills/fleet-health/SKILL.md +9 -1
  43. package/dist/general-knowledge/skills/hub/SKILL.md +154 -0
  44. package/dist/general-knowledge/skills/model-discovery/SKILL.md +4 -0
  45. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +7 -3
  46. package/dist/hub/admin-dashboard.d.ts +85 -0
  47. package/dist/hub/admin-dashboard.js +161 -0
  48. package/dist/hub/admin-dashboard.js.map +1 -0
  49. package/dist/hub/attachments/store.d.ts +2 -0
  50. package/dist/hub/attachments/store.js +6 -0
  51. package/dist/hub/attachments/store.js.map +1 -1
  52. package/dist/hub/client.d.ts +10 -0
  53. package/dist/hub/client.js +72 -10
  54. package/dist/hub/client.js.map +1 -1
  55. package/dist/hub/compose/member.d.ts +20 -0
  56. package/dist/hub/compose/member.js +212 -17
  57. package/dist/hub/compose/member.js.map +1 -1
  58. package/dist/hub/compose/server.d.ts +8 -0
  59. package/dist/hub/compose/server.js +13 -2
  60. package/dist/hub/compose/server.js.map +1 -1
  61. package/dist/hub/display-name.d.ts +10 -0
  62. package/dist/hub/display-name.js +35 -0
  63. package/dist/hub/display-name.js.map +1 -0
  64. package/dist/hub/execution/service.d.ts +1 -0
  65. package/dist/hub/execution/service.js +1 -1
  66. package/dist/hub/execution/service.js.map +1 -1
  67. package/dist/hub/fleet-info.d.ts +12 -0
  68. package/dist/hub/fleet-info.js +14 -0
  69. package/dist/hub/fleet-info.js.map +1 -0
  70. package/dist/hub/fleet-update-model.d.ts +100 -0
  71. package/dist/hub/fleet-update-model.js +15 -0
  72. package/dist/hub/fleet-update-model.js.map +1 -0
  73. package/dist/hub/fleet-updates.d.ts +46 -0
  74. package/dist/hub/fleet-updates.js +282 -0
  75. package/dist/hub/fleet-updates.js.map +1 -0
  76. package/dist/hub/fleet-versions.d.ts +28 -0
  77. package/dist/hub/fleet-versions.js +80 -0
  78. package/dist/hub/fleet-versions.js.map +1 -0
  79. package/dist/hub/http/compose.d.ts +2 -0
  80. package/dist/hub/http/compose.js +192 -16
  81. package/dist/hub/http/compose.js.map +1 -1
  82. package/dist/hub/http/deps.d.ts +1 -0
  83. package/dist/hub/http/schema.js +13 -1
  84. package/dist/hub/http/schema.js.map +1 -1
  85. package/dist/hub/member/display-name.d.ts +9 -0
  86. package/dist/hub/member/display-name.js +71 -0
  87. package/dist/hub/member/display-name.js.map +1 -0
  88. package/dist/hub/member/exposure-api.d.ts +4 -0
  89. package/dist/hub/member/exposure-api.js +8 -3
  90. package/dist/hub/member/exposure-api.js.map +1 -1
  91. package/dist/hub/member/exposures.d.ts +4 -0
  92. package/dist/hub/member/exposures.js +20 -0
  93. package/dist/hub/member/exposures.js.map +1 -1
  94. package/dist/hub/member/pairing-api.js +3 -2
  95. package/dist/hub/member/pairing-api.js.map +1 -1
  96. package/dist/hub/member/recommendations.d.ts +37 -0
  97. package/dist/hub/member/recommendations.js +129 -0
  98. package/dist/hub/member/recommendations.js.map +1 -0
  99. package/dist/hub/member/room-ask.d.ts +60 -1
  100. package/dist/hub/member/room-ask.js +250 -22
  101. package/dist/hub/member/room-ask.js.map +1 -1
  102. package/dist/hub/member/room-post-answers.d.ts +52 -0
  103. package/dist/hub/member/room-post-answers.js +152 -0
  104. package/dist/hub/member/room-post-answers.js.map +1 -0
  105. package/dist/hub/member/room-post-receipt.d.ts +21 -0
  106. package/dist/hub/member/room-post-receipt.js +49 -0
  107. package/dist/hub/member/room-post-receipt.js.map +1 -0
  108. package/dist/hub/member/room-post.d.ts +100 -0
  109. package/dist/hub/member/room-post.js +223 -0
  110. package/dist/hub/member/room-post.js.map +1 -0
  111. package/dist/hub/member/updates.d.ts +92 -0
  112. package/dist/hub/member/updates.js +316 -0
  113. package/dist/hub/member/updates.js.map +1 -0
  114. package/dist/hub/protocol.d.ts +658 -1
  115. package/dist/hub/protocol.js +90 -13
  116. package/dist/hub/protocol.js.map +1 -1
  117. package/dist/hub/published-version.d.ts +3 -0
  118. package/dist/hub/published-version.js +35 -0
  119. package/dist/hub/published-version.js.map +1 -0
  120. package/dist/hub/recommendation-model.d.ts +36 -0
  121. package/dist/hub/recommendation-model.js +9 -0
  122. package/dist/hub/recommendation-model.js.map +1 -0
  123. package/dist/hub/recommendations.d.ts +58 -0
  124. package/dist/hub/recommendations.js +211 -0
  125. package/dist/hub/recommendations.js.map +1 -0
  126. package/dist/hub/representative.d.ts +3 -0
  127. package/dist/hub/representative.js +1 -0
  128. package/dist/hub/representative.js.map +1 -1
  129. package/dist/hub/room-context-model.d.ts +43 -0
  130. package/dist/hub/room-context-model.js +12 -0
  131. package/dist/hub/room-context-model.js.map +1 -0
  132. package/dist/hub/rooms/agents.d.ts +41 -9
  133. package/dist/hub/rooms/agents.js +183 -21
  134. package/dist/hub/rooms/agents.js.map +1 -1
  135. package/dist/hub/rooms/assistant.d.ts +1 -6
  136. package/dist/hub/rooms/assistant.js +7 -2
  137. package/dist/hub/rooms/assistant.js.map +1 -1
  138. package/dist/hub/rooms/automation.d.ts +24 -0
  139. package/dist/hub/rooms/automation.js +66 -0
  140. package/dist/hub/rooms/automation.js.map +1 -0
  141. package/dist/hub/rooms/buttons.d.ts +85 -0
  142. package/dist/hub/rooms/buttons.js +62 -0
  143. package/dist/hub/rooms/buttons.js.map +1 -0
  144. package/dist/hub/rooms/context-cursor.d.ts +18 -0
  145. package/dist/hub/rooms/context-cursor.js +61 -0
  146. package/dist/hub/rooms/context-cursor.js.map +1 -0
  147. package/dist/hub/rooms/context.d.ts +1 -1
  148. package/dist/hub/rooms/context.js +4 -4
  149. package/dist/hub/rooms/context.js.map +1 -1
  150. package/dist/hub/rooms/mentions.d.ts +15 -0
  151. package/dist/hub/rooms/mentions.js +43 -0
  152. package/dist/hub/rooms/mentions.js.map +1 -0
  153. package/dist/hub/rooms/post-replies.d.ts +23 -0
  154. package/dist/hub/rooms/post-replies.js +114 -0
  155. package/dist/hub/rooms/post-replies.js.map +1 -0
  156. package/dist/hub/rooms/schema.d.ts +9 -0
  157. package/dist/hub/rooms/schema.js +43 -0
  158. package/dist/hub/rooms/schema.js.map +1 -1
  159. package/dist/hub/rooms/service.d.ts +136 -1
  160. package/dist/hub/rooms/service.js +727 -18
  161. package/dist/hub/rooms/service.js.map +1 -1
  162. package/dist/hub/rooms/types.d.ts +27 -3
  163. package/dist/hub/rooms.js +1 -1
  164. package/dist/hub/rooms.js.map +1 -1
  165. package/dist/hub/runtime.d.ts +1 -1
  166. package/dist/hub/runtime.js +12 -0
  167. package/dist/hub/runtime.js.map +1 -1
  168. package/dist/hub/server.d.ts +6 -1
  169. package/dist/hub/server.js +75 -5
  170. package/dist/hub/server.js.map +1 -1
  171. package/dist/hub/settings-directory-proof.js +22 -1
  172. package/dist/hub/settings-directory-proof.js.map +1 -1
  173. package/dist/hub/types.d.ts +133 -2
  174. package/dist/hub-contact-windows.d.ts +11 -0
  175. package/dist/hub-contact-windows.js +56 -0
  176. package/dist/hub-contact-windows.js.map +1 -0
  177. package/dist/hub-pairing-summary.d.ts +1 -1
  178. package/dist/hub-room-conversation.d.ts +14 -0
  179. package/dist/hub-room-conversation.js +60 -0
  180. package/dist/hub-room-conversation.js.map +1 -0
  181. package/dist/hub-update-notice.d.ts +12 -0
  182. package/dist/hub-update-notice.js +35 -0
  183. package/dist/hub-update-notice.js.map +1 -0
  184. package/dist/locale.js +56 -2
  185. package/dist/locale.js.map +1 -1
  186. package/dist/native-mcp.js +9 -6
  187. package/dist/native-mcp.js.map +1 -1
  188. package/dist/outbound-handlers.d.ts +14 -4
  189. package/dist/outbound-handlers.js +54 -1
  190. package/dist/outbound-handlers.js.map +1 -1
  191. package/dist/outbound-schemas.d.ts +12 -0
  192. package/dist/outbound-schemas.js +12 -0
  193. package/dist/outbound-schemas.js.map +1 -1
  194. package/dist/pane-port.d.ts +2 -0
  195. package/dist/queued-handoffs.d.ts +16 -4
  196. package/dist/queued-handoffs.js +18 -1
  197. package/dist/queued-handoffs.js.map +1 -1
  198. package/dist/runtime-cli-install.js +13 -10
  199. package/dist/runtime-cli-install.js.map +1 -1
  200. package/dist/settings-api.d.ts +1 -0
  201. package/dist/settings-api.js +87 -0
  202. package/dist/settings-api.js.map +1 -1
  203. package/dist/tmux-manager.d.ts +2 -0
  204. package/dist/tmux-manager.js +2 -0
  205. package/dist/tmux-manager.js.map +1 -1
  206. package/dist/tool-permissions.js +3 -0
  207. package/dist/tool-permissions.js.map +1 -1
  208. package/dist/ui/chat-msg-actions.js +3 -222
  209. package/dist/ui/hub-admin-overview.js +189 -0
  210. package/dist/ui/hub-client.js +36 -4
  211. package/dist/ui/hub-fleet-versions.js +393 -0
  212. package/dist/ui/hub-room-agent-strings.js +28 -0
  213. package/dist/ui/hub-room-composer.js +5 -3
  214. package/dist/ui/hub-room-members-strings.js +2 -2
  215. package/dist/ui/hub-room-members.js +3 -2
  216. package/dist/ui/hub-room-notify.js +161 -0
  217. package/dist/ui/hub-room-search.js +126 -0
  218. package/dist/ui/hub-room-strings.js +46 -0
  219. package/dist/ui/hub-room-thread.js +239 -34
  220. package/dist/ui/hub-room-unread.js +2 -1
  221. package/dist/ui/hub-strings.js +8 -0
  222. package/dist/ui/image-annotate.js +2 -283
  223. package/dist/ui/image-lightbox.js +2 -176
  224. package/dist/ui/image-zoom.js +2 -242
  225. package/dist/ui/notice-hub-update.js +94 -0
  226. package/dist/ui/panel-chat.js +35 -6
  227. package/dist/ui/panel-hub.js +133 -19
  228. package/dist/ui/panel-notices.js +3 -1
  229. package/dist/ui/panel-settings.js +1 -1
  230. package/dist/ui/settings-hub-updates.js +67 -0
  231. package/dist/ui/settings-hub.js +28 -3
  232. package/dist/ui/settings-registry.js +1 -0
  233. package/dist/ui/settings-update.js +11 -5
  234. package/dist/ui/settings-web-authority.js +1 -1
  235. package/dist/ui/shared/app-i18n.js +2 -0
  236. package/dist/ui/shared/app-nav.js +6 -2
  237. package/dist/ui/shared/app-prefs.js +2 -1
  238. package/dist/ui/shared/app-shell.js +11 -1
  239. package/dist/ui/shared/app-update.js +90 -8
  240. package/dist/ui/shared/app.css +20 -0
  241. package/dist/ui/shared/chat-msg-actions.js +225 -0
  242. package/dist/ui/shared/chat-thread.js +70 -5
  243. package/dist/ui/shared/chat-work-bar.css +25 -13
  244. package/dist/ui/shared/hub-chat.css +6 -1
  245. package/dist/ui/shared/hub-owner.css +104 -0
  246. package/dist/ui/shared/hub-rooms-u2.css +16 -0
  247. package/dist/ui/shared/hub.css +5 -0
  248. package/dist/ui/shared/image-annotate.js +306 -0
  249. package/dist/ui/shared/image-lightbox.js +183 -0
  250. package/dist/ui/shared/image-zoom.js +242 -0
  251. package/dist/ui/shared/instance-nav.js +36 -7
  252. package/dist/ui/shared/view-strings.js +6 -0
  253. package/dist/ui/shared/web-authorize.js +2 -2
  254. package/dist/update-dispatch.d.ts +8 -1
  255. package/dist/update-dispatch.js +16 -1
  256. package/dist/update-dispatch.js.map +1 -1
  257. package/dist/update-idle.d.ts +65 -0
  258. package/dist/update-idle.js +190 -0
  259. package/dist/update-idle.js.map +1 -0
  260. package/dist/update-launch.d.ts +1 -1
  261. package/dist/update-launch.js +9 -2
  262. package/dist/update-launch.js.map +1 -1
  263. package/dist/usage/profile-timeline.d.ts +2 -0
  264. package/dist/usage/profile-timeline.js +4 -0
  265. package/dist/usage/profile-timeline.js.map +1 -1
  266. package/dist/web-api.js +19 -2
  267. package/dist/web-api.js.map +1 -1
  268. package/dist/web-notices.d.ts +3 -0
  269. package/dist/web-notices.js +17 -2
  270. package/dist/web-notices.js.map +1 -1
  271. package/dist/web-prefs.js +1 -0
  272. package/dist/web-prefs.js.map +1 -1
  273. package/dist/web-update.d.ts +15 -1
  274. package/package.json +1 -1
@@ -81,3 +81,5 @@ CLI mode: `agend-agent send <instance> <text> --forward <verification_id>` (repe
81
81
  Forward access is read-only and row-scoped. It does not grant commands, visibility of siblings, or access by knowing an ID. Same-uid shell-capable agents are not isolated from one another; use distinct OS users/containers for mutually untrusted agents.
82
82
 
83
83
  An error or unknown acknowledgement retains `operation_id` for exact recovery even in compact mode. Query that ID with `delivery_status`; an unclear response after admission must never trigger a blind resend.
84
+
85
+ When a shared agent answers a Hub question with its contact limit on, contacting other Fleet agents (including broadcast) is refused. Answer `agend-hub` first, then retry your own work. The limit ends on accepted answer or after 30 minutes; `hub_room_post` has its separate limits.
@@ -59,7 +59,15 @@ it has completed onboarding or changed the account's server-side data preference
59
59
  After an interactive setup, the CLI's `/config` page shows **Enable Telemetry off**;
60
60
  this is the visible confirmation to inspect, rather than the completion file.
61
61
 
62
- ### Antigravity announcement above an idle composer
62
+ ### Antigravity rating surveys and announcements
63
+
64
+ Agy's rating survey is skipped with the literal `0`, never Enter. AgEnD requires
65
+ the legacy full question and all four numeric choices. Physical line wraps
66
+ inside the title or option labels are normalized; only the final **Skip** label
67
+ may be clipped (the complete `[0]` is still required). Prose, indented/fenced
68
+ quotes, drafts and other dialogs are not answered. A qualitative `/feedback`
69
+ report form is different and is never automatically submitted. The wrap
70
+ fixtures reconstruct the exact1.5.9 binary strings, not a live survey capture.
63
71
 
64
72
  An agy announcement such as “Introducing Gemini 4 Hydrogen” is not itself proof
65
73
  of work. The empty Auto-mode composer may show `> Auto mode: edits & safe
@@ -35,6 +35,7 @@ For signing in to a person's *own* dashboard (`/web`, codes, the authenticator a
35
35
  | Chat with agents / Share agents / Connect a fleet by AD group, Paused | [Group permissions](#group-permissions) |
36
36
  | Room assistant, backend/account, cap, idle stop, answer counts | [Room assistant administration](#room-assistant-administration) |
37
37
  | Connected fleets, Revoke, Individual invitations, pairing code, Notices | [Administration](#administration) |
38
+ | AgEnD version of a Fleet, Needs update (需要更新), Too old for rooms, Version unknown, "Your Fleet runs an older AgEnD" | [Fleet versions](#fleet-versions) |
38
39
  | `hub`, `hub_member` in fleet.yaml | [Config keys](#config-keys) |
39
40
  | how many, how long | [Limits](#limits) |
40
41
  | virtual teams, My teams, team lead, team grants | [Teams](#teams) |
@@ -231,11 +232,19 @@ Connecting shares nothing. **Reconnect** appears when the connection stopped (re
231
232
  ends the old connection and opens the Hub sign-in again. **Remove this connection** ends it from your side ("Agents
232
233
  you share will stop answering.").
233
234
 
235
+ The connected Hub card, Hub update requests and recommended-update line use the Hub's name once this Fleet has
236
+ learned it from the paired Hub. An older Hub that supplies no name keeps the address fallback. The name is a display
237
+ label; learning it does not change the connection, update consent or which updates are available.
238
+
234
239
  Reconnecting after revocation or removal creates a new Fleet identity on the same Hub. Its member journal and sharing
235
240
  consent are separate from the previous identity: old questions and receipts are not replayed. An ordinary network
236
241
  reconnect of the same identity keeps its delivery and acknowledgement history. Do not delete journal files to repair a
237
242
  connection; partial or inconsistent state is held rather than reset.
238
243
 
244
+ If a paired Fleet starts while its Hub cannot be reached, it stays **Offline** and retries the connection automatically.
245
+ The local sharing and update-consent controls remain available. When the Hub returns, the Fleet reconnects and
246
+ reconciles its saved state; restarting the Fleet or pairing again is unnecessary for an ordinary network outage.
247
+
239
248
  **Other ways** holds the older **pairing code** method, and appears only for a Hub without company sign-in: once the
240
249
  Hub typed in **Hub address** answers that it takes company sign-in, **Other ways** is hidden and the company sign-in is
241
250
  the one way in. It stays while the Hub cannot be reached or its certificate is not trusted. A pairing code pasted into
@@ -280,6 +289,13 @@ On your Fleet, **Settings → Hub**, under **Shared agents** (分享的 Agent),
280
289
  - **Who may share:** when group permissions are on, only people whose group has **Share agents**. Otherwise the row
281
290
  reads "Not shared: your Hub administrator hasn't allowed you to share agents. It will be shared once they do."
282
291
  (未分享:Hub 管理員還沒有允許你分享 Agent。) with **Don't share it** to take the request back.
292
+ - **While it answers a Hub question, this agent may not contact other agents** defaults on, including existing shares.
293
+ In Fleet **Settings → Hub → Shared agents**, untick it to allow agent-to-agent help; saving a shared agent's choice
294
+ follows the same confirmation as sharing. Existing owners get a Settings notice they acknowledge once. Each question
295
+ opens a durable 30-minute window at delivery, ending earlier when its answer is accepted. While any window is open,
296
+ send_to_instance, delegate_task, request_information and broadcast are refused; the agent can retry after answering.
297
+ Answers to agend-hub and hub_room_post still work. The agent's own tools/folder, previously learned information and
298
+ actions after the window ends are not isolated. Hub General and MCP agents are not changed by this setting.
283
299
  - Only fleet agents can be shared for now: "ClassicBot rooms can't be shared yet." A Fleet with nothing to share reads
284
300
  "This fleet has no agents to share yet."
285
301
  - "Shared under the older restricted mode. Hub questions are refused until you share this agent again." → **Share
@@ -356,6 +372,10 @@ one-to-one chat. The separate **Who may ask** list still controls private chats.
356
372
 
357
373
  - The question reaches the agent's existing conversation on its owner's Fleet. It names the room and asker and
358
374
  includes recent room messages. The agent keeps its own folder and tools; any required approval goes to its owner.
375
+ - A compatible Hub/Fleet sends the latest 30 visible room messages on the first question, then only newer messages
376
+ since the last question that reached that agent, plus the replied-to message when needed. Restarting the agent,
377
+ clearing its conversation or starting a new session gives the next question the full recent window again.
378
+ Ordinary reconnects keep its place; older peers continue sending the full window. Unconfirmed input never advances it.
359
379
  - Everyone in the room can see the question and answer. The answer returns to the same question, and a reconnect
360
380
  retries the saved answer without entering the question again. Room agent answers are text only for now.
361
381
  - **Idle** (待命) means the agent can be woken by a question. **Working** means it is busy. **Paused** (暫停) names a
@@ -365,6 +385,55 @@ one-to-one chat. The separate **Who may ask** list still controls private chats.
365
385
  - Offline, stopped or paused targets wait; unanswered room questions expire after 24 hours. A question whose input
366
386
  outcome is uncertain is held rather than automatically entered a second time.
367
387
 
388
+ ### Agents posting to a room
389
+
390
+ The MCP connector lists `hub_room_list`, `hub_room_members({room})`, `hub_people_search({q})` and
391
+ `hub_room_post({room,text,receipt_id?})` within the agent's configured tool permissions. These tools work on a Fleet
392
+ connected to a compatible Hub. Without that connection, a call says “This Fleet isn't connected to a Hub.” The ordinary
393
+ reply/report tools still load when the Hub is slow or unreachable.
394
+ List returns only the invoking agent's current room IDs/names, without history. Post uses a room ID or an exact unique
395
+ name and appears as that agent, with its owner label. It cannot post as another agent or join a room. Everyone in the
396
+ room can read the post. `send_to_instance` still means Fleet-instance messaging; it is not a room-post alias.
397
+
398
+ Members shows current people, agents and presence only in the agent's rooms. People search uses the owner's existing
399
+ person picker, with ID, display name and sign-in name; it is bounded and rate-limited, without a broader directory view.
400
+
401
+ When a Fleet administrator asks the agent to post for them, the agent may pass that instruction's full `hmsg-UUID`
402
+ as `receipt_id`. The Fleet verifies the original delivered receipt, access to it, current administrator and current
403
+ authority. Do not invent a receipt or reuse an unrelated instruction.
404
+ Only an instruction delivered less than 24 hours ago can authorize a new on-behalf post. One instruction may support
405
+ several follow-ups within that window. When it expires, ask the owner again; accepted posts and answer delivery continue.
406
+ An uncertain existing post may still retry its exact frozen operation after expiry; never turn it into a fresh call.
407
+ The Hub attributes the post to its paired owner as **X via agent**; this does not assert an AD match for the person's
408
+ platform account. The agent must belong to the room; the owner need not. `@all` follows the room's member setting or that owner's manager right. Receipt reuse cannot
409
+ keep resetting automation depth, and the same source/room rate limits still apply.
410
+
411
+ Agent answers return as notifications to the agent that posted, with the original post and optional receipt ID. Relay
412
+ them to the person who asked. Human replies are not returned through the agent. An owner who has not joined the room
413
+ is absent from its member list: @mentioning them in a human reply stays plain text and does not reach them. Join the
414
+ room to be reachable by its people. Notifications do not create a new `report_result` obligation. Lost ACKs retry without
415
+ another input; an uncertain or interrupted input is held rather than entered again. Removing the agent from the room
416
+ stops both posting and reply return.
417
+
418
+ - An unknown outcome may already be committed. Do not repeat it as a new tool call; the same operation retains its
419
+ original key/body for a safe transport retry. A refused/rate-limited result explains the refusal and may give a retry time.
420
+ - The Hub resolves mentions and applies the room's automation depth and rate limits. The Fleet does not infer which
421
+ prior ask caused a post or supply ancestry. Tools disappear while disconnected; a stale cached tool call is refused.
422
+ - These tools require the current shared exposure/owner consent and compatible negotiated room-post support. Native
423
+ read-only sessions may use the read tools but cannot post; an older launch's tool ceiling is not widened.
424
+
425
+ - In an answer or proactive post, `@name` mentions a current room person or asks another current room agent. Use its
426
+ full displayed name (or a person's sign-in name). Unknown names, emails, escaped @ and code stay ordinary text.
427
+ Duplicate names are not guessed. A person's mention adds the normal unread mark and desktop notification; a proactive
428
+ post without a mention adds unread but no desktop notification. Another agent's answer quotes the asking message.
429
+ - Normal agents cannot use @all or mention themselves. Self-mentions stay plain text; stopped mentions get a line in the
430
+ viewer's language. There are at most three ask hops per episode, five actions per source agent per minute and thirty
431
+ per room per minute. A post and each routed mention count as actions. An answer remains visible if its mentions stop.
432
+ - A person's new message starts a new episode. A fresh proactive post can also start one after thirty minutes without
433
+ an agent-to-agent ask, when none are still pending. Delayed/replayed answers and timers never reset it. Scheduled
434
+ agents can therefore continue a visible, bounded chain once per half-hour. At a depth stop an agent can still post
435
+ updates and mention people within the rate limits.
436
+
368
437
  ### Inviting another owner's agent
369
438
 
370
439
  When the Hub offers room invitations, a room manager can invite another owner's shared agent. The owner sees
@@ -480,8 +549,41 @@ Each answer uses the latest 30 supplied room messages, plus a replied-to message
480
549
  keeps no earlier model conversation, sees no other room and has no tools. Room membership, mentions and delivery
481
550
  are supplied by the rooms-server integration; these admin cards alone do not add a chat room or enable an account.
482
551
 
552
+ ## Connection compatibility
553
+
554
+ A Fleet offering newer update support may retry once with its older capability list if an older Hub closes before
555
+ welcome. It uses the same authenticated pairing and removes only the new update offer; it does not ask the user to pair
556
+ again. The log says `Retrying Hub connection with a legacy capability offer` once. Ordinary Hub features remain usable;
557
+ new remote-update support stays unavailable on that legacy connection. Authentication refusals and failures after welcome
558
+ do not trigger this retry. Updating the Hub and restarting the Fleet's Hub connection lets them negotiate newer support.
559
+
560
+ ## Fleet version reports
561
+
562
+ Newer Fleets report their AgEnD version and whether they run as a service when connecting to a supporting Hub.
563
+ The Hub retains the last report and last connection time across disconnects and restarts. An older Fleet can remain
564
+ connected without reporting; its version is unknown. Room compatibility comes from the capabilities it actually
565
+ negotiated, including for an offline Fleet whose last connection is known. These reports are diagnostic only:
566
+ they do not install updates, require a version, disconnect an older Fleet, or grant the Hub permission to update it.
567
+ No version is recommended until an administrator saves **Recommended AgEnD version**. They can follow this Hub's
568
+ running version, choose one exact published AgEnD version, or turn the recommendation off. Preview shows how many
569
+ active Fleets are below it or have not reported a version; older Fleets may need to be contacted directly. npm must
570
+ confirm the version before a recommendation is saved. A changed setting is fenced against another administrator's save.
571
+
572
+ Supporting Fleets receive only a version, revision and setting time. Each Fleet independently compares with its
573
+ running version and checks AgEnD's package on npm. Failed checks retry with a growing delay (five minutes up to four
574
+ hours), preserved through reconnects and restarts; a changed recommendation starts a fresh check. Only a newer, locally verified version appears in its admin update
575
+ state. The Hub's **Owner notified** time means that Fleet acknowledged this verified offer; it does not prove the
576
+ person read it or installed anything. Advice remains available during a temporary network outage and is cleared when
577
+ the local Hub connection is disabled/replaced or the Hub withdraws it. Neither saving nor receiving advice launches
578
+ an update or grants remote update permission; local admin confirmation remains required. The banner and chat reminder
579
+ are separate UI work; do not claim those screens or a remote-update switch from this protocol alone.
580
+
483
581
  ## Administration
484
582
 
583
+ - The administrator Overview reports people, shared-agent questions, answer times, failures, Fleets and rooms for today
584
+ or seven calendar days in the viewer’s time zone. Each agent asked counts once (including each @All target). It shows
585
+ counts only, never questions, answers, room names or per-person activity. Answer times need five measured answers;
586
+ older answers with no recorded time are excluded. Hub-assistant activity stays in the room message split.
485
587
  - **Connected fleets** lists each Fleet by its name with its owner under it. A row's menu has **Revoke…**: "It
486
588
  disconnects and everything it shares is withdrawn." Revoked Fleets fold under **Revoked (*n*)**.
487
589
  A revoked Fleet's old publications stay hidden even if it reconnects as a new Fleet. Reconnecting does not restore those shares; other active agents and their chats remain available.
@@ -496,6 +598,58 @@ are supplied by the rooms-server integration; these admin cards alone do not add
496
598
  listed there too and need **Acknowledge**.
497
599
  - **This Hub** shows the Hub's name (**Hub name**, up to 64 characters) and what identifies it; **Edit AD connection**
498
600
  opens the directory settings.
601
+ - **Tabs** (M-3162): Administration opens on **Overview** (總覽) where the Hub serves it. The tabs are **Overview**,
602
+ **Manage** (管理項目, everything above on one page), **Teams**, **Groups** and **This Hub** (這個 Hub); a tab whose
603
+ feature is off isn't shown. Overview has **Today** / **7 days**, refreshes every minute, and its line under the
604
+ range says it shows counts only. On a Hub nobody has joined yet it shows **Let colleagues join** instead of numbers.
605
+ **See Connected Fleets** opens Manage at that card.
606
+
607
+ ## Fleet versions
608
+
609
+ Newer Hub features (rooms, agent posts) need a Fleet that is new enough. The Hub shows who is behind; it does not update
610
+ a Fleet itself (yet).
611
+
612
+ - **Administration → Connected fleets** shows, per Fleet, its **AgEnD version** (AgEnD 版本; "Unknown" / 不明 for a
613
+ Fleet too old to report it), **Last connected** (上次連接: "Now" / 目前已連接 with a green dot, a relative time, or
614
+ "Never" / 從未連接) and one state tag. A line above the list counts them — "*n* of *m* Fleets need an update." — and
615
+ the **Needs update** (需要更新) chip shows only those.
616
+ - The tags, in this order (the first that applies):
617
+
618
+ | Tag | Means |
619
+ |---|---|
620
+ | **Too old for rooms** (版本太舊,無法使用房間) | "This Fleet's agents cannot answer in rooms until it is updated." The same condition as "Needs an AgEnD update" on an agent in a room. |
621
+ | **Needs update** (需要更新) | "This Fleet runs *x*; the recommended version is *y*." |
622
+ | **Version unknown** (版本不明) | "This Fleet is too old to report its version. Ask its owner to update it." Counted as needing an update. |
623
+ | **Up to date** (已是建議版本) | On the recommended version or newer, or none is set and nothing is missing. |
624
+
625
+ They are plain tags: no red badges or counts.
626
+ - **The owner is told on the Hub.** A person whose own Fleet is flagged sees, after signing in: "Your Fleet "*name*"
627
+ runs an older AgEnD (*version*). Some features here will not work until you update it. Open your AgEnD dashboard and
628
+ press Update." (With several: "*n* of your Fleets run an older AgEnD.") Close it and it stays away for that sign-in;
629
+ it comes back next time while still true.
630
+ - **In a room**, an agent whose Fleet is too old reads "Needs an AgEnD update · ask *owner*" (「需要更新 AgEnD · 請通知
631
+ *owner*」), so people know whom to tell.
632
+ - **Recommended AgEnD version** (建議的 AgEnD 版本), the card above Connected fleets: **Same as this Hub** (it follows
633
+ the Hub as the Hub is updated), **A specific version** (checked on npm first: "Version *x* was not found on npm."),
634
+ or **No recommendation** (the state before anyone sets it). Before **Save** applies it, the card says what it does:
635
+ "*n* Fleets will be asked to update." A Fleet that is behind is told; its row then reads "Owner notified · *when*",
636
+ or "Not notified yet" (too old to be told, or not online since). Nothing is updated without the owner.
637
+ - **The fix is the owner's Update**: on their AgEnD dashboard, the update banner's **Update now**, or Settings →
638
+ Advanced → **Version and update**; in chat, `/update`.
639
+ - **Updating a Fleet from the Hub** needs its owner's yes first: on the Fleet, Settings → Hub, under Shared agents,
640
+ **Let this Hub's administrator update this Fleet** (允許這個 Hub 的管理員更新這個 Fleet). Off by default; turning it on
641
+ asks once; it is greyed out on a Fleet started by hand ("a failed update could not be undone automatically"). Then
642
+ a behind Fleet's row has **Update** (otherwise "Owner updates it"), and above the list **Update *n* Fleets that allow
643
+ it**. Each asks first and always installs the recommended version — to move people elsewhere, change the
644
+ recommendation. The Fleet waits until its agents are idle (up to 24 hours), tells its owner before and after, and
645
+ goes back to the previous version if the update fails. The row then shows one line: Waiting for the Fleet to
646
+ connect · Waiting for its agents to be idle (with **Cancel**) · Updating… · Updated to v*x* · Update failed; back on
647
+ v*y* (**Try again**) · Did not start (busy 24 hours, or offline 7 days) · The owner cancelled this update.
648
+ A request waits up to 7 days for an offline Fleet to connect. **Cancel** reads **Cancelling…** until the Fleet
649
+ confirms it stopped; an update that has already started cannot be cancelled. Changing the recommendation later does
650
+ not change a waiting request's version; the row then offers **Update to v*x* instead**, which cancels the waiting
651
+ request first and sends the new one. The Fleet still makes its own checks (the owner's switch, a published
652
+ version) and can refuse; the row then says why. Older Fleets are always updated by their owners.
499
653
 
500
654
  ## Config keys
501
655
 
@@ -78,3 +78,7 @@ agy starts on **another model**, with a warning in its pane.
78
78
  then handed to the CLI anyway. So a name missing from `list_models` may still be
79
79
  valid, and a typo fails *in the CLI at launch*, not at config time — if an
80
80
  instance won't start after a model change, suspect the name first.
81
+
82
+ On agy 1.4.7 or later, AgEnD first tries a model/effort change in the running session while idle and verifies a new CLI confirmation. It resolves the same catalog effort variant a restart would launch. Older/unknown running versions, a missing model catalog, picker or unverified result keep restart fallback. The saved Fleet setting survives restart.
83
+
84
+ Grok 1.0.70 and later can apply a model or effort in the idle session when its own fresh response verifies the target. Older or unknown running versions and unconfirmed/picker results keep the saved target and restart.
@@ -54,8 +54,8 @@ codes — sign-in is paused for a few minutes."). The sign-in page is **Sign in
54
54
  terminal otherwise; from another device it says `/web` only while a chat is connected (a fleet whose chat is not
55
55
  connected yet, or a web-only one, points at `agend web --code` on the AgEnD computer).
56
56
 
57
- **Send me a new code.** On the sign-in page, for a browser that signed in before with a `/web` code (remembered 90
58
- days). The code arrives by DM. Limits: one a minute and five an hour per browser; fleet-wide one per 20 s, 20 an hour.
57
+ **Send me a new code.** On the sign-in page, for a browser that signed in before with a `/web` code or with a chat
58
+ admin's own authenticator code (remembered 90 days). The code arrives by DM. Not on a web-only fleet (no chat to send it to). Limits: one a minute and five an hour per browser; fleet-wide one per 20 s, 20 an hour.
59
59
 
60
60
  **Local vs public link.** Local: the dashboard on the host itself (127.0.0.1; the address cannot be changed, only
61
61
  `health_port`). Public: **🌐 Other device (temporary public)** starts a Cloudflare quick tunnel (an address under
@@ -470,7 +470,11 @@ every 5 s.
470
470
 
471
471
  **The sidebar list.** Grouped by team (an instance in `teams.<name>.members` under its first team, whatever its tags), else by
472
472
  its first tag ("#" before the heading), ClassicBot rooms under Classic, the rest under Other; Settings → Agents the same (#2172).
473
- Each row (#2179): name and context % on the first line, the time of the agent's last reply to a person at the end of the
473
+ Settings → Preferences → **Sidebar agent list** chooses **Detailed** (default) or **Compact** (`nav.density`, synced;
474
+ Save/Discard like the other preferences). Compact uses a status dot (working pulses), name and muted last-reply time,
475
+ without an avatar: 30 px on desktop, 40 px on phones. Hover shows the existing details tooltip. Filters, favorites,
476
+ groups, sorting and keyboard links are the same. Detailed keeps the current presentation.
477
+ Each detailed row (#2179): name and context % on the first line, the time of the agent's last reply to a person at the end of the
474
478
  second ("2 min ago"; cross-instance messages don't count); a reply under 10 minutes old is highlighted, fading by itself
475
479
  (nothing to mark read). The sort button beside Edit: **Custom** (default; a reply never moves a row) or **Recent replies**
476
480
  (the rest by last reply, no groups, no dragging; favorites pinned in their order, or **Sorted by last reply too**); synced
@@ -0,0 +1,85 @@
1
+ /** Administration aggregates only. Never reads content refs, audit content, or returns person/room identities. */
2
+ import type Database from "better-sqlite3";
3
+ import type { HubHttpMigration } from "./http/schema.js";
4
+ import type { HubCore } from "./http/core.js";
5
+ import type { HubFleetVersions } from "./fleet-versions.js";
6
+ import type { HubVersionRecommendations } from "./recommendations.js";
7
+ export declare const HUB_ADMIN_DASHBOARD_MIGRATION: HubHttpMigration;
8
+ /** Called only after inserting a new coalesced stop, inside that same transaction. No room/agent/person key is retained. */
9
+ export declare function countChainStop(db: Database.Database, reason: string, now: number): void;
10
+ type Reason = "offline" | "timedOut" | "permissionEnded" | "stoppedOrRefused" | "unknown";
11
+ export declare class HubAdminDashboard {
12
+ private readonly core;
13
+ private readonly versions;
14
+ private readonly recommendations;
15
+ constructor(core: HubCore, versions: HubFleetVersions, recommendations: HubVersionRecommendations);
16
+ view(params: URLSearchParams, permit: {
17
+ assertCurrent(): void;
18
+ }): {
19
+ generatedAt: number;
20
+ range: string;
21
+ timeZone: string;
22
+ start: number;
23
+ end: number;
24
+ people: {
25
+ total: number;
26
+ activeToday: number;
27
+ active7d: number;
28
+ joined7d: number;
29
+ signedInNow: number;
30
+ };
31
+ questions: {
32
+ asked: number;
33
+ perDay: {
34
+ date: string;
35
+ count: number;
36
+ }[];
37
+ answerTime: {
38
+ medianMs: null;
39
+ p90Ms: null;
40
+ samples: number;
41
+ } | {
42
+ medianMs: number;
43
+ p90Ms: number;
44
+ samples: number;
45
+ };
46
+ waiting: number;
47
+ longestWaitMs: number | null;
48
+ notAnswered: {
49
+ total: number;
50
+ reasons: Record<Reason, number>;
51
+ };
52
+ };
53
+ topAgents: {
54
+ id: string;
55
+ name: string;
56
+ ownerName: string | null;
57
+ questions: number;
58
+ medianMs: number | null;
59
+ notAnswered: number;
60
+ }[];
61
+ sharedAgents: number;
62
+ fleets: {
63
+ total: number;
64
+ connected: number;
65
+ needsUpdate: number;
66
+ tooOldRooms: number;
67
+ unknownVersion: number;
68
+ recommendedVersion: string | null;
69
+ };
70
+ rooms: {
71
+ total: number;
72
+ active: number;
73
+ created7d: number;
74
+ messages: number;
75
+ byAuthor: {
76
+ people: number;
77
+ agents: number;
78
+ assistant: number;
79
+ };
80
+ agentQuestions: number;
81
+ chainsStopped: number;
82
+ };
83
+ };
84
+ }
85
+ export {};
@@ -0,0 +1,161 @@
1
+ import { personKeyString } from "./identity.js";
2
+ import { HubProtocolError } from "./validation.js";
3
+ export const HUB_ADMIN_DASHBOARD_MIGRATION = Object.freeze({ component: "s3-admin-dashboard", version: 1, up(db) {
4
+ // Do not manufacture historical answer times from mutable stage_at or a placeholder's creation time.
5
+ db.exec(`ALTER TABLE hub_messages ADD COLUMN answered_at INTEGER;
6
+ ALTER TABLE hub_room_deliveries ADD COLUMN answered_at INTEGER;
7
+ CREATE TABLE hub_chain_stop_counts(bucket INTEGER NOT NULL,reason TEXT NOT NULL CHECK(reason IN ('depth','rate')),count INTEGER NOT NULL CHECK(count>0),PRIMARY KEY(bucket,reason));
8
+ INSERT INTO hub_chain_stop_counts SELECT (p.created_at/60000)*60000,s.reason,COUNT(*) FROM hub_room_agent_stops s
9
+ JOIN hub_room_posts p ON p.id=s.post_id WHERE s.reason IN ('depth','rate') GROUP BY (p.created_at/60000)*60000,s.reason;
10
+ CREATE INDEX hub_dashboard_direct_created ON hub_messages(created_at);
11
+ CREATE INDEX hub_dashboard_room_created ON hub_room_deliveries(created_at);
12
+ CREATE INDEX hub_dashboard_posts_created ON hub_room_posts(created_at);`);
13
+ } });
14
+ /** Called only after inserting a new coalesced stop, inside that same transaction. No room/agent/person key is retained. */
15
+ export function countChainStop(db, reason, now) {
16
+ if (reason !== "depth" && reason !== "rate")
17
+ return;
18
+ db.prepare(`INSERT INTO hub_chain_stop_counts VALUES(?,?,1) ON CONFLICT(bucket,reason) DO UPDATE SET count=count+1`)
19
+ .run(Math.floor(now / 60_000) * 60_000, reason);
20
+ db.prepare("DELETE FROM hub_chain_stop_counts WHERE bucket<?").run(now - 9 * 86_400_000);
21
+ }
22
+ function calendar(now, timeZone) {
23
+ let formatter;
24
+ try {
25
+ formatter = new Intl.DateTimeFormat("en-CA", { timeZone, year: "numeric", month: "2-digit", day: "2-digit" });
26
+ }
27
+ catch {
28
+ throw new HubProtocolError("invalid");
29
+ }
30
+ const date = (at) => {
31
+ const parts = formatter.formatToParts(at), part = (name) => parts.find(p => p.type === name).value;
32
+ return `${part("year")}-${part("month")}-${part("day")}`;
33
+ };
34
+ const today = date(now), day = Date.parse(`${today}T00:00:00Z`);
35
+ const days = Array.from({ length: 7 }, (_, i) => new Date(day - (6 - i) * 86_400_000).toISOString().slice(0, 10));
36
+ // Find local calendar midnight, including a 23/25-hour DST day, without a fixed-offset approximation.
37
+ const start = (label) => {
38
+ const nominal = Date.parse(`${label}T00:00:00Z`);
39
+ let lo = nominal - 36 * 3_600_000, hi = nominal + 36 * 3_600_000;
40
+ while (lo < hi) {
41
+ const mid = Math.floor((lo + hi) / 2);
42
+ if (date(mid) < label)
43
+ lo = mid + 1;
44
+ else
45
+ hi = mid;
46
+ }
47
+ return lo;
48
+ };
49
+ const starts = days.map(start);
50
+ return { days, starts, today: starts[6], week: starts[0] };
51
+ }
52
+ function reasonGroup(reason) {
53
+ if (reason === "offline")
54
+ return "offline";
55
+ if (reason === "expired")
56
+ return "timedOut";
57
+ if (["revoked", "denied", "stale", "retired"].includes(reason ?? ""))
58
+ return "permissionEnded";
59
+ if (["incompatible", "interrupted", "rejected", "stopped", "refused"].includes(reason ?? ""))
60
+ return "stoppedOrRefused";
61
+ // unavailable/uncertain do not prove that the Fleet was offline.
62
+ return "unknown";
63
+ }
64
+ const typical = (values) => {
65
+ if (values.length < 5)
66
+ return { medianMs: null, p90Ms: null, samples: values.length };
67
+ values.sort((a, b) => a - b);
68
+ const n = values.length;
69
+ return { medianMs: n % 2 ? values[Math.floor(n / 2)] : (values[n / 2 - 1] + values[n / 2]) / 2,
70
+ p90Ms: values[Math.ceil(n * .9) - 1], samples: n };
71
+ };
72
+ export class HubAdminDashboard {
73
+ core;
74
+ versions;
75
+ recommendations;
76
+ constructor(core, versions, recommendations) {
77
+ this.core = core;
78
+ this.versions = versions;
79
+ this.recommendations = recommendations;
80
+ }
81
+ view(params, permit) {
82
+ for (const key of params.keys())
83
+ if (!["range", "timeZone"].includes(key) || params.getAll(key).length !== 1)
84
+ throw new HubProtocolError("invalid");
85
+ const range = params.get("range") ?? "7d", timeZone = params.get("timeZone") ?? "UTC";
86
+ if (!["today", "7d"].includes(range) || !timeZone || timeZone.length > 100)
87
+ throw new HubProtocolError("invalid");
88
+ const now = this.core.now(), cal = calendar(now, timeZone), start = range === "today" ? cal.today : cal.week;
89
+ const recommendation = this.recommendations.settings(), fleets = this.core.deps.store.read().fleets.filter(f => f.status === "active");
90
+ const fleetViews = fleets.map(f => this.versions.view(f.id, recommendation.recommendedVersion));
91
+ return this.core.atomic(db => {
92
+ permit.assertCurrent();
93
+ const count = (sql, ...args) => db.prepare(sql).get(...args).n;
94
+ const active = (since) => count("SELECT COUNT(DISTINCT person) n FROM hub_sessions WHERE seen_at>=? AND seen_at<=?", since, now);
95
+ const people = { total: count("SELECT COUNT(*) n FROM hub_people"), activeToday: active(cal.today), active7d: active(cal.week),
96
+ joined7d: count("SELECT COUNT(*) n FROM (SELECT person,MIN(created_at) first_at FROM hub_sessions GROUP BY person) WHERE first_at>=? AND first_at<=?", cal.week, now),
97
+ signedInNow: count(`SELECT COUNT(DISTINCT s.person) n FROM hub_sessions s JOIN hub_people p ON p.person=s.person
98
+ WHERE s.state='active' AND p.status='active' AND s.directory_epoch=? AND s.expires_at>? AND s.seen_at>=? AND s.seen_at<=?`, this.core.directoryEpoch, now, now - 5 * 60_000, now) };
99
+ const questions = db.prepare(`SELECT exposure_id exposure,created_at created,answer_id IS NOT NULL answered,answered_at,
100
+ (stage IN ('rejected','cancelled','failed','uncertain') OR expires_at<=?) terminal,
101
+ CASE WHEN stage NOT IN ('rejected','cancelled','failed','uncertain') AND expires_at<=? THEN 'expired' ELSE reason_code END reason
102
+ FROM hub_messages WHERE created_at>=? AND created_at<=?
103
+ UNION ALL SELECT exposure_id,created_at,state='answered',answered_at,(state IN ('retired','expired') OR expires_at<=?),
104
+ CASE WHEN state='retired' THEN 'retired' WHEN state='expired' OR expires_at<=? THEN 'expired' ELSE NULL END
105
+ FROM hub_room_deliveries WHERE created_at>=? AND created_at<=?`)
106
+ .all(now, now, cal.week, now, now, now, cal.week, now);
107
+ const selected = questions.filter(q => q.created >= start), times = [];
108
+ const reasons = { offline: 0, timedOut: 0, permissionEnded: 0, stoppedOrRefused: 0, unknown: 0 };
109
+ const perDay = cal.days.map(date => ({ date, count: 0 }));
110
+ for (const q of questions) {
111
+ let index = cal.starts.length - 1;
112
+ while (index >= 0 && q.created < cal.starts[index])
113
+ index--;
114
+ if (index >= 0)
115
+ perDay[index].count++;
116
+ }
117
+ const agentCounts = new Map();
118
+ for (const q of selected) {
119
+ const failed = !q.answered && !!q.terminal;
120
+ if (failed)
121
+ reasons[reasonGroup(q.reason)]++;
122
+ const ms = q.answered && q.answered_at !== null && q.answered_at >= q.created ? q.answered_at - q.created : null;
123
+ if (ms !== null)
124
+ times.push(ms);
125
+ const agent = agentCounts.get(q.exposure) ?? { questions: 0, notAnswered: 0, times: [] };
126
+ agent.questions++;
127
+ if (failed)
128
+ agent.notAnswered++;
129
+ if (ms !== null)
130
+ agent.times.push(ms);
131
+ agentCounts.set(q.exposure, agent);
132
+ }
133
+ const waiting = db.prepare(`SELECT COUNT(*) n,MIN(created) oldest FROM (
134
+ SELECT created_at created FROM hub_messages WHERE answer_id IS NULL AND stage NOT IN ('rejected','cancelled','failed','uncertain') AND expires_at>? AND created_at<=?
135
+ UNION ALL SELECT created_at FROM hub_room_deliveries WHERE state IN ('queued','sent') AND expires_at>? AND created_at<=?)`).get(now, now, now, now);
136
+ const exposures = db.prepare("SELECT e.id,e.display_name,e.owner,e.fleet_id,e.state,e.frozen_through,e.revision,p.display_name owner_name FROM hub_exposures e LEFT JOIN hub_people p ON p.person=e.owner").all();
137
+ const topAgents = [...agentCounts].sort((a, b) => b[1].questions - a[1].questions || a[0].localeCompare(b[0])).slice(0, 5).map(([id, a]) => {
138
+ const e = exposures.find(e => e.id === id);
139
+ return { id, name: e?.display_name ?? "Agent", ownerName: e?.owner_name ?? null, questions: a.questions,
140
+ medianMs: typical(a.times).medianMs, notAnswered: a.notAnswered };
141
+ });
142
+ const posts = db.prepare(`SELECT p.author_kind,COUNT(*) n FROM hub_room_posts p JOIN hub_group_rooms r ON r.id=p.room_id
143
+ WHERE r.assistant_for IS NULL AND p.author_kind<>'system' AND (p.stage IS NULL OR p.stage='answered') AND p.created_at>=? AND p.created_at<=? GROUP BY p.author_kind`).all(start, now);
144
+ const byAuthor = { people: posts.find(p => p.author_kind === "person")?.n ?? 0, agents: posts.find(p => p.author_kind === "agent")?.n ?? 0, assistant: posts.find(p => p.author_kind === "assistant")?.n ?? 0 };
145
+ return { generatedAt: now, range, timeZone, start, end: now, people,
146
+ questions: { asked: selected.length, perDay, answerTime: typical(times), waiting: waiting.n, longestWaitMs: waiting.oldest === null ? null : now - waiting.oldest,
147
+ notAnswered: { total: Object.values(reasons).reduce((a, b) => a + b, 0), reasons } }, topAgents,
148
+ sharedAgents: exposures.filter(e => e.state === "published" && e.frozen_through < e.revision && fleets.some(f => f.id === e.fleet_id && personKeyString(f.owner) === e.owner)).length,
149
+ fleets: { total: fleets.length, connected: fleetViews.filter(f => f.connected).length, needsUpdate: fleetViews.filter(f => f.versionState === "needs-update").length,
150
+ tooOldRooms: fleetViews.filter(f => f.versionState === "too-old-rooms").length, unknownVersion: fleetViews.filter(f => f.versionState === "unknown").length, recommendedVersion: recommendation.recommendedVersion },
151
+ rooms: { total: count("SELECT COUNT(*) n FROM hub_group_rooms WHERE assistant_for IS NULL"),
152
+ active: count(`SELECT COUNT(DISTINCT p.room_id) n FROM hub_room_posts p JOIN hub_group_rooms r ON r.id=p.room_id
153
+ WHERE r.assistant_for IS NULL AND p.author_kind<>'system' AND (p.stage IS NULL OR p.stage='answered') AND p.created_at>=? AND p.created_at<=?`, start, now),
154
+ created7d: count("SELECT COUNT(*) n FROM hub_group_rooms WHERE assistant_for IS NULL AND created_at>=? AND created_at<=?", cal.week, now),
155
+ messages: Object.values(byAuthor).reduce((a, b) => a + b, 0), byAuthor,
156
+ agentQuestions: count("SELECT COUNT(*) n FROM hub_room_deliveries WHERE created_at>=? AND created_at<=?", start, now),
157
+ chainsStopped: count("SELECT COALESCE(SUM(count),0) n FROM hub_chain_stop_counts WHERE bucket>=? AND bucket<=?", start, now) } };
158
+ }, permit);
159
+ }
160
+ }
161
+ //# sourceMappingURL=admin-dashboard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin-dashboard.js","sourceRoot":"","sources":["../../src/hub/admin-dashboard.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,MAAM,CAAC,MAAM,6BAA6B,GAAqB,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,oBAAoB,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,EAAqB;QAClJ,qGAAqG;QACrG,EAAE,CAAC,IAAI,CAAC;;;;;;;wEAO8D,CAAC,CAAC;IAC1E,CAAC,EAAE,CAAC,CAAC;AAEL,4HAA4H;AAC5H,MAAM,UAAU,cAAc,CAAC,EAAqB,EAAE,MAAc,EAAE,GAAW;IAC/E,IAAI,MAAM,KAAK,OAAO,IAAI,MAAM,KAAK,MAAM;QAAE,OAAO;IACpD,EAAE,CAAC,OAAO,CAAC,wGAAwG,CAAC;SACjH,GAAG,CAAC,IAAI,CA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G,CAAC;oBACrH,aAAa,EAAE,KAAK,CAAC,0FAA0F,EAAE,KAAK,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC;QACvI,CAAC,EAAE,MAAM,CAAC,CAAC;IACb,CAAC;CACF"}
@@ -86,6 +86,8 @@ export declare class HubAttachmentStore {
86
86
  /** The uploader's own unexpired pending files in this room, in the order named; refused as a whole otherwise. */
87
87
  pending(db: Database.Database, roomId: string, uploader: string, ids: readonly string[]): HubAttachmentRef[];
88
88
  bindQuestion(db: Database.Database, refs: readonly HubAttachmentRef[], messageId: string, fleetId: string): void;
89
+ /** M-3125: a person's files on a group-room post (no fleet: people chat in group rooms; agents get them through a room ask). */
90
+ bindPost(db: Database.Database, refs: readonly HubAttachmentRef[], postId: string): void;
89
91
  /** A message's files in one direction, in order. */
90
92
  forMessage(db: Database.Database, messageId: string, direction: "question" | "answer"): HubAttachmentRef[];
91
93
  row(db: Database.Database, id: string): HubAttachmentRow | undefined;
@@ -159,6 +159,12 @@ export class HubAttachmentStore {
159
159
  refs.forEach((r, i) => { if (bind.run(messageId, fleetId, i, r.id).changes !== 1)
160
160
  throw new HubProtocolError("conflict"); });
161
161
  }
162
+ /** M-3125: a person's files on a group-room post (no fleet: people chat in group rooms; agents get them through a room ask). */
163
+ bindPost(db, refs, postId) {
164
+ const bind = db.prepare("UPDATE hub_attachments SET state='bound', message_id=?, position=?, expires_at=NULL WHERE id=? AND state='pending'");
165
+ refs.forEach((r, i) => { if (bind.run(postId, i, r.id).changes !== 1)
166
+ throw new HubProtocolError("conflict"); });
167
+ }
162
168
  /** A message's files in one direction, in order. */
163
169
  forMessage(db, messageId, direction) {
164
170
  return db.prepare("SELECT * FROM hub_attachments WHERE message_id=? AND direction=? AND state='bound' ORDER BY position").all(messageId, direction).map(refOf);