@leitwerk-dev/server 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{app-WfwKzrVk.d.ts → app-CsuxFZT5.d.ts} +332 -111
- package/dist/app-JM4CBTND.js +8 -0
- package/dist/app.d.ts +9 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/auth/fastify-auth.d.ts +9 -0
- package/dist/auth/fastify-auth.d.ts.map +1 -1
- package/dist/{chunk-LK3RO6C7.js → chunk-FPMDWQF7.js} +3050 -645
- package/dist/chunk-FPMDWQF7.js.map +1 -0
- package/dist/{chunk-KIOQNNG6.js → chunk-MBHRCQFE.js} +2781 -1822
- package/dist/chunk-MBHRCQFE.js.map +1 -0
- package/dist/config/config-loader.d.ts +1 -1
- package/dist/config/config-loader.d.ts.map +1 -1
- package/dist/config/config-types.d.ts +14 -1
- package/dist/config/config-types.d.ts.map +1 -1
- package/dist/config/kubernetes-docker-isolation.d.ts +7 -0
- package/dist/config/kubernetes-docker-isolation.d.ts.map +1 -0
- package/dist/db/database.d.ts.map +1 -1
- package/dist/db/execution-inspection-repo.d.ts +15 -0
- package/dist/db/execution-inspection-repo.d.ts.map +1 -0
- package/dist/db/history-window.d.ts +11 -0
- package/dist/db/history-window.d.ts.map +1 -0
- package/dist/db/mapped-llm-run-repo.d.ts +56 -0
- package/dist/db/mapped-llm-run-repo.d.ts.map +1 -0
- package/dist/db/process-event-repo.d.ts +2 -0
- package/dist/db/process-event-repo.d.ts.map +1 -1
- package/dist/db/process-instance-repo.d.ts +4 -1
- package/dist/db/process-instance-repo.d.ts.map +1 -1
- package/dist/db/process-leaf-outcome-snapshot-repo.d.ts +2 -1
- package/dist/db/process-leaf-outcome-snapshot-repo.d.ts.map +1 -1
- package/dist/db/process-project-repo.d.ts +2 -0
- package/dist/db/process-project-repo.d.ts.map +1 -1
- package/dist/db/process-skill-repo.d.ts.map +1 -1
- package/dist/db/process-turn-annotation-repo.d.ts +4 -1
- package/dist/db/process-turn-annotation-repo.d.ts.map +1 -1
- package/dist/db/process-turn-record-repo.d.ts +7 -1
- package/dist/db/process-turn-record-repo.d.ts.map +1 -1
- package/dist/db/publication-repo.d.ts +5 -0
- package/dist/db/publication-repo.d.ts.map +1 -0
- package/dist/db/repo-helpers.d.ts +6 -0
- package/dist/db/repo-helpers.d.ts.map +1 -1
- package/dist/db/repositories.d.ts +16 -0
- package/dist/db/repositories.d.ts.map +1 -1
- package/dist/db/schema.d.ts +1177 -71
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/scoped-settings-repo.d.ts +37 -0
- package/dist/db/scoped-settings-repo.d.ts.map +1 -0
- package/dist/db/skill-repo.d.ts +3 -0
- package/dist/db/skill-repo.d.ts.map +1 -1
- package/dist/db/turn-start-record-repo.d.ts +2 -1
- package/dist/db/turn-start-record-repo.d.ts.map +1 -1
- package/dist/db/turn-summary-repo.d.ts +1 -1
- package/dist/db/turn-summary-repo.d.ts.map +1 -1
- package/dist/db/worker-lease-repo.d.ts +2 -1
- package/dist/db/worker-lease-repo.d.ts.map +1 -1
- package/dist/domain-logic/outcome-tools.d.ts.map +1 -1
- package/dist/external-source-service.d.ts.map +1 -1
- package/dist/future-execution/execution.d.ts +4 -1
- package/dist/future-execution/execution.d.ts.map +1 -1
- package/dist/future-execution/launch-lifecycle.d.ts +9 -25
- package/dist/future-execution/launch-lifecycle.d.ts.map +1 -1
- package/dist/future-execution/lifecycle.d.ts +3 -28
- package/dist/future-execution/lifecycle.d.ts.map +1 -1
- package/dist/future-execution/model-projection.d.ts.map +1 -1
- package/dist/future-execution/reconciliation.d.ts +1 -0
- package/dist/future-execution/reconciliation.d.ts.map +1 -1
- package/dist/future-execution-presenter.d.ts +4 -14
- package/dist/future-execution-presenter.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/integration-tool-registry.d.ts +11 -2
- package/dist/integration-tool-registry.d.ts.map +1 -1
- package/dist/launch-coordinator-test-harness.d.ts.map +1 -1
- package/dist/launch-coordinator.d.ts.map +1 -1
- package/dist/launcher-model-config-service.d.ts +7 -1
- package/dist/launcher-model-config-service.d.ts.map +1 -1
- package/dist/leaf-outcome-snapshot-capture.d.ts +1 -0
- package/dist/leaf-outcome-snapshot-capture.d.ts.map +1 -1
- package/dist/main.js +3 -3
- package/dist/primary-path-snapshot.d.ts.map +1 -1
- package/dist/process-action-presenter.d.ts +11 -0
- package/dist/process-action-presenter.d.ts.map +1 -0
- package/dist/process-action-registry.d.ts.map +1 -1
- package/dist/process-engine/decision.d.ts +2 -0
- package/dist/process-engine/decision.d.ts.map +1 -1
- package/dist/process-engine/engine.d.ts.map +1 -1
- package/dist/process-engine/mapped-turns.d.ts +45 -0
- package/dist/process-engine/mapped-turns.d.ts.map +1 -0
- package/dist/process-engine/operation.d.ts +1 -1
- package/dist/process-engine/operation.d.ts.map +1 -1
- package/dist/process-engine/ops/accept-worker-turn-start.d.ts +2 -0
- package/dist/process-engine/ops/accept-worker-turn-start.d.ts.map +1 -1
- package/dist/process-engine/ops/continue-failed-turn.d.ts.map +1 -1
- package/dist/process-engine/ops/process-observation.d.ts +6 -0
- package/dist/process-engine/ops/process-observation.d.ts.map +1 -0
- package/dist/process-engine/ops/retry-failed-turn.d.ts.map +1 -1
- package/dist/process-engine/ops/retry-startup.d.ts.map +1 -1
- package/dist/process-engine/ops/start-process.d.ts +2 -0
- package/dist/process-engine/ops/start-process.d.ts.map +1 -1
- package/dist/process-engine/ops/turn-outcome.d.ts.map +1 -1
- package/dist/process-engine/ops/turn-wait.d.ts +30 -0
- package/dist/process-engine/ops/turn-wait.d.ts.map +1 -0
- package/dist/process-engine/ops/update-model-config.d.ts +9 -0
- package/dist/process-engine/ops/update-model-config.d.ts.map +1 -0
- package/dist/process-engine/recorder.d.ts.map +1 -1
- package/dist/process-engine/turn-start-preflight.d.ts +6 -0
- package/dist/process-engine/turn-start-preflight.d.ts.map +1 -1
- package/dist/process-engine/turn-wait-state.d.ts +24 -0
- package/dist/process-engine/turn-wait-state.d.ts.map +1 -0
- package/dist/process-engine/turn-worker-requirement.d.ts +2 -0
- package/dist/process-engine/turn-worker-requirement.d.ts.map +1 -1
- package/dist/process-engine/types.d.ts +10 -1
- package/dist/process-engine/types.d.ts.map +1 -1
- package/dist/process-engine/writes/build-process-abort-writes.d.ts +3 -1
- package/dist/process-engine/writes/build-process-abort-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-recovery-start-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-turn-outcome-writes.d.ts +10 -1
- package/dist/process-engine/writes/build-turn-outcome-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-turn-selection-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/commit-writes.d.ts +2 -0
- package/dist/process-engine/writes/commit-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/reserve-selected-turn-start.d.ts +5 -0
- package/dist/process-engine/writes/reserve-selected-turn-start.d.ts.map +1 -0
- package/dist/process-engine/writes/writes.d.ts +35 -49
- 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-inspection-reader.d.ts +21 -0
- package/dist/process-inspection-reader.d.ts.map +1 -0
- package/dist/process-inspection-trace.d.ts +13 -0
- package/dist/process-inspection-trace.d.ts.map +1 -0
- package/dist/process-inspection.d.ts +22 -0
- package/dist/process-inspection.d.ts.map +1 -0
- package/dist/process-instance-tree-presenter.d.ts +4 -3
- package/dist/process-instance-tree-presenter.d.ts.map +1 -1
- package/dist/process-launch-executor.d.ts +2 -0
- package/dist/process-launch-executor.d.ts.map +1 -1
- package/dist/process-launch-plan.d.ts +1 -0
- package/dist/process-launch-plan.d.ts.map +1 -1
- package/dist/process-launcher-registry.d.ts.map +1 -1
- package/dist/process-model-config.d.ts +19 -0
- package/dist/process-model-config.d.ts.map +1 -0
- package/dist/process-model-policy/construct.d.ts.map +1 -1
- package/dist/process-model-policy/evaluate.d.ts.map +1 -1
- package/dist/process-model-policy/index.d.ts +4 -1
- package/dist/process-model-policy/index.d.ts.map +1 -1
- package/dist/process-model-policy/project.d.ts.map +1 -1
- package/dist/process-model-policy/types.d.ts +18 -0
- package/dist/process-model-policy/types.d.ts.map +1 -1
- package/dist/process-model-policy-presenter.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-turn-navigation.d.ts +12 -2
- package/dist/process-turn-navigation.d.ts.map +1 -1
- package/dist/process-turn-trace.d.ts.map +1 -1
- package/dist/process-ui-snapshot-presenter.d.ts +15 -3
- package/dist/process-ui-snapshot-presenter.d.ts.map +1 -1
- package/dist/routes/future-executions.d.ts.map +1 -1
- package/dist/routes/launchers.d.ts.map +1 -1
- package/dist/routes/process-actions.d.ts.map +1 -1
- package/dist/routes/process-detail.d.ts.map +1 -1
- package/dist/routes/process-diagnostics-assembler.d.ts +3 -1
- package/dist/routes/process-diagnostics-assembler.d.ts.map +1 -1
- package/dist/routes/process-model-config.d.ts +4 -0
- package/dist/routes/process-model-config.d.ts.map +1 -0
- package/dist/routes/process-primary-path-assembler.d.ts +4 -12
- package/dist/routes/process-primary-path-assembler.d.ts.map +1 -1
- package/dist/routes/process-route-helpers.d.ts +15 -41
- package/dist/routes/process-route-helpers.d.ts.map +1 -1
- package/dist/routes/processes.d.ts.map +1 -1
- package/dist/routes/settings.d.ts +11 -0
- package/dist/routes/settings.d.ts.map +1 -0
- package/dist/routes/ticket-creation.d.ts.map +1 -1
- package/dist/scoped-settings-service.d.ts +83 -0
- package/dist/scoped-settings-service.d.ts.map +1 -0
- package/dist/server-bootstrap/build-host-capabilities.d.ts +2 -0
- package/dist/server-bootstrap/build-host-capabilities.d.ts.map +1 -1
- package/dist/server-bootstrap/register-http.d.ts.map +1 -1
- package/dist/session-summary-projection.d.ts.map +1 -1
- package/dist/skills/bundled-skills.d.ts +5 -0
- package/dist/skills/bundled-skills.d.ts.map +1 -0
- package/dist/skills/catalog-service.d.ts +1 -0
- package/dist/skills/catalog-service.d.ts.map +1 -1
- package/dist/skills/extension-importer.d.ts +11 -0
- package/dist/skills/extension-importer.d.ts.map +1 -0
- package/dist/skills/launch-skills.d.ts +11 -0
- package/dist/skills/launch-skills.d.ts.map +1 -0
- package/dist/skills/skill-frontmatter.d.ts +5 -0
- package/dist/skills/skill-frontmatter.d.ts.map +1 -1
- package/dist/skills/source-importer.d.ts +3 -0
- package/dist/skills/source-importer.d.ts.map +1 -1
- package/dist/startup-evidence.d.ts +3 -0
- package/dist/startup-evidence.d.ts.map +1 -1
- package/dist/supervisor/execution-inspection-ingestor.d.ts +9 -0
- package/dist/supervisor/execution-inspection-ingestor.d.ts.map +1 -0
- package/dist/supervisor/ipc-handler.d.ts +2 -0
- package/dist/supervisor/ipc-handler.d.ts.map +1 -1
- package/dist/supervisor/worker-event-ingestor.d.ts +1 -0
- package/dist/supervisor/worker-event-ingestor.d.ts.map +1 -1
- package/dist/supervisor/worker-start-payload-builder.d.ts +2 -0
- package/dist/supervisor/worker-start-payload-builder.d.ts.map +1 -1
- package/dist/supervisor/worker-supervisor.d.ts +4 -0
- package/dist/supervisor/worker-supervisor.d.ts.map +1 -1
- package/dist/supervisor/worker-turn-ipc-recorder.d.ts +2 -2
- package/dist/supervisor/worker-turn-ipc-recorder.d.ts.map +1 -1
- package/dist/test-helpers/accepted-turn-start.d.ts +18 -4
- package/dist/test-helpers/accepted-turn-start.d.ts.map +1 -1
- package/dist/test-helpers/owned-test-deps.d.ts +18 -0
- package/dist/test-helpers/owned-test-deps.d.ts.map +1 -0
- package/dist/test-helpers/prepared-fixture-start.d.ts.map +1 -1
- package/dist/test-helpers/process-model-fixtures.d.ts +1 -0
- package/dist/test-helpers/process-model-fixtures.d.ts.map +1 -1
- package/dist/test-helpers/scoped-settings-fixtures.d.ts +16 -0
- package/dist/test-helpers/scoped-settings-fixtures.d.ts.map +1 -0
- package/dist/test-helpers/skill-fixtures.d.ts +4 -0
- package/dist/test-helpers/skill-fixtures.d.ts.map +1 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +14 -10
- package/dist/testing.js.map +1 -1
- package/dist/tool-approval-gate.d.ts +3 -0
- package/dist/tool-approval-gate.d.ts.map +1 -1
- package/dist/turn-progress.d.ts.map +1 -1
- package/dist/turn-wait-service.d.ts +28 -0
- package/dist/turn-wait-service.d.ts.map +1 -0
- package/dist/worker-runtime-profile-selection.d.ts +2 -0
- package/dist/worker-runtime-profile-selection.d.ts.map +1 -1
- package/package.json +20 -19
- package/src/app.ts +117 -5
- package/src/auth/fastify-auth.ts +13 -0
- package/src/config/config-loader.ts +40 -2
- package/src/config/config-types.ts +14 -1
- package/src/config/kubernetes-docker-isolation.ts +21 -0
- package/src/db/database.ts +159 -40
- package/src/db/execution-inspection-repo.ts +163 -0
- package/src/db/history-window.ts +18 -0
- package/src/db/mapped-llm-run-repo.ts +177 -0
- package/src/db/process-event-repo.ts +88 -10
- package/src/db/process-instance-repo.ts +9 -2
- package/src/db/process-leaf-outcome-snapshot-repo.ts +8 -2
- package/src/db/process-project-repo.ts +4 -0
- package/src/db/process-skill-repo.ts +9 -2
- package/src/db/process-turn-annotation-repo.ts +27 -9
- package/src/db/process-turn-record-repo.ts +53 -13
- package/src/db/publication-repo.ts +63 -0
- package/src/db/repo-helpers.ts +11 -1
- package/src/db/repositories.ts +22 -0
- package/src/db/schema.ts +173 -2
- package/src/db/scoped-settings-repo.ts +234 -0
- package/src/db/skill-repo.ts +89 -27
- package/src/db/turn-start-record-repo.ts +13 -3
- package/src/db/turn-summary-repo.ts +12 -3
- package/src/db/worker-lease-repo.ts +8 -2
- package/src/domain-logic/outcome-tools.ts +4 -149
- package/src/external-source-service.ts +33 -7
- package/src/future-execution/execution.ts +9 -2
- package/src/future-execution/launch-lifecycle.ts +87 -78
- package/src/future-execution/lifecycle.ts +5 -34
- package/src/future-execution/model-projection.ts +2 -0
- package/src/future-execution/reconciliation.ts +7 -0
- package/src/future-execution-presenter.ts +14 -22
- package/src/integration-tool-registry.ts +59 -26
- package/src/launch-coordinator-test-harness.ts +8 -4
- package/src/launch-coordinator.ts +10 -1
- package/src/launcher-model-config-service.ts +24 -3
- package/src/leaf-outcome-snapshot-capture.ts +2 -0
- package/src/primary-path-snapshot.ts +3 -4
- package/src/process-action-presenter.ts +98 -0
- package/src/process-action-registry.ts +31 -39
- package/src/process-engine/decision.ts +10 -0
- package/src/process-engine/engine.ts +13 -4
- package/src/process-engine/mapped-turns.ts +328 -0
- package/src/process-engine/operation.ts +1 -1
- package/src/process-engine/ops/accept-worker-turn-start.ts +6 -0
- package/src/process-engine/ops/continue-failed-turn.ts +2 -13
- package/src/process-engine/ops/process-observation.ts +119 -0
- package/src/process-engine/ops/retry-failed-turn.ts +2 -12
- package/src/process-engine/ops/retry-startup.ts +10 -13
- package/src/process-engine/ops/start-process.ts +34 -2
- package/src/process-engine/ops/turn-outcome.ts +65 -62
- package/src/process-engine/ops/turn-wait.ts +225 -0
- package/src/process-engine/ops/update-model-config.ts +66 -0
- package/src/process-engine/recorder.ts +33 -5
- package/src/process-engine/runner.ts +8 -8
- package/src/process-engine/turn-start-preflight.ts +168 -105
- package/src/process-engine/turn-wait-state.ts +126 -0
- package/src/process-engine/turn-worker-requirement.ts +4 -0
- package/src/process-engine/types.ts +15 -0
- package/src/process-engine/writes/build-process-abort-writes.ts +30 -19
- package/src/process-engine/writes/build-recovery-start-writes.ts +1 -0
- package/src/process-engine/writes/build-turn-outcome-writes.ts +118 -21
- package/src/process-engine/writes/build-turn-selection-writes.ts +2 -31
- package/src/process-engine/writes/commit-writes.ts +20 -2
- package/src/process-engine/writes/reserve-selected-turn-start.ts +44 -0
- package/src/process-engine/writes/writes.ts +73 -61
- package/src/process-graph.ts +0 -1
- package/src/process-inspection-reader.ts +305 -0
- package/src/process-inspection-trace.ts +176 -0
- package/src/process-inspection.ts +169 -0
- package/src/process-instance-tree-presenter.ts +56 -216
- package/src/process-launch-executor.ts +5 -2
- package/src/process-launch-plan.ts +17 -2
- package/src/process-launcher-registry.ts +28 -16
- package/src/process-model-config.ts +100 -0
- package/src/process-model-policy/construct.ts +1 -0
- package/src/process-model-policy/evaluate.ts +34 -32
- package/src/process-model-policy/index.ts +45 -3
- package/src/process-model-policy/project.ts +62 -76
- package/src/process-model-policy/types.ts +26 -0
- package/src/process-model-policy-presenter.ts +7 -3
- package/src/process-runtime-availability.ts +9 -4
- package/src/process-turn-navigation.ts +86 -8
- package/src/process-turn-trace.ts +12 -24
- package/src/process-ui-snapshot-presenter.ts +249 -298
- package/src/routes/future-executions.ts +5 -5
- package/src/routes/launchers.ts +51 -1
- package/src/routes/process-actions.ts +10 -10
- package/src/routes/process-detail.ts +25 -2
- package/src/routes/process-diagnostics-assembler.ts +32 -6
- package/src/routes/process-model-config.ts +70 -0
- package/src/routes/process-primary-path-assembler.ts +17 -33
- package/src/routes/process-route-helpers.ts +161 -327
- package/src/routes/processes.ts +2 -0
- package/src/routes/settings.ts +173 -0
- package/src/routes/ticket-creation.ts +28 -5
- package/src/scoped-settings-service.ts +736 -0
- package/src/server-bootstrap/build-host-capabilities.ts +42 -0
- package/src/server-bootstrap/register-http.ts +7 -1
- package/src/session-summary-projection.ts +1 -2
- package/src/skills/bundled-skills.ts +64 -0
- package/src/skills/catalog-service.ts +35 -6
- package/src/skills/extension-importer.ts +97 -0
- package/src/skills/launch-skills.ts +19 -0
- package/src/skills/skill-frontmatter.ts +13 -0
- package/src/skills/source-importer.ts +3 -0
- package/src/startup-evidence.ts +20 -0
- package/src/supervisor/execution-inspection-ingestor.ts +55 -0
- package/src/supervisor/ipc-handler.ts +29 -18
- package/src/supervisor/worker-event-ingestor.ts +30 -14
- package/src/supervisor/worker-start-payload-builder.ts +42 -0
- package/src/supervisor/worker-supervisor.ts +5 -0
- package/src/supervisor/worker-turn-ipc-recorder.ts +13 -1
- package/src/test-helpers/accepted-turn-start.ts +51 -27
- package/src/test-helpers/owned-test-deps.ts +45 -0
- package/src/test-helpers/prepared-fixture-start.ts +1 -0
- package/src/test-helpers/process-model-fixtures.ts +2 -0
- package/src/test-helpers/scoped-settings-fixtures.ts +126 -0
- package/src/test-helpers/skill-fixtures.ts +28 -0
- package/src/testing.ts +4 -1
- package/src/tool-approval-gate.ts +16 -0
- package/src/turn-progress.ts +3 -2
- package/src/turn-wait-service.ts +228 -0
- package/src/worker-runtime-profile-selection.ts +8 -1
- package/dist/app-4QSV4FUQ.js +0 -8
- package/dist/chunk-KIOQNNG6.js.map +0 -1
- package/dist/chunk-LK3RO6C7.js.map +0 -1
- /package/dist/{app-4QSV4FUQ.js.map → app-JM4CBTND.js.map} +0 -0
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
} from "./process-model-policy-presenter.js";
|
|
15
15
|
|
|
16
16
|
type LauncherModelConfigDeps = {
|
|
17
|
+
scopedSettingsService?: import("./scoped-settings-service.js").ScopedSettingsService;
|
|
17
18
|
launcherService: ProcessLauncherService;
|
|
18
19
|
launchPlans: ProcessLaunchPlanServiceLike;
|
|
19
20
|
/** Server construction always supplies the authoritative model policy and availability view. */
|
|
@@ -39,15 +40,27 @@ function projectLauncherPreview(
|
|
|
39
40
|
input: LauncherModelConfigDeps,
|
|
40
41
|
processId: string,
|
|
41
42
|
modelConfig: LaunchModelConfigInputLike,
|
|
43
|
+
plan?: import("@leitwerk-dev/process-sdk").ProcessLaunchPlan,
|
|
42
44
|
) {
|
|
43
|
-
|
|
45
|
+
const preview = presentLauncherModelConfigPreview(
|
|
44
46
|
input.processModelPolicy.project({
|
|
45
47
|
kind: "launcher_preview",
|
|
48
|
+
plan,
|
|
46
49
|
processId,
|
|
47
50
|
modelConfig: modelConfig,
|
|
48
51
|
availability: input.modelStatusCache.snapshot(),
|
|
49
52
|
}),
|
|
50
53
|
);
|
|
54
|
+
const context = plan ? input.scopedSettingsService?.forLaunch(plan) : undefined;
|
|
55
|
+
return {
|
|
56
|
+
...preview,
|
|
57
|
+
...(context
|
|
58
|
+
? {
|
|
59
|
+
settingsSubjectId: context.context.repository ?? "instance",
|
|
60
|
+
settingsExplanations: context.explanations,
|
|
61
|
+
}
|
|
62
|
+
: {}),
|
|
63
|
+
};
|
|
51
64
|
}
|
|
52
65
|
|
|
53
66
|
export type LauncherModelConfigPreviewResult =
|
|
@@ -76,7 +89,10 @@ export async function buildLauncherModelConfigPreviewForLauncher(
|
|
|
76
89
|
let modelConfig = input.modelConfig;
|
|
77
90
|
let resolved: Awaited<ReturnType<ProcessLauncherService["resolveUiLauncher"]>> | null = null;
|
|
78
91
|
try {
|
|
79
|
-
resolved = await input.launcherService.
|
|
92
|
+
resolved = await input.launcherService.resolveUiLauncherPreview(
|
|
93
|
+
input.launcherId,
|
|
94
|
+
input.launcherInput,
|
|
95
|
+
);
|
|
80
96
|
} catch (error) {
|
|
81
97
|
if (!input.ignoreResolveErrors) throw error;
|
|
82
98
|
}
|
|
@@ -97,7 +113,12 @@ export async function buildLauncherModelConfigPreviewForLauncher(
|
|
|
97
113
|
return {
|
|
98
114
|
ok: true,
|
|
99
115
|
launcher,
|
|
100
|
-
preview: projectLauncherPreview(
|
|
116
|
+
preview: projectLauncherPreview(
|
|
117
|
+
input,
|
|
118
|
+
launcher.processId,
|
|
119
|
+
modelConfig,
|
|
120
|
+
resolved?.ok ? resolved.launcher.launchPlan : undefined,
|
|
121
|
+
),
|
|
101
122
|
};
|
|
102
123
|
}
|
|
103
124
|
|
|
@@ -55,6 +55,7 @@ export interface CaptureLeafOutcomeSnapshotOptions {
|
|
|
55
55
|
turnRecordId: string | null;
|
|
56
56
|
};
|
|
57
57
|
turnRecord: ProcessTurnRecord | null;
|
|
58
|
+
mappedResult?: unknown;
|
|
58
59
|
anchoredAt: string;
|
|
59
60
|
}
|
|
60
61
|
|
|
@@ -88,6 +89,7 @@ export async function captureLeafOutcomeSnapshot(
|
|
|
88
89
|
turnRecordId: options.leaf.turnRecordId,
|
|
89
90
|
},
|
|
90
91
|
turnRecord: options.turnRecord,
|
|
92
|
+
mappedResult: options.mappedResult,
|
|
91
93
|
readTreeEntry,
|
|
92
94
|
readLeafEntry,
|
|
93
95
|
readTurnRecord(turnRecordId: string) {
|
|
@@ -12,12 +12,11 @@ import { parseProcessStateJsonLenient } from "@leitwerk-dev/domain";
|
|
|
12
12
|
import { parseStructuralProcessState } from "@leitwerk-dev/process-sdk";
|
|
13
13
|
import {
|
|
14
14
|
asWsEventPayloadRecord,
|
|
15
|
-
|
|
15
|
+
createLiveTurnProjection,
|
|
16
16
|
type PrimaryPathActiveTurnSnapshot,
|
|
17
17
|
type PrimaryPathEntrySnapshot,
|
|
18
18
|
type PrimaryPathSnapshot,
|
|
19
19
|
readWsEventTurnRecordId,
|
|
20
|
-
snapshotLiveTurnProjection,
|
|
21
20
|
} from "@leitwerk-dev/protocol";
|
|
22
21
|
import type { ParsedInstanceTree } from "./instance-tree.js";
|
|
23
22
|
|
|
@@ -239,8 +238,8 @@ function buildActiveTurnSnapshot(input: {
|
|
|
239
238
|
}
|
|
240
239
|
return event.createdAt >= currentTurnRecord.startedAt;
|
|
241
240
|
});
|
|
242
|
-
const
|
|
243
|
-
|
|
241
|
+
const { assistant, toolCalls, traceItems, usage } =
|
|
242
|
+
createLiveTurnProjection(activeTurnEvents).rawSnapshot();
|
|
244
243
|
|
|
245
244
|
return {
|
|
246
245
|
turnRecordId: currentTurnRecord.id,
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { ProcessInstance } from "@leitwerk-dev/domain";
|
|
2
|
+
import { isLlmTurnDefinition, type TurnDefinition } from "@leitwerk-dev/process-sdk";
|
|
3
|
+
import type {
|
|
4
|
+
ProcessActionPreviewSummary,
|
|
5
|
+
ProcessActionSummary,
|
|
6
|
+
} from "@leitwerk-dev/protocol/http-contracts";
|
|
7
|
+
import type { VisibleProcessActionSummary } from "./process-action-registry.js";
|
|
8
|
+
import {
|
|
9
|
+
listVisibleActionsForProcess as listVisibleAttentionActionsForProcess,
|
|
10
|
+
type ProcessOperatorAttentionDeps,
|
|
11
|
+
} from "./process-operator-attention.js";
|
|
12
|
+
|
|
13
|
+
/** @internal */
|
|
14
|
+
export function buildActionSummaryForProcess(
|
|
15
|
+
deps: Pick<ProcessOperatorAttentionDeps, "processActionRegistry">,
|
|
16
|
+
process: ProcessInstance,
|
|
17
|
+
action: Pick<VisibleProcessActionSummary, "id" | "label" | "form"> &
|
|
18
|
+
Partial<Pick<VisibleProcessActionSummary, "description" | "preview">> & {
|
|
19
|
+
supportsScheduling?: boolean;
|
|
20
|
+
},
|
|
21
|
+
): ProcessActionSummary {
|
|
22
|
+
const actionId = action.id;
|
|
23
|
+
const preview =
|
|
24
|
+
action.preview ??
|
|
25
|
+
deps.processActionRegistry?.resolveActionPreview(process.processId, process, actionId) ??
|
|
26
|
+
null;
|
|
27
|
+
const hasPurePlan =
|
|
28
|
+
typeof deps.processActionRegistry?.getAction(process.processId, actionId)?.plan === "function";
|
|
29
|
+
const turnDef = preview?.candidateSelectedTurnId
|
|
30
|
+
? deps.processActionRegistry?.getTurnDefinition(
|
|
31
|
+
process.processId,
|
|
32
|
+
preview.candidateSelectedTurnId,
|
|
33
|
+
)
|
|
34
|
+
: undefined;
|
|
35
|
+
const supportsScheduling =
|
|
36
|
+
action.supportsScheduling ??
|
|
37
|
+
Boolean(
|
|
38
|
+
hasPurePlan &&
|
|
39
|
+
deps.processActionRegistry?.resolveActionScheduling(process.processId, process, actionId),
|
|
40
|
+
);
|
|
41
|
+
return {
|
|
42
|
+
id: action.id,
|
|
43
|
+
label: action.label,
|
|
44
|
+
description: action.description ?? null,
|
|
45
|
+
preview: buildProcessActionPreviewSummary(preview, turnDef),
|
|
46
|
+
supportsScheduling,
|
|
47
|
+
supportsNextTurnModelOverride: Boolean(hasPurePlan && turnDef && isLlmTurnDefinition(turnDef)),
|
|
48
|
+
...(action.form
|
|
49
|
+
? {
|
|
50
|
+
form: {
|
|
51
|
+
id: action.form.id,
|
|
52
|
+
title: action.form.title,
|
|
53
|
+
submitLabel: action.form.submitLabel,
|
|
54
|
+
fields: action.form.fields.map((field) => ({ ...field })),
|
|
55
|
+
},
|
|
56
|
+
}
|
|
57
|
+
: {}),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** @internal */
|
|
62
|
+
export function listVisibleActionsForProcess(
|
|
63
|
+
deps: ProcessOperatorAttentionDeps,
|
|
64
|
+
process: ProcessInstance,
|
|
65
|
+
) {
|
|
66
|
+
return listVisibleAttentionActionsForProcess(deps, process).map((action) =>
|
|
67
|
+
buildActionSummaryForProcess(deps, process, action),
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function buildProcessActionPreviewSummary(
|
|
72
|
+
preview: {
|
|
73
|
+
candidateSelectedTurnId: string | null;
|
|
74
|
+
lifecycleStatus?: string | null;
|
|
75
|
+
} | null,
|
|
76
|
+
turnDef: TurnDefinition | undefined,
|
|
77
|
+
): ProcessActionPreviewSummary | null {
|
|
78
|
+
if (!preview) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
if (!preview.candidateSelectedTurnId) {
|
|
82
|
+
return {
|
|
83
|
+
kind: "terminal",
|
|
84
|
+
turnId: null,
|
|
85
|
+
turnKind: null,
|
|
86
|
+
description: preview.lifecycleStatus === "aborted" ? "Abort process" : "Complete process",
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
if (!turnDef) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
kind: "turn",
|
|
94
|
+
turnId: preview.candidateSelectedTurnId,
|
|
95
|
+
turnKind: turnDef.kind,
|
|
96
|
+
description: turnDef.description,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
@@ -30,6 +30,7 @@ import type {
|
|
|
30
30
|
ProcessExternalSourceSummary,
|
|
31
31
|
ProcessSelectedTurnSummary,
|
|
32
32
|
} from "@leitwerk-dev/protocol/http-contracts";
|
|
33
|
+
import { pendingTurnWait } from "./process-engine/turn-wait-state.js";
|
|
33
34
|
|
|
34
35
|
/** @internal */
|
|
35
36
|
export interface ProcessContextData {
|
|
@@ -223,30 +224,6 @@ function listExternalTriggers(
|
|
|
223
224
|
state: unknown;
|
|
224
225
|
},
|
|
225
226
|
): ProcessExternalSourceSummary[] {
|
|
226
|
-
if (isHumanTurnDefinition(turnDef)) {
|
|
227
|
-
const view = resolveHumanTurnView({ turnId, turn: turnDef });
|
|
228
|
-
return [
|
|
229
|
-
...view.externalTriggers.map((trigger) => ({
|
|
230
|
-
id: trigger.id,
|
|
231
|
-
kind: "human_action_external_trigger",
|
|
232
|
-
label: trigger.label,
|
|
233
|
-
description: trigger.description,
|
|
234
|
-
})),
|
|
235
|
-
...view.externalActions
|
|
236
|
-
.filter((action) => {
|
|
237
|
-
const definition = turnDef.externalActions?.[action.externalActionId];
|
|
238
|
-
return !definition?.when || definition.when(ctx);
|
|
239
|
-
})
|
|
240
|
-
.map((action) => ({
|
|
241
|
-
id: action.id,
|
|
242
|
-
externalActionId: action.externalActionId,
|
|
243
|
-
kind: action.sourceKind,
|
|
244
|
-
sourceKind: action.sourceKind,
|
|
245
|
-
label: action.label,
|
|
246
|
-
description: action.description,
|
|
247
|
-
})),
|
|
248
|
-
];
|
|
249
|
-
}
|
|
250
227
|
if (isExternalTurnDefinition(turnDef)) {
|
|
251
228
|
return turnDef.transitions.map((transition, index) => ({
|
|
252
229
|
id: getExternalSourceTransitionId({ turnId, source: transition.source, index }),
|
|
@@ -255,8 +232,23 @@ function listExternalTriggers(
|
|
|
255
232
|
description: transition.source.description ?? null,
|
|
256
233
|
}));
|
|
257
234
|
}
|
|
258
|
-
if (
|
|
259
|
-
|
|
235
|
+
if (
|
|
236
|
+
!isHumanTurnDefinition(turnDef) &&
|
|
237
|
+
(!(isAutomaticTurnDefinition(turnDef) || turnDef.kind === "llm") ||
|
|
238
|
+
ctx.process.lifecycleStatus !== "waiting")
|
|
239
|
+
)
|
|
240
|
+
return [];
|
|
241
|
+
const triggers = isHumanTurnDefinition(turnDef)
|
|
242
|
+
? resolveHumanTurnView({ turnId, turn: turnDef }).externalTriggers.map((trigger) => ({
|
|
243
|
+
id: trigger.id,
|
|
244
|
+
kind: "human_action_external_trigger",
|
|
245
|
+
label: trigger.label,
|
|
246
|
+
description: trigger.description,
|
|
247
|
+
}))
|
|
248
|
+
: [];
|
|
249
|
+
return [
|
|
250
|
+
...triggers,
|
|
251
|
+
...Object.entries(turnDef.externalActions ?? {})
|
|
260
252
|
.filter(([, action]) => !action.when || action.when(ctx))
|
|
261
253
|
.map(([externalActionId, action]) => ({
|
|
262
254
|
id: getExternalActionArmingId({ turnId, externalActionId }),
|
|
@@ -265,9 +257,8 @@ function listExternalTriggers(
|
|
|
265
257
|
sourceKind: action.source.kind,
|
|
266
258
|
label: action.label ?? action.source.label ?? null,
|
|
267
259
|
description: action.description ?? action.source.description ?? null,
|
|
268
|
-
}))
|
|
269
|
-
|
|
270
|
-
return [];
|
|
260
|
+
})),
|
|
261
|
+
];
|
|
271
262
|
}
|
|
272
263
|
|
|
273
264
|
function resolveCurrentVisibleActionForProcess(
|
|
@@ -290,16 +281,8 @@ function isTurnScopedActionForProcess(
|
|
|
290
281
|
if (!processDef) {
|
|
291
282
|
return false;
|
|
292
283
|
}
|
|
293
|
-
for (const
|
|
294
|
-
if (isHumanTurnDefinition(turnDef))
|
|
295
|
-
const view = resolveHumanTurnView({ turnId, turn: turnDef });
|
|
296
|
-
if (
|
|
297
|
-
view.actions.some((action) => action.actionId === actionId) ||
|
|
298
|
-
view.externalTriggers.some((trigger) => trigger.actionId === actionId)
|
|
299
|
-
) {
|
|
300
|
-
return true;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
284
|
+
for (const { definition: turnDef } of processDef.turns.values()) {
|
|
285
|
+
if (isHumanTurnDefinition(turnDef) && Object.hasOwn(turnDef.actions, actionId)) return true;
|
|
303
286
|
}
|
|
304
287
|
return false;
|
|
305
288
|
}
|
|
@@ -314,6 +297,7 @@ function buildSelectedTurnSummaryForProcess(
|
|
|
314
297
|
return null;
|
|
315
298
|
}
|
|
316
299
|
const { params, state } = resolveProcessContextData(processDef, process);
|
|
300
|
+
const wait = pendingTurnWait(process);
|
|
317
301
|
return {
|
|
318
302
|
turnId: currentTurn.turnId,
|
|
319
303
|
kind: currentTurn.turnDef.kind,
|
|
@@ -327,6 +311,14 @@ function buildSelectedTurnSummaryForProcess(
|
|
|
327
311
|
params,
|
|
328
312
|
state,
|
|
329
313
|
}),
|
|
314
|
+
...(wait?.status === "waiting" && process.lifecycleStatus === "waiting"
|
|
315
|
+
? {
|
|
316
|
+
readiness: {
|
|
317
|
+
message: wait.message,
|
|
318
|
+
nextCheckAt: wait.nextCheckAt > 0 ? new Date(wait.nextCheckAt).toISOString() : null,
|
|
319
|
+
},
|
|
320
|
+
}
|
|
321
|
+
: {}),
|
|
330
322
|
};
|
|
331
323
|
}
|
|
332
324
|
|
|
@@ -9,6 +9,16 @@ import type { EngineErrorCode } from "./types.js";
|
|
|
9
9
|
|
|
10
10
|
export type Reaction = PostCommitEffect;
|
|
11
11
|
|
|
12
|
+
/** @internal */
|
|
13
|
+
export function modelOverrideMetadata(input: DecisionMetadata = {}): DecisionMetadata | undefined {
|
|
14
|
+
const { nextTurnModelProfileId, providerOptions } = input;
|
|
15
|
+
if (nextTurnModelProfileId === undefined && providerOptions === undefined) return undefined;
|
|
16
|
+
return {
|
|
17
|
+
...(nextTurnModelProfileId !== undefined ? { nextTurnModelProfileId } : {}),
|
|
18
|
+
...(providerOptions !== undefined ? { providerOptions } : {}),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
12
22
|
/** @internal */
|
|
13
23
|
export interface Decision<TData = void> {
|
|
14
24
|
/** @internal */
|
|
@@ -22,7 +22,10 @@ import {
|
|
|
22
22
|
UpdateSemanticRefs,
|
|
23
23
|
WorkerFailure,
|
|
24
24
|
} from "./ops/index.js";
|
|
25
|
+
import { ApplyProcessObservation } from "./ops/process-observation.js";
|
|
26
|
+
import { RetryTurnWait } from "./ops/turn-wait.js";
|
|
25
27
|
import { createEngineRunner } from "./runner.js";
|
|
28
|
+
import { pendingTurnWait } from "./turn-wait-state.js";
|
|
26
29
|
import type {
|
|
27
30
|
ActionExecutionResult,
|
|
28
31
|
EngineResult,
|
|
@@ -92,6 +95,9 @@ export function createProcessEngine(deps: ProcessEngineDeps): ProcessEngine {
|
|
|
92
95
|
|
|
93
96
|
engine = {
|
|
94
97
|
run,
|
|
98
|
+
applyProcessObservation(instanceId, input) {
|
|
99
|
+
return run(ApplyProcessObservation, { instanceId, ...input });
|
|
100
|
+
},
|
|
95
101
|
|
|
96
102
|
getDeferredProcessActivationSnapshots({ instanceId, processId, projectKey }) {
|
|
97
103
|
const processes = instanceId
|
|
@@ -134,7 +140,7 @@ export function createProcessEngine(deps: ProcessEngineDeps): ProcessEngine {
|
|
|
134
140
|
},
|
|
135
141
|
|
|
136
142
|
startProcess(instanceId, startTurnId, opts) {
|
|
137
|
-
return run(StartProcess, { instanceId, startTurnId,
|
|
143
|
+
return run(StartProcess, { instanceId, startTurnId, ...opts });
|
|
138
144
|
},
|
|
139
145
|
|
|
140
146
|
abortProcess(instanceId, opts) {
|
|
@@ -150,7 +156,10 @@ export function createProcessEngine(deps: ProcessEngineDeps): ProcessEngine {
|
|
|
150
156
|
},
|
|
151
157
|
|
|
152
158
|
async retryProcess(instanceId, opts) {
|
|
153
|
-
const
|
|
159
|
+
const process = deps.processes.getById(instanceId);
|
|
160
|
+
if (process && pendingTurnWait(process)?.status === "error")
|
|
161
|
+
return run(RetryTurnWait, { instanceId, ...opts });
|
|
162
|
+
const current = process?.currentExecution;
|
|
154
163
|
const start = current?.kind === "worker_start" ? deps.turnStarts.getById(current.id) : null;
|
|
155
164
|
if (start?.state.kind === "preparation_failed" || start?.state.kind === "bootstrap_failed") {
|
|
156
165
|
// RetryStartup fences this ID and lifecycle state under the process lock.
|
|
@@ -183,8 +192,8 @@ export function createProcessEngine(deps: ProcessEngineDeps): ProcessEngine {
|
|
|
183
192
|
return maybeBroadcastErrorAttentionToast(result, { errorCode: payload.errorCode });
|
|
184
193
|
},
|
|
185
194
|
|
|
186
|
-
acceptWorkerTurnStart(instanceId, input) {
|
|
187
|
-
return run(AcceptWorkerTurnStart, { instanceId, ...input });
|
|
195
|
+
acceptWorkerTurnStart(instanceId, input, options) {
|
|
196
|
+
return run(AcceptWorkerTurnStart, { instanceId, ...input, onRecorded: options?.onRecorded });
|
|
188
197
|
},
|
|
189
198
|
|
|
190
199
|
async recordTurnOutcome(instanceId, payload, options) {
|