@pellux/goodvibes-sdk 0.37.2 → 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/communication.d.ts +21 -1
- package/dist/events/communication.d.ts.map +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/message-bus-core.d.ts +7 -0
- package/dist/platform/agents/message-bus-core.d.ts.map +1 -1
- package/dist/platform/agents/message-bus-core.js +2 -1
- package/dist/platform/agents/orchestrator-runner.d.ts +50 -1
- package/dist/platform/agents/orchestrator-runner.d.ts.map +1 -1
- package/dist/platform/agents/orchestrator-runner.js +172 -7
- package/dist/platform/agents/orchestrator.d.ts +78 -6
- package/dist/platform/agents/orchestrator.d.ts.map +1 -1
- package/dist/platform/agents/orchestrator.js +95 -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 +192 -0
- package/dist/platform/agents/turn-knowledge-injection.d.ts.map +1 -0
- package/dist/platform/agents/turn-knowledge-injection.js +269 -0
- 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 +46 -0
- package/dist/platform/agents/wrfc-controller.d.ts.map +1 -1
- package/dist/platform/agents/wrfc-controller.js +213 -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 +18 -0
- package/dist/platform/config/manager.d.ts.map +1 -1
- package/dist/platform/config/manager.js +36 -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/adaptive-planner.d.ts +50 -0
- package/dist/platform/core/adaptive-planner.d.ts.map +1 -1
- package/dist/platform/core/adaptive-planner.js +49 -0
- 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 +2 -0
- package/dist/platform/core/index.d.ts.map +1 -1
- package/dist/platform/core/index.js +2 -0
- package/dist/platform/core/orchestrator-runtime.d.ts +31 -0
- 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 +35 -1
- package/dist/platform/core/orchestrator-turn-loop.d.ts.map +1 -1
- package/dist/platform/core/orchestrator-turn-loop.js +121 -3
- package/dist/platform/core/orchestrator.d.ts +67 -0
- package/dist/platform/core/orchestrator.d.ts.map +1 -1
- package/dist/platform/core/orchestrator.js +89 -1
- 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 +204 -0
- package/dist/platform/core/plan-proposal.d.ts.map +1 -0
- package/dist/platform/core/plan-proposal.js +296 -0
- 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/knowledge-api.d.ts +26 -0
- package/dist/platform/knowledge/knowledge-api.d.ts.map +1 -1
- package/dist/platform/knowledge/knowledge-api.js +11 -0
- 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 +22 -0
- package/dist/platform/orchestration/budget.d.ts.map +1 -0
- package/dist/platform/orchestration/budget.js +35 -0
- package/dist/platform/orchestration/cancellation.d.ts +31 -0
- package/dist/platform/orchestration/cancellation.d.ts.map +1 -0
- package/dist/platform/orchestration/cancellation.js +25 -0
- package/dist/platform/orchestration/controller-compat.d.ts +46 -0
- package/dist/platform/orchestration/controller-compat.d.ts.map +1 -0
- package/dist/platform/orchestration/controller-compat.js +27 -0
- package/dist/platform/orchestration/dirty-guard.d.ts +32 -0
- package/dist/platform/orchestration/dirty-guard.d.ts.map +1 -0
- package/dist/platform/orchestration/dirty-guard.js +147 -0
- package/dist/platform/orchestration/engine.d.ts +82 -0
- package/dist/platform/orchestration/engine.d.ts.map +1 -0
- package/dist/platform/orchestration/engine.js +623 -0
- package/dist/platform/orchestration/index.d.ts +20 -0
- package/dist/platform/orchestration/index.d.ts.map +1 -0
- package/dist/platform/orchestration/index.js +11 -0
- package/dist/platform/orchestration/persistence.d.ts +24 -0
- package/dist/platform/orchestration/persistence.d.ts.map +1 -0
- package/dist/platform/orchestration/persistence.js +179 -0
- package/dist/platform/orchestration/phase-runner.d.ts +114 -0
- package/dist/platform/orchestration/phase-runner.d.ts.map +1 -0
- package/dist/platform/orchestration/phase-runner.js +347 -0
- 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 +64 -0
- package/dist/platform/orchestration/scheduler.d.ts.map +1 -0
- package/dist/platform/orchestration/scheduler.js +73 -0
- package/dist/platform/orchestration/types.d.ts +535 -0
- package/dist/platform/orchestration/types.d.ts.map +1 -0
- package/dist/platform/orchestration/types.js +47 -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/communication.d.ts +11 -0
- package/dist/platform/runtime/emitters/communication.d.ts.map +1 -1
- package/dist/platform/runtime/emitters/communication.js +9 -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 +56 -1
- package/dist/platform/runtime/fleet/adapters/agent.d.ts +56 -0
- package/dist/platform/runtime/fleet/adapters/agent.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/adapters/agent.js +143 -0
- package/dist/platform/runtime/fleet/adapters/automation.d.ts +30 -0
- package/dist/platform/runtime/fleet/adapters/automation.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/adapters/automation.js +41 -0
- package/dist/platform/runtime/fleet/adapters/background-process.d.ts +12 -0
- package/dist/platform/runtime/fleet/adapters/background-process.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/adapters/background-process.js +46 -0
- package/dist/platform/runtime/fleet/adapters/code-index.d.ts +21 -0
- package/dist/platform/runtime/fleet/adapters/code-index.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/adapters/code-index.js +44 -0
- package/dist/platform/runtime/fleet/adapters/orchestration.d.ts +69 -0
- package/dist/platform/runtime/fleet/adapters/orchestration.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/adapters/orchestration.js +329 -0
- package/dist/platform/runtime/fleet/adapters/schedule.d.ts +14 -0
- package/dist/platform/runtime/fleet/adapters/schedule.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/adapters/schedule.js +28 -0
- package/dist/platform/runtime/fleet/adapters/trigger.d.ts +12 -0
- package/dist/platform/runtime/fleet/adapters/trigger.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/adapters/trigger.js +22 -0
- package/dist/platform/runtime/fleet/adapters/watcher.d.ts +13 -0
- package/dist/platform/runtime/fleet/adapters/watcher.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/adapters/watcher.js +47 -0
- package/dist/platform/runtime/fleet/adapters/workflow.d.ts +11 -0
- package/dist/platform/runtime/fleet/adapters/workflow.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/adapters/workflow.js +34 -0
- package/dist/platform/runtime/fleet/adapters/wrfc.d.ts +35 -0
- package/dist/platform/runtime/fleet/adapters/wrfc.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/adapters/wrfc.js +275 -0
- package/dist/platform/runtime/fleet/index.d.ts +10 -0
- package/dist/platform/runtime/fleet/index.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/index.js +6 -0
- package/dist/platform/runtime/fleet/registry.d.ts +113 -0
- package/dist/platform/runtime/fleet/registry.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/registry.js +664 -0
- package/dist/platform/runtime/fleet/types.d.ts +199 -0
- package/dist/platform/runtime/fleet/types.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/types.js +2 -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/runtime-knowledge-api.d.ts +1 -1
- package/dist/platform/runtime/runtime-knowledge-api.d.ts.map +1 -1
- package/dist/platform/runtime/runtime-knowledge-api.js +1 -0
- package/dist/platform/runtime/services.d.ts +48 -0
- package/dist/platform/runtime/services.d.ts.map +1 -1
- package/dist/platform/runtime/services.js +95 -2
- 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.d.ts +49 -0
- package/dist/platform/state/code-index-chunking.d.ts.map +1 -0
- package/dist/platform/state/code-index-chunking.js +111 -0
- package/dist/platform/state/code-index-db.d.ts +53 -0
- package/dist/platform/state/code-index-db.d.ts.map +1 -0
- package/dist/platform/state/code-index-db.js +101 -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 +175 -0
- package/dist/platform/state/code-index-store.d.ts.map +1 -0
- package/dist/platform/state/code-index-store.js +620 -0
- package/dist/platform/state/index.d.ts +12 -2
- package/dist/platform/state/index.d.ts.map +1 -1
- package/dist/platform/state/index.js +6 -1
- package/dist/platform/state/knowledge-injection.d.ts +23 -0
- package/dist/platform/state/knowledge-injection.d.ts.map +1 -1
- package/dist/platform/state/knowledge-injection.js +34 -19
- 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 +1 -13
- package/dist/platform/state/memory-vector-store.d.ts.map +1 -1
- package/dist/platform/state/memory-vector-store.js +18 -39
- 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 +25 -0
- package/dist/platform/state/sqlite-vec-loader.d.ts.map +1 -0
- package/dist/platform/state/sqlite-vec-loader.js +43 -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 +140 -1
- package/dist/platform/tools/agent/manager.d.ts.map +1 -1
- package/dist/platform/tools/agent/manager.js +143 -1
- 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 +161 -49
- package/dist/platform/tools/exec/schema.d.ts +3 -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/fetch/runtime.d.ts +7 -0
- package/dist/platform/tools/fetch/runtime.d.ts.map +1 -1
- package/dist/platform/tools/fetch/runtime.js +8 -6
- 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 +9 -3
- package/dist/platform/tools/registry.d.ts.map +1 -1
- package/dist/platform/tools/registry.js +9 -3
- 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 +14 -1
- package/dist/platform/types/tools.d.ts.map +1 -1
- package/dist/platform/version.js +1 -1
- package/package.json +29 -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
|
@@ -0,0 +1,227 @@
|
|
|
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
|
+
import { existsSync, readdirSync } from 'node:fs';
|
|
19
|
+
import { join } from 'node:path';
|
|
20
|
+
import { PersistentStore } from '../state/persistent-store.js';
|
|
21
|
+
import { CompanionChatPersistence } from '../companion/companion-chat-persistence.js';
|
|
22
|
+
import { defaultSessionsDir } from '../companion/companion-chat-persistence.js';
|
|
23
|
+
import { loadSessionBrokerState, createSessionBrokerSnapshot } from './session-broker-state.js';
|
|
24
|
+
import { logger } from '../utils/logger.js';
|
|
25
|
+
import { summarizeError } from '../utils/error-display.js';
|
|
26
|
+
/**
|
|
27
|
+
* How many message bodies to retain PER SESSION when re-persisting the merged
|
|
28
|
+
* store. This is a per-session cap, not a global one: every session keeps its
|
|
29
|
+
* most-recent 2 000 bodies independently, and a session that is truncated is
|
|
30
|
+
* stamped with an honest `retainedMessageCount` (see createSessionBrokerSnapshot).
|
|
31
|
+
* Migration therefore never silently drops whole sessions' transcripts.
|
|
32
|
+
*/
|
|
33
|
+
const MAX_PERSISTED_MESSAGES_PER_SESSION = 2_000;
|
|
34
|
+
/**
|
|
35
|
+
* Discover the legacy stores reachable from a single project root plus the
|
|
36
|
+
* home-scoped companion directory. Scans <projectRoot>/.goodvibes/<surface>/
|
|
37
|
+
* control-plane/sessions.json across every surface subdir (tui, goodvibes,
|
|
38
|
+
* agent, …). The home store itself is never returned as a source.
|
|
39
|
+
*/
|
|
40
|
+
export function discoverLegacySessionSources(input) {
|
|
41
|
+
const sources = [];
|
|
42
|
+
const companionDir = input.companionSessionsDir ?? defaultSessionsDir();
|
|
43
|
+
sources.push({ kind: 'companion-dir', path: companionDir, project: 'unknown' });
|
|
44
|
+
const goodvibesRoot = join(input.projectRoot, '.goodvibes');
|
|
45
|
+
let surfaceDirs = [];
|
|
46
|
+
try {
|
|
47
|
+
surfaceDirs = existsSync(goodvibesRoot)
|
|
48
|
+
? readdirSync(goodvibesRoot, { withFileTypes: true })
|
|
49
|
+
.filter((entry) => entry.isDirectory())
|
|
50
|
+
.map((entry) => entry.name)
|
|
51
|
+
: [];
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
logger.warn('[session-import] failed to scan project .goodvibes root', {
|
|
55
|
+
root: goodvibesRoot,
|
|
56
|
+
error: summarizeError(error),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
for (const surface of surfaceDirs) {
|
|
60
|
+
const storePath = join(goodvibesRoot, surface, 'control-plane', 'sessions.json');
|
|
61
|
+
if (existsSync(storePath)) {
|
|
62
|
+
sources.push({ kind: 'broker-store', path: storePath, project: input.projectRoot });
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return sources;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Fold every source into the home store at `homeStorePath`, idempotently.
|
|
69
|
+
* Starts from the existing home store, merges each source keyed by session id
|
|
70
|
+
* (newer updatedAt wins; messages/inputs union-deduped by id), and re-persists
|
|
71
|
+
* atomically. A second run over the same sources produces the same store.
|
|
72
|
+
*/
|
|
73
|
+
export async function importLegacySessionStores(input) {
|
|
74
|
+
const homeStore = new PersistentStore(input.homeStorePath);
|
|
75
|
+
const existing = loadSessionBrokerState(await safeLoad(homeStore));
|
|
76
|
+
const state = {
|
|
77
|
+
sessions: new Map(existing.sessions),
|
|
78
|
+
messages: new Map(),
|
|
79
|
+
inputs: new Map(),
|
|
80
|
+
};
|
|
81
|
+
for (const bucket of existing.messages.values())
|
|
82
|
+
for (const m of bucket)
|
|
83
|
+
state.messages.set(m.id, m);
|
|
84
|
+
for (const bucket of existing.inputs.values())
|
|
85
|
+
for (const i of bucket)
|
|
86
|
+
state.inputs.set(i.id, i);
|
|
87
|
+
const startCount = state.sessions.size;
|
|
88
|
+
const missingSources = [];
|
|
89
|
+
const skippedFiles = [];
|
|
90
|
+
for (const source of input.sources) {
|
|
91
|
+
if (!existsSync(source.path)) {
|
|
92
|
+
missingSources.push(source.path);
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (source.kind === 'companion-dir') {
|
|
96
|
+
await mergeCompanionDir(state, source, skippedFiles);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
await mergeBrokerStore(state, source, skippedFiles);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
await homeStore.persist(buildSnapshot(state));
|
|
103
|
+
return {
|
|
104
|
+
total: state.sessions.size,
|
|
105
|
+
imported: state.sessions.size - startCount,
|
|
106
|
+
missingSources,
|
|
107
|
+
skippedFiles,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
async function safeLoad(store) {
|
|
111
|
+
try {
|
|
112
|
+
return await store.load();
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
logger.warn('[session-import] home store failed to load; starting empty', {
|
|
116
|
+
error: summarizeError(error),
|
|
117
|
+
});
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
async function mergeBrokerStore(state, source, skippedFiles) {
|
|
122
|
+
let loaded;
|
|
123
|
+
try {
|
|
124
|
+
const snapshot = await new PersistentStore(source.path).load();
|
|
125
|
+
loaded = loadSessionBrokerState(snapshot);
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
logger.warn('[session-import] broker store failed to load; skipping', {
|
|
129
|
+
path: source.path,
|
|
130
|
+
error: summarizeError(error),
|
|
131
|
+
});
|
|
132
|
+
skippedFiles.push(source.path);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
for (const record of loaded.sessions.values()) {
|
|
136
|
+
const stamped = record.project === 'unknown' && source.project
|
|
137
|
+
? { ...record, project: source.project }
|
|
138
|
+
: record;
|
|
139
|
+
upsertSession(state, stamped);
|
|
140
|
+
}
|
|
141
|
+
for (const bucket of loaded.messages.values()) {
|
|
142
|
+
for (const message of bucket)
|
|
143
|
+
if (!state.messages.has(message.id))
|
|
144
|
+
state.messages.set(message.id, message);
|
|
145
|
+
}
|
|
146
|
+
for (const bucket of loaded.inputs.values()) {
|
|
147
|
+
for (const inputRecord of bucket)
|
|
148
|
+
if (!state.inputs.has(inputRecord.id))
|
|
149
|
+
state.inputs.set(inputRecord.id, inputRecord);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
async function mergeCompanionDir(state, source, skippedFiles) {
|
|
153
|
+
const persistence = new CompanionChatPersistence(source.path);
|
|
154
|
+
const stored = await persistence.loadAll();
|
|
155
|
+
for (const { meta, messages } of stored) {
|
|
156
|
+
const converted = companionMessagesToShared(meta.id, messages);
|
|
157
|
+
for (const message of converted)
|
|
158
|
+
if (!state.messages.has(message.id))
|
|
159
|
+
state.messages.set(message.id, message);
|
|
160
|
+
upsertSession(state, companionSessionToShared(meta, converted, source.project ?? 'unknown'));
|
|
161
|
+
}
|
|
162
|
+
// CompanionChatPersistence.loadAll already logs+skips corrupt files internally;
|
|
163
|
+
// there is no per-file signal to surface here beyond its own warnings.
|
|
164
|
+
void skippedFiles;
|
|
165
|
+
}
|
|
166
|
+
function upsertSession(state, incoming) {
|
|
167
|
+
const current = state.sessions.get(incoming.id);
|
|
168
|
+
if (!current || incoming.updatedAt >= current.updatedAt) {
|
|
169
|
+
const participants = current
|
|
170
|
+
? mergeParticipants(current, incoming)
|
|
171
|
+
: incoming.participants;
|
|
172
|
+
state.sessions.set(incoming.id, { ...incoming, participants });
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function mergeParticipants(current, incoming) {
|
|
176
|
+
const byId = new Map();
|
|
177
|
+
for (const p of current.participants)
|
|
178
|
+
byId.set(`${p.surfaceKind}:${p.surfaceId}:${p.userId ?? ''}`, p);
|
|
179
|
+
for (const p of incoming.participants)
|
|
180
|
+
byId.set(`${p.surfaceKind}:${p.surfaceId}:${p.userId ?? ''}`, p);
|
|
181
|
+
return [...byId.values()];
|
|
182
|
+
}
|
|
183
|
+
function companionSessionToShared(meta, messages, project) {
|
|
184
|
+
const lastMessageAt = messages.reduce((latest, m) => (latest === undefined || m.createdAt > latest ? m.createdAt : latest), undefined);
|
|
185
|
+
return {
|
|
186
|
+
id: meta.id,
|
|
187
|
+
kind: 'companion-chat',
|
|
188
|
+
project,
|
|
189
|
+
title: meta.title.trim().length > 0 ? meta.title : `Session ${meta.id}`,
|
|
190
|
+
status: meta.status,
|
|
191
|
+
createdAt: meta.createdAt,
|
|
192
|
+
updatedAt: meta.updatedAt,
|
|
193
|
+
...(lastMessageAt !== undefined ? { lastMessageAt } : {}),
|
|
194
|
+
...(meta.closedAt != null ? { closedAt: meta.closedAt } : {}),
|
|
195
|
+
lastActivityAt: meta.updatedAt,
|
|
196
|
+
messageCount: messages.length,
|
|
197
|
+
pendingInputCount: 0,
|
|
198
|
+
routeIds: [],
|
|
199
|
+
surfaceKinds: ['companion'],
|
|
200
|
+
participants: [{ surfaceKind: 'companion', surfaceId: meta.id, lastSeenAt: meta.updatedAt }],
|
|
201
|
+
metadata: {},
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
function companionMessagesToShared(sessionId, messages) {
|
|
205
|
+
return messages.map((message) => ({
|
|
206
|
+
id: message.id,
|
|
207
|
+
sessionId,
|
|
208
|
+
role: message.role,
|
|
209
|
+
body: message.content,
|
|
210
|
+
createdAt: message.createdAt,
|
|
211
|
+
surfaceKind: 'companion',
|
|
212
|
+
surfaceId: sessionId,
|
|
213
|
+
metadata: {},
|
|
214
|
+
}));
|
|
215
|
+
}
|
|
216
|
+
function buildSnapshot(state) {
|
|
217
|
+
const sessions = new Map(state.sessions);
|
|
218
|
+
const messages = new Map();
|
|
219
|
+
const inputs = new Map();
|
|
220
|
+
for (const message of state.messages.values()) {
|
|
221
|
+
messages.set(message.sessionId, [...(messages.get(message.sessionId) ?? []), message]);
|
|
222
|
+
}
|
|
223
|
+
for (const inputRecord of state.inputs.values()) {
|
|
224
|
+
inputs.set(inputRecord.sessionId, [...(inputs.get(inputRecord.sessionId) ?? []), inputRecord]);
|
|
225
|
+
}
|
|
226
|
+
return createSessionBrokerSnapshot({ sessions, messages, inputs }, MAX_PERSISTED_MESSAGES_PER_SESSION);
|
|
227
|
+
}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import type { AutomationRouteBinding } from '../automation/routes.js';
|
|
2
2
|
import type { AutomationSurfaceKind } from '../automation/types.js';
|
|
3
|
+
import type { SurfaceKind } from '../../events/surfaces.js';
|
|
3
4
|
import type { SharedSessionInputIntent, SharedSessionInputRecord, SharedSessionRoutingIntent } from './session-intents.js';
|
|
4
5
|
export type SharedSessionStatus = 'active' | 'closed';
|
|
5
6
|
export type SharedSessionMessageRole = 'user' | 'assistant' | 'system';
|
|
7
|
+
/**
|
|
8
|
+
* A session participant — the identity triple {surfaceKind, surfaceId, userId?}
|
|
9
|
+
* standardized on the canonical (wide) {@link SurfaceKind}, so product surfaces
|
|
10
|
+
* (agent/webui/companion) are first-class participants alongside transport
|
|
11
|
+
* surfaces. `userId` is the documented identity key. This is a DIFFERENT axis
|
|
12
|
+
* from {@link SharedSessionRecord.kind} (the session origin).
|
|
13
|
+
*/
|
|
6
14
|
export interface SharedSessionParticipant {
|
|
7
|
-
readonly surfaceKind:
|
|
15
|
+
readonly surfaceKind: SurfaceKind;
|
|
8
16
|
readonly surfaceId: string;
|
|
9
17
|
readonly externalId?: string | undefined;
|
|
10
18
|
readonly userId?: string | undefined;
|
|
@@ -18,7 +26,7 @@ export interface SharedSessionMessage {
|
|
|
18
26
|
readonly role: SharedSessionMessageRole;
|
|
19
27
|
readonly body: string;
|
|
20
28
|
readonly createdAt: number;
|
|
21
|
-
readonly surfaceKind?:
|
|
29
|
+
readonly surfaceKind?: SurfaceKind | undefined;
|
|
22
30
|
readonly surfaceId?: string | undefined;
|
|
23
31
|
readonly routeId?: string | undefined;
|
|
24
32
|
readonly agentId?: string | undefined;
|
|
@@ -27,15 +35,46 @@ export interface SharedSessionMessage {
|
|
|
27
35
|
readonly metadata: Record<string, unknown>;
|
|
28
36
|
}
|
|
29
37
|
/**
|
|
30
|
-
* Discriminates the session
|
|
31
|
-
*
|
|
38
|
+
* Discriminates the session ORIGIN — which product created the session. This is
|
|
39
|
+
* a separate axis from {@link SharedSessionParticipant.surfaceKind} (the surface
|
|
40
|
+
* a participant speaks through). Do not conflate them: a session's origin `kind`
|
|
41
|
+
* is stamped once at creation; a session can have many participants across many
|
|
42
|
+
* surfaces.
|
|
43
|
+
* - 'tui': created by the operator TUI (default for existing/legacy sessions)
|
|
44
|
+
* - 'agent': created by an agent runtime
|
|
45
|
+
* - 'webui': created by the rich web client
|
|
32
46
|
* - 'companion-task': created via task-submit flow (agent spawn)
|
|
33
47
|
* - 'companion-chat': created via companion chat-mode API (no agent spawn; uses per-session orchestrator)
|
|
48
|
+
* - 'automation': created by an automation job/run
|
|
34
49
|
*/
|
|
35
|
-
export type SharedSessionKind = 'tui' | 'companion-task' | 'companion-chat';
|
|
50
|
+
export type SharedSessionKind = 'tui' | 'agent' | 'webui' | 'companion-task' | 'companion-chat' | 'automation';
|
|
51
|
+
/**
|
|
52
|
+
* Why a session was closed. Drives the honest reopen-on-heartbeat rule:
|
|
53
|
+
* - 'idle-reaped': the GC sweep closed an idle session. It AUTO-REOPENS on the
|
|
54
|
+
* next register heartbeat from a participant (a surface coming back to a
|
|
55
|
+
* session the SYSTEM closed underneath it is not a conflict).
|
|
56
|
+
* - 'user' / 'surface': a deliberate close. It does NOT auto-reopen — register
|
|
57
|
+
* records the heartbeat and returns the still-closed record with a conflict
|
|
58
|
+
* marker unless `reopen: true` is passed (the Wave-1 honest-register semantics).
|
|
59
|
+
*
|
|
60
|
+
* Carried on the record under `metadata[SESSION_CLOSE_REASON_METADATA_KEY]` so it
|
|
61
|
+
* rides the wire without a schema change and old readers ignore it (metadata is
|
|
62
|
+
* an open record). Absent means the session is open, or was closed by a build
|
|
63
|
+
* that predates this field.
|
|
64
|
+
*/
|
|
65
|
+
export type SharedSessionCloseReason = 'idle-reaped' | 'user' | 'surface';
|
|
36
66
|
export interface SharedSessionRecord {
|
|
37
67
|
readonly id: string;
|
|
38
68
|
readonly kind: SharedSessionKind;
|
|
69
|
+
/**
|
|
70
|
+
* The workspace/project this session belongs to, carried as DATA on the
|
|
71
|
+
* record (not encoded in the store path). Typically the absolute working
|
|
72
|
+
* directory of the creating surface, or a stable project id. Legacy records
|
|
73
|
+
* lacking this field are backfilled to 'unknown' on load. Home-scoped,
|
|
74
|
+
* projectless surfaces (e.g. companion chat) use 'unknown'. This is what lets
|
|
75
|
+
* ONE home-scoped store serve every project and every surface filter honestly.
|
|
76
|
+
*/
|
|
77
|
+
readonly project: string;
|
|
39
78
|
readonly title: string;
|
|
40
79
|
readonly status: SharedSessionStatus;
|
|
41
80
|
readonly createdAt: number;
|
|
@@ -51,9 +90,19 @@ export interface SharedSessionRecord {
|
|
|
51
90
|
*/
|
|
52
91
|
readonly lastActivityAt: number;
|
|
53
92
|
readonly messageCount: number;
|
|
93
|
+
/**
|
|
94
|
+
* How many of this session's message BODIES are actually retained in the
|
|
95
|
+
* durable store, when that is fewer than {@link messageCount}. Persistence
|
|
96
|
+
* caps retained bodies per session (see MAX_PERSISTED_MESSAGES_PER_SESSION);
|
|
97
|
+
* when the cap prunes the oldest bodies, `messageCount` stays the honest
|
|
98
|
+
* logical total and this field records how many bodies survived. Omitted when
|
|
99
|
+
* nothing was pruned (retained === messageCount), so the common case carries
|
|
100
|
+
* no marker. Readers must treat an absent value as "fully retained".
|
|
101
|
+
*/
|
|
102
|
+
readonly retainedMessageCount?: number | undefined;
|
|
54
103
|
readonly pendingInputCount: number;
|
|
55
104
|
readonly routeIds: readonly string[];
|
|
56
|
-
readonly surfaceKinds: readonly
|
|
105
|
+
readonly surfaceKinds: readonly SurfaceKind[];
|
|
57
106
|
readonly participants: readonly SharedSessionParticipant[];
|
|
58
107
|
readonly activeAgentId?: string | undefined;
|
|
59
108
|
readonly lastAgentId?: string | undefined;
|
|
@@ -66,7 +115,7 @@ export interface SharedSessionSubmission {
|
|
|
66
115
|
readonly routeBinding?: AutomationRouteBinding | undefined;
|
|
67
116
|
readonly input: SharedSessionInputRecord;
|
|
68
117
|
readonly intent: SharedSessionInputIntent;
|
|
69
|
-
readonly mode: 'spawn' | 'continued-live' | 'queued-follow-up' | 'rejected';
|
|
118
|
+
readonly mode: 'spawn' | 'continued-live' | 'queued-follow-up' | 'queued-for-surface' | 'rejected';
|
|
70
119
|
readonly state: SharedSessionInputRecord['state'];
|
|
71
120
|
readonly task?: string | undefined;
|
|
72
121
|
readonly activeAgentId?: string | undefined;
|
|
@@ -89,9 +138,95 @@ export interface SubmitSharedSessionMessageInput {
|
|
|
89
138
|
export interface SteerSharedSessionMessageInput extends SubmitSharedSessionMessageInput {
|
|
90
139
|
readonly allowSpawnFallback?: boolean | undefined;
|
|
91
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* The participant/route attach input consumed by the broker's participant merge.
|
|
143
|
+
* Identical to a submit message minus `metadata`, but `surfaceKind` is the WIDE
|
|
144
|
+
* canonical {@link SurfaceKind} so product-surface participants (agent/webui/
|
|
145
|
+
* companion) — which arrive via sessions.register, not the transport submit
|
|
146
|
+
* path — can be merged. Transport submit inputs (narrow surfaceKind) remain
|
|
147
|
+
* assignable to this type.
|
|
148
|
+
*/
|
|
149
|
+
export type ParticipantRouteAttachInput = Omit<SubmitSharedSessionMessageInput, 'metadata' | 'surfaceKind'> & {
|
|
150
|
+
readonly surfaceKind: SurfaceKind;
|
|
151
|
+
};
|
|
92
152
|
export interface FindSharedSessionOptions {
|
|
93
153
|
readonly surfaceKind?: AutomationSurfaceKind | undefined;
|
|
94
154
|
readonly routeId?: string | undefined;
|
|
95
155
|
readonly includeClosed?: boolean | undefined;
|
|
156
|
+
/** Scope the search to a single project; omit for the cross-project union. */
|
|
157
|
+
readonly project?: string | undefined;
|
|
158
|
+
}
|
|
159
|
+
/** Options for {@link SharedSessionBroker.listSessions}. */
|
|
160
|
+
export interface ListSharedSessionsOptions {
|
|
161
|
+
/** Scope to a single project; omit for the cross-project union (default). */
|
|
162
|
+
readonly project?: string | undefined;
|
|
163
|
+
/** Filter by origin kind. */
|
|
164
|
+
readonly kind?: SharedSessionKind | undefined;
|
|
165
|
+
/** Include closed sessions (default: closed sessions are included). */
|
|
166
|
+
readonly includeClosed?: boolean | undefined;
|
|
167
|
+
}
|
|
168
|
+
/** Input to {@link SharedSessionBroker.createSession}. */
|
|
169
|
+
export interface CreateSharedSessionInput {
|
|
170
|
+
readonly id?: string | undefined;
|
|
171
|
+
readonly kind?: SharedSessionKind | undefined;
|
|
172
|
+
readonly project?: string | undefined;
|
|
173
|
+
readonly title?: string | undefined;
|
|
174
|
+
readonly metadata?: Record<string, unknown> | undefined;
|
|
175
|
+
readonly routeBinding?: AutomationRouteBinding | undefined;
|
|
176
|
+
readonly participant?: SharedSessionParticipant | undefined;
|
|
177
|
+
}
|
|
178
|
+
/** Input to {@link SharedSessionBroker.ensureSession} (idempotent create-or-adopt). */
|
|
179
|
+
export interface EnsureSharedSessionInput {
|
|
180
|
+
readonly sessionId?: string | undefined;
|
|
181
|
+
readonly kind?: SharedSessionKind | undefined;
|
|
182
|
+
readonly project?: string | undefined;
|
|
183
|
+
readonly title?: string | undefined;
|
|
184
|
+
readonly metadata?: Record<string, unknown> | undefined;
|
|
185
|
+
readonly routeBinding?: AutomationRouteBinding | undefined;
|
|
186
|
+
readonly participant?: SharedSessionParticipant | undefined;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Input to {@link SharedSessionBroker.register} — the idempotent upsert keyed on
|
|
190
|
+
* a caller-supplied session id. Re-calling register with the same id is the
|
|
191
|
+
* heartbeat: it advances `participant.lastSeenAt`. Carries the identity spine
|
|
192
|
+
* (kind + project + participant triple) that {@link EnsureSharedSessionInput}
|
|
193
|
+
* threads into the record.
|
|
194
|
+
*/
|
|
195
|
+
export interface RegisterSharedSessionInput {
|
|
196
|
+
readonly sessionId: string;
|
|
197
|
+
readonly kind?: SharedSessionKind | undefined;
|
|
198
|
+
readonly project?: string | undefined;
|
|
199
|
+
readonly title?: string | undefined;
|
|
200
|
+
readonly participant: SharedSessionParticipant;
|
|
201
|
+
/**
|
|
202
|
+
* Explicit intent to reopen a CLOSED session. Default `false`: registering
|
|
203
|
+
* against a closed id does NOT silently reopen it — it records the heartbeat
|
|
204
|
+
* (participant.lastSeenAt) and returns the still-closed record with an honest
|
|
205
|
+
* conflict marker. Pass `true` to reopen as part of the register.
|
|
206
|
+
*/
|
|
207
|
+
readonly reopen?: boolean | undefined;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Result of {@link SharedSessionBroker.register}. Carries the record plus honest
|
|
211
|
+
* lifecycle disposition so a caller (and the wire) never has to guess whether a
|
|
212
|
+
* closed session was resurrected.
|
|
213
|
+
*
|
|
214
|
+
* SPOOFING / TRUST NOTE: the control plane uses a single-admin-token model, so
|
|
215
|
+
* cross-surface writes under the same token (e.g. two surfaces heartbeating the
|
|
216
|
+
* same session id) are LEGITIMATE co-participation, not impersonation. `register`
|
|
217
|
+
* merges participants freely; what it will NOT do silently is change lifecycle
|
|
218
|
+
* status or rename a titled session.
|
|
219
|
+
*/
|
|
220
|
+
export interface SharedSessionRegisterResult {
|
|
221
|
+
readonly record: SharedSessionRecord;
|
|
222
|
+
/** True only when this call reopened a previously-closed session. */
|
|
223
|
+
readonly reopened: boolean;
|
|
224
|
+
/**
|
|
225
|
+
* Present when register targeted a CLOSED session without `reopen: true`. The
|
|
226
|
+
* record is returned as-is (still closed) with the heartbeat recorded.
|
|
227
|
+
*/
|
|
228
|
+
readonly conflict?: {
|
|
229
|
+
readonly status: 'closed';
|
|
230
|
+
} | undefined;
|
|
96
231
|
}
|
|
97
232
|
//# sourceMappingURL=session-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-types.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/session-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EACV,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,sBAAsB,CAAC;AAE9B,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AACtD,MAAM,MAAM,wBAAwB,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;AAEvE,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,WAAW,EAAE,
|
|
1
|
+
{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;IAC3D,QAAQ,CAAC,WAAW,CAAC,EAAE,wBAAwB,GAAG,SAAS,CAAC;CAC7D;AAED;;;;;;GAMG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC9C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,WAAW,EAAE,wBAAwB,CAAC;IAC/C;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACvC;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IACrC,qEAAqE;IACrE,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAA;KAAE,GAAG,SAAS,CAAC;CAC/D"}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* /plan explain
|
|
10
10
|
* /plan override <strategy>
|
|
11
11
|
*/
|
|
12
|
+
import { type PlanProposal, type PlanProposalIssue, type RawDecomposition } from './plan-proposal.js';
|
|
12
13
|
/**
|
|
13
14
|
* The five supported execution strategies.
|
|
14
15
|
*
|
|
@@ -52,6 +53,18 @@ export interface StrategyCandidate {
|
|
|
52
53
|
score: number;
|
|
53
54
|
reasonCode: StrategyReasonCode;
|
|
54
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* The outcome of the deterministic "does this task warrant decomposition?"
|
|
58
|
+
* gate. This is a semantic projection of the existing strategy selection —
|
|
59
|
+
* `decompose` is simply `selected !== 'single'` — so every existing reason
|
|
60
|
+
* code and the `/plan explain` output stay authoritative. No new scoring
|
|
61
|
+
* logic lives here.
|
|
62
|
+
*/
|
|
63
|
+
export interface DecompositionGate {
|
|
64
|
+
decompose: boolean;
|
|
65
|
+
strategy: ExecutionStrategy;
|
|
66
|
+
reasonCode: StrategyReasonCode;
|
|
67
|
+
}
|
|
55
68
|
/** The outcome of a planner selection pass. */
|
|
56
69
|
export interface PlannerDecision {
|
|
57
70
|
/** The strategy that was ultimately selected. */
|
|
@@ -86,6 +99,43 @@ export declare class AdaptivePlanner {
|
|
|
86
99
|
* The decision is appended to the history log.
|
|
87
100
|
*/
|
|
88
101
|
select(inputs: PlannerInputs): PlannerDecision;
|
|
102
|
+
/**
|
|
103
|
+
* Deterministic gate: does this task warrant decomposition into a
|
|
104
|
+
* multi-phase workstream, or is a single-item workstream the honest
|
|
105
|
+
* answer?
|
|
106
|
+
*
|
|
107
|
+
* This calls the existing `select()` pipeline — no new scoring logic — and
|
|
108
|
+
* projects the result: `decompose` is `selected !== 'single'`. Because it
|
|
109
|
+
* goes through `select()`, the decision is appended to the same audit
|
|
110
|
+
* history as every other planner call, and `/plan explain` / `/plan
|
|
111
|
+
* status` remain authoritative for it.
|
|
112
|
+
*/
|
|
113
|
+
shouldDecompose(inputs: PlannerInputs): DecompositionGate;
|
|
114
|
+
/**
|
|
115
|
+
* Produce a typed `PlanProposal` for the given inputs.
|
|
116
|
+
*
|
|
117
|
+
* `AdaptivePlanner` never spawns a planning agent and never performs LLM
|
|
118
|
+
* decomposition itself — it only gates (via `shouldDecompose`) and
|
|
119
|
+
* validates/assembles (via `assemblePlanProposal`, in `plan-proposal.ts`).
|
|
120
|
+
* The raw decomposition, if any, is expected to come from a planning
|
|
121
|
+
* agent that the ORCHESTRATION ENGINE spawns and hands back here.
|
|
122
|
+
*
|
|
123
|
+
* - If the gate says decomposition is not warranted, or no raw
|
|
124
|
+
* decomposition is available yet, this returns the honest single-item
|
|
125
|
+
* fallback (`singleItemProposal`) — never a partially-assembled guess.
|
|
126
|
+
* - Otherwise it validates `raw` via `assemblePlanProposal`, which never
|
|
127
|
+
* throws: malformed decompositions degrade to an honest partial result
|
|
128
|
+
* plus a list of `issues`.
|
|
129
|
+
*
|
|
130
|
+
* Returns the `gate` alongside the proposal so callers (the engine, or the
|
|
131
|
+
* TUI) can show WHY a proposal was or wasn't decomposed, reusing
|
|
132
|
+
* `AdaptivePlanner.explainReasonCode`.
|
|
133
|
+
*/
|
|
134
|
+
proposeWorkstream(inputs: PlannerInputs, raw?: RawDecomposition): {
|
|
135
|
+
proposal: PlanProposal;
|
|
136
|
+
gate: DecompositionGate;
|
|
137
|
+
issues: PlanProposalIssue[];
|
|
138
|
+
};
|
|
89
139
|
/**
|
|
90
140
|
* Set the operating mode for future calls to `select()`.
|
|
91
141
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptive-planner.d.ts","sourceRoot":"","sources":["../../../src/platform/core/adaptive-planner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"adaptive-planner.d.ts","sourceRoot":"","sources":["../../../src/platform/core/adaptive-planner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAM5B;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,YAAY,GAAG,QAAQ,CAAC;AAEvF,yFAAyF;AACzF,eAAO,MAAM,gBAAgB,EAAE,iBAAiB,EAAyD,CAAC;AAE1G;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAE1B,oBAAoB,GACpB,4BAA4B,GAC5B,oBAAoB,GACpB,gBAAgB,GAChB,qBAAqB,GACrB,gBAAgB,GAChB,sBAAsB,GAEtB,eAAe,GACf,eAAe,GAEf,kBAAkB,CAAC;AAEvB,6DAA6D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Proposal, singleItemProposal, } from './plan-proposal.js';
|
|
13
14
|
/** All valid strategy names (including 'auto'). Exported for use in command handlers. */
|
|
14
15
|
export const VALID_STRATEGIES = ['auto', 'single', 'cohort', 'background', 'remote'];
|
|
15
16
|
// ---------------------------------------------------------------------------
|
|
@@ -172,6 +173,54 @@ export class AdaptivePlanner {
|
|
|
172
173
|
});
|
|
173
174
|
return decision;
|
|
174
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Deterministic gate: does this task warrant decomposition into a
|
|
178
|
+
* multi-phase workstream, or is a single-item workstream the honest
|
|
179
|
+
* answer?
|
|
180
|
+
*
|
|
181
|
+
* This calls the existing `select()` pipeline — no new scoring logic — and
|
|
182
|
+
* projects the result: `decompose` is `selected !== 'single'`. Because it
|
|
183
|
+
* goes through `select()`, the decision is appended to the same audit
|
|
184
|
+
* history as every other planner call, and `/plan explain` / `/plan
|
|
185
|
+
* status` remain authoritative for it.
|
|
186
|
+
*/
|
|
187
|
+
shouldDecompose(inputs) {
|
|
188
|
+
const decision = this.select(inputs);
|
|
189
|
+
return {
|
|
190
|
+
decompose: decision.selected !== 'single',
|
|
191
|
+
strategy: decision.selected,
|
|
192
|
+
reasonCode: decision.reasonCode,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Produce a typed `PlanProposal` for the given inputs.
|
|
197
|
+
*
|
|
198
|
+
* `AdaptivePlanner` never spawns a planning agent and never performs LLM
|
|
199
|
+
* decomposition itself — it only gates (via `shouldDecompose`) and
|
|
200
|
+
* validates/assembles (via `assemblePlanProposal`, in `plan-proposal.ts`).
|
|
201
|
+
* The raw decomposition, if any, is expected to come from a planning
|
|
202
|
+
* agent that the ORCHESTRATION ENGINE spawns and hands back here.
|
|
203
|
+
*
|
|
204
|
+
* - If the gate says decomposition is not warranted, or no raw
|
|
205
|
+
* decomposition is available yet, this returns the honest single-item
|
|
206
|
+
* fallback (`singleItemProposal`) — never a partially-assembled guess.
|
|
207
|
+
* - Otherwise it validates `raw` via `assemblePlanProposal`, which never
|
|
208
|
+
* throws: malformed decompositions degrade to an honest partial result
|
|
209
|
+
* plus a list of `issues`.
|
|
210
|
+
*
|
|
211
|
+
* Returns the `gate` alongside the proposal so callers (the engine, or the
|
|
212
|
+
* TUI) can show WHY a proposal was or wasn't decomposed, reusing
|
|
213
|
+
* `AdaptivePlanner.explainReasonCode`.
|
|
214
|
+
*/
|
|
215
|
+
proposeWorkstream(inputs, raw) {
|
|
216
|
+
const gate = this.shouldDecompose(inputs);
|
|
217
|
+
const task = inputs.taskDescription ?? '';
|
|
218
|
+
if (gate.decompose && raw) {
|
|
219
|
+
const { proposal, issues } = assemblePlanProposal(task, gate.strategy, raw);
|
|
220
|
+
return { proposal, gate, issues };
|
|
221
|
+
}
|
|
222
|
+
return { proposal: singleItemProposal(task), gate, issues: [] };
|
|
223
|
+
}
|
|
175
224
|
/**
|
|
176
225
|
* Set the operating mode for future calls to `select()`.
|
|
177
226
|
*
|
|
@@ -14,16 +14,43 @@ export interface PlanItem {
|
|
|
14
14
|
agentId?: string;
|
|
15
15
|
dependencies?: string[];
|
|
16
16
|
}
|
|
17
|
+
export type ExecutionPlanStatus = 'draft' | 'active' | 'complete' | 'failed' | 'dismissed';
|
|
17
18
|
export interface ExecutionPlan {
|
|
18
19
|
id: string;
|
|
19
20
|
title: string;
|
|
20
21
|
createdAt: string;
|
|
21
22
|
updatedAt: string;
|
|
22
23
|
sessionId?: string | undefined;
|
|
23
|
-
status:
|
|
24
|
+
status: ExecutionPlanStatus;
|
|
24
25
|
items: PlanItem[];
|
|
25
26
|
specPath?: string;
|
|
26
27
|
awaitingPlan?: boolean;
|
|
28
|
+
/** ISO timestamp set when the plan was dismissed/archived (status 'dismissed'). */
|
|
29
|
+
dismissedAt?: string;
|
|
30
|
+
/** The status the plan held immediately before it was dismissed — preserved so
|
|
31
|
+
* a completed/failed record is not silently rewritten to look like a draft. */
|
|
32
|
+
dismissedFrom?: Exclude<ExecutionPlanStatus, 'dismissed'>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Outcome of {@link ExecutionPlanManager.dismiss}. Dismiss is intentionally
|
|
36
|
+
* refused mid-execution: an in-flight plan must be stopped via the workstream
|
|
37
|
+
* cancel path first, so `dismiss` never silently abandons running agent work.
|
|
38
|
+
*
|
|
39
|
+
* - `no-active-plan` — nothing to dismiss; no mutation.
|
|
40
|
+
* - `requires-cancel` — the active plan is mid-execution ('active');
|
|
41
|
+
* refused. Cancel the workstream first, then dismiss.
|
|
42
|
+
* - `dismissed` — a proposal/awaiting-approval or terminal plan was
|
|
43
|
+
* archived: retained on disk with status 'dismissed'
|
|
44
|
+
* + `dismissedAt`, and the active pointer cleared so a
|
|
45
|
+
* later `/plan <goal>` starts fresh.
|
|
46
|
+
*/
|
|
47
|
+
export type DismissPlanOutcome = 'no-active-plan' | 'requires-cancel' | 'dismissed';
|
|
48
|
+
export interface DismissPlanResult {
|
|
49
|
+
readonly outcome: DismissPlanOutcome;
|
|
50
|
+
/** The archived plan (only when `outcome === 'dismissed'`). */
|
|
51
|
+
readonly plan?: ExecutionPlan;
|
|
52
|
+
/** The plan that blocked dismissal (only when `outcome === 'requires-cancel'`). */
|
|
53
|
+
readonly blockedBy?: ExecutionPlan;
|
|
27
54
|
}
|
|
28
55
|
export interface ExecutionPlanParseIssue {
|
|
29
56
|
readonly line: number;
|
|
@@ -50,6 +77,21 @@ export declare class ExecutionPlanManager {
|
|
|
50
77
|
create(title: string, items: Omit<PlanItem, 'id' | 'status'>[], sessionId?: string): ExecutionPlan;
|
|
51
78
|
/** Update a plan item's status (and optionally assign an agent). */
|
|
52
79
|
updateItem(planId: string, itemId: string, status: PlanItemStatus, agentId?: string): void;
|
|
80
|
+
/**
|
|
81
|
+
* Dismiss (archive) the active plan for the current session.
|
|
82
|
+
*
|
|
83
|
+
* Honest semantics for every plan state:
|
|
84
|
+
* - No active plan → no-op (`{ outcome: 'no-active-plan' }`), nothing written.
|
|
85
|
+
* - Active/mid-execution ('active') → refused (`{ outcome: 'requires-cancel' }`).
|
|
86
|
+
* A running plan must be stopped via the workstream cancel path first;
|
|
87
|
+
* dismiss never abandons in-flight agent work by fiat.
|
|
88
|
+
* - Proposal/awaiting-approval ('draft') or a terminal record ('complete' /
|
|
89
|
+
* 'failed') → archived: the plan is RETAINED on disk with status
|
|
90
|
+
* 'dismissed', a `dismissedAt` timestamp, and `dismissedFrom` recording
|
|
91
|
+
* the prior status; the active pointer is cleared so a later
|
|
92
|
+
* `/plan <goal>` starts a fresh plan. Nothing is deleted.
|
|
93
|
+
*/
|
|
94
|
+
dismiss(sessionId?: string): DismissPlanResult;
|
|
53
95
|
/** List all plans (reads directory, excludes active.json). */
|
|
54
96
|
list(): ExecutionPlan[];
|
|
55
97
|
private nextCreatedAt;
|