agent-nuvira 3.3.3 → 3.3.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 (366) hide show
  1. package/README.md +13 -5
  2. package/dist/agent-sdk/src/agent.d.ts +2 -0
  3. package/dist/agent-sdk/src/agent.d.ts.map +1 -1
  4. package/dist/agent-sdk/src/define.d.ts +64 -0
  5. package/dist/agent-sdk/src/define.d.ts.map +1 -0
  6. package/dist/agent-sdk/src/define.js +76 -0
  7. package/dist/agent-sdk/src/define.js.map +1 -0
  8. package/dist/agent-sdk/src/index.d.ts +9 -0
  9. package/dist/agent-sdk/src/index.d.ts.map +1 -1
  10. package/dist/agent-sdk/src/index.js +9 -0
  11. package/dist/agent-sdk/src/index.js.map +1 -1
  12. package/dist/agent-sdk/src/scaffold.d.ts +11 -0
  13. package/dist/agent-sdk/src/scaffold.d.ts.map +1 -1
  14. package/dist/agent-sdk/src/scaffold.js +16 -6
  15. package/dist/agent-sdk/src/scaffold.js.map +1 -1
  16. package/dist/agents/long-form-plan.d.ts.map +1 -1
  17. package/dist/agents/long-form-plan.js +2 -1
  18. package/dist/agents/long-form-plan.js.map +1 -1
  19. package/dist/agents/orchestrator.d.ts.map +1 -1
  20. package/dist/agents/orchestrator.js +5 -4
  21. package/dist/agents/orchestrator.js.map +1 -1
  22. package/dist/cli/agent.d.ts +2 -2
  23. package/dist/cli/agent.js +10 -10
  24. package/dist/cli/chat.d.ts +94 -0
  25. package/dist/cli/chat.d.ts.map +1 -1
  26. package/dist/cli/chat.js +354 -20
  27. package/dist/cli/chat.js.map +1 -1
  28. package/dist/cli/cli-program.d.ts.map +1 -1
  29. package/dist/cli/cli-program.js +5 -0
  30. package/dist/cli/cli-program.js.map +1 -1
  31. package/dist/cli/config.d.ts.map +1 -1
  32. package/dist/cli/config.js +9 -1
  33. package/dist/cli/config.js.map +1 -1
  34. package/dist/cli/doctor.d.ts.map +1 -1
  35. package/dist/cli/doctor.js +3 -2
  36. package/dist/cli/doctor.js.map +1 -1
  37. package/dist/cli/edit.js +2 -2
  38. package/dist/cli/eval.d.ts +17 -0
  39. package/dist/cli/eval.d.ts.map +1 -1
  40. package/dist/cli/eval.js +105 -2
  41. package/dist/cli/eval.js.map +1 -1
  42. package/dist/cli/execute.d.ts +16 -1
  43. package/dist/cli/execute.d.ts.map +1 -1
  44. package/dist/cli/execute.js +192 -22
  45. package/dist/cli/execute.js.map +1 -1
  46. package/dist/cli/loop-executor.d.ts +55 -0
  47. package/dist/cli/loop-executor.d.ts.map +1 -1
  48. package/dist/cli/loop-executor.js +212 -13
  49. package/dist/cli/loop-executor.js.map +1 -1
  50. package/dist/cli/model.d.ts.map +1 -1
  51. package/dist/cli/model.js +9 -8
  52. package/dist/cli/model.js.map +1 -1
  53. package/dist/cli/models.d.ts +1 -1
  54. package/dist/cli/models.js +4 -4
  55. package/dist/cli/parity.d.ts +85 -0
  56. package/dist/cli/parity.d.ts.map +1 -0
  57. package/dist/cli/parity.js +506 -0
  58. package/dist/cli/parity.js.map +1 -0
  59. package/dist/cli/plan.d.ts.map +1 -1
  60. package/dist/cli/plan.js +2 -1
  61. package/dist/cli/plan.js.map +1 -1
  62. package/dist/cli/retrieval.d.ts.map +1 -1
  63. package/dist/cli/retrieval.js +5 -4
  64. package/dist/cli/retrieval.js.map +1 -1
  65. package/dist/cli/sdk.js +4 -4
  66. package/dist/cli/sdk.js.map +1 -1
  67. package/dist/cli/trace.d.ts.map +1 -1
  68. package/dist/cli/trace.js +2 -1
  69. package/dist/cli/trace.js.map +1 -1
  70. package/dist/cli/workflow.js +2 -2
  71. package/dist/cli/workflow.js.map +1 -1
  72. package/dist/config/process-env.d.ts +136 -0
  73. package/dist/config/process-env.d.ts.map +1 -0
  74. package/dist/config/process-env.js +217 -0
  75. package/dist/config/process-env.js.map +1 -0
  76. package/dist/config/types.d.ts +44 -0
  77. package/dist/config/types.d.ts.map +1 -1
  78. package/dist/findings/verdicts.d.ts +241 -0
  79. package/dist/findings/verdicts.d.ts.map +1 -0
  80. package/dist/findings/verdicts.js +284 -0
  81. package/dist/findings/verdicts.js.map +1 -0
  82. package/dist/gateway/adapters.d.ts +65 -0
  83. package/dist/gateway/adapters.d.ts.map +1 -1
  84. package/dist/gateway/adapters.js +216 -10
  85. package/dist/gateway/adapters.js.map +1 -1
  86. package/dist/gateway/channel-directory.d.ts +31 -0
  87. package/dist/gateway/channel-directory.d.ts.map +1 -1
  88. package/dist/gateway/channel-directory.js +40 -0
  89. package/dist/gateway/channel-directory.js.map +1 -1
  90. package/dist/gateway/gateway-log.d.ts +1 -1
  91. package/dist/gateway/gateway-log.d.ts.map +1 -1
  92. package/dist/gateway/gateway-log.js.map +1 -1
  93. package/dist/gateway/hooks.d.ts +87 -19
  94. package/dist/gateway/hooks.d.ts.map +1 -1
  95. package/dist/gateway/hooks.js +62 -23
  96. package/dist/gateway/hooks.js.map +1 -1
  97. package/dist/gateway/inbound-media.d.ts +147 -0
  98. package/dist/gateway/inbound-media.d.ts.map +1 -0
  99. package/dist/gateway/inbound-media.js +317 -0
  100. package/dist/gateway/inbound-media.js.map +1 -0
  101. package/dist/gateway/inbox.d.ts +8 -1
  102. package/dist/gateway/inbox.d.ts.map +1 -1
  103. package/dist/gateway/inbox.js.map +1 -1
  104. package/dist/gateway/platform-config.d.ts +14 -0
  105. package/dist/gateway/platform-config.d.ts.map +1 -1
  106. package/dist/gateway/platform-config.js +26 -8
  107. package/dist/gateway/platform-config.js.map +1 -1
  108. package/dist/gateway/realtime.d.ts +114 -0
  109. package/dist/gateway/realtime.d.ts.map +1 -0
  110. package/dist/gateway/realtime.js +402 -0
  111. package/dist/gateway/realtime.js.map +1 -0
  112. package/dist/gateway/registry.d.ts +31 -0
  113. package/dist/gateway/registry.d.ts.map +1 -1
  114. package/dist/gateway/registry.js +224 -4
  115. package/dist/gateway/registry.js.map +1 -1
  116. package/dist/gateway/whatsapp/baileys-bridge.d.ts +11 -1
  117. package/dist/gateway/whatsapp/baileys-bridge.d.ts.map +1 -1
  118. package/dist/gateway/whatsapp/baileys-bridge.js +123 -4
  119. package/dist/gateway/whatsapp/baileys-bridge.js.map +1 -1
  120. package/dist/gateway/whatsapp/bridge.d.ts +6 -2
  121. package/dist/gateway/whatsapp/bridge.d.ts.map +1 -1
  122. package/dist/gateway/whatsapp/bridge.js.map +1 -1
  123. package/dist/index.js +8 -0
  124. package/dist/index.js.map +1 -1
  125. package/dist/inference/factory.d.ts +14 -0
  126. package/dist/inference/factory.d.ts.map +1 -1
  127. package/dist/inference/factory.js +17 -0
  128. package/dist/inference/factory.js.map +1 -1
  129. package/dist/inference/groq-adapter.d.ts +2 -0
  130. package/dist/inference/groq-adapter.d.ts.map +1 -1
  131. package/dist/inference/groq-adapter.js +16 -6
  132. package/dist/inference/groq-adapter.js.map +1 -1
  133. package/dist/inference/tools.d.ts.map +1 -1
  134. package/dist/inference/tools.js +29 -0
  135. package/dist/inference/tools.js.map +1 -1
  136. package/dist/learning/benchmark.d.ts.map +1 -1
  137. package/dist/learning/benchmark.js +3 -2
  138. package/dist/learning/benchmark.js.map +1 -1
  139. package/dist/learning/continuation.d.ts.map +1 -1
  140. package/dist/learning/continuation.js +2 -1
  141. package/dist/learning/continuation.js.map +1 -1
  142. package/dist/learning/cost-tracker.d.ts.map +1 -1
  143. package/dist/learning/cost-tracker.js +2 -1
  144. package/dist/learning/cost-tracker.js.map +1 -1
  145. package/dist/learning/deferred-task.d.ts.map +1 -1
  146. package/dist/learning/deferred-task.js +13 -4
  147. package/dist/learning/deferred-task.js.map +1 -1
  148. package/dist/learning/eval-framework.d.ts.map +1 -1
  149. package/dist/learning/eval-framework.js +2 -1
  150. package/dist/learning/eval-framework.js.map +1 -1
  151. package/dist/learning/long-form.d.ts.map +1 -1
  152. package/dist/learning/long-form.js +2 -1
  153. package/dist/learning/long-form.js.map +1 -1
  154. package/dist/learning/model-reachability.d.ts +95 -0
  155. package/dist/learning/model-reachability.d.ts.map +1 -0
  156. package/dist/learning/model-reachability.js +111 -0
  157. package/dist/learning/model-reachability.js.map +1 -0
  158. package/dist/learning/model-registry.d.ts +22 -0
  159. package/dist/learning/model-registry.d.ts.map +1 -1
  160. package/dist/learning/model-registry.js +26 -1
  161. package/dist/learning/model-registry.js.map +1 -1
  162. package/dist/learning/model-verify-job.d.ts +131 -0
  163. package/dist/learning/model-verify-job.d.ts.map +1 -0
  164. package/dist/learning/model-verify-job.js +221 -0
  165. package/dist/learning/model-verify-job.js.map +1 -0
  166. package/dist/learning/reasoning-cache.d.ts.map +1 -1
  167. package/dist/learning/reasoning-cache.js +2 -1
  168. package/dist/learning/reasoning-cache.js.map +1 -1
  169. package/dist/learning/reasoning-trace.d.ts +37 -1
  170. package/dist/learning/reasoning-trace.d.ts.map +1 -1
  171. package/dist/learning/reasoning-trace.js +66 -0
  172. package/dist/learning/reasoning-trace.js.map +1 -1
  173. package/dist/learning/resilient-call.d.ts.map +1 -1
  174. package/dist/learning/resilient-call.js +2 -1
  175. package/dist/learning/resilient-call.js.map +1 -1
  176. package/dist/learning/retrieval.d.ts.map +1 -1
  177. package/dist/learning/retrieval.js +2 -1
  178. package/dist/learning/retrieval.js.map +1 -1
  179. package/dist/learning/seeded-benchmark.d.ts +160 -0
  180. package/dist/learning/seeded-benchmark.d.ts.map +1 -0
  181. package/dist/learning/seeded-benchmark.js +321 -0
  182. package/dist/learning/seeded-benchmark.js.map +1 -0
  183. package/dist/learning/seeded-bugs.d.ts +142 -0
  184. package/dist/learning/seeded-bugs.d.ts.map +1 -0
  185. package/dist/learning/seeded-bugs.js +535 -0
  186. package/dist/learning/seeded-bugs.js.map +1 -0
  187. package/dist/learning/step-checkpoint.d.ts +127 -0
  188. package/dist/learning/step-checkpoint.d.ts.map +1 -0
  189. package/dist/learning/step-checkpoint.js +244 -0
  190. package/dist/learning/step-checkpoint.js.map +1 -0
  191. package/dist/nlu/intent-confirm.d.ts +23 -1
  192. package/dist/nlu/intent-confirm.d.ts.map +1 -1
  193. package/dist/nlu/intent-confirm.js +85 -2
  194. package/dist/nlu/intent-confirm.js.map +1 -1
  195. package/dist/nlu/learnings.d.ts +7 -0
  196. package/dist/nlu/learnings.d.ts.map +1 -1
  197. package/dist/nlu/learnings.js +7 -0
  198. package/dist/nlu/learnings.js.map +1 -1
  199. package/dist/observability/debug-log.d.ts +250 -0
  200. package/dist/observability/debug-log.d.ts.map +1 -0
  201. package/dist/observability/debug-log.js +500 -0
  202. package/dist/observability/debug-log.js.map +1 -0
  203. package/dist/observability/event-bus.d.ts.map +1 -1
  204. package/dist/observability/event-bus.js +4 -1
  205. package/dist/observability/event-bus.js.map +1 -1
  206. package/dist/observability/otel.d.ts +278 -0
  207. package/dist/observability/otel.d.ts.map +1 -0
  208. package/dist/observability/otel.js +590 -0
  209. package/dist/observability/otel.js.map +1 -0
  210. package/dist/parity/drivers.d.ts +99 -0
  211. package/dist/parity/drivers.d.ts.map +1 -0
  212. package/dist/parity/drivers.js +1362 -0
  213. package/dist/parity/drivers.js.map +1 -0
  214. package/dist/parity/graph.d.ts +73 -0
  215. package/dist/parity/graph.d.ts.map +1 -0
  216. package/dist/parity/graph.js +162 -0
  217. package/dist/parity/graph.js.map +1 -0
  218. package/dist/parity/matrix.d.ts +105 -0
  219. package/dist/parity/matrix.d.ts.map +1 -0
  220. package/dist/parity/matrix.js +352 -0
  221. package/dist/parity/matrix.js.map +1 -0
  222. package/dist/parity/observation.d.ts +444 -0
  223. package/dist/parity/observation.d.ts.map +1 -0
  224. package/dist/parity/observation.js +333 -0
  225. package/dist/parity/observation.js.map +1 -0
  226. package/dist/parity/scenarios.d.ts +229 -0
  227. package/dist/parity/scenarios.d.ts.map +1 -0
  228. package/dist/parity/scenarios.js +175 -0
  229. package/dist/parity/scenarios.js.map +1 -0
  230. package/dist/parity/surfaces.d.ts +122 -0
  231. package/dist/parity/surfaces.d.ts.map +1 -0
  232. package/dist/parity/surfaces.js +190 -0
  233. package/dist/parity/surfaces.js.map +1 -0
  234. package/dist/runtime/fault-injection.d.ts +173 -0
  235. package/dist/runtime/fault-injection.d.ts.map +1 -0
  236. package/dist/runtime/fault-injection.js +281 -0
  237. package/dist/runtime/fault-injection.js.map +1 -0
  238. package/dist/tools/child-agent-entry.d.ts +23 -0
  239. package/dist/tools/child-agent-entry.d.ts.map +1 -0
  240. package/dist/tools/child-agent-entry.js +129 -0
  241. package/dist/tools/child-agent-entry.js.map +1 -0
  242. package/dist/tools/child-agent-runtime.d.ts +124 -0
  243. package/dist/tools/child-agent-runtime.d.ts.map +1 -0
  244. package/dist/tools/child-agent-runtime.js +704 -0
  245. package/dist/tools/child-agent-runtime.js.map +1 -0
  246. package/dist/tools/coding-tools.d.ts.map +1 -1
  247. package/dist/tools/coding-tools.js +82 -10
  248. package/dist/tools/coding-tools.js.map +1 -1
  249. package/dist/tools/delegation-system.d.ts +31 -0
  250. package/dist/tools/delegation-system.d.ts.map +1 -1
  251. package/dist/tools/delegation-system.js +70 -9
  252. package/dist/tools/delegation-system.js.map +1 -1
  253. package/dist/tools/extract/docx.d.ts +27 -0
  254. package/dist/tools/extract/docx.d.ts.map +1 -0
  255. package/dist/tools/extract/docx.js +48 -0
  256. package/dist/tools/extract/docx.js.map +1 -0
  257. package/dist/tools/extract/html-text.d.ts +27 -0
  258. package/dist/tools/extract/html-text.d.ts.map +1 -0
  259. package/dist/tools/extract/html-text.js +86 -0
  260. package/dist/tools/extract/html-text.js.map +1 -0
  261. package/dist/tools/extract/pdf-ocr.d.ts +58 -0
  262. package/dist/tools/extract/pdf-ocr.d.ts.map +1 -0
  263. package/dist/tools/extract/pdf-ocr.js +116 -0
  264. package/dist/tools/extract/pdf-ocr.js.map +1 -0
  265. package/dist/tools/extract/pdf.d.ts +65 -0
  266. package/dist/tools/extract/pdf.d.ts.map +1 -0
  267. package/dist/tools/extract/pdf.js +197 -0
  268. package/dist/tools/extract/pdf.js.map +1 -0
  269. package/dist/tools/extract/pptx.d.ts +32 -0
  270. package/dist/tools/extract/pptx.d.ts.map +1 -0
  271. package/dist/tools/extract/pptx.js +77 -0
  272. package/dist/tools/extract/pptx.js.map +1 -0
  273. package/dist/tools/extract/xlsx.d.ts +47 -0
  274. package/dist/tools/extract/xlsx.d.ts.map +1 -0
  275. package/dist/tools/extract/xlsx.js +111 -0
  276. package/dist/tools/extract/xlsx.js.map +1 -0
  277. package/dist/tools/finding-tool.d.ts +76 -0
  278. package/dist/tools/finding-tool.d.ts.map +1 -0
  279. package/dist/tools/finding-tool.js +125 -0
  280. package/dist/tools/finding-tool.js.map +1 -0
  281. package/dist/tools/messaging-tools.d.ts +41 -11
  282. package/dist/tools/messaging-tools.d.ts.map +1 -1
  283. package/dist/tools/messaging-tools.js +104 -55
  284. package/dist/tools/messaging-tools.js.map +1 -1
  285. package/dist/tools/neutts-synth.d.ts +27 -3
  286. package/dist/tools/neutts-synth.d.ts.map +1 -1
  287. package/dist/tools/neutts-synth.js +57 -13
  288. package/dist/tools/neutts-synth.js.map +1 -1
  289. package/dist/tools/pipeline-tool.d.ts +43 -1
  290. package/dist/tools/pipeline-tool.d.ts.map +1 -1
  291. package/dist/tools/pipeline-tool.js +13 -2
  292. package/dist/tools/pipeline-tool.js.map +1 -1
  293. package/dist/tools/read-extract.d.ts +116 -45
  294. package/dist/tools/read-extract.d.ts.map +1 -1
  295. package/dist/tools/read-extract.js +494 -158
  296. package/dist/tools/read-extract.js.map +1 -1
  297. package/dist/tools/registry.d.ts +2 -2
  298. package/dist/tools/registry.d.ts.map +1 -1
  299. package/dist/tools/registry.js +152 -23
  300. package/dist/tools/registry.js.map +1 -1
  301. package/dist/tools/subagent-refusal.d.ts +15 -0
  302. package/dist/tools/subagent-refusal.d.ts.map +1 -0
  303. package/dist/tools/subagent-refusal.js +18 -0
  304. package/dist/tools/subagent-refusal.js.map +1 -0
  305. package/dist/tools/subagent-spawner.d.ts +122 -0
  306. package/dist/tools/subagent-spawner.d.ts.map +1 -1
  307. package/dist/tools/subagent-spawner.js +249 -28
  308. package/dist/tools/subagent-spawner.js.map +1 -1
  309. package/dist/tools/tool-hooks.d.ts +177 -0
  310. package/dist/tools/tool-hooks.d.ts.map +1 -0
  311. package/dist/tools/tool-hooks.js +427 -0
  312. package/dist/tools/tool-hooks.js.map +1 -0
  313. package/dist/tools/tool-loop.d.ts +82 -0
  314. package/dist/tools/tool-loop.d.ts.map +1 -1
  315. package/dist/tools/tool-loop.js +167 -9
  316. package/dist/tools/tool-loop.js.map +1 -1
  317. package/dist/tools/tool-refusal.d.ts +68 -0
  318. package/dist/tools/tool-refusal.d.ts.map +1 -0
  319. package/dist/tools/tool-refusal.js +78 -0
  320. package/dist/tools/tool-refusal.js.map +1 -0
  321. package/dist/tools/toolsets.d.ts +8 -0
  322. package/dist/tools/toolsets.d.ts.map +1 -1
  323. package/dist/tools/toolsets.js +12 -2
  324. package/dist/tools/toolsets.js.map +1 -1
  325. package/dist/tools/vision-tools.d.ts +88 -83
  326. package/dist/tools/vision-tools.d.ts.map +1 -1
  327. package/dist/tools/vision-tools.js +134 -103
  328. package/dist/tools/vision-tools.js.map +1 -1
  329. package/dist/tools/worktree.d.ts +210 -0
  330. package/dist/tools/worktree.d.ts.map +1 -0
  331. package/dist/tools/worktree.js +374 -0
  332. package/dist/tools/worktree.js.map +1 -0
  333. package/dist/utils/format.d.ts +3 -0
  334. package/dist/utils/format.d.ts.map +1 -0
  335. package/dist/utils/format.js +32 -0
  336. package/dist/utils/format.js.map +1 -0
  337. package/dist/web-dashboard/attachment-extract.d.ts +64 -0
  338. package/dist/web-dashboard/attachment-extract.d.ts.map +1 -0
  339. package/dist/web-dashboard/attachment-extract.js +154 -0
  340. package/dist/web-dashboard/attachment-extract.js.map +1 -0
  341. package/dist/web-dashboard/chat-console.d.ts +108 -1
  342. package/dist/web-dashboard/chat-console.d.ts.map +1 -1
  343. package/dist/web-dashboard/chat-console.js +36 -0
  344. package/dist/web-dashboard/chat-console.js.map +1 -1
  345. package/dist/web-dashboard/hub-data.d.ts +37 -0
  346. package/dist/web-dashboard/hub-data.d.ts.map +1 -1
  347. package/dist/web-dashboard/hub-data.js +61 -1
  348. package/dist/web-dashboard/hub-data.js.map +1 -1
  349. package/dist/web-dashboard/process-env-inventory.d.ts +57 -0
  350. package/dist/web-dashboard/process-env-inventory.d.ts.map +1 -0
  351. package/dist/web-dashboard/process-env-inventory.js +96 -0
  352. package/dist/web-dashboard/process-env-inventory.js.map +1 -0
  353. package/dist/web-dashboard/server.d.ts +14 -0
  354. package/dist/web-dashboard/server.d.ts.map +1 -1
  355. package/dist/web-dashboard/server.js +493 -30
  356. package/dist/web-dashboard/server.js.map +1 -1
  357. package/dist/web-dashboard/src/types.d.ts +261 -48
  358. package/dist/web-dashboard/src/types.d.ts.map +1 -1
  359. package/package.json +18 -3
  360. package/src/web-dashboard/public/assets/{index-Cyd6tIew.css → index-CIJ6FHHZ.css} +1 -1
  361. package/src/web-dashboard/public/assets/index-CsySzR41.js +207 -0
  362. package/src/web-dashboard/public/assets/index-CsySzR41.js.map +1 -0
  363. package/src/web-dashboard/public/index.html +2 -2
  364. package/dist/tools/child-agent-worker.js +0 -212
  365. package/src/web-dashboard/public/assets/index-CxDj7p6i.js +0 -207
  366. package/src/web-dashboard/public/assets/index-CxDj7p6i.js.map +0 -1
@@ -0,0 +1,250 @@
1
+ /**
2
+ * WS2 (#24) — the session debug log you attach to a bug report.
3
+ *
4
+ * WHY THIS EXISTS, and what it is NOT. This repository's bug reports keep
5
+ * arriving as prose: "the dashboard did not answer", "the gateway sent the
6
+ * wrong thing", "it worked yesterday". Every one of them is then re-litigated
7
+ * by reading code, because the failing run left nothing behind that records
8
+ * WHICH BACKEND SERVED IT. The trace store (`learning/reasoning-trace.ts`) is
9
+ * the audit of what the MODEL was asked; the DAG bridge and the gateway log are
10
+ * per-surface records. None of them is the thing a user can attach to a bug
11
+ * report, and none of them is reachable the same way from all five surfaces.
12
+ *
13
+ * So a session debug log is deliberately boring: a plain-text file, ordered,
14
+ * with a header that names the surface and THE BACKEND — provider, model,
15
+ * transport, engine — before a single line of detail. If a bug report can only
16
+ * carry one thing, that header is the thing that makes it actionable.
17
+ *
18
+ * FOUR RULES, each closing a way a debug log becomes worse than none:
19
+ *
20
+ * 1. OPT-IN, AND CHEAP WHEN OFF. `NUVIRA_DEBUG_LOG=1` turns it on; with it off
21
+ * `sessionDebugLog()` returns `null` and every call site's `?.` makes the
22
+ * cost one boolean check. A logging path that is on by default is a disk
23
+ * leak and a privacy hazard wearing a helpful face.
24
+ *
25
+ * 2. REDACTED BY CONSTRUCTION. A log we ask a user to attach to a bug report
26
+ * is a log that will be pasted into an issue tracker. Every event line is
27
+ * scrubbed with the SAME `scrubSecrets` the gateway log uses (reused, not
28
+ * re-implemented: two regex lists drift, and the one that drifts is the one
29
+ * that leaks). The header carries the backend and versions — never a key.
30
+ *
31
+ * 3. BOUNDED. Events are capped, each line is truncated to a preview, and the
32
+ * file is capped by bytes. An instrument must never be the reason a run
33
+ * dies, and a nightly-failing turn must not fill a disk.
34
+ *
35
+ * 4. WRITTEN ONCE, AT CLOSE. The header has to name the backend that served
36
+ * the turn, and the backend is only known at the end (the loop may fail
37
+ * over between providers). So events buffer in memory and `write()`
38
+ * produces the whole file — header first — at the end of the turn. That
39
+ * also means a crashed process leaves NO half-written log, which is the
40
+ * honest outcome: a log whose header lies about the backend is worse than
41
+ * no log.
42
+ *
43
+ * The five surfaces each open one at their own turn seam (`cli/chat.ts`,
44
+ * `cli/loop-executor.ts`, `tools/child-agent-runtime.ts`, with the dashboard
45
+ * console and the gateway passing their identity down to the shared chat
46
+ * engine), and the parity harness reads the file back and asserts every
47
+ * surface's header names the SAME backend — the capability
48
+ * `debug-log@<surface>` is proved against.
49
+ *
50
+ * A log that a surface wrote into a directory the user has to find is only half
51
+ * the artifact. So a surface that HAS a conversation identity records it
52
+ * (`session`), which turns the file from readable into FINDABLE: the dashboard
53
+ * server can answer "the bundle for this chat" by looking up the logs whose
54
+ * header names that conversation, instead of guessing from timestamps and
55
+ * handing over someone else's. A surface with no such identity (the CLI's
56
+ * one-shot path) records nothing rather than inventing an id.
57
+ */
58
+ /** The env var that turns session debug logging on (`NUVIRA_DEBUG_LOG=1`). */
59
+ export declare const DEBUG_LOG_ENV = "DEBUG_LOG";
60
+ /** Optional directory override for the log files (`NUVIRA_DEBUG_LOG_DIR`). */
61
+ export declare const DEBUG_LOG_DIR_ENV = "DEBUG_LOG_DIR";
62
+ /** Hard cap on the written file. Bounded on purpose — see rule 3 above. */
63
+ export declare const DEBUG_LOG_MAX_BYTES: number;
64
+ /** Per-line detail preview cap. Never the whole payload. */
65
+ export declare const DEBUG_LOG_PREVIEW_CHARS = 300;
66
+ /** Event cap. Beyond it the OLDEST events are dropped, and the count is stated. */
67
+ export declare const DEBUG_LOG_MAX_EVENTS = 2000;
68
+ /** Cap on a session id as a FILENAME component, so a long id cannot fail a write. */
69
+ export declare const DEBUG_LOG_SESSION_CHARS = 48;
70
+ /** The backend that served a turn — the fact the header exists to carry. */
71
+ export interface DebugLogBackend {
72
+ provider?: string | null;
73
+ model?: string | null;
74
+ /** Tool transport: `native` / `json` / `none`. */
75
+ transport?: string | null;
76
+ /** The engine label the surface ran under (`loop` / `pipeline`). */
77
+ engine?: string | null;
78
+ }
79
+ /**
80
+ * The parsed header. Every field is present (null when the surface never
81
+ * learned it), so a reader can tell "not reported" apart from "reading failed".
82
+ */
83
+ export interface DebugLogHeader {
84
+ surface: string | null;
85
+ /**
86
+ * The chat/thread this turn belonged to, when the surface has one.
87
+ *
88
+ * This is what makes a log findable rather than merely readable: the dashboard
89
+ * cannot serve "the log for the conversation I am looking at" unless the log
90
+ * says which conversation it was. Null for a surface with no such identity —
91
+ * an absent id is honest, a fabricated one is not.
92
+ */
93
+ session: string | null;
94
+ engine: string | null;
95
+ provider: string | null;
96
+ model: string | null;
97
+ transport: string | null;
98
+ /** The agent-nuvira version that wrote the log. */
99
+ version: string | null;
100
+ startedAt: number | null;
101
+ /** The writing process — a forked subagent has its own, and that matters. */
102
+ pid: number | null;
103
+ platform: string | null;
104
+ }
105
+ /** One log file on disk, with its parsed header when it could be read. */
106
+ export interface DebugLogFile {
107
+ path: string;
108
+ /** Null when the file is unreadable or its header is malformed. */
109
+ header: DebugLogHeader | null;
110
+ }
111
+ /**
112
+ * Is session debug logging on?
113
+ *
114
+ * `NUVIRA_DEBUG_LOG` (or legacy `BUFF_DEBUG_LOG`) set to anything other than
115
+ * `0` / `false` / `off` enables it. Deliberately not "truthy string" only: a
116
+ * user who writes `NUVIRA_DEBUG_LOG=false` in an `.env` means off.
117
+ */
118
+ export declare function debugLoggingEnabled(env?: NodeJS.ProcessEnv): boolean;
119
+ /**
120
+ * Where the log files live.
121
+ *
122
+ * `NUVIRA_DEBUG_LOG_DIR` wins when set; otherwise `<config dir>/debug-logs`
123
+ * through `resolveNuviraDataPath`, so an isolated profile (tests, CI, the
124
+ * parity harness) can never write into the developer's real `~/.nuvira`.
125
+ */
126
+ export declare function debugLogDir(env?: NodeJS.ProcessEnv): string;
127
+ /**
128
+ * One session's debug log, buffered and written once.
129
+ *
130
+ * Deliberately a class rather than a bag of functions: the buffered state IS
131
+ * the object, and a surface that opens one and forgets to write it produces no
132
+ * file at all — which the parity harness reads as `written: false` rather than
133
+ * as agreement.
134
+ */
135
+ export declare class SessionDebugLog {
136
+ readonly id: string;
137
+ readonly startedAt: number;
138
+ private readonly surface;
139
+ private readonly goal;
140
+ private backend;
141
+ private readonly extra;
142
+ private readonly entries;
143
+ private dropped;
144
+ private truncatedLines;
145
+ private readonly dir;
146
+ private readonly now;
147
+ /** The conversation this turn belongs to, or null (see `DebugLogHeader.session`). */
148
+ readonly session: string | null;
149
+ private writtenPath;
150
+ constructor(opts: {
151
+ surface: string;
152
+ goal?: string;
153
+ session?: string;
154
+ backend?: DebugLogBackend;
155
+ dir?: string | null;
156
+ now?: () => number;
157
+ });
158
+ /** The backend that served the turn. Set as it is learned; last call wins. */
159
+ backendOf(backend: DebugLogBackend): this;
160
+ /**
161
+ * Preview one detail value: flattened, cut to the cap, then redacted.
162
+ *
163
+ * The cut is counted BEFORE the scrub (the scrub only shortens), so the
164
+ * "truncated" line in the file reports how much was actually lost.
165
+ */
166
+ private detailText;
167
+ /** One ordered event. `detail` is previewed and redacted. */
168
+ event(name: string, detail?: unknown): this;
169
+ /** A non-secret header field (a version, a channel, a bound). */
170
+ detail(key: string, value: unknown): this;
171
+ /** The attachable text: header first, then the events in order. */
172
+ render(): string;
173
+ /**
174
+ * Write the file. Returns the path, or null when logging is disabled, no
175
+ * directory was resolved, or the write failed — every one of which is a
176
+ * normal outcome a caller must not have to handle.
177
+ */
178
+ write(): string | null;
179
+ /** The path after a successful `write()` (null before it / on failure). */
180
+ path(): string | null;
181
+ }
182
+ /**
183
+ * Open a session debug log, or `null` when logging is off (or in a unit test
184
+ * that passed no directory). Callers use `?.` throughout, so the off path costs
185
+ * one boolean.
186
+ */
187
+ export declare function sessionDebugLog(opts: {
188
+ surface: string;
189
+ goal?: string;
190
+ /** The chat/thread this turn belongs to, when the surface has one. */
191
+ session?: string;
192
+ backend?: DebugLogBackend;
193
+ /** Explicit directory (tests / a harness that isolates the profile). */
194
+ dir?: string | null;
195
+ env?: NodeJS.ProcessEnv;
196
+ now?: () => number;
197
+ }): SessionDebugLog | null;
198
+ /**
199
+ * Parse a rendered log's header.
200
+ *
201
+ * Reads the leading `# key: value` comment block only, and returns null when
202
+ * `surface` is absent — the one field every header must have. Unknown keys are
203
+ * ignored rather than rejected, so an older reader can still open a newer log.
204
+ */
205
+ export declare function parseDebugLogHeader(text: string): DebugLogHeader | null;
206
+ /** Every log file in `dir`, newest first. Missing directory = empty list. */
207
+ export declare function listDebugLogs(dir?: string): DebugLogFile[];
208
+ /**
209
+ * The newest log a given surface wrote, or null.
210
+ *
211
+ * This is how the parity harness reads a surface's OWN durable artifact — the
212
+ * same reasoning the gateway driver uses to read `inbound.chat` from the
213
+ * gateway log rather than trusting a return value.
214
+ */
215
+ export declare function readLatestDebugLog(surface: string, dir?: string): {
216
+ path: string;
217
+ header: DebugLogHeader;
218
+ text: string;
219
+ } | null;
220
+ /** One log file with its parsed header and text — what a support bundle carries. */
221
+ export interface DebugLogRecord {
222
+ path: string;
223
+ header: DebugLogHeader;
224
+ text: string;
225
+ }
226
+ /**
227
+ * Every log a given conversation wrote, OLDEST FIRST — the findable half.
228
+ *
229
+ * This is what lets the dashboard answer "the debug log for the chat I am
230
+ * looking at" without guessing. Two rules make it safe to expose:
231
+ *
232
+ * 1. SELECTED BY THE LOG'S OWN HEADER, never by recency. "The newest few logs"
233
+ * would hand a user somebody else's conversation — with a concurrent turn in
234
+ * another tab, that is the common case, not the edge case.
235
+ *
236
+ * 2. OLDEST FIRST, because a bundle is read top to bottom as the story of what
237
+ * happened, and a single turn's log already reads that way internally. The
238
+ * newest-first order `listDebugLogs` uses is right for "what just happened"
239
+ * and wrong for this.
240
+ *
241
+ * A file that cannot be read or parsed is skipped rather than failing the whole
242
+ * bundle: one unreadable turn must not cost the user the other four.
243
+ */
244
+ export declare function debugLogsForSession(sessionId: string, dir?: string): DebugLogRecord[];
245
+ /**
246
+ * A one-line notice a surface can print so the user knows a log exists to
247
+ * attach. Kept here so all five surfaces word it identically.
248
+ */
249
+ export declare function debugLogNotice(surface: string, path: string | null): string | null;
250
+ //# sourceMappingURL=debug-log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-log.d.ts","sourceRoot":"","sources":["../../src/observability/debug-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAOH,8EAA8E;AAC9E,eAAO,MAAM,aAAa,cAAc,CAAC;AACzC,8EAA8E;AAC9E,eAAO,MAAM,iBAAiB,kBAAkB,CAAC;AACjD,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,QAAa,CAAC;AAC9C,4DAA4D;AAC5D,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,mFAAmF;AACnF,eAAO,MAAM,oBAAoB,OAAQ,CAAC;AAC1C,qFAAqF;AACrF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