agent-nuvira 3.3.3 → 3.3.4

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 (349) 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/types.d.ts +44 -0
  73. package/dist/config/types.d.ts.map +1 -1
  74. package/dist/findings/verdicts.d.ts +241 -0
  75. package/dist/findings/verdicts.d.ts.map +1 -0
  76. package/dist/findings/verdicts.js +284 -0
  77. package/dist/findings/verdicts.js.map +1 -0
  78. package/dist/gateway/adapters.d.ts +65 -0
  79. package/dist/gateway/adapters.d.ts.map +1 -1
  80. package/dist/gateway/adapters.js +216 -10
  81. package/dist/gateway/adapters.js.map +1 -1
  82. package/dist/gateway/channel-directory.d.ts +31 -0
  83. package/dist/gateway/channel-directory.d.ts.map +1 -1
  84. package/dist/gateway/channel-directory.js +40 -0
  85. package/dist/gateway/channel-directory.js.map +1 -1
  86. package/dist/gateway/gateway-log.d.ts +1 -1
  87. package/dist/gateway/gateway-log.d.ts.map +1 -1
  88. package/dist/gateway/gateway-log.js.map +1 -1
  89. package/dist/gateway/hooks.d.ts +87 -19
  90. package/dist/gateway/hooks.d.ts.map +1 -1
  91. package/dist/gateway/hooks.js +62 -23
  92. package/dist/gateway/hooks.js.map +1 -1
  93. package/dist/gateway/inbound-media.d.ts +147 -0
  94. package/dist/gateway/inbound-media.d.ts.map +1 -0
  95. package/dist/gateway/inbound-media.js +317 -0
  96. package/dist/gateway/inbound-media.js.map +1 -0
  97. package/dist/gateway/inbox.d.ts +8 -1
  98. package/dist/gateway/inbox.d.ts.map +1 -1
  99. package/dist/gateway/inbox.js.map +1 -1
  100. package/dist/gateway/platform-config.d.ts +14 -0
  101. package/dist/gateway/platform-config.d.ts.map +1 -1
  102. package/dist/gateway/platform-config.js +26 -8
  103. package/dist/gateway/platform-config.js.map +1 -1
  104. package/dist/gateway/realtime.d.ts +114 -0
  105. package/dist/gateway/realtime.d.ts.map +1 -0
  106. package/dist/gateway/realtime.js +402 -0
  107. package/dist/gateway/realtime.js.map +1 -0
  108. package/dist/gateway/registry.d.ts +31 -0
  109. package/dist/gateway/registry.d.ts.map +1 -1
  110. package/dist/gateway/registry.js +224 -4
  111. package/dist/gateway/registry.js.map +1 -1
  112. package/dist/gateway/whatsapp/baileys-bridge.d.ts +11 -1
  113. package/dist/gateway/whatsapp/baileys-bridge.d.ts.map +1 -1
  114. package/dist/gateway/whatsapp/baileys-bridge.js +123 -4
  115. package/dist/gateway/whatsapp/baileys-bridge.js.map +1 -1
  116. package/dist/gateway/whatsapp/bridge.d.ts +6 -2
  117. package/dist/gateway/whatsapp/bridge.d.ts.map +1 -1
  118. package/dist/gateway/whatsapp/bridge.js.map +1 -1
  119. package/dist/index.js +8 -0
  120. package/dist/index.js.map +1 -1
  121. package/dist/inference/factory.d.ts +14 -0
  122. package/dist/inference/factory.d.ts.map +1 -1
  123. package/dist/inference/factory.js +17 -0
  124. package/dist/inference/factory.js.map +1 -1
  125. package/dist/inference/groq-adapter.d.ts +2 -0
  126. package/dist/inference/groq-adapter.d.ts.map +1 -1
  127. package/dist/inference/groq-adapter.js +16 -6
  128. package/dist/inference/groq-adapter.js.map +1 -1
  129. package/dist/inference/tools.d.ts.map +1 -1
  130. package/dist/inference/tools.js +29 -0
  131. package/dist/inference/tools.js.map +1 -1
  132. package/dist/learning/benchmark.d.ts.map +1 -1
  133. package/dist/learning/benchmark.js +3 -2
  134. package/dist/learning/benchmark.js.map +1 -1
  135. package/dist/learning/continuation.d.ts.map +1 -1
  136. package/dist/learning/continuation.js +2 -1
  137. package/dist/learning/continuation.js.map +1 -1
  138. package/dist/learning/cost-tracker.d.ts.map +1 -1
  139. package/dist/learning/cost-tracker.js +2 -1
  140. package/dist/learning/cost-tracker.js.map +1 -1
  141. package/dist/learning/deferred-task.d.ts.map +1 -1
  142. package/dist/learning/deferred-task.js +13 -4
  143. package/dist/learning/deferred-task.js.map +1 -1
  144. package/dist/learning/eval-framework.d.ts.map +1 -1
  145. package/dist/learning/eval-framework.js +2 -1
  146. package/dist/learning/eval-framework.js.map +1 -1
  147. package/dist/learning/long-form.d.ts.map +1 -1
  148. package/dist/learning/long-form.js +2 -1
  149. package/dist/learning/long-form.js.map +1 -1
  150. package/dist/learning/model-registry.d.ts.map +1 -1
  151. package/dist/learning/model-registry.js +2 -1
  152. package/dist/learning/model-registry.js.map +1 -1
  153. package/dist/learning/reasoning-cache.d.ts.map +1 -1
  154. package/dist/learning/reasoning-cache.js +2 -1
  155. package/dist/learning/reasoning-cache.js.map +1 -1
  156. package/dist/learning/reasoning-trace.d.ts +37 -1
  157. package/dist/learning/reasoning-trace.d.ts.map +1 -1
  158. package/dist/learning/reasoning-trace.js +66 -0
  159. package/dist/learning/reasoning-trace.js.map +1 -1
  160. package/dist/learning/resilient-call.d.ts.map +1 -1
  161. package/dist/learning/resilient-call.js +2 -1
  162. package/dist/learning/resilient-call.js.map +1 -1
  163. package/dist/learning/retrieval.d.ts.map +1 -1
  164. package/dist/learning/retrieval.js +2 -1
  165. package/dist/learning/retrieval.js.map +1 -1
  166. package/dist/learning/seeded-benchmark.d.ts +160 -0
  167. package/dist/learning/seeded-benchmark.d.ts.map +1 -0
  168. package/dist/learning/seeded-benchmark.js +321 -0
  169. package/dist/learning/seeded-benchmark.js.map +1 -0
  170. package/dist/learning/seeded-bugs.d.ts +142 -0
  171. package/dist/learning/seeded-bugs.d.ts.map +1 -0
  172. package/dist/learning/seeded-bugs.js +535 -0
  173. package/dist/learning/seeded-bugs.js.map +1 -0
  174. package/dist/learning/step-checkpoint.d.ts +127 -0
  175. package/dist/learning/step-checkpoint.d.ts.map +1 -0
  176. package/dist/learning/step-checkpoint.js +244 -0
  177. package/dist/learning/step-checkpoint.js.map +1 -0
  178. package/dist/nlu/intent-confirm.d.ts +23 -1
  179. package/dist/nlu/intent-confirm.d.ts.map +1 -1
  180. package/dist/nlu/intent-confirm.js +85 -2
  181. package/dist/nlu/intent-confirm.js.map +1 -1
  182. package/dist/nlu/learnings.d.ts +7 -0
  183. package/dist/nlu/learnings.d.ts.map +1 -1
  184. package/dist/nlu/learnings.js +7 -0
  185. package/dist/nlu/learnings.js.map +1 -1
  186. package/dist/observability/debug-log.d.ts +250 -0
  187. package/dist/observability/debug-log.d.ts.map +1 -0
  188. package/dist/observability/debug-log.js +500 -0
  189. package/dist/observability/debug-log.js.map +1 -0
  190. package/dist/observability/event-bus.d.ts.map +1 -1
  191. package/dist/observability/event-bus.js +4 -1
  192. package/dist/observability/event-bus.js.map +1 -1
  193. package/dist/observability/otel.d.ts +278 -0
  194. package/dist/observability/otel.d.ts.map +1 -0
  195. package/dist/observability/otel.js +590 -0
  196. package/dist/observability/otel.js.map +1 -0
  197. package/dist/parity/drivers.d.ts +99 -0
  198. package/dist/parity/drivers.d.ts.map +1 -0
  199. package/dist/parity/drivers.js +1362 -0
  200. package/dist/parity/drivers.js.map +1 -0
  201. package/dist/parity/graph.d.ts +73 -0
  202. package/dist/parity/graph.d.ts.map +1 -0
  203. package/dist/parity/graph.js +162 -0
  204. package/dist/parity/graph.js.map +1 -0
  205. package/dist/parity/matrix.d.ts +105 -0
  206. package/dist/parity/matrix.d.ts.map +1 -0
  207. package/dist/parity/matrix.js +352 -0
  208. package/dist/parity/matrix.js.map +1 -0
  209. package/dist/parity/observation.d.ts +444 -0
  210. package/dist/parity/observation.d.ts.map +1 -0
  211. package/dist/parity/observation.js +333 -0
  212. package/dist/parity/observation.js.map +1 -0
  213. package/dist/parity/scenarios.d.ts +229 -0
  214. package/dist/parity/scenarios.d.ts.map +1 -0
  215. package/dist/parity/scenarios.js +175 -0
  216. package/dist/parity/scenarios.js.map +1 -0
  217. package/dist/parity/surfaces.d.ts +122 -0
  218. package/dist/parity/surfaces.d.ts.map +1 -0
  219. package/dist/parity/surfaces.js +190 -0
  220. package/dist/parity/surfaces.js.map +1 -0
  221. package/dist/runtime/fault-injection.d.ts +173 -0
  222. package/dist/runtime/fault-injection.d.ts.map +1 -0
  223. package/dist/runtime/fault-injection.js +281 -0
  224. package/dist/runtime/fault-injection.js.map +1 -0
  225. package/dist/tools/child-agent-entry.d.ts +23 -0
  226. package/dist/tools/child-agent-entry.d.ts.map +1 -0
  227. package/dist/tools/child-agent-entry.js +129 -0
  228. package/dist/tools/child-agent-entry.js.map +1 -0
  229. package/dist/tools/child-agent-runtime.d.ts +124 -0
  230. package/dist/tools/child-agent-runtime.d.ts.map +1 -0
  231. package/dist/tools/child-agent-runtime.js +704 -0
  232. package/dist/tools/child-agent-runtime.js.map +1 -0
  233. package/dist/tools/coding-tools.d.ts.map +1 -1
  234. package/dist/tools/coding-tools.js +82 -10
  235. package/dist/tools/coding-tools.js.map +1 -1
  236. package/dist/tools/delegation-system.d.ts +31 -0
  237. package/dist/tools/delegation-system.d.ts.map +1 -1
  238. package/dist/tools/delegation-system.js +70 -9
  239. package/dist/tools/delegation-system.js.map +1 -1
  240. package/dist/tools/extract/docx.d.ts +27 -0
  241. package/dist/tools/extract/docx.d.ts.map +1 -0
  242. package/dist/tools/extract/docx.js +48 -0
  243. package/dist/tools/extract/docx.js.map +1 -0
  244. package/dist/tools/extract/html-text.d.ts +27 -0
  245. package/dist/tools/extract/html-text.d.ts.map +1 -0
  246. package/dist/tools/extract/html-text.js +86 -0
  247. package/dist/tools/extract/html-text.js.map +1 -0
  248. package/dist/tools/extract/pdf-ocr.d.ts +58 -0
  249. package/dist/tools/extract/pdf-ocr.d.ts.map +1 -0
  250. package/dist/tools/extract/pdf-ocr.js +116 -0
  251. package/dist/tools/extract/pdf-ocr.js.map +1 -0
  252. package/dist/tools/extract/pdf.d.ts +65 -0
  253. package/dist/tools/extract/pdf.d.ts.map +1 -0
  254. package/dist/tools/extract/pdf.js +197 -0
  255. package/dist/tools/extract/pdf.js.map +1 -0
  256. package/dist/tools/extract/pptx.d.ts +32 -0
  257. package/dist/tools/extract/pptx.d.ts.map +1 -0
  258. package/dist/tools/extract/pptx.js +77 -0
  259. package/dist/tools/extract/pptx.js.map +1 -0
  260. package/dist/tools/extract/xlsx.d.ts +47 -0
  261. package/dist/tools/extract/xlsx.d.ts.map +1 -0
  262. package/dist/tools/extract/xlsx.js +111 -0
  263. package/dist/tools/extract/xlsx.js.map +1 -0
  264. package/dist/tools/finding-tool.d.ts +76 -0
  265. package/dist/tools/finding-tool.d.ts.map +1 -0
  266. package/dist/tools/finding-tool.js +125 -0
  267. package/dist/tools/finding-tool.js.map +1 -0
  268. package/dist/tools/messaging-tools.d.ts +41 -11
  269. package/dist/tools/messaging-tools.d.ts.map +1 -1
  270. package/dist/tools/messaging-tools.js +104 -55
  271. package/dist/tools/messaging-tools.js.map +1 -1
  272. package/dist/tools/neutts-synth.d.ts +27 -3
  273. package/dist/tools/neutts-synth.d.ts.map +1 -1
  274. package/dist/tools/neutts-synth.js +57 -13
  275. package/dist/tools/neutts-synth.js.map +1 -1
  276. package/dist/tools/pipeline-tool.d.ts +43 -1
  277. package/dist/tools/pipeline-tool.d.ts.map +1 -1
  278. package/dist/tools/pipeline-tool.js +13 -2
  279. package/dist/tools/pipeline-tool.js.map +1 -1
  280. package/dist/tools/read-extract.d.ts +116 -45
  281. package/dist/tools/read-extract.d.ts.map +1 -1
  282. package/dist/tools/read-extract.js +494 -158
  283. package/dist/tools/read-extract.js.map +1 -1
  284. package/dist/tools/registry.d.ts +2 -2
  285. package/dist/tools/registry.d.ts.map +1 -1
  286. package/dist/tools/registry.js +152 -23
  287. package/dist/tools/registry.js.map +1 -1
  288. package/dist/tools/subagent-refusal.d.ts +15 -0
  289. package/dist/tools/subagent-refusal.d.ts.map +1 -0
  290. package/dist/tools/subagent-refusal.js +18 -0
  291. package/dist/tools/subagent-refusal.js.map +1 -0
  292. package/dist/tools/subagent-spawner.d.ts +122 -0
  293. package/dist/tools/subagent-spawner.d.ts.map +1 -1
  294. package/dist/tools/subagent-spawner.js +249 -28
  295. package/dist/tools/subagent-spawner.js.map +1 -1
  296. package/dist/tools/tool-hooks.d.ts +177 -0
  297. package/dist/tools/tool-hooks.d.ts.map +1 -0
  298. package/dist/tools/tool-hooks.js +427 -0
  299. package/dist/tools/tool-hooks.js.map +1 -0
  300. package/dist/tools/tool-loop.d.ts +82 -0
  301. package/dist/tools/tool-loop.d.ts.map +1 -1
  302. package/dist/tools/tool-loop.js +167 -9
  303. package/dist/tools/tool-loop.js.map +1 -1
  304. package/dist/tools/tool-refusal.d.ts +68 -0
  305. package/dist/tools/tool-refusal.d.ts.map +1 -0
  306. package/dist/tools/tool-refusal.js +78 -0
  307. package/dist/tools/tool-refusal.js.map +1 -0
  308. package/dist/tools/toolsets.d.ts +8 -0
  309. package/dist/tools/toolsets.d.ts.map +1 -1
  310. package/dist/tools/toolsets.js +12 -2
  311. package/dist/tools/toolsets.js.map +1 -1
  312. package/dist/tools/vision-tools.d.ts +88 -83
  313. package/dist/tools/vision-tools.d.ts.map +1 -1
  314. package/dist/tools/vision-tools.js +134 -103
  315. package/dist/tools/vision-tools.js.map +1 -1
  316. package/dist/tools/worktree.d.ts +210 -0
  317. package/dist/tools/worktree.d.ts.map +1 -0
  318. package/dist/tools/worktree.js +374 -0
  319. package/dist/tools/worktree.js.map +1 -0
  320. package/dist/utils/format.d.ts +3 -0
  321. package/dist/utils/format.d.ts.map +1 -0
  322. package/dist/utils/format.js +32 -0
  323. package/dist/utils/format.js.map +1 -0
  324. package/dist/web-dashboard/attachment-extract.d.ts +64 -0
  325. package/dist/web-dashboard/attachment-extract.d.ts.map +1 -0
  326. package/dist/web-dashboard/attachment-extract.js +154 -0
  327. package/dist/web-dashboard/attachment-extract.js.map +1 -0
  328. package/dist/web-dashboard/chat-console.d.ts +108 -1
  329. package/dist/web-dashboard/chat-console.d.ts.map +1 -1
  330. package/dist/web-dashboard/chat-console.js +36 -0
  331. package/dist/web-dashboard/chat-console.js.map +1 -1
  332. package/dist/web-dashboard/hub-data.d.ts +37 -0
  333. package/dist/web-dashboard/hub-data.d.ts.map +1 -1
  334. package/dist/web-dashboard/hub-data.js +61 -1
  335. package/dist/web-dashboard/hub-data.js.map +1 -1
  336. package/dist/web-dashboard/server.d.ts +14 -0
  337. package/dist/web-dashboard/server.d.ts.map +1 -1
  338. package/dist/web-dashboard/server.js +247 -13
  339. package/dist/web-dashboard/server.js.map +1 -1
  340. package/dist/web-dashboard/src/types.d.ts +196 -48
  341. package/dist/web-dashboard/src/types.d.ts.map +1 -1
  342. package/package.json +18 -3
  343. package/src/web-dashboard/public/assets/{index-Cyd6tIew.css → index-XJjj2cBX.css} +1 -1
  344. package/src/web-dashboard/public/assets/index-YWF9FpwQ.js +207 -0
  345. package/src/web-dashboard/public/assets/index-YWF9FpwQ.js.map +1 -0
  346. package/src/web-dashboard/public/index.html +2 -2
  347. package/dist/tools/child-agent-worker.js +0 -212
  348. package/src/web-dashboard/public/assets/index-CxDj7p6i.js +0 -207
  349. package/src/web-dashboard/public/assets/index-CxDj7p6i.js.map +0 -1
@@ -0,0 +1,173 @@
1
+ /**
2
+ * WS6 (#28) — fault injection.
3
+ *
4
+ * WHY THIS IS TEST INFRASTRUCTURE AND NOT A MATRIX ROW. `src/parity/matrix.ts`
5
+ * says it in one line: fault injection is not a capability a surface can have, so
6
+ * it has no cells and no parity verdict of its own. What it DOES have is a job —
7
+ * make a dependency fail ON PURPOSE, deterministically, on every surface, so the
8
+ * honest answer to a failure can be measured instead of assumed. The whole
9
+ * truthfulness workstream exists because a failure reported as success is the one
10
+ * defect an agent cannot recover from, and nothing measures that shape as well as
11
+ * a fault that is declared in advance and cannot be confused with a real outage.
12
+ *
13
+ * TWO HALVES, and keeping them apart is the design:
14
+ *
15
+ * 1. THE WIRE (no production code involved). A parity scenario declares
16
+ * `fault: { site: 'provider', kind: 'error', times: Infinity }` and the
17
+ * harness's own loopback stub answers 500 / malformed JSON / 503. The REAL
18
+ * adapter's error mapping runs, the model call still happens (so the
19
+ * harness's "the turn must have reached a model" rule holds), and every
20
+ * surface must report the same failure. This is where a provider fault is
21
+ * proven, because the adapter — not this module — is what a user's real
22
+ * outage exercises.
23
+ *
24
+ * 2. THE SEAM (this module). `NUVIRA_INJECT_FAULT=provider:error:2` or
25
+ * `tool:error:list_dir` makes the running agent fail one of its own
26
+ * dependencies, in-process, for a live run, a demo, or a test that wants a
27
+ * fault without a stub server. OFF BY DEFAULT AND FREE WHEN OFF: with the
28
+ * variable unset, `activeFaultInjector()` returns null and nothing is
29
+ * wrapped — `ProviderFactory.createProvider` hands back the very same object
30
+ * it always did, so no run that did not ask for a fault is affected.
31
+ *
32
+ * THE ONE RULE THAT MAKES IT USEFUL: an injected fault must never look like a
33
+ * real one. Every message this module produces says, in the text the model and
34
+ * the operator both read, that the failure was declared and where the declaration
35
+ * came from. A fault that could be mistaken for a genuine outage would corrupt
36
+ * exactly the evidence it was injected to gather.
37
+ *
38
+ * A TYPO IS NOT A SILENT NO-OP. A declaration that cannot be parsed THROWS. The
39
+ * alternative — ignoring it and running the turn unfaulted — would let a demo or
40
+ * a test "prove" failure handling while nothing ever failed, which is the same
41
+ * class of lie this repo has spent a workstream removing.
42
+ */
43
+ import type { InferenceProvider } from '../inference/interface.js';
44
+ /** The environment variable that declares a fault. Unset (the default) = no fault. */
45
+ export declare const FAULT_ENV = "NUVIRA_INJECT_FAULT";
46
+ /**
47
+ * Where a fault is injected.
48
+ *
49
+ * - `provider` — the model call itself (a request that fails, or a response that
50
+ * cannot be parsed).
51
+ * - `tool` — one tool call (`match` names it; absent = the next call).
52
+ * - `ipc` — the child process boundary (the child exits before it works).
53
+ */
54
+ export type FaultSite = 'provider' | 'tool' | 'ipc';
55
+ /**
56
+ * What kind of failure to inject.
57
+ *
58
+ * - `error` — the call fails outright (HTTP 500 / a thrown provider error).
59
+ * - `malformed` — the call "succeeds" with a body nothing can parse.
60
+ * - `unavailable` — the backend reports itself temporarily unavailable (503).
61
+ */
62
+ export type FaultKind = 'error' | 'malformed' | 'unavailable';
63
+ /** A declared fault: what to break, and how many times. */
64
+ export interface FaultPlan {
65
+ site: FaultSite;
66
+ kind: FaultKind;
67
+ /**
68
+ * How many matching calls to fail. `1` is the default a bare declaration means,
69
+ * `Infinity` fails every matching call (what a parity row wants: a turn that
70
+ * recovers from a transient fault and one that reports it are both honest, and a
71
+ * row that cannot tell which happened measures neither).
72
+ */
73
+ times: number;
74
+ /** The tool name to match (`site: 'tool'`). Absent = every tool call. */
75
+ match?: string;
76
+ }
77
+ /** One fault that actually fired. */
78
+ export interface FaultFiring {
79
+ site: FaultSite;
80
+ kind: FaultKind;
81
+ /** What was about to run: a provider method, a tool name, or `child`. */
82
+ subject: string;
83
+ /** The text every consumer reads. Names the declaration, so it cannot be mistaken for a real outage. */
84
+ message: string;
85
+ }
86
+ /**
87
+ * Render a plan back to the declaration form the environment carries.
88
+ *
89
+ * The round trip matters: the harness declares a scenario's fault by writing this
90
+ * string into the environment, and a failure report shows the same string, so an
91
+ * operator can copy it straight into a shell.
92
+ */
93
+ export declare function formatFaultPlan(plan: FaultPlan): string;
94
+ /**
95
+ * Parse `site:kind[:times|all[:match]]`.
96
+ *
97
+ * Accepts `off`/`none`/`0` as "no fault" (an easy way for a script to switch one
98
+ * off without unsetting the variable). Anything else that does not parse THROWS —
99
+ * see the header: a declaration that silently injects nothing is worse than no
100
+ * declaration at all.
101
+ */
102
+ export declare function parseFaultPlan(raw: string | undefined | null): FaultPlan | null;
103
+ /** The declared fault for this process, or null. Throws on a malformed declaration. */
104
+ export declare function faultPlanFromEnv(env?: Record<string, string | undefined>): FaultPlan | null;
105
+ /**
106
+ * The message a fired fault carries into the tool result / provider error.
107
+ *
108
+ * Names the declaration and the subject, and says PLAINLY that it was injected —
109
+ * every consumer of this text (the model included) must be able to tell a
110
+ * declared fault from a real failure.
111
+ */
112
+ export declare function faultMessage(plan: FaultPlan, subject: string): string;
113
+ /**
114
+ * A counting injector for one declaration.
115
+ *
116
+ * `at()` is the whole API: it answers "should this call fail?", and returns null
117
+ * once the declaration's allowance is spent. Counting (rather than a boolean) is
118
+ * what makes `times` mean anything — and it is also the evidence a caller needs:
119
+ * a declared fault that never fired is a fault that measured nothing.
120
+ */
121
+ export declare class FaultInjector {
122
+ readonly plan: FaultPlan;
123
+ private remaining;
124
+ private readonly firings;
125
+ constructor(plan: FaultPlan);
126
+ /** How many times this injector has fired so far. */
127
+ get fired(): number;
128
+ /** What fired, in order — for a report or an assertion. */
129
+ get history(): readonly FaultFiring[];
130
+ /** True when the declaration's allowance is spent. */
131
+ get exhausted(): boolean;
132
+ /**
133
+ * Ask whether the call about to run should fail instead.
134
+ *
135
+ * Consumes one firing when it answers yes. A site that does not match — or a
136
+ * tool name that does not match — is never consumed, so `tool:error:read_file`
137
+ * does not spend its allowance on the writes around it.
138
+ */
139
+ at(site: FaultSite, subject: string): FaultFiring | null;
140
+ }
141
+ /** Build an injector for a plan. Off (null) when there is no plan. */
142
+ export declare function createFaultInjector(plan: FaultPlan | null | undefined): FaultInjector | null;
143
+ /**
144
+ * The injector for the CURRENT declaration, rebuilt when the declaration changes.
145
+ *
146
+ * Cached so one declaration's `times` is spent across the whole turn rather than
147
+ * reset per call, and keyed on the raw string so a caller that re-declares a fault
148
+ * (the parity harness does, once per surface) gets a fresh allowance without
149
+ * having to know this cache exists.
150
+ */
151
+ export declare function activeFaultInjector(env?: Record<string, string | undefined>): FaultInjector | null;
152
+ /** Forget the cached injector — call after changing the declaration (tests, the harness). */
153
+ export declare function resetFaultInjector(): void;
154
+ /** Should the call about to run fail? The one-liner the seams call. */
155
+ export declare function faultAt(site: FaultSite, subject: string): FaultFiring | null;
156
+ /**
157
+ * Wrap a provider so declared `provider` faults fail its model calls.
158
+ *
159
+ * TWO PROPERTIES, and both are load-bearing:
160
+ *
161
+ * - ONLY WHEN A DECLARATION EXISTS. With no `NUVIRA_INJECT_FAULT`, the provider
162
+ * is returned UNCHANGED — same object, not a transparent copy — so a run that
163
+ * asked for nothing cannot be affected by this module.
164
+ * - ONLY THE METHODS THAT EXIST. `generateTools` is optional (`InferenceProvider`)
165
+ * and its PRESENCE is how the loop picks the native transport over the JSON
166
+ * fallback (`child-agent-runtime.ts:181`). Adding it to a provider that lacks
167
+ * it would silently change the transport a run was measured on, so an absent
168
+ * method stays absent.
169
+ */
170
+ export declare function withFaultInjection(provider: InferenceProvider, injector?: FaultInjector | null): InferenceProvider;
171
+ /** What the seam can inject, for the CLI's `parity faults` listing. */
172
+ export declare function describeFaultProtocol(): string[];
173
+ //# sourceMappingURL=fault-injection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fault-injection.d.ts","sourceRoot":"","sources":["../../src/runtime/fault-injection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;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C,SAAS,CAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;gBAExB,IAAI,EAAE,SAAS;IAIpC,qDAAqD;IACrD,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,2DAA2D;IAC3D,IAAI,OAAO,IAAI,SAAS,WAAW,EAAE,CAEpC;IAED,sDAAsD;IACtD,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;;;;;OAMG;IACH,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;CAczD;AAED,sEAAsE;AACtE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,GAAG,aAAa,GAAG,IAAI,CAE5F;AAID;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GAAG,aAAa,GAAG,IAAI,CAK/G;AAED,6FAA6F;AAC7F,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AAED,uEAAuE;AACvE,wBAAgB,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAE5E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,iBAAiB,EAC3B,QAAQ,GAAE,aAAa,GAAG,IAA4B,GACrD,iBAAiB,CAkBnB;AAED,uEAAuE;AACvE,wBAAgB,qBAAqB,IAAI,MAAM,EAAE,CAgBhD"}
@@ -0,0 +1,281 @@
1
+ /**
2
+ * WS6 (#28) — fault injection.
3
+ *
4
+ * WHY THIS IS TEST INFRASTRUCTURE AND NOT A MATRIX ROW. `src/parity/matrix.ts`
5
+ * says it in one line: fault injection is not a capability a surface can have, so
6
+ * it has no cells and no parity verdict of its own. What it DOES have is a job —
7
+ * make a dependency fail ON PURPOSE, deterministically, on every surface, so the
8
+ * honest answer to a failure can be measured instead of assumed. The whole
9
+ * truthfulness workstream exists because a failure reported as success is the one
10
+ * defect an agent cannot recover from, and nothing measures that shape as well as
11
+ * a fault that is declared in advance and cannot be confused with a real outage.
12
+ *
13
+ * TWO HALVES, and keeping them apart is the design:
14
+ *
15
+ * 1. THE WIRE (no production code involved). A parity scenario declares
16
+ * `fault: { site: 'provider', kind: 'error', times: Infinity }` and the
17
+ * harness's own loopback stub answers 500 / malformed JSON / 503. The REAL
18
+ * adapter's error mapping runs, the model call still happens (so the
19
+ * harness's "the turn must have reached a model" rule holds), and every
20
+ * surface must report the same failure. This is where a provider fault is
21
+ * proven, because the adapter — not this module — is what a user's real
22
+ * outage exercises.
23
+ *
24
+ * 2. THE SEAM (this module). `NUVIRA_INJECT_FAULT=provider:error:2` or
25
+ * `tool:error:list_dir` makes the running agent fail one of its own
26
+ * dependencies, in-process, for a live run, a demo, or a test that wants a
27
+ * fault without a stub server. OFF BY DEFAULT AND FREE WHEN OFF: with the
28
+ * variable unset, `activeFaultInjector()` returns null and nothing is
29
+ * wrapped — `ProviderFactory.createProvider` hands back the very same object
30
+ * it always did, so no run that did not ask for a fault is affected.
31
+ *
32
+ * THE ONE RULE THAT MAKES IT USEFUL: an injected fault must never look like a
33
+ * real one. Every message this module produces says, in the text the model and
34
+ * the operator both read, that the failure was declared and where the declaration
35
+ * came from. A fault that could be mistaken for a genuine outage would corrupt
36
+ * exactly the evidence it was injected to gather.
37
+ *
38
+ * A TYPO IS NOT A SILENT NO-OP. A declaration that cannot be parsed THROWS. The
39
+ * alternative — ignoring it and running the turn unfaulted — would let a demo or
40
+ * a test "prove" failure handling while nothing ever failed, which is the same
41
+ * class of lie this repo has spent a workstream removing.
42
+ */
43
+ /** The environment variable that declares a fault. Unset (the default) = no fault. */
44
+ export const FAULT_ENV = 'NUVIRA_INJECT_FAULT';
45
+ const SITES = ['provider', 'tool', 'ipc'];
46
+ const KINDS = ['error', 'malformed', 'unavailable'];
47
+ function isSite(value) {
48
+ return SITES.includes(value);
49
+ }
50
+ function isKind(value) {
51
+ return KINDS.includes(value);
52
+ }
53
+ /**
54
+ * Render a plan back to the declaration form the environment carries.
55
+ *
56
+ * The round trip matters: the harness declares a scenario's fault by writing this
57
+ * string into the environment, and a failure report shows the same string, so an
58
+ * operator can copy it straight into a shell.
59
+ */
60
+ export function formatFaultPlan(plan) {
61
+ const parts = [plan.site, plan.kind];
62
+ const finite = Number.isFinite(plan.times) ? plan.times : Number.POSITIVE_INFINITY;
63
+ // Only spelled out when it is not the bare default, so `tool:error` stays short.
64
+ if (finite !== 1 || plan.match)
65
+ parts.push(finite === Number.POSITIVE_INFINITY ? 'all' : String(finite));
66
+ if (plan.match)
67
+ parts.push(plan.match);
68
+ return parts.join(':');
69
+ }
70
+ /**
71
+ * Parse `site:kind[:times|all[:match]]`.
72
+ *
73
+ * Accepts `off`/`none`/`0` as "no fault" (an easy way for a script to switch one
74
+ * off without unsetting the variable). Anything else that does not parse THROWS —
75
+ * see the header: a declaration that silently injects nothing is worse than no
76
+ * declaration at all.
77
+ */
78
+ export function parseFaultPlan(raw) {
79
+ const text = (raw ?? '').trim();
80
+ if (!text)
81
+ return null;
82
+ const lowered = text.toLowerCase();
83
+ if (lowered === 'off' || lowered === 'none' || lowered === '0')
84
+ return null;
85
+ const parts = text.split(':').map((part) => part.trim());
86
+ const [siteRaw, kindRaw, third, fourth] = parts;
87
+ if (!siteRaw || !kindRaw || !isSite(siteRaw) || !isKind(kindRaw)) {
88
+ throw new Error(`Invalid ${FAULT_ENV} declaration ${JSON.stringify(text)}: expected ` +
89
+ `<site>:<kind>[:<times|all>[:<match>]] where site is one of ${SITES.join(', ')} ` +
90
+ `and kind is one of ${KINDS.join(', ')}. Use \`off\` to disable.`);
91
+ }
92
+ let times = 1;
93
+ let match;
94
+ if (third !== undefined && third !== '') {
95
+ // ORDER MATTERS, and it was measured: `all` has to be recognised as a COUNT
96
+ // before the "not a number, so it must be a tool name" rule runs, because
97
+ // `Number('all')` is NaN — the first version of this parser read
98
+ // `tool:error:all:read_file` as "one call, matching the tool named `all`".
99
+ const parsed = Number(third);
100
+ if (third.toLowerCase() === 'all' || third === '*') {
101
+ times = Number.POSITIVE_INFINITY;
102
+ }
103
+ else if (!Number.isNaN(parsed)) {
104
+ if (!Number.isFinite(parsed) || parsed < 1 || !Number.isInteger(parsed)) {
105
+ throw new Error(`Invalid ${FAULT_ENV} declaration ${JSON.stringify(text)}: times must be a positive ` +
106
+ `integer or \`all\` (got ${JSON.stringify(third)}).`);
107
+ }
108
+ times = parsed;
109
+ }
110
+ else if (siteRaw === 'tool') {
111
+ match = third;
112
+ }
113
+ else {
114
+ throw new Error(`Invalid ${FAULT_ENV} declaration ${JSON.stringify(text)}: times must be a positive ` +
115
+ `integer or \`all\` (got ${JSON.stringify(third)}).`);
116
+ }
117
+ }
118
+ if (fourth !== undefined && fourth !== '') {
119
+ if (siteRaw !== 'tool') {
120
+ throw new Error(`Invalid ${FAULT_ENV} declaration ${JSON.stringify(text)}: only \`tool\` faults take a ` +
121
+ `tool name to match (got ${JSON.stringify(fourth)} on a \`${siteRaw}\` fault).`);
122
+ }
123
+ match = fourth;
124
+ }
125
+ return match ? { site: siteRaw, kind: kindRaw, times, match } : { site: siteRaw, kind: kindRaw, times };
126
+ }
127
+ /** The declared fault for this process, or null. Throws on a malformed declaration. */
128
+ export function faultPlanFromEnv(env = process.env) {
129
+ return parseFaultPlan(env[FAULT_ENV]);
130
+ }
131
+ /**
132
+ * The message a fired fault carries into the tool result / provider error.
133
+ *
134
+ * Names the declaration and the subject, and says PLAINLY that it was injected —
135
+ * every consumer of this text (the model included) must be able to tell a
136
+ * declared fault from a real failure.
137
+ */
138
+ export function faultMessage(plan, subject) {
139
+ const what = plan.kind === 'malformed'
140
+ ? `returned a response nothing could parse`
141
+ : plan.kind === 'unavailable'
142
+ ? `reported itself unavailable`
143
+ : `failed`;
144
+ return (`injected ${plan.site} fault: ${subject} was made to ${what} ON PURPOSE ` +
145
+ `(${FAULT_ENV}=${formatFaultPlan(plan)}). This is a declared fault, not a real ${plan.site} failure.`);
146
+ }
147
+ /**
148
+ * A counting injector for one declaration.
149
+ *
150
+ * `at()` is the whole API: it answers "should this call fail?", and returns null
151
+ * once the declaration's allowance is spent. Counting (rather than a boolean) is
152
+ * what makes `times` mean anything — and it is also the evidence a caller needs:
153
+ * a declared fault that never fired is a fault that measured nothing.
154
+ */
155
+ export class FaultInjector {
156
+ plan;
157
+ remaining;
158
+ firings = [];
159
+ constructor(plan) {
160
+ this.plan = plan;
161
+ this.remaining = plan.times;
162
+ }
163
+ /** How many times this injector has fired so far. */
164
+ get fired() {
165
+ return this.firings.length;
166
+ }
167
+ /** What fired, in order — for a report or an assertion. */
168
+ get history() {
169
+ return [...this.firings];
170
+ }
171
+ /** True when the declaration's allowance is spent. */
172
+ get exhausted() {
173
+ return this.remaining <= 0;
174
+ }
175
+ /**
176
+ * Ask whether the call about to run should fail instead.
177
+ *
178
+ * Consumes one firing when it answers yes. A site that does not match — or a
179
+ * tool name that does not match — is never consumed, so `tool:error:read_file`
180
+ * does not spend its allowance on the writes around it.
181
+ */
182
+ at(site, subject) {
183
+ if (site !== this.plan.site)
184
+ return null;
185
+ if (this.plan.match !== undefined && this.plan.match !== subject)
186
+ return null;
187
+ if (this.remaining <= 0)
188
+ return null;
189
+ this.remaining -= 1;
190
+ const firing = {
191
+ site,
192
+ kind: this.plan.kind,
193
+ subject,
194
+ message: faultMessage(this.plan, subject),
195
+ };
196
+ this.firings.push(firing);
197
+ return firing;
198
+ }
199
+ }
200
+ /** Build an injector for a plan. Off (null) when there is no plan. */
201
+ export function createFaultInjector(plan) {
202
+ return plan ? new FaultInjector(plan) : null;
203
+ }
204
+ let cached = null;
205
+ /**
206
+ * The injector for the CURRENT declaration, rebuilt when the declaration changes.
207
+ *
208
+ * Cached so one declaration's `times` is spent across the whole turn rather than
209
+ * reset per call, and keyed on the raw string so a caller that re-declares a fault
210
+ * (the parity harness does, once per surface) gets a fresh allowance without
211
+ * having to know this cache exists.
212
+ */
213
+ export function activeFaultInjector(env = process.env) {
214
+ const raw = env[FAULT_ENV];
215
+ if (cached && cached.raw === raw)
216
+ return cached.injector;
217
+ cached = { raw, injector: createFaultInjector(faultPlanFromEnv(env)) };
218
+ return cached.injector;
219
+ }
220
+ /** Forget the cached injector — call after changing the declaration (tests, the harness). */
221
+ export function resetFaultInjector() {
222
+ cached = null;
223
+ }
224
+ /** Should the call about to run fail? The one-liner the seams call. */
225
+ export function faultAt(site, subject) {
226
+ return activeFaultInjector()?.at(site, subject) ?? null;
227
+ }
228
+ /**
229
+ * Wrap a provider so declared `provider` faults fail its model calls.
230
+ *
231
+ * TWO PROPERTIES, and both are load-bearing:
232
+ *
233
+ * - ONLY WHEN A DECLARATION EXISTS. With no `NUVIRA_INJECT_FAULT`, the provider
234
+ * is returned UNCHANGED — same object, not a transparent copy — so a run that
235
+ * asked for nothing cannot be affected by this module.
236
+ * - ONLY THE METHODS THAT EXIST. `generateTools` is optional (`InferenceProvider`)
237
+ * and its PRESENCE is how the loop picks the native transport over the JSON
238
+ * fallback (`child-agent-runtime.ts:181`). Adding it to a provider that lacks
239
+ * it would silently change the transport a run was measured on, so an absent
240
+ * method stays absent.
241
+ */
242
+ export function withFaultInjection(provider, injector = activeFaultInjector()) {
243
+ if (!injector || injector.plan.site !== 'provider')
244
+ return provider;
245
+ const modelMethods = ['generate', 'generateTools', 'generateToolsStream'];
246
+ return new Proxy(provider, {
247
+ get(target, prop, receiver) {
248
+ if (typeof prop === 'string' && modelMethods.includes(prop)) {
249
+ const original = Reflect.get(target, prop, target);
250
+ if (typeof original !== 'function')
251
+ return original;
252
+ return async (...args) => {
253
+ const firing = injector.at('provider', prop);
254
+ if (firing)
255
+ throw new Error(firing.message);
256
+ return original.apply(target, args);
257
+ };
258
+ }
259
+ return Reflect.get(target, prop, receiver);
260
+ },
261
+ });
262
+ }
263
+ /** What the seam can inject, for the CLI's `parity faults` listing. */
264
+ export function describeFaultProtocol() {
265
+ return [
266
+ `Declaration: ${FAULT_ENV}=<site>:<kind>[:<times|all>[:<tool name>]]`,
267
+ ` sites: ${SITES.join(', ')} kinds: ${KINDS.join(', ')} times: 1 (default), N, or all`,
268
+ '',
269
+ ' provider:error the next model call fails (HTTP 500 / a thrown provider error)',
270
+ ' provider:malformed:all every model call returns a body nothing can parse',
271
+ ' provider:unavailable the backend reports itself temporarily unavailable (503)',
272
+ ' tool:error:list_dir the next list_dir call fails, and reports why',
273
+ ' tool:error:2 the next two tool calls fail',
274
+ ' ipc:error the forked child exits before it does any work',
275
+ ' off no fault (the default when the variable is unset)',
276
+ '',
277
+ 'A declaration that cannot be parsed THROWS rather than running unfaulted, and every',
278
+ 'message names the declaration, so an injected fault can never be mistaken for a real one.',
279
+ ];
280
+ }
281
+ //# sourceMappingURL=fault-injection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fault-injection.js","sourceRoot":"","sources":["../../src/runtime/fault-injection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAIH,sFAAsF;AACtF,MAAM,CAAC,MAAM,SAAS,GAAG,qBAAqB,CAAC;AA8C/C,MAAM,KAAK,GAAyB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AAChE,MAAM,KAAK,GAAyB,CAAC,OAAO,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC;AAE1E,SAAS,MAAM,CAAC,KAAa;IAC3B,OAAQ,KAA2B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,MAAM,CAAC,KAAa;IAC3B,OAAQ,KAA2B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACtD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,IAAe;IAC7C,MAAM,KAAK,GAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,MA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;gBAC9D,IAAI,OAAO,QAAQ,KAAK,UAAU;oBAAE,OAAO,QAAQ,CAAC;gBACpD,OAAO,KAAK,EAAE,GAAG,IAAe,EAAoB,EAAE;oBACpD,MAAM,MAAM,GAAG,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;oBAC7C,IAAI,MAAM;wBAAE,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;oBAC5C,OAAQ,QAAyC,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;gBACxE,CAAC,CAAC;YACJ,CAAC;YACD,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC7C,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,qBAAqB;IACnC,OAAO;QACL,gBAAgB,SAAS,4CAA4C;QACrE,YAAY,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,kCAAkC;QAC3F,EAAE;QACF,2FAA2F;QAC3F,8EAA8E;QAC9E,qFAAqF;QACrF,0EAA0E;QAC1E,yDAAyD;QACzD,2EAA2E;QAC3E,8EAA8E;QAC9E,EAAE;QACF,qFAAqF;QACrF,2FAA2F;KAC5F,CAAC;AACJ,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Child-agent entry point (`src/tools/child-agent-entry.ts`) — the file the
3
+ * spawner forks.
4
+ *
5
+ * It exists as TypeScript for two reasons that were both live defects:
6
+ *
7
+ * 1. **It is shipped.** `tsc` emits `dist/tools/child-agent-entry.js`, so the
8
+ * compiled layout forks a file that exists. The previous entry was a
9
+ * hand-written `child-agent-entry.js` under `src/`, which nothing copied to
10
+ * `dist/` (`allowJs` is false) — a compiled install forked a path that was
11
+ * never there, and `spawn()` threw ENOENT.
12
+ * 2. **It runs in this package's module system.** `package.json` is
13
+ * `"type": "module"`, so that same `.js` file was parsed as ESM while being
14
+ * written in CommonJS (`require`, `__dirname`, a `parentPort` import from a
15
+ * worker-thread API that a `fork()`ed process does not have). It died on
16
+ * `require is not defined` before it read a single environment variable.
17
+ *
18
+ * The child reports over the IPC channel `fork()` establishes: `progress` while
19
+ * it works, then exactly one `result` or `error`. The parent treats "exited
20
+ * without a result" as a failure, so this file must never exit 0 silently.
21
+ */
22
+ export {};
23
+ //# sourceMappingURL=child-agent-entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"child-agent-entry.d.ts","sourceRoot":"","sources":["../../src/tools/child-agent-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG"}
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Child-agent entry point (`src/tools/child-agent-entry.ts`) — the file the
3
+ * spawner forks.
4
+ *
5
+ * It exists as TypeScript for two reasons that were both live defects:
6
+ *
7
+ * 1. **It is shipped.** `tsc` emits `dist/tools/child-agent-entry.js`, so the
8
+ * compiled layout forks a file that exists. The previous entry was a
9
+ * hand-written `child-agent-entry.js` under `src/`, which nothing copied to
10
+ * `dist/` (`allowJs` is false) — a compiled install forked a path that was
11
+ * never there, and `spawn()` threw ENOENT.
12
+ * 2. **It runs in this package's module system.** `package.json` is
13
+ * `"type": "module"`, so that same `.js` file was parsed as ESM while being
14
+ * written in CommonJS (`require`, `__dirname`, a `parentPort` import from a
15
+ * worker-thread API that a `fork()`ed process does not have). It died on
16
+ * `require is not defined` before it read a single environment variable.
17
+ *
18
+ * The child reports over the IPC channel `fork()` establishes: `progress` while
19
+ * it works, then exactly one `result` or `error`. The parent treats "exited
20
+ * without a result" as a failure, so this file must never exit 0 silently.
21
+ */
22
+ import { runSubagent } from './child-agent-runtime.js';
23
+ import { SubagentRefusalError } from './subagent-refusal.js';
24
+ // WS6 (#28) — the declared fault seam, read in the CHILD's own process (the
25
+ // declaration reaches it through the environment it inherited).
26
+ import { faultAt } from '../runtime/fault-injection.js';
27
+ function num(raw, fallback) {
28
+ const n = Number(raw);
29
+ return Number.isFinite(n) && n > 0 ? n : fallback;
30
+ }
31
+ /** Env vars the spawner sets; anything malformed falls back rather than throwing. */
32
+ function readConfig() {
33
+ const parseList = (raw) => {
34
+ try {
35
+ const parsed = JSON.parse(raw ?? '[]');
36
+ return Array.isArray(parsed) ? parsed.filter((t) => typeof t === 'string') : [];
37
+ }
38
+ catch {
39
+ return [];
40
+ }
41
+ };
42
+ return {
43
+ goal: process.env.SUBAGENT_GOAL ?? '',
44
+ provider: process.env.SUBAGENT_PROVIDER || 'auto',
45
+ model: process.env.SUBAGENT_MODEL || undefined,
46
+ tools: parseList(process.env.SUBAGENT_TOOLS),
47
+ blockedTools: parseList(process.env.SUBAGENT_BLOCKED_TOOLS),
48
+ maxLlmCalls: num(process.env.SUBAGENT_MAX_LLM_CALLS, 25),
49
+ maxIterations: num(process.env.SUBAGENT_MAX_ITERATIONS, 12),
50
+ cwd: process.cwd(),
51
+ };
52
+ }
53
+ /**
54
+ * The run's identity, as the runtime announced it: which provider, which model it
55
+ * pinned, and which transport carries tool calls.
56
+ *
57
+ * Remembered on the way OUT so the failure frame can carry it too. A child that
58
+ * died before producing a result used to reach the parent as a bare message, so a
59
+ * failed subagent could not be attributed to a backend — the one moment you most
60
+ * want to know which provider/model was serving the run.
61
+ */
62
+ const identity = {};
63
+ function send(msg) {
64
+ if (typeof msg.provider === 'string')
65
+ identity.provider = msg.provider;
66
+ if (typeof msg.model === 'string')
67
+ identity.model = msg.model;
68
+ if (typeof msg.transport === 'string')
69
+ identity.transport = msg.transport;
70
+ try {
71
+ process.send?.(msg);
72
+ }
73
+ catch {
74
+ // A closed IPC channel must not turn a finished task into a crash.
75
+ }
76
+ }
77
+ async function main() {
78
+ // WS6 (#28) — a DECLARED ipc fault: this process dies before it does any work,
79
+ // and deliberately WITHOUT a frame, because a crash is the failure the parent
80
+ // cannot observe from inside its own process. The assertion it exists for is
81
+ // that the parent reports the run as failed rather than hanging on a child that
82
+ // will never speak, or inventing a result for it.
83
+ if (faultAt('ipc', 'child'))
84
+ process.exit(3);
85
+ const config = readConfig();
86
+ if (!config.goal) {
87
+ send({ type: 'error', error: 'SUBAGENT_GOAL is empty — nothing to do.' });
88
+ process.exit(1);
89
+ return;
90
+ }
91
+ try {
92
+ const outcome = await runSubagent(config, { send });
93
+ send({
94
+ type: 'result',
95
+ result: outcome.result,
96
+ llmCalls: outcome.llmCalls,
97
+ toolCalls: outcome.toolCalls,
98
+ provider: outcome.provider,
99
+ // Which model and which tool transport actually served the run — recorded
100
+ // so a finished subagent can be inspected after the fact rather than guessed
101
+ // at from its output.
102
+ ...(outcome.model ? { model: outcome.model } : {}),
103
+ transport: outcome.transport,
104
+ truncated: outcome.truncated,
105
+ // G1 — the child's OWN verification verdict, on the frame like every other
106
+ // fact the parent can only learn across the fork. Without it a delegated run
107
+ // that wrote and verified nothing looked exactly like one that checked its
108
+ // work: the honesty flags live in this process and nowhere else.
109
+ ...(outcome.unverifiedEdit ? { unverifiedEdit: true } : {}),
110
+ ...(outcome.unverifiedEditClaim ? { unverifiedEditClaim: true } : {}),
111
+ });
112
+ process.exit(0);
113
+ }
114
+ catch (err) {
115
+ // The refusal's code crosses the boundary with the message: the parent logs
116
+ // WHY, instead of inferring it from an exit code. The identity rides along so
117
+ // the parent can record which provider/model/transport failed.
118
+ const code = err instanceof SubagentRefusalError ? err.code : 'unavailable';
119
+ send({
120
+ type: 'error',
121
+ code,
122
+ error: err instanceof Error ? err.message : String(err),
123
+ ...identity,
124
+ });
125
+ process.exit(1);
126
+ }
127
+ }
128
+ void main();
129
+ //# sourceMappingURL=child-agent-entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"child-agent-entry.js","sourceRoot":"","sources":["../../src/tools/child-agent-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,WAAW,EAA8B,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAA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