@pellux/goodvibes-sdk 0.38.0 → 1.0.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 +3171 -929
- package/dist/daemon.d.ts +2 -0
- package/dist/daemon.d.ts.map +1 -1
- package/dist/daemon.js +4 -0
- 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 +13 -0
- package/dist/platform/agents/orchestrator-runner.d.ts.map +1 -1
- package/dist/platform/agents/orchestrator-runner.js +14 -0
- package/dist/platform/agents/orchestrator.d.ts +38 -6
- package/dist/platform/agents/orchestrator.d.ts.map +1 -1
- package/dist/platform/agents/orchestrator.js +66 -18
- 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 +23 -0
- package/dist/platform/agents/wrfc-controller.d.ts.map +1 -1
- package/dist/platform/agents/wrfc-controller.js +158 -32
- 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-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 +67 -20
- package/dist/platform/companion/companion-chat-manager.d.ts.map +1 -1
- package/dist/platform/companion/companion-chat-manager.js +130 -144
- 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 +37 -4
- 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-types.d.ts +13 -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 +6 -1
- package/dist/platform/control-plane/index.d.ts.map +1 -1
- package/dist/platform/control-plane/index.js +4 -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 +133 -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-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-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 +32 -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 +29 -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 +57 -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/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 +21 -1
- 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 +8 -1
- package/dist/platform/core/orchestrator-turn-loop.d.ts.map +1 -1
- package/dist/platform/core/orchestrator-turn-loop.js +6 -0
- package/dist/platform/core/orchestrator.d.ts +6 -0
- package/dist/platform/core/orchestrator.d.ts.map +1 -1
- package/dist/platform/core/orchestrator.js +15 -0
- 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 +63 -0
- package/dist/platform/daemon/boot.d.ts.map +1 -0
- package/dist/platform/daemon/boot.js +60 -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 +18 -6
- package/dist/platform/daemon/facade.d.ts.map +1 -1
- package/dist/platform/daemon/facade.js +50 -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 +1 -1
- package/dist/platform/daemon/http/router.d.ts.map +1 -1
- package/dist/platform/daemon/http/router.js +7 -22
- 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/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/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/controller-compat.d.ts +14 -0
- package/dist/platform/orchestration/controller-compat.d.ts.map +1 -1
- package/dist/platform/orchestration/controller-compat.js +18 -4
- 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 +226 -21
- 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 +4 -1
- package/dist/platform/orchestration/phase-runner.d.ts +29 -2
- 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 +19 -0
- 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 +286 -1
- 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/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/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/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 +48 -1
- package/dist/platform/runtime/fleet/registry.d.ts.map +1 -1
- package/dist/platform/runtime/fleet/registry.js +38 -4
- 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 +9 -7
- package/dist/platform/runtime/services.d.ts.map +1 -1
- package/dist/platform/runtime/services.js +19 -4
- 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-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 +10 -2
- 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 +63 -0
- package/dist/platform/state/memory-recall-contract.d.ts.map +1 -0
- package/dist/platform/state/memory-recall-contract.js +94 -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 +13 -2
- 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/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 +12 -0
- package/dist/platform/tools/agent/manager.d.ts.map +1 -1
- package/dist/platform/tools/agent/manager.js +6 -0
- 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 +22 -5
- package/dist/platform/tools/exec/schema.d.ts +1 -1
- package/dist/platform/tools/exec/schema.d.ts.map +1 -1
- package/dist/platform/tools/exec/schema.js +2 -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/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/version.js +1 -1
- package/package.json +21 -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,9 +1,8 @@
|
|
|
1
1
|
import { PersistentStore } from '../state/persistent-store.js';
|
|
2
2
|
import type { RuntimeEventBus } from '../runtime/events/index.js';
|
|
3
3
|
import { RouteBindingManager } from '../channels/index.js';
|
|
4
|
-
import type { AutomationRouteBinding } from '../automation/routes.js';
|
|
5
4
|
import type { SharedSessionCompletion, SharedSessionContinuationRunner, SharedSessionInputRecord } from './session-intents.js';
|
|
6
|
-
import type { FindSharedSessionOptions,
|
|
5
|
+
import type { CreateSharedSessionInput, EnsureSharedSessionInput, FindSharedSessionOptions, ListSharedSessionsOptions, RegisterSharedSessionInput, SharedSessionMessage, SharedSessionRecord, SharedSessionRegisterResult, SharedSessionSubmission, SteerSharedSessionMessageInput, SubmitSharedSessionMessageInput } from './session-types.js';
|
|
7
6
|
import { type SharedSessionAgentStatusProvider, type SharedSessionEventPublisher, type SharedSessionMessageSender, type SharedSessionStoreSnapshot } from './session-broker-helpers.js';
|
|
8
7
|
export declare class SharedSessionBroker {
|
|
9
8
|
private readonly store;
|
|
@@ -22,10 +21,10 @@ export declare class SharedSessionBroker {
|
|
|
22
21
|
private readonly _idleEmptyMs;
|
|
23
22
|
/** Default idle threshold for sessions with content (ms). */
|
|
24
23
|
private readonly _idleLongMs;
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
*/
|
|
24
|
+
/** Retention window (ms since closedAt) for CLOSED sessions; Infinity = retain forever. */
|
|
25
|
+
private readonly _deletionRetentionMs;
|
|
26
|
+
/** @param config idleEmptyMs (empty-session idle, default 10m), idleLongMs (default
|
|
27
|
+
* 24h), deletionRetentionMs (closed-session delete age, default Infinity = retain). */
|
|
29
28
|
constructor(config: {
|
|
30
29
|
readonly store?: PersistentStore<SharedSessionStoreSnapshot> | undefined;
|
|
31
30
|
readonly storePath?: string | undefined;
|
|
@@ -34,6 +33,7 @@ export declare class SharedSessionBroker {
|
|
|
34
33
|
readonly messageSender: SharedSessionMessageSender;
|
|
35
34
|
readonly idleEmptyMs?: number | undefined;
|
|
36
35
|
readonly idleLongMs?: number | undefined;
|
|
36
|
+
readonly deletionRetentionMs?: number | undefined;
|
|
37
37
|
});
|
|
38
38
|
setEventPublisher(publisher: SharedSessionEventPublisher | null): void;
|
|
39
39
|
/**
|
|
@@ -61,28 +61,43 @@ export declare class SharedSessionBroker {
|
|
|
61
61
|
attachRuntimeBus(bus: RuntimeEventBus, sessionResolver: (agentId: string) => string | null): () => void;
|
|
62
62
|
setContinuationRunner(runner: SharedSessionContinuationRunner | null): void;
|
|
63
63
|
start(): Promise<void>;
|
|
64
|
-
listSessions(limit?: number): SharedSessionRecord[];
|
|
64
|
+
listSessions(limit?: number, options?: ListSharedSessionsOptions): SharedSessionRecord[];
|
|
65
65
|
getSession(sessionId: string): SharedSessionRecord | null;
|
|
66
66
|
findPreferredSession(options?: FindSharedSessionOptions): Promise<SharedSessionRecord | null>;
|
|
67
|
-
ensureSession(input?:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}): Promise<SharedSessionRecord>;
|
|
67
|
+
ensureSession(input?: EnsureSharedSessionInput): Promise<SharedSessionRecord>;
|
|
68
|
+
/** Idempotent register/heartbeat; a brand-new session is born ALREADY
|
|
69
|
+
* surface-managed (avoids a create-then-patch race where a concurrent steer
|
|
70
|
+
* sees active-but-not-yet-managed and hits the executor path). */
|
|
71
|
+
register(input: RegisterSharedSessionInput): Promise<SharedSessionRegisterResult>;
|
|
72
|
+
private markSurfaceManaged;
|
|
74
73
|
getMessages(sessionId: string, limit?: number): SharedSessionMessage[];
|
|
75
74
|
getInputs(sessionId: string, limit?: number): SharedSessionInputRecord[];
|
|
76
|
-
createSession(input?:
|
|
77
|
-
readonly id?: string | undefined;
|
|
78
|
-
readonly title?: string | undefined;
|
|
79
|
-
readonly metadata?: Record<string, unknown> | undefined;
|
|
80
|
-
readonly routeBinding?: AutomationRouteBinding | undefined;
|
|
81
|
-
readonly participant?: SharedSessionParticipant | undefined;
|
|
82
|
-
readonly kind?: SharedSessionRecord['kind'] | undefined;
|
|
83
|
-
}): Promise<SharedSessionRecord>;
|
|
75
|
+
createSession(input?: CreateSharedSessionInput): Promise<SharedSessionRecord>;
|
|
84
76
|
closeSession(sessionId: string): Promise<SharedSessionRecord | null>;
|
|
85
77
|
reopenSession(sessionId: string): Promise<SharedSessionRecord | null>;
|
|
78
|
+
/**
|
|
79
|
+
* Permanently remove a shared session record and its queued messages/inputs
|
|
80
|
+
* from the home-scoped store (W5-S1: a real hard-delete verb, distinct from
|
|
81
|
+
* `closeSession` — closed sessions are HISTORY and are never touched by this
|
|
82
|
+
* path unless explicitly asked). Requires the session to already be closed:
|
|
83
|
+
* deleting a still-active session returns `'active'` so the caller can
|
|
84
|
+
* surface an honest 409 (close it, then delete) rather than yanking a
|
|
85
|
+
* record out from under a live participant/agent. An unknown OR
|
|
86
|
+
* already-deleted id returns `'not-found'` — delete is not a 200-noop; a
|
|
87
|
+
* second delete of the same id is an honest 404 at the route layer.
|
|
88
|
+
*
|
|
89
|
+
* Emits `session-deleted` on the same `session-update` wire channel as
|
|
90
|
+
* close/reopen/detach so subscribers drop the row live.
|
|
91
|
+
*/
|
|
92
|
+
deleteSession(sessionId: string): Promise<'deleted' | 'not-found' | 'active'>;
|
|
93
|
+
/**
|
|
94
|
+
* Detach a surface's participant + route binding without closing or killing the
|
|
95
|
+
* session ("detach != close != kill"). Emits `session-detached`. Idempotent:
|
|
96
|
+
* unknown session -> null (404); closed session or no matching participant ->
|
|
97
|
+
* returned unchanged (a closed session emits no updates, so "stop receiving
|
|
98
|
+
* updates" is already satisfied). See {@link detachSharedSessionParticipant}.
|
|
99
|
+
*/
|
|
100
|
+
detachParticipant(sessionId: string, surfaceId: string): Promise<SharedSessionRecord | null>;
|
|
86
101
|
bindAgent(sessionId: string, agentId: string): Promise<SharedSessionRecord | null>;
|
|
87
102
|
submitMessage(input: SubmitSharedSessionMessageInput): Promise<SharedSessionSubmission>;
|
|
88
103
|
steerMessage(input: SteerSharedSessionMessageInput): Promise<SharedSessionSubmission>;
|
|
@@ -113,27 +128,25 @@ export declare class SharedSessionBroker {
|
|
|
113
128
|
private publishUpdate;
|
|
114
129
|
private publishInputLifecycleEvent;
|
|
115
130
|
private handleIntent;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
131
|
+
/** Collection read for a live surface (see {@link filterSessionInputsSince}). */
|
|
132
|
+
getInputsSince(sessionId: string, options?: {
|
|
133
|
+
readonly state?: SharedSessionInputRecord['state'] | undefined;
|
|
134
|
+
readonly since?: number | undefined;
|
|
135
|
+
readonly limit?: number | undefined;
|
|
136
|
+
}): SharedSessionInputRecord[];
|
|
137
|
+
/** A live surface reports a collected input delivered (`consumed:false`) or
|
|
138
|
+
* consumed/completed (`consumed:true`); emits a session_update. Lifecycle rules
|
|
139
|
+
* live in {@link markSurfaceInputDelivered}. */
|
|
140
|
+
markInputDelivered(sessionId: string, inputId: string, options?: {
|
|
141
|
+
readonly consumed?: boolean | undefined;
|
|
142
|
+
}): Promise<SharedSessionInputRecord | null>;
|
|
120
143
|
private runQueuedFollowUp;
|
|
121
144
|
private sessionInputStore;
|
|
122
145
|
private messageStore;
|
|
123
146
|
private touch;
|
|
124
147
|
private refreshPendingInputCount;
|
|
125
|
-
/**
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
* Policy:
|
|
129
|
-
* - Sessions with messageCount === 0 AND no active agent AND idle longer than
|
|
130
|
-
* `_idleEmptyMs` (default 10min) are closed with reason `idle-empty`.
|
|
131
|
-
* - Sessions with messageCount > 0 AND no active agent AND idle longer than
|
|
132
|
-
* `_idleLongMs` (default 24h) are closed with reason `idle-long`.
|
|
133
|
-
*
|
|
134
|
-
* "Idle" is measured from `lastActivityAt` (updated on createInput/bindAgent/
|
|
135
|
-
* appendMessage). Sessions with an active agent are never GC'd.
|
|
136
|
-
*/
|
|
148
|
+
/** Periodic sweep: idle-close active sessions and (only under a finite retention
|
|
149
|
+
* window) delete closed ones. Full policy lives in {@link sweepSharedSessions}. */
|
|
137
150
|
private gcSweep;
|
|
138
151
|
}
|
|
139
152
|
//# sourceMappingURL=session-broker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-broker.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/session-broker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"session-broker.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/session-broker.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { SDKErrorCodes } from '@pellux/goodvibes-errors';
|
|
1
2
|
import { logger } from '../utils/logger.js';
|
|
2
3
|
import { sessionsActive } from '../runtime/metrics.js';
|
|
3
4
|
import { PersistentStore } from '../state/persistent-store.js';
|
|
4
5
|
import { RouteBindingManager } from '../channels/index.js';
|
|
5
6
|
import {} from './session-broker-helpers.js';
|
|
6
|
-
import { createSessionBrokerSnapshot, loadSessionBrokerState, sortSessions, } from './session-broker-state.js';
|
|
7
|
-
import { claimNextQueuedSessionInput, finalizeAgentSessionInputs, recordSharedSessionInput, refreshPendingInputCount, touchSharedSession, updateSharedSessionInput, } from './session-broker-inputs.js';
|
|
7
|
+
import { createSessionBrokerSnapshot, loadSessionBrokerState, reconcileSessionBrokerBoot, sortSessions, } from './session-broker-state.js';
|
|
8
|
+
import { claimNextQueuedSessionInput, filterSessionInputsSince, finalizeAgentSessionInputs, markSurfaceInputDelivered, recordSharedSessionInput, refreshPendingInputCount, touchSharedSession, updateSharedSessionInput, } from './session-broker-inputs.js';
|
|
8
9
|
import { appendSharedSessionMessage, buildSharedSessionContinuationTask, listSharedSessionMessages, } from './session-broker-messages.js';
|
|
9
|
-
import { attachSharedSessionParticipantAndRoute, bindSharedSessionAgent, closeSharedSessionRecord, createSharedSessionRecord, reopenSharedSessionRecord, } from './session-broker-sessions.js';
|
|
10
|
+
import { SESSION_SURFACE_MANAGED_METADATA_KEY, SURFACE_ROUTE_FRESHNESS_MS, attachSharedSessionParticipantAndRoute, bindSharedSessionAgent, closeSharedSessionRecord, createSharedSessionRecord, detachSharedSessionParticipant, participantToAttachInput, registerSharedSession, reopenSharedSessionRecord, shouldRouteInputToSurface, } from './session-broker-sessions.js';
|
|
10
11
|
import { sweepSharedSessions } from './session-broker-gc.js';
|
|
11
12
|
import { SharedSessionRuntimeBusBridge } from './session-broker-runtime-bus.js';
|
|
12
13
|
const MAX_PERSISTED_MESSAGES = 2_000;
|
|
@@ -14,11 +15,13 @@ const MAX_CONTINUATION_MESSAGES = 16;
|
|
|
14
15
|
/** Max inputs retained per session bucket. */
|
|
15
16
|
const MAX_PERSISTED_INPUTS = 500;
|
|
16
17
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
18
|
+
* Default retention for CLOSED sessions (HISTORY): `POSITIVE_INFINITY` = retain
|
|
19
|
+
* indefinitely, so the GC sweep NEVER deletes a closed session. A finite value
|
|
20
|
+
* (constructor `deletionRetentionMs`) is the opt-in deletion authority. The store
|
|
21
|
+
* is a full snapshot of memory, so there is no separate memory/disk eviction here
|
|
22
|
+
* (unlike the companion manager); memory is bounded by the per-session cap below.
|
|
20
23
|
*/
|
|
21
|
-
const SESSION_DELETION_RETENTION_MS =
|
|
24
|
+
const SESSION_DELETION_RETENTION_MS = Number.POSITIVE_INFINITY;
|
|
22
25
|
export class SharedSessionBroker {
|
|
23
26
|
store;
|
|
24
27
|
routeBindings;
|
|
@@ -36,10 +39,10 @@ export class SharedSessionBroker {
|
|
|
36
39
|
_idleEmptyMs;
|
|
37
40
|
/** Default idle threshold for sessions with content (ms). */
|
|
38
41
|
_idleLongMs;
|
|
39
|
-
/**
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
*/
|
|
42
|
+
/** Retention window (ms since closedAt) for CLOSED sessions; Infinity = retain forever. */
|
|
43
|
+
_deletionRetentionMs;
|
|
44
|
+
/** @param config idleEmptyMs (empty-session idle, default 10m), idleLongMs (default
|
|
45
|
+
* 24h), deletionRetentionMs (closed-session delete age, default Infinity = retain). */
|
|
43
46
|
constructor(config) {
|
|
44
47
|
if (!config.store && !config.storePath) {
|
|
45
48
|
throw new Error('SharedSessionBroker requires an explicit store or storePath.');
|
|
@@ -51,6 +54,7 @@ export class SharedSessionBroker {
|
|
|
51
54
|
this.messageSender = config.messageSender;
|
|
52
55
|
this._idleEmptyMs = config.idleEmptyMs ?? 10 * 60 * 1000; // 10 min
|
|
53
56
|
this._idleLongMs = config.idleLongMs ?? 24 * 60 * 60 * 1000; // 24 h
|
|
57
|
+
this._deletionRetentionMs = config.deletionRetentionMs ?? SESSION_DELETION_RETENTION_MS;
|
|
54
58
|
}
|
|
55
59
|
setEventPublisher(publisher) {
|
|
56
60
|
this.eventPublisher = publisher;
|
|
@@ -115,24 +119,9 @@ export class SharedSessionBroker {
|
|
|
115
119
|
this.inputs.set(sessionId, bucket);
|
|
116
120
|
}
|
|
117
121
|
this.loaded = true;
|
|
118
|
-
//
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
let changed = false;
|
|
122
|
-
for (let i = 0; i < bucket.length; i++) {
|
|
123
|
-
const entry = bucket[i];
|
|
124
|
-
if (entry.state === 'spawned' || entry.state === 'delivered') {
|
|
125
|
-
bucket[i] = { ...entry, state: 'cancelled', updatedAt: Date.now(), error: restartReason };
|
|
126
|
-
changed = true;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
if (changed)
|
|
130
|
-
this.refreshPendingInputCount(sessionId);
|
|
131
|
-
}
|
|
132
|
-
for (const [sessionId, session] of this.sessions.entries()) {
|
|
133
|
-
if (session.activeAgentId) {
|
|
134
|
-
this.sessions.set(sessionId, { ...session, activeAgentId: undefined, updatedAt: Date.now() });
|
|
135
|
-
}
|
|
122
|
+
// Boot reconciliation: cancel stuck spawned/delivered inputs, clear stale activeAgentId.
|
|
123
|
+
for (const sessionId of reconcileSessionBrokerBoot(this.sessions, this.inputs)) {
|
|
124
|
+
this.refreshPendingInputCount(sessionId);
|
|
136
125
|
}
|
|
137
126
|
await this.persist();
|
|
138
127
|
if (!this._gcInterval) {
|
|
@@ -142,8 +131,18 @@ export class SharedSessionBroker {
|
|
|
142
131
|
this._gcInterval = iv;
|
|
143
132
|
}
|
|
144
133
|
}
|
|
145
|
-
listSessions(limit = 100) {
|
|
146
|
-
|
|
134
|
+
listSessions(limit = 100, options = {}) {
|
|
135
|
+
const sorted = sortSessions(this.sessions.values());
|
|
136
|
+
const filtered = sorted.filter((session) => {
|
|
137
|
+
if (options.project !== undefined && session.project !== options.project)
|
|
138
|
+
return false;
|
|
139
|
+
if (options.kind !== undefined && session.kind !== options.kind)
|
|
140
|
+
return false;
|
|
141
|
+
if (options.includeClosed === false && session.status === 'closed')
|
|
142
|
+
return false;
|
|
143
|
+
return true;
|
|
144
|
+
});
|
|
145
|
+
return filtered.slice(0, Math.max(1, limit));
|
|
147
146
|
}
|
|
148
147
|
getSession(sessionId) {
|
|
149
148
|
return this.sessions.get(sessionId) ?? null;
|
|
@@ -157,29 +156,64 @@ export class SharedSessionBroker {
|
|
|
157
156
|
return false;
|
|
158
157
|
if (options.surfaceKind && !session.surfaceKinds.includes(options.surfaceKind))
|
|
159
158
|
return false;
|
|
159
|
+
if (options.project !== undefined && session.project !== options.project)
|
|
160
|
+
return false;
|
|
160
161
|
return true;
|
|
161
162
|
});
|
|
162
163
|
return candidates[0] ?? null;
|
|
163
164
|
}
|
|
164
165
|
async ensureSession(input = {}) {
|
|
165
166
|
await this.start();
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
167
|
+
const existing = input.sessionId ? this.sessions.get(input.sessionId) : undefined;
|
|
168
|
+
if (existing) {
|
|
169
|
+
const active = existing.status === 'closed'
|
|
170
|
+
? (await this.reopenSession(existing.id)) ?? existing
|
|
171
|
+
: existing;
|
|
172
|
+
// Adopt: record the participant + advance lastSeenAt (register heartbeat).
|
|
173
|
+
return input.participant
|
|
174
|
+
? this.attachParticipantAndRoute(active, participantToAttachInput(input.participant, input.title))
|
|
175
|
+
: active;
|
|
174
176
|
}
|
|
175
177
|
return this.createSession({
|
|
176
178
|
id: input.sessionId,
|
|
179
|
+
kind: input.kind,
|
|
180
|
+
project: input.project,
|
|
177
181
|
title: input.title,
|
|
178
182
|
metadata: input.metadata,
|
|
179
183
|
routeBinding: input.routeBinding,
|
|
180
184
|
participant: input.participant,
|
|
181
185
|
});
|
|
182
186
|
}
|
|
187
|
+
/** Idempotent register/heartbeat; a brand-new session is born ALREADY
|
|
188
|
+
* surface-managed (avoids a create-then-patch race where a concurrent steer
|
|
189
|
+
* sees active-but-not-yet-managed and hits the executor path). */
|
|
190
|
+
async register(input) {
|
|
191
|
+
await this.start();
|
|
192
|
+
const createManaged = (i) => this.createSession({ ...i, metadata: { ...i.metadata, [SESSION_SURFACE_MANAGED_METADATA_KEY]: true } });
|
|
193
|
+
const result = await registerSharedSession({
|
|
194
|
+
getSession: (id) => this.sessions.get(id) ?? null,
|
|
195
|
+
createSession: createManaged,
|
|
196
|
+
reopenSession: (id) => this.reopenSession(id),
|
|
197
|
+
attachParticipant: (s, a) => this.attachParticipantAndRoute(s, a),
|
|
198
|
+
}, input);
|
|
199
|
+
const marked = await this.markSurfaceManaged(result.record.id); // backstop; no-op if already set
|
|
200
|
+
return marked ? { ...result, record: marked } : result;
|
|
201
|
+
}
|
|
202
|
+
async markSurfaceManaged(sessionId) {
|
|
203
|
+
const session = this.sessions.get(sessionId);
|
|
204
|
+
if (!session)
|
|
205
|
+
return null;
|
|
206
|
+
if (session.metadata?.[SESSION_SURFACE_MANAGED_METADATA_KEY] === true)
|
|
207
|
+
return session;
|
|
208
|
+
const updated = {
|
|
209
|
+
...session,
|
|
210
|
+
metadata: { ...session.metadata, [SESSION_SURFACE_MANAGED_METADATA_KEY]: true },
|
|
211
|
+
updatedAt: Date.now(),
|
|
212
|
+
};
|
|
213
|
+
this.sessions.set(updated.id, updated);
|
|
214
|
+
await this.persist();
|
|
215
|
+
return updated;
|
|
216
|
+
}
|
|
183
217
|
getMessages(sessionId, limit = 100) {
|
|
184
218
|
return listSharedSessionMessages(this.messageStore(), sessionId, limit);
|
|
185
219
|
}
|
|
@@ -224,6 +258,61 @@ export class SharedSessionBroker {
|
|
|
224
258
|
this.publishUpdate('session-reopened', updated);
|
|
225
259
|
return updated;
|
|
226
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* Permanently remove a shared session record and its queued messages/inputs
|
|
263
|
+
* from the home-scoped store (W5-S1: a real hard-delete verb, distinct from
|
|
264
|
+
* `closeSession` — closed sessions are HISTORY and are never touched by this
|
|
265
|
+
* path unless explicitly asked). Requires the session to already be closed:
|
|
266
|
+
* deleting a still-active session returns `'active'` so the caller can
|
|
267
|
+
* surface an honest 409 (close it, then delete) rather than yanking a
|
|
268
|
+
* record out from under a live participant/agent. An unknown OR
|
|
269
|
+
* already-deleted id returns `'not-found'` — delete is not a 200-noop; a
|
|
270
|
+
* second delete of the same id is an honest 404 at the route layer.
|
|
271
|
+
*
|
|
272
|
+
* Emits `session-deleted` on the same `session-update` wire channel as
|
|
273
|
+
* close/reopen/detach so subscribers drop the row live.
|
|
274
|
+
*/
|
|
275
|
+
async deleteSession(sessionId) {
|
|
276
|
+
await this.start();
|
|
277
|
+
const session = this.sessions.get(sessionId);
|
|
278
|
+
if (!session)
|
|
279
|
+
return 'not-found';
|
|
280
|
+
if (session.status !== 'closed')
|
|
281
|
+
return 'active';
|
|
282
|
+
this.sessions.delete(sessionId);
|
|
283
|
+
this.messages.delete(sessionId);
|
|
284
|
+
this.inputs.delete(sessionId);
|
|
285
|
+
await this.persist();
|
|
286
|
+
sessionsActive.set(this.sessions.size);
|
|
287
|
+
this.publishUpdate('session-deleted', { sessionId });
|
|
288
|
+
return 'deleted';
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Detach a surface's participant + route binding without closing or killing the
|
|
292
|
+
* session ("detach != close != kill"). Emits `session-detached`. Idempotent:
|
|
293
|
+
* unknown session -> null (404); closed session or no matching participant ->
|
|
294
|
+
* returned unchanged (a closed session emits no updates, so "stop receiving
|
|
295
|
+
* updates" is already satisfied). See {@link detachSharedSessionParticipant}.
|
|
296
|
+
*/
|
|
297
|
+
async detachParticipant(sessionId, surfaceId) {
|
|
298
|
+
await this.start();
|
|
299
|
+
const session = this.sessions.get(sessionId);
|
|
300
|
+
if (!session)
|
|
301
|
+
return null;
|
|
302
|
+
if (session.status === 'closed')
|
|
303
|
+
return session;
|
|
304
|
+
const { session: updated, changed } = detachSharedSessionParticipant(session, surfaceId);
|
|
305
|
+
if (!changed)
|
|
306
|
+
return session;
|
|
307
|
+
this.sessions.set(sessionId, updated);
|
|
308
|
+
await this.persist();
|
|
309
|
+
this.publishUpdate('session-detached', {
|
|
310
|
+
sessionId: updated.id,
|
|
311
|
+
surfaceId,
|
|
312
|
+
participants: updated.participants.length,
|
|
313
|
+
});
|
|
314
|
+
return updated;
|
|
315
|
+
}
|
|
227
316
|
async bindAgent(sessionId, agentId) {
|
|
228
317
|
await this.start();
|
|
229
318
|
const session = this.sessions.get(sessionId);
|
|
@@ -231,7 +320,7 @@ export class SharedSessionBroker {
|
|
|
231
320
|
return null;
|
|
232
321
|
const updated = bindSharedSessionAgent(session, agentId);
|
|
233
322
|
this.sessions.set(sessionId, updated);
|
|
234
|
-
const claimed = this.
|
|
323
|
+
const claimed = claimNextQueuedSessionInput(this.sessionInputStore(), sessionId, agentId);
|
|
235
324
|
await this.persist();
|
|
236
325
|
this.publishUpdate('session-agent-bound', updated);
|
|
237
326
|
if (claimed) {
|
|
@@ -300,7 +389,7 @@ export class SharedSessionBroker {
|
|
|
300
389
|
...(metadata.status === 'failed' ? { lastError: body } : {}),
|
|
301
390
|
};
|
|
302
391
|
this.sessions.set(sessionId, updated);
|
|
303
|
-
const finalizedInputs = this.
|
|
392
|
+
const finalizedInputs = finalizeAgentSessionInputs(this.sessionInputStore(), sessionId, agentId, metadata.status === 'failed' ? 'failed' : metadata.status === 'cancelled' ? 'cancelled' : 'completed', metadata.status === 'failed' ? body : undefined);
|
|
304
393
|
await this.persist();
|
|
305
394
|
this.publishUpdate('session-agent-completed', {
|
|
306
395
|
sessionId,
|
|
@@ -319,7 +408,7 @@ export class SharedSessionBroker {
|
|
|
319
408
|
}
|
|
320
409
|
async cancelInput(sessionId, inputId) {
|
|
321
410
|
await this.start();
|
|
322
|
-
const updated = this.
|
|
411
|
+
const updated = updateSharedSessionInput(this.sessionInputStore(), sessionId, inputId, (entry) => {
|
|
323
412
|
if (entry.state !== 'queued')
|
|
324
413
|
return entry;
|
|
325
414
|
return {
|
|
@@ -456,6 +545,10 @@ export class SharedSessionBroker {
|
|
|
456
545
|
});
|
|
457
546
|
created = true;
|
|
458
547
|
}
|
|
548
|
+
// Closed sessions are history: steer/follow-up/submit against an EXISTING
|
|
549
|
+
// closed record are rejected before mutation; auto-create for a missing session is untouched.
|
|
550
|
+
if (session.status === 'closed')
|
|
551
|
+
throw Object.assign(new Error('Session is closed'), { code: SDKErrorCodes.SESSION_CLOSED, status: 409 });
|
|
459
552
|
const updatedSession = await this.attachParticipantAndRoute(session, input, binding ?? undefined);
|
|
460
553
|
const userMessage = await this.appendMessage(updatedSession.id, {
|
|
461
554
|
role: 'user',
|
|
@@ -470,7 +563,14 @@ export class SharedSessionBroker {
|
|
|
470
563
|
sessionIntent: intent,
|
|
471
564
|
},
|
|
472
565
|
});
|
|
473
|
-
const queuedInput = this.
|
|
566
|
+
const queuedInput = recordSharedSessionInput(this.sessionInputStore(), {
|
|
567
|
+
sessionId: updatedSession.id,
|
|
568
|
+
intent,
|
|
569
|
+
message: input,
|
|
570
|
+
routeId: binding?.id,
|
|
571
|
+
causationId: userMessage.id,
|
|
572
|
+
maxPersistedInputs: MAX_PERSISTED_INPUTS,
|
|
573
|
+
});
|
|
474
574
|
this.publishInputLifecycleEvent('session-input-queued', queuedInput, {
|
|
475
575
|
messageId: userMessage.id,
|
|
476
576
|
});
|
|
@@ -478,7 +578,7 @@ export class SharedSessionBroker {
|
|
|
478
578
|
if (intent !== 'follow-up' && activeAgentId) {
|
|
479
579
|
const sent = this.messageSender.send('orchestrator', activeAgentId, input.body, { kind: 'directive' });
|
|
480
580
|
if (sent) {
|
|
481
|
-
const delivered = this.
|
|
581
|
+
const delivered = updateSharedSessionInput(this.sessionInputStore(), updatedSession.id, queuedInput.id, (entry) => ({
|
|
482
582
|
...entry,
|
|
483
583
|
state: 'delivered',
|
|
484
584
|
activeAgentId,
|
|
@@ -509,7 +609,7 @@ export class SharedSessionBroker {
|
|
|
509
609
|
};
|
|
510
610
|
}
|
|
511
611
|
if (intent === 'steer' && !allowSpawnFallback) {
|
|
512
|
-
const rejected = this.
|
|
612
|
+
const rejected = updateSharedSessionInput(this.sessionInputStore(), updatedSession.id, queuedInput.id, (entry) => ({
|
|
513
613
|
...entry,
|
|
514
614
|
state: 'rejected',
|
|
515
615
|
updatedAt: Date.now(),
|
|
@@ -549,6 +649,25 @@ export class SharedSessionBroker {
|
|
|
549
649
|
created,
|
|
550
650
|
};
|
|
551
651
|
}
|
|
652
|
+
// Surface routing: a steer/follow-up with a LIVE surface participant (other than the
|
|
653
|
+
// sender) queues for that surface (sessions.inputs.list/deliver); no live surface keeps the executor path below.
|
|
654
|
+
if ((intent === 'steer' || intent === 'follow-up') &&
|
|
655
|
+
shouldRouteInputToSurface(updatedSession, Date.now(), SURFACE_ROUTE_FRESHNESS_MS, { surfaceId: input.surfaceId })) {
|
|
656
|
+
await this.persist();
|
|
657
|
+
this.publishInputLifecycleEvent('session-input-queued-for-surface', queuedInput, {
|
|
658
|
+
messageId: userMessage.id,
|
|
659
|
+
});
|
|
660
|
+
return {
|
|
661
|
+
session: this.sessions.get(updatedSession.id),
|
|
662
|
+
userMessage,
|
|
663
|
+
routeBinding: binding ?? undefined,
|
|
664
|
+
input: queuedInput,
|
|
665
|
+
intent,
|
|
666
|
+
mode: 'queued-for-surface',
|
|
667
|
+
state: queuedInput.state,
|
|
668
|
+
created,
|
|
669
|
+
};
|
|
670
|
+
}
|
|
552
671
|
await this.persist();
|
|
553
672
|
return {
|
|
554
673
|
session: this.sessions.get(updatedSession.id),
|
|
@@ -562,24 +681,23 @@ export class SharedSessionBroker {
|
|
|
562
681
|
created,
|
|
563
682
|
};
|
|
564
683
|
}
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
intent,
|
|
569
|
-
message: input,
|
|
570
|
-
routeId,
|
|
571
|
-
causationId,
|
|
572
|
-
maxPersistedInputs: MAX_PERSISTED_INPUTS,
|
|
573
|
-
});
|
|
574
|
-
}
|
|
575
|
-
updateInput(sessionId, inputId, transform) {
|
|
576
|
-
return updateSharedSessionInput(this.sessionInputStore(), sessionId, inputId, transform);
|
|
684
|
+
/** Collection read for a live surface (see {@link filterSessionInputsSince}). */
|
|
685
|
+
getInputsSince(sessionId, options = {}) {
|
|
686
|
+
return filterSessionInputsSince(this.inputs.get(sessionId) ?? [], options);
|
|
577
687
|
}
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
688
|
+
/** A live surface reports a collected input delivered (`consumed:false`) or
|
|
689
|
+
* consumed/completed (`consumed:true`); emits a session_update. Lifecycle rules
|
|
690
|
+
* live in {@link markSurfaceInputDelivered}. */
|
|
691
|
+
async markInputDelivered(sessionId, inputId, options = {}) {
|
|
692
|
+
await this.start();
|
|
693
|
+
const consumed = options.consumed === true;
|
|
694
|
+
const updated = markSurfaceInputDelivered(this.sessionInputStore(), sessionId, inputId, consumed);
|
|
695
|
+
if (!updated)
|
|
696
|
+
return null;
|
|
697
|
+
this.refreshPendingInputCount(sessionId);
|
|
698
|
+
await this.persist();
|
|
699
|
+
this.publishInputLifecycleEvent(consumed ? 'session-input-completed' : 'session-input-delivered', updated);
|
|
700
|
+
return updated;
|
|
583
701
|
}
|
|
584
702
|
async runQueuedFollowUp(sessionId) {
|
|
585
703
|
if (!this.continuationRunner)
|
|
@@ -620,23 +738,13 @@ export class SharedSessionBroker {
|
|
|
620
738
|
refreshPendingInputCount(sessionId) {
|
|
621
739
|
refreshPendingInputCount(this.sessionInputStore(), sessionId);
|
|
622
740
|
}
|
|
623
|
-
/**
|
|
624
|
-
*
|
|
625
|
-
*
|
|
626
|
-
* Policy:
|
|
627
|
-
* - Sessions with messageCount === 0 AND no active agent AND idle longer than
|
|
628
|
-
* `_idleEmptyMs` (default 10min) are closed with reason `idle-empty`.
|
|
629
|
-
* - Sessions with messageCount > 0 AND no active agent AND idle longer than
|
|
630
|
-
* `_idleLongMs` (default 24h) are closed with reason `idle-long`.
|
|
631
|
-
*
|
|
632
|
-
* "Idle" is measured from `lastActivityAt` (updated on createInput/bindAgent/
|
|
633
|
-
* appendMessage). Sessions with an active agent are never GC'd.
|
|
634
|
-
*/
|
|
741
|
+
/** Periodic sweep: idle-close active sessions and (only under a finite retention
|
|
742
|
+
* window) delete closed ones. Full policy lives in {@link sweepSharedSessions}. */
|
|
635
743
|
gcSweep() {
|
|
636
744
|
const anyChanged = sweepSharedSessions({ sessions: this.sessions, messages: this.messages, inputs: this.inputs }, {
|
|
637
745
|
idleEmptyMs: this._idleEmptyMs,
|
|
638
746
|
idleLongMs: this._idleLongMs,
|
|
639
|
-
deletionRetentionMs:
|
|
747
|
+
deletionRetentionMs: this._deletionRetentionMs,
|
|
640
748
|
publishUpdate: (event, payload) => this.publishUpdate(event, payload),
|
|
641
749
|
});
|
|
642
750
|
if (anyChanged) {
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* session-store-importer.ts
|
|
3
|
+
*
|
|
4
|
+
* Boot-time migration that folds every pre-existing session store into the ONE
|
|
5
|
+
* home-scoped durable broker store. Idempotent and safe to run repeatedly — the
|
|
6
|
+
* merge is keyed on session id, so a re-run over the same sources is a no-op.
|
|
7
|
+
*
|
|
8
|
+
* Sources folded in (One-Platform Wave 1, S1 spine):
|
|
9
|
+
* 1. Companion chat files — ~/.goodvibes/companion-chat/sessions/*.json
|
|
10
|
+
* (home-scoped, projectless → project 'unknown'); INCLUDING closed sessions.
|
|
11
|
+
* 2. Per-project broker snapshots — <root>/.goodvibes/<surface>/control-plane/
|
|
12
|
+
* sessions.json (the old project-scoped store path); stamped project = <root>.
|
|
13
|
+
* 3. The stale agent-fork store — same broker-snapshot shape under its surface.
|
|
14
|
+
*
|
|
15
|
+
* No session is dropped (closed included); deletion remains the GC's job. Corrupt
|
|
16
|
+
* or partial files are logged and skipped per-file — the run never aborts.
|
|
17
|
+
*/
|
|
18
|
+
/** A legacy store to fold into the home store. */
|
|
19
|
+
export interface LegacySessionSource {
|
|
20
|
+
/** 'broker-store' = a SharedSessionStoreSnapshot JSON file; 'companion-dir' = a dir of PersistedChatSession files. */
|
|
21
|
+
readonly kind: 'broker-store' | 'companion-dir';
|
|
22
|
+
/** File path (broker-store) or directory path (companion-dir). */
|
|
23
|
+
readonly path: string;
|
|
24
|
+
/** Project to stamp on records that carry no explicit project. Companion sources default to 'unknown'. */
|
|
25
|
+
readonly project?: string | undefined;
|
|
26
|
+
}
|
|
27
|
+
export interface ImportLegacySessionsResult {
|
|
28
|
+
/** Total sessions in the home store after the import. */
|
|
29
|
+
readonly total: number;
|
|
30
|
+
/** Sessions newly added by this run (0 on an idempotent re-run). */
|
|
31
|
+
readonly imported: number;
|
|
32
|
+
/** Sources that did not exist on disk (skipped, not an error). */
|
|
33
|
+
readonly missingSources: readonly string[];
|
|
34
|
+
/** Files that failed to parse and were skipped. */
|
|
35
|
+
readonly skippedFiles: readonly string[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Discover the legacy stores reachable from a single project root plus the
|
|
39
|
+
* home-scoped companion directory. Scans <projectRoot>/.goodvibes/<surface>/
|
|
40
|
+
* control-plane/sessions.json across every surface subdir (tui, goodvibes,
|
|
41
|
+
* agent, …). The home store itself is never returned as a source.
|
|
42
|
+
*/
|
|
43
|
+
export declare function discoverLegacySessionSources(input: {
|
|
44
|
+
readonly projectRoot: string;
|
|
45
|
+
readonly companionSessionsDir?: string | undefined;
|
|
46
|
+
}): LegacySessionSource[];
|
|
47
|
+
/**
|
|
48
|
+
* Fold every source into the home store at `homeStorePath`, idempotently.
|
|
49
|
+
* Starts from the existing home store, merges each source keyed by session id
|
|
50
|
+
* (newer updatedAt wins; messages/inputs union-deduped by id), and re-persists
|
|
51
|
+
* atomically. A second run over the same sources produces the same store.
|
|
52
|
+
*/
|
|
53
|
+
export declare function importLegacySessionStores(input: {
|
|
54
|
+
readonly homeStorePath: string;
|
|
55
|
+
readonly sources: readonly LegacySessionSource[];
|
|
56
|
+
}): Promise<ImportLegacySessionsResult>;
|
|
57
|
+
//# sourceMappingURL=session-store-importer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-store-importer.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/session-store-importer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AA0BH,kDAAkD;AAClD,MAAM,WAAW,mBAAmB;IAClC,sHAAsH;IACtH,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,eAAe,CAAC;IAChD,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0GAA0G;IAC1G,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC;AAED,MAAM,WAAW,0BAA0B;IACzC,yDAAyD;IACzD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,oEAAoE;IACpE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,kEAAkE;IAClE,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,mDAAmD;IACnD,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C;AAQD;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE;IAClD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACpD,GAAG,mBAAmB,EAAE,CA0BxB;AAED;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAAC,KAAK,EAAE;IACrD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,SAAS,mBAAmB,EAAE,CAAC;CAClD,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAkCtC"}
|