@leitwerk-dev/server 0.1.9 → 0.2.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-D4XHIbwA.d.ts +3250 -0
- package/dist/app-I4QQUL5B.js +10 -0
- package/dist/app-I4QQUL5B.js.map +1 -0
- package/dist/app.d.ts +4 -1
- package/dist/app.d.ts.map +1 -1
- package/dist/auth/api-token-audit.d.ts +3 -0
- package/dist/auth/api-token-audit.d.ts.map +1 -0
- package/dist/auth/api-token-policy.d.ts +8 -0
- package/dist/auth/api-token-policy.d.ts.map +1 -0
- package/dist/auth/api-token-routes.d.ts +4 -0
- package/dist/auth/api-token-routes.d.ts.map +1 -0
- package/dist/auth/api-token-service.d.ts +27 -0
- package/dist/auth/api-token-service.d.ts.map +1 -0
- package/dist/auth/auth-service.d.ts +3 -1
- package/dist/auth/auth-service.d.ts.map +1 -1
- package/dist/auth/auth-tokens.d.ts +4 -1
- package/dist/auth/auth-tokens.d.ts.map +1 -1
- package/dist/auth/fastify-auth.d.ts +10 -0
- package/dist/auth/fastify-auth.d.ts.map +1 -1
- package/dist/auth/routes.d.ts.map +1 -1
- package/dist/{chunk-2ESDXLNE.js → chunk-AGC2ND53.js} +6843 -4438
- package/dist/chunk-AGC2ND53.js.map +1 -0
- package/dist/{chunk-DFHOPJRZ.js → chunk-XTXH6623.js} +17275 -15915
- package/dist/chunk-XTXH6623.js.map +1 -0
- package/dist/config/config-loader.d.ts.map +1 -1
- package/dist/config/config-types.d.ts +56 -23
- package/dist/config/config-types.d.ts.map +1 -1
- package/dist/db/api-token-repo.d.ts +33 -0
- package/dist/db/api-token-repo.d.ts.map +1 -0
- package/dist/db/auth-repo.d.ts.map +1 -1
- package/dist/db/database.d.ts +9 -10
- package/dist/db/database.d.ts.map +1 -1
- package/dist/db/external-write-log-repo.d.ts +3 -6
- package/dist/db/external-write-log-repo.d.ts.map +1 -1
- package/dist/db/future-execution-repo.d.ts +0 -2
- package/dist/db/future-execution-repo.d.ts.map +1 -1
- package/dist/db/launch-run-repo.d.ts +22 -0
- package/dist/db/launch-run-repo.d.ts.map +1 -0
- package/dist/db/launcher-recent-value-repo.d.ts +0 -1
- package/dist/db/launcher-recent-value-repo.d.ts.map +1 -1
- package/dist/db/pending-external-source-fire-repo.d.ts +0 -2
- package/dist/db/pending-external-source-fire-repo.d.ts.map +1 -1
- package/dist/db/process-event-repo.d.ts +4 -0
- package/dist/db/process-event-repo.d.ts.map +1 -1
- package/dist/db/process-handoff-dedup-key-repo.d.ts +2 -5
- package/dist/db/process-handoff-dedup-key-repo.d.ts.map +1 -1
- package/dist/db/process-input-repo.d.ts +2 -2
- package/dist/db/process-input-repo.d.ts.map +1 -1
- package/dist/db/process-instance-repo.d.ts.map +1 -1
- package/dist/db/process-leaf-outcome-snapshot-repo.d.ts.map +1 -1
- package/dist/db/process-project-repo.d.ts +1 -7
- package/dist/db/process-project-repo.d.ts.map +1 -1
- package/dist/db/process-question-request-repo.d.ts.map +1 -1
- package/dist/db/process-relation-repo.d.ts +10 -0
- package/dist/db/process-relation-repo.d.ts.map +1 -0
- package/dist/db/process-title-job-repo.d.ts +9 -33
- package/dist/db/process-title-job-repo.d.ts.map +1 -1
- package/dist/db/process-tool-approval-request-repo.d.ts +27 -0
- package/dist/db/process-tool-approval-request-repo.d.ts.map +1 -0
- package/dist/db/process-turn-annotation-repo.d.ts.map +1 -1
- package/dist/db/process-turn-record-repo.d.ts +1 -15
- package/dist/db/process-turn-record-repo.d.ts.map +1 -1
- package/dist/db/repo-helpers.d.ts +2 -0
- package/dist/db/repo-helpers.d.ts.map +1 -1
- package/dist/db/repositories.d.ts +22 -0
- package/dist/db/repositories.d.ts.map +1 -1
- package/dist/db/schema-ddl.d.ts +0 -1
- package/dist/db/schema-ddl.d.ts.map +1 -1
- package/dist/db/schema.d.ts +2027 -1310
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/session-transfer-repo.d.ts +64 -0
- package/dist/db/session-transfer-repo.d.ts.map +1 -0
- package/dist/db/skill-repo.d.ts +2 -2
- package/dist/db/skill-repo.d.ts.map +1 -1
- package/dist/db/startup-observation-repo.d.ts +7 -0
- package/dist/db/startup-observation-repo.d.ts.map +1 -0
- package/dist/db/ticket-destination-recent-repo.d.ts +19 -0
- package/dist/db/ticket-destination-recent-repo.d.ts.map +1 -0
- package/dist/db/turn-summary-repo.d.ts +25 -0
- package/dist/db/turn-summary-repo.d.ts.map +1 -0
- package/dist/db/worker-lease-repo.d.ts +6 -0
- package/dist/db/worker-lease-repo.d.ts.map +1 -1
- package/dist/deployment-preflight.d.ts +1 -1
- package/dist/deployment-preflight.d.ts.map +1 -1
- package/dist/docker-registry-credentials.d.ts +5 -0
- package/dist/docker-registry-credentials.d.ts.map +1 -0
- package/dist/domain-logic/outcome-tools.d.ts.map +1 -1
- package/dist/domain-logic/process-state-machine.d.ts +0 -5
- package/dist/domain-logic/process-state-machine.d.ts.map +1 -1
- package/dist/domain-logic/turn-record-guards.d.ts +2 -2
- package/dist/domain-logic/turn-record-guards.d.ts.map +1 -1
- package/dist/effects/post-commit-effect.d.ts +4 -6
- package/dist/effects/post-commit-effect.d.ts.map +1 -1
- package/dist/effects/post-commit-runner.d.ts.map +1 -1
- package/dist/entry-ref-patch.d.ts +8 -0
- package/dist/entry-ref-patch.d.ts.map +1 -0
- package/dist/extension-ui/catalog.d.ts +5 -25
- package/dist/extension-ui/catalog.d.ts.map +1 -1
- package/dist/external-source-reporting.d.ts +4 -0
- package/dist/external-source-reporting.d.ts.map +1 -0
- package/dist/external-source-service.d.ts +5 -1
- package/dist/external-source-service.d.ts.map +1 -1
- package/dist/future-execution/execution.d.ts +3 -2
- package/dist/future-execution/execution.d.ts.map +1 -1
- package/dist/future-execution/index.d.ts +1 -1
- package/dist/future-execution/index.d.ts.map +1 -1
- package/dist/future-execution/launch-lifecycle.d.ts +136 -0
- package/dist/future-execution/launch-lifecycle.d.ts.map +1 -0
- package/dist/future-execution/lifecycle.d.ts +21 -77
- package/dist/future-execution/lifecycle.d.ts.map +1 -1
- package/dist/future-execution/reconciliation.d.ts.map +1 -1
- package/dist/future-execution/support.d.ts +11 -0
- package/dist/future-execution/support.d.ts.map +1 -1
- package/dist/future-execution-presenter.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +246 -29
- package/dist/index.js.map +1 -1
- package/dist/integration-tool-registry.d.ts +27 -5
- package/dist/integration-tool-registry.d.ts.map +1 -1
- package/dist/launch-coordinator-test-harness.d.ts +55 -0
- package/dist/launch-coordinator-test-harness.d.ts.map +1 -0
- package/dist/launch-coordinator.d.ts +72 -0
- package/dist/launch-coordinator.d.ts.map +1 -0
- package/dist/launch-idempotency.d.ts +17 -0
- package/dist/launch-idempotency.d.ts.map +1 -0
- package/dist/launch-pipeline.d.ts +105 -0
- package/dist/launch-pipeline.d.ts.map +1 -0
- package/dist/leaf-outcome-snapshot-capture.d.ts +1 -2
- package/dist/leaf-outcome-snapshot-capture.d.ts.map +1 -1
- package/dist/main.js +198 -71
- package/dist/main.js.map +1 -1
- package/dist/model-providers/builtin-server-adapter.d.ts.map +1 -1
- package/dist/model-providers/credentials.d.ts +2 -4
- package/dist/model-providers/credentials.d.ts.map +1 -1
- package/dist/model-providers/model-status-cache.d.ts.map +1 -1
- package/dist/model-providers/registry.d.ts.map +1 -1
- package/dist/physical-worker-starts.d.ts +8 -0
- package/dist/physical-worker-starts.d.ts.map +1 -0
- package/dist/pi-resources/assemble.d.ts.map +1 -1
- package/dist/pi-resources/bundle-cache.d.ts.map +1 -1
- package/dist/pi-resources/bundle-pin-lifecycle.d.ts.map +1 -1
- package/dist/pi-resources/resource-collector.d.ts +1 -0
- package/dist/pi-resources/resource-collector.d.ts.map +1 -1
- package/dist/primary-path-snapshot.d.ts +0 -4
- package/dist/primary-path-snapshot.d.ts.map +1 -1
- package/dist/process-action-next-turn-model.d.ts +1 -1
- package/dist/process-action-next-turn-model.d.ts.map +1 -1
- package/dist/process-action-planner.d.ts +1 -1
- package/dist/process-action-planner.d.ts.map +1 -1
- package/dist/process-action-registry.d.ts +6 -7
- package/dist/process-action-registry.d.ts.map +1 -1
- package/dist/process-attention-notifier.d.ts.map +1 -1
- package/dist/process-deletion-service.d.ts +3 -0
- package/dist/process-deletion-service.d.ts.map +1 -1
- package/dist/process-engine/engine.d.ts.map +1 -1
- package/dist/process-engine/operation.d.ts +7 -4
- package/dist/process-engine/operation.d.ts.map +1 -1
- package/dist/process-engine/ops/abort-process.d.ts +1 -0
- package/dist/process-engine/ops/abort-process.d.ts.map +1 -1
- package/dist/process-engine/ops/abort-turn.d.ts.map +1 -1
- package/dist/process-engine/ops/continue-failed-turn.d.ts +2 -7
- package/dist/process-engine/ops/continue-failed-turn.d.ts.map +1 -1
- package/dist/process-engine/ops/execute-action.d.ts +2 -10
- package/dist/process-engine/ops/execute-action.d.ts.map +1 -1
- package/dist/process-engine/ops/retry-failed-turn.d.ts.map +1 -1
- package/dist/process-engine/ops/retry-startup.d.ts +2 -0
- package/dist/process-engine/ops/retry-startup.d.ts.map +1 -1
- package/dist/process-engine/ops/start-process.d.ts +1 -0
- package/dist/process-engine/ops/start-process.d.ts.map +1 -1
- package/dist/process-engine/ops/turn-failed.d.ts +1 -0
- package/dist/process-engine/ops/turn-failed.d.ts.map +1 -1
- package/dist/process-engine/ops/turn-outcome.d.ts +1 -0
- package/dist/process-engine/ops/turn-outcome.d.ts.map +1 -1
- package/dist/process-engine/ops/update-semantic-refs.d.ts.map +1 -1
- package/dist/process-engine/ops/worker-failure.d.ts.map +1 -1
- package/dist/process-engine/runner.d.ts +2 -2
- package/dist/process-engine/runner.d.ts.map +1 -1
- package/dist/process-engine/startup-reconciliation.d.ts +2 -2
- package/dist/process-engine/startup-reconciliation.d.ts.map +1 -1
- package/dist/process-engine/turn-start-preflight.d.ts.map +1 -1
- package/dist/process-engine/types.d.ts +6 -9
- package/dist/process-engine/types.d.ts.map +1 -1
- package/dist/process-engine/writes/build-continue-failed-turn-writes.d.ts +2 -5
- package/dist/process-engine/writes/build-continue-failed-turn-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-process-abort-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-process-action-writes.d.ts +1 -1
- package/dist/process-engine/writes/build-process-action-writes.d.ts.map +1 -1
- 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 +17 -0
- package/dist/process-engine/writes/build-recovery-start-writes.d.ts.map +1 -0
- package/dist/process-engine/writes/build-retry-writes.d.ts +2 -5
- package/dist/process-engine/writes/build-retry-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-server-transition-writes.d.ts +6 -1
- package/dist/process-engine/writes/build-server-transition-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-turn-outcome-writes.d.ts +1 -1
- 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 +0 -1
- package/dist/process-engine/writes/build-turn-selection-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/commit-writes.d.ts +1 -0
- package/dist/process-engine/writes/commit-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/process-plan-collector.d.ts +14 -0
- package/dist/process-engine/writes/process-plan-collector.d.ts.map +1 -0
- package/dist/process-execution.d.ts +5 -0
- package/dist/process-execution.d.ts.map +1 -0
- package/dist/process-input-dispatch.d.ts +3 -8
- package/dist/process-input-dispatch.d.ts.map +1 -1
- package/dist/process-instance-tree-presenter.d.ts.map +1 -1
- package/dist/process-launch-executor.d.ts +37 -14
- package/dist/process-launch-executor.d.ts.map +1 -1
- package/dist/process-launch-pipeline-adapter.d.ts +17 -0
- package/dist/process-launch-pipeline-adapter.d.ts.map +1 -0
- package/dist/process-launch-plan.d.ts +2 -1
- package/dist/process-launch-plan.d.ts.map +1 -1
- package/dist/process-launcher-registry.d.ts.map +1 -1
- package/dist/process-model-policy/input.d.ts +1 -1
- package/dist/process-model-policy/input.d.ts.map +1 -1
- package/dist/process-model-selection.d.ts +1 -1
- package/dist/process-model-selection.d.ts.map +1 -1
- package/dist/process-operation-coordinator.d.ts.map +1 -1
- package/dist/process-operator-attention.d.ts.map +1 -1
- package/dist/process-overview-presenter.d.ts.map +1 -1
- package/dist/process-runtime-availability.d.ts +18 -0
- package/dist/process-runtime-availability.d.ts.map +1 -0
- package/dist/process-session-store.d.ts.map +1 -1
- package/dist/process-storage-size.d.ts +13 -0
- package/dist/process-storage-size.d.ts.map +1 -0
- package/dist/process-title-generator.d.ts +3 -0
- package/dist/process-title-generator.d.ts.map +1 -1
- package/dist/process-turn-navigation.d.ts +46 -0
- package/dist/process-turn-navigation.d.ts.map +1 -0
- package/dist/process-turn-trace.d.ts +6 -0
- package/dist/process-turn-trace.d.ts.map +1 -1
- package/dist/process-ui-registry.d.ts +0 -3
- package/dist/process-ui-registry.d.ts.map +1 -1
- package/dist/process-ui-snapshot-presenter.d.ts +28 -17
- package/dist/process-ui-snapshot-presenter.d.ts.map +1 -1
- package/dist/process-watcher-registry.d.ts.map +1 -1
- package/dist/product-ref-state.d.ts.map +1 -1
- package/dist/repository-credentials/service.d.ts +2 -2
- package/dist/repository-credentials/service.d.ts.map +1 -1
- package/dist/routes/bearer-token.d.ts +4 -0
- package/dist/routes/bearer-token.d.ts.map +1 -0
- package/dist/routes/internal-session-transfer-exports.d.ts +4 -0
- package/dist/routes/internal-session-transfer-exports.d.ts.map +1 -0
- package/dist/routes/internal-worker-auth.d.ts.map +1 -1
- package/dist/routes/internal-worker-session-snapshot.d.ts.map +1 -1
- package/dist/routes/launchers.d.ts.map +1 -1
- package/dist/routes/process-actions.d.ts.map +1 -1
- package/dist/routes/process-engine-http.d.ts.map +1 -1
- package/dist/routes/process-primary-path-assembler.d.ts.map +1 -1
- package/dist/routes/process-route-helpers.d.ts +13 -12
- package/dist/routes/process-route-helpers.d.ts.map +1 -1
- package/dist/routes/processes.d.ts.map +1 -1
- package/dist/routes/result-images.d.ts.map +1 -1
- package/dist/routes/session-transfers.d.ts +4 -0
- package/dist/routes/session-transfers.d.ts.map +1 -0
- package/dist/routes/skills.d.ts.map +1 -1
- package/dist/routes/ticket-creation.d.ts +5 -0
- package/dist/routes/ticket-creation.d.ts.map +1 -0
- package/dist/scheduled-action-preflight.d.ts +1 -1
- package/dist/scheduled-action-preflight.d.ts.map +1 -1
- package/dist/semantic-entry-ref-state.d.ts +2 -4
- package/dist/semantic-entry-ref-state.d.ts.map +1 -1
- package/dist/server-bootstrap/build-host-capabilities.d.ts +5 -8
- package/dist/server-bootstrap/build-host-capabilities.d.ts.map +1 -1
- package/dist/server-bootstrap/load-extension-catalog.d.ts.map +1 -1
- package/dist/server-bootstrap/register-http.d.ts +2 -0
- package/dist/server-bootstrap/register-http.d.ts.map +1 -1
- package/dist/server-bootstrap/register-websocket.d.ts.map +1 -1
- package/dist/session-summary-projection.d.ts +12 -0
- package/dist/session-summary-projection.d.ts.map +1 -0
- package/dist/session-transfer-helper-relays.d.ts +36 -0
- package/dist/session-transfer-helper-relays.d.ts.map +1 -0
- package/dist/session-transfer-service.d.ts +93 -0
- package/dist/session-transfer-service.d.ts.map +1 -0
- package/dist/skills/invocation-detector.d.ts.map +1 -1
- package/dist/skills/skill-frontmatter.d.ts +0 -2
- package/dist/skills/skill-frontmatter.d.ts.map +1 -1
- package/dist/skills/source-importer.d.ts +1 -1
- package/dist/skills/source-importer.d.ts.map +1 -1
- package/dist/startup-evidence.d.ts +32 -0
- package/dist/startup-evidence.d.ts.map +1 -0
- package/dist/supervisor/accepted-turn-start-replay.d.ts +0 -1
- package/dist/supervisor/accepted-turn-start-replay.d.ts.map +1 -1
- package/dist/supervisor/adoption/worker-adoption-coordinator.d.ts +4 -5
- package/dist/supervisor/adoption/worker-adoption-coordinator.d.ts.map +1 -1
- package/dist/supervisor/diagnostic-trace-writer.d.ts +5 -0
- package/dist/supervisor/diagnostic-trace-writer.d.ts.map +1 -0
- package/dist/supervisor/ipc-handler.d.ts +6 -11
- package/dist/supervisor/ipc-handler.d.ts.map +1 -1
- package/dist/supervisor/record-worker-lifecycle-event.d.ts +10 -0
- package/dist/supervisor/record-worker-lifecycle-event.d.ts.map +1 -0
- package/dist/supervisor/stale-heartbeat-watchdog.d.ts +1 -1
- package/dist/supervisor/stale-heartbeat-watchdog.d.ts.map +1 -1
- package/dist/supervisor/startup-observer.d.ts +14 -0
- package/dist/supervisor/startup-observer.d.ts.map +1 -0
- package/dist/supervisor/worker-capacity-queue.d.ts +15 -0
- package/dist/supervisor/worker-capacity-queue.d.ts.map +1 -0
- package/dist/supervisor/worker-connect-token.d.ts +4 -3
- package/dist/supervisor/worker-connect-token.d.ts.map +1 -1
- package/dist/supervisor/worker-event-ingestor.d.ts +2 -0
- package/dist/supervisor/worker-event-ingestor.d.ts.map +1 -1
- package/dist/supervisor/worker-lease-observer.d.ts +1 -0
- package/dist/supervisor/worker-lease-observer.d.ts.map +1 -1
- package/dist/supervisor/worker-shutdown-controller.d.ts.map +1 -1
- package/dist/supervisor/worker-start-payload-builder.d.ts +7 -5
- package/dist/supervisor/worker-start-payload-builder.d.ts.map +1 -1
- package/dist/supervisor/worker-storage-layout.d.ts +1 -0
- package/dist/supervisor/worker-storage-layout.d.ts.map +1 -1
- package/dist/supervisor/worker-supervisor.d.ts +10 -2
- package/dist/supervisor/worker-supervisor.d.ts.map +1 -1
- package/dist/supervisor/worker-turn-ipc-recorder.d.ts +11 -1
- package/dist/supervisor/worker-turn-ipc-recorder.d.ts.map +1 -1
- package/dist/supervisor/worker-unit-reclaimer.d.ts +23 -0
- package/dist/supervisor/worker-unit-reclaimer.d.ts.map +1 -0
- package/dist/supervisor/worker-websocket-ipc.d.ts.map +1 -1
- package/dist/test-helpers/accepted-turn-start.d.ts +24 -0
- package/dist/test-helpers/accepted-turn-start.d.ts.map +1 -0
- package/dist/test-helpers/ipc-handler-harness.d.ts +3 -1
- package/dist/test-helpers/ipc-handler-harness.d.ts.map +1 -1
- package/dist/test-helpers/process-binding-fixtures.d.ts.map +1 -1
- package/dist/test-helpers/process-fixtures.d.ts +1 -6
- package/dist/test-helpers/process-fixtures.d.ts.map +1 -1
- package/dist/test-helpers/session-snapshot-fixtures.d.ts +4 -0
- package/dist/test-helpers/session-snapshot-fixtures.d.ts.map +1 -0
- package/dist/test-helpers/structural-process-fixtures.d.ts +2 -2
- package/dist/test-helpers/structural-process-fixtures.d.ts.map +1 -1
- package/dist/test-helpers/unit-deps.d.ts +2 -0
- package/dist/test-helpers/unit-deps.d.ts.map +1 -1
- package/dist/test-helpers/worker-runner-runtime.d.ts +3 -0
- package/dist/test-helpers/worker-runner-runtime.d.ts.map +1 -0
- package/dist/testing.d.ts +2 -0
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +411 -6
- package/dist/testing.js.map +1 -1
- package/dist/tool-approval-gate.d.ts +32 -0
- package/dist/tool-approval-gate.d.ts.map +1 -0
- package/dist/turn-preparation.d.ts +13 -0
- package/dist/turn-preparation.d.ts.map +1 -0
- package/dist/turn-progress.d.ts +1 -0
- package/dist/turn-progress.d.ts.map +1 -1
- package/dist/{semantic-turn-result-markdown.d.ts → turn-result-markdown.d.ts} +10 -5
- package/dist/turn-result-markdown.d.ts.map +1 -0
- package/dist/worker-runtime-profile-selection.d.ts +2 -3
- package/dist/worker-runtime-profile-selection.d.ts.map +1 -1
- package/package.json +13 -14
- package/src/app.ts +208 -13
- package/src/auth/api-token-audit.ts +25 -0
- package/src/auth/api-token-policy.ts +56 -0
- package/src/auth/api-token-routes.ts +113 -0
- package/src/auth/api-token-service.ts +118 -0
- package/src/auth/auth-service.ts +9 -1
- package/src/auth/auth-tokens.ts +22 -3
- package/src/auth/fastify-auth.ts +54 -13
- package/src/auth/routes.ts +6 -5
- package/src/config/config-loader.ts +145 -99
- package/src/config/config-types.ts +53 -24
- package/src/db/api-token-repo.ts +90 -0
- package/src/db/auth-repo.ts +4 -15
- package/src/db/database.ts +492 -70
- package/src/db/external-write-log-repo.ts +2 -6
- package/src/db/future-execution-repo.ts +12 -22
- package/src/db/launch-run-repo.ts +143 -0
- package/src/db/launcher-recent-value-repo.ts +22 -60
- package/src/db/pending-external-source-fire-repo.ts +6 -30
- package/src/db/process-event-repo.ts +116 -55
- package/src/db/process-handoff-dedup-key-repo.ts +2 -6
- package/src/db/process-input-repo.ts +18 -24
- package/src/db/process-instance-repo.ts +19 -38
- package/src/db/process-leaf-outcome-snapshot-repo.ts +2 -16
- package/src/db/process-project-repo.ts +12 -36
- package/src/db/process-question-request-repo.ts +13 -11
- package/src/db/process-relation-repo.ts +55 -0
- package/src/db/process-title-job-repo.ts +84 -190
- package/src/db/process-tool-approval-request-repo.ts +145 -0
- package/src/db/process-turn-annotation-repo.ts +6 -19
- package/src/db/process-turn-record-repo.ts +17 -33
- package/src/db/repo-helpers.ts +15 -0
- package/src/db/repositories.ts +34 -3
- package/src/db/schema-ddl.ts +3 -10
- package/src/db/schema.ts +246 -12
- package/src/db/session-transfer-repo.ts +286 -0
- package/src/db/skill-repo.ts +64 -77
- package/src/db/startup-observation-repo.ts +40 -0
- package/src/db/ticket-destination-recent-repo.ts +92 -0
- package/src/db/turn-summary-repo.ts +68 -0
- package/src/db/worker-lease-repo.ts +48 -11
- package/src/deployment-preflight.ts +9 -5
- package/src/docker-registry-credentials.ts +21 -0
- package/src/domain-logic/outcome-tools.ts +47 -134
- package/src/domain-logic/process-state-machine.ts +47 -94
- package/src/domain-logic/turn-record-guards.ts +4 -8
- package/src/effects/post-commit-effect.ts +9 -8
- package/src/effects/post-commit-runner.ts +33 -58
- package/src/entry-ref-patch.ts +56 -0
- package/src/extension-ui/catalog.ts +11 -42
- package/src/external-source-reporting.ts +37 -0
- package/src/external-source-service.ts +267 -301
- package/src/future-execution/execution.ts +123 -56
- package/src/future-execution/index.ts +2 -0
- package/src/future-execution/launch-lifecycle.ts +665 -0
- package/src/future-execution/lifecycle.ts +57 -653
- package/src/future-execution/reconciliation.ts +10 -14
- package/src/future-execution/support.ts +20 -0
- package/src/future-execution-presenter.ts +18 -46
- package/src/index.ts +0 -4
- package/src/integration-tool-registry.ts +422 -27
- package/src/launch-coordinator-test-harness.ts +155 -0
- package/src/launch-coordinator.ts +719 -0
- package/src/launch-idempotency.ts +30 -0
- package/src/launch-pipeline.ts +365 -0
- package/src/leaf-outcome-snapshot-capture.ts +2 -20
- package/src/model-providers/builtin-server-adapter.ts +25 -4
- package/src/model-providers/credentials.ts +10 -36
- package/src/model-providers/model-status-cache.ts +42 -70
- package/src/model-providers/registry.ts +1 -4
- package/src/physical-worker-starts.ts +64 -0
- package/src/pi-resources/assemble.ts +4 -11
- package/src/pi-resources/bundle-cache.ts +17 -41
- package/src/pi-resources/bundle-pin-lifecycle.ts +6 -11
- package/src/pi-resources/resource-collector.ts +13 -29
- package/src/primary-path-snapshot.ts +12 -29
- package/src/process-action-next-turn-model.ts +1 -4
- package/src/process-action-planner.ts +1 -1
- package/src/process-action-registry.ts +81 -182
- package/src/process-attention-notifier.ts +2 -8
- package/src/process-deletion-service.ts +40 -31
- package/src/process-engine/engine.ts +16 -25
- package/src/process-engine/operation.ts +8 -5
- package/src/process-engine/ops/abort-process.ts +12 -9
- package/src/process-engine/ops/abort-turn.ts +5 -6
- package/src/process-engine/ops/continue-failed-turn.ts +4 -15
- package/src/process-engine/ops/execute-action.ts +5 -9
- package/src/process-engine/ops/retry-failed-turn.ts +2 -29
- package/src/process-engine/ops/retry-startup.ts +24 -4
- package/src/process-engine/ops/start-process.ts +10 -1
- package/src/process-engine/ops/turn-failed.ts +5 -3
- package/src/process-engine/ops/turn-outcome.ts +51 -47
- package/src/process-engine/ops/update-semantic-refs.ts +1 -9
- package/src/process-engine/ops/worker-failure.ts +15 -10
- package/src/process-engine/runner.ts +24 -47
- package/src/process-engine/startup-reconciliation.ts +19 -48
- package/src/process-engine/turn-start-preflight.ts +2 -14
- package/src/process-engine/types.ts +7 -11
- package/src/process-engine/writes/build-continue-failed-turn-writes.ts +17 -56
- package/src/process-engine/writes/build-process-abort-writes.ts +11 -34
- package/src/process-engine/writes/build-process-action-writes.ts +36 -150
- package/src/process-engine/writes/build-process-park-writes.ts +11 -14
- package/src/process-engine/writes/build-recovery-start-writes.ts +71 -0
- package/src/process-engine/writes/build-retry-writes.ts +10 -60
- package/src/process-engine/writes/build-server-transition-writes.ts +35 -87
- package/src/process-engine/writes/build-turn-outcome-writes.ts +15 -91
- package/src/process-engine/writes/build-turn-selection-writes.ts +23 -75
- package/src/process-engine/writes/commit-writes.ts +20 -8
- package/src/process-engine/writes/process-plan-collector.ts +77 -0
- package/src/process-execution.ts +10 -0
- package/src/process-input-dispatch.ts +2 -12
- package/src/process-instance-tree-presenter.ts +6 -23
- package/src/process-launch-executor.ts +109 -64
- package/src/process-launch-pipeline-adapter.ts +57 -0
- package/src/process-launch-plan.ts +19 -0
- package/src/process-launcher-registry.ts +38 -58
- package/src/process-model-policy/input.ts +5 -12
- package/src/process-model-selection.ts +1 -4
- package/src/process-operation-coordinator.ts +1 -4
- package/src/process-operator-attention.ts +2 -10
- package/src/process-overview-presenter.ts +30 -41
- package/src/process-runtime-availability.ts +74 -0
- package/src/process-session-store.ts +13 -4
- package/src/process-storage-size.ts +45 -0
- package/src/process-title-generator.ts +56 -21
- package/src/process-turn-navigation.ts +24 -0
- package/src/process-turn-trace.ts +92 -202
- package/src/process-ui-registry.ts +5 -16
- package/src/process-ui-snapshot-presenter.ts +343 -199
- package/src/process-watcher-registry.ts +53 -50
- package/src/product-ref-state.ts +4 -70
- package/src/repository-credentials/service.ts +40 -9
- package/src/routes/bearer-token.ts +10 -0
- package/src/routes/internal-session-transfer-exports.ts +65 -0
- package/src/routes/internal-worker-auth.ts +2 -3
- package/src/routes/internal-worker-session-snapshot.ts +17 -31
- package/src/routes/launchers.ts +70 -6
- package/src/routes/process-actions.ts +12 -23
- package/src/routes/process-engine-http.ts +14 -16
- package/src/routes/process-primary-path-assembler.ts +2 -9
- package/src/routes/process-route-helpers.ts +54 -82
- package/src/routes/processes.ts +8 -0
- package/src/routes/result-images.ts +5 -9
- package/src/routes/session-transfers.ts +144 -0
- package/src/routes/skills.ts +3 -1
- package/src/routes/ticket-creation.ts +240 -0
- package/src/scheduled-action-preflight.ts +1 -1
- package/src/semantic-entry-ref-state.ts +5 -85
- package/src/server-bootstrap/build-host-capabilities.ts +29 -48
- package/src/server-bootstrap/load-extension-catalog.ts +4 -8
- package/src/server-bootstrap/register-http.ts +17 -1
- package/src/server-bootstrap/register-websocket.ts +3 -6
- package/src/session-summary-projection.ts +110 -0
- package/src/session-transfer-helper-relays.ts +201 -0
- package/src/session-transfer-service.ts +439 -0
- package/src/skills/invocation-detector.ts +1 -6
- package/src/skills/skill-frontmatter.ts +9 -5
- package/src/skills/source-importer.ts +32 -16
- package/src/startup-evidence.ts +388 -0
- package/src/supervisor/accepted-turn-start-replay.ts +1 -2
- package/src/supervisor/adoption/worker-adoption-coordinator.ts +22 -19
- package/src/supervisor/diagnostic-trace-writer.ts +18 -0
- package/src/supervisor/ipc-handler.ts +47 -54
- package/src/supervisor/record-worker-lifecycle-event.ts +18 -0
- package/src/supervisor/stale-heartbeat-watchdog.ts +41 -31
- package/src/supervisor/startup-observer.ts +98 -0
- package/src/supervisor/worker-capacity-queue.ts +72 -0
- package/src/supervisor/worker-connect-token.ts +5 -14
- package/src/supervisor/worker-event-ingestor.ts +73 -21
- package/src/supervisor/worker-lease-observer.ts +2 -0
- package/src/supervisor/worker-shutdown-controller.ts +14 -13
- package/src/supervisor/worker-start-payload-builder.ts +106 -77
- package/src/supervisor/worker-storage-layout.ts +8 -1
- package/src/supervisor/worker-supervisor.ts +295 -143
- package/src/supervisor/worker-turn-ipc-recorder.ts +100 -58
- package/src/supervisor/worker-unit-reclaimer.ts +136 -0
- package/src/supervisor/worker-websocket-ipc.ts +6 -20
- package/src/test-helpers/accepted-turn-start.ts +79 -0
- package/src/test-helpers/ipc-handler-harness.ts +5 -0
- package/src/test-helpers/process-binding-fixtures.ts +1 -5
- package/src/test-helpers/process-fixtures.ts +4 -35
- package/src/test-helpers/session-snapshot-fixtures.ts +20 -0
- package/src/test-helpers/structural-process-fixtures.ts +1 -10
- package/src/test-helpers/unit-deps.ts +20 -0
- package/src/test-helpers/worker-runner-runtime.ts +32 -0
- package/src/testing.ts +5 -0
- package/src/tool-approval-gate.ts +116 -0
- package/src/turn-preparation.ts +53 -0
- package/src/turn-progress.ts +43 -27
- package/src/turn-result-markdown.ts +102 -0
- package/src/worker-runtime-profile-selection.ts +15 -9
- package/dist/app.js +0 -922
- package/dist/app.js.map +0 -1
- package/dist/auth/auth-client.js +0 -19
- package/dist/auth/auth-client.js.map +0 -1
- package/dist/auth/auth-config.js +0 -52
- package/dist/auth/auth-config.js.map +0 -1
- package/dist/auth/auth-service.js +0 -133
- package/dist/auth/auth-service.js.map +0 -1
- package/dist/auth/auth-test-helpers.js +0 -30
- package/dist/auth/auth-test-helpers.js.map +0 -1
- package/dist/auth/auth-tokens.js +0 -11
- package/dist/auth/auth-tokens.js.map +0 -1
- package/dist/auth/fastify-auth.js +0 -20
- package/dist/auth/fastify-auth.js.map +0 -1
- package/dist/auth/github-oauth-client.js +0 -79
- package/dist/auth/github-oauth-client.js.map +0 -1
- package/dist/auth/oidc-client.js +0 -55
- package/dist/auth/oidc-client.js.map +0 -1
- package/dist/auth/routes.js +0 -74
- package/dist/auth/routes.js.map +0 -1
- package/dist/chunk-2ESDXLNE.js.map +0 -1
- package/dist/chunk-DFHOPJRZ.js.map +0 -1
- package/dist/commit-message-policy.js +0 -15
- package/dist/commit-message-policy.js.map +0 -1
- package/dist/config/config-loader.js +0 -838
- package/dist/config/config-loader.js.map +0 -1
- package/dist/config/config-types.js +0 -2
- package/dist/config/config-types.js.map +0 -1
- package/dist/config/index.js +0 -2
- package/dist/config/index.js.map +0 -1
- package/dist/config/url-policy.js +0 -25
- package/dist/config/url-policy.js.map +0 -1
- package/dist/db/auth-repo.js +0 -92
- package/dist/db/auth-repo.js.map +0 -1
- package/dist/db/credential-cipher.js +0 -47
- package/dist/db/credential-cipher.js.map +0 -1
- package/dist/db/database.js +0 -423
- package/dist/db/database.js.map +0 -1
- package/dist/db/external-write-log-repo.js +0 -49
- package/dist/db/external-write-log-repo.js.map +0 -1
- package/dist/db/future-execution-repo.js +0 -267
- package/dist/db/future-execution-repo.js.map +0 -1
- package/dist/db/index.js +0 -4
- package/dist/db/index.js.map +0 -1
- package/dist/db/launcher-recent-value-repo.js +0 -76
- package/dist/db/launcher-recent-value-repo.js.map +0 -1
- package/dist/db/pending-external-source-fire-repo.js +0 -108
- package/dist/db/pending-external-source-fire-repo.js.map +0 -1
- package/dist/db/process-event-repo.js +0 -98
- package/dist/db/process-event-repo.js.map +0 -1
- package/dist/db/process-handoff-dedup-key-repo.js +0 -34
- package/dist/db/process-handoff-dedup-key-repo.js.map +0 -1
- package/dist/db/process-input-repo.js +0 -90
- package/dist/db/process-input-repo.js.map +0 -1
- package/dist/db/process-instance-repo.js +0 -281
- package/dist/db/process-instance-repo.js.map +0 -1
- package/dist/db/process-leaf-outcome-snapshot-repo.js +0 -77
- package/dist/db/process-leaf-outcome-snapshot-repo.js.map +0 -1
- package/dist/db/process-project-repo.js +0 -129
- package/dist/db/process-project-repo.js.map +0 -1
- package/dist/db/process-question-request-repo.js +0 -99
- package/dist/db/process-question-request-repo.js.map +0 -1
- package/dist/db/process-skill-repo.js +0 -58
- package/dist/db/process-skill-repo.js.map +0 -1
- package/dist/db/process-title-job-repo.js +0 -173
- package/dist/db/process-title-job-repo.js.map +0 -1
- package/dist/db/process-turn-annotation-repo.js +0 -104
- package/dist/db/process-turn-annotation-repo.js.map +0 -1
- package/dist/db/process-turn-record-repo.js +0 -125
- package/dist/db/process-turn-record-repo.js.map +0 -1
- package/dist/db/provider-credential-repo.js +0 -60
- package/dist/db/provider-credential-repo.js.map +0 -1
- package/dist/db/repo-helpers.js +0 -20
- package/dist/db/repo-helpers.js.map +0 -1
- package/dist/db/repositories.js +0 -73
- package/dist/db/repositories.js.map +0 -1
- package/dist/db/schema-ddl.js +0 -99
- package/dist/db/schema-ddl.js.map +0 -1
- package/dist/db/schema.js +0 -475
- package/dist/db/schema.js.map +0 -1
- package/dist/db/skill-repo.js +0 -468
- package/dist/db/skill-repo.js.map +0 -1
- package/dist/db/turn-start-record-repo.js +0 -67
- package/dist/db/turn-start-record-repo.js.map +0 -1
- package/dist/db/worker-lease-repo.js +0 -109
- package/dist/db/worker-lease-repo.js.map +0 -1
- package/dist/deployment-preflight.js +0 -69
- package/dist/deployment-preflight.js.map +0 -1
- package/dist/domain-logic/cron.js +0 -25
- package/dist/domain-logic/cron.js.map +0 -1
- package/dist/domain-logic/outcome-tools.js +0 -267
- package/dist/domain-logic/outcome-tools.js.map +0 -1
- package/dist/domain-logic/process-state-machine.js +0 -140
- package/dist/domain-logic/process-state-machine.js.map +0 -1
- package/dist/domain-logic/scheduled-action-lock.js +0 -39
- package/dist/domain-logic/scheduled-action-lock.js.map +0 -1
- package/dist/domain-logic/turn-record-guards.js +0 -26
- package/dist/domain-logic/turn-record-guards.js.map +0 -1
- package/dist/domain-logic/worker-lease-lifecycle.js +0 -77
- package/dist/domain-logic/worker-lease-lifecycle.js.map +0 -1
- package/dist/effects/post-commit-effect.js +0 -8
- package/dist/effects/post-commit-effect.js.map +0 -1
- package/dist/effects/post-commit-runner.js +0 -215
- package/dist/effects/post-commit-runner.js.map +0 -1
- package/dist/extension-ui/catalog.js +0 -265
- package/dist/extension-ui/catalog.js.map +0 -1
- package/dist/extensions/extension-host.js +0 -34
- package/dist/extensions/extension-host.js.map +0 -1
- package/dist/external-source-service.js +0 -1036
- package/dist/external-source-service.js.map +0 -1
- package/dist/future-execution/execution.js +0 -309
- package/dist/future-execution/execution.js.map +0 -1
- package/dist/future-execution/index.js +0 -2
- package/dist/future-execution/index.js.map +0 -1
- package/dist/future-execution/lifecycle.js +0 -783
- package/dist/future-execution/lifecycle.js.map +0 -1
- package/dist/future-execution/model-projection.js +0 -98
- package/dist/future-execution/model-projection.js.map +0 -1
- package/dist/future-execution/reconciliation.js +0 -91
- package/dist/future-execution/reconciliation.js.map +0 -1
- package/dist/future-execution/support.js +0 -36
- package/dist/future-execution/support.js.map +0 -1
- package/dist/future-execution/transition-planner.js +0 -84
- package/dist/future-execution/transition-planner.js.map +0 -1
- package/dist/future-execution-broadcast.js +0 -13
- package/dist/future-execution-broadcast.js.map +0 -1
- package/dist/future-execution-presenter.js +0 -143
- package/dist/future-execution-presenter.js.map +0 -1
- package/dist/future-execution-scheduler.js +0 -37
- package/dist/future-execution-scheduler.js.map +0 -1
- package/dist/instance-tree.js +0 -41
- package/dist/instance-tree.js.map +0 -1
- package/dist/integration-tool-registry.js +0 -140
- package/dist/integration-tool-registry.js.map +0 -1
- package/dist/launch-title.js +0 -36
- package/dist/launch-title.js.map +0 -1
- package/dist/launcher-model-config-service.js +0 -73
- package/dist/launcher-model-config-service.js.map +0 -1
- package/dist/launcher-recent-values-service.js +0 -43
- package/dist/launcher-recent-values-service.js.map +0 -1
- package/dist/leaf-outcome-snapshot-capture.js +0 -101
- package/dist/leaf-outcome-snapshot-capture.js.map +0 -1
- package/dist/live-turn-projection.d.ts +0 -2
- package/dist/live-turn-projection.d.ts.map +0 -1
- package/dist/live-turn-projection.js +0 -2
- package/dist/live-turn-projection.js.map +0 -1
- package/dist/model-providers/builtin-server-adapter.js +0 -73
- package/dist/model-providers/builtin-server-adapter.js.map +0 -1
- package/dist/model-providers/credentials.js +0 -165
- package/dist/model-providers/credentials.js.map +0 -1
- package/dist/model-providers/index.js +0 -7
- package/dist/model-providers/index.js.map +0 -1
- package/dist/model-providers/model-status-cache.js +0 -220
- package/dist/model-providers/model-status-cache.js.map +0 -1
- package/dist/model-providers/provider-boundary-utils.js +0 -32
- package/dist/model-providers/provider-boundary-utils.js.map +0 -1
- package/dist/model-providers/provider-options.js +0 -76
- package/dist/model-providers/provider-options.js.map +0 -1
- package/dist/model-providers/registry.js +0 -138
- package/dist/model-providers/registry.js.map +0 -1
- package/dist/model-providers/server-adapters.js +0 -63
- package/dist/model-providers/server-adapters.js.map +0 -1
- package/dist/pi-resources/assemble.js +0 -275
- package/dist/pi-resources/assemble.js.map +0 -1
- package/dist/pi-resources/bundle-cache.js +0 -125
- package/dist/pi-resources/bundle-cache.js.map +0 -1
- package/dist/pi-resources/bundle-pin-lifecycle.js +0 -41
- package/dist/pi-resources/bundle-pin-lifecycle.js.map +0 -1
- package/dist/pi-resources/index.js +0 -4
- package/dist/pi-resources/index.js.map +0 -1
- package/dist/pi-resources/resource-collector.js +0 -163
- package/dist/pi-resources/resource-collector.js.map +0 -1
- package/dist/pi-session-tree.js +0 -106
- package/dist/pi-session-tree.js.map +0 -1
- package/dist/primary-path-snapshot.js +0 -246
- package/dist/primary-path-snapshot.js.map +0 -1
- package/dist/process-action-input-validation.js +0 -75
- package/dist/process-action-input-validation.js.map +0 -1
- package/dist/process-action-next-turn-model.js +0 -102
- package/dist/process-action-next-turn-model.js.map +0 -1
- package/dist/process-action-planner.js +0 -93
- package/dist/process-action-planner.js.map +0 -1
- package/dist/process-action-registry.js +0 -335
- package/dist/process-action-registry.js.map +0 -1
- package/dist/process-attention-notifier.js +0 -41
- package/dist/process-attention-notifier.js.map +0 -1
- package/dist/process-deletion-service.js +0 -48
- package/dist/process-deletion-service.js.map +0 -1
- package/dist/process-engine/decision.js +0 -22
- package/dist/process-engine/decision.js.map +0 -1
- package/dist/process-engine/engine.js +0 -168
- package/dist/process-engine/engine.js.map +0 -1
- package/dist/process-engine/index.js +0 -8
- package/dist/process-engine/index.js.map +0 -1
- package/dist/process-engine/internal-failures.js +0 -32
- package/dist/process-engine/internal-failures.js.map +0 -1
- package/dist/process-engine/operation.js +0 -4
- package/dist/process-engine/operation.js.map +0 -1
- package/dist/process-engine/ops/abort-process.js +0 -104
- package/dist/process-engine/ops/abort-process.js.map +0 -1
- package/dist/process-engine/ops/abort-turn.js +0 -48
- package/dist/process-engine/ops/abort-turn.js.map +0 -1
- package/dist/process-engine/ops/accept-worker-turn-start.js +0 -137
- package/dist/process-engine/ops/accept-worker-turn-start.js.map +0 -1
- package/dist/process-engine/ops/continue-failed-turn.js +0 -109
- package/dist/process-engine/ops/continue-failed-turn.js.map +0 -1
- package/dist/process-engine/ops/deferred-process-activation.js +0 -98
- package/dist/process-engine/ops/deferred-process-activation.js.map +0 -1
- package/dist/process-engine/ops/execute-action.js +0 -289
- package/dist/process-engine/ops/execute-action.js.map +0 -1
- package/dist/process-engine/ops/index.js +0 -17
- package/dist/process-engine/ops/index.js.map +0 -1
- package/dist/process-engine/ops/park-process.js +0 -14
- package/dist/process-engine/ops/park-process.js.map +0 -1
- package/dist/process-engine/ops/queue-inputs.js +0 -35
- package/dist/process-engine/ops/queue-inputs.js.map +0 -1
- package/dist/process-engine/ops/retry-failed-turn.js +0 -74
- package/dist/process-engine/ops/retry-failed-turn.js.map +0 -1
- package/dist/process-engine/ops/retry-startup.js +0 -65
- package/dist/process-engine/ops/retry-startup.js.map +0 -1
- package/dist/process-engine/ops/start-process.js +0 -20
- package/dist/process-engine/ops/start-process.js.map +0 -1
- package/dist/process-engine/ops/turn-failed.js +0 -34
- package/dist/process-engine/ops/turn-failed.js.map +0 -1
- package/dist/process-engine/ops/turn-outcome.js +0 -345
- package/dist/process-engine/ops/turn-outcome.js.map +0 -1
- package/dist/process-engine/ops/update-product-refs.js +0 -18
- package/dist/process-engine/ops/update-product-refs.js.map +0 -1
- package/dist/process-engine/ops/update-semantic-refs.js +0 -21
- package/dist/process-engine/ops/update-semantic-refs.js.map +0 -1
- package/dist/process-engine/ops/worker-failure.js +0 -81
- package/dist/process-engine/ops/worker-failure.js.map +0 -1
- package/dist/process-engine/reactions.js +0 -23
- package/dist/process-engine/reactions.js.map +0 -1
- package/dist/process-engine/recorder.js +0 -245
- package/dist/process-engine/recorder.js.map +0 -1
- package/dist/process-engine/runner.js +0 -206
- package/dist/process-engine/runner.js.map +0 -1
- package/dist/process-engine/startup-reconciliation.js +0 -130
- package/dist/process-engine/startup-reconciliation.js.map +0 -1
- package/dist/process-engine/state-json.js +0 -5
- package/dist/process-engine/state-json.js.map +0 -1
- package/dist/process-engine/turn-start-preflight.js +0 -229
- package/dist/process-engine/turn-start-preflight.js.map +0 -1
- package/dist/process-engine/turn-worker-requirement.js +0 -11
- package/dist/process-engine/turn-worker-requirement.js.map +0 -1
- package/dist/process-engine/types.js +0 -2
- package/dist/process-engine/types.js.map +0 -1
- package/dist/process-engine/worker-reconciliation.js +0 -29
- package/dist/process-engine/worker-reconciliation.js.map +0 -1
- package/dist/process-engine/writes/build-continue-failed-turn-writes.js +0 -95
- package/dist/process-engine/writes/build-continue-failed-turn-writes.js.map +0 -1
- package/dist/process-engine/writes/build-process-abort-writes.js +0 -64
- package/dist/process-engine/writes/build-process-abort-writes.js.map +0 -1
- package/dist/process-engine/writes/build-process-action-writes.js +0 -140
- package/dist/process-engine/writes/build-process-action-writes.js.map +0 -1
- package/dist/process-engine/writes/build-process-park-writes.js +0 -48
- package/dist/process-engine/writes/build-process-park-writes.js.map +0 -1
- package/dist/process-engine/writes/build-retry-writes.js +0 -83
- package/dist/process-engine/writes/build-retry-writes.js.map +0 -1
- package/dist/process-engine/writes/build-server-transition-writes.js +0 -75
- package/dist/process-engine/writes/build-server-transition-writes.js.map +0 -1
- package/dist/process-engine/writes/build-turn-failed-writes.js +0 -52
- package/dist/process-engine/writes/build-turn-failed-writes.js.map +0 -1
- package/dist/process-engine/writes/build-turn-outcome-writes.js +0 -170
- package/dist/process-engine/writes/build-turn-outcome-writes.js.map +0 -1
- package/dist/process-engine/writes/build-turn-selection-writes.js +0 -158
- package/dist/process-engine/writes/build-turn-selection-writes.js.map +0 -1
- package/dist/process-engine/writes/build-worker-failure-writes.js +0 -59
- package/dist/process-engine/writes/build-worker-failure-writes.js.map +0 -1
- package/dist/process-engine/writes/commit-writes.js +0 -252
- package/dist/process-engine/writes/commit-writes.js.map +0 -1
- package/dist/process-engine/writes/deferred-extension-events.js +0 -13
- package/dist/process-engine/writes/deferred-extension-events.js.map +0 -1
- package/dist/process-engine/writes/process-effects.js +0 -20
- package/dist/process-engine/writes/process-effects.js.map +0 -1
- package/dist/process-engine/writes/writes.js +0 -139
- package/dist/process-engine/writes/writes.js.map +0 -1
- package/dist/process-graph.js +0 -7
- package/dist/process-graph.js.map +0 -1
- package/dist/process-input-dispatch.js +0 -85
- package/dist/process-input-dispatch.js.map +0 -1
- package/dist/process-instance-tree-presenter.js +0 -202
- package/dist/process-instance-tree-presenter.js.map +0 -1
- package/dist/process-launch-executor.js +0 -310
- package/dist/process-launch-executor.js.map +0 -1
- package/dist/process-launch-plan-model-config.js +0 -22
- package/dist/process-launch-plan-model-config.js.map +0 -1
- package/dist/process-launch-plan.js +0 -64
- package/dist/process-launch-plan.js.map +0 -1
- package/dist/process-launcher-registry.js +0 -104
- package/dist/process-launcher-registry.js.map +0 -1
- package/dist/process-model-availability-recovery.js +0 -41
- package/dist/process-model-availability-recovery.js.map +0 -1
- package/dist/process-model-availability-transitions.js +0 -14
- package/dist/process-model-availability-transitions.js.map +0 -1
- package/dist/process-model-integrity-reconciler.js +0 -27
- package/dist/process-model-integrity-reconciler.js.map +0 -1
- package/dist/process-model-policy/construct.js +0 -94
- package/dist/process-model-policy/construct.js.map +0 -1
- package/dist/process-model-policy/evaluate.js +0 -163
- package/dist/process-model-policy/evaluate.js.map +0 -1
- package/dist/process-model-policy/fingerprint.js +0 -39
- package/dist/process-model-policy/fingerprint.js.map +0 -1
- package/dist/process-model-policy/index.js +0 -47
- package/dist/process-model-policy/index.js.map +0 -1
- package/dist/process-model-policy/input.js +0 -79
- package/dist/process-model-policy/input.js.map +0 -1
- package/dist/process-model-policy/integrity.js +0 -53
- package/dist/process-model-policy/integrity.js.map +0 -1
- package/dist/process-model-policy/launch.js +0 -171
- package/dist/process-model-policy/launch.js.map +0 -1
- package/dist/process-model-policy/project.js +0 -144
- package/dist/process-model-policy/project.js.map +0 -1
- package/dist/process-model-policy/stable-availability.js +0 -16
- package/dist/process-model-policy/stable-availability.js.map +0 -1
- package/dist/process-model-policy/types.js +0 -9
- package/dist/process-model-policy/types.js.map +0 -1
- package/dist/process-model-policy-presenter.js +0 -77
- package/dist/process-model-policy-presenter.js.map +0 -1
- package/dist/process-model-selection.js +0 -101
- package/dist/process-model-selection.js.map +0 -1
- package/dist/process-operation-coordinator.js +0 -23
- package/dist/process-operation-coordinator.js.map +0 -1
- package/dist/process-operator-attention.js +0 -149
- package/dist/process-operator-attention.js.map +0 -1
- package/dist/process-overview-presenter.js +0 -220
- package/dist/process-overview-presenter.js.map +0 -1
- package/dist/process-question-service.js +0 -131
- package/dist/process-question-service.js.map +0 -1
- package/dist/process-session-store.js +0 -210
- package/dist/process-session-store.js.map +0 -1
- package/dist/process-title-generator.js +0 -628
- package/dist/process-title-generator.js.map +0 -1
- package/dist/process-turn-trace.js +0 -482
- package/dist/process-turn-trace.js.map +0 -1
- package/dist/process-ui-registry.js +0 -22
- package/dist/process-ui-registry.js.map +0 -1
- package/dist/process-ui-snapshot-presenter.js +0 -894
- package/dist/process-ui-snapshot-presenter.js.map +0 -1
- package/dist/process-watcher-registry.js +0 -159
- package/dist/process-watcher-registry.js.map +0 -1
- package/dist/product-ref-state.js +0 -84
- package/dist/product-ref-state.js.map +0 -1
- package/dist/product-turn-result-markdown.d.ts +0 -9
- package/dist/product-turn-result-markdown.d.ts.map +0 -1
- package/dist/product-turn-result-markdown.js +0 -44
- package/dist/product-turn-result-markdown.js.map +0 -1
- package/dist/project-mutation-service.js +0 -68
- package/dist/project-mutation-service.js.map +0 -1
- package/dist/repository-credentials/service.js +0 -49
- package/dist/repository-credentials/service.js.map +0 -1
- package/dist/result-image-store.js +0 -85
- package/dist/result-image-store.js.map +0 -1
- package/dist/result-image-validation.js +0 -47
- package/dist/result-image-validation.js.map +0 -1
- package/dist/routes/future-executions.js +0 -62
- package/dist/routes/future-executions.js.map +0 -1
- package/dist/routes/internal-worker-auth.js +0 -33
- package/dist/routes/internal-worker-auth.js.map +0 -1
- package/dist/routes/internal-worker-session-snapshot.js +0 -172
- package/dist/routes/internal-worker-session-snapshot.js.map +0 -1
- package/dist/routes/launchers.js +0 -140
- package/dist/routes/launchers.js.map +0 -1
- package/dist/routes/process-actions.js +0 -210
- package/dist/routes/process-actions.js.map +0 -1
- package/dist/routes/process-detail.js +0 -110
- package/dist/routes/process-detail.js.map +0 -1
- package/dist/routes/process-diagnostics-assembler.js +0 -92
- package/dist/routes/process-diagnostics-assembler.js.map +0 -1
- package/dist/routes/process-engine-http.js +0 -82
- package/dist/routes/process-engine-http.js.map +0 -1
- package/dist/routes/process-primary-path-assembler.js +0 -67
- package/dist/routes/process-primary-path-assembler.js.map +0 -1
- package/dist/routes/process-questions.js +0 -12
- package/dist/routes/process-questions.js.map +0 -1
- package/dist/routes/process-route-helpers.js +0 -523
- package/dist/routes/process-route-helpers.js.map +0 -1
- package/dist/routes/process-session.js +0 -24
- package/dist/routes/process-session.js.map +0 -1
- package/dist/routes/processes.js +0 -15
- package/dist/routes/processes.js.map +0 -1
- package/dist/routes/result-images.js +0 -92
- package/dist/routes/result-images.js.map +0 -1
- package/dist/routes/skills.js +0 -35
- package/dist/routes/skills.js.map +0 -1
- package/dist/routes/ui-renderers.js +0 -40
- package/dist/routes/ui-renderers.js.map +0 -1
- package/dist/routes/watchers.js +0 -46
- package/dist/routes/watchers.js.map +0 -1
- package/dist/runtime-server-config.js +0 -46
- package/dist/runtime-server-config.js.map +0 -1
- package/dist/scheduled-action-preflight.js +0 -53
- package/dist/scheduled-action-preflight.js.map +0 -1
- package/dist/semantic-entry-ref-state.js +0 -97
- package/dist/semantic-entry-ref-state.js.map +0 -1
- package/dist/semantic-state-json.d.ts +0 -6
- package/dist/semantic-state-json.d.ts.map +0 -1
- package/dist/semantic-state-json.js +0 -6
- package/dist/semantic-state-json.js.map +0 -1
- package/dist/semantic-turn-result-markdown.d.ts.map +0 -1
- package/dist/semantic-turn-result-markdown.js +0 -45
- package/dist/semantic-turn-result-markdown.js.map +0 -1
- package/dist/server-automatic-turn-drainer.d.ts +0 -13
- package/dist/server-automatic-turn-drainer.d.ts.map +0 -1
- package/dist/server-automatic-turn-drainer.js +0 -250
- package/dist/server-automatic-turn-drainer.js.map +0 -1
- package/dist/server-bootstrap/build-host-capabilities.js +0 -83
- package/dist/server-bootstrap/build-host-capabilities.js.map +0 -1
- package/dist/server-bootstrap/load-extension-catalog.js +0 -17
- package/dist/server-bootstrap/load-extension-catalog.js.map +0 -1
- package/dist/server-bootstrap/register-http.js +0 -52
- package/dist/server-bootstrap/register-http.js.map +0 -1
- package/dist/server-bootstrap/register-websocket.js +0 -111
- package/dist/server-bootstrap/register-websocket.js.map +0 -1
- package/dist/server-topology.js +0 -33
- package/dist/server-topology.js.map +0 -1
- package/dist/skills/catalog-service.js +0 -66
- package/dist/skills/catalog-service.js.map +0 -1
- package/dist/skills/invocation-detector.js +0 -54
- package/dist/skills/invocation-detector.js.map +0 -1
- package/dist/skills/skill-dependencies.js +0 -17
- package/dist/skills/skill-dependencies.js.map +0 -1
- package/dist/skills/skill-frontmatter.js +0 -13
- package/dist/skills/skill-frontmatter.js.map +0 -1
- package/dist/skills/skill-id.js +0 -3
- package/dist/skills/skill-id.js.map +0 -1
- package/dist/skills/source-importer.js +0 -105
- package/dist/skills/source-importer.js.map +0 -1
- package/dist/supervisor/accepted-turn-start-replay.js +0 -23
- package/dist/supervisor/accepted-turn-start-replay.js.map +0 -1
- package/dist/supervisor/adoption/adoption-plan.js +0 -25
- package/dist/supervisor/adoption/adoption-plan.js.map +0 -1
- package/dist/supervisor/adoption/worker-adoption-coordinator.js +0 -227
- package/dist/supervisor/adoption/worker-adoption-coordinator.js.map +0 -1
- package/dist/supervisor/idle-worker-ttl.js +0 -26
- package/dist/supervisor/idle-worker-ttl.js.map +0 -1
- package/dist/supervisor/ipc-handler.js +0 -281
- package/dist/supervisor/ipc-handler.js.map +0 -1
- package/dist/supervisor/stale-heartbeat-watchdog.js +0 -88
- package/dist/supervisor/stale-heartbeat-watchdog.js.map +0 -1
- package/dist/supervisor/synthetic-worker-failure.js +0 -21
- package/dist/supervisor/synthetic-worker-failure.js.map +0 -1
- package/dist/supervisor/worker-api-compatibility.js +0 -20
- package/dist/supervisor/worker-api-compatibility.js.map +0 -1
- package/dist/supervisor/worker-connect-token.js +0 -13
- package/dist/supervisor/worker-connect-token.js.map +0 -1
- package/dist/supervisor/worker-event-ingestor.js +0 -209
- package/dist/supervisor/worker-event-ingestor.js.map +0 -1
- package/dist/supervisor/worker-input-ack-handler.js +0 -37
- package/dist/supervisor/worker-input-ack-handler.js.map +0 -1
- package/dist/supervisor/worker-lease-observer.js +0 -79
- package/dist/supervisor/worker-lease-observer.js.map +0 -1
- package/dist/supervisor/worker-shutdown-controller.js +0 -68
- package/dist/supervisor/worker-shutdown-controller.js.map +0 -1
- package/dist/supervisor/worker-start-payload-builder.js +0 -286
- package/dist/supervisor/worker-start-payload-builder.js.map +0 -1
- package/dist/supervisor/worker-storage-layout.js +0 -60
- package/dist/supervisor/worker-storage-layout.js.map +0 -1
- package/dist/supervisor/worker-supervisor.js +0 -703
- package/dist/supervisor/worker-supervisor.js.map +0 -1
- package/dist/supervisor/worker-turn-ipc-recorder.js +0 -158
- package/dist/supervisor/worker-turn-ipc-recorder.js.map +0 -1
- package/dist/supervisor/worker-websocket-ipc.js +0 -230
- package/dist/supervisor/worker-websocket-ipc.js.map +0 -1
- package/dist/test-helpers/fake-worker-supervisor.js +0 -64
- package/dist/test-helpers/fake-worker-supervisor.js.map +0 -1
- package/dist/test-helpers/ipc-handler-harness.js +0 -314
- package/dist/test-helpers/ipc-handler-harness.js.map +0 -1
- package/dist/test-helpers/model-provider-fixtures.js +0 -8
- package/dist/test-helpers/model-provider-fixtures.js.map +0 -1
- package/dist/test-helpers/process-binding-fixtures.js +0 -121
- package/dist/test-helpers/process-binding-fixtures.js.map +0 -1
- package/dist/test-helpers/process-fixtures.js +0 -206
- package/dist/test-helpers/process-fixtures.js.map +0 -1
- package/dist/test-helpers/process-model-fixtures.js +0 -159
- package/dist/test-helpers/process-model-fixtures.js.map +0 -1
- package/dist/test-helpers/process-title-fixtures.js +0 -36
- package/dist/test-helpers/process-title-fixtures.js.map +0 -1
- package/dist/test-helpers/structural-process-fixtures.js +0 -24
- package/dist/test-helpers/structural-process-fixtures.js.map +0 -1
- package/dist/test-helpers/turn-fixtures.js +0 -148
- package/dist/test-helpers/turn-fixtures.js.map +0 -1
- package/dist/test-helpers/turn-start-preflight-fixtures.js +0 -34
- package/dist/test-helpers/turn-start-preflight-fixtures.js.map +0 -1
- package/dist/test-helpers/unit-deps.js +0 -106
- package/dist/test-helpers/unit-deps.js.map +0 -1
- package/dist/turn-progress.js +0 -108
- package/dist/turn-progress.js.map +0 -1
- package/dist/worker-runtime-profile-selection.js +0 -90
- package/dist/worker-runtime-profile-selection.js.map +0 -1
- package/dist/writes-DNXpryd0.d.ts +0 -6653
- package/dist/ws/broadcast.js +0 -34
- package/dist/ws/broadcast.js.map +0 -1
- package/src/live-turn-projection.ts +0 -8
- package/src/product-turn-result-markdown.ts +0 -70
- package/src/semantic-state-json.ts +0 -18
- package/src/semantic-turn-result-markdown.ts +0 -93
- package/src/server-automatic-turn-drainer.ts +0 -316
|
@@ -0,0 +1,3250 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { LoadedExtensionModule, LeitwerkRuntimeLane, CatalogPiContribution, OwnedModelProviderSet, ExtensionCatalog, DiscoveredExtensionEntry } from '@leitwerk-dev/extension-runtime';
|
|
3
|
+
import * as _leitwerk_dev_process_sdk from '@leitwerk-dev/process-sdk';
|
|
4
|
+
import { ServerExtensionEventMap, ModelProviderDefinition, ProviderCredentialStatus, ProviderAvailability, PiServerAdapter, HandoffDedupKeyRecordLike, ProcessActionDefinition, ServerProcessContext, ProcessActionPreviewDefinition, BuiltServerProcessDefinition, TurnDefinition, ExtensionProcessDefinition, ProcessActionExecutionSource, TurnAcceptanceState, ProcessActionSchedulingDefinition, ProcessLaunchPlan, LaunchPlanPreparationResultLike, ProcessGraphRegistry, QueuedProcessInputLike, ProcessLeafOutcomeDefinition, ServerExtensionEventName, ActionExecutionResultLike, DeferredProcessActivationSnapshotQuery, DeferredProcessActivationSnapshotResult, PreparedDeferredProcessActivation, DeferredProcessActivationOutcome, DeferredProcessActivationFailure, ProcessActionServiceLike, ProcessLaunchPlanServiceLike, ProcessLauncherService, ProgrammaticLaunchRequestLike, ProgrammaticLaunchResultLike, RegisteredProcessWatcherLike, ProcessTitleSourceField, ExternalSourceServiceLike, ProcessModelSelectionServiceLike, ProvidedCapability } from '@leitwerk-dev/process-sdk';
|
|
5
|
+
import { ProcessStateExportHelperRelay, ProcessStateExporter, WorkerRunner as WorkerRunner$1, ProcessVolume as ProcessVolume$1 } from '@leitwerk-dev/worker-runners';
|
|
6
|
+
import { FastifyInstance } from 'fastify';
|
|
7
|
+
import * as _leitwerk_dev_protocol from '@leitwerk-dev/protocol';
|
|
8
|
+
import { ConfigSnapshot, ServerConfigSnapshot, StorageConfigSnapshot, ComponentConfigSnapshot, WorkersConfigSnapshot, ProcessConfigSnapshot, NotificationsConfigSnapshot, SandboxConfigSnapshot, ExtensionLoadingConfigSnapshot, LeafOutcomeRendererDescriptor, BrowserUiExtensionDescriptor, ModelProfileSnapshot, CompactTurnSummary, PrimaryPathUiSnapshot, TurnTracePreview, SkillSelection, SkillOptionSummary, SkillCatalogItem, InstalledSkillCatalogItem, SkillCatalogDetail, InstalledSkillCatalogDetail, WsFrame, KnownDurableWsFrameType, WsPayloadByType, KnownEphemeralWsFrameType, PrimaryPathEntrySnapshot, DurableWsFrameInput, ParsedLauncherRequestBody, LauncherModelConfigDefaults, LauncherValidationError, ParsedActionRequestBody, SkillsCatalogResponseBody } from '@leitwerk-dev/protocol';
|
|
9
|
+
import * as _leitwerk_dev_worker_protocol from '@leitwerk-dev/worker-protocol';
|
|
10
|
+
import { DockerNetworkConfig, WorkerCredentialMaterial, PiResourceBundle, PiResourceProvenanceKind, WorkerQuestionResponsePayload, WorkerQuestionRequestedPayload, WorkerTurnFailedPayload, WorkerIntegrationToolRequestPayload, WorkerIntegrationToolResultPayload, WorkerIntegrationToolCancelPayload, WorkerTurnStartAcceptedPayload, WorkerCredentialUpdateResultPayload, IpcEnvelope, ServerToWorkerMessage, InputDelivery, WorkerTurnTerminalRecordedPayload } from '@leitwerk-dev/worker-protocol';
|
|
11
|
+
import * as drizzle_orm_node_sqlite from 'drizzle-orm/node-sqlite';
|
|
12
|
+
import { drizzle } from 'drizzle-orm/node-sqlite';
|
|
13
|
+
import * as drizzle_orm from 'drizzle-orm';
|
|
14
|
+
import { DatabaseSync } from 'node:sqlite';
|
|
15
|
+
import { Actor, StartupObservation, ExternalWriteLog, FutureExecutionScheduleKind, DurableModelSelection, FutureExecutionBlockReason, FutureExecutionKind, FutureExecution, LaunchOrigin, LaunchChecklistStep, LaunchRun, ProcessEvent, InputSource, InputKind, ProcessInputTarget, ProcessInput, ProcessCustomizableFields, TurnId, ProcessLifecycleStatus, CurrentExecutionRef, ModelSelectionKind, ProcessSelectedTurnModelSource, ProcessInstance, ProcessLeafOutcomeSnapshotStatus, ProcessLeafOutcomeSnapshot, ProcessProject, ProcessQuestionRequest, NormalizedQuestion, ProcessRelation, ProcessToolApprovalRequest, ProcessToolApprovalDestination, ToolApprovalStatus, TurnAnnotationReference, ProcessTurnAnnotation, ProcessTurnType, ProcessTurnRecordStatus, ModelSelectionProvenance, WorkerErrorClass, ProcessTurnRecordPathType, ProcessTurnRecord, TurnStartRecord, TurnStartRecordState, WorkerState, WorkerBootstrapReceipt, WorkerLease, ProcessTurnTerminalLifecycleStatus, ProcessSemanticEntryRefKey, LaunchModelConfigInput, TurnStartKind, QuestionAnswerDraft, ProcessProductRef, TurnFailedPayload, TurnOutcomePayload } from '@leitwerk-dev/domain';
|
|
16
|
+
import { ApiTokenMetadata, ProcessSelectedTurnSummary } from '@leitwerk-dev/protocol/http-contracts';
|
|
17
|
+
import { ExternalWriteLogRecordInput } from '@leitwerk-dev/external-writes';
|
|
18
|
+
import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
|
|
19
|
+
import { SessionTransferAttemptWire, SessionTransferLimits, LeitwerkTransferManifestV1 } from '@leitwerk-dev/session-transfer';
|
|
20
|
+
import { SessionHeader, SessionEntry } from '@earendil-works/pi-coding-agent';
|
|
21
|
+
import { WorkerRunner, ProcessVolume } from '@leitwerk-dev/worker-runners/types';
|
|
22
|
+
import { ToolCallRendererDefinition } from '@leitwerk-dev/protocol/tool-renderer-contract';
|
|
23
|
+
import * as node_stream from 'node:stream';
|
|
24
|
+
import { Readable, Transform } from 'node:stream';
|
|
25
|
+
|
|
26
|
+
interface SkillRepositoryConfig {
|
|
27
|
+
id: string;
|
|
28
|
+
label?: string;
|
|
29
|
+
url: string;
|
|
30
|
+
ref: string;
|
|
31
|
+
/** Directory recursively scanned for skill directories. Defaults to `skills`. */
|
|
32
|
+
path?: string;
|
|
33
|
+
}
|
|
34
|
+
interface AuthSessionConfig {
|
|
35
|
+
cookie_name?: string;
|
|
36
|
+
ttl?: string;
|
|
37
|
+
}
|
|
38
|
+
interface AuthOidcProviderConfig {
|
|
39
|
+
id: string;
|
|
40
|
+
kind: "oidc";
|
|
41
|
+
issuer: string;
|
|
42
|
+
client_id: string;
|
|
43
|
+
client_secret: string;
|
|
44
|
+
redirect_uri?: string;
|
|
45
|
+
scopes?: string[];
|
|
46
|
+
identity_claim?: string;
|
|
47
|
+
}
|
|
48
|
+
interface AuthGithubProviderConfig {
|
|
49
|
+
id: "github";
|
|
50
|
+
kind: "oauth2";
|
|
51
|
+
client_id: string;
|
|
52
|
+
client_secret: string;
|
|
53
|
+
/** GitHub organization whose active members may sign in. */
|
|
54
|
+
organization: string;
|
|
55
|
+
redirect_uri?: string;
|
|
56
|
+
}
|
|
57
|
+
type AuthProviderConfig = AuthOidcProviderConfig | AuthGithubProviderConfig;
|
|
58
|
+
interface ApiTokensConfig {
|
|
59
|
+
enabled?: boolean;
|
|
60
|
+
default_ttl?: string;
|
|
61
|
+
max_ttl?: string;
|
|
62
|
+
allow_no_expiry?: boolean;
|
|
63
|
+
}
|
|
64
|
+
interface AuthConfig {
|
|
65
|
+
api_tokens?: ApiTokensConfig;
|
|
66
|
+
/** Only true enables authentication; omit or set false to keep the leitwerk unauthenticated. */
|
|
67
|
+
enabled?: boolean;
|
|
68
|
+
session?: AuthSessionConfig;
|
|
69
|
+
providers?: AuthProviderConfig[];
|
|
70
|
+
/** Raw OIDC identity claim values that may sign in. GitHub uses organization membership. */
|
|
71
|
+
allowlist?: string[];
|
|
72
|
+
}
|
|
73
|
+
interface DockerProcessVolumeConfig {
|
|
74
|
+
/** `bind` mounts a host path; `named_volume` uses a Docker-managed volume. */
|
|
75
|
+
mode: "bind" | "named_volume";
|
|
76
|
+
/** Host root under which per-process volumes are created (bind mode). */
|
|
77
|
+
host_root: string;
|
|
78
|
+
/** Path inside the worker container where the volume is mounted. */
|
|
79
|
+
mount_path: string;
|
|
80
|
+
}
|
|
81
|
+
interface DockerPrivateDaemonConfig {
|
|
82
|
+
/** Exact isolation used for every Docker-requiring process. */
|
|
83
|
+
isolation: "privileged" | "sysbox-runc";
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Server-only Docker run-mode wiring. The worker never receives this block; it
|
|
87
|
+
* dials back over WebSocket using launcher-injected connect env.
|
|
88
|
+
*/
|
|
89
|
+
interface DockerRunnerConfig {
|
|
90
|
+
/** Docker Engine API socket (Podman/OrbStack/nerdctl compatible). */
|
|
91
|
+
socket: string;
|
|
92
|
+
/** Shared private user-defined network for server + workers. */
|
|
93
|
+
network: string;
|
|
94
|
+
/** Stable internal HTTP(S) base URL workers use for IPC, never a host IP. */
|
|
95
|
+
server_url: string;
|
|
96
|
+
/** CA the worker trusts for internal TLS (self-signed ok on a private net). */
|
|
97
|
+
server_ca_file?: string;
|
|
98
|
+
process_volume: DockerProcessVolumeConfig;
|
|
99
|
+
/** Private daemon realization for Docker-requiring processes. */
|
|
100
|
+
private_daemon?: DockerPrivateDaemonConfig;
|
|
101
|
+
}
|
|
102
|
+
interface KubernetesProcessVolumeConfig {
|
|
103
|
+
/** Optional ready-volume target; zero stops replenishment. */
|
|
104
|
+
pre_provision?: {
|
|
105
|
+
count: number;
|
|
106
|
+
};
|
|
107
|
+
storage_class_name?: string;
|
|
108
|
+
size: string;
|
|
109
|
+
access_modes: string[];
|
|
110
|
+
mount_path: string;
|
|
111
|
+
}
|
|
112
|
+
interface KubernetesDockerConfig {
|
|
113
|
+
/** Pod RuntimeClass selected for every Docker-requiring process. */
|
|
114
|
+
runtime_class_name?: string;
|
|
115
|
+
/** Pod user-namespace policy passed directly to spec.hostUsers. */
|
|
116
|
+
host_users?: boolean;
|
|
117
|
+
/** StorageClass selected for the process's single retained PVC. */
|
|
118
|
+
process_storage_class_name?: string;
|
|
119
|
+
network?: DockerNetworkConfig;
|
|
120
|
+
}
|
|
121
|
+
interface KubernetesHostAliasConfig {
|
|
122
|
+
ip: string;
|
|
123
|
+
hostnames: string[];
|
|
124
|
+
}
|
|
125
|
+
interface KubernetesPodConfig {
|
|
126
|
+
node_selector?: Record<string, string>;
|
|
127
|
+
tolerations?: unknown[];
|
|
128
|
+
annotations?: Record<string, string>;
|
|
129
|
+
host_aliases?: KubernetesHostAliasConfig[];
|
|
130
|
+
}
|
|
131
|
+
interface KubernetesImagePullSecretCopyConfig {
|
|
132
|
+
/** Secret name in the server namespace. */
|
|
133
|
+
source_name: string;
|
|
134
|
+
/** Secret name created in each process namespace. */
|
|
135
|
+
target_name: string;
|
|
136
|
+
}
|
|
137
|
+
/** Server-only Kubernetes run-mode wiring. */
|
|
138
|
+
interface LocalWorkerRunnerConfig {
|
|
139
|
+
/** Command used by the best-effort local dev/test runner. */
|
|
140
|
+
command: string;
|
|
141
|
+
/** Arguments passed to the local worker command. */
|
|
142
|
+
args: string[];
|
|
143
|
+
/** Explicit acknowledgement that Docker processes inherit host Docker authority. */
|
|
144
|
+
allow_host_docker?: boolean;
|
|
145
|
+
}
|
|
146
|
+
interface KubernetesRunnerConfig {
|
|
147
|
+
/** Dedicated namespace where the singleton server runs. */
|
|
148
|
+
server_namespace: string;
|
|
149
|
+
/** Safe DNS prefix used to derive one namespace per process instance. */
|
|
150
|
+
process_namespace_prefix: string;
|
|
151
|
+
/** Stable in-cluster HTTP(S) base URL workers use to dial the server. */
|
|
152
|
+
server_url: string;
|
|
153
|
+
/** Server-local CA bundle copied into process namespaces for worker TLS trust. */
|
|
154
|
+
server_ca_file?: string;
|
|
155
|
+
/** Optional Kubernetes API URL override; defaults to the in-cluster service. */
|
|
156
|
+
api_server_url?: string;
|
|
157
|
+
default_worker_runtime_profile?: string;
|
|
158
|
+
worker_service_account?: string;
|
|
159
|
+
process_volume: KubernetesProcessVolumeConfig;
|
|
160
|
+
/** Trusted private-Docker realization. Incomplete blocks leave Docker processes unavailable. */
|
|
161
|
+
docker?: KubernetesDockerConfig;
|
|
162
|
+
pod?: KubernetesPodConfig;
|
|
163
|
+
image_pull_secrets?: string[];
|
|
164
|
+
image_pull_secret_copies?: KubernetesImagePullSecretCopyConfig[];
|
|
165
|
+
}
|
|
166
|
+
interface WorkerRuntimeProfileCpuMemoryConfig {
|
|
167
|
+
cpu?: string;
|
|
168
|
+
memory?: string;
|
|
169
|
+
}
|
|
170
|
+
interface DockerRegistryConfig {
|
|
171
|
+
/** Actual registry permissions are enforced by the registry, not this binding. */
|
|
172
|
+
profiles: Record<string, {
|
|
173
|
+
registry: string;
|
|
174
|
+
username: string;
|
|
175
|
+
password: string;
|
|
176
|
+
}>;
|
|
177
|
+
process_bindings: Record<string, string[]>;
|
|
178
|
+
}
|
|
179
|
+
interface WorkerRuntimeProfileResourcesConfig {
|
|
180
|
+
requests?: WorkerRuntimeProfileCpuMemoryConfig;
|
|
181
|
+
limits?: WorkerRuntimeProfileCpuMemoryConfig;
|
|
182
|
+
/** Back-compat shorthand interpreted as limits by Docker and manifest builders. */
|
|
183
|
+
cpu?: string;
|
|
184
|
+
memory?: string;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* A reusable worker image selection authored only in leitwerk config.
|
|
188
|
+
* Repository branch content must never select an image.
|
|
189
|
+
*/
|
|
190
|
+
interface WorkerRuntimeProfileConfig {
|
|
191
|
+
/** Fully qualified image reference, ideally digest-pinned for production. */
|
|
192
|
+
image: string;
|
|
193
|
+
image_pull_policy?: string;
|
|
194
|
+
resources?: WorkerRuntimeProfileResourcesConfig;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Server-only internal TLS for worker → server IPC. The server presents a cert
|
|
198
|
+
* with a SAN for the stable internal name; workers trust the signing CA handed
|
|
199
|
+
* to them via {@link DockerRunnerConfig.server_ca_file} or
|
|
200
|
+
* {@link KubernetesRunnerConfig.server_ca_file}. Public UI/API HTTPS is
|
|
201
|
+
* terminated separately by a reverse proxy. Disabled by default so local and
|
|
202
|
+
* parity runs stay on plain HTTP.
|
|
203
|
+
*/
|
|
204
|
+
interface CommitMessageTemplateConfig {
|
|
205
|
+
/** Human-readable instructions applied to generated commit messages. */
|
|
206
|
+
rules: string;
|
|
207
|
+
}
|
|
208
|
+
interface CommitMessageConfig {
|
|
209
|
+
/** Named, reusable formatting-rule templates. */
|
|
210
|
+
templates: Record<string, CommitMessageTemplateConfig>;
|
|
211
|
+
/** Template used when a repository has no explicit mapping. Null/omitted uses built-in guidance. */
|
|
212
|
+
default_template?: string | null;
|
|
213
|
+
/** Repository locator to template id. Locators are normalized before matching. */
|
|
214
|
+
repositories: Record<string, string>;
|
|
215
|
+
}
|
|
216
|
+
interface InternalTlsConfig {
|
|
217
|
+
enabled: boolean;
|
|
218
|
+
/** PEM cert chain the server presents on the internal listener. */
|
|
219
|
+
cert_file?: string;
|
|
220
|
+
/** PEM private key for {@link InternalTlsConfig.cert_file}. */
|
|
221
|
+
key_file?: string;
|
|
222
|
+
/**
|
|
223
|
+
* Reserved for future worker client-certificate verification. Currently
|
|
224
|
+
* rejected by validation because workers do not receive client cert/key material.
|
|
225
|
+
*/
|
|
226
|
+
client_ca_file?: string;
|
|
227
|
+
}
|
|
228
|
+
interface SessionTransferConfig {
|
|
229
|
+
max_entries: number;
|
|
230
|
+
max_logical_bytes: number;
|
|
231
|
+
max_compressed_bytes: number;
|
|
232
|
+
}
|
|
233
|
+
interface DevelopmentToolsConfig {
|
|
234
|
+
install_timeout: string;
|
|
235
|
+
local: {
|
|
236
|
+
mise_command: string;
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
/** Server-owned config. `auth` and runner wiring are intentionally server-only and are not part of the worker ConfigSnapshot. */
|
|
240
|
+
interface LeitwerkConfig extends ConfigSnapshot {
|
|
241
|
+
server: ServerConfigSnapshot;
|
|
242
|
+
storage: StorageConfigSnapshot;
|
|
243
|
+
components: Record<string, ComponentConfigSnapshot>;
|
|
244
|
+
workers: WorkersConfigSnapshot;
|
|
245
|
+
development_tools: DevelopmentToolsConfig;
|
|
246
|
+
process_configs?: Record<string, ProcessConfigSnapshot>;
|
|
247
|
+
notifications: NotificationsConfigSnapshot;
|
|
248
|
+
sandbox: SandboxConfigSnapshot;
|
|
249
|
+
extension_loading: ExtensionLoadingConfigSnapshot;
|
|
250
|
+
/** Extension-owned config blocks, keyed by extension ID. */
|
|
251
|
+
extensions: Record<string, unknown>;
|
|
252
|
+
auth?: AuthConfig;
|
|
253
|
+
/** Server-only Docker run-mode wiring; stripped from the worker snapshot. */
|
|
254
|
+
docker?: DockerRunnerConfig;
|
|
255
|
+
/** Server-only credentials delivered exclusively through authenticated worker.start. */
|
|
256
|
+
docker_registries?: DockerRegistryConfig;
|
|
257
|
+
/** Server-only Kubernetes run-mode wiring; stripped from the worker snapshot. */
|
|
258
|
+
kubernetes?: KubernetesRunnerConfig;
|
|
259
|
+
/** Server-only best-effort local dev/test runner wiring; stripped from the worker snapshot. */
|
|
260
|
+
local_worker?: LocalWorkerRunnerConfig;
|
|
261
|
+
/** Reusable worker image selections; stripped from the worker snapshot. */
|
|
262
|
+
worker_runtime_profiles?: Record<string, WorkerRuntimeProfileConfig>;
|
|
263
|
+
/** Server-only internal TLS for worker IPC; stripped from the worker snapshot. */
|
|
264
|
+
internal_tls?: InternalTlsConfig;
|
|
265
|
+
/** Git repositories scanned for operator-managed skills. */
|
|
266
|
+
skill_repositories?: SkillRepositoryConfig[];
|
|
267
|
+
/** Server-owned repository-aware commit-message generation rules. */
|
|
268
|
+
commit_messages?: CommitMessageConfig;
|
|
269
|
+
/** Bounded archive and extraction ceilings for local session transfer. */
|
|
270
|
+
session_transfer?: SessionTransferConfig;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
type LeitwerkDb = ReturnType<typeof drizzle>;
|
|
274
|
+
interface DatabaseOptions {
|
|
275
|
+
sqlitePath: string;
|
|
276
|
+
enableWAL?: boolean;
|
|
277
|
+
}
|
|
278
|
+
interface InitializeSchemaOptions {
|
|
279
|
+
sqlitePath?: string;
|
|
280
|
+
}
|
|
281
|
+
declare class DatabaseSchemaMismatchError extends Error {
|
|
282
|
+
readonly sqlitePath: string;
|
|
283
|
+
readonly tableName: string;
|
|
284
|
+
constructor(sqlitePath: string, tableName: string);
|
|
285
|
+
}
|
|
286
|
+
declare function initializeSchema(sqlite: DatabaseSync, opts?: InitializeSchemaOptions): void;
|
|
287
|
+
declare function createDatabase(opts: DatabaseOptions): drizzle_orm_node_sqlite.NodeSQLiteDatabase<drizzle_orm.EmptyRelations> & {
|
|
288
|
+
$client: DatabaseSync;
|
|
289
|
+
};
|
|
290
|
+
declare function createInMemoryDatabase(): drizzle_orm_node_sqlite.NodeSQLiteDatabase<drizzle_orm.EmptyRelations> & {
|
|
291
|
+
$client: DatabaseSync;
|
|
292
|
+
};
|
|
293
|
+
declare function closeDatabase(db: LeitwerkDb): void;
|
|
294
|
+
|
|
295
|
+
type ExtensionUiRendererDescriptor = Omit<LeafOutcomeRendererDescriptor, "ok" | "moduleUrl">;
|
|
296
|
+
type ExtensionUiRendererLookup = Omit<LeafOutcomeRendererDescriptor, "ok">;
|
|
297
|
+
type ExtensionUiBrowserModuleLookup = BrowserUiExtensionDescriptor;
|
|
298
|
+
interface ExtensionUiAssetRoot {
|
|
299
|
+
extensionManifestId: string;
|
|
300
|
+
assetRootDir: string;
|
|
301
|
+
}
|
|
302
|
+
interface ExtensionUiCatalog {
|
|
303
|
+
getRenderer(rendererId: string): ExtensionUiRendererLookup | null;
|
|
304
|
+
listBrowserModules(): readonly ExtensionUiBrowserModuleLookup[];
|
|
305
|
+
getAssetRoot(extensionManifestId: string): ExtensionUiAssetRoot | null;
|
|
306
|
+
}
|
|
307
|
+
interface BuildExtensionUiCatalogOptions {
|
|
308
|
+
runtimeLane?: LeitwerkRuntimeLane;
|
|
309
|
+
}
|
|
310
|
+
declare function buildExtensionUiCatalog(loadedModules: readonly LoadedExtensionModule[], options?: BuildExtensionUiCatalogOptions): Promise<ExtensionUiCatalog>;
|
|
311
|
+
declare function resolveExtensionUiAssetPath(catalog: ExtensionUiCatalog, extensionManifestId: string, requestedPath: string): string | null;
|
|
312
|
+
declare function inferExtensionUiAssetContentType(pathname: string): string;
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Server-side extension host. Mirrors the worker-side ProcessAPI.events pattern.
|
|
316
|
+
* Extensions register handlers for lifecycle events. The server emits events
|
|
317
|
+
* when IPC messages arrive or commands execute.
|
|
318
|
+
*/
|
|
319
|
+
type ExtensionEventHandler<T = unknown> = (payload: T) => void | Promise<void>;
|
|
320
|
+
interface ExtensionHost<TEventMap extends object = ServerExtensionEventMap> {
|
|
321
|
+
on<K extends keyof TEventMap & string>(event: K, handler: ExtensionEventHandler<TEventMap[K]>): void;
|
|
322
|
+
off<K extends keyof TEventMap & string>(event: K, handler: ExtensionEventHandler<TEventMap[K]>): void;
|
|
323
|
+
emit<K extends keyof TEventMap & string>(event: K, payload: TEventMap[K]): Promise<void>;
|
|
324
|
+
}
|
|
325
|
+
declare function createExtensionHost<TEventMap extends object = ServerExtensionEventMap>(): ExtensionHost<TEventMap>;
|
|
326
|
+
|
|
327
|
+
/** Application boundary for encrypted credential payloads. Callers supply deployment key material. */
|
|
328
|
+
interface CredentialCipher {
|
|
329
|
+
encrypt(plaintext: string): string;
|
|
330
|
+
decrypt(ciphertext: string): string;
|
|
331
|
+
}
|
|
332
|
+
declare const PROVIDER_CREDENTIAL_KEY_ENV = "LEITWERK_CREDENTIAL_ENCRYPTION_KEY";
|
|
333
|
+
/** A missing deployment key may inspect an empty table but can never read or write credentials. */
|
|
334
|
+
declare function createUnavailableCredentialCipher(): CredentialCipher;
|
|
335
|
+
/** Parses an exact 32-byte Base64 deployment secret. */
|
|
336
|
+
declare function createCredentialCipherFromBase64(value: string): CredentialCipher;
|
|
337
|
+
declare function createCredentialCipherFromEnvironment(environment?: NodeJS.ProcessEnv): CredentialCipher | null;
|
|
338
|
+
declare function createAes256GcmCredentialCipher(key: Buffer): CredentialCipher;
|
|
339
|
+
|
|
340
|
+
interface ProviderCredentialRecord {
|
|
341
|
+
providerId: string;
|
|
342
|
+
revision: number;
|
|
343
|
+
payload: string;
|
|
344
|
+
createdAt: string;
|
|
345
|
+
updatedAt: string;
|
|
346
|
+
}
|
|
347
|
+
declare function createProviderCredentialRepo(db: LeitwerkDb, cipher: CredentialCipher): {
|
|
348
|
+
count(): number;
|
|
349
|
+
get(providerId: string): ProviderCredentialRecord | null;
|
|
350
|
+
create(input: {
|
|
351
|
+
providerId: string;
|
|
352
|
+
payload: string;
|
|
353
|
+
}): ProviderCredentialRecord;
|
|
354
|
+
compareAndSet(input: {
|
|
355
|
+
providerId: string;
|
|
356
|
+
expectedRevision: number;
|
|
357
|
+
payload: string;
|
|
358
|
+
}): ProviderCredentialRecord | null;
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
interface RegisteredModelProvider {
|
|
362
|
+
readonly id: string;
|
|
363
|
+
readonly ownerExtensionId: string;
|
|
364
|
+
readonly packageName: string;
|
|
365
|
+
readonly definition: ModelProviderDefinition;
|
|
366
|
+
/** The parsed, non-secret provider configuration fragment. */
|
|
367
|
+
readonly config: unknown;
|
|
368
|
+
/** Configured credential seed, visible only to the credential service. */
|
|
369
|
+
readonly configuredCredential: unknown | null;
|
|
370
|
+
readonly piContribution: CatalogPiContribution | null;
|
|
371
|
+
}
|
|
372
|
+
interface ModelProviderRegistry {
|
|
373
|
+
readonly size: number;
|
|
374
|
+
list(): readonly RegisteredModelProvider[];
|
|
375
|
+
get(providerId: string): RegisteredModelProvider | null;
|
|
376
|
+
require(providerId: string): RegisteredModelProvider;
|
|
377
|
+
}
|
|
378
|
+
type ModelProviderCredentialStatusResolver = (provider: RegisteredModelProvider) => ProviderCredentialStatus | Promise<ProviderCredentialStatus>;
|
|
379
|
+
declare const defaultModelProviderCredentialStatus: ModelProviderCredentialStatusResolver;
|
|
380
|
+
interface CreateModelProviderRegistryInput {
|
|
381
|
+
readonly sets: readonly OwnedModelProviderSet[];
|
|
382
|
+
readonly piContributions: readonly CatalogPiContribution[];
|
|
383
|
+
readonly extensionConfig: Readonly<Record<string, unknown>>;
|
|
384
|
+
readonly modelProfiles: readonly ModelProfileSnapshot[];
|
|
385
|
+
readonly titleModelProfileId: string | null;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Parse extension-owned provider configuration once and freeze the resulting
|
|
389
|
+
* lookup. Provider definitions cannot be added from setupServer().
|
|
390
|
+
*/
|
|
391
|
+
declare function createModelProviderRegistry(input: CreateModelProviderRegistryInput): ModelProviderRegistry;
|
|
392
|
+
|
|
393
|
+
type CredentialRepo = ReturnType<typeof createProviderCredentialRepo>;
|
|
394
|
+
interface ResolvedProviderCredential extends WorkerCredentialMaterial {
|
|
395
|
+
}
|
|
396
|
+
interface ProviderCredentialUpdateResult {
|
|
397
|
+
accepted: boolean;
|
|
398
|
+
currentRevision: number | null;
|
|
399
|
+
safeReason?: string;
|
|
400
|
+
}
|
|
401
|
+
interface ModelProviderCredentialService {
|
|
402
|
+
initialize(): void;
|
|
403
|
+
status: ModelProviderCredentialStatusResolver;
|
|
404
|
+
resolve(providerId: string, options?: Readonly<Record<string, string>>): ResolvedProviderCredential | null;
|
|
405
|
+
compareAndSet(input: {
|
|
406
|
+
providerId: string;
|
|
407
|
+
expectedRevision: number;
|
|
408
|
+
value: unknown;
|
|
409
|
+
}): ProviderCredentialUpdateResult;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Owns encrypted provider credential reads, startup seed/rotation, short-lived
|
|
413
|
+
* secret projection, and revision compare-and-set. Secret values never enter
|
|
414
|
+
* model status, receipts, or durable turn records.
|
|
415
|
+
*/
|
|
416
|
+
declare function createModelProviderCredentialService(input: {
|
|
417
|
+
registry: ModelProviderRegistry;
|
|
418
|
+
repo: CredentialRepo;
|
|
419
|
+
}): ModelProviderCredentialService;
|
|
420
|
+
|
|
421
|
+
interface CachedModelProfileStatus {
|
|
422
|
+
readonly profileId: string;
|
|
423
|
+
readonly providerId: string;
|
|
424
|
+
readonly modelId: string;
|
|
425
|
+
readonly availability: ProviderAvailability;
|
|
426
|
+
readonly safeReason?: string;
|
|
427
|
+
readonly checkedAt: string | null;
|
|
428
|
+
readonly expiresAt: string | null;
|
|
429
|
+
}
|
|
430
|
+
interface ModelAvailabilityTransition {
|
|
431
|
+
readonly profileId: string;
|
|
432
|
+
readonly from: ProviderAvailability;
|
|
433
|
+
readonly to: ProviderAvailability;
|
|
434
|
+
}
|
|
435
|
+
interface ModelStatusCacheSnapshot {
|
|
436
|
+
readonly revision: number;
|
|
437
|
+
readonly capturedAt: string;
|
|
438
|
+
readonly profiles: readonly CachedModelProfileStatus[];
|
|
439
|
+
/** Present only on the refresh result that observed the transition. */
|
|
440
|
+
readonly availabilityTransitions: readonly ModelAvailabilityTransition[];
|
|
441
|
+
}
|
|
442
|
+
interface ModelStatusCache {
|
|
443
|
+
refresh(): Promise<ModelStatusCacheSnapshot>;
|
|
444
|
+
snapshot(): ModelStatusCacheSnapshot;
|
|
445
|
+
get(profileId: string): CachedModelProfileStatus | null;
|
|
446
|
+
}
|
|
447
|
+
interface CreateModelStatusCacheInput {
|
|
448
|
+
readonly registry: ModelProviderRegistry;
|
|
449
|
+
readonly modelProfiles: readonly ModelProfileSnapshot[];
|
|
450
|
+
readonly credentialStatus: ModelProviderCredentialStatusResolver;
|
|
451
|
+
readonly ttlMs?: number;
|
|
452
|
+
readonly timeoutMs?: number;
|
|
453
|
+
readonly maxProfiles?: number;
|
|
454
|
+
readonly now?: () => Date;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Keep a fixed, configured-profile status catalog. Refresh failures are safe,
|
|
458
|
+
* bounded stale states; they never remove a configured profile from the UI.
|
|
459
|
+
*/
|
|
460
|
+
declare function createModelStatusCache(input: CreateModelStatusCacheInput): ModelStatusCache;
|
|
461
|
+
|
|
462
|
+
type BuiltinPiServerAdapterFactory = (builtinProviderId: string, provider: RegisteredModelProvider) => PiServerAdapter | Promise<PiServerAdapter>;
|
|
463
|
+
interface ModelProviderServerAdapterRegistry {
|
|
464
|
+
get(providerId: string): PiServerAdapter | null;
|
|
465
|
+
require(providerId: string): PiServerAdapter;
|
|
466
|
+
generateText(input: {
|
|
467
|
+
profileId: string;
|
|
468
|
+
prompt: string;
|
|
469
|
+
systemPrompt: string;
|
|
470
|
+
maxTokens: number;
|
|
471
|
+
request: {
|
|
472
|
+
timeoutMs?: number;
|
|
473
|
+
maxRetries?: number;
|
|
474
|
+
maxRetryDelayMs: number;
|
|
475
|
+
};
|
|
476
|
+
}): Promise<string>;
|
|
477
|
+
}
|
|
478
|
+
declare function createModelProviderServerAdapterRegistry(input: {
|
|
479
|
+
registry: ModelProviderRegistry;
|
|
480
|
+
modelProfiles: readonly ModelProfileSnapshot[];
|
|
481
|
+
credentials: ModelProviderCredentialService;
|
|
482
|
+
createBuiltinAdapter: BuiltinPiServerAdapterFactory;
|
|
483
|
+
loadExtensionAdapter?: (entryPath: string) => Promise<PiServerAdapter>;
|
|
484
|
+
}): Promise<ModelProviderServerAdapterRegistry>;
|
|
485
|
+
|
|
486
|
+
type TokenProviderBinding = {
|
|
487
|
+
id: string;
|
|
488
|
+
kind: "oidc";
|
|
489
|
+
issuer: string;
|
|
490
|
+
identityClaim: string;
|
|
491
|
+
} | {
|
|
492
|
+
id: string;
|
|
493
|
+
kind: "oauth2";
|
|
494
|
+
organization: string;
|
|
495
|
+
};
|
|
496
|
+
interface ApiTokenOwner {
|
|
497
|
+
kind: "user" | "anonymous";
|
|
498
|
+
id: string;
|
|
499
|
+
actor: Actor;
|
|
500
|
+
providerBinding: TokenProviderBinding | null;
|
|
501
|
+
}
|
|
502
|
+
interface ApiTokenRecord extends ApiTokenMetadata {
|
|
503
|
+
secretHash: string;
|
|
504
|
+
owner: ApiTokenOwner;
|
|
505
|
+
}
|
|
506
|
+
declare function createApiTokenRepo(db: LeitwerkDb): {
|
|
507
|
+
create({ owner, ...fields }: ApiTokenRecord): void;
|
|
508
|
+
list(owner: ApiTokenOwner): ApiTokenRecord[];
|
|
509
|
+
findByHash(hash: string): ApiTokenRecord | null;
|
|
510
|
+
revoke(owner: ApiTokenOwner, id: string, at: string): boolean;
|
|
511
|
+
revokeAll(owner: ApiTokenOwner, at: string): number;
|
|
512
|
+
revokeAnonymous(at: string): number;
|
|
513
|
+
touch(id: string, at: string): void;
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
declare function createStartupObservationRepo(db: LeitwerkDb): {
|
|
517
|
+
record(observation: StartupObservation): boolean;
|
|
518
|
+
listByLease(workerLeaseId: string): StartupObservation[];
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
interface SessionSummary {
|
|
522
|
+
signature: string | null;
|
|
523
|
+
leafId: string | null;
|
|
524
|
+
primaryPath: Pick<PrimaryPathUiSnapshot, "currentLeaf" | "semanticEntryRefs" | "entryCount" | "turnAnnotations">;
|
|
525
|
+
prompt: {
|
|
526
|
+
text: string | null;
|
|
527
|
+
createdAt: string | null;
|
|
528
|
+
};
|
|
529
|
+
tracePreviewsByTurnRecordId: Record<string, TurnTracePreview>;
|
|
530
|
+
continuationByTurnRecordId: Record<string, {
|
|
531
|
+
hasProgress: boolean;
|
|
532
|
+
userPrompt: string | null;
|
|
533
|
+
}>;
|
|
534
|
+
}
|
|
535
|
+
declare function createTurnSummaryRepo(db: LeitwerkDb): {
|
|
536
|
+
get(turnRecordId: string): CompactTurnSummary | null;
|
|
537
|
+
put(instanceId: string, turnRecordId: string, summary: CompactTurnSummary): void;
|
|
538
|
+
listByInstance(instanceId: string): Record<string, CompactTurnSummary>;
|
|
539
|
+
getSession(instanceId: string): SessionSummary | null;
|
|
540
|
+
putSession(instanceId: string, summary: SessionSummary): void;
|
|
541
|
+
deleteSession(instanceId: string): void;
|
|
542
|
+
};
|
|
543
|
+
|
|
544
|
+
interface AuthSessionRecord {
|
|
545
|
+
idHash: string;
|
|
546
|
+
actor: Actor;
|
|
547
|
+
createdAt: string;
|
|
548
|
+
expiresAt: string;
|
|
549
|
+
}
|
|
550
|
+
interface AuthLoginFlowRecord {
|
|
551
|
+
idHash: string;
|
|
552
|
+
providerId: string;
|
|
553
|
+
state: string;
|
|
554
|
+
pkceVerifier: string;
|
|
555
|
+
createdAt: string;
|
|
556
|
+
expiresAt: string;
|
|
557
|
+
}
|
|
558
|
+
declare function createAuthSessionRepo(db: LeitwerkDb): {
|
|
559
|
+
create(input: {
|
|
560
|
+
idHash: string;
|
|
561
|
+
actor: Actor;
|
|
562
|
+
expiresAt: string;
|
|
563
|
+
}): AuthSessionRecord;
|
|
564
|
+
getValid(idHash: string, atIso?: string): AuthSessionRecord | null;
|
|
565
|
+
delete(idHash: string): boolean;
|
|
566
|
+
deleteExpired(atIso?: string): number;
|
|
567
|
+
};
|
|
568
|
+
declare function createAuthLoginFlowRepo(db: LeitwerkDb): {
|
|
569
|
+
create(input: {
|
|
570
|
+
idHash: string;
|
|
571
|
+
providerId: string;
|
|
572
|
+
state: string;
|
|
573
|
+
pkceVerifier: string;
|
|
574
|
+
expiresAt: string;
|
|
575
|
+
}): AuthLoginFlowRecord;
|
|
576
|
+
getValid(idHash: string, atIso?: string): AuthLoginFlowRecord | null;
|
|
577
|
+
delete(idHash: string): boolean;
|
|
578
|
+
deleteExpired(atIso?: string): number;
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
interface CreateExternalWriteLogInput extends ExternalWriteLogRecordInput {
|
|
582
|
+
}
|
|
583
|
+
declare function createExternalWriteLogRepo(db: LeitwerkDb): {
|
|
584
|
+
record(input: CreateExternalWriteLogInput): ExternalWriteLog;
|
|
585
|
+
hasDedupKey(dedupKey: string): boolean;
|
|
586
|
+
listByInstance(instanceId: string): ExternalWriteLog[];
|
|
587
|
+
};
|
|
588
|
+
|
|
589
|
+
interface FutureExecutionWritableFields {
|
|
590
|
+
scheduleKind: FutureExecutionScheduleKind;
|
|
591
|
+
processId: string;
|
|
592
|
+
instanceId?: string | null;
|
|
593
|
+
launcherId?: string | null;
|
|
594
|
+
actionId?: string | null;
|
|
595
|
+
payloadJson: string;
|
|
596
|
+
cronExpression?: string | null;
|
|
597
|
+
nextRunAt: string;
|
|
598
|
+
modelSelection?: DurableModelSelection | null;
|
|
599
|
+
blockedReason?: FutureExecutionBlockReason | null;
|
|
600
|
+
}
|
|
601
|
+
interface CreateFutureExecutionInput extends FutureExecutionWritableFields {
|
|
602
|
+
id?: string;
|
|
603
|
+
kind: FutureExecutionKind;
|
|
604
|
+
}
|
|
605
|
+
interface FutureExecutionOverviewQuery {
|
|
606
|
+
query?: string;
|
|
607
|
+
processType?: string;
|
|
608
|
+
status?: "all" | "running" | "scheduled" | "needs_attention" | "completed" | "aborted";
|
|
609
|
+
matchingLauncherIdsByTerm?: readonly (readonly string[])[];
|
|
610
|
+
}
|
|
611
|
+
interface FutureExecutionOverviewPageQuery extends FutureExecutionOverviewQuery {
|
|
612
|
+
limit: number;
|
|
613
|
+
offset: number;
|
|
614
|
+
}
|
|
615
|
+
interface FutureExecutionOverviewWindowQuery extends FutureExecutionOverviewQuery {
|
|
616
|
+
limit: number;
|
|
617
|
+
sortKey: "status" | "title" | "timeline";
|
|
618
|
+
sortDirection: "asc" | "desc";
|
|
619
|
+
launcherFallbackTitles: Readonly<Record<string, string>>;
|
|
620
|
+
}
|
|
621
|
+
type UpdateFutureExecutionInput = Partial<FutureExecutionWritableFields>;
|
|
622
|
+
declare function createFutureExecutionRepo(db: LeitwerkDb): {
|
|
623
|
+
create(input: CreateFutureExecutionInput): FutureExecution;
|
|
624
|
+
getById(id: string): FutureExecution | null;
|
|
625
|
+
listAll(): FutureExecution[];
|
|
626
|
+
countOverview(input: FutureExecutionOverviewQuery): number;
|
|
627
|
+
listOverviewProcessTypes(input: Pick<FutureExecutionOverviewQuery, "query" | "status" | "matchingLauncherIdsByTerm">): {
|
|
628
|
+
processId: string;
|
|
629
|
+
value: number;
|
|
630
|
+
}[];
|
|
631
|
+
listOverviewWindow(input: FutureExecutionOverviewWindowQuery): FutureExecution[];
|
|
632
|
+
listOverviewPage(input: FutureExecutionOverviewPageQuery): {
|
|
633
|
+
items: FutureExecution[];
|
|
634
|
+
total: number;
|
|
635
|
+
};
|
|
636
|
+
listByInstance(instanceId: string): FutureExecution[];
|
|
637
|
+
listRunnableDue(asOf: string): FutureExecution[];
|
|
638
|
+
listBlockedCronDue(asOf: string): FutureExecution[];
|
|
639
|
+
getScheduledActionByInstance(instanceId: string): FutureExecution | null;
|
|
640
|
+
updatePayloadJsonIfUnchanged(id: string, expectedPayloadJson: string, payloadJson: string): FutureExecution | null;
|
|
641
|
+
update(id: string, input: UpdateFutureExecutionInput): FutureExecution | null;
|
|
642
|
+
delete(id: string): boolean;
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
interface CreateLaunchRunInput {
|
|
646
|
+
launcherId: string | null;
|
|
647
|
+
idempotencyKey?: string | null;
|
|
648
|
+
origin: LaunchOrigin;
|
|
649
|
+
steps: readonly LaunchChecklistStep[];
|
|
650
|
+
}
|
|
651
|
+
declare function createLaunchRunRepo(db: LeitwerkDb): {
|
|
652
|
+
create(input: CreateLaunchRunInput): LaunchRun;
|
|
653
|
+
getById(id: string): LaunchRun | null;
|
|
654
|
+
saveReplay(runId: string, payload: unknown): void;
|
|
655
|
+
getReplay<T>(runId: string): T | null;
|
|
656
|
+
deleteReplay(runId: string): void;
|
|
657
|
+
getByIdempotencyKey(key: string): LaunchRun | null;
|
|
658
|
+
archiveIdempotencyKey(id: string, key: string): void;
|
|
659
|
+
listByInstance: (instanceId: string) => LaunchRun[];
|
|
660
|
+
listIncomplete: () => LaunchRun[];
|
|
661
|
+
compareAndSet(next: LaunchRun, expectedRevision: number): LaunchRun | null;
|
|
662
|
+
update(id: string, mutate: (current: LaunchRun) => LaunchRun): LaunchRun | null;
|
|
663
|
+
};
|
|
664
|
+
|
|
665
|
+
interface LauncherRecentValue {
|
|
666
|
+
id: string;
|
|
667
|
+
launcherId: string;
|
|
668
|
+
fieldId: string;
|
|
669
|
+
value: string;
|
|
670
|
+
createdAt: string;
|
|
671
|
+
updatedAt: string;
|
|
672
|
+
}
|
|
673
|
+
declare function createLauncherRecentValueRepo(db: LeitwerkDb): {
|
|
674
|
+
listByLauncher(launcherId: string): LauncherRecentValue[];
|
|
675
|
+
recordValue(input: {
|
|
676
|
+
launcherId: string;
|
|
677
|
+
fieldId: string;
|
|
678
|
+
value: string;
|
|
679
|
+
limit?: number;
|
|
680
|
+
}): LauncherRecentValue;
|
|
681
|
+
pruneField(launcherId: string, fieldId: string, limit?: number): void;
|
|
682
|
+
};
|
|
683
|
+
|
|
684
|
+
interface PendingExternalSourceFire {
|
|
685
|
+
id: string;
|
|
686
|
+
instanceId: string;
|
|
687
|
+
armingId: string;
|
|
688
|
+
turnId: string;
|
|
689
|
+
externalActionId: string;
|
|
690
|
+
sourceKind: string;
|
|
691
|
+
input: Record<string, unknown>;
|
|
692
|
+
event: Record<string, unknown>;
|
|
693
|
+
mergeKey: string | null;
|
|
694
|
+
queuedCount: number;
|
|
695
|
+
createdAt: string;
|
|
696
|
+
updatedAt: string;
|
|
697
|
+
}
|
|
698
|
+
interface CreatePendingExternalSourceFireInput {
|
|
699
|
+
instanceId: string;
|
|
700
|
+
armingId: string;
|
|
701
|
+
turnId: string;
|
|
702
|
+
externalActionId: string;
|
|
703
|
+
sourceKind?: string;
|
|
704
|
+
input?: Record<string, unknown>;
|
|
705
|
+
event?: Record<string, unknown>;
|
|
706
|
+
mergeKey?: string | null;
|
|
707
|
+
queuedCount?: number;
|
|
708
|
+
}
|
|
709
|
+
interface UpdatePendingExternalSourceFireInput {
|
|
710
|
+
input?: Record<string, unknown>;
|
|
711
|
+
event?: Record<string, unknown>;
|
|
712
|
+
queuedCount?: number;
|
|
713
|
+
}
|
|
714
|
+
declare function createPendingExternalSourceFireRepo(db: LeitwerkDb): {
|
|
715
|
+
create(input: CreatePendingExternalSourceFireInput): PendingExternalSourceFire;
|
|
716
|
+
listByInstance(instanceId: string): PendingExternalSourceFire[];
|
|
717
|
+
getByMergeKey(instanceId: string, armingId: string, mergeKey: string): PendingExternalSourceFire | null;
|
|
718
|
+
update(id: string, input: UpdatePendingExternalSourceFireInput): PendingExternalSourceFire | null;
|
|
719
|
+
delete(id: string): boolean;
|
|
720
|
+
};
|
|
721
|
+
|
|
722
|
+
interface CreateProcessEventInput {
|
|
723
|
+
instanceId: string;
|
|
724
|
+
eventType: string;
|
|
725
|
+
data?: Record<string, unknown>;
|
|
726
|
+
}
|
|
727
|
+
declare function createProcessEventRepo(db: LeitwerkDb): {
|
|
728
|
+
create(input: CreateProcessEventInput): ProcessEvent;
|
|
729
|
+
latestSequence(instanceId: string): number;
|
|
730
|
+
listByTurnRecord(instanceId: string, turnRecordId: string): ProcessEvent[];
|
|
731
|
+
latestByTurnRecordEventType(instanceId: string, turnRecordId: string, eventType: string): ProcessEvent | null;
|
|
732
|
+
summary(turnRecordId: string): _leitwerk_dev_protocol.CompactTurnSummary | null;
|
|
733
|
+
listByInstance(instanceId: string, limit?: number): ProcessEvent[];
|
|
734
|
+
listByInstanceEventTypes(instanceId: string, eventTypes: readonly string[], limit?: number): ProcessEvent[];
|
|
735
|
+
listByInstanceSince(instanceId: string, sinceCreatedAt: string, options?: {
|
|
736
|
+
limit?: number;
|
|
737
|
+
eventTypePrefix?: string;
|
|
738
|
+
}): ProcessEvent[];
|
|
739
|
+
listByInstanceTurnRecordEventTypes(instanceId: string, turnRecordId: string, eventTypes: readonly string[]): ProcessEvent[];
|
|
740
|
+
listByInstanceSinceEventTypes(instanceId: string, sinceCreatedAt: string, eventTypes: readonly string[], limit?: number): ProcessEvent[];
|
|
741
|
+
};
|
|
742
|
+
|
|
743
|
+
interface ProcessHandoffDedupKeyRecord extends HandoffDedupKeyRecordLike {
|
|
744
|
+
}
|
|
745
|
+
interface CreateProcessHandoffDedupKeyInput {
|
|
746
|
+
key: string;
|
|
747
|
+
instanceId: string;
|
|
748
|
+
metadata?: Record<string, unknown> | null;
|
|
749
|
+
}
|
|
750
|
+
declare function createProcessHandoffDedupKeyRepo(db: LeitwerkDb): {
|
|
751
|
+
create(input: CreateProcessHandoffDedupKeyInput): ProcessHandoffDedupKeyRecord;
|
|
752
|
+
getByKey(key: string): ProcessHandoffDedupKeyRecord | null;
|
|
753
|
+
};
|
|
754
|
+
|
|
755
|
+
interface CreateProcessInputInput {
|
|
756
|
+
instanceId: string;
|
|
757
|
+
sequence: number;
|
|
758
|
+
source: InputSource;
|
|
759
|
+
kind: InputKind;
|
|
760
|
+
target?: ProcessInputTarget | null;
|
|
761
|
+
bodyMarkdown: string;
|
|
762
|
+
actor?: Actor;
|
|
763
|
+
}
|
|
764
|
+
declare function createProcessInputRepo(db: LeitwerkDb): {
|
|
765
|
+
create(input: CreateProcessInputInput): ProcessInput;
|
|
766
|
+
listByInstance: (instanceId: string) => ProcessInput[];
|
|
767
|
+
listUnconsumed: (instanceId: string) => ProcessInput[];
|
|
768
|
+
markConsumed(id: string): boolean;
|
|
769
|
+
delete(id: string): boolean;
|
|
770
|
+
getMaxSequence(instanceId: string): number;
|
|
771
|
+
};
|
|
772
|
+
|
|
773
|
+
interface ProcessLaunchIntent {
|
|
774
|
+
launcherId: string;
|
|
775
|
+
launcherInput: Record<string, unknown>;
|
|
776
|
+
}
|
|
777
|
+
interface CreateProcessInstanceInput extends ProcessCustomizableFields {
|
|
778
|
+
processId: string;
|
|
779
|
+
selectedTurnId?: TurnId | null;
|
|
780
|
+
lifecycleStatus?: ProcessLifecycleStatus;
|
|
781
|
+
currentExecution?: CurrentExecutionRef;
|
|
782
|
+
selectedTurnModelKind?: ModelSelectionKind | null;
|
|
783
|
+
selectedTurnModelSource?: ProcessSelectedTurnModelSource | null;
|
|
784
|
+
paramsJson?: string | null;
|
|
785
|
+
stateJson?: string | null;
|
|
786
|
+
launchIntent?: ProcessLaunchIntent;
|
|
787
|
+
}
|
|
788
|
+
type ProcessOverviewStatusFilter = "all" | "running" | "needs_attention" | "completed" | "aborted" | "scheduled";
|
|
789
|
+
interface ProcessOverviewQuery {
|
|
790
|
+
query?: string;
|
|
791
|
+
processType?: string;
|
|
792
|
+
status?: ProcessOverviewStatusFilter;
|
|
793
|
+
}
|
|
794
|
+
interface ProcessOverviewWindowQuery extends ProcessOverviewQuery {
|
|
795
|
+
limit: number;
|
|
796
|
+
sortKey: "status" | "title" | "timeline";
|
|
797
|
+
sortDirection: "asc" | "desc";
|
|
798
|
+
}
|
|
799
|
+
interface UpdateProcessInstanceInput extends ProcessCustomizableFields {
|
|
800
|
+
selectedTurnId?: TurnId | null;
|
|
801
|
+
lifecycleStatus?: ProcessLifecycleStatus;
|
|
802
|
+
currentExecution?: CurrentExecutionRef;
|
|
803
|
+
planRevision?: number;
|
|
804
|
+
selectedTurnModelKind?: ModelSelectionKind | null;
|
|
805
|
+
selectedTurnModelSource?: ProcessSelectedTurnModelSource | null;
|
|
806
|
+
paramsJson?: string | null;
|
|
807
|
+
stateJson?: string | null;
|
|
808
|
+
}
|
|
809
|
+
declare function createProcessInstanceRepo(db: LeitwerkDb): {
|
|
810
|
+
getLaunchIntent(instanceId: string): ProcessLaunchIntent | null;
|
|
811
|
+
create(input: CreateProcessInstanceInput): ProcessInstance;
|
|
812
|
+
getById(id: string): ProcessInstance | null;
|
|
813
|
+
listAll(): ProcessInstance[];
|
|
814
|
+
listCurrent(limit: number): ProcessInstance[];
|
|
815
|
+
countCurrent(): number;
|
|
816
|
+
countOverview(input: ProcessOverviewQuery): number;
|
|
817
|
+
countOverviewByLifecycle(input: Pick<ProcessOverviewQuery, "query" | "processType">): {
|
|
818
|
+
lifecycleStatus: string;
|
|
819
|
+
value: number;
|
|
820
|
+
}[];
|
|
821
|
+
listOverviewProcessTypes(input: Pick<ProcessOverviewQuery, "query" | "status">): {
|
|
822
|
+
processId: string;
|
|
823
|
+
value: number;
|
|
824
|
+
}[];
|
|
825
|
+
listOverviewWindow(input: ProcessOverviewWindowQuery): ProcessInstance[];
|
|
826
|
+
setGeneratedTitleIfBlank(id: string, title: string): ProcessInstance | null;
|
|
827
|
+
update(id: string, input: UpdateProcessInstanceInput): ProcessInstance | null;
|
|
828
|
+
delete(id: string): boolean;
|
|
829
|
+
};
|
|
830
|
+
|
|
831
|
+
interface CreateProcessLeafOutcomeSnapshotInput {
|
|
832
|
+
id?: string;
|
|
833
|
+
instanceId: string;
|
|
834
|
+
leafEntryId: string;
|
|
835
|
+
turnRecordId?: string | null;
|
|
836
|
+
rendererId?: string | null;
|
|
837
|
+
schemaVersion?: number | null;
|
|
838
|
+
props?: Record<string, unknown> | null;
|
|
839
|
+
fallbackMarkdown?: string | null;
|
|
840
|
+
status: ProcessLeafOutcomeSnapshotStatus;
|
|
841
|
+
warningCode?: string | null;
|
|
842
|
+
warningMessage?: string | null;
|
|
843
|
+
anchoredAt: string;
|
|
844
|
+
createdAt?: string;
|
|
845
|
+
}
|
|
846
|
+
declare function createProcessLeafOutcomeSnapshotRepo(db: LeitwerkDb): {
|
|
847
|
+
create(input: CreateProcessLeafOutcomeSnapshotInput): ProcessLeafOutcomeSnapshot;
|
|
848
|
+
listByInstance(instanceId: string): ProcessLeafOutcomeSnapshot[];
|
|
849
|
+
getByInstanceAndLeafEntryId(instanceId: string, leafEntryId: string): ProcessLeafOutcomeSnapshot | null;
|
|
850
|
+
};
|
|
851
|
+
|
|
852
|
+
interface CreateProcessProjectInput extends UpdateProcessProjectInput {
|
|
853
|
+
instanceId: string;
|
|
854
|
+
key: string;
|
|
855
|
+
repoLocator: string;
|
|
856
|
+
baseBranch: string;
|
|
857
|
+
}
|
|
858
|
+
interface UpdateProcessProjectInput {
|
|
859
|
+
repoLocator?: string;
|
|
860
|
+
workBranch?: string | null;
|
|
861
|
+
externalId?: string | null;
|
|
862
|
+
externalUrl?: string | null;
|
|
863
|
+
metadata?: Record<string, unknown> | null;
|
|
864
|
+
pipelineStatus?: string | null;
|
|
865
|
+
baseBranch?: string;
|
|
866
|
+
}
|
|
867
|
+
declare function createProcessProjectRepo(db: LeitwerkDb): {
|
|
868
|
+
create(input: CreateProcessProjectInput): ProcessProject;
|
|
869
|
+
getById(id: string): ProcessProject | null;
|
|
870
|
+
listByInstance(instanceId: string): ProcessProject[];
|
|
871
|
+
listByInstances(instanceIds: readonly string[]): ProcessProject[];
|
|
872
|
+
getByInstanceAndKey(instanceId: string, key: string): ProcessProject | null;
|
|
873
|
+
update(id: string, input: UpdateProcessProjectInput): ProcessProject | null;
|
|
874
|
+
};
|
|
875
|
+
|
|
876
|
+
interface CreateQuestionRequestInput {
|
|
877
|
+
instanceId: string;
|
|
878
|
+
turnRecordId: string;
|
|
879
|
+
toolCallId: string;
|
|
880
|
+
questions: readonly NormalizedQuestion[];
|
|
881
|
+
askedAt?: string;
|
|
882
|
+
}
|
|
883
|
+
declare function createProcessQuestionRequestRepo(db: LeitwerkDb): {
|
|
884
|
+
getById: (id: string) => ProcessQuestionRequest | null;
|
|
885
|
+
listByInstance: (instanceId: string) => ProcessQuestionRequest[];
|
|
886
|
+
listOpen: (instanceId?: string) => ProcessQuestionRequest[];
|
|
887
|
+
createIdempotent(input: CreateQuestionRequestInput): {
|
|
888
|
+
kind: "created" | "replay";
|
|
889
|
+
request: ProcessQuestionRequest;
|
|
890
|
+
};
|
|
891
|
+
answer(input: {
|
|
892
|
+
id: string;
|
|
893
|
+
answers: readonly string[];
|
|
894
|
+
actor: Actor;
|
|
895
|
+
answeredAt?: string;
|
|
896
|
+
}): ProcessQuestionRequest | null;
|
|
897
|
+
cancelOpenByTurn(instanceId: string, turnRecordId: string): number;
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
declare function createProcessRelationRepo(db: LeitwerkDb): {
|
|
901
|
+
create(input: Omit<ProcessRelation, "kind" | "createdAt"> & {
|
|
902
|
+
createdAt?: string;
|
|
903
|
+
}): ProcessRelation;
|
|
904
|
+
getByChild(childInstanceId: string): ProcessRelation | null;
|
|
905
|
+
listByParent(parentInstanceId: string): ProcessRelation[];
|
|
906
|
+
};
|
|
907
|
+
|
|
908
|
+
interface PiResourceLimits {
|
|
909
|
+
readonly maxFiles?: number;
|
|
910
|
+
readonly maxFileBytes?: number;
|
|
911
|
+
readonly maxTotalBytes?: number;
|
|
912
|
+
}
|
|
913
|
+
interface ResourceOwner {
|
|
914
|
+
readonly kind: Exclude<PiResourceProvenanceKind, "generated">;
|
|
915
|
+
readonly ownerExtensionId: string | null;
|
|
916
|
+
readonly packageName: string | null;
|
|
917
|
+
}
|
|
918
|
+
interface PiResourceLayer {
|
|
919
|
+
readonly bundle: PiResourceBundle;
|
|
920
|
+
readonly owner: ResourceOwner;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
declare function createProcessSkillRepo(db: LeitwerkDb): {
|
|
924
|
+
attach(instanceId: string, selections: readonly SkillSelection[]): void;
|
|
925
|
+
listSelections(instanceId: string): SkillSelection[];
|
|
926
|
+
listResourceLayers(instanceId: string): PiResourceLayer[];
|
|
927
|
+
};
|
|
928
|
+
|
|
929
|
+
declare const processTitleJobs: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
930
|
+
name: "process_title_jobs";
|
|
931
|
+
schema: undefined;
|
|
932
|
+
columns: {
|
|
933
|
+
id: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
934
|
+
name: string;
|
|
935
|
+
tableName: "process_title_jobs";
|
|
936
|
+
dataType: "string";
|
|
937
|
+
data: string;
|
|
938
|
+
driverParam: string;
|
|
939
|
+
notNull: true;
|
|
940
|
+
hasDefault: false;
|
|
941
|
+
isPrimaryKey: true;
|
|
942
|
+
isAutoincrement: false;
|
|
943
|
+
hasRuntimeDefault: false;
|
|
944
|
+
enumValues: [string, ...string[]];
|
|
945
|
+
baseColumn: never;
|
|
946
|
+
identity: undefined;
|
|
947
|
+
generated: undefined;
|
|
948
|
+
}, {}>;
|
|
949
|
+
targetKind: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
950
|
+
name: string;
|
|
951
|
+
tableName: "process_title_jobs";
|
|
952
|
+
dataType: "string enum";
|
|
953
|
+
data: "process" | "future_execution";
|
|
954
|
+
driverParam: string;
|
|
955
|
+
notNull: true;
|
|
956
|
+
hasDefault: false;
|
|
957
|
+
isPrimaryKey: false;
|
|
958
|
+
isAutoincrement: false;
|
|
959
|
+
hasRuntimeDefault: false;
|
|
960
|
+
enumValues: ["process", "future_execution"];
|
|
961
|
+
baseColumn: never;
|
|
962
|
+
identity: undefined;
|
|
963
|
+
generated: undefined;
|
|
964
|
+
}, {}>;
|
|
965
|
+
processDefinitionId: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
966
|
+
name: string;
|
|
967
|
+
tableName: "process_title_jobs";
|
|
968
|
+
dataType: "string";
|
|
969
|
+
data: string;
|
|
970
|
+
driverParam: string;
|
|
971
|
+
notNull: true;
|
|
972
|
+
hasDefault: false;
|
|
973
|
+
isPrimaryKey: false;
|
|
974
|
+
isAutoincrement: false;
|
|
975
|
+
hasRuntimeDefault: false;
|
|
976
|
+
enumValues: [string, ...string[]];
|
|
977
|
+
baseColumn: never;
|
|
978
|
+
identity: undefined;
|
|
979
|
+
generated: undefined;
|
|
980
|
+
}, {}>;
|
|
981
|
+
processInstanceId: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
982
|
+
name: string;
|
|
983
|
+
tableName: "process_title_jobs";
|
|
984
|
+
dataType: "string";
|
|
985
|
+
data: string;
|
|
986
|
+
driverParam: string;
|
|
987
|
+
notNull: false;
|
|
988
|
+
hasDefault: false;
|
|
989
|
+
isPrimaryKey: false;
|
|
990
|
+
isAutoincrement: false;
|
|
991
|
+
hasRuntimeDefault: false;
|
|
992
|
+
enumValues: [string, ...string[]];
|
|
993
|
+
baseColumn: never;
|
|
994
|
+
identity: undefined;
|
|
995
|
+
generated: undefined;
|
|
996
|
+
}, {}>;
|
|
997
|
+
futureExecutionId: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
998
|
+
name: string;
|
|
999
|
+
tableName: "process_title_jobs";
|
|
1000
|
+
dataType: "string";
|
|
1001
|
+
data: string;
|
|
1002
|
+
driverParam: string;
|
|
1003
|
+
notNull: false;
|
|
1004
|
+
hasDefault: false;
|
|
1005
|
+
isPrimaryKey: false;
|
|
1006
|
+
isAutoincrement: false;
|
|
1007
|
+
hasRuntimeDefault: false;
|
|
1008
|
+
enumValues: [string, ...string[]];
|
|
1009
|
+
baseColumn: never;
|
|
1010
|
+
identity: undefined;
|
|
1011
|
+
generated: undefined;
|
|
1012
|
+
}, {}>;
|
|
1013
|
+
launchRunId: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
1014
|
+
name: string;
|
|
1015
|
+
tableName: "process_title_jobs";
|
|
1016
|
+
dataType: "string";
|
|
1017
|
+
data: string;
|
|
1018
|
+
driverParam: string;
|
|
1019
|
+
notNull: false;
|
|
1020
|
+
hasDefault: false;
|
|
1021
|
+
isPrimaryKey: false;
|
|
1022
|
+
isAutoincrement: false;
|
|
1023
|
+
hasRuntimeDefault: false;
|
|
1024
|
+
enumValues: [string, ...string[]];
|
|
1025
|
+
baseColumn: never;
|
|
1026
|
+
identity: undefined;
|
|
1027
|
+
generated: undefined;
|
|
1028
|
+
}, {}>;
|
|
1029
|
+
modelProfileId: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
1030
|
+
name: string;
|
|
1031
|
+
tableName: "process_title_jobs";
|
|
1032
|
+
dataType: "string";
|
|
1033
|
+
data: string;
|
|
1034
|
+
driverParam: string;
|
|
1035
|
+
notNull: true;
|
|
1036
|
+
hasDefault: false;
|
|
1037
|
+
isPrimaryKey: false;
|
|
1038
|
+
isAutoincrement: false;
|
|
1039
|
+
hasRuntimeDefault: false;
|
|
1040
|
+
enumValues: [string, ...string[]];
|
|
1041
|
+
baseColumn: never;
|
|
1042
|
+
identity: undefined;
|
|
1043
|
+
generated: undefined;
|
|
1044
|
+
}, {}>;
|
|
1045
|
+
prompt: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
1046
|
+
name: string;
|
|
1047
|
+
tableName: "process_title_jobs";
|
|
1048
|
+
dataType: "string";
|
|
1049
|
+
data: string;
|
|
1050
|
+
driverParam: string;
|
|
1051
|
+
notNull: true;
|
|
1052
|
+
hasDefault: false;
|
|
1053
|
+
isPrimaryKey: false;
|
|
1054
|
+
isAutoincrement: false;
|
|
1055
|
+
hasRuntimeDefault: false;
|
|
1056
|
+
enumValues: [string, ...string[]];
|
|
1057
|
+
baseColumn: never;
|
|
1058
|
+
identity: undefined;
|
|
1059
|
+
generated: undefined;
|
|
1060
|
+
}, {}>;
|
|
1061
|
+
expectedPayloadJson: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
1062
|
+
name: string;
|
|
1063
|
+
tableName: "process_title_jobs";
|
|
1064
|
+
dataType: "string";
|
|
1065
|
+
data: string;
|
|
1066
|
+
driverParam: string;
|
|
1067
|
+
notNull: false;
|
|
1068
|
+
hasDefault: false;
|
|
1069
|
+
isPrimaryKey: false;
|
|
1070
|
+
isAutoincrement: false;
|
|
1071
|
+
hasRuntimeDefault: false;
|
|
1072
|
+
enumValues: [string, ...string[]];
|
|
1073
|
+
baseColumn: never;
|
|
1074
|
+
identity: undefined;
|
|
1075
|
+
generated: undefined;
|
|
1076
|
+
}, {}>;
|
|
1077
|
+
status: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
1078
|
+
name: string;
|
|
1079
|
+
tableName: "process_title_jobs";
|
|
1080
|
+
dataType: "string enum";
|
|
1081
|
+
data: "pending" | "running" | "completed" | "superseded" | "failed";
|
|
1082
|
+
driverParam: string;
|
|
1083
|
+
notNull: true;
|
|
1084
|
+
hasDefault: false;
|
|
1085
|
+
isPrimaryKey: false;
|
|
1086
|
+
isAutoincrement: false;
|
|
1087
|
+
hasRuntimeDefault: false;
|
|
1088
|
+
enumValues: ["pending", "running", "completed", "superseded", "failed"];
|
|
1089
|
+
baseColumn: never;
|
|
1090
|
+
identity: undefined;
|
|
1091
|
+
generated: undefined;
|
|
1092
|
+
}, {}>;
|
|
1093
|
+
attemptCount: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
1094
|
+
name: string;
|
|
1095
|
+
tableName: "process_title_jobs";
|
|
1096
|
+
dataType: "number int53";
|
|
1097
|
+
data: number;
|
|
1098
|
+
driverParam: number;
|
|
1099
|
+
notNull: true;
|
|
1100
|
+
hasDefault: true;
|
|
1101
|
+
isPrimaryKey: false;
|
|
1102
|
+
isAutoincrement: false;
|
|
1103
|
+
hasRuntimeDefault: false;
|
|
1104
|
+
enumValues: undefined;
|
|
1105
|
+
baseColumn: never;
|
|
1106
|
+
identity: undefined;
|
|
1107
|
+
generated: undefined;
|
|
1108
|
+
}, {}>;
|
|
1109
|
+
maxAttempts: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
1110
|
+
name: string;
|
|
1111
|
+
tableName: "process_title_jobs";
|
|
1112
|
+
dataType: "number int53";
|
|
1113
|
+
data: number;
|
|
1114
|
+
driverParam: number;
|
|
1115
|
+
notNull: true;
|
|
1116
|
+
hasDefault: false;
|
|
1117
|
+
isPrimaryKey: false;
|
|
1118
|
+
isAutoincrement: false;
|
|
1119
|
+
hasRuntimeDefault: false;
|
|
1120
|
+
enumValues: undefined;
|
|
1121
|
+
baseColumn: never;
|
|
1122
|
+
identity: undefined;
|
|
1123
|
+
generated: undefined;
|
|
1124
|
+
}, {}>;
|
|
1125
|
+
nextRunAt: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
1126
|
+
name: string;
|
|
1127
|
+
tableName: "process_title_jobs";
|
|
1128
|
+
dataType: "string";
|
|
1129
|
+
data: string;
|
|
1130
|
+
driverParam: string;
|
|
1131
|
+
notNull: true;
|
|
1132
|
+
hasDefault: false;
|
|
1133
|
+
isPrimaryKey: false;
|
|
1134
|
+
isAutoincrement: false;
|
|
1135
|
+
hasRuntimeDefault: false;
|
|
1136
|
+
enumValues: [string, ...string[]];
|
|
1137
|
+
baseColumn: never;
|
|
1138
|
+
identity: undefined;
|
|
1139
|
+
generated: undefined;
|
|
1140
|
+
}, {}>;
|
|
1141
|
+
lastError: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
1142
|
+
name: string;
|
|
1143
|
+
tableName: "process_title_jobs";
|
|
1144
|
+
dataType: "string";
|
|
1145
|
+
data: string;
|
|
1146
|
+
driverParam: string;
|
|
1147
|
+
notNull: false;
|
|
1148
|
+
hasDefault: false;
|
|
1149
|
+
isPrimaryKey: false;
|
|
1150
|
+
isAutoincrement: false;
|
|
1151
|
+
hasRuntimeDefault: false;
|
|
1152
|
+
enumValues: [string, ...string[]];
|
|
1153
|
+
baseColumn: never;
|
|
1154
|
+
identity: undefined;
|
|
1155
|
+
generated: undefined;
|
|
1156
|
+
}, {}>;
|
|
1157
|
+
createdAt: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
1158
|
+
name: string;
|
|
1159
|
+
tableName: "process_title_jobs";
|
|
1160
|
+
dataType: "string";
|
|
1161
|
+
data: string;
|
|
1162
|
+
driverParam: string;
|
|
1163
|
+
notNull: true;
|
|
1164
|
+
hasDefault: false;
|
|
1165
|
+
isPrimaryKey: false;
|
|
1166
|
+
isAutoincrement: false;
|
|
1167
|
+
hasRuntimeDefault: false;
|
|
1168
|
+
enumValues: [string, ...string[]];
|
|
1169
|
+
baseColumn: never;
|
|
1170
|
+
identity: undefined;
|
|
1171
|
+
generated: undefined;
|
|
1172
|
+
}, {}>;
|
|
1173
|
+
updatedAt: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
1174
|
+
name: string;
|
|
1175
|
+
tableName: "process_title_jobs";
|
|
1176
|
+
dataType: "string";
|
|
1177
|
+
data: string;
|
|
1178
|
+
driverParam: string;
|
|
1179
|
+
notNull: true;
|
|
1180
|
+
hasDefault: false;
|
|
1181
|
+
isPrimaryKey: false;
|
|
1182
|
+
isAutoincrement: false;
|
|
1183
|
+
hasRuntimeDefault: false;
|
|
1184
|
+
enumValues: [string, ...string[]];
|
|
1185
|
+
baseColumn: never;
|
|
1186
|
+
identity: undefined;
|
|
1187
|
+
generated: undefined;
|
|
1188
|
+
}, {}>;
|
|
1189
|
+
};
|
|
1190
|
+
dialect: "sqlite";
|
|
1191
|
+
}>;
|
|
1192
|
+
|
|
1193
|
+
type ProcessTitleJob = typeof processTitleJobs.$inferSelect;
|
|
1194
|
+
type EnqueueProcessTitleJobInput = {
|
|
1195
|
+
processDefinitionId: string;
|
|
1196
|
+
modelProfileId: string;
|
|
1197
|
+
prompt: string;
|
|
1198
|
+
maxAttempts: number;
|
|
1199
|
+
nextRunAt: string;
|
|
1200
|
+
} & ({
|
|
1201
|
+
processInstanceId: string;
|
|
1202
|
+
launchRunId?: string | null;
|
|
1203
|
+
} | {
|
|
1204
|
+
futureExecutionId: string;
|
|
1205
|
+
expectedPayloadJson: string;
|
|
1206
|
+
});
|
|
1207
|
+
declare function createProcessTitleJobRepo(db: LeitwerkDb): {
|
|
1208
|
+
enqueue(input: EnqueueProcessTitleJobInput): ProcessTitleJob;
|
|
1209
|
+
getById(id: string): ProcessTitleJob | null;
|
|
1210
|
+
listByProcessInstance(processInstanceId: string): ProcessTitleJob[];
|
|
1211
|
+
listAll(): ProcessTitleJob[];
|
|
1212
|
+
listDuePending(asOf: string, limit: number): ProcessTitleJob[];
|
|
1213
|
+
markRunning(id: string): ProcessTitleJob | null;
|
|
1214
|
+
reschedule(id: string, nextRunAt: string, lastError: string): ProcessTitleJob | null;
|
|
1215
|
+
markCompleted(id: string): ProcessTitleJob | null;
|
|
1216
|
+
markFailed(id: string, lastError: string): ProcessTitleJob | null;
|
|
1217
|
+
markSuperseded(id: string): ProcessTitleJob | null;
|
|
1218
|
+
};
|
|
1219
|
+
|
|
1220
|
+
declare function createProcessToolApprovalRequestRepo(db: LeitwerkDb): {
|
|
1221
|
+
listByInstance: (instanceId: string) => ProcessToolApprovalRequest[];
|
|
1222
|
+
listOpen: (instanceId?: string) => ProcessToolApprovalRequest[];
|
|
1223
|
+
createIdempotent(input: {
|
|
1224
|
+
instanceId: string;
|
|
1225
|
+
turnRecordId: string;
|
|
1226
|
+
toolCallId: string;
|
|
1227
|
+
toolName: string;
|
|
1228
|
+
arguments: Record<string, unknown>;
|
|
1229
|
+
destination?: ProcessToolApprovalDestination;
|
|
1230
|
+
requestedAt?: string;
|
|
1231
|
+
}): {
|
|
1232
|
+
kind: "created" | "replay";
|
|
1233
|
+
request: ProcessToolApprovalRequest;
|
|
1234
|
+
};
|
|
1235
|
+
resolve(input: {
|
|
1236
|
+
id: string;
|
|
1237
|
+
status: Exclude<ToolApprovalStatus, "open" | "cancelled">;
|
|
1238
|
+
actor: Actor;
|
|
1239
|
+
feedback?: string;
|
|
1240
|
+
resolvedAt?: string;
|
|
1241
|
+
}): ProcessToolApprovalRequest | null;
|
|
1242
|
+
cancelOpenByTurn(instanceId: string, turnRecordId: string): number;
|
|
1243
|
+
};
|
|
1244
|
+
|
|
1245
|
+
interface CreateProcessTurnAnnotationInput {
|
|
1246
|
+
id?: string;
|
|
1247
|
+
instanceId: string;
|
|
1248
|
+
annotationType: string;
|
|
1249
|
+
/** Null means append-only and therefore not addressable via upsert key. */
|
|
1250
|
+
annotationKey?: string | null;
|
|
1251
|
+
references?: readonly TurnAnnotationReference[];
|
|
1252
|
+
payload?: Record<string, unknown>;
|
|
1253
|
+
createdAt?: string;
|
|
1254
|
+
updatedAt?: string;
|
|
1255
|
+
}
|
|
1256
|
+
interface UpdateProcessTurnAnnotationInput {
|
|
1257
|
+
annotationType?: string;
|
|
1258
|
+
/** Null means append-only and therefore not addressable via upsert key. */
|
|
1259
|
+
annotationKey?: string | null;
|
|
1260
|
+
references?: readonly TurnAnnotationReference[];
|
|
1261
|
+
payload?: Record<string, unknown>;
|
|
1262
|
+
updatedAt?: string;
|
|
1263
|
+
}
|
|
1264
|
+
declare function createProcessTurnAnnotationRepo(db: LeitwerkDb): {
|
|
1265
|
+
create(input: CreateProcessTurnAnnotationInput): ProcessTurnAnnotation;
|
|
1266
|
+
getById(id: string): ProcessTurnAnnotation | null;
|
|
1267
|
+
findByKey(instanceId: string, annotationKey: string): ProcessTurnAnnotation | null;
|
|
1268
|
+
listByInstance(instanceId: string): ProcessTurnAnnotation[];
|
|
1269
|
+
update(id: string, input: UpdateProcessTurnAnnotationInput): ProcessTurnAnnotation | null;
|
|
1270
|
+
delete(id: string): boolean;
|
|
1271
|
+
};
|
|
1272
|
+
|
|
1273
|
+
interface CreateProcessTurnRecordInput extends UpdateProcessTurnRecordInput {
|
|
1274
|
+
id?: string;
|
|
1275
|
+
instanceId: string;
|
|
1276
|
+
turnId: TurnId;
|
|
1277
|
+
pathType?: ProcessTurnRecordPathType;
|
|
1278
|
+
startedAt?: string;
|
|
1279
|
+
}
|
|
1280
|
+
interface UpdateProcessTurnRecordInput {
|
|
1281
|
+
turnType?: ProcessTurnType;
|
|
1282
|
+
status?: ProcessTurnRecordStatus;
|
|
1283
|
+
attemptNumber?: number;
|
|
1284
|
+
parentTurnRecordId?: string | null;
|
|
1285
|
+
turnStartRecordId?: string | null;
|
|
1286
|
+
acceptedWorkerLeaseId?: string | null;
|
|
1287
|
+
forkPiEntryId?: string | null;
|
|
1288
|
+
resultPiEntryId?: string | null;
|
|
1289
|
+
modelProfileId?: string | null;
|
|
1290
|
+
modelSelectionProvenance?: ModelSelectionProvenance | null;
|
|
1291
|
+
turnResultMarkdown?: string | null;
|
|
1292
|
+
errorSummary?: string | null;
|
|
1293
|
+
errorClass?: WorkerErrorClass | null;
|
|
1294
|
+
endedAt?: string | null;
|
|
1295
|
+
}
|
|
1296
|
+
declare function createProcessTurnRecordRepo(db: LeitwerkDb): {
|
|
1297
|
+
create(input: CreateProcessTurnRecordInput): ProcessTurnRecord;
|
|
1298
|
+
getById(id: string): ProcessTurnRecord | null;
|
|
1299
|
+
listByInstance(instanceId: string): ProcessTurnRecord[];
|
|
1300
|
+
getLatestSucceededPrimaryByInstance(instanceId: string): ProcessTurnRecord | null;
|
|
1301
|
+
update(id: string, input: UpdateProcessTurnRecordInput): ProcessTurnRecord | null;
|
|
1302
|
+
};
|
|
1303
|
+
|
|
1304
|
+
interface SessionTransferGrant {
|
|
1305
|
+
id: string;
|
|
1306
|
+
instanceId: string;
|
|
1307
|
+
tokenHash: string;
|
|
1308
|
+
createdAt: string;
|
|
1309
|
+
expiresAt: string;
|
|
1310
|
+
consumedAt: string | null;
|
|
1311
|
+
tombstoneUntil: string | null;
|
|
1312
|
+
}
|
|
1313
|
+
interface SessionTransferAttempt extends SessionTransferAttemptWire {
|
|
1314
|
+
createdAt: string;
|
|
1315
|
+
completedAt: string | null;
|
|
1316
|
+
}
|
|
1317
|
+
declare function createSessionTransferRepo(db: LeitwerkDb): {
|
|
1318
|
+
createGrant(input: {
|
|
1319
|
+
instanceId: string;
|
|
1320
|
+
now: Date;
|
|
1321
|
+
lifetimeMs: number;
|
|
1322
|
+
}): {
|
|
1323
|
+
grant: SessionTransferGrant;
|
|
1324
|
+
rawToken: string;
|
|
1325
|
+
};
|
|
1326
|
+
getGrant(id: string): SessionTransferGrant | null;
|
|
1327
|
+
getAttempt(id: string): SessionTransferAttempt | null;
|
|
1328
|
+
getActiveByInstance(instanceId: string): SessionTransferAttempt | null;
|
|
1329
|
+
listActive(): SessionTransferAttempt[];
|
|
1330
|
+
startAttempt(input: {
|
|
1331
|
+
instanceId: string;
|
|
1332
|
+
grantId: string;
|
|
1333
|
+
token: string;
|
|
1334
|
+
now: Date;
|
|
1335
|
+
leaseMs: number;
|
|
1336
|
+
hardDeadlineMs: number;
|
|
1337
|
+
}): {
|
|
1338
|
+
kind: "created";
|
|
1339
|
+
attempt: SessionTransferAttempt;
|
|
1340
|
+
} | {
|
|
1341
|
+
kind: "not_found";
|
|
1342
|
+
} | {
|
|
1343
|
+
kind: "busy";
|
|
1344
|
+
};
|
|
1345
|
+
verifyAttempt(input: {
|
|
1346
|
+
instanceId: string;
|
|
1347
|
+
grantId: string;
|
|
1348
|
+
attemptId: string;
|
|
1349
|
+
token: string;
|
|
1350
|
+
}): SessionTransferAttempt | null;
|
|
1351
|
+
updateAttempt(id: string, patch: Partial<Omit<SessionTransferAttempt, "id" | "grantId" | "instanceId" | "createdAt" | "state">>): SessionTransferAttempt | null;
|
|
1352
|
+
renew(id: string, input: {
|
|
1353
|
+
now: Date;
|
|
1354
|
+
leaseMs: number;
|
|
1355
|
+
}): SessionTransferAttempt | null;
|
|
1356
|
+
acknowledge(input: {
|
|
1357
|
+
attemptId: string;
|
|
1358
|
+
now: Date;
|
|
1359
|
+
tombstoneMs: number;
|
|
1360
|
+
}): SessionTransferAttempt | null;
|
|
1361
|
+
revokeProcess(instanceId: string): void;
|
|
1362
|
+
cleanup(now: Date): void;
|
|
1363
|
+
};
|
|
1364
|
+
|
|
1365
|
+
interface ImportedSkill {
|
|
1366
|
+
skillId: string;
|
|
1367
|
+
label: string;
|
|
1368
|
+
description: string | null;
|
|
1369
|
+
bundle: PiResourceBundle;
|
|
1370
|
+
sourceRevision: string | null;
|
|
1371
|
+
}
|
|
1372
|
+
interface ImportedRepositorySkill extends ImportedSkill {
|
|
1373
|
+
sourcePath: string;
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
declare function createSkillRepo(db: LeitwerkDb): {
|
|
1377
|
+
listAvailable(): SkillOptionSummary[];
|
|
1378
|
+
resolveActive(ids: readonly string[]): SkillSelection[];
|
|
1379
|
+
reconcile(imported: readonly ImportedSkill[]): void;
|
|
1380
|
+
backfillDependencies(): void;
|
|
1381
|
+
markUnconfiguredCatalogEntries(configuredRepositoryIds: readonly string[]): void;
|
|
1382
|
+
mergeCatalog(repositoryId: string, imported: readonly ImportedRepositorySkill[]): void;
|
|
1383
|
+
registerCatalogEntry(repositoryId: string, skillId: string): string;
|
|
1384
|
+
remove(skillId: string): boolean;
|
|
1385
|
+
catalog(): {
|
|
1386
|
+
availableSkills: SkillCatalogItem[];
|
|
1387
|
+
installedSkills: InstalledSkillCatalogItem[];
|
|
1388
|
+
};
|
|
1389
|
+
getCatalogDetail(repositoryId: string, skillId: string): SkillCatalogDetail | null;
|
|
1390
|
+
getInstalledDetail(skillId: string): InstalledSkillCatalogDetail | null;
|
|
1391
|
+
recordInvocations(input: {
|
|
1392
|
+
instanceId: string;
|
|
1393
|
+
turnRecordId: string;
|
|
1394
|
+
invocations: readonly {
|
|
1395
|
+
skillId: string;
|
|
1396
|
+
invokedAt: string;
|
|
1397
|
+
}[];
|
|
1398
|
+
}): void;
|
|
1399
|
+
};
|
|
1400
|
+
|
|
1401
|
+
interface TicketDestinationRecent {
|
|
1402
|
+
id: string;
|
|
1403
|
+
actorKey: string;
|
|
1404
|
+
toolName: string;
|
|
1405
|
+
destinationId: string;
|
|
1406
|
+
createdAt: string;
|
|
1407
|
+
updatedAt: string;
|
|
1408
|
+
}
|
|
1409
|
+
declare function createTicketDestinationRecentRepo(db: LeitwerkDb): {
|
|
1410
|
+
list(actorKey: string, toolName: string, limit?: number): TicketDestinationRecent[];
|
|
1411
|
+
record(input: {
|
|
1412
|
+
actorKey: string;
|
|
1413
|
+
toolName: string;
|
|
1414
|
+
destinationId: string;
|
|
1415
|
+
limit?: number;
|
|
1416
|
+
}): TicketDestinationRecent;
|
|
1417
|
+
};
|
|
1418
|
+
|
|
1419
|
+
declare function createTurnStartRecordRepo(db: LeitwerkDb): {
|
|
1420
|
+
create(input: Omit<TurnStartRecord, "id" | "createdAt" | "updatedAt"> & {
|
|
1421
|
+
id?: string;
|
|
1422
|
+
}): TurnStartRecord;
|
|
1423
|
+
getById(id: string): TurnStartRecord | null;
|
|
1424
|
+
listByInstance(instanceId: string): TurnStartRecord[];
|
|
1425
|
+
compareAndSetState(input: {
|
|
1426
|
+
id: string;
|
|
1427
|
+
expectedKind: TurnStartRecordState["kind"];
|
|
1428
|
+
state: TurnStartRecordState;
|
|
1429
|
+
}): TurnStartRecord | null;
|
|
1430
|
+
};
|
|
1431
|
+
|
|
1432
|
+
interface CreateWorkerLeaseInput {
|
|
1433
|
+
instanceId: string;
|
|
1434
|
+
workerId: string;
|
|
1435
|
+
state: WorkerState;
|
|
1436
|
+
serverEpoch?: string | null;
|
|
1437
|
+
connectTokenHash?: string | null;
|
|
1438
|
+
snapshotTokenHash?: string | null;
|
|
1439
|
+
modelPolicyFingerprint?: string | null;
|
|
1440
|
+
bootstrapReceipt?: WorkerBootstrapReceipt | null;
|
|
1441
|
+
turnStartRecordId?: string | null;
|
|
1442
|
+
}
|
|
1443
|
+
interface UpdateWorkerLeaseInput {
|
|
1444
|
+
state?: WorkerState;
|
|
1445
|
+
serverEpoch?: string | null;
|
|
1446
|
+
connectTokenHash?: string | null;
|
|
1447
|
+
snapshotTokenHash?: string | null;
|
|
1448
|
+
modelPolicyFingerprint?: string | null;
|
|
1449
|
+
lastHeartbeatAt?: string | null;
|
|
1450
|
+
connectedAt?: string | null;
|
|
1451
|
+
workspacePreparationStartedAt?: string | null;
|
|
1452
|
+
readyAt?: string | null;
|
|
1453
|
+
exitedAt?: string | null;
|
|
1454
|
+
}
|
|
1455
|
+
declare function createWorkerLeaseRepo(db: LeitwerkDb): {
|
|
1456
|
+
create(input: CreateWorkerLeaseInput): WorkerLease;
|
|
1457
|
+
getByInstance(instanceId: string): WorkerLease | null;
|
|
1458
|
+
getById(id: string): WorkerLease | null;
|
|
1459
|
+
listByInstance(instanceId: string): WorkerLease[];
|
|
1460
|
+
listActive(): WorkerLease[];
|
|
1461
|
+
update(id: string, input: UpdateWorkerLeaseInput): WorkerLease | null;
|
|
1462
|
+
observeTimestamp(id: string, field: "connectedAt" | "workspacePreparationStartedAt" | "readyAt"): WorkerLease | null;
|
|
1463
|
+
updateHeartbeat(workerId: string): boolean;
|
|
1464
|
+
/** Stores the first receipt only. Exact replay is accepted; changed receipts are rejected. */
|
|
1465
|
+
compareAndSetBootstrapReceipt(id: string, receipt: WorkerBootstrapReceipt): "stored" | "replay" | "changed" | "missing";
|
|
1466
|
+
};
|
|
1467
|
+
|
|
1468
|
+
interface RepositoryBundle {
|
|
1469
|
+
startupObservations: ReturnType<typeof createStartupObservationRepo>;
|
|
1470
|
+
turnSummaries: ReturnType<typeof createTurnSummaryRepo>;
|
|
1471
|
+
processes: ReturnType<typeof createProcessInstanceRepo>;
|
|
1472
|
+
projects: ReturnType<typeof createProcessProjectRepo>;
|
|
1473
|
+
questionRequests: ReturnType<typeof createProcessQuestionRequestRepo>;
|
|
1474
|
+
processRelations: ReturnType<typeof createProcessRelationRepo>;
|
|
1475
|
+
toolApprovalRequests: ReturnType<typeof createProcessToolApprovalRequestRepo>;
|
|
1476
|
+
inputs: ReturnType<typeof createProcessInputRepo>;
|
|
1477
|
+
events: ReturnType<typeof createProcessEventRepo>;
|
|
1478
|
+
handoffDedupKeys: ReturnType<typeof createProcessHandoffDedupKeyRepo>;
|
|
1479
|
+
futureExecutions: ReturnType<typeof createFutureExecutionRepo>;
|
|
1480
|
+
launcherRecentValues: ReturnType<typeof createLauncherRecentValueRepo>;
|
|
1481
|
+
ticketDestinationRecents: ReturnType<typeof createTicketDestinationRecentRepo>;
|
|
1482
|
+
launchRuns: ReturnType<typeof createLaunchRunRepo>;
|
|
1483
|
+
titleJobs: ReturnType<typeof createProcessTitleJobRepo>;
|
|
1484
|
+
pendingExternalSourceFires: ReturnType<typeof createPendingExternalSourceFireRepo>;
|
|
1485
|
+
leafOutcomeSnapshots: ReturnType<typeof createProcessLeafOutcomeSnapshotRepo>;
|
|
1486
|
+
turnRecords: ReturnType<typeof createProcessTurnRecordRepo>;
|
|
1487
|
+
turnStarts: ReturnType<typeof createTurnStartRecordRepo>;
|
|
1488
|
+
turnAnnotations: ReturnType<typeof createProcessTurnAnnotationRepo>;
|
|
1489
|
+
leases: ReturnType<typeof createWorkerLeaseRepo>;
|
|
1490
|
+
providerCredentials: ReturnType<typeof createProviderCredentialRepo>;
|
|
1491
|
+
externalWrites: ReturnType<typeof createExternalWriteLogRepo>;
|
|
1492
|
+
sessionTransfers: ReturnType<typeof createSessionTransferRepo>;
|
|
1493
|
+
skills: ReturnType<typeof createSkillRepo>;
|
|
1494
|
+
processSkills: ReturnType<typeof createProcessSkillRepo>;
|
|
1495
|
+
apiTokens: ReturnType<typeof createApiTokenRepo>;
|
|
1496
|
+
authSessions: ReturnType<typeof createAuthSessionRepo>;
|
|
1497
|
+
authLoginFlows: ReturnType<typeof createAuthLoginFlowRepo>;
|
|
1498
|
+
transaction<T>(fn: (repos: RepositoryBundle) => T): T;
|
|
1499
|
+
}
|
|
1500
|
+
declare function createAllRepos(db: LeitwerkDb, options?: {
|
|
1501
|
+
credentialCipher?: CredentialCipher;
|
|
1502
|
+
}): RepositoryBundle;
|
|
1503
|
+
|
|
1504
|
+
interface ProcessContextData {
|
|
1505
|
+
params: unknown;
|
|
1506
|
+
state: unknown;
|
|
1507
|
+
}
|
|
1508
|
+
interface ResolvedUiHumanTurnAction {
|
|
1509
|
+
kind: "ui_human_action";
|
|
1510
|
+
turnId: string;
|
|
1511
|
+
turnType: "human";
|
|
1512
|
+
semanticEntryRefKey: ProcessSemanticEntryRefKey | null;
|
|
1513
|
+
acceptanceState: TurnAcceptanceState;
|
|
1514
|
+
}
|
|
1515
|
+
interface ResolvedExternalHumanTriggerAction {
|
|
1516
|
+
kind: "external_human_trigger";
|
|
1517
|
+
turnId: string;
|
|
1518
|
+
turnType: "external";
|
|
1519
|
+
semanticEntryRefKey: ProcessSemanticEntryRefKey | null;
|
|
1520
|
+
acceptanceState: TurnAcceptanceState;
|
|
1521
|
+
externalTrigger: {
|
|
1522
|
+
id: string;
|
|
1523
|
+
actionId: string;
|
|
1524
|
+
label: string;
|
|
1525
|
+
description: string;
|
|
1526
|
+
};
|
|
1527
|
+
}
|
|
1528
|
+
type ResolvedTurnScopedAction = ResolvedUiHumanTurnAction | ResolvedExternalHumanTriggerAction;
|
|
1529
|
+
interface ResolvedAction<Definition> {
|
|
1530
|
+
definition: Definition;
|
|
1531
|
+
candidateSelectedTurnId: string | null;
|
|
1532
|
+
lifecycleStatus: ProcessTurnTerminalLifecycleStatus | null;
|
|
1533
|
+
}
|
|
1534
|
+
type ResolvedActionPreview = ResolvedAction<ProcessActionPreviewDefinition>;
|
|
1535
|
+
type ResolvedActionScheduling = ResolvedAction<ProcessActionSchedulingDefinition>;
|
|
1536
|
+
interface VisibleProcessActionSummary {
|
|
1537
|
+
id: string;
|
|
1538
|
+
label: string;
|
|
1539
|
+
description: string | null;
|
|
1540
|
+
form?: ProcessActionDefinition["form"];
|
|
1541
|
+
preview: ResolvedActionPreview | null;
|
|
1542
|
+
}
|
|
1543
|
+
interface ProcessActionRegistry {
|
|
1544
|
+
getAction(processId: string, actionId: string): ProcessActionDefinition | undefined;
|
|
1545
|
+
isTurnScopedAction(processId: string, actionId: string): boolean;
|
|
1546
|
+
listVisibleActions(processId: string, ctx: ServerProcessContext): VisibleProcessActionSummary[];
|
|
1547
|
+
getSelectedTurnSummary(processId: string, process: ProcessInstance, projects?: readonly ProcessProject[]): ProcessSelectedTurnSummary | null;
|
|
1548
|
+
getServerDefinition(processId: string): BuiltServerProcessDefinition | undefined;
|
|
1549
|
+
getTurnDefinition(processId: string, turnId: string): TurnDefinition<unknown, unknown> | undefined;
|
|
1550
|
+
getProcessGraph(processId: string): ExtensionProcessDefinition | undefined;
|
|
1551
|
+
getProcessDisplayName(processId: string): string | undefined;
|
|
1552
|
+
resolveContextData(processId: string, process: Pick<ProcessInstance, "paramsJson" | "stateJson">): ProcessContextData;
|
|
1553
|
+
resolveTurnScopedAction(processId: string, process: Pick<ProcessInstance, "selectedTurnId" | "paramsJson" | "stateJson">, actionId: string, source: ProcessActionExecutionSource): ResolvedTurnScopedAction | null;
|
|
1554
|
+
resolveActionPreview(processId: string, process: Pick<ProcessInstance, "selectedTurnId" | "paramsJson" | "stateJson">, actionId: string): ResolvedActionPreview | null;
|
|
1555
|
+
resolveActionScheduling(processId: string, process: Pick<ProcessInstance, "selectedTurnId" | "paramsJson" | "stateJson">, actionId: string): ResolvedActionScheduling | null;
|
|
1556
|
+
}
|
|
1557
|
+
declare function buildProcessActionRegistry(catalog: Pick<ExtensionCatalog, "processes">): ProcessActionRegistry;
|
|
1558
|
+
|
|
1559
|
+
type ProcessModelAvailabilitySnapshot = ModelStatusCacheSnapshot;
|
|
1560
|
+
type PersistedModelConfigurationIssue = {
|
|
1561
|
+
readonly code: "invalid_turn_configs_json";
|
|
1562
|
+
readonly reason: "invalid_json" | "not_object" | "turn_config_not_object";
|
|
1563
|
+
readonly turnId?: string;
|
|
1564
|
+
};
|
|
1565
|
+
type PersistedModelRelationalIssue = {
|
|
1566
|
+
readonly code: "model_config_requires_llm_turn";
|
|
1567
|
+
readonly turnId: string;
|
|
1568
|
+
} | {
|
|
1569
|
+
readonly code: "selected_model_requires_selected_turn";
|
|
1570
|
+
readonly modelProfileId: string;
|
|
1571
|
+
} | {
|
|
1572
|
+
readonly code: "selected_model_requires_llm_turn";
|
|
1573
|
+
readonly turnId: string;
|
|
1574
|
+
readonly modelProfileId: string;
|
|
1575
|
+
};
|
|
1576
|
+
type PersistedModelSelectionIssue = {
|
|
1577
|
+
readonly code: "contradictory_provenance";
|
|
1578
|
+
readonly turnId: string;
|
|
1579
|
+
readonly modelProfileId: string;
|
|
1580
|
+
readonly kind: ModelSelectionKind;
|
|
1581
|
+
readonly source: ProcessSelectedTurnModelSource;
|
|
1582
|
+
};
|
|
1583
|
+
type PersistedModelIntegrityIssue = PersistedModelConfigurationIssue | PersistedModelRelationalIssue | PersistedModelSelectionIssue;
|
|
1584
|
+
type PersistedModelIntegrity = {
|
|
1585
|
+
readonly kind: "valid";
|
|
1586
|
+
} | {
|
|
1587
|
+
readonly kind: "malformed";
|
|
1588
|
+
readonly issues: readonly PersistedModelIntegrityIssue[];
|
|
1589
|
+
};
|
|
1590
|
+
type ProcessModelPolicyFailureBase = {
|
|
1591
|
+
readonly ok: false;
|
|
1592
|
+
readonly selection: DurableModelSelection | null;
|
|
1593
|
+
readonly availabilityRevision?: number;
|
|
1594
|
+
};
|
|
1595
|
+
type ProcessModelPolicyFailure = ProcessModelPolicyFailureBase & ({
|
|
1596
|
+
readonly code: "model_required";
|
|
1597
|
+
} | {
|
|
1598
|
+
readonly code: "unknown_model_profile";
|
|
1599
|
+
readonly modelProfileId: string;
|
|
1600
|
+
} | {
|
|
1601
|
+
readonly code: "model_profile_not_allowed";
|
|
1602
|
+
readonly modelProfileId: string;
|
|
1603
|
+
readonly processId: string;
|
|
1604
|
+
} | {
|
|
1605
|
+
readonly code: "model_unavailable" | "model_stale";
|
|
1606
|
+
readonly reason: string | null;
|
|
1607
|
+
} | {
|
|
1608
|
+
readonly code: "invalid_model_configuration";
|
|
1609
|
+
readonly source: "configuration" | "selection_provenance";
|
|
1610
|
+
readonly issues: readonly (PersistedModelConfigurationIssue | PersistedModelSelectionIssue)[];
|
|
1611
|
+
} | {
|
|
1612
|
+
readonly code: "stale_evaluation_snapshot";
|
|
1613
|
+
});
|
|
1614
|
+
interface ProcessModelPolicyResolution {
|
|
1615
|
+
readonly ok: true;
|
|
1616
|
+
readonly selection: DurableModelSelection | null;
|
|
1617
|
+
readonly availabilityRevision?: number;
|
|
1618
|
+
}
|
|
1619
|
+
type ProcessModelPolicyEvaluation = ProcessModelPolicyResolution | ProcessModelPolicyFailure;
|
|
1620
|
+
interface ProjectedModelProfile {
|
|
1621
|
+
readonly id: string;
|
|
1622
|
+
readonly providerId: string;
|
|
1623
|
+
readonly modelId: string;
|
|
1624
|
+
readonly thinkingLevel: string;
|
|
1625
|
+
readonly availability: "available" | "unavailable" | "stale";
|
|
1626
|
+
readonly safeReason: string | null;
|
|
1627
|
+
readonly checkedAt: string | null;
|
|
1628
|
+
}
|
|
1629
|
+
interface ProjectedModelDefault {
|
|
1630
|
+
readonly processConfigModelProfileId: string | null;
|
|
1631
|
+
readonly instanceModelProfileId: string | null;
|
|
1632
|
+
readonly effectiveModelProfileId: string | null;
|
|
1633
|
+
readonly source: "instance" | "process_config" | "catalog_default" | "none";
|
|
1634
|
+
}
|
|
1635
|
+
type ProjectedModelResolutionSource = ProcessSelectedTurnModelSource | "none";
|
|
1636
|
+
interface ProjectedLauncherModelSchema {
|
|
1637
|
+
readonly profiles: readonly ProjectedModelProfile[];
|
|
1638
|
+
readonly turns: readonly {
|
|
1639
|
+
readonly turnId: string;
|
|
1640
|
+
readonly description: string;
|
|
1641
|
+
}[];
|
|
1642
|
+
}
|
|
1643
|
+
interface ProjectedLauncherModelPreview {
|
|
1644
|
+
readonly defaultModel: {
|
|
1645
|
+
readonly source: ProjectedModelDefault["source"];
|
|
1646
|
+
readonly profile: ProjectedModelProfile | null;
|
|
1647
|
+
};
|
|
1648
|
+
readonly turns: readonly {
|
|
1649
|
+
readonly turnId: string;
|
|
1650
|
+
readonly description: string;
|
|
1651
|
+
readonly effective: {
|
|
1652
|
+
readonly source: ProjectedModelResolutionSource;
|
|
1653
|
+
readonly profile: ProjectedModelProfile | null;
|
|
1654
|
+
};
|
|
1655
|
+
}[];
|
|
1656
|
+
}
|
|
1657
|
+
type ProjectedProcessModelConfiguration = {
|
|
1658
|
+
readonly state: {
|
|
1659
|
+
readonly kind: "ready";
|
|
1660
|
+
} | {
|
|
1661
|
+
readonly kind: "blocked";
|
|
1662
|
+
readonly issues: readonly PersistedModelConfigurationIssue[];
|
|
1663
|
+
};
|
|
1664
|
+
readonly profiles: readonly ProjectedModelProfile[];
|
|
1665
|
+
readonly effectiveSelectedTurn: {
|
|
1666
|
+
readonly turnId: string;
|
|
1667
|
+
readonly description: string;
|
|
1668
|
+
readonly modelProfileId: string;
|
|
1669
|
+
readonly source: ProcessSelectedTurnModelSource;
|
|
1670
|
+
} | null;
|
|
1671
|
+
readonly defaultModel: ProjectedModelDefault;
|
|
1672
|
+
readonly turns: readonly {
|
|
1673
|
+
readonly turnId: string;
|
|
1674
|
+
readonly description: string;
|
|
1675
|
+
readonly pathType: string;
|
|
1676
|
+
readonly processConfigModelProfileId: string | null;
|
|
1677
|
+
readonly instanceModelProfileId: string | null;
|
|
1678
|
+
readonly effectiveConfiguredModelProfileId: string | null;
|
|
1679
|
+
readonly source: "instance" | "process_config" | "default";
|
|
1680
|
+
}[];
|
|
1681
|
+
};
|
|
1682
|
+
interface ProcessModelPolicyProjectionByKind {
|
|
1683
|
+
readonly profile_options: readonly ProjectedModelProfile[];
|
|
1684
|
+
readonly compatible_profiles: readonly string[];
|
|
1685
|
+
readonly launcher_schema: ProjectedLauncherModelSchema;
|
|
1686
|
+
readonly launcher_preview: ProjectedLauncherModelPreview;
|
|
1687
|
+
readonly process_configuration: ProjectedProcessModelConfiguration;
|
|
1688
|
+
}
|
|
1689
|
+
type ProcessModelPolicyEvaluationSubject = {
|
|
1690
|
+
readonly kind: "process_turn";
|
|
1691
|
+
readonly process: ProcessInstance;
|
|
1692
|
+
readonly turnId: string;
|
|
1693
|
+
readonly availability?: ProcessModelAvailabilitySnapshot;
|
|
1694
|
+
readonly startKind?: TurnStartKind;
|
|
1695
|
+
/** True only when selecting the first turn of a persisted process. */
|
|
1696
|
+
readonly initialSelection?: boolean;
|
|
1697
|
+
readonly modelOverride?: string | null;
|
|
1698
|
+
} | {
|
|
1699
|
+
readonly kind: "launch_plan_turn";
|
|
1700
|
+
readonly plan: ProcessLaunchPlan;
|
|
1701
|
+
readonly turnId: string;
|
|
1702
|
+
readonly availability: ProcessModelAvailabilitySnapshot;
|
|
1703
|
+
} | {
|
|
1704
|
+
readonly kind: "runtime_selection";
|
|
1705
|
+
readonly processId: string;
|
|
1706
|
+
readonly selection: DurableModelSelection | null;
|
|
1707
|
+
readonly availability: ProcessModelAvailabilitySnapshot;
|
|
1708
|
+
} | {
|
|
1709
|
+
readonly kind: "preparation_recovery";
|
|
1710
|
+
readonly cause: "availability_transition" | "startup_reconciliation";
|
|
1711
|
+
readonly process: ProcessInstance;
|
|
1712
|
+
readonly currentStart: TurnStartRecord;
|
|
1713
|
+
readonly availability: ProcessModelAvailabilitySnapshot;
|
|
1714
|
+
};
|
|
1715
|
+
type ProcessModelPolicyProjectionSubject = {
|
|
1716
|
+
readonly kind: "profile_options";
|
|
1717
|
+
readonly processId: string;
|
|
1718
|
+
readonly availability: ProcessModelAvailabilitySnapshot;
|
|
1719
|
+
} | {
|
|
1720
|
+
readonly kind: "compatible_profiles";
|
|
1721
|
+
readonly processId: string;
|
|
1722
|
+
readonly providerId: string;
|
|
1723
|
+
readonly modelId: string;
|
|
1724
|
+
readonly availability: ProcessModelAvailabilitySnapshot;
|
|
1725
|
+
} | {
|
|
1726
|
+
readonly kind: "launcher_schema";
|
|
1727
|
+
readonly processId: string;
|
|
1728
|
+
readonly availability?: ProcessModelAvailabilitySnapshot;
|
|
1729
|
+
} | {
|
|
1730
|
+
readonly kind: "launcher_preview";
|
|
1731
|
+
readonly processId: string;
|
|
1732
|
+
readonly modelConfig: LaunchModelConfigInput;
|
|
1733
|
+
readonly availability: ProcessModelAvailabilitySnapshot;
|
|
1734
|
+
} | {
|
|
1735
|
+
readonly kind: "process_configuration";
|
|
1736
|
+
readonly process: ProcessInstance;
|
|
1737
|
+
readonly availability: ProcessModelAvailabilitySnapshot;
|
|
1738
|
+
};
|
|
1739
|
+
type ProcessModelPolicyProjectionKind = ProcessModelPolicyProjectionSubject["kind"];
|
|
1740
|
+
type ProcessModelPolicyProjectionSubjectFor<K extends ProcessModelPolicyProjectionKind> = Extract<ProcessModelPolicyProjectionSubject, {
|
|
1741
|
+
readonly kind: K;
|
|
1742
|
+
}>;
|
|
1743
|
+
interface ProcessModelPolicyFingerprintSubject {
|
|
1744
|
+
readonly process: ProcessInstance;
|
|
1745
|
+
readonly currentStart: TurnStartRecord;
|
|
1746
|
+
}
|
|
1747
|
+
interface PrepareLaunchPlanOptions {
|
|
1748
|
+
readonly modelConfig?: LaunchModelConfigInput;
|
|
1749
|
+
readonly replaceModelConfig?: boolean;
|
|
1750
|
+
readonly invalidModelConfig?: "reject" | "omit";
|
|
1751
|
+
}
|
|
1752
|
+
interface ServerProcessModelPolicy {
|
|
1753
|
+
prepareLaunchPlan(launchPlan: ProcessLaunchPlan, opts?: PrepareLaunchPlanOptions): LaunchPlanPreparationResultLike;
|
|
1754
|
+
inspectPersistedState(process: ProcessInstance): PersistedModelIntegrity;
|
|
1755
|
+
evaluate(request: ProcessModelPolicyEvaluationSubject): ProcessModelPolicyEvaluation;
|
|
1756
|
+
project<K extends ProcessModelPolicyProjectionKind>(request: ProcessModelPolicyProjectionSubjectFor<K>): ProcessModelPolicyProjectionByKind[K];
|
|
1757
|
+
fingerprint(request: ProcessModelPolicyFingerprintSubject): string;
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
interface WsClientLike {
|
|
1761
|
+
readyState: number;
|
|
1762
|
+
send(data: string): void;
|
|
1763
|
+
on(event: string, handler: () => void): void;
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
declare function createBroadcaster(): {
|
|
1767
|
+
addClient: (ws: WsClientLike) => void;
|
|
1768
|
+
broadcast: (frame: WsFrame) => void;
|
|
1769
|
+
sendDurable: <T extends KnownDurableWsFrameType>(type: T, payload: WsPayloadByType[T], instanceId?: string) => void;
|
|
1770
|
+
sendEphemeral: <T extends KnownEphemeralWsFrameType>(type: T, payload: WsPayloadByType[T], instanceId?: string) => void;
|
|
1771
|
+
};
|
|
1772
|
+
type Broadcaster = ReturnType<typeof createBroadcaster>;
|
|
1773
|
+
|
|
1774
|
+
interface ProcessOperationCoordinator {
|
|
1775
|
+
runExclusive<T>(instanceId: string, operation: () => Promise<T> | T): Promise<T>;
|
|
1776
|
+
}
|
|
1777
|
+
declare function createProcessOperationCoordinator(): ProcessOperationCoordinator;
|
|
1778
|
+
|
|
1779
|
+
type ProcessQuestionRepos = Pick<RepositoryBundle, "events" | "leases" | "processes" | "questionRequests" | "transaction" | "turnRecords">;
|
|
1780
|
+
declare function createProcessQuestionService(input: {
|
|
1781
|
+
repos: ProcessQuestionRepos;
|
|
1782
|
+
processOperations: ProcessOperationCoordinator;
|
|
1783
|
+
broadcaster: Broadcaster;
|
|
1784
|
+
getWorkerId: (instanceId: string) => string | null;
|
|
1785
|
+
sendQuestionResponse: (instanceId: string, workerId: string, payload: WorkerQuestionResponsePayload) => void;
|
|
1786
|
+
emitQuestionRequested?: (request: ProcessQuestionRequest) => void | Promise<void>;
|
|
1787
|
+
}): {
|
|
1788
|
+
listOpen: (instanceId?: string) => ProcessQuestionRequest[];
|
|
1789
|
+
handleWorkerRequest(instanceId: string, workerLeaseId: string, workerId: string, payload: WorkerQuestionRequestedPayload): Promise<void>;
|
|
1790
|
+
submitAnswers(instanceId: string, requestId: string, draftInput: readonly QuestionAnswerDraft[], actor: Actor): Promise<{
|
|
1791
|
+
ok: false;
|
|
1792
|
+
code: "not_found";
|
|
1793
|
+
message: string;
|
|
1794
|
+
request?: undefined;
|
|
1795
|
+
} | {
|
|
1796
|
+
ok: false;
|
|
1797
|
+
code: "not_current";
|
|
1798
|
+
message: string;
|
|
1799
|
+
request: ProcessQuestionRequest;
|
|
1800
|
+
} | {
|
|
1801
|
+
ok: true;
|
|
1802
|
+
request: ProcessQuestionRequest;
|
|
1803
|
+
code?: undefined;
|
|
1804
|
+
message?: undefined;
|
|
1805
|
+
} | {
|
|
1806
|
+
ok: false;
|
|
1807
|
+
code: "invalid";
|
|
1808
|
+
message: string;
|
|
1809
|
+
}>;
|
|
1810
|
+
};
|
|
1811
|
+
type ProcessQuestionService = ReturnType<typeof createProcessQuestionService>;
|
|
1812
|
+
|
|
1813
|
+
interface WorkerEventLogEntry {
|
|
1814
|
+
instanceId: string;
|
|
1815
|
+
workerId: string;
|
|
1816
|
+
eventType: string;
|
|
1817
|
+
selectedTurnId: string | null;
|
|
1818
|
+
timestamp: string;
|
|
1819
|
+
serverObservedAt: string;
|
|
1820
|
+
serverObservedLatencyMs: number | null;
|
|
1821
|
+
turnRecordId: string | null;
|
|
1822
|
+
data: Record<string, unknown>;
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
interface WorkerTurnIpcRecorderCallbacks {
|
|
1826
|
+
onTurnOutcomeRecorded?: (instanceId: string, turnId: string, outcome: string, params: Record<string, unknown>) => void;
|
|
1827
|
+
onTurnTerminalRecorded?: (instanceId: string, workerId: string, turnRecordId: string) => void;
|
|
1828
|
+
onTurnFailedRecorded?: (input: {
|
|
1829
|
+
instanceId: string;
|
|
1830
|
+
workerId: string;
|
|
1831
|
+
turnRecordId: string;
|
|
1832
|
+
turnId: string;
|
|
1833
|
+
turnType: WorkerTurnFailedPayload["turnType"];
|
|
1834
|
+
errorSummary: string;
|
|
1835
|
+
errorClass?: WorkerTurnFailedPayload["errorClass"];
|
|
1836
|
+
failureCode?: WorkerTurnFailedPayload["failureCode"];
|
|
1837
|
+
}) => void;
|
|
1838
|
+
onTurnTerminalRecordingFailed?: (input: {
|
|
1839
|
+
instanceId: string;
|
|
1840
|
+
workerId: string;
|
|
1841
|
+
turnRecordId: string;
|
|
1842
|
+
terminalType: "outcome" | "failure";
|
|
1843
|
+
code: string;
|
|
1844
|
+
message: string;
|
|
1845
|
+
}) => void;
|
|
1846
|
+
}
|
|
1847
|
+
|
|
1848
|
+
interface IpcHandlerDeps extends Pick<RepositoryBundle, "processes" | "projects" | "inputs" | "events" | "leases" | "turnRecords"> {
|
|
1849
|
+
startupObservations?: RepositoryBundle["startupObservations"];
|
|
1850
|
+
getLaunchCoordinator?: () => LaunchCoordinator | undefined;
|
|
1851
|
+
processQuestions?: ProcessQuestionService;
|
|
1852
|
+
broadcaster: Broadcaster;
|
|
1853
|
+
commands: ProcessEngine;
|
|
1854
|
+
workerEventLogger?: (entry: WorkerEventLogEntry) => void;
|
|
1855
|
+
appendDiagnosticTrace?: (instanceId: string, text: string) => void;
|
|
1856
|
+
updateCredential?: (input: {
|
|
1857
|
+
providerId: string;
|
|
1858
|
+
expectedRevision: number;
|
|
1859
|
+
values: Record<string, string>;
|
|
1860
|
+
}) => {
|
|
1861
|
+
accepted: boolean;
|
|
1862
|
+
currentRevision: number | null;
|
|
1863
|
+
safeReason?: string;
|
|
1864
|
+
};
|
|
1865
|
+
handleIntegrationToolRequest?: (instanceId: string, payload: WorkerIntegrationToolRequestPayload) => Promise<WorkerIntegrationToolResultPayload>;
|
|
1866
|
+
handleIntegrationToolCancel?: (instanceId: string, payload: WorkerIntegrationToolCancelPayload) => void;
|
|
1867
|
+
}
|
|
1868
|
+
interface IpcHandlerCallbacks extends WorkerTurnIpcRecorderCallbacks {
|
|
1869
|
+
onWorkerReady?: (instanceId: string, workerId: string) => void;
|
|
1870
|
+
onWorkerFailed?: (instanceId: string, workerId: string, error: string) => void;
|
|
1871
|
+
onWorkerExited?: (instanceId: string, workerId: string) => void;
|
|
1872
|
+
onCleanupCompleted?: (instanceId: string, workerId: string) => void;
|
|
1873
|
+
onWorkerTurnStartAccepted?: (instanceId: string, workerId: string, payload: WorkerTurnStartAcceptedPayload) => void;
|
|
1874
|
+
onCredentialUpdateResult?: (instanceId: string, workerId: string, payload: WorkerCredentialUpdateResultPayload) => void;
|
|
1875
|
+
onIntegrationToolResult?: (instanceId: string, workerId: string, payload: WorkerIntegrationToolResultPayload) => void;
|
|
1876
|
+
}
|
|
1877
|
+
declare function createIpcHandler(deps: IpcHandlerDeps, callbacks: IpcHandlerCallbacks): {
|
|
1878
|
+
handleMessage(envelope: IpcEnvelope): void;
|
|
1879
|
+
};
|
|
1880
|
+
type IpcHandler = ReturnType<typeof createIpcHandler>;
|
|
1881
|
+
|
|
1882
|
+
interface WorkerTreePaths {
|
|
1883
|
+
primaryTreeFile: string;
|
|
1884
|
+
workspaceRoot: string;
|
|
1885
|
+
piResourceBundlesDir: string;
|
|
1886
|
+
resume: boolean;
|
|
1887
|
+
}
|
|
1888
|
+
type WorkerStorageLayout = (instanceId: string) => WorkerTreePaths;
|
|
1889
|
+
declare function createLocalWorkerStorageLayout(input: {
|
|
1890
|
+
processWorkspacesDir: string;
|
|
1891
|
+
treeFilesDir: string;
|
|
1892
|
+
}): WorkerStorageLayout;
|
|
1893
|
+
declare function createProcessVolumeWorkerStorageLayout(input: {
|
|
1894
|
+
mountPath: string;
|
|
1895
|
+
}): WorkerStorageLayout;
|
|
1896
|
+
declare function createWorkerStorageLayout(config: LeitwerkConfig): WorkerStorageLayout;
|
|
1897
|
+
|
|
1898
|
+
interface WorkerStartPayloadBuilderDeps extends Pick<RepositoryBundle, "processes" | "projects" | "inputs" | "turnRecords" | "turnStarts" | "leases" | "events"> {
|
|
1899
|
+
config: LeitwerkConfig;
|
|
1900
|
+
processGraphs: ProcessGraphRegistry;
|
|
1901
|
+
processActionRegistry: Pick<ProcessActionRegistry, "getTurnDefinition" | "resolveContextData">;
|
|
1902
|
+
storageLayout?: WorkerStorageLayout;
|
|
1903
|
+
/**
|
|
1904
|
+
* The sole server-side resource-bundle seam. The resulting canonical bytes are
|
|
1905
|
+
* delivered only in the authenticated `worker.start` message, irrespective of
|
|
1906
|
+
* whether the physical worker is local, Docker, or Kubernetes.
|
|
1907
|
+
*/
|
|
1908
|
+
resolveResourceBundle?(digest: string): PiResourceBundle | null;
|
|
1909
|
+
resolveRepositoryCredentials?(input: {
|
|
1910
|
+
process: ProcessInstance;
|
|
1911
|
+
projects: ReturnType<RepositoryBundle["projects"]["listByInstance"]>;
|
|
1912
|
+
}): _leitwerk_dev_worker_protocol.WorkerRepositoryCredential[];
|
|
1913
|
+
resolveCredential?(providerId: string, options: Readonly<Record<string, string>>): Pick<ResolvedProviderCredential, "revision" | "values"> | null;
|
|
1914
|
+
integrationTools?: {
|
|
1915
|
+
declarations(names: readonly string[], context?: {
|
|
1916
|
+
paramsJson: string | null;
|
|
1917
|
+
}): _leitwerk_dev_worker_protocol.IntegrationToolDeclaration[];
|
|
1918
|
+
};
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
interface WorkerUnitCleanupLogger {
|
|
1922
|
+
info?(bindings: Record<string, unknown>, message: string): void;
|
|
1923
|
+
warn?(bindings: Record<string, unknown>, message: string): void;
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1926
|
+
interface WorkerWebSocketLike {
|
|
1927
|
+
readyState: number;
|
|
1928
|
+
send(data: string): void;
|
|
1929
|
+
close(code?: number, reason?: string): void;
|
|
1930
|
+
on(event: "message", handler: (raw: Buffer | string | ArrayBuffer | Buffer[]) => void): void;
|
|
1931
|
+
on(event: "close", handler: (event?: {
|
|
1932
|
+
code?: number;
|
|
1933
|
+
reason?: string;
|
|
1934
|
+
}) => void): void;
|
|
1935
|
+
on(event: "error", handler: (error: unknown) => void): void;
|
|
1936
|
+
}
|
|
1937
|
+
interface WorkerWebSocketCallbacks {
|
|
1938
|
+
onEnvelope(envelope: IpcEnvelope): void;
|
|
1939
|
+
onInvalidOutput(): void;
|
|
1940
|
+
onRuntimeError(error: unknown): void;
|
|
1941
|
+
}
|
|
1942
|
+
declare function createWorkerWebSocketIpcManager(options?: {
|
|
1943
|
+
authTimeoutMs?: number;
|
|
1944
|
+
maxBufferedMessages?: number;
|
|
1945
|
+
}): {
|
|
1946
|
+
setUnknownWorkerConnectionsRetryable(enabled: boolean): void;
|
|
1947
|
+
verifyWorkerToken({ instanceId, workerId, token, }: {
|
|
1948
|
+
instanceId: string;
|
|
1949
|
+
workerId: string;
|
|
1950
|
+
token: string;
|
|
1951
|
+
}): boolean;
|
|
1952
|
+
registerWorker({ instanceId, workerId, callbacks, tokenHash, }: {
|
|
1953
|
+
instanceId: string;
|
|
1954
|
+
workerId: string;
|
|
1955
|
+
callbacks: WorkerWebSocketCallbacks;
|
|
1956
|
+
tokenHash: string;
|
|
1957
|
+
}): void;
|
|
1958
|
+
bindSocket({ instanceId, workerId, socket, }: {
|
|
1959
|
+
instanceId: string;
|
|
1960
|
+
workerId: string;
|
|
1961
|
+
socket: WorkerWebSocketLike;
|
|
1962
|
+
}): {
|
|
1963
|
+
ok: true;
|
|
1964
|
+
} | {
|
|
1965
|
+
ok: false;
|
|
1966
|
+
error: string;
|
|
1967
|
+
code: number;
|
|
1968
|
+
};
|
|
1969
|
+
send(instanceId: string, workerId: string, message: ServerToWorkerMessage): void;
|
|
1970
|
+
unregister(instanceId: string, workerId: string, reason: string): void;
|
|
1971
|
+
};
|
|
1972
|
+
type WorkerWebSocketIpcManager = ReturnType<typeof createWorkerWebSocketIpcManager>;
|
|
1973
|
+
|
|
1974
|
+
interface SupervisorDeps extends Pick<RepositoryBundle, "leases" | "processes" | "projects" | "inputs" | "turnRecords" | "turnStarts" | "events"> {
|
|
1975
|
+
startupObservations?: RepositoryBundle["startupObservations"];
|
|
1976
|
+
config: LeitwerkConfig;
|
|
1977
|
+
getLaunchCoordinator?: () => LaunchCoordinator | undefined;
|
|
1978
|
+
processGraphs: ProcessGraphRegistry;
|
|
1979
|
+
processActionRegistry: ProcessActionRegistry;
|
|
1980
|
+
processModelPolicy: ServerProcessModelPolicy;
|
|
1981
|
+
ipcHandler: ReturnType<typeof createIpcHandler>;
|
|
1982
|
+
broadcaster: Broadcaster;
|
|
1983
|
+
runnerRuntime: {
|
|
1984
|
+
runner: WorkerRunner;
|
|
1985
|
+
volume?: ProcessVolume;
|
|
1986
|
+
webSocketIpc: WorkerWebSocketIpcManager;
|
|
1987
|
+
};
|
|
1988
|
+
resolvedExtensionEntriesJson?: string;
|
|
1989
|
+
serverEpoch?: string;
|
|
1990
|
+
logger?: WorkerUnitCleanupLogger;
|
|
1991
|
+
resolveResourceBundle?: (digest: string) => PiResourceBundle | null;
|
|
1992
|
+
resolveRepositoryCredentials?: WorkerStartPayloadBuilderDeps["resolveRepositoryCredentials"];
|
|
1993
|
+
integrationTools?: WorkerStartPayloadBuilderDeps["integrationTools"];
|
|
1994
|
+
resolveCredential?: WorkerStartPayloadBuilderDeps["resolveCredential"];
|
|
1995
|
+
}
|
|
1996
|
+
interface WorkerHandle {
|
|
1997
|
+
workerId: string;
|
|
1998
|
+
instanceId: string;
|
|
1999
|
+
/** Runtime-specific handle id when known; used to distinguish duplicate units during adoption scans. */
|
|
2000
|
+
unitId?: string;
|
|
2001
|
+
namespace?: string;
|
|
2002
|
+
send(message: ServerToWorkerMessage): void;
|
|
2003
|
+
kill(signal?: NodeJS.Signals | number): void;
|
|
2004
|
+
/** Stops the physical runtime and rejects if disappearance cannot be confirmed. */
|
|
2005
|
+
killAndWait?(signal?: NodeJS.Signals | number): Promise<void>;
|
|
2006
|
+
detach(reason: string): void;
|
|
2007
|
+
onceExit(listener: () => void): void;
|
|
2008
|
+
}
|
|
2009
|
+
interface WorkerSupervisor {
|
|
2010
|
+
/** Returns undefined when accepted into the capacity queue. */
|
|
2011
|
+
spawnWorker(instanceId: string): Promise<WorkerHandle | undefined>;
|
|
2012
|
+
stopWorker(instanceId: string, reason: string): Promise<void>;
|
|
2013
|
+
abortTurn(instanceId: string, reason: string): void;
|
|
2014
|
+
deliverInputs(instanceId: string, inputs: InputDelivery[]): void;
|
|
2015
|
+
acceptTurnStart(instanceId: string, workerId: string, startRecordId: string, turnRecordId: string): void;
|
|
2016
|
+
reconcileAcceptedTurnStart(instanceId: string, workerId: string): boolean;
|
|
2017
|
+
acknowledgeTurnTerminal(instanceId: string, workerId: string, payload: WorkerTurnTerminalRecordedPayload): void;
|
|
2018
|
+
questionResponse(instanceId: string, workerId: string, payload: WorkerQuestionResponsePayload): void;
|
|
2019
|
+
credentialUpdateResult(instanceId: string, workerId: string, payload: WorkerCredentialUpdateResultPayload): void;
|
|
2020
|
+
integrationToolResult(instanceId: string, workerId: string, payload: WorkerIntegrationToolResultPayload): void;
|
|
2021
|
+
getWorker(instanceId: string): WorkerHandle | undefined;
|
|
2022
|
+
isAdoptionPending(instanceId: string): boolean;
|
|
2023
|
+
adoptRegisteredWorkers(): Promise<void>;
|
|
2024
|
+
detachAll(reason: string): Promise<void>;
|
|
2025
|
+
shutdownAll(reason: string): Promise<void>;
|
|
2026
|
+
}
|
|
2027
|
+
declare function createWorkerSupervisor(deps: SupervisorDeps): WorkerSupervisor;
|
|
2028
|
+
|
|
2029
|
+
interface QueuedProcessInput extends QueuedProcessInputLike {
|
|
2030
|
+
}
|
|
2031
|
+
|
|
2032
|
+
interface PiSessionTreeNode {
|
|
2033
|
+
entry: SessionEntry;
|
|
2034
|
+
children: PiSessionTreeNode[];
|
|
2035
|
+
label?: string;
|
|
2036
|
+
}
|
|
2037
|
+
interface ReadonlyPiSessionTree {
|
|
2038
|
+
/** Identifier of the parsed source (instance id or file path). */
|
|
2039
|
+
treeFile: string;
|
|
2040
|
+
header: SessionHeader | null;
|
|
2041
|
+
entries: SessionEntry[];
|
|
2042
|
+
leafId: string | null;
|
|
2043
|
+
getEntry(id: string): SessionEntry | undefined;
|
|
2044
|
+
getChildren(parentId: string): SessionEntry[];
|
|
2045
|
+
getBranch(fromId?: string): SessionEntry[];
|
|
2046
|
+
getTree(): PiSessionTreeNode[];
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
interface ParsedInstanceTree {
|
|
2050
|
+
entriesById: Map<string, PrimaryPathEntrySnapshot>;
|
|
2051
|
+
labelsByEntryId: Map<string, string>;
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2054
|
+
/**
|
|
2055
|
+
* A handle to a process session payload that exposes a change `signature`
|
|
2056
|
+
* before the reader pays the cost of parsing the full content.
|
|
2057
|
+
*
|
|
2058
|
+
* The two-step shape lets the reader skip re-parsing whenever the signature is
|
|
2059
|
+
* unchanged. Sources may capture content while producing a handle so its
|
|
2060
|
+
* signature and payload come from the same storage generation.
|
|
2061
|
+
*/
|
|
2062
|
+
interface ProcessSessionSnapshotHandle {
|
|
2063
|
+
/** Opaque value that changes whenever the underlying session content changes. */
|
|
2064
|
+
signature: string;
|
|
2065
|
+
/** Loads the raw session JSONL content captured by this handle. */
|
|
2066
|
+
load(): Promise<string>;
|
|
2067
|
+
}
|
|
2068
|
+
/**
|
|
2069
|
+
* Provides raw process session content without committing the server to a
|
|
2070
|
+
* particular storage location.
|
|
2071
|
+
*
|
|
2072
|
+
* Production read models use a server-owned latest-snapshot store fed by the
|
|
2073
|
+
* worker session-snapshot HTTP exchange. The store may be file-backed, but it
|
|
2074
|
+
* represents the server copy of the session JSONL rather than a requirement to
|
|
2075
|
+
* mount or inspect worker volumes.
|
|
2076
|
+
*/
|
|
2077
|
+
interface ProcessSessionSource {
|
|
2078
|
+
/** Returns a handle for the instance, or `null` when no session exists yet. */
|
|
2079
|
+
readSnapshotHandle(instanceId: string): Promise<ProcessSessionSnapshotHandle | null>;
|
|
2080
|
+
}
|
|
2081
|
+
interface ProcessSessionTreeReadResult {
|
|
2082
|
+
signature: string | null;
|
|
2083
|
+
piTree: ReadonlyPiSessionTree;
|
|
2084
|
+
parsedTree: ParsedInstanceTree;
|
|
2085
|
+
}
|
|
2086
|
+
/**
|
|
2087
|
+
* Reads and caches parsed process session state from a {@link ProcessSessionSource}.
|
|
2088
|
+
*
|
|
2089
|
+
* All server read paths (primary-path snapshots, diagnostics, leaf-outcome
|
|
2090
|
+
* capture and failed-turn continuation) go through this seam so
|
|
2091
|
+
* the server never reads worker filesystems directly.
|
|
2092
|
+
*/
|
|
2093
|
+
declare class ProcessSessionReader {
|
|
2094
|
+
private readonly source;
|
|
2095
|
+
private readonly sessionTreeCache;
|
|
2096
|
+
private readonly inFlightReads;
|
|
2097
|
+
constructor(source: ProcessSessionSource);
|
|
2098
|
+
readSessionTree(instanceId: string): Promise<ProcessSessionTreeReadResult>;
|
|
2099
|
+
readInstanceTree(instanceId: string): Promise<ParsedInstanceTree>;
|
|
2100
|
+
readPiSessionTree(instanceId: string): Promise<ReadonlyPiSessionTree>;
|
|
2101
|
+
private readCachedSessionTree;
|
|
2102
|
+
/** Returns the raw session JSONL, or `null` when no session exists yet. */
|
|
2103
|
+
readRawContent(instanceId: string): Promise<string | null>;
|
|
2104
|
+
}
|
|
2105
|
+
|
|
2106
|
+
interface ProcessUiRegistry {
|
|
2107
|
+
getLeafOutcomeDefinition(processId: string): ProcessLeafOutcomeDefinition | undefined;
|
|
2108
|
+
}
|
|
2109
|
+
|
|
2110
|
+
type ProcessProductRefPatch = Record<string, ProcessProductRef | null | undefined>;
|
|
2111
|
+
|
|
2112
|
+
type EntryRefPatch = Record<string, {
|
|
2113
|
+
entryId: string;
|
|
2114
|
+
turnRecordId?: string | null;
|
|
2115
|
+
} | null | undefined>;
|
|
2116
|
+
|
|
2117
|
+
type ProcessSemanticEntryRefPatch = Partial<Record<ProcessSemanticEntryRefKey, EntryRefPatch[string]>>;
|
|
2118
|
+
|
|
2119
|
+
type DeferredProcessExtensionEvent = {
|
|
2120
|
+
[K in ServerExtensionEventName]: {
|
|
2121
|
+
type: K;
|
|
2122
|
+
payload: ServerExtensionEventMap[K];
|
|
2123
|
+
};
|
|
2124
|
+
}[ServerExtensionEventName];
|
|
2125
|
+
declare function emitDeferredExtensionEvent(host: ExtensionHost | undefined, event: DeferredProcessExtensionEvent): Promise<void> | void;
|
|
2126
|
+
|
|
2127
|
+
type FutureExecutionTransitionPlan = {
|
|
2128
|
+
kind: "consume";
|
|
2129
|
+
futureExecutionId: string;
|
|
2130
|
+
expectedKind: FutureExecution["kind"];
|
|
2131
|
+
expectedNextRunAt: string;
|
|
2132
|
+
} | {
|
|
2133
|
+
kind: "advance";
|
|
2134
|
+
futureExecutionId: string;
|
|
2135
|
+
expectedKind: FutureExecution["kind"];
|
|
2136
|
+
expectedNextRunAt: string;
|
|
2137
|
+
nextRunAt: string;
|
|
2138
|
+
} | {
|
|
2139
|
+
kind: "block";
|
|
2140
|
+
futureExecutionId: string;
|
|
2141
|
+
expectedKind: FutureExecution["kind"];
|
|
2142
|
+
expectedNextRunAt: string;
|
|
2143
|
+
blockedReason: FutureExecutionBlockReason;
|
|
2144
|
+
modelSelection: DurableModelSelection | null;
|
|
2145
|
+
nextRunAt?: string;
|
|
2146
|
+
} | {
|
|
2147
|
+
kind: "retry";
|
|
2148
|
+
futureExecutionId: string;
|
|
2149
|
+
expectedKind: FutureExecution["kind"];
|
|
2150
|
+
expectedNextRunAt: string;
|
|
2151
|
+
nextRunAt: string;
|
|
2152
|
+
} | {
|
|
2153
|
+
kind: "cancel_action";
|
|
2154
|
+
futureExecutionId: string;
|
|
2155
|
+
expectedInstanceId: string;
|
|
2156
|
+
};
|
|
2157
|
+
|
|
2158
|
+
type DurableBroadcast = DurableWsFrameInput;
|
|
2159
|
+
type TurnRecordWrite = {
|
|
2160
|
+
kind: "create";
|
|
2161
|
+
input: CreateProcessTurnRecordInput;
|
|
2162
|
+
} | {
|
|
2163
|
+
kind: "update";
|
|
2164
|
+
id: string;
|
|
2165
|
+
input: UpdateProcessTurnRecordInput;
|
|
2166
|
+
};
|
|
2167
|
+
type TurnStartWrite = {
|
|
2168
|
+
kind: "create";
|
|
2169
|
+
input: Omit<TurnStartRecord, "id" | "createdAt" | "updatedAt"> & {
|
|
2170
|
+
id?: string;
|
|
2171
|
+
};
|
|
2172
|
+
} | {
|
|
2173
|
+
kind: "cas_state";
|
|
2174
|
+
id: string;
|
|
2175
|
+
expectedKind: TurnStartRecord["state"]["kind"];
|
|
2176
|
+
state: TurnStartRecord["state"];
|
|
2177
|
+
};
|
|
2178
|
+
type TurnAnnotationWrite = {
|
|
2179
|
+
kind: "create";
|
|
2180
|
+
input: CreateProcessTurnAnnotationInput;
|
|
2181
|
+
} | {
|
|
2182
|
+
kind: "update";
|
|
2183
|
+
id: string;
|
|
2184
|
+
input: UpdateProcessTurnAnnotationInput;
|
|
2185
|
+
} | {
|
|
2186
|
+
kind: "delete";
|
|
2187
|
+
id: string;
|
|
2188
|
+
};
|
|
2189
|
+
type LeafOutcomeSnapshotWrite = {
|
|
2190
|
+
kind: "create";
|
|
2191
|
+
input: CreateProcessLeafOutcomeSnapshotInput;
|
|
2192
|
+
};
|
|
2193
|
+
type WorkerIntent = {
|
|
2194
|
+
kind: "reconcile";
|
|
2195
|
+
} | {
|
|
2196
|
+
kind: "restart_worker";
|
|
2197
|
+
} | {
|
|
2198
|
+
kind: "start_if_needed";
|
|
2199
|
+
} | {
|
|
2200
|
+
kind: "abort_turn";
|
|
2201
|
+
reason: string;
|
|
2202
|
+
} | {
|
|
2203
|
+
kind: "stop_with_reason";
|
|
2204
|
+
reason: string;
|
|
2205
|
+
};
|
|
2206
|
+
type PendingExternalSourceFireWrite = {
|
|
2207
|
+
kind: "create";
|
|
2208
|
+
input: CreatePendingExternalSourceFireInput;
|
|
2209
|
+
} | {
|
|
2210
|
+
kind: "update";
|
|
2211
|
+
id: string;
|
|
2212
|
+
input: UpdatePendingExternalSourceFireInput;
|
|
2213
|
+
} | {
|
|
2214
|
+
kind: "delete";
|
|
2215
|
+
id: string;
|
|
2216
|
+
};
|
|
2217
|
+
interface DecisionMetadata {
|
|
2218
|
+
nextTurnModelProfileId?: string | null;
|
|
2219
|
+
providerOptions?: Readonly<Record<string, string>>;
|
|
2220
|
+
}
|
|
2221
|
+
interface Writes {
|
|
2222
|
+
processPatch: UpdateProcessInstanceInput;
|
|
2223
|
+
changedFields: string[];
|
|
2224
|
+
projectWrite?: {
|
|
2225
|
+
id: string;
|
|
2226
|
+
input: UpdateProcessProjectInput;
|
|
2227
|
+
};
|
|
2228
|
+
turnRecordWrites: TurnRecordWrite[];
|
|
2229
|
+
turnStartWrites: TurnStartWrite[];
|
|
2230
|
+
turnAnnotationWrites: TurnAnnotationWrite[];
|
|
2231
|
+
leafOutcomeSnapshotWrites: LeafOutcomeSnapshotWrite[];
|
|
2232
|
+
events: CreateProcessEventInput[];
|
|
2233
|
+
broadcasts: DurableBroadcast[];
|
|
2234
|
+
queuedInputs: QueuedProcessInput[];
|
|
2235
|
+
extensionEvents: DeferredProcessExtensionEvent[];
|
|
2236
|
+
futureExecutionPlans: FutureExecutionTransitionPlan[];
|
|
2237
|
+
pendingExternalSourceFireWrites: PendingExternalSourceFireWrite[];
|
|
2238
|
+
workerIntent?: WorkerIntent;
|
|
2239
|
+
}
|
|
2240
|
+
interface WriteBuildFailure {
|
|
2241
|
+
ok: false;
|
|
2242
|
+
code: string;
|
|
2243
|
+
message: string;
|
|
2244
|
+
}
|
|
2245
|
+
type WriteBuildResult = Writes | WriteBuildFailure;
|
|
2246
|
+
|
|
2247
|
+
interface WorkerReconcileEffectChange extends ProcessTurnSelectionChange {
|
|
2248
|
+
}
|
|
2249
|
+
type FutureExecutionUpdatedOperation = "created" | "updated" | "deleted";
|
|
2250
|
+
type PostCommitEffect = {
|
|
2251
|
+
kind: "broadcast";
|
|
2252
|
+
frame: DurableWsFrameInput;
|
|
2253
|
+
} | {
|
|
2254
|
+
kind: "future_execution_updated";
|
|
2255
|
+
futureExecution: Pick<FutureExecution, "id" | "kind" | "instanceId">;
|
|
2256
|
+
operation: FutureExecutionUpdatedOperation;
|
|
2257
|
+
} | {
|
|
2258
|
+
kind: "dispatch_inputs";
|
|
2259
|
+
instanceId: string;
|
|
2260
|
+
inputs: ProcessInput[];
|
|
2261
|
+
spawnIfMissing: boolean;
|
|
2262
|
+
} | {
|
|
2263
|
+
kind: "worker";
|
|
2264
|
+
instanceId: string;
|
|
2265
|
+
effect: WorkerIntent;
|
|
2266
|
+
} | {
|
|
2267
|
+
kind: "worker_reconcile";
|
|
2268
|
+
instanceId: string;
|
|
2269
|
+
processId: string;
|
|
2270
|
+
change: WorkerReconcileEffectChange;
|
|
2271
|
+
} | {
|
|
2272
|
+
kind: "extension_event";
|
|
2273
|
+
event: DeferredProcessExtensionEvent;
|
|
2274
|
+
} | {
|
|
2275
|
+
kind: "queue_process_title";
|
|
2276
|
+
processId: string;
|
|
2277
|
+
launchPlan: ProcessLaunchPlan;
|
|
2278
|
+
launchRunId?: string;
|
|
2279
|
+
} | {
|
|
2280
|
+
kind: "queue_future_execution_title";
|
|
2281
|
+
futureExecutionId: string;
|
|
2282
|
+
launchPlan: ProcessLaunchPlan;
|
|
2283
|
+
expectedPayloadJson?: string;
|
|
2284
|
+
};
|
|
2285
|
+
|
|
2286
|
+
interface RecordCommit {
|
|
2287
|
+
turnEventSequences?: Record<string, number>;
|
|
2288
|
+
instanceId: string;
|
|
2289
|
+
processBefore: ProcessInstance | null;
|
|
2290
|
+
processAfter: ProcessInstance | null;
|
|
2291
|
+
committedProject: ProcessProject | null;
|
|
2292
|
+
committedTurnRecords: ProcessTurnRecord[];
|
|
2293
|
+
committedLeafOutcomeSnapshots: ProcessLeafOutcomeSnapshot[];
|
|
2294
|
+
committedAnnotationChanges: Array<{
|
|
2295
|
+
change: "created" | "updated";
|
|
2296
|
+
annotation: ProcessTurnAnnotation;
|
|
2297
|
+
}>;
|
|
2298
|
+
persistedInputs: ProcessInput[];
|
|
2299
|
+
extensionEvents: DeferredProcessExtensionEvent[];
|
|
2300
|
+
workerIntent?: WorkerIntent;
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2303
|
+
interface Decision<TData = void> {
|
|
2304
|
+
ok: true;
|
|
2305
|
+
writes: Writes;
|
|
2306
|
+
data: TData;
|
|
2307
|
+
metadata?: DecisionMetadata;
|
|
2308
|
+
/**
|
|
2309
|
+
* Used when operation data is only known after the durable commit. For example,
|
|
2310
|
+
* queued inputs receive durable sequence numbers while recording.
|
|
2311
|
+
*/
|
|
2312
|
+
deriveData?: (commit: RecordCommit) => TData;
|
|
2313
|
+
}
|
|
2314
|
+
interface RejectedDecision<TData = unknown> {
|
|
2315
|
+
ok: false;
|
|
2316
|
+
code: EngineErrorCode;
|
|
2317
|
+
message: string;
|
|
2318
|
+
data?: TData;
|
|
2319
|
+
}
|
|
2320
|
+
type DecideResult<TData> = Decision<TData> | RejectedDecision<TData>;
|
|
2321
|
+
|
|
2322
|
+
interface OperationInputBase {
|
|
2323
|
+
instanceId: string;
|
|
2324
|
+
}
|
|
2325
|
+
interface OperationMessages {
|
|
2326
|
+
dispatchErrorMessage?: string;
|
|
2327
|
+
reconcileErrorMessage?: string;
|
|
2328
|
+
}
|
|
2329
|
+
type DecideFunction<TInput extends OperationInputBase, TData> = {
|
|
2330
|
+
bivarianceHack(ctx: DecideContext, input: TInput): Promise<DecideResult<TData>> | DecideResult<TData>;
|
|
2331
|
+
}["bivarianceHack"];
|
|
2332
|
+
type MessageResolver<TInput extends OperationInputBase> = {
|
|
2333
|
+
bivarianceHack(input: TInput): OperationMessages;
|
|
2334
|
+
}["bivarianceHack"];
|
|
2335
|
+
type BestEffortFailureReportingResolver<TInput extends OperationInputBase> = {
|
|
2336
|
+
bivarianceHack(input: TInput): boolean;
|
|
2337
|
+
}["bivarianceHack"];
|
|
2338
|
+
type AfterRecordFunction<TInput extends OperationInputBase, TData> = {
|
|
2339
|
+
bivarianceHack(input: TInput, data: TData): void;
|
|
2340
|
+
}["bivarianceHack"];
|
|
2341
|
+
interface OperationSpec<TKind extends string, TInput extends OperationInputBase, TData> {
|
|
2342
|
+
kind: TKind;
|
|
2343
|
+
label?: string;
|
|
2344
|
+
/** Reject this operation while another subsystem has reserved new-turn admission. */
|
|
2345
|
+
admission?: "new_turn";
|
|
2346
|
+
/**
|
|
2347
|
+
* Operation decisions are pure with respect to process-owned durable state and
|
|
2348
|
+
* the outside world: they may read repositories and prepare writes/reactions,
|
|
2349
|
+
* but they must not commit state, broadcast, dispatch inputs, control workers,
|
|
2350
|
+
* or emit extension events.
|
|
2351
|
+
*/
|
|
2352
|
+
decide: DecideFunction<TInput, TData>;
|
|
2353
|
+
/** Runs after the transaction and process lock complete, before reactions are dispatched. */
|
|
2354
|
+
afterRecord?: AfterRecordFunction<TInput, TData>;
|
|
2355
|
+
messages?: OperationMessages | MessageResolver<TInput>;
|
|
2356
|
+
reportBestEffortFailures?: boolean | BestEffortFailureReportingResolver<TInput>;
|
|
2357
|
+
}
|
|
2358
|
+
type OperationInput<TOp> = TOp extends OperationSpec<string, infer TInput, unknown> ? TInput : never;
|
|
2359
|
+
type OperationData<TOp> = TOp extends OperationSpec<string, OperationInputBase, infer TData> ? TData : never;
|
|
2360
|
+
|
|
2361
|
+
interface ParkProcessLifecyclePayload {
|
|
2362
|
+
selectedTurnId?: string | null;
|
|
2363
|
+
reason?: string;
|
|
2364
|
+
errorClass?: WorkerErrorClass;
|
|
2365
|
+
}
|
|
2366
|
+
interface ProcessEngineLogger {
|
|
2367
|
+
error(payload: Record<string, unknown>, message?: string): void;
|
|
2368
|
+
}
|
|
2369
|
+
interface ProcessEngineDeps extends Pick<RepositoryBundle, "processes" | "events" | "futureExecutions" | "inputs" | "projects" | "pendingExternalSourceFires" | "leafOutcomeSnapshots" | "questionRequests" | "turnRecords" | "turnStarts" | "leases" | "turnAnnotations" | "transaction"> {
|
|
2370
|
+
processOperations: ProcessOperationCoordinator;
|
|
2371
|
+
broadcaster: Broadcaster;
|
|
2372
|
+
config?: LeitwerkConfig;
|
|
2373
|
+
toastTtlMs?: number;
|
|
2374
|
+
getSupervisor: () => WorkerSupervisor | undefined;
|
|
2375
|
+
extensionHost?: ExtensionHost;
|
|
2376
|
+
processGraphs: ProcessGraphRegistry;
|
|
2377
|
+
sessionReader?: ProcessSessionReader;
|
|
2378
|
+
getProcessActionRegistry?: () => ProcessActionRegistry | undefined;
|
|
2379
|
+
getProcessUiRegistry?: () => ProcessUiRegistry | undefined;
|
|
2380
|
+
logger?: ProcessEngineLogger;
|
|
2381
|
+
/** Required by the server-owned engine; embedded callers adapt at construction. */
|
|
2382
|
+
processModelPolicy: ServerProcessModelPolicy;
|
|
2383
|
+
getModelAvailabilitySnapshot: () => ModelStatusCacheSnapshot;
|
|
2384
|
+
afterRecord?: (process: ProcessInstance) => void | Promise<void>;
|
|
2385
|
+
afterSuccessHooks?: Set<(instanceId: string) => void | Promise<void>>;
|
|
2386
|
+
isNewTurnBlocked?: (instanceId: string) => boolean;
|
|
2387
|
+
prepareTurnStarts?: (process: ProcessInstance, writes: Writes, providerOptions?: Readonly<Record<string, string>>, availabilitySnapshot?: ModelStatusCacheSnapshot) => Promise<{
|
|
2388
|
+
ok: true;
|
|
2389
|
+
} | {
|
|
2390
|
+
ok: false;
|
|
2391
|
+
code: string;
|
|
2392
|
+
message: string;
|
|
2393
|
+
}>;
|
|
2394
|
+
}
|
|
2395
|
+
interface DecideContext {
|
|
2396
|
+
deps: ProcessEngineDeps;
|
|
2397
|
+
instanceId: string;
|
|
2398
|
+
process: ProcessInstance;
|
|
2399
|
+
}
|
|
2400
|
+
interface ProcessTurnSelectionChange {
|
|
2401
|
+
fromTurnId: string | null;
|
|
2402
|
+
toTurnId: string | null;
|
|
2403
|
+
fromLifecycleStatus: ProcessLifecycleStatus;
|
|
2404
|
+
toLifecycleStatus: ProcessLifecycleStatus;
|
|
2405
|
+
}
|
|
2406
|
+
type EngineErrorCode = "process_not_found" | "operation_failed" | "record_failed" | "post_commit_failed" | "approval_conflict" | "external_publish_failed" | "input_dispatch_failed" | "worker_reconcile_failed" | "retry_target_missing" | (string & {});
|
|
2407
|
+
type EngineFailureStage = "pre_commit" | "post_commit";
|
|
2408
|
+
interface EngineSuccess<T> {
|
|
2409
|
+
ok: true;
|
|
2410
|
+
process: ProcessInstance;
|
|
2411
|
+
data: T;
|
|
2412
|
+
turnSelectionChange?: ProcessTurnSelectionChange;
|
|
2413
|
+
}
|
|
2414
|
+
interface EngineFailure<T> {
|
|
2415
|
+
ok: false;
|
|
2416
|
+
code: EngineErrorCode;
|
|
2417
|
+
message: string;
|
|
2418
|
+
process?: ProcessInstance | null;
|
|
2419
|
+
data?: T;
|
|
2420
|
+
turnSelectionChange?: ProcessTurnSelectionChange;
|
|
2421
|
+
stage?: EngineFailureStage;
|
|
2422
|
+
}
|
|
2423
|
+
type EngineResult<T = undefined> = EngineSuccess<T> | EngineFailure<T>;
|
|
2424
|
+
type ActionExecutionResult = ActionExecutionResultLike;
|
|
2425
|
+
interface ProcessEngine {
|
|
2426
|
+
getDeferredProcessActivationSnapshots(query: DeferredProcessActivationSnapshotQuery): DeferredProcessActivationSnapshotResult;
|
|
2427
|
+
activateDeferredProcess(instanceId: string, prepared: PreparedDeferredProcessActivation): Promise<EngineResult<{
|
|
2428
|
+
outcome: DeferredProcessActivationOutcome;
|
|
2429
|
+
}>>;
|
|
2430
|
+
parkDeferredProcessActivationFailure(instanceId: string, failure: DeferredProcessActivationFailure): Promise<EngineResult<{
|
|
2431
|
+
outcome: "parked" | "stale" | "not_applicable" | "project_not_found";
|
|
2432
|
+
}>>;
|
|
2433
|
+
run<TOp extends OperationSpec<string, OperationInputBase, unknown>>(operation: TOp, input: OperationInput<TOp>): Promise<EngineResult<OperationData<TOp>>>;
|
|
2434
|
+
startProcess(instanceId: string, startTurnId: TurnId, opts?: {
|
|
2435
|
+
actor?: Actor;
|
|
2436
|
+
}): Promise<EngineResult<void>>;
|
|
2437
|
+
abortProcess(instanceId: string, opts?: {
|
|
2438
|
+
actor?: Actor;
|
|
2439
|
+
expectedTurnRecordId?: string;
|
|
2440
|
+
}): Promise<EngineResult<void>>;
|
|
2441
|
+
abortTurn(instanceId: string, opts?: {
|
|
2442
|
+
reason?: string;
|
|
2443
|
+
actor?: Actor;
|
|
2444
|
+
}): Promise<EngineResult<void>>;
|
|
2445
|
+
retryProcess(instanceId: string, opts?: {
|
|
2446
|
+
nextTurnModelProfileId?: string | null;
|
|
2447
|
+
providerOptions?: Readonly<Record<string, string>>;
|
|
2448
|
+
actor?: Actor;
|
|
2449
|
+
}): Promise<EngineResult<void>>;
|
|
2450
|
+
retryStartup(instanceId: string, startRecordId: string, opts?: {
|
|
2451
|
+
nextTurnModelProfileId?: string | null;
|
|
2452
|
+
providerOptions?: Readonly<Record<string, string>>;
|
|
2453
|
+
}): Promise<EngineResult<{
|
|
2454
|
+
startRecordId: string;
|
|
2455
|
+
}>>;
|
|
2456
|
+
continueFailedTurn(instanceId: string, turnRecordId: string, options?: {
|
|
2457
|
+
prompt?: string | null;
|
|
2458
|
+
nextTurnModelProfileId?: string | null;
|
|
2459
|
+
providerOptions?: Readonly<Record<string, string>>;
|
|
2460
|
+
actor?: Actor;
|
|
2461
|
+
}): Promise<EngineResult<void>>;
|
|
2462
|
+
parkProcessLifecycle(instanceId: string, payload: ParkProcessLifecyclePayload): Promise<EngineResult<void>>;
|
|
2463
|
+
recordWorkerFailure(instanceId: string, payload: {
|
|
2464
|
+
errorCode: string;
|
|
2465
|
+
message: string;
|
|
2466
|
+
errorClass?: WorkerErrorClass;
|
|
2467
|
+
workerLeaseId?: string | null;
|
|
2468
|
+
resultPiEntryId?: string | null;
|
|
2469
|
+
recoveryContext?: TurnFailedPayload["recoveryContext"];
|
|
2470
|
+
}): Promise<EngineResult<void>>;
|
|
2471
|
+
acceptWorkerTurnStart(instanceId: string, input: {
|
|
2472
|
+
startRecordId: string;
|
|
2473
|
+
proposedTurnRecordId: string;
|
|
2474
|
+
workerLeaseId: string;
|
|
2475
|
+
}): Promise<EngineResult<{
|
|
2476
|
+
turnRecordId: string;
|
|
2477
|
+
}>>;
|
|
2478
|
+
recordTurnOutcome(instanceId: string, payload: TurnOutcomePayload, options?: {
|
|
2479
|
+
onRecorded?: () => void;
|
|
2480
|
+
}): Promise<EngineResult<void>>;
|
|
2481
|
+
recordTurnFailed(instanceId: string, payload: TurnFailedPayload, options?: {
|
|
2482
|
+
onRecorded?: () => void;
|
|
2483
|
+
}): Promise<EngineResult<void>>;
|
|
2484
|
+
updateSemanticEntryRefs(instanceId: string, patch: ProcessSemanticEntryRefPatch): Promise<EngineResult<void>>;
|
|
2485
|
+
updateProductRefs(instanceId: string, patch: ProcessProductRefPatch): Promise<EngineResult<void>>;
|
|
2486
|
+
queueInputs(instanceId: string, queued: QueuedProcessInput[], opts?: {
|
|
2487
|
+
dispatchErrorMessage?: string;
|
|
2488
|
+
actor?: Actor;
|
|
2489
|
+
}): Promise<EngineResult<ProcessInput[]>>;
|
|
2490
|
+
dispatchExternalTurnTrigger(instanceId: string, actionId: string, input: Record<string, unknown>): Promise<ActionExecutionResult | {
|
|
2491
|
+
ok: true;
|
|
2492
|
+
process: null;
|
|
2493
|
+
data: {
|
|
2494
|
+
ignored: true;
|
|
2495
|
+
};
|
|
2496
|
+
}>;
|
|
2497
|
+
executeProcessAction(instanceId: string, actionId: string, input: Record<string, unknown>, opts?: NonNullable<Parameters<ProcessActionServiceLike["executeAction"]>[3]> & {
|
|
2498
|
+
scheduledExecutionId?: string;
|
|
2499
|
+
consumeScheduledExecutionOnSuccess?: boolean;
|
|
2500
|
+
}): Promise<ActionExecutionResult>;
|
|
2501
|
+
}
|
|
2502
|
+
|
|
2503
|
+
type PostCommitEffectFailureCode = "input_dispatch_failed" | "worker_reconcile_failed" | "broadcast_failed" | "extension_event_failed" | "queue_process_title_failed" | "queue_future_execution_title_failed";
|
|
2504
|
+
|
|
2505
|
+
type LaunchStageFailure<TFailure> = {
|
|
2506
|
+
safeSummary: string;
|
|
2507
|
+
value: TFailure;
|
|
2508
|
+
};
|
|
2509
|
+
type LaunchResolution<TResolved, TFailure> = {
|
|
2510
|
+
kind: "resolved";
|
|
2511
|
+
value: TResolved;
|
|
2512
|
+
} | {
|
|
2513
|
+
kind: "skipped";
|
|
2514
|
+
} | {
|
|
2515
|
+
kind: "failed";
|
|
2516
|
+
failure: LaunchStageFailure<TFailure>;
|
|
2517
|
+
};
|
|
2518
|
+
interface LaunchPipelineCheck {
|
|
2519
|
+
id: string;
|
|
2520
|
+
label: string;
|
|
2521
|
+
run(input: {
|
|
2522
|
+
signal: AbortSignal;
|
|
2523
|
+
logger: {
|
|
2524
|
+
info(message: string): void;
|
|
2525
|
+
warn(message: string): void;
|
|
2526
|
+
};
|
|
2527
|
+
}): Promise<void>;
|
|
2528
|
+
}
|
|
2529
|
+
type LaunchCommit<TResult, TFailure> = {
|
|
2530
|
+
kind: "committed";
|
|
2531
|
+
result: TResult;
|
|
2532
|
+
process: ProcessInstance;
|
|
2533
|
+
startTurnId: string | null;
|
|
2534
|
+
reused: boolean;
|
|
2535
|
+
} | {
|
|
2536
|
+
kind: "committed_with_reaction_error";
|
|
2537
|
+
result: TResult;
|
|
2538
|
+
process: ProcessInstance;
|
|
2539
|
+
startTurnId: string | null;
|
|
2540
|
+
safeSummary: string;
|
|
2541
|
+
} | {
|
|
2542
|
+
kind: "failed";
|
|
2543
|
+
failure: LaunchStageFailure<TFailure>;
|
|
2544
|
+
};
|
|
2545
|
+
interface LaunchAdapter<TResolved, TPrepared, TResult, TFailure> {
|
|
2546
|
+
resolve(): Promise<LaunchResolution<TResolved, TFailure>>;
|
|
2547
|
+
preparationChecks?(resolved: TResolved): readonly LaunchPipelineCheck[];
|
|
2548
|
+
preparationCheckFailure?(error: unknown, safeSummary: string): TFailure;
|
|
2549
|
+
prepare(resolved: TResolved): Promise<{
|
|
2550
|
+
ok: true;
|
|
2551
|
+
value: TPrepared;
|
|
2552
|
+
} | {
|
|
2553
|
+
ok: false;
|
|
2554
|
+
failure: LaunchStageFailure<TFailure>;
|
|
2555
|
+
}>;
|
|
2556
|
+
commit(prepared: TPrepared, ctx: {
|
|
2557
|
+
launchRunId: string;
|
|
2558
|
+
}): Promise<LaunchCommit<TResult, TFailure>>;
|
|
2559
|
+
unexpectedFailure?(error: unknown): LaunchStageFailure<TFailure>;
|
|
2560
|
+
}
|
|
2561
|
+
type LaunchPipelineRunResult<TResult, TFailure> = {
|
|
2562
|
+
kind: "skipped";
|
|
2563
|
+
} | {
|
|
2564
|
+
kind: "failed";
|
|
2565
|
+
failure: LaunchStageFailure<TFailure>;
|
|
2566
|
+
} | {
|
|
2567
|
+
kind: "committed" | "committed_with_reaction_error";
|
|
2568
|
+
result: TResult;
|
|
2569
|
+
process: ProcessInstance;
|
|
2570
|
+
reused: boolean;
|
|
2571
|
+
};
|
|
2572
|
+
interface LaunchPipeline {
|
|
2573
|
+
open(input: {
|
|
2574
|
+
launcherId: string | null;
|
|
2575
|
+
idempotencyKey?: string | null;
|
|
2576
|
+
origin: LaunchRun["origin"];
|
|
2577
|
+
broadcast?: boolean;
|
|
2578
|
+
}): {
|
|
2579
|
+
launchRunId: string;
|
|
2580
|
+
existing: boolean;
|
|
2581
|
+
};
|
|
2582
|
+
update(id: string, fn: (run: LaunchRun) => LaunchRun): LaunchRun;
|
|
2583
|
+
run<TResolved, TPrepared, TResult, TFailure>(launchRunId: string, adapter: LaunchAdapter<TResolved, TPrepared, TResult, TFailure>): Promise<LaunchPipelineRunResult<TResult, TFailure>>;
|
|
2584
|
+
}
|
|
2585
|
+
|
|
2586
|
+
interface LauncherRecentValuesService {
|
|
2587
|
+
list(launcherId: string): Record<string, readonly string[]>;
|
|
2588
|
+
record(launcherId: string, launcherInput: Record<string, unknown>): void;
|
|
2589
|
+
}
|
|
2590
|
+
|
|
2591
|
+
type ProcessLaunchRelationInput = Omit<ProcessRelation, "kind" | "childInstanceId" | "createdAt">;
|
|
2592
|
+
|
|
2593
|
+
type FutureModelSelectionState = Pick<FutureExecution, "modelSelection" | "blockedReason">;
|
|
2594
|
+
declare function projectLaunchPlanModelState(plan: ProcessLaunchPlan, input: {
|
|
2595
|
+
policy: ServerProcessModelPolicy;
|
|
2596
|
+
availability: ModelStatusCacheSnapshot;
|
|
2597
|
+
detectedAt?: string;
|
|
2598
|
+
existingBlockedReason?: FutureExecutionBlockReason | null;
|
|
2599
|
+
}): FutureModelSelectionState;
|
|
2600
|
+
|
|
2601
|
+
interface FutureExecutionIssue extends LauncherValidationError {
|
|
2602
|
+
}
|
|
2603
|
+
type LaunchFailure = {
|
|
2604
|
+
kind: "invalid";
|
|
2605
|
+
issues: readonly FutureExecutionIssue[];
|
|
2606
|
+
} | {
|
|
2607
|
+
kind: "not_found";
|
|
2608
|
+
target: "future_execution" | "launch" | "action" | "process";
|
|
2609
|
+
} | {
|
|
2610
|
+
kind: "conflict";
|
|
2611
|
+
issue: FutureExecutionIssue;
|
|
2612
|
+
} | {
|
|
2613
|
+
kind: "unavailable";
|
|
2614
|
+
reason: string;
|
|
2615
|
+
} | {
|
|
2616
|
+
kind: "failed";
|
|
2617
|
+
issue: FutureExecutionIssue;
|
|
2618
|
+
};
|
|
2619
|
+
type LaunchMutationOutcome = {
|
|
2620
|
+
kind: "scheduled";
|
|
2621
|
+
execution: FutureExecution;
|
|
2622
|
+
operation: "created" | "updated";
|
|
2623
|
+
} | {
|
|
2624
|
+
kind: "launched";
|
|
2625
|
+
process: ProcessInstance;
|
|
2626
|
+
projects: ProcessProject[];
|
|
2627
|
+
operation: "created" | "updated";
|
|
2628
|
+
} | {
|
|
2629
|
+
kind: "committed_with_reaction_error";
|
|
2630
|
+
process: ProcessInstance;
|
|
2631
|
+
projects: ProcessProject[];
|
|
2632
|
+
error: string;
|
|
2633
|
+
code?: string;
|
|
2634
|
+
} | {
|
|
2635
|
+
kind: "committed_with_reaction_error";
|
|
2636
|
+
execution: FutureExecution;
|
|
2637
|
+
operation: "created" | "updated";
|
|
2638
|
+
error: string;
|
|
2639
|
+
code: string;
|
|
2640
|
+
} | LaunchFailure;
|
|
2641
|
+
interface NormalizedScheduledLaunchInput extends ParsedLauncherRequestBody {
|
|
2642
|
+
}
|
|
2643
|
+
type ValidatedLaunchSchedule = {
|
|
2644
|
+
mode: "now";
|
|
2645
|
+
nextRunAt: null;
|
|
2646
|
+
cronExpression: null;
|
|
2647
|
+
} | {
|
|
2648
|
+
mode: "once";
|
|
2649
|
+
nextRunAt: string;
|
|
2650
|
+
cronExpression: null;
|
|
2651
|
+
} | {
|
|
2652
|
+
mode: "cron";
|
|
2653
|
+
nextRunAt: string;
|
|
2654
|
+
cronExpression: string;
|
|
2655
|
+
};
|
|
2656
|
+
interface PreparedLaunch {
|
|
2657
|
+
processId: string;
|
|
2658
|
+
launcherId: string;
|
|
2659
|
+
launcherInput: Record<string, unknown>;
|
|
2660
|
+
modelConfig: LauncherModelConfigDefaults;
|
|
2661
|
+
launchPlan: ProcessLaunchPlan;
|
|
2662
|
+
selectedSkillIds: readonly string[];
|
|
2663
|
+
resourceSelections: readonly SkillSelection[];
|
|
2664
|
+
modelState: ReturnType<typeof projectLaunchPlanModelState>;
|
|
2665
|
+
schedule: ValidatedLaunchSchedule;
|
|
2666
|
+
}
|
|
2667
|
+
type PreparedLaunchResult = {
|
|
2668
|
+
ok: true;
|
|
2669
|
+
prepared: PreparedLaunch;
|
|
2670
|
+
} | {
|
|
2671
|
+
ok: false;
|
|
2672
|
+
outcome: LaunchMutationOutcome;
|
|
2673
|
+
};
|
|
2674
|
+
|
|
2675
|
+
interface FutureExecutionExecutorDeps extends Pick<RepositoryBundle, "futureExecutions" | "processes" | "projects" | "processRelations" | "processSkills" | "skills" | "handoffDedupKeys" | "transaction"> {
|
|
2676
|
+
turnRecords?: RepositoryBundle["turnRecords"];
|
|
2677
|
+
broadcaster: Broadcaster;
|
|
2678
|
+
commands: ProcessEngine;
|
|
2679
|
+
processOperations: ProcessOperationCoordinator;
|
|
2680
|
+
processTitles?: ProcessTitleGenerator;
|
|
2681
|
+
extensionHost?: ExtensionHost;
|
|
2682
|
+
processGraphs?: ProcessGraphRegistry;
|
|
2683
|
+
processActionRegistry?: ProcessActionRegistry;
|
|
2684
|
+
/** Required for every server-owned scheduled execution. */
|
|
2685
|
+
processModelPolicy: ServerProcessModelPolicy;
|
|
2686
|
+
launchPlans: ProcessLaunchPlanServiceLike;
|
|
2687
|
+
modelStatusCache: Pick<ModelStatusCache, "snapshot">;
|
|
2688
|
+
launchPipeline: LaunchPipeline;
|
|
2689
|
+
logger?: ProcessEngineLogger;
|
|
2690
|
+
}
|
|
2691
|
+
type FutureExecutionItemOutcome = {
|
|
2692
|
+
kind: "no_work";
|
|
2693
|
+
} | {
|
|
2694
|
+
kind: "blocked";
|
|
2695
|
+
} | {
|
|
2696
|
+
kind: "retry_scheduled";
|
|
2697
|
+
} | {
|
|
2698
|
+
kind: "occurrence_advanced";
|
|
2699
|
+
} | {
|
|
2700
|
+
kind: "terminal_invalid_removed";
|
|
2701
|
+
} | {
|
|
2702
|
+
kind: "durable_work_committed";
|
|
2703
|
+
} | {
|
|
2704
|
+
kind: "durable_work_committed_with_reaction_error";
|
|
2705
|
+
error: string;
|
|
2706
|
+
};
|
|
2707
|
+
|
|
2708
|
+
interface FutureExecutionLifecycleDeps extends FutureExecutionExecutorDeps {
|
|
2709
|
+
turnRecords: RepositoryBundle["turnRecords"];
|
|
2710
|
+
launcherService?: ProcessLauncherService;
|
|
2711
|
+
launcherRecentValues?: LauncherRecentValuesService;
|
|
2712
|
+
assertRuntimeAvailable?: (processId: string) => Promise<void>;
|
|
2713
|
+
}
|
|
2714
|
+
interface FutureExecutionLifecycleOptions {
|
|
2715
|
+
now?: () => Date;
|
|
2716
|
+
}
|
|
2717
|
+
type LifecycleFailure = {
|
|
2718
|
+
kind: "invalid";
|
|
2719
|
+
issues: readonly FutureExecutionIssue[];
|
|
2720
|
+
} | {
|
|
2721
|
+
kind: "not_found";
|
|
2722
|
+
target: "future_execution" | "launch" | "action" | "process";
|
|
2723
|
+
} | {
|
|
2724
|
+
kind: "conflict";
|
|
2725
|
+
issue: FutureExecutionIssue;
|
|
2726
|
+
} | {
|
|
2727
|
+
kind: "unavailable";
|
|
2728
|
+
reason: string;
|
|
2729
|
+
} | {
|
|
2730
|
+
kind: "failed";
|
|
2731
|
+
issue: FutureExecutionIssue;
|
|
2732
|
+
};
|
|
2733
|
+
type ActionMutationOutcome = {
|
|
2734
|
+
kind: "scheduled";
|
|
2735
|
+
execution: FutureExecution;
|
|
2736
|
+
instanceId: string;
|
|
2737
|
+
operation: "created" | "updated";
|
|
2738
|
+
} | {
|
|
2739
|
+
kind: "executed";
|
|
2740
|
+
process: ProcessInstance;
|
|
2741
|
+
data?: Record<string, unknown>;
|
|
2742
|
+
} | {
|
|
2743
|
+
kind: "committed_with_reaction_error";
|
|
2744
|
+
process: ProcessInstance;
|
|
2745
|
+
error: string;
|
|
2746
|
+
code?: string;
|
|
2747
|
+
} | {
|
|
2748
|
+
kind: "committed_with_reaction_error";
|
|
2749
|
+
execution: FutureExecution;
|
|
2750
|
+
instanceId: string;
|
|
2751
|
+
operation: "created" | "updated";
|
|
2752
|
+
error: string;
|
|
2753
|
+
code: string;
|
|
2754
|
+
} | LifecycleFailure;
|
|
2755
|
+
type CancelFutureExecutionOutcome = {
|
|
2756
|
+
kind: "canceled";
|
|
2757
|
+
execution: FutureExecution;
|
|
2758
|
+
} | {
|
|
2759
|
+
kind: "committed_with_reaction_error";
|
|
2760
|
+
execution: FutureExecution;
|
|
2761
|
+
error: string;
|
|
2762
|
+
code: string;
|
|
2763
|
+
} | {
|
|
2764
|
+
kind: "not_found";
|
|
2765
|
+
target: "future_execution";
|
|
2766
|
+
};
|
|
2767
|
+
interface FutureExecutionDueItemOutcome {
|
|
2768
|
+
futureExecutionId: string;
|
|
2769
|
+
kind: FutureExecutionItemOutcome["kind"] | "unexpected_error";
|
|
2770
|
+
error?: string;
|
|
2771
|
+
}
|
|
2772
|
+
interface FutureExecutionDueBatchOutcome {
|
|
2773
|
+
kind: "batch_completed";
|
|
2774
|
+
asOf: string;
|
|
2775
|
+
items: FutureExecutionDueItemOutcome[];
|
|
2776
|
+
}
|
|
2777
|
+
interface NormalizedScheduledActionInput extends ParsedActionRequestBody {
|
|
2778
|
+
}
|
|
2779
|
+
declare function createFutureExecutionLifecycle(deps: FutureExecutionLifecycleDeps, _options?: FutureExecutionLifecycleOptions): {
|
|
2780
|
+
prepareLaunch: (launcherId: string, request: NormalizedScheduledLaunchInput, opts?: {
|
|
2781
|
+
resolvedLauncher?: _leitwerk_dev_process_sdk.ResolvedProcessLauncher;
|
|
2782
|
+
}) => Promise<PreparedLaunchResult>;
|
|
2783
|
+
commitPreparedLaunch: (prepared: PreparedLaunch, opts?: {
|
|
2784
|
+
actor?: Actor;
|
|
2785
|
+
launchRunId?: string;
|
|
2786
|
+
}) => Promise<LaunchMutationOutcome>;
|
|
2787
|
+
reviseScheduledLaunch: (futureExecutionId: string, request: NormalizedScheduledLaunchInput, opts?: {
|
|
2788
|
+
actor?: Actor;
|
|
2789
|
+
}) => Promise<LaunchMutationOutcome>;
|
|
2790
|
+
scheduleAction(process: ProcessInstance, actionId: string, request: NormalizedScheduledActionInput, opts?: {
|
|
2791
|
+
actor?: Actor;
|
|
2792
|
+
}): Promise<ActionMutationOutcome>;
|
|
2793
|
+
reviseScheduledAction(futureExecutionId: string, request: NormalizedScheduledActionInput, opts?: {
|
|
2794
|
+
actor?: Actor;
|
|
2795
|
+
}): Promise<ActionMutationOutcome>;
|
|
2796
|
+
cancel(futureExecutionId: string): Promise<CancelFutureExecutionOutcome>;
|
|
2797
|
+
applyGeneratedFutureLaunchTitleIfUnchanged: (input: {
|
|
2798
|
+
futureExecutionId: string;
|
|
2799
|
+
expectedPayloadJson: string;
|
|
2800
|
+
title: string;
|
|
2801
|
+
}) => Promise<{
|
|
2802
|
+
kind: "applied";
|
|
2803
|
+
execution: FutureExecution;
|
|
2804
|
+
} | {
|
|
2805
|
+
kind: "applied_with_reaction_error";
|
|
2806
|
+
execution: FutureExecution;
|
|
2807
|
+
error: string;
|
|
2808
|
+
code: string;
|
|
2809
|
+
} | {
|
|
2810
|
+
kind: "superseded";
|
|
2811
|
+
} | {
|
|
2812
|
+
kind: "failed";
|
|
2813
|
+
error: string;
|
|
2814
|
+
}>;
|
|
2815
|
+
reconcileModelAvailability(input: {
|
|
2816
|
+
availability: ModelStatusCacheSnapshot;
|
|
2817
|
+
profileIds?: ReadonlySet<string>;
|
|
2818
|
+
asOf?: string;
|
|
2819
|
+
}): Promise<{
|
|
2820
|
+
kind: string;
|
|
2821
|
+
changed: number;
|
|
2822
|
+
asOf: string;
|
|
2823
|
+
error?: undefined;
|
|
2824
|
+
code?: undefined;
|
|
2825
|
+
} | {
|
|
2826
|
+
kind: string;
|
|
2827
|
+
changed: number;
|
|
2828
|
+
asOf: string;
|
|
2829
|
+
error: string;
|
|
2830
|
+
code: PostCommitEffectFailureCode;
|
|
2831
|
+
}>;
|
|
2832
|
+
reconcileMissedScheduleOccurrences(asOf: string): Promise<{
|
|
2833
|
+
kind: "occurrences_advanced";
|
|
2834
|
+
asOf: string;
|
|
2835
|
+
}>;
|
|
2836
|
+
runDueWork(asOf: string): Promise<FutureExecutionDueBatchOutcome>;
|
|
2837
|
+
};
|
|
2838
|
+
type FutureExecutionLifecycle = ReturnType<typeof createFutureExecutionLifecycle>;
|
|
2839
|
+
|
|
2840
|
+
interface StartLaunchRequest {
|
|
2841
|
+
launcherId: string;
|
|
2842
|
+
idempotencyKey?: string | null;
|
|
2843
|
+
request: NormalizedScheduledLaunchInput;
|
|
2844
|
+
actor: Actor;
|
|
2845
|
+
processMetadata?: Record<string, unknown>;
|
|
2846
|
+
}
|
|
2847
|
+
interface PreparedPlanLaunchRequest {
|
|
2848
|
+
launchPlan: ProcessLaunchPlan;
|
|
2849
|
+
idempotencyKey: string;
|
|
2850
|
+
actor: Actor;
|
|
2851
|
+
origin: LaunchRun["origin"];
|
|
2852
|
+
relation?: ProcessLaunchRelationInput;
|
|
2853
|
+
}
|
|
2854
|
+
interface LaunchCoordinator {
|
|
2855
|
+
start(request: StartLaunchRequest): Promise<{
|
|
2856
|
+
launchRunId: string;
|
|
2857
|
+
}>;
|
|
2858
|
+
startPreparedPlan(request: PreparedPlanLaunchRequest): Promise<{
|
|
2859
|
+
launchRunId: string;
|
|
2860
|
+
process: ProcessInstance | null;
|
|
2861
|
+
error: string | null;
|
|
2862
|
+
}>;
|
|
2863
|
+
startProgrammatic(request: ProgrammaticLaunchRequestLike, opts: {
|
|
2864
|
+
idempotencyKey: string;
|
|
2865
|
+
actor: Actor;
|
|
2866
|
+
}): Promise<ProgrammaticLaunchResultLike>;
|
|
2867
|
+
startWatcher<TConfig, TEvent>(watcher: RegisteredProcessWatcherLike<TConfig, TEvent>, event: TEvent, request: {
|
|
2868
|
+
idempotencyKey: string;
|
|
2869
|
+
actor: Actor;
|
|
2870
|
+
}): Promise<{
|
|
2871
|
+
launchRunId: string;
|
|
2872
|
+
process: ProcessInstance | null;
|
|
2873
|
+
error: string | null;
|
|
2874
|
+
}>;
|
|
2875
|
+
retryStartup(instanceId: string, actor: Actor): Promise<{
|
|
2876
|
+
launchRunId: string;
|
|
2877
|
+
}>;
|
|
2878
|
+
get(launchRunId: string): LaunchRun | null;
|
|
2879
|
+
refresh(instanceId: string): LaunchRun | null;
|
|
2880
|
+
reconcileIncomplete(): Promise<void>;
|
|
2881
|
+
}
|
|
2882
|
+
|
|
2883
|
+
type ProcessTitleRepos = Pick<RepositoryBundle, "futureExecutions" | "processes" | "titleJobs">;
|
|
2884
|
+
interface ProcessTitleLogger {
|
|
2885
|
+
warn(message: string, details?: Record<string, unknown>): void;
|
|
2886
|
+
}
|
|
2887
|
+
interface ProcessTitleGenerator {
|
|
2888
|
+
start?(): Promise<void>;
|
|
2889
|
+
queueProcessTitleGeneration(input: {
|
|
2890
|
+
processId: string;
|
|
2891
|
+
launchPlan: ProcessLaunchPlan;
|
|
2892
|
+
launchRunId?: string;
|
|
2893
|
+
}): void;
|
|
2894
|
+
queueFutureExecutionTitleGeneration(input: {
|
|
2895
|
+
futureExecutionId: string;
|
|
2896
|
+
launchPlan: ProcessLaunchPlan;
|
|
2897
|
+
expectedPayloadJson?: string;
|
|
2898
|
+
}): void;
|
|
2899
|
+
close?(): Promise<void>;
|
|
2900
|
+
}
|
|
2901
|
+
interface ProcessTitleProviderOptions {
|
|
2902
|
+
timeoutMs?: number;
|
|
2903
|
+
maxRetries?: number;
|
|
2904
|
+
maxRetryDelayMs: number;
|
|
2905
|
+
}
|
|
2906
|
+
type FutureExecutionTitleApplier = (input: {
|
|
2907
|
+
futureExecutionId: string;
|
|
2908
|
+
expectedPayloadJson: string;
|
|
2909
|
+
title: string;
|
|
2910
|
+
}) => Promise<{
|
|
2911
|
+
kind: "applied";
|
|
2912
|
+
} | {
|
|
2913
|
+
kind: "applied_with_reaction_error";
|
|
2914
|
+
error: string;
|
|
2915
|
+
code: string;
|
|
2916
|
+
} | {
|
|
2917
|
+
kind: "superseded";
|
|
2918
|
+
} | {
|
|
2919
|
+
kind: "failed";
|
|
2920
|
+
error: string;
|
|
2921
|
+
}>;
|
|
2922
|
+
interface ProcessTitleGeneratorRuntimeDeps {
|
|
2923
|
+
generateTitle(input: {
|
|
2924
|
+
expandedAgentDir: string;
|
|
2925
|
+
provider: string;
|
|
2926
|
+
modelId: string;
|
|
2927
|
+
prompt: string;
|
|
2928
|
+
maxTokens: number;
|
|
2929
|
+
providerOptions: ProcessTitleProviderOptions;
|
|
2930
|
+
}): Promise<string>;
|
|
2931
|
+
defer(work: () => void): {
|
|
2932
|
+
unref?(): void;
|
|
2933
|
+
};
|
|
2934
|
+
now(): Date;
|
|
2935
|
+
pollIntervalMs: number;
|
|
2936
|
+
}
|
|
2937
|
+
declare function normalizeProcessTitle(value: string | null | undefined): string | null;
|
|
2938
|
+
declare function buildProcessTitleSourceFields(launchPlan: ProcessLaunchPlan): ProcessTitleSourceField[];
|
|
2939
|
+
declare function buildProcessTitlePrompt(launchPlan: ProcessLaunchPlan): string | null;
|
|
2940
|
+
declare function createProcessTitleGenerator(options: {
|
|
2941
|
+
config: LeitwerkConfig;
|
|
2942
|
+
repos: ProcessTitleRepos;
|
|
2943
|
+
broadcaster: Broadcaster;
|
|
2944
|
+
logger?: ProcessTitleLogger;
|
|
2945
|
+
runtime?: Partial<ProcessTitleGeneratorRuntimeDeps>;
|
|
2946
|
+
extensionHost?: ExtensionHost;
|
|
2947
|
+
futureExecutionTitleApplier?: FutureExecutionTitleApplier;
|
|
2948
|
+
getLaunchCoordinator?: () => LaunchCoordinator | undefined;
|
|
2949
|
+
}): ProcessTitleGenerator;
|
|
2950
|
+
|
|
2951
|
+
type ProjectUpdatedFrameInput = Extract<DurableWsFrameInput, {
|
|
2952
|
+
type: "project.updated";
|
|
2953
|
+
}>;
|
|
2954
|
+
interface ProjectMutationCommit {
|
|
2955
|
+
project: ProcessProject | null;
|
|
2956
|
+
effects: PostCommitEffect[];
|
|
2957
|
+
}
|
|
2958
|
+
interface ProjectMutationService {
|
|
2959
|
+
create(input: CreateProcessProjectInput): ProcessProject;
|
|
2960
|
+
update(id: string, input: UpdateProcessProjectInput): ProcessProject | null;
|
|
2961
|
+
getById(id: string): ProcessProject | null;
|
|
2962
|
+
getByInstanceAndKey(instanceId: string, key: string): ProcessProject | null;
|
|
2963
|
+
listByInstance(instanceId: string): ProcessProject[];
|
|
2964
|
+
}
|
|
2965
|
+
interface ProjectMutationServiceDeps extends Pick<RepositoryBundle, "projects" | "transaction"> {
|
|
2966
|
+
broadcaster: Broadcaster;
|
|
2967
|
+
onProjectMutated?: (project: ProcessProject) => void;
|
|
2968
|
+
}
|
|
2969
|
+
declare function buildProjectUpdatedFrame(project: ProcessProject): ProjectUpdatedFrameInput;
|
|
2970
|
+
declare function buildProjectUpdatedEffect(project: ProcessProject): PostCommitEffect;
|
|
2971
|
+
declare function commitProjectCreate(deps: Pick<RepositoryBundle, "projects">, input: CreateProcessProjectInput): ProjectMutationCommit & {
|
|
2972
|
+
project: ProcessProject;
|
|
2973
|
+
};
|
|
2974
|
+
declare function commitProjectUpdate(deps: Pick<RepositoryBundle, "projects">, id: string, input: UpdateProcessProjectInput): ProjectMutationCommit;
|
|
2975
|
+
declare function createProjectMutationService(deps: ProjectMutationServiceDeps): ProjectMutationService;
|
|
2976
|
+
|
|
2977
|
+
interface ExternalSourceService extends ExternalSourceServiceLike {
|
|
2978
|
+
currentGenerations(instanceId: string): Array<{
|
|
2979
|
+
id: string;
|
|
2980
|
+
generation: string;
|
|
2981
|
+
}>;
|
|
2982
|
+
drainQueued(instanceId: string): Promise<void>;
|
|
2983
|
+
invalidateArmings(instanceId: string): void;
|
|
2984
|
+
reconcileArmings(instanceId: string): Promise<void>;
|
|
2985
|
+
reconcileAllArmings(): Promise<void>;
|
|
2986
|
+
}
|
|
2987
|
+
|
|
2988
|
+
declare function createSessionTransferHelperRelays(deps: {
|
|
2989
|
+
repos: Pick<RepositoryBundle, "sessionTransfers">;
|
|
2990
|
+
limits: SessionTransferLimits;
|
|
2991
|
+
now?: () => Date;
|
|
2992
|
+
}): {
|
|
2993
|
+
create(input: {
|
|
2994
|
+
instanceId: string;
|
|
2995
|
+
manifest: LeitwerkTransferManifestV1;
|
|
2996
|
+
}): ProcessStateExportHelperRelay;
|
|
2997
|
+
sweep(): void;
|
|
2998
|
+
stop(): void;
|
|
2999
|
+
helperSpec(input: {
|
|
3000
|
+
exportId: string;
|
|
3001
|
+
credential: string;
|
|
3002
|
+
}): {
|
|
3003
|
+
manifest: LeitwerkTransferManifestV1;
|
|
3004
|
+
limits: SessionTransferLimits;
|
|
3005
|
+
} | null;
|
|
3006
|
+
reportHelperPreflight(input: {
|
|
3007
|
+
exportId: string;
|
|
3008
|
+
credential: string;
|
|
3009
|
+
report: unknown;
|
|
3010
|
+
signal?: AbortSignal;
|
|
3011
|
+
}): Promise<boolean>;
|
|
3012
|
+
acceptHelperStream(input: {
|
|
3013
|
+
exportId: string;
|
|
3014
|
+
credential: string;
|
|
3015
|
+
stream: Readable;
|
|
3016
|
+
}): boolean;
|
|
3017
|
+
};
|
|
3018
|
+
type SessionTransferHelperRelays = ReturnType<typeof createSessionTransferHelperRelays>;
|
|
3019
|
+
|
|
3020
|
+
type AttemptAuth = Parameters<RepositoryBundle["sessionTransfers"]["verifyAttempt"]>[0];
|
|
3021
|
+
declare function createSessionTransferService(deps: {
|
|
3022
|
+
repos: Pick<RepositoryBundle, "processes" | "projects" | "leases" | "sessionTransfers" | "transaction">;
|
|
3023
|
+
processOperations: ProcessOperationCoordinator;
|
|
3024
|
+
supervisor: WorkerSupervisor;
|
|
3025
|
+
exporter: ProcessStateExporter;
|
|
3026
|
+
helperRelays: SessionTransferHelperRelays;
|
|
3027
|
+
sessionSource: ProcessSessionSource;
|
|
3028
|
+
config: LeitwerkConfig;
|
|
3029
|
+
limits?: SessionTransferLimits;
|
|
3030
|
+
now?: () => Date;
|
|
3031
|
+
logger?: {
|
|
3032
|
+
warn(details: unknown, message: string): void;
|
|
3033
|
+
};
|
|
3034
|
+
onUpdated?: (attempt: SessionTransferAttempt) => void;
|
|
3035
|
+
isDeletionPending?: (instanceId: string) => boolean;
|
|
3036
|
+
}): {
|
|
3037
|
+
createGrant(instanceId: string): Promise<{
|
|
3038
|
+
kind: "deletion_pending";
|
|
3039
|
+
grantId?: undefined;
|
|
3040
|
+
rawToken?: undefined;
|
|
3041
|
+
expiresAt?: undefined;
|
|
3042
|
+
} | {
|
|
3043
|
+
kind: "not_found";
|
|
3044
|
+
grantId?: undefined;
|
|
3045
|
+
rawToken?: undefined;
|
|
3046
|
+
expiresAt?: undefined;
|
|
3047
|
+
} | {
|
|
3048
|
+
kind: "created";
|
|
3049
|
+
grantId: string;
|
|
3050
|
+
rawToken: string;
|
|
3051
|
+
expiresAt: string;
|
|
3052
|
+
}>;
|
|
3053
|
+
startAttempt(input: {
|
|
3054
|
+
instanceId: string;
|
|
3055
|
+
grantId: string;
|
|
3056
|
+
token: string;
|
|
3057
|
+
}): {
|
|
3058
|
+
kind: "created";
|
|
3059
|
+
attempt: SessionTransferAttempt;
|
|
3060
|
+
} | {
|
|
3061
|
+
kind: "not_found";
|
|
3062
|
+
} | {
|
|
3063
|
+
kind: "busy";
|
|
3064
|
+
};
|
|
3065
|
+
heartbeat(input: AttemptAuth): SessionTransferAttempt | null;
|
|
3066
|
+
openStream(input: AttemptAuth): Transform;
|
|
3067
|
+
cancel(input: AttemptAuth & {
|
|
3068
|
+
code?: string;
|
|
3069
|
+
}): SessionTransferAttempt | null;
|
|
3070
|
+
cancelForWeb(instanceId: string, attemptId: string): SessionTransferAttempt | null;
|
|
3071
|
+
acknowledge(input: AttemptAuth): SessionTransferAttempt | null;
|
|
3072
|
+
activeForProcess(instanceId: string): SessionTransferAttempt | null;
|
|
3073
|
+
revokeProcess(instanceId: string): void;
|
|
3074
|
+
reconcile(): Promise<void>;
|
|
3075
|
+
start(): void;
|
|
3076
|
+
stop(): void;
|
|
3077
|
+
helperSpec: (input: {
|
|
3078
|
+
exportId: string;
|
|
3079
|
+
credential: string;
|
|
3080
|
+
}) => {
|
|
3081
|
+
manifest: LeitwerkTransferManifestV1;
|
|
3082
|
+
limits: SessionTransferLimits;
|
|
3083
|
+
} | null;
|
|
3084
|
+
reportHelperPreflight: (input: {
|
|
3085
|
+
exportId: string;
|
|
3086
|
+
credential: string;
|
|
3087
|
+
report: unknown;
|
|
3088
|
+
signal?: AbortSignal;
|
|
3089
|
+
}) => Promise<boolean>;
|
|
3090
|
+
acceptHelperStream: (input: {
|
|
3091
|
+
exportId: string;
|
|
3092
|
+
credential: string;
|
|
3093
|
+
stream: node_stream.Readable;
|
|
3094
|
+
}) => boolean;
|
|
3095
|
+
};
|
|
3096
|
+
type SessionTransferService = ReturnType<typeof createSessionTransferService>;
|
|
3097
|
+
|
|
3098
|
+
type ProcessDeletionResult = {
|
|
3099
|
+
ok: true;
|
|
3100
|
+
} | {
|
|
3101
|
+
ok: false;
|
|
3102
|
+
kind: "not_found";
|
|
3103
|
+
} | {
|
|
3104
|
+
ok: false;
|
|
3105
|
+
kind: "abort_failed";
|
|
3106
|
+
failure: EngineFailure<void>;
|
|
3107
|
+
} | {
|
|
3108
|
+
ok: false;
|
|
3109
|
+
kind: "cleanup_failed";
|
|
3110
|
+
message: string;
|
|
3111
|
+
};
|
|
3112
|
+
interface ProcessDeletionService {
|
|
3113
|
+
deleteProcess(instanceId: string, actor: Actor): Promise<ProcessDeletionResult>;
|
|
3114
|
+
}
|
|
3115
|
+
|
|
3116
|
+
interface SkillCatalogService {
|
|
3117
|
+
refresh(): Promise<SkillsCatalogResponseBody>;
|
|
3118
|
+
list(): SkillsCatalogResponseBody;
|
|
3119
|
+
detail(repositoryId: string, skillId: string): SkillCatalogDetail | null;
|
|
3120
|
+
installedDetail(skillId: string): InstalledSkillCatalogDetail | null;
|
|
3121
|
+
register(repositoryId: string, skillId: string): string;
|
|
3122
|
+
remove(skillId: string): boolean;
|
|
3123
|
+
}
|
|
3124
|
+
|
|
3125
|
+
type ToolApprovalDecision = {
|
|
3126
|
+
kind: "accepted";
|
|
3127
|
+
} | {
|
|
3128
|
+
kind: "feedback";
|
|
3129
|
+
feedback: string;
|
|
3130
|
+
} | {
|
|
3131
|
+
kind: "declined";
|
|
3132
|
+
};
|
|
3133
|
+
type ToolApprovalRepos = Pick<RepositoryBundle, "processes" | "turnRecords" | "turnStarts" | "toolApprovalRequests" | "transaction">;
|
|
3134
|
+
declare function createToolApprovalGate(input: {
|
|
3135
|
+
repos: ToolApprovalRepos;
|
|
3136
|
+
processOperations: ProcessOperationCoordinator;
|
|
3137
|
+
}): {
|
|
3138
|
+
reconcile: (instanceId: string) => void;
|
|
3139
|
+
review(requestInput: {
|
|
3140
|
+
instanceId: string;
|
|
3141
|
+
turnRecordId: string;
|
|
3142
|
+
toolCallId: string;
|
|
3143
|
+
toolName: string;
|
|
3144
|
+
arguments: Record<string, unknown>;
|
|
3145
|
+
destination?: ProcessToolApprovalDestination;
|
|
3146
|
+
}): Promise<ToolApprovalDecision>;
|
|
3147
|
+
listOpen(instanceId?: string): ProcessToolApprovalRequest[];
|
|
3148
|
+
resolve(instanceId: string, requestId: string, decision: ToolApprovalDecision, actor: Actor): Promise<ProcessToolApprovalRequest | null>;
|
|
3149
|
+
cancelTurn(instanceId: string, turnRecordId: string): number;
|
|
3150
|
+
};
|
|
3151
|
+
type ToolApprovalGate = ReturnType<typeof createToolApprovalGate>;
|
|
3152
|
+
|
|
3153
|
+
interface TokenAuditContext {
|
|
3154
|
+
operation: string;
|
|
3155
|
+
tokenId?: string;
|
|
3156
|
+
actor?: Actor;
|
|
3157
|
+
ownerKind?: "user" | "anonymous";
|
|
3158
|
+
count?: number;
|
|
3159
|
+
}
|
|
3160
|
+
declare module "fastify" {
|
|
3161
|
+
interface FastifyRequest {
|
|
3162
|
+
actor?: Actor;
|
|
3163
|
+
tokenAudit?: TokenAuditContext;
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
|
|
3167
|
+
interface RouteDeps extends Pick<RepositoryBundle, "processes" | "launchRuns" | "projects" | "inputs" | "events" | "turnSummaries" | "futureExecutions" | "skills" | "processSkills" | "handoffDedupKeys" | "leafOutcomeSnapshots" | "questionRequests" | "processRelations" | "toolApprovalRequests" | "turnRecords" | "turnStarts" | "turnAnnotations" | "leases" | "externalWrites" | "transaction"> {
|
|
3168
|
+
startupObservations?: RepositoryBundle["startupObservations"];
|
|
3169
|
+
externalSourceService?: Pick<ExternalSourceService, "currentGenerations">;
|
|
3170
|
+
broadcaster: Broadcaster;
|
|
3171
|
+
processOperations: ProcessOperationCoordinator;
|
|
3172
|
+
processQuestions: ProcessQuestionService;
|
|
3173
|
+
toolApprovalGate: ToolApprovalGate;
|
|
3174
|
+
processGraphs: ProcessGraphRegistry;
|
|
3175
|
+
supervisor?: WorkerSupervisor;
|
|
3176
|
+
processEngine: ProcessEngine;
|
|
3177
|
+
processDeletion: ProcessDeletionService;
|
|
3178
|
+
processActionRegistry?: ProcessActionRegistry;
|
|
3179
|
+
processUiRegistry?: ProcessUiRegistry;
|
|
3180
|
+
extensionHost?: ExtensionHost;
|
|
3181
|
+
launcherService: ProcessLauncherService;
|
|
3182
|
+
launchCoordinator: LaunchCoordinator;
|
|
3183
|
+
launcherRecentValues: LauncherRecentValuesService;
|
|
3184
|
+
launchPlans: ProcessLaunchPlanServiceLike;
|
|
3185
|
+
processTitles?: ProcessTitleGenerator;
|
|
3186
|
+
toolRenderers?: ReadonlyMap<string, ToolCallRendererDefinition>;
|
|
3187
|
+
config?: LeitwerkConfig;
|
|
3188
|
+
sessionReader: ProcessSessionReader;
|
|
3189
|
+
futureExecutionLifecycle: FutureExecutionLifecycle;
|
|
3190
|
+
modelProviderRegistry?: ModelProviderRegistry;
|
|
3191
|
+
modelProviderCredentialStatus?: ModelProviderCredentialStatusResolver;
|
|
3192
|
+
modelStatusCache: ModelStatusCache;
|
|
3193
|
+
processModelPolicy: ServerProcessModelPolicy;
|
|
3194
|
+
processModelSelection: ProcessModelSelectionServiceLike;
|
|
3195
|
+
skillCatalog?: SkillCatalogService;
|
|
3196
|
+
sessionTransferService?: SessionTransferService;
|
|
3197
|
+
}
|
|
3198
|
+
|
|
3199
|
+
interface AppOptions {
|
|
3200
|
+
host?: string;
|
|
3201
|
+
port?: number;
|
|
3202
|
+
config?: LeitwerkConfig;
|
|
3203
|
+
db?: LeitwerkDb;
|
|
3204
|
+
logger?: boolean;
|
|
3205
|
+
extensionCatalog?: ExtensionCatalog | Promise<ExtensionCatalog>;
|
|
3206
|
+
resolvedExtensionEntries?: readonly DiscoveredExtensionEntry[];
|
|
3207
|
+
extensionLoadingStartDir?: string;
|
|
3208
|
+
/** Runtime lane override for extension UI assets. */
|
|
3209
|
+
extensionUiRuntimeLane?: LeitwerkRuntimeLane;
|
|
3210
|
+
/** Pre-provided capabilities injected before extensions are set up (e.g. fake adapters for testing). */
|
|
3211
|
+
preProvidedCapabilities?: readonly ProvidedCapability[];
|
|
3212
|
+
processTitleGenerator?: ProcessTitleGenerator;
|
|
3213
|
+
/** Test/custom seam for supplying a concrete container runner implementation. */
|
|
3214
|
+
workerRunnerRuntime?: {
|
|
3215
|
+
runner: WorkerRunner$1;
|
|
3216
|
+
volume?: ProcessVolume$1;
|
|
3217
|
+
exporter: ProcessStateExporter;
|
|
3218
|
+
webSocketIpc?: WorkerWebSocketIpcManager;
|
|
3219
|
+
};
|
|
3220
|
+
/** Local runner spawn seam for tests/dev only. */
|
|
3221
|
+
localWorkerSpawnImpl?: typeof spawn;
|
|
3222
|
+
/** Test seam shared by local Docker admission and worker startup. */
|
|
3223
|
+
localWorkerDockerPreflightImpl?: (timeoutMs: number) => Promise<void>;
|
|
3224
|
+
/** Credential-store seam. Declared credential providers default unavailable until it is wired. */
|
|
3225
|
+
modelProviderCredentialStatus?: ModelProviderCredentialStatusResolver;
|
|
3226
|
+
}
|
|
3227
|
+
interface AppContext {
|
|
3228
|
+
app: FastifyInstance;
|
|
3229
|
+
db: LeitwerkDb;
|
|
3230
|
+
broadcaster: Broadcaster;
|
|
3231
|
+
config: LeitwerkConfig;
|
|
3232
|
+
deps: RouteDeps;
|
|
3233
|
+
extensionCatalog: ExtensionCatalog;
|
|
3234
|
+
modelProviderRegistry: ModelProviderRegistry;
|
|
3235
|
+
modelProviderServerAdapters: ModelProviderServerAdapterRegistry;
|
|
3236
|
+
modelStatusCache: ModelStatusCache;
|
|
3237
|
+
extensionUiCatalog: ExtensionUiCatalog;
|
|
3238
|
+
processGraphs: ProcessGraphRegistry;
|
|
3239
|
+
extensionHost: ExtensionHost;
|
|
3240
|
+
projectMutations: ProjectMutationService;
|
|
3241
|
+
ipcHandler: IpcHandler;
|
|
3242
|
+
supervisor: WorkerSupervisor;
|
|
3243
|
+
startBackgroundServices(): Promise<void>;
|
|
3244
|
+
stopBackgroundServices(): Promise<void>;
|
|
3245
|
+
isReady(): boolean;
|
|
3246
|
+
}
|
|
3247
|
+
declare function createApp(opts?: AppOptions): Promise<FastifyInstance>;
|
|
3248
|
+
declare function createAppContext(opts?: AppOptions): Promise<AppContext>;
|
|
3249
|
+
|
|
3250
|
+
export { type EnqueueProcessTitleJobInput as $, type AppContext as A, type Broadcaster as B, type CachedModelProfileStatus as C, type CreateModelProviderRegistryInput as D, type ExtensionUiCatalog as E, type CreateModelStatusCacheInput as F, type CreatePendingExternalSourceFireInput as G, type CreateProcessEventInput as H, type CreateProcessHandoffDedupKeyInput as I, type CreateProcessInputInput as J, type CreateProcessInstanceInput as K, type LeitwerkDb as L, type ModelStatusCacheSnapshot as M, type CreateProcessLeafOutcomeSnapshotInput as N, type CreateProcessProjectInput as O, type ProcessEngineDeps as P, type CreateProcessTurnAnnotationInput as Q, type ReadonlyPiSessionTree as R, type SessionSummary as S, type CreateProcessTurnRecordInput as T, type CreateQuestionRequestInput as U, type CreateWorkerLeaseInput as V, type WorkerSupervisor as W, type CredentialCipher as X, DatabaseSchemaMismatchError as Y, type DeferredProcessExtensionEvent as Z, type EngineResult as _, type RepositoryBundle as a, createCredentialCipherFromEnvironment as a$, type ExtensionHost as a0, type ExtensionUiAssetRoot as a1, type ExtensionUiRendererDescriptor as a2, type ExtensionUiRendererLookup as a3, type FutureExecutionOverviewPageQuery as a4, type FutureExecutionOverviewQuery as a5, type FutureExecutionOverviewWindowQuery as a6, type InitializeSchemaOptions as a7, type IpcHandler as a8, type IpcHandlerCallbacks as a9, type UpdateFutureExecutionInput as aA, type UpdatePendingExternalSourceFireInput as aB, type UpdateProcessInstanceInput as aC, type UpdateProcessProjectInput as aD, type UpdateProcessTurnAnnotationInput as aE, type UpdateProcessTurnRecordInput as aF, type UpdateWorkerLeaseInput as aG, type WorkerHandle as aH, type WorkerStorageLayout as aI, type WorkerTreePaths as aJ, buildExtensionUiCatalog as aK, buildProcessTitlePrompt as aL, buildProcessTitleSourceFields as aM, buildProjectUpdatedEffect as aN, buildProjectUpdatedFrame as aO, closeDatabase as aP, commitProjectCreate as aQ, commitProjectUpdate as aR, createAes256GcmCredentialCipher as aS, createAllRepos as aT, createApiTokenRepo as aU, createApp as aV, createAppContext as aW, createAuthLoginFlowRepo as aX, createAuthSessionRepo as aY, createBroadcaster as aZ, createCredentialCipherFromBase64 as a_, type IpcHandlerDeps as aa, type LauncherRecentValue as ab, type ModelProviderCredentialService as ac, type ModelProviderRegistry as ad, type ModelProviderServerAdapterRegistry as ae, type ModelStatusCache as af, PROVIDER_CREDENTIAL_KEY_ENV as ag, type PendingExternalSourceFire as ah, type ProcessHandoffDedupKeyRecord as ai, type ProcessLaunchIntent as aj, type ProcessOverviewQuery as ak, type ProcessOverviewStatusFilter as al, type ProcessOverviewWindowQuery as am, type ProcessTitleGenerator as an, type ProcessTitleJob as ao, type ProcessTitleLogger as ap, type ProjectMutationService as aq, type ProviderCredentialRecord as ar, type ProviderCredentialUpdateResult as as, type ResolvedProviderCredential as at, type RouteDeps as au, type SessionTransferAttempt as av, type SessionTransferGrant as aw, type SupervisorDeps as ax, type TicketDestinationRecent as ay, type TokenProviderBinding as az, type ServerProcessModelPolicy as b, createDatabase as b0, createExtensionHost as b1, createExternalWriteLogRepo as b2, createFutureExecutionRepo as b3, createInMemoryDatabase as b4, createIpcHandler as b5, createLaunchRunRepo as b6, createLauncherRecentValueRepo as b7, createLocalWorkerStorageLayout as b8, createModelProviderCredentialService as b9, createWorkerLeaseRepo as bA, createWorkerStorageLayout as bB, createWorkerSupervisor as bC, defaultModelProviderCredentialStatus as bD, emitDeferredExtensionEvent as bE, inferExtensionUiAssetContentType as bF, initializeSchema as bG, normalizeProcessTitle as bH, resolveExtensionUiAssetPath as bI, createModelProviderRegistry as ba, createModelProviderServerAdapterRegistry as bb, createModelStatusCache as bc, createPendingExternalSourceFireRepo as bd, createProcessEventRepo as be, createProcessHandoffDedupKeyRepo as bf, createProcessInputRepo as bg, createProcessInstanceRepo as bh, createProcessLeafOutcomeSnapshotRepo as bi, createProcessProjectRepo as bj, createProcessQuestionRequestRepo as bk, createProcessRelationRepo as bl, createProcessSkillRepo as bm, createProcessTitleGenerator as bn, createProcessTitleJobRepo as bo, createProcessToolApprovalRequestRepo as bp, createProcessTurnAnnotationRepo as bq, createProcessTurnRecordRepo as br, createProcessVolumeWorkerStorageLayout as bs, createProjectMutationService as bt, createProviderCredentialRepo as bu, createSessionTransferRepo as bv, createSkillRepo as bw, createTicketDestinationRecentRepo as bx, createTurnStartRecordRepo as by, createUnavailableCredentialCipher as bz, buildProcessActionRegistry as c, createProcessOperationCoordinator as d, type LeitwerkConfig as e, type RegisteredModelProvider as f, type ModelProviderCredentialStatusResolver as g, type PiResourceLayer as h, type PiResourceLimits as i, type ProcessEngine as j, type ProcessActionRegistry as k, type ParkProcessLifecyclePayload as l, type WriteBuildResult as m, type Writes as n, type WorkerIntent as o, type WorkerRuntimeProfileConfig as p, type ActionExecutionResult as q, type ApiTokenOwner as r, type ApiTokenRecord as s, type AppOptions as t, type AuthLoginFlowRecord as u, type AuthSessionRecord as v, type BuiltinPiServerAdapterFactory as w, type CreateExternalWriteLogInput as x, type CreateFutureExecutionInput as y, type CreateLaunchRunInput as z };
|