@songsid/agend 2.4.0-alpha.1 → 2.4.0-alpha.2

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 (235) hide show
  1. package/README.md +1 -1
  2. package/README.zh-TW.md +1 -1
  3. package/dist/agent-whats-new.js +2 -0
  4. package/dist/agent-whats-new.js.map +1 -1
  5. package/dist/auth-api.js +3 -1
  6. package/dist/auth-api.js.map +1 -1
  7. package/dist/backend/claude-code.js +4 -0
  8. package/dist/backend/claude-code.js.map +1 -1
  9. package/dist/backend/types.d.ts +6 -0
  10. package/dist/backend/types.js.map +1 -1
  11. package/dist/backend-availability.d.ts +1 -1
  12. package/dist/backend-availability.js +28 -1
  13. package/dist/backend-availability.js.map +1 -1
  14. package/dist/browser-backend-signins.d.ts +7 -1
  15. package/dist/browser-backend-signins.js +8 -4
  16. package/dist/browser-backend-signins.js.map +1 -1
  17. package/dist/build-provenance.json +1 -1
  18. package/dist/channel/mcp-tools.js +1 -1
  19. package/dist/channel/mcp-tools.js.map +1 -1
  20. package/dist/config-validator.js +47 -7
  21. package/dist/config-validator.js.map +1 -1
  22. package/dist/daemon.d.ts +3 -0
  23. package/dist/daemon.js +4 -0
  24. package/dist/daemon.js.map +1 -1
  25. package/dist/fleet-manager.d.ts +33 -4
  26. package/dist/fleet-manager.js +143 -61
  27. package/dist/fleet-manager.js.map +1 -1
  28. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +19 -0
  29. package/dist/hub/audit/index.js +12 -5
  30. package/dist/hub/audit/index.js.map +1 -1
  31. package/dist/hub/catalog.d.ts +6 -0
  32. package/dist/hub/catalog.js +14 -4
  33. package/dist/hub/catalog.js.map +1 -1
  34. package/dist/hub/client.js +2 -0
  35. package/dist/hub/client.js.map +1 -1
  36. package/dist/hub/compose/member.d.ts +2 -0
  37. package/dist/hub/compose/member.js +11 -2
  38. package/dist/hub/compose/member.js.map +1 -1
  39. package/dist/hub/compose/server.js +2 -1
  40. package/dist/hub/compose/server.js.map +1 -1
  41. package/dist/hub/enrolment-code.d.ts +126 -0
  42. package/dist/hub/enrolment-code.js +266 -0
  43. package/dist/hub/enrolment-code.js.map +1 -0
  44. package/dist/hub/group-policy/admin-impact.js +4 -2
  45. package/dist/hub/group-policy/admin-impact.js.map +1 -1
  46. package/dist/hub/group-policy/admin-inventory.js +6 -6
  47. package/dist/hub/group-policy/admin-inventory.js.map +1 -1
  48. package/dist/hub/group-policy/authorization.d.ts +16 -2
  49. package/dist/hub/group-policy/authorization.js +69 -5
  50. package/dist/hub/group-policy/authorization.js.map +1 -1
  51. package/dist/hub/group-policy/impact-inventory.js +3 -3
  52. package/dist/hub/group-policy/impact-inventory.js.map +1 -1
  53. package/dist/hub/group-policy/resources.d.ts +40 -1
  54. package/dist/hub/group-policy/resources.js +51 -13
  55. package/dist/hub/group-policy/resources.js.map +1 -1
  56. package/dist/hub/group-policy/store.d.ts +6 -0
  57. package/dist/hub/group-policy/store.js +49 -4
  58. package/dist/hub/group-policy/store.js.map +1 -1
  59. package/dist/hub/http/compose.js +30 -6
  60. package/dist/hub/http/compose.js.map +1 -1
  61. package/dist/hub/init/text.js +2 -2
  62. package/dist/hub/init/text.js.map +1 -1
  63. package/dist/hub/init/web.d.ts +7 -0
  64. package/dist/hub/init/web.js +6 -1
  65. package/dist/hub/init/web.js.map +1 -1
  66. package/dist/hub/join/local.d.ts +27 -0
  67. package/dist/hub/join/local.js +70 -5
  68. package/dist/hub/join/local.js.map +1 -1
  69. package/dist/hub/join/receipt.d.ts +1 -0
  70. package/dist/hub/join/receipt.js +1 -1
  71. package/dist/hub/join/receipt.js.map +1 -1
  72. package/dist/hub/join/service.d.ts +92 -6
  73. package/dist/hub/join/service.js +199 -28
  74. package/dist/hub/join/service.js.map +1 -1
  75. package/dist/hub/join/store.d.ts +2 -1
  76. package/dist/hub/join/store.js +7 -7
  77. package/dist/hub/join/store.js.map +1 -1
  78. package/dist/hub/member/exposure-api.d.ts +2 -0
  79. package/dist/hub/member/exposure-api.js +3 -2
  80. package/dist/hub/member/exposure-api.js.map +1 -1
  81. package/dist/hub/member/exposures.d.ts +4 -0
  82. package/dist/hub/member/exposures.js +12 -2
  83. package/dist/hub/member/exposures.js.map +1 -1
  84. package/dist/hub/member/pairing-notices.js +8 -6
  85. package/dist/hub/member/pairing-notices.js.map +1 -1
  86. package/dist/hub/pairing-notices.d.ts +5 -2
  87. package/dist/hub/pairing-notices.js +38 -13
  88. package/dist/hub/pairing-notices.js.map +1 -1
  89. package/dist/hub/pairing.d.ts +7 -2
  90. package/dist/hub/protocol.d.ts +47 -0
  91. package/dist/hub/protocol.js +3 -1
  92. package/dist/hub/protocol.js.map +1 -1
  93. package/dist/hub/server.js +15 -1
  94. package/dist/hub/server.js.map +1 -1
  95. package/dist/hub/types.d.ts +12 -4
  96. package/dist/hub-pairing-summary.js +1 -1
  97. package/dist/hub-pairing-summary.js.map +1 -1
  98. package/dist/instance-config-impact.js +4 -0
  99. package/dist/instance-config-impact.js.map +1 -1
  100. package/dist/instance-lifecycle.js +4 -0
  101. package/dist/instance-lifecycle.js.map +1 -1
  102. package/dist/locale.js +6 -2
  103. package/dist/locale.js.map +1 -1
  104. package/dist/log-service.d.ts +62 -6
  105. package/dist/log-service.js +135 -28
  106. package/dist/log-service.js.map +1 -1
  107. package/dist/log-steps-agy-grok.d.ts +74 -0
  108. package/dist/log-steps-agy-grok.js +440 -0
  109. package/dist/log-steps-agy-grok.js.map +1 -0
  110. package/dist/log-steps.d.ts +62 -3
  111. package/dist/log-steps.js +188 -22
  112. package/dist/log-steps.js.map +1 -1
  113. package/dist/log-transcript-paths.d.ts +29 -0
  114. package/dist/log-transcript-paths.js +109 -0
  115. package/dist/log-transcript-paths.js.map +1 -0
  116. package/dist/login-controller.d.ts +17 -3
  117. package/dist/login-controller.js +57 -5
  118. package/dist/login-controller.js.map +1 -1
  119. package/dist/login-window-lock.d.ts +20 -8
  120. package/dist/login-window-lock.js +35 -16
  121. package/dist/login-window-lock.js.map +1 -1
  122. package/dist/outbound-handlers.d.ts +14 -0
  123. package/dist/outbound-handlers.js +49 -1
  124. package/dist/outbound-handlers.js.map +1 -1
  125. package/dist/profile-signins.d.ts +2 -0
  126. package/dist/profile-signins.js +1 -1
  127. package/dist/profile-signins.js.map +1 -1
  128. package/dist/settings-api.d.ts +34 -0
  129. package/dist/settings-api.js +184 -6
  130. package/dist/settings-api.js.map +1 -1
  131. package/dist/settings-change.js +38 -1
  132. package/dist/settings-change.js.map +1 -1
  133. package/dist/settings-effect.js +14 -0
  134. package/dist/settings-effect.js.map +1 -1
  135. package/dist/tool-progress.d.ts +7 -0
  136. package/dist/tool-progress.js +21 -9
  137. package/dist/tool-progress.js.map +1 -1
  138. package/dist/types.d.ts +13 -0
  139. package/dist/ui/accounts-view.js +14 -4
  140. package/dist/ui/agent-details-settings.js +2 -2
  141. package/dist/ui/agent-page-strings.js +2 -2
  142. package/dist/ui/backend-signin.js +47 -14
  143. package/dist/ui/chat-activity-groups.js +225 -0
  144. package/dist/ui/chat-activity.js +355 -0
  145. package/dist/ui/chat-popout-header.js +35 -0
  146. package/dist/ui/chat-popout-transport.js +80 -0
  147. package/dist/ui/chat-popout.js +63 -0
  148. package/dist/ui/chat-quote.js +3 -1
  149. package/dist/ui/chat-store.js +45 -4
  150. package/dist/ui/chat-workspace-gestures.js +177 -0
  151. package/dist/ui/chat-workspace-navigation.js +34 -10
  152. package/dist/ui/chat-workspace.js +96 -32
  153. package/dist/ui/host-install.js +2 -2
  154. package/dist/ui/hub-agent-copy.js +7 -7
  155. package/dist/ui/hub-chat-strings.js +3 -3
  156. package/dist/ui/hub-client.js +77 -17
  157. package/dist/ui/hub-company-join-strings.js +12 -10
  158. package/dist/ui/hub-company-join.js +52 -39
  159. package/dist/ui/hub-confirm-place.js +44 -0
  160. package/dist/ui/hub-directory-editor-strings.js +3 -3
  161. package/dist/ui/hub-directory-notice-strings.js +1 -1
  162. package/dist/ui/hub-enrolment-code-strings.js +44 -0
  163. package/dist/ui/hub-enrolment-code.js +159 -0
  164. package/dist/ui/hub-group-search.js +82 -0
  165. package/dist/ui/hub-group-strings.js +8 -8
  166. package/dist/ui/hub-join-approval.js +31 -0
  167. package/dist/ui/hub-join-code-input.js +66 -0
  168. package/dist/ui/hub-join-queue.js +62 -0
  169. package/dist/ui/hub-join-steps.js +231 -0
  170. package/dist/ui/hub-joincode-flow-strings.js +22 -0
  171. package/dist/ui/hub-owner-strings.js +9 -9
  172. package/dist/ui/hub-pairing-progress-strings.js +1 -1
  173. package/dist/ui/hub-quick-pairing.js +8 -4
  174. package/dist/ui/hub-quick-strings.js +11 -11
  175. package/dist/ui/hub-share-refused.js +17 -0
  176. package/dist/ui/hub-strings.js +61 -61
  177. package/dist/ui/hub-this-hub.js +2 -2
  178. package/dist/ui/hub-welcome.js +26 -5
  179. package/dist/ui/image-annotate.js +283 -0
  180. package/dist/ui/image-lightbox.js +26 -6
  181. package/dist/ui/log-row.js +327 -0
  182. package/dist/ui/panel-chat.js +151 -12
  183. package/dist/ui/panel-details.js +14 -6
  184. package/dist/ui/panel-hub.js +42 -13
  185. package/dist/ui/panel-log.js +9 -154
  186. package/dist/ui/panel-settings.js +48 -11
  187. package/dist/ui/search-dialog.js +1 -0
  188. package/dist/ui/settings-access-overview.js +1 -1
  189. package/dist/ui/settings-hub-browser-certificate.js +3 -3
  190. package/dist/ui/settings-hub-company-join.js +41 -30
  191. package/dist/ui/settings-hub-connection.js +8 -5
  192. package/dist/ui/settings-hub-membership.js +3 -3
  193. package/dist/ui/settings-hub-section.js +1 -1
  194. package/dist/ui/settings-hub-setup-strings.js +6 -6
  195. package/dist/ui/settings-hub-setup.js +44 -6
  196. package/dist/ui/settings-hub.js +35 -10
  197. package/dist/ui/settings-layout.js +6 -4
  198. package/dist/ui/settings-public-session-strings.js +37 -0
  199. package/dist/ui/settings-registry.js +4 -0
  200. package/dist/ui/settings-strings.js +2 -2
  201. package/dist/ui/shared/app-shell.js +16 -10
  202. package/dist/ui/shared/app.css +195 -30
  203. package/dist/ui/shared/app.js +8 -1
  204. package/dist/ui/shared/chat-render.js +11 -2
  205. package/dist/ui/shared/chat-thread.js +20 -3
  206. package/dist/ui/shared/chat-work-bar.css +7 -0
  207. package/dist/ui/shared/chat-workspace-model.js +39 -9
  208. package/dist/ui/shared/hub-owner.css +8 -0
  209. package/dist/ui/shared/identity-color.js +9 -3
  210. package/dist/ui/shared/image-annotate.css +45 -0
  211. package/dist/ui/shared/instance-nav.js +59 -22
  212. package/dist/ui/shared/pane-geometry.js +29 -0
  213. package/dist/ui/shared/signin.js +2 -2
  214. package/dist/ui/shared/tokens.css +14 -0
  215. package/dist/ui/shared/ui-menu.js +22 -7
  216. package/dist/ui/signin.html +1 -1
  217. package/dist/ui/structured-signin.js +11 -4
  218. package/dist/web-api.d.ts +1 -0
  219. package/dist/web-api.js +34 -4
  220. package/dist/web-api.js.map +1 -1
  221. package/dist/web-backend-login.d.ts +9 -3
  222. package/dist/web-backend-login.js +7 -4
  223. package/dist/web-backend-login.js.map +1 -1
  224. package/dist/web-chat-history.d.ts +11 -0
  225. package/dist/web-chat-history.js +9 -1
  226. package/dist/web-chat-history.js.map +1 -1
  227. package/dist/web-guest-access.js +2 -2
  228. package/dist/web-guest-access.js.map +1 -1
  229. package/dist/web-session.d.ts +31 -3
  230. package/dist/web-session.js +25 -4
  231. package/dist/web-session.js.map +1 -1
  232. package/dist/web-settings-patch.d.ts +8 -2
  233. package/dist/web-settings-patch.js +22 -10
  234. package/dist/web-settings-patch.js.map +1 -1
  235. package/package.json +1 -1
@@ -106,7 +106,7 @@ import { type WebUpdateHost } from "./web-update.js";
106
106
  import { WebBackendLogins, type SignInTarget } from "./web-backend-login.js";
107
107
  import { WebHostInstalls, type HostInstallMode, type HostInstallReporter, type HostInstallStart } from "./web-host-install.js";
108
108
  import { BrowserBackendSignIns } from "./browser-backend-signins.js";
109
- import { type RawConfigPatch } from "./settings-api.js";
109
+ import { type ClassicProfileSwitch, type RawConfigPatch } from "./settings-api.js";
110
110
  import { type AgentEndpointContext } from "./agent-endpoint.js";
111
111
  import { AgentCredentials } from "./agent-credentials.js";
112
112
  import { ClassicChannelManager } from "./classic-channel-manager.js";
@@ -1810,6 +1810,11 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1810
1810
  /** #1218: the Log tab's on-demand service — made on first use; with `web.log_tab` off it answers off and does nothing. */
1811
1811
  private logService;
1812
1812
  private get log();
1813
+ /**
1814
+ * AGEND-197: an instance's effective `tool_progress` — what its chat's activity block is gated by: its own setting, else
1815
+ * the fleet default, else off (a ClassicBot room: its channel's, as the daemon reads it). Junk values are off.
1816
+ */
1817
+ private chatToolProgress;
1813
1818
  /** Board 003648ac: a web /compact followed to its end, from the transcript the Log reads (none: nothing to follow). */
1814
1819
  private compactWatchService;
1815
1820
  private get compactWatch();
@@ -2082,9 +2087,28 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
2082
2087
  private applyHotConfigUpdate;
2083
2088
  private classicBehaviorUpdate;
2084
2089
  /** Compensation retains this transaction's exact instance owner across its own transitions. */
2090
+ /** A Settings compensation for a ClassicBot room (#1423): throws stale when its receipt no longer owns the room. */
2085
2091
  captureClassicSettingsRestoration(instanceName: string, changedFields: string[], execution?: SettingsExecution): () => Promise<void>;
2086
2092
  /** Apply a Settings edit to a ClassicBot channel without waiting for the poller. */
2087
- restartClassicInstanceFromSettings(instanceName: string, changedFields?: string[], execution?: SettingsExecution): Promise<void>;
2093
+ restartClassicInstanceFromSettings(instanceName: string, changedFields?: string[], execution?: SettingsExecution, opts?: {
2094
+ startIfStopped?: boolean;
2095
+ }): Promise<void>;
2096
+ /** #3715: update_instance_config's room account switch — an owned restart with no request execution of its own. */
2097
+ beginClassicProfileSwitch(instanceName: string, changedFields: string[]): ReturnType<FleetManager["beginClassicSettingsRestart"]>;
2098
+ /**
2099
+ * One owned ClassicBot room restart and its compensation (#1423; #3715, Prism on #3719; M-2966). Both are bound to one
2100
+ * receipt — the room's epoch and daemon as this operation last left them — so a Stop or another start queued meanwhile
2101
+ * supersedes both: the forward work never launches after it, and the compensation never stops or replaces a newer
2102
+ * runtime. A request's own execution (a confirmed continuation) is used for the forward work when there is one; a plain
2103
+ * Save gets an owned one here, so its receipt follows its own stop and start instead of going stale at the first stop.
2104
+ * `restore` brings a room that was running before back up — also when the failed start took its daemon away — and says
2105
+ * what it did.
2106
+ */
2107
+ beginClassicSettingsRestart(instanceName: string, changedFields: string[], execution?: SettingsExecution): {
2108
+ restart(): Promise<void>;
2109
+ restore(): Promise<"restarted" | "not-running" | "superseded">;
2110
+ close(): void;
2111
+ };
2088
2112
  private restartClassicSettingsOwned;
2089
2113
  /** Reload classicBot.yaml once. Kept callable so the periodic production
2090
2114
  * path is covered without relying on fake timers around startAll(). */
@@ -3781,6 +3805,8 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
3781
3805
  * ClassicBot room's launched or would-be login when the room runs that backend. Null: the backend's default login
3782
3806
  * (also for a backend that has no profiles, where the option is ignored).
3783
3807
  */
3808
+ /** #3715: update_instance_config's ClassicBot room account switch — the room's Settings save (#3691), from a tool. */
3809
+ switchClassicRoomProfile(name: string, backendOptions: unknown): Promise<ClassicProfileSwitch>;
3784
3810
  credentialProfileOf(name: string, backend: string): string | null;
3785
3811
  /**
3786
3812
  * #1699: the claude config dir an instance's CLI uses — its credential profile's, else exactly as before
@@ -4779,8 +4805,11 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
4779
4805
  private loginReopenGen;
4780
4806
  private reopenLoginWindow;
4781
4807
  private shutdownLoginWindows;
4782
- /** `/login cancel` — abort the active session and remove its window. */
4783
- cancelLoginSession(): Promise<string>;
4808
+ /**
4809
+ * `/login cancel` — abort the active session and remove its window. `backend` (AGEND-203, the dashboard's "Cancel the running sign-in" on a refused start): only the
4810
+ * sign-in or install running on that backend; nothing else is touched, and the answer says none ran when there is none.
4811
+ */
4812
+ cancelLoginSession(backend?: string): Promise<string>;
4784
4813
  /**
4785
4814
  * After a successful login: wake the paused instances of that backend AND
4786
4815
  * restart the running ones — a live CLI holds the old token in memory and
@@ -32,7 +32,7 @@ import { SettingsRouteLifetime } from "./settings-route-lifetime.js";
32
32
  import { GeneralManagedFileError } from "./runtime-general-protocol.js";
33
33
  import { GeneralBindings, generalBindingRevision, parseGeneralSwitchInput, switchGeneralLocation } from "./general-binding.js";
34
34
  import { confirmGeneralHostExit } from "./general-host-owner.js";
35
- import { settingsFingerprint, SettingsExecution, settingsRevision, noteSettingsWrite, settingsFileResource, assertSettingsLease, trySettingsLease, waitSettingsLease, settingsUndo, undoSettingsPaths } from "./settings-transaction.js";
35
+ import { settingsFingerprint, SettingsExecution, SettingsExecutionError, settingsRevision, noteSettingsWrite, settingsFileResource, assertSettingsLease, trySettingsLease, waitSettingsLease, settingsUndo, undoSettingsPaths } from "./settings-transaction.js";
36
36
  import { performance } from "node:perf_hooks";
37
37
  import { withSpawnHoldReply } from "./spawn-hold-reply.js";
38
38
  import { gatewayRequestContext } from "./web-request-context.js";
@@ -232,7 +232,7 @@ import { shapeWebModelCatalog } from "./web-model-groups.js";
232
232
  import { isWindowsInstance, isNativePaneInstance, isNativeExecInstance, WINDOWS_CONFIG_REFUSED, nativeCredentialProfile } from "./native-instance-registry.js";
233
233
  import { createNativeWindowsInstance, updateNativeWindowsInstance } from "./native-instance-api.js";
234
234
  import { NativeInstanceConfigEdit, parseNativeInstanceCreate } from "./native-instance-input.js";
235
- import { LogService } from "./log-service.js";
235
+ import { LogService, thinkingOn } from "./log-service.js";
236
236
  import { viewHistory } from "./view-history.js";
237
237
  import { WebChatHistory, WEB_CHAT_TEXT_MAX, isWebMessageId, newWebMessageId, webChatFrom } from "./web-chat-history.js";
238
238
  import { WEB_ECHO_COPIES_MAX, WEB_MIRROR_TIMEOUT_MS, webReactionEmoji, webReactionProblem } from "./web-reactions.js";
@@ -294,7 +294,7 @@ import { BrowserBackendSignIns } from "./browser-backend-signins.js";
294
294
  import { createStructuredSignInTransport } from "./structured-signin-transport.js";
295
295
  import { ONBOARDING_BACKENDS, readPendingBackendSignIns } from "./backend-signin-pending.js";
296
296
  import { structuredSignInSupported } from "./structured-signin.js";
297
- import { handleSettingsRequest } from "./settings-api.js";
297
+ import { handleSettingsRequest, switchClassicRoomProfile } from "./settings-api.js";
298
298
  import { setLocale, detectLocale, getLocale, t } from "./locale.js";
299
299
  import { remoteCardAction, remoteCardChoiceLabel, remoteCardOutcomeText, remoteCardPrompt, REMOTE_CARD_TEXT_MAX } from "./remote-card-prompt.js";
300
300
  import { recentChatContext } from "./log-tail.js";
@@ -340,7 +340,7 @@ import { mayUseTool, resolveToolSet, scheduleOpRefusal, toolForIpcType, toolRefu
340
340
  import { authorizeSession, decideWebGate, loadOrCreateWebToken, readSessionCookies, readWebToken, sessionCookieUpgrade } from "./web-auth.js";
341
341
  import { bypassesWebGate, handleAuthRequest, serveGuestRefusedPage, serveSigninPage } from "./auth-api.js";
342
342
  import { isWebPageNavigation } from "./web-shell-routes.js";
343
- import { guestSessionPolicy, localSessionPolicy, sessionVia, tokenEpoch, WebSessionStore } from "./web-session.js";
343
+ import { guestSessionPolicy, localSessionPolicy, publicLinkSessionPolicy, sessionVia, tokenEpoch, WebSessionStore } from "./web-session.js";
344
344
  import { WebNotices, WEB_NOTICES_FILE } from "./web-notices.js";
345
345
  import { enrolledRuntimeNotice } from "./runtime-enroll-notice.js";
346
346
  import { DeviceLoginRequests } from "./web-device-login.js";
@@ -406,6 +406,7 @@ import { estimateCapacity } from "./usage/capacity.js";
406
406
  import { covered, hourSources } from "./usage-rollup.js";
407
407
  import { KEEP_DAYS } from "./cache-ledger.js";
408
408
  import { ratesFor } from "./cache-prices.js";
409
+ import { ownTranscript } from "./log-transcript-paths.js";
409
410
  // Closed migration cohort: these 11 names existed immediately before the first
410
411
  // managed-skill publisher (a1ac499f; parent e267e684). Never grow this set when
411
412
  // adding a bundled skill: its new name is not proof of old AgEnD ownership.
@@ -1558,7 +1559,8 @@ export class FleetManager {
1558
1559
  if (this.shuttingDown)
1559
1560
  throw Error("Fleet is stopping");
1560
1561
  const controller = createHubWebInitializer({ home: this.dataDir, readConfig: () => this.getRawFleetConfig(),
1561
- writeFleet: patches => this.saveFleetConfig(patches), committed: () => this.applyHubSwitches() });
1562
+ writeFleet: patches => this.saveFleetConfig(patches), committed: () => this.applyHubSwitches(),
1563
+ serverHealth: hub => this.shuttingDown ? "stopped" : this.hubRuntime?.serverHealth(hub) ?? "unavailable" });
1562
1564
  this.hubSetupController = controller;
1563
1565
  return controller;
1564
1566
  })();
@@ -5305,7 +5307,9 @@ export class FleetManager {
5305
5307
  claimedCards: () => this.livenessCards(),
5306
5308
  facts: (name) => this.livenessFacts(name),
5307
5309
  backgroundBusy: (name) => this.livenessBackgroundBusy(name),
5308
- isInstance: (name) => this.fleetConfig?.instances?.[name] != null,
5310
+ // #3720: a ClassicBot room's agent is an agent too (「ClassicBot 派工作也是 agent 派的」): a card it handed out is told
5311
+ // to it like any instance's. A room that is gone falls to Needs you (not an agent here); one not running is away.
5312
+ isInstance: (name) => this.fleetConfig?.instances?.[name] != null || this.isClassicInstance(name),
5309
5313
  // Not running now: stopped, crashed, paused, or no daemon at all.
5310
5314
  dispatcherAway: (name) => this.instanceProcessStatus.has(name) || this.lifecycle.isPaused(name) || !this.daemons.has(name),
5311
5315
  boardOff: (name) => taskBoardOffIn(this.fleetConfig, name),
@@ -6913,17 +6917,30 @@ export class FleetManager {
6913
6917
  get log() {
6914
6918
  return this.logService ??= new LogService({
6915
6919
  enabled: () => this.fleetConfig?.web?.log_tab === true,
6920
+ cwd: (name) => { const dir = this.fleetConfig?.instances?.[name]?.working_directory; return typeof dir === "string" && dir ? dir : undefined; },
6921
+ thinking: () => thinkingOn(this.fleetConfig?.web), // AGEND-181/197: off unless turned on
6922
+ toolProgress: (name) => this.chatToolProgress(name),
6916
6923
  known: (name) => Object.prototype.hasOwnProperty.call(this.fleetConfig?.instances ?? {}, name) || this.classicRoomFor(name) !== null,
6917
6924
  source: (name) => this.logSource(name),
6918
6925
  events: (name, limit) => (this.eventLog?.query({ instance: name, limit }) ?? []),
6919
6926
  emit: (event, data) => this.emitSseEvent(event, data),
6920
6927
  });
6921
6928
  }
6929
+ /**
6930
+ * AGEND-197: an instance's effective `tool_progress` — what its chat's activity block is gated by: its own setting, else
6931
+ * the fleet default, else off (a ClassicBot room: its channel's, as the daemon reads it). Junk values are off.
6932
+ */
6933
+ chatToolProgress(name) {
6934
+ const defaults = this.fleetConfig?.defaults?.tool_progress;
6935
+ const own = Object.prototype.hasOwnProperty.call(this.fleetConfig?.instances ?? {}, name) ? this.fleetConfig?.instances?.[name]?.tool_progress : undefined;
6936
+ const level = own ?? (this.classicRoomFor(name) ? this.classicChannels?.getToolProgressByInstance(name, defaults) : undefined) ?? defaults;
6937
+ return level === "standard" || level === "verbose" ? level : "off";
6938
+ }
6922
6939
  /** Board 003648ac: a web /compact followed to its end, from the transcript the Log reads (none: nothing to follow). */
6923
6940
  compactWatchService = null;
6924
6941
  get compactWatch() {
6925
6942
  return this.compactWatchService ??= new CompactWatch({
6926
- source: (name) => { const src = this.logSource(name); return { path: src.path, format: src.format }; },
6943
+ source: (name) => { const src = this.logSource(name); return { path: src.path, format: src.format === "claude" || src.format === "codex" ? src.format : null }; },
6927
6944
  // The launch that runs it now (the same value the daemon sends with raw_paste_written).
6928
6945
  owner: (name) => {
6929
6946
  const daemon = this.lifecycle.daemons.get(name);
@@ -6983,6 +7000,11 @@ export class FleetManager {
6983
7000
  }
6984
7001
  if (backend === "codex")
6985
7002
  return { backend, path: live, format: "codex", ...(live ? {} : { reason: "not_running" }) };
7003
+ // AGEND-181 PR2: agy and grok keep their records per working directory (log-transcript-paths.ts); a stopped instance's last
7004
+ // work is still there. Classic rooms have no working directory of their own: nothing to read.
7005
+ const own = ownTranscript(backend, config ? (config.working_directory || this.getInstanceDir(name)) : null);
7006
+ if (own)
7007
+ return { backend, ...own, ...(own.path ? {} : { reason: "no_transcript" }) };
6986
7008
  if (backend === "kiro-cli") {
6987
7009
  // #1218 PR4: events only until the launch's root and the current conversation are both proven (kiro-log-gate.ts);
6988
7010
  // the reason names which proof is missing. With today's proofs the gate never opens, and nothing is read for kiro:
@@ -8424,29 +8446,63 @@ export class FleetManager {
8424
8446
  };
8425
8447
  }
8426
8448
  /** Compensation retains this transaction's exact instance owner across its own transitions. */
8449
+ /** A Settings compensation for a ClassicBot room (#1423): throws stale when its receipt no longer owns the room. */
8427
8450
  captureClassicSettingsRestoration(instanceName, changedFields, execution) {
8451
+ const op = this.beginClassicSettingsRestart(instanceName, changedFields, execution);
8452
+ return async () => { if (await op.restore() === "superseded")
8453
+ throw new SettingsExecutionError("settings_execution_stale"); };
8454
+ }
8455
+ /** Apply a Settings edit to a ClassicBot channel without waiting for the poller. */
8456
+ async restartClassicInstanceFromSettings(instanceName, changedFields = [], execution, opts) {
8457
+ return this.lifecycle.runTransition(instanceName, transition => this.restartClassicSettingsOwned(instanceName, changedFields, execution, transition, opts));
8458
+ }
8459
+ /** #3715: update_instance_config's room account switch — an owned restart with no request execution of its own. */
8460
+ beginClassicProfileSwitch(instanceName, changedFields) {
8461
+ return this.beginClassicSettingsRestart(instanceName, changedFields);
8462
+ }
8463
+ /**
8464
+ * One owned ClassicBot room restart and its compensation (#1423; #3715, Prism on #3719; M-2966). Both are bound to one
8465
+ * receipt — the room's epoch and daemon as this operation last left them — so a Stop or another start queued meanwhile
8466
+ * supersedes both: the forward work never launches after it, and the compensation never stops or replaces a newer
8467
+ * runtime. A request's own execution (a confirmed continuation) is used for the forward work when there is one; a plain
8468
+ * Save gets an owned one here, so its receipt follows its own stop and start instead of going stale at the first stop.
8469
+ * `restore` brings a room that was running before back up — also when the failed start took its daemon away — and says
8470
+ * what it did.
8471
+ */
8472
+ beginClassicSettingsRestart(instanceName, changedFields, execution) {
8428
8473
  const generation = this.settingsGeneration;
8429
8474
  const receipt = { instanceName, epoch: this.lifecycle.epochOf(instanceName), daemon: this.daemons.get(instanceName) };
8475
+ const wasRunning = receipt.daemon !== undefined;
8476
+ const owned = () => !this.shuttingDown && this.settingsGeneration === generation
8477
+ && this.lifecycle.epochOf(instanceName) === receipt.epoch && this.daemons.get(instanceName) === receipt.daemon;
8430
8478
  if (execution)
8431
8479
  this.classicSettingsOwners.set(execution, receipt);
8432
- return async () => {
8433
- const cleanup = new SettingsExecution({ current: () => !this.shuttingDown && this.settingsGeneration === generation
8434
- && this.lifecycle.epochOf(instanceName) === receipt.epoch && this.daemons.get(instanceName) === receipt.daemon, snapshot: () => null });
8435
- this.classicSettingsOwners.set(cleanup, receipt);
8436
- try {
8437
- cleanup.assert();
8438
- await this.restartClassicInstanceFromSettings(instanceName, changedFields, cleanup);
8439
- }
8440
- finally {
8441
- cleanup.close();
8442
- }
8480
+ let forward = execution, ownForward;
8481
+ return {
8482
+ restart: () => {
8483
+ if (!forward) {
8484
+ forward = ownForward = new SettingsExecution({ current: owned, snapshot: () => null });
8485
+ this.classicSettingsOwners.set(forward, receipt);
8486
+ }
8487
+ return this.restartClassicInstanceFromSettings(instanceName, changedFields, forward);
8488
+ },
8489
+ restore: async () => {
8490
+ if (!owned())
8491
+ return "superseded";
8492
+ const cleanup = new SettingsExecution({ current: owned, snapshot: () => null });
8493
+ this.classicSettingsOwners.set(cleanup, receipt);
8494
+ try {
8495
+ await this.restartClassicInstanceFromSettings(instanceName, changedFields, cleanup, { startIfStopped: wasRunning });
8496
+ }
8497
+ finally {
8498
+ cleanup.close();
8499
+ }
8500
+ return wasRunning ? "restarted" : "not-running";
8501
+ },
8502
+ close: () => ownForward?.close(),
8443
8503
  };
8444
8504
  }
8445
- /** Apply a Settings edit to a ClassicBot channel without waiting for the poller. */
8446
- async restartClassicInstanceFromSettings(instanceName, changedFields = [], execution) {
8447
- return this.lifecycle.runTransition(instanceName, transition => this.restartClassicSettingsOwned(instanceName, changedFields, execution, transition));
8448
- }
8449
- async restartClassicSettingsOwned(instanceName, changedFields, execution, transition) {
8505
+ async restartClassicSettingsOwned(instanceName, changedFields, execution, transition, opts) {
8450
8506
  const generation = this.settingsGeneration;
8451
8507
  const receipt = execution ? this.classicSettingsOwners.get(execution) : undefined;
8452
8508
  const check = () => {
@@ -8458,7 +8514,9 @@ export class FleetManager {
8458
8514
  check();
8459
8515
  if (!this.classicChannels)
8460
8516
  throw new Error("Classic channel manager not initialized");
8461
- const wasRunning = this.daemons.has(instanceName);
8517
+ // #3715: a compensation brings back a room its own failed start took down (startIfStopped, owned by its receipt).
8518
+ const hasDaemon = this.daemons.has(instanceName);
8519
+ const wasRunning = hasDaemon || opts?.startIfStopped === true;
8462
8520
  this.classicChannels.reloadFromDisk();
8463
8521
  this.reportClassicUnrecoverableIds();
8464
8522
  this.reregisterClassicChannels();
@@ -8476,25 +8534,28 @@ export class FleetManager {
8476
8534
  }
8477
8535
  // M-2909 (Prism on #3691): an account saved from Settings hands the conversation over like a classicBot.yaml edit
8478
8536
  // (#1753) — read against what it was launched on, before the stop takes that away.
8479
- const launchedSnapshot = this.daemons.get(instanceName)?.getConfigSnapshot?.();
8480
- const launchedBackend = launchedSnapshot?.backend ?? this.fleetConfig?.defaults?.backend ?? "claude-code";
8481
- const profileSwitch = this.classicProfileChange(instanceName, launchedBackend !== this.classicChannels.getBackendByInstance(instanceName, this.fleetConfig?.defaults?.backend));
8482
- const launchedIn = launchedSnapshot?.working_directory;
8483
- const stopping = this.stopInstance(instanceName, transition);
8484
- // stop() invalidates synchronously in our transition. Keep only that exact acquisition.
8485
- if (receipt && this.lifecycle.epochOf(instanceName) === receipt.epoch + 1 && this.daemons.get(instanceName) === receipt.daemon)
8486
- receipt.epoch++;
8487
- await stopping;
8488
- if (receipt && this.lifecycle.epochOf(instanceName) === receipt.epoch && !this.daemons.has(instanceName))
8489
- receipt.daemon = undefined;
8490
- check();
8491
- // #1753: the conversation goes along where it can; otherwise a switch that loses it starts fresh.
8492
- if (profileSwitch.carry) {
8493
- await this.switchConversation(instanceName, { ...profileSwitch.carry, workingDirectory: launchedIn });
8537
+ // #3715: with no daemon (a compensation after its own failed start) there is nothing to stop or hand over.
8538
+ if (hasDaemon) {
8539
+ const launchedSnapshot = this.daemons.get(instanceName)?.getConfigSnapshot?.();
8540
+ const launchedBackend = launchedSnapshot?.backend ?? this.fleetConfig?.defaults?.backend ?? "claude-code";
8541
+ const profileSwitch = this.classicProfileChange(instanceName, launchedBackend !== this.classicChannels.getBackendByInstance(instanceName, this.fleetConfig?.defaults?.backend));
8542
+ const launchedIn = launchedSnapshot?.working_directory;
8543
+ const stopping = this.stopInstance(instanceName, transition);
8544
+ // stop() invalidates synchronously in our transition. Keep only that exact acquisition.
8545
+ if (receipt && this.lifecycle.epochOf(instanceName) === receipt.epoch + 1 && this.daemons.get(instanceName) === receipt.daemon)
8546
+ receipt.epoch++;
8547
+ await stopping;
8548
+ if (receipt && this.lifecycle.epochOf(instanceName) === receipt.epoch && !this.daemons.has(instanceName))
8549
+ receipt.daemon = undefined;
8494
8550
  check();
8551
+ // #1753: the conversation goes along where it can; otherwise a switch that loses it starts fresh.
8552
+ if (profileSwitch.carry) {
8553
+ await this.switchConversation(instanceName, { ...profileSwitch.carry, workingDirectory: launchedIn });
8554
+ check();
8555
+ }
8556
+ else if (profileSwitch.startsFresh)
8557
+ this.writeFreshStartMarker(instanceName);
8495
8558
  }
8496
- else if (profileSwitch.startsFresh)
8497
- this.writeFreshStartMarker(instanceName);
8498
8559
  const stoppedEpoch = this.lifecycle.epochOf(instanceName);
8499
8560
  await new Promise(resolve => setTimeout(resolve, 250));
8500
8561
  check();
@@ -9648,6 +9709,8 @@ export class FleetManager {
9648
9709
  localPolicy: () => localSessionPolicy(this.fleetConfig?.web?.session?.local),
9649
9710
  // #1920 §5.4: a guest's, from web.guests.session (never longer than the surface's own).
9650
9711
  guestPolicy: () => guestSessionPolicy(this.fleetConfig?.web?.guests?.session),
9712
+ // #3708: web.session.public_link — longer than 30 min / 8 h only with a fixed hostname (a named tunnel).
9713
+ gatewayPolicy: () => publicLinkSessionPolicy(this.fleetConfig?.web?.session?.public_link, publicLinkNamedHostname(this.fleetConfig?.web)),
9651
9714
  // A session over the temporary link ends with the link (its TTL, at most 8 h on a quick tunnel).
9652
9715
  exposureEnd: id => this.publicWebLink?.endOf(id) ?? null,
9653
9716
  });
@@ -14232,6 +14295,7 @@ export class FleetManager {
14232
14295
  this.emitSseEvent("message", {
14233
14296
  instance, sender: msg.username, role: "user", text: text.slice(0, WEB_CHAT_TEXT_MAX), ts: new Date().toISOString(),
14234
14297
  channel: true, from: webChatFrom(msg.adapterId, msg.userId), ...(posts ? { posts } : {}),
14298
+ ...(msg.messageId ? { anchor: msg.messageId } : {}), // AGEND-181: the transcript names it `(message_id: <platform id>)`
14235
14299
  });
14236
14300
  }
14237
14301
  /** Handle outbound tool calls from a daemon instance */
@@ -14550,7 +14614,7 @@ export class FleetManager {
14550
14614
  && this.landedInOwnChannel(instanceName, replyAdapterId, result);
14551
14615
  }
14552
14616
  catch { /* not known: not the channel's (fail closed), and the bookkeeping below still runs */ }
14553
- void this.afterReplyRouted(instanceName, args, senderSessionName, buttonsView, inChannel, replyAdapterId ? { adapterId: replyAdapterId, result } : undefined, replyIdentity);
14617
+ void this.afterReplyRouted(instanceName, args, senderSessionName, buttonsView, inChannel, replyAdapterId ? { adapterId: replyAdapterId, result } : undefined, replyIdentity, result);
14554
14618
  }
14555
14619
  catch (err) {
14556
14620
  this.logger.warn({ err, instanceName }, "Reply delivered but post-delivery bookkeeping failed");
@@ -14634,7 +14698,9 @@ export class FleetManager {
14634
14698
  return false;
14635
14699
  }
14636
14700
  }
14637
- afterReplyRouted(instanceName, args, senderSessionName, buttons = null, inChannel = false, sentAs, identity = this.webChatIdentity(instanceName)) {
14701
+ afterReplyRouted(instanceName, args, senderSessionName, buttons = null, inChannel = false, sentAs, identity = this.webChatIdentity(instanceName), replyResult = sentAs?.result) {
14702
+ // AGEND-181: the id the reply call returned (also on a fleet with no adapter: web-only), the row's anchor.
14703
+ const returned = replyResult && typeof replyResult === "object" ? replyResult.messageId : undefined;
14638
14704
  // #2281: where the reply is, when it landed in the instance's own place — a web reply to it is then a native reply
14639
14705
  // there. A reply elsewhere (another chat, the web-only sink) records none.
14640
14706
  const sent = (sentAs?.result && typeof sentAs.result === "object" ? sentAs.result : {});
@@ -14686,6 +14752,7 @@ export class FleetManager {
14686
14752
  ...(buttons ? { buttons } : {}), // #1266
14687
14753
  ...(inChannel ? { channel: true } : {}), // #1920 §5.2
14688
14754
  ...(post ? { posts: [post] } : {}), // #2281
14755
+ ...(typeof returned === "string" && returned ? { anchor: returned } : {}), // AGEND-181: what the reply call returned
14689
14756
  ...(reserved !== undefined ? { reserved } : {}), // #1774
14690
14757
  });
14691
14758
  };
@@ -18745,6 +18812,10 @@ export class FleetManager {
18745
18812
  * ClassicBot room's launched or would-be login when the room runs that backend. Null: the backend's default login
18746
18813
  * (also for a backend that has no profiles, where the option is ignored).
18747
18814
  */
18815
+ /** #3715: update_instance_config's ClassicBot room account switch — the room's Settings save (#3691), from a tool. */
18816
+ switchClassicRoomProfile(name, backendOptions) {
18817
+ return switchClassicRoomProfile(this, name, backendOptions);
18818
+ }
18748
18819
  credentialProfileOf(name, backend) {
18749
18820
  if (isWindowsInstance(this.fleetConfig?.instances[name]))
18750
18821
  return null;
@@ -21923,7 +21994,8 @@ export class FleetManager {
21923
21994
  claimWindow: backend => this.loginWindow.tryClaim("web", backend),
21924
21995
  releaseWindow: claim => { this.loginWindow.release(claim); },
21925
21996
  isClaimCurrent: claim => this.loginWindow.isCurrent(claim),
21926
- windowBusyMessage: () => this.loginWindow.busyMessage(),
21997
+ windowBusyMessage: backend => this.loginWindow.busyMessage(backend),
21998
+ windowHolder: backend => this.loginWindow.holderFor(backend),
21927
21999
  tunnelDataDir: () => this.dataDir,
21928
22000
  reserveTunnel: owner => this.getTunnelLane().reserve("login", owner),
21929
22001
  // Throws when the prompt cannot be posted: the controller tells the
@@ -22087,7 +22159,7 @@ export class FleetManager {
22087
22159
  accessToken: sink => this.loginController?.webAccessToken(sink) ?? null,
22088
22160
  isActiveFor: sink => this.loginController?.isActiveFor(sink) ?? false,
22089
22161
  cancelFor: (sink, opts) => this.loginController?.cancelFor(sink, opts) ?? Promise.resolve(false),
22090
- cancel: () => this.cancelLoginSession(),
22162
+ cancel: backend => this.cancelLoginSession(backend),
22091
22163
  notice: ({ shown, label, handle }) => this.notifyFleetError(t("login.web_dashboard_notice", shown, label, handle.slice(0, 8))),
22092
22164
  // No details in the event: each page reads its own view (GET /ui/backend-login), as its session may see it.
22093
22165
  // The accounts are forgotten when ANY sign-in ends, even one a later one replaced (it may be a different account now), and not at every step of a
@@ -22549,7 +22621,7 @@ export class FleetManager {
22549
22621
  const dry = removeAccountProfile(this.dataDir, this.removalRequest(backend, name, confirm, null), undefined, { dryRun: true });
22550
22622
  if (!dry.ok)
22551
22623
  return refused(dry);
22552
- const claim = this.loginWindow.tryClaim("web", backend);
22624
+ const claim = this.loginWindow.tryClaim("account", backend);
22553
22625
  if (!claim)
22554
22626
  return refused({ ok: false, error: "signing_in" });
22555
22627
  const step = await this.withAccountWriter(claim, async (deps) => {
@@ -22621,9 +22693,11 @@ export class FleetManager {
22621
22693
  classic: classic.filter(c => c.backend === backend && same(c.profile)).map(c => c.key),
22622
22694
  fleetDefault: same(fleetDefaults.get(backend)),
22623
22695
  };
22624
- const held = this.loginWindow.current;
22696
+ // The window held on THIS backend, and only a sign-in of THIS backend explains it by account (the precise checks below). Another backend's running sign-in (a Grok terminal beside a
22697
+ // Claude Code logout) says nothing about who holds this one: the held window itself then refuses Remove (a logout's child may still be running).
22698
+ const held = this.loginWindow.heldFor(backend);
22625
22699
  const signingIn = (this.loginController?.signingIn(backend, profile) ?? false) || (this.profileSignInsInstance?.signingIn(backend, profile) ?? false)
22626
- || (!!held && held !== ownClaim && held.backend === backend && !this.loginController?.activeBackend && !this.profileSignInsInstance?.active); // a named account's sign-in holds the window too, and says WHICH account (above)
22700
+ || (!!held && held !== ownClaim && this.loginController?.activeBackend !== backend && this.profileSignInsInstance?.active?.backend !== backend); // a named account's sign-in holds the window too, and says WHICH account (above)
22627
22701
  return { backend, name, confirm, users, signingIn, usersUnknown: rooms.kind === "unknown" };
22628
22702
  }
22629
22703
  /**
@@ -22680,7 +22754,7 @@ export class FleetManager {
22680
22754
  // #3305 review P2-3: the logout holds the shared login window from before it runs until its cleanup is done — no
22681
22755
  // sign-in (chat, dashboard, install) and no other logout starts meanwhile; one already running refuses this.
22682
22756
  const signingIn = (this.loginController?.signingIn(backend, named) ?? false) || (named !== null && (this.profileSignInsInstance?.signingIn(backend, named) ?? false));
22683
- const claim = signingIn ? null : this.loginWindow.tryClaim("web", backend);
22757
+ const claim = signingIn ? null : this.loginWindow.tryClaim("account", backend);
22684
22758
  let result;
22685
22759
  if (!claim)
22686
22760
  result = { ok: false, error: "signing_in" };
@@ -23101,30 +23175,37 @@ export class FleetManager {
23101
23175
  bounded(this.accountWriters.size ? Promise.all([...this.accountWriters]).then(() => undefined) : undefined, "account-logout"),
23102
23176
  ]);
23103
23177
  }
23104
- /** `/login cancel` — abort the active session and remove its window. */
23105
- async cancelLoginSession() {
23178
+ /**
23179
+ * `/login cancel` — abort the active session and remove its window. `backend` (AGEND-203, the dashboard's "Cancel the running sign-in" on a refused start): only the
23180
+ * sign-in or install running on that backend; nothing else is touched, and the answer says none ran when there is none.
23181
+ */
23182
+ async cancelLoginSession(backend) {
23183
+ const mine = (b) => backend === undefined || b === backend;
23106
23184
  // `/login cancel` also stops an install that `/login` started — and the
23107
23185
  // sign-in an install that just succeeded is about to hand over to.
23108
- if (this.activeInstall)
23186
+ if (this.activeInstall && mine(this.activeInstall.backend))
23109
23187
  return this.cancelInstallSession();
23110
- if (this.installHandoff) {
23111
- const { backend } = this.installHandoff;
23188
+ if (this.installHandoff && mine(this.installHandoff.backend)) {
23189
+ const { backend: handedOff } = this.installHandoff;
23112
23190
  this.installHandoff.cancelled = true;
23113
23191
  this.installHandoff = null;
23114
- return t("login.cancelled", backend);
23192
+ return t("login.cancelled", handedOff);
23115
23193
  }
23116
23194
  const browserLogin = this.browserBackendSignInsInstance, browserBackend = browserLogin?.activeBackend;
23117
- if (browserLogin && browserBackend) {
23195
+ if (browserLogin && browserBackend && mine(browserBackend)) {
23118
23196
  const confirmed = await browserLogin.close();
23119
23197
  if (confirmed)
23120
23198
  this.browserBackendSignInsInstance = null;
23121
23199
  return confirmed ? t("login.cancelled", browserBackend) : t("login.browser_cleanup_failed");
23122
23200
  }
23123
23201
  // #3212: a named account's sign-in on this host ("Cancel sign-in and remove" and `/login cancel` end it as they end the others).
23124
- const ended = await this.profileSignInsInstance?.cancelActive();
23125
- if (ended)
23126
- return ended.confirmed ? t("login.cancelled", t("login.profile_label", ended.target.backend, ended.target.profile)) : t("login.browser_cleanup_failed");
23127
- if (this.loginController?.isActive())
23202
+ const target = this.profileSignInsInstance?.active ?? null;
23203
+ if (!target || mine(target.backend)) {
23204
+ const ended = await this.profileSignInsInstance?.cancelActive();
23205
+ if (ended)
23206
+ return ended.confirmed ? t("login.cancelled", t("login.profile_label", ended.target.backend, ended.target.profile)) : t("login.browser_cleanup_failed");
23207
+ }
23208
+ if (this.loginController?.isActive() && mine(this.loginController.pendingBackend))
23128
23209
  return this.loginController.cancel();
23129
23210
  return t("login.no_session");
23130
23211
  }
@@ -23280,7 +23361,7 @@ export class FleetManager {
23280
23361
  return t("install.already", backend, info.binary);
23281
23362
  }
23282
23363
  if (!claim)
23283
- return this.loginWindow.busyMessage();
23364
+ return this.loginWindow.busyMessage(backend);
23284
23365
  // M-2281: the installer's output, live, in the chat that asked — no page shows this window.
23285
23366
  // Telegram gets its own <pre> (its markdown conversion keeps a fence as literal backticks); others a fenced block.
23286
23367
  const frameStyle = chat.adapter.type === "telegram" ? "html" : "markdown";
@@ -23774,6 +23855,7 @@ export class FleetManager {
23774
23855
  instance: String(m.instance ?? ""), sender: String(m.sender ?? ""), text: String(m.text ?? ""), ts: String(m.ts ?? new Date().toISOString()),
23775
23856
  attachments: Array.isArray(m.attachments) ? m.attachments : undefined,
23776
23857
  messageId: typeof m.messageId === "string" ? m.messageId : undefined,
23858
+ anchor: typeof m.anchor === "string" ? m.anchor : undefined,
23777
23859
  role: typeof m.role === "string" ? m.role : undefined,
23778
23860
  buttons: m.buttons,
23779
23861
  click: m.click,