@songsid/agend 2.3.5-alpha.5 → 2.3.5-alpha.6
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 +27 -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/backend/codex.js +1 -0
- package/dist/backend/codex.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/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 +116 -11
- 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 +129 -0
- package/dist/fleet-manager.js +725 -53
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +10 -0
- package/dist/hub/compose/server.js +1 -0
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/directory/directory.d.ts +1 -1
- package/dist/hub/directory/directory.js +115 -3
- 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 +1 -0
- package/dist/hub/directory/types.d.ts +4 -0
- package/dist/hub/directory/types.js.map +1 -1
- 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 +52 -0
- package/dist/hub/group-policy/resources.js +166 -0
- package/dist/hub/group-policy/resources.js.map +1 -0
- package/dist/hub/group-policy/store.d.ts +52 -0
- package/dist/hub/group-policy/store.js +149 -0
- package/dist/hub/group-policy/store.js.map +1 -0
- package/dist/hub/http/compose.js +4 -3
- package/dist/hub/http/compose.js.map +1 -1
- 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/server.d.ts +2 -0
- package/dist/hub/server.js +12 -2
- package/dist/hub/server.js.map +1 -1
- 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 +21 -0
- 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 +125 -1
- 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 +3 -0
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-change.js +8 -0
- package/dist/settings-change.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 +1 -1
- package/dist/structured-signin.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 +3 -0
- package/dist/ui/accounts-keepalive.js +112 -0
- package/dist/ui/accounts-manage.js +237 -0
- package/dist/ui/accounts-view.js +175 -31
- package/dist/ui/agent-runtime-settings.js +2 -1
- package/dist/ui/app.html +8 -1
- package/dist/ui/hub-attachments.js +90 -0
- package/dist/ui/hub-chat-store.js +9 -4
- package/dist/ui/hub-client.js +20 -1
- package/dist/ui/hub-preview.js +101 -0
- package/dist/ui/machine-signin.js +56 -0
- package/dist/ui/panel-fleet.js +1 -1
- package/dist/ui/panel-hub.js +126 -31
- package/dist/ui/panel-needs.js +14 -8
- package/dist/ui/panel-notices.js +4 -3
- package/dist/ui/panel-runtimes.js +19 -6
- package/dist/ui/panel-settings.js +12 -6
- 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 +114 -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-guests.js +3 -2
- package/dist/ui/settings-hub-browser-certificate.js +2 -0
- package/dist/ui/settings-hub-membership.js +12 -6
- package/dist/ui/settings-hub-retention.js +2 -0
- package/dist/ui/settings-hub.js +11 -3
- package/dist/ui/settings-quota-notice.js +100 -0
- package/dist/ui/settings-registry.js +1 -0
- package/dist/ui/settings-strings.js +2 -2
- 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-route.js +1 -1
- package/dist/ui/shared/app-shell.js +9 -3
- package/dist/ui/shared/app-store.js +2 -2
- package/dist/ui/shared/app.css +13 -0
- package/dist/ui/shared/app.js +2 -1
- package/dist/ui/shared/hub-chat.css +1 -0
- package/dist/ui/shared/hub-owner.css +1 -1
- 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/workspace-follow.css +19 -0
- package/dist/ui/signin.html +7 -3
- package/dist/ui/structured-signin.js +31 -7
- 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 +5 -0
- package/dist/usage/providers.js +5 -0
- 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 +33 -0
- package/dist/web-api.js +342 -8
- 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-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 +6 -0
- package/dist/windows-cli-api.js +11 -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 +6 -2
- package/templates/runtime-install/install.ps1 +154 -13
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
// #3212 PR 2: Settings → Accounts — + Add account and Remove (POST/DELETE /ui/accounts/…, accounts-profiles.ts on the
|
|
2
|
+
// server, which decides; this page only asks). A module of its own, its words registered here: a tab that loaded PR 1's
|
|
3
|
+
// accounts-view.js keeps working without these, and these never meet an older cached strings file.
|
|
4
|
+
// - AddAccountDialog: a name (checked here as the server checks it, so the person sees why at once); Add creates the
|
|
5
|
+
// profile's folder; then Sign in opens right away where the dashboard can sign it in, else the row shows the host command.
|
|
6
|
+
// - RemoveAccountDialog: names the account and its CLI and what is lost; while anything uses it, Remove is not offered and
|
|
7
|
+
// each user is listed with Move… (an agent: its own dialog's Account field; the fleet default: the card's selector; a
|
|
8
|
+
// ClassicBot room: where its account is set); typing the account's name enables Remove.
|
|
9
|
+
import { html, useEffect, useRef, useState } from "/assets/app-html.js";
|
|
10
|
+
import { register, t } from "/assets/app-i18n.js";
|
|
11
|
+
import { Dialog } from "/assets/ui-dialog.js";
|
|
12
|
+
import { toast } from "/assets/ui-toast.js";
|
|
13
|
+
|
|
14
|
+
register("accountsManage", {
|
|
15
|
+
en: {
|
|
16
|
+
add: "+ Add account", addTitle: "Add a {0} account", addLead: "A named account is a separate sign-in on this host. Name it, then sign it in.",
|
|
17
|
+
nameLabel: "Name", nameHint: "Letters, digits, dots, hyphens or underscores; it starts with a letter or digit.", addGo: "Add",
|
|
18
|
+
cancel: "Cancel", adding: "Adding…",
|
|
19
|
+
err_name: "Use 1–64 letters, digits, dots, hyphens or underscores, starting with a letter or digit; not ending with a dot, and not a Windows device name (CON, NUL…).",
|
|
20
|
+
err_exists: "An account with this name already exists.", err_case_clash: "“{0}” already exists; names that differ only in letter case would be the same folder.",
|
|
21
|
+
err_unsafe_root: "The accounts folder on this host isn't a plain folder of this account, so nothing was created.",
|
|
22
|
+
err_backend: "This CLI has no named accounts.", err_failed: "That didn't work. Try again.",
|
|
23
|
+
added: "Account “{0}” added.", addedHostSignIn: "Account “{0}” added. Sign it in on the host with the command on its row.",
|
|
24
|
+
remove: "Remove…", removeTitle: "Remove the {0} account “{1}”?",
|
|
25
|
+
removeLead: "This deletes the account's folder on this host: its sign-in.", removeLeadClaude: "This deletes the account's folder on this host: its sign-in and its own copies of conversations.",
|
|
26
|
+
removeAfter: "Agents can't use it afterwards.", sep: " ",
|
|
27
|
+
inUse: "Still used by — move each to another account first:", inUseAgent: "Agent {0}", inUseRoom: "ClassicBot room {0}", inUseDefault: "The fleet default for {0} agents",
|
|
28
|
+
move: "Move…", roomHow: "Change it in that room's ClassicBot settings (its credential_profile).",
|
|
29
|
+
typeLabel: "Type {0} to confirm", removeGo: "Remove", removing: "Removing…", removed: "Account “{0}” removed.",
|
|
30
|
+
err_confirm: "Type the account's name exactly.", err_in_use: "Something still uses this account.", err_signing_in: "A sign-in for this account is running. Wait for it to end, or cancel it.",
|
|
31
|
+
err_missing: "This account's folder is no longer there.", err_unsafe: "This account's folder isn't a plain folder of this account inside AgEnD's accounts folder, so nothing was deleted.",
|
|
32
|
+
err_default_home: "That is the CLI's default sign-in, which is never deleted here.",
|
|
33
|
+
err_users_unknown: "AgEnD can't read the ClassicBot settings, so it can't tell whether a room uses this account. Fix classicBot.yaml, then try again.",
|
|
34
|
+
signOut: "Sign out…", switchAccount: "Switch account…", signOutTitle: "Sign out of {0}'s {1}?", switchTitle: "Switch {0}'s default sign-in?",
|
|
35
|
+
signOutLead: "AgEnD runs {0}'s own logout for this account on the host. Its conversations stay.",
|
|
36
|
+
switchLead: "AgEnD signs this account out with {0}'s own logout, then opens Sign in for the account you want. Agents using it restart on the new account once you've signed in.",
|
|
37
|
+
stopUsers: "Using it now — they stop working until it's signed in again:", nobody: "No agent, ClassicBot room or fleet default uses it.",
|
|
38
|
+
signOutGo: "Sign out", switchGo: "Sign out and sign in", signingOut: "Signing out…", signedOut: "Signed out.",
|
|
39
|
+
keychainLeft: "Signed out, but a Keychain item for this account is still on this Mac. Remove it in Keychain Access.",
|
|
40
|
+
removedKeychainLeft: "Account “{0}” removed, but a Keychain item for it is still on this Mac. Remove it in Keychain Access.",
|
|
41
|
+
err_unsupported: "This CLI can't be signed out from here.", err_signout_failed: "{0}'s logout didn't succeed. Try again, or run it on the host.",
|
|
42
|
+
defName: "default sign-in", acctName: "account “{0}”",
|
|
43
|
+
// #3190 Part 3c: an account on a paired computer (its Runtime does the work; the computer's owner has to allow it there).
|
|
44
|
+
addTitleMachine: "Add a {0} account on {1}", addLeadMachine: "A named account is a separate sign-in kept on {0}. Name it, then sign it in here. Its folder is made by that computer's Runtime.",
|
|
45
|
+
removeLeadMachine: "This deletes the account's folder on {0}: its sign-in and its own copies of conversations. That computer's Runtime does it, and records it.",
|
|
46
|
+
inUseMachineDefault: "This computer's default account for agents (change it on that computer: agend-runtime profile default NAME)",
|
|
47
|
+
signOutLeadMachine: "AgEnD asks {0}'s Runtime to run {1}'s own logout for this account. Its conversations stay.",
|
|
48
|
+
err_machine_unknown: "That computer is not paired any more.", err_machine_offline: "That computer is offline. Start its Runtime, then try again.",
|
|
49
|
+
err_machine_unsupported: "That computer's Runtime is too old for this. Update the Runtime on it, then try again.",
|
|
50
|
+
err_machine_accounts_off: "The owner of that computer has not allowed this. On that computer run: agend-runtime remote-setup accounts on",
|
|
51
|
+
err_machine_unreachable: "That computer did not answer. Check its Runtime window, then try again.",
|
|
52
|
+
err_machine_profile_not_owned: "This account was not created by AgEnD's Runtime, so it can only be changed on that computer.",
|
|
53
|
+
err_machine_default_login: "That is the Windows user's own sign-in on that computer, which is never changed from here.",
|
|
54
|
+
err_machine_refused: "That computer did not do it.",
|
|
55
|
+
},
|
|
56
|
+
"zh-TW": {
|
|
57
|
+
add: "+ 新增帳號", addTitle: "新增 {0} 帳號", addLead: "具名帳號是這台主機上另一組登入。先取名,再登入。",
|
|
58
|
+
nameLabel: "名稱", nameHint: "英文字母、數字、句點、連字號或底線;以字母或數字開頭。", addGo: "新增",
|
|
59
|
+
cancel: "取消", adding: "正在新增…",
|
|
60
|
+
err_name: "請用 1–64 個英文字母、數字、句點、連字號或底線,以字母或數字開頭;不能以句點結尾,也不能是 Windows 裝置名稱(CON、NUL…)。",
|
|
61
|
+
err_exists: "已經有這個名稱的帳號。", err_case_clash: "已經有「{0}」;只差大小寫的名稱會是同一個資料夾。",
|
|
62
|
+
err_unsafe_root: "這台主機的帳號資料夾不是這個使用者的一般資料夾,所以沒有建立任何東西。",
|
|
63
|
+
err_backend: "這個 CLI 沒有具名帳號。", err_failed: "沒有成功,請再試一次。",
|
|
64
|
+
added: "已新增帳號「{0}」。", addedHostSignIn: "已新增帳號「{0}」。請用它那一列的指令在主機上登入。",
|
|
65
|
+
remove: "移除…", removeTitle: "要移除 {0} 帳號「{1}」嗎?",
|
|
66
|
+
removeLead: "這會刪除這台主機上該帳號的資料夾:它的登入。", removeLeadClaude: "這會刪除這台主機上該帳號的資料夾:它的登入,以及它自己的對話副本。",
|
|
67
|
+
removeAfter: "之後 Agent 就不能使用它。", sep: "",
|
|
68
|
+
inUse: "仍在使用中,請先把每一項移到其他帳號:", inUseAgent: "Agent {0}", inUseRoom: "ClassicBot 房間 {0}", inUseDefault: "{0} Agent 的 Fleet 預設帳號",
|
|
69
|
+
move: "移動…", roomHow: "請在該房間的 ClassicBot 設定(credential_profile)中更改。",
|
|
70
|
+
typeLabel: "輸入 {0} 以確認", removeGo: "移除", removing: "正在移除…", removed: "已移除帳號「{0}」。",
|
|
71
|
+
err_confirm: "請正確輸入帳號名稱。", err_in_use: "仍有項目在使用這個帳號。", err_signing_in: "這個帳號正在登入。請等它結束,或取消它。",
|
|
72
|
+
err_missing: "這個帳號的資料夾已經不在了。", err_unsafe: "這個帳號的資料夾不是 AgEnD 帳號資料夾裡、屬於這個使用者的一般資料夾,所以沒有刪除任何東西。",
|
|
73
|
+
err_default_home: "那是 CLI 的預設登入,這裡永遠不會刪除它。",
|
|
74
|
+
err_users_unknown: "AgEnD 無法讀取 ClassicBot 設定,所以無法確定是否有房間在使用這個帳號。請先修正 classicBot.yaml 再試一次。",
|
|
75
|
+
signOut: "登出…", switchAccount: "切換帳號…", signOutTitle: "要登出 {0} 的{1}嗎?", switchTitle: "要切換 {0} 的預設登入嗎?",
|
|
76
|
+
signOutLead: "AgEnD 會在主機上用 {0} 自己的登出指令登出這個帳號。它的對話會保留。",
|
|
77
|
+
switchLead: "AgEnD 會用 {0} 自己的登出指令登出這個帳號,然後開啟「登入」讓你登入想用的帳號。登入後,使用它的 Agent 會以新帳號重新啟動。",
|
|
78
|
+
stopUsers: "目前使用中——在重新登入前它們都無法運作:", nobody: "沒有 Agent、ClassicBot 房間或 Fleet 預設在使用它。",
|
|
79
|
+
signOutGo: "登出", switchGo: "登出並登入", signingOut: "正在登出…", signedOut: "已登出。",
|
|
80
|
+
keychainLeft: "已登出,但這台 Mac 上仍有這個帳號的鑰匙圈項目。請在「鑰匙圈存取」中刪除。",
|
|
81
|
+
removedKeychainLeft: "已移除帳號「{0}」,但這台 Mac 上仍有它的鑰匙圈項目。請在「鑰匙圈存取」中刪除。",
|
|
82
|
+
err_unsupported: "這個 CLI 無法在這裡登出。", err_signout_failed: "{0} 的登出沒有成功。請再試一次,或在主機上執行。",
|
|
83
|
+
defName: "預設登入", acctName: "帳號「{0}」",
|
|
84
|
+
// #3190 Part 3c:配對電腦上的帳號(由那台電腦的 Runtime 執行;需要電腦的擁有者在那裡允許)。
|
|
85
|
+
addTitleMachine: "在 {1} 新增 {0} 帳號", addLeadMachine: "具名帳號是保存在 {0} 上的另一組登入。先取名,再在這裡登入。它的資料夾由那台電腦的 Runtime 建立。",
|
|
86
|
+
removeLeadMachine: "這會刪除 {0} 上該帳號的資料夾:它的登入,以及它自己的對話副本。由那台電腦的 Runtime 執行並記錄。",
|
|
87
|
+
inUseMachineDefault: "這台電腦給 Agent 用的預設帳號(請在那台電腦上更改:agend-runtime profile default NAME)",
|
|
88
|
+
signOutLeadMachine: "AgEnD 會請 {0} 的 Runtime 用 {1} 自己的登出指令登出這個帳號。它的對話會保留。",
|
|
89
|
+
err_machine_unknown: "那台電腦已不再配對。", err_machine_offline: "那台電腦離線了。請先啟動它的 Runtime,再試一次。",
|
|
90
|
+
err_machine_unsupported: "那台電腦的 Runtime 太舊,無法這樣做。請先更新它的 Runtime,再試一次。",
|
|
91
|
+
err_machine_accounts_off: "那台電腦的擁有者尚未允許這件事。請在那台電腦上執行:agend-runtime remote-setup accounts on",
|
|
92
|
+
err_machine_unreachable: "那台電腦沒有回應。請檢查它的 Runtime 視窗,再試一次。",
|
|
93
|
+
err_machine_profile_not_owned: "這個帳號不是 AgEnD 的 Runtime 建立的,只能在那台電腦上更改。",
|
|
94
|
+
err_machine_default_login: "那是那台電腦上 Windows 使用者自己的登入,這裡永遠不會更改它。",
|
|
95
|
+
err_machine_refused: "那台電腦沒有執行。",
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
const tm = (k, ...v) => t(`accountsManage.${k}`, ...v);
|
|
99
|
+
|
|
100
|
+
/** The server's name rule (credential-profile.ts + #3190's Windows-safe checks), so the dialog says why before asking. */
|
|
101
|
+
const NAME = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
|
|
102
|
+
const DEVICE = /^(?:con|prn|aux|nul|conin\$|conout\$|com[0-9¹²³]|lpt[0-9¹²³])(?:\..*)?$/i;
|
|
103
|
+
export const validAccountName = (s) => typeof s === "string" && NAME.test(s) && !s.endsWith(".") && !DEVICE.test(s);
|
|
104
|
+
|
|
105
|
+
async function send(method, path, body) {
|
|
106
|
+
try {
|
|
107
|
+
const r = await fetch(path, { method, credentials: "same-origin", cache: "no-store", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body) });
|
|
108
|
+
let j = null; try { j = await r.json(); } catch { /* none */ }
|
|
109
|
+
return r.ok ? { ok: true, ...(j || {}) } : { ok: false, error: (j && typeof j.error === "string" && j.error) || "failed", ...(j || {}) };
|
|
110
|
+
} catch { return { ok: false, error: "failed" }; }
|
|
111
|
+
}
|
|
112
|
+
const errText = (r) => {
|
|
113
|
+
// A computer's own refusal sentence (its Runtime's words, bounded; no path, URL, code or output) says more than ours does.
|
|
114
|
+
if (r.error === "machine_refused" && typeof r.message === "string" && r.message) return r.message;
|
|
115
|
+
const key = `err_${r.error}`, s = tm(key, r.clash || "");
|
|
116
|
+
return s === `accountsManage.${key}` ? tm("err_failed") : s;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/** `cli`: the Accounts view's card; `label`: the CLI's name; `onAdded(name)`: after the server made it. */
|
|
120
|
+
/**
|
|
121
|
+
* #3291 review (Prism P2-5): while its request runs a dialog can't be dismissed (Cancel disabled; Dialog's `busy` holds ×, Esc and the backdrop), and an answer that
|
|
122
|
+
* comes after the dialog left the page (navigation) does nothing — it never closes or opens what replaced it.
|
|
123
|
+
*/
|
|
124
|
+
function useLive() {
|
|
125
|
+
const live = useRef(true);
|
|
126
|
+
useEffect(() => () => { live.current = false; }, []);
|
|
127
|
+
return live;
|
|
128
|
+
}
|
|
129
|
+
export function AddAccountDialog({ cli, label, machine = null, onClose, onAdded }) {
|
|
130
|
+
const [name, setName] = useState("");
|
|
131
|
+
const [busy, setBusy] = useState(false);
|
|
132
|
+
const [err, setErr] = useState("");
|
|
133
|
+
const input = useRef(null);
|
|
134
|
+
const live = useLive();
|
|
135
|
+
useEffect(() => { input.current && input.current.focus(); }, []);
|
|
136
|
+
const trimmed = name.trim();
|
|
137
|
+
const shownErr = err || (trimmed && !validAccountName(trimmed) ? tm("err_name") : "");
|
|
138
|
+
const go = async () => {
|
|
139
|
+
if (busy || !validAccountName(trimmed)) return;
|
|
140
|
+
setBusy(true); setErr("");
|
|
141
|
+
const r = await send("POST", `/ui/accounts/${encodeURIComponent(cli.backend)}`, { name: trimmed, ...(machine ? { machine: machine.id } : {}) });
|
|
142
|
+
if (!live.current) return;
|
|
143
|
+
setBusy(false);
|
|
144
|
+
if (!r.ok) { setErr(errText(r)); return; }
|
|
145
|
+
onClose(); onAdded(trimmed);
|
|
146
|
+
};
|
|
147
|
+
return html`<${Dialog} title=${machine ? tm("addTitleMachine", label, machine.name) : tm("addTitle", label)} onClose=${onClose} busy=${busy} actions=${html`<button type="button" class="btn" disabled=${busy} onClick=${onClose}>${tm("cancel")}</button>
|
|
148
|
+
<button type="button" class="btn btn-primary" disabled=${busy || !validAccountName(trimmed)} onClick=${go}>${busy ? tm("adding") : tm("addGo")}</button>`}>
|
|
149
|
+
<p>${machine ? tm("addLeadMachine", machine.name) : tm("addLead")}</p>
|
|
150
|
+
<div class="field"><label for="acctAddName">${tm("nameLabel")}</label>
|
|
151
|
+
<input id="acctAddName" ref=${input} value=${name} maxlength="64" autocomplete="off" spellcheck=${false}
|
|
152
|
+
onInput=${(e) => { setName(e.target.value); setErr(""); }} onKeyDown=${(e) => { if (e.key === "Enter") { e.preventDefault(); void go(); } }} />
|
|
153
|
+
<small class="note">${tm("nameHint")}</small>
|
|
154
|
+
${shownErr ? html`<p class="err" role="alert">${shownErr}</p>` : null}</div>
|
|
155
|
+
</${Dialog}>`;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* `row`: the named account's row (its `usedBy` from the view); `onMove(user)`: open where that user's account is set
|
|
160
|
+
* ({ kind: "agent", name } | { kind: "default" }); `onRemoved()`: after the server removed it.
|
|
161
|
+
*/
|
|
162
|
+
export function RemoveAccountDialog({ cli, row, label, onClose, onMove, onRemoved }) {
|
|
163
|
+
const [typed, setTyped] = useState("");
|
|
164
|
+
const [busy, setBusy] = useState(false);
|
|
165
|
+
const [err, setErr] = useState("");
|
|
166
|
+
const [users, setUsers] = useState(row.usedBy); // the server's answer replaces it when it knows better
|
|
167
|
+
const live = useLive();
|
|
168
|
+
const machine = row.scope && row.scope.kind === "machine" ? row.scope : null; // #3190 Part 3c: an account on a paired computer
|
|
169
|
+
const inUse = users.agents.length > 0 || users.classic.length > 0 || users.fleetDefault;
|
|
170
|
+
const go = async () => {
|
|
171
|
+
if (busy || inUse || typed !== row.profile) return;
|
|
172
|
+
setBusy(true); setErr("");
|
|
173
|
+
const r = await send("DELETE", `/ui/accounts/${encodeURIComponent(cli.backend)}/${encodeURIComponent(row.profile)}`, { confirm: typed, ...(machine ? { machine: machine.id } : {}) });
|
|
174
|
+
if (!live.current) return;
|
|
175
|
+
setBusy(false);
|
|
176
|
+
if (r.ok) { toast(r.keychainLeft ? tm("removedKeychainLeft", row.profile) : tm("removed", row.profile), !r.keychainLeft); onClose(); onRemoved(); return; }
|
|
177
|
+
if (r.error === "in_use" && r.users) setUsers(r.users);
|
|
178
|
+
setErr(errText(r));
|
|
179
|
+
};
|
|
180
|
+
const moveBtn = (user) => html`<button type="button" class="btn btn-sm" disabled=${busy} onClick=${() => { onClose(); onMove(user); }}>${tm("move")}</button>`;
|
|
181
|
+
return html`<${Dialog} title=${tm("removeTitle", label, row.profile)} onClose=${onClose} busy=${busy} actions=${html`<button type="button" class="btn" disabled=${busy} onClick=${onClose}>${tm("cancel")}</button>
|
|
182
|
+
<button type="button" class="btn btn-danger" disabled=${busy || inUse || typed !== row.profile} onClick=${go}>${busy ? tm("removing") : tm("removeGo")}</button>`}>
|
|
183
|
+
<p>${machine ? tm("removeLeadMachine", machine.name) : cli.backend === "claude-code" ? tm("removeLeadClaude") : tm("removeLead")}${tm("sep")}${tm("removeAfter")}</p>
|
|
184
|
+
${inUse ? html`<div class="s-account-inuse" role="status"><p><strong>${tm("inUse")}</strong></p><ul>
|
|
185
|
+
${users.agents.map((name) => html`<li><span>${tm("inUseAgent", name)}</span>${moveBtn({ kind: "agent", name })}</li>`)}
|
|
186
|
+
${users.fleetDefault ? html`<li><span>${machine ? tm("inUseMachineDefault") : tm("inUseDefault", label)}</span>${machine ? null : moveBtn({ kind: "default" })}</li>` : null}
|
|
187
|
+
${users.classic.map((key) => html`<li><span>${tm("inUseRoom", key)}</span><small class="note">${tm("roomHow")}</small></li>`)}
|
|
188
|
+
</ul></div>` : html`<div class="field"><label for="acctRemoveName">${tm("typeLabel", row.profile)}</label>
|
|
189
|
+
<input id="acctRemoveName" value=${typed} autocomplete="off" spellcheck=${false} onInput=${(e) => { setTyped(e.target.value); setErr(""); }}
|
|
190
|
+
onKeyDown=${(e) => { if (e.key === "Enter") { e.preventDefault(); void go(); } }} /></div>`}
|
|
191
|
+
${err ? html`<p class="err" role="alert">${err}</p>` : null}
|
|
192
|
+
</${Dialog}>`;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* #3212 PR 3: Sign out (`mode` "signout") or Switch account (`mode` "switch", the default sign-in): names the account
|
|
197
|
+
* and who stops using it until it is signed in again (an agent and the fleet default with Move…); the CLI's own logout
|
|
198
|
+
* runs on the host. `onDone(result)`: after the server signed it out.
|
|
199
|
+
*/
|
|
200
|
+
export function SignOutDialog({ cli, row, label, mode = "signout", onClose, onMove, onDone }) {
|
|
201
|
+
const [busy, setBusy] = useState(false);
|
|
202
|
+
const [err, setErr] = useState("");
|
|
203
|
+
const live = useLive();
|
|
204
|
+
const users = row.usedBy;
|
|
205
|
+
const any = users.agents.length > 0 || users.classic.length > 0 || users.fleetDefault;
|
|
206
|
+
const which = row.profile ? tm("acctName", row.profile) : tm("defName");
|
|
207
|
+
const machine = row.scope && row.scope.kind === "machine" ? row.scope : null; // #3190 Part 3c: an account on a paired computer
|
|
208
|
+
const go = async () => {
|
|
209
|
+
if (busy) return;
|
|
210
|
+
setBusy(true); setErr("");
|
|
211
|
+
const r = await send("POST", `/ui/accounts/${encodeURIComponent(cli.backend)}/signout`, { profile: row.profile || null, confirm: true, ...(machine ? { machine: machine.id } : {}) });
|
|
212
|
+
if (!live.current) return;
|
|
213
|
+
setBusy(false);
|
|
214
|
+
if (!r.ok) { setErr(r.error === "failed" ? tm("err_signout_failed", label) : errText(r)); return; }
|
|
215
|
+
toast(r.keychainLeft ? tm("keychainLeft") : tm("signedOut"), !r.keychainLeft);
|
|
216
|
+
onClose(); onDone(r);
|
|
217
|
+
};
|
|
218
|
+
const moveBtn = (user) => html`<button type="button" class="btn btn-sm" disabled=${busy} onClick=${() => { onClose(); onMove(user); }}>${tm("move")}</button>`;
|
|
219
|
+
return html`<${Dialog} title=${mode === "switch" ? tm("switchTitle", label) : tm("signOutTitle", label, which)} onClose=${onClose} busy=${busy}
|
|
220
|
+
actions=${html`<button type="button" class="btn" disabled=${busy} onClick=${onClose}>${tm("cancel")}</button>
|
|
221
|
+
<button type="button" class=${mode === "switch" ? "btn btn-primary" : "btn btn-danger"} disabled=${busy} onClick=${go}>${busy ? tm("signingOut") : mode === "switch" ? tm("switchGo") : tm("signOutGo")}</button>`}>
|
|
222
|
+
<p>${mode === "switch" ? tm("switchLead", label) : machine ? tm("signOutLeadMachine", machine.name, label) : tm("signOutLead", label)}</p>
|
|
223
|
+
${any ? html`<div class="s-account-inuse" role="status"><p><strong>${tm("stopUsers")}</strong></p><ul>
|
|
224
|
+
${users.agents.map((name) => html`<li><span>${tm("inUseAgent", name)}</span>${mode === "switch" ? null : moveBtn({ kind: "agent", name })}</li>`)}
|
|
225
|
+
${users.fleetDefault && row.profile ? html`<li><span>${machine ? tm("inUseMachineDefault") : tm("inUseDefault", label)}</span>${machine ? null : moveBtn({ kind: "default" })}</li>` : null}
|
|
226
|
+
${users.classic.map((key) => html`<li><span>${tm("inUseRoom", key)}</span></li>`)}
|
|
227
|
+
</ul></div>` : html`<p class="note">${tm("nobody")}</p>`}
|
|
228
|
+
${err ? html`<p class="err" role="alert">${err}</p>` : null}
|
|
229
|
+
</${Dialog}>`;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** The CLIs the dashboard can sign out (their own logout; accounts-signout.ts SIGN_OUT). */
|
|
233
|
+
export const SIGN_OUT_CLIS = new Set(["claude-code", "codex", "kiro-cli"]);
|
|
234
|
+
|
|
235
|
+
/** The button labels the view draws (from this module, so an older view never shows them). */
|
|
236
|
+
export const manageWords = { add: () => tm("add"), remove: () => tm("remove"), added: (n) => tm("added", n), addedHost: (n) => tm("addedHostSignIn", n),
|
|
237
|
+
signOut: () => tm("signOut"), switchAccount: () => tm("switchAccount") };
|
package/dist/ui/accounts-view.js
CHANGED
|
@@ -6,15 +6,23 @@
|
|
|
6
6
|
// staging and Save (a change of account waits for the same confirmation as any credential setting, and restarts).
|
|
7
7
|
// - Fleet default: the same, for `defaults.backend_options.<cli>.credential_profile`.
|
|
8
8
|
// - AccountSelect: the Agent dialog's Account field (settings-dialogs.js), from the same view.
|
|
9
|
-
// Rows carry a `scope`:
|
|
9
|
+
// Rows carry a `scope`: `host`, and (#3190 Part 3c) a paired computer's `machine` rows under its name — Claude Code first. A computer's account is signed in, signed
|
|
10
|
+
// out and removed here only where its Runtime allows it (its owner turned `accounts` on there, and the profile is one that Runtime created); every other row is
|
|
11
|
+
// read-only with the reason (a code from the server, worded here) and the command to run on that computer.
|
|
10
12
|
// Words are registered here (a new module: an older cached strings file never leaves a raw key).
|
|
11
|
-
import { html, useEffect, useState } from "/assets/app-html.js";
|
|
13
|
+
import { html, useEffect, useRef, useState } from "/assets/app-html.js";
|
|
12
14
|
import { register, t } from "/assets/app-i18n.js";
|
|
13
|
-
import { createStore, useStore } from "/assets/app-store.js";
|
|
15
|
+
import { appStore, createStore, useStore } from "/assets/app-store.js";
|
|
14
16
|
import { Dialog } from "/assets/ui-dialog.js";
|
|
17
|
+
import { Skeleton } from "/assets/ui-states.js";
|
|
15
18
|
import { CliProductMark, cliLabel } from "./cli-picker.js";
|
|
16
19
|
import { identityText } from "./account-identity.js";
|
|
17
20
|
import { openSignIn, refreshSignIn, signInStore } from "./backend-signin.js";
|
|
21
|
+
import { toast } from "/assets/ui-toast.js";
|
|
22
|
+
import { shellStore } from "/assets/app-shell.js";
|
|
23
|
+
import { AddAccountDialog, RemoveAccountDialog, SignOutDialog, SIGN_OUT_CLIS, manageWords } from "./accounts-manage.js"; // #3212 PR 2, PR 3
|
|
24
|
+
import { machineSignInStore, openMachineSignIn } from "./machine-signin.js"; // #3190 Part 3c
|
|
25
|
+
import { KeepAliveControl } from "./accounts-keepalive.js"; // #3292
|
|
18
26
|
|
|
19
27
|
register("accounts", {
|
|
20
28
|
en: {
|
|
@@ -29,7 +37,16 @@ register("accounts", {
|
|
|
29
37
|
carry_claude: "Claude Code carries its conversation over.", carry_codex: "Codex keeps its conversation.", carry_kiro: "Kiro starts a new conversation, with a handover.",
|
|
30
38
|
moveNone: "Every {0} agent already uses this account.", moveStage: "Stage", cancel: "Cancel", current: "now: {0}",
|
|
31
39
|
fleetDefault: "Fleet default for {0} agents", fleetDefaultHint: "Agents that don't choose an account use this one.",
|
|
32
|
-
machine: "On {0}", machineReadOnly: "Read-only here",
|
|
40
|
+
machine: "On {0}", machineReadOnly: "Read-only here", machineOnline: "online", machineOffline: "offline", machineDefaultTag: "this computer's default",
|
|
41
|
+
machineNoUsage: "—", machineNoUsageHint: "That computer does not report usage.",
|
|
42
|
+
machineCommand: "Sign in on that computer", machineCommandHint: "Run this in a terminal on {0}.",
|
|
43
|
+
why_offline: "{0} is offline. Start its Runtime to manage its accounts.",
|
|
44
|
+
why_runtime_old: "{0}'s Runtime is too old to manage accounts from here. Update the Runtime on that computer.",
|
|
45
|
+
why_accounts_off: "The owner of {0} has not allowed account changes from AgEnD. On that computer run: agend-runtime remote-setup accounts on",
|
|
46
|
+
why_switch_unreadable: "{0} did not say whether account changes are allowed. Check its Runtime window.",
|
|
47
|
+
why_not_installed: "Claude Code is not installed on {0}. Install it from Settings → Runtime.",
|
|
48
|
+
why_not_created: "This account was not created by AgEnD's Runtime, so it can only be handled on {0}.",
|
|
49
|
+
why_default_login: "This is the Windows user's own sign-in on {0}. It is never changed from here: add an account instead.",
|
|
33
50
|
acctLabel: "Account", acctInherit: "Fleet default ({0})", acctInheritDefault: "Fleet default (default sign-in)", acctNotSignedIn: "{0} — not signed in",
|
|
34
51
|
acctHint: "Changing the account restarts the agent. A signed-out account can't be chosen: sign it in under Accounts first.",
|
|
35
52
|
acctDefaultBlocked: "This fleet's default for {0} is “{1}”, so an agent follows it unless it names another account.",
|
|
@@ -46,13 +63,25 @@ register("accounts", {
|
|
|
46
63
|
carry_claude: "Claude Code 會帶著對話過去。", carry_codex: "Codex 保留原本的對話。", carry_kiro: "Kiro 會開新對話並附上交接。",
|
|
47
64
|
moveNone: "所有 {0} Agent 都已經使用這個帳號。", moveStage: "加入待儲存", cancel: "取消", current: "目前:{0}",
|
|
48
65
|
fleetDefault: "{0} Agent 的 Fleet 預設帳號", fleetDefaultHint: "沒有指定帳號的 Agent 會使用這個。",
|
|
49
|
-
machine: "在 {0}", machineReadOnly: "這裡只能檢視",
|
|
66
|
+
machine: "在 {0}", machineReadOnly: "這裡只能檢視", machineOnline: "在線", machineOffline: "離線", machineDefaultTag: "這台電腦的預設",
|
|
67
|
+
machineNoUsage: "—", machineNoUsageHint: "那台電腦不回報用量。",
|
|
68
|
+
machineCommand: "在那台電腦上登入", machineCommandHint: "請在 {0} 的終端機執行。",
|
|
69
|
+
why_offline: "{0} 離線了。請先啟動它的 Runtime,才能管理它的帳號。",
|
|
70
|
+
why_runtime_old: "{0} 的 Runtime 太舊,無法從這裡管理帳號。請更新那台電腦上的 Runtime。",
|
|
71
|
+
why_accounts_off: "{0} 的擁有者尚未允許從 AgEnD 變更帳號。請在那台電腦上執行:agend-runtime remote-setup accounts on",
|
|
72
|
+
why_switch_unreadable: "{0} 沒有回報是否允許變更帳號。請檢查它的 Runtime 視窗。",
|
|
73
|
+
why_not_installed: "{0} 上沒有安裝 Claude Code。請從「設定 → Runtime」安裝。",
|
|
74
|
+
why_not_created: "這個帳號不是 AgEnD 的 Runtime 建立的,只能在 {0} 上處理。",
|
|
75
|
+
why_default_login: "這是 {0} 上 Windows 使用者自己的登入,永遠不會從這裡更改:請改用新增帳號。",
|
|
50
76
|
acctLabel: "帳號", acctInherit: "Fleet 預設({0})", acctInheritDefault: "Fleet 預設(預設登入)", acctNotSignedIn: "{0}——尚未登入",
|
|
51
77
|
acctHint: "更換帳號會重新啟動 Agent。尚未登入的帳號不能選,請先在「帳號」登入。",
|
|
52
78
|
acctDefaultBlocked: "這個 Fleet 的 {0} 預設帳號是「{1}」,Agent 除非指定其他帳號,否則會使用它。",
|
|
53
79
|
},
|
|
54
80
|
});
|
|
55
81
|
const tx = (k, ...v) => t(`accounts.${k}`, ...v);
|
|
82
|
+
/** The reasons that apply to a whole computer (the heading says them once); the others belong to one row. A code a newer server sends that this page does not know is shown as it is. */
|
|
83
|
+
const MACHINE_LEVEL = new Set(["offline", "runtime_old", "accounts_off", "switch_unreadable", "not_installed"]);
|
|
84
|
+
const reasonText = (code, name) => { const key = `why_${code}`, text = tx(key, name); return text === `accounts.${key}` ? String(code) : text; };
|
|
56
85
|
/** This view's stylesheet, linked once (a tab opened before an upgrade has an app.css without these rules). */
|
|
57
86
|
function linkAccountsCss(doc = typeof document !== "undefined" ? document : null) {
|
|
58
87
|
try {
|
|
@@ -65,15 +94,35 @@ function linkAccountsCss(doc = typeof document !== "undefined" ? document : null
|
|
|
65
94
|
const CARRY = { "claude-code": "carry_claude", codex: "carry_codex", "kiro-cli": "carry_kiro" };
|
|
66
95
|
|
|
67
96
|
export const accountsStore = createStore({ loaded: false, failed: false, view: null });
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
97
|
+
/**
|
|
98
|
+
* #3313 review P2-7: the server says sign-ins changed (`backend_login`: a sign-in moved, an account was learned, a Keep
|
|
99
|
+
* sign-in alive check finished): a page showing the accounts reads them again, fresh. Listened to once per page. The
|
|
100
|
+
* existing event, so a tab whose cached shell (app-stream.js) predates this still delivers it.
|
|
101
|
+
*/
|
|
102
|
+
let accountsEventOff = null;
|
|
103
|
+
export function listenAccountsEvent() {
|
|
104
|
+
if (accountsEventOff) return;
|
|
105
|
+
const on = appStore.get().streamOn;
|
|
106
|
+
if (typeof on !== "function") return;
|
|
107
|
+
accountsEventOff = on("backend_login", () => { if (accountsStore.get().loaded) void refreshAccounts({ fresh: true }); }) || (() => {});
|
|
108
|
+
}
|
|
109
|
+
let reading = null, started = 0, applied = 0;
|
|
110
|
+
/**
|
|
111
|
+
* Read GET /ui/accounts. A read already running is joined — unless `fresh` (#3291 review, Prism P2-4: after a write, the
|
|
112
|
+
* view must come from a read that began after it): then a new read starts, and an older one that answers later never
|
|
113
|
+
* replaces a newer answer. Resolves true only when THIS read's view was applied (#3313 review r2: what a write's follow-up
|
|
114
|
+
* read needs to know).
|
|
115
|
+
*/
|
|
116
|
+
export function refreshAccounts({ fresh = false } = {}) {
|
|
117
|
+
if (reading && !fresh) return reading;
|
|
118
|
+
const mine = ++started;
|
|
119
|
+
const apply = (next) => { if (mine > applied) { applied = mine; accountsStore.set(next); return true; } return false; };
|
|
120
|
+
const p = fetch("/ui/accounts", { credentials: "same-origin", cache: "no-store" })
|
|
121
|
+
.then(async (r) => { const v = r.ok ? await r.json() : null; return apply({ loaded: true, failed: !v, view: v }) && !!v; })
|
|
122
|
+
.catch(() => { apply({ loaded: true, failed: true, view: accountsStore.get().view }); return false; })
|
|
123
|
+
.finally(() => { if (reading === p) reading = null; });
|
|
124
|
+
reading = p;
|
|
125
|
+
return p;
|
|
77
126
|
}
|
|
78
127
|
const rowName = (row) => (row.profile ? tx("profile", row.profile) : tx("def"));
|
|
79
128
|
const usedText = (row) => {
|
|
@@ -108,31 +157,98 @@ export function accountChoices(view, backend) {
|
|
|
108
157
|
return { fleetDefault: cli.fleetDefault, rows: cli.rows.filter((r) => r.scope && r.scope.kind === "host" && r.profile) };
|
|
109
158
|
}
|
|
110
159
|
|
|
111
|
-
/**
|
|
112
|
-
|
|
160
|
+
/**
|
|
161
|
+
* Settings → Agents → Accounts. `stageAgent(name, inst, patch)` and `stageDefault(backend, profile | null)` stage changes;
|
|
162
|
+
* `openAgent(name)` (#3212 PR 2) opens an agent's own dialog, where its Account is chosen (Remove's Move…).
|
|
163
|
+
*/
|
|
164
|
+
export function AccountsView({ instances, stageAgent, stageDefault, openAgent }) {
|
|
113
165
|
const { loaded, failed, view } = useStore(accountsStore);
|
|
114
166
|
// Settings read its data again (after a Save): so does this view.
|
|
115
167
|
useEffect(() => { if (loaded) void refreshAccounts(); }, [instances]);
|
|
116
168
|
const { structured, login } = useStore(signInStore);
|
|
169
|
+
const machineLogin = useStore(machineSignInStore); // #3190 Part 3c: the open sign-in dialog of a computer's account
|
|
117
170
|
const [move, setMove] = useState(null); // { cli, row }
|
|
171
|
+
const [adding, setAdding] = useState(null); // #3212 PR 2: the card whose + Add account is open; #3190 Part 3c: { cli, machine } for a computer's
|
|
172
|
+
const [removing, setRemoving] = useState(null); // { cli, row }
|
|
173
|
+
const [signingOut, setSigningOut] = useState(null); // #3212 PR 3: { cli, row, mode: "signout" | "switch" }
|
|
174
|
+
const mounted = useRef(true);
|
|
175
|
+
useEffect(() => () => { mounted.current = false; }, []);
|
|
176
|
+
// #3291 review (Prism P2-5 remainder): each dialog this view opens is a new interaction. Add's follow-up (the read,
|
|
177
|
+
// then Sign in) belongs to the interaction it came from: any later one — another Add, a Remove, Move agents — makes it
|
|
178
|
+
// do nothing.
|
|
179
|
+
const interaction = useRef(0);
|
|
180
|
+
const begin = (fn) => (...a) => { interaction.current++; fn(...a); };
|
|
118
181
|
// The sign-in controllers' state too (a sign-in already running disables Sign in, as the old list did).
|
|
119
|
-
useEffect(() => { linkAccountsCss(); void refreshAccounts(); void refreshSignIn(); }, []);
|
|
182
|
+
useEffect(() => { linkAccountsCss(); listenAccountsEvent(); void refreshAccounts(); void refreshSignIn(); }, []);
|
|
120
183
|
// A sign-in that ends may be another account now: read again.
|
|
121
|
-
const phase = `${(login && login.phase) || ""}:${(structured && structured.login && structured.login.phase) || ""}`;
|
|
184
|
+
const phase = `${(login && login.phase) || ""}:${(structured && structured.login && structured.login.phase) || ""}:${machineLogin.phase || ""}`;
|
|
122
185
|
useEffect(() => { if (loaded) void refreshAccounts(); }, [phase]);
|
|
123
186
|
const active = structured && structured.login;
|
|
124
|
-
const
|
|
125
|
-
|
|
187
|
+
const machineActive = !!machineLogin.phase && machineLogin.phase !== "done" && !(machineLogin.phase === "failed" && machineLogin.reason);
|
|
188
|
+
const running = !!((login && login.phase === "running") || (active && active.phase !== "done" && !(active.phase === "failed" && active.reason)) || machineActive);
|
|
189
|
+
if (!loaded) return html`<section class="s-group s-accounts" aria-label=${tx("title")}>
|
|
190
|
+
<header class="s-auth-section-head"><div><h3>${tx("title")}</h3><p>${tx("hint")}</p></div></header>
|
|
191
|
+
<${Skeleton} variant="cards" lines=${2} label=${tx("loading")} /></section>`;
|
|
126
192
|
if (failed && !view) return html`<p class="note" role="alert">${tx("failed")}</p>`;
|
|
127
193
|
const clis = (view && view.clis) || [];
|
|
128
194
|
return html`<section class="s-group s-accounts" aria-label=${tx("title")}>
|
|
129
195
|
<header class="s-auth-section-head"><div><h3>${tx("title")}</h3><p>${tx("hint")}</p></div></header>
|
|
130
|
-
${!clis.length ? html`<p class="note">${tx("empty")}</p>` : clis.map((cli) => html`<${Card} key=${cli.backend} cli=${cli} running=${running} onMove=${(row) => setMove({ cli, row })} stageDefault=${stageDefault}
|
|
196
|
+
${!clis.length ? html`<p class="note">${tx("empty")}</p>` : clis.map((cli) => html`<${Card} key=${cli.backend} cli=${cli} running=${running} onMove=${begin((row) => setMove({ cli, row }))} stageDefault=${stageDefault}
|
|
197
|
+
onAdd=${begin((machine) => setAdding(machine ? { cli, machine } : cli))} onRemove=${begin((row) => setRemoving({ cli, row }))} onSignIn=${begin((target) => (target.machine ? openMachineSignIn(target) : openSignIn(target)))}
|
|
198
|
+
onSignOut=${begin((row, mode) => setSigningOut({ cli, row, mode }))} />`)}
|
|
131
199
|
${move ? html`<${MoveDialog} cli=${move.cli} row=${move.row} instances=${instances} stageAgent=${stageAgent} onClose=${() => setMove(null)} />` : null}
|
|
200
|
+
${adding ? html`<${AddAccountDialog} cli=${adding.machine ? adding.cli : adding} machine=${adding.machine || null} label=${cliLabel((adding.machine ? adding.cli : adding).backend)} onClose=${() => setAdding(null)}
|
|
201
|
+
onAdded=${(name) => { const mine = ++interaction.current, a = adding; void (a.machine ? machineAdded(a.machine, name, () => mounted.current && interaction.current === mine) : accountAdded(a.backend, name, () => mounted.current && interaction.current === mine)); }} />` : null}
|
|
202
|
+
${signingOut ? html`<${SignOutDialog} cli=${signingOut.cli} row=${signingOut.row} mode=${signingOut.mode} label=${cliLabel(signingOut.cli.backend)}
|
|
203
|
+
onClose=${() => setSigningOut(null)} onMove=${(user) => moveUser(signingOut.cli.backend, user, openAgent)}
|
|
204
|
+
onDone=${() => { const s = signingOut, mine = ++interaction.current; void signedOut(s, () => mounted.current && interaction.current === mine); }} />` : null}
|
|
205
|
+
${removing ? html`<${RemoveAccountDialog} cli=${removing.cli} row=${removing.row} label=${cliLabel(removing.cli.backend)} onClose=${() => setRemoving(null)}
|
|
206
|
+
onRemoved=${() => void refreshAccounts({ fresh: true })} onMove=${(user) => moveUser(removing.cli.backend, user, openAgent)} />` : null}
|
|
132
207
|
</section>`;
|
|
133
208
|
}
|
|
134
209
|
|
|
135
|
-
|
|
210
|
+
/**
|
|
211
|
+
* After + Add account: the view read again (a read begun after the write), then Sign in at once where the dashboard can
|
|
212
|
+
* sign it in (else its row shows the host command) — only while this is still the person's current interaction
|
|
213
|
+
* (`current()`: the view on screen, no dialog opened since) and no other dialog is open on the page.
|
|
214
|
+
*/
|
|
215
|
+
async function accountAdded(backend, name, current) {
|
|
216
|
+
await refreshAccounts({ fresh: true });
|
|
217
|
+
if (!current() || shellStore.get().dialog) return;
|
|
218
|
+
const v = accountsStore.get().view, cli = v && Array.isArray(v.clis) ? v.clis.find((c) => c.backend === backend) : null;
|
|
219
|
+
const row = cli ? cli.rows.find((r) => r.scope && r.scope.kind === "host" && r.profile === name) : null;
|
|
220
|
+
if (row && row.signIn) { toast(manageWords.added(name), true); openSignIn({ backend, profile: name }); }
|
|
221
|
+
else toast(manageWords.addedHost(name), true);
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* #3190 Part 3c: after + Add account on a computer: the server only checked the name (the folder is made by that computer's Runtime when the first sign-in starts), so
|
|
225
|
+
* Sign in opens at once for the new name — while this is still the person's current interaction and no other dialog is open.
|
|
226
|
+
*/
|
|
227
|
+
async function machineAdded(machine, name, current) {
|
|
228
|
+
await refreshAccounts({ fresh: true });
|
|
229
|
+
if (!current() || shellStore.get().dialog) return;
|
|
230
|
+
openMachineSignIn({ machine, profile: name });
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* #3212 PR 3: after Sign out — the view and the sign-ins read again (reads begun after it); Switch account then opens
|
|
234
|
+
* Sign in for the same CLI's default sign-in, while that is still the person's current interaction and no other dialog
|
|
235
|
+
* is open.
|
|
236
|
+
*/
|
|
237
|
+
async function signedOut({ cli, row, mode }, current) {
|
|
238
|
+
await Promise.all([refreshAccounts({ fresh: true }), refreshSignIn()]);
|
|
239
|
+
if (mode !== "switch" || !current() || shellStore.get().dialog) return;
|
|
240
|
+
openSignIn({ backend: cli.backend, ...(row.profile ? { profile: row.profile } : {}) });
|
|
241
|
+
}
|
|
242
|
+
/** Remove's Move…: an agent's own dialog (its Account field), or the card's fleet-default selector. */
|
|
243
|
+
function moveUser(backend, user, openAgent) {
|
|
244
|
+
if (user.kind === "agent" && typeof openAgent === "function") { openAgent(user.name); return; }
|
|
245
|
+
if (user.kind === "default" && typeof document !== "undefined") {
|
|
246
|
+
const sel = document.querySelector(`.s-account-card[data-backend="${backend}"] .s-account-default select`);
|
|
247
|
+
if (sel) { sel.scrollIntoView?.({ block: "center" }); sel.focus(); }
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function Card({ cli, running, onMove, stageDefault, onAdd, onRemove, onSignIn, onSignOut }) {
|
|
136
252
|
const [picked, setPicked] = useState(undefined); // a staged fleet default, shown until Save reads it back
|
|
137
253
|
useEffect(() => setPicked(undefined), [cli.fleetDefault]);
|
|
138
254
|
const host = cli.rows.filter((r) => r.scope && r.scope.kind === "host");
|
|
@@ -140,10 +256,10 @@ function Card({ cli, running, onMove, stageDefault }) {
|
|
|
140
256
|
for (const r of cli.rows) if (r.scope && r.scope.kind === "machine") { const k = r.scope.id; if (!machines.has(k)) machines.set(k, { scope: r.scope, rows: [] }); machines.get(k).rows.push(r); }
|
|
141
257
|
const signedIn = host.filter((r) => r.profile && r.state !== "not_signed_in");
|
|
142
258
|
return html`<div class="s-account-card" data-backend=${cli.backend}>
|
|
143
|
-
<div class="s-account-head"><${CliProductMark} id=${cli.backend} size=${24} /><strong>${cliLabel(cli.backend)}</strong
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
259
|
+
<div class="s-account-head"><${CliProductMark} id=${cli.backend} size=${24} /><strong>${cliLabel(cli.backend)}</strong>
|
|
260
|
+
${cli.profiles && typeof onAdd === "function" ? html`<button type="button" class="btn btn-sm s-account-add" onClick=${() => onAdd()}>${manageWords.add()}</button>` : null}</div>
|
|
261
|
+
<div class="s-account-rows">${host.map((row) => html`<${Row} key=${row.profile || ""} cli=${cli} row=${row} running=${running} onMove=${onMove} onRemove=${onRemove} onSignIn=${onSignIn} onSignOut=${onSignOut} />`)}</div>
|
|
262
|
+
${[...machines.values()].map((m) => html`<${MachineSection} key=${m.scope.id} cli=${cli} m=${m} running=${running} onAdd=${onAdd} onSignIn=${onSignIn} onSignOut=${onSignOut} onRemove=${onRemove} />`)}
|
|
147
263
|
${cli.profiles && typeof stageDefault === "function" ? html`<label class="field s-account-default"><span>${tx("fleetDefault", cliLabel(cli.backend))}</span>
|
|
148
264
|
<select value=${(picked !== undefined ? picked : cli.fleetDefault) || ""} onChange=${(e) => { setPicked(e.target.value || null); stageDefault(cli.backend, e.target.value || null); }}>
|
|
149
265
|
<option value="">${tx("def")}</option>
|
|
@@ -153,21 +269,49 @@ function Card({ cli, running, onMove, stageDefault }) {
|
|
|
153
269
|
</div>`;
|
|
154
270
|
}
|
|
155
271
|
|
|
156
|
-
|
|
272
|
+
/**
|
|
273
|
+
* #3190 Part 3c: one paired computer's accounts under its name: online or not, why nothing can be changed there when that is so (said once, for the whole
|
|
274
|
+
* computer), + Add account where its Runtime will take one, and its rows.
|
|
275
|
+
*/
|
|
276
|
+
function MachineSection({ cli, m, running, onAdd, onSignIn, onSignOut, onRemove }) {
|
|
277
|
+
const level = m.rows.map((r) => r.scope.readOnlyReason).find((code) => code && MACHINE_LEVEL.has(code));
|
|
278
|
+
const online = !!m.scope.online;
|
|
279
|
+
return html`<div class="s-account-machine" data-machine=${m.scope.id}>
|
|
280
|
+
<div class="s-account-machine-head"><strong>${tx("machine", m.scope.name)}</strong>
|
|
281
|
+
<span class=${`tag s-auth-state is-${online ? "usable" : "unknown"}`}>${online ? tx("machineOnline") : tx("machineOffline")}</span>
|
|
282
|
+
${cli.profiles && !level && typeof onAdd === "function" ? html`<button type="button" class="btn btn-sm s-account-add" disabled=${running} onClick=${() => onAdd(m.scope)}>${manageWords.add()}</button>` : null}</div>
|
|
283
|
+
${level ? html`<p class="note s-account-why" role="status">${reasonText(level, m.scope.name)}</p>` : null}
|
|
284
|
+
${m.rows.map((row) => html`<${Row} key=${`m:${m.scope.id}:${row.profile || ""}`} cli=${cli} row=${row} running=${running} onSignIn=${onSignIn} onSignOut=${onSignOut} onRemove=${onRemove} />`)}
|
|
285
|
+
</div>`;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function Row({ cli, row, onMove, onRemove, onSignIn = openSignIn, onSignOut, running = false, readOnly = false }) {
|
|
289
|
+
// #3212 PR 3: a signed-in account of a CLI whose own logout the dashboard runs; Switch account on the default sign-in.
|
|
290
|
+
// #3190 Part 3c: a computer's row is changed only where its Runtime allows it (`signIn`); never its default (the Windows user's own sign-in), never Move or Switch.
|
|
291
|
+
const machine = row.scope && row.scope.kind === "machine" ? row.scope : null;
|
|
292
|
+
const manageable = !machine || (row.signIn && !!row.profile);
|
|
293
|
+
const canSignOut = manageable && typeof onSignOut === "function" && row.state === "usable" && SIGN_OUT_CLIS.has(row.backend);
|
|
157
294
|
const who = identityText(row.identity);
|
|
158
295
|
const u = row.usage;
|
|
296
|
+
const why = machine && machine.readOnlyReason && !MACHINE_LEVEL.has(machine.readOnlyReason) ? reasonText(machine.readOnlyReason, machine.name) : "";
|
|
159
297
|
return html`<div class="s-row s-account-row" data-account=${row.profile || "default"}>
|
|
160
298
|
<div class="s-account-who"><strong>${rowName(row)}</strong>
|
|
161
299
|
${who ? html`<small class="s-account-identity">${who}</small>` : null}
|
|
162
|
-
<small class="s-account-used">${usedText(row)}${row.usedBy.fleetDefault && cli.profiles ? html` · <span class="tag">${tx("fleetDefaultTag")}</span>` : null}</small>
|
|
300
|
+
<small class="s-account-used">${usedText(row)}${row.usedBy.fleetDefault && cli.profiles ? html` · <span class="tag">${machine ? tx("machineDefaultTag") : tx("fleetDefaultTag")}</span>` : null}</small>
|
|
301
|
+
${machine ? html`<small class="s-account-usage is-none" title=${tx("machineNoUsageHint")}>${tx("machineNoUsage")}</small>` : null}
|
|
302
|
+
${why ? html`<small class="note s-account-why">${why}</small>` : null}
|
|
163
303
|
${u ? html`<small class=${`s-account-usage${u.stale ? " is-stale" : ""}`}>${tx("weekly", u.percent)}${u.resetsAt ? ` · ${tx("resets", when(u.resetsAt))}` : ""}${u.stale ? ` · ${tx("stale")}` : ""}</small>` : null}
|
|
164
304
|
</div>
|
|
165
305
|
<span class=${`tag s-auth-state is-${row.state || "unknown"}`}>${tx(`state_${row.state || "unknown"}`)}</span>
|
|
166
306
|
${readOnly ? null : html`<span class="s-actions">
|
|
167
|
-
${row.signIn ? html`<button type="button" class=${row.state === "not_signed_in" ? "btn btn-sm btn-primary" : "btn btn-sm"} disabled=${running} onClick=${() =>
|
|
168
|
-
${cli.profiles && row.state !== "not_signed_in" && typeof onMove === "function" ? html`<button type="button" class="btn btn-sm" onClick=${() => onMove(row)}>${tx("moveHere")}</button>` : null}
|
|
307
|
+
${row.signIn && typeof onSignIn === "function" ? html`<button type="button" class=${row.state === "not_signed_in" ? "btn btn-sm btn-primary" : "btn btn-sm"} disabled=${running} onClick=${() => onSignIn({ backend: row.backend, ...(row.profile ? { profile: row.profile } : {}), ...(machine ? { machine } : {}) })}>${row.state === "usable" ? tx("signInAgain") : tx("signIn")}</button>` : null}
|
|
308
|
+
${!machine && cli.profiles && row.state !== "not_signed_in" && typeof onMove === "function" ? html`<button type="button" class="btn btn-sm" onClick=${() => onMove(row)}>${tx("moveHere")}</button>` : null}
|
|
309
|
+
${canSignOut && !machine && !row.profile && row.signIn ? html`<button type="button" class="btn btn-sm s-account-switch" disabled=${running} onClick=${() => onSignOut(row, "switch")}>${manageWords.switchAccount()}</button>` : null}
|
|
310
|
+
${canSignOut ? html`<button type="button" class="btn btn-sm btn-ghost s-account-signout" disabled=${running} onClick=${() => onSignOut(row, "signout")}>${manageWords.signOut()}</button>` : null}
|
|
311
|
+
${manageable && row.profile && typeof onRemove === "function" ? html`<button type="button" class="btn btn-sm btn-ghost s-account-remove" onClick=${() => onRemove(row)}>${manageWords.remove()}</button>` : null}
|
|
169
312
|
</span>`}
|
|
170
|
-
${!readOnly && !row.signIn && row.hostCommand ? html`<details class="s-host-cli-help"><summary>${tx("hostCommand")}</summary><p class="note">${tx("hostCommandHint")}</p><p class="s-host-cli-command"><code>${row.hostCommand}</code></p></details>` : null}
|
|
313
|
+
${!readOnly && !row.signIn && row.hostCommand ? html`<details class="s-host-cli-help"><summary>${machine ? tx("machineCommand") : tx("hostCommand")}</summary><p class="note">${machine ? tx("machineCommandHint", machine.name) : tx("hostCommandHint")}</p><p class="s-host-cli-command"><code>${row.hostCommand}</code></p></details>` : null}
|
|
314
|
+
${!readOnly && row.keepAlive && (!row.scope || row.scope.kind === "host") ? html`<${KeepAliveControl} row=${row} onSaved=${() => refreshAccounts({ fresh: true })} />` : null}
|
|
171
315
|
</div>`;
|
|
172
316
|
}
|
|
173
317
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {html,useEffect,useRef,useState} from "/assets/app-html.js";
|
|
2
|
+
import { Skeleton } from "/assets/ui-states.js";
|
|
2
3
|
import {useLease} from "/assets/app-ctx.js";
|
|
3
4
|
import {appStore,useStore} from "/assets/app-store.js";
|
|
4
5
|
import {register,t} from "/assets/app-i18n.js";
|
|
@@ -58,7 +59,7 @@ export function AgentRuntimeChangeDialog({name,inst,onClose,onChanged}){
|
|
|
58
59
|
};
|
|
59
60
|
const close=()=>{if(!claim.current)onClose();};
|
|
60
61
|
return html`<${Dialog} title=${text("title")} cls="agent-runtime-change-dialog" busy=${busy} onClose=${close} wide=${true} actions=${html`<button type="button" class="btn" disabled=${busy} onClick=${close}>${text("cancel")}</button>${step===2?html`<button type="button" class="btn" disabled=${busy||uncertain} onClick=${()=>setStep(1)}>${text("back")}</button>`:null}<button type="button" class="btn btn-primary" disabled=${busy||uncertain||!source||!targetReady||(step===2&&(!f.fresh||!allowedRead&&f.access==="read-only"))} onClick=${step===1?()=>setStep(2):submit}>${text(step===1?"next":"apply")}</button>`}>
|
|
61
|
-
<div class="form agent-runtime-change" aria-busy=${busy}><p>${text("lead")}</p>${!source?html
|
|
62
|
+
<div class="form agent-runtime-change" aria-busy=${busy}><p>${text("lead")}</p>${!source&&!error?html`<${Skeleton} variant="rows" lines=${3} label=${text("loading")} />`:null}
|
|
62
63
|
${source&&step===1?html`<${RuntimePicker} value=${f.runtime} onChange=${runtime=>choose(runtime)} windowsEnabled=${windowsCli===true} machineId=${f.machineId} machines=${machines} onMachineChange=${id=>choose("windows",id)} onRefresh=${machinesState.refresh} loaded=${!!machinesState.data && !machinesState.error}/><div class="field"><label>${tr("backend")}</label><${CliPicker} value=${f.backend} choices=${choices} label=${tr("backend")} onChange=${backend=>setForm(old=>({...old,backend,model:"",credentialProfile:backend==="claude-code"?old.credentialProfile:"",fresh:false}))}/></div>${removedBackendReplacement(f.backend)?html`<p class="note" role="status">${text("removed",f.backend,removedBackendReplacement(f.backend))}</p>`:null}${!choices.length?html`<p class="note">${text("noCli")}</p>`:null}`:null}
|
|
63
64
|
${source&&step===2?html`<h3>${text("configure")}</h3><p><strong>${machine?.name||(windows?tr("windows"):tr("wsl"))}</strong> · ${cliLabel(f.backend)}</p><label class="field"><span>${tr("directory")}</span><input value=${f.directory} disabled=${busy||uncertain} onInput=${event=>set("directory",event.target.value)}/></label><p class="note">${text("directoryHint")}</p><div class="field"><label for="runtime-change-model">${t("settings.model")}</label><${ModelSelect} id="runtime-change-model" disabled=${busy||uncertain} value=${f.model} onChange=${value=>set("model",value)} backend=${f.backend} instance=${!windows&&source.runtime==="wsl"&&source.backend===f.backend?name:undefined} runtime=${f.runtime} machineId=${f.machineId} inherit=${t("settings.modelCliDefault")}/></div>
|
|
64
65
|
${windows?html`<label class="field"><span>${tr("access")}</span><select value=${f.access} disabled=${busy||uncertain} onChange=${event=>set("access",event.target.value)}><option value="read-only" disabled=${!allowedRead}>${tr("read")}</option><option value="workspace-write">${tr("write")}</option></select></label>${!allowedRead?html`<p class="note" role="status">${tr("noReadOnly")}</p>`:null}<label class="field"><span>${tr("adapter")}</span><select value=${f.adapter} disabled=${busy||uncertain} onChange=${event=>set("adapter",event.target.value)}><option value="exec">${tr("adapterExec")}</option><option value="pane" disabled=${!["codex","claude-code"].includes(f.backend)}>${tr("adapterPane")}</option></select></label>${f.machineId?html`<${ClaudeAccountSelect} id="runtime-change-claude-account" machine=${machine} backend=${f.backend} value=${f.credentialProfile} onChange=${value=>set("credentialProfile",value)} disabled=${busy||uncertain||machine?.status!=="online"} changeNote=${true}/>`:null}`:null}
|
package/dist/ui/app.html
CHANGED
|
@@ -13,11 +13,18 @@
|
|
|
13
13
|
<script src="/assets/theme.js"></script>
|
|
14
14
|
<link rel="stylesheet" href="/assets/tokens.css">
|
|
15
15
|
<link rel="stylesheet" href="/assets/app.css">
|
|
16
|
+
<link rel="stylesheet" href="/assets/loading.css">
|
|
16
17
|
<script src="/assets/agend-auth.js"></script>
|
|
17
18
|
<script type="module" src="/assets/app.js"></script>
|
|
18
19
|
</head>
|
|
19
20
|
<body>
|
|
20
|
-
<div id="app" class="app-root"
|
|
21
|
+
<div id="app" class="app-root"><div class="sk-boot" role="status" aria-busy="true" aria-label="Loading…">
|
|
22
|
+
<div class="sk-boot-side" aria-hidden="true"><div class="skeleton"><div class="sk-line"></div><div class="sk-line"></div><div class="sk-line"></div></div></div>
|
|
23
|
+
<div class="sk-boot-main" aria-hidden="true"><div class="sk-boot-head skeleton"><div class="sk-line"></div></div>
|
|
24
|
+
<div class="skeleton sk-rows"><div class="sk-row"><div class="sk-line sk-thumb"></div><div class="sk-copy"><div class="sk-line"></div><div class="sk-line"></div></div><div class="sk-line sk-pill"></div></div>
|
|
25
|
+
<div class="sk-row"><div class="sk-line sk-thumb"></div><div class="sk-copy"><div class="sk-line"></div><div class="sk-line"></div></div><div class="sk-line sk-pill"></div></div>
|
|
26
|
+
<div class="sk-row"><div class="sk-line sk-thumb"></div><div class="sk-copy"><div class="sk-line"></div><div class="sk-line"></div></div><div class="sk-line sk-pill"></div></div></div>
|
|
27
|
+
</div></div></div>
|
|
21
28
|
<noscript><p class="noscript">AgEnD's web app needs JavaScript.</p></noscript>
|
|
22
29
|
</body>
|
|
23
30
|
</html>
|