open-multi-agent-kit 0.98.3 → 0.98.5

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 (468) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +12 -2
  3. package/dist/cli/args.d.ts +1 -0
  4. package/dist/cli/args.d.ts.map +1 -1
  5. package/dist/cli/args.js +14 -0
  6. package/dist/cli/args.js.map +1 -1
  7. package/dist/cli/help.d.ts.map +1 -1
  8. package/dist/cli/help.js +3 -0
  9. package/dist/cli/help.js.map +1 -1
  10. package/dist/cli/mcp-attach.d.ts +3 -3
  11. package/dist/cli/mcp-attach.d.ts.map +1 -1
  12. package/dist/cli/mcp-attach.js +5 -4
  13. package/dist/cli/mcp-attach.js.map +1 -1
  14. package/dist/cli/model-contract.d.ts +5 -0
  15. package/dist/cli/model-contract.d.ts.map +1 -0
  16. package/dist/cli/model-contract.js +45 -0
  17. package/dist/cli/model-contract.js.map +1 -0
  18. package/dist/commands/adaptorch-doctor-cli.d.ts.map +1 -1
  19. package/dist/commands/adaptorch-doctor-cli.js +32 -10
  20. package/dist/commands/adaptorch-doctor-cli.js.map +1 -1
  21. package/dist/commands/init-cli.d.ts +12 -0
  22. package/dist/commands/init-cli.d.ts.map +1 -0
  23. package/dist/commands/init-cli.js +76 -0
  24. package/dist/commands/init-cli.js.map +1 -0
  25. package/dist/commands/provider-sync-cli.d.ts +27 -0
  26. package/dist/commands/provider-sync-cli.d.ts.map +1 -0
  27. package/dist/commands/provider-sync-cli.js +177 -0
  28. package/dist/commands/provider-sync-cli.js.map +1 -0
  29. package/dist/commands/run-command.d.ts +9 -0
  30. package/dist/commands/run-command.d.ts.map +1 -0
  31. package/dist/commands/run-command.js +34 -0
  32. package/dist/commands/run-command.js.map +1 -0
  33. package/dist/commands/verified-run-cli.d.ts +6 -0
  34. package/dist/commands/verified-run-cli.d.ts.map +1 -0
  35. package/dist/commands/verified-run-cli.js +190 -0
  36. package/dist/commands/verified-run-cli.js.map +1 -0
  37. package/dist/core/active-skill-state.d.ts +7 -0
  38. package/dist/core/active-skill-state.d.ts.map +1 -0
  39. package/dist/core/active-skill-state.js +25 -0
  40. package/dist/core/active-skill-state.js.map +1 -0
  41. package/dist/core/agent-session-services.d.ts +10 -1
  42. package/dist/core/agent-session-services.d.ts.map +1 -1
  43. package/dist/core/agent-session-services.js +43 -0
  44. package/dist/core/agent-session-services.js.map +1 -1
  45. package/dist/core/agent-session.d.ts +7 -9
  46. package/dist/core/agent-session.d.ts.map +1 -1
  47. package/dist/core/agent-session.js +91 -126
  48. package/dist/core/agent-session.js.map +1 -1
  49. package/dist/core/codex-chatgpt-web-bridge.d.ts +99 -0
  50. package/dist/core/codex-chatgpt-web-bridge.d.ts.map +1 -0
  51. package/dist/core/codex-chatgpt-web-bridge.js +192 -0
  52. package/dist/core/codex-chatgpt-web-bridge.js.map +1 -0
  53. package/dist/core/codex-chatgpt-web-sync.d.ts +50 -0
  54. package/dist/core/codex-chatgpt-web-sync.d.ts.map +1 -0
  55. package/dist/core/codex-chatgpt-web-sync.js +119 -0
  56. package/dist/core/codex-chatgpt-web-sync.js.map +1 -0
  57. package/dist/core/compaction/compaction-headroom.d.ts +30 -0
  58. package/dist/core/compaction/compaction-headroom.d.ts.map +1 -0
  59. package/dist/core/compaction/compaction-headroom.js +48 -0
  60. package/dist/core/compaction/compaction-headroom.js.map +1 -0
  61. package/dist/core/compaction/compaction.d.ts +2 -29
  62. package/dist/core/compaction/compaction.d.ts.map +1 -1
  63. package/dist/core/compaction/compaction.js +19 -47
  64. package/dist/core/compaction/compaction.js.map +1 -1
  65. package/dist/core/compaction/overflow-retry-guard.d.ts +20 -0
  66. package/dist/core/compaction/overflow-retry-guard.d.ts.map +1 -0
  67. package/dist/core/compaction/overflow-retry-guard.js +38 -0
  68. package/dist/core/compaction/overflow-retry-guard.js.map +1 -0
  69. package/dist/core/context-budget-headroom-types.d.ts.map +1 -1
  70. package/dist/core/context-budget-headroom-types.js +1 -1
  71. package/dist/core/context-budget-headroom-types.js.map +1 -1
  72. package/dist/core/context-budget-token-counter-types.d.ts +27 -0
  73. package/dist/core/context-budget-token-counter-types.d.ts.map +1 -0
  74. package/dist/core/context-budget-token-counter-types.js +2 -0
  75. package/dist/core/context-budget-token-counter-types.js.map +1 -0
  76. package/dist/core/context-budget-token-counter.d.ts +2 -26
  77. package/dist/core/context-budget-token-counter.d.ts.map +1 -1
  78. package/dist/core/context-budget-token-counter.js +2 -0
  79. package/dist/core/context-budget-token-counter.js.map +1 -1
  80. package/dist/core/context-budget-v2-scoring.d.ts.map +1 -1
  81. package/dist/core/context-budget-v2-scoring.js +14 -10
  82. package/dist/core/context-budget-v2-scoring.js.map +1 -1
  83. package/dist/core/domain-router.d.ts.map +1 -1
  84. package/dist/core/domain-router.js +1 -1
  85. package/dist/core/domain-router.js.map +1 -1
  86. package/dist/core/grok-harness-dispatch.d.ts +4 -0
  87. package/dist/core/grok-harness-dispatch.d.ts.map +1 -1
  88. package/dist/core/grok-harness-dispatch.js +20 -3
  89. package/dist/core/grok-harness-dispatch.js.map +1 -1
  90. package/dist/core/grok-harness.d.ts +15 -9
  91. package/dist/core/grok-harness.d.ts.map +1 -1
  92. package/dist/core/grok-harness.js +34 -8
  93. package/dist/core/grok-harness.js.map +1 -1
  94. package/dist/core/mcp/tools.d.ts +2 -2
  95. package/dist/core/mcp/tools.d.ts.map +1 -1
  96. package/dist/core/mcp/tools.js +29 -3
  97. package/dist/core/mcp/tools.js.map +1 -1
  98. package/dist/core/model-registry-schema.d.ts +1081 -0
  99. package/dist/core/model-registry-schema.d.ts.map +1 -0
  100. package/dist/core/model-registry-schema.js +148 -0
  101. package/dist/core/model-registry-schema.js.map +1 -0
  102. package/dist/core/model-registry.d.ts.map +1 -1
  103. package/dist/core/model-registry.js +1 -146
  104. package/dist/core/model-registry.js.map +1 -1
  105. package/dist/core/model-resolver.d.ts +2 -1
  106. package/dist/core/model-resolver.d.ts.map +1 -1
  107. package/dist/core/model-resolver.js +2 -1
  108. package/dist/core/model-resolver.js.map +1 -1
  109. package/dist/core/prompt-preset.d.ts +1 -1
  110. package/dist/core/prompt-preset.d.ts.map +1 -1
  111. package/dist/core/prompt-preset.js +16 -1
  112. package/dist/core/prompt-preset.js.map +1 -1
  113. package/dist/core/prompt-settlement.d.ts +4 -3
  114. package/dist/core/prompt-settlement.d.ts.map +1 -1
  115. package/dist/core/prompt-settlement.js.map +1 -1
  116. package/dist/core/provider-display-names.d.ts.map +1 -1
  117. package/dist/core/provider-display-names.js +1 -0
  118. package/dist/core/provider-display-names.js.map +1 -1
  119. package/dist/core/provider-resilience.d.ts +8 -0
  120. package/dist/core/provider-resilience.d.ts.map +1 -1
  121. package/dist/core/provider-resilience.js +20 -3
  122. package/dist/core/provider-resilience.js.map +1 -1
  123. package/dist/core/provider-usage-types.d.ts +42 -0
  124. package/dist/core/provider-usage-types.d.ts.map +1 -0
  125. package/dist/core/provider-usage-types.js +2 -0
  126. package/dist/core/provider-usage-types.js.map +1 -0
  127. package/dist/core/provider-usage.d.ts +2 -31
  128. package/dist/core/provider-usage.d.ts.map +1 -1
  129. package/dist/core/provider-usage.js +4 -0
  130. package/dist/core/provider-usage.js.map +1 -1
  131. package/dist/core/redaction.d.ts.map +1 -1
  132. package/dist/core/redaction.js +18 -2
  133. package/dist/core/redaction.js.map +1 -1
  134. package/dist/core/run-budget-policy.d.ts +18 -0
  135. package/dist/core/run-budget-policy.d.ts.map +1 -0
  136. package/dist/core/run-budget-policy.js +52 -0
  137. package/dist/core/run-budget-policy.js.map +1 -0
  138. package/dist/core/run-budget.d.ts +33 -0
  139. package/dist/core/run-budget.d.ts.map +1 -0
  140. package/dist/core/run-budget.js +89 -0
  141. package/dist/core/run-budget.js.map +1 -0
  142. package/dist/core/run-execution-api.d.ts +15 -0
  143. package/dist/core/run-execution-api.d.ts.map +1 -0
  144. package/dist/core/run-execution-api.js +7 -0
  145. package/dist/core/run-execution-api.js.map +1 -0
  146. package/dist/core/run-journal.d.ts.map +1 -1
  147. package/dist/core/run-journal.js +30 -208
  148. package/dist/core/run-journal.js.map +1 -1
  149. package/dist/core/sandbox/policy-merge.d.ts +6 -0
  150. package/dist/core/sandbox/policy-merge.d.ts.map +1 -0
  151. package/dist/core/sandbox/policy-merge.js +74 -0
  152. package/dist/core/sandbox/policy-merge.js.map +1 -0
  153. package/dist/core/sandbox/policy-paths.d.ts +4 -0
  154. package/dist/core/sandbox/policy-paths.d.ts.map +1 -0
  155. package/dist/core/sandbox/policy-paths.js +21 -0
  156. package/dist/core/sandbox/policy-paths.js.map +1 -0
  157. package/dist/core/sandbox/policy-types.d.ts +75 -0
  158. package/dist/core/sandbox/policy-types.d.ts.map +1 -0
  159. package/dist/core/sandbox/policy-types.js +2 -0
  160. package/dist/core/sandbox/policy-types.js.map +1 -0
  161. package/dist/core/sandbox/policy.d.ts +3 -77
  162. package/dist/core/sandbox/policy.d.ts.map +1 -1
  163. package/dist/core/sandbox/policy.js +3 -98
  164. package/dist/core/sandbox/policy.js.map +1 -1
  165. package/dist/core/sdk-provider-stream.d.ts +14 -0
  166. package/dist/core/sdk-provider-stream.d.ts.map +1 -0
  167. package/dist/core/sdk-provider-stream.js +38 -0
  168. package/dist/core/sdk-provider-stream.js.map +1 -0
  169. package/dist/core/sdk.d.ts +5 -1
  170. package/dist/core/sdk.d.ts.map +1 -1
  171. package/dist/core/sdk.js +17 -33
  172. package/dist/core/sdk.js.map +1 -1
  173. package/dist/core/session-bash-service.d.ts +2 -2
  174. package/dist/core/session-bash-service.d.ts.map +1 -1
  175. package/dist/core/session-bash-service.js +21 -9
  176. package/dist/core/session-bash-service.js.map +1 -1
  177. package/dist/core/session-failure-cause.d.ts.map +1 -1
  178. package/dist/core/session-failure-cause.js +15 -3
  179. package/dist/core/session-failure-cause.js.map +1 -1
  180. package/dist/core/session-prompt-lifecycle.d.ts +25 -0
  181. package/dist/core/session-prompt-lifecycle.d.ts.map +1 -0
  182. package/dist/core/session-prompt-lifecycle.js +87 -0
  183. package/dist/core/session-prompt-lifecycle.js.map +1 -0
  184. package/dist/core/session-run-budget.d.ts +28 -0
  185. package/dist/core/session-run-budget.d.ts.map +1 -0
  186. package/dist/core/session-run-budget.js +127 -0
  187. package/dist/core/session-run-budget.js.map +1 -0
  188. package/dist/core/session-run-termination.d.ts +18 -0
  189. package/dist/core/session-run-termination.d.ts.map +1 -0
  190. package/dist/core/session-run-termination.js +72 -0
  191. package/dist/core/session-run-termination.js.map +1 -0
  192. package/dist/core/session-termination-types.d.ts +97 -0
  193. package/dist/core/session-termination-types.d.ts.map +1 -0
  194. package/dist/core/session-termination-types.js +26 -0
  195. package/dist/core/session-termination-types.js.map +1 -0
  196. package/dist/core/session-termination.d.ts +3 -97
  197. package/dist/core/session-termination.d.ts.map +1 -1
  198. package/dist/core/session-termination.js +25 -29
  199. package/dist/core/session-termination.js.map +1 -1
  200. package/dist/core/skill-selector.d.ts +40 -0
  201. package/dist/core/skill-selector.d.ts.map +1 -0
  202. package/dist/core/skill-selector.js +102 -0
  203. package/dist/core/skill-selector.js.map +1 -0
  204. package/dist/core/slash-commands.d.ts.map +1 -1
  205. package/dist/core/slash-commands.js +1 -0
  206. package/dist/core/slash-commands.js.map +1 -1
  207. package/dist/core/subagent-lane-launcher.d.ts +3 -2
  208. package/dist/core/subagent-lane-launcher.d.ts.map +1 -1
  209. package/dist/core/subagent-lane-launcher.js +24 -13
  210. package/dist/core/subagent-lane-launcher.js.map +1 -1
  211. package/dist/core/tools/render-utils.d.ts.map +1 -1
  212. package/dist/core/tools/render-utils.js +2 -4
  213. package/dist/core/tools/render-utils.js.map +1 -1
  214. package/dist/core/turn-metrics-record.d.ts +55 -0
  215. package/dist/core/turn-metrics-record.d.ts.map +1 -0
  216. package/dist/core/turn-metrics-record.js +149 -0
  217. package/dist/core/turn-metrics-record.js.map +1 -0
  218. package/dist/core/turn-metrics.d.ts +4 -56
  219. package/dist/core/turn-metrics.d.ts.map +1 -1
  220. package/dist/core/turn-metrics.js +12 -60
  221. package/dist/core/turn-metrics.js.map +1 -1
  222. package/dist/core/verified-run/broker.d.ts +26 -0
  223. package/dist/core/verified-run/broker.d.ts.map +1 -0
  224. package/dist/core/verified-run/broker.js +210 -0
  225. package/dist/core/verified-run/broker.js.map +1 -0
  226. package/dist/core/verified-run/candidate.d.ts +24 -0
  227. package/dist/core/verified-run/candidate.d.ts.map +1 -0
  228. package/dist/core/verified-run/candidate.js +167 -0
  229. package/dist/core/verified-run/candidate.js.map +1 -0
  230. package/dist/core/verified-run/check-receipt.d.ts +18 -0
  231. package/dist/core/verified-run/check-receipt.d.ts.map +1 -0
  232. package/dist/core/verified-run/check-receipt.js +92 -0
  233. package/dist/core/verified-run/check-receipt.js.map +1 -0
  234. package/dist/core/verified-run/coordinator.d.ts +39 -0
  235. package/dist/core/verified-run/coordinator.d.ts.map +1 -0
  236. package/dist/core/verified-run/coordinator.js +190 -0
  237. package/dist/core/verified-run/coordinator.js.map +1 -0
  238. package/dist/core/verified-run/dag-candidates.d.ts +8 -0
  239. package/dist/core/verified-run/dag-candidates.d.ts.map +1 -0
  240. package/dist/core/verified-run/dag-candidates.js +65 -0
  241. package/dist/core/verified-run/dag-candidates.js.map +1 -0
  242. package/dist/core/verified-run/dag-phase.d.ts +7 -0
  243. package/dist/core/verified-run/dag-phase.d.ts.map +1 -0
  244. package/dist/core/verified-run/dag-phase.js +92 -0
  245. package/dist/core/verified-run/dag-phase.js.map +1 -0
  246. package/dist/core/verified-run/dag-projection.d.ts +7 -0
  247. package/dist/core/verified-run/dag-projection.d.ts.map +1 -0
  248. package/dist/core/verified-run/dag-projection.js +90 -0
  249. package/dist/core/verified-run/dag-projection.js.map +1 -0
  250. package/dist/core/verified-run/dag-recovery.d.ts +13 -0
  251. package/dist/core/verified-run/dag-recovery.d.ts.map +1 -0
  252. package/dist/core/verified-run/dag-recovery.js +98 -0
  253. package/dist/core/verified-run/dag-recovery.js.map +1 -0
  254. package/dist/core/verified-run/dag-retry-projection.d.ts +9 -0
  255. package/dist/core/verified-run/dag-retry-projection.d.ts.map +1 -0
  256. package/dist/core/verified-run/dag-retry-projection.js +43 -0
  257. package/dist/core/verified-run/dag-retry-projection.js.map +1 -0
  258. package/dist/core/verified-run/dag-types.d.ts +47 -0
  259. package/dist/core/verified-run/dag-types.d.ts.map +1 -0
  260. package/dist/core/verified-run/dag-types.js +2 -0
  261. package/dist/core/verified-run/dag-types.js.map +1 -0
  262. package/dist/core/verified-run/event-parser.d.ts +3 -0
  263. package/dist/core/verified-run/event-parser.d.ts.map +1 -0
  264. package/dist/core/verified-run/event-parser.js +153 -0
  265. package/dist/core/verified-run/event-parser.js.map +1 -0
  266. package/dist/core/verified-run/events.d.ts +4 -0
  267. package/dist/core/verified-run/events.d.ts.map +1 -0
  268. package/dist/core/verified-run/events.js +3 -0
  269. package/dist/core/verified-run/events.js.map +1 -0
  270. package/dist/core/verified-run/evidence-binding.d.ts +18 -0
  271. package/dist/core/verified-run/evidence-binding.d.ts.map +1 -0
  272. package/dist/core/verified-run/evidence-binding.js +81 -0
  273. package/dist/core/verified-run/evidence-binding.js.map +1 -0
  274. package/dist/core/verified-run/evidence.d.ts +27 -0
  275. package/dist/core/verified-run/evidence.d.ts.map +1 -0
  276. package/dist/core/verified-run/evidence.js +100 -0
  277. package/dist/core/verified-run/evidence.js.map +1 -0
  278. package/dist/core/verified-run/journal.d.ts +32 -0
  279. package/dist/core/verified-run/journal.d.ts.map +1 -0
  280. package/dist/core/verified-run/journal.js +103 -0
  281. package/dist/core/verified-run/journal.js.map +1 -0
  282. package/dist/core/verified-run/namespace-identity.d.ts +11 -0
  283. package/dist/core/verified-run/namespace-identity.d.ts.map +1 -0
  284. package/dist/core/verified-run/namespace-identity.js +77 -0
  285. package/dist/core/verified-run/namespace-identity.js.map +1 -0
  286. package/dist/core/verified-run/owned-execution.d.ts +21 -0
  287. package/dist/core/verified-run/owned-execution.d.ts.map +1 -0
  288. package/dist/core/verified-run/owned-execution.js +43 -0
  289. package/dist/core/verified-run/owned-execution.js.map +1 -0
  290. package/dist/core/verified-run/phase-context.d.ts +9 -0
  291. package/dist/core/verified-run/phase-context.d.ts.map +1 -0
  292. package/dist/core/verified-run/phase-context.js +2 -0
  293. package/dist/core/verified-run/phase-context.js.map +1 -0
  294. package/dist/core/verified-run/process-gate.d.ts +5 -0
  295. package/dist/core/verified-run/process-gate.d.ts.map +1 -0
  296. package/dist/core/verified-run/process-gate.js +31 -0
  297. package/dist/core/verified-run/process-gate.js.map +1 -0
  298. package/dist/core/verified-run/projection.d.ts +4 -0
  299. package/dist/core/verified-run/projection.d.ts.map +1 -0
  300. package/dist/core/verified-run/projection.js +219 -0
  301. package/dist/core/verified-run/projection.js.map +1 -0
  302. package/dist/core/verified-run/recovery-clock.d.ts +19 -0
  303. package/dist/core/verified-run/recovery-clock.d.ts.map +1 -0
  304. package/dist/core/verified-run/recovery-clock.js +69 -0
  305. package/dist/core/verified-run/recovery-clock.js.map +1 -0
  306. package/dist/core/verified-run/recovery-command.d.ts +11 -0
  307. package/dist/core/verified-run/recovery-command.d.ts.map +1 -0
  308. package/dist/core/verified-run/recovery-command.js +73 -0
  309. package/dist/core/verified-run/recovery-command.js.map +1 -0
  310. package/dist/core/verified-run/recovery-projection.d.ts +12 -0
  311. package/dist/core/verified-run/recovery-projection.d.ts.map +1 -0
  312. package/dist/core/verified-run/recovery-projection.js +88 -0
  313. package/dist/core/verified-run/recovery-projection.js.map +1 -0
  314. package/dist/core/verified-run/recovery.d.ts +12 -0
  315. package/dist/core/verified-run/recovery.d.ts.map +1 -0
  316. package/dist/core/verified-run/recovery.js +115 -0
  317. package/dist/core/verified-run/recovery.js.map +1 -0
  318. package/dist/core/verified-run/run-types.d.ts +103 -0
  319. package/dist/core/verified-run/run-types.d.ts.map +1 -0
  320. package/dist/core/verified-run/run-types.js +2 -0
  321. package/dist/core/verified-run/run-types.js.map +1 -0
  322. package/dist/core/verified-run/scripted-writer.d.ts +15 -0
  323. package/dist/core/verified-run/scripted-writer.d.ts.map +1 -0
  324. package/dist/core/verified-run/scripted-writer.js +94 -0
  325. package/dist/core/verified-run/scripted-writer.js.map +1 -0
  326. package/dist/core/verified-run/session-port.d.ts +27 -0
  327. package/dist/core/verified-run/session-port.d.ts.map +1 -0
  328. package/dist/core/verified-run/session-port.js +2 -0
  329. package/dist/core/verified-run/session-port.js.map +1 -0
  330. package/dist/core/verified-run/storage.d.ts +15 -0
  331. package/dist/core/verified-run/storage.d.ts.map +1 -0
  332. package/dist/core/verified-run/storage.js +96 -0
  333. package/dist/core/verified-run/storage.js.map +1 -0
  334. package/dist/core/verified-run/verification-phase.d.ts +5 -0
  335. package/dist/core/verified-run/verification-phase.d.ts.map +1 -0
  336. package/dist/core/verified-run/verification-phase.js +56 -0
  337. package/dist/core/verified-run/verification-phase.js.map +1 -0
  338. package/dist/core/verified-run/work-recovery.d.ts +8 -0
  339. package/dist/core/verified-run/work-recovery.d.ts.map +1 -0
  340. package/dist/core/verified-run/work-recovery.js +44 -0
  341. package/dist/core/verified-run/work-recovery.js.map +1 -0
  342. package/dist/core/verified-run/writer-completion.d.ts +4 -0
  343. package/dist/core/verified-run/writer-completion.d.ts.map +1 -0
  344. package/dist/core/verified-run/writer-completion.js +27 -0
  345. package/dist/core/verified-run/writer-completion.js.map +1 -0
  346. package/dist/core/verified-run/writer-phase.d.ts +8 -0
  347. package/dist/core/verified-run/writer-phase.d.ts.map +1 -0
  348. package/dist/core/verified-run/writer-phase.js +76 -0
  349. package/dist/core/verified-run/writer-phase.js.map +1 -0
  350. package/dist/core/verified-run/writer-projection.d.ts +11 -0
  351. package/dist/core/verified-run/writer-projection.d.ts.map +1 -0
  352. package/dist/core/verified-run/writer-projection.js +70 -0
  353. package/dist/core/verified-run/writer-projection.js.map +1 -0
  354. package/dist/core/verified-run/writer-recovery.d.ts +16 -0
  355. package/dist/core/verified-run/writer-recovery.d.ts.map +1 -0
  356. package/dist/core/verified-run/writer-recovery.js +107 -0
  357. package/dist/core/verified-run/writer-recovery.js.map +1 -0
  358. package/dist/core/workload-permit-pool.d.ts +1 -3
  359. package/dist/core/workload-permit-pool.d.ts.map +1 -1
  360. package/dist/core/workload-permit-pool.js +11 -11
  361. package/dist/core/workload-permit-pool.js.map +1 -1
  362. package/dist/guardrails/evidence-system.d.ts +1 -1
  363. package/dist/guardrails/evidence-system.d.ts.map +1 -1
  364. package/dist/guardrails/evidence-system.js +18 -29
  365. package/dist/guardrails/evidence-system.js.map +1 -1
  366. package/dist/guardrails/merge-gate-result.d.ts +4 -0
  367. package/dist/guardrails/merge-gate-result.d.ts.map +1 -0
  368. package/dist/guardrails/merge-gate-result.js +32 -0
  369. package/dist/guardrails/merge-gate-result.js.map +1 -0
  370. package/dist/index.d.ts +3 -2
  371. package/dist/index.d.ts.map +1 -1
  372. package/dist/index.js +2 -2
  373. package/dist/index.js.map +1 -1
  374. package/dist/main.d.ts.map +1 -1
  375. package/dist/main.js +17 -23
  376. package/dist/main.js.map +1 -1
  377. package/dist/modes/interactive/components/session-failure.d.ts +13 -0
  378. package/dist/modes/interactive/components/session-failure.d.ts.map +1 -0
  379. package/dist/modes/interactive/components/session-failure.js +81 -0
  380. package/dist/modes/interactive/components/session-failure.js.map +1 -0
  381. package/dist/modes/interactive/interactive-login-options.d.ts +27 -0
  382. package/dist/modes/interactive/interactive-login-options.d.ts.map +1 -0
  383. package/dist/modes/interactive/interactive-login-options.js +54 -0
  384. package/dist/modes/interactive/interactive-login-options.js.map +1 -0
  385. package/dist/modes/interactive/interactive-mode.d.ts +8 -4
  386. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  387. package/dist/modes/interactive/interactive-mode.js +183 -171
  388. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  389. package/dist/modes/interactive/interactive-resume-command.d.ts +3 -0
  390. package/dist/modes/interactive/interactive-resume-command.d.ts.map +1 -0
  391. package/dist/modes/interactive/interactive-resume-command.js +24 -0
  392. package/dist/modes/interactive/interactive-resume-command.js.map +1 -0
  393. package/dist/modes/interactive/interactive-tool-result.d.ts +32 -0
  394. package/dist/modes/interactive/interactive-tool-result.d.ts.map +1 -0
  395. package/dist/modes/interactive/interactive-tool-result.js +59 -0
  396. package/dist/modes/interactive/interactive-tool-result.js.map +1 -0
  397. package/dist/modes/interactive/tui-diagnostics.d.ts +36 -0
  398. package/dist/modes/interactive/tui-diagnostics.d.ts.map +1 -0
  399. package/dist/modes/interactive/tui-diagnostics.js +105 -0
  400. package/dist/modes/interactive/tui-diagnostics.js.map +1 -0
  401. package/dist/modes/interactive/tui-runtime-info.d.ts +20 -0
  402. package/dist/modes/interactive/tui-runtime-info.d.ts.map +1 -0
  403. package/dist/modes/interactive/tui-runtime-info.js +76 -0
  404. package/dist/modes/interactive/tui-runtime-info.js.map +1 -0
  405. package/dist/modes/print-mode.d.ts.map +1 -1
  406. package/dist/modes/print-mode.js +22 -0
  407. package/dist/modes/print-mode.js.map +1 -1
  408. package/dist/utils/clipboard-image.d.ts.map +1 -1
  409. package/dist/utils/clipboard-image.js +10 -60
  410. package/dist/utils/clipboard-image.js.map +1 -1
  411. package/dist/utils/terminal-links.d.ts +13 -0
  412. package/dist/utils/terminal-links.d.ts.map +1 -0
  413. package/dist/utils/terminal-links.js +68 -0
  414. package/dist/utils/terminal-links.js.map +1 -0
  415. package/dist/utils/windows-clipboard-image.d.ts +16 -0
  416. package/dist/utils/windows-clipboard-image.d.ts.map +1 -0
  417. package/dist/utils/windows-clipboard-image.js +87 -0
  418. package/dist/utils/windows-clipboard-image.js.map +1 -0
  419. package/docs/adaptorch-onboarding.md +80 -0
  420. package/docs/containerization.md +12 -0
  421. package/docs/context-files.md +97 -0
  422. package/docs/correctness-wall.md +8 -0
  423. package/docs/custom-provider.md +35 -0
  424. package/docs/development.md +28 -3
  425. package/docs/environment-variables.md +2 -0
  426. package/docs/grok-harness.md +4 -0
  427. package/docs/harness-boundaries.md +154 -0
  428. package/docs/harness-improvements.md +90 -0
  429. package/docs/json.md +19 -0
  430. package/docs/keybindings.md +2 -2
  431. package/docs/mcp.md +22 -2
  432. package/docs/metrics.md +66 -16
  433. package/docs/model-catalog-refresh.md +190 -0
  434. package/docs/model-contract.md +168 -0
  435. package/docs/models.md +21 -4
  436. package/docs/provider-resilience.md +5 -3
  437. package/docs/providers.md +68 -1
  438. package/docs/quickstart.md +4 -0
  439. package/docs/release-audit-0.98.4.md +112 -0
  440. package/docs/release-audit-0.98.5.md +84 -0
  441. package/docs/review-bundle-followup.md +195 -0
  442. package/docs/run-protocol.md +33 -1
  443. package/docs/runtime-algorithms.md +45 -0
  444. package/docs/sdk.md +204 -2
  445. package/docs/sessions.md +1 -1
  446. package/docs/settings.md +17 -1
  447. package/docs/skills.md +2 -0
  448. package/docs/tb21-audit.md +131 -0
  449. package/docs/terminal-setup.md +20 -0
  450. package/docs/usage.md +77 -1
  451. package/docs/verified-run-testing.md +417 -0
  452. package/docs/verified-run.md +388 -0
  453. package/docs/windows.md +48 -0
  454. package/examples/README.md +4 -0
  455. package/examples/context/AGENTS.md +64 -0
  456. package/examples/context/CLAUDE.md +17 -0
  457. package/examples/context/INTERNET.md +42 -0
  458. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  459. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  460. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  461. package/examples/extensions/gondolin/package-lock.json +2 -2
  462. package/examples/extensions/gondolin/package.json +1 -1
  463. package/examples/extensions/sandbox/package-lock.json +2 -2
  464. package/examples/extensions/sandbox/package.json +1 -1
  465. package/examples/extensions/with-deps/package-lock.json +2 -2
  466. package/examples/extensions/with-deps/package.json +1 -1
  467. package/npm-shrinkwrap.json +18 -18
  468. package/package.json +6 -6
@@ -7,12 +7,15 @@ import * as fs from "node:fs";
7
7
  import * as os from "node:os";
8
8
  import * as path from "node:path";
9
9
  import { spawn, spawnSync } from "child_process";
10
- import { getProviders, } from "omk-ai";
11
10
  import { AttachmentStore } from "../../core/attachment-store.js";
12
11
  import { describePromptImageAttachment } from "../../core/prompt-attachment.js";
13
12
  import { createAttachmentStrip } from "./components/attachment-strip.js";
14
- import { CombinedAutocompleteProvider, Container, fuzzyFilter, getCapabilities, hyperlink, Loader, Markdown, matchesKey, ProcessTerminal, Spacer, setKeybindings, Text, TruncatedText, TUI, visibleWidth, } from "omk-tui";
15
- import { APP_NAME, APP_TITLE, getAgentDir, getAuthPath, getDebugLogPath, getDocsPath, getShareViewerUrl, VERSION, } from "../../config.js";
13
+ export { formatResumeCommand } from "./interactive-resume-command.js";
14
+ import { getApiKeyLoginDisplayName, isApiKeyLoginProvider, resolveLoginProviderArg, } from "./interactive-login-options.js";
15
+ import { disposeComponent, ExpandableText, isExpandable, normalizeToolExecutionResult, } from "./interactive-tool-result.js";
16
+ export { getApiKeyLoginDisplayName, isApiKeyLoginProvider, resolveLoginProviderArg, } from "./interactive-login-options.js";
17
+ import { CombinedAutocompleteProvider, Container, fuzzyFilter, getCapabilities, hyperlink, Loader, Markdown, matchesKey, ProcessTerminal, Spacer, setKeybindings, Text, TruncatedText, TUI, } from "omk-tui";
18
+ import { APP_NAME, APP_TITLE, getAgentDir, getAuthPath, getDocsPath, getShareViewerUrl, VERSION, } from "../../config.js";
16
19
  import { parseSkillBlock } from "../../core/agent-session.js";
17
20
  import { SessionImportFileNotFoundError } from "../../core/agent-session-runtime.js";
18
21
  import { parseBangInvocation } from "../../core/bang-skill-invocation.js";
@@ -25,12 +28,10 @@ import { KeybindingsManager } from "../../core/keybindings.js";
25
28
  import { createCompactionSummaryMessage } from "../../core/messages.js";
26
29
  import { defaultModelPerProvider, findExactModelReferenceMatch, resolveModelScope } from "../../core/model-resolver.js";
27
30
  import { DefaultPackageManager } from "../../core/package-manager.js";
28
- import { BUILT_IN_PROVIDER_DISPLAY_NAMES } from "../../core/provider-display-names.js";
29
31
  import { decideResourceAdmission } from "../../core/resource-admission.js";
30
32
  import { formatResourcePolicyLines, formatResourceProbeLines, formatResourceSummaryLines, resolveResourceGovernorSettings, } from "../../core/resource-governor-settings.js";
31
33
  import { formatMissingSessionCwdPrompt, MissingSessionCwdError } from "../../core/session-cwd.js";
32
34
  import { SessionManager } from "../../core/session-manager.js";
33
- import { formatSessionTermination } from "../../core/session-termination.js";
34
35
  import { BUILTIN_SLASH_COMMANDS } from "../../core/slash-commands.js";
35
36
  import { isInstallTelemetryEnabled } from "../../core/telemetry.js";
36
37
  import { getChangelogPath, getNewEntries, parseChangelog } from "../../utils/changelog.js";
@@ -40,6 +41,7 @@ import { parseGitUrl } from "../../utils/git.js";
40
41
  import { openBrowser } from "../../utils/open-browser.js";
41
42
  import { getCwdRelativePath } from "../../utils/paths.js";
42
43
  import { killTrackedDetachedChildren } from "../../utils/shell.js";
44
+ import { terminalMarkdownLinks } from "../../utils/terminal-links.js";
43
45
  import { ensureTool } from "../../utils/tools-manager.js";
44
46
  import { checkForNewOmkVersion } from "../../utils/version-check.js";
45
47
  import { ArminComponent } from "./components/armin.js";
@@ -67,6 +69,7 @@ import { ModelSelectorComponent } from "./components/model-selector.js";
67
69
  import { OAuthAccountSelectorComponent } from "./components/oauth-account-selector.js";
68
70
  import { OAuthSelectorComponent } from "./components/oauth-selector.js";
69
71
  import { ScopedModelsSelectorComponent } from "./components/scoped-models-selector.js";
72
+ import { SessionFailureComponent } from "./components/session-failure.js";
70
73
  import { SessionSelectorComponent } from "./components/session-selector.js";
71
74
  import { SettingsSelectorComponent, ThinkingSelectorComponent } from "./components/settings-selector.js";
72
75
  import { SkillInvocationMessageComponent } from "./components/skill-invocation-message.js";
@@ -76,63 +79,9 @@ import { TreeSelectorComponent } from "./components/tree-selector.js";
76
79
  import { UserMessageComponent } from "./components/user-message.js";
77
80
  import { UserMessageSelectorComponent } from "./components/user-message-selector.js";
78
81
  import { getAvailableThemes, getAvailableThemesWithPaths, getEditorTheme, getMarkdownTheme, getThemeByName, initTheme, onThemeChange, setRegisteredThemes, setTheme, setThemeInstance, stopThemeWatcher, Theme, theme, } from "./theme/theme.js";
79
- function isExpandable(obj) {
80
- return typeof obj === "object" && obj !== null && "setExpanded" in obj && typeof obj.setExpanded === "function";
81
- }
82
- function disposeComponent(component) {
83
- if (typeof component === "object" &&
84
- component !== null &&
85
- "dispose" in component &&
86
- typeof component.dispose === "function") {
87
- component.dispose();
88
- }
89
- }
90
- function isRecord(value) {
91
- return typeof value === "object" && value !== null && !Array.isArray(value);
92
- }
93
- function isToolExecutionContent(value) {
94
- if (!isRecord(value))
95
- return false;
96
- if (value.type === "text")
97
- return typeof value.text === "string";
98
- return value.type === "image" && typeof value.data === "string" && typeof value.mimeType === "string";
99
- }
100
- function isToolExecutionResult(value) {
101
- return isRecord(value) && Array.isArray(value.content) && value.content.every(isToolExecutionContent);
102
- }
103
- function normalizeToolExecutionResult(result, isError) {
104
- try {
105
- if (isToolExecutionResult(result)) {
106
- return { content: result.content, details: result.details, isError };
107
- }
108
- }
109
- catch {
110
- // Treat inaccessible or malformed extension payloads as invalid results.
111
- }
112
- return {
113
- content: [{ type: "text", text: "Tool returned an invalid result." }],
114
- isError: true,
115
- };
116
- }
117
- class ExpandableText extends Text {
118
- getCollapsedText;
119
- getExpandedText;
120
- expanded;
121
- constructor(getCollapsedText, getExpandedText, expanded = false, paddingX = 0, paddingY = 0) {
122
- super(expanded ? getExpandedText() : getCollapsedText(), paddingX, paddingY);
123
- this.getCollapsedText = getCollapsedText;
124
- this.getExpandedText = getExpandedText;
125
- this.expanded = expanded;
126
- }
127
- setExpanded(expanded) {
128
- this.expanded = expanded;
129
- this.setText(expanded ? this.getExpandedText() : this.getCollapsedText());
130
- }
131
- invalidate() {
132
- this.setText(this.expanded ? this.getExpandedText() : this.getCollapsedText());
133
- super.invalidate();
134
- }
135
- }
82
+ import { createTuiDiagnostics, createTuiDiagnosticsView, saveTuiDiagnostics } from "./tui-diagnostics.js";
83
+ import { captureTuiRuntime, inspectTuiRuntime } from "./tui-runtime-info.js";
84
+ const TUI_RUNTIME = captureTuiRuntime(import.meta.url);
136
85
  const DEAD_TERMINAL_ERROR_CODES = new Set(["EIO", "EPIPE", "ENOTCONN"]);
137
86
  /**
138
87
  * Pseudo-entry for the thinking selector/autocomplete representing auto mode.
@@ -155,41 +104,10 @@ function isAnthropicSubscriptionAuthKey(apiKey) {
155
104
  function isUnknownModel(model) {
156
105
  return !!model && model.provider === "unknown" && model.id === "unknown" && model.api === "unknown";
157
106
  }
158
- function quoteIfNeeded(value) {
159
- if (value.length > 0 && !/[^a-zA-Z0-9_\-./~:@]/.test(value)) {
160
- return value;
161
- }
162
- return `'${value.replace(/'/g, `'\\''`)}'`;
163
- }
164
- export function formatResumeCommand(sessionManager) {
165
- if (!process.stdout.isTTY)
166
- return undefined;
167
- if (!sessionManager.isPersisted())
168
- return undefined;
169
- const sessionFile = sessionManager.getSessionFile();
170
- if (!sessionFile || !fs.existsSync(sessionFile))
171
- return undefined;
172
- const args = [APP_NAME];
173
- if (!sessionManager.usesDefaultSessionDir()) {
174
- args.push("--session-dir", quoteIfNeeded(sessionManager.getSessionDir()));
175
- }
176
- args.push("--session", sessionManager.getSessionId());
177
- return args.join(" ");
178
- }
179
107
  function hasDefaultModelProvider(providerId) {
180
108
  return providerId in defaultModelPerProvider;
181
109
  }
182
110
  const BEDROCK_PROVIDER_ID = "amazon-bedrock";
183
- const BUILT_IN_MODEL_PROVIDERS = new Set(getProviders());
184
- export function isApiKeyLoginProvider(providerId, oauthProviderIds, builtInProviderIds = BUILT_IN_MODEL_PROVIDERS) {
185
- if (BUILT_IN_PROVIDER_DISPLAY_NAMES[providerId]) {
186
- return true;
187
- }
188
- if (builtInProviderIds.has(providerId)) {
189
- return false;
190
- }
191
- return !oauthProviderIds.has(providerId);
192
- }
193
111
  /** Placeholder shown in the empty editor to make core affordances discoverable. */
194
112
  const EDITOR_PLACEHOLDER = "Ask anything · / for commands · ! for skills/bash";
195
113
  /** How long transient info notices stay visible below the editor. */
@@ -219,6 +137,7 @@ export class InteractiveMode {
219
137
  // Stored so the same manager can be injected into custom editors, selectors, and extension UI.
220
138
  keybindings;
221
139
  version;
140
+ lastResourceReloadAt;
222
141
  isInitialized = false;
223
142
  onInputCallback;
224
143
  pendingPromptPayloads = [];
@@ -434,6 +353,46 @@ export class InteractiveMode {
434
353
  });
435
354
  };
436
355
  }
356
+ const loginCommand = slashCommands.find((command) => command.name === "login");
357
+ if (loginCommand) {
358
+ loginCommand.argumentHint = "[provider]";
359
+ loginCommand.getArgumentCompletions = (prefix) => {
360
+ const options = this.getLoginProviderOptions();
361
+ // Dedupe ids that appear as both oauth and api_key (e.g.
362
+ // meta): keep the oauth (subscription) entry.
363
+ const byId = new Map();
364
+ for (const option of options) {
365
+ const existing = byId.get(option.id);
366
+ if (!existing || (existing.authType !== "oauth" && option.authType === "oauth")) {
367
+ byId.set(option.id, option);
368
+ }
369
+ }
370
+ const unique = [...byId.values()];
371
+ const filtered = fuzzyFilter(unique, prefix.trimStart(), (option) => `${option.id} ${option.name}`);
372
+ if (filtered.length === 0)
373
+ return null;
374
+ return filtered.map((option) => ({
375
+ value: option.id,
376
+ label: option.id,
377
+ description: option.name,
378
+ }));
379
+ };
380
+ }
381
+ const logoutCommand = slashCommands.find((command) => command.name === "logout");
382
+ if (logoutCommand) {
383
+ logoutCommand.argumentHint = "[provider]";
384
+ logoutCommand.getArgumentCompletions = (prefix) => {
385
+ const options = this.getLogoutProviderOptions();
386
+ const filtered = fuzzyFilter(options, prefix.trimStart(), (option) => `${option.id} ${option.name}`);
387
+ if (filtered.length === 0)
388
+ return null;
389
+ return filtered.map((option) => ({
390
+ value: option.id,
391
+ label: option.id,
392
+ description: option.name,
393
+ }));
394
+ };
395
+ }
437
396
  const modelCommand = slashCommands.find((command) => command.name === "model");
438
397
  if (modelCommand) {
439
398
  modelCommand.getArgumentCompletions = (prefix) => {
@@ -899,6 +858,7 @@ export class InteractiveMode {
899
858
  getMarkdownThemeWithSettings() {
900
859
  return {
901
860
  ...getMarkdownTheme(),
861
+ ...terminalMarkdownLinks(this.sessionManager.getCwd()),
902
862
  codeBlockIndent: this.settingsManager.getCodeBlockIndent(),
903
863
  };
904
864
  }
@@ -2217,7 +2177,7 @@ export class InteractiveMode {
2217
2177
  this.updateEditorBorderColor();
2218
2178
  }
2219
2179
  };
2220
- // Handle clipboard image paste (triggered on Ctrl+V)
2180
+ // Handle the configured clipboard image shortcut (Ctrl+V or Alt+V).
2221
2181
  this.defaultEditor.onPasteImage = () => {
2222
2182
  this.handleClipboardImagePaste();
2223
2183
  };
@@ -2226,18 +2186,13 @@ export class InteractiveMode {
2226
2186
  try {
2227
2187
  const image = await readClipboardImage();
2228
2188
  if (!image) {
2189
+ this.showStatus("No image in clipboard. Copy a screenshot, then press Alt+V (or Ctrl+V if forwarded by your terminal).");
2229
2190
  return;
2230
2191
  }
2231
- let attachment;
2232
- try {
2233
- attachment = this.attachmentStore.put(new Uint8Array(image.bytes), "clipboard");
2234
- }
2235
- catch (error) {
2236
- this.showWarning(error instanceof Error ? error.message : String(error));
2237
- return;
2238
- }
2192
+ const attachment = this.attachmentStore.put(new Uint8Array(image.bytes), "clipboard");
2239
2193
  this.draftAttachmentIds.push(attachment.id);
2240
2194
  this.refreshAttachmentStrip();
2195
+ this.showStatus("Image attached to the prompt. Submit when ready.");
2241
2196
  }
2242
2197
  catch (error) {
2243
2198
  this.showWarning(`Clipboard paste failed: ${error instanceof Error ? error.message : String(error)}`);
@@ -2433,13 +2388,25 @@ export class InteractiveMode {
2433
2388
  this.editor.setText("");
2434
2389
  return;
2435
2390
  }
2436
- if (text === "/login") {
2437
- this.showOAuthSelector("login");
2391
+ if (text === "/login" || text.startsWith("/login ")) {
2392
+ const providerArg = text.startsWith("/login ") ? text.slice("/login".length).trim() : undefined;
2393
+ if (providerArg) {
2394
+ await this.handleLoginProviderArg(providerArg);
2395
+ }
2396
+ else {
2397
+ this.showOAuthSelector("login");
2398
+ }
2438
2399
  this.editor.setText("");
2439
2400
  return;
2440
2401
  }
2441
- if (text === "/logout") {
2442
- this.showOAuthSelector("logout");
2402
+ if (text === "/logout" || text.startsWith("/logout ")) {
2403
+ const providerArg = text.startsWith("/logout ") ? text.slice("/logout".length).trim() : undefined;
2404
+ if (providerArg) {
2405
+ await this.handleLogoutProviderArg(providerArg);
2406
+ }
2407
+ else {
2408
+ this.showOAuthSelector("logout");
2409
+ }
2443
2410
  this.editor.setText("");
2444
2411
  return;
2445
2412
  }
@@ -2459,8 +2426,8 @@ export class InteractiveMode {
2459
2426
  await this.handleReloadCommand();
2460
2427
  return;
2461
2428
  }
2462
- if (text === "/debug") {
2463
- this.handleDebugCommand();
2429
+ if (text === "/debug" || text.startsWith("/debug ")) {
2430
+ this.handleDebugCommand(text.slice("/debug".length).trim());
2464
2431
  this.editor.setText("");
2465
2432
  return;
2466
2433
  }
@@ -2906,13 +2873,22 @@ export class InteractiveMode {
2906
2873
  return textBlocks.map((c) => c.text).join("");
2907
2874
  }
2908
2875
  showSessionTermination(termination) {
2909
- if (termination.kind === "completed" || this.lastRenderedTermination === termination)
2876
+ if (termination.kind === "completed")
2877
+ return;
2878
+ const last = this.lastRenderedTermination;
2879
+ if (last?.sessionId === termination.sessionId &&
2880
+ last.runId === termination.runId &&
2881
+ last.timestamp === termination.timestamp &&
2882
+ last.causeCode === termination.causeCode &&
2883
+ last.source === termination.source)
2910
2884
  return;
2911
2885
  this.lastRenderedTermination = termination;
2912
2886
  // compaction_end owns the concise cancellation status; rendering this too duplicates it as a scary error.
2913
2887
  if (termination.causeCode === "compaction.aborted")
2914
2888
  return;
2915
- this.showError(formatSessionTermination(termination));
2889
+ this.chatContainer.addChild(new Spacer(1));
2890
+ this.chatContainer.addChild(new SessionFailureComponent(termination, this.toolOutputExpanded));
2891
+ this.ui.requestRender();
2916
2892
  }
2917
2893
  showPromptError(error, previousTermination) {
2918
2894
  const termination = this.session.lastTermination;
@@ -4342,14 +4318,21 @@ export class InteractiveMode {
4342
4318
  if (!isApiKeyLoginProvider(providerId, oauthProviderIds)) {
4343
4319
  continue;
4344
4320
  }
4321
+ const displayName = this.session.modelRegistry.getProviderDisplayName(providerId);
4345
4322
  options.push({
4346
4323
  id: providerId,
4347
- name: this.session.modelRegistry.getProviderDisplayName(providerId),
4324
+ // The shared "meta" id resolves its display name to the oauth
4325
+ // entry, so label the API-key row distinctly.
4326
+ name: oauthProviderIds.has(providerId) && displayName !== providerId
4327
+ ? getApiKeyLoginDisplayName(providerId, displayName)
4328
+ : displayName,
4348
4329
  authType: "api_key",
4349
4330
  });
4350
4331
  }
4351
4332
  const filteredOptions = authType ? options.filter((option) => option.authType === authType) : options;
4352
- return filteredOptions.sort((a, b) => a.name.localeCompare(b.name));
4333
+ // Stable order: by name, then oauth before api_key so a shared id
4334
+ // (e.g. meta) lists the subscription entry first.
4335
+ return filteredOptions.sort((a, b) => a.name.localeCompare(b.name) || a.authType.localeCompare(b.authType));
4353
4336
  }
4354
4337
  getLogoutProviderOptions() {
4355
4338
  const authStorage = this.session.modelRegistry.authStorage;
@@ -4367,6 +4350,40 @@ export class InteractiveMode {
4367
4350
  }
4368
4351
  return options.sort((a, b) => a.name.localeCompare(b.name));
4369
4352
  }
4353
+ async handleLogoutProviderArg(providerArg) {
4354
+ const providerOptions = this.getLogoutProviderOptions();
4355
+ const match = resolveLoginProviderArg(providerArg, providerOptions);
4356
+ if (!match) {
4357
+ const hint = providerOptions.length > 0
4358
+ ? "Run /logout and pick from the list of stored credentials."
4359
+ : "No stored credentials to remove.";
4360
+ this.showWarning(`Unknown provider "${providerArg}". ${hint}`);
4361
+ return;
4362
+ }
4363
+ await this.logoutProvider(match);
4364
+ }
4365
+ async logoutProvider(providerOption) {
4366
+ try {
4367
+ const oauthAccountCount = this.session.modelRegistry.authStorage.getOAuthAccountCount(providerOption.id);
4368
+ this.session.modelRegistry.authStorage.logout(providerOption.id);
4369
+ this.session.modelRegistry.refresh();
4370
+ await this.updateAvailableProviderCount();
4371
+ let message;
4372
+ if (providerOption.authType === "oauth") {
4373
+ message =
4374
+ oauthAccountCount > 1
4375
+ ? `Logged out of ${providerOption.name}. Removed ${oauthAccountCount} subscription accounts.`
4376
+ : `Logged out of ${providerOption.name}`;
4377
+ }
4378
+ else {
4379
+ message = `Removed stored API key for ${providerOption.name}. Environment variables and models.json config are unchanged.`;
4380
+ }
4381
+ this.showStatus(message);
4382
+ }
4383
+ catch (error) {
4384
+ this.showError(`Logout failed: ${error instanceof Error ? error.message : String(error)}`);
4385
+ }
4386
+ }
4370
4387
  showLoginAuthTypeSelector() {
4371
4388
  const subscriptionLabel = "Use a subscription";
4372
4389
  const apiKeyLabel = "Use an API key";
@@ -4382,6 +4399,33 @@ export class InteractiveMode {
4382
4399
  return { component: selector, focus: selector };
4383
4400
  });
4384
4401
  }
4402
+ async handleLoginProviderArg(providerArg) {
4403
+ const providerOptions = this.getLoginProviderOptions();
4404
+ const match = resolveLoginProviderArg(providerArg, providerOptions);
4405
+ if (!match) {
4406
+ this.showWarning(`Unknown provider "${providerArg}". Run /login and pick from the list, or check /model for provider ids.`);
4407
+ return;
4408
+ }
4409
+ await this.startLoginForProvider(match);
4410
+ }
4411
+ async startLoginForProvider(providerOption) {
4412
+ if (providerOption.authType === "oauth") {
4413
+ const authStorage = this.session.modelRegistry.authStorage;
4414
+ const accounts = authStorage.listOAuthAccounts(providerOption.id);
4415
+ if (accounts.length > 0) {
4416
+ this.showOAuthAccountSelector(providerOption);
4417
+ }
4418
+ else {
4419
+ await this.showLoginDialog(providerOption.id, providerOption.name);
4420
+ }
4421
+ }
4422
+ else if (providerOption.id === BEDROCK_PROVIDER_ID) {
4423
+ this.showBedrockSetupDialog(providerOption.id, providerOption.name);
4424
+ }
4425
+ else {
4426
+ await this.showApiKeyLoginDialog(providerOption.id, providerOption.name);
4427
+ }
4428
+ }
4385
4429
  showLoginProviderSelector(authType) {
4386
4430
  const providerOptions = this.getLoginProviderOptions(authType);
4387
4431
  if (providerOptions.length === 0) {
@@ -4395,21 +4439,7 @@ export class InteractiveMode {
4395
4439
  if (!providerOption) {
4396
4440
  return;
4397
4441
  }
4398
- if (providerOption.authType === "oauth") {
4399
- const accounts = this.session.modelRegistry.authStorage.listOAuthAccounts(providerOption.id);
4400
- if (accounts.length > 0) {
4401
- this.showOAuthAccountSelector(providerOption);
4402
- }
4403
- else {
4404
- await this.showLoginDialog(providerOption.id, providerOption.name);
4405
- }
4406
- }
4407
- else if (providerOption.id === BEDROCK_PROVIDER_ID) {
4408
- this.showBedrockSetupDialog(providerOption.id, providerOption.name);
4409
- }
4410
- else {
4411
- await this.showApiKeyLoginDialog(providerOption.id, providerOption.name);
4412
- }
4442
+ await this.startLoginForProvider(providerOption);
4413
4443
  }, () => {
4414
4444
  done();
4415
4445
  this.showLoginAuthTypeSelector();
@@ -4467,26 +4497,7 @@ export class InteractiveMode {
4467
4497
  if (!providerOption) {
4468
4498
  return;
4469
4499
  }
4470
- try {
4471
- const oauthAccountCount = this.session.modelRegistry.authStorage.getOAuthAccountCount(providerOption.id);
4472
- this.session.modelRegistry.authStorage.logout(providerOption.id);
4473
- this.session.modelRegistry.refresh();
4474
- await this.updateAvailableProviderCount();
4475
- let message;
4476
- if (providerOption.authType === "oauth") {
4477
- message =
4478
- oauthAccountCount > 1
4479
- ? `Logged out of ${providerOption.name}. Removed ${oauthAccountCount} subscription accounts.`
4480
- : `Logged out of ${providerOption.name}`;
4481
- }
4482
- else {
4483
- message = `Removed stored API key for ${providerOption.name}. Environment variables and models.json config are unchanged.`;
4484
- }
4485
- this.showStatus(message);
4486
- }
4487
- catch (error) {
4488
- this.showError(`Logout failed: ${error instanceof Error ? error.message : String(error)}`);
4489
- }
4500
+ await this.logoutProvider(providerOption);
4490
4501
  }, () => {
4491
4502
  done();
4492
4503
  this.ui.requestRender();
@@ -4777,6 +4788,7 @@ export class InteractiveMode {
4777
4788
  if (modelsJsonError) {
4778
4789
  this.showError(`models.json error: ${modelsJsonError}`);
4779
4790
  }
4791
+ this.lastResourceReloadAt = new Date().toISOString();
4780
4792
  this.showStatus("Reloaded keybindings, extensions, skills, prompts, themes");
4781
4793
  }
4782
4794
  catch (error) {
@@ -5275,31 +5287,31 @@ export class InteractiveMode {
5275
5287
  await this.handleFatalRuntimeError("Failed to create session", error);
5276
5288
  }
5277
5289
  }
5278
- handleDebugCommand() {
5279
- const width = this.ui.terminal.columns;
5280
- const height = this.ui.terminal.rows;
5281
- const allLines = this.ui.render(width);
5282
- const debugLogPath = getDebugLogPath();
5283
- const debugData = [
5284
- `Debug output at ${new Date().toISOString()}`,
5285
- `Terminal: ${width}x${height}`,
5286
- `Total lines: ${allLines.length}`,
5287
- "",
5288
- "=== All rendered lines with visible widths ===",
5289
- ...allLines.map((line, idx) => {
5290
- const vw = visibleWidth(line);
5291
- const escaped = JSON.stringify(line);
5292
- return `[${idx}] (w=${vw}) ${escaped}`;
5293
- }),
5294
- "",
5295
- "=== Agent messages (JSONL) ===",
5296
- ...this.session.messages.map((msg) => JSON.stringify(msg)),
5297
- "",
5298
- ].join("\n");
5299
- fs.mkdirSync(path.dirname(debugLogPath), { recursive: true });
5300
- fs.writeFileSync(debugLogPath, debugData);
5290
+ handleDebugCommand(args = "") {
5291
+ if (args !== "" && args !== "save") {
5292
+ this.showError("Usage: /debug [save]. Raw transcripts are not part of diagnostics.");
5293
+ return;
5294
+ }
5295
+ const report = createTuiDiagnostics({
5296
+ runtime: inspectTuiRuntime(TUI_RUNTIME),
5297
+ columns: this.ui.terminal.columns,
5298
+ rows: this.ui.terminal.rows,
5299
+ isStreaming: this.session.isStreaming,
5300
+ isCompacting: this.session.isCompacting,
5301
+ messageCount: this.session.messages.length,
5302
+ termination: this.session.lastTermination,
5303
+ lastResourceReloadAt: this.lastResourceReloadAt,
5304
+ });
5301
5305
  this.chatContainer.addChild(new Spacer(1));
5302
- this.chatContainer.addChild(new Text(`${theme.fg("accent", "✓ Debug log written")}\n${theme.fg("muted", debugLogPath)}`, 1, 1));
5306
+ this.chatContainer.addChild(createTuiDiagnosticsView(report, TUI_RUNTIME));
5307
+ if (args === "save") {
5308
+ try {
5309
+ this.showStatus(`Metadata-only diagnostics saved locally: ${saveTuiDiagnostics(report)}`);
5310
+ }
5311
+ catch {
5312
+ this.showError("Could not save diagnostics. Check temporary-directory permissions; no transcript was exported.");
5313
+ }
5314
+ }
5303
5315
  this.ui.requestRender();
5304
5316
  }
5305
5317
  handleArminSaysHi() {