@leitwerk-dev/server 0.2.0 → 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-D4XHIbwA.d.ts → app-WfwKzrVk.d.ts} +2029 -410
- package/dist/app.d.ts +55 -12
- package/dist/app.d.ts.map +1 -1
- package/dist/{chunk-XTXH6623.js → chunk-CNITOV76.js} +1359 -991
- package/dist/chunk-CNITOV76.js.map +1 -0
- package/dist/{chunk-AGC2ND53.js → chunk-ZSKM25SD.js} +588 -667
- 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 +152 -51
- package/dist/config/config-types.d.ts.map +1 -1
- package/dist/db/api-token-repo.d.ts +24 -0
- package/dist/db/api-token-repo.d.ts.map +1 -1
- package/dist/db/auth-repo.d.ts +30 -0
- package/dist/db/auth-repo.d.ts.map +1 -1
- package/dist/db/credential-cipher.d.ts +8 -3
- package/dist/db/credential-cipher.d.ts.map +1 -1
- package/dist/db/database.d.ts +19 -1
- package/dist/db/database.d.ts.map +1 -1
- package/dist/db/external-write-log-repo.d.ts +6 -1
- package/dist/db/external-write-log-repo.d.ts.map +1 -1
- package/dist/db/future-execution-repo.d.ts +47 -0
- package/dist/db/future-execution-repo.d.ts.map +1 -1
- package/dist/db/launch-run-repo.d.ts +17 -0
- package/dist/db/launch-run-repo.d.ts.map +1 -1
- package/dist/db/launcher-recent-value-repo.d.ts +15 -0
- package/dist/db/launcher-recent-value-repo.d.ts.map +1 -1
- package/dist/db/pending-external-source-fire-repo.d.ts +33 -0
- package/dist/db/pending-external-source-fire-repo.d.ts.map +1 -1
- package/dist/db/process-event-repo.d.ts +17 -0
- package/dist/db/process-event-repo.d.ts.map +1 -1
- package/dist/db/process-handoff-dedup-key-repo.d.ts +8 -0
- package/dist/db/process-handoff-dedup-key-repo.d.ts.map +1 -1
- package/dist/db/process-input-repo.d.ts +15 -0
- package/dist/db/process-input-repo.d.ts.map +1 -1
- package/dist/db/process-instance-repo.d.ts +49 -0
- package/dist/db/process-instance-repo.d.ts.map +1 -1
- package/dist/db/process-leaf-outcome-snapshot-repo.d.ts +18 -0
- package/dist/db/process-leaf-outcome-snapshot-repo.d.ts.map +1 -1
- package/dist/db/process-project-repo.d.ts +20 -0
- package/dist/db/process-project-repo.d.ts.map +1 -1
- package/dist/db/process-question-request-repo.d.ts +19 -0
- package/dist/db/process-question-request-repo.d.ts.map +1 -1
- package/dist/db/process-relation-repo.d.ts +5 -0
- package/dist/db/process-relation-repo.d.ts.map +1 -1
- package/dist/db/process-skill-repo.d.ts +4 -0
- package/dist/db/process-skill-repo.d.ts.map +1 -1
- package/dist/db/process-title-job-repo.d.ts +22 -0
- package/dist/db/process-title-job-repo.d.ts.map +1 -1
- package/dist/db/process-tool-approval-request-repo.d.ts +20 -0
- package/dist/db/process-tool-approval-request-repo.d.ts.map +1 -1
- package/dist/db/process-turn-annotation-repo.d.ts +22 -2
- package/dist/db/process-turn-annotation-repo.d.ts.map +1 -1
- package/dist/db/process-turn-record-repo.d.ts +27 -0
- package/dist/db/process-turn-record-repo.d.ts.map +1 -1
- package/dist/db/provider-credential-repo.d.ts +16 -0
- package/dist/db/provider-credential-repo.d.ts.map +1 -1
- package/dist/db/repositories.d.ts +33 -0
- package/dist/db/repositories.d.ts.map +1 -1
- package/dist/db/session-transfer-repo.d.ts +49 -1
- package/dist/db/session-transfer-repo.d.ts.map +1 -1
- package/dist/db/skill-repo.d.ts +20 -0
- package/dist/db/skill-repo.d.ts.map +1 -1
- package/dist/db/startup-observation-repo.d.ts +3 -0
- package/dist/db/startup-observation-repo.d.ts.map +1 -1
- package/dist/db/ticket-destination-recent-repo.d.ts +14 -0
- package/dist/db/ticket-destination-recent-repo.d.ts.map +1 -1
- package/dist/db/turn-start-record-repo.d.ts +9 -0
- package/dist/db/turn-start-record-repo.d.ts.map +1 -1
- package/dist/db/turn-summary-repo.d.ts +18 -0
- package/dist/db/turn-summary-repo.d.ts.map +1 -1
- package/dist/db/worker-lease-repo.d.ts +31 -1
- package/dist/db/worker-lease-repo.d.ts.map +1 -1
- package/dist/effects/post-commit-effect.d.ts +29 -0
- package/dist/effects/post-commit-effect.d.ts.map +1 -1
- package/dist/effects/post-commit-runner.d.ts +1 -0
- package/dist/effects/post-commit-runner.d.ts.map +1 -1
- package/dist/entry-ref-patch.d.ts +3 -0
- package/dist/entry-ref-patch.d.ts.map +1 -1
- package/dist/extension-ui/catalog.d.ts +15 -0
- package/dist/extension-ui/catalog.d.ts.map +1 -1
- package/dist/extensions/extension-host.d.ts +6 -0
- package/dist/extensions/extension-host.d.ts.map +1 -1
- package/dist/external-source-service.d.ts +8 -0
- package/dist/external-source-service.d.ts.map +1 -1
- package/dist/future-execution/execution.d.ts +23 -1
- package/dist/future-execution/execution.d.ts.map +1 -1
- package/dist/future-execution/launch-lifecycle.d.ts +76 -0
- package/dist/future-execution/launch-lifecycle.d.ts.map +1 -1
- package/dist/future-execution/lifecycle.d.ts +99 -0
- package/dist/future-execution/lifecycle.d.ts.map +1 -1
- package/dist/future-execution/model-projection.d.ts +6 -0
- package/dist/future-execution/model-projection.d.ts.map +1 -1
- package/dist/future-execution/transition-planner.d.ts +25 -0
- package/dist/future-execution/transition-planner.d.ts.map +1 -1
- package/dist/future-execution-scheduler.d.ts +1 -1
- package/dist/future-execution-scheduler.d.ts.map +1 -1
- package/dist/index.d.ts +3 -30
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -239
- package/dist/index.js.map +1 -1
- package/dist/instance-tree.d.ts +3 -0
- package/dist/instance-tree.d.ts.map +1 -1
- package/dist/integration-tool-registry.d.ts +4 -1
- package/dist/integration-tool-registry.d.ts.map +1 -1
- package/dist/launch-coordinator.d.ts +33 -0
- package/dist/launch-coordinator.d.ts.map +1 -1
- package/dist/launch-pipeline.d.ts +60 -0
- package/dist/launch-pipeline.d.ts.map +1 -1
- package/dist/launcher-recent-values-service.d.ts +3 -0
- package/dist/launcher-recent-values-service.d.ts.map +1 -1
- package/dist/main.js +7 -14
- package/dist/main.js.map +1 -1
- package/dist/model-providers/builtin-server-adapter.d.ts +1 -0
- package/dist/model-providers/builtin-server-adapter.d.ts.map +1 -1
- package/dist/model-providers/credentials.d.ts +17 -0
- package/dist/model-providers/credentials.d.ts.map +1 -1
- package/dist/model-providers/model-status-cache.d.ts +30 -1
- package/dist/model-providers/model-status-cache.d.ts.map +1 -1
- package/dist/model-providers/provider-options.d.ts +21 -1
- package/dist/model-providers/provider-options.d.ts.map +1 -1
- package/dist/model-providers/registry.d.ts +22 -2
- package/dist/model-providers/registry.d.ts.map +1 -1
- package/dist/model-providers/server-adapters.d.ts +19 -0
- package/dist/model-providers/server-adapters.d.ts.map +1 -1
- package/dist/pi-resources/assemble.d.ts +24 -4
- package/dist/pi-resources/assemble.d.ts.map +1 -1
- package/dist/pi-resources/bundle-cache.d.ts +20 -1
- package/dist/pi-resources/bundle-cache.d.ts.map +1 -1
- package/dist/pi-resources/bundle-pin-lifecycle.d.ts +5 -1
- package/dist/pi-resources/bundle-pin-lifecycle.d.ts.map +1 -1
- package/dist/pi-resources/resource-collector.d.ts +11 -0
- package/dist/pi-resources/resource-collector.d.ts.map +1 -1
- package/dist/pi-session-tree.d.ts +13 -1
- package/dist/pi-session-tree.d.ts.map +1 -1
- package/dist/process-action-registry.d.ts +47 -0
- package/dist/process-action-registry.d.ts.map +1 -1
- package/dist/process-deletion-service.d.ts +12 -0
- package/dist/process-deletion-service.d.ts.map +1 -1
- package/dist/process-engine/decision.d.ts +12 -0
- package/dist/process-engine/decision.d.ts.map +1 -1
- package/dist/process-engine/engine.d.ts +1 -0
- package/dist/process-engine/engine.d.ts.map +1 -1
- package/dist/process-engine/operation.d.ts +23 -2
- package/dist/process-engine/operation.d.ts.map +1 -1
- package/dist/process-engine/startup-reconciliation.d.ts +14 -0
- package/dist/process-engine/startup-reconciliation.d.ts.map +1 -1
- package/dist/process-engine/types.d.ts +112 -1
- package/dist/process-engine/types.d.ts.map +1 -1
- package/dist/process-engine/writes/build-process-park-writes.d.ts +3 -0
- package/dist/process-engine/writes/build-process-park-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-recovery-start-writes.d.ts +4 -0
- package/dist/process-engine/writes/build-recovery-start-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-retry-writes.d.ts +3 -0
- package/dist/process-engine/writes/build-retry-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-turn-failed-writes.d.ts +6 -0
- package/dist/process-engine/writes/build-turn-failed-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-turn-outcome-writes.d.ts +8 -0
- package/dist/process-engine/writes/build-turn-outcome-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-turn-selection-writes.d.ts +8 -0
- package/dist/process-engine/writes/build-turn-selection-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/commit-writes.d.ts +14 -0
- package/dist/process-engine/writes/commit-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/deferred-extension-events.d.ts +4 -0
- package/dist/process-engine/writes/deferred-extension-events.d.ts.map +1 -1
- package/dist/process-engine/writes/writes.d.ts +67 -0
- package/dist/process-engine/writes/writes.d.ts.map +1 -1
- package/dist/process-graph.d.ts +1 -1
- package/dist/process-graph.d.ts.map +1 -1
- package/dist/process-input-dispatch.d.ts +1 -0
- package/dist/process-input-dispatch.d.ts.map +1 -1
- package/dist/process-launch-executor.d.ts +1 -0
- package/dist/process-launch-executor.d.ts.map +1 -1
- package/dist/process-model-policy/types.d.ts +157 -1
- package/dist/process-model-policy/types.d.ts.map +1 -1
- package/dist/process-operation-coordinator.d.ts +3 -0
- package/dist/process-operation-coordinator.d.ts.map +1 -1
- package/dist/process-question-service.d.ts +36 -20
- package/dist/process-question-service.d.ts.map +1 -1
- package/dist/process-runtime-availability.d.ts +2 -1
- package/dist/process-runtime-availability.d.ts.map +1 -1
- package/dist/process-session-store.d.ts +15 -4
- package/dist/process-session-store.d.ts.map +1 -1
- package/dist/process-title-generator.d.ts +53 -0
- package/dist/process-title-generator.d.ts.map +1 -1
- package/dist/process-turn-navigation.d.ts +1 -30
- package/dist/process-turn-navigation.d.ts.map +1 -1
- package/dist/process-turn-trace.d.ts +7 -0
- package/dist/process-turn-trace.d.ts.map +1 -1
- package/dist/process-ui-registry.d.ts +2 -0
- package/dist/process-ui-registry.d.ts.map +1 -1
- package/dist/process-ui-snapshot-presenter.d.ts +68 -1
- package/dist/process-ui-snapshot-presenter.d.ts.map +1 -1
- package/dist/process-watcher-registry.d.ts +5 -0
- package/dist/process-watcher-registry.d.ts.map +1 -1
- package/dist/product-ref-state.d.ts +1 -0
- package/dist/product-ref-state.d.ts.map +1 -1
- package/dist/project-mutation-service.d.ts +19 -0
- package/dist/project-mutation-service.d.ts.map +1 -1
- package/dist/result-image-store.d.ts +20 -0
- package/dist/result-image-store.d.ts.map +1 -1
- package/dist/routes/process-route-helpers.d.ts +30 -0
- package/dist/routes/process-route-helpers.d.ts.map +1 -1
- package/dist/routes/ui-renderers.d.ts +4 -0
- package/dist/routes/ui-renderers.d.ts.map +1 -1
- package/dist/routes/watchers.d.ts +3 -0
- package/dist/routes/watchers.d.ts.map +1 -1
- package/dist/semantic-entry-ref-state.d.ts +1 -0
- package/dist/semantic-entry-ref-state.d.ts.map +1 -1
- package/dist/server-bootstrap/app-lifecycle.d.ts +24 -0
- package/dist/server-bootstrap/app-lifecycle.d.ts.map +1 -0
- package/dist/server-bootstrap/build-host-capabilities.d.ts +5 -1
- package/dist/server-bootstrap/build-host-capabilities.d.ts.map +1 -1
- package/dist/server-topology.d.ts +8 -1
- package/dist/server-topology.d.ts.map +1 -1
- package/dist/session-transfer-helper-relays.d.ts +24 -0
- package/dist/session-transfer-helper-relays.d.ts.map +1 -1
- package/dist/session-transfer-service.d.ts +63 -1
- package/dist/session-transfer-service.d.ts.map +1 -1
- package/dist/skills/catalog-service.d.ts +7 -0
- package/dist/skills/catalog-service.d.ts.map +1 -1
- package/dist/skills/source-importer.d.ts +8 -0
- package/dist/skills/source-importer.d.ts.map +1 -1
- package/dist/startup-evidence.d.ts.map +1 -1
- package/dist/supervisor/ipc-handler.d.ts +28 -0
- package/dist/supervisor/ipc-handler.d.ts.map +1 -1
- package/dist/supervisor/worker-event-ingestor.d.ts +10 -0
- package/dist/supervisor/worker-event-ingestor.d.ts.map +1 -1
- package/dist/supervisor/worker-start-payload-builder.d.ts +13 -0
- package/dist/supervisor/worker-start-payload-builder.d.ts.map +1 -1
- package/dist/supervisor/worker-storage-layout.d.ts +12 -0
- package/dist/supervisor/worker-storage-layout.d.ts.map +1 -1
- package/dist/supervisor/worker-supervisor.d.ts +47 -3
- package/dist/supervisor/worker-supervisor.d.ts.map +1 -1
- package/dist/supervisor/worker-turn-ipc-recorder.d.ts +19 -0
- package/dist/supervisor/worker-turn-ipc-recorder.d.ts.map +1 -1
- package/dist/supervisor/worker-unit-reclaimer.d.ts +3 -0
- package/dist/supervisor/worker-unit-reclaimer.d.ts.map +1 -1
- package/dist/supervisor/worker-websocket-ipc.d.ts +37 -0
- package/dist/supervisor/worker-websocket-ipc.d.ts.map +1 -1
- package/dist/test-helpers/accepted-turn-start.d.ts +17 -0
- package/dist/test-helpers/accepted-turn-start.d.ts.map +1 -1
- package/dist/test-helpers/session-snapshot-fixtures.d.ts +1 -1
- package/dist/test-helpers/session-snapshot-fixtures.d.ts.map +1 -1
- package/dist/test-helpers/turn-start-preflight-fixtures.d.ts +8 -1
- package/dist/test-helpers/turn-start-preflight-fixtures.d.ts.map +1 -1
- package/dist/test-helpers/unit-deps.d.ts +8 -0
- package/dist/test-helpers/unit-deps.d.ts.map +1 -1
- package/dist/testing.d.ts +4 -7
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +2 -53
- package/dist/testing.js.map +1 -1
- package/dist/tool-approval-gate.d.ts +21 -0
- package/dist/tool-approval-gate.d.ts.map +1 -1
- package/dist/turn-result-markdown.d.ts +2 -0
- package/dist/turn-result-markdown.d.ts.map +1 -1
- package/dist/worker-runtime-profile-selection.d.ts +20 -4
- package/dist/worker-runtime-profile-selection.d.ts.map +1 -1
- package/dist/ws/broadcast.d.ts +10 -0
- package/dist/ws/broadcast.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/app.ts +916 -892
- package/src/config/config-loader.ts +12 -0
- package/src/config/config-types.ts +166 -66
- package/src/db/api-token-repo.ts +35 -2
- package/src/db/auth-repo.ts +35 -1
- package/src/db/credential-cipher.ts +8 -3
- package/src/db/database.ts +14 -0
- package/src/db/external-write-log-repo.ts +6 -1
- package/src/db/future-execution-repo.ts +51 -1
- package/src/db/launch-run-repo.ts +17 -0
- package/src/db/launcher-recent-value-repo.ts +15 -0
- package/src/db/pending-external-source-fire-repo.ts +33 -0
- package/src/db/process-event-repo.ts +21 -1
- package/src/db/process-handoff-dedup-key-repo.ts +8 -0
- package/src/db/process-input-repo.ts +15 -0
- package/src/db/process-instance-repo.ts +57 -2
- package/src/db/process-leaf-outcome-snapshot-repo.ts +18 -0
- package/src/db/process-project-repo.ts +20 -0
- package/src/db/process-question-request-repo.ts +19 -0
- package/src/db/process-relation-repo.ts +8 -1
- package/src/db/process-skill-repo.ts +4 -0
- package/src/db/process-title-job-repo.ts +30 -2
- package/src/db/process-tool-approval-request-repo.ts +24 -1
- package/src/db/process-turn-annotation-repo.ts +22 -2
- package/src/db/process-turn-record-repo.ts +27 -0
- package/src/db/provider-credential-repo.ts +20 -1
- package/src/db/repositories.ts +36 -1
- package/src/db/session-transfer-repo.ts +71 -9
- package/src/db/skill-repo.ts +24 -1
- package/src/db/startup-observation-repo.ts +3 -0
- package/src/db/ticket-destination-recent-repo.ts +14 -0
- package/src/db/turn-start-record-repo.ts +12 -1
- package/src/db/turn-summary-repo.ts +29 -2
- package/src/db/worker-lease-repo.ts +31 -1
- package/src/deployment-preflight.ts +1 -1
- package/src/effects/post-commit-effect.ts +42 -3
- package/src/effects/post-commit-runner.ts +1 -0
- package/src/entry-ref-patch.ts +9 -1
- package/src/extension-ui/catalog.ts +15 -0
- package/src/extensions/extension-host.ts +6 -0
- package/src/external-source-service.ts +12 -1
- package/src/future-execution/execution.ts +45 -8
- package/src/future-execution/launch-lifecycle.ts +145 -17
- package/src/future-execution/lifecycle.ts +124 -13
- package/src/future-execution/model-projection.ts +6 -0
- package/src/future-execution/transition-planner.ts +25 -0
- package/src/future-execution-scheduler.ts +7 -6
- package/src/index.ts +5 -153
- package/src/instance-tree.ts +3 -0
- package/src/integration-tool-registry.ts +17 -8
- package/src/launch-coordinator.ts +55 -5
- package/src/launch-pipeline.ts +103 -12
- package/src/launcher-recent-values-service.ts +3 -0
- package/src/main.ts +3 -10
- package/src/model-providers/builtin-server-adapter.ts +1 -0
- package/src/model-providers/credentials.ts +17 -0
- package/src/model-providers/model-status-cache.ts +30 -1
- package/src/model-providers/provider-options.ts +25 -2
- package/src/model-providers/registry.ts +22 -2
- package/src/model-providers/server-adapters.ts +19 -0
- package/src/pi-resources/assemble.ts +24 -4
- package/src/pi-resources/bundle-cache.ts +20 -1
- package/src/pi-resources/bundle-pin-lifecycle.ts +8 -2
- package/src/pi-resources/resource-collector.ts +11 -0
- package/src/pi-session-tree.ts +13 -1
- package/src/process-action-registry.ts +53 -1
- package/src/process-deletion-service.ts +29 -4
- package/src/process-engine/decision.ts +12 -0
- package/src/process-engine/engine.ts +1 -0
- package/src/process-engine/operation.ts +23 -2
- package/src/process-engine/startup-reconciliation.ts +14 -0
- package/src/process-engine/types.ts +176 -14
- package/src/process-engine/writes/build-process-park-writes.ts +3 -0
- package/src/process-engine/writes/build-recovery-start-writes.ts +4 -0
- package/src/process-engine/writes/build-retry-writes.ts +3 -0
- package/src/process-engine/writes/build-turn-failed-writes.ts +6 -0
- package/src/process-engine/writes/build-turn-outcome-writes.ts +8 -0
- package/src/process-engine/writes/build-turn-selection-writes.ts +8 -0
- package/src/process-engine/writes/commit-writes.ts +14 -0
- package/src/process-engine/writes/deferred-extension-events.ts +4 -0
- package/src/process-engine/writes/writes.ts +104 -10
- package/src/process-graph.ts +0 -3
- package/src/process-input-dispatch.ts +1 -0
- package/src/process-launch-executor.ts +1 -0
- package/src/process-model-policy/types.ts +195 -11
- package/src/process-operation-coordinator.ts +3 -0
- package/src/process-question-service.ts +53 -11
- package/src/process-runtime-availability.ts +4 -3
- package/src/process-session-store.ts +15 -4
- package/src/process-title-generator.ts +71 -5
- package/src/process-turn-navigation.ts +4 -1
- package/src/process-turn-trace.ts +7 -0
- package/src/process-ui-registry.ts +2 -0
- package/src/process-ui-snapshot-presenter.ts +75 -3
- package/src/process-watcher-registry.ts +5 -0
- package/src/product-ref-state.ts +1 -0
- package/src/project-mutation-service.ts +22 -1
- package/src/result-image-store.ts +27 -2
- package/src/routes/process-route-helpers.ts +30 -0
- package/src/routes/ui-renderers.ts +4 -0
- package/src/routes/watchers.ts +3 -0
- package/src/semantic-entry-ref-state.ts +1 -0
- package/src/server-bootstrap/app-lifecycle.ts +150 -0
- package/src/server-topology.ts +8 -1
- package/src/session-transfer-helper-relays.ts +33 -2
- package/src/session-transfer-service.ts +75 -7
- package/src/skills/catalog-service.ts +7 -0
- package/src/skills/source-importer.ts +8 -0
- package/src/startup-evidence.ts +23 -41
- package/src/supervisor/ipc-handler.ts +33 -1
- package/src/supervisor/worker-event-ingestor.ts +10 -0
- package/src/supervisor/worker-start-payload-builder.ts +16 -1
- package/src/supervisor/worker-storage-layout.ts +12 -0
- package/src/supervisor/worker-supervisor.ts +119 -133
- package/src/supervisor/worker-turn-ipc-recorder.ts +19 -0
- package/src/supervisor/worker-unit-reclaimer.ts +3 -0
- package/src/supervisor/worker-websocket-ipc.ts +57 -3
- package/src/test-helpers/accepted-turn-start.ts +28 -2
- package/src/test-helpers/session-snapshot-fixtures.ts +1 -1
- package/src/test-helpers/turn-start-preflight-fixtures.ts +8 -1
- package/src/test-helpers/unit-deps.ts +13 -1
- package/src/testing.ts +4 -23
- package/src/tool-approval-gate.ts +32 -3
- package/src/turn-result-markdown.ts +2 -0
- package/src/worker-runtime-profile-selection.ts +24 -5
- package/src/ws/broadcast.ts +20 -1
- package/dist/app-I4QQUL5B.js +0 -10
- package/dist/chunk-AGC2ND53.js.map +0 -1
- package/dist/chunk-XTXH6623.js.map +0 -1
- /package/dist/{app-I4QQUL5B.js.map → app-7PKX73TU.js.map} +0 -0
|
@@ -36,6 +36,7 @@ interface AttemptRuntime {
|
|
|
36
36
|
streamClaimed: boolean;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
/** @internal */
|
|
39
40
|
type AttemptAuth = Parameters<RepositoryBundle["sessionTransfers"]["verifyAttempt"]>[0];
|
|
40
41
|
|
|
41
42
|
function isExportPending(attempt: SessionTransferAttempt): boolean {
|
|
@@ -66,26 +67,43 @@ function relativeSessionCwd(input: {
|
|
|
66
67
|
return relative.split(path.sep).join("/");
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
/** @internal */
|
|
69
71
|
export function createSessionTransferService(deps: {
|
|
72
|
+
/** @internal */
|
|
70
73
|
repos: Pick<
|
|
71
74
|
RepositoryBundle,
|
|
72
75
|
"processes" | "projects" | "leases" | "sessionTransfers" | "transaction"
|
|
73
76
|
>;
|
|
77
|
+
/** @internal */
|
|
74
78
|
processOperations: ProcessOperationCoordinator;
|
|
79
|
+
/** @internal */
|
|
75
80
|
supervisor: WorkerSupervisor;
|
|
81
|
+
/** @internal */
|
|
76
82
|
exporter: ProcessStateExporter;
|
|
83
|
+
/** @internal */
|
|
77
84
|
helperRelays: SessionTransferHelperRelays;
|
|
85
|
+
/** @internal */
|
|
78
86
|
sessionSource: ProcessSessionSource;
|
|
87
|
+
/** @internal */
|
|
79
88
|
config: LeitwerkConfig;
|
|
89
|
+
/** @internal */
|
|
80
90
|
limits?: SessionTransferLimits;
|
|
91
|
+
/** @internal */
|
|
81
92
|
now?: () => Date;
|
|
82
|
-
|
|
93
|
+
/** @internal */
|
|
94
|
+
logger?: {
|
|
95
|
+
/** @internal */
|
|
96
|
+
warn(details: unknown, message: string): void;
|
|
97
|
+
};
|
|
98
|
+
/** @internal */
|
|
83
99
|
onUpdated?: (attempt: SessionTransferAttempt) => void;
|
|
100
|
+
/** @internal */
|
|
84
101
|
isDeletionPending?: (instanceId: string) => boolean;
|
|
85
102
|
}) {
|
|
86
103
|
const now = deps.now ?? (() => new Date());
|
|
87
104
|
const limits = deps.limits ?? DEFAULT_SESSION_TRANSFER_LIMITS;
|
|
88
105
|
const runtimes = new Map<string, AttemptRuntime>();
|
|
106
|
+
const exportWork = new Set<Promise<void>>();
|
|
89
107
|
let sweepTimer: NodeJS.Timeout | null = null;
|
|
90
108
|
|
|
91
109
|
function publish(attempt: SessionTransferAttempt | null): SessionTransferAttempt | null {
|
|
@@ -176,7 +194,7 @@ export function createSessionTransferService(deps: {
|
|
|
176
194
|
streamClaimed: false,
|
|
177
195
|
};
|
|
178
196
|
runtimes.set(attempt.id, runtime);
|
|
179
|
-
|
|
197
|
+
const work = (async () => {
|
|
180
198
|
updatePhase(attempt.id, "waiting_for_execution_chain");
|
|
181
199
|
while (true) {
|
|
182
200
|
const reserved = await deps.processOperations.runExclusive(attempt.instanceId, () => {
|
|
@@ -233,6 +251,11 @@ export function createSessionTransferService(deps: {
|
|
|
233
251
|
runtimes.delete(attempt.id);
|
|
234
252
|
}
|
|
235
253
|
});
|
|
254
|
+
exportWork.add(work);
|
|
255
|
+
void work.then(
|
|
256
|
+
() => exportWork.delete(work),
|
|
257
|
+
() => exportWork.delete(work),
|
|
258
|
+
);
|
|
236
259
|
}
|
|
237
260
|
|
|
238
261
|
function cancelAttempt(attempt: SessionTransferAttempt, code: string): SessionTransferAttempt {
|
|
@@ -265,10 +288,19 @@ export function createSessionTransferService(deps: {
|
|
|
265
288
|
}
|
|
266
289
|
|
|
267
290
|
return {
|
|
291
|
+
/** @internal */
|
|
268
292
|
async createGrant(instanceId: string) {
|
|
269
293
|
return deps.processOperations.runExclusive(instanceId, async () => {
|
|
270
|
-
if (deps.isDeletionPending?.(instanceId))
|
|
271
|
-
|
|
294
|
+
if (deps.isDeletionPending?.(instanceId))
|
|
295
|
+
return {
|
|
296
|
+
/** @internal */
|
|
297
|
+
kind: "deletion_pending" as const,
|
|
298
|
+
};
|
|
299
|
+
if (!deps.repos.processes.getById(instanceId))
|
|
300
|
+
return {
|
|
301
|
+
/** @internal */
|
|
302
|
+
kind: "not_found" as const,
|
|
303
|
+
};
|
|
272
304
|
const handle = await deps.sessionSource.readSnapshotHandle(instanceId);
|
|
273
305
|
if (!handle) return { kind: "not_found" as const };
|
|
274
306
|
const created = deps.repos.sessionTransfers.createGrant({
|
|
@@ -277,14 +309,26 @@ export function createSessionTransferService(deps: {
|
|
|
277
309
|
lifetimeMs: GRANT_LIFETIME_MS,
|
|
278
310
|
});
|
|
279
311
|
return {
|
|
312
|
+
/** @internal */
|
|
280
313
|
kind: "created" as const,
|
|
314
|
+
/** @internal */
|
|
281
315
|
grantId: created.grant.id,
|
|
316
|
+
/** @internal */
|
|
282
317
|
rawToken: created.rawToken,
|
|
318
|
+
/** @internal */
|
|
283
319
|
expiresAt: created.grant.expiresAt,
|
|
284
320
|
};
|
|
285
321
|
});
|
|
286
322
|
},
|
|
287
|
-
|
|
323
|
+
/** @internal */
|
|
324
|
+
startAttempt(input: {
|
|
325
|
+
/** @internal */
|
|
326
|
+
instanceId: string;
|
|
327
|
+
/** @internal */
|
|
328
|
+
grantId: string;
|
|
329
|
+
/** @internal */
|
|
330
|
+
token: string;
|
|
331
|
+
}) {
|
|
288
332
|
if (deps.isDeletionPending?.(input.instanceId)) return { kind: "not_found" as const };
|
|
289
333
|
const result = deps.repos.transaction((repos) =>
|
|
290
334
|
repos.sessionTransfers.startAttempt({
|
|
@@ -300,6 +344,7 @@ export function createSessionTransferService(deps: {
|
|
|
300
344
|
}
|
|
301
345
|
return result;
|
|
302
346
|
},
|
|
347
|
+
/** @internal */
|
|
303
348
|
heartbeat(input: AttemptAuth) {
|
|
304
349
|
const attempt = deps.repos.sessionTransfers.verifyAttempt(input);
|
|
305
350
|
if (!attempt) return null;
|
|
@@ -310,6 +355,7 @@ export function createSessionTransferService(deps: {
|
|
|
310
355
|
current
|
|
311
356
|
);
|
|
312
357
|
},
|
|
358
|
+
/** @internal */
|
|
313
359
|
openStream(input: AttemptAuth) {
|
|
314
360
|
const attempt = deps.repos.sessionTransfers.verifyAttempt(input);
|
|
315
361
|
if (!attempt || deadlineCode(attempt)) {
|
|
@@ -370,10 +416,17 @@ export function createSessionTransferService(deps: {
|
|
|
370
416
|
void pipeline(source, meter, { signal: runtime.controller.signal }).catch(() => undefined);
|
|
371
417
|
return meter;
|
|
372
418
|
},
|
|
373
|
-
|
|
419
|
+
/** @internal */
|
|
420
|
+
cancel(
|
|
421
|
+
input: AttemptAuth & {
|
|
422
|
+
/** @internal */
|
|
423
|
+
code?: string;
|
|
424
|
+
},
|
|
425
|
+
) {
|
|
374
426
|
const attempt = deps.repos.sessionTransfers.verifyAttempt(input);
|
|
375
427
|
return attempt ? cancelAttempt(attempt, input.code ?? "client_cancelled") : null;
|
|
376
428
|
},
|
|
429
|
+
/** @internal */
|
|
377
430
|
cancelForWeb(instanceId: string, attemptId: string) {
|
|
378
431
|
const attempt = deps.repos.sessionTransfers.getAttempt(attemptId);
|
|
379
432
|
if (!attempt || attempt.instanceId !== instanceId) return null;
|
|
@@ -381,6 +434,7 @@ export function createSessionTransferService(deps: {
|
|
|
381
434
|
? attempt
|
|
382
435
|
: cancelAttempt(attempt, "operator_cancelled");
|
|
383
436
|
},
|
|
437
|
+
/** @internal */
|
|
384
438
|
acknowledge(input: AttemptAuth) {
|
|
385
439
|
const attempt = deps.repos.sessionTransfers.verifyAttempt(input);
|
|
386
440
|
if (!attempt) return null;
|
|
@@ -398,14 +452,17 @@ export function createSessionTransferService(deps: {
|
|
|
398
452
|
);
|
|
399
453
|
return publish(acknowledged);
|
|
400
454
|
},
|
|
455
|
+
/** @internal */
|
|
401
456
|
activeForProcess(instanceId: string) {
|
|
402
457
|
return deps.repos.sessionTransfers.getActiveByInstance(instanceId);
|
|
403
458
|
},
|
|
459
|
+
/** @internal */
|
|
404
460
|
revokeProcess(instanceId: string) {
|
|
405
461
|
const active = deps.repos.sessionTransfers.getActiveByInstance(instanceId);
|
|
406
462
|
if (active) cancelAttempt(active, "process_deleted");
|
|
407
463
|
deps.repos.sessionTransfers.revokeProcess(instanceId);
|
|
408
464
|
},
|
|
465
|
+
/** @internal */
|
|
409
466
|
async reconcile() {
|
|
410
467
|
await deps.exporter.reconcile();
|
|
411
468
|
for (const attempt of deps.repos.sessionTransfers.listActive()) {
|
|
@@ -418,10 +475,12 @@ export function createSessionTransferService(deps: {
|
|
|
418
475
|
}
|
|
419
476
|
sweep();
|
|
420
477
|
},
|
|
478
|
+
/** @internal */
|
|
421
479
|
start() {
|
|
422
480
|
if (!sweepTimer) sweepTimer = setInterval(sweep, 15_000);
|
|
423
481
|
},
|
|
424
|
-
|
|
482
|
+
/** @internal */
|
|
483
|
+
async stop() {
|
|
425
484
|
if (sweepTimer) clearInterval(sweepTimer);
|
|
426
485
|
sweepTimer = null;
|
|
427
486
|
for (const runtime of runtimes.values()) {
|
|
@@ -429,11 +488,20 @@ export function createSessionTransferService(deps: {
|
|
|
429
488
|
}
|
|
430
489
|
runtimes.clear();
|
|
431
490
|
deps.helperRelays.stop();
|
|
491
|
+
const results = await Promise.allSettled(exportWork);
|
|
492
|
+
const errors = results
|
|
493
|
+
.filter((result) => result.status === "rejected")
|
|
494
|
+
.map((result) => result.reason);
|
|
495
|
+
if (errors.length) throw new AggregateError(errors, "Session export cleanup failed");
|
|
432
496
|
},
|
|
497
|
+
/** @internal */
|
|
433
498
|
helperSpec: deps.helperRelays.helperSpec,
|
|
499
|
+
/** @internal */
|
|
434
500
|
reportHelperPreflight: deps.helperRelays.reportHelperPreflight,
|
|
501
|
+
/** @internal */
|
|
435
502
|
acceptHelperStream: deps.helperRelays.acceptHelperStream,
|
|
436
503
|
};
|
|
437
504
|
}
|
|
438
505
|
|
|
506
|
+
/** @internal */
|
|
439
507
|
export type SessionTransferService = ReturnType<typeof createSessionTransferService>;
|
|
@@ -8,12 +8,19 @@ import type { SkillRepositoryConfig } from "../config/config-types.js";
|
|
|
8
8
|
import type { RepositoryBundle } from "../db/repositories.js";
|
|
9
9
|
import { importSkillRepository } from "./source-importer.js";
|
|
10
10
|
|
|
11
|
+
/** @internal */
|
|
11
12
|
export interface SkillCatalogService {
|
|
13
|
+
/** @internal */
|
|
12
14
|
refresh(): Promise<SkillsCatalogResponseBody>;
|
|
15
|
+
/** @internal */
|
|
13
16
|
list(): SkillsCatalogResponseBody;
|
|
17
|
+
/** @internal */
|
|
14
18
|
detail(repositoryId: string, skillId: string): SkillCatalogDetail | null;
|
|
19
|
+
/** @internal */
|
|
15
20
|
installedDetail(skillId: string): InstalledSkillCatalogDetail | null;
|
|
21
|
+
/** @internal */
|
|
16
22
|
register(repositoryId: string, skillId: string): string;
|
|
23
|
+
/** @internal */
|
|
17
24
|
remove(skillId: string): boolean;
|
|
18
25
|
}
|
|
19
26
|
|
|
@@ -15,15 +15,23 @@ const execFileAsync = promisify(execFile);
|
|
|
15
15
|
const GIT_ENV = { ...process.env, GIT_TERMINAL_PROMPT: "0", GIT_ASKPASS: "/bin/false" };
|
|
16
16
|
const FORBIDDEN_SKILL_NAMES = new Set([".git"]);
|
|
17
17
|
|
|
18
|
+
/** @internal */
|
|
18
19
|
export interface ImportedSkill {
|
|
20
|
+
/** @internal */
|
|
19
21
|
skillId: string;
|
|
22
|
+
/** @internal */
|
|
20
23
|
label: string;
|
|
24
|
+
/** @internal */
|
|
21
25
|
description: string | null;
|
|
26
|
+
/** @internal */
|
|
22
27
|
bundle: PiResourceBundle;
|
|
28
|
+
/** @internal */
|
|
23
29
|
sourceRevision: string | null;
|
|
24
30
|
}
|
|
25
31
|
|
|
32
|
+
/** @internal */
|
|
26
33
|
export interface ImportedRepositorySkill extends ImportedSkill {
|
|
34
|
+
/** @internal */
|
|
27
35
|
sourcePath: string;
|
|
28
36
|
}
|
|
29
37
|
|
package/src/startup-evidence.ts
CHANGED
|
@@ -240,20 +240,17 @@ export function buildStartupEvidence(input: StartupEvidenceInput): StartupEviden
|
|
|
240
240
|
steps,
|
|
241
241
|
};
|
|
242
242
|
});
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
.find((candidate) => candidate.status === "succeeded");
|
|
248
|
-
return recoveryAttempt
|
|
243
|
+
// Startup history ends at the first accepted start, so any success is the final attempt.
|
|
244
|
+
const authoritative = attempts.find((attempt) => attempt.status === "succeeded");
|
|
245
|
+
const recoveredAttempts = attempts.map((attempt) =>
|
|
246
|
+
attempt.status === "failed" && authoritative
|
|
249
247
|
? {
|
|
250
248
|
...attempt,
|
|
251
249
|
status: "recovered" as const,
|
|
252
|
-
recoveredByStartRecordId:
|
|
250
|
+
recoveredByStartRecordId: authoritative.startRecordId,
|
|
253
251
|
}
|
|
254
|
-
: attempt
|
|
255
|
-
|
|
256
|
-
const authoritative = recoveredAttempts.findLast((attempt) => attempt.status === "succeeded");
|
|
252
|
+
: attempt,
|
|
253
|
+
);
|
|
257
254
|
const currentAttempt =
|
|
258
255
|
(currentStartId
|
|
259
256
|
? recoveredAttempts.find((attempt) => attempt.startRecordId === currentStartId)
|
|
@@ -320,43 +317,28 @@ export function projectLaunchRunStartup(
|
|
|
320
317
|
let next = run;
|
|
321
318
|
const attempt = evidence.currentAttempt;
|
|
322
319
|
if (!wasFailed) {
|
|
323
|
-
for (const id of [
|
|
324
|
-
"start_worker",
|
|
325
|
-
"connect_worker",
|
|
326
|
-
"prepare_workspace",
|
|
327
|
-
"start_first_turn",
|
|
328
|
-
] as const) {
|
|
329
|
-
const step = attempt?.steps.find((candidate) => candidate.id === id);
|
|
330
|
-
if (!step) {
|
|
331
|
-
const existing = next.steps.find((candidate) => candidate.id === id);
|
|
332
|
-
if (existing?.status !== "skipped") next = projectStep(next, id, "pending", null);
|
|
333
|
-
continue;
|
|
334
|
-
}
|
|
335
|
-
const status = step.status === "superseded" ? "pending" : step.status;
|
|
336
|
-
next = projectStep(
|
|
337
|
-
next,
|
|
338
|
-
id,
|
|
339
|
-
status,
|
|
340
|
-
step.occurredAt,
|
|
341
|
-
status === "failed"
|
|
342
|
-
? (attempt?.summary ??
|
|
343
|
-
"Worker startup stopped before completion. Retry startup from the process page.")
|
|
344
|
-
: id === "start_worker" && attempt?.summary
|
|
345
|
-
? attempt.summary
|
|
346
|
-
: undefined,
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
320
|
next = {
|
|
350
321
|
...next,
|
|
351
322
|
steps: next.steps.map((item) => {
|
|
323
|
+
if (!Object.hasOwn(STARTUP_STEP_LABELS, item.id)) return item;
|
|
352
324
|
const phase = attempt?.steps.find((candidate) => candidate.id === item.id);
|
|
353
|
-
if (!phase) return item;
|
|
354
|
-
const { startedAt: _start, completedAt: _end, ...rest } = item;
|
|
325
|
+
if (!phase && item.status === "skipped") return item;
|
|
326
|
+
const { startedAt: _start, completedAt: _end, safeSummary: _summary, ...rest } = item;
|
|
327
|
+
const status = !phase || phase.status === "superseded" ? "pending" : phase.status;
|
|
328
|
+
const safeSummary =
|
|
329
|
+
status === "failed"
|
|
330
|
+
? (attempt?.summary ??
|
|
331
|
+
"Worker startup stopped before completion. Retry startup from the process page.")
|
|
332
|
+
: item.id === "start_worker"
|
|
333
|
+
? attempt?.summary
|
|
334
|
+
: undefined;
|
|
355
335
|
return {
|
|
356
336
|
...rest,
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
...(phase
|
|
337
|
+
status,
|
|
338
|
+
label: phase?.label ?? item.label,
|
|
339
|
+
...(phase?.startedAt ? { startedAt: phase.startedAt } : {}),
|
|
340
|
+
...(phase?.endedAt ? { completedAt: phase.endedAt } : {}),
|
|
341
|
+
...(phase && safeSummary ? { safeSummary } : {}),
|
|
360
342
|
};
|
|
361
343
|
}),
|
|
362
344
|
};
|
|
@@ -39,48 +39,77 @@ function mapWorkerStateToObservation(value: string): WorkerLeaseObservation | nu
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
/** @internal */
|
|
42
43
|
export interface IpcHandlerDeps
|
|
43
44
|
extends Pick<
|
|
44
45
|
RepositoryBundle,
|
|
45
46
|
"processes" | "projects" | "inputs" | "events" | "leases" | "turnRecords"
|
|
46
47
|
> {
|
|
48
|
+
/** @internal */
|
|
47
49
|
startupObservations?: RepositoryBundle["startupObservations"];
|
|
50
|
+
/** @internal */
|
|
48
51
|
getLaunchCoordinator?: () => LaunchCoordinator | undefined;
|
|
52
|
+
/** @internal */
|
|
49
53
|
processQuestions?: ProcessQuestionService;
|
|
54
|
+
/** @internal */
|
|
50
55
|
broadcaster: Broadcaster;
|
|
56
|
+
/** @internal */
|
|
51
57
|
commands: ProcessEngine;
|
|
58
|
+
/** @internal */
|
|
52
59
|
workerEventLogger?: (entry: WorkerEventLogEntry) => void;
|
|
60
|
+
/** @internal */
|
|
53
61
|
appendDiagnosticTrace?: (instanceId: string, text: string) => void;
|
|
62
|
+
/** @internal */
|
|
54
63
|
updateCredential?: (input: {
|
|
64
|
+
/** @internal */
|
|
55
65
|
providerId: string;
|
|
66
|
+
/** @internal */
|
|
56
67
|
expectedRevision: number;
|
|
68
|
+
/** @internal */
|
|
57
69
|
values: Record<string, string>;
|
|
58
|
-
}) => {
|
|
70
|
+
}) => {
|
|
71
|
+
/** @internal */
|
|
72
|
+
accepted: boolean;
|
|
73
|
+
/** @internal */
|
|
74
|
+
currentRevision: number | null;
|
|
75
|
+
/** @internal */
|
|
76
|
+
safeReason?: string;
|
|
77
|
+
};
|
|
78
|
+
/** @internal */
|
|
59
79
|
handleIntegrationToolRequest?: (
|
|
60
80
|
instanceId: string,
|
|
61
81
|
payload: WorkerIntegrationToolRequestPayload,
|
|
62
82
|
) => Promise<WorkerIntegrationToolResultPayload>;
|
|
83
|
+
/** @internal */
|
|
63
84
|
handleIntegrationToolCancel?: (
|
|
64
85
|
instanceId: string,
|
|
65
86
|
payload: WorkerIntegrationToolCancelPayload,
|
|
66
87
|
) => void;
|
|
67
88
|
}
|
|
68
89
|
|
|
90
|
+
/** @internal */
|
|
69
91
|
export interface IpcHandlerCallbacks extends WorkerTurnIpcRecorderCallbacks {
|
|
92
|
+
/** @internal */
|
|
70
93
|
onWorkerReady?: (instanceId: string, workerId: string) => void;
|
|
94
|
+
/** @internal */
|
|
71
95
|
onWorkerFailed?: (instanceId: string, workerId: string, error: string) => void;
|
|
96
|
+
/** @internal */
|
|
72
97
|
onWorkerExited?: (instanceId: string, workerId: string) => void;
|
|
98
|
+
/** @internal */
|
|
73
99
|
onCleanupCompleted?: (instanceId: string, workerId: string) => void;
|
|
100
|
+
/** @internal */
|
|
74
101
|
onWorkerTurnStartAccepted?: (
|
|
75
102
|
instanceId: string,
|
|
76
103
|
workerId: string,
|
|
77
104
|
payload: WorkerTurnStartAcceptedPayload,
|
|
78
105
|
) => void;
|
|
106
|
+
/** @internal */
|
|
79
107
|
onCredentialUpdateResult?: (
|
|
80
108
|
instanceId: string,
|
|
81
109
|
workerId: string,
|
|
82
110
|
payload: WorkerCredentialUpdateResultPayload,
|
|
83
111
|
) => void;
|
|
112
|
+
/** @internal */
|
|
84
113
|
onIntegrationToolResult?: (
|
|
85
114
|
instanceId: string,
|
|
86
115
|
workerId: string,
|
|
@@ -88,6 +117,7 @@ export interface IpcHandlerCallbacks extends WorkerTurnIpcRecorderCallbacks {
|
|
|
88
117
|
) => void;
|
|
89
118
|
}
|
|
90
119
|
|
|
120
|
+
/** @internal */
|
|
91
121
|
export function createIpcHandler(deps: IpcHandlerDeps, callbacks: IpcHandlerCallbacks) {
|
|
92
122
|
const eventIngestor = createWorkerEventIngestor(deps);
|
|
93
123
|
const inputAckHandler = createWorkerInputAckHandler(deps);
|
|
@@ -107,6 +137,7 @@ export function createIpcHandler(deps: IpcHandlerDeps, callbacks: IpcHandlerCall
|
|
|
107
137
|
);
|
|
108
138
|
|
|
109
139
|
return {
|
|
140
|
+
/** @internal */
|
|
110
141
|
handleMessage(envelope: IpcEnvelope): void {
|
|
111
142
|
const decoded = decodeWorkerToServerMessage(envelope);
|
|
112
143
|
if (!decoded.ok) {
|
|
@@ -381,4 +412,5 @@ export function createIpcHandler(deps: IpcHandlerDeps, callbacks: IpcHandlerCall
|
|
|
381
412
|
};
|
|
382
413
|
}
|
|
383
414
|
|
|
415
|
+
/** @internal */
|
|
384
416
|
export type IpcHandler = ReturnType<typeof createIpcHandler>;
|
|
@@ -23,15 +23,25 @@ import { recordTurnProgress } from "../turn-progress.js";
|
|
|
23
23
|
import type { Broadcaster } from "../ws/broadcast.js";
|
|
24
24
|
import { recordInitialTurnObservation } from "./startup-observer.js";
|
|
25
25
|
|
|
26
|
+
/** @internal */
|
|
26
27
|
export interface WorkerEventLogEntry {
|
|
28
|
+
/** @internal */
|
|
27
29
|
instanceId: string;
|
|
30
|
+
/** @internal */
|
|
28
31
|
workerId: string;
|
|
32
|
+
/** @internal */
|
|
29
33
|
eventType: string;
|
|
34
|
+
/** @internal */
|
|
30
35
|
selectedTurnId: string | null;
|
|
36
|
+
/** @internal */
|
|
31
37
|
timestamp: string;
|
|
38
|
+
/** @internal */
|
|
32
39
|
serverObservedAt: string;
|
|
40
|
+
/** @internal */
|
|
33
41
|
serverObservedLatencyMs: number | null;
|
|
42
|
+
/** @internal */
|
|
34
43
|
turnRecordId: string | null;
|
|
44
|
+
/** @internal */
|
|
35
45
|
data: Record<string, unknown>;
|
|
36
46
|
}
|
|
37
47
|
|
|
@@ -33,33 +33,48 @@ import {
|
|
|
33
33
|
} from "../turn-result-markdown.js";
|
|
34
34
|
import { createWorkerStorageLayout, type WorkerStorageLayout } from "./worker-storage-layout.js";
|
|
35
35
|
|
|
36
|
+
/** @internal */
|
|
36
37
|
export interface WorkerStartPayloadBuilderDeps
|
|
37
38
|
extends Pick<
|
|
38
39
|
RepositoryBundle,
|
|
39
40
|
"processes" | "projects" | "inputs" | "turnRecords" | "turnStarts" | "leases" | "events"
|
|
40
41
|
> {
|
|
42
|
+
/** @internal */
|
|
41
43
|
config: LeitwerkConfig;
|
|
44
|
+
/** @internal */
|
|
42
45
|
processGraphs: ProcessGraphRegistry;
|
|
46
|
+
/** @internal */
|
|
43
47
|
processActionRegistry: Pick<ProcessActionRegistry, "getTurnDefinition" | "resolveContextData">;
|
|
48
|
+
/** @internal */
|
|
44
49
|
storageLayout?: WorkerStorageLayout;
|
|
45
50
|
/**
|
|
46
51
|
* The sole server-side resource-bundle seam. The resulting canonical bytes are
|
|
47
52
|
* delivered only in the authenticated `worker.start` message, irrespective of
|
|
48
53
|
* whether the physical worker is local, Docker, or Kubernetes.
|
|
49
54
|
*/
|
|
55
|
+
/** @internal */
|
|
50
56
|
resolveResourceBundle?(digest: string): PiResourceBundle | null;
|
|
57
|
+
/** @internal */
|
|
51
58
|
resolveRepositoryCredentials?(input: {
|
|
59
|
+
/** @internal */
|
|
52
60
|
process: ProcessInstance;
|
|
61
|
+
/** @internal */
|
|
53
62
|
projects: ReturnType<RepositoryBundle["projects"]["listByInstance"]>;
|
|
54
63
|
}): import("@leitwerk-dev/worker-protocol").WorkerRepositoryCredential[];
|
|
64
|
+
/** @internal */
|
|
55
65
|
resolveCredential?(
|
|
56
66
|
providerId: string,
|
|
57
67
|
options: Readonly<Record<string, string>>,
|
|
58
68
|
): Pick<ResolvedProviderCredential, "revision" | "values"> | null;
|
|
69
|
+
/** @internal */
|
|
59
70
|
integrationTools?: {
|
|
71
|
+
/** @internal */
|
|
60
72
|
declarations(
|
|
61
73
|
names: readonly string[],
|
|
62
|
-
context?: {
|
|
74
|
+
context?: {
|
|
75
|
+
/** @internal */
|
|
76
|
+
paramsJson: string | null;
|
|
77
|
+
},
|
|
63
78
|
): import("@leitwerk-dev/worker-protocol").IntegrationToolDeclaration[];
|
|
64
79
|
};
|
|
65
80
|
}
|
|
@@ -3,13 +3,19 @@ import path from "node:path";
|
|
|
3
3
|
import { expandPiAgentDir } from "@leitwerk-dev/process-sdk/pi-config";
|
|
4
4
|
import type { LeitwerkConfig } from "../config/config-types.js";
|
|
5
5
|
|
|
6
|
+
/** @internal */
|
|
6
7
|
export interface WorkerTreePaths {
|
|
8
|
+
/** @internal */
|
|
7
9
|
primaryTreeFile: string;
|
|
10
|
+
/** @internal */
|
|
8
11
|
workspaceRoot: string;
|
|
12
|
+
/** @internal */
|
|
9
13
|
piResourceBundlesDir: string;
|
|
14
|
+
/** @internal */
|
|
10
15
|
resume: boolean;
|
|
11
16
|
}
|
|
12
17
|
|
|
18
|
+
/** @internal */
|
|
13
19
|
export type WorkerStorageLayout = (instanceId: string) => WorkerTreePaths;
|
|
14
20
|
|
|
15
21
|
function normalizeContainerMountPath(mountPath: string): string {
|
|
@@ -26,8 +32,11 @@ function joinContainerPath(mountPath: string, ...segments: string[]): string {
|
|
|
26
32
|
return path.posix.join(normalized, ...segments);
|
|
27
33
|
}
|
|
28
34
|
|
|
35
|
+
/** @internal */
|
|
29
36
|
export function createLocalWorkerStorageLayout(input: {
|
|
37
|
+
/** @internal */
|
|
30
38
|
processWorkspacesDir: string;
|
|
39
|
+
/** @internal */
|
|
31
40
|
treeFilesDir: string;
|
|
32
41
|
}): WorkerStorageLayout {
|
|
33
42
|
return (instanceId) => {
|
|
@@ -48,7 +57,9 @@ export function createLocalWorkerStorageLayout(input: {
|
|
|
48
57
|
};
|
|
49
58
|
}
|
|
50
59
|
|
|
60
|
+
/** @internal */
|
|
51
61
|
export function createProcessVolumeWorkerStorageLayout(input: {
|
|
62
|
+
/** @internal */
|
|
52
63
|
mountPath: string;
|
|
53
64
|
}): WorkerStorageLayout {
|
|
54
65
|
return () => ({
|
|
@@ -74,6 +85,7 @@ export function resolveWorkerPiAgentDir(config: LeitwerkConfig, mountPath?: stri
|
|
|
74
85
|
: expandPiAgentDir(config.pi.agent_dir);
|
|
75
86
|
}
|
|
76
87
|
|
|
88
|
+
/** @internal */
|
|
77
89
|
export function createWorkerStorageLayout(config: LeitwerkConfig): WorkerStorageLayout {
|
|
78
90
|
if (config.workers.runner === "docker" || config.workers.runner === "kubernetes") {
|
|
79
91
|
return createProcessVolumeWorkerStorageLayout({
|