@leitwerk-dev/server 0.3.1 → 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.
Files changed (309) hide show
  1. package/dist/{app-BuJCdkvy.d.ts → app-CsuxFZT5.d.ts} +262 -121
  2. package/dist/app-JM4CBTND.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-FPMDWQF7.js} +2617 -562
  8. package/dist/chunk-FPMDWQF7.js.map +1 -0
  9. package/dist/{chunk-HK6BLLHA.js → chunk-MBHRCQFE.js} +2303 -1576
  10. package/dist/chunk-MBHRCQFE.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 +14 -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/db/database.d.ts.map +1 -1
  18. package/dist/db/execution-inspection-repo.d.ts +15 -0
  19. package/dist/db/execution-inspection-repo.d.ts.map +1 -0
  20. package/dist/db/history-window.d.ts +11 -0
  21. package/dist/db/history-window.d.ts.map +1 -0
  22. package/dist/db/process-event-repo.d.ts +2 -0
  23. package/dist/db/process-event-repo.d.ts.map +1 -1
  24. package/dist/db/process-instance-repo.d.ts +4 -1
  25. package/dist/db/process-instance-repo.d.ts.map +1 -1
  26. package/dist/db/process-leaf-outcome-snapshot-repo.d.ts +2 -1
  27. package/dist/db/process-leaf-outcome-snapshot-repo.d.ts.map +1 -1
  28. package/dist/db/process-project-repo.d.ts +2 -0
  29. package/dist/db/process-project-repo.d.ts.map +1 -1
  30. package/dist/db/process-skill-repo.d.ts.map +1 -1
  31. package/dist/db/process-turn-annotation-repo.d.ts +4 -1
  32. package/dist/db/process-turn-annotation-repo.d.ts.map +1 -1
  33. package/dist/db/process-turn-record-repo.d.ts +4 -0
  34. package/dist/db/process-turn-record-repo.d.ts.map +1 -1
  35. package/dist/db/publication-repo.d.ts +5 -0
  36. package/dist/db/publication-repo.d.ts.map +1 -0
  37. package/dist/db/repositories.d.ts +12 -0
  38. package/dist/db/repositories.d.ts.map +1 -1
  39. package/dist/db/schema.d.ts +693 -2
  40. package/dist/db/schema.d.ts.map +1 -1
  41. package/dist/db/scoped-settings-repo.d.ts +37 -0
  42. package/dist/db/scoped-settings-repo.d.ts.map +1 -0
  43. package/dist/db/skill-repo.d.ts +3 -0
  44. package/dist/db/skill-repo.d.ts.map +1 -1
  45. package/dist/db/turn-start-record-repo.d.ts +2 -1
  46. package/dist/db/turn-start-record-repo.d.ts.map +1 -1
  47. package/dist/db/turn-summary-repo.d.ts +1 -1
  48. package/dist/db/turn-summary-repo.d.ts.map +1 -1
  49. package/dist/db/worker-lease-repo.d.ts +2 -1
  50. package/dist/db/worker-lease-repo.d.ts.map +1 -1
  51. package/dist/domain-logic/outcome-tools.d.ts.map +1 -1
  52. package/dist/external-source-service.d.ts.map +1 -1
  53. package/dist/future-execution/execution.d.ts +4 -1
  54. package/dist/future-execution/execution.d.ts.map +1 -1
  55. package/dist/future-execution/launch-lifecycle.d.ts +9 -25
  56. package/dist/future-execution/launch-lifecycle.d.ts.map +1 -1
  57. package/dist/future-execution/lifecycle.d.ts +3 -28
  58. package/dist/future-execution/lifecycle.d.ts.map +1 -1
  59. package/dist/future-execution/model-projection.d.ts.map +1 -1
  60. package/dist/future-execution/reconciliation.d.ts +1 -0
  61. package/dist/future-execution/reconciliation.d.ts.map +1 -1
  62. package/dist/future-execution-presenter.d.ts.map +1 -1
  63. package/dist/index.js +2 -2
  64. package/dist/integration-tool-registry.d.ts +11 -2
  65. package/dist/integration-tool-registry.d.ts.map +1 -1
  66. package/dist/launch-coordinator.d.ts.map +1 -1
  67. package/dist/launcher-model-config-service.d.ts +7 -1
  68. package/dist/launcher-model-config-service.d.ts.map +1 -1
  69. package/dist/leaf-outcome-snapshot-capture.d.ts +1 -0
  70. package/dist/leaf-outcome-snapshot-capture.d.ts.map +1 -1
  71. package/dist/main.js +3 -3
  72. package/dist/primary-path-snapshot.d.ts.map +1 -1
  73. package/dist/process-action-presenter.d.ts +1 -6
  74. package/dist/process-action-presenter.d.ts.map +1 -1
  75. package/dist/process-action-registry.d.ts.map +1 -1
  76. package/dist/process-engine/decision.d.ts +2 -0
  77. package/dist/process-engine/decision.d.ts.map +1 -1
  78. package/dist/process-engine/engine.d.ts.map +1 -1
  79. package/dist/process-engine/mapped-turns.d.ts.map +1 -1
  80. package/dist/process-engine/ops/continue-failed-turn.d.ts.map +1 -1
  81. package/dist/process-engine/ops/process-observation.d.ts +6 -0
  82. package/dist/process-engine/ops/process-observation.d.ts.map +1 -0
  83. package/dist/process-engine/ops/retry-failed-turn.d.ts.map +1 -1
  84. package/dist/process-engine/ops/retry-startup.d.ts.map +1 -1
  85. package/dist/process-engine/ops/start-process.d.ts +2 -0
  86. package/dist/process-engine/ops/start-process.d.ts.map +1 -1
  87. package/dist/process-engine/ops/turn-outcome.d.ts.map +1 -1
  88. package/dist/process-engine/ops/turn-wait.d.ts +30 -0
  89. package/dist/process-engine/ops/turn-wait.d.ts.map +1 -0
  90. package/dist/process-engine/ops/update-model-config.d.ts +9 -0
  91. package/dist/process-engine/ops/update-model-config.d.ts.map +1 -0
  92. package/dist/process-engine/recorder.d.ts.map +1 -1
  93. package/dist/process-engine/turn-start-preflight.d.ts +6 -0
  94. package/dist/process-engine/turn-start-preflight.d.ts.map +1 -1
  95. package/dist/process-engine/turn-wait-state.d.ts +24 -0
  96. package/dist/process-engine/turn-wait-state.d.ts.map +1 -0
  97. package/dist/process-engine/turn-worker-requirement.d.ts +2 -0
  98. package/dist/process-engine/turn-worker-requirement.d.ts.map +1 -1
  99. package/dist/process-engine/types.d.ts +5 -1
  100. package/dist/process-engine/types.d.ts.map +1 -1
  101. package/dist/process-engine/writes/build-process-abort-writes.d.ts +3 -1
  102. package/dist/process-engine/writes/build-process-abort-writes.d.ts.map +1 -1
  103. package/dist/process-engine/writes/build-turn-outcome-writes.d.ts +2 -0
  104. package/dist/process-engine/writes/build-turn-outcome-writes.d.ts.map +1 -1
  105. package/dist/process-engine/writes/commit-writes.d.ts +2 -0
  106. package/dist/process-engine/writes/commit-writes.d.ts.map +1 -1
  107. package/dist/process-engine/writes/writes.d.ts +28 -60
  108. package/dist/process-engine/writes/writes.d.ts.map +1 -1
  109. package/dist/process-graph.d.ts +1 -1
  110. package/dist/process-graph.d.ts.map +1 -1
  111. package/dist/process-inspection-reader.d.ts +21 -0
  112. package/dist/process-inspection-reader.d.ts.map +1 -0
  113. package/dist/process-inspection-trace.d.ts +13 -0
  114. package/dist/process-inspection-trace.d.ts.map +1 -0
  115. package/dist/process-inspection.d.ts +22 -0
  116. package/dist/process-inspection.d.ts.map +1 -0
  117. package/dist/process-instance-tree-presenter.d.ts +4 -3
  118. package/dist/process-instance-tree-presenter.d.ts.map +1 -1
  119. package/dist/process-launch-executor.d.ts +2 -0
  120. package/dist/process-launch-executor.d.ts.map +1 -1
  121. package/dist/process-launch-plan.d.ts +1 -0
  122. package/dist/process-launch-plan.d.ts.map +1 -1
  123. package/dist/process-launcher-registry.d.ts.map +1 -1
  124. package/dist/process-model-config.d.ts +19 -0
  125. package/dist/process-model-config.d.ts.map +1 -0
  126. package/dist/process-model-policy/construct.d.ts.map +1 -1
  127. package/dist/process-model-policy/evaluate.d.ts.map +1 -1
  128. package/dist/process-model-policy/index.d.ts +4 -1
  129. package/dist/process-model-policy/index.d.ts.map +1 -1
  130. package/dist/process-model-policy/project.d.ts.map +1 -1
  131. package/dist/process-model-policy/types.d.ts +18 -0
  132. package/dist/process-model-policy/types.d.ts.map +1 -1
  133. package/dist/process-model-policy-presenter.d.ts.map +1 -1
  134. package/dist/process-runtime-availability.d.ts +2 -1
  135. package/dist/process-runtime-availability.d.ts.map +1 -1
  136. package/dist/process-turn-trace.d.ts.map +1 -1
  137. package/dist/process-ui-snapshot-presenter.d.ts +14 -3
  138. package/dist/process-ui-snapshot-presenter.d.ts.map +1 -1
  139. package/dist/routes/future-executions.d.ts.map +1 -1
  140. package/dist/routes/launchers.d.ts.map +1 -1
  141. package/dist/routes/process-actions.d.ts.map +1 -1
  142. package/dist/routes/process-detail.d.ts.map +1 -1
  143. package/dist/routes/process-model-config.d.ts +4 -0
  144. package/dist/routes/process-model-config.d.ts.map +1 -0
  145. package/dist/routes/process-route-helpers.d.ts +8 -9
  146. package/dist/routes/process-route-helpers.d.ts.map +1 -1
  147. package/dist/routes/processes.d.ts.map +1 -1
  148. package/dist/routes/settings.d.ts +11 -0
  149. package/dist/routes/settings.d.ts.map +1 -0
  150. package/dist/routes/ticket-creation.d.ts.map +1 -1
  151. package/dist/scoped-settings-service.d.ts +83 -0
  152. package/dist/scoped-settings-service.d.ts.map +1 -0
  153. package/dist/server-bootstrap/build-host-capabilities.d.ts +2 -0
  154. package/dist/server-bootstrap/build-host-capabilities.d.ts.map +1 -1
  155. package/dist/server-bootstrap/register-http.d.ts.map +1 -1
  156. package/dist/session-summary-projection.d.ts.map +1 -1
  157. package/dist/skills/bundled-skills.d.ts +5 -0
  158. package/dist/skills/bundled-skills.d.ts.map +1 -0
  159. package/dist/skills/catalog-service.d.ts +1 -0
  160. package/dist/skills/catalog-service.d.ts.map +1 -1
  161. package/dist/skills/extension-importer.d.ts +11 -0
  162. package/dist/skills/extension-importer.d.ts.map +1 -0
  163. package/dist/skills/launch-skills.d.ts +11 -0
  164. package/dist/skills/launch-skills.d.ts.map +1 -0
  165. package/dist/skills/skill-frontmatter.d.ts +5 -0
  166. package/dist/skills/skill-frontmatter.d.ts.map +1 -1
  167. package/dist/skills/source-importer.d.ts +3 -0
  168. package/dist/skills/source-importer.d.ts.map +1 -1
  169. package/dist/startup-evidence.d.ts +3 -0
  170. package/dist/startup-evidence.d.ts.map +1 -1
  171. package/dist/supervisor/execution-inspection-ingestor.d.ts +9 -0
  172. package/dist/supervisor/execution-inspection-ingestor.d.ts.map +1 -0
  173. package/dist/supervisor/ipc-handler.d.ts +2 -0
  174. package/dist/supervisor/ipc-handler.d.ts.map +1 -1
  175. package/dist/supervisor/worker-event-ingestor.d.ts +1 -0
  176. package/dist/supervisor/worker-event-ingestor.d.ts.map +1 -1
  177. package/dist/supervisor/worker-start-payload-builder.d.ts.map +1 -1
  178. package/dist/supervisor/worker-supervisor.d.ts +2 -0
  179. package/dist/supervisor/worker-supervisor.d.ts.map +1 -1
  180. package/dist/test-helpers/prepared-fixture-start.d.ts.map +1 -1
  181. package/dist/test-helpers/process-model-fixtures.d.ts +1 -0
  182. package/dist/test-helpers/process-model-fixtures.d.ts.map +1 -1
  183. package/dist/test-helpers/scoped-settings-fixtures.d.ts +16 -0
  184. package/dist/test-helpers/scoped-settings-fixtures.d.ts.map +1 -0
  185. package/dist/test-helpers/skill-fixtures.d.ts +4 -0
  186. package/dist/test-helpers/skill-fixtures.d.ts.map +1 -0
  187. package/dist/testing.js +2 -1
  188. package/dist/testing.js.map +1 -1
  189. package/dist/tool-approval-gate.d.ts +3 -0
  190. package/dist/tool-approval-gate.d.ts.map +1 -1
  191. package/dist/turn-progress.d.ts.map +1 -1
  192. package/dist/turn-wait-service.d.ts +28 -0
  193. package/dist/turn-wait-service.d.ts.map +1 -0
  194. package/dist/worker-runtime-profile-selection.d.ts +2 -0
  195. package/dist/worker-runtime-profile-selection.d.ts.map +1 -1
  196. package/package.json +20 -19
  197. package/src/app.ts +115 -5
  198. package/src/auth/fastify-auth.ts +13 -0
  199. package/src/config/config-loader.ts +40 -2
  200. package/src/config/config-types.ts +14 -1
  201. package/src/config/kubernetes-docker-isolation.ts +21 -0
  202. package/src/db/database.ts +131 -40
  203. package/src/db/execution-inspection-repo.ts +163 -0
  204. package/src/db/history-window.ts +18 -0
  205. package/src/db/process-event-repo.ts +88 -10
  206. package/src/db/process-instance-repo.ts +9 -2
  207. package/src/db/process-leaf-outcome-snapshot-repo.ts +8 -2
  208. package/src/db/process-project-repo.ts +4 -0
  209. package/src/db/process-skill-repo.ts +9 -2
  210. package/src/db/process-turn-annotation-repo.ts +27 -9
  211. package/src/db/process-turn-record-repo.ts +45 -12
  212. package/src/db/publication-repo.ts +63 -0
  213. package/src/db/repositories.ts +17 -0
  214. package/src/db/schema.ts +103 -1
  215. package/src/db/scoped-settings-repo.ts +234 -0
  216. package/src/db/skill-repo.ts +89 -27
  217. package/src/db/turn-start-record-repo.ts +8 -2
  218. package/src/db/turn-summary-repo.ts +12 -3
  219. package/src/db/worker-lease-repo.ts +8 -2
  220. package/src/domain-logic/outcome-tools.ts +4 -193
  221. package/src/external-source-service.ts +33 -7
  222. package/src/future-execution/execution.ts +9 -2
  223. package/src/future-execution/launch-lifecycle.ts +87 -78
  224. package/src/future-execution/lifecycle.ts +5 -34
  225. package/src/future-execution/model-projection.ts +2 -0
  226. package/src/future-execution/reconciliation.ts +7 -0
  227. package/src/future-execution-presenter.ts +7 -8
  228. package/src/integration-tool-registry.ts +59 -26
  229. package/src/launch-coordinator.ts +10 -1
  230. package/src/launcher-model-config-service.ts +24 -3
  231. package/src/leaf-outcome-snapshot-capture.ts +2 -0
  232. package/src/primary-path-snapshot.ts +3 -4
  233. package/src/process-action-presenter.ts +22 -57
  234. package/src/process-action-registry.ts +31 -39
  235. package/src/process-engine/decision.ts +10 -0
  236. package/src/process-engine/engine.ts +11 -2
  237. package/src/process-engine/mapped-turns.ts +5 -7
  238. package/src/process-engine/ops/continue-failed-turn.ts +2 -13
  239. package/src/process-engine/ops/process-observation.ts +119 -0
  240. package/src/process-engine/ops/retry-failed-turn.ts +2 -12
  241. package/src/process-engine/ops/retry-startup.ts +9 -13
  242. package/src/process-engine/ops/start-process.ts +34 -2
  243. package/src/process-engine/ops/turn-outcome.ts +61 -60
  244. package/src/process-engine/ops/turn-wait.ts +225 -0
  245. package/src/process-engine/ops/update-model-config.ts +66 -0
  246. package/src/process-engine/recorder.ts +21 -5
  247. package/src/process-engine/turn-start-preflight.ts +168 -105
  248. package/src/process-engine/turn-wait-state.ts +126 -0
  249. package/src/process-engine/turn-worker-requirement.ts +4 -0
  250. package/src/process-engine/types.ts +9 -0
  251. package/src/process-engine/writes/build-process-abort-writes.ts +30 -20
  252. package/src/process-engine/writes/build-turn-outcome-writes.ts +39 -2
  253. package/src/process-engine/writes/commit-writes.ts +15 -2
  254. package/src/process-engine/writes/writes.ts +59 -74
  255. package/src/process-graph.ts +0 -1
  256. package/src/process-inspection-reader.ts +305 -0
  257. package/src/process-inspection-trace.ts +176 -0
  258. package/src/process-inspection.ts +169 -0
  259. package/src/process-instance-tree-presenter.ts +56 -216
  260. package/src/process-launch-executor.ts +5 -2
  261. package/src/process-launch-plan.ts +17 -2
  262. package/src/process-launcher-registry.ts +28 -16
  263. package/src/process-model-config.ts +100 -0
  264. package/src/process-model-policy/construct.ts +1 -0
  265. package/src/process-model-policy/evaluate.ts +34 -32
  266. package/src/process-model-policy/index.ts +45 -3
  267. package/src/process-model-policy/project.ts +62 -76
  268. package/src/process-model-policy/types.ts +26 -0
  269. package/src/process-model-policy-presenter.ts +7 -3
  270. package/src/process-runtime-availability.ts +9 -4
  271. package/src/process-turn-trace.ts +12 -24
  272. package/src/process-ui-snapshot-presenter.ts +210 -295
  273. package/src/routes/future-executions.ts +5 -5
  274. package/src/routes/launchers.ts +51 -1
  275. package/src/routes/process-actions.ts +9 -9
  276. package/src/routes/process-detail.ts +25 -2
  277. package/src/routes/process-model-config.ts +70 -0
  278. package/src/routes/process-route-helpers.ts +153 -162
  279. package/src/routes/processes.ts +2 -0
  280. package/src/routes/settings.ts +173 -0
  281. package/src/routes/ticket-creation.ts +28 -5
  282. package/src/scoped-settings-service.ts +736 -0
  283. package/src/server-bootstrap/build-host-capabilities.ts +42 -0
  284. package/src/server-bootstrap/register-http.ts +7 -1
  285. package/src/session-summary-projection.ts +1 -2
  286. package/src/skills/bundled-skills.ts +64 -0
  287. package/src/skills/catalog-service.ts +35 -6
  288. package/src/skills/extension-importer.ts +97 -0
  289. package/src/skills/launch-skills.ts +19 -0
  290. package/src/skills/skill-frontmatter.ts +13 -0
  291. package/src/skills/source-importer.ts +3 -0
  292. package/src/startup-evidence.ts +20 -0
  293. package/src/supervisor/execution-inspection-ingestor.ts +55 -0
  294. package/src/supervisor/ipc-handler.ts +2 -0
  295. package/src/supervisor/worker-event-ingestor.ts +30 -14
  296. package/src/supervisor/worker-start-payload-builder.ts +17 -0
  297. package/src/supervisor/worker-supervisor.ts +3 -0
  298. package/src/test-helpers/prepared-fixture-start.ts +1 -0
  299. package/src/test-helpers/process-model-fixtures.ts +2 -0
  300. package/src/test-helpers/scoped-settings-fixtures.ts +126 -0
  301. package/src/test-helpers/skill-fixtures.ts +28 -0
  302. package/src/tool-approval-gate.ts +16 -0
  303. package/src/turn-progress.ts +3 -2
  304. package/src/turn-wait-service.ts +228 -0
  305. package/src/worker-runtime-profile-selection.ts +8 -1
  306. package/dist/app-MSJXFK33.js +0 -8
  307. package/dist/chunk-HK6BLLHA.js.map +0 -1
  308. package/dist/chunk-QCHS3X33.js.map +0 -1
  309. /package/dist/{app-MSJXFK33.js.map → app-JM4CBTND.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, 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';
@@ -150,11 +152,17 @@ interface KubernetesProcessVolumeConfig {
150
152
  }
151
153
  /** @internal */
152
154
  interface KubernetesDockerConfig {
155
+ /** Default profile for Docker processes without an explicit process/component profile. @internal */
156
+ worker_runtime_profile?: string;
157
+ /** Docker-only selector keys override matching global Pod selector keys. @internal */
158
+ node_selector?: Record<string, string>;
153
159
  /** Pod RuntimeClass selected for every Docker-requiring process. @internal */
154
160
  runtime_class_name?: string;
155
161
  /** Pod user-namespace policy passed directly to spec.hostUsers. @internal */
156
162
  host_users?: boolean;
157
- /** @internal Opt in to the verified gVisor Docker wrapper and guest capabilities. */
163
+ /** Trusted sandbox policy for a separately qualified cluster runtime. @internal */
164
+ isolation?: "gvisor" | "virtual-machine";
165
+ /** Legacy alias for isolation: gvisor when isolation is omitted. @internal */
158
166
  gvisor?: boolean;
159
167
  /** StorageClass selected for the process's single retained PVC. @internal */
160
168
  process_storage_class_name?: string;
@@ -197,6 +205,11 @@ interface LocalWorkerRunnerConfig {
197
205
  }
198
206
  /** @internal */
199
207
  interface KubernetesRunnerConfig {
208
+ /** Optional worker image preparation on eligible nodes; disabled by default. @internal */
209
+ image_preload?: {
210
+ /** @internal */
211
+ enabled: boolean;
212
+ };
200
213
  /** Dedicated namespace where the singleton server runs. @internal */
201
214
  server_namespace: string;
202
215
  /** Safe DNS prefix used to derive one namespace per process instance. @internal */
@@ -361,6 +374,8 @@ interface LeitwerkConfig extends ConfigSnapshot {
361
374
  internal_tls?: InternalTlsConfig;
362
375
  /** Git repositories scanned for operator-managed skills. @internal */
363
376
  skill_repositories?: SkillRepositoryConfig[];
377
+ /** Installed skill IDs included in new launches unless replaced by process defaults. @public */
378
+ default_skills?: string[];
364
379
  /** Server-owned repository-aware commit-message generation rules. @internal */
365
380
  commit_messages?: CommitMessageConfig;
366
381
  /** Bounded archive and extraction ceilings for local session transfer. @internal */
@@ -613,6 +628,55 @@ declare function createApiTokenRepo(db: LeitwerkDb): {
613
628
  touch(id: string, at: string): void;
614
629
  };
615
630
 
631
+ /** Immutable content and incremental observation references. No session ancestry is copied. @internal */
632
+ declare function createExecutionInspectionRepo(db: LeitwerkDb): {
633
+ /** Model identities without loading retained prompts or message contents. @internal */
634
+ modelInputs(instanceId: string, turnRecordId: string): Pick<InspectionConfigurationRevision, "id" | "timestamp" | "boundaryEntryId" | "model">[];
635
+ /** @internal */
636
+ append(input: Omit<ExecutionInspectionRecord, "sequence">): "stored" | "replay";
637
+ /** Expanded evidence is read only on demand. @internal */
638
+ list(instanceId: string, turnRecordId: string): ExecutionInspectionRecord[];
639
+ /** Small origin/product references for compact lineage without loading prompts. @internal */
640
+ listContextFacts(instanceId: string, turnRecordIds?: string[]): InspectionContextObservation[];
641
+ };
642
+
643
+ /** @internal */
644
+ declare function createPublicationRepo(db: LeitwerkDb): PublicationStore;
645
+
646
+ /** @internal */
647
+ type SettingsWrite = Omit<SettingsOverride, "revision" | "createdAt" | "updatedAt"> & {
648
+ /** @internal */
649
+ expectedRevision: number;
650
+ };
651
+ /** @internal */
652
+ type SubjectWrite = Pick<SettingsSubject, "scopeType" | "identity" | "label" | "context"> & {
653
+ /** @internal */
654
+ id?: string;
655
+ };
656
+ /** @internal */
657
+ declare function createScopedSettingsRepo(db: LeitwerkDb): {
658
+ /** @internal */
659
+ listSubjects(): SettingsSubject[];
660
+ /** @internal */
661
+ getSubject(id: string): SettingsSubject | null;
662
+ /** @internal */
663
+ findIdentity(scopeType: string, identity: string): SettingsSubject | null;
664
+ /** @internal */
665
+ findAlias(alias: string): SettingsSubject | null;
666
+ /** @internal */
667
+ putSubject(input: SubjectWrite): SettingsSubject;
668
+ /** @internal */
669
+ putAlias(alias: string, subjectId: string): void;
670
+ /** @internal */
671
+ listOverrides(subjectId?: string): SettingsOverride[];
672
+ /** @internal */
673
+ getOverride(subjectId: string, key: string): SettingsOverride | null;
674
+ /** Atomic compare-and-swap, including resets and first writes. @internal */
675
+ write(input: SettingsWrite): SettingsOverride | null;
676
+ /** Call inside a transaction after verifying that active overrides agree. @internal */
677
+ mergeLocatorSubject(sourceId: string, targetId: string): void;
678
+ };
679
+
616
680
  /** @internal */
617
681
  declare function createStartupObservationRepo(db: LeitwerkDb): {
618
682
  /** @internal */
@@ -653,7 +717,7 @@ declare function createTurnSummaryRepo(db: LeitwerkDb): {
653
717
  /** @internal */
654
718
  put(instanceId: string, turnRecordId: string, summary: CompactTurnSummary): void;
655
719
  /** @internal */
656
- listByInstance(instanceId: string): Record<string, CompactTurnSummary>;
720
+ listByInstance(instanceId: string, turnRecordIds?: string[]): Record<string, CompactTurnSummary>;
657
721
  /** @internal */
658
722
  getSession(instanceId: string): SessionSummary | null;
659
723
  /** @internal */
@@ -1050,6 +1114,8 @@ interface CreateProcessEventInput {
1050
1114
  }
1051
1115
  /** @internal */
1052
1116
  declare function createProcessEventRepo(db: LeitwerkDb): {
1117
+ /** Timeline facts without embedded process state or provider responses. @internal */
1118
+ listUiSnapshotEvents(instanceId: string, turnRecordIds: readonly string[]): ProcessEvent[];
1053
1119
  /** @internal */
1054
1120
  create(input: CreateProcessEventInput): ProcessEvent;
1055
1121
  /** @internal */
@@ -1232,11 +1298,22 @@ declare function createProcessInstanceRepo(db: LeitwerkDb): {
1232
1298
  /** @internal */
1233
1299
  setGeneratedTitleIfBlank(id: string, title: string): ProcessInstance | null;
1234
1300
  /** @public */
1235
- update(id: string, input: UpdateProcessInstanceInput): ProcessInstance | null;
1301
+ update(id: string, input: UpdateProcessInstanceInput, options?: {
1302
+ /** Scheduling-only writes retain process activity time; never part of a process patch. @internal */
1303
+ preserveUpdatedAt?: boolean;
1304
+ }): ProcessInstance | null;
1236
1305
  /** @internal */
1237
1306
  delete(id: string): boolean;
1238
1307
  };
1239
1308
 
1309
+ /** @internal */
1310
+ interface HistoryWindow {
1311
+ /** @internal */
1312
+ since?: string;
1313
+ /** @internal */
1314
+ until?: string;
1315
+ }
1316
+
1240
1317
  /** @internal */
1241
1318
  interface CreateProcessLeafOutcomeSnapshotInput {
1242
1319
  /** @internal */
@@ -1271,7 +1348,7 @@ declare function createProcessLeafOutcomeSnapshotRepo(db: LeitwerkDb): {
1271
1348
  /** @internal */
1272
1349
  create(input: CreateProcessLeafOutcomeSnapshotInput): ProcessLeafOutcomeSnapshot;
1273
1350
  /** @internal */
1274
- listByInstance(instanceId: string): ProcessLeafOutcomeSnapshot[];
1351
+ listByInstance(instanceId: string, window?: HistoryWindow): ProcessLeafOutcomeSnapshot[];
1275
1352
  /** @internal */
1276
1353
  getByInstanceAndLeafEntryId(instanceId: string, leafEntryId: string): ProcessLeafOutcomeSnapshot | null;
1277
1354
  };
@@ -1306,6 +1383,8 @@ interface UpdateProcessProjectInput {
1306
1383
  }
1307
1384
  /** @public */
1308
1385
  declare function createProcessProjectRepo(db: LeitwerkDb): {
1386
+ /** @internal */
1387
+ listAll(): ProcessProject[];
1309
1388
  /** @internal */
1310
1389
  create(input: CreateProcessProjectInput): ProcessProject;
1311
1390
  /** @internal */
@@ -1802,7 +1881,9 @@ declare function createProcessTurnAnnotationRepo(db: LeitwerkDb): {
1802
1881
  /** @internal */
1803
1882
  findByKey(instanceId: string, annotationKey: string): ProcessTurnAnnotation | null;
1804
1883
  /** @internal */
1805
- listByInstance(instanceId: string): ProcessTurnAnnotation[];
1884
+ listByInstance(instanceId: string, window?: HistoryWindow): ProcessTurnAnnotation[];
1885
+ /** Keep presentation and observation fields without the raw source event. @internal */
1886
+ listForTimeline(instanceId: string, window?: HistoryWindow): ProcessTurnAnnotation[];
1806
1887
  /** @internal */
1807
1888
  update(id: string, input: UpdateProcessTurnAnnotationInput): ProcessTurnAnnotation | null;
1808
1889
  /** @internal */
@@ -1863,6 +1944,10 @@ declare function createProcessTurnRecordRepo(db: LeitwerkDb): {
1863
1944
  getById(id: string): ProcessTurnRecord | null;
1864
1945
  /** @public */
1865
1946
  listByInstance(instanceId: string): ProcessTurnRecord[];
1947
+ /** Only absent summaries need repair; don't read every retained turn at startup. @internal */
1948
+ listMissingSummaries(instanceId: string): ProcessTurnRecord[];
1949
+ /** A stable page, even when new turns arrive or timestamps tie. @internal */
1950
+ listPage(instanceId: string, before?: Pick<ProcessTurnRecord, "startedAt" | "id">, limit?: number): ProcessTurnRecord[];
1866
1951
  /** @internal */
1867
1952
  getLatestSucceededPrimaryByInstance(instanceId: string): ProcessTurnRecord | null;
1868
1953
  /** @internal */
@@ -1980,6 +2065,8 @@ declare function createSessionTransferRepo(db: LeitwerkDb): {
1980
2065
 
1981
2066
  /** @internal */
1982
2067
  interface ImportedSkill {
2068
+ /** Explicit extension provenance and dependencies. @internal */
2069
+ provenance?: SkillRevisionProvenance;
1983
2070
  /** @internal */
1984
2071
  skillId: string;
1985
2072
  /** @internal */
@@ -1997,6 +2084,12 @@ interface ImportedRepositorySkill extends ImportedSkill {
1997
2084
  sourcePath: string;
1998
2085
  }
1999
2086
 
2087
+ /** @internal */
2088
+ interface ImportedExtensionSkill extends ImportedSkill {
2089
+ /** @internal */
2090
+ provenance: SkillRevisionProvenance;
2091
+ }
2092
+
2000
2093
  /** @internal */
2001
2094
  declare function createSkillRepo(db: LeitwerkDb): {
2002
2095
  /** @internal */
@@ -2005,6 +2098,8 @@ declare function createSkillRepo(db: LeitwerkDb): {
2005
2098
  resolveActive(ids: readonly string[]): SkillSelection[];
2006
2099
  /** @internal */
2007
2100
  reconcile(imported: readonly ImportedSkill[]): void;
2101
+ /** Reconcile all loaded extension packs in the caller's startup transaction. @internal */
2102
+ reconcileExtensions(imported: readonly ImportedExtensionSkill[]): void;
2008
2103
  /** @internal */
2009
2104
  backfillDependencies(): void;
2010
2105
  /** @internal */
@@ -2084,7 +2179,7 @@ declare function createTurnStartRecordRepo(db: LeitwerkDb): {
2084
2179
  /** @internal */
2085
2180
  getById(id: string): TurnStartRecord | null;
2086
2181
  /** @internal */
2087
- listByInstance(instanceId: string): TurnStartRecord[];
2182
+ listByInstance(instanceId: string, window?: HistoryWindow): TurnStartRecord[];
2088
2183
  /** @internal */
2089
2184
  compareAndSetState(input: {
2090
2185
  /** @internal */
@@ -2149,7 +2244,7 @@ declare function createWorkerLeaseRepo(db: LeitwerkDb): {
2149
2244
  /** @internal */
2150
2245
  getById(id: string): WorkerLease | null;
2151
2246
  /** @internal */
2152
- listByInstance(instanceId: string): WorkerLease[];
2247
+ listByInstance(instanceId: string, window?: HistoryWindow): WorkerLease[];
2153
2248
  /** @internal */
2154
2249
  listActive(): WorkerLease[];
2155
2250
  /** @internal */
@@ -2164,6 +2259,14 @@ declare function createWorkerLeaseRepo(db: LeitwerkDb): {
2164
2259
 
2165
2260
  /** @public */
2166
2261
  interface RepositoryBundle {
2262
+ /** @internal */
2263
+ topicWiki: ReturnType<typeof createTopicWikiRepo>;
2264
+ /** @internal */
2265
+ publications: ReturnType<typeof createPublicationRepo>;
2266
+ /** @internal */
2267
+ executionInspections: ReturnType<typeof createExecutionInspectionRepo>;
2268
+ /** @internal */
2269
+ scopedSettings: ReturnType<typeof createScopedSettingsRepo>;
2167
2270
  /** @internal */
2168
2271
  startupObservations: ReturnType<typeof createStartupObservationRepo>;
2169
2272
  /** @internal */
@@ -2328,6 +2431,67 @@ interface ProcessActionRegistry {
2328
2431
  resolveActionScheduling(processId: string, process: Pick<ProcessInstance, "selectedTurnId" | "paramsJson" | "stateJson">, actionId: string): ResolvedActionScheduling | null;
2329
2432
  }
2330
2433
 
2434
+ /** @internal */
2435
+ type SettingsDraft = Omit<SettingsOverride, "actor" | "createdAt" | "updatedAt">;
2436
+ /** @internal */
2437
+ type SettingsChange = Omit<SettingsWrite, "schemaVersion" | "mode"> & Partial<Pick<SettingsWrite, "mode">>;
2438
+ /** @internal */
2439
+ type SubjectProcess = Pick<ProcessInstance, "id" | "processId" | "metadata">;
2440
+ /** @internal */
2441
+ type Project = Pick<_leitwerk_dev_process_sdk.ProcessLaunchProjectConfig, "key" | "repoLocator" | "metadata">;
2442
+ /** @internal */
2443
+ interface ProcessScopeContext {
2444
+ /** @internal */
2445
+ context: SettingsContext;
2446
+ /** @internal */
2447
+ subjects: Array<{
2448
+ /** @internal */
2449
+ project: Project;
2450
+ /** @internal */
2451
+ subject: SettingsSubject;
2452
+ }>;
2453
+ /** @internal */
2454
+ explanations: string[];
2455
+ }
2456
+ /** @internal */
2457
+ interface ProcessSettingsPreview {
2458
+ /** @internal */
2459
+ turnId: string;
2460
+ /** @internal */
2461
+ settings: ScopedSettingsSnapshot | null;
2462
+ /** @internal */
2463
+ error: string | null;
2464
+ }
2465
+ /** @internal */
2466
+ interface ScopedSettingsService extends ScopedSettingsResolver {
2467
+ /** @internal */
2468
+ capture(process: SubjectProcess, turnId: string, includeModelDefault?: boolean): ScopedSettingsSnapshot | undefined;
2469
+ /** @internal */
2470
+ modelDefault(processId: string, turnId: string, process?: SubjectProcess, plan?: ProcessLaunchPlan): string | null;
2471
+ /** @internal */
2472
+ preview(subjectId: string, draft?: SettingsDraft): Promise<SettingsPreview>;
2473
+ /** @internal */
2474
+ choices(subjectId: string, key: string, search?: string): Promise<SettingFieldView["choices"]>;
2475
+ /** @internal */
2476
+ write(change: SettingsChange): SettingsOverride;
2477
+ /** @internal */
2478
+ listScopes(): SettingsScopesResponse;
2479
+ /** @internal */
2480
+ overview(scopeType: string): Promise<SettingsOverviewResponse>;
2481
+ /** @internal */
2482
+ forProcess(process: SubjectProcess): ProcessScopeContext;
2483
+ /** @internal */
2484
+ forLaunch(plan: ProcessLaunchPlan): ProcessScopeContext;
2485
+ /** @internal */
2486
+ previewProcess(process: SubjectProcess): ProcessSettingsPreview[];
2487
+ /** @internal */
2488
+ definitions(): Array<Pick<SettingFieldView, "key" | "owner" | "schemaVersion" | "scopes" | "merge" | "form">>;
2489
+ /** @internal */
2490
+ refresh(): Promise<SettingsScopesResponse>;
2491
+ /** @internal */
2492
+ previewDraft(change: Omit<SettingsChange, "expectedRevision">): Promise<SettingsPreview>;
2493
+ }
2494
+
2331
2495
  /** @internal */
2332
2496
  type ProcessModelAvailabilitySnapshot = ModelStatusCacheSnapshot;
2333
2497
  /** @internal */
@@ -2419,6 +2583,8 @@ type ProcessModelPolicyFailure = ProcessModelPolicyFailureBase & ({
2419
2583
  /** @internal */
2420
2584
  readonly source: "configuration" | "selection_provenance";
2421
2585
  /** @internal */
2586
+ readonly message?: string;
2587
+ /** @internal */
2422
2588
  readonly issues: readonly (PersistedModelConfigurationIssue | PersistedModelSelectionIssue)[];
2423
2589
  } | {
2424
2590
  /** @internal */
@@ -2494,6 +2660,8 @@ interface ProjectedLauncherModelPreview {
2494
2660
  readonly description: string;
2495
2661
  /** @internal */
2496
2662
  readonly effective: {
2663
+ /** @internal */
2664
+ readonly error?: string;
2497
2665
  /** @internal */
2498
2666
  readonly source: ProjectedModelResolutionSource;
2499
2667
  /** @internal */
@@ -2543,6 +2711,14 @@ type ProjectedProcessModelConfiguration = {
2543
2711
  /** @internal */
2544
2712
  readonly effectiveConfiguredModelProfileId: string | null;
2545
2713
  /** @internal */
2714
+ readonly fixedModelProfileId: string | null;
2715
+ /** @internal */
2716
+ readonly effectiveModelProfileId: string | null;
2717
+ /** @internal */
2718
+ readonly effectiveSource: ProcessSelectedTurnModelSource | "none";
2719
+ /** @internal */
2720
+ readonly effectiveError?: string;
2721
+ /** @internal */
2546
2722
  readonly source: "instance" | "process_config" | "default";
2547
2723
  }[];
2548
2724
  };
@@ -2635,6 +2811,8 @@ type ProcessModelPolicyProjectionSubject = {
2635
2811
  /** @internal */
2636
2812
  readonly kind: "launcher_preview";
2637
2813
  /** @internal */
2814
+ readonly plan?: ProcessLaunchPlan;
2815
+ /** @internal */
2638
2816
  readonly processId: string;
2639
2817
  /** @internal */
2640
2818
  readonly modelConfig: LaunchModelConfigInput;
@@ -2834,6 +3012,8 @@ interface IpcHandlerDeps extends Pick<RepositoryBundle, "processes" | "projects"
2834
3012
  /** @internal */
2835
3013
  startupObservations?: RepositoryBundle["startupObservations"];
2836
3014
  /** @internal */
3015
+ executionInspections?: RepositoryBundle["executionInspections"];
3016
+ /** @internal */
2837
3017
  getLaunchCoordinator?: () => LaunchCoordinator | undefined;
2838
3018
  /** @internal */
2839
3019
  processQuestions?: ProcessQuestionService;
@@ -3224,64 +3404,48 @@ type FutureExecutionTransitionPlan = {
3224
3404
  /** @internal */
3225
3405
  type DurableBroadcast = DurableWsFrameInput;
3226
3406
  /** @internal */
3227
- type TurnRecordWrite = {
3407
+ type CreateWrite<T> = {
3228
3408
  /** @internal */
3229
3409
  kind: "create";
3230
3410
  /** @internal */
3231
- input: CreateProcessTurnRecordInput;
3232
- } | {
3411
+ input: T;
3412
+ };
3413
+ /** @internal */
3414
+ type UpdateWrite<T> = {
3233
3415
  /** @internal */
3234
3416
  kind: "update";
3235
3417
  /** @internal */
3236
3418
  id: string;
3237
3419
  /** @internal */
3238
- input: UpdateProcessTurnRecordInput;
3420
+ input: T;
3239
3421
  };
3240
3422
  /** @internal */
3241
- type TurnStartWrite = {
3242
- /** @internal */
3243
- kind: "create";
3423
+ type DeleteWrite = {
3244
3424
  /** @internal */
3245
- input: Omit<TurnStartRecord, "id" | "createdAt" | "updatedAt"> & {
3246
- /** @internal */
3247
- id?: string;
3248
- };
3249
- } | {
3250
- /** @internal */
3251
- kind: "cas_state";
3425
+ kind: "delete";
3252
3426
  /** @internal */
3253
3427
  id: string;
3254
- /** @internal */
3255
- expectedKind: TurnStartRecord["state"]["kind"];
3256
- /** @internal */
3257
- state: TurnStartRecord["state"];
3258
3428
  };
3259
3429
  /** @internal */
3260
- type TurnAnnotationWrite = {
3261
- /** @internal */
3262
- kind: "create";
3430
+ type TurnRecordWrite = CreateWrite<CreateProcessTurnRecordInput> | UpdateWrite<UpdateProcessTurnRecordInput>;
3431
+ /** @internal */
3432
+ type TurnStartWrite = CreateWrite<Omit<TurnStartRecord, "id" | "createdAt" | "updatedAt"> & {
3263
3433
  /** @internal */
3264
- input: CreateProcessTurnAnnotationInput;
3265
- } | {
3434
+ id?: string;
3435
+ }> | {
3266
3436
  /** @internal */
3267
- kind: "update";
3437
+ kind: "cas_state";
3268
3438
  /** @internal */
3269
3439
  id: string;
3270
3440
  /** @internal */
3271
- input: UpdateProcessTurnAnnotationInput;
3272
- } | {
3273
- /** @internal */
3274
- kind: "delete";
3441
+ expectedKind: TurnStartRecord["state"]["kind"];
3275
3442
  /** @internal */
3276
- id: string;
3443
+ state: TurnStartRecord["state"];
3277
3444
  };
3445
+ /** @internal */
3446
+ type TurnAnnotationWrite = CreateWrite<CreateProcessTurnAnnotationInput> | UpdateWrite<UpdateProcessTurnAnnotationInput> | DeleteWrite;
3278
3447
  /** Mapped-run writes, committed in order before turn starts. @internal */
3279
- type MappedRunWrite = {
3280
- /** @internal */
3281
- kind: "create";
3282
- /** @internal */
3283
- input: CreateMappedRunInput;
3284
- } | {
3448
+ type MappedRunWrite = CreateWrite<CreateMappedRunInput> | {
3285
3449
  /** @internal */
3286
3450
  kind: "complete_item";
3287
3451
  /** @internal */
@@ -3291,12 +3455,7 @@ type MappedRunWrite = {
3291
3455
  kind: "abort_active";
3292
3456
  };
3293
3457
  /** @internal */
3294
- type LeafOutcomeSnapshotWrite = {
3295
- /** @internal */
3296
- kind: "create";
3297
- /** @internal */
3298
- input: CreateProcessLeafOutcomeSnapshotInput;
3299
- };
3458
+ type LeafOutcomeSnapshotWrite = CreateWrite<CreateProcessLeafOutcomeSnapshotInput>;
3300
3459
  /** @internal */
3301
3460
  type WorkerIntent = {
3302
3461
  /** @internal */
@@ -3319,24 +3478,7 @@ type WorkerIntent = {
3319
3478
  reason: string;
3320
3479
  };
3321
3480
  /** @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
- };
3481
+ type PendingExternalSourceFireWrite = CreateWrite<CreatePendingExternalSourceFireInput> | UpdateWrite<UpdatePendingExternalSourceFireInput> | DeleteWrite;
3340
3482
  /** @internal */
3341
3483
  interface DecisionMetadata {
3342
3484
  /** @internal */
@@ -3346,6 +3488,10 @@ interface DecisionMetadata {
3346
3488
  }
3347
3489
  /** @internal */
3348
3490
  interface Writes {
3491
+ /** Internal scheduling writes do not count as process activity. @internal */
3492
+ preserveUpdatedAt?: boolean;
3493
+ /** A fenced, successful server-side wait check. Never supplied by extensions. @internal */
3494
+ waitForAdmission?: string;
3349
3495
  /** @internal */
3350
3496
  processPatch: UpdateProcessInstanceInput;
3351
3497
  /** @internal */
@@ -3357,6 +3503,8 @@ interface Writes {
3357
3503
  /** @internal */
3358
3504
  input: UpdateProcessProjectInput;
3359
3505
  };
3506
+ /** Initial bindings, committed before the first worker start. @internal */
3507
+ initialProjects?: CreateProcessProjectInput[];
3360
3508
  /** @internal */
3361
3509
  turnRecordWrites: TurnRecordWrite[];
3362
3510
  /** @internal */
@@ -3396,6 +3544,8 @@ interface RecordCommit {
3396
3544
  /** @internal */
3397
3545
  committedProject: ProcessProject | null;
3398
3546
  /** @internal */
3547
+ initialProjects?: ProcessProject[];
3548
+ /** @internal */
3399
3549
  committedTurnRecords: ProcessTurnRecord[];
3400
3550
  /** @internal */
3401
3551
  committedLeafOutcomeSnapshots: ProcessLeafOutcomeSnapshot[];
@@ -3626,6 +3776,8 @@ type EngineResult<T = undefined> = EngineSuccess<T> | EngineFailure<T>;
3626
3776
  type ActionExecutionResult = ActionExecutionResultLike;
3627
3777
  /** @internal */
3628
3778
  interface ProcessEngine {
3779
+ /** @internal */
3780
+ applyProcessObservation(instanceId: string, input: ProcessObservationUpdate): Promise<EngineResult<void>>;
3629
3781
  /** @internal */
3630
3782
  getDeferredProcessActivationSnapshots(query: DeferredProcessActivationSnapshotQuery): DeferredProcessActivationSnapshotResult;
3631
3783
  /** @internal */
@@ -3644,6 +3796,8 @@ interface ProcessEngine {
3644
3796
  startProcess(instanceId: string, startTurnId: TurnId, opts?: {
3645
3797
  /** @internal */
3646
3798
  actor?: Actor;
3799
+ /** @internal */
3800
+ restart?: WaitingProcessRestart;
3647
3801
  }): Promise<EngineResult<void>>;
3648
3802
  /** @internal */
3649
3803
  abortProcess(instanceId: string, opts?: {
@@ -3915,6 +4069,9 @@ interface LauncherRecentValuesService {
3915
4069
  record(launcherId: string, launcherInput: Record<string, unknown>): void;
3916
4070
  }
3917
4071
 
4072
+ /** Server-owned defaults, resolved only when selecting skills for a new launch. @internal */
4073
+ type LaunchSkillDefaults = Pick<LeitwerkConfig, "default_skills" | "process_configs">;
4074
+
3918
4075
  /** @internal */
3919
4076
  type ProcessLaunchRelationInput = Omit<ProcessRelation, "kind" | "childInstanceId" | "createdAt">;
3920
4077
 
@@ -4006,28 +4163,9 @@ type LaunchMutationOutcome = {
4006
4163
  interface NormalizedScheduledLaunchInput extends ParsedLauncherRequestBody {
4007
4164
  }
4008
4165
  /** @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
- };
4166
+ type ValidatedLaunchSchedule = Extract<ReturnType<typeof validateScheduleRequestInput>, {
4167
+ ok: true;
4168
+ }>["value"];
4031
4169
  /** @internal */
4032
4170
  interface PreparedLaunch {
4033
4171
  /** @internal */
@@ -4064,6 +4202,8 @@ type PreparedLaunchResult = {
4064
4202
 
4065
4203
  /** @internal */
4066
4204
  interface FutureExecutionExecutorDeps extends Pick<RepositoryBundle, "futureExecutions" | "processes" | "projects" | "processRelations" | "processSkills" | "skills" | "handoffDedupKeys" | "transaction"> {
4205
+ /** @internal */
4206
+ skillDefaults?: LaunchSkillDefaults;
4067
4207
  /** @internal */
4068
4208
  turnRecords?: RepositoryBundle["turnRecords"];
4069
4209
  /** @internal */
@@ -4134,33 +4274,6 @@ interface FutureExecutionLifecycleOptions {
4134
4274
  now?: () => Date;
4135
4275
  }
4136
4276
  /** @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
4277
  type ActionMutationOutcome = {
4165
4278
  /** @internal */
4166
4279
  kind: "scheduled";
@@ -4199,7 +4312,7 @@ type ActionMutationOutcome = {
4199
4312
  error: string;
4200
4313
  /** @internal */
4201
4314
  code: string;
4202
- } | LifecycleFailure;
4315
+ } | LaunchFailure;
4203
4316
  /** @internal */
4204
4317
  type CancelFutureExecutionOutcome = {
4205
4318
  /** @internal */
@@ -4248,6 +4361,8 @@ declare function createFutureExecutionLifecycle(deps: FutureExecutionLifecycleDe
4248
4361
  prepareLaunch: (launcherId: string, request: NormalizedScheduledLaunchInput, opts?: {
4249
4362
  /** @internal */
4250
4363
  resolvedLauncher?: _leitwerk_dev_process_sdk.ResolvedProcessLauncher;
4364
+ /** @internal */
4365
+ futureExecutionId?: string;
4251
4366
  }) => Promise<PreparedLaunchResult>;
4252
4367
  /** @internal */
4253
4368
  commitPreparedLaunch: (prepared: PreparedLaunch, opts?: {
@@ -4746,6 +4861,8 @@ declare function createToolApprovalGate(input: {
4746
4861
  repos: ToolApprovalRepos;
4747
4862
  /** @internal */
4748
4863
  processOperations: ProcessOperationCoordinator;
4864
+ /** @internal */
4865
+ broadcaster: Pick<Broadcaster, "sendDurable">;
4749
4866
  }): {
4750
4867
  /** @internal */
4751
4868
  reconcile: (instanceId: string) => void;
@@ -4774,22 +4891,37 @@ declare function createToolApprovalGate(input: {
4774
4891
  /** @internal */
4775
4892
  type ToolApprovalGate = ReturnType<typeof createToolApprovalGate>;
4776
4893
 
4894
+ /** @internal */
4777
4895
  interface TokenAuditContext {
4896
+ /** @internal */
4778
4897
  operation: string;
4898
+ /** @internal */
4779
4899
  tokenId?: string;
4900
+ /** @internal */
4780
4901
  actor?: Actor;
4902
+ /** @internal */
4781
4903
  ownerKind?: "user" | "anonymous";
4904
+ /** @internal */
4782
4905
  count?: number;
4783
4906
  }
4784
4907
  declare module "fastify" {
4908
+ /** @internal */
4785
4909
  interface FastifyRequest {
4910
+ /** @internal */
4786
4911
  actor?: Actor;
4912
+ /** @internal */
4787
4913
  tokenAudit?: TokenAuditContext;
4788
4914
  }
4789
4915
  }
4790
4916
 
4791
4917
  /** @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"> {
4918
+ 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"> {
4919
+ /** @internal */
4920
+ scopedSettingsService?: ScopedSettingsService;
4921
+ /** @internal */
4922
+ topicWiki?: RepositoryBundle["topicWiki"];
4923
+ /** @internal */
4924
+ onSettingsChanged?: () => Promise<void>;
4793
4925
  /** @internal */
4794
4926
  mappedRuns?: RepositoryBundle["mappedRuns"];
4795
4927
  /** @internal */
@@ -4854,6 +4986,15 @@ interface RouteDeps extends Pick<RepositoryBundle, "processes" | "launchRuns" |
4854
4986
 
4855
4987
  /** @public */
4856
4988
  interface AppOptions {
4989
+ /** Clock and cadence seam for readiness integration tests. @internal */
4990
+ turnWait?: {
4991
+ /** @internal */
4992
+ now?: () => number;
4993
+ /** @internal */
4994
+ pollIntervalMs?: number;
4995
+ /** @internal */
4996
+ timeoutMs?: number;
4997
+ };
4857
4998
  /** @public */
4858
4999
  config?: LeitwerkConfig;
4859
5000
  /** @internal */