@songsid/agend 2.3.5-alpha.5 → 2.3.5-alpha.7
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.
- package/THIRD_PARTY_NOTICES.md +0 -1
- package/dist/accounts-profiles.d.ts +96 -0
- package/dist/accounts-profiles.js +178 -0
- package/dist/accounts-profiles.js.map +1 -0
- package/dist/accounts-signout.d.ts +59 -0
- package/dist/accounts-signout.js +184 -0
- package/dist/accounts-signout.js.map +1 -0
- package/dist/accounts-view.d.ts +54 -0
- package/dist/accounts-view.js +55 -11
- package/dist/accounts-view.js.map +1 -1
- package/dist/agent-workspace.d.ts +11 -0
- package/dist/agent-workspace.js +28 -0
- package/dist/agent-workspace.js.map +1 -1
- package/dist/auth-api.js +38 -5
- package/dist/auth-api.js.map +1 -1
- package/dist/authority/session-authorizations.d.ts +2 -0
- package/dist/authority/session-authorizations.js +7 -1
- package/dist/authority/session-authorizations.js.map +1 -1
- package/dist/authority/web-authority.d.ts +13 -0
- package/dist/authority/web-authority.js +12 -0
- package/dist/authority/web-authority.js.map +1 -1
- package/dist/backend/claude-code.js +47 -9
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/codex.js +1 -0
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/kiro.js +1 -1
- package/dist/backend/kiro.js.map +1 -1
- package/dist/backend/types.d.ts +2 -0
- package/dist/backend/types.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/bundled-tmux-guard.d.ts +19 -0
- package/dist/bundled-tmux-guard.js +83 -0
- package/dist/bundled-tmux-guard.js.map +1 -0
- package/dist/channel/access-manager.d.ts +1 -6
- package/dist/channel/access-manager.js +4 -94
- package/dist/channel/access-manager.js.map +1 -1
- package/dist/channel/adapters/discord.d.ts +0 -2
- package/dist/channel/adapters/discord.js +0 -8
- package/dist/channel/adapters/discord.js.map +1 -1
- package/dist/channel/adapters/telegram.d.ts +0 -3
- package/dist/channel/adapters/telegram.js +1 -30
- package/dist/channel/adapters/telegram.js.map +1 -1
- package/dist/channel/types.d.ts +0 -2
- package/dist/classic-bindings.d.ts +13 -0
- package/dist/classic-bindings.js +28 -2
- package/dist/classic-bindings.js.map +1 -1
- package/dist/classic-channel-manager.d.ts +2 -0
- package/dist/classic-channel-manager.js +5 -1
- package/dist/classic-channel-manager.js.map +1 -1
- package/dist/cli.js +117 -30
- package/dist/cli.js.map +1 -1
- package/dist/config-validator.js +11 -0
- package/dist/config-validator.js.map +1 -1
- package/dist/config.js +3 -1
- package/dist/config.js.map +1 -1
- package/dist/daemon.d.ts +27 -2
- package/dist/daemon.js +107 -6
- package/dist/daemon.js.map +1 -1
- package/dist/doctor.js +3 -4
- package/dist/doctor.js.map +1 -1
- package/dist/e2e-isolation.js +5 -2
- package/dist/e2e-isolation.js.map +1 -1
- package/dist/fleet-control-audit.d.ts +1 -1
- package/dist/fleet-manager.d.ts +188 -1
- package/dist/fleet-manager.js +1059 -79
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +22 -7
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +10 -0
- package/dist/general-knowledge/steering/core-rules.md +6 -4
- package/dist/hub/buttons.js +4 -2
- package/dist/hub/buttons.js.map +1 -1
- package/dist/hub/catalog.d.ts +1 -1
- package/dist/hub/catalog.js +82 -15
- package/dist/hub/catalog.js.map +1 -1
- package/dist/hub/compose/server.d.ts +4 -1
- package/dist/hub/compose/server.js +30 -3
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/directory/directory.d.ts +1 -1
- package/dist/hub/directory/directory.js +142 -21
- package/dist/hub/directory/directory.js.map +1 -1
- package/dist/hub/directory/groups.d.ts +29 -0
- package/dist/hub/directory/groups.js +29 -0
- package/dist/hub/directory/groups.js.map +1 -0
- package/dist/hub/directory/index.d.ts +2 -1
- package/dist/hub/directory/types.d.ts +12 -2
- package/dist/hub/directory/types.js.map +1 -1
- package/dist/hub/group-policy/admin-context.d.ts +23 -0
- package/dist/hub/group-policy/admin-context.js +52 -0
- package/dist/hub/group-policy/admin-context.js.map +1 -0
- package/dist/hub/group-policy/admin-dto.d.ts +235 -0
- package/dist/hub/group-policy/admin-dto.js +55 -0
- package/dist/hub/group-policy/admin-dto.js.map +1 -0
- package/dist/hub/group-policy/admin-inventory.d.ts +24 -0
- package/dist/hub/group-policy/admin-inventory.js +72 -0
- package/dist/hub/group-policy/admin-inventory.js.map +1 -0
- package/dist/hub/group-policy/admin-read.d.ts +21 -0
- package/dist/hub/group-policy/admin-read.js +90 -0
- package/dist/hub/group-policy/admin-read.js.map +1 -0
- package/dist/hub/group-policy/authorization.d.ts +43 -0
- package/dist/hub/group-policy/authorization.js +170 -0
- package/dist/hub/group-policy/authorization.js.map +1 -0
- package/dist/hub/group-policy/model.d.ts +56 -0
- package/dist/hub/group-policy/model.js +46 -0
- package/dist/hub/group-policy/model.js.map +1 -0
- package/dist/hub/group-policy/resources.d.ts +60 -0
- package/dist/hub/group-policy/resources.js +191 -0
- package/dist/hub/group-policy/resources.js.map +1 -0
- package/dist/hub/group-policy/store.d.ts +58 -0
- package/dist/hub/group-policy/store.js +155 -0
- package/dist/hub/group-policy/store.js.map +1 -0
- package/dist/hub/http/compose.js +9 -9
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/core.d.ts +23 -3
- package/dist/hub/http/core.js +138 -5
- package/dist/hub/http/core.js.map +1 -1
- package/dist/hub/http/deps.d.ts +3 -0
- package/dist/hub/pairing.d.ts +3 -1
- package/dist/hub/pairing.js +6 -3
- package/dist/hub/pairing.js.map +1 -1
- package/dist/hub/policy.d.ts +3 -1
- package/dist/hub/policy.js +13 -6
- package/dist/hub/policy.js.map +1 -1
- package/dist/hub/rooms.d.ts +1 -0
- package/dist/hub/rooms.js +76 -26
- package/dist/hub/rooms.js.map +1 -1
- package/dist/hub/server.d.ts +2 -0
- package/dist/hub/server.js +12 -2
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/sessions.js +2 -1
- package/dist/hub/sessions.js.map +1 -1
- package/dist/hub/types.d.ts +2 -0
- package/dist/instance-config-impact.js +4 -3
- package/dist/instance-config-impact.js.map +1 -1
- package/dist/instance-lifecycle.d.ts +17 -0
- package/dist/instance-lifecycle.js +38 -1
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/locale.js +45 -18
- package/dist/locale.js.map +1 -1
- package/dist/login-controller.d.ts +5 -0
- package/dist/login-controller.js +11 -0
- package/dist/login-controller.js.map +1 -1
- package/dist/login-window-lock.d.ts +2 -1
- package/dist/login-window-lock.js.map +1 -1
- package/dist/ls-rows.d.ts +1 -1
- package/dist/ls-rows.js +1 -1
- package/dist/ls-rows.js.map +1 -1
- package/dist/machine-accounts.d.ts +110 -0
- package/dist/machine-accounts.js +229 -0
- package/dist/machine-accounts.js.map +1 -0
- package/dist/machine-signins.d.ts +89 -0
- package/dist/machine-signins.js +182 -0
- package/dist/machine-signins.js.map +1 -0
- package/dist/muse-usage-relay.d.ts +2 -0
- package/dist/muse-usage-relay.js +5 -3
- package/dist/muse-usage-relay.js.map +1 -1
- package/dist/needs-you-hub.d.ts +3 -0
- package/dist/needs-you-hub.js +13 -3
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you.d.ts +35 -2
- package/dist/needs-you.js +19 -0
- package/dist/needs-you.js.map +1 -1
- package/dist/quickstart.js +7 -18
- package/dist/quickstart.js.map +1 -1
- package/dist/quiet-run.d.ts +31 -0
- package/dist/quiet-run.js +50 -0
- package/dist/quiet-run.js.map +1 -0
- package/dist/quota-notice-config.d.ts +22 -0
- package/dist/quota-notice-config.js +41 -0
- package/dist/quota-notice-config.js.map +1 -0
- package/dist/runtime-api.d.ts +13 -0
- package/dist/runtime-api.js +134 -2
- package/dist/runtime-api.js.map +1 -1
- package/dist/runtime-build-info.d.ts +2 -1
- package/dist/runtime-build-info.js +7 -3
- package/dist/runtime-build-info.js.map +1 -1
- package/dist/runtime-cli-install.d.ts +153 -0
- package/dist/runtime-cli-install.js +675 -0
- package/dist/runtime-cli-install.js.map +1 -0
- package/dist/runtime-cli.js +157 -12
- package/dist/runtime-cli.js.map +1 -1
- package/dist/runtime-client.d.ts +64 -2
- package/dist/runtime-client.js +277 -20
- package/dist/runtime-client.js.map +1 -1
- package/dist/runtime-coordinator.d.ts +10 -1
- package/dist/runtime-coordinator.js +93 -2
- package/dist/runtime-coordinator.js.map +1 -1
- package/dist/runtime-credential-profiles.d.ts +11 -2
- package/dist/runtime-credential-profiles.js +28 -4
- package/dist/runtime-credential-profiles.js.map +1 -1
- package/dist/runtime-install.js +9 -6
- package/dist/runtime-install.js.map +1 -1
- package/dist/runtime-pane-link.js +2 -1
- package/dist/runtime-pane-link.js.map +1 -1
- package/dist/runtime-pane-service.js +2 -2
- package/dist/runtime-pane-service.js.map +1 -1
- package/dist/runtime-pane-store.d.ts +10 -0
- package/dist/runtime-pane-store.js +13 -1
- package/dist/runtime-pane-store.js.map +1 -1
- package/dist/runtime-profile-ownership.d.ts +66 -0
- package/dist/runtime-profile-ownership.js +391 -0
- package/dist/runtime-profile-ownership.js.map +1 -0
- package/dist/runtime-protocol.d.ts +88 -2
- package/dist/runtime-protocol.js +40 -0
- package/dist/runtime-protocol.js.map +1 -1
- package/dist/runtime-remote-accounts.d.ts +197 -0
- package/dist/runtime-remote-accounts.js +663 -0
- package/dist/runtime-remote-accounts.js.map +1 -0
- package/dist/runtime-remote-setup.d.ts +105 -0
- package/dist/runtime-remote-setup.js +529 -0
- package/dist/runtime-remote-setup.js.map +1 -0
- package/dist/runtime-signin-transport.d.ts +39 -0
- package/dist/runtime-signin-transport.js +110 -0
- package/dist/runtime-signin-transport.js.map +1 -0
- package/dist/runtime-signin.d.ts +132 -0
- package/dist/runtime-signin.js +289 -0
- package/dist/runtime-signin.js.map +1 -0
- package/dist/runtime-update-attention.d.ts +4 -0
- package/dist/runtime-update-attention.js +11 -0
- package/dist/runtime-update-attention.js.map +1 -0
- package/dist/runtime-update-controller.d.ts +75 -0
- package/dist/runtime-update-controller.js +691 -0
- package/dist/runtime-update-controller.js.map +1 -0
- package/dist/runtime-update-ipc.d.ts +42 -0
- package/dist/runtime-update-ipc.js +144 -0
- package/dist/runtime-update-ipc.js.map +1 -0
- package/dist/runtime-update-journal.d.ts +5 -0
- package/dist/runtime-update-journal.js +7 -0
- package/dist/runtime-update-journal.js.map +1 -1
- package/dist/runtime-update-lock.js +17 -2
- package/dist/runtime-update-lock.js.map +1 -1
- package/dist/runtime-update-status.d.ts +30 -0
- package/dist/runtime-update-status.js +31 -0
- package/dist/runtime-update-status.js.map +1 -0
- package/dist/settings-api.js +6 -2
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-change.d.ts +10 -0
- package/dist/settings-change.js +25 -1
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-confirmation.d.ts +25 -1
- package/dist/settings-confirmation.js +11 -3
- package/dist/settings-confirmation.js.map +1 -1
- package/dist/settings-effect.js +18 -6
- package/dist/settings-effect.js.map +1 -1
- package/dist/settings-http-confirmation.d.ts +21 -0
- package/dist/settings-http-confirmation.js +74 -3
- package/dist/settings-http-confirmation.js.map +1 -1
- package/dist/settings-instance-patch.js +1 -1
- package/dist/settings-instance-patch.js.map +1 -1
- package/dist/setup-wizard.js +3 -5
- package/dist/setup-wizard.js.map +1 -1
- package/dist/signin-keepalive.d.ts +203 -0
- package/dist/signin-keepalive.js +652 -0
- package/dist/signin-keepalive.js.map +1 -0
- package/dist/structured-signin-transport.js +4 -0
- package/dist/structured-signin-transport.js.map +1 -1
- package/dist/structured-signin.d.ts +7 -0
- package/dist/structured-signin.js +4 -2
- package/dist/structured-signin.js.map +1 -1
- package/dist/tips.js +4 -4
- package/dist/tips.js.map +1 -1
- package/dist/tmux-binary.d.ts +23 -23
- package/dist/tmux-binary.js +35 -46
- package/dist/tmux-binary.js.map +1 -1
- package/dist/tmux-exec-helper.js +3 -3
- package/dist/tmux-exec-helper.js.map +1 -1
- package/dist/tmux-legacy.d.ts +94 -0
- package/dist/tmux-legacy.js +309 -0
- package/dist/tmux-legacy.js.map +1 -0
- package/dist/tmux-manager.d.ts +7 -1
- package/dist/tmux-manager.js +21 -11
- package/dist/tmux-manager.js.map +1 -1
- package/dist/tmux-rollback.d.ts +31 -0
- package/dist/tmux-rollback.js +72 -0
- package/dist/tmux-rollback.js.map +1 -0
- package/dist/tmux-server.d.ts +102 -0
- package/dist/tmux-server.js +248 -0
- package/dist/tmux-server.js.map +1 -0
- package/dist/transcript-monitor.js +43 -5
- package/dist/transcript-monitor.js.map +1 -1
- package/dist/transcript-records.d.ts +2 -1
- package/dist/transcript-records.js +3 -0
- package/dist/transcript-records.js.map +1 -1
- package/dist/transcript-sources.js +3 -0
- package/dist/transcript-sources.js.map +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/types.js.map +1 -1
- package/dist/ui/accounts-keepalive.js +113 -0
- package/dist/ui/accounts-manage.js +237 -0
- package/dist/ui/accounts-view.js +191 -36
- package/dist/ui/agent-runtime-settings.js +2 -1
- package/dist/ui/app.html +8 -1
- package/dist/ui/backend-signin.js +12 -3
- package/dist/ui/general-location.js +28 -14
- package/dist/ui/hub-attachments.js +90 -0
- package/dist/ui/hub-chat-store.js +11 -5
- package/dist/ui/hub-client.js +20 -1
- package/dist/ui/hub-grant-strings.js +13 -0
- package/dist/ui/hub-owner-strings.js +6 -2
- package/dist/ui/hub-preview.js +101 -0
- package/dist/ui/hub-strings.js +4 -2
- package/dist/ui/machine-signin.js +56 -0
- package/dist/ui/panel-fleet.js +1 -1
- package/dist/ui/panel-hub.js +194 -54
- package/dist/ui/panel-log.js +2 -2
- package/dist/ui/panel-needs.js +14 -8
- package/dist/ui/panel-notices.js +4 -3
- package/dist/ui/panel-runtimes.js +32 -11
- package/dist/ui/panel-settings.js +18 -24
- package/dist/ui/panel-windows-agent.js +2 -1
- package/dist/ui/preview-pages.js +3 -41
- package/dist/ui/preview-panel-actions.js +3 -161
- package/dist/ui/preview-panel.js +10 -557
- package/dist/ui/preview-versions.js +3 -155
- package/dist/ui/runtime-cli-install.js +134 -0
- package/dist/ui/runtime-update-commands.d.ts +2 -0
- package/dist/ui/runtime-update-commands.js +11 -0
- package/dist/ui/runtime-update-status.js +53 -0
- package/dist/ui/search-dialog.js +3 -2
- package/dist/ui/settings-confirm.js +28 -0
- package/dist/ui/settings-devices.js +6 -10
- package/dist/ui/settings-guests.js +3 -2
- package/dist/ui/settings-hub-browser-certificate.js +2 -0
- package/dist/ui/settings-hub-membership.js +17 -11
- package/dist/ui/settings-hub-retention.js +2 -0
- package/dist/ui/settings-hub-section.js +35 -0
- package/dist/ui/settings-hub.js +17 -5
- package/dist/ui/settings-layout.js +6 -2
- package/dist/ui/settings-named-test.js +2 -2
- package/dist/ui/settings-outside.js +1 -1
- package/dist/ui/settings-quota-notice.js +102 -0
- package/dist/ui/settings-registry.js +4 -0
- package/dist/ui/settings-strings.js +6 -6
- package/dist/ui/settings-web-authority.js +2 -1
- package/dist/ui/shared/accounts-keepalive.css +7 -0
- package/dist/ui/shared/accounts.css +13 -0
- package/dist/ui/shared/app-i18n.js +4 -2
- package/dist/ui/shared/app-route.js +1 -1
- package/dist/ui/shared/app-shell.js +111 -8
- package/dist/ui/shared/app-store.js +2 -2
- package/dist/ui/shared/app.css +29 -0
- package/dist/ui/shared/app.js +2 -1
- package/dist/ui/shared/chat-strings.js +8 -8
- package/dist/ui/shared/hub-chat.css +1 -0
- package/dist/ui/shared/hub-owner.css +3 -3
- package/dist/ui/shared/hub-signin.css +24 -0
- package/dist/ui/shared/loading.css +37 -0
- package/dist/ui/shared/preview-pages.js +41 -0
- package/dist/ui/shared/preview-panel-actions.js +168 -0
- package/dist/ui/shared/preview-panel.js +565 -0
- package/dist/ui/shared/preview-versions.js +155 -0
- package/dist/ui/shared/runtime-install.css +4 -0
- package/dist/ui/shared/signin.js +68 -6
- package/dist/ui/shared/ui-states.js +14 -3
- package/dist/ui/shared/view-strings.js +4 -4
- package/dist/ui/shared/workspace-follow.css +19 -0
- package/dist/ui/signin.html +7 -3
- package/dist/ui/structured-signin.js +43 -11
- package/dist/ui/workspace-follow-strings.js +28 -0
- package/dist/ui/workspace-panel.js +225 -36
- package/dist/update-install.d.ts +7 -0
- package/dist/update-install.js +23 -0
- package/dist/update-install.js.map +1 -1
- package/dist/usage/providers.d.ts +6 -0
- package/dist/usage/providers.js +18 -9
- package/dist/usage/providers.js.map +1 -1
- package/dist/usage/quota-notices.d.ts +38 -0
- package/dist/usage/quota-notices.js +160 -0
- package/dist/usage/quota-notices.js.map +1 -0
- package/dist/usage/usage-api.d.ts +1 -0
- package/dist/usage/usage-api.js +16 -0
- package/dist/usage/usage-api.js.map +1 -1
- package/dist/web-api.d.ts +38 -0
- package/dist/web-api.js +357 -14
- package/dist/web-api.js.map +1 -1
- package/dist/web-login.d.ts +35 -1
- package/dist/web-login.js +51 -5
- package/dist/web-login.js.map +1 -1
- package/dist/web-remote-access.d.ts +6 -0
- package/dist/web-remote-access.js +10 -1
- package/dist/web-remote-access.js.map +1 -1
- package/dist/web-session.d.ts +11 -0
- package/dist/web-session.js +38 -1
- package/dist/web-session.js.map +1 -1
- package/dist/web-shell-routes.d.ts +1 -1
- package/dist/web-shell-routes.js +1 -1
- package/dist/web-shell-routes.js.map +1 -1
- package/dist/web-signin-link.d.ts +42 -0
- package/dist/web-signin-link.js +110 -0
- package/dist/web-signin-link.js.map +1 -0
- package/dist/windows-cli-api.d.ts +14 -0
- package/dist/windows-cli-api.js +21 -0
- package/dist/windows-cli-api.js.map +1 -1
- package/dist/windows-cli-worker.d.ts +3 -1
- package/dist/windows-cli-worker.js +18 -3
- package/dist/windows-cli-worker.js.map +1 -1
- package/dist/workspace-follow-parse.d.ts +36 -0
- package/dist/workspace-follow-parse.js +208 -0
- package/dist/workspace-follow-parse.js.map +1 -0
- package/dist/workspace-follow-records.d.ts +17 -0
- package/dist/workspace-follow-records.js +88 -0
- package/dist/workspace-follow-records.js.map +1 -0
- package/dist/workspace-follow.d.ts +41 -0
- package/dist/workspace-follow.js +143 -0
- package/dist/workspace-follow.js.map +1 -0
- package/dist/wsl-detect.d.ts +1 -0
- package/dist/wsl-detect.js +20 -0
- package/dist/wsl-detect.js.map +1 -0
- package/launcher/tmux-bundle.cjs +26 -10
- package/package.json +7 -2
- package/templates/runtime-install/install.ps1 +154 -13
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -141,5 +141,4 @@ component's full licence text in its `LICENSES/` directory:
|
|
|
141
141
|
| libevent, https://libevent.org | 2.1.12-stable | BSD-3-Clause | linked statically |
|
|
142
142
|
| ncurses, https://invisible-island.net/ncurses/ | 6.5 | X11 (MIT-style) | linked statically; the terminfo subset is compiled from its `misc/terminfo.src` |
|
|
143
143
|
| utf8proc, https://github.com/JuliaStrings/utf8proc | 2.12.0 | MIT, and the Unicode License v3 for its data tables | linked statically |
|
|
144
|
-
| jemalloc, https://jemalloc.net | 5.3.0 | BSD-2-Clause | linked statically, macOS builds only |
|
|
145
144
|
| musl libc, https://musl.libc.org | 1.2.5 (the Alpine build image's, checked at build time) | MIT | linked statically, Linux builds only |
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #3212 PR 2: adding and removing a named account (a credential profile) on this host, from Settings → Accounts.
|
|
3
|
+
*
|
|
4
|
+
* Add creates `<AGEND_HOME>/credential-profiles/<backend>/<name>` (private to this account) and nothing else: signing it
|
|
5
|
+
* in prepares it as a launch does (login-controller.ts, prepareCredentialProfileHome).
|
|
6
|
+
*
|
|
7
|
+
* Remove deletes that folder — its sign-in and, for Claude Code, its own copies of conversations — and is refused,
|
|
8
|
+
* with nothing deleted, unless every one of these holds (the safeguards agreed on #3212, issuecomment-6684192752):
|
|
9
|
+
* - no host agent, ClassicBot room or fleet default uses it (the caller passes who does; the refusal names them);
|
|
10
|
+
* - the request names the profile again (the typed confirmation);
|
|
11
|
+
* - it is one of the three profile backends and a valid, Windows-safe name;
|
|
12
|
+
* - no sign-in for it is running (the caller asks the login controller);
|
|
13
|
+
* - the folder is AgEnD's own: `<root>/<backend>/<name>` with no link at any level, each level a real directory owned
|
|
14
|
+
* by the account running AgEnD, and its real path exactly that place under the real root;
|
|
15
|
+
* - it is not, does not contain and is not inside the CLI's default sign-in home.
|
|
16
|
+
* The folder is renamed to a hidden sibling first, checked again to be the same folder, and only then deleted; the
|
|
17
|
+
* delete never follows a link inside it (a relocated home links shared parts back to the default home).
|
|
18
|
+
*
|
|
19
|
+
* No path, file name or folder content leaves this module in an answer: refusals are codes, with names only.
|
|
20
|
+
*/
|
|
21
|
+
import { type Stats } from "node:fs";
|
|
22
|
+
export declare const PROFILES_DIRECTORY = "credential-profiles";
|
|
23
|
+
/** Who still uses a profile: host agents, ClassicBot rooms (by key) and whether the fleet default names it. */
|
|
24
|
+
export interface ProfileUsers {
|
|
25
|
+
agents: string[];
|
|
26
|
+
classic: string[];
|
|
27
|
+
fleetDefault: boolean;
|
|
28
|
+
}
|
|
29
|
+
export type AddRefusal = "backend" | "name" | "exists" | "case_clash" | "unsafe_root";
|
|
30
|
+
export type RemoveRefusal = "backend" | "name" | "confirm" | "in_use" | "users_unknown" | "signing_in" | "missing" | "unsafe" | "default_home" | "failed";
|
|
31
|
+
export type AddResult = {
|
|
32
|
+
ok: true;
|
|
33
|
+
} | {
|
|
34
|
+
ok: false;
|
|
35
|
+
error: AddRefusal;
|
|
36
|
+
clash?: string;
|
|
37
|
+
};
|
|
38
|
+
export type RemoveResult = {
|
|
39
|
+
ok: true;
|
|
40
|
+
keychainLeft?: true;
|
|
41
|
+
identity?: {
|
|
42
|
+
dev: number;
|
|
43
|
+
ino: number;
|
|
44
|
+
};
|
|
45
|
+
} | {
|
|
46
|
+
ok: false;
|
|
47
|
+
error: RemoveRefusal;
|
|
48
|
+
users?: ProfileUsers;
|
|
49
|
+
};
|
|
50
|
+
export interface ProfileFs {
|
|
51
|
+
/** The account running AgEnD; null where the platform has none (then ownership is not checked). */
|
|
52
|
+
uid: number | null;
|
|
53
|
+
/** The CLI's default sign-in home (credential-profile.ts sharedRoot), for the never-the-default-home check. */
|
|
54
|
+
defaultHome(backend: string): string | null;
|
|
55
|
+
}
|
|
56
|
+
export declare const realFs: () => ProfileFs;
|
|
57
|
+
/**
|
|
58
|
+
* Create a profile's folder. `configured`: the profile names the configuration already refers to for this backend (an
|
|
59
|
+
* agent, a room or the fleet default may name one whose folder does not exist yet).
|
|
60
|
+
*/
|
|
61
|
+
export declare function addAccountProfile(dataDir: string, backend: string, name: unknown, configured?: Iterable<string>, fs?: ProfileFs): AddResult;
|
|
62
|
+
export interface RemoveRequest {
|
|
63
|
+
backend: string;
|
|
64
|
+
name: unknown;
|
|
65
|
+
/** What the person typed: must be the name itself. */
|
|
66
|
+
confirm: unknown;
|
|
67
|
+
/** Who uses it now (the configuration's view; host agents only). */
|
|
68
|
+
users: ProfileUsers;
|
|
69
|
+
/** A sign-in for this backend and profile is running (or one for this backend is starting and its profile is not known). */
|
|
70
|
+
signingIn: boolean;
|
|
71
|
+
/** Who uses it could not be read completely (ClassicBot's settings unreadable or malformed): nothing proves it unused. */
|
|
72
|
+
usersUnknown?: boolean;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The folder of an existing profile, when it is AgEnD's own (Remove's and Sign out's check): `<root>/<backend>/<name>`,
|
|
76
|
+
* each level a real directory (never a link) owned by this account, its real path exactly that place under the real
|
|
77
|
+
* root, and neither the CLI's default sign-in home nor inside or around it. `name` must already be valid.
|
|
78
|
+
*/
|
|
79
|
+
export declare function ownProfileFolder(dataDir: string, backend: string, name: string, fs?: ProfileFs): {
|
|
80
|
+
ok: true;
|
|
81
|
+
base: string;
|
|
82
|
+
home: string;
|
|
83
|
+
st: Stats;
|
|
84
|
+
realRoot: string;
|
|
85
|
+
} | {
|
|
86
|
+
ok: false;
|
|
87
|
+
error: "missing" | "unsafe" | "default_home";
|
|
88
|
+
};
|
|
89
|
+
/** Remove a profile's folder, or refuse (nothing deleted). See the module comment for every rule. */
|
|
90
|
+
export declare function removeAccountProfile(dataDir: string, req: RemoveRequest, fs?: ProfileFs, opts?: {
|
|
91
|
+
dryRun?: boolean;
|
|
92
|
+
expect?: {
|
|
93
|
+
dev: number;
|
|
94
|
+
ino: number;
|
|
95
|
+
};
|
|
96
|
+
}): RemoveResult;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #3212 PR 2: adding and removing a named account (a credential profile) on this host, from Settings → Accounts.
|
|
3
|
+
*
|
|
4
|
+
* Add creates `<AGEND_HOME>/credential-profiles/<backend>/<name>` (private to this account) and nothing else: signing it
|
|
5
|
+
* in prepares it as a launch does (login-controller.ts, prepareCredentialProfileHome).
|
|
6
|
+
*
|
|
7
|
+
* Remove deletes that folder — its sign-in and, for Claude Code, its own copies of conversations — and is refused,
|
|
8
|
+
* with nothing deleted, unless every one of these holds (the safeguards agreed on #3212, issuecomment-6684192752):
|
|
9
|
+
* - no host agent, ClassicBot room or fleet default uses it (the caller passes who does; the refusal names them);
|
|
10
|
+
* - the request names the profile again (the typed confirmation);
|
|
11
|
+
* - it is one of the three profile backends and a valid, Windows-safe name;
|
|
12
|
+
* - no sign-in for it is running (the caller asks the login controller);
|
|
13
|
+
* - the folder is AgEnD's own: `<root>/<backend>/<name>` with no link at any level, each level a real directory owned
|
|
14
|
+
* by the account running AgEnD, and its real path exactly that place under the real root;
|
|
15
|
+
* - it is not, does not contain and is not inside the CLI's default sign-in home.
|
|
16
|
+
* The folder is renamed to a hidden sibling first, checked again to be the same folder, and only then deleted; the
|
|
17
|
+
* delete never follows a link inside it (a relocated home links shared parts back to the default home).
|
|
18
|
+
*
|
|
19
|
+
* No path, file name or folder content leaves this module in an answer: refusals are codes, with names only.
|
|
20
|
+
*/
|
|
21
|
+
import { lstatSync, mkdirSync, readdirSync, realpathSync, renameSync, rmSync } from "node:fs";
|
|
22
|
+
import { randomBytes } from "node:crypto";
|
|
23
|
+
import { join, relative, isAbsolute, sep } from "node:path";
|
|
24
|
+
import { credentialHomeSpec } from "./backend/credential-profile.js";
|
|
25
|
+
import { validCredentialProfileName } from "./runtime-credential-profiles.js";
|
|
26
|
+
import { PROFILE_CLIS } from "./accounts-view.js";
|
|
27
|
+
export const PROFILES_DIRECTORY = "credential-profiles";
|
|
28
|
+
export const realFs = () => ({
|
|
29
|
+
uid: typeof process.getuid === "function" ? process.getuid() : null,
|
|
30
|
+
defaultHome: backend => { try {
|
|
31
|
+
return credentialHomeSpec(backend)?.sharedRoot() ?? null;
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return null;
|
|
35
|
+
} },
|
|
36
|
+
});
|
|
37
|
+
const lst = (path) => { try {
|
|
38
|
+
return lstatSync(path);
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return null;
|
|
42
|
+
} };
|
|
43
|
+
/** A real directory (never a link) owned by `uid` (when there is one). */
|
|
44
|
+
const ownDir = (st, uid) => !!st && st.isDirectory() && !st.isSymbolicLink() && (uid === null || st.uid === uid);
|
|
45
|
+
/** `inner` is `outer` or below it. */
|
|
46
|
+
const within = (outer, inner) => { const r = relative(outer, inner); return r === "" || (!r.startsWith("..") && !isAbsolute(r)); };
|
|
47
|
+
const realOrNull = (path) => { try {
|
|
48
|
+
return realpathSync(path);
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return null;
|
|
52
|
+
} };
|
|
53
|
+
/** Every name that is (or would be) the same folder as `name` on a case-insensitive disk (Windows, default macOS). */
|
|
54
|
+
function caseClash(name, names) {
|
|
55
|
+
for (const other of names)
|
|
56
|
+
if (other !== name && other.toLowerCase() === name.toLowerCase())
|
|
57
|
+
return other;
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Create a profile's folder. `configured`: the profile names the configuration already refers to for this backend (an
|
|
62
|
+
* agent, a room or the fleet default may name one whose folder does not exist yet).
|
|
63
|
+
*/
|
|
64
|
+
export function addAccountProfile(dataDir, backend, name, configured = [], fs = realFs()) {
|
|
65
|
+
if (!PROFILE_CLIS.has(backend))
|
|
66
|
+
return { ok: false, error: "backend" };
|
|
67
|
+
if (!validCredentialProfileName(name))
|
|
68
|
+
return { ok: false, error: "name" };
|
|
69
|
+
const root = join(dataDir, PROFILES_DIRECTORY), base = join(root, backend), home = join(base, name);
|
|
70
|
+
// The two levels above are made here when missing, private; one that is a link (or not ours) is refused.
|
|
71
|
+
for (const level of [root, base]) {
|
|
72
|
+
if (!lst(level)) {
|
|
73
|
+
try {
|
|
74
|
+
mkdirSync(level, { mode: 0o700 });
|
|
75
|
+
}
|
|
76
|
+
catch { /* checked below */ }
|
|
77
|
+
}
|
|
78
|
+
if (!ownDir(lst(level), fs.uid))
|
|
79
|
+
return { ok: false, error: "unsafe_root" };
|
|
80
|
+
}
|
|
81
|
+
const folders = (() => { try {
|
|
82
|
+
return readdirSync(base);
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return [];
|
|
86
|
+
} })();
|
|
87
|
+
if (folders.includes(name))
|
|
88
|
+
return { ok: false, error: "exists" };
|
|
89
|
+
const clash = caseClash(name, [...folders.filter(f => validCredentialProfileName(f)), ...configured]);
|
|
90
|
+
if (clash)
|
|
91
|
+
return { ok: false, error: "case_clash", clash };
|
|
92
|
+
try {
|
|
93
|
+
mkdirSync(home, { mode: 0o700 });
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
return { ok: false, error: err.code === "EEXIST" ? "exists" : "unsafe_root" };
|
|
97
|
+
}
|
|
98
|
+
if (!ownDir(lst(home), fs.uid))
|
|
99
|
+
return { ok: false, error: "unsafe_root" };
|
|
100
|
+
return { ok: true };
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The folder of an existing profile, when it is AgEnD's own (Remove's and Sign out's check): `<root>/<backend>/<name>`,
|
|
104
|
+
* each level a real directory (never a link) owned by this account, its real path exactly that place under the real
|
|
105
|
+
* root, and neither the CLI's default sign-in home nor inside or around it. `name` must already be valid.
|
|
106
|
+
*/
|
|
107
|
+
export function ownProfileFolder(dataDir, backend, name, fs = realFs()) {
|
|
108
|
+
const root = join(dataDir, PROFILES_DIRECTORY), base = join(root, backend), home = join(base, name);
|
|
109
|
+
const st = lst(home);
|
|
110
|
+
if (!st)
|
|
111
|
+
return { ok: false, error: "missing" };
|
|
112
|
+
// Each level: a real directory, never a link, owned by this account.
|
|
113
|
+
if (!ownDir(lst(root), fs.uid) || !ownDir(lst(base), fs.uid) || !ownDir(st, fs.uid))
|
|
114
|
+
return { ok: false, error: "unsafe" };
|
|
115
|
+
const realRoot = realOrNull(root), real = realOrNull(home);
|
|
116
|
+
if (!realRoot || !real || real !== join(realRoot, backend, name))
|
|
117
|
+
return { ok: false, error: "unsafe" };
|
|
118
|
+
const dflt = fs.defaultHome(backend);
|
|
119
|
+
if (dflt) {
|
|
120
|
+
const realDefault = realOrNull(dflt) ?? dflt;
|
|
121
|
+
if (within(realDefault, real) || within(real, realDefault))
|
|
122
|
+
return { ok: false, error: "default_home" };
|
|
123
|
+
}
|
|
124
|
+
return { ok: true, base, home, st, realRoot };
|
|
125
|
+
}
|
|
126
|
+
/** Remove a profile's folder, or refuse (nothing deleted). See the module comment for every rule. */
|
|
127
|
+
export function removeAccountProfile(dataDir, req, fs = realFs(), opts = {}) {
|
|
128
|
+
const { backend, name } = req;
|
|
129
|
+
if (!PROFILE_CLIS.has(backend))
|
|
130
|
+
return { ok: false, error: "backend" };
|
|
131
|
+
if (!validCredentialProfileName(name))
|
|
132
|
+
return { ok: false, error: "name" };
|
|
133
|
+
if (req.confirm !== name)
|
|
134
|
+
return { ok: false, error: "confirm" };
|
|
135
|
+
const u = req.users;
|
|
136
|
+
if (u.agents.length || u.classic.length || u.fleetDefault)
|
|
137
|
+
return { ok: false, error: "in_use", users: u };
|
|
138
|
+
if (req.usersUnknown)
|
|
139
|
+
return { ok: false, error: "users_unknown" };
|
|
140
|
+
if (req.signingIn)
|
|
141
|
+
return { ok: false, error: "signing_in" };
|
|
142
|
+
const own = ownProfileFolder(dataDir, backend, name, fs);
|
|
143
|
+
if (!own.ok)
|
|
144
|
+
return own;
|
|
145
|
+
const { base, home, st, realRoot } = own;
|
|
146
|
+
// #3305 review P2-2: after a wait, the folder must be the one the dry run proved (the same directory).
|
|
147
|
+
if (opts.expect && (st.dev !== opts.expect.dev || st.ino !== opts.expect.ino))
|
|
148
|
+
return { ok: false, error: "unsafe" };
|
|
149
|
+
// #3212 PR 3: every check above, nothing changed — the caller runs what must come first (macOS: Claude Code's own
|
|
150
|
+
// logout), then calls again with `expect` (this folder's identity) for the real removal.
|
|
151
|
+
if (opts.dryRun)
|
|
152
|
+
return { ok: true, identity: { dev: st.dev, ino: st.ino } };
|
|
153
|
+
// Out of sight first (a hidden name the listing never shows), then the same folder again, then deleted.
|
|
154
|
+
const parked = join(base, `.removing-${name}-${randomBytes(6).toString("hex")}`);
|
|
155
|
+
try {
|
|
156
|
+
renameSync(home, parked);
|
|
157
|
+
}
|
|
158
|
+
catch {
|
|
159
|
+
return { ok: false, error: "failed" };
|
|
160
|
+
}
|
|
161
|
+
const moved = lst(parked);
|
|
162
|
+
if (!moved || !ownDir(moved, fs.uid) || moved.ino !== st.ino || moved.dev !== st.dev || realOrNull(parked) !== join(realRoot, backend, parked.slice(base.length + sep.length))) {
|
|
163
|
+
try {
|
|
164
|
+
renameSync(parked, home);
|
|
165
|
+
}
|
|
166
|
+
catch { /* left hidden; never deleted */ }
|
|
167
|
+
return { ok: false, error: "unsafe" };
|
|
168
|
+
}
|
|
169
|
+
// rmSync never follows a link: a link inside (a relocated home's shared parts) is removed, its target left alone.
|
|
170
|
+
try {
|
|
171
|
+
rmSync(parked, { recursive: true, force: false });
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
return { ok: false, error: "failed" };
|
|
175
|
+
}
|
|
176
|
+
return { ok: true };
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=accounts-profiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts-profiles.js","sourceRoot":"","sources":["../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AI,EAAE,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type ProfileFs } from "./accounts-profiles.js";
|
|
2
|
+
/** The CLIs that can sign out from the dashboard, and how (their own logout; checked offline per CLI). */
|
|
3
|
+
export declare const SIGN_OUT: Readonly<Record<string, {
|
|
4
|
+
binary: string;
|
|
5
|
+
args: readonly string[];
|
|
6
|
+
}>>;
|
|
7
|
+
/** Claude Code's unsuffixed Keychain item: the default sign-in's (macOS). */
|
|
8
|
+
export declare const CLAUDE_DEFAULT_KEYCHAIN_SERVICE = "Claude Code-credentials";
|
|
9
|
+
export type SignOutRefusal = "unsupported" | "confirm" | "name" | "signing_in" | "missing" | "unsafe" | "default_home" | "failed";
|
|
10
|
+
export type SignOutResult = {
|
|
11
|
+
ok: true;
|
|
12
|
+
keychainLeft?: true;
|
|
13
|
+
} | {
|
|
14
|
+
ok: false;
|
|
15
|
+
error: SignOutRefusal;
|
|
16
|
+
};
|
|
17
|
+
export interface SignOutRequest {
|
|
18
|
+
backend: string;
|
|
19
|
+
/** null: the CLI's default sign-in. */
|
|
20
|
+
profile: unknown;
|
|
21
|
+
/** The person confirmed (the dialog named who stops). */
|
|
22
|
+
confirm: unknown;
|
|
23
|
+
/** A sign-in for this backend and account is running, or one for this backend is starting and its account is not known. */
|
|
24
|
+
signingIn: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface SignOutDeps {
|
|
27
|
+
/** Run the CLI (no shell, no input); its exit code. */
|
|
28
|
+
run(binary: string, args: readonly string[], env: NodeJS.ProcessEnv): Promise<{
|
|
29
|
+
code: number | null;
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* #3305 review P2-3: whether this logout still owns the credential writer (its login-window claim is current). Asked
|
|
33
|
+
* after the CLI ran, before anything is cleaned or reported: a fleet that stopped meanwhile (and perhaps started a
|
|
34
|
+
* new sign-in) is not cleaned up after.
|
|
35
|
+
*/
|
|
36
|
+
stillOwner?(): boolean;
|
|
37
|
+
/** macOS: whether a Keychain item with this service name is reachable. */
|
|
38
|
+
keychainHas(service: string): Promise<boolean>;
|
|
39
|
+
platform: NodeJS.Platform;
|
|
40
|
+
env: NodeJS.ProcessEnv;
|
|
41
|
+
fs: ProfileFs;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The `.claude.json` backups in a config dir, as `<name>\0<inode>` (a file replaced under the same name is another one).
|
|
45
|
+
* An empty set only when there is no backups folder at all; null when what is there could not be read completely
|
|
46
|
+
* (#3305 review: unknown is not empty — a cleanup measured against an incomplete list could take the person's files).
|
|
47
|
+
*/
|
|
48
|
+
export declare function claudeBackups(configDir: string): Set<string> | null;
|
|
49
|
+
/**
|
|
50
|
+
* The backups `claude auth logout` leaves that still name the account: all of them (`all`: a named profile's folder,
|
|
51
|
+
* AgEnD's own), or only those not in `except` (the default sign-in's folder: what was there before the logout is the
|
|
52
|
+
* person's own — #3305 review P2-4: by identity, never by time).
|
|
53
|
+
*/
|
|
54
|
+
export declare function removeClaudeBackups(configDir: string, which: {
|
|
55
|
+
all: true;
|
|
56
|
+
} | {
|
|
57
|
+
except: ReadonlySet<string>;
|
|
58
|
+
}): number;
|
|
59
|
+
export declare function signOutAccount(dataDir: string, req: SignOutRequest, deps: Partial<SignOutDeps> & Pick<SignOutDeps, "run" | "keychainHas">): Promise<SignOutResult>;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #3212 PR 3: signing an account out from Settings → Accounts — the CLI's own logout, run exactly as a launch would run
|
|
3
|
+
* the CLI for that account (the profile's variable from credentialProfileEnv, or nothing for the default sign-in).
|
|
4
|
+
*
|
|
5
|
+
* Checked offline per CLI (issuecomment-6700440777, -6700591696):
|
|
6
|
+
* - Claude Code `auth logout` removes `.credentials.json` (macOS: its own Keychain item, named after the config dir) and
|
|
7
|
+
* the account block of `.claude.json`, but writes `backups/.claude.json.backup.<ms>` that still names the account —
|
|
8
|
+
* so those are deleted too: every one in a named profile's folder (AgEnD's own, re-checked to be the same folder after
|
|
9
|
+
* the logout), only the ones that were not there before it in the default sign-in's folder (the person's own files);
|
|
10
|
+
* - Codex `logout` removes `auth.json`; Kiro `logout` clears its token rows. All three are idempotent and need no network.
|
|
11
|
+
*
|
|
12
|
+
* AgEnD never deletes a Keychain item itself: on macOS, an item with the account's service name still there after the
|
|
13
|
+
* logout (more than one matched) is reported, and nothing more is deleted.
|
|
14
|
+
*
|
|
15
|
+
* Refused (nothing run): a CLI with no logout; no confirmation; an invalid name; a named profile's folder that is not
|
|
16
|
+
* AgEnD's own (ownProfileFolder: Remove's checks); a sign-in for it running. No output of the CLI is kept or sent.
|
|
17
|
+
*/
|
|
18
|
+
import { lstatSync, readdirSync, realpathSync, rmSync } from "node:fs";
|
|
19
|
+
import { join } from "node:path";
|
|
20
|
+
import { credentialProfileEnv, credentialProfileHome } from "./backend/credential-profile.js";
|
|
21
|
+
import { claudeConfigDirFor, claudeKeychainService } from "./backend/claude-code.js";
|
|
22
|
+
import { validCredentialProfileName } from "./runtime-credential-profiles.js";
|
|
23
|
+
import { ownProfileFolder, realFs } from "./accounts-profiles.js";
|
|
24
|
+
/** The CLIs that can sign out from the dashboard, and how (their own logout; checked offline per CLI). */
|
|
25
|
+
export const SIGN_OUT = Object.freeze({
|
|
26
|
+
"claude-code": { binary: "claude", args: ["auth", "logout"] },
|
|
27
|
+
codex: { binary: "codex", args: ["logout"] },
|
|
28
|
+
"kiro-cli": { binary: "kiro-cli", args: ["logout"] },
|
|
29
|
+
});
|
|
30
|
+
/** Claude Code's unsuffixed Keychain item: the default sign-in's (macOS). */
|
|
31
|
+
export const CLAUDE_DEFAULT_KEYCHAIN_SERVICE = "Claude Code-credentials";
|
|
32
|
+
/**
|
|
33
|
+
* The `.claude.json` backups in a config dir, as `<name>\0<inode>` (a file replaced under the same name is another one).
|
|
34
|
+
* An empty set only when there is no backups folder at all; null when what is there could not be read completely
|
|
35
|
+
* (#3305 review: unknown is not empty — a cleanup measured against an incomplete list could take the person's files).
|
|
36
|
+
*/
|
|
37
|
+
export function claudeBackups(configDir) {
|
|
38
|
+
const dir = join(configDir, "backups"), out = new Set();
|
|
39
|
+
let st;
|
|
40
|
+
try {
|
|
41
|
+
st = lstatSync(dir);
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
return err.code === "ENOENT" ? out : null;
|
|
45
|
+
}
|
|
46
|
+
if (!st.isDirectory() || st.isSymbolicLink())
|
|
47
|
+
return out; // nothing the cleanup would touch
|
|
48
|
+
let names;
|
|
49
|
+
try {
|
|
50
|
+
names = readdirSync(dir);
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
for (const name of names) {
|
|
56
|
+
if (!name.startsWith(".claude.json.backup"))
|
|
57
|
+
continue;
|
|
58
|
+
try {
|
|
59
|
+
out.add(`${name}\0${lstatSync(join(dir, name)).ino}`);
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
if (err.code !== "ENOENT")
|
|
63
|
+
return null; // gone meanwhile: not there; anything else: unknown
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return out;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The backups `claude auth logout` leaves that still name the account: all of them (`all`: a named profile's folder,
|
|
70
|
+
* AgEnD's own), or only those not in `except` (the default sign-in's folder: what was there before the logout is the
|
|
71
|
+
* person's own — #3305 review P2-4: by identity, never by time).
|
|
72
|
+
*/
|
|
73
|
+
export function removeClaudeBackups(configDir, which) {
|
|
74
|
+
const dir = join(configDir, "backups");
|
|
75
|
+
let names;
|
|
76
|
+
try {
|
|
77
|
+
const st = lstatSync(dir);
|
|
78
|
+
if (!st.isDirectory() || st.isSymbolicLink())
|
|
79
|
+
return 0;
|
|
80
|
+
names = readdirSync(dir);
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return 0;
|
|
84
|
+
}
|
|
85
|
+
let n = 0;
|
|
86
|
+
for (const name of names) {
|
|
87
|
+
if (!name.startsWith(".claude.json.backup"))
|
|
88
|
+
continue;
|
|
89
|
+
const path = join(dir, name);
|
|
90
|
+
try {
|
|
91
|
+
const st = lstatSync(path);
|
|
92
|
+
if (!st.isFile())
|
|
93
|
+
continue; // never a link or a folder
|
|
94
|
+
if (!("all" in which) && which.except.has(`${name}\0${st.ino}`))
|
|
95
|
+
continue;
|
|
96
|
+
rmSync(path);
|
|
97
|
+
n++;
|
|
98
|
+
}
|
|
99
|
+
catch { /* gone already */ }
|
|
100
|
+
}
|
|
101
|
+
return n;
|
|
102
|
+
}
|
|
103
|
+
/** A directory's real path and identity, or null (missing, not a directory). */
|
|
104
|
+
function dirIdentity(path) {
|
|
105
|
+
try {
|
|
106
|
+
const real = realpathSync(path), st = lstatSync(real);
|
|
107
|
+
return st.isDirectory() ? { real, dev: st.dev, ino: st.ino } : null;
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
export async function signOutAccount(dataDir, req, deps) {
|
|
114
|
+
const d = { platform: process.platform, env: process.env, fs: realFs(), ...deps };
|
|
115
|
+
const how = Object.hasOwn(SIGN_OUT, req.backend) ? SIGN_OUT[req.backend] : null;
|
|
116
|
+
if (!how)
|
|
117
|
+
return { ok: false, error: "unsupported" };
|
|
118
|
+
if (req.confirm !== true)
|
|
119
|
+
return { ok: false, error: "confirm" };
|
|
120
|
+
const profile = req.profile ?? null;
|
|
121
|
+
if (profile !== null && !validCredentialProfileName(profile))
|
|
122
|
+
return { ok: false, error: "name" };
|
|
123
|
+
let identity = null;
|
|
124
|
+
if (profile !== null) {
|
|
125
|
+
const own = ownProfileFolder(dataDir, req.backend, profile, d.fs);
|
|
126
|
+
if (!own.ok)
|
|
127
|
+
return own;
|
|
128
|
+
identity = { dev: own.st.dev, ino: own.st.ino };
|
|
129
|
+
}
|
|
130
|
+
if (req.signingIn)
|
|
131
|
+
return { ok: false, error: "signing_in" };
|
|
132
|
+
const env = { ...d.env, ...(profile !== null ? credentialProfileEnv(dataDir, req.backend, profile) ?? {} : {}) };
|
|
133
|
+
const configDir = profile !== null ? credentialProfileHome(dataDir, "claude-code", profile) : claudeConfigDirFor(null);
|
|
134
|
+
// #3305 review P1 (default folder): the folder is the one seen before the logout — its real path and identity — and
|
|
135
|
+
// its backups then are the person's own. Cleanup happens in that directory only, never in one put at its path meanwhile.
|
|
136
|
+
const seen = req.backend === "claude-code" && profile === null ? dirIdentity(configDir) : null;
|
|
137
|
+
const before = seen ? claudeBackups(seen.real) : null;
|
|
138
|
+
let code;
|
|
139
|
+
try {
|
|
140
|
+
({ code } = await d.run(how.binary, how.args, env));
|
|
141
|
+
}
|
|
142
|
+
catch {
|
|
143
|
+
return { ok: false, error: "failed" };
|
|
144
|
+
}
|
|
145
|
+
if (code !== 0)
|
|
146
|
+
return { ok: false, error: "failed" };
|
|
147
|
+
if (d.stillOwner && !d.stillOwner())
|
|
148
|
+
return { ok: false, error: "failed" };
|
|
149
|
+
// #3305 review P1: the folder checked before the wait must be the one cleaned after it — the same directory (device
|
|
150
|
+
// and inode), still AgEnD's own with no link on the way. A folder swapped meanwhile is refused and left alone.
|
|
151
|
+
if (profile !== null) {
|
|
152
|
+
const again = ownProfileFolder(dataDir, req.backend, profile, d.fs);
|
|
153
|
+
if (!again.ok || again.st.dev !== identity.dev || again.st.ino !== identity.ino)
|
|
154
|
+
return { ok: false, error: "unsafe" };
|
|
155
|
+
}
|
|
156
|
+
if (req.backend !== "claude-code")
|
|
157
|
+
return { ok: true };
|
|
158
|
+
if (profile !== null)
|
|
159
|
+
removeClaudeBackups(configDir, { all: true });
|
|
160
|
+
else {
|
|
161
|
+
// No folder before the logout, or its backups could not be listed completely: nothing is bound to clean — nothing is
|
|
162
|
+
// deleted (the backup this logout wrote stays; the person's own are never at risk).
|
|
163
|
+
if (seen && before) {
|
|
164
|
+
const now = dirIdentity(configDir);
|
|
165
|
+
if (!now || now.real !== seen.real || now.dev !== seen.dev || now.ino !== seen.ino)
|
|
166
|
+
return { ok: false, error: "unsafe" };
|
|
167
|
+
removeClaudeBackups(seen.real, { except: before });
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (d.platform === "darwin") {
|
|
171
|
+
const service = profile !== null ? claudeKeychainService(configDir) : CLAUDE_DEFAULT_KEYCHAIN_SERVICE;
|
|
172
|
+
let left = false;
|
|
173
|
+
try {
|
|
174
|
+
left = await d.keychainHas(service);
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
left = false;
|
|
178
|
+
}
|
|
179
|
+
if (left)
|
|
180
|
+
return { ok: true, keychainLeft: true };
|
|
181
|
+
}
|
|
182
|
+
return { ok: true };
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=accounts-signout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts-signout.js","sourceRoot":"","sources":["../src/accounts-signout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAC9F,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAkB,MAAM,wBAAwB,CAAC;AAElF,0GAA0G;AAC1G,MAAM,CAAC,MAAM,QAAQ,GAA0E,MAAM,CAAC,MAAM,CAAC;IAC3G,aAAa,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE;IAC7D,KAAK,EAAE,EAAE,MA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AW,CAAC,SAAS,CAAC,CAAC;YACnC,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG;gBAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;YAC1H,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IACD,IAAI,CAAC,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAG,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,+BAA+B,CAAC;QACtG,IAAI,IAAI,GAAG,KAAK,CAAC;QACjB,IAAI,CAAC;YAAC,IAAI,GAAG,MAAM,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC;YAAC,IAAI,GAAG,KAAK,CAAC;QAAC,CAAC;QACpE,IAAI,IAAI;YAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;IACpD,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACtB,CAAC"}
|
package/dist/accounts-view.d.ts
CHANGED
|
@@ -13,6 +13,14 @@ export type AccountScope = {
|
|
|
13
13
|
online: boolean;
|
|
14
14
|
readOnlyReason?: string;
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Why a computer's row cannot be changed from the dashboard. The first five are about the whole computer (every row carries one of them); the last two are about
|
|
18
|
+
* one row. Codes, not sentences: the page words them in its own language, and shows the command to run on that computer.
|
|
19
|
+
*/
|
|
20
|
+
export declare const MACHINE_READ_ONLY_REASONS: readonly ["offline", "runtime_old", "accounts_off", "switch_unreadable", "not_installed", "not_created", "default_login"];
|
|
21
|
+
export type MachineReadOnlyReason = typeof MACHINE_READ_ONLY_REASONS[number];
|
|
22
|
+
/** The CLIs a paired computer's accounts are shown for (Claude Code first; Codex waits for #3212 PR 4). */
|
|
23
|
+
export declare const MACHINE_ACCOUNT_CLIS: ReadonlySet<string>;
|
|
16
24
|
export interface AccountUsage {
|
|
17
25
|
percent: number;
|
|
18
26
|
resetsAt?: string;
|
|
@@ -37,6 +45,18 @@ export interface AccountRow {
|
|
|
37
45
|
fleetDefault: boolean;
|
|
38
46
|
};
|
|
39
47
|
usage?: AccountUsage;
|
|
48
|
+
/** #3292: "Keep sign-in alive" (Claude Code and Codex host rows): the setting, its last run, the dates the sign-in's file says. */
|
|
49
|
+
keepAlive?: AccountKeepAlive;
|
|
50
|
+
}
|
|
51
|
+
/** Dates are ISO strings; `lastOutcome` is signin-keepalive.ts's Outcome. No token, path or output is in it. */
|
|
52
|
+
export interface AccountKeepAlive {
|
|
53
|
+
enabled: boolean;
|
|
54
|
+
fallback?: boolean;
|
|
55
|
+
endsAt?: string;
|
|
56
|
+
expiresAt?: string;
|
|
57
|
+
lastAt?: string;
|
|
58
|
+
lastOutcome?: string;
|
|
59
|
+
planType?: string;
|
|
40
60
|
}
|
|
41
61
|
export interface AccountsCli {
|
|
42
62
|
backend: string;
|
|
@@ -52,6 +72,33 @@ export interface AccountsCli {
|
|
|
52
72
|
export interface AccountsView {
|
|
53
73
|
clis: AccountsCli[];
|
|
54
74
|
}
|
|
75
|
+
/** One paired computer's accounts for the view, as its Runtime reported them (names, signed in or not, a masked identity) and what its owner allows. */
|
|
76
|
+
export interface MachineAccountsInput {
|
|
77
|
+
id: string;
|
|
78
|
+
name: string;
|
|
79
|
+
online: boolean;
|
|
80
|
+
/** A whole-computer reason (offline, an older Runtime, the owner's `accounts` switch off or unreadable, no Claude Code there): every row is read-only with it. */
|
|
81
|
+
readOnlyReason?: Exclude<MachineReadOnlyReason, "not_created" | "default_login">;
|
|
82
|
+
/** The profiles this computer reported. `created`: this Runtime made and recorded the folder; absent means a Runtime that does not report it. */
|
|
83
|
+
profiles: ReadonlyArray<{
|
|
84
|
+
name: string;
|
|
85
|
+
loggedIn: boolean | null;
|
|
86
|
+
identity?: AccountIdentity;
|
|
87
|
+
created?: boolean;
|
|
88
|
+
}>;
|
|
89
|
+
/** The pairing's default profile, when one is set; else agents without a profile use the Windows user's own sign-in. */
|
|
90
|
+
defaultProfile?: string;
|
|
91
|
+
/** The Windows user's own Claude Code sign-in on that computer (`claude auth status`), as the Runtime reported it with its CLIs. */
|
|
92
|
+
defaultLogin?: {
|
|
93
|
+
loggedIn: boolean | null;
|
|
94
|
+
identity?: AccountIdentity;
|
|
95
|
+
};
|
|
96
|
+
/** Agents that run on this computer, and the profile each names (null: none, so the computer's default). */
|
|
97
|
+
agents: ReadonlyArray<{
|
|
98
|
+
name: string;
|
|
99
|
+
profile: string | null;
|
|
100
|
+
}>;
|
|
101
|
+
}
|
|
55
102
|
export interface AccountsInput {
|
|
56
103
|
/** backendSignInTargets(): every backend's default, and each profile an agent uses. */
|
|
57
104
|
targets: readonly SignInTarget[];
|
|
@@ -79,6 +126,13 @@ export interface AccountsInput {
|
|
|
79
126
|
fleetDefaults: ReadonlyMap<string, string>;
|
|
80
127
|
/** Weekly (or longer) usage per row, by `backend\0profile` ("" for the default). */
|
|
81
128
|
usage?: ReadonlyMap<string, AccountUsage>;
|
|
129
|
+
/** #3190 Part 3c: paired computers' accounts, as rows under their own scope. Absent: no computer. */
|
|
130
|
+
machines?: readonly MachineAccountsInput[];
|
|
131
|
+
/**
|
|
132
|
+
* #3292: the keep-alive part per HOST row, by the same `backend\0profile` key. Never applied to a computer's rows: the key is the same for a host profile and a
|
|
133
|
+
* computer's profile of that name (and for `claude-code\0` of the host's default and a computer's), so the one would show the other's setting.
|
|
134
|
+
*/
|
|
135
|
+
keepAlive?: ReadonlyMap<string, AccountKeepAlive>;
|
|
82
136
|
}
|
|
83
137
|
/** Build the view. Pure. */
|
|
84
138
|
export declare function buildAccountsView(input: AccountsInput): AccountsView;
|