@songsid/agend 2.4.0-alpha.2 → 2.4.0-alpha.4
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 +15 -9
- 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 +9 -7
- 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 +11 -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.d.ts +8 -0
- package/dist/backend/claude-code.js +11 -4
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/codex.js +7 -3
- package/dist/backend/codex.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/grok.d.ts +19 -0
- package/dist/backend/grok.js +112 -1
- package/dist/backend/grok.js.map +1 -1
- package/dist/backend/types.d.ts +10 -0
- package/dist/backend/types.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 +10 -10
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/child-process.d.ts +1 -0
- package/dist/child-process.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/claude-model-observation.d.ts +71 -0
- package/dist/claude-model-observation.js +169 -0
- package/dist/claude-model-observation.js.map +1 -0
- 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/cross-instance-envelope.d.ts +4 -1
- package/dist/cross-instance-envelope.js +12 -7
- package/dist/cross-instance-envelope.js.map +1 -1
- package/dist/daemon.d.ts +24 -2
- package/dist/daemon.js +265 -37
- 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/delivery-consumed-watch.d.ts +24 -0
- package/dist/delivery-consumed-watch.js +21 -10
- package/dist/delivery-consumed-watch.js.map +1 -1
- package/dist/delivery-outbox.d.ts +5 -1
- package/dist/delivery-outbox.js +5 -0
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/fleet-manager.d.ts +31 -2
- package/dist/fleet-manager.js +238 -56
- 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 +48 -7
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +23 -6
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +18 -8
- package/dist/general-knowledge/skills/fleet-health/SKILL.md +16 -0
- package/dist/general-knowledge/skills/hub/SKILL.md +518 -0
- package/dist/general-knowledge/skills/multi-channel/SKILL.md +1 -1
- package/dist/general-knowledge/skills/scheduling/SKILL.md +1 -1
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +199 -40
- 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/grok-delivery-proof.d.ts +24 -0
- package/dist/grok-delivery-proof.js +124 -0
- package/dist/grok-delivery-proof.js.map +1 -0
- package/dist/hub/assistant/admin-types.d.ts +43 -0
- package/dist/hub/assistant/admin-types.js +2 -0
- package/dist/hub/assistant/admin-types.js.map +1 -0
- package/dist/hub/assistant/claude-host.d.ts +17 -0
- package/dist/hub/assistant/claude-host.js +300 -0
- package/dist/hub/assistant/claude-host.js.map +1 -0
- package/dist/hub/assistant/context.d.ts +3 -0
- package/dist/hub/assistant/context.js +7 -0
- package/dist/hub/assistant/context.js.map +1 -0
- package/dist/hub/assistant/fleet-host.d.ts +19 -0
- package/dist/hub/assistant/fleet-host.js +28 -0
- package/dist/hub/assistant/fleet-host.js.map +1 -0
- package/dist/hub/assistant/runner.d.ts +64 -0
- package/dist/hub/assistant/runner.js +239 -0
- package/dist/hub/assistant/runner.js.map +1 -0
- package/dist/hub/assistant/service.d.ts +51 -0
- package/dist/hub/assistant/service.js +143 -0
- package/dist/hub/assistant/service.js.map +1 -0
- package/dist/hub/assistant/store.d.ts +3 -0
- package/dist/hub/assistant/store.js +65 -0
- package/dist/hub/assistant/store.js.map +1 -0
- package/dist/hub/assistant/types.d.ts +60 -0
- package/dist/hub/assistant/types.js +2 -0
- package/dist/hub/assistant/types.js.map +1 -0
- 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 +127 -35
- package/dist/hub/catalog.js.map +1 -1
- package/dist/hub/client.d.ts +16 -0
- package/dist/hub/client.js +52 -9
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.d.ts +8 -1
- package/dist/hub/compose/member.js +238 -57
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.d.ts +17 -1
- package/dist/hub/compose/server.js +76 -13
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/directory/admission.d.ts +15 -0
- package/dist/hub/directory/admission.js +56 -0
- package/dist/hub/directory/admission.js.map +1 -0
- package/dist/hub/directory/directory.d.ts +1 -1
- package/dist/hub/directory/directory.js +114 -0
- package/dist/hub/directory/directory.js.map +1 -1
- package/dist/hub/directory/types.d.ts +27 -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-control.d.ts +1 -0
- package/dist/hub/group-policy/admin-control.js +4 -2
- package/dist/hub/group-policy/admin-control.js.map +1 -1
- package/dist/hub/group-policy/admin-facts.d.ts +1 -0
- package/dist/hub/group-policy/admin-facts.js +2 -1
- package/dist/hub/group-policy/admin-facts.js.map +1 -1
- 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/admin-read.d.ts +1 -0
- package/dist/hub/group-policy/admin-read.js +3 -2
- package/dist/hub/group-policy/admin-read.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/errors.d.ts +9 -0
- package/dist/hub/group-policy/errors.js +13 -0
- package/dist/hub/group-policy/errors.js.map +1 -0
- 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 +21 -12
- package/dist/hub/group-policy/store.js +99 -109
- 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.d.ts +1 -0
- package/dist/hub/http/compose.js +463 -20
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/core.d.ts +24 -5
- package/dist/hub/http/core.js +181 -54
- package/dist/hub/http/core.js.map +1 -1
- package/dist/hub/http/deps.d.ts +26 -0
- package/dist/hub/http/schema.js +19 -0
- package/dist/hub/http/schema.js.map +1 -1
- package/dist/hub/init/member-certificate.d.ts +1 -0
- package/dist/hub/init/member-certificate.js +39 -0
- package/dist/hub/init/member-certificate.js.map +1 -0
- package/dist/hub/init/plan-digest.js +1 -0
- package/dist/hub/init/plan-digest.js.map +1 -1
- package/dist/hub/invitations.d.ts +96 -0
- package/dist/hub/invitations.js +292 -0
- package/dist/hub/invitations.js.map +1 -0
- package/dist/hub/join/certificate-trust.d.ts +13 -0
- package/dist/hub/join/certificate-trust.js +41 -0
- package/dist/hub/join/certificate-trust.js.map +1 -0
- package/dist/hub/join/certificate.d.ts +11 -0
- package/dist/hub/join/certificate.js +67 -0
- package/dist/hub/join/certificate.js.map +1 -0
- package/dist/hub/join/client.d.ts +5 -0
- package/dist/hub/join/client.js +30 -3
- package/dist/hub/join/client.js.map +1 -1
- package/dist/hub/join/http.js +5 -3
- package/dist/hub/join/http.js.map +1 -1
- package/dist/hub/join/local.d.ts +37 -1
- package/dist/hub/join/local.js +142 -14
- package/dist/hub/join/local.js.map +1 -1
- package/dist/hub/join/service.d.ts +19 -0
- package/dist/hub/join/service.js +46 -35
- package/dist/hub/join/service.js.map +1 -1
- package/dist/hub/join/trust.d.ts +9 -0
- package/dist/hub/join/trust.js +35 -0
- package/dist/hub/join/trust.js.map +1 -1
- package/dist/hub/member/pairing-api.js +12 -1
- package/dist/hub/member/pairing-api.js.map +1 -1
- package/dist/hub/member/room-ask.d.ts +137 -0
- package/dist/hub/member/room-ask.js +358 -0
- package/dist/hub/member/room-ask.js.map +1 -0
- package/dist/hub/member-journal.d.ts +18 -1
- package/dist/hub/member-journal.js +76 -3
- package/dist/hub/member-journal.js.map +1 -1
- package/dist/hub/member-origin.d.ts +177 -0
- package/dist/hub/member-origin.js +314 -0
- package/dist/hub/member-origin.js.map +1 -0
- package/dist/hub/pairing-notices.d.ts +1 -0
- package/dist/hub/pairing-notices.js +2 -1
- package/dist/hub/pairing-notices.js.map +1 -1
- package/dist/hub/pairing.d.ts +11 -0
- package/dist/hub/pairing.js +69 -21
- 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 +172 -0
- package/dist/hub/protocol.js +25 -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/clock.d.ts +18 -0
- package/dist/hub/roles/clock.js +58 -0
- package/dist/hub/roles/clock.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-marker.d.ts +57 -0
- package/dist/hub/roles/cutover-marker.js +26 -0
- package/dist/hub/roles/cutover-marker.js.map +1 -0
- package/dist/hub/roles/cutover.d.ts +32 -0
- package/dist/hub/roles/cutover.js +170 -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 +33 -0
- package/dist/hub/roles/read.js +55 -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/admin.d.ts +45 -0
- package/dist/hub/rooms/admin.js +105 -0
- package/dist/hub/rooms/admin.js.map +1 -0
- package/dist/hub/rooms/agents.d.ts +74 -0
- package/dist/hub/rooms/agents.js +333 -0
- package/dist/hub/rooms/agents.js.map +1 -0
- package/dist/hub/rooms/assistant.d.ts +44 -0
- package/dist/hub/rooms/assistant.js +179 -0
- package/dist/hub/rooms/assistant.js.map +1 -0
- package/dist/hub/rooms/context.d.ts +10 -0
- package/dist/hub/rooms/context.js +24 -0
- package/dist/hub/rooms/context.js.map +1 -0
- package/dist/hub/rooms/direct-view.d.ts +39 -0
- package/dist/hub/rooms/direct-view.js +38 -0
- package/dist/hub/rooms/direct-view.js.map +1 -0
- package/dist/hub/rooms/directory.d.ts +35 -0
- package/dist/hub/rooms/directory.js +98 -0
- package/dist/hub/rooms/directory.js.map +1 -0
- package/dist/hub/rooms/schema.d.ts +11 -0
- package/dist/hub/rooms/schema.js +73 -0
- package/dist/hub/rooms/schema.js.map +1 -0
- package/dist/hub/rooms/service.d.ts +449 -0
- package/dist/hub/rooms/service.js +581 -0
- package/dist/hub/rooms/service.js.map +1 -0
- package/dist/hub/rooms/types.d.ts +79 -0
- package/dist/hub/rooms/types.js +2 -0
- package/dist/hub/rooms/types.js.map +1 -0
- package/dist/hub/rooms.d.ts +15 -1
- package/dist/hub/rooms.js +76 -31
- package/dist/hub/rooms.js.map +1 -1
- package/dist/hub/runtime.d.ts +8 -0
- package/dist/hub/runtime.js +57 -3
- package/dist/hub/runtime.js.map +1 -1
- package/dist/hub/server.d.ts +28 -0
- package/dist/hub/server.js +66 -6
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/sessions.js +6 -2
- package/dist/hub/sessions.js.map +1 -1
- package/dist/hub/settings-commit.d.ts +6 -1
- package/dist/hub/settings-commit.js +15 -0
- package/dist/hub/settings-commit.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.d.ts +5 -0
- package/dist/hub/settings-directory-recovery.js +14 -4
- package/dist/hub/settings-directory-recovery.js.map +1 -1
- package/dist/hub/settings-member-address-control.d.ts +84 -0
- package/dist/hub/settings-member-address-control.js +150 -0
- package/dist/hub/settings-member-address-control.js.map +1 -0
- package/dist/hub/settings-member-address-decision.d.ts +229 -0
- package/dist/hub/settings-member-address-decision.js +318 -0
- package/dist/hub/settings-member-address-decision.js.map +1 -0
- package/dist/hub/settings-member-address-http.d.ts +9 -0
- package/dist/hub/settings-member-address-http.js +78 -0
- package/dist/hub/settings-member-address-http.js.map +1 -0
- package/dist/hub/settings-member-address-network.d.ts +2 -0
- package/dist/hub/settings-member-address-network.js +22 -0
- package/dist/hub/settings-member-address-network.js.map +1 -0
- package/dist/hub/settings-member-address-notices.d.ts +22 -0
- package/dist/hub/settings-member-address-notices.js +21 -0
- package/dist/hub/settings-member-address-notices.js.map +1 -0
- package/dist/hub/settings-member-address-policy.d.ts +21 -0
- package/dist/hub/settings-member-address-policy.js +34 -0
- package/dist/hub/settings-member-address-policy.js.map +1 -0
- package/dist/hub/settings-member-address.d.ts +64 -0
- package/dist/hub/settings-member-address.js +239 -0
- package/dist/hub/settings-member-address.js.map +1 -0
- 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/socket.d.ts +2 -0
- package/dist/hub/socket.js +2 -0
- package/dist/hub/socket.js.map +1 -1
- package/dist/hub/store.js +6 -2
- package/dist/hub/store.js.map +1 -1
- package/dist/hub/teams/types.d.ts +41 -0
- package/dist/hub/teams/types.js +2 -0
- package/dist/hub/teams/types.js.map +1 -0
- package/dist/hub/tls.d.ts +47 -0
- package/dist/hub/tls.js +23 -6
- package/dist/hub/tls.js.map +1 -1
- package/dist/hub/types.d.ts +68 -4
- package/dist/hub/validation.d.ts +1 -1
- package/dist/hub/validation.js +2 -2
- package/dist/hub/validation.js.map +1 -1
- package/dist/hub/web-origin.d.ts +93 -0
- package/dist/hub/web-origin.js +174 -0
- package/dist/hub/web-origin.js.map +1 -0
- package/dist/hub-pilot-trust-settings.d.ts +4 -0
- package/dist/hub-pilot-trust-settings.js +13 -0
- package/dist/hub-pilot-trust-settings.js.map +1 -0
- package/dist/human-delivery-receipts.d.ts +4 -2
- package/dist/human-delivery-receipts.js +20 -13
- package/dist/human-delivery-receipts.js.map +1 -1
- package/dist/inbound-presentation.d.ts +28 -0
- package/dist/inbound-presentation.js +48 -0
- package/dist/inbound-presentation.js.map +1 -0
- package/dist/instance-lifecycle.d.ts +13 -1
- package/dist/instance-lifecycle.js +33 -10
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/instructions.d.ts +10 -2
- package/dist/instructions.js +32 -7
- package/dist/instructions.js.map +1 -1
- package/dist/locale.js +20 -6
- package/dist/locale.js.map +1 -1
- package/dist/log-service.d.ts +3 -0
- package/dist/log-service.js +39 -22
- package/dist/log-service.js.map +1 -1
- package/dist/log-steps.d.ts +56 -1
- package/dist/log-steps.js +318 -56
- package/dist/log-steps.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/needs-you-hub.js +6 -2
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you.d.ts +5 -1
- package/dist/needs-you.js +4 -8
- package/dist/needs-you.js.map +1 -1
- package/dist/office-share-page.js +1 -1
- package/dist/office-share-page.js.map +1 -1
- package/dist/outbound-handlers.d.ts +1 -0
- package/dist/outbound-handlers.js +25 -19
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +19 -0
- package/dist/outbound-schemas.js +23 -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/queued-handoffs.d.ts +3 -1
- package/dist/queued-handoffs.js +1 -1
- package/dist/queued-handoffs.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-transcript-source.d.ts +2 -0
- package/dist/runtime-transcript-source.js +23 -1
- package/dist/runtime-transcript-source.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 +1 -0
- package/dist/settings-api.js +15 -8
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-baseline.d.ts +3 -0
- package/dist/settings-baseline.js +2 -2
- package/dist/settings-baseline.js.map +1 -1
- package/dist/settings-effect.d.ts +3 -0
- package/dist/settings-effect.js +12 -2
- 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-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/topic-commands.js +2 -1
- package/dist/topic-commands.js.map +1 -1
- package/dist/transcript-jsonl.d.ts +24 -0
- package/dist/transcript-jsonl.js +72 -22
- package/dist/transcript-jsonl.js.map +1 -1
- package/dist/transcript-monitor.d.ts +5 -1
- package/dist/transcript-monitor.js +65 -3
- package/dist/transcript-monitor.js.map +1 -1
- package/dist/transcript-needles.d.ts +1 -1
- package/dist/transcript-needles.js +1 -1
- package/dist/transcript-records.d.ts +2 -1
- package/dist/transcript-records.js.map +1 -1
- package/dist/transcript-sources.d.ts +4 -0
- package/dist/transcript-sources.js +2 -0
- package/dist/transcript-sources.js.map +1 -1
- 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-details-settings.js +10 -1
- 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/chat-activity.js +2 -2
- package/dist/ui/cli-caps.js +7 -7
- package/dist/ui/credential-profile-select.js +32 -19
- package/dist/ui/fleet-canvas.js +5 -2
- package/dist/ui/fleet-office-card.js +4 -2
- package/dist/ui/fleet-org.js +2 -0
- package/dist/ui/hub-admin-rooms-strings.js +28 -0
- package/dist/ui/hub-admin-rooms.js +77 -0
- package/dist/ui/hub-assistant-admin-strings.js +26 -0
- package/dist/ui/hub-assistant-admin.js +85 -0
- package/dist/ui/hub-chat-store.js +8 -4
- package/dist/ui/hub-client.js +224 -33
- 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-invitations-strings.js +30 -0
- package/dist/ui/hub-invitations.js +108 -0
- package/dist/ui/hub-join-one-strings.js +4 -2
- package/dist/ui/hub-join-steps.js +5 -2
- package/dist/ui/hub-pairing-form-strings.js +48 -0
- package/dist/ui/hub-pilot-trust-strings.js +27 -0
- package/dist/ui/hub-pilot-trust.js +41 -0
- package/dist/ui/hub-room-composer.js +113 -0
- package/dist/ui/hub-room-favorites.js +90 -0
- package/dist/ui/hub-room-list.js +152 -0
- package/dist/ui/hub-room-members-strings.js +12 -0
- package/dist/ui/hub-room-members.js +104 -0
- package/dist/ui/hub-room-new-strings.js +46 -0
- package/dist/ui/hub-room-new.js +135 -0
- package/dist/ui/hub-room-presence.js +123 -0
- package/dist/ui/hub-room-settings-strings.js +26 -0
- package/dist/ui/hub-room-settings.js +134 -0
- package/dist/ui/hub-room-strings.js +222 -0
- package/dist/ui/hub-room-thread.js +262 -0
- package/dist/ui/hub-room-unread.js +51 -0
- package/dist/ui/hub-room-working.js +29 -0
- package/dist/ui/log-row.js +14 -5
- package/dist/ui/machine-signin.js +47 -14
- package/dist/ui/panel-details.js +6 -1
- package/dist/ui/panel-fleet.js +2 -2
- package/dist/ui/panel-hub.js +145 -59
- package/dist/ui/panel-needs.js +2 -0
- package/dist/ui/panel-settings.js +2 -2
- package/dist/ui/settings-hub-company-join.js +32 -11
- package/dist/ui/settings-hub-connection.js +9 -3
- package/dist/ui/settings-hub-member-address.js +205 -0
- package/dist/ui/settings-hub-section.js +4 -0
- package/dist/ui/settings-hub-web-address.js +233 -0
- package/dist/ui/settings-hub.js +16 -4
- 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-i18n.js +2 -2
- package/dist/ui/shared/app-needs.js +3 -0
- package/dist/ui/shared/app-shell.js +4 -1
- package/dist/ui/shared/app.css +43 -5
- package/dist/ui/shared/chat-render.js +10 -0
- package/dist/ui/shared/chat-thread.js +14 -5
- package/dist/ui/shared/hub-chat.css +17 -0
- package/dist/ui/shared/hub-grant-picker.css +4 -0
- package/dist/ui/shared/hub-rooms-u2.css +42 -0
- package/dist/ui/shared/hub-sharing.css +4 -0
- package/dist/ui/shared/model-observation.js +16 -0
- package/dist/ui/shared/stale-tab.css +6 -0
- package/dist/ui/shared/stale-tab.js +50 -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 +4 -0
- package/dist/web-api.js +32 -13
- 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
package/dist/hub/http/compose.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* - `receive(frame, link)` is S1's HubServer callback for an authenticated member link.
|
|
14
14
|
* - `close()` forgets the links. S5 closes the DB.
|
|
15
15
|
*/
|
|
16
|
+
import { HubGroupPolicyError } from "../group-policy/errors.js";
|
|
16
17
|
import { GROUP_POLICY_FEATURE, handleGroupHttp } from "../group-policy/admin-api.js";
|
|
17
18
|
import { handleHubDirectorySettingsHttp, HUB_DIRECTORY_SETTINGS_FEATURE, HUB_DIRECTORY_CA_FEATURE, HUB_DIRECTORY_EDITOR_FEATURE } from "../settings-directory-http.js";
|
|
18
19
|
import { handleHubSettingsHttp } from "../settings-api.js";
|
|
@@ -24,16 +25,22 @@ import { personKeyString } from "../identity.js";
|
|
|
24
25
|
import { HubEnrolmentCodeLimit } from "../enrolment-code.js";
|
|
25
26
|
import { HubSessions, hubClearCookie, hubSetCookie } from "../sessions.js";
|
|
26
27
|
import { HubCatalogService } from "../catalog.js";
|
|
28
|
+
import { HubGrantSearch } from "../grant-search.js";
|
|
27
29
|
import { HubPolicyService } from "../policy.js";
|
|
28
30
|
import { HubRoomsService } from "../rooms.js";
|
|
31
|
+
import { HubRoomAdmin } from "../rooms/admin.js";
|
|
32
|
+
import { HubGroupRooms, HubRoomRefusal } from "../rooms/service.js";
|
|
33
|
+
import { directMessages, directRoomView, directUnread, markDirectRead } from "../rooms/direct-view.js";
|
|
29
34
|
import { HubAttachmentRefused } from "../attachments/store.js";
|
|
30
35
|
import { HubQuotaService } from "../quota.js";
|
|
31
36
|
import { HubCore, pairingOwnerByLogin } from "./core.js";
|
|
37
|
+
import { HubSharingPaused, HubSharingService } from "../sharing.js";
|
|
32
38
|
import { HUB_HTTP_MIGRATIONS } from "./schema.js";
|
|
33
39
|
import { serveHubWorkspaceShell } from "../../web-api.js";
|
|
34
40
|
import { servePublicAsset } from "../../auth-api.js";
|
|
35
41
|
import { handleCompanyJoin, companyFlowCookie } from "../join/http.js";
|
|
36
42
|
import { CompanyJoinCodeRefusal, CompanyJoinLimit, CompanyJoinOfferPending } from "../join/service.js";
|
|
43
|
+
import { HubMemberAddressError } from "../settings-member-address-policy.js";
|
|
37
44
|
export { HUB_HTTP_MIGRATIONS };
|
|
38
45
|
/** S5's lazy entry (HubHttpEntry): this module itself — `createHubHttp` and `migrations`. */
|
|
39
46
|
export const migrations = HUB_HTTP_MIGRATIONS;
|
|
@@ -42,9 +49,22 @@ export const HUB_UI_MODULES = Object.freeze(["panel-hub.js", "hub-client.js", "h
|
|
|
42
49
|
// #3298 S-89 (lazy; loaded only when the session says "group-policy-v1"): the welcome, Group permissions and their words.
|
|
43
50
|
"hub-welcome.js", "hub-group-policy.js", "hub-group-strings.js", "hub-read-strings.js", "hub-quick-pairing.js", "hub-quick-strings.js", "hub-company-join.js", "hub-company-join-strings.js", "hub-this-hub.js", "hub-directory-notices.js", "hub-directory-notice-strings.js", "hub-directory-editor.js", "hub-directory-editor-strings.js",
|
|
44
51
|
// Hub UX U2 (M-2932): the group-search picker (its own words inside), shared with B2's join-code scope.
|
|
45
|
-
"hub-group-search.js", "hub-join-steps.js",
|
|
52
|
+
"hub-group-search.js", "hub-join-steps.js", "hub-grant-picker.js",
|
|
46
53
|
// B2: code management and the same-request Hub approval queue.
|
|
47
|
-
"hub-enrolment-code.js", "hub-enrolment-code-strings.js", "hub-join-queue.js", "hub-join-approval.js", "hub-joincode-flow-strings.js"
|
|
54
|
+
"hub-enrolment-code.js", "hub-enrolment-code-strings.js", "hub-join-queue.js", "hub-join-approval.js", "hub-joincode-flow-strings.js",
|
|
55
|
+
// Hub rooms (hub-rooms-ux.md §§2,5): the rooms words (#3850) then the presence helper (pure, no DOM).
|
|
56
|
+
"hub-room-strings.js", "hub-room-presence.js",
|
|
57
|
+
// Hub rooms §12: unread counts and the Fleet desktop-notify rule (lazy; screens load it).
|
|
58
|
+
"hub-room-unread.js",
|
|
59
|
+
// Hub rooms, track U2 (dev-claude2; hub-rooms-split.md section 3): new room, room settings, members rail, invitations,
|
|
60
|
+
// 管理 → 房間.
|
|
61
|
+
"hub-room-new.js", "hub-room-new-strings.js", "hub-room-settings.js", "hub-room-settings-strings.js", "hub-room-members.js", "hub-room-members-strings.js", "hub-invitations.js", "hub-invitations-strings.js", "hub-admin-rooms.js", "hub-admin-rooms-strings.js",
|
|
62
|
+
// M-3092 (Hub rooms, track U): the conversation list, a room on the shared thread, its composer.
|
|
63
|
+
"hub-room-list.js", "hub-room-thread.js", "hub-room-composer.js", "hub-assistant-admin.js", "hub-assistant-admin-strings.js",
|
|
64
|
+
// M-3092 S-145: the list's favourites (the Fleet sidebar's #1664 rules; per browser until a Hub-side store).
|
|
65
|
+
"hub-room-favorites.js",
|
|
66
|
+
// S-148: the working bar's words (#3857), shared by the room thread.
|
|
67
|
+
"hub-room-working.js"]);
|
|
48
68
|
const BODY_LIMIT = 96 * 1024;
|
|
49
69
|
const UPLOADS_PER_SESSION = 2, UPLOADS_TOTAL = 8;
|
|
50
70
|
const UUID = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
|
|
@@ -137,11 +157,19 @@ const int = (v) => { const n = typeof v === "string" && /^\d{1,15}$/.test(v) ? N
|
|
|
137
157
|
export function createHubHttp(deps, sql) {
|
|
138
158
|
let closed = false;
|
|
139
159
|
const core = new HubCore(deps, sql, () => !closed);
|
|
160
|
+
const sharing = new HubSharingService(core);
|
|
140
161
|
const sessions = new HubSessions(core), catalog = new HubCatalogService(core), policy = new HubPolicyService(core);
|
|
162
|
+
const grantSearch = new HubGrantSearch(core);
|
|
141
163
|
const rooms = new HubRoomsService(core, policy);
|
|
164
|
+
const groupRooms = new HubGroupRooms(core);
|
|
165
|
+
const invitations = deps.roomInvitations?.(core, groupRooms.invitationHost());
|
|
166
|
+
const roomAdmin = new HubRoomAdmin(core, event => groupRooms.publish(event), id => { groupRooms.assistant.forget(id); groupRooms.agents.sweep(id); });
|
|
142
167
|
const quota = new HubQuotaService(core);
|
|
143
168
|
const uiDir = join(dirname(fileURLToPath(import.meta.url)), "..", "..", "ui");
|
|
144
169
|
const live = () => !closed && core.live();
|
|
170
|
+
const grantSubjectsOffered = () => !!deps.grantDirectory && deps.directory.groupPolicy === "ad-direct-guid"
|
|
171
|
+
&& typeof deps.directory.searchPolicyGroups === "function" && typeof deps.directory.searchGrantPeople === "function"
|
|
172
|
+
&& typeof deps.directory.resolvePolicyGroup === "function" && typeof deps.directory.readPolicyGroups === "function";
|
|
145
173
|
/** Upload bodies being read now, per session and in all (each up to the file limit in memory). */
|
|
146
174
|
const uploading = new Map();
|
|
147
175
|
let uploadingTotal = 0;
|
|
@@ -174,8 +202,8 @@ export function createHubHttp(deps, sql) {
|
|
|
174
202
|
};
|
|
175
203
|
const m = (re) => re.exec(path);
|
|
176
204
|
// Composed routes, not enrollment authority or the administrator's on/off switch. Older Hubs omit unsupported cards.
|
|
177
|
-
const offered = [...(deps.groupHttp ? [GROUP_POLICY_FEATURE, ...(deps.pairingNotices ? ["quick-pairing-v1"] : [])] : []),
|
|
178
|
-
...(deps.companyJoin ? ["company-join-v1", "enrolment-code-v1"] : []), ...(deps.directoryNotices ? ["directory-security-notices-v1"] : []),
|
|
205
|
+
const offered = ["rooms-v1", ...(deps.roomAssistant && deps.assistantAdmin ? ["room-assistant-v1"] : []), ...(deps.refreshAuthorization ? ["sharing-pause-v1"] : []), ...(deps.groupHttp ? [GROUP_POLICY_FEATURE, ...(deps.pairingNotices ? ["quick-pairing-v1"] : [])] : []), ...(grantSubjectsOffered() ? ["grant-subjects-v1"] : []),
|
|
206
|
+
...(deps.companyJoin ? ["company-join-v1", "enrolment-code-v1"] : []), ...(deps.directoryNotices ? ["directory-security-notices-v1"] : []), ...(deps.memberAddressNotices ? ["member-address-notices-v1"] : []),
|
|
179
207
|
...(deps.directorySettings ? [HUB_DIRECTORY_SETTINGS_FEATURE, HUB_DIRECTORY_CA_FEATURE, HUB_DIRECTORY_EDITOR_FEATURE] : [])];
|
|
180
208
|
const features = offered.length ? { features: offered } : {};
|
|
181
209
|
let r;
|
|
@@ -225,8 +253,9 @@ export function createHubHttp(deps, sql) {
|
|
|
225
253
|
if (deps.companyJoin && path === "/hub/v1/admin/company-join") {
|
|
226
254
|
if (method === "GET") {
|
|
227
255
|
signedIn();
|
|
228
|
-
await ctx.
|
|
229
|
-
|
|
256
|
+
const permit = await core.management(ctx, "join.manage"), view = deps.companyJoin.adminView();
|
|
257
|
+
permit.assertCurrent();
|
|
258
|
+
return send(res, 200, view);
|
|
230
259
|
}
|
|
231
260
|
if (method !== "PUT")
|
|
232
261
|
throw new HttpError(405, "method");
|
|
@@ -252,6 +281,34 @@ export function createHubHttp(deps, sql) {
|
|
|
252
281
|
}
|
|
253
282
|
throw new HttpError(405, "method");
|
|
254
283
|
}
|
|
284
|
+
if (deps.memberAddressNotices) {
|
|
285
|
+
const notices = deps.memberAddressNotices;
|
|
286
|
+
if (path === "/hub/v1/security-notices/member-address") {
|
|
287
|
+
if (method !== "GET")
|
|
288
|
+
throw new HttpError(405, "method");
|
|
289
|
+
signedIn();
|
|
290
|
+
if ([...query.keys()].some(k => k !== "before") || query.getAll("before").length > 1
|
|
291
|
+
|| query.has("before") && !/^[1-9][0-9]{0,15}$/.test(query.get("before")))
|
|
292
|
+
throw new HubProtocolError("invalid");
|
|
293
|
+
const page = await guard(() => notices.forSession(ctx, query.has("before") ? Number(query.get("before")) : undefined));
|
|
294
|
+
if (!live())
|
|
295
|
+
throw new HubProtocolError("unavailable");
|
|
296
|
+
signedIn();
|
|
297
|
+
return send(res, 200, page);
|
|
298
|
+
}
|
|
299
|
+
if ((r = m(/^\/hub\/v1\/security-notices\/member-address\/([^/]+)\/ack$/))) {
|
|
300
|
+
if (method !== "POST")
|
|
301
|
+
throw new HttpError(405, "method");
|
|
302
|
+
if ([...query.keys()].length)
|
|
303
|
+
throw new HubProtocolError("invalid");
|
|
304
|
+
csrf();
|
|
305
|
+
await guard(() => notices.acknowledgeSession(ctx, uuid(r[1])));
|
|
306
|
+
if (!live())
|
|
307
|
+
throw new HubProtocolError("unavailable");
|
|
308
|
+
signedIn();
|
|
309
|
+
return send(res, 200, { ok: true });
|
|
310
|
+
}
|
|
311
|
+
}
|
|
255
312
|
if (deps.directoryNotices) {
|
|
256
313
|
const notices = deps.directoryNotices;
|
|
257
314
|
if (path === "/hub/v1/security-notices/directory") {
|
|
@@ -386,6 +443,14 @@ export function createHubHttp(deps, sql) {
|
|
|
386
443
|
return;
|
|
387
444
|
}
|
|
388
445
|
}
|
|
446
|
+
if ((r = m(/^\/hub\/v1\/exposures\/([^/]+)\/grant-subjects\/search$/))) {
|
|
447
|
+
if (method !== "POST")
|
|
448
|
+
throw new HttpError(405, "method");
|
|
449
|
+
csrf();
|
|
450
|
+
const input = await body(), response = await guard(() => grantSearch.search(ctx, uuid(r[1]), input));
|
|
451
|
+
const limited = response?.reason === "limited";
|
|
452
|
+
return send(res, limited ? 429 : 200, response, limited ? { "Retry-After": "60" } : {});
|
|
453
|
+
}
|
|
389
454
|
if (path === "/hub/v1/exposures" || path === "/hub/v1/grants") {
|
|
390
455
|
if (method === "GET") {
|
|
391
456
|
signedIn();
|
|
@@ -395,7 +460,8 @@ export function createHubHttp(deps, sql) {
|
|
|
395
460
|
if (path === "/hub/v1/grants" && method === "POST") {
|
|
396
461
|
csrf();
|
|
397
462
|
const b = await body();
|
|
398
|
-
const g = await guard(() => catalog.grant(ctx, { exposureId: uuid(b.exposureId), exposureRevision: int(b.exposureRevision),
|
|
463
|
+
const g = await guard(() => catalog.grant(ctx, { exposureId: uuid(b.exposureId), exposureRevision: int(b.exposureRevision),
|
|
464
|
+
...(b.login !== undefined ? { login: str(b.login) } : {}), ...(b.subject !== undefined ? { subject: b.subject } : {}), days: int(b.days) }));
|
|
399
465
|
return send(res, 200, { grant: g });
|
|
400
466
|
}
|
|
401
467
|
throw new HttpError(405, "method");
|
|
@@ -414,6 +480,21 @@ export function createHubHttp(deps, sql) {
|
|
|
414
480
|
signedIn();
|
|
415
481
|
return send(res, 200, { activity: await guard(() => rooms.activity(ctx, uuid(r[1]))) });
|
|
416
482
|
}
|
|
483
|
+
if ((r = m(/^\/hub\/v1\/exposures\/([^/]+)\/rooms$/))) {
|
|
484
|
+
if (method !== "GET")
|
|
485
|
+
throw new HttpError(405, "method");
|
|
486
|
+
signedIn();
|
|
487
|
+
return send(res, 200, { rooms: await guard(() => groupRooms.roomsForExposure(ctx, uuid(r[1]))) });
|
|
488
|
+
}
|
|
489
|
+
if ((r = m(/^\/hub\/v1\/exposures\/([^/]+)\/sharing$/))) {
|
|
490
|
+
if (method !== "POST")
|
|
491
|
+
throw new HttpError(405, "method");
|
|
492
|
+
csrf();
|
|
493
|
+
const b = await body();
|
|
494
|
+
await guard(() => sharing.change(ctx, uuid(r[1]), b));
|
|
495
|
+
groupRooms.agents.publicationChanged(undefined, uuid(r[1]));
|
|
496
|
+
return send(res, 200, { ok: true });
|
|
497
|
+
}
|
|
417
498
|
if ((r = m(/^\/hub\/v1\/exposures\/([^/]+)\/freeze$/))) {
|
|
418
499
|
if (method !== "POST")
|
|
419
500
|
throw new HttpError(405, "method");
|
|
@@ -433,19 +514,309 @@ export function createHubHttp(deps, sql) {
|
|
|
433
514
|
await guard(() => quota.setVisible(ctx, exposureId, int(b.revision), b.visible));
|
|
434
515
|
return send(res, 200, { quotaVisible: b.visible, ...quota.projection(exposureId) });
|
|
435
516
|
}
|
|
517
|
+
if (path === "/hub/v1/admin/assistant" || path === "/hub/v1/admin/assistant/usage" || /^\/hub\/v1\/admin\/assistant\/rooms\/[^/]+\/stop$/.test(path)) {
|
|
518
|
+
const port = deps.roomAssistant && deps.assistantAdmin;
|
|
519
|
+
if (!port)
|
|
520
|
+
throw new HttpError(404, "not-found");
|
|
521
|
+
if (mutation)
|
|
522
|
+
csrf();
|
|
523
|
+
else
|
|
524
|
+
signedIn();
|
|
525
|
+
const permit = await guard(() => core.management(ctx, "hub.admin"));
|
|
526
|
+
const call = async (work) => {
|
|
527
|
+
permit.assertCurrent();
|
|
528
|
+
let result;
|
|
529
|
+
try {
|
|
530
|
+
result = await work();
|
|
531
|
+
}
|
|
532
|
+
catch {
|
|
533
|
+
permit.assertCurrent();
|
|
534
|
+
throw new HttpError(503, "unavailable");
|
|
535
|
+
}
|
|
536
|
+
permit.assertCurrent();
|
|
537
|
+
return result;
|
|
538
|
+
};
|
|
539
|
+
if (path === "/hub/v1/admin/assistant") {
|
|
540
|
+
if (method === "GET")
|
|
541
|
+
return send(res, 200, await guard(() => call(() => port.settings())));
|
|
542
|
+
if (method === "PUT") {
|
|
543
|
+
const b = await body();
|
|
544
|
+
return send(res, 200, await guard(() => call(() => port.configure(b))));
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
else if (path.endsWith("/usage") && method === "GET")
|
|
548
|
+
return send(res, 200, await guard(() => call(() => port.usage())));
|
|
549
|
+
else if (method === "POST") {
|
|
550
|
+
const id = uuid(path.split("/")[6]);
|
|
551
|
+
await guard(() => call(() => { groupRooms.assistant.cancel(id); return port.stopRoom(id); }));
|
|
552
|
+
return send(res, 200, { ok: true });
|
|
553
|
+
}
|
|
554
|
+
throw new HttpError(405, "method");
|
|
555
|
+
}
|
|
556
|
+
if (path === "/hub/v1/admin/rooms/creators") {
|
|
557
|
+
if (method === "GET") {
|
|
558
|
+
signedIn();
|
|
559
|
+
return send(res, 200, await guard(() => roomAdmin.creators(ctx)));
|
|
560
|
+
}
|
|
561
|
+
if (method === "PUT") {
|
|
562
|
+
csrf();
|
|
563
|
+
const b = await body();
|
|
564
|
+
return send(res, 200, await guard(() => roomAdmin.creators(ctx, b)));
|
|
565
|
+
}
|
|
566
|
+
throw new HttpError(405, "method");
|
|
567
|
+
}
|
|
568
|
+
if (path === "/hub/v1/admin/rooms") {
|
|
569
|
+
if (method !== "GET")
|
|
570
|
+
throw new HttpError(405, "method");
|
|
571
|
+
signedIn();
|
|
572
|
+
return send(res, 200, await guard(() => roomAdmin.list(ctx)));
|
|
573
|
+
}
|
|
574
|
+
if ((r = m(/^\/hub\/v1\/admin\/rooms\/([^/]+)(?:\/(join))?$/))) {
|
|
575
|
+
const roomId = uuid(r[1]);
|
|
576
|
+
csrf();
|
|
577
|
+
if (r[2] === "join" && method === "POST")
|
|
578
|
+
return send(res, 200, await guard(() => roomAdmin.join(ctx, roomId)));
|
|
579
|
+
if (!r[2] && method === "PATCH") {
|
|
580
|
+
const b = await body();
|
|
581
|
+
return send(res, 200, await guard(() => roomAdmin.archive(ctx, roomId, b)));
|
|
582
|
+
}
|
|
583
|
+
throw new HttpError(405, "method");
|
|
584
|
+
}
|
|
585
|
+
if (path === "/hub/v1/rooms/candidates") {
|
|
586
|
+
if (method !== "GET")
|
|
587
|
+
throw new HttpError(405, "method");
|
|
588
|
+
signedIn();
|
|
589
|
+
return send(res, 200, { candidates: await guard(() => groupRooms.candidates(ctx, query.get("q") ?? "", query.get("kind") ?? "person")) });
|
|
590
|
+
}
|
|
591
|
+
if ((r = m(/^\/hub\/v1\/rooms\/candidates\/group\/([^/]+)$/))) {
|
|
592
|
+
if (method !== "GET")
|
|
593
|
+
throw new HttpError(405, "method");
|
|
594
|
+
signedIn();
|
|
595
|
+
return send(res, 200, await guard(() => groupRooms.groupCandidate(ctx, uuid(r[1]))));
|
|
596
|
+
}
|
|
597
|
+
if (path === "/hub/v1/invitations") {
|
|
598
|
+
if (!invitations)
|
|
599
|
+
throw new HttpError(404, "not-found");
|
|
600
|
+
if (method !== "GET")
|
|
601
|
+
throw new HttpError(405, "method");
|
|
602
|
+
signedIn();
|
|
603
|
+
return send(res, 200, await guard(() => invitations.pending(ctx)));
|
|
604
|
+
}
|
|
605
|
+
if ((r = m(/^\/hub\/v1\/invitations\/([^/]+)\/(accept|decline)$/))) {
|
|
606
|
+
if (!invitations)
|
|
607
|
+
throw new HttpError(404, "not-found");
|
|
608
|
+
if (method !== "POST")
|
|
609
|
+
throw new HttpError(405, "method");
|
|
610
|
+
csrf();
|
|
611
|
+
const id = uuid(r[1]);
|
|
612
|
+
return send(res, 200, await guard(() => r[2] === "accept" ? invitations.accept(ctx, id) : invitations.decline(ctx, id)));
|
|
613
|
+
}
|
|
614
|
+
if ((r = m(/^\/hub\/v1\/rooms\/([^/]+)\/invitations(?:\/([^/]+))?$/))) {
|
|
615
|
+
if (!invitations)
|
|
616
|
+
throw new HttpError(404, "not-found");
|
|
617
|
+
csrf();
|
|
618
|
+
const id = uuid(r[1]);
|
|
619
|
+
if (method === "DELETE" && r[2])
|
|
620
|
+
return send(res, 200, await guard(() => invitations.cancel(ctx, id, uuid(r[2]))));
|
|
621
|
+
if (method === "POST" && !r[2]) {
|
|
622
|
+
const b = await body();
|
|
623
|
+
if (Object.keys(b).length !== 1 || !(Array.isArray(b.agents) || typeof b.team === "string"))
|
|
624
|
+
throw new HubProtocolError("invalid");
|
|
625
|
+
const input = Array.isArray(b.agents) ? { agents: b.agents.map(value => uuid(value)) } : { team: uuid(b.team) };
|
|
626
|
+
if (input.agents && input.agents.length > 64)
|
|
627
|
+
throw new HubProtocolError("invalid");
|
|
628
|
+
return send(res, 200, await guard(() => invitations.invite(ctx, id, input)));
|
|
629
|
+
}
|
|
630
|
+
throw new HttpError(405, "method");
|
|
631
|
+
}
|
|
632
|
+
if (path === "/hub/v1/rooms/events") {
|
|
633
|
+
if (method !== "GET")
|
|
634
|
+
throw new HttpError(405, "method");
|
|
635
|
+
const streamSession = signedIn(), streamPerson = personKeyString(await guard(() => ctx.requirePerson()));
|
|
636
|
+
const requestedNotices = query.get("notices"), notices = deps.pairingNotices;
|
|
637
|
+
const noticeVersion = requestedNotices === "3" && deps.companyJoin ? 3 : requestedNotices === "2" || requestedNotices === "3" ? 2 : null;
|
|
638
|
+
const initialNotices = notices && noticeVersion ? await guard(() => notices.forSession(ctx, noticeVersion)) : null;
|
|
639
|
+
if (streams.size >= 64 || !ctx.isCurrent?.())
|
|
640
|
+
throw new HubProtocolError("backpressure");
|
|
641
|
+
res.writeHead(200, { ...API_HEADERS, "Content-Type": "text/event-stream; charset=utf-8", Connection: "keep-alive", "X-Accel-Buffering": "no" });
|
|
642
|
+
let ended = false, queued = 0, tail = Promise.resolve(), noticesRunning = false, noticesDirty = false;
|
|
643
|
+
let offNotices = () => { };
|
|
644
|
+
const close = () => { if (ended)
|
|
645
|
+
return; ended = true; off(); offNotices(); clearInterval(heartbeat); streams.delete(close); res.end(); };
|
|
646
|
+
const off = groupRooms.subscribe(event => {
|
|
647
|
+
if (ended)
|
|
648
|
+
return;
|
|
649
|
+
if (event.audiencePerson && event.audiencePerson !== streamPerson)
|
|
650
|
+
return;
|
|
651
|
+
if (!event.audiencePerson && !groupRooms.interested(streamPerson, event))
|
|
652
|
+
return;
|
|
653
|
+
if (++queued > 64) {
|
|
654
|
+
close();
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
tail = tail.then(async () => {
|
|
658
|
+
if (ended)
|
|
659
|
+
return;
|
|
660
|
+
let data;
|
|
661
|
+
// Concurrent agent checks can briefly fill the person's physical read slots. Keep this event in the bounded
|
|
662
|
+
// queue and re-read it after a short delay; persistent overload and all other failures still close the stream.
|
|
663
|
+
for (let attempt = 0;; attempt++) {
|
|
664
|
+
try {
|
|
665
|
+
if (event.audiencePerson) {
|
|
666
|
+
if (event.type === "invitation.changed") {
|
|
667
|
+
data = personKeyString(await ctx.requirePerson()) === event.audiencePerson ? {} : null;
|
|
668
|
+
}
|
|
669
|
+
else {
|
|
670
|
+
const view = await rooms.view(ctx, event.roomId);
|
|
671
|
+
if (event.type === "unread.changed")
|
|
672
|
+
data = { roomId: event.roomId, unread: directUnread(core, view) };
|
|
673
|
+
else if (event.type === "room.changed")
|
|
674
|
+
data = { roomId: event.roomId, room: directRoomView(view, rooms.presence(view.exposureId), directUnread(core, view)) };
|
|
675
|
+
else {
|
|
676
|
+
const page = await rooms.readPage(ctx, event.roomId, 0, streamSession.sessionId, { before: null, limit: 100 });
|
|
677
|
+
const message = directMessages(page.room, page.entries, streamSession.displayName).find(m => m.id === event.data.messageId);
|
|
678
|
+
data = message ? { roomId: event.roomId, message } : null;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
else
|
|
683
|
+
data = await groupRooms.event(ctx, event);
|
|
684
|
+
break;
|
|
685
|
+
}
|
|
686
|
+
catch (error) {
|
|
687
|
+
if (!(error instanceof HubProtocolError) || error.code !== "backpressure" || attempt >= 3)
|
|
688
|
+
throw error;
|
|
689
|
+
await new Promise(resolve => setTimeout(resolve, 25 * 2 ** attempt));
|
|
690
|
+
if (ended || !live() || !ctx.isCurrent?.())
|
|
691
|
+
return close();
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
if (ended || !live() || !ctx.isCurrent?.())
|
|
695
|
+
return close();
|
|
696
|
+
if (data && !res.write(`event: ${event.type}\ndata: ${JSON.stringify(data)}\n\n`))
|
|
697
|
+
close();
|
|
698
|
+
}).catch(close).finally(() => { queued--; });
|
|
699
|
+
});
|
|
700
|
+
const pushNotices = async () => {
|
|
701
|
+
if (ended || !notices || !noticeVersion)
|
|
702
|
+
return;
|
|
703
|
+
if (noticesRunning) {
|
|
704
|
+
noticesDirty = true;
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
noticesRunning = true;
|
|
708
|
+
try {
|
|
709
|
+
do {
|
|
710
|
+
noticesDirty = false;
|
|
711
|
+
const rows = await notices.forSession(ctx, noticeVersion);
|
|
712
|
+
if (ended || !live() || !ctx.isCurrent?.())
|
|
713
|
+
return close();
|
|
714
|
+
if (!res.write(`event: notices\ndata: ${JSON.stringify({ notices: rows })}\n\n`))
|
|
715
|
+
return close();
|
|
716
|
+
} while (noticesDirty);
|
|
717
|
+
}
|
|
718
|
+
catch {
|
|
719
|
+
close();
|
|
720
|
+
}
|
|
721
|
+
finally {
|
|
722
|
+
noticesRunning = false;
|
|
723
|
+
}
|
|
724
|
+
};
|
|
725
|
+
const heartbeat = setInterval(() => { if (!live() || !ctx.isCurrent?.())
|
|
726
|
+
close();
|
|
727
|
+
else if (!res.write(": heartbeat\n\n"))
|
|
728
|
+
close(); }, 15_000);
|
|
729
|
+
heartbeat.unref();
|
|
730
|
+
try {
|
|
731
|
+
if (notices && noticeVersion)
|
|
732
|
+
offNotices = notices.subscribe(() => void pushNotices());
|
|
733
|
+
}
|
|
734
|
+
catch {
|
|
735
|
+
close();
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
streams.add(close);
|
|
739
|
+
res.on("close", close);
|
|
740
|
+
if (initialNotices)
|
|
741
|
+
res.write(`event: notices\ndata: ${JSON.stringify({ notices: initialNotices })}\n\n`);
|
|
742
|
+
res.write(": connected\n\n");
|
|
743
|
+
return;
|
|
744
|
+
}
|
|
436
745
|
if (path === "/hub/v1/rooms") {
|
|
437
746
|
if (method === "GET") {
|
|
438
747
|
signedIn();
|
|
439
|
-
|
|
748
|
+
const view = await guard(() => rooms.listAuthorized(ctx));
|
|
749
|
+
// Cached clients draw every row as a direct agent conversation. New roomList() opts into group rows.
|
|
750
|
+
if (query.get("v") !== "2")
|
|
751
|
+
return send(res, 200, { rooms: view.rooms.map(room => ({ ...room, ...quota.roomProjection(room, view.grantProof) })) });
|
|
752
|
+
const groups = await guard(() => groupRooms.list(ctx));
|
|
753
|
+
const pending = invitations ? await guard(() => invitations.pending(ctx)) : null;
|
|
754
|
+
return send(res, 200, { ...groups, invitations: pending?.invitations.length ?? 0, rooms: [...groups.rooms, ...view.rooms.map(room => ({ ...directRoomView(room, rooms.presence(room.exposureId), directUnread(core, room)), ...quota.roomProjection(room, view.grantProof) }))] });
|
|
440
755
|
}
|
|
441
756
|
if (method === "POST") {
|
|
442
757
|
csrf();
|
|
443
758
|
const b = await body();
|
|
759
|
+
if (b.exposureId === undefined)
|
|
760
|
+
return send(res, 200, await guard(() => groupRooms.create(ctx, b)));
|
|
444
761
|
const room = await guard(() => rooms.open(ctx, uuid(b.exposureId), uuid(b.grantId)));
|
|
445
|
-
return send(res, 200, { room: { id: room.id, exposureId: room.exposureId, grantId: room.grantId, state: room.state, exposureName: room.exposure.displayName, features: rooms.features(room.exposure.fleetId), ...quota.
|
|
762
|
+
return send(res, 200, { room: { id: room.id, exposureId: room.exposureId, grantId: room.grantId, state: room.state, exposureName: room.exposure.displayName, features: rooms.features(room.exposure.fleetId), ...quota.roomProjection(room, room.grantProof) } });
|
|
763
|
+
}
|
|
764
|
+
throw new HttpError(405, "method");
|
|
765
|
+
}
|
|
766
|
+
if ((r = m(/^\/hub\/v1\/rooms\/([^/]+)$/))) {
|
|
767
|
+
signedIn();
|
|
768
|
+
const roomId = uuid(r[1]);
|
|
769
|
+
if (groupRooms.has(roomId)) {
|
|
770
|
+
if (method === "GET") {
|
|
771
|
+
const view = await guard(() => groupRooms.detail(ctx, roomId));
|
|
772
|
+
const invited = invitations && view.me.role === "manager" && !view.room.archived ? await guard(() => invitations.forRoom(ctx, roomId)) : [];
|
|
773
|
+
return send(res, 200, { ...view, invited });
|
|
774
|
+
}
|
|
775
|
+
if (method === "PATCH") {
|
|
776
|
+
csrf();
|
|
777
|
+
const b = await body();
|
|
778
|
+
return send(res, 200, await guard(() => groupRooms.patch(ctx, roomId, b)));
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
else if (method === "GET") {
|
|
782
|
+
const room = await guard(() => rooms.view(ctx, roomId));
|
|
783
|
+
const person = personKeyString(room.asker), name = signedIn().displayName;
|
|
784
|
+
return send(res, 200, { room: directRoomView(room, rooms.presence(room.exposureId), directUnread(core, room)), me: { id: person, role: "member" },
|
|
785
|
+
members: [{ id: person, kind: "person", name, role: "member", presence: "online" }, { id: room.exposureId, kind: "agent", name: room.exposureName,
|
|
786
|
+
owner: { name: room.ownerName }, role: "member", presence: rooms.presence(room.exposureId), canAsk: room.state === "active" }],
|
|
787
|
+
settings: { allMention: false, historyForNew: "all" }, invited: [] });
|
|
446
788
|
}
|
|
447
789
|
throw new HttpError(405, "method");
|
|
448
790
|
}
|
|
791
|
+
if ((r = m(/^\/hub\/v1\/rooms\/([^/]+)\/members(?:\/([^/]+))?$/))) {
|
|
792
|
+
csrf();
|
|
793
|
+
const roomId = uuid(r[1]), memberId = r[2] ? uuid(r[2]) : null;
|
|
794
|
+
if (method === "POST" && !memberId) {
|
|
795
|
+
const b = await body();
|
|
796
|
+
return send(res, 200, await guard(() => groupRooms.add(ctx, roomId, b)));
|
|
797
|
+
}
|
|
798
|
+
if (method === "DELETE" && memberId)
|
|
799
|
+
return send(res, 200, await guard(() => groupRooms.changeMember(ctx, roomId, memberId)));
|
|
800
|
+
if (method === "PATCH" && memberId) {
|
|
801
|
+
const b = await body();
|
|
802
|
+
if (Object.keys(b).length !== 1 || !["manager", "member"].includes(String(b.role)))
|
|
803
|
+
throw new HubProtocolError("invalid");
|
|
804
|
+
return send(res, 200, await guard(() => groupRooms.changeMember(ctx, roomId, memberId, b.role)));
|
|
805
|
+
}
|
|
806
|
+
throw new HttpError(405, "method");
|
|
807
|
+
}
|
|
808
|
+
if ((r = m(/^\/hub\/v1\/rooms\/([^/]+)\/read$/))) {
|
|
809
|
+
if (method !== "POST")
|
|
810
|
+
throw new HttpError(405, "method");
|
|
811
|
+
csrf();
|
|
812
|
+
const b = await body(), roomId = uuid(r[1]);
|
|
813
|
+
if (groupRooms.has(roomId))
|
|
814
|
+
return send(res, 200, await guard(() => groupRooms.markRead(ctx, roomId, b.upTo)));
|
|
815
|
+
const room = await guard(() => rooms.view(ctx, roomId));
|
|
816
|
+
markDirectRead(core, roomId, str(b.upTo));
|
|
817
|
+
groupRooms.publish({ type: "unread.changed", roomId, data: { roomId }, audiencePerson: personKeyString(room.asker) });
|
|
818
|
+
return send(res, 200, { ok: true });
|
|
819
|
+
}
|
|
449
820
|
if ((r = m(/^\/hub\/v1\/rooms\/([^/]+)\/buttons$/))) {
|
|
450
821
|
if (method !== "POST")
|
|
451
822
|
throw new HttpError(405, "method");
|
|
@@ -455,18 +826,43 @@ export function createHubHttp(deps, sql) {
|
|
|
455
826
|
}
|
|
456
827
|
if ((r = m(/^\/hub\/v1\/rooms\/([^/]+)\/messages$/))) {
|
|
457
828
|
const roomId = uuid(r[1]);
|
|
829
|
+
if (groupRooms.has(roomId)) {
|
|
830
|
+
if (method === "GET") {
|
|
831
|
+
signedIn();
|
|
832
|
+
return send(res, 200, await guard(() => groupRooms.messages(ctx, roomId, query.get("before"), int(query.get("limit") ?? "50"))));
|
|
833
|
+
}
|
|
834
|
+
if (method === "POST") {
|
|
835
|
+
csrf();
|
|
836
|
+
const b = await body();
|
|
837
|
+
return send(res, 200, await guard(() => groupRooms.post(ctx, roomId, b)));
|
|
838
|
+
}
|
|
839
|
+
throw new HttpError(405, "method");
|
|
840
|
+
}
|
|
458
841
|
if (method === "GET") {
|
|
459
842
|
const s = signedIn();
|
|
460
843
|
// #3226 B + G: the room comes with its entries, fresh each poll — its view (state, grant's end, what its link
|
|
461
844
|
// negotiated) and its quota projection (G; absent when hidden or not shared).
|
|
462
|
-
const { entries, room: view } = await guard(() => rooms.readPage(ctx, roomId, int(query.get("after") ?? "0"), s.sessionId));
|
|
463
|
-
|
|
845
|
+
const { entries, room: view, grantProof, more } = await guard(() => rooms.readPage(ctx, roomId, int(query.get("after") ?? "0"), s.sessionId, query.has("after") ? undefined : { before: query.get("before"), limit: int(query.get("limit") ?? "50") }));
|
|
846
|
+
let messages = directMessages(view, entries, s.displayName);
|
|
847
|
+
const cursor = query.get("before"), index = cursor ? messages.findIndex(m => m.id === cursor) : -1;
|
|
848
|
+
if (index >= 0)
|
|
849
|
+
messages = messages.slice(0, index);
|
|
850
|
+
const limit = int(query.get("limit") ?? "50"), overflow = !query.has("after") && messages.length > limit;
|
|
851
|
+
if (overflow)
|
|
852
|
+
messages = messages.slice(-limit);
|
|
853
|
+
return send(res, 200, { entries, room: { ...view, ...quota.roomProjection(view, grantProof) }, messages, more: (more ?? false) || overflow });
|
|
464
854
|
}
|
|
465
855
|
if (method === "POST") {
|
|
466
856
|
csrf();
|
|
467
857
|
const b = await body();
|
|
468
858
|
const files = b.files === undefined ? [] : Array.isArray(b.files) && b.files.length <= 10 ? b.files.map(uuid) : (() => { throw new HubProtocolError("invalid"); })();
|
|
469
|
-
|
|
859
|
+
if (b.mentions !== undefined && (!Array.isArray(b.mentions) || b.mentions.length))
|
|
860
|
+
throw new HubProtocolError("invalid");
|
|
861
|
+
const receipt = await guard(() => rooms.ask(ctx, roomId, uuid(b.idempotencyKey), typeof b.text === "string" ? b.text : "", files));
|
|
862
|
+
const room = await guard(() => rooms.view(ctx, roomId));
|
|
863
|
+
groupRooms.publish({ type: "message.added", roomId, data: { roomId, messageId: receipt.messageId }, audiencePerson: personKeyString(room.asker) });
|
|
864
|
+
return send(res, 200, { id: receipt.messageId, roomId, at: receipt.at, author: { kind: "person", id: personKeyString(room.asker), name: signedIn().displayName },
|
|
865
|
+
text: typeof b.text === "string" ? b.text : "", mentions: [], idempotencyKey: b.idempotencyKey, receipt });
|
|
470
866
|
}
|
|
471
867
|
throw new HttpError(405, "method");
|
|
472
868
|
}
|
|
@@ -636,7 +1032,9 @@ export function createHubHttp(deps, sql) {
|
|
|
636
1032
|
void req;
|
|
637
1033
|
throw new HttpError(404, "not-found");
|
|
638
1034
|
}
|
|
639
|
-
function fail(res, e) {
|
|
1035
|
+
function fail(res, e, method, path) {
|
|
1036
|
+
if (e instanceof HubRoomRefusal)
|
|
1037
|
+
return send(res, e.status, { code: e.code, ...e.details });
|
|
640
1038
|
if (e instanceof HubEnrolmentCodeLimit)
|
|
641
1039
|
return send(res, 429, { code: "backpressure", reason: e.reason });
|
|
642
1040
|
if (e instanceof CompanyJoinCodeRefusal)
|
|
@@ -649,10 +1047,21 @@ export function createHubHttp(deps, sql) {
|
|
|
649
1047
|
return send(res, 401, { code: "signed-out" });
|
|
650
1048
|
if (e instanceof HttpError)
|
|
651
1049
|
return send(res, e.status, { code: e.code });
|
|
1050
|
+
if (e instanceof HubSharingPaused)
|
|
1051
|
+
return send(res, 409, { code: "sharing-paused" });
|
|
1052
|
+
if (e instanceof HubMemberAddressError)
|
|
1053
|
+
return send(res, STATUS[e.code] ?? 503, { code: e.code });
|
|
652
1054
|
if (e instanceof HubAttachmentRefused)
|
|
653
1055
|
return send(res, 415, { code: e.refusal });
|
|
654
1056
|
if (e instanceof HubProtocolError) {
|
|
655
1057
|
const status = STATUS[e.code] ?? 400;
|
|
1058
|
+
if (status === 503) {
|
|
1059
|
+
try {
|
|
1060
|
+
deps.log?.("warn", "Hub HTTP unavailable", { method, path, code: e.code,
|
|
1061
|
+
cause: e.cause instanceof HubGroupPolicyError ? e.cause.message : e.code });
|
|
1062
|
+
}
|
|
1063
|
+
catch { /* diagnostics cannot replace the response */ }
|
|
1064
|
+
}
|
|
656
1065
|
return send(res, status, { code: e.code }, status === 429 ? { "Retry-After": "10" } : {});
|
|
657
1066
|
}
|
|
658
1067
|
send(res, 500, { code: "unavailable" });
|
|
@@ -669,7 +1078,7 @@ export function createHubHttp(deps, sql) {
|
|
|
669
1078
|
if (deps.companyJoin && live() && handleCompanyJoin(req, res, deps.companyJoin))
|
|
670
1079
|
return true;
|
|
671
1080
|
if (path.startsWith("/hub/v1/")) {
|
|
672
|
-
void api(req, res, path, url.searchParams).catch((e) => fail(res, e));
|
|
1081
|
+
void api(req, res, path, url.searchParams).catch((e) => fail(res, e, method, path));
|
|
673
1082
|
return true;
|
|
674
1083
|
}
|
|
675
1084
|
if (method !== "GET" && method !== "HEAD")
|
|
@@ -710,12 +1119,27 @@ export function createHubHttp(deps, sql) {
|
|
|
710
1119
|
throw new HubProtocolError("stale");
|
|
711
1120
|
rooms.noteLink(link);
|
|
712
1121
|
quota.noteLink(link);
|
|
1122
|
+
groupRooms.agents.noteLink(link);
|
|
713
1123
|
deps.pairingNotices?.noteLink(link);
|
|
714
1124
|
const reply = { v: 1, requestId: frame.requestId, linkEpoch: link.linkEpoch };
|
|
715
1125
|
switch (frame.type) {
|
|
1126
|
+
case "room.answer":
|
|
1127
|
+
try {
|
|
1128
|
+
return { ...reply, type: "room.answer-ack", payload: await groupRooms.agents.answer(frame.payload, link) };
|
|
1129
|
+
}
|
|
1130
|
+
catch (error) {
|
|
1131
|
+
// No ACK means the Fleet retains its frozen answer. A pause or transient read must not break its member link.
|
|
1132
|
+
if (error instanceof HubProtocolError && ["unavailable", "backpressure", "revoked", "not-found", "stale"].includes(error.code))
|
|
1133
|
+
return;
|
|
1134
|
+
throw error;
|
|
1135
|
+
}
|
|
1136
|
+
case "agent.state":
|
|
1137
|
+
groupRooms.agents.state(frame.payload, link);
|
|
1138
|
+
return;
|
|
716
1139
|
case "exposure.snapshot":
|
|
717
1140
|
await catalog.receiveSnapshot(frame.payload, link, frame.requestId);
|
|
718
1141
|
quota.prune();
|
|
1142
|
+
groupRooms.agents.publicationChanged(link.fleetId);
|
|
719
1143
|
return;
|
|
720
1144
|
case "exposure.quota":
|
|
721
1145
|
quota.receive(frame.payload, link);
|
|
@@ -725,8 +1149,16 @@ export function createHubHttp(deps, sql) {
|
|
|
725
1149
|
throw new HubProtocolError("incompatible");
|
|
726
1150
|
deps.pairingNotices.acknowledgeFleet(link, frame.payload.id);
|
|
727
1151
|
return;
|
|
728
|
-
case "receipt":
|
|
729
|
-
|
|
1152
|
+
case "receipt": {
|
|
1153
|
+
const payload = rooms.receipt(frame.payload, link);
|
|
1154
|
+
directChanged(payload.messageId, false);
|
|
1155
|
+
return { ...reply, type: "receipt", payload };
|
|
1156
|
+
}
|
|
1157
|
+
case "answer": {
|
|
1158
|
+
const payload = await rooms.answer(frame.payload, link);
|
|
1159
|
+
directChanged(payload.messageId, true);
|
|
1160
|
+
return { ...reply, type: "receipt", payload };
|
|
1161
|
+
}
|
|
730
1162
|
case "authorize.request": return { ...reply, type: "authorize.result", payload: await policy.authorize(frame.payload, link) };
|
|
731
1163
|
case "reconcile": {
|
|
732
1164
|
const page = rooms.reconcile(frame.payload, link);
|
|
@@ -740,27 +1172,38 @@ export function createHubHttp(deps, sql) {
|
|
|
740
1172
|
case "error": return;
|
|
741
1173
|
}
|
|
742
1174
|
}
|
|
1175
|
+
function directChanged(messageId, answer) {
|
|
1176
|
+
const row = core.atomic(db => db.prepare("SELECT room_id,asker FROM hub_messages WHERE id=?").get(messageId));
|
|
1177
|
+
if (!row)
|
|
1178
|
+
return;
|
|
1179
|
+
groupRooms.publish({ type: answer ? "message.added" : "message.updated", roomId: row.room_id, data: { roomId: row.room_id, messageId: answer ? `${messageId}:answer` : messageId }, audiencePerson: row.asker });
|
|
1180
|
+
groupRooms.publish({ type: "unread.changed", roomId: row.room_id, data: { roomId: row.room_id }, audiencePerson: row.asker });
|
|
1181
|
+
}
|
|
743
1182
|
function flushSoon(link, attempt = 0) {
|
|
744
1183
|
const t = setTimeout(() => {
|
|
745
1184
|
if (!live() || !link.current())
|
|
746
1185
|
return;
|
|
747
1186
|
void rooms.flush(link.fleetId).then((sent) => { if (!sent && attempt < 5)
|
|
748
1187
|
flushSoon(link, attempt + 1); }, () => { });
|
|
1188
|
+
groupRooms.agents.wake();
|
|
749
1189
|
void deps.pairingNotices?.flushFleet(link).catch(() => { });
|
|
750
1190
|
}, attempt === 0 ? 0 : 100 * attempt);
|
|
751
1191
|
t.unref?.();
|
|
752
1192
|
}
|
|
753
1193
|
rooms.buttons.start();
|
|
1194
|
+
groupRooms.agents.wake();
|
|
1195
|
+
groupRooms.assistant.start();
|
|
754
1196
|
return {
|
|
755
1197
|
directorySessions: Object.freeze({
|
|
756
1198
|
recentAuthentication: actor => sessions.recentAuthentication(actor),
|
|
757
1199
|
prepareDirectoryRotation: (token, actor) => sessions.prepareDirectoryRotation(token, actor),
|
|
758
1200
|
completeDirectoryRotation: (rotation, operationId) => sessions.completeDirectoryRotation(rotation, operationId),
|
|
759
1201
|
}),
|
|
760
|
-
handle, receive,
|
|
761
|
-
...(deps.
|
|
762
|
-
|
|
763
|
-
|
|
1202
|
+
handle, receive, memberClosed: fleetId => { if (live())
|
|
1203
|
+
groupRooms.agents.disconnected(fleetId); }, features: Object.freeze(["rooms-v1", "room-ask-v1", ...(deps.roomAssistant && deps.assistantAdmin ? ["room-assistant-v1"] : []), ...(deps.refreshAuthorization ? ["sharing-pause-v1"] : []), ...(deps.groupHttp ? [GROUP_POLICY_FEATURE, ...(deps.pairingNotices ? ["quick-pairing-v1"] : [])] : []), ...(grantSubjectsOffered() ? ["grant-subjects-v1"] : []),
|
|
1204
|
+
...(deps.directoryNotices ? ["directory-security-notices-v1"] : []), ...(deps.memberAddressNotices ? ["member-address-notices-v1"] : []), ...(deps.directorySettings ? [HUB_DIRECTORY_SETTINGS_FEATURE, HUB_DIRECTORY_CA_FEATURE, HUB_DIRECTORY_EDITOR_FEATURE] : [])]),
|
|
1205
|
+
async close() { closed = true; grantSearch.close(); for (const end of streams)
|
|
1206
|
+
end(); await groupRooms.close(); await rooms.buttons.close(); rooms.forget(); quota.close(); },
|
|
764
1207
|
};
|
|
765
1208
|
}
|
|
766
1209
|
//# sourceMappingURL=compose.js.map
|