open-multi-agent-kit 1.2.0 → 1.2.2

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 (436) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +2 -2
  3. package/dist/approval-api.d.ts +5 -0
  4. package/dist/approval-api.d.ts.map +1 -0
  5. package/dist/approval-api.js +5 -0
  6. package/dist/approval-api.js.map +1 -0
  7. package/dist/cli/session-picker.d.ts +2 -2
  8. package/dist/cli/session-picker.d.ts.map +1 -1
  9. package/dist/cli/session-picker.js.map +1 -1
  10. package/dist/commands/verified-run-cli.d.ts.map +1 -1
  11. package/dist/commands/verified-run-cli.js +69 -22
  12. package/dist/commands/verified-run-cli.js.map +1 -1
  13. package/dist/commands/verified-run-signal.d.ts +3 -0
  14. package/dist/commands/verified-run-signal.d.ts.map +1 -0
  15. package/dist/commands/verified-run-signal.js +15 -0
  16. package/dist/commands/verified-run-signal.js.map +1 -0
  17. package/dist/coordination/broker.d.ts.map +1 -1
  18. package/dist/coordination/broker.js +13 -6
  19. package/dist/coordination/broker.js.map +1 -1
  20. package/dist/coordination/operation.d.ts +1 -0
  21. package/dist/coordination/operation.d.ts.map +1 -1
  22. package/dist/coordination/operation.js +55 -3
  23. package/dist/coordination/operation.js.map +1 -1
  24. package/dist/coordination/resource.d.ts +1 -1
  25. package/dist/coordination/resource.d.ts.map +1 -1
  26. package/dist/coordination/resource.js +10 -4
  27. package/dist/coordination/resource.js.map +1 -1
  28. package/dist/coordination/types.d.ts.map +1 -1
  29. package/dist/coordination/types.js +1 -1
  30. package/dist/coordination/types.js.map +1 -1
  31. package/dist/core/adaptorch-bridge.d.ts +1 -1
  32. package/dist/core/adaptorch-bridge.d.ts.map +1 -1
  33. package/dist/core/adaptorch-bridge.js +1 -1
  34. package/dist/core/adaptorch-bridge.js.map +1 -1
  35. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  36. package/dist/core/agent-session-runtime.js +16 -16
  37. package/dist/core/agent-session-runtime.js.map +1 -1
  38. package/dist/core/agent-session.d.ts.map +1 -1
  39. package/dist/core/agent-session.js +32 -33
  40. package/dist/core/agent-session.js.map +1 -1
  41. package/dist/core/canonical-json.d.ts +3 -0
  42. package/dist/core/canonical-json.d.ts.map +1 -0
  43. package/dist/core/canonical-json.js +20 -0
  44. package/dist/core/canonical-json.js.map +1 -0
  45. package/dist/core/compaction/compaction.d.ts +7 -3
  46. package/dist/core/compaction/compaction.d.ts.map +1 -1
  47. package/dist/core/compaction/compaction.js +14 -29
  48. package/dist/core/compaction/compaction.js.map +1 -1
  49. package/dist/core/compaction/fallback.d.ts +16 -5
  50. package/dist/core/compaction/fallback.d.ts.map +1 -1
  51. package/dist/core/compaction/fallback.js +4 -3
  52. package/dist/core/compaction/fallback.js.map +1 -1
  53. package/dist/core/compaction/model-failover.d.ts +21 -0
  54. package/dist/core/compaction/model-failover.d.ts.map +1 -0
  55. package/dist/core/compaction/model-failover.js +46 -0
  56. package/dist/core/compaction/model-failover.js.map +1 -0
  57. package/dist/core/compaction/session-summary.d.ts +21 -0
  58. package/dist/core/compaction/session-summary.d.ts.map +1 -0
  59. package/dist/core/compaction/session-summary.js +27 -0
  60. package/dist/core/compaction/session-summary.js.map +1 -0
  61. package/dist/core/export-html/template.js +14 -0
  62. package/dist/core/extensions/index.d.ts +1 -1
  63. package/dist/core/extensions/index.d.ts.map +1 -1
  64. package/dist/core/extensions/index.js.map +1 -1
  65. package/dist/core/extensions/session-lifecycle-types.d.ts +14 -0
  66. package/dist/core/extensions/session-lifecycle-types.d.ts.map +1 -0
  67. package/dist/core/extensions/session-lifecycle-types.js +2 -0
  68. package/dist/core/extensions/session-lifecycle-types.js.map +1 -0
  69. package/dist/core/extensions/types.d.ts +4 -9
  70. package/dist/core/extensions/types.d.ts.map +1 -1
  71. package/dist/core/extensions/types.js.map +1 -1
  72. package/dist/core/http-dispatcher.d.ts.map +1 -1
  73. package/dist/core/http-dispatcher.js +10 -1
  74. package/dist/core/http-dispatcher.js.map +1 -1
  75. package/dist/core/keybindings.d.ts.map +1 -1
  76. package/dist/core/keybindings.js +3 -6
  77. package/dist/core/keybindings.js.map +1 -1
  78. package/dist/core/legacy-resource-policy.d.ts +7 -0
  79. package/dist/core/legacy-resource-policy.d.ts.map +1 -0
  80. package/dist/core/legacy-resource-policy.js +9 -0
  81. package/dist/core/legacy-resource-policy.js.map +1 -0
  82. package/dist/core/mcp/config.d.ts.map +1 -1
  83. package/dist/core/mcp/config.js +17 -3
  84. package/dist/core/mcp/config.js.map +1 -1
  85. package/dist/core/mcp/connection-queue.d.ts +12 -0
  86. package/dist/core/mcp/connection-queue.d.ts.map +1 -0
  87. package/dist/core/mcp/connection-queue.js +46 -0
  88. package/dist/core/mcp/connection-queue.js.map +1 -0
  89. package/dist/core/mcp/manager-runtime.d.ts +55 -0
  90. package/dist/core/mcp/manager-runtime.d.ts.map +1 -0
  91. package/dist/core/mcp/manager-runtime.js +66 -0
  92. package/dist/core/mcp/manager-runtime.js.map +1 -0
  93. package/dist/core/mcp/manager.d.ts +12 -68
  94. package/dist/core/mcp/manager.d.ts.map +1 -1
  95. package/dist/core/mcp/manager.js +33 -113
  96. package/dist/core/mcp/manager.js.map +1 -1
  97. package/dist/core/mcp/protocol.d.ts.map +1 -1
  98. package/dist/core/mcp/protocol.js +70 -40
  99. package/dist/core/mcp/protocol.js.map +1 -1
  100. package/dist/core/package-manager.d.ts +4 -0
  101. package/dist/core/package-manager.d.ts.map +1 -1
  102. package/dist/core/package-manager.js +59 -129
  103. package/dist/core/package-manager.js.map +1 -1
  104. package/dist/core/package-resource-patterns.d.ts +7 -0
  105. package/dist/core/package-resource-patterns.d.ts.map +1 -0
  106. package/dist/core/package-resource-patterns.js +99 -0
  107. package/dist/core/package-resource-patterns.js.map +1 -0
  108. package/dist/core/provider-resilience.d.ts +9 -0
  109. package/dist/core/provider-resilience.d.ts.map +1 -1
  110. package/dist/core/provider-resilience.js +15 -0
  111. package/dist/core/provider-resilience.js.map +1 -1
  112. package/dist/core/reasoning-router-v4.d.ts +5 -2
  113. package/dist/core/reasoning-router-v4.d.ts.map +1 -1
  114. package/dist/core/reasoning-router-v4.js.map +1 -1
  115. package/dist/core/resource-loader.d.ts.map +1 -1
  116. package/dist/core/resource-loader.js +4 -8
  117. package/dist/core/resource-loader.js.map +1 -1
  118. package/dist/core/run-execution-api.d.ts +8 -1
  119. package/dist/core/run-execution-api.d.ts.map +1 -1
  120. package/dist/core/run-execution-api.js +4 -0
  121. package/dist/core/run-execution-api.js.map +1 -1
  122. package/dist/core/run-journal.d.ts +1 -2
  123. package/dist/core/run-journal.d.ts.map +1 -1
  124. package/dist/core/run-journal.js +2 -19
  125. package/dist/core/run-journal.js.map +1 -1
  126. package/dist/core/session-listing.d.ts +51 -0
  127. package/dist/core/session-listing.d.ts.map +1 -0
  128. package/dist/core/session-listing.js +111 -0
  129. package/dist/core/session-listing.js.map +1 -0
  130. package/dist/core/session-manager.d.ts +12 -37
  131. package/dist/core/session-manager.d.ts.map +1 -1
  132. package/dist/core/session-manager.js +12 -118
  133. package/dist/core/session-manager.js.map +1 -1
  134. package/dist/core/session-message-text.d.ts +5 -0
  135. package/dist/core/session-message-text.d.ts.map +1 -0
  136. package/dist/core/session-message-text.js +9 -0
  137. package/dist/core/session-message-text.js.map +1 -0
  138. package/dist/core/skills-catalog-cache.d.ts +2 -0
  139. package/dist/core/skills-catalog-cache.d.ts.map +1 -1
  140. package/dist/core/skills-catalog-cache.js +71 -17
  141. package/dist/core/skills-catalog-cache.js.map +1 -1
  142. package/dist/core/tools/read.d.ts.map +1 -1
  143. package/dist/core/tools/read.js +1 -1
  144. package/dist/core/tools/read.js.map +1 -1
  145. package/dist/core/verified-run/authority-clock.d.ts +3 -0
  146. package/dist/core/verified-run/authority-clock.d.ts.map +1 -0
  147. package/dist/core/verified-run/authority-clock.js +25 -0
  148. package/dist/core/verified-run/authority-clock.js.map +1 -0
  149. package/dist/core/verified-run/authority-errors.d.ts +10 -0
  150. package/dist/core/verified-run/authority-errors.d.ts.map +1 -0
  151. package/dist/core/verified-run/authority-errors.js +17 -0
  152. package/dist/core/verified-run/authority-errors.js.map +1 -0
  153. package/dist/core/verified-run/authority-events.d.ts +126 -0
  154. package/dist/core/verified-run/authority-events.d.ts.map +1 -0
  155. package/dist/core/verified-run/authority-events.js +482 -0
  156. package/dist/core/verified-run/authority-events.js.map +1 -0
  157. package/dist/core/verified-run/authority-journal.d.ts +27 -0
  158. package/dist/core/verified-run/authority-journal.d.ts.map +1 -0
  159. package/dist/core/verified-run/authority-journal.js +83 -0
  160. package/dist/core/verified-run/authority-journal.js.map +1 -0
  161. package/dist/core/verified-run/authority-meaning.d.ts +13 -0
  162. package/dist/core/verified-run/authority-meaning.d.ts.map +1 -0
  163. package/dist/core/verified-run/authority-meaning.js +40 -0
  164. package/dist/core/verified-run/authority-meaning.js.map +1 -0
  165. package/dist/core/verified-run/authority-runtime.d.ts +82 -0
  166. package/dist/core/verified-run/authority-runtime.d.ts.map +1 -0
  167. package/dist/core/verified-run/authority-runtime.js +169 -0
  168. package/dist/core/verified-run/authority-runtime.js.map +1 -0
  169. package/dist/core/verified-run/authority-store.d.ts +204 -0
  170. package/dist/core/verified-run/authority-store.d.ts.map +1 -0
  171. package/dist/core/verified-run/authority-store.js +852 -0
  172. package/dist/core/verified-run/authority-store.js.map +1 -0
  173. package/dist/core/verified-run/broker.d.ts +8 -1
  174. package/dist/core/verified-run/broker.d.ts.map +1 -1
  175. package/dist/core/verified-run/broker.js +94 -90
  176. package/dist/core/verified-run/broker.js.map +1 -1
  177. package/dist/core/verified-run/candidate-policy.d.ts +10 -0
  178. package/dist/core/verified-run/candidate-policy.d.ts.map +1 -0
  179. package/dist/core/verified-run/candidate-policy.js +33 -0
  180. package/dist/core/verified-run/candidate-policy.js.map +1 -0
  181. package/dist/core/verified-run/candidate.d.ts.map +1 -1
  182. package/dist/core/verified-run/candidate.js +5 -10
  183. package/dist/core/verified-run/candidate.js.map +1 -1
  184. package/dist/core/verified-run/coordinator.d.ts +35 -17
  185. package/dist/core/verified-run/coordinator.d.ts.map +1 -1
  186. package/dist/core/verified-run/coordinator.js +111 -57
  187. package/dist/core/verified-run/coordinator.js.map +1 -1
  188. package/dist/core/verified-run/dag-phase.d.ts.map +1 -1
  189. package/dist/core/verified-run/dag-phase.js +1 -1
  190. package/dist/core/verified-run/dag-phase.js.map +1 -1
  191. package/dist/core/verified-run/dag-recovery.d.ts +5 -1
  192. package/dist/core/verified-run/dag-recovery.d.ts.map +1 -1
  193. package/dist/core/verified-run/dag-recovery.js +10 -4
  194. package/dist/core/verified-run/dag-recovery.js.map +1 -1
  195. package/dist/core/verified-run/event-parser.d.ts.map +1 -1
  196. package/dist/core/verified-run/event-parser.js +33 -0
  197. package/dist/core/verified-run/event-parser.js.map +1 -1
  198. package/dist/core/verified-run/evidence-read-projection.d.ts +4 -0
  199. package/dist/core/verified-run/evidence-read-projection.d.ts.map +1 -0
  200. package/dist/core/verified-run/evidence-read-projection.js +27 -0
  201. package/dist/core/verified-run/evidence-read-projection.js.map +1 -0
  202. package/dist/core/verified-run/evidence.d.ts +12 -1
  203. package/dist/core/verified-run/evidence.d.ts.map +1 -1
  204. package/dist/core/verified-run/evidence.js +51 -2
  205. package/dist/core/verified-run/evidence.js.map +1 -1
  206. package/dist/core/verified-run/git-candidate-preflight.d.ts +4 -0
  207. package/dist/core/verified-run/git-candidate-preflight.d.ts.map +1 -0
  208. package/dist/core/verified-run/git-candidate-preflight.js +34 -0
  209. package/dist/core/verified-run/git-candidate-preflight.js.map +1 -0
  210. package/dist/core/verified-run/git-effect-supervisor.d.ts +24 -0
  211. package/dist/core/verified-run/git-effect-supervisor.d.ts.map +1 -0
  212. package/dist/core/verified-run/git-effect-supervisor.js +174 -0
  213. package/dist/core/verified-run/git-effect-supervisor.js.map +1 -0
  214. package/dist/core/verified-run/git-execution.d.ts +27 -0
  215. package/dist/core/verified-run/git-execution.d.ts.map +1 -0
  216. package/dist/core/verified-run/git-execution.js +118 -0
  217. package/dist/core/verified-run/git-execution.js.map +1 -0
  218. package/dist/core/verified-run/git-plumbing.d.ts +37 -0
  219. package/dist/core/verified-run/git-plumbing.d.ts.map +1 -0
  220. package/dist/core/verified-run/git-plumbing.js +171 -0
  221. package/dist/core/verified-run/git-plumbing.js.map +1 -0
  222. package/dist/core/verified-run/git-publication-worker.d.ts +2 -0
  223. package/dist/core/verified-run/git-publication-worker.d.ts.map +1 -0
  224. package/dist/core/verified-run/git-publication-worker.js +54 -0
  225. package/dist/core/verified-run/git-publication-worker.js.map +1 -0
  226. package/dist/core/verified-run/git-sandbox-layout.d.ts +4 -0
  227. package/dist/core/verified-run/git-sandbox-layout.d.ts.map +1 -0
  228. package/dist/core/verified-run/git-sandbox-layout.js +29 -0
  229. package/dist/core/verified-run/git-sandbox-layout.js.map +1 -0
  230. package/dist/core/verified-run/git-worker-protocol.d.ts +19 -0
  231. package/dist/core/verified-run/git-worker-protocol.d.ts.map +1 -0
  232. package/dist/core/verified-run/git-worker-protocol.js +109 -0
  233. package/dist/core/verified-run/git-worker-protocol.js.map +1 -0
  234. package/dist/core/verified-run/git-worker-runtime.d.ts +19 -0
  235. package/dist/core/verified-run/git-worker-runtime.d.ts.map +1 -0
  236. package/dist/core/verified-run/git-worker-runtime.js +74 -0
  237. package/dist/core/verified-run/git-worker-runtime.js.map +1 -0
  238. package/dist/core/verified-run/journal.d.ts +2 -3
  239. package/dist/core/verified-run/journal.d.ts.map +1 -1
  240. package/dist/core/verified-run/journal.js.map +1 -1
  241. package/dist/core/verified-run/namespace-identity.d.ts.map +1 -1
  242. package/dist/core/verified-run/namespace-identity.js +1 -1
  243. package/dist/core/verified-run/namespace-identity.js.map +1 -1
  244. package/dist/core/verified-run/owned-execution.d.ts +10 -1
  245. package/dist/core/verified-run/owned-execution.d.ts.map +1 -1
  246. package/dist/core/verified-run/owned-execution.js +124 -31
  247. package/dist/core/verified-run/owned-execution.js.map +1 -1
  248. package/dist/core/verified-run/phase-context.d.ts +2 -0
  249. package/dist/core/verified-run/phase-context.d.ts.map +1 -1
  250. package/dist/core/verified-run/phase-context.js.map +1 -1
  251. package/dist/core/verified-run/projection.d.ts.map +1 -1
  252. package/dist/core/verified-run/projection.js +51 -1
  253. package/dist/core/verified-run/projection.js.map +1 -1
  254. package/dist/core/verified-run/publish-preflight.d.ts +12 -0
  255. package/dist/core/verified-run/publish-preflight.d.ts.map +1 -0
  256. package/dist/core/verified-run/publish-preflight.js +38 -0
  257. package/dist/core/verified-run/publish-preflight.js.map +1 -0
  258. package/dist/core/verified-run/publish-start.d.ts +5 -0
  259. package/dist/core/verified-run/publish-start.d.ts.map +1 -0
  260. package/dist/core/verified-run/publish-start.js +7 -0
  261. package/dist/core/verified-run/publish-start.js.map +1 -0
  262. package/dist/core/verified-run/recovery-projection.d.ts.map +1 -1
  263. package/dist/core/verified-run/recovery-projection.js +5 -0
  264. package/dist/core/verified-run/recovery-projection.js.map +1 -1
  265. package/dist/core/verified-run/recovery.d.ts +5 -1
  266. package/dist/core/verified-run/recovery.d.ts.map +1 -1
  267. package/dist/core/verified-run/recovery.js +10 -4
  268. package/dist/core/verified-run/recovery.js.map +1 -1
  269. package/dist/core/verified-run/run-plan.d.ts +17 -0
  270. package/dist/core/verified-run/run-plan.d.ts.map +1 -0
  271. package/dist/core/verified-run/run-plan.js +18 -0
  272. package/dist/core/verified-run/run-plan.js.map +1 -0
  273. package/dist/core/verified-run/run-publish-owned.d.ts +6 -0
  274. package/dist/core/verified-run/run-publish-owned.d.ts.map +1 -0
  275. package/dist/core/verified-run/run-publish-owned.js +199 -0
  276. package/dist/core/verified-run/run-publish-owned.js.map +1 -0
  277. package/dist/core/verified-run/run-publish.d.ts +19 -0
  278. package/dist/core/verified-run/run-publish.d.ts.map +1 -0
  279. package/dist/core/verified-run/run-publish.js +210 -0
  280. package/dist/core/verified-run/run-publish.js.map +1 -0
  281. package/dist/core/verified-run/run-status-owned.d.ts +4 -0
  282. package/dist/core/verified-run/run-status-owned.d.ts.map +1 -0
  283. package/dist/core/verified-run/run-status-owned.js +14 -0
  284. package/dist/core/verified-run/run-status-owned.js.map +1 -0
  285. package/dist/core/verified-run/run-status.d.ts +133 -0
  286. package/dist/core/verified-run/run-status.d.ts.map +1 -0
  287. package/dist/core/verified-run/run-status.js +193 -0
  288. package/dist/core/verified-run/run-status.js.map +1 -0
  289. package/dist/core/verified-run/run-types.d.ts +31 -0
  290. package/dist/core/verified-run/run-types.d.ts.map +1 -1
  291. package/dist/core/verified-run/run-types.js.map +1 -1
  292. package/dist/core/verified-run/storage.d.ts.map +1 -1
  293. package/dist/core/verified-run/storage.js +1 -1
  294. package/dist/core/verified-run/storage.js.map +1 -1
  295. package/dist/core/verified-run/supervisor-adapter.d.ts +77 -0
  296. package/dist/core/verified-run/supervisor-adapter.d.ts.map +1 -0
  297. package/dist/core/verified-run/supervisor-adapter.js +164 -0
  298. package/dist/core/verified-run/supervisor-adapter.js.map +1 -0
  299. package/dist/core/verified-run/verification-phase.d.ts.map +1 -1
  300. package/dist/core/verified-run/verification-phase.js +1 -1
  301. package/dist/core/verified-run/verification-phase.js.map +1 -1
  302. package/dist/core/verified-run/writer-phase.d.ts.map +1 -1
  303. package/dist/core/verified-run/writer-phase.js +1 -0
  304. package/dist/core/verified-run/writer-phase.js.map +1 -1
  305. package/dist/core/verified-run/writer-recovery.d.ts +2 -0
  306. package/dist/core/verified-run/writer-recovery.d.ts.map +1 -1
  307. package/dist/core/verified-run/writer-recovery.js +1 -0
  308. package/dist/core/verified-run/writer-recovery.js.map +1 -1
  309. package/dist/core/workload-shard-execution-types.d.ts +4 -1
  310. package/dist/core/workload-shard-execution-types.d.ts.map +1 -1
  311. package/dist/core/workload-shard-execution-types.js.map +1 -1
  312. package/dist/core/workload-shard-executor.d.ts +2 -2
  313. package/dist/core/workload-shard-executor.d.ts.map +1 -1
  314. package/dist/core/workload-shard-executor.js +16 -37
  315. package/dist/core/workload-shard-executor.js.map +1 -1
  316. package/dist/core/workload-shard-frontier.d.ts +5 -0
  317. package/dist/core/workload-shard-frontier.d.ts.map +1 -0
  318. package/dist/core/workload-shard-frontier.js +47 -0
  319. package/dist/core/workload-shard-frontier.js.map +1 -0
  320. package/dist/core/workload-shard-runner.d.ts.map +1 -1
  321. package/dist/core/workload-shard-runner.js +28 -17
  322. package/dist/core/workload-shard-runner.js.map +1 -1
  323. package/dist/index.d.ts +2 -5
  324. package/dist/index.d.ts.map +1 -1
  325. package/dist/index.js +1 -4
  326. package/dist/index.js.map +1 -1
  327. package/dist/main.d.ts.map +1 -1
  328. package/dist/main.js +2 -1
  329. package/dist/main.js.map +1 -1
  330. package/dist/metacognition/bridge-result.d.ts +148 -0
  331. package/dist/metacognition/bridge-result.d.ts.map +1 -0
  332. package/dist/metacognition/bridge-result.js +46 -0
  333. package/dist/metacognition/bridge-result.js.map +1 -0
  334. package/dist/metacognition/calibration-selective.d.ts.map +1 -1
  335. package/dist/metacognition/calibration-selective.js +8 -2
  336. package/dist/metacognition/calibration-selective.js.map +1 -1
  337. package/dist/metacognition/index.d.ts +1 -0
  338. package/dist/metacognition/index.d.ts.map +1 -1
  339. package/dist/metacognition/index.js +1 -0
  340. package/dist/metacognition/index.js.map +1 -1
  341. package/dist/metacognition/risk.d.ts.map +1 -1
  342. package/dist/metacognition/risk.js +28 -14
  343. package/dist/metacognition/risk.js.map +1 -1
  344. package/dist/metacognition/runtime-bridge.d.ts +41 -14
  345. package/dist/metacognition/runtime-bridge.d.ts.map +1 -1
  346. package/dist/metacognition/runtime-bridge.js +357 -39
  347. package/dist/metacognition/runtime-bridge.js.map +1 -1
  348. package/dist/modes/interactive/components/assistant-message.d.ts +2 -0
  349. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  350. package/dist/modes/interactive/components/assistant-message.js +42 -26
  351. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  352. package/dist/modes/interactive/components/chat-container.d.ts +7 -0
  353. package/dist/modes/interactive/components/chat-container.d.ts.map +1 -0
  354. package/dist/modes/interactive/components/chat-container.js +14 -0
  355. package/dist/modes/interactive/components/chat-container.js.map +1 -0
  356. package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
  357. package/dist/modes/interactive/components/dynamic-border.js +4 -2
  358. package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
  359. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  360. package/dist/modes/interactive/components/login-dialog.js +0 -1
  361. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  362. package/dist/modes/interactive/components/session-selector-async-search.d.ts +33 -0
  363. package/dist/modes/interactive/components/session-selector-async-search.d.ts.map +1 -0
  364. package/dist/modes/interactive/components/session-selector-async-search.js +109 -0
  365. package/dist/modes/interactive/components/session-selector-async-search.js.map +1 -0
  366. package/dist/modes/interactive/components/session-selector-loaders.d.ts +6 -0
  367. package/dist/modes/interactive/components/session-selector-loaders.d.ts.map +1 -0
  368. package/dist/modes/interactive/components/session-selector-loaders.js +9 -0
  369. package/dist/modes/interactive/components/session-selector-loaders.js.map +1 -0
  370. package/dist/modes/interactive/components/session-selector-search.d.ts +1 -1
  371. package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
  372. package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
  373. package/dist/modes/interactive/components/session-selector-tree.d.ts +16 -0
  374. package/dist/modes/interactive/components/session-selector-tree.d.ts.map +1 -0
  375. package/dist/modes/interactive/components/session-selector-tree.js +46 -0
  376. package/dist/modes/interactive/components/session-selector-tree.js.map +1 -0
  377. package/dist/modes/interactive/components/session-selector.d.ts +6 -1
  378. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  379. package/dist/modes/interactive/components/session-selector.js +36 -76
  380. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  381. package/dist/modes/interactive/components/tool-execution-images.d.ts +32 -0
  382. package/dist/modes/interactive/components/tool-execution-images.d.ts.map +1 -0
  383. package/dist/modes/interactive/components/tool-execution-images.js +144 -0
  384. package/dist/modes/interactive/components/tool-execution-images.js.map +1 -0
  385. package/dist/modes/interactive/components/tool-execution.d.ts +3 -4
  386. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  387. package/dist/modes/interactive/components/tool-execution.js +22 -71
  388. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  389. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  390. package/dist/modes/interactive/interactive-mode.js +7 -9
  391. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  392. package/dist/modes/interactive/tui-diagnostics.d.ts +8 -4
  393. package/dist/modes/interactive/tui-diagnostics.d.ts.map +1 -1
  394. package/dist/modes/interactive/tui-diagnostics.js +35 -1
  395. package/dist/modes/interactive/tui-diagnostics.js.map +1 -1
  396. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  397. package/dist/modes/rpc/rpc-mode.js +14 -17
  398. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  399. package/dist/modes/rpc/rpc-response.d.ts +5 -0
  400. package/dist/modes/rpc/rpc-response.d.ts.map +1 -0
  401. package/dist/modes/rpc/rpc-response.js +17 -0
  402. package/dist/modes/rpc/rpc-response.js.map +1 -0
  403. package/dist/utils/exif-orientation.d.ts.map +1 -1
  404. package/dist/utils/exif-orientation.js +2 -3
  405. package/dist/utils/exif-orientation.js.map +1 -1
  406. package/dist/utils/tools-manager.d.ts.map +1 -1
  407. package/dist/utils/tools-manager.js +3 -5
  408. package/dist/utils/tools-manager.js.map +1 -1
  409. package/docs/adaptorch-preview-spec.md +7 -7
  410. package/docs/atomic-commit-planning.md +69 -0
  411. package/docs/compaction.md +26 -1
  412. package/docs/extensions.md +14 -0
  413. package/docs/mcp.md +22 -0
  414. package/docs/metacognition.md +79 -0
  415. package/docs/model-catalog-refresh.md +159 -1
  416. package/docs/models.md +1 -1
  417. package/docs/runtime-algorithms.md +49 -4
  418. package/docs/session-format.md +8 -0
  419. package/docs/sessions.md +19 -0
  420. package/docs/skills.md +19 -0
  421. package/docs/terminal-setup.md +15 -0
  422. package/docs/tui.md +41 -0
  423. package/docs/verified-run-safety.md +75 -0
  424. package/examples/extensions/custom-provider-anthropic/index.ts +1 -1
  425. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  426. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  427. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  428. package/examples/extensions/doom-overlay/wad-finder.ts +7 -3
  429. package/examples/extensions/gondolin/package-lock.json +2 -2
  430. package/examples/extensions/gondolin/package.json +1 -1
  431. package/examples/extensions/sandbox/package-lock.json +2 -2
  432. package/examples/extensions/sandbox/package.json +1 -1
  433. package/examples/extensions/with-deps/package-lock.json +2 -2
  434. package/examples/extensions/with-deps/package.json +1 -1
  435. package/npm-shrinkwrap.json +18 -18
  436. package/package.json +6 -8
@@ -1 +1 @@
1
- {"version":3,"file":"tools-manager.js","sourceRoot":"","sources":["../../src/utils/tools-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAyB,SAAS,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC1G,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,SAAS,GAAG,SAAS,EAAE,CAAC;AAC9B,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAEpC,SAAS,oBAAoB,GAAY;IACxC,MAAM,KAAK,G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BAAsB,MAAM,CAAC,IAAI,KAAK,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACvG,CAAC;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;AAAA,CACD","sourcesContent":["import chalk from \"chalk\";\nimport { type SpawnSyncReturns, spawnSync } from \"child_process\";\nimport { chmodSync, createWriteStream, existsSync, mkdirSync, readdirSync, renameSync, rmSync } from \"fs\";\nimport { arch, platform } from \"os\";\nimport { join } from \"path\";\nimport { Readable } from \"stream\";\nimport { pipeline } from \"stream/promises\";\nimport { APP_NAME, getBinDir } from \"../config.ts\";\n\nconst TOOLS_DIR = getBinDir();\nconst NETWORK_TIMEOUT_MS = 10_000;\nconst DOWNLOAD_TIMEOUT_MS = 120_000;\n\nfunction isOfflineModeEnabled(): boolean {\n\tconst value = process.env.OMK_OFFLINE;\n\tif (!value) return false;\n\treturn value === \"1\" || value.toLowerCase() === \"true\" || value.toLowerCase() === \"yes\";\n}\n\nexport type ManagedTool = \"fd\" | \"rg\" | \"codexbar\";\n\ninterface ToolConfig {\n\treadonly name: string;\n\treadonly repo?: string; // GitHub repo (e.g., \"sharkdp/fd\") when auto-download is supported\n\treadonly binaryName: string; // Name of the binary inside the archive\n\treadonly systemBinaryNames?: readonly string[]; // Alternative system command names to try before downloading\n\treadonly preferSystemBinary?: boolean;\n\treadonly tagPrefix?: string; // Prefix for tags (e.g., \"v\" for v1.0.0, \"\" for 1.0.0)\n\treadonly getAssetName: (version: string, plat: string, architecture: string) => string | null;\n\treadonly downloadUnsupportedMessage?: string;\n}\n\nconst TOOLS: Record<ManagedTool, ToolConfig> = {\n\tfd: {\n\t\tname: \"fd\",\n\t\trepo: \"sharkdp/fd\",\n\t\tbinaryName: \"fd\",\n\t\tsystemBinaryNames: [\"fd\", \"fdfind\"],\n\t\ttagPrefix: \"v\",\n\t\tgetAssetName: (version, plat, architecture) => {\n\t\t\tif (plat === \"darwin\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `fd-v${version}-${archStr}-apple-darwin.tar.gz`;\n\t\t\t} else if (plat === \"linux\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `fd-v${version}-${archStr}-unknown-linux-gnu.tar.gz`;\n\t\t\t} else if (plat === \"win32\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `fd-v${version}-${archStr}-pc-windows-msvc.zip`;\n\t\t\t}\n\t\t\treturn null;\n\t\t},\n\t},\n\trg: {\n\t\tname: \"ripgrep\",\n\t\trepo: \"BurntSushi/ripgrep\",\n\t\tbinaryName: \"rg\",\n\t\ttagPrefix: \"\",\n\t\tgetAssetName: (version, plat, architecture) => {\n\t\t\tif (plat === \"darwin\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `ripgrep-${version}-${archStr}-apple-darwin.tar.gz`;\n\t\t\t} else if (plat === \"linux\") {\n\t\t\t\tif (architecture === \"arm64\") {\n\t\t\t\t\treturn `ripgrep-${version}-aarch64-unknown-linux-gnu.tar.gz`;\n\t\t\t\t}\n\t\t\t\treturn `ripgrep-${version}-x86_64-unknown-linux-musl.tar.gz`;\n\t\t\t} else if (plat === \"win32\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `ripgrep-${version}-${archStr}-pc-windows-msvc.zip`;\n\t\t\t}\n\t\t\treturn null;\n\t\t},\n\t},\n\tcodexbar: {\n\t\tname: \"CodexBar\",\n\t\tbinaryName: \"codexbar\",\n\t\tsystemBinaryNames: [\"codexbar\"],\n\t\tpreferSystemBinary: true,\n\t\tgetAssetName: () => null,\n\t\tdownloadUnsupportedMessage: \"CodexBar auto-download is not configured; install codexbar on PATH.\",\n\t},\n};\n\n// Check if a command exists in PATH by trying to run it\nfunction commandExists(cmd: string): boolean {\n\ttry {\n\t\tconst result = spawnSync(cmd, [\"--version\"], { stdio: \"pipe\" });\n\t\t// Check for ENOENT error (command not found)\n\t\treturn result.error === undefined || result.error === null;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n// Get the path to a tool (system-wide or in our tools dir)\nexport function getToolPath(tool: ManagedTool): string | null {\n\tconst config = TOOLS[tool];\n\tconst systemBinaryNames = config.systemBinaryNames ?? [config.binaryName];\n\tconst getSystemPath = (): string | null => {\n\t\tfor (const systemBinaryName of systemBinaryNames) {\n\t\t\tif (commandExists(systemBinaryName)) {\n\t\t\t\treturn systemBinaryName;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t};\n\n\tif (config.preferSystemBinary) {\n\t\tconst systemPath = getSystemPath();\n\t\tif (systemPath) return systemPath;\n\t}\n\n\tconst localPath = join(TOOLS_DIR, config.binaryName + (platform() === \"win32\" ? \".exe\" : \"\"));\n\tif (existsSync(localPath)) {\n\t\treturn localPath;\n\t}\n\n\treturn config.preferSystemBinary ? null : getSystemPath();\n}\n\n// Fetch latest release version from GitHub\nasync function getLatestVersion(repo: string): Promise<string> {\n\tconst response = await fetch(`https://api.github.com/repos/${repo}/releases/latest`, {\n\t\theaders: { \"User-Agent\": `${APP_NAME}-coding-agent` },\n\t\tsignal: AbortSignal.timeout(NETWORK_TIMEOUT_MS),\n\t});\n\n\tif (!response.ok) {\n\t\tthrow new Error(`GitHub API error: ${response.status}`);\n\t}\n\n\tconst data = (await response.json()) as { tag_name: string };\n\treturn data.tag_name.replace(/^v/, \"\");\n}\n\n// Download a file from URL\nasync function downloadFile(url: string, dest: string): Promise<void> {\n\tconst response = await fetch(url, {\n\t\tsignal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS),\n\t});\n\n\tif (!response.ok) {\n\t\tthrow new Error(`Failed to download: ${response.status}`);\n\t}\n\n\tif (!response.body) {\n\t\tthrow new Error(\"No response body\");\n\t}\n\n\tconst fileStream = createWriteStream(dest);\n\tawait pipeline(Readable.fromWeb(response.body as any), fileStream);\n}\n\nfunction findBinaryRecursively(rootDir: string, binaryFileName: string): string | null {\n\tconst stack: string[] = [rootDir];\n\n\twhile (stack.length > 0) {\n\t\tconst currentDir = stack.pop();\n\t\tif (!currentDir) continue;\n\n\t\tconst entries = readdirSync(currentDir, { withFileTypes: true });\n\t\tfor (const entry of entries) {\n\t\t\tconst fullPath = join(currentDir, entry.name);\n\t\t\tif (entry.isFile() && entry.name === binaryFileName) {\n\t\t\t\treturn fullPath;\n\t\t\t}\n\t\t\tif (entry.isDirectory()) {\n\t\t\t\tstack.push(fullPath);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null;\n}\n\nfunction formatSpawnFailure(result: SpawnSyncReturns<Buffer>): string {\n\tif (result.error?.message) {\n\t\treturn result.error.message;\n\t}\n\tconst stderr = result.stderr?.toString().trim();\n\tif (stderr) {\n\t\treturn stderr;\n\t}\n\tconst stdout = result.stdout?.toString().trim();\n\tif (stdout) {\n\t\treturn stdout;\n\t}\n\treturn `exit status ${result.status ?? \"unknown\"}`;\n}\n\nfunction runExtractionCommand(command: string, args: string[]): string | null {\n\tconst result = spawnSync(command, args, { stdio: \"pipe\" });\n\tif (!result.error && result.status === 0) {\n\t\treturn null;\n\t}\n\treturn `${command}: ${formatSpawnFailure(result)}`;\n}\n\nfunction extractTarGzArchive(archivePath: string, extractDir: string, assetName: string): void {\n\tconst failure = runExtractionCommand(\"tar\", [\"xzf\", archivePath, \"-C\", extractDir]);\n\tif (failure) {\n\t\tthrow new Error(`Failed to extract ${assetName}: ${failure}`);\n\t}\n}\n\nfunction getWindowsTarCommand(): string {\n\tconst systemRoot = process.env.SystemRoot ?? process.env.WINDIR;\n\tif (systemRoot) {\n\t\tconst systemTar = join(systemRoot, \"System32\", \"tar.exe\");\n\t\tif (existsSync(systemTar)) {\n\t\t\treturn systemTar;\n\t\t}\n\t}\n\treturn \"tar.exe\";\n}\n\nfunction extractZipArchive(archivePath: string, extractDir: string, assetName: string): void {\n\tconst failures: string[] = [];\n\n\tif (platform() === \"win32\") {\n\t\t// Windows ships bsdtar as tar.exe, which supports zip files. Prefer the\n\t\t// System32 binary over Git Bash's GNU tar, which does not handle zip archives.\n\t\tconst tarFailure = runExtractionCommand(getWindowsTarCommand(), [\"xf\", archivePath, \"-C\", extractDir]);\n\t\tif (!tarFailure) return;\n\t\tfailures.push(tarFailure);\n\n\t\tconst script =\n\t\t\t\"& { param($archive, $destination) $ErrorActionPreference = 'Stop'; Expand-Archive -LiteralPath $archive -DestinationPath $destination -Force }\";\n\t\tconst powershellFailure = runExtractionCommand(\"powershell.exe\", [\n\t\t\t\"-NoLogo\",\n\t\t\t\"-NoProfile\",\n\t\t\t\"-NonInteractive\",\n\t\t\t\"-ExecutionPolicy\",\n\t\t\t\"Bypass\",\n\t\t\t\"-Command\",\n\t\t\tscript,\n\t\t\tarchivePath,\n\t\t\textractDir,\n\t\t]);\n\t\tif (!powershellFailure) return;\n\t\tfailures.push(powershellFailure);\n\t} else {\n\t\tconst unzipFailure = runExtractionCommand(\"unzip\", [\"-q\", archivePath, \"-d\", extractDir]);\n\t\tif (!unzipFailure) return;\n\t\tfailures.push(unzipFailure);\n\n\t\tconst tarFailure = runExtractionCommand(\"tar\", [\"xf\", archivePath, \"-C\", extractDir]);\n\t\tif (!tarFailure) return;\n\t\tfailures.push(tarFailure);\n\t}\n\n\tthrow new Error(`Failed to extract ${assetName}: ${failures.join(\"; \")}`);\n}\n\n// Download and install a tool\nasync function downloadTool(tool: ManagedTool): Promise<string> {\n\tconst config = TOOLS[tool];\n\tif (config.downloadUnsupportedMessage) {\n\t\tthrow new Error(config.downloadUnsupportedMessage);\n\t}\n\tif (!config.repo || config.tagPrefix === undefined) {\n\t\tthrow new Error(`${config.name} auto-download is not configured; install ${config.binaryName} on PATH.`);\n\t}\n\n\tconst plat = platform();\n\tconst architecture = arch();\n\n\t// Get latest version\n\tlet version = await getLatestVersion(config.repo);\n\tif (tool === \"fd\" && plat === \"darwin\" && architecture === \"x64\") {\n\t\tversion = \"10.3.0\";\n\t}\n\n\t// Get asset name for this platform\n\tconst assetName = config.getAssetName(version, plat, architecture);\n\tif (!assetName) {\n\t\tthrow new Error(`Unsupported platform: ${plat}/${architecture}`);\n\t}\n\n\t// Create tools directory\n\tmkdirSync(TOOLS_DIR, { recursive: true });\n\n\tconst downloadUrl = `https://github.com/${config.repo}/releases/download/${config.tagPrefix}${version}/${assetName}`;\n\tconst archivePath = join(TOOLS_DIR, assetName);\n\tconst binaryExt = plat === \"win32\" ? \".exe\" : \"\";\n\tconst binaryPath = join(TOOLS_DIR, config.binaryName + binaryExt);\n\n\t// Download\n\tawait downloadFile(downloadUrl, archivePath);\n\n\t// Extract into a unique temp directory. fd and rg downloads can run concurrently\n\t// during startup, so sharing a fixed directory causes races.\n\tconst extractDir = join(\n\t\tTOOLS_DIR,\n\t\t`extract_tmp_${config.binaryName}_${process.pid}_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`,\n\t);\n\tmkdirSync(extractDir, { recursive: true });\n\n\ttry {\n\t\tif (assetName.endsWith(\".tar.gz\")) {\n\t\t\textractTarGzArchive(archivePath, extractDir, assetName);\n\t\t} else if (assetName.endsWith(\".zip\")) {\n\t\t\textractZipArchive(archivePath, extractDir, assetName);\n\t\t} else {\n\t\t\tthrow new Error(`Unsupported archive format: ${assetName}`);\n\t\t}\n\n\t\t// Find the binary in extracted files. Some archives contain files directly\n\t\t// at root, others nest under a versioned subdirectory.\n\t\tconst binaryFileName = config.binaryName + binaryExt;\n\t\tconst extractedDir = join(extractDir, assetName.replace(/\\.(tar\\.gz|zip)$/, \"\"));\n\t\tconst extractedBinaryCandidates = [join(extractedDir, binaryFileName), join(extractDir, binaryFileName)];\n\t\tlet extractedBinary = extractedBinaryCandidates.find((candidate) => existsSync(candidate));\n\n\t\tif (!extractedBinary) {\n\t\t\textractedBinary = findBinaryRecursively(extractDir, binaryFileName) ?? undefined;\n\t\t}\n\n\t\tif (extractedBinary) {\n\t\t\trenameSync(extractedBinary, binaryPath);\n\t\t} else {\n\t\t\tthrow new Error(`Binary not found in archive: expected ${binaryFileName} under ${extractDir}`);\n\t\t}\n\n\t\t// Make executable (Unix only)\n\t\tif (plat !== \"win32\") {\n\t\t\tchmodSync(binaryPath, 0o755);\n\t\t}\n\t} finally {\n\t\t// Cleanup\n\t\trmSync(archivePath, { force: true });\n\t\trmSync(extractDir, { recursive: true, force: true });\n\t}\n\n\treturn binaryPath;\n}\n\n// Termux package names for tools\nconst TERMUX_PACKAGES: Partial<Record<ManagedTool, string>> = {\n\tfd: \"fd\",\n\trg: \"ripgrep\",\n};\n\n// Ensure a tool is available, downloading if necessary\n// Returns the path to the tool, or undefined if unavailable\nexport async function ensureTool(tool: ManagedTool, silent: boolean = false): Promise<string | undefined> {\n\tconst existingPath = getToolPath(tool);\n\tif (existingPath) {\n\t\treturn existingPath;\n\t}\n\n\tconst config = TOOLS[tool];\n\n\tif (isOfflineModeEnabled()) {\n\t\tif (!silent) {\n\t\t\tconsole.log(chalk.yellow(`${config.name} not found. Offline mode enabled, skipping download.`));\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t// On Android/Termux, Linux binaries don't work due to Bionic libc incompatibility.\n\t// Users must install via pkg.\n\tif (platform() === \"android\") {\n\t\tconst pkgName = TERMUX_PACKAGES[tool];\n\t\tif (!silent) {\n\t\t\tif (pkgName) {\n\t\t\t\tconsole.log(chalk.yellow(`${config.name} not found. Install with: pkg install ${pkgName}`));\n\t\t\t} else {\n\t\t\t\tconsole.log(\n\t\t\t\t\tchalk.yellow(\n\t\t\t\t\t\t`${config.name} not found. No Termux package is configured; install ${config.binaryName} on PATH.`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tif (config.downloadUnsupportedMessage) {\n\t\tif (!silent) {\n\t\t\tconsole.log(chalk.yellow(`${config.name} not found. ${config.downloadUnsupportedMessage}`));\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t// Tool not found - download it\n\tif (!silent) {\n\t\tconsole.log(chalk.dim(`${config.name} not found. Downloading...`));\n\t}\n\n\ttry {\n\t\tconst path = await downloadTool(tool);\n\t\tif (!silent) {\n\t\t\tconsole.log(chalk.dim(`${config.name} installed to ${path}`));\n\t\t}\n\t\treturn path;\n\t} catch (e) {\n\t\tif (!silent) {\n\t\t\tconsole.log(chalk.yellow(`Failed to download ${config.name}: ${e instanceof Error ? e.message : e}`));\n\t\t}\n\t\treturn undefined;\n\t}\n}\n"]}
1
+ {"version":3,"file":"tools-manager.js","sourceRoot":"","sources":["../../src/utils/tools-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAyB,SAAS,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC1G,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,SAAS,GAAG,SAAS,EAAE,CAAC;AAC9B,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAEpC,SAAS,oBAAoB,GAAY;IACxC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;IACtC,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACzB,OAAO,KAAK,KAAK,GAAG,IAAI,KAAK,CAA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AAC,CAAC;QACvG,CAAC;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;AAAA,CACD","sourcesContent":["import chalk from \"chalk\";\nimport { type SpawnSyncReturns, spawnSync } from \"child_process\";\nimport { chmodSync, createWriteStream, existsSync, mkdirSync, readdirSync, renameSync, rmSync } from \"fs\";\nimport { arch, platform } from \"os\";\nimport { join } from \"path\";\nimport { Readable } from \"stream\";\nimport { pipeline } from \"stream/promises\";\nimport { APP_NAME, getBinDir } from \"../config.ts\";\n\nconst TOOLS_DIR = getBinDir();\nconst NETWORK_TIMEOUT_MS = 10_000;\nconst DOWNLOAD_TIMEOUT_MS = 120_000;\n\nfunction isOfflineModeEnabled(): boolean {\n\tconst value = process.env.OMK_OFFLINE;\n\tif (!value) return false;\n\treturn value === \"1\" || value.toLowerCase() === \"true\" || value.toLowerCase() === \"yes\";\n}\n\nexport type ManagedTool = \"fd\" | \"rg\" | \"codexbar\";\n\ninterface ToolConfig {\n\treadonly name: string;\n\treadonly repo?: string; // GitHub repo (e.g., \"sharkdp/fd\") when auto-download is supported\n\treadonly binaryName: string; // Name of the binary inside the archive\n\treadonly systemBinaryNames?: readonly string[]; // Alternative system command names to try before downloading\n\treadonly preferSystemBinary?: boolean;\n\treadonly tagPrefix?: string; // Prefix for tags (e.g., \"v\" for v1.0.0, \"\" for 1.0.0)\n\treadonly getAssetName: (version: string, plat: string, architecture: string) => string | null;\n\treadonly downloadUnsupportedMessage?: string;\n}\n\nconst TOOLS: Record<ManagedTool, ToolConfig> = {\n\tfd: {\n\t\tname: \"fd\",\n\t\trepo: \"sharkdp/fd\",\n\t\tbinaryName: \"fd\",\n\t\tsystemBinaryNames: [\"fd\", \"fdfind\"],\n\t\ttagPrefix: \"v\",\n\t\tgetAssetName: (version, plat, architecture) => {\n\t\t\tif (plat === \"darwin\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `fd-v${version}-${archStr}-apple-darwin.tar.gz`;\n\t\t\t} else if (plat === \"linux\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `fd-v${version}-${archStr}-unknown-linux-musl.tar.gz`;\n\t\t\t} else if (plat === \"win32\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `fd-v${version}-${archStr}-pc-windows-msvc.zip`;\n\t\t\t}\n\t\t\treturn null;\n\t\t},\n\t},\n\trg: {\n\t\tname: \"ripgrep\",\n\t\trepo: \"BurntSushi/ripgrep\",\n\t\tbinaryName: \"rg\",\n\t\ttagPrefix: \"\",\n\t\tgetAssetName: (version, plat, architecture) => {\n\t\t\tif (plat === \"darwin\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `ripgrep-${version}-${archStr}-apple-darwin.tar.gz`;\n\t\t\t} else if (plat === \"linux\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `ripgrep-${version}-${archStr}-unknown-linux-musl.tar.gz`;\n\t\t\t} else if (plat === \"win32\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `ripgrep-${version}-${archStr}-pc-windows-msvc.zip`;\n\t\t\t}\n\t\t\treturn null;\n\t\t},\n\t},\n\tcodexbar: {\n\t\tname: \"CodexBar\",\n\t\tbinaryName: \"codexbar\",\n\t\tsystemBinaryNames: [\"codexbar\"],\n\t\tpreferSystemBinary: true,\n\t\tgetAssetName: () => null,\n\t\tdownloadUnsupportedMessage: \"CodexBar auto-download is not configured; install codexbar on PATH.\",\n\t},\n};\n\n// Check if a command exists in PATH by trying to run it\nfunction commandExists(cmd: string): boolean {\n\ttry {\n\t\tconst result = spawnSync(cmd, [\"--version\"], { stdio: \"pipe\" });\n\t\t// Check for ENOENT error (command not found)\n\t\treturn result.error === undefined || result.error === null;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n// Get the path to a tool (system-wide or in our tools dir)\nexport function getToolPath(tool: ManagedTool): string | null {\n\tconst config = TOOLS[tool];\n\tconst systemBinaryNames = config.systemBinaryNames ?? [config.binaryName];\n\tconst getSystemPath = (): string | null => {\n\t\tfor (const systemBinaryName of systemBinaryNames) {\n\t\t\tif (commandExists(systemBinaryName)) {\n\t\t\t\treturn systemBinaryName;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t};\n\n\tif (config.preferSystemBinary) {\n\t\tconst systemPath = getSystemPath();\n\t\tif (systemPath) return systemPath;\n\t}\n\n\tconst localPath = join(TOOLS_DIR, config.binaryName + (platform() === \"win32\" ? \".exe\" : \"\"));\n\tif (existsSync(localPath)) {\n\t\treturn localPath;\n\t}\n\n\treturn config.preferSystemBinary ? null : getSystemPath();\n}\n\n// Fetch latest release version from GitHub\nasync function getLatestVersion(repo: string): Promise<string> {\n\tconst response = await fetch(`https://api.github.com/repos/${repo}/releases/latest`, {\n\t\theaders: { \"User-Agent\": `${APP_NAME}-coding-agent` },\n\t\tsignal: AbortSignal.timeout(NETWORK_TIMEOUT_MS),\n\t});\n\n\tif (!response.ok) {\n\t\tthrow new Error(`GitHub API error: ${response.status}`);\n\t}\n\n\tconst data = (await response.json()) as { tag_name: string };\n\treturn data.tag_name.replace(/^v/, \"\");\n}\n\n// Download a file from URL\nasync function downloadFile(url: string, dest: string): Promise<void> {\n\tconst response = await fetch(url, {\n\t\tsignal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS),\n\t});\n\n\tif (!response.ok) {\n\t\tthrow new Error(`Failed to download: ${response.status}`);\n\t}\n\n\tif (!response.body) {\n\t\tthrow new Error(\"No response body\");\n\t}\n\n\tconst fileStream = createWriteStream(dest);\n\tawait pipeline(Readable.fromWeb(response.body as any), fileStream);\n}\n\nfunction findBinaryRecursively(rootDir: string, binaryFileName: string): string | null {\n\tconst stack: string[] = [rootDir];\n\n\twhile (stack.length > 0) {\n\t\tconst currentDir = stack.pop();\n\t\tif (!currentDir) continue;\n\n\t\tconst entries = readdirSync(currentDir, { withFileTypes: true });\n\t\tfor (const entry of entries) {\n\t\t\tconst fullPath = join(currentDir, entry.name);\n\t\t\tif (entry.isFile() && entry.name === binaryFileName) {\n\t\t\t\treturn fullPath;\n\t\t\t}\n\t\t\tif (entry.isDirectory()) {\n\t\t\t\tstack.push(fullPath);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null;\n}\n\nfunction formatSpawnFailure(result: SpawnSyncReturns<Buffer>): string {\n\tif (result.error?.message) {\n\t\treturn result.error.message;\n\t}\n\tconst stderr = result.stderr?.toString().trim();\n\tif (stderr) {\n\t\treturn stderr;\n\t}\n\tconst stdout = result.stdout?.toString().trim();\n\tif (stdout) {\n\t\treturn stdout;\n\t}\n\treturn `exit status ${result.status ?? \"unknown\"}`;\n}\n\nfunction runExtractionCommand(command: string, args: string[]): string | null {\n\tconst result = spawnSync(command, args, { stdio: \"pipe\" });\n\tif (!result.error && result.status === 0) {\n\t\treturn null;\n\t}\n\treturn `${command}: ${formatSpawnFailure(result)}`;\n}\n\nfunction extractTarGzArchive(archivePath: string, extractDir: string, assetName: string): void {\n\tconst failure = runExtractionCommand(\"tar\", [\"xzf\", archivePath, \"-C\", extractDir]);\n\tif (failure) {\n\t\tthrow new Error(`Failed to extract ${assetName}: ${failure}`);\n\t}\n}\n\nfunction getWindowsTarCommand(): string {\n\tconst systemRoot = process.env.SystemRoot ?? process.env.WINDIR;\n\tif (systemRoot) {\n\t\tconst systemTar = join(systemRoot, \"System32\", \"tar.exe\");\n\t\tif (existsSync(systemTar)) {\n\t\t\treturn systemTar;\n\t\t}\n\t}\n\treturn \"tar.exe\";\n}\n\nfunction extractZipArchive(archivePath: string, extractDir: string, assetName: string): void {\n\tconst failures: string[] = [];\n\n\tif (platform() === \"win32\") {\n\t\t// Windows ships bsdtar as tar.exe, which supports zip files. Prefer the\n\t\t// System32 binary over Git Bash's GNU tar, which does not handle zip archives.\n\t\tconst tarFailure = runExtractionCommand(getWindowsTarCommand(), [\"xf\", archivePath, \"-C\", extractDir]);\n\t\tif (!tarFailure) return;\n\t\tfailures.push(tarFailure);\n\n\t\tconst script =\n\t\t\t\"& { param($archive, $destination) $ErrorActionPreference = 'Stop'; Expand-Archive -LiteralPath $archive -DestinationPath $destination -Force }\";\n\t\tconst powershellFailure = runExtractionCommand(\"powershell.exe\", [\n\t\t\t\"-NoLogo\",\n\t\t\t\"-NoProfile\",\n\t\t\t\"-NonInteractive\",\n\t\t\t\"-ExecutionPolicy\",\n\t\t\t\"Bypass\",\n\t\t\t\"-Command\",\n\t\t\tscript,\n\t\t\tarchivePath,\n\t\t\textractDir,\n\t\t]);\n\t\tif (!powershellFailure) return;\n\t\tfailures.push(powershellFailure);\n\t} else {\n\t\tconst unzipFailure = runExtractionCommand(\"unzip\", [\"-q\", archivePath, \"-d\", extractDir]);\n\t\tif (!unzipFailure) return;\n\t\tfailures.push(unzipFailure);\n\n\t\tconst tarFailure = runExtractionCommand(\"tar\", [\"xf\", archivePath, \"-C\", extractDir]);\n\t\tif (!tarFailure) return;\n\t\tfailures.push(tarFailure);\n\t}\n\n\tthrow new Error(`Failed to extract ${assetName}: ${failures.join(\"; \")}`);\n}\n\n// Download and install a tool\nasync function downloadTool(tool: ManagedTool): Promise<string> {\n\tconst config = TOOLS[tool];\n\tif (config.downloadUnsupportedMessage) {\n\t\tthrow new Error(config.downloadUnsupportedMessage);\n\t}\n\tif (!config.repo || config.tagPrefix === undefined) {\n\t\tthrow new Error(`${config.name} auto-download is not configured; install ${config.binaryName} on PATH.`);\n\t}\n\n\tconst plat = platform();\n\tconst architecture = arch();\n\n\t// Get latest version\n\tlet version = await getLatestVersion(config.repo);\n\tif (tool === \"fd\" && plat === \"darwin\" && architecture === \"x64\") {\n\t\tversion = \"10.3.0\";\n\t}\n\n\t// Get asset name for this platform\n\tconst assetName = config.getAssetName(version, plat, architecture);\n\tif (!assetName) {\n\t\tthrow new Error(`Unsupported platform: ${plat}/${architecture}`);\n\t}\n\n\t// Create tools directory\n\tmkdirSync(TOOLS_DIR, { recursive: true });\n\n\tconst downloadUrl = `https://github.com/${config.repo}/releases/download/${config.tagPrefix}${version}/${assetName}`;\n\tconst archivePath = join(TOOLS_DIR, assetName);\n\tconst binaryExt = plat === \"win32\" ? \".exe\" : \"\";\n\tconst binaryPath = join(TOOLS_DIR, config.binaryName + binaryExt);\n\n\t// Download\n\tawait downloadFile(downloadUrl, archivePath);\n\n\t// Extract into a unique temp directory. fd and rg downloads can run concurrently\n\t// during startup, so sharing a fixed directory causes races.\n\tconst extractDir = join(\n\t\tTOOLS_DIR,\n\t\t`extract_tmp_${config.binaryName}_${process.pid}_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`,\n\t);\n\tmkdirSync(extractDir, { recursive: true });\n\n\ttry {\n\t\tif (assetName.endsWith(\".tar.gz\")) {\n\t\t\textractTarGzArchive(archivePath, extractDir, assetName);\n\t\t} else if (assetName.endsWith(\".zip\")) {\n\t\t\textractZipArchive(archivePath, extractDir, assetName);\n\t\t} else {\n\t\t\tthrow new Error(`Unsupported archive format: ${assetName}`);\n\t\t}\n\n\t\t// Find the binary in extracted files. Some archives contain files directly\n\t\t// at root, others nest under a versioned subdirectory.\n\t\tconst binaryFileName = config.binaryName + binaryExt;\n\t\tconst extractedDir = join(extractDir, assetName.replace(/\\.(tar\\.gz|zip)$/, \"\"));\n\t\tconst extractedBinaryCandidates = [join(extractedDir, binaryFileName), join(extractDir, binaryFileName)];\n\t\tlet extractedBinary = extractedBinaryCandidates.find((candidate) => existsSync(candidate));\n\n\t\tif (!extractedBinary) {\n\t\t\textractedBinary = findBinaryRecursively(extractDir, binaryFileName) ?? undefined;\n\t\t}\n\n\t\tif (extractedBinary) {\n\t\t\trenameSync(extractedBinary, binaryPath);\n\t\t} else {\n\t\t\tthrow new Error(`Binary not found in archive: expected ${binaryFileName} under ${extractDir}`);\n\t\t}\n\n\t\t// Make executable (Unix only)\n\t\tif (plat !== \"win32\") {\n\t\t\tchmodSync(binaryPath, 0o755);\n\t\t}\n\t} finally {\n\t\t// Cleanup\n\t\trmSync(archivePath, { force: true });\n\t\trmSync(extractDir, { recursive: true, force: true });\n\t}\n\n\treturn binaryPath;\n}\n\n// Termux package names for tools\nconst TERMUX_PACKAGES: Partial<Record<ManagedTool, string>> = {\n\tfd: \"fd\",\n\trg: \"ripgrep\",\n};\n\n// Ensure a tool is available, downloading if necessary\n// Returns the path to the tool, or undefined if unavailable\nexport async function ensureTool(tool: ManagedTool, silent: boolean = false): Promise<string | undefined> {\n\tconst existingPath = getToolPath(tool);\n\tif (existingPath) {\n\t\treturn existingPath;\n\t}\n\n\tconst config = TOOLS[tool];\n\n\tif (isOfflineModeEnabled()) {\n\t\tif (!silent) {\n\t\t\tconsole.log(chalk.yellow(`${config.name} not found. Offline mode enabled, skipping download.`));\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t// On Android/Termux, Linux binaries don't work due to Bionic libc incompatibility.\n\t// Users must install via pkg.\n\tif (platform() === \"android\") {\n\t\tconst pkgName = TERMUX_PACKAGES[tool];\n\t\tif (!silent) {\n\t\t\tif (pkgName) {\n\t\t\t\tconsole.log(chalk.yellow(`${config.name} not found. Install with: pkg install ${pkgName}`));\n\t\t\t} else {\n\t\t\t\tconsole.log(\n\t\t\t\t\tchalk.yellow(\n\t\t\t\t\t\t`${config.name} not found. No Termux package is configured; install ${config.binaryName} on PATH.`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tif (config.downloadUnsupportedMessage) {\n\t\tif (!silent) {\n\t\t\tconsole.log(chalk.yellow(`${config.name} not found. ${config.downloadUnsupportedMessage}`));\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t// Tool not found - download it\n\tif (!silent) {\n\t\tconsole.log(chalk.dim(`${config.name} not found. Downloading...`));\n\t}\n\n\ttry {\n\t\tconst path = await downloadTool(tool);\n\t\tif (!silent) {\n\t\t\tconsole.log(chalk.dim(`${config.name} installed to ${path}`));\n\t\t}\n\t\treturn path;\n\t} catch (e) {\n\t\tif (!silent) {\n\t\t\tconsole.log(chalk.yellow(`Failed to download ${config.name}: ${e instanceof Error ? e.message : e}`));\n\t\t}\n\t\treturn undefined;\n\t}\n}\n"]}
@@ -15,7 +15,7 @@
15
15
  | `task_text` | string | user / lane kickoff | Primary routing signal; may be truncated for headroom. |
16
16
  | `path_hints` | string[] | cwd, owned paths, globs | Optional; used for domain triggers and write-scope checks. |
17
17
  | `upstream_tags` | string[] | goal id, lane role, preset | e.g. `grok-adaptorch-prod`, `omk-planner`. |
18
- | `payload_shape` | object | planner / DAG artifact | Non-empty `subtasks` array plus optional `dependencies`; descriptions are bounded and sanitized, with no secrets or session ids. |
18
+ | `route_payload` | object | planner / DAG artifact | Non-empty `subtasks` array plus optional `dependencies`, passed as the tool's top-level arguments. Descriptions are bounded and sanitized, with no secrets or session ids. |
19
19
  | `provider_profile` | enum | session | `xai` \| `default` \| other registered provider. |
20
20
  | `adaptorch_transport` | optional | MCP grant | If absent, preview runs **local-only** (OMK compose + deterministic fallbacks). |
21
21
  | `lane_grants[]` | object[] | root coordinator | Each: scope, authority, skills, MCP, acceptance, evidence path. |
@@ -44,12 +44,12 @@
44
44
 
45
45
  **Purpose:** Classify execution topology **without** submitting `adaptorch_run`.
46
46
 
47
- **Precondition:** `adaptorch_transport` granted **and** `payload_shape` is sanitized.
47
+ **Precondition:** `adaptorch_transport` granted **and** `route_payload` is sanitized.
48
48
 
49
49
  **Steps:**
50
50
 
51
51
  1. Call `adaptorch_capabilities` once per preview session (cache TTL).
52
- 2. Call `adaptorch_route_topology` with `payload_shape` as the tool's top-level argument object.
52
+ 2. Call `adaptorch_route_topology` with `route_payload`'s `subtasks` and optional `dependencies` as the tool's top-level arguments. Do not wrap them in `payload_shape`; the engine schema sets `additionalProperties: false` and requires `subtasks`.
53
53
  3. Read `raw.topology` and validate it against `adaptorch_capabilities.topologies`.
54
54
  4. If transport is missing or the value is outside that advertised set, set `topology = null` and record a bounded `skipped_reason`.
55
55
 
@@ -122,8 +122,8 @@
122
122
  function PreviewOrchestrate(inputs):
123
123
  assert inputs.task_text is non-empty
124
124
  A <- StageA_SignalIntake(inputs.task_text, inputs.path_hints, inputs.upstream_tags)
125
- if inputs.adaptorch_transport is granted and inputs.payload_shape is sanitized:
126
- B <- StageB_TopologyPreview(inputs.adaptorch_transport, inputs.payload_shape)
125
+ if inputs.adaptorch_transport is granted and inputs.route_payload is sanitized:
126
+ B <- StageB_TopologyPreview(inputs.adaptorch_transport, inputs.route_payload)
127
127
  else:
128
128
  B <- { topology: null, skipped_reason: transport_or_shape }
129
129
  C <- StageC_ComposeLanes(A, B, inputs.lane_grants, inputs.budget_caps)
@@ -138,11 +138,11 @@ function PreviewOrchestrate(inputs):
138
138
  ## Algorithm 2 — TopologyClassifyPreview
139
139
 
140
140
  ```
141
- function TopologyClassifyPreview(transport, payload_shape):
141
+ function TopologyClassifyPreview(transport, route_payload):
142
142
  caps <- transport.call("adaptorch_capabilities", {})
143
143
  if caps indicates unsupported connector:
144
144
  return { topology: null, skipped_reason: capabilities }
145
- raw <- transport.call("adaptorch_route_topology", payload_shape)
145
+ raw <- transport.call("adaptorch_route_topology", route_payload)
146
146
  topology <- extract_enum(raw.topology, caps.topologies)
147
147
  if topology is missing:
148
148
  return { topology: null, skipped_reason: unparseable }
@@ -0,0 +1,69 @@
1
+ # 원자적 커밋 계획기
2
+
3
+ `omk-agent-core`의 `planAtomicCommits`는 변경을 검증 가능한 후보 그룹으로 나누는 순수 함수입니다. Git, 파일시스템, provider, 시계를 호출하지 않습니다. 세션 종료 시 커밋하거나 기존 tool scheduler를 대체하지 않습니다.
4
+
5
+ ## 지원 API
6
+
7
+ ```typescript
8
+ import { planAtomicCommits, type CommitPlannerInput } from "omk-agent-core";
9
+
10
+ export function inspectObservedChanges(hostObserved: CommitPlannerInput) {
11
+ const plan = planAtomicCommits(hostObserved);
12
+ return { groups: plan.groups, validationOrder: plan.validationOrder };
13
+ }
14
+ ```
15
+
16
+ `hostObserved`는 신뢰된 host adapter가 관측한 사실이어야 합니다. 타입 검사나 parser 통과만으로 그 사실이 인증되는 것은 아닙니다. 현재 edit receipt를 수집하고 인증하는 adapter는 연결하지 않았습니다. 모델이 JSON에 `provenance: "verified"`, `settled: true`를 적었다고 소유권이나 종료가 증명되지 않습니다.
17
+
18
+ 공개 타입은 `ChangeAtom`, `ChangeRelation`, `CommitPlannerInput`, `CommitGroup`, `CommitPlan`입니다. atom은 repository/worktree/session/intent ID, 모든 변경 경로, package 식별자, receipt 참조, preimage와 patch 식별자, dependency completeness, writer settlement, review 필요 여부를 포함합니다. rename은 이전 경로와 새 경로를 같은 atom에 담습니다.
19
+
20
+ 패키지 경계와 의미 관계도 host가 제공하는 입력입니다. 폴더명, import, mtime, dirty 상태에서 이를 추측하지 않습니다. nested workspace를 자동 탐색하거나 새로운 Git 작업을 시작하는 API는 아닙니다.
21
+
22
+ ## 그룹과 순서
23
+
24
+ - `together(A, B)`: 양방향 연결입니다. 분리하면 계약이 깨지는 변경을 같은 후보로 묶습니다.
25
+ - `depends(A, B)`: A가 B를 prerequisite로 갖습니다. dependency-first 순서를 생성합니다.
26
+ - `separate(A, B)`: 같은 SCC에 포함되면 `CONTRADICTORY_BOUNDARIES`로 차단합니다.
27
+
28
+ 재귀 없는 SCC로 서로 분리할 수 없는 그룹을 계산합니다. 현재 repository/worktree/session의 그룹과 그 prerequisite closure만 선택하고, 무관한 foreign atom은 `unrelatedAtomIds`에 남깁니다. 그룹 ID와 dependency-first layer 내 순서는 ID의 코드 단위 비교로 결정합니다. locale, 입력 배열 순서와 중복 symmetric relation에 의존하지 않습니다.
29
+
30
+ | 상태 | 의미 |
31
+ | --- | --- |
32
+ | `candidate` | 정확한 snapshot 검증의 후보. 커밋 실행 허가가 아닙니다. |
33
+ | `review` | cross-intent closure 또는 명시적 review가 필요합니다. |
34
+ | `blocked` | foreign/unknown 소유권, 미종료 writer, 불완전한 closure, 경계 모순 등으로 진행할 수 없습니다. |
35
+
36
+ prerequisite가 candidate가 아니면 dependent도 차단합니다. 동일 SCC뿐 아니라 선행 그룹이 다른 intent인 경우에도 review가 필요합니다. 이 review 판정을 모델이 승인으로 바꾸는 API는 없습니다.
37
+
38
+ ## file-level 경계와 입력 검증
39
+
40
+ v1은 서로 다른 atom이 같은 repository/worktree의 같은 파일을 독립적으로 소유한다고 추정하지 않습니다. 같은 파일 또는 file/descendant 경로가 겹치면 `AMBIGUOUS_FILE_OWNERSHIP`으로 보류합니다. 선택되지 않은 foreign atom도 겹침 검사에 포함합니다. `together`나 `depends`를 추가해 이 경계를 우회할 수 없습니다. 연속된 자기 편집을 하나의 정확한 file-level atom으로 만들거나, 후속 hunk 소유권 증명을 제공하는 것은 host adapter의 책임입니다.
41
+
42
+ 다른 repository/worktree의 같은 상대 경로는 동일 파일로 취급하지 않습니다. 한 후보에 다른 repository의 변경이 의존성으로 들어오면 foreign ownership으로 차단합니다.
43
+
44
+ 모든 safety flag는 실제 boolean이어야 합니다. truthy 문자열, 잘못된 enum, sparse array, 누락된 ID/edge evidence, 중복 atom ID, 알 수 없는 relation node는 `TypeError`입니다. 경로는 제어문자, 비정상 Unicode, 절대 경로, 역슬래시, 콜론, 빈 segment, `.`/`..`와 대소문자 변형 `.git` segment를 거절합니다.
45
+
46
+ 입력 한도는 atom 20,000개, relation 100,000개, 전체 path entry와 package entry 각각 100,000개, atom당 path/package entry 각각 256개입니다. atom/relation 배열 길이는 atom 해석 전에 확인하고, 전체 entry 예산을 넘기는 atom은 해당 배열의 원소를 읽거나 복사하기 전에 거절합니다.
47
+
48
+ 경로는 4,096 UTF-16 code unit, 나머지 text 식별자는 512개까지입니다. header, atom, relation의 인식된 문자열 값은 중복 제거 전에 모두 합산하며 총 8,388,608 UTF-16 code unit을 넘으면 거절합니다. enum 문자열도 포함합니다. 각 한도는 누적되며, 개수 한도 이내인 입력도 문자열 총량을 넘으면 거절합니다. 예산은 호출마다 새로 시작합니다. 이는 입력 파싱 작업의 상한이지 OS 경로 보안이나 실행 시간 보장은 아닙니다. symlink/junction, case folding, Git common-dir, submodule/LFS와 실제 scope 검사는 아직 host adapter 책임으로 남아 있습니다.
49
+
50
+ 결과와 중첩 배열은 freeze됩니다. `canonicalInput`은 planner schema, policy version, repository/worktree/session, base, atom/receipt/patch와 relation evidence를 정규화한 JSON입니다. host는 이를 digest에 결합할 수 있지만, 이 문자열 자체는 인증된 receipt나 검증 성공이 아닙니다.
51
+
52
+ ## 아직 제공하지 않는 기능
53
+
54
+ - edit receipt 관측과 인증, 의미 관계 자동 추출
55
+ - 원본 HEAD/index/working tree를 보존하는 production snapshot broker
56
+ - exact-prefix 검사, 실제 hook 실행, lease/fencing, 전용 candidate ref 게시와 crash recovery
57
+ - `/commit plan`, `/commit apply`, `/commit status` 명령
58
+ - shutdown 자동 커밋, 기존 index에서의 자동 staging, source branch 전진
59
+
60
+ 별도 임시 Git fixture에서 snapshot commit, hook veto, CAS 충돌, alternate-index 함정을 확인했지만 production executor의 검증으로 계산하지 않습니다. 이 계획기만으로 preserve-mode 전체 P0가 완료된 것은 아닙니다. 기존 수동 Git 지침과 [Verified run 안전 경계](verified-run-safety.md)는 그대로 적용됩니다.
61
+
62
+ ## 검사
63
+
64
+ ```bash
65
+ cd packages/agent
66
+ LIVE_E2E=0 node ../../node_modules/vitest/dist/cli.js --run test/atomic-commit --maxWorkers=1
67
+ ```
68
+
69
+ 검사는 공개 API, strict input, mixed ownership, cross-intent review, 400개 seeded graph의 독립 reachability oracle, 12,000-node chain/fanout, browser bundle을 포함합니다. 단위 테스트의 합격률을 production 안전확률이나 Git 게시 승인으로 해석하지 않습니다.
@@ -95,9 +95,34 @@ By default, compaction uses the active session model. Set `compaction.model` to
95
95
 
96
96
  Every compaction and branch-summary LLM call flows through one choke point (`completeSummarization`):
97
97
 
98
- - **Retries**: transient stream drops (`terminated`, socket close, 5xx, DNS/transport errors) follow the configured `retry` settings (`enabled`, `maxRetries`, `baseDelayMs`) with exponential backoff instead of failing the whole operation on the first attempt. Quota/billing exhaustion on the summarization model triggers one pass through the resilience failover chain ([provider-resilience.md](provider-resilience.md)); only when every candidate is also quota-blocked does the run fail with a non-retryable `compaction.quota_exhausted` termination cause whose guidance suggests `/model`, setting `compaction.model`, or waiting for reset. Aborts are never retried. Retry progress is emitted as `summarization_retry_scheduled` / `summarization_retry_attempt_start` / `summarization_retry_finished` session events (surfaced in the TUI and RPC stream).
98
+ - **Retries**: transient stream drops (`terminated`, socket close, 5xx, DNS/transport errors) follow the configured `retry` settings (`enabled`, `maxRetries`, `baseDelayMs`) with exponential backoff. Aborts are never retried. Retry progress is emitted as `summarization_retry_scheduled` / `summarization_retry_attempt_start` / `summarization_retry_finished` session events (surfaced in the TUI and RPC stream).
99
99
  - **Isolation**: each summarization request runs with prompt caching disabled (`cacheRetention: "none"`) and a fresh routing `sessionId`, so summaries never write unusable provider cache entries or inherit interactive session affinity.
100
100
 
101
+ ### Compaction Failover and Rescue
102
+
103
+ For compaction, primary-model quota/billing exhaustion triggers one pass through
104
+ the configured [resilience candidates](provider-resilience.md). Cross-provider
105
+ candidates must resolve their own credentials; missing or failed auth resolution
106
+ skips a candidate without forwarding the primary key or headers. Same-provider
107
+ candidates can inherit primary credentials when no resolver is supplied.
108
+ Terminal candidate failures, including quota and entitlement/auth denial, advance
109
+ the chain. Other candidate errors retain the candidate identity. Cancellation is
110
+ checked again after credential resolution, before another summarization starts.
111
+
112
+ Manual and threshold compaction rescue a quota-exhausted attempt using the live
113
+ session model when it differs from the configured compaction model. If that
114
+ rescue also fails, they use a deterministic trim. A non-quota failure of the
115
+ initial attempt still propagates instead of silently degrading the summary.
116
+ Overflow recovery uses the rescue ladder for any summarization failure because
117
+ another over-limit request would otherwise strand the session. Aborts stop the
118
+ ladder in every mode. Branch summarization does not use this rescue ladder.
119
+
120
+ The deterministic path preserves structured rules, file operations, a bounded
121
+ prior summary and the recent cut-point window, but discards older turns without
122
+ semantic summarization. Its `Deterministic emergency compaction` heading and
123
+ `details.deterministicEmergency` flag distinguish it from a model summary.
124
+ This fallback still must pass the normal compaction transaction checks.
125
+
101
126
  ### How It Works
102
127
 
103
128
  1. **Find cut point**: Walk backwards from newest message, accumulating token estimates until `keepRecentTokens` (default 20k, configurable in `~/.omk/agent/settings.json` or `<project-dir>/.omk/settings.json`) is reached
@@ -320,6 +320,9 @@ user sends another prompt ◄─────────────────
320
320
  ├─► session_start { reason: "fork", previousSessionFile }
321
321
  └─► resources_discover { reason: "startup" }
322
322
 
323
+ /name or pi.setSessionName()
324
+ └─► session_info_changed
325
+
323
326
  /compact or auto-compaction
324
327
  ├─► session_before_compact (can cancel or customize)
325
328
  └─► session_compact
@@ -374,6 +377,17 @@ omk.on("session_start", async (event, ctx) => {
374
377
  });
375
378
  ```
376
379
 
380
+ #### session_info_changed
381
+
382
+ Fired when the current session display name is set via `/name`, RPC, or `pi.setSessionName()`.
383
+
384
+ ```typescript
385
+ pi.on("session_info_changed", async (event, ctx) => {
386
+ // event.name - current normalized name, or undefined if cleared
387
+ ctx.ui.notify(`Session renamed: ${event.name ?? "(none)"}`, "info");
388
+ });
389
+ ```
390
+
377
391
  #### session_before_switch
378
392
 
379
393
  Fired before starting a new session (`/new`) or switching sessions (`/resume`).
package/docs/mcp.md CHANGED
@@ -72,6 +72,22 @@ session.getToolDefinition("playwright__navigate");
72
72
  duplicating them.
73
73
  - `session.dispose()` terminates every server it started.
74
74
 
75
+ ### Bounded startup
76
+
77
+ Each manager admits up to four connect/handshake/catalog attempts at once by
78
+ default. Low-level SDK callers can set a positive integer `connectionConcurrency`
79
+ in `McpManagerOptions`. This is a startup limit, not a server or tool limit: a
80
+ listing still waits for every enabled attempt and returns the full admitted
81
+ catalog in configuration order. Waiting servers report `queued`; they have not
82
+ been spawned yet. Direct connects and explicit health recovery share the queue.
83
+
84
+ Closing a manager cancels queued starts and invalidates active generations. An
85
+ active attempt keeps its slot until settlement, and late handshake/list results
86
+ cannot publish tools. Explicit post-close connects wait for the previous attempt
87
+ to settle before reconnecting. No idle-server shutdown or descriptor reduction is
88
+ introduced. Four is a conservative default, not a measured optimum: staging can
89
+ increase full-catalog readiness time while reducing simultaneous startup work.
90
+
75
91
  ### Failure behavior
76
92
 
77
93
  Failures are isolated by design, because one broken server must not cost a
@@ -84,6 +100,12 @@ session:
84
100
  | Server dies mid-session | In-flight requests reject; later calls to its tools return a tool-level error instead of throwing. |
85
101
  | Tool returns an MCP error | Surfaces as a normal tool result with `isError: true`, so the model sees the server's own message. |
86
102
  | Server emits a non-JSON line | The line is dropped and decoding resynchronizes at the next newline. |
103
+ | Server emits a frame larger than 16 MiB | One framing error is reported; the remainder is discarded until the next newline. |
104
+
105
+ The frame limit counts raw UTF-8 bytes, including whitespace and CR in CRLF,
106
+ independently of chunk boundaries. The decoder scans only new chunks and batches
107
+ small fragments without truncating valid messages or reducing tool catalogs.
108
+ This bounds retained frame data, not the memory of parsed JSON or the whole process.
87
109
 
88
110
  ## Checking your configuration
89
111
 
@@ -43,6 +43,85 @@ host-owned structured state, never as model self-report.
43
43
  - Environment failures are recorded separately from code failures — neither
44
44
  inflates nor silently discards the other.
45
45
 
46
+ ## Primitive hardening
47
+
48
+ The September 21, 2026 review's WP00 fixes harden the local library without
49
+ changing the default CLI workflow or enabling a supervisor.
50
+
51
+ ### Contracts and compatibility
52
+
53
+ - Operations cannot return to observation or proposal after authorization or
54
+ dispatch. Replanning requires a new operation.
55
+ - Observations and authorization inputs are copied and frozen. Dispatch must
56
+ match the saved intent, approval, policy version and lease generation, even
57
+ when a replacement permit is internally consistent.
58
+ - Permit flags and postconditions must be booleans. Binding strings are bounded
59
+ and nonempty, and generations use canonical decimal `Sequence` values.
60
+ - Only unresolved dispatched outcomes can settle. Repeating the current outcome
61
+ is idempotent, including history. Applied and confirmed-failure outcomes cannot
62
+ be overwritten. Cancellation is still not proof of termination.
63
+ - The broker validates and snapshots claims before changing state. Malformed or
64
+ sparse arrays cannot acquire or start effects, or expire another reservation.
65
+ - Exact claim-set binding includes generation; resource conflicts still ignore
66
+ generation. A changed generation requires readmission before `start`.
67
+ - `claimKey` uses a JSON tuple including generation instead of NUL delimiters.
68
+ Consumers must recompute keys rather than mix old and new formats. This
69
+ in-memory kernel provides no durable key migration.
70
+ - Instance IDs reject NUL and lengths over 4096; canonical keys also reject
71
+ backslashes. Deadline sums must be safe integers, and sequence increments
72
+ remain within the existing 40-digit wire limit.
73
+
74
+ ### Numerical behavior and tests
75
+
76
+ Temperature scaling shifts log probabilities before dividing by temperature, so
77
+ `Number.MIN_VALUE` preserves a nonzero maximum and finite ties. Log loss rejects
78
+ clips whose upper boundary rounds to one and uses `Math.log1p`.
79
+
80
+ Clopper-Pearson bounds invert the beta survival probability without rounding
81
+ `1 - alpha` to one; zero failures use the closed form. Incomplete beta rejects
82
+ invalid arguments, non-convergence and invalid results. Bonferroni adjustment
83
+ rejects comparison-count overflow and alpha underflow. These floating-point
84
+ calculations are not interval-arithmetic proofs or next-action guarantees.
85
+
86
+ From `packages/coding-agent`:
87
+
88
+ ```bash
89
+ LIVE_E2E=0 node ../../node_modules/vitest/dist/cli.js --run test/primitive-hardening.test.ts test/primitive-boundaries.test.ts test/primitive-numeric-oracle.test.ts
90
+ ```
91
+
92
+ The original 41 regression cases reproduced 28 failures before the six source
93
+ fixes and passed afterwards. The seeded broker model runs 64 seeds with 512
94
+ transitions each, branch-count assertions, and an independent component-overlap
95
+ oracle. Additional sparse-array regressions cover a gap in the supplied patch.
96
+ These are regression cases, not independent product failures or task successes.
97
+
98
+ `test/fixtures/primitive-numeric-oracle.json` contains 282 fixed values from
99
+ SciPy 1.17.0 `scipy.stats.beta.isf(alpha, k + 1, n - k)` (one when `k == n`).
100
+ The grid uses `n` in `{1, 2, 10, 100, 300, 1000, 10000, 100000, 1000000}`, valid
101
+ unique `k` in `{0, 1, 2, n // 2, n - 1, n}`, and alpha in
102
+ `{0.1, 0.05, 0.01, 1e-6, 1e-12, 1e-20}`. Tolerance is
103
+ `1e-9 + 1e-8 * abs(expected)`. Before hardening, 48 values exceeded tolerance;
104
+ afterwards all passed, with maximum absolute error about `6.82e-14` on this grid.
105
+ Tests require neither Python nor network access. Other numerical domains are
106
+ not established by this fixture.
107
+
108
+ ### Integration boundary
109
+
110
+ The coordination and metacognition barrels are re-exported from `src/index.ts`.
111
+ In the reviewed source, `AdmissionBroker`, `OperationLifecycle`, temperature
112
+ scaling and Clopper-Pearson bounds have no production execution call sites.
113
+ `AdmissionBroker.start` uses the strengthened `sameClaimSet`; tests exercise
114
+ real implementations, not a mock supervisor. Library availability does not
115
+ mean the default agent loop enforces these contracts.
116
+
117
+ The review's WP01-WP07 remain separate work: an end-to-end verified runtime path,
118
+ worker/descendant termination, durable recovery, immutable candidate publication,
119
+ loss-aware bridge mapping, shared UI/SDK states, and same-budget efficacy
120
+ experiments. Additional primitive proposals are not part of these six fixes.
121
+ No release, OS fencing, durable recovery or automatic completion-verification
122
+ claim follows from these tests. See [Development](development.md) for the
123
+ repository check and explicit test-filter workflow.
124
+
46
125
  ## Tests
47
126
 
48
127
  `test/metacognition-*.test.ts` — 94 tests, including the 13 numerical checks
@@ -1,8 +1,67 @@
1
1
  # 모델 목록·thinking 갱신 기록
2
2
 
3
- 확인일: 2026-09-09. 생성기와 공급자 어댑터를 수정한 뒤 `npm run models:refresh`로
3
+ 확인일: 2026-09-22. 생성기와 공급자 어댑터를 수정한 뒤 `npm run models:refresh`로
4
4
  두 카탈로그를 재생성했다. 생성 파일을 손으로 수정하지 않았다.
5
5
 
6
+ ## 2026-09-22 갱신: Grok 4.7·MiMo v2.6과 reasoning/context 대조
7
+
8
+ `npm run models:refresh`를 종료 0으로 재생성했다. 전 소스가 응답했고 `--allow-partial`은 쓰지 않았다.
9
+ 키 없는 Zyloo는 정적 6개를 유지했다. 이미지 카탈로그는 변화 없다.
10
+
11
+ | 항목 | 값 |
12
+ | --- | --- |
13
+ | 공급자 / 모델 | 40 / 1,826 → 1,847 |
14
+ | 추가 | 32 |
15
+ | 제거 | 11 |
16
+ | context 또는 maxTokens 변경 | 15 |
17
+ | thinking 맵 변경(기존 id) | 0 |
18
+
19
+ ### 공식 원천과 대조
20
+
21
+ AdaptOrch `TopologyRouter`는 이 검증 DAG을 `hybrid`로 권고했다(width 2 exact, critical depth 4,
22
+ coupling density 0.66). 이는 실행 순서가 아니라 권고이다. 실제 검증은 공개 문서·공개 카탈로그 숫자와
23
+ 생성 결과의 대조이며, 공급자 추론 호출은 하지 않았다.
24
+
25
+ | 모델 | 문서 context | 문서 effort | 카탈로그 |
26
+ | --- | --- | --- | --- |
27
+ | `grok-4.7` | 500,000 | `low/medium/high/xhigh`, 기본 `high`, 끄기 불가 | `xai` context 500,000, maxTokens 500,000. 네이티브는 `applyGrokThinking`이 `xhigh`까지 노출하고 `max/ultra`는 `xhigh` 별칭 |
28
+ | `grok-4.6` | 500,000 | 같은 사다리 | 변경 없음 |
29
+ | `grok-4.5` | 500,000 | `low/medium/high` (`xhigh` 없음) | `xhigh` 미노출 유지. 새 floor가 4.20 스냅샷에는 적용되지 않음 |
30
+ | MiMo v2.6 Pro/Flash | OpenRouter context 1,048,576, max completion 131,072 | route가 effort 목록을 선언하지 않음 | 선언 없는 사다리를 지어내지 않음. `reasoning: true`, map 없음 |
31
+ | GPT-5.6 계열 | OpenAI 문서 1.05M | `none/low/medium/high/xhigh/max` | 기존 생성기가 1,000,000으로 고정. 라이브 90개 모두 1,000,000 |
32
+
33
+ 근거: [Grok 4.7](https://docs.x.ai/developers/models/grok-4.7),
34
+ [xAI reasoning](https://docs.x.ai/developers/model-capabilities/text/reasoning),
35
+ [OpenRouter models](https://openrouter.ai/api/v1/models),
36
+ [models.dev](https://models.dev/api.json).
37
+
38
+ ### 생성기 보정
39
+
40
+ models.dev가 `grok-4.7`의 `reasoning_options`에 `xhigh`를 선언한다. 카탈로그 지연 시
41
+ `/thinking xhigh`가 `high`로 좁히지 않도록, xAI 문서의 "4.6 이후" 규칙을
42
+ `isDocumentedGrokXhighModel`로 두었다. `grok-4.20-*` 날짜 스냅샷은 이 사다리가 아니다.
43
+
44
+ ### 추가·제거
45
+
46
+ 추가는 `xai`·`openrouter`·`vercel-ai-gateway`·`github-copilot`·`opencode-go`의 `grok-4.7`,
47
+ Xiaomi 직접·토큰 플랜 3곳·OpenRouter·Vercel·OpenCode Go의 MiMo v2.6 Flash/Pro(와 Pro UltraSpeed),
48
+ OpenRouter `nex-agi/nex-n2.5-pro`·`mistralai/mistral-small-3.1-24b-instruct`,
49
+ Vercel `mixedbread/toast-1`·`quiverai/arrow-2`·`arrow-2-telos`, Hugging Face `tencent/Hy4-preview`다.
50
+
51
+ 제거는 갱신 소스에서 더 이상 선정되지 않은 항목이다. NVIDIA `deepseek-v4-flash-0731`,
52
+ OpenCode `mimo-v2.5-free`, OpenRouter `anthropic/claude-opus-4`와 batch 별칭 7개,
53
+ `kwaipilot/kat-coder-pro-v2`가 해당한다. 공급자 폐기 공지나 모든 계정의 사용 불가는 아니다.
54
+
55
+ OpenRouter가 선언한 context·출력 상한 변경 15건은 목록 값을 그대로 반영했다.
56
+ 예를 들면 `anthropic/claude-sonnet-4` context는 1,000,000에서 200,000으로, Aion 2.0/3.0 context는
57
+ 131,072에서 1,048,576으로 바뀌었다. 이 숫자는 route 선언이지 공급자 원문 보증은 아니다.
58
+
59
+ ### 검증과 한계
60
+
61
+ 표적 vitest 12파일 151개 통과. `generate-models.ts` LSP diagnostics 없음.
62
+ 공급자 추론, 전체 `npm run check`, build/install, commit/push는 실행하지 않았다.
63
+ 계정별 사용 가능 여부와 실제 청구액은 검증 범위 밖이다.
64
+
6
65
  ## 2026-09-19 갱신: 라이브 재생성과 생성기 결함 3건 교정
7
66
 
8
67
  `npm run models:refresh`를 종료0으로 재생성했다(전 소스 응답, `--allow-partial` 미사용,
@@ -297,3 +356,102 @@ npm run check
297
356
  [Gemini thinking](https://ai.google.dev/gemini-api/docs/generate-content/thinking),
298
357
  [DeepSeek thinking](https://api-docs.deepseek.com/guides/thinking_mode),
299
358
  [Model Studio DeepSeek](https://www.alibabacloud.com/help/en/model-studio/deepseek-api).
359
+
360
+ ## 2026-09-23 대조: MiMo V2.6 커버리지와 xhigh
361
+
362
+ 카탈로그를 다시 생성하지 않았다. 2026-09-22 갱신이 넣은 V2.6 항목을 라이브 소스와
363
+ 대조하고, 빠지면 실패하는 검사를 추가했다. 공급자 추론 호출은 하지 않았다.
364
+
365
+ ### 커버리지
366
+
367
+ `mimo-v2.6-pro`와 `mimo-v2.6-flash`를 올리는 현재 OMK 공급자는 모두 이미 갖고 있다.
368
+
369
+ | 공급자 | 상류 | 카탈로그 |
370
+ | `xiaomi`, 토큰 플랜 cn/ams/sgp | models.dev `xiaomi`가 Flash/Pro/Pro UltraSpeed | 네 곳 모두 세 모델. 토큰 플랜은 `xiaomi` 목록을 미러 |
371
+ | `openrouter` | 라이브 `/api/v1/models`의 `xiaomi/mimo-v2.6-*` 3개 | 그대로 |
372
+ | `vercel-ai-gateway` | 라이브 `ai-gateway.vercel.sh/v1/models` 3개 | 그대로 |
373
+ | `opencode-go` | Flash/Pro. UltraSpeed 없음 | Flash/Pro |
374
+ | `opencode` | Zen은 `mimo-v2.6-flash-free`만, context 200,000 | 그대로. 유료 Pro/Flash는 Zen 목록에 없음 |
375
+ | `huggingface` | 라우터는 V2.5/V2.5-Pro만 | V2.6 없음이 맞음 |
376
+
377
+ OMK에 없는 게이트웨이(nano-gpt, Kilo, CrossModel, EmpirioLabs, LLM Gateway, DevPass)는
378
+ 이번 범위가 아니다.
379
+
380
+ ### xhigh는 없다
381
+
382
+ MiMo V2.6은 xhigh를 지원하지 않는다. 상류가 선언하지 않은 사다리를 만들지 않았다.
383
+
384
+ - Xiaomi Chat Completions는 `thinking.type`의 `enabled`/`disabled`만 받는다.
385
+ [openai-api](https://mimo.mi.com/docs/en-US/api/chat/openai-api), 2026-09-22 갱신.
386
+ - Responses 호환 `reasoning.effort`는 `none`/`low`/`medium`/`high`다. `none`만 끄고
387
+ 나머지는 동작이 같다. 문서 원문: "The reasoning intensity is not differentiated at this stage."
388
+ [responses](https://mimo.mi.com/docs/en-US/api/chat/responses)
389
+ - models.dev의 `xiaomi`, 토큰 플랜 3곳, `openrouter`는 `reasoning_options: [{type: "toggle"}]`다.
390
+ OpenRouter 라이브도 `supported_reasoning_parameters: null`이다.
391
+ - 라이브 Vercel 게이트웨이는 `xiaomi/mimo-v2.6-*`에 `none`/`minimal`/`low`/`medium`/`high`만
392
+ 선언한다. models.dev `vercel` 항목의 `xhigh`/`max`는 이 조회와 맞지 않아 따르지 않았다.
393
+
394
+ xhigh가 보이는 곳은 V2.5 라우트(Hugging Face, 일부 애그리게이터)이거나 MiMo Code 문서의
395
+ OpenAI 변형 목록이다. V2.6 계약이 아니다.
396
+
397
+ ### 검증
398
+
399
+ `packages/ai/test/mimo-v26-catalog.test.ts` 46개 통과(종료 0). 21개 항목이 존재하고
400
+ `xhigh`/`max`/`ultra`를 노출하지 않는지, Xiaomi 4곳은 `thinkingFormat: "deepseek"` 토글인지
401
+ 고정한다. 공급자 추론, `npm run check`, build/install, commit은 하지 않았다.
402
+
403
+ ## 2026-09-23 갱신: Claude Opus 5.5와 GPT-6 Sol
404
+
405
+ AdaptOrch `TopologyRouter`는 증거, 생성, 검사를 `sequential`로 권고했다(width 1, critical depth 3).
406
+ 실행 순서가 아니라 권고이다. `npm run generate-models`는 전 소스가 응답해 종료 0으로 끝났다.
407
+ 공급자 추론은 하지 않았다.
408
+
409
+ | 모델 | 공식 원천 | 카탈로그 |
410
+ | Claude Opus 5.5 | `claude-opus-5-5`, context 1,000,000, output 128,000, effort `low/medium/high/xhigh/max`, thinking 끄기 불가 | `anthropic`, Bedrock 6개 지역 식별자, OpenRouter `anthropic/claude-opus-5.5`, Vercel `anthropic/claude-opus-5.5` |
411
+ | GPT-6 Sol | OpenAI 모델 색인에 없음. OpenRouter는 `none`부터 `max`, Vercel 라이브는 `high`까지 | OpenRouter `openai/gpt-6-sol`, `openai/gpt-6-sol-pro`와 batch. Vercel `openai/gpt-6-sol`. `openai` 공급자에는 넣지 않음 |
412
+
413
+ Vertex의 `claude-opus-5-5@default`는 OMK `google-vertex`가 쓰는 Gemini API가 아니므로 넣지 않았다.
414
+ 기존 문서는 Opus 4.7/4.8과 Fable만 `xhigh`와 `max`를 갖는다고 적었지만, Opus 5.5 공식 문서가 같은 사다리를 선언한다.
415
+
416
+ 검사: `packages/ai/test/opus55-gpt6sol-catalog.test.ts` 15개, `catalog-thinking.test.ts` 23개,
417
+ `mimo-v26-catalog.test.ts` 46개 통과. `catalog-thinking.ts`와 `bedrock-thinking.ts` 주 LSP는 오류 없다.
418
+ `npm run check`, build/install, commit은 하지 않았다.
419
+
420
+ 근거: [Opus 5.5](https://platform.claude.com/docs/en/models/opus-5-5/overview),
421
+ [models.dev](https://models.dev/api.json), [OpenRouter models](https://openrouter.ai/api/v1/models),
422
+ [Vercel AI Gateway models](https://ai-gateway.vercel.sh/v1/models).
423
+
424
+ ### 2026-09-23 후속 검증: 라이브 대조, 상류 드리프트, stale 검사 정리
425
+
426
+ AdaptOrch `TopologyRouter`는 증거/검사/보고 3노드를 `parallel`로 권고했다
427
+ (추가 비용 없음, 권고일 뿐 실행 순서 아님). 재생성으로 `npm run generate-models`
428
+ 종료 0, 1,876개 route.
429
+
430
+ - **라이브 대조 일치**: OpenRouter(`openai/gpt-6-sol` 4종, effort `none`~`max`), Vercel
431
+ (`openai/gpt-6-sol`은 `none/low/medium/high`만 선언 — `anthropic-messages` 예산 경로라
432
+ thinkingLevelMap 생략이 일치), Anthropic 문서(1M context, 128K output, adaptive
433
+ thinking 상시, effort 5단계) 모두 카탈로그 값과 일치했다.
434
+ - **상류 드리프트 반영**: 이전 단락의 "OpenAI 모델 색인에 없음"은 stale해졌다.
435
+ models.dev가 `openai`/`azure`/`opencode`의 Responses route에 `gpt-6-sol`과
436
+ `gpt-6-luna`를 새로 올렸고 네 소스 모두 effort `none`~`max`를 선언한다.
437
+ `catalog-thinking.ts`에 `GPT6_SOL_LUNA_ID` 규칙을 추가해 해당 route에
438
+ `off:"none"`/`minimal:null`/`low`~`max` 맵을 입혔다(Vercel은 anthropic-messages
439
+ 예산 경로, openai-codex는 별도 천장이라 제외). OpenCode의 `claude-opus-5-5`와
440
+ OpenRouter의 `qwen/qwen3.8-omni-flash`(effort 미선언, 일반 Qwen 규칙 적용)도
441
+ 상류 신규 등재로 들어왔다.
442
+ - **stale 검사 정리**: `thinking-max-level.test.ts`가 기대하던 `z-ai/glm-5.2:batch`는
443
+ OpenRouter 라이브 목록에서 제거됐고(현재 `z-ai/glm-5.2`, `z-ai/glm-5.2:free`만 존재),
444
+ 재생성 카탈로그는 정확하므로 검사 대상에서 빼고 주석을 남겼다.
445
+ - **정규식 대칭 보정**: `OPUS_55_ID`의 점 철자(`claude-opus-5.5`) 대안부가 `^|/`만
446
+ 허용하던 것을 `^|[./]`로 맞췄다. 오늘 카탈로그에는 해당 형태가 없어 동작 변화는 없다.
447
+ - **회귀 가드 추가**: `opus55-gpt6sol-catalog.test.ts`에 `claude-opus-5` 본체가 여전히
448
+ `off`를 노출하는지, `openai`/`azure`/`opencode`의 `gpt-6-sol`이 선언 사다리를 노출하는지,
449
+ `gpt-6-sol-fast`를 지어내지 않는지 검사를 추가했다(20개로 확장).
450
+ - **기존 한계 기록**: `bedrock-thinking.ts`의 `opus-(?:4-[678]|5(?:-5)?)(?:-|$)`는
451
+ `opus-5-6` 같은 미래 ID도 매치한다(기존 `5` 분기와 동일한 관용, 이번 변경의 회귀 아님).
452
+ `grok-thinking.ts` 정적 테이블은 정확-일치 키만 지원해 `grok-4.8+` 변형이 들어오면
453
+ `isDocumentedGrokXhighModel` floor가 xhigh 맵은 입혀도 런타임 compat은 미적용이다.
454
+
455
+ 재검증: 표적 vitest 14파일 204개 중 203 통과·1 skip(유료 Bedrock E2E). 변경 파일 Biome,
456
+ `tsgo --noEmit`, `git diff --check` 종료 0. 공급자 추론, `npm run check`, build/install,
457
+ commit은 하지 않았다. 계정별 사용 가능 여부와 실제 청구액은 검증 범위 밖이다.
package/docs/models.md CHANGED
@@ -22,7 +22,7 @@ The NVIDIA catalog is filtered against NIM's live model IDs and known compatibil
22
22
  limits. A historical GLM route is not evidence that NIM still lists it. Use the
23
23
  current model selector rather than copying a removed ID from older examples.
24
24
 
25
- The [2026-09-09 catalog refresh](model-catalog-refresh.md) records new models,
25
+ The [2026-09-22 catalog refresh](model-catalog-refresh.md) records new models,
26
26
  provider-specific thinking ladders, and verification limits. Model discovery does
27
27
  not prove that an account can invoke that model.
28
28