@leitwerk-dev/server 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (392) hide show
  1. package/dist/app-7PKX73TU.js +8 -0
  2. package/dist/{app-D4XHIbwA.d.ts → app-WfwKzrVk.d.ts} +2029 -410
  3. package/dist/app.d.ts +55 -12
  4. package/dist/app.d.ts.map +1 -1
  5. package/dist/{chunk-XTXH6623.js → chunk-CNITOV76.js} +1359 -991
  6. package/dist/chunk-CNITOV76.js.map +1 -0
  7. package/dist/{chunk-AGC2ND53.js → chunk-ZSKM25SD.js} +588 -667
  8. package/dist/chunk-ZSKM25SD.js.map +1 -0
  9. package/dist/config/config-loader.d.ts +11 -0
  10. package/dist/config/config-loader.d.ts.map +1 -1
  11. package/dist/config/config-types.d.ts +152 -51
  12. package/dist/config/config-types.d.ts.map +1 -1
  13. package/dist/db/api-token-repo.d.ts +24 -0
  14. package/dist/db/api-token-repo.d.ts.map +1 -1
  15. package/dist/db/auth-repo.d.ts +30 -0
  16. package/dist/db/auth-repo.d.ts.map +1 -1
  17. package/dist/db/credential-cipher.d.ts +8 -3
  18. package/dist/db/credential-cipher.d.ts.map +1 -1
  19. package/dist/db/database.d.ts +19 -1
  20. package/dist/db/database.d.ts.map +1 -1
  21. package/dist/db/external-write-log-repo.d.ts +6 -1
  22. package/dist/db/external-write-log-repo.d.ts.map +1 -1
  23. package/dist/db/future-execution-repo.d.ts +47 -0
  24. package/dist/db/future-execution-repo.d.ts.map +1 -1
  25. package/dist/db/launch-run-repo.d.ts +17 -0
  26. package/dist/db/launch-run-repo.d.ts.map +1 -1
  27. package/dist/db/launcher-recent-value-repo.d.ts +15 -0
  28. package/dist/db/launcher-recent-value-repo.d.ts.map +1 -1
  29. package/dist/db/pending-external-source-fire-repo.d.ts +33 -0
  30. package/dist/db/pending-external-source-fire-repo.d.ts.map +1 -1
  31. package/dist/db/process-event-repo.d.ts +17 -0
  32. package/dist/db/process-event-repo.d.ts.map +1 -1
  33. package/dist/db/process-handoff-dedup-key-repo.d.ts +8 -0
  34. package/dist/db/process-handoff-dedup-key-repo.d.ts.map +1 -1
  35. package/dist/db/process-input-repo.d.ts +15 -0
  36. package/dist/db/process-input-repo.d.ts.map +1 -1
  37. package/dist/db/process-instance-repo.d.ts +49 -0
  38. package/dist/db/process-instance-repo.d.ts.map +1 -1
  39. package/dist/db/process-leaf-outcome-snapshot-repo.d.ts +18 -0
  40. package/dist/db/process-leaf-outcome-snapshot-repo.d.ts.map +1 -1
  41. package/dist/db/process-project-repo.d.ts +20 -0
  42. package/dist/db/process-project-repo.d.ts.map +1 -1
  43. package/dist/db/process-question-request-repo.d.ts +19 -0
  44. package/dist/db/process-question-request-repo.d.ts.map +1 -1
  45. package/dist/db/process-relation-repo.d.ts +5 -0
  46. package/dist/db/process-relation-repo.d.ts.map +1 -1
  47. package/dist/db/process-skill-repo.d.ts +4 -0
  48. package/dist/db/process-skill-repo.d.ts.map +1 -1
  49. package/dist/db/process-title-job-repo.d.ts +22 -0
  50. package/dist/db/process-title-job-repo.d.ts.map +1 -1
  51. package/dist/db/process-tool-approval-request-repo.d.ts +20 -0
  52. package/dist/db/process-tool-approval-request-repo.d.ts.map +1 -1
  53. package/dist/db/process-turn-annotation-repo.d.ts +22 -2
  54. package/dist/db/process-turn-annotation-repo.d.ts.map +1 -1
  55. package/dist/db/process-turn-record-repo.d.ts +27 -0
  56. package/dist/db/process-turn-record-repo.d.ts.map +1 -1
  57. package/dist/db/provider-credential-repo.d.ts +16 -0
  58. package/dist/db/provider-credential-repo.d.ts.map +1 -1
  59. package/dist/db/repositories.d.ts +33 -0
  60. package/dist/db/repositories.d.ts.map +1 -1
  61. package/dist/db/session-transfer-repo.d.ts +49 -1
  62. package/dist/db/session-transfer-repo.d.ts.map +1 -1
  63. package/dist/db/skill-repo.d.ts +20 -0
  64. package/dist/db/skill-repo.d.ts.map +1 -1
  65. package/dist/db/startup-observation-repo.d.ts +3 -0
  66. package/dist/db/startup-observation-repo.d.ts.map +1 -1
  67. package/dist/db/ticket-destination-recent-repo.d.ts +14 -0
  68. package/dist/db/ticket-destination-recent-repo.d.ts.map +1 -1
  69. package/dist/db/turn-start-record-repo.d.ts +9 -0
  70. package/dist/db/turn-start-record-repo.d.ts.map +1 -1
  71. package/dist/db/turn-summary-repo.d.ts +18 -0
  72. package/dist/db/turn-summary-repo.d.ts.map +1 -1
  73. package/dist/db/worker-lease-repo.d.ts +31 -1
  74. package/dist/db/worker-lease-repo.d.ts.map +1 -1
  75. package/dist/effects/post-commit-effect.d.ts +29 -0
  76. package/dist/effects/post-commit-effect.d.ts.map +1 -1
  77. package/dist/effects/post-commit-runner.d.ts +1 -0
  78. package/dist/effects/post-commit-runner.d.ts.map +1 -1
  79. package/dist/entry-ref-patch.d.ts +3 -0
  80. package/dist/entry-ref-patch.d.ts.map +1 -1
  81. package/dist/extension-ui/catalog.d.ts +15 -0
  82. package/dist/extension-ui/catalog.d.ts.map +1 -1
  83. package/dist/extensions/extension-host.d.ts +6 -0
  84. package/dist/extensions/extension-host.d.ts.map +1 -1
  85. package/dist/external-source-service.d.ts +8 -0
  86. package/dist/external-source-service.d.ts.map +1 -1
  87. package/dist/future-execution/execution.d.ts +23 -1
  88. package/dist/future-execution/execution.d.ts.map +1 -1
  89. package/dist/future-execution/launch-lifecycle.d.ts +76 -0
  90. package/dist/future-execution/launch-lifecycle.d.ts.map +1 -1
  91. package/dist/future-execution/lifecycle.d.ts +99 -0
  92. package/dist/future-execution/lifecycle.d.ts.map +1 -1
  93. package/dist/future-execution/model-projection.d.ts +6 -0
  94. package/dist/future-execution/model-projection.d.ts.map +1 -1
  95. package/dist/future-execution/transition-planner.d.ts +25 -0
  96. package/dist/future-execution/transition-planner.d.ts.map +1 -1
  97. package/dist/future-execution-scheduler.d.ts +1 -1
  98. package/dist/future-execution-scheduler.d.ts.map +1 -1
  99. package/dist/index.d.ts +3 -30
  100. package/dist/index.d.ts.map +1 -1
  101. package/dist/index.js +5 -239
  102. package/dist/index.js.map +1 -1
  103. package/dist/instance-tree.d.ts +3 -0
  104. package/dist/instance-tree.d.ts.map +1 -1
  105. package/dist/integration-tool-registry.d.ts +4 -1
  106. package/dist/integration-tool-registry.d.ts.map +1 -1
  107. package/dist/launch-coordinator.d.ts +33 -0
  108. package/dist/launch-coordinator.d.ts.map +1 -1
  109. package/dist/launch-pipeline.d.ts +60 -0
  110. package/dist/launch-pipeline.d.ts.map +1 -1
  111. package/dist/launcher-recent-values-service.d.ts +3 -0
  112. package/dist/launcher-recent-values-service.d.ts.map +1 -1
  113. package/dist/main.js +7 -14
  114. package/dist/main.js.map +1 -1
  115. package/dist/model-providers/builtin-server-adapter.d.ts +1 -0
  116. package/dist/model-providers/builtin-server-adapter.d.ts.map +1 -1
  117. package/dist/model-providers/credentials.d.ts +17 -0
  118. package/dist/model-providers/credentials.d.ts.map +1 -1
  119. package/dist/model-providers/model-status-cache.d.ts +30 -1
  120. package/dist/model-providers/model-status-cache.d.ts.map +1 -1
  121. package/dist/model-providers/provider-options.d.ts +21 -1
  122. package/dist/model-providers/provider-options.d.ts.map +1 -1
  123. package/dist/model-providers/registry.d.ts +22 -2
  124. package/dist/model-providers/registry.d.ts.map +1 -1
  125. package/dist/model-providers/server-adapters.d.ts +19 -0
  126. package/dist/model-providers/server-adapters.d.ts.map +1 -1
  127. package/dist/pi-resources/assemble.d.ts +24 -4
  128. package/dist/pi-resources/assemble.d.ts.map +1 -1
  129. package/dist/pi-resources/bundle-cache.d.ts +20 -1
  130. package/dist/pi-resources/bundle-cache.d.ts.map +1 -1
  131. package/dist/pi-resources/bundle-pin-lifecycle.d.ts +5 -1
  132. package/dist/pi-resources/bundle-pin-lifecycle.d.ts.map +1 -1
  133. package/dist/pi-resources/resource-collector.d.ts +11 -0
  134. package/dist/pi-resources/resource-collector.d.ts.map +1 -1
  135. package/dist/pi-session-tree.d.ts +13 -1
  136. package/dist/pi-session-tree.d.ts.map +1 -1
  137. package/dist/process-action-registry.d.ts +47 -0
  138. package/dist/process-action-registry.d.ts.map +1 -1
  139. package/dist/process-deletion-service.d.ts +12 -0
  140. package/dist/process-deletion-service.d.ts.map +1 -1
  141. package/dist/process-engine/decision.d.ts +12 -0
  142. package/dist/process-engine/decision.d.ts.map +1 -1
  143. package/dist/process-engine/engine.d.ts +1 -0
  144. package/dist/process-engine/engine.d.ts.map +1 -1
  145. package/dist/process-engine/operation.d.ts +23 -2
  146. package/dist/process-engine/operation.d.ts.map +1 -1
  147. package/dist/process-engine/startup-reconciliation.d.ts +14 -0
  148. package/dist/process-engine/startup-reconciliation.d.ts.map +1 -1
  149. package/dist/process-engine/types.d.ts +112 -1
  150. package/dist/process-engine/types.d.ts.map +1 -1
  151. package/dist/process-engine/writes/build-process-park-writes.d.ts +3 -0
  152. package/dist/process-engine/writes/build-process-park-writes.d.ts.map +1 -1
  153. package/dist/process-engine/writes/build-recovery-start-writes.d.ts +4 -0
  154. package/dist/process-engine/writes/build-recovery-start-writes.d.ts.map +1 -1
  155. package/dist/process-engine/writes/build-retry-writes.d.ts +3 -0
  156. package/dist/process-engine/writes/build-retry-writes.d.ts.map +1 -1
  157. package/dist/process-engine/writes/build-turn-failed-writes.d.ts +6 -0
  158. package/dist/process-engine/writes/build-turn-failed-writes.d.ts.map +1 -1
  159. package/dist/process-engine/writes/build-turn-outcome-writes.d.ts +8 -0
  160. package/dist/process-engine/writes/build-turn-outcome-writes.d.ts.map +1 -1
  161. package/dist/process-engine/writes/build-turn-selection-writes.d.ts +8 -0
  162. package/dist/process-engine/writes/build-turn-selection-writes.d.ts.map +1 -1
  163. package/dist/process-engine/writes/commit-writes.d.ts +14 -0
  164. package/dist/process-engine/writes/commit-writes.d.ts.map +1 -1
  165. package/dist/process-engine/writes/deferred-extension-events.d.ts +4 -0
  166. package/dist/process-engine/writes/deferred-extension-events.d.ts.map +1 -1
  167. package/dist/process-engine/writes/writes.d.ts +67 -0
  168. package/dist/process-engine/writes/writes.d.ts.map +1 -1
  169. package/dist/process-graph.d.ts +1 -1
  170. package/dist/process-graph.d.ts.map +1 -1
  171. package/dist/process-input-dispatch.d.ts +1 -0
  172. package/dist/process-input-dispatch.d.ts.map +1 -1
  173. package/dist/process-launch-executor.d.ts +1 -0
  174. package/dist/process-launch-executor.d.ts.map +1 -1
  175. package/dist/process-model-policy/types.d.ts +157 -1
  176. package/dist/process-model-policy/types.d.ts.map +1 -1
  177. package/dist/process-operation-coordinator.d.ts +3 -0
  178. package/dist/process-operation-coordinator.d.ts.map +1 -1
  179. package/dist/process-question-service.d.ts +36 -20
  180. package/dist/process-question-service.d.ts.map +1 -1
  181. package/dist/process-runtime-availability.d.ts +2 -1
  182. package/dist/process-runtime-availability.d.ts.map +1 -1
  183. package/dist/process-session-store.d.ts +15 -4
  184. package/dist/process-session-store.d.ts.map +1 -1
  185. package/dist/process-title-generator.d.ts +53 -0
  186. package/dist/process-title-generator.d.ts.map +1 -1
  187. package/dist/process-turn-navigation.d.ts +1 -30
  188. package/dist/process-turn-navigation.d.ts.map +1 -1
  189. package/dist/process-turn-trace.d.ts +7 -0
  190. package/dist/process-turn-trace.d.ts.map +1 -1
  191. package/dist/process-ui-registry.d.ts +2 -0
  192. package/dist/process-ui-registry.d.ts.map +1 -1
  193. package/dist/process-ui-snapshot-presenter.d.ts +68 -1
  194. package/dist/process-ui-snapshot-presenter.d.ts.map +1 -1
  195. package/dist/process-watcher-registry.d.ts +5 -0
  196. package/dist/process-watcher-registry.d.ts.map +1 -1
  197. package/dist/product-ref-state.d.ts +1 -0
  198. package/dist/product-ref-state.d.ts.map +1 -1
  199. package/dist/project-mutation-service.d.ts +19 -0
  200. package/dist/project-mutation-service.d.ts.map +1 -1
  201. package/dist/result-image-store.d.ts +20 -0
  202. package/dist/result-image-store.d.ts.map +1 -1
  203. package/dist/routes/process-route-helpers.d.ts +30 -0
  204. package/dist/routes/process-route-helpers.d.ts.map +1 -1
  205. package/dist/routes/ui-renderers.d.ts +4 -0
  206. package/dist/routes/ui-renderers.d.ts.map +1 -1
  207. package/dist/routes/watchers.d.ts +3 -0
  208. package/dist/routes/watchers.d.ts.map +1 -1
  209. package/dist/semantic-entry-ref-state.d.ts +1 -0
  210. package/dist/semantic-entry-ref-state.d.ts.map +1 -1
  211. package/dist/server-bootstrap/app-lifecycle.d.ts +24 -0
  212. package/dist/server-bootstrap/app-lifecycle.d.ts.map +1 -0
  213. package/dist/server-bootstrap/build-host-capabilities.d.ts +5 -1
  214. package/dist/server-bootstrap/build-host-capabilities.d.ts.map +1 -1
  215. package/dist/server-topology.d.ts +8 -1
  216. package/dist/server-topology.d.ts.map +1 -1
  217. package/dist/session-transfer-helper-relays.d.ts +24 -0
  218. package/dist/session-transfer-helper-relays.d.ts.map +1 -1
  219. package/dist/session-transfer-service.d.ts +63 -1
  220. package/dist/session-transfer-service.d.ts.map +1 -1
  221. package/dist/skills/catalog-service.d.ts +7 -0
  222. package/dist/skills/catalog-service.d.ts.map +1 -1
  223. package/dist/skills/source-importer.d.ts +8 -0
  224. package/dist/skills/source-importer.d.ts.map +1 -1
  225. package/dist/startup-evidence.d.ts.map +1 -1
  226. package/dist/supervisor/ipc-handler.d.ts +28 -0
  227. package/dist/supervisor/ipc-handler.d.ts.map +1 -1
  228. package/dist/supervisor/worker-event-ingestor.d.ts +10 -0
  229. package/dist/supervisor/worker-event-ingestor.d.ts.map +1 -1
  230. package/dist/supervisor/worker-start-payload-builder.d.ts +13 -0
  231. package/dist/supervisor/worker-start-payload-builder.d.ts.map +1 -1
  232. package/dist/supervisor/worker-storage-layout.d.ts +12 -0
  233. package/dist/supervisor/worker-storage-layout.d.ts.map +1 -1
  234. package/dist/supervisor/worker-supervisor.d.ts +47 -3
  235. package/dist/supervisor/worker-supervisor.d.ts.map +1 -1
  236. package/dist/supervisor/worker-turn-ipc-recorder.d.ts +19 -0
  237. package/dist/supervisor/worker-turn-ipc-recorder.d.ts.map +1 -1
  238. package/dist/supervisor/worker-unit-reclaimer.d.ts +3 -0
  239. package/dist/supervisor/worker-unit-reclaimer.d.ts.map +1 -1
  240. package/dist/supervisor/worker-websocket-ipc.d.ts +37 -0
  241. package/dist/supervisor/worker-websocket-ipc.d.ts.map +1 -1
  242. package/dist/test-helpers/accepted-turn-start.d.ts +17 -0
  243. package/dist/test-helpers/accepted-turn-start.d.ts.map +1 -1
  244. package/dist/test-helpers/session-snapshot-fixtures.d.ts +1 -1
  245. package/dist/test-helpers/session-snapshot-fixtures.d.ts.map +1 -1
  246. package/dist/test-helpers/turn-start-preflight-fixtures.d.ts +8 -1
  247. package/dist/test-helpers/turn-start-preflight-fixtures.d.ts.map +1 -1
  248. package/dist/test-helpers/unit-deps.d.ts +8 -0
  249. package/dist/test-helpers/unit-deps.d.ts.map +1 -1
  250. package/dist/testing.d.ts +4 -7
  251. package/dist/testing.d.ts.map +1 -1
  252. package/dist/testing.js +2 -53
  253. package/dist/testing.js.map +1 -1
  254. package/dist/tool-approval-gate.d.ts +21 -0
  255. package/dist/tool-approval-gate.d.ts.map +1 -1
  256. package/dist/turn-result-markdown.d.ts +2 -0
  257. package/dist/turn-result-markdown.d.ts.map +1 -1
  258. package/dist/worker-runtime-profile-selection.d.ts +20 -4
  259. package/dist/worker-runtime-profile-selection.d.ts.map +1 -1
  260. package/dist/ws/broadcast.d.ts +10 -0
  261. package/dist/ws/broadcast.d.ts.map +1 -1
  262. package/package.json +11 -11
  263. package/src/app.ts +916 -892
  264. package/src/config/config-loader.ts +12 -0
  265. package/src/config/config-types.ts +166 -66
  266. package/src/db/api-token-repo.ts +35 -2
  267. package/src/db/auth-repo.ts +35 -1
  268. package/src/db/credential-cipher.ts +8 -3
  269. package/src/db/database.ts +14 -0
  270. package/src/db/external-write-log-repo.ts +6 -1
  271. package/src/db/future-execution-repo.ts +51 -1
  272. package/src/db/launch-run-repo.ts +17 -0
  273. package/src/db/launcher-recent-value-repo.ts +15 -0
  274. package/src/db/pending-external-source-fire-repo.ts +33 -0
  275. package/src/db/process-event-repo.ts +21 -1
  276. package/src/db/process-handoff-dedup-key-repo.ts +8 -0
  277. package/src/db/process-input-repo.ts +15 -0
  278. package/src/db/process-instance-repo.ts +57 -2
  279. package/src/db/process-leaf-outcome-snapshot-repo.ts +18 -0
  280. package/src/db/process-project-repo.ts +20 -0
  281. package/src/db/process-question-request-repo.ts +19 -0
  282. package/src/db/process-relation-repo.ts +8 -1
  283. package/src/db/process-skill-repo.ts +4 -0
  284. package/src/db/process-title-job-repo.ts +30 -2
  285. package/src/db/process-tool-approval-request-repo.ts +24 -1
  286. package/src/db/process-turn-annotation-repo.ts +22 -2
  287. package/src/db/process-turn-record-repo.ts +27 -0
  288. package/src/db/provider-credential-repo.ts +20 -1
  289. package/src/db/repositories.ts +36 -1
  290. package/src/db/session-transfer-repo.ts +71 -9
  291. package/src/db/skill-repo.ts +24 -1
  292. package/src/db/startup-observation-repo.ts +3 -0
  293. package/src/db/ticket-destination-recent-repo.ts +14 -0
  294. package/src/db/turn-start-record-repo.ts +12 -1
  295. package/src/db/turn-summary-repo.ts +29 -2
  296. package/src/db/worker-lease-repo.ts +31 -1
  297. package/src/deployment-preflight.ts +1 -1
  298. package/src/effects/post-commit-effect.ts +42 -3
  299. package/src/effects/post-commit-runner.ts +1 -0
  300. package/src/entry-ref-patch.ts +9 -1
  301. package/src/extension-ui/catalog.ts +15 -0
  302. package/src/extensions/extension-host.ts +6 -0
  303. package/src/external-source-service.ts +12 -1
  304. package/src/future-execution/execution.ts +45 -8
  305. package/src/future-execution/launch-lifecycle.ts +145 -17
  306. package/src/future-execution/lifecycle.ts +124 -13
  307. package/src/future-execution/model-projection.ts +6 -0
  308. package/src/future-execution/transition-planner.ts +25 -0
  309. package/src/future-execution-scheduler.ts +7 -6
  310. package/src/index.ts +5 -153
  311. package/src/instance-tree.ts +3 -0
  312. package/src/integration-tool-registry.ts +17 -8
  313. package/src/launch-coordinator.ts +55 -5
  314. package/src/launch-pipeline.ts +103 -12
  315. package/src/launcher-recent-values-service.ts +3 -0
  316. package/src/main.ts +3 -10
  317. package/src/model-providers/builtin-server-adapter.ts +1 -0
  318. package/src/model-providers/credentials.ts +17 -0
  319. package/src/model-providers/model-status-cache.ts +30 -1
  320. package/src/model-providers/provider-options.ts +25 -2
  321. package/src/model-providers/registry.ts +22 -2
  322. package/src/model-providers/server-adapters.ts +19 -0
  323. package/src/pi-resources/assemble.ts +24 -4
  324. package/src/pi-resources/bundle-cache.ts +20 -1
  325. package/src/pi-resources/bundle-pin-lifecycle.ts +8 -2
  326. package/src/pi-resources/resource-collector.ts +11 -0
  327. package/src/pi-session-tree.ts +13 -1
  328. package/src/process-action-registry.ts +53 -1
  329. package/src/process-deletion-service.ts +29 -4
  330. package/src/process-engine/decision.ts +12 -0
  331. package/src/process-engine/engine.ts +1 -0
  332. package/src/process-engine/operation.ts +23 -2
  333. package/src/process-engine/startup-reconciliation.ts +14 -0
  334. package/src/process-engine/types.ts +176 -14
  335. package/src/process-engine/writes/build-process-park-writes.ts +3 -0
  336. package/src/process-engine/writes/build-recovery-start-writes.ts +4 -0
  337. package/src/process-engine/writes/build-retry-writes.ts +3 -0
  338. package/src/process-engine/writes/build-turn-failed-writes.ts +6 -0
  339. package/src/process-engine/writes/build-turn-outcome-writes.ts +8 -0
  340. package/src/process-engine/writes/build-turn-selection-writes.ts +8 -0
  341. package/src/process-engine/writes/commit-writes.ts +14 -0
  342. package/src/process-engine/writes/deferred-extension-events.ts +4 -0
  343. package/src/process-engine/writes/writes.ts +104 -10
  344. package/src/process-graph.ts +0 -3
  345. package/src/process-input-dispatch.ts +1 -0
  346. package/src/process-launch-executor.ts +1 -0
  347. package/src/process-model-policy/types.ts +195 -11
  348. package/src/process-operation-coordinator.ts +3 -0
  349. package/src/process-question-service.ts +53 -11
  350. package/src/process-runtime-availability.ts +4 -3
  351. package/src/process-session-store.ts +15 -4
  352. package/src/process-title-generator.ts +71 -5
  353. package/src/process-turn-navigation.ts +4 -1
  354. package/src/process-turn-trace.ts +7 -0
  355. package/src/process-ui-registry.ts +2 -0
  356. package/src/process-ui-snapshot-presenter.ts +75 -3
  357. package/src/process-watcher-registry.ts +5 -0
  358. package/src/product-ref-state.ts +1 -0
  359. package/src/project-mutation-service.ts +22 -1
  360. package/src/result-image-store.ts +27 -2
  361. package/src/routes/process-route-helpers.ts +30 -0
  362. package/src/routes/ui-renderers.ts +4 -0
  363. package/src/routes/watchers.ts +3 -0
  364. package/src/semantic-entry-ref-state.ts +1 -0
  365. package/src/server-bootstrap/app-lifecycle.ts +150 -0
  366. package/src/server-topology.ts +8 -1
  367. package/src/session-transfer-helper-relays.ts +33 -2
  368. package/src/session-transfer-service.ts +75 -7
  369. package/src/skills/catalog-service.ts +7 -0
  370. package/src/skills/source-importer.ts +8 -0
  371. package/src/startup-evidence.ts +23 -41
  372. package/src/supervisor/ipc-handler.ts +33 -1
  373. package/src/supervisor/worker-event-ingestor.ts +10 -0
  374. package/src/supervisor/worker-start-payload-builder.ts +16 -1
  375. package/src/supervisor/worker-storage-layout.ts +12 -0
  376. package/src/supervisor/worker-supervisor.ts +119 -133
  377. package/src/supervisor/worker-turn-ipc-recorder.ts +19 -0
  378. package/src/supervisor/worker-unit-reclaimer.ts +3 -0
  379. package/src/supervisor/worker-websocket-ipc.ts +57 -3
  380. package/src/test-helpers/accepted-turn-start.ts +28 -2
  381. package/src/test-helpers/session-snapshot-fixtures.ts +1 -1
  382. package/src/test-helpers/turn-start-preflight-fixtures.ts +8 -1
  383. package/src/test-helpers/unit-deps.ts +13 -1
  384. package/src/testing.ts +4 -23
  385. package/src/tool-approval-gate.ts +32 -3
  386. package/src/turn-result-markdown.ts +2 -0
  387. package/src/worker-runtime-profile-selection.ts +24 -5
  388. package/src/ws/broadcast.ts +20 -1
  389. package/dist/app-I4QQUL5B.js +0 -10
  390. package/dist/chunk-AGC2ND53.js.map +0 -1
  391. package/dist/chunk-XTXH6623.js.map +0 -1
  392. /package/dist/{app-I4QQUL5B.js.map → app-7PKX73TU.js.map} +0 -0
@@ -5,39 +5,64 @@ import type {
5
5
  } from "@leitwerk-dev/domain";
6
6
  import type { RepositoryBundle } from "../db/repositories.js";
7
7
 
8
+ /** @internal */
8
9
  export type FutureExecutionTransitionPlan =
9
10
  | {
11
+ /** @internal */
10
12
  kind: "consume";
13
+ /** @internal */
11
14
  futureExecutionId: string;
15
+ /** @internal */
12
16
  expectedKind: FutureExecution["kind"];
17
+ /** @internal */
13
18
  expectedNextRunAt: string;
14
19
  }
15
20
  | {
21
+ /** @internal */
16
22
  kind: "advance";
23
+ /** @internal */
17
24
  futureExecutionId: string;
25
+ /** @internal */
18
26
  expectedKind: FutureExecution["kind"];
27
+ /** @internal */
19
28
  expectedNextRunAt: string;
29
+ /** @internal */
20
30
  nextRunAt: string;
21
31
  }
22
32
  | {
33
+ /** @internal */
23
34
  kind: "block";
35
+ /** @internal */
24
36
  futureExecutionId: string;
37
+ /** @internal */
25
38
  expectedKind: FutureExecution["kind"];
39
+ /** @internal */
26
40
  expectedNextRunAt: string;
41
+ /** @internal */
27
42
  blockedReason: FutureExecutionBlockReason;
43
+ /** @internal */
28
44
  modelSelection: DurableModelSelection | null;
45
+ /** @internal */
29
46
  nextRunAt?: string;
30
47
  }
31
48
  | {
49
+ /** @internal */
32
50
  kind: "retry";
51
+ /** @internal */
33
52
  futureExecutionId: string;
53
+ /** @internal */
34
54
  expectedKind: FutureExecution["kind"];
55
+ /** @internal */
35
56
  expectedNextRunAt: string;
57
+ /** @internal */
36
58
  nextRunAt: string;
37
59
  }
38
60
  | {
61
+ /** @internal */
39
62
  kind: "cancel_action";
63
+ /** @internal */
40
64
  futureExecutionId: string;
65
+ /** @internal */
41
66
  expectedInstanceId: string;
42
67
  };
43
68
 
@@ -12,17 +12,17 @@ export function startFutureExecutionScheduler(
12
12
  const pollIntervalMs = options.pollIntervalMs ?? 1_000;
13
13
  const nowFn = options.now ?? (() => new Date());
14
14
  let timer: ReturnType<typeof setInterval> | null = null;
15
- let tickInProgress = false;
15
+ let tickInProgress: Promise<void> | undefined;
16
16
 
17
17
  async function tick(): Promise<void> {
18
18
  if (tickInProgress) {
19
- return;
19
+ return tickInProgress;
20
20
  }
21
- tickInProgress = true;
21
+ tickInProgress = lifecycle.runDueWork(nowFn().toISOString()).then(() => {});
22
22
  try {
23
- await lifecycle.runDueWork(nowFn().toISOString());
23
+ await tickInProgress;
24
24
  } finally {
25
- tickInProgress = false;
25
+ tickInProgress = undefined;
26
26
  }
27
27
  }
28
28
 
@@ -37,11 +37,12 @@ export function startFutureExecutionScheduler(
37
37
  void tick();
38
38
  }, pollIntervalMs);
39
39
  },
40
- stop(): void {
40
+ async stop(): Promise<void> {
41
41
  if (timer) {
42
42
  clearInterval(timer);
43
43
  timer = null;
44
44
  }
45
+ await tickInProgress;
45
46
  },
46
47
  };
47
48
  }
package/src/index.ts CHANGED
@@ -1,159 +1,11 @@
1
1
  export {
2
- buildKubernetesProcessNamespaceManifest,
3
- buildKubernetesProcessPvcManifest,
4
- buildKubernetesWorkerPodManifest,
5
- buildProcessResourceLabels,
6
- buildWorkerUnitLabels,
7
- createDockerWorkerRunner,
8
- createKubernetesWorkerRunner,
9
- createLocalWorkerRunner,
10
- type DockerEngineClient,
11
- type DockerProcessVolumeOptions,
12
- type DockerWorkerRunnerOptions,
13
- FakeKubernetesApiClient,
14
- type IsolatedStartWorkerInput,
15
- isManagedWorkerUnitLabels,
16
- type KubernetesApiClient,
17
- type KubernetesNamespaceSummary,
18
- type KubernetesPersistentVolumeClaimManifest,
19
- type KubernetesPodManifest,
20
- type KubernetesPodSpecOptions,
21
- type KubernetesPodSummary,
22
- type KubernetesProcessNamespaceManifest,
23
- type KubernetesProcessVolumeSpec,
24
- type KubernetesWorkerRunnerOptions,
25
- kubernetesProcessNamespaceName,
26
- kubernetesProcessPvcName,
27
- kubernetesWorkerPodName,
28
- type LocalStartWorkerInput,
29
- type LocalWorkerRunnerOptions,
30
- managedProcessNamespaceLabelSelector,
31
- managedWorkerLabelSelector,
32
- mapKubernetesPodExit,
33
- PROCESS_NAMESPACE_COMPONENT_VALUE,
34
- PROCESS_SERVER_CA_COMPONENT_VALUE,
35
- PROCESS_VOLUME_COMPONENT_VALUE,
36
- type ProcessVolume,
37
- parseWorkerUnitIdentity,
38
- type ResolvedWorkerImage,
39
- type StartWorkerInput,
40
- type StopWorkerOptions,
41
- sanitizeKubernetesNameSegment,
42
- type VolumeRef,
43
- WORKER_LABEL_COMPONENT,
44
- WORKER_LABEL_INSTANCE_ID,
45
- WORKER_LABEL_MANAGED_BY,
46
- WORKER_LABEL_SERVER_EPOCH,
47
- WORKER_LABEL_WORKER_ID,
48
- type WorkerExitInfo,
49
- type WorkerResourceLimits,
50
- type WorkerRunner,
51
- type WorkerUnit,
52
- type WorkerUnitDescriptor,
53
- type WorkerUnitIdentity,
54
- type WorkerUnitRef,
55
- } from "@leitwerk-dev/worker-runners";
56
- export { type AppContext, type AppOptions, createApp, createAppContext } from "./app.js";
2
+ type AppContext,
3
+ type AppOptions,
4
+ createAppContext,
5
+ } from "./app.js";
57
6
  export {
58
- applyConfigDefaults,
59
7
  getDefaultConfig,
60
8
  type LeitwerkConfig,
61
9
  loadConfig,
62
- sanitizeConfigForLogging,
63
10
  } from "./config/index.js";
64
- export {
65
- closeDatabase,
66
- createDatabase,
67
- createInMemoryDatabase,
68
- DatabaseSchemaMismatchError,
69
- type InitializeSchemaOptions,
70
- initializeSchema,
71
- type LeitwerkDb,
72
- } from "./db/database.js";
73
- export * from "./db/repositories.js";
74
- export {
75
- buildExtensionUiCatalog,
76
- type ExtensionUiAssetRoot,
77
- type ExtensionUiCatalog,
78
- type ExtensionUiRendererDescriptor,
79
- type ExtensionUiRendererLookup,
80
- inferExtensionUiAssetContentType,
81
- resolveExtensionUiAssetPath,
82
- } from "./extension-ui/catalog.js";
83
- export { createExtensionHost, type ExtensionHost } from "./extensions/extension-host.js";
84
- export * from "./model-providers/index.js";
85
- export * from "./pi-resources/index.js";
86
- export {
87
- type ActionExecutionResult,
88
- createProcessEngine,
89
- type EngineResult,
90
- type ProcessEngine,
91
- type ProcessEngineDeps,
92
- } from "./process-engine/index.js";
93
- export {
94
- reconcileProcessesOnStartup,
95
- type StartupReconciliationDeps,
96
- shouldResumeProcessOnStartup,
97
- } from "./process-engine/startup-reconciliation.js";
98
- export { buildParkProcessWrites } from "./process-engine/writes/build-process-park-writes.js";
99
- export { buildRetryWrites } from "./process-engine/writes/build-retry-writes.js";
100
- export { buildTurnFailedWrites } from "./process-engine/writes/build-turn-failed-writes.js";
101
- export { buildTurnOutcomeWrites } from "./process-engine/writes/build-turn-outcome-writes.js";
102
- export { buildTurnSelectionWrites } from "./process-engine/writes/build-turn-selection-writes.js";
103
- export {
104
- type DeferredProcessExtensionEvent,
105
- emitDeferredExtensionEvent,
106
- } from "./process-engine/writes/deferred-extension-events.js";
107
- export {
108
- buildProcessTitlePrompt,
109
- buildProcessTitleSourceFields,
110
- createProcessTitleGenerator,
111
- normalizeProcessTitle,
112
- type ProcessTitleGenerator,
113
- type ProcessTitleLogger,
114
- } from "./process-title-generator.js";
115
- export { buildProcessWatcherRegistry } from "./process-watcher-registry.js";
116
- export {
117
- buildProjectUpdatedEffect,
118
- buildProjectUpdatedFrame,
119
- commitProjectCreate,
120
- commitProjectUpdate,
121
- createProjectMutationService,
122
- type ProjectMutationService,
123
- } from "./project-mutation-service.js";
124
- export { ResultImageStore } from "./result-image-store.js";
125
- export type { RouteDeps } from "./routes/processes.js";
126
- export { registerUiRendererRoutes, type UiRouteDeps } from "./routes/ui-renderers.js";
127
- export { registerWatcherRoutes, type WatcherRouteDeps } from "./routes/watchers.js";
128
- export {
129
- type FileReader,
130
- resolveServerTlsOptions,
131
- type ServerTlsOptions,
132
- } from "./server-topology.js";
133
- export {
134
- createIpcHandler,
135
- type IpcHandler,
136
- type IpcHandlerCallbacks,
137
- type IpcHandlerDeps,
138
- } from "./supervisor/ipc-handler.js";
139
- export {
140
- createLocalWorkerStorageLayout,
141
- createProcessVolumeWorkerStorageLayout,
142
- createWorkerStorageLayout,
143
- type WorkerStorageLayout,
144
- type WorkerTreePaths,
145
- } from "./supervisor/worker-storage-layout.js";
146
- export {
147
- createWorkerSupervisor,
148
- type SupervisorDeps,
149
- type WorkerHandle,
150
- type WorkerSupervisor,
151
- } from "./supervisor/worker-supervisor.js";
152
- export {
153
- buildRuntimeProfileSelectionInput,
154
- type ComponentRuntimeProfileSelection,
155
- type RuntimeProfileSelectionInput,
156
- type RuntimeProfileSelectionResult,
157
- selectWorkerRuntimeProfile,
158
- } from "./worker-runtime-profile-selection.js";
159
- export { type Broadcaster, createBroadcaster, type WsFrame } from "./ws/broadcast.js";
11
+ export type { WsFrame } from "./ws/broadcast.js";
@@ -1,8 +1,11 @@
1
1
  import type { PrimaryPathEntrySnapshot } from "@leitwerk-dev/protocol";
2
2
  import { parsePiSessionTreeContent, type ReadonlyPiSessionTree } from "./pi-session-tree.js";
3
3
 
4
+ /** @internal */
4
5
  export interface ParsedInstanceTree {
6
+ /** @internal */
5
7
  entriesById: Map<string, PrimaryPathEntrySnapshot>;
8
+ /** @internal */
6
9
  labelsByEntryId: Map<string, string>;
7
10
  }
8
11
 
@@ -1,7 +1,12 @@
1
1
  import type { Actor } from "@leitwerk-dev/domain";
2
+ import {
3
+ bindExternalWrites,
4
+ type ExternalWriteLogRepoLike,
5
+ } from "@leitwerk-dev/external-writes/internal";
2
6
  import {
3
7
  type IntegrationToolDefinition,
4
8
  type IntegrationToolExecutionContext,
9
+ objectArg,
5
10
  parseJsonData,
6
11
  RESERVED_INTEGRATION_TOOL_NAMES,
7
12
  type TicketCreationCapability,
@@ -27,7 +32,10 @@ import type { ToolApprovalGate } from "./tool-approval-gate.js";
27
32
 
28
33
  type RegisteredIntegrationTool = IntegrationToolDefinition<unknown>;
29
34
  type TicketCreationTool = RegisteredIntegrationTool & { capability: TicketCreationCapability };
30
- type IntegrationToolExecutionInput = Omit<IntegrationToolExecutionContext, "signal">;
35
+ type IntegrationToolExecutionInput = Omit<
36
+ IntegrationToolExecutionContext,
37
+ "signal" | "externalWrites"
38
+ >;
31
39
 
32
40
  interface PendingIntegrationToolExecution {
33
41
  readonly controller: AbortController;
@@ -196,12 +204,8 @@ function resolveJsonPointer(value: unknown, pointer: string): unknown {
196
204
  }, value);
197
205
  }
198
206
 
199
- function parseToolArgs(value: unknown): Record<string, unknown> {
200
- if (!value || typeof value !== "object" || Array.isArray(value)) {
201
- throw new Error("Integration tool arguments must be an object");
202
- }
203
- return value as Record<string, unknown>;
204
- }
207
+ const parseToolArgs = (value: unknown) =>
208
+ objectArg(value, "Integration tool arguments must be an object");
205
209
 
206
210
  function persistedTicketActor(value: unknown): Actor {
207
211
  return parseSchema(persistedActorSchema, value, "Ticket creation actor is invalid");
@@ -259,6 +263,7 @@ function withTicketDestinationParameter(
259
263
  }
260
264
 
261
265
  export class IntegrationToolRegistry {
266
+ constructor(private readonly writes: ExternalWriteLogRepoLike) {}
262
267
  private readonly tools = new Map<string, RegisteredIntegrationTool>();
263
268
  private readonly executions = new Map<string, PendingIntegrationToolExecution>();
264
269
 
@@ -373,7 +378,11 @@ export class IntegrationToolRegistry {
373
378
  throw new Error("Integration tool execution cancelled");
374
379
  }
375
380
  return definition.execute(
376
- { ...ctx, signal: controller.signal },
381
+ {
382
+ ...ctx,
383
+ signal: controller.signal,
384
+ externalWrites: bindExternalWrites(this.writes, ctx.process.id),
385
+ },
377
386
  definition.parse?.(args) ?? parseToolArgs(args),
378
387
  );
379
388
  })
@@ -86,41 +86,91 @@ function mergeProcessMetadata(
86
86
  return merge(base ?? {}, patch);
87
87
  }
88
88
 
89
+ /** @internal */
89
90
  export interface StartLaunchRequest {
91
+ /** @internal */
90
92
  launcherId: string;
93
+ /** @internal */
91
94
  idempotencyKey?: string | null;
95
+ /** @internal */
92
96
  request: NormalizedScheduledLaunchInput;
97
+ /** @internal */
93
98
  actor: Actor;
99
+ /** @internal */
94
100
  processMetadata?: Record<string, unknown>;
95
101
  }
96
102
 
103
+ /** @internal */
97
104
  export interface PreparedPlanLaunchRequest {
105
+ /** @internal */
98
106
  launchPlan: ProcessLaunchPlan;
107
+ /** @internal */
99
108
  idempotencyKey: string;
109
+ /** @internal */
100
110
  actor: Actor;
111
+ /** @internal */
101
112
  origin: LaunchRun["origin"];
113
+ /** @internal */
102
114
  relation?: ProcessLaunchRelationInput;
103
115
  }
104
116
 
117
+ /** @internal */
105
118
  export interface LaunchCoordinator {
106
- start(request: StartLaunchRequest): Promise<{ launchRunId: string }>;
119
+ /** @internal */
120
+ start(request: StartLaunchRequest): Promise<{
121
+ /** @internal */
122
+ launchRunId: string;
123
+ }>;
124
+ /** @internal */
107
125
  startPreparedPlan(request: PreparedPlanLaunchRequest): Promise<{
126
+ /** @internal */
108
127
  launchRunId: string;
128
+ /** @internal */
109
129
  process: ProcessInstance | null;
130
+ /** @internal */
110
131
  error: string | null;
111
132
  }>;
133
+ /** @internal */
112
134
  startProgrammatic(
113
135
  request: ProgrammaticLaunchRequestLike,
114
- opts: { idempotencyKey: string; actor: Actor },
136
+ opts: {
137
+ /** @internal */
138
+ idempotencyKey: string;
139
+ /** @internal */
140
+ actor: Actor;
141
+ },
115
142
  ): Promise<ProgrammaticLaunchResultLike>;
143
+ /** @internal */
116
144
  startWatcher<TConfig, TEvent>(
117
145
  watcher: RegisteredProcessWatcherLike<TConfig, TEvent>,
118
146
  event: TEvent,
119
- request: { idempotencyKey: string; actor: Actor },
120
- ): Promise<{ launchRunId: string; process: ProcessInstance | null; error: string | null }>;
121
- retryStartup(instanceId: string, actor: Actor): Promise<{ launchRunId: string }>;
147
+ request: {
148
+ /** @internal */
149
+ idempotencyKey: string;
150
+ /** @internal */
151
+ actor: Actor;
152
+ },
153
+ ): Promise<{
154
+ /** @internal */
155
+ launchRunId: string;
156
+ /** @internal */
157
+ process: ProcessInstance | null;
158
+ /** @internal */
159
+ error: string | null;
160
+ }>;
161
+ /** @internal */
162
+ retryStartup(
163
+ instanceId: string,
164
+ actor: Actor,
165
+ ): Promise<{
166
+ /** @internal */
167
+ launchRunId: string;
168
+ }>;
169
+ /** @internal */
122
170
  get(launchRunId: string): LaunchRun | null;
171
+ /** @internal */
123
172
  refresh(instanceId: string): LaunchRun | null;
173
+ /** @internal */
124
174
  reconcileIncomplete(): Promise<void>;
125
175
  }
126
176
 
@@ -34,63 +34,141 @@ export const STARTUP_STEP_IDS = [
34
34
  "start_first_turn",
35
35
  ] as const;
36
36
 
37
+ /** @internal */
37
38
  export type LaunchStageFailure<TFailure> = {
39
+ /** @internal */
38
40
  safeSummary: string;
41
+ /** @internal */
39
42
  value: TFailure;
40
43
  };
41
44
 
45
+ /** @internal */
42
46
  export type LaunchResolution<TResolved, TFailure> =
43
- | { kind: "resolved"; value: TResolved }
44
- | { kind: "skipped" }
45
- | { kind: "failed"; failure: LaunchStageFailure<TFailure> };
47
+ | {
48
+ /** @internal */
49
+ kind: "resolved";
50
+ /** @internal */
51
+ value: TResolved;
52
+ }
53
+ | {
54
+ /** @internal */
55
+ kind: "skipped";
56
+ }
57
+ | {
58
+ /** @internal */
59
+ kind: "failed";
60
+ /** @internal */
61
+ failure: LaunchStageFailure<TFailure>;
62
+ };
46
63
 
64
+ /** @internal */
47
65
  export interface LaunchPipelineCheck {
66
+ /** @internal */
48
67
  id: string;
68
+ /** @internal */
49
69
  label: string;
70
+ /** @internal */
50
71
  run(input: {
72
+ /** @internal */
51
73
  signal: AbortSignal;
52
- logger: { info(message: string): void; warn(message: string): void };
74
+ /** @internal */
75
+ logger: {
76
+ /** @internal */
77
+ info(message: string): void;
78
+ /** @internal */
79
+ warn(message: string): void;
80
+ };
53
81
  }): Promise<void>;
54
82
  }
55
83
 
84
+ /** @internal */
56
85
  export type LaunchCommit<TResult, TFailure> =
57
86
  | {
87
+ /** @internal */
58
88
  kind: "committed";
89
+ /** @internal */
59
90
  result: TResult;
91
+ /** @internal */
60
92
  process: ProcessInstance;
93
+ /** @internal */
61
94
  startTurnId: string | null;
95
+ /** @internal */
62
96
  reused: boolean;
63
97
  }
64
98
  | {
99
+ /** @internal */
65
100
  kind: "committed_with_reaction_error";
101
+ /** @internal */
66
102
  result: TResult;
103
+ /** @internal */
67
104
  process: ProcessInstance;
105
+ /** @internal */
68
106
  startTurnId: string | null;
107
+ /** @internal */
69
108
  safeSummary: string;
70
109
  }
71
- | { kind: "failed"; failure: LaunchStageFailure<TFailure> };
110
+ | {
111
+ /** @internal */
112
+ kind: "failed";
113
+ /** @internal */
114
+ failure: LaunchStageFailure<TFailure>;
115
+ };
72
116
 
117
+ /** @internal */
73
118
  export interface LaunchAdapter<TResolved, TPrepared, TResult, TFailure> {
119
+ /** @internal */
74
120
  resolve(): Promise<LaunchResolution<TResolved, TFailure>>;
121
+ /** @internal */
75
122
  preparationChecks?(resolved: TResolved): readonly LaunchPipelineCheck[];
123
+ /** @internal */
76
124
  preparationCheckFailure?(error: unknown, safeSummary: string): TFailure;
77
- prepare(
78
- resolved: TResolved,
79
- ): Promise<{ ok: true; value: TPrepared } | { ok: false; failure: LaunchStageFailure<TFailure> }>;
125
+ /** @internal */
126
+ prepare(resolved: TResolved): Promise<
127
+ | {
128
+ /** @internal */
129
+ ok: true;
130
+ /** @internal */
131
+ value: TPrepared;
132
+ }
133
+ | {
134
+ /** @internal */
135
+ ok: false;
136
+ /** @internal */
137
+ failure: LaunchStageFailure<TFailure>;
138
+ }
139
+ >;
140
+ /** @internal */
80
141
  commit(
81
142
  prepared: TPrepared,
82
- ctx: { launchRunId: string },
143
+ ctx: {
144
+ /** @internal */
145
+ launchRunId: string;
146
+ },
83
147
  ): Promise<LaunchCommit<TResult, TFailure>>;
148
+ /** @internal */
84
149
  unexpectedFailure?(error: unknown): LaunchStageFailure<TFailure>;
85
150
  }
86
151
 
152
+ /** @internal */
87
153
  export type LaunchPipelineRunResult<TResult, TFailure> =
88
- | { kind: "skipped" }
89
- | { kind: "failed"; failure: LaunchStageFailure<TFailure> }
90
154
  | {
155
+ /** @internal */
156
+ kind: "skipped";
157
+ }
158
+ | {
159
+ /** @internal */
160
+ kind: "failed";
161
+ /** @internal */
162
+ failure: LaunchStageFailure<TFailure>;
163
+ }
164
+ | {
165
+ /** @internal */
91
166
  kind: "committed" | "committed_with_reaction_error";
167
+ /** @internal */
92
168
  result: TResult;
169
+ /** @internal */
93
170
  process: ProcessInstance;
171
+ /** @internal */
94
172
  reused: boolean;
95
173
  };
96
174
 
@@ -113,14 +191,27 @@ export function presentPipelineResult<TResult, TFailure>(
113
191
  };
114
192
  }
115
193
 
194
+ /** @internal */
116
195
  export interface LaunchPipeline {
196
+ /** @internal */
117
197
  open(input: {
198
+ /** @internal */
118
199
  launcherId: string | null;
200
+ /** @internal */
119
201
  idempotencyKey?: string | null;
202
+ /** @internal */
120
203
  origin: LaunchRun["origin"];
204
+ /** @internal */
121
205
  broadcast?: boolean;
122
- }): { launchRunId: string; existing: boolean };
206
+ }): {
207
+ /** @internal */
208
+ launchRunId: string;
209
+ /** @internal */
210
+ existing: boolean;
211
+ };
212
+ /** @internal */
123
213
  update(id: string, fn: (run: LaunchRun) => LaunchRun): LaunchRun;
214
+ /** @internal */
124
215
  run<TResolved, TPrepared, TResult, TFailure>(
125
216
  launchRunId: string,
126
217
  adapter: LaunchAdapter<TResolved, TPrepared, TResult, TFailure>,
@@ -9,8 +9,11 @@ import {
9
9
  } from "@leitwerk-dev/process-sdk";
10
10
  import type { RepositoryBundle } from "./db/repositories.js";
11
11
 
12
+ /** @internal */
12
13
  export interface LauncherRecentValuesService {
14
+ /** @internal */
13
15
  list(launcherId: string): Record<string, readonly string[]>;
16
+ /** @internal */
14
17
  record(launcherId: string, launcherInput: Record<string, unknown>): void;
15
18
  }
16
19
 
package/src/main.ts CHANGED
@@ -69,8 +69,7 @@ async function shutdown(signal: keyof typeof SIGNAL_EXIT_CODES) {
69
69
  }
70
70
  shuttingDown = true;
71
71
  try {
72
- await ctx.stopBackgroundServices();
73
- await ctx.app.close();
72
+ await ctx.close();
74
73
  process.exit(SIGNAL_EXIT_CODES[signal]);
75
74
  } catch (error) {
76
75
  ctx.app.log.error(error);
@@ -86,17 +85,11 @@ process.once("SIGTERM", () => {
86
85
  });
87
86
 
88
87
  try {
89
- const listenStartedAt = performance.now();
90
- await ctx.app.listen({ host: runtimeServer.host, port: runtimeServer.port });
91
- ctx.app.log.info(
92
- { listenDurationMs: Math.round((performance.now() - listenStartedAt) * 10) / 10 },
93
- "Server HTTP listener ready",
94
- );
95
- await ctx.startBackgroundServices();
88
+ await ctx.listen({ host: runtimeServer.host, port: runtimeServer.port });
96
89
  } catch (err) {
97
90
  ctx.app.log.error(err);
98
91
  try {
99
- await ctx.app.close();
92
+ await ctx.close();
100
93
  } catch (closeError) {
101
94
  ctx.app.log.error(closeError);
102
95
  }
@@ -51,6 +51,7 @@ function configuredModel(
51
51
  * Direct, server-only Pi AI adapter. It never reads PI_CODING_AGENT_DIR or an
52
52
  * ambient auth file; the current credential revision is supplied per call.
53
53
  */
54
+ /** @internal */
54
55
  export function createBuiltinPiServerAdapter(builtinProviderId: string): PiServerAdapter {
55
56
  return definePiServerAdapter({
56
57
  async generateText(input) {