@leitwerk-dev/server 0.3.1 → 0.4.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.
Files changed (327) hide show
  1. package/dist/{app-BuJCdkvy.d.ts → app-CtlotzYm.d.ts} +312 -121
  2. package/dist/app-KR3N2JAE.js +8 -0
  3. package/dist/app.d.ts +9 -0
  4. package/dist/app.d.ts.map +1 -1
  5. package/dist/auth/fastify-auth.d.ts +9 -0
  6. package/dist/auth/fastify-auth.d.ts.map +1 -1
  7. package/dist/{chunk-QCHS3X33.js → chunk-OUA5EZS2.js} +3127 -689
  8. package/dist/chunk-OUA5EZS2.js.map +1 -0
  9. package/dist/{chunk-HK6BLLHA.js → chunk-YLWY4UTT.js} +2424 -1580
  10. package/dist/chunk-YLWY4UTT.js.map +1 -0
  11. package/dist/config/config-loader.d.ts +1 -1
  12. package/dist/config/config-loader.d.ts.map +1 -1
  13. package/dist/config/config-types.d.ts +16 -1
  14. package/dist/config/config-types.d.ts.map +1 -1
  15. package/dist/config/kubernetes-docker-isolation.d.ts +7 -0
  16. package/dist/config/kubernetes-docker-isolation.d.ts.map +1 -0
  17. package/dist/dashboard-model-issues.d.ts +10 -0
  18. package/dist/dashboard-model-issues.d.ts.map +1 -0
  19. package/dist/db/database.d.ts.map +1 -1
  20. package/dist/db/execution-inspection-repo.d.ts +15 -0
  21. package/dist/db/execution-inspection-repo.d.ts.map +1 -0
  22. package/dist/db/history-window.d.ts +11 -0
  23. package/dist/db/history-window.d.ts.map +1 -0
  24. package/dist/db/process-event-repo.d.ts +2 -0
  25. package/dist/db/process-event-repo.d.ts.map +1 -1
  26. package/dist/db/process-instance-repo.d.ts +21 -1
  27. package/dist/db/process-instance-repo.d.ts.map +1 -1
  28. package/dist/db/process-leaf-outcome-snapshot-repo.d.ts +2 -1
  29. package/dist/db/process-leaf-outcome-snapshot-repo.d.ts.map +1 -1
  30. package/dist/db/process-project-repo.d.ts +2 -0
  31. package/dist/db/process-project-repo.d.ts.map +1 -1
  32. package/dist/db/process-skill-repo.d.ts.map +1 -1
  33. package/dist/db/process-turn-annotation-repo.d.ts +4 -1
  34. package/dist/db/process-turn-annotation-repo.d.ts.map +1 -1
  35. package/dist/db/process-turn-record-repo.d.ts +4 -0
  36. package/dist/db/process-turn-record-repo.d.ts.map +1 -1
  37. package/dist/db/publication-repo.d.ts +5 -0
  38. package/dist/db/publication-repo.d.ts.map +1 -0
  39. package/dist/db/repositories.d.ts +12 -0
  40. package/dist/db/repositories.d.ts.map +1 -1
  41. package/dist/db/schema.d.ts +693 -2
  42. package/dist/db/schema.d.ts.map +1 -1
  43. package/dist/db/scoped-settings-repo.d.ts +37 -0
  44. package/dist/db/scoped-settings-repo.d.ts.map +1 -0
  45. package/dist/db/skill-repo.d.ts +3 -0
  46. package/dist/db/skill-repo.d.ts.map +1 -1
  47. package/dist/db/turn-start-record-repo.d.ts +2 -1
  48. package/dist/db/turn-start-record-repo.d.ts.map +1 -1
  49. package/dist/db/turn-summary-repo.d.ts +10 -1
  50. package/dist/db/turn-summary-repo.d.ts.map +1 -1
  51. package/dist/db/worker-lease-repo.d.ts +2 -1
  52. package/dist/db/worker-lease-repo.d.ts.map +1 -1
  53. package/dist/domain-logic/outcome-tools.d.ts.map +1 -1
  54. package/dist/domain-logic/worker-lease-lifecycle.d.ts.map +1 -1
  55. package/dist/external-source-service.d.ts.map +1 -1
  56. package/dist/future-execution/execution.d.ts +4 -1
  57. package/dist/future-execution/execution.d.ts.map +1 -1
  58. package/dist/future-execution/launch-lifecycle.d.ts +9 -25
  59. package/dist/future-execution/launch-lifecycle.d.ts.map +1 -1
  60. package/dist/future-execution/lifecycle.d.ts +3 -28
  61. package/dist/future-execution/lifecycle.d.ts.map +1 -1
  62. package/dist/future-execution/model-projection.d.ts.map +1 -1
  63. package/dist/future-execution/reconciliation.d.ts +1 -0
  64. package/dist/future-execution/reconciliation.d.ts.map +1 -1
  65. package/dist/future-execution-presenter.d.ts.map +1 -1
  66. package/dist/index.js +2 -2
  67. package/dist/integration-tool-registry.d.ts +11 -2
  68. package/dist/integration-tool-registry.d.ts.map +1 -1
  69. package/dist/launch-coordinator.d.ts.map +1 -1
  70. package/dist/launcher-model-config-service.d.ts +7 -1
  71. package/dist/launcher-model-config-service.d.ts.map +1 -1
  72. package/dist/leaf-outcome-snapshot-capture.d.ts +1 -0
  73. package/dist/leaf-outcome-snapshot-capture.d.ts.map +1 -1
  74. package/dist/main.js +3 -3
  75. package/dist/primary-path-snapshot.d.ts.map +1 -1
  76. package/dist/process-action-presenter.d.ts +1 -6
  77. package/dist/process-action-presenter.d.ts.map +1 -1
  78. package/dist/process-action-registry.d.ts.map +1 -1
  79. package/dist/process-engine/decision.d.ts +2 -0
  80. package/dist/process-engine/decision.d.ts.map +1 -1
  81. package/dist/process-engine/engine.d.ts.map +1 -1
  82. package/dist/process-engine/mapped-turns.d.ts.map +1 -1
  83. package/dist/process-engine/ops/automatic-retry-startup.d.ts +8 -0
  84. package/dist/process-engine/ops/automatic-retry-startup.d.ts.map +1 -0
  85. package/dist/process-engine/ops/continue-failed-turn.d.ts.map +1 -1
  86. package/dist/process-engine/ops/process-observation.d.ts +6 -0
  87. package/dist/process-engine/ops/process-observation.d.ts.map +1 -0
  88. package/dist/process-engine/ops/retry-failed-turn.d.ts.map +1 -1
  89. package/dist/process-engine/ops/retry-startup.d.ts +2 -0
  90. package/dist/process-engine/ops/retry-startup.d.ts.map +1 -1
  91. package/dist/process-engine/ops/start-process.d.ts +2 -0
  92. package/dist/process-engine/ops/start-process.d.ts.map +1 -1
  93. package/dist/process-engine/ops/turn-outcome.d.ts.map +1 -1
  94. package/dist/process-engine/ops/turn-wait.d.ts +30 -0
  95. package/dist/process-engine/ops/turn-wait.d.ts.map +1 -0
  96. package/dist/process-engine/ops/update-model-config.d.ts +9 -0
  97. package/dist/process-engine/ops/update-model-config.d.ts.map +1 -0
  98. package/dist/process-engine/recorder.d.ts.map +1 -1
  99. package/dist/process-engine/turn-start-preflight.d.ts +6 -0
  100. package/dist/process-engine/turn-start-preflight.d.ts.map +1 -1
  101. package/dist/process-engine/turn-wait-state.d.ts +24 -0
  102. package/dist/process-engine/turn-wait-state.d.ts.map +1 -0
  103. package/dist/process-engine/turn-worker-requirement.d.ts +2 -0
  104. package/dist/process-engine/turn-worker-requirement.d.ts.map +1 -1
  105. package/dist/process-engine/types.d.ts +13 -2
  106. package/dist/process-engine/types.d.ts.map +1 -1
  107. package/dist/process-engine/writes/build-process-abort-writes.d.ts +3 -1
  108. package/dist/process-engine/writes/build-process-abort-writes.d.ts.map +1 -1
  109. package/dist/process-engine/writes/build-turn-outcome-writes.d.ts +2 -0
  110. package/dist/process-engine/writes/build-turn-outcome-writes.d.ts.map +1 -1
  111. package/dist/process-engine/writes/commit-writes.d.ts +2 -0
  112. package/dist/process-engine/writes/commit-writes.d.ts.map +1 -1
  113. package/dist/process-engine/writes/writes.d.ts +28 -60
  114. package/dist/process-engine/writes/writes.d.ts.map +1 -1
  115. package/dist/process-graph.d.ts +1 -1
  116. package/dist/process-graph.d.ts.map +1 -1
  117. package/dist/process-inspection-reader.d.ts +21 -0
  118. package/dist/process-inspection-reader.d.ts.map +1 -0
  119. package/dist/process-inspection-trace.d.ts +13 -0
  120. package/dist/process-inspection-trace.d.ts.map +1 -0
  121. package/dist/process-inspection.d.ts +22 -0
  122. package/dist/process-inspection.d.ts.map +1 -0
  123. package/dist/process-instance-tree-presenter.d.ts +4 -3
  124. package/dist/process-instance-tree-presenter.d.ts.map +1 -1
  125. package/dist/process-launch-executor.d.ts +2 -0
  126. package/dist/process-launch-executor.d.ts.map +1 -1
  127. package/dist/process-launch-plan.d.ts +1 -0
  128. package/dist/process-launch-plan.d.ts.map +1 -1
  129. package/dist/process-launcher-registry.d.ts.map +1 -1
  130. package/dist/process-model-availability-recovery.d.ts +1 -1
  131. package/dist/process-model-availability-recovery.d.ts.map +1 -1
  132. package/dist/process-model-config.d.ts +19 -0
  133. package/dist/process-model-config.d.ts.map +1 -0
  134. package/dist/process-model-policy/construct.d.ts.map +1 -1
  135. package/dist/process-model-policy/evaluate.d.ts.map +1 -1
  136. package/dist/process-model-policy/index.d.ts +4 -1
  137. package/dist/process-model-policy/index.d.ts.map +1 -1
  138. package/dist/process-model-policy/project.d.ts.map +1 -1
  139. package/dist/process-model-policy/types.d.ts +18 -0
  140. package/dist/process-model-policy/types.d.ts.map +1 -1
  141. package/dist/process-model-policy-presenter.d.ts.map +1 -1
  142. package/dist/process-runtime-availability.d.ts +2 -1
  143. package/dist/process-runtime-availability.d.ts.map +1 -1
  144. package/dist/process-turn-trace.d.ts.map +1 -1
  145. package/dist/process-ui-snapshot-presenter.d.ts +14 -3
  146. package/dist/process-ui-snapshot-presenter.d.ts.map +1 -1
  147. package/dist/routes/dashboard.d.ts +17 -0
  148. package/dist/routes/dashboard.d.ts.map +1 -0
  149. package/dist/routes/future-executions.d.ts.map +1 -1
  150. package/dist/routes/launchers.d.ts.map +1 -1
  151. package/dist/routes/process-actions.d.ts.map +1 -1
  152. package/dist/routes/process-detail.d.ts.map +1 -1
  153. package/dist/routes/process-model-config.d.ts +4 -0
  154. package/dist/routes/process-model-config.d.ts.map +1 -0
  155. package/dist/routes/process-route-helpers.d.ts +8 -9
  156. package/dist/routes/process-route-helpers.d.ts.map +1 -1
  157. package/dist/routes/processes.d.ts.map +1 -1
  158. package/dist/routes/settings.d.ts +11 -0
  159. package/dist/routes/settings.d.ts.map +1 -0
  160. package/dist/routes/ticket-creation.d.ts.map +1 -1
  161. package/dist/scoped-settings-service.d.ts +98 -0
  162. package/dist/scoped-settings-service.d.ts.map +1 -0
  163. package/dist/server-bootstrap/build-host-capabilities.d.ts +2 -0
  164. package/dist/server-bootstrap/build-host-capabilities.d.ts.map +1 -1
  165. package/dist/server-bootstrap/register-http.d.ts.map +1 -1
  166. package/dist/session-summary-projection.d.ts.map +1 -1
  167. package/dist/skills/bundled-skills.d.ts +5 -0
  168. package/dist/skills/bundled-skills.d.ts.map +1 -0
  169. package/dist/skills/catalog-service.d.ts +1 -0
  170. package/dist/skills/catalog-service.d.ts.map +1 -1
  171. package/dist/skills/extension-importer.d.ts +11 -0
  172. package/dist/skills/extension-importer.d.ts.map +1 -0
  173. package/dist/skills/launch-skills.d.ts +11 -0
  174. package/dist/skills/launch-skills.d.ts.map +1 -0
  175. package/dist/skills/skill-frontmatter.d.ts +7 -0
  176. package/dist/skills/skill-frontmatter.d.ts.map +1 -1
  177. package/dist/skills/source-importer.d.ts +3 -0
  178. package/dist/skills/source-importer.d.ts.map +1 -1
  179. package/dist/startup-evidence.d.ts +4 -3
  180. package/dist/startup-evidence.d.ts.map +1 -1
  181. package/dist/startup-retry-policy.d.ts +8 -0
  182. package/dist/startup-retry-policy.d.ts.map +1 -0
  183. package/dist/supervisor/execution-inspection-ingestor.d.ts +9 -0
  184. package/dist/supervisor/execution-inspection-ingestor.d.ts.map +1 -0
  185. package/dist/supervisor/ipc-handler.d.ts +2 -0
  186. package/dist/supervisor/ipc-handler.d.ts.map +1 -1
  187. package/dist/supervisor/worker-event-ingestor.d.ts +1 -0
  188. package/dist/supervisor/worker-event-ingestor.d.ts.map +1 -1
  189. package/dist/supervisor/worker-start-payload-builder.d.ts.map +1 -1
  190. package/dist/supervisor/worker-supervisor.d.ts +2 -0
  191. package/dist/supervisor/worker-supervisor.d.ts.map +1 -1
  192. package/dist/test-helpers/prepared-fixture-start.d.ts.map +1 -1
  193. package/dist/test-helpers/process-model-fixtures.d.ts +1 -0
  194. package/dist/test-helpers/process-model-fixtures.d.ts.map +1 -1
  195. package/dist/test-helpers/scoped-settings-fixtures.d.ts +16 -0
  196. package/dist/test-helpers/scoped-settings-fixtures.d.ts.map +1 -0
  197. package/dist/test-helpers/skill-fixtures.d.ts +4 -0
  198. package/dist/test-helpers/skill-fixtures.d.ts.map +1 -0
  199. package/dist/testing.js +2 -1
  200. package/dist/testing.js.map +1 -1
  201. package/dist/tool-approval-gate.d.ts +3 -0
  202. package/dist/tool-approval-gate.d.ts.map +1 -1
  203. package/dist/turn-progress.d.ts.map +1 -1
  204. package/dist/turn-wait-service.d.ts +28 -0
  205. package/dist/turn-wait-service.d.ts.map +1 -0
  206. package/dist/worker-runtime-profile-selection.d.ts +2 -0
  207. package/dist/worker-runtime-profile-selection.d.ts.map +1 -1
  208. package/package.json +20 -19
  209. package/src/app.ts +177 -25
  210. package/src/auth/fastify-auth.ts +13 -0
  211. package/src/config/config-loader.ts +42 -2
  212. package/src/config/config-types.ts +16 -1
  213. package/src/config/kubernetes-docker-isolation.ts +21 -0
  214. package/src/dashboard-model-issues.ts +199 -0
  215. package/src/db/database.ts +131 -40
  216. package/src/db/execution-inspection-repo.ts +163 -0
  217. package/src/db/history-window.ts +18 -0
  218. package/src/db/process-event-repo.ts +88 -10
  219. package/src/db/process-instance-repo.ts +33 -2
  220. package/src/db/process-leaf-outcome-snapshot-repo.ts +8 -2
  221. package/src/db/process-project-repo.ts +4 -0
  222. package/src/db/process-skill-repo.ts +9 -2
  223. package/src/db/process-turn-annotation-repo.ts +27 -9
  224. package/src/db/process-turn-record-repo.ts +45 -12
  225. package/src/db/publication-repo.ts +63 -0
  226. package/src/db/repositories.ts +17 -0
  227. package/src/db/schema.ts +103 -1
  228. package/src/db/scoped-settings-repo.ts +234 -0
  229. package/src/db/skill-repo.ts +89 -27
  230. package/src/db/turn-start-record-repo.ts +13 -3
  231. package/src/db/turn-summary-repo.ts +36 -4
  232. package/src/db/worker-lease-repo.ts +8 -2
  233. package/src/domain-logic/outcome-tools.ts +18 -216
  234. package/src/domain-logic/worker-lease-lifecycle.ts +2 -1
  235. package/src/external-source-service.ts +33 -7
  236. package/src/future-execution/execution.ts +9 -2
  237. package/src/future-execution/launch-lifecycle.ts +87 -78
  238. package/src/future-execution/lifecycle.ts +5 -34
  239. package/src/future-execution/model-projection.ts +2 -0
  240. package/src/future-execution/reconciliation.ts +7 -0
  241. package/src/future-execution-presenter.ts +7 -8
  242. package/src/integration-tool-registry.ts +59 -26
  243. package/src/launch-coordinator.ts +10 -1
  244. package/src/launcher-model-config-service.ts +24 -3
  245. package/src/leaf-outcome-snapshot-capture.ts +2 -0
  246. package/src/primary-path-snapshot.ts +3 -4
  247. package/src/process-action-presenter.ts +22 -57
  248. package/src/process-action-registry.ts +31 -39
  249. package/src/process-engine/decision.ts +10 -0
  250. package/src/process-engine/engine.ts +25 -2
  251. package/src/process-engine/mapped-turns.ts +5 -7
  252. package/src/process-engine/ops/automatic-retry-startup.ts +93 -0
  253. package/src/process-engine/ops/continue-failed-turn.ts +2 -13
  254. package/src/process-engine/ops/process-observation.ts +119 -0
  255. package/src/process-engine/ops/retry-failed-turn.ts +2 -12
  256. package/src/process-engine/ops/retry-startup.ts +20 -16
  257. package/src/process-engine/ops/start-process.ts +34 -2
  258. package/src/process-engine/ops/turn-outcome.ts +61 -60
  259. package/src/process-engine/ops/turn-wait.ts +225 -0
  260. package/src/process-engine/ops/update-model-config.ts +66 -0
  261. package/src/process-engine/recorder.ts +34 -5
  262. package/src/process-engine/turn-start-preflight.ts +168 -105
  263. package/src/process-engine/turn-wait-state.ts +126 -0
  264. package/src/process-engine/turn-worker-requirement.ts +4 -0
  265. package/src/process-engine/types.ts +21 -0
  266. package/src/process-engine/writes/build-process-abort-writes.ts +30 -20
  267. package/src/process-engine/writes/build-turn-outcome-writes.ts +39 -2
  268. package/src/process-engine/writes/commit-writes.ts +16 -4
  269. package/src/process-engine/writes/writes.ts +59 -74
  270. package/src/process-graph.ts +0 -1
  271. package/src/process-inspection-reader.ts +305 -0
  272. package/src/process-inspection-trace.ts +176 -0
  273. package/src/process-inspection.ts +169 -0
  274. package/src/process-instance-tree-presenter.ts +56 -216
  275. package/src/process-launch-executor.ts +5 -2
  276. package/src/process-launch-plan.ts +17 -2
  277. package/src/process-launcher-registry.ts +28 -16
  278. package/src/process-model-availability-recovery.ts +6 -4
  279. package/src/process-model-config.ts +100 -0
  280. package/src/process-model-policy/construct.ts +1 -0
  281. package/src/process-model-policy/evaluate.ts +34 -32
  282. package/src/process-model-policy/index.ts +45 -3
  283. package/src/process-model-policy/project.ts +62 -76
  284. package/src/process-model-policy/types.ts +26 -0
  285. package/src/process-model-policy-presenter.ts +7 -3
  286. package/src/process-runtime-availability.ts +9 -4
  287. package/src/process-turn-trace.ts +12 -24
  288. package/src/process-ui-snapshot-presenter.ts +210 -295
  289. package/src/routes/dashboard.ts +106 -0
  290. package/src/routes/future-executions.ts +5 -5
  291. package/src/routes/launchers.ts +51 -1
  292. package/src/routes/process-actions.ts +10 -10
  293. package/src/routes/process-detail.ts +25 -2
  294. package/src/routes/process-model-config.ts +70 -0
  295. package/src/routes/process-route-helpers.ts +153 -162
  296. package/src/routes/processes.ts +2 -0
  297. package/src/routes/settings.ts +173 -0
  298. package/src/routes/ticket-creation.ts +28 -5
  299. package/src/scoped-settings-service.ts +797 -0
  300. package/src/server-bootstrap/build-host-capabilities.ts +42 -0
  301. package/src/server-bootstrap/register-http.ts +12 -1
  302. package/src/session-summary-projection.ts +1 -2
  303. package/src/skills/bundled-skills.ts +64 -0
  304. package/src/skills/catalog-service.ts +35 -6
  305. package/src/skills/extension-importer.ts +94 -0
  306. package/src/skills/launch-skills.ts +19 -0
  307. package/src/skills/skill-frontmatter.ts +19 -6
  308. package/src/skills/source-importer.ts +7 -13
  309. package/src/startup-evidence.ts +29 -8
  310. package/src/startup-retry-policy.ts +106 -0
  311. package/src/supervisor/execution-inspection-ingestor.ts +55 -0
  312. package/src/supervisor/ipc-handler.ts +2 -0
  313. package/src/supervisor/worker-event-ingestor.ts +30 -14
  314. package/src/supervisor/worker-start-payload-builder.ts +17 -0
  315. package/src/supervisor/worker-supervisor.ts +26 -1
  316. package/src/test-helpers/prepared-fixture-start.ts +1 -0
  317. package/src/test-helpers/process-model-fixtures.ts +2 -0
  318. package/src/test-helpers/scoped-settings-fixtures.ts +126 -0
  319. package/src/test-helpers/skill-fixtures.ts +28 -0
  320. package/src/tool-approval-gate.ts +16 -0
  321. package/src/turn-progress.ts +3 -2
  322. package/src/turn-wait-service.ts +228 -0
  323. package/src/worker-runtime-profile-selection.ts +8 -1
  324. package/dist/app-MSJXFK33.js +0 -8
  325. package/dist/chunk-HK6BLLHA.js.map +0 -1
  326. package/dist/chunk-QCHS3X33.js.map +0 -1
  327. /package/dist/{app-MSJXFK33.js.map → app-KR3N2JAE.js.map} +0 -0
@@ -1,17 +1,19 @@
1
1
  import { spawn } from 'node:child_process';
2
2
  import { CatalogPiContribution, ExtensionCatalog, DiscoveredExtensionEntry, LeitwerkRuntimeLane } from '@leitwerk-dev/extension-runtime';
3
3
  import * as _leitwerk_dev_process_sdk from '@leitwerk-dev/process-sdk';
4
- import { ServerExtensionEventMap, ModelProviderDefinition, ProviderCredentialStatus, ProviderAvailability, PiServerAdapter, HandoffDedupKeyRecordLike, ProcessActionDefinition, ServerProcessContext, ProcessActionPreviewDefinition, BuiltServerProcessDefinition, TurnDefinition, ExtensionProcessDefinition, ProcessActionExecutionSource, TurnAcceptanceState, ProcessActionSchedulingDefinition, ProcessLaunchPlan, LaunchPlanPreparationResultLike, QueuedProcessInputLike, ProcessLeafOutcomeDefinition, ServerExtensionEventName, DeferredProcessActivationSnapshotQuery, DeferredProcessActivationSnapshotResult, PreparedDeferredProcessActivation, DeferredProcessActivationOutcome, DeferredProcessActivationFailure, ProcessGraphRegistry, ActionExecutionResultLike, ProcessActionServiceLike, ProcessLaunchPlanServiceLike, ProcessLauncherService, ProgrammaticLaunchRequestLike, ProgrammaticLaunchResultLike, RegisteredProcessWatcherLike, ExternalSourceServiceLike, ProcessModelSelectionServiceLike, ProvidedCapability } from '@leitwerk-dev/process-sdk';
4
+ import { ServerExtensionEventMap, ModelProviderDefinition, ProviderCredentialStatus, ProviderAvailability, PiServerAdapter, HandoffDedupKeyRecordLike, ProcessActionDefinition, ServerProcessContext, ProcessActionPreviewDefinition, BuiltServerProcessDefinition, TurnDefinition, ExtensionProcessDefinition, ProcessActionExecutionSource, TurnAcceptanceState, ProcessActionSchedulingDefinition, ScopedSettingsResolver, ProcessLaunchPlan, LaunchPlanPreparationResultLike, QueuedProcessInputLike, ProcessLeafOutcomeDefinition, ServerExtensionEventName, ProcessObservationUpdate, DeferredProcessActivationSnapshotQuery, DeferredProcessActivationSnapshotResult, PreparedDeferredProcessActivation, DeferredProcessActivationOutcome, DeferredProcessActivationFailure, ProcessGraphRegistry, WaitingProcessRestart, ActionExecutionResultLike, ProcessActionServiceLike, ProcessLaunchPlanServiceLike, ProcessLauncherService, ProgrammaticLaunchRequestLike, ProgrammaticLaunchResultLike, RegisteredProcessWatcherLike, ExternalSourceServiceLike, ProcessModelSelectionServiceLike, ProvidedCapability } from '@leitwerk-dev/process-sdk';
5
5
  import { ProcessStateExportHelperRelay, ProcessStateExporter, WorkerRunner, ProcessVolume } from '@leitwerk-dev/worker-runners';
6
6
  import { FastifyInstance } from 'fastify';
7
7
  import { ConfigSnapshot, ServerConfigSnapshot, StorageConfigSnapshot, ComponentConfigSnapshot, WorkersConfigSnapshot, ProcessConfigSnapshot, NotificationsConfigSnapshot, SandboxConfigSnapshot, ExtensionLoadingConfigSnapshot } from '@leitwerk-dev/protocol/config-snapshot';
8
8
  import { DockerNetworkConfig, PiResourceBundle, PiResourceProvenanceKind, WorkerQuestionResponsePayload, WorkerQuestionRequestedPayload, WorkerTurnFailedPayload, WorkerIntegrationToolRequestPayload, WorkerIntegrationToolResultPayload, WorkerIntegrationToolCancelPayload, WorkerTurnStartAcceptedPayload, WorkerCredentialUpdateResultPayload, IpcEnvelope, ServerToWorkerMessage, InputDelivery, WorkerTurnTerminalRecordedPayload } from '@leitwerk-dev/worker-protocol';
9
9
  import { drizzle } from 'drizzle-orm/node-sqlite';
10
10
  import * as _leitwerk_dev_protocol from '@leitwerk-dev/protocol';
11
- import { LeafOutcomeRendererDescriptor, BrowserUiExtensionDescriptor, CompactTurnSummary, PrimaryPathUiSnapshot, TurnTracePreview, SkillSelection, SkillOptionSummary, SkillCatalogItem, InstalledSkillCatalogItem, SkillCatalogDetail, InstalledSkillCatalogDetail, WsFrame, KnownDurableWsFrameType, WsPayloadByType, KnownEphemeralWsFrameType, PrimaryPathEntrySnapshot, DurableWsFrameInput, ParsedLauncherRequestBody, LauncherModelConfigDefaults, LauncherValidationError, ParsedActionRequestBody, SkillsCatalogResponseBody } from '@leitwerk-dev/protocol';
12
- import { Actor, StartupObservation, ExternalWriteLog, FutureExecutionScheduleKind, DurableModelSelection, FutureExecutionBlockReason, FutureExecutionKind, FutureExecution, LaunchOrigin, LaunchChecklistStep, LaunchRun, TurnId, MappedRunStatus, MappedItem, MappedRun, ProcessEvent, InputSource, InputKind, ProcessInputTarget, ProcessInput, ProcessCustomizableFields, ProcessLifecycleStatus, CurrentExecutionRef, ModelSelectionKind, ProcessSelectedTurnModelSource, ProcessInstance, ProcessLeafOutcomeSnapshotStatus, ProcessLeafOutcomeSnapshot, ProcessProject, ProcessQuestionRequest, NormalizedQuestion, ProcessRelation, ProcessToolApprovalRequest, ProcessToolApprovalDestination, ToolApprovalStatus, TurnAnnotationReference, ProcessTurnAnnotation, ProcessTurnType, ProcessTurnRecordStatus, ModelSelectionProvenance, MappedTurnItemRef, WorkerErrorClass, ProcessTurnRecordPathType, ProcessTurnRecord, TurnStartRecord, TurnStartRecordState, WorkerState, WorkerBootstrapReceipt, WorkerLease, ProcessTurnTerminalLifecycleStatus, ProcessSemanticEntryRefKey, LaunchModelConfigInput, TurnStartKind, QuestionAnswerDraft, ProcessProductRef, TurnFailedPayload, TurnOutcomePayload } from '@leitwerk-dev/domain';
11
+ import { LeafOutcomeRendererDescriptor, BrowserUiExtensionDescriptor, InspectionConfigurationRevision, CompactTurnSummary, PrimaryPathUiSnapshot, TurnTracePreview, SkillSelection, SkillRevisionProvenance, SkillOptionSummary, SkillCatalogItem, InstalledSkillCatalogItem, SkillCatalogDetail, InstalledSkillCatalogDetail, WsFrame, KnownDurableWsFrameType, WsPayloadByType, KnownEphemeralWsFrameType, PrimaryPathEntrySnapshot, DurableWsFrameInput, ParsedLauncherRequestBody, LauncherModelConfigDefaults, validateScheduleRequestInput, LauncherValidationError, ParsedActionRequestBody, SkillsCatalogResponseBody } from '@leitwerk-dev/protocol';
12
+ import { Actor, ExecutionInspectionRecord, InspectionContextObservation, SettingsSubject, SettingsOverride, StartupObservation, ExternalWriteLog, FutureExecutionScheduleKind, DurableModelSelection, FutureExecutionBlockReason, FutureExecutionKind, FutureExecution, LaunchOrigin, LaunchChecklistStep, LaunchRun, TurnId, MappedRunStatus, MappedItem, MappedRun, ProcessEvent, InputSource, InputKind, ProcessInputTarget, ProcessInput, ProcessCustomizableFields, ProcessLifecycleStatus, CurrentExecutionRef, ModelSelectionKind, ProcessSelectedTurnModelSource, ProcessInstance, ProcessLeafOutcomeSnapshotStatus, ProcessLeafOutcomeSnapshot, ProcessProject, ProcessQuestionRequest, NormalizedQuestion, ProcessRelation, ProcessToolApprovalRequest, ProcessToolApprovalDestination, ToolApprovalStatus, TurnAnnotationReference, ProcessTurnAnnotation, ProcessTurnType, ProcessTurnRecordStatus, ModelSelectionProvenance, MappedTurnItemRef, WorkerErrorClass, ProcessTurnRecordPathType, ProcessTurnRecord, TurnStartRecord, TurnStartRecordState, WorkerState, WorkerBootstrapReceipt, WorkerLease, ProcessTurnTerminalLifecycleStatus, ProcessSemanticEntryRefKey, ScopedSettingsSnapshot, SettingsContext, LaunchModelConfigInput, TurnStartKind, QuestionAnswerDraft, ProcessProductRef, AutomaticStartupRecoverySummary, TurnFailedPayload, TurnOutcomePayload } from '@leitwerk-dev/domain';
13
+ import { ApiTokenMetadata, ProcessSelectedTurnSummary, SettingsPreview, SettingFieldView, SettingsScopesResponse, SettingsOverviewResponse } from '@leitwerk-dev/protocol/http-contracts';
13
14
  import { ToolCallRendererDefinition } from '@leitwerk-dev/protocol/tool-renderer-contract';
14
- import { ApiTokenMetadata, ProcessSelectedTurnSummary } from '@leitwerk-dev/protocol/http-contracts';
15
+ import { createTopicWikiRepo } from '@leitwerk-dev/wiki/server';
16
+ import { PublicationStore } from '@leitwerk-dev/external-writes';
15
17
  import { ExternalWriteLogRecordInput } from '@leitwerk-dev/external-writes/internal';
16
18
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
17
19
  import { SessionTransferAttemptWire, SessionTransferLimits, LeitwerkTransferManifestV1 } from '@leitwerk-dev/session-transfer';
@@ -134,6 +136,8 @@ interface DockerRunnerConfig {
134
136
  }
135
137
  /** @internal */
136
138
  interface KubernetesProcessVolumeConfig {
139
+ /** Discard terminal workspaces and their backing storage; disabled by default. @internal */
140
+ reclaim_on_close?: boolean;
137
141
  /** Optional ready-volume target; zero stops replenishment. @internal */
138
142
  pre_provision?: {
139
143
  /** @internal */
@@ -150,11 +154,17 @@ interface KubernetesProcessVolumeConfig {
150
154
  }
151
155
  /** @internal */
152
156
  interface KubernetesDockerConfig {
157
+ /** Default profile for Docker processes without an explicit process/component profile. @internal */
158
+ worker_runtime_profile?: string;
159
+ /** Docker-only selector keys override matching global Pod selector keys. @internal */
160
+ node_selector?: Record<string, string>;
153
161
  /** Pod RuntimeClass selected for every Docker-requiring process. @internal */
154
162
  runtime_class_name?: string;
155
163
  /** Pod user-namespace policy passed directly to spec.hostUsers. @internal */
156
164
  host_users?: boolean;
157
- /** @internal Opt in to the verified gVisor Docker wrapper and guest capabilities. */
165
+ /** Trusted sandbox policy for a separately qualified cluster runtime. @internal */
166
+ isolation?: "gvisor" | "virtual-machine";
167
+ /** Legacy alias for isolation: gvisor when isolation is omitted. @internal */
158
168
  gvisor?: boolean;
159
169
  /** StorageClass selected for the process's single retained PVC. @internal */
160
170
  process_storage_class_name?: string;
@@ -197,6 +207,11 @@ interface LocalWorkerRunnerConfig {
197
207
  }
198
208
  /** @internal */
199
209
  interface KubernetesRunnerConfig {
210
+ /** Optional worker image preparation on eligible nodes; disabled by default. @internal */
211
+ image_preload?: {
212
+ /** @internal */
213
+ enabled: boolean;
214
+ };
200
215
  /** Dedicated namespace where the singleton server runs. @internal */
201
216
  server_namespace: string;
202
217
  /** Safe DNS prefix used to derive one namespace per process instance. @internal */
@@ -361,6 +376,8 @@ interface LeitwerkConfig extends ConfigSnapshot {
361
376
  internal_tls?: InternalTlsConfig;
362
377
  /** Git repositories scanned for operator-managed skills. @internal */
363
378
  skill_repositories?: SkillRepositoryConfig[];
379
+ /** Installed skill IDs included in new launches unless replaced by process defaults. @public */
380
+ default_skills?: string[];
364
381
  /** Server-owned repository-aware commit-message generation rules. @internal */
365
382
  commit_messages?: CommitMessageConfig;
366
383
  /** Bounded archive and extraction ceilings for local session transfer. @internal */
@@ -613,6 +630,55 @@ declare function createApiTokenRepo(db: LeitwerkDb): {
613
630
  touch(id: string, at: string): void;
614
631
  };
615
632
 
633
+ /** Immutable content and incremental observation references. No session ancestry is copied. @internal */
634
+ declare function createExecutionInspectionRepo(db: LeitwerkDb): {
635
+ /** Model identities without loading retained prompts or message contents. @internal */
636
+ modelInputs(instanceId: string, turnRecordId: string): Pick<InspectionConfigurationRevision, "id" | "timestamp" | "boundaryEntryId" | "model">[];
637
+ /** @internal */
638
+ append(input: Omit<ExecutionInspectionRecord, "sequence">): "stored" | "replay";
639
+ /** Expanded evidence is read only on demand. @internal */
640
+ list(instanceId: string, turnRecordId: string): ExecutionInspectionRecord[];
641
+ /** Small origin/product references for compact lineage without loading prompts. @internal */
642
+ listContextFacts(instanceId: string, turnRecordIds?: string[]): InspectionContextObservation[];
643
+ };
644
+
645
+ /** @internal */
646
+ declare function createPublicationRepo(db: LeitwerkDb): PublicationStore;
647
+
648
+ /** @internal */
649
+ type SettingsWrite = Omit<SettingsOverride, "revision" | "createdAt" | "updatedAt"> & {
650
+ /** @internal */
651
+ expectedRevision: number;
652
+ };
653
+ /** @internal */
654
+ type SubjectWrite = Pick<SettingsSubject, "scopeType" | "identity" | "label" | "context"> & {
655
+ /** @internal */
656
+ id?: string;
657
+ };
658
+ /** @internal */
659
+ declare function createScopedSettingsRepo(db: LeitwerkDb): {
660
+ /** @internal */
661
+ listSubjects(): SettingsSubject[];
662
+ /** @internal */
663
+ getSubject(id: string): SettingsSubject | null;
664
+ /** @internal */
665
+ findIdentity(scopeType: string, identity: string): SettingsSubject | null;
666
+ /** @internal */
667
+ findAlias(alias: string): SettingsSubject | null;
668
+ /** @internal */
669
+ putSubject(input: SubjectWrite): SettingsSubject;
670
+ /** @internal */
671
+ putAlias(alias: string, subjectId: string): void;
672
+ /** @internal */
673
+ listOverrides(subjectId?: string): SettingsOverride[];
674
+ /** @internal */
675
+ getOverride(subjectId: string, key: string): SettingsOverride | null;
676
+ /** Atomic compare-and-swap, including resets and first writes. @internal */
677
+ write(input: SettingsWrite): SettingsOverride | null;
678
+ /** Call inside a transaction after verifying that active overrides agree. @internal */
679
+ mergeLocatorSubject(sourceId: string, targetId: string): void;
680
+ };
681
+
616
682
  /** @internal */
617
683
  declare function createStartupObservationRepo(db: LeitwerkDb): {
618
684
  /** @internal */
@@ -648,12 +714,21 @@ interface SessionSummary {
648
714
  }
649
715
  /** @internal */
650
716
  declare function createTurnSummaryRepo(db: LeitwerkDb): {
717
+ /** Dashboard projections never load assistant text, event payloads or session files. @internal */
718
+ listDashboardCosts(): {
719
+ /** @internal */
720
+ providerId: string | null;
721
+ /** @internal */
722
+ modelId: string | null;
723
+ /** @internal */
724
+ costUsd: number | null;
725
+ }[];
651
726
  /** @internal */
652
727
  get(turnRecordId: string): CompactTurnSummary | null;
653
728
  /** @internal */
654
729
  put(instanceId: string, turnRecordId: string, summary: CompactTurnSummary): void;
655
730
  /** @internal */
656
- listByInstance(instanceId: string): Record<string, CompactTurnSummary>;
731
+ listByInstance(instanceId: string, turnRecordIds?: string[]): Record<string, CompactTurnSummary>;
657
732
  /** @internal */
658
733
  getSession(instanceId: string): SessionSummary | null;
659
734
  /** @internal */
@@ -1050,6 +1125,8 @@ interface CreateProcessEventInput {
1050
1125
  }
1051
1126
  /** @internal */
1052
1127
  declare function createProcessEventRepo(db: LeitwerkDb): {
1128
+ /** Timeline facts without embedded process state or provider responses. @internal */
1129
+ listUiSnapshotEvents(instanceId: string, turnRecordIds: readonly string[]): ProcessEvent[];
1053
1130
  /** @internal */
1054
1131
  create(input: CreateProcessEventInput): ProcessEvent;
1055
1132
  /** @internal */
@@ -1207,6 +1284,23 @@ declare function createProcessInstanceRepo(db: LeitwerkDb): {
1207
1284
  getById(id: string): ProcessInstance | null;
1208
1285
  /** @public */
1209
1286
  listAll(): ProcessInstance[];
1287
+ /** Model references for current work without loading prompts or process state. @internal */
1288
+ listModelConfigurations(): {
1289
+ /** @internal */
1290
+ id: string;
1291
+ /** @internal */
1292
+ processId: string;
1293
+ /** @internal */
1294
+ title: string | null;
1295
+ /** @internal */
1296
+ defaultModelProfileId: string | null;
1297
+ /** @internal */
1298
+ turnConfigsJson: string | null;
1299
+ /** @internal */
1300
+ selectedTurnId: string | null;
1301
+ /** @internal */
1302
+ selectedTurnModelProfileId: string | null;
1303
+ }[];
1210
1304
  /** @internal */
1211
1305
  listCurrent(limit: number): ProcessInstance[];
1212
1306
  /** @internal */
@@ -1232,11 +1326,22 @@ declare function createProcessInstanceRepo(db: LeitwerkDb): {
1232
1326
  /** @internal */
1233
1327
  setGeneratedTitleIfBlank(id: string, title: string): ProcessInstance | null;
1234
1328
  /** @public */
1235
- update(id: string, input: UpdateProcessInstanceInput): ProcessInstance | null;
1329
+ update(id: string, input: UpdateProcessInstanceInput, options?: {
1330
+ /** Scheduling-only writes retain process activity time; never part of a process patch. @internal */
1331
+ preserveUpdatedAt?: boolean;
1332
+ }): ProcessInstance | null;
1236
1333
  /** @internal */
1237
1334
  delete(id: string): boolean;
1238
1335
  };
1239
1336
 
1337
+ /** @internal */
1338
+ interface HistoryWindow {
1339
+ /** @internal */
1340
+ since?: string;
1341
+ /** @internal */
1342
+ until?: string;
1343
+ }
1344
+
1240
1345
  /** @internal */
1241
1346
  interface CreateProcessLeafOutcomeSnapshotInput {
1242
1347
  /** @internal */
@@ -1271,7 +1376,7 @@ declare function createProcessLeafOutcomeSnapshotRepo(db: LeitwerkDb): {
1271
1376
  /** @internal */
1272
1377
  create(input: CreateProcessLeafOutcomeSnapshotInput): ProcessLeafOutcomeSnapshot;
1273
1378
  /** @internal */
1274
- listByInstance(instanceId: string): ProcessLeafOutcomeSnapshot[];
1379
+ listByInstance(instanceId: string, window?: HistoryWindow): ProcessLeafOutcomeSnapshot[];
1275
1380
  /** @internal */
1276
1381
  getByInstanceAndLeafEntryId(instanceId: string, leafEntryId: string): ProcessLeafOutcomeSnapshot | null;
1277
1382
  };
@@ -1306,6 +1411,8 @@ interface UpdateProcessProjectInput {
1306
1411
  }
1307
1412
  /** @public */
1308
1413
  declare function createProcessProjectRepo(db: LeitwerkDb): {
1414
+ /** @internal */
1415
+ listAll(): ProcessProject[];
1309
1416
  /** @internal */
1310
1417
  create(input: CreateProcessProjectInput): ProcessProject;
1311
1418
  /** @internal */
@@ -1802,7 +1909,9 @@ declare function createProcessTurnAnnotationRepo(db: LeitwerkDb): {
1802
1909
  /** @internal */
1803
1910
  findByKey(instanceId: string, annotationKey: string): ProcessTurnAnnotation | null;
1804
1911
  /** @internal */
1805
- listByInstance(instanceId: string): ProcessTurnAnnotation[];
1912
+ listByInstance(instanceId: string, window?: HistoryWindow): ProcessTurnAnnotation[];
1913
+ /** Keep presentation and observation fields without the raw source event. @internal */
1914
+ listForTimeline(instanceId: string, window?: HistoryWindow): ProcessTurnAnnotation[];
1806
1915
  /** @internal */
1807
1916
  update(id: string, input: UpdateProcessTurnAnnotationInput): ProcessTurnAnnotation | null;
1808
1917
  /** @internal */
@@ -1863,6 +1972,10 @@ declare function createProcessTurnRecordRepo(db: LeitwerkDb): {
1863
1972
  getById(id: string): ProcessTurnRecord | null;
1864
1973
  /** @public */
1865
1974
  listByInstance(instanceId: string): ProcessTurnRecord[];
1975
+ /** Only absent summaries need repair; don't read every retained turn at startup. @internal */
1976
+ listMissingSummaries(instanceId: string): ProcessTurnRecord[];
1977
+ /** A stable page, even when new turns arrive or timestamps tie. @internal */
1978
+ listPage(instanceId: string, before?: Pick<ProcessTurnRecord, "startedAt" | "id">, limit?: number): ProcessTurnRecord[];
1866
1979
  /** @internal */
1867
1980
  getLatestSucceededPrimaryByInstance(instanceId: string): ProcessTurnRecord | null;
1868
1981
  /** @internal */
@@ -1980,6 +2093,8 @@ declare function createSessionTransferRepo(db: LeitwerkDb): {
1980
2093
 
1981
2094
  /** @internal */
1982
2095
  interface ImportedSkill {
2096
+ /** Explicit extension provenance and dependencies. @internal */
2097
+ provenance?: SkillRevisionProvenance;
1983
2098
  /** @internal */
1984
2099
  skillId: string;
1985
2100
  /** @internal */
@@ -1997,6 +2112,12 @@ interface ImportedRepositorySkill extends ImportedSkill {
1997
2112
  sourcePath: string;
1998
2113
  }
1999
2114
 
2115
+ /** @internal */
2116
+ interface ImportedExtensionSkill extends ImportedSkill {
2117
+ /** @internal */
2118
+ provenance: SkillRevisionProvenance;
2119
+ }
2120
+
2000
2121
  /** @internal */
2001
2122
  declare function createSkillRepo(db: LeitwerkDb): {
2002
2123
  /** @internal */
@@ -2005,6 +2126,8 @@ declare function createSkillRepo(db: LeitwerkDb): {
2005
2126
  resolveActive(ids: readonly string[]): SkillSelection[];
2006
2127
  /** @internal */
2007
2128
  reconcile(imported: readonly ImportedSkill[]): void;
2129
+ /** Reconcile all loaded extension packs in the caller's startup transaction. @internal */
2130
+ reconcileExtensions(imported: readonly ImportedExtensionSkill[]): void;
2008
2131
  /** @internal */
2009
2132
  backfillDependencies(): void;
2010
2133
  /** @internal */
@@ -2084,7 +2207,7 @@ declare function createTurnStartRecordRepo(db: LeitwerkDb): {
2084
2207
  /** @internal */
2085
2208
  getById(id: string): TurnStartRecord | null;
2086
2209
  /** @internal */
2087
- listByInstance(instanceId: string): TurnStartRecord[];
2210
+ listByInstance(instanceId: string, window?: HistoryWindow): TurnStartRecord[];
2088
2211
  /** @internal */
2089
2212
  compareAndSetState(input: {
2090
2213
  /** @internal */
@@ -2149,7 +2272,7 @@ declare function createWorkerLeaseRepo(db: LeitwerkDb): {
2149
2272
  /** @internal */
2150
2273
  getById(id: string): WorkerLease | null;
2151
2274
  /** @internal */
2152
- listByInstance(instanceId: string): WorkerLease[];
2275
+ listByInstance(instanceId: string, window?: HistoryWindow): WorkerLease[];
2153
2276
  /** @internal */
2154
2277
  listActive(): WorkerLease[];
2155
2278
  /** @internal */
@@ -2164,6 +2287,14 @@ declare function createWorkerLeaseRepo(db: LeitwerkDb): {
2164
2287
 
2165
2288
  /** @public */
2166
2289
  interface RepositoryBundle {
2290
+ /** @internal */
2291
+ topicWiki: ReturnType<typeof createTopicWikiRepo>;
2292
+ /** @internal */
2293
+ publications: ReturnType<typeof createPublicationRepo>;
2294
+ /** @internal */
2295
+ executionInspections: ReturnType<typeof createExecutionInspectionRepo>;
2296
+ /** @internal */
2297
+ scopedSettings: ReturnType<typeof createScopedSettingsRepo>;
2167
2298
  /** @internal */
2168
2299
  startupObservations: ReturnType<typeof createStartupObservationRepo>;
2169
2300
  /** @internal */
@@ -2328,6 +2459,82 @@ interface ProcessActionRegistry {
2328
2459
  resolveActionScheduling(processId: string, process: Pick<ProcessInstance, "selectedTurnId" | "paramsJson" | "stateJson">, actionId: string): ResolvedActionScheduling | null;
2329
2460
  }
2330
2461
 
2462
+ /** @internal */
2463
+ type SettingsDraft = Omit<SettingsOverride, "actor" | "createdAt" | "updatedAt">;
2464
+ /** @internal */
2465
+ type SettingsChange = Omit<SettingsWrite, "schemaVersion" | "mode"> & Partial<Pick<SettingsWrite, "mode">>;
2466
+ /** @internal */
2467
+ type SubjectProcess = Pick<ProcessInstance, "id" | "processId" | "metadata">;
2468
+ /** @internal */
2469
+ type Project = Pick<_leitwerk_dev_process_sdk.ProcessLaunchProjectConfig, "key" | "repoLocator" | "metadata">;
2470
+ /** @internal */
2471
+ interface ProcessScopeContext {
2472
+ /** @internal */
2473
+ context: SettingsContext;
2474
+ /** @internal */
2475
+ subjects: Array<{
2476
+ /** @internal */
2477
+ project: Project;
2478
+ /** @internal */
2479
+ subject: SettingsSubject;
2480
+ }>;
2481
+ /** @internal */
2482
+ explanations: string[];
2483
+ }
2484
+ /** @internal */
2485
+ interface ProcessSettingsPreview {
2486
+ /** @internal */
2487
+ turnId: string;
2488
+ /** @internal */
2489
+ settings: ScopedSettingsSnapshot | null;
2490
+ /** @internal */
2491
+ error: string | null;
2492
+ }
2493
+ /** Read-only model references without repository discovery or choice providers. @internal */
2494
+ interface ScopedModelReference {
2495
+ /** @internal */
2496
+ key: string;
2497
+ /** @internal */
2498
+ label: string;
2499
+ /** Null for extension-defined defaults. @internal */
2500
+ subjectId: string | null;
2501
+ /** @internal */
2502
+ modelProfileId: string | null;
2503
+ /** Invalid schema, version, or override mode; never includes raw values. @internal */
2504
+ invalid: boolean;
2505
+ }
2506
+ /** @internal */
2507
+ interface ScopedSettingsService extends ScopedSettingsResolver {
2508
+ /** @internal */
2509
+ modelReferences(): ScopedModelReference[];
2510
+ /** @internal */
2511
+ capture(process: SubjectProcess, turnId: string, includeModelDefault?: boolean): ScopedSettingsSnapshot | undefined;
2512
+ /** @internal */
2513
+ modelDefault(processId: string, turnId: string, process?: SubjectProcess, plan?: ProcessLaunchPlan): string | null;
2514
+ /** @internal */
2515
+ preview(subjectId: string, draft?: SettingsDraft): Promise<SettingsPreview>;
2516
+ /** @internal */
2517
+ choices(subjectId: string, key: string, search?: string): Promise<SettingFieldView["choices"]>;
2518
+ /** @internal */
2519
+ write(change: SettingsChange): SettingsOverride;
2520
+ /** @internal */
2521
+ listScopes(): SettingsScopesResponse;
2522
+ /** @internal */
2523
+ overview(scopeType: string): Promise<SettingsOverviewResponse>;
2524
+ /** @internal */
2525
+ forProcess(process: SubjectProcess): ProcessScopeContext;
2526
+ /** @internal */
2527
+ forLaunch(plan: ProcessLaunchPlan): ProcessScopeContext;
2528
+ /** @internal */
2529
+ previewProcess(process: SubjectProcess): ProcessSettingsPreview[];
2530
+ /** @internal */
2531
+ definitions(): Array<Pick<SettingFieldView, "key" | "owner" | "schemaVersion" | "scopes" | "merge" | "form">>;
2532
+ /** @internal */
2533
+ refresh(): Promise<SettingsScopesResponse>;
2534
+ /** @internal */
2535
+ previewDraft(change: Omit<SettingsChange, "expectedRevision">): Promise<SettingsPreview>;
2536
+ }
2537
+
2331
2538
  /** @internal */
2332
2539
  type ProcessModelAvailabilitySnapshot = ModelStatusCacheSnapshot;
2333
2540
  /** @internal */
@@ -2419,6 +2626,8 @@ type ProcessModelPolicyFailure = ProcessModelPolicyFailureBase & ({
2419
2626
  /** @internal */
2420
2627
  readonly source: "configuration" | "selection_provenance";
2421
2628
  /** @internal */
2629
+ readonly message?: string;
2630
+ /** @internal */
2422
2631
  readonly issues: readonly (PersistedModelConfigurationIssue | PersistedModelSelectionIssue)[];
2423
2632
  } | {
2424
2633
  /** @internal */
@@ -2494,6 +2703,8 @@ interface ProjectedLauncherModelPreview {
2494
2703
  readonly description: string;
2495
2704
  /** @internal */
2496
2705
  readonly effective: {
2706
+ /** @internal */
2707
+ readonly error?: string;
2497
2708
  /** @internal */
2498
2709
  readonly source: ProjectedModelResolutionSource;
2499
2710
  /** @internal */
@@ -2543,6 +2754,14 @@ type ProjectedProcessModelConfiguration = {
2543
2754
  /** @internal */
2544
2755
  readonly effectiveConfiguredModelProfileId: string | null;
2545
2756
  /** @internal */
2757
+ readonly fixedModelProfileId: string | null;
2758
+ /** @internal */
2759
+ readonly effectiveModelProfileId: string | null;
2760
+ /** @internal */
2761
+ readonly effectiveSource: ProcessSelectedTurnModelSource | "none";
2762
+ /** @internal */
2763
+ readonly effectiveError?: string;
2764
+ /** @internal */
2546
2765
  readonly source: "instance" | "process_config" | "default";
2547
2766
  }[];
2548
2767
  };
@@ -2635,6 +2854,8 @@ type ProcessModelPolicyProjectionSubject = {
2635
2854
  /** @internal */
2636
2855
  readonly kind: "launcher_preview";
2637
2856
  /** @internal */
2857
+ readonly plan?: ProcessLaunchPlan;
2858
+ /** @internal */
2638
2859
  readonly processId: string;
2639
2860
  /** @internal */
2640
2861
  readonly modelConfig: LaunchModelConfigInput;
@@ -2834,6 +3055,8 @@ interface IpcHandlerDeps extends Pick<RepositoryBundle, "processes" | "projects"
2834
3055
  /** @internal */
2835
3056
  startupObservations?: RepositoryBundle["startupObservations"];
2836
3057
  /** @internal */
3058
+ executionInspections?: RepositoryBundle["executionInspections"];
3059
+ /** @internal */
2837
3060
  getLaunchCoordinator?: () => LaunchCoordinator | undefined;
2838
3061
  /** @internal */
2839
3062
  processQuestions?: ProcessQuestionService;
@@ -3224,64 +3447,48 @@ type FutureExecutionTransitionPlan = {
3224
3447
  /** @internal */
3225
3448
  type DurableBroadcast = DurableWsFrameInput;
3226
3449
  /** @internal */
3227
- type TurnRecordWrite = {
3450
+ type CreateWrite<T> = {
3228
3451
  /** @internal */
3229
3452
  kind: "create";
3230
3453
  /** @internal */
3231
- input: CreateProcessTurnRecordInput;
3232
- } | {
3454
+ input: T;
3455
+ };
3456
+ /** @internal */
3457
+ type UpdateWrite<T> = {
3233
3458
  /** @internal */
3234
3459
  kind: "update";
3235
3460
  /** @internal */
3236
3461
  id: string;
3237
3462
  /** @internal */
3238
- input: UpdateProcessTurnRecordInput;
3463
+ input: T;
3239
3464
  };
3240
3465
  /** @internal */
3241
- type TurnStartWrite = {
3242
- /** @internal */
3243
- kind: "create";
3244
- /** @internal */
3245
- input: Omit<TurnStartRecord, "id" | "createdAt" | "updatedAt"> & {
3246
- /** @internal */
3247
- id?: string;
3248
- };
3249
- } | {
3466
+ type DeleteWrite = {
3250
3467
  /** @internal */
3251
- kind: "cas_state";
3468
+ kind: "delete";
3252
3469
  /** @internal */
3253
3470
  id: string;
3254
- /** @internal */
3255
- expectedKind: TurnStartRecord["state"]["kind"];
3256
- /** @internal */
3257
- state: TurnStartRecord["state"];
3258
3471
  };
3259
3472
  /** @internal */
3260
- type TurnAnnotationWrite = {
3261
- /** @internal */
3262
- kind: "create";
3473
+ type TurnRecordWrite = CreateWrite<CreateProcessTurnRecordInput> | UpdateWrite<UpdateProcessTurnRecordInput>;
3474
+ /** @internal */
3475
+ type TurnStartWrite = CreateWrite<Omit<TurnStartRecord, "id" | "createdAt" | "updatedAt"> & {
3263
3476
  /** @internal */
3264
- input: CreateProcessTurnAnnotationInput;
3265
- } | {
3477
+ id?: string;
3478
+ }> | {
3266
3479
  /** @internal */
3267
- kind: "update";
3480
+ kind: "cas_state";
3268
3481
  /** @internal */
3269
3482
  id: string;
3270
3483
  /** @internal */
3271
- input: UpdateProcessTurnAnnotationInput;
3272
- } | {
3273
- /** @internal */
3274
- kind: "delete";
3484
+ expectedKind: TurnStartRecord["state"]["kind"];
3275
3485
  /** @internal */
3276
- id: string;
3486
+ state: TurnStartRecord["state"];
3277
3487
  };
3488
+ /** @internal */
3489
+ type TurnAnnotationWrite = CreateWrite<CreateProcessTurnAnnotationInput> | UpdateWrite<UpdateProcessTurnAnnotationInput> | DeleteWrite;
3278
3490
  /** Mapped-run writes, committed in order before turn starts. @internal */
3279
- type MappedRunWrite = {
3280
- /** @internal */
3281
- kind: "create";
3282
- /** @internal */
3283
- input: CreateMappedRunInput;
3284
- } | {
3491
+ type MappedRunWrite = CreateWrite<CreateMappedRunInput> | {
3285
3492
  /** @internal */
3286
3493
  kind: "complete_item";
3287
3494
  /** @internal */
@@ -3291,12 +3498,7 @@ type MappedRunWrite = {
3291
3498
  kind: "abort_active";
3292
3499
  };
3293
3500
  /** @internal */
3294
- type LeafOutcomeSnapshotWrite = {
3295
- /** @internal */
3296
- kind: "create";
3297
- /** @internal */
3298
- input: CreateProcessLeafOutcomeSnapshotInput;
3299
- };
3501
+ type LeafOutcomeSnapshotWrite = CreateWrite<CreateProcessLeafOutcomeSnapshotInput>;
3300
3502
  /** @internal */
3301
3503
  type WorkerIntent = {
3302
3504
  /** @internal */
@@ -3319,24 +3521,7 @@ type WorkerIntent = {
3319
3521
  reason: string;
3320
3522
  };
3321
3523
  /** @internal */
3322
- type PendingExternalSourceFireWrite = {
3323
- /** @internal */
3324
- kind: "create";
3325
- /** @internal */
3326
- input: CreatePendingExternalSourceFireInput;
3327
- } | {
3328
- /** @internal */
3329
- kind: "update";
3330
- /** @internal */
3331
- id: string;
3332
- /** @internal */
3333
- input: UpdatePendingExternalSourceFireInput;
3334
- } | {
3335
- /** @internal */
3336
- kind: "delete";
3337
- /** @internal */
3338
- id: string;
3339
- };
3524
+ type PendingExternalSourceFireWrite = CreateWrite<CreatePendingExternalSourceFireInput> | UpdateWrite<UpdatePendingExternalSourceFireInput> | DeleteWrite;
3340
3525
  /** @internal */
3341
3526
  interface DecisionMetadata {
3342
3527
  /** @internal */
@@ -3346,6 +3531,10 @@ interface DecisionMetadata {
3346
3531
  }
3347
3532
  /** @internal */
3348
3533
  interface Writes {
3534
+ /** Internal scheduling writes do not count as process activity. @internal */
3535
+ preserveUpdatedAt?: boolean;
3536
+ /** A fenced, successful server-side wait check. Never supplied by extensions. @internal */
3537
+ waitForAdmission?: string;
3349
3538
  /** @internal */
3350
3539
  processPatch: UpdateProcessInstanceInput;
3351
3540
  /** @internal */
@@ -3357,6 +3546,8 @@ interface Writes {
3357
3546
  /** @internal */
3358
3547
  input: UpdateProcessProjectInput;
3359
3548
  };
3549
+ /** Initial bindings, committed before the first worker start. @internal */
3550
+ initialProjects?: CreateProcessProjectInput[];
3360
3551
  /** @internal */
3361
3552
  turnRecordWrites: TurnRecordWrite[];
3362
3553
  /** @internal */
@@ -3396,6 +3587,8 @@ interface RecordCommit {
3396
3587
  /** @internal */
3397
3588
  committedProject: ProcessProject | null;
3398
3589
  /** @internal */
3590
+ initialProjects?: ProcessProject[];
3591
+ /** @internal */
3399
3592
  committedTurnRecords: ProcessTurnRecord[];
3400
3593
  /** @internal */
3401
3594
  committedLeafOutcomeSnapshots: ProcessLeafOutcomeSnapshot[];
@@ -3626,6 +3819,8 @@ type EngineResult<T = undefined> = EngineSuccess<T> | EngineFailure<T>;
3626
3819
  type ActionExecutionResult = ActionExecutionResultLike;
3627
3820
  /** @internal */
3628
3821
  interface ProcessEngine {
3822
+ /** @internal */
3823
+ applyProcessObservation(instanceId: string, input: ProcessObservationUpdate): Promise<EngineResult<void>>;
3629
3824
  /** @internal */
3630
3825
  getDeferredProcessActivationSnapshots(query: DeferredProcessActivationSnapshotQuery): DeferredProcessActivationSnapshotResult;
3631
3826
  /** @internal */
@@ -3644,6 +3839,8 @@ interface ProcessEngine {
3644
3839
  startProcess(instanceId: string, startTurnId: TurnId, opts?: {
3645
3840
  /** @internal */
3646
3841
  actor?: Actor;
3842
+ /** @internal */
3843
+ restart?: WaitingProcessRestart;
3647
3844
  }): Promise<EngineResult<void>>;
3648
3845
  /** @internal */
3649
3846
  abortProcess(instanceId: string, opts?: {
@@ -3670,6 +3867,8 @@ interface ProcessEngine {
3670
3867
  }): Promise<EngineResult<void>>;
3671
3868
  /** @internal */
3672
3869
  retryStartup(instanceId: string, startRecordId: string, opts?: {
3870
+ /** @internal */
3871
+ actor?: Actor;
3673
3872
  /** @internal */
3674
3873
  nextTurnModelProfileId?: string | null;
3675
3874
  /** @internal */
@@ -3678,6 +3877,11 @@ interface ProcessEngine {
3678
3877
  /** @internal */
3679
3878
  startRecordId: string;
3680
3879
  }>>;
3880
+ /** Automatic recovery never retries accepted turns or resets the startup budget. @internal */
3881
+ retryStartupAutomatically(instanceId: string, startRecordId: string, opts?: {
3882
+ /** @internal */
3883
+ availabilityCause?: "availability_transition" | "startup_reconciliation";
3884
+ }): Promise<EngineResult<AutomaticStartupRecoverySummary>>;
3681
3885
  /** @internal */
3682
3886
  continueFailedTurn(instanceId: string, turnRecordId: string, options?: {
3683
3887
  /** @internal */
@@ -3915,6 +4119,9 @@ interface LauncherRecentValuesService {
3915
4119
  record(launcherId: string, launcherInput: Record<string, unknown>): void;
3916
4120
  }
3917
4121
 
4122
+ /** Server-owned defaults, resolved only when selecting skills for a new launch. @internal */
4123
+ type LaunchSkillDefaults = Pick<LeitwerkConfig, "default_skills" | "process_configs">;
4124
+
3918
4125
  /** @internal */
3919
4126
  type ProcessLaunchRelationInput = Omit<ProcessRelation, "kind" | "childInstanceId" | "createdAt">;
3920
4127
 
@@ -4006,28 +4213,9 @@ type LaunchMutationOutcome = {
4006
4213
  interface NormalizedScheduledLaunchInput extends ParsedLauncherRequestBody {
4007
4214
  }
4008
4215
  /** @internal */
4009
- type ValidatedLaunchSchedule = {
4010
- /** @internal */
4011
- mode: "now";
4012
- /** @internal */
4013
- nextRunAt: null;
4014
- /** @internal */
4015
- cronExpression: null;
4016
- } | {
4017
- /** @internal */
4018
- mode: "once";
4019
- /** @internal */
4020
- nextRunAt: string;
4021
- /** @internal */
4022
- cronExpression: null;
4023
- } | {
4024
- /** @internal */
4025
- mode: "cron";
4026
- /** @internal */
4027
- nextRunAt: string;
4028
- /** @internal */
4029
- cronExpression: string;
4030
- };
4216
+ type ValidatedLaunchSchedule = Extract<ReturnType<typeof validateScheduleRequestInput>, {
4217
+ ok: true;
4218
+ }>["value"];
4031
4219
  /** @internal */
4032
4220
  interface PreparedLaunch {
4033
4221
  /** @internal */
@@ -4064,6 +4252,8 @@ type PreparedLaunchResult = {
4064
4252
 
4065
4253
  /** @internal */
4066
4254
  interface FutureExecutionExecutorDeps extends Pick<RepositoryBundle, "futureExecutions" | "processes" | "projects" | "processRelations" | "processSkills" | "skills" | "handoffDedupKeys" | "transaction"> {
4255
+ /** @internal */
4256
+ skillDefaults?: LaunchSkillDefaults;
4067
4257
  /** @internal */
4068
4258
  turnRecords?: RepositoryBundle["turnRecords"];
4069
4259
  /** @internal */
@@ -4134,33 +4324,6 @@ interface FutureExecutionLifecycleOptions {
4134
4324
  now?: () => Date;
4135
4325
  }
4136
4326
  /** @internal */
4137
- type LifecycleFailure = {
4138
- /** @internal */
4139
- kind: "invalid";
4140
- /** @internal */
4141
- issues: readonly FutureExecutionIssue[];
4142
- } | {
4143
- /** @internal */
4144
- kind: "not_found";
4145
- /** @internal */
4146
- target: "future_execution" | "launch" | "action" | "process";
4147
- } | {
4148
- /** @internal */
4149
- kind: "conflict";
4150
- /** @internal */
4151
- issue: FutureExecutionIssue;
4152
- } | {
4153
- /** @internal */
4154
- kind: "unavailable";
4155
- /** @internal */
4156
- reason: string;
4157
- } | {
4158
- /** @internal */
4159
- kind: "failed";
4160
- /** @internal */
4161
- issue: FutureExecutionIssue;
4162
- };
4163
- /** @internal */
4164
4327
  type ActionMutationOutcome = {
4165
4328
  /** @internal */
4166
4329
  kind: "scheduled";
@@ -4199,7 +4362,7 @@ type ActionMutationOutcome = {
4199
4362
  error: string;
4200
4363
  /** @internal */
4201
4364
  code: string;
4202
- } | LifecycleFailure;
4365
+ } | LaunchFailure;
4203
4366
  /** @internal */
4204
4367
  type CancelFutureExecutionOutcome = {
4205
4368
  /** @internal */
@@ -4248,6 +4411,8 @@ declare function createFutureExecutionLifecycle(deps: FutureExecutionLifecycleDe
4248
4411
  prepareLaunch: (launcherId: string, request: NormalizedScheduledLaunchInput, opts?: {
4249
4412
  /** @internal */
4250
4413
  resolvedLauncher?: _leitwerk_dev_process_sdk.ResolvedProcessLauncher;
4414
+ /** @internal */
4415
+ futureExecutionId?: string;
4251
4416
  }) => Promise<PreparedLaunchResult>;
4252
4417
  /** @internal */
4253
4418
  commitPreparedLaunch: (prepared: PreparedLaunch, opts?: {
@@ -4746,6 +4911,8 @@ declare function createToolApprovalGate(input: {
4746
4911
  repos: ToolApprovalRepos;
4747
4912
  /** @internal */
4748
4913
  processOperations: ProcessOperationCoordinator;
4914
+ /** @internal */
4915
+ broadcaster: Pick<Broadcaster, "sendDurable">;
4749
4916
  }): {
4750
4917
  /** @internal */
4751
4918
  reconcile: (instanceId: string) => void;
@@ -4774,22 +4941,37 @@ declare function createToolApprovalGate(input: {
4774
4941
  /** @internal */
4775
4942
  type ToolApprovalGate = ReturnType<typeof createToolApprovalGate>;
4776
4943
 
4944
+ /** @internal */
4777
4945
  interface TokenAuditContext {
4946
+ /** @internal */
4778
4947
  operation: string;
4948
+ /** @internal */
4779
4949
  tokenId?: string;
4950
+ /** @internal */
4780
4951
  actor?: Actor;
4952
+ /** @internal */
4781
4953
  ownerKind?: "user" | "anonymous";
4954
+ /** @internal */
4782
4955
  count?: number;
4783
4956
  }
4784
4957
  declare module "fastify" {
4958
+ /** @internal */
4785
4959
  interface FastifyRequest {
4960
+ /** @internal */
4786
4961
  actor?: Actor;
4962
+ /** @internal */
4787
4963
  tokenAudit?: TokenAuditContext;
4788
4964
  }
4789
4965
  }
4790
4966
 
4791
4967
  /** @public */
4792
- interface RouteDeps extends Pick<RepositoryBundle, "processes" | "launchRuns" | "projects" | "inputs" | "events" | "turnSummaries" | "futureExecutions" | "skills" | "processSkills" | "handoffDedupKeys" | "leafOutcomeSnapshots" | "questionRequests" | "processRelations" | "toolApprovalRequests" | "turnRecords" | "turnStarts" | "turnAnnotations" | "leases" | "externalWrites" | "transaction"> {
4968
+ interface RouteDeps extends Pick<RepositoryBundle, "processes" | "launchRuns" | "projects" | "inputs" | "events" | "turnSummaries" | "executionInspections" | "futureExecutions" | "skills" | "processSkills" | "handoffDedupKeys" | "leafOutcomeSnapshots" | "questionRequests" | "processRelations" | "toolApprovalRequests" | "turnRecords" | "turnStarts" | "turnAnnotations" | "leases" | "externalWrites" | "transaction"> {
4969
+ /** @internal */
4970
+ scopedSettingsService?: ScopedSettingsService;
4971
+ /** @internal */
4972
+ topicWiki?: RepositoryBundle["topicWiki"];
4973
+ /** @internal */
4974
+ onSettingsChanged?: () => Promise<void>;
4793
4975
  /** @internal */
4794
4976
  mappedRuns?: RepositoryBundle["mappedRuns"];
4795
4977
  /** @internal */
@@ -4854,6 +5036,15 @@ interface RouteDeps extends Pick<RepositoryBundle, "processes" | "launchRuns" |
4854
5036
 
4855
5037
  /** @public */
4856
5038
  interface AppOptions {
5039
+ /** Clock and cadence seam for readiness integration tests. @internal */
5040
+ turnWait?: {
5041
+ /** @internal */
5042
+ now?: () => number;
5043
+ /** @internal */
5044
+ pollIntervalMs?: number;
5045
+ /** @internal */
5046
+ timeoutMs?: number;
5047
+ };
4857
5048
  /** @public */
4858
5049
  config?: LeitwerkConfig;
4859
5050
  /** @internal */