@leitwerk-dev/server 0.1.9 → 0.2.1
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-7PKX73TU.js +8 -0
- package/dist/app-7PKX73TU.js.map +1 -0
- package/dist/app-WfwKzrVk.d.ts +4869 -0
- package/dist/app.d.ts +58 -12
- 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-DFHOPJRZ.js → chunk-CNITOV76.js} +18382 -16654
- package/dist/chunk-CNITOV76.js.map +1 -0
- package/dist/{chunk-2ESDXLNE.js → chunk-ZSKM25SD.js} +6857 -4531
- package/dist/chunk-ZSKM25SD.js.map +1 -0
- package/dist/config/config-loader.d.ts +11 -0
- package/dist/config/config-loader.d.ts.map +1 -1
- package/dist/config/config-types.d.ts +197 -63
- package/dist/config/config-types.d.ts.map +1 -1
- package/dist/db/api-token-repo.d.ts +57 -0
- package/dist/db/api-token-repo.d.ts.map +1 -0
- package/dist/db/auth-repo.d.ts +30 -0
- package/dist/db/auth-repo.d.ts.map +1 -1
- package/dist/db/credential-cipher.d.ts +8 -3
- package/dist/db/credential-cipher.d.ts.map +1 -1
- package/dist/db/database.d.ts +28 -11
- package/dist/db/database.d.ts.map +1 -1
- package/dist/db/external-write-log-repo.d.ts +8 -6
- package/dist/db/external-write-log-repo.d.ts.map +1 -1
- package/dist/db/future-execution-repo.d.ts +47 -2
- package/dist/db/future-execution-repo.d.ts.map +1 -1
- package/dist/db/launch-run-repo.d.ts +39 -0
- package/dist/db/launch-run-repo.d.ts.map +1 -0
- package/dist/db/launcher-recent-value-repo.d.ts +15 -1
- package/dist/db/launcher-recent-value-repo.d.ts.map +1 -1
- package/dist/db/pending-external-source-fire-repo.d.ts +33 -2
- package/dist/db/pending-external-source-fire-repo.d.ts.map +1 -1
- package/dist/db/process-event-repo.d.ts +21 -0
- package/dist/db/process-event-repo.d.ts.map +1 -1
- package/dist/db/process-handoff-dedup-key-repo.d.ts +10 -5
- package/dist/db/process-handoff-dedup-key-repo.d.ts.map +1 -1
- package/dist/db/process-input-repo.d.ts +17 -2
- package/dist/db/process-input-repo.d.ts.map +1 -1
- package/dist/db/process-instance-repo.d.ts +49 -0
- package/dist/db/process-instance-repo.d.ts.map +1 -1
- package/dist/db/process-leaf-outcome-snapshot-repo.d.ts +18 -0
- package/dist/db/process-leaf-outcome-snapshot-repo.d.ts.map +1 -1
- package/dist/db/process-project-repo.d.ts +21 -7
- package/dist/db/process-project-repo.d.ts.map +1 -1
- package/dist/db/process-question-request-repo.d.ts +19 -0
- package/dist/db/process-question-request-repo.d.ts.map +1 -1
- package/dist/db/process-relation-repo.d.ts +15 -0
- package/dist/db/process-relation-repo.d.ts.map +1 -0
- package/dist/db/process-skill-repo.d.ts +4 -0
- package/dist/db/process-skill-repo.d.ts.map +1 -1
- package/dist/db/process-title-job-repo.d.ts +31 -33
- package/dist/db/process-title-job-repo.d.ts.map +1 -1
- package/dist/db/process-tool-approval-request-repo.d.ts +47 -0
- package/dist/db/process-tool-approval-request-repo.d.ts.map +1 -0
- package/dist/db/process-turn-annotation-repo.d.ts +22 -2
- package/dist/db/process-turn-annotation-repo.d.ts.map +1 -1
- package/dist/db/process-turn-record-repo.d.ts +28 -15
- package/dist/db/process-turn-record-repo.d.ts.map +1 -1
- package/dist/db/provider-credential-repo.d.ts +16 -0
- package/dist/db/provider-credential-repo.d.ts.map +1 -1
- package/dist/db/repo-helpers.d.ts +2 -0
- package/dist/db/repo-helpers.d.ts.map +1 -1
- package/dist/db/repositories.d.ts +55 -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 +112 -0
- package/dist/db/session-transfer-repo.d.ts.map +1 -0
- package/dist/db/skill-repo.d.ts +22 -2
- package/dist/db/skill-repo.d.ts.map +1 -1
- package/dist/db/startup-observation-repo.d.ts +10 -0
- package/dist/db/startup-observation-repo.d.ts.map +1 -0
- package/dist/db/ticket-destination-recent-repo.d.ts +33 -0
- package/dist/db/ticket-destination-recent-repo.d.ts.map +1 -0
- package/dist/db/turn-start-record-repo.d.ts +9 -0
- package/dist/db/turn-start-record-repo.d.ts.map +1 -1
- package/dist/db/turn-summary-repo.d.ts +43 -0
- package/dist/db/turn-summary-repo.d.ts.map +1 -0
- package/dist/db/worker-lease-repo.d.ts +37 -1
- 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 +33 -6
- package/dist/effects/post-commit-effect.d.ts.map +1 -1
- package/dist/effects/post-commit-runner.d.ts +1 -0
- package/dist/effects/post-commit-runner.d.ts.map +1 -1
- package/dist/entry-ref-patch.d.ts +11 -0
- package/dist/entry-ref-patch.d.ts.map +1 -0
- package/dist/extension-ui/catalog.d.ts +20 -25
- package/dist/extension-ui/catalog.d.ts.map +1 -1
- package/dist/extensions/extension-host.d.ts +6 -0
- package/dist/extensions/extension-host.d.ts.map +1 -1
- package/dist/external-source-reporting.d.ts +4 -0
- package/dist/external-source-reporting.d.ts.map +1 -0
- package/dist/external-source-service.d.ts +13 -1
- package/dist/external-source-service.d.ts.map +1 -1
- package/dist/future-execution/execution.d.ts +26 -3
- 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 +212 -0
- package/dist/future-execution/launch-lifecycle.d.ts.map +1 -0
- package/dist/future-execution/lifecycle.d.ts +120 -77
- package/dist/future-execution/lifecycle.d.ts.map +1 -1
- package/dist/future-execution/model-projection.d.ts +6 -0
- package/dist/future-execution/model-projection.d.ts.map +1 -1
- package/dist/future-execution/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/transition-planner.d.ts +25 -0
- package/dist/future-execution/transition-planner.d.ts.map +1 -1
- package/dist/future-execution-presenter.d.ts.map +1 -1
- package/dist/future-execution-scheduler.d.ts +1 -1
- package/dist/future-execution-scheduler.d.ts.map +1 -1
- package/dist/index.d.ts +3 -30
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -29
- package/dist/index.js.map +1 -1
- package/dist/instance-tree.d.ts +3 -0
- package/dist/instance-tree.d.ts.map +1 -1
- package/dist/integration-tool-registry.d.ts +31 -6
- 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 +105 -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 +165 -0
- package/dist/launch-pipeline.d.ts.map +1 -0
- package/dist/launcher-recent-values-service.d.ts +3 -0
- package/dist/launcher-recent-values-service.d.ts.map +1 -1
- 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 +191 -71
- package/dist/main.js.map +1 -1
- package/dist/model-providers/builtin-server-adapter.d.ts +1 -0
- package/dist/model-providers/builtin-server-adapter.d.ts.map +1 -1
- package/dist/model-providers/credentials.d.ts +19 -4
- package/dist/model-providers/credentials.d.ts.map +1 -1
- package/dist/model-providers/model-status-cache.d.ts +30 -1
- package/dist/model-providers/model-status-cache.d.ts.map +1 -1
- package/dist/model-providers/provider-options.d.ts +21 -1
- package/dist/model-providers/provider-options.d.ts.map +1 -1
- package/dist/model-providers/registry.d.ts +22 -2
- package/dist/model-providers/registry.d.ts.map +1 -1
- package/dist/model-providers/server-adapters.d.ts +19 -0
- package/dist/model-providers/server-adapters.d.ts.map +1 -1
- package/dist/physical-worker-starts.d.ts +8 -0
- package/dist/physical-worker-starts.d.ts.map +1 -0
- package/dist/pi-resources/assemble.d.ts +24 -4
- package/dist/pi-resources/assemble.d.ts.map +1 -1
- package/dist/pi-resources/bundle-cache.d.ts +20 -1
- package/dist/pi-resources/bundle-cache.d.ts.map +1 -1
- package/dist/pi-resources/bundle-pin-lifecycle.d.ts +5 -1
- package/dist/pi-resources/bundle-pin-lifecycle.d.ts.map +1 -1
- package/dist/pi-resources/resource-collector.d.ts +12 -0
- package/dist/pi-resources/resource-collector.d.ts.map +1 -1
- package/dist/pi-session-tree.d.ts +13 -1
- package/dist/pi-session-tree.d.ts.map +1 -1
- package/dist/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 +53 -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 +15 -0
- package/dist/process-deletion-service.d.ts.map +1 -1
- package/dist/process-engine/decision.d.ts +12 -0
- package/dist/process-engine/decision.d.ts.map +1 -1
- package/dist/process-engine/engine.d.ts +1 -0
- package/dist/process-engine/engine.d.ts.map +1 -1
- package/dist/process-engine/operation.d.ts +28 -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 +16 -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 +118 -10
- 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 +3 -0
- package/dist/process-engine/writes/build-process-park-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-recovery-start-writes.d.ts +21 -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 +5 -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-failed-writes.d.ts +6 -0
- package/dist/process-engine/writes/build-turn-failed-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-turn-outcome-writes.d.ts +9 -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 +8 -1
- package/dist/process-engine/writes/build-turn-selection-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/commit-writes.d.ts +15 -0
- package/dist/process-engine/writes/commit-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/deferred-extension-events.d.ts +4 -0
- package/dist/process-engine/writes/deferred-extension-events.d.ts.map +1 -1
- package/dist/process-engine/writes/process-plan-collector.d.ts +14 -0
- package/dist/process-engine/writes/process-plan-collector.d.ts.map +1 -0
- package/dist/process-engine/writes/writes.d.ts +67 -0
- package/dist/process-engine/writes/writes.d.ts.map +1 -1
- package/dist/process-execution.d.ts +5 -0
- package/dist/process-execution.d.ts.map +1 -0
- package/dist/process-graph.d.ts +1 -1
- package/dist/process-graph.d.ts.map +1 -1
- package/dist/process-input-dispatch.d.ts +4 -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 +38 -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-policy/types.d.ts +157 -1
- package/dist/process-model-policy/types.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 +3 -0
- 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-question-service.d.ts +36 -20
- package/dist/process-question-service.d.ts.map +1 -1
- package/dist/process-runtime-availability.d.ts +19 -0
- package/dist/process-runtime-availability.d.ts.map +1 -0
- package/dist/process-session-store.d.ts +15 -4
- 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 +56 -0
- package/dist/process-title-generator.d.ts.map +1 -1
- package/dist/process-turn-navigation.d.ts +17 -0
- package/dist/process-turn-navigation.d.ts.map +1 -0
- package/dist/process-turn-trace.d.ts +13 -0
- package/dist/process-turn-trace.d.ts.map +1 -1
- package/dist/process-ui-registry.d.ts +2 -3
- package/dist/process-ui-registry.d.ts.map +1 -1
- package/dist/process-ui-snapshot-presenter.d.ts +96 -18
- package/dist/process-ui-snapshot-presenter.d.ts.map +1 -1
- package/dist/process-watcher-registry.d.ts +5 -0
- package/dist/process-watcher-registry.d.ts.map +1 -1
- package/dist/product-ref-state.d.ts +1 -0
- package/dist/product-ref-state.d.ts.map +1 -1
- package/dist/project-mutation-service.d.ts +19 -0
- package/dist/project-mutation-service.d.ts.map +1 -1
- package/dist/repository-credentials/service.d.ts +2 -2
- package/dist/repository-credentials/service.d.ts.map +1 -1
- package/dist/result-image-store.d.ts +20 -0
- package/dist/result-image-store.d.ts.map +1 -1
- package/dist/routes/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 +43 -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/routes/ui-renderers.d.ts +4 -0
- package/dist/routes/ui-renderers.d.ts.map +1 -1
- package/dist/routes/watchers.d.ts +3 -0
- package/dist/routes/watchers.d.ts.map +1 -1
- package/dist/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 +3 -4
- package/dist/semantic-entry-ref-state.d.ts.map +1 -1
- package/dist/server-bootstrap/app-lifecycle.d.ts +24 -0
- package/dist/server-bootstrap/app-lifecycle.d.ts.map +1 -0
- package/dist/server-bootstrap/build-host-capabilities.d.ts +10 -9
- 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/server-topology.d.ts +8 -1
- package/dist/server-topology.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 +60 -0
- package/dist/session-transfer-helper-relays.d.ts.map +1 -0
- package/dist/session-transfer-service.d.ts +155 -0
- package/dist/session-transfer-service.d.ts.map +1 -0
- package/dist/skills/catalog-service.d.ts +7 -0
- package/dist/skills/catalog-service.d.ts.map +1 -1
- 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 +9 -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 +34 -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 +12 -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 +20 -5
- package/dist/supervisor/worker-start-payload-builder.d.ts.map +1 -1
- package/dist/supervisor/worker-storage-layout.d.ts +13 -0
- package/dist/supervisor/worker-storage-layout.d.ts.map +1 -1
- package/dist/supervisor/worker-supervisor.d.ts +55 -3
- package/dist/supervisor/worker-supervisor.d.ts.map +1 -1
- package/dist/supervisor/worker-turn-ipc-recorder.d.ts +30 -1
- package/dist/supervisor/worker-turn-ipc-recorder.d.ts.map +1 -1
- package/dist/supervisor/worker-unit-reclaimer.d.ts +26 -0
- package/dist/supervisor/worker-unit-reclaimer.d.ts.map +1 -0
- package/dist/supervisor/worker-websocket-ipc.d.ts +37 -0
- package/dist/supervisor/worker-websocket-ipc.d.ts.map +1 -1
- package/dist/test-helpers/accepted-turn-start.d.ts +41 -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/turn-start-preflight-fixtures.d.ts +8 -1
- package/dist/test-helpers/turn-start-preflight-fixtures.d.ts.map +1 -1
- package/dist/test-helpers/unit-deps.d.ts +10 -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 +5 -6
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +360 -6
- package/dist/testing.js.map +1 -1
- package/dist/tool-approval-gate.d.ts +53 -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} +12 -5
- package/dist/turn-result-markdown.d.ts.map +1 -0
- package/dist/worker-runtime-profile-selection.d.ts +22 -7
- package/dist/worker-runtime-profile-selection.d.ts.map +1 -1
- package/dist/ws/broadcast.d.ts +10 -0
- package/dist/ws/broadcast.d.ts.map +1 -1
- package/package.json +13 -14
- package/src/app.ts +974 -755
- 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 +157 -99
- package/src/config/config-types.ts +205 -76
- package/src/db/api-token-repo.ts +123 -0
- package/src/db/auth-repo.ts +39 -16
- package/src/db/credential-cipher.ts +8 -3
- package/src/db/database.ts +506 -70
- package/src/db/external-write-log-repo.ts +7 -6
- package/src/db/future-execution-repo.ts +63 -23
- package/src/db/launch-run-repo.ts +160 -0
- package/src/db/launcher-recent-value-repo.ts +37 -60
- package/src/db/pending-external-source-fire-repo.ts +39 -30
- package/src/db/process-event-repo.ts +137 -56
- package/src/db/process-handoff-dedup-key-repo.ts +10 -6
- package/src/db/process-input-repo.ts +33 -24
- package/src/db/process-instance-repo.ts +76 -40
- package/src/db/process-leaf-outcome-snapshot-repo.ts +20 -16
- package/src/db/process-project-repo.ts +32 -36
- package/src/db/process-question-request-repo.ts +32 -11
- package/src/db/process-relation-repo.ts +62 -0
- package/src/db/process-skill-repo.ts +4 -0
- package/src/db/process-title-job-repo.ts +113 -191
- package/src/db/process-tool-approval-request-repo.ts +168 -0
- package/src/db/process-turn-annotation-repo.ts +28 -21
- package/src/db/process-turn-record-repo.ts +44 -33
- package/src/db/provider-credential-repo.ts +20 -1
- package/src/db/repo-helpers.ts +15 -0
- package/src/db/repositories.ts +70 -4
- package/src/db/schema-ddl.ts +3 -10
- package/src/db/schema.ts +246 -12
- package/src/db/session-transfer-repo.ts +348 -0
- package/src/db/skill-repo.ts +88 -78
- package/src/db/startup-observation-repo.ts +43 -0
- package/src/db/ticket-destination-recent-repo.ts +106 -0
- package/src/db/turn-start-record-repo.ts +12 -1
- package/src/db/turn-summary-repo.ts +95 -0
- package/src/db/worker-lease-repo.ts +79 -12
- package/src/deployment-preflight.ts +10 -6
- 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 +51 -11
- package/src/effects/post-commit-runner.ts +34 -58
- package/src/entry-ref-patch.ts +64 -0
- package/src/extension-ui/catalog.ts +26 -42
- package/src/extensions/extension-host.ts +6 -0
- package/src/external-source-reporting.ts +37 -0
- package/src/external-source-service.ts +278 -301
- package/src/future-execution/execution.ts +168 -64
- package/src/future-execution/index.ts +2 -0
- package/src/future-execution/launch-lifecycle.ts +793 -0
- package/src/future-execution/lifecycle.ts +173 -658
- package/src/future-execution/model-projection.ts +6 -0
- package/src/future-execution/reconciliation.ts +10 -14
- package/src/future-execution/support.ts +20 -0
- package/src/future-execution/transition-planner.ts +25 -0
- package/src/future-execution-presenter.ts +18 -46
- package/src/future-execution-scheduler.ts +7 -6
- package/src/index.ts +5 -157
- package/src/instance-tree.ts +3 -0
- package/src/integration-tool-registry.ts +437 -33
- package/src/launch-coordinator-test-harness.ts +155 -0
- package/src/launch-coordinator.ts +769 -0
- package/src/launch-idempotency.ts +30 -0
- package/src/launch-pipeline.ts +456 -0
- package/src/launcher-recent-values-service.ts +3 -0
- package/src/leaf-outcome-snapshot-capture.ts +2 -20
- package/src/main.ts +3 -10
- package/src/model-providers/builtin-server-adapter.ts +26 -4
- package/src/model-providers/credentials.ts +27 -36
- package/src/model-providers/model-status-cache.ts +72 -71
- package/src/model-providers/provider-options.ts +25 -2
- package/src/model-providers/registry.ts +23 -6
- package/src/model-providers/server-adapters.ts +19 -0
- package/src/physical-worker-starts.ts +64 -0
- package/src/pi-resources/assemble.ts +28 -15
- package/src/pi-resources/bundle-cache.ts +37 -42
- package/src/pi-resources/bundle-pin-lifecycle.ts +14 -13
- package/src/pi-resources/resource-collector.ts +24 -29
- package/src/pi-session-tree.ts +13 -1
- 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 +134 -183
- package/src/process-attention-notifier.ts +2 -8
- package/src/process-deletion-service.ts +69 -35
- package/src/process-engine/decision.ts +12 -0
- package/src/process-engine/engine.ts +17 -25
- package/src/process-engine/operation.ts +29 -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 +33 -48
- package/src/process-engine/turn-start-preflight.ts +2 -14
- package/src/process-engine/types.ts +182 -24
- 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 +14 -14
- package/src/process-engine/writes/build-recovery-start-writes.ts +75 -0
- package/src/process-engine/writes/build-retry-writes.ts +13 -60
- package/src/process-engine/writes/build-server-transition-writes.ts +35 -87
- package/src/process-engine/writes/build-turn-failed-writes.ts +6 -0
- package/src/process-engine/writes/build-turn-outcome-writes.ts +23 -91
- package/src/process-engine/writes/build-turn-selection-writes.ts +31 -75
- package/src/process-engine/writes/commit-writes.ts +34 -8
- package/src/process-engine/writes/deferred-extension-events.ts +4 -0
- package/src/process-engine/writes/process-plan-collector.ts +77 -0
- package/src/process-engine/writes/writes.ts +104 -10
- package/src/process-execution.ts +10 -0
- package/src/process-graph.ts +0 -3
- package/src/process-input-dispatch.ts +3 -12
- package/src/process-instance-tree-presenter.ts +6 -23
- package/src/process-launch-executor.ts +110 -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-policy/types.ts +195 -11
- package/src/process-model-selection.ts +1 -4
- package/src/process-operation-coordinator.ts +4 -4
- package/src/process-operator-attention.ts +2 -10
- package/src/process-overview-presenter.ts +30 -41
- package/src/process-question-service.ts +53 -11
- package/src/process-runtime-availability.ts +75 -0
- package/src/process-session-store.ts +28 -8
- package/src/process-storage-size.ts +45 -0
- package/src/process-title-generator.ts +127 -26
- package/src/process-turn-navigation.ts +27 -0
- package/src/process-turn-trace.ts +99 -202
- package/src/process-ui-registry.ts +7 -16
- package/src/process-ui-snapshot-presenter.ts +416 -200
- package/src/process-watcher-registry.ts +58 -50
- package/src/product-ref-state.ts +5 -70
- package/src/project-mutation-service.ts +22 -1
- package/src/repository-credentials/service.ts +40 -9
- package/src/result-image-store.ts +27 -2
- 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 +84 -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/routes/ui-renderers.ts +4 -0
- package/src/routes/watchers.ts +3 -0
- package/src/scheduled-action-preflight.ts +1 -1
- package/src/semantic-entry-ref-state.ts +6 -85
- package/src/server-bootstrap/app-lifecycle.ts +150 -0
- 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/server-topology.ts +8 -1
- package/src/session-summary-projection.ts +110 -0
- package/src/session-transfer-helper-relays.ts +232 -0
- package/src/session-transfer-service.ts +507 -0
- package/src/skills/catalog-service.ts +7 -0
- package/src/skills/invocation-detector.ts +1 -6
- package/src/skills/skill-frontmatter.ts +9 -5
- package/src/skills/source-importer.ts +40 -16
- package/src/startup-evidence.ts +370 -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 +80 -55
- 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 +83 -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 +121 -77
- package/src/supervisor/worker-storage-layout.ts +20 -1
- package/src/supervisor/worker-supervisor.ts +352 -214
- package/src/supervisor/worker-turn-ipc-recorder.ts +119 -58
- package/src/supervisor/worker-unit-reclaimer.ts +139 -0
- package/src/supervisor/worker-websocket-ipc.ts +63 -23
- package/src/test-helpers/accepted-turn-start.ts +105 -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/turn-start-preflight-fixtures.ts +8 -1
- package/src/test-helpers/unit-deps.ts +33 -1
- package/src/test-helpers/worker-runner-runtime.ts +32 -0
- package/src/testing.ts +5 -19
- package/src/tool-approval-gate.ts +145 -0
- package/src/turn-preparation.ts +53 -0
- package/src/turn-progress.ts +43 -27
- package/src/turn-result-markdown.ts +104 -0
- package/src/worker-runtime-profile-selection.ts +39 -14
- package/src/ws/broadcast.ts +20 -1
- 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
package/src/app.ts
CHANGED
|
@@ -15,9 +15,12 @@ import type {
|
|
|
15
15
|
ServerExtensionEventMap,
|
|
16
16
|
} from "@leitwerk-dev/process-sdk";
|
|
17
17
|
import type { ModelProfileSnapshot } from "@leitwerk-dev/protocol";
|
|
18
|
-
import {
|
|
18
|
+
import { DEFAULT_SESSION_TRANSFER_LIMITS } from "@leitwerk-dev/session-transfer";
|
|
19
|
+
import { createPollingCoordinator, parseDurationMs } from "@leitwerk-dev/watcher-utils";
|
|
19
20
|
import {
|
|
20
21
|
cleanupRetainedProcessVolumes,
|
|
22
|
+
type ProcessStateExporter,
|
|
23
|
+
type ProcessStateExportHelperRelayProvider,
|
|
21
24
|
type ProcessVolume,
|
|
22
25
|
planProcessVolumeRetentionCleanup,
|
|
23
26
|
type WorkerRunner,
|
|
@@ -44,6 +47,8 @@ import {
|
|
|
44
47
|
createIntegrationToolRequestService,
|
|
45
48
|
IntegrationToolRegistry,
|
|
46
49
|
} from "./integration-tool-registry.js";
|
|
50
|
+
import { createLaunchCoordinator, type LaunchCoordinator } from "./launch-coordinator.js";
|
|
51
|
+
import { createLaunchPipeline } from "./launch-pipeline.js";
|
|
47
52
|
import { createLauncherModelConfigService } from "./launcher-model-config-service.js";
|
|
48
53
|
import { createLauncherRecentValuesService } from "./launcher-recent-values-service.js";
|
|
49
54
|
import {
|
|
@@ -68,6 +73,7 @@ import { createProcessEngine } from "./process-engine/engine.js";
|
|
|
68
73
|
import { reconcileProcessesOnStartup } from "./process-engine/startup-reconciliation.js";
|
|
69
74
|
import { prepareCreatedTurnStarts } from "./process-engine/turn-start-preflight.js";
|
|
70
75
|
import type { ProcessGraphRegistry } from "./process-graph.js";
|
|
76
|
+
import { createProcessFromLaunchPlan } from "./process-launch-executor.js";
|
|
71
77
|
import { buildProcessLauncherRegistry } from "./process-launcher-registry.js";
|
|
72
78
|
import { recoverModelAvailabilityFailures } from "./process-model-availability-recovery.js";
|
|
73
79
|
import { applyProcessModelAvailabilityTransitions } from "./process-model-availability-transitions.js";
|
|
@@ -77,6 +83,10 @@ import { createProcessModelSelection } from "./process-model-selection.js";
|
|
|
77
83
|
import { createProcessOperationCoordinator } from "./process-operation-coordinator.js";
|
|
78
84
|
import { listVisibleActionsForProcess as listVisibleOperatorActionsForProcess } from "./process-operator-attention.js";
|
|
79
85
|
import { createProcessQuestionService } from "./process-question-service.js";
|
|
86
|
+
import {
|
|
87
|
+
assertProcessRuntimeAvailable,
|
|
88
|
+
resolveKubernetesDockerConfig,
|
|
89
|
+
} from "./process-runtime-availability.js";
|
|
80
90
|
import {
|
|
81
91
|
createFileBackedProcessSessionSnapshotStore,
|
|
82
92
|
ProcessSessionReader,
|
|
@@ -95,12 +105,17 @@ import {
|
|
|
95
105
|
import { RepositoryCredentialService } from "./repository-credentials/service.js";
|
|
96
106
|
import { ResultImageStore } from "./result-image-store.js";
|
|
97
107
|
import type { RouteDeps } from "./routes/processes.js";
|
|
108
|
+
import { collectCleanupErrors, createAppLifecycle } from "./server-bootstrap/app-lifecycle.js";
|
|
98
109
|
import { buildHostCapabilities } from "./server-bootstrap/build-host-capabilities.js";
|
|
99
110
|
import { loadServerExtensionCatalog } from "./server-bootstrap/load-extension-catalog.js";
|
|
100
111
|
import { registerHttp } from "./server-bootstrap/register-http.js";
|
|
101
112
|
import { registerWebsocket } from "./server-bootstrap/register-websocket.js";
|
|
102
113
|
import { resolveServerTlsOptions } from "./server-topology.js";
|
|
114
|
+
import { createProjectedSessionSnapshotStore } from "./session-summary-projection.js";
|
|
115
|
+
import { createSessionTransferHelperRelays } from "./session-transfer-helper-relays.js";
|
|
116
|
+
import { createSessionTransferService } from "./session-transfer-service.js";
|
|
103
117
|
import { createSkillCatalogService } from "./skills/catalog-service.js";
|
|
118
|
+
import { createDiagnosticTraceWriter } from "./supervisor/diagnostic-trace-writer.js";
|
|
104
119
|
import { createIpcHandler, type IpcHandler } from "./supervisor/ipc-handler.js";
|
|
105
120
|
import { startStaleHeartbeatWatchdog } from "./supervisor/stale-heartbeat-watchdog.js";
|
|
106
121
|
import { createWorkerSupervisor, type WorkerSupervisor } from "./supervisor/worker-supervisor.js";
|
|
@@ -108,52 +123,102 @@ import {
|
|
|
108
123
|
createWorkerWebSocketIpcManager,
|
|
109
124
|
type WorkerWebSocketIpcManager,
|
|
110
125
|
} from "./supervisor/worker-websocket-ipc.js";
|
|
126
|
+
import { createToolApprovalGate } from "./tool-approval-gate.js";
|
|
127
|
+
import { defaultWorkerRuntimeProfile } from "./worker-runtime-profile-selection.js";
|
|
111
128
|
import { type Broadcaster, createBroadcaster } from "./ws/broadcast.js";
|
|
112
129
|
|
|
130
|
+
/** @public */
|
|
113
131
|
export interface AppOptions {
|
|
114
|
-
|
|
115
|
-
port?: number;
|
|
132
|
+
/** @public */
|
|
116
133
|
config?: LeitwerkConfig;
|
|
134
|
+
/** @internal */
|
|
117
135
|
db?: LeitwerkDb;
|
|
136
|
+
/** @internal */
|
|
118
137
|
logger?: boolean;
|
|
138
|
+
/** @internal */
|
|
119
139
|
extensionCatalog?: ExtensionCatalog | Promise<ExtensionCatalog>;
|
|
140
|
+
/** @internal */
|
|
120
141
|
resolvedExtensionEntries?: readonly DiscoveredExtensionEntry[];
|
|
142
|
+
/** @public */
|
|
121
143
|
extensionLoadingStartDir?: string;
|
|
122
|
-
/** Runtime lane override for extension UI assets. */
|
|
144
|
+
/** Runtime lane override for extension UI assets. @internal */
|
|
123
145
|
extensionUiRuntimeLane?: LeitwerkRuntimeLane;
|
|
124
|
-
/** Pre-provided capabilities injected before extensions are set up (e.g. fake adapters for testing). */
|
|
146
|
+
/** Pre-provided capabilities injected before extensions are set up (e.g. fake adapters for testing). @internal */
|
|
125
147
|
preProvidedCapabilities?: readonly ProvidedCapability[];
|
|
148
|
+
/** @internal */
|
|
126
149
|
processTitleGenerator?: ProcessTitleGenerator;
|
|
127
|
-
/** Test/custom seam for supplying a concrete container runner implementation. */
|
|
150
|
+
/** Test/custom seam for supplying a concrete container runner implementation. @internal */
|
|
128
151
|
workerRunnerRuntime?: {
|
|
152
|
+
/** @internal */
|
|
129
153
|
runner: WorkerRunner;
|
|
154
|
+
/** @internal */
|
|
130
155
|
volume?: ProcessVolume;
|
|
156
|
+
/** @internal */
|
|
157
|
+
exporter: ProcessStateExporter;
|
|
158
|
+
/** @internal */
|
|
131
159
|
webSocketIpc?: WorkerWebSocketIpcManager;
|
|
132
160
|
};
|
|
133
|
-
/** Local runner spawn seam for tests/dev only. */
|
|
161
|
+
/** Local runner spawn seam for tests/dev only. @public */
|
|
134
162
|
localWorkerSpawnImpl?: typeof spawn;
|
|
135
|
-
/**
|
|
163
|
+
/** Test seam shared by local Docker admission and worker startup. @public */
|
|
164
|
+
localWorkerDockerPreflightImpl?: (timeoutMs: number) => Promise<void>;
|
|
165
|
+
/** Credential-store seam. Declared credential providers default unavailable until it is wired. @internal */
|
|
136
166
|
modelProviderCredentialStatus?: ModelProviderCredentialStatusResolver;
|
|
137
167
|
}
|
|
138
168
|
|
|
169
|
+
/** @public */
|
|
170
|
+
export interface ServerListenOptions {
|
|
171
|
+
/** @public */
|
|
172
|
+
host?: string;
|
|
173
|
+
/** @public */
|
|
174
|
+
port?: number;
|
|
175
|
+
/** Only for unauthenticated loopback fixtures. @public */
|
|
176
|
+
useBoundAddressAsBaseUrl?: boolean;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** @public */
|
|
180
|
+
export interface ServerListenResult {
|
|
181
|
+
/** @public */
|
|
182
|
+
address: string;
|
|
183
|
+
/** @public */
|
|
184
|
+
port: number;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** @public */
|
|
139
188
|
export interface AppContext {
|
|
189
|
+
/** @public */
|
|
140
190
|
app: FastifyInstance;
|
|
191
|
+
/** @internal */
|
|
141
192
|
db: LeitwerkDb;
|
|
193
|
+
/** @internal */
|
|
142
194
|
broadcaster: Broadcaster;
|
|
195
|
+
/** @internal */
|
|
143
196
|
config: LeitwerkConfig;
|
|
197
|
+
/** @public */
|
|
144
198
|
deps: RouteDeps;
|
|
145
|
-
|
|
199
|
+
/** @internal */
|
|
146
200
|
modelProviderRegistry: ModelProviderRegistry;
|
|
201
|
+
/** @internal */
|
|
147
202
|
modelProviderServerAdapters: ModelProviderServerAdapterRegistry;
|
|
203
|
+
/** @internal */
|
|
148
204
|
modelStatusCache: ModelStatusCache;
|
|
205
|
+
/** @internal */
|
|
149
206
|
extensionUiCatalog: ExtensionUiCatalog;
|
|
207
|
+
/** @internal */
|
|
150
208
|
processGraphs: ProcessGraphRegistry;
|
|
209
|
+
/** @internal */
|
|
151
210
|
extensionHost: ExtensionHost;
|
|
211
|
+
/** @internal */
|
|
152
212
|
projectMutations: ProjectMutationService;
|
|
213
|
+
/** @internal */
|
|
153
214
|
ipcHandler: IpcHandler;
|
|
215
|
+
/** @public */
|
|
154
216
|
supervisor: WorkerSupervisor;
|
|
155
|
-
|
|
156
|
-
|
|
217
|
+
/** @public */
|
|
218
|
+
listen(options?: ServerListenOptions): Promise<ServerListenResult>;
|
|
219
|
+
/** @public */
|
|
220
|
+
close(): Promise<void>;
|
|
221
|
+
/** @internal */
|
|
157
222
|
isReady(): boolean;
|
|
158
223
|
}
|
|
159
224
|
|
|
@@ -163,15 +228,29 @@ function createConfiguredDatabase(config: LeitwerkConfig): LeitwerkDb {
|
|
|
163
228
|
: createDatabase({ sqlitePath: config.storage.sqlite_path });
|
|
164
229
|
}
|
|
165
230
|
|
|
231
|
+
function configuredExporterProfile(config: LeitwerkConfig): {
|
|
232
|
+
image: string | undefined;
|
|
233
|
+
imagePullPolicy: string | undefined;
|
|
234
|
+
} {
|
|
235
|
+
const profileId = defaultWorkerRuntimeProfile(config);
|
|
236
|
+
const profile = profileId ? config.worker_runtime_profiles?.[profileId] : undefined;
|
|
237
|
+
return { image: profile?.image, imagePullPolicy: profile?.image_pull_policy };
|
|
238
|
+
}
|
|
239
|
+
|
|
166
240
|
async function createConfiguredWorkerRunnerRuntime(input: {
|
|
167
241
|
config: LeitwerkConfig;
|
|
168
242
|
webSocketIpc: WorkerWebSocketIpcManager;
|
|
169
243
|
provided?: AppOptions["workerRunnerRuntime"];
|
|
244
|
+
helperRelays: ProcessStateExportHelperRelayProvider;
|
|
245
|
+
onVolumePoolError: () => void;
|
|
170
246
|
localWorkerSpawnImpl?: AppOptions["localWorkerSpawnImpl"];
|
|
247
|
+
localWorkerDockerPreflightImpl?: AppOptions["localWorkerDockerPreflightImpl"];
|
|
171
248
|
}): Promise<{
|
|
172
249
|
runner: WorkerRunner;
|
|
173
250
|
volume?: ProcessVolume;
|
|
251
|
+
exporter: ProcessStateExporter;
|
|
174
252
|
webSocketIpc: WorkerWebSocketIpcManager;
|
|
253
|
+
volumePool?: { start(): void; stop(): Promise<void> };
|
|
175
254
|
}> {
|
|
176
255
|
if (input.provided) {
|
|
177
256
|
return {
|
|
@@ -184,7 +263,11 @@ async function createConfiguredWorkerRunnerRuntime(input: {
|
|
|
184
263
|
const created = createLocalWorkerRunner({
|
|
185
264
|
command: input.config.local_worker?.command,
|
|
186
265
|
args: input.config.local_worker?.args,
|
|
266
|
+
processWorkspacesDir: input.config.storage.process_workspaces_dir,
|
|
267
|
+
treeFilesDir: input.config.storage.tree_files_dir,
|
|
268
|
+
allowHostDocker: input.config.local_worker?.allow_host_docker,
|
|
187
269
|
localWorkerSpawnImpl: input.localWorkerSpawnImpl,
|
|
270
|
+
dockerPreflightImpl: input.localWorkerDockerPreflightImpl,
|
|
188
271
|
});
|
|
189
272
|
return { ...created, webSocketIpc: input.webSocketIpc };
|
|
190
273
|
}
|
|
@@ -195,12 +278,17 @@ async function createConfiguredWorkerRunnerRuntime(input: {
|
|
|
195
278
|
import("@leitwerk-dev/worker-runners/kubernetes-client"),
|
|
196
279
|
]);
|
|
197
280
|
const processVolume = input.config.kubernetes?.process_volume;
|
|
281
|
+
const kubernetesDocker = resolveKubernetesDockerConfig(input.config);
|
|
198
282
|
const pod = input.config.kubernetes?.pod;
|
|
283
|
+
const exporterProfile = configuredExporterProfile(input.config);
|
|
199
284
|
const kubernetesClient = createInClusterKubernetesApiClient({
|
|
200
285
|
apiServerUrl: input.config.kubernetes?.api_server_url,
|
|
201
286
|
});
|
|
202
287
|
const created = createKubernetesWorkerRunner({
|
|
203
288
|
client: kubernetesClient,
|
|
289
|
+
preProvision: processVolume?.pre_provision
|
|
290
|
+
? { ...processVolume.pre_provision, onError: input.onVolumePoolError }
|
|
291
|
+
: undefined,
|
|
204
292
|
processNamespacePrefix:
|
|
205
293
|
input.config.kubernetes?.process_namespace_prefix ?? "leitwerk-process-",
|
|
206
294
|
volume: {
|
|
@@ -211,8 +299,13 @@ async function createConfiguredWorkerRunnerRuntime(input: {
|
|
|
211
299
|
? { storageClassName: processVolume.storage_class_name }
|
|
212
300
|
: {}),
|
|
213
301
|
},
|
|
302
|
+
docker: kubernetesDocker,
|
|
214
303
|
serverCaFile: input.config.kubernetes?.server_ca_file,
|
|
215
304
|
serverNamespace: input.config.kubernetes?.server_namespace ?? "leitwerk-system",
|
|
305
|
+
serverUrl: input.config.kubernetes?.server_url,
|
|
306
|
+
exporterImage: exporterProfile.image,
|
|
307
|
+
exporterImagePullPolicy: exporterProfile.imagePullPolicy,
|
|
308
|
+
helperRelays: input.helperRelays,
|
|
216
309
|
imagePullSecretCopies: input.config.kubernetes?.image_pull_secret_copies?.map((copy) => ({
|
|
217
310
|
sourceName: copy.source_name,
|
|
218
311
|
targetName: copy.target_name,
|
|
@@ -237,6 +330,7 @@ async function createConfiguredWorkerRunnerRuntime(input: {
|
|
|
237
330
|
import("@leitwerk-dev/worker-runners/docker-client"),
|
|
238
331
|
]);
|
|
239
332
|
const dockerVolume = input.config.docker?.process_volume;
|
|
333
|
+
const exporterProfile = configuredExporterProfile(input.config);
|
|
240
334
|
const created = createDockerWorkerRunner({
|
|
241
335
|
engine: createDockerEngineHttpClient({
|
|
242
336
|
socket: input.config.docker?.socket ?? "unix:///var/run/docker.sock",
|
|
@@ -247,17 +341,16 @@ async function createConfiguredWorkerRunnerRuntime(input: {
|
|
|
247
341
|
mountPath: dockerVolume?.mount_path ?? "/state",
|
|
248
342
|
},
|
|
249
343
|
defaultNetwork: input.config.docker?.network ?? "leitwerk",
|
|
250
|
-
|
|
344
|
+
privateDaemonIsolation: input.config.docker?.private_daemon?.isolation,
|
|
251
345
|
serverCaFile: input.config.docker?.server_ca_file,
|
|
346
|
+
serverUrl: input.config.docker?.server_url,
|
|
347
|
+
exporterImage: exporterProfile.image,
|
|
348
|
+
helperRelays: input.helperRelays,
|
|
252
349
|
});
|
|
253
350
|
return { ...created, webSocketIpc: input.webSocketIpc };
|
|
254
351
|
}
|
|
255
352
|
|
|
256
|
-
|
|
257
|
-
const ctx = await createAppContext(opts);
|
|
258
|
-
return ctx.app;
|
|
259
|
-
}
|
|
260
|
-
|
|
353
|
+
/** @public */
|
|
261
354
|
export async function createAppContext(opts: AppOptions = {}): Promise<AppContext> {
|
|
262
355
|
const startupStartedAt = performance.now();
|
|
263
356
|
let previousStartupMark = startupStartedAt;
|
|
@@ -295,257 +388,273 @@ export async function createAppContext(opts: AppOptions = {}): Promise<AppContex
|
|
|
295
388
|
);
|
|
296
389
|
previousStartupMark = now;
|
|
297
390
|
};
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
opts.modelProviderCredentialStatus ??
|
|
346
|
-
(modelProviderRegistry.size > 0
|
|
347
|
-
? modelProviderCredentials.status
|
|
348
|
-
: defaultModelProviderCredentialStatus),
|
|
349
|
-
});
|
|
350
|
-
await modelStatusCache.refresh();
|
|
351
|
-
const modelProviderServerAdapters = await createModelProviderServerAdapterRegistry({
|
|
352
|
-
registry: modelProviderRegistry,
|
|
353
|
-
modelProfiles: config.pi.model_profiles,
|
|
354
|
-
credentials: modelProviderCredentials,
|
|
355
|
-
createBuiltinAdapter: (providerId) => createBuiltinPiServerAdapter(providerId),
|
|
356
|
-
});
|
|
357
|
-
const piResourceBundles = createPiResourceBundleCache();
|
|
358
|
-
const piResourceBundlePins = createPiResourceBundlePinReconciler({
|
|
359
|
-
turnStarts: repos.turnStarts,
|
|
360
|
-
turnRecords: repos.turnRecords,
|
|
361
|
-
bundleCache: piResourceBundles,
|
|
362
|
-
});
|
|
363
|
-
markStartup("model_providers");
|
|
364
|
-
|
|
365
|
-
const broadcaster = createBroadcaster();
|
|
366
|
-
const processOperations = createProcessOperationCoordinator();
|
|
367
|
-
const processGraphs = extensionCatalog.processes;
|
|
368
|
-
const processActionRegistry = buildProcessActionRegistry(extensionCatalog);
|
|
369
|
-
const integrationTools = new IntegrationToolRegistry();
|
|
370
|
-
const processUiRegistry = buildProcessUiRegistry(extensionCatalog);
|
|
371
|
-
const processModelPolicy = createServerProcessModelPolicy({
|
|
372
|
-
config,
|
|
373
|
-
processGraphs,
|
|
374
|
-
processActionRegistry,
|
|
375
|
-
});
|
|
376
|
-
const extensionUiCatalog = await buildExtensionUiCatalog(
|
|
377
|
-
extensionCatalog.modules,
|
|
378
|
-
opts.extensionUiRuntimeLane ? { runtimeLane: opts.extensionUiRuntimeLane } : {},
|
|
379
|
-
);
|
|
380
|
-
markStartup("extension_ui_catalog");
|
|
381
|
-
const launcherModelProfiles: LauncherModelProfileSummary[] = config.pi.model_profiles.map(
|
|
382
|
-
(profile: ModelProfileSnapshot): LauncherModelProfileSummary => ({
|
|
383
|
-
id: profile.id,
|
|
384
|
-
provider: profile.provider,
|
|
385
|
-
modelId: profile.model_id,
|
|
386
|
-
thinkingLevel: profile.thinking_level ?? "off",
|
|
387
|
-
}),
|
|
388
|
-
);
|
|
389
|
-
const launcherModelProfilesById = new Map(
|
|
390
|
-
launcherModelProfiles.map((profile) => [profile.id, profile] as const),
|
|
391
|
-
);
|
|
392
|
-
const getModelProfilesForProcess = (processId: string) => {
|
|
393
|
-
return processModelPolicy
|
|
394
|
-
.project({
|
|
395
|
-
kind: "profile_options",
|
|
396
|
-
processId,
|
|
397
|
-
availability: modelStatusCache.snapshot(),
|
|
398
|
-
})
|
|
399
|
-
.map((profile) => launcherModelProfilesById.get(profile.id))
|
|
400
|
-
.filter(
|
|
401
|
-
(
|
|
402
|
-
profile: LauncherModelProfileSummary | undefined,
|
|
403
|
-
): profile is LauncherModelProfileSummary => profile !== undefined,
|
|
391
|
+
let finishCleanup: (() => Promise<void>) | undefined;
|
|
392
|
+
let stopAcquiredWorkers: (() => Promise<void>) | undefined;
|
|
393
|
+
let closeOwnedDatabase: (() => void) | undefined;
|
|
394
|
+
const preCloseCleanup: Array<() => void | Promise<void>> = [];
|
|
395
|
+
try {
|
|
396
|
+
await app.register(cookie);
|
|
397
|
+
markStartup("fastify_plugins");
|
|
398
|
+
const ownsDb = !opts.db;
|
|
399
|
+
const db = opts.db ?? createConfiguredDatabase(config);
|
|
400
|
+
if (ownsDb) closeOwnedDatabase = () => closeDatabase(db);
|
|
401
|
+
preCloseCleanup.push(() => stopAcquiredWorkers?.());
|
|
402
|
+
app.addHook("onClose", async () => {
|
|
403
|
+
await finishCleanup?.();
|
|
404
|
+
});
|
|
405
|
+
markStartup("database");
|
|
406
|
+
const { resolvedExtensionEntries, extensionCatalog } = await loadServerExtensionCatalog({
|
|
407
|
+
config,
|
|
408
|
+
extensionCatalog: opts.extensionCatalog,
|
|
409
|
+
resolvedExtensionEntries: opts.resolvedExtensionEntries,
|
|
410
|
+
extensionLoadingStartDir: opts.extensionLoadingStartDir,
|
|
411
|
+
});
|
|
412
|
+
markStartup("extension_catalog");
|
|
413
|
+
const modelProviderRegistry = createModelProviderRegistry({
|
|
414
|
+
sets: extensionCatalog.modelProviders,
|
|
415
|
+
piContributions: extensionCatalog.piContributions,
|
|
416
|
+
extensionConfig: config.extensions ?? {},
|
|
417
|
+
modelProfiles: config.pi.model_profiles,
|
|
418
|
+
titleModelProfileId: config.pi.process_title_generation.model_profile,
|
|
419
|
+
});
|
|
420
|
+
const credentialCipher = createCredentialCipherFromEnvironment();
|
|
421
|
+
const repos = createAllRepos(db, {
|
|
422
|
+
...(credentialCipher ? { credentialCipher } : {}),
|
|
423
|
+
});
|
|
424
|
+
repos.transaction((transactionRepos) => {
|
|
425
|
+
// Directly configured skills are no longer supported. Deactivate any left by an older release.
|
|
426
|
+
transactionRepos.skills.reconcile([]);
|
|
427
|
+
transactionRepos.skills.backfillDependencies();
|
|
428
|
+
});
|
|
429
|
+
const skillCatalog = createSkillCatalogService({
|
|
430
|
+
repositories: config.skill_repositories ?? [],
|
|
431
|
+
repos,
|
|
432
|
+
});
|
|
433
|
+
await skillCatalog.refresh();
|
|
434
|
+
markStartup("skill_catalog");
|
|
435
|
+
if (!credentialCipher && repos.providerCredentials.count() > 0) {
|
|
436
|
+
throw new Error(
|
|
437
|
+
"Encrypted provider credentials exist but LEITWERK_CREDENTIAL_ENCRYPTION_KEY is unavailable",
|
|
404
438
|
);
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
> = async () => ({
|
|
435
|
-
kind: "failed",
|
|
436
|
-
error: "Future execution lifecycle is not initialized",
|
|
437
|
-
});
|
|
438
|
-
const processTitles: ProcessTitleGenerator | undefined =
|
|
439
|
-
opts.processTitleGenerator ??
|
|
440
|
-
(config.pi.process_title_generation.model_profile === null
|
|
441
|
-
? undefined
|
|
442
|
-
: createProcessTitleGenerator({
|
|
443
|
-
config,
|
|
444
|
-
repos,
|
|
445
|
-
broadcaster,
|
|
446
|
-
extensionHost,
|
|
447
|
-
futureExecutionTitleApplier: (input) => applyGeneratedFutureExecutionTitle(input),
|
|
448
|
-
logger: {
|
|
449
|
-
warn: (message, details) => app.log.warn(details ?? {}, message),
|
|
450
|
-
},
|
|
451
|
-
runtime: {
|
|
452
|
-
generateTitle: ({ prompt, maxTokens, providerOptions }) =>
|
|
453
|
-
modelProviderServerAdapters.generateText({
|
|
454
|
-
profileId: config.pi.process_title_generation.model_profile as string,
|
|
455
|
-
prompt,
|
|
456
|
-
systemPrompt: TITLE_SYSTEM_PROMPT,
|
|
457
|
-
maxTokens,
|
|
458
|
-
request: providerOptions,
|
|
459
|
-
}),
|
|
460
|
-
},
|
|
461
|
-
}));
|
|
439
|
+
}
|
|
440
|
+
const modelProviderCredentials = createModelProviderCredentialService({
|
|
441
|
+
registry: modelProviderRegistry,
|
|
442
|
+
repo: repos.providerCredentials,
|
|
443
|
+
});
|
|
444
|
+
modelProviderCredentials.initialize();
|
|
445
|
+
const modelStatusCache = createModelStatusCache({
|
|
446
|
+
registry: modelProviderRegistry,
|
|
447
|
+
modelProfiles: config.pi.model_profiles,
|
|
448
|
+
credentialStatus:
|
|
449
|
+
opts.modelProviderCredentialStatus ??
|
|
450
|
+
(modelProviderRegistry.size > 0
|
|
451
|
+
? modelProviderCredentials.status
|
|
452
|
+
: defaultModelProviderCredentialStatus),
|
|
453
|
+
});
|
|
454
|
+
await modelStatusCache.refresh();
|
|
455
|
+
const modelProviderServerAdapters = await createModelProviderServerAdapterRegistry({
|
|
456
|
+
registry: modelProviderRegistry,
|
|
457
|
+
modelProfiles: config.pi.model_profiles,
|
|
458
|
+
credentials: modelProviderCredentials,
|
|
459
|
+
createBuiltinAdapter: (providerId) => createBuiltinPiServerAdapter(providerId),
|
|
460
|
+
});
|
|
461
|
+
const piResourceBundles = createPiResourceBundleCache();
|
|
462
|
+
const piResourceBundlePins = createPiResourceBundlePinReconciler({
|
|
463
|
+
turnStarts: repos.turnStarts,
|
|
464
|
+
turnRecords: repos.turnRecords,
|
|
465
|
+
bundleCache: piResourceBundles,
|
|
466
|
+
});
|
|
467
|
+
markStartup("model_providers");
|
|
462
468
|
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
469
|
+
const broadcaster = createBroadcaster();
|
|
470
|
+
const processOperations = createProcessOperationCoordinator();
|
|
471
|
+
const processGraphs = extensionCatalog.processes;
|
|
472
|
+
const processActionRegistry = buildProcessActionRegistry(extensionCatalog);
|
|
473
|
+
const integrationTools = new IntegrationToolRegistry(repos.externalWrites);
|
|
474
|
+
const processUiRegistry = buildProcessUiRegistry(extensionCatalog);
|
|
475
|
+
const processModelPolicy = createServerProcessModelPolicy({
|
|
476
|
+
config,
|
|
477
|
+
processGraphs,
|
|
478
|
+
processActionRegistry,
|
|
479
|
+
});
|
|
480
|
+
const extensionUiCatalog = await buildExtensionUiCatalog(
|
|
481
|
+
extensionCatalog.modules,
|
|
482
|
+
opts.extensionUiRuntimeLane ? { runtimeLane: opts.extensionUiRuntimeLane } : {},
|
|
483
|
+
);
|
|
484
|
+
markStartup("extension_ui_catalog");
|
|
485
|
+
const launcherModelProfiles: LauncherModelProfileSummary[] = config.pi.model_profiles.map(
|
|
486
|
+
(profile: ModelProfileSnapshot): LauncherModelProfileSummary => ({
|
|
487
|
+
id: profile.id,
|
|
488
|
+
provider: profile.provider,
|
|
489
|
+
modelId: profile.model_id,
|
|
490
|
+
thinkingLevel: profile.thinking_level ?? "off",
|
|
491
|
+
}),
|
|
492
|
+
);
|
|
493
|
+
const launcherModelProfilesById = new Map(
|
|
494
|
+
launcherModelProfiles.map((profile) => [profile.id, profile] as const),
|
|
495
|
+
);
|
|
496
|
+
const getModelProfilesForProcess = (processId: string) => {
|
|
497
|
+
return processModelPolicy
|
|
498
|
+
.project({
|
|
499
|
+
kind: "profile_options",
|
|
500
|
+
processId,
|
|
501
|
+
availability: modelStatusCache.snapshot(),
|
|
502
|
+
})
|
|
503
|
+
.map((profile) => launcherModelProfilesById.get(profile.id))
|
|
504
|
+
.filter(
|
|
505
|
+
(
|
|
506
|
+
profile: LauncherModelProfileSummary | undefined,
|
|
507
|
+
): profile is LauncherModelProfileSummary => profile !== undefined,
|
|
508
|
+
);
|
|
509
|
+
};
|
|
510
|
+
const launcherService = buildProcessLauncherRegistry(extensionCatalog, {
|
|
511
|
+
modelProfiles: launcherModelProfiles,
|
|
512
|
+
commitMessages: config.commit_messages,
|
|
513
|
+
getModelProfilesForProcess,
|
|
514
|
+
});
|
|
515
|
+
const processWatcherService = buildProcessWatcherRegistry(extensionCatalog, config, {
|
|
516
|
+
modelProfiles: launcherModelProfiles,
|
|
517
|
+
getModelProfilesForProcess,
|
|
518
|
+
processModelPolicy,
|
|
519
|
+
});
|
|
520
|
+
const workerWebSocketIpc = createWorkerWebSocketIpcManager();
|
|
521
|
+
// This window must open before listen(): workers from the previous server
|
|
522
|
+
// process can reconnect as soon as the socket accepts connections, before
|
|
523
|
+
// startup adoption has registered their worker ids.
|
|
524
|
+
workerWebSocketIpc.setUnknownWorkerConnectionsRetryable(true);
|
|
525
|
+
const serverEpoch = `epoch_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
|
|
526
|
+
const sessionSnapshots = createProjectedSessionSnapshotStore(
|
|
527
|
+
createFileBackedProcessSessionSnapshotStore(config.storage.tree_files_dir),
|
|
528
|
+
repos,
|
|
529
|
+
);
|
|
530
|
+
for (const process of repos.processes.listAll()) await sessionSnapshots.backfill(process.id);
|
|
531
|
+
const sessionReader = new ProcessSessionReader(sessionSnapshots);
|
|
532
|
+
const resultImages = new ResultImageStore({
|
|
533
|
+
rootDir: path.join(config.storage.tree_files_dir, "result-images"),
|
|
534
|
+
});
|
|
535
|
+
const authService = createAuthService({ config, repos });
|
|
536
|
+
await registerWebsocket(app, broadcaster, workerWebSocketIpc, authService);
|
|
537
|
+
const extensionHost = createExtensionHost<ServerExtensionEventMap>();
|
|
538
|
+
let launchCoordinator: LaunchCoordinator | undefined;
|
|
539
|
+
let applyGeneratedFutureExecutionTitle: NonNullable<
|
|
540
|
+
Parameters<typeof createProcessTitleGenerator>[0]["futureExecutionTitleApplier"]
|
|
541
|
+
> = async () => ({
|
|
542
|
+
kind: "failed",
|
|
543
|
+
error: "Future execution lifecycle is not initialized",
|
|
544
|
+
});
|
|
545
|
+
const processTitles: ProcessTitleGenerator | undefined =
|
|
546
|
+
opts.processTitleGenerator ??
|
|
547
|
+
(config.pi.process_title_generation.model_profile === null
|
|
548
|
+
? undefined
|
|
549
|
+
: createProcessTitleGenerator({
|
|
550
|
+
config,
|
|
551
|
+
repos,
|
|
552
|
+
broadcaster,
|
|
553
|
+
extensionHost,
|
|
554
|
+
futureExecutionTitleApplier: (input) => applyGeneratedFutureExecutionTitle(input),
|
|
555
|
+
getLaunchCoordinator: () => launchCoordinator,
|
|
556
|
+
logger: {
|
|
557
|
+
warn: (message, details) => app.log.warn(details ?? {}, message),
|
|
558
|
+
},
|
|
559
|
+
runtime: {
|
|
560
|
+
generateTitle: ({ prompt, maxTokens, providerOptions }) =>
|
|
561
|
+
modelProviderServerAdapters.generateText({
|
|
562
|
+
profileId: config.pi.process_title_generation.model_profile as string,
|
|
563
|
+
prompt,
|
|
564
|
+
systemPrompt: TITLE_SYSTEM_PROMPT,
|
|
565
|
+
maxTokens,
|
|
566
|
+
request: providerOptions,
|
|
567
|
+
}),
|
|
568
|
+
},
|
|
569
|
+
}));
|
|
490
570
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
processes: baseDeps.processes,
|
|
511
|
-
turnStarts: baseDeps.turnStarts,
|
|
512
|
-
commands: processEngine,
|
|
513
|
-
policy: processModelPolicy,
|
|
514
|
-
availability: snapshot,
|
|
515
|
-
cause: "availability_transition",
|
|
516
|
-
profileIds,
|
|
517
|
-
logger: app.log,
|
|
518
|
-
});
|
|
571
|
+
const baseDeps = {
|
|
572
|
+
...repos,
|
|
573
|
+
broadcaster,
|
|
574
|
+
processOperations,
|
|
575
|
+
};
|
|
576
|
+
let invalidateExternalSourceArmings: ((instanceId: string) => void) | null = null;
|
|
577
|
+
const projectMutations = createProjectMutationService({
|
|
578
|
+
projects: baseDeps.projects,
|
|
579
|
+
transaction: baseDeps.transaction,
|
|
580
|
+
broadcaster,
|
|
581
|
+
onProjectMutated: (project) => invalidateExternalSourceArmings?.(project.instanceId),
|
|
582
|
+
});
|
|
583
|
+
const launcherRecentValues = createLauncherRecentValuesService({
|
|
584
|
+
repos: baseDeps,
|
|
585
|
+
launcherService,
|
|
586
|
+
});
|
|
587
|
+
const launchPlans: ProcessLaunchPlanServiceLike = {
|
|
588
|
+
async prepare(launchPlan, opts = {}) {
|
|
589
|
+
return processModelPolicy.prepareLaunchPlan(launchPlan, opts);
|
|
519
590
|
},
|
|
591
|
+
};
|
|
592
|
+
const launcherModelConfigs = createLauncherModelConfigService({
|
|
593
|
+
launcherService,
|
|
594
|
+
launchPlans,
|
|
595
|
+
processModelPolicy,
|
|
596
|
+
modelStatusCache,
|
|
520
597
|
});
|
|
521
|
-
|
|
522
|
-
startHooks.push(() => {
|
|
523
|
-
if (modelProviderRegistry.size === 0) return;
|
|
524
|
-
modelStatusRefreshTimer = setInterval(() => {
|
|
525
|
-
void refreshModelStatusAndApplyTransitions().catch((error: unknown) => {
|
|
526
|
-
app.log.warn({ error }, "Model provider status refresh failed");
|
|
527
|
-
});
|
|
528
|
-
}, 15_000);
|
|
529
|
-
});
|
|
530
|
-
stopHooks.push(() => {
|
|
531
|
-
if (modelStatusRefreshTimer) clearInterval(modelStatusRefreshTimer);
|
|
532
|
-
modelStatusRefreshTimer = null;
|
|
533
|
-
});
|
|
534
|
-
let stopAuthSweep: (() => void) | null = null;
|
|
535
|
-
startHooks.push(() => {
|
|
536
|
-
stopAuthSweep = authService.startExpiredAuthStateSweep();
|
|
537
|
-
});
|
|
538
|
-
stopHooks.push(() => {
|
|
539
|
-
stopAuthSweep?.();
|
|
540
|
-
stopAuthSweep = null;
|
|
541
|
-
});
|
|
598
|
+
const polling = createPollingCoordinator(app.log);
|
|
542
599
|
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
600
|
+
const startHooks: Array<() => void | Promise<void>> = [];
|
|
601
|
+
const stopHooks: Array<() => void | Promise<void>> = [];
|
|
602
|
+
preCloseCleanup.push(async () => {
|
|
603
|
+
const errors = await collectCleanupErrors(stopHooks);
|
|
604
|
+
if (errors.length) throw new AggregateError(errors, "Background service cleanup failed");
|
|
605
|
+
});
|
|
606
|
+
const modelRefreshWork = new Set<Promise<void>>();
|
|
607
|
+
let modelStatusRefreshTimer: NodeJS.Timeout | null = null;
|
|
608
|
+
let futureExecutionLifecycle: FutureExecutionLifecycle;
|
|
609
|
+
async function refreshModelStatusAndApplyTransitions(): Promise<void> {
|
|
610
|
+
const snapshot = await modelStatusCache.refresh();
|
|
611
|
+
await applyProcessModelAvailabilityTransitions({
|
|
612
|
+
snapshot,
|
|
613
|
+
reconcileFutureExecutions: async (profileIds) => {
|
|
614
|
+
await futureExecutionLifecycle.reconcileModelAvailability({
|
|
615
|
+
availability: snapshot,
|
|
616
|
+
profileIds,
|
|
617
|
+
});
|
|
618
|
+
},
|
|
619
|
+
recoverProcesses: async (profileIds) => {
|
|
620
|
+
await recoverModelAvailabilityFailures({
|
|
621
|
+
processes: baseDeps.processes,
|
|
622
|
+
turnStarts: baseDeps.turnStarts,
|
|
623
|
+
commands: processEngine,
|
|
624
|
+
policy: processModelPolicy,
|
|
625
|
+
availability: snapshot,
|
|
626
|
+
cause: "availability_transition",
|
|
627
|
+
profileIds,
|
|
628
|
+
logger: app.log,
|
|
629
|
+
});
|
|
630
|
+
},
|
|
631
|
+
});
|
|
546
632
|
}
|
|
633
|
+
startHooks.push(() => {
|
|
634
|
+
if (modelProviderRegistry.size === 0) return;
|
|
635
|
+
modelStatusRefreshTimer = setInterval(() => {
|
|
636
|
+
const work = refreshModelStatusAndApplyTransitions().catch((error: unknown) => {
|
|
637
|
+
app.log.warn({ error }, "Model provider status refresh failed");
|
|
638
|
+
});
|
|
639
|
+
modelRefreshWork.add(work);
|
|
640
|
+
void work.finally(() => modelRefreshWork.delete(work));
|
|
641
|
+
}, 15_000);
|
|
642
|
+
});
|
|
643
|
+
stopHooks.push(async () => {
|
|
644
|
+
if (modelStatusRefreshTimer) clearInterval(modelStatusRefreshTimer);
|
|
645
|
+
modelStatusRefreshTimer = null;
|
|
646
|
+
await Promise.all(modelRefreshWork);
|
|
647
|
+
});
|
|
648
|
+
let stopAuthSweep: (() => void) | null = null;
|
|
649
|
+
startHooks.push(() => {
|
|
650
|
+
stopAuthSweep = authService.startExpiredAuthStateSweep();
|
|
651
|
+
});
|
|
652
|
+
stopHooks.push(() => {
|
|
653
|
+
stopAuthSweep?.();
|
|
654
|
+
stopAuthSweep = null;
|
|
655
|
+
});
|
|
547
656
|
|
|
548
|
-
|
|
657
|
+
async function reconcileStartup(assertOpen: () => void): Promise<void> {
|
|
549
658
|
if (!supervisor) {
|
|
550
659
|
throw new Error("worker supervisor not initialized");
|
|
551
660
|
}
|
|
@@ -554,6 +663,7 @@ export async function createAppContext(opts: AppOptions = {}): Promise<AppContex
|
|
|
554
663
|
await futureExecutionLifecycle.reconcileModelAvailability({
|
|
555
664
|
availability: modelStatusCache.snapshot(),
|
|
556
665
|
});
|
|
666
|
+
assertOpen();
|
|
557
667
|
await recoverModelAvailabilityFailures({
|
|
558
668
|
processes: baseDeps.processes,
|
|
559
669
|
turnStarts: baseDeps.turnStarts,
|
|
@@ -563,13 +673,16 @@ export async function createAppContext(opts: AppOptions = {}): Promise<AppContex
|
|
|
563
673
|
cause: "startup_reconciliation",
|
|
564
674
|
logger: app.log,
|
|
565
675
|
});
|
|
676
|
+
assertOpen();
|
|
566
677
|
await reconcilePersistedProcessModelIntegrity({
|
|
567
678
|
processes: baseDeps.processes,
|
|
568
679
|
commands: processEngine,
|
|
569
680
|
policy: processModelPolicy,
|
|
570
681
|
logger: app.log,
|
|
571
682
|
});
|
|
683
|
+
assertOpen();
|
|
572
684
|
await supervisor.adoptRegisteredWorkers();
|
|
685
|
+
assertOpen();
|
|
573
686
|
await reconcileProcessesOnStartup({
|
|
574
687
|
config,
|
|
575
688
|
processes: baseDeps.processes,
|
|
@@ -583,536 +696,642 @@ export async function createAppContext(opts: AppOptions = {}): Promise<AppContex
|
|
|
583
696
|
processActionRegistry,
|
|
584
697
|
logger: app.log,
|
|
585
698
|
});
|
|
586
|
-
|
|
699
|
+
assertOpen();
|
|
587
700
|
} finally {
|
|
588
701
|
workerWebSocketIpc.setUnknownWorkerConnectionsRetryable(false);
|
|
589
702
|
}
|
|
590
703
|
}
|
|
591
704
|
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
705
|
+
let supervisor: WorkerSupervisor | undefined;
|
|
706
|
+
let isNewTurnBlocked = (_instanceId: string): boolean => false;
|
|
707
|
+
const afterSuccessHooks = new Set<(instanceId: string) => void | Promise<void>>();
|
|
708
|
+
const toastTtlMs = parseDurationMs(config.server.websocket.toast_ttl, 6_000, {
|
|
709
|
+
allowHours: true,
|
|
710
|
+
});
|
|
711
|
+
const processEngine = createProcessEngine({
|
|
712
|
+
processes: baseDeps.processes,
|
|
713
|
+
events: baseDeps.events,
|
|
714
|
+
futureExecutions: baseDeps.futureExecutions,
|
|
715
|
+
projects: baseDeps.projects,
|
|
716
|
+
inputs: baseDeps.inputs,
|
|
717
|
+
pendingExternalSourceFires: baseDeps.pendingExternalSourceFires,
|
|
718
|
+
leafOutcomeSnapshots: baseDeps.leafOutcomeSnapshots,
|
|
719
|
+
questionRequests: baseDeps.questionRequests,
|
|
720
|
+
turnRecords: baseDeps.turnRecords,
|
|
721
|
+
turnStarts: baseDeps.turnStarts,
|
|
722
|
+
leases: baseDeps.leases,
|
|
723
|
+
turnAnnotations: baseDeps.turnAnnotations,
|
|
724
|
+
transaction: baseDeps.transaction,
|
|
725
|
+
broadcaster,
|
|
726
|
+
config,
|
|
727
|
+
toastTtlMs,
|
|
728
|
+
processOperations,
|
|
729
|
+
getSupervisor: () => supervisor,
|
|
730
|
+
extensionHost,
|
|
731
|
+
processGraphs,
|
|
732
|
+
sessionReader,
|
|
733
|
+
getProcessActionRegistry: () => processActionRegistry,
|
|
734
|
+
getProcessUiRegistry: () => processUiRegistry,
|
|
735
|
+
logger: app.log,
|
|
736
|
+
processModelPolicy,
|
|
737
|
+
getModelAvailabilitySnapshot: () => modelStatusCache.snapshot(),
|
|
738
|
+
afterRecord(process) {
|
|
739
|
+
// The process volume is the durable source for an already-created start.
|
|
740
|
+
// A missing server-cache entry is valid after restart.
|
|
741
|
+
piResourceBundlePins.reconcile(process);
|
|
742
|
+
toolApprovalGate.reconcile(process.id);
|
|
743
|
+
},
|
|
744
|
+
afterSuccessHooks,
|
|
745
|
+
isNewTurnBlocked: (instanceId) => isNewTurnBlocked(instanceId),
|
|
746
|
+
prepareTurnStarts: (process, writes, providerOptions, availabilitySnapshot) =>
|
|
747
|
+
prepareCreatedTurnStarts(
|
|
748
|
+
{
|
|
749
|
+
config,
|
|
750
|
+
registry: modelProviderRegistry,
|
|
751
|
+
modelStatusCache,
|
|
752
|
+
piContributions: extensionCatalog.piContributions,
|
|
753
|
+
bundleCache: piResourceBundles,
|
|
754
|
+
projects: baseDeps.projects,
|
|
755
|
+
processSkills: baseDeps.processSkills,
|
|
756
|
+
},
|
|
757
|
+
process,
|
|
758
|
+
writes,
|
|
759
|
+
providerOptions,
|
|
760
|
+
availabilitySnapshot,
|
|
761
|
+
),
|
|
762
|
+
});
|
|
763
|
+
|
|
764
|
+
const processQuestions = createProcessQuestionService({
|
|
765
|
+
repos: baseDeps,
|
|
766
|
+
processOperations,
|
|
767
|
+
broadcaster,
|
|
768
|
+
getWorkerId: (instanceId) => supervisor?.getWorker(instanceId)?.workerId ?? null,
|
|
769
|
+
sendQuestionResponse: (instanceId, workerId, payload) =>
|
|
770
|
+
supervisor?.questionResponse(instanceId, workerId, payload),
|
|
771
|
+
emitQuestionRequested: (request) =>
|
|
772
|
+
extensionHost
|
|
773
|
+
.emit("question_requested", { instanceId: request.instanceId, request })
|
|
774
|
+
.catch((error) =>
|
|
775
|
+
app.log.error(
|
|
776
|
+
{ error, instanceId: request.instanceId },
|
|
777
|
+
"Question delivery event failed",
|
|
778
|
+
),
|
|
779
|
+
),
|
|
780
|
+
});
|
|
781
|
+
|
|
782
|
+
const toolApprovalGate = createToolApprovalGate({
|
|
783
|
+
repos: baseDeps,
|
|
784
|
+
processOperations,
|
|
785
|
+
});
|
|
786
|
+
const integrationToolRequests = createIntegrationToolRequestService({
|
|
787
|
+
registry: integrationTools,
|
|
788
|
+
repos: baseDeps,
|
|
789
|
+
processActionRegistry,
|
|
790
|
+
toolApprovalGate,
|
|
791
|
+
});
|
|
792
|
+
const diagnosticTraceWriter = createDiagnosticTraceWriter(
|
|
793
|
+
path.join(config.storage.tree_files_dir, "diagnostic-traces"),
|
|
794
|
+
);
|
|
795
|
+
const ipcHandler = createIpcHandler(
|
|
796
|
+
{
|
|
797
|
+
startupObservations: baseDeps.startupObservations,
|
|
798
|
+
processes: baseDeps.processes,
|
|
799
|
+
getLaunchCoordinator: () => launchCoordinator,
|
|
800
|
+
projects: baseDeps.projects,
|
|
801
|
+
inputs: baseDeps.inputs,
|
|
802
|
+
events: baseDeps.events,
|
|
803
|
+
leases: baseDeps.leases,
|
|
804
|
+
turnRecords: baseDeps.turnRecords,
|
|
805
|
+
handleIntegrationToolRequest: (instanceId, payload) =>
|
|
806
|
+
integrationToolRequests.handle(instanceId, payload),
|
|
807
|
+
handleIntegrationToolCancel: (instanceId, payload) =>
|
|
808
|
+
void integrationToolRequests.cancel(instanceId, payload),
|
|
809
|
+
processQuestions,
|
|
810
|
+
broadcaster,
|
|
811
|
+
commands: processEngine,
|
|
812
|
+
updateCredential: ({ providerId, expectedRevision, values }) => {
|
|
813
|
+
const result = modelProviderCredentials.compareAndSet({
|
|
814
|
+
providerId,
|
|
815
|
+
expectedRevision,
|
|
816
|
+
value: values,
|
|
817
|
+
});
|
|
818
|
+
if (result.accepted && !lifecycle.isClosing()) {
|
|
819
|
+
const work = refreshModelStatusAndApplyTransitions().catch((error: unknown) => {
|
|
820
|
+
app.log.warn(
|
|
821
|
+
{ error, providerId },
|
|
822
|
+
"Model status refresh after credential update failed",
|
|
823
|
+
);
|
|
824
|
+
});
|
|
825
|
+
modelRefreshWork.add(work);
|
|
826
|
+
void work.finally(() => modelRefreshWork.delete(work));
|
|
827
|
+
}
|
|
828
|
+
return result;
|
|
829
|
+
},
|
|
830
|
+
appendDiagnosticTrace(instanceId, text) {
|
|
831
|
+
try {
|
|
832
|
+
diagnosticTraceWriter.append(instanceId, text);
|
|
833
|
+
} catch (error) {
|
|
834
|
+
app.log.warn({ error, instanceId }, "Could not append worker diagnostic trace");
|
|
835
|
+
}
|
|
836
|
+
},
|
|
837
|
+
workerEventLogger: config.workers.log_worker_events_to_stdout
|
|
838
|
+
? (entry) => {
|
|
839
|
+
// Worker IPC is WebSocket-only; terminal visibility comes from mirroring
|
|
840
|
+
// worker.event payloads through the server's own logger.
|
|
841
|
+
app.log.info({ source: "worker_event", ...entry }, "worker.event");
|
|
842
|
+
}
|
|
843
|
+
: undefined,
|
|
844
|
+
},
|
|
845
|
+
{
|
|
846
|
+
onTurnTerminalRecorded(instanceId, workerId, turnRecordId) {
|
|
847
|
+
supervisor?.acknowledgeTurnTerminal(instanceId, workerId, { turnRecordId });
|
|
848
|
+
},
|
|
849
|
+
onTurnFailedRecorded(input) {
|
|
850
|
+
app.log.warn(input, "Worker turn failed");
|
|
851
|
+
},
|
|
852
|
+
onTurnTerminalRecordingFailed(input) {
|
|
853
|
+
app.log.error(input, "Worker turn terminal recording failed");
|
|
854
|
+
baseDeps.events.create({
|
|
855
|
+
instanceId: input.instanceId,
|
|
856
|
+
eventType: "worker_terminal_recording_failed",
|
|
857
|
+
data: {
|
|
858
|
+
workerId: input.workerId,
|
|
859
|
+
turnRecordId: input.turnRecordId,
|
|
860
|
+
terminalType: input.terminalType,
|
|
861
|
+
code: input.code,
|
|
862
|
+
message: input.message,
|
|
863
|
+
},
|
|
864
|
+
});
|
|
865
|
+
},
|
|
866
|
+
onWorkerTurnStartAccepted(instanceId, workerId, payload) {
|
|
867
|
+
supervisor?.acceptTurnStart(
|
|
868
|
+
instanceId,
|
|
869
|
+
workerId,
|
|
870
|
+
payload.startRecordId,
|
|
871
|
+
payload.turnRecordId,
|
|
872
|
+
);
|
|
873
|
+
},
|
|
874
|
+
onCredentialUpdateResult(instanceId, workerId, payload) {
|
|
875
|
+
supervisor?.credentialUpdateResult(instanceId, workerId, payload);
|
|
876
|
+
},
|
|
877
|
+
onIntegrationToolResult(instanceId, workerId, payload) {
|
|
878
|
+
supervisor?.integrationToolResult(instanceId, workerId, payload);
|
|
879
|
+
},
|
|
880
|
+
},
|
|
881
|
+
);
|
|
882
|
+
|
|
883
|
+
const repositoryCredentials = new RepositoryCredentialService(extensionCatalog.processes);
|
|
884
|
+
const sessionTransferLimits = config.session_transfer
|
|
885
|
+
? {
|
|
886
|
+
maxEntries: config.session_transfer.max_entries,
|
|
887
|
+
maxLogicalBytes: config.session_transfer.max_logical_bytes,
|
|
888
|
+
maxCompressedBytes: config.session_transfer.max_compressed_bytes,
|
|
889
|
+
}
|
|
890
|
+
: DEFAULT_SESSION_TRANSFER_LIMITS;
|
|
891
|
+
const sessionTransferHelperRelays = createSessionTransferHelperRelays({
|
|
892
|
+
repos: baseDeps,
|
|
893
|
+
limits: sessionTransferLimits,
|
|
894
|
+
});
|
|
895
|
+
const supervisorConfig = config;
|
|
896
|
+
const runnerRuntime = await createConfiguredWorkerRunnerRuntime({
|
|
897
|
+
config: supervisorConfig,
|
|
898
|
+
webSocketIpc: workerWebSocketIpc,
|
|
899
|
+
provided: opts.workerRunnerRuntime,
|
|
900
|
+
helperRelays: sessionTransferHelperRelays,
|
|
901
|
+
onVolumePoolError: () =>
|
|
902
|
+
app.log.warn("Volume pre-provisioning failed; retrying in the background"),
|
|
903
|
+
localWorkerSpawnImpl: opts.localWorkerSpawnImpl,
|
|
904
|
+
localWorkerDockerPreflightImpl: opts.localWorkerDockerPreflightImpl,
|
|
905
|
+
});
|
|
906
|
+
if (runnerRuntime.volumePool) {
|
|
907
|
+
startHooks.push(() => runnerRuntime.volumePool?.start());
|
|
908
|
+
stopHooks.push(() => runnerRuntime.volumePool?.stop());
|
|
909
|
+
}
|
|
910
|
+
markStartup("worker_runner");
|
|
911
|
+
supervisor = createWorkerSupervisor({
|
|
912
|
+
startupObservations: baseDeps.startupObservations,
|
|
913
|
+
config: supervisorConfig,
|
|
914
|
+
processGraphs,
|
|
915
|
+
processActionRegistry,
|
|
916
|
+
processModelPolicy,
|
|
917
|
+
ipcHandler,
|
|
918
|
+
leases: baseDeps.leases,
|
|
919
|
+
getLaunchCoordinator: () => launchCoordinator,
|
|
920
|
+
processes: baseDeps.processes,
|
|
921
|
+
projects: baseDeps.projects,
|
|
922
|
+
inputs: baseDeps.inputs,
|
|
923
|
+
turnRecords: baseDeps.turnRecords,
|
|
924
|
+
turnStarts: baseDeps.turnStarts,
|
|
925
|
+
events: baseDeps.events,
|
|
926
|
+
broadcaster,
|
|
927
|
+
runnerRuntime,
|
|
928
|
+
logger: app.log,
|
|
929
|
+
resolvedExtensionEntriesJson: serializeResolvedExtensionEntries(resolvedExtensionEntries),
|
|
930
|
+
serverEpoch,
|
|
931
|
+
resolveResourceBundle(digest) {
|
|
932
|
+
return piResourceBundles.get(digest);
|
|
933
|
+
},
|
|
934
|
+
resolveRepositoryCredentials: (input) =>
|
|
935
|
+
repositoryCredentials.resolveWorkerCredentials(input),
|
|
936
|
+
integrationTools,
|
|
937
|
+
resolveCredential: (providerId, options) =>
|
|
938
|
+
modelProviderCredentials.resolve(providerId, options),
|
|
939
|
+
});
|
|
940
|
+
|
|
941
|
+
let staleHeartbeatWatchdog: ReturnType<typeof startStaleHeartbeatWatchdog> | null = null;
|
|
942
|
+
let workersClosedForServerShutdown = false;
|
|
943
|
+
stopAcquiredWorkers = async () => {
|
|
944
|
+
if (workersClosedForServerShutdown) return;
|
|
945
|
+
workersClosedForServerShutdown = true;
|
|
946
|
+
if (config.workers.runner === "local") await supervisor?.shutdownAll("server_shutdown");
|
|
947
|
+
else await supervisor?.detachAll("server_shutdown");
|
|
948
|
+
};
|
|
949
|
+
let retentionWork: Promise<void> | undefined;
|
|
950
|
+
let retainedVolumeCleanupTimer: NodeJS.Timeout | null = null;
|
|
951
|
+
let retainedVolumeCleanupRunning = false;
|
|
952
|
+
const releasedRetainedVolumes = new Set<string>();
|
|
953
|
+
async function runRetainedVolumeCleanup(): Promise<void> {
|
|
954
|
+
if (retainedVolumeCleanupRunning) return;
|
|
955
|
+
retainedVolumeCleanupRunning = true;
|
|
956
|
+
const processes = baseDeps.processes.listAll();
|
|
957
|
+
const now = new Date();
|
|
958
|
+
const policy = {
|
|
959
|
+
completedProcessRetention: config.workers.cleanup.completed_process_retention,
|
|
960
|
+
errorProcessRetention: config.workers.cleanup.error_process_retention,
|
|
961
|
+
};
|
|
962
|
+
const expiredImageProcesses = new Set(
|
|
963
|
+
planProcessVolumeRetentionCleanup({ processes, now, policy }),
|
|
964
|
+
);
|
|
965
|
+
try {
|
|
966
|
+
const released = await cleanupRetainedProcessVolumes({
|
|
967
|
+
volume: runnerRuntime.volume,
|
|
968
|
+
processes,
|
|
969
|
+
now,
|
|
970
|
+
policy,
|
|
971
|
+
alreadyReleased: releasedRetainedVolumes,
|
|
972
|
+
});
|
|
973
|
+
for (const instanceId of released) releasedRetainedVolumes.add(instanceId);
|
|
974
|
+
} catch (error) {
|
|
975
|
+
app.log.warn({ error }, "retained process volume cleanup failed");
|
|
596
976
|
}
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
977
|
+
try {
|
|
978
|
+
await resultImages.cleanupProcesses({
|
|
979
|
+
// Refresh after volume cleanup so a process created during the sweep is
|
|
980
|
+
// never mistaken for an orphan.
|
|
981
|
+
retainedInstanceIds: new Set(baseDeps.processes.listAll().map((process) => process.id)),
|
|
982
|
+
expiredInstanceIds: expiredImageProcesses,
|
|
983
|
+
});
|
|
984
|
+
} catch (error) {
|
|
985
|
+
app.log.warn({ error }, "retained result image cleanup failed");
|
|
986
|
+
} finally {
|
|
987
|
+
retainedVolumeCleanupRunning = false;
|
|
603
988
|
}
|
|
604
|
-
throw error;
|
|
605
989
|
}
|
|
606
|
-
|
|
990
|
+
startHooks.push(() => {
|
|
991
|
+
if (!supervisor) {
|
|
992
|
+
throw new Error("worker supervisor not initialized");
|
|
993
|
+
}
|
|
994
|
+
retentionWork = runRetainedVolumeCleanup();
|
|
995
|
+
const cleanupIntervalMs = Math.max(
|
|
996
|
+
60_000,
|
|
997
|
+
parseDurationMs(config.workers.cleanup.transient_ttl, 3_600_000, { allowHours: true }),
|
|
998
|
+
);
|
|
999
|
+
retainedVolumeCleanupTimer = setInterval(() => {
|
|
1000
|
+
if (!retainedVolumeCleanupRunning) retentionWork = runRetainedVolumeCleanup();
|
|
1001
|
+
}, cleanupIntervalMs);
|
|
1002
|
+
staleHeartbeatWatchdog = startStaleHeartbeatWatchdog({
|
|
1003
|
+
leases: baseDeps.leases,
|
|
1004
|
+
processes: baseDeps.processes,
|
|
1005
|
+
turnRecords: baseDeps.turnRecords,
|
|
1006
|
+
turnStarts: baseDeps.turnStarts,
|
|
1007
|
+
ipcHandler,
|
|
1008
|
+
supervisor,
|
|
1009
|
+
staleHeartbeatTimeout: config.workers.stale_heartbeat_timeout,
|
|
1010
|
+
});
|
|
1011
|
+
});
|
|
1012
|
+
stopHooks.push(async () => {
|
|
1013
|
+
staleHeartbeatWatchdog?.stop();
|
|
1014
|
+
staleHeartbeatWatchdog = null;
|
|
1015
|
+
if (retainedVolumeCleanupTimer) {
|
|
1016
|
+
clearInterval(retainedVolumeCleanupTimer);
|
|
1017
|
+
retainedVolumeCleanupTimer = null;
|
|
1018
|
+
}
|
|
1019
|
+
await retentionWork;
|
|
1020
|
+
});
|
|
607
1021
|
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
if (!backgroundServicesStarted) {
|
|
611
|
-
return;
|
|
1022
|
+
if (processTitles?.start) {
|
|
1023
|
+
startHooks.push(() => processTitles.start?.());
|
|
612
1024
|
}
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
await hook();
|
|
1025
|
+
if (processTitles?.close) {
|
|
1026
|
+
stopHooks.push(() => processTitles.close?.());
|
|
616
1027
|
}
|
|
617
|
-
}
|
|
618
1028
|
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
futureExecutions: baseDeps.futureExecutions,
|
|
628
|
-
projects: baseDeps.projects,
|
|
629
|
-
inputs: baseDeps.inputs,
|
|
630
|
-
pendingExternalSourceFires: baseDeps.pendingExternalSourceFires,
|
|
631
|
-
leafOutcomeSnapshots: baseDeps.leafOutcomeSnapshots,
|
|
632
|
-
questionRequests: baseDeps.questionRequests,
|
|
633
|
-
turnRecords: baseDeps.turnRecords,
|
|
634
|
-
turnStarts: baseDeps.turnStarts,
|
|
635
|
-
leases: baseDeps.leases,
|
|
636
|
-
turnAnnotations: baseDeps.turnAnnotations,
|
|
637
|
-
transaction: baseDeps.transaction,
|
|
638
|
-
broadcaster,
|
|
639
|
-
config,
|
|
640
|
-
toastTtlMs,
|
|
641
|
-
processOperations,
|
|
642
|
-
getSupervisor: () => supervisor,
|
|
643
|
-
extensionHost,
|
|
644
|
-
processGraphs,
|
|
645
|
-
sessionReader,
|
|
646
|
-
getProcessActionRegistry: () => processActionRegistry,
|
|
647
|
-
getProcessUiRegistry: () => processUiRegistry,
|
|
648
|
-
logger: app.log,
|
|
649
|
-
processModelPolicy,
|
|
650
|
-
getModelAvailabilitySnapshot: () => modelStatusCache.snapshot(),
|
|
651
|
-
afterRecord(process) {
|
|
652
|
-
const { missingDigest } = piResourceBundlePins.reconcile(process);
|
|
653
|
-
if (missingDigest) {
|
|
654
|
-
throw new Error(`Pi resource bundle '${missingDigest}' is unavailable after commit`);
|
|
655
|
-
}
|
|
656
|
-
},
|
|
657
|
-
afterSuccessHooks,
|
|
658
|
-
prepareTurnStarts: (process, writes, providerOptions, availabilitySnapshot) =>
|
|
659
|
-
prepareCreatedTurnStarts(
|
|
1029
|
+
const launchPipeline = createLaunchPipeline({
|
|
1030
|
+
launchRuns: baseDeps.launchRuns,
|
|
1031
|
+
broadcaster,
|
|
1032
|
+
titleGenerationAvailable: Boolean(processTitles),
|
|
1033
|
+
logger: app.log,
|
|
1034
|
+
});
|
|
1035
|
+
const assertRuntimeAvailable = (processId: string) =>
|
|
1036
|
+
assertProcessRuntimeAvailable(
|
|
660
1037
|
{
|
|
661
1038
|
config,
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
piContributions: extensionCatalog.piContributions,
|
|
665
|
-
bundleCache: piResourceBundles,
|
|
666
|
-
projects: baseDeps.projects,
|
|
667
|
-
processSkills: baseDeps.processSkills,
|
|
1039
|
+
processes: extensionCatalog.processes,
|
|
1040
|
+
dockerInfo: opts.localWorkerDockerPreflightImpl,
|
|
668
1041
|
},
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
.emit("question_requested", { instanceId: request.instanceId, request })
|
|
686
|
-
.catch((error) =>
|
|
687
|
-
app.log.error(
|
|
688
|
-
{ error, instanceId: request.instanceId },
|
|
689
|
-
"Question delivery event failed",
|
|
690
|
-
),
|
|
691
|
-
),
|
|
692
|
-
});
|
|
693
|
-
|
|
694
|
-
const integrationToolRequests = createIntegrationToolRequestService({
|
|
695
|
-
registry: integrationTools,
|
|
696
|
-
repos: baseDeps,
|
|
697
|
-
processActionRegistry,
|
|
698
|
-
});
|
|
699
|
-
const ipcHandler = createIpcHandler(
|
|
700
|
-
{
|
|
1042
|
+
processId,
|
|
1043
|
+
);
|
|
1044
|
+
const processLaunchDeps = {
|
|
1045
|
+
...baseDeps,
|
|
1046
|
+
broadcaster,
|
|
1047
|
+
commands: processEngine,
|
|
1048
|
+
processTitles,
|
|
1049
|
+
extensionHost,
|
|
1050
|
+
logger: app.log,
|
|
1051
|
+
repositoryCredentials,
|
|
1052
|
+
getSupervisor: () => supervisor,
|
|
1053
|
+
assertRuntimeAvailable,
|
|
1054
|
+
};
|
|
1055
|
+
const createProcess = createProcessFromLaunchPlan.bind(null, processLaunchDeps);
|
|
1056
|
+
futureExecutionLifecycle = createFutureExecutionLifecycle({
|
|
1057
|
+
futureExecutions: baseDeps.futureExecutions,
|
|
701
1058
|
processes: baseDeps.processes,
|
|
702
1059
|
projects: baseDeps.projects,
|
|
703
|
-
|
|
1060
|
+
processRelations: baseDeps.processRelations,
|
|
1061
|
+
handoffDedupKeys: baseDeps.handoffDedupKeys,
|
|
1062
|
+
turnRecords: baseDeps.turnRecords,
|
|
1063
|
+
skills: baseDeps.skills,
|
|
1064
|
+
processSkills: baseDeps.processSkills,
|
|
1065
|
+
transaction: baseDeps.transaction,
|
|
1066
|
+
broadcaster,
|
|
1067
|
+
commands: processEngine,
|
|
1068
|
+
processOperations,
|
|
1069
|
+
processTitles,
|
|
1070
|
+
extensionHost,
|
|
1071
|
+
launcherService,
|
|
1072
|
+
launcherRecentValues,
|
|
1073
|
+
processGraphs,
|
|
1074
|
+
processActionRegistry: processActionRegistry ?? undefined,
|
|
1075
|
+
processModelPolicy,
|
|
1076
|
+
launchPlans,
|
|
1077
|
+
modelStatusCache,
|
|
1078
|
+
launchPipeline,
|
|
1079
|
+
assertRuntimeAvailable,
|
|
1080
|
+
logger: app.log,
|
|
1081
|
+
});
|
|
1082
|
+
applyGeneratedFutureExecutionTitle = (input) =>
|
|
1083
|
+
futureExecutionLifecycle.applyGeneratedFutureLaunchTitleIfUnchanged(input);
|
|
1084
|
+
launchCoordinator = createLaunchCoordinator({
|
|
704
1085
|
events: baseDeps.events,
|
|
1086
|
+
commands: processEngine,
|
|
1087
|
+
launchRuns: baseDeps.launchRuns,
|
|
1088
|
+
processes: baseDeps.processes,
|
|
705
1089
|
leases: baseDeps.leases,
|
|
706
1090
|
turnRecords: baseDeps.turnRecords,
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
1091
|
+
turnStarts: baseDeps.turnStarts,
|
|
1092
|
+
titleJobs: baseDeps.titleJobs,
|
|
1093
|
+
launcherService,
|
|
1094
|
+
futureExecutionLifecycle,
|
|
1095
|
+
launchPipeline,
|
|
1096
|
+
launchPlans,
|
|
1097
|
+
createProcessFromLaunchPlan: createProcess,
|
|
1098
|
+
titleGenerationAvailable: Boolean(processTitles),
|
|
1099
|
+
logger: app.log,
|
|
1100
|
+
});
|
|
1101
|
+
startHooks.push(() => launchCoordinator?.reconcileIncomplete());
|
|
1102
|
+
const futureExecutionScheduler = startFutureExecutionScheduler(futureExecutionLifecycle);
|
|
1103
|
+
startHooks.push(() => futureExecutionScheduler.start());
|
|
1104
|
+
stopHooks.push(() => futureExecutionScheduler.stop());
|
|
1105
|
+
const externalSourceService = createExternalSourceService({
|
|
1106
|
+
events: baseDeps.events,
|
|
1107
|
+
processes: baseDeps.processes,
|
|
1108
|
+
projects: baseDeps.projects,
|
|
1109
|
+
pendingExternalSourceFires: baseDeps.pendingExternalSourceFires,
|
|
713
1110
|
commands: processEngine,
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
baseDeps.events.create({
|
|
745
|
-
instanceId: input.instanceId,
|
|
746
|
-
eventType: "worker_terminal_recording_failed",
|
|
747
|
-
data: {
|
|
748
|
-
workerId: input.workerId,
|
|
749
|
-
turnRecordId: input.turnRecordId,
|
|
750
|
-
terminalType: input.terminalType,
|
|
751
|
-
code: input.code,
|
|
752
|
-
message: input.message,
|
|
753
|
-
},
|
|
754
|
-
});
|
|
755
|
-
},
|
|
756
|
-
onWorkerTurnStartAccepted(instanceId, workerId, payload) {
|
|
757
|
-
supervisor?.acceptTurnStart(
|
|
758
|
-
instanceId,
|
|
759
|
-
workerId,
|
|
760
|
-
payload.startRecordId,
|
|
761
|
-
payload.turnRecordId,
|
|
1111
|
+
processActionRegistry,
|
|
1112
|
+
});
|
|
1113
|
+
invalidateExternalSourceArmings = (instanceId) =>
|
|
1114
|
+
externalSourceService.invalidateArmings(instanceId);
|
|
1115
|
+
startHooks.push(() => externalSourceService.reconcileAllArmings());
|
|
1116
|
+
afterSuccessHooks.add(async (instanceId) => {
|
|
1117
|
+
const process = baseDeps.processes.getById(instanceId);
|
|
1118
|
+
if (process) piResourceBundlePins.reconcile(process);
|
|
1119
|
+
await externalSourceService.reconcileArmings(instanceId);
|
|
1120
|
+
await externalSourceService.drainQueued(instanceId);
|
|
1121
|
+
});
|
|
1122
|
+
|
|
1123
|
+
if (!supervisor) throw new Error("worker supervisor not initialized");
|
|
1124
|
+
const deletionPending = new Set<string>();
|
|
1125
|
+
const sessionTransfers = createSessionTransferService({
|
|
1126
|
+
repos: baseDeps,
|
|
1127
|
+
processOperations,
|
|
1128
|
+
supervisor,
|
|
1129
|
+
exporter: runnerRuntime.exporter,
|
|
1130
|
+
helperRelays: sessionTransferHelperRelays,
|
|
1131
|
+
sessionSource: sessionSnapshots,
|
|
1132
|
+
config,
|
|
1133
|
+
limits: sessionTransferLimits,
|
|
1134
|
+
logger: app.log,
|
|
1135
|
+
isDeletionPending: (instanceId) => deletionPending.has(instanceId),
|
|
1136
|
+
onUpdated: (attempt) => {
|
|
1137
|
+
broadcaster.sendDurable(
|
|
1138
|
+
"session_transfer.updated",
|
|
1139
|
+
{ attemptId: attempt.id },
|
|
1140
|
+
attempt.instanceId,
|
|
762
1141
|
);
|
|
763
1142
|
},
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
ipcHandler,
|
|
788
|
-
leases: baseDeps.leases,
|
|
789
|
-
processes: baseDeps.processes,
|
|
790
|
-
projects: baseDeps.projects,
|
|
791
|
-
inputs: baseDeps.inputs,
|
|
792
|
-
turnRecords: baseDeps.turnRecords,
|
|
793
|
-
turnStarts: baseDeps.turnStarts,
|
|
794
|
-
broadcaster,
|
|
795
|
-
runnerRuntime,
|
|
796
|
-
resolvedExtensionEntriesJson: serializeResolvedExtensionEntries(resolvedExtensionEntries),
|
|
797
|
-
serverEpoch,
|
|
798
|
-
resolveResourceBundle(digest) {
|
|
799
|
-
return piResourceBundles.get(digest);
|
|
800
|
-
},
|
|
801
|
-
resolveRepositoryCredentials: (input) => repositoryCredentials.resolveWorkerCredentials(input),
|
|
802
|
-
integrationTools,
|
|
803
|
-
resolveCredential: (providerId, options) =>
|
|
804
|
-
modelProviderCredentials.resolve(providerId, options),
|
|
805
|
-
});
|
|
1143
|
+
});
|
|
1144
|
+
isNewTurnBlocked = (instanceId) => {
|
|
1145
|
+
const attempt = sessionTransfers.activeForProcess(instanceId);
|
|
1146
|
+
return attempt?.state === "queued" || attempt?.state === "exporting";
|
|
1147
|
+
};
|
|
1148
|
+
startHooks.push(async () => {
|
|
1149
|
+
await sessionTransfers.reconcile();
|
|
1150
|
+
sessionTransfers.start();
|
|
1151
|
+
});
|
|
1152
|
+
stopHooks.push(() => sessionTransfers.stop());
|
|
1153
|
+
const processDeletion = createProcessDeletionService({
|
|
1154
|
+
processes: baseDeps.processes,
|
|
1155
|
+
processEngine,
|
|
1156
|
+
processOperations,
|
|
1157
|
+
supervisor,
|
|
1158
|
+
volume: runnerRuntime.volume,
|
|
1159
|
+
sessionSnapshots,
|
|
1160
|
+
resultImages,
|
|
1161
|
+
sessionTransfers,
|
|
1162
|
+
deletionPending,
|
|
1163
|
+
broadcaster,
|
|
1164
|
+
logger: app.log,
|
|
1165
|
+
});
|
|
806
1166
|
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
const processes = baseDeps.processes.listAll();
|
|
815
|
-
const now = new Date();
|
|
816
|
-
const policy = {
|
|
817
|
-
completedProcessRetention: config.workers.cleanup.completed_process_retention,
|
|
818
|
-
errorProcessRetention: config.workers.cleanup.error_process_retention,
|
|
1167
|
+
const processActionListDeps = {
|
|
1168
|
+
projects: baseDeps.projects,
|
|
1169
|
+
futureExecutions: baseDeps.futureExecutions,
|
|
1170
|
+
turnRecords: baseDeps.turnRecords,
|
|
1171
|
+
turnStarts: baseDeps.turnStarts,
|
|
1172
|
+
processGraphs,
|
|
1173
|
+
processActionRegistry,
|
|
819
1174
|
};
|
|
820
|
-
const
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
try {
|
|
824
|
-
const released = await cleanupRetainedProcessVolumes({
|
|
825
|
-
volume: runnerRuntime.volume,
|
|
826
|
-
processes,
|
|
827
|
-
now,
|
|
828
|
-
policy,
|
|
829
|
-
alreadyReleased: releasedRetainedVolumes,
|
|
830
|
-
});
|
|
831
|
-
for (const instanceId of released) releasedRetainedVolumes.add(instanceId);
|
|
832
|
-
} catch (error) {
|
|
833
|
-
app.log.warn({ error }, "retained process volume cleanup failed");
|
|
834
|
-
}
|
|
835
|
-
try {
|
|
836
|
-
await resultImages.cleanupProcesses({
|
|
837
|
-
// Refresh after volume cleanup so a process created during the sweep is
|
|
838
|
-
// never mistaken for an orphan.
|
|
839
|
-
retainedInstanceIds: new Set(baseDeps.processes.listAll().map((process) => process.id)),
|
|
840
|
-
expiredInstanceIds: expiredImageProcesses,
|
|
841
|
-
});
|
|
842
|
-
} catch (error) {
|
|
843
|
-
app.log.warn({ error }, "retained result image cleanup failed");
|
|
844
|
-
} finally {
|
|
845
|
-
retainedVolumeCleanupRunning = false;
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
startHooks.push(() => {
|
|
849
|
-
if (!supervisor) {
|
|
850
|
-
throw new Error("worker supervisor not initialized");
|
|
851
|
-
}
|
|
852
|
-
void runRetainedVolumeCleanup();
|
|
853
|
-
const cleanupIntervalMs = Math.max(
|
|
854
|
-
60_000,
|
|
855
|
-
parseDurationMs(config.workers.cleanup.transient_ttl, 3_600_000, { allowHours: true }),
|
|
856
|
-
);
|
|
857
|
-
retainedVolumeCleanupTimer = setInterval(
|
|
858
|
-
() => void runRetainedVolumeCleanup(),
|
|
859
|
-
cleanupIntervalMs,
|
|
860
|
-
);
|
|
861
|
-
staleHeartbeatWatchdog = startStaleHeartbeatWatchdog({
|
|
862
|
-
leases: baseDeps.leases,
|
|
1175
|
+
const processModelSelection = createProcessModelSelection({
|
|
1176
|
+
processGraphs,
|
|
1177
|
+
processActionRegistry,
|
|
863
1178
|
processes: baseDeps.processes,
|
|
1179
|
+
projects: baseDeps.projects,
|
|
1180
|
+
scheduledActions: baseDeps.futureExecutions,
|
|
864
1181
|
turnRecords: baseDeps.turnRecords,
|
|
865
1182
|
turnStarts: baseDeps.turnStarts,
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
1183
|
+
instanceTrees: sessionReader,
|
|
1184
|
+
processModelPolicy,
|
|
1185
|
+
modelStatusCache,
|
|
869
1186
|
});
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
if (processTitles?.start) {
|
|
881
|
-
startHooks.push(() => processTitles.start?.());
|
|
882
|
-
}
|
|
883
|
-
if (processTitles?.close) {
|
|
884
|
-
stopHooks.push(() => processTitles.close?.());
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
futureExecutionLifecycle = createFutureExecutionLifecycle({
|
|
888
|
-
futureExecutions: baseDeps.futureExecutions,
|
|
889
|
-
processes: baseDeps.processes,
|
|
890
|
-
projects: baseDeps.projects,
|
|
891
|
-
handoffDedupKeys: baseDeps.handoffDedupKeys,
|
|
892
|
-
turnRecords: baseDeps.turnRecords,
|
|
893
|
-
skills: baseDeps.skills,
|
|
894
|
-
processSkills: baseDeps.processSkills,
|
|
895
|
-
transaction: baseDeps.transaction,
|
|
896
|
-
broadcaster,
|
|
897
|
-
commands: processEngine,
|
|
898
|
-
processOperations,
|
|
899
|
-
processTitles,
|
|
900
|
-
extensionHost,
|
|
901
|
-
launcherService,
|
|
902
|
-
launcherRecentValues,
|
|
903
|
-
processGraphs,
|
|
904
|
-
processActionRegistry: processActionRegistry ?? undefined,
|
|
905
|
-
processModelPolicy,
|
|
906
|
-
launchPlans,
|
|
907
|
-
modelStatusCache,
|
|
908
|
-
logger: app.log,
|
|
909
|
-
});
|
|
910
|
-
applyGeneratedFutureExecutionTitle = (input) =>
|
|
911
|
-
futureExecutionLifecycle.applyGeneratedFutureLaunchTitleIfUnchanged(input);
|
|
912
|
-
const futureExecutionScheduler = startFutureExecutionScheduler(futureExecutionLifecycle);
|
|
913
|
-
startHooks.push(() => futureExecutionScheduler.start());
|
|
914
|
-
stopHooks.push(() => futureExecutionScheduler.stop());
|
|
915
|
-
const externalSourceService = createExternalSourceService({
|
|
916
|
-
processes: baseDeps.processes,
|
|
917
|
-
projects: baseDeps.projects,
|
|
918
|
-
pendingExternalSourceFires: baseDeps.pendingExternalSourceFires,
|
|
919
|
-
commands: processEngine,
|
|
920
|
-
processActionRegistry,
|
|
921
|
-
});
|
|
922
|
-
invalidateExternalSourceArmings = (instanceId) =>
|
|
923
|
-
externalSourceService.invalidateArmings(instanceId);
|
|
924
|
-
startHooks.push(() => externalSourceService.reconcileAllArmings());
|
|
925
|
-
afterSuccessHooks.add(async (instanceId) => {
|
|
926
|
-
const process = baseDeps.processes.getById(instanceId);
|
|
927
|
-
if (process) piResourceBundlePins.reconcile(process);
|
|
928
|
-
await externalSourceService.reconcileArmings(instanceId);
|
|
929
|
-
await externalSourceService.drainQueued(instanceId);
|
|
930
|
-
});
|
|
931
|
-
|
|
932
|
-
if (!supervisor) throw new Error("worker supervisor not initialized");
|
|
933
|
-
const processDeletion = createProcessDeletionService({
|
|
934
|
-
processes: baseDeps.processes,
|
|
935
|
-
processEngine,
|
|
936
|
-
processOperations,
|
|
937
|
-
supervisor,
|
|
938
|
-
volume: runnerRuntime.volume,
|
|
939
|
-
sessionSnapshots,
|
|
940
|
-
resultImages,
|
|
941
|
-
broadcaster,
|
|
942
|
-
logger: app.log,
|
|
943
|
-
});
|
|
944
|
-
|
|
945
|
-
const processActionListDeps = {
|
|
946
|
-
projects: baseDeps.projects,
|
|
947
|
-
futureExecutions: baseDeps.futureExecutions,
|
|
948
|
-
turnRecords: baseDeps.turnRecords,
|
|
949
|
-
turnStarts: baseDeps.turnStarts,
|
|
950
|
-
processGraphs,
|
|
951
|
-
processActionRegistry,
|
|
952
|
-
};
|
|
953
|
-
const processModelSelection = createProcessModelSelection({
|
|
954
|
-
processGraphs,
|
|
955
|
-
processActionRegistry,
|
|
956
|
-
processes: baseDeps.processes,
|
|
957
|
-
projects: baseDeps.projects,
|
|
958
|
-
scheduledActions: baseDeps.futureExecutions,
|
|
959
|
-
turnRecords: baseDeps.turnRecords,
|
|
960
|
-
turnStarts: baseDeps.turnStarts,
|
|
961
|
-
instanceTrees: sessionReader,
|
|
962
|
-
processModelPolicy,
|
|
963
|
-
modelStatusCache,
|
|
964
|
-
});
|
|
965
|
-
const hostCapabilities = buildHostCapabilities({
|
|
966
|
-
config,
|
|
967
|
-
baseDeps,
|
|
968
|
-
projectMutations,
|
|
969
|
-
commands: processEngine,
|
|
970
|
-
getSupervisor: () => supervisor,
|
|
971
|
-
listVisibleActionsForProcess(instanceId: string) {
|
|
972
|
-
const process = baseDeps.processes.getById(instanceId);
|
|
973
|
-
return process ? listVisibleOperatorActionsForProcess(processActionListDeps, process) : [];
|
|
974
|
-
},
|
|
975
|
-
launcherService,
|
|
976
|
-
launcherRecentValues,
|
|
977
|
-
launcherModelConfigs,
|
|
978
|
-
launchPlans,
|
|
979
|
-
processTitles,
|
|
980
|
-
extensionHost,
|
|
981
|
-
logger: app.log,
|
|
982
|
-
processWatcherService,
|
|
983
|
-
externalSourceService,
|
|
984
|
-
processModelSelection,
|
|
985
|
-
resultImages,
|
|
986
|
-
repositoryCredentials,
|
|
987
|
-
processDefinitions: extensionCatalog.processes,
|
|
988
|
-
processQuestions,
|
|
989
|
-
preProvidedCapabilities: opts.preProvidedCapabilities,
|
|
990
|
-
});
|
|
991
|
-
|
|
992
|
-
await setupServerExtensions(
|
|
993
|
-
extensionCatalog,
|
|
994
|
-
{
|
|
995
|
-
events: extensionHost,
|
|
996
|
-
logger: app.log,
|
|
997
|
-
provide: hostCapabilities.provide.bind(hostCapabilities),
|
|
998
|
-
get: hostCapabilities.get.bind(hostCapabilities),
|
|
999
|
-
require: hostCapabilities.require.bind(hostCapabilities),
|
|
1000
|
-
tool: (definition) => integrationTools.register(definition),
|
|
1001
|
-
onStart(handler: () => void | Promise<void>) {
|
|
1002
|
-
startHooks.push(handler);
|
|
1187
|
+
const hostCapabilities = buildHostCapabilities({
|
|
1188
|
+
config,
|
|
1189
|
+
baseDeps,
|
|
1190
|
+
projectMutations,
|
|
1191
|
+
commands: processEngine,
|
|
1192
|
+
getSupervisor: () => supervisor,
|
|
1193
|
+
listVisibleActionsForProcess(instanceId: string) {
|
|
1194
|
+
const process = baseDeps.processes.getById(instanceId);
|
|
1195
|
+
return process ? listVisibleOperatorActionsForProcess(processActionListDeps, process) : [];
|
|
1003
1196
|
},
|
|
1004
|
-
|
|
1005
|
-
|
|
1197
|
+
launcherService,
|
|
1198
|
+
launcherRecentValues,
|
|
1199
|
+
launcherModelConfigs,
|
|
1200
|
+
launchPlans,
|
|
1201
|
+
processWatcherService,
|
|
1202
|
+
polling,
|
|
1203
|
+
externalSourceService,
|
|
1204
|
+
processModelSelection,
|
|
1205
|
+
resultImages,
|
|
1206
|
+
repositoryCredentials,
|
|
1207
|
+
processQuestions,
|
|
1208
|
+
launchCoordinator,
|
|
1209
|
+
preProvidedCapabilities: opts.preProvidedCapabilities,
|
|
1210
|
+
});
|
|
1211
|
+
|
|
1212
|
+
await setupServerExtensions(
|
|
1213
|
+
extensionCatalog,
|
|
1214
|
+
{
|
|
1215
|
+
events: extensionHost,
|
|
1216
|
+
logger: app.log,
|
|
1217
|
+
provide: hostCapabilities.provide.bind(hostCapabilities),
|
|
1218
|
+
get: hostCapabilities.get.bind(hostCapabilities),
|
|
1219
|
+
require: hostCapabilities.require.bind(hostCapabilities),
|
|
1220
|
+
tool: (definition) => integrationTools.register(definition),
|
|
1221
|
+
onStart(handler: () => void | Promise<void>) {
|
|
1222
|
+
startHooks.push(handler);
|
|
1223
|
+
},
|
|
1224
|
+
onStop(handler: () => void | Promise<void>) {
|
|
1225
|
+
stopHooks.push(handler);
|
|
1226
|
+
},
|
|
1006
1227
|
},
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1228
|
+
(id: string) => config.extensions?.[id],
|
|
1229
|
+
);
|
|
1230
|
+
integrationTools.validateTicketProcesses(extensionCatalog.processes);
|
|
1231
|
+
startHooks.push(() => polling.start());
|
|
1232
|
+
stopHooks.push(() => polling.stop());
|
|
1233
|
+
for (const process of extensionCatalog.processes.values()) {
|
|
1234
|
+
for (const [turnId, binding] of process.turns) {
|
|
1235
|
+
const definition = binding.definition;
|
|
1236
|
+
if (definition.kind !== "llm" || !definition.integrationTools?.length) continue;
|
|
1237
|
+
try {
|
|
1238
|
+
integrationTools.declarations(definition.integrationTools);
|
|
1239
|
+
} catch (error) {
|
|
1240
|
+
throw new Error(
|
|
1241
|
+
`Invalid integration tools for process '${process.id}' turn '${turnId}': ${error instanceof Error ? error.message : String(error)}`,
|
|
1242
|
+
);
|
|
1243
|
+
}
|
|
1020
1244
|
}
|
|
1021
1245
|
}
|
|
1022
|
-
|
|
1023
|
-
markStartup("server_extensions");
|
|
1024
|
-
|
|
1025
|
-
const deps: RouteDeps = {
|
|
1026
|
-
...baseDeps,
|
|
1027
|
-
processGraphs,
|
|
1028
|
-
supervisor,
|
|
1029
|
-
processEngine,
|
|
1030
|
-
processQuestions,
|
|
1031
|
-
processDeletion,
|
|
1032
|
-
processActionRegistry,
|
|
1033
|
-
processUiRegistry,
|
|
1034
|
-
extensionHost,
|
|
1035
|
-
launcherService,
|
|
1036
|
-
launcherRecentValues,
|
|
1037
|
-
launchPlans,
|
|
1038
|
-
processTitles,
|
|
1039
|
-
toolRenderers: extensionCatalog.toolRenderers,
|
|
1040
|
-
config,
|
|
1041
|
-
sessionReader,
|
|
1042
|
-
futureExecutionLifecycle,
|
|
1043
|
-
modelProviderRegistry,
|
|
1044
|
-
modelProviderCredentialStatus: modelProviderCredentials.status,
|
|
1045
|
-
modelStatusCache,
|
|
1046
|
-
processModelPolicy,
|
|
1047
|
-
processModelSelection,
|
|
1048
|
-
skillCatalog,
|
|
1049
|
-
};
|
|
1050
|
-
|
|
1051
|
-
registerHttp({
|
|
1052
|
-
app,
|
|
1053
|
-
isReady: () => backgroundServicesReady,
|
|
1054
|
-
deps,
|
|
1055
|
-
authService,
|
|
1056
|
-
processWatcherService,
|
|
1057
|
-
extensionUiCatalog,
|
|
1058
|
-
sessionSnapshots,
|
|
1059
|
-
resultImages,
|
|
1060
|
-
maxSessionSnapshotBytes: config.workers.session_snapshot_max_size_bytes,
|
|
1061
|
-
extensionUiAssetCacheControl:
|
|
1062
|
-
process.env.LEITWERK_RUNTIME_LANE === "source" ? "no-store" : undefined,
|
|
1063
|
-
});
|
|
1064
|
-
markStartup("routes_ready");
|
|
1246
|
+
markStartup("server_extensions");
|
|
1065
1247
|
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1248
|
+
const deps: RouteDeps = {
|
|
1249
|
+
externalSourceService,
|
|
1250
|
+
...baseDeps,
|
|
1251
|
+
launchCoordinator,
|
|
1252
|
+
processGraphs,
|
|
1253
|
+
supervisor,
|
|
1254
|
+
processEngine,
|
|
1255
|
+
processQuestions,
|
|
1256
|
+
toolApprovalGate,
|
|
1257
|
+
processDeletion,
|
|
1258
|
+
processActionRegistry,
|
|
1259
|
+
processUiRegistry,
|
|
1260
|
+
extensionHost,
|
|
1261
|
+
launcherService,
|
|
1262
|
+
launcherRecentValues,
|
|
1263
|
+
launchPlans,
|
|
1264
|
+
processTitles,
|
|
1265
|
+
toolRenderers: extensionCatalog.toolRenderers,
|
|
1266
|
+
config,
|
|
1267
|
+
sessionReader,
|
|
1268
|
+
futureExecutionLifecycle,
|
|
1269
|
+
modelProviderRegistry,
|
|
1270
|
+
modelProviderCredentialStatus: modelProviderCredentials.status,
|
|
1271
|
+
modelStatusCache,
|
|
1272
|
+
processModelPolicy,
|
|
1273
|
+
processModelSelection,
|
|
1274
|
+
skillCatalog,
|
|
1275
|
+
sessionTransferService: sessionTransfers,
|
|
1276
|
+
};
|
|
1081
1277
|
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1278
|
+
registerHttp({
|
|
1279
|
+
app,
|
|
1280
|
+
isReady: () => lifecycle.isReady(),
|
|
1281
|
+
deps,
|
|
1282
|
+
authService,
|
|
1283
|
+
processWatcherService,
|
|
1284
|
+
extensionUiCatalog,
|
|
1285
|
+
integrationTools,
|
|
1286
|
+
sessionSnapshots,
|
|
1287
|
+
resultImages,
|
|
1288
|
+
maxSessionSnapshotBytes: config.workers.session_snapshot_max_size_bytes,
|
|
1289
|
+
extensionUiAssetCacheControl:
|
|
1290
|
+
process.env.LEITWERK_RUNTIME_LANE === "source" ? "no-store" : undefined,
|
|
1291
|
+
});
|
|
1292
|
+
markStartup("routes_ready");
|
|
1086
1293
|
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1294
|
+
const lifecycle = createAppLifecycle({
|
|
1295
|
+
app,
|
|
1296
|
+
server: config.server,
|
|
1297
|
+
authEnabled: authService.config.enabled,
|
|
1298
|
+
reconcile: reconcileStartup,
|
|
1299
|
+
startHooks,
|
|
1300
|
+
preCloseCleanup,
|
|
1301
|
+
closeDatabase: () => closeOwnedDatabase?.(),
|
|
1302
|
+
});
|
|
1303
|
+
finishCleanup = lifecycle.finishCleanup;
|
|
1097
1304
|
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
}
|
|
1305
|
+
return {
|
|
1306
|
+
app,
|
|
1307
|
+
db,
|
|
1308
|
+
broadcaster,
|
|
1309
|
+
config,
|
|
1310
|
+
deps,
|
|
1311
|
+
modelProviderRegistry,
|
|
1312
|
+
modelProviderServerAdapters,
|
|
1313
|
+
modelStatusCache,
|
|
1314
|
+
extensionUiCatalog,
|
|
1315
|
+
processGraphs,
|
|
1316
|
+
extensionHost,
|
|
1317
|
+
projectMutations,
|
|
1318
|
+
ipcHandler,
|
|
1319
|
+
supervisor,
|
|
1320
|
+
listen: lifecycle.listen,
|
|
1321
|
+
close: lifecycle.close,
|
|
1322
|
+
isReady: lifecycle.isReady,
|
|
1323
|
+
};
|
|
1324
|
+
} catch (error) {
|
|
1325
|
+
const errors = [
|
|
1326
|
+
error,
|
|
1327
|
+
...(await collectCleanupErrors([
|
|
1328
|
+
() => app.close(),
|
|
1329
|
+
() => closeOwnedDatabase?.(),
|
|
1330
|
+
...preCloseCleanup,
|
|
1331
|
+
])),
|
|
1332
|
+
];
|
|
1333
|
+
if (errors.length > 1)
|
|
1334
|
+
throw new AggregateError(errors, "Context construction and cleanup failed", { cause: error });
|
|
1335
|
+
throw error;
|
|
1336
|
+
}
|
|
1118
1337
|
}
|