@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
@@ -37,14 +37,21 @@ const positiveSafeInteger = v.pipe(
37
37
  v.maxValue(Number.MAX_SAFE_INTEGER),
38
38
  );
39
39
 
40
+ /** @public */
40
41
  export interface ConfigLoadResult {
42
+ /** @public */
41
43
  ok: true;
44
+ /** @public */
42
45
  config: LeitwerkConfig;
46
+ /** @internal */
43
47
  filePath: string;
44
48
  }
45
49
 
50
+ /** @public */
46
51
  export interface ConfigLoadError {
52
+ /** @public */
47
53
  ok: false;
54
+ /** @public */
48
55
  error: string;
49
56
  }
50
57
 
@@ -79,6 +86,7 @@ const mergeConfigDefaults = createDefu((object, key, value) => {
79
86
  return false;
80
87
  });
81
88
 
89
+ /** @internal */
82
90
  export function applyConfigDefaults(raw: Record<string, unknown>): LeitwerkConfig {
83
91
  const merged = mergeConfigDefaults(structuredClone(raw), getDefaultConfig()) as LeitwerkConfig;
84
92
  if (Object.hasOwn(raw, "worker_runtime_profiles")) {
@@ -123,6 +131,7 @@ export function loadConfigFromFile(filePath: string): ConfigLoadResult | ConfigL
123
131
  }
124
132
  }
125
133
 
134
+ /** @public */
126
135
  export function loadConfig(explicitPath?: string): ConfigLoadResult | ConfigLoadError {
127
136
  const filePath = resolveConfigPath(explicitPath);
128
137
  if (!filePath) {
@@ -385,6 +394,7 @@ const configSchema = v.looseObject({
385
394
  v.strictObject({
386
395
  runtime_class_name: v.optional(v.string()),
387
396
  host_users: v.optional(v.boolean()),
397
+ gvisor: v.optional(v.boolean()),
388
398
  process_storage_class_name: v.optional(v.string()),
389
399
  network: v.optional(dockerNetworkSchema),
390
400
  }),
@@ -943,6 +953,7 @@ function shouldRedactForLogging(path: readonly string[], key: string): boolean {
943
953
  );
944
954
  }
945
955
 
956
+ /** @internal */
946
957
  export function sanitizeConfigForLogging(value: unknown, path: readonly string[] = []): unknown {
947
958
  if (Array.isArray(value)) {
948
959
  return value.map((entry, index) => sanitizeConfigForLogging(entry, [...path, String(index)]));
@@ -963,6 +974,7 @@ export function sanitizeConfigForLogging(value: unknown, path: readonly string[]
963
974
  return sanitized;
964
975
  }
965
976
 
977
+ /** @public */
966
978
  export function getDefaultConfig(): LeitwerkConfig {
967
979
  return {
968
980
  skill_repositories: [],
@@ -8,7 +8,7 @@ import type {
8
8
  ServerConfigSnapshot,
9
9
  StorageConfigSnapshot,
10
10
  WorkersConfigSnapshot,
11
- } from "@leitwerk-dev/protocol";
11
+ } from "@leitwerk-dev/protocol/config-snapshot";
12
12
  import type { DockerNetworkConfig } from "@leitwerk-dev/worker-protocol";
13
13
 
14
14
  export type {
@@ -16,90 +16,113 @@ export type {
16
16
  ConfigSnapshot,
17
17
  ExtensionLoadingConfigSnapshot as ExtensionLoadingConfig,
18
18
  ModelProfileSnapshot as ModelProfile,
19
- NotificationChannelConfigSnapshot as NotificationChannelConfig,
20
- NotificationsConfigSnapshot as NotificationsConfig,
21
- PiConfigSnapshot as PiConfig,
22
- PiProcessTitleGenerationConfigSnapshot,
23
- PiProcessTitleGenerationRetryConfigSnapshot,
24
- PiProviderRetryConfigSnapshot,
25
- PiRetryConfigSnapshot,
26
19
  ProcessConfigSnapshot as ProcessConfig,
27
- ProcessTurnConfigSnapshot as ProcessTurnConfig,
28
20
  SandboxConfigSnapshot as SandboxConfig,
29
21
  ServerConfigSnapshot as ServerConfig,
30
- ServerWebsocketConfigSnapshot,
31
- SquadNotificationConfigSnapshot as SquadNotificationConfig,
32
- SquadNotificationRouteSnapshot,
33
22
  StorageConfigSnapshot as StorageConfig,
34
- WorkersCleanupConfigSnapshot,
35
23
  WorkersConfigSnapshot as WorkersConfig,
36
- } from "@leitwerk-dev/protocol";
24
+ } from "@leitwerk-dev/protocol/config-snapshot";
37
25
 
26
+ /** @internal */
38
27
  export interface SkillRepositoryConfig {
28
+ /** @internal */
39
29
  id: string;
30
+ /** @internal */
40
31
  label?: string;
32
+ /** @internal */
41
33
  url: string;
34
+ /** @internal */
42
35
  ref: string;
43
- /** Directory recursively scanned for skill directories. Defaults to `skills`. */
36
+ /** Directory recursively scanned for skill directories. Defaults to `skills`. @internal */
44
37
  path?: string;
45
38
  }
46
39
 
40
+ /** @internal */
47
41
  export interface AuthSessionConfig {
42
+ /** @internal */
48
43
  cookie_name?: string;
44
+ /** @internal */
49
45
  ttl?: string;
50
46
  }
51
47
 
48
+ /** @internal */
52
49
  export interface AuthOidcProviderConfig {
50
+ /** @internal */
53
51
  id: string;
52
+ /** @internal */
54
53
  kind: "oidc";
54
+ /** @internal */
55
55
  issuer: string;
56
+ /** @internal */
56
57
  client_id: string;
58
+ /** @internal */
57
59
  client_secret: string;
60
+ /** @internal */
58
61
  redirect_uri?: string;
62
+ /** @internal */
59
63
  scopes?: string[];
64
+ /** @internal */
60
65
  identity_claim?: string;
61
66
  }
62
67
 
68
+ /** @internal */
63
69
  export interface AuthGithubProviderConfig {
70
+ /** @internal */
64
71
  id: "github";
72
+ /** @internal */
65
73
  kind: "oauth2";
74
+ /** @internal */
66
75
  client_id: string;
76
+ /** @internal */
67
77
  client_secret: string;
68
- /** GitHub organization whose active members may sign in. */
78
+ /** GitHub organization whose active members may sign in. @internal */
69
79
  organization: string;
80
+ /** @internal */
70
81
  redirect_uri?: string;
71
82
  }
72
83
 
84
+ /** @internal */
73
85
  export type AuthProviderConfig = AuthOidcProviderConfig | AuthGithubProviderConfig;
74
86
 
87
+ /** @internal */
75
88
  export interface ApiTokensConfig {
89
+ /** @internal */
76
90
  enabled?: boolean;
91
+ /** @internal */
77
92
  default_ttl?: string;
93
+ /** @internal */
78
94
  max_ttl?: string;
95
+ /** @internal */
79
96
  allow_no_expiry?: boolean;
80
97
  }
81
98
 
99
+ /** @internal */
82
100
  export interface AuthConfig {
101
+ /** @internal */
83
102
  api_tokens?: ApiTokensConfig;
84
- /** Only true enables authentication; omit or set false to keep the leitwerk unauthenticated. */
103
+ /** Only true enables authentication; omit or set false to keep the leitwerk unauthenticated. @internal */
85
104
  enabled?: boolean;
105
+ /** @internal */
86
106
  session?: AuthSessionConfig;
107
+ /** @internal */
87
108
  providers?: AuthProviderConfig[];
88
- /** Raw OIDC identity claim values that may sign in. GitHub uses organization membership. */
109
+ /** Raw OIDC identity claim values that may sign in. GitHub uses organization membership. @internal */
89
110
  allowlist?: string[];
90
111
  }
91
112
 
113
+ /** @internal */
92
114
  export interface DockerProcessVolumeConfig {
93
- /** `bind` mounts a host path; `named_volume` uses a Docker-managed volume. */
115
+ /** `bind` mounts a host path; `named_volume` uses a Docker-managed volume. @internal */
94
116
  mode: "bind" | "named_volume";
95
- /** Host root under which per-process volumes are created (bind mode). */
117
+ /** Host root under which per-process volumes are created (bind mode). @internal */
96
118
  host_root: string;
97
- /** Path inside the worker container where the volume is mounted. */
119
+ /** Path inside the worker container where the volume is mounted. @internal */
98
120
  mount_path: string;
99
121
  }
100
122
 
123
+ /** @internal */
101
124
  export interface DockerPrivateDaemonConfig {
102
- /** Exact isolation used for every Docker-requiring process. */
125
+ /** Exact isolation used for every Docker-requiring process. @internal */
103
126
  isolation: "privileged" | "sysbox-runc";
104
127
  }
105
128
 
@@ -107,105 +130,154 @@ export interface DockerPrivateDaemonConfig {
107
130
  * Server-only Docker run-mode wiring. The worker never receives this block; it
108
131
  * dials back over WebSocket using launcher-injected connect env.
109
132
  */
133
+ /** @internal */
110
134
  export interface DockerRunnerConfig {
111
- /** Docker Engine API socket (Podman/OrbStack/nerdctl compatible). */
135
+ /** Docker Engine API socket (Podman/OrbStack/nerdctl compatible). @internal */
112
136
  socket: string;
113
- /** Shared private user-defined network for server + workers. */
137
+ /** Shared private user-defined network for server + workers. @internal */
114
138
  network: string;
115
- /** Stable internal HTTP(S) base URL workers use for IPC, never a host IP. */
139
+ /** Stable internal HTTP(S) base URL workers use for IPC, never a host IP. @internal */
116
140
  server_url: string;
117
- /** CA the worker trusts for internal TLS (self-signed ok on a private net). */
141
+ /** CA the worker trusts for internal TLS (self-signed ok on a private net). @internal */
118
142
  server_ca_file?: string;
143
+ /** @internal */
119
144
  process_volume: DockerProcessVolumeConfig;
120
- /** Private daemon realization for Docker-requiring processes. */
145
+ /** Private daemon realization for Docker-requiring processes. @internal */
121
146
  private_daemon?: DockerPrivateDaemonConfig;
122
147
  }
123
148
 
149
+ /** @internal */
124
150
  export interface KubernetesProcessVolumeConfig {
125
- /** Optional ready-volume target; zero stops replenishment. */
126
- pre_provision?: { count: number };
151
+ /** Optional ready-volume target; zero stops replenishment. @internal */
152
+ pre_provision?: {
153
+ /** @internal */
154
+ count: number;
155
+ };
156
+ /** @internal */
127
157
  storage_class_name?: string;
158
+ /** @internal */
128
159
  size: string;
160
+ /** @internal */
129
161
  access_modes: string[];
162
+ /** @internal */
130
163
  mount_path: string;
131
164
  }
132
165
 
166
+ /** @internal */
133
167
  export interface KubernetesDockerConfig {
134
- /** Pod RuntimeClass selected for every Docker-requiring process. */
168
+ /** Pod RuntimeClass selected for every Docker-requiring process. @internal */
135
169
  runtime_class_name?: string;
136
- /** Pod user-namespace policy passed directly to spec.hostUsers. */
170
+ /** Pod user-namespace policy passed directly to spec.hostUsers. @internal */
137
171
  host_users?: boolean;
138
- /** StorageClass selected for the process's single retained PVC. */
172
+ /** @internal Opt in to the verified gVisor Docker wrapper and guest capabilities. */
173
+ gvisor?: boolean;
174
+ /** StorageClass selected for the process's single retained PVC. @internal */
139
175
  process_storage_class_name?: string;
176
+ /** @internal */
140
177
  network?: DockerNetworkConfig;
141
178
  }
142
179
 
180
+ /** @internal */
143
181
  export interface KubernetesHostAliasConfig {
182
+ /** @internal */
144
183
  ip: string;
184
+ /** @internal */
145
185
  hostnames: string[];
146
186
  }
147
187
 
188
+ /** @internal */
148
189
  export interface KubernetesPodConfig {
190
+ /** @internal */
149
191
  node_selector?: Record<string, string>;
192
+ /** @internal */
150
193
  tolerations?: unknown[];
194
+ /** @internal */
151
195
  annotations?: Record<string, string>;
196
+ /** @internal */
152
197
  host_aliases?: KubernetesHostAliasConfig[];
153
198
  }
154
199
 
200
+ /** @internal */
155
201
  export interface KubernetesImagePullSecretCopyConfig {
156
- /** Secret name in the server namespace. */
202
+ /** Secret name in the server namespace. @internal */
157
203
  source_name: string;
158
- /** Secret name created in each process namespace. */
204
+ /** Secret name created in each process namespace. @internal */
159
205
  target_name: string;
160
206
  }
161
207
 
162
- /** Server-only Kubernetes run-mode wiring. */
208
+ /** Server-only Kubernetes run-mode wiring. @public */
163
209
  export interface LocalWorkerRunnerConfig {
164
- /** Command used by the best-effort local dev/test runner. */
210
+ /** Command used by the best-effort local dev/test runner. @internal */
165
211
  command: string;
166
- /** Arguments passed to the local worker command. */
212
+ /** Arguments passed to the local worker command. @internal */
167
213
  args: string[];
168
- /** Explicit acknowledgement that Docker processes inherit host Docker authority. */
214
+ /** Explicit acknowledgement that Docker processes inherit host Docker authority. @public */
169
215
  allow_host_docker?: boolean;
170
216
  }
171
217
 
218
+ /** @internal */
172
219
  export interface KubernetesRunnerConfig {
173
- /** Dedicated namespace where the singleton server runs. */
220
+ /** Dedicated namespace where the singleton server runs. @internal */
174
221
  server_namespace: string;
175
- /** Safe DNS prefix used to derive one namespace per process instance. */
222
+ /** Safe DNS prefix used to derive one namespace per process instance. @internal */
176
223
  process_namespace_prefix: string;
177
- /** Stable in-cluster HTTP(S) base URL workers use to dial the server. */
224
+ /** Stable in-cluster HTTP(S) base URL workers use to dial the server. @internal */
178
225
  server_url: string;
179
- /** Server-local CA bundle copied into process namespaces for worker TLS trust. */
226
+ /** Server-local CA bundle copied into process namespaces for worker TLS trust. @internal */
180
227
  server_ca_file?: string;
181
- /** Optional Kubernetes API URL override; defaults to the in-cluster service. */
228
+ /** Optional Kubernetes API URL override; defaults to the in-cluster service. @internal */
182
229
  api_server_url?: string;
230
+ /** @internal */
183
231
  default_worker_runtime_profile?: string;
232
+ /** @internal */
184
233
  worker_service_account?: string;
234
+ /** @internal */
185
235
  process_volume: KubernetesProcessVolumeConfig;
186
- /** Trusted private-Docker realization. Incomplete blocks leave Docker processes unavailable. */
236
+ /** Trusted private-Docker realization. Incomplete blocks leave Docker processes unavailable. @internal */
187
237
  docker?: KubernetesDockerConfig;
238
+ /** @internal */
188
239
  pod?: KubernetesPodConfig;
240
+ /** @internal */
189
241
  image_pull_secrets?: string[];
242
+ /** @internal */
190
243
  image_pull_secret_copies?: KubernetesImagePullSecretCopyConfig[];
191
244
  }
192
245
 
246
+ /** @internal */
193
247
  export interface WorkerRuntimeProfileCpuMemoryConfig {
248
+ /** @internal */
194
249
  cpu?: string;
250
+ /** @internal */
195
251
  memory?: string;
196
252
  }
197
253
 
254
+ /** @internal */
198
255
  export interface DockerRegistryConfig {
199
- /** Actual registry permissions are enforced by the registry, not this binding. */
200
- profiles: Record<string, { registry: string; username: string; password: string }>;
256
+ /** Actual registry permissions are enforced by the registry, not this binding. @internal */
257
+ profiles: Record<
258
+ string,
259
+ {
260
+ /** @internal */
261
+ registry: string;
262
+ /** @internal */
263
+ username: string;
264
+ /** @internal */
265
+ password: string;
266
+ }
267
+ >;
268
+ /** @internal */
201
269
  process_bindings: Record<string, string[]>;
202
270
  }
203
271
 
272
+ /** @internal */
204
273
  export interface WorkerRuntimeProfileResourcesConfig {
274
+ /** @internal */
205
275
  requests?: WorkerRuntimeProfileCpuMemoryConfig;
276
+ /** @internal */
206
277
  limits?: WorkerRuntimeProfileCpuMemoryConfig;
207
- /** Back-compat shorthand interpreted as limits by Docker and manifest builders. */
278
+ /** Back-compat shorthand interpreted as limits by Docker and manifest builders. @internal */
208
279
  cpu?: string;
280
+ /** @internal */
209
281
  memory?: string;
210
282
  }
211
283
 
@@ -213,10 +285,13 @@ export interface WorkerRuntimeProfileResourcesConfig {
213
285
  * A reusable worker image selection authored only in leitwerk config.
214
286
  * Repository branch content must never select an image.
215
287
  */
288
+ /** @internal */
216
289
  export interface WorkerRuntimeProfileConfig {
217
- /** Fully qualified image reference, ideally digest-pinned for production. */
290
+ /** Fully qualified image reference, ideally digest-pinned for production. @internal */
218
291
  image: string;
292
+ /** @internal */
219
293
  image_pull_policy?: string;
294
+ /** @internal */
220
295
  resources?: WorkerRuntimeProfileResourcesConfig;
221
296
  }
222
297
 
@@ -228,74 +303,99 @@ export interface WorkerRuntimeProfileConfig {
228
303
  * terminated separately by a reverse proxy. Disabled by default so local and
229
304
  * parity runs stay on plain HTTP.
230
305
  */
306
+ /** @internal */
231
307
  export interface CommitMessageTemplateConfig {
232
- /** Human-readable instructions applied to generated commit messages. */
308
+ /** Human-readable instructions applied to generated commit messages. @internal */
233
309
  rules: string;
234
310
  }
235
311
 
312
+ /** @internal */
236
313
  export interface CommitMessageConfig {
237
- /** Named, reusable formatting-rule templates. */
314
+ /** Named, reusable formatting-rule templates. @internal */
238
315
  templates: Record<string, CommitMessageTemplateConfig>;
239
- /** Template used when a repository has no explicit mapping. Null/omitted uses built-in guidance. */
316
+ /** Template used when a repository has no explicit mapping. Null/omitted uses built-in guidance. @internal */
240
317
  default_template?: string | null;
241
- /** Repository locator to template id. Locators are normalized before matching. */
318
+ /** Repository locator to template id. Locators are normalized before matching. @internal */
242
319
  repositories: Record<string, string>;
243
320
  }
244
321
 
322
+ /** @internal */
245
323
  export interface InternalTlsConfig {
324
+ /** @internal */
246
325
  enabled: boolean;
247
- /** PEM cert chain the server presents on the internal listener. */
326
+ /** PEM cert chain the server presents on the internal listener. @internal */
248
327
  cert_file?: string;
249
- /** PEM private key for {@link InternalTlsConfig.cert_file}. */
328
+ /** PEM private key for {@link InternalTlsConfig.cert_file}. @internal */
250
329
  key_file?: string;
251
330
  /**
252
331
  * Reserved for future worker client-certificate verification. Currently
253
332
  * rejected by validation because workers do not receive client cert/key material.
254
333
  */
334
+ /** @internal */
255
335
  client_ca_file?: string;
256
336
  }
257
337
 
338
+ /** @internal */
258
339
  export interface SessionTransferConfig {
340
+ /** @internal */
259
341
  max_entries: number;
342
+ /** @internal */
260
343
  max_logical_bytes: number;
344
+ /** @internal */
261
345
  max_compressed_bytes: number;
262
346
  }
263
347
 
348
+ /** @internal */
264
349
  export interface DevelopmentToolsConfig {
350
+ /** @internal */
265
351
  install_timeout: string;
266
- local: { mise_command: string };
352
+ /** @internal */
353
+ local: {
354
+ /** @internal */
355
+ mise_command: string;
356
+ };
267
357
  }
268
358
 
269
- /** Server-owned config. `auth` and runner wiring are intentionally server-only and are not part of the worker ConfigSnapshot. */
359
+ /** Server-owned config. `auth` and runner wiring are intentionally server-only and are not part of the worker ConfigSnapshot. @public */
270
360
  export interface LeitwerkConfig extends ConfigSnapshot {
361
+ /** @public */
271
362
  server: ServerConfigSnapshot;
363
+ /** @public */
272
364
  storage: StorageConfigSnapshot;
365
+ /** @internal */
273
366
  components: Record<string, ComponentConfigSnapshot>;
367
+ /** @public */
274
368
  workers: WorkersConfigSnapshot;
369
+ /** @internal */
275
370
  development_tools: DevelopmentToolsConfig;
371
+ /** @public */
276
372
  process_configs?: Record<string, ProcessConfigSnapshot>;
373
+ /** @internal */
277
374
  notifications: NotificationsConfigSnapshot;
375
+ /** @internal */
278
376
  sandbox: SandboxConfigSnapshot;
377
+ /** @public */
279
378
  extension_loading: ExtensionLoadingConfigSnapshot;
280
- /** Extension-owned config blocks, keyed by extension ID. */
379
+ /** Extension-owned config blocks, keyed by extension ID. @public */
281
380
  extensions: Record<string, unknown>;
381
+ /** @internal */
282
382
  auth?: AuthConfig;
283
- /** Server-only Docker run-mode wiring; stripped from the worker snapshot. */
383
+ /** Server-only Docker run-mode wiring; stripped from the worker snapshot. @internal */
284
384
  docker?: DockerRunnerConfig;
285
- /** Server-only credentials delivered exclusively through authenticated worker.start. */
385
+ /** Server-only credentials delivered exclusively through authenticated worker.start. @internal */
286
386
  docker_registries?: DockerRegistryConfig;
287
- /** Server-only Kubernetes run-mode wiring; stripped from the worker snapshot. */
387
+ /** Server-only Kubernetes run-mode wiring; stripped from the worker snapshot. @internal */
288
388
  kubernetes?: KubernetesRunnerConfig;
289
- /** Server-only best-effort local dev/test runner wiring; stripped from the worker snapshot. */
389
+ /** Server-only best-effort local dev/test runner wiring; stripped from the worker snapshot. @public */
290
390
  local_worker?: LocalWorkerRunnerConfig;
291
- /** Reusable worker image selections; stripped from the worker snapshot. */
391
+ /** Reusable worker image selections; stripped from the worker snapshot. @internal */
292
392
  worker_runtime_profiles?: Record<string, WorkerRuntimeProfileConfig>;
293
- /** Server-only internal TLS for worker IPC; stripped from the worker snapshot. */
393
+ /** Server-only internal TLS for worker IPC; stripped from the worker snapshot. @internal */
294
394
  internal_tls?: InternalTlsConfig;
295
- /** Git repositories scanned for operator-managed skills. */
395
+ /** Git repositories scanned for operator-managed skills. @internal */
296
396
  skill_repositories?: SkillRepositoryConfig[];
297
- /** Server-owned repository-aware commit-message generation rules. */
397
+ /** Server-owned repository-aware commit-message generation rules. @internal */
298
398
  commit_messages?: CommitMessageConfig;
299
- /** Bounded archive and extraction ceilings for local session transfer. */
399
+ /** Bounded archive and extraction ceilings for local session transfer. @internal */
300
400
  session_transfer?: SessionTransferConfig;
301
401
  }
@@ -4,17 +4,42 @@ import { and, desc, eq, isNull } from "drizzle-orm";
4
4
  import type { LeitwerkDb } from "./database.js";
5
5
  import { apiTokens } from "./schema.js";
6
6
 
7
+ /** @internal */
7
8
  export type TokenProviderBinding =
8
- | { id: string; kind: "oidc"; issuer: string; identityClaim: string }
9
- | { id: string; kind: "oauth2"; organization: string };
9
+ | {
10
+ /** @internal */
11
+ id: string;
12
+ /** @internal */
13
+ kind: "oidc";
14
+ /** @internal */
15
+ issuer: string;
16
+ /** @internal */
17
+ identityClaim: string;
18
+ }
19
+ | {
20
+ /** @internal */
21
+ id: string;
22
+ /** @internal */
23
+ kind: "oauth2";
24
+ /** @internal */
25
+ organization: string;
26
+ };
27
+ /** @internal */
10
28
  export interface ApiTokenOwner {
29
+ /** @internal */
11
30
  kind: "user" | "anonymous";
31
+ /** @internal */
12
32
  id: string;
33
+ /** @internal */
13
34
  actor: Actor;
35
+ /** @internal */
14
36
  providerBinding: TokenProviderBinding | null;
15
37
  }
38
+ /** @internal */
16
39
  export interface ApiTokenRecord extends ApiTokenMetadata {
40
+ /** @internal */
17
41
  secretHash: string;
42
+ /** @internal */
18
43
  owner: ApiTokenOwner;
19
44
  }
20
45
  function record(row: typeof apiTokens.$inferSelect): ApiTokenRecord {
@@ -32,8 +57,10 @@ function record(row: typeof apiTokens.$inferSelect): ApiTokenRecord {
32
57
  function owned(owner: ApiTokenOwner) {
33
58
  return and(eq(apiTokens.ownerKind, owner.kind), eq(apiTokens.ownerId, owner.id));
34
59
  }
60
+ /** @internal */
35
61
  export function createApiTokenRepo(db: LeitwerkDb) {
36
62
  return {
63
+ /** @internal */
37
64
  create({ owner, ...fields }: ApiTokenRecord): void {
38
65
  db.insert(apiTokens)
39
66
  .values({
@@ -45,6 +72,7 @@ export function createApiTokenRepo(db: LeitwerkDb) {
45
72
  })
46
73
  .run();
47
74
  },
75
+ /** @internal */
48
76
  list(owner: ApiTokenOwner): ApiTokenRecord[] {
49
77
  return db
50
78
  .select()
@@ -54,10 +82,12 @@ export function createApiTokenRepo(db: LeitwerkDb) {
54
82
  .all()
55
83
  .map(record);
56
84
  },
85
+ /** @internal */
57
86
  findByHash(hash: string): ApiTokenRecord | null {
58
87
  const row = db.select().from(apiTokens).where(eq(apiTokens.secretHash, hash)).get();
59
88
  return row ? record(row) : null;
60
89
  },
90
+ /** @internal */
61
91
  revoke(owner: ApiTokenOwner, id: string, at: string): boolean {
62
92
  const filter = and(owned(owner), eq(apiTokens.id, id));
63
93
  if (!db.select({ id: apiTokens.id }).from(apiTokens).where(filter).get()) return false;
@@ -67,6 +97,7 @@ export function createApiTokenRepo(db: LeitwerkDb) {
67
97
  .run();
68
98
  return true;
69
99
  },
100
+ /** @internal */
70
101
  revokeAll(owner: ApiTokenOwner, at: string): number {
71
102
  const result = db
72
103
  .update(apiTokens)
@@ -75,6 +106,7 @@ export function createApiTokenRepo(db: LeitwerkDb) {
75
106
  .run();
76
107
  return Number(result.changes);
77
108
  },
109
+ /** @internal */
78
110
  revokeAnonymous(at: string): number {
79
111
  const result = db
80
112
  .update(apiTokens)
@@ -83,6 +115,7 @@ export function createApiTokenRepo(db: LeitwerkDb) {
83
115
  .run();
84
116
  return Number(result.changes);
85
117
  },
118
+ /** @internal */
86
119
  touch(id: string, at: string): void {
87
120
  db.update(apiTokens).set({ lastUsedAt: at }).where(eq(apiTokens.id, id)).run();
88
121
  },