@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
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* client.ts — the SDK session-spine surface client.
|
|
3
|
+
*
|
|
4
|
+
* The in-process coordinator that mirrors a surface's OWN session identity
|
|
5
|
+
* (create / resume / heartbeat / close) into the daemon-hosted session spine.
|
|
6
|
+
* It sits NEXT TO a surface's local session truth, never replacing it: the local
|
|
7
|
+
* store stays the offline read-model; this client mirrors identity to the daemon
|
|
8
|
+
* and buffers ops when the daemon is unreachable.
|
|
9
|
+
*
|
|
10
|
+
* This is the ONE core extracted from two near-twin implementations — the TUI's
|
|
11
|
+
* typed-client version (`goodvibes-tui` src/runtime/session-spine-client.ts) and
|
|
12
|
+
* the agent's raw-REST version (`goodvibes-agent` src/runtime/session-spine-client.ts).
|
|
13
|
+
* The union of their behaviors is the spec; their differences are parameterized:
|
|
14
|
+
*
|
|
15
|
+
* - TRANSPORT is injected. The core builds a canonical
|
|
16
|
+
* {@link RegisterSharedSessionInput} and hands it to an injected
|
|
17
|
+
* {@link SpineTransport}; the adapter performs the real wire call (a typed SDK
|
|
18
|
+
* sessions client, or a hand-rolled version-tolerant REST mirror) and folds its
|
|
19
|
+
* result into a {@link SpineResult}. The core NEVER assumes a typed client
|
|
20
|
+
* exists — that is exactly why the agent, which compiles against a pinned npm
|
|
21
|
+
* SDK that may predate `sessions.register`, can still use this core.
|
|
22
|
+
* - ACTIVATION MODE is optional. Construct WITH a `transport` for
|
|
23
|
+
* live-immediately mode (the agent — live for the whole process lifetime), or
|
|
24
|
+
* WITHOUT one for dormant-until-`activate()` mode (the TUI — activated once its
|
|
25
|
+
* bootstrap adopts a compatible external daemon, deactivated when the mode is
|
|
26
|
+
* lost).
|
|
27
|
+
* - PARTICIPANT identity, origin `kind`, queue bound and heartbeat window are
|
|
28
|
+
* options with the verified defaults.
|
|
29
|
+
*
|
|
30
|
+
* Discipline (load-bearing for the interactive-latency budget):
|
|
31
|
+
* - Every public method (register / reopen / heartbeat / close /
|
|
32
|
+
* foldLegacyRecords) is fire-and-forget: it returns `void` SYNCHRONOUSLY and
|
|
33
|
+
* never throws into the caller, even when the wire call rejects. Session
|
|
34
|
+
* start/resume/heartbeat never block the render or turn path.
|
|
35
|
+
* - Before a transport is attached every op is queued, never dropped-on-the-floor
|
|
36
|
+
* and never attempted over a transport that does not exist. Attaching flushes
|
|
37
|
+
* the backlog.
|
|
38
|
+
* - Offline ops go into a bounded ring (drop-oldest); flush is idempotent because
|
|
39
|
+
* register is an upsert.
|
|
40
|
+
* - Heartbeat is debounced/coalesced to at most one wire call per window and omits
|
|
41
|
+
* the title so it never renames a titled session.
|
|
42
|
+
* - A timer-driven keepalive fires the heartbeat on a fixed cadence INDEPENDENT of
|
|
43
|
+
* render/turn activity, so a live-but-idle surface keeps its participant
|
|
44
|
+
* lastSeenAt fresh and never falls outside the daemon's freshness/reaper windows.
|
|
45
|
+
*/
|
|
46
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
47
|
+
import { dirname } from 'node:path';
|
|
48
|
+
import { logger } from '../../utils/logger.js';
|
|
49
|
+
/**
|
|
50
|
+
* The canonical TUI participant (TRANSPORT axis). Pass as the `participant` option
|
|
51
|
+
* when the surface is the operator terminal UI.
|
|
52
|
+
*/
|
|
53
|
+
export const TUI_SPINE_PARTICIPANT = {
|
|
54
|
+
surfaceKind: 'tui',
|
|
55
|
+
surfaceId: 'surface:tui',
|
|
56
|
+
displayName: 'Terminal UI',
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* The canonical agent participant (TRANSPORT axis). `surfaceKind` stays 'service';
|
|
60
|
+
* the record origin `kind` ('agent') is stamped by the REST mirror server-side, not
|
|
61
|
+
* here — so the agent leaves `recordKind` unset.
|
|
62
|
+
*/
|
|
63
|
+
export const AGENT_SPINE_PARTICIPANT = {
|
|
64
|
+
surfaceKind: 'service',
|
|
65
|
+
surfaceId: 'surface:goodvibes-agent',
|
|
66
|
+
displayName: 'GoodVibes Agent',
|
|
67
|
+
};
|
|
68
|
+
const DEFAULT_QUEUE_LIMIT = 128;
|
|
69
|
+
const DEFAULT_HEARTBEAT_MIN_INTERVAL_MS = 45_000;
|
|
70
|
+
export class SessionSpineClient {
|
|
71
|
+
participant;
|
|
72
|
+
recordKind;
|
|
73
|
+
probeImpl;
|
|
74
|
+
now;
|
|
75
|
+
queueLimit;
|
|
76
|
+
heartbeatMinIntervalMs;
|
|
77
|
+
log;
|
|
78
|
+
transport = null;
|
|
79
|
+
reachability = 'unknown';
|
|
80
|
+
records = new Map();
|
|
81
|
+
queue = [];
|
|
82
|
+
lastHeartbeatAt = 0;
|
|
83
|
+
heartbeatTimer = null;
|
|
84
|
+
flushing = false;
|
|
85
|
+
/** The most recently registered/reopened session — the keepalive heartbeat target. */
|
|
86
|
+
lastSessionId = null;
|
|
87
|
+
/**
|
|
88
|
+
* Timer-driven keepalive: fires the heartbeat on a fixed cadence INDEPENDENT of
|
|
89
|
+
* render/turn activity, so a live-but-render-silent surface keeps its participant
|
|
90
|
+
* lastSeenAt fresh. Each tick is just a heartbeat() call, so it rides the SAME
|
|
91
|
+
* bounded offline-queue/reconnect handling as every other op — no new retry loop,
|
|
92
|
+
* no faster-than-cadence attempts against a dead daemon.
|
|
93
|
+
*/
|
|
94
|
+
keepaliveTimer = null;
|
|
95
|
+
constructor(options) {
|
|
96
|
+
this.participant = options.participant;
|
|
97
|
+
this.recordKind = options.recordKind;
|
|
98
|
+
this.probeImpl = options.probe;
|
|
99
|
+
this.now = options.now ?? (() => Date.now());
|
|
100
|
+
this.queueLimit = Math.max(1, options.queueLimit ?? DEFAULT_QUEUE_LIMIT);
|
|
101
|
+
this.heartbeatMinIntervalMs = Math.max(0, options.heartbeatMinIntervalMs ?? DEFAULT_HEARTBEAT_MIN_INTERVAL_MS);
|
|
102
|
+
this.log = options.log ?? logger;
|
|
103
|
+
// Live-immediately mode: a transport supplied at construction starts the
|
|
104
|
+
// keepalive now and is live for the whole process lifetime (no activate step).
|
|
105
|
+
if (options.transport) {
|
|
106
|
+
this.transport = options.transport;
|
|
107
|
+
this.startKeepalive();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/** Honest reachability: 'unknown' until a wire call resolves, then online/offline. */
|
|
111
|
+
status() {
|
|
112
|
+
return this.reachability;
|
|
113
|
+
}
|
|
114
|
+
/** Whether a transport is currently attached. */
|
|
115
|
+
get active() {
|
|
116
|
+
return this.transport !== null;
|
|
117
|
+
}
|
|
118
|
+
/** Current bounded offline-queue depth (for diagnostics / tests). */
|
|
119
|
+
get pendingOps() {
|
|
120
|
+
return this.queue.length;
|
|
121
|
+
}
|
|
122
|
+
/** The session the keepalive heartbeat currently targets (diagnostics/tests). */
|
|
123
|
+
get keepaliveSessionId() {
|
|
124
|
+
return this.lastSessionId;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* The CANONICAL "which wire rows are mine" set: every sessionId this client
|
|
128
|
+
* has register()/reopen()'d and not yet close()'d, regardless of whatever id
|
|
129
|
+
* a caller's own local store separately uses for the same conceptual
|
|
130
|
+
* session. register()/reopen() send exactly the `sessionId` the caller
|
|
131
|
+
* passes in — this client never assumes that string also matches a local
|
|
132
|
+
* broker's own idea of the session's id. A cross-surface read facade (the
|
|
133
|
+
* SDK's SessionUnionCache) uses this to recognize its own wire mirror by
|
|
134
|
+
* the id ACTUALLY SENT, not by hoping a local reader's id happens to agree.
|
|
135
|
+
*/
|
|
136
|
+
get mirroredSessionIds() {
|
|
137
|
+
return new Set(this.records.keys());
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* DORMANT-MODE activation: attach the transport once a compatible external daemon
|
|
141
|
+
* has been adopted. Flushes anything queued while dormant, starts the keepalive.
|
|
142
|
+
* Reachability stays 'unknown' until the first wire call resolves.
|
|
143
|
+
*/
|
|
144
|
+
activate(transport) {
|
|
145
|
+
this.transport = transport;
|
|
146
|
+
this.log.info('session spine activated — mirroring session identity to the adopted external daemon', {});
|
|
147
|
+
this.startKeepalive();
|
|
148
|
+
void this.flush();
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Detach the transport (daemon mode resolved to non-external, or was lost). Ops
|
|
152
|
+
* continue to be queued (bounded, drop-oldest) rather than dropped.
|
|
153
|
+
*/
|
|
154
|
+
deactivate(reason) {
|
|
155
|
+
if (this.transport === null)
|
|
156
|
+
return;
|
|
157
|
+
this.transport = null;
|
|
158
|
+
this.reachability = 'unknown';
|
|
159
|
+
this.stopKeepalive();
|
|
160
|
+
this.log.info('session spine deactivated', { reason });
|
|
161
|
+
}
|
|
162
|
+
/** CREATE: fire-and-forget initial registration (title stamped once). */
|
|
163
|
+
register(record) {
|
|
164
|
+
this.cacheHeartbeatRecord(record);
|
|
165
|
+
this.dispatchRegister(this.buildInput(record, { includeTitle: true }));
|
|
166
|
+
}
|
|
167
|
+
/** RESUME: fire-and-forget reopen (reopen:true, no title) — the only reopen path. */
|
|
168
|
+
reopen(record) {
|
|
169
|
+
this.cacheHeartbeatRecord(record);
|
|
170
|
+
this.dispatchRegister(this.buildInput(record, { includeTitle: false, reopen: true }));
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* HEARTBEAT: debounced re-register, coalesced to one wire call per window, no title,
|
|
174
|
+
* no reopen. Safe to call on every turn/render tick — internally a no-op unless the
|
|
175
|
+
* window has elapsed.
|
|
176
|
+
*/
|
|
177
|
+
heartbeat(sessionId) {
|
|
178
|
+
const cached = this.records.get(sessionId);
|
|
179
|
+
if (!cached)
|
|
180
|
+
return;
|
|
181
|
+
const now = this.now();
|
|
182
|
+
if (now - this.lastHeartbeatAt >= this.heartbeatMinIntervalMs) {
|
|
183
|
+
this.lastHeartbeatAt = now;
|
|
184
|
+
this.dispatchRegister(this.withFreshLastSeen(cached));
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (this.heartbeatTimer)
|
|
188
|
+
return; // already a trailing beat scheduled -> coalesced
|
|
189
|
+
const delay = Math.max(0, this.heartbeatMinIntervalMs - (now - this.lastHeartbeatAt));
|
|
190
|
+
this.heartbeatTimer = setTimeout(() => {
|
|
191
|
+
this.heartbeatTimer = null;
|
|
192
|
+
this.lastHeartbeatAt = this.now();
|
|
193
|
+
const rec = this.records.get(sessionId);
|
|
194
|
+
if (rec)
|
|
195
|
+
this.dispatchRegister(this.withFreshLastSeen(rec));
|
|
196
|
+
}, delay);
|
|
197
|
+
this.heartbeatTimer.unref?.();
|
|
198
|
+
}
|
|
199
|
+
/** CLOSE: best-effort, fire-and-forget; tolerate a racing daemon stop. */
|
|
200
|
+
close(sessionId) {
|
|
201
|
+
this.records.delete(sessionId);
|
|
202
|
+
if (!this.transport) {
|
|
203
|
+
this.enqueue({ type: 'close', sessionId });
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
void this.runClose(sessionId);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* LEGACY FOLD: register each per-project record; a record whose id is in `closedIds`
|
|
210
|
+
* is registered then closed so a locally-closed session STAYS closed in the daemon
|
|
211
|
+
* (honest history). Idempotent — register is an upsert; closing an already-closed
|
|
212
|
+
* record is a no-op.
|
|
213
|
+
*/
|
|
214
|
+
foldLegacyRecords(records, closedIds) {
|
|
215
|
+
for (const record of records) {
|
|
216
|
+
this.enqueue({ type: 'register', sessionId: record.sessionId, input: this.buildInput(record, { includeTitle: true }) });
|
|
217
|
+
if (closedIds.has(record.sessionId)) {
|
|
218
|
+
this.enqueue({ type: 'close', sessionId: record.sessionId });
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
void this.flush();
|
|
222
|
+
}
|
|
223
|
+
/** Reachability probe — runs OFF the interactive path (deferred startup). Flushes on
|
|
224
|
+
* success. A no-op returning the current status when no `probe` option was supplied. */
|
|
225
|
+
async probeReachability() {
|
|
226
|
+
if (!this.probeImpl)
|
|
227
|
+
return this.reachability;
|
|
228
|
+
let reachable = false;
|
|
229
|
+
try {
|
|
230
|
+
reachable = await this.probeImpl();
|
|
231
|
+
}
|
|
232
|
+
catch {
|
|
233
|
+
reachable = false;
|
|
234
|
+
}
|
|
235
|
+
if (reachable) {
|
|
236
|
+
this.reachability = 'online';
|
|
237
|
+
await this.flush();
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
this.reachability = 'offline';
|
|
241
|
+
}
|
|
242
|
+
return this.reachability;
|
|
243
|
+
}
|
|
244
|
+
/** Clears the pending heartbeat + keepalive timers; call on shutdown. */
|
|
245
|
+
dispose() {
|
|
246
|
+
if (this.heartbeatTimer) {
|
|
247
|
+
clearTimeout(this.heartbeatTimer);
|
|
248
|
+
this.heartbeatTimer = null;
|
|
249
|
+
}
|
|
250
|
+
this.stopKeepalive();
|
|
251
|
+
}
|
|
252
|
+
startKeepalive() {
|
|
253
|
+
if (this.keepaliveTimer !== null || this.heartbeatMinIntervalMs <= 0)
|
|
254
|
+
return;
|
|
255
|
+
this.keepaliveTimer = setInterval(() => {
|
|
256
|
+
if (this.lastSessionId)
|
|
257
|
+
this.heartbeat(this.lastSessionId);
|
|
258
|
+
}, this.heartbeatMinIntervalMs);
|
|
259
|
+
this.keepaliveTimer.unref?.();
|
|
260
|
+
}
|
|
261
|
+
stopKeepalive() {
|
|
262
|
+
if (this.keepaliveTimer !== null) {
|
|
263
|
+
clearInterval(this.keepaliveTimer);
|
|
264
|
+
this.keepaliveTimer = null;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
cacheHeartbeatRecord(record) {
|
|
268
|
+
// Cache the title-less form so heartbeats never rename a titled session.
|
|
269
|
+
this.records.set(record.sessionId, this.buildInput(record, { includeTitle: false }));
|
|
270
|
+
// Track the newest session as the keepalive-heartbeat target.
|
|
271
|
+
this.lastSessionId = record.sessionId;
|
|
272
|
+
}
|
|
273
|
+
buildInput(record, opts) {
|
|
274
|
+
const participant = {
|
|
275
|
+
...this.participant,
|
|
276
|
+
...(record.userId ? { userId: record.userId } : {}),
|
|
277
|
+
lastSeenAt: this.now(),
|
|
278
|
+
};
|
|
279
|
+
return {
|
|
280
|
+
sessionId: record.sessionId,
|
|
281
|
+
...(this.recordKind ? { kind: this.recordKind } : {}),
|
|
282
|
+
project: record.project,
|
|
283
|
+
...(opts.includeTitle && record.title ? { title: record.title } : {}),
|
|
284
|
+
participant,
|
|
285
|
+
...(opts.reopen ? { reopen: true } : {}),
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
withFreshLastSeen(input) {
|
|
289
|
+
return { ...input, participant: { ...input.participant, lastSeenAt: this.now() } };
|
|
290
|
+
}
|
|
291
|
+
dispatchRegister(input) {
|
|
292
|
+
if (!this.transport) {
|
|
293
|
+
this.enqueue({ type: 'register', sessionId: input.sessionId, input });
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
void this.runRegister(input);
|
|
297
|
+
}
|
|
298
|
+
async runRegister(input) {
|
|
299
|
+
const transport = this.transport;
|
|
300
|
+
if (!transport) {
|
|
301
|
+
this.enqueue({ type: 'register', sessionId: input.sessionId, input });
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
try {
|
|
305
|
+
const result = await transport.register(input);
|
|
306
|
+
if (result.outcome === 'ok') {
|
|
307
|
+
this.reachability = 'online';
|
|
308
|
+
await this.flush();
|
|
309
|
+
}
|
|
310
|
+
else if (result.outcome === 'offline') {
|
|
311
|
+
this.reachability = 'offline';
|
|
312
|
+
this.enqueue({ type: 'register', sessionId: input.sessionId, input });
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
// Durable reject: honest local-only. Never claim online; do not queue (this is
|
|
316
|
+
// not a transient connectivity fault, so it must not retry-forever).
|
|
317
|
+
this.log.debug('session spine register not applied', { error: result.error });
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
catch (error) {
|
|
321
|
+
// Fire-and-forget contract: absorb everything. An unexpected transport throw is
|
|
322
|
+
// treated as transient offline and queued for reconnect replay.
|
|
323
|
+
this.reachability = 'offline';
|
|
324
|
+
this.enqueue({ type: 'register', sessionId: input.sessionId, input });
|
|
325
|
+
this.log.debug('session spine register threw — queued for reconnect', { error: errorMessage(error) });
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
async runClose(sessionId) {
|
|
329
|
+
const transport = this.transport;
|
|
330
|
+
if (!transport) {
|
|
331
|
+
this.enqueue({ type: 'close', sessionId });
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
try {
|
|
335
|
+
const result = await transport.close(sessionId);
|
|
336
|
+
if (result.outcome === 'ok') {
|
|
337
|
+
this.reachability = 'online';
|
|
338
|
+
}
|
|
339
|
+
else if (result.outcome === 'offline') {
|
|
340
|
+
this.reachability = 'offline';
|
|
341
|
+
this.enqueue({ type: 'close', sessionId });
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
this.log.debug('session spine close not applied', { error: result.error });
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
catch (error) {
|
|
348
|
+
this.reachability = 'offline';
|
|
349
|
+
this.enqueue({ type: 'close', sessionId });
|
|
350
|
+
this.log.debug('session spine close threw — queued for reconnect', { error: errorMessage(error) });
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
enqueue(op) {
|
|
354
|
+
if (this.queue.length >= this.queueLimit)
|
|
355
|
+
this.queue.shift(); // drop-oldest
|
|
356
|
+
this.queue.push(op);
|
|
357
|
+
}
|
|
358
|
+
async flush() {
|
|
359
|
+
if (this.flushing || this.queue.length === 0)
|
|
360
|
+
return;
|
|
361
|
+
const transport = this.transport;
|
|
362
|
+
if (!transport)
|
|
363
|
+
return;
|
|
364
|
+
this.flushing = true;
|
|
365
|
+
try {
|
|
366
|
+
const pending = this.queue.splice(0, this.queue.length);
|
|
367
|
+
for (const op of pending) {
|
|
368
|
+
try {
|
|
369
|
+
let result;
|
|
370
|
+
if (op.type === 'register') {
|
|
371
|
+
if (!op.input)
|
|
372
|
+
continue;
|
|
373
|
+
result = await transport.register(op.input);
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
result = await transport.close(op.sessionId);
|
|
377
|
+
}
|
|
378
|
+
if (result.outcome === 'ok') {
|
|
379
|
+
this.reachability = 'online';
|
|
380
|
+
}
|
|
381
|
+
else if (result.outcome === 'offline') {
|
|
382
|
+
this.reachability = 'offline';
|
|
383
|
+
this.enqueue(op);
|
|
384
|
+
}
|
|
385
|
+
else {
|
|
386
|
+
this.log.debug('session spine flush op not applied', { error: result.error });
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
catch (error) {
|
|
390
|
+
this.reachability = 'offline';
|
|
391
|
+
this.enqueue(op);
|
|
392
|
+
this.log.debug('session spine flush op threw — re-queued', { error: errorMessage(error) });
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
finally {
|
|
397
|
+
this.flushing = false;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
function errorMessage(error) {
|
|
402
|
+
return error instanceof Error ? error.message : String(error);
|
|
403
|
+
}
|
|
404
|
+
function isRecord(value) {
|
|
405
|
+
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Reads a surface's OWN project-scoped control-plane sessions.json and folds each
|
|
409
|
+
* record into the daemon via the client (register upsert; closed records also
|
|
410
|
+
* closed). Writes a marker file so subsequent runs are a no-op. Register is
|
|
411
|
+
* idempotent, so even a marker-less re-run is safe. Only folds the store for the
|
|
412
|
+
* project it is invoked from — the per-project discovery scope is documented, not
|
|
413
|
+
* silently "complete" across every project a surface has ever run in.
|
|
414
|
+
*/
|
|
415
|
+
export function foldLegacySpineStore(client, options) {
|
|
416
|
+
const log = options.log ?? logger;
|
|
417
|
+
if (existsSync(options.markerPath))
|
|
418
|
+
return { folded: 0, skipped: true };
|
|
419
|
+
let raw;
|
|
420
|
+
try {
|
|
421
|
+
raw = JSON.parse(readFileSync(options.storePath, 'utf-8'));
|
|
422
|
+
}
|
|
423
|
+
catch {
|
|
424
|
+
// No store (or unreadable) -> nothing to fold; do not write a marker so a later
|
|
425
|
+
// run with a real store still folds.
|
|
426
|
+
return { folded: 0, skipped: false };
|
|
427
|
+
}
|
|
428
|
+
const sessions = isRecord(raw) && isRecord(raw.sessions) ? raw.sessions : {};
|
|
429
|
+
const records = [];
|
|
430
|
+
const closedIds = new Set();
|
|
431
|
+
for (const [key, value] of Object.entries(sessions)) {
|
|
432
|
+
if (!isRecord(value))
|
|
433
|
+
continue;
|
|
434
|
+
const sessionId = typeof value.id === 'string' && value.id.trim().length > 0 ? value.id : key;
|
|
435
|
+
const title = typeof value.title === 'string' ? value.title : undefined;
|
|
436
|
+
records.push({ sessionId, project: options.project, ...(title ? { title } : {}) });
|
|
437
|
+
if (value.status === 'closed')
|
|
438
|
+
closedIds.add(sessionId);
|
|
439
|
+
}
|
|
440
|
+
client.foldLegacyRecords(records, closedIds);
|
|
441
|
+
try {
|
|
442
|
+
mkdirSync(dirname(options.markerPath), { recursive: true });
|
|
443
|
+
writeFileSync(options.markerPath, JSON.stringify({ migratedAt: (options.now ?? Date.now)(), count: records.length, source: options.storePath }, null, 2));
|
|
444
|
+
}
|
|
445
|
+
catch (err) {
|
|
446
|
+
log.debug('session spine legacy fold marker write failed', { err });
|
|
447
|
+
}
|
|
448
|
+
return { folded: records.length, skipped: false };
|
|
449
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @pellux/goodvibes-sdk/platform/runtime/session-spine
|
|
3
|
+
*
|
|
4
|
+
* The ONE session-spine surface client extracted from the near-twin TUI and agent
|
|
5
|
+
* implementations, plus the cross-surface session read facade (union cache). Both
|
|
6
|
+
* are consumed by two-plus surfaces (TUI, agent, and — in waiting — webui / PWA),
|
|
7
|
+
* which is why they live here per the SDK-boundary rule (machinery needed by 2+
|
|
8
|
+
* surfaces => SDK). See docs/decisions/2026-07-05-session-spine-sdk-extraction.md.
|
|
9
|
+
*/
|
|
10
|
+
export { SessionSpineClient, foldLegacySpineStore, TUI_SPINE_PARTICIPANT, AGENT_SPINE_PARTICIPANT, type SpineReachability, type SpineOutcome, type SpineResult, type SpineTransport, type SessionSpineRecord, type SessionSpineClientOptions, type FoldLegacySpineStoreOptions, type FoldLegacySpineStoreResult, } from './client.js';
|
|
11
|
+
export { SessionUnionCache, deriveSpineFooterStatus, type LocalSessionReader, type WireSessionReader, type SessionUnionMode, type CrossSurfaceView, type SessionReadFacade, type SessionUnionCacheOptions, } from './union-cache.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/platform/runtime/session-spine/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,GAChC,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,GAC9B,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @pellux/goodvibes-sdk/platform/runtime/session-spine
|
|
3
|
+
*
|
|
4
|
+
* The ONE session-spine surface client extracted from the near-twin TUI and agent
|
|
5
|
+
* implementations, plus the cross-surface session read facade (union cache). Both
|
|
6
|
+
* are consumed by two-plus surfaces (TUI, agent, and — in waiting — webui / PWA),
|
|
7
|
+
* which is why they live here per the SDK-boundary rule (machinery needed by 2+
|
|
8
|
+
* surfaces => SDK). See docs/decisions/2026-07-05-session-spine-sdk-extraction.md.
|
|
9
|
+
*/
|
|
10
|
+
export { SessionSpineClient, foldLegacySpineStore, TUI_SPINE_PARTICIPANT, AGENT_SPINE_PARTICIPANT, } from './client.js';
|
|
11
|
+
export { SessionUnionCache, deriveSpineFooterStatus, } from './union-cache.js';
|