@vauban-org/agent-sdk 0.16.0

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 (1238) hide show
  1. package/CONTRACT.md +6968 -0
  2. package/README.md +205 -0
  3. package/dist/adapters/hitl/memory-state-store.d.ts +23 -0
  4. package/dist/adapters/hitl/memory-state-store.d.ts.map +1 -0
  5. package/dist/adapters/hitl/memory-state-store.js +72 -0
  6. package/dist/adapters/hitl/memory-state-store.js.map +1 -0
  7. package/dist/adapters/hitl/postgres-state-store.d.ts +29 -0
  8. package/dist/adapters/hitl/postgres-state-store.d.ts.map +1 -0
  9. package/dist/adapters/hitl/postgres-state-store.js +103 -0
  10. package/dist/adapters/hitl/postgres-state-store.js.map +1 -0
  11. package/dist/adapters/llm/anthropic-direct.d.ts +28 -0
  12. package/dist/adapters/llm/anthropic-direct.d.ts.map +1 -0
  13. package/dist/adapters/llm/anthropic-direct.js +163 -0
  14. package/dist/adapters/llm/anthropic-direct.js.map +1 -0
  15. package/dist/adapters/llm/cascade.d.ts +27 -0
  16. package/dist/adapters/llm/cascade.d.ts.map +1 -0
  17. package/dist/adapters/llm/cascade.js +88 -0
  18. package/dist/adapters/llm/cascade.js.map +1 -0
  19. package/dist/adapters/llm/litellm.d.ts +28 -0
  20. package/dist/adapters/llm/litellm.d.ts.map +1 -0
  21. package/dist/adapters/llm/litellm.js +239 -0
  22. package/dist/adapters/llm/litellm.js.map +1 -0
  23. package/dist/adapters/messaging/console.d.ts +32 -0
  24. package/dist/adapters/messaging/console.d.ts.map +1 -0
  25. package/dist/adapters/messaging/console.js +47 -0
  26. package/dist/adapters/messaging/console.js.map +1 -0
  27. package/dist/adapters/messaging/discord.d.ts +34 -0
  28. package/dist/adapters/messaging/discord.d.ts.map +1 -0
  29. package/dist/adapters/messaging/discord.js +86 -0
  30. package/dist/adapters/messaging/discord.js.map +1 -0
  31. package/dist/adapters/messaging/mcp.d.ts +53 -0
  32. package/dist/adapters/messaging/mcp.d.ts.map +1 -0
  33. package/dist/adapters/messaging/mcp.js +43 -0
  34. package/dist/adapters/messaging/mcp.js.map +1 -0
  35. package/dist/adapters/messaging/slack.d.ts +21 -0
  36. package/dist/adapters/messaging/slack.d.ts.map +1 -0
  37. package/dist/adapters/messaging/slack.js +71 -0
  38. package/dist/adapters/messaging/slack.js.map +1 -0
  39. package/dist/adapters/messaging/telegram.d.ts +31 -0
  40. package/dist/adapters/messaging/telegram.d.ts.map +1 -0
  41. package/dist/adapters/messaging/telegram.js +85 -0
  42. package/dist/adapters/messaging/telegram.js.map +1 -0
  43. package/dist/adapters/registry/memory.d.ts +40 -0
  44. package/dist/adapters/registry/memory.d.ts.map +1 -0
  45. package/dist/adapters/registry/memory.js +71 -0
  46. package/dist/adapters/registry/memory.js.map +1 -0
  47. package/dist/adapters/registry/postgres.d.ts +39 -0
  48. package/dist/adapters/registry/postgres.d.ts.map +1 -0
  49. package/dist/adapters/registry/postgres.js +124 -0
  50. package/dist/adapters/registry/postgres.js.map +1 -0
  51. package/dist/agents/index.d.ts +2 -0
  52. package/dist/agents/index.d.ts.map +1 -0
  53. package/dist/agents/index.js +3 -0
  54. package/dist/agents/index.js.map +1 -0
  55. package/dist/agents/trading.d.ts +99 -0
  56. package/dist/agents/trading.d.ts.map +1 -0
  57. package/dist/agents/trading.js +39 -0
  58. package/dist/agents/trading.js.map +1 -0
  59. package/dist/auth/errors.d.ts +38 -0
  60. package/dist/auth/errors.d.ts.map +1 -0
  61. package/dist/auth/errors.js +57 -0
  62. package/dist/auth/errors.js.map +1 -0
  63. package/dist/auth/nonce-store.d.ts +52 -0
  64. package/dist/auth/nonce-store.d.ts.map +1 -0
  65. package/dist/auth/nonce-store.js +55 -0
  66. package/dist/auth/nonce-store.js.map +1 -0
  67. package/dist/auth/sign-event.d.ts +28 -0
  68. package/dist/auth/sign-event.d.ts.map +1 -0
  69. package/dist/auth/sign-event.js +42 -0
  70. package/dist/auth/sign-event.js.map +1 -0
  71. package/dist/auth/verify-event.d.ts +36 -0
  72. package/dist/auth/verify-event.d.ts.map +1 -0
  73. package/dist/auth/verify-event.js +78 -0
  74. package/dist/auth/verify-event.js.map +1 -0
  75. package/dist/boot/init-sdk.d.ts +69 -0
  76. package/dist/boot/init-sdk.d.ts.map +1 -0
  77. package/dist/boot/init-sdk.js +53 -0
  78. package/dist/boot/init-sdk.js.map +1 -0
  79. package/dist/boot/load-agent-context.d.ts +82 -0
  80. package/dist/boot/load-agent-context.d.ts.map +1 -0
  81. package/dist/boot/load-agent-context.js +90 -0
  82. package/dist/boot/load-agent-context.js.map +1 -0
  83. package/dist/boot/load-recent-memory.d.ts +47 -0
  84. package/dist/boot/load-recent-memory.d.ts.map +1 -0
  85. package/dist/boot/load-recent-memory.js +56 -0
  86. package/dist/boot/load-recent-memory.js.map +1 -0
  87. package/dist/budget/budget-state.d.ts +88 -0
  88. package/dist/budget/budget-state.d.ts.map +1 -0
  89. package/dist/budget/budget-state.js +172 -0
  90. package/dist/budget/budget-state.js.map +1 -0
  91. package/dist/budget/index.d.ts +3 -0
  92. package/dist/budget/index.d.ts.map +1 -0
  93. package/dist/budget/index.js +2 -0
  94. package/dist/budget/index.js.map +1 -0
  95. package/dist/clients/agents.d.ts +40 -0
  96. package/dist/clients/agents.d.ts.map +1 -0
  97. package/dist/clients/agents.js +85 -0
  98. package/dist/clients/agents.js.map +1 -0
  99. package/dist/clients/index.d.ts +7 -0
  100. package/dist/clients/index.d.ts.map +1 -0
  101. package/dist/clients/index.js +7 -0
  102. package/dist/clients/index.js.map +1 -0
  103. package/dist/clients/messaging-adapters.d.ts +51 -0
  104. package/dist/clients/messaging-adapters.d.ts.map +1 -0
  105. package/dist/clients/messaging-adapters.js +118 -0
  106. package/dist/clients/messaging-adapters.js.map +1 -0
  107. package/dist/clients/pipelines.d.ts +43 -0
  108. package/dist/clients/pipelines.d.ts.map +1 -0
  109. package/dist/clients/pipelines.js +96 -0
  110. package/dist/clients/pipelines.js.map +1 -0
  111. package/dist/compute/strategies/best-of-n.d.ts +46 -0
  112. package/dist/compute/strategies/best-of-n.d.ts.map +1 -0
  113. package/dist/compute/strategies/best-of-n.js +112 -0
  114. package/dist/compute/strategies/best-of-n.js.map +1 -0
  115. package/dist/compute/strategies/bon-mav.d.ts +65 -0
  116. package/dist/compute/strategies/bon-mav.d.ts.map +1 -0
  117. package/dist/compute/strategies/bon-mav.js +154 -0
  118. package/dist/compute/strategies/bon-mav.js.map +1 -0
  119. package/dist/compute/strategies/single-shot.d.ts +17 -0
  120. package/dist/compute/strategies/single-shot.d.ts.map +1 -0
  121. package/dist/compute/strategies/single-shot.js +36 -0
  122. package/dist/compute/strategies/single-shot.js.map +1 -0
  123. package/dist/compute/types.d.ts +30 -0
  124. package/dist/compute/types.d.ts.map +1 -0
  125. package/dist/compute/types.js +8 -0
  126. package/dist/compute/types.js.map +1 -0
  127. package/dist/compute/verifier.d.ts +55 -0
  128. package/dist/compute/verifier.d.ts.map +1 -0
  129. package/dist/compute/verifier.js +35 -0
  130. package/dist/compute/verifier.js.map +1 -0
  131. package/dist/compute/with-compute.d.ts +50 -0
  132. package/dist/compute/with-compute.d.ts.map +1 -0
  133. package/dist/compute/with-compute.js +69 -0
  134. package/dist/compute/with-compute.js.map +1 -0
  135. package/dist/constitution/axioms.d.ts +65 -0
  136. package/dist/constitution/axioms.d.ts.map +1 -0
  137. package/dist/constitution/axioms.js +496 -0
  138. package/dist/constitution/axioms.js.map +1 -0
  139. package/dist/constitution/gate.d.ts +47 -0
  140. package/dist/constitution/gate.d.ts.map +1 -0
  141. package/dist/constitution/gate.js +143 -0
  142. package/dist/constitution/gate.js.map +1 -0
  143. package/dist/constitution/index.d.ts +20 -0
  144. package/dist/constitution/index.d.ts.map +1 -0
  145. package/dist/constitution/index.js +15 -0
  146. package/dist/constitution/index.js.map +1 -0
  147. package/dist/constitution/scorer.d.ts +67 -0
  148. package/dist/constitution/scorer.d.ts.map +1 -0
  149. package/dist/constitution/scorer.js +111 -0
  150. package/dist/constitution/scorer.js.map +1 -0
  151. package/dist/constitution/signal.d.ts +41 -0
  152. package/dist/constitution/signal.d.ts.map +1 -0
  153. package/dist/constitution/signal.js +61 -0
  154. package/dist/constitution/signal.js.map +1 -0
  155. package/dist/constitution/types.d.ts +295 -0
  156. package/dist/constitution/types.d.ts.map +1 -0
  157. package/dist/constitution/types.js +59 -0
  158. package/dist/constitution/types.js.map +1 -0
  159. package/dist/counterfactual/index.d.ts +11 -0
  160. package/dist/counterfactual/index.d.ts.map +1 -0
  161. package/dist/counterfactual/index.js +10 -0
  162. package/dist/counterfactual/index.js.map +1 -0
  163. package/dist/counterfactual/replay-with-alt.d.ts +137 -0
  164. package/dist/counterfactual/replay-with-alt.d.ts.map +1 -0
  165. package/dist/counterfactual/replay-with-alt.js +191 -0
  166. package/dist/counterfactual/replay-with-alt.js.map +1 -0
  167. package/dist/dataops/index.d.ts +5 -0
  168. package/dist/dataops/index.d.ts.map +1 -0
  169. package/dist/dataops/index.js +3 -0
  170. package/dist/dataops/index.js.map +1 -0
  171. package/dist/dataops/starkscan.d.ts +13 -0
  172. package/dist/dataops/starkscan.d.ts.map +1 -0
  173. package/dist/dataops/starkscan.js +12 -0
  174. package/dist/dataops/starkscan.js.map +1 -0
  175. package/dist/dataops/voyager.d.ts +58 -0
  176. package/dist/dataops/voyager.d.ts.map +1 -0
  177. package/dist/dataops/voyager.js +146 -0
  178. package/dist/dataops/voyager.js.map +1 -0
  179. package/dist/deprecation.d.ts +49 -0
  180. package/dist/deprecation.d.ts.map +1 -0
  181. package/dist/deprecation.js +84 -0
  182. package/dist/deprecation.js.map +1 -0
  183. package/dist/durable/bullmq-runner.d.ts +138 -0
  184. package/dist/durable/bullmq-runner.d.ts.map +1 -0
  185. package/dist/durable/bullmq-runner.js +378 -0
  186. package/dist/durable/bullmq-runner.js.map +1 -0
  187. package/dist/durable/index.d.ts +3 -0
  188. package/dist/durable/index.d.ts.map +1 -0
  189. package/dist/durable/index.js +2 -0
  190. package/dist/durable/index.js.map +1 -0
  191. package/dist/economy/circuit-breaker.d.ts +37 -0
  192. package/dist/economy/circuit-breaker.d.ts.map +1 -0
  193. package/dist/economy/circuit-breaker.js +104 -0
  194. package/dist/economy/circuit-breaker.js.map +1 -0
  195. package/dist/economy/economy-router.d.ts +103 -0
  196. package/dist/economy/economy-router.d.ts.map +1 -0
  197. package/dist/economy/economy-router.js +176 -0
  198. package/dist/economy/economy-router.js.map +1 -0
  199. package/dist/economy/index.d.ts +16 -0
  200. package/dist/economy/index.d.ts.map +1 -0
  201. package/dist/economy/index.js +11 -0
  202. package/dist/economy/index.js.map +1 -0
  203. package/dist/economy/outcome-tracker.d.ts +90 -0
  204. package/dist/economy/outcome-tracker.d.ts.map +1 -0
  205. package/dist/economy/outcome-tracker.js +172 -0
  206. package/dist/economy/outcome-tracker.js.map +1 -0
  207. package/dist/economy/router.d.ts +97 -0
  208. package/dist/economy/router.d.ts.map +1 -0
  209. package/dist/economy/router.js +181 -0
  210. package/dist/economy/router.js.map +1 -0
  211. package/dist/economy/tier-policy.d.ts +46 -0
  212. package/dist/economy/tier-policy.d.ts.map +1 -0
  213. package/dist/economy/tier-policy.js +76 -0
  214. package/dist/economy/tier-policy.js.map +1 -0
  215. package/dist/errors.d.ts +102 -0
  216. package/dist/errors.d.ts.map +1 -0
  217. package/dist/errors.js +135 -0
  218. package/dist/errors.js.map +1 -0
  219. package/dist/evals/datasets/index.d.ts +27 -0
  220. package/dist/evals/datasets/index.d.ts.map +1 -0
  221. package/dist/evals/datasets/index.js +279 -0
  222. package/dist/evals/datasets/index.js.map +1 -0
  223. package/dist/evals/harness.d.ts +52 -0
  224. package/dist/evals/harness.d.ts.map +1 -0
  225. package/dist/evals/harness.js +108 -0
  226. package/dist/evals/harness.js.map +1 -0
  227. package/dist/evals/index.d.ts +5 -0
  228. package/dist/evals/index.d.ts.map +1 -0
  229. package/dist/evals/index.js +3 -0
  230. package/dist/evals/index.js.map +1 -0
  231. package/dist/factory/agent-factory.d.ts +86 -0
  232. package/dist/factory/agent-factory.d.ts.map +1 -0
  233. package/dist/factory/agent-factory.js +119 -0
  234. package/dist/factory/agent-factory.js.map +1 -0
  235. package/dist/hitl/api.d.ts +38 -0
  236. package/dist/hitl/api.d.ts.map +1 -0
  237. package/dist/hitl/api.js +58 -0
  238. package/dist/hitl/api.js.map +1 -0
  239. package/dist/hitl/approval-channel.d.ts +84 -0
  240. package/dist/hitl/approval-channel.d.ts.map +1 -0
  241. package/dist/hitl/approval-channel.js +59 -0
  242. package/dist/hitl/approval-channel.js.map +1 -0
  243. package/dist/hitl/callback-handlers.d.ts +21 -0
  244. package/dist/hitl/callback-handlers.d.ts.map +1 -0
  245. package/dist/hitl/callback-handlers.js +30 -0
  246. package/dist/hitl/callback-handlers.js.map +1 -0
  247. package/dist/hitl/index.d.ts +3 -0
  248. package/dist/hitl/index.d.ts.map +1 -0
  249. package/dist/hitl/index.js +2 -0
  250. package/dist/hitl/index.js.map +1 -0
  251. package/dist/hitl/slack.d.ts +76 -0
  252. package/dist/hitl/slack.d.ts.map +1 -0
  253. package/dist/hitl/slack.js +243 -0
  254. package/dist/hitl/slack.js.map +1 -0
  255. package/dist/hitl/telegram.d.ts +74 -0
  256. package/dist/hitl/telegram.d.ts.map +1 -0
  257. package/dist/hitl/telegram.js +227 -0
  258. package/dist/hitl/telegram.js.map +1 -0
  259. package/dist/index.d.ts +173 -0
  260. package/dist/index.d.ts.map +1 -0
  261. package/dist/index.js +147 -0
  262. package/dist/index.js.map +1 -0
  263. package/dist/llm/parse-structured-output.d.ts +55 -0
  264. package/dist/llm/parse-structured-output.d.ts.map +1 -0
  265. package/dist/llm/parse-structured-output.js +80 -0
  266. package/dist/llm/parse-structured-output.js.map +1 -0
  267. package/dist/loop/index.d.ts +7 -0
  268. package/dist/loop/index.d.ts.map +1 -0
  269. package/dist/loop/index.js +5 -0
  270. package/dist/loop/index.js.map +1 -0
  271. package/dist/loop/minimal-loop.d.ts +81 -0
  272. package/dist/loop/minimal-loop.d.ts.map +1 -0
  273. package/dist/loop/minimal-loop.js +318 -0
  274. package/dist/loop/minimal-loop.js.map +1 -0
  275. package/dist/loop/sdk-loop.d.ts +103 -0
  276. package/dist/loop/sdk-loop.d.ts.map +1 -0
  277. package/dist/loop/sdk-loop.js +344 -0
  278. package/dist/loop/sdk-loop.js.map +1 -0
  279. package/dist/mcp/index.d.ts +38 -0
  280. package/dist/mcp/index.d.ts.map +1 -0
  281. package/dist/mcp/index.js +113 -0
  282. package/dist/mcp/index.js.map +1 -0
  283. package/dist/metrics/create-agent-metrics.d.ts +78 -0
  284. package/dist/metrics/create-agent-metrics.d.ts.map +1 -0
  285. package/dist/metrics/create-agent-metrics.js +115 -0
  286. package/dist/metrics/create-agent-metrics.js.map +1 -0
  287. package/dist/orchestration/bulkhead.d.ts +70 -0
  288. package/dist/orchestration/bulkhead.d.ts.map +1 -0
  289. package/dist/orchestration/bulkhead.js +99 -0
  290. package/dist/orchestration/bulkhead.js.map +1 -0
  291. package/dist/orchestration/idempotency.d.ts +52 -0
  292. package/dist/orchestration/idempotency.d.ts.map +1 -0
  293. package/dist/orchestration/idempotency.js +93 -0
  294. package/dist/orchestration/idempotency.js.map +1 -0
  295. package/dist/orchestration/index.d.ts +16 -0
  296. package/dist/orchestration/index.d.ts.map +1 -0
  297. package/dist/orchestration/index.js +15 -0
  298. package/dist/orchestration/index.js.map +1 -0
  299. package/dist/orchestration/ooda/agent-config-loader.d.ts +67 -0
  300. package/dist/orchestration/ooda/agent-config-loader.d.ts.map +1 -0
  301. package/dist/orchestration/ooda/agent-config-loader.js +65 -0
  302. package/dist/orchestration/ooda/agent-config-loader.js.map +1 -0
  303. package/dist/orchestration/ooda/agent.d.ts +54 -0
  304. package/dist/orchestration/ooda/agent.d.ts.map +1 -0
  305. package/dist/orchestration/ooda/agent.js +730 -0
  306. package/dist/orchestration/ooda/agent.js.map +1 -0
  307. package/dist/orchestration/ooda/audit-log.d.ts +26 -0
  308. package/dist/orchestration/ooda/audit-log.d.ts.map +1 -0
  309. package/dist/orchestration/ooda/audit-log.js +41 -0
  310. package/dist/orchestration/ooda/audit-log.js.map +1 -0
  311. package/dist/orchestration/ooda/brain-context.d.ts +121 -0
  312. package/dist/orchestration/ooda/brain-context.d.ts.map +1 -0
  313. package/dist/orchestration/ooda/brain-context.js +149 -0
  314. package/dist/orchestration/ooda/brain-context.js.map +1 -0
  315. package/dist/orchestration/ooda/child-agent.d.ts +55 -0
  316. package/dist/orchestration/ooda/child-agent.d.ts.map +1 -0
  317. package/dist/orchestration/ooda/child-agent.js +16 -0
  318. package/dist/orchestration/ooda/child-agent.js.map +1 -0
  319. package/dist/orchestration/ooda/cron-schedule.d.ts +26 -0
  320. package/dist/orchestration/ooda/cron-schedule.d.ts.map +1 -0
  321. package/dist/orchestration/ooda/cron-schedule.js +94 -0
  322. package/dist/orchestration/ooda/cron-schedule.js.map +1 -0
  323. package/dist/orchestration/ooda/debate.d.ts +68 -0
  324. package/dist/orchestration/ooda/debate.d.ts.map +1 -0
  325. package/dist/orchestration/ooda/debate.js +39 -0
  326. package/dist/orchestration/ooda/debate.js.map +1 -0
  327. package/dist/orchestration/ooda/economic-observer.d.ts +50 -0
  328. package/dist/orchestration/ooda/economic-observer.d.ts.map +1 -0
  329. package/dist/orchestration/ooda/economic-observer.js +36 -0
  330. package/dist/orchestration/ooda/economic-observer.js.map +1 -0
  331. package/dist/orchestration/ooda/errors.d.ts +21 -0
  332. package/dist/orchestration/ooda/errors.d.ts.map +1 -0
  333. package/dist/orchestration/ooda/errors.js +30 -0
  334. package/dist/orchestration/ooda/errors.js.map +1 -0
  335. package/dist/orchestration/ooda/execution-mode-guard.d.ts +24 -0
  336. package/dist/orchestration/ooda/execution-mode-guard.d.ts.map +1 -0
  337. package/dist/orchestration/ooda/execution-mode-guard.js +31 -0
  338. package/dist/orchestration/ooda/execution-mode-guard.js.map +1 -0
  339. package/dist/orchestration/ooda/factory.d.ts +12 -0
  340. package/dist/orchestration/ooda/factory.d.ts.map +1 -0
  341. package/dist/orchestration/ooda/factory.js +27 -0
  342. package/dist/orchestration/ooda/factory.js.map +1 -0
  343. package/dist/orchestration/ooda/guardrails.d.ts +65 -0
  344. package/dist/orchestration/ooda/guardrails.d.ts.map +1 -0
  345. package/dist/orchestration/ooda/guardrails.js +127 -0
  346. package/dist/orchestration/ooda/guardrails.js.map +1 -0
  347. package/dist/orchestration/ooda/guards/always-on.d.ts +15 -0
  348. package/dist/orchestration/ooda/guards/always-on.d.ts.map +1 -0
  349. package/dist/orchestration/ooda/guards/always-on.js +19 -0
  350. package/dist/orchestration/ooda/guards/always-on.js.map +1 -0
  351. package/dist/orchestration/ooda/guards/business-hours.d.ts +46 -0
  352. package/dist/orchestration/ooda/guards/business-hours.d.ts.map +1 -0
  353. package/dist/orchestration/ooda/guards/business-hours.js +78 -0
  354. package/dist/orchestration/ooda/guards/business-hours.js.map +1 -0
  355. package/dist/orchestration/ooda/guards/index.d.ts +14 -0
  356. package/dist/orchestration/ooda/guards/index.d.ts.map +1 -0
  357. package/dist/orchestration/ooda/guards/index.js +14 -0
  358. package/dist/orchestration/ooda/guards/index.js.map +1 -0
  359. package/dist/orchestration/ooda/guards/redis-circuit-breaker.d.ts +84 -0
  360. package/dist/orchestration/ooda/guards/redis-circuit-breaker.d.ts.map +1 -0
  361. package/dist/orchestration/ooda/guards/redis-circuit-breaker.js +96 -0
  362. package/dist/orchestration/ooda/guards/redis-circuit-breaker.js.map +1 -0
  363. package/dist/orchestration/ooda/guards/rth-session.d.ts +27 -0
  364. package/dist/orchestration/ooda/guards/rth-session.d.ts.map +1 -0
  365. package/dist/orchestration/ooda/guards/rth-session.js +95 -0
  366. package/dist/orchestration/ooda/guards/rth-session.js.map +1 -0
  367. package/dist/orchestration/ooda/handoff.d.ts +82 -0
  368. package/dist/orchestration/ooda/handoff.d.ts.map +1 -0
  369. package/dist/orchestration/ooda/handoff.js +86 -0
  370. package/dist/orchestration/ooda/handoff.js.map +1 -0
  371. package/dist/orchestration/ooda/hitl-gate.d.ts +57 -0
  372. package/dist/orchestration/ooda/hitl-gate.d.ts.map +1 -0
  373. package/dist/orchestration/ooda/hitl-gate.js +107 -0
  374. package/dist/orchestration/ooda/hitl-gate.js.map +1 -0
  375. package/dist/orchestration/ooda/index.d.ts +48 -0
  376. package/dist/orchestration/ooda/index.d.ts.map +1 -0
  377. package/dist/orchestration/ooda/index.js +33 -0
  378. package/dist/orchestration/ooda/index.js.map +1 -0
  379. package/dist/orchestration/ooda/inner-monologue.d.ts +69 -0
  380. package/dist/orchestration/ooda/inner-monologue.d.ts.map +1 -0
  381. package/dist/orchestration/ooda/inner-monologue.js +69 -0
  382. package/dist/orchestration/ooda/inner-monologue.js.map +1 -0
  383. package/dist/orchestration/ooda/learn.d.ts +60 -0
  384. package/dist/orchestration/ooda/learn.d.ts.map +1 -0
  385. package/dist/orchestration/ooda/learn.js +94 -0
  386. package/dist/orchestration/ooda/learn.js.map +1 -0
  387. package/dist/orchestration/ooda/multimodal.d.ts +91 -0
  388. package/dist/orchestration/ooda/multimodal.d.ts.map +1 -0
  389. package/dist/orchestration/ooda/multimodal.js +88 -0
  390. package/dist/orchestration/ooda/multimodal.js.map +1 -0
  391. package/dist/orchestration/ooda/phase-routing.d.ts +41 -0
  392. package/dist/orchestration/ooda/phase-routing.d.ts.map +1 -0
  393. package/dist/orchestration/ooda/phase-routing.js +43 -0
  394. package/dist/orchestration/ooda/phase-routing.js.map +1 -0
  395. package/dist/orchestration/ooda/plan-execute.d.ts +55 -0
  396. package/dist/orchestration/ooda/plan-execute.d.ts.map +1 -0
  397. package/dist/orchestration/ooda/plan-execute.js +41 -0
  398. package/dist/orchestration/ooda/plan-execute.js.map +1 -0
  399. package/dist/orchestration/ooda/react-loop.d.ts +96 -0
  400. package/dist/orchestration/ooda/react-loop.d.ts.map +1 -0
  401. package/dist/orchestration/ooda/react-loop.js +90 -0
  402. package/dist/orchestration/ooda/react-loop.js.map +1 -0
  403. package/dist/orchestration/ooda/reflexion.d.ts +56 -0
  404. package/dist/orchestration/ooda/reflexion.d.ts.map +1 -0
  405. package/dist/orchestration/ooda/reflexion.js +58 -0
  406. package/dist/orchestration/ooda/reflexion.js.map +1 -0
  407. package/dist/orchestration/ooda/resource-limits.d.ts +63 -0
  408. package/dist/orchestration/ooda/resource-limits.d.ts.map +1 -0
  409. package/dist/orchestration/ooda/resource-limits.js +107 -0
  410. package/dist/orchestration/ooda/resource-limits.js.map +1 -0
  411. package/dist/orchestration/ooda/run-step-persistence.d.ts +50 -0
  412. package/dist/orchestration/ooda/run-step-persistence.d.ts.map +1 -0
  413. package/dist/orchestration/ooda/run-step-persistence.js +89 -0
  414. package/dist/orchestration/ooda/run-step-persistence.js.map +1 -0
  415. package/dist/orchestration/ooda/skills.d.ts +58 -0
  416. package/dist/orchestration/ooda/skills.d.ts.map +1 -0
  417. package/dist/orchestration/ooda/skills.js +19 -0
  418. package/dist/orchestration/ooda/skills.js.map +1 -0
  419. package/dist/orchestration/ooda/structured-output.d.ts +46 -0
  420. package/dist/orchestration/ooda/structured-output.d.ts.map +1 -0
  421. package/dist/orchestration/ooda/structured-output.js +60 -0
  422. package/dist/orchestration/ooda/structured-output.js.map +1 -0
  423. package/dist/orchestration/ooda/types.d.ts +463 -0
  424. package/dist/orchestration/ooda/types.d.ts.map +1 -0
  425. package/dist/orchestration/ooda/types.js +38 -0
  426. package/dist/orchestration/ooda/types.js.map +1 -0
  427. package/dist/otel/attributes.d.ts +71 -0
  428. package/dist/otel/attributes.d.ts.map +1 -0
  429. package/dist/otel/attributes.js +56 -0
  430. package/dist/otel/attributes.js.map +1 -0
  431. package/dist/otel/index.d.ts +5 -0
  432. package/dist/otel/index.d.ts.map +1 -0
  433. package/dist/otel/index.js +5 -0
  434. package/dist/otel/index.js.map +1 -0
  435. package/dist/otel/ingest.d.ts +99 -0
  436. package/dist/otel/ingest.d.ts.map +1 -0
  437. package/dist/otel/ingest.js +192 -0
  438. package/dist/otel/ingest.js.map +1 -0
  439. package/dist/otel/trace-context.d.ts +48 -0
  440. package/dist/otel/trace-context.d.ts.map +1 -0
  441. package/dist/otel/trace-context.js +137 -0
  442. package/dist/otel/trace-context.js.map +1 -0
  443. package/dist/otel/types.d.ts +54 -0
  444. package/dist/otel/types.d.ts.map +1 -0
  445. package/dist/otel/types.js +12 -0
  446. package/dist/otel/types.js.map +1 -0
  447. package/dist/outcomes/client.d.ts +81 -0
  448. package/dist/outcomes/client.d.ts.map +1 -0
  449. package/dist/outcomes/client.js +98 -0
  450. package/dist/outcomes/client.js.map +1 -0
  451. package/dist/outcomes/compute-roi.d.ts +40 -0
  452. package/dist/outcomes/compute-roi.d.ts.map +1 -0
  453. package/dist/outcomes/compute-roi.js +58 -0
  454. package/dist/outcomes/compute-roi.js.map +1 -0
  455. package/dist/outcomes/index.d.ts +4 -0
  456. package/dist/outcomes/index.d.ts.map +1 -0
  457. package/dist/outcomes/index.js +4 -0
  458. package/dist/outcomes/index.js.map +1 -0
  459. package/dist/outcomes/meter.d.ts +73 -0
  460. package/dist/outcomes/meter.d.ts.map +1 -0
  461. package/dist/outcomes/meter.js +140 -0
  462. package/dist/outcomes/meter.js.map +1 -0
  463. package/dist/outcomes/trajectory.d.ts +53 -0
  464. package/dist/outcomes/trajectory.d.ts.map +1 -0
  465. package/dist/outcomes/trajectory.js +110 -0
  466. package/dist/outcomes/trajectory.js.map +1 -0
  467. package/dist/outcomes/types.d.ts +93 -0
  468. package/dist/outcomes/types.d.ts.map +1 -0
  469. package/dist/outcomes/types.js +8 -0
  470. package/dist/outcomes/types.js.map +1 -0
  471. package/dist/patterns/_shared/brain-logger.d.ts +12 -0
  472. package/dist/patterns/_shared/brain-logger.d.ts.map +1 -0
  473. package/dist/patterns/_shared/brain-logger.js +6 -0
  474. package/dist/patterns/_shared/brain-logger.js.map +1 -0
  475. package/dist/patterns/circuit-breaker/index.d.ts +3 -0
  476. package/dist/patterns/circuit-breaker/index.d.ts.map +1 -0
  477. package/dist/patterns/circuit-breaker/index.js +2 -0
  478. package/dist/patterns/circuit-breaker/index.js.map +1 -0
  479. package/dist/patterns/circuit-breaker/session-cb.d.ts +3 -0
  480. package/dist/patterns/circuit-breaker/session-cb.d.ts.map +1 -0
  481. package/dist/patterns/circuit-breaker/session-cb.js +175 -0
  482. package/dist/patterns/circuit-breaker/session-cb.js.map +1 -0
  483. package/dist/patterns/circuit-breaker/types.d.ts +68 -0
  484. package/dist/patterns/circuit-breaker/types.d.ts.map +1 -0
  485. package/dist/patterns/circuit-breaker/types.js +2 -0
  486. package/dist/patterns/circuit-breaker/types.js.map +1 -0
  487. package/dist/patterns/escalation/index.d.ts +3 -0
  488. package/dist/patterns/escalation/index.d.ts.map +1 -0
  489. package/dist/patterns/escalation/index.js +2 -0
  490. package/dist/patterns/escalation/index.js.map +1 -0
  491. package/dist/patterns/escalation/pyramid.d.ts +3 -0
  492. package/dist/patterns/escalation/pyramid.d.ts.map +1 -0
  493. package/dist/patterns/escalation/pyramid.js +86 -0
  494. package/dist/patterns/escalation/pyramid.js.map +1 -0
  495. package/dist/patterns/escalation/types.d.ts +46 -0
  496. package/dist/patterns/escalation/types.d.ts.map +1 -0
  497. package/dist/patterns/escalation/types.js +2 -0
  498. package/dist/patterns/escalation/types.js.map +1 -0
  499. package/dist/patterns/quality-gate/gate.d.ts +3 -0
  500. package/dist/patterns/quality-gate/gate.d.ts.map +1 -0
  501. package/dist/patterns/quality-gate/gate.js +73 -0
  502. package/dist/patterns/quality-gate/gate.js.map +1 -0
  503. package/dist/patterns/quality-gate/index.d.ts +3 -0
  504. package/dist/patterns/quality-gate/index.d.ts.map +1 -0
  505. package/dist/patterns/quality-gate/index.js +2 -0
  506. package/dist/patterns/quality-gate/index.js.map +1 -0
  507. package/dist/patterns/quality-gate/types.d.ts +41 -0
  508. package/dist/patterns/quality-gate/types.d.ts.map +1 -0
  509. package/dist/patterns/quality-gate/types.js +2 -0
  510. package/dist/patterns/quality-gate/types.js.map +1 -0
  511. package/dist/permissions/capability-gate.d.ts +57 -0
  512. package/dist/permissions/capability-gate.d.ts.map +1 -0
  513. package/dist/permissions/capability-gate.js +26 -0
  514. package/dist/permissions/capability-gate.js.map +1 -0
  515. package/dist/permissions/index.d.ts +3 -0
  516. package/dist/permissions/index.d.ts.map +1 -0
  517. package/dist/permissions/index.js +2 -0
  518. package/dist/permissions/index.js.map +1 -0
  519. package/dist/permissions/renewal-manager.d.ts +49 -0
  520. package/dist/permissions/renewal-manager.d.ts.map +1 -0
  521. package/dist/permissions/renewal-manager.js +60 -0
  522. package/dist/permissions/renewal-manager.js.map +1 -0
  523. package/dist/permissions/sdk-permissions.d.ts +48 -0
  524. package/dist/permissions/sdk-permissions.d.ts.map +1 -0
  525. package/dist/permissions/sdk-permissions.js +94 -0
  526. package/dist/permissions/sdk-permissions.js.map +1 -0
  527. package/dist/ports/agent-registry.d.ts +95 -0
  528. package/dist/ports/agent-registry.d.ts.map +1 -0
  529. package/dist/ports/agent-registry.js +16 -0
  530. package/dist/ports/agent-registry.js.map +1 -0
  531. package/dist/ports/brain.d.ts +147 -0
  532. package/dist/ports/brain.d.ts.map +1 -0
  533. package/dist/ports/brain.js +105 -0
  534. package/dist/ports/brain.js.map +1 -0
  535. package/dist/ports/db.d.ts +8 -0
  536. package/dist/ports/db.d.ts.map +1 -0
  537. package/dist/ports/db.js +2 -0
  538. package/dist/ports/db.js.map +1 -0
  539. package/dist/ports/event-bus.d.ts +167 -0
  540. package/dist/ports/event-bus.d.ts.map +1 -0
  541. package/dist/ports/event-bus.js +25 -0
  542. package/dist/ports/event-bus.js.map +1 -0
  543. package/dist/ports/eviction-policy.d.ts +92 -0
  544. package/dist/ports/eviction-policy.d.ts.map +1 -0
  545. package/dist/ports/eviction-policy.js +120 -0
  546. package/dist/ports/eviction-policy.js.map +1 -0
  547. package/dist/ports/hitl.contract.test.d.ts +9 -0
  548. package/dist/ports/hitl.contract.test.d.ts.map +1 -0
  549. package/dist/ports/hitl.contract.test.js +100 -0
  550. package/dist/ports/hitl.contract.test.js.map +1 -0
  551. package/dist/ports/hitl.d.ts +91 -0
  552. package/dist/ports/hitl.d.ts.map +1 -0
  553. package/dist/ports/hitl.js +76 -0
  554. package/dist/ports/hitl.js.map +1 -0
  555. package/dist/ports/index.d.ts +19 -0
  556. package/dist/ports/index.d.ts.map +1 -0
  557. package/dist/ports/index.js +4 -0
  558. package/dist/ports/index.js.map +1 -0
  559. package/dist/ports/key-provider.d.ts +113 -0
  560. package/dist/ports/key-provider.d.ts.map +1 -0
  561. package/dist/ports/key-provider.js +119 -0
  562. package/dist/ports/key-provider.js.map +1 -0
  563. package/dist/ports/llm-provider.contract.d.ts +24 -0
  564. package/dist/ports/llm-provider.contract.d.ts.map +1 -0
  565. package/dist/ports/llm-provider.contract.js +111 -0
  566. package/dist/ports/llm-provider.contract.js.map +1 -0
  567. package/dist/ports/llm-provider.d.ts +63 -0
  568. package/dist/ports/llm-provider.d.ts.map +1 -0
  569. package/dist/ports/llm-provider.js +13 -0
  570. package/dist/ports/llm-provider.js.map +1 -0
  571. package/dist/ports/logger.d.ts +18 -0
  572. package/dist/ports/logger.d.ts.map +1 -0
  573. package/dist/ports/logger.js +10 -0
  574. package/dist/ports/logger.js.map +1 -0
  575. package/dist/ports/messaging.contract.test.d.ts +22 -0
  576. package/dist/ports/messaging.contract.test.d.ts.map +1 -0
  577. package/dist/ports/messaging.contract.test.js +296 -0
  578. package/dist/ports/messaging.contract.test.js.map +1 -0
  579. package/dist/ports/messaging.d.ts +47 -0
  580. package/dist/ports/messaging.d.ts.map +1 -0
  581. package/dist/ports/messaging.js +24 -0
  582. package/dist/ports/messaging.js.map +1 -0
  583. package/dist/ports/outcome.d.ts +25 -0
  584. package/dist/ports/outcome.d.ts.map +1 -0
  585. package/dist/ports/outcome.js +9 -0
  586. package/dist/ports/outcome.js.map +1 -0
  587. package/dist/ports/timestamp.d.ts +53 -0
  588. package/dist/ports/timestamp.d.ts.map +1 -0
  589. package/dist/ports/timestamp.js +28 -0
  590. package/dist/ports/timestamp.js.map +1 -0
  591. package/dist/privacy/channel.d.ts +137 -0
  592. package/dist/privacy/channel.d.ts.map +1 -0
  593. package/dist/privacy/channel.js +196 -0
  594. package/dist/privacy/channel.js.map +1 -0
  595. package/dist/privacy/composition.d.ts +140 -0
  596. package/dist/privacy/composition.d.ts.map +1 -0
  597. package/dist/privacy/composition.js +182 -0
  598. package/dist/privacy/composition.js.map +1 -0
  599. package/dist/privacy/delegation.d.ts +87 -0
  600. package/dist/privacy/delegation.d.ts.map +1 -0
  601. package/dist/privacy/delegation.js +67 -0
  602. package/dist/privacy/delegation.js.map +1 -0
  603. package/dist/privacy/index.d.ts +25 -0
  604. package/dist/privacy/index.d.ts.map +1 -0
  605. package/dist/privacy/index.js +21 -0
  606. package/dist/privacy/index.js.map +1 -0
  607. package/dist/privacy/nullifier.d.ts +59 -0
  608. package/dist/privacy/nullifier.d.ts.map +1 -0
  609. package/dist/privacy/nullifier.js +70 -0
  610. package/dist/privacy/nullifier.js.map +1 -0
  611. package/dist/privacy/poseidon-felt252.d.ts +35 -0
  612. package/dist/privacy/poseidon-felt252.d.ts.map +1 -0
  613. package/dist/privacy/poseidon-felt252.js +93 -0
  614. package/dist/privacy/poseidon-felt252.js.map +1 -0
  615. package/dist/privacy/uar.d.ts +170 -0
  616. package/dist/privacy/uar.d.ts.map +1 -0
  617. package/dist/privacy/uar.js +150 -0
  618. package/dist/privacy/uar.js.map +1 -0
  619. package/dist/prompts/build-orient-prompt.d.ts +41 -0
  620. package/dist/prompts/build-orient-prompt.d.ts.map +1 -0
  621. package/dist/prompts/build-orient-prompt.js +40 -0
  622. package/dist/prompts/build-orient-prompt.js.map +1 -0
  623. package/dist/proof/chain.d.ts +90 -0
  624. package/dist/proof/chain.d.ts.map +1 -0
  625. package/dist/proof/chain.js +177 -0
  626. package/dist/proof/chain.js.map +1 -0
  627. package/dist/proof/fallback-adapter.d.ts +50 -0
  628. package/dist/proof/fallback-adapter.d.ts.map +1 -0
  629. package/dist/proof/fallback-adapter.js +99 -0
  630. package/dist/proof/fallback-adapter.js.map +1 -0
  631. package/dist/proof/index.d.ts +35 -0
  632. package/dist/proof/index.d.ts.map +1 -0
  633. package/dist/proof/index.js +161 -0
  634. package/dist/proof/index.js.map +1 -0
  635. package/dist/proof/load.d.ts +27 -0
  636. package/dist/proof/load.d.ts.map +1 -0
  637. package/dist/proof/load.js +44 -0
  638. package/dist/proof/load.js.map +1 -0
  639. package/dist/proof/otel.d.ts +25 -0
  640. package/dist/proof/otel.d.ts.map +1 -0
  641. package/dist/proof/otel.js +57 -0
  642. package/dist/proof/otel.js.map +1 -0
  643. package/dist/proof/receipt-queue.d.ts +97 -0
  644. package/dist/proof/receipt-queue.d.ts.map +1 -0
  645. package/dist/proof/receipt-queue.js +131 -0
  646. package/dist/proof/receipt-queue.js.map +1 -0
  647. package/dist/proof/sha256.d.ts +27 -0
  648. package/dist/proof/sha256.d.ts.map +1 -0
  649. package/dist/proof/sha256.js +65 -0
  650. package/dist/proof/sha256.js.map +1 -0
  651. package/dist/proof/types.d.ts +55 -0
  652. package/dist/proof/types.d.ts.map +1 -0
  653. package/dist/proof/types.js +10 -0
  654. package/dist/proof/types.js.map +1 -0
  655. package/dist/proof/verify.d.ts +28 -0
  656. package/dist/proof/verify.d.ts.map +1 -0
  657. package/dist/proof/verify.js +70 -0
  658. package/dist/proof/verify.js.map +1 -0
  659. package/dist/registry/agent-capability.d.ts +29 -0
  660. package/dist/registry/agent-capability.d.ts.map +1 -0
  661. package/dist/registry/agent-capability.js +21 -0
  662. package/dist/registry/agent-capability.js.map +1 -0
  663. package/dist/registry/agent-card.d.ts +86 -0
  664. package/dist/registry/agent-card.d.ts.map +1 -0
  665. package/dist/registry/agent-card.js +80 -0
  666. package/dist/registry/agent-card.js.map +1 -0
  667. package/dist/registry/agent-ids.d.ts +30 -0
  668. package/dist/registry/agent-ids.d.ts.map +1 -0
  669. package/dist/registry/agent-ids.js +46 -0
  670. package/dist/registry/agent-ids.js.map +1 -0
  671. package/dist/registry/agent-registry.d.ts +104 -0
  672. package/dist/registry/agent-registry.d.ts.map +1 -0
  673. package/dist/registry/agent-registry.js +277 -0
  674. package/dist/registry/agent-registry.js.map +1 -0
  675. package/dist/registry/index.d.ts +7 -0
  676. package/dist/registry/index.d.ts.map +1 -0
  677. package/dist/registry/index.js +4 -0
  678. package/dist/registry/index.js.map +1 -0
  679. package/dist/replay/clock.d.ts +69 -0
  680. package/dist/replay/clock.d.ts.map +1 -0
  681. package/dist/replay/clock.js +84 -0
  682. package/dist/replay/clock.js.map +1 -0
  683. package/dist/replay/cross-cycle.d.ts +143 -0
  684. package/dist/replay/cross-cycle.d.ts.map +1 -0
  685. package/dist/replay/cross-cycle.js +271 -0
  686. package/dist/replay/cross-cycle.js.map +1 -0
  687. package/dist/replay/http-vcr.d.ts +46 -0
  688. package/dist/replay/http-vcr.d.ts.map +1 -0
  689. package/dist/replay/http-vcr.js +87 -0
  690. package/dist/replay/http-vcr.js.map +1 -0
  691. package/dist/replay/index.d.ts +18 -0
  692. package/dist/replay/index.d.ts.map +1 -0
  693. package/dist/replay/index.js +18 -0
  694. package/dist/replay/index.js.map +1 -0
  695. package/dist/replay/llm-cache.d.ts +126 -0
  696. package/dist/replay/llm-cache.d.ts.map +1 -0
  697. package/dist/replay/llm-cache.js +114 -0
  698. package/dist/replay/llm-cache.js.map +1 -0
  699. package/dist/replay/random.d.ts +114 -0
  700. package/dist/replay/random.d.ts.map +1 -0
  701. package/dist/replay/random.js +183 -0
  702. package/dist/replay/random.js.map +1 -0
  703. package/dist/replay/replay.d.ts +160 -0
  704. package/dist/replay/replay.d.ts.map +1 -0
  705. package/dist/replay/replay.js +115 -0
  706. package/dist/replay/replay.js.map +1 -0
  707. package/dist/resilience/bulkhead.d.ts +37 -0
  708. package/dist/resilience/bulkhead.d.ts.map +1 -0
  709. package/dist/resilience/bulkhead.js +65 -0
  710. package/dist/resilience/bulkhead.js.map +1 -0
  711. package/dist/resilience/circuit-breaker.d.ts +56 -0
  712. package/dist/resilience/circuit-breaker.d.ts.map +1 -0
  713. package/dist/resilience/circuit-breaker.js +93 -0
  714. package/dist/resilience/circuit-breaker.js.map +1 -0
  715. package/dist/resilience/idempotent.d.ts +61 -0
  716. package/dist/resilience/idempotent.d.ts.map +1 -0
  717. package/dist/resilience/idempotent.js +103 -0
  718. package/dist/resilience/idempotent.js.map +1 -0
  719. package/dist/resilience/index.d.ts +28 -0
  720. package/dist/resilience/index.d.ts.map +1 -0
  721. package/dist/resilience/index.js +25 -0
  722. package/dist/resilience/index.js.map +1 -0
  723. package/dist/router/index.d.ts +3 -0
  724. package/dist/router/index.d.ts.map +1 -0
  725. package/dist/router/index.js +2 -0
  726. package/dist/router/index.js.map +1 -0
  727. package/dist/router/provider-router.d.ts +61 -0
  728. package/dist/router/provider-router.d.ts.map +1 -0
  729. package/dist/router/provider-router.js +214 -0
  730. package/dist/router/provider-router.js.map +1 -0
  731. package/dist/runs/health.d.ts +24 -0
  732. package/dist/runs/health.d.ts.map +1 -0
  733. package/dist/runs/health.js +52 -0
  734. package/dist/runs/health.js.map +1 -0
  735. package/dist/runs/index.d.ts +4 -0
  736. package/dist/runs/index.d.ts.map +1 -0
  737. package/dist/runs/index.js +4 -0
  738. package/dist/runs/index.js.map +1 -0
  739. package/dist/runs/subscribe.d.ts +34 -0
  740. package/dist/runs/subscribe.d.ts.map +1 -0
  741. package/dist/runs/subscribe.js +228 -0
  742. package/dist/runs/subscribe.js.map +1 -0
  743. package/dist/runs/types.d.ts +53 -0
  744. package/dist/runs/types.d.ts.map +1 -0
  745. package/dist/runs/types.js +11 -0
  746. package/dist/runs/types.js.map +1 -0
  747. package/dist/safety/immune.d.ts +62 -0
  748. package/dist/safety/immune.d.ts.map +1 -0
  749. package/dist/safety/immune.js +109 -0
  750. package/dist/safety/immune.js.map +1 -0
  751. package/dist/safety/index.d.ts +3 -0
  752. package/dist/safety/index.d.ts.map +1 -0
  753. package/dist/safety/index.js +2 -0
  754. package/dist/safety/index.js.map +1 -0
  755. package/dist/safety/sanitize.d.ts +71 -0
  756. package/dist/safety/sanitize.d.ts.map +1 -0
  757. package/dist/safety/sanitize.js +139 -0
  758. package/dist/safety/sanitize.js.map +1 -0
  759. package/dist/sdk-permission-mapping.d.ts +41 -0
  760. package/dist/sdk-permission-mapping.d.ts.map +1 -0
  761. package/dist/sdk-permission-mapping.js +96 -0
  762. package/dist/sdk-permission-mapping.js.map +1 -0
  763. package/dist/skills/_otel.d.ts +2 -0
  764. package/dist/skills/_otel.d.ts.map +1 -0
  765. package/dist/skills/_otel.js +29 -0
  766. package/dist/skills/_otel.js.map +1 -0
  767. package/dist/skills/alpaca-quote.d.ts +30 -0
  768. package/dist/skills/alpaca-quote.d.ts.map +1 -0
  769. package/dist/skills/alpaca-quote.js +70 -0
  770. package/dist/skills/alpaca-quote.js.map +1 -0
  771. package/dist/skills/base-skills.d.ts +30 -0
  772. package/dist/skills/base-skills.d.ts.map +1 -0
  773. package/dist/skills/base-skills.js +26 -0
  774. package/dist/skills/base-skills.js.map +1 -0
  775. package/dist/skills/brain-query.d.ts +34 -0
  776. package/dist/skills/brain-query.d.ts.map +1 -0
  777. package/dist/skills/brain-query.js +46 -0
  778. package/dist/skills/brain-query.js.map +1 -0
  779. package/dist/skills/brain-store.d.ts +44 -0
  780. package/dist/skills/brain-store.d.ts.map +1 -0
  781. package/dist/skills/brain-store.js +55 -0
  782. package/dist/skills/brain-store.js.map +1 -0
  783. package/dist/skills/calendar-check.d.ts +37 -0
  784. package/dist/skills/calendar-check.d.ts.map +1 -0
  785. package/dist/skills/calendar-check.js +87 -0
  786. package/dist/skills/calendar-check.js.map +1 -0
  787. package/dist/skills/cboe-vix-spot.d.ts +24 -0
  788. package/dist/skills/cboe-vix-spot.d.ts.map +1 -0
  789. package/dist/skills/cboe-vix-spot.js +70 -0
  790. package/dist/skills/cboe-vix-spot.js.map +1 -0
  791. package/dist/skills/errors.d.ts +33 -0
  792. package/dist/skills/errors.d.ts.map +1 -0
  793. package/dist/skills/errors.js +50 -0
  794. package/dist/skills/errors.js.map +1 -0
  795. package/dist/skills/hitl-request.d.ts +39 -0
  796. package/dist/skills/hitl-request.d.ts.map +1 -0
  797. package/dist/skills/hitl-request.js +55 -0
  798. package/dist/skills/hitl-request.js.map +1 -0
  799. package/dist/skills/http-fetch.d.ts +32 -0
  800. package/dist/skills/http-fetch.d.ts.map +1 -0
  801. package/dist/skills/http-fetch.js +82 -0
  802. package/dist/skills/http-fetch.js.map +1 -0
  803. package/dist/skills/index.d.ts +46 -0
  804. package/dist/skills/index.d.ts.map +1 -0
  805. package/dist/skills/index.js +32 -0
  806. package/dist/skills/index.js.map +1 -0
  807. package/dist/skills/record-outcome.d.ts +49 -0
  808. package/dist/skills/record-outcome.d.ts.map +1 -0
  809. package/dist/skills/record-outcome.js +104 -0
  810. package/dist/skills/record-outcome.js.map +1 -0
  811. package/dist/skills/run-sql-query.d.ts +33 -0
  812. package/dist/skills/run-sql-query.d.ts.map +1 -0
  813. package/dist/skills/run-sql-query.js +78 -0
  814. package/dist/skills/run-sql-query.js.map +1 -0
  815. package/dist/skills/send-email.d.ts +39 -0
  816. package/dist/skills/send-email.d.ts.map +1 -0
  817. package/dist/skills/send-email.js +100 -0
  818. package/dist/skills/send-email.js.map +1 -0
  819. package/dist/skills/skill-ledger.d.ts +62 -0
  820. package/dist/skills/skill-ledger.d.ts.map +1 -0
  821. package/dist/skills/skill-ledger.js +40 -0
  822. package/dist/skills/skill-ledger.js.map +1 -0
  823. package/dist/skills/skill-registry-builder.d.ts +91 -0
  824. package/dist/skills/skill-registry-builder.d.ts.map +1 -0
  825. package/dist/skills/skill-registry-builder.js +173 -0
  826. package/dist/skills/skill-registry-builder.js.map +1 -0
  827. package/dist/skills/slack-notify.d.ts +43 -0
  828. package/dist/skills/slack-notify.d.ts.map +1 -0
  829. package/dist/skills/slack-notify.js +70 -0
  830. package/dist/skills/slack-notify.js.map +1 -0
  831. package/dist/skills/starknet-balance.d.ts +34 -0
  832. package/dist/skills/starknet-balance.d.ts.map +1 -0
  833. package/dist/skills/starknet-balance.js +91 -0
  834. package/dist/skills/starknet-balance.js.map +1 -0
  835. package/dist/skills/telegram-notify.d.ts +44 -0
  836. package/dist/skills/telegram-notify.d.ts.map +1 -0
  837. package/dist/skills/telegram-notify.js +71 -0
  838. package/dist/skills/telegram-notify.js.map +1 -0
  839. package/dist/skills/web-search.d.ts +32 -0
  840. package/dist/skills/web-search.d.ts.map +1 -0
  841. package/dist/skills/web-search.js +84 -0
  842. package/dist/skills/web-search.js.map +1 -0
  843. package/dist/templates/complex-agent.d.ts +105 -0
  844. package/dist/templates/complex-agent.d.ts.map +1 -0
  845. package/dist/templates/complex-agent.js +94 -0
  846. package/dist/templates/complex-agent.js.map +1 -0
  847. package/dist/templates/index.d.ts +17 -0
  848. package/dist/templates/index.d.ts.map +1 -0
  849. package/dist/templates/index.js +14 -0
  850. package/dist/templates/index.js.map +1 -0
  851. package/dist/templates/reasoning-agent.d.ts +160 -0
  852. package/dist/templates/reasoning-agent.d.ts.map +1 -0
  853. package/dist/templates/reasoning-agent.js +119 -0
  854. package/dist/templates/reasoning-agent.js.map +1 -0
  855. package/dist/templates/simple-agent.d.ts +108 -0
  856. package/dist/templates/simple-agent.d.ts.map +1 -0
  857. package/dist/templates/simple-agent.js +84 -0
  858. package/dist/templates/simple-agent.js.map +1 -0
  859. package/dist/testing/brain-conformance.d.ts +45 -0
  860. package/dist/testing/brain-conformance.d.ts.map +1 -0
  861. package/dist/testing/brain-conformance.js +68 -0
  862. package/dist/testing/brain-conformance.js.map +1 -0
  863. package/dist/testing/chaos.d.ts +126 -0
  864. package/dist/testing/chaos.d.ts.map +1 -0
  865. package/dist/testing/chaos.js +176 -0
  866. package/dist/testing/chaos.js.map +1 -0
  867. package/dist/testing/contracts/brain-port.contract.d.ts +23 -0
  868. package/dist/testing/contracts/brain-port.contract.d.ts.map +1 -0
  869. package/dist/testing/contracts/brain-port.contract.js +79 -0
  870. package/dist/testing/contracts/brain-port.contract.js.map +1 -0
  871. package/dist/testing/contracts/economic-observer.contract.d.ts +23 -0
  872. package/dist/testing/contracts/economic-observer.contract.d.ts.map +1 -0
  873. package/dist/testing/contracts/economic-observer.contract.js +71 -0
  874. package/dist/testing/contracts/economic-observer.contract.js.map +1 -0
  875. package/dist/testing/contracts/event-bus.contract.d.ts +30 -0
  876. package/dist/testing/contracts/event-bus.contract.d.ts.map +1 -0
  877. package/dist/testing/contracts/event-bus.contract.js +216 -0
  878. package/dist/testing/contracts/event-bus.contract.js.map +1 -0
  879. package/dist/testing/db-conformance.d.ts +22 -0
  880. package/dist/testing/db-conformance.d.ts.map +1 -0
  881. package/dist/testing/db-conformance.js +25 -0
  882. package/dist/testing/db-conformance.js.map +1 -0
  883. package/dist/testing/eval.d.ts +61 -0
  884. package/dist/testing/eval.d.ts.map +1 -0
  885. package/dist/testing/eval.js +98 -0
  886. package/dist/testing/eval.js.map +1 -0
  887. package/dist/testing/index.d.ts +32 -0
  888. package/dist/testing/index.d.ts.map +1 -0
  889. package/dist/testing/index.js +38 -0
  890. package/dist/testing/index.js.map +1 -0
  891. package/dist/testing/integration-harness.d.ts +45 -0
  892. package/dist/testing/integration-harness.d.ts.map +1 -0
  893. package/dist/testing/integration-harness.js +57 -0
  894. package/dist/testing/integration-harness.js.map +1 -0
  895. package/dist/testing/logger-conformance.d.ts +16 -0
  896. package/dist/testing/logger-conformance.d.ts.map +1 -0
  897. package/dist/testing/logger-conformance.js +43 -0
  898. package/dist/testing/logger-conformance.js.map +1 -0
  899. package/dist/testing/outcome-conformance.d.ts +17 -0
  900. package/dist/testing/outcome-conformance.d.ts.map +1 -0
  901. package/dist/testing/outcome-conformance.js +50 -0
  902. package/dist/testing/outcome-conformance.js.map +1 -0
  903. package/dist/testing/runner.d.ts +19 -0
  904. package/dist/testing/runner.d.ts.map +1 -0
  905. package/dist/testing/runner.js +9 -0
  906. package/dist/testing/runner.js.map +1 -0
  907. package/dist/testing/test-brain-port.d.ts +25 -0
  908. package/dist/testing/test-brain-port.d.ts.map +1 -0
  909. package/dist/testing/test-brain-port.js +54 -0
  910. package/dist/testing/test-brain-port.js.map +1 -0
  911. package/dist/testing/test-child-agent.d.ts +32 -0
  912. package/dist/testing/test-child-agent.d.ts.map +1 -0
  913. package/dist/testing/test-child-agent.js +59 -0
  914. package/dist/testing/test-child-agent.js.map +1 -0
  915. package/dist/testing/test-event-bus.d.ts +57 -0
  916. package/dist/testing/test-event-bus.d.ts.map +1 -0
  917. package/dist/testing/test-event-bus.js +191 -0
  918. package/dist/testing/test-event-bus.js.map +1 -0
  919. package/dist/tools/index.d.ts +5 -0
  920. package/dist/tools/index.d.ts.map +1 -0
  921. package/dist/tools/index.js +4 -0
  922. package/dist/tools/index.js.map +1 -0
  923. package/dist/tools/registry.d.ts +20 -0
  924. package/dist/tools/registry.d.ts.map +1 -0
  925. package/dist/tools/registry.js +102 -0
  926. package/dist/tools/registry.js.map +1 -0
  927. package/dist/tools/types.d.ts +85 -0
  928. package/dist/tools/types.d.ts.map +1 -0
  929. package/dist/tools/types.js +13 -0
  930. package/dist/tools/types.js.map +1 -0
  931. package/dist/tools/zod-to-json-schema.d.ts +11 -0
  932. package/dist/tools/zod-to-json-schema.d.ts.map +1 -0
  933. package/dist/tools/zod-to-json-schema.js +92 -0
  934. package/dist/tools/zod-to-json-schema.js.map +1 -0
  935. package/dist/trace/canonical.d.ts +37 -0
  936. package/dist/trace/canonical.d.ts.map +1 -0
  937. package/dist/trace/canonical.js +139 -0
  938. package/dist/trace/canonical.js.map +1 -0
  939. package/dist/trace/policy.d.ts +103 -0
  940. package/dist/trace/policy.d.ts.map +1 -0
  941. package/dist/trace/policy.js +137 -0
  942. package/dist/trace/policy.js.map +1 -0
  943. package/dist/trace/schema.d.ts +195 -0
  944. package/dist/trace/schema.d.ts.map +1 -0
  945. package/dist/trace/schema.js +18 -0
  946. package/dist/trace/schema.js.map +1 -0
  947. package/dist/trace/strict-pii-detector.d.ts +28 -0
  948. package/dist/trace/strict-pii-detector.d.ts.map +1 -0
  949. package/dist/trace/strict-pii-detector.js +144 -0
  950. package/dist/trace/strict-pii-detector.js.map +1 -0
  951. package/dist/tracing/traced-port.d.ts +50 -0
  952. package/dist/tracing/traced-port.d.ts.map +1 -0
  953. package/dist/tracing/traced-port.js +108 -0
  954. package/dist/tracing/traced-port.js.map +1 -0
  955. package/dist/tracking/agent-run-tracker.d.ts +63 -0
  956. package/dist/tracking/agent-run-tracker.d.ts.map +1 -0
  957. package/dist/tracking/agent-run-tracker.js +132 -0
  958. package/dist/tracking/agent-run-tracker.js.map +1 -0
  959. package/dist/tracking/gen-ai.d.ts +54 -0
  960. package/dist/tracking/gen-ai.d.ts.map +1 -0
  961. package/dist/tracking/gen-ai.js +101 -0
  962. package/dist/tracking/gen-ai.js.map +1 -0
  963. package/dist/tracking/index.d.ts +4 -0
  964. package/dist/tracking/index.d.ts.map +1 -0
  965. package/dist/tracking/index.js +3 -0
  966. package/dist/tracking/index.js.map +1 -0
  967. package/dist/types/agent.d.ts +84 -0
  968. package/dist/types/agent.d.ts.map +1 -0
  969. package/dist/types/agent.js +13 -0
  970. package/dist/types/agent.js.map +1 -0
  971. package/dist/types/agent.test.d.ts +11 -0
  972. package/dist/types/agent.test.d.ts.map +1 -0
  973. package/dist/types/agent.test.js +144 -0
  974. package/dist/types/agent.test.js.map +1 -0
  975. package/dist/types/escalation-mapping.d.ts +30 -0
  976. package/dist/types/escalation-mapping.d.ts.map +1 -0
  977. package/dist/types/escalation-mapping.js +32 -0
  978. package/dist/types/escalation-mapping.js.map +1 -0
  979. package/docs/byom.md +106 -0
  980. package/docs/contributing.md +139 -0
  981. package/docs/economy.md +159 -0
  982. package/docs/getting-started.md +179 -0
  983. package/docs/index.md +57 -0
  984. package/docs/migration/0.15-to-0.17.md +227 -0
  985. package/docs/papers/bon-mav-notes.md +36 -0
  986. package/docs/patterns.md +138 -0
  987. package/docs/platforms.md +137 -0
  988. package/docs/ports/agent-registry.md +100 -0
  989. package/docs/ports/event-bus.md +131 -0
  990. package/docs/ports/hitl.md +105 -0
  991. package/docs/ports/llm-provider.md +125 -0
  992. package/docs/ports/messaging.md +94 -0
  993. package/docs/templates.md +165 -0
  994. package/package.json +160 -0
  995. package/src/adapters/hitl/memory-state-store.ts +96 -0
  996. package/src/adapters/hitl/postgres-state-store.ts +147 -0
  997. package/src/adapters/llm/anthropic-direct.ts +212 -0
  998. package/src/adapters/llm/cascade.ts +109 -0
  999. package/src/adapters/llm/litellm.ts +300 -0
  1000. package/src/adapters/messaging/console.ts +73 -0
  1001. package/src/adapters/messaging/discord.ts +125 -0
  1002. package/src/adapters/messaging/mcp.ts +84 -0
  1003. package/src/adapters/messaging/slack.ts +109 -0
  1004. package/src/adapters/messaging/telegram.ts +134 -0
  1005. package/src/adapters/registry/memory.ts +84 -0
  1006. package/src/adapters/registry/postgres.ts +166 -0
  1007. package/src/agents/index.ts +2 -0
  1008. package/src/agents/trading.ts +114 -0
  1009. package/src/auth/errors.ts +66 -0
  1010. package/src/auth/nonce-store.ts +79 -0
  1011. package/src/auth/sign-event.ts +51 -0
  1012. package/src/auth/verify-event.ts +112 -0
  1013. package/src/boot/init-sdk.ts +92 -0
  1014. package/src/boot/load-agent-context.ts +164 -0
  1015. package/src/boot/load-recent-memory.ts +92 -0
  1016. package/src/budget/budget-state.ts +234 -0
  1017. package/src/budget/index.ts +11 -0
  1018. package/src/clients/agents.ts +140 -0
  1019. package/src/clients/index.ts +6 -0
  1020. package/src/clients/messaging-adapters.ts +173 -0
  1021. package/src/clients/pipelines.ts +160 -0
  1022. package/src/compute/strategies/best-of-n.ts +162 -0
  1023. package/src/compute/strategies/bon-mav.ts +221 -0
  1024. package/src/compute/strategies/single-shot.ts +45 -0
  1025. package/src/compute/types.ts +36 -0
  1026. package/src/compute/verifier.ts +84 -0
  1027. package/src/compute/with-compute.ts +108 -0
  1028. package/src/constitution/axioms.ts +548 -0
  1029. package/src/constitution/gate.ts +180 -0
  1030. package/src/constitution/index.ts +53 -0
  1031. package/src/constitution/scorer.ts +170 -0
  1032. package/src/constitution/signal.ts +114 -0
  1033. package/src/constitution/types.ts +195 -0
  1034. package/src/counterfactual/index.ts +20 -0
  1035. package/src/counterfactual/replay-with-alt.ts +357 -0
  1036. package/src/dataops/index.ts +4 -0
  1037. package/src/dataops/starkscan.ts +13 -0
  1038. package/src/dataops/voyager.ts +215 -0
  1039. package/src/deprecation.ts +102 -0
  1040. package/src/durable/bullmq-runner.ts +560 -0
  1041. package/src/durable/index.ts +11 -0
  1042. package/src/economy/circuit-breaker.ts +130 -0
  1043. package/src/economy/economy-router.ts +242 -0
  1044. package/src/economy/index.ts +28 -0
  1045. package/src/economy/outcome-tracker.ts +228 -0
  1046. package/src/economy/router.ts +246 -0
  1047. package/src/economy/tier-policy.ts +116 -0
  1048. package/src/errors.ts +159 -0
  1049. package/src/evals/datasets/index.ts +343 -0
  1050. package/src/evals/harness.ts +171 -0
  1051. package/src/evals/index.ts +4 -0
  1052. package/src/factory/agent-factory.ts +261 -0
  1053. package/src/hitl/api.ts +78 -0
  1054. package/src/hitl/approval-channel.ts +128 -0
  1055. package/src/hitl/callback-handlers.ts +61 -0
  1056. package/src/hitl/index.ts +9 -0
  1057. package/src/hitl/slack.ts +358 -0
  1058. package/src/hitl/telegram.ts +342 -0
  1059. package/src/index.ts +710 -0
  1060. package/src/llm/parse-structured-output.ts +116 -0
  1061. package/src/loop/index.ts +26 -0
  1062. package/src/loop/minimal-loop.ts +448 -0
  1063. package/src/loop/sdk-loop.ts +505 -0
  1064. package/src/mcp/index.ts +146 -0
  1065. package/src/metrics/create-agent-metrics.ts +231 -0
  1066. package/src/orchestration/bulkhead.ts +145 -0
  1067. package/src/orchestration/idempotency.ts +137 -0
  1068. package/src/orchestration/index.ts +24 -0
  1069. package/src/orchestration/ooda/agent-config-loader.ts +118 -0
  1070. package/src/orchestration/ooda/agent.ts +1009 -0
  1071. package/src/orchestration/ooda/audit-log.ts +57 -0
  1072. package/src/orchestration/ooda/brain-context.ts +269 -0
  1073. package/src/orchestration/ooda/child-agent.ts +60 -0
  1074. package/src/orchestration/ooda/cron-schedule.ts +115 -0
  1075. package/src/orchestration/ooda/debate.ts +100 -0
  1076. package/src/orchestration/ooda/economic-observer.ts +77 -0
  1077. package/src/orchestration/ooda/errors.ts +32 -0
  1078. package/src/orchestration/ooda/execution-mode-guard.ts +37 -0
  1079. package/src/orchestration/ooda/factory.ts +48 -0
  1080. package/src/orchestration/ooda/guardrails.ts +172 -0
  1081. package/src/orchestration/ooda/guards/always-on.ts +21 -0
  1082. package/src/orchestration/ooda/guards/business-hours.ts +134 -0
  1083. package/src/orchestration/ooda/guards/cme-holidays-2026.json +1 -0
  1084. package/src/orchestration/ooda/guards/index.ts +27 -0
  1085. package/src/orchestration/ooda/guards/redis-circuit-breaker.ts +172 -0
  1086. package/src/orchestration/ooda/guards/rth-session.ts +133 -0
  1087. package/src/orchestration/ooda/handoff.ts +150 -0
  1088. package/src/orchestration/ooda/hitl-gate.ts +166 -0
  1089. package/src/orchestration/ooda/index.ts +163 -0
  1090. package/src/orchestration/ooda/inner-monologue.ts +99 -0
  1091. package/src/orchestration/ooda/learn.ts +146 -0
  1092. package/src/orchestration/ooda/multimodal.ts +174 -0
  1093. package/src/orchestration/ooda/phase-routing.ts +74 -0
  1094. package/src/orchestration/ooda/plan-execute.ts +87 -0
  1095. package/src/orchestration/ooda/react-loop.ts +192 -0
  1096. package/src/orchestration/ooda/reflexion.ts +98 -0
  1097. package/src/orchestration/ooda/resource-limits.ts +123 -0
  1098. package/src/orchestration/ooda/run-step-persistence.ts +137 -0
  1099. package/src/orchestration/ooda/skills.ts +60 -0
  1100. package/src/orchestration/ooda/structured-output.ts +93 -0
  1101. package/src/orchestration/ooda/types.ts +508 -0
  1102. package/src/otel/attributes.ts +104 -0
  1103. package/src/otel/index.ts +4 -0
  1104. package/src/otel/ingest.ts +294 -0
  1105. package/src/otel/trace-context.ts +197 -0
  1106. package/src/otel/types.ts +49 -0
  1107. package/src/outcomes/client.ts +194 -0
  1108. package/src/outcomes/compute-roi.ts +89 -0
  1109. package/src/outcomes/index.ts +3 -0
  1110. package/src/outcomes/meter.ts +217 -0
  1111. package/src/outcomes/trajectory.ts +170 -0
  1112. package/src/outcomes/types.ts +88 -0
  1113. package/src/patterns/_shared/brain-logger.ts +18 -0
  1114. package/src/patterns/circuit-breaker/index.ts +8 -0
  1115. package/src/patterns/circuit-breaker/session-cb.ts +198 -0
  1116. package/src/patterns/circuit-breaker/types.ts +72 -0
  1117. package/src/patterns/escalation/index.ts +8 -0
  1118. package/src/patterns/escalation/pyramid.ts +125 -0
  1119. package/src/patterns/escalation/types.ts +62 -0
  1120. package/src/patterns/quality-gate/gate.ts +102 -0
  1121. package/src/patterns/quality-gate/index.ts +8 -0
  1122. package/src/patterns/quality-gate/types.ts +45 -0
  1123. package/src/permissions/capability-gate.ts +63 -0
  1124. package/src/permissions/index.ts +11 -0
  1125. package/src/permissions/renewal-manager.ts +89 -0
  1126. package/src/permissions/sdk-permissions.ts +124 -0
  1127. package/src/ports/agent-registry.ts +104 -0
  1128. package/src/ports/brain.ts +255 -0
  1129. package/src/ports/db.ts +7 -0
  1130. package/src/ports/event-bus.ts +199 -0
  1131. package/src/ports/eviction-policy.ts +179 -0
  1132. package/src/ports/hitl.contract.test.ts +131 -0
  1133. package/src/ports/hitl.ts +153 -0
  1134. package/src/ports/index.ts +48 -0
  1135. package/src/ports/key-provider.ts +179 -0
  1136. package/src/ports/llm-provider.contract.ts +132 -0
  1137. package/src/ports/llm-provider.ts +68 -0
  1138. package/src/ports/logger.ts +23 -0
  1139. package/src/ports/messaging.contract.test.ts +422 -0
  1140. package/src/ports/messaging.ts +53 -0
  1141. package/src/ports/outcome.ts +26 -0
  1142. package/src/ports/timestamp.ts +64 -0
  1143. package/src/privacy/channel.ts +283 -0
  1144. package/src/privacy/composition.ts +289 -0
  1145. package/src/privacy/delegation.ts +128 -0
  1146. package/src/privacy/index.ts +64 -0
  1147. package/src/privacy/nullifier.ts +79 -0
  1148. package/src/privacy/poseidon-felt252.ts +104 -0
  1149. package/src/privacy/uar.ts +234 -0
  1150. package/src/prompts/build-orient-prompt.ts +78 -0
  1151. package/src/proof/chain.ts +249 -0
  1152. package/src/proof/fallback-adapter.ts +117 -0
  1153. package/src/proof/index.ts +207 -0
  1154. package/src/proof/load.ts +61 -0
  1155. package/src/proof/otel.ts +74 -0
  1156. package/src/proof/receipt-queue.ts +235 -0
  1157. package/src/proof/sha256.ts +80 -0
  1158. package/src/proof/types.ts +58 -0
  1159. package/src/proof/verify.ts +89 -0
  1160. package/src/registry/agent-capability.ts +48 -0
  1161. package/src/registry/agent-card.ts +162 -0
  1162. package/src/registry/agent-ids.ts +56 -0
  1163. package/src/registry/agent-registry.ts +378 -0
  1164. package/src/registry/index.ts +23 -0
  1165. package/src/replay/clock.ts +104 -0
  1166. package/src/replay/cross-cycle.ts +406 -0
  1167. package/src/replay/http-vcr.ts +123 -0
  1168. package/src/replay/index.ts +62 -0
  1169. package/src/replay/llm-cache.ts +199 -0
  1170. package/src/replay/random.ts +249 -0
  1171. package/src/replay/replay.ts +271 -0
  1172. package/src/resilience/bulkhead.ts +95 -0
  1173. package/src/resilience/circuit-breaker.ts +129 -0
  1174. package/src/resilience/idempotent.ts +126 -0
  1175. package/src/resilience/index.ts +51 -0
  1176. package/src/router/index.ts +11 -0
  1177. package/src/router/provider-router.ts +319 -0
  1178. package/src/runs/health.ts +84 -0
  1179. package/src/runs/index.ts +3 -0
  1180. package/src/runs/subscribe.ts +263 -0
  1181. package/src/runs/types.ts +63 -0
  1182. package/src/safety/immune.ts +145 -0
  1183. package/src/safety/index.ts +6 -0
  1184. package/src/safety/sanitize.ts +183 -0
  1185. package/src/sdk-permission-mapping.ts +123 -0
  1186. package/src/skills/_otel.ts +31 -0
  1187. package/src/skills/alpaca-quote.ts +82 -0
  1188. package/src/skills/base-skills.ts +38 -0
  1189. package/src/skills/brain-query.ts +62 -0
  1190. package/src/skills/brain-store.ts +69 -0
  1191. package/src/skills/calendar-check.ts +111 -0
  1192. package/src/skills/cboe-vix-spot.ts +89 -0
  1193. package/src/skills/errors.ts +59 -0
  1194. package/src/skills/hitl-request.ts +68 -0
  1195. package/src/skills/http-fetch.ts +92 -0
  1196. package/src/skills/index.ts +71 -0
  1197. package/src/skills/record-outcome.ts +125 -0
  1198. package/src/skills/run-sql-query.ts +87 -0
  1199. package/src/skills/send-email.ts +111 -0
  1200. package/src/skills/skill-ledger.ts +92 -0
  1201. package/src/skills/skill-registry-builder.ts +264 -0
  1202. package/src/skills/slack-notify.ts +90 -0
  1203. package/src/skills/starknet-balance.ts +106 -0
  1204. package/src/skills/telegram-notify.ts +88 -0
  1205. package/src/skills/web-search.ts +108 -0
  1206. package/src/templates/complex-agent.ts +187 -0
  1207. package/src/templates/index.ts +27 -0
  1208. package/src/templates/reasoning-agent.ts +251 -0
  1209. package/src/templates/simple-agent.ts +173 -0
  1210. package/src/testing/brain-conformance.ts +105 -0
  1211. package/src/testing/chaos.ts +266 -0
  1212. package/src/testing/contracts/brain-port.contract.ts +91 -0
  1213. package/src/testing/contracts/economic-observer.contract.ts +87 -0
  1214. package/src/testing/contracts/event-bus.contract.ts +324 -0
  1215. package/src/testing/db-conformance.ts +43 -0
  1216. package/src/testing/eval.ts +161 -0
  1217. package/src/testing/index.ts +59 -0
  1218. package/src/testing/integration-harness.ts +75 -0
  1219. package/src/testing/logger-conformance.ts +57 -0
  1220. package/src/testing/outcome-conformance.ts +62 -0
  1221. package/src/testing/runner.ts +19 -0
  1222. package/src/testing/test-brain-port.ts +69 -0
  1223. package/src/testing/test-child-agent.ts +70 -0
  1224. package/src/testing/test-event-bus.ts +247 -0
  1225. package/src/tools/index.ts +11 -0
  1226. package/src/tools/registry.ts +122 -0
  1227. package/src/tools/types.ts +114 -0
  1228. package/src/tools/zod-to-json-schema.ts +112 -0
  1229. package/src/trace/canonical.ts +158 -0
  1230. package/src/trace/policy.ts +242 -0
  1231. package/src/trace/schema.ts +245 -0
  1232. package/src/trace/strict-pii-detector.ts +156 -0
  1233. package/src/tracing/traced-port.ts +149 -0
  1234. package/src/tracking/agent-run-tracker.ts +228 -0
  1235. package/src/tracking/gen-ai.ts +153 -0
  1236. package/src/tracking/index.ts +19 -0
  1237. package/src/types/agent.ts +93 -0
  1238. package/src/types/escalation-mapping.ts +48 -0
@@ -0,0 +1,57 @@
1
+ /**
2
+ * OODA HITL audit-log helper — sprint-525:quick-2.
3
+ *
4
+ * Records a human's verdict on a HITL approval request. This is the
5
+ * "resolve" side of the gate persisted by `waitForHITLApproval`: the
6
+ * gate INSERTs a `pending` row, this helper UPDATEs it to the final
7
+ * decision so the polling loop can observe the transition.
8
+ *
9
+ * The dashboard or operator UI calls this exactly once per request.
10
+ * The UPDATE is gated on `status='pending'` so a double-resolve from
11
+ * concurrent UIs is a no-op for the second writer.
12
+ *
13
+ * @public
14
+ */
15
+
16
+ import type { DbClient } from "../../tracking/agent-run-tracker.js";
17
+
18
+ export type HITLDecision = "approved" | "rejected";
19
+
20
+ /**
21
+ * Record a HITL verdict in `hitl_approvals`. Returns silently — the
22
+ * polling gate observes the row transition on its next tick.
23
+ *
24
+ * Concurrent calls: only the first one transitions the row (status
25
+ * filter on UPDATE). Subsequent callers find no `pending` row and the
26
+ * UPDATE simply affects 0 rows.
27
+ */
28
+ export async function recordHITLDecision(
29
+ db: DbClient,
30
+ hitlId: string,
31
+ decision: HITLDecision,
32
+ resolverUserId: string,
33
+ rationale?: string,
34
+ ): Promise<void> {
35
+ if (typeof hitlId !== "string" || hitlId.length === 0) {
36
+ throw new Error("[ooda/audit-log] hitlId must be a non-empty string");
37
+ }
38
+ if (decision !== "approved" && decision !== "rejected") {
39
+ throw new Error(
40
+ `[ooda/audit-log] decision must be 'approved' | 'rejected'. Got: ${String(decision)}`,
41
+ );
42
+ }
43
+ if (typeof resolverUserId !== "string" || resolverUserId.length === 0) {
44
+ throw new Error("[ooda/audit-log] resolverUserId must be a non-empty string");
45
+ }
46
+
47
+ await db.query(
48
+ `UPDATE hitl_approvals
49
+ SET status = $2,
50
+ resolved_by = $3,
51
+ rationale = $4,
52
+ resolved_at = now()
53
+ WHERE id = $1
54
+ AND status = 'pending'`,
55
+ [hitlId, decision, resolverUserId, rationale ?? null],
56
+ );
57
+ }
@@ -0,0 +1,269 @@
1
+ /**
2
+ * Brain context auto-injection for the OODA ORIENT phase — sprint-525:quick-4.
3
+ *
4
+ * D1+D2 systemic fix: instead of every OODA agent calling Brain manually
5
+ * during ORIENT, this primitive wraps the orient phase function so that:
6
+ *
7
+ * 1. A Brain query is built from the observe input (`options.query(input)`).
8
+ * 2. The `query_knowledge` skill (or an injected `fetchBrainContext`) is
9
+ * called once, returning top-K chunks above `minSimilarity`.
10
+ * 3. The chunks + their entry IDs are injected into the orient input as
11
+ * `OrientInputWithBrain<TObs>` — orient code stays decoupled from
12
+ * Brain MCP wiring.
13
+ * 4. `mcp_call_hash` + `retrieval_proof_hash` are emitted via the OODA
14
+ * context's step-recording side-effect (a retrieval `run_step` row),
15
+ * so `assembleRunCertificate` populates `brain_context_refs`
16
+ * automatically — no per-agent boilerplate.
17
+ *
18
+ * Replay safety: when `ctx.isReplay === true`, the wrapper consults the
19
+ * injected `replayChunks` (if provided) and emits no MCP call. This keeps
20
+ * deterministic re-execution stable.
21
+ *
22
+ * @public
23
+ */
24
+
25
+ import type { OODAContext } from "./types.js";
26
+
27
+ // ─── Public types ─────────────────────────────────────────────────────────────
28
+
29
+ /**
30
+ * A single chunk returned from a Brain retrieval. `entry_id` is the only
31
+ * field consumed by certificate assembly; the rest is forwarded to the
32
+ * wrapped orient phase.
33
+ */
34
+ export interface BrainChunk {
35
+ readonly entry_id: string;
36
+ readonly content: string;
37
+ readonly similarity: number;
38
+ readonly metadata?: Record<string, unknown>;
39
+ }
40
+
41
+ /**
42
+ * Result of a Brain MCP call wrapped by `callBrainTool` (server-side).
43
+ * Re-exported in this module for SDK consumers that build their own
44
+ * `fetchBrainContext` impl.
45
+ */
46
+ export interface BrainCallResult<T> {
47
+ readonly result: T;
48
+ readonly mcp_call_hash: string;
49
+ readonly retrieval_proof_hash: string;
50
+ }
51
+
52
+ /**
53
+ * Returned by the circuit breaker when Brain is unreachable (open circuit).
54
+ * All downstream decisions MUST carry `[UNGROUNDED: brain]` markers.
55
+ */
56
+ export interface DegradedResponse {
57
+ readonly status: "degraded";
58
+ readonly fallback: "UNGROUNDED";
59
+ readonly reason: string;
60
+ readonly stale_since: string;
61
+ }
62
+
63
+ /**
64
+ * Discriminator: narrow a fetch result to DegradedResponse or BrainCallResult.
65
+ */
66
+ export function isDegradedResponse(r: unknown): r is DegradedResponse {
67
+ return (
68
+ typeof r === "object" &&
69
+ r !== null &&
70
+ "status" in r &&
71
+ (r as DegradedResponse).status === "degraded"
72
+ );
73
+ }
74
+
75
+ /**
76
+ * Configuration for the wrapper.
77
+ *
78
+ * `enabled: false` short-circuits to an empty context — orient still
79
+ * receives `OrientInputWithBrain` but with `brainContext: []`.
80
+ */
81
+ export interface BrainContextOptions<TInput> {
82
+ readonly enabled: boolean;
83
+ /** Build the Brain query string from the observe phase output. */
84
+ readonly query: (input: TInput) => string;
85
+ /** Default 5. Bounded by the BrainPort `query_knowledge` page size. */
86
+ readonly topK?: number;
87
+ /** Default 0.7. Chunks below this similarity are filtered out. */
88
+ readonly minSimilarity?: number;
89
+ /**
90
+ * Host-injected Brain MCP fetcher. When omitted and `enabled === true`,
91
+ * the wrapper throws — encouraging callers to wire a `BrainPort`-backed
92
+ * adapter at boot time. The fetcher must:
93
+ * - Throw `BrainSkillNotConfiguredError` when BRAIN_MCP_URL is unset.
94
+ * - Return `BrainCallResult` with the two hashes computed via
95
+ * JCS-canonicalized SHA-256 (RFC 8785).
96
+ */
97
+ readonly fetchBrainContext?: (
98
+ query: string,
99
+ topK: number
100
+ ) => Promise<BrainCallResult<BrainChunk[]> | DegradedResponse>;
101
+ /**
102
+ * Optional deterministic replay fixture. When `ctx.isReplay === true`,
103
+ * the wrapper returns these chunks instead of calling Brain.
104
+ */
105
+ readonly replayChunks?: BrainChunk[];
106
+ }
107
+
108
+ /**
109
+ * The augmented input the wrapped orient phase receives. `raw` is the
110
+ * original observe output; `brainContext` is the filtered chunk list;
111
+ * `brainContextRefs` is the ordered, deduped list of entry IDs that
112
+ * `assembleRunCertificate` will lift onto the proof certificate.
113
+ */
114
+ export interface OrientInputWithBrain<TObs> {
115
+ readonly raw: TObs;
116
+ readonly brainContext: BrainChunk[];
117
+ readonly brainContextRefs: string[];
118
+ }
119
+
120
+ // ─── Errors ───────────────────────────────────────────────────────────────────
121
+
122
+ export class BrainSkillNotConfiguredError extends Error {
123
+ constructor() {
124
+ super(
125
+ "Brain skill requires BRAIN_MCP_URL env var. " +
126
+ "See https://command.vauban.tech/docs/sdk/brain-config"
127
+ );
128
+ this.name = "BrainSkillNotConfiguredError";
129
+ }
130
+ }
131
+
132
+ // ─── Defaults ─────────────────────────────────────────────────────────────────
133
+
134
+ const DEFAULT_TOP_K = 5;
135
+ const DEFAULT_MIN_SIMILARITY = 0.7;
136
+
137
+ // ─── Helpers ──────────────────────────────────────────────────────────────────
138
+
139
+ /**
140
+ * Filter chunks by `minSimilarity`, sort by descending similarity, then
141
+ * truncate to `topK`. Pure — no side-effects.
142
+ */
143
+ function filterAndRank(
144
+ chunks: readonly BrainChunk[],
145
+ topK: number,
146
+ minSimilarity: number
147
+ ): BrainChunk[] {
148
+ return chunks
149
+ .filter((c) => c.similarity >= minSimilarity)
150
+ .slice()
151
+ .sort((a, b) => b.similarity - a.similarity)
152
+ .slice(0, topK);
153
+ }
154
+
155
+ /**
156
+ * Deduplicate entry IDs while preserving first-seen order.
157
+ */
158
+ function dedupePreserveOrder(ids: readonly string[]): string[] {
159
+ const seen = new Set<string>();
160
+ const out: string[] = [];
161
+ for (const id of ids) {
162
+ if (!seen.has(id)) {
163
+ seen.add(id);
164
+ out.push(id);
165
+ }
166
+ }
167
+ return out;
168
+ }
169
+
170
+ // ─── Public API ───────────────────────────────────────────────────────────────
171
+
172
+ /**
173
+ * Wraps an orient phase function to auto-inject Brain context.
174
+ *
175
+ * The wrapped function:
176
+ * 1. Inserts a `retrieval` step (pending).
177
+ * 2. Calls `fetchBrainContext` (unless disabled or replaying).
178
+ * 3. Filters/sorts/truncates chunks per config.
179
+ * 4. Completes the retrieval step with `mcp_call_hash` + entry IDs in
180
+ * the payload — `assembleRunCertificate` lifts entry IDs onto the
181
+ * certificate's `brain_context_refs`.
182
+ * 5. Invokes the inner orient with `OrientInputWithBrain<TObs>`.
183
+ *
184
+ * Strict typing: the inner orient remains parametric in `TObs`/`TOrient`,
185
+ * so existing OODA `PhaseDef<TObs, TOrient>` consumers can adopt this
186
+ * wrapper without rewriting types — they swap the `fn` field for the
187
+ * wrapper's return value.
188
+ */
189
+ export function withBrainContext<TObs, TOrient>(
190
+ options: BrainContextOptions<TObs>,
191
+ orientFn: (
192
+ input: OrientInputWithBrain<TObs>,
193
+ ctx: OODAContext
194
+ ) => Promise<TOrient>
195
+ ): (input: TObs, ctx: OODAContext) => Promise<TOrient> {
196
+ const topK = options.topK ?? DEFAULT_TOP_K;
197
+ const minSimilarity = options.minSimilarity ?? DEFAULT_MIN_SIMILARITY;
198
+
199
+ return async (input, ctx) => {
200
+ // Fast path: disabled → orient receives an empty context, no step row.
201
+ if (!options.enabled) {
202
+ return orientFn(
203
+ { raw: input, brainContext: [], brainContextRefs: [] },
204
+ ctx
205
+ );
206
+ }
207
+
208
+ const query = options.query(input);
209
+ const { stepId } = await ctx.insertStep({
210
+ type: "retrieval",
211
+ phase: "orient.brain-context",
212
+ payload: { query, topK, minSimilarity },
213
+ });
214
+
215
+ let chunks: BrainChunk[];
216
+ let mcpCallHash: string | null = null;
217
+ let retrievalProofHash: string | null = null;
218
+ let degradedResponse: DegradedResponse | null = null;
219
+
220
+ try {
221
+ if (ctx.isReplay) {
222
+ chunks = filterAndRank(options.replayChunks ?? [], topK, minSimilarity);
223
+ } else {
224
+ if (!options.fetchBrainContext) {
225
+ throw new BrainSkillNotConfiguredError();
226
+ }
227
+ const call = await options.fetchBrainContext(query, topK);
228
+
229
+ // Circuit breaker: Brain is down → return empty context instead of crashing
230
+ if (isDegradedResponse(call)) {
231
+ degradedResponse = call;
232
+ chunks = [];
233
+ } else {
234
+ mcpCallHash = call.mcp_call_hash;
235
+ retrievalProofHash = call.retrieval_proof_hash;
236
+ chunks = filterAndRank(call.result, topK, minSimilarity);
237
+ }
238
+ }
239
+ } catch (err) {
240
+ await ctx.errorStep(
241
+ stepId,
242
+ err instanceof Error ? err : new Error(String(err))
243
+ );
244
+ throw err;
245
+ }
246
+
247
+ const brainContextRefs = dedupePreserveOrder(chunks.map((c) => c.entry_id));
248
+
249
+ // Complete the retrieval step. The OODA host owns mcp_call_hash
250
+ // column writing; the SDK contract is to surface it via payload so
251
+ // the host adapter (insertStepImpl/completeStepImpl) can lift it onto
252
+ // the run_step row when persisting.
253
+ await ctx.completeStep(stepId, {
254
+ query,
255
+ brain_entry_ids: brainContextRefs,
256
+ mcp_call_hash: mcpCallHash,
257
+ retrieval_proof_hash: retrievalProofHash,
258
+ chunk_count: chunks.length,
259
+ ...(degradedResponse
260
+ ? { degraded: true, fallback: degradedResponse.fallback }
261
+ : {}),
262
+ });
263
+
264
+ return orientFn(
265
+ { raw: input, brainContext: chunks, brainContextRefs },
266
+ ctx
267
+ );
268
+ };
269
+ }
@@ -0,0 +1,60 @@
1
+ /**
2
+ * ChildAgentPort — Supervisor-Worker pattern for multi-agent orchestration.
3
+ *
4
+ * Async-first design: `spawnAsync` returns a `workerId` immediately; the worker
5
+ * publishes a `worker.completed` CloudEvent on the bus when done. The supervisor
6
+ * picks it up in its next `observe()` cycle — never blocking.
7
+ *
8
+ * `spawnSync` is available for short tasks (< 10s) but should be used sparingly.
9
+ *
10
+ * Cycle detection: `maxChainDepth` (default 3) prevents infinite agent chains.
11
+ * If `handoffChain.length >= maxChainDepth`, the port throws `HandoffCycleError`.
12
+ *
13
+ * @public
14
+ */
15
+
16
+ // ─── Types ──────────────────────────────────────────────────────────────────────
17
+
18
+ export interface ChildAgentOptions {
19
+ /** Target agent identifier. */
20
+ agentId: string;
21
+ /** Task payload — arbitrary JSON-serializable record. */
22
+ task: Record<string, unknown>;
23
+ /** Max wait time for spawnSync (default: 10_000 ms). */
24
+ timeoutMs?: number;
25
+ /** Chain of agent IDs that have handed off to this worker. */
26
+ handoffChain?: string[];
27
+ /** Max chain depth before HandoffCycleError (default: 3). */
28
+ maxChainDepth?: number;
29
+ }
30
+
31
+ export interface ChildAgentResult {
32
+ workerId: string;
33
+ status: "accepted" | "completed" | "failed" | "timeout";
34
+ output?: unknown;
35
+ error?: string;
36
+ }
37
+
38
+ // ─── Port ───────────────────────────────────────────────────────────────────────
39
+
40
+ export interface ChildAgentPort {
41
+ /**
42
+ * Fire-and-forget: spawn a worker, get workerId immediately.
43
+ *
44
+ * The worker publishes a `worker.completed` CloudEvent on the event bus
45
+ * when done. The supervisor picks it up in its next observe() cycle.
46
+ *
47
+ * Throws `HandoffCycleError` if `handoffChain.length >= maxChainDepth`.
48
+ */
49
+ spawnAsync(opts: ChildAgentOptions): Promise<{ workerId: string }>;
50
+
51
+ /**
52
+ * Await result synchronously. Use only for short tasks (< 10s).
53
+ *
54
+ * Blocks the supervisor cycle during worker execution. Prefer `spawnAsync`
55
+ * for all non-trivial work.
56
+ *
57
+ * Throws `HandoffCycleError` if `handoffChain.length >= maxChainDepth`.
58
+ */
59
+ spawnSync(opts: ChildAgentOptions): Promise<ChildAgentResult>;
60
+ }
@@ -0,0 +1,115 @@
1
+ /**
2
+ * CronExpression scheduling — SessionGuard based on cron expressions.
3
+ *
4
+ * Replaces fixed-interval scheduling with cron-based patterns:
5
+ * "every Monday 9am", "first day of month", "every weekday at 8am".
6
+ *
7
+ * The `cronSessionGuard(expr)` returns a `SessionGuard` compatible with
8
+ * the existing OODA guard system — zero boilerplate wiring.
9
+ *
10
+ * @public
11
+ */
12
+
13
+ import type { SessionGuard } from "./types.js";
14
+
15
+ // ─── Cron Parser ────────────────────────────────────────────────────────────────
16
+
17
+ /**
18
+ * Minimal cron expression parser (5-field: minute hour day-of-month month day-of-week).
19
+ *
20
+ * Supports wildcards, specific values, ranges, steps, and lists.
21
+ * Does NOT support L, W, hash, question mark, or year field.
22
+ */
23
+ function parseField(field: string, min: number, max: number): Set<number> {
24
+ const values = new Set<number>();
25
+
26
+ if (field === "*") {
27
+ for (let i = min; i <= max; i++) values.add(i);
28
+ return values;
29
+ }
30
+
31
+ const parts = field.split(",");
32
+ for (const part of parts) {
33
+ const [range, stepStr] = part.split("/");
34
+ const step = stepStr ? parseInt(stepStr, 10) : 1;
35
+
36
+ let rangeMin: number;
37
+ let rangeMax: number;
38
+
39
+ if (range === "*") {
40
+ rangeMin = min;
41
+ rangeMax = max;
42
+ } else if (range.includes("-")) {
43
+ const [a, b] = range.split("-");
44
+ rangeMin = parseInt(a, 10);
45
+ rangeMax = parseInt(b, 10);
46
+ } else {
47
+ rangeMin = parseInt(range, 10);
48
+ rangeMax = rangeMin;
49
+ }
50
+
51
+ for (let i = rangeMin; i <= rangeMax; i += step) {
52
+ if (i >= min && i <= max) values.add(i);
53
+ }
54
+ }
55
+
56
+ return values;
57
+ }
58
+
59
+ interface CronFields {
60
+ minutes: Set<number>;
61
+ hours: Set<number>;
62
+ daysOfMonth: Set<number>;
63
+ months: Set<number>;
64
+ daysOfWeek: Set<number>;
65
+ }
66
+
67
+ function parseCronExpression(expr: string): CronFields {
68
+ const parts = expr.trim().split(/\s+/);
69
+ if (parts.length !== 5) {
70
+ throw new Error(`Invalid cron expression "${expr}": expected 5 fields, got ${parts.length}`);
71
+ }
72
+
73
+ return {
74
+ minutes: parseField(parts[0], 0, 59),
75
+ hours: parseField(parts[1], 0, 23),
76
+ daysOfMonth: parseField(parts[2], 1, 31),
77
+ months: parseField(parts[3], 1, 12),
78
+ daysOfWeek: parseField(parts[4], 0, 6), // 0=Sunday
79
+ };
80
+ }
81
+
82
+ function cronMatches(expr: string, date: Date): boolean {
83
+ const fields = parseCronExpression(expr);
84
+ return (
85
+ fields.minutes.has(date.getUTCMinutes()) &&
86
+ fields.hours.has(date.getUTCHours()) &&
87
+ fields.daysOfMonth.has(date.getUTCDate()) &&
88
+ fields.months.has(date.getUTCMonth() + 1) &&
89
+ fields.daysOfWeek.has(date.getUTCDay())
90
+ );
91
+ }
92
+
93
+ // ─── Session Guard ──────────────────────────────────────────────────────────────
94
+
95
+ /**
96
+ * Create a SessionGuard from a cron expression.
97
+ *
98
+ * The guard returns `isActive: true` when the current time matches the
99
+ * cron expression. This gates whether a cycle should run at all.
100
+ *
101
+ * @example
102
+ * ```typescript
103
+ * // Run every weekday at 9:00 AM UTC
104
+ * const guard = cronSessionGuard("0 9 * * 1-5");
105
+ * ```
106
+ */
107
+ export function cronSessionGuard(expr: string): SessionGuard {
108
+ // Validate at construction time
109
+ parseCronExpression(expr);
110
+
111
+ return {
112
+ name: `cron:${expr}`,
113
+ isActive: async (at: Date) => cronMatches(expr, at),
114
+ };
115
+ }
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Multi-Agent Debate — Dual LLM in orient/decide phases.
3
+ *
4
+ * Pattern: Strategist (thesis) + Skeptic (antithesis) → Synthesizer → synthesis.
5
+ *
6
+ * The debate engine runs two adversarial LLM stances against each other
7
+ * and produces a consensus score + plan. Used for high-stakes decisions
8
+ * where a single LLM's blind spots are unacceptable (legal review,
9
+ * financial allocation, security decisions).
10
+ *
11
+ * Reference: command-center/docs/specs/debate-engine-spec.md
12
+ *
13
+ * @public
14
+ */
15
+
16
+ // ─── Types ──────────────────────────────────────────────────────────────────────
17
+
18
+ export interface DebateStance {
19
+ /** The argument / position. */
20
+ content: string;
21
+ /** Confidence score (0.0 - 1.0). */
22
+ confidence: number;
23
+ /** Key points supporting this stance. */
24
+ keyPoints: string[];
25
+ /** Identified risks or weaknesses. */
26
+ risks: string[];
27
+ }
28
+
29
+ export interface DebateSynthesis {
30
+ /** Synthesized conclusion. */
31
+ conclusion: string;
32
+ /** Consensus score (0.0 = total disagreement, 1.0 = full agreement). */
33
+ consensusScore: number;
34
+ /** Recommended action. */
35
+ recommendation: string;
36
+ /** Key trade-offs identified. */
37
+ tradeoffs: string[];
38
+ /** Whether HITL escalation is recommended. */
39
+ hitlRecommended: boolean;
40
+ }
41
+
42
+ export interface DebateResult {
43
+ thesis: DebateStance;
44
+ antithesis: DebateStance;
45
+ synthesis: DebateSynthesis;
46
+ /** Number of debate rounds. */
47
+ rounds: number;
48
+ }
49
+
50
+ export interface DebateConfig {
51
+ /** The question or decision to debate. */
52
+ question: string;
53
+ /** Context / background information. */
54
+ context?: string;
55
+ /** Max debate rounds (default: 1). */
56
+ maxRounds?: number;
57
+ /** LLM function for the strategist (thesis). */
58
+ strategist: (question: string, context?: string) => Promise<DebateStance>;
59
+ /** LLM function for the skeptic (antithesis). */
60
+ skeptic: (question: string, thesis: DebateStance, context?: string) => Promise<DebateStance>;
61
+ /** LLM function for the synthesizer. */
62
+ synthesizer: (question: string, thesis: DebateStance, antithesis: DebateStance, context?: string) => Promise<DebateSynthesis>;
63
+ }
64
+
65
+ // ─── Engine ─────────────────────────────────────────────────────────────────────
66
+
67
+ /**
68
+ * Run a multi-agent debate.
69
+ *
70
+ * 1. Strategist proposes thesis
71
+ * 2. Skeptic challenges with antithesis
72
+ * 3. Synthesizer merges into consensus + recommendation
73
+ *
74
+ * If `maxRounds > 1`, the thesis and antithesis are fed back for refinement.
75
+ */
76
+ export async function runDebate(config: DebateConfig): Promise<DebateResult> {
77
+ const maxRounds = config.maxRounds ?? 1;
78
+
79
+ let thesis = await config.strategist(config.question, config.context);
80
+ let antithesis = await config.skeptic(config.question, thesis, config.context);
81
+
82
+ // Multi-round refinement
83
+ for (let round = 1; round < maxRounds; round++) {
84
+ // Refine thesis against antithesis
85
+ thesis = await config.strategist(
86
+ `${config.question}\n\nCounterarguments to address:\n${antithesis.content}`,
87
+ config.context
88
+ );
89
+ // Refine antithesis against refined thesis
90
+ antithesis = await config.skeptic(
91
+ `${config.question}\n\nUpdated thesis to challenge:\n${thesis.content}`,
92
+ thesis,
93
+ config.context
94
+ );
95
+ }
96
+
97
+ const synthesis = await config.synthesizer(config.question, thesis, antithesis, config.context);
98
+
99
+ return { thesis, antithesis, synthesis, rounds: maxRounds };
100
+ }
@@ -0,0 +1,77 @@
1
+ /**
2
+ * EconomicObserver — Cost/value guard for autonomous agents.
3
+ *
4
+ * Tracks per-agent token costs vs. outcome value over a 7-day rolling window.
5
+ * Agents with negative ROI get throttled (cycle skipped with reason
6
+ * `economic_observer:negative_roi`).
7
+ *
8
+ * The SDK defines ONLY the interface + guard factory — pure, no DB.
9
+ * Forge implements `PostgresEconomicObserver` backed by TimescaleDB.
10
+ *
11
+ * Throttle logic:
12
+ * if cost_7d > value_7d * 0.5 AND cycles > 20 → throttle (skip cycle).
13
+ * Cycles under 20 always run (cold-start grace period).
14
+ *
15
+ * @public
16
+ */
17
+
18
+ import type { RiskGuard, OODAContext } from "./types.js";
19
+
20
+ // ─── Interface ──────────────────────────────────────────────────────────────────
21
+
22
+ export interface EconomicObserver {
23
+ /**
24
+ * Record a completed cycle's cost and value.
25
+ *
26
+ * Called after the feedback phase produces an OutcomeRecord.
27
+ * `confidence` weights the outcome value: effective_value = valueCents * confidence.
28
+ */
29
+ recordCycle(
30
+ agentId: string,
31
+ tokenCostUsd: number,
32
+ outcomeValueCents: number,
33
+ confidence: number
34
+ ): Promise<void>;
35
+
36
+ /**
37
+ * Check whether this agent should be throttled (skipped).
38
+ *
39
+ * Returns true if the agent's 7-day rolling cost exceeds 50% of its
40
+ * 7-day rolling value AND it has completed more than 20 cycles.
41
+ */
42
+ shouldThrottle(agentId: string): Promise<boolean>;
43
+
44
+ /**
45
+ * Get statistics for the 7-day rolling window.
46
+ */
47
+ getStats(agentId: string): Promise<{
48
+ cost7d: number;
49
+ value7d: number;
50
+ roi: number;
51
+ cycles: number;
52
+ }>;
53
+ }
54
+
55
+ // ─── Guard Factory ──────────────────────────────────────────────────────────────
56
+
57
+ /**
58
+ * Create a RiskGuard from an EconomicObserver.
59
+ *
60
+ * Returns a guard compatible with `OODAAgentConfig.riskGuards` —
61
+ * zero boilerplate wiring into the OODA loop.
62
+ */
63
+ export function economicObserverGuard(
64
+ observer: EconomicObserver,
65
+ agentId: string
66
+ ): RiskGuard {
67
+ return {
68
+ name: "economic_observer",
69
+ check: async (_ctx: OODAContext) => {
70
+ const throttled = await observer.shouldThrottle(agentId);
71
+ return {
72
+ proceed: !throttled,
73
+ reason: throttled ? "economic_observer:negative_roi" : undefined,
74
+ };
75
+ },
76
+ };
77
+ }