open-multi-agent-kit 0.98.4 → 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 (252) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +3 -2
  3. package/dist/commands/run-command.d.ts +2 -1
  4. package/dist/commands/run-command.d.ts.map +1 -1
  5. package/dist/commands/run-command.js +9 -1
  6. package/dist/commands/run-command.js.map +1 -1
  7. package/dist/commands/verified-run-cli.d.ts +6 -0
  8. package/dist/commands/verified-run-cli.d.ts.map +1 -0
  9. package/dist/commands/verified-run-cli.js +190 -0
  10. package/dist/commands/verified-run-cli.js.map +1 -0
  11. package/dist/core/agent-session-services.d.ts +8 -1
  12. package/dist/core/agent-session-services.d.ts.map +1 -1
  13. package/dist/core/agent-session-services.js +41 -0
  14. package/dist/core/agent-session-services.js.map +1 -1
  15. package/dist/core/agent-session.d.ts +7 -8
  16. package/dist/core/agent-session.d.ts.map +1 -1
  17. package/dist/core/agent-session.js +61 -41
  18. package/dist/core/agent-session.js.map +1 -1
  19. package/dist/core/prompt-settlement.d.ts +4 -3
  20. package/dist/core/prompt-settlement.d.ts.map +1 -1
  21. package/dist/core/prompt-settlement.js.map +1 -1
  22. package/dist/core/run-budget-policy.d.ts +18 -0
  23. package/dist/core/run-budget-policy.d.ts.map +1 -0
  24. package/dist/core/run-budget-policy.js +52 -0
  25. package/dist/core/run-budget-policy.js.map +1 -0
  26. package/dist/core/run-budget.d.ts +33 -0
  27. package/dist/core/run-budget.d.ts.map +1 -0
  28. package/dist/core/run-budget.js +89 -0
  29. package/dist/core/run-budget.js.map +1 -0
  30. package/dist/core/run-execution-api.d.ts +15 -0
  31. package/dist/core/run-execution-api.d.ts.map +1 -0
  32. package/dist/core/run-execution-api.js +7 -0
  33. package/dist/core/run-execution-api.js.map +1 -0
  34. package/dist/core/run-journal.d.ts.map +1 -1
  35. package/dist/core/run-journal.js +30 -208
  36. package/dist/core/run-journal.js.map +1 -1
  37. package/dist/core/session-bash-service.d.ts +2 -2
  38. package/dist/core/session-bash-service.d.ts.map +1 -1
  39. package/dist/core/session-bash-service.js +21 -9
  40. package/dist/core/session-bash-service.js.map +1 -1
  41. package/dist/core/session-failure-cause.d.ts.map +1 -1
  42. package/dist/core/session-failure-cause.js +5 -0
  43. package/dist/core/session-failure-cause.js.map +1 -1
  44. package/dist/core/session-prompt-lifecycle.d.ts +25 -0
  45. package/dist/core/session-prompt-lifecycle.d.ts.map +1 -0
  46. package/dist/core/session-prompt-lifecycle.js +87 -0
  47. package/dist/core/session-prompt-lifecycle.js.map +1 -0
  48. package/dist/core/session-run-budget.d.ts +28 -0
  49. package/dist/core/session-run-budget.d.ts.map +1 -0
  50. package/dist/core/session-run-budget.js +127 -0
  51. package/dist/core/session-run-budget.js.map +1 -0
  52. package/dist/core/session-run-termination.d.ts.map +1 -1
  53. package/dist/core/session-run-termination.js +14 -3
  54. package/dist/core/session-run-termination.js.map +1 -1
  55. package/dist/core/session-termination-types.d.ts +97 -0
  56. package/dist/core/session-termination-types.d.ts.map +1 -0
  57. package/dist/core/session-termination-types.js +26 -0
  58. package/dist/core/session-termination-types.js.map +1 -0
  59. package/dist/core/session-termination.d.ts +3 -97
  60. package/dist/core/session-termination.d.ts.map +1 -1
  61. package/dist/core/session-termination.js +24 -28
  62. package/dist/core/session-termination.js.map +1 -1
  63. package/dist/core/slash-commands.d.ts.map +1 -1
  64. package/dist/core/slash-commands.js +1 -0
  65. package/dist/core/slash-commands.js.map +1 -1
  66. package/dist/core/subagent-lane-launcher.d.ts +3 -2
  67. package/dist/core/subagent-lane-launcher.d.ts.map +1 -1
  68. package/dist/core/subagent-lane-launcher.js +24 -13
  69. package/dist/core/subagent-lane-launcher.js.map +1 -1
  70. package/dist/core/verified-run/broker.d.ts +26 -0
  71. package/dist/core/verified-run/broker.d.ts.map +1 -0
  72. package/dist/core/verified-run/broker.js +210 -0
  73. package/dist/core/verified-run/broker.js.map +1 -0
  74. package/dist/core/verified-run/candidate.d.ts +24 -0
  75. package/dist/core/verified-run/candidate.d.ts.map +1 -0
  76. package/dist/core/verified-run/candidate.js +167 -0
  77. package/dist/core/verified-run/candidate.js.map +1 -0
  78. package/dist/core/verified-run/check-receipt.d.ts +18 -0
  79. package/dist/core/verified-run/check-receipt.d.ts.map +1 -0
  80. package/dist/core/verified-run/check-receipt.js +92 -0
  81. package/dist/core/verified-run/check-receipt.js.map +1 -0
  82. package/dist/core/verified-run/coordinator.d.ts +39 -0
  83. package/dist/core/verified-run/coordinator.d.ts.map +1 -0
  84. package/dist/core/verified-run/coordinator.js +190 -0
  85. package/dist/core/verified-run/coordinator.js.map +1 -0
  86. package/dist/core/verified-run/dag-candidates.d.ts +8 -0
  87. package/dist/core/verified-run/dag-candidates.d.ts.map +1 -0
  88. package/dist/core/verified-run/dag-candidates.js +65 -0
  89. package/dist/core/verified-run/dag-candidates.js.map +1 -0
  90. package/dist/core/verified-run/dag-phase.d.ts +7 -0
  91. package/dist/core/verified-run/dag-phase.d.ts.map +1 -0
  92. package/dist/core/verified-run/dag-phase.js +92 -0
  93. package/dist/core/verified-run/dag-phase.js.map +1 -0
  94. package/dist/core/verified-run/dag-projection.d.ts +7 -0
  95. package/dist/core/verified-run/dag-projection.d.ts.map +1 -0
  96. package/dist/core/verified-run/dag-projection.js +90 -0
  97. package/dist/core/verified-run/dag-projection.js.map +1 -0
  98. package/dist/core/verified-run/dag-recovery.d.ts +13 -0
  99. package/dist/core/verified-run/dag-recovery.d.ts.map +1 -0
  100. package/dist/core/verified-run/dag-recovery.js +98 -0
  101. package/dist/core/verified-run/dag-recovery.js.map +1 -0
  102. package/dist/core/verified-run/dag-retry-projection.d.ts +9 -0
  103. package/dist/core/verified-run/dag-retry-projection.d.ts.map +1 -0
  104. package/dist/core/verified-run/dag-retry-projection.js +43 -0
  105. package/dist/core/verified-run/dag-retry-projection.js.map +1 -0
  106. package/dist/core/verified-run/dag-types.d.ts +47 -0
  107. package/dist/core/verified-run/dag-types.d.ts.map +1 -0
  108. package/dist/core/verified-run/dag-types.js +2 -0
  109. package/dist/core/verified-run/dag-types.js.map +1 -0
  110. package/dist/core/verified-run/event-parser.d.ts +3 -0
  111. package/dist/core/verified-run/event-parser.d.ts.map +1 -0
  112. package/dist/core/verified-run/event-parser.js +153 -0
  113. package/dist/core/verified-run/event-parser.js.map +1 -0
  114. package/dist/core/verified-run/events.d.ts +4 -0
  115. package/dist/core/verified-run/events.d.ts.map +1 -0
  116. package/dist/core/verified-run/events.js +3 -0
  117. package/dist/core/verified-run/events.js.map +1 -0
  118. package/dist/core/verified-run/evidence-binding.d.ts +18 -0
  119. package/dist/core/verified-run/evidence-binding.d.ts.map +1 -0
  120. package/dist/core/verified-run/evidence-binding.js +81 -0
  121. package/dist/core/verified-run/evidence-binding.js.map +1 -0
  122. package/dist/core/verified-run/evidence.d.ts +27 -0
  123. package/dist/core/verified-run/evidence.d.ts.map +1 -0
  124. package/dist/core/verified-run/evidence.js +100 -0
  125. package/dist/core/verified-run/evidence.js.map +1 -0
  126. package/dist/core/verified-run/journal.d.ts +32 -0
  127. package/dist/core/verified-run/journal.d.ts.map +1 -0
  128. package/dist/core/verified-run/journal.js +103 -0
  129. package/dist/core/verified-run/journal.js.map +1 -0
  130. package/dist/core/verified-run/namespace-identity.d.ts +11 -0
  131. package/dist/core/verified-run/namespace-identity.d.ts.map +1 -0
  132. package/dist/core/verified-run/namespace-identity.js +77 -0
  133. package/dist/core/verified-run/namespace-identity.js.map +1 -0
  134. package/dist/core/verified-run/owned-execution.d.ts +21 -0
  135. package/dist/core/verified-run/owned-execution.d.ts.map +1 -0
  136. package/dist/core/verified-run/owned-execution.js +43 -0
  137. package/dist/core/verified-run/owned-execution.js.map +1 -0
  138. package/dist/core/verified-run/phase-context.d.ts +9 -0
  139. package/dist/core/verified-run/phase-context.d.ts.map +1 -0
  140. package/dist/core/verified-run/phase-context.js +2 -0
  141. package/dist/core/verified-run/phase-context.js.map +1 -0
  142. package/dist/core/verified-run/process-gate.d.ts +5 -0
  143. package/dist/core/verified-run/process-gate.d.ts.map +1 -0
  144. package/dist/core/verified-run/process-gate.js +31 -0
  145. package/dist/core/verified-run/process-gate.js.map +1 -0
  146. package/dist/core/verified-run/projection.d.ts +4 -0
  147. package/dist/core/verified-run/projection.d.ts.map +1 -0
  148. package/dist/core/verified-run/projection.js +219 -0
  149. package/dist/core/verified-run/projection.js.map +1 -0
  150. package/dist/core/verified-run/recovery-clock.d.ts +19 -0
  151. package/dist/core/verified-run/recovery-clock.d.ts.map +1 -0
  152. package/dist/core/verified-run/recovery-clock.js +69 -0
  153. package/dist/core/verified-run/recovery-clock.js.map +1 -0
  154. package/dist/core/verified-run/recovery-command.d.ts +11 -0
  155. package/dist/core/verified-run/recovery-command.d.ts.map +1 -0
  156. package/dist/core/verified-run/recovery-command.js +73 -0
  157. package/dist/core/verified-run/recovery-command.js.map +1 -0
  158. package/dist/core/verified-run/recovery-projection.d.ts +12 -0
  159. package/dist/core/verified-run/recovery-projection.d.ts.map +1 -0
  160. package/dist/core/verified-run/recovery-projection.js +88 -0
  161. package/dist/core/verified-run/recovery-projection.js.map +1 -0
  162. package/dist/core/verified-run/recovery.d.ts +12 -0
  163. package/dist/core/verified-run/recovery.d.ts.map +1 -0
  164. package/dist/core/verified-run/recovery.js +115 -0
  165. package/dist/core/verified-run/recovery.js.map +1 -0
  166. package/dist/core/verified-run/run-types.d.ts +103 -0
  167. package/dist/core/verified-run/run-types.d.ts.map +1 -0
  168. package/dist/core/verified-run/run-types.js +2 -0
  169. package/dist/core/verified-run/run-types.js.map +1 -0
  170. package/dist/core/verified-run/scripted-writer.d.ts +15 -0
  171. package/dist/core/verified-run/scripted-writer.d.ts.map +1 -0
  172. package/dist/core/verified-run/scripted-writer.js +94 -0
  173. package/dist/core/verified-run/scripted-writer.js.map +1 -0
  174. package/dist/core/verified-run/session-port.d.ts +27 -0
  175. package/dist/core/verified-run/session-port.d.ts.map +1 -0
  176. package/dist/core/verified-run/session-port.js +2 -0
  177. package/dist/core/verified-run/session-port.js.map +1 -0
  178. package/dist/core/verified-run/storage.d.ts +15 -0
  179. package/dist/core/verified-run/storage.d.ts.map +1 -0
  180. package/dist/core/verified-run/storage.js +96 -0
  181. package/dist/core/verified-run/storage.js.map +1 -0
  182. package/dist/core/verified-run/verification-phase.d.ts +5 -0
  183. package/dist/core/verified-run/verification-phase.d.ts.map +1 -0
  184. package/dist/core/verified-run/verification-phase.js +56 -0
  185. package/dist/core/verified-run/verification-phase.js.map +1 -0
  186. package/dist/core/verified-run/work-recovery.d.ts +8 -0
  187. package/dist/core/verified-run/work-recovery.d.ts.map +1 -0
  188. package/dist/core/verified-run/work-recovery.js +44 -0
  189. package/dist/core/verified-run/work-recovery.js.map +1 -0
  190. package/dist/core/verified-run/writer-completion.d.ts +4 -0
  191. package/dist/core/verified-run/writer-completion.d.ts.map +1 -0
  192. package/dist/core/verified-run/writer-completion.js +27 -0
  193. package/dist/core/verified-run/writer-completion.js.map +1 -0
  194. package/dist/core/verified-run/writer-phase.d.ts +8 -0
  195. package/dist/core/verified-run/writer-phase.d.ts.map +1 -0
  196. package/dist/core/verified-run/writer-phase.js +76 -0
  197. package/dist/core/verified-run/writer-phase.js.map +1 -0
  198. package/dist/core/verified-run/writer-projection.d.ts +11 -0
  199. package/dist/core/verified-run/writer-projection.d.ts.map +1 -0
  200. package/dist/core/verified-run/writer-projection.js +70 -0
  201. package/dist/core/verified-run/writer-projection.js.map +1 -0
  202. package/dist/core/verified-run/writer-recovery.d.ts +16 -0
  203. package/dist/core/verified-run/writer-recovery.d.ts.map +1 -0
  204. package/dist/core/verified-run/writer-recovery.js +107 -0
  205. package/dist/core/verified-run/writer-recovery.js.map +1 -0
  206. package/dist/core/workload-permit-pool.d.ts +1 -3
  207. package/dist/core/workload-permit-pool.d.ts.map +1 -1
  208. package/dist/core/workload-permit-pool.js +11 -11
  209. package/dist/core/workload-permit-pool.js.map +1 -1
  210. package/dist/index.d.ts +3 -2
  211. package/dist/index.d.ts.map +1 -1
  212. package/dist/index.js +2 -2
  213. package/dist/index.js.map +1 -1
  214. package/dist/main.d.ts.map +1 -1
  215. package/dist/main.js +2 -8
  216. package/dist/main.js.map +1 -1
  217. package/dist/modes/interactive/components/session-failure.d.ts +13 -0
  218. package/dist/modes/interactive/components/session-failure.d.ts.map +1 -0
  219. package/dist/modes/interactive/components/session-failure.js +81 -0
  220. package/dist/modes/interactive/components/session-failure.js.map +1 -0
  221. package/dist/modes/interactive/interactive-mode.d.ts +1 -0
  222. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  223. package/dist/modes/interactive/interactive-mode.js +45 -31
  224. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  225. package/dist/modes/interactive/tui-diagnostics.d.ts +36 -0
  226. package/dist/modes/interactive/tui-diagnostics.d.ts.map +1 -0
  227. package/dist/modes/interactive/tui-diagnostics.js +105 -0
  228. package/dist/modes/interactive/tui-diagnostics.js.map +1 -0
  229. package/dist/modes/interactive/tui-runtime-info.d.ts +20 -0
  230. package/dist/modes/interactive/tui-runtime-info.d.ts.map +1 -0
  231. package/dist/modes/interactive/tui-runtime-info.js +76 -0
  232. package/dist/modes/interactive/tui-runtime-info.js.map +1 -0
  233. package/docs/development.md +10 -0
  234. package/docs/keybindings.md +1 -1
  235. package/docs/release-audit-0.98.5.md +84 -0
  236. package/docs/run-protocol.md +33 -1
  237. package/docs/runtime-algorithms.md +26 -0
  238. package/docs/sdk.md +193 -0
  239. package/docs/usage.md +54 -0
  240. package/docs/verified-run-testing.md +417 -0
  241. package/docs/verified-run.md +388 -0
  242. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  243. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  244. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  245. package/examples/extensions/gondolin/package-lock.json +2 -2
  246. package/examples/extensions/gondolin/package.json +1 -1
  247. package/examples/extensions/sandbox/package-lock.json +2 -2
  248. package/examples/extensions/sandbox/package.json +1 -1
  249. package/examples/extensions/with-deps/package-lock.json +2 -2
  250. package/examples/extensions/with-deps/package.json +1 -1
  251. package/npm-shrinkwrap.json +18 -18
  252. package/package.json +6 -6
@@ -14,8 +14,8 @@ export { formatResumeCommand } from "./interactive-resume-command.js";
14
14
  import { getApiKeyLoginDisplayName, isApiKeyLoginProvider, resolveLoginProviderArg, } from "./interactive-login-options.js";
15
15
  import { disposeComponent, ExpandableText, isExpandable, normalizeToolExecutionResult, } from "./interactive-tool-result.js";
16
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, visibleWidth, } from "omk-tui";
18
- import { APP_NAME, APP_TITLE, getAgentDir, getAuthPath, getDebugLogPath, getDocsPath, getShareViewerUrl, VERSION, } from "../../config.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";
19
19
  import { parseSkillBlock } from "../../core/agent-session.js";
20
20
  import { SessionImportFileNotFoundError } from "../../core/agent-session-runtime.js";
21
21
  import { parseBangInvocation } from "../../core/bang-skill-invocation.js";
@@ -32,7 +32,6 @@ import { decideResourceAdmission } from "../../core/resource-admission.js";
32
32
  import { formatResourcePolicyLines, formatResourceProbeLines, formatResourceSummaryLines, resolveResourceGovernorSettings, } from "../../core/resource-governor-settings.js";
33
33
  import { formatMissingSessionCwdPrompt, MissingSessionCwdError } from "../../core/session-cwd.js";
34
34
  import { SessionManager } from "../../core/session-manager.js";
35
- import { formatSessionTermination } from "../../core/session-termination.js";
36
35
  import { BUILTIN_SLASH_COMMANDS } from "../../core/slash-commands.js";
37
36
  import { isInstallTelemetryEnabled } from "../../core/telemetry.js";
38
37
  import { getChangelogPath, getNewEntries, parseChangelog } from "../../utils/changelog.js";
@@ -70,6 +69,7 @@ import { ModelSelectorComponent } from "./components/model-selector.js";
70
69
  import { OAuthAccountSelectorComponent } from "./components/oauth-account-selector.js";
71
70
  import { OAuthSelectorComponent } from "./components/oauth-selector.js";
72
71
  import { ScopedModelsSelectorComponent } from "./components/scoped-models-selector.js";
72
+ import { SessionFailureComponent } from "./components/session-failure.js";
73
73
  import { SessionSelectorComponent } from "./components/session-selector.js";
74
74
  import { SettingsSelectorComponent, ThinkingSelectorComponent } from "./components/settings-selector.js";
75
75
  import { SkillInvocationMessageComponent } from "./components/skill-invocation-message.js";
@@ -79,6 +79,9 @@ import { TreeSelectorComponent } from "./components/tree-selector.js";
79
79
  import { UserMessageComponent } from "./components/user-message.js";
80
80
  import { UserMessageSelectorComponent } from "./components/user-message-selector.js";
81
81
  import { getAvailableThemes, getAvailableThemesWithPaths, getEditorTheme, getMarkdownTheme, getThemeByName, initTheme, onThemeChange, setRegisteredThemes, setTheme, setThemeInstance, stopThemeWatcher, Theme, theme, } from "./theme/theme.js";
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);
82
85
  const DEAD_TERMINAL_ERROR_CODES = new Set(["EIO", "EPIPE", "ENOTCONN"]);
83
86
  /**
84
87
  * Pseudo-entry for the thinking selector/autocomplete representing auto mode.
@@ -134,6 +137,7 @@ export class InteractiveMode {
134
137
  // Stored so the same manager can be injected into custom editors, selectors, and extension UI.
135
138
  keybindings;
136
139
  version;
140
+ lastResourceReloadAt;
137
141
  isInitialized = false;
138
142
  onInputCallback;
139
143
  pendingPromptPayloads = [];
@@ -2422,8 +2426,8 @@ export class InteractiveMode {
2422
2426
  await this.handleReloadCommand();
2423
2427
  return;
2424
2428
  }
2425
- if (text === "/debug") {
2426
- this.handleDebugCommand();
2429
+ if (text === "/debug" || text.startsWith("/debug ")) {
2430
+ this.handleDebugCommand(text.slice("/debug".length).trim());
2427
2431
  this.editor.setText("");
2428
2432
  return;
2429
2433
  }
@@ -2869,13 +2873,22 @@ export class InteractiveMode {
2869
2873
  return textBlocks.map((c) => c.text).join("");
2870
2874
  }
2871
2875
  showSessionTermination(termination) {
2872
- 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)
2873
2884
  return;
2874
2885
  this.lastRenderedTermination = termination;
2875
2886
  // compaction_end owns the concise cancellation status; rendering this too duplicates it as a scary error.
2876
2887
  if (termination.causeCode === "compaction.aborted")
2877
2888
  return;
2878
- this.showError(formatSessionTermination(termination));
2889
+ this.chatContainer.addChild(new Spacer(1));
2890
+ this.chatContainer.addChild(new SessionFailureComponent(termination, this.toolOutputExpanded));
2891
+ this.ui.requestRender();
2879
2892
  }
2880
2893
  showPromptError(error, previousTermination) {
2881
2894
  const termination = this.session.lastTermination;
@@ -4775,6 +4788,7 @@ export class InteractiveMode {
4775
4788
  if (modelsJsonError) {
4776
4789
  this.showError(`models.json error: ${modelsJsonError}`);
4777
4790
  }
4791
+ this.lastResourceReloadAt = new Date().toISOString();
4778
4792
  this.showStatus("Reloaded keybindings, extensions, skills, prompts, themes");
4779
4793
  }
4780
4794
  catch (error) {
@@ -5273,31 +5287,31 @@ export class InteractiveMode {
5273
5287
  await this.handleFatalRuntimeError("Failed to create session", error);
5274
5288
  }
5275
5289
  }
5276
- handleDebugCommand() {
5277
- const width = this.ui.terminal.columns;
5278
- const height = this.ui.terminal.rows;
5279
- const allLines = this.ui.render(width);
5280
- const debugLogPath = getDebugLogPath();
5281
- const debugData = [
5282
- `Debug output at ${new Date().toISOString()}`,
5283
- `Terminal: ${width}x${height}`,
5284
- `Total lines: ${allLines.length}`,
5285
- "",
5286
- "=== All rendered lines with visible widths ===",
5287
- ...allLines.map((line, idx) => {
5288
- const vw = visibleWidth(line);
5289
- const escaped = JSON.stringify(line);
5290
- return `[${idx}] (w=${vw}) ${escaped}`;
5291
- }),
5292
- "",
5293
- "=== Agent messages (JSONL) ===",
5294
- ...this.session.messages.map((msg) => JSON.stringify(msg)),
5295
- "",
5296
- ].join("\n");
5297
- fs.mkdirSync(path.dirname(debugLogPath), { recursive: true });
5298
- 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
+ });
5299
5305
  this.chatContainer.addChild(new Spacer(1));
5300
- 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
+ }
5301
5315
  this.ui.requestRender();
5302
5316
  }
5303
5317
  handleArminSaysHi() {