open-multi-agent-kit 0.80.6 → 0.80.7

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 (981) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/README.md +22 -14
  3. package/dist/cli/config-selector.d.ts +1 -1
  4. package/dist/cli/config-selector.d.ts.map +1 -1
  5. package/dist/cli/config-selector.js +1 -1
  6. package/dist/cli/config-selector.js.map +1 -1
  7. package/dist/config.d.ts +1 -0
  8. package/dist/config.d.ts.map +1 -1
  9. package/dist/config.js +9 -8
  10. package/dist/config.js.map +1 -1
  11. package/dist/core/agent-session.d.ts +45 -6
  12. package/dist/core/agent-session.d.ts.map +1 -1
  13. package/dist/core/agent-session.js +197 -13
  14. package/dist/core/agent-session.js.map +1 -1
  15. package/dist/core/auth-storage.d.ts +4 -1
  16. package/dist/core/auth-storage.d.ts.map +1 -1
  17. package/dist/core/auth-storage.js +5 -5
  18. package/dist/core/auth-storage.js.map +1 -1
  19. package/dist/core/bash-executor.d.ts.map +1 -1
  20. package/dist/core/bash-executor.js +1 -1
  21. package/dist/core/bash-executor.js.map +1 -1
  22. package/dist/core/command-safety.d.ts +11 -0
  23. package/dist/core/command-safety.d.ts.map +1 -0
  24. package/dist/core/command-safety.js +528 -0
  25. package/dist/core/command-safety.js.map +1 -0
  26. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  27. package/dist/core/compaction/branch-summarization.js +14 -4
  28. package/dist/core/compaction/branch-summarization.js.map +1 -1
  29. package/dist/core/compaction/compaction.d.ts +18 -1
  30. package/dist/core/compaction/compaction.d.ts.map +1 -1
  31. package/dist/core/compaction/compaction.js +80 -42
  32. package/dist/core/compaction/compaction.js.map +1 -1
  33. package/dist/core/compaction/pruner-policy.d.ts +84 -0
  34. package/dist/core/compaction/pruner-policy.d.ts.map +1 -0
  35. package/dist/core/compaction/pruner-policy.js +273 -0
  36. package/dist/core/compaction/pruner-policy.js.map +1 -0
  37. package/dist/core/context-graph-identity-resolution.d.ts +114 -0
  38. package/dist/core/context-graph-identity-resolution.d.ts.map +1 -0
  39. package/dist/core/context-graph-identity-resolution.js +127 -0
  40. package/dist/core/context-graph-identity-resolution.js.map +1 -0
  41. package/dist/core/context-graph-memory-store.d.ts +153 -0
  42. package/dist/core/context-graph-memory-store.d.ts.map +1 -0
  43. package/dist/core/context-graph-memory-store.js +377 -0
  44. package/dist/core/context-graph-memory-store.js.map +1 -0
  45. package/dist/core/context-graph-ontology-generation.d.ts +104 -0
  46. package/dist/core/context-graph-ontology-generation.d.ts.map +1 -0
  47. package/dist/core/context-graph-ontology-generation.js +135 -0
  48. package/dist/core/context-graph-ontology-generation.js.map +1 -0
  49. package/dist/core/context-graph-ontology-registry.d.ts +766 -0
  50. package/dist/core/context-graph-ontology-registry.d.ts.map +1 -0
  51. package/dist/core/context-graph-ontology-registry.js +1133 -0
  52. package/dist/core/context-graph-ontology-registry.js.map +1 -0
  53. package/dist/core/context-graph-policy.d.ts +68 -0
  54. package/dist/core/context-graph-policy.d.ts.map +1 -0
  55. package/dist/core/context-graph-policy.js +221 -0
  56. package/dist/core/context-graph-policy.js.map +1 -0
  57. package/dist/core/context-graph-reasoning.d.ts +130 -0
  58. package/dist/core/context-graph-reasoning.d.ts.map +1 -0
  59. package/dist/core/context-graph-reasoning.js +442 -0
  60. package/dist/core/context-graph-reasoning.js.map +1 -0
  61. package/dist/core/context-graph-retrieval.d.ts +120 -0
  62. package/dist/core/context-graph-retrieval.d.ts.map +1 -0
  63. package/dist/core/context-graph-retrieval.js +288 -0
  64. package/dist/core/context-graph-retrieval.js.map +1 -0
  65. package/dist/core/contract-verification.d.ts +78 -0
  66. package/dist/core/contract-verification.d.ts.map +1 -0
  67. package/dist/core/contract-verification.js +110 -0
  68. package/dist/core/contract-verification.js.map +1 -0
  69. package/dist/core/exact-cache-policy.d.ts +100 -0
  70. package/dist/core/exact-cache-policy.d.ts.map +1 -0
  71. package/dist/core/exact-cache-policy.js +175 -0
  72. package/dist/core/exact-cache-policy.js.map +1 -0
  73. package/dist/core/exec.d.ts +2 -0
  74. package/dist/core/exec.d.ts.map +1 -1
  75. package/dist/core/exec.js +1 -0
  76. package/dist/core/exec.js.map +1 -1
  77. package/dist/core/export-html/template.js +2 -2
  78. package/dist/core/extensions/builtin/command-safety-gate.d.ts +77 -0
  79. package/dist/core/extensions/builtin/command-safety-gate.d.ts.map +1 -0
  80. package/dist/core/extensions/builtin/command-safety-gate.js +147 -0
  81. package/dist/core/extensions/builtin/command-safety-gate.js.map +1 -0
  82. package/dist/core/extensions/loader.d.ts +4 -4
  83. package/dist/core/extensions/loader.d.ts.map +1 -1
  84. package/dist/core/extensions/loader.js +94 -56
  85. package/dist/core/extensions/loader.js.map +1 -1
  86. package/dist/core/extensions/runner.d.ts.map +1 -1
  87. package/dist/core/extensions/runner.js +1 -1
  88. package/dist/core/extensions/runner.js.map +1 -1
  89. package/dist/core/extensions/types.d.ts +38 -10
  90. package/dist/core/extensions/types.d.ts.map +1 -1
  91. package/dist/core/extensions/types.js.map +1 -1
  92. package/dist/core/freedom/banner.d.ts +14 -0
  93. package/dist/core/freedom/banner.d.ts.map +1 -0
  94. package/dist/core/freedom/banner.js +22 -0
  95. package/dist/core/freedom/banner.js.map +1 -0
  96. package/dist/core/freedom/config.d.ts +27 -0
  97. package/dist/core/freedom/config.d.ts.map +1 -0
  98. package/dist/core/freedom/config.js +216 -0
  99. package/dist/core/freedom/config.js.map +1 -0
  100. package/dist/core/freedom/index.d.ts +23 -0
  101. package/dist/core/freedom/index.d.ts.map +1 -0
  102. package/dist/core/freedom/index.js +19 -0
  103. package/dist/core/freedom/index.js.map +1 -0
  104. package/dist/core/freedom/policy.d.ts +42 -0
  105. package/dist/core/freedom/policy.d.ts.map +1 -0
  106. package/dist/core/freedom/policy.js +47 -0
  107. package/dist/core/freedom/policy.js.map +1 -0
  108. package/dist/core/freedom/safety-floor.d.ts +73 -0
  109. package/dist/core/freedom/safety-floor.d.ts.map +1 -0
  110. package/dist/core/freedom/safety-floor.js +275 -0
  111. package/dist/core/freedom/safety-floor.js.map +1 -0
  112. package/dist/core/harness-control-events.d.ts +13 -1
  113. package/dist/core/harness-control-events.d.ts.map +1 -1
  114. package/dist/core/harness-control-events.js +216 -41
  115. package/dist/core/harness-control-events.js.map +1 -1
  116. package/dist/core/harness-control-replay.d.ts +7 -2
  117. package/dist/core/harness-control-replay.d.ts.map +1 -1
  118. package/dist/core/harness-control-replay.js +36 -4
  119. package/dist/core/harness-control-replay.js.map +1 -1
  120. package/dist/core/headroom-middleware.d.ts +35 -0
  121. package/dist/core/headroom-middleware.d.ts.map +1 -0
  122. package/dist/core/headroom-middleware.js +166 -0
  123. package/dist/core/headroom-middleware.js.map +1 -0
  124. package/dist/core/hook-inventory.d.ts +23 -0
  125. package/dist/core/hook-inventory.d.ts.map +1 -0
  126. package/dist/core/hook-inventory.js +50 -0
  127. package/dist/core/hook-inventory.js.map +1 -0
  128. package/dist/core/lean-context-middleware.d.ts +12 -0
  129. package/dist/core/lean-context-middleware.d.ts.map +1 -0
  130. package/dist/core/lean-context-middleware.js +87 -0
  131. package/dist/core/lean-context-middleware.js.map +1 -0
  132. package/dist/core/lean-context-policy.d.ts +45 -0
  133. package/dist/core/lean-context-policy.d.ts.map +1 -0
  134. package/dist/core/lean-context-policy.js +108 -0
  135. package/dist/core/lean-context-policy.js.map +1 -0
  136. package/dist/core/loadout-access-policy.d.ts +41 -0
  137. package/dist/core/loadout-access-policy.d.ts.map +1 -0
  138. package/dist/core/loadout-access-policy.js +182 -0
  139. package/dist/core/loadout-access-policy.js.map +1 -0
  140. package/dist/core/loadout-runtime.d.ts +84 -0
  141. package/dist/core/loadout-runtime.d.ts.map +1 -0
  142. package/dist/core/loadout-runtime.js +157 -0
  143. package/dist/core/loadout-runtime.js.map +1 -0
  144. package/dist/core/loadouts.d.ts +147 -0
  145. package/dist/core/loadouts.d.ts.map +1 -0
  146. package/dist/core/loadouts.js +442 -0
  147. package/dist/core/loadouts.js.map +1 -0
  148. package/dist/core/mcp-inventory.d.ts +34 -0
  149. package/dist/core/mcp-inventory.d.ts.map +1 -1
  150. package/dist/core/mcp-inventory.js +53 -1
  151. package/dist/core/mcp-inventory.js.map +1 -1
  152. package/dist/core/mcp-presets.d.ts +57 -0
  153. package/dist/core/mcp-presets.d.ts.map +1 -0
  154. package/dist/core/mcp-presets.js +81 -0
  155. package/dist/core/mcp-presets.js.map +1 -0
  156. package/dist/core/model-registry.d.ts +1 -0
  157. package/dist/core/model-registry.d.ts.map +1 -1
  158. package/dist/core/model-registry.js +40 -17
  159. package/dist/core/model-registry.js.map +1 -1
  160. package/dist/core/model-resolver.d.ts.map +1 -1
  161. package/dist/core/model-resolver.js +1 -0
  162. package/dist/core/model-resolver.js.map +1 -1
  163. package/dist/core/native-adoption-benchmark.d.ts +166 -0
  164. package/dist/core/native-adoption-benchmark.d.ts.map +1 -0
  165. package/dist/core/native-adoption-benchmark.js +624 -0
  166. package/dist/core/native-adoption-benchmark.js.map +1 -0
  167. package/dist/core/observability-trace.d.ts +80 -0
  168. package/dist/core/observability-trace.d.ts.map +1 -0
  169. package/dist/core/observability-trace.js +140 -0
  170. package/dist/core/observability-trace.js.map +1 -0
  171. package/dist/core/orchestration/checkpoint.d.ts +83 -0
  172. package/dist/core/orchestration/checkpoint.d.ts.map +1 -0
  173. package/dist/core/orchestration/checkpoint.js +152 -0
  174. package/dist/core/orchestration/checkpoint.js.map +1 -0
  175. package/dist/core/orchestration/errors.d.ts +74 -0
  176. package/dist/core/orchestration/errors.d.ts.map +1 -0
  177. package/dist/core/orchestration/errors.js +52 -0
  178. package/dist/core/orchestration/errors.js.map +1 -0
  179. package/dist/core/orchestration/merge-queue.d.ts +121 -0
  180. package/dist/core/orchestration/merge-queue.d.ts.map +1 -0
  181. package/dist/core/orchestration/merge-queue.js +149 -0
  182. package/dist/core/orchestration/merge-queue.js.map +1 -0
  183. package/dist/core/orchestration/recovery.d.ts +106 -0
  184. package/dist/core/orchestration/recovery.d.ts.map +1 -0
  185. package/dist/core/orchestration/recovery.js +110 -0
  186. package/dist/core/orchestration/recovery.js.map +1 -0
  187. package/dist/core/orchestration/replay-ledger.d.ts +76 -0
  188. package/dist/core/orchestration/replay-ledger.d.ts.map +1 -0
  189. package/dist/core/orchestration/replay-ledger.js +395 -0
  190. package/dist/core/orchestration/replay-ledger.js.map +1 -0
  191. package/dist/core/orchestration/scheduler-state.d.ts +78 -0
  192. package/dist/core/orchestration/scheduler-state.d.ts.map +1 -0
  193. package/dist/core/orchestration/scheduler-state.js +185 -0
  194. package/dist/core/orchestration/scheduler-state.js.map +1 -0
  195. package/dist/core/orchestration/scheduler-store.d.ts +309 -0
  196. package/dist/core/orchestration/scheduler-store.d.ts.map +1 -0
  197. package/dist/core/orchestration/scheduler-store.js +368 -0
  198. package/dist/core/orchestration/scheduler-store.js.map +1 -0
  199. package/dist/core/orchestration/sqlite-scheduler-store.d.ts +57 -0
  200. package/dist/core/orchestration/sqlite-scheduler-store.d.ts.map +1 -0
  201. package/dist/core/orchestration/sqlite-scheduler-store.js +528 -0
  202. package/dist/core/orchestration/sqlite-scheduler-store.js.map +1 -0
  203. package/dist/core/orchestration/transaction-coordinator.d.ts +217 -0
  204. package/dist/core/orchestration/transaction-coordinator.d.ts.map +1 -0
  205. package/dist/core/orchestration/transaction-coordinator.js +281 -0
  206. package/dist/core/orchestration/transaction-coordinator.js.map +1 -0
  207. package/dist/core/orchestration/verification-contract.d.ts +197 -0
  208. package/dist/core/orchestration/verification-contract.d.ts.map +1 -0
  209. package/dist/core/orchestration/verification-contract.js +145 -0
  210. package/dist/core/orchestration/verification-contract.js.map +1 -0
  211. package/dist/core/package-composition.d.ts +68 -0
  212. package/dist/core/package-composition.d.ts.map +1 -0
  213. package/dist/core/package-composition.js +304 -0
  214. package/dist/core/package-composition.js.map +1 -0
  215. package/dist/core/package-gallery.d.ts +124 -0
  216. package/dist/core/package-gallery.d.ts.map +1 -0
  217. package/dist/core/package-gallery.js +392 -0
  218. package/dist/core/package-gallery.js.map +1 -0
  219. package/dist/core/package-manager.d.ts +69 -0
  220. package/dist/core/package-manager.d.ts.map +1 -1
  221. package/dist/core/package-manager.js +367 -69
  222. package/dist/core/package-manager.js.map +1 -1
  223. package/dist/core/package-procurement.d.ts +268 -0
  224. package/dist/core/package-procurement.d.ts.map +1 -0
  225. package/dist/core/package-procurement.js +697 -0
  226. package/dist/core/package-procurement.js.map +1 -0
  227. package/dist/core/package-trial-runtime.d.ts +75 -0
  228. package/dist/core/package-trial-runtime.d.ts.map +1 -0
  229. package/dist/core/package-trial-runtime.js +73 -0
  230. package/dist/core/package-trial-runtime.js.map +1 -0
  231. package/dist/core/package-trial-sandbox.d.ts +27 -0
  232. package/dist/core/package-trial-sandbox.d.ts.map +1 -0
  233. package/dist/core/package-trial-sandbox.js +102 -0
  234. package/dist/core/package-trial-sandbox.js.map +1 -0
  235. package/dist/core/policy-overlays-runtime.d.ts +141 -0
  236. package/dist/core/policy-overlays-runtime.d.ts.map +1 -0
  237. package/dist/core/policy-overlays-runtime.js +720 -0
  238. package/dist/core/policy-overlays-runtime.js.map +1 -0
  239. package/dist/core/read-anchor-registry.d.ts +27 -0
  240. package/dist/core/read-anchor-registry.d.ts.map +1 -0
  241. package/dist/core/read-anchor-registry.js +103 -0
  242. package/dist/core/read-anchor-registry.js.map +1 -0
  243. package/dist/core/read-anchors.d.ts +110 -0
  244. package/dist/core/read-anchors.d.ts.map +1 -0
  245. package/dist/core/read-anchors.js +193 -0
  246. package/dist/core/read-anchors.js.map +1 -0
  247. package/dist/core/read-content-cache.d.ts +22 -0
  248. package/dist/core/read-content-cache.d.ts.map +1 -0
  249. package/dist/core/read-content-cache.js +79 -0
  250. package/dist/core/read-content-cache.js.map +1 -0
  251. package/dist/core/recovery-checkpoint.d.ts +196 -0
  252. package/dist/core/recovery-checkpoint.d.ts.map +1 -0
  253. package/dist/core/recovery-checkpoint.js +382 -0
  254. package/dist/core/recovery-checkpoint.js.map +1 -0
  255. package/dist/core/resolve-config-value.d.ts +1 -1
  256. package/dist/core/resolve-config-value.d.ts.map +1 -1
  257. package/dist/core/resolve-config-value.js +30 -2
  258. package/dist/core/resolve-config-value.js.map +1 -1
  259. package/dist/core/resource-loader.d.ts +23 -21
  260. package/dist/core/resource-loader.d.ts.map +1 -1
  261. package/dist/core/resource-loader.js +93 -15
  262. package/dist/core/resource-loader.js.map +1 -1
  263. package/dist/core/sandbox/backend.d.ts +25 -0
  264. package/dist/core/sandbox/backend.d.ts.map +1 -0
  265. package/dist/core/sandbox/backend.js +150 -0
  266. package/dist/core/sandbox/backend.js.map +1 -0
  267. package/dist/core/sandbox/env.d.ts +6 -0
  268. package/dist/core/sandbox/env.d.ts.map +1 -0
  269. package/dist/core/sandbox/env.js +46 -0
  270. package/dist/core/sandbox/env.js.map +1 -0
  271. package/dist/core/sandbox/path-resolver.d.ts +4 -0
  272. package/dist/core/sandbox/path-resolver.d.ts.map +1 -0
  273. package/dist/core/sandbox/path-resolver.js +44 -0
  274. package/dist/core/sandbox/path-resolver.js.map +1 -0
  275. package/dist/core/sandbox/policy.d.ts +87 -0
  276. package/dist/core/sandbox/policy.d.ts.map +1 -0
  277. package/dist/core/sandbox/policy.js +280 -0
  278. package/dist/core/sandbox/policy.js.map +1 -0
  279. package/dist/core/sandbox/spawn.d.ts +20 -0
  280. package/dist/core/sandbox/spawn.d.ts.map +1 -0
  281. package/dist/core/sandbox/spawn.js +80 -0
  282. package/dist/core/sandbox/spawn.js.map +1 -0
  283. package/dist/core/sdk.d.ts +83 -4
  284. package/dist/core/sdk.d.ts.map +1 -1
  285. package/dist/core/sdk.js +143 -55
  286. package/dist/core/sdk.js.map +1 -1
  287. package/dist/core/semantic-cache-policy.d.ts +45 -0
  288. package/dist/core/semantic-cache-policy.d.ts.map +1 -0
  289. package/dist/core/semantic-cache-policy.js +220 -0
  290. package/dist/core/semantic-cache-policy.js.map +1 -0
  291. package/dist/core/session-digest.d.ts +57 -0
  292. package/dist/core/session-digest.d.ts.map +1 -0
  293. package/dist/core/session-digest.js +193 -0
  294. package/dist/core/session-digest.js.map +1 -0
  295. package/dist/core/session-manager.d.ts +2 -2
  296. package/dist/core/session-manager.d.ts.map +1 -1
  297. package/dist/core/session-manager.js +5 -4
  298. package/dist/core/session-manager.js.map +1 -1
  299. package/dist/core/settings-manager.d.ts +14 -0
  300. package/dist/core/settings-manager.d.ts.map +1 -1
  301. package/dist/core/settings-manager.js +43 -2
  302. package/dist/core/settings-manager.js.map +1 -1
  303. package/dist/core/system-prompt.d.ts.map +1 -1
  304. package/dist/core/system-prompt.js +25 -7
  305. package/dist/core/system-prompt.js.map +1 -1
  306. package/dist/core/telemetry.d.ts.map +1 -1
  307. package/dist/core/telemetry.js +1 -1
  308. package/dist/core/telemetry.js.map +1 -1
  309. package/dist/core/timings.d.ts +1 -1
  310. package/dist/core/timings.d.ts.map +1 -1
  311. package/dist/core/timings.js +2 -2
  312. package/dist/core/timings.js.map +1 -1
  313. package/dist/core/tools/bash.d.ts +28 -3
  314. package/dist/core/tools/bash.d.ts.map +1 -1
  315. package/dist/core/tools/bash.js +53 -10
  316. package/dist/core/tools/bash.js.map +1 -1
  317. package/dist/core/tools/edit.d.ts +12 -0
  318. package/dist/core/tools/edit.d.ts.map +1 -1
  319. package/dist/core/tools/edit.js +24 -0
  320. package/dist/core/tools/edit.js.map +1 -1
  321. package/dist/core/tools/find.d.ts +3 -0
  322. package/dist/core/tools/find.d.ts.map +1 -1
  323. package/dist/core/tools/find.js +3 -0
  324. package/dist/core/tools/find.js.map +1 -1
  325. package/dist/core/tools/grep.d.ts +3 -0
  326. package/dist/core/tools/grep.d.ts.map +1 -1
  327. package/dist/core/tools/grep.js +4 -1
  328. package/dist/core/tools/grep.js.map +1 -1
  329. package/dist/core/tools/index.d.ts +1 -1
  330. package/dist/core/tools/index.d.ts.map +1 -1
  331. package/dist/core/tools/index.js.map +1 -1
  332. package/dist/core/tools/ls.d.ts +3 -0
  333. package/dist/core/tools/ls.d.ts.map +1 -1
  334. package/dist/core/tools/ls.js +3 -0
  335. package/dist/core/tools/ls.js.map +1 -1
  336. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  337. package/dist/core/tools/output-accumulator.js +1 -1
  338. package/dist/core/tools/output-accumulator.js.map +1 -1
  339. package/dist/core/tools/read.d.ts +13 -0
  340. package/dist/core/tools/read.d.ts.map +1 -1
  341. package/dist/core/tools/read.js +29 -2
  342. package/dist/core/tools/read.js.map +1 -1
  343. package/dist/core/tools/write.d.ts +3 -0
  344. package/dist/core/tools/write.d.ts.map +1 -1
  345. package/dist/core/tools/write.js +3 -0
  346. package/dist/core/tools/write.js.map +1 -1
  347. package/dist/index.d.ts +19 -4
  348. package/dist/index.d.ts.map +1 -1
  349. package/dist/index.js +17 -2
  350. package/dist/index.js.map +1 -1
  351. package/dist/main.d.ts.map +1 -1
  352. package/dist/main.js +4 -6
  353. package/dist/main.js.map +1 -1
  354. package/dist/migrations.d.ts.map +1 -1
  355. package/dist/migrations.js +1 -1
  356. package/dist/migrations.js.map +1 -1
  357. package/dist/modes/interactive/components/control-panel-gradient-motion.d.ts +28 -0
  358. package/dist/modes/interactive/components/control-panel-gradient-motion.d.ts.map +1 -0
  359. package/dist/modes/interactive/components/control-panel-gradient-motion.js +146 -0
  360. package/dist/modes/interactive/components/control-panel-gradient-motion.js.map +1 -0
  361. package/dist/modes/interactive/components/control-panel-gradient.d.ts +27 -0
  362. package/dist/modes/interactive/components/control-panel-gradient.d.ts.map +1 -0
  363. package/dist/modes/interactive/components/control-panel-gradient.js +127 -0
  364. package/dist/modes/interactive/components/control-panel-gradient.js.map +1 -0
  365. package/dist/modes/interactive/components/control-panel.d.ts +28 -1
  366. package/dist/modes/interactive/components/control-panel.d.ts.map +1 -1
  367. package/dist/modes/interactive/components/control-panel.js +153 -3
  368. package/dist/modes/interactive/components/control-panel.js.map +1 -1
  369. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -1
  370. package/dist/modes/interactive/components/earendil-announcement.js +1 -1
  371. package/dist/modes/interactive/components/earendil-announcement.js.map +1 -1
  372. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  373. package/dist/modes/interactive/components/extension-editor.js +1 -1
  374. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  375. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  376. package/dist/modes/interactive/components/footer.js +8 -0
  377. package/dist/modes/interactive/components/footer.js.map +1 -1
  378. package/dist/modes/interactive/components/mcp-selector.d.ts +2 -0
  379. package/dist/modes/interactive/components/mcp-selector.d.ts.map +1 -1
  380. package/dist/modes/interactive/components/mcp-selector.js +18 -1
  381. package/dist/modes/interactive/components/mcp-selector.js.map +1 -1
  382. package/dist/modes/interactive/components/model-selector-state.d.ts +101 -0
  383. package/dist/modes/interactive/components/model-selector-state.d.ts.map +1 -0
  384. package/dist/modes/interactive/components/model-selector-state.js +261 -0
  385. package/dist/modes/interactive/components/model-selector-state.js.map +1 -0
  386. package/dist/modes/interactive/components/model-selector.d.ts +44 -10
  387. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  388. package/dist/modes/interactive/components/model-selector.js +163 -110
  389. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  390. package/dist/modes/interactive/components/theme-selector.d.ts +1 -0
  391. package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
  392. package/dist/modes/interactive/components/theme-selector.js +10 -1
  393. package/dist/modes/interactive/components/theme-selector.js.map +1 -1
  394. package/dist/modes/interactive/interactive-mode.d.ts +4 -2
  395. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  396. package/dist/modes/interactive/interactive-mode.js +61 -13
  397. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  398. package/dist/modes/interactive/theme/omk-blackboard.json +91 -0
  399. package/dist/modes/interactive/theme/omk-freedom-grid.json +91 -0
  400. package/dist/modes/interactive/theme/omk-neon-ops.json +90 -0
  401. package/dist/modes/interactive/theme/omk-slate-light.json +91 -0
  402. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  403. package/dist/modes/interactive/theme/theme.js +14 -0
  404. package/dist/modes/interactive/theme/theme.js.map +1 -1
  405. package/dist/modes/print-mode.d.ts +2 -2
  406. package/dist/modes/print-mode.d.ts.map +1 -1
  407. package/dist/modes/print-mode.js +2 -2
  408. package/dist/modes/print-mode.js.map +1 -1
  409. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  410. package/dist/modes/rpc/rpc-mode.js +4 -0
  411. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  412. package/dist/package-manager-cli.d.ts.map +1 -1
  413. package/dist/package-manager-cli.js +114 -49
  414. package/dist/package-manager-cli.js.map +1 -1
  415. package/dist/utils/clipboard-image.d.ts.map +1 -1
  416. package/dist/utils/clipboard-image.js +1 -1
  417. package/dist/utils/clipboard-image.js.map +1 -1
  418. package/dist/utils/omk-user-agent.d.ts +2 -0
  419. package/dist/utils/omk-user-agent.d.ts.map +1 -0
  420. package/dist/utils/{pi-user-agent.js → omk-user-agent.js} +2 -2
  421. package/dist/utils/omk-user-agent.js.map +1 -0
  422. package/dist/utils/tools-manager.d.ts.map +1 -1
  423. package/dist/utils/tools-manager.js +1 -1
  424. package/dist/utils/tools-manager.js.map +1 -1
  425. package/dist/utils/version-check.d.ts +5 -5
  426. package/dist/utils/version-check.d.ts.map +1 -1
  427. package/dist/utils/version-check.js +8 -11
  428. package/dist/utils/version-check.js.map +1 -1
  429. package/dist/utils/windows-self-update.d.ts.map +1 -1
  430. package/dist/utils/windows-self-update.js +1 -1
  431. package/dist/utils/windows-self-update.js.map +1 -1
  432. package/docs/packages.md +47 -6
  433. package/docs/prompt-templates.md +2 -0
  434. package/docs/usage.md +16 -6
  435. package/examples/README.md +1 -1
  436. package/examples/extensions/README.md +11 -11
  437. package/examples/extensions/auto-commit-on-exit.ts +6 -6
  438. package/examples/extensions/bash-spawn-hook.ts +4 -4
  439. package/examples/extensions/bookmark.ts +5 -5
  440. package/examples/extensions/border-status-editor.ts +7 -7
  441. package/examples/extensions/built-in-tool-renderer.ts +6 -6
  442. package/examples/extensions/claude-rules.ts +4 -4
  443. package/examples/extensions/commands.ts +5 -5
  444. package/examples/extensions/confirm-destructive.ts +3 -3
  445. package/examples/extensions/custom-compaction.ts +3 -3
  446. package/examples/extensions/custom-footer.ts +2 -2
  447. package/examples/extensions/custom-header.ts +5 -5
  448. package/examples/extensions/custom-provider-anthropic/index.ts +4 -4
  449. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  450. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  451. package/examples/extensions/custom-provider-gitlab-duo/index.ts +3 -3
  452. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  453. package/examples/extensions/dirty-repo-guard.ts +7 -7
  454. package/examples/extensions/doom-overlay/README.md +3 -3
  455. package/examples/extensions/doom-overlay/doom/build.sh +2 -2
  456. package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +1 -1
  457. package/examples/extensions/doom-overlay/index.ts +3 -3
  458. package/examples/extensions/dynamic-resources/dynamic.json +1 -1
  459. package/examples/extensions/dynamic-resources/index.ts +2 -2
  460. package/examples/extensions/dynamic-tools.ts +4 -4
  461. package/examples/extensions/event-bus.ts +8 -8
  462. package/examples/extensions/file-trigger.ts +3 -3
  463. package/examples/extensions/git-checkpoint.ts +7 -7
  464. package/examples/extensions/git-merge-and-resolve.ts +14 -14
  465. package/examples/extensions/github-issue-autocomplete.ts +6 -6
  466. package/examples/extensions/gondolin/index.ts +16 -16
  467. package/examples/extensions/gondolin/package-lock.json +2 -2
  468. package/examples/extensions/gondolin/package.json +1 -1
  469. package/examples/extensions/handoff.ts +2 -2
  470. package/examples/extensions/hello.ts +2 -2
  471. package/examples/extensions/hidden-thinking-label.ts +4 -4
  472. package/examples/extensions/inline-bash.ts +5 -5
  473. package/examples/extensions/input-transform-streaming.ts +5 -5
  474. package/examples/extensions/input-transform.ts +5 -5
  475. package/examples/extensions/interactive-shell.ts +3 -3
  476. package/examples/extensions/mac-system-theme.ts +5 -5
  477. package/examples/extensions/message-renderer.ts +4 -4
  478. package/examples/extensions/minimal-mode.ts +9 -9
  479. package/examples/extensions/modal-editor.ts +3 -3
  480. package/examples/extensions/model-status.ts +3 -3
  481. package/examples/extensions/notify.ts +5 -5
  482. package/examples/extensions/overlay-qa-tests.ts +20 -20
  483. package/examples/extensions/overlay-test.ts +3 -3
  484. package/examples/extensions/permission-gate.ts +2 -2
  485. package/examples/extensions/pirate.ts +4 -4
  486. package/examples/extensions/plan-mode/index.ts +22 -22
  487. package/examples/extensions/preset.ts +30 -30
  488. package/examples/extensions/prompt-customizer.ts +3 -3
  489. package/examples/extensions/protected-paths.ts +2 -2
  490. package/examples/extensions/provider-payload.ts +5 -5
  491. package/examples/extensions/qna.ts +2 -2
  492. package/examples/extensions/question.ts +2 -2
  493. package/examples/extensions/questionnaire.ts +2 -2
  494. package/examples/extensions/rainbow-editor.ts +3 -3
  495. package/examples/extensions/reload-runtime.ts +4 -4
  496. package/examples/extensions/rpc-demo.ts +10 -10
  497. package/examples/extensions/sandbox/index.ts +17 -17
  498. package/examples/extensions/sandbox/package-lock.json +2 -2
  499. package/examples/extensions/sandbox/package.json +1 -1
  500. package/examples/extensions/send-user-message.ts +13 -13
  501. package/examples/extensions/session-name.ts +4 -4
  502. package/examples/extensions/shutdown-command.ts +10 -10
  503. package/examples/extensions/snake.ts +3 -3
  504. package/examples/extensions/space-invaders.ts +3 -3
  505. package/examples/extensions/ssh.ts +12 -12
  506. package/examples/extensions/status-line.ts +4 -4
  507. package/examples/extensions/structured-output.ts +2 -2
  508. package/examples/extensions/subagent/README.md +13 -13
  509. package/examples/extensions/subagent/agents.ts +2 -2
  510. package/examples/extensions/subagent/index.ts +53 -21
  511. package/examples/extensions/summarize.ts +2 -2
  512. package/examples/extensions/system-prompt-header.ts +3 -3
  513. package/examples/extensions/tic-tac-toe.ts +15 -15
  514. package/examples/extensions/timed-confirm.ts +4 -4
  515. package/examples/extensions/titlebar-spinner.ts +9 -9
  516. package/examples/extensions/todo.ts +5 -5
  517. package/examples/extensions/tool-override.ts +5 -5
  518. package/examples/extensions/tools.ts +10 -10
  519. package/examples/extensions/trigger-compact.ts +3 -3
  520. package/examples/extensions/truncated-tool.ts +3 -3
  521. package/examples/extensions/widget-placement.ts +2 -2
  522. package/examples/extensions/with-deps/index.ts +2 -2
  523. package/examples/extensions/with-deps/package-lock.json +2 -2
  524. package/examples/extensions/with-deps/package.json +1 -1
  525. package/examples/extensions/working-indicator.ts +7 -7
  526. package/examples/extensions/working-message-test.ts +3 -3
  527. package/examples/sdk/01-minimal.ts +1 -1
  528. package/examples/sdk/03-custom-prompt.ts +1 -1
  529. package/examples/sdk/04-skills.ts +1 -1
  530. package/examples/sdk/05-tools.ts +1 -1
  531. package/examples/sdk/06-extensions.ts +11 -11
  532. package/examples/sdk/07-context-files.ts +2 -0
  533. package/examples/sdk/08-prompt-templates.ts +1 -1
  534. package/examples/sdk/09-api-keys-and-oauth.ts +2 -2
  535. package/examples/sdk/README.md +2 -2
  536. package/node_modules/@earendil-works/omk-agent-core/README.md +488 -0
  537. package/node_modules/@earendil-works/omk-agent-core/dist/agent-loop.d.ts +24 -0
  538. package/node_modules/@earendil-works/omk-agent-core/dist/agent-loop.d.ts.map +1 -0
  539. package/node_modules/@earendil-works/omk-agent-core/dist/agent-loop.js +553 -0
  540. package/node_modules/@earendil-works/omk-agent-core/dist/agent-loop.js.map +1 -0
  541. package/node_modules/@earendil-works/omk-agent-core/dist/agent.d.ts +118 -0
  542. package/node_modules/@earendil-works/omk-agent-core/dist/agent.d.ts.map +1 -0
  543. package/node_modules/@earendil-works/omk-agent-core/dist/agent.js +402 -0
  544. package/node_modules/@earendil-works/omk-agent-core/dist/agent.js.map +1 -0
  545. package/node_modules/@earendil-works/omk-agent-core/dist/harness/agent-harness.d.ts +95 -0
  546. package/node_modules/@earendil-works/omk-agent-core/dist/harness/agent-harness.d.ts.map +1 -0
  547. package/node_modules/@earendil-works/omk-agent-core/dist/harness/agent-harness.js +996 -0
  548. package/node_modules/@earendil-works/omk-agent-core/dist/harness/agent-harness.js.map +1 -0
  549. package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/branch-summarization.d.ts +53 -0
  550. package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/branch-summarization.d.ts.map +1 -0
  551. package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/branch-summarization.js +175 -0
  552. package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/branch-summarization.js.map +1 -0
  553. package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/compaction.d.ts +117 -0
  554. package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/compaction.d.ts.map +1 -0
  555. package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/compaction.js +568 -0
  556. package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/compaction.js.map +1 -0
  557. package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/utils.d.ts +25 -0
  558. package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/utils.d.ts.map +1 -0
  559. package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/utils.js +131 -0
  560. package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/utils.js.map +1 -0
  561. package/node_modules/@earendil-works/omk-agent-core/dist/harness/env/nodejs.d.ts +51 -0
  562. package/node_modules/@earendil-works/omk-agent-core/dist/harness/env/nodejs.d.ts.map +1 -0
  563. package/node_modules/@earendil-works/omk-agent-core/dist/harness/env/nodejs.js +510 -0
  564. package/node_modules/@earendil-works/omk-agent-core/dist/harness/env/nodejs.js.map +1 -0
  565. package/node_modules/@earendil-works/omk-agent-core/dist/harness/messages.d.ts +51 -0
  566. package/node_modules/@earendil-works/omk-agent-core/dist/harness/messages.d.ts.map +1 -0
  567. package/node_modules/@earendil-works/omk-agent-core/dist/harness/messages.js +102 -0
  568. package/node_modules/@earendil-works/omk-agent-core/dist/harness/messages.js.map +1 -0
  569. package/node_modules/@earendil-works/omk-agent-core/dist/harness/prompt-templates.d.ts +48 -0
  570. package/node_modules/@earendil-works/omk-agent-core/dist/harness/prompt-templates.d.ts.map +1 -0
  571. package/node_modules/@earendil-works/omk-agent-core/dist/harness/prompt-templates.js +230 -0
  572. package/node_modules/@earendil-works/omk-agent-core/dist/harness/prompt-templates.js.map +1 -0
  573. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-repo.d.ts +26 -0
  574. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-repo.d.ts.map +1 -0
  575. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-repo.js +101 -0
  576. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-repo.js.map +1 -0
  577. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-storage.d.ts +36 -0
  578. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-storage.d.ts.map +1 -0
  579. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-storage.js +273 -0
  580. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-storage.js.map +1 -0
  581. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-repo.d.ts +18 -0
  582. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-repo.d.ts.map +1 -0
  583. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-repo.js +42 -0
  584. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-repo.js.map +1 -0
  585. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-storage.d.ts +25 -0
  586. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-storage.d.ts.map +1 -0
  587. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-storage.js +114 -0
  588. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-storage.js.map +1 -0
  589. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/repo-utils.d.ts +11 -0
  590. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/repo-utils.d.ts.map +1 -0
  591. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/repo-utils.js +39 -0
  592. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/repo-utils.js.map +1 -0
  593. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/session.d.ts +33 -0
  594. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/session.d.ts.map +1 -0
  595. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/session.js +210 -0
  596. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/session.js.map +1 -0
  597. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/uuid.d.ts +2 -0
  598. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/uuid.d.ts.map +1 -0
  599. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/uuid.js +50 -0
  600. package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/uuid.js.map +1 -0
  601. package/node_modules/@earendil-works/omk-agent-core/dist/harness/skills.d.ts +44 -0
  602. package/node_modules/@earendil-works/omk-agent-core/dist/harness/skills.d.ts.map +1 -0
  603. package/node_modules/@earendil-works/omk-agent-core/dist/harness/skills.js +311 -0
  604. package/node_modules/@earendil-works/omk-agent-core/dist/harness/skills.js.map +1 -0
  605. package/node_modules/@earendil-works/omk-agent-core/dist/harness/system-prompt.d.ts +3 -0
  606. package/node_modules/@earendil-works/omk-agent-core/dist/harness/system-prompt.d.ts.map +1 -0
  607. package/node_modules/@earendil-works/omk-agent-core/dist/harness/system-prompt.js +30 -0
  608. package/node_modules/@earendil-works/omk-agent-core/dist/harness/system-prompt.js.map +1 -0
  609. package/node_modules/@earendil-works/omk-agent-core/dist/harness/types.d.ts +616 -0
  610. package/node_modules/@earendil-works/omk-agent-core/dist/harness/types.d.ts.map +1 -0
  611. package/node_modules/@earendil-works/omk-agent-core/dist/harness/types.js +94 -0
  612. package/node_modules/@earendil-works/omk-agent-core/dist/harness/types.js.map +1 -0
  613. package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/shell-output.d.ts +14 -0
  614. package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/shell-output.d.ts.map +1 -0
  615. package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/shell-output.js +126 -0
  616. package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/shell-output.js.map +1 -0
  617. package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/truncate.d.ts +70 -0
  618. package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/truncate.d.ts.map +1 -0
  619. package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/truncate.js +297 -0
  620. package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/truncate.js.map +1 -0
  621. package/node_modules/@earendil-works/omk-agent-core/dist/index.d.ts +20 -0
  622. package/node_modules/@earendil-works/omk-agent-core/dist/index.d.ts.map +1 -0
  623. package/node_modules/@earendil-works/omk-agent-core/dist/index.js +25 -0
  624. package/node_modules/@earendil-works/omk-agent-core/dist/index.js.map +1 -0
  625. package/node_modules/@earendil-works/omk-agent-core/dist/node.d.ts +3 -0
  626. package/node_modules/@earendil-works/omk-agent-core/dist/node.d.ts.map +1 -0
  627. package/node_modules/@earendil-works/omk-agent-core/dist/node.js +3 -0
  628. package/node_modules/@earendil-works/omk-agent-core/dist/node.js.map +1 -0
  629. package/node_modules/@earendil-works/omk-agent-core/dist/proxy.d.ts +69 -0
  630. package/node_modules/@earendil-works/omk-agent-core/dist/proxy.d.ts.map +1 -0
  631. package/node_modules/@earendil-works/omk-agent-core/dist/proxy.js +278 -0
  632. package/node_modules/@earendil-works/omk-agent-core/dist/proxy.js.map +1 -0
  633. package/node_modules/@earendil-works/omk-agent-core/dist/types.d.ts +393 -0
  634. package/node_modules/@earendil-works/omk-agent-core/dist/types.d.ts.map +1 -0
  635. package/node_modules/@earendil-works/omk-agent-core/dist/types.js +2 -0
  636. package/node_modules/@earendil-works/omk-agent-core/dist/types.js.map +1 -0
  637. package/node_modules/@earendil-works/omk-agent-core/package.json +60 -0
  638. package/node_modules/@earendil-works/omk-ai/README.md +1389 -0
  639. package/node_modules/@earendil-works/omk-ai/dist/api-registry.d.ts +20 -0
  640. package/node_modules/@earendil-works/omk-ai/dist/api-registry.d.ts.map +1 -0
  641. package/node_modules/@earendil-works/omk-ai/dist/api-registry.js +44 -0
  642. package/node_modules/@earendil-works/omk-ai/dist/api-registry.js.map +1 -0
  643. package/node_modules/@earendil-works/omk-ai/dist/bedrock-provider.d.ts +5 -0
  644. package/node_modules/@earendil-works/omk-ai/dist/bedrock-provider.d.ts.map +1 -0
  645. package/node_modules/@earendil-works/omk-ai/dist/bedrock-provider.js +6 -0
  646. package/node_modules/@earendil-works/omk-ai/dist/bedrock-provider.js.map +1 -0
  647. package/node_modules/@earendil-works/omk-ai/dist/cli.d.ts +3 -0
  648. package/node_modules/@earendil-works/omk-ai/dist/cli.d.ts.map +1 -0
  649. package/node_modules/@earendil-works/omk-ai/dist/cli.js +130 -0
  650. package/node_modules/@earendil-works/omk-ai/dist/cli.js.map +1 -0
  651. package/node_modules/@earendil-works/omk-ai/dist/env-api-keys.d.ts +20 -0
  652. package/node_modules/@earendil-works/omk-ai/dist/env-api-keys.d.ts.map +1 -0
  653. package/node_modules/@earendil-works/omk-ai/dist/env-api-keys.js +199 -0
  654. package/node_modules/@earendil-works/omk-ai/dist/env-api-keys.js.map +1 -0
  655. package/node_modules/@earendil-works/omk-ai/dist/image-models.d.ts +10 -0
  656. package/node_modules/@earendil-works/omk-ai/dist/image-models.d.ts.map +1 -0
  657. package/node_modules/@earendil-works/omk-ai/dist/image-models.generated.d.ts +515 -0
  658. package/node_modules/@earendil-works/omk-ai/dist/image-models.generated.d.ts.map +1 -0
  659. package/node_modules/@earendil-works/omk-ai/dist/image-models.generated.js +517 -0
  660. package/node_modules/@earendil-works/omk-ai/dist/image-models.generated.js.map +1 -0
  661. package/node_modules/@earendil-works/omk-ai/dist/image-models.js +23 -0
  662. package/node_modules/@earendil-works/omk-ai/dist/image-models.js.map +1 -0
  663. package/node_modules/@earendil-works/omk-ai/dist/images-api-registry.d.ts +14 -0
  664. package/node_modules/@earendil-works/omk-ai/dist/images-api-registry.d.ts.map +1 -0
  665. package/node_modules/@earendil-works/omk-ai/dist/images-api-registry.js +22 -0
  666. package/node_modules/@earendil-works/omk-ai/dist/images-api-registry.js.map +1 -0
  667. package/node_modules/@earendil-works/omk-ai/dist/images.d.ts +4 -0
  668. package/node_modules/@earendil-works/omk-ai/dist/images.d.ts.map +1 -0
  669. package/node_modules/@earendil-works/omk-ai/dist/images.js +16 -0
  670. package/node_modules/@earendil-works/omk-ai/dist/images.js.map +1 -0
  671. package/node_modules/@earendil-works/omk-ai/dist/index.d.ts +33 -0
  672. package/node_modules/@earendil-works/omk-ai/dist/index.d.ts.map +1 -0
  673. package/node_modules/@earendil-works/omk-ai/dist/index.js +21 -0
  674. package/node_modules/@earendil-works/omk-ai/dist/index.js.map +1 -0
  675. package/node_modules/@earendil-works/omk-ai/dist/models.d.ts +18 -0
  676. package/node_modules/@earendil-works/omk-ai/dist/models.d.ts.map +1 -0
  677. package/node_modules/@earendil-works/omk-ai/dist/models.generated.d.ts +18762 -0
  678. package/node_modules/@earendil-works/omk-ai/dist/models.generated.d.ts.map +1 -0
  679. package/node_modules/@earendil-works/omk-ai/dist/models.generated.js +17197 -0
  680. package/node_modules/@earendil-works/omk-ai/dist/models.generated.js.map +1 -0
  681. package/node_modules/@earendil-works/omk-ai/dist/models.js +78 -0
  682. package/node_modules/@earendil-works/omk-ai/dist/models.js.map +1 -0
  683. package/node_modules/@earendil-works/omk-ai/dist/oauth.d.ts +2 -0
  684. package/node_modules/@earendil-works/omk-ai/dist/oauth.d.ts.map +1 -0
  685. package/node_modules/@earendil-works/omk-ai/dist/oauth.js +2 -0
  686. package/node_modules/@earendil-works/omk-ai/dist/oauth.js.map +1 -0
  687. package/node_modules/@earendil-works/omk-ai/dist/provider-network.d.ts +39 -0
  688. package/node_modules/@earendil-works/omk-ai/dist/provider-network.d.ts.map +1 -0
  689. package/node_modules/@earendil-works/omk-ai/dist/provider-network.js +170 -0
  690. package/node_modules/@earendil-works/omk-ai/dist/provider-network.js.map +1 -0
  691. package/node_modules/@earendil-works/omk-ai/dist/providers/amazon-bedrock.d.ts +38 -0
  692. package/node_modules/@earendil-works/omk-ai/dist/providers/amazon-bedrock.d.ts.map +1 -0
  693. package/node_modules/@earendil-works/omk-ai/dist/providers/amazon-bedrock.js +826 -0
  694. package/node_modules/@earendil-works/omk-ai/dist/providers/amazon-bedrock.js.map +1 -0
  695. package/node_modules/@earendil-works/omk-ai/dist/providers/anthropic.d.ts +77 -0
  696. package/node_modules/@earendil-works/omk-ai/dist/providers/anthropic.d.ts.map +1 -0
  697. package/node_modules/@earendil-works/omk-ai/dist/providers/anthropic.js +1123 -0
  698. package/node_modules/@earendil-works/omk-ai/dist/providers/anthropic.js.map +1 -0
  699. package/node_modules/@earendil-works/omk-ai/dist/providers/azure-openai-responses.d.ts +15 -0
  700. package/node_modules/@earendil-works/omk-ai/dist/providers/azure-openai-responses.d.ts.map +1 -0
  701. package/node_modules/@earendil-works/omk-ai/dist/providers/azure-openai-responses.js +221 -0
  702. package/node_modules/@earendil-works/omk-ai/dist/providers/azure-openai-responses.js.map +1 -0
  703. package/node_modules/@earendil-works/omk-ai/dist/providers/cloudflare.d.ts +13 -0
  704. package/node_modules/@earendil-works/omk-ai/dist/providers/cloudflare.d.ts.map +1 -0
  705. package/node_modules/@earendil-works/omk-ai/dist/providers/cloudflare.js +26 -0
  706. package/node_modules/@earendil-works/omk-ai/dist/providers/cloudflare.js.map +1 -0
  707. package/node_modules/@earendil-works/omk-ai/dist/providers/faux.d.ts +56 -0
  708. package/node_modules/@earendil-works/omk-ai/dist/providers/faux.d.ts.map +1 -0
  709. package/node_modules/@earendil-works/omk-ai/dist/providers/faux.js +368 -0
  710. package/node_modules/@earendil-works/omk-ai/dist/providers/faux.js.map +1 -0
  711. package/node_modules/@earendil-works/omk-ai/dist/providers/github-copilot-headers.d.ts +8 -0
  712. package/node_modules/@earendil-works/omk-ai/dist/providers/github-copilot-headers.d.ts.map +1 -0
  713. package/node_modules/@earendil-works/omk-ai/dist/providers/github-copilot-headers.js +29 -0
  714. package/node_modules/@earendil-works/omk-ai/dist/providers/github-copilot-headers.js.map +1 -0
  715. package/node_modules/@earendil-works/omk-ai/dist/providers/google-shared.d.ts +70 -0
  716. package/node_modules/@earendil-works/omk-ai/dist/providers/google-shared.d.ts.map +1 -0
  717. package/node_modules/@earendil-works/omk-ai/dist/providers/google-shared.js +331 -0
  718. package/node_modules/@earendil-works/omk-ai/dist/providers/google-shared.js.map +1 -0
  719. package/node_modules/@earendil-works/omk-ai/dist/providers/google-vertex.d.ts +15 -0
  720. package/node_modules/@earendil-works/omk-ai/dist/providers/google-vertex.d.ts.map +1 -0
  721. package/node_modules/@earendil-works/omk-ai/dist/providers/google-vertex.js +442 -0
  722. package/node_modules/@earendil-works/omk-ai/dist/providers/google-vertex.js.map +1 -0
  723. package/node_modules/@earendil-works/omk-ai/dist/providers/google.d.ts +13 -0
  724. package/node_modules/@earendil-works/omk-ai/dist/providers/google.d.ts.map +1 -0
  725. package/node_modules/@earendil-works/omk-ai/dist/providers/google.js +402 -0
  726. package/node_modules/@earendil-works/omk-ai/dist/providers/google.js.map +1 -0
  727. package/node_modules/@earendil-works/omk-ai/dist/providers/images/openrouter.d.ts +3 -0
  728. package/node_modules/@earendil-works/omk-ai/dist/providers/images/openrouter.d.ts.map +1 -0
  729. package/node_modules/@earendil-works/omk-ai/dist/providers/images/openrouter.js +128 -0
  730. package/node_modules/@earendil-works/omk-ai/dist/providers/images/openrouter.js.map +1 -0
  731. package/node_modules/@earendil-works/omk-ai/dist/providers/images/register-builtins.d.ts +4 -0
  732. package/node_modules/@earendil-works/omk-ai/dist/providers/images/register-builtins.d.ts.map +1 -0
  733. package/node_modules/@earendil-works/omk-ai/dist/providers/images/register-builtins.js +34 -0
  734. package/node_modules/@earendil-works/omk-ai/dist/providers/images/register-builtins.js.map +1 -0
  735. package/node_modules/@earendil-works/omk-ai/dist/providers/mistral.d.ts +25 -0
  736. package/node_modules/@earendil-works/omk-ai/dist/providers/mistral.d.ts.map +1 -0
  737. package/node_modules/@earendil-works/omk-ai/dist/providers/mistral.js +534 -0
  738. package/node_modules/@earendil-works/omk-ai/dist/providers/mistral.js.map +1 -0
  739. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-codex-responses.d.ts +30 -0
  740. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-codex-responses.d.ts.map +1 -0
  741. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-codex-responses.js +1171 -0
  742. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-codex-responses.js.map +1 -0
  743. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-completions.d.ts +19 -0
  744. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-completions.d.ts.map +1 -0
  745. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-completions.js +977 -0
  746. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-completions.js.map +1 -0
  747. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-prompt-cache.d.ts +11 -0
  748. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-prompt-cache.d.ts.map +1 -0
  749. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-prompt-cache.js +22 -0
  750. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-prompt-cache.js.map +1 -0
  751. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses-shared.d.ts +18 -0
  752. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses-shared.d.ts.map +1 -0
  753. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses-shared.js +496 -0
  754. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses-shared.js.map +1 -0
  755. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses.d.ts +13 -0
  756. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses.d.ts.map +1 -0
  757. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses.js +233 -0
  758. package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses.js.map +1 -0
  759. package/node_modules/@earendil-works/omk-ai/dist/providers/register-builtins.d.ts +35 -0
  760. package/node_modules/@earendil-works/omk-ai/dist/providers/register-builtins.d.ts.map +1 -0
  761. package/node_modules/@earendil-works/omk-ai/dist/providers/register-builtins.js +254 -0
  762. package/node_modules/@earendil-works/omk-ai/dist/providers/register-builtins.js.map +1 -0
  763. package/node_modules/@earendil-works/omk-ai/dist/providers/simple-options.d.ts +8 -0
  764. package/node_modules/@earendil-works/omk-ai/dist/providers/simple-options.d.ts.map +1 -0
  765. package/node_modules/@earendil-works/omk-ai/dist/providers/simple-options.js +42 -0
  766. package/node_modules/@earendil-works/omk-ai/dist/providers/simple-options.js.map +1 -0
  767. package/node_modules/@earendil-works/omk-ai/dist/providers/tool-schema.d.ts +13 -0
  768. package/node_modules/@earendil-works/omk-ai/dist/providers/tool-schema.d.ts.map +1 -0
  769. package/node_modules/@earendil-works/omk-ai/dist/providers/tool-schema.js +82 -0
  770. package/node_modules/@earendil-works/omk-ai/dist/providers/tool-schema.js.map +1 -0
  771. package/node_modules/@earendil-works/omk-ai/dist/providers/transform-messages.d.ts +8 -0
  772. package/node_modules/@earendil-works/omk-ai/dist/providers/transform-messages.d.ts.map +1 -0
  773. package/node_modules/@earendil-works/omk-ai/dist/providers/transform-messages.js +184 -0
  774. package/node_modules/@earendil-works/omk-ai/dist/providers/transform-messages.js.map +1 -0
  775. package/node_modules/@earendil-works/omk-ai/dist/session-resources.d.ts +4 -0
  776. package/node_modules/@earendil-works/omk-ai/dist/session-resources.d.ts.map +1 -0
  777. package/node_modules/@earendil-works/omk-ai/dist/session-resources.js +22 -0
  778. package/node_modules/@earendil-works/omk-ai/dist/session-resources.js.map +1 -0
  779. package/node_modules/@earendil-works/omk-ai/dist/stream.d.ts +8 -0
  780. package/node_modules/@earendil-works/omk-ai/dist/stream.d.ts.map +1 -0
  781. package/node_modules/@earendil-works/omk-ai/dist/stream.js +77 -0
  782. package/node_modules/@earendil-works/omk-ai/dist/stream.js.map +1 -0
  783. package/node_modules/@earendil-works/omk-ai/dist/types.d.ts +570 -0
  784. package/node_modules/@earendil-works/omk-ai/dist/types.d.ts.map +1 -0
  785. package/node_modules/@earendil-works/omk-ai/dist/types.js +2 -0
  786. package/node_modules/@earendil-works/omk-ai/dist/types.js.map +1 -0
  787. package/node_modules/@earendil-works/omk-ai/dist/utils/abort-signals.d.ts +6 -0
  788. package/node_modules/@earendil-works/omk-ai/dist/utils/abort-signals.d.ts.map +1 -0
  789. package/node_modules/@earendil-works/omk-ai/dist/utils/abort-signals.js +34 -0
  790. package/node_modules/@earendil-works/omk-ai/dist/utils/abort-signals.js.map +1 -0
  791. package/node_modules/@earendil-works/omk-ai/dist/utils/diagnostics.d.ts +19 -0
  792. package/node_modules/@earendil-works/omk-ai/dist/utils/diagnostics.d.ts.map +1 -0
  793. package/node_modules/@earendil-works/omk-ai/dist/utils/diagnostics.js +25 -0
  794. package/node_modules/@earendil-works/omk-ai/dist/utils/diagnostics.js.map +1 -0
  795. package/node_modules/@earendil-works/omk-ai/dist/utils/event-stream.d.ts +21 -0
  796. package/node_modules/@earendil-works/omk-ai/dist/utils/event-stream.d.ts.map +1 -0
  797. package/node_modules/@earendil-works/omk-ai/dist/utils/event-stream.js +81 -0
  798. package/node_modules/@earendil-works/omk-ai/dist/utils/event-stream.js.map +1 -0
  799. package/node_modules/@earendil-works/omk-ai/dist/utils/hash.d.ts +3 -0
  800. package/node_modules/@earendil-works/omk-ai/dist/utils/hash.d.ts.map +1 -0
  801. package/node_modules/@earendil-works/omk-ai/dist/utils/hash.js +14 -0
  802. package/node_modules/@earendil-works/omk-ai/dist/utils/hash.js.map +1 -0
  803. package/node_modules/@earendil-works/omk-ai/dist/utils/headers.d.ts +2 -0
  804. package/node_modules/@earendil-works/omk-ai/dist/utils/headers.d.ts.map +1 -0
  805. package/node_modules/@earendil-works/omk-ai/dist/utils/headers.js +8 -0
  806. package/node_modules/@earendil-works/omk-ai/dist/utils/headers.js.map +1 -0
  807. package/node_modules/@earendil-works/omk-ai/dist/utils/json-parse.d.ts +16 -0
  808. package/node_modules/@earendil-works/omk-ai/dist/utils/json-parse.d.ts.map +1 -0
  809. package/node_modules/@earendil-works/omk-ai/dist/utils/json-parse.js +113 -0
  810. package/node_modules/@earendil-works/omk-ai/dist/utils/json-parse.js.map +1 -0
  811. package/node_modules/@earendil-works/omk-ai/dist/utils/node-http-proxy.d.ts +10 -0
  812. package/node_modules/@earendil-works/omk-ai/dist/utils/node-http-proxy.d.ts.map +1 -0
  813. package/node_modules/@earendil-works/omk-ai/dist/utils/node-http-proxy.js +97 -0
  814. package/node_modules/@earendil-works/omk-ai/dist/utils/node-http-proxy.js.map +1 -0
  815. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/anthropic.d.ts +25 -0
  816. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/anthropic.d.ts.map +1 -0
  817. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/anthropic.js +335 -0
  818. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/anthropic.js.map +1 -0
  819. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/device-code.d.ts +21 -0
  820. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/device-code.d.ts.map +1 -0
  821. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/device-code.js +56 -0
  822. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/device-code.js.map +1 -0
  823. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/github-copilot.d.ts +30 -0
  824. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -0
  825. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/github-copilot.js +280 -0
  826. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/github-copilot.js.map +1 -0
  827. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/index.d.ts +58 -0
  828. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/index.d.ts.map +1 -0
  829. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/index.js +122 -0
  830. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/index.js.map +1 -0
  831. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/oauth-page.d.ts +3 -0
  832. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/oauth-page.d.ts.map +1 -0
  833. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/oauth-page.js +105 -0
  834. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/oauth-page.js.map +1 -0
  835. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/openai-codex.d.ts +43 -0
  836. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/openai-codex.d.ts.map +1 -0
  837. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/openai-codex.js +487 -0
  838. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/openai-codex.js.map +1 -0
  839. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/pkce.d.ts +13 -0
  840. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/pkce.d.ts.map +1 -0
  841. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/pkce.js +31 -0
  842. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/pkce.js.map +1 -0
  843. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/types.d.ts +64 -0
  844. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/types.d.ts.map +1 -0
  845. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/types.js +2 -0
  846. package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/types.js.map +1 -0
  847. package/node_modules/@earendil-works/omk-ai/dist/utils/overflow.d.ts +57 -0
  848. package/node_modules/@earendil-works/omk-ai/dist/utils/overflow.d.ts.map +1 -0
  849. package/node_modules/@earendil-works/omk-ai/dist/utils/overflow.js +154 -0
  850. package/node_modules/@earendil-works/omk-ai/dist/utils/overflow.js.map +1 -0
  851. package/node_modules/@earendil-works/omk-ai/dist/utils/sanitize-unicode.d.ts +22 -0
  852. package/node_modules/@earendil-works/omk-ai/dist/utils/sanitize-unicode.d.ts.map +1 -0
  853. package/node_modules/@earendil-works/omk-ai/dist/utils/sanitize-unicode.js +26 -0
  854. package/node_modules/@earendil-works/omk-ai/dist/utils/sanitize-unicode.js.map +1 -0
  855. package/node_modules/@earendil-works/omk-ai/dist/utils/typebox-helpers.d.ts +17 -0
  856. package/node_modules/@earendil-works/omk-ai/dist/utils/typebox-helpers.d.ts.map +1 -0
  857. package/node_modules/@earendil-works/omk-ai/dist/utils/typebox-helpers.js +21 -0
  858. package/node_modules/@earendil-works/omk-ai/dist/utils/typebox-helpers.js.map +1 -0
  859. package/node_modules/@earendil-works/omk-ai/dist/utils/validation.d.ts +18 -0
  860. package/node_modules/@earendil-works/omk-ai/dist/utils/validation.d.ts.map +1 -0
  861. package/node_modules/@earendil-works/omk-ai/dist/utils/validation.js +281 -0
  862. package/node_modules/@earendil-works/omk-ai/dist/utils/validation.js.map +1 -0
  863. package/node_modules/@earendil-works/omk-ai/package.json +106 -0
  864. package/node_modules/@earendil-works/omk-tui/README.md +791 -0
  865. package/node_modules/@earendil-works/omk-tui/dist/autocomplete.d.ts +54 -0
  866. package/node_modules/@earendil-works/omk-tui/dist/autocomplete.d.ts.map +1 -0
  867. package/node_modules/@earendil-works/omk-tui/dist/autocomplete.js +632 -0
  868. package/node_modules/@earendil-works/omk-tui/dist/autocomplete.js.map +1 -0
  869. package/node_modules/@earendil-works/omk-tui/dist/components/box.d.ts +22 -0
  870. package/node_modules/@earendil-works/omk-tui/dist/components/box.d.ts.map +1 -0
  871. package/node_modules/@earendil-works/omk-tui/dist/components/box.js +104 -0
  872. package/node_modules/@earendil-works/omk-tui/dist/components/box.js.map +1 -0
  873. package/node_modules/@earendil-works/omk-tui/dist/components/cancellable-loader.d.ts +22 -0
  874. package/node_modules/@earendil-works/omk-tui/dist/components/cancellable-loader.d.ts.map +1 -0
  875. package/node_modules/@earendil-works/omk-tui/dist/components/cancellable-loader.js +35 -0
  876. package/node_modules/@earendil-works/omk-tui/dist/components/cancellable-loader.js.map +1 -0
  877. package/node_modules/@earendil-works/omk-tui/dist/components/editor.d.ts +249 -0
  878. package/node_modules/@earendil-works/omk-tui/dist/components/editor.d.ts.map +1 -0
  879. package/node_modules/@earendil-works/omk-tui/dist/components/editor.js +1857 -0
  880. package/node_modules/@earendil-works/omk-tui/dist/components/editor.js.map +1 -0
  881. package/node_modules/@earendil-works/omk-tui/dist/components/image.d.ts +28 -0
  882. package/node_modules/@earendil-works/omk-tui/dist/components/image.d.ts.map +1 -0
  883. package/node_modules/@earendil-works/omk-tui/dist/components/image.js +89 -0
  884. package/node_modules/@earendil-works/omk-tui/dist/components/image.js.map +1 -0
  885. package/node_modules/@earendil-works/omk-tui/dist/components/input.d.ts +37 -0
  886. package/node_modules/@earendil-works/omk-tui/dist/components/input.d.ts.map +1 -0
  887. package/node_modules/@earendil-works/omk-tui/dist/components/input.js +378 -0
  888. package/node_modules/@earendil-works/omk-tui/dist/components/input.js.map +1 -0
  889. package/node_modules/@earendil-works/omk-tui/dist/components/loader.d.ts +31 -0
  890. package/node_modules/@earendil-works/omk-tui/dist/components/loader.d.ts.map +1 -0
  891. package/node_modules/@earendil-works/omk-tui/dist/components/loader.js +69 -0
  892. package/node_modules/@earendil-works/omk-tui/dist/components/loader.js.map +1 -0
  893. package/node_modules/@earendil-works/omk-tui/dist/components/markdown.d.ts +96 -0
  894. package/node_modules/@earendil-works/omk-tui/dist/components/markdown.d.ts.map +1 -0
  895. package/node_modules/@earendil-works/omk-tui/dist/components/markdown.js +644 -0
  896. package/node_modules/@earendil-works/omk-tui/dist/components/markdown.js.map +1 -0
  897. package/node_modules/@earendil-works/omk-tui/dist/components/select-list.d.ts +50 -0
  898. package/node_modules/@earendil-works/omk-tui/dist/components/select-list.d.ts.map +1 -0
  899. package/node_modules/@earendil-works/omk-tui/dist/components/select-list.js +159 -0
  900. package/node_modules/@earendil-works/omk-tui/dist/components/select-list.js.map +1 -0
  901. package/node_modules/@earendil-works/omk-tui/dist/components/settings-list.d.ts +50 -0
  902. package/node_modules/@earendil-works/omk-tui/dist/components/settings-list.d.ts.map +1 -0
  903. package/node_modules/@earendil-works/omk-tui/dist/components/settings-list.js +185 -0
  904. package/node_modules/@earendil-works/omk-tui/dist/components/settings-list.js.map +1 -0
  905. package/node_modules/@earendil-works/omk-tui/dist/components/spacer.d.ts +12 -0
  906. package/node_modules/@earendil-works/omk-tui/dist/components/spacer.d.ts.map +1 -0
  907. package/node_modules/@earendil-works/omk-tui/dist/components/spacer.js +23 -0
  908. package/node_modules/@earendil-works/omk-tui/dist/components/spacer.js.map +1 -0
  909. package/node_modules/@earendil-works/omk-tui/dist/components/text.d.ts +19 -0
  910. package/node_modules/@earendil-works/omk-tui/dist/components/text.d.ts.map +1 -0
  911. package/node_modules/@earendil-works/omk-tui/dist/components/text.js +89 -0
  912. package/node_modules/@earendil-works/omk-tui/dist/components/text.js.map +1 -0
  913. package/node_modules/@earendil-works/omk-tui/dist/components/truncated-text.d.ts +13 -0
  914. package/node_modules/@earendil-works/omk-tui/dist/components/truncated-text.d.ts.map +1 -0
  915. package/node_modules/@earendil-works/omk-tui/dist/components/truncated-text.js +51 -0
  916. package/node_modules/@earendil-works/omk-tui/dist/components/truncated-text.js.map +1 -0
  917. package/node_modules/@earendil-works/omk-tui/dist/editor-component.d.ts +39 -0
  918. package/node_modules/@earendil-works/omk-tui/dist/editor-component.d.ts.map +1 -0
  919. package/node_modules/@earendil-works/omk-tui/dist/editor-component.js +2 -0
  920. package/node_modules/@earendil-works/omk-tui/dist/editor-component.js.map +1 -0
  921. package/node_modules/@earendil-works/omk-tui/dist/fuzzy.d.ts +16 -0
  922. package/node_modules/@earendil-works/omk-tui/dist/fuzzy.d.ts.map +1 -0
  923. package/node_modules/@earendil-works/omk-tui/dist/fuzzy.js +110 -0
  924. package/node_modules/@earendil-works/omk-tui/dist/fuzzy.js.map +1 -0
  925. package/node_modules/@earendil-works/omk-tui/dist/index.d.ts +23 -0
  926. package/node_modules/@earendil-works/omk-tui/dist/index.d.ts.map +1 -0
  927. package/node_modules/@earendil-works/omk-tui/dist/index.js +32 -0
  928. package/node_modules/@earendil-works/omk-tui/dist/index.js.map +1 -0
  929. package/node_modules/@earendil-works/omk-tui/dist/keybindings.d.ts +212 -0
  930. package/node_modules/@earendil-works/omk-tui/dist/keybindings.d.ts.map +1 -0
  931. package/node_modules/@earendil-works/omk-tui/dist/keybindings.js +252 -0
  932. package/node_modules/@earendil-works/omk-tui/dist/keybindings.js.map +1 -0
  933. package/node_modules/@earendil-works/omk-tui/dist/keys.d.ts +184 -0
  934. package/node_modules/@earendil-works/omk-tui/dist/keys.d.ts.map +1 -0
  935. package/node_modules/@earendil-works/omk-tui/dist/keys.js +1173 -0
  936. package/node_modules/@earendil-works/omk-tui/dist/keys.js.map +1 -0
  937. package/node_modules/@earendil-works/omk-tui/dist/kill-ring.d.ts +28 -0
  938. package/node_modules/@earendil-works/omk-tui/dist/kill-ring.d.ts.map +1 -0
  939. package/node_modules/@earendil-works/omk-tui/dist/kill-ring.js +44 -0
  940. package/node_modules/@earendil-works/omk-tui/dist/kill-ring.js.map +1 -0
  941. package/node_modules/@earendil-works/omk-tui/dist/native-modifiers.d.ts +3 -0
  942. package/node_modules/@earendil-works/omk-tui/dist/native-modifiers.d.ts.map +1 -0
  943. package/node_modules/@earendil-works/omk-tui/dist/native-modifiers.js +53 -0
  944. package/node_modules/@earendil-works/omk-tui/dist/native-modifiers.js.map +1 -0
  945. package/node_modules/@earendil-works/omk-tui/dist/stdin-buffer.d.ts +50 -0
  946. package/node_modules/@earendil-works/omk-tui/dist/stdin-buffer.d.ts.map +1 -0
  947. package/node_modules/@earendil-works/omk-tui/dist/stdin-buffer.js +361 -0
  948. package/node_modules/@earendil-works/omk-tui/dist/stdin-buffer.js.map +1 -0
  949. package/node_modules/@earendil-works/omk-tui/dist/terminal-image.d.ts +90 -0
  950. package/node_modules/@earendil-works/omk-tui/dist/terminal-image.d.ts.map +1 -0
  951. package/node_modules/@earendil-works/omk-tui/dist/terminal-image.js +366 -0
  952. package/node_modules/@earendil-works/omk-tui/dist/terminal-image.js.map +1 -0
  953. package/node_modules/@earendil-works/omk-tui/dist/terminal.d.ts +113 -0
  954. package/node_modules/@earendil-works/omk-tui/dist/terminal.d.ts.map +1 -0
  955. package/node_modules/@earendil-works/omk-tui/dist/terminal.js +472 -0
  956. package/node_modules/@earendil-works/omk-tui/dist/terminal.js.map +1 -0
  957. package/node_modules/@earendil-works/omk-tui/dist/tui.d.ts +242 -0
  958. package/node_modules/@earendil-works/omk-tui/dist/tui.d.ts.map +1 -0
  959. package/node_modules/@earendil-works/omk-tui/dist/tui.js +1221 -0
  960. package/node_modules/@earendil-works/omk-tui/dist/tui.js.map +1 -0
  961. package/node_modules/@earendil-works/omk-tui/dist/undo-stack.d.ts +17 -0
  962. package/node_modules/@earendil-works/omk-tui/dist/undo-stack.d.ts.map +1 -0
  963. package/node_modules/@earendil-works/omk-tui/dist/undo-stack.js +25 -0
  964. package/node_modules/@earendil-works/omk-tui/dist/undo-stack.js.map +1 -0
  965. package/node_modules/@earendil-works/omk-tui/dist/utils.d.ts +84 -0
  966. package/node_modules/@earendil-works/omk-tui/dist/utils.d.ts.map +1 -0
  967. package/node_modules/@earendil-works/omk-tui/dist/utils.js +1032 -0
  968. package/node_modules/@earendil-works/omk-tui/dist/utils.js.map +1 -0
  969. package/node_modules/@earendil-works/omk-tui/dist/word-navigation.d.ts +25 -0
  970. package/node_modules/@earendil-works/omk-tui/dist/word-navigation.d.ts.map +1 -0
  971. package/node_modules/@earendil-works/omk-tui/dist/word-navigation.js +96 -0
  972. package/node_modules/@earendil-works/omk-tui/dist/word-navigation.js.map +1 -0
  973. package/node_modules/@earendil-works/omk-tui/native/darwin/prebuilds/darwin-arm64/darwin-modifiers.node +0 -0
  974. package/node_modules/@earendil-works/omk-tui/native/darwin/prebuilds/darwin-x64/darwin-modifiers.node +0 -0
  975. package/node_modules/@earendil-works/omk-tui/native/win32/prebuilds/win32-arm64/win32-console-mode.node +0 -0
  976. package/node_modules/@earendil-works/omk-tui/native/win32/prebuilds/win32-x64/win32-console-mode.node +0 -0
  977. package/node_modules/@earendil-works/omk-tui/package.json +47 -0
  978. package/package.json +22 -6
  979. package/dist/utils/pi-user-agent.d.ts +0 -2
  980. package/dist/utils/pi-user-agent.d.ts.map +0 -1
  981. package/dist/utils/pi-user-agent.js.map +0 -1
@@ -0,0 +1,152 @@
1
+ export const CHECKPOINT_SCHEMA_VERSION = "omk.checkpoint.v1";
2
+ export function renderCheckpointMarkdown(checkpoint) {
3
+ const lines = [
4
+ `# OMK Checkpoint ${checkpoint.checkpointId}`,
5
+ `Run: ${checkpoint.runId}`,
6
+ `Timestamp: ${checkpoint.timestamp}`,
7
+ `Goal: ${checkpoint.currentGoal.summary} (${checkpoint.currentGoal.status})`,
8
+ "",
9
+ "## Constraints",
10
+ ...formatBullets(checkpoint.constraints),
11
+ "",
12
+ "## Decisions",
13
+ ...checkpoint.decisions.map((decision) => `- ${decision.id}: ${decision.summary} [hashes: ${decision.artifactHashes.join(",") || "none"}]`),
14
+ "",
15
+ "## Open Tasks",
16
+ ...checkpoint.openTasks.map((task) => `- ${task.id} p${task.priority}: ${task.summary}`),
17
+ "",
18
+ "## Blockers",
19
+ ...checkpoint.blockers.map((blocker) => `- ${blocker.id} ${blocker.severity}: ${blocker.summary}`),
20
+ "",
21
+ "## Files",
22
+ `- read: ${checkpoint.files.read.join(",") || "none"}`,
23
+ `- modified: ${checkpoint.files.modified.join(",") || "none"}`,
24
+ "",
25
+ "## Commands",
26
+ ...checkpoint.commands.map((command) => `- ${command.command} => exitCode=${command.exitCode}, outputHash=${command.outputHash}`),
27
+ "",
28
+ "## Artifacts",
29
+ ...checkpoint.artifacts.map((artifact) => `- ${artifact.kind}: ${artifact.path} sha256=${artifact.sha256}`),
30
+ "",
31
+ "## Failed Approaches",
32
+ ...checkpoint.failedApproaches.map((approach) => `- ${approach.summary}: ${approach.reason}`),
33
+ "",
34
+ `Resume: ${checkpoint.resumeAction.summary}${checkpoint.resumeAction.targetTaskId ? ` (${checkpoint.resumeAction.targetTaskId})` : ""}`,
35
+ ];
36
+ return `${lines.join("\n")}\n`;
37
+ }
38
+ export function validateCheckpoint(checkpoint, authoritative) {
39
+ const errors = [];
40
+ validateCommands(checkpoint, authoritative, errors);
41
+ validateBlockers(checkpoint, authoritative, errors);
42
+ validateFiles(checkpoint, authoritative, errors);
43
+ validateArtifacts(checkpoint, authoritative, errors);
44
+ return { valid: errors.length === 0, errors };
45
+ }
46
+ export function deriveResumePlan(checkpoint) {
47
+ const blocker = [...checkpoint.blockers].sort(compareBlockerPriority)[0];
48
+ if (blocker !== undefined) {
49
+ return { kind: "blocker", summary: blocker.summary, targetId: blocker.id };
50
+ }
51
+ const task = [...checkpoint.openTasks].sort(compareTaskPriority)[0];
52
+ if (task !== undefined) {
53
+ return { kind: "task", summary: task.summary, targetId: task.id };
54
+ }
55
+ return {
56
+ kind: "resumeAction",
57
+ summary: checkpoint.resumeAction.summary,
58
+ targetId: checkpoint.resumeAction.targetTaskId,
59
+ };
60
+ }
61
+ export function enforceCheckpointBudget(markdown, maxChars) {
62
+ if (markdown.length <= maxChars) {
63
+ return markdown;
64
+ }
65
+ const goal = findLine(markdown, "Goal:") ?? "Goal: unknown";
66
+ const resume = findLine(markdown, "Resume:") ?? "Resume: unknown";
67
+ const compact = [`# OMK Checkpoint`, goal, "Evidence hashes preserved.", resume].join("\n");
68
+ if (compact.length <= maxChars) {
69
+ return compact;
70
+ }
71
+ return compact.slice(0, Math.max(0, maxChars));
72
+ }
73
+ function validateCommands(checkpoint, authoritative, errors) {
74
+ const byCommand = new Map(authoritative.commands.map((command) => [command.command, command]));
75
+ for (const command of checkpoint.commands) {
76
+ const expected = byCommand.get(command.command);
77
+ if (expected === undefined) {
78
+ errors.push(`command missing from authoritative source: ${command.command}`);
79
+ continue;
80
+ }
81
+ if (command.exitCode !== expected.exitCode) {
82
+ errors.push(`command exitCode mismatch for ${command.command}: ${command.exitCode} != ${expected.exitCode}`);
83
+ }
84
+ if (command.outputHash !== expected.outputHash) {
85
+ errors.push(`command outputHash mismatch for ${command.command}: ${command.outputHash} != ${expected.outputHash}`);
86
+ }
87
+ }
88
+ }
89
+ function validateBlockers(checkpoint, authoritative, errors) {
90
+ const authoritativeIds = new Set(authoritative.blockerIds);
91
+ for (const blocker of checkpoint.blockers) {
92
+ if (!authoritativeIds.has(blocker.id)) {
93
+ errors.push(`blocker not present in authoritative source: ${blocker.id}`);
94
+ }
95
+ }
96
+ }
97
+ function validateFiles(checkpoint, authoritative, errors) {
98
+ const authoritativePaths = new Set(authoritative.filePaths);
99
+ for (const filePath of [...checkpoint.files.read, ...checkpoint.files.modified]) {
100
+ if (!authoritativePaths.has(filePath)) {
101
+ errors.push(`file path not present in authoritative source: ${filePath}`);
102
+ }
103
+ }
104
+ }
105
+ function validateArtifacts(checkpoint, authoritative, errors) {
106
+ const byPath = new Map(authoritative.artifacts.map((artifact) => [artifact.path, artifact]));
107
+ for (const artifact of checkpoint.artifacts) {
108
+ const expected = byPath.get(artifact.path);
109
+ if (expected === undefined) {
110
+ errors.push(`artifact missing from authoritative source: ${artifact.path}`);
111
+ continue;
112
+ }
113
+ if (artifact.sha256 !== expected.sha256) {
114
+ errors.push(`artifact sha256 mismatch for ${artifact.path}: ${artifact.sha256} != ${expected.sha256}`);
115
+ }
116
+ }
117
+ }
118
+ function formatBullets(values) {
119
+ if (values.length === 0) {
120
+ return ["- none"];
121
+ }
122
+ return values.map((value) => `- ${value}`);
123
+ }
124
+ function blockerRank(severity) {
125
+ if (severity === "high")
126
+ return 0;
127
+ if (severity === "medium")
128
+ return 1;
129
+ return 2;
130
+ }
131
+ function compareBlockerPriority(a, b) {
132
+ const rank = blockerRank(a.severity) - blockerRank(b.severity);
133
+ if (rank !== 0)
134
+ return rank;
135
+ return compareString(a.id, b.id);
136
+ }
137
+ function compareTaskPriority(a, b) {
138
+ if (a.priority !== b.priority)
139
+ return a.priority - b.priority;
140
+ return compareString(a.id, b.id);
141
+ }
142
+ function compareString(a, b) {
143
+ if (a < b)
144
+ return -1;
145
+ if (a > b)
146
+ return 1;
147
+ return 0;
148
+ }
149
+ function findLine(markdown, prefix) {
150
+ return markdown.split("\n").find((line) => line.startsWith(prefix));
151
+ }
152
+ //# sourceMappingURL=checkpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint.js","sourceRoot":"","sources":["../../../src/core/orchestration/checkpoint.ts"],"names":[],"mappings":"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","sourcesContent":["export const CHECKPOINT_SCHEMA_VERSION = \"omk.checkpoint.v1\";\n\nexport type CheckpointStatus = \"intake\" | \"running\" | \"blocked\" | \"complete\" | \"failed\";\nexport type BlockerSeverity = \"low\" | \"medium\" | \"high\";\n\nexport interface GoalState {\n\tsummary: string;\n\tstatus: CheckpointStatus;\n}\n\nexport interface DecisionRecord {\n\tid: string;\n\tsummary: string;\n\tartifactHashes: readonly string[];\n}\n\nexport interface OpenTaskRecord {\n\tid: string;\n\tsummary: string;\n\tpriority: number;\n}\n\nexport interface BlockerRecord {\n\tid: string;\n\tsummary: string;\n\tseverity: BlockerSeverity;\n}\n\nexport interface FileState {\n\tread: readonly string[];\n\tmodified: readonly string[];\n}\n\nexport interface CommandRecord {\n\tcommand: string;\n\texitCode: number;\n\toutputHash: string;\n}\n\nexport interface ArtifactRecord {\n\tpath: string;\n\tsha256: string;\n\tkind: string;\n}\n\nexport interface FailedApproachRecord {\n\tsummary: string;\n\treason: string;\n}\n\nexport interface ResumeActionRecord {\n\tsummary: string;\n\ttargetTaskId?: string;\n}\n\nexport interface Checkpoint {\n\tschemaVersion: typeof CHECKPOINT_SCHEMA_VERSION;\n\tcheckpointId: string;\n\trunId: string;\n\ttimestamp: string;\n\tcurrentGoal: GoalState;\n\tconstraints: readonly string[];\n\tdecisions: readonly DecisionRecord[];\n\topenTasks: readonly OpenTaskRecord[];\n\tblockers: readonly BlockerRecord[];\n\tfiles: FileState;\n\tcommands: readonly CommandRecord[];\n\tartifacts: readonly ArtifactRecord[];\n\tfailedApproaches: readonly FailedApproachRecord[];\n\tresumeAction: ResumeActionRecord;\n}\n\nexport interface AuthoritativeCheckpointSource {\n\tcommands: readonly CommandRecord[];\n\tblockerIds: readonly string[];\n\tfilePaths: readonly string[];\n\tartifacts: readonly { path: string; sha256: string }[];\n}\n\nexport interface CheckpointValidationResult {\n\tvalid: boolean;\n\terrors: string[];\n}\n\nexport interface ResumePlan {\n\tkind: \"blocker\" | \"task\" | \"resumeAction\";\n\tsummary: string;\n\ttargetId?: string;\n}\n\nexport function renderCheckpointMarkdown(checkpoint: Checkpoint): string {\n\tconst lines: string[] = [\n\t\t`# OMK Checkpoint ${checkpoint.checkpointId}`,\n\t\t`Run: ${checkpoint.runId}`,\n\t\t`Timestamp: ${checkpoint.timestamp}`,\n\t\t`Goal: ${checkpoint.currentGoal.summary} (${checkpoint.currentGoal.status})`,\n\t\t\"\",\n\t\t\"## Constraints\",\n\t\t...formatBullets(checkpoint.constraints),\n\t\t\"\",\n\t\t\"## Decisions\",\n\t\t...checkpoint.decisions.map(\n\t\t\t(decision) => `- ${decision.id}: ${decision.summary} [hashes: ${decision.artifactHashes.join(\",\") || \"none\"}]`,\n\t\t),\n\t\t\"\",\n\t\t\"## Open Tasks\",\n\t\t...checkpoint.openTasks.map((task) => `- ${task.id} p${task.priority}: ${task.summary}`),\n\t\t\"\",\n\t\t\"## Blockers\",\n\t\t...checkpoint.blockers.map((blocker) => `- ${blocker.id} ${blocker.severity}: ${blocker.summary}`),\n\t\t\"\",\n\t\t\"## Files\",\n\t\t`- read: ${checkpoint.files.read.join(\",\") || \"none\"}`,\n\t\t`- modified: ${checkpoint.files.modified.join(\",\") || \"none\"}`,\n\t\t\"\",\n\t\t\"## Commands\",\n\t\t...checkpoint.commands.map(\n\t\t\t(command) => `- ${command.command} => exitCode=${command.exitCode}, outputHash=${command.outputHash}`,\n\t\t),\n\t\t\"\",\n\t\t\"## Artifacts\",\n\t\t...checkpoint.artifacts.map((artifact) => `- ${artifact.kind}: ${artifact.path} sha256=${artifact.sha256}`),\n\t\t\"\",\n\t\t\"## Failed Approaches\",\n\t\t...checkpoint.failedApproaches.map((approach) => `- ${approach.summary}: ${approach.reason}`),\n\t\t\"\",\n\t\t`Resume: ${checkpoint.resumeAction.summary}${checkpoint.resumeAction.targetTaskId ? ` (${checkpoint.resumeAction.targetTaskId})` : \"\"}`,\n\t];\n\treturn `${lines.join(\"\\n\")}\\n`;\n}\n\nexport function validateCheckpoint(\n\tcheckpoint: Checkpoint,\n\tauthoritative: AuthoritativeCheckpointSource,\n): CheckpointValidationResult {\n\tconst errors: string[] = [];\n\tvalidateCommands(checkpoint, authoritative, errors);\n\tvalidateBlockers(checkpoint, authoritative, errors);\n\tvalidateFiles(checkpoint, authoritative, errors);\n\tvalidateArtifacts(checkpoint, authoritative, errors);\n\treturn { valid: errors.length === 0, errors };\n}\n\nexport function deriveResumePlan(checkpoint: Checkpoint): ResumePlan {\n\tconst blocker = [...checkpoint.blockers].sort(compareBlockerPriority)[0];\n\tif (blocker !== undefined) {\n\t\treturn { kind: \"blocker\", summary: blocker.summary, targetId: blocker.id };\n\t}\n\n\tconst task = [...checkpoint.openTasks].sort(compareTaskPriority)[0];\n\tif (task !== undefined) {\n\t\treturn { kind: \"task\", summary: task.summary, targetId: task.id };\n\t}\n\n\treturn {\n\t\tkind: \"resumeAction\",\n\t\tsummary: checkpoint.resumeAction.summary,\n\t\ttargetId: checkpoint.resumeAction.targetTaskId,\n\t};\n}\n\nexport function enforceCheckpointBudget(markdown: string, maxChars: number): string {\n\tif (markdown.length <= maxChars) {\n\t\treturn markdown;\n\t}\n\n\tconst goal = findLine(markdown, \"Goal:\") ?? \"Goal: unknown\";\n\tconst resume = findLine(markdown, \"Resume:\") ?? \"Resume: unknown\";\n\tconst compact = [`# OMK Checkpoint`, goal, \"Evidence hashes preserved.\", resume].join(\"\\n\");\n\tif (compact.length <= maxChars) {\n\t\treturn compact;\n\t}\n\treturn compact.slice(0, Math.max(0, maxChars));\n}\n\nfunction validateCommands(\n\tcheckpoint: Checkpoint,\n\tauthoritative: AuthoritativeCheckpointSource,\n\terrors: string[],\n): void {\n\tconst byCommand = new Map(authoritative.commands.map((command) => [command.command, command]));\n\tfor (const command of checkpoint.commands) {\n\t\tconst expected = byCommand.get(command.command);\n\t\tif (expected === undefined) {\n\t\t\terrors.push(`command missing from authoritative source: ${command.command}`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (command.exitCode !== expected.exitCode) {\n\t\t\terrors.push(`command exitCode mismatch for ${command.command}: ${command.exitCode} != ${expected.exitCode}`);\n\t\t}\n\t\tif (command.outputHash !== expected.outputHash) {\n\t\t\terrors.push(\n\t\t\t\t`command outputHash mismatch for ${command.command}: ${command.outputHash} != ${expected.outputHash}`,\n\t\t\t);\n\t\t}\n\t}\n}\n\nfunction validateBlockers(\n\tcheckpoint: Checkpoint,\n\tauthoritative: AuthoritativeCheckpointSource,\n\terrors: string[],\n): void {\n\tconst authoritativeIds = new Set(authoritative.blockerIds);\n\tfor (const blocker of checkpoint.blockers) {\n\t\tif (!authoritativeIds.has(blocker.id)) {\n\t\t\terrors.push(`blocker not present in authoritative source: ${blocker.id}`);\n\t\t}\n\t}\n}\n\nfunction validateFiles(checkpoint: Checkpoint, authoritative: AuthoritativeCheckpointSource, errors: string[]): void {\n\tconst authoritativePaths = new Set(authoritative.filePaths);\n\tfor (const filePath of [...checkpoint.files.read, ...checkpoint.files.modified]) {\n\t\tif (!authoritativePaths.has(filePath)) {\n\t\t\terrors.push(`file path not present in authoritative source: ${filePath}`);\n\t\t}\n\t}\n}\n\nfunction validateArtifacts(\n\tcheckpoint: Checkpoint,\n\tauthoritative: AuthoritativeCheckpointSource,\n\terrors: string[],\n): void {\n\tconst byPath = new Map(authoritative.artifacts.map((artifact) => [artifact.path, artifact]));\n\tfor (const artifact of checkpoint.artifacts) {\n\t\tconst expected = byPath.get(artifact.path);\n\t\tif (expected === undefined) {\n\t\t\terrors.push(`artifact missing from authoritative source: ${artifact.path}`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (artifact.sha256 !== expected.sha256) {\n\t\t\terrors.push(`artifact sha256 mismatch for ${artifact.path}: ${artifact.sha256} != ${expected.sha256}`);\n\t\t}\n\t}\n}\n\nfunction formatBullets(values: readonly string[]): string[] {\n\tif (values.length === 0) {\n\t\treturn [\"- none\"];\n\t}\n\treturn values.map((value) => `- ${value}`);\n}\n\nfunction blockerRank(severity: BlockerSeverity): number {\n\tif (severity === \"high\") return 0;\n\tif (severity === \"medium\") return 1;\n\treturn 2;\n}\n\nfunction compareBlockerPriority(a: BlockerRecord, b: BlockerRecord): number {\n\tconst rank = blockerRank(a.severity) - blockerRank(b.severity);\n\tif (rank !== 0) return rank;\n\treturn compareString(a.id, b.id);\n}\n\nfunction compareTaskPriority(a: OpenTaskRecord, b: OpenTaskRecord): number {\n\tif (a.priority !== b.priority) return a.priority - b.priority;\n\treturn compareString(a.id, b.id);\n}\n\nfunction compareString(a: string, b: string): number {\n\tif (a < b) return -1;\n\tif (a > b) return 1;\n\treturn 0;\n}\n\nfunction findLine(markdown: string, prefix: string): string | undefined {\n\treturn markdown.split(\"\\n\").find((line) => line.startsWith(prefix));\n}\n"]}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Phase 0 safety contracts for the fail-closed orchestration control plane.
3
+ *
4
+ * These are pure type/value definitions shared by the transaction coordinator,
5
+ * recovery classifier, and (later) the SQLite scheduler store. They encode the
6
+ * invariant that no state-changing mutation may commit unless its required
7
+ * ledger event was durably appended and mirrored.
8
+ *
9
+ * Reference: .omk/runs/omk-autonomous-harness-remediation-plan/algorithm-plan.md
10
+ * (Phase 0 + Phase 1) and audit-transaction.md.
11
+ */
12
+ /**
13
+ * Coarse transaction phase for a single durable operation. Carried on every
14
+ * typed coordinator error so operators and recovery can locate the crash point.
15
+ */
16
+ export type TransactionPhase = "prepare" | "start" | "apply" | "receipt" | "verify" | "commit" | "rollback" | "compensate";
17
+ /**
18
+ * Whether a ledger event is mandatory before the surrounding mutation commits
19
+ * ("required", fail-closed) or best-effort observability ("optional-readonly").
20
+ */
21
+ export type LedgerRequirement = "required" | "optional-readonly";
22
+ /**
23
+ * Execution mode is derived from print/json/RPC/SDK invocation, independent of
24
+ * whether an interactive UI is available. Headless never auto-confirms.
25
+ */
26
+ export type ExecutionMode = "interactive" | "headless";
27
+ /**
28
+ * How a typed coordinator failure should be handled by recovery/operators.
29
+ */
30
+ export type CoordinatorRecoverability = "retry" | "rollback" | "in_doubt" | "operator";
31
+ /**
32
+ * Closed set of typed coordinator error codes (algorithm-plan Phase 0).
33
+ */
34
+ export type CoordinatorErrorCode = "LEDGER_APPEND_REQUIRED_FAILED" | "LEDGER_INTEGRITY_FAILED" | "SQLITE_MIRROR_FAILED" | "SQLITE_COMMIT_AFTER_LEDGER_FAILED" | "IDEMPOTENCY_CONFLICT" | "VERIFY_GATE_FAILED" | "COMPENSATION_FAILED";
35
+ /**
36
+ * Structured metadata attached to every coordinator error. Preserving this
37
+ * across throws is what lets recovery map a crash to resume/rollback/in_doubt.
38
+ */
39
+ export interface CoordinatorErrorContext {
40
+ runId: string;
41
+ nodeId: string;
42
+ operationId: string;
43
+ phase: TransactionPhase;
44
+ recoverability: CoordinatorRecoverability;
45
+ attemptId?: string;
46
+ eventType?: string;
47
+ cause?: unknown;
48
+ }
49
+ /**
50
+ * Base typed error for the orchestration control plane. Always carries the
51
+ * operation identity, phase, and recoverability so failures are auditable.
52
+ */
53
+ export declare class CoordinatorError extends Error {
54
+ readonly code: CoordinatorErrorCode;
55
+ readonly runId: string;
56
+ readonly nodeId: string;
57
+ readonly operationId: string;
58
+ readonly phase: TransactionPhase;
59
+ readonly recoverability: CoordinatorRecoverability;
60
+ readonly attemptId?: string;
61
+ readonly eventType?: string;
62
+ constructor(code: CoordinatorErrorCode, message: string, context: CoordinatorErrorContext);
63
+ }
64
+ /**
65
+ * Required-audit-write failure: a mandatory ledger event could not be appended,
66
+ * so the surrounding mutation must roll back fail-closed. This is the canonical
67
+ * `LEDGER_APPEND_REQUIRED_FAILED` error and defaults to `rollback` recovery.
68
+ */
69
+ export declare class RequiredAuditWriteError extends CoordinatorError {
70
+ constructor(message: string, context: Omit<CoordinatorErrorContext, "recoverability" | "code"> & {
71
+ recoverability?: CoordinatorRecoverability;
72
+ });
73
+ }
74
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/core/orchestration/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GACzB,SAAS,GACT,OAAO,GACP,OAAO,GACP,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,YAAY,CAAC;AAEhB;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,mBAAmB,CAAC;AAEjE;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,UAAU,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,CAAC;AAEvF;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAC7B,+BAA+B,GAC/B,yBAAyB,GACzB,sBAAsB,GACtB,mCAAmC,GACnC,sBAAsB,GACtB,oBAAoB,GACpB,qBAAqB,CAAC;AAEzB;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,gBAAgB,CAAC;IACxB,cAAc,EAAE,yBAAyB,CAAC;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC;IACjC,QAAQ,CAAC,cAAc,EAAE,yBAAyB,CAAC;IACnD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAE5B,YAAY,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB,EAWxF;CACD;AAED;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,gBAAgB;IAC5D,YACC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,IAAI,CAAC,uBAAuB,EAAE,gBAAgB,GAAG,MAAM,CAAC,GAAG;QACnE,cAAc,CAAC,EAAE,yBAAyB,CAAC;KAC3C,EAOD;CACD","sourcesContent":["/**\n * Phase 0 safety contracts for the fail-closed orchestration control plane.\n *\n * These are pure type/value definitions shared by the transaction coordinator,\n * recovery classifier, and (later) the SQLite scheduler store. They encode the\n * invariant that no state-changing mutation may commit unless its required\n * ledger event was durably appended and mirrored.\n *\n * Reference: .omk/runs/omk-autonomous-harness-remediation-plan/algorithm-plan.md\n * (Phase 0 + Phase 1) and audit-transaction.md.\n */\n\n/**\n * Coarse transaction phase for a single durable operation. Carried on every\n * typed coordinator error so operators and recovery can locate the crash point.\n */\nexport type TransactionPhase =\n\t| \"prepare\"\n\t| \"start\"\n\t| \"apply\"\n\t| \"receipt\"\n\t| \"verify\"\n\t| \"commit\"\n\t| \"rollback\"\n\t| \"compensate\";\n\n/**\n * Whether a ledger event is mandatory before the surrounding mutation commits\n * (\"required\", fail-closed) or best-effort observability (\"optional-readonly\").\n */\nexport type LedgerRequirement = \"required\" | \"optional-readonly\";\n\n/**\n * Execution mode is derived from print/json/RPC/SDK invocation, independent of\n * whether an interactive UI is available. Headless never auto-confirms.\n */\nexport type ExecutionMode = \"interactive\" | \"headless\";\n\n/**\n * How a typed coordinator failure should be handled by recovery/operators.\n */\nexport type CoordinatorRecoverability = \"retry\" | \"rollback\" | \"in_doubt\" | \"operator\";\n\n/**\n * Closed set of typed coordinator error codes (algorithm-plan Phase 0).\n */\nexport type CoordinatorErrorCode =\n\t| \"LEDGER_APPEND_REQUIRED_FAILED\"\n\t| \"LEDGER_INTEGRITY_FAILED\"\n\t| \"SQLITE_MIRROR_FAILED\"\n\t| \"SQLITE_COMMIT_AFTER_LEDGER_FAILED\"\n\t| \"IDEMPOTENCY_CONFLICT\"\n\t| \"VERIFY_GATE_FAILED\"\n\t| \"COMPENSATION_FAILED\";\n\n/**\n * Structured metadata attached to every coordinator error. Preserving this\n * across throws is what lets recovery map a crash to resume/rollback/in_doubt.\n */\nexport interface CoordinatorErrorContext {\n\trunId: string;\n\tnodeId: string;\n\toperationId: string;\n\tphase: TransactionPhase;\n\trecoverability: CoordinatorRecoverability;\n\tattemptId?: string;\n\teventType?: string;\n\tcause?: unknown;\n}\n\n/**\n * Base typed error for the orchestration control plane. Always carries the\n * operation identity, phase, and recoverability so failures are auditable.\n */\nexport class CoordinatorError extends Error {\n\treadonly code: CoordinatorErrorCode;\n\treadonly runId: string;\n\treadonly nodeId: string;\n\treadonly operationId: string;\n\treadonly phase: TransactionPhase;\n\treadonly recoverability: CoordinatorRecoverability;\n\treadonly attemptId?: string;\n\treadonly eventType?: string;\n\n\tconstructor(code: CoordinatorErrorCode, message: string, context: CoordinatorErrorContext) {\n\t\tsuper(message, context.cause === undefined ? undefined : { cause: context.cause });\n\t\tthis.name = \"CoordinatorError\";\n\t\tthis.code = code;\n\t\tthis.runId = context.runId;\n\t\tthis.nodeId = context.nodeId;\n\t\tthis.operationId = context.operationId;\n\t\tthis.phase = context.phase;\n\t\tthis.recoverability = context.recoverability;\n\t\tthis.attemptId = context.attemptId;\n\t\tthis.eventType = context.eventType;\n\t}\n}\n\n/**\n * Required-audit-write failure: a mandatory ledger event could not be appended,\n * so the surrounding mutation must roll back fail-closed. This is the canonical\n * `LEDGER_APPEND_REQUIRED_FAILED` error and defaults to `rollback` recovery.\n */\nexport class RequiredAuditWriteError extends CoordinatorError {\n\tconstructor(\n\t\tmessage: string,\n\t\tcontext: Omit<CoordinatorErrorContext, \"recoverability\" | \"code\"> & {\n\t\t\trecoverability?: CoordinatorRecoverability;\n\t\t},\n\t) {\n\t\tsuper(\"LEDGER_APPEND_REQUIRED_FAILED\", message, {\n\t\t\t...context,\n\t\t\trecoverability: context.recoverability ?? \"rollback\",\n\t\t});\n\t\tthis.name = \"RequiredAuditWriteError\";\n\t}\n}\n"]}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Phase 0 safety contracts for the fail-closed orchestration control plane.
3
+ *
4
+ * These are pure type/value definitions shared by the transaction coordinator,
5
+ * recovery classifier, and (later) the SQLite scheduler store. They encode the
6
+ * invariant that no state-changing mutation may commit unless its required
7
+ * ledger event was durably appended and mirrored.
8
+ *
9
+ * Reference: .omk/runs/omk-autonomous-harness-remediation-plan/algorithm-plan.md
10
+ * (Phase 0 + Phase 1) and audit-transaction.md.
11
+ */
12
+ /**
13
+ * Base typed error for the orchestration control plane. Always carries the
14
+ * operation identity, phase, and recoverability so failures are auditable.
15
+ */
16
+ export class CoordinatorError extends Error {
17
+ code;
18
+ runId;
19
+ nodeId;
20
+ operationId;
21
+ phase;
22
+ recoverability;
23
+ attemptId;
24
+ eventType;
25
+ constructor(code, message, context) {
26
+ super(message, context.cause === undefined ? undefined : { cause: context.cause });
27
+ this.name = "CoordinatorError";
28
+ this.code = code;
29
+ this.runId = context.runId;
30
+ this.nodeId = context.nodeId;
31
+ this.operationId = context.operationId;
32
+ this.phase = context.phase;
33
+ this.recoverability = context.recoverability;
34
+ this.attemptId = context.attemptId;
35
+ this.eventType = context.eventType;
36
+ }
37
+ }
38
+ /**
39
+ * Required-audit-write failure: a mandatory ledger event could not be appended,
40
+ * so the surrounding mutation must roll back fail-closed. This is the canonical
41
+ * `LEDGER_APPEND_REQUIRED_FAILED` error and defaults to `rollback` recovery.
42
+ */
43
+ export class RequiredAuditWriteError extends CoordinatorError {
44
+ constructor(message, context) {
45
+ super("LEDGER_APPEND_REQUIRED_FAILED", message, {
46
+ ...context,
47
+ recoverability: context.recoverability ?? "rollback",
48
+ });
49
+ this.name = "RequiredAuditWriteError";
50
+ }
51
+ }
52
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/core/orchestration/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AA4DH;;;GAGG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACjC,IAAI,CAAuB;IAC3B,KAAK,CAAS;IACd,MAAM,CAAS;IACf,WAAW,CAAS;IACpB,KAAK,CAAmB;IACxB,cAAc,CAA4B;IAC1C,SAAS,CAAU;IACnB,SAAS,CAAU;IAE5B,YAAY,IAA0B,EAAE,OAAe,EAAE,OAAgC,EAAE;QAC1F,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QACnF,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;QAC7C,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IAAA,CACnC;CACD;AAED;;;;GAIG;AACH,MAAM,OAAO,uBAAwB,SAAQ,gBAAgB;IAC5D,YACC,OAAe,EACf,OAEC,EACA;QACD,KAAK,CAAC,+BAA+B,EAAE,OAAO,EAAE;YAC/C,GAAG,OAAO;YACV,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,UAAU;SACpD,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IAAA,CACtC;CACD","sourcesContent":["/**\n * Phase 0 safety contracts for the fail-closed orchestration control plane.\n *\n * These are pure type/value definitions shared by the transaction coordinator,\n * recovery classifier, and (later) the SQLite scheduler store. They encode the\n * invariant that no state-changing mutation may commit unless its required\n * ledger event was durably appended and mirrored.\n *\n * Reference: .omk/runs/omk-autonomous-harness-remediation-plan/algorithm-plan.md\n * (Phase 0 + Phase 1) and audit-transaction.md.\n */\n\n/**\n * Coarse transaction phase for a single durable operation. Carried on every\n * typed coordinator error so operators and recovery can locate the crash point.\n */\nexport type TransactionPhase =\n\t| \"prepare\"\n\t| \"start\"\n\t| \"apply\"\n\t| \"receipt\"\n\t| \"verify\"\n\t| \"commit\"\n\t| \"rollback\"\n\t| \"compensate\";\n\n/**\n * Whether a ledger event is mandatory before the surrounding mutation commits\n * (\"required\", fail-closed) or best-effort observability (\"optional-readonly\").\n */\nexport type LedgerRequirement = \"required\" | \"optional-readonly\";\n\n/**\n * Execution mode is derived from print/json/RPC/SDK invocation, independent of\n * whether an interactive UI is available. Headless never auto-confirms.\n */\nexport type ExecutionMode = \"interactive\" | \"headless\";\n\n/**\n * How a typed coordinator failure should be handled by recovery/operators.\n */\nexport type CoordinatorRecoverability = \"retry\" | \"rollback\" | \"in_doubt\" | \"operator\";\n\n/**\n * Closed set of typed coordinator error codes (algorithm-plan Phase 0).\n */\nexport type CoordinatorErrorCode =\n\t| \"LEDGER_APPEND_REQUIRED_FAILED\"\n\t| \"LEDGER_INTEGRITY_FAILED\"\n\t| \"SQLITE_MIRROR_FAILED\"\n\t| \"SQLITE_COMMIT_AFTER_LEDGER_FAILED\"\n\t| \"IDEMPOTENCY_CONFLICT\"\n\t| \"VERIFY_GATE_FAILED\"\n\t| \"COMPENSATION_FAILED\";\n\n/**\n * Structured metadata attached to every coordinator error. Preserving this\n * across throws is what lets recovery map a crash to resume/rollback/in_doubt.\n */\nexport interface CoordinatorErrorContext {\n\trunId: string;\n\tnodeId: string;\n\toperationId: string;\n\tphase: TransactionPhase;\n\trecoverability: CoordinatorRecoverability;\n\tattemptId?: string;\n\teventType?: string;\n\tcause?: unknown;\n}\n\n/**\n * Base typed error for the orchestration control plane. Always carries the\n * operation identity, phase, and recoverability so failures are auditable.\n */\nexport class CoordinatorError extends Error {\n\treadonly code: CoordinatorErrorCode;\n\treadonly runId: string;\n\treadonly nodeId: string;\n\treadonly operationId: string;\n\treadonly phase: TransactionPhase;\n\treadonly recoverability: CoordinatorRecoverability;\n\treadonly attemptId?: string;\n\treadonly eventType?: string;\n\n\tconstructor(code: CoordinatorErrorCode, message: string, context: CoordinatorErrorContext) {\n\t\tsuper(message, context.cause === undefined ? undefined : { cause: context.cause });\n\t\tthis.name = \"CoordinatorError\";\n\t\tthis.code = code;\n\t\tthis.runId = context.runId;\n\t\tthis.nodeId = context.nodeId;\n\t\tthis.operationId = context.operationId;\n\t\tthis.phase = context.phase;\n\t\tthis.recoverability = context.recoverability;\n\t\tthis.attemptId = context.attemptId;\n\t\tthis.eventType = context.eventType;\n\t}\n}\n\n/**\n * Required-audit-write failure: a mandatory ledger event could not be appended,\n * so the surrounding mutation must roll back fail-closed. This is the canonical\n * `LEDGER_APPEND_REQUIRED_FAILED` error and defaults to `rollback` recovery.\n */\nexport class RequiredAuditWriteError extends CoordinatorError {\n\tconstructor(\n\t\tmessage: string,\n\t\tcontext: Omit<CoordinatorErrorContext, \"recoverability\" | \"code\"> & {\n\t\t\trecoverability?: CoordinatorRecoverability;\n\t\t},\n\t) {\n\t\tsuper(\"LEDGER_APPEND_REQUIRED_FAILED\", message, {\n\t\t\t...context,\n\t\t\trecoverability: context.recoverability ?? \"rollback\",\n\t\t});\n\t\tthis.name = \"RequiredAuditWriteError\";\n\t}\n}\n"]}
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Deterministic merge-queue pure algorithms for the OMK durable DAG scheduler.
3
+ *
4
+ * This module contains ONLY pure data transformations. It performs NO real git
5
+ * execution and NO I/O. The durable SQLite scheduler (see foundation.md
6
+ * `merge_queue` table) and the git worktree integration lane (see
7
+ * worktree-merge.md) consume these helpers to decide ordering, promotion
8
+ * gating, conflict recording, and orphan-worktree reclaim policy.
9
+ *
10
+ * Design contract (worktree-merge.md §3.1, §3.3, §4.2, §5):
11
+ * - Merge is strictly serial: exactly one entry advances per selection.
12
+ * - Selection order key is fully deterministic:
13
+ * priority ASC, dagDepth ASC, leaseFinishedAt ASC, queueId ASC.
14
+ * - Verify gate: a merge_queue entry can only advance from `pending` once its
15
+ * owning node reached the completed state AND its VerificationContract passed.
16
+ * This module trusts `completedNodeIds` (the scheduler supplies the verified
17
+ * completed set); pure logic only enforces the membership check.
18
+ * - Promotion gate: the canonical branch is promoted only when the entry is in
19
+ * `merging`, verification passed, the target branch is unchanged, and no
20
+ * conflict was detected.
21
+ * - Worktree reclaim never removes outside `.omk/worktrees/`.
22
+ */
23
+ export type MergeQueueStatus = "pending" | "merging" | "merged" | "conflict" | "blocked";
24
+ /**
25
+ * A single merge_queue row plus the ordering metadata derived from the owning
26
+ * node and its lease. `leaseFinishedAt` mirrors the owning node's `finished_at`
27
+ * (the moment its lease ended); it is `null` when the node has not finished.
28
+ */
29
+ export interface MergeQueueEntry {
30
+ queueId: string;
31
+ runId: string;
32
+ nodeId: string;
33
+ branchName: string;
34
+ targetBranch: string;
35
+ status: MergeQueueStatus;
36
+ priority: number;
37
+ dagDepth: number;
38
+ leaseFinishedAt: string | null;
39
+ createdAt: string;
40
+ }
41
+ /**
42
+ * Inputs to the canonical-branch promotion gate. The scheduler fills these from
43
+ * the merge worktree preparation + re-verification step (worktree-merge.md §5).
44
+ */
45
+ export interface MergePromotionDecision {
46
+ queueStatus: MergeQueueStatus;
47
+ verificationPassed: boolean;
48
+ targetUnchanged: boolean;
49
+ conflict: boolean;
50
+ }
51
+ /** One side of a path-level merge conflict (ours / theirs blob SHAs). */
52
+ export interface ConflictFile {
53
+ path: string;
54
+ ours: string;
55
+ theirs: string;
56
+ }
57
+ /** Deterministic conflict artifact persisted to the artifacts table. */
58
+ export interface ConflictArtifact {
59
+ type: "merge-conflict";
60
+ runId: string;
61
+ nodeId: string;
62
+ branch: string;
63
+ targetBranch: string;
64
+ conflictedFiles: ConflictFile[];
65
+ mergeBase: string;
66
+ createdAt: string;
67
+ }
68
+ /** Caller-supplied raw conflict data; files may arrive in any order. */
69
+ export interface ConflictArtifactInput {
70
+ runId: string;
71
+ nodeId: string;
72
+ branch: string;
73
+ targetBranch: string;
74
+ conflictedFiles: ConflictFile[];
75
+ mergeBase: string;
76
+ createdAt: string;
77
+ }
78
+ /** Worktree reclaim decision returned by {@link shouldReclaimWorktree}. */
79
+ export type WorktreeReclaimAction = "preserve" | "remove" | "ignore";
80
+ /**
81
+ * Choose exactly one pending merge_queue entry to advance next.
82
+ *
83
+ * Selection rules:
84
+ * 1. Only `pending` entries are eligible.
85
+ * 2. Verify gate: the owning node must be in `completedNodeIds` (the scheduler
86
+ * only adds nodes that reached `completed` AND passed VerificationContract).
87
+ * 3. Among eligible entries, order by priority ASC, dagDepth ASC,
88
+ * leaseFinishedAt ASC (nulls last), queueId ASC. queueId is the unique
89
+ * final tie-break, so the result is fully deterministic.
90
+ *
91
+ * Returns `undefined` when no entry is eligible.
92
+ */
93
+ export declare function selectNextMergeEntry(entries: readonly MergeQueueEntry[], completedNodeIds: ReadonlySet<string>): MergeQueueEntry | undefined;
94
+ /**
95
+ * Promotion gate for the canonical (target) branch.
96
+ *
97
+ * Returns true only when every promotion precondition holds:
98
+ * queue is `merging`, verification passed, the target branch is unchanged,
99
+ * and no conflict was detected. Any failure leaves the target untouched.
100
+ */
101
+ export declare function canPromoteMerge(decision: MergePromotionDecision): boolean;
102
+ /**
103
+ * Build a deterministic conflict artifact. `conflictedFiles` are copied and
104
+ * sorted by path (then ours, then theirs for total determinism); the input
105
+ * array is never mutated.
106
+ */
107
+ export declare function createConflictArtifact(input: ConflictArtifactInput): ConflictArtifact;
108
+ /**
109
+ * Decide the reclaim fate of a worktree during startup recovery
110
+ * (worktree-merge.md §2.3).
111
+ *
112
+ * - Outside `.omk/worktrees/`: always `ignore` (never remove user/foreign
113
+ * worktrees).
114
+ * - Terminal node (completed/merged/failed/rolled_back/cancelled) under prefix:
115
+ * `remove` — the worktree is leftover and safe to clean up.
116
+ * - Expired lease with a non-terminal node under prefix: `preserve` — orphan
117
+ * recovery keeps the worktree and requeues the node.
118
+ * - Otherwise (active, healthy): `ignore`.
119
+ */
120
+ export declare function shouldReclaimWorktree(nodeTerminal: boolean, leaseExpired: boolean, pathUnderOmkWorktrees: boolean): WorktreeReclaimAction;
121
+ //# sourceMappingURL=merge-queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge-queue.d.ts","sourceRoot":"","sources":["../../../src/core/orchestration/merge-queue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;AAEzF;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,gBAAgB,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACtC,WAAW,EAAE,gBAAgB,CAAC;IAC9B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;CAClB;AAED,yEAAyE;AACzE,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CACf;AAED,wEAAwE;AACxE,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,YAAY,EAAE,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,wEAAwE;AACxE,MAAM,WAAW,qBAAqB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,YAAY,EAAE,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,2EAA2E;AAC3E,MAAM,MAAM,qBAAqB,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAErE;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CACnC,OAAO,EAAE,SAAS,eAAe,EAAE,EACnC,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAC,GACnC,eAAe,GAAG,SAAS,CAU7B;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,sBAAsB,GAAG,OAAO,CAOzE;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,qBAAqB,GAAG,gBAAgB,CAYrF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACpC,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,OAAO,EACrB,qBAAqB,EAAE,OAAO,GAC5B,qBAAqB,CAWvB","sourcesContent":["/**\n * Deterministic merge-queue pure algorithms for the OMK durable DAG scheduler.\n *\n * This module contains ONLY pure data transformations. It performs NO real git\n * execution and NO I/O. The durable SQLite scheduler (see foundation.md\n * `merge_queue` table) and the git worktree integration lane (see\n * worktree-merge.md) consume these helpers to decide ordering, promotion\n * gating, conflict recording, and orphan-worktree reclaim policy.\n *\n * Design contract (worktree-merge.md §3.1, §3.3, §4.2, §5):\n * - Merge is strictly serial: exactly one entry advances per selection.\n * - Selection order key is fully deterministic:\n * priority ASC, dagDepth ASC, leaseFinishedAt ASC, queueId ASC.\n * - Verify gate: a merge_queue entry can only advance from `pending` once its\n * owning node reached the completed state AND its VerificationContract passed.\n * This module trusts `completedNodeIds` (the scheduler supplies the verified\n * completed set); pure logic only enforces the membership check.\n * - Promotion gate: the canonical branch is promoted only when the entry is in\n * `merging`, verification passed, the target branch is unchanged, and no\n * conflict was detected.\n * - Worktree reclaim never removes outside `.omk/worktrees/`.\n */\n\nexport type MergeQueueStatus = \"pending\" | \"merging\" | \"merged\" | \"conflict\" | \"blocked\";\n\n/**\n * A single merge_queue row plus the ordering metadata derived from the owning\n * node and its lease. `leaseFinishedAt` mirrors the owning node's `finished_at`\n * (the moment its lease ended); it is `null` when the node has not finished.\n */\nexport interface MergeQueueEntry {\n\tqueueId: string;\n\trunId: string;\n\tnodeId: string;\n\tbranchName: string;\n\ttargetBranch: string;\n\tstatus: MergeQueueStatus;\n\tpriority: number;\n\tdagDepth: number;\n\tleaseFinishedAt: string | null;\n\tcreatedAt: string;\n}\n\n/**\n * Inputs to the canonical-branch promotion gate. The scheduler fills these from\n * the merge worktree preparation + re-verification step (worktree-merge.md §5).\n */\nexport interface MergePromotionDecision {\n\tqueueStatus: MergeQueueStatus;\n\tverificationPassed: boolean;\n\ttargetUnchanged: boolean;\n\tconflict: boolean;\n}\n\n/** One side of a path-level merge conflict (ours / theirs blob SHAs). */\nexport interface ConflictFile {\n\tpath: string;\n\tours: string;\n\ttheirs: string;\n}\n\n/** Deterministic conflict artifact persisted to the artifacts table. */\nexport interface ConflictArtifact {\n\ttype: \"merge-conflict\";\n\trunId: string;\n\tnodeId: string;\n\tbranch: string;\n\ttargetBranch: string;\n\tconflictedFiles: ConflictFile[];\n\tmergeBase: string;\n\tcreatedAt: string;\n}\n\n/** Caller-supplied raw conflict data; files may arrive in any order. */\nexport interface ConflictArtifactInput {\n\trunId: string;\n\tnodeId: string;\n\tbranch: string;\n\ttargetBranch: string;\n\tconflictedFiles: ConflictFile[];\n\tmergeBase: string;\n\tcreatedAt: string;\n}\n\n/** Worktree reclaim decision returned by {@link shouldReclaimWorktree}. */\nexport type WorktreeReclaimAction = \"preserve\" | \"remove\" | \"ignore\";\n\n/**\n * Choose exactly one pending merge_queue entry to advance next.\n *\n * Selection rules:\n * 1. Only `pending` entries are eligible.\n * 2. Verify gate: the owning node must be in `completedNodeIds` (the scheduler\n * only adds nodes that reached `completed` AND passed VerificationContract).\n * 3. Among eligible entries, order by priority ASC, dagDepth ASC,\n * leaseFinishedAt ASC (nulls last), queueId ASC. queueId is the unique\n * final tie-break, so the result is fully deterministic.\n *\n * Returns `undefined` when no entry is eligible.\n */\nexport function selectNextMergeEntry(\n\tentries: readonly MergeQueueEntry[],\n\tcompletedNodeIds: ReadonlySet<string>,\n): MergeQueueEntry | undefined {\n\tconst eligible = entries.filter((entry) => entry.status === \"pending\" && completedNodeIds.has(entry.nodeId));\n\tif (eligible.length === 0) {\n\t\treturn undefined;\n\t}\n\tif (eligible.length === 1) {\n\t\treturn eligible[0];\n\t}\n\tconst ordered = [...eligible].sort(compareMergeEntryOrder);\n\treturn ordered[0];\n}\n\n/**\n * Promotion gate for the canonical (target) branch.\n *\n * Returns true only when every promotion precondition holds:\n * queue is `merging`, verification passed, the target branch is unchanged,\n * and no conflict was detected. Any failure leaves the target untouched.\n */\nexport function canPromoteMerge(decision: MergePromotionDecision): boolean {\n\treturn (\n\t\tdecision.queueStatus === \"merging\" &&\n\t\tdecision.verificationPassed === true &&\n\t\tdecision.targetUnchanged === true &&\n\t\tdecision.conflict === false\n\t);\n}\n\n/**\n * Build a deterministic conflict artifact. `conflictedFiles` are copied and\n * sorted by path (then ours, then theirs for total determinism); the input\n * array is never mutated.\n */\nexport function createConflictArtifact(input: ConflictArtifactInput): ConflictArtifact {\n\tconst conflictedFiles = [...input.conflictedFiles].sort(compareConflictFile);\n\treturn {\n\t\ttype: \"merge-conflict\",\n\t\trunId: input.runId,\n\t\tnodeId: input.nodeId,\n\t\tbranch: input.branch,\n\t\ttargetBranch: input.targetBranch,\n\t\tconflictedFiles,\n\t\tmergeBase: input.mergeBase,\n\t\tcreatedAt: input.createdAt,\n\t};\n}\n\n/**\n * Decide the reclaim fate of a worktree during startup recovery\n * (worktree-merge.md §2.3).\n *\n * - Outside `.omk/worktrees/`: always `ignore` (never remove user/foreign\n * worktrees).\n * - Terminal node (completed/merged/failed/rolled_back/cancelled) under prefix:\n * `remove` — the worktree is leftover and safe to clean up.\n * - Expired lease with a non-terminal node under prefix: `preserve` — orphan\n * recovery keeps the worktree and requeues the node.\n * - Otherwise (active, healthy): `ignore`.\n */\nexport function shouldReclaimWorktree(\n\tnodeTerminal: boolean,\n\tleaseExpired: boolean,\n\tpathUnderOmkWorktrees: boolean,\n): WorktreeReclaimAction {\n\tif (!pathUnderOmkWorktrees) {\n\t\treturn \"ignore\";\n\t}\n\tif (nodeTerminal) {\n\t\treturn \"remove\";\n\t}\n\tif (leaseExpired) {\n\t\treturn \"preserve\";\n\t}\n\treturn \"ignore\";\n}\n\nfunction compareMergeEntryOrder(a: MergeQueueEntry, b: MergeQueueEntry): number {\n\tif (a.priority !== b.priority) {\n\t\treturn a.priority - b.priority;\n\t}\n\tif (a.dagDepth !== b.dagDepth) {\n\t\treturn a.dagDepth - b.dagDepth;\n\t}\n\tconst byTime = compareNullableTimestamp(a.leaseFinishedAt, b.leaseFinishedAt);\n\tif (byTime !== 0) {\n\t\treturn byTime;\n\t}\n\treturn compareString(a.queueId, b.queueId);\n}\n\nfunction compareConflictFile(a: ConflictFile, b: ConflictFile): number {\n\tconst byPath = compareString(a.path, b.path);\n\tif (byPath !== 0) {\n\t\treturn byPath;\n\t}\n\tconst byOurs = compareString(a.ours, b.ours);\n\tif (byOurs !== 0) {\n\t\treturn byOurs;\n\t}\n\treturn compareString(a.theirs, b.theirs);\n}\n\nfunction compareNullableTimestamp(a: string | null, b: string | null): number {\n\t// ISO-8601 strings sort lexicographically in chronological order; null\n\t// (node never finished) sorts after any real timestamp.\n\tif (a === null && b === null) {\n\t\treturn 0;\n\t}\n\tif (a === null) {\n\t\treturn 1;\n\t}\n\tif (b === null) {\n\t\treturn -1;\n\t}\n\treturn compareString(a, b);\n}\n\nfunction compareString(a: string, b: string): number {\n\tif (a < b) {\n\t\treturn -1;\n\t}\n\tif (a > b) {\n\t\treturn 1;\n\t}\n\treturn 0;\n}\n"]}
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Deterministic merge-queue pure algorithms for the OMK durable DAG scheduler.
3
+ *
4
+ * This module contains ONLY pure data transformations. It performs NO real git
5
+ * execution and NO I/O. The durable SQLite scheduler (see foundation.md
6
+ * `merge_queue` table) and the git worktree integration lane (see
7
+ * worktree-merge.md) consume these helpers to decide ordering, promotion
8
+ * gating, conflict recording, and orphan-worktree reclaim policy.
9
+ *
10
+ * Design contract (worktree-merge.md §3.1, §3.3, §4.2, §5):
11
+ * - Merge is strictly serial: exactly one entry advances per selection.
12
+ * - Selection order key is fully deterministic:
13
+ * priority ASC, dagDepth ASC, leaseFinishedAt ASC, queueId ASC.
14
+ * - Verify gate: a merge_queue entry can only advance from `pending` once its
15
+ * owning node reached the completed state AND its VerificationContract passed.
16
+ * This module trusts `completedNodeIds` (the scheduler supplies the verified
17
+ * completed set); pure logic only enforces the membership check.
18
+ * - Promotion gate: the canonical branch is promoted only when the entry is in
19
+ * `merging`, verification passed, the target branch is unchanged, and no
20
+ * conflict was detected.
21
+ * - Worktree reclaim never removes outside `.omk/worktrees/`.
22
+ */
23
+ /**
24
+ * Choose exactly one pending merge_queue entry to advance next.
25
+ *
26
+ * Selection rules:
27
+ * 1. Only `pending` entries are eligible.
28
+ * 2. Verify gate: the owning node must be in `completedNodeIds` (the scheduler
29
+ * only adds nodes that reached `completed` AND passed VerificationContract).
30
+ * 3. Among eligible entries, order by priority ASC, dagDepth ASC,
31
+ * leaseFinishedAt ASC (nulls last), queueId ASC. queueId is the unique
32
+ * final tie-break, so the result is fully deterministic.
33
+ *
34
+ * Returns `undefined` when no entry is eligible.
35
+ */
36
+ export function selectNextMergeEntry(entries, completedNodeIds) {
37
+ const eligible = entries.filter((entry) => entry.status === "pending" && completedNodeIds.has(entry.nodeId));
38
+ if (eligible.length === 0) {
39
+ return undefined;
40
+ }
41
+ if (eligible.length === 1) {
42
+ return eligible[0];
43
+ }
44
+ const ordered = [...eligible].sort(compareMergeEntryOrder);
45
+ return ordered[0];
46
+ }
47
+ /**
48
+ * Promotion gate for the canonical (target) branch.
49
+ *
50
+ * Returns true only when every promotion precondition holds:
51
+ * queue is `merging`, verification passed, the target branch is unchanged,
52
+ * and no conflict was detected. Any failure leaves the target untouched.
53
+ */
54
+ export function canPromoteMerge(decision) {
55
+ return (decision.queueStatus === "merging" &&
56
+ decision.verificationPassed === true &&
57
+ decision.targetUnchanged === true &&
58
+ decision.conflict === false);
59
+ }
60
+ /**
61
+ * Build a deterministic conflict artifact. `conflictedFiles` are copied and
62
+ * sorted by path (then ours, then theirs for total determinism); the input
63
+ * array is never mutated.
64
+ */
65
+ export function createConflictArtifact(input) {
66
+ const conflictedFiles = [...input.conflictedFiles].sort(compareConflictFile);
67
+ return {
68
+ type: "merge-conflict",
69
+ runId: input.runId,
70
+ nodeId: input.nodeId,
71
+ branch: input.branch,
72
+ targetBranch: input.targetBranch,
73
+ conflictedFiles,
74
+ mergeBase: input.mergeBase,
75
+ createdAt: input.createdAt,
76
+ };
77
+ }
78
+ /**
79
+ * Decide the reclaim fate of a worktree during startup recovery
80
+ * (worktree-merge.md §2.3).
81
+ *
82
+ * - Outside `.omk/worktrees/`: always `ignore` (never remove user/foreign
83
+ * worktrees).
84
+ * - Terminal node (completed/merged/failed/rolled_back/cancelled) under prefix:
85
+ * `remove` — the worktree is leftover and safe to clean up.
86
+ * - Expired lease with a non-terminal node under prefix: `preserve` — orphan
87
+ * recovery keeps the worktree and requeues the node.
88
+ * - Otherwise (active, healthy): `ignore`.
89
+ */
90
+ export function shouldReclaimWorktree(nodeTerminal, leaseExpired, pathUnderOmkWorktrees) {
91
+ if (!pathUnderOmkWorktrees) {
92
+ return "ignore";
93
+ }
94
+ if (nodeTerminal) {
95
+ return "remove";
96
+ }
97
+ if (leaseExpired) {
98
+ return "preserve";
99
+ }
100
+ return "ignore";
101
+ }
102
+ function compareMergeEntryOrder(a, b) {
103
+ if (a.priority !== b.priority) {
104
+ return a.priority - b.priority;
105
+ }
106
+ if (a.dagDepth !== b.dagDepth) {
107
+ return a.dagDepth - b.dagDepth;
108
+ }
109
+ const byTime = compareNullableTimestamp(a.leaseFinishedAt, b.leaseFinishedAt);
110
+ if (byTime !== 0) {
111
+ return byTime;
112
+ }
113
+ return compareString(a.queueId, b.queueId);
114
+ }
115
+ function compareConflictFile(a, b) {
116
+ const byPath = compareString(a.path, b.path);
117
+ if (byPath !== 0) {
118
+ return byPath;
119
+ }
120
+ const byOurs = compareString(a.ours, b.ours);
121
+ if (byOurs !== 0) {
122
+ return byOurs;
123
+ }
124
+ return compareString(a.theirs, b.theirs);
125
+ }
126
+ function compareNullableTimestamp(a, b) {
127
+ // ISO-8601 strings sort lexicographically in chronological order; null
128
+ // (node never finished) sorts after any real timestamp.
129
+ if (a === null && b === null) {
130
+ return 0;
131
+ }
132
+ if (a === null) {
133
+ return 1;
134
+ }
135
+ if (b === null) {
136
+ return -1;
137
+ }
138
+ return compareString(a, b);
139
+ }
140
+ function compareString(a, b) {
141
+ if (a < b) {
142
+ return -1;
143
+ }
144
+ if (a > b) {
145
+ return 1;
146
+ }
147
+ return 0;
148
+ }
149
+ //# sourceMappingURL=merge-queue.js.map