@songsid/agend 2.3.5-alpha.10 → 2.3.5-alpha.11

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 (293) hide show
  1. package/dist/accounts-view.d.ts +14 -0
  2. package/dist/accounts-view.js +22 -6
  3. package/dist/accounts-view.js.map +1 -1
  4. package/dist/agent-cli-instructions.md +2 -2
  5. package/dist/auth-api.d.ts +48 -16
  6. package/dist/auth-api.js +99 -32
  7. package/dist/auth-api.js.map +1 -1
  8. package/dist/authority/settings-role.d.ts +56 -0
  9. package/dist/authority/settings-role.js +48 -0
  10. package/dist/authority/settings-role.js.map +1 -0
  11. package/dist/backend/claude-code.d.ts +2 -0
  12. package/dist/backend/claude-code.js +16 -3
  13. package/dist/backend/claude-code.js.map +1 -1
  14. package/dist/backend/cli-env-probe.js +6 -2
  15. package/dist/backend/cli-env-probe.js.map +1 -1
  16. package/dist/backend/codex.d.ts +5 -3
  17. package/dist/backend/codex.js +31 -13
  18. package/dist/backend/codex.js.map +1 -1
  19. package/dist/backend/credential-profile.d.ts +2 -0
  20. package/dist/backend/credential-profile.js +2 -0
  21. package/dist/backend/credential-profile.js.map +1 -1
  22. package/dist/backend/kiro.js +1 -1
  23. package/dist/backend/kiro.js.map +1 -1
  24. package/dist/backend/types.d.ts +5 -1
  25. package/dist/backend/types.js.map +1 -1
  26. package/dist/backend-availability.d.ts +15 -0
  27. package/dist/backend-availability.js +37 -1
  28. package/dist/backend-availability.js.map +1 -1
  29. package/dist/build-provenance.json +1 -1
  30. package/dist/bundled-tmux-guard.d.ts +4 -0
  31. package/dist/bundled-tmux-guard.js +7 -0
  32. package/dist/bundled-tmux-guard.js.map +1 -1
  33. package/dist/claude-auth-status.d.ts +20 -8
  34. package/dist/claude-auth-status.js +38 -22
  35. package/dist/claude-auth-status.js.map +1 -1
  36. package/dist/cli-audited.d.ts +60 -0
  37. package/dist/cli-audited.js +84 -0
  38. package/dist/cli-audited.js.map +1 -0
  39. package/dist/cli-capability.d.ts +36 -5
  40. package/dist/cli-capability.js +2 -2
  41. package/dist/cli-capability.js.map +1 -1
  42. package/dist/cli-caps-module.d.ts +5 -1
  43. package/dist/cli-caps-module.js +4 -2
  44. package/dist/cli-caps-module.js.map +1 -1
  45. package/dist/cli-registry-check.js +16 -2
  46. package/dist/cli-registry-check.js.map +1 -1
  47. package/dist/cli-registry.d.ts +56 -4
  48. package/dist/cli-registry.js +1 -1
  49. package/dist/cli-registry.js.map +1 -1
  50. package/dist/cli-spec-antigravity.d.ts +12 -1
  51. package/dist/cli-spec-antigravity.js +13 -1
  52. package/dist/cli-spec-antigravity.js.map +1 -1
  53. package/dist/cli-spec-claude-code.d.ts +9 -0
  54. package/dist/cli-spec-claude-code.js +4 -2
  55. package/dist/cli-spec-claude-code.js.map +1 -1
  56. package/dist/cli-spec-codex.d.ts +10 -1
  57. package/dist/cli-spec-codex.js +5 -3
  58. package/dist/cli-spec-codex.js.map +1 -1
  59. package/dist/cli-spec-grok.d.ts +5 -0
  60. package/dist/cli-spec-grok.js +6 -1
  61. package/dist/cli-spec-grok.js.map +1 -1
  62. package/dist/cli-spec-kiro-cli.d.ts +7 -1
  63. package/dist/cli-spec-kiro-cli.js +7 -3
  64. package/dist/cli-spec-kiro-cli.js.map +1 -1
  65. package/dist/cli-spec-muse.d.ts +2 -0
  66. package/dist/cli-spec-muse.js +3 -1
  67. package/dist/cli-spec-muse.js.map +1 -1
  68. package/dist/cli-spec-opencode.d.ts +11 -1
  69. package/dist/cli-spec-opencode.js +7 -2
  70. package/dist/cli-spec-opencode.js.map +1 -1
  71. package/dist/cli.js +28 -1
  72. package/dist/cli.js.map +1 -1
  73. package/dist/daemon.d.ts +3 -0
  74. package/dist/daemon.js +17 -2
  75. package/dist/daemon.js.map +1 -1
  76. package/dist/fleet-context.d.ts +5 -1
  77. package/dist/fleet-manager.d.ts +337 -69
  78. package/dist/fleet-manager.js +1247 -355
  79. package/dist/fleet-manager.js.map +1 -1
  80. package/dist/fleet-process-handlers.d.ts +1 -1
  81. package/dist/fleet-process-handlers.js +3 -2
  82. package/dist/fleet-process-handlers.js.map +1 -1
  83. package/dist/general-knowledge/skills/concepts/SKILL.md +21 -14
  84. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +9 -8
  85. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +9 -1
  86. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +27 -20
  87. package/dist/instance-lifecycle.js +4 -2
  88. package/dist/instance-lifecycle.js.map +1 -1
  89. package/dist/instructions.js +29 -6
  90. package/dist/instructions.js.map +1 -1
  91. package/dist/locale.js +119 -75
  92. package/dist/locale.js.map +1 -1
  93. package/dist/login-manager.d.ts +2 -2
  94. package/dist/login-manager.js +3 -2
  95. package/dist/login-manager.js.map +1 -1
  96. package/dist/native-model-catalog.d.ts +20 -0
  97. package/dist/native-model-catalog.js +107 -2
  98. package/dist/native-model-catalog.js.map +1 -1
  99. package/dist/public-web-gateway.js +1 -1
  100. package/dist/public-web-gateway.js.map +1 -1
  101. package/dist/runtime-api.d.ts +1 -1
  102. package/dist/runtime-api.js +104 -12
  103. package/dist/runtime-api.js.map +1 -1
  104. package/dist/runtime-autostart.d.ts +61 -0
  105. package/dist/runtime-autostart.js +161 -0
  106. package/dist/runtime-autostart.js.map +1 -0
  107. package/dist/runtime-background.d.ts +200 -0
  108. package/dist/runtime-background.js +480 -0
  109. package/dist/runtime-background.js.map +1 -0
  110. package/dist/runtime-build-info.js +5 -5
  111. package/dist/runtime-build-info.js.map +1 -1
  112. package/dist/runtime-cli-background.d.ts +92 -0
  113. package/dist/runtime-cli-background.js +336 -0
  114. package/dist/runtime-cli-background.js.map +1 -0
  115. package/dist/runtime-cli-install.d.ts +148 -8
  116. package/dist/runtime-cli-install.js +253 -59
  117. package/dist/runtime-cli-install.js.map +1 -1
  118. package/dist/runtime-cli.d.ts +8 -1
  119. package/dist/runtime-cli.js +206 -44
  120. package/dist/runtime-cli.js.map +1 -1
  121. package/dist/runtime-client-store.d.ts +11 -0
  122. package/dist/runtime-client-store.js +20 -5
  123. package/dist/runtime-client-store.js.map +1 -1
  124. package/dist/runtime-client.d.ts +23 -1
  125. package/dist/runtime-client.js +92 -6
  126. package/dist/runtime-client.js.map +1 -1
  127. package/dist/runtime-connection.d.ts +1 -1
  128. package/dist/runtime-connection.js +1 -1
  129. package/dist/runtime-connection.js.map +1 -1
  130. package/dist/runtime-coordinator.d.ts +95 -1
  131. package/dist/runtime-coordinator.js +344 -10
  132. package/dist/runtime-coordinator.js.map +1 -1
  133. package/dist/runtime-enroll-notice.d.ts +4 -0
  134. package/dist/runtime-enroll-notice.js +21 -0
  135. package/dist/runtime-enroll-notice.js.map +1 -0
  136. package/dist/runtime-enrollment.d.ts +21 -0
  137. package/dist/runtime-enrollment.js +52 -0
  138. package/dist/runtime-enrollment.js.map +1 -0
  139. package/dist/runtime-pane-native.js +4 -4
  140. package/dist/runtime-pane-native.js.map +1 -1
  141. package/dist/runtime-protocol.d.ts +78 -1
  142. package/dist/runtime-protocol.js +95 -5
  143. package/dist/runtime-protocol.js.map +1 -1
  144. package/dist/runtime-remote-accounts.d.ts +12 -0
  145. package/dist/runtime-remote-accounts.js +56 -5
  146. package/dist/runtime-remote-accounts.js.map +1 -1
  147. package/dist/runtime-remote-setup.d.ts +4 -1
  148. package/dist/runtime-remote-setup.js +4 -1
  149. package/dist/runtime-remote-setup.js.map +1 -1
  150. package/dist/runtime-update-controller.d.ts +11 -0
  151. package/dist/runtime-update-controller.js +56 -4
  152. package/dist/runtime-update-controller.js.map +1 -1
  153. package/dist/settings-api.d.ts +13 -1
  154. package/dist/settings-api.js +39 -3
  155. package/dist/settings-api.js.map +1 -1
  156. package/dist/settings-change.d.ts +5 -13
  157. package/dist/settings-change.js.map +1 -1
  158. package/dist/settings-confirmation.d.ts +11 -13
  159. package/dist/settings-confirmation.js +2 -6
  160. package/dist/settings-confirmation.js.map +1 -1
  161. package/dist/settings-effect.d.ts +5 -0
  162. package/dist/settings-effect.js +76 -10
  163. package/dist/settings-effect.js.map +1 -1
  164. package/dist/settings-http-confirmation.d.ts +8 -1
  165. package/dist/settings-http-confirmation.js +39 -13
  166. package/dist/settings-http-confirmation.js.map +1 -1
  167. package/dist/settings-request-capability.d.ts +7 -0
  168. package/dist/settings-request-capability.js +3 -1
  169. package/dist/settings-request-capability.js.map +1 -1
  170. package/dist/setup-i18n.js +4 -4
  171. package/dist/setup-i18n.js.map +1 -1
  172. package/dist/subagent-records.d.ts +45 -0
  173. package/dist/subagent-records.js +214 -0
  174. package/dist/subagent-records.js.map +1 -0
  175. package/dist/subagent-service.d.ts +27 -0
  176. package/dist/subagent-service.js +199 -0
  177. package/dist/subagent-service.js.map +1 -0
  178. package/dist/tmux-manager.d.ts +2 -2
  179. package/dist/tmux-manager.js +5 -3
  180. package/dist/tmux-manager.js.map +1 -1
  181. package/dist/ui/account-identity.js +7 -5
  182. package/dist/ui/accounts-keepalive.js +17 -17
  183. package/dist/ui/accounts-manage.js +34 -34
  184. package/dist/ui/accounts-view.js +63 -21
  185. package/dist/ui/agent-runtime-settings.js +1 -1
  186. package/dist/ui/backend-signin.js +67 -67
  187. package/dist/ui/chat-msg-actions.js +50 -4
  188. package/dist/ui/chat-quote.js +256 -0
  189. package/dist/ui/chat-store.js +9 -4
  190. package/dist/ui/cli-caps.js +7 -7
  191. package/dist/ui/credential-profile-select.js +4 -4
  192. package/dist/ui/general-location.js +1 -1
  193. package/dist/ui/host-install.js +290 -0
  194. package/dist/ui/hub-company-join-strings.js +3 -0
  195. package/dist/ui/hub-company-join.js +20 -2
  196. package/dist/ui/hub-owner-strings.js +5 -4
  197. package/dist/ui/hub-pairing-progress-strings.js +1 -1
  198. package/dist/ui/hub-quick-strings.js +4 -4
  199. package/dist/ui/machine-signin.js +4 -4
  200. package/dist/ui/model-picker.js +68 -0
  201. package/dist/ui/panel-chat.js +73 -13
  202. package/dist/ui/panel-fleet.js +1 -1
  203. package/dist/ui/panel-hub.js +8 -4
  204. package/dist/ui/panel-needs.js +2 -2
  205. package/dist/ui/panel-runtimes.js +232 -33
  206. package/dist/ui/panel-windows-cli.js +1 -1
  207. package/dist/ui/runtime-cli-install.js +99 -20
  208. package/dist/ui/runtime-commands.d.ts +2 -0
  209. package/dist/ui/runtime-commands.js +34 -1
  210. package/dist/ui/runtime-update-status.js +2 -2
  211. package/dist/ui/search-dialog.js +1 -0
  212. package/dist/ui/settings-access-strings.js +1 -1
  213. package/dist/ui/settings-catalog.js +19 -3
  214. package/dist/ui/settings-confirm.js +2 -2
  215. package/dist/ui/settings-devices.js +59 -25
  216. package/dist/ui/settings-dialogs.js +12 -13
  217. package/dist/ui/settings-guests.js +1 -1
  218. package/dist/ui/settings-hub-company-join.js +10 -7
  219. package/dist/ui/settings-hub-connection.js +121 -0
  220. package/dist/ui/settings-hub-membership.js +1 -1
  221. package/dist/ui/settings-hub-run.js +5 -6
  222. package/dist/ui/settings-hub-section.js +3 -6
  223. package/dist/ui/settings-hub.js +12 -7
  224. package/dist/ui/settings-layout.js +6 -6
  225. package/dist/ui/settings-outside.js +87 -19
  226. package/dist/ui/settings-registry.js +2 -1
  227. package/dist/ui/settings-revoke-strings.js +28 -0
  228. package/dist/ui/settings-strings.js +19 -19
  229. package/dist/ui/settings-web-authority.js +11 -4
  230. package/dist/ui/shared/accounts.css +11 -1
  231. package/dist/ui/shared/agend-auth.js +8 -1
  232. package/dist/ui/shared/app-i18n.js +10 -12
  233. package/dist/ui/shared/app-session.js +13 -16
  234. package/dist/ui/shared/app-shell.js +36 -36
  235. package/dist/ui/shared/app.css +35 -2
  236. package/dist/ui/shared/chat-strings.js +4 -4
  237. package/dist/ui/shared/device-roles.js +27 -0
  238. package/dist/ui/shared/host-install.css +10 -0
  239. package/dist/ui/shared/hub-owner.css +6 -0
  240. package/dist/ui/shared/model-picker.css +21 -0
  241. package/dist/ui/shared/runtime-install.css +26 -1
  242. package/dist/ui/shared/setup-host-text.js +4 -4
  243. package/dist/ui/shared/signin-authenticator.js +60 -0
  244. package/dist/ui/shared/signin.js +45 -25
  245. package/dist/ui/shared/subagent-row.css +15 -0
  246. package/dist/ui/shared/usage-dialog.js +1 -1
  247. package/dist/ui/shared/view-strings.js +7 -7
  248. package/dist/ui/shared/web-authorize.js +53 -3
  249. package/dist/ui/signin-authenticator.html +60 -0
  250. package/dist/ui/structured-signin.js +30 -30
  251. package/dist/ui/subagent-row.js +72 -0
  252. package/dist/ui/web-terminal/terminal.js +9 -9
  253. package/dist/update-launch.js +4 -1
  254. package/dist/update-launch.js.map +1 -1
  255. package/dist/update-npm-env.d.ts +70 -0
  256. package/dist/update-npm-env.js +128 -0
  257. package/dist/update-npm-env.js.map +1 -0
  258. package/dist/usage/providers.js +2 -2
  259. package/dist/usage/providers.js.map +1 -1
  260. package/dist/web-api.d.ts +33 -4
  261. package/dist/web-api.js +312 -18
  262. package/dist/web-api.js.map +1 -1
  263. package/dist/web-auth.js +1 -1
  264. package/dist/web-auth.js.map +1 -1
  265. package/dist/web-channel-echo.js +3 -1
  266. package/dist/web-channel-echo.js.map +1 -1
  267. package/dist/web-commands.d.ts +9 -1
  268. package/dist/web-commands.js +7 -1
  269. package/dist/web-commands.js.map +1 -1
  270. package/dist/web-host-install.d.ts +127 -0
  271. package/dist/web-host-install.js +165 -0
  272. package/dist/web-host-install.js.map +1 -0
  273. package/dist/web-remote-access.d.ts +126 -11
  274. package/dist/web-remote-access.js +267 -34
  275. package/dist/web-remote-access.js.map +1 -1
  276. package/dist/web-session.d.ts +11 -3
  277. package/dist/web-session.js.map +1 -1
  278. package/dist/web-signin-device.d.ts +16 -0
  279. package/dist/web-signin-device.js +81 -0
  280. package/dist/web-signin-device.js.map +1 -0
  281. package/dist/web-update.js +3 -1
  282. package/dist/web-update.js.map +1 -1
  283. package/dist/windows-cli-api.js +2 -1
  284. package/dist/windows-cli-api.js.map +1 -1
  285. package/dist/windows-cli-worker.d.ts +14 -0
  286. package/dist/windows-cli-worker.js +145 -1
  287. package/dist/windows-cli-worker.js.map +1 -1
  288. package/dist/windows-cli.d.ts +4 -0
  289. package/dist/windows-cli.js +9 -1
  290. package/dist/windows-cli.js.map +1 -1
  291. package/launcher/agend-install.cjs +16 -3
  292. package/package.json +1 -1
  293. package/templates/runtime-install/install.ps1 +219 -12
@@ -19,105 +19,105 @@ import { FIRST_RUN_BACKENDS, capsOf } from "./cli-caps.js";
19
19
 
20
20
  register("signin", {
21
21
  en: {
22
- title: "Sign in to {0}",
23
- checking: "Checking whether {0} is signed in…",
24
- confirmDevice: "AgEnD runs {0}'s own sign-in on this machine. You get a link and a one-time code here, to finish in your browser.",
25
- confirmTerminal: "AgEnD runs {0}'s own sign-in on this machine and opens it as a terminal in your browser (only that sign-in, no shell). You get the link and a one-time access code here.",
26
- stillSignedIn: "It is still signed in: signing in again replaces that login.",
27
- logoutFirst: "It signs out first ({0}), then in.",
28
- publicNote: "Not at this machine? A temporary public link opens the terminal from anywhere, for this sign-in only.",
29
- go: "Sign in",
22
+ title: "Connect an AI account: {0}",
23
+ checking: "Checking whether your {0} account is connected…",
24
+ confirmDevice: "AgEnD starts {0}'s own authorization on this machine. You get a link and an authorization code here: finish on {0}'s official website.",
25
+ confirmTerminal: "AgEnD starts {0}'s own authorization on this machine and opens it as a terminal in your browser (only that authorization, no shell). You get the link and a one-time access code here.",
26
+ stillSignedIn: "It is still connected: connecting again replaces that connection.",
27
+ logoutFirst: "It disconnects first ({0}), then connects again.",
28
+ publicNote: "Not at this machine? A temporary public link opens the terminal from anywhere, for this authorization only.",
29
+ go: "Connect",
30
30
  goPublic: "Use a temporary public link",
31
31
  cancel: "Cancel",
32
32
  close: "Close",
33
33
  starting: "Starting…",
34
- deviceStep: "Open this page and enter the code:",
35
- linkStep: "Open this page to sign in; if it gives you a code, paste it into the sign-in terminal:",
36
- terminalStep: "Open the sign-in terminal and enter this access code there. It works once, for {0} minutes.",
37
- openTerminal: "Open the sign-in terminal",
34
+ deviceStep: "Finish on the provider's official website: open this page and enter the authorization code:",
35
+ linkStep: "Open this page to authorize on the provider's official website; if it gives you an authorization code, paste it into the authorization terminal:",
36
+ terminalStep: "Open the authorization terminal and enter this access code there. It works once, for {0} minutes.",
37
+ openTerminal: "Open the authorization terminal",
38
38
  accessCode: "Access code",
39
- code: "Code",
39
+ code: "Authorization code",
40
40
  copy: "Copy",
41
41
  copied: "Copied",
42
- publicLink: "Public link: anyone with the link and the code could use it — keep both to yourself.",
42
+ publicLink: "Public link: anyone with the link and the access code could use it — keep both to yourself.",
43
43
  loopback: "This terminal listens on the machine's own address only. Open it on that machine, or set web_terminal.bind for your network.",
44
- waitingHint: "Waiting for the sign-in to show its link…",
45
- signedIn: "{0} is signed in.",
46
- ended: "The sign-in ended.",
47
- cancelSignIn: "Cancel sign-in",
48
- cancelled: "Sign-in cancelled.",
49
- running: "Signing in to {0} (started on {1}).",
44
+ waitingHint: "Waiting for the provider's authorization link…",
45
+ signedIn: "Your {0} account is connected.",
46
+ ended: "The authorization ended.",
47
+ cancelSignIn: "Cancel connecting",
48
+ cancelled: "Connecting cancelled.",
49
+ running: "Connecting your {0} account (started on {1}).",
50
50
  open: "Open",
51
51
  expired: "That took too long — start again.",
52
- notHere: "Signing in is not available over the public link. Open the dashboard on the machine running AgEnD, or use /login in your chat.",
53
- notAdmin: "Only a fleet admin signed in on this machine or its network can sign a backend in.",
54
- notOffered: "A public link is not offered for this sign-in.",
52
+ notHere: "Connecting an AI account is not available over the public link. Open the dashboard on the machine running AgEnD, or use /login in your chat.",
53
+ notAdmin: "Only a fleet admin signed in on this machine or its network can connect an AI account.",
54
+ notOffered: "A public link is not offered for this authorization.",
55
55
  failed: "That did not work.",
56
- listTitle: "Sign-ins",
57
- browserRunning: "Signing in to {0} on this machine",
56
+ listTitle: "AI accounts",
57
+ browserRunning: "Connecting your {0} account on this machine",
58
58
  consoleFallback: "Use console fallback",
59
- defaultAccount: "Default sign-in",
60
- listHint: "Each backend's login on this machine, and each credential profile an agent uses.",
61
- stUsable: "signed in",
62
- stNotSignedIn: "not signed in",
59
+ defaultAccount: "Default connection",
60
+ listHint: "Connect AI accounts: each AI account connected on this machine, and each credential profile an agent uses. Connecting finishes on the provider's official website.",
61
+ stUsable: "connected",
62
+ stNotSignedIn: "not connected",
63
63
  stNotInstalled: "not installed",
64
64
  stTooOld: "too old",
65
65
  stUnknown: "not checked",
66
- signIn: "Sign in",
67
- signInAgain: "Sign in again",
68
- onHost: "Sign in on the machine: {0}",
66
+ signIn: "Connect account",
67
+ signInAgain: "Reconnect",
68
+ onHost: "Connect on the machine: {0}",
69
69
  install: "Install on the machine: {0}",
70
70
  update: "Update on the machine: {0}",
71
71
  profile: "{0} · profile {1}",
72
72
  },
73
73
  "zh-TW": {
74
- title: "登入 {0}",
75
- checking: "正在確認 {0} 是否已登入…",
76
- confirmDevice: "AgEnD 會在這台機器上執行 {0} 自己的登入。這裡會給你一個連結和一次性代碼,在瀏覽器完成登入。",
77
- confirmTerminal: "AgEnD 會在這台機器上執行 {0} 自己的登入,並在瀏覽器以終端機開啟(只有這個登入,沒有 shell)。這裡會給你連結和一次性存取碼。",
78
- stillSignedIn: "它目前仍是登入狀態:重新登入會取代原本的登入。",
79
- logoutFirst: "會先登出({0}),再登入。",
80
- publicNote: "不在這台機器前?臨時公開連結可以從任何地方開啟終端機,只用於這次登入。",
81
- go: "登入",
74
+ title: "連接 AI 帳號:{0}",
75
+ checking: "正在確認 {0} 帳號是否已連接…",
76
+ confirmDevice: "AgEnD 會在這台機器上啟動 {0} 自己的授權流程。這裡會給你一個連結和授權碼,請前往 {0} 官方網站完成授權。",
77
+ confirmTerminal: "AgEnD 會在這台機器上啟動 {0} 自己的授權流程,並在瀏覽器以終端機開啟(只有這個授權流程,沒有 shell)。這裡會給你連結和一次性存取碼。",
78
+ stillSignedIn: "目前仍是連接狀態:重新連接會取代原本的連接。",
79
+ logoutFirst: "會先撤銷連接({0}),再重新連接。",
80
+ publicNote: "不在這台機器前?臨時公開連結可以從任何地方開啟終端機,只用於這次授權。",
81
+ go: "連接",
82
82
  goPublic: "使用臨時公開連結",
83
83
  cancel: "取消",
84
84
  close: "關閉",
85
85
  starting: "啟動中…",
86
- deviceStep: "開啟這個頁面並輸入代碼:",
87
- linkStep: "開啟這個頁面登入;如果它給你一組代碼,請貼到登入終端機:",
88
- terminalStep: "開啟登入終端機,在那裡輸入這個存取碼。只能用一次,{0} 分鐘內有效。",
89
- openTerminal: "開啟登入終端機",
86
+ deviceStep: "前往官方網站完成授權:開啟這個頁面,輸入授權碼:",
87
+ linkStep: "開啟這個頁面,在官方網站完成授權;如果網站給你一組授權碼,請貼到授權終端機:",
88
+ terminalStep: "開啟授權終端機,在那裡輸入這個存取碼。只能用一次,{0} 分鐘內有效。",
89
+ openTerminal: "開啟授權終端機",
90
90
  accessCode: "存取碼",
91
- code: "代碼",
91
+ code: "授權碼",
92
92
  copy: "複製",
93
93
  copied: "已複製",
94
- publicLink: "公開連結:拿到連結和代碼的人都能使用——兩者都只留給自己。",
94
+ publicLink: "公開連結:拿到連結和存取碼的人都能使用——兩者都只留給自己。",
95
95
  loopback: "這個終端機只在本機位址上接聽。請在那台機器上開啟,或為你的網路設定 web_terminal.bind。",
96
- waitingHint: "等待登入顯示連結…",
97
- signedIn: "{0} 已登入。",
98
- ended: "登入已結束。",
99
- cancelSignIn: "取消登入",
100
- cancelled: "已取消登入。",
101
- running: "正在登入 {0}(從 {1} 啟動)。",
96
+ waitingHint: "等待官方網站的授權連結…",
97
+ signedIn: "{0} 帳號已連接。",
98
+ ended: "授權流程已結束。",
99
+ cancelSignIn: "取消連接",
100
+ cancelled: "已取消連接。",
101
+ running: "正在連接 {0} 帳號(從 {1} 啟動)。",
102
102
  open: "開啟",
103
103
  expired: "等太久了——請重新開始。",
104
- notHere: "公開連結上不能登入。請在執行 AgEnD 的機器上開啟儀表板,或在聊天裡用 /login。",
105
- notAdmin: "只有在這台機器或它的網路上登入的 fleet 管理員,才能讓後端登入。",
106
- notOffered: "這次登入不提供公開連結。",
104
+ notHere: "公開連結上不能連接 AI 帳號。請在執行 AgEnD 的機器上開啟儀表板,或在聊天裡用 /login。",
105
+ notAdmin: "只有在這台機器或它的網路上登入的 fleet 管理員,才能連接 AI 帳號。",
106
+ notOffered: "這次授權不提供公開連結。",
107
107
  failed: "沒有成功。",
108
- listTitle: "登入",
109
- browserRunning: "正在這台機器登入 {0}",
108
+ listTitle: "AI 帳號",
109
+ browserRunning: "正在這台機器連接 {0} 帳號",
110
110
  consoleFallback: "改用主控台備援",
111
- defaultAccount: "預設登入",
112
- listHint: "這台機器上每個 backend 的登入,以及 Agent 使用的每個憑證設定檔。",
113
- stUsable: "已登入",
114
- stNotSignedIn: "未登入",
111
+ defaultAccount: "預設連接",
112
+ listHint: "連接 AI 帳號:這台機器上連接的每個 AI 帳號,以及 Agent 使用的每個憑證設定檔。連接時會前往供應商官方網站完成授權。",
113
+ stUsable: "已連接",
114
+ stNotSignedIn: "未連接",
115
115
  stNotInstalled: "未安裝",
116
116
  stTooOld: "版本太舊",
117
117
  stUnknown: "未檢查",
118
- signIn: "登入",
119
- signInAgain: "重新登入",
120
- onHost: "在機器上登入:{0}",
118
+ signIn: "連接帳號",
119
+ signInAgain: "重新連接",
120
+ onHost: "在機器上連接:{0}",
121
121
  install: "在機器上安裝:{0}",
122
122
  update: "在機器上更新:{0}",
123
123
  profile: "{0} · 設定檔 {1}",
@@ -172,7 +172,7 @@ export function installerSignInBackends(search) {
172
172
 
173
173
  /**
174
174
  * #3212: which backends' NAMED accounts the dashboard signs in with the structured controls (Sign in → open the page → paste the code), as the default account is.
175
- * The registry's `host.dashboardSignIn.named` (a login screen that was checked under a relocated home, with these controls; cli-caps.js: `structuredNamedSignIn`); another backend's named account keeps the older
175
+ * The registry's `host.structuredSignIn.named` (a login screen checked under a relocated home with these controls; cli-caps.js: `structuredNamedSignIn`); another backend's named account keeps the older
176
176
  * dialog, which says what to run on the machine (or, where the host signs it in from the dashboard, runs it in the web terminal).
177
177
  */
178
178
  /** One named account's sign-in controls on this host (the same endpoint as the default account's, addressed by `?backend=&profile=`). */
@@ -421,6 +421,6 @@ export function SignInList() {
421
421
 
422
422
  // Ridge #3321 S01: "Sign in again" — the dashboard's confirmation, titled with the CLI it is for.
423
423
  register("signin", {
424
- en: { reloginTitle: "Sign in to {0} again", reloginGo: "Sign in again" },
425
- "zh-TW": { reloginTitle: "重新登入 {0}", reloginGo: "重新登入" },
424
+ en: { reloginTitle: "Reconnect {0}", reloginGo: "Reconnect" },
425
+ "zh-TW": { reloginTitle: "重新連接 {0}", reloginGo: "重新連接" },
426
426
  });
@@ -4,7 +4,12 @@
4
4
  // - Right-click on a message opens Reply / Copy text / Copy link. Shift+right-click, a right-click with text selected,
5
5
  // or one on a link, an image or a field keeps the browser's own menu.
6
6
  // - A long press (500 ms without moving) opens the same menu; the click and the browser menu it would also cause are
7
- // swallowed.
7
+ // swallowed. M-2789 (the leader's ruling A, "text wins on text"): a long press on a message's WORDS, or one when a
8
+ // selection has already started inside the message, is the browser's — it selects text (then the 「引用」 pill,
9
+ // chat-quote.js); the menu still opens from a long press anywhere else on the message (its padding, header, an empty
10
+ // part of the bubble). Android starts its selection only after contextmenu's own default, so the press's place
11
+ // decides, not only a selection already made. Native long-press selection can't be shown headless: confirmed on a
12
+ // real phone before a beta.
8
13
  // - Swipe left on a message: it follows the finger (up to 64 px); let go past 56 px and it is a reply. A mostly
9
14
  // vertical move is scrolling, never a reply. A swipe right is the phone drawer's (app-swipe.js), on a message too: the
10
15
  // two never fight.
@@ -12,7 +17,41 @@
12
17
  // order); Escape closes the menu.
13
18
 
14
19
  const LONG_PRESS_MS = 500, MOVE_TOLERANCE = 10, SWIPE_REPLY_PX = 56, SWIPE_MAX_PX = 64;
20
+ /** How long after a touch on a message's words its contextmenu is still that press's (the browser's selection). */
21
+ const WORDS_PRESS_MS = 1500;
22
+ const clock = () => (typeof performance !== "undefined" && performance.now ? performance.now() : Date.now());
15
23
 
24
+ /**
25
+ * On a message's own words: the press at (x, y) lands on a glyph of its rendered text — not on the blank part of a
26
+ * line, its padding, its header or its action strip (a paragraph's box is wider than a short line's glyphs: #3555
27
+ * review P2-2). The browser's own hit test (caretPositionFromPoint / caretRangeFromPoint), then the glyph's box
28
+ * beside that caret; without either API, not words (the menu, as before).
29
+ */
30
+ const GLYPH_SLACK = 2;
31
+ function onWords(target, x, y, doc) {
32
+ const e = target && (target.nodeType === 1 ? target : target.parentElement);
33
+ const md = e && e.closest ? e.closest(".msg[data-key] .md") : null;
34
+ if (!md || e.closest(".meta, .msg-actions") || !Number.isFinite(x) || !Number.isFinite(y)) return false;
35
+ let node = null, offset = 0;
36
+ if (typeof doc.caretPositionFromPoint === "function") { const p = doc.caretPositionFromPoint(x, y); if (p) { node = p.offsetNode; offset = p.offset; } }
37
+ else if (typeof doc.caretRangeFromPoint === "function") { const r = doc.caretRangeFromPoint(x, y); if (r) { node = r.startContainer; offset = r.startOffset; } }
38
+ if (!node || node.nodeType !== 3 || !md.contains(node) || typeof doc.createRange !== "function") return false;
39
+ // The caret sits between two characters: the press is on words when the glyph before or after it holds the point.
40
+ for (const at of [offset - 1, offset]) {
41
+ if (at < 0 || at >= node.data.length || !node.data[at].trim()) continue;
42
+ const rg = doc.createRange(); rg.setStart(node, at); rg.setEnd(node, at + 1);
43
+ for (const b of rg.getClientRects()) {
44
+ if (x >= b.left - GLYPH_SLACK && x <= b.right + GLYPH_SLACK && y >= b.top - GLYPH_SLACK && y <= b.bottom + GLYPH_SLACK) return true;
45
+ }
46
+ }
47
+ return false;
48
+ }
49
+ /** A selection already started inside `el` (a message): the browser's, never ours. */
50
+ function selectionIn(el, doc) {
51
+ const sel = doc.getSelection ? doc.getSelection() : null;
52
+ if (!sel || sel.isCollapsed || !String(sel).trim()) return false;
53
+ return !!((sel.anchorNode && el.contains(sel.anchorNode)) || (sel.focusNode && el.contains(sel.focusNode)));
54
+ }
16
55
  /** The message element an event is on (a person's or an agent's message of this thread), or null. */
17
56
  function messageEl(list, target) {
18
57
  const el = target && target.closest ? target.closest(".msg[data-key]") : null;
@@ -34,7 +73,7 @@ function keepsNativeMenu(e, doc) {
34
73
  */
35
74
  export function installMessageActions(list, deps) {
36
75
  const doc = list.ownerDocument, win = doc.defaultView;
37
- let menu = null, press = null, swipe = null, swallowClick = false;
76
+ let menu = null, press = null, swipe = null, swallowClick = false, wordsPressAt = -Infinity;
38
77
 
39
78
  function closeMenu() {
40
79
  if (!menu) return;
@@ -88,6 +127,8 @@ export function installMessageActions(list, deps) {
88
127
  cancelPress(); // Android's long press fires this itself: one menu
89
128
  const el = messageEl(list, e.target);
90
129
  if (!el || keepsNativeMenu(e, doc)) return;
130
+ // M-2789: a long press on the words (or a selection begun in this message) is the browser's — its selection.
131
+ if (selectionIn(el, doc) || (clock() - wordsPressAt < WORDS_PRESS_MS && onWords(e.target, e.clientX, e.clientY, doc))) return;
91
132
  const row = deps.messageOf(el.dataset.key);
92
133
  if (!row) return;
93
134
  e.preventDefault();
@@ -117,9 +158,14 @@ export function installMessageActions(list, deps) {
117
158
  if (!el) return;
118
159
  const t0 = e.touches[0];
119
160
  const native = keepsNativeMenu({ target: e.target, shiftKey: false }, doc); // a link, an image, code: the browser's
120
- press = native ? null : { el, x: t0.clientX, y: t0.clientY, timer: setTimeout(() => {
161
+ // M-2789: a press on the message's words is the browser's text selection, not our menu (swipe-left Reply stays).
162
+ const words = onWords(e.target, t0.clientX, t0.clientY, doc);
163
+ wordsPressAt = words ? clock() : -Infinity;
164
+ press = native || words ? null : { el, x: t0.clientX, y: t0.clientY, timer: setTimeout(() => {
121
165
  const row = deps.messageOf(el.dataset.key);
122
- press = null; cancelSwipe();
166
+ press = null;
167
+ if (selectionIn(el, doc)) return; // a selection has started here: it stays the browser's
168
+ cancelSwipe();
123
169
  if (!row) return;
124
170
  swallowClick = true; setTimeout(() => { swallowClick = false; }, 700);
125
171
  openMenu(row, t0.clientX, t0.clientY);
@@ -0,0 +1,256 @@
1
+ // M-2789 (the user, 11-09): answer a long, multi-part message passage by passage. Select text in ONE message of the thread
2
+ // → a small 「引用」 pill → the passage goes into the composer as a Markdown quote ("> …") at the caret, on its own lines,
3
+ // the caret left on the next line for the answer. Repeatable: quote, answer, quote the next passage, answer…
4
+ //
5
+ // - Desktop: the pill is anchored to where the selection ends (a pointer at the exact spot), above that line — or below
6
+ // it when that covers less of the neighbouring lines' text (the passage itself never counts). After a quote the
7
+ // composer takes the focus.
8
+ // - Phone (a coarse pointer): the pill 「引用選取的文字」 docks above the composer's whole box inside the 16-px gutter — clear
9
+ // of the system's own copy toolbar (above a selection) and of the finger — or at the top of the thread when the
10
+ // passage sits there. The keyboard does NOT open after a quote (the user's choice): more passages can be selected;
11
+ // the composer's own scroller shows the caret and the newest quote.
12
+ // - No pill for a selection across messages, outside the thread, or on a page that can't send; no keyboard shortcut
13
+ // (the user's choice). The whole-message Reply (#2272) is unchanged, and so is the browser's menu on selected text.
14
+ // - What is sent is the composer's text as typed: the agent reads the "> " lines as written; the web renders them as
15
+ // blockquotes (chat-render.js); Discord's mirror shows them as quotes, Telegram's as the same plain lines.
16
+ //
17
+ // Its own words and drawing (a page that loaded an older chat-strings.js or ui-icons.js still draws it), CSSOM only
18
+ // (no style attribute: #1300), the shared popover look (.msg-menu) with the shared border and shadow tokens.
19
+ import { register, t } from "/assets/app-i18n.js";
20
+
21
+ register("chatQuote", {
22
+ en: { quote: "Quote", quotePhone: "Quote selection", label: "Quote the selected text in your message" },
23
+ "zh-TW": { quote: "引用", quotePhone: "引用選取的文字", label: "把選取的文字引用到你的訊息裡" },
24
+ });
25
+ const tq = (k) => t(`chatQuote.${k}`);
26
+
27
+ /**
28
+ * Where the person's caret was in the composer when it last lost the focus — what a quote goes in at. A field's own
29
+ * selectionStart can't be trusted after the page's selection moved into the thread (Chrome resets it), so it is kept
30
+ * here, with the text it belongs to (a caret for another text is no caret).
31
+ */
32
+ const remembered = new WeakMap();
33
+ export function composerCaret(field, value) {
34
+ if (!field) return value.length;
35
+ const r = remembered.get(field);
36
+ if (r && r.value === value) return r.caret;
37
+ const doc = field.ownerDocument;
38
+ if (doc && doc.activeElement === field && field.value === value) return field.selectionStart ?? value.length;
39
+ return value.length;
40
+ }
41
+
42
+ /** The passage as Markdown quote lines: each line "> line" (an empty one "> " keeps the quote one block). */
43
+ export function quoteBlock(text) {
44
+ const lines = String(text ?? "").replace(/\r\n?/g, "\n").replace(/ /g, " ").split("\n").map((l) => l.replace(/\s+$/, ""));
45
+ while (lines.length && !lines[0].trim()) lines.shift();
46
+ while (lines.length && !lines[lines.length - 1].trim()) lines.pop();
47
+ // A run of empty lines inside the passage becomes one quoted empty line.
48
+ const out = [];
49
+ for (const l of lines) { if (!l.trim() && out.length && out[out.length - 1] === ">") continue; out.push(l.trim() ? `> ${l}` : ">"); }
50
+ return out.join("\n");
51
+ }
52
+
53
+ /**
54
+ * Put the passage into `value` at `caret`, on its own lines: a blank line before it when text precedes on the line or
55
+ * just above, the caret on the line after it (for the answer), and a line break before any text that follows.
56
+ * Returns { value, caret }, or null for a passage with nothing to quote.
57
+ */
58
+ export function insertQuote(value, caret, text) {
59
+ const block = quoteBlock(text);
60
+ if (!block) return null;
61
+ const v = String(value ?? "");
62
+ const at = Math.max(0, Math.min(Number.isInteger(caret) ? caret : v.length, v.length));
63
+ const before = v.slice(0, at), after = v.slice(at);
64
+ const lead = !before ? "" : before.endsWith("\n\n") ? "" : before.endsWith("\n") ? "\n" : "\n\n";
65
+ const head = before + lead + block + "\n";
66
+ // Text after the caret starts its own line below the answer's (its leading spaces dropped with the break).
67
+ const tail = after && !after.startsWith("\n") ? "\n" + after.replace(/^[ \t]+/, "") : after;
68
+ return { value: head + tail, caret: head.length };
69
+ }
70
+
71
+ /** The selected passage when it lies inside one message's text of `list`, else null. { text, el, rects }. */
72
+ export function selectedPassage(list, sel) {
73
+ if (!sel || sel.isCollapsed || !sel.rangeCount) return null;
74
+ const text = String(sel.toString() || "");
75
+ if (!text.trim()) return null;
76
+ const msg = (n) => { const e = n && (n.nodeType === 1 ? n : n.parentElement); return e && e.closest ? e.closest(".msg[data-key]") : null; };
77
+ // The message's own words, not its header (sender, time) or its action strip.
78
+ const inBody = (n) => { const e = n && (n.nodeType === 1 ? n : n.parentElement); return !!(e && e.closest && e.closest(".body, .md") && !e.closest(".meta, .msg-actions")); };
79
+ // Every range of the selection (a browser may keep several: #3555 review P3) in the same message's words — what is
80
+ // quoted is the whole selection's text.
81
+ const range = sel.getRangeAt(0), a = msg(range.startContainer);
82
+ if (!a || !list.contains(a)) return null;
83
+ for (let i = 0; i < sel.rangeCount; i++) {
84
+ const rg = sel.getRangeAt(i);
85
+ if (msg(rg.startContainer) !== a || msg(rg.endContainer) !== a || !inBody(rg.startContainer) || !inBody(rg.endContainer)) return null;
86
+ }
87
+ return { text, el: a, range };
88
+ }
89
+
90
+ /**
91
+ * Where the composer's caret sits, in px from the top of its text (a mirror of the field's text box up to the caret).
92
+ * Used to show the caret without focusing the field (a phone: the keyboard stays down).
93
+ */
94
+ export function caretTop(field, pos) {
95
+ const doc = field.ownerDocument, win = doc.defaultView;
96
+ if (!win || !win.getComputedStyle) return 0;
97
+ const cs = win.getComputedStyle(field);
98
+ const m = doc.createElement("div");
99
+ for (const p of ["box-sizing", "width", "padding-top", "padding-right", "padding-bottom", "padding-left", "border-top-width", "border-right-width",
100
+ "border-bottom-width", "border-left-width", "font-family", "font-size", "font-weight", "font-style", "line-height", "letter-spacing", "word-spacing", "tab-size"]) {
101
+ m.style.setProperty(p, cs.getPropertyValue(p));
102
+ }
103
+ for (const [k, v] of [["position", "absolute"], ["visibility", "hidden"], ["top", "0"], ["left", "-9999px"], ["white-space", "pre-wrap"], ["overflow-wrap", "break-word"], ["height", "auto"]]) m.style.setProperty(k, v);
104
+ m.textContent = field.value.slice(0, pos);
105
+ const mark = doc.createElement("span"); mark.textContent = "​"; m.append(mark);
106
+ doc.body.append(m);
107
+ const y = mark.offsetTop, h = mark.offsetHeight;
108
+ m.remove();
109
+ return { y, h };
110
+ }
111
+
112
+ /** Scroll the field's own scroller so the caret (and the lines just above it: the newest quote) are in view. */
113
+ export function showCaret(field, pos) {
114
+ // At the end (the usual case: the newest quote is the last thing in the box): the bottom.
115
+ if (pos >= field.value.length) { field.scrollTop = field.scrollHeight; return; }
116
+ const c = caretTop(field, pos);
117
+ if (!c || typeof c !== "object") { field.scrollTop = field.scrollHeight; return; }
118
+ const view = field.clientHeight;
119
+ if (c.y + c.h > field.scrollTop + view) field.scrollTop = Math.max(0, c.y + c.h - view + 4);
120
+ else if (c.y < field.scrollTop) field.scrollTop = Math.max(0, c.y - 4);
121
+ }
122
+
123
+ // The quote mark: two marks on the shared 24-px grid, 2-px stroke, currentColor (as ui-icons.js draws).
124
+ const ICON = "M4 11h5v6H4v-6zm0 0c0-3 1.5-5 4-6M14 11h5v6h-5v-6zm0 0c0-3 1.5-5 4-6";
125
+ function iconEl(doc) {
126
+ const NS = "http://www.w3.org/2000/svg";
127
+ const svg = doc.createElementNS(NS, "svg");
128
+ for (const [k, v] of [["class", "icon"], ["width", "16"], ["height", "16"], ["viewBox", "0 0 24 24"], ["fill", "none"], ["stroke", "currentColor"], ["stroke-width", "2"],
129
+ ["stroke-linecap", "round"], ["stroke-linejoin", "round"], ["aria-hidden", "true"], ["focusable", "false"]]) svg.setAttribute(k, v);
130
+ const p = doc.createElementNS(NS, "path"); p.setAttribute("d", ICON); svg.append(p);
131
+ return svg;
132
+ }
133
+
134
+ const overlap = (a, z) => Math.max(0, Math.min(a.right, z.right) - Math.max(a.left, z.left)) * Math.max(0, Math.min(a.bottom, z.bottom) - Math.max(a.top, z.top));
135
+
136
+ /**
137
+ * Install the pill on `list` (the thread element). `deps`:
138
+ * field() → the composer's text field (marked data-touched once it has had the focus: its caret is the person's);
139
+ * canQuote() → boolean (a page that can send); insert(text) (the composer's side: see panel-chat.js);
140
+ * phone() → boolean (a coarse pointer); composerBox() → the composer's whole box (Element) or null; threadBox() → Element.
141
+ * Returns a function that removes everything.
142
+ */
143
+ export function installQuoteSelection(list, deps) {
144
+ const doc = list.ownerDocument, win = doc.defaultView;
145
+ let pop = null, timer = null, down = false, current = null, drawnFor = "";
146
+
147
+ function hide() {
148
+ current = null; drawnFor = "";
149
+ if (!pop) return;
150
+ pop.remove(); pop = null;
151
+ }
152
+ function place(passage) {
153
+ const phone = !!deps.phone?.();
154
+ if (!pop) {
155
+ pop = doc.createElement("div");
156
+ pop.className = "msg-menu quote-pop";
157
+ pop.setAttribute("role", "toolbar"); pop.setAttribute("data-trust", "menu"); pop.setAttribute("aria-label", tq("label"));
158
+ const b = doc.createElement("button");
159
+ b.type = "button"; b.className = "menu-item quote-pick";
160
+ b.append(iconEl(doc));
161
+ const span = doc.createElement("span"); b.append(span);
162
+ // A press on the pill must not collapse the selection it is about (mousedown's default does, pointerdown's
163
+ // preventDefault alone doesn't); the passage is the one the pill was drawn for, whatever the selection did since.
164
+ b.addEventListener("pointerdown", (e) => { e.preventDefault(); });
165
+ b.addEventListener("mousedown", (e) => { e.preventDefault(); });
166
+ b.addEventListener("click", (e) => { e.preventDefault(); const text = drawnFor; hide(); if (text) { deps.insert(text); doc.getSelection?.()?.removeAllRanges?.(); } });
167
+ pop.append(b);
168
+ doc.body.append(pop);
169
+ }
170
+ pop.classList.toggle("is-phone", phone);
171
+ const label = pop.querySelector(".quote-pick span"); label.textContent = tq(phone ? "quotePhone" : "quote");
172
+ pop.querySelector(".quote-tip")?.remove();
173
+ const pr = pop.getBoundingClientRect();
174
+ const vw = win?.innerWidth ?? 1024;
175
+ const rects = [...(passage.range.getClientRects?.() ?? [])].filter((x) => x.width > 0);
176
+ if (!rects.length) { hide(); return; }
177
+ const last = rects[rects.length - 1];
178
+ let left, top, tip = null;
179
+ if (!phone) {
180
+ // The other lines of the message (the passage's own never count as covered).
181
+ const lines = [];
182
+ if (typeof doc.createTreeWalker === "function" && typeof doc.createRange === "function") {
183
+ const w = doc.createTreeWalker(passage.el, 4 /* text */);
184
+ while (w.nextNode()) {
185
+ const rg = doc.createRange(); rg.selectNodeContents(w.currentNode);
186
+ for (const z of rg.getClientRects()) if (z.width > 0 && !rects.some((q) => overlap(q, z) > 0)) lines.push(z);
187
+ }
188
+ }
189
+ left = Math.max(8, Math.min(last.right - pr.width / 2, vw - pr.width - 8));
190
+ const above = { left, right: left + pr.width, top: last.top - pr.height - 10, bottom: last.top - 10 };
191
+ const below = { left, right: left + pr.width, top: last.bottom + 10, bottom: last.bottom + 10 + pr.height };
192
+ const cover = (a) => lines.reduce((n, z) => n + overlap(a, z), 0);
193
+ const under = cover(below) < cover(above) || above.top < 4;
194
+ top = under ? below.top : above.top;
195
+ tip = { side: under ? "up" : "down", x: Math.max(10, Math.min(last.right - left - 5, pr.width - 20)) };
196
+ } else {
197
+ const box = deps.composerBox?.()?.getBoundingClientRect?.();
198
+ left = Math.max(16, vw - 16 - pr.width);
199
+ top = box ? box.top - pr.height - 12 : (win?.innerHeight ?? 800) - pr.height - 120;
200
+ const at = { left, right: left + pr.width, top: top - 8, bottom: top + pr.height + 8 };
201
+ if (rects.some((q) => overlap(at, q) > 0)) {
202
+ const th = deps.threadBox?.()?.getBoundingClientRect?.();
203
+ top = Math.max(th ? th.top : 0, 0) + 12;
204
+ }
205
+ }
206
+ if (tip) {
207
+ const s = doc.createElement("span"); s.className = `quote-tip ${tip.side}`; s.setAttribute("aria-hidden", "true");
208
+ s.style.setProperty("left", `${tip.x}px`);
209
+ pop.append(s);
210
+ }
211
+ pop.style.setProperty("left", `${Math.round(left)}px`);
212
+ pop.style.setProperty("top", `${Math.round(top)}px`);
213
+ }
214
+ function check() {
215
+ timer = null;
216
+ if (down || deps.canQuote?.() === false) { hide(); return; }
217
+ const passage = selectedPassage(list, doc.getSelection?.());
218
+ if (!passage) { hide(); return; }
219
+ current = passage; drawnFor = passage.text;
220
+ place(passage);
221
+ }
222
+ function soon() { if (timer) clearTimeout(timer); timer = setTimeout(check, 120); }
223
+ const onSelection = () => soon();
224
+ const onDown = (e) => { if (pop && pop.contains(e.target)) return; down = true; hide(); };
225
+ // A gesture the browser took over (a touch scroll: pointerdown → pointercancel, no pointerup — #3555 review P2-1)
226
+ // ends the press as a pointerup does; the selection then decides.
227
+ const onUp = () => { if (!down) return; down = false; soon(); };
228
+ const onKey = (e) => { if (e.key === "Escape" && pop) { hide(); } };
229
+ const onScroll = () => { if (pop && current) place(current); };
230
+ const onFocusIn = (e) => { const f = deps.field?.(); if (f && e.target === f) f.dataset.touched = "1"; };
231
+ // The caret as the person leaves it: kept on every move inside the composer and when it loses the focus.
232
+ const keep = (e) => { const f = deps.field?.(); if (f && e.target === f) remembered.set(f, { value: f.value, caret: f.selectionStart ?? f.value.length }); };
233
+ const KEEP = ["focusout", "input", "keyup", "mouseup", "select"];
234
+ doc.addEventListener("focusin", onFocusIn);
235
+ for (const k of KEEP) doc.addEventListener(k, keep, true);
236
+ doc.addEventListener("selectionchange", onSelection);
237
+ list.addEventListener("pointerdown", onDown);
238
+ doc.addEventListener("pointerup", onUp);
239
+ doc.addEventListener("pointercancel", onUp);
240
+ doc.addEventListener("keydown", onKey);
241
+ win?.addEventListener("scroll", onScroll, true);
242
+ win?.addEventListener("resize", onScroll);
243
+ return () => {
244
+ if (timer) clearTimeout(timer);
245
+ hide();
246
+ doc.removeEventListener("focusin", onFocusIn);
247
+ for (const k of KEEP) doc.removeEventListener(k, keep, true);
248
+ doc.removeEventListener("selectionchange", onSelection);
249
+ list.removeEventListener("pointerdown", onDown);
250
+ doc.removeEventListener("pointerup", onUp);
251
+ doc.removeEventListener("pointercancel", onUp);
252
+ doc.removeEventListener("keydown", onKey);
253
+ win?.removeEventListener("scroll", onScroll, true);
254
+ win?.removeEventListener("resize", onScroll);
255
+ };
256
+ }
@@ -534,21 +534,26 @@ export function createChatStore(deps) {
534
534
  async function runCommand(target, command, args, opts = {}) {
535
535
  if (!target || !commandFree(target)) return;
536
536
  const alive = opts.alive || (() => true);
537
- s.commands[target] = { command, busy: true };
537
+ if (!alive()) return;
538
+ const previous = s.commands[target];
539
+ const pending = { command, busy: true, ...(opts.action && previous?.command === command ? { choices: previous.choices } : {}) };
540
+ s.commands[target] = pending;
538
541
  changed(target);
539
542
  const post = async (extra) => {
540
- try { return await api("POST", "/ui/command", { instance: target, command, ...(args ? { args } : {}), ...extra }); }
543
+ try { return await api("POST", "/ui/command", { instance: target, command, ...(args ? { args } : {}), ...(opts.action ? { action: opts.action } : {}), ...extra }); }
541
544
  catch (err) { return { error: err && err.message ? err.message : t("chat.disconnected") }; }
542
545
  };
543
546
  let r = await post({});
547
+ if (!alive() || s.commands[target] !== pending) return;
544
548
  if (r && r.confirm) {
545
549
  const yes = deps.confirm ? await deps.confirm({ title: `/${command}`, message: r.confirm.message, confirmLabel: t(command === "backend" ? "chat.cmdConfirmBackend" : "chat.cmdConfirm"), danger: true }) : false;
546
- if (!yes || !alive()) { delete s.commands[target]; changed(target); return; }
550
+ if (!yes || !alive() || s.commands[target] !== pending) { if (s.commands[target] === pending) { delete s.commands[target]; changed(target); } return; }
547
551
  r = await post({ confirm: r.confirm.token });
552
+ if (!alive() || s.commands[target] !== pending) return;
548
553
  }
549
554
  const follow = r && r.follow && r.follow.kind === "compact" ? r.follow : null;
550
555
  showCommand(target, r && r.choices ? { command, busy: false, choices: r.choices }
551
- : r && r.error ? { command, busy: false, error: r.error }
556
+ : r && r.error ? { command, busy: false, error: r.error, ...(opts.action ? { choices: pending.choices } : {}) }
552
557
  : { command, busy: false, text: (r && r.text) || "", ...(r && r.sent === true ? { sent: true } : {}), ...(follow ? { compact: follow.id ? "running" : "unknown", watch: follow.id } : {}) });
553
558
  changed(target);
554
559
  }
@@ -1,13 +1,13 @@
1
1
  // GENERATED by `npx tsx scripts/gen-cli-caps.mts` from src/cli-registry.ts. Do not edit it: tests/cli-registry-ui-caps.test.ts fails while it differs from the registry.
2
2
  // What the dashboard's scripts may ask about a CLI (see src/cli-caps-module.ts). Booleans and words only; nothing here runs anything.
3
3
  export const CLI_CAPS = Object.freeze({
4
- "claude-code": Object.freeze({ signOut: true, namedAccounts: true, carry: "carries", structuredSignIn: true, structuredNamedSignIn: true, firstRunSignIn: "browser", runtimeInstall: true, runtimeName: "Claude Code" }),
5
- "codex": Object.freeze({ signOut: true, namedAccounts: true, carry: "keeps", structuredSignIn: true, structuredNamedSignIn: false, firstRunSignIn: "browser", runtimeInstall: true, runtimeName: "Codex" }),
6
- "kiro-cli": Object.freeze({ signOut: true, namedAccounts: true, carry: "handover", structuredSignIn: true, structuredNamedSignIn: false, firstRunSignIn: "browser", runtimeInstall: false, runtimeName: null }),
7
- "antigravity": Object.freeze({ signOut: false, namedAccounts: false, carry: null, structuredSignIn: false, structuredNamedSignIn: false, firstRunSignIn: "console", runtimeInstall: false, runtimeName: null }),
8
- "grok": Object.freeze({ signOut: false, namedAccounts: false, carry: null, structuredSignIn: false, structuredNamedSignIn: false, firstRunSignIn: null, runtimeInstall: false, runtimeName: null }),
9
- "muse": Object.freeze({ signOut: false, namedAccounts: false, carry: null, structuredSignIn: false, structuredNamedSignIn: false, firstRunSignIn: null, runtimeInstall: false, runtimeName: null }),
10
- "opencode": Object.freeze({ signOut: false, namedAccounts: false, carry: null, structuredSignIn: false, structuredNamedSignIn: false, firstRunSignIn: null, runtimeInstall: false, runtimeName: null }),
4
+ "claude-code": Object.freeze({ signOut: true, namedAccounts: true, carry: "carries", structuredSignIn: true, structuredNamedSignIn: true, firstRunSignIn: "browser", runtimeInstall: true, runtimeUpdate: true, runtimeUpdateLatest: false, runtimeName: "Claude Code" }),
5
+ "codex": Object.freeze({ signOut: true, namedAccounts: true, carry: "keeps", structuredSignIn: true, structuredNamedSignIn: false, firstRunSignIn: "browser", runtimeInstall: true, runtimeUpdate: true, runtimeUpdateLatest: false, runtimeName: "Codex" }),
6
+ "kiro-cli": Object.freeze({ signOut: true, namedAccounts: true, carry: "handover", structuredSignIn: true, structuredNamedSignIn: false, firstRunSignIn: "browser", runtimeInstall: false, runtimeUpdate: false, runtimeUpdateLatest: false, runtimeName: null }),
7
+ "antigravity": Object.freeze({ signOut: false, namedAccounts: false, carry: null, structuredSignIn: false, structuredNamedSignIn: false, firstRunSignIn: "console", runtimeInstall: true, runtimeUpdate: true, runtimeUpdateLatest: true, runtimeName: "Antigravity" }),
8
+ "grok": Object.freeze({ signOut: false, namedAccounts: false, carry: null, structuredSignIn: false, structuredNamedSignIn: false, firstRunSignIn: null, runtimeInstall: false, runtimeUpdate: false, runtimeUpdateLatest: false, runtimeName: null }),
9
+ "muse": Object.freeze({ signOut: false, namedAccounts: false, carry: null, structuredSignIn: false, structuredNamedSignIn: false, firstRunSignIn: null, runtimeInstall: false, runtimeUpdate: false, runtimeUpdateLatest: false, runtimeName: null }),
10
+ "opencode": Object.freeze({ signOut: false, namedAccounts: false, carry: null, structuredSignIn: false, structuredNamedSignIn: false, firstRunSignIn: null, runtimeInstall: true, runtimeUpdate: true, runtimeUpdateLatest: false, runtimeName: "OpenCode" }),
11
11
  });
12
12
  /** The CLIs the first-run page offers a sign-in for, in its order. */
13
13
  export const FIRST_RUN_BACKENDS = Object.freeze(["kiro-cli", "claude-code", "codex", "antigravity"]);
@@ -7,15 +7,15 @@ import { identityText } from "./account-identity.js";
7
7
  * stays on that computer, and a Runtime reports nothing but each name and whether it is signed in. No path, e-mail or token is read here.
8
8
  */
9
9
  register("claudeAccount", {
10
- en: { label:"Claude account", none:"This computer's default sign-in", default:"default", signedOut:"not signed in", unchecked:"not checked", notReported:"not reported",
10
+ en: { label:"Claude account", none:"This computer's default connection", default:"default", signedOut:"not connected", unchecked:"not checked", notReported:"not reported",
11
11
  old:"Update the Runtime on that computer to choose a Claude account for this agent.",
12
12
  empty:"No Claude accounts reported yet. On that computer run agend-runtime login claude-code NAME, then choose Detect again in that computer's CLI diagnostics (Settings → Runtime).",
13
- hint:"The account is chosen by name; its sign-in stays on that computer. A name that does not exist or is not signed in there is refused, never replaced by another account.",
13
+ hint:"The account is chosen by name; its connection stays on that computer. A name that does not exist or is not connected there is refused, never replaced by another account.",
14
14
  changeNote:"Changing the account starts a new conversation." },
15
- "zh-TW": { label:"Claude 帳號", none:"這台電腦的預設登入", default:"預設", signedOut:"尚未登入", unchecked:"未確認", notReported:"未回報",
15
+ "zh-TW": { label:"Claude 帳號", none:"這台電腦的預設連接", default:"預設", signedOut:"尚未連接", unchecked:"未確認", notReported:"未回報",
16
16
  old:"請更新那台電腦上的 Runtime,才能為這個 Agent 選擇 Claude 帳號。",
17
17
  empty:"尚未回報任何 Claude 帳號。請在那台電腦執行 agend-runtime login claude-code 名稱,再到設定 → Runtime,在該電腦的「CLI 診斷」按「重新偵測」。",
18
- hint:"帳號以名稱選擇,登入資料只保留在那台電腦。不存在或尚未登入的名稱會被拒絕,不會改用其他帳號。",
18
+ hint:"帳號以名稱選擇,連接資料只保留在那台電腦。不存在或尚未連接的名稱會被拒絕,不會改用其他帳號。",
19
19
  changeNote:"更換帳號會開始新的對話。" },
20
20
  });
21
21
  export const accountText = (key, ...values) => t(`claudeAccount.${key}`, ...values);