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

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 (488) hide show
  1. package/README.md +1 -1
  2. package/README.zh-TW.md +1 -1
  3. package/dist/agend-home.js +5 -5
  4. package/dist/agend-home.js.map +1 -1
  5. package/dist/agent-endpoint.js +10 -0
  6. package/dist/agent-endpoint.js.map +1 -1
  7. package/dist/agent-file-read.js +1 -1
  8. package/dist/agent-file-read.js.map +1 -1
  9. package/dist/agent-workspace.d.ts +18 -2
  10. package/dist/agent-workspace.js +15 -4
  11. package/dist/agent-workspace.js.map +1 -1
  12. package/dist/auth-api.js +3 -1
  13. package/dist/auth-api.js.map +1 -1
  14. package/dist/backend/antigravity.js +8 -6
  15. package/dist/backend/antigravity.js.map +1 -1
  16. package/dist/backend/claude-code.js +17 -0
  17. package/dist/backend/claude-code.js.map +1 -1
  18. package/dist/backend/claude-usage-credits.d.ts +8 -0
  19. package/dist/backend/claude-usage-credits.js +121 -0
  20. package/dist/backend/claude-usage-credits.js.map +1 -0
  21. package/dist/backend/types.d.ts +30 -0
  22. package/dist/backend/types.js.map +1 -1
  23. package/dist/build-provenance.json +1 -1
  24. package/dist/channel/adapters/discord.js +7 -1
  25. package/dist/channel/adapters/discord.js.map +1 -1
  26. package/dist/channel/mcp-tools.js +1 -1
  27. package/dist/channel/mcp-tools.js.map +1 -1
  28. package/dist/channel/tool-router.js +1 -0
  29. package/dist/channel/tool-router.js.map +1 -1
  30. package/dist/cli-audited.js +9 -4
  31. package/dist/cli-audited.js.map +1 -1
  32. package/dist/cli.js +184 -21
  33. package/dist/cli.js.map +1 -1
  34. package/dist/config-validator.js +11 -1
  35. package/dist/config-validator.js.map +1 -1
  36. package/dist/config.js +2 -0
  37. package/dist/config.js.map +1 -1
  38. package/dist/contact-auth-store.d.ts +18 -0
  39. package/dist/contact-auth-store.js +55 -8
  40. package/dist/contact-auth-store.js.map +1 -1
  41. package/dist/contact-auth-types.d.ts +3 -0
  42. package/dist/contact-auth-types.js.map +1 -1
  43. package/dist/contact-change-proposals.d.ts +34 -0
  44. package/dist/contact-change-proposals.js +1 -1
  45. package/dist/contact-change-proposals.js.map +1 -1
  46. package/dist/cross-instance-notice.d.ts +1 -0
  47. package/dist/cross-instance-notice.js +9 -8
  48. package/dist/cross-instance-notice.js.map +1 -1
  49. package/dist/daemon.d.ts +35 -0
  50. package/dist/daemon.js +234 -19
  51. package/dist/daemon.js.map +1 -1
  52. package/dist/delivery-outbox.d.ts +42 -1
  53. package/dist/delivery-outbox.js +198 -21
  54. package/dist/delivery-outbox.js.map +1 -1
  55. package/dist/fleet-context.d.ts +8 -0
  56. package/dist/fleet-lock.d.ts +83 -2
  57. package/dist/fleet-lock.js +276 -2
  58. package/dist/fleet-lock.js.map +1 -1
  59. package/dist/fleet-manager.d.ts +183 -7
  60. package/dist/fleet-manager.js +1279 -78
  61. package/dist/fleet-manager.js.map +1 -1
  62. package/dist/fleet-windows-runtime.d.ts +20 -1
  63. package/dist/fleet-windows-runtime.js +98 -18
  64. package/dist/fleet-windows-runtime.js.map +1 -1
  65. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +13 -1
  66. package/dist/general-knowledge/skills/hub/SKILL.md +12 -1
  67. package/dist/general-knowledge/skills/web-appearance/SKILL.md +3 -1
  68. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +21 -4
  69. package/dist/home-update-lock.d.ts +35 -0
  70. package/dist/home-update-lock.js +81 -0
  71. package/dist/home-update-lock.js.map +1 -0
  72. package/dist/hub/client.js +7 -0
  73. package/dist/hub/client.js.map +1 -1
  74. package/dist/hub/compose/member.d.ts +5 -1
  75. package/dist/hub/compose/member.js +15 -6
  76. package/dist/hub/compose/member.js.map +1 -1
  77. package/dist/hub/compose/server.d.ts +1 -0
  78. package/dist/hub/compose/server.js +3 -2
  79. package/dist/hub/compose/server.js.map +1 -1
  80. package/dist/hub/http/compose.js +3 -2
  81. package/dist/hub/http/compose.js.map +1 -1
  82. package/dist/hub/http/deps.d.ts +1 -0
  83. package/dist/hub/member/room-ask.d.ts +12 -8
  84. package/dist/hub/member/room-ask.js +95 -29
  85. package/dist/hub/member/room-ask.js.map +1 -1
  86. package/dist/hub/member/room-mention-feedback.d.ts +2 -0
  87. package/dist/hub/member/room-mention-feedback.js +1 -1
  88. package/dist/hub/member/room-mention-feedback.js.map +1 -1
  89. package/dist/hub/member/room-post-answers.d.ts +2 -0
  90. package/dist/hub/member/room-post-answers.js +1 -1
  91. package/dist/hub/member/room-post-answers.js.map +1 -1
  92. package/dist/hub/member/room-post.d.ts +5 -0
  93. package/dist/hub/member/room-post.js +4 -1
  94. package/dist/hub/member/room-post.js.map +1 -1
  95. package/dist/hub/member/room-reaction-acks.d.ts +12 -0
  96. package/dist/hub/member/room-reaction-acks.js +44 -0
  97. package/dist/hub/member/room-reaction-acks.js.map +1 -0
  98. package/dist/hub/member/updates.d.ts +7 -1
  99. package/dist/hub/member/updates.js +7 -1
  100. package/dist/hub/member/updates.js.map +1 -1
  101. package/dist/hub/protocol.d.ts +4 -0
  102. package/dist/hub/protocol.js +2 -2
  103. package/dist/hub/protocol.js.map +1 -1
  104. package/dist/hub/representative.d.ts +7 -0
  105. package/dist/hub/representative.js +38 -5
  106. package/dist/hub/representative.js.map +1 -1
  107. package/dist/hub/roles/audit-details.d.ts +2 -0
  108. package/dist/hub/roles/audit-details.js +1 -1
  109. package/dist/hub/roles/audit-details.js.map +1 -1
  110. package/dist/hub/roles/authority.d.ts +8 -3
  111. package/dist/hub/roles/authority.js +144 -102
  112. package/dist/hub/roles/authority.js.map +1 -1
  113. package/dist/hub/roles/delegation.js +2 -2
  114. package/dist/hub/roles/delegation.js.map +1 -1
  115. package/dist/hub/roles/model.d.ts +5 -2
  116. package/dist/hub/roles/model.js +5 -4
  117. package/dist/hub/roles/model.js.map +1 -1
  118. package/dist/hub/roles/review.js +2 -2
  119. package/dist/hub/roles/review.js.map +1 -1
  120. package/dist/hub/room-react-ack-model.d.ts +2 -0
  121. package/dist/hub/room-react-ack-model.js +3 -0
  122. package/dist/hub/room-react-ack-model.js.map +1 -0
  123. package/dist/hub/rooms/admin.d.ts +6 -0
  124. package/dist/hub/rooms/admin.js +33 -0
  125. package/dist/hub/rooms/admin.js.map +1 -1
  126. package/dist/hub/rooms/agents.d.ts +2 -0
  127. package/dist/hub/rooms/agents.js +44 -3
  128. package/dist/hub/rooms/agents.js.map +1 -1
  129. package/dist/hub/rooms/service.d.ts +5 -1
  130. package/dist/hub/rooms/service.js +76 -24
  131. package/dist/hub/rooms/service.js.map +1 -1
  132. package/dist/hub/rooms/types.d.ts +2 -0
  133. package/dist/hub/server.js +6 -1
  134. package/dist/hub/server.js.map +1 -1
  135. package/dist/hub/types.d.ts +2 -0
  136. package/dist/install-lock.d.ts +15 -1
  137. package/dist/install-lock.js +16 -8
  138. package/dist/install-lock.js.map +1 -1
  139. package/dist/install-ownership.d.ts +165 -0
  140. package/dist/install-ownership.js +404 -0
  141. package/dist/install-ownership.js.map +1 -0
  142. package/dist/instance-config-impact.js +2 -0
  143. package/dist/instance-config-impact.js.map +1 -1
  144. package/dist/instructions.d.ts +4 -0
  145. package/dist/instructions.js +4 -0
  146. package/dist/instructions.js.map +1 -1
  147. package/dist/local-pane-endpoint.d.ts +4 -1
  148. package/dist/local-pane-endpoint.js +12 -2
  149. package/dist/local-pane-endpoint.js.map +1 -1
  150. package/dist/locale.js +162 -6
  151. package/dist/locale.js.map +1 -1
  152. package/dist/native-agent-admission.d.ts +7 -0
  153. package/dist/native-agent-admission.js +46 -3
  154. package/dist/native-agent-admission.js.map +1 -1
  155. package/dist/native-mcp.d.ts +16 -1
  156. package/dist/native-mcp.js +38 -5
  157. package/dist/native-mcp.js.map +1 -1
  158. package/dist/native-pane-lifecycle.d.ts +9 -0
  159. package/dist/native-pane-lifecycle.js +23 -0
  160. package/dist/native-pane-lifecycle.js.map +1 -1
  161. package/dist/native-pane-manager.d.ts +19 -6
  162. package/dist/native-pane-manager.js +79 -4
  163. package/dist/native-pane-manager.js.map +1 -1
  164. package/dist/needs-you.d.ts +8 -0
  165. package/dist/needs-you.js +1 -0
  166. package/dist/needs-you.js.map +1 -1
  167. package/dist/outbound-handlers.d.ts +12 -0
  168. package/dist/outbound-handlers.js +30 -2
  169. package/dist/outbound-handlers.js.map +1 -1
  170. package/dist/package-preimage.js +4 -0
  171. package/dist/package-preimage.js.map +1 -1
  172. package/dist/pane-port.d.ts +1 -0
  173. package/dist/plist-args.d.ts +9 -0
  174. package/dist/plist-args.js +22 -0
  175. package/dist/plist-args.js.map +1 -0
  176. package/dist/public-preview.d.ts +4 -6
  177. package/dist/public-preview.js +5 -2
  178. package/dist/public-preview.js.map +1 -1
  179. package/dist/public-web-gateway.js +10 -3
  180. package/dist/public-web-gateway.js.map +1 -1
  181. package/dist/public-web-link.d.ts +13 -1
  182. package/dist/public-web-link.js +28 -1
  183. package/dist/public-web-link.js.map +1 -1
  184. package/dist/recover.cjs +2638 -0
  185. package/dist/remote-card-prompt.d.ts +6 -2
  186. package/dist/remote-card-prompt.js +12 -3
  187. package/dist/remote-card-prompt.js.map +1 -1
  188. package/dist/reply-draft.d.ts +12 -0
  189. package/dist/reply-draft.js +81 -0
  190. package/dist/reply-draft.js.map +1 -0
  191. package/dist/request-contact-api.d.ts +15 -0
  192. package/dist/request-contact-api.js +120 -0
  193. package/dist/request-contact-api.js.map +1 -0
  194. package/dist/request-contact-card.d.ts +36 -0
  195. package/dist/request-contact-card.js +206 -0
  196. package/dist/request-contact-card.js.map +1 -0
  197. package/dist/request-contact-gate.d.ts +79 -0
  198. package/dist/request-contact-gate.js +262 -0
  199. package/dist/request-contact-gate.js.map +1 -0
  200. package/dist/request-contact-native.d.ts +52 -0
  201. package/dist/request-contact-native.js +87 -0
  202. package/dist/request-contact-native.js.map +1 -0
  203. package/dist/request-contact-types.d.ts +86 -0
  204. package/dist/request-contact-types.js +7 -0
  205. package/dist/request-contact-types.js.map +1 -0
  206. package/dist/request-context-call-protocol.d.ts +12 -0
  207. package/dist/request-context-call-protocol.js +14 -0
  208. package/dist/request-context-call-protocol.js.map +1 -0
  209. package/dist/request-context-call.d.ts +22 -0
  210. package/dist/request-context-call.js +35 -0
  211. package/dist/request-context-call.js.map +1 -0
  212. package/dist/request-context-drain.d.ts +39 -0
  213. package/dist/request-context-drain.js +159 -0
  214. package/dist/request-context-drain.js.map +1 -0
  215. package/dist/request-context-fence.d.ts +28 -0
  216. package/dist/request-context-fence.js +58 -0
  217. package/dist/request-context-fence.js.map +1 -0
  218. package/dist/request-context-migration.d.ts +64 -0
  219. package/dist/request-context-migration.js +158 -0
  220. package/dist/request-context-migration.js.map +1 -0
  221. package/dist/request-context-pane.d.ts +25 -0
  222. package/dist/request-context-pane.js +48 -0
  223. package/dist/request-context-pane.js.map +1 -0
  224. package/dist/request-context-policy.d.ts +74 -0
  225. package/dist/request-context-policy.js +116 -0
  226. package/dist/request-context-policy.js.map +1 -0
  227. package/dist/request-context-recovery.d.ts +14 -0
  228. package/dist/request-context-recovery.js +56 -0
  229. package/dist/request-context-recovery.js.map +1 -0
  230. package/dist/request-context-relay.d.ts +19 -0
  231. package/dist/request-context-relay.js +63 -0
  232. package/dist/request-context-relay.js.map +1 -0
  233. package/dist/request-context-returns.d.ts +67 -0
  234. package/dist/request-context-returns.js +211 -0
  235. package/dist/request-context-returns.js.map +1 -0
  236. package/dist/request-context-store.d.ts +2 -1
  237. package/dist/request-context-store.js +8 -1
  238. package/dist/request-context-store.js.map +1 -1
  239. package/dist/request-context-turns.d.ts +99 -0
  240. package/dist/request-context-turns.js +215 -0
  241. package/dist/request-context-turns.js.map +1 -0
  242. package/dist/request-context-view.d.ts +33 -0
  243. package/dist/request-context-view.js +36 -0
  244. package/dist/request-context-view.js.map +1 -0
  245. package/dist/request-hub-context.d.ts +130 -0
  246. package/dist/request-hub-context.js +89 -0
  247. package/dist/request-hub-context.js.map +1 -0
  248. package/dist/request-hub-output.d.ts +11 -0
  249. package/dist/request-hub-output.js +21 -0
  250. package/dist/request-hub-output.js.map +1 -0
  251. package/dist/runtime-cli-install.js +13 -11
  252. package/dist/runtime-cli-install.js.map +1 -1
  253. package/dist/runtime-client.d.ts +2 -0
  254. package/dist/runtime-client.js +17 -4
  255. package/dist/runtime-client.js.map +1 -1
  256. package/dist/runtime-coordinator.d.ts +4 -1
  257. package/dist/runtime-coordinator.js +10 -3
  258. package/dist/runtime-coordinator.js.map +1 -1
  259. package/dist/runtime-pane-assets.d.ts +1 -1
  260. package/dist/runtime-pane-assets.js +1 -1
  261. package/dist/runtime-pane-assets.js.map +1 -1
  262. package/dist/runtime-pane-host.d.ts +3 -0
  263. package/dist/runtime-pane-host.js +39 -21
  264. package/dist/runtime-pane-host.js.map +1 -1
  265. package/dist/runtime-pane-link.d.ts +6 -2
  266. package/dist/runtime-pane-link.js +17 -4
  267. package/dist/runtime-pane-link.js.map +1 -1
  268. package/dist/runtime-pane-mcp-relay.d.ts +11 -1
  269. package/dist/runtime-pane-mcp-relay.js +69 -3
  270. package/dist/runtime-pane-mcp-relay.js.map +1 -1
  271. package/dist/runtime-pane-mcp.d.ts +28 -1
  272. package/dist/runtime-pane-mcp.js +92 -15
  273. package/dist/runtime-pane-mcp.js.map +1 -1
  274. package/dist/runtime-pane-port.d.ts +6 -0
  275. package/dist/runtime-pane-port.js +23 -4
  276. package/dist/runtime-pane-port.js.map +1 -1
  277. package/dist/runtime-pane-protocol.d.ts +4 -0
  278. package/dist/runtime-pane-protocol.js +11 -4
  279. package/dist/runtime-pane-protocol.js.map +1 -1
  280. package/dist/runtime-pane-service.d.ts +1 -0
  281. package/dist/runtime-pane-service.js +25 -9
  282. package/dist/runtime-pane-service.js.map +1 -1
  283. package/dist/runtime-pane-stdio-protocol.d.ts +4 -0
  284. package/dist/runtime-pane-stdio-protocol.js +12 -5
  285. package/dist/runtime-pane-stdio-protocol.js.map +1 -1
  286. package/dist/runtime-pane-stdio.js +5 -5
  287. package/dist/runtime-pane-stdio.js.map +1 -1
  288. package/dist/runtime-protocol.d.ts +3 -0
  289. package/dist/runtime-protocol.js.map +1 -1
  290. package/dist/scheduler/scheduler.d.ts +15 -0
  291. package/dist/scheduler/scheduler.js +45 -1
  292. package/dist/scheduler/scheduler.js.map +1 -1
  293. package/dist/scheduler/scheduler.test.js +17 -0
  294. package/dist/scheduler/scheduler.test.js.map +1 -1
  295. package/dist/scheduler/task-board.d.ts +4 -0
  296. package/dist/scheduler/task-board.js +6 -0
  297. package/dist/scheduler/task-board.js.map +1 -1
  298. package/dist/scheduler/types.d.ts +1 -1
  299. package/dist/service-activation.js +3 -13
  300. package/dist/service-activation.js.map +1 -1
  301. package/dist/service-lock.d.ts +28 -0
  302. package/dist/service-lock.js +85 -0
  303. package/dist/service-lock.js.map +1 -0
  304. package/dist/settings-api.d.ts +6 -0
  305. package/dist/settings-api.js +107 -0
  306. package/dist/settings-api.js.map +1 -1
  307. package/dist/settings-change.js +14 -1
  308. package/dist/settings-change.js.map +1 -1
  309. package/dist/settings-effect.js +11 -1
  310. package/dist/settings-effect.js.map +1 -1
  311. package/dist/state-lease.d.ts +24 -0
  312. package/dist/state-lease.js +103 -0
  313. package/dist/state-lease.js.map +1 -0
  314. package/dist/tmux-binary.js +1 -1
  315. package/dist/tmux-binary.js.map +1 -1
  316. package/dist/tool-receipt-output.d.ts +2 -0
  317. package/dist/topic-commands.js +21 -1
  318. package/dist/topic-commands.js.map +1 -1
  319. package/dist/transcript-monitor.js +3 -0
  320. package/dist/transcript-monitor.js.map +1 -1
  321. package/dist/tunnel/named-link-test.d.ts +27 -0
  322. package/dist/tunnel/named-link-test.js +41 -0
  323. package/dist/tunnel/named-link-test.js.map +1 -1
  324. package/dist/types.d.ts +7 -0
  325. package/dist/ui/chat-store.js +5 -4
  326. package/dist/ui/contact-auth-strings.js +7 -2
  327. package/dist/ui/contact-permissions.js +10 -2
  328. package/dist/ui/fleet-office-card.js +15 -2
  329. package/dist/ui/fleet-office-pack.d.ts +2 -2
  330. package/dist/ui/fleet-office-pack.js +25 -8
  331. package/dist/ui/fleet-office-skin.js +33 -9
  332. package/dist/ui/fleet-office-vehicles.js +28 -11
  333. package/dist/ui/fleet-office-zones.js +10 -5
  334. package/dist/ui/fleet-office.js +158 -20
  335. package/dist/ui/fleet-task-files.js +1 -1
  336. package/dist/ui/hub-admin-rooms-strings.js +6 -2
  337. package/dist/ui/hub-admin-rooms.js +3 -1
  338. package/dist/ui/hub-group-search.js +2 -2
  339. package/dist/ui/hub-notify-keep.js +49 -0
  340. package/dist/ui/hub-role-view.js +1 -1
  341. package/dist/ui/hub-roles-strings.js +14 -10
  342. package/dist/ui/hub-roles.js +1 -1
  343. package/dist/ui/hub-room-notify.js +2 -1
  344. package/dist/ui/hub-room-strings.js +3 -3
  345. package/dist/ui/hub-room-thread.js +9 -4
  346. package/dist/ui/panel-chat.js +15 -2
  347. package/dist/ui/panel-hub.js +3 -2
  348. package/dist/ui/panel-needs.js +35 -7
  349. package/dist/ui/panel-settings.js +22 -8
  350. package/dist/ui/settings-preview-address.js +156 -0
  351. package/dist/ui/settings-registry.js +2 -0
  352. package/dist/ui/settings-strings.js +6 -6
  353. package/dist/ui/settings-update.js +13 -0
  354. package/dist/ui/shared/app-install.js +123 -0
  355. package/dist/ui/shared/app-shell.js +4 -2
  356. package/dist/ui/shared/app-update.js +16 -2
  357. package/dist/ui/shared/app.css +119 -2
  358. package/dist/ui/shared/app.js +3 -0
  359. package/dist/ui/shared/chat-strings.js +6 -2
  360. package/dist/ui/shared/chat-thread.js +7 -1
  361. package/dist/ui/shared/hub-chat.css +6 -0
  362. package/dist/ui/shared/preview-panel.js +1 -1
  363. package/dist/ui/shared/preview.js +11 -2
  364. package/dist/ui/shared/tokens.css +18 -3
  365. package/dist/ui/shared/ui-confirm.js +7 -5
  366. package/dist/ui/shared/ui-icons.js +2 -0
  367. package/dist/ui/shared/update-card-ui.js +419 -0
  368. package/dist/ui/shared/workspace.css +7 -0
  369. package/dist/ui/usage-credits-card.js +84 -0
  370. package/dist/ui/workspace-ignored-strings.js +16 -0
  371. package/dist/ui/workspace-panel.js +15 -6
  372. package/dist/update-abandon.d.ts +26 -0
  373. package/dist/update-abandon.js +111 -0
  374. package/dist/update-abandon.js.map +1 -0
  375. package/dist/update-card.d.ts +193 -0
  376. package/dist/update-card.js +620 -0
  377. package/dist/update-card.js.map +1 -0
  378. package/dist/update-dispatch.d.ts +16 -1
  379. package/dist/update-dispatch.js +12 -4
  380. package/dist/update-dispatch.js.map +1 -1
  381. package/dist/update-forward.d.ts +59 -0
  382. package/dist/update-forward.js +227 -0
  383. package/dist/update-forward.js.map +1 -0
  384. package/dist/update-goback.d.ts +90 -0
  385. package/dist/update-goback.js +260 -0
  386. package/dist/update-goback.js.map +1 -0
  387. package/dist/update-idle.d.ts +1 -0
  388. package/dist/update-idle.js +12 -3
  389. package/dist/update-idle.js.map +1 -1
  390. package/dist/update-install.d.ts +2 -1
  391. package/dist/update-install.js +18 -10
  392. package/dist/update-install.js.map +1 -1
  393. package/dist/update-journal.d.ts +359 -0
  394. package/dist/update-journal.js +723 -0
  395. package/dist/update-journal.js.map +1 -0
  396. package/dist/update-launch.js +1 -1
  397. package/dist/update-launch.js.map +1 -1
  398. package/dist/update-npm-env.d.ts +45 -12
  399. package/dist/update-npm-env.js +48 -0
  400. package/dist/update-npm-env.js.map +1 -1
  401. package/dist/update-package-restore.d.ts +84 -0
  402. package/dist/update-package-restore.js +329 -0
  403. package/dist/update-package-restore.js.map +1 -0
  404. package/dist/update-quiescence.d.ts +221 -0
  405. package/dist/update-quiescence.js +370 -0
  406. package/dist/update-quiescence.js.map +1 -0
  407. package/dist/update-readiness-host.d.ts +61 -0
  408. package/dist/update-readiness-host.js +297 -0
  409. package/dist/update-readiness-host.js.map +1 -0
  410. package/dist/update-readiness.d.ts +83 -0
  411. package/dist/update-readiness.js +459 -0
  412. package/dist/update-readiness.js.map +1 -0
  413. package/dist/update-recovery/kit.d.ts +35 -0
  414. package/dist/update-recovery/kit.js +99 -0
  415. package/dist/update-recovery/kit.js.map +1 -0
  416. package/dist/update-recovery/pre-start.d.ts +34 -0
  417. package/dist/update-recovery/pre-start.js +103 -0
  418. package/dist/update-recovery/pre-start.js.map +1 -0
  419. package/dist/update-recovery/recover-main.d.ts +1 -0
  420. package/dist/update-recovery/recover-main.js +4 -0
  421. package/dist/update-recovery/recover-main.js.map +1 -0
  422. package/dist/update-recovery/recover.d.ts +22 -0
  423. package/dist/update-recovery/recover.js +134 -0
  424. package/dist/update-recovery/recover.js.map +1 -0
  425. package/dist/update-recovery/route.d.ts +53 -0
  426. package/dist/update-recovery/route.js +262 -0
  427. package/dist/update-recovery/route.js.map +1 -0
  428. package/dist/update-recovery/runner.d.ts +62 -0
  429. package/dist/update-recovery/runner.js +229 -0
  430. package/dist/update-recovery/runner.js.map +1 -0
  431. package/dist/update-recovery/service-manager.d.ts +39 -0
  432. package/dist/update-recovery/service-manager.js +57 -0
  433. package/dist/update-recovery/service-manager.js.map +1 -0
  434. package/dist/update-restore.d.ts +50 -0
  435. package/dist/update-restore.js +360 -0
  436. package/dist/update-restore.js.map +1 -0
  437. package/dist/update-retained.d.ts +65 -0
  438. package/dist/update-retained.js +116 -0
  439. package/dist/update-retained.js.map +1 -0
  440. package/dist/update-rollback.d.ts +74 -0
  441. package/dist/update-rollback.js +221 -0
  442. package/dist/update-rollback.js.map +1 -0
  443. package/dist/update-settings.d.ts +63 -0
  444. package/dist/update-settings.js +162 -0
  445. package/dist/update-settings.js.map +1 -0
  446. package/dist/update-snapshot-manifest.d.ts +32 -0
  447. package/dist/update-snapshot-manifest.js +65 -0
  448. package/dist/update-snapshot-manifest.js.map +1 -0
  449. package/dist/update-snapshot-scope.d.ts +67 -0
  450. package/dist/update-snapshot-scope.js +173 -0
  451. package/dist/update-snapshot-scope.js.map +1 -0
  452. package/dist/update-snapshot.d.ts +34 -0
  453. package/dist/update-snapshot.js +246 -0
  454. package/dist/update-snapshot.js.map +1 -0
  455. package/dist/update-writers.d.ts +71 -0
  456. package/dist/update-writers.js +235 -0
  457. package/dist/update-writers.js.map +1 -0
  458. package/dist/web-api.d.ts +3 -0
  459. package/dist/web-api.js +43 -8
  460. package/dist/web-api.js.map +1 -1
  461. package/dist/web-chat-history.d.ts +7 -0
  462. package/dist/web-chat-history.js +15 -0
  463. package/dist/web-chat-history.js.map +1 -1
  464. package/dist/web-icons.d.ts +11 -0
  465. package/dist/web-icons.js +14 -2
  466. package/dist/web-icons.js.map +1 -1
  467. package/dist/web-mentions.d.ts +27 -8
  468. package/dist/web-mentions.js +108 -1
  469. package/dist/web-mentions.js.map +1 -1
  470. package/dist/web-office-acts.js +3 -0
  471. package/dist/web-office-acts.js.map +1 -1
  472. package/dist/web-preview.d.ts +5 -0
  473. package/dist/web-preview.js +1 -1
  474. package/dist/web-preview.js.map +1 -1
  475. package/dist/web-update.d.ts +6 -0
  476. package/dist/windows-agents.d.ts +12 -0
  477. package/dist/windows-agents.js +5 -0
  478. package/dist/windows-agents.js.map +1 -1
  479. package/launcher/agend +4 -1
  480. package/launcher/agend-agent +4 -1
  481. package/launcher/agend-install.cjs +16 -8
  482. package/launcher/install-admission.d.cts +8 -0
  483. package/launcher/npm-allow-scripts.cjs +72 -0
  484. package/launcher/npm-global-prefix.cjs +81 -0
  485. package/launcher/postinstall.cjs +9 -8
  486. package/launcher/runtime-select.cjs +8 -2
  487. package/package.json +4 -3
  488. package/scripts/preinstall-guard.cjs +1 -1
@@ -4,6 +4,7 @@ import { notifyOn, notifySupport, notifyStore, refreshNotify, setNotify } from "
4
4
  import { html, useEffect } from "/assets/app-html.js";
5
5
  import { useStore } from "/assets/app-store.js";
6
6
  import { Icon } from "/assets/ui-icons.js";
7
+ import { setHubNotify } from "./hub-notify-keep.js";
7
8
  import { counts, shouldNotify } from "./hub-room-unread.js";
8
9
  import { hroom } from "./hub-room-strings.js";
9
10
 
@@ -157,5 +158,5 @@ export function HubNotifyToggle() {
157
158
  return html`<span class="icon-btn hub-notify" aria-disabled="true" title=${title} aria-label=${title}><${Icon} name="bell" size=${16} /></span>`;
158
159
  }
159
160
  return html`<button type="button" class="icon-btn hub-notify" aria-pressed=${on ? "true" : "false"} aria-label=${label} title=${title}
160
- disabled=${asking} onClick=${() => { void setNotify(!on); }}><${Icon} name="bell" size=${16} /></button>`;
161
+ disabled=${asking} onClick=${() => { void setHubNotify(!on); }}><${Icon} name="bell" size=${16} /></button>`;
161
162
  }
@@ -142,7 +142,7 @@ register("hubRoom", {
142
142
  assistantNotEnabled: "The room assistant is not enabled yet.",
143
143
  assistantEnableHint: "Sign in an AI account in AgEnD on this computer, then come back and turn it on.",
144
144
  // §11 admin → rooms
145
- whoCanCreate: "Who can start rooms", addPeopleOrTeams: "Add people or teams",
145
+ whoCanCreate: "Who can create rooms", addPeopleOrTeams: "Add people or teams",
146
146
  everyoneDirect: "Everyone can start a one-to-one chat.",
147
147
  allRooms: "All rooms", active: "Active", archived: "Archived",
148
148
  noContent: "Room content is not visible here.",
@@ -150,7 +150,7 @@ register("hubRoom", {
150
150
  // §12 unread: unreadN is the list-row count tooltip; mentionedYou is the row's @ mark.
151
151
  unreadPrefix: "({0})", unreadN: "{0} unread", mentionMark: "@", mentionedYou: "Mentioned you",
152
152
  // §12 desktop notification (opt-in, like the Fleet's Notify me): the header toggle and one ping per kind.
153
- notifyTitle: "Notify me on this device", notifyOn: "Notifications are on while a Hub tab is open.",
153
+ notifyTitle: "Notify me on this device", notifyOn: "Notifications are on while a Hub tab or the AgEnD app is open, even in the background.",
154
154
  notifyOff: "Get a desktop notification when someone @mentions you, an agent answers, or a new invitation arrives.",
155
155
  notifyDenied: "This browser blocked notifications. Allow them in the site settings to turn this on.",
156
156
  notifyUnavailable: "This browser cannot show notifications here.",
@@ -295,7 +295,7 @@ register("hubRoom", {
295
295
  noContent: "這裡看不到任何房間的內容。",
296
296
  joinAsManager: "加入自己成為房間管理",
297
297
  unreadPrefix: "({0})", unreadN: "{0} 則未讀", mentionMark: "@", mentionedYou: "有人 @ 你",
298
- notifyTitle: "在這個裝置上通知我", notifyOn: "Hub 分頁開著時會收到通知。",
298
+ notifyTitle: "在這個裝置上通知我", notifyOn: "Hub 分頁或 AgEnD 應用程式開著時(在背景也可以)會收到通知。",
299
299
  notifyOff: "有人 @ 你、Agent 回答或有新邀請時,收到桌面通知。",
300
300
  notifyDenied: "這個瀏覽器封鎖了通知。請在網站設定中允許,才能開啟。",
301
301
  notifyUnavailable: "這個瀏覽器在這裡無法顯示通知。",
@@ -27,8 +27,10 @@ import {ha} from "./hub-ai-apps-strings.js";
27
27
  import { RoomComposer } from "./hub-room-composer.js";
28
28
  import { TextSizeButton, TEXT_SIZES, setTextSize, textSizeStore } from "/assets/header-tools.js";
29
29
  import { useStore } from "/assets/app-store.js";
30
- import { notifyStore, notifySupport, setNotify } from "/assets/app-needs.js";
30
+ import { notifyStore, notifySupport } from "/assets/app-needs.js";
31
31
  import { HubNotifyToggle } from "./hub-room-notify.js";
32
+ import { setHubNotify } from "./hub-notify-keep.js";
33
+ import { InstallAppButton, installLabel, installOffered, installStore, runInstall } from "/assets/app-install.js";
32
34
  import { createHubButtonActions } from "./hub-button-actions.js";
33
35
  import { linkRoomsU2Css } from "./hub-room-new-strings.js";
34
36
  import { directStatus, workingLine } from "./hub-room-working.js";
@@ -182,6 +184,7 @@ export function toThreadMessages(messages, { meId, ids, direct = false, expanded
182
184
  const num = (id) => { if (!ids.has(id)) ids.set(id, ids.size * 2 + 2); return ids.get(id); };
183
185
  for (const m of ordered) {
184
186
  if (!m || typeof m.id !== "string") continue;
187
+ if (m.answerTo && m.acknowledgedByReaction === true) continue;
185
188
  const author = m.author || {}, kind = author.kind;
186
189
  // An answer still to come (queued, or being worked on: the working bar says who) is never an empty bubble.
187
190
  if (m.answerTo && !m.text && (m.stage === "queued" || m.stage === "working")) continue;
@@ -602,7 +605,7 @@ export function HubRoomPage({ roomId, listed = null, Thread, client, meId = "",
602
605
  }
603
606
  // M-3311 (3): the header's menu — a group room's Room settings and Leave, and on a desk the Fleet chat's 「全寬」 for any room.
604
607
  const [fullWidth, setFullWidth] = useState(hubChatWide);
605
- const textSize = useStore(textSizeStore), notify = useStore(notifyStore), narrow = useNarrowScreen();
608
+ const textSize = useStore(textSizeStore), notify = useStore(notifyStore), install = useStore(installStore), narrow = useNarrowScreen();
606
609
  const [muteBusy,setMuteBusy]=useState(false);
607
610
  async function toggleDirectMute(){
608
611
  if(muteBusy)return;setMuteBusy(true);
@@ -624,7 +627,9 @@ export function HubRoomPage({ roomId, listed = null, Thread, client, meId = "",
624
627
  // move into ⋯ there (hub-chat.css hides the two buttons at the same width).
625
628
  ...(narrow ? [
626
629
  { key: "textSize", label: t("app.textSize", t(`app.textSize_${textSize.size}`)), icon: "type", onSelect: () => setTextSize(TEXT_SIZES[(TEXT_SIZES.indexOf(textSize.size) + 1) % TEXT_SIZES.length]) },
627
- ...(notifySupport() === "ok" ? [{ key: "notify", checkbox: true, checked: notify.state === "on", disabled: notify.asking, label: hroom("notifyTitle"), onSelect: () => { void setNotify(notify.state !== "on"); } }] : []),
630
+ ...(notifySupport() === "ok" ? [{ key: "notify", checkbox: true, checked: notify.state === "on", disabled: notify.asking, label: hroom("notifyTitle"), onSelect: () => { void setHubNotify(notify.state !== "on"); } }] : []),
631
+ // S-255: Install as an app sits by the bell, so on a phone it moves into ⋯ with it.
632
+ ...(installOffered(install.state) ? [{ key: "install", label: installLabel(), icon: "install", onSelect: () => runInstall(install.state) }] : []),
628
633
  ] : []),
629
634
  ].filter(Boolean);
630
635
  const line2 = narrow && inOffice ? hroom("tabOffice") : group ? `${countsLine(room.people, room.agents)}${hasAssistant ? ` · ${hroom("roomAssistant")}` : ""}`
@@ -679,7 +684,7 @@ export function HubRoomPage({ roomId, listed = null, Thread, client, meId = "",
679
684
  const label = hroom(v === "chat" ? "tabChat" : "tabOffice"), on = (v === "office") === inOffice;
680
685
  return html`<a key=${v} class=${`seg-item${on ? " active" : ""}`} href=${officeHref(v)} aria-current=${on ? "page" : undefined} data-label=${label}
681
686
  onClick=${(e) => { if (e.metaKey || e.ctrlKey || e.shiftKey || e.button > 0) return; e.preventDefault(); onView(v); }}>${label}</a>`; })}</nav>` : null}
682
- <span class="hub-head-tools"><${RoomPinsButton} count=${pinCount} onOpen=${() => setPinsOpen(true)} /><${TextSizeButton} /><${HubNotifyToggle} /></span>
687
+ <span class="hub-head-tools"><${RoomPinsButton} count=${pinCount} onOpen=${() => setPinsOpen(true)} /><${TextSizeButton} /><${InstallAppButton} /><${HubNotifyToggle} /></span>
683
688
  ${group && Panel ? html`<button type="button" class="icon-btn hub-room-rail-toggle" aria-pressed=${(wide ? showRail : sheet) ? "true" : "false"} title=${hroom("members")} aria-label=${hroom("members")}
684
689
  onClick=${() => { if (!wide) { setSheet(true); return; } if (panelOpen && !inOffice) { closePanel(); setRail(true); return; } setRail(!rail); }}><${Icon} name="team" size=${18} /></button>` : null}
685
690
  ${menuItems.length ? html`<${Menu} cls="hub-room-menu" label=${hroom("menu")} fit=${true} ownerKey=${roomId} items=${menuItems} />` : null}
@@ -245,6 +245,7 @@ linkWorkBarCss();
245
245
 
246
246
  import { activityDrawCtx, activityInfo, activityInfoStore, activityOffered, activityPrefs, composeActivity, mountActivity, observeActivity, setActivityOn, setActivityThinking } from "./chat-activity.js";
247
247
  import { timeText } from "/assets/clock-text.js";
248
+ import { usageCreditsActions, usageCreditsTitle, usageCreditsDetail, kindClass, showRawLabel } from "./usage-credits-card.js";
248
249
  /** The composer's textarea (#2342: text put back into it is a step Ctrl+Z goes back from). */
249
250
  const composers = new Map(); // agent → current mounted refs, never a retained thread's stale closure
250
251
  const composerField = (name) => composers.get(name)?.input.current || null;
@@ -1280,13 +1281,25 @@ function QuickActions({ name, inst, lease }) {
1280
1281
  function Prompts({ name }) {
1281
1282
  const list = store.promptsFor(name);
1282
1283
  if (!list.length) return null;
1283
- return html`<div data-trust="permission" class="prompts" aria-live="polite">${list.map(p => html`<div key=${p.nonce} class=${`prompt${p.resolved ? " done" : ""}`} role="group" aria-label=${p.text}>
1284
+ return html`<div data-trust="permission" class="prompts" aria-live="polite">${list.map(p => p.view && p.view.kind === "usage-credits" && !p.resolved ? html`<${UsageCreditsPrompt} key=${p.nonce} p=${p} />` : html`<div key=${p.nonce} class=${`prompt${p.resolved ? " done" : ""}`} role="group" aria-label=${p.text}>
1284
1285
  <div class="txt">${p.resolved ? (p.outcome || t("chat.promptGone")) : textLinkSegments(p.text, p.links).map(sg => sg.href ? html`<a data-trust="link" class="st-link" href=${sg.href}>${sg.text}</a>` : sg.text)}</div>
1285
- ${p.resolved ? null : html`<div class="acts">${p.actions.filter(a => !a.input).map(a => html`<button key=${a.id} type="button" class="btn" disabled=${!!p.busy} onClick=${() => store.answerPrompt(p, a.id)}>${a.label}</button>`)}
1286
+ ${p.resolved ? null : html`<div class="acts">${p.actions.filter(a => !a.input).map(a => html`<button key=${a.id} type="button" class="btn" disabled=${!!p.busy} onClick=${() => store.answerPrompt(p, a.id)}>${a.label}${a.hint ? html`<span class="btn-hint">${a.hint}</span>` : null}</button>`)}
1286
1287
  ${p.busy && !p.confirming ? html`<span class="wait">${t("chat.promptAnswering")}</span>` : null}</div>`}
1287
1288
  ${p.resolved ? null : p.actions.filter(a => a.input).map(a => html`<${PromptText} key=${a.id} p=${p} action=${a} />`)}</div>`)}</div>`;
1288
1289
  }
1289
1290
 
1291
+ /** M-3757: Claude's usage-credits prompt, as in Needs you: the question naming the agent, one sentence on the bill, Claude's own words folded, its choices. */
1292
+ function UsageCreditsPrompt({ p }) {
1293
+ const title = usageCreditsTitle(p.view);
1294
+ return html`<div class="prompt prompt-usage-credits" role="group" aria-label=${title}>
1295
+ <div class="txt"><strong>${title}</strong></div>
1296
+ <div class="txt prompt-detail">${usageCreditsDetail(p.view)}</div>
1297
+ <details class="n-raw"><summary>${showRawLabel()}</summary><pre class="n-raw-text">${p.view.raw || p.text}</pre></details>
1298
+ <div class="acts">${usageCreditsActions(p.view, p.actions).filter(a => !a.input).map(a => html`<button key=${a.id} type="button" class=${`btn btn-sm${kindClass(a.kind)}`} disabled=${!!p.busy} onClick=${() => store.answerPrompt(p, a.id)}>${a.label}</button>`)}
1299
+ ${p.busy && !p.confirming ? html`<span class="wait">${t("chat.promptAnswering")}</span>` : null}</div>
1300
+ </div>`;
1301
+ }
1302
+
1290
1303
  /** #2675: a prompt's typed answer (a kiro question card's "answer in words"): a box and its send button. */
1291
1304
  function PromptText({ p, action }) {
1292
1305
  const [text, setText] = useState("");
@@ -47,6 +47,7 @@ const { useRoomStar } = roomFavorites;
47
47
  import { HubRoomPage } from "./hub-room-thread.js";
48
48
  import { TextSizeButton } from "/assets/header-tools.js";
49
49
  import { HubNotifyToggle, clearHubMeId, noteHubMeId, rememberedMeId, startHubRoomNotifier } from "./hub-room-notify.js";
50
+ import { InstallAppButton } from "/assets/app-install.js";
50
51
  import { hroom } from "./hub-room-strings.js";
51
52
  import { ha as hApps } from "./hub-ai-apps-strings.js";
52
53
  import { hr } from "./hub-read-strings.js";
@@ -213,7 +214,7 @@ export function HubPanel({ route }) {
213
214
  props=${{client:hubClient(),person:s.displayName,request:new URLSearchParams(location.search).get("request")||""}}/></div></div></div>`;
214
215
  // Security notices stay on their own page. The bound join branch above never renders the chat or notices page.
215
216
  if (s && tab === "ask" && view === "notices" && noticesOffered(s)) return html`<div data-effect-panel="hub" class="panel p-hub p-hub-notices">
216
- <${PanelHeader} title=${hc("noticesTitle")}><span class="hub-head-tools"><${HubNotifyToggle} /></span></${PanelHeader}><div data-trust="panel-content" class="panel-body hub-page-body">
217
+ <${PanelHeader} title=${hc("noticesTitle")}><span class="hub-head-tools"><${InstallAppButton} /><${HubNotifyToggle} /></span></${PanelHeader}><div data-trust="panel-content" class="panel-body hub-page-body">
217
218
  <div class="col hub-owner hub-notices-col"><p class="s-page-lead hub-page-lead">${roleNoticesOffered(s, hubClient()) ? roleNoticeLead() : directoryNoticesOffered(s, hubClient()) ? dn("pageLead") : hc("noticesLead")}</p>
218
219
  ${pairingNoticesOffered(s) ? html`<${PairingNotices} admin=${!!s.admin} empty=${introNoticeOffered(s,hubClient()) || directoryNoticesOffered(s, hubClient()) || roleNoticesOffered(s, hubClient()) ? null : html`<${Empty} icon="bell" title=${hc("noNotices")} />`} />` : null}
219
220
  ${introNoticeOffered(s,hubClient())?html`<${IntroNotice} client=${hubClient()} />`:null}${directoryNoticesOffered(s, hubClient()) ? html`<${DirectoryNotices} client=${hubClient()} />` : null}${roleNoticesOffered(s, hubClient()) ? html`<${RoleNotices} client=${hubClient()} />` : null}</div></div></div>`;
@@ -669,7 +670,7 @@ function HubChats() {
669
670
  if (opening && (!rs.loaded || recentRoom(rs.rooms))) return html`<${PanelHeader} title=${hc("chats")} /><div class="hub-home"><div class="hub-home-pick center"><${Skeleton} variant="rows" lines=${4} /></div></div>`;
670
671
  // On a phone the launcher takes the page on 新對話 and when there is nothing to list; otherwise the list does.
671
672
  const alone = launch || (rs.loaded && !rs.error && !rs.rooms.length);
672
- return html`<${PanelHeader} title=${launch ? hc("newChat") : hc("chats")} />
673
+ return html`<${PanelHeader} title=${launch ? hc("newChat") : hc("chats")}><span class="hub-head-tools"><${InstallAppButton} /></span></${PanelHeader}>
673
674
  ${/* M-3137 (versions spec §2.3): the signed-in person whose own Fleet is behind is told here, once per sign-in. */ ""}
674
675
  <${OlderFleetBanner} client=${hubClient()} signIn=${s?.csrf || ""} />
675
676
  <div class=${`hub-home${alone ? " is-launch" : ""}`}>
@@ -19,20 +19,25 @@ import { t, register } from "/assets/app-i18n.js";
19
19
  import { appStore, createStore, useStore } from "/assets/app-store.js";
20
20
  import { useLease } from "/assets/app-ctx.js";
21
21
  import { PanelHeader, setTitle } from "/assets/app-shell.js";
22
- import { fleetPath, chatPath } from "/assets/app-route.js";
22
+ import { fleetPath, chatPath, settingsPath } from "/assets/app-route.js";
23
23
  import { namesOf, namesStore } from "/assets/instance-nav.js";
24
24
  import { Empty, Skeleton } from "/assets/ui-states.js";
25
25
  import { Icon } from "/assets/ui-icons.js";
26
+ import { InstallAppSection } from "/assets/app-install.js";
26
27
  import { toast } from "/assets/ui-toast.js";
27
28
  import { confirmDialog } from "/assets/ui-confirm.js";
28
29
  import { notifyStore, notifySupport, configDetail, reasonText, refreshNotify, setNotify } from "/assets/app-needs.js";
29
30
  import { openSignIn, signInOffered } from "./backend-signin.js";
31
+ import { usageCreditsActions, usageCreditsTitle, usageCreditsDetail, kindClass, showRawLabel } from "./usage-credits-card.js";
30
32
  import { decideProposal, installProposals } from "./agent-proposals.js";
31
33
  import { GeneralLocation } from "./general-location.js";
32
34
  import { runtimeUpdateText } from "./runtime-update-status.js";
33
35
  import { ContactNeedsItem, ContactSuggestionsGroup, isRestrictedSuggestion } from "./contact-needs.js";
34
36
  import { ContactVerifyNeed, contactVerifyCount, isContactVerify } from "./contact-verify-need.js";
35
37
  import { HostDirectoryNotices, hostDirectoryNoticesOffered } from "./hub-host-security-notices.js";
38
+ // M-3770 1.4: AgEnD's own update in Needs you — only a failure or "can't update here" (design §3.1).
39
+ import { UpdateNeedsItem, updateAttention } from "/assets/update-card-ui.js";
40
+ import { updateStore } from "/assets/app-update.js";
36
41
 
37
42
  // A pre-upgrade tab retains app-i18n.js. Register these reasons when the updated panel is loaded, too.
38
43
  register("app", {
@@ -71,7 +76,7 @@ register("needs", {
71
76
  e_confirmation_not_pending: "This request was already decided or ran out.", e_not_found: "This request is no longer here.",
72
77
  },
73
78
  "zh-TW": {
74
- otherEmpty: "沒有其他待處理事項。", title: "等你處理", empty: "目前沒有需要你處理的事", emptyHint: "agent 在等你時,會出現在這裡——也會出現在聊天 app 的 General。", emptyHintWeb: "agent 在等你時,會出現在這裡。",
79
+ otherEmpty: "沒有其他待處理事項。", title: "等你處理", empty: "目前沒有需要你處理的事", emptyHint: "Agent 在等你時,會出現在這裡——也會出現在聊天 app 的 General。", emptyHintWeb: "Agent 在等你時,會出現在這裡。",
75
80
  open: "開啟聊天", kiroOpen: "開啟 Agent", kiroMigration: "遷移說明", openCard: "打開卡片", noAssignee: "任務看板(沒有負責人)", fleetSignIns: "AI 帳號", signIn: "連接帳號",
76
81
  gap: "還沒補齊:{0}", gapUnchecked: "還有 {0} 項沒勾", gapNoResult: "沒有產出總結", gapJoin: "、", acknowledge: "確認", acknowledging: "確認中…", answering: "回覆中…",
77
82
  hubClose: "不處理這題", hubClosing: "結束中…", hubCloseTitle: "不處理這題?", hubCloseConfirm: "不處理這題", hubCloseDetail: "可以結束這題,不會再把問題送給 Agent。", hubCloseMessage: "Hub 會告訴提問者這題不會回答。關閉後無法復原。同一則訊息無法再試一次;提問者可以另問一題。已經送出的答案會保留。這不會停止 Agent 已經開始的工作。", hubCloseDone: "Hub 已確認結束這題。", hubCloseAnswered: "答案已經送達 Hub,原有答案會保留。", hubCloseVerify: "請先驗證管理員帳號,再結束這題。", hubCloseForbidden: "只有管理這個 Agent 的管理員可以結束這題。", hubCloseUnsupported: "請先更新 Hub,才能結束這題。目前仍保留暫停項目。", hubCloseUnavailable: "Hub 尚未確認結束。請檢查連線後再試;問題沒有重新送出。",
@@ -221,7 +226,9 @@ export function NeedsPanel({ navKey }) {
221
226
  const verify = items.find(isContactVerify);
222
227
  const groups = groupNeeds(items.filter(item => !item.runtimeUpdate && !isRestrictedSuggestion(item) && !isContactVerify(item)));
223
228
  // M-3710: the verify line counts as the requests it stands for (as the badge and tab title do).
224
- const shownCount = items.length - suggestions.length + (suggestions.length ? 1 : 0) + asks.length + (verify ? contactVerifyCount(verify) - 1 : 0);
229
+ // #4487 review P2: AgEnD's own update item — rendered, counted and weighed for the empty state from the one answer.
230
+ const updateInfo = useStore(updateStore).info, updateNeed = !!updateAttention(updateInfo);
231
+ const shownCount = items.length - suggestions.length + (suggestions.length ? 1 : 0) + asks.length + (verify ? contactVerifyCount(verify) - 1 : 0) + (updateNeed ? 1 : 0);
225
232
  if (updates.length) groups.push({ instance: "", items: updates });
226
233
  const nowMs = Date.now();
227
234
  return html`<div data-effect-panel="needs" class="panel p-needs">
@@ -233,8 +240,9 @@ export function NeedsPanel({ navKey }) {
233
240
  ${decidedHere.map(([id, d]) => html`<${ProposalResult} key=${id} result=${d} />`)}
234
241
  </section>` : null}
235
242
  ${verify ? html`<${ContactVerifyNeed} item=${verify} />` : null}
236
- ${(!ready || needsLoaded === false) && !items.length && !asks.length ? html`<${Skeleton} variant="rows" lines=${3} />`
237
- : !items.length && !asks.length && !decidedHere.length ? hostDirectoryNoticesOffered() ? html`<p class="muted">${tn("otherEmpty")}</p>` : html`<${Empty} icon="check" title=${tn("empty")} hint=${tn(chatApp ? "emptyHint" : "emptyHintWeb")} />`
243
+ ${updateNeed ? html`<${UpdateNeedsItem} info=${updateInfo} settingsHref=${`${settingsPath("advanced")}#settings-update`} />` : null}
244
+ ${(!ready || needsLoaded === false) && !items.length && !asks.length && !updateNeed ? html`<${Skeleton} variant="rows" lines=${3} />`
245
+ : !items.length && !asks.length && !decidedHere.length ? updateNeed ? null : hostDirectoryNoticesOffered() ? html`<p class="muted">${tn("otherEmpty")}</p>` : html`<${Empty} icon="check" title=${tn("empty")} hint=${tn(chatApp ? "emptyHint" : "emptyHintWeb")} />`
238
246
  : groups.map((g) => html`<section key=${JSON.stringify([g.instance, g.items[0]?.type === "config",g.items[0]?.type === 'host', !!g.items[0]?.runtimeUpdate])} class="n-group" aria-label=${g.items[0]?.runtimeUpdate ? runtimeUpdateText("attention") : g.instance}>
239
247
  <h2 class="n-group-head">${g.items[0]?.runtimeUpdate ? runtimeUpdateText("attention") : g.instance ? html`<a href=${chatPath(g.instance)} title=${g.instance}>${nameFor(g.instance)}</a>` : g.items[0]?.type==='host'?hostAlertText('title'):g.items[0]?.type === "config" ? t("app.settings") : tn(g.items.some(i => i.type === "backend") ? "fleetSignIns" : "noAssignee")}</h2>
240
248
  ${g.items.map((item) => item.type === "contact"
@@ -254,13 +262,16 @@ function NeedsItem({ item, nowMs, owner }) {
254
262
  const p = item.type === "prompt" && item.nonce && owner ? owner.state.prompts[item.nonce] : null;
255
263
  const fallback = item.nonce ? c.prompts[item.nonce] : undefined;
256
264
  const promptBusy = p ? p.busy || p.resolved : !!fallback;
265
+ // M-3757: Claude's usage-credits prompt, compact: a one-line title, its options named by what they do, its own words folded.
266
+ const ucView = item.type === "prompt" && item.view && item.view.kind === "usage-credits" ? item.view : null;
267
+ const shownActions = ucView ? usageCreditsActions(ucView, item.actions) : item.actions;
257
268
  const answer = async (action) => {
258
269
  const store = chatOwner();
259
270
  if (store) { store.answerByNonce(item, action); return; }
260
271
  // Only before Chat has booted: the page's own claim on this nonce, taken now (synchronously), kept until the
261
272
  // server's list drops the prompt (or the answer fails).
262
273
  if (claims.get().prompts[item.nonce]) return;
263
- const confirmation = item.actions?.find(a => a.id === action)?.confirmation;
274
+ const confirmation = shownActions?.find(a => a.id === action)?.confirmation;
264
275
  setClaim("prompts", item.nonce, confirmation ? "confirming" : "busy");
265
276
  if (confirmation && !await confirmDialog({ ...confirmation, danger: true })) {
266
277
  setClaim("prompts", item.nonce, null);
@@ -328,6 +339,22 @@ function NeedsItem({ item, nowMs, owner }) {
328
339
  setClaim("acks", hubKey, ok ? "done" : null);
329
340
  toast(ok ? tn("hubRetryDone") : res && res.status === 404 ? tn("hubRetryGone") : res && res.status === 409 ? tn("hubRetryNot") : t("app.failed"), ok);
330
341
  };
342
+ const answering = (p ? p.busy && !p.confirming : fallback === "busy");
343
+ // M-3757: Claude's usage-credits prompt in the standard layout: the question, one sentence on the bill, Claude's own
344
+ // words folded, then its choices (named by what they do) and Open chat.
345
+ if (ucView) return html`<article data-trust="permission" class="n-item n-usage-credits">
346
+ <span class="n-icon"><${Icon} name=${ICON[item.type] || "alert"} size=${18} /></span>
347
+ <div class="n-body">
348
+ <div class="n-title"><strong>${usageCreditsTitle(ucView, { named: false })}</strong><span class="n-age">${age(item.since, nowMs)}</span></div>
349
+ <p class="n-detail">${usageCreditsDetail(ucView)}</p>
350
+ <details class="n-raw"><summary>${showRawLabel()}</summary><pre class="n-raw-text">${ucView.raw}</pre></details>
351
+ <div class="n-actions">
352
+ ${shownActions.filter((a) => !a.input).map((a) => html`<button key=${a.id} type="button" class=${`btn btn-sm${kindClass(a.kind)}`}
353
+ disabled=${promptBusy} onClick=${() => answer(a.id)}>${answering ? tn("answering") : a.label}</button>`)}
354
+ ${item.instance ? html`<a class="btn btn-sm btn-ghost" href=${chatPath(item.instance)}>${tn("open")}</a>` : null}
355
+ </div>
356
+ </div>
357
+ </article>`;
331
358
  return html`<article data-trust="permission" class=${`n-item${BAD.has(item.reason) ? " bad" : ""}`}>
332
359
  <span class="n-icon"><${Icon} name=${ICON[item.type] || "alert"} size=${18} /></span>
333
360
  <div class="n-body">
@@ -340,7 +367,7 @@ function NeedsItem({ item, nowMs, owner }) {
340
367
  ${item.type==='host'?(item.hostAlert?html`<${HostAlertActions} record=${item.hostAlert}/>`:html`<a class="btn btn-sm" href=${fleetPath('host-health')}>${hostAlertText('open')}</a>`):null}
341
368
  <div class="n-actions">
342
369
  ${item.type === "prompt" && Array.isArray(item.actions) ? item.actions.filter((a) => !a.input).map((a) => html`<button key=${a.id} type="button" class="btn btn-sm"
343
- disabled=${promptBusy} onClick=${() => answer(a.id)}>${(p ? p.busy && !p.confirming : fallback === "busy") ? tn("answering") : a.label}</button>`) : null}
370
+ disabled=${promptBusy} onClick=${() => answer(a.id)}>${(p ? p.busy && !p.confirming : fallback === "busy") ? tn("answering") : a.label}${a.hint ? html`<span class="btn-hint">${a.hint}</span>` : null}</button>`) : null}
344
371
  ${item.type === "hub" && item.hubRetry ? html`<button type="button" class="btn btn-sm btn-primary" disabled=${!!hubAck || !!closeAck} onClick=${retryHub}>
345
372
  <${Icon} name="restart" size=${14} />${hubAck === "busy" ? tn("hubRetrying") : tn("hubRetry")}</button>` : null}
346
373
  ${item.type === "hub" && item.hubClose ? html`<button type="button" class="btn btn-sm hub-close" disabled=${!!closeAck || !!hubAck} onClick=${closeHub}>${tn(closeAck === "busy" ? "hubClosing" : "hubClose")}</button>` : null}
@@ -483,5 +510,6 @@ function NotifyToggle() {
483
510
  <${Icon} name="bell" size=${14} />${on ? tn("turnOff") : tn("turnOn")}</button></div>` : null}
484
511
  </div>
485
512
  </article>
513
+ <${InstallAppSection} />
486
514
  </section>`;
487
515
  }
@@ -72,6 +72,7 @@ import { DevicesCard } from "./settings-devices.js";
72
72
  import { AccessOverview, accessOverviewLabel } from "./settings-access-overview.js";
73
73
  import { HubSection, hubSectionText } from "./settings-hub-section.js";
74
74
  import { NamedLinkTest, setTypedTunnelToken } from "./settings-named-test.js";
75
+ import { FixedPreviewAddress, bareHost, previewHostPlaceholder, previewPortOf } from "./settings-preview-address.js";
75
76
  import { SignInList } from "./backend-signin.js";
76
77
  import { AccountsView, defaultsBackendOptions } from "./accounts-view.js"; // #3212: SignInList stays exported for a page that still imports it
77
78
  import { ProviderMark } from "./provider-marks.js";
@@ -163,6 +164,10 @@ export function SettingsPanel({ route, navKey }) {
163
164
  const stagedRef = useRef(staged);
164
165
  stagedRef.current = staged;
165
166
  const [dialog, setDialog] = useState(null); // { kind, ...props, key: navKey }
167
+ // M-3814: a section's open tab for this navigation, kept across the reload that remounts it after a save (its key
168
+ // moves with loadedAt): saving on Access → Sharing no longer drops back to Overview a moment later.
169
+ const tabMemory = useRef({ navKey: null, tabs: {} });
170
+ if (tabMemory.current.navKey !== navKey) tabMemory.current = { navKey, tabs: {} };
166
171
  const [search, setSearch] = useState("");
167
172
  // #2347: each section's draft while it is edited (settings-draft.js), and the epoch that remounts the sections when
168
173
  // the drafts go: a Save that went through whole, or Discard. A Save that failed keeps them (what did not land is staged
@@ -399,7 +404,7 @@ export function SettingsPanel({ route, navKey }) {
399
404
  // #2347: sections read `staged` (each change as staged, its extra fields kept: Guests carries its whole draft) and
400
405
  // `drafts` to come back to their edits; `draftEpoch` moves on Discard and after a Save to start them from what is saved.
401
406
  const ctx = data && !data.error ? makeCtx(data, setData, stage, unstage, reload, reloadLive, () => mount.current(),
402
- { drafts: drafts.current, draftEpoch, staged, savingDrafts: () => submitted.current,
407
+ { drafts: drafts.current, draftEpoch, staged, savingDrafts: () => submitted.current, tabMemory: tabMemory.current,
403
408
  savingStaged: () => (submitted.current || operationActive() ? submittedStaged.current : null) }) : null;
404
409
  // #1519 P7: "Connect a chat app" on the first-run card elsewhere came here for the wizard: it opens once the data is in.
405
410
  // #2347: it writes a connection and an agent at once — not while a fleet.yaml edit waits to be saved.
@@ -1332,7 +1337,9 @@ export function uploadMbInEffect(web) {
1332
1337
  }
1333
1338
  function WebSection({ ctx, staged, part = "all" }) {
1334
1339
  const { schema } = ctx;
1335
- const [accessTab, setAccessTab] = useSettingsTabs("access", "overview");
1340
+ const memory = ctx.tabMemory || null;
1341
+ const [accessTab, setAccessTab] = useSettingsTabs("access", (memory && memory.tabs.access) || "overview");
1342
+ useEffect(() => { if (memory) memory.tabs.access = accessTab; }, [accessTab, memory]);
1336
1343
  const web = ctx.fleet.web || {}, local = (web.session && web.session.local) || {}, term = ctx.fleet.web_terminal || {};
1337
1344
  const plSession = (web.session && web.session.public_link) || {}; // #3708
1338
1345
  // M-3278 (decision 7933bf90): over the public link an admin edits these as anywhere (Guests and Web authority included);
@@ -1347,7 +1354,7 @@ function WebSection({ ctx, staged, part = "all" }) {
1347
1354
  levels: web.office_levels !== false, // #2661: on by default
1348
1355
  cdn: web.preview_cdn === true, // #2911 (7): off by default
1349
1356
  loginQr: web.login_qr === true, // #3061 (P2b): off by default
1350
- pub: { allow_public: (web.public_link && web.public_link.allow_public) ?? true, ttl_minutes: (web.public_link && web.public_link.ttl_minutes) ?? 120, protocol: (web.public_link && web.public_link.protocol) ?? "http2", hostname: (web.public_link && web.public_link.hostname) ?? "", tunnel_token_env: (web.public_link && web.public_link.tunnel_token_env) ?? "", origin_port: (web.public_link && web.public_link.origin_port) ?? 19282, auto_open: (web.public_link && web.public_link.auto_open) ?? false },
1357
+ pub: { allow_public: (web.public_link && web.public_link.allow_public) ?? true, ttl_minutes: (web.public_link && web.public_link.ttl_minutes) ?? 120, protocol: (web.public_link && web.public_link.protocol) ?? "http2", hostname: (web.public_link && web.public_link.hostname) ?? "", tunnel_token_env: (web.public_link && web.public_link.tunnel_token_env) ?? "", origin_port: (web.public_link && web.public_link.origin_port) ?? 19282, auto_open: (web.public_link && web.public_link.auto_open) ?? false, preview_hostname: (web.public_link && web.public_link.preview_hostname) ?? "" },
1351
1358
  session: { absolute_hours: local.absolute_hours ?? null, idle_hours: local.idle_hours ?? null },
1352
1359
  plSession: { absolute_hours: plSession.absolute_hours ?? null, idle_minutes: plSession.idle_minutes ?? null },
1353
1360
  terminal: { enabled: term.enabled ?? null, ttl_minutes: term.ttl_minutes ?? null },
@@ -1355,7 +1362,7 @@ function WebSection({ ctx, staged, part = "all" }) {
1355
1362
  const text = (v) => (v === null || v === undefined ? "" : String(v));
1356
1363
  /** #2347: a field's row class: `s-dirty` while it differs from what is saved (the draft may come from before). */
1357
1364
  const savedForm = useMemo(() => ({ notify: String(original.notify), echo: original.echo, log: original.log, thinking: original.thinking, usagePub: original.usagePub, levels: original.levels, cdn: original.cdn, loginQr: original.loginQr, pub: original.pub.allow_public,
1358
- ttl: String(original.pub.ttl_minutes), protocol: original.pub.protocol, hostname: original.pub.hostname, originPort: String(original.pub.origin_port),
1365
+ ttl: String(original.pub.ttl_minutes), protocol: original.pub.protocol, hostname: original.pub.hostname, originPort: String(original.pub.origin_port), previewHost: original.pub.preview_hostname,
1359
1366
  abs: text(original.session.absolute_hours), idle: text(original.session.idle_hours),
1360
1367
  plAbs: text(original.plSession.absolute_hours), plIdle: text(original.plSession.idle_minutes), termOn: original.terminal.enabled !== false,
1361
1368
  termTtl: text(original.terminal.ttl_minutes), autoOpen: original.pub.auto_open }), []);
@@ -1371,7 +1378,7 @@ function WebSection({ ctx, staged, part = "all" }) {
1371
1378
  echo: pick(pending, "echo_to_channel", original.echo), log: pick(pending, "log_tab", original.log), thinking: pick(pending, "log_thinking", original.thinking), usagePub: pick(pending, "usage_report_on_public_link", original.usagePub),
1372
1379
  levels: pick(pending, "office_levels", original.levels), cdn: pick(pending, "preview_cdn", original.cdn), loginQr: pick(pending, "login_qr", original.loginQr),
1373
1380
  pub: pick(pub, "allow_public", original.pub.allow_public), ttl: String(pick(pub, "ttl_minutes", original.pub.ttl_minutes)), protocol: pick(pub, "protocol", original.pub.protocol),
1374
- hostname: pick(pub, "hostname", original.pub.hostname), originPort: String(pick(pub, "origin_port", original.pub.origin_port)), autoOpen: pick(pub, "auto_open", original.pub.auto_open),
1381
+ hostname: pick(pub, "hostname", original.pub.hostname), originPort: String(pick(pub, "origin_port", original.pub.origin_port)), previewHost: pick(pub, "preview_hostname", original.pub.preview_hostname), autoOpen: pick(pub, "auto_open", original.pub.auto_open),
1375
1382
  abs: text(pick(session, "absolute_hours", original.session.absolute_hours)), idle: text(pick(session, "idle_hours", original.session.idle_hours)),
1376
1383
  plAbs: text(pick(plPending, "absolute_hours", original.plSession.absolute_hours)), plIdle: text(pick(plPending, "idle_minutes", original.plSession.idle_minutes)),
1377
1384
  termOn: pick(terminal, "enabled", original.terminal.enabled) !== false, termTtl: text(pick(terminal, "ttl_minutes", original.terminal.ttl_minutes)),
@@ -1396,6 +1403,10 @@ function WebSection({ ctx, staged, part = "all" }) {
1396
1403
  const plAbsNow = Math.min(plAbsQuick, abs), plIdleNow = Math.min(plIdleQuick, plAbsNow * 60, idle * 60);
1397
1404
  const errors = {
1398
1405
  hostname: f.hostname && !/^(?:https:\/\/)?[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)+\/?$/.test(f.hostname) ? "namedHostnameInvalid" : "",
1406
+ // M-3814: the fixed preview address — a separate name on the same tunnel, only beside a fixed hostname.
1407
+ previewHost: !String(f.previewHost || "").trim() ? ""
1408
+ : !/^(?:https:\/\/)?[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)+\/?$/.test(String(f.previewHost).trim()) ? "namedHostnameInvalid"
1409
+ : !named ? "previewHostNeedsHostname" : bareHost(f.previewHost) === bareHost(f.hostname) ? "previewHostSame" : "",
1399
1410
  originPort: !Number.isInteger(Number(f.originPort)) || Number(f.originPort) < 1024 || Number(f.originPort) > 65535 ? "namedPortInvalid" : "",
1400
1411
  // #named-link-ttl: a fixed hostname (named tunnel) allows up to 7 days, or 0 = no expiry; a quick tunnel 1–480.
1401
1412
  ttl: String(f.ttl).trim() === "" || !Number.isInteger(Number(f.ttl)) || Number(f.ttl) < (named ? 0 : 1) || Number(f.ttl) > (named ? 10080 : 480)
@@ -1412,7 +1423,7 @@ function WebSection({ ctx, staged, part = "all" }) {
1412
1423
  // #2347: invalid text keeps the draft unsaved and Save waiting ("Fix 1 field to save"); no older valid draft is sent.
1413
1424
  if (overPublicLink) return;
1414
1425
  if (!ready) {
1415
- const at = { hostname: "#publicWebHostname", originPort: "#publicWebOriginPort", ttl: "#publicWebTtl", abs: "#webSessionAbsolute", idle: "#webSessionIdle",
1426
+ const at = { hostname: "#publicWebHostname", previewHost: "#publicWebPreviewHostname", originPort: "#publicWebOriginPort", ttl: "#publicWebTtl", abs: "#webSessionAbsolute", idle: "#webSessionIdle",
1416
1427
  plAbs: "#webPublicSessionAbsolute", plIdle: "#webPublicSessionIdle",
1417
1428
  termTtl: "#webTerminalTtl" }[Object.keys(errors).find((k) => errors[k])];
1418
1429
  syncStage(ctx, "web", { label: tn("webSettingsLabel"), invalid: tn(Object.values(errors).find(Boolean)), section: "access", target: at });
@@ -1422,7 +1433,7 @@ function WebSection({ ctx, staged, part = "all" }) {
1422
1433
  // reference adopts the standard env key; mounting or editing an unrelated field never rewrites credentials.
1423
1434
  const tokenEnv = f.hostname === original.pub.hostname ? original.pub.tunnel_token_env
1424
1435
  : f.hostname ? original.pub.tunnel_token_env || "AGEND_CLOUDFLARE_TUNNEL_TOKEN" : "";
1425
- const publicPatch = changedFields({ allow_public: f.pub, ttl_minutes: Number(f.ttl), protocol: f.protocol, hostname: f.hostname, tunnel_token_env: tokenEnv, origin_port: Number(f.originPort), auto_open: f.autoOpen }, original.pub);
1436
+ const publicPatch = changedFields({ allow_public: f.pub, ttl_minutes: Number(f.ttl), protocol: f.protocol, hostname: f.hostname, tunnel_token_env: tokenEnv, origin_port: Number(f.originPort), auto_open: f.autoOpen, preview_hostname: String(f.previewHost || "").trim() }, original.pub);
1426
1437
  const sessionPatch = changedFields({ absolute_hours: value(f.abs), idle_hours: value(f.idle) }, original.session);
1427
1438
  const plSessionPatch = changedFields({ absolute_hours: value(f.plAbs), idle_minutes: value(f.plIdle) }, original.plSession);
1428
1439
  // The checkbox shows the default (on) for an unset key: only a real toggle is written; on again = back to the default.
@@ -1578,12 +1589,15 @@ function WebSection({ ctx, staged, part = "all" }) {
1578
1589
  ${lock(html`<section class="card s-public-entry"><h3>${layoutText("revPublicEntry")}</h3>
1579
1590
  <label class=${fc("check", "pub")}><input id="publicWebLink" type="checkbox" checked=${f.pub} onChange=${(e) => set("pub")(e.target.checked)} /><span>${tn("publicLink")}</span><${Impact} schema=${schema} field="web.public_link.allow_public" /></label>
1580
1591
  <p class="note">${tn("publicLinkHint")}</p>
1581
- <div class="grid2">
1592
+ <div class="grid2" id="publicFixedAddress">
1582
1593
  <div class=${fc("field", "hostname")}><label for="publicWebHostname">${tn("namedHostname")}</label><input id="publicWebHostname" type="text" value=${f.hostname} placeholder="agend.example.com" class=${errors.hostname ? "invalid" : ""} onInput=${(e) => set("hostname")(e.target.value)} /><${Feedback} error=${errors.hostname} /></div>
1583
1594
  <div class=${fc("field", "originPort")}><label for="publicWebOriginPort">${tn("namedOriginPort")}</label><input id="publicWebOriginPort" type="number" min="1024" max="65535" value=${f.originPort} class=${errors.originPort ? "invalid" : ""} onInput=${(e) => set("originPort")(e.target.value)} /><${Feedback} error=${errors.originPort} /></div>
1584
1595
  </div>
1585
1596
  <p class="note">${tn("namedTunnelHint")} <a href="https://github.com/songsid/AgEnD/blob/main/docs/named-tunnel.md" target="_blank" rel="noopener noreferrer">${tn("namedTunnelSetup")}</a></p>
1586
1597
  ${String(f.hostname || "").trim() ? html`<${NamedLinkTest} hostname=${f.hostname} port=${f.originPort} protocol=${f.protocol} />` : null}
1598
+ ${!named && !String(f.previewHost || "").trim() ? html`<p class="fixed-preview-needs lbar" id="publicPreviewNeedsFixed" role="note">${tn("previewNeedsFixedHost")}</p>` : null}
1599
+ ${named || String(f.previewHost || "").trim() ? html`<${FixedPreviewAddress} field=${html`<div class=${fc("field", "previewHost")}><label for="publicWebPreviewHostname">${tn("previewHostname")}<${Impact} schema=${schema} field="web.public_link.preview_hostname" /></label><input id="publicWebPreviewHostname" type="text" value=${f.previewHost} placeholder=${previewHostPlaceholder(f.hostname)} class=${errors.previewHost ? "invalid" : ""} onInput=${(e) => set("previewHost")(e.target.value)} /><${Feedback} error=${errors.previewHost} /></div>`}
1600
+ hostname=${String(f.previewHost || "").trim()} placeholder=${previewHostPlaceholder(f.hostname)} originPort=${f.originPort} saved=${bareHost(f.previewHost) !== "" && bareHost(f.previewHost) === bareHost(web.public_link && web.public_link.preview_hostname)} port=${previewPortOf(ctx.fleet)} />` : null}
1587
1601
  <div class="grid2">
1588
1602
  <div class=${fc("field", "ttl")}><label for="publicWebTtl">${tn(named ? "publicTtlNamed" : "publicTtl")}</label><input id="publicWebTtl" type="number" min=${named ? "0" : "1"} max=${named ? "10080" : "480"} step="1" class=${errors.ttl ? "invalid" : ""} value=${f.ttl} onInput=${(e) => set("ttl")(e.target.value)} /><${Feedback} error=${errors.ttl} /></div>
1589
1603
  <div class=${fc("field", "protocol")}><label for="publicWebProtocol">${tn("publicProtocol")}</label><${Select} id="publicWebProtocol" value=${f.protocol} onChange=${set("protocol")} options=${["http2", "quic", "auto"]} /></div>
@@ -0,0 +1,156 @@
1
+ // M-3814 (the user, 2026-11-26): Settings → Access → the fixed address's preview address. Over a fixed link, HTML
2
+ // previews used to open a temporary Cloudflare address each time, which Cloudflare sometimes limits (429). With
3
+ // `web.public_link.preview_hostname` they use a second published route on the same tunnel, to the preview port; the
4
+ // one manual step is that route (Cloudflare adds its DNS record itself). **Check** proves the saved address reaches
5
+ // this AgEnD's previews through the open fixed link; it starts nothing. The server answers closed step codes only.
6
+ import { html, useRef, useState } from "/assets/app-html.js";
7
+ import { register, t } from "/assets/app-i18n.js";
8
+ import { useLease } from "/assets/app-ctx.js";
9
+ import { api } from "./settings-confirm.js";
10
+
11
+ register("settings", {
12
+ en: {
13
+ previewHostname: "Preview address (optional)",
14
+ previewHostNeedsHostname: "A preview address needs the fixed public hostname above.",
15
+ previewHostSame: "Use a different name from the fixed hostname: a preview on the dashboard's own name could use its sign-in.",
16
+ pvaLead: "HTML previews over the fixed public link use a second address on the same tunnel. Without one, AgEnD opens a temporary Cloudflare link for previews, and Cloudflare sometimes limits those.",
17
+ pvaStepsTitle: "Set it up once in Cloudflare",
18
+ pvaStep1: "In Cloudflare, open “Networking” → “Tunnels”, click your tunnel, then press “Routes” → “Add route” → “Published application” (Cloudflare's own buttons).",
19
+ pvaStep2: "In the “Hostname” field: {0}",
20
+ pvaStep2Any: "In the “Hostname” field: a name such as {0}",
21
+ pvaStep3: "In the “Service URL” field: http://127.0.0.1:{0} (the preview's own port, not {1})",
22
+ pvaStep4: "Press “Add route” to save. Cloudflare adds the DNS record by itself.",
23
+ pvaStep5: "Fill in the address here and save. With the public link open (send /web), press “Check preview address”.",
24
+ pvaCheck: "Check preview address",
25
+ pvaNeedsAddress: "Fill in the preview address first.",
26
+ previewNeedsFixedHost: "HTML previews over the public link use a temporary Cloudflare link. To give them a fixed preview address, fill in the fixed public hostname above first.",
27
+ pvaChecking: "Checking… (up to about a minute)",
28
+ pvaBusy: "A check is already running. Try again when it ends.",
29
+ pvaFailed: "The check could not run. Try again.",
30
+ pvaNotRun: "Not checked (an earlier step failed).",
31
+ pvaStep_values: "The preview address is saved",
32
+ pvaStep_link: "The public link is open",
33
+ pvaResultFor: "Check of {0}",
34
+ pvaStep_dns: "Found in DNS",
35
+ pvaStep_reach: "Reaches this AgEnD's previews",
36
+ "pva_values_not-set": "No preview address is saved.",
37
+ "pva_values_not-saved": "Save first: Check uses the saved address.",
38
+ "pva_link_link-closed": "Open the public link (/web), then check again: the preview address only answers while the public link is open.",
39
+ "pva_link_no-listener": "Previews are off or not running on this AgEnD.",
40
+ "pva_dns_dns-missing": "{0} does not exist yet. Add the Published application route for {0} on this tunnel (step 1).",
41
+ "pva_dns_dns-failed": "This machine could not look up {0}: this machine's network may block DNS. Ask the network administrator.",
42
+ pva_reach_ok: "It works: previews over the public link use this address.",
43
+ "pva_reach_wrong-service": "Cloudflare answered but could not reach the service: make the route's service http://127.0.0.1:{1} (HTTP, not HTTPS).",
44
+ "pva_reach_other-page": "{0} answered with another page: point its route to this tunnel, with the service http://127.0.0.1:{1}.",
45
+ "pva_reach_route-missing": "{0} is not routed to this tunnel. Add the Published application route for {0} (step 1).",
46
+ "pva_reach_self-unreachable": "The tunnel is connected, but this machine's network can't open {0} (some networks filter new domains). From another network, such as a phone on mobile data, it may still work.",
47
+ "pva_reach_reach-failed": "{0} did not answer as expected. Try again in a while; if it repeats, check {0} on the tunnel's page in Cloudflare.",
48
+ pvaTimeout: "The check took too long and was stopped. Check again; if it repeats, check this machine's network.",
49
+ },
50
+ "zh-TW": {
51
+ previewHostname: "預覽網址(選用)",
52
+ previewHostNeedsHostname: "預覽網址需要先填上方的固定公開網域。",
53
+ previewHostSame: "請用和固定網域不同的名稱:預覽若用儀表板自己的網域,可能用到它的登入。",
54
+ pvaLead: "透過固定的公開連結看 HTML 預覽時,會用同一條通道上的第二個網址。沒有設定的話,AgEnD 會為預覽另開一條 Cloudflare 臨時連結,而 Cloudflare 有時會限制這類連結。",
55
+ pvaStepsTitle: "在 Cloudflare 設定一次",
56
+ pvaStep1: "在 Cloudflare 打開「Networking」→「Tunnels」,點你的通道,再按「Routes」→「Add route」→「Published application」(Cloudflare 畫面上的英文按鈕)。",
57
+ pvaStep2: "「Hostname」欄填 {0}",
58
+ pvaStep2Any: "「Hostname」欄填一個名稱,例如 {0}",
59
+ pvaStep3: "「Service URL」欄填 http://127.0.0.1:{0}(預覽專用的埠,不是 {1})",
60
+ pvaStep4: "按「Add route」儲存。Cloudflare 會自動新增 DNS 記錄。",
61
+ pvaStep5: "在這裡填上網址並儲存。公開連結開著時(傳 /web 開啟),按「檢查預覽網址」。",
62
+ pvaCheck: "檢查預覽網址",
63
+ pvaNeedsAddress: "先填好預覽網址。",
64
+ previewNeedsFixedHost: "透過公開連結的 HTML 預覽會用 Cloudflare 臨時連結。要改用固定的預覽網址,請先填上方的固定公開網域。",
65
+ pvaChecking: "檢查中…(最多約 1 分鐘)",
66
+ pvaBusy: "已經有一個檢查在進行,請等它結束再試。",
67
+ pvaFailed: "檢查沒有執行成功,請再試一次。",
68
+ pvaNotRun: "未檢查(前面的步驟失敗)。",
69
+ pvaStep_values: "預覽網址已儲存",
70
+ pvaStep_link: "公開連結已開啟",
71
+ pvaResultFor: "{0} 的檢查結果",
72
+ pvaStep_dns: "查得到",
73
+ pvaStep_reach: "連得到這台 AgEnD 的預覽",
74
+ "pva_values_not-set": "還沒有儲存預覽網址。",
75
+ "pva_values_not-saved": "請先儲存:檢查用的是已儲存的網址。",
76
+ "pva_link_link-closed": "請先開啟公開連結(/web)再檢查:預覽網址只在公開連結開著時回應。",
77
+ "pva_link_no-listener": "這台 AgEnD 的預覽已關閉或沒有在執行。",
78
+ "pva_dns_dns-missing": "{0} 還不存在。請在這條通道新增 {0} 的 Published application 路由(第 1 步)。",
79
+ "pva_dns_dns-failed": "這台主機查不到 {0}:這台主機所在的網路可能擋了 DNS。請洽網路管理員。",
80
+ pva_reach_ok: "正常:透過公開連結的預覽會用這個網址。",
81
+ "pva_reach_wrong-service": "Cloudflare 有回應,但連不到服務:請把路由的 service 設成 http://127.0.0.1:{1}(HTTP,不是 HTTPS)。",
82
+ "pva_reach_other-page": "{0} 回應了別的頁面:請把它的路由指向這條通道,service 設成 http://127.0.0.1:{1}。",
83
+ "pva_reach_route-missing": "{0} 沒有路由到這條通道。請新增 {0} 的 Published application 路由(第 1 步)。",
84
+ "pva_reach_self-unreachable": "通道已連上,但這台主機所在的網路打不開 {0}(有些網路會擋新的網域)。從其他網路(例如手機行動網路)可能可以正常使用。",
85
+ "pva_reach_reach-failed": "{0} 沒有如預期回應。請過一陣子再試;如果一直這樣,請到 Cloudflare 的通道頁檢查 {0}。",
86
+ pvaTimeout: "檢查太久,已經停止。請再檢查一次;如果一直這樣,請檢查這台主機所在的網路。",
87
+ },
88
+ });
89
+ const tn = (k, ...v) => t(`settings.${k}`, ...v);
90
+ const STEPS = ["values", "link", "dns", "reach"];
91
+
92
+ /** A hostname as the server reads it: no https://, no trailing slash, lower case. */
93
+ export function bareHost(value) {
94
+ return String(value ?? "").trim().replace(/^https:\/\//i, "").replace(/\/$/, "").toLowerCase();
95
+ }
96
+ /** What the field suggests: preview.<the fixed hostname>. */
97
+ export function previewHostPlaceholder(hostname) {
98
+ const host = bareHost(hostname);
99
+ return host ? `preview.${host}` : "preview.agend.example.com";
100
+ }
101
+ /** The preview listener's port, as the fleet resolves it (web-preview.ts previewSettings): preview_port, else web port + 1. */
102
+ export function previewPortOf(fleet) {
103
+ const set = fleet && fleet.web && fleet.web.preview_port;
104
+ if (Number.isInteger(set) && set > 0) return set;
105
+ const hp = Number.isInteger(fleet && fleet.health_port) ? fleet.health_port : 19280;
106
+ return hp > 0 && hp + 1 <= 65535 ? hp + 1 : null;
107
+ }
108
+
109
+ /** The field, the one route step, and Check (on the saved address). */
110
+ export function FixedPreviewAddress({ field, hostname, saved, port, placeholder, originPort }) {
111
+ const lease = useLease("fixed-preview-check");
112
+ const [busy, setBusy] = useState(false);
113
+ const [result, setResult] = useState(null);
114
+ const [note, setNote] = useState("");
115
+ const running = useRef(false);
116
+ const host = bareHost(hostname);
117
+ const run = async () => {
118
+ if (running.current) return;
119
+ running.current = true; setBusy(true); setNote(""); setResult(null);
120
+ try {
121
+ // The server knows what is saved (this page's copy may be from before a save): it answers "not-saved" for another.
122
+ const r = await api("/api/settings/public-link/preview-test", { method: "POST", body: JSON.stringify({ hostname: host }) });
123
+ if (!lease.current()) return;
124
+ if (r.status === 409) setNote(tn("pvaBusy"));
125
+ else if (!r.ok || !Array.isArray(r.body?.steps)) setNote(tn("pvaFailed"));
126
+ else setResult(r.body);
127
+ } catch { if (lease.current()) setNote(tn("pvaFailed")); }
128
+ finally { running.current = false; if (lease.current()) setBusy(false); }
129
+ };
130
+ const shown = result?.hostname || host || "—", shownPort = result?.port ?? port ?? "—";
131
+ return html`<div class="fixed-preview" id="publicPreviewAddress">
132
+ ${field}
133
+ <p class="note">${tn("pvaLead")}</p>
134
+ <details class="fixed-preview-steps" open=${!saved}>
135
+ <summary>${tn("pvaStepsTitle")}</summary>
136
+ <ol>
137
+ <li>${tn("pvaStep1")}</li>
138
+ <li>${host ? tn("pvaStep2", host) : tn("pvaStep2Any", placeholder || "preview.agend.example.com")}</li>
139
+ <li>${tn("pvaStep3", port ?? "—", originPort || "19282")}</li>
140
+ <li>${tn("pvaStep4")}</li>
141
+ <li>${tn("pvaStep5")}</li>
142
+ </ol>
143
+ </details>
144
+ <div class="save-row"><button type="button" class="btn btn-sm" id="previewAddressCheck" disabled=${busy || !host} onClick=${run}>${busy ? tn("pvaChecking") : tn("pvaCheck")}</button>${!host ? html`<span class="note fixed-preview-why" id="previewAddressCheckWhy">${tn("pvaNeedsAddress")}</span>` : null}</div>
145
+ ${note ? html`<p class="note" role="status">${note}</p>` : null}
146
+ ${result ? html`<p class="note fixed-preview-result" id="previewAddressResultFor"><strong>${tn("pvaResultFor", shown)}</strong></p>` : null}
147
+ ${result ? html`<ol class="named-test-steps" role="status" aria-live="polite">${STEPS.map((step) => {
148
+ const r = result.steps.find((s) => s.step === step);
149
+ const mark = !r ? "–" : r.ok ? "✓" : "✗";
150
+ // A passed step says it once (its line is the finding); the last one says it works; a failed one says what to do.
151
+ const said = !r ? tn("pvaNotRun") : r.code === "timeout" ? tn("pvaTimeout") : r.ok && step !== "reach" ? "" : tn(`pva_${step}_${r.code}`, shown, shownPort);
152
+ return html`<li key=${step} class=${!r ? "nt-skip" : r.ok ? "nt-ok" : "nt-fail"} data-step=${step} data-code=${r ? r.code : ""}>
153
+ <span class="nt-mark" aria-hidden="true">${mark}</span> <strong>${tn(`pvaStep_${step}`, shown, shownPort)}</strong>${said ? ` — ${said}` : ""}</li>`;
154
+ })}</ol>` : null}
155
+ </div>`;
156
+ }
@@ -124,6 +124,8 @@ const ROWS = [
124
124
  ["access.terminal-ttl", "access", "#webTerminalTtl", "settings.webTerminalTtl", "web_terminal.ttl_minutes", ["terminal minutes", "terminal", "ttl"], ["終端機", "分鐘"]],
125
125
  ["access.public-link", "access", "#publicWebLink", "settings.publicLink", "web.public_link.allow_public", ["public link", "share", "tunnel", "cloudflare", "trycloudflare"], ["公開連結", "分享", "tunnel"]],
126
126
  ["access.hostname", "access", "#publicWebHostname", "settings.namedHostname", "web.public_link.hostname", ["fixed address", "domain", "hostname", "named tunnel", "https"], ["固定網址", "網域", "主機名稱", "具名 tunnel"]],
127
+ // M-3814: shown with a fixed hostname (or while it is set).
128
+ ["access.preview-address", "access", "#publicWebPreviewHostname", null, "web.public_link.preview_hostname", ["preview address", "preview", "html preview", "fixed address", "429"], ["預覽網址", "預覽", "固定網址"], L("Preview address", "預覽網址")],
127
129
  ["access.origin-port", "access", "#publicWebOriginPort", "settings.namedOriginPort", "web.public_link.origin_port", ["port", "origin port", "fixed address"], ["連接埠", "port", "固定網址"]],
128
130
  ["access.public-ttl", "access", "#publicWebTtl", "settings.publicTtl", "web.public_link.ttl_minutes", ["public link minutes", "how long", "ttl", "no expiry", "expire"], ["公開連結", "分鐘", "多久", "不過期", "到期"]],
129
131
  // Shown with a fixed hostname (a named tunnel), or while it is set.