@songsid/agend 2.4.0-beta.18 → 2.4.0-beta.19

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 (377) hide show
  1. package/dist/agent-cli-instructions.md +13 -7
  2. package/dist/agent-cli.js +149 -49
  3. package/dist/agent-cli.js.map +1 -1
  4. package/dist/agent-export.d.ts +3 -1
  5. package/dist/agent-export.js +18 -1
  6. package/dist/agent-export.js.map +1 -1
  7. package/dist/agent-whats-new.js +9 -0
  8. package/dist/agent-whats-new.js.map +1 -1
  9. package/dist/apply-job.d.ts +2 -2
  10. package/dist/auth-api.js +1 -1
  11. package/dist/auth-api.js.map +1 -1
  12. package/dist/backend/claude-code.d.ts +0 -6
  13. package/dist/backend/claude-code.js +23 -3
  14. package/dist/backend/claude-code.js.map +1 -1
  15. package/dist/backend/codex-precaution.js +3 -2
  16. package/dist/backend/codex-precaution.js.map +1 -1
  17. package/dist/backend/codex.js +1 -1
  18. package/dist/backend/codex.js.map +1 -1
  19. package/dist/backend/types.d.ts +6 -0
  20. package/dist/backend/types.js.map +1 -1
  21. package/dist/build-provenance.json +1 -1
  22. package/dist/channel/mcp-server.js +8 -2
  23. package/dist/channel/mcp-server.js.map +1 -1
  24. package/dist/channel/mcp-tools.d.ts +27 -1
  25. package/dist/channel/mcp-tools.js +77 -7
  26. package/dist/channel/mcp-tools.js.map +1 -1
  27. package/dist/chat-task-refs.d.ts +61 -0
  28. package/dist/chat-task-refs.js +112 -0
  29. package/dist/chat-task-refs.js.map +1 -0
  30. package/dist/classic-channel-manager.d.ts +1 -1
  31. package/dist/classic-channel-manager.js +6 -2
  32. package/dist/classic-channel-manager.js.map +1 -1
  33. package/dist/claude-credential-launch.d.ts +6 -0
  34. package/dist/claude-credential-launch.js +16 -3
  35. package/dist/claude-credential-launch.js.map +1 -1
  36. package/dist/claude-credential-runner.js +3 -1
  37. package/dist/claude-credential-runner.js.map +1 -1
  38. package/dist/claude-setup-token-transport.js +25 -3
  39. package/dist/claude-setup-token-transport.js.map +1 -1
  40. package/dist/cli-audited.js +5 -5
  41. package/dist/cli-audited.js.map +1 -1
  42. package/dist/composite-tools.d.ts +11 -0
  43. package/dist/composite-tools.js +29 -0
  44. package/dist/composite-tools.js.map +1 -0
  45. package/dist/config-validator.js +22 -1
  46. package/dist/config-validator.js.map +1 -1
  47. package/dist/config.js +11 -0
  48. package/dist/config.js.map +1 -1
  49. package/dist/contact-auth-policy.d.ts +1 -0
  50. package/dist/contact-auth-policy.js +2 -1
  51. package/dist/contact-auth-policy.js.map +1 -1
  52. package/dist/contact-auth-service.js +2 -0
  53. package/dist/contact-auth-service.js.map +1 -1
  54. package/dist/contact-auth-store.js +21 -6
  55. package/dist/contact-auth-store.js.map +1 -1
  56. package/dist/contact-auth-types.d.ts +2 -0
  57. package/dist/contact-auth-types.js.map +1 -1
  58. package/dist/daemon.js +4 -0
  59. package/dist/daemon.js.map +1 -1
  60. package/dist/darwin-memory.js +2 -1
  61. package/dist/darwin-memory.js.map +1 -1
  62. package/dist/dashboard-permissions.d.ts +1 -8
  63. package/dist/dashboard-permissions.js +8 -9
  64. package/dist/dashboard-permissions.js.map +1 -1
  65. package/dist/delivery-outbox.d.ts +0 -6
  66. package/dist/delivery-outbox.js +0 -25
  67. package/dist/delivery-outbox.js.map +1 -1
  68. package/dist/delivery-outbox.test.js +132 -96
  69. package/dist/delivery-outbox.test.js.map +1 -1
  70. package/dist/fleet-manager.d.ts +45 -7
  71. package/dist/fleet-manager.js +309 -99
  72. package/dist/fleet-manager.js.map +1 -1
  73. package/dist/fleet-windows-runtime.d.ts +1 -1
  74. package/dist/fleet-windows-runtime.js +8 -1
  75. package/dist/fleet-windows-runtime.js.map +1 -1
  76. package/dist/fleet-yaml-stringify.d.ts +1 -1
  77. package/dist/fleet-yaml-stringify.js +64 -11
  78. package/dist/fleet-yaml-stringify.js.map +1 -1
  79. package/dist/general-knowledge/skills/concepts/SKILL.md +53 -4
  80. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +4 -0
  81. package/dist/general-knowledge/skills/fleet-config/SKILL.md +21 -1
  82. package/dist/general-knowledge/skills/hub/SKILL.md +2 -0
  83. package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +5 -1
  84. package/dist/general-knowledge/skills/model-discovery/SKILL.md +3 -2
  85. package/dist/general-knowledge/skills/persona-emoji/SKILL.md +3 -0
  86. package/dist/general-knowledge/skills/task-board/SKILL.md +63 -0
  87. package/dist/general-knowledge/skills/web-appearance/SKILL.md +25 -2
  88. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +38 -9
  89. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +4 -0
  90. package/dist/general-knowledge/steering/core-rules.md +15 -78
  91. package/dist/general-role-block.d.ts +19 -0
  92. package/dist/general-role-block.js +56 -0
  93. package/dist/general-role-block.js.map +1 -0
  94. package/dist/general-role.d.ts +1 -1
  95. package/dist/general-role.js +1 -0
  96. package/dist/general-role.js.map +1 -1
  97. package/dist/host-memory.d.ts +3 -0
  98. package/dist/host-memory.js.map +1 -1
  99. package/dist/host-monitoring/darwin/collector.d.ts +18 -0
  100. package/dist/host-monitoring/darwin/collector.js +65 -0
  101. package/dist/host-monitoring/darwin/collector.js.map +1 -0
  102. package/dist/host-monitoring/darwin/defaults.d.ts +2 -0
  103. package/dist/host-monitoring/darwin/defaults.js +9 -0
  104. package/dist/host-monitoring/darwin/defaults.js.map +1 -0
  105. package/dist/host-monitoring/darwin/interpretation.d.ts +20 -0
  106. package/dist/host-monitoring/darwin/interpretation.js +73 -0
  107. package/dist/host-monitoring/darwin/interpretation.js.map +1 -0
  108. package/dist/host-monitoring/linux/collector.d.ts +17 -0
  109. package/dist/host-monitoring/linux/collector.js +55 -0
  110. package/dist/host-monitoring/linux/collector.js.map +1 -0
  111. package/dist/host-monitoring/linux/defaults.d.ts +2 -0
  112. package/dist/host-monitoring/linux/defaults.js +9 -0
  113. package/dist/host-monitoring/linux/defaults.js.map +1 -0
  114. package/dist/host-monitoring/linux/interpretation.d.ts +22 -0
  115. package/dist/host-monitoring/linux/interpretation.js +76 -0
  116. package/dist/host-monitoring/linux/interpretation.js.map +1 -0
  117. package/dist/host-monitoring/transport.d.ts +42 -0
  118. package/dist/host-monitoring/transport.js +101 -0
  119. package/dist/host-monitoring/transport.js.map +1 -0
  120. package/dist/host-monitoring/wsl/collector.d.ts +19 -0
  121. package/dist/host-monitoring/wsl/collector.js +72 -0
  122. package/dist/host-monitoring/wsl/collector.js.map +1 -0
  123. package/dist/host-monitoring/wsl/defaults.d.ts +2 -0
  124. package/dist/host-monitoring/wsl/defaults.js +9 -0
  125. package/dist/host-monitoring/wsl/defaults.js.map +1 -0
  126. package/dist/host-monitoring/wsl/interpretation.d.ts +22 -0
  127. package/dist/host-monitoring/wsl/interpretation.js +77 -0
  128. package/dist/host-monitoring/wsl/interpretation.js.map +1 -0
  129. package/dist/host-monitoring-alert-policy.d.ts +2 -0
  130. package/dist/host-monitoring-alert-policy.js +4 -2
  131. package/dist/host-monitoring-alert-policy.js.map +1 -1
  132. package/dist/host-monitoring-alert-settings.d.ts +3 -1
  133. package/dist/host-monitoring-alert-settings.js +7 -2
  134. package/dist/host-monitoring-alert-settings.js.map +1 -1
  135. package/dist/host-monitoring-alerts.d.ts +3 -0
  136. package/dist/host-monitoring-alerts.js +18 -3
  137. package/dist/host-monitoring-alerts.js.map +1 -1
  138. package/dist/host-monitoring-defaults.d.ts +19 -0
  139. package/dist/host-monitoring-defaults.js +10 -0
  140. package/dist/host-monitoring-defaults.js.map +1 -0
  141. package/dist/host-monitoring-platform.d.ts +18 -70
  142. package/dist/host-monitoring-platform.js +14 -269
  143. package/dist/host-monitoring-platform.js.map +1 -1
  144. package/dist/host-monitoring.d.ts +13 -0
  145. package/dist/host-monitoring.js.map +1 -1
  146. package/dist/hub/agent-catalog-model.d.ts +21 -0
  147. package/dist/hub/agent-catalog-model.js +9 -1
  148. package/dist/hub/agent-catalog-model.js.map +1 -1
  149. package/dist/hub/agent-catalog.d.ts +4 -1
  150. package/dist/hub/agent-catalog.js +11 -0
  151. package/dist/hub/agent-catalog.js.map +1 -1
  152. package/dist/hub/catalog.js +12 -0
  153. package/dist/hub/catalog.js.map +1 -1
  154. package/dist/hub/client.js +4 -1
  155. package/dist/hub/client.js.map +1 -1
  156. package/dist/hub/compose/member.d.ts +5 -0
  157. package/dist/hub/compose/member.js +25 -5
  158. package/dist/hub/compose/member.js.map +1 -1
  159. package/dist/hub/compose/server.d.ts +2 -0
  160. package/dist/hub/compose/server.js +4 -2
  161. package/dist/hub/compose/server.js.map +1 -1
  162. package/dist/hub/http/compose.d.ts +5 -0
  163. package/dist/hub/http/compose.js +25 -2
  164. package/dist/hub/http/compose.js.map +1 -1
  165. package/dist/hub/http/deps.d.ts +2 -0
  166. package/dist/hub/http/schema.js +4 -0
  167. package/dist/hub/http/schema.js.map +1 -1
  168. package/dist/hub/lapse-carry.d.ts +45 -0
  169. package/dist/hub/lapse-carry.js +62 -0
  170. package/dist/hub/lapse-carry.js.map +1 -0
  171. package/dist/hub/member/agent-catalog.d.ts +4 -1
  172. package/dist/hub/member/agent-catalog.js +15 -4
  173. package/dist/hub/member/agent-catalog.js.map +1 -1
  174. package/dist/hub/member/agent-intro.d.ts +4 -3
  175. package/dist/hub/member/agent-intro.js +7 -0
  176. package/dist/hub/member/agent-intro.js.map +1 -1
  177. package/dist/hub/member/exposure-api.d.ts +2 -0
  178. package/dist/hub/member/exposure-api.js +8 -1
  179. package/dist/hub/member/exposure-api.js.map +1 -1
  180. package/dist/hub/member/room-post.d.ts +34 -6
  181. package/dist/hub/member/room-post.js +30 -0
  182. package/dist/hub/member/room-post.js.map +1 -1
  183. package/dist/hub/member/sharing.d.ts +2 -0
  184. package/dist/hub/member/sharing.js +9 -2
  185. package/dist/hub/member/sharing.js.map +1 -1
  186. package/dist/hub/protocol.d.ts +2 -0
  187. package/dist/hub/room-brief-model.js +2 -1
  188. package/dist/hub/room-brief-model.js.map +1 -1
  189. package/dist/hub/rooms/agents.d.ts +2 -0
  190. package/dist/hub/rooms/agents.js +16 -2
  191. package/dist/hub/rooms/agents.js.map +1 -1
  192. package/dist/hub/rooms/office.d.ts +82 -0
  193. package/dist/hub/rooms/office.js +46 -0
  194. package/dist/hub/rooms/office.js.map +1 -0
  195. package/dist/hub/rooms/service.d.ts +66 -1
  196. package/dist/hub/rooms/service.js +67 -11
  197. package/dist/hub/rooms/service.js.map +1 -1
  198. package/dist/hub/rooms/types.d.ts +4 -0
  199. package/dist/hub/runtime.d.ts +1 -1
  200. package/dist/hub/server.js +9 -2
  201. package/dist/hub/server.js.map +1 -1
  202. package/dist/hub/sharing-requests.d.ts +5 -2
  203. package/dist/hub/sharing-requests.js +19 -4
  204. package/dist/hub/sharing-requests.js.map +1 -1
  205. package/dist/instance-config-impact.js +1 -1
  206. package/dist/instance-config-impact.js.map +1 -1
  207. package/dist/instance-lifecycle.js +6 -7
  208. package/dist/instance-lifecycle.js.map +1 -1
  209. package/dist/instruction-file-sizes.d.ts +46 -0
  210. package/dist/instruction-file-sizes.js +115 -0
  211. package/dist/instruction-file-sizes.js.map +1 -0
  212. package/dist/instructions.d.ts +35 -1
  213. package/dist/instructions.js +59 -33
  214. package/dist/instructions.js.map +1 -1
  215. package/dist/locale.js +16 -4
  216. package/dist/locale.js.map +1 -1
  217. package/dist/log-steps.d.ts +5 -0
  218. package/dist/log-steps.js +6 -2
  219. package/dist/log-steps.js.map +1 -1
  220. package/dist/memory-guidance.d.ts +5 -0
  221. package/dist/memory-guidance.js +14 -0
  222. package/dist/memory-guidance.js.map +1 -0
  223. package/dist/model-defaults.d.ts +5 -0
  224. package/dist/model-defaults.js +6 -0
  225. package/dist/model-defaults.js.map +1 -0
  226. package/dist/native-mcp.d.ts +2 -0
  227. package/dist/native-mcp.js +16 -6
  228. package/dist/native-mcp.js.map +1 -1
  229. package/dist/needs-you-hub.d.ts +2 -0
  230. package/dist/needs-you-hub.js +6 -1
  231. package/dist/needs-you-hub.js.map +1 -1
  232. package/dist/needs-you.d.ts +13 -1
  233. package/dist/needs-you.js +5 -0
  234. package/dist/needs-you.js.map +1 -1
  235. package/dist/outbound-handlers.d.ts +3 -3
  236. package/dist/outbound-schemas.d.ts +3 -0
  237. package/dist/outbound-schemas.js +27 -26
  238. package/dist/outbound-schemas.js.map +1 -1
  239. package/dist/quickstart.d.ts +1 -1
  240. package/dist/quickstart.js +2 -3
  241. package/dist/quickstart.js.map +1 -1
  242. package/dist/remote-card-prompt.d.ts +1 -0
  243. package/dist/remote-card-prompt.js +1 -1
  244. package/dist/remote-card-prompt.js.map +1 -1
  245. package/dist/runtime-build-info.js +1 -1
  246. package/dist/runtime-build-info.js.map +1 -1
  247. package/dist/runtime-cli-install.js +5 -5
  248. package/dist/runtime-cli-install.js.map +1 -1
  249. package/dist/runtime-pane-mcp.js +7 -3
  250. package/dist/runtime-pane-mcp.js.map +1 -1
  251. package/dist/runtime-pane-native.js +2 -1
  252. package/dist/runtime-pane-native.js.map +1 -1
  253. package/dist/scheduler/db.js +2 -0
  254. package/dist/scheduler/db.js.map +1 -1
  255. package/dist/scheduler/task-board-mentions.d.ts +32 -0
  256. package/dist/scheduler/task-board-mentions.js +97 -0
  257. package/dist/scheduler/task-board-mentions.js.map +1 -0
  258. package/dist/scheduler/task-board-text.js +3 -0
  259. package/dist/scheduler/task-board-text.js.map +1 -1
  260. package/dist/scheduler/task-board.d.ts +199 -3
  261. package/dist/scheduler/task-board.js +492 -7
  262. package/dist/scheduler/task-board.js.map +1 -1
  263. package/dist/settings-api.d.ts +3 -1
  264. package/dist/settings-api.js +23 -4
  265. package/dist/settings-api.js.map +1 -1
  266. package/dist/settings-change.js +4 -2
  267. package/dist/settings-change.js.map +1 -1
  268. package/dist/settings-effect.js +1 -1
  269. package/dist/settings-effect.js.map +1 -1
  270. package/dist/settings-instance-patch.js +3 -1
  271. package/dist/settings-instance-patch.js.map +1 -1
  272. package/dist/setup-host.d.ts +2 -3
  273. package/dist/setup-host.js +3 -5
  274. package/dist/setup-host.js.map +1 -1
  275. package/dist/setup-wizard.js +0 -2
  276. package/dist/setup-wizard.js.map +1 -1
  277. package/dist/shared-default-adoption.d.ts +24 -0
  278. package/dist/shared-default-adoption.js +73 -0
  279. package/dist/shared-default-adoption.js.map +1 -0
  280. package/dist/subagent-records.d.ts +2 -0
  281. package/dist/subagent-records.js +11 -1
  282. package/dist/subagent-records.js.map +1 -1
  283. package/dist/subagent-service.d.ts +3 -0
  284. package/dist/subagent-service.js +24 -4
  285. package/dist/subagent-service.js.map +1 -1
  286. package/dist/task-board-tool.d.ts +31 -0
  287. package/dist/task-board-tool.js +31 -0
  288. package/dist/task-board-tool.js.map +1 -1
  289. package/dist/task-board-waker.d.ts +23 -30
  290. package/dist/task-board-waker.js +136 -97
  291. package/dist/task-board-waker.js.map +1 -1
  292. package/dist/types.d.ts +23 -0
  293. package/dist/ui/agent-details-settings.js +2 -2
  294. package/dist/ui/agent-export-dialog.js +4 -3
  295. package/dist/ui/agent-export-strings.js +4 -4
  296. package/dist/ui/agent-page-strings.js +18 -0
  297. package/dist/ui/chat-activity-groups.js +1 -1
  298. package/dist/ui/chat-activity.js +17 -0
  299. package/dist/ui/chat-store.js +13 -4
  300. package/dist/ui/chat-task-ref-strings.js +24 -0
  301. package/dist/ui/chat-task-refs.js +129 -0
  302. package/dist/ui/claude-setup-token.js +3 -3
  303. package/dist/ui/contact-auth-strings.js +33 -3
  304. package/dist/ui/contact-authorizations.js +17 -24
  305. package/dist/ui/contact-grant-editor.js +50 -0
  306. package/dist/ui/contact-permissions.js +21 -8
  307. package/dist/ui/fleet-office-card.js +18 -14
  308. package/dist/ui/fleet-office.js +29 -17
  309. package/dist/ui/fleet-task-activity.js +362 -0
  310. package/dist/ui/fleet-task-card.js +317 -314
  311. package/dist/ui/fleet-task-common.js +99 -9
  312. package/dist/ui/fleet-task-create.js +67 -0
  313. package/dist/ui/fleet-task-edit.js +204 -0
  314. package/dist/ui/fleet-task-follow.js +123 -0
  315. package/dist/ui/fleet-task-menu.js +1 -1
  316. package/dist/ui/fleet-task-owner.js +252 -0
  317. package/dist/ui/fleet-task-run.js +257 -0
  318. package/dist/ui/fleet-task-view.js +178 -39
  319. package/dist/ui/fleet-task-work.js +2 -2
  320. package/dist/ui/fleet-tasks.js +258 -130
  321. package/dist/ui/host-health.js +9 -6
  322. package/dist/ui/host-monitoring-darwin.js +6 -0
  323. package/dist/ui/host-monitoring-help.js +7 -0
  324. package/dist/ui/host-monitoring-linux.js +6 -0
  325. package/dist/ui/host-monitoring-wsl.js +6 -0
  326. package/dist/ui/hub-agent-copy.js +2 -0
  327. package/dist/ui/hub-client.js +4 -0
  328. package/dist/ui/hub-my-agents-strings.js +2 -0
  329. package/dist/ui/hub-my-agents.js +17 -1
  330. package/dist/ui/hub-room-composer.js +108 -5
  331. package/dist/ui/hub-room-members-strings.js +9 -2
  332. package/dist/ui/hub-room-members.js +72 -15
  333. package/dist/ui/hub-room-office.js +191 -0
  334. package/dist/ui/hub-room-purpose.js +18 -2
  335. package/dist/ui/hub-room-settings.js +8 -1
  336. package/dist/ui/hub-room-strings.js +15 -0
  337. package/dist/ui/hub-room-thread.js +51 -15
  338. package/dist/ui/hub-strings.js +1 -1
  339. package/dist/ui/log-row.js +7 -5
  340. package/dist/ui/native-instance-settings.js +4 -2
  341. package/dist/ui/panel-chat.js +96 -17
  342. package/dist/ui/panel-details.js +17 -0
  343. package/dist/ui/panel-fleet.js +1 -1
  344. package/dist/ui/panel-hub.js +4 -1
  345. package/dist/ui/panel-needs.js +11 -2
  346. package/dist/ui/panel-settings.js +57 -13
  347. package/dist/ui/settings-apply.js +8 -3
  348. package/dist/ui/settings-default-model-scope.js +40 -0
  349. package/dist/ui/settings-default-model-strings.js +43 -0
  350. package/dist/ui/settings-dialogs.js +9 -5
  351. package/dist/ui/settings-host-alerts.js +4 -3
  352. package/dist/ui/settings-host-monitoring.js +2 -1
  353. package/dist/ui/settings-hub.js +1 -1
  354. package/dist/ui/settings-layout.js +7 -2
  355. package/dist/ui/settings-model.js +9 -5
  356. package/dist/ui/settings-quota-notice.js +3 -3
  357. package/dist/ui/settings-registry.js +3 -0
  358. package/dist/ui/settings-shared-strings.js +22 -0
  359. package/dist/ui/settings-shared.js +59 -12
  360. package/dist/ui/settings-strings.js +2 -4
  361. package/dist/ui/shared/app-i18n.js +2 -2
  362. package/dist/ui/shared/app.css +124 -46
  363. package/dist/ui/shared/chat-composer.js +7 -6
  364. package/dist/ui/shared/chat-render.js +39 -1
  365. package/dist/ui/shared/chat-thread.js +8 -3
  366. package/dist/ui/shared/composer-focus.js +21 -0
  367. package/dist/ui/shared/hub-chat.css +30 -2
  368. package/dist/ui/shared/hub-rooms-u2.css +17 -0
  369. package/dist/ui/shared/task-board.css +406 -8
  370. package/dist/ui/trigger-complete.js +71 -0
  371. package/dist/web-api.d.ts +9 -0
  372. package/dist/web-api.js +128 -13
  373. package/dist/web-api.js.map +1 -1
  374. package/dist/windows-native-mcp.js +5 -2
  375. package/dist/windows-native-mcp.js.map +1 -1
  376. package/dist/workflow-templates/default.md +4 -6
  377. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import {monitoringHelp} from './host-monitoring-help.js';
1
2
  import {HostFootprintView,footprintText} from './host-footprint.js';
2
3
  import {hostTime} from './host-time.js';
3
4
  import {HostAlerts} from './host-alerts.js';
@@ -7,15 +8,17 @@ import {PageHead} from '/assets/page-head.js';
7
8
  import {Skeleton,ErrorState} from '/assets/ui-states.js';
8
9
  import {Icon} from '/assets/ui-icons.js';
9
10
  import {sectionPath} from '/assets/app-route.js';
10
- import {HOST_RANGES,numberOrNull,metricState,displayBytes,storageRows,historySeries,chartData,sampleCoverage} from './host-health-model.js';
11
+ import {HOST_RANGES,numberOrNull,metricState,displayBytes as formatBytes,storageRows,historySeries,chartData,sampleCoverage} from './host-health-model.js';
11
12
 
12
13
  register('hostHealth',{
13
14
  en:{title:'Host health',computer:'This computer',lead:'CPU, memory and storage from the latest recorded samples.',settings:'Monitoring settings',refresh:'Refresh',refreshing:'Refreshing…',unsupported:'Host monitoring is not available on this computer.',off:'Host monitoring is off',offHint:'Turn it on in Settings to collect samples and keep bounded local history.',admin:'Administrator sign-in required',adminHint:'Sign in as a Fleet administrator to see host metrics.',starting:'Waiting for the first samples',stopping:'Stopping monitoring',failedHint:'Monitoring could not complete. Check its settings and local storage permissions; history cleanup may still need attention.',failed:'Monitoring needs attention',unavailable:'Not available',stale:'Stale',lastLabel:'Last successful sample:',last:'Last successful sample: {0}',none:'No successful sample yet',wsl:'WSL 2',linux:'Linux',darwin:'macOS',wslNote:'CPU and memory describe WSL, not the physical Windows computer. The Windows backing drive is shown separately.',macNote:'APFS volumes may share free space. Do not add their free space together. Available memory is an estimate; pressure is shown separately.',linuxNote:'Local Linux filesystems and available memory. Unavailable fields are not treated as zero.',runtimeNote:'Paired Windows Runtimes are separate computers and are not included in these totals.',storage:'Storage',root:'Linux filesystem',state:'Fleet state',backing:'Windows backing drive',volume:'Local volume',drive:' ({0}:)',shared:'Shared APFS capacity',sharedHint:'Do not add free space across volumes.',free:'{0} available',used:'{0}% used',unknownDrive:'Windows drive not identified',chooseDrive:'Choose drive in Settings',unknownHint:'Linux free space alone does not show whether the Windows drive holding WSL has room.',cpu:'CPU',wslCpu:'WSL CPU',wslMemory:'WSL memory',cpuUsed:'{0}% used',cores:'{0} logical CPUs',loadLabel:'Load average:',load:'Load average: {0}',memory:'Memory',available:'{0} available of {1}',pressureLabel:'Memory pressure:',pressure:'Memory pressure: {0}',normal:'Normal',elevated:'Elevated',critical:'Critical',unknown:'Unknown',swap:'Swap free: {0}',history:'History',range:'History range',coverageSummary:'{0} of {1} readings have fresh data',collecting:'Collecting history…',noHistory:'No recorded samples in this range',historyUnavailable:'Recorded history is temporarily unavailable. Refresh to try again.',historyLoading:'Loading recorded history…',historyWaiting:'History has not started recording yet.',historyPaused:'History recording is paused.',historyFailed:'History could not be recorded. Current samples remain available.',lowSpace:'Low storage: keeping current samples in memory only.',recovering:'Waiting for both storage volumes to stay above 4 GiB for ten minutes.',diskUnavailable:'Storage data is unavailable; history is paused.',backingUnknown:'Identify the Windows backing drive before history can be recorded.',clockChanged:'The computer clock moved backwards; recording is waiting for it to catch up.',historyBusy:'History storage is busy; no additional write is queued.',minimum:'Minimum: {0}',maximum:'Peak: {0}',coverage:'{0} of {1} chart buckets contain recorded samples',gaps:'Gaps mean no sample was recorded; they are not zero.',retention:'History is capped at 64 MiB, with up to 24 hours of raw samples and 30 days of rollups. Older samples may be pruned earlier.',snapshotOnly:'Refresh reads saved snapshots. It does not start a new probe.',samples:'Host every 30 s · storage every 60 s',chart:'{0} history',usedHistory:'Storage used',freeHistory:'Available space trend',notMeasured:'Not measured'},
14
15
  'zh-TW':{title:'主機狀態',computer:'這台電腦',lead:'依最新記錄的取樣查看 CPU、記憶體與儲存空間。',settings:'監測設定',refresh:'重新整理',refreshing:'重新整理中…',unsupported:'這台電腦尚未提供主機監測。',off:'主機監測已關閉',offHint:'請在設定中開啟,開始取樣並保留容量受限的本機歷史。',admin:'需要管理員登入',adminHint:'請以 Fleet 管理員身分登入,才能查看主機資料。',starting:'等待第一筆取樣',stopping:'正在停止監測',failedHint:'主機監測未能完成操作,請檢查設定與本機儲存空間權限;歷史資料可能仍需清理。',failed:'主機監測需要處理',unavailable:'無法取得',stale:'資料已過期',lastLabel:'最後成功取樣:',last:'最後成功取樣:{0}',none:'尚無成功的取樣',wsl:'WSL 2',linux:'Linux',darwin:'macOS',wslNote:'CPU 與記憶體代表 WSL,不是實體 Windows 電腦。存放 WSL 的 Windows 磁碟會另外列出。',macNote:'APFS 磁碟區可能共用空間,請勿把可用空間相加。可用記憶體是估算值,記憶體壓力會另外顯示。',linuxNote:'本機 Linux 檔案系統與可用記憶體。無法取得的欄位不會當作零。',runtimeNote:'配對的 Windows 電腦是另一台,不算在這裡的數字裡。',storage:'儲存空間',root:'Linux 檔案系統',state:'Fleet 狀態資料',backing:'存放 WSL 的 Windows 磁碟',volume:'本機磁碟區',drive:'({0}:)',shared:'共用 APFS 容量',sharedHint:'請勿把各磁碟區的可用空間相加。',free:'可用 {0}',used:'已使用 {0}%',unknownDrive:'尚未確認 Windows 磁碟',chooseDrive:'到設定選擇磁碟',unknownHint:'只有 Linux 的可用空間,無法判斷存放 WSL 的 Windows 磁碟是否還有空間。',cpu:'CPU',wslCpu:'WSL CPU',wslMemory:'WSL 記憶體',cpuUsed:'使用率 {0}%',cores:'{0} 個邏輯 CPU',loadLabel:'平均負載:',load:'平均負載:{0}',memory:'記憶體',available:'可用 {0},共 {1}',pressureLabel:'記憶體壓力:',pressure:'記憶體壓力:{0}',normal:'正常',elevated:'偏高',critical:'嚴重',unknown:'未知',swap:'Swap 可用:{0}',history:'歷史紀錄',range:'歷史期間',coverageSummary:'{1} 項讀數中,{0} 項有最新資料',collecting:'正在累積歷史紀錄…',noHistory:'這段期間尚無記錄的取樣',historyUnavailable:'暫時無法取得歷史紀錄,請重新整理再試。',historyLoading:'正在載入歷史紀錄…',historyWaiting:'歷史紀錄尚未開始取樣。',historyPaused:'歷史紀錄已暫停。',historyFailed:'無法記錄歷史,目前的取樣仍可查看。',lowSpace:'儲存空間不足:目前取樣只保留在記憶體中。',recovering:'等待兩個儲存空間持續十分鐘都超過 4 GiB。',diskUnavailable:'無法取得儲存空間資料,歷史紀錄已暫停。',backingUnknown:'請先確認存放 WSL 的 Windows 磁碟,再記錄歷史。',clockChanged:'電腦時間往回調整,正在等待時間追上後再記錄。',historyBusy:'歷史儲存空間忙碌中,不會排入額外的寫入。',minimum:'最低:{0}',maximum:'最高:{0}',coverage:'{1} 個圖表區間中,{0} 個有記錄取樣',gaps:'缺口代表沒有記錄取樣,不是零。',retention:'歷史資料最多 64 MiB;原始取樣最多保留 24 小時,彙整最多 30 天。較舊的取樣可能提早清除。',snapshotOnly:'重新整理只讀取已保存的取樣,不會啟動新的探測。',samples:'主機每 30 秒 · 儲存空間每 60 秒',chart:'{0} 歷史',usedHistory:'儲存空間使用率',freeHistory:'可用空間趨勢',notMeasured:'未量測'}
15
16
  });
16
17
  const text=(key,...values)=>t(`hostHealth.${key}`,...values);
18
+ const displayBytes=value=>formatBytes(value)?.replace(/ /g,'\u00a0')??null;
19
+ const keepWords=value=>lang()==='zh-TW'?value.split(/(歷史|取樣)/).map(part=>/^(歷史|取樣)$/.test(part)?html`<span class="host-word">${part}</span>`:part):value;
17
20
  const date=value=>numberOrNull(value)===null?text('none'):hostTime(value);
18
- const sampleTime=value=>html`${text('lastLabel')}${lang()==='zh-TW'?'':' '}<span class="host-sample-time">${date(value)}</span>`;
21
+ const sampleTime=value=>html`${keepWords(text('lastLabel'))}${lang()==='zh-TW'?'':' '}<span class="host-sample-time">${date(value)}</span>`;
19
22
  const settingLink=()=>sectionPath('notifications')+'#host-monitoring';
20
23
  const metricLabel=(metric,interval)=>metricState(metric,interval)==='ok'?null:text(metricState(metric,interval));
21
24
  export function historyMessage(status){
@@ -25,7 +28,7 @@ export function historyMessage(status){
25
28
  function HistoryChart({answer,id,label,unit='percent'}){
26
29
  const model=chartData(answer?.series?.find(s=>s.id===id)?.buckets);
27
30
  const value=n=>n===null?text('unavailable'):unit==='bytes'?displayBytes(n):unit==='pressure'?text(({1:'normal',2:'elevated',3:'critical'})[Math.round(n)]||'unknown'):`${n.toFixed(1)}%`;
28
- return html`<figure class="host-chart"><figcaption>${label===text('freeHistory')?label:text('chart',label)}</figcaption>${model.covered>=4?html`<svg viewBox="0 0 600 110" role="img" aria-label=${`${label===text('freeHistory')?label:text('chart',label)}. ${text('minimum',value(model.min))}. ${text('maximum',value(model.max))}. ${text('coverage',model.covered,model.total)}`}><line x1="0" x2="600" y1="100" y2="100" />${model.segments.map((points,i)=>html`<polyline key=${i} points=${points} />`)}${model.dots.map((point,i)=>html`<circle key=${i} cx=${point.x} cy=${point.y} r="2.5"/>`)}</svg><p class="note">${text('minimum',value(model.min))} · ${text('maximum',value(model.max))}</p><p class="note">${text('coverage',model.covered,model.total)}</p>`:html`<p class="note host-no-history">${text(answer===undefined?'historyLoading':answer?.unavailable?'historyUnavailable':model.covered?'collecting':'noHistory')}</p>`}</figure>`;
31
+ return html`<figure class="host-chart"><figcaption>${keepWords(label===text('freeHistory')?label:text('chart',label))}</figcaption>${model.covered>=4?html`<svg viewBox="0 0 600 110" role="img" aria-label=${`${label===text('freeHistory')?label:text('chart',label)}. ${text('minimum',value(model.min))}. ${text('maximum',value(model.max))}. ${text('coverage',model.covered,model.total)}`}><line x1="0" x2="600" y1="100" y2="100" />${model.segments.map((points,i)=>html`<polyline key=${i} points=${points} />`)}${model.dots.map((point,i)=>html`<circle key=${i} cx=${point.x} cy=${point.y} r="2.5"/>`)}</svg><p class="note">${text('minimum',value(model.min))} · ${text('maximum',value(model.max))}</p><p class="note">${text('coverage',model.covered,model.total)}</p>`:html`<p class="note host-no-history">${keepWords(text(answer===undefined?'historyLoading':answer?.unavailable?'historyUnavailable':model.covered?'collecting':'noHistory'))}</p>`}</figure>`;
29
32
  }
30
33
  function ValueState({metric,interval}){const state=metricLabel(metric,interval);return state?html`<span class="tag">${state}</span>`:null;}
31
34
  function Storage({health,history}){
@@ -44,12 +47,12 @@ export function HostHealthView({health,history,busy,range,onRange,onRefresh,agen
44
47
  ${!populated?html`<p class="note">${text('snapshotOnly')}</p>`:null}
45
48
  ${health?.platformSupported===false?html`<section class="card"><h3>${text('unsupported')}</h3></section>`:!health?.enabled?html`<section class="card host-off"><h3>${text(health?.state==='failed'?'failed':health?.state==='stopping'?'stopping':'off')}</h3><p>${text(health?.state==='failed'?'failedHint':health?.state==='stopping'?'stopping':'offHint')}</p><a class="btn btn-primary" href=${settingLink()}>${text('settings')}</a></section>`:html`
46
49
  ${health.state!=='sampling'?html`<div class="notice" role="status">${text(({starting:'starting',stopping:'stopping',failed:'failed'})[health.state]||'unavailable')}</div>`:null}
47
- ${health.history?.state!=='recording'?html`<p class="notice" role="status">${historyMessage(health.history)}</p>`:null}
50
+ ${health.history?.state!=='recording'?html`<p class="notice" role="status">${keepWords(historyMessage(health.history))}</p>`:null}
48
51
  <${HostAlerts} alerts=${health.alerts} onChange=${onRefresh}/>
49
52
  <div class="host-range" role="group" aria-label=${text('range')}>${HOST_RANGES.map(r=>html`<button type="button" class=${`btn btn-sm${range===r?' active':''}`} aria-pressed=${range===r} onClick=${()=>onRange(r)}>${r}</button>`)}</div>
50
53
  <div class="host-grid"><div class="host-compute"><section class="card"><div class="host-row"><h3>${text(health.platform==='wsl'?'wslCpu':'cpu')}</h3><${ValueState} metric=${health.cpu} interval=${30000}/></div><p class="host-value">${numberOrNull(cpu?.usedPercent,100)===null?text('unavailable'):text('cpuUsed',cpu.usedPercent.toFixed(1))}</p><p class="note">${numberOrNull(cpu?.logicalCpus)!==null?text('cores',cpu.logicalCpus):text('unavailable')}</p>${Array.isArray(cpu?.loadAverage)?html`<p class="note">${text('loadLabel')}${lang()==='zh-TW'?'':' '}<span class="host-load-value">${cpu.loadAverage.slice(0,3).map(n=>numberOrNull(n)===null?'—':n.toFixed(2)).join(' / ')}</span></p>`:null}<p class="note">${sampleTime(health.cpu?.sampledAt)}</p><${HistoryChart} answer=${history} id="cpu.used" label=${text('cpu')}/></section>
51
- <section class="card"><div class="host-row"><h3>${text(health.platform==='wsl'?'wslMemory':'memory')}</h3><${ValueState} metric=${health.memory} interval=${30000}/></div><p class="host-value">${text('pressureLabel')}${lang()==='zh-TW'?'':' '}<span class="host-pressure-value">${text(metricState(health.memory,30000)==='ok'&&['normal','elevated','critical'].includes(memory?.pressure)?memory.pressure:'unknown')}</span></p><p class="note">${numberOrNull(memory?.availableBytes)===null?text('unavailable'):text('available',displayBytes(memory.availableBytes),displayBytes(memory.totalBytes)||text('unavailable'))}</p><p class="note">${text('swap',displayBytes(memory?.swapFreeBytes)||text('unavailable'))}</p><p class="note">${sampleTime(health.memory?.sampledAt)}</p><${HistoryChart} answer=${history} id="memory.available" label=${text('memory')} unit="bytes" /></section></div>
52
- <${Storage} health=${health} history=${history}/></div><p class="note">${text(health.platform==='wsl'?'wslNote':health.platform==='darwin'?'macNote':'linuxNote')}</p><p class="note">${text('samples')} · ${text('snapshotOnly')}</p><p class="note">${text('runtimeNote')}</p><p class="note">${text('gaps')}</p><p class="note">${text('retention')}</p><${HostFootprintView} snapshot=${health.footprint} offset=${agentOffset} onOffset=${onAgentOffset} onSelect=${onSelectedAgent} selected=${selectedAgent} charts=${selectedAgent&&health.footprint?.enabled?html`<${HistoryChart} answer=${history} id=${`agent.${selectedAgent}.cpu`} label=${footprintText('agentCpu')}/><${HistoryChart} answer=${history} id=${`agent.${selectedAgent}.rss`} label=${footprintText('agentMemory')} unit="bytes"/>`:null}/>`}
54
+ <section class="card"><div class="host-row"><h3>${text(health.platform==='wsl'?'wslMemory':'memory')}</h3><${ValueState} metric=${health.memory} interval=${30000}/></div><p class="host-value">${text('pressureLabel')}${lang()==='zh-TW'?'':' '}<span class="host-pressure-value">${text(metricState(health.memory,30000)==='ok'&&['normal','elevated','critical'].includes(memory?.pressure)?memory.pressure:'unknown')}</span></p><p class="note">${numberOrNull(memory?.availableBytes)===null?text('unavailable'):monitoringHelp(health.platform,memory.availableKind==='free'?'availableFallback':'available',displayBytes(memory.availableBytes),displayBytes(memory.totalBytes)||text('unavailable'))}</p><p class="note" data-platform-memory-help>${monitoringHelp(health.platform,'memory')}</p><p class="note">${health.platform==='darwin'?monitoringHelp('darwin','swap',displayBytes(memory?.details?.kind==='darwin'?memory.details.swapUsedBytes:null)||text('unavailable'),displayBytes(memory?.swapTotalBytes)||text('unavailable')):monitoringHelp(health.platform,'swap',displayBytes(memory?.swapFreeBytes)||text('unavailable'))}</p>${health.platform==='darwin'?html`<p class="note" data-memory-compression>${monitoringHelp('darwin','compression',displayBytes(memory?.details?.kind==='darwin'?memory.details.compressedBytes:null)||text('unavailable'),displayBytes(memory?.details?.kind==='darwin'?memory.details.storedBytes:null)||text('unavailable'))}</p>`:html`<p class="note" data-memory-psi>${monitoringHelp(health.platform,'psi',numberOrNull(memory?.details?.psiSomeAvg60,100)===null?text('unavailable'):memory.details.psiSomeAvg60.toFixed(1),numberOrNull(memory?.details?.psiFullAvg10,100)===null?text('unavailable'):memory.details.psiFullAvg10.toFixed(1))}</p>`}<p class="note">${sampleTime(health.memory?.sampledAt)}</p><${HistoryChart} answer=${history} id="memory.available" label=${monitoringHelp(health.platform,'chart')} unit="bytes" /></section></div>
55
+ <${Storage} health=${health} history=${history}/></div><p class="note">${monitoringHelp(health.platform,'overall')}</p><p class="note">${keepWords(text('samples'))} · ${keepWords(text('snapshotOnly'))}</p><p class="note">${text('runtimeNote')}</p><p class="note">${text('gaps')}</p><p class="note">${text('retention')}</p><${HostFootprintView} snapshot=${health.footprint} offset=${agentOffset} onOffset=${onAgentOffset} onSelect=${onSelectedAgent} selected=${selectedAgent} charts=${selectedAgent&&health.footprint?.enabled?html`<${HistoryChart} answer=${history} id=${`agent.${selectedAgent}.cpu`} label=${footprintText('agentCpu')}/><${HistoryChart} answer=${history} id=${`agent.${selectedAgent}.rss`} label=${footprintText('agentMemory')} unit="bytes"/>`:null}/>`}
53
56
  </section>`;
54
57
  }
55
58
  export function HostHealth({lease}){
@@ -0,0 +1,6 @@
1
+ import {register,t} from '/assets/app-i18n.js';
2
+ register('hostDarwin',{
3
+ en:{settings:'macOS uses its kernel memory-pressure state. Compression and swap are diagnostics, not percentages that trigger alerts. APFS volumes may share one storage pool.',memory:'Pressure comes from the macOS kernel. Low free RAM or a large swap allocation alone does not mean Critical.',available:'Reclaimable RAM estimate: {0} of {1}',availableFallback:'Reclaimable RAM estimate: {0} of {1}',swap:'Swap used: {0} · allocated now: {1}. macOS can change this pool.',compression:'Compressor RAM: {0} · stored content before compression: {1}',psi:'',alertHint:'Default: alert only at Critical. Your saved memory rule takes precedence.',overall:'macOS memory pressure, compression and dynamically allocated swap have different meanings. APFS volumes in one container share free space; it is not added once per volume.',chart:'Reclaimable RAM estimate'},
4
+ 'zh-TW':{settings:'macOS 依核心的記憶體壓力狀態判斷。壓縮與交換空間用來說明用量,不會按使用率觸發警示。APFS 卷宗可能共用同一個儲存空間。',memory:'壓力狀態來自 macOS 核心。可用 RAM 少或交換空間配置較大,單憑這些數字不代表嚴重。',available:'可回收 RAM 估算:{0}/{1}',availableFallback:'可回收 RAM 估算:{0}/{1}',swap:'已用交換空間:{0} · 目前配置:{1}。macOS 會調整這個空間。',compression:'壓縮器佔用 RAM:{0} · 壓縮前資料量:{1}',psi:'',alertHint:'預設只在嚴重時警示;你已儲存的記憶體規則優先。',overall:'macOS 的壓力狀態、壓縮與動態配置的交換空間各有不同意義。同一個 APFS 容器內的卷宗共用可用空間,不會按卷宗重複加總。',chart:'可回收 RAM 估算'}
5
+ });
6
+ export const help=(key,...args)=>t('hostDarwin.'+key,...args);
@@ -0,0 +1,7 @@
1
+ // Presentation dispatch only; each platform owns its wording and meaning.
2
+ import {help as darwin} from './host-monitoring-darwin.js';
3
+ import {help as linux} from './host-monitoring-linux.js';
4
+ import {help as wsl} from './host-monitoring-wsl.js';
5
+ import {register,t} from '/assets/app-i18n.js';
6
+ register('hostPlatformHelp',{en:{unavailable:'Unavailable',memory:'Memory',unknown:'Platform-specific information is unavailable until the platform is identified.'},'zh-TW':{unavailable:'無法取得',memory:'記憶體',unknown:'辨識平台後才能顯示該平台的說明。'}});
7
+ export function monitoringHelp(platform,key,...args){const own=platform==='darwin'?darwin:platform==='wsl'?wsl:platform==='linux'?linux:null;return own?own(key,...args):t('hostPlatformHelp.'+(['settings','memory','overall'].includes(key)?'unknown':key==='chart'?'memory':'unavailable'));}
@@ -0,0 +1,6 @@
1
+ import {register,t} from '/assets/app-i18n.js';
2
+ register('hostLinux',{
3
+ en:{settings:'Linux pressure uses MemAvailable, memory-stall information (PSI) when available, and swap. Missing PSI uses the existing RAM/swap policy.',memory:'Pressure follows the Linux policy for available RAM, swap and PSI stalls.',available:'MemAvailable: {0} of {1}',availableFallback:'Free RAM fallback (MemAvailable unavailable): {0} of {1}',swap:'Swap free: {0}',compression:'',psi:'Memory stalls: some {0}% (60 s) · full {1}% (10 s)',alertHint:'Default: warn at Elevated and alert urgently at Critical. Your saved memory rule takes precedence.',overall:'Linux reports estimated available memory, PSI stalls and swap separately. Missing signals remain unavailable; local filesystem space is shown for the relevant storage pool.',chart:'Available memory'},
4
+ 'zh-TW':{settings:'Linux 依 MemAvailable、可取得時的記憶體停滯資料(PSI)及交換空間判斷壓力。沒有 PSI 時沿用 RAM 與交換空間規則。',memory:'壓力標籤依 Linux 的可用 RAM、交換空間與 PSI 停滯規則判斷。',available:'可用記憶體:{0}/{1}',availableFallback:'可用記憶體備用讀數:{0}/{1}',swap:'可用交換空間:{0}',compression:'',psi:'記憶體停滯:部分 {0}%(60 秒)· 全部 {1}%(10 秒)',alertHint:'預設偏高時發出注意警示、嚴重時發出緊急警示;你已儲存的記憶體規則優先。',overall:'Linux 分別呈現估算的可用記憶體、PSI 停滯與交換空間。缺少的訊號維持無法取得;本機檔案系統依相關儲存空間顯示。',chart:'可用記憶體'}
5
+ });
6
+ export const help=(key,...args)=>t('hostLinux.'+key,...args);
@@ -0,0 +1,6 @@
1
+ import {register,t} from '/assets/app-i18n.js';
2
+ register('hostWsl',{
3
+ en:{settings:'WSL pressure uses its Linux MemAvailable, PSI and swap. These are WSL figures; the Windows drive holding the virtual disk is monitored separately.',memory:'Memory and swap belong to the WSL environment, not all Windows RAM. Pressure follows the Linux RAM/swap and PSI policy.',available:'WSL MemAvailable: {0} of {1}',availableFallback:'WSL free RAM fallback (MemAvailable unavailable): {0} of {1}',swap:'WSL swap free: {0}',compression:'',psi:'WSL memory stalls: some {0}% (60 s) · full {1}% (10 s)',alertHint:'Default: warn at Elevated and alert urgently at Critical. Your saved memory rule takes precedence.',overall:'WSL memory/swap are separate from Windows host memory. The Windows drive holding the virtual disk has its own free-space reading; an unknown drive is never guessed.',chart:'WSL available memory'},
4
+ 'zh-TW':{settings:'WSL 依自身 Linux 的 MemAvailable、PSI 與交換空間判斷壓力。這些是 WSL 的數字;存放虛擬磁碟的 Windows 磁碟另行監測。',memory:'記憶體與交換空間屬於 WSL 環境,不是整台 Windows 電腦的 RAM。壓力依 Linux 的 RAM、交換空間與 PSI 規則判斷。',available:'WSL 可用記憶體:{0}/{1}',availableFallback:'WSL 可用記憶體備用讀數:{0}/{1}',swap:'WSL 可用交換空間:{0}',compression:'',psi:'WSL 記憶體停滯:部分 {0}%(60 秒)· 全部 {1}%(10 秒)',alertHint:'預設偏高時發出注意警示、嚴重時發出緊急警示;你已儲存的記憶體規則優先。',overall:'WSL 的記憶體與交換空間不代表 Windows 主機的全部用量。存放虛擬磁碟的 Windows 磁碟另有可用空間讀數;無法辨識時不會猜測。',chart:'WSL 可用記憶體'}
5
+ });
6
+ export const help=(key,...args)=>t('hostWsl.'+key,...args);
@@ -7,6 +7,7 @@ register("hub", {
7
7
  classicRoomLead: "You can also share the agent of a ClassicBot room. Hub questions and answers are not posted in its Discord or Telegram room, and the room's chat is not copied to the Hub. It is one agent with one memory, though: it may use what it learned in the room when it answers on the Hub, and the other way round.",
8
8
  agentShared: "Shared: Hub questions go to this agent's own conversation.",
9
9
  republishRequired: "Shared under the older restricted mode. Hub questions are refused until you share this agent again.",
10
+ shareLapsed: "Its backend or folder changed since you shared it, and a share does not carry over. Hub questions are refused until you share it again.",
10
11
  shareAgain: "Share again",
11
12
  classicRoomTag: "ClassicBot room",
12
13
  agentNotShareable: "This agent can't be shared right now. Reload the page and try again.",
@@ -17,6 +18,7 @@ register("hub", {
17
18
  classicRoomLead: "也可以分享 ClassicBot 房間的 Agent。Hub 的提問與回答不會貼到它的 Discord 或 Telegram 房間,房間的聊天也不會複製到 Hub。但它是同一個 Agent、同一份記憶:回答 Hub 的提問時,可能用到它在房間裡得知的內容,反過來也一樣。",
18
19
  agentShared: "已分享:Hub 的提問會送到這個 Agent 自己的對話。",
19
20
  republishRequired: "這是舊的受限模式分享。重新分享這個 Agent 之前,Hub 的提問都會被拒絕。",
21
+ shareLapsed: "分享之後它的後端或資料夾換了,原本的分享不會延續。重新分享之前,Hub 的提問都會被拒絕。",
20
22
  shareAgain: "重新分享",
21
23
  classicRoomTag: "ClassicBot 房間",
22
24
  agentNotShareable: "目前無法分享這個 Agent。請重新整理頁面後再試一次。",
@@ -499,6 +499,10 @@ export function createHubWebClient({ fetchImpl = (...a) => fetch(...a), readTime
499
499
  reactRoomMessage(roomId, messageId, emoji, on) { return call("POST", `/hub/v1/rooms/${id(roomId)}/messages/${id(messageId)}/reactions`, { emoji: String(emoji), on: on === true }); },
500
500
  /** M-3340: my own pins in a group room (nobody else's) → { pins: [{ messageId, pinnedAt, message }] }, newest first. */
501
501
  roomPins(roomId) { return call("GET", `/hub/v1/rooms/${id(roomId)}/pins`); },
502
+ /** M-3533 R1: a Hub that serves rooms' offices (with the session's room-office-v1). */
503
+ roomOfficeV1: true,
504
+ /** M-3533 R1: a group room's office, as a share link's /state reads (409 office-off while a manager has it off). */
505
+ roomOfficeState(roomId) { return call("GET", `/hub/v1/rooms/${id(roomId)}/office/state`); },
502
506
  /** M-3340: pin (`on`) or unpin a group-room message for me only → { pins }. Past 50: the Hub refuses (pins-full). */
503
507
  pinRoomMessage(roomId, messageId, on) { return call(on ? "PUT" : "DELETE", `/hub/v1/rooms/${id(roomId)}/pins/${id(messageId)}`); },
504
508
  markRoomRead(roomId, upTo) { return call("POST", `/hub/v1/rooms/${id(roomId)}/read`, { upTo }); },
@@ -3,6 +3,7 @@ register("hubMyAgents", {
3
3
  en: {
4
4
  offlineShort:"Offline · last seen {0}", knownShared:"{0} shared", oldCountOne:"1 Fleet needs an update to share agents from here.", oldCount:"{0} Fleets need an update to share agents from here.", namesMore:"{0} and {1} more", lead:"The agents you can share on this Hub, and who may ask each one.", refresh:"Refresh", refreshing:"Checking…", fleet:"Fleet", connected:"Connected", offline:"This Fleet is offline. Shown as last seen at {0}.", count:"{0} of {1} shared", select:"Select all", general:"Your Fleet's General. It can manage this Fleet.", classic:"ClassicBot room", classicHint:"Hub questions and answers are not posted in its Discord or Telegram room, and the room's chat is not copied to the Hub. It is one agent with one memory: it may use what it learned in the room when it answers here.",
5
5
  old:"Update this Fleet to share agents from here.", update:"Update this Fleet", updateHint:"On that computer, open Settings → Hub and check its connection and version.", off:"Sharing from the Hub page is turned off in this Fleet's Settings → Hub.", denied:"Your Hub administrator hasn't allowed you to share agents.", unknown:"The Hub could not check whether sharing is allowed. Refresh to check.", remote:"This kind of agent can't answer Hub questions yet.", unavailable:"This agent cannot answer Hub questions right now.", limit:"This Fleet already shares 64 agents, the most allowed.", suspended:"This Fleet is paused on this Hub.", revoked:"This Fleet was removed from this Hub.",
6
+ lapsed:"Its backend or folder changed since you shared it, so Hub questions are refused until you share it again. The people who may ask it stay.", shareAgain:"Share again", needsReshare:"Needs re-share", kept:"(kept)",
6
7
  shared:"Shared", nobody:"nobody may ask yet", peopleOne:"1 person may ask", people:"{0} people may ask", subjects:"{0} people, groups or teams may ask", paused:"Paused", sharing:"Sharing…", stopping:"Stopping…", uncertain:"Not confirmed yet: this Fleet hasn't answered. Refresh to check.", refused:"Not shared: {0}", changed:"This list changed. It has been refreshed; tick again.",
7
8
  shareOne:"Share 1 agent", stopOne:"Stop sharing 1 agent", stopTitleOne:"Stop sharing 1 agent?", accessTitleOne:"1 agent is shared. Who may ask it?", share:"Share {0} agents", stop:"Stop sharing {0} agents", mixed:"Share {0} · Stop sharing {1}", apply:"Apply changes", cancel:"Cancel", stopTitle:"Stop sharing {0} agents?", stopBody:"People will no longer be able to ask: {0}. Their lists of who may ask are cleared.", stopHint:"To keep the lists and only stop answers for now, pause sharing instead.", stopGo:"Stop sharing", pause:"Pause instead", pauseOne:"Pause sharing", later:"Decide later", accessTitle:"{0} agents are shared. Who may ask them?", accessLead:"Nobody can ask them until you choose.", same:"The same people for all {0}", each:"Choose for each agent", choose:"Choose who may ask", previousMixed:"Use the list it had before", previous:"Use the list it had before ({0} people)", used:"The previous list is saved.", saved:"Saved", saveFailed:"Could not save access for {0}. Check the current agent and try again.", personal:"On my own computer", details:"Open {0}",
8
9
  empty:"You don't have an agent on this Hub yet.", already:"You can already ask other people's agents: open Chats, or @mention an agent in a room.", emptyLead:"To have an agent of your own that colleagues can ask:", personalOff:"Personal agents are turned off on this Hub. Ask your Hub administrator.", fleetLead:"If you run AgEnD, share the agents in it.", connectDenied:"Ask your Hub administrator to let you connect a Fleet.", apps:"Your own Claude Code or Codex can also use this Hub for you. That is for asking and posting as you. Colleagues can't ask it.", appsLink:"My AI apps", failed:"The list could not be read. Refresh to try again.",
@@ -10,6 +11,7 @@ register("hubMyAgents", {
10
11
  "zh-TW": {
11
12
  offlineShort:"離線 · 最後上線 {0}", knownShared:"已分享 {0}", oldCountOne:"有 1 個 Fleet 需要更新,才能從這裡分享 Agent。", oldCount:"有 {0} 個 Fleet 需要更新,才能從這裡分享 Agent。", namesMore:"{0} 等 {1} 個", lead:"可以分享到這個 Hub 的 Agent,以及誰可以向它們提問。", refresh:"重新整理", refreshing:"確認中…", fleet:"Fleet", connected:"已連接", offline:"這個 Fleet 目前離線,顯示的是 {0} 的狀態。", count:"已分享 {0} / {1}", select:"全選", general:"你的 Fleet 的 General,可以管理這個 Fleet。", classic:"ClassicBot 房間", classicHint:"Hub 的提問與回答不會貼到它的 Discord 或 Telegram 房間,房間的聊天也不會複製到 Hub。但它是同一個 Agent、同一份記憶:在這裡回答時,可能用到它在房間裡得知的內容。",
12
13
  old:"請更新這個 Fleet,才能從這裡分享 Agent。", update:"更新這個 Fleet", updateHint:"請到那台電腦的「設定 → Hub」,確認連接狀態與版本。", off:"這個 Fleet 的「設定 → Hub」關閉了從 Hub 頁面分享。", denied:"Hub 管理員還沒有允許你分享 Agent。", unknown:"Hub 目前無法確認是否允許分享,請重新整理確認。", remote:"這種 Agent 還不能回答 Hub 的提問。", unavailable:"這個 Agent 目前無法回答 Hub 的提問。", limit:"這個 Fleet 已經分享 64 個 Agent,達到上限。", suspended:"這個 Fleet 在這個 Hub 已暫停。", revoked:"這個 Fleet 已從這個 Hub 移除。",
14
+ lapsed:"分享之後它的後端或資料夾換了,重新分享之前 Hub 的提問都會被拒絕。可以提問的人會保留。", shareAgain:"重新分享", needsReshare:"需要重新分享", kept:"(會保留)",
13
15
  shared:"分享中", nobody:"還沒有人可以問", peopleOne:"1 人可以提問", people:"{0} 人可以提問", subjects:"{0} 個人員、群組或團隊可以提問", paused:"已暫停", sharing:"分享中…", stopping:"停止中…", uncertain:"還沒有確認:這個 Fleet 尚未回應,請重新整理確認。", refused:"沒有分享:{0}", changed:"清單已有變動並重新整理,請重新勾選。",
14
16
  shareOne:"分享 1 個 Agent", stopOne:"停止分享 1 個 Agent", stopTitleOne:"要停止分享 1 個 Agent 嗎?", accessTitleOne:"已分享 1 個 Agent。誰可以問它?", share:"分享 {0} 個 Agent", stop:"停止分享 {0} 個 Agent", mixed:"分享 {0} 個 · 停止分享 {1} 個", apply:"套用變更", cancel:"取消", stopTitle:"要停止分享 {0} 個 Agent 嗎?", stopBody:"同仁將無法再問:{0}。這些 Agent 的「可以提問的人」名單會被清除。", stopHint:"如果只是暫時不回答、想保留名單,請改用「暫停分享」。", stopGo:"停止分享", pause:"改為暫停", pauseOne:"暫停分享", later:"稍後再決定", accessTitle:"已分享 {0} 個 Agent。誰可以問它們?", accessLead:"在你選擇之前,沒有人可以問它們。", same:"{0} 個都用同一份名單", each:"每個 Agent 分開選", choose:"選擇誰可以提問", previousMixed:"沿用之前的名單", previous:"沿用之前的名單({0} 人)", used:"已儲存之前的名單。", saved:"已儲存", saveFailed:"無法儲存 {0} 的提問權限,請確認目前的 Agent 後再試。", personal:"在我的電腦上", details:"開啟 {0}",
15
17
  empty:"你在這個 Hub 還沒有自己的 Agent。", already:"你現在就可以問別人的 Agent:到「對話」,或在房間裡 @ 一個 Agent。", emptyLead:"想要有自己的 Agent 讓同仁提問:", personalOff:"這個 Hub 還沒有開啟個人 Agent,請洽 Hub 管理員。", fleetLead:"如果你有在使用 AgEnD,可以分享裡面的 Agent。", connectDenied:"請 Hub 管理員允許你連接 Fleet。", apps:"你自己的 Claude Code 或 Codex 也可以替你使用這個 Hub,用來提問和發言;同仁不能問它。", appsLink:"我的 AI App", failed:"無法讀取清單,請重新整理再試。",
@@ -74,6 +74,18 @@ export function HubMyAgents({ client, scope, shared = [], policy = false, person
74
74
  const response = r.ok ? r : definite ? { state: "complete", result: { results: op.rows.map(row => ({ ...(row.instance ? { instance: row.instance } : { exposureId: row.id }), ok: false, code: r.code === "conflict" ? "stale-list" : r.code === "denied" ? "not-allowed" : "unavailable" })) } } : op.response;
75
75
  persist(currentOps.current.map(x => x.input.idempotencyKey === op.input.idempotencyKey ? { ...x, response } : x));
76
76
  };
77
+ // M-3543: Share again of a lapsed agent (shared, but its backend/folder changed since): one share request for it, which
78
+ // the Fleet answers with a republish at the next revision; the Hub keeps the people who may ask it.
79
+ const shareAgain = async (row, fleet) => {
80
+ if (writing.current) return; writing.current = true; setBusy(true); const generation = life.current;
81
+ try {
82
+ const op = { input: { idempotencyKey: crypto.randomUUID(), fleetId: fleet.id, catalogRevision: fleet.catalog.revision, share: [row.instance], stop: [] }, at: Date.now(),
83
+ rows: [{ instance: row.instance, name: row.displayName, before: { id: row.current.id, revision: row.current.revision } }], response: null };
84
+ persist([...currentOps.current.slice(-24), op]);
85
+ await send(op, generation);
86
+ await load(generation);
87
+ } finally { if (live(generation)) { writing.current = false; setBusy(false); } }
88
+ };
77
89
  const refresh = async () => {
78
90
  if (writing.current) return; writing.current = true; setBusy(true); const generation = life.current;
79
91
  try {
@@ -119,7 +131,11 @@ export function HubMyAgents({ client, scope, shared = [], policy = false, person
119
131
  <span class="hub-row-text">${row.current ? html`<a href=${`/ui/hub/exposures?agent=${encodeURIComponent(row.current.id)}`} aria-label=${ms("details", row.displayName)}><strong>${row.displayName}</strong></a>` : html`<strong>${row.displayName}</strong>`}
120
132
  ${row.kind === "classic-room" ? html`<small class="tag">${ms("classic")}</small>` : null}<small class="note">${reason && reason !== "offline" ? ms(reason) : row.general ? ms("general") : row.description}</small>
121
133
  ${row.current?.intro ? html`<small class="note">${row.current.intro}</small>` : null}
122
- ${row.shared ? html`<small class="note">${ms(row.current.state !== "published" ? "paused" : "shared")} · ${summary(row.current)}</small>` : null}
134
+ ${row.shared ? (row.exposure?.lapsed === true && row.instance
135
+ ? html`<small class="note hub-agent-lapsed-status">${ms("needsReshare")} · ${summary(row.current)}${lang() === "zh-TW" ? "" : " "}${ms("kept")}</small>`
136
+ : html`<small class="note">${ms(row.current.state !== "published" ? "paused" : "shared")} · ${summary(row.current)}</small>`) : null}
137
+ ${row.shared && row.exposure?.lapsed === true && row.instance ? html`<small class="note hub-agent-lapsed" role="status">${ms("lapsed")}</small>
138
+ <button type="button" class="btn btn-sm hub-agent-share-again" data-share-again=${row.instance} disabled=${busy || !!waiting.length} onClick=${() => shareAgain(row, fleet)}>${ms("shareAgain")}</button>` : null}
123
139
  ${status ? html`<small class=${status.state === "refused" ? "err" : "note"} role="status">${status.state === "uncertain" ? ms("uncertain") : status.state === "refused" ? status.code === "stale-list" ? ms("changed") : ms("refused", ms(({ "not-allowed": "denied", "switched-off": "off", "limit": "limit", "not-shareable": "unavailable" })[status.code] || "unavailable")) : ms(status.instance ? "sharing" : "stopping")}</small>` : null}</span>
124
140
  ${pausable && row.shared && row.current.state === "published" && typeof client.ownerSharing === "function" ? html`<button type="button" class="btn btn-sm hub-agent-pause" disabled=${busy} onClick=${() => pause([{ ...row, fleet }])}>${ms("pauseOne")}</button>` : null}</div>
125
141
  ${row.kind === "classic-room" && tick && !row.shared ? html`<p class="note hub-classic-disclosure">${ms("classicHint")}</p>` : null}</div>`; })}</div></details>`;
@@ -79,6 +79,74 @@ export function mentionsIn(text, detail) {
79
79
  return [...new Set(out)];
80
80
  }
81
81
 
82
+ /**
83
+ * M-3533 (#4355 review): who a mention put in the box stands for — the office card's "@ it" and the members panel's — is
84
+ * that member, not every member of its name. A binding is one mention where it was put: { name, id, start } (its `@name`
85
+ * at `start`). Edits move or retire it (shiftBindings); only one still whole at its place binds (intactBindings).
86
+ */
87
+ const tokenAt = (s, b) => s.startsWith(`@${b.name}`, b.start) && !/[\w-]/.test(s.charAt(b.start + 1 + b.name.length));
88
+ /**
89
+ * The edit that turned `prev` into `next`, from the box's selection when it began ({ start, end }) and its caret after
90
+ * (`caret`): prev[a, b) became next[a, caret) — typing, a paste, a cut, Backspace or Delete, an IME's composed text — or
91
+ * null when those do not account for the change (the change is then not the box's own: see shiftBindings).
92
+ */
93
+ export function editRange(prev, next, sel, caret) {
94
+ const a0 = String(prev || ""), b0 = String(next || "");
95
+ if (!sel || !Number.isInteger(sel.start) || !Number.isInteger(sel.end) || !Number.isInteger(caret)) return null;
96
+ const a = Math.min(sel.start, caret), b = caret - (b0.length - a0.length);
97
+ if (a < 0 || b < a || b > a0.length || caret > b0.length) return null;
98
+ return a0.slice(0, a) === b0.slice(0, a) && a0.slice(b) === b0.slice(caret) ? { a, b, c: caret } : null;
99
+ }
100
+ /**
101
+ * The bindings after the text changed from `prev` to `next` by `range` (editRange: prev[a, b) became next[a, c)): a
102
+ * mention wholly before the edit stays, one wholly after it moves by the change in length, one the edit touches is gone
103
+ * (deleted or edited: a later pick or a name retyped by hand cannot revive it). With no range, the edit could be anywhere
104
+ * the two texts allow (two identical mentions: either one) — every binding it could have touched is gone, none is moved
105
+ * onto another member's mention.
106
+ */
107
+ export function shiftBindings(prev, next, bindings = [], range = null) {
108
+ const a0 = String(prev || ""), b0 = String(next || ""), list = Array.isArray(bindings) ? bindings : [];
109
+ if (a0 === b0) return list;
110
+ const d = b0.length - a0.length;
111
+ let lo, hi;
112
+ if (range) { lo = range.a; hi = range.b; } else {
113
+ // The earliest and the latest the edit can be: the longest common start first, and the longest common end first.
114
+ let p = 0; while (p < a0.length && p < b0.length && a0[p] === b0[p]) p++;
115
+ let q = 0; while (q < a0.length - p && q < b0.length - p && a0[a0.length - 1 - q] === b0[b0.length - 1 - q]) q++;
116
+ let q2 = 0; while (q2 < a0.length && q2 < b0.length && a0[a0.length - 1 - q2] === b0[b0.length - 1 - q2]) q2++;
117
+ let p2 = 0; while (p2 < a0.length - q2 && p2 < b0.length - q2 && a0[p2] === b0[p2]) p2++;
118
+ lo = Math.min(p, p2); hi = Math.max(a0.length - q, a0.length - q2);
119
+ }
120
+ return list.flatMap((x) => {
121
+ const end = x.start + 1 + x.name.length;
122
+ if (end <= lo) return [x];
123
+ if (x.start >= hi) return [{ ...x, start: x.start + d }];
124
+ return [];
125
+ });
126
+ }
127
+ /** The bindings still whole where they were put in `text`. */
128
+ export const intactBindings = (text, bindings = []) => (Array.isArray(bindings) ? bindings : [])
129
+ .filter((b) => b && typeof b.name === "string" && typeof b.id === "string" && Number.isInteger(b.start) && tokenAt(String(text || ""), b));
130
+ /**
131
+ * The mentions `text` sends: as read (mentionsIn), except that a name whose every `@name` is a bound mention sends the
132
+ * members bound — two agents called Notes, picked one each, send those two; one picked and one typed by hand reads as
133
+ * typed (both).
134
+ */
135
+ export function boundMentions(text, detail, bindings = []) {
136
+ const s = String(text || ""), out = mentionsIn(s, detail), live = intactBindings(s, bindings);
137
+ if (!live.length) return out;
138
+ const byName = new Map();
139
+ for (const b of live) { const k = b.name.toLocaleLowerCase("en-US"); byName.set(k, [...(byName.get(k) || []), b]); }
140
+ let result = out;
141
+ for (const [k, list] of byName) {
142
+ const name = list[0].name, said = (s.match(atName(name, "g")) || []).length;
143
+ if (list.length < said) continue;
144
+ const same = new Set(agentsOf(detail).filter((a) => String(a.name).toLocaleLowerCase("en-US") === k).map((a) => a.id));
145
+ result = [...result.filter((id) => !same.has(id)), ...list.map((b) => b.id)];
146
+ }
147
+ return [...new Set(result)];
148
+ }
149
+
82
150
  // M-3308: the paste helpers live with the Hub's files (hub-attachments.js), shared with the 1:1 question's composer (M-3311).
83
151
  export { LONG_PASTE_CHARS, pastedFile } from "./hub-attachments.js";
84
152
 
@@ -105,6 +173,9 @@ export function refusalText(r) {
105
173
  */
106
174
  export function RoomComposer({ store, detail, reply = null, onReply = () => {}, closed = false, inputRef, insertRef, attach = null, pending = null, canSendEmpty = false }) {
107
175
  const [value, setValue] = useState(""), [msg, setMsg] = useState(null), [busy, setBusy] = useState(false), [pick, setPick] = useState(0);
176
+ // M-3533: the mentions put in the box for a member, where they were put; each edit moves or retires them by its own
177
+ // range (editRange: the selection when it began, the caret after), never by guessing from the text.
178
+ const bindings = useRef([]), edit = useRef({ input: null, key: null, ime: null, composing: false });
108
179
  const own = useRef(null), input = inputRef || own;
109
180
  const [caret, setCaret] = useState(0);
110
181
  const at = mentionAt(value, caret), options = at ? mentionOptions(detail, at.query) : [];
@@ -113,10 +184,36 @@ export function RoomComposer({ store, detail, reply = null, onReply = () => {},
113
184
  const short = useShortPlaceholder();
114
185
  // M-3117: the Fleet chat's box takes the focus when its conversation opens (panel-chat.js Composer): a room's too.
115
186
  useEffect(() => { if (!closed) input.current?.focus(); }, [room.id || "", closed]);
116
- // 「在這裡 @ 它」 from the members panel: the mention goes into the box, after what is there.
117
- if (insertRef) insertRef.current = (text) => { setValue((v) => `${v && !/\s$/.test(v) ? `${v} ` : v}${text} `); setTimeout(() => input.current?.focus(), 0); };
187
+ // 「在這裡 @ 它」 from the members panel or the office card: the mention goes into the box, after what is there, bound to
188
+ // the member it was picked for (`bind`: { name, id }; see boundMentions).
189
+ if (insertRef) insertRef.current = (text, bind = null) => {
190
+ setValue((v) => {
191
+ const base = v && !/\s$/.test(v) ? `${v} ` : v;
192
+ // Appended after everything: no mention already in the box moves; this one is bound where it is put.
193
+ if (bind) bindings.current = [...bindings.current, { ...bind, start: base.length + text.indexOf(`@${bind.name}`) }];
194
+ return `${base}${text} `;
195
+ });
196
+ setTimeout(() => input.current?.focus(), 0);
197
+ };
198
+ // Where the box's selection was when this edit began: the edit's own beforeinput (each one, so a caret moved since is
199
+ // never stale); an IME's, where its composition started (kept to its end: the text arrives once, at compositionend);
200
+ // the latest key's (each keydown, an arrow too, replaces it) only where no beforeinput came. Spent by each edit.
201
+ useEffect(() => {
202
+ const el = input.current;
203
+ if (!el?.addEventListener) return undefined;
204
+ const at = () => ({ start: el.selectionStart, end: el.selectionEnd });
205
+ const on = {
206
+ beforeinput: () => { if (!edit.current.composing) edit.current.input = at(); },
207
+ keydown: () => { edit.current.key = at(); },
208
+ compositionstart: () => { edit.current.composing = true; edit.current.ime = at(); },
209
+ compositionend: () => { edit.current.composing = false; },
210
+ };
211
+ for (const [k, fn] of Object.entries(on)) el.addEventListener(k, fn);
212
+ return () => { for (const [k, fn] of Object.entries(on)) el.removeEventListener(k, fn); };
213
+ }, [input.current]);
118
214
  const complete = (o) => {
119
215
  const next = `${value.slice(0, at.start)}${o.label} ${value.slice(caret)}`;
216
+ bindings.current = shiftBindings(value, next, bindings.current, { a: at.start, b: caret, c: at.start + o.label.length + 1 });
120
217
  setValue(next); setPick(0);
121
218
  setTimeout(() => { const el = input.current; if (el) { const n = at.start + o.label.length + 1; el.focus(); try { el.setSelectionRange(n, n); } catch { /* not a text field */ } setCaret(n); } }, 0);
122
219
  };
@@ -124,9 +221,9 @@ export function RoomComposer({ store, detail, reply = null, onReply = () => {},
124
221
  // M-3125: `canSendEmpty` — files are ready to go, so a post may be the files alone (the server takes it).
125
222
  const text = value.trim(); if ((!text && !canSendEmpty) || busy || closed) return;
126
223
  setBusy(true); setMsg(null);
127
- const r = await store.send(text, { mentions: mentionsIn(text, detail), ...(reply ? { replyTo: reply.roomMessage } : {}) });
224
+ const r = await store.send(text, { mentions: boundMentions(value, detail, bindings.current), ...(reply ? { replyTo: reply.roomMessage } : {}) });
128
225
  setBusy(false);
129
- if (r.ok) { setValue(""); onReply(null); } else setMsg({ text: refusalText(r), retry: !REFUSALS[r.code] });
226
+ if (r.ok) { setValue(""); bindings.current = []; onReply(null); } else setMsg({ text: refusalText(r), retry: !REFUSALS[r.code] });
130
227
  };
131
228
  const onKeyDown = (e) => {
132
229
  if (palette && (e.key === "ArrowDown" || e.key === "ArrowUp")) { e.preventDefault(); setPick((i) => (i + (e.key === "ArrowDown" ? 1 : palette.length - 1)) % palette.length); return; }
@@ -135,7 +232,13 @@ export function RoomComposer({ store, detail, reply = null, onReply = () => {},
135
232
  // Enter sends, Shift+Enter is a new line — the Fleet chat's own rule (and a phone's).
136
233
  if (globalThis.AgendChatRender?.composerKey(e, { touch: touchScreen() }) === "send") { e.preventDefault(); void send(); }
137
234
  };
138
- const track = (v) => { setValue(v); setMsg(null); setCaret(input.current ? input.current.selectionStart ?? v.length : v.length); };
235
+ const track = (v) => {
236
+ const c = input.current ? input.current.selectionStart ?? v.length : v.length;
237
+ const e = edit.current, began = e.ime || e.input || e.key;
238
+ bindings.current = shiftBindings(value, v, bindings.current, editRange(value, v, began, c));
239
+ edit.current = { input: null, key: null, ime: null, composing: e.composing };
240
+ setValue(v); setMsg(null); setCaret(c);
241
+ };
139
242
  // M-3308 (the user: a screenshot pasted with Ctrl+V did nothing in a room): the Fleet chat's paste, through the room's own
140
243
  // Attach and its file rules (hub-attachments.js pasteToAttach). A room that takes no files keeps the text (as before).
141
244
  const onPaste = (e) => { if (!closed) pasteToAttach(e, attach); };
@@ -5,8 +5,15 @@ import { register, t } from "/assets/app-i18n.js";
5
5
 
6
6
  register("hubRoomMembers", {
7
7
  en: { askOwner: "ask {0}", fewer: "Show fewer", ownerOf: "Owner: {0}", removeFailed: "It was not removed. Try again.", agents: "Agents", ownerAgent: "{0}'s agent", ownerAgentLatin: "{0}'s agent",
8
- noAgents: "No agents yet. A room manager can add or invite them in Room settings." },
8
+ noAgents: "No agents yet. A room manager can add or invite them in Room settings.",
9
+ // M-3533 M1: the compact list of a large room.
10
+ summary: "{0} people, {1} online · {2} agents of {3} owners", filter: "Filter: name or owner", filterLabel: "Filter members",
11
+ notOnline: "Not online · {0}", ownerGroup: "{0} · {1}", noOwner: "—", noMatch: "No members match.",
12
+ membersMatch: "Members · {0} of {1} match", agentsMatch: "Agents · {0} of {1} match" },
9
13
  "zh-TW": { askOwner: "請通知 {0}", fewer: "收合", ownerOf: "擁有者:{0}", removeFailed: "沒有移除,請再試一次。", agents: "Agent", ownerAgent: "{0}的 Agent", ownerAgentLatin: "{0} 的 Agent",
10
- noAgents: "還沒有 Agent。房間管理可以在房間設定加入或邀請。" },
14
+ noAgents: "還沒有 Agent。房間管理可以在房間設定加入或邀請。",
15
+ summary: "{0} 人,{1} 人在線上 · {2} 個 Agent,{3} 位擁有者", filter: "篩選:名稱或擁有者", filterLabel: "篩選成員",
16
+ notOnline: "不在線上 · {0}", ownerGroup: "{0} · {1}", noOwner: "—", noMatch: "沒有符合的成員。",
17
+ membersMatch: "成員 · 符合 {0}/{1}", agentsMatch: "Agent · 符合 {0}/{1}" },
11
18
  });
12
19
  export const hm = (key, ...args) => t(`hubRoomMembers.${key}`, ...args);
@@ -6,6 +6,7 @@ import { hi } from "./hub-agent-intro.js";
6
6
  // The dots use the Fleet sidebar's colours (.dot ok / busy / warn / off), so a state reads the same in both.
7
7
  // The shell owns the room's detail (and reads it again on member.changed); this panel applies presence.changed in place.
8
8
  import { html, useEffect, useState } from "/assets/app-html.js";
9
+ import { lang } from "/assets/app-i18n.js";
9
10
  import { hubClient } from "./hub-client.js";
10
11
  import { hm } from "./hub-room-members-strings.js";
11
12
  import { hroom } from "./hub-room-strings.js";
@@ -16,6 +17,36 @@ import { roomSource, RoomSourceMark } from "./hub-room-source.js";
16
17
  linkRoomsU2Css();
17
18
 
18
19
  const AGENTS_SHOWN = 8;
20
+ /**
21
+ * M-3533 M1 (docs/design/hub-office-visit.md §2.6): past this many people and agents together, the list is compact — a
22
+ * summary line, a filter, one line a row, the people not online folded, the agents grouped by owner (folded). A smaller
23
+ * room keeps today's list.
24
+ */
25
+ export const COMPACT_OVER = 12;
26
+
27
+ /** M1: a member matches the filter by its name or (an agent) its owner's, ignoring case. */
28
+ export const memberMatches = (m, q) => { const s = String(q || "").trim().toLocaleLowerCase(); return !s || `${m.name || ""} ${m.owner?.name || ""}`.toLocaleLowerCase().includes(s); };
29
+
30
+ /**
31
+ * M1: the agents by owner — keyed by the owner's id (two owners of one name are two groups), named by their name; my own
32
+ * group first, then the owners by name in the viewer's language (a group does not move as its agents start and stop).
33
+ * Within a group, the list's own order (presence).
34
+ */
35
+ export function byOwner(agents, locale = undefined) {
36
+ const groups = new Map();
37
+ for (const m of agents) {
38
+ const key = String(m.owner?.id || `name:${m.owner?.name || ""}`);
39
+ if (!groups.has(key)) groups.set(key, { key, owner: String(m.owner?.name || ""), mine: m.owner?.mine === true, agents: [] });
40
+ groups.get(key).agents.push(m);
41
+ }
42
+ return [...groups.values()].sort((a, b) => (Number(b.mine) - Number(a.mine)) || a.owner.localeCompare(b.owner, locale) || (a.key < b.key ? -1 : a.key > b.key ? 1 : 0));
43
+ }
44
+
45
+ /** M1: people in a stable order — me first, then by name in the viewer's language, the member id breaking a tie. */
46
+ export function peopleOrder(people, meId, locale = undefined) {
47
+ return [...people].sort((a, b) => (Number(b.id === meId) - Number(a.id === meId)) || String(a.name || "").localeCompare(String(b.name || ""), locale)
48
+ || (String(a.id) < String(b.id) ? -1 : String(a.id) > String(b.id) ? 1 : 0));
49
+ }
19
50
 
20
51
  /**
21
52
  * The dot class and words for one member, from the shared rooms presence mapping (hub-room-presence.js: reason codes,
@@ -46,11 +77,12 @@ export function ownerAgent(name) {
46
77
  * until the next detail;
47
78
  * - onMention(member): puts 「@name 」 in the composer;
48
79
  * - onOpenChat(member): opens the one-to-one, offered only for an agent whose member row says `canAsk`;
49
- * - onSettings().
80
+ * - onSettings();
81
+ * - compact (M1): true / false for that list whatever the size; absent, a room over COMPACT_OVER gets the compact one.
50
82
  */
51
- export function RoomMembersPanel({ client = hubClient(), roomId, detail, onMention, onOpenChat, onSettings } = {}) {
83
+ export function RoomMembersPanel({ client = hubClient(), roomId, detail, onMention, onOpenChat, onSettings, compact: force = undefined } = {}) {
52
84
  const [presence, setPresence] = useState({}), [open, setOpen] = useState(null), [expanded, setExpanded] = useState(false);
53
- const [busy, setBusy] = useState(false), [failed, setFailed] = useState(false), [gone, setGone] = useState({});
85
+ const [busy, setBusy] = useState(false), [failed, setFailed] = useState(false), [gone, setGone] = useState({}), [q, setQ] = useState("");
54
86
  useEffect(() => { setPresence({}); setGone({}); }, [detail]);
55
87
  useEffect(() => client.subscribeRooms?.({
56
88
  // The whole state each time: presence, its reason code and note. One the event omits is cleared (undefined), so a
@@ -75,19 +107,16 @@ export function RoomMembersPanel({ client = hubClient(), roomId, detail, onMenti
75
107
  if (r?.ok) { setOpen(null); setGone(old => ({ ...old, [m.id]: true })); } // the shell reads the room again on member.changed
76
108
  else setFailed(true);
77
109
  };
110
+ // `compact` true / false: that list whatever the room's size (the classic list's own tests); by default, by size.
111
+ const compact = typeof force === "boolean" ? force : people.length + agents.length > COMPACT_OVER;
78
112
  // An agent's second line names whose it is beside its state (「處理中 · 林小華的 Agent」), always shown, not only on hover.
113
+ // M1: in a compact list a row is one line — the name, its state — and the owner and introduction move into its card.
79
114
  const row = (m, extra = null) => {
80
- const v = memberStatus(m), owner = (m.kind === "agent" || m.kind === "later") && m.owner?.name ? (v.update ? hm("askOwner", m.owner.name) : ownerAgent(m.owner.name)) : "";
81
- return html`<span class="hub-member-name"><${RoomSourceMark} source=${roomSource(m)} decorative=${true} />${m.name}${extra}</span><span class="hub-member-state"><span class=${`dot ${v.dot}`} aria-hidden="true"></span><span>${v.text}</span>${owner ? html`<span class="hub-member-owner">· ${owner}</span>` : null}</span>${m.intro||m.kind==="assistant"?html`<small class="note">${m.kind==="assistant"?hi("assistant"):m.intro}</small>`:null}`;
115
+ const v = memberStatus(m), owner = !compact && (m.kind === "agent" || m.kind === "later") && m.owner?.name ? (v.update ? hm("askOwner", m.owner.name) : ownerAgent(m.owner.name)) : "";
116
+ return html`<span class="hub-member-name"><${RoomSourceMark} source=${roomSource(m)} decorative=${true} />${m.name}${extra}</span><span class="hub-member-state"><span class=${`dot ${v.dot}`} aria-hidden="true"></span><span>${v.text}</span>${owner ? html`<span class="hub-member-owner">· ${owner}</span>` : null}</span>${!compact&&(m.intro||m.kind==="assistant")?html`<small class="note">${m.kind==="assistant"?hi("assistant"):m.intro}</small>`:null}`;
82
117
  };
83
- return html`<aside class="hub-room-members">
84
- ${detail.room?.purpose?html`<section class="hub-room-purpose-panel"><h4>${rp("title")}</h4><p>${detail.room.purpose}</p></section>`:manager&&client.roomPurposeV1===true&&typeof detail.room?.purpose==="string"?html`<button type="button" class="btn btn-link" onClick=${()=>onSettings?.()}>${rp("add")}</button>`:null}
85
- <section><h4>${heads.member}</h4>
86
- <ul>${people.map(m => html`<li class="hub-member" key=${m.id}>${row(m, html`${m.id === meId ? html` <span class="tag">${hroom("roleYou")}</span>` : null}${m.role === "manager" ? html` <span class="tag">${hroom("roleManager")}</span>` : null}`)}</li>`)}</ul>
87
- </section>
88
- ${agents.length ? null : html`<section class="hub-room-no-agents"><h4>${hm("agents")}</h4><p class="note">${hm("noAgents")}</p></section>`}
89
- ${agents.length ? html`<section><h4>${heads.agent}</h4>
90
- <ul>${shown.map(m => html`<li class="hub-member hub-member-agent" key=${m.id}>
118
+ const person = (m) => html`<li class="hub-member" key=${m.id}>${row(m, html`${m.id === meId ? html` <span class="tag">${hroom("roleYou")}</span>` : null}${m.role === "manager" ? html` <span class="tag">${hroom("roleManager")}</span>` : null}`)}</li>`;
119
+ const agentItem = (m) => html`<li class="hub-member hub-member-agent" key=${m.id}>
91
120
  <button type="button" class="hub-member-open" title=${roomSource(m)?.label || ""} aria-label=${`${m.name}. ${memberStatus(m).text}. ${roomSource(m)?.label || ""}`} aria-expanded=${open === m.id} onClick=${() => { setFailed(false); setOpen(open === m.id ? null : m.id); }}>${row(m)}</button>
92
121
  ${open === m.id ? html`<div class="hub-member-card" role="group" aria-label=${m.name}>
93
122
  <strong>${m.name}</strong>${m.intro?html`<p class="note">${m.intro}</p>`:null}${m.owner?.name ? html`<small class="note">${hm("ownerOf", m.owner.name)}</small>` : null}
@@ -100,9 +129,37 @@ export function RoomMembersPanel({ client = hubClient(), roomId, detail, onMenti
100
129
  </div>
101
130
  ${failed ? html`<p class="note" role="alert">${hm("removeFailed")}</p>` : null}
102
131
  </div>` : null}
103
- </li>`)}</ul>
132
+ </li>`;
133
+ // M1: the compact list (§2.6) — the summary, the filter, who is online, the rest folded; the agents by owner, folded.
134
+ // A filter opens every group with a match and shows only the matches; the summary keeps the room's counts, and the two
135
+ // headings say how many match of how many (the leader, #4366: clear that the list is filtered).
136
+ const compactList = () => {
137
+ const locale = lang(), ordered = peopleOrder(people, meId, locale);
138
+ const online = ordered.filter((m) => m.id === meId || m.presence === "online"), owners = byOwner(agents, locale);
139
+ const on = online.filter((m) => memberMatches(m, q)), off = ordered.filter((m) => !online.includes(m) && memberMatches(m, q));
140
+ const groups = owners.map((g) => ({ ...g, shown: g.agents.filter((m) => memberMatches(m, q)) })).filter((g) => g.shown.length);
141
+ const filtering = !!q.trim();
142
+ return html`<p class="note hub-members-sum">${hm("summary", people.length, online.length, agents.length, owners.length)}</p>
143
+ <input class="hub-members-filter" type="search" value=${q} placeholder=${hm("filter")} aria-label=${hm("filterLabel")} onInput=${(e) => setQ(e.target.value)} />
144
+ ${filtering && !on.length && !off.length && !groups.length ? html`<p class="note hub-members-none" role="status">${hm("noMatch")}</p>` : null}
145
+ <section class="hub-members-people"><h4>${filtering ? hm("membersMatch", on.length + off.length, people.length) : heads.member}</h4>
146
+ ${on.length ? html`<ul>${on.map(person)}</ul>` : null}
147
+ ${off.length ? html`<details class="hub-member-group hub-members-offline" open=${filtering}><summary>${hm("notOnline", off.length)}</summary><ul>${off.map(person)}</ul></details>` : null}
148
+ </section>
149
+ ${agents.length ? html`<section><h4>${filtering ? hm("agentsMatch", groups.reduce((n, g) => n + g.shown.length, 0), agents.length) : heads.agent}</h4>
150
+ ${groups.map((g) => html`<details class="hub-member-group hub-members-owner" key=${g.key} open=${filtering}><summary>${hm("ownerGroup", g.owner || hm("noOwner"), filtering ? g.shown.length : g.agents.length)}</summary><ul>${g.shown.map(agentItem)}</ul></details>`)}
151
+ </section>` : null}`;
152
+ };
153
+ return html`<aside class=${`hub-room-members${compact ? " compact" : ""}`}>
154
+ ${detail.room?.purpose?html`<section class="hub-room-purpose-panel"><h4>${rp("title")}</h4><p>${detail.room.purpose}</p></section>`:manager&&client.roomPurposeV1===true&&typeof detail.room?.purpose==="string"?html`<button type="button" class="btn btn-link" onClick=${()=>onSettings?.()}>${rp("add")}</button>`:null}
155
+ ${compact ? compactList() : html`<section><h4>${heads.member}</h4>
156
+ <ul>${people.map(person)}</ul>
157
+ </section>
158
+ ${agents.length ? null : html`<section class="hub-room-no-agents"><h4>${hm("agents")}</h4><p class="note">${hm("noAgents")}</p></section>`}
159
+ ${agents.length ? html`<section><h4>${heads.agent}</h4>
160
+ <ul>${shown.map(agentItem)}</ul>
104
161
  ${fold.rest ? html`<button type="button" class="btn btn-link hub-members-more" onClick=${() => setExpanded(!expanded)}>${expanded ? hm("fewer") : hroom("moreN", fold.rest)}</button>` : null}
105
- </section>` : null}
162
+ </section>` : null}`}
106
163
  ${assistant ? html`<section><ul><li class="hub-member hub-member-assistant">${row({ ...assistant, name: hroom("roomAssistant") })}</li></ul></section>` : null}
107
164
  <section class="hub-room-who"><h4>${hroom("whoSees")}</h4><p class="note">${hroom("whoSeesRoom")}</p></section>
108
165
  ${manager ? html`<button type="button" class="btn btn-link hub-room-settings-link" onClick=${() => onSettings?.()}>${hroom("roomSettings")}</button>` : null}