@pellux/goodvibes-sdk 0.38.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contracts/artifacts/operator-contract.json +4468 -916
- package/dist/daemon.d.ts +2 -0
- package/dist/daemon.d.ts.map +1 -1
- package/dist/daemon.js +4 -0
- package/dist/events/communication.d.ts +1 -1
- package/dist/events/surfaces.d.ts +25 -3
- package/dist/events/surfaces.d.ts.map +1 -1
- package/dist/events/surfaces.js +22 -1
- package/dist/events/workflows.d.ts +7 -6
- package/dist/events/workflows.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/platform/agents/archetypes.d.ts.map +1 -1
- package/dist/platform/agents/archetypes.js +7 -0
- package/dist/platform/agents/index.d.ts +1 -0
- package/dist/platform/agents/index.d.ts.map +1 -1
- package/dist/platform/agents/index.js +1 -0
- package/dist/platform/agents/orchestrator-runner.d.ts +16 -3
- package/dist/platform/agents/orchestrator-runner.d.ts.map +1 -1
- package/dist/platform/agents/orchestrator-runner.js +20 -6
- package/dist/platform/agents/orchestrator.d.ts +42 -10
- package/dist/platform/agents/orchestrator.d.ts.map +1 -1
- package/dist/platform/agents/orchestrator.js +68 -20
- package/dist/platform/agents/planner-decomposition-runner.d.ts +38 -0
- package/dist/platform/agents/planner-decomposition-runner.d.ts.map +1 -0
- package/dist/platform/agents/planner-decomposition-runner.js +113 -0
- package/dist/platform/agents/turn-knowledge-injection.d.ts +88 -3
- package/dist/platform/agents/turn-knowledge-injection.d.ts.map +1 -1
- package/dist/platform/agents/turn-knowledge-injection.js +147 -30
- package/dist/platform/agents/worktree.d.ts +126 -8
- package/dist/platform/agents/worktree.d.ts.map +1 -1
- package/dist/platform/agents/worktree.js +240 -19
- package/dist/platform/agents/wrfc-controller.d.ts +24 -1
- package/dist/platform/agents/wrfc-controller.d.ts.map +1 -1
- package/dist/platform/agents/wrfc-controller.js +161 -35
- package/dist/platform/agents/wrfc-gate-runtime.d.ts +9 -0
- package/dist/platform/agents/wrfc-gate-runtime.d.ts.map +1 -1
- package/dist/platform/agents/wrfc-gate-runtime.js +7 -3
- package/dist/platform/agents/wrfc-gates.d.ts +1 -1
- package/dist/platform/agents/wrfc-gates.d.ts.map +1 -1
- package/dist/platform/agents/wrfc-gates.js +7 -1
- package/dist/platform/agents/wrfc-types.d.ts +23 -3
- package/dist/platform/agents/wrfc-types.d.ts.map +1 -1
- package/dist/platform/automation/types.d.ts +9 -1
- package/dist/platform/automation/types.d.ts.map +1 -1
- package/dist/platform/calendar/calendar-api-shared.d.ts +25 -0
- package/dist/platform/calendar/calendar-api-shared.d.ts.map +1 -0
- package/dist/platform/calendar/calendar-api-shared.js +100 -0
- package/dist/platform/calendar/calendar-connector.d.ts +79 -0
- package/dist/platform/calendar/calendar-connector.d.ts.map +1 -0
- package/dist/platform/calendar/calendar-connector.js +155 -0
- package/dist/platform/calendar/google-calendar-api.d.ts +25 -0
- package/dist/platform/calendar/google-calendar-api.d.ts.map +1 -0
- package/dist/platform/calendar/google-calendar-api.js +89 -0
- package/dist/platform/calendar/http-fetch-adapter.d.ts +25 -0
- package/dist/platform/calendar/http-fetch-adapter.d.ts.map +1 -0
- package/dist/platform/calendar/http-fetch-adapter.js +25 -0
- package/dist/platform/calendar/ics-parser.d.ts +35 -0
- package/dist/platform/calendar/ics-parser.d.ts.map +1 -0
- package/dist/platform/calendar/ics-parser.js +236 -0
- package/dist/platform/calendar/index.d.ts +41 -0
- package/dist/platform/calendar/index.d.ts.map +1 -0
- package/dist/platform/calendar/index.js +49 -0
- package/dist/platform/calendar/merged-calendar-model.d.ts +67 -0
- package/dist/platform/calendar/merged-calendar-model.d.ts.map +1 -0
- package/dist/platform/calendar/merged-calendar-model.js +181 -0
- package/dist/platform/calendar/microsoft-graph-api.d.ts +25 -0
- package/dist/platform/calendar/microsoft-graph-api.d.ts.map +1 -0
- package/dist/platform/calendar/microsoft-graph-api.js +95 -0
- package/dist/platform/calendar/oauth-flow.d.ts +62 -0
- package/dist/platform/calendar/oauth-flow.d.ts.map +1 -0
- package/dist/platform/calendar/oauth-flow.js +305 -0
- package/dist/platform/calendar/oauth-providers.d.ts +43 -0
- package/dist/platform/calendar/oauth-providers.d.ts.map +1 -0
- package/dist/platform/calendar/oauth-providers.js +120 -0
- package/dist/platform/calendar/oauth-token-store.d.ts +72 -0
- package/dist/platform/calendar/oauth-token-store.d.ts.map +1 -0
- package/dist/platform/calendar/oauth-token-store.js +189 -0
- package/dist/platform/calendar/oauth-types.d.ts +274 -0
- package/dist/platform/calendar/oauth-types.d.ts.map +1 -0
- package/dist/platform/calendar/oauth-types.js +22 -0
- package/dist/platform/calendar/rrule.d.ts +39 -0
- package/dist/platform/calendar/rrule.d.ts.map +1 -0
- package/dist/platform/calendar/rrule.js +261 -0
- package/dist/platform/calendar/subscription-store.d.ts +118 -0
- package/dist/platform/calendar/subscription-store.d.ts.map +1 -0
- package/dist/platform/calendar/subscription-store.js +293 -0
- package/dist/platform/calendar/types.d.ts +170 -0
- package/dist/platform/calendar/types.d.ts.map +1 -0
- package/dist/platform/calendar/types.js +21 -0
- package/dist/platform/companion/companion-chat-attachments.d.ts +29 -0
- package/dist/platform/companion/companion-chat-attachments.d.ts.map +1 -0
- package/dist/platform/companion/companion-chat-attachments.js +121 -0
- package/dist/platform/companion/companion-chat-branching.d.ts +66 -0
- package/dist/platform/companion/companion-chat-branching.d.ts.map +1 -0
- package/dist/platform/companion/companion-chat-branching.js +142 -0
- package/dist/platform/companion/companion-chat-broker-bridge.d.ts +40 -0
- package/dist/platform/companion/companion-chat-broker-bridge.d.ts.map +1 -0
- package/dist/platform/companion/companion-chat-broker-bridge.js +14 -0
- package/dist/platform/companion/companion-chat-broker-sync.d.ts +38 -0
- package/dist/platform/companion/companion-chat-broker-sync.d.ts.map +1 -0
- package/dist/platform/companion/companion-chat-broker-sync.js +80 -0
- package/dist/platform/companion/companion-chat-gc.d.ts +63 -0
- package/dist/platform/companion/companion-chat-gc.d.ts.map +1 -0
- package/dist/platform/companion/companion-chat-gc.js +38 -0
- package/dist/platform/companion/companion-chat-manager.d.ts +91 -23
- package/dist/platform/companion/companion-chat-manager.d.ts.map +1 -1
- package/dist/platform/companion/companion-chat-manager.js +195 -223
- package/dist/platform/companion/companion-chat-persistence.d.ts +9 -1
- package/dist/platform/companion/companion-chat-persistence.d.ts.map +1 -1
- package/dist/platform/companion/companion-chat-persistence.js +10 -2
- package/dist/platform/companion/companion-chat-routes.d.ts +2 -1
- package/dist/platform/companion/companion-chat-routes.d.ts.map +1 -1
- package/dist/platform/companion/companion-chat-routes.js +113 -4
- package/dist/platform/companion/companion-chat-turn-execution.d.ts +61 -0
- package/dist/platform/companion/companion-chat-turn-execution.d.ts.map +1 -0
- package/dist/platform/companion/companion-chat-turn-execution.js +107 -0
- package/dist/platform/companion/companion-chat-types.d.ts +67 -0
- package/dist/platform/companion/companion-chat-types.d.ts.map +1 -1
- package/dist/platform/config/credential-status.d.ts +28 -0
- package/dist/platform/config/credential-status.d.ts.map +1 -0
- package/dist/platform/config/credential-status.js +75 -0
- package/dist/platform/config/index.d.ts +25 -0
- package/dist/platform/config/index.d.ts.map +1 -1
- package/dist/platform/config/index.js +18 -0
- package/dist/platform/config/manager.d.ts +9 -0
- package/dist/platform/config/manager.d.ts.map +1 -1
- package/dist/platform/config/manager.js +21 -2
- package/dist/platform/config/migrations.d.ts +48 -0
- package/dist/platform/config/migrations.d.ts.map +1 -0
- package/dist/platform/config/migrations.js +54 -0
- package/dist/platform/config/schema-domain-core.d.ts +10 -1
- package/dist/platform/config/schema-domain-core.d.ts.map +1 -1
- package/dist/platform/config/schema-domain-core.js +46 -3
- package/dist/platform/config/schema-domain-runtime.d.ts +8 -0
- package/dist/platform/config/schema-domain-runtime.d.ts.map +1 -1
- package/dist/platform/config/schema-domain-runtime.js +32 -0
- package/dist/platform/config/schema-types.d.ts +21 -7
- package/dist/platform/config/schema-types.d.ts.map +1 -1
- package/dist/platform/config/schema.d.ts.map +1 -1
- package/dist/platform/config/schema.js +2 -0
- package/dist/platform/control-plane/approval-broker.d.ts +11 -0
- package/dist/platform/control-plane/approval-broker.d.ts.map +1 -1
- package/dist/platform/control-plane/approval-broker.js +17 -1
- package/dist/platform/control-plane/approval-hunk-apply.d.ts +77 -0
- package/dist/platform/control-plane/approval-hunk-apply.d.ts.map +1 -0
- package/dist/platform/control-plane/approval-hunk-apply.js +80 -0
- package/dist/platform/control-plane/gateway-disabled-response.d.ts +20 -0
- package/dist/platform/control-plane/gateway-disabled-response.d.ts.map +1 -0
- package/dist/platform/control-plane/gateway-disabled-response.js +24 -0
- package/dist/platform/control-plane/gateway-scope-enforcement.d.ts +68 -0
- package/dist/platform/control-plane/gateway-scope-enforcement.d.ts.map +1 -0
- package/dist/platform/control-plane/gateway-scope-enforcement.js +91 -0
- package/dist/platform/control-plane/gateway-utils.d.ts +17 -0
- package/dist/platform/control-plane/gateway-utils.d.ts.map +1 -1
- package/dist/platform/control-plane/gateway-utils.js +30 -0
- package/dist/platform/control-plane/gateway.d.ts +12 -2
- package/dist/platform/control-plane/gateway.d.ts.map +1 -1
- package/dist/platform/control-plane/gateway.js +27 -31
- package/dist/platform/control-plane/index.d.ts +8 -1
- package/dist/platform/control-plane/index.d.ts.map +1 -1
- package/dist/platform/control-plane/index.js +8 -0
- package/dist/platform/control-plane/invoke-input-validation.d.ts +56 -0
- package/dist/platform/control-plane/invoke-input-validation.d.ts.map +1 -0
- package/dist/platform/control-plane/invoke-input-validation.js +163 -0
- package/dist/platform/control-plane/method-catalog-admin.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog-admin.js +12 -1
- package/dist/platform/control-plane/method-catalog-calendar.d.ts +16 -0
- package/dist/platform/control-plane/method-catalog-calendar.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog-calendar.js +21 -0
- package/dist/platform/control-plane/method-catalog-channels.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog-channels.js +32 -3
- package/dist/platform/control-plane/method-catalog-control-automation.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog-control-automation.js +19 -34
- package/dist/platform/control-plane/method-catalog-control-companion.d.ts +15 -0
- package/dist/platform/control-plane/method-catalog-control-companion.d.ts.map +1 -0
- package/dist/platform/control-plane/method-catalog-control-companion.js +176 -0
- package/dist/platform/control-plane/method-catalog-control-core.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog-control-core.js +104 -122
- package/dist/platform/control-plane/method-catalog-control.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog-control.js +4 -0
- package/dist/platform/control-plane/method-catalog-email.d.ts +17 -0
- package/dist/platform/control-plane/method-catalog-email.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog-email.js +21 -0
- package/dist/platform/control-plane/method-catalog-events.d.ts +28 -0
- package/dist/platform/control-plane/method-catalog-events.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog-events.js +74 -1
- package/dist/platform/control-plane/method-catalog-fleet.d.ts +24 -0
- package/dist/platform/control-plane/method-catalog-fleet.d.ts.map +1 -0
- package/dist/platform/control-plane/method-catalog-fleet.js +65 -0
- package/dist/platform/control-plane/method-catalog-push.d.ts +30 -0
- package/dist/platform/control-plane/method-catalog-push.d.ts.map +1 -0
- package/dist/platform/control-plane/method-catalog-push.js +80 -0
- package/dist/platform/control-plane/method-catalog-route-reconcile.d.ts +84 -0
- package/dist/platform/control-plane/method-catalog-route-reconcile.d.ts.map +1 -0
- package/dist/platform/control-plane/method-catalog-route-reconcile.js +103 -0
- package/dist/platform/control-plane/method-catalog-runtime.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog-runtime.js +83 -1
- package/dist/platform/control-plane/method-catalog-shared.d.ts +29 -0
- package/dist/platform/control-plane/method-catalog-shared.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog.d.ts +9 -0
- package/dist/platform/control-plane/method-catalog.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog.js +34 -3
- package/dist/platform/control-plane/operator-contract-schemas-admin.d.ts +8 -0
- package/dist/platform/control-plane/operator-contract-schemas-admin.d.ts.map +1 -1
- package/dist/platform/control-plane/operator-contract-schemas-admin.js +22 -1
- package/dist/platform/control-plane/operator-contract-schemas-fleet.d.ts +18 -0
- package/dist/platform/control-plane/operator-contract-schemas-fleet.d.ts.map +1 -0
- package/dist/platform/control-plane/operator-contract-schemas-fleet.js +182 -0
- package/dist/platform/control-plane/operator-contract-schemas-permissions.d.ts.map +1 -1
- package/dist/platform/control-plane/operator-contract-schemas-permissions.js +5 -0
- package/dist/platform/control-plane/operator-contract-schemas-runtime.d.ts +37 -0
- package/dist/platform/control-plane/operator-contract-schemas-runtime.d.ts.map +1 -1
- package/dist/platform/control-plane/operator-contract-schemas-runtime.js +100 -3
- package/dist/platform/control-plane/operator-contract-schemas.d.ts +1 -0
- package/dist/platform/control-plane/operator-contract-schemas.d.ts.map +1 -1
- package/dist/platform/control-plane/operator-contract-schemas.js +1 -0
- package/dist/platform/control-plane/operator-contract.d.ts.map +1 -1
- package/dist/platform/control-plane/operator-contract.js +8 -0
- package/dist/platform/control-plane/routes/checkpoints.d.ts +39 -0
- package/dist/platform/control-plane/routes/checkpoints.d.ts.map +1 -0
- package/dist/platform/control-plane/routes/checkpoints.js +166 -0
- package/dist/platform/control-plane/routes/fleet.d.ts +53 -0
- package/dist/platform/control-plane/routes/fleet.d.ts.map +1 -0
- package/dist/platform/control-plane/routes/fleet.js +153 -0
- package/dist/platform/control-plane/routes/gateway-verb-error.d.ts +30 -0
- package/dist/platform/control-plane/routes/gateway-verb-error.d.ts.map +1 -0
- package/dist/platform/control-plane/routes/gateway-verb-error.js +36 -0
- package/dist/platform/control-plane/routes/index.d.ts +0 -6
- package/dist/platform/control-plane/routes/index.d.ts.map +1 -1
- package/dist/platform/control-plane/routes/index.js +5 -5
- package/dist/platform/control-plane/routes/invocation-params.d.ts +23 -0
- package/dist/platform/control-plane/routes/invocation-params.d.ts.map +1 -0
- package/dist/platform/control-plane/routes/invocation-params.js +9 -0
- package/dist/platform/control-plane/routes/push.d.ts +26 -0
- package/dist/platform/control-plane/routes/push.d.ts.map +1 -0
- package/dist/platform/control-plane/routes/push.js +104 -0
- package/dist/platform/control-plane/routes/register-gateway-verb-groups.d.ts +31 -0
- package/dist/platform/control-plane/routes/register-gateway-verb-groups.d.ts.map +1 -0
- package/dist/platform/control-plane/routes/register-gateway-verb-groups.js +16 -0
- package/dist/platform/control-plane/routes/register-w3-s2.d.ts +26 -0
- package/dist/platform/control-plane/routes/register-w3-s2.d.ts.map +1 -0
- package/dist/platform/control-plane/routes/register-w3-s2.js +8 -0
- package/dist/platform/control-plane/routes/session-search.d.ts +37 -0
- package/dist/platform/control-plane/routes/session-search.d.ts.map +1 -0
- package/dist/platform/control-plane/routes/session-search.js +113 -0
- package/dist/platform/control-plane/session-broker-gc.d.ts +16 -0
- package/dist/platform/control-plane/session-broker-gc.d.ts.map +1 -1
- package/dist/platform/control-plane/session-broker-gc.js +23 -6
- package/dist/platform/control-plane/session-broker-helpers.d.ts +3 -3
- package/dist/platform/control-plane/session-broker-helpers.d.ts.map +1 -1
- package/dist/platform/control-plane/session-broker-inputs.d.ts +18 -0
- package/dist/platform/control-plane/session-broker-inputs.d.ts.map +1 -1
- package/dist/platform/control-plane/session-broker-inputs.js +34 -0
- package/dist/platform/control-plane/session-broker-sessions.d.ts +102 -3
- package/dist/platform/control-plane/session-broker-sessions.d.ts.map +1 -1
- package/dist/platform/control-plane/session-broker-sessions.js +179 -5
- package/dist/platform/control-plane/session-broker-state.d.ts +20 -1
- package/dist/platform/control-plane/session-broker-state.d.ts.map +1 -1
- package/dist/platform/control-plane/session-broker-state.js +67 -5
- package/dist/platform/control-plane/session-broker.d.ts +51 -38
- package/dist/platform/control-plane/session-broker.d.ts.map +1 -1
- package/dist/platform/control-plane/session-broker.js +183 -75
- package/dist/platform/control-plane/session-store-importer.d.ts +57 -0
- package/dist/platform/control-plane/session-store-importer.d.ts.map +1 -0
- package/dist/platform/control-plane/session-store-importer.js +227 -0
- package/dist/platform/control-plane/session-types.d.ts +142 -7
- package/dist/platform/control-plane/session-types.d.ts.map +1 -1
- package/dist/platform/core/execution-plan.d.ts +43 -1
- package/dist/platform/core/execution-plan.d.ts.map +1 -1
- package/dist/platform/core/execution-plan.js +46 -10
- package/dist/platform/core/index.d.ts +1 -0
- package/dist/platform/core/index.d.ts.map +1 -1
- package/dist/platform/core/index.js +1 -0
- package/dist/platform/core/orchestrator-runtime.d.ts +23 -3
- package/dist/platform/core/orchestrator-runtime.d.ts.map +1 -1
- package/dist/platform/core/orchestrator-tool-runtime.d.ts +7 -0
- package/dist/platform/core/orchestrator-tool-runtime.d.ts.map +1 -1
- package/dist/platform/core/orchestrator-tool-runtime.js +10 -0
- package/dist/platform/core/orchestrator-turn-loop.d.ts +13 -6
- package/dist/platform/core/orchestrator-turn-loop.d.ts.map +1 -1
- package/dist/platform/core/orchestrator-turn-loop.js +29 -22
- package/dist/platform/core/orchestrator.d.ts +16 -10
- package/dist/platform/core/orchestrator.d.ts.map +1 -1
- package/dist/platform/core/orchestrator.js +23 -8
- package/dist/platform/core/plan-decomposition.d.ts +196 -0
- package/dist/platform/core/plan-decomposition.d.ts.map +1 -0
- package/dist/platform/core/plan-decomposition.js +417 -0
- package/dist/platform/core/plan-proposal.d.ts +39 -0
- package/dist/platform/core/plan-proposal.d.ts.map +1 -1
- package/dist/platform/core/wrfc-routing.d.ts +1 -0
- package/dist/platform/core/wrfc-routing.d.ts.map +1 -1
- package/dist/platform/core/wrfc-routing.js +51 -1
- package/dist/platform/daemon/boot.d.ts +69 -0
- package/dist/platform/daemon/boot.d.ts.map +1 -0
- package/dist/platform/daemon/boot.js +61 -0
- package/dist/platform/daemon/cli.js +2 -1
- package/dist/platform/daemon/control-plane.d.ts.map +1 -1
- package/dist/platform/daemon/control-plane.js +50 -1
- package/dist/platform/daemon/facade-composition.d.ts.map +1 -1
- package/dist/platform/daemon/facade-composition.js +6 -0
- package/dist/platform/daemon/facade.d.ts +15 -6
- package/dist/platform/daemon/facade.d.ts.map +1 -1
- package/dist/platform/daemon/facade.js +48 -43
- package/dist/platform/daemon/http/router-route-contexts.d.ts +1 -0
- package/dist/platform/daemon/http/router-route-contexts.d.ts.map +1 -1
- package/dist/platform/daemon/http/router-route-contexts.js +1 -0
- package/dist/platform/daemon/http/router-session-broker-adapter.d.ts +13 -0
- package/dist/platform/daemon/http/router-session-broker-adapter.d.ts.map +1 -0
- package/dist/platform/daemon/http/router-session-broker-adapter.js +27 -0
- package/dist/platform/daemon/http/router.d.ts +2 -1
- package/dist/platform/daemon/http/router.d.ts.map +1 -1
- package/dist/platform/daemon/http/router.js +42 -40
- package/dist/platform/daemon/http/runtime-route-types.d.ts +42 -4
- package/dist/platform/daemon/http/runtime-route-types.d.ts.map +1 -1
- package/dist/platform/daemon/http/webui-serving.d.ts +68 -0
- package/dist/platform/daemon/http/webui-serving.d.ts.map +1 -0
- package/dist/platform/daemon/http/webui-serving.js +230 -0
- package/dist/platform/daemon/index.d.ts +2 -0
- package/dist/platform/daemon/index.d.ts.map +1 -1
- package/dist/platform/daemon/index.js +1 -0
- package/dist/platform/daemon/service-manager.d.ts +16 -0
- package/dist/platform/daemon/service-manager.d.ts.map +1 -1
- package/dist/platform/daemon/service-manager.js +79 -15
- package/dist/platform/intelligence/tree-sitter/service.d.ts.map +1 -1
- package/dist/platform/intelligence/tree-sitter/service.js +16 -2
- package/dist/platform/knowledge/browser-history/readers.d.ts.map +1 -1
- package/dist/platform/knowledge/browser-history/readers.js +15 -5
- package/dist/platform/knowledge/knowledge-api.d.ts +1 -1
- package/dist/platform/knowledge/project-planning/service.d.ts +14 -1
- package/dist/platform/knowledge/project-planning/service.d.ts.map +1 -1
- package/dist/platform/knowledge/project-planning/service.js +77 -0
- package/dist/platform/knowledge/project-planning/types.d.ts +32 -0
- package/dist/platform/knowledge/project-planning/types.d.ts.map +1 -1
- package/dist/platform/orchestration/bookkeeping.d.ts +12 -0
- package/dist/platform/orchestration/bookkeeping.d.ts.map +1 -0
- package/dist/platform/orchestration/bookkeeping.js +91 -0
- package/dist/platform/orchestration/budget.d.ts +2 -2
- package/dist/platform/orchestration/cancellation.d.ts +2 -2
- package/dist/platform/orchestration/controller-compat.d.ts +16 -3
- package/dist/platform/orchestration/controller-compat.d.ts.map +1 -1
- package/dist/platform/orchestration/controller-compat.js +18 -4
- package/dist/platform/orchestration/dirty-guard.js +1 -1
- package/dist/platform/orchestration/engine.d.ts +26 -1
- package/dist/platform/orchestration/engine.d.ts.map +1 -1
- package/dist/platform/orchestration/engine.js +229 -25
- package/dist/platform/orchestration/index.d.ts +6 -4
- package/dist/platform/orchestration/index.d.ts.map +1 -1
- package/dist/platform/orchestration/index.js +3 -2
- package/dist/platform/orchestration/persistence.d.ts.map +1 -1
- package/dist/platform/orchestration/persistence.js +6 -3
- package/dist/platform/orchestration/phase-runner.d.ts +33 -6
- package/dist/platform/orchestration/phase-runner.d.ts.map +1 -1
- package/dist/platform/orchestration/phase-runner.js +98 -25
- package/dist/platform/orchestration/proposal-workstream.d.ts +56 -0
- package/dist/platform/orchestration/proposal-workstream.d.ts.map +1 -0
- package/dist/platform/orchestration/proposal-workstream.js +76 -0
- package/dist/platform/orchestration/scheduler.d.ts +20 -1
- package/dist/platform/orchestration/scheduler.d.ts.map +1 -1
- package/dist/platform/orchestration/scheduler.js +16 -0
- package/dist/platform/orchestration/types.d.ts +289 -4
- package/dist/platform/orchestration/types.d.ts.map +1 -1
- package/dist/platform/orchestration/types.js +32 -0
- package/dist/platform/orchestration/worktree-isolation.d.ts +33 -0
- package/dist/platform/orchestration/worktree-isolation.d.ts.map +1 -0
- package/dist/platform/orchestration/worktree-isolation.js +248 -0
- package/dist/platform/presentation/glyphs.d.ts +91 -0
- package/dist/platform/presentation/glyphs.d.ts.map +1 -0
- package/dist/platform/presentation/glyphs.js +93 -0
- package/dist/platform/presentation/index.d.ts +28 -0
- package/dist/platform/presentation/index.d.ts.map +1 -0
- package/dist/platform/presentation/index.js +27 -0
- package/dist/platform/presentation/thinking-phrases.d.ts +12 -0
- package/dist/platform/presentation/thinking-phrases.d.ts.map +1 -0
- package/dist/platform/presentation/thinking-phrases.js +32 -0
- package/dist/platform/presentation/tones.d.ts +121 -0
- package/dist/platform/presentation/tones.d.ts.map +1 -0
- package/dist/platform/presentation/tones.js +145 -0
- package/dist/platform/presentation/waiting-wording.d.ts +54 -0
- package/dist/platform/presentation/waiting-wording.d.ts.map +1 -0
- package/dist/platform/presentation/waiting-wording.js +51 -0
- package/dist/platform/providers/runtime-snapshot.d.ts.map +1 -1
- package/dist/platform/providers/runtime-snapshot.js +12 -2
- package/dist/platform/push/delivery.d.ts +48 -0
- package/dist/platform/push/delivery.d.ts.map +1 -0
- package/dist/platform/push/delivery.js +117 -0
- package/dist/platform/push/encryption.d.ts +41 -0
- package/dist/platform/push/encryption.d.ts.map +1 -0
- package/dist/platform/push/encryption.js +82 -0
- package/dist/platform/push/index.d.ts +17 -0
- package/dist/platform/push/index.d.ts.map +1 -0
- package/dist/platform/push/index.js +10 -0
- package/dist/platform/push/service.d.ts +75 -0
- package/dist/platform/push/service.d.ts.map +1 -0
- package/dist/platform/push/service.js +95 -0
- package/dist/platform/push/subscription-store.d.ts +50 -0
- package/dist/platform/push/subscription-store.d.ts.map +1 -0
- package/dist/platform/push/subscription-store.js +123 -0
- package/dist/platform/push/types.d.ts +68 -0
- package/dist/platform/push/types.d.ts.map +1 -0
- package/dist/platform/push/types.js +13 -0
- package/dist/platform/push/vapid.d.ts +54 -0
- package/dist/platform/push/vapid.d.ts.map +1 -0
- package/dist/platform/push/vapid.js +113 -0
- package/dist/platform/runtime/bootstrap-services.d.ts +62 -2
- package/dist/platform/runtime/bootstrap-services.d.ts.map +1 -1
- package/dist/platform/runtime/bootstrap-services.js +217 -50
- package/dist/platform/runtime/daemon-version-compat.d.ts +39 -0
- package/dist/platform/runtime/daemon-version-compat.d.ts.map +1 -0
- package/dist/platform/runtime/daemon-version-compat.js +75 -0
- package/dist/platform/runtime/detached-daemon-runtime.d.ts +26 -0
- package/dist/platform/runtime/detached-daemon-runtime.d.ts.map +1 -0
- package/dist/platform/runtime/detached-daemon-runtime.js +49 -0
- package/dist/platform/runtime/emitters/workflows.d.ts +1 -1
- package/dist/platform/runtime/emitters/workflows.d.ts.map +1 -1
- package/dist/platform/runtime/events/index.d.ts +13 -0
- package/dist/platform/runtime/events/index.d.ts.map +1 -1
- package/dist/platform/runtime/events/index.js +13 -0
- package/dist/platform/runtime/feature-flags/flags.d.ts.map +1 -1
- package/dist/platform/runtime/feature-flags/flags.js +39 -1
- package/dist/platform/runtime/fleet/adapters/agent.d.ts +2 -2
- package/dist/platform/runtime/fleet/adapters/agent.d.ts.map +1 -1
- package/dist/platform/runtime/fleet/adapters/agent.js +4 -4
- package/dist/platform/runtime/fleet/adapters/automation.d.ts +1 -1
- package/dist/platform/runtime/fleet/adapters/automation.js +1 -1
- package/dist/platform/runtime/fleet/adapters/code-index.d.ts +1 -1
- package/dist/platform/runtime/fleet/adapters/code-index.js +1 -1
- package/dist/platform/runtime/fleet/adapters/orchestration.d.ts +40 -18
- package/dist/platform/runtime/fleet/adapters/orchestration.d.ts.map +1 -1
- package/dist/platform/runtime/fleet/adapters/orchestration.js +138 -34
- package/dist/platform/runtime/fleet/adapters/schedule.d.ts +4 -4
- package/dist/platform/runtime/fleet/adapters/schedule.js +4 -4
- package/dist/platform/runtime/fleet/adapters/trigger.d.ts +3 -4
- package/dist/platform/runtime/fleet/adapters/trigger.d.ts.map +1 -1
- package/dist/platform/runtime/fleet/adapters/trigger.js +3 -4
- package/dist/platform/runtime/fleet/adapters/wrfc.d.ts +13 -0
- package/dist/platform/runtime/fleet/adapters/wrfc.d.ts.map +1 -1
- package/dist/platform/runtime/fleet/adapters/wrfc.js +49 -2
- package/dist/platform/runtime/fleet/registry.d.ts +7 -7
- package/dist/platform/runtime/fleet/registry.d.ts.map +1 -1
- package/dist/platform/runtime/fleet/registry.js +41 -7
- package/dist/platform/runtime/fleet/types.d.ts +9 -9
- package/dist/platform/runtime/fleet/types.d.ts.map +1 -1
- package/dist/platform/runtime/memory-spine/client.d.ts +127 -0
- package/dist/platform/runtime/memory-spine/client.d.ts.map +1 -0
- package/dist/platform/runtime/memory-spine/client.js +113 -0
- package/dist/platform/runtime/memory-spine/index.d.ts +11 -0
- package/dist/platform/runtime/memory-spine/index.d.ts.map +1 -0
- package/dist/platform/runtime/memory-spine/index.js +10 -0
- package/dist/platform/runtime/operator-client.d.ts +20 -2
- package/dist/platform/runtime/operator-client.d.ts.map +1 -1
- package/dist/platform/runtime/operator-client.js +11 -1
- package/dist/platform/runtime/provider-accounts/registry.d.ts.map +1 -1
- package/dist/platform/runtime/provider-accounts/registry.js +11 -1
- package/dist/platform/runtime/services.d.ts +11 -9
- package/dist/platform/runtime/services.d.ts.map +1 -1
- package/dist/platform/runtime/services.js +24 -9
- package/dist/platform/runtime/session-spine/client.d.ts +234 -0
- package/dist/platform/runtime/session-spine/client.d.ts.map +1 -0
- package/dist/platform/runtime/session-spine/client.js +449 -0
- package/dist/platform/runtime/session-spine/index.d.ts +12 -0
- package/dist/platform/runtime/session-spine/index.d.ts.map +1 -0
- package/dist/platform/runtime/session-spine/index.js +11 -0
- package/dist/platform/runtime/session-spine/union-cache.d.ts +225 -0
- package/dist/platform/runtime/session-spine/union-cache.d.ts.map +1 -0
- package/dist/platform/runtime/session-spine/union-cache.js +333 -0
- package/dist/platform/runtime/shell-command-ops.d.ts +3 -1
- package/dist/platform/runtime/shell-command-ops.d.ts.map +1 -1
- package/dist/platform/runtime/transports/daemon-http-client-validators.d.ts.map +1 -1
- package/dist/platform/runtime/transports/daemon-http-client-validators.js +22 -0
- package/dist/platform/runtime/transports/daemon-http-client.d.ts.map +1 -1
- package/dist/platform/runtime/transports/daemon-http-client.js +25 -2
- package/dist/platform/runtime/transports/http-types.d.ts +9 -2
- package/dist/platform/runtime/transports/http-types.d.ts.map +1 -1
- package/dist/platform/state/canonical-memory.d.ts +95 -0
- package/dist/platform/state/canonical-memory.d.ts.map +1 -0
- package/dist/platform/state/canonical-memory.js +155 -0
- package/dist/platform/state/code-index-chunking.js +1 -1
- package/dist/platform/state/code-index-db.d.ts +1 -1
- package/dist/platform/state/code-index-reindex.d.ts +73 -0
- package/dist/platform/state/code-index-reindex.d.ts.map +1 -0
- package/dist/platform/state/code-index-reindex.js +156 -0
- package/dist/platform/state/code-index-store.d.ts.map +1 -1
- package/dist/platform/state/code-index-store.js +11 -3
- package/dist/platform/state/index.d.ts +8 -0
- package/dist/platform/state/index.d.ts.map +1 -1
- package/dist/platform/state/index.js +4 -0
- package/dist/platform/state/memory-recall-contract.d.ts +118 -0
- package/dist/platform/state/memory-recall-contract.d.ts.map +1 -0
- package/dist/platform/state/memory-recall-contract.js +170 -0
- package/dist/platform/state/memory-registry.d.ts +8 -0
- package/dist/platform/state/memory-registry.d.ts.map +1 -1
- package/dist/platform/state/memory-registry.js +10 -0
- package/dist/platform/state/memory-store.d.ts +2 -0
- package/dist/platform/state/memory-store.d.ts.map +1 -1
- package/dist/platform/state/memory-store.js +4 -0
- package/dist/platform/state/memory-vector-store.d.ts.map +1 -1
- package/dist/platform/state/memory-vector-store.js +14 -3
- package/dist/platform/state/sqlite-store.d.ts +2 -0
- package/dist/platform/state/sqlite-store.d.ts.map +1 -1
- package/dist/platform/state/sqlite-store.js +4 -0
- package/dist/platform/state/sqlite-vec-loader.d.ts +1 -1
- package/dist/platform/state/sqlite-vec-loader.js +1 -1
- package/dist/platform/state/vibe-projection.d.ts +67 -0
- package/dist/platform/state/vibe-projection.d.ts.map +1 -0
- package/dist/platform/state/vibe-projection.js +115 -0
- package/dist/platform/tools/agent/index.d.ts.map +1 -1
- package/dist/platform/tools/agent/index.js +8 -0
- package/dist/platform/tools/agent/manager.d.ts +22 -10
- package/dist/platform/tools/agent/manager.d.ts.map +1 -1
- package/dist/platform/tools/agent/manager.js +13 -7
- package/dist/platform/tools/agent/schema.d.ts +26 -0
- package/dist/platform/tools/agent/schema.d.ts.map +1 -1
- package/dist/platform/tools/agent/schema.js +2 -2
- package/dist/platform/tools/agent/wrfc-batch-policy.d.ts +13 -0
- package/dist/platform/tools/agent/wrfc-batch-policy.d.ts.map +1 -1
- package/dist/platform/tools/agent/wrfc-batch-policy.js +60 -0
- package/dist/platform/tools/exec/runtime.d.ts +10 -0
- package/dist/platform/tools/exec/runtime.d.ts.map +1 -1
- package/dist/platform/tools/exec/runtime.js +27 -10
- package/dist/platform/tools/exec/schema.d.ts +2 -2
- package/dist/platform/tools/exec/schema.d.ts.map +1 -1
- package/dist/platform/tools/exec/schema.js +2 -1
- package/dist/platform/tools/fetch/runtime.d.ts +1 -1
- package/dist/platform/tools/index.d.ts +2 -0
- package/dist/platform/tools/index.d.ts.map +1 -1
- package/dist/platform/tools/index.js +2 -0
- package/dist/platform/tools/registry.d.ts +1 -1
- package/dist/platform/tools/registry.js +1 -1
- package/dist/platform/tools/state/index.d.ts +9 -0
- package/dist/platform/tools/state/index.d.ts.map +1 -1
- package/dist/platform/tools/state/index.js +60 -3
- package/dist/platform/types/foundation-contract.d.ts +1 -1
- package/dist/platform/types/foundation-contract.d.ts.map +1 -1
- package/dist/platform/types/index.d.ts +1 -1
- package/dist/platform/types/index.d.ts.map +1 -1
- package/dist/platform/types/tools.d.ts +1 -1
- package/dist/platform/utils/request-body.d.ts.map +1 -1
- package/dist/platform/utils/request-body.js +50 -5
- package/dist/platform/version.js +1 -1
- package/package.json +25 -9
- package/dist/platform/control-plane/routes/automation.d.ts +0 -3
- package/dist/platform/control-plane/routes/automation.d.ts.map +0 -1
- package/dist/platform/control-plane/routes/automation.js +0 -63
- package/dist/platform/control-plane/routes/context.d.ts +0 -2
- package/dist/platform/control-plane/routes/context.d.ts.map +0 -1
- package/dist/platform/control-plane/routes/context.js +0 -1
- package/dist/platform/control-plane/routes/operator.d.ts +0 -8
- package/dist/platform/control-plane/routes/operator.d.ts.map +0 -1
- package/dist/platform/control-plane/routes/operator.js +0 -415
- package/dist/platform/control-plane/routes/remote.d.ts +0 -3
- package/dist/platform/control-plane/routes/remote.d.ts.map +0 -1
- package/dist/platform/control-plane/routes/remote.js +0 -35
- package/dist/platform/control-plane/routes/sessions.d.ts +0 -3
- package/dist/platform/control-plane/routes/sessions.d.ts.map +0 -1
- package/dist/platform/control-plane/routes/sessions.js +0 -43
- package/dist/platform/control-plane/routes/tasks.d.ts +0 -3
- package/dist/platform/control-plane/routes/tasks.d.ts.map +0 -1
- package/dist/platform/control-plane/routes/tasks.js +0 -22
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* types.ts — the shared type surface for the calendar-connectivity module.
|
|
3
|
+
*
|
|
4
|
+
* Pure data shapes only. The module reads external calendars two ways — parsing
|
|
5
|
+
* .ics text (a file or a fetched feed body) into typed events, and managing named
|
|
6
|
+
* feed subscriptions with honest per-subscription status — and every value a
|
|
7
|
+
* caller sees is described here.
|
|
8
|
+
*
|
|
9
|
+
* Honesty contract (see docs/decisions/2026-07-05-calendar-connectivity-sdk-extraction.md):
|
|
10
|
+
* - date-time zone handling is stated, never faked. A DTSTART with a TZID is kept
|
|
11
|
+
* as its wall-clock value with the TZID recorded; NO offset conversion is applied
|
|
12
|
+
* (this build ships no tz database), so `zone: 'tzid'` means "local wall time in
|
|
13
|
+
* the named zone, not converted to UTC". A trailing-Z value is real UTC
|
|
14
|
+
* (`zone: 'utc'`); a bare date-time with neither is floating (`zone: 'floating'`).
|
|
15
|
+
* - recurrence is either fully expanded or explicitly not. A VEVENT whose RRULE
|
|
16
|
+
* uses only the supported subset expands to real occurrences; anything else keeps
|
|
17
|
+
* the seed event and carries an explicit `expansion: 'unsupported'` marker naming
|
|
18
|
+
* the part we declined to expand. Occurrences are never fabricated from a rule we
|
|
19
|
+
* do not fully honor.
|
|
20
|
+
*/
|
|
21
|
+
/** How a date/date-time value is anchored in time. */
|
|
22
|
+
export type EventZone = 'utc' | 'floating' | 'tzid';
|
|
23
|
+
/** A parsed DTSTART/DTEND value with its honest time anchoring. */
|
|
24
|
+
export interface EventDateTime {
|
|
25
|
+
/**
|
|
26
|
+
* The as-parsed value:
|
|
27
|
+
* - `kind: 'date'` => 'YYYY-MM-DD'
|
|
28
|
+
* - `kind: 'date-time'` => 'YYYY-MM-DDTHH:mm:ss' (floating/tzid) or the same
|
|
29
|
+
* with a trailing 'Z' (utc).
|
|
30
|
+
*/
|
|
31
|
+
readonly value: string;
|
|
32
|
+
readonly kind: 'date' | 'date-time';
|
|
33
|
+
readonly zone: EventZone;
|
|
34
|
+
/** Present only when `zone === 'tzid'`; the raw TZID as written in the feed. */
|
|
35
|
+
readonly tzid?: string;
|
|
36
|
+
}
|
|
37
|
+
/** Whether a VEVENT's RRULE was fully expanded, and why not when it was not. */
|
|
38
|
+
export type RecurrenceExpansion = 'full' | 'unsupported';
|
|
39
|
+
/** The honest recurrence descriptor attached to a recurring VEVENT. */
|
|
40
|
+
export interface RecurrenceInfo {
|
|
41
|
+
/** The raw RRULE line value, e.g. 'FREQ=WEEKLY;BYDAY=MO,WE;COUNT=10'. */
|
|
42
|
+
readonly rule: string;
|
|
43
|
+
readonly expansion: RecurrenceExpansion;
|
|
44
|
+
/**
|
|
45
|
+
* When `expansion === 'unsupported'`, a plain-language reason naming the part
|
|
46
|
+
* this build does not expand (e.g. 'RRULE part BYMONTHDAY is not expanded by
|
|
47
|
+
* this build'). Absent when `expansion === 'full'`.
|
|
48
|
+
*/
|
|
49
|
+
readonly unsupportedReason?: string;
|
|
50
|
+
}
|
|
51
|
+
/** A single calendar event parsed from a VEVENT. */
|
|
52
|
+
export interface CalendarEvent {
|
|
53
|
+
/** The VEVENT UID; a stable synthetic id is assigned when the feed omits one. */
|
|
54
|
+
readonly uid: string;
|
|
55
|
+
readonly summary: string;
|
|
56
|
+
readonly location?: string;
|
|
57
|
+
readonly description?: string;
|
|
58
|
+
readonly start: EventDateTime;
|
|
59
|
+
/** DTEND when present; a VEVENT may legitimately omit it (e.g. a reminder). */
|
|
60
|
+
readonly end?: EventDateTime;
|
|
61
|
+
/** Present when the VEVENT carried an RRULE. */
|
|
62
|
+
readonly recurrence?: RecurrenceInfo;
|
|
63
|
+
}
|
|
64
|
+
/** A non-fatal problem encountered while parsing, tied to the source when known. */
|
|
65
|
+
export interface ParseDiagnostic {
|
|
66
|
+
/** 1-based line number in the (unfolded) source, when attributable. */
|
|
67
|
+
readonly line?: number;
|
|
68
|
+
/** The offending component/property name, when attributable (e.g. 'DTSTART'). */
|
|
69
|
+
readonly component?: string;
|
|
70
|
+
readonly message: string;
|
|
71
|
+
}
|
|
72
|
+
/** The full result of parsing .ics text. */
|
|
73
|
+
export interface ParsedCalendar {
|
|
74
|
+
/** Calendar name from X-WR-CALNAME, when the feed supplied one. */
|
|
75
|
+
readonly calendarName?: string;
|
|
76
|
+
readonly events: readonly CalendarEvent[];
|
|
77
|
+
/**
|
|
78
|
+
* Events that were recognised as VEVENTs but could not be turned into a usable
|
|
79
|
+
* event (e.g. no DTSTART). Never silently dropped — surfaced here with a reason.
|
|
80
|
+
*/
|
|
81
|
+
readonly skipped: readonly ParseDiagnostic[];
|
|
82
|
+
/** Non-fatal notes (unsupported recurrence, unknown TZID kept as-is, etc.). */
|
|
83
|
+
readonly diagnostics: readonly ParseDiagnostic[];
|
|
84
|
+
}
|
|
85
|
+
/** One concrete occurrence produced by expanding a (possibly recurring) event. */
|
|
86
|
+
export interface EventOccurrence {
|
|
87
|
+
readonly event: CalendarEvent;
|
|
88
|
+
/** Occurrence start as 'YYYY-MM-DD' or 'YYYY-MM-DDTHH:mm:ss[Z]', mirroring start.kind/zone. */
|
|
89
|
+
readonly start: string;
|
|
90
|
+
/** True only for the seed occurrence of a recurring event. */
|
|
91
|
+
readonly isSeed: boolean;
|
|
92
|
+
}
|
|
93
|
+
/** An inclusive [from, to] window for occurrence expansion, as 'YYYY-MM-DD' strings. */
|
|
94
|
+
export interface DateWindow {
|
|
95
|
+
readonly from: string;
|
|
96
|
+
readonly to: string;
|
|
97
|
+
}
|
|
98
|
+
/** Honest health of a named feed subscription. */
|
|
99
|
+
export type SubscriptionHealth = 'never-fetched' | 'ok' | 'stale' | 'unreachable' | 'parse-error';
|
|
100
|
+
/** A named external-calendar feed subscription and its current status. */
|
|
101
|
+
export interface CalendarSubscription {
|
|
102
|
+
readonly name: string;
|
|
103
|
+
/** The feed URL. Treat as secrets-adjacent: a Google "secret address" grants read access. */
|
|
104
|
+
readonly url: string;
|
|
105
|
+
/** How often a refresh becomes due, in milliseconds. Bounded by the store. */
|
|
106
|
+
readonly refreshIntervalMs: number;
|
|
107
|
+
/** Epoch ms of the last fetch ATTEMPT (success or failure), if any. */
|
|
108
|
+
readonly lastFetchedAt?: number;
|
|
109
|
+
/** Epoch ms of the last SUCCESSFUL parse, if any. */
|
|
110
|
+
readonly lastSucceededAt?: number;
|
|
111
|
+
/** HTTP validators for conditional refresh, when the server supplied them. */
|
|
112
|
+
readonly etag?: string;
|
|
113
|
+
readonly lastModified?: string;
|
|
114
|
+
readonly health: SubscriptionHealth;
|
|
115
|
+
/** Plain-language elaboration of a non-ok health (http status, parse line, age). */
|
|
116
|
+
readonly detail?: string;
|
|
117
|
+
/** Count of events from the most recent successful parse. */
|
|
118
|
+
readonly eventCount?: number;
|
|
119
|
+
}
|
|
120
|
+
/** A conditional-fetch request the injected fetcher receives. */
|
|
121
|
+
export interface FeedFetchRequest {
|
|
122
|
+
readonly url: string;
|
|
123
|
+
readonly etag?: string;
|
|
124
|
+
readonly lastModified?: string;
|
|
125
|
+
}
|
|
126
|
+
/** The result the injected fetcher returns. Tests supply this from fake feeds. */
|
|
127
|
+
export type FeedFetchResult = {
|
|
128
|
+
readonly kind: 'ok';
|
|
129
|
+
readonly body: string;
|
|
130
|
+
readonly etag?: string;
|
|
131
|
+
readonly lastModified?: string;
|
|
132
|
+
} | {
|
|
133
|
+
readonly kind: 'not-modified';
|
|
134
|
+
readonly etag?: string;
|
|
135
|
+
readonly lastModified?: string;
|
|
136
|
+
} | {
|
|
137
|
+
readonly kind: 'error';
|
|
138
|
+
readonly status?: number;
|
|
139
|
+
readonly message: string;
|
|
140
|
+
};
|
|
141
|
+
/** Injected network boundary — the ONLY way this module reaches the network. */
|
|
142
|
+
export type FeedFetcher = (req: FeedFetchRequest) => Promise<FeedFetchResult>;
|
|
143
|
+
/** Injected clock, so refresh/staleness timing is deterministic in tests. */
|
|
144
|
+
export type Clock = () => number;
|
|
145
|
+
/** The per-refresh report a caller can turn into an honest status line. */
|
|
146
|
+
export interface RefreshReport {
|
|
147
|
+
readonly name: string;
|
|
148
|
+
/**
|
|
149
|
+
* - 'updated' — fetched fresh body, parsed, events replaced.
|
|
150
|
+
* - 'not-modified' — server said 304; kept prior events, refreshed timestamp.
|
|
151
|
+
* - 'skipped' — not due yet and not forced.
|
|
152
|
+
* - 'unreachable' — fetch failed at the network stage.
|
|
153
|
+
* - 'parse-error' — fetched, but the body could not be parsed.
|
|
154
|
+
*/
|
|
155
|
+
readonly outcome: 'updated' | 'not-modified' | 'skipped' | 'unreachable' | 'parse-error';
|
|
156
|
+
readonly health: SubscriptionHealth;
|
|
157
|
+
readonly eventCount?: number;
|
|
158
|
+
readonly detail?: string;
|
|
159
|
+
}
|
|
160
|
+
/** Serialisable subscription metadata for a caller that persists across restarts. */
|
|
161
|
+
export interface SubscriptionSnapshot {
|
|
162
|
+
readonly name: string;
|
|
163
|
+
readonly url: string;
|
|
164
|
+
readonly refreshIntervalMs: number;
|
|
165
|
+
readonly lastFetchedAt?: number;
|
|
166
|
+
readonly lastSucceededAt?: number;
|
|
167
|
+
readonly etag?: string;
|
|
168
|
+
readonly lastModified?: string;
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/platform/calendar/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* types.ts — the shared type surface for the calendar-connectivity module.
|
|
3
|
+
*
|
|
4
|
+
* Pure data shapes only. The module reads external calendars two ways — parsing
|
|
5
|
+
* .ics text (a file or a fetched feed body) into typed events, and managing named
|
|
6
|
+
* feed subscriptions with honest per-subscription status — and every value a
|
|
7
|
+
* caller sees is described here.
|
|
8
|
+
*
|
|
9
|
+
* Honesty contract (see docs/decisions/2026-07-05-calendar-connectivity-sdk-extraction.md):
|
|
10
|
+
* - date-time zone handling is stated, never faked. A DTSTART with a TZID is kept
|
|
11
|
+
* as its wall-clock value with the TZID recorded; NO offset conversion is applied
|
|
12
|
+
* (this build ships no tz database), so `zone: 'tzid'` means "local wall time in
|
|
13
|
+
* the named zone, not converted to UTC". A trailing-Z value is real UTC
|
|
14
|
+
* (`zone: 'utc'`); a bare date-time with neither is floating (`zone: 'floating'`).
|
|
15
|
+
* - recurrence is either fully expanded or explicitly not. A VEVENT whose RRULE
|
|
16
|
+
* uses only the supported subset expands to real occurrences; anything else keeps
|
|
17
|
+
* the seed event and carries an explicit `expansion: 'unsupported'` marker naming
|
|
18
|
+
* the part we declined to expand. Occurrences are never fabricated from a rule we
|
|
19
|
+
* do not fully honor.
|
|
20
|
+
*/
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* companion-chat-attachments.ts
|
|
3
|
+
*
|
|
4
|
+
* Pure attachment-resolution + provider-content helpers for CompanionChatManager.
|
|
5
|
+
* Extracted so the manager file stays within its line budget; behaviour is
|
|
6
|
+
* unchanged — every function takes the artifact store explicitly instead of
|
|
7
|
+
* reaching through `this`.
|
|
8
|
+
*/
|
|
9
|
+
import { Buffer } from 'node:buffer';
|
|
10
|
+
import type { ContentPart } from '../providers/interface.js';
|
|
11
|
+
import type { ArtifactDescriptor } from '../artifacts/index.js';
|
|
12
|
+
import type { CompanionChatMessageAttachment, CompanionChatMessageAttachmentInput, CompanionChatMessage } from './companion-chat-types.js';
|
|
13
|
+
export declare const MAX_ATTACHMENTS_PER_MESSAGE = 8;
|
|
14
|
+
export interface CompanionChatArtifactStore {
|
|
15
|
+
get(artifactId: string): ArtifactDescriptor | null;
|
|
16
|
+
readContent(artifactId: string): Promise<{
|
|
17
|
+
readonly record: {
|
|
18
|
+
readonly mimeType: string;
|
|
19
|
+
readonly filename?: string | undefined;
|
|
20
|
+
};
|
|
21
|
+
readonly buffer: ArrayBuffer | Uint8Array | Buffer;
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
24
|
+
export declare function toNodeBuffer(buffer: ArrayBuffer | Uint8Array | Buffer): Buffer;
|
|
25
|
+
export declare function resolveAttachments(inputs: readonly CompanionChatMessageAttachmentInput[], artifactStore: CompanionChatArtifactStore | null): CompanionChatMessageAttachment[];
|
|
26
|
+
export declare function formatAttachmentSummary(attachments: readonly CompanionChatMessageAttachment[]): string;
|
|
27
|
+
export declare function buildReplayUserContent(message: CompanionChatMessage): string;
|
|
28
|
+
export declare function buildProviderUserContent(content: string, attachments: readonly CompanionChatMessageAttachment[], artifactStore: CompanionChatArtifactStore | null): Promise<string | ContentPart[]>;
|
|
29
|
+
//# sourceMappingURL=companion-chat-attachments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"companion-chat-attachments.d.ts","sourceRoot":"","sources":["../../../src/platform/companion/companion-chat-attachments.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EACV,8BAA8B,EAC9B,mCAAmC,EACnC,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;AAInC,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAI7C,MAAM,WAAW,0BAA0B;IACzC,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,kBAAkB,GAAG,IAAI,CAAC;IACnD,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;QACvC,QAAQ,CAAC,MAAM,EAAE;YAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;SAAE,CAAC;QACvF,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,UAAU,GAAG,MAAM,CAAC;KACpD,CAAC,CAAC;CACJ;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAI9E;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,SAAS,mCAAmC,EAAE,EACtD,aAAa,EAAE,0BAA0B,GAAG,IAAI,GAC/C,8BAA8B,EAAE,CAwClC;AAED,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,SAAS,8BAA8B,EAAE,GAAG,MAAM,CAOtG;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAE5E;AAqBD,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,SAAS,8BAA8B,EAAE,EACtD,aAAa,EAAE,0BAA0B,GAAG,IAAI,GAC/C,OAAO,CAAC,MAAM,GAAG,WAAW,EAAE,CAAC,CAmCjC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* companion-chat-attachments.ts
|
|
3
|
+
*
|
|
4
|
+
* Pure attachment-resolution + provider-content helpers for CompanionChatManager.
|
|
5
|
+
* Extracted so the manager file stays within its line budget; behaviour is
|
|
6
|
+
* unchanged — every function takes the artifact store explicitly instead of
|
|
7
|
+
* reaching through `this`.
|
|
8
|
+
*/
|
|
9
|
+
import { Buffer } from 'node:buffer';
|
|
10
|
+
import { summarizeError } from '../utils/error-display.js';
|
|
11
|
+
import { logger } from '../utils/logger.js';
|
|
12
|
+
export const MAX_ATTACHMENTS_PER_MESSAGE = 8;
|
|
13
|
+
const MAX_INLINE_IMAGE_ATTACHMENT_BYTES = 20 * 1024 * 1024;
|
|
14
|
+
const MAX_INLINE_TEXT_ATTACHMENT_BYTES = 200 * 1024;
|
|
15
|
+
export function toNodeBuffer(buffer) {
|
|
16
|
+
if (Buffer.isBuffer(buffer))
|
|
17
|
+
return buffer;
|
|
18
|
+
if (buffer instanceof ArrayBuffer)
|
|
19
|
+
return Buffer.from(new Uint8Array(buffer));
|
|
20
|
+
return Buffer.from(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
21
|
+
}
|
|
22
|
+
export function resolveAttachments(inputs, artifactStore) {
|
|
23
|
+
if (inputs.length === 0)
|
|
24
|
+
return [];
|
|
25
|
+
if (inputs.length > MAX_ATTACHMENTS_PER_MESSAGE) {
|
|
26
|
+
throw Object.assign(new Error(`A companion chat message can include at most ${MAX_ATTACHMENTS_PER_MESSAGE} attachments.`), { code: 'TOO_MANY_ATTACHMENTS', status: 400 });
|
|
27
|
+
}
|
|
28
|
+
if (!artifactStore) {
|
|
29
|
+
throw Object.assign(new Error('Companion chat attachments require an artifact store.'), { code: 'ATTACHMENTS_UNAVAILABLE', status: 501 });
|
|
30
|
+
}
|
|
31
|
+
return inputs.map((input) => {
|
|
32
|
+
const artifactId = input.artifactId.trim();
|
|
33
|
+
if (!artifactId) {
|
|
34
|
+
throw Object.assign(new Error('Attachment artifactId is required.'), {
|
|
35
|
+
code: 'INVALID_ATTACHMENT',
|
|
36
|
+
status: 400,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
const artifact = artifactStore.get(artifactId);
|
|
40
|
+
if (!artifact) {
|
|
41
|
+
throw Object.assign(new Error(`Unknown attachment artifact: ${artifactId}`), {
|
|
42
|
+
code: 'UNKNOWN_ARTIFACT',
|
|
43
|
+
status: 404,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
...artifact,
|
|
48
|
+
artifactId: artifact.id,
|
|
49
|
+
...(input.label?.trim() ? { label: input.label.trim() } : {}),
|
|
50
|
+
metadata: {
|
|
51
|
+
...artifact.metadata,
|
|
52
|
+
...(input.metadata ?? {}),
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
export function formatAttachmentSummary(attachments) {
|
|
58
|
+
if (attachments.length === 0)
|
|
59
|
+
return '';
|
|
60
|
+
const lines = attachments.map((attachment, index) => {
|
|
61
|
+
const name = attachment.label ?? attachment.filename ?? attachment.artifactId;
|
|
62
|
+
return `${index + 1}. ${name} (${attachment.mimeType}, ${attachment.sizeBytes} bytes, artifact ${attachment.artifactId})`;
|
|
63
|
+
});
|
|
64
|
+
return `\n\nAttached file${attachments.length === 1 ? '' : 's'}:\n${lines.join('\n')}`;
|
|
65
|
+
}
|
|
66
|
+
export function buildReplayUserContent(message) {
|
|
67
|
+
return `${message.content}${formatAttachmentSummary(message.attachments ?? [])}`;
|
|
68
|
+
}
|
|
69
|
+
function isInlineTextAttachment(attachment) {
|
|
70
|
+
const lower = attachment.mimeType.toLowerCase();
|
|
71
|
+
return attachment.sizeBytes <= MAX_INLINE_TEXT_ATTACHMENT_BYTES
|
|
72
|
+
&& (lower.startsWith('text/')
|
|
73
|
+
|| lower === 'application/json'
|
|
74
|
+
|| lower === 'application/xml'
|
|
75
|
+
|| lower === 'application/yaml'
|
|
76
|
+
|| lower === 'text/csv');
|
|
77
|
+
}
|
|
78
|
+
function isInlineImageAttachment(attachment) {
|
|
79
|
+
const lower = attachment.mimeType.toLowerCase();
|
|
80
|
+
return attachment.sizeBytes <= MAX_INLINE_IMAGE_ATTACHMENT_BYTES
|
|
81
|
+
&& (lower === 'image/png'
|
|
82
|
+
|| lower === 'image/jpeg'
|
|
83
|
+
|| lower === 'image/gif'
|
|
84
|
+
|| lower === 'image/webp');
|
|
85
|
+
}
|
|
86
|
+
export async function buildProviderUserContent(content, attachments, artifactStore) {
|
|
87
|
+
if (attachments.length === 0)
|
|
88
|
+
return content;
|
|
89
|
+
const textSections = [content.trim() ? content : 'Please review the attached file(s).'];
|
|
90
|
+
const imageParts = [];
|
|
91
|
+
for (const attachment of attachments) {
|
|
92
|
+
if (!artifactStore)
|
|
93
|
+
continue;
|
|
94
|
+
try {
|
|
95
|
+
if (isInlineTextAttachment(attachment)) {
|
|
96
|
+
const { buffer } = await artifactStore.readContent(attachment.artifactId);
|
|
97
|
+
const text = toNodeBuffer(buffer).toString('utf-8');
|
|
98
|
+
textSections.push(`\n\n--- Attachment: ${attachment.label ?? attachment.filename ?? attachment.artifactId} ---\n${text}`);
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (isInlineImageAttachment(attachment)) {
|
|
102
|
+
const { buffer } = await artifactStore.readContent(attachment.artifactId);
|
|
103
|
+
imageParts.push({
|
|
104
|
+
type: 'image',
|
|
105
|
+
mediaType: attachment.mimeType,
|
|
106
|
+
data: toNodeBuffer(buffer).toString('base64'),
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
logger.warn('[companion-chat] failed to inline attachment for provider prompt', {
|
|
112
|
+
artifactId: attachment.artifactId,
|
|
113
|
+
error: summarizeError(error),
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
textSections.push(formatAttachmentSummary(attachments));
|
|
118
|
+
if (imageParts.length === 0)
|
|
119
|
+
return textSections.join('');
|
|
120
|
+
return [{ type: 'text', text: textSections.join('') }, ...imageParts];
|
|
121
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* companion-chat-branching.ts
|
|
3
|
+
*
|
|
4
|
+
* The honest-lineage core for the two conversation-forking operations the chat
|
|
5
|
+
* web UI needs: regenerate a response, and edit an earlier message and branch
|
|
6
|
+
* from it. Split out of companion-chat-manager.ts (see CHANGELOG) so the manager
|
|
7
|
+
* stays under the hand-authored file-size cap.
|
|
8
|
+
*
|
|
9
|
+
* THE HONESTY CONTRACT (this is the whole point of the module):
|
|
10
|
+
* neither operation ever deletes or overwrites message history. A regenerate or
|
|
11
|
+
* an edit marks the affected messages as SUPERSEDED — they stay in the message
|
|
12
|
+
* list and on disk, flagged with `supersededAt`/`supersededReason` — and then a
|
|
13
|
+
* fresh turn runs from the fork point. The "active" conversation is the chain of
|
|
14
|
+
* messages WITHOUT a `supersededAt`; everything behind a fork remains
|
|
15
|
+
* retrievable. Nothing is silently lost, mirroring the delete-means-delete
|
|
16
|
+
* discipline: a regenerate is a new turn, an edit is a new branch, and the old
|
|
17
|
+
* branch is kept as visible history rather than thrown away.
|
|
18
|
+
*
|
|
19
|
+
* These functions mutate the passed session's `messages` array in place and
|
|
20
|
+
* return a plan; the caller (the manager) is responsible for rebuilding the
|
|
21
|
+
* LLM-facing conversation from the active chain, persisting, and running the new
|
|
22
|
+
* turn. Errors are thrown with `{ code, status }` so the route layer maps them
|
|
23
|
+
* to honest machine codes.
|
|
24
|
+
*/
|
|
25
|
+
import type { CompanionChatMessage, EditCompanionChatMessageInput } from './companion-chat-types.js';
|
|
26
|
+
import { type CompanionChatArtifactStore } from './companion-chat-attachments.js';
|
|
27
|
+
/** The mutable session shape these helpers operate on (subset of the manager's InternalSession). */
|
|
28
|
+
export interface BranchingSession {
|
|
29
|
+
messages: CompanionChatMessage[];
|
|
30
|
+
lastActivityAt: number;
|
|
31
|
+
}
|
|
32
|
+
/** The active (non-superseded) messages, in order — the live conversation chain. */
|
|
33
|
+
export declare function activeMessages(messages: readonly CompanionChatMessage[]): CompanionChatMessage[];
|
|
34
|
+
export interface RegeneratePlan {
|
|
35
|
+
readonly regeneratedFrom: string;
|
|
36
|
+
readonly supersededMessageIds: readonly string[];
|
|
37
|
+
/** The user message the re-run turn is anchored on. */
|
|
38
|
+
readonly anchorUserMessageId: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Plan a regenerate: pick the target assistant message (an explicit id, or the
|
|
42
|
+
* latest active assistant message), supersede it and everything after it, and
|
|
43
|
+
* return the preceding active user message as the anchor for the new turn.
|
|
44
|
+
*
|
|
45
|
+
* Throws when the session has no assistant message to regenerate, when an
|
|
46
|
+
* explicit id is unknown or is not an active assistant message, or when there is
|
|
47
|
+
* no user message preceding the target to re-run from.
|
|
48
|
+
*/
|
|
49
|
+
export declare function planRegenerate(session: BranchingSession, targetMessageId: string | undefined, now: number): RegeneratePlan;
|
|
50
|
+
export interface EditBranchPlan {
|
|
51
|
+
readonly editedFrom: string;
|
|
52
|
+
readonly newMessageId: string;
|
|
53
|
+
readonly supersededMessageIds: readonly string[];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Apply an edit-and-branch: the target must be an active user message. It and
|
|
57
|
+
* everything after it are superseded (retained), then a new user message with
|
|
58
|
+
* the edited content — carrying `revisionOf` back to the original — is appended.
|
|
59
|
+
* The caller then rebuilds the conversation from the active chain and runs a
|
|
60
|
+
* turn.
|
|
61
|
+
*
|
|
62
|
+
* Throws when the target id is unknown, is not a user message, is already
|
|
63
|
+
* superseded history, or the edited message has neither content nor attachments.
|
|
64
|
+
*/
|
|
65
|
+
export declare function applyEditBranch(session: BranchingSession, sessionId: string, input: EditCompanionChatMessageInput, artifactStore: CompanionChatArtifactStore | null, now: number): EditBranchPlan;
|
|
66
|
+
//# sourceMappingURL=companion-chat-branching.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"companion-chat-branching.d.ts","sourceRoot":"","sources":["../../../src/platform/companion/companion-chat-branching.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EACV,oBAAoB,EAEpB,6BAA6B,EAC9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,iCAAiC,CAAC;AAEzC,oGAAoG;AACpG,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,oBAAoB,EAAE,CAAC;IACjC,cAAc,EAAE,MAAM,CAAC;CACxB;AAwBD,oFAAoF;AACpF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,SAAS,oBAAoB,EAAE,GAAG,oBAAoB,EAAE,CAEhG;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,oBAAoB,EAAE,SAAS,MAAM,EAAE,CAAC;IACjD,uDAAuD;IACvD,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;CACtC;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,gBAAgB,EACzB,eAAe,EAAE,MAAM,GAAG,SAAS,EACnC,GAAG,EAAE,MAAM,GACV,cAAc,CA4DhB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,oBAAoB,EAAE,SAAS,MAAM,EAAE,CAAC;CAClD;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,gBAAgB,EACzB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,6BAA6B,EACpC,aAAa,EAAE,0BAA0B,GAAG,IAAI,EAChD,GAAG,EAAE,MAAM,GACV,cAAc,CAwChB"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* companion-chat-branching.ts
|
|
3
|
+
*
|
|
4
|
+
* The honest-lineage core for the two conversation-forking operations the chat
|
|
5
|
+
* web UI needs: regenerate a response, and edit an earlier message and branch
|
|
6
|
+
* from it. Split out of companion-chat-manager.ts (see CHANGELOG) so the manager
|
|
7
|
+
* stays under the hand-authored file-size cap.
|
|
8
|
+
*
|
|
9
|
+
* THE HONESTY CONTRACT (this is the whole point of the module):
|
|
10
|
+
* neither operation ever deletes or overwrites message history. A regenerate or
|
|
11
|
+
* an edit marks the affected messages as SUPERSEDED — they stay in the message
|
|
12
|
+
* list and on disk, flagged with `supersededAt`/`supersededReason` — and then a
|
|
13
|
+
* fresh turn runs from the fork point. The "active" conversation is the chain of
|
|
14
|
+
* messages WITHOUT a `supersededAt`; everything behind a fork remains
|
|
15
|
+
* retrievable. Nothing is silently lost, mirroring the delete-means-delete
|
|
16
|
+
* discipline: a regenerate is a new turn, an edit is a new branch, and the old
|
|
17
|
+
* branch is kept as visible history rather than thrown away.
|
|
18
|
+
*
|
|
19
|
+
* These functions mutate the passed session's `messages` array in place and
|
|
20
|
+
* return a plan; the caller (the manager) is responsible for rebuilding the
|
|
21
|
+
* LLM-facing conversation from the active chain, persisting, and running the new
|
|
22
|
+
* turn. Errors are thrown with `{ code, status }` so the route layer maps them
|
|
23
|
+
* to honest machine codes.
|
|
24
|
+
*/
|
|
25
|
+
import { randomUUID } from 'node:crypto';
|
|
26
|
+
import { resolveAttachments, } from './companion-chat-attachments.js';
|
|
27
|
+
/** Build a `{ code, status }`-carrying error the route layer turns into a machine code. */
|
|
28
|
+
function branchError(message, code, status) {
|
|
29
|
+
return Object.assign(new Error(message), { code, status });
|
|
30
|
+
}
|
|
31
|
+
/** Mark messages[fromIndex..] as superseded in place, returning the ids touched. */
|
|
32
|
+
function supersedeFrom(session, fromIndex, reason, now) {
|
|
33
|
+
const superseded = [];
|
|
34
|
+
for (let i = fromIndex; i < session.messages.length; i++) {
|
|
35
|
+
const msg = session.messages[i];
|
|
36
|
+
if (msg.supersededAt !== undefined)
|
|
37
|
+
continue; // already retained history — leave as-is
|
|
38
|
+
session.messages[i] = { ...msg, supersededAt: now, supersededReason: reason };
|
|
39
|
+
superseded.push(msg.id);
|
|
40
|
+
}
|
|
41
|
+
return superseded;
|
|
42
|
+
}
|
|
43
|
+
/** The active (non-superseded) messages, in order — the live conversation chain. */
|
|
44
|
+
export function activeMessages(messages) {
|
|
45
|
+
return messages.filter((m) => m.supersededAt === undefined);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Plan a regenerate: pick the target assistant message (an explicit id, or the
|
|
49
|
+
* latest active assistant message), supersede it and everything after it, and
|
|
50
|
+
* return the preceding active user message as the anchor for the new turn.
|
|
51
|
+
*
|
|
52
|
+
* Throws when the session has no assistant message to regenerate, when an
|
|
53
|
+
* explicit id is unknown or is not an active assistant message, or when there is
|
|
54
|
+
* no user message preceding the target to re-run from.
|
|
55
|
+
*/
|
|
56
|
+
export function planRegenerate(session, targetMessageId, now) {
|
|
57
|
+
const messages = session.messages;
|
|
58
|
+
let targetIndex;
|
|
59
|
+
if (targetMessageId !== undefined) {
|
|
60
|
+
targetIndex = messages.findIndex((m) => m.id === targetMessageId);
|
|
61
|
+
if (targetIndex === -1) {
|
|
62
|
+
throw branchError(`Message not found: ${targetMessageId}`, 'MESSAGE_NOT_FOUND', 404);
|
|
63
|
+
}
|
|
64
|
+
const target = messages[targetIndex];
|
|
65
|
+
if (target.supersededAt !== undefined) {
|
|
66
|
+
throw branchError('That message is already superseded history; regenerate the active response instead.', 'MESSAGE_SUPERSEDED', 409);
|
|
67
|
+
}
|
|
68
|
+
if (target.role !== 'assistant') {
|
|
69
|
+
throw branchError('Only an assistant message can be regenerated; edit a user message to branch instead.', 'NOT_AN_ASSISTANT_MESSAGE', 400);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
targetIndex = -1;
|
|
74
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
75
|
+
const m = messages[i];
|
|
76
|
+
if (m.supersededAt === undefined && m.role === 'assistant') {
|
|
77
|
+
targetIndex = i;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (targetIndex === -1) {
|
|
82
|
+
throw branchError('No assistant response to regenerate.', 'NO_ASSISTANT_MESSAGE', 409);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const regeneratedFrom = messages[targetIndex].id;
|
|
86
|
+
// The anchor is the nearest active user message before the target assistant.
|
|
87
|
+
let anchorUserMessageId = null;
|
|
88
|
+
for (let i = targetIndex - 1; i >= 0; i--) {
|
|
89
|
+
const m = messages[i];
|
|
90
|
+
if (m.supersededAt === undefined && m.role === 'user') {
|
|
91
|
+
anchorUserMessageId = m.id;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (anchorUserMessageId === null) {
|
|
96
|
+
throw branchError('No user message precedes that response to regenerate from.', 'NO_ANCHOR_MESSAGE', 409);
|
|
97
|
+
}
|
|
98
|
+
const supersededMessageIds = supersedeFrom(session, targetIndex, 'regenerate', now);
|
|
99
|
+
session.lastActivityAt = now;
|
|
100
|
+
return { regeneratedFrom, supersededMessageIds, anchorUserMessageId };
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Apply an edit-and-branch: the target must be an active user message. It and
|
|
104
|
+
* everything after it are superseded (retained), then a new user message with
|
|
105
|
+
* the edited content — carrying `revisionOf` back to the original — is appended.
|
|
106
|
+
* The caller then rebuilds the conversation from the active chain and runs a
|
|
107
|
+
* turn.
|
|
108
|
+
*
|
|
109
|
+
* Throws when the target id is unknown, is not a user message, is already
|
|
110
|
+
* superseded history, or the edited message has neither content nor attachments.
|
|
111
|
+
*/
|
|
112
|
+
export function applyEditBranch(session, sessionId, input, artifactStore, now) {
|
|
113
|
+
const attachments = resolveAttachments(input.attachments ?? [], artifactStore);
|
|
114
|
+
if (!input.content.trim() && attachments.length === 0) {
|
|
115
|
+
throw branchError('content or attachments are required', 'INVALID_INPUT', 400);
|
|
116
|
+
}
|
|
117
|
+
const targetIndex = session.messages.findIndex((m) => m.id === input.messageId);
|
|
118
|
+
if (targetIndex === -1) {
|
|
119
|
+
throw branchError(`Message not found: ${input.messageId}`, 'MESSAGE_NOT_FOUND', 404);
|
|
120
|
+
}
|
|
121
|
+
const target = session.messages[targetIndex];
|
|
122
|
+
if (target.supersededAt !== undefined) {
|
|
123
|
+
throw branchError('That message is already superseded history; edit the active message instead.', 'MESSAGE_SUPERSEDED', 409);
|
|
124
|
+
}
|
|
125
|
+
if (target.role !== 'user') {
|
|
126
|
+
throw branchError('Only a user message can be edited and branched from.', 'NOT_A_USER_MESSAGE', 400);
|
|
127
|
+
}
|
|
128
|
+
const supersededMessageIds = supersedeFrom(session, targetIndex, 'edit', now);
|
|
129
|
+
const replacement = {
|
|
130
|
+
id: randomUUID(),
|
|
131
|
+
sessionId,
|
|
132
|
+
role: 'user',
|
|
133
|
+
content: input.content,
|
|
134
|
+
attachments,
|
|
135
|
+
...(input.metadata !== undefined ? { metadata: input.metadata } : {}),
|
|
136
|
+
createdAt: now,
|
|
137
|
+
revisionOf: input.messageId,
|
|
138
|
+
};
|
|
139
|
+
session.messages.push(replacement);
|
|
140
|
+
session.lastActivityAt = now;
|
|
141
|
+
return { editedFrom: input.messageId, newMessageId: replacement.id, supersededMessageIds };
|
|
142
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* companion-chat-broker-bridge.ts
|
|
3
|
+
*
|
|
4
|
+
* The narrow, structural view of the SharedSessionBroker that CompanionChatManager
|
|
5
|
+
* uses to register companion sessions INTO the one shared session store at write
|
|
6
|
+
* time (S1 item D: companion registers into the broker). Defined structurally so
|
|
7
|
+
* the companion package does not take a hard dependency on the control-plane
|
|
8
|
+
* broker's full surface — the real SharedSessionBroker satisfies this shape.
|
|
9
|
+
*
|
|
10
|
+
* Live registration is the fast path (a created/closed companion session is
|
|
11
|
+
* visible to /api/sessions immediately, same-process); the boot-time importer
|
|
12
|
+
* fold remains the reconciliation path for files written by other instances.
|
|
13
|
+
*/
|
|
14
|
+
/** Participant identity for a companion session in the shared store. */
|
|
15
|
+
export interface CompanionBrokerParticipant {
|
|
16
|
+
readonly surfaceKind: 'companion';
|
|
17
|
+
readonly surfaceId: string;
|
|
18
|
+
readonly lastSeenAt: number;
|
|
19
|
+
}
|
|
20
|
+
export interface CompanionBrokerRegisterInput {
|
|
21
|
+
readonly sessionId: string;
|
|
22
|
+
readonly kind: 'companion-chat';
|
|
23
|
+
readonly project?: string | undefined;
|
|
24
|
+
readonly title?: string | undefined;
|
|
25
|
+
readonly participant: CompanionBrokerParticipant;
|
|
26
|
+
/** Reopen a closed shared record; companion mirrors its own live state. */
|
|
27
|
+
readonly reopen?: boolean | undefined;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Structural subset of SharedSessionBroker. Return types are intentionally
|
|
31
|
+
* `unknown` — the companion manager fires these for their effect on the store,
|
|
32
|
+
* not for their result.
|
|
33
|
+
*/
|
|
34
|
+
export interface CompanionSessionBrokerBridge {
|
|
35
|
+
register(input: CompanionBrokerRegisterInput): Promise<unknown>;
|
|
36
|
+
closeSession(sessionId: string): Promise<unknown>;
|
|
37
|
+
/** Hard-remove the mirrored shared-session record (see CHANGELOG 1.0.0: companion delete is a real removal, not a close). */
|
|
38
|
+
deleteSession(sessionId: string): Promise<unknown>;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=companion-chat-broker-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"companion-chat-broker-bridge.d.ts","sourceRoot":"","sources":["../../../src/platform/companion/companion-chat-broker-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,wEAAwE;AACxE,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,WAAW,EAAE,0BAA0B,CAAC;IACjD,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACvC;AAED;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,KAAK,EAAE,4BAA4B,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAChE,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAClD,6HAA6H;IAC7H,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACpD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* companion-chat-broker-bridge.ts
|
|
3
|
+
*
|
|
4
|
+
* The narrow, structural view of the SharedSessionBroker that CompanionChatManager
|
|
5
|
+
* uses to register companion sessions INTO the one shared session store at write
|
|
6
|
+
* time (S1 item D: companion registers into the broker). Defined structurally so
|
|
7
|
+
* the companion package does not take a hard dependency on the control-plane
|
|
8
|
+
* broker's full surface — the real SharedSessionBroker satisfies this shape.
|
|
9
|
+
*
|
|
10
|
+
* Live registration is the fast path (a created/closed companion session is
|
|
11
|
+
* visible to /api/sessions immediately, same-process); the boot-time importer
|
|
12
|
+
* fold remains the reconciliation path for files written by other instances.
|
|
13
|
+
*/
|
|
14
|
+
export {};
|