@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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
isUnknownRecord,
|
|
2
3
|
normalizeLaunchModelConfigInput,
|
|
3
4
|
type ProcessEvent,
|
|
4
5
|
type ProcessInstance,
|
|
@@ -8,9 +9,7 @@ import {
|
|
|
8
9
|
} from "@leitwerk-dev/domain";
|
|
9
10
|
import type { ProcessModelSelectionServiceLike } from "@leitwerk-dev/process-sdk";
|
|
10
11
|
import {
|
|
11
|
-
type FormDefinition,
|
|
12
12
|
findUiLauncherById,
|
|
13
|
-
isLlmTurnDefinition,
|
|
14
13
|
type OutcomeToolParameterSpec,
|
|
15
14
|
type ProcessLauncherService,
|
|
16
15
|
type ProcessLaunchPlanServiceLike,
|
|
@@ -21,20 +20,13 @@ import {
|
|
|
21
20
|
resolveProcessPiConfig,
|
|
22
21
|
resolveTurnActiveToolNames,
|
|
23
22
|
} from "@leitwerk-dev/process-sdk/pi-config";
|
|
24
|
-
import {
|
|
25
|
-
parseActionRequestBody,
|
|
26
|
-
parseLauncherInputJson,
|
|
27
|
-
parseLauncherRequestBody,
|
|
28
|
-
} from "@leitwerk-dev/protocol";
|
|
23
|
+
import { parseLauncherInputJson, parseLauncherRequestBody } from "@leitwerk-dev/protocol";
|
|
29
24
|
import type {
|
|
30
25
|
LauncherModelConfigSchema,
|
|
31
26
|
LauncherMutationResponseBody,
|
|
32
|
-
ProcessActionPreviewSummary,
|
|
33
|
-
ProcessActionSummary,
|
|
34
27
|
ProcessLaunchConfigurationView,
|
|
35
28
|
ProcessRunDetailsView,
|
|
36
29
|
ProcessRunTurnView,
|
|
37
|
-
ScheduledActionDetail,
|
|
38
30
|
ScheduledActionMutationResponseBody,
|
|
39
31
|
} from "@leitwerk-dev/protocol/http-contracts";
|
|
40
32
|
import type { ToolCallRendererDefinition } from "@leitwerk-dev/protocol/tool-renderer-contract";
|
|
@@ -48,12 +40,11 @@ import type {
|
|
|
48
40
|
ActionMutationOutcome,
|
|
49
41
|
FutureExecutionLifecycle,
|
|
50
42
|
LaunchMutationOutcome,
|
|
51
|
-
NormalizedScheduledActionInput,
|
|
52
43
|
NormalizedScheduledLaunchInput,
|
|
53
44
|
} from "../future-execution/index.js";
|
|
54
45
|
import {
|
|
55
46
|
buildFutureExecutionListView,
|
|
56
|
-
getScheduledActionDetailForProcess
|
|
47
|
+
getScheduledActionDetailForProcess,
|
|
57
48
|
} from "../future-execution-presenter.js";
|
|
58
49
|
import type { LaunchCoordinator } from "../launch-coordinator.js";
|
|
59
50
|
import { normalizeSubmittedProcessTitle } from "../launch-title.js";
|
|
@@ -74,11 +65,7 @@ import { getProcessGraph, type ProcessGraphRegistry } from "../process-graph.js"
|
|
|
74
65
|
import type { ServerProcessModelPolicy } from "../process-model-policy/index.js";
|
|
75
66
|
import { presentLauncherModelConfigSchema } from "../process-model-policy-presenter.js";
|
|
76
67
|
import type { ProcessOperationCoordinator } from "../process-operation-coordinator.js";
|
|
77
|
-
import {
|
|
78
|
-
getSelectedTurnSummaryForProcess,
|
|
79
|
-
listCurrentVisibleActions,
|
|
80
|
-
listVisibleActionsForProcess as listVisibleAttentionActionsForProcess,
|
|
81
|
-
} from "../process-operator-attention.js";
|
|
68
|
+
import { getSelectedTurnSummaryForProcess } from "../process-operator-attention.js";
|
|
82
69
|
import type { ProcessQuestionService } from "../process-question-service.js";
|
|
83
70
|
import type { ProcessSessionReader } from "../process-session-store.js";
|
|
84
71
|
import type { ProcessTitleGenerator } from "../process-title-generator.js";
|
|
@@ -101,6 +88,7 @@ export interface RouteDeps
|
|
|
101
88
|
| "inputs"
|
|
102
89
|
| "events"
|
|
103
90
|
| "turnSummaries"
|
|
91
|
+
| "executionInspections"
|
|
104
92
|
| "futureExecutions"
|
|
105
93
|
| "skills"
|
|
106
94
|
| "processSkills"
|
|
@@ -117,6 +105,14 @@ export interface RouteDeps
|
|
|
117
105
|
| "transaction"
|
|
118
106
|
> {
|
|
119
107
|
/** @internal */
|
|
108
|
+
scopedSettingsService?: import("../scoped-settings-service.js").ScopedSettingsService;
|
|
109
|
+
/** @internal */
|
|
110
|
+
topicWiki?: RepositoryBundle["topicWiki"];
|
|
111
|
+
/** @internal */
|
|
112
|
+
onSettingsChanged?: () => Promise<void>;
|
|
113
|
+
/** @internal */
|
|
114
|
+
mappedRuns?: RepositoryBundle["mappedRuns"];
|
|
115
|
+
/** @internal */
|
|
120
116
|
startupObservations?: RepositoryBundle["startupObservations"];
|
|
121
117
|
/** @public */
|
|
122
118
|
externalSourceService?: Pick<
|
|
@@ -179,10 +175,20 @@ export interface RouteDeps
|
|
|
179
175
|
sessionTransferService?: SessionTransferService;
|
|
180
176
|
}
|
|
181
177
|
|
|
182
|
-
export function routeConfig(deps: RouteDeps): LeitwerkConfig {
|
|
178
|
+
export function routeConfig(deps: Pick<RouteDeps, "config">): LeitwerkConfig {
|
|
183
179
|
return deps.config ?? getDefaultConfig();
|
|
184
180
|
}
|
|
185
181
|
|
|
182
|
+
function safeLaunchValue(value: unknown): unknown {
|
|
183
|
+
if (typeof value === "string") return redactCredentialBearingAbsoluteUrl(value);
|
|
184
|
+
if (Array.isArray(value)) return value.map(safeLaunchValue);
|
|
185
|
+
if (value && typeof value === "object")
|
|
186
|
+
return Object.fromEntries(
|
|
187
|
+
Object.entries(value).map(([key, item]) => [key, safeLaunchValue(item)]),
|
|
188
|
+
);
|
|
189
|
+
return value;
|
|
190
|
+
}
|
|
191
|
+
|
|
186
192
|
function formatLaunchParameterValue(value: unknown): string | null {
|
|
187
193
|
if (value === undefined || value === null) {
|
|
188
194
|
return null;
|
|
@@ -191,37 +197,31 @@ function formatLaunchParameterValue(value: unknown): string | null {
|
|
|
191
197
|
const normalized = redactCredentialBearingAbsoluteUrl(value.trim());
|
|
192
198
|
return normalized === "" ? null : normalized;
|
|
193
199
|
}
|
|
194
|
-
return
|
|
200
|
+
return typeof value === "object"
|
|
201
|
+
? JSON.stringify(safeLaunchValue(value), null, 2)
|
|
202
|
+
: String(value);
|
|
195
203
|
}
|
|
196
204
|
|
|
197
205
|
function buildLaunchParameterRows(
|
|
198
206
|
params: Record<string, unknown>,
|
|
199
207
|
launcher: ReturnType<ProcessLauncherService["listUiLaunchers"]>[number] | null,
|
|
200
208
|
): ProcessLaunchConfigurationView["parameters"] {
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}
|
|
218
|
-
rows.push({
|
|
219
|
-
fieldId,
|
|
220
|
-
label: fieldId,
|
|
221
|
-
value: formatLaunchParameterValue(params[fieldId]),
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
return rows;
|
|
209
|
+
const fields = (launcher?.launchConfigSchema.fields ?? []).filter((field) =>
|
|
210
|
+
Object.hasOwn(params, field.id),
|
|
211
|
+
);
|
|
212
|
+
const declared = new Set(fields.map((field) => field.id));
|
|
213
|
+
return [
|
|
214
|
+
...fields,
|
|
215
|
+
...Object.keys(params)
|
|
216
|
+
.sort((left, right) => left.localeCompare(right))
|
|
217
|
+
.filter((id) => !declared.has(id))
|
|
218
|
+
.map((id) => ({ id, label: id })),
|
|
219
|
+
].map(({ id, label }) => ({
|
|
220
|
+
fieldId: id,
|
|
221
|
+
label: label || id,
|
|
222
|
+
value: formatLaunchParameterValue(params[id]),
|
|
223
|
+
rawValue: safeLaunchValue(params[id]),
|
|
224
|
+
}));
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
export function buildProcessLaunchConfigurationView(
|
|
@@ -256,7 +256,7 @@ export function buildProcessLaunchConfigurationView(
|
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
export function buildProcessRunDetailsView(
|
|
259
|
-
deps: RouteDeps,
|
|
259
|
+
deps: Pick<RouteDeps, "config" | "processActionRegistry" | "processGraphs">,
|
|
260
260
|
process: ProcessInstance,
|
|
261
261
|
projects: readonly ProcessProject[],
|
|
262
262
|
): ProcessRunDetailsView {
|
|
@@ -285,18 +285,57 @@ export function buildProcessRunDetailsView(
|
|
|
285
285
|
const turns: ProcessRunTurnView[] = [];
|
|
286
286
|
|
|
287
287
|
for (const [turnId, turnContract] of contract.turns) {
|
|
288
|
-
if (turnContract.turnType !== "llm") {
|
|
289
|
-
continue;
|
|
290
|
-
}
|
|
291
288
|
const turnDef = deps.processActionRegistry?.getTurnDefinition(process.processId, turnId);
|
|
292
|
-
if (!turnDef
|
|
289
|
+
if (!turnDef) continue;
|
|
290
|
+
const common = {
|
|
291
|
+
turnId,
|
|
292
|
+
description: turnDef.description,
|
|
293
|
+
consumedProducts: [...(turnContract.consumedProducts ?? [])],
|
|
294
|
+
};
|
|
295
|
+
if (turnDef.kind !== "llm") {
|
|
296
|
+
const actions =
|
|
297
|
+
turnDef.kind === "human"
|
|
298
|
+
? Object.entries(turnDef.actions).map(([name, action]) => ({
|
|
299
|
+
name,
|
|
300
|
+
label: action.label,
|
|
301
|
+
description: action.description,
|
|
302
|
+
form: action.form,
|
|
303
|
+
}))
|
|
304
|
+
: [];
|
|
305
|
+
const outcomes =
|
|
306
|
+
turnDef.kind === "automatic"
|
|
307
|
+
? Object.entries(turnDef.outcomes ?? {}).map(([name, outcome]) => ({
|
|
308
|
+
name,
|
|
309
|
+
description: outcome?.description,
|
|
310
|
+
parameters: outcome?.parameters,
|
|
311
|
+
}))
|
|
312
|
+
: [];
|
|
313
|
+
turns.push({
|
|
314
|
+
...common,
|
|
315
|
+
pathType: "not_applicable",
|
|
316
|
+
publishedProducts: [...(turnContract.publishedProducts ?? [])],
|
|
317
|
+
activePiToolNames: [],
|
|
318
|
+
outcomeActions: [],
|
|
319
|
+
integrationToolNames: turnDef.kind === "automatic" ? (turnDef.integrationTools ?? []) : [],
|
|
320
|
+
definitionContract: {
|
|
321
|
+
kind: turnDef.kind,
|
|
322
|
+
actions,
|
|
323
|
+
outcomes,
|
|
324
|
+
reviewProduct: turnDef.kind === "human" ? turnDef.reviewProduct : undefined,
|
|
325
|
+
},
|
|
326
|
+
});
|
|
293
327
|
continue;
|
|
294
328
|
}
|
|
295
329
|
turns.push({
|
|
296
|
-
|
|
297
|
-
description: turnDef.description,
|
|
330
|
+
...common,
|
|
298
331
|
pathType: turnDef.branchType,
|
|
299
|
-
|
|
332
|
+
definitionContract: {
|
|
333
|
+
kind: turnDef.kind,
|
|
334
|
+
context: turnDef.context,
|
|
335
|
+
modelPurpose: turnDef.modelPurpose ?? null,
|
|
336
|
+
askQuestions: turnDef.askQuestions ?? false,
|
|
337
|
+
},
|
|
338
|
+
integrationToolNames: turnDef.integrationTools ?? [],
|
|
300
339
|
publishedProducts: [
|
|
301
340
|
...new Set(
|
|
302
341
|
[turnContract.publishedProduct, ...(turnContract.publishedProducts ?? [])].filter(
|
|
@@ -324,7 +363,7 @@ export function buildProcessRunDetailsView(
|
|
|
324
363
|
Object.entries(toolSpec.parameters) as [string, OutcomeToolParameterSpec][]
|
|
325
364
|
).map(([parameterName, parameterSpec]) => ({
|
|
326
365
|
name: parameterName,
|
|
327
|
-
type: parameterSpec.type,
|
|
366
|
+
type: parameterSpec.type ?? "union",
|
|
328
367
|
description: parameterSpec.description,
|
|
329
368
|
required: parameterSpec.required === true,
|
|
330
369
|
})),
|
|
@@ -340,60 +379,10 @@ export function buildProcessRunDetailsView(
|
|
|
340
379
|
};
|
|
341
380
|
}
|
|
342
381
|
|
|
343
|
-
export function
|
|
344
|
-
deps: RouteDeps,
|
|
382
|
+
export function processDefinesLeafOutcome(
|
|
383
|
+
deps: Pick<RouteDeps, "processUiRegistry">,
|
|
345
384
|
process: ProcessInstance,
|
|
346
|
-
actionId: string,
|
|
347
385
|
): boolean {
|
|
348
|
-
const action = deps.processActionRegistry?.getAction(process.processId, actionId);
|
|
349
|
-
return typeof action?.plan === "function";
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
export function buildActionSummaryForProcess(
|
|
353
|
-
deps: RouteDeps,
|
|
354
|
-
process: ProcessInstance,
|
|
355
|
-
actionId: string,
|
|
356
|
-
action: {
|
|
357
|
-
id: string;
|
|
358
|
-
label: string;
|
|
359
|
-
form?: FormDefinition;
|
|
360
|
-
},
|
|
361
|
-
labelOverride?: string | null,
|
|
362
|
-
overrides: { supportsScheduling?: boolean } = {},
|
|
363
|
-
): ProcessActionSummary {
|
|
364
|
-
const visibleAction = listCurrentVisibleActions(deps, process).find(
|
|
365
|
-
(candidate) => candidate.id === actionId,
|
|
366
|
-
);
|
|
367
|
-
const preview =
|
|
368
|
-
visibleAction?.preview ??
|
|
369
|
-
deps.processActionRegistry?.resolveActionPreview(process.processId, process, actionId) ??
|
|
370
|
-
null;
|
|
371
|
-
const supportsScheduling =
|
|
372
|
-
overrides.supportsScheduling ??
|
|
373
|
-
Boolean(
|
|
374
|
-
actionHasPurePlan(deps, process, actionId) &&
|
|
375
|
-
deps.processActionRegistry?.resolveActionScheduling(process.processId, process, actionId),
|
|
376
|
-
);
|
|
377
|
-
return buildProcessActionSummary(action, labelOverride ?? visibleAction?.label ?? action.label, {
|
|
378
|
-
description: visibleAction?.description ?? null,
|
|
379
|
-
preview: buildProcessActionPreviewSummary(deps, preview, process),
|
|
380
|
-
supportsScheduling,
|
|
381
|
-
supportsNextTurnModelOverride: previewSupportsNextTurnModelOverride(
|
|
382
|
-
deps,
|
|
383
|
-
process,
|
|
384
|
-
actionId,
|
|
385
|
-
preview,
|
|
386
|
-
),
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
export function listVisibleActionsForProcess(deps: RouteDeps, process: ProcessInstance) {
|
|
391
|
-
return listVisibleAttentionActionsForProcess(deps, process).map((action) =>
|
|
392
|
-
buildActionSummaryForProcess(deps, process, action.id, action, action.label),
|
|
393
|
-
);
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
export function processDefinesLeafOutcome(deps: RouteDeps, process: ProcessInstance): boolean {
|
|
397
386
|
return deps.processUiRegistry?.getLeafOutcomeDefinition(process.processId) != null;
|
|
398
387
|
}
|
|
399
388
|
|
|
@@ -426,75 +415,71 @@ export interface NormalizedRecoveryModelRequest {
|
|
|
426
415
|
providerOptions?: Record<string, string>;
|
|
427
416
|
}
|
|
428
417
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
418
|
+
const modelRequestEntries = {
|
|
419
|
+
nextTurnModelProfileId: v.exactOptional(
|
|
420
|
+
v.pipe(
|
|
421
|
+
v.nullish(v.string("nextTurnModelProfileId must be a string or null")),
|
|
422
|
+
v.transform((value) => value?.trim() || null),
|
|
423
|
+
),
|
|
424
|
+
),
|
|
425
|
+
providerOptions: v.exactOptional(
|
|
426
|
+
v.pipe(
|
|
427
|
+
v.custom<Record<string, unknown>>(
|
|
428
|
+
isUnknownRecord,
|
|
429
|
+
"providerOptions must be an object of string values",
|
|
430
|
+
),
|
|
431
|
+
v.maxEntries(64, "providerOptions has too many fields"),
|
|
432
|
+
v.guard(
|
|
433
|
+
(options): options is Record<string, string> =>
|
|
434
|
+
Object.entries(options).every(
|
|
435
|
+
([key, value]) =>
|
|
436
|
+
key.length > 0 &&
|
|
437
|
+
key.length <= 128 &&
|
|
438
|
+
typeof value === "string" &&
|
|
439
|
+
value.length <= 4096,
|
|
440
|
+
),
|
|
441
|
+
"providerOptions contains an invalid field",
|
|
442
|
+
),
|
|
443
|
+
v.transform((options) => Object.assign({}, options)),
|
|
444
|
+
),
|
|
445
|
+
),
|
|
446
|
+
};
|
|
447
|
+
const promptSchema = v.exactOptional(
|
|
448
|
+
v.pipe(
|
|
449
|
+
v.nullish(v.string("prompt must be a string or null")),
|
|
450
|
+
v.transform((value) => value ?? null),
|
|
451
|
+
),
|
|
452
|
+
);
|
|
446
453
|
|
|
447
454
|
function parseModelRequest(
|
|
448
455
|
value: unknown,
|
|
449
|
-
|
|
450
|
-
):
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
typeof modelProfileId !== "string"
|
|
477
|
-
) {
|
|
478
|
-
return { ok: false, error: "nextTurnModelProfileId must be a string or null" };
|
|
479
|
-
}
|
|
480
|
-
const providerOptionsProvided = Object.hasOwn(body, "providerOptions");
|
|
481
|
-
const providerOptions = providerOptionsProvided
|
|
482
|
-
? normalizeProviderOptions(body.providerOptions)
|
|
483
|
-
: ({ ok: true, value: {} } as const);
|
|
484
|
-
if (!providerOptions.ok) return providerOptions;
|
|
485
|
-
return {
|
|
486
|
-
ok: true,
|
|
487
|
-
body,
|
|
488
|
-
request: {
|
|
489
|
-
...(nextTurnModelProfileIdProvided
|
|
490
|
-
? {
|
|
491
|
-
nextTurnModelProfileId:
|
|
492
|
-
typeof modelProfileId === "string" ? modelProfileId.trim() || null : null,
|
|
493
|
-
}
|
|
494
|
-
: {}),
|
|
495
|
-
...(providerOptionsProvided ? { providerOptions: providerOptions.value } : {}),
|
|
496
|
-
},
|
|
497
|
-
};
|
|
456
|
+
requestName: "continue" | "recovery",
|
|
457
|
+
): { ok: true; request: NormalizedContinueRequest } | { ok: false; error: string } {
|
|
458
|
+
const schema =
|
|
459
|
+
requestName === "continue"
|
|
460
|
+
? v.object({ ...modelRequestEntries, prompt: promptSchema })
|
|
461
|
+
: v.object(modelRequestEntries);
|
|
462
|
+
const shape =
|
|
463
|
+
requestName === "continue"
|
|
464
|
+
? "{ prompt, nextTurnModelProfileId, providerOptions }"
|
|
465
|
+
: "{ nextTurnModelProfileId, providerOptions }";
|
|
466
|
+
const parsed = v.safeParse(
|
|
467
|
+
v.pipe(
|
|
468
|
+
v.unknown(),
|
|
469
|
+
v.check(isUnknownRecord, `${requestName} request body must be an object`),
|
|
470
|
+
unknownRecordSchema,
|
|
471
|
+
v.check(
|
|
472
|
+
(body) => Object.keys(body).every((key) => Object.hasOwn(schema.entries, key)),
|
|
473
|
+
`${requestName} request body must use ${shape}`,
|
|
474
|
+
),
|
|
475
|
+
schema,
|
|
476
|
+
),
|
|
477
|
+
value ?? {},
|
|
478
|
+
{ abortEarly: true },
|
|
479
|
+
);
|
|
480
|
+
return parsed.success
|
|
481
|
+
? { ok: true, request: parsed.output }
|
|
482
|
+
: { ok: false, error: parsed.issues[0].message };
|
|
498
483
|
}
|
|
499
484
|
|
|
500
485
|
export function normalizeLauncherRequest(value: unknown):
|
|
@@ -523,25 +508,6 @@ export function normalizeLauncherRequest(value: unknown):
|
|
|
523
508
|
};
|
|
524
509
|
}
|
|
525
510
|
|
|
526
|
-
export function normalizeActionRequest(value: unknown):
|
|
527
|
-
| {
|
|
528
|
-
ok: true;
|
|
529
|
-
request: NormalizedScheduledActionInput;
|
|
530
|
-
}
|
|
531
|
-
| {
|
|
532
|
-
ok: false;
|
|
533
|
-
error: string;
|
|
534
|
-
} {
|
|
535
|
-
const parsed = parseActionRequestBody(value);
|
|
536
|
-
if (!parsed.ok) {
|
|
537
|
-
return { ok: false, error: parsed.error };
|
|
538
|
-
}
|
|
539
|
-
return {
|
|
540
|
-
ok: true,
|
|
541
|
-
request: parsed.value,
|
|
542
|
-
};
|
|
543
|
-
}
|
|
544
|
-
|
|
545
511
|
function isScheduleRequestError(error: string): boolean {
|
|
546
512
|
return (
|
|
547
513
|
error === "schedule must be an object" ||
|
|
@@ -568,139 +534,13 @@ export function sendActionRequestNormalizationError(reply: FastifyReply, error:
|
|
|
568
534
|
export function normalizeContinueRequest(
|
|
569
535
|
value: unknown,
|
|
570
536
|
): { ok: true; request: NormalizedContinueRequest } | { ok: false; error: string } {
|
|
571
|
-
|
|
572
|
-
requestName: "continue",
|
|
573
|
-
allowedKeys: ["prompt", "nextTurnModelProfileId", "providerOptions"],
|
|
574
|
-
expectedShape: "{ prompt, nextTurnModelProfileId, providerOptions }",
|
|
575
|
-
});
|
|
576
|
-
if (!parsed.ok) return parsed;
|
|
577
|
-
if (
|
|
578
|
-
parsed.body.prompt !== undefined &&
|
|
579
|
-
parsed.body.prompt !== null &&
|
|
580
|
-
typeof parsed.body.prompt !== "string"
|
|
581
|
-
) {
|
|
582
|
-
return { ok: false, error: "prompt must be a string or null" };
|
|
583
|
-
}
|
|
584
|
-
const promptProvided = Object.hasOwn(parsed.body, "prompt");
|
|
585
|
-
return {
|
|
586
|
-
ok: true,
|
|
587
|
-
request: {
|
|
588
|
-
...parsed.request,
|
|
589
|
-
...(promptProvided ? { prompt: parsed.body.prompt ?? null } : {}),
|
|
590
|
-
},
|
|
591
|
-
};
|
|
537
|
+
return parseModelRequest(value, "continue");
|
|
592
538
|
}
|
|
593
539
|
|
|
594
540
|
export function normalizeRecoveryModelRequest(
|
|
595
541
|
value: unknown,
|
|
596
542
|
): { ok: true; request: NormalizedRecoveryModelRequest } | { ok: false; error: string } {
|
|
597
|
-
|
|
598
|
-
requestName: "recovery",
|
|
599
|
-
allowedKeys: ["nextTurnModelProfileId", "providerOptions"],
|
|
600
|
-
expectedShape: "{ nextTurnModelProfileId, providerOptions }",
|
|
601
|
-
});
|
|
602
|
-
return parsed.ok ? { ok: true, request: parsed.request } : parsed;
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
export function buildProcessActionPreviewSummary(
|
|
606
|
-
deps: RouteDeps,
|
|
607
|
-
preview: {
|
|
608
|
-
candidateSelectedTurnId: string | null;
|
|
609
|
-
lifecycleStatus?: string | null;
|
|
610
|
-
} | null,
|
|
611
|
-
process: ProcessInstance,
|
|
612
|
-
): ProcessActionPreviewSummary | null {
|
|
613
|
-
if (!preview) {
|
|
614
|
-
return null;
|
|
615
|
-
}
|
|
616
|
-
if (!preview.candidateSelectedTurnId) {
|
|
617
|
-
return {
|
|
618
|
-
kind: "terminal",
|
|
619
|
-
turnId: null,
|
|
620
|
-
turnKind: null,
|
|
621
|
-
description: preview.lifecycleStatus === "aborted" ? "Abort process" : "Complete process",
|
|
622
|
-
};
|
|
623
|
-
}
|
|
624
|
-
const turnDef = deps.processActionRegistry?.getTurnDefinition(
|
|
625
|
-
process.processId,
|
|
626
|
-
preview.candidateSelectedTurnId,
|
|
627
|
-
);
|
|
628
|
-
if (!turnDef) {
|
|
629
|
-
return null;
|
|
630
|
-
}
|
|
631
|
-
return {
|
|
632
|
-
kind: "turn",
|
|
633
|
-
turnId: preview.candidateSelectedTurnId,
|
|
634
|
-
turnKind: turnDef.kind,
|
|
635
|
-
description: turnDef.description,
|
|
636
|
-
};
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
export function previewSupportsNextTurnModelOverride(
|
|
640
|
-
deps: RouteDeps,
|
|
641
|
-
process: ProcessInstance,
|
|
642
|
-
actionId: string,
|
|
643
|
-
preview: { candidateSelectedTurnId: string | null } | null,
|
|
644
|
-
): boolean {
|
|
645
|
-
if (!preview?.candidateSelectedTurnId) {
|
|
646
|
-
return false;
|
|
647
|
-
}
|
|
648
|
-
if (!actionHasPurePlan(deps, process, actionId)) {
|
|
649
|
-
return false;
|
|
650
|
-
}
|
|
651
|
-
const turnDef = deps.processActionRegistry?.getTurnDefinition(
|
|
652
|
-
process.processId,
|
|
653
|
-
preview.candidateSelectedTurnId,
|
|
654
|
-
);
|
|
655
|
-
return Boolean(turnDef && isLlmTurnDefinition(turnDef));
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
export function buildProcessActionSummary(
|
|
659
|
-
action: {
|
|
660
|
-
id: string;
|
|
661
|
-
label: string;
|
|
662
|
-
form?: FormDefinition;
|
|
663
|
-
},
|
|
664
|
-
labelOverride?: string | null,
|
|
665
|
-
opts: {
|
|
666
|
-
description?: string | null;
|
|
667
|
-
preview?: ProcessActionPreviewSummary | null;
|
|
668
|
-
supportsScheduling?: boolean;
|
|
669
|
-
supportsNextTurnModelOverride?: boolean;
|
|
670
|
-
} = {},
|
|
671
|
-
): ProcessActionSummary {
|
|
672
|
-
return {
|
|
673
|
-
id: action.id,
|
|
674
|
-
label: labelOverride?.trim() ? labelOverride : action.label,
|
|
675
|
-
description: opts.description ?? null,
|
|
676
|
-
preview: opts.preview ?? null,
|
|
677
|
-
supportsScheduling: opts.supportsScheduling === true,
|
|
678
|
-
supportsNextTurnModelOverride: opts.supportsNextTurnModelOverride === true,
|
|
679
|
-
...(action.form
|
|
680
|
-
? {
|
|
681
|
-
form: {
|
|
682
|
-
id: action.form.id,
|
|
683
|
-
title: action.form.title,
|
|
684
|
-
submitLabel: action.form.submitLabel,
|
|
685
|
-
fields: action.form.fields.map((field) => ({ ...field })),
|
|
686
|
-
},
|
|
687
|
-
}
|
|
688
|
-
: {}),
|
|
689
|
-
};
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
export function getScheduledActionDetailForProcess(
|
|
693
|
-
deps: RouteDeps,
|
|
694
|
-
process: ProcessInstance,
|
|
695
|
-
): ScheduledActionDetail | null {
|
|
696
|
-
return getPresentedScheduledActionDetailForProcess(
|
|
697
|
-
{
|
|
698
|
-
...deps,
|
|
699
|
-
buildActionSummaryForProcess: (process, actionId, action, labelOverride, overrides) =>
|
|
700
|
-
buildActionSummaryForProcess(deps, process, actionId, action, labelOverride, overrides),
|
|
701
|
-
},
|
|
702
|
-
process,
|
|
703
|
-
);
|
|
543
|
+
return parseModelRequest(value, "recovery");
|
|
704
544
|
}
|
|
705
545
|
|
|
706
546
|
export function buildLauncherModelConfigSchema(
|
|
@@ -844,16 +684,10 @@ export function sendScheduledActionMutationResponse(
|
|
|
844
684
|
export function mergeProcessEventWindowsAscending(
|
|
845
685
|
windows: readonly (readonly ProcessEvent[])[],
|
|
846
686
|
): ProcessEvent[] {
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
return [...eventsById.values()].sort((left, right) => {
|
|
854
|
-
const createdAtComparison = left.createdAt.localeCompare(right.createdAt);
|
|
855
|
-
return createdAtComparison !== 0 ? createdAtComparison : left.id.localeCompare(right.id);
|
|
856
|
-
});
|
|
687
|
+
return [...new Map(windows.flat().map((event) => [event.id, event])).values()].sort(
|
|
688
|
+
(left, right) =>
|
|
689
|
+
left.createdAt.localeCompare(right.createdAt) || left.id.localeCompare(right.id),
|
|
690
|
+
);
|
|
857
691
|
}
|
|
858
692
|
|
|
859
693
|
export { getSelectedTurnSummaryForProcess };
|
package/src/routes/processes.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { registerFutureExecutionRoutes } from "./future-executions.js";
|
|
|
3
3
|
import { registerLauncherRoutes } from "./launchers.js";
|
|
4
4
|
import { registerProcessActionRoutes } from "./process-actions.js";
|
|
5
5
|
import { registerProcessDetailRoutes } from "./process-detail.js";
|
|
6
|
+
import { registerProcessModelConfigRoutes } from "./process-model-config.js";
|
|
6
7
|
import { registerProcessQuestionRoutes } from "./process-questions.js";
|
|
7
8
|
import type { RouteDeps } from "./process-route-helpers.js";
|
|
8
9
|
import { registerProcessSessionRoutes } from "./process-session.js";
|
|
@@ -12,6 +13,7 @@ export type { RouteDeps } from "./process-route-helpers.js";
|
|
|
12
13
|
|
|
13
14
|
export function registerProcessRoutes(app: FastifyInstance, deps: RouteDeps) {
|
|
14
15
|
registerProcessDetailRoutes(app, deps);
|
|
16
|
+
registerProcessModelConfigRoutes(app, deps);
|
|
15
17
|
registerLauncherRoutes(app, deps, deps.futureExecutionLifecycle);
|
|
16
18
|
registerFutureExecutionRoutes(app, deps, deps.futureExecutionLifecycle);
|
|
17
19
|
registerProcessActionRoutes(app, deps, deps.futureExecutionLifecycle);
|