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
@@ -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,EA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AAE,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;AAC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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
+ //# sourceMappingURL=tui-runtime-info.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tui-runtime-info.js","sourceRoot":"","sources":["../../../src/modes/interactive/tui-runtime-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5F,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAoB1C,SAAS,YAAY,CAAC,QAAuB,EAAiB;IAC7D,IA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7E,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
  ```
@@ -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
 
@@ -0,0 +1,84 @@
1
+ # Release audit: v0.98.5
2
+
3
+ Date: 2026-09-12. This records candidate preparation and verification, not proof of
4
+ semantic correctness, comparative performance or completed publication.
5
+
6
+ ## Scope and changelog audit
7
+
8
+ The candidate retains the public v0.98.4 ancestry and the committed implementation
9
+ range through `b84d0d9b8e`. The audit covers index-preserving Git checks, execution
10
+ ownership/shared budgets, protected verified runs and candidate recovery, input
11
+ checkpoint writer restart, static DAG retry, and TUI diagnostics. Tool timeout
12
+ messages now distinguish requested cancellation from observed termination and use
13
+ a monotonic teardown grace period.
14
+
15
+ Preparation adds release metadata, this audit, and focused verification fixes:
16
+ initial failure-card expansion is applied at construction, execution wrappers
17
+ preserve lazy context-sensitive timeouts, and the commit hook handles changed-file
18
+ status under Husky's errexit mode. Existing dirty provider, retry,
19
+ parallel-frontier, resource-label and TB changes are excluded.
20
+ Their working files are preserved, and their pending changelog entries stay out of
21
+ the candidate. Published v0.98.4 and earlier changelog bodies remain unchanged.
22
+ Model catalogs are reused rather than fetched or regenerated. Credentials, private
23
+ agent-home configuration and the user's running TUI are not changed.
24
+
25
+ ## Version and artifact contract
26
+
27
+ All seven public packages target 0.98.5: `open-multi-agent-kit`, `omk-ai`,
28
+ `omk-agent-core`, `omk-tui`, `omk-protocol`, `omk-adaptorch-wpl` and
29
+ `omk-book-to-skill`. Root/example manifests and locks, internal dependency ranges,
30
+ the book compiler's source version constant, CLI shrinkwrap and README pointers
31
+ are synchronized. External dependency versions and integrity values are unchanged.
32
+
33
+ The release candidate is selected by path/hunk and inspected as a complete staged
34
+ diff. Verification uses an isolated candidate, not the mixed working tree. Temporary
35
+ homes contain no provider credentials; live inference and benchmarks are not run.
36
+
37
+ ## Observed verification
38
+
39
+ - The diagnostics implementation passed type checking and 104 focused tests in its
40
+ staged snapshot. Its canonical installed launcher passed offline 120/80-column
41
+ inspection, save, failure, reload and quit checks without model prompts.
42
+ - Version preparation passed 13-manifest/root-lock parity, source-version tests,
43
+ book metadata tests and the canonical `omk --version` check for 0.98.5.
44
+ - The isolated candidate build and `npm run check` exited 0. Module-size and
45
+ import-cycle baselines were not raised.
46
+ - The final full offline run exited 0: 8,181 passed, 837 environment/live-condition
47
+ skips, no failures. Package passes were WPL 149, agent 870, AI 631, book compiler
48
+ 22, coding-agent 5,653, protocol 126 and TUI 730. Vitest workers were bounded at
49
+ four; the TUI package used its Node test runner.
50
+ - Seven-package npm pack dry runs and release-surface checks passed. They checked
51
+ package version/file metadata without publication or lifecycle scripts.
52
+ - Gitleaks found no leaks in the staged changes or the six implementation commits
53
+ since v0.98.4. Reports were redacted; this is not clearance for private histories
54
+ outside that range.
55
+
56
+ ## Verification repairs
57
+
58
+ The isolated candidate exposed a two-line module-size overrun that the mixed tree
59
+ hid. Passing initial expansion to the failure-card constructor avoids a redundant
60
+ rebuild and keeps the existing size baseline; both initial states are tested.
61
+
62
+ The full suite exposed an execution wrapper spreading a tool's dynamic timeout
63
+ getter into a fixed value. The wrapper now projects tool metadata and forwards
64
+ that getter lazily. Regression checks cover no eager evaluation, timeout changes,
65
+ stale-context rejection and retained execution metadata.
66
+
67
+ The commit hook had only been tested under plain `sh`, while Husky invokes `sh -e`.
68
+ A changed-file `git diff --quiet` status of 1 therefore stopped valid release
69
+ commits. Capturing that status in an OR-list preserves errexit for real failures;
70
+ all six hook fixtures now run under `sh -e`, including changed paths with spaces,
71
+ index preservation and a fatal git-diff error.
72
+
73
+ An initial test launch resolved to the wrong checkout and was cancelled, not counted
74
+ as candidate evidence. Subsequent launches fix both process cwd and npm prefix.
75
+ An isolated HOME also hid the installed Rust toolchain: explicitly supplying its
76
+ location restored the real cargo diagnostic check without changing the test or
77
+ copying credentials. Neither fixture failure was treated as a product pass.
78
+
79
+ A source-file fingerprint is not an executed-build attestation. Linux observations
80
+ do not establish behavior on every target platform. CI must validate the exact tag,
81
+ build the six platform archives, run checks/tests, publish all seven npm packages
82
+ and create the GitHub Release. Existing token-based CI authentication is unchanged;
83
+ OIDC/Sigstore provenance is not claimed. Publication is complete only when the main
84
+ tag, GitHub Release and seven npm `latest` values agree.
@@ -6,7 +6,7 @@ The OMK Run Protocol defines one versioned contract for task execution and evalu
6
6
  TaskSpec -> ExecutionAttempt -> Observation -> EvaluationResult -> RuntimeDecision
7
7
  ```
8
8
 
9
- `omk-protocol` owns these records and the pure reducers that connect them. Tool execution, persistence, scheduling, routing, and topology remain outside the package.
9
+ `omk-protocol` owns these records and the pure reducers that connect them. Tool execution, persistence, runtime scheduling, routing, and topology selection remain outside the package.
10
10
 
11
11
  ## Implemented scope
12
12
 
@@ -24,6 +24,38 @@ The first v1 slice is available under `packages/protocol` with schema version `o
24
24
 
25
25
  Every top-level record carries `schemaVersion`. Parsers reject unsupported versions, malformed timestamps, duplicate claim IDs, invalid JSON facts, and empty logical conditions.
26
26
 
27
+ ## Isolated command-run profile
28
+
29
+ `RunContract` and `RunStartCommand` add strict, immutable parsers for the opt-in
30
+ `linux-command-v1` and `linux-scripted-agent-v1` profiles. They pin the input digest,
31
+ write scope, commands, stdout assertions and finite phase/snapshot limits. The
32
+ scripted profile also pins 1–16 approved steps and a 1–32 logical request cap for
33
+ an offline AgentSession reference adapter. Unknown authority/provider fields are
34
+ rejected; the host must separately authorize the exact contract digest.
35
+ `RunResumeCommand` / `parseRunResumeCommand()` pin the contract, candidate and exact
36
+ expected revision/generation. The host may acquire at most three generations under
37
+ `MAX_VERIFIED_RUN_GENERATIONS`; a resume command does not authorize replay of a writer.
38
+ The separate `RunWriterRestartCommand` / `parseRunWriterRestartCommand()` binds
39
+ `baseDigest` to a durable input checkpoint for an explicit local writer restart.
40
+ Recovery commands share command IDs and the generation cap; none resets budgets.
41
+
42
+ `linux-command-dag-v1` adds `RunDagWriter` / `RunDagTask` with 1–16 nodes, explicit
43
+ artifact dependencies, disjoint write scopes and 1–2 preapproved command attempts per
44
+ node. `orderRunDag()` provides deterministic FIFO topological order and
45
+ `runDagAncestors()` includes the full transitive input closure. `RunTaskRetryCommand`
46
+ / `parseRunTaskRetryCommand()` pins a task selection to the original input and exact
47
+ run revision/generation. These pure contracts never authorize dispatch or authenticate
48
+ cached output; the Coordinator checks stored material and records adoption before reuse.
49
+
50
+ The coding-agent's `RunCoordinator` owns execution and its separate v2 journal.
51
+ It binds native v3 receipt cores to the candidate through a supervisor attestation,
52
+ then supplies authenticated checks to the existing claim-closure reducer.
53
+ This does not replace the task/attempt/evaluation contracts or add execution to
54
+ this package. See [Verified Run](verified-run.md) for the implemented CLI/SDK
55
+ path, candidate recovery and checkpoint-based local writer restart, plus the
56
+ serial command DAG and selective retry, plus remaining live-model, parallel frontier,
57
+ plan amendment and control-surface work.
58
+
27
59
  ## Durable goal lifecycle
28
60
 
29
61
  A durable goal is working-directory state, not a session-file field or a `TaskSpec`. `/goal <objective>` creates or edits `.omk/goals/current.json`; `/goal` without arguments shows its status and round count.
@@ -1,5 +1,31 @@
1
1
  # Runtime Algorithms and Direction
2
2
 
3
+ ## Working-tree shared run budgets
4
+
5
+ The SDK `prompt(..., { runBudget })` path now shares a monotonic deadline and
6
+ logical request/concurrency limits across the active prompt's main stream,
7
+ retries, continuations, and first-party summaries using that stream. Exhaustion
8
+ is a non-retryable `budget_exhausted` termination; snapshots keep outstanding
9
+ streams until terminal metadata arrives. No request/time budget is imposed by
10
+ default. Preflight is now owned even for unbounded prompts; unresolved streams
11
+ block a later prompt instead of being discarded when their budget scope closes.
12
+ See [Shared run budgets](sdk.md#shared-run-budgets-sdk-opt-in) for units, zero
13
+ semantics, cancellation, and uncovered paths. This is not billing enforcement,
14
+ a persisted budget, or a hard process-termination deadline.
15
+
16
+ ## Working-tree execution ownership (2026-09-10)
17
+
18
+ The live session now retains registered tool-promise ownership after timeout or
19
+ abort, defers prompt settlement/resource-lease release until actual termination,
20
+ and rejects overlapping prompt admission. Shared permits capture request values,
21
+ honor zero capacity, and wake FIFO followers after head cancellation/expiry.
22
+ The internal lane launcher forwards cancellation and respects zero/heavy caps.
23
+ Independent bash calls now own separate cancellation controllers, and one call's
24
+ completion cannot hide another active call. Core teardown waits use a monotonic
25
+ clock, preserving the existing grace interval across wall-clock changes.
26
+ See [Prompt settlement](sdk.md#prompt-settlement) for tests, compatibility, and
27
+ uncovered paths. These changes do not implement a durable verified-run product.
28
+
3
29
  ## v0.98.3 release delta (2026-09-06)
4
30
 
5
31
  The explicit advisory SDK requires normal first-party model completion, honors cancellation,