open-multi-agent-kit 0.98.4 → 0.99.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (357) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +4 -2
  3. package/dist/cli/help.d.ts.map +1 -1
  4. package/dist/cli/help.js +1 -0
  5. package/dist/cli/help.js.map +1 -1
  6. package/dist/commands/run-command.d.ts +2 -1
  7. package/dist/commands/run-command.d.ts.map +1 -1
  8. package/dist/commands/run-command.js +9 -1
  9. package/dist/commands/run-command.js.map +1 -1
  10. package/dist/commands/verified-run-cli.d.ts +6 -0
  11. package/dist/commands/verified-run-cli.d.ts.map +1 -0
  12. package/dist/commands/verified-run-cli.js +190 -0
  13. package/dist/commands/verified-run-cli.js.map +1 -0
  14. package/dist/core/agent-session-services.d.ts +8 -1
  15. package/dist/core/agent-session-services.d.ts.map +1 -1
  16. package/dist/core/agent-session-services.js +41 -0
  17. package/dist/core/agent-session-services.js.map +1 -1
  18. package/dist/core/agent-session.d.ts +7 -8
  19. package/dist/core/agent-session.d.ts.map +1 -1
  20. package/dist/core/agent-session.js +80 -43
  21. package/dist/core/agent-session.js.map +1 -1
  22. package/dist/core/devin-harness-dispatch.d.ts +12 -0
  23. package/dist/core/devin-harness-dispatch.d.ts.map +1 -0
  24. package/dist/core/devin-harness-dispatch.js +12 -0
  25. package/dist/core/devin-harness-dispatch.js.map +1 -0
  26. package/dist/core/devin-harness.d.ts +53 -0
  27. package/dist/core/devin-harness.d.ts.map +1 -0
  28. package/dist/core/devin-harness.js +112 -0
  29. package/dist/core/devin-harness.js.map +1 -0
  30. package/dist/core/domain-dispatch.d.ts +4 -1
  31. package/dist/core/domain-dispatch.d.ts.map +1 -1
  32. package/dist/core/domain-dispatch.js +5 -0
  33. package/dist/core/domain-dispatch.js.map +1 -1
  34. package/dist/core/domain-loadouts-provider-harness.d.ts +12 -0
  35. package/dist/core/domain-loadouts-provider-harness.d.ts.map +1 -0
  36. package/dist/core/domain-loadouts-provider-harness.js +122 -0
  37. package/dist/core/domain-loadouts-provider-harness.js.map +1 -0
  38. package/dist/core/domain-loadouts.d.ts +2 -33
  39. package/dist/core/domain-loadouts.d.ts.map +1 -1
  40. package/dist/core/domain-loadouts.js +3 -56
  41. package/dist/core/domain-loadouts.js.map +1 -1
  42. package/dist/core/domain-profile.d.ts +40 -0
  43. package/dist/core/domain-profile.d.ts.map +1 -0
  44. package/dist/core/domain-profile.js +7 -0
  45. package/dist/core/domain-profile.js.map +1 -0
  46. package/dist/core/grok-harness-dispatch.d.ts +6 -20
  47. package/dist/core/grok-harness-dispatch.d.ts.map +1 -1
  48. package/dist/core/grok-harness-dispatch.js +6 -55
  49. package/dist/core/grok-harness-dispatch.js.map +1 -1
  50. package/dist/core/grok-harness.d.ts +7 -9
  51. package/dist/core/grok-harness.d.ts.map +1 -1
  52. package/dist/core/grok-harness.js +9 -23
  53. package/dist/core/grok-harness.js.map +1 -1
  54. package/dist/core/harness-skills.d.ts +20 -0
  55. package/dist/core/harness-skills.d.ts.map +1 -0
  56. package/dist/core/harness-skills.js +36 -0
  57. package/dist/core/harness-skills.js.map +1 -0
  58. package/dist/core/loadout-runtime-state.d.ts +25 -0
  59. package/dist/core/loadout-runtime-state.d.ts.map +1 -0
  60. package/dist/core/loadout-runtime-state.js +39 -0
  61. package/dist/core/loadout-runtime-state.js.map +1 -0
  62. package/dist/core/loadout-runtime.d.ts +2 -12
  63. package/dist/core/loadout-runtime.d.ts.map +1 -1
  64. package/dist/core/loadout-runtime.js +6 -13
  65. package/dist/core/loadout-runtime.js.map +1 -1
  66. package/dist/core/model-resolver.d.ts +1 -41
  67. package/dist/core/model-resolver.d.ts.map +1 -1
  68. package/dist/core/model-resolver.js +2 -49
  69. package/dist/core/model-resolver.js.map +1 -1
  70. package/dist/core/prompt-settlement.d.ts +4 -3
  71. package/dist/core/prompt-settlement.d.ts.map +1 -1
  72. package/dist/core/prompt-settlement.js.map +1 -1
  73. package/dist/core/provider-default-models.d.ts +42 -0
  74. package/dist/core/provider-default-models.d.ts.map +1 -0
  75. package/dist/core/provider-default-models.js +50 -0
  76. package/dist/core/provider-default-models.js.map +1 -0
  77. package/dist/core/provider-display-names.d.ts.map +1 -1
  78. package/dist/core/provider-display-names.js +1 -0
  79. package/dist/core/provider-display-names.js.map +1 -1
  80. package/dist/core/provider-harness-dispatch.d.ts +63 -0
  81. package/dist/core/provider-harness-dispatch.d.ts.map +1 -0
  82. package/dist/core/provider-harness-dispatch.js +60 -0
  83. package/dist/core/provider-harness-dispatch.js.map +1 -0
  84. package/dist/core/provider-usage-devin.d.ts +16 -0
  85. package/dist/core/provider-usage-devin.d.ts.map +1 -0
  86. package/dist/core/provider-usage-devin.js +61 -0
  87. package/dist/core/provider-usage-devin.js.map +1 -0
  88. package/dist/core/provider-usage-text.d.ts +5 -0
  89. package/dist/core/provider-usage-text.d.ts.map +1 -0
  90. package/dist/core/provider-usage-text.js +15 -0
  91. package/dist/core/provider-usage-text.js.map +1 -0
  92. package/dist/core/provider-usage-types.d.ts +2 -1
  93. package/dist/core/provider-usage-types.d.ts.map +1 -1
  94. package/dist/core/provider-usage-types.js.map +1 -1
  95. package/dist/core/provider-usage.d.ts +1 -2
  96. package/dist/core/provider-usage.d.ts.map +1 -1
  97. package/dist/core/provider-usage.js +12 -7
  98. package/dist/core/provider-usage.js.map +1 -1
  99. package/dist/core/run-budget-policy.d.ts +18 -0
  100. package/dist/core/run-budget-policy.d.ts.map +1 -0
  101. package/dist/core/run-budget-policy.js +52 -0
  102. package/dist/core/run-budget-policy.js.map +1 -0
  103. package/dist/core/run-budget.d.ts +33 -0
  104. package/dist/core/run-budget.d.ts.map +1 -0
  105. package/dist/core/run-budget.js +89 -0
  106. package/dist/core/run-budget.js.map +1 -0
  107. package/dist/core/run-execution-api.d.ts +15 -0
  108. package/dist/core/run-execution-api.d.ts.map +1 -0
  109. package/dist/core/run-execution-api.js +7 -0
  110. package/dist/core/run-execution-api.js.map +1 -0
  111. package/dist/core/run-journal.d.ts.map +1 -1
  112. package/dist/core/run-journal.js +30 -208
  113. package/dist/core/run-journal.js.map +1 -1
  114. package/dist/core/sdk.d.ts.map +1 -1
  115. package/dist/core/sdk.js +23 -18
  116. package/dist/core/sdk.js.map +1 -1
  117. package/dist/core/session-bash-service.d.ts +2 -2
  118. package/dist/core/session-bash-service.d.ts.map +1 -1
  119. package/dist/core/session-bash-service.js +21 -9
  120. package/dist/core/session-bash-service.js.map +1 -1
  121. package/dist/core/session-failure-cause.d.ts.map +1 -1
  122. package/dist/core/session-failure-cause.js +5 -0
  123. package/dist/core/session-failure-cause.js.map +1 -1
  124. package/dist/core/session-prompt-lifecycle.d.ts +25 -0
  125. package/dist/core/session-prompt-lifecycle.d.ts.map +1 -0
  126. package/dist/core/session-prompt-lifecycle.js +87 -0
  127. package/dist/core/session-prompt-lifecycle.js.map +1 -0
  128. package/dist/core/session-run-budget.d.ts +28 -0
  129. package/dist/core/session-run-budget.d.ts.map +1 -0
  130. package/dist/core/session-run-budget.js +127 -0
  131. package/dist/core/session-run-budget.js.map +1 -0
  132. package/dist/core/session-run-termination.d.ts.map +1 -1
  133. package/dist/core/session-run-termination.js +14 -3
  134. package/dist/core/session-run-termination.js.map +1 -1
  135. package/dist/core/session-termination-types.d.ts +97 -0
  136. package/dist/core/session-termination-types.d.ts.map +1 -0
  137. package/dist/core/session-termination-types.js +26 -0
  138. package/dist/core/session-termination-types.js.map +1 -0
  139. package/dist/core/session-termination.d.ts +3 -97
  140. package/dist/core/session-termination.d.ts.map +1 -1
  141. package/dist/core/session-termination.js +24 -28
  142. package/dist/core/session-termination.js.map +1 -1
  143. package/dist/core/slash-commands.d.ts.map +1 -1
  144. package/dist/core/slash-commands.js +1 -0
  145. package/dist/core/slash-commands.js.map +1 -1
  146. package/dist/core/subagent-lane-launcher.d.ts +3 -2
  147. package/dist/core/subagent-lane-launcher.d.ts.map +1 -1
  148. package/dist/core/subagent-lane-launcher.js +24 -13
  149. package/dist/core/subagent-lane-launcher.js.map +1 -1
  150. package/dist/core/verified-run/broker.d.ts +26 -0
  151. package/dist/core/verified-run/broker.d.ts.map +1 -0
  152. package/dist/core/verified-run/broker.js +210 -0
  153. package/dist/core/verified-run/broker.js.map +1 -0
  154. package/dist/core/verified-run/candidate.d.ts +24 -0
  155. package/dist/core/verified-run/candidate.d.ts.map +1 -0
  156. package/dist/core/verified-run/candidate.js +167 -0
  157. package/dist/core/verified-run/candidate.js.map +1 -0
  158. package/dist/core/verified-run/check-receipt.d.ts +18 -0
  159. package/dist/core/verified-run/check-receipt.d.ts.map +1 -0
  160. package/dist/core/verified-run/check-receipt.js +92 -0
  161. package/dist/core/verified-run/check-receipt.js.map +1 -0
  162. package/dist/core/verified-run/coordinator.d.ts +39 -0
  163. package/dist/core/verified-run/coordinator.d.ts.map +1 -0
  164. package/dist/core/verified-run/coordinator.js +190 -0
  165. package/dist/core/verified-run/coordinator.js.map +1 -0
  166. package/dist/core/verified-run/dag-candidates.d.ts +8 -0
  167. package/dist/core/verified-run/dag-candidates.d.ts.map +1 -0
  168. package/dist/core/verified-run/dag-candidates.js +65 -0
  169. package/dist/core/verified-run/dag-candidates.js.map +1 -0
  170. package/dist/core/verified-run/dag-phase.d.ts +7 -0
  171. package/dist/core/verified-run/dag-phase.d.ts.map +1 -0
  172. package/dist/core/verified-run/dag-phase.js +130 -0
  173. package/dist/core/verified-run/dag-phase.js.map +1 -0
  174. package/dist/core/verified-run/dag-projection.d.ts +7 -0
  175. package/dist/core/verified-run/dag-projection.d.ts.map +1 -0
  176. package/dist/core/verified-run/dag-projection.js +103 -0
  177. package/dist/core/verified-run/dag-projection.js.map +1 -0
  178. package/dist/core/verified-run/dag-recovery.d.ts +13 -0
  179. package/dist/core/verified-run/dag-recovery.d.ts.map +1 -0
  180. package/dist/core/verified-run/dag-recovery.js +98 -0
  181. package/dist/core/verified-run/dag-recovery.js.map +1 -0
  182. package/dist/core/verified-run/dag-retry-projection.d.ts +9 -0
  183. package/dist/core/verified-run/dag-retry-projection.d.ts.map +1 -0
  184. package/dist/core/verified-run/dag-retry-projection.js +43 -0
  185. package/dist/core/verified-run/dag-retry-projection.js.map +1 -0
  186. package/dist/core/verified-run/dag-types.d.ts +58 -0
  187. package/dist/core/verified-run/dag-types.d.ts.map +1 -0
  188. package/dist/core/verified-run/dag-types.js +2 -0
  189. package/dist/core/verified-run/dag-types.js.map +1 -0
  190. package/dist/core/verified-run/event-parser.d.ts +3 -0
  191. package/dist/core/verified-run/event-parser.d.ts.map +1 -0
  192. package/dist/core/verified-run/event-parser.js +154 -0
  193. package/dist/core/verified-run/event-parser.js.map +1 -0
  194. package/dist/core/verified-run/events.d.ts +4 -0
  195. package/dist/core/verified-run/events.d.ts.map +1 -0
  196. package/dist/core/verified-run/events.js +3 -0
  197. package/dist/core/verified-run/events.js.map +1 -0
  198. package/dist/core/verified-run/evidence-binding.d.ts +18 -0
  199. package/dist/core/verified-run/evidence-binding.d.ts.map +1 -0
  200. package/dist/core/verified-run/evidence-binding.js +81 -0
  201. package/dist/core/verified-run/evidence-binding.js.map +1 -0
  202. package/dist/core/verified-run/evidence.d.ts +27 -0
  203. package/dist/core/verified-run/evidence.d.ts.map +1 -0
  204. package/dist/core/verified-run/evidence.js +100 -0
  205. package/dist/core/verified-run/evidence.js.map +1 -0
  206. package/dist/core/verified-run/journal.d.ts +32 -0
  207. package/dist/core/verified-run/journal.d.ts.map +1 -0
  208. package/dist/core/verified-run/journal.js +103 -0
  209. package/dist/core/verified-run/journal.js.map +1 -0
  210. package/dist/core/verified-run/namespace-identity.d.ts +11 -0
  211. package/dist/core/verified-run/namespace-identity.d.ts.map +1 -0
  212. package/dist/core/verified-run/namespace-identity.js +77 -0
  213. package/dist/core/verified-run/namespace-identity.js.map +1 -0
  214. package/dist/core/verified-run/owned-execution.d.ts +22 -0
  215. package/dist/core/verified-run/owned-execution.d.ts.map +1 -0
  216. package/dist/core/verified-run/owned-execution.js +49 -0
  217. package/dist/core/verified-run/owned-execution.js.map +1 -0
  218. package/dist/core/verified-run/phase-context.d.ts +9 -0
  219. package/dist/core/verified-run/phase-context.d.ts.map +1 -0
  220. package/dist/core/verified-run/phase-context.js +2 -0
  221. package/dist/core/verified-run/phase-context.js.map +1 -0
  222. package/dist/core/verified-run/process-gate.d.ts +5 -0
  223. package/dist/core/verified-run/process-gate.d.ts.map +1 -0
  224. package/dist/core/verified-run/process-gate.js +31 -0
  225. package/dist/core/verified-run/process-gate.js.map +1 -0
  226. package/dist/core/verified-run/process-projection.d.ts +13 -0
  227. package/dist/core/verified-run/process-projection.d.ts.map +1 -0
  228. package/dist/core/verified-run/process-projection.js +82 -0
  229. package/dist/core/verified-run/process-projection.js.map +1 -0
  230. package/dist/core/verified-run/projection.d.ts +4 -0
  231. package/dist/core/verified-run/projection.d.ts.map +1 -0
  232. package/dist/core/verified-run/projection.js +175 -0
  233. package/dist/core/verified-run/projection.js.map +1 -0
  234. package/dist/core/verified-run/recovery-clock.d.ts +19 -0
  235. package/dist/core/verified-run/recovery-clock.d.ts.map +1 -0
  236. package/dist/core/verified-run/recovery-clock.js +69 -0
  237. package/dist/core/verified-run/recovery-clock.js.map +1 -0
  238. package/dist/core/verified-run/recovery-command.d.ts +11 -0
  239. package/dist/core/verified-run/recovery-command.d.ts.map +1 -0
  240. package/dist/core/verified-run/recovery-command.js +73 -0
  241. package/dist/core/verified-run/recovery-command.js.map +1 -0
  242. package/dist/core/verified-run/recovery-projection.d.ts +12 -0
  243. package/dist/core/verified-run/recovery-projection.d.ts.map +1 -0
  244. package/dist/core/verified-run/recovery-projection.js +88 -0
  245. package/dist/core/verified-run/recovery-projection.js.map +1 -0
  246. package/dist/core/verified-run/recovery.d.ts +12 -0
  247. package/dist/core/verified-run/recovery.d.ts.map +1 -0
  248. package/dist/core/verified-run/recovery.js +115 -0
  249. package/dist/core/verified-run/recovery.js.map +1 -0
  250. package/dist/core/verified-run/run-types.d.ts +104 -0
  251. package/dist/core/verified-run/run-types.d.ts.map +1 -0
  252. package/dist/core/verified-run/run-types.js +2 -0
  253. package/dist/core/verified-run/run-types.js.map +1 -0
  254. package/dist/core/verified-run/scripted-writer.d.ts +15 -0
  255. package/dist/core/verified-run/scripted-writer.d.ts.map +1 -0
  256. package/dist/core/verified-run/scripted-writer.js +94 -0
  257. package/dist/core/verified-run/scripted-writer.js.map +1 -0
  258. package/dist/core/verified-run/session-port.d.ts +27 -0
  259. package/dist/core/verified-run/session-port.d.ts.map +1 -0
  260. package/dist/core/verified-run/session-port.js +2 -0
  261. package/dist/core/verified-run/session-port.js.map +1 -0
  262. package/dist/core/verified-run/storage.d.ts +15 -0
  263. package/dist/core/verified-run/storage.d.ts.map +1 -0
  264. package/dist/core/verified-run/storage.js +96 -0
  265. package/dist/core/verified-run/storage.js.map +1 -0
  266. package/dist/core/verified-run/task-execution.d.ts +9 -0
  267. package/dist/core/verified-run/task-execution.d.ts.map +1 -0
  268. package/dist/core/verified-run/task-execution.js +29 -0
  269. package/dist/core/verified-run/task-execution.js.map +1 -0
  270. package/dist/core/verified-run/verification-phase.d.ts +5 -0
  271. package/dist/core/verified-run/verification-phase.d.ts.map +1 -0
  272. package/dist/core/verified-run/verification-phase.js +56 -0
  273. package/dist/core/verified-run/verification-phase.js.map +1 -0
  274. package/dist/core/verified-run/work-recovery.d.ts +8 -0
  275. package/dist/core/verified-run/work-recovery.d.ts.map +1 -0
  276. package/dist/core/verified-run/work-recovery.js +44 -0
  277. package/dist/core/verified-run/work-recovery.js.map +1 -0
  278. package/dist/core/verified-run/writer-completion.d.ts +4 -0
  279. package/dist/core/verified-run/writer-completion.d.ts.map +1 -0
  280. package/dist/core/verified-run/writer-completion.js +27 -0
  281. package/dist/core/verified-run/writer-completion.js.map +1 -0
  282. package/dist/core/verified-run/writer-phase.d.ts +8 -0
  283. package/dist/core/verified-run/writer-phase.d.ts.map +1 -0
  284. package/dist/core/verified-run/writer-phase.js +76 -0
  285. package/dist/core/verified-run/writer-phase.js.map +1 -0
  286. package/dist/core/verified-run/writer-projection.d.ts +11 -0
  287. package/dist/core/verified-run/writer-projection.d.ts.map +1 -0
  288. package/dist/core/verified-run/writer-projection.js +71 -0
  289. package/dist/core/verified-run/writer-projection.js.map +1 -0
  290. package/dist/core/verified-run/writer-recovery.d.ts +16 -0
  291. package/dist/core/verified-run/writer-recovery.d.ts.map +1 -0
  292. package/dist/core/verified-run/writer-recovery.js +107 -0
  293. package/dist/core/verified-run/writer-recovery.js.map +1 -0
  294. package/dist/core/workload-permit-pool.d.ts +1 -3
  295. package/dist/core/workload-permit-pool.d.ts.map +1 -1
  296. package/dist/core/workload-permit-pool.js +11 -11
  297. package/dist/core/workload-permit-pool.js.map +1 -1
  298. package/dist/index.d.ts +3 -2
  299. package/dist/index.d.ts.map +1 -1
  300. package/dist/index.js +2 -2
  301. package/dist/index.js.map +1 -1
  302. package/dist/main.d.ts.map +1 -1
  303. package/dist/main.js +2 -8
  304. package/dist/main.js.map +1 -1
  305. package/dist/modes/interactive/components/session-failure.d.ts +13 -0
  306. package/dist/modes/interactive/components/session-failure.d.ts.map +1 -0
  307. package/dist/modes/interactive/components/session-failure.js +81 -0
  308. package/dist/modes/interactive/components/session-failure.js.map +1 -0
  309. package/dist/modes/interactive/interactive-mode.d.ts +1 -0
  310. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  311. package/dist/modes/interactive/interactive-mode.js +47 -36
  312. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  313. package/dist/modes/interactive/resource-description.d.ts +3 -0
  314. package/dist/modes/interactive/resource-description.d.ts.map +1 -0
  315. package/dist/modes/interactive/resource-description.js +15 -0
  316. package/dist/modes/interactive/resource-description.js.map +1 -0
  317. package/dist/modes/interactive/tui-diagnostics.d.ts +36 -0
  318. package/dist/modes/interactive/tui-diagnostics.d.ts.map +1 -0
  319. package/dist/modes/interactive/tui-diagnostics.js +105 -0
  320. package/dist/modes/interactive/tui-diagnostics.js.map +1 -0
  321. package/dist/modes/interactive/tui-runtime-info.d.ts +20 -0
  322. package/dist/modes/interactive/tui-runtime-info.d.ts.map +1 -0
  323. package/dist/modes/interactive/tui-runtime-info.js +76 -0
  324. package/dist/modes/interactive/tui-runtime-info.js.map +1 -0
  325. package/docs/development.md +10 -0
  326. package/docs/devin-harness.md +121 -0
  327. package/docs/docs.json +4 -0
  328. package/docs/environment-variables.md +2 -1
  329. package/docs/index.md +1 -0
  330. package/docs/keybindings.md +1 -1
  331. package/docs/loadout-domains/README.md +2 -1
  332. package/docs/loadout-domains/devin-harness.md +72 -0
  333. package/docs/metrics.md +57 -16
  334. package/docs/providers.md +76 -0
  335. package/docs/release-audit-0.98.5.md +101 -0
  336. package/docs/release-audit-0.99.0.md +68 -0
  337. package/docs/run-protocol.md +34 -1
  338. package/docs/runtime-algorithms.md +30 -1
  339. package/docs/sdk.md +198 -1
  340. package/docs/settings.md +1 -1
  341. package/docs/startup-resource-labels-testing.md +47 -0
  342. package/docs/tb21-audit.md +18 -4
  343. package/docs/usage.md +59 -0
  344. package/docs/verified-run-remaining-design.md +881 -0
  345. package/docs/verified-run-testing.md +508 -0
  346. package/docs/verified-run.md +409 -0
  347. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  348. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  349. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  350. package/examples/extensions/gondolin/package-lock.json +2 -2
  351. package/examples/extensions/gondolin/package.json +1 -1
  352. package/examples/extensions/sandbox/package-lock.json +2 -2
  353. package/examples/extensions/sandbox/package.json +1 -1
  354. package/examples/extensions/with-deps/package-lock.json +2 -2
  355. package/examples/extensions/with-deps/package.json +1 -1
  356. package/npm-shrinkwrap.json +18 -18
  357. package/package.json +6 -6
@@ -0,0 +1,3 @@
1
+ /** Keep decorative imported harness markers out of OMK display; source metadata stays unchanged. */
2
+ export declare function formatResourceDescription(description: string | undefined, sourceTag?: string): string | undefined;
3
+ //# sourceMappingURL=resource-description.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-description.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/resource-description.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAWjH","sourcesContent":["/** Keep decorative imported harness markers out of OMK display; source metadata stays unchanged. */\nexport function formatResourceDescription(description: string | undefined, sourceTag?: string): string | undefined {\n\tlet text = description;\n\tif (description) {\n\t\tconst marker = /^\\[(OMX|OMO)\\]\\s*/.exec(description);\n\t\tif (marker) {\n\t\t\tconst body = description.slice(marker[0].length);\n\t\t\ttext = body || \"OMK resource\";\n\t\t}\n\t}\n\tif (!sourceTag) return text;\n\treturn text ? `[${sourceTag}] ${text}` : `[${sourceTag}]`;\n}\n"]}
@@ -0,0 +1,15 @@
1
+ /** Keep decorative imported harness markers out of OMK display; source metadata stays unchanged. */
2
+ export function formatResourceDescription(description, sourceTag) {
3
+ let text = description;
4
+ if (description) {
5
+ const marker = /^\[(OMX|OMO)\]\s*/.exec(description);
6
+ if (marker) {
7
+ const body = description.slice(marker[0].length);
8
+ text = body || "OMK resource";
9
+ }
10
+ }
11
+ if (!sourceTag)
12
+ return text;
13
+ return text ? `[${sourceTag}] ${text}` : `[${sourceTag}]`;
14
+ }
15
+ //# sourceMappingURL=resource-description.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-description.js","sourceRoot":"","sources":["../../../src/modes/interactive/resource-description.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,MAAM,UAAU,yBAAyB,CAAC,WAA+B,EAAE,SAAkB,EAAsB;IAClH,IAAI,IAAI,GAAG,WAAW,CAAC;IACvB,IAAI,WAAW,EAAE,CAAC;QACjB,MAAM,MAAM,GAAG,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACrD,IAAI,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;YACjD,IAAI,GAAG,IAAI,IAAI,cAAc,CAAC;QAC/B,CAAC;IACF,CAAC;IACD,IAAI,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IAC5B,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,SAAS,GAAG,CAAC;AAAA,CAC1D","sourcesContent":["/** Keep decorative imported harness markers out of OMK display; source metadata stays unchanged. */\nexport function formatResourceDescription(description: string | undefined, sourceTag?: string): string | undefined {\n\tlet text = description;\n\tif (description) {\n\t\tconst marker = /^\\[(OMX|OMO)\\]\\s*/.exec(description);\n\t\tif (marker) {\n\t\t\tconst body = description.slice(marker[0].length);\n\t\t\ttext = body || \"OMK resource\";\n\t\t}\n\t}\n\tif (!sourceTag) return text;\n\treturn text ? `[${sourceTag}] ${text}` : `[${sourceTag}]`;\n}\n"]}
@@ -0,0 +1,36 @@
1
+ import { type Component } from "omk-tui";
2
+ import type { SessionTermination } from "../../core/session-termination-types.ts";
3
+ import type { TuiRuntimeCapture, TuiRuntimeInfo } from "./tui-runtime-info.ts";
4
+ type DiagnosticTermination = Pick<SessionTermination, "kind" | "phase" | "causeCode" | "source" | "sideEffects" | "retryable" | "safeToAutoRetry">;
5
+ export interface TuiDiagnostics {
6
+ readonly schemaVersion: 1;
7
+ readonly privacy: "metadata-only";
8
+ readonly generatedAt: string;
9
+ readonly runtime: Omit<TuiRuntimeInfo, "entryPath" | "modulePath">;
10
+ readonly terminal: {
11
+ readonly columns: number;
12
+ readonly rows: number;
13
+ };
14
+ readonly session: {
15
+ readonly streaming: boolean;
16
+ readonly compacting: boolean;
17
+ readonly messageCount: number;
18
+ readonly lastResourceReloadAt: string | null;
19
+ };
20
+ readonly termination: DiagnosticTermination | null;
21
+ }
22
+ /** Project each approved field; never serialize a session, message, model, config or arbitrary error. */
23
+ export declare function createTuiDiagnostics(input: {
24
+ readonly runtime: TuiRuntimeInfo;
25
+ readonly columns: number;
26
+ readonly rows: number;
27
+ readonly isStreaming: boolean;
28
+ readonly isCompacting: boolean;
29
+ readonly messageCount: number;
30
+ readonly lastResourceReloadAt: string | undefined;
31
+ readonly termination: SessionTermination | undefined;
32
+ }): TuiDiagnostics;
33
+ export declare function saveTuiDiagnostics(report: TuiDiagnostics, directory?: string): string;
34
+ export declare function createTuiDiagnosticsView(report: TuiDiagnostics, locations: TuiRuntimeCapture): Component;
35
+ export {};
36
+ //# sourceMappingURL=tui-diagnostics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tui-diagnostics.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/tui-diagnostics.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAmB,MAAM,SAAS,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAIlF,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE/E,KAAK,qBAAqB,GAAG,IAAI,CAChC,kBAAkB,EAClB,MAAM,GAAG,OAAO,GAAG,WAAW,GAAG,QAAQ,GAAG,aAAa,GAAG,WAAW,GAAG,iBAAiB,CAC3F,CAAC;AACF,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,WAAW,GAAG,YAAY,CAAC,CAAC;IACnE,QAAQ,CAAC,QAAQ,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACvE,QAAQ,CAAC,OAAO,EAAE;QACjB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;QAC5B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;QAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;QAC9B,QAAQ,CAAC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;KAC7C,CAAC;IACF,QAAQ,CAAC,WAAW,EAAE,qBAAqB,GAAG,IAAI,CAAC;CACnD;AAED,yGAAyG;AACzG,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC3C,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;IAClD,QAAQ,CAAC,WAAW,EAAE,kBAAkB,GAAG,SAAS,CAAC;CACrD,GAAG,cAAc,CAsCjB;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,cAAc,EAAE,SAAS,SAAW,GAAG,MAAM,CAcvF;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,iBAAiB,GAAG,SAAS,CAiDxG","sourcesContent":["import { mkdtempSync, rmSync, writeFileSync } from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { type Component, Container, Text } from \"omk-tui\";\nimport type { SessionTermination } from \"../../core/session-termination-types.ts\";\nimport { DynamicBorder } from \"./components/dynamic-border.ts\";\nimport { diagnosticDisplayText } from \"./components/session-failure.ts\";\nimport { theme } from \"./theme/theme.ts\";\nimport type { TuiRuntimeCapture, TuiRuntimeInfo } from \"./tui-runtime-info.ts\";\n\ntype DiagnosticTermination = Pick<\n\tSessionTermination,\n\t\"kind\" | \"phase\" | \"causeCode\" | \"source\" | \"sideEffects\" | \"retryable\" | \"safeToAutoRetry\"\n>;\nexport interface TuiDiagnostics {\n\treadonly schemaVersion: 1;\n\treadonly privacy: \"metadata-only\";\n\treadonly generatedAt: string;\n\treadonly runtime: Omit<TuiRuntimeInfo, \"entryPath\" | \"modulePath\">;\n\treadonly terminal: { readonly columns: number; readonly rows: number };\n\treadonly session: {\n\t\treadonly streaming: boolean;\n\t\treadonly compacting: boolean;\n\t\treadonly messageCount: number;\n\t\treadonly lastResourceReloadAt: string | null;\n\t};\n\treadonly termination: DiagnosticTermination | null;\n}\n\n/** Project each approved field; never serialize a session, message, model, config or arbitrary error. */\nexport function createTuiDiagnostics(input: {\n\treadonly runtime: TuiRuntimeInfo;\n\treadonly columns: number;\n\treadonly rows: number;\n\treadonly isStreaming: boolean;\n\treadonly isCompacting: boolean;\n\treadonly messageCount: number;\n\treadonly lastResourceReloadAt: string | undefined;\n\treadonly termination: SessionTermination | undefined;\n}): TuiDiagnostics {\n\tconst r = input.runtime;\n\tconst t = input.termination;\n\treturn {\n\t\tschemaVersion: 1,\n\t\tprivacy: \"metadata-only\",\n\t\tgeneratedAt: new Date().toISOString(),\n\t\truntime: {\n\t\t\tversion: r.version,\n\t\t\tnodeVersion: r.nodeVersion,\n\t\t\tplatform: r.platform,\n\t\t\tarch: r.arch,\n\t\t\tcapturedAt: r.capturedAt,\n\t\t\tmoduleKind: r.moduleKind,\n\t\t\tmoduleState: r.moduleState,\n\t\t\tinitialModuleSha256: r.initialModuleSha256,\n\t\t\tcurrentModuleSha256: r.currentModuleSha256,\n\t\t\tbuildRevision: r.buildRevision,\n\t\t},\n\t\tterminal: { columns: input.columns, rows: input.rows },\n\t\tsession: {\n\t\t\tstreaming: input.isStreaming,\n\t\t\tcompacting: input.isCompacting,\n\t\t\tmessageCount: input.messageCount,\n\t\t\tlastResourceReloadAt: input.lastResourceReloadAt ?? null,\n\t\t},\n\t\ttermination: t\n\t\t\t? {\n\t\t\t\t\tkind: t.kind,\n\t\t\t\t\tphase: t.phase,\n\t\t\t\t\tcauseCode: t.causeCode,\n\t\t\t\t\tsource: t.source,\n\t\t\t\t\tsideEffects: t.sideEffects,\n\t\t\t\t\tretryable: t.retryable,\n\t\t\t\t\tsafeToAutoRetry: t.safeToAutoRetry,\n\t\t\t\t}\n\t\t\t: null,\n\t};\n}\n\nexport function saveTuiDiagnostics(report: TuiDiagnostics, directory = tmpdir()): string {\n\tconst ownedDirectory = mkdtempSync(join(directory, \"omk-debug-\"));\n\ttry {\n\t\tconst outputPath = join(ownedDirectory, \"diagnostics.json\");\n\t\twriteFileSync(outputPath, `${JSON.stringify(report, null, 2)}\\n`, { flag: \"wx\", mode: 0o600 });\n\t\treturn outputPath;\n\t} catch (error) {\n\t\ttry {\n\t\t\trmSync(ownedDirectory, { recursive: true, force: true });\n\t\t} catch (cleanupError) {\n\t\t\tthrow new AggregateError([error, cleanupError], \"Diagnostics write and cleanup failed\");\n\t\t}\n\t\tthrow error;\n\t}\n}\n\nexport function createTuiDiagnosticsView(report: TuiDiagnostics, locations: TuiRuntimeCapture): Component {\n\treturn {\n\t\trender(width: number): string[] {\n\t\t\tconst view = new Container();\n\t\t\tview.addChild(new DynamicBorder((s) => theme.fg(\"accent\", s)));\n\t\t\tview.addChild(new Text(theme.fg(\"accent\", theme.bold(\"OMK diagnostics\")), 1, 0));\n\t\t\tconst r = report.runtime;\n\t\t\tconst t = report.termination;\n\t\t\tconst moduleStatus =\n\t\t\t\tr.moduleState === \"changed\"\n\t\t\t\t\t? \"changed since initialization — restart to load code\"\n\t\t\t\t\t: r.moduleState === \"unchanged\"\n\t\t\t\t\t\t? \"unchanged since initialization (this file only)\"\n\t\t\t\t\t\t: \"unavailable — not confirmed\";\n\t\t\tconst lines = [\n\t\t\t\t`Runtime: OMK ${r.version} · Node ${r.nodeVersion} · ${r.platform}/${r.arch}`,\n\t\t\t\t`Loaded UI: ${r.moduleKind} · Initialized: ${r.capturedAt}`,\n\t\t\t\t`UI file on disk: ${moduleStatus}`,\n\t\t\t\t`UI SHA256 at initialization: ${r.initialModuleSha256 ?? \"unavailable\"}`,\n\t\t\t\t\"Build revision: unavailable (checkout HEAD is not a build identity)\",\n\t\t\t\t`Last resource reload: ${report.session.lastResourceReloadAt ?? \"not reloaded in this TUI\"}`,\n\t\t\t\t\"/reload refreshes resources, not core code. Core updates require a restart.\",\n\t\t\t\t`Terminal: ${report.terminal.columns}×${report.terminal.rows} · Messages: ${report.session.messageCount}`,\n\t\t\t\t`Streaming: ${report.session.streaming ? \"yes\" : \"no\"} · Compacting: ${report.session.compacting ? \"yes\" : \"no\"}`,\n\t\t\t\tt ? `Latest outcome: ${t.kind} · ${t.causeCode} · ${t.source}` : \"Latest outcome: none recorded\",\n\t\t\t\t...(t\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t`Effects: ${t.sideEffects} · Retryable: ${t.retryable ? \"yes\" : \"no\"} · Automatic retry: ${t.safeToAutoRetry ? \"yes\" : \"no\"}`,\n\t\t\t\t\t\t]\n\t\t\t\t\t: []),\n\t\t\t\t`Launch path (local only): ${locations.entryPath ?? \"unavailable\"}`,\n\t\t\t\t`UI module (local only): ${locations.modulePath ?? \"unavailable\"}`,\n\t\t\t];\n\t\t\tview.addChild(new Text(lines.map(diagnosticDisplayText).join(\"\\n\"), 1, 0));\n\t\t\tview.addChild(\n\t\t\t\tnew Text(\n\t\t\t\t\ttheme.fg(\n\t\t\t\t\t\t\"muted\",\n\t\t\t\t\t\t\"Saving is explicit: /debug save writes a metadata-only JSON report locally.\\nMessages, prompts, outputs, config, paths, route names and session/run IDs are excluded. No upload.\",\n\t\t\t\t\t),\n\t\t\t\t\t1,\n\t\t\t\t\t0,\n\t\t\t\t),\n\t\t\t);\n\t\t\tview.addChild(new DynamicBorder((s) => theme.fg(\"accent\", s)));\n\t\t\treturn view.render(width);\n\t\t},\n\t\tinvalidate(): void {},\n\t};\n}\n"]}
@@ -0,0 +1,105 @@
1
+ import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
2
+ import { tmpdir } from "node:os";
3
+ import { join } from "node:path";
4
+ import { Container, Text } from "omk-tui";
5
+ import { DynamicBorder } from "./components/dynamic-border.js";
6
+ import { diagnosticDisplayText } from "./components/session-failure.js";
7
+ import { theme } from "./theme/theme.js";
8
+ /** Project each approved field; never serialize a session, message, model, config or arbitrary error. */
9
+ export function createTuiDiagnostics(input) {
10
+ const r = input.runtime;
11
+ const t = input.termination;
12
+ return {
13
+ schemaVersion: 1,
14
+ privacy: "metadata-only",
15
+ generatedAt: new Date().toISOString(),
16
+ runtime: {
17
+ version: r.version,
18
+ nodeVersion: r.nodeVersion,
19
+ platform: r.platform,
20
+ arch: r.arch,
21
+ capturedAt: r.capturedAt,
22
+ moduleKind: r.moduleKind,
23
+ moduleState: r.moduleState,
24
+ initialModuleSha256: r.initialModuleSha256,
25
+ currentModuleSha256: r.currentModuleSha256,
26
+ buildRevision: r.buildRevision,
27
+ },
28
+ terminal: { columns: input.columns, rows: input.rows },
29
+ session: {
30
+ streaming: input.isStreaming,
31
+ compacting: input.isCompacting,
32
+ messageCount: input.messageCount,
33
+ lastResourceReloadAt: input.lastResourceReloadAt ?? null,
34
+ },
35
+ termination: t
36
+ ? {
37
+ kind: t.kind,
38
+ phase: t.phase,
39
+ causeCode: t.causeCode,
40
+ source: t.source,
41
+ sideEffects: t.sideEffects,
42
+ retryable: t.retryable,
43
+ safeToAutoRetry: t.safeToAutoRetry,
44
+ }
45
+ : null,
46
+ };
47
+ }
48
+ export function saveTuiDiagnostics(report, directory = tmpdir()) {
49
+ const ownedDirectory = mkdtempSync(join(directory, "omk-debug-"));
50
+ try {
51
+ const outputPath = join(ownedDirectory, "diagnostics.json");
52
+ writeFileSync(outputPath, `${JSON.stringify(report, null, 2)}\n`, { flag: "wx", mode: 0o600 });
53
+ return outputPath;
54
+ }
55
+ catch (error) {
56
+ try {
57
+ rmSync(ownedDirectory, { recursive: true, force: true });
58
+ }
59
+ catch (cleanupError) {
60
+ throw new AggregateError([error, cleanupError], "Diagnostics write and cleanup failed");
61
+ }
62
+ throw error;
63
+ }
64
+ }
65
+ export function createTuiDiagnosticsView(report, locations) {
66
+ return {
67
+ render(width) {
68
+ const view = new Container();
69
+ view.addChild(new DynamicBorder((s) => theme.fg("accent", s)));
70
+ view.addChild(new Text(theme.fg("accent", theme.bold("OMK diagnostics")), 1, 0));
71
+ const r = report.runtime;
72
+ const t = report.termination;
73
+ const moduleStatus = r.moduleState === "changed"
74
+ ? "changed since initialization — restart to load code"
75
+ : r.moduleState === "unchanged"
76
+ ? "unchanged since initialization (this file only)"
77
+ : "unavailable — not confirmed";
78
+ const lines = [
79
+ `Runtime: OMK ${r.version} · Node ${r.nodeVersion} · ${r.platform}/${r.arch}`,
80
+ `Loaded UI: ${r.moduleKind} · Initialized: ${r.capturedAt}`,
81
+ `UI file on disk: ${moduleStatus}`,
82
+ `UI SHA256 at initialization: ${r.initialModuleSha256 ?? "unavailable"}`,
83
+ "Build revision: unavailable (checkout HEAD is not a build identity)",
84
+ `Last resource reload: ${report.session.lastResourceReloadAt ?? "not reloaded in this TUI"}`,
85
+ "/reload refreshes resources, not core code. Core updates require a restart.",
86
+ `Terminal: ${report.terminal.columns}×${report.terminal.rows} · Messages: ${report.session.messageCount}`,
87
+ `Streaming: ${report.session.streaming ? "yes" : "no"} · Compacting: ${report.session.compacting ? "yes" : "no"}`,
88
+ t ? `Latest outcome: ${t.kind} · ${t.causeCode} · ${t.source}` : "Latest outcome: none recorded",
89
+ ...(t
90
+ ? [
91
+ `Effects: ${t.sideEffects} · Retryable: ${t.retryable ? "yes" : "no"} · Automatic retry: ${t.safeToAutoRetry ? "yes" : "no"}`,
92
+ ]
93
+ : []),
94
+ `Launch path (local only): ${locations.entryPath ?? "unavailable"}`,
95
+ `UI module (local only): ${locations.modulePath ?? "unavailable"}`,
96
+ ];
97
+ view.addChild(new Text(lines.map(diagnosticDisplayText).join("\n"), 1, 0));
98
+ view.addChild(new Text(theme.fg("muted", "Saving is explicit: /debug save writes a metadata-only JSON report locally.\nMessages, prompts, outputs, config, paths, route names and session/run IDs are excluded. No upload."), 1, 0));
99
+ view.addChild(new DynamicBorder((s) => theme.fg("accent", s)));
100
+ return view.render(width);
101
+ },
102
+ invalidate() { },
103
+ };
104
+ }
105
+ //# sourceMappingURL=tui-diagnostics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tui-diagnostics.js","sourceRoot":"","sources":["../../../src/modes/interactive/tui-diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAkB,SAAS,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAsBzC,yGAAyG;AACzG,MAAM,UAAU,oBAAoB,CAAC,KASpC,EAAkB;IAClB,MAAM,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC;IACxB,MAAM,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC;IAC5B,OAAO;QACN,aAAa,EAAE,CAAC;QAChB,OAAO,EAAE,eAAe;QACxB,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACrC,OAAO,EAAE;YACR,OAAO,EAAE,CAAC,CAAC,OAAO;YAClB,WAAW,EAAE,CAAC,CAAC,WAAW;YAC1B,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,UAAU,EAAE,CAAC,CAAC,UAAU;YACxB,UAAU,EAAE,CAAC,CAAC,UAA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C,EAAE,CAAC,CAAC,CAAC,CAAC;YAC3E,IAAI,CAAC,QAAQ,CACZ,IAAI,IAAI,CACP,KAAK,CAAC,EAAE,CACP,OAAO,EACP,kLAAkL,CAClL,EACD,CAAC,EACD,CAAC,CACD,CACD,CAAC;YACF,IAAI,CAAC,QAAQ,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAC/D,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAAA,CAC1B;QACD,UAAU,GAAS,EAAC,CAAC;KACrB,CAAC;AAAA,CACF","sourcesContent":["import { mkdtempSync, rmSync, writeFileSync } from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { type Component, Container, Text } from \"omk-tui\";\nimport type { SessionTermination } from \"../../core/session-termination-types.ts\";\nimport { DynamicBorder } from \"./components/dynamic-border.ts\";\nimport { diagnosticDisplayText } from \"./components/session-failure.ts\";\nimport { theme } from \"./theme/theme.ts\";\nimport type { TuiRuntimeCapture, TuiRuntimeInfo } from \"./tui-runtime-info.ts\";\n\ntype DiagnosticTermination = Pick<\n\tSessionTermination,\n\t\"kind\" | \"phase\" | \"causeCode\" | \"source\" | \"sideEffects\" | \"retryable\" | \"safeToAutoRetry\"\n>;\nexport interface TuiDiagnostics {\n\treadonly schemaVersion: 1;\n\treadonly privacy: \"metadata-only\";\n\treadonly generatedAt: string;\n\treadonly runtime: Omit<TuiRuntimeInfo, \"entryPath\" | \"modulePath\">;\n\treadonly terminal: { readonly columns: number; readonly rows: number };\n\treadonly session: {\n\t\treadonly streaming: boolean;\n\t\treadonly compacting: boolean;\n\t\treadonly messageCount: number;\n\t\treadonly lastResourceReloadAt: string | null;\n\t};\n\treadonly termination: DiagnosticTermination | null;\n}\n\n/** Project each approved field; never serialize a session, message, model, config or arbitrary error. */\nexport function createTuiDiagnostics(input: {\n\treadonly runtime: TuiRuntimeInfo;\n\treadonly columns: number;\n\treadonly rows: number;\n\treadonly isStreaming: boolean;\n\treadonly isCompacting: boolean;\n\treadonly messageCount: number;\n\treadonly lastResourceReloadAt: string | undefined;\n\treadonly termination: SessionTermination | undefined;\n}): TuiDiagnostics {\n\tconst r = input.runtime;\n\tconst t = input.termination;\n\treturn {\n\t\tschemaVersion: 1,\n\t\tprivacy: \"metadata-only\",\n\t\tgeneratedAt: new Date().toISOString(),\n\t\truntime: {\n\t\t\tversion: r.version,\n\t\t\tnodeVersion: r.nodeVersion,\n\t\t\tplatform: r.platform,\n\t\t\tarch: r.arch,\n\t\t\tcapturedAt: r.capturedAt,\n\t\t\tmoduleKind: r.moduleKind,\n\t\t\tmoduleState: r.moduleState,\n\t\t\tinitialModuleSha256: r.initialModuleSha256,\n\t\t\tcurrentModuleSha256: r.currentModuleSha256,\n\t\t\tbuildRevision: r.buildRevision,\n\t\t},\n\t\tterminal: { columns: input.columns, rows: input.rows },\n\t\tsession: {\n\t\t\tstreaming: input.isStreaming,\n\t\t\tcompacting: input.isCompacting,\n\t\t\tmessageCount: input.messageCount,\n\t\t\tlastResourceReloadAt: input.lastResourceReloadAt ?? null,\n\t\t},\n\t\ttermination: t\n\t\t\t? {\n\t\t\t\t\tkind: t.kind,\n\t\t\t\t\tphase: t.phase,\n\t\t\t\t\tcauseCode: t.causeCode,\n\t\t\t\t\tsource: t.source,\n\t\t\t\t\tsideEffects: t.sideEffects,\n\t\t\t\t\tretryable: t.retryable,\n\t\t\t\t\tsafeToAutoRetry: t.safeToAutoRetry,\n\t\t\t\t}\n\t\t\t: null,\n\t};\n}\n\nexport function saveTuiDiagnostics(report: TuiDiagnostics, directory = tmpdir()): string {\n\tconst ownedDirectory = mkdtempSync(join(directory, \"omk-debug-\"));\n\ttry {\n\t\tconst outputPath = join(ownedDirectory, \"diagnostics.json\");\n\t\twriteFileSync(outputPath, `${JSON.stringify(report, null, 2)}\\n`, { flag: \"wx\", mode: 0o600 });\n\t\treturn outputPath;\n\t} catch (error) {\n\t\ttry {\n\t\t\trmSync(ownedDirectory, { recursive: true, force: true });\n\t\t} catch (cleanupError) {\n\t\t\tthrow new AggregateError([error, cleanupError], \"Diagnostics write and cleanup failed\");\n\t\t}\n\t\tthrow error;\n\t}\n}\n\nexport function createTuiDiagnosticsView(report: TuiDiagnostics, locations: TuiRuntimeCapture): Component {\n\treturn {\n\t\trender(width: number): string[] {\n\t\t\tconst view = new Container();\n\t\t\tview.addChild(new DynamicBorder((s) => theme.fg(\"accent\", s)));\n\t\t\tview.addChild(new Text(theme.fg(\"accent\", theme.bold(\"OMK diagnostics\")), 1, 0));\n\t\t\tconst r = report.runtime;\n\t\t\tconst t = report.termination;\n\t\t\tconst moduleStatus =\n\t\t\t\tr.moduleState === \"changed\"\n\t\t\t\t\t? \"changed since initialization — restart to load code\"\n\t\t\t\t\t: r.moduleState === \"unchanged\"\n\t\t\t\t\t\t? \"unchanged since initialization (this file only)\"\n\t\t\t\t\t\t: \"unavailable — not confirmed\";\n\t\t\tconst lines = [\n\t\t\t\t`Runtime: OMK ${r.version} · Node ${r.nodeVersion} · ${r.platform}/${r.arch}`,\n\t\t\t\t`Loaded UI: ${r.moduleKind} · Initialized: ${r.capturedAt}`,\n\t\t\t\t`UI file on disk: ${moduleStatus}`,\n\t\t\t\t`UI SHA256 at initialization: ${r.initialModuleSha256 ?? \"unavailable\"}`,\n\t\t\t\t\"Build revision: unavailable (checkout HEAD is not a build identity)\",\n\t\t\t\t`Last resource reload: ${report.session.lastResourceReloadAt ?? \"not reloaded in this TUI\"}`,\n\t\t\t\t\"/reload refreshes resources, not core code. Core updates require a restart.\",\n\t\t\t\t`Terminal: ${report.terminal.columns}×${report.terminal.rows} · Messages: ${report.session.messageCount}`,\n\t\t\t\t`Streaming: ${report.session.streaming ? \"yes\" : \"no\"} · Compacting: ${report.session.compacting ? \"yes\" : \"no\"}`,\n\t\t\t\tt ? `Latest outcome: ${t.kind} · ${t.causeCode} · ${t.source}` : \"Latest outcome: none recorded\",\n\t\t\t\t...(t\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t`Effects: ${t.sideEffects} · Retryable: ${t.retryable ? \"yes\" : \"no\"} · Automatic retry: ${t.safeToAutoRetry ? \"yes\" : \"no\"}`,\n\t\t\t\t\t\t]\n\t\t\t\t\t: []),\n\t\t\t\t`Launch path (local only): ${locations.entryPath ?? \"unavailable\"}`,\n\t\t\t\t`UI module (local only): ${locations.modulePath ?? \"unavailable\"}`,\n\t\t\t];\n\t\t\tview.addChild(new Text(lines.map(diagnosticDisplayText).join(\"\\n\"), 1, 0));\n\t\t\tview.addChild(\n\t\t\t\tnew Text(\n\t\t\t\t\ttheme.fg(\n\t\t\t\t\t\t\"muted\",\n\t\t\t\t\t\t\"Saving is explicit: /debug save writes a metadata-only JSON report locally.\\nMessages, prompts, outputs, config, paths, route names and session/run IDs are excluded. No upload.\",\n\t\t\t\t\t),\n\t\t\t\t\t1,\n\t\t\t\t\t0,\n\t\t\t\t),\n\t\t\t);\n\t\t\tview.addChild(new DynamicBorder((s) => theme.fg(\"accent\", s)));\n\t\t\treturn view.render(width);\n\t\t},\n\t\tinvalidate(): void {},\n\t};\n}\n"]}
@@ -0,0 +1,20 @@
1
+ export interface TuiRuntimeCapture {
2
+ readonly version: string;
3
+ readonly nodeVersion: string;
4
+ readonly platform: NodeJS.Platform;
5
+ readonly arch: string;
6
+ readonly capturedAt: string;
7
+ readonly entryPath: string | null;
8
+ readonly modulePath: string | null;
9
+ readonly moduleKind: "source" | "dist" | "bundled" | "unknown";
10
+ readonly initialModuleSha256: string | null;
11
+ }
12
+ export interface TuiRuntimeInfo extends TuiRuntimeCapture {
13
+ readonly currentModuleSha256: string | null;
14
+ readonly moduleState: "unchanged" | "changed" | "unavailable";
15
+ /** The package currently supplies no build-to-commit binding. Never substitute checkout HEAD. */
16
+ readonly buildRevision: null;
17
+ }
18
+ export declare function captureTuiRuntime(moduleUrl: string): TuiRuntimeCapture;
19
+ export declare function inspectTuiRuntime(capture: TuiRuntimeCapture): TuiRuntimeInfo;
20
+ //# sourceMappingURL=tui-runtime-info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tui-runtime-info.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/tui-runtime-info.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,UAAU,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;IAC/D,QAAQ,CAAC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5C;AACD,MAAM,WAAW,cAAe,SAAQ,iBAAiB;IACxD,QAAQ,CAAC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,QAAQ,CAAC,WAAW,EAAE,WAAW,GAAG,SAAS,GAAG,aAAa,CAAC;IAC9D,iGAAiG;IACjG,QAAQ,CAAC,aAAa,EAAE,IAAI,CAAC;CAC7B;AAqBD,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,iBAAiB,CAkCtE;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG,cAAc,CAS5E","sourcesContent":["import { createHash } from \"node:crypto\";\nimport { closeSync, constants, fstatSync, openSync, readSync, realpathSync } from \"node:fs\";\nimport { extname, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { VERSION } from \"../../config.ts\";\n\nexport interface TuiRuntimeCapture {\n\treadonly version: string;\n\treadonly nodeVersion: string;\n\treadonly platform: NodeJS.Platform;\n\treadonly arch: string;\n\treadonly capturedAt: string;\n\treadonly entryPath: string | null;\n\treadonly modulePath: string | null;\n\treadonly moduleKind: \"source\" | \"dist\" | \"bundled\" | \"unknown\";\n\treadonly initialModuleSha256: string | null;\n}\nexport interface TuiRuntimeInfo extends TuiRuntimeCapture {\n\treadonly currentModuleSha256: string | null;\n\treadonly moduleState: \"unchanged\" | \"changed\" | \"unavailable\";\n\t/** The package currently supplies no build-to-commit binding. Never substitute checkout HEAD. */\n\treadonly buildRevision: null;\n}\n\nfunction moduleDigest(filePath: string | null): string | null {\n\tif (!filePath) return null;\n\tlet fd: number | undefined;\n\ttry {\n\t\tfd = openSync(filePath, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);\n\t\tconst stat = fstatSync(fd);\n\t\tif (!stat.isFile() || stat.size > 1_048_576) return null;\n\t\tconst bytes = Buffer.alloc(stat.size + 1);\n\t\tconst count = readSync(fd, bytes, 0, bytes.length, 0);\n\t\tif (count !== stat.size || fstatSync(fd).mtimeMs !== stat.mtimeMs) return null;\n\t\treturn createHash(\"sha256\").update(bytes.subarray(0, count)).digest(\"hex\");\n\t} catch {\n\t\t// A missing/unreadable/virtual entry is an unavailable observation, not a clean bill of health.\n\t\treturn null;\n\t} finally {\n\t\tif (fd !== undefined) closeSync(fd);\n\t}\n}\n\nexport function captureTuiRuntime(moduleUrl: string): TuiRuntimeCapture {\n\tlet modulePath: string | null = null;\n\ttry {\n\t\tmodulePath = fileURLToPath(moduleUrl);\n\t} catch {\n\t\t// Bundled runtimes need not expose a file URL.\n\t}\n\tlet entryPath = process.argv[1] ? resolve(process.argv[1]) : null;\n\tif (entryPath) {\n\t\ttry {\n\t\t\tentryPath = realpathSync(entryPath);\n\t\t} catch {\n\t\t\t/* Keep the observed launch path when unavailable. */\n\t\t}\n\t}\n\tconst normalized = modulePath?.replaceAll(\"\\\\\", \"/\") ?? moduleUrl;\n\tconst moduleKind = /(?:^bun:|\\/\\$bunfs\\/|\\/~BUN\\/)/u.test(normalized)\n\t\t? \"bundled\"\n\t\t: modulePath && [\".ts\", \".tsx\", \".mts\", \".cts\"].includes(extname(modulePath))\n\t\t\t? \"source\"\n\t\t\t: normalized.includes(\"/dist/\")\n\t\t\t\t? \"dist\"\n\t\t\t\t: \"unknown\";\n\treturn Object.freeze({\n\t\tversion: VERSION,\n\t\tnodeVersion: process.versions.node,\n\t\tplatform: process.platform,\n\t\tarch: process.arch,\n\t\tcapturedAt: new Date().toISOString(),\n\t\tentryPath,\n\t\tmodulePath,\n\t\tmoduleKind,\n\t\tinitialModuleSha256: moduleKind === \"bundled\" ? null : moduleDigest(modulePath),\n\t});\n}\n\nexport function inspectTuiRuntime(capture: TuiRuntimeCapture): TuiRuntimeInfo {\n\tconst currentModuleSha256 = capture.moduleKind === \"bundled\" ? null : moduleDigest(capture.modulePath);\n\tconst moduleState =\n\t\t!capture.initialModuleSha256 || !currentModuleSha256\n\t\t\t? \"unavailable\"\n\t\t\t: capture.initialModuleSha256 === currentModuleSha256\n\t\t\t\t? \"unchanged\"\n\t\t\t\t: \"changed\";\n\treturn { ...capture, currentModuleSha256, moduleState, buildRevision: null };\n}\n"]}
@@ -0,0 +1,76 @@
1
+ import { createHash } from "node:crypto";
2
+ import { closeSync, constants, fstatSync, openSync, readSync, realpathSync } from "node:fs";
3
+ import { extname, resolve } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { VERSION } from "../../config.js";
6
+ function moduleDigest(filePath) {
7
+ if (!filePath)
8
+ return null;
9
+ let fd;
10
+ try {
11
+ fd = openSync(filePath, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
12
+ const stat = fstatSync(fd);
13
+ if (!stat.isFile() || stat.size > 1_048_576)
14
+ return null;
15
+ const bytes = Buffer.alloc(stat.size + 1);
16
+ const count = readSync(fd, bytes, 0, bytes.length, 0);
17
+ if (count !== stat.size || fstatSync(fd).mtimeMs !== stat.mtimeMs)
18
+ return null;
19
+ return createHash("sha256").update(bytes.subarray(0, count)).digest("hex");
20
+ }
21
+ catch {
22
+ // A missing/unreadable/virtual entry is an unavailable observation, not a clean bill of health.
23
+ return null;
24
+ }
25
+ finally {
26
+ if (fd !== undefined)
27
+ closeSync(fd);
28
+ }
29
+ }
30
+ export function captureTuiRuntime(moduleUrl) {
31
+ let modulePath = null;
32
+ try {
33
+ modulePath = fileURLToPath(moduleUrl);
34
+ }
35
+ catch {
36
+ // Bundled runtimes need not expose a file URL.
37
+ }
38
+ let entryPath = process.argv[1] ? resolve(process.argv[1]) : null;
39
+ if (entryPath) {
40
+ try {
41
+ entryPath = realpathSync(entryPath);
42
+ }
43
+ catch {
44
+ /* Keep the observed launch path when unavailable. */
45
+ }
46
+ }
47
+ const normalized = modulePath?.replaceAll("\\", "/") ?? moduleUrl;
48
+ const moduleKind = /(?:^bun:|\/\$bunfs\/|\/~BUN\/)/u.test(normalized)
49
+ ? "bundled"
50
+ : modulePath && [".ts", ".tsx", ".mts", ".cts"].includes(extname(modulePath))
51
+ ? "source"
52
+ : normalized.includes("/dist/")
53
+ ? "dist"
54
+ : "unknown";
55
+ return Object.freeze({
56
+ version: VERSION,
57
+ nodeVersion: process.versions.node,
58
+ platform: process.platform,
59
+ arch: process.arch,
60
+ capturedAt: new Date().toISOString(),
61
+ entryPath,
62
+ modulePath,
63
+ moduleKind,
64
+ initialModuleSha256: moduleKind === "bundled" ? null : moduleDigest(modulePath),
65
+ });
66
+ }
67
+ export function inspectTuiRuntime(capture) {
68
+ const currentModuleSha256 = capture.moduleKind === "bundled" ? null : moduleDigest(capture.modulePath);
69
+ const moduleState = !capture.initialModuleSha256 || !currentModuleSha256
70
+ ? "unavailable"
71
+ : capture.initialModuleSha256 === currentModuleSha256
72
+ ? "unchanged"
73
+ : "changed";
74
+ return { ...capture, currentModuleSha256, moduleState, buildRevision: null };
75
+ }
76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AC9B,CAAC,CAAC,MAAM;gBACR,CAAC,CAAC,SAAS,CAAC;IACf,OAAO,MAAM,CAAC,MAAM,CAAC;QACpB,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI;QAClC,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACpC,SAAS;QACT,UAAU;QACV,UAAU;QACV,mBAAmB,EAAE,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC;KAC/E,CAAC,CAAC;AAAA,CACH;AAED,MAAM,UAAU,iBAAiB,CAAC,OAA0B,EAAkB;IAC7E,MAAM,mBAAmB,GAAG,OAAO,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACvG,MAAM,WAAW,GAChB,CAAC,OAAO,CAAC,mBAAmB,IAAI,CAAC,mBAAmB;QACnD,CAAC,CAAC,aAAa;QACf,CAAC,CAAC,OAAO,CAAC,mBAAmB,KAAK,mBAAmB;YACpD,CAAC,CAAC,WAAW;YACb,CAAC,CAAC,SAAS,CAAC;IACf,OAAO,EAAE,GAAG,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;AAAA,CAC7E","sourcesContent":["import { createHash } from \"node:crypto\";\nimport { closeSync, constants, fstatSync, openSync, readSync, realpathSync } from \"node:fs\";\nimport { extname, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { VERSION } from \"../../config.ts\";\n\nexport interface TuiRuntimeCapture {\n\treadonly version: string;\n\treadonly nodeVersion: string;\n\treadonly platform: NodeJS.Platform;\n\treadonly arch: string;\n\treadonly capturedAt: string;\n\treadonly entryPath: string | null;\n\treadonly modulePath: string | null;\n\treadonly moduleKind: \"source\" | \"dist\" | \"bundled\" | \"unknown\";\n\treadonly initialModuleSha256: string | null;\n}\nexport interface TuiRuntimeInfo extends TuiRuntimeCapture {\n\treadonly currentModuleSha256: string | null;\n\treadonly moduleState: \"unchanged\" | \"changed\" | \"unavailable\";\n\t/** The package currently supplies no build-to-commit binding. Never substitute checkout HEAD. */\n\treadonly buildRevision: null;\n}\n\nfunction moduleDigest(filePath: string | null): string | null {\n\tif (!filePath) return null;\n\tlet fd: number | undefined;\n\ttry {\n\t\tfd = openSync(filePath, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);\n\t\tconst stat = fstatSync(fd);\n\t\tif (!stat.isFile() || stat.size > 1_048_576) return null;\n\t\tconst bytes = Buffer.alloc(stat.size + 1);\n\t\tconst count = readSync(fd, bytes, 0, bytes.length, 0);\n\t\tif (count !== stat.size || fstatSync(fd).mtimeMs !== stat.mtimeMs) return null;\n\t\treturn createHash(\"sha256\").update(bytes.subarray(0, count)).digest(\"hex\");\n\t} catch {\n\t\t// A missing/unreadable/virtual entry is an unavailable observation, not a clean bill of health.\n\t\treturn null;\n\t} finally {\n\t\tif (fd !== undefined) closeSync(fd);\n\t}\n}\n\nexport function captureTuiRuntime(moduleUrl: string): TuiRuntimeCapture {\n\tlet modulePath: string | null = null;\n\ttry {\n\t\tmodulePath = fileURLToPath(moduleUrl);\n\t} catch {\n\t\t// Bundled runtimes need not expose a file URL.\n\t}\n\tlet entryPath = process.argv[1] ? resolve(process.argv[1]) : null;\n\tif (entryPath) {\n\t\ttry {\n\t\t\tentryPath = realpathSync(entryPath);\n\t\t} catch {\n\t\t\t/* Keep the observed launch path when unavailable. */\n\t\t}\n\t}\n\tconst normalized = modulePath?.replaceAll(\"\\\\\", \"/\") ?? moduleUrl;\n\tconst moduleKind = /(?:^bun:|\\/\\$bunfs\\/|\\/~BUN\\/)/u.test(normalized)\n\t\t? \"bundled\"\n\t\t: modulePath && [\".ts\", \".tsx\", \".mts\", \".cts\"].includes(extname(modulePath))\n\t\t\t? \"source\"\n\t\t\t: normalized.includes(\"/dist/\")\n\t\t\t\t? \"dist\"\n\t\t\t\t: \"unknown\";\n\treturn Object.freeze({\n\t\tversion: VERSION,\n\t\tnodeVersion: process.versions.node,\n\t\tplatform: process.platform,\n\t\tarch: process.arch,\n\t\tcapturedAt: new Date().toISOString(),\n\t\tentryPath,\n\t\tmodulePath,\n\t\tmoduleKind,\n\t\tinitialModuleSha256: moduleKind === \"bundled\" ? null : moduleDigest(modulePath),\n\t});\n}\n\nexport function inspectTuiRuntime(capture: TuiRuntimeCapture): TuiRuntimeInfo {\n\tconst currentModuleSha256 = capture.moduleKind === \"bundled\" ? null : moduleDigest(capture.modulePath);\n\tconst moduleState =\n\t\t!capture.initialModuleSha256 || !currentModuleSha256\n\t\t\t? \"unavailable\"\n\t\t\t: capture.initialModuleSha256 === currentModuleSha256\n\t\t\t\t? \"unchanged\"\n\t\t\t\t: \"changed\";\n\treturn { ...capture, currentModuleSha256, moduleState, buildRevision: null };\n}\n"]}
@@ -76,6 +76,16 @@ LIVE_E2E=0 node ../../node_modules/vitest/dist/cli.js --run test/adaptorch-onboa
76
76
  Keep explicit file filters for routine work. A keyless regression pass is not a
77
77
  live-provider or release verification, and unfiltered suites may include e2e tests.
78
78
 
79
+ ## Commit checks
80
+
81
+ The pre-commit hook validates the working tree without changing the selected
82
+ index. It never auto-stages checker edits or unstaged hunks. If a checker changes
83
+ the index, the hook fails and asks you to review the selection again; it does not
84
+ restore or discard those changes. The checks still run against the working tree,
85
+ not an isolated staged snapshot, so review partially staged changes separately.
86
+
87
+ Hook regression: `node --test scripts/test/pre-commit-index.test.mjs`.
88
+
79
89
  ## Project Structure
80
90
 
81
91
  ```
@@ -0,0 +1,121 @@
1
+ # Devin SWE-2 harness
2
+
3
+ This page is the canonical operator guide for the built-in `devin` provider and its only logical model, `swe-2`. Use `/login devin` for the Devin CLI subscription PKCE flow or `DEVIN_API_KEY` for an already-owned CLI session token. A user-local `~/.omk/agent/devin.md` may add operator notes, but it is not the portable product contract.
4
+
5
+ Authentication, transport, and verification limits are owned by [Providers](providers.md#devin-cli); this page covers how OMK drives SWE-2 as a harness.
6
+
7
+ ## Presets
8
+
9
+ Project presets live in `.omk/presets.json` (or `~/.omk/agent/presets.json`) and are consumed by the preset extension from `packages/coding-agent/examples/extensions/preset.ts`. The shared SWE-2 presets intentionally omit the `tools` key so role/domain lane grants keep control of the active tools.
10
+
11
+ | Preset | Provider | Model | Thinking | Use |
12
+ | --- | --- | --- | --- | --- |
13
+ | `swe2-verified` | `devin` | `swe-2` | `high` | Default SWE-2 coding baseline: multi-file edits with tests. |
14
+ | `swe2-max` | `devin` | `swe-2` | `max` | Long-horizon, uncertain, or repository-wide work that should use the 1M budget. |
15
+ | `swe2-fast-edit` | `devin` | `swe-2` | `medium` | Small, well-specified edits where medium acts sooner and costs less. |
16
+
17
+ ```json
18
+ {
19
+ "swe2-verified": { "provider": "devin", "model": "swe-2", "thinkingLevel": "high" },
20
+ "swe2-max": { "provider": "devin", "model": "swe-2", "thinkingLevel": "max" },
21
+ "swe2-fast-edit": { "provider": "devin", "model": "swe-2", "thinkingLevel": "medium" }
22
+ }
23
+ ```
24
+
25
+ For a new session without presets:
26
+
27
+ ```bash
28
+ omk --provider devin --model swe-2 --thinking max
29
+ ```
30
+
31
+ ## Effort tiers
32
+
33
+ SWE-2 exposes exactly three server-declared efforts. OMK maps its thinking tiers as follows and rejects anything else before sending credentials; `max` is a reasoning level, not the Devin Max subscription tier.
34
+
35
+ | OMK tier | `swe-2` |
36
+ | --- | --- |
37
+ | `off`, `minimal`, `low` | unavailable |
38
+ | `medium` | `medium` |
39
+ | `high` | `high` |
40
+ | `xhigh`, `ultra` | unavailable |
41
+ | `max` | `max` |
42
+
43
+ Guidance from the [SWE-2 announcement](https://cognition.com/blog/swe-2): `medium` makes its first real edit sooner and is the cost-efficient choice for simple and intermediate tasks; `high` and `max` plan more, explore more of the codebase, and verify more on complex tasks. `recommendedDevinEffortForIntent()` encodes the same split (`code` → `medium`, `test` → `high`, `debug`/`repo` → `max`).
44
+
45
+ ## Context budget: 1,000,000 tokens
46
+
47
+ `devin/swe-2` ships with `contextWindow: 1000000` and `maxTokens: 16384`. These are local budgets that drive OMK's context budgeting and compaction, **not published SWE-2 limits**; Cognition has not published a context window for SWE-2. The budget also selects the catalog lane:
48
+
49
+ 1. Before each turn OMK reads `GetCliModelConfigs`. SWE-2 family entries may carry a `1M Context` axis (order `1`) beside the effort axis. A local budget of 1,000,000 or more asks for that 1M-context lane; below it, the standard lane is used and 1M entries are ignored.
50
+ 2. A catalog with no 1M-context lane keeps the standard lane for the selected effort.
51
+ 3. If the chosen lane declares a context window smaller than the local budget, the request fails with `... declares a N-token context window; lower the models.json contextWindow before retrying`. OMK never shrinks the budget silently, never invents a wire UID, and never downgrades to another effort.
52
+ 4. Fast-lane (`Fast Mode`) entries are always excluded. Output is capped against the authenticated catalog's declared maximum.
53
+
54
+ To lower the budget (for example if your account only serves the standard lane at 262,144 tokens), override the built-in model in `~/.omk/agent/models.json`:
55
+
56
+ ```json
57
+ {
58
+ "providers": {
59
+ "devin": {
60
+ "modelOverrides": {
61
+ "swe-2": { "contextWindow": 262144 }
62
+ }
63
+ }
64
+ }
65
+ }
66
+ ```
67
+
68
+ Recommended compaction settings for 1M sessions keep the defaults but raise the recent-token window so summaries do not discard the working set:
69
+
70
+ ```json
71
+ {
72
+ "compaction": { "enabled": true, "reserveTokens": 16384, "keepRecentTokens": 60000, "maxUsageRatio": 0.85 }
73
+ }
74
+ ```
75
+
76
+ Context discipline still applies: the budget is room for the repository, not an invitation to dump it. Prefer targeted reads and searches, keep tool output bounded, and let `precompact-checkpoint` snapshot state before compaction rather than restarting sessions. Quota is per account; a larger window consumes more of it per turn.
77
+
78
+ With a Devin credential configured, the status rail's USAGE section shows the account's daily and weekly quota meters from `GetUserStatus` (or the plan name and credit balances when the plan reports no quota windows), matching the CLI's `/usage` surface.
79
+
80
+ ## Domain routing
81
+
82
+ Selecting the `devin` provider auto-applies the `devin-harness` loadout by default; this does not require `OMK_DOMAIN_ROUTING=1`. Set `OMK_DEVIN_HARNESS=0` to disable that provider-specific dispatch. The flag is independent from `OMK_GROK_HARNESS`.
83
+
84
+ Loadout policies reject extension tools that shadow builtins fail-closed. A host that intentionally replaces the builtin `bash` (for example a Landstrip shell provider) should keep `OMK_DEVIN_HARNESS=0` in its launcher until the replacement is removed or bridged; the `devin.md` overlay and the model budget still apply in that case.
85
+
86
+ General prompt-based domain routing is separate and opt-in through `OMK_DOMAIN_ROUTING=1`. It selects one of the profiles under [`loadout-domains/`](loadout-domains/README.md) and composes it with the active role loadout. SWE-2 presets only set provider, model, thinking level, and instruction pointers.
87
+
88
+ ## Model selection
89
+
90
+ The `devin` catalog contains only the logical `swe-2` model; the server's SWE-2 family metadata supplies each effort's wire UID at request time. Use `/model` or `omk --list-models devin` for the current list. Image input is unsupported; provide text.
91
+
92
+ ## Skill and MCP matrix summary
93
+
94
+ Use the normal OMK lane grant model: grant the smallest skill and MCP surface that matches the task.
95
+
96
+ For each non-queued `devin` request started through `AgentSession.prompt()`, OMK calls `selectDevinHarnessSkills()` against the live discovered skill descriptions after ordinary prompt-template expansion. It merges up to three matches with explicit/settings selections and rebuilds that turn's `<active_skills source="devin-harness">` marker. The scorer is the same `selectSkills()` used by the Grok harness: weak 0.35 / strong 0.7 thresholds, deterministic input-order ties, first-name-wins deduplication, explicit-only skills never auto-selected, and `headroom` only for lexical pressure cues or the session's measured context-pressure bucket. A task with no signals yields an empty automatic grant rather than the full allowlist. Queued `steer`, `followUp`, or `prompt(..., { streamingBehavior })` messages retain the active run's system prompt.
97
+
98
+ | Task class | Skills | MCP |
99
+ | --- | --- | --- |
100
+ | Multi-package or repo-context work | `packages`; add `headroom` only under context pressure | none by default |
101
+ | Repo graph or broad comprehension | `understand-anything`; optionally `packages` | `understand-anything` |
102
+ | TypeScript/Rust/Python/Go edits | `programming`; add `lsp` or `ast-grep` only for symbol/structural work | none by default |
103
+ | New behavior or bug fix with regression test | `tdd-workflow`, `programming` | none by default |
104
+ | Runtime failures or broken behavior | `debugging` | task-specific only |
105
+ | Library API lookup | task skill as needed | `context7` |
106
+ | Current public URL or docs lookup | task skill as needed | `fetch` |
107
+ | UI/TUI verification | task skill as needed | `playwright` only when browser/UI evidence is required |
108
+
109
+ Relevant evidence hooks for SWE-2 lanes are `pre-shell-guard`, `protect-secrets`, `typecheck-after-edit`, `stop-verify`, `session-context`, and `precompact-checkpoint`. Hook output is incremental evidence; code changes still need the project's required final verification command before claiming type/lint cleanliness.
110
+
111
+ ## Suggested TUI flow
112
+
113
+ 1. Run `/login devin` once; the account picker stores the CLI session token in `auth.json`.
114
+ 2. Select `/preset swe2-verified` for normal coding work, `/preset swe2-max` for long-horizon or repository-wide tasks, and `/preset swe2-fast-edit` for small edits.
115
+ 3. Use `/think medium`, `/think high`, or `/think max` to change effort mid-session; other levels are rejected.
116
+ 4. If a turn fails with an "unavailable or ambiguous" route or a smaller declared context window, treat it as a configuration signal: check `devin models list`, or lower `contextWindow` as shown above. Do not retry with a guessed wire UID.
117
+ 5. Keep credentials out of preset JSON, prompts, and logs: the session token, the exchanged user JWT, and `auth.json` contents are secrets under `protect-secrets`.
118
+
119
+ ## Local overlay
120
+
121
+ When the `devin` provider is active, OMK appends `~/.omk/agent/devin.md` (capped at 24,000 characters) to the system prompt, mirroring the Grok `grok.md` overlay. Treat that file as optional host configuration for effort defaults, compaction notes, or team conventions; this page and the current provider documentation remain authoritative and it cannot override higher-priority instructions.
package/docs/docs.json CHANGED
@@ -27,6 +27,10 @@
27
27
  "title": "Native xAI Grok",
28
28
  "path": "grok-harness.md"
29
29
  },
30
+ {
31
+ "title": "Devin SWE-2",
32
+ "path": "devin-harness.md"
33
+ },
30
34
  {
31
35
  "title": "Containerization",
32
36
  "path": "containerization.md"
@@ -100,7 +100,8 @@ These variables are read by OMK itself. The four built-in harness flags below ar
100
100
  | `OMK_YOLO`, `OMK_COMMAND_SAFETY`, `OMK_DISABLE_COMMAND_SAFETY` | Disable the command-safety gate entirely (YOLO mode). `OMK_YOLO` and `OMK_DISABLE_COMMAND_SAFETY` accept `1`, `true`, `yes`, or `on`; `OMK_COMMAND_SAFETY` accepts `0`, `false`, `off`, `disable`, or `disabled`. Every verdict, including block-tier and privilege commands, is skipped in interactive and headless runs. Use only when a verified outer sandbox owns the boundary |
101
101
  | `OMK_COMMAND_SAFETY_ASSUME_YES` | `1` or `true` auto-accepts non-privilege confirm-tier commands in interactive **and headless** runs. Privilege confirmation and block-tier commands remain denied. Use only under a trusted outer sandbox when headless auto-accept is intended |
102
102
  | `OMK_GROK_HARNESS` | Default-on native `xai` provider dispatch to the `grok-harness` loadout. `0`, `false`, `off`, or `no` disables it |
103
- | `OMK_DOMAIN_ROUTING` | Set to `1` to enable general prompt-based domain routing. Native xAI harness dispatch does not require it |
103
+ | `OMK_DEVIN_HARNESS` | Default-on `devin` provider dispatch to the `devin-harness` loadout. `0`, `false`, `off`, or `no` disables it; independent from `OMK_GROK_HARNESS` |
104
+ | `OMK_DOMAIN_ROUTING` | Set to `1` to enable general prompt-based domain routing. Native xAI and Devin harness dispatch do not require it |
104
105
  | `VISUAL`, `EDITOR` | External editor fallback when `externalEditor` is unset |
105
106
  | `HTTP_PROXY`, `HTTPS_PROXY` | Proxy outbound HTTP requests |
106
107
  | `OMK_RESOURCE_GOVERNOR` | Resource-governor mode: `off`, `observe` (default), `adaptive`, or `strict`. Feeds `/resource [probe\|policy]` and `omk doctor resources [--json]`; see the resource governor section in [Settings](settings.md) |
package/docs/index.md CHANGED
@@ -39,6 +39,7 @@ For the full first-run flow, see [Quickstart](quickstart.md).
39
39
  - [Providers](providers.md) - subscription and API-key setup for built-in providers.
40
40
  - [Provider Resilience](provider-resilience.md) - retry, failover, quota, and safety-stop recovery.
41
41
  - [Native xAI Grok](grok-harness.md) - authentication, weekly SuperGrok usage, presets, and thinking tiers.
42
+ - [Devin SWE-2](devin-harness.md) - presets, effort tiers, the 1M-token context budget and lane rule, and the `devin-harness` loadout.
42
43
  - [Containerization](containerization.md) - sandbox omk with OpenShell, Gondolin, or Docker.
43
44
  - [Settings](settings.md) - global and project settings.
44
45
  - [Environment Variables](environment-variables.md) - process configuration, harness opt-outs, and bash-tool session environment.
@@ -118,7 +118,7 @@ Modifier combinations: `ctrl+shift+x`, `alt+ctrl+x`, `ctrl+shift+alt+x`, `ctrl+1
118
118
 
119
119
  | Keybinding id | Default | Description |
120
120
  |--------|---------|-------------|
121
- | `app.tools.expand` | `ctrl+o` | Collapse or expand tool output |
121
+ | `app.tools.expand` | `ctrl+o` | Collapse or expand tool output and typed failure details |
122
122
  | `app.message.followUp` | `alt+enter` | Queue follow-up message |
123
123
  | `app.message.dequeue` | `alt+up` | Restore queued messages to editor |
124
124
 
@@ -21,7 +21,7 @@ OMK routes incoming tasks to a **domain capability profile** ("inherited documen
21
21
 
22
22
  Thresholds: `STRONG_THRESHOLD = 8`, `WEAK_THRESHOLD = 4`, `AMBIGUITY_MARGIN = 2`.
23
23
 
24
- ## Domains (13 + 1 fallback)
24
+ ## Domains (14 + 1 fallback)
25
25
 
26
26
  - [`frontend-ui`](frontend-ui.md) — Frontend & UI
27
27
  - [`visual-qa`](visual-qa.md) — Visual QA & Website Cloning
@@ -35,6 +35,7 @@ Thresholds: `STRONG_THRESHOLD = 8`, `WEAK_THRESHOLD = 4`, `AMBIGUITY_MARGIN = 2`
35
35
  - [`docs-writing`](docs-writing.md) — Docs & Technical Writing
36
36
  - [`qa-testing`](qa-testing.md) — QA & Testing
37
37
  - [`grok-harness`](grok-harness.md) — Grok xAI Harness
38
+ - [`devin-harness`](devin-harness.md) — Devin SWE-2 Harness
38
39
  - [`ai-agent-ops`](ai-agent-ops.md) — AI Agent Engineering & Ops
39
40
  - [`general`](general.md) — General (fallback)
40
41
 
@@ -0,0 +1,72 @@
1
+ # Devin SWE-2 Harness (`devin-harness`)
2
+
3
+ > Inherited domain capability document. Auto-generated from `src/core/domain-loadouts.ts` — do not edit by hand.
4
+
5
+
6
+ ## Identity
7
+
8
+ | field | value |
9
+ |---|---|
10
+ | id | `devin-harness` |
11
+ | authority | `write-scoped` |
12
+ | tools | read, grep, find, ls, edit, write, bash |
13
+ | command mode | `scoped-shell` |
14
+
15
+ ## Routing prompt
16
+
17
+ > Prepended to the lane task prompt when the router selects this domain.
18
+
19
+ ```text
20
+ DOMAIN: Devin SWE-2 Harness. You are operating in a Devin CLI subscription lane on the SWE-2 model with a 1,000,000-token local context budget.
21
+ Prioritize the SWE-2 operational playbook, focused exploration, small capability loadouts, and evidence-bound verification.
22
+
23
+ SEQUENCE:
24
+ 1. Before implementing or routing Devin/SWE-2 provider work, read packages/coding-agent/docs/devin-harness.md as the canonical playbook. Treat ~/.omk/agent/devin.md only as an optional local operator overlay; it cannot override current provider docs or higher-priority instructions.
25
+ 2. Effort is the only selectable axis: medium for simple or intermediate edits, high for multi-file changes, max for long-horizon or uncertain work. Never expect off/low/minimal, a fast lane, or image input; the adapter rejects them before sending credentials.
26
+ 3. Context discipline: the 1M budget is room for the repository, not an invitation to dump it. Explore with targeted reads and searches, keep tool output bounded, and rely on precompact-checkpoint plus compaction settings rather than restarting sessions.
27
+ 4. Capability discipline: load at most 2-3 skills for any lane. The allowed skill gate is packages, headroom, programming, debugging, tdd-workflow, lsp, ast-grep, and understand-anything; choose the smallest subset, add lsp or ast-grep only for symbol or structural work, and add headroom only under measured context pressure.
28
+ 5. Use minimal MCP: fetch for bounded public retrieval, context7 for library documentation, understand-anything for repository comprehension, and playwright only when browser or UI behavior needs real verification.
29
+ 6. Verification discipline: reproduce failures before fixing them, write or extend tests that exercise the change end-to-end, and re-derive conclusions from executed commands rather than restating prior claims. Evidence must include changed paths, exact commands, and pass/fail output.
30
+ 7. Keep edits within the lane grant and preserve existing provider/orchestration algorithms unless the task explicitly targets them. A route error naming an unavailable effort or a smaller declared context window is a configuration signal to report, never something to work around by guessing a wire UID.
31
+
32
+ HARD RULES: the packaged Devin harness doc is mandatory context; a local devin.md is optional; medium/high/max are the only efforts; the 1M budget never justifies unbounded dumps; maximum 2-3 active skills; never log the Devin session token, user JWT, or auth.json contents; protect-secrets applies.
33
+ ```
34
+
35
+ ## Curated skills (8)
36
+
37
+ - `packages`
38
+ - `headroom`
39
+ - `programming`
40
+ - `debugging`
41
+ - `tdd-workflow`
42
+ - `lsp`
43
+ - `ast-grep`
44
+ - `understand-anything`
45
+
46
+ ## Curated MCP servers (4)
47
+
48
+ - `fetch`
49
+ - `context7`
50
+ - `understand-anything`
51
+ - `playwright`
52
+
53
+ ## Curated hooks (6)
54
+
55
+ - `pre-shell-guard`
56
+ - `protect-secrets`
57
+ - `typecheck-after-edit`
58
+ - `stop-verify`
59
+ - `session-context`
60
+ - `precompact-checkpoint`
61
+
62
+ ## Routing triggers (7)
63
+
64
+ | kind | pattern | weight |
65
+ |---|---|---|
66
+ | keyword | `devin` | 8 |
67
+ | keyword | `swe-2` | 8 |
68
+ | keyword | `swe2` | 8 |
69
+ | keyword | `cognition` | 6 |
70
+ | keyword | `devin cli` | 8 |
71
+ | keyword | `1m context` | 5 |
72
+ | regex | `\b(devin|swe[- ]?2|cognition)\b` | 7 |