@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
|
@@ -13,11 +13,39 @@ import type { RepositoryBundle } from "./db/repositories.js";
|
|
|
13
13
|
import type { ProcessOperationCoordinator } from "./process-operation-coordinator.js";
|
|
14
14
|
import type { Broadcaster } from "./ws/broadcast.js";
|
|
15
15
|
|
|
16
|
+
/** @internal */
|
|
16
17
|
type ProcessQuestionRepos = Pick<
|
|
17
18
|
RepositoryBundle,
|
|
18
19
|
"events" | "leases" | "processes" | "questionRequests" | "transaction" | "turnRecords"
|
|
19
20
|
>;
|
|
20
21
|
|
|
22
|
+
/** @internal */
|
|
23
|
+
type SubmitAnswersResult =
|
|
24
|
+
| {
|
|
25
|
+
/** @internal */
|
|
26
|
+
ok: true;
|
|
27
|
+
/** @internal */
|
|
28
|
+
request: ProcessQuestionRequest;
|
|
29
|
+
}
|
|
30
|
+
| {
|
|
31
|
+
/** @internal */
|
|
32
|
+
ok: false;
|
|
33
|
+
/** @internal */
|
|
34
|
+
code: "not_found" | "invalid";
|
|
35
|
+
/** @internal */
|
|
36
|
+
message: string;
|
|
37
|
+
}
|
|
38
|
+
| {
|
|
39
|
+
/** @internal */
|
|
40
|
+
ok: false;
|
|
41
|
+
/** @internal */
|
|
42
|
+
code: "not_current";
|
|
43
|
+
/** @internal */
|
|
44
|
+
message: string;
|
|
45
|
+
/** @internal */
|
|
46
|
+
request: ProcessQuestionRequest;
|
|
47
|
+
};
|
|
48
|
+
|
|
21
49
|
function isCurrentRequest(repos: ProcessQuestionRepos, request: ProcessQuestionRequest): boolean {
|
|
22
50
|
const process = repos.processes.getById(request.instanceId);
|
|
23
51
|
const turn = repos.turnRecords.getById(request.turnRecordId);
|
|
@@ -30,16 +58,23 @@ function isCurrentRequest(repos: ProcessQuestionRepos, request: ProcessQuestionR
|
|
|
30
58
|
);
|
|
31
59
|
}
|
|
32
60
|
|
|
61
|
+
/** @internal */
|
|
33
62
|
export function createProcessQuestionService(input: {
|
|
63
|
+
/** @internal */
|
|
34
64
|
repos: ProcessQuestionRepos;
|
|
65
|
+
/** @internal */
|
|
35
66
|
processOperations: ProcessOperationCoordinator;
|
|
67
|
+
/** @internal */
|
|
36
68
|
broadcaster: Broadcaster;
|
|
69
|
+
/** @internal */
|
|
37
70
|
getWorkerId: (instanceId: string) => string | null;
|
|
71
|
+
/** @internal */
|
|
38
72
|
sendQuestionResponse: (
|
|
39
73
|
instanceId: string,
|
|
40
74
|
workerId: string,
|
|
41
75
|
payload: WorkerQuestionResponsePayload,
|
|
42
76
|
) => void;
|
|
77
|
+
/** @internal */
|
|
43
78
|
emitQuestionRequested?: (request: ProcessQuestionRequest) => void | Promise<void>;
|
|
44
79
|
}) {
|
|
45
80
|
const sendResponse = (instanceId: string, workerId: string, request: ProcessQuestionRequest) => {
|
|
@@ -51,7 +86,9 @@ export function createProcessQuestionService(input: {
|
|
|
51
86
|
});
|
|
52
87
|
};
|
|
53
88
|
return {
|
|
89
|
+
/** @internal */
|
|
54
90
|
listOpen: (instanceId?: string) => input.repos.questionRequests.listOpen(instanceId),
|
|
91
|
+
/** @internal */
|
|
55
92
|
async handleWorkerRequest(
|
|
56
93
|
instanceId: string,
|
|
57
94
|
workerLeaseId: string,
|
|
@@ -117,27 +154,28 @@ export function createProcessQuestionService(input: {
|
|
|
117
154
|
instanceId,
|
|
118
155
|
);
|
|
119
156
|
},
|
|
157
|
+
/** @internal */
|
|
120
158
|
async submitAnswers(
|
|
121
159
|
instanceId: string,
|
|
122
160
|
requestId: string,
|
|
123
161
|
draftInput: readonly QuestionAnswerDraft[],
|
|
124
162
|
actor: Actor,
|
|
125
|
-
) {
|
|
163
|
+
): Promise<SubmitAnswersResult> {
|
|
126
164
|
try {
|
|
127
165
|
const result = await input.processOperations.runExclusive(instanceId, () =>
|
|
128
|
-
input.repos.transaction((repos) => {
|
|
166
|
+
input.repos.transaction((repos): SubmitAnswersResult => {
|
|
129
167
|
const request = repos.questionRequests.getById(requestId);
|
|
130
168
|
if (!request || request.instanceId !== instanceId) {
|
|
131
169
|
return {
|
|
132
|
-
ok: false
|
|
133
|
-
code: "not_found"
|
|
170
|
+
ok: false,
|
|
171
|
+
code: "not_found",
|
|
134
172
|
message: "Question request not found",
|
|
135
173
|
};
|
|
136
174
|
}
|
|
137
175
|
if (request.status !== "open" || !isCurrentRequest(repos, request)) {
|
|
138
176
|
return {
|
|
139
|
-
ok: false
|
|
140
|
-
code: "not_current"
|
|
177
|
+
ok: false,
|
|
178
|
+
code: "not_current",
|
|
141
179
|
message: "Question request is no longer active",
|
|
142
180
|
request,
|
|
143
181
|
};
|
|
@@ -149,8 +187,8 @@ export function createProcessQuestionService(input: {
|
|
|
149
187
|
});
|
|
150
188
|
if (!answered) {
|
|
151
189
|
return {
|
|
152
|
-
ok: false
|
|
153
|
-
code: "not_current"
|
|
190
|
+
ok: false,
|
|
191
|
+
code: "not_current",
|
|
154
192
|
message: "Question request was answered elsewhere",
|
|
155
193
|
request: repos.questionRequests.getById(request.id) ?? request,
|
|
156
194
|
};
|
|
@@ -160,7 +198,10 @@ export function createProcessQuestionService(input: {
|
|
|
160
198
|
eventType: "question_answered",
|
|
161
199
|
data: { requestId: request.id, actorId: actor.id },
|
|
162
200
|
});
|
|
163
|
-
return {
|
|
201
|
+
return {
|
|
202
|
+
ok: true,
|
|
203
|
+
request: answered,
|
|
204
|
+
};
|
|
164
205
|
}),
|
|
165
206
|
);
|
|
166
207
|
if (!result.ok) return result;
|
|
@@ -174,8 +215,8 @@ export function createProcessQuestionService(input: {
|
|
|
174
215
|
return result;
|
|
175
216
|
} catch (error) {
|
|
176
217
|
return {
|
|
177
|
-
ok: false
|
|
178
|
-
code: "invalid"
|
|
218
|
+
ok: false,
|
|
219
|
+
code: "invalid",
|
|
179
220
|
message: error instanceof Error ? error.message : String(error),
|
|
180
221
|
};
|
|
181
222
|
}
|
|
@@ -183,4 +224,5 @@ export function createProcessQuestionService(input: {
|
|
|
183
224
|
};
|
|
184
225
|
}
|
|
185
226
|
|
|
227
|
+
/** @internal */
|
|
186
228
|
export type ProcessQuestionService = ReturnType<typeof createProcessQuestionService>;
|
|
@@ -11,7 +11,8 @@ export interface ProcessRuntimeAvailabilityDeps {
|
|
|
11
11
|
|
|
12
12
|
export interface ResolvedKubernetesDockerConfig {
|
|
13
13
|
runtimeClassName: string;
|
|
14
|
-
hostUsers
|
|
14
|
+
hostUsers?: boolean;
|
|
15
|
+
gvisor?: boolean;
|
|
15
16
|
processStorageClassName: string;
|
|
16
17
|
network?: import("./config/config-types.js").KubernetesDockerConfig["network"];
|
|
17
18
|
}
|
|
@@ -23,14 +24,14 @@ export function resolveKubernetesDockerConfig(
|
|
|
23
24
|
const docker = config.kubernetes?.docker;
|
|
24
25
|
if (
|
|
25
26
|
!docker?.runtime_class_name?.trim() ||
|
|
26
|
-
typeof docker.host_users !== "boolean" ||
|
|
27
|
+
(docker.gvisor ? docker.host_users !== undefined : typeof docker.host_users !== "boolean") ||
|
|
27
28
|
!docker.process_storage_class_name?.trim()
|
|
28
29
|
) {
|
|
29
30
|
return undefined;
|
|
30
31
|
}
|
|
31
32
|
return {
|
|
32
33
|
runtimeClassName: docker.runtime_class_name,
|
|
33
|
-
hostUsers: docker.host_users,
|
|
34
|
+
...(docker.gvisor ? { gvisor: true } : { hostUsers: docker.host_users }),
|
|
34
35
|
processStorageClassName: docker.process_storage_class_name,
|
|
35
36
|
...(docker.network ? { network: docker.network } : {}),
|
|
36
37
|
};
|
|
@@ -31,10 +31,11 @@ import {
|
|
|
31
31
|
* unchanged. Sources may capture content while producing a handle so its
|
|
32
32
|
* signature and payload come from the same storage generation.
|
|
33
33
|
*/
|
|
34
|
+
/** @internal */
|
|
34
35
|
export interface ProcessSessionSnapshotHandle {
|
|
35
|
-
/** Opaque value that changes whenever the underlying session content changes. */
|
|
36
|
+
/** Opaque value that changes whenever the underlying session content changes. @internal */
|
|
36
37
|
signature: string;
|
|
37
|
-
/** Loads the raw session JSONL content captured by this handle. */
|
|
38
|
+
/** Loads the raw session JSONL content captured by this handle. @internal */
|
|
38
39
|
load(): Promise<string>;
|
|
39
40
|
}
|
|
40
41
|
|
|
@@ -47,8 +48,9 @@ export interface ProcessSessionSnapshotHandle {
|
|
|
47
48
|
* represents the server copy of the session JSONL rather than a requirement to
|
|
48
49
|
* mount or inspect worker volumes.
|
|
49
50
|
*/
|
|
51
|
+
/** @internal */
|
|
50
52
|
export interface ProcessSessionSource {
|
|
51
|
-
/** Returns a handle for the instance, or `null` when no session exists yet. */
|
|
53
|
+
/** Returns a handle for the instance, or `null` when no session exists yet. @internal */
|
|
52
54
|
readSnapshotHandle(instanceId: string): Promise<ProcessSessionSnapshotHandle | null>;
|
|
53
55
|
}
|
|
54
56
|
|
|
@@ -76,9 +78,13 @@ interface CachedSessionTree {
|
|
|
76
78
|
parsedTree: ParsedInstanceTree;
|
|
77
79
|
}
|
|
78
80
|
|
|
81
|
+
/** @internal */
|
|
79
82
|
export interface ProcessSessionTreeReadResult {
|
|
83
|
+
/** @internal */
|
|
80
84
|
signature: string | null;
|
|
85
|
+
/** @internal */
|
|
81
86
|
piTree: ReadonlyPiSessionTree;
|
|
87
|
+
/** @internal */
|
|
82
88
|
parsedTree: ParsedInstanceTree;
|
|
83
89
|
}
|
|
84
90
|
|
|
@@ -89,12 +95,15 @@ export interface ProcessSessionTreeReadResult {
|
|
|
89
95
|
* capture and failed-turn continuation) go through this seam so
|
|
90
96
|
* the server never reads worker filesystems directly.
|
|
91
97
|
*/
|
|
98
|
+
/** @internal */
|
|
92
99
|
export class ProcessSessionReader {
|
|
93
100
|
private readonly sessionTreeCache = new Map<string, CachedSessionTree>();
|
|
94
101
|
private readonly inFlightReads = new Map<string, Promise<CachedSessionTree>>();
|
|
95
102
|
|
|
103
|
+
/** @internal */
|
|
96
104
|
constructor(private readonly source: ProcessSessionSource) {}
|
|
97
105
|
|
|
106
|
+
/** @internal */
|
|
98
107
|
async readSessionTree(instanceId: string): Promise<ProcessSessionTreeReadResult> {
|
|
99
108
|
for (let attempt = 0; attempt < 3; attempt += 1) {
|
|
100
109
|
const handle = await this.source.readSnapshotHandle(instanceId);
|
|
@@ -122,10 +131,12 @@ export class ProcessSessionReader {
|
|
|
122
131
|
throw new Error(`Unable to read process session snapshot '${instanceId}'`);
|
|
123
132
|
}
|
|
124
133
|
|
|
134
|
+
/** @internal */
|
|
125
135
|
async readInstanceTree(instanceId: string): Promise<ParsedInstanceTree> {
|
|
126
136
|
return (await this.readSessionTree(instanceId)).parsedTree;
|
|
127
137
|
}
|
|
128
138
|
|
|
139
|
+
/** @internal */
|
|
129
140
|
async readPiSessionTree(instanceId: string): Promise<ReadonlyPiSessionTree> {
|
|
130
141
|
return (await this.readSessionTree(instanceId)).piTree;
|
|
131
142
|
}
|
|
@@ -159,7 +170,7 @@ export class ProcessSessionReader {
|
|
|
159
170
|
return promise;
|
|
160
171
|
}
|
|
161
172
|
|
|
162
|
-
/** Returns the raw session JSONL, or `null` when no session exists yet. */
|
|
173
|
+
/** Returns the raw session JSONL, or `null` when no session exists yet. @internal */
|
|
163
174
|
async readRawContent(instanceId: string): Promise<string | null> {
|
|
164
175
|
for (let attempt = 0; attempt < 3; attempt += 1) {
|
|
165
176
|
const handle = await this.source.readSnapshotHandle(instanceId);
|
|
@@ -26,24 +26,38 @@ const MAX_SOURCE_FIELDS = 6;
|
|
|
26
26
|
const DEFAULT_TITLE_GENERATION_POLL_INTERVAL_MS = 1_000;
|
|
27
27
|
const PI_AGENT_DIR_ENV = "PI_CODING_AGENT_DIR";
|
|
28
28
|
|
|
29
|
+
/** @internal */
|
|
29
30
|
type ProcessTitleRepos = Pick<RepositoryBundle, "futureExecutions" | "processes" | "titleJobs">;
|
|
30
31
|
|
|
32
|
+
/** @internal */
|
|
31
33
|
export interface ProcessTitleLogger {
|
|
34
|
+
/** @internal */
|
|
32
35
|
warn(message: string, details?: Record<string, unknown>): void;
|
|
33
36
|
}
|
|
34
37
|
|
|
38
|
+
/** @internal */
|
|
35
39
|
export interface ProcessTitleGenerator {
|
|
40
|
+
/** @internal */
|
|
36
41
|
start?(): Promise<void>;
|
|
42
|
+
/** @internal */
|
|
37
43
|
queueProcessTitleGeneration(input: {
|
|
44
|
+
/** @internal */
|
|
38
45
|
processId: string;
|
|
46
|
+
/** @internal */
|
|
39
47
|
launchPlan: ProcessLaunchPlan;
|
|
48
|
+
/** @internal */
|
|
40
49
|
launchRunId?: string;
|
|
41
50
|
}): void;
|
|
51
|
+
/** @internal */
|
|
42
52
|
queueFutureExecutionTitleGeneration(input: {
|
|
53
|
+
/** @internal */
|
|
43
54
|
futureExecutionId: string;
|
|
55
|
+
/** @internal */
|
|
44
56
|
launchPlan: ProcessLaunchPlan;
|
|
57
|
+
/** @internal */
|
|
45
58
|
expectedPayloadJson?: string;
|
|
46
59
|
}): void;
|
|
60
|
+
/** @internal */
|
|
47
61
|
close?(): Promise<void>;
|
|
48
62
|
}
|
|
49
63
|
|
|
@@ -52,34 +66,74 @@ interface ProcessTitleRuntimeDiagnosticSummary {
|
|
|
52
66
|
message: string;
|
|
53
67
|
}
|
|
54
68
|
|
|
69
|
+
/** @internal */
|
|
55
70
|
interface ProcessTitleProviderOptions {
|
|
71
|
+
/** @internal */
|
|
56
72
|
timeoutMs?: number;
|
|
73
|
+
/** @internal */
|
|
57
74
|
maxRetries?: number;
|
|
75
|
+
/** @internal */
|
|
58
76
|
maxRetryDelayMs: number;
|
|
59
77
|
}
|
|
60
78
|
|
|
79
|
+
/** @internal */
|
|
61
80
|
export type FutureExecutionTitleApplier = (input: {
|
|
81
|
+
/** @internal */
|
|
62
82
|
futureExecutionId: string;
|
|
83
|
+
/** @internal */
|
|
63
84
|
expectedPayloadJson: string;
|
|
85
|
+
/** @internal */
|
|
64
86
|
title: string;
|
|
65
87
|
}) => Promise<
|
|
66
|
-
| {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
88
|
+
| {
|
|
89
|
+
/** @internal */
|
|
90
|
+
kind: "applied";
|
|
91
|
+
}
|
|
92
|
+
| {
|
|
93
|
+
/** @internal */
|
|
94
|
+
kind: "applied_with_reaction_error";
|
|
95
|
+
/** @internal */
|
|
96
|
+
error: string;
|
|
97
|
+
/** @internal */
|
|
98
|
+
code: string;
|
|
99
|
+
}
|
|
100
|
+
| {
|
|
101
|
+
/** @internal */
|
|
102
|
+
kind: "superseded";
|
|
103
|
+
}
|
|
104
|
+
| {
|
|
105
|
+
/** @internal */
|
|
106
|
+
kind: "failed";
|
|
107
|
+
/** @internal */
|
|
108
|
+
error: string;
|
|
109
|
+
}
|
|
70
110
|
>;
|
|
71
111
|
|
|
112
|
+
/** @internal */
|
|
72
113
|
export interface ProcessTitleGeneratorRuntimeDeps {
|
|
114
|
+
/** @internal */
|
|
73
115
|
generateTitle(input: {
|
|
116
|
+
/** @internal */
|
|
74
117
|
expandedAgentDir: string;
|
|
118
|
+
/** @internal */
|
|
75
119
|
provider: string;
|
|
120
|
+
/** @internal */
|
|
76
121
|
modelId: string;
|
|
122
|
+
/** @internal */
|
|
77
123
|
prompt: string;
|
|
124
|
+
/** @internal */
|
|
78
125
|
maxTokens: number;
|
|
126
|
+
/** @internal */
|
|
79
127
|
providerOptions: ProcessTitleProviderOptions;
|
|
80
128
|
}): Promise<string>;
|
|
81
|
-
|
|
129
|
+
/** @internal */
|
|
130
|
+
defer(work: () => void): {
|
|
131
|
+
/** @internal */
|
|
132
|
+
unref?(): void;
|
|
133
|
+
};
|
|
134
|
+
/** @internal */
|
|
82
135
|
now(): Date;
|
|
136
|
+
/** @internal */
|
|
83
137
|
pollIntervalMs: number;
|
|
84
138
|
}
|
|
85
139
|
|
|
@@ -122,6 +176,7 @@ function getFutureExecutionTitleJobTarget(job: ProcessTitleJob): FutureExecution
|
|
|
122
176
|
};
|
|
123
177
|
}
|
|
124
178
|
|
|
179
|
+
/** @internal */
|
|
125
180
|
export function normalizeProcessTitle(value: string | null | undefined): string | null {
|
|
126
181
|
const trimmed = trimToNull(value);
|
|
127
182
|
if (!trimmed) {
|
|
@@ -146,6 +201,7 @@ function normalizeSourceValue(value: string): string | null {
|
|
|
146
201
|
return truncateTextAtWordBoundary(trimmed.replace(/\s+/g, " "), MAX_SOURCE_VALUE_LENGTH);
|
|
147
202
|
}
|
|
148
203
|
|
|
204
|
+
/** @internal */
|
|
149
205
|
export function buildProcessTitleSourceFields(
|
|
150
206
|
launchPlan: ProcessLaunchPlan,
|
|
151
207
|
): ProcessTitleSourceField[] {
|
|
@@ -168,6 +224,7 @@ export function buildProcessTitleSourceFields(
|
|
|
168
224
|
return [...normalized.values()];
|
|
169
225
|
}
|
|
170
226
|
|
|
227
|
+
/** @internal */
|
|
171
228
|
export function buildProcessTitlePrompt(launchPlan: ProcessLaunchPlan): string | null {
|
|
172
229
|
const fields = buildProcessTitleSourceFields(launchPlan);
|
|
173
230
|
if (fields.length === 0) {
|
|
@@ -834,14 +891,23 @@ class DefaultProcessTitleGenerator implements ProcessTitleGenerator {
|
|
|
834
891
|
}
|
|
835
892
|
}
|
|
836
893
|
|
|
894
|
+
/** @internal */
|
|
837
895
|
export function createProcessTitleGenerator(options: {
|
|
896
|
+
/** @internal */
|
|
838
897
|
config: LeitwerkConfig;
|
|
898
|
+
/** @internal */
|
|
839
899
|
repos: ProcessTitleRepos;
|
|
900
|
+
/** @internal */
|
|
840
901
|
broadcaster: Broadcaster;
|
|
902
|
+
/** @internal */
|
|
841
903
|
logger?: ProcessTitleLogger;
|
|
904
|
+
/** @internal */
|
|
842
905
|
runtime?: Partial<ProcessTitleGeneratorRuntimeDeps>;
|
|
906
|
+
/** @internal */
|
|
843
907
|
extensionHost?: ExtensionHost;
|
|
908
|
+
/** @internal */
|
|
844
909
|
futureExecutionTitleApplier?: FutureExecutionTitleApplier;
|
|
910
|
+
/** @internal */
|
|
845
911
|
getLaunchCoordinator?: () => LaunchCoordinator | undefined;
|
|
846
912
|
}): ProcessTitleGenerator {
|
|
847
913
|
const runtime = { ...createDefaultRuntimeDeps(), ...options.runtime };
|
|
@@ -8,7 +8,10 @@ export function presentProcessTurnNavigation(input: {
|
|
|
8
8
|
turns: readonly ProcessTimelineTurnSummary[];
|
|
9
9
|
selectedTurnId: string | null;
|
|
10
10
|
lifecycleStatus: ProcessLifecycleStatus;
|
|
11
|
-
}) {
|
|
11
|
+
}): {
|
|
12
|
+
turns: ProcessTimelineTurnSummary[];
|
|
13
|
+
plannedNextTurn: { turnId: string; description: string } | null;
|
|
14
|
+
} {
|
|
12
15
|
const path = input.graph.happyPath ?? [];
|
|
13
16
|
const currentIndex = path.indexOf(input.selectedTurnId ?? "");
|
|
14
17
|
const nextId =
|
|
@@ -82,6 +82,7 @@ function extractToolResultValue(message: PiSessionMessageRecord): unknown {
|
|
|
82
82
|
return message.content ?? null;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
/** @internal */
|
|
85
86
|
type TraceTurnRecord = Pick<
|
|
86
87
|
ProcessTurnRecord,
|
|
87
88
|
"id" | "turnType" | "forkPiEntryId" | "resultPiEntryId" | "startedAt" | "endedAt" | "status"
|
|
@@ -437,6 +438,7 @@ export function buildCommittedTurnTrace(input: {
|
|
|
437
438
|
return trace;
|
|
438
439
|
}
|
|
439
440
|
|
|
441
|
+
/** @internal */
|
|
440
442
|
export function buildTurnTracePreview(
|
|
441
443
|
turnRecordId: string,
|
|
442
444
|
trace: TurnTraceSnapshot | undefined,
|
|
@@ -477,9 +479,13 @@ export function buildTurnTracePreview(
|
|
|
477
479
|
};
|
|
478
480
|
}
|
|
479
481
|
|
|
482
|
+
/** @internal */
|
|
480
483
|
interface TurnTraceCollectionInput {
|
|
484
|
+
/** @internal */
|
|
481
485
|
tree: ReadonlyPiSessionTree;
|
|
486
|
+
/** @internal */
|
|
482
487
|
turnRecords: readonly TraceTurnRecord[];
|
|
488
|
+
/** @internal */
|
|
483
489
|
events?: readonly ProcessEvent[];
|
|
484
490
|
}
|
|
485
491
|
|
|
@@ -514,6 +520,7 @@ export function buildTurnTracePreviewsFromSession(
|
|
|
514
520
|
return previews;
|
|
515
521
|
}
|
|
516
522
|
|
|
523
|
+
/** @internal */
|
|
517
524
|
export function buildTurnTraceIndexFromSession(
|
|
518
525
|
input: TurnTraceCollectionInput,
|
|
519
526
|
): Record<string, TurnTraceSnapshot> {
|
|
@@ -2,7 +2,9 @@ import type { ExtensionCatalog } from "@leitwerk-dev/extension-runtime";
|
|
|
2
2
|
import type { ProcessLeafOutcomeDefinition } from "@leitwerk-dev/process-sdk";
|
|
3
3
|
import { buildUiProcessDefinition } from "@leitwerk-dev/process-sdk";
|
|
4
4
|
|
|
5
|
+
/** @internal */
|
|
5
6
|
export interface ProcessUiRegistry {
|
|
7
|
+
/** @internal */
|
|
6
8
|
getLeafOutcomeDefinition(processId: string): ProcessLeafOutcomeDefinition | undefined;
|
|
7
9
|
}
|
|
8
10
|
|
|
@@ -444,14 +444,23 @@ function createCompletedTurnRecord(args: {
|
|
|
444
444
|
};
|
|
445
445
|
}
|
|
446
446
|
|
|
447
|
+
/** @internal */
|
|
447
448
|
export function presentProcessTimelineTurns(input: {
|
|
449
|
+
/** @internal */
|
|
448
450
|
process: ProcessInstance;
|
|
451
|
+
/** @internal */
|
|
449
452
|
currentExecutionTurnRecordId?: string | null;
|
|
453
|
+
/** @internal */
|
|
450
454
|
turnRecords: readonly ProcessTurnRecord[];
|
|
455
|
+
/** @internal */
|
|
451
456
|
turnAnnotations: readonly ProcessTurnAnnotation[];
|
|
457
|
+
/** @internal */
|
|
452
458
|
events: readonly ProcessEvent[];
|
|
459
|
+
/** @internal */
|
|
453
460
|
activeTurn: PrimaryPathSnapshot["turnState"]["activeTurn"] | CompactActiveTurnSnapshot;
|
|
461
|
+
/** @internal */
|
|
454
462
|
selectedTurnType: ProcessTurnRecord["turnType"] | null;
|
|
463
|
+
/** @internal */
|
|
455
464
|
activeModelProfileId?: string | null;
|
|
456
465
|
}): ProcessTimelineTurnSummary[] {
|
|
457
466
|
const outcomeEventsByTurnRecordId = createTurnOutcomeEventMap(input.events);
|
|
@@ -710,9 +719,13 @@ function joinDetails(...parts: Array<string | null>): string | null {
|
|
|
710
719
|
return joined.length > 0 ? joined : null;
|
|
711
720
|
}
|
|
712
721
|
|
|
722
|
+
/** @internal */
|
|
713
723
|
export function buildExternalTriggerSignals(args: {
|
|
724
|
+
/** @internal */
|
|
714
725
|
externalTriggers: readonly ProcessExternalTriggerSummary[];
|
|
726
|
+
/** @internal */
|
|
715
727
|
events: readonly ProcessEvent[];
|
|
728
|
+
/** @internal */
|
|
716
729
|
isWaitingForSelectedTurn: boolean;
|
|
717
730
|
}): ProcessExternalTriggerSignal[] {
|
|
718
731
|
return args.externalTriggers.map((trigger) => {
|
|
@@ -844,13 +857,28 @@ export function formatProcessErrorPresentation(
|
|
|
844
857
|
};
|
|
845
858
|
}
|
|
846
859
|
|
|
860
|
+
/** @internal */
|
|
847
861
|
export function buildCurrentTurnRecovery(input: {
|
|
862
|
+
/** @internal */
|
|
848
863
|
process: ProcessInstance;
|
|
849
|
-
|
|
864
|
+
/** @internal */
|
|
865
|
+
turnStarts: {
|
|
866
|
+
/** @internal */
|
|
867
|
+
getById(id: string): import("@leitwerk-dev/domain").TurnStartRecord | null;
|
|
868
|
+
};
|
|
869
|
+
/** @internal */
|
|
850
870
|
turnRecords: readonly ProcessTurnRecord[];
|
|
871
|
+
/** @internal */
|
|
851
872
|
selectedTurnDescription: string | null;
|
|
873
|
+
/** @internal */
|
|
852
874
|
piEntries: readonly PiSessionEntry[];
|
|
853
|
-
|
|
875
|
+
/** @internal */
|
|
876
|
+
continuation?: {
|
|
877
|
+
/** @internal */
|
|
878
|
+
hasProgress: boolean;
|
|
879
|
+
/** @internal */
|
|
880
|
+
userPrompt: string | null;
|
|
881
|
+
};
|
|
854
882
|
}): CurrentTurnRecoverySummary | null {
|
|
855
883
|
if (input.process.lifecycleStatus !== "error") {
|
|
856
884
|
return null;
|
|
@@ -907,10 +935,15 @@ export function buildCurrentTurnRecovery(input: {
|
|
|
907
935
|
};
|
|
908
936
|
}
|
|
909
937
|
|
|
938
|
+
/** @internal */
|
|
910
939
|
export function buildCurrentProcessError(input: {
|
|
940
|
+
/** @internal */
|
|
911
941
|
process: ProcessInstance;
|
|
942
|
+
/** @internal */
|
|
912
943
|
events: readonly ProcessEvent[];
|
|
944
|
+
/** @internal */
|
|
913
945
|
selectedTurnDescription: string | null;
|
|
946
|
+
/** @internal */
|
|
914
947
|
currentTurnRecovery: CurrentTurnRecoverySummary | null;
|
|
915
948
|
}): CurrentProcessErrorSummary | null {
|
|
916
949
|
if (input.process.lifecycleStatus !== "error" || input.currentTurnRecovery) {
|
|
@@ -938,11 +971,17 @@ export function buildCurrentProcessError(input: {
|
|
|
938
971
|
};
|
|
939
972
|
}
|
|
940
973
|
|
|
974
|
+
/** @internal */
|
|
941
975
|
export function buildUsageEstimate(input: {
|
|
976
|
+
/** @internal */
|
|
942
977
|
turnRecords: readonly ProcessTurnRecord[];
|
|
978
|
+
/** @internal */
|
|
943
979
|
activeTurn: PrimaryPathSnapshot["turnState"]["activeTurn"] | CompactActiveTurnSnapshot;
|
|
980
|
+
/** @internal */
|
|
944
981
|
currentTurnRecordId: string | null;
|
|
982
|
+
/** @internal */
|
|
945
983
|
usageByTurnRecordId: Record<string, TurnTraceSnapshot["usage"]>;
|
|
984
|
+
/** @internal */
|
|
946
985
|
tracePreviewsByTurnRecordId: Record<string, TurnTracePreview>;
|
|
947
986
|
}): ProcessUsageEstimateSnapshot | null {
|
|
948
987
|
let usage: TurnTraceSnapshot["usage"] = null;
|
|
@@ -995,22 +1034,42 @@ export function buildUsageEstimate(input: {
|
|
|
995
1034
|
};
|
|
996
1035
|
}
|
|
997
1036
|
|
|
1037
|
+
/** @internal */
|
|
998
1038
|
export function buildProcessUiSnapshotProjections(input: {
|
|
1039
|
+
/** @internal */
|
|
999
1040
|
process: ProcessInstance;
|
|
1000
|
-
|
|
1041
|
+
/** @internal */
|
|
1042
|
+
turnStarts?: {
|
|
1043
|
+
/** @internal */
|
|
1044
|
+
getById(id: string): TurnStartRecord | null;
|
|
1045
|
+
};
|
|
1046
|
+
/** @internal */
|
|
1001
1047
|
startupTurnStarts?: readonly TurnStartRecord[];
|
|
1048
|
+
/** @internal */
|
|
1002
1049
|
workerLeases?: readonly WorkerLease[];
|
|
1050
|
+
/** @internal */
|
|
1003
1051
|
startupObservations?: readonly import("@leitwerk-dev/domain").StartupObservation[];
|
|
1052
|
+
/** @internal */
|
|
1004
1053
|
turnRecords: readonly ProcessTurnRecord[];
|
|
1054
|
+
/** @internal */
|
|
1005
1055
|
turnAnnotations: readonly ProcessTurnAnnotation[];
|
|
1056
|
+
/** @internal */
|
|
1006
1057
|
events: readonly ProcessEvent[];
|
|
1058
|
+
/** @internal */
|
|
1007
1059
|
inputs: readonly ProcessInput[];
|
|
1060
|
+
/** @internal */
|
|
1008
1061
|
selectedTurn: ProcessSelectedTurnSummary | null;
|
|
1062
|
+
/** @internal */
|
|
1009
1063
|
primaryPathSnapshot: PrimaryPathSnapshot | PrimaryPathUiSnapshot;
|
|
1064
|
+
/** @internal */
|
|
1010
1065
|
sessionTree?: ReadonlyPiSessionTree;
|
|
1066
|
+
/** @internal */
|
|
1011
1067
|
sessionSummary?: SessionSummary | null;
|
|
1068
|
+
/** @internal */
|
|
1012
1069
|
eventSummariesByTurnRecordId?: Record<string, CompactTurnSummary>;
|
|
1070
|
+
/** @internal */
|
|
1013
1071
|
eventUsageByTurnRecordId?: Record<string, TurnTraceSnapshot["usage"]>;
|
|
1072
|
+
/** @internal */
|
|
1014
1073
|
activeModelProfileId?: string | null;
|
|
1015
1074
|
}) {
|
|
1016
1075
|
const tracePreviewsByTurnRecordId = {
|
|
@@ -1087,10 +1146,15 @@ export function buildProcessUiSnapshotProjections(input: {
|
|
|
1087
1146
|
observations: input.startupObservations ?? [],
|
|
1088
1147
|
});
|
|
1089
1148
|
return {
|
|
1149
|
+
/** @internal */
|
|
1090
1150
|
process: projectProcessForUiSnapshot(input.process),
|
|
1151
|
+
/** @internal */
|
|
1091
1152
|
primaryPath: compactPrimaryPathSnapshot(input.primaryPathSnapshot),
|
|
1153
|
+
/** @internal */
|
|
1092
1154
|
timeline: {
|
|
1155
|
+
/** @internal */
|
|
1093
1156
|
prompt,
|
|
1157
|
+
/** @internal */
|
|
1094
1158
|
turns: presentProcessTimelineTurns({
|
|
1095
1159
|
process: input.process,
|
|
1096
1160
|
turnRecords: input.turnRecords,
|
|
@@ -1101,8 +1165,11 @@ export function buildProcessUiSnapshotProjections(input: {
|
|
|
1101
1165
|
selectedTurnType: input.selectedTurn?.kind ?? null,
|
|
1102
1166
|
activeModelProfileId: input.activeModelProfileId,
|
|
1103
1167
|
}),
|
|
1168
|
+
/** @internal */
|
|
1104
1169
|
tracePreviewsByTurnRecordId,
|
|
1170
|
+
/** @internal */
|
|
1105
1171
|
inputs: input.inputs.map(buildTimelineInputSummary),
|
|
1172
|
+
/** @internal */
|
|
1106
1173
|
externalTriggerSignals: buildExternalTriggerSignals({
|
|
1107
1174
|
externalTriggers: input.selectedTurn?.externalTriggers ?? [],
|
|
1108
1175
|
events: input.events,
|
|
@@ -1111,15 +1178,20 @@ export function buildProcessUiSnapshotProjections(input: {
|
|
|
1111
1178
|
(input.selectedTurn?.turnId ?? null) === (input.process.selectedTurnId ?? null),
|
|
1112
1179
|
}),
|
|
1113
1180
|
} satisfies ProcessTimelineSnapshot,
|
|
1181
|
+
/** @internal */
|
|
1114
1182
|
recovery,
|
|
1183
|
+
/** @internal */
|
|
1115
1184
|
startup,
|
|
1185
|
+
/** @internal */
|
|
1116
1186
|
startupRecovery: startup.recovery,
|
|
1187
|
+
/** @internal */
|
|
1117
1188
|
processError: buildCurrentProcessError({
|
|
1118
1189
|
process: input.process,
|
|
1119
1190
|
events: input.events,
|
|
1120
1191
|
selectedTurnDescription: input.selectedTurn?.description ?? null,
|
|
1121
1192
|
currentTurnRecovery: recovery,
|
|
1122
1193
|
}),
|
|
1194
|
+
/** @internal */
|
|
1123
1195
|
usageEstimate: buildUsageEstimate({
|
|
1124
1196
|
turnRecords: input.turnRecords,
|
|
1125
1197
|
activeTurn,
|
|
@@ -32,9 +32,13 @@ interface RegisteredProcessWatcher {
|
|
|
32
32
|
launchSkillIds: readonly string[];
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/** @public */
|
|
35
36
|
interface ProcessWatcherRegistryOptions {
|
|
37
|
+
/** @internal */
|
|
36
38
|
modelProfiles?: readonly LauncherModelProfileSummary[];
|
|
39
|
+
/** @internal */
|
|
37
40
|
getModelProfilesForProcess?: (processId: string) => readonly LauncherModelProfileSummary[];
|
|
41
|
+
/** @internal */
|
|
38
42
|
processModelPolicy?: ServerProcessModelPolicy;
|
|
39
43
|
}
|
|
40
44
|
|
|
@@ -161,6 +165,7 @@ function collectConfiguredProcessWatchers(input: {
|
|
|
161
165
|
return { watchers, errors };
|
|
162
166
|
}
|
|
163
167
|
|
|
168
|
+
/** @public */
|
|
164
169
|
export function buildProcessWatcherRegistry(
|
|
165
170
|
catalog: Pick<ExtensionCatalog, "processes">,
|
|
166
171
|
config: LeitwerkConfig,
|