@songsid/agend 2.4.0-alpha.1 → 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/README.md +1 -1
- package/README.zh-TW.md +1 -1
- 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 +4 -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 +7 -1
- 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/claude-code.js +4 -0
- package/dist/backend/claude-code.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/types.d.ts +6 -0
- package/dist/backend/types.js.map +1 -1
- package/dist/backend-availability.d.ts +7 -1
- package/dist/backend-availability.js +39 -1
- package/dist/backend-availability.js.map +1 -1
- package/dist/browser-backend-signins.d.ts +16 -2
- package/dist/browser-backend-signins.js +17 -9
- package/dist/browser-backend-signins.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/channel/mcp-tools.js +10 -10
- 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/config-validator.js +47 -7
- package/dist/config-validator.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.d.ts +3 -0
- package/dist/daemon.js +6 -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 +53 -5
- package/dist/fleet-manager.js +301 -115
- 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 +42 -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/audit/index.js +12 -5
- package/dist/hub/audit/index.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 +18 -5
- package/dist/hub/catalog.js +119 -36
- package/dist/hub/catalog.js.map +1 -1
- package/dist/hub/client.d.ts +6 -0
- package/dist/hub/client.js +6 -1
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.d.ts +2 -0
- package/dist/hub/compose/member.js +26 -2
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.d.ts +6 -0
- package/dist/hub/compose/server.js +11 -4
- 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 +126 -0
- package/dist/hub/enrolment-code.js +266 -0
- package/dist/hub/enrolment-code.js.map +1 -0
- 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 +14 -4
- package/dist/hub/group-policy/admin-impact.js.map +1 -1
- package/dist/hub/group-policy/admin-inventory.js +7 -7
- package/dist/hub/group-policy/admin-inventory.js.map +1 -1
- package/dist/hub/group-policy/authorization.d.ts +20 -3
- package/dist/hub/group-policy/authorization.js +132 -27
- package/dist/hub/group-policy/authorization.js.map +1 -1
- package/dist/hub/group-policy/impact-inventory.js +23 -7
- package/dist/hub/group-policy/impact-inventory.js.map +1 -1
- package/dist/hub/group-policy/resources.d.ts +44 -6
- package/dist/hub/group-policy/resources.js +75 -30
- package/dist/hub/group-policy/resources.js.map +1 -1
- package/dist/hub/group-policy/store.d.ts +24 -3
- package/dist/hub/group-policy/store.js +136 -77
- 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 +68 -16
- 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/init/text.js +2 -2
- package/dist/hub/init/text.js.map +1 -1
- package/dist/hub/init/web.d.ts +7 -0
- package/dist/hub/init/web.js +6 -1
- package/dist/hub/init/web.js.map +1 -1
- package/dist/hub/join/local.d.ts +32 -0
- package/dist/hub/join/local.js +98 -10
- package/dist/hub/join/local.js.map +1 -1
- package/dist/hub/join/receipt.d.ts +1 -0
- package/dist/hub/join/receipt.js +1 -1
- package/dist/hub/join/receipt.js.map +1 -1
- package/dist/hub/join/service.d.ts +94 -6
- package/dist/hub/join/service.js +214 -44
- package/dist/hub/join/service.js.map +1 -1
- package/dist/hub/join/store.d.ts +2 -1
- package/dist/hub/join/store.js +7 -7
- package/dist/hub/join/store.js.map +1 -1
- package/dist/hub/member/exposure-api.d.ts +2 -0
- package/dist/hub/member/exposure-api.js +3 -2
- package/dist/hub/member/exposure-api.js.map +1 -1
- package/dist/hub/member/exposures.d.ts +4 -0
- package/dist/hub/member/exposures.js +12 -2
- package/dist/hub/member/exposures.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/member/pairing-notices.js +8 -6
- package/dist/hub/member/pairing-notices.js.map +1 -1
- package/dist/hub/pairing-notices.d.ts +5 -2
- package/dist/hub/pairing-notices.js +38 -13
- package/dist/hub/pairing-notices.js.map +1 -1
- package/dist/hub/pairing.d.ts +10 -2
- 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 +60 -0
- package/dist/hub/protocol.js +9 -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 +18 -2
- 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 +29 -5
- 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/hub-pairing-summary.js +1 -1
- package/dist/hub-pairing-summary.js.map +1 -1
- package/dist/human-delivery-receipts.js +2 -2
- package/dist/human-delivery-receipts.js.map +1 -1
- package/dist/instance-config-impact.js +4 -0
- package/dist/instance-config-impact.js.map +1 -1
- package/dist/instance-lifecycle.d.ts +13 -1
- package/dist/instance-lifecycle.js +36 -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 +12 -8
- package/dist/locale.js.map +1 -1
- package/dist/log-service.d.ts +62 -6
- package/dist/log-service.js +135 -28
- package/dist/log-service.js.map +1 -1
- package/dist/log-steps-agy-grok.d.ts +74 -0
- package/dist/log-steps-agy-grok.js +440 -0
- package/dist/log-steps-agy-grok.js.map +1 -0
- package/dist/log-steps.d.ts +62 -3
- package/dist/log-steps.js +188 -22
- package/dist/log-steps.js.map +1 -1
- package/dist/log-transcript-paths.d.ts +29 -0
- package/dist/log-transcript-paths.js +109 -0
- package/dist/log-transcript-paths.js.map +1 -0
- package/dist/login-controller.d.ts +17 -3
- package/dist/login-controller.js +57 -5
- package/dist/login-controller.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/login-window-lock.d.ts +20 -8
- package/dist/login-window-lock.js +35 -16
- package/dist/login-window-lock.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.d.ts +14 -0
- package/dist/outbound-handlers.js +68 -20
- 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 +7 -0
- package/dist/profile-signins.js +2 -1
- 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/settings-api.d.ts +34 -0
- package/dist/settings-api.js +184 -6
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-change.js +38 -1
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-effect.js +14 -0
- package/dist/settings-effect.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-progress.d.ts +7 -0
- package/dist/tool-progress.js +21 -9
- package/dist/tool-progress.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/types.d.ts +13 -0
- package/dist/ui/accounts-keepalive.js +15 -6
- package/dist/ui/accounts-manage.js +25 -5
- package/dist/ui/accounts-view.js +40 -26
- package/dist/ui/agent-details-settings.js +2 -2
- package/dist/ui/agent-page-strings.js +2 -2
- package/dist/ui/agent-proposals.js +22 -2
- package/dist/ui/agent-runtime-settings.js +3 -3
- package/dist/ui/backend-signin.js +49 -16
- package/dist/ui/chat-activity-groups.js +225 -0
- package/dist/ui/chat-activity.js +355 -0
- package/dist/ui/chat-popout-header.js +35 -0
- package/dist/ui/chat-popout-transport.js +80 -0
- package/dist/ui/chat-popout.js +63 -0
- package/dist/ui/chat-quote.js +3 -1
- package/dist/ui/chat-store.js +45 -4
- package/dist/ui/chat-workspace-gestures.js +177 -0
- package/dist/ui/chat-workspace-navigation.js +34 -10
- package/dist/ui/chat-workspace.js +96 -32
- package/dist/ui/cli-caps.js +7 -7
- package/dist/ui/credential-profile-select.js +32 -19
- package/dist/ui/host-install.js +2 -2
- package/dist/ui/hub-agent-copy.js +7 -7
- package/dist/ui/hub-chat-store.js +8 -4
- package/dist/ui/hub-chat-strings.js +3 -3
- package/dist/ui/hub-client.js +113 -18
- package/dist/ui/hub-company-join-strings.js +12 -10
- package/dist/ui/hub-company-join.js +52 -39
- package/dist/ui/hub-confirm-place.js +44 -0
- package/dist/ui/hub-directory-editor-strings.js +3 -3
- package/dist/ui/hub-directory-notice-strings.js +1 -1
- package/dist/ui/hub-enrolment-code-strings.js +44 -0
- package/dist/ui/hub-enrolment-code.js +159 -0
- package/dist/ui/hub-grant-picker.js +100 -0
- package/dist/ui/hub-group-search.js +82 -0
- package/dist/ui/hub-group-strings.js +8 -8
- package/dist/ui/hub-join-approval.js +31 -0
- package/dist/ui/hub-join-code-input.js +66 -0
- package/dist/ui/hub-join-one-strings.js +2 -2
- package/dist/ui/hub-join-queue.js +62 -0
- package/dist/ui/hub-join-steps.js +234 -0
- package/dist/ui/hub-joincode-flow-strings.js +22 -0
- package/dist/ui/hub-owner-strings.js +9 -9
- package/dist/ui/hub-pairing-progress-strings.js +1 -1
- package/dist/ui/hub-quick-pairing.js +8 -4
- package/dist/ui/hub-quick-strings.js +11 -11
- package/dist/ui/hub-share-refused.js +17 -0
- package/dist/ui/hub-strings.js +61 -61
- package/dist/ui/hub-this-hub.js +2 -2
- package/dist/ui/hub-welcome.js +26 -5
- package/dist/ui/image-annotate.js +283 -0
- package/dist/ui/image-lightbox.js +26 -6
- package/dist/ui/log-row.js +327 -0
- package/dist/ui/machine-signin.js +47 -14
- package/dist/ui/panel-chat.js +151 -12
- package/dist/ui/panel-details.js +14 -6
- package/dist/ui/panel-fleet.js +2 -2
- package/dist/ui/panel-hub.js +94 -21
- package/dist/ui/panel-log.js +9 -154
- package/dist/ui/panel-settings.js +50 -13
- package/dist/ui/search-dialog.js +1 -0
- package/dist/ui/settings-access-overview.js +1 -1
- package/dist/ui/settings-hub-browser-certificate.js +3 -3
- package/dist/ui/settings-hub-company-join.js +42 -30
- package/dist/ui/settings-hub-connection.js +8 -5
- package/dist/ui/settings-hub-membership.js +3 -3
- package/dist/ui/settings-hub-section.js +3 -1
- package/dist/ui/settings-hub-setup-strings.js +6 -6
- package/dist/ui/settings-hub-setup.js +44 -6
- package/dist/ui/settings-hub-web-address.js +233 -0
- package/dist/ui/settings-hub.js +41 -10
- package/dist/ui/settings-layout.js +6 -4
- package/dist/ui/settings-public-session-strings.js +37 -0
- package/dist/ui/settings-registry.js +4 -0
- package/dist/ui/settings-strings.js +2 -2
- 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-shell.js +16 -10
- package/dist/ui/shared/app.css +233 -35
- package/dist/ui/shared/app.js +8 -1
- package/dist/ui/shared/chat-render.js +11 -2
- package/dist/ui/shared/chat-thread.js +20 -3
- package/dist/ui/shared/chat-work-bar.css +7 -0
- package/dist/ui/shared/chat-workspace-model.js +39 -9
- package/dist/ui/shared/hub-grant-picker.css +4 -0
- package/dist/ui/shared/hub-owner.css +8 -0
- package/dist/ui/shared/hub-sharing.css +4 -0
- package/dist/ui/shared/identity-color.js +9 -3
- package/dist/ui/shared/image-annotate.css +45 -0
- package/dist/ui/shared/instance-nav.js +59 -22
- package/dist/ui/shared/pane-geometry.js +29 -0
- package/dist/ui/shared/signin.js +2 -2
- package/dist/ui/shared/tokens.css +14 -0
- package/dist/ui/shared/ui-menu.js +22 -7
- package/dist/ui/shared/view-strings.js +2 -2
- package/dist/ui/signin.html +1 -1
- package/dist/ui/structured-signin.js +29 -9
- 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 +3 -0
- package/dist/web-api.js +61 -16
- package/dist/web-api.js.map +1 -1
- package/dist/web-backend-login.d.ts +13 -4
- package/dist/web-backend-login.js +7 -4
- package/dist/web-backend-login.js.map +1 -1
- package/dist/web-chat-history.d.ts +11 -0
- package/dist/web-chat-history.js +9 -1
- package/dist/web-chat-history.js.map +1 -1
- package/dist/web-guest-access.js +2 -2
- package/dist/web-guest-access.js.map +1 -1
- package/dist/web-session.d.ts +31 -3
- package/dist/web-session.js +25 -4
- package/dist/web-session.js.map +1 -1
- package/dist/web-settings-patch.d.ts +8 -2
- package/dist/web-settings-patch.js +22 -10
- package/dist/web-settings-patch.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
package/dist/hub/join/service.js
CHANGED
|
@@ -2,9 +2,9 @@ import { randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { HubProtocolError, hash, plain, uuid, person, token, validated, parseStrictJson } from "../validation.js";
|
|
4
4
|
import { canonicalArguments, personKeyString, sha256 } from "../identity.js";
|
|
5
|
-
import { HubGroupAuthorizationError } from "../group-policy/authorization.js";
|
|
5
|
+
import { HubCodeScopeRefusal, HubGroupAuthorizationError } from "../group-policy/authorization.js";
|
|
6
6
|
import { HubGroupEnrollmentRefusal } from "../group-policy/resources.js";
|
|
7
|
-
import { HubGroupPolicyError } from "../group-policy/store.js";
|
|
7
|
+
import { HubGroupPolicyError, HubGroupReadOverload } from "../group-policy/store.js";
|
|
8
8
|
import { HUB_SESSION_IDLE } from "../sessions.js";
|
|
9
9
|
import { readHubSessionEpoch } from "../session-epoch.js";
|
|
10
10
|
import { automaticFleetSlots, enrollmentThrottled, spendEnrollmentBudget } from "../enrollment-budget.js";
|
|
@@ -12,6 +12,8 @@ import { CompanyJoinRecords, companyInvitationRecord as invitationRecord } from
|
|
|
12
12
|
import { browserOriginProof, companyIdentityDigest, joinKeyThumbprint, joinPurpose, pkceChallenge, validateJoinBinding, verifierSchema, verifyJoinProof } from "./protocol.js";
|
|
13
13
|
import { createJoinSealer } from "./receipt.js";
|
|
14
14
|
import { verifyCompanyInvitation } from "./invitation.js";
|
|
15
|
+
import { HubEnrolmentCodes, enrolmentCreate } from "../enrolment-code.js";
|
|
16
|
+
import { parseStoredHubGroupResource } from "../group-policy/resources.js";
|
|
15
17
|
import { revokeHubFleet } from "../fleet-revocation.js";
|
|
16
18
|
export class CompanyJoinLimit extends HubProtocolError {
|
|
17
19
|
constructor() { super("backpressure"); }
|
|
@@ -20,28 +22,38 @@ export class CompanyJoinLimit extends HubProtocolError {
|
|
|
20
22
|
export class CompanyJoinOfferPending extends HubProtocolError {
|
|
21
23
|
constructor() { super("conflict"); }
|
|
22
24
|
}
|
|
25
|
+
export class CompanyJoinCodeRefusal extends HubProtocolError {
|
|
26
|
+
reason;
|
|
27
|
+
constructor(reason) {
|
|
28
|
+
super("denied");
|
|
29
|
+
this.reason = reason;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
23
32
|
const pushPayload = z.strictObject({ label: plain(120).refine(s => s.trim().length > 0), stateHash: hash,
|
|
24
|
-
invitation: z.string().max(8192).nullable(), supersedes: z.strictObject({ fleetId: uuid, credential: token }).optional() });
|
|
33
|
+
invitation: z.string().max(8192).nullable(), code: z.string().max(16).nullable().optional(), supersedes: z.strictObject({ fleetId: uuid, credential: token }).optional() });
|
|
25
34
|
const redeemPayload = z.strictObject({ verifier: verifierSchema });
|
|
26
35
|
const ackPayload = redeemPayload.extend({ credentialHash: hash, profileDigest: hash, journalCommitId: uuid });
|
|
27
36
|
export class HubCompanyJoin {
|
|
28
37
|
options;
|
|
29
38
|
records;
|
|
39
|
+
codes;
|
|
30
40
|
directoryEpoch;
|
|
31
41
|
sealer;
|
|
32
42
|
constructor(options) {
|
|
33
43
|
this.options = options;
|
|
34
44
|
this.directoryEpoch = readHubSessionEpoch(options.db);
|
|
35
45
|
this.records = new CompanyJoinRecords(options.db, () => this.now());
|
|
46
|
+
this.codes = new HubEnrolmentCodes({ db: options.db, home: options.home, hubId: options.identity.hubId, now: () => this.now(),
|
|
47
|
+
audit: (action, codeId, use, actor) => this.audit(action, use?.requestId ?? codeId, use?.owner ?? actor ?? this.options.administrator, use?.fleetId, codeId) });
|
|
36
48
|
}
|
|
37
49
|
now() { return this.options.now?.() ?? Date.now(); }
|
|
38
50
|
check() { if (!this.options.current() || readHubSessionEpoch(this.options.db) !== this.directoryEpoch)
|
|
39
51
|
throw new HubProtocolError("unavailable"); }
|
|
40
52
|
atomic(work) { this.check(); return this.options.db.transaction(() => { this.check(); const result = work(); this.check(); return result; }).immediate(); }
|
|
41
|
-
audit(action, requestId, owner, fleetId) {
|
|
53
|
+
audit(action, requestId, owner, fleetId, codeId) {
|
|
42
54
|
const result = this.options.audit.appendInTransaction({ id: randomUUID(), sequence: 0, policyVersion: this.options.store.read().revocationVersion,
|
|
43
55
|
at: this.now(), requestId, actor: owner ? { kind: "person", person: owner } : { kind: "local-host" },
|
|
44
|
-
action, result: "completed", ...(fleetId ? { fleetId } : {}) }, this.options.db);
|
|
56
|
+
action, result: "completed", ...(fleetId ? { fleetId } : {}), ...(codeId ? { codeId, reasonCode: "code" } : {}) }, this.options.db);
|
|
45
57
|
if (result && typeof result.then === "function") {
|
|
46
58
|
void Promise.resolve(result).catch(() => { });
|
|
47
59
|
throw new HubProtocolError("uncertain");
|
|
@@ -65,7 +77,7 @@ export class HubCompanyJoin {
|
|
|
65
77
|
this.check();
|
|
66
78
|
validated(uuid, id);
|
|
67
79
|
const row = this.options.db.prepare("SELECT source FROM hub_group_resources WHERE resource_key=?").get(JSON.stringify(["fleet", id, 1]));
|
|
68
|
-
const issued = this.options.db.prepare("SELECT at FROM hub_audit WHERE fleet_id=? AND action IN('pairing.claimed','company-join.group-approved','company-join.admin-approved') AND result='allowed' ORDER BY sequence LIMIT 1")
|
|
80
|
+
const issued = this.options.db.prepare("SELECT at FROM hub_audit WHERE fleet_id=? AND action IN('pairing.claimed','company-join.group-approved','company-join.admin-approved','company-join.code-approved') AND result='allowed' ORDER BY sequence LIMIT 1")
|
|
69
81
|
.get(id);
|
|
70
82
|
return { source: row?.source ?? null, createdAt: issued?.at ?? null };
|
|
71
83
|
}
|
|
@@ -73,16 +85,15 @@ export class HubCompanyJoin {
|
|
|
73
85
|
const control = this.control();
|
|
74
86
|
return { v: 1, hub: this.options.identity, identityDigest: companyIdentityDigest(this.options.identity),
|
|
75
87
|
certificatePem: this.options.certificatePem, ...(this.options.name ? { name: this.options.name } : {}),
|
|
76
|
-
features: control.enabled ? ["company-join-v1", "join-supersedes-v1", "member-leave-v1"] : [] };
|
|
88
|
+
features: control.enabled ? ["company-join-v1", "join-supersedes-v1", "member-leave-v1", "enrolment-code-v1"] : [] };
|
|
77
89
|
}
|
|
78
90
|
async configure(ctx, input) {
|
|
79
91
|
const body = validated(z.strictObject({ enabled: z.boolean(), expectedRevision: z.number().int().min(1) }), input);
|
|
80
|
-
await
|
|
81
|
-
if (ctx.isCurrent?.() !== true)
|
|
82
|
-
throw new HubProtocolError("revoked");
|
|
92
|
+
const admin = await this.codeAdmin(ctx);
|
|
83
93
|
if (body.enabled)
|
|
84
94
|
this.seal();
|
|
85
95
|
this.atomic(() => {
|
|
96
|
+
admin.assertCurrent();
|
|
86
97
|
const before = this.control();
|
|
87
98
|
if (before.revision !== body.expectedRevision)
|
|
88
99
|
throw new HubProtocolError("conflict");
|
|
@@ -95,9 +106,8 @@ export class HubCompanyJoin {
|
|
|
95
106
|
for (const { id } of rows)
|
|
96
107
|
this.end(this.records.get(id), "disabled");
|
|
97
108
|
}
|
|
98
|
-
this.audit("company-join.configured", ctx.requestId,
|
|
99
|
-
|
|
100
|
-
throw new HubProtocolError("revoked");
|
|
109
|
+
this.audit("company-join.configured", ctx.requestId, admin.person);
|
|
110
|
+
admin.assertCurrent();
|
|
101
111
|
});
|
|
102
112
|
return this.adminView();
|
|
103
113
|
}
|
|
@@ -119,7 +129,6 @@ export class HubCompanyJoin {
|
|
|
119
129
|
const row = this.readInvitation(r.invitationId);
|
|
120
130
|
if (row.requestId !== r.binding.requestId || row.consumed !== (r.issuedHash !== null)
|
|
121
131
|
|| !r.approvedBy || personKeyString(row.claims.approvedBy) !== personKeyString(r.approvedBy)
|
|
122
|
-
|| personKeyString(row.claims.approvedBy) !== personKeyString(this.options.administrator)
|
|
123
132
|
|| r.owner && personKeyString(row.claims.owner) !== personKeyString(r.owner)
|
|
124
133
|
|| companyIdentityDigest(row.claims.hub) !== companyIdentityDigest(r.binding.hub))
|
|
125
134
|
throw new HubProtocolError("denied");
|
|
@@ -127,16 +136,15 @@ export class HubCompanyJoin {
|
|
|
127
136
|
}
|
|
128
137
|
async createInvitation(ctx, input) {
|
|
129
138
|
this.enabled();
|
|
130
|
-
const
|
|
131
|
-
if (admin.kind !== "directory" || personKeyString(admin.person) !== personKeyString(this.options.administrator) || ctx.isCurrent?.() !== true)
|
|
132
|
-
throw new HubProtocolError("denied");
|
|
139
|
+
const owner = validated(person, input), admin = await this.codeAdmin(ctx, true);
|
|
133
140
|
const now = this.now(), claims = { v: 2, id: randomUUID(), hub: this.options.identity, owner,
|
|
134
141
|
approvedBy: admin.person, nonce: randomBytes(32).toString("hex"), createdAt: now, expiresAt: now + 600_000 };
|
|
135
142
|
const invitation = this.options.signInvitation(claims);
|
|
136
143
|
if (canonicalArguments(verifyCompanyInvitation(invitation, now)) !== canonicalArguments(claims))
|
|
137
144
|
throw new HubProtocolError("uncertain");
|
|
138
145
|
this.atomic(() => {
|
|
139
|
-
|
|
146
|
+
admin.assertCurrent();
|
|
147
|
+
if (!this.control().enabled)
|
|
140
148
|
throw new HubProtocolError("revoked");
|
|
141
149
|
const pending = this.options.store.read().pairings.filter(p => p.expiresAt > this.now()).length;
|
|
142
150
|
if (pending + this.retained() >= 64)
|
|
@@ -147,11 +155,92 @@ export class HubCompanyJoin {
|
|
|
147
155
|
throw new HubProtocolError("backpressure");
|
|
148
156
|
this.options.db.prepare("INSERT INTO hub_company_join_invites VALUES(?,?)").run(claims.id, canonicalArguments({ claims, digest: sha256(invitation), requestId: null, consumed: false }));
|
|
149
157
|
this.audit("company-join.invitation-issued", ctx.requestId, admin.person);
|
|
150
|
-
|
|
151
|
-
throw new HubProtocolError("revoked");
|
|
158
|
+
admin.assertCurrent();
|
|
152
159
|
});
|
|
153
160
|
return { invitation, url: this.options.identity.webOrigin + "/join-info#invite=" + invitation, expiresAt: claims.expiresAt };
|
|
154
161
|
}
|
|
162
|
+
async codeAdmin(ctx, creating = false) {
|
|
163
|
+
this.check();
|
|
164
|
+
if (creating)
|
|
165
|
+
this.enabled();
|
|
166
|
+
const permit = this.options.management ? await this.options.management.require(ctx, "join.manage") : null;
|
|
167
|
+
const actor = permit?.actor ?? await ctx.requireAdmin(), caller = ctx.isCurrent?.bind(ctx);
|
|
168
|
+
if (actor.kind !== "directory" || !permit && personKeyString(actor.person) !== personKeyString(this.options.administrator))
|
|
169
|
+
throw new HubProtocolError("denied");
|
|
170
|
+
const assertCurrent = () => { this.check(); permit?.assertCurrent(); if (caller?.() !== true)
|
|
171
|
+
throw new HubProtocolError("revoked"); };
|
|
172
|
+
assertCurrent();
|
|
173
|
+
return Object.freeze({ ...actor, person: Object.freeze({ ...actor.person }), assertCurrent });
|
|
174
|
+
}
|
|
175
|
+
async createCode(ctx, input) {
|
|
176
|
+
const actor = await this.codeAdmin(ctx, true), body = validated(enrolmentCreate, input), revision = this.control().revision;
|
|
177
|
+
const scopeProof = await this.options.groups.validateCodeScope(body.scope, { requestId: ctx.requestId, current: () => { actor.assertCurrent(); return true; } }, actor.person);
|
|
178
|
+
actor.assertCurrent();
|
|
179
|
+
return this.atomic(() => {
|
|
180
|
+
actor.assertCurrent();
|
|
181
|
+
scopeProof.assertCurrent();
|
|
182
|
+
if (!this.control().enabled || this.control().revision !== revision)
|
|
183
|
+
throw new HubProtocolError("revoked");
|
|
184
|
+
const result = { ...this.codes.create(actor.person, body), freeFleetRows: Math.max(0, 256 - this.options.store.read().fleets.length) };
|
|
185
|
+
actor.assertCurrent();
|
|
186
|
+
scopeProof.assertCurrent();
|
|
187
|
+
if (!this.control().enabled || this.control().revision !== revision)
|
|
188
|
+
throw new HubProtocolError("revoked");
|
|
189
|
+
return result;
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
async listCodes(ctx) {
|
|
193
|
+
const actor = await this.codeAdmin(ctx);
|
|
194
|
+
return this.atomic(() => {
|
|
195
|
+
actor.assertCurrent();
|
|
196
|
+
this.maintainCodes();
|
|
197
|
+
const codes = this.codes.list().map(code => {
|
|
198
|
+
// Display all unissued joins, including people who have not signed in yet. Quota reservations stay separate.
|
|
199
|
+
const inFlight = this.options.db.prepare("SELECT id FROM hub_company_join_requests WHERE json_extract(body,'$.enrolmentCodeId')=? AND stage IN('pending','identity-approved') AND outer_deadline>?")
|
|
200
|
+
.all(code.id, this.now()).map(row => this.records.get(row.id)).filter(r => !r.issuedHash);
|
|
201
|
+
return { ...code, inFlight: inFlight.length, inFlightLabels: inFlight.slice(0, 3).map(r => r.label),
|
|
202
|
+
recent: this.options.db.prepare("SELECT u.fleet_id,u.owner,u.at FROM hub_enrolment_code_uses u WHERE code_id=? ORDER BY at DESC,rowid DESC LIMIT 50").all(code.id).map(use => {
|
|
203
|
+
const person = this.options.db.prepare("SELECT display_name,login_label FROM hub_people WHERE person=?").get(use.owner);
|
|
204
|
+
const fleet = this.options.store.read().fleets.find(f => f.id === use.fleet_id);
|
|
205
|
+
return { label: fleet?.label ?? "", owner: { name: person?.display_name ?? "", login: person?.login_label ?? "" }, at: use.at };
|
|
206
|
+
}) };
|
|
207
|
+
});
|
|
208
|
+
actor.assertCurrent();
|
|
209
|
+
return { codes };
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
async revokeCode(ctx, id) {
|
|
213
|
+
const actor = await this.codeAdmin(ctx);
|
|
214
|
+
this.atomic(() => {
|
|
215
|
+
actor.assertCurrent();
|
|
216
|
+
this.codes.revoke(id, actor.person);
|
|
217
|
+
const rows = this.options.db.prepare("SELECT id FROM hub_company_join_requests WHERE json_extract(body,'$.enrolmentCodeId')=? AND stage IN('pending','identity-approved')").all(id);
|
|
218
|
+
for (const row of rows)
|
|
219
|
+
this.endCode(this.records.get(row.id));
|
|
220
|
+
actor.assertCurrent();
|
|
221
|
+
});
|
|
222
|
+
return (await this.listCodes(ctx)).codes.find(code => code.id === id);
|
|
223
|
+
}
|
|
224
|
+
maintainCodes() {
|
|
225
|
+
this.atomic(() => {
|
|
226
|
+
this.codes.maintain();
|
|
227
|
+
const rows = this.options.db.prepare("SELECT id FROM hub_company_join_requests WHERE stage IN('pending','identity-approved') AND json_extract(body,'$.enrolmentCodeId') IS NOT NULL").all();
|
|
228
|
+
for (const { id } of rows) {
|
|
229
|
+
const r = this.records.get(id);
|
|
230
|
+
const row = this.options.db.prepare("SELECT id FROM hub_enrolment_codes WHERE id=?").get(r.enrolmentCodeId);
|
|
231
|
+
if (r.outerDeadline <= this.now() || r.stage === "identity-approved" && (r.redeemDeadline === null || r.redeemDeadline <= this.now()))
|
|
232
|
+
this.end(r, "expired");
|
|
233
|
+
else if (!row || this.codes.state(this.codes.get(r.enrolmentCodeId)) !== "live")
|
|
234
|
+
this.endCode(r);
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
codeReservations(id, except) {
|
|
239
|
+
return this.options.db.prepare("SELECT count(*) n FROM hub_company_join_requests r WHERE json_extract(body,'$.enrolmentCodeId')=? AND stage='identity-approved' AND outer_deadline>? AND json_extract(body,'$.redeemDeadline')>? AND id<>? AND NOT EXISTS(SELECT 1 FROM hub_enrolment_code_uses u WHERE u.request_id=r.id)")
|
|
240
|
+
.get(id, this.now(), this.now(), except ?? "").n;
|
|
241
|
+
}
|
|
242
|
+
codeGrant(c) { return { codeId: c.id, approvedBy: c.createdBy, scope: c.scope, perPersonFleets: c.perPersonFleets }; }
|
|
243
|
+
source(r) { return r.enrolmentCodeId ? "code" : r.invitationId ? "manual" : "group"; }
|
|
155
244
|
enabled() { if (!this.control().enabled)
|
|
156
245
|
throw new HubProtocolError("denied"); }
|
|
157
246
|
/** Called only inside the group-policy update's owning transaction; never reads the directory. */
|
|
@@ -162,7 +251,7 @@ export class HubCompanyJoin {
|
|
|
162
251
|
const rows = this.options.db.prepare("SELECT id FROM hub_company_join_requests WHERE stage IN('identity-approved','issued')").all();
|
|
163
252
|
for (const { id } of rows) {
|
|
164
253
|
const r = this.records.get(id);
|
|
165
|
-
if (r.owner && (denied.has(personKeyString(r.owner)) || !r.invitationId && policy.state !== "enabled")) {
|
|
254
|
+
if (r.owner && (denied.has(personKeyString(r.owner)) || !r.invitationId && !r.enrolmentCodeId && policy.state !== "enabled")) {
|
|
166
255
|
this.end(r, "authority");
|
|
167
256
|
this.audit("company-join.policy-cancelled", id, r.owner);
|
|
168
257
|
}
|
|
@@ -203,17 +292,36 @@ export class HubCompanyJoin {
|
|
|
203
292
|
push(binding, input, proof) {
|
|
204
293
|
this.enabled();
|
|
205
294
|
const b = this.bound(binding), p = validated(pushPayload, input);
|
|
295
|
+
if (p.code != null && p.invitation !== null)
|
|
296
|
+
throw new HubProtocolError("invalid");
|
|
206
297
|
this.consume(b, "push", proof, p);
|
|
298
|
+
let code = null;
|
|
299
|
+
if (p.code != null) {
|
|
300
|
+
const now = this.now();
|
|
301
|
+
if (enrollmentThrottled(this.options.store.read(), "code:invalid", 11, now))
|
|
302
|
+
throw new HubProtocolError("denied");
|
|
303
|
+
this.maintainCodes();
|
|
304
|
+
try {
|
|
305
|
+
code = this.codes.lookup(p.code);
|
|
306
|
+
}
|
|
307
|
+
catch (error) {
|
|
308
|
+
if (!(error instanceof HubProtocolError) || error.code !== "denied")
|
|
309
|
+
throw new HubProtocolError("unavailable");
|
|
310
|
+
this.atomic(() => this.options.store.mutate({ at: now, requestId: b.requestId, actor: { kind: "member", fleetId: b.fleetId }, action: "enrolment-code.refused", result: "denied" }, state => { spendEnrollmentBudget(state, "code:invalid", 11, now); }));
|
|
311
|
+
throw new HubProtocolError("denied");
|
|
312
|
+
}
|
|
313
|
+
}
|
|
207
314
|
const invite = p.invitation ? verifyCompanyInvitation(p.invitation, this.now()) : null;
|
|
208
|
-
if (invite &&
|
|
209
|
-
|| personKeyString(invite.approvedBy) !== personKeyString(this.options.administrator)))
|
|
315
|
+
if (invite && companyIdentityDigest(invite.hub) !== companyIdentityDigest(b.hub))
|
|
210
316
|
throw new HubProtocolError("denied");
|
|
211
317
|
const now = invite?.createdAt ?? this.now(), outerDeadline = now + 600_000;
|
|
212
318
|
const record = { v: 1, binding: b, version: 1, label: p.label, stateHash: p.stateHash, stage: "pending", createdAt: now,
|
|
213
319
|
outerDeadline, retainUntil: Math.max(outerDeadline, now + this.options.eventDays * 86_400_000), browserHash: null, browserOrigin: null,
|
|
214
320
|
owner: null, sessionId: null, approvedAt: null, redeemDeadline: null, deliveryDeadline: null, issuedHash: null,
|
|
215
|
-
reason: null, delivery: null, receipt: null, invitationId: invite?.id ?? null, approvedBy: invite?.approvedBy ?? null, supersedesFleetId: null };
|
|
321
|
+
reason: null, delivery: null, receipt: null, invitationId: invite?.id ?? null, approvedBy: code?.createdBy ?? invite?.approvedBy ?? null, supersedesFleetId: null, enrolmentCodeId: code?.id ?? null };
|
|
216
322
|
this.atomic(() => {
|
|
323
|
+
if (code)
|
|
324
|
+
this.codes.live(code.id);
|
|
217
325
|
if (p.supersedes) {
|
|
218
326
|
const old = this.options.store.read().fleets.find(f => f.id === p.supersedes.fleetId);
|
|
219
327
|
if (old?.status === "active" && old.credentialHash === sha256(p.supersedes.credential)
|
|
@@ -281,6 +389,10 @@ export class HubCompanyJoin {
|
|
|
281
389
|
return this.options.current() && this.control().enabled && this.records.current(r) && this.session(r) && this.now() < r.outerDeadline;
|
|
282
390
|
}
|
|
283
391
|
groupError(error) {
|
|
392
|
+
if (error instanceof HubGroupReadOverload)
|
|
393
|
+
throw new HubProtocolError("backpressure");
|
|
394
|
+
if (error instanceof HubCodeScopeRefusal)
|
|
395
|
+
throw new CompanyJoinCodeRefusal("code-scope");
|
|
284
396
|
if (error instanceof HubGroupAuthorizationError && error.reason === "denied"
|
|
285
397
|
|| error instanceof HubGroupEnrollmentRefusal && error.outcome === "denied")
|
|
286
398
|
throw new HubProtocolError("denied");
|
|
@@ -297,9 +409,23 @@ export class HubCompanyJoin {
|
|
|
297
409
|
}
|
|
298
410
|
async approve(ctx, cookie, requestId) {
|
|
299
411
|
this.enabled();
|
|
300
|
-
|
|
301
|
-
|
|
412
|
+
let r = this.browser(cookie, requestId);
|
|
413
|
+
const actor = await ctx.current();
|
|
414
|
+
if (actor.kind !== "directory" || ctx.isCurrent?.() !== true || !this.records.current(r))
|
|
415
|
+
throw new HubProtocolError("conflict");
|
|
416
|
+
if (r.stage !== "pending") {
|
|
417
|
+
// An authenticated browser may have been open before normal revocation/expiry retired its unissued request.
|
|
418
|
+
// This is feedback only: issued results and unrelated retirement keep the ordinary conflict/recovery path.
|
|
419
|
+
if (r.enrolmentCodeId && !r.issuedHash && r.stage === "ended" && this.codes.state(this.codes.get(r.enrolmentCodeId)) !== "live")
|
|
420
|
+
throw new CompanyJoinCodeRefusal("code-ended");
|
|
302
421
|
throw new HubProtocolError("conflict");
|
|
422
|
+
}
|
|
423
|
+
if (r.enrolmentCodeId) {
|
|
424
|
+
this.maintainCodes();
|
|
425
|
+
r = this.browser(cookie, requestId);
|
|
426
|
+
if (r.stage !== "pending")
|
|
427
|
+
throw new CompanyJoinCodeRefusal("code-ended");
|
|
428
|
+
}
|
|
303
429
|
try {
|
|
304
430
|
return await this.admit(ctx, r, actor);
|
|
305
431
|
}
|
|
@@ -320,44 +446,51 @@ export class HubCompanyJoin {
|
|
|
320
446
|
}
|
|
321
447
|
}
|
|
322
448
|
async admit(ctx, r, actor) {
|
|
449
|
+
this.maintainCodes();
|
|
323
450
|
const owner = validated(person, actor.person), key = personKeyString(owner), now = this.now(), invitation = this.invitation(r);
|
|
324
451
|
if (invitation && personKeyString(invitation.claims.owner) !== key)
|
|
325
452
|
throw new HubProtocolError("denied");
|
|
326
453
|
let expected = r;
|
|
327
454
|
const live = () => ctx.isCurrent?.() === true && this.options.current() && this.control().enabled && this.records.current(expected) && this.now() < r.outerDeadline;
|
|
328
|
-
const initial = this.options.store.read();
|
|
329
|
-
|
|
455
|
+
const initial = this.options.store.read(), code = r.enrolmentCodeId ? this.codes.live(r.enrolmentCodeId) : null;
|
|
456
|
+
const buckets = code ? [[`code:${code.id}`, 120], ["code:all", 120]] : [["quick:all", 48]];
|
|
457
|
+
if (enrollmentThrottled(initial, `quick:${key}`, 5, now) || buckets.some(([key, max]) => enrollmentThrottled(initial, key, max, now)))
|
|
330
458
|
throw new HubProtocolError("backpressure");
|
|
331
459
|
this.atomic(() => this.options.store.mutate({ at: now, requestId: ctx.requestId, actor: { kind: "person", person: owner }, action: "company-join.admission", result: "allowed" }, state => {
|
|
332
460
|
if (!live())
|
|
333
461
|
throw new HubProtocolError("revoked");
|
|
334
|
-
if (!spendEnrollmentBudget(state, `quick:${key}`, 5, now) || !spendEnrollmentBudget(state,
|
|
462
|
+
if (!spendEnrollmentBudget(state, `quick:${key}`, 5, now) || buckets.some(([key, max]) => !spendEnrollmentBudget(state, key, max, now)))
|
|
335
463
|
throw new HubProtocolError("backpressure");
|
|
336
464
|
}));
|
|
337
465
|
let permit, eligibility;
|
|
338
466
|
try {
|
|
339
467
|
const resource = { kind: "fleet", id: r.binding.fleetId, revision: 1, owner }, context = { requestId: ctx.requestId, current: live };
|
|
340
468
|
eligibility = await this.options.groups.prepareOwnerEligibility(owner, context);
|
|
341
|
-
permit = invitation ? await this.options.groups.prepareManualEnrollment(resource, invitation.claims.approvedBy, context) : await this.options.groups.prepareEnrollment(resource, context);
|
|
469
|
+
permit = code ? await this.options.groups.prepareCodeEnrollment(resource, this.codeGrant(code), context) : invitation ? await this.options.groups.prepareManualEnrollment(resource, invitation.claims.approvedBy, context) : await this.options.groups.prepareEnrollment(resource, context);
|
|
342
470
|
}
|
|
343
471
|
catch (error) {
|
|
344
472
|
if (!live())
|
|
345
473
|
throw new HubProtocolError("revoked");
|
|
346
474
|
return this.groupError(error);
|
|
347
475
|
}
|
|
348
|
-
if (permit.source !== (r
|
|
476
|
+
if (permit.source !== this.source(r) || !r.invitationId && permit.maxFleets < 1)
|
|
349
477
|
throw new HubProtocolError("denied");
|
|
350
478
|
this.atomic(() => {
|
|
351
479
|
eligibility.assertCurrent();
|
|
352
480
|
permit.assertCurrent();
|
|
353
481
|
if (!live())
|
|
354
482
|
throw new HubProtocolError("revoked");
|
|
483
|
+
if (code) {
|
|
484
|
+
const current = this.codes.assertDefinition(code);
|
|
485
|
+
if (current.uses + this.codeReservations(code.id, r.binding.requestId) >= current.maxUses)
|
|
486
|
+
throw new HubProtocolError("denied");
|
|
487
|
+
}
|
|
355
488
|
const transport = this.options.store.read();
|
|
356
489
|
const old = this.superseded(r, transport, owner);
|
|
357
490
|
if (!invitation && (transport.pairings.some(p => p.expiresAt > this.now() && personKeyString(p.owner) === key && ["offered", "pending"].includes(p.state))
|
|
358
491
|
|| this.records.reservations(owner) > 0))
|
|
359
492
|
throw new CompanyJoinOfferPending();
|
|
360
|
-
if (!invitation && transport.pairings.filter(p => p.expiresAt > this.now()).length + this.retained() >= 48)
|
|
493
|
+
if (!invitation && (code ? this.records.retained(true) >= 256 : transport.pairings.filter(p => p.expiresAt > this.now()).length + this.retained() >= 48))
|
|
361
494
|
throw new HubProtocolError("backpressure");
|
|
362
495
|
if (!invitation && automaticFleetSlots(transport, owner, this.now(), this.records.reservations(owner)) - Number(!!old) >= permit.maxFleets)
|
|
363
496
|
throw new CompanyJoinLimit();
|
|
@@ -365,7 +498,12 @@ export class HubCompanyJoin {
|
|
|
365
498
|
expected = { ...r, owner, sessionId: actor.sessionId, approvedAt: at, redeemDeadline: Math.min(at + 60_000, r.outerDeadline),
|
|
366
499
|
stage: "identity-approved", reason: null, version: r.version + 1 };
|
|
367
500
|
this.records.save(expected, r.version);
|
|
368
|
-
this.audit("company-join.identity-approved", ctx.requestId, owner);
|
|
501
|
+
this.audit("company-join.identity-approved", ctx.requestId, owner, undefined, r.enrolmentCodeId ?? undefined);
|
|
502
|
+
if (code) {
|
|
503
|
+
const current = this.codes.assertDefinition(code);
|
|
504
|
+
if (current.uses + this.codeReservations(code.id) > current.maxUses)
|
|
505
|
+
throw new HubProtocolError("revoked");
|
|
506
|
+
}
|
|
369
507
|
eligibility.assertCurrent();
|
|
370
508
|
permit.assertCurrent();
|
|
371
509
|
if (ctx.isCurrent?.() !== true)
|
|
@@ -378,6 +516,13 @@ export class HubCompanyJoin {
|
|
|
378
516
|
this.records.save(next, r.version);
|
|
379
517
|
return next;
|
|
380
518
|
}
|
|
519
|
+
endCode(r) {
|
|
520
|
+
if (!r.enrolmentCodeId || r.issuedHash || !["pending", "identity-approved"].includes(r.stage))
|
|
521
|
+
throw new HubProtocolError("uncertain");
|
|
522
|
+
// Keep the durable v3 vocabulary readable by older servers. The exact ended/unissued/code tuple projects
|
|
523
|
+
// this denied approval as code-ended; ordinary authority loss and already-issued recovery are untouched.
|
|
524
|
+
this.end(r, "denied");
|
|
525
|
+
}
|
|
381
526
|
expire(input) {
|
|
382
527
|
if (input.issuedHash && input.stage !== "revoked") {
|
|
383
528
|
const fleet = this.options.store.read().fleets.find(f => f.id === input.binding.fleetId);
|
|
@@ -408,7 +553,8 @@ export class HubCompanyJoin {
|
|
|
408
553
|
});
|
|
409
554
|
}
|
|
410
555
|
view(r) {
|
|
411
|
-
|
|
556
|
+
const reason = r.stage === "ended" && r.enrolmentCodeId && !r.issuedHash && r.reason === "denied" ? "code-ended" : r.reason;
|
|
557
|
+
return { state: r.stage, reason, issued: r.issuedHash !== null, fleetId: r.issuedHash ? r.binding.fleetId : null,
|
|
412
558
|
generation: r.issuedHash ? 1 : null, outerDeadline: r.outerDeadline, redeemDeadline: r.redeemDeadline, deliveryDeadline: r.deliveryDeadline };
|
|
413
559
|
}
|
|
414
560
|
status(binding, proof, payload, purpose = "status") {
|
|
@@ -439,9 +585,17 @@ export class HubCompanyJoin {
|
|
|
439
585
|
provenance(r) {
|
|
440
586
|
const resource = this.resource(r), raw = this.options.db.prepare("SELECT body,source,state,revision FROM hub_group_resources WHERE resource_key=?")
|
|
441
587
|
.get(JSON.stringify(["fleet", resource.id, 1]));
|
|
442
|
-
if (!raw || raw.state !== "active" || raw.source !== (r
|
|
443
|
-
|| canonicalArguments(parseStrictJson(raw.body)) !== canonicalArguments(resource))
|
|
588
|
+
if (!raw || raw.state !== "active" || raw.source !== this.source(r) || raw.revision < 1
|
|
589
|
+
|| canonicalArguments(parseStoredHubGroupResource(parseStrictJson(raw.body), raw.source).resource) !== canonicalArguments(resource))
|
|
444
590
|
throw new HubProtocolError("denied");
|
|
591
|
+
if (r.enrolmentCodeId) {
|
|
592
|
+
const code = parseStoredHubGroupResource(parseStrictJson(raw.body), raw.source).code;
|
|
593
|
+
if (!code || code.codeId !== r.enrolmentCodeId || !r.approvedBy || personKeyString(code.approvedBy) !== personKeyString(r.approvedBy))
|
|
594
|
+
throw new HubProtocolError("denied");
|
|
595
|
+
const use = this.options.db.prepare("SELECT code_id,fleet_id,owner FROM hub_enrolment_code_uses WHERE request_id=?").get(r.binding.requestId);
|
|
596
|
+
if (!use || use.code_id !== r.enrolmentCodeId || use.fleet_id !== r.binding.fleetId || use.owner !== personKeyString(r.owner))
|
|
597
|
+
throw new HubProtocolError("denied");
|
|
598
|
+
}
|
|
445
599
|
const events = this.options.db.prepare("SELECT body FROM hub_group_resource_events WHERE json_extract(body,'$.resource.kind')='fleet' AND json_extract(body,'$.resource.id')=? AND json_extract(body,'$.resource.revision')=1 ORDER BY rowid LIMIT 257")
|
|
446
600
|
.all(resource.id);
|
|
447
601
|
if (!events.length || events.length > 256)
|
|
@@ -484,7 +638,7 @@ export class HubCompanyJoin {
|
|
|
484
638
|
}
|
|
485
639
|
return this.groupError(error);
|
|
486
640
|
}
|
|
487
|
-
if (permit.source !== (r
|
|
641
|
+
if (permit.source !== this.source(r))
|
|
488
642
|
throw new HubProtocolError("denied");
|
|
489
643
|
permit.assertCurrent();
|
|
490
644
|
this.assertIssued(r);
|
|
@@ -508,6 +662,8 @@ export class HubCompanyJoin {
|
|
|
508
662
|
this.consume(b, "redeem", proof, p);
|
|
509
663
|
if (pkceChallenge(p.verifier) !== b.verifierS256)
|
|
510
664
|
throw new HubProtocolError("denied");
|
|
665
|
+
if (this.exact(b).enrolmentCodeId)
|
|
666
|
+
this.maintainCodes();
|
|
511
667
|
let expected = this.expire(this.exact(b));
|
|
512
668
|
if (expected.stage === "issued")
|
|
513
669
|
return this.reveal(expected); // SAME result, never enrollment
|
|
@@ -519,10 +675,11 @@ export class HubCompanyJoin {
|
|
|
519
675
|
throw new HubProtocolError("revoked");
|
|
520
676
|
const sealer = this.seal();
|
|
521
677
|
let permit, eligibility;
|
|
678
|
+
const code = expected.enrolmentCodeId ? this.codes.live(expected.enrolmentCodeId) : null;
|
|
522
679
|
try {
|
|
523
680
|
const invitation = this.invitation(expected), context = { requestId: b.requestId, current: live };
|
|
524
681
|
eligibility = await this.options.groups.prepareOwnerEligibility(owner, context);
|
|
525
|
-
permit = invitation ? await this.options.groups.prepareManualEnrollment(this.resource(expected), invitation.claims.approvedBy, context)
|
|
682
|
+
permit = code ? await this.options.groups.prepareCodeEnrollment(this.resource(expected), this.codeGrant(code), context) : invitation ? await this.options.groups.prepareManualEnrollment(this.resource(expected), invitation.claims.approvedBy, context)
|
|
526
683
|
: await this.options.groups.prepareEnrollment(this.resource(expected), context);
|
|
527
684
|
}
|
|
528
685
|
catch (error) {
|
|
@@ -530,17 +687,28 @@ export class HubCompanyJoin {
|
|
|
530
687
|
throw new HubProtocolError("revoked");
|
|
531
688
|
return this.groupError(error);
|
|
532
689
|
}
|
|
533
|
-
if (permit.source !== (expected
|
|
690
|
+
if (permit.source !== this.source(expected) || !expected.invitationId && permit.maxFleets < 1)
|
|
534
691
|
throw new HubProtocolError("denied");
|
|
535
692
|
const credential = randomBytes(32).toString("hex"), issuedHash = sha256(credential);
|
|
536
|
-
let replaced = false;
|
|
693
|
+
let replaced = false, consumedCode = null;
|
|
694
|
+
const finalCode = () => { if (consumedCode)
|
|
695
|
+
this.codes.assertConsumed(consumedCode, { requestId: b.requestId, fleetId: b.fleetId, owner }); };
|
|
537
696
|
this.atomic(() => {
|
|
697
|
+
eligibility.assertCurrent();
|
|
698
|
+
permit.assertCurrent();
|
|
699
|
+
if (!live())
|
|
700
|
+
throw new HubProtocolError("revoked");
|
|
701
|
+
// A last-use/revoke refusal occurs before the transport's independent floor advances.
|
|
702
|
+
if (code) {
|
|
703
|
+
consumedCode = this.codes.assertDefinition(code);
|
|
704
|
+
this.codes.consume(consumedCode, { requestId: b.requestId, fleetId: b.fleetId, owner });
|
|
705
|
+
}
|
|
538
706
|
eligibility.assertCurrent();
|
|
539
707
|
permit.assertCurrent();
|
|
540
708
|
if (!live())
|
|
541
709
|
throw new HubProtocolError("revoked");
|
|
542
710
|
this.options.store.mutate({ at: this.now(), requestId: b.requestId, actor: { kind: "person", person: owner },
|
|
543
|
-
fleetId: b.fleetId, action: expected.invitationId ? "company-join.admin-approved" : "company-join.group-approved", result: "allowed" }, state => {
|
|
711
|
+
fleetId: b.fleetId, action: expected.enrolmentCodeId ? "company-join.code-approved" : expected.invitationId ? "company-join.admin-approved" : "company-join.group-approved", result: "allowed", ...(expected.enrolmentCodeId ? { codeId: expected.enrolmentCodeId, reasonCode: "code" } : {}) }, state => {
|
|
544
712
|
if (!live())
|
|
545
713
|
throw new HubProtocolError("revoked");
|
|
546
714
|
const old = this.superseded(expected, state, owner);
|
|
@@ -549,7 +717,8 @@ export class HubCompanyJoin {
|
|
|
549
717
|
if (state.fleets.length >= 256 || state.fleets.some(f => f.id === b.fleetId))
|
|
550
718
|
throw new HubProtocolError("backpressure");
|
|
551
719
|
state.fleets.push({ id: b.fleetId, owner, credentialHash: issuedHash, generation: 1, status: "active", label: expected.label });
|
|
552
|
-
});
|
|
720
|
+
}, () => { eligibility.assertCurrent(); permit.assertCurrent(); if (!live())
|
|
721
|
+
throw new HubProtocolError("revoked"); finalCode(); });
|
|
553
722
|
permit.commit(this.options.db);
|
|
554
723
|
const source = this.provenance({ ...expected, owner });
|
|
555
724
|
const issuedAt = this.now(), deliveryDeadline = Math.min(issuedAt + 120_000, expected.outerDeadline);
|
|
@@ -560,7 +729,7 @@ export class HubCompanyJoin {
|
|
|
560
729
|
const receipt = sealer.seal(delivery, credential);
|
|
561
730
|
this.options.db.prepare("INSERT INTO hub_company_join_cipher_nonces VALUES(?,?)").run(receipt.keyId, receipt.nonce);
|
|
562
731
|
this.options.notices.enqueue(this.options.db, { fleetId: b.fleetId, generation: 1, owner, label: expected.label,
|
|
563
|
-
at: issuedAt, initiatingSessionId: expected.sessionId, source: source.source }, { ...this.options.store.read(),
|
|
732
|
+
at: issuedAt, initiatingSessionId: expected.sessionId, ...(source.source === "code" ? { source: "code", codeId: expected.enrolmentCodeId } : { source: source.source }) }, { ...this.options.store.read(),
|
|
564
733
|
fleets: this.options.store.read().fleets.filter(f => f.id !== expected.supersedesFleetId) });
|
|
565
734
|
const next = { ...expected, stage: "issued", delivery, receipt, issuedHash, deliveryDeadline, version: expected.version + 1 };
|
|
566
735
|
if (expected.invitationId) {
|
|
@@ -575,6 +744,7 @@ export class HubCompanyJoin {
|
|
|
575
744
|
eligibility.assertCurrent();
|
|
576
745
|
permit.assertCurrent();
|
|
577
746
|
this.assertIssued(expected);
|
|
747
|
+
finalCode();
|
|
578
748
|
// The permit binds the previous global version. Finish it before advancing revocation, in this SAME root transaction.
|
|
579
749
|
const old = this.superseded(expected, this.options.store.read(), owner);
|
|
580
750
|
if (old) {
|
|
@@ -584,7 +754,7 @@ export class HubCompanyJoin {
|
|
|
584
754
|
if (!current || current.generation !== old.generation || current.credentialHash !== old.credentialHash)
|
|
585
755
|
throw new HubProtocolError("revoked");
|
|
586
756
|
revokeHubFleet(state, current);
|
|
587
|
-
}, () => { eligibility.assertCurrent(); permit.assertCurrent(); this.assertIssued(expected); });
|
|
757
|
+
}, () => { eligibility.assertCurrent(); permit.assertCurrent(); this.assertIssued(expected); finalCode(); });
|
|
588
758
|
replaced = true;
|
|
589
759
|
}
|
|
590
760
|
});
|