@leitwerk-dev/server 0.2.0 → 0.3.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/app-4QSV4FUQ.js +8 -0
- package/dist/{app-D4XHIbwA.d.ts → app-WfwKzrVk.d.ts} +2029 -410
- package/dist/app.d.ts +55 -12
- package/dist/app.d.ts.map +1 -1
- package/dist/{chunk-AGC2ND53.js → chunk-KIOQNNG6.js} +1645 -750
- package/dist/chunk-KIOQNNG6.js.map +1 -0
- package/dist/{chunk-XTXH6623.js → chunk-LK3RO6C7.js} +1543 -2111
- package/dist/chunk-LK3RO6C7.js.map +1 -0
- package/dist/config/config-loader.d.ts +11 -0
- package/dist/config/config-loader.d.ts.map +1 -1
- package/dist/config/config-types.d.ts +152 -51
- package/dist/config/config-types.d.ts.map +1 -1
- package/dist/db/api-token-repo.d.ts +24 -0
- package/dist/db/api-token-repo.d.ts.map +1 -1
- package/dist/db/auth-repo.d.ts +30 -0
- package/dist/db/auth-repo.d.ts.map +1 -1
- package/dist/db/credential-cipher.d.ts +8 -3
- package/dist/db/credential-cipher.d.ts.map +1 -1
- package/dist/db/database.d.ts +19 -1
- package/dist/db/database.d.ts.map +1 -1
- package/dist/db/external-write-log-repo.d.ts +6 -1
- package/dist/db/external-write-log-repo.d.ts.map +1 -1
- package/dist/db/future-execution-repo.d.ts +47 -0
- package/dist/db/future-execution-repo.d.ts.map +1 -1
- package/dist/db/launch-run-repo.d.ts +17 -0
- package/dist/db/launch-run-repo.d.ts.map +1 -1
- package/dist/db/launcher-recent-value-repo.d.ts +15 -0
- package/dist/db/launcher-recent-value-repo.d.ts.map +1 -1
- package/dist/db/pending-external-source-fire-repo.d.ts +33 -0
- package/dist/db/pending-external-source-fire-repo.d.ts.map +1 -1
- package/dist/db/process-event-repo.d.ts +17 -0
- package/dist/db/process-event-repo.d.ts.map +1 -1
- package/dist/db/process-handoff-dedup-key-repo.d.ts +8 -0
- package/dist/db/process-handoff-dedup-key-repo.d.ts.map +1 -1
- package/dist/db/process-input-repo.d.ts +15 -0
- package/dist/db/process-input-repo.d.ts.map +1 -1
- package/dist/db/process-instance-repo.d.ts +49 -0
- package/dist/db/process-instance-repo.d.ts.map +1 -1
- package/dist/db/process-leaf-outcome-snapshot-repo.d.ts +18 -0
- package/dist/db/process-leaf-outcome-snapshot-repo.d.ts.map +1 -1
- package/dist/db/process-project-repo.d.ts +20 -0
- package/dist/db/process-project-repo.d.ts.map +1 -1
- package/dist/db/process-question-request-repo.d.ts +19 -0
- package/dist/db/process-question-request-repo.d.ts.map +1 -1
- package/dist/db/process-relation-repo.d.ts +5 -0
- package/dist/db/process-relation-repo.d.ts.map +1 -1
- package/dist/db/process-skill-repo.d.ts +4 -0
- package/dist/db/process-skill-repo.d.ts.map +1 -1
- package/dist/db/process-title-job-repo.d.ts +22 -0
- package/dist/db/process-title-job-repo.d.ts.map +1 -1
- package/dist/db/process-tool-approval-request-repo.d.ts +20 -0
- package/dist/db/process-tool-approval-request-repo.d.ts.map +1 -1
- package/dist/db/process-turn-annotation-repo.d.ts +22 -2
- package/dist/db/process-turn-annotation-repo.d.ts.map +1 -1
- package/dist/db/process-turn-record-repo.d.ts +27 -0
- package/dist/db/process-turn-record-repo.d.ts.map +1 -1
- package/dist/db/provider-credential-repo.d.ts +16 -0
- package/dist/db/provider-credential-repo.d.ts.map +1 -1
- package/dist/db/repositories.d.ts +33 -0
- package/dist/db/repositories.d.ts.map +1 -1
- package/dist/db/session-transfer-repo.d.ts +49 -1
- package/dist/db/session-transfer-repo.d.ts.map +1 -1
- package/dist/db/skill-repo.d.ts +20 -0
- package/dist/db/skill-repo.d.ts.map +1 -1
- package/dist/db/startup-observation-repo.d.ts +3 -0
- package/dist/db/startup-observation-repo.d.ts.map +1 -1
- package/dist/db/ticket-destination-recent-repo.d.ts +14 -0
- package/dist/db/ticket-destination-recent-repo.d.ts.map +1 -1
- package/dist/db/turn-start-record-repo.d.ts +9 -0
- package/dist/db/turn-start-record-repo.d.ts.map +1 -1
- package/dist/db/turn-summary-repo.d.ts +18 -0
- package/dist/db/turn-summary-repo.d.ts.map +1 -1
- package/dist/db/worker-lease-repo.d.ts +31 -1
- package/dist/db/worker-lease-repo.d.ts.map +1 -1
- package/dist/effects/post-commit-effect.d.ts +29 -0
- package/dist/effects/post-commit-effect.d.ts.map +1 -1
- package/dist/effects/post-commit-runner.d.ts +1 -0
- package/dist/effects/post-commit-runner.d.ts.map +1 -1
- package/dist/entry-ref-patch.d.ts +3 -0
- package/dist/entry-ref-patch.d.ts.map +1 -1
- package/dist/extension-ui/catalog.d.ts +15 -0
- package/dist/extension-ui/catalog.d.ts.map +1 -1
- package/dist/extensions/extension-host.d.ts +6 -0
- package/dist/extensions/extension-host.d.ts.map +1 -1
- package/dist/external-source-service.d.ts +8 -0
- package/dist/external-source-service.d.ts.map +1 -1
- package/dist/future-execution/execution.d.ts +23 -1
- package/dist/future-execution/execution.d.ts.map +1 -1
- package/dist/future-execution/launch-lifecycle.d.ts +76 -0
- package/dist/future-execution/launch-lifecycle.d.ts.map +1 -1
- package/dist/future-execution/lifecycle.d.ts +99 -0
- package/dist/future-execution/lifecycle.d.ts.map +1 -1
- package/dist/future-execution/model-projection.d.ts +6 -0
- package/dist/future-execution/model-projection.d.ts.map +1 -1
- package/dist/future-execution/transition-planner.d.ts +25 -0
- package/dist/future-execution/transition-planner.d.ts.map +1 -1
- package/dist/future-execution-scheduler.d.ts +1 -1
- package/dist/future-execution-scheduler.d.ts.map +1 -1
- package/dist/index.d.ts +3 -30
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -239
- package/dist/index.js.map +1 -1
- package/dist/instance-tree.d.ts +3 -0
- package/dist/instance-tree.d.ts.map +1 -1
- package/dist/integration-tool-registry.d.ts +4 -1
- package/dist/integration-tool-registry.d.ts.map +1 -1
- package/dist/launch-coordinator.d.ts +33 -0
- package/dist/launch-coordinator.d.ts.map +1 -1
- package/dist/launch-pipeline.d.ts +60 -0
- package/dist/launch-pipeline.d.ts.map +1 -1
- package/dist/launcher-recent-values-service.d.ts +3 -0
- package/dist/launcher-recent-values-service.d.ts.map +1 -1
- package/dist/main.js +7 -14
- package/dist/main.js.map +1 -1
- package/dist/model-providers/builtin-server-adapter.d.ts +1 -0
- package/dist/model-providers/builtin-server-adapter.d.ts.map +1 -1
- package/dist/model-providers/credentials.d.ts +17 -0
- package/dist/model-providers/credentials.d.ts.map +1 -1
- package/dist/model-providers/model-status-cache.d.ts +30 -1
- package/dist/model-providers/model-status-cache.d.ts.map +1 -1
- package/dist/model-providers/provider-options.d.ts +21 -1
- package/dist/model-providers/provider-options.d.ts.map +1 -1
- package/dist/model-providers/registry.d.ts +22 -2
- package/dist/model-providers/registry.d.ts.map +1 -1
- package/dist/model-providers/server-adapters.d.ts +19 -0
- package/dist/model-providers/server-adapters.d.ts.map +1 -1
- package/dist/pi-resources/assemble.d.ts +24 -4
- package/dist/pi-resources/assemble.d.ts.map +1 -1
- package/dist/pi-resources/bundle-cache.d.ts +20 -1
- package/dist/pi-resources/bundle-cache.d.ts.map +1 -1
- package/dist/pi-resources/bundle-pin-lifecycle.d.ts +5 -1
- package/dist/pi-resources/bundle-pin-lifecycle.d.ts.map +1 -1
- package/dist/pi-resources/resource-collector.d.ts +11 -0
- package/dist/pi-resources/resource-collector.d.ts.map +1 -1
- package/dist/pi-session-tree.d.ts +13 -1
- package/dist/pi-session-tree.d.ts.map +1 -1
- package/dist/process-action-registry.d.ts +47 -0
- package/dist/process-action-registry.d.ts.map +1 -1
- package/dist/process-deletion-service.d.ts +12 -0
- package/dist/process-deletion-service.d.ts.map +1 -1
- package/dist/process-engine/decision.d.ts +12 -0
- package/dist/process-engine/decision.d.ts.map +1 -1
- package/dist/process-engine/engine.d.ts +1 -0
- package/dist/process-engine/engine.d.ts.map +1 -1
- package/dist/process-engine/operation.d.ts +23 -2
- package/dist/process-engine/operation.d.ts.map +1 -1
- package/dist/process-engine/startup-reconciliation.d.ts +14 -0
- package/dist/process-engine/startup-reconciliation.d.ts.map +1 -1
- package/dist/process-engine/types.d.ts +112 -1
- package/dist/process-engine/types.d.ts.map +1 -1
- package/dist/process-engine/writes/build-process-park-writes.d.ts +3 -0
- package/dist/process-engine/writes/build-process-park-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-recovery-start-writes.d.ts +4 -0
- package/dist/process-engine/writes/build-recovery-start-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-retry-writes.d.ts +3 -0
- package/dist/process-engine/writes/build-retry-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-turn-failed-writes.d.ts +6 -0
- package/dist/process-engine/writes/build-turn-failed-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-turn-outcome-writes.d.ts +8 -0
- package/dist/process-engine/writes/build-turn-outcome-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-turn-selection-writes.d.ts +8 -0
- package/dist/process-engine/writes/build-turn-selection-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/commit-writes.d.ts +14 -0
- package/dist/process-engine/writes/commit-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/deferred-extension-events.d.ts +4 -0
- package/dist/process-engine/writes/deferred-extension-events.d.ts.map +1 -1
- package/dist/process-engine/writes/writes.d.ts +67 -0
- package/dist/process-engine/writes/writes.d.ts.map +1 -1
- package/dist/process-graph.d.ts +1 -1
- package/dist/process-graph.d.ts.map +1 -1
- package/dist/process-input-dispatch.d.ts +1 -0
- package/dist/process-input-dispatch.d.ts.map +1 -1
- package/dist/process-launch-executor.d.ts +1 -0
- package/dist/process-launch-executor.d.ts.map +1 -1
- package/dist/process-model-policy/types.d.ts +157 -1
- package/dist/process-model-policy/types.d.ts.map +1 -1
- package/dist/process-operation-coordinator.d.ts +3 -0
- package/dist/process-operation-coordinator.d.ts.map +1 -1
- package/dist/process-question-service.d.ts +36 -20
- package/dist/process-question-service.d.ts.map +1 -1
- package/dist/process-runtime-availability.d.ts +2 -1
- package/dist/process-runtime-availability.d.ts.map +1 -1
- package/dist/process-session-store.d.ts +15 -4
- package/dist/process-session-store.d.ts.map +1 -1
- package/dist/process-title-generator.d.ts +53 -0
- package/dist/process-title-generator.d.ts.map +1 -1
- package/dist/process-turn-navigation.d.ts +1 -30
- package/dist/process-turn-navigation.d.ts.map +1 -1
- package/dist/process-turn-trace.d.ts +7 -0
- package/dist/process-turn-trace.d.ts.map +1 -1
- package/dist/process-ui-registry.d.ts +2 -0
- package/dist/process-ui-registry.d.ts.map +1 -1
- package/dist/process-ui-snapshot-presenter.d.ts +68 -1
- package/dist/process-ui-snapshot-presenter.d.ts.map +1 -1
- package/dist/process-watcher-registry.d.ts +5 -0
- package/dist/process-watcher-registry.d.ts.map +1 -1
- package/dist/product-ref-state.d.ts +1 -0
- package/dist/product-ref-state.d.ts.map +1 -1
- package/dist/project-mutation-service.d.ts +19 -0
- package/dist/project-mutation-service.d.ts.map +1 -1
- package/dist/result-image-store.d.ts +20 -0
- package/dist/result-image-store.d.ts.map +1 -1
- package/dist/routes/process-route-helpers.d.ts +30 -0
- package/dist/routes/process-route-helpers.d.ts.map +1 -1
- package/dist/routes/ui-renderers.d.ts +4 -0
- package/dist/routes/ui-renderers.d.ts.map +1 -1
- package/dist/routes/watchers.d.ts +3 -0
- package/dist/routes/watchers.d.ts.map +1 -1
- package/dist/semantic-entry-ref-state.d.ts +1 -0
- package/dist/semantic-entry-ref-state.d.ts.map +1 -1
- package/dist/server-bootstrap/app-lifecycle.d.ts +24 -0
- package/dist/server-bootstrap/app-lifecycle.d.ts.map +1 -0
- package/dist/server-bootstrap/build-host-capabilities.d.ts +5 -1
- package/dist/server-bootstrap/build-host-capabilities.d.ts.map +1 -1
- package/dist/server-topology.d.ts +8 -1
- package/dist/server-topology.d.ts.map +1 -1
- package/dist/session-transfer-helper-relays.d.ts +24 -0
- package/dist/session-transfer-helper-relays.d.ts.map +1 -1
- package/dist/session-transfer-service.d.ts +63 -1
- package/dist/session-transfer-service.d.ts.map +1 -1
- package/dist/skills/catalog-service.d.ts +7 -0
- package/dist/skills/catalog-service.d.ts.map +1 -1
- package/dist/skills/source-importer.d.ts +8 -0
- package/dist/skills/source-importer.d.ts.map +1 -1
- package/dist/startup-evidence.d.ts.map +1 -1
- package/dist/supervisor/ipc-handler.d.ts +28 -0
- package/dist/supervisor/ipc-handler.d.ts.map +1 -1
- package/dist/supervisor/worker-event-ingestor.d.ts +10 -0
- package/dist/supervisor/worker-event-ingestor.d.ts.map +1 -1
- package/dist/supervisor/worker-start-payload-builder.d.ts +13 -0
- package/dist/supervisor/worker-start-payload-builder.d.ts.map +1 -1
- package/dist/supervisor/worker-storage-layout.d.ts +12 -0
- package/dist/supervisor/worker-storage-layout.d.ts.map +1 -1
- package/dist/supervisor/worker-supervisor.d.ts +47 -3
- package/dist/supervisor/worker-supervisor.d.ts.map +1 -1
- package/dist/supervisor/worker-turn-ipc-recorder.d.ts +19 -0
- package/dist/supervisor/worker-turn-ipc-recorder.d.ts.map +1 -1
- package/dist/supervisor/worker-unit-reclaimer.d.ts +3 -0
- package/dist/supervisor/worker-unit-reclaimer.d.ts.map +1 -1
- package/dist/supervisor/worker-websocket-ipc.d.ts +37 -0
- package/dist/supervisor/worker-websocket-ipc.d.ts.map +1 -1
- package/dist/test-helpers/accepted-turn-start.d.ts +22 -0
- package/dist/test-helpers/accepted-turn-start.d.ts.map +1 -1
- package/dist/test-helpers/prepared-fixture-start.d.ts +14 -0
- package/dist/test-helpers/prepared-fixture-start.d.ts.map +1 -0
- package/dist/test-helpers/session-snapshot-fixtures.d.ts +1 -1
- package/dist/test-helpers/session-snapshot-fixtures.d.ts.map +1 -1
- package/dist/test-helpers/turn-start-preflight-fixtures.d.ts +8 -1
- package/dist/test-helpers/turn-start-preflight-fixtures.d.ts.map +1 -1
- package/dist/test-helpers/unit-deps.d.ts +8 -0
- package/dist/test-helpers/unit-deps.d.ts.map +1 -1
- package/dist/testing.d.ts +5 -7
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +60 -53
- package/dist/testing.js.map +1 -1
- package/dist/tool-approval-gate.d.ts +21 -0
- package/dist/tool-approval-gate.d.ts.map +1 -1
- package/dist/turn-result-markdown.d.ts +2 -0
- package/dist/turn-result-markdown.d.ts.map +1 -1
- package/dist/worker-runtime-profile-selection.d.ts +20 -4
- package/dist/worker-runtime-profile-selection.d.ts.map +1 -1
- package/dist/ws/broadcast.d.ts +10 -0
- package/dist/ws/broadcast.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/app.ts +916 -892
- package/src/config/config-loader.ts +12 -0
- package/src/config/config-types.ts +166 -66
- package/src/db/api-token-repo.ts +35 -2
- package/src/db/auth-repo.ts +35 -1
- package/src/db/credential-cipher.ts +8 -3
- package/src/db/database.ts +14 -0
- package/src/db/external-write-log-repo.ts +6 -1
- package/src/db/future-execution-repo.ts +51 -1
- package/src/db/launch-run-repo.ts +17 -0
- package/src/db/launcher-recent-value-repo.ts +15 -0
- package/src/db/pending-external-source-fire-repo.ts +33 -0
- package/src/db/process-event-repo.ts +21 -1
- package/src/db/process-handoff-dedup-key-repo.ts +8 -0
- package/src/db/process-input-repo.ts +15 -0
- package/src/db/process-instance-repo.ts +57 -2
- package/src/db/process-leaf-outcome-snapshot-repo.ts +18 -0
- package/src/db/process-project-repo.ts +20 -0
- package/src/db/process-question-request-repo.ts +19 -0
- package/src/db/process-relation-repo.ts +8 -1
- package/src/db/process-skill-repo.ts +4 -0
- package/src/db/process-title-job-repo.ts +30 -2
- package/src/db/process-tool-approval-request-repo.ts +24 -1
- package/src/db/process-turn-annotation-repo.ts +22 -2
- package/src/db/process-turn-record-repo.ts +27 -0
- package/src/db/provider-credential-repo.ts +20 -1
- package/src/db/repositories.ts +36 -1
- package/src/db/session-transfer-repo.ts +71 -9
- package/src/db/skill-repo.ts +24 -1
- package/src/db/startup-observation-repo.ts +3 -0
- package/src/db/ticket-destination-recent-repo.ts +14 -0
- package/src/db/turn-start-record-repo.ts +12 -1
- package/src/db/turn-summary-repo.ts +29 -2
- package/src/db/worker-lease-repo.ts +31 -1
- package/src/deployment-preflight.ts +1 -1
- package/src/effects/post-commit-effect.ts +42 -3
- package/src/effects/post-commit-runner.ts +1 -0
- package/src/entry-ref-patch.ts +9 -1
- package/src/extension-ui/catalog.ts +15 -0
- package/src/extensions/extension-host.ts +6 -0
- package/src/external-source-service.ts +12 -1
- package/src/future-execution/execution.ts +45 -8
- package/src/future-execution/launch-lifecycle.ts +145 -17
- package/src/future-execution/lifecycle.ts +124 -13
- package/src/future-execution/model-projection.ts +6 -0
- package/src/future-execution/transition-planner.ts +25 -0
- package/src/future-execution-scheduler.ts +7 -6
- package/src/index.ts +5 -153
- package/src/instance-tree.ts +3 -0
- package/src/integration-tool-registry.ts +17 -8
- package/src/launch-coordinator.ts +55 -5
- package/src/launch-pipeline.ts +103 -12
- package/src/launcher-recent-values-service.ts +3 -0
- package/src/main.ts +3 -10
- package/src/model-providers/builtin-server-adapter.ts +1 -0
- package/src/model-providers/credentials.ts +17 -0
- package/src/model-providers/model-status-cache.ts +30 -1
- package/src/model-providers/provider-options.ts +25 -2
- package/src/model-providers/registry.ts +22 -2
- package/src/model-providers/server-adapters.ts +19 -0
- package/src/pi-resources/assemble.ts +24 -4
- package/src/pi-resources/bundle-cache.ts +20 -1
- package/src/pi-resources/bundle-pin-lifecycle.ts +8 -2
- package/src/pi-resources/resource-collector.ts +11 -0
- package/src/pi-session-tree.ts +13 -1
- package/src/process-action-registry.ts +53 -1
- package/src/process-deletion-service.ts +29 -4
- package/src/process-engine/decision.ts +12 -0
- package/src/process-engine/engine.ts +1 -0
- package/src/process-engine/operation.ts +23 -2
- package/src/process-engine/startup-reconciliation.ts +14 -0
- package/src/process-engine/types.ts +176 -14
- package/src/process-engine/writes/build-process-park-writes.ts +3 -0
- package/src/process-engine/writes/build-recovery-start-writes.ts +4 -0
- package/src/process-engine/writes/build-retry-writes.ts +3 -0
- package/src/process-engine/writes/build-turn-failed-writes.ts +6 -0
- package/src/process-engine/writes/build-turn-outcome-writes.ts +8 -0
- package/src/process-engine/writes/build-turn-selection-writes.ts +8 -0
- package/src/process-engine/writes/commit-writes.ts +14 -0
- package/src/process-engine/writes/deferred-extension-events.ts +4 -0
- package/src/process-engine/writes/writes.ts +104 -10
- package/src/process-graph.ts +0 -3
- package/src/process-input-dispatch.ts +1 -0
- package/src/process-launch-executor.ts +1 -0
- package/src/process-model-policy/types.ts +195 -11
- package/src/process-operation-coordinator.ts +3 -0
- package/src/process-question-service.ts +53 -11
- package/src/process-runtime-availability.ts +4 -3
- package/src/process-session-store.ts +15 -4
- package/src/process-title-generator.ts +71 -5
- package/src/process-turn-navigation.ts +4 -1
- package/src/process-turn-trace.ts +7 -0
- package/src/process-ui-registry.ts +2 -0
- package/src/process-ui-snapshot-presenter.ts +75 -3
- package/src/process-watcher-registry.ts +5 -0
- package/src/product-ref-state.ts +1 -0
- package/src/project-mutation-service.ts +22 -1
- package/src/result-image-store.ts +27 -2
- package/src/routes/process-route-helpers.ts +30 -0
- package/src/routes/ui-renderers.ts +4 -0
- package/src/routes/watchers.ts +3 -0
- package/src/semantic-entry-ref-state.ts +1 -0
- package/src/server-bootstrap/app-lifecycle.ts +150 -0
- package/src/server-topology.ts +8 -1
- package/src/session-transfer-helper-relays.ts +33 -2
- package/src/session-transfer-service.ts +75 -7
- package/src/skills/catalog-service.ts +7 -0
- package/src/skills/source-importer.ts +8 -0
- package/src/startup-evidence.ts +23 -41
- package/src/supervisor/ipc-handler.ts +33 -1
- package/src/supervisor/worker-event-ingestor.ts +10 -0
- package/src/supervisor/worker-start-payload-builder.ts +16 -1
- package/src/supervisor/worker-storage-layout.ts +12 -0
- package/src/supervisor/worker-supervisor.ts +119 -133
- package/src/supervisor/worker-turn-ipc-recorder.ts +19 -0
- package/src/supervisor/worker-unit-reclaimer.ts +3 -0
- package/src/supervisor/worker-websocket-ipc.ts +57 -3
- package/src/test-helpers/accepted-turn-start.ts +32 -3
- package/src/test-helpers/prepared-fixture-start.ts +74 -0
- package/src/test-helpers/session-snapshot-fixtures.ts +1 -1
- package/src/test-helpers/turn-start-preflight-fixtures.ts +8 -1
- package/src/test-helpers/unit-deps.ts +13 -1
- package/src/testing.ts +5 -23
- package/src/tool-approval-gate.ts +32 -3
- package/src/turn-result-markdown.ts +2 -0
- package/src/worker-runtime-profile-selection.ts +24 -5
- package/src/ws/broadcast.ts +20 -1
- package/dist/app-I4QQUL5B.js +0 -10
- package/dist/chunk-AGC2ND53.js.map +0 -1
- package/dist/chunk-XTXH6623.js.map +0 -1
- /package/dist/{app-I4QQUL5B.js.map → app-4QSV4FUQ.js.map} +0 -0
package/dist/testing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/test-helpers/accepted-turn-start.ts","../src/test-helpers/session-snapshot-fixtures.ts","../src/test-helpers/turn-start-preflight-fixtures.ts","../src/test-helpers/process-fixtures.ts","../src/test-helpers/unit-deps.ts"],"sourcesContent":["import type { AppContext } from \"../app.js\";\n\nexport function createAcceptedLlmTurn(\n\tctx: AppContext | null,\n\tinput: Parameters<AppContext[\"deps\"][\"turnRecords\"][\"create\"]>[0] & {\n\t\tid: string;\n\t\tturnType: \"llm\";\n\t},\n\toptions: Parameters<typeof createAcceptedLlmTurnStart>[3] & {\n\t\tcurrent?: boolean;\n\t\tworkerId?: string;\n\t} = {},\n) {\n\tif (!ctx) throw new Error(\"Server context not initialized\");\n\tconst current = options.current ?? input.status === \"running\";\n\tconst lease = ctx.deps.leases.create({\n\t\tinstanceId: input.instanceId,\n\t\tworkerId: options.workerId ?? `wkr_${input.id}`,\n\t\tstate: current ? (input.status === \"failed\" ? \"failed\" : \"busy\") : \"exited\",\n\t});\n\tconst start = createAcceptedLlmTurnStart(ctx, input, lease.id, options);\n\tconst record = ctx.deps.turnRecords.create({\n\t\t...input,\n\t\tturnStartRecordId: start.id,\n\t\tacceptedWorkerLeaseId: lease.id,\n\t});\n\tif (current) {\n\t\tctx.deps.processes.update(input.instanceId, {\n\t\t\tcurrentExecution: { kind: \"worker_start\", id: start.id },\n\t\t});\n\t} else {\n\t\tctx.deps.leases.update(lease.id, {\n\t\t\texitedAt: input.endedAt ?? input.startedAt ?? new Date().toISOString(),\n\t\t});\n\t}\n\treturn record;\n}\n\nexport function createAcceptedLlmTurnStart(\n\tctx: AppContext,\n\tinput: { id: string; instanceId: string; turnId: string },\n\tacceptedWorkerLeaseId: string,\n\toptions: {\n\t\tid?: string;\n\t\tmodel?: { profileId: string; providerId: string; modelId: string; thinkingLevel: \"off\" };\n\t\tpiResourceSnapshotDigest?: string;\n\t\tworkerRuntimeProfileId?: string;\n\t} = {},\n) {\n\treturn ctx.deps.turnStarts.create({\n\t\tid: options.id ?? `tsr_${input.id}`,\n\t\tinstanceId: input.instanceId,\n\t\tturnId: input.turnId,\n\t\tturnType: \"llm\",\n\t\tproposedTurnRecordId: input.id,\n\t\tstartKind: \"selected_turn\",\n\t\trecoveryTurnRecordId: null,\n\t\tcontinuation: null,\n\t\tstate: {\n\t\t\tkind: \"accepted\",\n\t\t\tstart: {\n\t\t\t\tkind: \"llm\",\n\t\t\t\tmodel: options.model ?? {\n\t\t\t\t\tprofileId: \"fixture-profile\",\n\t\t\t\t\tproviderId: \"fixture-provider\",\n\t\t\t\t\tmodelId: \"fixture-model\",\n\t\t\t\t\tthinkingLevel: \"off\",\n\t\t\t\t},\n\t\t\t\tproviderOptions: {},\n\t\t\t\tproviderWorkerConfig: null,\n\t\t\t\tpiResourceSnapshotDigest: options.piResourceSnapshotDigest ?? \"fixture-resource-digest\",\n\t\t\t\tworkerRuntimeProfileId: options.workerRuntimeProfileId ?? \"local\",\n\t\t\t\tpiSettings: {},\n\t\t\t},\n\t\t\tturnRecordId: input.id,\n\t\t\tacceptedWorkerLeaseId,\n\t\t},\n\t});\n}\n","import type { AppContext } from \"../app.js\";\nimport { createAllRepos } from \"../db/repositories.js\";\nimport { createFileBackedProcessSessionSnapshotStore } from \"../process-session-store.js\";\nimport { createProjectedSessionSnapshotStore } from \"../session-summary-projection.js\";\n\n/** Accept fixture snapshots through the same persisted projection as worker uploads. */\nexport async function writeProcessSessionSnapshot(\n\tctx: Pick<AppContext, \"db\" | \"config\">,\n\tinstanceId: string,\n\tentries: readonly unknown[],\n): Promise<void> {\n\tconst store = createProjectedSessionSnapshotStore(\n\t\tcreateFileBackedProcessSessionSnapshotStore(ctx.config.storage.tree_files_dir),\n\t\tcreateAllRepos(ctx.db),\n\t);\n\tawait store.writeSnapshot(\n\t\tinstanceId,\n\t\t`${entries.map((entry) => JSON.stringify(entry)).join(\"\\n\")}\\n`,\n\t);\n}\n","import type { ProcessEngineDeps } from \"../process-engine/types.js\";\n\nexport interface SuccessfulLlmTurnStartOptions {\n\tprofileId?: string;\n\tproviderId?: string;\n\tmodelId?: string;\n\tthinkingLevel?: string;\n\tpiResourceSnapshotDigest?: string;\n\tworkerRuntimeProfileId?: string;\n}\n\n/** Creates a preflight double that successfully prepares every new LLM turn start. */\nexport function prepareSuccessfulLlmTurnStarts(\n\toptions: SuccessfulLlmTurnStartOptions = {},\n): NonNullable<ProcessEngineDeps[\"prepareTurnStarts\"]> {\n\treturn async (_current, writes) => {\n\t\tlet prepared = false;\n\t\tfor (const write of writes.turnStartWrites) {\n\t\t\tif (write.kind !== \"create\" || write.input.turnType !== \"llm\") continue;\n\t\t\tprepared = true;\n\t\t\twrite.input.state = {\n\t\t\t\tkind: \"starting\",\n\t\t\t\tstart: {\n\t\t\t\t\tkind: \"llm\",\n\t\t\t\t\tmodel: {\n\t\t\t\t\t\tprofileId: options.profileId ?? \"fixture-profile\",\n\t\t\t\t\t\tproviderId: options.providerId ?? \"fixture-provider\",\n\t\t\t\t\t\tmodelId: options.modelId ?? \"fixture-model\",\n\t\t\t\t\t\tthinkingLevel: options.thinkingLevel ?? \"off\",\n\t\t\t\t\t},\n\t\t\t\t\tproviderOptions: {},\n\t\t\t\t\tproviderWorkerConfig: null,\n\t\t\t\t\tpiResourceSnapshotDigest: options.piResourceSnapshotDigest ?? \"fixture-resource-digest\",\n\t\t\t\t\tworkerRuntimeProfileId: options.workerRuntimeProfileId ?? \"local\",\n\t\t\t\t\tpiSettings: {},\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (prepared) {\n\t\t\twrites.processPatch.lifecycleStatus = \"active\";\n\t\t\twrites.workerIntent = { kind: \"restart_worker\" };\n\t\t}\n\t\treturn { ok: true };\n\t};\n}\n","import type { TurnId } from \"@leitwerk-dev/domain\";\nimport {\n\ttype AutomaticTurnDefinition,\n\tautomaticTurn,\n\tdefineProcess,\n\ttype ExtensionProcessDefinition,\n\temptyParamsCodec,\n\ttype HumanTurnDefinition,\n\thumanTurn,\n\ttype LlmTurnDefinition,\n\tllmTurn,\n\ttype TurnDefinition,\n} from \"@leitwerk-dev/process-sdk\";\n\nexport function createFixtureLlmTurn(\n\tdescription: string,\n\toverrides: Partial<LlmTurnDefinition<string, Record<string, never>, Record<string, never>>> = {},\n): LlmTurnDefinition<string, Record<string, never>, Record<string, never>> {\n\treturn llmTurn({\n\t\tavailableTools: [],\n\t\tdescription,\n\t\tbranchType: \"primary\",\n\t\tcontext: \"fresh\",\n\t\tprompt: async () => description,\n\t\tturnEnd: { outcome: \"done\", params: {}, complete: true },\n\t\t...overrides,\n\t});\n}\n\nexport function createFixtureHumanTurn(\n\toverrides: Partial<HumanTurnDefinition<Record<string, never>, Record<string, never>>> = {},\n): HumanTurnDefinition<Record<string, never>, Record<string, never>> {\n\treturn humanTurn({\n\t\tdescription: \"Review\",\n\t\treviewSemanticRef: \"plan\",\n\t\tactions: {\n\t\t\tmark_done: {\n\t\t\t\tlabel: \"Mark done\",\n\t\t\t\tacceptanceState: \"accepted\",\n\t\t\t\tcomplete: true,\n\t\t\t},\n\t\t},\n\t\t...overrides,\n\t});\n}\n\nexport function createFixtureAutomaticTurn(\n\tdescription = \"Automatic turn\",\n): AutomaticTurnDefinition<\"done\", Record<string, never>, Record<string, never>> {\n\treturn automaticTurn<Record<string, never>, Record<string, never>, \"done\">({\n\t\tdescription,\n\t\trun: async () => ({ outcome: \"done\", params: {} }),\n\t\tturnEnd: { outcome: \"done\", params: {}, complete: true },\n\t});\n}\n\nfunction ensureFixtureTurnIsValid(\n\tdefinition: TurnDefinition<Record<string, never>, Record<string, never>>,\n): TurnDefinition<Record<string, never>, Record<string, never>> {\n\tif (definition.kind === \"human\" && Object.keys(definition.actions).length === 0) {\n\t\treturn {\n\t\t\t...definition,\n\t\t\tactions: {\n\t\t\t\t__fixture_noop: { label: \"No-op\", acceptanceState: \"neutral\", complete: true },\n\t\t\t},\n\t\t};\n\t}\n\tif (\n\t\t(definition.kind === \"llm\" || definition.kind === \"automatic\") &&\n\t\tObject.keys(definition.outcomes ?? {}).length === 0 &&\n\t\t!definition.turnEnd\n\t) {\n\t\treturn {\n\t\t\t...definition,\n\t\t\tturnEnd: { outcome: \"done\", params: {}, complete: true },\n\t\t} as TurnDefinition<Record<string, never>, Record<string, never>>;\n\t}\n\treturn definition;\n}\n\nexport function createFixtureProcess(input: {\n\tid: string;\n\tentry: TurnId;\n\talternateEntries?: readonly TurnId[];\n\tturns?: Record<string, TurnDefinition<Record<string, never>, Record<string, never>>>;\n}): ExtensionProcessDefinition<Record<string, never>, Record<string, never>> {\n\tconst turns = input.turns ?? {};\n\tconst entries = [input.entry, ...(input.alternateEntries ?? [])];\n\treturn defineProcess<Record<string, never>, Record<string, never>>({\n\t\tid: input.id,\n\t\tdisplayName: input.id,\n\t\tentry: input.entry,\n\t\t...(input.alternateEntries ? { alternateEntries: input.alternateEntries } : {}),\n\t\tparamsCodec: emptyParamsCodec,\n\t\tstateCodec: emptyParamsCodec,\n\t\tinitialState: () => ({}),\n\t\tturns:\n\t\t\tObject.keys(turns).length > 0\n\t\t\t\t? Object.fromEntries(\n\t\t\t\t\t\tObject.entries(turns).map(([turnId, definition]) => [\n\t\t\t\t\t\t\tturnId,\n\t\t\t\t\t\t\tensureFixtureTurnIsValid(definition),\n\t\t\t\t\t\t]),\n\t\t\t\t\t)\n\t\t\t\t: Object.fromEntries(entries.map((turnId) => [turnId, createFixtureLlmTurn(turnId)])),\n\t});\n}\n\nexport function createProcessGraphRegistry(\n\tprocesses: readonly ExtensionProcessDefinition<unknown, unknown>[],\n): ReadonlyMap<string, ExtensionProcessDefinition<unknown, unknown>> {\n\treturn new Map(\n\t\tprocesses.map(\n\t\t\t(process) => [process.id, process as ExtensionProcessDefinition<unknown, unknown>] as const,\n\t\t),\n\t);\n}\n\nexport function createTurnOwnershipFixtureProcess(\n\tid = \"turn_ownership_process\",\n): ExtensionProcessDefinition<Record<string, never>, Record<string, never>> {\n\treturn createFixtureProcess({\n\t\tid,\n\t\tentry: \"llm_turn\",\n\t\tturns: {\n\t\t\tllm_turn: createFixtureLlmTurn(\"LLM turn\"),\n\t\t\tautomatic_turn: createFixtureAutomaticTurn(),\n\t\t\thuman_turn: createFixtureHumanTurn(),\n\t\t},\n\t});\n}\n\nexport function createDefaultTestProcessGraphRegistry(): ReadonlyMap<\n\tstring,\n\tExtensionProcessDefinition<unknown, unknown>\n> {\n\tconst ticket = createFixtureProcess({\n\t\tid: \"ticket_issue_process\",\n\t\tentry: \"generate_plan\",\n\t\tturns: {\n\t\t\tgenerate_plan: createFixtureLlmTurn(\"generate_plan\", {\n\t\t\t\tresultSemanticRef: \"plan\",\n\t\t\t\tturnEnd: undefined,\n\t\t\t\toutcomes: { plan_saved: { description: \"plan_saved\", parameters: {}, to: \"plan_review\" } },\n\t\t\t}),\n\t\t\tplan_review: createFixtureHumanTurn({\n\t\t\t\treviewSemanticRef: \"plan\",\n\t\t\t\tactions: {\n\t\t\t\t\trevision_requested: {\n\t\t\t\t\t\tlabel: \"Request revision\",\n\t\t\t\t\t\tacceptanceState: \"requires_changes\",\n\t\t\t\t\t\tto: \"generate_plan\",\n\t\t\t\t\t},\n\t\t\t\t\tplan_approved: {\n\t\t\t\t\t\tlabel: \"Approve plan\",\n\t\t\t\t\t\tacceptanceState: \"accepted\",\n\t\t\t\t\t\tto: \"implement\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}),\n\t\t\timplement: createFixtureLlmTurn(\"implement\", {\n\t\t\t\tturnEnd: { outcome: \"done\", params: {}, to: \"handoff_review\" },\n\t\t\t}),\n\t\t\thandoff_review: createFixtureLlmTurn(\"handoff_review\", {\n\t\t\t\tturnEnd: { outcome: \"created\", params: {}, to: \"run_llm_review\" },\n\t\t\t}),\n\t\t\trun_llm_review: createFixtureLlmTurn(\"run_llm_review\", {\n\t\t\t\tresultSemanticRef: \"review\",\n\t\t\t\tturnEnd: undefined,\n\t\t\t\toutcomes: {\n\t\t\t\t\tissues_found: { description: \"issues_found\", parameters: {}, to: \"address_review\" },\n\t\t\t\t\tno_issues: { description: \"no_issues\", parameters: {}, to: \"implementation_review\" },\n\t\t\t\t},\n\t\t\t}),\n\t\t\taddress_review: createFixtureLlmTurn(\"address_review\", {\n\t\t\t\tturnEnd: { outcome: \"comments_addressed\", params: {}, to: \"verify_build\" },\n\t\t\t}),\n\t\t\tverify_build: createFixtureLlmTurn(\"verify_build\", {\n\t\t\t\tturnEnd: undefined,\n\t\t\t\toutcomes: {\n\t\t\t\t\tbuild_failing: { description: \"build_failing\", parameters: {}, to: \"fix_build\" },\n\t\t\t\t\tbuild_passing: {\n\t\t\t\t\t\tdescription: \"build_passing\",\n\t\t\t\t\t\tparameters: {},\n\t\t\t\t\t\tto: \"commit_and_complete\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}),\n\t\t\tfix_build: createFixtureLlmTurn(\"fix_build\", {\n\t\t\t\tturnEnd: { outcome: \"build_fixed\", params: {}, to: \"verify_build\" },\n\t\t\t}),\n\t\t\tcommit_and_complete: createFixtureLlmTurn(\"commit_and_complete\", {\n\t\t\t\tturnEnd: { outcome: \"committed\", params: {}, to: \"implementation_review\" },\n\t\t\t}),\n\t\t\timplementation_review: createFixtureHumanTurn({\n\t\t\t\treviewSemanticRef: \"review\",\n\t\t\t}),\n\t\t},\n\t});\n\tconst mrPolish = createFixtureProcess({\n\t\tid: \"mr_polish_process\",\n\t\tentry: \"address_review\",\n\t\tturns: {\n\t\t\taddress_review: createFixtureLlmTurn(\"address_review\", {\n\t\t\t\tturnEnd: { outcome: \"comments_addressed\", params: {}, to: \"verify_build\" },\n\t\t\t}),\n\t\t\tverify_build: createFixtureLlmTurn(\"verify_build\", {\n\t\t\t\tturnEnd: undefined,\n\t\t\t\toutcomes: {\n\t\t\t\t\tbuild_failing: { description: \"build_failing\", parameters: {}, to: \"fix_build\" },\n\t\t\t\t\tbuild_passing: {\n\t\t\t\t\t\tdescription: \"build_passing\",\n\t\t\t\t\t\tparameters: {},\n\t\t\t\t\t\tto: \"commit_and_complete\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}),\n\t\t\tfix_build: createFixtureLlmTurn(\"fix_build\", {\n\t\t\t\tturnEnd: { outcome: \"build_fixed\", params: {}, to: \"verify_build\" },\n\t\t\t}),\n\t\t\tcommit_and_complete: createFixtureLlmTurn(\"commit_and_complete\", {\n\t\t\t\tturnEnd: { outcome: \"committed\", params: {}, to: \"mr_polish_review\" },\n\t\t\t}),\n\t\t\tmr_polish_review: createFixtureHumanTurn({\n\t\t\t\treviewSemanticRef: \"review\",\n\t\t\t}),\n\t\t},\n\t});\n\treturn createProcessGraphRegistry([\n\t\tticket as ExtensionProcessDefinition<unknown, unknown>,\n\t\tmrPolish as ExtensionProcessDefinition<unknown, unknown>,\n\t]);\n}\n","import type { ProcessLaunchPlanServiceLike } from \"@leitwerk-dev/process-sdk\";\nimport { getDefaultConfig } from \"../config/config-loader.js\";\nimport { createDatabase, createInMemoryDatabase, type LeitwerkDb } from \"../db/database.js\";\nimport { createAllRepos, type RepositoryBundle } from \"../db/repositories.js\";\nimport type { ModelStatusCacheSnapshot } from \"../model-providers/model-status-cache.js\";\nimport {\n\tcreateServerProcessModelPolicy,\n\ttype ServerProcessModelPolicy,\n} from \"../process-model-policy/index.js\";\nimport { type Broadcaster, createBroadcaster } from \"../ws/broadcast.js\";\nimport { createDefaultTestProcessGraphRegistry } from \"./process-fixtures.js\";\n\nexport interface TestDeps extends RepositoryBundle {\n\tdb: LeitwerkDb;\n\tbroadcaster: Broadcaster;\n\tprocessModelPolicy: ServerProcessModelPolicy;\n\tlaunchPlans: ProcessLaunchPlanServiceLike;\n\tgetModelAvailabilitySnapshot: () => ModelStatusCacheSnapshot;\n}\n\n/** Select a turn-start fixture without creating a turn record or attempt. */\nexport function createSelectedTurnStart(\n\tdeps: TestDeps,\n\tinput: Omit<\n\t\tParameters<TestDeps[\"turnStarts\"][\"create\"]>[0],\n\t\t\"startKind\" | \"recoveryTurnRecordId\" | \"continuation\"\n\t>,\n) {\n\tconst record = deps.turnStarts.create({\n\t\t...input,\n\t\tstartKind: \"selected_turn\",\n\t\trecoveryTurnRecordId: null,\n\t\tcontinuation: null,\n\t});\n\tdeps.processes.update(input.instanceId, {\n\t\tcurrentExecution: { kind: \"worker_start\", id: record.id },\n\t});\n\treturn record;\n}\n\nexport function createTestDeps(options: { sqlitePath?: string } = {}): TestDeps {\n\tconst db = options.sqlitePath\n\t\t? createDatabase({ sqlitePath: options.sqlitePath, enableWAL: false })\n\t\t: createInMemoryDatabase();\n\tconst repos = createAllRepos(db);\n\tconst config = getDefaultConfig();\n\tconst processModelPolicy = createServerProcessModelPolicy({\n\t\tconfig,\n\t\tprocessGraphs: createDefaultTestProcessGraphRegistry(),\n\t\tprocessActionRegistry: { getTurnDefinition: () => undefined },\n\t});\n\tconst launchPlans: ProcessLaunchPlanServiceLike = {\n\t\tasync prepare(launchPlan, opts = {}) {\n\t\t\treturn processModelPolicy.prepareLaunchPlan(launchPlan, opts);\n\t\t},\n\t};\n\tconst getModelAvailabilitySnapshot = (): ModelStatusCacheSnapshot => ({\n\t\trevision: 1,\n\t\tcapturedAt: new Date().toISOString(),\n\t\tavailabilityTransitions: [],\n\t\tprofiles: config.pi.model_profiles.map((profile) => ({\n\t\t\tprofileId: profile.id,\n\t\t\tproviderId: profile.provider,\n\t\t\tmodelId: profile.model_id,\n\t\t\tavailability: \"available\",\n\t\t\tcheckedAt: new Date().toISOString(),\n\t\t\texpiresAt: new Date(Date.now() + 60_000).toISOString(),\n\t\t})),\n\t});\n\tconst createTurnRecord = repos.turnRecords.create.bind(repos.turnRecords);\n\trepos.turnRecords.create = (input) => {\n\t\tconst turnType = input.turnType ?? \"llm\";\n\t\tif (\n\t\t\t(turnType === \"llm\" || turnType === \"automatic\") &&\n\t\t\t(!input.turnStartRecordId || !input.acceptedWorkerLeaseId)\n\t\t) {\n\t\t\tconst turnRecordId = input.id ?? `trn_fixture_${crypto.randomUUID()}`;\n\t\t\tconst isCurrent =\n\t\t\t\tinput.status === \"running\" || input.status === \"failed\" || input.status === undefined;\n\t\t\tconst lease = repos.leases.create({\n\t\t\t\tinstanceId: input.instanceId,\n\t\t\t\tworkerId: `wkr_fixture_${turnRecordId}`,\n\t\t\t\tstate: input.status === \"failed\" ? \"failed\" : isCurrent ? \"busy\" : \"exited\",\n\t\t\t});\n\t\t\tconst start = repos.turnStarts.create({\n\t\t\t\tid: `tsr_fixture_${turnRecordId}`,\n\t\t\t\tinstanceId: input.instanceId,\n\t\t\t\tturnId: input.turnId,\n\t\t\t\tturnType,\n\t\t\t\tproposedTurnRecordId: turnRecordId,\n\t\t\t\tstartKind: \"selected_turn\",\n\t\t\t\trecoveryTurnRecordId: null,\n\t\t\t\tcontinuation: null,\n\t\t\t\tstate: {\n\t\t\t\t\tkind: \"accepted\",\n\t\t\t\t\tstart:\n\t\t\t\t\t\tturnType === \"automatic\"\n\t\t\t\t\t\t\t? { kind: \"automatic\" }\n\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\tkind: \"llm\",\n\t\t\t\t\t\t\t\t\tmodel: {\n\t\t\t\t\t\t\t\t\t\tprofileId: input.modelProfileId ?? \"fixture-model\",\n\t\t\t\t\t\t\t\t\t\tproviderId: \"fixture-provider\",\n\t\t\t\t\t\t\t\t\t\tmodelId: \"fixture-model\",\n\t\t\t\t\t\t\t\t\t\tthinkingLevel: \"low\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tproviderOptions: {},\n\t\t\t\t\t\t\t\t\tproviderWorkerConfig: null,\n\t\t\t\t\t\t\t\t\tpiResourceSnapshotDigest: \"fixture-resource-snapshot\",\n\t\t\t\t\t\t\t\t\tworkerRuntimeProfileId: \"local\",\n\t\t\t\t\t\t\t\t\tpiSettings: {},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\tturnRecordId,\n\t\t\t\t\tacceptedWorkerLeaseId: lease.id,\n\t\t\t\t},\n\t\t\t});\n\t\t\tconst record = createTurnRecord({\n\t\t\t\t...input,\n\t\t\t\tid: turnRecordId,\n\t\t\t\tturnStartRecordId: start.id,\n\t\t\t\tacceptedWorkerLeaseId: lease.id,\n\t\t\t});\n\t\t\tif (isCurrent) {\n\t\t\t\trepos.processes.update(record.instanceId, {\n\t\t\t\t\tcurrentExecution: { kind: \"worker_start\", id: start.id },\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\trepos.leases.update(lease.id, { exitedAt: record.endedAt ?? record.startedAt });\n\t\t\t}\n\t\t\treturn record;\n\t\t}\n\t\treturn createTurnRecord(input);\n\t};\n\treturn {\n\t\tdb,\n\t\t...repos,\n\t\tbroadcaster: createBroadcaster(),\n\t\tprocessModelPolicy,\n\t\tlaunchPlans,\n\t\tgetModelAvailabilitySnapshot,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEO,SAAS,sBACf,KACA,OAIA,UAGI,CAAC,GACJ;AACD,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,gCAAgC;AAC1D,QAAM,UAAU,QAAQ,WAAW,MAAM,WAAW;AACpD,QAAM,QAAQ,IAAI,KAAK,OAAO,OAAO;AAAA,IACpC,YAAY,MAAM;AAAA,IAClB,UAAU,QAAQ,YAAY,OAAO,MAAM,EAAE;AAAA,IAC7C,OAAO,UAAW,MAAM,WAAW,WAAW,WAAW,SAAU;AAAA,EACpE,CA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;AAAA,QAC9B;AAAA,MACD,CAAC;AACD,YAAM,SAAS,iBAAiB;AAAA,QAC/B,GAAG;AAAA,QACH,IAAI;AAAA,QACJ,mBAAmB,MAAM;AAAA,QACzB,uBAAuB,MAAM;AAAA,MAC9B,CAAC;AACD,UAAI,WAAW;AACd,cAAM,UAAU,OAAO,OAAO,YAAY;AAAA,UACzC,kBAAkB,EAAE,MAAM,gBAAgB,IAAI,MAAM,GAAG;AAAA,QACxD,CAAC;AAAA,MACF,OAAO;AACN,cAAM,OAAO,OAAO,MAAM,IAAI,EAAE,UAAU,OAAO,WAAW,OAAO,UAAU,CAAC;AAAA,MAC/E;AACA,aAAO;AAAA,IACR;AACA,WAAO,iBAAiB,KAAK;AAAA,EAC9B;AACA,SAAO;AAAA,IACN;AAAA,IACA,GAAG;AAAA,IACH,aAAa,kBAAkB;AAAA,IAC/B;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/test-helpers/accepted-turn-start.ts","../src/test-helpers/prepared-fixture-start.ts","../src/test-helpers/session-snapshot-fixtures.ts","../src/test-helpers/process-fixtures.ts","../src/test-helpers/unit-deps.ts"],"sourcesContent":["import type { ResolvedTurnStart } from \"@leitwerk-dev/domain\";\nimport type { AppContext } from \"../app.js\";\n\n/** @internal */\nexport function createAcceptedLlmTurn(\n\tctx: AppContext | null,\n\tinput: Parameters<AppContext[\"deps\"][\"turnRecords\"][\"create\"]>[0] & {\n\t\t/** @internal */\n\t\tid: string;\n\t\t/** @internal */\n\t\tturnType: \"llm\";\n\t},\n\toptions: Parameters<typeof createAcceptedLlmTurnStart>[3] & {\n\t\t/** @internal */\n\t\tcurrent?: boolean;\n\t\t/** @internal */\n\t\tworkerId?: string;\n\t} = {},\n) {\n\tif (!ctx) throw new Error(\"Server context not initialized\");\n\tconst current = options.current ?? input.status === \"running\";\n\tconst lease = ctx.deps.leases.create({\n\t\tinstanceId: input.instanceId,\n\t\tworkerId: options.workerId ?? `wkr_${input.id}`,\n\t\tstate: current ? (input.status === \"failed\" ? \"failed\" : \"busy\") : \"exited\",\n\t});\n\tconst start = createAcceptedLlmTurnStart(ctx, input, lease.id, options);\n\tconst record = ctx.deps.turnRecords.create({\n\t\t...input,\n\t\tturnStartRecordId: start.id,\n\t\tacceptedWorkerLeaseId: lease.id,\n\t});\n\tif (current) {\n\t\tctx.deps.processes.update(input.instanceId, {\n\t\t\tcurrentExecution: { kind: \"worker_start\", id: start.id },\n\t\t});\n\t} else {\n\t\tctx.deps.leases.update(lease.id, {\n\t\t\texitedAt: input.endedAt ?? input.startedAt ?? new Date().toISOString(),\n\t\t});\n\t}\n\treturn record;\n}\n\n/** @internal */\nexport function createAcceptedLlmTurnStart(\n\tctx: AppContext,\n\tinput: {\n\t\t/** @internal */\n\t\tid: string;\n\t\t/** @internal */\n\t\tinstanceId: string;\n\t\t/** @internal */\n\t\tturnId: string;\n\t},\n\tacceptedWorkerLeaseId: string,\n\toptions: {\n\t\t/** @internal */\n\t\tid?: string;\n\t\t/** @internal */\n\t\tpreparedStart?: Extract<ResolvedTurnStart, { kind: \"llm\" }>;\n\t\t/** @internal */\n\t\tmodel?: {\n\t\t\t/** @internal */\n\t\t\tprofileId: string;\n\t\t\t/** @internal */\n\t\t\tproviderId: string;\n\t\t\t/** @internal */\n\t\t\tmodelId: string;\n\t\t\t/** @internal */\n\t\t\tthinkingLevel: \"off\";\n\t\t};\n\t\t/** @internal */\n\t\tpiResourceSnapshotDigest?: string;\n\t\t/** @internal */\n\t\tworkerRuntimeProfileId?: string;\n\t} = {},\n) {\n\treturn ctx.deps.turnStarts.create({\n\t\tid: options.id ?? `tsr_${input.id}`,\n\t\tinstanceId: input.instanceId,\n\t\tturnId: input.turnId,\n\t\tturnType: \"llm\",\n\t\tproposedTurnRecordId: input.id,\n\t\tstartKind: \"selected_turn\",\n\t\trecoveryTurnRecordId: null,\n\t\tcontinuation: null,\n\t\tstate: {\n\t\t\tkind: \"accepted\",\n\t\t\tstart: options.preparedStart ?? {\n\t\t\t\tkind: \"llm\",\n\t\t\t\tmodel: options.model ?? {\n\t\t\t\t\tprofileId: \"fixture-profile\",\n\t\t\t\t\tproviderId: \"fixture-provider\",\n\t\t\t\t\tmodelId: \"fixture-model\",\n\t\t\t\t\tthinkingLevel: \"off\",\n\t\t\t\t},\n\t\t\t\tproviderOptions: {},\n\t\t\t\tproviderWorkerConfig: null,\n\t\t\t\tpiResourceSnapshotDigest: options.piResourceSnapshotDigest ?? \"fixture-resource-digest\",\n\t\t\t\tworkerRuntimeProfileId: options.workerRuntimeProfileId ?? \"local\",\n\t\t\t\tpiSettings: {},\n\t\t\t},\n\t\t\tturnRecordId: input.id,\n\t\t\tacceptedWorkerLeaseId,\n\t\t},\n\t});\n}\n","import type { ProcessInstance, ResolvedTurnStart } from \"@leitwerk-dev/domain\";\nimport type { ExtensionCatalog } from \"@leitwerk-dev/extension-runtime\";\nimport type { PiResourceBundle } from \"@leitwerk-dev/worker-protocol\";\nimport type { AppContext } from \"../app.js\";\nimport { createPiResourceBundleCache } from \"../pi-resources/index.js\";\nimport { prepareCreatedTurnStarts } from \"../process-engine/turn-start-preflight.js\";\nimport { createWrites, type TurnStartWrite } from \"../process-engine/writes/writes.js\";\n\n/** Prepare fixture resources through the same provider preflight as admitted work. @internal */\nexport async function prepareAcceptedFixtureStart(\n\tctx: AppContext,\n\tprocess: ProcessInstance,\n\tturnId: string,\n\tcontributions: ExtensionCatalog[\"piContributions\"],\n): Promise<{\n\t/** @internal */\n\tstart: Extract<ResolvedTurnStart, { kind: \"llm\" }>;\n\t/** @internal */\n\tbundle: PiResourceBundle;\n}> {\n\tconst profileId =\n\t\tprocess.selectedTurnModelProfileId ??\n\t\tprocess.defaultModelProfileId ??\n\t\tctx.config.process_configs?.[process.processId]?.default_model_profile;\n\tconst write: Extract<TurnStartWrite, { kind: \"create\" }> = {\n\t\tkind: \"create\",\n\t\tinput: {\n\t\t\tinstanceId: process.id,\n\t\t\tturnId,\n\t\t\tturnType: \"llm\",\n\t\t\tproposedTurnRecordId: \"fixture-preflight\",\n\t\t\tstartKind: \"selected_turn\",\n\t\t\trecoveryTurnRecordId: null,\n\t\t\tcontinuation: null,\n\t\t\tstate: {\n\t\t\t\tkind: \"preparation_failed\",\n\t\t\t\trequestedModelProfileId: profileId ?? null,\n\t\t\t\tproviderOptions: {},\n\t\t\t\tcode: \"model_required\",\n\t\t\t\tsafeSummary: \"Fixture preparation\",\n\t\t\t},\n\t\t},\n\t};\n\tconst writes = createWrites({ turnStartWrites: [write] });\n\tconst bundleCache = createPiResourceBundleCache();\n\tconst result = await prepareCreatedTurnStarts(\n\t\t{\n\t\t\tconfig: ctx.config,\n\t\t\tregistry: ctx.modelProviderRegistry,\n\t\t\tmodelStatusCache: ctx.modelStatusCache,\n\t\t\tpiContributions: contributions,\n\t\t\tbundleCache,\n\t\t\tprojects: ctx.deps.projects,\n\t\t\tprocessSkills: ctx.deps.processSkills,\n\t\t},\n\t\t{ ...process, selectedTurnId: turnId, selectedTurnModelProfileId: profileId ?? null },\n\t\twrites,\n\t);\n\tif (!result.ok) throw new Error(`Cannot prepare accepted fixture: ${result.message}`);\n\tconst state = write.input.state;\n\tif (state.kind !== \"starting\" || state.start.kind !== \"llm\") {\n\t\tthrow new Error(\n\t\t\t`Cannot prepare accepted fixture: ${state.kind === \"preparation_failed\" ? state.safeSummary : state.kind}`,\n\t\t);\n\t}\n\tconst bundle = bundleCache.get(state.start.piResourceSnapshotDigest);\n\tif (!bundle) throw new Error(\"Prepared fixture resource bundle is missing\");\n\treturn {\n\t\t/** @internal */\n\t\tstart: state.start,\n\t\t/** @internal */\n\t\tbundle,\n\t};\n}\n","import type { AppContext } from \"../app.js\";\nimport { createAllRepos } from \"../db/repositories.js\";\nimport { createFileBackedProcessSessionSnapshotStore } from \"../process-session-store.js\";\nimport { createProjectedSessionSnapshotStore } from \"../session-summary-projection.js\";\n\n/** Accept fixture snapshots through the same persisted projection as worker uploads. @internal */\nexport async function writeProcessSessionSnapshot(\n\tctx: Pick<AppContext, \"db\" | \"config\">,\n\tinstanceId: string,\n\tentries: readonly unknown[],\n): Promise<void> {\n\tconst store = createProjectedSessionSnapshotStore(\n\t\tcreateFileBackedProcessSessionSnapshotStore(ctx.config.storage.tree_files_dir),\n\t\tcreateAllRepos(ctx.db),\n\t);\n\tawait store.writeSnapshot(\n\t\tinstanceId,\n\t\t`${entries.map((entry) => JSON.stringify(entry)).join(\"\\n\")}\\n`,\n\t);\n}\n","import type { TurnId } from \"@leitwerk-dev/domain\";\nimport {\n\ttype AutomaticTurnDefinition,\n\tautomaticTurn,\n\tdefineProcess,\n\ttype ExtensionProcessDefinition,\n\temptyParamsCodec,\n\ttype HumanTurnDefinition,\n\thumanTurn,\n\ttype LlmTurnDefinition,\n\tllmTurn,\n\ttype TurnDefinition,\n} from \"@leitwerk-dev/process-sdk\";\n\nexport function createFixtureLlmTurn(\n\tdescription: string,\n\toverrides: Partial<LlmTurnDefinition<string, Record<string, never>, Record<string, never>>> = {},\n): LlmTurnDefinition<string, Record<string, never>, Record<string, never>> {\n\treturn llmTurn({\n\t\tavailableTools: [],\n\t\tdescription,\n\t\tbranchType: \"primary\",\n\t\tcontext: \"fresh\",\n\t\tprompt: async () => description,\n\t\tturnEnd: { outcome: \"done\", params: {}, complete: true },\n\t\t...overrides,\n\t});\n}\n\nexport function createFixtureHumanTurn(\n\toverrides: Partial<HumanTurnDefinition<Record<string, never>, Record<string, never>>> = {},\n): HumanTurnDefinition<Record<string, never>, Record<string, never>> {\n\treturn humanTurn({\n\t\tdescription: \"Review\",\n\t\treviewSemanticRef: \"plan\",\n\t\tactions: {\n\t\t\tmark_done: {\n\t\t\t\tlabel: \"Mark done\",\n\t\t\t\tacceptanceState: \"accepted\",\n\t\t\t\tcomplete: true,\n\t\t\t},\n\t\t},\n\t\t...overrides,\n\t});\n}\n\nexport function createFixtureAutomaticTurn(\n\tdescription = \"Automatic turn\",\n): AutomaticTurnDefinition<\"done\", Record<string, never>, Record<string, never>> {\n\treturn automaticTurn<Record<string, never>, Record<string, never>, \"done\">({\n\t\tdescription,\n\t\trun: async () => ({ outcome: \"done\", params: {} }),\n\t\tturnEnd: { outcome: \"done\", params: {}, complete: true },\n\t});\n}\n\nfunction ensureFixtureTurnIsValid(\n\tdefinition: TurnDefinition<Record<string, never>, Record<string, never>>,\n): TurnDefinition<Record<string, never>, Record<string, never>> {\n\tif (definition.kind === \"human\" && Object.keys(definition.actions).length === 0) {\n\t\treturn {\n\t\t\t...definition,\n\t\t\tactions: {\n\t\t\t\t__fixture_noop: { label: \"No-op\", acceptanceState: \"neutral\", complete: true },\n\t\t\t},\n\t\t};\n\t}\n\tif (\n\t\t(definition.kind === \"llm\" || definition.kind === \"automatic\") &&\n\t\tObject.keys(definition.outcomes ?? {}).length === 0 &&\n\t\t!definition.turnEnd\n\t) {\n\t\treturn {\n\t\t\t...definition,\n\t\t\tturnEnd: { outcome: \"done\", params: {}, complete: true },\n\t\t} as TurnDefinition<Record<string, never>, Record<string, never>>;\n\t}\n\treturn definition;\n}\n\nexport function createFixtureProcess(input: {\n\tid: string;\n\tentry: TurnId;\n\talternateEntries?: readonly TurnId[];\n\tturns?: Record<string, TurnDefinition<Record<string, never>, Record<string, never>>>;\n}): ExtensionProcessDefinition<Record<string, never>, Record<string, never>> {\n\tconst turns = input.turns ?? {};\n\tconst entries = [input.entry, ...(input.alternateEntries ?? [])];\n\treturn defineProcess<Record<string, never>, Record<string, never>>({\n\t\tid: input.id,\n\t\tdisplayName: input.id,\n\t\tentry: input.entry,\n\t\t...(input.alternateEntries ? { alternateEntries: input.alternateEntries } : {}),\n\t\tparamsCodec: emptyParamsCodec,\n\t\tstateCodec: emptyParamsCodec,\n\t\tinitialState: () => ({}),\n\t\tturns:\n\t\t\tObject.keys(turns).length > 0\n\t\t\t\t? Object.fromEntries(\n\t\t\t\t\t\tObject.entries(turns).map(([turnId, definition]) => [\n\t\t\t\t\t\t\tturnId,\n\t\t\t\t\t\t\tensureFixtureTurnIsValid(definition),\n\t\t\t\t\t\t]),\n\t\t\t\t\t)\n\t\t\t\t: Object.fromEntries(entries.map((turnId) => [turnId, createFixtureLlmTurn(turnId)])),\n\t});\n}\n\nexport function createProcessGraphRegistry(\n\tprocesses: readonly ExtensionProcessDefinition<unknown, unknown>[],\n): ReadonlyMap<string, ExtensionProcessDefinition<unknown, unknown>> {\n\treturn new Map(\n\t\tprocesses.map(\n\t\t\t(process) => [process.id, process as ExtensionProcessDefinition<unknown, unknown>] as const,\n\t\t),\n\t);\n}\n\nexport function createTurnOwnershipFixtureProcess(\n\tid = \"turn_ownership_process\",\n): ExtensionProcessDefinition<Record<string, never>, Record<string, never>> {\n\treturn createFixtureProcess({\n\t\tid,\n\t\tentry: \"llm_turn\",\n\t\tturns: {\n\t\t\tllm_turn: createFixtureLlmTurn(\"LLM turn\"),\n\t\t\tautomatic_turn: createFixtureAutomaticTurn(),\n\t\t\thuman_turn: createFixtureHumanTurn(),\n\t\t},\n\t});\n}\n\nexport function createDefaultTestProcessGraphRegistry(): ReadonlyMap<\n\tstring,\n\tExtensionProcessDefinition<unknown, unknown>\n> {\n\tconst ticket = createFixtureProcess({\n\t\tid: \"ticket_issue_process\",\n\t\tentry: \"generate_plan\",\n\t\tturns: {\n\t\t\tgenerate_plan: createFixtureLlmTurn(\"generate_plan\", {\n\t\t\t\tresultSemanticRef: \"plan\",\n\t\t\t\tturnEnd: undefined,\n\t\t\t\toutcomes: { plan_saved: { description: \"plan_saved\", parameters: {}, to: \"plan_review\" } },\n\t\t\t}),\n\t\t\tplan_review: createFixtureHumanTurn({\n\t\t\t\treviewSemanticRef: \"plan\",\n\t\t\t\tactions: {\n\t\t\t\t\trevision_requested: {\n\t\t\t\t\t\tlabel: \"Request revision\",\n\t\t\t\t\t\tacceptanceState: \"requires_changes\",\n\t\t\t\t\t\tto: \"generate_plan\",\n\t\t\t\t\t},\n\t\t\t\t\tplan_approved: {\n\t\t\t\t\t\tlabel: \"Approve plan\",\n\t\t\t\t\t\tacceptanceState: \"accepted\",\n\t\t\t\t\t\tto: \"implement\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}),\n\t\t\timplement: createFixtureLlmTurn(\"implement\", {\n\t\t\t\tturnEnd: { outcome: \"done\", params: {}, to: \"handoff_review\" },\n\t\t\t}),\n\t\t\thandoff_review: createFixtureLlmTurn(\"handoff_review\", {\n\t\t\t\tturnEnd: { outcome: \"created\", params: {}, to: \"run_llm_review\" },\n\t\t\t}),\n\t\t\trun_llm_review: createFixtureLlmTurn(\"run_llm_review\", {\n\t\t\t\tresultSemanticRef: \"review\",\n\t\t\t\tturnEnd: undefined,\n\t\t\t\toutcomes: {\n\t\t\t\t\tissues_found: { description: \"issues_found\", parameters: {}, to: \"address_review\" },\n\t\t\t\t\tno_issues: { description: \"no_issues\", parameters: {}, to: \"implementation_review\" },\n\t\t\t\t},\n\t\t\t}),\n\t\t\taddress_review: createFixtureLlmTurn(\"address_review\", {\n\t\t\t\tturnEnd: { outcome: \"comments_addressed\", params: {}, to: \"verify_build\" },\n\t\t\t}),\n\t\t\tverify_build: createFixtureLlmTurn(\"verify_build\", {\n\t\t\t\tturnEnd: undefined,\n\t\t\t\toutcomes: {\n\t\t\t\t\tbuild_failing: { description: \"build_failing\", parameters: {}, to: \"fix_build\" },\n\t\t\t\t\tbuild_passing: {\n\t\t\t\t\t\tdescription: \"build_passing\",\n\t\t\t\t\t\tparameters: {},\n\t\t\t\t\t\tto: \"commit_and_complete\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}),\n\t\t\tfix_build: createFixtureLlmTurn(\"fix_build\", {\n\t\t\t\tturnEnd: { outcome: \"build_fixed\", params: {}, to: \"verify_build\" },\n\t\t\t}),\n\t\t\tcommit_and_complete: createFixtureLlmTurn(\"commit_and_complete\", {\n\t\t\t\tturnEnd: { outcome: \"committed\", params: {}, to: \"implementation_review\" },\n\t\t\t}),\n\t\t\timplementation_review: createFixtureHumanTurn({\n\t\t\t\treviewSemanticRef: \"review\",\n\t\t\t}),\n\t\t},\n\t});\n\tconst mrPolish = createFixtureProcess({\n\t\tid: \"mr_polish_process\",\n\t\tentry: \"address_review\",\n\t\tturns: {\n\t\t\taddress_review: createFixtureLlmTurn(\"address_review\", {\n\t\t\t\tturnEnd: { outcome: \"comments_addressed\", params: {}, to: \"verify_build\" },\n\t\t\t}),\n\t\t\tverify_build: createFixtureLlmTurn(\"verify_build\", {\n\t\t\t\tturnEnd: undefined,\n\t\t\t\toutcomes: {\n\t\t\t\t\tbuild_failing: { description: \"build_failing\", parameters: {}, to: \"fix_build\" },\n\t\t\t\t\tbuild_passing: {\n\t\t\t\t\t\tdescription: \"build_passing\",\n\t\t\t\t\t\tparameters: {},\n\t\t\t\t\t\tto: \"commit_and_complete\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}),\n\t\t\tfix_build: createFixtureLlmTurn(\"fix_build\", {\n\t\t\t\tturnEnd: { outcome: \"build_fixed\", params: {}, to: \"verify_build\" },\n\t\t\t}),\n\t\t\tcommit_and_complete: createFixtureLlmTurn(\"commit_and_complete\", {\n\t\t\t\tturnEnd: { outcome: \"committed\", params: {}, to: \"mr_polish_review\" },\n\t\t\t}),\n\t\t\tmr_polish_review: createFixtureHumanTurn({\n\t\t\t\treviewSemanticRef: \"review\",\n\t\t\t}),\n\t\t},\n\t});\n\treturn createProcessGraphRegistry([\n\t\tticket as ExtensionProcessDefinition<unknown, unknown>,\n\t\tmrPolish as ExtensionProcessDefinition<unknown, unknown>,\n\t]);\n}\n","import type { ProcessLaunchPlanServiceLike } from \"@leitwerk-dev/process-sdk\";\nimport { getDefaultConfig } from \"../config/config-loader.js\";\nimport { createDatabase, createInMemoryDatabase, type LeitwerkDb } from \"../db/database.js\";\nimport { createAllRepos, type RepositoryBundle } from \"../db/repositories.js\";\nimport type { ModelStatusCacheSnapshot } from \"../model-providers/model-status-cache.js\";\nimport {\n\tcreateServerProcessModelPolicy,\n\ttype ServerProcessModelPolicy,\n} from \"../process-model-policy/index.js\";\nimport { type Broadcaster, createBroadcaster } from \"../ws/broadcast.js\";\nimport { createDefaultTestProcessGraphRegistry } from \"./process-fixtures.js\";\n\n/** @internal */\nexport interface TestDeps extends RepositoryBundle {\n\t/** @internal */\n\tdb: LeitwerkDb;\n\t/** @internal */\n\tbroadcaster: Broadcaster;\n\t/** @internal */\n\tprocessModelPolicy: ServerProcessModelPolicy;\n\t/** @internal */\n\tlaunchPlans: ProcessLaunchPlanServiceLike;\n\t/** @internal */\n\tgetModelAvailabilitySnapshot: () => ModelStatusCacheSnapshot;\n}\n\n/** Select a turn-start fixture without creating a turn record or attempt. */\nexport function createSelectedTurnStart(\n\tdeps: TestDeps,\n\tinput: Omit<\n\t\tParameters<TestDeps[\"turnStarts\"][\"create\"]>[0],\n\t\t\"startKind\" | \"recoveryTurnRecordId\" | \"continuation\"\n\t>,\n) {\n\tconst record = deps.turnStarts.create({\n\t\t...input,\n\t\tstartKind: \"selected_turn\",\n\t\trecoveryTurnRecordId: null,\n\t\tcontinuation: null,\n\t});\n\tdeps.processes.update(input.instanceId, {\n\t\tcurrentExecution: { kind: \"worker_start\", id: record.id },\n\t});\n\treturn record;\n}\n\n/** @internal */\nexport function createTestDeps(\n\toptions: {\n\t\t/** @internal */\n\t\tsqlitePath?: string;\n\t} = {},\n): TestDeps {\n\tconst db = options.sqlitePath\n\t\t? createDatabase({ sqlitePath: options.sqlitePath, enableWAL: false })\n\t\t: createInMemoryDatabase();\n\tconst repos = createAllRepos(db);\n\tconst config = getDefaultConfig();\n\tconst processModelPolicy = createServerProcessModelPolicy({\n\t\tconfig,\n\t\tprocessGraphs: createDefaultTestProcessGraphRegistry(),\n\t\tprocessActionRegistry: { getTurnDefinition: () => undefined },\n\t});\n\tconst launchPlans: ProcessLaunchPlanServiceLike = {\n\t\tasync prepare(launchPlan, opts = {}) {\n\t\t\treturn processModelPolicy.prepareLaunchPlan(launchPlan, opts);\n\t\t},\n\t};\n\tconst getModelAvailabilitySnapshot = (): ModelStatusCacheSnapshot => ({\n\t\trevision: 1,\n\t\tcapturedAt: new Date().toISOString(),\n\t\tavailabilityTransitions: [],\n\t\tprofiles: config.pi.model_profiles.map((profile) => ({\n\t\t\tprofileId: profile.id,\n\t\t\tproviderId: profile.provider,\n\t\t\tmodelId: profile.model_id,\n\t\t\tavailability: \"available\",\n\t\t\tcheckedAt: new Date().toISOString(),\n\t\t\texpiresAt: new Date(Date.now() + 60_000).toISOString(),\n\t\t})),\n\t});\n\tconst createTurnRecord = repos.turnRecords.create.bind(repos.turnRecords);\n\trepos.turnRecords.create = (input) => {\n\t\tconst turnType = input.turnType ?? \"llm\";\n\t\tif (\n\t\t\t(turnType === \"llm\" || turnType === \"automatic\") &&\n\t\t\t(!input.turnStartRecordId || !input.acceptedWorkerLeaseId)\n\t\t) {\n\t\t\tconst turnRecordId = input.id ?? `trn_fixture_${crypto.randomUUID()}`;\n\t\t\tconst isCurrent =\n\t\t\t\tinput.status === \"running\" || input.status === \"failed\" || input.status === undefined;\n\t\t\tconst lease = repos.leases.create({\n\t\t\t\tinstanceId: input.instanceId,\n\t\t\t\tworkerId: `wkr_fixture_${turnRecordId}`,\n\t\t\t\tstate: input.status === \"failed\" ? \"failed\" : isCurrent ? \"busy\" : \"exited\",\n\t\t\t});\n\t\t\tconst start = repos.turnStarts.create({\n\t\t\t\tid: `tsr_fixture_${turnRecordId}`,\n\t\t\t\tinstanceId: input.instanceId,\n\t\t\t\tturnId: input.turnId,\n\t\t\t\tturnType,\n\t\t\t\tproposedTurnRecordId: turnRecordId,\n\t\t\t\tstartKind: \"selected_turn\",\n\t\t\t\trecoveryTurnRecordId: null,\n\t\t\t\tcontinuation: null,\n\t\t\t\tstate: {\n\t\t\t\t\tkind: \"accepted\",\n\t\t\t\t\tstart:\n\t\t\t\t\t\tturnType === \"automatic\"\n\t\t\t\t\t\t\t? { kind: \"automatic\" }\n\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\tkind: \"llm\",\n\t\t\t\t\t\t\t\t\tmodel: {\n\t\t\t\t\t\t\t\t\t\tprofileId: input.modelProfileId ?? \"fixture-model\",\n\t\t\t\t\t\t\t\t\t\tproviderId: \"fixture-provider\",\n\t\t\t\t\t\t\t\t\t\tmodelId: \"fixture-model\",\n\t\t\t\t\t\t\t\t\t\tthinkingLevel: \"low\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tproviderOptions: {},\n\t\t\t\t\t\t\t\t\tproviderWorkerConfig: null,\n\t\t\t\t\t\t\t\t\tpiResourceSnapshotDigest: \"fixture-resource-snapshot\",\n\t\t\t\t\t\t\t\t\tworkerRuntimeProfileId: \"local\",\n\t\t\t\t\t\t\t\t\tpiSettings: {},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\tturnRecordId,\n\t\t\t\t\tacceptedWorkerLeaseId: lease.id,\n\t\t\t\t},\n\t\t\t});\n\t\t\tconst record = createTurnRecord({\n\t\t\t\t...input,\n\t\t\t\tid: turnRecordId,\n\t\t\t\tturnStartRecordId: start.id,\n\t\t\t\tacceptedWorkerLeaseId: lease.id,\n\t\t\t});\n\t\t\tif (isCurrent) {\n\t\t\t\trepos.processes.update(record.instanceId, {\n\t\t\t\t\tcurrentExecution: { kind: \"worker_start\", id: start.id },\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\trepos.leases.update(lease.id, { exitedAt: record.endedAt ?? record.startedAt });\n\t\t\t}\n\t\t\treturn record;\n\t\t}\n\t\treturn createTurnRecord(input);\n\t};\n\treturn {\n\t\tdb,\n\t\t...repos,\n\t\tbroadcaster: createBroadcaster(),\n\t\tprocessModelPolicy,\n\t\tlaunchPlans,\n\t\tgetModelAvailabilitySnapshot,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAIO,SAAS,sBACf,KACA,OAMA,UAKI,CAAC,GACJ;AACD,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,gCAAgC;AAC1D,QAAM,UAAU,QAAQ,WAAW,MAAM,WAAW;AACpD,QAAM,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A,IACA,GAAG;AAAA,IACH,aAAa,kBAAkB;AAAA,IAC/B;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;","names":[]}
|
|
@@ -1,32 +1,53 @@
|
|
|
1
1
|
import type { Actor, ProcessToolApprovalDestination, ProcessToolApprovalRequest } from "@leitwerk-dev/domain";
|
|
2
2
|
import type { RepositoryBundle } from "./db/repositories.js";
|
|
3
3
|
import type { ProcessOperationCoordinator } from "./process-operation-coordinator.js";
|
|
4
|
+
/** @internal */
|
|
4
5
|
export type ToolApprovalDecision = {
|
|
6
|
+
/** @internal */
|
|
5
7
|
kind: "accepted";
|
|
6
8
|
} | {
|
|
9
|
+
/** @internal */
|
|
7
10
|
kind: "feedback";
|
|
11
|
+
/** @internal */
|
|
8
12
|
feedback: string;
|
|
9
13
|
} | {
|
|
14
|
+
/** @internal */
|
|
10
15
|
kind: "declined";
|
|
11
16
|
};
|
|
17
|
+
/** @internal */
|
|
12
18
|
type ToolApprovalRepos = Pick<RepositoryBundle, "processes" | "turnRecords" | "turnStarts" | "toolApprovalRequests" | "transaction">;
|
|
19
|
+
/** @internal */
|
|
13
20
|
export declare function createToolApprovalGate(input: {
|
|
21
|
+
/** @internal */
|
|
14
22
|
repos: ToolApprovalRepos;
|
|
23
|
+
/** @internal */
|
|
15
24
|
processOperations: ProcessOperationCoordinator;
|
|
16
25
|
}): {
|
|
26
|
+
/** @internal */
|
|
17
27
|
reconcile: (instanceId: string) => void;
|
|
28
|
+
/** @internal */
|
|
18
29
|
review(requestInput: {
|
|
30
|
+
/** @internal */
|
|
19
31
|
instanceId: string;
|
|
32
|
+
/** @internal */
|
|
20
33
|
turnRecordId: string;
|
|
34
|
+
/** @internal */
|
|
21
35
|
toolCallId: string;
|
|
36
|
+
/** @internal */
|
|
22
37
|
toolName: string;
|
|
38
|
+
/** @internal */
|
|
23
39
|
arguments: Record<string, unknown>;
|
|
40
|
+
/** @internal */
|
|
24
41
|
destination?: ProcessToolApprovalDestination;
|
|
25
42
|
}): Promise<ToolApprovalDecision>;
|
|
43
|
+
/** @internal */
|
|
26
44
|
listOpen(instanceId?: string): ProcessToolApprovalRequest[];
|
|
45
|
+
/** @internal */
|
|
27
46
|
resolve(instanceId: string, requestId: string, decision: ToolApprovalDecision, actor: Actor): Promise<ProcessToolApprovalRequest | null>;
|
|
47
|
+
/** @internal */
|
|
28
48
|
cancelTurn(instanceId: string, turnRecordId: string): number;
|
|
29
49
|
};
|
|
50
|
+
/** @internal */
|
|
30
51
|
export type ToolApprovalGate = ReturnType<typeof createToolApprovalGate>;
|
|
31
52
|
export {};
|
|
32
53
|
//# sourceMappingURL=tool-approval-gate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-approval-gate.d.ts","sourceRoot":"","sources":["../src/tool-approval-gate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,KAAK,EACL,8BAA8B,EAC9B,0BAA0B,EAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AAEtF,MAAM,MAAM,oBAAoB,GAC7B;
|
|
1
|
+
{"version":3,"file":"tool-approval-gate.d.ts","sourceRoot":"","sources":["../src/tool-approval-gate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,KAAK,EACL,8BAA8B,EAC9B,0BAA0B,EAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AAEtF,gBAAgB;AAChB,MAAM,MAAM,oBAAoB,GAC7B;IACA,gBAAgB;IAChB,IAAI,EAAE,UAAU,CAAC;CAChB,GACD;IACA,gBAAgB;IAChB,IAAI,EAAE,UAAU,CAAC;IACjB,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAC;CAChB,GACD;IACA,gBAAgB;IAChB,IAAI,EAAE,UAAU,CAAC;CAChB,CAAC;AAEL,gBAAgB;AAChB,KAAK,iBAAiB,GAAG,IAAI,CAC5B,gBAAgB,EAChB,WAAW,GAAG,aAAa,GAAG,YAAY,GAAG,sBAAsB,GAAG,aAAa,CACnF,CAAC;AA6BF,gBAAgB;AAChB,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAC7C,gBAAgB;IAChB,KAAK,EAAE,iBAAiB,CAAC;IACzB,gBAAgB;IAChB,iBAAiB,EAAE,2BAA2B,CAAC;CAC/C;IAYC,gBAAgB;4BATc,MAAM,KAAG,IAAI;IAW3C,gBAAgB;yBACW;QAC1B,gBAAgB;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,gBAAgB;QAChB,YAAY,EAAE,MAAM,CAAC;QACrB,gBAAgB;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,gBAAgB;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,gBAAgB;QAChB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACnC,gBAAgB;QAChB,WAAW,CAAC,EAAE,8BAA8B,CAAC;KAC7C,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAWjC,gBAAgB;0BACM,MAAM,GAAG,0BAA0B,EAAE;IAG3D,gBAAgB;wBAEH,MAAM,aACP,MAAM,YACP,oBAAoB,SACvB,KAAK;IAuBb,gBAAgB;2BACO,MAAM,gBAAgB,MAAM,GAAG,MAAM;EAM7D;AACD,gBAAgB;AAChB,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type ProcessInstance, type ProcessSemanticEntryRefKey, type ProcessTurnRecord, type TurnStartRecord } from "@leitwerk-dev/domain";
|
|
2
|
+
/** @internal */
|
|
2
3
|
export interface TurnRecordMarkdownLookup {
|
|
4
|
+
/** @internal */
|
|
3
5
|
getById(id: string): Pick<ProcessTurnRecord, "instanceId" | "resultPiEntryId" | "turnResultMarkdown"> | null;
|
|
4
6
|
}
|
|
5
7
|
export interface ProcessTurnRecordLookup {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"turn-result-markdown.d.ts","sourceRoot":"","sources":["../src/turn-result-markdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,eAAe,EACpB,KAAK,0BAA0B,EAC/B,KAAK,iBAAiB,EAItB,KAAK,eAAe,EACpB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,wBAAwB;IACxC,OAAO,CACN,EAAE,EAAE,MAAM,GACR,IAAI,CAAC,iBAAiB,EAAE,YAAY,GAAG,iBAAiB,GAAG,oBAAoB,CAAC,GAAG,IAAI,CAAC;CAC3F;AAED,MAAM,WAAW,uBAAuB;IACvC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAAC;IAC9C,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,iBAAiB,EAAE,CAAC;CACjE;AAED,MAAM,WAAW,qBAAqB;IACrC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAAC;CAC5C;AAED,UAAU,uBAAuB;IAChC,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,IAAI,GAAG,gBAAgB,GAAG,WAAW,CAAC,CAAC;IACtE,WAAW,EAAE,wBAAwB,CAAC;IACtC,QAAQ,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,gCAAgC,CAC/C,KAAK,EAAE,uBAAuB,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,GACtD,MAAM,GAAG,IAAI,CAOf;AAED,wBAAgB,iCAAiC,CAChD,KAAK,EAAE,uBAAuB,GAAG;IAAE,mBAAmB,EAAE,0BAA0B,CAAA;CAAE,GAClF,MAAM,GAAG,IAAI,CAMf"}
|
|
1
|
+
{"version":3,"file":"turn-result-markdown.d.ts","sourceRoot":"","sources":["../src/turn-result-markdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,eAAe,EACpB,KAAK,0BAA0B,EAC/B,KAAK,iBAAiB,EAItB,KAAK,eAAe,EACpB,MAAM,sBAAsB,CAAC;AAE9B,gBAAgB;AAChB,MAAM,WAAW,wBAAwB;IACxC,gBAAgB;IAChB,OAAO,CACN,EAAE,EAAE,MAAM,GACR,IAAI,CAAC,iBAAiB,EAAE,YAAY,GAAG,iBAAiB,GAAG,oBAAoB,CAAC,GAAG,IAAI,CAAC;CAC3F;AAED,MAAM,WAAW,uBAAuB;IACvC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAAC;IAC9C,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,iBAAiB,EAAE,CAAC;CACjE;AAED,MAAM,WAAW,qBAAqB;IACrC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAAC;CAC5C;AAED,UAAU,uBAAuB;IAChC,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,IAAI,GAAG,gBAAgB,GAAG,WAAW,CAAC,CAAC;IACtE,WAAW,EAAE,wBAAwB,CAAC;IACtC,QAAQ,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,gCAAgC,CAC/C,KAAK,EAAE,uBAAuB,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,GACtD,MAAM,GAAG,IAAI,CAOf;AAED,wBAAgB,iCAAiC,CAChD,KAAK,EAAE,uBAAuB,GAAG;IAAE,mBAAmB,EAAE,0BAA0B,CAAA;CAAE,GAClF,MAAM,GAAG,IAAI,CAMf"}
|
|
@@ -4,27 +4,38 @@ import type { LeitwerkConfig, WorkerRuntimeProfileConfig } from "./config/config
|
|
|
4
4
|
* Per-component runtime profile selection input. `profile` is the component's
|
|
5
5
|
* configured `worker_runtime_profile`, or `undefined` when it declares none.
|
|
6
6
|
*/
|
|
7
|
+
/** @internal */
|
|
7
8
|
export interface ComponentRuntimeProfileSelection {
|
|
9
|
+
/** @internal */
|
|
8
10
|
component: string;
|
|
11
|
+
/** @internal */
|
|
9
12
|
profile?: string;
|
|
10
13
|
}
|
|
14
|
+
/** @internal */
|
|
11
15
|
export interface RuntimeProfileSelectionInput {
|
|
16
|
+
/** @internal */
|
|
12
17
|
processId: string;
|
|
13
|
-
/** `process_configs.<processId>.worker_runtime_profile`, if set. */
|
|
18
|
+
/** `process_configs.<processId>.worker_runtime_profile`, if set. @internal */
|
|
14
19
|
processOverride?: string;
|
|
15
|
-
/** Per-component profile selections for the process's projects. */
|
|
20
|
+
/** Per-component profile selections for the process's projects. @internal */
|
|
16
21
|
componentProfiles: ComponentRuntimeProfileSelection[];
|
|
17
|
-
/** Runner-specific default profile (`kubernetes.default_worker_runtime_profile` wins in Kubernetes mode). */
|
|
22
|
+
/** Runner-specific default profile (`kubernetes.default_worker_runtime_profile` wins in Kubernetes mode). @internal */
|
|
18
23
|
defaultProfile?: string;
|
|
19
|
-
/** Configured `worker_runtime_profiles` keyed by id. */
|
|
24
|
+
/** Configured `worker_runtime_profiles` keyed by id. @internal */
|
|
20
25
|
profiles: Record<string, WorkerRuntimeProfileConfig>;
|
|
21
26
|
}
|
|
27
|
+
/** @internal */
|
|
22
28
|
export type RuntimeProfileSelectionResult = {
|
|
29
|
+
/** @internal */
|
|
23
30
|
ok: true;
|
|
31
|
+
/** @internal */
|
|
24
32
|
runtimeProfile: string;
|
|
33
|
+
/** @internal */
|
|
25
34
|
image: ResolvedWorkerImage;
|
|
26
35
|
} | {
|
|
36
|
+
/** @internal */
|
|
27
37
|
ok: false;
|
|
38
|
+
/** @internal */
|
|
28
39
|
error: string;
|
|
29
40
|
};
|
|
30
41
|
export declare function defaultWorkerRuntimeProfile(config: LeitwerkConfig): string | null;
|
|
@@ -42,14 +53,19 @@ export declare function defaultWorkerRuntimeProfile(config: LeitwerkConfig): str
|
|
|
42
53
|
* Repository branch content never reaches this function; image authority lives
|
|
43
54
|
* entirely in leitwerk config.
|
|
44
55
|
*/
|
|
56
|
+
/** @internal */
|
|
45
57
|
export declare function selectWorkerRuntimeProfile(input: RuntimeProfileSelectionInput): RuntimeProfileSelectionResult;
|
|
46
58
|
/**
|
|
47
59
|
* Builds {@link RuntimeProfileSelectionInput} from leitwerk config for a
|
|
48
60
|
* process and the components it spans.
|
|
49
61
|
*/
|
|
62
|
+
/** @internal */
|
|
50
63
|
export declare function buildRuntimeProfileSelectionInput(args: {
|
|
64
|
+
/** @internal */
|
|
51
65
|
config: LeitwerkConfig;
|
|
66
|
+
/** @internal */
|
|
52
67
|
processId: string;
|
|
68
|
+
/** @internal */
|
|
53
69
|
componentKeys: string[];
|
|
54
70
|
}): RuntimeProfileSelectionInput;
|
|
55
71
|
//# sourceMappingURL=worker-runtime-profile-selection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-runtime-profile-selection.d.ts","sourceRoot":"","sources":["../src/worker-runtime-profile-selection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAE3F;;;GAGG;AACH,MAAM,WAAW,gCAAgC;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,4BAA4B;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,
|
|
1
|
+
{"version":3,"file":"worker-runtime-profile-selection.d.ts","sourceRoot":"","sources":["../src/worker-runtime-profile-selection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAE3F;;;GAGG;AACH,gBA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
|
|
1
1
|
import { type KnownDurableWsFrameType, type KnownEphemeralWsFrameType, type WsDurability, type WsFrame, type WsPayloadByType } from "@leitwerk-dev/protocol";
|
|
2
|
+
/** @internal */
|
|
2
3
|
export interface WsClientLike {
|
|
4
|
+
/** @internal */
|
|
3
5
|
readyState: number;
|
|
6
|
+
/** @internal */
|
|
4
7
|
send(data: string): void;
|
|
8
|
+
/** @internal */
|
|
5
9
|
on(event: string, handler: () => void): void;
|
|
6
10
|
}
|
|
7
11
|
export type { WsDurability, WsFrame };
|
|
12
|
+
/** @internal */
|
|
8
13
|
export declare function createBroadcaster(): {
|
|
14
|
+
/** @internal */
|
|
9
15
|
addClient: (ws: WsClientLike) => void;
|
|
16
|
+
/** @internal */
|
|
10
17
|
broadcast: (frame: WsFrame) => void;
|
|
18
|
+
/** @internal */
|
|
11
19
|
sendDurable: <T extends KnownDurableWsFrameType>(type: T, payload: WsPayloadByType[T], instanceId?: string) => void;
|
|
20
|
+
/** @internal */
|
|
12
21
|
sendEphemeral: <T extends KnownEphemeralWsFrameType>(type: T, payload: WsPayloadByType[T], instanceId?: string) => void;
|
|
13
22
|
};
|
|
23
|
+
/** @internal */
|
|
14
24
|
export type Broadcaster = ReturnType<typeof createBroadcaster>;
|
|
15
25
|
//# sourceMappingURL=broadcast.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"broadcast.d.ts","sourceRoot":"","sources":["../../src/ws/broadcast.ts"],"names":[],"mappings":"AAAA,OAAO,EAKN,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC9B,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,eAAe,EACpB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,YAAY;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;CAC7C;AAED,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC;AAEtC,wBAAgB,iBAAiB;
|
|
1
|
+
{"version":3,"file":"broadcast.d.ts","sourceRoot":"","sources":["../../src/ws/broadcast.ts"],"names":[],"mappings":"AAAA,OAAO,EAKN,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC9B,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,eAAe,EACpB,MAAM,wBAAwB,CAAC;AAEhC,gBAAgB;AAChB,MAAM,WAAW,YAAY;IAC5B,gBAAgB;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB;IAChB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,gBAAgB;IAChB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;CAC7C;AAED,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC;AAEtC,gBAAgB;AAChB,wBAAgB,iBAAiB;IAgD/B,gBAAgB;oBA5CM,YAAY;IA8ClC,gBAAgB;uBAxCS,OAAO;IA0ChC,gBAAgB;kBAhCI,CAAC,SAAS,uBAAuB,QAC/C,CAAC,WACE,eAAe,CAAC,CAAC,CAAC,eACd,MAAM;IA+BnB,gBAAgB;oBApBM,CAAC,SAAS,yBAAyB,QACnD,CAAC,WACE,eAAe,CAAC,CAAC,CAAC,eACd,MAAM;EAoBpB;AAED,gBAAgB;AAChB,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leitwerk-dev/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/leitwerk-dev/leitwerk.git",
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
"@earendil-works/pi-coding-agent": "^0.81.1",
|
|
29
29
|
"@fastify/cookie": "11.0.2",
|
|
30
30
|
"@fastify/websocket": "^11.2.0",
|
|
31
|
-
"@leitwerk-dev/domain": "0.
|
|
32
|
-
"@leitwerk-dev/extension-runtime": "0.
|
|
33
|
-
"@leitwerk-dev/external-writes": "0.
|
|
34
|
-
"@leitwerk-dev/process-sdk": "0.
|
|
35
|
-
"@leitwerk-dev/protocol": "0.
|
|
36
|
-
"@leitwerk-dev/session-transfer": "0.
|
|
37
|
-
"@leitwerk-dev/watcher-utils": "0.
|
|
38
|
-
"@leitwerk-dev/worker-protocol": "0.
|
|
39
|
-
"@leitwerk-dev/worker-runners": "0.
|
|
31
|
+
"@leitwerk-dev/domain": "0.3.0",
|
|
32
|
+
"@leitwerk-dev/extension-runtime": "0.3.0",
|
|
33
|
+
"@leitwerk-dev/external-writes": "0.3.0",
|
|
34
|
+
"@leitwerk-dev/process-sdk": "0.3.0",
|
|
35
|
+
"@leitwerk-dev/protocol": "0.3.0",
|
|
36
|
+
"@leitwerk-dev/session-transfer": "0.3.0",
|
|
37
|
+
"@leitwerk-dev/watcher-utils": "0.3.0",
|
|
38
|
+
"@leitwerk-dev/worker-protocol": "0.3.0",
|
|
39
|
+
"@leitwerk-dev/worker-runners": "0.3.0",
|
|
40
40
|
"cron-parser": "^5.5.0",
|
|
41
41
|
"defu": "^6.1.7",
|
|
42
42
|
"drizzle-orm": "1.0.0-rc.4",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"yaml": "^2.8.3"
|
|
49
49
|
},
|
|
50
50
|
"optionalDependencies": {
|
|
51
|
-
"@leitwerk-dev/worker": "0.
|
|
51
|
+
"@leitwerk-dev/worker": "0.3.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"tsup": "^8.5.1",
|