@strands-agents/sdk 1.7.0 → 1.8.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 (659) hide show
  1. package/dist/src/agent/agent.d.ts +1 -1
  2. package/dist/src/agent/agent.d.ts.map +1 -1
  3. package/dist/src/agent/agent.js +1 -1
  4. package/dist/src/agent/agent.js.map +1 -1
  5. package/dist/src/context-manager/modes/agentic/agentic-context.d.ts +3 -3
  6. package/dist/src/context-manager/modes/agentic/agentic-context.d.ts.map +1 -1
  7. package/dist/src/index.d.ts +1 -1
  8. package/dist/src/index.d.ts.map +1 -1
  9. package/dist/src/index.js +1 -1
  10. package/dist/src/index.js.map +1 -1
  11. package/dist/src/index.node.d.ts.map +1 -1
  12. package/dist/src/index.node.js +3 -0
  13. package/dist/src/index.node.js.map +1 -1
  14. package/dist/src/interventions/actions.d.ts.map +1 -1
  15. package/dist/src/interventions/actions.js.map +1 -1
  16. package/dist/src/{mcp.d.ts → mcp/client.d.ts} +13 -4
  17. package/dist/src/mcp/client.d.ts.map +1 -0
  18. package/dist/src/{mcp.js → mcp/client.js} +15 -3
  19. package/dist/src/mcp/client.js.map +1 -0
  20. package/dist/src/mcp/config.d.ts +52 -0
  21. package/dist/src/mcp/config.d.ts.map +1 -0
  22. package/dist/src/mcp/config.js +12 -0
  23. package/dist/src/mcp/config.js.map +1 -0
  24. package/dist/src/mcp/config.node.d.ts +16 -0
  25. package/dist/src/mcp/config.node.d.ts.map +1 -0
  26. package/dist/src/mcp/config.node.js +145 -0
  27. package/dist/src/mcp/config.node.js.map +1 -0
  28. package/dist/src/mcp/index.d.ts +3 -0
  29. package/dist/src/mcp/index.d.ts.map +1 -0
  30. package/dist/src/mcp/index.js +2 -0
  31. package/dist/src/mcp/index.js.map +1 -0
  32. package/dist/src/models/model.d.ts.map +1 -1
  33. package/dist/src/models/model.js +2 -1
  34. package/dist/src/models/model.js.map +1 -1
  35. package/dist/src/multiagent/graph.d.ts +7 -0
  36. package/dist/src/multiagent/graph.d.ts.map +1 -1
  37. package/dist/src/multiagent/graph.js +22 -1
  38. package/dist/src/multiagent/graph.js.map +1 -1
  39. package/dist/src/multiagent/nodes.d.ts +5 -0
  40. package/dist/src/multiagent/nodes.d.ts.map +1 -1
  41. package/dist/src/multiagent/nodes.js +15 -0
  42. package/dist/src/multiagent/nodes.js.map +1 -1
  43. package/dist/src/multiagent/state.d.ts.map +1 -1
  44. package/dist/src/multiagent/state.js.map +1 -1
  45. package/dist/src/tools/function-tool.d.ts +1 -1
  46. package/dist/src/tools/function-tool.d.ts.map +1 -1
  47. package/dist/src/tools/function-tool.js +4 -12
  48. package/dist/src/tools/function-tool.js.map +1 -1
  49. package/dist/src/tools/mcp-tool.d.ts +2 -1
  50. package/dist/src/tools/mcp-tool.d.ts.map +1 -1
  51. package/dist/src/tools/mcp-tool.js +1 -0
  52. package/dist/src/tools/mcp-tool.js.map +1 -1
  53. package/dist/src/tools/tool-factory.d.ts +1 -1
  54. package/dist/src/tools/tool-factory.d.ts.map +1 -1
  55. package/dist/src/tools/types.d.ts +4 -0
  56. package/dist/src/tools/types.d.ts.map +1 -1
  57. package/dist/src/tools/zod-tool.d.ts +4 -2
  58. package/dist/src/tools/zod-tool.d.ts.map +1 -1
  59. package/dist/src/tools/zod-tool.js.map +1 -1
  60. package/dist/src/tsconfig.tsbuildinfo +1 -1
  61. package/dist/src/types/media.d.ts.map +1 -1
  62. package/dist/src/types/media.js.map +1 -1
  63. package/dist/src/types/messages.d.ts.map +1 -1
  64. package/dist/src/types/messages.js.map +1 -1
  65. package/dist/src/vended-memory-stores/local/index.d.ts +2 -0
  66. package/dist/src/vended-memory-stores/local/index.d.ts.map +1 -0
  67. package/dist/src/vended-memory-stores/local/index.js +2 -0
  68. package/dist/src/vended-memory-stores/local/index.js.map +1 -0
  69. package/dist/src/vended-memory-stores/local/store.d.ts +122 -0
  70. package/dist/src/vended-memory-stores/local/store.d.ts.map +1 -0
  71. package/dist/src/vended-memory-stores/local/store.js +281 -0
  72. package/dist/src/vended-memory-stores/local/store.js.map +1 -0
  73. package/dist/src/vended-plugins/context-offloader/search.d.ts.map +1 -1
  74. package/dist/src/vended-plugins/context-offloader/search.js +4 -2
  75. package/dist/src/vended-plugins/context-offloader/search.js.map +1 -1
  76. package/dist/src/vended-plugins/context-offloader/storage.js +1 -1
  77. package/dist/src/vended-plugins/context-offloader/storage.js.map +1 -1
  78. package/dist/src/vended-plugins/skills/skill.d.ts.map +1 -1
  79. package/dist/src/vended-plugins/skills/skill.js.map +1 -1
  80. package/dist/src/vended-tools/notebook/notebook.d.ts +1 -1
  81. package/package.json +21 -14
  82. package/dist/src/__fixtures__/agent-helpers.d.ts +0 -136
  83. package/dist/src/__fixtures__/agent-helpers.d.ts.map +0 -1
  84. package/dist/src/__fixtures__/agent-helpers.js +0 -156
  85. package/dist/src/__fixtures__/agent-helpers.js.map +0 -1
  86. package/dist/src/__fixtures__/environment.d.ts +0 -12
  87. package/dist/src/__fixtures__/environment.d.ts.map +0 -1
  88. package/dist/src/__fixtures__/environment.js +0 -12
  89. package/dist/src/__fixtures__/environment.js.map +0 -1
  90. package/dist/src/__fixtures__/metrics-helpers.d.ts +0 -55
  91. package/dist/src/__fixtures__/metrics-helpers.d.ts.map +0 -1
  92. package/dist/src/__fixtures__/metrics-helpers.js +0 -57
  93. package/dist/src/__fixtures__/metrics-helpers.js.map +0 -1
  94. package/dist/src/__fixtures__/mock-message-model.d.ts +0 -103
  95. package/dist/src/__fixtures__/mock-message-model.d.ts.map +0 -1
  96. package/dist/src/__fixtures__/mock-message-model.js +0 -245
  97. package/dist/src/__fixtures__/mock-message-model.js.map +0 -1
  98. package/dist/src/__fixtures__/mock-meter.d.ts +0 -32
  99. package/dist/src/__fixtures__/mock-meter.d.ts.map +0 -1
  100. package/dist/src/__fixtures__/mock-meter.js +0 -47
  101. package/dist/src/__fixtures__/mock-meter.js.map +0 -1
  102. package/dist/src/__fixtures__/mock-plugin.d.ts +0 -13
  103. package/dist/src/__fixtures__/mock-plugin.d.ts.map +0 -1
  104. package/dist/src/__fixtures__/mock-plugin.js +0 -35
  105. package/dist/src/__fixtures__/mock-plugin.js.map +0 -1
  106. package/dist/src/__fixtures__/mock-span.d.ts +0 -78
  107. package/dist/src/__fixtures__/mock-span.d.ts.map +0 -1
  108. package/dist/src/__fixtures__/mock-span.js +0 -93
  109. package/dist/src/__fixtures__/mock-span.js.map +0 -1
  110. package/dist/src/__fixtures__/mock-storage-provider.d.ts +0 -42
  111. package/dist/src/__fixtures__/mock-storage-provider.d.ts.map +0 -1
  112. package/dist/src/__fixtures__/mock-storage-provider.js +0 -122
  113. package/dist/src/__fixtures__/mock-storage-provider.js.map +0 -1
  114. package/dist/src/__fixtures__/model-test-helpers.d.ts +0 -56
  115. package/dist/src/__fixtures__/model-test-helpers.d.ts.map +0 -1
  116. package/dist/src/__fixtures__/model-test-helpers.js +0 -85
  117. package/dist/src/__fixtures__/model-test-helpers.js.map +0 -1
  118. package/dist/src/__fixtures__/register-node-defaults.d.ts +0 -2
  119. package/dist/src/__fixtures__/register-node-defaults.d.ts.map +0 -1
  120. package/dist/src/__fixtures__/register-node-defaults.js +0 -6
  121. package/dist/src/__fixtures__/register-node-defaults.js.map +0 -1
  122. package/dist/src/__fixtures__/slim-types.d.ts +0 -51
  123. package/dist/src/__fixtures__/slim-types.d.ts.map +0 -1
  124. package/dist/src/__fixtures__/slim-types.js +0 -6
  125. package/dist/src/__fixtures__/slim-types.js.map +0 -1
  126. package/dist/src/__fixtures__/test-sandbox.node.d.ts +0 -15
  127. package/dist/src/__fixtures__/test-sandbox.node.d.ts.map +0 -1
  128. package/dist/src/__fixtures__/test-sandbox.node.js +0 -23
  129. package/dist/src/__fixtures__/test-sandbox.node.js.map +0 -1
  130. package/dist/src/__fixtures__/tool-helpers.d.ts +0 -45
  131. package/dist/src/__fixtures__/tool-helpers.d.ts.map +0 -1
  132. package/dist/src/__fixtures__/tool-helpers.js +0 -101
  133. package/dist/src/__fixtures__/tool-helpers.js.map +0 -1
  134. package/dist/src/__tests__/default-slot.test.d.ts +0 -2
  135. package/dist/src/__tests__/default-slot.test.d.ts.map +0 -1
  136. package/dist/src/__tests__/default-slot.test.js +0 -33
  137. package/dist/src/__tests__/default-slot.test.js.map +0 -1
  138. package/dist/src/__tests__/errors.test.d.ts +0 -2
  139. package/dist/src/__tests__/errors.test.d.ts.map +0 -1
  140. package/dist/src/__tests__/errors.test.js +0 -170
  141. package/dist/src/__tests__/errors.test.js.map +0 -1
  142. package/dist/src/__tests__/index.test.d.ts +0 -2
  143. package/dist/src/__tests__/index.test.d.ts.map +0 -1
  144. package/dist/src/__tests__/index.test.js +0 -48
  145. package/dist/src/__tests__/index.test.js.map +0 -1
  146. package/dist/src/__tests__/interrupt.test.d.ts +0 -2
  147. package/dist/src/__tests__/interrupt.test.d.ts.map +0 -1
  148. package/dist/src/__tests__/interrupt.test.js +0 -264
  149. package/dist/src/__tests__/interrupt.test.js.map +0 -1
  150. package/dist/src/__tests__/mcp.test.d.ts +0 -2
  151. package/dist/src/__tests__/mcp.test.d.ts.map +0 -1
  152. package/dist/src/__tests__/mcp.test.js +0 -1003
  153. package/dist/src/__tests__/mcp.test.js.map +0 -1
  154. package/dist/src/__tests__/mime.test.d.ts +0 -2
  155. package/dist/src/__tests__/mime.test.d.ts.map +0 -1
  156. package/dist/src/__tests__/mime.test.js +0 -83
  157. package/dist/src/__tests__/mime.test.js.map +0 -1
  158. package/dist/src/__tests__/state-store.test.d.ts +0 -2
  159. package/dist/src/__tests__/state-store.test.d.ts.map +0 -1
  160. package/dist/src/__tests__/state-store.test.js +0 -285
  161. package/dist/src/__tests__/state-store.test.js.map +0 -1
  162. package/dist/src/a2a/__tests__/a2a-agent.test.d.ts +0 -2
  163. package/dist/src/a2a/__tests__/a2a-agent.test.d.ts.map +0 -1
  164. package/dist/src/a2a/__tests__/a2a-agent.test.js +0 -383
  165. package/dist/src/a2a/__tests__/a2a-agent.test.js.map +0 -1
  166. package/dist/src/a2a/__tests__/adapters.test.d.ts +0 -2
  167. package/dist/src/a2a/__tests__/adapters.test.d.ts.map +0 -1
  168. package/dist/src/a2a/__tests__/adapters.test.js +0 -151
  169. package/dist/src/a2a/__tests__/adapters.test.js.map +0 -1
  170. package/dist/src/a2a/__tests__/async-lock.test.d.ts +0 -2
  171. package/dist/src/a2a/__tests__/async-lock.test.d.ts.map +0 -1
  172. package/dist/src/a2a/__tests__/async-lock.test.js +0 -137
  173. package/dist/src/a2a/__tests__/async-lock.test.js.map +0 -1
  174. package/dist/src/a2a/__tests__/events.test.d.ts +0 -2
  175. package/dist/src/a2a/__tests__/events.test.d.ts.map +0 -1
  176. package/dist/src/a2a/__tests__/events.test.js +0 -68
  177. package/dist/src/a2a/__tests__/events.test.js.map +0 -1
  178. package/dist/src/a2a/__tests__/executor.test.d.ts +0 -2
  179. package/dist/src/a2a/__tests__/executor.test.d.ts.map +0 -1
  180. package/dist/src/a2a/__tests__/executor.test.js +0 -345
  181. package/dist/src/a2a/__tests__/executor.test.js.map +0 -1
  182. package/dist/src/a2a/__tests__/server.test.d.ts +0 -2
  183. package/dist/src/a2a/__tests__/server.test.d.ts.map +0 -1
  184. package/dist/src/a2a/__tests__/server.test.js +0 -71
  185. package/dist/src/a2a/__tests__/server.test.js.map +0 -1
  186. package/dist/src/a2a/__tests__/server.test.node.d.ts +0 -2
  187. package/dist/src/a2a/__tests__/server.test.node.d.ts.map +0 -1
  188. package/dist/src/a2a/__tests__/server.test.node.js +0 -110
  189. package/dist/src/a2a/__tests__/server.test.node.js.map +0 -1
  190. package/dist/src/agent/__tests__/agent-as-tool.invocation-state.test.d.ts +0 -2
  191. package/dist/src/agent/__tests__/agent-as-tool.invocation-state.test.d.ts.map +0 -1
  192. package/dist/src/agent/__tests__/agent-as-tool.invocation-state.test.js +0 -23
  193. package/dist/src/agent/__tests__/agent-as-tool.invocation-state.test.js.map +0 -1
  194. package/dist/src/agent/__tests__/agent-as-tool.test.d.ts +0 -2
  195. package/dist/src/agent/__tests__/agent-as-tool.test.d.ts.map +0 -1
  196. package/dist/src/agent/__tests__/agent-as-tool.test.js +0 -347
  197. package/dist/src/agent/__tests__/agent-as-tool.test.js.map +0 -1
  198. package/dist/src/agent/__tests__/agent.cancel.test.d.ts +0 -2
  199. package/dist/src/agent/__tests__/agent.cancel.test.d.ts.map +0 -1
  200. package/dist/src/agent/__tests__/agent.cancel.test.js +0 -337
  201. package/dist/src/agent/__tests__/agent.cancel.test.js.map +0 -1
  202. package/dist/src/agent/__tests__/agent.concurrent.test.d.ts +0 -2
  203. package/dist/src/agent/__tests__/agent.concurrent.test.d.ts.map +0 -1
  204. package/dist/src/agent/__tests__/agent.concurrent.test.js +0 -488
  205. package/dist/src/agent/__tests__/agent.concurrent.test.js.map +0 -1
  206. package/dist/src/agent/__tests__/agent.context-manager.test.d.ts +0 -2
  207. package/dist/src/agent/__tests__/agent.context-manager.test.d.ts.map +0 -1
  208. package/dist/src/agent/__tests__/agent.context-manager.test.js +0 -106
  209. package/dist/src/agent/__tests__/agent.context-manager.test.js.map +0 -1
  210. package/dist/src/agent/__tests__/agent.hook.test.d.ts +0 -2
  211. package/dist/src/agent/__tests__/agent.hook.test.d.ts.map +0 -1
  212. package/dist/src/agent/__tests__/agent.hook.test.js +0 -1332
  213. package/dist/src/agent/__tests__/agent.hook.test.js.map +0 -1
  214. package/dist/src/agent/__tests__/agent.interrupt.test.d.ts +0 -2
  215. package/dist/src/agent/__tests__/agent.interrupt.test.d.ts.map +0 -1
  216. package/dist/src/agent/__tests__/agent.interrupt.test.js +0 -779
  217. package/dist/src/agent/__tests__/agent.interrupt.test.js.map +0 -1
  218. package/dist/src/agent/__tests__/agent.invocation-state.test.d.ts +0 -2
  219. package/dist/src/agent/__tests__/agent.invocation-state.test.d.ts.map +0 -1
  220. package/dist/src/agent/__tests__/agent.invocation-state.test.js +0 -219
  221. package/dist/src/agent/__tests__/agent.invocation-state.test.js.map +0 -1
  222. package/dist/src/agent/__tests__/agent.model-retry.test.d.ts +0 -2
  223. package/dist/src/agent/__tests__/agent.model-retry.test.d.ts.map +0 -1
  224. package/dist/src/agent/__tests__/agent.model-retry.test.js +0 -161
  225. package/dist/src/agent/__tests__/agent.model-retry.test.js.map +0 -1
  226. package/dist/src/agent/__tests__/agent.stateful-model.test.d.ts +0 -2
  227. package/dist/src/agent/__tests__/agent.stateful-model.test.d.ts.map +0 -1
  228. package/dist/src/agent/__tests__/agent.stateful-model.test.js +0 -169
  229. package/dist/src/agent/__tests__/agent.stateful-model.test.js.map +0 -1
  230. package/dist/src/agent/__tests__/agent.test.d.ts +0 -2
  231. package/dist/src/agent/__tests__/agent.test.d.ts.map +0 -1
  232. package/dist/src/agent/__tests__/agent.test.js +0 -1624
  233. package/dist/src/agent/__tests__/agent.test.js.map +0 -1
  234. package/dist/src/agent/__tests__/agent.tracer.test.node.d.ts +0 -2
  235. package/dist/src/agent/__tests__/agent.tracer.test.node.d.ts.map +0 -1
  236. package/dist/src/agent/__tests__/agent.tracer.test.node.js +0 -535
  237. package/dist/src/agent/__tests__/agent.tracer.test.node.js.map +0 -1
  238. package/dist/src/agent/__tests__/printer.test.d.ts +0 -2
  239. package/dist/src/agent/__tests__/printer.test.d.ts.map +0 -1
  240. package/dist/src/agent/__tests__/printer.test.js +0 -188
  241. package/dist/src/agent/__tests__/printer.test.js.map +0 -1
  242. package/dist/src/agent/__tests__/snapshot.test.d.ts +0 -2
  243. package/dist/src/agent/__tests__/snapshot.test.d.ts.map +0 -1
  244. package/dist/src/agent/__tests__/snapshot.test.js +0 -442
  245. package/dist/src/agent/__tests__/snapshot.test.js.map +0 -1
  246. package/dist/src/agent/__tests__/tool-caller.test.d.ts +0 -2
  247. package/dist/src/agent/__tests__/tool-caller.test.d.ts.map +0 -1
  248. package/dist/src/agent/__tests__/tool-caller.test.js +0 -459
  249. package/dist/src/agent/__tests__/tool-caller.test.js.map +0 -1
  250. package/dist/src/conversation-manager/__tests__/agentic-context.test.d.ts +0 -2
  251. package/dist/src/conversation-manager/__tests__/agentic-context.test.d.ts.map +0 -1
  252. package/dist/src/conversation-manager/__tests__/agentic-context.test.js +0 -332
  253. package/dist/src/conversation-manager/__tests__/agentic-context.test.js.map +0 -1
  254. package/dist/src/conversation-manager/__tests__/context-compression.test.d.ts +0 -2
  255. package/dist/src/conversation-manager/__tests__/context-compression.test.d.ts.map +0 -1
  256. package/dist/src/conversation-manager/__tests__/context-compression.test.js +0 -176
  257. package/dist/src/conversation-manager/__tests__/context-compression.test.js.map +0 -1
  258. package/dist/src/conversation-manager/__tests__/conversation-manager.test.d.ts +0 -2
  259. package/dist/src/conversation-manager/__tests__/conversation-manager.test.d.ts.map +0 -1
  260. package/dist/src/conversation-manager/__tests__/conversation-manager.test.js +0 -321
  261. package/dist/src/conversation-manager/__tests__/conversation-manager.test.js.map +0 -1
  262. package/dist/src/conversation-manager/__tests__/null-conversation-manager.test.d.ts +0 -2
  263. package/dist/src/conversation-manager/__tests__/null-conversation-manager.test.d.ts.map +0 -1
  264. package/dist/src/conversation-manager/__tests__/null-conversation-manager.test.js +0 -64
  265. package/dist/src/conversation-manager/__tests__/null-conversation-manager.test.js.map +0 -1
  266. package/dist/src/conversation-manager/__tests__/pin.test.d.ts +0 -2
  267. package/dist/src/conversation-manager/__tests__/pin.test.d.ts.map +0 -1
  268. package/dist/src/conversation-manager/__tests__/pin.test.js +0 -119
  269. package/dist/src/conversation-manager/__tests__/pin.test.js.map +0 -1
  270. package/dist/src/conversation-manager/__tests__/sliding-window-conversation-manager.test.d.ts +0 -2
  271. package/dist/src/conversation-manager/__tests__/sliding-window-conversation-manager.test.d.ts.map +0 -1
  272. package/dist/src/conversation-manager/__tests__/sliding-window-conversation-manager.test.js +0 -1080
  273. package/dist/src/conversation-manager/__tests__/sliding-window-conversation-manager.test.js.map +0 -1
  274. package/dist/src/conversation-manager/__tests__/summarizing-conversation-manager.test.d.ts +0 -2
  275. package/dist/src/conversation-manager/__tests__/summarizing-conversation-manager.test.d.ts.map +0 -1
  276. package/dist/src/conversation-manager/__tests__/summarizing-conversation-manager.test.js +0 -400
  277. package/dist/src/conversation-manager/__tests__/summarizing-conversation-manager.test.js.map +0 -1
  278. package/dist/src/conversation-manager/__tests__/token-usage-middleware.test.d.ts +0 -2
  279. package/dist/src/conversation-manager/__tests__/token-usage-middleware.test.d.ts.map +0 -1
  280. package/dist/src/conversation-manager/__tests__/token-usage-middleware.test.js +0 -138
  281. package/dist/src/conversation-manager/__tests__/token-usage-middleware.test.js.map +0 -1
  282. package/dist/src/hooks/__tests__/events.test.d.ts +0 -2
  283. package/dist/src/hooks/__tests__/events.test.d.ts.map +0 -1
  284. package/dist/src/hooks/__tests__/events.test.js +0 -1060
  285. package/dist/src/hooks/__tests__/events.test.js.map +0 -1
  286. package/dist/src/hooks/__tests__/registry.test.d.ts +0 -2
  287. package/dist/src/hooks/__tests__/registry.test.d.ts.map +0 -1
  288. package/dist/src/hooks/__tests__/registry.test.js +0 -325
  289. package/dist/src/hooks/__tests__/registry.test.js.map +0 -1
  290. package/dist/src/injection/__tests__/message-injection.test.d.ts +0 -2
  291. package/dist/src/injection/__tests__/message-injection.test.d.ts.map +0 -1
  292. package/dist/src/injection/__tests__/message-injection.test.js +0 -200
  293. package/dist/src/injection/__tests__/message-injection.test.js.map +0 -1
  294. package/dist/src/interventions/__tests__/handler.test.d.ts +0 -2
  295. package/dist/src/interventions/__tests__/handler.test.d.ts.map +0 -1
  296. package/dist/src/interventions/__tests__/handler.test.js +0 -35
  297. package/dist/src/interventions/__tests__/handler.test.js.map +0 -1
  298. package/dist/src/interventions/__tests__/registry.test.d.ts +0 -2
  299. package/dist/src/interventions/__tests__/registry.test.d.ts.map +0 -1
  300. package/dist/src/interventions/__tests__/registry.test.js +0 -692
  301. package/dist/src/interventions/__tests__/registry.test.js.map +0 -1
  302. package/dist/src/logging/__tests__/logger.test.d.ts +0 -2
  303. package/dist/src/logging/__tests__/logger.test.d.ts.map +0 -1
  304. package/dist/src/logging/__tests__/logger.test.js +0 -70
  305. package/dist/src/logging/__tests__/logger.test.js.map +0 -1
  306. package/dist/src/logging/__tests__/warn-once.test.d.ts +0 -2
  307. package/dist/src/logging/__tests__/warn-once.test.d.ts.map +0 -1
  308. package/dist/src/logging/__tests__/warn-once.test.js +0 -30
  309. package/dist/src/logging/__tests__/warn-once.test.js.map +0 -1
  310. package/dist/src/mcp.d.ts.map +0 -1
  311. package/dist/src/mcp.js.map +0 -1
  312. package/dist/src/memory/__tests__/memory-manager.test.d.ts +0 -2
  313. package/dist/src/memory/__tests__/memory-manager.test.d.ts.map +0 -1
  314. package/dist/src/memory/__tests__/memory-manager.test.js +0 -679
  315. package/dist/src/memory/__tests__/memory-manager.test.js.map +0 -1
  316. package/dist/src/memory/__tests__/memory-tracing.test.d.ts +0 -2
  317. package/dist/src/memory/__tests__/memory-tracing.test.d.ts.map +0 -1
  318. package/dist/src/memory/__tests__/memory-tracing.test.js +0 -250
  319. package/dist/src/memory/__tests__/memory-tracing.test.js.map +0 -1
  320. package/dist/src/memory/extraction/__tests__/extraction.test.d.ts +0 -2
  321. package/dist/src/memory/extraction/__tests__/extraction.test.d.ts.map +0 -1
  322. package/dist/src/memory/extraction/__tests__/extraction.test.js +0 -639
  323. package/dist/src/memory/extraction/__tests__/extraction.test.js.map +0 -1
  324. package/dist/src/memory/extraction/__tests__/model-extractor.test.d.ts +0 -2
  325. package/dist/src/memory/extraction/__tests__/model-extractor.test.d.ts.map +0 -1
  326. package/dist/src/memory/extraction/__tests__/model-extractor.test.js +0 -104
  327. package/dist/src/memory/extraction/__tests__/model-extractor.test.js.map +0 -1
  328. package/dist/src/memory/extraction/__tests__/resolve-extraction-config.test.d.ts +0 -2
  329. package/dist/src/memory/extraction/__tests__/resolve-extraction-config.test.d.ts.map +0 -1
  330. package/dist/src/memory/extraction/__tests__/resolve-extraction-config.test.js +0 -81
  331. package/dist/src/memory/extraction/__tests__/resolve-extraction-config.test.js.map +0 -1
  332. package/dist/src/middleware/__tests__/agent-middleware.test.d.ts +0 -2
  333. package/dist/src/middleware/__tests__/agent-middleware.test.d.ts.map +0 -1
  334. package/dist/src/middleware/__tests__/agent-middleware.test.js +0 -1206
  335. package/dist/src/middleware/__tests__/agent-middleware.test.js.map +0 -1
  336. package/dist/src/middleware/__tests__/copy-on-input.test.d.ts +0 -2
  337. package/dist/src/middleware/__tests__/copy-on-input.test.d.ts.map +0 -1
  338. package/dist/src/middleware/__tests__/copy-on-input.test.js +0 -379
  339. package/dist/src/middleware/__tests__/copy-on-input.test.js.map +0 -1
  340. package/dist/src/middleware/__tests__/custom-stages.test.d.ts +0 -2
  341. package/dist/src/middleware/__tests__/custom-stages.test.d.ts.map +0 -1
  342. package/dist/src/middleware/__tests__/custom-stages.test.js +0 -97
  343. package/dist/src/middleware/__tests__/custom-stages.test.js.map +0 -1
  344. package/dist/src/middleware/__tests__/middleware-interrupts.test.d.ts +0 -2
  345. package/dist/src/middleware/__tests__/middleware-interrupts.test.d.ts.map +0 -1
  346. package/dist/src/middleware/__tests__/middleware-interrupts.test.js +0 -267
  347. package/dist/src/middleware/__tests__/middleware-interrupts.test.js.map +0 -1
  348. package/dist/src/middleware/__tests__/registry.test.d.ts +0 -2
  349. package/dist/src/middleware/__tests__/registry.test.d.ts.map +0 -1
  350. package/dist/src/middleware/__tests__/registry.test.js +0 -525
  351. package/dist/src/middleware/__tests__/registry.test.js.map +0 -1
  352. package/dist/src/models/__tests__/anthropic.test.d.ts +0 -2
  353. package/dist/src/models/__tests__/anthropic.test.d.ts.map +0 -1
  354. package/dist/src/models/__tests__/anthropic.test.js +0 -793
  355. package/dist/src/models/__tests__/anthropic.test.js.map +0 -1
  356. package/dist/src/models/__tests__/bedrock.test.d.ts +0 -2
  357. package/dist/src/models/__tests__/bedrock.test.d.ts.map +0 -1
  358. package/dist/src/models/__tests__/bedrock.test.js +0 -3964
  359. package/dist/src/models/__tests__/bedrock.test.js.map +0 -1
  360. package/dist/src/models/__tests__/defaults.test.d.ts +0 -2
  361. package/dist/src/models/__tests__/defaults.test.d.ts.map +0 -1
  362. package/dist/src/models/__tests__/defaults.test.js +0 -36
  363. package/dist/src/models/__tests__/defaults.test.js.map +0 -1
  364. package/dist/src/models/__tests__/google.test.d.ts +0 -2
  365. package/dist/src/models/__tests__/google.test.d.ts.map +0 -1
  366. package/dist/src/models/__tests__/google.test.js +0 -1145
  367. package/dist/src/models/__tests__/google.test.js.map +0 -1
  368. package/dist/src/models/__tests__/model.test.d.ts +0 -2
  369. package/dist/src/models/__tests__/model.test.d.ts.map +0 -1
  370. package/dist/src/models/__tests__/model.test.js +0 -921
  371. package/dist/src/models/__tests__/model.test.js.map +0 -1
  372. package/dist/src/models/__tests__/streaming.test.d.ts +0 -2
  373. package/dist/src/models/__tests__/streaming.test.d.ts.map +0 -1
  374. package/dist/src/models/__tests__/streaming.test.js +0 -50
  375. package/dist/src/models/__tests__/streaming.test.js.map +0 -1
  376. package/dist/src/models/__tests__/test-utils.d.ts +0 -10
  377. package/dist/src/models/__tests__/test-utils.d.ts.map +0 -1
  378. package/dist/src/models/__tests__/test-utils.js +0 -17
  379. package/dist/src/models/__tests__/test-utils.js.map +0 -1
  380. package/dist/src/models/__tests__/vercel.test.d.ts +0 -2
  381. package/dist/src/models/__tests__/vercel.test.d.ts.map +0 -1
  382. package/dist/src/models/__tests__/vercel.test.js +0 -740
  383. package/dist/src/models/__tests__/vercel.test.js.map +0 -1
  384. package/dist/src/models/openai/__tests__/chat.test.d.ts +0 -2
  385. package/dist/src/models/openai/__tests__/chat.test.d.ts.map +0 -1
  386. package/dist/src/models/openai/__tests__/chat.test.js +0 -1586
  387. package/dist/src/models/openai/__tests__/chat.test.js.map +0 -1
  388. package/dist/src/models/openai/__tests__/errors.test.d.ts +0 -2
  389. package/dist/src/models/openai/__tests__/errors.test.d.ts.map +0 -1
  390. package/dist/src/models/openai/__tests__/errors.test.js +0 -39
  391. package/dist/src/models/openai/__tests__/errors.test.js.map +0 -1
  392. package/dist/src/models/openai/__tests__/mantle.test.d.ts +0 -2
  393. package/dist/src/models/openai/__tests__/mantle.test.d.ts.map +0 -1
  394. package/dist/src/models/openai/__tests__/mantle.test.js +0 -189
  395. package/dist/src/models/openai/__tests__/mantle.test.js.map +0 -1
  396. package/dist/src/models/openai/__tests__/responses.test.d.ts +0 -2
  397. package/dist/src/models/openai/__tests__/responses.test.d.ts.map +0 -1
  398. package/dist/src/models/openai/__tests__/responses.test.js +0 -709
  399. package/dist/src/models/openai/__tests__/responses.test.js.map +0 -1
  400. package/dist/src/multiagent/__tests__/events.test.d.ts +0 -2
  401. package/dist/src/multiagent/__tests__/events.test.d.ts.map +0 -1
  402. package/dist/src/multiagent/__tests__/events.test.js +0 -493
  403. package/dist/src/multiagent/__tests__/events.test.js.map +0 -1
  404. package/dist/src/multiagent/__tests__/graph.invocation-state.test.d.ts +0 -2
  405. package/dist/src/multiagent/__tests__/graph.invocation-state.test.d.ts.map +0 -1
  406. package/dist/src/multiagent/__tests__/graph.invocation-state.test.js +0 -95
  407. package/dist/src/multiagent/__tests__/graph.invocation-state.test.js.map +0 -1
  408. package/dist/src/multiagent/__tests__/graph.test.d.ts +0 -2
  409. package/dist/src/multiagent/__tests__/graph.test.d.ts.map +0 -1
  410. package/dist/src/multiagent/__tests__/graph.test.js +0 -698
  411. package/dist/src/multiagent/__tests__/graph.test.js.map +0 -1
  412. package/dist/src/multiagent/__tests__/graph.tracer.test.d.ts +0 -2
  413. package/dist/src/multiagent/__tests__/graph.tracer.test.d.ts.map +0 -1
  414. package/dist/src/multiagent/__tests__/graph.tracer.test.js +0 -218
  415. package/dist/src/multiagent/__tests__/graph.tracer.test.js.map +0 -1
  416. package/dist/src/multiagent/__tests__/interrupts.test.d.ts +0 -2
  417. package/dist/src/multiagent/__tests__/interrupts.test.d.ts.map +0 -1
  418. package/dist/src/multiagent/__tests__/interrupts.test.js +0 -390
  419. package/dist/src/multiagent/__tests__/interrupts.test.js.map +0 -1
  420. package/dist/src/multiagent/__tests__/nodes.test.d.ts +0 -2
  421. package/dist/src/multiagent/__tests__/nodes.test.d.ts.map +0 -1
  422. package/dist/src/multiagent/__tests__/nodes.test.js +0 -321
  423. package/dist/src/multiagent/__tests__/nodes.test.js.map +0 -1
  424. package/dist/src/multiagent/__tests__/queue.test.d.ts +0 -2
  425. package/dist/src/multiagent/__tests__/queue.test.d.ts.map +0 -1
  426. package/dist/src/multiagent/__tests__/queue.test.js +0 -118
  427. package/dist/src/multiagent/__tests__/queue.test.js.map +0 -1
  428. package/dist/src/multiagent/__tests__/snapshot.test.d.ts +0 -2
  429. package/dist/src/multiagent/__tests__/snapshot.test.d.ts.map +0 -1
  430. package/dist/src/multiagent/__tests__/snapshot.test.js +0 -161
  431. package/dist/src/multiagent/__tests__/snapshot.test.js.map +0 -1
  432. package/dist/src/multiagent/__tests__/state.test.d.ts +0 -2
  433. package/dist/src/multiagent/__tests__/state.test.d.ts.map +0 -1
  434. package/dist/src/multiagent/__tests__/state.test.js +0 -526
  435. package/dist/src/multiagent/__tests__/state.test.js.map +0 -1
  436. package/dist/src/multiagent/__tests__/swarm.invocation-state.test.d.ts +0 -2
  437. package/dist/src/multiagent/__tests__/swarm.invocation-state.test.d.ts.map +0 -1
  438. package/dist/src/multiagent/__tests__/swarm.invocation-state.test.js +0 -56
  439. package/dist/src/multiagent/__tests__/swarm.invocation-state.test.js.map +0 -1
  440. package/dist/src/multiagent/__tests__/swarm.test.d.ts +0 -2
  441. package/dist/src/multiagent/__tests__/swarm.test.d.ts.map +0 -1
  442. package/dist/src/multiagent/__tests__/swarm.test.js +0 -477
  443. package/dist/src/multiagent/__tests__/swarm.test.js.map +0 -1
  444. package/dist/src/multiagent/__tests__/swarm.tracer.test.d.ts +0 -2
  445. package/dist/src/multiagent/__tests__/swarm.tracer.test.d.ts.map +0 -1
  446. package/dist/src/multiagent/__tests__/swarm.tracer.test.js +0 -235
  447. package/dist/src/multiagent/__tests__/swarm.tracer.test.js.map +0 -1
  448. package/dist/src/plugins/__tests__/plugin.test.d.ts +0 -2
  449. package/dist/src/plugins/__tests__/plugin.test.d.ts.map +0 -1
  450. package/dist/src/plugins/__tests__/plugin.test.js +0 -114
  451. package/dist/src/plugins/__tests__/plugin.test.js.map +0 -1
  452. package/dist/src/plugins/__tests__/registry.test.d.ts +0 -2
  453. package/dist/src/plugins/__tests__/registry.test.d.ts.map +0 -1
  454. package/dist/src/plugins/__tests__/registry.test.js +0 -147
  455. package/dist/src/plugins/__tests__/registry.test.js.map +0 -1
  456. package/dist/src/registry/__tests__/tool-registry.test.d.ts +0 -2
  457. package/dist/src/registry/__tests__/tool-registry.test.d.ts.map +0 -1
  458. package/dist/src/registry/__tests__/tool-registry.test.js +0 -210
  459. package/dist/src/registry/__tests__/tool-registry.test.js.map +0 -1
  460. package/dist/src/retry/__tests__/backoff-strategy.test.d.ts +0 -2
  461. package/dist/src/retry/__tests__/backoff-strategy.test.d.ts.map +0 -1
  462. package/dist/src/retry/__tests__/backoff-strategy.test.js +0 -116
  463. package/dist/src/retry/__tests__/backoff-strategy.test.js.map +0 -1
  464. package/dist/src/retry/__tests__/default-model-retry-strategy.test.d.ts +0 -2
  465. package/dist/src/retry/__tests__/default-model-retry-strategy.test.d.ts.map +0 -1
  466. package/dist/src/retry/__tests__/default-model-retry-strategy.test.js +0 -225
  467. package/dist/src/retry/__tests__/default-model-retry-strategy.test.js.map +0 -1
  468. package/dist/src/sandbox/__tests__/default.test.browser.d.ts +0 -2
  469. package/dist/src/sandbox/__tests__/default.test.browser.d.ts.map +0 -1
  470. package/dist/src/sandbox/__tests__/default.test.browser.js +0 -11
  471. package/dist/src/sandbox/__tests__/default.test.browser.js.map +0 -1
  472. package/dist/src/sandbox/__tests__/default.test.node.d.ts +0 -2
  473. package/dist/src/sandbox/__tests__/default.test.node.d.ts.map +0 -1
  474. package/dist/src/sandbox/__tests__/default.test.node.js +0 -23
  475. package/dist/src/sandbox/__tests__/default.test.node.js.map +0 -1
  476. package/dist/src/sandbox/__tests__/docker.test.node.d.ts +0 -2
  477. package/dist/src/sandbox/__tests__/docker.test.node.d.ts.map +0 -1
  478. package/dist/src/sandbox/__tests__/docker.test.node.js +0 -89
  479. package/dist/src/sandbox/__tests__/docker.test.node.js.map +0 -1
  480. package/dist/src/sandbox/__tests__/errors.test.node.d.ts +0 -2
  481. package/dist/src/sandbox/__tests__/errors.test.node.d.ts.map +0 -1
  482. package/dist/src/sandbox/__tests__/errors.test.node.js +0 -33
  483. package/dist/src/sandbox/__tests__/errors.test.node.js.map +0 -1
  484. package/dist/src/sandbox/__tests__/not-a-sandbox-local-environment.test.node.d.ts +0 -2
  485. package/dist/src/sandbox/__tests__/not-a-sandbox-local-environment.test.node.d.ts.map +0 -1
  486. package/dist/src/sandbox/__tests__/not-a-sandbox-local-environment.test.node.js +0 -124
  487. package/dist/src/sandbox/__tests__/not-a-sandbox-local-environment.test.node.js.map +0 -1
  488. package/dist/src/sandbox/__tests__/posix-shell.test.node.d.ts +0 -2
  489. package/dist/src/sandbox/__tests__/posix-shell.test.node.d.ts.map +0 -1
  490. package/dist/src/sandbox/__tests__/posix-shell.test.node.js +0 -298
  491. package/dist/src/sandbox/__tests__/posix-shell.test.node.js.map +0 -1
  492. package/dist/src/sandbox/__tests__/ssh.test.node.d.ts +0 -2
  493. package/dist/src/sandbox/__tests__/ssh.test.node.d.ts.map +0 -1
  494. package/dist/src/sandbox/__tests__/ssh.test.node.js +0 -262
  495. package/dist/src/sandbox/__tests__/ssh.test.node.js.map +0 -1
  496. package/dist/src/session/__tests__/file-storage.test.node.d.ts +0 -2
  497. package/dist/src/session/__tests__/file-storage.test.node.d.ts.map +0 -1
  498. package/dist/src/session/__tests__/file-storage.test.node.js +0 -278
  499. package/dist/src/session/__tests__/file-storage.test.node.js.map +0 -1
  500. package/dist/src/session/__tests__/s3-storage.test.d.ts +0 -2
  501. package/dist/src/session/__tests__/s3-storage.test.d.ts.map +0 -1
  502. package/dist/src/session/__tests__/s3-storage.test.js +0 -461
  503. package/dist/src/session/__tests__/s3-storage.test.js.map +0 -1
  504. package/dist/src/session/__tests__/session-manager.test.d.ts +0 -2
  505. package/dist/src/session/__tests__/session-manager.test.d.ts.map +0 -1
  506. package/dist/src/session/__tests__/session-manager.test.js +0 -832
  507. package/dist/src/session/__tests__/session-manager.test.js.map +0 -1
  508. package/dist/src/session/__tests__/validation.test.d.ts +0 -2
  509. package/dist/src/session/__tests__/validation.test.d.ts.map +0 -1
  510. package/dist/src/session/__tests__/validation.test.js +0 -47
  511. package/dist/src/session/__tests__/validation.test.js.map +0 -1
  512. package/dist/src/telemetry/__tests__/config.test.d.ts +0 -2
  513. package/dist/src/telemetry/__tests__/config.test.d.ts.map +0 -1
  514. package/dist/src/telemetry/__tests__/config.test.js +0 -64
  515. package/dist/src/telemetry/__tests__/config.test.js.map +0 -1
  516. package/dist/src/telemetry/__tests__/config.test.node.d.ts +0 -2
  517. package/dist/src/telemetry/__tests__/config.test.node.d.ts.map +0 -1
  518. package/dist/src/telemetry/__tests__/config.test.node.js +0 -164
  519. package/dist/src/telemetry/__tests__/config.test.node.js.map +0 -1
  520. package/dist/src/telemetry/__tests__/json.test.d.ts +0 -2
  521. package/dist/src/telemetry/__tests__/json.test.d.ts.map +0 -1
  522. package/dist/src/telemetry/__tests__/json.test.js +0 -89
  523. package/dist/src/telemetry/__tests__/json.test.js.map +0 -1
  524. package/dist/src/telemetry/__tests__/local-trace.test.d.ts +0 -2
  525. package/dist/src/telemetry/__tests__/local-trace.test.d.ts.map +0 -1
  526. package/dist/src/telemetry/__tests__/local-trace.test.js +0 -158
  527. package/dist/src/telemetry/__tests__/local-trace.test.js.map +0 -1
  528. package/dist/src/telemetry/__tests__/meter.test.d.ts +0 -2
  529. package/dist/src/telemetry/__tests__/meter.test.d.ts.map +0 -1
  530. package/dist/src/telemetry/__tests__/meter.test.js +0 -695
  531. package/dist/src/telemetry/__tests__/meter.test.js.map +0 -1
  532. package/dist/src/telemetry/__tests__/tracer.test.node.d.ts +0 -2
  533. package/dist/src/telemetry/__tests__/tracer.test.node.d.ts.map +0 -1
  534. package/dist/src/telemetry/__tests__/tracer.test.node.js +0 -958
  535. package/dist/src/telemetry/__tests__/tracer.test.node.js.map +0 -1
  536. package/dist/src/tools/__tests__/structured-output-tool.test.d.ts +0 -2
  537. package/dist/src/tools/__tests__/structured-output-tool.test.d.ts.map +0 -1
  538. package/dist/src/tools/__tests__/structured-output-tool.test.js +0 -84
  539. package/dist/src/tools/__tests__/structured-output-tool.test.js.map +0 -1
  540. package/dist/src/tools/__tests__/tool-factory.test.d.ts +0 -2
  541. package/dist/src/tools/__tests__/tool-factory.test.d.ts.map +0 -1
  542. package/dist/src/tools/__tests__/tool-factory.test.js +0 -98
  543. package/dist/src/tools/__tests__/tool-factory.test.js.map +0 -1
  544. package/dist/src/tools/__tests__/tool.test.d.ts +0 -2
  545. package/dist/src/tools/__tests__/tool.test.d.ts.map +0 -1
  546. package/dist/src/tools/__tests__/tool.test.js +0 -1043
  547. package/dist/src/tools/__tests__/tool.test.js.map +0 -1
  548. package/dist/src/tools/__tests__/zod-tool.test-d.d.ts +0 -2
  549. package/dist/src/tools/__tests__/zod-tool.test-d.d.ts.map +0 -1
  550. package/dist/src/tools/__tests__/zod-tool.test-d.js +0 -227
  551. package/dist/src/tools/__tests__/zod-tool.test-d.js.map +0 -1
  552. package/dist/src/tools/__tests__/zod-tool.test.d.ts +0 -2
  553. package/dist/src/tools/__tests__/zod-tool.test.d.ts.map +0 -1
  554. package/dist/src/tools/__tests__/zod-tool.test.js +0 -563
  555. package/dist/src/tools/__tests__/zod-tool.test.js.map +0 -1
  556. package/dist/src/types/__tests__/agent.test.d.ts +0 -2
  557. package/dist/src/types/__tests__/agent.test.d.ts.map +0 -1
  558. package/dist/src/types/__tests__/agent.test.js +0 -476
  559. package/dist/src/types/__tests__/agent.test.js.map +0 -1
  560. package/dist/src/types/__tests__/citations.test.d.ts +0 -2
  561. package/dist/src/types/__tests__/citations.test.d.ts.map +0 -1
  562. package/dist/src/types/__tests__/citations.test.js +0 -104
  563. package/dist/src/types/__tests__/citations.test.js.map +0 -1
  564. package/dist/src/types/__tests__/json.test.d.ts +0 -2
  565. package/dist/src/types/__tests__/json.test.d.ts.map +0 -1
  566. package/dist/src/types/__tests__/json.test.js +0 -298
  567. package/dist/src/types/__tests__/json.test.js.map +0 -1
  568. package/dist/src/types/__tests__/media.test.d.ts +0 -2
  569. package/dist/src/types/__tests__/media.test.d.ts.map +0 -1
  570. package/dist/src/types/__tests__/media.test.js +0 -478
  571. package/dist/src/types/__tests__/media.test.js.map +0 -1
  572. package/dist/src/types/__tests__/messages.test.d.ts +0 -2
  573. package/dist/src/types/__tests__/messages.test.d.ts.map +0 -1
  574. package/dist/src/types/__tests__/messages.test.js +0 -681
  575. package/dist/src/types/__tests__/messages.test.js.map +0 -1
  576. package/dist/src/types/__tests__/validation.test.d.ts +0 -2
  577. package/dist/src/types/__tests__/validation.test.d.ts.map +0 -1
  578. package/dist/src/types/__tests__/validation.test.js +0 -30
  579. package/dist/src/types/__tests__/validation.test.js.map +0 -1
  580. package/dist/src/vended-interventions/cedar/__tests__/cedar.test.node.d.ts +0 -2
  581. package/dist/src/vended-interventions/cedar/__tests__/cedar.test.node.d.ts.map +0 -1
  582. package/dist/src/vended-interventions/cedar/__tests__/cedar.test.node.js +0 -756
  583. package/dist/src/vended-interventions/cedar/__tests__/cedar.test.node.js.map +0 -1
  584. package/dist/src/vended-interventions/hitl/__tests__/hitl.test.d.ts +0 -2
  585. package/dist/src/vended-interventions/hitl/__tests__/hitl.test.d.ts.map +0 -1
  586. package/dist/src/vended-interventions/hitl/__tests__/hitl.test.js +0 -358
  587. package/dist/src/vended-interventions/hitl/__tests__/hitl.test.js.map +0 -1
  588. package/dist/src/vended-interventions/steering/__tests__/handler.test.d.ts +0 -2
  589. package/dist/src/vended-interventions/steering/__tests__/handler.test.d.ts.map +0 -1
  590. package/dist/src/vended-interventions/steering/__tests__/handler.test.js +0 -163
  591. package/dist/src/vended-interventions/steering/__tests__/handler.test.js.map +0 -1
  592. package/dist/src/vended-interventions/steering/__tests__/llm.test.d.ts +0 -2
  593. package/dist/src/vended-interventions/steering/__tests__/llm.test.d.ts.map +0 -1
  594. package/dist/src/vended-interventions/steering/__tests__/llm.test.js +0 -60
  595. package/dist/src/vended-interventions/steering/__tests__/llm.test.js.map +0 -1
  596. package/dist/src/vended-interventions/steering/__tests__/tool-ledger.test.d.ts +0 -2
  597. package/dist/src/vended-interventions/steering/__tests__/tool-ledger.test.d.ts.map +0 -1
  598. package/dist/src/vended-interventions/steering/__tests__/tool-ledger.test.js +0 -94
  599. package/dist/src/vended-interventions/steering/__tests__/tool-ledger.test.js.map +0 -1
  600. package/dist/src/vended-memory-stores/bedrock-knowledge-base/__tests__/bedrock-knowledge-base-store.test.node.d.ts +0 -2
  601. package/dist/src/vended-memory-stores/bedrock-knowledge-base/__tests__/bedrock-knowledge-base-store.test.node.d.ts.map +0 -1
  602. package/dist/src/vended-memory-stores/bedrock-knowledge-base/__tests__/bedrock-knowledge-base-store.test.node.js +0 -758
  603. package/dist/src/vended-memory-stores/bedrock-knowledge-base/__tests__/bedrock-knowledge-base-store.test.node.js.map +0 -1
  604. package/dist/src/vended-plugins/context-injector/__tests__/plugin.test.d.ts +0 -2
  605. package/dist/src/vended-plugins/context-injector/__tests__/plugin.test.d.ts.map +0 -1
  606. package/dist/src/vended-plugins/context-injector/__tests__/plugin.test.js +0 -96
  607. package/dist/src/vended-plugins/context-injector/__tests__/plugin.test.js.map +0 -1
  608. package/dist/src/vended-plugins/context-offloader/__tests__/file-storage-sandbox.test.node.d.ts +0 -2
  609. package/dist/src/vended-plugins/context-offloader/__tests__/file-storage-sandbox.test.node.d.ts.map +0 -1
  610. package/dist/src/vended-plugins/context-offloader/__tests__/file-storage-sandbox.test.node.js +0 -68
  611. package/dist/src/vended-plugins/context-offloader/__tests__/file-storage-sandbox.test.node.js.map +0 -1
  612. package/dist/src/vended-plugins/context-offloader/__tests__/plugin.test.d.ts +0 -2
  613. package/dist/src/vended-plugins/context-offloader/__tests__/plugin.test.d.ts.map +0 -1
  614. package/dist/src/vended-plugins/context-offloader/__tests__/plugin.test.js +0 -539
  615. package/dist/src/vended-plugins/context-offloader/__tests__/plugin.test.js.map +0 -1
  616. package/dist/src/vended-plugins/context-offloader/__tests__/plugin.test.node.d.ts +0 -2
  617. package/dist/src/vended-plugins/context-offloader/__tests__/plugin.test.node.d.ts.map +0 -1
  618. package/dist/src/vended-plugins/context-offloader/__tests__/plugin.test.node.js +0 -97
  619. package/dist/src/vended-plugins/context-offloader/__tests__/plugin.test.node.js.map +0 -1
  620. package/dist/src/vended-plugins/context-offloader/__tests__/search.test.d.ts +0 -2
  621. package/dist/src/vended-plugins/context-offloader/__tests__/search.test.d.ts.map +0 -1
  622. package/dist/src/vended-plugins/context-offloader/__tests__/search.test.js +0 -149
  623. package/dist/src/vended-plugins/context-offloader/__tests__/search.test.js.map +0 -1
  624. package/dist/src/vended-plugins/context-offloader/__tests__/storage.test.d.ts +0 -2
  625. package/dist/src/vended-plugins/context-offloader/__tests__/storage.test.d.ts.map +0 -1
  626. package/dist/src/vended-plugins/context-offloader/__tests__/storage.test.js +0 -216
  627. package/dist/src/vended-plugins/context-offloader/__tests__/storage.test.js.map +0 -1
  628. package/dist/src/vended-plugins/context-offloader/__tests__/storage.test.node.d.ts +0 -2
  629. package/dist/src/vended-plugins/context-offloader/__tests__/storage.test.node.d.ts.map +0 -1
  630. package/dist/src/vended-plugins/context-offloader/__tests__/storage.test.node.js +0 -78
  631. package/dist/src/vended-plugins/context-offloader/__tests__/storage.test.node.js.map +0 -1
  632. package/dist/src/vended-plugins/goal/__tests__/plugin.test.d.ts +0 -2
  633. package/dist/src/vended-plugins/goal/__tests__/plugin.test.d.ts.map +0 -1
  634. package/dist/src/vended-plugins/goal/__tests__/plugin.test.js +0 -736
  635. package/dist/src/vended-plugins/goal/__tests__/plugin.test.js.map +0 -1
  636. package/dist/src/vended-plugins/skills/__tests__/agent-skills.test.node.d.ts +0 -2
  637. package/dist/src/vended-plugins/skills/__tests__/agent-skills.test.node.d.ts.map +0 -1
  638. package/dist/src/vended-plugins/skills/__tests__/agent-skills.test.node.js +0 -482
  639. package/dist/src/vended-plugins/skills/__tests__/agent-skills.test.node.js.map +0 -1
  640. package/dist/src/vended-plugins/skills/__tests__/skill.test.node.d.ts +0 -2
  641. package/dist/src/vended-plugins/skills/__tests__/skill.test.node.d.ts.map +0 -1
  642. package/dist/src/vended-plugins/skills/__tests__/skill.test.node.js +0 -476
  643. package/dist/src/vended-plugins/skills/__tests__/skill.test.node.js.map +0 -1
  644. package/dist/src/vended-tools/bash/__tests__/bash.test.node.d.ts +0 -2
  645. package/dist/src/vended-tools/bash/__tests__/bash.test.node.d.ts.map +0 -1
  646. package/dist/src/vended-tools/bash/__tests__/bash.test.node.js +0 -390
  647. package/dist/src/vended-tools/bash/__tests__/bash.test.node.js.map +0 -1
  648. package/dist/src/vended-tools/file-editor/__tests__/file-editor.test.node.d.ts +0 -2
  649. package/dist/src/vended-tools/file-editor/__tests__/file-editor.test.node.d.ts.map +0 -1
  650. package/dist/src/vended-tools/file-editor/__tests__/file-editor.test.node.js +0 -452
  651. package/dist/src/vended-tools/file-editor/__tests__/file-editor.test.node.js.map +0 -1
  652. package/dist/src/vended-tools/http-request/__tests__/http-request.test.d.ts +0 -2
  653. package/dist/src/vended-tools/http-request/__tests__/http-request.test.d.ts.map +0 -1
  654. package/dist/src/vended-tools/http-request/__tests__/http-request.test.js +0 -189
  655. package/dist/src/vended-tools/http-request/__tests__/http-request.test.js.map +0 -1
  656. package/dist/src/vended-tools/notebook/__tests__/notebook.test.d.ts +0 -2
  657. package/dist/src/vended-tools/notebook/__tests__/notebook.test.d.ts.map +0 -1
  658. package/dist/src/vended-tools/notebook/__tests__/notebook.test.js +0 -388
  659. package/dist/src/vended-tools/notebook/__tests__/notebook.test.js.map +0 -1
@@ -1,756 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { CedarAuthorization } from '../cedar.js';
3
- import { Agent } from '../../../agent/agent.js';
4
- import { MockMessageModel } from '../../../__fixtures__/mock-message-model.js';
5
- import { createMockTool } from '../../../__fixtures__/tool-helpers.js';
6
- import { resolve } from 'node:path';
7
- import { writeFileSync, unlinkSync, existsSync } from 'node:fs';
8
- const FIXTURES = resolve(import.meta.dirname, 'fixtures');
9
- describe('CedarAuthorization', () => {
10
- describe('real Cedar evaluation', () => {
11
- const entities = [
12
- { uid: { type: 'Resource', id: 'agent' }, attrs: {}, parents: [] },
13
- { uid: { type: 'User', id: 'alice' }, attrs: { role: 'admin' }, parents: [] },
14
- { uid: { type: 'User', id: 'bob' }, attrs: { role: 'analyst' }, parents: [] },
15
- { uid: { type: 'User', id: 'eve' }, attrs: { role: 'viewer' }, parents: [] },
16
- ];
17
- it('allows permitted tool calls', async () => {
18
- const model = new MockMessageModel()
19
- .addTurn({ type: 'toolUseBlock', name: 'search', toolUseId: 'tool-1', input: { query: 'test' } })
20
- .addTurn({ type: 'textBlock', text: 'Done' });
21
- let toolExecuted = false;
22
- const tool = createMockTool('search', () => {
23
- toolExecuted = true;
24
- return 'results';
25
- });
26
- const cedar = new CedarAuthorization({
27
- policies: `${FIXTURES}/test.cedar`,
28
- entities,
29
- principalResolver: (state) => {
30
- if (!state.user_id)
31
- return undefined;
32
- return { type: 'User', id: String(state.user_id) };
33
- },
34
- });
35
- const agent = new Agent({ model, tools: [tool], interventions: [cedar], printer: false });
36
- const result = await agent.invoke('Search', { invocationState: { user_id: 'alice' } });
37
- expect(result.stopReason).toBe('endTurn');
38
- expect(toolExecuted).toBe(true);
39
- });
40
- it('denies tools not in any permit policy (default-deny)', async () => {
41
- const model = new MockMessageModel()
42
- .addTurn({ type: 'toolUseBlock', name: 'delete_record', toolUseId: 'tool-1', input: { id: '1' } })
43
- .addTurn({ type: 'textBlock', text: 'Ok' });
44
- let toolExecuted = false;
45
- const tool = createMockTool('delete_record', () => {
46
- toolExecuted = true;
47
- return 'deleted';
48
- });
49
- const cedar = new CedarAuthorization({
50
- policies: `${FIXTURES}/test.cedar`,
51
- entities,
52
- principalResolver: () => ({ type: 'User', id: 'alice' }),
53
- });
54
- const agent = new Agent({ model, tools: [tool], interventions: [cedar], printer: false });
55
- await agent.invoke('Delete it', { invocationState: {} });
56
- expect(toolExecuted).toBe(false);
57
- });
58
- it('enforces role-based access (admin can delete, analyst cannot)', async () => {
59
- const model = new MockMessageModel()
60
- .addTurn({ type: 'toolUseBlock', name: 'delete_record', toolUseId: 'tool-1', input: {} })
61
- .addTurn({ type: 'textBlock', text: 'Done' });
62
- let toolExecuted = false;
63
- const tool = createMockTool('delete_record', () => {
64
- toolExecuted = true;
65
- return 'deleted';
66
- });
67
- // Admin can delete
68
- const cedarAdmin = new CedarAuthorization({
69
- policies: `${FIXTURES}/role-based.cedar`,
70
- entities,
71
- principalResolver: () => ({ type: 'User', id: 'alice' }),
72
- });
73
- const agentAdmin = new Agent({ model, tools: [tool], interventions: [cedarAdmin], printer: false });
74
- await agentAdmin.invoke('Delete', { invocationState: {} });
75
- expect(toolExecuted).toBe(true);
76
- // Analyst cannot delete
77
- toolExecuted = false;
78
- const model2 = new MockMessageModel()
79
- .addTurn({ type: 'toolUseBlock', name: 'delete_record', toolUseId: 'tool-2', input: {} })
80
- .addTurn({ type: 'textBlock', text: 'Denied' });
81
- const cedarAnalyst = new CedarAuthorization({
82
- policies: `${FIXTURES}/role-based.cedar`,
83
- entities,
84
- principalResolver: () => ({ type: 'User', id: 'bob' }),
85
- });
86
- const agentAnalyst = new Agent({ model: model2, tools: [tool], interventions: [cedarAnalyst], printer: false });
87
- await agentAnalyst.invoke('Delete', { invocationState: {} });
88
- expect(toolExecuted).toBe(false);
89
- });
90
- it('enforces role-based access (analyst can search, viewer cannot)', async () => {
91
- const model = new MockMessageModel()
92
- .addTurn({ type: 'toolUseBlock', name: 'search', toolUseId: 'tool-1', input: {} })
93
- .addTurn({ type: 'textBlock', text: 'Done' });
94
- let toolExecuted = false;
95
- const tool = createMockTool('search', () => {
96
- toolExecuted = true;
97
- return 'found';
98
- });
99
- // Analyst can search
100
- const cedarAnalyst = new CedarAuthorization({
101
- policies: `${FIXTURES}/role-based.cedar`,
102
- entities,
103
- principalResolver: () => ({ type: 'User', id: 'bob' }),
104
- });
105
- const agent1 = new Agent({ model, tools: [tool], interventions: [cedarAnalyst], printer: false });
106
- await agent1.invoke('Search', { invocationState: {} });
107
- expect(toolExecuted).toBe(true);
108
- // Viewer cannot search
109
- toolExecuted = false;
110
- const model2 = new MockMessageModel()
111
- .addTurn({ type: 'toolUseBlock', name: 'search', toolUseId: 'tool-2', input: {} })
112
- .addTurn({ type: 'textBlock', text: 'Denied' });
113
- const cedarViewer = new CedarAuthorization({
114
- policies: `${FIXTURES}/role-based.cedar`,
115
- entities,
116
- principalResolver: () => ({ type: 'User', id: 'eve' }),
117
- });
118
- const agent2 = new Agent({ model: model2, tools: [tool], interventions: [cedarViewer], printer: false });
119
- await agent2.invoke('Search', { invocationState: {} });
120
- expect(toolExecuted).toBe(false);
121
- });
122
- it('enforces rate limits via call_count in session context', async () => {
123
- const model = new MockMessageModel()
124
- .addTurn({ type: 'toolUseBlock', name: 'send_email', toolUseId: 'tool-1', input: {} })
125
- .addTurn({ type: 'toolUseBlock', name: 'send_email', toolUseId: 'tool-2', input: {} })
126
- .addTurn({ type: 'toolUseBlock', name: 'send_email', toolUseId: 'tool-3', input: {} })
127
- .addTurn({ type: 'toolUseBlock', name: 'send_email', toolUseId: 'tool-4', input: {} })
128
- .addTurn({ type: 'textBlock', text: 'Done' });
129
- let callCount = 0;
130
- const tool = createMockTool('send_email', () => {
131
- callCount++;
132
- return 'sent';
133
- });
134
- const cedar = new CedarAuthorization({
135
- policies: `${FIXTURES}/rate-limited.cedar`,
136
- entities,
137
- principalResolver: () => ({ type: 'User', id: 'alice' }),
138
- });
139
- const agent = new Agent({ model, tools: [tool], interventions: [cedar], printer: false });
140
- await agent.invoke('Send 4 emails', { invocationState: {} });
141
- // Policy allows call_count < 3, so calls 1 and 2 succeed, 3+ denied
142
- expect(callCount).toBe(2);
143
- });
144
- it('enforces environment restrictions via contextEnricher', async () => {
145
- const model = new MockMessageModel()
146
- .addTurn({ type: 'toolUseBlock', name: 'search', toolUseId: 'tool-1', input: {} })
147
- .addTurn({ type: 'textBlock', text: 'Done' });
148
- let toolExecuted = false;
149
- const tool = createMockTool('search', () => {
150
- toolExecuted = true;
151
- return 'results';
152
- });
153
- // Non-production: allowed
154
- const cedar = new CedarAuthorization({
155
- policies: `${FIXTURES}/env-restricted.cedar`,
156
- entities,
157
- principalResolver: () => ({ type: 'User', id: 'alice' }),
158
- contextEnricher: ({ invocationState }) => ({
159
- environment: invocationState.environment ?? 'unknown',
160
- }),
161
- });
162
- const agent = new Agent({ model, tools: [tool], interventions: [cedar], printer: false });
163
- await agent.invoke('Search', { invocationState: { environment: 'development' } });
164
- expect(toolExecuted).toBe(true);
165
- // Production: denied
166
- toolExecuted = false;
167
- const model2 = new MockMessageModel()
168
- .addTurn({ type: 'toolUseBlock', name: 'search', toolUseId: 'tool-2', input: {} })
169
- .addTurn({ type: 'textBlock', text: 'Denied' });
170
- const agent2 = new Agent({ model: model2, tools: [tool], interventions: [cedar], printer: false });
171
- await agent2.invoke('Search', { invocationState: { environment: 'production' } });
172
- expect(toolExecuted).toBe(false);
173
- });
174
- it('denies when principal is missing (fail-closed)', async () => {
175
- const model = new MockMessageModel()
176
- .addTurn({ type: 'toolUseBlock', name: 'search', toolUseId: 'tool-1', input: {} })
177
- .addTurn({ type: 'textBlock', text: 'Ok' });
178
- let toolExecuted = false;
179
- const tool = createMockTool('search', () => {
180
- toolExecuted = true;
181
- return 'results';
182
- });
183
- const cedar = new CedarAuthorization({
184
- policies: `${FIXTURES}/test.cedar`,
185
- entities,
186
- principalResolver: (state) => {
187
- if (!state.user_id)
188
- return undefined;
189
- return { type: 'User', id: String(state.user_id) };
190
- },
191
- });
192
- const agent = new Agent({ model, tools: [tool], interventions: [cedar], printer: false });
193
- await agent.invoke('Search', { invocationState: {} });
194
- expect(toolExecuted).toBe(false);
195
- });
196
- it('throws on malformed policy at construction time', () => {
197
- expect(() => new CedarAuthorization({
198
- policies: 'this is not valid cedar syntax at all!!!',
199
- entities,
200
- principalResolver: () => ({ type: 'User', id: 'alice' }),
201
- })).toThrow('Invalid Cedar policy');
202
- });
203
- });
204
- describe('principal config', () => {
205
- it('supports static principal (no invocationState needed)', async () => {
206
- const model = new MockMessageModel()
207
- .addTurn({ type: 'toolUseBlock', name: 'search', toolUseId: 'tool-1', input: {} })
208
- .addTurn({ type: 'textBlock', text: 'Done' });
209
- let toolExecuted = false;
210
- const tool = createMockTool('search', () => {
211
- toolExecuted = true;
212
- return 'ok';
213
- });
214
- const cedar = new CedarAuthorization({
215
- policies: `${FIXTURES}/test.cedar`,
216
- entities: [{ uid: { type: 'Resource', id: 'agent' }, attrs: {}, parents: [] }],
217
- principal: { type: 'User', id: 'alice' },
218
- });
219
- const agent = new Agent({ model, tools: [tool], interventions: [cedar], printer: false });
220
- await agent.invoke('Search', { invocationState: {} });
221
- expect(toolExecuted).toBe(true);
222
- });
223
- it('throws when both principal and principalResolver are provided', () => {
224
- expect(() => new CedarAuthorization({
225
- policies: `${FIXTURES}/test.cedar`,
226
- principal: { type: 'User', id: 'alice' },
227
- principalResolver: () => ({ type: 'User', id: 'alice' }),
228
- })).toThrow('Provide either `principal` or `principalResolver`, not both');
229
- });
230
- it('defaults to User::"anonymous" when neither principal nor principalResolver is provided', async () => {
231
- const model = new MockMessageModel()
232
- .addTurn({ type: 'toolUseBlock', name: 'search', toolUseId: 'tool-1', input: {} })
233
- .addTurn({ type: 'textBlock', text: 'Done' });
234
- let toolExecuted = false;
235
- const tool = createMockTool('search', () => {
236
- toolExecuted = true;
237
- return 'ok';
238
- });
239
- // Policy permits any principal to search
240
- const cedar = new CedarAuthorization({
241
- policies: 'permit(principal, action == Action::"search", resource);',
242
- entities: [{ uid: { type: 'Resource', id: 'agent' }, attrs: {}, parents: [] }],
243
- });
244
- const agent = new Agent({ model, tools: [tool], interventions: [cedar], printer: false });
245
- await agent.invoke('Search', { invocationState: {} });
246
- expect(toolExecuted).toBe(true);
247
- });
248
- });
249
- describe('resource handling', () => {
250
- it('uses unconstrained resource by default', async () => {
251
- const model = new MockMessageModel()
252
- .addTurn({ type: 'toolUseBlock', name: 'search', toolUseId: 'tool-1', input: {} })
253
- .addTurn({ type: 'textBlock', text: 'Done' });
254
- let toolExecuted = false;
255
- const tool = createMockTool('search', () => {
256
- toolExecuted = true;
257
- return 'ok';
258
- });
259
- const cedar = new CedarAuthorization({
260
- policies: 'permit(principal, action == Action::"search", resource);',
261
- principalResolver: () => ({ type: 'User', id: 'alice' }),
262
- });
263
- const agent = new Agent({ model, tools: [tool], interventions: [cedar], printer: false });
264
- await agent.invoke('Go', { invocationState: {} });
265
- expect(toolExecuted).toBe(true);
266
- });
267
- it('constrains on tool arguments via context.input', async () => {
268
- const model = new MockMessageModel()
269
- .addTurn({ type: 'toolUseBlock', name: 'delete', toolUseId: 'tool-1', input: { record_id: '99' } })
270
- .addTurn({ type: 'textBlock', text: 'Denied' });
271
- let toolExecuted = false;
272
- const tool = createMockTool('delete', () => {
273
- toolExecuted = true;
274
- return 'deleted';
275
- });
276
- // Only allow deleting record 42 via context.input check
277
- const cedar = new CedarAuthorization({
278
- policies: 'permit(principal, action == Action::"delete", resource) when { context.input.record_id == "42" };',
279
- principalResolver: () => ({ type: 'User', id: 'alice' }),
280
- });
281
- const agent = new Agent({ model, tools: [tool], interventions: [cedar], printer: false });
282
- await agent.invoke('Delete 99', { invocationState: {} });
283
- expect(toolExecuted).toBe(false);
284
- });
285
- });
286
- describe('context enricher', () => {
287
- it('adds custom fields usable in policies', async () => {
288
- const model = new MockMessageModel()
289
- .addTurn({ type: 'toolUseBlock', name: 'search', toolUseId: 'tool-1', input: {} })
290
- .addTurn({ type: 'textBlock', text: 'Done' });
291
- let toolExecuted = false;
292
- const tool = createMockTool('search', () => {
293
- toolExecuted = true;
294
- return 'ok';
295
- });
296
- // Policy checks custom context field
297
- const cedar = new CedarAuthorization({
298
- policies: 'permit(principal, action, resource) when { context.session.department == "engineering" };',
299
- entities: [{ uid: { type: 'Resource', id: 'agent' }, attrs: {}, parents: [] }],
300
- principalResolver: () => ({ type: 'User', id: 'alice' }),
301
- contextEnricher: () => ({ department: 'engineering' }),
302
- });
303
- const agent = new Agent({ model, tools: [tool], interventions: [cedar], printer: false });
304
- await agent.invoke('Go', { invocationState: {} });
305
- expect(toolExecuted).toBe(true);
306
- });
307
- it('denies when enricher value does not match policy', async () => {
308
- const model = new MockMessageModel()
309
- .addTurn({ type: 'toolUseBlock', name: 'search', toolUseId: 'tool-1', input: {} })
310
- .addTurn({ type: 'textBlock', text: 'Denied' });
311
- let toolExecuted = false;
312
- const tool = createMockTool('search', () => {
313
- toolExecuted = true;
314
- return 'ok';
315
- });
316
- const cedar = new CedarAuthorization({
317
- policies: 'permit(principal, action, resource) when { context.session.department == "engineering" };',
318
- entities: [{ uid: { type: 'Resource', id: 'agent' }, attrs: {}, parents: [] }],
319
- principalResolver: () => ({ type: 'User', id: 'alice' }),
320
- contextEnricher: () => ({ department: 'marketing' }),
321
- });
322
- const agent = new Agent({ model, tools: [tool], interventions: [cedar], printer: false });
323
- await agent.invoke('Go', { invocationState: {} });
324
- expect(toolExecuted).toBe(false);
325
- });
326
- });
327
- describe('onError behavior', () => {
328
- it('throws by default when handler errors', async () => {
329
- const model = new MockMessageModel()
330
- .addTurn({ type: 'toolUseBlock', name: 'tool', toolUseId: 'tool-1', input: {} })
331
- .addTurn({ type: 'textBlock', text: 'Done' });
332
- const tool = createMockTool('tool', () => 'ok');
333
- // principalResolver throws
334
- const cedar = new CedarAuthorization({
335
- policies: 'permit(principal, action, resource);',
336
- principalResolver: () => {
337
- throw new Error('resolver crash');
338
- },
339
- onError: 'throw',
340
- });
341
- const agent = new Agent({ model, tools: [tool], interventions: [cedar], printer: false });
342
- await expect(agent.invoke('Go', { invocationState: {} })).rejects.toThrow('resolver crash');
343
- });
344
- it('denies when onError is "deny" and handler throws', async () => {
345
- const model = new MockMessageModel()
346
- .addTurn({ type: 'toolUseBlock', name: 'tool', toolUseId: 'tool-1', input: {} })
347
- .addTurn({ type: 'textBlock', text: 'Done' });
348
- let toolExecuted = false;
349
- const tool = createMockTool('tool', () => {
350
- toolExecuted = true;
351
- return 'ok';
352
- });
353
- const cedar = new CedarAuthorization({
354
- policies: 'permit(principal, action, resource);',
355
- principalResolver: () => {
356
- throw new Error('resolver crash');
357
- },
358
- onError: 'deny',
359
- });
360
- const agent = new Agent({ model, tools: [tool], interventions: [cedar], printer: false });
361
- const result = await agent.invoke('Go', { invocationState: {} });
362
- expect(result.stopReason).toBe('endTurn');
363
- expect(toolExecuted).toBe(false);
364
- });
365
- it('proceeds when onError is "proceed" and handler throws', async () => {
366
- const model = new MockMessageModel()
367
- .addTurn({ type: 'toolUseBlock', name: 'tool', toolUseId: 'tool-1', input: {} })
368
- .addTurn({ type: 'textBlock', text: 'Done' });
369
- let toolExecuted = false;
370
- const tool = createMockTool('tool', () => {
371
- toolExecuted = true;
372
- return 'ok';
373
- });
374
- const cedar = new CedarAuthorization({
375
- policies: 'permit(principal, action, resource);',
376
- principalResolver: () => {
377
- throw new Error('resolver crash');
378
- },
379
- onError: 'proceed',
380
- });
381
- const agent = new Agent({ model, tools: [tool], interventions: [cedar], printer: false });
382
- const result = await agent.invoke('Go', { invocationState: {} });
383
- expect(result.stopReason).toBe('endTurn');
384
- expect(toolExecuted).toBe(true);
385
- });
386
- });
387
- describe('file-based config', () => {
388
- it('reads .cedar file from disk', async () => {
389
- const fixturesDir = FIXTURES;
390
- const model = new MockMessageModel()
391
- .addTurn({ type: 'toolUseBlock', name: 'search', toolUseId: 'tool-1', input: {} })
392
- .addTurn({ type: 'textBlock', text: 'Done' });
393
- let toolExecuted = false;
394
- const tool = createMockTool('search', () => {
395
- toolExecuted = true;
396
- return 'ok';
397
- });
398
- const cedar = new CedarAuthorization({
399
- policies: `${fixturesDir}/test.cedar`,
400
- entities: [
401
- { uid: { type: 'Resource', id: 'agent' }, attrs: {}, parents: [] },
402
- { uid: { type: 'User', id: 'alice' }, attrs: { role: 'analyst' }, parents: [] },
403
- ],
404
- principalResolver: () => ({ type: 'User', id: 'alice' }),
405
- });
406
- const agent = new Agent({ model, tools: [tool], interventions: [cedar], printer: false });
407
- await agent.invoke('Search', { invocationState: {} });
408
- expect(toolExecuted).toBe(true);
409
- });
410
- it('reads .json entity file from disk', async () => {
411
- const fixturesDir = FIXTURES;
412
- const model = new MockMessageModel()
413
- .addTurn({ type: 'toolUseBlock', name: 'search', toolUseId: 'tool-1', input: {} })
414
- .addTurn({ type: 'textBlock', text: 'Done' });
415
- let toolExecuted = false;
416
- const tool = createMockTool('search', () => {
417
- toolExecuted = true;
418
- return 'ok';
419
- });
420
- const cedar = new CedarAuthorization({
421
- policies: 'permit(principal, action == Action::"search", resource);',
422
- entities: `${fixturesDir}/entities.json`,
423
- principalResolver: () => ({ type: 'User', id: 'alice' }),
424
- });
425
- const agent = new Agent({ model, tools: [tool], interventions: [cedar], printer: false });
426
- await agent.invoke('Search', { invocationState: {} });
427
- expect(toolExecuted).toBe(true);
428
- });
429
- it('throws when .cedar file does not exist', () => {
430
- expect(() => new CedarAuthorization({
431
- policies: '/nonexistent/path.cedar',
432
- principalResolver: () => ({ type: 'User', id: 'alice' }),
433
- })).toThrow('Cedar policy file not found: /nonexistent/path.cedar');
434
- });
435
- });
436
- describe('session management', () => {
437
- it('resetCallCounts clears counts and re-enables rate-limited tools', async () => {
438
- let callCount = 0;
439
- // Rate limit: < 2 calls allowed
440
- const cedar = new CedarAuthorization({
441
- policies: 'permit(principal, action, resource) when { context.session.call_count < 2 };',
442
- principalResolver: () => ({ type: 'User', id: 'alice' }),
443
- });
444
- // First call succeeds (count = 1)
445
- const model1 = new MockMessageModel()
446
- .addTurn({ type: 'toolUseBlock', name: 'send_email', toolUseId: 'tool-1', input: {} })
447
- .addTurn({ type: 'textBlock', text: 'Done' });
448
- const tool1 = createMockTool('send_email', () => {
449
- callCount++;
450
- return 'sent';
451
- });
452
- const agent1 = new Agent({ model: model1, tools: [tool1], interventions: [cedar], printer: false });
453
- await agent1.invoke('Send', { invocationState: {} });
454
- expect(callCount).toBe(1);
455
- // Second call succeeds (count = 2, but < 2 check passes for count at time of eval which is 2... denied)
456
- const model2 = new MockMessageModel()
457
- .addTurn({ type: 'toolUseBlock', name: 'send_email', toolUseId: 'tool-2', input: {} })
458
- .addTurn({ type: 'textBlock', text: 'Denied' });
459
- const tool2 = createMockTool('send_email', () => {
460
- callCount++;
461
- return 'sent';
462
- });
463
- const agent2 = new Agent({ model: model2, tools: [tool2], interventions: [cedar], printer: false });
464
- await agent2.invoke('Send', { invocationState: {} });
465
- expect(callCount).toBe(1); // still 1 — second was denied
466
- // Reset and try again — should succeed
467
- cedar.resetCallCounts(agent2);
468
- const model3 = new MockMessageModel()
469
- .addTurn({ type: 'toolUseBlock', name: 'send_email', toolUseId: 'tool-3', input: {} })
470
- .addTurn({ type: 'textBlock', text: 'Done' });
471
- const tool3 = createMockTool('send_email', () => {
472
- callCount++;
473
- return 'sent';
474
- });
475
- const agent3 = new Agent({ model: model3, tools: [tool3], interventions: [cedar], printer: false });
476
- await agent3.invoke('Send again', { invocationState: {} });
477
- expect(callCount).toBe(2); // succeeded after reset
478
- });
479
- });
480
- describe('reload', () => {
481
- it('reloads policies from file', () => {
482
- const cedar = new CedarAuthorization({
483
- policies: `${FIXTURES}/test.cedar`,
484
- principalResolver: () => ({ type: 'User', id: 'alice' }),
485
- });
486
- // reload() should not throw — file still exists and is valid
487
- expect(() => cedar.reload()).not.toThrow();
488
- });
489
- it('throws on reload if policy file was deleted', () => {
490
- const tmpFile = `${FIXTURES}/_tmp_reload_test.cedar`;
491
- writeFileSync(tmpFile, 'permit(principal, action, resource);');
492
- try {
493
- const cedar = new CedarAuthorization({
494
- policies: tmpFile,
495
- principalResolver: () => ({ type: 'User', id: 'alice' }),
496
- });
497
- unlinkSync(tmpFile);
498
- expect(() => cedar.reload()).toThrow('Cedar policy file not found');
499
- }
500
- finally {
501
- if (existsSync(tmpFile))
502
- unlinkSync(tmpFile);
503
- }
504
- });
505
- it('validates policies on reload', () => {
506
- const tmpFile = `${FIXTURES}/_tmp_reload_invalid.cedar`;
507
- writeFileSync(tmpFile, 'permit(principal, action, resource);');
508
- try {
509
- const cedar = new CedarAuthorization({
510
- policies: tmpFile,
511
- principalResolver: () => ({ type: 'User', id: 'alice' }),
512
- });
513
- writeFileSync(tmpFile, 'this is broken!!!');
514
- expect(() => cedar.reload()).toThrow('Invalid Cedar policy');
515
- }
516
- finally {
517
- if (existsSync(tmpFile))
518
- unlinkSync(tmpFile);
519
- }
520
- });
521
- });
522
- describe('schema validation', () => {
523
- it('passes validation when policies match schema', () => {
524
- expect(() => new CedarAuthorization({
525
- policies: 'permit(principal is User, action == Action::"search", resource is Resource);',
526
- schema: `${FIXTURES}/test.cedarschema`,
527
- principalResolver: () => ({ type: 'User', id: 'alice' }),
528
- })).not.toThrow();
529
- });
530
- it('throws when policy references unknown action', () => {
531
- expect(() => new CedarAuthorization({
532
- policies: 'permit(principal, action == Action::"nonexistent_tool", resource);',
533
- schema: `${FIXTURES}/test.cedarschema`,
534
- principalResolver: () => ({ type: 'User', id: 'alice' }),
535
- })).toThrow('Cedar policy validation failed');
536
- });
537
- it('throws when policy references unknown attribute', () => {
538
- expect(() => new CedarAuthorization({
539
- policies: 'permit(principal, action == Action::"search", resource) when { principal.nonexistent == "x" };',
540
- schema: `${FIXTURES}/test.cedarschema`,
541
- principalResolver: () => ({ type: 'User', id: 'alice' }),
542
- })).toThrow('Cedar policy validation failed');
543
- });
544
- it('accepts inline schema string', () => {
545
- const schema = `
546
- entity User = { role: String };
547
- entity Resource;
548
- action "search" appliesTo { principal: [User], resource: [Resource] };
549
- `;
550
- expect(() => new CedarAuthorization({
551
- policies: 'permit(principal is User, action == Action::"search", resource is Resource);',
552
- schema,
553
- principalResolver: () => ({ type: 'User', id: 'alice' }),
554
- })).not.toThrow();
555
- });
556
- it('skips schema validation when schema is not provided', () => {
557
- // This policy references an unknown entity type — without schema, it passes parse check
558
- expect(() => new CedarAuthorization({
559
- policies: 'permit(principal, action == Action::"anything", resource);',
560
- principalResolver: () => ({ type: 'User', id: 'alice' }),
561
- })).not.toThrow();
562
- });
563
- });
564
- describe('tools config (schema generator integration)', () => {
565
- const tools = [
566
- {
567
- name: 'search',
568
- inputSchema: { type: 'object', properties: { query: { type: 'string' } }, required: ['query'] },
569
- },
570
- { name: 'delete', inputSchema: { type: 'object', properties: { id: { type: 'string' } }, required: ['id'] } },
571
- ];
572
- it('auto-generates schema and validates policies when tools are provided', () => {
573
- const cedar = new CedarAuthorization({
574
- policies: 'permit(principal, action == Action::"search", resource);',
575
- tools,
576
- });
577
- expect(cedar.name).toBe('cedar-authorization');
578
- });
579
- it('catches unknown action names via auto-generated schema', () => {
580
- expect(() => new CedarAuthorization({
581
- policies: 'permit(principal, action == Action::"nonexistent", resource);',
582
- tools,
583
- })).toThrow('Cedar policy validation failed');
584
- });
585
- it('allows policies referencing context.session (handler-injected, not in schema)', () => {
586
- const cedar = new CedarAuthorization({
587
- policies: 'permit(principal, action == Action::"search", resource) when { context.session.role == "admin" };',
588
- tools,
589
- });
590
- expect(cedar.name).toBe('cedar-authorization');
591
- });
592
- it('allows tool calls when tools config is provided', async () => {
593
- const model = new MockMessageModel()
594
- .addTurn({ type: 'toolUseBlock', name: 'search', toolUseId: 'tool-1', input: { query: 'test' } })
595
- .addTurn({ type: 'textBlock', text: 'Done' });
596
- let toolExecuted = false;
597
- const tool = createMockTool('search', () => {
598
- toolExecuted = true;
599
- return 'results';
600
- });
601
- const cedar = new CedarAuthorization({
602
- policies: 'permit(principal, action == Action::"search", resource);',
603
- tools,
604
- principal: { type: 'User', id: 'alice' },
605
- });
606
- const agent = new Agent({ model, tools: [tool], interventions: [cedar], printer: false });
607
- await agent.invoke('Search', { invocationState: {} });
608
- expect(toolExecuted).toBe(true);
609
- });
610
- it('validates nested tool input schemas without breaking', async () => {
611
- const nestedTools = [
612
- ...tools,
613
- {
614
- name: 'create_user',
615
- inputSchema: {
616
- type: 'object',
617
- properties: {
618
- name: { type: 'string' },
619
- address: { type: 'object', properties: { street: { type: 'string' }, city: { type: 'string' } } },
620
- },
621
- },
622
- },
623
- ];
624
- const cedar = new CedarAuthorization({
625
- policies: 'permit(principal, action == Action::"create_user", resource);',
626
- tools: nestedTools,
627
- principal: { type: 'User', id: 'alice' },
628
- });
629
- const model = new MockMessageModel()
630
- .addTurn({
631
- type: 'toolUseBlock',
632
- name: 'create_user',
633
- toolUseId: 'tool-1',
634
- input: { name: 'Bob', address: { street: '123', city: 'NYC' } },
635
- })
636
- .addTurn({ type: 'textBlock', text: 'Done' });
637
- let toolExecuted = false;
638
- const tool = createMockTool('create_user', () => {
639
- toolExecuted = true;
640
- return 'created';
641
- });
642
- const agent = new Agent({ model, tools: [tool], interventions: [cedar], printer: false });
643
- await agent.invoke('Create user', { invocationState: {} });
644
- expect(toolExecuted).toBe(true);
645
- });
646
- it('surfaces schema generator errors for naming collisions in nested inputs', async () => {
647
- const collidingTools = [
648
- {
649
- name: 'create_user',
650
- inputSchema: {
651
- type: 'object',
652
- properties: {
653
- address: {
654
- type: 'object',
655
- properties: {
656
- street: { type: 'string' },
657
- geo: { type: 'object', properties: { lat: { type: 'number' }, lng: { type: 'number' } } },
658
- },
659
- },
660
- address_geo: {
661
- type: 'object',
662
- properties: { lat: { type: 'string' }, lng: { type: 'string' } },
663
- },
664
- },
665
- },
666
- },
667
- ];
668
- expect(() => new CedarAuthorization({
669
- policies: 'permit(principal, action, resource);',
670
- tools: collidingTools,
671
- })).toThrow('Schema generation failed');
672
- });
673
- });
674
- describe('namespace option', () => {
675
- it('uses namespaced action and resource types when namespace is set', async () => {
676
- const model = new MockMessageModel()
677
- .addTurn({ type: 'toolUseBlock', name: 'search', toolUseId: 'tool-1', input: { query: 'test' } })
678
- .addTurn({ type: 'textBlock', text: 'Done' });
679
- let toolExecuted = false;
680
- const tool = createMockTool('search', () => {
681
- toolExecuted = true;
682
- return 'results';
683
- });
684
- const cedar = new CedarAuthorization({
685
- namespace: 'Agent',
686
- policies: 'permit(principal in Agent::Role::"admin", action == Agent::Action::"search", resource);',
687
- entities: [
688
- { uid: { type: 'Agent::Role', id: 'admin' }, attrs: {}, parents: [] },
689
- { uid: { type: 'Agent::User', id: 'alice' }, attrs: {}, parents: [{ type: 'Agent::Role', id: 'admin' }] },
690
- { uid: { type: 'Agent::Resource', id: 'default' }, attrs: {}, parents: [] },
691
- ],
692
- principalResolver: (state) => {
693
- if (!state.user_id)
694
- return undefined;
695
- return { type: 'Agent::User', id: String(state.user_id) };
696
- },
697
- });
698
- const agent = new Agent({ model, tools: [tool], interventions: [cedar], printer: false });
699
- await agent.invoke('Search', { invocationState: { user_id: 'alice' } });
700
- expect(toolExecuted).toBe(true);
701
- });
702
- it('denies when principal is not in the role (namespaced)', async () => {
703
- const model = new MockMessageModel()
704
- .addTurn({ type: 'toolUseBlock', name: 'search', toolUseId: 'tool-1', input: { query: 'test' } })
705
- .addTurn({ type: 'textBlock', text: 'Done' });
706
- let toolExecuted = false;
707
- const tool = createMockTool('search', () => {
708
- toolExecuted = true;
709
- return 'results';
710
- });
711
- const cedar = new CedarAuthorization({
712
- namespace: 'Agent',
713
- policies: 'permit(principal in Agent::Role::"admin", action == Agent::Action::"search", resource);',
714
- entities: [
715
- { uid: { type: 'Agent::Role', id: 'admin' }, attrs: {}, parents: [] },
716
- { uid: { type: 'Agent::User', id: 'bob' }, attrs: {}, parents: [] },
717
- { uid: { type: 'Agent::Resource', id: 'default' }, attrs: {}, parents: [] },
718
- ],
719
- principalResolver: (state) => {
720
- if (!state.user_id)
721
- return undefined;
722
- return { type: 'Agent::User', id: String(state.user_id) };
723
- },
724
- });
725
- const agent = new Agent({ model, tools: [tool], interventions: [cedar], printer: false });
726
- await agent.invoke('Search', { invocationState: { user_id: 'bob' } });
727
- expect(toolExecuted).toBe(false);
728
- });
729
- it('works with namespace and tools (schema generation path)', async () => {
730
- const model = new MockMessageModel()
731
- .addTurn({ type: 'toolUseBlock', name: 'search', toolUseId: 'tool-1', input: { query: 'test' } })
732
- .addTurn({ type: 'textBlock', text: 'Done' });
733
- let toolExecuted = false;
734
- const tool = createMockTool('search', () => {
735
- toolExecuted = true;
736
- return 'results';
737
- });
738
- const tools = [
739
- {
740
- name: 'search',
741
- inputSchema: { type: 'object', properties: { query: { type: 'string' } }, required: ['query'] },
742
- },
743
- ];
744
- const cedar = new CedarAuthorization({
745
- namespace: 'MyApp',
746
- policies: 'permit(principal, action == MyApp::Action::"search", resource);',
747
- tools,
748
- entities: [{ uid: { type: 'MyApp::Resource', id: 'default' }, attrs: {}, parents: [] }],
749
- });
750
- const agent = new Agent({ model, tools: [tool], interventions: [cedar], printer: false });
751
- await agent.invoke('Search', { invocationState: {} });
752
- expect(toolExecuted).toBe(true);
753
- });
754
- });
755
- });
756
- //# sourceMappingURL=cedar.test.node.js.map