@pellux/goodvibes-sdk 0.38.0 → 1.1.0
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/contracts/artifacts/operator-contract.json +4468 -916
- package/dist/daemon.d.ts +2 -0
- package/dist/daemon.d.ts.map +1 -1
- package/dist/daemon.js +4 -0
- package/dist/events/communication.d.ts +1 -1
- package/dist/events/surfaces.d.ts +25 -3
- package/dist/events/surfaces.d.ts.map +1 -1
- package/dist/events/surfaces.js +22 -1
- package/dist/events/workflows.d.ts +7 -6
- package/dist/events/workflows.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/platform/agents/archetypes.d.ts.map +1 -1
- package/dist/platform/agents/archetypes.js +7 -0
- package/dist/platform/agents/index.d.ts +1 -0
- package/dist/platform/agents/index.d.ts.map +1 -1
- package/dist/platform/agents/index.js +1 -0
- package/dist/platform/agents/orchestrator-runner.d.ts +16 -3
- package/dist/platform/agents/orchestrator-runner.d.ts.map +1 -1
- package/dist/platform/agents/orchestrator-runner.js +20 -6
- package/dist/platform/agents/orchestrator.d.ts +42 -10
- package/dist/platform/agents/orchestrator.d.ts.map +1 -1
- package/dist/platform/agents/orchestrator.js +68 -20
- package/dist/platform/agents/planner-decomposition-runner.d.ts +38 -0
- package/dist/platform/agents/planner-decomposition-runner.d.ts.map +1 -0
- package/dist/platform/agents/planner-decomposition-runner.js +113 -0
- package/dist/platform/agents/turn-knowledge-injection.d.ts +88 -3
- package/dist/platform/agents/turn-knowledge-injection.d.ts.map +1 -1
- package/dist/platform/agents/turn-knowledge-injection.js +147 -30
- package/dist/platform/agents/worktree.d.ts +126 -8
- package/dist/platform/agents/worktree.d.ts.map +1 -1
- package/dist/platform/agents/worktree.js +240 -19
- package/dist/platform/agents/wrfc-controller.d.ts +24 -1
- package/dist/platform/agents/wrfc-controller.d.ts.map +1 -1
- package/dist/platform/agents/wrfc-controller.js +161 -35
- package/dist/platform/agents/wrfc-gate-runtime.d.ts +9 -0
- package/dist/platform/agents/wrfc-gate-runtime.d.ts.map +1 -1
- package/dist/platform/agents/wrfc-gate-runtime.js +7 -3
- package/dist/platform/agents/wrfc-gates.d.ts +1 -1
- package/dist/platform/agents/wrfc-gates.d.ts.map +1 -1
- package/dist/platform/agents/wrfc-gates.js +7 -1
- package/dist/platform/agents/wrfc-types.d.ts +23 -3
- package/dist/platform/agents/wrfc-types.d.ts.map +1 -1
- package/dist/platform/automation/types.d.ts +9 -1
- package/dist/platform/automation/types.d.ts.map +1 -1
- package/dist/platform/calendar/calendar-api-shared.d.ts +25 -0
- package/dist/platform/calendar/calendar-api-shared.d.ts.map +1 -0
- package/dist/platform/calendar/calendar-api-shared.js +100 -0
- package/dist/platform/calendar/calendar-connector.d.ts +79 -0
- package/dist/platform/calendar/calendar-connector.d.ts.map +1 -0
- package/dist/platform/calendar/calendar-connector.js +155 -0
- package/dist/platform/calendar/google-calendar-api.d.ts +25 -0
- package/dist/platform/calendar/google-calendar-api.d.ts.map +1 -0
- package/dist/platform/calendar/google-calendar-api.js +89 -0
- package/dist/platform/calendar/http-fetch-adapter.d.ts +25 -0
- package/dist/platform/calendar/http-fetch-adapter.d.ts.map +1 -0
- package/dist/platform/calendar/http-fetch-adapter.js +25 -0
- package/dist/platform/calendar/ics-parser.d.ts +35 -0
- package/dist/platform/calendar/ics-parser.d.ts.map +1 -0
- package/dist/platform/calendar/ics-parser.js +236 -0
- package/dist/platform/calendar/index.d.ts +41 -0
- package/dist/platform/calendar/index.d.ts.map +1 -0
- package/dist/platform/calendar/index.js +49 -0
- package/dist/platform/calendar/merged-calendar-model.d.ts +67 -0
- package/dist/platform/calendar/merged-calendar-model.d.ts.map +1 -0
- package/dist/platform/calendar/merged-calendar-model.js +181 -0
- package/dist/platform/calendar/microsoft-graph-api.d.ts +25 -0
- package/dist/platform/calendar/microsoft-graph-api.d.ts.map +1 -0
- package/dist/platform/calendar/microsoft-graph-api.js +95 -0
- package/dist/platform/calendar/oauth-flow.d.ts +62 -0
- package/dist/platform/calendar/oauth-flow.d.ts.map +1 -0
- package/dist/platform/calendar/oauth-flow.js +305 -0
- package/dist/platform/calendar/oauth-providers.d.ts +43 -0
- package/dist/platform/calendar/oauth-providers.d.ts.map +1 -0
- package/dist/platform/calendar/oauth-providers.js +120 -0
- package/dist/platform/calendar/oauth-token-store.d.ts +72 -0
- package/dist/platform/calendar/oauth-token-store.d.ts.map +1 -0
- package/dist/platform/calendar/oauth-token-store.js +189 -0
- package/dist/platform/calendar/oauth-types.d.ts +274 -0
- package/dist/platform/calendar/oauth-types.d.ts.map +1 -0
- package/dist/platform/calendar/oauth-types.js +22 -0
- package/dist/platform/calendar/rrule.d.ts +39 -0
- package/dist/platform/calendar/rrule.d.ts.map +1 -0
- package/dist/platform/calendar/rrule.js +261 -0
- package/dist/platform/calendar/subscription-store.d.ts +118 -0
- package/dist/platform/calendar/subscription-store.d.ts.map +1 -0
- package/dist/platform/calendar/subscription-store.js +293 -0
- package/dist/platform/calendar/types.d.ts +170 -0
- package/dist/platform/calendar/types.d.ts.map +1 -0
- package/dist/platform/calendar/types.js +21 -0
- package/dist/platform/companion/companion-chat-attachments.d.ts +29 -0
- package/dist/platform/companion/companion-chat-attachments.d.ts.map +1 -0
- package/dist/platform/companion/companion-chat-attachments.js +121 -0
- package/dist/platform/companion/companion-chat-branching.d.ts +66 -0
- package/dist/platform/companion/companion-chat-branching.d.ts.map +1 -0
- package/dist/platform/companion/companion-chat-branching.js +142 -0
- package/dist/platform/companion/companion-chat-broker-bridge.d.ts +40 -0
- package/dist/platform/companion/companion-chat-broker-bridge.d.ts.map +1 -0
- package/dist/platform/companion/companion-chat-broker-bridge.js +14 -0
- package/dist/platform/companion/companion-chat-broker-sync.d.ts +38 -0
- package/dist/platform/companion/companion-chat-broker-sync.d.ts.map +1 -0
- package/dist/platform/companion/companion-chat-broker-sync.js +80 -0
- package/dist/platform/companion/companion-chat-gc.d.ts +63 -0
- package/dist/platform/companion/companion-chat-gc.d.ts.map +1 -0
- package/dist/platform/companion/companion-chat-gc.js +38 -0
- package/dist/platform/companion/companion-chat-manager.d.ts +91 -23
- package/dist/platform/companion/companion-chat-manager.d.ts.map +1 -1
- package/dist/platform/companion/companion-chat-manager.js +195 -223
- package/dist/platform/companion/companion-chat-persistence.d.ts +9 -1
- package/dist/platform/companion/companion-chat-persistence.d.ts.map +1 -1
- package/dist/platform/companion/companion-chat-persistence.js +10 -2
- package/dist/platform/companion/companion-chat-routes.d.ts +2 -1
- package/dist/platform/companion/companion-chat-routes.d.ts.map +1 -1
- package/dist/platform/companion/companion-chat-routes.js +113 -4
- package/dist/platform/companion/companion-chat-turn-execution.d.ts +61 -0
- package/dist/platform/companion/companion-chat-turn-execution.d.ts.map +1 -0
- package/dist/platform/companion/companion-chat-turn-execution.js +107 -0
- package/dist/platform/companion/companion-chat-types.d.ts +67 -0
- package/dist/platform/companion/companion-chat-types.d.ts.map +1 -1
- package/dist/platform/config/credential-status.d.ts +28 -0
- package/dist/platform/config/credential-status.d.ts.map +1 -0
- package/dist/platform/config/credential-status.js +75 -0
- package/dist/platform/config/index.d.ts +25 -0
- package/dist/platform/config/index.d.ts.map +1 -1
- package/dist/platform/config/index.js +18 -0
- package/dist/platform/config/manager.d.ts +9 -0
- package/dist/platform/config/manager.d.ts.map +1 -1
- package/dist/platform/config/manager.js +21 -2
- package/dist/platform/config/migrations.d.ts +48 -0
- package/dist/platform/config/migrations.d.ts.map +1 -0
- package/dist/platform/config/migrations.js +54 -0
- package/dist/platform/config/schema-domain-core.d.ts +10 -1
- package/dist/platform/config/schema-domain-core.d.ts.map +1 -1
- package/dist/platform/config/schema-domain-core.js +46 -3
- package/dist/platform/config/schema-domain-runtime.d.ts +8 -0
- package/dist/platform/config/schema-domain-runtime.d.ts.map +1 -1
- package/dist/platform/config/schema-domain-runtime.js +32 -0
- package/dist/platform/config/schema-types.d.ts +21 -7
- package/dist/platform/config/schema-types.d.ts.map +1 -1
- package/dist/platform/config/schema.d.ts.map +1 -1
- package/dist/platform/config/schema.js +2 -0
- package/dist/platform/control-plane/approval-broker.d.ts +11 -0
- package/dist/platform/control-plane/approval-broker.d.ts.map +1 -1
- package/dist/platform/control-plane/approval-broker.js +17 -1
- package/dist/platform/control-plane/approval-hunk-apply.d.ts +77 -0
- package/dist/platform/control-plane/approval-hunk-apply.d.ts.map +1 -0
- package/dist/platform/control-plane/approval-hunk-apply.js +80 -0
- package/dist/platform/control-plane/gateway-disabled-response.d.ts +20 -0
- package/dist/platform/control-plane/gateway-disabled-response.d.ts.map +1 -0
- package/dist/platform/control-plane/gateway-disabled-response.js +24 -0
- package/dist/platform/control-plane/gateway-scope-enforcement.d.ts +68 -0
- package/dist/platform/control-plane/gateway-scope-enforcement.d.ts.map +1 -0
- package/dist/platform/control-plane/gateway-scope-enforcement.js +91 -0
- package/dist/platform/control-plane/gateway-utils.d.ts +17 -0
- package/dist/platform/control-plane/gateway-utils.d.ts.map +1 -1
- package/dist/platform/control-plane/gateway-utils.js +30 -0
- package/dist/platform/control-plane/gateway.d.ts +12 -2
- package/dist/platform/control-plane/gateway.d.ts.map +1 -1
- package/dist/platform/control-plane/gateway.js +27 -31
- package/dist/platform/control-plane/index.d.ts +8 -1
- package/dist/platform/control-plane/index.d.ts.map +1 -1
- package/dist/platform/control-plane/index.js +8 -0
- package/dist/platform/control-plane/invoke-input-validation.d.ts +56 -0
- package/dist/platform/control-plane/invoke-input-validation.d.ts.map +1 -0
- package/dist/platform/control-plane/invoke-input-validation.js +163 -0
- package/dist/platform/control-plane/method-catalog-admin.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog-admin.js +12 -1
- package/dist/platform/control-plane/method-catalog-calendar.d.ts +16 -0
- package/dist/platform/control-plane/method-catalog-calendar.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog-calendar.js +21 -0
- package/dist/platform/control-plane/method-catalog-channels.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog-channels.js +32 -3
- package/dist/platform/control-plane/method-catalog-control-automation.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog-control-automation.js +19 -34
- package/dist/platform/control-plane/method-catalog-control-companion.d.ts +15 -0
- package/dist/platform/control-plane/method-catalog-control-companion.d.ts.map +1 -0
- package/dist/platform/control-plane/method-catalog-control-companion.js +176 -0
- package/dist/platform/control-plane/method-catalog-control-core.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog-control-core.js +104 -122
- package/dist/platform/control-plane/method-catalog-control.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog-control.js +4 -0
- package/dist/platform/control-plane/method-catalog-email.d.ts +17 -0
- package/dist/platform/control-plane/method-catalog-email.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog-email.js +21 -0
- package/dist/platform/control-plane/method-catalog-events.d.ts +28 -0
- package/dist/platform/control-plane/method-catalog-events.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog-events.js +74 -1
- package/dist/platform/control-plane/method-catalog-fleet.d.ts +24 -0
- package/dist/platform/control-plane/method-catalog-fleet.d.ts.map +1 -0
- package/dist/platform/control-plane/method-catalog-fleet.js +65 -0
- package/dist/platform/control-plane/method-catalog-push.d.ts +30 -0
- package/dist/platform/control-plane/method-catalog-push.d.ts.map +1 -0
- package/dist/platform/control-plane/method-catalog-push.js +80 -0
- package/dist/platform/control-plane/method-catalog-route-reconcile.d.ts +84 -0
- package/dist/platform/control-plane/method-catalog-route-reconcile.d.ts.map +1 -0
- package/dist/platform/control-plane/method-catalog-route-reconcile.js +103 -0
- package/dist/platform/control-plane/method-catalog-runtime.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog-runtime.js +83 -1
- package/dist/platform/control-plane/method-catalog-shared.d.ts +29 -0
- package/dist/platform/control-plane/method-catalog-shared.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog.d.ts +9 -0
- package/dist/platform/control-plane/method-catalog.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog.js +34 -3
- package/dist/platform/control-plane/operator-contract-schemas-admin.d.ts +8 -0
- package/dist/platform/control-plane/operator-contract-schemas-admin.d.ts.map +1 -1
- package/dist/platform/control-plane/operator-contract-schemas-admin.js +22 -1
- package/dist/platform/control-plane/operator-contract-schemas-fleet.d.ts +18 -0
- package/dist/platform/control-plane/operator-contract-schemas-fleet.d.ts.map +1 -0
- package/dist/platform/control-plane/operator-contract-schemas-fleet.js +182 -0
- package/dist/platform/control-plane/operator-contract-schemas-permissions.d.ts.map +1 -1
- package/dist/platform/control-plane/operator-contract-schemas-permissions.js +5 -0
- package/dist/platform/control-plane/operator-contract-schemas-runtime.d.ts +37 -0
- package/dist/platform/control-plane/operator-contract-schemas-runtime.d.ts.map +1 -1
- package/dist/platform/control-plane/operator-contract-schemas-runtime.js +100 -3
- package/dist/platform/control-plane/operator-contract-schemas.d.ts +1 -0
- package/dist/platform/control-plane/operator-contract-schemas.d.ts.map +1 -1
- package/dist/platform/control-plane/operator-contract-schemas.js +1 -0
- package/dist/platform/control-plane/operator-contract.d.ts.map +1 -1
- package/dist/platform/control-plane/operator-contract.js +8 -0
- package/dist/platform/control-plane/routes/checkpoints.d.ts +39 -0
- package/dist/platform/control-plane/routes/checkpoints.d.ts.map +1 -0
- package/dist/platform/control-plane/routes/checkpoints.js +166 -0
- package/dist/platform/control-plane/routes/fleet.d.ts +53 -0
- package/dist/platform/control-plane/routes/fleet.d.ts.map +1 -0
- package/dist/platform/control-plane/routes/fleet.js +153 -0
- package/dist/platform/control-plane/routes/gateway-verb-error.d.ts +30 -0
- package/dist/platform/control-plane/routes/gateway-verb-error.d.ts.map +1 -0
- package/dist/platform/control-plane/routes/gateway-verb-error.js +36 -0
- package/dist/platform/control-plane/routes/index.d.ts +0 -6
- package/dist/platform/control-plane/routes/index.d.ts.map +1 -1
- package/dist/platform/control-plane/routes/index.js +5 -5
- package/dist/platform/control-plane/routes/invocation-params.d.ts +23 -0
- package/dist/platform/control-plane/routes/invocation-params.d.ts.map +1 -0
- package/dist/platform/control-plane/routes/invocation-params.js +9 -0
- package/dist/platform/control-plane/routes/push.d.ts +26 -0
- package/dist/platform/control-plane/routes/push.d.ts.map +1 -0
- package/dist/platform/control-plane/routes/push.js +104 -0
- package/dist/platform/control-plane/routes/register-gateway-verb-groups.d.ts +31 -0
- package/dist/platform/control-plane/routes/register-gateway-verb-groups.d.ts.map +1 -0
- package/dist/platform/control-plane/routes/register-gateway-verb-groups.js +16 -0
- package/dist/platform/control-plane/routes/register-w3-s2.d.ts +26 -0
- package/dist/platform/control-plane/routes/register-w3-s2.d.ts.map +1 -0
- package/dist/platform/control-plane/routes/register-w3-s2.js +8 -0
- package/dist/platform/control-plane/routes/session-search.d.ts +37 -0
- package/dist/platform/control-plane/routes/session-search.d.ts.map +1 -0
- package/dist/platform/control-plane/routes/session-search.js +113 -0
- package/dist/platform/control-plane/session-broker-gc.d.ts +16 -0
- package/dist/platform/control-plane/session-broker-gc.d.ts.map +1 -1
- package/dist/platform/control-plane/session-broker-gc.js +23 -6
- package/dist/platform/control-plane/session-broker-helpers.d.ts +3 -3
- package/dist/platform/control-plane/session-broker-helpers.d.ts.map +1 -1
- package/dist/platform/control-plane/session-broker-inputs.d.ts +18 -0
- package/dist/platform/control-plane/session-broker-inputs.d.ts.map +1 -1
- package/dist/platform/control-plane/session-broker-inputs.js +34 -0
- package/dist/platform/control-plane/session-broker-sessions.d.ts +102 -3
- package/dist/platform/control-plane/session-broker-sessions.d.ts.map +1 -1
- package/dist/platform/control-plane/session-broker-sessions.js +179 -5
- package/dist/platform/control-plane/session-broker-state.d.ts +20 -1
- package/dist/platform/control-plane/session-broker-state.d.ts.map +1 -1
- package/dist/platform/control-plane/session-broker-state.js +67 -5
- package/dist/platform/control-plane/session-broker.d.ts +51 -38
- package/dist/platform/control-plane/session-broker.d.ts.map +1 -1
- package/dist/platform/control-plane/session-broker.js +183 -75
- package/dist/platform/control-plane/session-store-importer.d.ts +57 -0
- package/dist/platform/control-plane/session-store-importer.d.ts.map +1 -0
- package/dist/platform/control-plane/session-store-importer.js +227 -0
- package/dist/platform/control-plane/session-types.d.ts +142 -7
- package/dist/platform/control-plane/session-types.d.ts.map +1 -1
- package/dist/platform/core/execution-plan.d.ts +43 -1
- package/dist/platform/core/execution-plan.d.ts.map +1 -1
- package/dist/platform/core/execution-plan.js +46 -10
- package/dist/platform/core/index.d.ts +1 -0
- package/dist/platform/core/index.d.ts.map +1 -1
- package/dist/platform/core/index.js +1 -0
- package/dist/platform/core/orchestrator-runtime.d.ts +23 -3
- package/dist/platform/core/orchestrator-runtime.d.ts.map +1 -1
- package/dist/platform/core/orchestrator-tool-runtime.d.ts +7 -0
- package/dist/platform/core/orchestrator-tool-runtime.d.ts.map +1 -1
- package/dist/platform/core/orchestrator-tool-runtime.js +10 -0
- package/dist/platform/core/orchestrator-turn-loop.d.ts +13 -6
- package/dist/platform/core/orchestrator-turn-loop.d.ts.map +1 -1
- package/dist/platform/core/orchestrator-turn-loop.js +29 -22
- package/dist/platform/core/orchestrator.d.ts +16 -10
- package/dist/platform/core/orchestrator.d.ts.map +1 -1
- package/dist/platform/core/orchestrator.js +23 -8
- package/dist/platform/core/plan-decomposition.d.ts +196 -0
- package/dist/platform/core/plan-decomposition.d.ts.map +1 -0
- package/dist/platform/core/plan-decomposition.js +417 -0
- package/dist/platform/core/plan-proposal.d.ts +39 -0
- package/dist/platform/core/plan-proposal.d.ts.map +1 -1
- package/dist/platform/core/wrfc-routing.d.ts +1 -0
- package/dist/platform/core/wrfc-routing.d.ts.map +1 -1
- package/dist/platform/core/wrfc-routing.js +51 -1
- package/dist/platform/daemon/boot.d.ts +69 -0
- package/dist/platform/daemon/boot.d.ts.map +1 -0
- package/dist/platform/daemon/boot.js +61 -0
- package/dist/platform/daemon/cli.js +2 -1
- package/dist/platform/daemon/control-plane.d.ts.map +1 -1
- package/dist/platform/daemon/control-plane.js +50 -1
- package/dist/platform/daemon/facade-composition.d.ts.map +1 -1
- package/dist/platform/daemon/facade-composition.js +6 -0
- package/dist/platform/daemon/facade.d.ts +15 -6
- package/dist/platform/daemon/facade.d.ts.map +1 -1
- package/dist/platform/daemon/facade.js +48 -43
- package/dist/platform/daemon/http/router-route-contexts.d.ts +1 -0
- package/dist/platform/daemon/http/router-route-contexts.d.ts.map +1 -1
- package/dist/platform/daemon/http/router-route-contexts.js +1 -0
- package/dist/platform/daemon/http/router-session-broker-adapter.d.ts +13 -0
- package/dist/platform/daemon/http/router-session-broker-adapter.d.ts.map +1 -0
- package/dist/platform/daemon/http/router-session-broker-adapter.js +27 -0
- package/dist/platform/daemon/http/router.d.ts +2 -1
- package/dist/platform/daemon/http/router.d.ts.map +1 -1
- package/dist/platform/daemon/http/router.js +42 -40
- package/dist/platform/daemon/http/runtime-route-types.d.ts +42 -4
- package/dist/platform/daemon/http/runtime-route-types.d.ts.map +1 -1
- package/dist/platform/daemon/http/webui-serving.d.ts +68 -0
- package/dist/platform/daemon/http/webui-serving.d.ts.map +1 -0
- package/dist/platform/daemon/http/webui-serving.js +230 -0
- package/dist/platform/daemon/index.d.ts +2 -0
- package/dist/platform/daemon/index.d.ts.map +1 -1
- package/dist/platform/daemon/index.js +1 -0
- package/dist/platform/daemon/service-manager.d.ts +16 -0
- package/dist/platform/daemon/service-manager.d.ts.map +1 -1
- package/dist/platform/daemon/service-manager.js +79 -15
- package/dist/platform/intelligence/tree-sitter/service.d.ts.map +1 -1
- package/dist/platform/intelligence/tree-sitter/service.js +16 -2
- package/dist/platform/knowledge/browser-history/readers.d.ts.map +1 -1
- package/dist/platform/knowledge/browser-history/readers.js +15 -5
- package/dist/platform/knowledge/knowledge-api.d.ts +1 -1
- package/dist/platform/knowledge/project-planning/service.d.ts +14 -1
- package/dist/platform/knowledge/project-planning/service.d.ts.map +1 -1
- package/dist/platform/knowledge/project-planning/service.js +77 -0
- package/dist/platform/knowledge/project-planning/types.d.ts +32 -0
- package/dist/platform/knowledge/project-planning/types.d.ts.map +1 -1
- package/dist/platform/orchestration/bookkeeping.d.ts +12 -0
- package/dist/platform/orchestration/bookkeeping.d.ts.map +1 -0
- package/dist/platform/orchestration/bookkeeping.js +91 -0
- package/dist/platform/orchestration/budget.d.ts +2 -2
- package/dist/platform/orchestration/cancellation.d.ts +2 -2
- package/dist/platform/orchestration/controller-compat.d.ts +16 -3
- package/dist/platform/orchestration/controller-compat.d.ts.map +1 -1
- package/dist/platform/orchestration/controller-compat.js +18 -4
- package/dist/platform/orchestration/dirty-guard.js +1 -1
- package/dist/platform/orchestration/engine.d.ts +26 -1
- package/dist/platform/orchestration/engine.d.ts.map +1 -1
- package/dist/platform/orchestration/engine.js +229 -25
- package/dist/platform/orchestration/index.d.ts +6 -4
- package/dist/platform/orchestration/index.d.ts.map +1 -1
- package/dist/platform/orchestration/index.js +3 -2
- package/dist/platform/orchestration/persistence.d.ts.map +1 -1
- package/dist/platform/orchestration/persistence.js +6 -3
- package/dist/platform/orchestration/phase-runner.d.ts +33 -6
- package/dist/platform/orchestration/phase-runner.d.ts.map +1 -1
- package/dist/platform/orchestration/phase-runner.js +98 -25
- package/dist/platform/orchestration/proposal-workstream.d.ts +56 -0
- package/dist/platform/orchestration/proposal-workstream.d.ts.map +1 -0
- package/dist/platform/orchestration/proposal-workstream.js +76 -0
- package/dist/platform/orchestration/scheduler.d.ts +20 -1
- package/dist/platform/orchestration/scheduler.d.ts.map +1 -1
- package/dist/platform/orchestration/scheduler.js +16 -0
- package/dist/platform/orchestration/types.d.ts +289 -4
- package/dist/platform/orchestration/types.d.ts.map +1 -1
- package/dist/platform/orchestration/types.js +32 -0
- package/dist/platform/orchestration/worktree-isolation.d.ts +33 -0
- package/dist/platform/orchestration/worktree-isolation.d.ts.map +1 -0
- package/dist/platform/orchestration/worktree-isolation.js +248 -0
- package/dist/platform/presentation/glyphs.d.ts +91 -0
- package/dist/platform/presentation/glyphs.d.ts.map +1 -0
- package/dist/platform/presentation/glyphs.js +93 -0
- package/dist/platform/presentation/index.d.ts +28 -0
- package/dist/platform/presentation/index.d.ts.map +1 -0
- package/dist/platform/presentation/index.js +27 -0
- package/dist/platform/presentation/thinking-phrases.d.ts +12 -0
- package/dist/platform/presentation/thinking-phrases.d.ts.map +1 -0
- package/dist/platform/presentation/thinking-phrases.js +32 -0
- package/dist/platform/presentation/tones.d.ts +121 -0
- package/dist/platform/presentation/tones.d.ts.map +1 -0
- package/dist/platform/presentation/tones.js +145 -0
- package/dist/platform/presentation/waiting-wording.d.ts +54 -0
- package/dist/platform/presentation/waiting-wording.d.ts.map +1 -0
- package/dist/platform/presentation/waiting-wording.js +51 -0
- package/dist/platform/providers/runtime-snapshot.d.ts.map +1 -1
- package/dist/platform/providers/runtime-snapshot.js +12 -2
- package/dist/platform/push/delivery.d.ts +48 -0
- package/dist/platform/push/delivery.d.ts.map +1 -0
- package/dist/platform/push/delivery.js +117 -0
- package/dist/platform/push/encryption.d.ts +41 -0
- package/dist/platform/push/encryption.d.ts.map +1 -0
- package/dist/platform/push/encryption.js +82 -0
- package/dist/platform/push/index.d.ts +17 -0
- package/dist/platform/push/index.d.ts.map +1 -0
- package/dist/platform/push/index.js +10 -0
- package/dist/platform/push/service.d.ts +75 -0
- package/dist/platform/push/service.d.ts.map +1 -0
- package/dist/platform/push/service.js +95 -0
- package/dist/platform/push/subscription-store.d.ts +50 -0
- package/dist/platform/push/subscription-store.d.ts.map +1 -0
- package/dist/platform/push/subscription-store.js +123 -0
- package/dist/platform/push/types.d.ts +68 -0
- package/dist/platform/push/types.d.ts.map +1 -0
- package/dist/platform/push/types.js +13 -0
- package/dist/platform/push/vapid.d.ts +54 -0
- package/dist/platform/push/vapid.d.ts.map +1 -0
- package/dist/platform/push/vapid.js +113 -0
- package/dist/platform/runtime/bootstrap-services.d.ts +62 -2
- package/dist/platform/runtime/bootstrap-services.d.ts.map +1 -1
- package/dist/platform/runtime/bootstrap-services.js +217 -50
- package/dist/platform/runtime/daemon-version-compat.d.ts +39 -0
- package/dist/platform/runtime/daemon-version-compat.d.ts.map +1 -0
- package/dist/platform/runtime/daemon-version-compat.js +75 -0
- package/dist/platform/runtime/detached-daemon-runtime.d.ts +26 -0
- package/dist/platform/runtime/detached-daemon-runtime.d.ts.map +1 -0
- package/dist/platform/runtime/detached-daemon-runtime.js +49 -0
- package/dist/platform/runtime/emitters/workflows.d.ts +1 -1
- package/dist/platform/runtime/emitters/workflows.d.ts.map +1 -1
- package/dist/platform/runtime/events/index.d.ts +13 -0
- package/dist/platform/runtime/events/index.d.ts.map +1 -1
- package/dist/platform/runtime/events/index.js +13 -0
- package/dist/platform/runtime/feature-flags/flags.d.ts.map +1 -1
- package/dist/platform/runtime/feature-flags/flags.js +39 -1
- package/dist/platform/runtime/fleet/adapters/agent.d.ts +2 -2
- package/dist/platform/runtime/fleet/adapters/agent.d.ts.map +1 -1
- package/dist/platform/runtime/fleet/adapters/agent.js +4 -4
- package/dist/platform/runtime/fleet/adapters/automation.d.ts +1 -1
- package/dist/platform/runtime/fleet/adapters/automation.js +1 -1
- package/dist/platform/runtime/fleet/adapters/code-index.d.ts +1 -1
- package/dist/platform/runtime/fleet/adapters/code-index.js +1 -1
- package/dist/platform/runtime/fleet/adapters/orchestration.d.ts +40 -18
- package/dist/platform/runtime/fleet/adapters/orchestration.d.ts.map +1 -1
- package/dist/platform/runtime/fleet/adapters/orchestration.js +138 -34
- package/dist/platform/runtime/fleet/adapters/schedule.d.ts +4 -4
- package/dist/platform/runtime/fleet/adapters/schedule.js +4 -4
- package/dist/platform/runtime/fleet/adapters/trigger.d.ts +3 -4
- package/dist/platform/runtime/fleet/adapters/trigger.d.ts.map +1 -1
- package/dist/platform/runtime/fleet/adapters/trigger.js +3 -4
- package/dist/platform/runtime/fleet/adapters/wrfc.d.ts +13 -0
- package/dist/platform/runtime/fleet/adapters/wrfc.d.ts.map +1 -1
- package/dist/platform/runtime/fleet/adapters/wrfc.js +49 -2
- package/dist/platform/runtime/fleet/registry.d.ts +7 -7
- package/dist/platform/runtime/fleet/registry.d.ts.map +1 -1
- package/dist/platform/runtime/fleet/registry.js +41 -7
- package/dist/platform/runtime/fleet/types.d.ts +9 -9
- package/dist/platform/runtime/fleet/types.d.ts.map +1 -1
- package/dist/platform/runtime/memory-spine/client.d.ts +127 -0
- package/dist/platform/runtime/memory-spine/client.d.ts.map +1 -0
- package/dist/platform/runtime/memory-spine/client.js +113 -0
- package/dist/platform/runtime/memory-spine/index.d.ts +11 -0
- package/dist/platform/runtime/memory-spine/index.d.ts.map +1 -0
- package/dist/platform/runtime/memory-spine/index.js +10 -0
- package/dist/platform/runtime/operator-client.d.ts +20 -2
- package/dist/platform/runtime/operator-client.d.ts.map +1 -1
- package/dist/platform/runtime/operator-client.js +11 -1
- package/dist/platform/runtime/provider-accounts/registry.d.ts.map +1 -1
- package/dist/platform/runtime/provider-accounts/registry.js +11 -1
- package/dist/platform/runtime/services.d.ts +11 -9
- package/dist/platform/runtime/services.d.ts.map +1 -1
- package/dist/platform/runtime/services.js +24 -9
- package/dist/platform/runtime/session-spine/client.d.ts +234 -0
- package/dist/platform/runtime/session-spine/client.d.ts.map +1 -0
- package/dist/platform/runtime/session-spine/client.js +449 -0
- package/dist/platform/runtime/session-spine/index.d.ts +12 -0
- package/dist/platform/runtime/session-spine/index.d.ts.map +1 -0
- package/dist/platform/runtime/session-spine/index.js +11 -0
- package/dist/platform/runtime/session-spine/union-cache.d.ts +225 -0
- package/dist/platform/runtime/session-spine/union-cache.d.ts.map +1 -0
- package/dist/platform/runtime/session-spine/union-cache.js +333 -0
- package/dist/platform/runtime/shell-command-ops.d.ts +3 -1
- package/dist/platform/runtime/shell-command-ops.d.ts.map +1 -1
- package/dist/platform/runtime/transports/daemon-http-client-validators.d.ts.map +1 -1
- package/dist/platform/runtime/transports/daemon-http-client-validators.js +22 -0
- package/dist/platform/runtime/transports/daemon-http-client.d.ts.map +1 -1
- package/dist/platform/runtime/transports/daemon-http-client.js +25 -2
- package/dist/platform/runtime/transports/http-types.d.ts +9 -2
- package/dist/platform/runtime/transports/http-types.d.ts.map +1 -1
- package/dist/platform/state/canonical-memory.d.ts +95 -0
- package/dist/platform/state/canonical-memory.d.ts.map +1 -0
- package/dist/platform/state/canonical-memory.js +155 -0
- package/dist/platform/state/code-index-chunking.js +1 -1
- package/dist/platform/state/code-index-db.d.ts +1 -1
- package/dist/platform/state/code-index-reindex.d.ts +73 -0
- package/dist/platform/state/code-index-reindex.d.ts.map +1 -0
- package/dist/platform/state/code-index-reindex.js +156 -0
- package/dist/platform/state/code-index-store.d.ts.map +1 -1
- package/dist/platform/state/code-index-store.js +11 -3
- package/dist/platform/state/index.d.ts +8 -0
- package/dist/platform/state/index.d.ts.map +1 -1
- package/dist/platform/state/index.js +4 -0
- package/dist/platform/state/memory-recall-contract.d.ts +118 -0
- package/dist/platform/state/memory-recall-contract.d.ts.map +1 -0
- package/dist/platform/state/memory-recall-contract.js +170 -0
- package/dist/platform/state/memory-registry.d.ts +8 -0
- package/dist/platform/state/memory-registry.d.ts.map +1 -1
- package/dist/platform/state/memory-registry.js +10 -0
- package/dist/platform/state/memory-store.d.ts +2 -0
- package/dist/platform/state/memory-store.d.ts.map +1 -1
- package/dist/platform/state/memory-store.js +4 -0
- package/dist/platform/state/memory-vector-store.d.ts.map +1 -1
- package/dist/platform/state/memory-vector-store.js +14 -3
- package/dist/platform/state/sqlite-store.d.ts +2 -0
- package/dist/platform/state/sqlite-store.d.ts.map +1 -1
- package/dist/platform/state/sqlite-store.js +4 -0
- package/dist/platform/state/sqlite-vec-loader.d.ts +1 -1
- package/dist/platform/state/sqlite-vec-loader.js +1 -1
- package/dist/platform/state/vibe-projection.d.ts +67 -0
- package/dist/platform/state/vibe-projection.d.ts.map +1 -0
- package/dist/platform/state/vibe-projection.js +115 -0
- package/dist/platform/tools/agent/index.d.ts.map +1 -1
- package/dist/platform/tools/agent/index.js +8 -0
- package/dist/platform/tools/agent/manager.d.ts +22 -10
- package/dist/platform/tools/agent/manager.d.ts.map +1 -1
- package/dist/platform/tools/agent/manager.js +13 -7
- package/dist/platform/tools/agent/schema.d.ts +26 -0
- package/dist/platform/tools/agent/schema.d.ts.map +1 -1
- package/dist/platform/tools/agent/schema.js +2 -2
- package/dist/platform/tools/agent/wrfc-batch-policy.d.ts +13 -0
- package/dist/platform/tools/agent/wrfc-batch-policy.d.ts.map +1 -1
- package/dist/platform/tools/agent/wrfc-batch-policy.js +60 -0
- package/dist/platform/tools/exec/runtime.d.ts +10 -0
- package/dist/platform/tools/exec/runtime.d.ts.map +1 -1
- package/dist/platform/tools/exec/runtime.js +27 -10
- package/dist/platform/tools/exec/schema.d.ts +2 -2
- package/dist/platform/tools/exec/schema.d.ts.map +1 -1
- package/dist/platform/tools/exec/schema.js +2 -1
- package/dist/platform/tools/fetch/runtime.d.ts +1 -1
- package/dist/platform/tools/index.d.ts +2 -0
- package/dist/platform/tools/index.d.ts.map +1 -1
- package/dist/platform/tools/index.js +2 -0
- package/dist/platform/tools/registry.d.ts +1 -1
- package/dist/platform/tools/registry.js +1 -1
- package/dist/platform/tools/state/index.d.ts +9 -0
- package/dist/platform/tools/state/index.d.ts.map +1 -1
- package/dist/platform/tools/state/index.js +60 -3
- package/dist/platform/types/foundation-contract.d.ts +1 -1
- package/dist/platform/types/foundation-contract.d.ts.map +1 -1
- package/dist/platform/types/index.d.ts +1 -1
- package/dist/platform/types/index.d.ts.map +1 -1
- package/dist/platform/types/tools.d.ts +1 -1
- package/dist/platform/utils/request-body.d.ts.map +1 -1
- package/dist/platform/utils/request-body.js +50 -5
- package/dist/platform/version.js +1 -1
- package/package.json +25 -9
- package/dist/platform/control-plane/routes/automation.d.ts +0 -3
- package/dist/platform/control-plane/routes/automation.d.ts.map +0 -1
- package/dist/platform/control-plane/routes/automation.js +0 -63
- package/dist/platform/control-plane/routes/context.d.ts +0 -2
- package/dist/platform/control-plane/routes/context.d.ts.map +0 -1
- package/dist/platform/control-plane/routes/context.js +0 -1
- package/dist/platform/control-plane/routes/operator.d.ts +0 -8
- package/dist/platform/control-plane/routes/operator.d.ts.map +0 -1
- package/dist/platform/control-plane/routes/operator.js +0 -415
- package/dist/platform/control-plane/routes/remote.d.ts +0 -3
- package/dist/platform/control-plane/routes/remote.d.ts.map +0 -1
- package/dist/platform/control-plane/routes/remote.js +0 -35
- package/dist/platform/control-plane/routes/sessions.d.ts +0 -3
- package/dist/platform/control-plane/routes/sessions.d.ts.map +0 -1
- package/dist/platform/control-plane/routes/sessions.js +0 -43
- package/dist/platform/control-plane/routes/tasks.d.ts +0 -3
- package/dist/platform/control-plane/routes/tasks.d.ts.map +0 -1
- package/dist/platform/control-plane/routes/tasks.js +0 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway-utils.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/gateway-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AAC1F,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAE5G,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"gateway-utils.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/gateway-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AAC1F,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAE5G,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAG3D,eAAO,MAAM,qBAAqB,EAAE,wBAMnC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAAS,kBAAkB,EAexD,CAAC;AAEF,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,UAAU,CAAC,EAAE,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AkB,EAAE,GAAG,SAAS,GAAG,kBAAkB,EAAE,CAGhH;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,4BAA4B,GAAG,OAAO,CAQ3E;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,6BAA6B,EACpC,OAAO,EAAE,+BAA+B,GACvC,OAAO,CAcT;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,6BAA6B,GAAG,uBAAuB,CAO9F;AAED,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,wBAAwB,CAAC,EAC9C,GAAG,SAAa,GACf,IAAI,CAUN;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,SAAS,6BAA6B,EAAE,EACtD,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,EAC5D,OAAO,EAAE,+BAA+B,EACxC,aAAa,EAAE,WAAW,CAAC,kBAAkB,CAAC,GAAG,IAAI,EACrD,OAAO,CAAC,EAAE,MAAM,GACf,IAAI,CAUN"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isRuntimeEventDomain } from '../runtime/events/index.js';
|
|
2
|
+
import { clientMayReceiveEventDomain } from './gateway-scope-enforcement.js';
|
|
2
3
|
export const DEFAULT_SERVER_CONFIG = {
|
|
3
4
|
enabled: false,
|
|
4
5
|
host: '127.0.0.1',
|
|
@@ -95,3 +96,32 @@ export function pruneDisconnectedClientRecords(clients, now = Date.now()) {
|
|
|
95
96
|
clients.delete(client.id);
|
|
96
97
|
}
|
|
97
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Replay recent traffic to a freshly-connected client. Mirrors live delivery:
|
|
101
|
+
* canReplayEventToClient applies the kind/route/surface/domain-name filters, and
|
|
102
|
+
* the EVENT_DOMAIN broadcast-domain filter is applied on top so a domain-narrowed
|
|
103
|
+
* client is not handed a replayed broadcast (e.g. session-update) for a domain it
|
|
104
|
+
* did not subscribe to.
|
|
105
|
+
*
|
|
106
|
+
* `replayDomains` MUST be the same null-or-set value the caller registered on the
|
|
107
|
+
* live client (`LiveControlPlaneClient.domains`) — null when the client did NOT
|
|
108
|
+
* opt into narrowing (deliver-all, matching live), a `Set` when it did. Do NOT
|
|
109
|
+
* derive this from `options.domains` here: by the time options reaches this
|
|
110
|
+
* function it has already been normalized (empty/undefined domains fall back to
|
|
111
|
+
* DEFAULT_DOMAINS, which excludes e.g. 'permissions'), so re-deriving from it
|
|
112
|
+
* would always look "explicit" and silently narrow every default consumer's
|
|
113
|
+
* replay — the bug this parameter exists to prevent.
|
|
114
|
+
*/
|
|
115
|
+
export function replayRecentTraffic(recentEvents, send, options, replayDomains, sinceId) {
|
|
116
|
+
const sinceIndex = sinceId ? recentEvents.findIndex((event) => event.id === sinceId) : -1;
|
|
117
|
+
const window = sinceIndex >= 0
|
|
118
|
+
? recentEvents.slice(0, sinceIndex).reverse()
|
|
119
|
+
: recentEvents.slice(0, 20).reverse();
|
|
120
|
+
for (const recentEvent of window) {
|
|
121
|
+
if (!canReplayEventToClient(recentEvent, options))
|
|
122
|
+
continue;
|
|
123
|
+
if (!clientMayReceiveEventDomain(replayDomains, recentEvent.event))
|
|
124
|
+
continue;
|
|
125
|
+
send(recentEvent.event, recentEvent.payload, recentEvent.id);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RuntimeStore } from '../runtime/store/index.js';
|
|
2
2
|
import type { RuntimeEventBus, RuntimeEventDomain } from '../runtime/events/index.js';
|
|
3
3
|
import type { ControlPlaneClientDescriptor, ControlPlaneServerConfig, ControlPlaneSurfaceMessage } from './types.js';
|
|
4
|
-
import type
|
|
4
|
+
import { type FeatureFlagReader } from '../runtime/feature-flags/index.js';
|
|
5
5
|
import { DEFAULT_DOMAINS, type ControlPlaneRecentEvent } from './gateway-utils.js';
|
|
6
6
|
export type { ControlPlaneRecentEvent } from './gateway-utils.js';
|
|
7
7
|
export interface ControlPlaneGatewayConfig {
|
|
@@ -19,6 +19,8 @@ export interface ControlPlaneEventStreamOptions {
|
|
|
19
19
|
readonly principalId?: string | undefined;
|
|
20
20
|
readonly principalKind?: 'user' | 'bot' | 'service' | 'token' | undefined;
|
|
21
21
|
readonly scopes?: readonly string[] | undefined;
|
|
22
|
+
/** Admin token — scopes collapse; sees all channels. */
|
|
23
|
+
readonly admin?: boolean | undefined;
|
|
22
24
|
readonly sessionId?: string | undefined;
|
|
23
25
|
readonly routeId?: string | undefined;
|
|
24
26
|
readonly surfaceId?: string | undefined;
|
|
@@ -30,6 +32,15 @@ interface LiveControlPlaneClient {
|
|
|
30
32
|
readonly kind: 'tui' | 'web' | 'slack' | 'discord' | 'ntfy' | 'webhook' | 'homeassistant' | 'telegram' | 'google-chat' | 'signal' | 'whatsapp' | 'telephony' | 'imessage' | 'msteams' | 'bluebubbles' | 'mattermost' | 'matrix' | 'daemon';
|
|
31
33
|
readonly surfaceId?: string | undefined;
|
|
32
34
|
readonly routeId?: string | undefined;
|
|
35
|
+
/** Principal scopes (SSE/WS); `admin` collapses scopes (sees every channel). */
|
|
36
|
+
readonly scopes?: readonly string[] | undefined;
|
|
37
|
+
readonly admin?: boolean | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Subscribed domains for the broadcast (`publishEvent`) fan-out. `null` =
|
|
40
|
+
* deliver-all (client did not opt into narrowing); a non-null set narrows to
|
|
41
|
+
* tagged events in the set. For WS this is a live ref to the subscription set.
|
|
42
|
+
*/
|
|
43
|
+
readonly domains: ReadonlySet<RuntimeEventDomain> | null;
|
|
33
44
|
readonly send: (event: string, payload: unknown, id?: string) => void;
|
|
34
45
|
}
|
|
35
46
|
export declare class ControlPlaneGateway {
|
|
@@ -93,7 +104,6 @@ export declare class ControlPlaneGateway {
|
|
|
93
104
|
subscribeWebSocketClient(clientId: string, domains: readonly RuntimeEventDomain[]): void;
|
|
94
105
|
unsubscribeWebSocketClient(clientId: string, domains?: readonly RuntimeEventDomain[]): void;
|
|
95
106
|
closeWebSocketClient(clientId: string, reason?: string): void;
|
|
96
|
-
private replayRecentTraffic;
|
|
97
107
|
createEventStream(request: Request, options?: ControlPlaneEventStreamOptions): Response;
|
|
98
108
|
renderWebUi(authTokenHint?: string): Response;
|
|
99
109
|
private _scheduleControlPlaneSync;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/gateway.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/gateway.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AActF,OAAO,KAAK,EACV,4BAA4B,EAC5B,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,iBAAiB,EAA4C,MAAM,mCAAmC,CAAC;AACrH,OAAO,EACL,eAAe,EAUf,KAAK,uBAAuB,EAE7B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAElE,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,UAAU,CAAC,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,CAAC;IACzD,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,CAAC;IACxD,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,GAAG,SAAS,C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B,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,kBAAkB,EAAE,GAAG,IAAI;IAqBxF,0BAA0B,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,kBAAkB,EAAE,GAAG,IAAI;IAc3F,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAkB,GAAG,IAAI;IA2CtE,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,GAAE,8BAAmC,GAAG,QAAQ;IAiM3F,WAAW,CAAC,aAAa,SAAK,GAAG,QAAQ;IAOzC,OAAO,CAAC,yBAAyB;IAcjC,OAAO,CAAC,aAAa;CAmBtB;AAGD,OAAO,EAAE,eAAe,IAAI,2BAA2B,EAAE,CAAC"}
|
|
@@ -3,8 +3,10 @@ import { logger } from '../utils/logger.js';
|
|
|
3
3
|
import { createDomainDispatch } from '../runtime/store/index.js';
|
|
4
4
|
import { emitControlPlaneAuthGranted, emitControlPlaneClientConnected, emitControlPlaneClientDisconnected, emitControlPlaneSubscriptionCreated, emitControlPlaneSubscriptionDropped, emitStreamSubscriberConnected, emitStreamSubscriberDisconnected, } from '../runtime/emitters/index.js';
|
|
5
5
|
import { renderControlPlaneGatewayWebUi } from './gateway-web-ui.js';
|
|
6
|
+
import { buildGatewayDisabledResponseBody } from './gateway-disabled-response.js';
|
|
7
|
+
import { CHANNEL_REQUIRED_SCOPE, clientMayReceiveEventDomain, clientMaySeeScopedChannel } from './gateway-scope-enforcement.js';
|
|
6
8
|
import { isFeatureGateEnabled, requireFeatureGate } from '../runtime/feature-flags/index.js';
|
|
7
|
-
import { DEFAULT_DOMAINS, DEFAULT_SERVER_CONFIG,
|
|
9
|
+
import { DEFAULT_DOMAINS, DEFAULT_SERVER_CONFIG, hasReplayScope, normalizeRuntimeDomains, pruneDisconnectedClientRecords, replayRecentTraffic, serializeEnvelope, stripReplayScope, toClientDescriptor, } from './gateway-utils.js';
|
|
8
10
|
export class ControlPlaneGateway {
|
|
9
11
|
runtimeBus;
|
|
10
12
|
dispatch;
|
|
@@ -14,7 +16,6 @@ export class ControlPlaneGateway {
|
|
|
14
16
|
liveClients = new Map();
|
|
15
17
|
websocketClients = new Map();
|
|
16
18
|
recentMessages = [];
|
|
17
|
-
// Circular ring buffer for O(1) insert instead of O(n) unshift.
|
|
18
19
|
_recentEventsRing;
|
|
19
20
|
_recentEventsHead = 0;
|
|
20
21
|
_recentEventsCount = 0;
|
|
@@ -31,7 +32,6 @@ export class ControlPlaneGateway {
|
|
|
31
32
|
out.push(entry);
|
|
32
33
|
}
|
|
33
34
|
else if (process.env.NODE_ENV !== 'production') {
|
|
34
|
-
// Dev-only: undefined slot despite valid count — ring buffer accounting bug.
|
|
35
35
|
logger.error('[ControlPlaneGateway] recentEvents: undefined slot at ring index', { head: this._recentEventsHead, count: this._recentEventsCount, index: idx, offset: i });
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -170,6 +170,7 @@ export class ControlPlaneGateway {
|
|
|
170
170
|
if (!this.isEnabled())
|
|
171
171
|
return;
|
|
172
172
|
const record = this.rememberEvent(event, payload, filter);
|
|
173
|
+
const requiredScope = CHANNEL_REQUIRED_SCOPE[event];
|
|
173
174
|
for (const client of this.liveClients.values()) {
|
|
174
175
|
if (filter?.clientKind && client.kind !== filter.clientKind)
|
|
175
176
|
continue;
|
|
@@ -179,6 +180,11 @@ export class ControlPlaneGateway {
|
|
|
179
180
|
continue;
|
|
180
181
|
if (filter?.surfaceId && client.surfaceId !== filter.surfaceId)
|
|
181
182
|
continue;
|
|
183
|
+
if (requiredScope && !clientMaySeeScopedChannel(client, requiredScope))
|
|
184
|
+
continue;
|
|
185
|
+
// Domain filter, AND-ed with scope (null = deliver-all; untagged = delivered).
|
|
186
|
+
if (!clientMayReceiveEventDomain(client.domains, event))
|
|
187
|
+
continue;
|
|
182
188
|
client.send(event, payload, record.id);
|
|
183
189
|
}
|
|
184
190
|
}
|
|
@@ -256,18 +262,24 @@ export class ControlPlaneGateway {
|
|
|
256
262
|
},
|
|
257
263
|
};
|
|
258
264
|
const traceId = `control-plane:${clientId}`;
|
|
265
|
+
// Live ref to the WS subscription set, shared with the liveClient (null = deliver-all).
|
|
266
|
+
const wsDomains = new Set();
|
|
267
|
+
const explicitDomains = (options.domains?.length ?? 0) > 0;
|
|
259
268
|
this.clients.set(clientId, clientRecord);
|
|
260
269
|
this.liveClients.set(clientId, {
|
|
261
270
|
clientId,
|
|
262
271
|
kind: options.clientKind ?? 'web',
|
|
263
272
|
surfaceId: options.surfaceId,
|
|
264
273
|
routeId: options.routeId,
|
|
274
|
+
scopes: options.scopes,
|
|
275
|
+
admin: options.admin,
|
|
276
|
+
domains: explicitDomains ? wsDomains : null,
|
|
265
277
|
send,
|
|
266
278
|
});
|
|
267
279
|
this.websocketClients.set(clientId, {
|
|
268
280
|
clientId,
|
|
269
281
|
traceId,
|
|
270
|
-
domains:
|
|
282
|
+
domains: wsDomains,
|
|
271
283
|
unsubscribers: new Map(),
|
|
272
284
|
});
|
|
273
285
|
this.dispatch?.syncControlPlaneState({
|
|
@@ -309,7 +321,7 @@ export class ControlPlaneGateway {
|
|
|
309
321
|
}
|
|
310
322
|
this.subscribeWebSocketClient(clientId, selectedDomains);
|
|
311
323
|
send('ready', { clientId, domains: selectedDomains, transport: 'websocket' });
|
|
312
|
-
this.
|
|
324
|
+
replayRecentTraffic(this.recentEvents, send, { ...options, clientId, domains: selectedDomains }, explicitDomains ? wsDomains : null);
|
|
313
325
|
return { clientId, domains: selectedDomains };
|
|
314
326
|
}
|
|
315
327
|
touchWebSocketClient(clientId, metadata = {}) {
|
|
@@ -443,20 +455,9 @@ export class ControlPlaneGateway {
|
|
|
443
455
|
connectionState: [...this.clients.values()].some((client) => client.connected) ? 'connected' : 'disconnected',
|
|
444
456
|
}, 'control-plane.gateway.ws-disconnect');
|
|
445
457
|
}
|
|
446
|
-
replayRecentTraffic(send, options, sinceId) {
|
|
447
|
-
const sinceIndex = sinceId ? this.recentEvents.findIndex((event) => event.id === sinceId) : -1;
|
|
448
|
-
const recentEvents = sinceIndex >= 0
|
|
449
|
-
? this.recentEvents.slice(0, sinceIndex).reverse()
|
|
450
|
-
: this.recentEvents.slice(0, 20).reverse();
|
|
451
|
-
for (const recentEvent of recentEvents) {
|
|
452
|
-
if (!canReplayEventToClient(recentEvent, options))
|
|
453
|
-
continue;
|
|
454
|
-
send(recentEvent.event, recentEvent.payload, recentEvent.id);
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
458
|
createEventStream(request, options = {}) {
|
|
458
459
|
if (!this.isEnabled()) {
|
|
459
|
-
return Response.json(
|
|
460
|
+
return Response.json(buildGatewayDisabledResponseBody(), { status: 503 });
|
|
460
461
|
}
|
|
461
462
|
if (!this.runtimeBus) {
|
|
462
463
|
return Response.json({ error: 'Runtime event bus unavailable' }, { status: 503 });
|
|
@@ -527,16 +528,11 @@ export class ControlPlaneGateway {
|
|
|
527
528
|
});
|
|
528
529
|
}
|
|
529
530
|
let teardown = () => { };
|
|
530
|
-
//
|
|
531
|
-
// enqueues to drop subsequent chunks before any consumer has pulled. Raise HWM to
|
|
532
|
-
// 256 chunks so initial handshake + recent-traffic replay + live events fit without
|
|
533
|
-
// tripping the backpressure guard for a healthy consumer.
|
|
531
|
+
// HWM 256 (default 1 drops handshake/replay chunks before the consumer pulls).
|
|
534
532
|
const stream = new ReadableStream({
|
|
535
533
|
start: (controller) => {
|
|
536
534
|
const send = (event, payload, id) => {
|
|
537
|
-
//
|
|
538
|
-
// desiredSize <= 0 means the consumer is falling behind; dropping prevents
|
|
539
|
-
// unbounded memory growth from enqueued-but-unread chunks.
|
|
535
|
+
// Backpressure guard: drop when the consumer is falling behind (desiredSize<=0).
|
|
540
536
|
if ((controller.desiredSize ?? 1) <= 0)
|
|
541
537
|
return;
|
|
542
538
|
controller.enqueue(encoder.encode(`${id ? `id: ${id}\n` : ''}event: ${event}\ndata: ${JSON.stringify(payload)}\n\n`));
|
|
@@ -556,14 +552,18 @@ export class ControlPlaneGateway {
|
|
|
556
552
|
const record = this.rememberEvent(domain, serialized);
|
|
557
553
|
send(domain, serialized, record.id);
|
|
558
554
|
}));
|
|
555
|
+
// Opt-in narrowing (null=deliver-all, never the DEFAULT_DOMAINS fallback); reused below for replay.
|
|
556
|
+
const sseLiveDomains = (options.domains?.length ?? 0) > 0 ? new Set(selectedDomains) : null;
|
|
559
557
|
this.liveClients.set(clientId, {
|
|
560
558
|
clientId,
|
|
561
559
|
kind: options.clientKind ?? 'web',
|
|
562
560
|
surfaceId: options.surfaceId,
|
|
563
561
|
routeId: options.routeId,
|
|
562
|
+
scopes: options.scopes,
|
|
563
|
+
admin: options.admin,
|
|
564
|
+
domains: sseLiveDomains,
|
|
564
565
|
send,
|
|
565
566
|
});
|
|
566
|
-
// emit STREAM_SUBSCRIBER_CONNECTED when the SSE client is registered.
|
|
567
567
|
emitStreamSubscriberConnected(this.runtimeBus, {
|
|
568
568
|
sessionId: options.sessionId ?? 'control-plane',
|
|
569
569
|
source: 'control-plane.gateway',
|
|
@@ -576,7 +576,6 @@ export class ControlPlaneGateway {
|
|
|
576
576
|
const heartbeat = setInterval(() => {
|
|
577
577
|
send('heartbeat', { clientId, ts: Date.now() });
|
|
578
578
|
}, 15_000);
|
|
579
|
-
// Don't block clean process exit.
|
|
580
579
|
heartbeat.unref?.();
|
|
581
580
|
teardown = () => {
|
|
582
581
|
clearInterval(heartbeat);
|
|
@@ -615,7 +614,6 @@ export class ControlPlaneGateway {
|
|
|
615
614
|
clientId,
|
|
616
615
|
reason: 'stream-closed',
|
|
617
616
|
});
|
|
618
|
-
// emit STREAM_SUBSCRIBER_DISCONNECTED when the SSE client tears down.
|
|
619
617
|
emitStreamSubscriberDisconnected(this.runtimeBus, {
|
|
620
618
|
sessionId: options.sessionId ?? 'control-plane',
|
|
621
619
|
source: 'control-plane.gateway',
|
|
@@ -633,7 +631,7 @@ export class ControlPlaneGateway {
|
|
|
633
631
|
controller.close();
|
|
634
632
|
}, { once: true });
|
|
635
633
|
send('ready', { clientId, domains: selectedDomains });
|
|
636
|
-
this.
|
|
634
|
+
replayRecentTraffic(this.recentEvents, send, { ...options, clientId, domains: selectedDomains }, sseLiveDomains, lastEventId);
|
|
637
635
|
},
|
|
638
636
|
cancel: () => {
|
|
639
637
|
teardown();
|
|
@@ -649,7 +647,7 @@ export class ControlPlaneGateway {
|
|
|
649
647
|
}
|
|
650
648
|
renderWebUi(authTokenHint = '') {
|
|
651
649
|
if (!this.isEnabled()) {
|
|
652
|
-
return Response.json(
|
|
650
|
+
return Response.json(buildGatewayDisabledResponseBody(), { status: 503 });
|
|
653
651
|
}
|
|
654
652
|
return renderControlPlaneGatewayWebUi(authTokenHint);
|
|
655
653
|
}
|
|
@@ -675,13 +673,11 @@ export class ControlPlaneGateway {
|
|
|
675
673
|
payload,
|
|
676
674
|
...(replayScope && hasReplayScope(replayScope) ? { replayScope } : {}),
|
|
677
675
|
};
|
|
678
|
-
// O(1) circular ring buffer write — no array shifting.
|
|
679
676
|
this._recentEventsRing[this._recentEventsHead] = record;
|
|
680
677
|
this._recentEventsHead = (this._recentEventsHead + 1) % this._recentEventsCapacity;
|
|
681
678
|
if (this._recentEventsCount < this._recentEventsCapacity)
|
|
682
679
|
this._recentEventsCount++;
|
|
683
680
|
this._lastEventAt = record.createdAt;
|
|
684
|
-
// Debounced: coalesce N events/frame into 1 store sync.
|
|
685
681
|
this._scheduleControlPlaneSync();
|
|
686
682
|
return record;
|
|
687
683
|
}
|
|
@@ -3,11 +3,15 @@ export type { ControlPlaneGatewayConfig, ControlPlaneEventStreamOptions, Control
|
|
|
3
3
|
export { ControlPlaneGateway } from './gateway.js';
|
|
4
4
|
export { GatewayMethodCatalog, } from './method-catalog.js';
|
|
5
5
|
export type { GatewayEventDescriptor, GatewayEventListOptions, GatewayEventTransport, GatewayHttpBinding, GatewayMethodAccess, GatewayMethodDescriptor, GatewayMethodHandler, GatewayMethodInvocation, GatewayMethodInvocationContext, GatewayMethodListOptions, GatewayMethodSource, GatewayMethodTransport, } from './method-catalog.js';
|
|
6
|
-
export type { FindSharedSessionOptions, SharedSessionMessage, SharedSessionParticipant, SharedSessionRecord, SharedSessionSubmission, SteerSharedSessionMessageInput, SubmitSharedSessionMessageInput, } from './session-types.js';
|
|
6
|
+
export type { CreateSharedSessionInput, EnsureSharedSessionInput, FindSharedSessionOptions, ListSharedSessionsOptions, ParticipantRouteAttachInput, RegisterSharedSessionInput, SharedSessionRegisterResult, SharedSessionKind, SharedSessionMessage, SharedSessionParticipant, SharedSessionRecord, SharedSessionStatus, SharedSessionSubmission, SteerSharedSessionMessageInput, SubmitSharedSessionMessageInput, } from './session-types.js';
|
|
7
7
|
export type { SharedSessionCompletion, SharedSessionContinuationRequest, SharedSessionContinuationResult, SharedSessionHelperModelOverride, SharedSessionInputIntent, SharedSessionInputRecord, SharedSessionInputState, SharedSessionRoutingIntent, } from './session-intents.js';
|
|
8
8
|
export { SharedSessionBroker } from './session-broker.js';
|
|
9
|
+
export { discoverLegacySessionSources, importLegacySessionStores, } from './session-store-importer.js';
|
|
10
|
+
export type { LegacySessionSource, ImportLegacySessionsResult, } from './session-store-importer.js';
|
|
9
11
|
export type { SharedApprovalRecord, SharedApprovalAuditRecord, SharedApprovalStatus, RequestSharedApprovalInput, } from './approval-broker.js';
|
|
10
12
|
export { ApprovalBroker } from './approval-broker.js';
|
|
13
|
+
export { buildModifiedEditArgs, readApprovalEditHunks, resolveApprovalHunkSelection, } from './approval-hunk-apply.js';
|
|
14
|
+
export type { EditHunkLike, ApprovalHunkSelectionResolution } from './approval-hunk-apply.js';
|
|
11
15
|
export type { ControlPlaneAuthMode, ControlPlaneAuthSnapshot } from '../../client-auth/control-plane-auth-snapshot.js';
|
|
12
16
|
export type { MessageSource, ConversationMessageEnvelope } from './conversation-message.js';
|
|
13
17
|
export { buildOperatorContract } from './operator-contract.js';
|
|
@@ -17,4 +21,7 @@ export { ARTIFACT_ATTACHMENT_SCHEMA, ARTIFACT_DESCRIPTOR_SCHEMA, } from './opera
|
|
|
17
21
|
export { AUTOMATION_RUN_SCHEMA, ROUTE_BINDING_SCHEMA, } from './operator-contract-schemas-admin.js';
|
|
18
22
|
export { SHARED_SESSION_INPUT_RECORD_SCHEMA, SHARED_SESSION_ROUTING_INTENT_SCHEMA, } from './operator-contract-schemas-runtime.js';
|
|
19
23
|
export { KNOWLEDGE_INJECTION_PROMPT_SCHEMA, KNOWLEDGE_INJECTION_SCHEMA, } from './operator-contract-schemas-knowledge.js';
|
|
24
|
+
export { registerW3S2GatewayMethods } from './routes/register-w3-s2.js';
|
|
25
|
+
export { registerGatewayVerbGroups } from './routes/register-gateway-verb-groups.js';
|
|
26
|
+
export type { GatewayVerbGroupDeps } from './routes/register-gateway-verb-groups.js';
|
|
20
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,yBAAyB,EAAE,8BAA8B,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvH,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EACL,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,8BAA8B,EAC9B,wBAAwB,EACxB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,wBAAwB,EACxB,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,8BAA8B,EAC9B,+BAA+B,GAChC,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,uBAAuB,EACvB,gCAAgC,EAChC,+BAA+B,EAC/B,gCAAgC,EAChC,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EACV,oBAAoB,EACpB,yBAAyB,EACzB,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,YAAY,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,kDAAkD,CAAC;AACvH,YAAY,EAAE,aAAa,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAC5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EACL,gCAAgC,EAChC,0BAA0B,GAC3B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,kCAAkC,EAClC,oCAAoC,GACrC,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,iCAAiC,EACjC,0BAA0B,GAC3B,MAAM,0CAA0C,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,yBAAyB,EAAE,8BAA8B,EAAE,uBAAuB,EAAE,MAAM,cAA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,YAAY,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,kDAAkD,CAAC;AACvH,YAAY,EAAE,aAAa,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAC5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EACL,gCAAgC,EAChC,0BAA0B,GAC3B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,kCAAkC,EAClC,oCAAoC,GACrC,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,iCAAiC,EACjC,0BAA0B,GAC3B,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAIxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AACrF,YAAY,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { ControlPlaneGateway } from './gateway.js';
|
|
2
2
|
export { GatewayMethodCatalog, } from './method-catalog.js';
|
|
3
3
|
export { SharedSessionBroker } from './session-broker.js';
|
|
4
|
+
export { discoverLegacySessionSources, importLegacySessionStores, } from './session-store-importer.js';
|
|
4
5
|
export { ApprovalBroker } from './approval-broker.js';
|
|
6
|
+
export { buildModifiedEditArgs, readApprovalEditHunks, resolveApprovalHunkSelection, } from './approval-hunk-apply.js';
|
|
5
7
|
export { buildOperatorContract } from './operator-contract.js';
|
|
6
8
|
export { dispatchDaemonApiRoutes } from './routes/index.js';
|
|
7
9
|
export { ARTIFACT_ACQUISITION_MODE_SCHEMA, ARTIFACT_FETCH_MODE_SCHEMA, } from './media-contract-schemas.js';
|
|
@@ -9,3 +11,9 @@ export { ARTIFACT_ATTACHMENT_SCHEMA, ARTIFACT_DESCRIPTOR_SCHEMA, } from './opera
|
|
|
9
11
|
export { AUTOMATION_RUN_SCHEMA, ROUTE_BINDING_SCHEMA, } from './operator-contract-schemas-admin.js';
|
|
10
12
|
export { SHARED_SESSION_INPUT_RECORD_SCHEMA, SHARED_SESSION_ROUTING_INTENT_SCHEMA, } from './operator-contract-schemas-runtime.js';
|
|
11
13
|
export { KNOWLEDGE_INJECTION_PROMPT_SCHEMA, KNOWLEDGE_INJECTION_SCHEMA, } from './operator-contract-schemas-knowledge.js';
|
|
14
|
+
// fleet.*/checkpoints.*/sessions.search verb registration (see routes/register-w3-s2.ts).
|
|
15
|
+
export { registerW3S2GatewayMethods } from './routes/register-w3-s2.js';
|
|
16
|
+
// The single verb-group registrar the runtime-services composition root calls:
|
|
17
|
+
// folds in the fleet/checkpoints group above and constructs + wires the
|
|
18
|
+
// browser-push group (see routes/register-gateway-verb-groups.ts).
|
|
19
|
+
export { registerGatewayVerbGroups } from './routes/register-gateway-verb-groups.js';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* invoke-input-validation.ts (see CHANGELOG 1.0.0, Part B)
|
|
3
|
+
*
|
|
4
|
+
* A central, catalog-driven input gate for the gateway invoke layer. Before a
|
|
5
|
+
* resolved verb's handler (or its HTTP delegate) runs, the invocation's params
|
|
6
|
+
* are validated against the method catalog's `inputSchema`, returning an honest
|
|
7
|
+
* 400 instead of letting a wrong-typed or missing-required field reach a handler
|
|
8
|
+
* that would silently coerce or misbehave.
|
|
9
|
+
*
|
|
10
|
+
* Scope is deliberately the TYPED subset only:
|
|
11
|
+
* - Object schemas that declare `properties` are structurally validated.
|
|
12
|
+
* - Generic object schemas (object with no `properties`, e.g. an
|
|
13
|
+
* additionalProperties-only "any JSON object") pass through unchanged — the
|
|
14
|
+
* status quo — so no verb is falsely rejected for extra fields.
|
|
15
|
+
* - A verb with no `inputSchema` is untyped and passes through.
|
|
16
|
+
*
|
|
17
|
+
* The validator is lenient on unknown keys (does NOT enforce
|
|
18
|
+
* `additionalProperties: false`): the goal is to reject provable type/shape
|
|
19
|
+
* mismatches, not to tighten every loose handler that historically tolerated
|
|
20
|
+
* extra fields. It reports the first violation it finds.
|
|
21
|
+
*/
|
|
22
|
+
import type { GatewayMethodDescriptor } from './method-catalog-shared.js';
|
|
23
|
+
/** Structured result of a rejected invocation — same 400 shape the router uses. */
|
|
24
|
+
export interface InvokeValidationError {
|
|
25
|
+
readonly code: 'INVALID_INPUT';
|
|
26
|
+
readonly detail: string;
|
|
27
|
+
}
|
|
28
|
+
/** How a descriptor's inputSchema is treated by the validate gate. */
|
|
29
|
+
export type InvokeValidationDisposition = 'validated' | 'generic' | 'untyped';
|
|
30
|
+
/**
|
|
31
|
+
* Classify an inputSchema for both the validate gate and coverage accounting:
|
|
32
|
+
* - 'validated' — an object schema with declared properties (structurally checked)
|
|
33
|
+
* - 'generic' — an object schema with no properties (skipped)
|
|
34
|
+
* - 'untyped' — absent, or a non-object root we do not structurally validate (skipped)
|
|
35
|
+
*/
|
|
36
|
+
export declare function classifyInputSchema(schema: Record<string, unknown> | undefined): InvokeValidationDisposition;
|
|
37
|
+
/**
|
|
38
|
+
* Validate an invocation's params against a verb's inputSchema. Returns an
|
|
39
|
+
* `InvokeValidationError` when a typed schema is violated, or null when the
|
|
40
|
+
* params conform, the schema is generic/untyped, or there is nothing to check.
|
|
41
|
+
*
|
|
42
|
+
* `params` is the request payload the verb receives (the invoke body for
|
|
43
|
+
* body-carrying verbs). `undefined` is treated as an empty object so a schema
|
|
44
|
+
* with required fields honestly reports them missing.
|
|
45
|
+
*/
|
|
46
|
+
export declare function validateInvocationInput(descriptor: GatewayMethodDescriptor, params: unknown): InvokeValidationError | null;
|
|
47
|
+
/** Coverage tallies for the operator contract manifest: how many cataloged verbs
|
|
48
|
+
* the invoke input gate structurally validates vs skips (generic/untyped). */
|
|
49
|
+
export interface InvokeValidationCoverage {
|
|
50
|
+
readonly methods: number;
|
|
51
|
+
readonly validated: number;
|
|
52
|
+
readonly skippedGeneric: number;
|
|
53
|
+
readonly skippedUntyped: number;
|
|
54
|
+
}
|
|
55
|
+
export declare function summarizeInvokeValidationCoverage(methods: readonly GatewayMethodDescriptor[]): InvokeValidationCoverage;
|
|
56
|
+
//# sourceMappingURL=invoke-input-validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoke-input-validation.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/invoke-input-validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAE1E,mFAAmF;AACnF,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,sEAAsE;AACtE,MAAM,MAAM,2BAA2B,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;AAY9E;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,2BAA2B,CAK5G;AAsFD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,uBAAuB,EACnC,MAAM,EAAE,OAAO,GACd,qBAAqB,GAAG,IAAI,CAM9B;AAED;+EAC+E;AAC/E,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,SAAS,uBAAuB,EAAE,GAC1C,wBAAwB,CAY1B"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* invoke-input-validation.ts (see CHANGELOG 1.0.0, Part B)
|
|
3
|
+
*
|
|
4
|
+
* A central, catalog-driven input gate for the gateway invoke layer. Before a
|
|
5
|
+
* resolved verb's handler (or its HTTP delegate) runs, the invocation's params
|
|
6
|
+
* are validated against the method catalog's `inputSchema`, returning an honest
|
|
7
|
+
* 400 instead of letting a wrong-typed or missing-required field reach a handler
|
|
8
|
+
* that would silently coerce or misbehave.
|
|
9
|
+
*
|
|
10
|
+
* Scope is deliberately the TYPED subset only:
|
|
11
|
+
* - Object schemas that declare `properties` are structurally validated.
|
|
12
|
+
* - Generic object schemas (object with no `properties`, e.g. an
|
|
13
|
+
* additionalProperties-only "any JSON object") pass through unchanged — the
|
|
14
|
+
* status quo — so no verb is falsely rejected for extra fields.
|
|
15
|
+
* - A verb with no `inputSchema` is untyped and passes through.
|
|
16
|
+
*
|
|
17
|
+
* The validator is lenient on unknown keys (does NOT enforce
|
|
18
|
+
* `additionalProperties: false`): the goal is to reject provable type/shape
|
|
19
|
+
* mismatches, not to tighten every loose handler that historically tolerated
|
|
20
|
+
* extra fields. It reports the first violation it finds.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* A "generic" object schema declares `type: 'object'` but no `properties` map
|
|
24
|
+
* (e.g. JSON_OBJECT_SCHEMA / an additionalProperties-only bag). Mirrors
|
|
25
|
+
* operator-contract.ts:isGenericObjectSchema so coverage accounting and the gate
|
|
26
|
+
* agree on what counts as typed.
|
|
27
|
+
*/
|
|
28
|
+
function isGenericObjectSchema(schema) {
|
|
29
|
+
return Boolean(schema && schema.type === 'object' && !Object.hasOwn(schema, 'properties'));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Classify an inputSchema for both the validate gate and coverage accounting:
|
|
33
|
+
* - 'validated' — an object schema with declared properties (structurally checked)
|
|
34
|
+
* - 'generic' — an object schema with no properties (skipped)
|
|
35
|
+
* - 'untyped' — absent, or a non-object root we do not structurally validate (skipped)
|
|
36
|
+
*/
|
|
37
|
+
export function classifyInputSchema(schema) {
|
|
38
|
+
if (schema === undefined)
|
|
39
|
+
return 'untyped';
|
|
40
|
+
if (isGenericObjectSchema(schema))
|
|
41
|
+
return 'generic';
|
|
42
|
+
if (schema.type === 'object' && Object.hasOwn(schema, 'properties'))
|
|
43
|
+
return 'validated';
|
|
44
|
+
return 'untyped';
|
|
45
|
+
}
|
|
46
|
+
function schemaLabel(path) {
|
|
47
|
+
return path === '' ? 'value' : path;
|
|
48
|
+
}
|
|
49
|
+
function childPath(path, key) {
|
|
50
|
+
return path === '' ? key : `${path}.${key}`;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Validate `value` against a JSON-schema-like `schema`. Returns a human-readable
|
|
54
|
+
* detail string for the first violation, or null when the value conforms. Schema
|
|
55
|
+
* forms without a `type` keyword (e.g. the empty "any JSON value" schema), or
|
|
56
|
+
* with an unrecognized `type`, are treated as permissive (accept).
|
|
57
|
+
*/
|
|
58
|
+
function validateValue(value, schema, path) {
|
|
59
|
+
if (Array.isArray(schema.anyOf)) {
|
|
60
|
+
for (const branch of schema.anyOf) {
|
|
61
|
+
if (branch && typeof branch === 'object' && validateValue(value, branch, path) === null) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return `${schemaLabel(path)} did not match any of the allowed types`;
|
|
66
|
+
}
|
|
67
|
+
if (Array.isArray(schema.enum) && !schema.enum.includes(value)) {
|
|
68
|
+
return `${schemaLabel(path)} must be one of ${JSON.stringify(schema.enum)}`;
|
|
69
|
+
}
|
|
70
|
+
const type = schema.type;
|
|
71
|
+
if (typeof type !== 'string')
|
|
72
|
+
return null; // no type constraint → accept
|
|
73
|
+
switch (type) {
|
|
74
|
+
case 'string':
|
|
75
|
+
return typeof value === 'string' ? null : `${schemaLabel(path)} must be a string`;
|
|
76
|
+
case 'number':
|
|
77
|
+
case 'integer':
|
|
78
|
+
return typeof value === 'number' && !Number.isNaN(value)
|
|
79
|
+
? null
|
|
80
|
+
: `${schemaLabel(path)} must be a number`;
|
|
81
|
+
case 'boolean':
|
|
82
|
+
return typeof value === 'boolean' ? null : `${schemaLabel(path)} must be a boolean`;
|
|
83
|
+
case 'null':
|
|
84
|
+
return value === null ? null : `${schemaLabel(path)} must be null`;
|
|
85
|
+
case 'array': {
|
|
86
|
+
if (!Array.isArray(value))
|
|
87
|
+
return `${schemaLabel(path)} must be an array`;
|
|
88
|
+
const items = schema.items;
|
|
89
|
+
if (items && typeof items === 'object' && !Array.isArray(items)) {
|
|
90
|
+
for (let i = 0; i < value.length; i++) {
|
|
91
|
+
const detail = validateValue(value[i], items, `${schemaLabel(path)}[${i}]`);
|
|
92
|
+
if (detail)
|
|
93
|
+
return detail;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
case 'object': {
|
|
99
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
100
|
+
return `${schemaLabel(path)} must be an object`;
|
|
101
|
+
}
|
|
102
|
+
const record = value;
|
|
103
|
+
const required = Array.isArray(schema.required) ? schema.required : [];
|
|
104
|
+
for (const key of required) {
|
|
105
|
+
if (typeof key === 'string' && (!(key in record) || record[key] === undefined)) {
|
|
106
|
+
return `${childPath(path, key)} is required`;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const properties = (schema.properties && typeof schema.properties === 'object')
|
|
110
|
+
? schema.properties
|
|
111
|
+
: {};
|
|
112
|
+
for (const [key, propValue] of Object.entries(record)) {
|
|
113
|
+
const propSchema = properties[key];
|
|
114
|
+
if (propSchema && typeof propSchema === 'object' && !Array.isArray(propSchema)) {
|
|
115
|
+
const detail = validateValue(propValue, propSchema, childPath(path, key));
|
|
116
|
+
if (detail)
|
|
117
|
+
return detail;
|
|
118
|
+
}
|
|
119
|
+
// Unknown keys are tolerated (lenient on additionalProperties) so loose
|
|
120
|
+
// handlers that historically accepted extra fields are not broken.
|
|
121
|
+
}
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
default:
|
|
125
|
+
return null; // unrecognized type keyword → accept
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Validate an invocation's params against a verb's inputSchema. Returns an
|
|
130
|
+
* `InvokeValidationError` when a typed schema is violated, or null when the
|
|
131
|
+
* params conform, the schema is generic/untyped, or there is nothing to check.
|
|
132
|
+
*
|
|
133
|
+
* `params` is the request payload the verb receives (the invoke body for
|
|
134
|
+
* body-carrying verbs). `undefined` is treated as an empty object so a schema
|
|
135
|
+
* with required fields honestly reports them missing.
|
|
136
|
+
*/
|
|
137
|
+
export function validateInvocationInput(descriptor, params) {
|
|
138
|
+
const schema = descriptor.inputSchema;
|
|
139
|
+
if (classifyInputSchema(schema) !== 'validated')
|
|
140
|
+
return null;
|
|
141
|
+
const value = params === undefined ? {} : params;
|
|
142
|
+
const detail = validateValue(value, schema, '');
|
|
143
|
+
return detail ? { code: 'INVALID_INPUT', detail } : null;
|
|
144
|
+
}
|
|
145
|
+
export function summarizeInvokeValidationCoverage(methods) {
|
|
146
|
+
let validated = 0;
|
|
147
|
+
let skippedGeneric = 0;
|
|
148
|
+
let skippedUntyped = 0;
|
|
149
|
+
for (const method of methods) {
|
|
150
|
+
switch (classifyInputSchema(method.inputSchema)) {
|
|
151
|
+
case 'validated':
|
|
152
|
+
validated += 1;
|
|
153
|
+
break;
|
|
154
|
+
case 'generic':
|
|
155
|
+
skippedGeneric += 1;
|
|
156
|
+
break;
|
|
157
|
+
case 'untyped':
|
|
158
|
+
skippedUntyped += 1;
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return { methods: methods.length, validated, skippedGeneric, skippedUntyped };
|
|
163
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"method-catalog-admin.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/method-catalog-admin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"method-catalog-admin.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/method-catalog-admin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAgB1E,eAAO,MAAM,oCAAoC,EAAE,SAAS,uBAAuB,EAmIlF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EMPTY_OBJECT_SCHEMA, STRING_SCHEMA, objectSchema, listOutputSchema, entityOutputSchema, bodyEnvelopeSchema, methodDescriptor } from './method-catalog-shared.js';
|
|
2
|
-
import { CONFIG_SET_OUTPUT_SCHEMA, CONFIG_SNAPSHOT_SCHEMA, LOCAL_AUTH_USER_SCHEMA, LOCAL_AUTH_BOOTSTRAP_DELETE_OUTPUT_SCHEMA, LOCAL_AUTH_DELETE_OUTPUT_SCHEMA, LOCAL_AUTH_SESSION_REVOKE_OUTPUT_SCHEMA, LOCAL_AUTH_STATUS_SCHEMA, LOCAL_AUTH_ROTATE_PASSWORD_OUTPUT_SCHEMA, PANEL_OPEN_OUTPUT_SCHEMA, PANEL_SNAPSHOT_SCHEMA, } from './operator-contract-schemas.js';
|
|
2
|
+
import { CONFIG_SET_OUTPUT_SCHEMA, CONFIG_SNAPSHOT_SCHEMA, CREDENTIALS_SNAPSHOT_SCHEMA, LOCAL_AUTH_USER_SCHEMA, LOCAL_AUTH_BOOTSTRAP_DELETE_OUTPUT_SCHEMA, LOCAL_AUTH_DELETE_OUTPUT_SCHEMA, LOCAL_AUTH_SESSION_REVOKE_OUTPUT_SCHEMA, LOCAL_AUTH_STATUS_SCHEMA, LOCAL_AUTH_ROTATE_PASSWORD_OUTPUT_SCHEMA, PANEL_OPEN_OUTPUT_SCHEMA, PANEL_SNAPSHOT_SCHEMA, } from './operator-contract-schemas.js';
|
|
3
3
|
export const builtinGatewayAdminMethodDescriptors = [
|
|
4
4
|
methodDescriptor({
|
|
5
5
|
id: 'local_auth.status',
|
|
@@ -107,6 +107,17 @@ export const builtinGatewayAdminMethodDescriptors = [
|
|
|
107
107
|
inputSchema: EMPTY_OBJECT_SCHEMA,
|
|
108
108
|
outputSchema: CONFIG_SNAPSHOT_SCHEMA,
|
|
109
109
|
}),
|
|
110
|
+
methodDescriptor({
|
|
111
|
+
id: 'credentials.get',
|
|
112
|
+
title: 'Get Credential Status',
|
|
113
|
+
description: 'Return secret-free credential status (configured/usable) for the shared store. Never returns raw secret bytes. Optional ?key= narrows to one credential.',
|
|
114
|
+
category: 'config',
|
|
115
|
+
scopes: ['read:config'],
|
|
116
|
+
access: 'admin',
|
|
117
|
+
http: { method: 'GET', path: '/config/credentials' },
|
|
118
|
+
inputSchema: objectSchema({ key: STRING_SCHEMA }, []),
|
|
119
|
+
outputSchema: CREDENTIALS_SNAPSHOT_SCHEMA,
|
|
120
|
+
}),
|
|
110
121
|
methodDescriptor({
|
|
111
122
|
id: 'config.set',
|
|
112
123
|
title: 'Set Config Value',
|