@anthropic-ai/sdk 0.119.0 → 0.121.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 (466) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/helpers/beta/environments.d.mts +5 -4
  3. package/helpers/beta/environments.d.mts.map +1 -1
  4. package/helpers/beta/environments.d.ts +5 -4
  5. package/helpers/beta/environments.d.ts.map +1 -1
  6. package/helpers/beta/environments.js +5 -4
  7. package/helpers/beta/environments.js.map +1 -1
  8. package/helpers/beta/environments.mjs +5 -4
  9. package/helpers/beta/environments.mjs.map +1 -1
  10. package/helpers/beta/standard-schema.d.mts +45 -0
  11. package/helpers/beta/standard-schema.d.mts.map +1 -0
  12. package/helpers/beta/standard-schema.d.ts +45 -0
  13. package/helpers/beta/standard-schema.d.ts.map +1 -0
  14. package/helpers/beta/standard-schema.js +58 -0
  15. package/helpers/beta/standard-schema.js.map +1 -0
  16. package/helpers/beta/standard-schema.mjs +54 -0
  17. package/helpers/beta/standard-schema.mjs.map +1 -0
  18. package/internal/detect-platform.js +1 -1
  19. package/internal/detect-platform.js.map +1 -1
  20. package/internal/detect-platform.mjs +1 -1
  21. package/internal/detect-platform.mjs.map +1 -1
  22. package/internal/file-store.d.mts +136 -0
  23. package/internal/file-store.d.mts.map +1 -0
  24. package/internal/file-store.d.ts +136 -0
  25. package/internal/file-store.d.ts.map +1 -0
  26. package/internal/file-store.js +531 -0
  27. package/internal/file-store.js.map +1 -0
  28. package/internal/file-store.mjs +523 -0
  29. package/internal/file-store.mjs.map +1 -0
  30. package/internal/utils/values.d.mts +6 -0
  31. package/internal/utils/values.d.mts.map +1 -1
  32. package/internal/utils/values.d.ts +6 -0
  33. package/internal/utils/values.d.ts.map +1 -1
  34. package/internal/utils/values.js +7 -0
  35. package/internal/utils/values.js.map +1 -1
  36. package/internal/utils/values.mjs +6 -0
  37. package/internal/utils/values.mjs.map +1 -1
  38. package/lib/BetaMessageStream.d.mts.map +1 -1
  39. package/lib/BetaMessageStream.d.ts.map +1 -1
  40. package/lib/BetaMessageStream.js +3 -4
  41. package/lib/BetaMessageStream.js.map +1 -1
  42. package/lib/BetaMessageStream.mjs +1 -2
  43. package/lib/BetaMessageStream.mjs.map +1 -1
  44. package/lib/MessageStream.d.mts.map +1 -1
  45. package/lib/MessageStream.d.ts.map +1 -1
  46. package/lib/MessageStream.js +3 -4
  47. package/lib/MessageStream.js.map +1 -1
  48. package/lib/MessageStream.mjs +1 -2
  49. package/lib/MessageStream.mjs.map +1 -1
  50. package/lib/environments/poller.d.mts +6 -0
  51. package/lib/environments/poller.d.mts.map +1 -1
  52. package/lib/environments/poller.d.ts +6 -0
  53. package/lib/environments/poller.d.ts.map +1 -1
  54. package/lib/environments/poller.js +46 -1
  55. package/lib/environments/poller.js.map +1 -1
  56. package/lib/environments/poller.mjs +46 -1
  57. package/lib/environments/poller.mjs.map +1 -1
  58. package/lib/environments/worker.d.mts +89 -12
  59. package/lib/environments/worker.d.mts.map +1 -1
  60. package/lib/environments/worker.d.ts +89 -12
  61. package/lib/environments/worker.d.ts.map +1 -1
  62. package/lib/environments/worker.js +336 -67
  63. package/lib/environments/worker.js.map +1 -1
  64. package/lib/environments/worker.mjs +336 -68
  65. package/lib/environments/worker.mjs.map +1 -1
  66. package/lib/sessions/accumulate.d.mts.map +1 -1
  67. package/lib/sessions/accumulate.d.ts.map +1 -1
  68. package/lib/sessions/accumulate.js +3 -4
  69. package/lib/sessions/accumulate.js.map +1 -1
  70. package/lib/sessions/accumulate.mjs +1 -2
  71. package/lib/sessions/accumulate.mjs.map +1 -1
  72. package/lib/standard-schema.d.mts +131 -0
  73. package/lib/standard-schema.d.mts.map +1 -0
  74. package/lib/standard-schema.d.ts +131 -0
  75. package/lib/standard-schema.d.ts.map +1 -0
  76. package/lib/standard-schema.js +45 -0
  77. package/lib/standard-schema.js.map +1 -0
  78. package/lib/standard-schema.mjs +41 -0
  79. package/lib/standard-schema.mjs.map +1 -0
  80. package/lib/tools/BetaToolRunner.d.mts.map +1 -1
  81. package/lib/tools/BetaToolRunner.d.ts.map +1 -1
  82. package/lib/tools/BetaToolRunner.js +35 -6
  83. package/lib/tools/BetaToolRunner.js.map +1 -1
  84. package/lib/tools/BetaToolRunner.mjs +35 -6
  85. package/lib/tools/BetaToolRunner.mjs.map +1 -1
  86. package/package.json +2 -11
  87. package/resources/beta/agents/agents.d.mts +322 -27
  88. package/resources/beta/agents/agents.d.mts.map +1 -1
  89. package/resources/beta/agents/agents.d.ts +322 -27
  90. package/resources/beta/agents/agents.d.ts.map +1 -1
  91. package/resources/beta/agents/agents.js.map +1 -1
  92. package/resources/beta/agents/agents.mjs.map +1 -1
  93. package/resources/beta/agents/index.d.mts +1 -1
  94. package/resources/beta/agents/index.d.mts.map +1 -1
  95. package/resources/beta/agents/index.d.ts +1 -1
  96. package/resources/beta/agents/index.d.ts.map +1 -1
  97. package/resources/beta/agents/index.js.map +1 -1
  98. package/resources/beta/agents/index.mjs.map +1 -1
  99. package/resources/beta/beta.d.mts +7 -3
  100. package/resources/beta/beta.d.mts.map +1 -1
  101. package/resources/beta/beta.d.ts +7 -3
  102. package/resources/beta/beta.d.ts.map +1 -1
  103. package/resources/beta/beta.js +4 -0
  104. package/resources/beta/beta.js.map +1 -1
  105. package/resources/beta/beta.mjs +4 -0
  106. package/resources/beta/beta.mjs.map +1 -1
  107. package/resources/beta/environments/environments.d.mts +8 -1
  108. package/resources/beta/environments/environments.d.mts.map +1 -1
  109. package/resources/beta/environments/environments.d.ts +8 -1
  110. package/resources/beta/environments/environments.d.ts.map +1 -1
  111. package/resources/beta/environments/environments.js.map +1 -1
  112. package/resources/beta/environments/environments.mjs.map +1 -1
  113. package/resources/beta/environments/work.d.mts +5 -1
  114. package/resources/beta/environments/work.d.mts.map +1 -1
  115. package/resources/beta/environments/work.d.ts +5 -1
  116. package/resources/beta/environments/work.d.ts.map +1 -1
  117. package/resources/beta/environments/work.js +0 -17
  118. package/resources/beta/environments/work.js.map +1 -1
  119. package/resources/beta/environments/work.mjs +0 -17
  120. package/resources/beta/environments/work.mjs.map +1 -1
  121. package/resources/beta/index.d.mts +2 -1
  122. package/resources/beta/index.d.mts.map +1 -1
  123. package/resources/beta/index.d.ts +2 -1
  124. package/resources/beta/index.d.ts.map +1 -1
  125. package/resources/beta/index.js +11 -9
  126. package/resources/beta/index.js.map +1 -1
  127. package/resources/beta/index.mjs +1 -0
  128. package/resources/beta/index.mjs.map +1 -1
  129. package/resources/beta/memory-stores/memories.d.mts +6 -5
  130. package/resources/beta/memory-stores/memories.d.mts.map +1 -1
  131. package/resources/beta/memory-stores/memories.d.ts +6 -5
  132. package/resources/beta/memory-stores/memories.d.ts.map +1 -1
  133. package/resources/beta/memory-stores/memory-versions.d.mts +8 -5
  134. package/resources/beta/memory-stores/memory-versions.d.mts.map +1 -1
  135. package/resources/beta/memory-stores/memory-versions.d.ts +8 -5
  136. package/resources/beta/memory-stores/memory-versions.d.ts.map +1 -1
  137. package/resources/beta/messages/messages.d.mts +51 -9
  138. package/resources/beta/messages/messages.d.mts.map +1 -1
  139. package/resources/beta/messages/messages.d.ts +51 -9
  140. package/resources/beta/messages/messages.d.ts.map +1 -1
  141. package/resources/beta/messages/messages.js.map +1 -1
  142. package/resources/beta/messages/messages.mjs.map +1 -1
  143. package/resources/beta/organization/api-keys.d.mts +177 -0
  144. package/resources/beta/organization/api-keys.d.mts.map +1 -0
  145. package/resources/beta/organization/api-keys.d.ts +177 -0
  146. package/resources/beta/organization/api-keys.d.ts.map +1 -0
  147. package/resources/beta/organization/api-keys.js +56 -0
  148. package/resources/beta/organization/api-keys.js.map +1 -0
  149. package/resources/beta/organization/api-keys.mjs +52 -0
  150. package/resources/beta/organization/api-keys.mjs.map +1 -0
  151. package/resources/beta/organization/external-keys.d.mts +269 -0
  152. package/resources/beta/organization/external-keys.d.mts.map +1 -0
  153. package/resources/beta/organization/external-keys.d.ts +269 -0
  154. package/resources/beta/organization/external-keys.d.ts.map +1 -0
  155. package/resources/beta/organization/external-keys.js +119 -0
  156. package/resources/beta/organization/external-keys.js.map +1 -0
  157. package/resources/beta/organization/external-keys.mjs +115 -0
  158. package/resources/beta/organization/external-keys.mjs.map +1 -0
  159. package/resources/beta/organization/federation/federation.d.mts +14 -0
  160. package/resources/beta/organization/federation/federation.d.mts.map +1 -0
  161. package/resources/beta/organization/federation/federation.d.ts +14 -0
  162. package/resources/beta/organization/federation/federation.d.ts.map +1 -0
  163. package/resources/beta/organization/federation/federation.js +21 -0
  164. package/resources/beta/organization/federation/federation.js.map +1 -0
  165. package/resources/beta/organization/federation/federation.mjs +16 -0
  166. package/resources/beta/organization/federation/federation.mjs.map +1 -0
  167. package/resources/beta/organization/federation/index.d.mts +4 -0
  168. package/resources/beta/organization/federation/index.d.mts.map +1 -0
  169. package/resources/beta/organization/federation/index.d.ts +4 -0
  170. package/resources/beta/organization/federation/index.d.ts.map +1 -0
  171. package/resources/beta/organization/federation/index.js +11 -0
  172. package/resources/beta/organization/federation/index.js.map +1 -0
  173. package/resources/beta/organization/federation/index.mjs +5 -0
  174. package/resources/beta/organization/federation/index.mjs.map +1 -0
  175. package/resources/beta/organization/federation/issuers.d.mts +353 -0
  176. package/resources/beta/organization/federation/issuers.d.mts.map +1 -0
  177. package/resources/beta/organization/federation/issuers.d.ts +353 -0
  178. package/resources/beta/organization/federation/issuers.d.ts.map +1 -0
  179. package/resources/beta/organization/federation/issuers.js +169 -0
  180. package/resources/beta/organization/federation/issuers.js.map +1 -0
  181. package/resources/beta/organization/federation/issuers.mjs +165 -0
  182. package/resources/beta/organization/federation/issuers.mjs.map +1 -0
  183. package/resources/beta/organization/federation/rules/index.d.mts +3 -0
  184. package/resources/beta/organization/federation/rules/index.d.mts.map +1 -0
  185. package/resources/beta/organization/federation/rules/index.d.ts +3 -0
  186. package/resources/beta/organization/federation/rules/index.d.ts.map +1 -0
  187. package/resources/beta/organization/federation/rules/index.js +9 -0
  188. package/resources/beta/organization/federation/rules/index.js.map +1 -0
  189. package/resources/beta/organization/federation/rules/index.mjs +4 -0
  190. package/resources/beta/organization/federation/rules/index.mjs.map +1 -0
  191. package/resources/beta/organization/federation/rules/rules.d.mts +468 -0
  192. package/resources/beta/organization/federation/rules/rules.d.mts.map +1 -0
  193. package/resources/beta/organization/federation/rules/rules.d.ts +468 -0
  194. package/resources/beta/organization/federation/rules/rules.d.ts.map +1 -0
  195. package/resources/beta/organization/federation/rules/rules.js +198 -0
  196. package/resources/beta/organization/federation/rules/rules.js.map +1 -0
  197. package/resources/beta/organization/federation/rules/rules.mjs +193 -0
  198. package/resources/beta/organization/federation/rules/rules.mjs.map +1 -0
  199. package/resources/beta/organization/federation/rules/workspaces.d.mts +124 -0
  200. package/resources/beta/organization/federation/rules/workspaces.d.mts.map +1 -0
  201. package/resources/beta/organization/federation/rules/workspaces.d.ts +124 -0
  202. package/resources/beta/organization/federation/rules/workspaces.d.ts.map +1 -0
  203. package/resources/beta/organization/federation/rules/workspaces.js +114 -0
  204. package/resources/beta/organization/federation/rules/workspaces.js.map +1 -0
  205. package/resources/beta/organization/federation/rules/workspaces.mjs +110 -0
  206. package/resources/beta/organization/federation/rules/workspaces.mjs.map +1 -0
  207. package/resources/beta/organization/federation/rules.d.mts +2 -0
  208. package/resources/beta/organization/federation/rules.d.mts.map +1 -0
  209. package/resources/beta/organization/federation/rules.d.ts +2 -0
  210. package/resources/beta/organization/federation/rules.d.ts.map +1 -0
  211. package/resources/beta/organization/federation/rules.js +6 -0
  212. package/resources/beta/organization/federation/rules.js.map +1 -0
  213. package/resources/beta/organization/federation/rules.mjs +3 -0
  214. package/resources/beta/organization/federation/rules.mjs.map +1 -0
  215. package/resources/beta/organization/federation.d.mts +2 -0
  216. package/resources/beta/organization/federation.d.mts.map +1 -0
  217. package/resources/beta/organization/federation.d.ts +2 -0
  218. package/resources/beta/organization/federation.d.ts.map +1 -0
  219. package/resources/beta/organization/federation.js +6 -0
  220. package/resources/beta/organization/federation.js.map +1 -0
  221. package/resources/beta/organization/federation.mjs +3 -0
  222. package/resources/beta/organization/federation.mjs.map +1 -0
  223. package/resources/beta/organization/index.d.mts +10 -0
  224. package/resources/beta/organization/index.d.mts.map +1 -0
  225. package/resources/beta/organization/index.d.ts +10 -0
  226. package/resources/beta/organization/index.d.ts.map +1 -0
  227. package/resources/beta/organization/index.js +23 -0
  228. package/resources/beta/organization/index.js.map +1 -0
  229. package/resources/beta/organization/index.mjs +11 -0
  230. package/resources/beta/organization/index.mjs.map +1 -0
  231. package/resources/beta/organization/invites.d.mts +162 -0
  232. package/resources/beta/organization/invites.d.mts.map +1 -0
  233. package/resources/beta/organization/invites.d.ts +162 -0
  234. package/resources/beta/organization/invites.d.ts.map +1 -0
  235. package/resources/beta/organization/invites.js +76 -0
  236. package/resources/beta/organization/invites.js.map +1 -0
  237. package/resources/beta/organization/invites.mjs +72 -0
  238. package/resources/beta/organization/invites.mjs.map +1 -0
  239. package/resources/beta/organization/organization.d.mts +69 -0
  240. package/resources/beta/organization/organization.d.mts.map +1 -0
  241. package/resources/beta/organization/organization.d.ts +69 -0
  242. package/resources/beta/organization/organization.d.ts.map +1 -0
  243. package/resources/beta/organization/organization.js +58 -0
  244. package/resources/beta/organization/organization.js.map +1 -0
  245. package/resources/beta/organization/organization.mjs +53 -0
  246. package/resources/beta/organization/organization.mjs.map +1 -0
  247. package/resources/beta/organization/rate-limits.d.mts +78 -0
  248. package/resources/beta/organization/rate-limits.d.mts.map +1 -0
  249. package/resources/beta/organization/rate-limits.d.ts +78 -0
  250. package/resources/beta/organization/rate-limits.d.ts.map +1 -0
  251. package/resources/beta/organization/rate-limits.js +32 -0
  252. package/resources/beta/organization/rate-limits.js.map +1 -0
  253. package/resources/beta/organization/rate-limits.mjs +28 -0
  254. package/resources/beta/organization/rate-limits.mjs.map +1 -0
  255. package/resources/beta/organization/service-accounts/index.d.mts +3 -0
  256. package/resources/beta/organization/service-accounts/index.d.mts.map +1 -0
  257. package/resources/beta/organization/service-accounts/index.d.ts +3 -0
  258. package/resources/beta/organization/service-accounts/index.d.ts.map +1 -0
  259. package/resources/beta/organization/service-accounts/index.js +9 -0
  260. package/resources/beta/organization/service-accounts/index.js.map +1 -0
  261. package/resources/beta/organization/service-accounts/index.mjs +4 -0
  262. package/resources/beta/organization/service-accounts/index.mjs.map +1 -0
  263. package/resources/beta/organization/service-accounts/service-accounts.d.mts +258 -0
  264. package/resources/beta/organization/service-accounts/service-accounts.d.mts.map +1 -0
  265. package/resources/beta/organization/service-accounts/service-accounts.d.ts +258 -0
  266. package/resources/beta/organization/service-accounts/service-accounts.d.ts.map +1 -0
  267. package/resources/beta/organization/service-accounts/service-accounts.js +174 -0
  268. package/resources/beta/organization/service-accounts/service-accounts.js.map +1 -0
  269. package/resources/beta/organization/service-accounts/service-accounts.mjs +169 -0
  270. package/resources/beta/organization/service-accounts/service-accounts.mjs.map +1 -0
  271. package/resources/beta/organization/service-accounts/workspaces.d.mts +141 -0
  272. package/resources/beta/organization/service-accounts/workspaces.d.mts.map +1 -0
  273. package/resources/beta/organization/service-accounts/workspaces.d.ts +141 -0
  274. package/resources/beta/organization/service-accounts/workspaces.d.ts.map +1 -0
  275. package/resources/beta/organization/service-accounts/workspaces.js +125 -0
  276. package/resources/beta/organization/service-accounts/workspaces.js.map +1 -0
  277. package/resources/beta/organization/service-accounts/workspaces.mjs +121 -0
  278. package/resources/beta/organization/service-accounts/workspaces.mjs.map +1 -0
  279. package/resources/beta/organization/service-accounts.d.mts +2 -0
  280. package/resources/beta/organization/service-accounts.d.mts.map +1 -0
  281. package/resources/beta/organization/service-accounts.d.ts +2 -0
  282. package/resources/beta/organization/service-accounts.d.ts.map +1 -0
  283. package/resources/beta/organization/service-accounts.js +6 -0
  284. package/resources/beta/organization/service-accounts.js.map +1 -0
  285. package/resources/beta/organization/service-accounts.mjs +3 -0
  286. package/resources/beta/organization/service-accounts.mjs.map +1 -0
  287. package/resources/beta/organization/users.d.mts +124 -0
  288. package/resources/beta/organization/users.d.mts.map +1 -0
  289. package/resources/beta/organization/users.d.ts +124 -0
  290. package/resources/beta/organization/users.d.ts.map +1 -0
  291. package/resources/beta/organization/users.js +67 -0
  292. package/resources/beta/organization/users.js.map +1 -0
  293. package/resources/beta/organization/users.mjs +63 -0
  294. package/resources/beta/organization/users.mjs.map +1 -0
  295. package/resources/beta/organization/workspaces/index.d.mts +5 -0
  296. package/resources/beta/organization/workspaces/index.d.mts.map +1 -0
  297. package/resources/beta/organization/workspaces/index.d.ts +5 -0
  298. package/resources/beta/organization/workspaces/index.d.ts.map +1 -0
  299. package/resources/beta/organization/workspaces/index.js +13 -0
  300. package/resources/beta/organization/workspaces/index.js.map +1 -0
  301. package/resources/beta/organization/workspaces/index.mjs +6 -0
  302. package/resources/beta/organization/workspaces/index.mjs.map +1 -0
  303. package/resources/beta/organization/workspaces/members.d.mts +135 -0
  304. package/resources/beta/organization/workspaces/members.d.mts.map +1 -0
  305. package/resources/beta/organization/workspaces/members.d.ts +135 -0
  306. package/resources/beta/organization/workspaces/members.d.ts.map +1 -0
  307. package/resources/beta/organization/workspaces/members.js +102 -0
  308. package/resources/beta/organization/workspaces/members.js.map +1 -0
  309. package/resources/beta/organization/workspaces/members.mjs +98 -0
  310. package/resources/beta/organization/workspaces/members.mjs.map +1 -0
  311. package/resources/beta/organization/workspaces/rate-limits.d.mts +84 -0
  312. package/resources/beta/organization/workspaces/rate-limits.d.mts.map +1 -0
  313. package/resources/beta/organization/workspaces/rate-limits.d.ts +84 -0
  314. package/resources/beta/organization/workspaces/rate-limits.d.ts.map +1 -0
  315. package/resources/beta/organization/workspaces/rate-limits.js +35 -0
  316. package/resources/beta/organization/workspaces/rate-limits.js.map +1 -0
  317. package/resources/beta/organization/workspaces/rate-limits.mjs +31 -0
  318. package/resources/beta/organization/workspaces/rate-limits.mjs.map +1 -0
  319. package/resources/beta/organization/workspaces/service-accounts.d.mts +210 -0
  320. package/resources/beta/organization/workspaces/service-accounts.d.mts.map +1 -0
  321. package/resources/beta/organization/workspaces/service-accounts.d.ts +210 -0
  322. package/resources/beta/organization/workspaces/service-accounts.d.ts.map +1 -0
  323. package/resources/beta/organization/workspaces/service-accounts.js +189 -0
  324. package/resources/beta/organization/workspaces/service-accounts.js.map +1 -0
  325. package/resources/beta/organization/workspaces/service-accounts.mjs +185 -0
  326. package/resources/beta/organization/workspaces/service-accounts.mjs.map +1 -0
  327. package/resources/beta/organization/workspaces/workspaces.d.mts +287 -0
  328. package/resources/beta/organization/workspaces/workspaces.d.mts.map +1 -0
  329. package/resources/beta/organization/workspaces/workspaces.d.ts +287 -0
  330. package/resources/beta/organization/workspaces/workspaces.d.ts.map +1 -0
  331. package/resources/beta/organization/workspaces/workspaces.js +112 -0
  332. package/resources/beta/organization/workspaces/workspaces.js.map +1 -0
  333. package/resources/beta/organization/workspaces/workspaces.mjs +107 -0
  334. package/resources/beta/organization/workspaces/workspaces.mjs.map +1 -0
  335. package/resources/beta/organization/workspaces.d.mts +2 -0
  336. package/resources/beta/organization/workspaces.d.mts.map +1 -0
  337. package/resources/beta/organization/workspaces.d.ts +2 -0
  338. package/resources/beta/organization/workspaces.d.ts.map +1 -0
  339. package/resources/beta/organization/workspaces.js +6 -0
  340. package/resources/beta/organization/workspaces.js.map +1 -0
  341. package/resources/beta/organization/workspaces.mjs +3 -0
  342. package/resources/beta/organization/workspaces.mjs.map +1 -0
  343. package/resources/beta/organization.d.mts +2 -0
  344. package/resources/beta/organization.d.mts.map +1 -0
  345. package/resources/beta/organization.d.ts +2 -0
  346. package/resources/beta/organization.d.ts.map +1 -0
  347. package/resources/beta/organization.js +6 -0
  348. package/resources/beta/organization.js.map +1 -0
  349. package/resources/beta/organization.mjs +3 -0
  350. package/resources/beta/organization.mjs.map +1 -0
  351. package/resources/beta/sessions/threads/threads.d.mts +2 -1
  352. package/resources/beta/sessions/threads/threads.d.mts.map +1 -1
  353. package/resources/beta/sessions/threads/threads.d.ts +2 -1
  354. package/resources/beta/sessions/threads/threads.d.ts.map +1 -1
  355. package/resources/beta/sessions/threads/threads.js.map +1 -1
  356. package/resources/beta/sessions/threads/threads.mjs.map +1 -1
  357. package/resources/messages/messages.d.mts +1 -1
  358. package/resources/messages/messages.d.ts +1 -1
  359. package/src/helpers/beta/environments.ts +5 -4
  360. package/src/helpers/beta/standard-schema.ts +99 -0
  361. package/src/internal/detect-platform.ts +1 -1
  362. package/src/internal/file-store.ts +550 -0
  363. package/src/internal/utils/values.ts +7 -0
  364. package/src/lib/BetaMessageStream.ts +1 -3
  365. package/src/lib/MessageStream.ts +1 -3
  366. package/src/lib/environments/poller.ts +47 -1
  367. package/src/lib/environments/worker.ts +419 -79
  368. package/src/lib/sessions/accumulate.ts +1 -3
  369. package/src/lib/standard-schema.ts +209 -0
  370. package/src/lib/tools/BetaToolRunner.ts +38 -6
  371. package/src/resources/beta/agents/agents.ts +435 -30
  372. package/src/resources/beta/agents/index.ts +17 -0
  373. package/src/resources/beta/beta.ts +52 -1
  374. package/src/resources/beta/environments/environments.ts +8 -1
  375. package/src/resources/beta/environments/work.ts +7 -0
  376. package/src/resources/beta/index.ts +18 -0
  377. package/src/resources/beta/memory-stores/memories.ts +6 -5
  378. package/src/resources/beta/memory-stores/memory-versions.ts +8 -5
  379. package/src/resources/beta/messages/messages.ts +51 -9
  380. package/src/resources/beta/organization/api-keys.ts +231 -0
  381. package/src/resources/beta/organization/external-keys.ts +362 -0
  382. package/src/resources/beta/organization/federation/federation.ts +71 -0
  383. package/src/resources/beta/organization/federation/index.ts +31 -0
  384. package/src/resources/beta/organization/federation/issuers.ts +486 -0
  385. package/src/resources/beta/organization/federation/rules/index.ts +23 -0
  386. package/src/resources/beta/organization/federation/rules/rules.ts +624 -0
  387. package/src/resources/beta/organization/federation/rules/workspaces.ts +196 -0
  388. package/src/resources/beta/organization/federation/rules.ts +3 -0
  389. package/src/resources/beta/organization/federation.ts +3 -0
  390. package/src/resources/beta/organization/index.ts +83 -0
  391. package/src/resources/beta/organization/invites.ts +207 -0
  392. package/src/resources/beta/organization/organization.ts +245 -0
  393. package/src/resources/beta/organization/rate-limits.ts +105 -0
  394. package/src/resources/beta/organization/service-accounts/index.ts +21 -0
  395. package/src/resources/beta/organization/service-accounts/service-accounts.ts +389 -0
  396. package/src/resources/beta/organization/service-accounts/workspaces.ts +217 -0
  397. package/src/resources/beta/organization/service-accounts.ts +3 -0
  398. package/src/resources/beta/organization/users.ts +163 -0
  399. package/src/resources/beta/organization/workspaces/index.ts +43 -0
  400. package/src/resources/beta/organization/workspaces/members.ts +209 -0
  401. package/src/resources/beta/organization/workspaces/rate-limits.ts +114 -0
  402. package/src/resources/beta/organization/workspaces/service-accounts.ts +325 -0
  403. package/src/resources/beta/organization/workspaces/workspaces.ts +434 -0
  404. package/src/resources/beta/organization/workspaces.ts +3 -0
  405. package/src/resources/beta/organization.ts +3 -0
  406. package/src/resources/beta/sessions/threads/threads.ts +2 -1
  407. package/src/resources/messages/messages.ts +1 -1
  408. package/src/tools/agent-toolset/fs-util.ts +40 -24
  409. package/src/tools/agent-toolset/memories.ts +1017 -0
  410. package/src/tools/agent-toolset/node.browser.ts +69 -1
  411. package/src/tools/agent-toolset/node.ts +143 -57
  412. package/src/tools/agent-toolset/skills.ts +29 -9
  413. package/src/tools/agent-toolset/sync-interval.ts +30 -0
  414. package/src/version.ts +1 -1
  415. package/tools/agent-toolset/fs-util.d.mts +23 -10
  416. package/tools/agent-toolset/fs-util.d.mts.map +1 -1
  417. package/tools/agent-toolset/fs-util.d.ts +23 -10
  418. package/tools/agent-toolset/fs-util.d.ts.map +1 -1
  419. package/tools/agent-toolset/fs-util.js +40 -25
  420. package/tools/agent-toolset/fs-util.js.map +1 -1
  421. package/tools/agent-toolset/fs-util.mjs +38 -25
  422. package/tools/agent-toolset/fs-util.mjs.map +1 -1
  423. package/tools/agent-toolset/memories.d.mts +173 -0
  424. package/tools/agent-toolset/memories.d.mts.map +1 -0
  425. package/tools/agent-toolset/memories.d.ts +173 -0
  426. package/tools/agent-toolset/memories.d.ts.map +1 -0
  427. package/tools/agent-toolset/memories.js +902 -0
  428. package/tools/agent-toolset/memories.js.map +1 -0
  429. package/tools/agent-toolset/memories.mjs +895 -0
  430. package/tools/agent-toolset/memories.mjs.map +1 -0
  431. package/tools/agent-toolset/node.browser.d.mts +32 -1
  432. package/tools/agent-toolset/node.browser.d.mts.map +1 -1
  433. package/tools/agent-toolset/node.browser.d.ts +32 -1
  434. package/tools/agent-toolset/node.browser.d.ts.map +1 -1
  435. package/tools/agent-toolset/node.browser.js +59 -1
  436. package/tools/agent-toolset/node.browser.js.map +1 -1
  437. package/tools/agent-toolset/node.browser.mjs +54 -0
  438. package/tools/agent-toolset/node.browser.mjs.map +1 -1
  439. package/tools/agent-toolset/node.d.mts +56 -24
  440. package/tools/agent-toolset/node.d.mts.map +1 -1
  441. package/tools/agent-toolset/node.d.ts +56 -24
  442. package/tools/agent-toolset/node.d.ts.map +1 -1
  443. package/tools/agent-toolset/node.js +83 -44
  444. package/tools/agent-toolset/node.js.map +1 -1
  445. package/tools/agent-toolset/node.mjs +77 -44
  446. package/tools/agent-toolset/node.mjs.map +1 -1
  447. package/tools/agent-toolset/skills.d.mts +16 -7
  448. package/tools/agent-toolset/skills.d.mts.map +1 -1
  449. package/tools/agent-toolset/skills.d.ts +16 -7
  450. package/tools/agent-toolset/skills.d.ts.map +1 -1
  451. package/tools/agent-toolset/skills.js +27 -9
  452. package/tools/agent-toolset/skills.js.map +1 -1
  453. package/tools/agent-toolset/skills.mjs +27 -9
  454. package/tools/agent-toolset/skills.mjs.map +1 -1
  455. package/tools/agent-toolset/sync-interval.d.mts +19 -0
  456. package/tools/agent-toolset/sync-interval.d.mts.map +1 -0
  457. package/tools/agent-toolset/sync-interval.d.ts +19 -0
  458. package/tools/agent-toolset/sync-interval.d.ts.map +1 -0
  459. package/tools/agent-toolset/sync-interval.js +29 -0
  460. package/tools/agent-toolset/sync-interval.js.map +1 -0
  461. package/tools/agent-toolset/sync-interval.mjs +25 -0
  462. package/tools/agent-toolset/sync-interval.mjs.map +1 -0
  463. package/version.d.mts +1 -1
  464. package/version.d.ts +1 -1
  465. package/version.js +1 -1
  466. package/version.mjs +1 -1
@@ -0,0 +1,434 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../../core/resource';
4
+ import * as BetaAPI from '../../beta';
5
+ import * as MembersAPI from './members';
6
+ import {
7
+ MemberAddParams,
8
+ MemberListParams,
9
+ MemberRemoveParams,
10
+ MemberRemoveResponse,
11
+ MemberRetrieveParams,
12
+ MemberUpdateParams,
13
+ Members,
14
+ } from './members';
15
+ import * as RateLimitsAPI from './rate-limits';
16
+ import {
17
+ BetaWorkspaceRateLimit,
18
+ BetaWorkspaceRateLimitValue,
19
+ BetaWorkspaceRateLimitsPageCursor,
20
+ RateLimitListParams,
21
+ RateLimits,
22
+ } from './rate-limits';
23
+ import * as ServiceAccountsAPI from './service-accounts';
24
+ import {
25
+ ServiceAccountAddParams,
26
+ ServiceAccountListParams,
27
+ ServiceAccountRemoveParams,
28
+ ServiceAccountRemoveResponse,
29
+ ServiceAccountRetrieveParams,
30
+ ServiceAccountUpdateParams,
31
+ ServiceAccounts,
32
+ } from './service-accounts';
33
+ import { APIPromise } from '../../../../core/api-promise';
34
+ import { Page, type PageParams, PagePromise } from '../../../../core/pagination';
35
+ import { buildHeaders } from '../../../../internal/headers';
36
+ import { RequestOptions } from '../../../../internal/request-options';
37
+ import { path } from '../../../../internal/utils/path';
38
+
39
+ export class Workspaces extends APIResource {
40
+ rateLimits: RateLimitsAPI.RateLimits = new RateLimitsAPI.RateLimits(this._client);
41
+ members: MembersAPI.Members = new MembersAPI.Members(this._client);
42
+ serviceAccounts: ServiceAccountsAPI.ServiceAccounts = new ServiceAccountsAPI.ServiceAccounts(this._client);
43
+
44
+ /**
45
+ * Create Workspace
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * const betaWorkspace =
50
+ * await client.beta.organization.workspaces.create({
51
+ * name: 'x',
52
+ * });
53
+ * ```
54
+ */
55
+ create(params: WorkspaceCreateParams, options?: RequestOptions): APIPromise<BetaWorkspace> {
56
+ const { betas, ...body } = params;
57
+ return this._client.post('/v1/organizations/workspaces?beta=true', {
58
+ body,
59
+ ...options,
60
+ headers: buildHeaders([
61
+ { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
62
+ options?.headers,
63
+ ]),
64
+ });
65
+ }
66
+
67
+ /**
68
+ * Get Workspace
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * const betaWorkspace =
73
+ * await client.beta.organization.workspaces.retrieve(
74
+ * 'workspace_id',
75
+ * );
76
+ * ```
77
+ */
78
+ retrieve(workspaceID: string, options?: RequestOptions): APIPromise<BetaWorkspace> {
79
+ return this._client.get(path`/v1/organizations/workspaces/${workspaceID}?beta=true`, options);
80
+ }
81
+
82
+ /**
83
+ * Update Workspace
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * const betaWorkspace =
88
+ * await client.beta.organization.workspaces.update(
89
+ * 'workspace_id',
90
+ * );
91
+ * ```
92
+ */
93
+ update(
94
+ workspaceID: string,
95
+ body: WorkspaceUpdateParams,
96
+ options?: RequestOptions,
97
+ ): APIPromise<BetaWorkspace> {
98
+ return this._client.post(path`/v1/organizations/workspaces/${workspaceID}?beta=true`, {
99
+ body,
100
+ ...options,
101
+ });
102
+ }
103
+
104
+ /**
105
+ * List Workspaces
106
+ *
107
+ * @example
108
+ * ```ts
109
+ * // Automatically fetches more pages as needed.
110
+ * for await (const betaWorkspace of client.beta.organization.workspaces.list()) {
111
+ * // ...
112
+ * }
113
+ * ```
114
+ */
115
+ list(
116
+ query: WorkspaceListParams | null | undefined = {},
117
+ options?: RequestOptions,
118
+ ): PagePromise<BetaWorkspacesPage, BetaWorkspace> {
119
+ return this._client.getAPIList('/v1/organizations/workspaces?beta=true', Page<BetaWorkspace>, {
120
+ query,
121
+ ...options,
122
+ });
123
+ }
124
+
125
+ /**
126
+ * Archive Workspace
127
+ *
128
+ * @example
129
+ * ```ts
130
+ * const betaWorkspace =
131
+ * await client.beta.organization.workspaces.archive(
132
+ * 'workspace_id',
133
+ * );
134
+ * ```
135
+ */
136
+ archive(workspaceID: string, options?: RequestOptions): APIPromise<BetaWorkspace> {
137
+ return this._client.post(path`/v1/organizations/workspaces/${workspaceID}/archive?beta=true`, options);
138
+ }
139
+ }
140
+
141
+ export type BetaWorkspacesPage = Page<BetaWorkspace>;
142
+
143
+ export type BetaWorkspaceMembersPage = Page<BetaWorkspaceMember>;
144
+
145
+ export type BetaAllowedInferenceGeo = 'global' | 'us';
146
+
147
+ export interface BetaDataResidency {
148
+ /**
149
+ * Permitted inference geo values. 'unrestricted' means all geos are allowed.
150
+ */
151
+ allowed_inference_geos: Array<string> | 'unrestricted';
152
+
153
+ /**
154
+ * Default inference geo applied when requests omit the parameter.
155
+ */
156
+ default_inference_geo: string;
157
+
158
+ /**
159
+ * Geographic region for workspace data storage. Immutable after creation.
160
+ */
161
+ workspace_geo: string;
162
+ }
163
+
164
+ export interface BetaDataResidencyCreateConfig {
165
+ /**
166
+ * Permitted inference geo values. Defaults to 'unrestricted' if omitted, which
167
+ * allows all geos. Use the string 'unrestricted' to allow all geos, or a list of
168
+ * specific geos.
169
+ */
170
+ allowed_inference_geos?: Array<BetaAllowedInferenceGeo> | 'unrestricted' | null;
171
+
172
+ /**
173
+ * Default inference geo applied when requests omit the parameter. Defaults to
174
+ * 'global' if omitted. Must be a member of `allowed_inference_geos` unless
175
+ * `allowed_inference_geos` is `"unrestricted"`.
176
+ */
177
+ default_inference_geo?: 'global' | 'us' | null;
178
+
179
+ /**
180
+ * Geographic region for workspace data storage. Immutable after creation. Defaults
181
+ * to 'us' if omitted.
182
+ */
183
+ workspace_geo?: 'us' | null;
184
+ }
185
+
186
+ export interface BetaDataResidencyUpdateConfig {
187
+ /**
188
+ * Permitted inference geo values. Use 'unrestricted' to allow all geos, or a list
189
+ * of specific geos.
190
+ */
191
+ allowed_inference_geos?: Array<BetaAllowedInferenceGeo> | 'unrestricted' | null;
192
+
193
+ /**
194
+ * Default inference geo applied when requests omit the parameter. Must be a member
195
+ * of `allowed_inference_geos` unless `allowed_inference_geos` is `"unrestricted"`.
196
+ */
197
+ default_inference_geo?: 'global' | 'us' | null;
198
+ }
199
+
200
+ export type BetaNoBillingWorkspaceRole =
201
+ | 'workspace_admin'
202
+ | 'workspace_developer'
203
+ | 'workspace_restricted_developer'
204
+ | 'workspace_user';
205
+
206
+ export interface BetaWorkspace {
207
+ /**
208
+ * ID of the Workspace.
209
+ */
210
+ id: string;
211
+
212
+ /**
213
+ * RFC 3339 datetime string indicating when the Workspace was archived, or `null`
214
+ * if the Workspace is not archived.
215
+ */
216
+ archived_at: string | null;
217
+
218
+ /**
219
+ * Identifier for this Workspace's encryption compartment. When you configure a
220
+ * customer-managed encryption key (CMEK) on AWS, reference this value in your KMS
221
+ * key-policy condition so the key is scoped to this compartment. On GCP and Azure,
222
+ * Anthropic enforces the compartment binding automatically; you do not need to
223
+ * reference this value in your key configuration. See the CMEK integration guide
224
+ * for the required key configuration, including the value used during key
225
+ * validation.
226
+ */
227
+ compartment_id: string;
228
+
229
+ /**
230
+ * RFC 3339 datetime string indicating when the Workspace was created.
231
+ */
232
+ created_at: string;
233
+
234
+ /**
235
+ * Data residency configuration.
236
+ */
237
+ data_residency: BetaDataResidency;
238
+
239
+ /**
240
+ * Hex color code representing the Workspace in the Anthropic Console.
241
+ */
242
+ display_color: string;
243
+
244
+ /**
245
+ * ID of the customer-managed encryption key (CMEK) configuration to use for this
246
+ * Workspace. Setting this field requires CMEK to be enabled for your organization.
247
+ * When set, data stored for this Workspace is encrypted with the referenced key.
248
+ * Create key configurations with the External Keys API. This field is write-once:
249
+ * once a key is attached to a Workspace it cannot be detached or replaced. To
250
+ * rotate key material, rotate the underlying key on your cloud KMS; the
251
+ * `external_key_id` stays the same.
252
+ */
253
+ external_key_id: string | null;
254
+
255
+ /**
256
+ * Name of the Workspace.
257
+ */
258
+ name: string;
259
+
260
+ /**
261
+ * User-defined tags as string key-value pairs. Keys may not begin with
262
+ * `anthropic`.
263
+ */
264
+ tags: { [key: string]: string };
265
+
266
+ /**
267
+ * Object type.
268
+ *
269
+ * For Workspaces, this is always `"workspace"`.
270
+ */
271
+ type: 'workspace';
272
+ }
273
+
274
+ export interface BetaWorkspaceMember {
275
+ /**
276
+ * Object type.
277
+ *
278
+ * For Workspace Members, this is always `"workspace_member"`.
279
+ */
280
+ type: 'workspace_member';
281
+
282
+ /**
283
+ * ID of the User.
284
+ */
285
+ user_id: string;
286
+
287
+ /**
288
+ * ID of the Workspace.
289
+ */
290
+ workspace_id: string;
291
+
292
+ /**
293
+ * Role of the Workspace Member.
294
+ */
295
+ workspace_role: BetaWorkspaceRole;
296
+ }
297
+
298
+ export type BetaWorkspaceRole =
299
+ | 'workspace_admin'
300
+ | 'workspace_billing'
301
+ | 'workspace_developer'
302
+ | 'workspace_restricted_developer'
303
+ | 'workspace_user';
304
+
305
+ export interface WorkspaceCreateParams {
306
+ /**
307
+ * Body param: Name of the Workspace.
308
+ */
309
+ name: string;
310
+
311
+ /**
312
+ * Body param: Data residency configuration for the workspace. If omitted, defaults
313
+ * to `workspace_geo: "us"`, `allowed_inference_geos: "unrestricted"`, and
314
+ * `default_inference_geo: "global"`.
315
+ */
316
+ data_residency?: BetaDataResidencyCreateConfig | null;
317
+
318
+ /**
319
+ * Body param: Hex color code representing the Workspace in the Anthropic Console.
320
+ */
321
+ display_color?: string | null;
322
+
323
+ /**
324
+ * Body param: ID of the customer-managed encryption key (CMEK) configuration to
325
+ * use for this Workspace. Setting this field requires CMEK to be enabled for your
326
+ * organization. When set, data stored for this Workspace is encrypted with the
327
+ * referenced key. Create key configurations with the External Keys API. This field
328
+ * is write-once: once a key is attached to a Workspace it cannot be detached or
329
+ * replaced. To rotate key material, rotate the underlying key on your cloud KMS;
330
+ * the `external_key_id` stays the same.
331
+ */
332
+ external_key_id?: string | null;
333
+
334
+ /**
335
+ * Body param: User-defined tags as string key-value pairs. Keys may not begin with
336
+ * `anthropic`.
337
+ */
338
+ tags?: { [key: string]: string } | null;
339
+
340
+ /**
341
+ * Header param: Optional header to specify the beta version(s) you want to use.
342
+ */
343
+ betas?: Array<BetaAPI.AnthropicBeta>;
344
+ }
345
+
346
+ export interface WorkspaceUpdateParams {
347
+ /**
348
+ * Data residency configuration for the workspace.
349
+ */
350
+ data_residency?: BetaDataResidencyUpdateConfig | null;
351
+
352
+ /**
353
+ * Hex color code representing the Workspace in the Anthropic Console.
354
+ */
355
+ display_color?: string;
356
+
357
+ /**
358
+ * ID of the customer-managed encryption key (CMEK) configuration to use for this
359
+ * Workspace. Setting this field requires CMEK to be enabled for your organization.
360
+ * When set, data stored for this Workspace is encrypted with the referenced key.
361
+ * Create key configurations with the External Keys API. This field is write-once:
362
+ * once a key is attached to a Workspace it cannot be detached or replaced. To
363
+ * rotate key material, rotate the underlying key on your cloud KMS; the
364
+ * `external_key_id` stays the same.
365
+ */
366
+ external_key_id?: string;
367
+
368
+ /**
369
+ * Name of the Workspace.
370
+ */
371
+ name?: string;
372
+
373
+ /**
374
+ * User-defined tags as string key-value pairs. Keys may not begin with
375
+ * `anthropic`.
376
+ */
377
+ tags?: { [key: string]: string | null } | null;
378
+ }
379
+
380
+ export interface WorkspaceListParams extends PageParams {
381
+ /**
382
+ * Whether to include Workspaces that have been archived in the response
383
+ */
384
+ include_archived?: boolean;
385
+ }
386
+
387
+ Workspaces.RateLimits = RateLimits;
388
+ Workspaces.Members = Members;
389
+ Workspaces.ServiceAccounts = ServiceAccounts;
390
+
391
+ export declare namespace Workspaces {
392
+ export {
393
+ type BetaAllowedInferenceGeo as BetaAllowedInferenceGeo,
394
+ type BetaDataResidency as BetaDataResidency,
395
+ type BetaDataResidencyCreateConfig as BetaDataResidencyCreateConfig,
396
+ type BetaDataResidencyUpdateConfig as BetaDataResidencyUpdateConfig,
397
+ type BetaNoBillingWorkspaceRole as BetaNoBillingWorkspaceRole,
398
+ type BetaWorkspace as BetaWorkspace,
399
+ type BetaWorkspaceMember as BetaWorkspaceMember,
400
+ type BetaWorkspaceRole as BetaWorkspaceRole,
401
+ type BetaWorkspacesPage as BetaWorkspacesPage,
402
+ type WorkspaceCreateParams as WorkspaceCreateParams,
403
+ type WorkspaceUpdateParams as WorkspaceUpdateParams,
404
+ type WorkspaceListParams as WorkspaceListParams,
405
+ };
406
+
407
+ export {
408
+ RateLimits as RateLimits,
409
+ type BetaWorkspaceRateLimit as BetaWorkspaceRateLimit,
410
+ type BetaWorkspaceRateLimitValue as BetaWorkspaceRateLimitValue,
411
+ type BetaWorkspaceRateLimitsPageCursor as BetaWorkspaceRateLimitsPageCursor,
412
+ type RateLimitListParams as RateLimitListParams,
413
+ };
414
+
415
+ export {
416
+ Members as Members,
417
+ type MemberRemoveResponse as MemberRemoveResponse,
418
+ type MemberRetrieveParams as MemberRetrieveParams,
419
+ type MemberUpdateParams as MemberUpdateParams,
420
+ type MemberListParams as MemberListParams,
421
+ type MemberAddParams as MemberAddParams,
422
+ type MemberRemoveParams as MemberRemoveParams,
423
+ };
424
+
425
+ export {
426
+ ServiceAccounts as ServiceAccounts,
427
+ type ServiceAccountRemoveResponse as ServiceAccountRemoveResponse,
428
+ type ServiceAccountRetrieveParams as ServiceAccountRetrieveParams,
429
+ type ServiceAccountUpdateParams as ServiceAccountUpdateParams,
430
+ type ServiceAccountListParams as ServiceAccountListParams,
431
+ type ServiceAccountAddParams as ServiceAccountAddParams,
432
+ type ServiceAccountRemoveParams as ServiceAccountRemoveParams,
433
+ };
434
+ }
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './workspaces/index';
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './organization/index';
@@ -117,7 +117,8 @@ export interface BetaManagedAgentsSessionThread {
117
117
  id: string;
118
118
 
119
119
  /**
120
- * A session-resolved multiagent roster entry.
120
+ * The resolved agent a session thread runs: a saved-agent snapshot, the platform
121
+ * advisor entry, or an inline-defined (ephemeral) agent snapshot.
121
122
  */
122
123
  agent: AgentsAPI.BetaManagedAgentsSessionThreadAgent | AgentsAPI.BetaManagedAgentsAdvisor;
123
124
 
@@ -2196,7 +2196,7 @@ export interface ContainerSkill {
2196
2196
  type: 'anthropic' | 'custom';
2197
2197
 
2198
2198
  /**
2199
- * Skill version or 'latest' for most recent version
2199
+ * The resolved version: a skill version ID for custom skills.
2200
2200
  */
2201
2201
  version: string;
2202
2202
  }
@@ -15,13 +15,25 @@ export const DIR_CREATE_MODE = 0o755;
15
15
  /** Mode for files the file tools create. */
16
16
  export const FILE_CREATE_MODE = 0o644;
17
17
 
18
- /** `realpath` `p`, or return `p` unchanged when it cannot be resolved. */
19
- async function realpathOrSelf(p: string): Promise<string> {
20
- try {
21
- return await fs.realpath(p);
22
- } catch {
23
- return p;
18
+ /** True when `p` is `root` itself or lexically contained within it. */
19
+ export function isWithin(root: string, p: string): boolean {
20
+ const rel = path.relative(root, p);
21
+ return rel === '' || (!rel.startsWith('..' + path.sep) && rel !== '..' && !path.isAbsolute(rel));
22
+ }
23
+
24
+ /**
25
+ * The first entry of `roots` whose canonical form contains the
26
+ * already-canonical `target`, returned as configured; `undefined` when none
27
+ * does. Each root goes through {@link canonicalize} at check time, exactly like
28
+ * the workdir in {@link confineToRoot}, so granting access (`allowedRoots`)
29
+ * and refusing writes (`readOnlyRoots`) can never resolve the same entry two
30
+ * different ways.
31
+ */
32
+ export async function containingRoot(roots: readonly string[], target: string): Promise<string | undefined> {
33
+ for (const root of roots) {
34
+ if (isWithin(await canonicalize(path.resolve(root)), target)) return root;
24
35
  }
36
+ return undefined;
25
37
  }
26
38
 
27
39
  /** Matches Linux MAXSYMLINKS, the threshold at which `realpath` itself reports ELOOP. */
@@ -79,17 +91,19 @@ export async function canonicalize(abs: string): Promise<string> {
79
91
  }
80
92
 
81
93
  /**
82
- * Resolve `p` and confine it to `root`.
94
+ * Resolve `p` against `root` and confine it to `root` or one of `allowedRoots`
95
+ * (absolute paths, resolved at check time exactly like `root`).
83
96
  *
84
97
  * Absolute and relative inputs go through the same canonicalise-then-contain
85
- * check — an absolute path that lands inside `root` is permitted, only paths
86
- * that resolve *outside* are rejected. Every symlink in `p` (including the
87
- * leaf, even a dangling one) is resolved before the confinement check, and the
88
- * resolved path is what the caller then operates on, so a symlink inside `root`
89
- * that points outside it can neither pass the check nor be followed afterwards.
90
- * `..` is collapsed lexically before any symlink is followed. A path that cannot
91
- * be resolved (symlink loop, unreadable component) is rejected with a
92
- * `ToolError` naming `p`, never the host's absolute path.
98
+ * check — an absolute path that lands inside a permitted root is accepted,
99
+ * only paths that resolve *outside* all of them are rejected. Every symlink in
100
+ * `p` (including the leaf, even a dangling one) is resolved before the
101
+ * confinement check, and the resolved path is what the caller then operates
102
+ * on, so a symlink inside `root` that points outside it can neither pass the
103
+ * check nor be followed afterwards. `..` is collapsed lexically before any
104
+ * symlink is followed. A path that cannot be resolved (symlink loop, unreadable
105
+ * component) is rejected with a `ToolError` naming `p`, never the host's
106
+ * absolute path.
93
107
  *
94
108
  * Residual TOCTOU: a component could still be swapped for a symlink between this
95
109
  * call and the eventual `fs` operation. Closing that fully needs per-component
@@ -99,22 +113,24 @@ export async function canonicalize(abs: string): Promise<string> {
99
113
  export async function confineToRoot(
100
114
  root: string,
101
115
  p: string,
102
- opts?: { allowOutside?: boolean },
116
+ opts?: { allowedRoots?: readonly string[] },
103
117
  ): Promise<string> {
104
- const allowOutside = opts?.allowOutside ?? false;
105
- const realRoot = await realpathOrSelf(path.resolve(root));
106
- const abs = path.resolve(realRoot, p);
107
- if (allowOutside) return abs;
118
+ const allowedRoots = opts?.allowedRoots ?? [];
119
+ const realRoot = await canonicalize(path.resolve(root));
108
120
  let real: string;
109
121
  try {
110
- real = await canonicalize(abs);
122
+ real = await canonicalize(path.resolve(realRoot, p));
111
123
  } catch (err) {
112
124
  throw new ToolError(fsErrorMessage(err, `path ${JSON.stringify(p)}`));
113
125
  }
114
- if (real !== realRoot && !real.startsWith(realRoot + path.sep)) {
115
- throw new ToolError(`path ${JSON.stringify(p)} escapes workdir`);
126
+ if (isWithin(realRoot, real) || (await containingRoot(allowedRoots, real)) !== undefined) {
127
+ return real;
116
128
  }
117
- return real;
129
+ const permitted =
130
+ allowedRoots.length ?
131
+ "the session's working directory and its other permitted directories"
132
+ : "the session's working directory";
133
+ throw new ToolError(`path ${JSON.stringify(p)} is outside ${permitted}`);
118
134
  }
119
135
 
120
136
  /**