@songsid/agend 2.4.0-alpha.2 → 2.4.0-alpha.3
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/account-isolation.d.ts +6 -0
- package/dist/account-isolation.js +40 -0
- package/dist/account-isolation.js.map +1 -0
- package/dist/accounts-signout.d.ts +15 -2
- package/dist/accounts-signout.js +52 -4
- package/dist/accounts-signout.js.map +1 -1
- package/dist/accounts-view.d.ts +114 -27
- package/dist/accounts-view.js +123 -60
- package/dist/accounts-view.js.map +1 -1
- package/dist/agent-cli-instructions.md +9 -7
- package/dist/agent-cli.js +47 -20
- package/dist/agent-cli.js.map +1 -1
- package/dist/agent-endpoint.js +23 -8
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/agent-list-output.d.ts +23 -0
- package/dist/agent-list-output.js +53 -0
- package/dist/agent-list-output.js.map +1 -0
- package/dist/agent-runtime-change.js +4 -4
- package/dist/agent-runtime-change.js.map +1 -1
- package/dist/agent-whats-new.js +2 -0
- package/dist/agent-whats-new.js.map +1 -1
- package/dist/antigravity-first-run.d.ts +4 -0
- package/dist/antigravity-first-run.js +57 -0
- package/dist/antigravity-first-run.js.map +1 -0
- package/dist/antigravity-identity.d.ts +6 -0
- package/dist/antigravity-identity.js +27 -0
- package/dist/antigravity-identity.js.map +1 -0
- package/dist/antigravity-store.d.ts +22 -0
- package/dist/antigravity-store.js +79 -0
- package/dist/antigravity-store.js.map +1 -0
- package/dist/auth-api.js +4 -0
- package/dist/auth-api.js.map +1 -1
- package/dist/backend/agy-onboarding.d.ts +14 -0
- package/dist/backend/agy-onboarding.js +114 -0
- package/dist/backend/agy-onboarding.js.map +1 -0
- package/dist/backend/antigravity.d.ts +15 -0
- package/dist/backend/antigravity.js +44 -4
- package/dist/backend/antigravity.js.map +1 -1
- package/dist/backend/credential-profile.d.ts +22 -3
- package/dist/backend/credential-profile.js +61 -9
- package/dist/backend/credential-profile.js.map +1 -1
- package/dist/backend-availability.d.ts +6 -0
- package/dist/backend-availability.js +11 -0
- package/dist/backend-availability.js.map +1 -1
- package/dist/browser-backend-signins.d.ts +9 -1
- package/dist/browser-backend-signins.js +9 -5
- package/dist/browser-backend-signins.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/channel/mcp-tools.js +9 -9
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/claude-auth-status.d.ts +1 -0
- package/dist/claude-auth-status.js +25 -0
- package/dist/claude-auth-status.js.map +1 -1
- package/dist/cli-capability.d.ts +104 -19
- package/dist/cli-capability.js +3 -1
- package/dist/cli-capability.js.map +1 -1
- package/dist/cli-caps-module.d.ts +14 -0
- package/dist/cli-caps-module.js +8 -1
- package/dist/cli-caps-module.js.map +1 -1
- package/dist/cli-registry-check.js +114 -18
- package/dist/cli-registry-check.js.map +1 -1
- package/dist/cli-registry.d.ts +116 -12
- package/dist/cli-registry.js +16 -1
- package/dist/cli-registry.js.map +1 -1
- package/dist/cli-spec-antigravity.d.ts +53 -11
- package/dist/cli-spec-antigravity.js +44 -13
- package/dist/cli-spec-antigravity.js.map +1 -1
- package/dist/cli-spec-claude-code.d.ts +14 -1
- package/dist/cli-spec-claude-code.js +5 -4
- package/dist/cli-spec-claude-code.js.map +1 -1
- package/dist/cli-spec-codex.d.ts +8 -0
- package/dist/cli-spec-codex.js +4 -3
- package/dist/cli-spec-codex.js.map +1 -1
- package/dist/cli-spec-grok.d.ts +4 -0
- package/dist/cli-spec-grok.js +2 -1
- package/dist/cli-spec-grok.js.map +1 -1
- package/dist/cli-spec-kiro-cli.d.ts +7 -0
- package/dist/cli-spec-kiro-cli.js +3 -2
- package/dist/cli-spec-kiro-cli.js.map +1 -1
- package/dist/cli-spec-muse.d.ts +4 -0
- package/dist/cli-spec-muse.js +2 -1
- package/dist/cli-spec-muse.js.map +1 -1
- package/dist/cli-spec-opencode.d.ts +1 -0
- package/dist/cli-spec-opencode.js +1 -0
- package/dist/cli-spec-opencode.js.map +1 -1
- package/dist/credential-store-proof.d.ts +6 -0
- package/dist/credential-store-proof.js +30 -0
- package/dist/credential-store-proof.js.map +1 -0
- package/dist/daemon.js +2 -2
- package/dist/daemon.js.map +1 -1
- package/dist/decision-list.d.ts +5 -4
- package/dist/decision-list.js +22 -8
- package/dist/decision-list.js.map +1 -1
- package/dist/fleet-manager.d.ts +20 -1
- package/dist/fleet-manager.js +158 -54
- package/dist/fleet-manager.js.map +1 -1
- package/dist/fleet-windows-runtime.js +6 -6
- package/dist/fleet-windows-runtime.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +32 -4
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +23 -6
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +14 -6
- package/dist/general-knowledge/skills/fleet-health/SKILL.md +16 -0
- package/dist/general-knowledge/skills/hub/SKILL.md +361 -0
- package/dist/general-knowledge/skills/scheduling/SKILL.md +1 -1
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +184 -36
- package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +5 -1
- package/dist/general-role.d.ts +1 -1
- package/dist/general-role.js +1 -0
- package/dist/general-role.js.map +1 -1
- package/dist/hub/buttons.d.ts +3 -0
- package/dist/hub/buttons.js +11 -11
- package/dist/hub/buttons.js.map +1 -1
- package/dist/hub/catalog.d.ts +13 -6
- package/dist/hub/catalog.js +106 -33
- package/dist/hub/catalog.js.map +1 -1
- package/dist/hub/client.d.ts +6 -0
- package/dist/hub/client.js +4 -1
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.js +15 -0
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.d.ts +6 -0
- package/dist/hub/compose/server.js +9 -3
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/directory/directory.d.ts +1 -1
- package/dist/hub/directory/directory.js +51 -0
- package/dist/hub/directory/directory.js.map +1 -1
- package/dist/hub/directory/types.d.ts +14 -0
- package/dist/hub/directory/types.js.map +1 -1
- package/dist/hub/enrolment-code.d.ts +1 -1
- package/dist/hub/enrolment-code.js +4 -4
- package/dist/hub/enrolment-code.js.map +1 -1
- package/dist/hub/grant-access.d.ts +11 -0
- package/dist/hub/grant-access.js +113 -0
- package/dist/hub/grant-access.js.map +1 -0
- package/dist/hub/grant-search.d.ts +9 -0
- package/dist/hub/grant-search.js +92 -0
- package/dist/hub/grant-search.js.map +1 -0
- package/dist/hub/group-policy/admin-impact.d.ts +2 -0
- package/dist/hub/group-policy/admin-impact.js +10 -2
- package/dist/hub/group-policy/admin-impact.js.map +1 -1
- package/dist/hub/group-policy/admin-inventory.js +1 -1
- package/dist/hub/group-policy/admin-inventory.js.map +1 -1
- package/dist/hub/group-policy/authorization.d.ts +5 -2
- package/dist/hub/group-policy/authorization.js +73 -32
- package/dist/hub/group-policy/authorization.js.map +1 -1
- package/dist/hub/group-policy/impact-inventory.js +20 -4
- package/dist/hub/group-policy/impact-inventory.js.map +1 -1
- package/dist/hub/group-policy/resources.d.ts +4 -5
- package/dist/hub/group-policy/resources.js +26 -19
- package/dist/hub/group-policy/resources.js.map +1 -1
- package/dist/hub/group-policy/store.d.ts +18 -3
- package/dist/hub/group-policy/store.js +94 -80
- package/dist/hub/group-policy/store.js.map +1 -1
- package/dist/hub/group-policy/welcome.js.map +1 -1
- package/dist/hub/http/compose.js +39 -11
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/core.d.ts +18 -0
- package/dist/hub/http/core.js +108 -7
- package/dist/hub/http/core.js.map +1 -1
- package/dist/hub/http/deps.d.ts +8 -0
- package/dist/hub/http/schema.js +11 -0
- package/dist/hub/http/schema.js.map +1 -1
- package/dist/hub/join/local.d.ts +5 -0
- package/dist/hub/join/local.js +28 -5
- package/dist/hub/join/local.js.map +1 -1
- package/dist/hub/join/service.d.ts +2 -0
- package/dist/hub/join/service.js +34 -35
- package/dist/hub/join/service.js.map +1 -1
- package/dist/hub/member/pairing-api.js +4 -1
- package/dist/hub/member/pairing-api.js.map +1 -1
- package/dist/hub/pairing.d.ts +3 -0
- package/dist/hub/pairing.js +37 -16
- package/dist/hub/pairing.js.map +1 -1
- package/dist/hub/policy.d.ts +1 -1
- package/dist/hub/policy.js +19 -6
- package/dist/hub/policy.js.map +1 -1
- package/dist/hub/protocol.d.ts +13 -0
- package/dist/hub/protocol.js +7 -2
- package/dist/hub/protocol.js.map +1 -1
- package/dist/hub/quota.d.ts +2 -1
- package/dist/hub/quota.js +2 -2
- package/dist/hub/quota.js.map +1 -1
- package/dist/hub/roles/authority.d.ts +45 -0
- package/dist/hub/roles/authority.js +199 -0
- package/dist/hub/roles/authority.js.map +1 -0
- package/dist/hub/roles/change.d.ts +18 -0
- package/dist/hub/roles/change.js +76 -0
- package/dist/hub/roles/change.js.map +1 -0
- package/dist/hub/roles/convert.d.ts +11 -0
- package/dist/hub/roles/convert.js +27 -0
- package/dist/hub/roles/convert.js.map +1 -0
- package/dist/hub/roles/cutover-inventory.d.ts +14 -0
- package/dist/hub/roles/cutover-inventory.js +42 -0
- package/dist/hub/roles/cutover-inventory.js.map +1 -0
- package/dist/hub/roles/cutover.d.ts +32 -0
- package/dist/hub/roles/cutover.js +184 -0
- package/dist/hub/roles/cutover.js.map +1 -0
- package/dist/hub/roles/delegation.d.ts +24 -0
- package/dist/hub/roles/delegation.js +111 -0
- package/dist/hub/roles/delegation.js.map +1 -0
- package/dist/hub/roles/evaluate.d.ts +50 -0
- package/dist/hub/roles/evaluate.js +96 -0
- package/dist/hub/roles/evaluate.js.map +1 -0
- package/dist/hub/roles/expiry.d.ts +46 -0
- package/dist/hub/roles/expiry.js +180 -0
- package/dist/hub/roles/expiry.js.map +1 -0
- package/dist/hub/roles/mode-effects.d.ts +5 -0
- package/dist/hub/roles/mode-effects.js +21 -0
- package/dist/hub/roles/mode-effects.js.map +1 -0
- package/dist/hub/roles/model.d.ts +171 -0
- package/dist/hub/roles/model.js +79 -0
- package/dist/hub/roles/model.js.map +1 -0
- package/dist/hub/roles/read.d.ts +29 -0
- package/dist/hub/roles/read.js +47 -0
- package/dist/hub/roles/read.js.map +1 -0
- package/dist/hub/roles/writer.d.ts +80 -0
- package/dist/hub/roles/writer.js +427 -0
- package/dist/hub/roles/writer.js.map +1 -0
- package/dist/hub/rooms.d.ts +8 -0
- package/dist/hub/rooms.js +47 -27
- package/dist/hub/rooms.js.map +1 -1
- package/dist/hub/server.d.ts +3 -0
- package/dist/hub/server.js +3 -1
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/sessions.js +5 -1
- package/dist/hub/sessions.js.map +1 -1
- package/dist/hub/settings-directory-decision.d.ts +2 -2
- package/dist/hub/settings-directory-decision.js +7 -5
- package/dist/hub/settings-directory-decision.js.map +1 -1
- package/dist/hub/settings-directory-proof.js +3 -1
- package/dist/hub/settings-directory-proof.js.map +1 -1
- package/dist/hub/settings-directory-recovery.js +3 -3
- package/dist/hub/settings-directory-recovery.js.map +1 -1
- package/dist/hub/sharing.d.ts +10 -0
- package/dist/hub/sharing.js +74 -0
- package/dist/hub/sharing.js.map +1 -0
- package/dist/hub/store.js +6 -2
- package/dist/hub/store.js.map +1 -1
- package/dist/hub/types.d.ts +17 -1
- package/dist/hub/web-origin.d.ts +80 -0
- package/dist/hub/web-origin.js +163 -0
- package/dist/hub/web-origin.js.map +1 -0
- package/dist/human-delivery-receipts.js +2 -2
- package/dist/human-delivery-receipts.js.map +1 -1
- package/dist/instance-lifecycle.d.ts +13 -1
- package/dist/instance-lifecycle.js +32 -10
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/instructions.d.ts +8 -2
- package/dist/instructions.js +28 -6
- package/dist/instructions.js.map +1 -1
- package/dist/locale.js +6 -6
- package/dist/locale.js.map +1 -1
- package/dist/login-flows.d.ts +24 -2
- package/dist/login-flows.js +53 -22
- package/dist/login-flows.js.map +1 -1
- package/dist/login-url.js +3 -0
- package/dist/login-url.js.map +1 -1
- package/dist/machine-accounts.d.ts +42 -12
- package/dist/machine-accounts.js +144 -46
- package/dist/machine-accounts.js.map +1 -1
- package/dist/machine-signins.d.ts +35 -13
- package/dist/machine-signins.js +57 -27
- package/dist/machine-signins.js.map +1 -1
- package/dist/native-instance-input.js +4 -4
- package/dist/native-instance-input.js.map +1 -1
- package/dist/native-instance-registry.d.ts +3 -3
- package/dist/native-instance-registry.js +11 -10
- package/dist/native-instance-registry.js.map +1 -1
- package/dist/outbound-handlers.js +19 -19
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +18 -0
- package/dist/outbound-schemas.js +22 -4
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/profile-signins.d.ts +5 -0
- package/dist/profile-signins.js +1 -0
- package/dist/profile-signins.js.map +1 -1
- package/dist/runtime-build-info.js +6 -2
- package/dist/runtime-build-info.js.map +1 -1
- package/dist/runtime-cli.js +33 -11
- package/dist/runtime-cli.js.map +1 -1
- package/dist/runtime-client.d.ts +18 -2
- package/dist/runtime-client.js +84 -21
- package/dist/runtime-client.js.map +1 -1
- package/dist/runtime-credential-profiles.d.ts +36 -4
- package/dist/runtime-credential-profiles.js +82 -16
- package/dist/runtime-credential-profiles.js.map +1 -1
- package/dist/runtime-profile-ownership.d.ts +2 -2
- package/dist/runtime-profile-ownership.js +3 -3
- package/dist/runtime-profile-ownership.js.map +1 -1
- package/dist/runtime-protocol.d.ts +5 -3
- package/dist/runtime-protocol.js +4 -0
- package/dist/runtime-protocol.js.map +1 -1
- package/dist/runtime-remote-accounts.d.ts +72 -5
- package/dist/runtime-remote-accounts.js +293 -52
- package/dist/runtime-remote-accounts.js.map +1 -1
- package/dist/runtime-remote-setup.d.ts +2 -2
- package/dist/runtime-remote-setup.js +2 -2
- package/dist/runtime-remote-setup.js.map +1 -1
- package/dist/runtime-signin-transport.d.ts +22 -4
- package/dist/runtime-signin-transport.js +50 -12
- package/dist/runtime-signin-transport.js.map +1 -1
- package/dist/runtime-signin.d.ts +42 -0
- package/dist/runtime-signin.js +105 -9
- package/dist/runtime-signin.js.map +1 -1
- package/dist/runtime-windows-bridge.js +6 -1
- package/dist/runtime-windows-bridge.js.map +1 -1
- package/dist/scheduler/task-board.d.ts +1 -0
- package/dist/scheduler/task-board.js +10 -1
- package/dist/scheduler/task-board.js.map +1 -1
- package/dist/signin-keepalive.d.ts +31 -2
- package/dist/signin-keepalive.js +123 -12
- package/dist/signin-keepalive.js.map +1 -1
- package/dist/structured-signin-transport.d.ts +2 -2
- package/dist/structured-signin-transport.js +27 -6
- package/dist/structured-signin-transport.js.map +1 -1
- package/dist/structured-signin.d.ts +16 -2
- package/dist/structured-signin.js +59 -4
- package/dist/structured-signin.js.map +1 -1
- package/dist/task-board-tool.d.ts +0 -13
- package/dist/task-board-tool.js +42 -6
- package/dist/task-board-tool.js.map +1 -1
- package/dist/tool-receipt-output.d.ts +151 -0
- package/dist/tool-receipt-output.js +50 -0
- package/dist/tool-receipt-output.js.map +1 -0
- package/dist/ui/accounts-keepalive.js +15 -6
- package/dist/ui/accounts-manage.js +25 -5
- package/dist/ui/accounts-view.js +28 -24
- package/dist/ui/agent-proposals.js +22 -2
- package/dist/ui/agent-runtime-settings.js +3 -3
- package/dist/ui/backend-signin.js +4 -4
- package/dist/ui/cli-caps.js +7 -7
- package/dist/ui/credential-profile-select.js +32 -19
- package/dist/ui/hub-chat-store.js +8 -4
- package/dist/ui/hub-client.js +54 -19
- package/dist/ui/hub-enrolment-code.js +1 -1
- package/dist/ui/hub-grant-picker.js +100 -0
- package/dist/ui/hub-group-search.js +2 -2
- package/dist/ui/hub-join-one-strings.js +2 -2
- package/dist/ui/hub-join-steps.js +5 -2
- package/dist/ui/machine-signin.js +47 -14
- package/dist/ui/panel-fleet.js +2 -2
- package/dist/ui/panel-hub.js +55 -11
- package/dist/ui/panel-settings.js +2 -2
- package/dist/ui/settings-hub-company-join.js +1 -0
- package/dist/ui/settings-hub-section.js +2 -0
- package/dist/ui/settings-hub-web-address.js +233 -0
- package/dist/ui/settings-hub.js +6 -0
- package/dist/ui/shared/accounts-keepalive.css +8 -0
- package/dist/ui/shared/accounts-usage-pool.css +10 -0
- package/dist/ui/shared/accounts.css +9 -0
- package/dist/ui/shared/app.css +38 -5
- package/dist/ui/shared/hub-grant-picker.css +4 -0
- package/dist/ui/shared/hub-sharing.css +4 -0
- package/dist/ui/shared/view-strings.js +2 -2
- package/dist/ui/structured-signin.js +19 -6
- package/dist/ui/usage-pool.js +76 -0
- package/dist/usage/agent-output.d.ts +144 -0
- package/dist/usage/agent-output.js +75 -0
- package/dist/usage/agent-output.js.map +1 -0
- package/dist/usage/provider-alerts.d.ts +6 -0
- package/dist/usage/provider-alerts.js +6 -0
- package/dist/usage/provider-alerts.js.map +1 -1
- package/dist/usage/providers.d.ts +2 -2
- package/dist/usage/providers.js +60 -18
- package/dist/usage/providers.js.map +1 -1
- package/dist/usage/usage-api.d.ts +12 -0
- package/dist/usage/usage-api.js +39 -0
- package/dist/usage/usage-api.js.map +1 -1
- package/dist/web-api.d.ts +2 -0
- package/dist/web-api.js +27 -12
- package/dist/web-api.js.map +1 -1
- package/dist/web-backend-login.d.ts +4 -1
- package/dist/web-backend-login.js.map +1 -1
- package/dist/windows-cli-providers.js +5 -1
- package/dist/windows-cli-providers.js.map +1 -1
- package/dist/windows-cli-worker.d.ts +33 -1
- package/dist/windows-cli-worker.js +150 -10
- package/dist/windows-cli-worker.js.map +1 -1
- package/dist/windows-cli.d.ts +7 -1
- package/dist/windows-cli.js +19 -2
- package/dist/windows-cli.js.map +1 -1
- package/dist/workflow-templates/default.md +2 -2
- package/package.json +1 -1
|
@@ -57,7 +57,7 @@ export function hubEntryToMessages(entry, room, { me = "", reason = (code) => co
|
|
|
57
57
|
*/
|
|
58
58
|
export function createHubChatStore(room, { client = hubClient(), me = "", reason, timers = globalThis, doc = typeof document !== "undefined" ? document : null } = {}) {
|
|
59
59
|
const subs = new Set();
|
|
60
|
-
const st = { live: true, timer: 0, inflight: false, entries: [], room: { ...room }, closed: false, loaded: false, error: null, accessDenied: false, accessEpoch: 0, pending: [], full: false, reads: 0, farTurn: 0 };
|
|
60
|
+
const st = { live: true, timer: 0, inflight: false, entries: [], room: { ...room }, closed: false, loaded: false, error: null, accessDenied: false, accessEpoch: 0, availabilityEpoch: 0, pending: [], full: false, reads: 0, farTurn: 0 };
|
|
61
61
|
const emit = () => { for (const fn of subs) { try { fn(); } catch { /* a subscriber's own failure */ } } };
|
|
62
62
|
const merge = (got) => {
|
|
63
63
|
const byId = new Map(st.entries.map((e) => [e.messageId, e]));
|
|
@@ -74,7 +74,7 @@ export function createHubChatStore(room, { client = hubClient(), me = "", reason
|
|
|
74
74
|
if (!st.live || st.inflight || st.closed) return;
|
|
75
75
|
if (doc && doc.hidden) { schedule(POLL_MS); return; }
|
|
76
76
|
st.inflight = true;
|
|
77
|
-
const accessEpoch = st.accessEpoch;
|
|
77
|
+
const accessEpoch = st.accessEpoch, availabilityEpoch = st.availabilityEpoch;
|
|
78
78
|
// Unsettled entries are read again (from just before the oldest one) — but a full page means there is more after
|
|
79
79
|
// it: read on from the last one first, so an old open entry can never pin the read to the same page (#3246 review).
|
|
80
80
|
const last = st.entries.length ? st.entries[st.entries.length - 1].sequence : 0;
|
|
@@ -101,10 +101,13 @@ export function createHubChatStore(room, { client = hubClient(), me = "", reason
|
|
|
101
101
|
// The room as the server says it now. Its quota is the server's to give: absent means withdrawn (the owner hid it,
|
|
102
102
|
// the grant is gone), never "unchanged" — a band once shown must not outlive that. An answer with no room at all
|
|
103
103
|
// (an older Hub) keeps what is known.
|
|
104
|
-
|
|
104
|
+
// A send can learn a pause while this older history read is held. Only a read begun after
|
|
105
|
+
// that refusal may restore availability; keep its history, but never undo the newer refusal.
|
|
106
|
+
const availabilityCurrent = availabilityEpoch === st.availabilityEpoch;
|
|
107
|
+
if (r.room && availabilityCurrent) { st.room = { ...st.room, ...r.room }; if (!Object.prototype.hasOwnProperty.call(r.room, "quota")) delete st.room.quota; }
|
|
105
108
|
st.pending = st.pending.filter((p) => !st.entries.some((e) => e.messageId === p.messageId));
|
|
106
109
|
if (r.room && accessEpoch === st.accessEpoch) st.accessDenied = false;
|
|
107
|
-
st.loaded = true; st.error = null; emit(); schedule(POLL_MS); return;
|
|
110
|
+
st.loaded = true; st.error = null; emit(); schedule(availabilityCurrent ? POLL_MS : 0); return;
|
|
108
111
|
}
|
|
109
112
|
if (r.code === "revoked" || r.code === "not-found") { st.closed = true; emit(); return; }
|
|
110
113
|
if (r.code === "denied") { st.accessDenied = true; st.accessEpoch++; }
|
|
@@ -151,6 +154,7 @@ export function createHubChatStore(room, { client = hubClient(), me = "", reason
|
|
|
151
154
|
if (!q || st.closed) return { ok: false, code: "invalid" };
|
|
152
155
|
let r;
|
|
153
156
|
try { r = await client.ask(st.room.id, newKey(), q, extras); } catch { r = { ok: false, code: "unreachable" }; }
|
|
157
|
+
if (!r.ok && r.code === "sharing-paused" && st.live) { st.availabilityEpoch++; st.room = { ...st.room, exposureState: "paused" }; emit(); schedule(0); return r; }
|
|
154
158
|
if (!r.ok) { if (r.code === "denied" && st.live) { st.accessDenied = true; st.accessEpoch++; emit(); } if (r.code === "revoked") { st.closed = true; emit(); } return r; }
|
|
155
159
|
st.pending.push({ messageId: r.receipt.messageId, text: q, at: r.receipt.at || Date.now() });
|
|
156
160
|
emit();
|
package/dist/ui/hub-client.js
CHANGED
|
@@ -204,39 +204,65 @@ export function createStubClient({ now = () => Date.now(), agents = () => [] } =
|
|
|
204
204
|
* session cookie (HttpOnly; this page never sees it) and the CSRF token /hub/v1/session gives a same-origin read.
|
|
205
205
|
* Every answer is { ok: true, ...body } or { ok: false, status, code }; a 401 also tells the page the session ended.
|
|
206
206
|
*/
|
|
207
|
-
export function createHubWebClient({ fetchImpl = (...a) => fetch(...a) } = {}) {
|
|
207
|
+
export function createHubWebClient({ fetchImpl = (...a) => fetch(...a), readTimeoutMs = 120_000 } = {}) {
|
|
208
|
+
// The factory override is for owned transports/rehearsals; the page uses the finite default.
|
|
209
|
+
const readBudget = Number.isInteger(readTimeoutMs) && readTimeoutMs > 0 && readTimeoutMs <= 300_000 ? readTimeoutMs : 120_000;
|
|
208
210
|
let csrf = null, codeNotices = false, generation = 0;
|
|
209
|
-
const ended = new Set(), pendingReads = new Map(), waits = new Set();
|
|
211
|
+
const ended = new Set(), pendingReads = new Map(), waits = new Set(), readControllers = new Set();
|
|
210
212
|
let readTail = Promise.resolve();
|
|
211
213
|
const retired = () => ({ ok: false, status: 401, code: "unauthenticated" });
|
|
212
|
-
const
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
const
|
|
214
|
+
const unreachable = () => ({ ok: false, status: 0, code: "unreachable" });
|
|
215
|
+
const retireReads = () => {
|
|
216
|
+
generation++; pendingReads.clear();
|
|
217
|
+
for (const controller of readControllers) controller.abort();
|
|
218
|
+
for (const wake of waits) wake();
|
|
219
|
+
};
|
|
220
|
+
const pause = (ms, signal) => new Promise(resolve => {
|
|
221
|
+
const wake = () => { clearTimeout(timer); waits.delete(wake); signal.removeEventListener("abort", wake); resolve(); };
|
|
222
|
+
const timer = setTimeout(wake, ms); waits.add(wake); signal.addEventListener("abort", wake, { once: true });
|
|
223
|
+
if (signal.aborted) wake();
|
|
216
224
|
});
|
|
217
|
-
// Private reads share fresh directory eligibility admission.
|
|
218
|
-
//
|
|
225
|
+
// Private reads share fresh directory eligibility admission. Only simultaneous signal-less GETs coalesce;
|
|
226
|
+
// a caller-owned signal stays independent. No successful-response cache and no automatic write replay.
|
|
219
227
|
function call(method, path, body, signal) {
|
|
220
228
|
if (method !== "GET") { pendingReads.clear(); return request(method, path, body, signal); }
|
|
221
229
|
if (!signal && pendingReads.has(path)) return pendingReads.get(path);
|
|
222
|
-
const mine = generation;
|
|
230
|
+
const mine = generation, controller = new AbortController();
|
|
231
|
+
let timedOut = false;
|
|
232
|
+
readControllers.add(controller);
|
|
233
|
+
const aborted = () => mine !== generation ? retired() : { ...unreachable(), ...(timedOut ? { timedOut: true } : {}) };
|
|
234
|
+
let stop;
|
|
235
|
+
const stopped = new Promise(resolve => { stop = () => resolve(aborted()); controller.signal.addEventListener("abort", stop, { once: true }); });
|
|
236
|
+
const cancel = () => controller.abort();
|
|
237
|
+
signal?.addEventListener("abort", cancel, { once: true });
|
|
238
|
+
if (signal?.aborted) cancel();
|
|
223
239
|
const run = async () => {
|
|
224
240
|
for (let attempt = 0; ; attempt++) {
|
|
225
241
|
if (mine !== generation) return retired();
|
|
226
|
-
if (signal
|
|
227
|
-
|
|
242
|
+
if (controller.signal.aborted) return aborted();
|
|
243
|
+
// Budget begins when this attempt is admitted, and covers BOTH headers and JSON body. Abort the actual
|
|
244
|
+
// transport before settling the timeout; the race also fences late/non-cooperative transport completions.
|
|
245
|
+
const timer = setTimeout(() => { timedOut = true; cancel(); }, readBudget);
|
|
246
|
+
let result;
|
|
247
|
+
try { result = await Promise.race([request(method, path, body, controller.signal), stopped]); }
|
|
248
|
+
finally { clearTimeout(timer); }
|
|
228
249
|
if (mine !== generation) return retired();
|
|
250
|
+
if (controller.signal.aborted) return aborted();
|
|
229
251
|
if (result.ok || result.status !== 429 || result.code !== "backpressure" || attempt === 3) return result;
|
|
230
|
-
await pause(Math.min(2000, Math.max(500 * 2 ** attempt, Number(result.retryAfter) * 1000 || 0)));
|
|
252
|
+
await pause(Math.min(2000, Math.max(500 * 2 ** attempt, Number(result.retryAfter) * 1000 || 0)), controller.signal);
|
|
231
253
|
}
|
|
232
254
|
};
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
255
|
+
const queued = readTail.then(run, run);
|
|
256
|
+
// A queued caller can cancel promptly, but does not let later work jump its still-running predecessor.
|
|
257
|
+
readTail = queued.then(() => {}, () => {});
|
|
258
|
+
const result = Promise.race([queued, stopped]);
|
|
259
|
+
const forget = () => {
|
|
260
|
+
readControllers.delete(controller); controller.signal.removeEventListener("abort", stop);
|
|
261
|
+
signal?.removeEventListener("abort", cancel);
|
|
262
|
+
if (pendingReads.get(path) === result) pendingReads.delete(path);
|
|
263
|
+
};
|
|
264
|
+
void result.then(forget, forget);
|
|
265
|
+
if (!signal) pendingReads.set(path, result);
|
|
240
266
|
return result;
|
|
241
267
|
}
|
|
242
268
|
async function request(method, path, body, signal) {
|
|
@@ -247,8 +273,10 @@ export function createHubWebClient({ fetchImpl = (...a) => fetch(...a) } = {}) {
|
|
|
247
273
|
let r;
|
|
248
274
|
try { r = await fetchImpl(path, { method, headers, credentials: "same-origin", cache: "no-store", ...(signal ? { signal } : {}), body: body === undefined ? undefined : JSON.stringify(body) }); }
|
|
249
275
|
catch { return { ok: false, status: 0, code: "unreachable" }; }
|
|
276
|
+
if (method === "GET" && signal?.aborted) return unreachable();
|
|
250
277
|
let json = null;
|
|
251
278
|
try { json = await r.json(); } catch { json = null; }
|
|
279
|
+
if (method === "GET" && signal?.aborted) return unreachable();
|
|
252
280
|
if (r.status === 401 && mine === generation) { retireReads(); csrf = null; codeNotices = false; for (const fn of ended) { try { fn(); } catch { /* a listener's own failure */ } } }
|
|
253
281
|
if (!r.ok) return { ok: false, status: r.status, code: (json && typeof json.code === "string" && json.code) || "failed", retryAfter: Number(r.headers.get("Retry-After")) || 0,
|
|
254
282
|
...(method === "POST" && path === "/hub/v1/admin/enrolment-codes" && r.status === 429 && json?.code === "backpressure"
|
|
@@ -264,7 +292,14 @@ export function createHubWebClient({ fetchImpl = (...a) => fetch(...a) } = {}) {
|
|
|
264
292
|
async signIn(login, password) { retireReads(); const r = await call("POST", "/hub/v1/session", { login, password }); if (r.ok) { csrf = r.csrf || null; codeNotices = r.features?.includes("enrolment-code-v1") === true; } return r; },
|
|
265
293
|
async signOut() { retireReads(); const r = await call("DELETE", "/hub/v1/session"); csrf = null; codeNotices = false; return r; },
|
|
266
294
|
catalog() { return call("GET", "/hub/v1/exposures"); },
|
|
295
|
+
sharingPauseV1: true,
|
|
296
|
+
sharing(exposureId, revision, sharingEpoch, paused) { return call("POST", `/hub/v1/exposures/${id(exposureId)}/sharing`, { revision, sharingEpoch, paused }); },
|
|
267
297
|
grant(input) { return call("POST", "/hub/v1/grants", input); },
|
|
298
|
+
grantSubjectsV1: true,
|
|
299
|
+
async searchGrantSubjects(exposureId, exposureRevision, kind, q, signal) {
|
|
300
|
+
const out = await call("POST", `/hub/v1/exposures/${id(exposureId)}/grant-subjects/search`, { exposureRevision, kind, q }, signal);
|
|
301
|
+
return signal?.aborted ? { ok: false, status: 0, code: "unreachable" } : out;
|
|
302
|
+
},
|
|
268
303
|
revokeGrant(grantId, revision) { return call("DELETE", `/hub/v1/grants/${id(grantId)}?revision=${id(revision)}`); },
|
|
269
304
|
activity(exposureId) { return call("GET", `/hub/v1/exposures/${id(exposureId)}/activity`); },
|
|
270
305
|
freeze(exposureId, revision, admin = false) { return call("POST", `/hub/v1/${admin ? "admin/" : ""}exposures/${id(exposureId)}/freeze`, { revision }); },
|
|
@@ -78,7 +78,7 @@ export function HubEnrolmentCode({ client = hubClient(), enabled = false, host =
|
|
|
78
78
|
if (!current(mine) || writing.current) return;
|
|
79
79
|
setLoading(false);
|
|
80
80
|
if (r.ok && Array.isArray(r.codes)) { setData({ client, codes: r.codes }); setError(null); return true; }
|
|
81
|
-
else { if (r.code !== "backpressure") setData(null); setError(errorText(r, "loadFailed")); }
|
|
81
|
+
else { if (r.code !== "backpressure" && r.timedOut !== true) setData(null); setError(errorText(r, "loadFailed")); }
|
|
82
82
|
};
|
|
83
83
|
refresh.current = read;
|
|
84
84
|
useEffect(() => {
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/** Exact owner/exposure suggestions; the server re-resolves the selected immutable identity at commit. */
|
|
2
|
+
import { html, useEffect, useMemo, useRef, useState } from "/assets/app-html.js";
|
|
3
|
+
import { register, t } from "/assets/app-i18n.js";
|
|
4
|
+
import { Dialog } from "/assets/ui-dialog.js";
|
|
5
|
+
import { GroupSearch } from "./hub-group-search.js";
|
|
6
|
+
import { hubClient } from "./hub-client.js";
|
|
7
|
+
register("hubGrantPicker", {
|
|
8
|
+
en: {
|
|
9
|
+
title: "Allow access to {0}", kind: "Allow", person: "A person", group: "An AD security group", findPerson: "Find a person", query: "Name or login", hint: "Type 2 to 64 characters.",
|
|
10
|
+
searching: "Searching…", none: "No matching people. Try more of their name or login.", more: "More people match. Type more of the name.", pick: "Choose {0}", choose: "Choose", change: "Choose someone else",
|
|
11
|
+
failed: "The directory could not be searched just now. Try again.", unsupported: "This directory does not support that search.", limited: "Too many searches. Try again shortly.", retry: "Search again",
|
|
12
|
+
days: "Access lasts", day: "{0} days", expiry: "Choose up to 90 days. Access expires automatically; removing the grant also ends access to its chats.",
|
|
13
|
+
groupHint: "Direct members are checked again for every action. Nested and primary groups are not included. Whoever manages this AD group can change who may ask. Each person has a private chat.",
|
|
14
|
+
save: "Allow", cancel: "Cancel", refused: "The selected person or group changed or is no longer available. Search and choose again.", saveFailed: "Access could not be saved. Check the current agent and try again.",
|
|
15
|
+
},
|
|
16
|
+
"zh-TW": {
|
|
17
|
+
title: "允許向 {0} 提問", kind: "允許對象", person: "個人", group: "AD 安全性群組", findPerson: "尋找同仁", query: "姓名或登入帳號", hint: "請輸入 2 到 64 個字。",
|
|
18
|
+
searching: "搜尋中…", none: "找不到符合的同仁。請多輸入幾個姓名或帳號的字。", more: "還有更多同仁符合,請多輸入幾個字。", pick: "選擇 {0}", choose: "選擇", change: "重新選擇對象",
|
|
19
|
+
failed: "目前無法搜尋目錄,請再試一次。", unsupported: "這個目錄不支援這項搜尋。", limited: "搜尋太多次了,請稍後再試。", retry: "重新搜尋",
|
|
20
|
+
days: "允許多久", day: "{0} 天", expiry: "最長 90 天,到期自動失效;移除授權也會結束其聊天存取權。",
|
|
21
|
+
groupHint: "每次操作都會重新檢查直接成員,不含巢狀或主要群組。能管理這個 AD 群組的人,也能改變誰可以提問。每個人都有自己的私人對話。",
|
|
22
|
+
save: "允許提問", cancel: "取消", refused: "選取的同仁或群組已變更或無法使用,請重新搜尋選擇。", saveFailed: "無法儲存授權,請確認目前的 Agent 後再試。",
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
const g = (key, ...args) => t(`hubGrantPicker.${key}`, ...args);
|
|
26
|
+
/** Fresh lazy picker rules must not depend on the shell's retained app.css. */
|
|
27
|
+
export function linkHubGrantPickerCss(doc = typeof document !== "undefined" ? document : null) {
|
|
28
|
+
try {
|
|
29
|
+
if (!doc?.head || doc.querySelector('link[data-hub-grant-picker-css="1"]')) return;
|
|
30
|
+
const link = doc.createElement("link");
|
|
31
|
+
link.setAttribute("rel", "stylesheet"); link.setAttribute("href", "/assets/hub-grant-picker.css"); link.setAttribute("data-hub-grant-picker-css", "1");
|
|
32
|
+
doc.head.appendChild(link);
|
|
33
|
+
} catch { /* The form's existing controls still work if the stylesheet cannot be linked. */ }
|
|
34
|
+
}
|
|
35
|
+
function PeopleSearch({ search, disabled, onPick }) {
|
|
36
|
+
const [query, setQuery] = useState(""), [answer, setAnswer] = useState(null), [busy, setBusy] = useState(false), [retry, setRetry] = useState(0);
|
|
37
|
+
const sequence = useRef(0);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
const mine = ++sequence.current, q = query.trim(); setAnswer(null);
|
|
40
|
+
if (q.length < 2 || q.length > 64) { setBusy(false); return; }
|
|
41
|
+
setBusy(true); const timer = setTimeout(async () => {
|
|
42
|
+
let out; try { out = await search("person", q); } catch { out = { ok: false }; }
|
|
43
|
+
if (mine !== sequence.current) return;
|
|
44
|
+
setBusy(false); setAnswer(out);
|
|
45
|
+
}, 300);
|
|
46
|
+
return () => { clearTimeout(timer); sequence.current++; };
|
|
47
|
+
}, [query, search, retry]);
|
|
48
|
+
const hits = answer?.ok && Array.isArray(answer.people) ? answer.people.slice(0, 20) : [];
|
|
49
|
+
return html`<div class="hub-group-search">
|
|
50
|
+
<label class="field" for="hubGrantPerson"><span>${g("findPerson")}</span><input id="hubGrantPerson" type="search" autocomplete="off" spellcheck=${false}
|
|
51
|
+
disabled=${disabled} value=${query} placeholder=${g("query")} aria-describedby="hubGrantPersonNote" onInput=${e => setQuery(e.target.value)} /></label>
|
|
52
|
+
<p id="hubGrantPersonNote" class="note" role="status">${busy ? g("searching") : !answer ? g("hint") : answer.ok ? hits.length ? answer.truncated ? g("more") : "" : g("none") : answer.status === 429 ? g("limited") : g("failed")}</p>
|
|
53
|
+
${answer && !answer.ok && !busy ? html`<button type="button" class="btn btn-sm" disabled=${disabled} onClick=${() => setRetry(n => n + 1)}>${g("retry")}</button>` : null}
|
|
54
|
+
${hits.length ? html`<ul class="hub-group-hits" role="list">${hits.map(p => html`<li key=${`${p.person?.realm}/${p.person?.objectId}`} class="s-row"><span class="hub-row-text"><strong>${p.displayName || p.login}</strong><small class="note"><code>${p.login}</code></small></span>
|
|
55
|
+
<button type="button" class="btn btn-sm" disabled=${disabled} aria-label=${g("pick", p.displayName || p.login)} onClick=${() => onPick(p)}>${g("choose")}</button></li>`)}</ul>` : null}
|
|
56
|
+
</div>`;
|
|
57
|
+
}
|
|
58
|
+
export function HubGrantPicker({ x, client, act, onClose }) {
|
|
59
|
+
const [kind, setKind] = useState("person"), [selected, setSelected] = useState(null), [days, setDays] = useState(7), [busy, setBusy] = useState(false), [error, setError] = useState(null), [unsupported, setUnsupported] = useState(false);
|
|
60
|
+
const life = useRef(0), writing = useRef(false), controllers = useRef(new Set());
|
|
61
|
+
const search = useMemo(() => async (kind, q) => {
|
|
62
|
+
const controller = new AbortController(); for (const old of controllers.current) old.abort(); controllers.current.add(controller);
|
|
63
|
+
const timer = setTimeout(() => controller.abort(), 10_000);
|
|
64
|
+
try { return await client.searchGrantSubjects(x.id, x.revision, kind, q, controller.signal); }
|
|
65
|
+
finally { clearTimeout(timer); controllers.current.delete(controller); }
|
|
66
|
+
}, [client, x.id, x.revision]);
|
|
67
|
+
const groupClient = useMemo(() => ({ searchGroups: q => search("group", q) }), [search]);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
linkHubGrantPickerCss();
|
|
70
|
+
const mine = life.current;
|
|
71
|
+
const end = client.onSignedOut?.(() => { if (life.current === mine) { life.current++; onClose(); } });
|
|
72
|
+
return () => { life.current++; end?.(); for (const c of controllers.current) c.abort(); controllers.current.clear(); };
|
|
73
|
+
}, [client, x.id, x.revision]);
|
|
74
|
+
const change = () => { setSelected(null); setError(null); setUnsupported(false); };
|
|
75
|
+
const submit = async event => {
|
|
76
|
+
event?.preventDefault?.(); if (writing.current || !selected || client !== hubClient()) return;
|
|
77
|
+
writing.current = true; setBusy(true); setError(null); const mine = life.current;
|
|
78
|
+
const subject = kind === "group" ? { kind: "group", group: { realm: selected.realm, objectId: selected.objectId }, dn: selected.dn }
|
|
79
|
+
: { kind: "person", person: { ...selected.person } };
|
|
80
|
+
const input = { exposureId: x.id, exposureRevision: x.revision, days, subject, ...(kind === "person" ? { login: selected.login } : {}) };
|
|
81
|
+
try {
|
|
82
|
+
const out = await act(() => client.grant(input), undefined, () => { if (mine === life.current) setError(g("refused")); });
|
|
83
|
+
if (mine === life.current && client === hubClient()) { if (out?.ok) onClose(); else setError(g("refused")); }
|
|
84
|
+
} catch { if (mine === life.current) setError(g("saveFailed")); }
|
|
85
|
+
finally { if (mine === life.current) { writing.current = false; setBusy(false); } }
|
|
86
|
+
};
|
|
87
|
+
return html`<${Dialog} title=${g("title", x.displayName)} onClose=${onClose} actions=${html`<button type="button" class="btn" onClick=${onClose}>${g("cancel")}</button><button type="button" class="btn btn-primary" disabled=${busy || !selected} onClick=${submit}>${g("save")}</button>`}>
|
|
88
|
+
<form class="form hub-grant" data-grant-picker onSubmit=${submit}>
|
|
89
|
+
${error ? html`<p class="err" role="alert">${error}</p>` : null}
|
|
90
|
+
<label class="field"><span>${g("kind")}</span><select data-grant-kind value=${kind} disabled=${busy} onChange=${e => { change(); setKind(e.target.value); }}><option value="person">${g("person")}</option><option value="group">${g("group")}</option></select></label>
|
|
91
|
+
${selected ? html`<div class="s-row"><span class="hub-row-text"><strong>${selected.displayName || selected.cn || selected.login}</strong><small class="note"><code>${selected.login || selected.dn}</code></small></span><button type="button" class="btn btn-sm" disabled=${busy} onClick=${change}>${g("change")}</button></div>`
|
|
92
|
+
: kind === "person" ? html`<${PeopleSearch} search=${search} disabled=${busy} onPick=${setSelected} />`
|
|
93
|
+
: html`<${GroupSearch} client=${groupClient} id="hubGrantGroup" disabled=${busy} unknownHint=${g("failed")} onUnsupported=${() => setUnsupported(true)} onPick=${p => setSelected({ ...p, realm: x.owner?.realm || "" })} />`}
|
|
94
|
+
${unsupported ? html`<p class="err" role="status">${g("unsupported")}</p>` : null}
|
|
95
|
+
${kind === "group" ? html`<p class="note">${g("groupHint")}</p>` : null}
|
|
96
|
+
<label class="field"><span>${g("days")}</span><select data-grant-days value=${String(days)} disabled=${busy} onChange=${e => setDays(Number(e.target.value))}>${[1, 7, 30, 90].map(d => html`<option value=${String(d)}>${g("day", d)}</option>`)}</select></label>
|
|
97
|
+
<p class="note">${g("expiry")}</p>
|
|
98
|
+
</form>
|
|
99
|
+
</${Dialog}>`;
|
|
100
|
+
}
|
|
@@ -47,7 +47,7 @@ export async function searchGroups(client, q) {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
/** The search box: 300 ms after typing stops, the newest answer for the text in the box only. */
|
|
50
|
-
export function GroupSearch({ client, disabled = false, exclude = [], label, onPick, onUnsupported, id = "hubGroupSearch" } = {}) {
|
|
50
|
+
export function GroupSearch({ client, disabled = false, exclude = [], label, onPick, onUnsupported, unknownHint, id = "hubGroupSearch" } = {}) {
|
|
51
51
|
const noteId = `${id}Note`;
|
|
52
52
|
const [q, setQ] = useState(""), [answer, setAnswer] = useState(null), [busy, setBusy] = useState(false);
|
|
53
53
|
const seq = useRef(0), told = useRef(false), live = useRef(true);
|
|
@@ -69,7 +69,7 @@ export function GroupSearch({ client, disabled = false, exclude = [], label, onP
|
|
|
69
69
|
const message = busy ? g("searching")
|
|
70
70
|
: !answer ? (q.trim() && q.trim().length < 2 ? g("hint") : null)
|
|
71
71
|
: answer.ok ? (hits.length ? (answer.truncated ? g("more") : null) : g("none", answer.q))
|
|
72
|
-
: answer.reason === "limited" ? g("limited", answer.retryAfter ?? 60) : answer.reason === "invalid" ? g("invalid") : g("unknown");
|
|
72
|
+
: answer.reason === "limited" ? g("limited", answer.retryAfter ?? 60) : answer.reason === "invalid" ? g("invalid") : unknownHint || g("unknown");
|
|
73
73
|
return html`<div class="hub-group-search">
|
|
74
74
|
<label class="field" for=${id}><span>${label || g("label")}</span>
|
|
75
75
|
<input id=${id} type="search" value=${q} disabled=${disabled} autocomplete="off" spellcheck=${false} placeholder=${g("placeholder")}
|
|
@@ -24,7 +24,7 @@ register("joinOne", {
|
|
|
24
24
|
E11: "The Hub is handling other connections and will retry shortly.",
|
|
25
25
|
E12: "This attempt timed out and nothing was created. Press again.",
|
|
26
26
|
E13: "Another connection with a pairing code is still in progress for you. Finish or stop it on the Hub first.",
|
|
27
|
-
E14: "The result could not be confirmed. Choose Check
|
|
27
|
+
E14: "The result could not be confirmed. Choose Check again; do not start again.",
|
|
28
28
|
limited: "Too many lookups. Wait a minute, then try again.",
|
|
29
29
|
opened: "Opened the sign-in tab for {0}…", left: "{0} left", reopen: "Reopen tab", cancel: "Cancel",
|
|
30
30
|
ownerLine: "Connected with {0}'s company account · This Fleet is called “{1}”",
|
|
@@ -50,7 +50,7 @@ register("joinOne", {
|
|
|
50
50
|
E11: "Hub 正在處理其他連接,稍後會自動再試。",
|
|
51
51
|
E12: "這次連接逾時了,沒有建立任何東西。請再按一次。",
|
|
52
52
|
E13: "你有另一個用配對碼的連接還沒完成。請先在 Hub 完成或停止它。",
|
|
53
|
-
E14: "
|
|
53
|
+
E14: "無法確認結果。請按「再次檢查」,不要重新開始。",
|
|
54
54
|
limited: "查詢太多次了。請等一分鐘再試。",
|
|
55
55
|
opened: "已開啟 {0} 的登入分頁…", left: "剩 {0}", reopen: "重新開啟分頁", cancel: "取消",
|
|
56
56
|
ownerLine: "以 {0} 的公司帳號連接 · 這台 Fleet 叫「{1}」",
|
|
@@ -14,6 +14,7 @@ import { html, useEffect, useRef, useState } from "/assets/app-html.js";
|
|
|
14
14
|
import { GroupSearch } from "./hub-group-search.js";
|
|
15
15
|
import { register, t } from "/assets/app-i18n.js";
|
|
16
16
|
import { hubClient } from "./hub-client.js";
|
|
17
|
+
import { navigate } from "/assets/app-nav.js";
|
|
17
18
|
export const joinStepsV1 = true;
|
|
18
19
|
register("hubJoinSteps", {
|
|
19
20
|
en: {
|
|
@@ -200,7 +201,7 @@ export function HubJoinCard({ view, busy = false, error = null, onToggle, onRetr
|
|
|
200
201
|
let r; try { r = await client[method](); } catch { r = { ok: false }; }
|
|
201
202
|
if (!live) return;
|
|
202
203
|
if (r?.ok) save(method === "groupPolicy" ? r.policy : Array.isArray(r.codes) ? r.codes : null);
|
|
203
|
-
else { failed = true; if (r?.code !== "backpressure") save(null); }
|
|
204
|
+
else { failed = true; if (r?.code !== "backpressure" && r?.timedOut !== true) save(null); }
|
|
204
205
|
}
|
|
205
206
|
if (live) { setReadError(failed); setReading(false); }
|
|
206
207
|
};
|
|
@@ -220,7 +221,9 @@ export function HubJoinCard({ view, busy = false, error = null, onToggle, onRetr
|
|
|
220
221
|
<li class=${s1 ? "done" : "now"} data-step="1"><div class="hub-step-body"><span><b>${sw("step1")}${mark(s1)}</b></span>
|
|
221
222
|
${view ? html`<label class="check"><input type="checkbox" role="switch" class="s-ui-toggle" checked=${view.enabled} disabled=${busy || !!error} onChange=${(e) => onToggle?.(e.target.checked)} /><span>${sw("step1Switch")}</span></label>` : null}</div></li>
|
|
222
223
|
<li class=${s2 ? "done" : s1 ? "now" : ""} data-step="2"><div class="hub-step-body"><span><b>${sw("step2")}${mark(s2)}</b><small class="note">${sw("step2Hint")} ${features.includes("enrolment-code-v1") ? sw("step2Code") : ""}</small></span>
|
|
223
|
-
${groups ? html`<${JoinStep2} client=${client} onSaved=${changed}
|
|
224
|
+
${groups ? html`<${JoinStep2} client=${client} onSaved=${changed} />
|
|
225
|
+
<div class="field-row hub-join-groups-link"><a class="btn btn-sm" href="/ui/hub/admin?view=groups"
|
|
226
|
+
onClick=${(e) => { e.preventDefault(); navigate("/ui/hub/admin?view=groups"); }}>${sw("groupsPage")}</a></div>` : html`<p class="note" role="status">${sw("unsupported")}</p>`}</div></li>
|
|
224
227
|
<${JoinStep3} webOrigin=${origin} step1=${s1} step2=${s2} features=${features} client=${client} onChanged=${changed} pending=${!view || reading || readError} />
|
|
225
228
|
</ol>
|
|
226
229
|
${view && view.enabled && view.companyLink ? html`<details class="s-ui-disclosure hub-join-advanced"><summary>${sw("advanced")}</summary><div class="s-disclosure-body"><p class="note">${sw("advancedHint")}</p>
|
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
// (structured-signin.js: the link, the code box, the outcome), pointed at ONE computer and ONE profile — the same /ui/browser-backend-signins with
|
|
3
3
|
// `?machine=&profile=` — so there is no second sign-in screen to learn. Only a Claude subscription account is signed in from here: a Console account is kept
|
|
4
4
|
// outside the profile's folder, so the person runs `agend-runtime login claude-code NAME` on that computer (said in the dialog).
|
|
5
|
+
// AGEND-113: a CLI whose registry spec says `runtime.signIn.profile === "none"` (cli-caps.js: `runtimeDefaultLogin`; Antigravity) has no profile: its login on Windows is one entry in the Credential
|
|
6
|
+
// Manager, so this signs the computer's OWN login in (`?machine=&backend=<cli>`), after the person has confirmed that it changes that login (the Windows user has one default connection; named accounts are separate).
|
|
5
7
|
// A module of its own, its words registered here: a tab that loaded an older accounts-view.js keeps working, and this never meets an older cached strings file.
|
|
6
8
|
import { html, useEffect, useRef } from "/assets/app-html.js";
|
|
7
9
|
import { register, t, lang, onLang } from "/assets/app-i18n.js";
|
|
8
10
|
import { createStore } from "/assets/app-store.js";
|
|
9
11
|
import { closeDialog, showDialog } from "/assets/app-shell.js";
|
|
10
12
|
import { Dialog } from "/assets/ui-dialog.js";
|
|
13
|
+
import { confirmDialog } from "/assets/ui-confirm.js";
|
|
11
14
|
import { mountStructuredSignIns } from "./structured-signin.js";
|
|
12
15
|
import { cliLabel } from "./cli-picker.js";
|
|
16
|
+
import { capsOf } from "./cli-caps.js";
|
|
13
17
|
|
|
14
18
|
register("machineSignin", {
|
|
15
19
|
en: {
|
|
@@ -17,40 +21,69 @@ register("machineSignin", {
|
|
|
17
21
|
lead: "AgEnD asks {0}'s Runtime to connect this account. You get a link here, open it in your browser, finish on the provider's official website, and paste back the authorization code it shows. The connection is kept on that computer, and anyone who can sign in to that Windows user can use it.",
|
|
18
22
|
console: "Using an Anthropic Console account instead? Run this on that computer: {0}",
|
|
19
23
|
close: "Close",
|
|
24
|
+
titleDefault: "Connect {0} on {1}",
|
|
25
|
+
leadDefault: "AgEnD asks {1}'s Runtime to connect {0}. You get a link here, open it in your browser, finish with the account, and paste back the code it shows. This replaces the Windows user's one default {0} connection on that computer (named accounts are separate and are not affected), and anyone who can sign in to that Windows user can use it.",
|
|
26
|
+
confirmTitle: "Change {1}'s connection on {0}?",
|
|
27
|
+
confirm: "This changes the default {1} connection on {0}. The Windows user has one default {1} connection, so the account that is connected there now is replaced. Named accounts are not affected.",
|
|
28
|
+
confirmLabel: "Continue",
|
|
20
29
|
},
|
|
21
30
|
"zh-TW": {
|
|
22
31
|
title: "在 {2} 連接 {0} 帳號「{1}」",
|
|
23
32
|
lead: "AgEnD 會請 {0} 的 Runtime 連接這個帳號。這裡會給你一個連結,在瀏覽器開啟、前往官方網站完成授權後,把它顯示的授權碼貼回來。連接資料保存在那台電腦上,能登入該 Windows 使用者的人都能使用它。",
|
|
24
33
|
console: "要改用 Anthropic Console 帳號嗎?請在那台電腦上執行:{0}",
|
|
25
34
|
close: "關閉",
|
|
35
|
+
titleDefault: "在 {1} 連接 {0}",
|
|
36
|
+
leadDefault: "AgEnD 會請 {1} 的 Runtime 連接 {0}。這裡會給你一個連結,在瀏覽器開啟後用帳號完成連接,再把它顯示的授權碼貼回來。這會取代那台電腦上 Windows 使用者目前的預設 {0} 連接(具名帳號是分開的,不受影響),能登入該 Windows 使用者的人都能使用它。",
|
|
37
|
+
confirmTitle: "要更改 {0} 上的 {1} 連接嗎?",
|
|
38
|
+
confirm: "這會更改 {0} 上的預設 {1} 連接。Windows 使用者只有一個預設 {1} 連接,所以目前連接在那裡的帳號會被取代;具名帳號不受影響。",
|
|
39
|
+
confirmLabel: "繼續",
|
|
26
40
|
},
|
|
27
41
|
});
|
|
28
42
|
const tm = (k, ...v) => t(`machineSignin.${k}`, ...v);
|
|
43
|
+
/** The CLI's login on a computer is the computer's own, with no profile (cli-caps.js: `runtimeDefaultLogin`). */
|
|
44
|
+
const ownLogin = (backend) => !!(capsOf(backend) && capsOf(backend).runtimeDefaultLogin);
|
|
29
45
|
|
|
30
46
|
/** What the Accounts view reads to refresh itself and to keep a second sign-in from starting: the open dialog's current phase for the computer's profile. */
|
|
31
|
-
export const machineSignInStore = createStore({ phase: "", reason: "" });
|
|
47
|
+
export const machineSignInStore = createStore({ phase: "", reason: "", backend: "" });
|
|
32
48
|
|
|
33
|
-
/** The endpoint of one profile's sign-in on one computer. */
|
|
34
|
-
export const machineSignInEndpoint = (machineId, profile) =>
|
|
49
|
+
/** The endpoint of one profile's sign-in on one computer; with a `backend` whose login is the computer's own (no profile), that login. */
|
|
50
|
+
export const machineSignInEndpoint = (machineId, profile, backend) => backend && !profile && ownLogin(backend)
|
|
51
|
+
? `/ui/browser-backend-signins?machine=${encodeURIComponent(machineId)}&backend=${encodeURIComponent(backend)}`
|
|
52
|
+
// AGEND-124: a NAMED account of a CLI other than Claude Code (Antigravity) names its CLI too; Claude Code's address is the one it always had.
|
|
53
|
+
: backend && backend !== "claude-code" && profile
|
|
54
|
+
? `/ui/browser-backend-signins?machine=${encodeURIComponent(machineId)}&backend=${encodeURIComponent(backend)}&profile=${encodeURIComponent(profile)}`
|
|
55
|
+
: `/ui/browser-backend-signins?machine=${encodeURIComponent(machineId)}&profile=${encodeURIComponent(profile)}`;
|
|
35
56
|
|
|
36
|
-
/** `machine`: `{ id, name }`; `profile`: the credential profile's name on that computer. */
|
|
37
|
-
export function MachineSignInDialog({ machine, profile, onClose }) {
|
|
57
|
+
/** `machine`: `{ id, name }`; `profile`: the credential profile's name on that computer (none for a CLI whose login is the computer's own: its `backend` says which). */
|
|
58
|
+
export function MachineSignInDialog({ machine, profile, backend, onClose }) {
|
|
38
59
|
const root = useRef(null), close = onClose || closeDialog;
|
|
60
|
+
const bare = !profile && ownLogin(backend);
|
|
39
61
|
useEffect(() => {
|
|
40
|
-
const cards = mountStructuredSignIns(root.current, { endpoint: machineSignInEndpoint(machine.id, profile), lang, machine: true, changed: (next) => {
|
|
62
|
+
const cards = mountStructuredSignIns(root.current, { endpoint: machineSignInEndpoint(machine.id, profile, backend), lang, machine: true, codeHint: (b) => !!(capsOf(b) && capsOf(b).codeHint), changed: (next) => {
|
|
41
63
|
const login = next && next.login;
|
|
42
|
-
|
|
64
|
+
// AGEND-250: the state carries the dialog's backend, so an Antigravity sign-in being busy marks Antigravity's card and never Claude's.
|
|
65
|
+
machineSignInStore.set({ phase: login ? login.phase : "", reason: (login && login.reason) || "", backend: backend || "claude-code" });
|
|
43
66
|
} });
|
|
44
67
|
const unlisten = onLang(() => cards.relabel());
|
|
45
|
-
return () => { unlisten(); cards.dispose(); machineSignInStore.set({ phase: "", reason: "" }); };
|
|
46
|
-
}, [machine.id, profile]);
|
|
47
|
-
|
|
68
|
+
return () => { unlisten(); cards.dispose(); machineSignInStore.set({ phase: "", reason: "", backend: "" }); };
|
|
69
|
+
}, [machine.id, profile, backend]);
|
|
70
|
+
const product = cliLabel(backend && backend !== "claude-code" ? backend : "claude-code"), claude = !backend || backend === "claude-code";
|
|
71
|
+
return html`<${Dialog} title=${bare ? tm("titleDefault", cliLabel(backend), machine.name) : tm("title", product, profile, machine.name)} onClose=${close}
|
|
48
72
|
actions=${html`<button type="button" class="btn" onClick=${close}>${tm("close")}</button>`}>
|
|
49
|
-
<p>${tm("lead", machine.name)}</p>
|
|
50
|
-
|
|
73
|
+
<p>${bare ? tm("leadDefault", cliLabel(backend), machine.name) : tm("lead", machine.name)}</p>
|
|
74
|
+
${bare || !claude ? null : html`<p class="note">${tm("console", `agend-runtime login claude-code ${profile}`)}</p>`}
|
|
51
75
|
<div class="signin-browser" ref=${root}></div>
|
|
52
76
|
</${Dialog}>`;
|
|
53
77
|
}
|
|
54
78
|
|
|
55
|
-
/**
|
|
56
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Open the dialog for one profile on one computer. For a computer's OWN login of a CLI (no profile; Antigravity) the person is asked first: it replaces the login of that computer's
|
|
81
|
+
* Windows user, which is not an account AgEnD created, so it never changes without that answer.
|
|
82
|
+
*/
|
|
83
|
+
export function openMachineSignIn({ machine, profile, backend }) {
|
|
84
|
+
const target = { machine: { id: machine.id, name: machine.name }, ...(profile ? { profile } : {}), ...(!profile && ownLogin(backend) ? { backend } : {}), ...(profile && backend && backend !== "claude-code" ? { backend } : {}) };
|
|
85
|
+
// A NAMED account (with or without a CLI other than Claude Code) is one AgEnD's Runtime made: no question first. Only the computer's own login is confirmed.
|
|
86
|
+
if (profile || !target.backend) { showDialog(MachineSignInDialog, target); return; }
|
|
87
|
+
void confirmDialog({ title: tm("confirmTitle", machine.name, cliLabel(backend)), message: tm("confirm", machine.name, cliLabel(backend)), confirmLabel: tm("confirmLabel") })
|
|
88
|
+
.then((yes) => { if (yes) showDialog(MachineSignInDialog, target); }, () => {});
|
|
89
|
+
}
|
package/dist/ui/panel-fleet.js
CHANGED
|
@@ -16,7 +16,7 @@ import { RuntimePicker, AgentDraftAssistant, NativeAgendToolsHint, tr } from "./
|
|
|
16
16
|
import { CliPicker, cliLabel as productLabel } from "./cli-picker.js";
|
|
17
17
|
import { useWindowsCliCatalog, WindowsCliDiscoveryStatus, detectionText } from "./windows-cli-catalog.js";
|
|
18
18
|
import { useRuntimeCatalog } from "./runtime-catalog.js";
|
|
19
|
-
import { ClaudeAccountSelect } from "./credential-profile-select.js";
|
|
19
|
+
import { ClaudeAccountSelect, accountCli } from "./credential-profile-select.js";
|
|
20
20
|
import { AccountSelect } from "./accounts-view.js"; // the same Account field as the agent dialog (a new module: never a stale named import)
|
|
21
21
|
import { capsOf } from "./cli-caps.js";
|
|
22
22
|
import { chatPath, fleetPath, FLEET_TABS, rememberFleetTab } from "/assets/app-route.js";
|
|
@@ -562,7 +562,7 @@ export function CreateInstanceDialog({ onClose }) {
|
|
|
562
562
|
if (windows) {
|
|
563
563
|
const name = f.topic.trim() || f.dir.trim().replace(/[\\/]+$/, "").split(/[\\/]/).pop();
|
|
564
564
|
if (!name) { toast(tr("required"),false); return null; }
|
|
565
|
-
return {runtime:"windows",...(nativeAdapter==="pane"?{native_adapter:"pane"}:{}),...(machineId ? {machineId} : {}),...(machineId && f.backend
|
|
565
|
+
return {runtime:"windows",...(nativeAdapter==="pane"?{native_adapter:"pane"}:{}),...(machineId ? {machineId} : {}),...(machineId && accountCli(f.backend) && credentialProfile ? {credentialProfile} : {}),topic_name:name,backend:f.backend,...(f.model.trim() ? {model:f.model.trim()} : {}),...(f.dir.trim() ? {directory:f.dir.trim()} : {}),description:f.desc.trim(),systemPrompt:f.prompt.trim(),sandbox};
|
|
566
566
|
}
|
|
567
567
|
if (!f.dir.trim() && !f.topic.trim()) { toast(t("fleet.topicRequired"), false); return null; }
|
|
568
568
|
const body = {};
|