@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
|
@@ -6,9 +6,13 @@ import { generateId, now } from "./repo-helpers.js";
|
|
|
6
6
|
import * as s from "./schema.js";
|
|
7
7
|
import { createTurnSummaryRepo } from "./turn-summary-repo.js";
|
|
8
8
|
|
|
9
|
+
/** @internal */
|
|
9
10
|
export interface CreateProcessEventInput {
|
|
11
|
+
/** @internal */
|
|
10
12
|
instanceId: string;
|
|
13
|
+
/** @internal */
|
|
11
14
|
eventType: string;
|
|
15
|
+
/** @internal */
|
|
12
16
|
data?: Record<string, unknown>;
|
|
13
17
|
}
|
|
14
18
|
|
|
@@ -23,6 +27,7 @@ function rowToProcessEvent(row: typeof s.processEvents.$inferSelect): ProcessEve
|
|
|
23
27
|
};
|
|
24
28
|
}
|
|
25
29
|
|
|
30
|
+
/** @internal */
|
|
26
31
|
export function createProcessEventRepo(db: LeitwerkDb) {
|
|
27
32
|
const summaries = createTurnSummaryRepo(db);
|
|
28
33
|
const listNewest = (where: SQL | undefined, limit: number): ProcessEvent[] =>
|
|
@@ -35,6 +40,7 @@ export function createProcessEventRepo(db: LeitwerkDb) {
|
|
|
35
40
|
.all()
|
|
36
41
|
.map(rowToProcessEvent);
|
|
37
42
|
return {
|
|
43
|
+
/** @internal */
|
|
38
44
|
create(input: CreateProcessEventInput): ProcessEvent {
|
|
39
45
|
const id = generateId("evt");
|
|
40
46
|
const ts = now();
|
|
@@ -72,6 +78,7 @@ export function createProcessEventRepo(db: LeitwerkDb) {
|
|
|
72
78
|
return rowToProcessEvent(values);
|
|
73
79
|
},
|
|
74
80
|
|
|
81
|
+
/** @internal */
|
|
75
82
|
latestSequence(instanceId: string): number {
|
|
76
83
|
return (
|
|
77
84
|
db
|
|
@@ -83,6 +90,7 @@ export function createProcessEventRepo(db: LeitwerkDb) {
|
|
|
83
90
|
.get()?.sequence ?? 0
|
|
84
91
|
);
|
|
85
92
|
},
|
|
93
|
+
/** @internal */
|
|
86
94
|
listByTurnRecord(instanceId: string, turnRecordId: string): ProcessEvent[] {
|
|
87
95
|
return db
|
|
88
96
|
.select()
|
|
@@ -97,6 +105,7 @@ export function createProcessEventRepo(db: LeitwerkDb) {
|
|
|
97
105
|
.all()
|
|
98
106
|
.map(rowToProcessEvent);
|
|
99
107
|
},
|
|
108
|
+
/** @internal */
|
|
100
109
|
latestByTurnRecordEventType(
|
|
101
110
|
instanceId: string,
|
|
102
111
|
turnRecordId: string,
|
|
@@ -117,13 +126,16 @@ export function createProcessEventRepo(db: LeitwerkDb) {
|
|
|
117
126
|
.get();
|
|
118
127
|
return row ? rowToProcessEvent(row) : null;
|
|
119
128
|
},
|
|
129
|
+
/** @internal */
|
|
120
130
|
summary(turnRecordId: string) {
|
|
121
131
|
return summaries.get(turnRecordId);
|
|
122
132
|
},
|
|
133
|
+
/** @internal */
|
|
123
134
|
listByInstance(instanceId: string, limit = 100): ProcessEvent[] {
|
|
124
135
|
return listNewest(eq(s.processEvents.instanceId, instanceId), limit);
|
|
125
136
|
},
|
|
126
137
|
|
|
138
|
+
/** @internal */
|
|
127
139
|
listByInstanceEventTypes(
|
|
128
140
|
instanceId: string,
|
|
129
141
|
eventTypes: readonly string[],
|
|
@@ -147,10 +159,16 @@ export function createProcessEventRepo(db: LeitwerkDb) {
|
|
|
147
159
|
return limit < 0 ? events : events.slice(0, limit);
|
|
148
160
|
},
|
|
149
161
|
|
|
162
|
+
/** @internal */
|
|
150
163
|
listByInstanceSince(
|
|
151
164
|
instanceId: string,
|
|
152
165
|
sinceCreatedAt: string,
|
|
153
|
-
options: {
|
|
166
|
+
options: {
|
|
167
|
+
/** @internal */
|
|
168
|
+
limit?: number;
|
|
169
|
+
/** @internal */
|
|
170
|
+
eventTypePrefix?: string;
|
|
171
|
+
} = {},
|
|
154
172
|
): ProcessEvent[] {
|
|
155
173
|
const prefix =
|
|
156
174
|
typeof options.eventTypePrefix === "string" ? options.eventTypePrefix.trim() : "";
|
|
@@ -164,6 +182,7 @@ export function createProcessEventRepo(db: LeitwerkDb) {
|
|
|
164
182
|
);
|
|
165
183
|
},
|
|
166
184
|
|
|
185
|
+
/** @internal */
|
|
167
186
|
listByInstanceTurnRecordEventTypes(
|
|
168
187
|
instanceId: string,
|
|
169
188
|
turnRecordId: string,
|
|
@@ -188,6 +207,7 @@ export function createProcessEventRepo(db: LeitwerkDb) {
|
|
|
188
207
|
.map(rowToProcessEvent);
|
|
189
208
|
},
|
|
190
209
|
|
|
210
|
+
/** @internal */
|
|
191
211
|
listByInstanceSinceEventTypes(
|
|
192
212
|
instanceId: string,
|
|
193
213
|
sinceCreatedAt: string,
|
|
@@ -4,11 +4,16 @@ import type { LeitwerkDb } from "./database.js";
|
|
|
4
4
|
import { now } from "./repo-helpers.js";
|
|
5
5
|
import * as s from "./schema.js";
|
|
6
6
|
|
|
7
|
+
/** @internal */
|
|
7
8
|
export interface ProcessHandoffDedupKeyRecord extends HandoffDedupKeyRecordLike {}
|
|
8
9
|
|
|
10
|
+
/** @internal */
|
|
9
11
|
export interface CreateProcessHandoffDedupKeyInput {
|
|
12
|
+
/** @internal */
|
|
10
13
|
key: string;
|
|
14
|
+
/** @internal */
|
|
11
15
|
instanceId: string;
|
|
16
|
+
/** @internal */
|
|
12
17
|
metadata?: Record<string, unknown> | null;
|
|
13
18
|
}
|
|
14
19
|
|
|
@@ -23,8 +28,10 @@ function rowToRecord(
|
|
|
23
28
|
};
|
|
24
29
|
}
|
|
25
30
|
|
|
31
|
+
/** @internal */
|
|
26
32
|
export function createProcessHandoffDedupKeyRepo(db: LeitwerkDb) {
|
|
27
33
|
return {
|
|
34
|
+
/** @internal */
|
|
28
35
|
create(input: CreateProcessHandoffDedupKeyInput): ProcessHandoffDedupKeyRecord {
|
|
29
36
|
const values = {
|
|
30
37
|
key: input.key,
|
|
@@ -36,6 +43,7 @@ export function createProcessHandoffDedupKeyRepo(db: LeitwerkDb) {
|
|
|
36
43
|
return rowToRecord(values);
|
|
37
44
|
},
|
|
38
45
|
|
|
46
|
+
/** @internal */
|
|
39
47
|
getByKey(key: string): ProcessHandoffDedupKeyRecord | null {
|
|
40
48
|
const row = db
|
|
41
49
|
.select()
|
|
@@ -11,13 +11,21 @@ import type { LeitwerkDb } from "./database.js";
|
|
|
11
11
|
import { generateId, now } from "./repo-helpers.js";
|
|
12
12
|
import * as s from "./schema.js";
|
|
13
13
|
|
|
14
|
+
/** @internal */
|
|
14
15
|
export interface CreateProcessInputInput {
|
|
16
|
+
/** @internal */
|
|
15
17
|
instanceId: string;
|
|
18
|
+
/** @internal */
|
|
16
19
|
sequence: number;
|
|
20
|
+
/** @internal */
|
|
17
21
|
source: InputSource;
|
|
22
|
+
/** @internal */
|
|
18
23
|
kind: InputKind;
|
|
24
|
+
/** @internal */
|
|
19
25
|
target?: ProcessInputTarget | null;
|
|
26
|
+
/** @internal */
|
|
20
27
|
bodyMarkdown: string;
|
|
28
|
+
/** @internal */
|
|
21
29
|
actor?: Actor;
|
|
22
30
|
}
|
|
23
31
|
|
|
@@ -48,6 +56,7 @@ function rowToProcessInput(row: typeof s.processInputs.$inferSelect): ProcessInp
|
|
|
48
56
|
};
|
|
49
57
|
}
|
|
50
58
|
|
|
59
|
+
/** @internal */
|
|
51
60
|
export function createProcessInputRepo(db: LeitwerkDb) {
|
|
52
61
|
const list = (instanceId: string, unconsumed = false): ProcessInput[] =>
|
|
53
62
|
db
|
|
@@ -63,6 +72,7 @@ export function createProcessInputRepo(db: LeitwerkDb) {
|
|
|
63
72
|
.all()
|
|
64
73
|
.map(rowToProcessInput);
|
|
65
74
|
return {
|
|
75
|
+
/** @internal */
|
|
66
76
|
create(input: CreateProcessInputInput): ProcessInput {
|
|
67
77
|
const id = generateId("inp");
|
|
68
78
|
const ts = now();
|
|
@@ -83,9 +93,12 @@ export function createProcessInputRepo(db: LeitwerkDb) {
|
|
|
83
93
|
return rowToProcessInput(values);
|
|
84
94
|
},
|
|
85
95
|
|
|
96
|
+
/** @internal */
|
|
86
97
|
listByInstance: (instanceId: string) => list(instanceId),
|
|
98
|
+
/** @internal */
|
|
87
99
|
listUnconsumed: (instanceId: string) => list(instanceId, true),
|
|
88
100
|
|
|
101
|
+
/** @internal */
|
|
89
102
|
markConsumed(id: string): boolean {
|
|
90
103
|
const result = db
|
|
91
104
|
.update(s.processInputs)
|
|
@@ -95,11 +108,13 @@ export function createProcessInputRepo(db: LeitwerkDb) {
|
|
|
95
108
|
return result.changes > 0;
|
|
96
109
|
},
|
|
97
110
|
|
|
111
|
+
/** @internal */
|
|
98
112
|
delete(id: string): boolean {
|
|
99
113
|
const result = db.delete(s.processInputs).where(eq(s.processInputs.id, id)).run();
|
|
100
114
|
return result.changes > 0;
|
|
101
115
|
},
|
|
102
116
|
|
|
117
|
+
/** @internal */
|
|
103
118
|
getMaxSequence(instanceId: string): number {
|
|
104
119
|
const row = db
|
|
105
120
|
.select({ sequence: max(s.processInputs.sequence) })
|
|
@@ -15,23 +15,37 @@ import type { LeitwerkDb } from "./database.js";
|
|
|
15
15
|
import { generateId, now, parseMetadata, sqliteLikePatterns } from "./repo-helpers.js";
|
|
16
16
|
import * as s from "./schema.js";
|
|
17
17
|
|
|
18
|
+
/** @internal */
|
|
18
19
|
export interface ProcessLaunchIntent {
|
|
20
|
+
/** @internal */
|
|
19
21
|
launcherId: string;
|
|
22
|
+
/** @internal */
|
|
20
23
|
launcherInput: Record<string, unknown>;
|
|
21
24
|
}
|
|
22
25
|
|
|
26
|
+
/** @public */
|
|
23
27
|
export interface CreateProcessInstanceInput extends ProcessCustomizableFields {
|
|
28
|
+
/** @public */
|
|
24
29
|
processId: string;
|
|
30
|
+
/** @public */
|
|
25
31
|
selectedTurnId?: TurnId | null;
|
|
32
|
+
/** @public */
|
|
26
33
|
lifecycleStatus?: ProcessLifecycleStatus;
|
|
34
|
+
/** @internal */
|
|
27
35
|
currentExecution?: CurrentExecutionRef;
|
|
36
|
+
/** @internal */
|
|
28
37
|
selectedTurnModelKind?: ModelSelectionKind | null;
|
|
38
|
+
/** @internal */
|
|
29
39
|
selectedTurnModelSource?: ProcessSelectedTurnModelSource | null;
|
|
40
|
+
/** @public */
|
|
30
41
|
paramsJson?: string | null;
|
|
42
|
+
/** @public */
|
|
31
43
|
stateJson?: string | null;
|
|
44
|
+
/** @internal */
|
|
32
45
|
launchIntent?: ProcessLaunchIntent;
|
|
33
46
|
}
|
|
34
47
|
|
|
48
|
+
/** @internal */
|
|
35
49
|
export type ProcessOverviewStatusFilter =
|
|
36
50
|
| "all"
|
|
37
51
|
| "running"
|
|
@@ -40,26 +54,43 @@ export type ProcessOverviewStatusFilter =
|
|
|
40
54
|
| "aborted"
|
|
41
55
|
| "scheduled";
|
|
42
56
|
|
|
57
|
+
/** @internal */
|
|
43
58
|
export interface ProcessOverviewQuery {
|
|
59
|
+
/** @internal */
|
|
44
60
|
query?: string;
|
|
61
|
+
/** @internal */
|
|
45
62
|
processType?: string;
|
|
63
|
+
/** @internal */
|
|
46
64
|
status?: ProcessOverviewStatusFilter;
|
|
47
65
|
}
|
|
48
66
|
|
|
67
|
+
/** @internal */
|
|
49
68
|
export interface ProcessOverviewWindowQuery extends ProcessOverviewQuery {
|
|
69
|
+
/** @internal */
|
|
50
70
|
limit: number;
|
|
71
|
+
/** @internal */
|
|
51
72
|
sortKey: "status" | "title" | "timeline";
|
|
73
|
+
/** @internal */
|
|
52
74
|
sortDirection: "asc" | "desc";
|
|
53
75
|
}
|
|
54
76
|
|
|
77
|
+
/** @public */
|
|
55
78
|
export interface UpdateProcessInstanceInput extends ProcessCustomizableFields {
|
|
79
|
+
/** @internal */
|
|
56
80
|
selectedTurnId?: TurnId | null;
|
|
81
|
+
/** @internal */
|
|
57
82
|
lifecycleStatus?: ProcessLifecycleStatus;
|
|
83
|
+
/** @internal */
|
|
58
84
|
currentExecution?: CurrentExecutionRef;
|
|
85
|
+
/** @internal */
|
|
59
86
|
planRevision?: number;
|
|
87
|
+
/** @internal */
|
|
60
88
|
selectedTurnModelKind?: ModelSelectionKind | null;
|
|
89
|
+
/** @internal */
|
|
61
90
|
selectedTurnModelSource?: ProcessSelectedTurnModelSource | null;
|
|
91
|
+
/** @public */
|
|
62
92
|
paramsJson?: string | null;
|
|
93
|
+
/** @internal */
|
|
63
94
|
stateJson?: string | null;
|
|
64
95
|
}
|
|
65
96
|
|
|
@@ -159,8 +190,10 @@ function rowToProcessInstance(row: typeof s.processInstances.$inferSelect): Proc
|
|
|
159
190
|
};
|
|
160
191
|
}
|
|
161
192
|
|
|
193
|
+
/** @public */
|
|
162
194
|
export function createProcessInstanceRepo(db: LeitwerkDb) {
|
|
163
195
|
return {
|
|
196
|
+
/** @internal */
|
|
164
197
|
getLaunchIntent(instanceId: string): ProcessLaunchIntent | null {
|
|
165
198
|
const row = db
|
|
166
199
|
.select({ launchIntentJson: s.processInstances.launchIntentJson })
|
|
@@ -169,6 +202,7 @@ export function createProcessInstanceRepo(db: LeitwerkDb) {
|
|
|
169
202
|
.get();
|
|
170
203
|
return parseLaunchIntent(row?.launchIntentJson ?? null);
|
|
171
204
|
},
|
|
205
|
+
/** @public */
|
|
172
206
|
create(input: CreateProcessInstanceInput): ProcessInstance {
|
|
173
207
|
const id = generateId("agt");
|
|
174
208
|
const ts = now();
|
|
@@ -202,11 +236,13 @@ export function createProcessInstanceRepo(db: LeitwerkDb) {
|
|
|
202
236
|
return rowToProcessInstance({ ...values, planRevision: 0 });
|
|
203
237
|
},
|
|
204
238
|
|
|
239
|
+
/** @public */
|
|
205
240
|
getById(id: string): ProcessInstance | null {
|
|
206
241
|
const row = db.select().from(s.processInstances).where(eq(s.processInstances.id, id)).get();
|
|
207
242
|
return row ? rowToProcessInstance(row) : null;
|
|
208
243
|
},
|
|
209
244
|
|
|
245
|
+
/** @public */
|
|
210
246
|
listAll(): ProcessInstance[] {
|
|
211
247
|
return db
|
|
212
248
|
.select()
|
|
@@ -216,6 +252,7 @@ export function createProcessInstanceRepo(db: LeitwerkDb) {
|
|
|
216
252
|
.map(rowToProcessInstance);
|
|
217
253
|
},
|
|
218
254
|
|
|
255
|
+
/** @internal */
|
|
219
256
|
listCurrent(limit: number): ProcessInstance[] {
|
|
220
257
|
return db
|
|
221
258
|
.select()
|
|
@@ -227,6 +264,7 @@ export function createProcessInstanceRepo(db: LeitwerkDb) {
|
|
|
227
264
|
.map(rowToProcessInstance);
|
|
228
265
|
},
|
|
229
266
|
|
|
267
|
+
/** @internal */
|
|
230
268
|
countCurrent(): number {
|
|
231
269
|
return (
|
|
232
270
|
db
|
|
@@ -237,6 +275,7 @@ export function createProcessInstanceRepo(db: LeitwerkDb) {
|
|
|
237
275
|
);
|
|
238
276
|
},
|
|
239
277
|
|
|
278
|
+
/** @internal */
|
|
240
279
|
countOverview(input: ProcessOverviewQuery): number {
|
|
241
280
|
return (
|
|
242
281
|
db.select({ value: count() }).from(s.processInstances).where(overviewWhere(input)).get()
|
|
@@ -244,18 +283,30 @@ export function createProcessInstanceRepo(db: LeitwerkDb) {
|
|
|
244
283
|
);
|
|
245
284
|
},
|
|
246
285
|
|
|
286
|
+
/** @internal */
|
|
247
287
|
countOverviewByLifecycle(input: Pick<ProcessOverviewQuery, "query" | "processType">) {
|
|
248
288
|
return db
|
|
249
|
-
.select({
|
|
289
|
+
.select({
|
|
290
|
+
/** @internal */
|
|
291
|
+
lifecycleStatus: s.processInstances.lifecycleStatus,
|
|
292
|
+
/** @internal */
|
|
293
|
+
value: count(),
|
|
294
|
+
})
|
|
250
295
|
.from(s.processInstances)
|
|
251
296
|
.where(overviewWhere({ ...input, status: "all" }))
|
|
252
297
|
.groupBy(s.processInstances.lifecycleStatus)
|
|
253
298
|
.all();
|
|
254
299
|
},
|
|
255
300
|
|
|
301
|
+
/** @internal */
|
|
256
302
|
listOverviewProcessTypes(input: Pick<ProcessOverviewQuery, "query" | "status">) {
|
|
257
303
|
return db
|
|
258
|
-
.select({
|
|
304
|
+
.select({
|
|
305
|
+
/** @internal */
|
|
306
|
+
processId: s.processInstances.processId,
|
|
307
|
+
/** @internal */
|
|
308
|
+
value: count(),
|
|
309
|
+
})
|
|
259
310
|
.from(s.processInstances)
|
|
260
311
|
.where(overviewWhere(input))
|
|
261
312
|
.groupBy(s.processInstances.processId)
|
|
@@ -263,6 +314,7 @@ export function createProcessInstanceRepo(db: LeitwerkDb) {
|
|
|
263
314
|
.all();
|
|
264
315
|
},
|
|
265
316
|
|
|
317
|
+
/** @internal */
|
|
266
318
|
listOverviewWindow(input: ProcessOverviewWindowQuery): ProcessInstance[] {
|
|
267
319
|
const title = sql<string>`coalesce(${s.processInstances.title}, ${s.processInstances.externalId}, ${s.processInstances.id})`;
|
|
268
320
|
const status = sql<number>`case
|
|
@@ -290,6 +342,7 @@ export function createProcessInstanceRepo(db: LeitwerkDb) {
|
|
|
290
342
|
.map(rowToProcessInstance);
|
|
291
343
|
},
|
|
292
344
|
|
|
345
|
+
/** @internal */
|
|
293
346
|
setGeneratedTitleIfBlank(id: string, title: string): ProcessInstance | null {
|
|
294
347
|
const normalizedTitle = normalizeProcessTitleInput(title);
|
|
295
348
|
if (!normalizedTitle) {
|
|
@@ -308,6 +361,7 @@ export function createProcessInstanceRepo(db: LeitwerkDb) {
|
|
|
308
361
|
return result.changes > 0 ? this.getById(id) : null;
|
|
309
362
|
},
|
|
310
363
|
|
|
364
|
+
/** @public */
|
|
311
365
|
update(id: string, input: UpdateProcessInstanceInput): ProcessInstance | null {
|
|
312
366
|
const ts = now();
|
|
313
367
|
const setValues: SQLiteUpdateSetSource<typeof s.processInstances> = {
|
|
@@ -341,6 +395,7 @@ export function createProcessInstanceRepo(db: LeitwerkDb) {
|
|
|
341
395
|
return this.getById(id);
|
|
342
396
|
},
|
|
343
397
|
|
|
398
|
+
/** @internal */
|
|
344
399
|
delete(id: string): boolean {
|
|
345
400
|
const result = db.delete(s.processInstances).where(eq(s.processInstances.id, id)).run();
|
|
346
401
|
return result.changes > 0;
|
|
@@ -7,19 +7,33 @@ import type { LeitwerkDb } from "./database.js";
|
|
|
7
7
|
import { generateId, now, parseJsonRecord } from "./repo-helpers.js";
|
|
8
8
|
import * as s from "./schema.js";
|
|
9
9
|
|
|
10
|
+
/** @internal */
|
|
10
11
|
export interface CreateProcessLeafOutcomeSnapshotInput {
|
|
12
|
+
/** @internal */
|
|
11
13
|
id?: string;
|
|
14
|
+
/** @internal */
|
|
12
15
|
instanceId: string;
|
|
16
|
+
/** @internal */
|
|
13
17
|
leafEntryId: string;
|
|
18
|
+
/** @internal */
|
|
14
19
|
turnRecordId?: string | null;
|
|
20
|
+
/** @internal */
|
|
15
21
|
rendererId?: string | null;
|
|
22
|
+
/** @internal */
|
|
16
23
|
schemaVersion?: number | null;
|
|
24
|
+
/** @internal */
|
|
17
25
|
props?: Record<string, unknown> | null;
|
|
26
|
+
/** @internal */
|
|
18
27
|
fallbackMarkdown?: string | null;
|
|
28
|
+
/** @internal */
|
|
19
29
|
status: ProcessLeafOutcomeSnapshotStatus;
|
|
30
|
+
/** @internal */
|
|
20
31
|
warningCode?: string | null;
|
|
32
|
+
/** @internal */
|
|
21
33
|
warningMessage?: string | null;
|
|
34
|
+
/** @internal */
|
|
22
35
|
anchoredAt: string;
|
|
36
|
+
/** @internal */
|
|
23
37
|
createdAt?: string;
|
|
24
38
|
}
|
|
25
39
|
|
|
@@ -43,8 +57,10 @@ function rowToProcessLeafOutcomeSnapshot(
|
|
|
43
57
|
};
|
|
44
58
|
}
|
|
45
59
|
|
|
60
|
+
/** @internal */
|
|
46
61
|
export function createProcessLeafOutcomeSnapshotRepo(db: LeitwerkDb) {
|
|
47
62
|
return {
|
|
63
|
+
/** @internal */
|
|
48
64
|
create(input: CreateProcessLeafOutcomeSnapshotInput): ProcessLeafOutcomeSnapshot {
|
|
49
65
|
const values = {
|
|
50
66
|
id: input.id ?? generateId("los"),
|
|
@@ -65,6 +81,7 @@ export function createProcessLeafOutcomeSnapshotRepo(db: LeitwerkDb) {
|
|
|
65
81
|
return rowToProcessLeafOutcomeSnapshot(values);
|
|
66
82
|
},
|
|
67
83
|
|
|
84
|
+
/** @internal */
|
|
68
85
|
listByInstance(instanceId: string): ProcessLeafOutcomeSnapshot[] {
|
|
69
86
|
return db
|
|
70
87
|
.select()
|
|
@@ -78,6 +95,7 @@ export function createProcessLeafOutcomeSnapshotRepo(db: LeitwerkDb) {
|
|
|
78
95
|
.map(rowToProcessLeafOutcomeSnapshot);
|
|
79
96
|
},
|
|
80
97
|
|
|
98
|
+
/** @internal */
|
|
81
99
|
getByInstanceAndLeafEntryId(
|
|
82
100
|
instanceId: string,
|
|
83
101
|
leafEntryId: string,
|
|
@@ -9,20 +9,33 @@ import type { LeitwerkDb } from "./database.js";
|
|
|
9
9
|
import { generateId, now, parseMetadata } from "./repo-helpers.js";
|
|
10
10
|
import * as s from "./schema.js";
|
|
11
11
|
|
|
12
|
+
/** @internal */
|
|
12
13
|
export interface CreateProcessProjectInput extends UpdateProcessProjectInput {
|
|
14
|
+
/** @internal */
|
|
13
15
|
instanceId: string;
|
|
16
|
+
/** @internal */
|
|
14
17
|
key: string;
|
|
18
|
+
/** @internal */
|
|
15
19
|
repoLocator: string;
|
|
20
|
+
/** @internal */
|
|
16
21
|
baseBranch: string;
|
|
17
22
|
}
|
|
18
23
|
|
|
24
|
+
/** @public */
|
|
19
25
|
export interface UpdateProcessProjectInput {
|
|
26
|
+
/** @internal */
|
|
20
27
|
repoLocator?: string;
|
|
28
|
+
/** @internal */
|
|
21
29
|
workBranch?: string | null;
|
|
30
|
+
/** @internal */
|
|
22
31
|
externalId?: string | null;
|
|
32
|
+
/** @internal */
|
|
23
33
|
externalUrl?: string | null;
|
|
34
|
+
/** @public */
|
|
24
35
|
metadata?: Record<string, unknown> | null;
|
|
36
|
+
/** @internal */
|
|
25
37
|
pipelineStatus?: string | null;
|
|
38
|
+
/** @internal */
|
|
26
39
|
baseBranch?: string;
|
|
27
40
|
}
|
|
28
41
|
|
|
@@ -44,8 +57,10 @@ function rowToProcessProject(row: typeof s.processProjects.$inferSelect): Proces
|
|
|
44
57
|
};
|
|
45
58
|
}
|
|
46
59
|
|
|
60
|
+
/** @public */
|
|
47
61
|
export function createProcessProjectRepo(db: LeitwerkDb) {
|
|
48
62
|
return {
|
|
63
|
+
/** @internal */
|
|
49
64
|
create(input: CreateProcessProjectInput): ProcessProject {
|
|
50
65
|
const id = generateId("prj");
|
|
51
66
|
const ts = now();
|
|
@@ -70,11 +85,13 @@ export function createProcessProjectRepo(db: LeitwerkDb) {
|
|
|
70
85
|
return rowToProcessProject(values);
|
|
71
86
|
},
|
|
72
87
|
|
|
88
|
+
/** @internal */
|
|
73
89
|
getById(id: string): ProcessProject | null {
|
|
74
90
|
const row = db.select().from(s.processProjects).where(eq(s.processProjects.id, id)).get();
|
|
75
91
|
return row ? rowToProcessProject(row) : null;
|
|
76
92
|
},
|
|
77
93
|
|
|
94
|
+
/** @public */
|
|
78
95
|
listByInstance(instanceId: string): ProcessProject[] {
|
|
79
96
|
return db
|
|
80
97
|
.select()
|
|
@@ -84,6 +101,7 @@ export function createProcessProjectRepo(db: LeitwerkDb) {
|
|
|
84
101
|
.map(rowToProcessProject);
|
|
85
102
|
},
|
|
86
103
|
|
|
104
|
+
/** @internal */
|
|
87
105
|
listByInstances(instanceIds: readonly string[]): ProcessProject[] {
|
|
88
106
|
if (instanceIds.length === 0) {
|
|
89
107
|
return [];
|
|
@@ -96,6 +114,7 @@ export function createProcessProjectRepo(db: LeitwerkDb) {
|
|
|
96
114
|
.map(rowToProcessProject);
|
|
97
115
|
},
|
|
98
116
|
|
|
117
|
+
/** @internal */
|
|
99
118
|
getByInstanceAndKey(instanceId: string, key: string): ProcessProject | null {
|
|
100
119
|
const row = db
|
|
101
120
|
.select()
|
|
@@ -105,6 +124,7 @@ export function createProcessProjectRepo(db: LeitwerkDb) {
|
|
|
105
124
|
return row ? rowToProcessProject(row) : null;
|
|
106
125
|
},
|
|
107
126
|
|
|
127
|
+
/** @public */
|
|
108
128
|
update(id: string, input: UpdateProcessProjectInput): ProcessProject | null {
|
|
109
129
|
const previous = this.getById(id);
|
|
110
130
|
if (!previous) {
|
|
@@ -24,14 +24,21 @@ function map(row: typeof s.processQuestionRequests.$inferSelect): ProcessQuestio
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
/** @internal */
|
|
27
28
|
export interface CreateQuestionRequestInput {
|
|
29
|
+
/** @internal */
|
|
28
30
|
instanceId: string;
|
|
31
|
+
/** @internal */
|
|
29
32
|
turnRecordId: string;
|
|
33
|
+
/** @internal */
|
|
30
34
|
toolCallId: string;
|
|
35
|
+
/** @internal */
|
|
31
36
|
questions: readonly NormalizedQuestion[];
|
|
37
|
+
/** @internal */
|
|
32
38
|
askedAt?: string;
|
|
33
39
|
}
|
|
34
40
|
|
|
41
|
+
/** @internal */
|
|
35
42
|
export function createProcessQuestionRequestRepo(db: LeitwerkDb) {
|
|
36
43
|
const getById = (id: string): ProcessQuestionRequest | null => {
|
|
37
44
|
const row = db
|
|
@@ -55,11 +62,17 @@ export function createProcessQuestionRequestRepo(db: LeitwerkDb) {
|
|
|
55
62
|
.map(map);
|
|
56
63
|
};
|
|
57
64
|
return {
|
|
65
|
+
/** @internal */
|
|
58
66
|
getById,
|
|
67
|
+
/** @internal */
|
|
59
68
|
listByInstance: (instanceId: string) => list(instanceId),
|
|
69
|
+
/** @internal */
|
|
60
70
|
listOpen: (instanceId?: string) => list(instanceId, true),
|
|
71
|
+
/** @internal */
|
|
61
72
|
createIdempotent(input: CreateQuestionRequestInput): {
|
|
73
|
+
/** @internal */
|
|
62
74
|
kind: "created" | "replay";
|
|
75
|
+
/** @internal */
|
|
63
76
|
request: ProcessQuestionRequest;
|
|
64
77
|
} {
|
|
65
78
|
const existingRow = db
|
|
@@ -94,10 +107,15 @@ export function createProcessQuestionRequestRepo(db: LeitwerkDb) {
|
|
|
94
107
|
.get();
|
|
95
108
|
return { kind: "created", request: map(row) };
|
|
96
109
|
},
|
|
110
|
+
/** @internal */
|
|
97
111
|
answer(input: {
|
|
112
|
+
/** @internal */
|
|
98
113
|
id: string;
|
|
114
|
+
/** @internal */
|
|
99
115
|
answers: readonly string[];
|
|
116
|
+
/** @internal */
|
|
100
117
|
actor: Actor;
|
|
118
|
+
/** @internal */
|
|
101
119
|
answeredAt?: string;
|
|
102
120
|
}): ProcessQuestionRequest | null {
|
|
103
121
|
const row = db
|
|
@@ -118,6 +136,7 @@ export function createProcessQuestionRequestRepo(db: LeitwerkDb) {
|
|
|
118
136
|
.get();
|
|
119
137
|
return row ? map(row) : null;
|
|
120
138
|
},
|
|
139
|
+
/** @internal */
|
|
121
140
|
cancelOpenByTurn(instanceId: string, turnRecordId: string): number {
|
|
122
141
|
return Number(
|
|
123
142
|
db
|
|
@@ -15,10 +15,15 @@ function map(row: typeof s.processRelations.$inferSelect): ProcessRelation {
|
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
/** @internal */
|
|
18
19
|
export function createProcessRelationRepo(db: LeitwerkDb) {
|
|
19
20
|
return {
|
|
21
|
+
/** @internal */
|
|
20
22
|
create(
|
|
21
|
-
input: Omit<ProcessRelation, "kind" | "createdAt"> & {
|
|
23
|
+
input: Omit<ProcessRelation, "kind" | "createdAt"> & {
|
|
24
|
+
/** @internal */
|
|
25
|
+
createdAt?: string;
|
|
26
|
+
},
|
|
22
27
|
): ProcessRelation {
|
|
23
28
|
const row = db
|
|
24
29
|
.insert(s.processRelations)
|
|
@@ -34,6 +39,7 @@ export function createProcessRelationRepo(db: LeitwerkDb) {
|
|
|
34
39
|
.get();
|
|
35
40
|
return map(row);
|
|
36
41
|
},
|
|
42
|
+
/** @internal */
|
|
37
43
|
getByChild(childInstanceId: string): ProcessRelation | null {
|
|
38
44
|
const row = db
|
|
39
45
|
.select()
|
|
@@ -42,6 +48,7 @@ export function createProcessRelationRepo(db: LeitwerkDb) {
|
|
|
42
48
|
.get();
|
|
43
49
|
return row ? map(row) : null;
|
|
44
50
|
},
|
|
51
|
+
/** @internal */
|
|
45
52
|
listByParent(parentInstanceId: string): ProcessRelation[] {
|
|
46
53
|
return db
|
|
47
54
|
.select()
|
|
@@ -4,8 +4,10 @@ import { type PiResourceLayer, SKILL_RESOURCE_OWNER } from "../pi-resources/reso
|
|
|
4
4
|
import type { LeitwerkDb } from "./database.js";
|
|
5
5
|
import { processSkills, skillRevisions } from "./schema.js";
|
|
6
6
|
|
|
7
|
+
/** @internal */
|
|
7
8
|
export function createProcessSkillRepo(db: LeitwerkDb) {
|
|
8
9
|
return {
|
|
10
|
+
/** @internal */
|
|
9
11
|
attach(instanceId: string, selections: readonly SkillSelection[]): void {
|
|
10
12
|
const seen = new Set<string>();
|
|
11
13
|
selections.forEach((selection, position) => {
|
|
@@ -29,6 +31,7 @@ export function createProcessSkillRepo(db: LeitwerkDb) {
|
|
|
29
31
|
.run();
|
|
30
32
|
});
|
|
31
33
|
},
|
|
34
|
+
/** @internal */
|
|
32
35
|
listSelections(instanceId: string): SkillSelection[] {
|
|
33
36
|
return db
|
|
34
37
|
.select({
|
|
@@ -40,6 +43,7 @@ export function createProcessSkillRepo(db: LeitwerkDb) {
|
|
|
40
43
|
.orderBy(asc(processSkills.position))
|
|
41
44
|
.all();
|
|
42
45
|
},
|
|
46
|
+
/** @internal */
|
|
43
47
|
listResourceLayers(instanceId: string): PiResourceLayer[] {
|
|
44
48
|
return db
|
|
45
49
|
.select({
|