@songsid/agend 2.4.0-beta.7 → 2.4.0-beta.9
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/dist/auth-api.js +4 -0
- package/dist/auth-api.js.map +1 -1
- package/dist/backend/antigravity.d.ts +9 -2
- package/dist/backend/antigravity.js +24 -6
- package/dist/backend/antigravity.js.map +1 -1
- package/dist/backend/cli-env-probe.js +1 -1
- package/dist/backend/cli-env-probe.js.map +1 -1
- package/dist/backend/cli-runtime-switch.js +1 -26
- package/dist/backend/cli-runtime-switch.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/connect/mcp.d.ts +9 -0
- package/dist/connect/mcp.js +10 -0
- package/dist/connect/mcp.js.map +1 -0
- package/dist/connect/stdio.d.ts +1 -1
- package/dist/connect/stdio.js +22 -28
- package/dist/connect/stdio.js.map +1 -1
- package/dist/daemon.d.ts +13 -0
- package/dist/daemon.js +64 -1
- package/dist/daemon.js.map +1 -1
- package/dist/dispatcher-liveness.d.ts +51 -1
- package/dist/dispatcher-liveness.js +92 -2
- package/dist/dispatcher-liveness.js.map +1 -1
- package/dist/fleet-manager.d.ts +56 -1
- package/dist/fleet-manager.js +243 -32
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/hub/SKILL.md +83 -3
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +10 -2
- package/dist/hub/admin-dashboard.js +17 -1
- package/dist/hub/admin-dashboard.js.map +1 -1
- package/dist/hub/audit/index.d.ts +2 -0
- package/dist/hub/audit/index.js +8 -0
- package/dist/hub/audit/index.js.map +1 -1
- package/dist/hub/buttons.js +3 -1
- package/dist/hub/buttons.js.map +1 -1
- package/dist/hub/catalog.d.ts +7 -4
- package/dist/hub/catalog.js +19 -10
- package/dist/hub/catalog.js.map +1 -1
- package/dist/hub/client.d.ts +3 -0
- package/dist/hub/client.js +14 -2
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.js +28 -11
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.d.ts +5 -0
- package/dist/hub/compose/server.js +91 -10
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/group-policy/admin-api.d.ts +1 -0
- package/dist/hub/group-policy/admin-api.js +1 -1
- package/dist/hub/group-policy/admin-api.js.map +1 -1
- package/dist/hub/group-policy/admin-dto.d.ts +2 -1
- package/dist/hub/group-policy/admin-impact.d.ts +32 -3
- package/dist/hub/group-policy/admin-impact.js +14 -2
- package/dist/hub/group-policy/admin-impact.js.map +1 -1
- package/dist/hub/group-policy/admin-inventory.d.ts +2 -0
- package/dist/hub/group-policy/admin-inventory.js +13 -4
- package/dist/hub/group-policy/admin-inventory.js.map +1 -1
- package/dist/hub/group-policy/authorization.d.ts +2 -0
- package/dist/hub/group-policy/authorization.js +7 -2
- package/dist/hub/group-policy/authorization.js.map +1 -1
- package/dist/hub/group-policy/impact-inventory.d.ts +1 -1
- package/dist/hub/group-policy/impact-inventory.js.map +1 -1
- package/dist/hub/group-policy/resources.d.ts +2 -0
- package/dist/hub/group-policy/resources.js +12 -1
- package/dist/hub/group-policy/resources.js.map +1 -1
- package/dist/hub/http/compose.js +164 -23
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/core.js +27 -0
- package/dist/hub/http/core.js.map +1 -1
- package/dist/hub/http/deps.d.ts +12 -0
- package/dist/hub/http/schema.js +6 -0
- package/dist/hub/http/schema.js.map +1 -1
- package/dist/hub/join/service.d.ts +1 -1
- package/dist/hub/join/service.js.map +1 -1
- package/dist/hub/mcp/auth-schema.d.ts +7 -0
- package/dist/hub/mcp/auth-schema.js +31 -0
- package/dist/hub/mcp/auth-schema.js.map +1 -0
- package/dist/hub/mcp/auth.d.ts +89 -0
- package/dist/hub/mcp/auth.js +374 -0
- package/dist/hub/mcp/auth.js.map +1 -0
- package/dist/hub/mcp/catalog.d.ts +44 -0
- package/dist/hub/mcp/catalog.js +31 -0
- package/dist/hub/mcp/catalog.js.map +1 -0
- package/dist/hub/mcp/door-schema.d.ts +7 -0
- package/dist/hub/mcp/door-schema.js +20 -0
- package/dist/hub/mcp/door-schema.js.map +1 -0
- package/dist/hub/mcp/http.d.ts +25 -0
- package/dist/hub/mcp/http.js +259 -0
- package/dist/hub/mcp/http.js.map +1 -0
- package/dist/hub/mcp/policy.d.ts +65 -0
- package/dist/hub/mcp/policy.js +153 -0
- package/dist/hub/mcp/policy.js.map +1 -0
- package/dist/hub/mcp/server.d.ts +3 -0
- package/dist/hub/mcp/server.js +32 -0
- package/dist/hub/mcp/server.js.map +1 -0
- package/dist/hub/mcp/tools.d.ts +31 -0
- package/dist/hub/mcp/tools.js +176 -0
- package/dist/hub/mcp/tools.js.map +1 -0
- package/dist/hub/member/room-ask.d.ts +4 -4
- package/dist/hub/member/room-ask.js +12 -0
- package/dist/hub/member/room-ask.js.map +1 -1
- package/dist/hub/member/room-mention-feedback.d.ts +44 -0
- package/dist/hub/member/room-mention-feedback.js +121 -0
- package/dist/hub/member/room-mention-feedback.js.map +1 -0
- package/dist/hub/member/room-notification.d.ts +9 -0
- package/dist/hub/member/room-notification.js +2 -0
- package/dist/hub/member/room-notification.js.map +1 -0
- package/dist/hub/member/room-post-answers.d.ts +1 -7
- package/dist/hub/member/room-post-answers.js.map +1 -1
- package/dist/hub/member/room-post.d.ts +3 -0
- package/dist/hub/member/room-post.js +9 -1
- package/dist/hub/member/room-post.js.map +1 -1
- package/dist/hub/pairing.d.ts +15 -1
- package/dist/hub/pairing.js +33 -2
- package/dist/hub/pairing.js.map +1 -1
- package/dist/hub/personal/owner-host.d.ts +140 -0
- package/dist/hub/personal/owner-host.js +287 -0
- package/dist/hub/personal/owner-host.js.map +1 -0
- package/dist/hub/personal/refusals.d.ts +11 -0
- package/dist/hub/personal/refusals.js +33 -0
- package/dist/hub/personal/refusals.js.map +1 -0
- package/dist/hub/personal/runtime-host.d.ts +26 -0
- package/dist/hub/personal/runtime-host.js +51 -0
- package/dist/hub/personal/runtime-host.js.map +1 -0
- package/dist/hub/personal/schema.d.ts +4 -0
- package/dist/hub/personal/schema.js +54 -0
- package/dist/hub/personal/schema.js.map +1 -0
- package/dist/hub/personal/turns.d.ts +39 -0
- package/dist/hub/personal/turns.js +221 -0
- package/dist/hub/personal/turns.js.map +1 -0
- package/dist/hub/personal/types.d.ts +42 -0
- package/dist/hub/personal/types.js +2 -0
- package/dist/hub/personal/types.js.map +1 -0
- package/dist/hub/policy.d.ts +1 -1
- package/dist/hub/policy.js +2 -0
- package/dist/hub/policy.js.map +1 -1
- package/dist/hub/protocol.d.ts +43 -0
- package/dist/hub/protocol.js +16 -4
- package/dist/hub/protocol.js.map +1 -1
- package/dist/hub/quota.js +3 -1
- package/dist/hub/quota.js.map +1 -1
- package/dist/hub/roles/admin-control.d.ts +29 -0
- package/dist/hub/roles/admin-control.js +187 -0
- package/dist/hub/roles/admin-control.js.map +1 -0
- package/dist/hub/roles/admin-types.d.ts +72 -0
- package/dist/hub/roles/admin-types.js +2 -0
- package/dist/hub/roles/admin-types.js.map +1 -0
- package/dist/hub/roles/allowed-list-control.d.ts +34 -0
- package/dist/hub/roles/allowed-list-control.js +179 -0
- package/dist/hub/roles/allowed-list-control.js.map +1 -0
- package/dist/hub/roles/allowed-list.d.ts +8 -0
- package/dist/hub/roles/allowed-list.js +49 -0
- package/dist/hub/roles/allowed-list.js.map +1 -0
- package/dist/hub/roles/audit-details.d.ts +144 -0
- package/dist/hub/roles/audit-details.js +26 -0
- package/dist/hub/roles/audit-details.js.map +1 -0
- package/dist/hub/roles/authority.d.ts +12 -0
- package/dist/hub/roles/authority.js +39 -3
- package/dist/hub/roles/authority.js.map +1 -1
- package/dist/hub/roles/change.d.ts +3 -1
- package/dist/hub/roles/change.js +4 -3
- package/dist/hub/roles/change.js.map +1 -1
- package/dist/hub/roles/clock.d.ts +3 -0
- package/dist/hub/roles/clock.js +1 -1
- package/dist/hub/roles/clock.js.map +1 -1
- package/dist/hub/roles/cutover-inventory.d.ts +2 -0
- package/dist/hub/roles/cutover-inventory.js +8 -1
- package/dist/hub/roles/cutover-inventory.js.map +1 -1
- package/dist/hub/roles/cutover.d.ts +2 -2
- package/dist/hub/roles/cutover.js +3 -4
- package/dist/hub/roles/cutover.js.map +1 -1
- package/dist/hub/roles/delegation.d.ts +4 -1
- package/dist/hub/roles/delegation.js +3 -2
- package/dist/hub/roles/delegation.js.map +1 -1
- package/dist/hub/roles/expiry-effects.d.ts +8 -0
- package/dist/hub/roles/expiry-effects.js +50 -0
- package/dist/hub/roles/expiry-effects.js.map +1 -0
- package/dist/hub/roles/migrations.d.ts +7 -0
- package/dist/hub/roles/migrations.js +44 -0
- package/dist/hub/roles/migrations.js.map +1 -0
- package/dist/hub/roles/model.d.ts +2 -0
- package/dist/hub/roles/model.js +2 -1
- package/dist/hub/roles/model.js.map +1 -1
- package/dist/hub/roles/overview.d.ts +8 -0
- package/dist/hub/roles/overview.js +15 -0
- package/dist/hub/roles/overview.js.map +1 -0
- package/dist/hub/roles/resource-effects.d.ts +17 -0
- package/dist/hub/roles/resource-effects.js +62 -0
- package/dist/hub/roles/resource-effects.js.map +1 -0
- package/dist/hub/roles/review.d.ts +16 -0
- package/dist/hub/roles/review.js +42 -0
- package/dist/hub/roles/review.js.map +1 -0
- package/dist/hub/roles/writer.d.ts +14 -3
- package/dist/hub/roles/writer.js +64 -16
- package/dist/hub/roles/writer.js.map +1 -1
- package/dist/hub/room-mention-feedback-model.d.ts +12 -0
- package/dist/hub/room-mention-feedback-model.js +12 -0
- package/dist/hub/room-mention-feedback-model.js.map +1 -0
- package/dist/hub/rooms/agents.d.ts +3 -1
- package/dist/hub/rooms/agents.js +96 -11
- package/dist/hub/rooms/agents.js.map +1 -1
- package/dist/hub/rooms/direct-view.d.ts +6 -2
- package/dist/hub/rooms/direct-view.js +3 -3
- package/dist/hub/rooms/direct-view.js.map +1 -1
- package/dist/hub/rooms/service.d.ts +27 -3
- package/dist/hub/rooms/service.js +74 -13
- package/dist/hub/rooms/service.js.map +1 -1
- package/dist/hub/rooms/types.d.ts +3 -1
- package/dist/hub/rooms.d.ts +12 -2
- package/dist/hub/rooms.js +87 -17
- package/dist/hub/rooms.js.map +1 -1
- package/dist/hub/runtime.js +1 -1
- package/dist/hub/runtime.js.map +1 -1
- package/dist/hub/server.d.ts +2 -0
- package/dist/hub/server.js +19 -3
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/session-directory-transition.d.ts +2 -1
- package/dist/hub/session-directory-transition.js +10 -3
- package/dist/hub/session-directory-transition.js.map +1 -1
- package/dist/hub/sessions.d.ts +1 -1
- package/dist/hub/sessions.js +26 -4
- package/dist/hub/sessions.js.map +1 -1
- package/dist/hub/settings-commit.d.ts +32 -1
- package/dist/hub/settings-commit.js +11 -4
- package/dist/hub/settings-commit.js.map +1 -1
- package/dist/hub/settings-directory-ca.js +1 -1
- package/dist/hub/settings-directory-ca.js.map +1 -1
- package/dist/hub/settings-directory-control.js +7 -7
- package/dist/hub/settings-directory-control.js.map +1 -1
- package/dist/hub/settings-directory-http.d.ts +2 -0
- package/dist/hub/settings-directory-http.js +21 -6
- package/dist/hub/settings-directory-http.js.map +1 -1
- package/dist/hub/settings-directory-proof.d.ts +5 -1
- package/dist/hub/settings-directory-proof.js +27 -9
- package/dist/hub/settings-directory-proof.js.map +1 -1
- package/dist/hub/settings-directory-recovery.js +2 -1
- package/dist/hub/settings-directory-recovery.js.map +1 -1
- package/dist/hub/settings-directory-save.d.ts +2 -0
- package/dist/hub/settings-directory-save.js +9 -6
- package/dist/hub/settings-directory-save.js.map +1 -1
- package/dist/hub/sharing.js +2 -2
- package/dist/hub/sharing.js.map +1 -1
- package/dist/hub/types.d.ts +26 -3
- package/dist/locale.js +13 -10
- package/dist/locale.js.map +1 -1
- package/dist/login-controller.d.ts +19 -2
- package/dist/login-controller.js +26 -8
- package/dist/login-controller.js.map +1 -1
- package/dist/native-model-catalog.d.ts +15 -0
- package/dist/native-model-catalog.js +43 -3
- package/dist/native-model-catalog.js.map +1 -1
- package/dist/runtime-build-info.js +1 -0
- package/dist/runtime-build-info.js.map +1 -1
- package/dist/runtime-cli.js +31 -5
- package/dist/runtime-cli.js.map +1 -1
- package/dist/runtime-client-store.d.ts +5 -0
- package/dist/runtime-client-store.js +28 -0
- package/dist/runtime-client-store.js.map +1 -1
- package/dist/runtime-client.d.ts +4 -0
- package/dist/runtime-client.js +33 -10
- package/dist/runtime-client.js.map +1 -1
- package/dist/runtime-coordinator.d.ts +4 -2
- package/dist/runtime-coordinator.js +33 -6
- package/dist/runtime-coordinator.js.map +1 -1
- package/dist/runtime-install.d.ts +6 -1
- package/dist/runtime-install.js +12 -4
- package/dist/runtime-install.js.map +1 -1
- package/dist/runtime-personal-answer-only-probe.d.ts +3 -0
- package/dist/runtime-personal-answer-only-probe.js +134 -0
- package/dist/runtime-personal-answer-only-probe.js.map +1 -0
- package/dist/runtime-personal-answer-only.d.ts +16 -0
- package/dist/runtime-personal-answer-only.js +54 -0
- package/dist/runtime-personal-answer-only.js.map +1 -0
- package/dist/runtime-personal-answer.d.ts +7 -2
- package/dist/runtime-personal-answer.js +12 -3
- package/dist/runtime-personal-answer.js.map +1 -1
- package/dist/runtime-personal-preflight.d.ts +8 -0
- package/dist/runtime-personal-preflight.js +103 -0
- package/dist/runtime-personal-preflight.js.map +1 -0
- package/dist/runtime-personal-profile.d.ts +7 -1
- package/dist/runtime-personal-profile.js +24 -4
- package/dist/runtime-personal-profile.js.map +1 -1
- package/dist/runtime-personal-protocol.d.ts +10 -0
- package/dist/runtime-personal-protocol.js +15 -0
- package/dist/runtime-personal-protocol.js.map +1 -0
- package/dist/runtime-personal-stage.d.ts +37 -0
- package/dist/runtime-personal-stage.js +167 -0
- package/dist/runtime-personal-stage.js.map +1 -0
- package/dist/runtime-protocol.d.ts +2 -0
- package/dist/setup-form.js +10 -0
- package/dist/setup-form.js.map +1 -1
- package/dist/tunnel/lease.d.ts +14 -0
- package/dist/tunnel/lease.js +23 -0
- package/dist/tunnel/lease.js.map +1 -1
- package/dist/ui/backend-signin.js +86 -20
- package/dist/ui/chat-activity-groups.js +41 -8
- package/dist/ui/chat-activity.js +3 -1
- package/dist/ui/chat-store.js +39 -2
- package/dist/ui/chat-tour.js +1 -1
- package/dist/ui/fleet-canvas.js +10 -5
- package/dist/ui/fleet-office.js +73 -7
- package/dist/ui/hub-ai-apps-strings.js +6 -0
- package/dist/ui/hub-ai-apps.js +83 -0
- package/dist/ui/hub-client.js +32 -1
- package/dist/ui/hub-directory-editor-strings.js +2 -2
- package/dist/ui/hub-directory-editor.js +1 -0
- package/dist/ui/hub-group-policy.js +4 -3
- package/dist/ui/hub-group-strings.js +2 -2
- package/dist/ui/hub-personal-agent-strings.js +160 -0
- package/dist/ui/hub-personal-agent.js +94 -0
- package/dist/ui/hub-role-audit.js +39 -0
- package/dist/ui/hub-role-forms.js +99 -0
- package/dist/ui/hub-role-notices.js +11 -0
- package/dist/ui/hub-role-view.js +86 -0
- package/dist/ui/hub-roles-strings.js +439 -0
- package/dist/ui/hub-roles.js +83 -0
- package/dist/ui/hub-room-composer.js +3 -2
- package/dist/ui/hub-room-list.js +4 -3
- package/dist/ui/hub-room-members.js +4 -2
- package/dist/ui/hub-room-settings.js +6 -0
- package/dist/ui/hub-room-source-strings.js +17 -0
- package/dist/ui/hub-room-source.js +34 -0
- package/dist/ui/hub-room-thread.js +10 -4
- package/dist/ui/hub-switcher.js +2 -2
- package/dist/ui/hub-this-hub.js +2 -2
- package/dist/ui/model-picker.js +4 -1
- package/dist/ui/panel-chat.js +4 -4
- package/dist/ui/panel-fleet.js +3 -3
- package/dist/ui/panel-hub.js +51 -31
- package/dist/ui/panel-settings.js +2 -3
- package/dist/ui/runtime-commands.d.ts +2 -2
- package/dist/ui/runtime-commands.js +7 -4
- package/dist/ui/settings-build-version.js +2 -2
- package/dist/ui/settings-catalog.js +22 -0
- package/dist/ui/settings-hub-setup.js +2 -1
- package/dist/ui/settings-strings.js +2 -0
- package/dist/ui/shared/access-overview.css +1 -1
- package/dist/ui/shared/accounts-keepalive.css +1 -1
- package/dist/ui/shared/accounts.css +1 -1
- package/dist/ui/shared/agent-sheet.js +2 -2
- package/dist/ui/shared/app-prefs.js +5 -2
- package/dist/ui/shared/app-shell.js +20 -8
- package/dist/ui/shared/app-stream.js +3 -1
- package/dist/ui/shared/app-swipe.js +3 -1
- package/dist/ui/shared/app.css +142 -48
- package/dist/ui/shared/app.js +1 -1
- package/dist/ui/shared/chat-thread.js +5 -1
- package/dist/ui/shared/chat-work-bar.css +5 -5
- package/dist/ui/shared/connector-prompt.d.ts +1 -0
- package/dist/ui/shared/connector-prompt.js +10 -0
- package/dist/ui/shared/hub-ai-apps.css +12 -0
- package/dist/ui/shared/hub-chat.css +9 -2
- package/dist/ui/shared/hub-groups.css +1 -1
- package/dist/ui/shared/hub-owner.css +5 -5
- package/dist/ui/shared/hub-roles.css +99 -0
- package/dist/ui/shared/hub-rooms-u2.css +14 -0
- package/dist/ui/shared/hub.css +13 -5
- package/dist/ui/shared/instance-nav.js +24 -9
- package/dist/ui/shared/loading.css +1 -1
- package/dist/ui/shared/model-picker.css +2 -2
- package/dist/ui/shared/preview-panel-actions.js +1 -1
- package/dist/ui/shared/preview-panel.js +2 -2
- package/dist/ui/shared/signin.js +27 -12
- package/dist/ui/shared/task-board.css +2 -2
- package/dist/ui/shared/tokens.css +1 -1
- package/dist/ui/shared/ui-toast.js +4 -4
- package/dist/ui/shared/usage-dialog.js +110 -16
- package/dist/ui/shared/view-strings.js +8 -0
- package/dist/ui/signin.html +4 -2
- package/dist/ui/structured-signin.js +64 -12
- package/dist/ui/web-terminal/terminal.css +1 -1
- package/dist/web-api.d.ts +4 -0
- package/dist/web-api.js +39 -23
- package/dist/web-api.js.map +1 -1
- package/dist/web-backend-login.d.ts +5 -1
- package/dist/web-backend-login.js +8 -2
- package/dist/web-backend-login.js.map +1 -1
- package/dist/web-prefs.js +2 -0
- package/dist/web-prefs.js.map +1 -1
- package/dist/windows-cli-worker.d.ts +10 -0
- package/dist/windows-cli-worker.js +109 -14
- package/dist/windows-cli-worker.js.map +1 -1
- package/dist/windows-cli.d.ts +10 -1
- package/dist/windows-cli.js +47 -13
- package/dist/windows-cli.js.map +1 -1
- package/package.json +1 -1
- package/templates/runtime-install/install.ps1 +24 -4
|
@@ -11,7 +11,7 @@ import { Dialog } from "./ui-dialog.js";
|
|
|
11
11
|
import { ErrorState, Skeleton } from "./ui-states.js";
|
|
12
12
|
import { Icon } from "./ui-icons.js";
|
|
13
13
|
import "./view-strings.js";
|
|
14
|
-
import { CompactMeter, resetClock, resetText, tn, usageClock, usageDuration, usageText } from "./usage-meter.js";
|
|
14
|
+
import { CompactMeter, level, resetClock, resetText, tn, usageClock, usageDuration, usageText, windowTag } from "./usage-meter.js";
|
|
15
15
|
// What this file exported before the meter moved out of it (#3321), for what imports it from here.
|
|
16
16
|
export { usageClock, windowTag, soonestReset } from "./usage-meter.js";
|
|
17
17
|
|
|
@@ -201,25 +201,67 @@ function rowNote(p) {
|
|
|
201
201
|
if (p.status === "no-credentials") return tn("usage.not_logged_in");
|
|
202
202
|
return "";
|
|
203
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* M-3248 (the user): a login no agent uses said 「此帳號目前沒有 Agent」 as a line of text beside its name. It is a quiet ⓘ
|
|
206
|
+
* there now (the muted text colour, never a warning's), its words on a hover, a focus or a tap, in the settings pages' tip
|
|
207
|
+
* bubble (.s-tipbody). The bubble is fixed to the window, so the group's rounded clip (.u-cgroup, overflow: hidden) never
|
|
208
|
+
* cuts it, and is only in the page while shown. In a compact row (itself a button that opens the login's card) the mark
|
|
209
|
+
* is not a second button: an image named by the words — the row reads "wii, No agents on this profile" — and a tap on it
|
|
210
|
+
* shows them without opening the row. In the full card it is a button, reached with Tab.
|
|
211
|
+
*/
|
|
212
|
+
function NoAgentsMark({ inRow = false }) {
|
|
213
|
+
const words = tn("usage.no_agents");
|
|
214
|
+
const [at, setAt] = useState(null);
|
|
215
|
+
const [pinned, setPinned] = useState(false);
|
|
216
|
+
const mark = useRef(null), bubble = useRef(null);
|
|
217
|
+
const show = () => {
|
|
218
|
+
const r = mark.current && mark.current.getBoundingClientRect ? mark.current.getBoundingClientRect() : null;
|
|
219
|
+
const w = window.innerWidth || 0, hgt = window.innerHeight || 0;
|
|
220
|
+
if (!r || !w) { setAt({ x: 8, y: 8, above: false }); return; }
|
|
221
|
+
const above = r.bottom + 72 > hgt;
|
|
222
|
+
// Pushed sideways to stay inside the window (a custom property: the page allows no style attribute).
|
|
223
|
+
setAt({ x: Math.round(Math.max(8, Math.min(r.left - 8, w - Math.min(260, w - 16) - 8))), y: Math.round(above ? hgt - r.top + 6 : r.bottom + 6), above });
|
|
224
|
+
};
|
|
225
|
+
const hide = () => { setAt(null); setPinned(false); };
|
|
226
|
+
useLayoutEffect(() => {
|
|
227
|
+
const b = bubble.current;
|
|
228
|
+
if (b && b.style && at) { b.style.setProperty("--tip-x", `${at.x}px`); b.style.setProperty("--tip-y", `${at.y}px`); }
|
|
229
|
+
}, [at]);
|
|
230
|
+
useEffect(() => {
|
|
231
|
+
if (!at) return undefined;
|
|
232
|
+
const esc = (e) => { if (e.key === "Escape") { e.stopPropagation(); hide(); } };
|
|
233
|
+
const away = (e) => { if (mark.current && !mark.current.contains(e.target)) hide(); };
|
|
234
|
+
document.addEventListener("keydown", esc, true); document.addEventListener("click", away); window.addEventListener("scroll", hide, true);
|
|
235
|
+
return () => { document.removeEventListener("keydown", esc, true); document.removeEventListener("click", away); window.removeEventListener("scroll", hide, true); };
|
|
236
|
+
}, [!!at]);
|
|
237
|
+
const tap = (e) => { e.stopPropagation(); e.preventDefault(); if (pinned) hide(); else { show(); setPinned(true); } };
|
|
238
|
+
const leave = () => { if (!pinned) hide(); };
|
|
239
|
+
const tip = at ? html`<span ref=${bubble} class=${`s-tipbody u-na-tip${at.above ? " above" : ""}`} aria-hidden="true">${words}</span>` : null;
|
|
240
|
+
return inRow
|
|
241
|
+
? html`<span ref=${mark} class="u-na" role="img" aria-label=${words} onMouseEnter=${show} onMouseLeave=${leave} onClick=${tap}><${Icon} name="info" size=${14} />${tip}</span>`
|
|
242
|
+
: html`<button ref=${mark} type="button" class="u-na" aria-label=${words} onMouseEnter=${show} onMouseLeave=${leave} onFocus=${show} onBlur=${hide} onClick=${tap}><${Icon} name="info" size=${14} />${tip}</button>`;
|
|
243
|
+
}
|
|
204
244
|
/**
|
|
205
245
|
* A login in three short lines, under its provider's name (the user's pick, 2026-10-22): its name and plan; then its
|
|
206
246
|
* short window and its long one, each a labelled full-width bar, the percent and that window's own reset.
|
|
207
247
|
* Numbers not current, a failed read or no login: one muted line in place of the bars, what is wrong as its tooltip.
|
|
208
248
|
* Pressed, it opens its full card.
|
|
209
249
|
*/
|
|
210
|
-
export function CompactRow({ p, onExpand }) {
|
|
250
|
+
export function CompactRow({ p, onExpand, one = false }) {
|
|
211
251
|
const title = providerTitle(p), failed = p.status === "error" || p.status === "no-credentials";
|
|
212
252
|
// Last known numbers (stale, e.g. an expired token) show as the others do (the user, 2026-10-23; the full card has since
|
|
213
253
|
// #2386), with a small "cached at 07:47" on the name line; a window that reset since is left out (compactSlots).
|
|
214
|
-
|
|
215
|
-
const
|
|
254
|
+
// M-3241: `one` — its group shows one line per login: the binding window (the most used) beside the name.
|
|
255
|
+
const binding = one && !failed ? bindingMetric(p) : null;
|
|
256
|
+
const pools = failed || one ? null : compactPools(p);
|
|
257
|
+
const metrics = failed ? [] : one ? (binding ? [binding] : []) : pools ? pools.flatMap((x) => x.metrics) : compactMetrics(p);
|
|
216
258
|
const note = rowNote(p), stale = p.stale ? staleNote(p) : null;
|
|
217
259
|
const say = stale ? stale.mark : note || tn("usage.no_data");
|
|
218
260
|
const detail = stale ? [stale.mark, stale.detail].filter(Boolean).join(" — ") : say;
|
|
219
261
|
const name = title.profile || title.base;
|
|
220
262
|
const models = !pools && metrics.some((m) => m.scope === "model");
|
|
221
|
-
return html`<button type="button" class=${`u-crow${p.stale ? " is-stale" : ""}${pools ? " is-pooled" : ""}${models ? " has-models" : ""}`} aria-expanded="false" title=${`${p.name} — ${tn("usageExpand")}`} onClick=${onExpand}>
|
|
222
|
-
<span class="u-crow-head"><span class="u-crow-name">${name}</span>${p.noAgents ? html
|
|
263
|
+
return html`<button type="button" class=${`u-crow${p.stale ? " is-stale" : ""}${pools ? " is-pooled" : ""}${models ? " has-models" : ""}${one ? " is-one" : ""}`} aria-expanded="false" title=${`${p.name} — ${tn("usageExpand")}`} onClick=${onExpand}>
|
|
264
|
+
<span class="u-crow-head"><span class="u-crow-name">${name}</span>${p.noAgents ? html`<${NoAgentsMark} inRow=${true} />` : null}
|
|
223
265
|
${p.plan ? html`<span class="pill u-plan" title=${p.plan}><span aria-hidden="true">${planBadge(p.plan)}</span><span class="sr-only">${p.plan}</span></span>` : null}
|
|
224
266
|
${stale && metrics.length ? html`<span class="u-crow-stale" title=${detail}>${p.cachedAt ? tn("usageCachedAt", { at: usageClock(p.cachedAt) }) : stale.mark}<span class="sr-only"> (${detail})</span></span>` : null}</span>
|
|
225
267
|
${pools ? pools.map((x) => html`<${CompactMeter} key=${x.pool.label} m=${x.worst} tag=${usageText(x.pool.label, x.pool.labelI18n)}
|
|
@@ -228,11 +270,63 @@ export function CompactRow({ p, onExpand }) {
|
|
|
228
270
|
: html`<span class=${`u-crow-note${(stale || (p.status === "error" && !p.transient)) ? " is-alert" : ""}`} title=${detail}>${say}</span>`}
|
|
229
271
|
</button>`;
|
|
230
272
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
273
|
+
// ── M-3241 (the user): a provider of two or more logins folds — −/+ on its header cycles every window of each login →
|
|
274
|
+
// one line per login (its binding window: the most used) → the header alone, with the highest percent. Warning colours
|
|
275
|
+
// stay in each. This browser's choice (localStorage), per provider; another tab's follows. ──
|
|
276
|
+
const GROUP_MODE_KEY = "agend_usage_group_modes";
|
|
277
|
+
const GROUP_MODES = ["expanded", "compact", "collapsed"];
|
|
278
|
+
function readGroupModes() {
|
|
279
|
+
try { const o = JSON.parse(stored(GROUP_MODE_KEY) || "{}"); return o && typeof o === "object" && !Array.isArray(o) ? Object.fromEntries(Object.entries(o).filter(([, v]) => GROUP_MODES.includes(v))) : {}; }
|
|
280
|
+
catch { return {}; }
|
|
281
|
+
}
|
|
282
|
+
export const usageGroupStore = createStore({ modes: readGroupModes() });
|
|
283
|
+
export const groupMode = (base) => usageGroupStore.get().modes[base] || "expanded";
|
|
284
|
+
export function setGroupMode(base, mode) {
|
|
285
|
+
const modes = { ...usageGroupStore.get().modes };
|
|
286
|
+
if (mode === "expanded") delete modes[base]; else modes[base] = mode;
|
|
287
|
+
usageGroupStore.set({ modes });
|
|
288
|
+
store(GROUP_MODE_KEY, JSON.stringify(modes));
|
|
289
|
+
}
|
|
290
|
+
if (typeof window !== "undefined" && typeof window.addEventListener === "function") {
|
|
291
|
+
window.addEventListener("storage", (e) => { if (!e || e.key === GROUP_MODE_KEY || e.key === null) usageGroupStore.set({ modes: readGroupModes() }); });
|
|
292
|
+
}
|
|
293
|
+
/** The window that binds a login: its most used percent window (any pool, any model), or null. */
|
|
294
|
+
export function bindingMetric(p) {
|
|
295
|
+
const pct = ((p && p.metrics) || []).filter((m) => m && m.type === "percent" && !m.resetPassed);
|
|
296
|
+
return pct.length ? pct.reduce((a, b) => ((b.used ?? 0) > (a.used ?? 0) ? b : a)) : null;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* A group's most used window, and whose: the collapsed header's number. A failed login has none. A stale login's cached
|
|
300
|
+
* number (#4054 review) counts only when no current login has one, and is then muted and marked cached, as its row is.
|
|
301
|
+
*/
|
|
302
|
+
function groupTop(group) {
|
|
303
|
+
let top = null, cached = null;
|
|
304
|
+
for (const { p } of group.items) {
|
|
305
|
+
const m = p.status === "error" || p.status === "no-credentials" ? null : bindingMetric(p);
|
|
306
|
+
if (!m) continue;
|
|
307
|
+
if (p.stale) { if (!cached || (m.used ?? 0) > (cached.m.used ?? 0)) cached = { m, p }; }
|
|
308
|
+
else if (!top || (m.used ?? 0) > (top.m.used ?? 0)) top = { m, p };
|
|
309
|
+
}
|
|
310
|
+
return top || cached;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* A provider's logins: its name once (×N), in small capitals, then each login (or the full card of one opened). Two or
|
|
314
|
+
* more (M-3241): −/+ on the right cycles `mode` — every window, one line each, the header alone with the highest percent.
|
|
315
|
+
*/
|
|
316
|
+
export function CompactGroup({ group, line, mode = "expanded", onCycle }) {
|
|
317
|
+
const many = group.items.length > 1 && typeof onCycle === "function";
|
|
318
|
+
const shown = many ? mode : "expanded";
|
|
319
|
+
const top = many && shown === "collapsed" ? groupTop(group) : null;
|
|
320
|
+
const pct = top ? Math.min(100, Math.max(0, top.m.used ?? 0)) : null;
|
|
321
|
+
const next = shown === "expanded" ? "usageGroupToOne" : shown === "compact" ? "usageGroupToHeader" : "usageGroupToAll";
|
|
322
|
+
const who = top ? `${providerTitle(top.p).profile || providerTitle(top.p).base} · ${top.m.scope === "model" ? modelTag(top.m) : windowTag(top.m)}` : "";
|
|
323
|
+
return html`<section class=${`u-cgroup${many ? ` is-${shown}` : ""}`} data-group=${group.base}>
|
|
324
|
+
<div class="u-cg-head"><span class="u-cg-name" title=${group.base}>${group.base}</span>${group.items.length > 1 ? html`<span class="u-cg-count">×${group.items.length}</span>` : null}
|
|
325
|
+
${many ? html`<span class="u-cg-tools">
|
|
326
|
+
${top ? html`<span class=${`u-cg-top u-cm-pct ${level(pct)}${top.p.stale ? " is-stale" : ""}`} title=${tn("usageGroupTop", { pct: pct.toFixed(0), who }) + (top.p.stale && top.p.cachedAt ? ` · ${tn("usageCachedAt", { at: usageClock(top.p.cachedAt) })}` : "")}>${pct.toFixed(0)}%<span class="sr-only"> (${who})</span></span>` : null}
|
|
327
|
+
<button type="button" class="icon-btn u-cg-toggle" aria-expanded=${shown === "collapsed" ? "false" : "true"} aria-label=${`${group.base}: ${tn(next)}`} title=${tn(next)}
|
|
328
|
+
onClick=${() => onCycle(GROUP_MODES[(GROUP_MODES.indexOf(shown) + 1) % GROUP_MODES.length])}><${Icon} name=${shown === "collapsed" ? "plus" : "minus"} size=${14} /></button></span>` : null}</div>
|
|
329
|
+
${shown === "collapsed" ? null : group.items.map(line)}
|
|
236
330
|
</section>`;
|
|
237
331
|
}
|
|
238
332
|
|
|
@@ -250,6 +344,7 @@ export function UsageBody({ owner }) {
|
|
|
250
344
|
const reads = useMemo(() => readStream(lease), [lease]);
|
|
251
345
|
// Compact (one line per login): a line pressed opens its full card here, until folded or the mode changes.
|
|
252
346
|
const { compact } = useStore(usageViewStore);
|
|
347
|
+
const { modes } = useStore(usageGroupStore); // M-3241
|
|
253
348
|
const [expanded, setExpanded] = useState(() => new Set());
|
|
254
349
|
useEffect(() => { setExpanded(new Set()); }, [compact]);
|
|
255
350
|
const toggleOne = (id) => setExpanded((was) => { const next = new Set(was); if (next.has(id)) next.delete(id); else next.add(id); return next; });
|
|
@@ -301,14 +396,13 @@ export function UsageBody({ owner }) {
|
|
|
301
396
|
else {
|
|
302
397
|
const providers = ordered(data.providers);
|
|
303
398
|
const card = (p, i) => html`<section key=${key(p)} class=${p.stale ? "u-provider is-stale" : "u-provider"}>
|
|
304
|
-
<div class="u-head"><strong title=${p.name}>${providerTitle(p).base}</strong>${p.plan ? html`<span class="pill u-plan" title=${p.plan}><span aria-hidden="true">${planBadge(p.plan)}</span><span class="sr-only">${p.plan}</span></span>` : null}
|
|
399
|
+
<div class="u-head"><strong title=${p.name}>${providerTitle(p).base}</strong>${p.noAgents && !providerTitle(p).profile ? html`<${NoAgentsMark} />` : null}${p.plan ? html`<span class="pill u-plan" title=${p.plan}><span aria-hidden="true">${planBadge(p.plan)}</span><span class="sr-only">${p.plan}</span></span>` : null}
|
|
305
400
|
<span class="u-order">${compact ? html`<button type="button" class="icon-btn u-collapse" aria-expanded="true" aria-label=${tn("usageCollapse")} title=${tn("usageCollapse")}
|
|
306
401
|
onClick=${() => toggleOne(key(p))}><${Icon} name="minus" size=${14} /></button>` : null}
|
|
307
402
|
<button type="button" class="icon-btn" disabled=${i === 0} aria-label=${tn("usageMoveUp")} title=${tn("usageMoveUp")} onClick=${() => move(key(p), -1, data.providers)}><${Icon} name="up" size=${14} /></button>
|
|
308
403
|
<button type="button" class="icon-btn" disabled=${i === providers.length - 1} aria-label=${tn("usageMoveDown")} title=${tn("usageMoveDown")} onClick=${() => move(key(p), 1, data.providers)}><${Icon} name="down" size=${14} /></button>
|
|
309
404
|
</span></div>
|
|
310
|
-
${providerTitle(p).profile ? html`<div class
|
|
311
|
-
${p.noAgents ? html`<p class="note">${tn("usage.no_agents")}</p>` : null}
|
|
405
|
+
${providerTitle(p).profile ? html`<div class=${`u-profile${p.noAgents ? " has-na" : ""}`} title=${p.name}>${p.noAgents ? html`<span class="u-profile-name">${providerTitle(p).profile}</span><${NoAgentsMark} />` : providerTitle(p).profile}</div>` : null}
|
|
312
406
|
${p.stale ? html`<p class="note u-stale" title=${staleNote(p).detail || null}>${staleNote(p).mark}</p>${staleNote(p).detail ? html`<p class="note u-stale-detail">${staleNote(p).detail}</p>` : null}` : null}
|
|
313
407
|
${p.status === "error" && !p.transient ? html`<p class="u-err">${usageText(p.error || tn("usage.error_fallback"), p.errorI18n)}</p>`
|
|
314
408
|
: p.status === "error" && p.transient ? html`<p class="note">${usageText(p.error || tn("usage.error_fallback"), p.errorI18n)}</p>`
|
|
@@ -317,8 +411,8 @@ export function UsageBody({ owner }) {
|
|
|
317
411
|
${!p.stale && p.hint ? html`<p class="note">${usageText(p.hint, p.hintI18n)}</p>` : !(p.metrics || []).length ? html`<p class="note">${tn("usage.no_data")}</p>` : null}`}
|
|
318
412
|
</section>`;
|
|
319
413
|
content = html`${!providers.length ? html`<p class="note">${tn("usage.empty_active")}</p>` : null}
|
|
320
|
-
${compact ? compactGroups(providers).map((g) => html`<${CompactGroup} key=${g.base} group=${g}
|
|
321
|
-
line=${({ p, i }) => (expanded.has(key(p)) ? card(p, i) : html`<${CompactRow} key=${key(p)} p=${p} onExpand=${() => toggleOne(key(p))} />`)} />`)
|
|
414
|
+
${compact ? compactGroups(providers).map((g) => html`<${CompactGroup} key=${g.base} group=${g} mode=${modes[g.base] || "expanded"} onCycle=${(m) => setGroupMode(g.base, m)}
|
|
415
|
+
line=${({ p, i }) => (expanded.has(key(p)) ? card(p, i) : html`<${CompactRow} key=${key(p)} p=${p} one=${(modes[g.base] || "expanded") === "compact" && g.items.length > 1} onExpand=${() => toggleOne(key(p))} />`)} />`)
|
|
322
416
|
: providers.map((p, i) => card(p, i))}
|
|
323
417
|
<div class="u-foot"><span class="note" title=${new Date(data.fetchedAt).toLocaleString()}>${failed ? html`${updatedAgo(data.fetchedAt)} · <span class="u-refresh-failed" role="status">${tn("usageRefreshFailed")}</span>` : data.refreshing ? html`<span class="u-refreshing">${tn("usageRefreshing")}</span>` : updatedAgo(data.fetchedAt)}</span>
|
|
324
418
|
${byAgent() ? html`<a class="btn btn-ghost btn-sm u-by-agent" href="/ui/fleet/usage" title=${tn("usageByAgentTitle")}>${tn("usageByAgent")}</a>` : null}
|
|
@@ -52,6 +52,10 @@ register("view", {
|
|
|
52
52
|
"usageMoveDown": "Move down",
|
|
53
53
|
"usageCompact": "Compact",
|
|
54
54
|
"usageCompactTitle": "One line per login",
|
|
55
|
+
"usageGroupToOne": "One line per account",
|
|
56
|
+
"usageGroupToHeader": "Show only the header",
|
|
57
|
+
"usageGroupToAll": "Show every window",
|
|
58
|
+
"usageGroupTop": "Highest: {pct}% ({who})",
|
|
55
59
|
"usageFull": "Full",
|
|
56
60
|
"usageFullTitle": "The full card for each login",
|
|
57
61
|
"usageExpand": "Show the full card",
|
|
@@ -333,6 +337,10 @@ register("view", {
|
|
|
333
337
|
"usageMoveDown": "下移",
|
|
334
338
|
"usageCompact": "精簡",
|
|
335
339
|
"usageCompactTitle": "每個登入一行",
|
|
340
|
+
"usageGroupToOne": "每個帳號一行",
|
|
341
|
+
"usageGroupToHeader": "只顯示標題",
|
|
342
|
+
"usageGroupToAll": "顯示所有用量",
|
|
343
|
+
"usageGroupTop": "最高:{pct}%({who})",
|
|
336
344
|
"usageFull": "完整",
|
|
337
345
|
"usageFullTitle": "每個登入顯示完整卡片",
|
|
338
346
|
"usageExpand": "顯示完整卡片",
|
package/dist/ui/signin.html
CHANGED
|
@@ -53,12 +53,14 @@
|
|
|
53
53
|
#reachHelp[open] summary::before { content: "▾"; }
|
|
54
54
|
#reachHelp ul { padding-left: var(--s-5); margin: var(--s-2) 0; }
|
|
55
55
|
#reachHelp li { margin: var(--s-2) 0; }
|
|
56
|
-
@media (max-width: 899px) { body { padding-top: var(--s-7); } }
|
|
56
|
+
@media (max-width: 899px), (pointer: coarse) and (max-height: 500px) and (max-width: 1023px) { body { padding-top: var(--s-7); } }
|
|
57
57
|
.hint code, .help code { white-space: nowrap; font-family: var(--font-mono); }
|
|
58
58
|
/* #1854: the operator's way in (no chat bot) — closed until asked for. */
|
|
59
59
|
.help { margin-top: 8px; font-size: var(--fs-xs); color: var(--text-3); }
|
|
60
60
|
.help summary { cursor: pointer; width: fit-content; }
|
|
61
61
|
.help p { margin: 6px 0 0; color: var(--text-3); }
|
|
62
|
+
.help ol { margin: 6px 0 0; padding-left: 1.4em; }
|
|
63
|
+
.help li + li { margin-top: 4px; }
|
|
62
64
|
[hidden] { display: none !important; }
|
|
63
65
|
</style>
|
|
64
66
|
</head>
|
|
@@ -80,7 +82,7 @@
|
|
|
80
82
|
<button id="another" type="button" class="secondary" hidden data-i18n="another">Sign in with another device</button>
|
|
81
83
|
<div id="msg" role="alert" aria-live="polite"></div>
|
|
82
84
|
<p id="authHint" hidden></p>
|
|
83
|
-
<details id="reachHelp" class="help" hidden><summary id="reachTitle">How
|
|
85
|
+
<details id="reachHelp" class="help" hidden><summary id="reachTitle">How do I open AgEnD on my phone?</summary><p id="reachLead"></p><ol><li id="reachTemp"></li><li id="reachFixed"></li><li id="reachPrivate"></li></ol></details>
|
|
84
86
|
<details class="help"><summary data-i18n="nobot">No chat bot?</summary><p data-i18n="nobot_body">Ask the operator to run <code>agend web --code</code> on the AgEnD computer.</p></details>
|
|
85
87
|
<details class="help"><summary data-i18n="safe">Page looks wrong after signing in?</summary><p data-i18n="safe_body">Your custom CSS may be hiding something. Add ?safe=1 to the end of the address to load the page without it, then fix it or turn it off in Settings → Web appearance.</p></details>
|
|
86
88
|
</form>
|
|
@@ -7,6 +7,9 @@ export const SIGNIN_STRINGS = {
|
|
|
7
7
|
check: "Check connections", skipped: "Connect later · remains in Needs you", valid: "Connected ✓", notInstalled: "Not installed on this host",
|
|
8
8
|
consoleOnly: "Use the explicit console fallback, or connect later.", needed: "Not connected", waiting: "Waiting for the CLI…", login: "Connecting: {0}",
|
|
9
9
|
openProvider: "Finish on the provider's official website", deviceCode: "Authorization code:", answerSent: "Answer sent. Waiting for the next screen; it will not be sent twice.",
|
|
10
|
+
// M-3238: the provider's page and its code as numbered steps.
|
|
11
|
+
stepOpen: "Open sign-in page", stepCode: "Enter this code on that page", stepBack: "Come back here when you're done. This page updates by itself.",
|
|
12
|
+
copy: "Copy", copyLink: "Copy link", copied: "Copied",
|
|
10
13
|
cancel: "Cancel connecting", signIn: "Connect account", signInAgain: "Reconnect", later: "Connect later", submit: "Submit {0}",
|
|
11
14
|
relogin: "Reconnect {0}? It disconnects its current account first.", reloginReplace: "Reconnect {0}? The new connection replaces the account it uses now.", ready: "You can continue setup.",
|
|
12
15
|
field_code: "Paste the authorization code", field_start_url: "Organization Start URL", field_region: "AWS region",
|
|
@@ -47,6 +50,8 @@ export const SIGNIN_STRINGS = {
|
|
|
47
50
|
check: "檢查連接狀態", skipped: "稍後連接 · 會留在「等你回應」", valid: "已連接 ✓", notInstalled: "這台主機上沒有安裝",
|
|
48
51
|
consoleOnly: "請改用主控台備援,或稍後連接。", needed: "尚未連接", waiting: "等待 CLI 回應…", login: "連接中:{0}",
|
|
49
52
|
openProvider: "前往官方網站完成授權", deviceCode: "授權碼:", answerSent: "已送出。等待下一個畫面;不會重複送出。",
|
|
53
|
+
stepOpen: "開啟登入頁面", stepCode: "在那個頁面輸入這組授權碼", stepBack: "完成後回到這裡,這個畫面會自動更新。",
|
|
54
|
+
copy: "複製", copyLink: "複製連結", copied: "已複製",
|
|
50
55
|
cancel: "取消連接", signIn: "連接帳號", signInAgain: "重新連接", later: "稍後連接", submit: "送出{0}",
|
|
51
56
|
relogin: "要重新連接 {0} 嗎?會先撤銷目前帳號的連接。", reloginReplace: "要重新連接 {0} 嗎?新的連接會取代目前使用的帳號。", ready: "可以繼續設定了。",
|
|
52
57
|
field_code: "貼上取得的授權碼", field_start_url: "組織的 Start URL", field_region: "AWS 區域",
|
|
@@ -82,10 +87,18 @@ export const SIGNIN_STRINGS = {
|
|
|
82
87
|
error_machine_transport_failed: "那台電腦沒有完成這次登入。請檢查它的 Runtime 視窗,再試一次。",
|
|
83
88
|
},
|
|
84
89
|
};
|
|
90
|
+
const SVG = "http://www.w3.org/2000/svg";
|
|
91
|
+
/** ui-icons.js's external and copy, as paths (this module cannot import the dashboard's icons on the setup page). */
|
|
92
|
+
const ICON_PATHS = {
|
|
93
|
+
external: ["M14 4h6v6M20 4l-9 9", "M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"],
|
|
94
|
+
copy: ["M11 9h9a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-9a2 2 0 0 1-2-2v-9a2 2 0 0 1 2-2z", "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"],
|
|
95
|
+
};
|
|
85
96
|
const NAMES = { "kiro-cli": "Kiro", "claude-code": "Claude Code", codex: "Codex", antigravity: "Antigravity" };
|
|
86
97
|
const CHOICES = { builder_id: "Builder ID", google: "Google", github: "GitHub", organization: null, subscription: null, console: "Anthropic Console" };
|
|
87
98
|
/** The page's language, as its <html lang> says (the setup page and the dashboard both keep it current). */
|
|
88
99
|
const pageLang = doc => /^zh/i.test(doc?.documentElement?.lang || "") ? "zh-TW" : "en";
|
|
100
|
+
/** M-3238: a sign-in page's address as a button names it — its host and path, no query (one line; long ones end in "…"). */
|
|
101
|
+
export const shortUrl = url => { const text = url.host + (url.pathname && url.pathname !== "/" ? url.pathname : ""); return text.length > 48 ? text.slice(0, 47) + "…" : text; };
|
|
89
102
|
|
|
90
103
|
/**
|
|
91
104
|
* `machine` (#3190 Part 3c): these cards are for ONE credential profile on a paired computer (the endpoint carries `?machine=&profile=`). The dialog around them says
|
|
@@ -105,7 +118,7 @@ const pageLang = doc => /^zh/i.test(doc?.documentElement?.lang || "") ? "zh-TW"
|
|
|
105
118
|
* `abandoned` (run id → void): the same id, when the cards were disposed (the dialog closed) while that request was still in flight: nobody is left to show or keep the run, so
|
|
106
119
|
* whoever mounted the cards ends it by this id. Nothing is drawn, and no other run is touched.
|
|
107
120
|
*/
|
|
108
|
-
export function mountStructuredSignIns(root, { endpoint, fetcher = fetch, changed = () => {}, lang, machine = false, ask, dashboard = false, dialog = false, focus, started = () => {}, abandoned = () => {}, codeHint = () => false } = {}) {
|
|
121
|
+
export function mountStructuredSignIns(root, { endpoint, fetcher = fetch, changed = () => {}, lang, machine = false, ask, dashboard = false, dialog = false, focus, started = () => {}, abandoned = () => {}, codeHint = () => false, footerCancel = false } = {}) {
|
|
109
122
|
const doc = root.ownerDocument;
|
|
110
123
|
let view = null, busy = false, disposed = false, timer = null, generation = 0, message = "", rendered = "";
|
|
111
124
|
const language = () => (lang ? lang() : pageLang(doc)) === "zh-TW" ? "zh-TW" : "en";
|
|
@@ -120,6 +133,22 @@ export function mountStructuredSignIns(root, { endpoint, fetcher = fetch, change
|
|
|
120
133
|
const choiceName = choice => CHOICES[choice] ?? tr("choice_" + choice);
|
|
121
134
|
const phaseName = phase => SIGNIN_STRINGS.en["phase_" + phase] ? tr("phase_" + phase) : phase.replaceAll("_", " ");
|
|
122
135
|
const button = (parent, label, action) => { const b = el("button", label, parent); b.type = "button"; b.disabled = busy; b.onclick = action; return b; };
|
|
136
|
+
// M-3238: the app's icons (ui-icons.js paths), drawn here as SVG: this module is served alone to the setup page too.
|
|
137
|
+
const icon = (parent, name, size = 14) => {
|
|
138
|
+
if (typeof doc.createElementNS !== "function") return null;
|
|
139
|
+
const svg = doc.createElementNS(SVG, "svg");
|
|
140
|
+
for (const [k, v] of [["class", "icon"], ["width", size], ["height", size], ["viewBox", "0 0 24 24"], ["fill", "none"], ["stroke", "currentColor"], ["stroke-width", 2],
|
|
141
|
+
["stroke-linecap", "round"], ["stroke-linejoin", "round"], ["aria-hidden", "true"], ["focusable", "false"]]) svg.setAttribute(k, String(v));
|
|
142
|
+
for (const d of ICON_PATHS[name] || []) { const path = doc.createElementNS(SVG, "path"); path.setAttribute("d", d); svg.append(path); }
|
|
143
|
+
parent.append(svg); return svg;
|
|
144
|
+
};
|
|
145
|
+
// Copy a link or a code (for another device, or to paste): says Copied for a moment. Never disabled: it changes nothing.
|
|
146
|
+
const copyButton = (parent, value, label, cls) => {
|
|
147
|
+
const b = el("button", null, parent); b.type = "button"; b.className = `${cls} signin-copy`;
|
|
148
|
+
icon(b, "copy"); const text = el("span", label, b);
|
|
149
|
+
b.onclick = async () => { try { await globalThis.navigator?.clipboard?.writeText(value); text.textContent = tr("copied"); setTimeout(() => { text.textContent = label; }, 1500); } catch { /* the value stays selectable on the page */ } };
|
|
150
|
+
return b;
|
|
151
|
+
};
|
|
123
152
|
const request = async data => {
|
|
124
153
|
const response = await fetcher(endpoint, { method: data ? "POST" : "GET", cache: "no-store", headers: { "Content-Type": "application/json" }, ...(data ? { body: JSON.stringify(data) } : {}) });
|
|
125
154
|
const body = await response.json().catch(() => null);
|
|
@@ -151,25 +180,46 @@ export function mountStructuredSignIns(root, { endpoint, fetcher = fetch, change
|
|
|
151
180
|
if (!view) { if (!dialog || message) button(root, tr("check"), () => perform({ operation: "refresh" })); return; }
|
|
152
181
|
for (const backend of dialog && focus ? view.selected.filter(b => b === focus) : view.selected) {
|
|
153
182
|
const card = el("section"); card.dataset.backend = backend;
|
|
154
|
-
|
|
183
|
+
// M-3238 (Argon): the account dialog for ONE account names the CLI in its title — no second heading here.
|
|
184
|
+
const single = dialog && !!focus;
|
|
185
|
+
if (!single) el("h3", name(backend), card);
|
|
155
186
|
const state = view.states[backend], pending = view.pending.includes(backend), skipped = view.skipped.includes(backend);
|
|
156
|
-
// "Console only" is the first-run list's word for a CLI it does not sign in; Settings → Accounts (`dialog`, or a computer's own sign-in) does, so there it is a sign-in that is needed.
|
|
157
|
-
el("p", tr(skipped ? "skipped" : state === "valid" ? "valid" : state === "not_installed" ? "notInstalled" : state === "console_only" && !(dialog || machine) ? "consoleOnly" : "needed"), card);
|
|
158
187
|
const login = view.login?.backend === backend ? view.login : null;
|
|
159
188
|
const active = login && login.phase !== "done" && !(login.phase === "failed" && login.reason);
|
|
189
|
+
let url = null;
|
|
190
|
+
if (active && login.url) { try { const u = new URL(login.url); if (u.protocol === "https:" && !u.username && !u.password) url = u; } catch {} }
|
|
191
|
+
const stepped = active && (url || login.code);
|
|
192
|
+
// "Console only" is the first-run list's word for a CLI it does not sign in; Settings → Accounts (`dialog`, or a computer's own sign-in) does, so there it is a sign-in that is needed.
|
|
193
|
+
// While the steps show, the one-account dialog does not repeat "Not connected" above them.
|
|
194
|
+
if (!(single && active)) el("p", tr(skipped ? "skipped" : state === "valid" ? "valid" : state === "not_installed" ? "notInstalled" : state === "console_only" && !(dialog || machine) ? "consoleOnly" : "needed"), card);
|
|
160
195
|
if (active) {
|
|
161
|
-
el("p", login.phase === "waiting" || login.phase === "starting" ? tr("waiting") : tr("login", phaseName(login.phase)), card);
|
|
196
|
+
if (!(single && stepped)) el("p", login.phase === "waiting" || login.phase === "starting" ? tr("waiting") : tr("login", phaseName(login.phase)), card);
|
|
162
197
|
if (login.phase === "method" && login.canAct) for (const choice of login.choices || []) {
|
|
163
198
|
if (Object.hasOwn(CHOICES, choice)) button(card, choiceName(choice), () => perform({ operation: "input", id: login.id, revision: login.revision, action: { kind: "method", choice } }));
|
|
164
199
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
200
|
+
// M-3238 (the user; Argon's review): the provider's page and its code as numbered steps (the step circles) — a short
|
|
201
|
+
// primary 「開啟登入頁面」 beside Copy link, the page's address a quiet note under them; the code with Copy in one box;
|
|
202
|
+
// "come back here" a quiet status line, not a step. The host already allowlists these URLs; still never turn a
|
|
203
|
+
// non-HTTPS one into a link.
|
|
204
|
+
if (stepped) {
|
|
205
|
+
const steps = el("ol", null, card); steps.className = "signin-steps";
|
|
206
|
+
const step = title => { const li = el("li", null, steps), body = el("div", null, li); body.className = "signin-step-body"; el("span", title, body).className = "signin-step-title"; return body; };
|
|
207
|
+
if (url) {
|
|
208
|
+
const body = step(tr("openProvider")), row = el("div", null, body); row.className = "signin-linkrow";
|
|
209
|
+
const link = el("a", null, row); link.className = "btn btn-primary signin-open"; link.href = url.href; link.target = "_blank"; link.rel = "noopener noreferrer";
|
|
210
|
+
el("span", tr("stepOpen"), link); icon(link, "external");
|
|
211
|
+
copyButton(row, url.href, tr("copyLink"), "btn");
|
|
212
|
+
el("span", shortUrl(url), body).className = "note mono signin-url";
|
|
213
|
+
}
|
|
214
|
+
if (login.code) {
|
|
215
|
+
const body = step(tr("stepCode")), box = el("div", null, body); box.className = "signin-code-box";
|
|
216
|
+
const code = el("code", login.code, box); code.className = "signin-code"; code.setAttribute("aria-label", tr("deviceCode") + " " + login.code);
|
|
217
|
+
copyButton(box, login.code, tr("copy"), "btn btn-sm");
|
|
218
|
+
}
|
|
219
|
+
if (url && !(login.canAct && ["code", "start_url", "region"].includes(login.phase))) {
|
|
220
|
+
const back = el("p", tr("stepBack"), card); back.className = "s-info signin-back"; back.setAttribute("role", "status");
|
|
170
221
|
}
|
|
171
222
|
}
|
|
172
|
-
if (login.code) { el("p", tr("deviceCode"), card); el("code", login.code, card); }
|
|
173
223
|
if (login.canAct && ["code", "start_url", "region"].includes(login.phase)) {
|
|
174
224
|
const label = el("label", tr("field_" + login.phase), card);
|
|
175
225
|
const input = el("input", null, label); input.type = login.phase === "code" ? "password" : "text"; input.autocomplete = "off"; input.spellcheck = false;
|
|
@@ -178,7 +228,7 @@ export function mountStructuredSignIns(root, { endpoint, fetcher = fetch, change
|
|
|
178
228
|
button(card, tr("submit", phaseName(login.phase)), () => { const value = input.value; input.value = ""; void perform({ operation: "input", id: login.id, revision: login.revision, action: { kind: login.phase, value } }); });
|
|
179
229
|
}
|
|
180
230
|
if (["method", "code", "start_url", "region"].includes(login.phase) && !login.canAct) el("p", tr("answerSent"), card);
|
|
181
|
-
button(card, tr("cancel"), () => perform({ operation: "cancel" }));
|
|
231
|
+
if (!(footerCancel && single)) button(card, tr("cancel"), () => perform({ operation: "cancel" })); // the one-account dialog has it in its footer
|
|
182
232
|
} else {
|
|
183
233
|
if (login?.reason && login.reason !== "cancelled") el("p", errorText(login.reason), card);
|
|
184
234
|
// A CLI the first-run list only names the console command for (`view.console`, from the registry's `host.firstRunSignIn`) has no button there; in Settings → Accounts (a dialog, or a
|
|
@@ -217,6 +267,8 @@ export function mountStructuredSignIns(root, { endpoint, fetcher = fetch, change
|
|
|
217
267
|
addBackend(backend) { if (view && NAMES[backend] && !view.selected.includes(backend)) return perform({ operation: "select", backends: [...view.selected, backend] }); },
|
|
218
268
|
/** Draw it again in the page's language now (it also follows on its next poll). */
|
|
219
269
|
relabel() { render(); },
|
|
270
|
+
/** M-3238: the dialog's own "Cancel connecting" (its footer), for the sign-in these cards show. */
|
|
271
|
+
cancel() { return perform({ operation: "cancel" }); },
|
|
220
272
|
dispose() { disposed = true; generation++; clearTimeout(timer); root.replaceChildren(); },
|
|
221
273
|
};
|
|
222
274
|
}
|
|
@@ -20,4 +20,4 @@ body { display: flex; flex-direction: column; }
|
|
|
20
20
|
#keys button { background: #222; color: #ddd; border: 1px solid #444; border-radius: 4px; padding: 6px 10px; font: 14px ui-monospace, monospace, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", emoji; cursor: pointer; }
|
|
21
21
|
#done { padding: 10px; background: #1c1c1c; border-top: 1px solid #333; }
|
|
22
22
|
#done.ok { color: #8d8; } #done.bad { color: #f88; }
|
|
23
|
-
@media (min-width: 900px) { #keys { display: none; } }
|
|
23
|
+
@media (min-width: 900px) and (pointer: fine), (min-width: 900px) and (pointer: none), (min-width: 900px) and (min-height: 501px), (min-width: 1024px) { #keys { display: none; } }
|
package/dist/web-api.d.ts
CHANGED
|
@@ -85,6 +85,10 @@ export interface WebApiContext {
|
|
|
85
85
|
label: string;
|
|
86
86
|
description?: string;
|
|
87
87
|
}>>;
|
|
88
|
+
/** Discover an empty (or refresh a stale) model list once, bounded, before GET /ui/models answers; never throws. */
|
|
89
|
+
ensureModelCatalog?(backend: string, instance: string | null, selection?: {
|
|
90
|
+
profile?: string;
|
|
91
|
+
}): Promise<void>;
|
|
88
92
|
refreshModelCatalogFor?(backend: string, instance: string | null, selection?: {
|
|
89
93
|
profile?: string;
|
|
90
94
|
}): Promise<{
|
package/dist/web-api.js
CHANGED
|
@@ -377,6 +377,35 @@ function webCatalog(ctx, backend, instance, profile, plain) {
|
|
|
377
377
|
const flat = plain ?? (profile !== null ? ctx.modelCatalogFor?.(backend, instance, { profile }) : ctx.modelCatalogFor?.(backend, instance)) ?? [];
|
|
378
378
|
return shapeWebModelCatalog(backend, flat);
|
|
379
379
|
}
|
|
380
|
+
/** GET /ui/models' answer: the cached catalog of this instance/account, else the CLI's own cache, else (claude) the documented ids. */
|
|
381
|
+
function answerModelCatalog(res, ctx, backend, instance, profile, canAnswer) {
|
|
382
|
+
const models = webCatalog(ctx, backend, instance, profile);
|
|
383
|
+
// claude with no account list — with or without a credential profile — is answered with the documentation's ids.
|
|
384
|
+
const answerCatalog = () => {
|
|
385
|
+
if (backend === "claude-code" && !models.length)
|
|
386
|
+
json(res, 200, { backend, models: documentedClaudeCatalog(ctx), source: "official-catalog" });
|
|
387
|
+
else
|
|
388
|
+
json(res, 200, { backend, models });
|
|
389
|
+
};
|
|
390
|
+
// The existing catalog belongs to this instance/account and always wins.
|
|
391
|
+
if (models.length || !ctx.cliModelCatalogFor || profile !== null) {
|
|
392
|
+
answerCatalog();
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
void (async () => {
|
|
396
|
+
const cliModels = await ctx.cliModelCatalogFor?.(backend, instance) ?? [];
|
|
397
|
+
if (!canAnswer())
|
|
398
|
+
return;
|
|
399
|
+
const shaped = shapeWebModelCatalog(backend, cliModels);
|
|
400
|
+
if (shaped.length)
|
|
401
|
+
json(res, 200, { backend, models: shaped, source: "cli-cache" });
|
|
402
|
+
else
|
|
403
|
+
answerCatalog();
|
|
404
|
+
})().catch(() => {
|
|
405
|
+
if (canAnswer())
|
|
406
|
+
json(res, 503, { error: "CLI model cache unavailable" });
|
|
407
|
+
});
|
|
408
|
+
}
|
|
380
409
|
/** claude's fallback when no account list is readable: the documentation's `claude-*` ids for the host's CLI version, unverified. */
|
|
381
410
|
function documentedClaudeCatalog(ctx) {
|
|
382
411
|
const version = ctx.backendAvailabilityRows?.().find(row => row.backend === "claude-code")?.version;
|
|
@@ -2858,33 +2887,20 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
2858
2887
|
}
|
|
2859
2888
|
if (handleNativeModelCatalog(req, res, url, ctx))
|
|
2860
2889
|
return true;
|
|
2861
|
-
const
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
json(res, 200, { backend, models });
|
|
2868
|
-
};
|
|
2869
|
-
// The existing catalog belongs to this instance/account and always wins.
|
|
2870
|
-
if (models.length || !ctx.cliModelCatalogFor || profile !== null) {
|
|
2871
|
-
answerCatalog();
|
|
2890
|
+
const canAnswer = () => !res.headersSent && !res.destroyed && !res.writableEnded && stillAuthorized(req, res, url, ctx);
|
|
2891
|
+
const answer = () => answerModelCatalog(res, ctx, backend, instance, profile, canAnswer);
|
|
2892
|
+
// An empty (or stale) list is discovered once, bounded, before the answer — the page shows its loading state
|
|
2893
|
+
// meanwhile — rather than answered as "no models" until someone presses Refresh. A cached fresh list is answered at once.
|
|
2894
|
+
if (!ctx.ensureModelCatalog) {
|
|
2895
|
+
answer();
|
|
2872
2896
|
return true;
|
|
2873
2897
|
}
|
|
2874
|
-
const canAnswer = () => !res.headersSent && !res.destroyed && !res.writableEnded && stillAuthorized(req, res, url, ctx);
|
|
2875
2898
|
void (async () => {
|
|
2876
|
-
|
|
2877
|
-
if (!canAnswer())
|
|
2878
|
-
return;
|
|
2879
|
-
const shaped = shapeWebModelCatalog(backend, cliModels);
|
|
2880
|
-
if (shaped.length)
|
|
2881
|
-
json(res, 200, { backend, models: shaped, source: "cli-cache" });
|
|
2882
|
-
else
|
|
2883
|
-
answerCatalog();
|
|
2884
|
-
})().catch(() => {
|
|
2899
|
+
await ctx.ensureModelCatalog?.(backend, instance, profile !== null ? { profile } : undefined);
|
|
2885
2900
|
if (canAnswer())
|
|
2886
|
-
|
|
2887
|
-
})
|
|
2901
|
+
answer();
|
|
2902
|
+
})().catch(() => { if (canAnswer())
|
|
2903
|
+
json(res, 503, { error: "model catalog unavailable" }); });
|
|
2888
2904
|
return true;
|
|
2889
2905
|
}
|
|
2890
2906
|
// The effort levels Settings → Runtime & model's dropdown offers for an agent and a (not yet saved) model — the chat chip's list.
|