@anthropic-ai/sdk 0.122.0 → 0.124.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 (486) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/client.d.mts +6 -5
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +6 -5
  5. package/client.d.ts.map +1 -1
  6. package/client.js +2 -1
  7. package/client.js.map +1 -1
  8. package/client.mjs +2 -1
  9. package/client.mjs.map +1 -1
  10. package/core/credentials.d.mts.map +1 -1
  11. package/core/credentials.d.ts.map +1 -1
  12. package/core/credentials.js +5 -7
  13. package/core/credentials.js.map +1 -1
  14. package/core/credentials.mjs +5 -7
  15. package/core/credentials.mjs.map +1 -1
  16. package/core/streaming.js +4 -2
  17. package/core/streaming.js.map +1 -1
  18. package/core/streaming.mjs +4 -2
  19. package/core/streaming.mjs.map +1 -1
  20. package/internal/file-store.d.mts.map +1 -1
  21. package/internal/file-store.d.ts.map +1 -1
  22. package/internal/file-store.js +23 -25
  23. package/internal/file-store.js.map +1 -1
  24. package/internal/file-store.mjs +5 -6
  25. package/internal/file-store.mjs.map +1 -1
  26. package/internal/node.browser.d.mts +9 -0
  27. package/internal/node.browser.d.mts.map +1 -0
  28. package/internal/node.browser.d.ts +9 -0
  29. package/internal/node.browser.d.ts.map +1 -0
  30. package/internal/node.browser.js +22 -0
  31. package/internal/node.browser.js.map +1 -0
  32. package/internal/node.browser.mjs +19 -0
  33. package/internal/node.browser.mjs.map +1 -0
  34. package/internal/node.d.mts +14 -0
  35. package/internal/node.d.mts.map +1 -0
  36. package/internal/node.d.ts +14 -0
  37. package/internal/node.d.ts.map +1 -0
  38. package/internal/node.js +24 -0
  39. package/internal/node.js.map +1 -0
  40. package/internal/node.mjs +14 -0
  41. package/internal/node.mjs.map +1 -0
  42. package/lib/BetaMessageStream.d.mts.map +1 -1
  43. package/lib/BetaMessageStream.d.ts.map +1 -1
  44. package/lib/BetaMessageStream.js +3 -0
  45. package/lib/BetaMessageStream.js.map +1 -1
  46. package/lib/BetaMessageStream.mjs +3 -0
  47. package/lib/BetaMessageStream.mjs.map +1 -1
  48. package/lib/credentials/credential-chain.js +1 -1
  49. package/lib/credentials/credential-chain.js.map +1 -1
  50. package/lib/credentials/credential-chain.mjs +1 -1
  51. package/lib/credentials/credential-chain.mjs.map +1 -1
  52. package/lib/credentials/identity-token.js +1 -1
  53. package/lib/credentials/identity-token.js.map +1 -1
  54. package/lib/credentials/identity-token.mjs +1 -1
  55. package/lib/credentials/identity-token.mjs.map +1 -1
  56. package/lib/credentials/types.d.mts.map +1 -1
  57. package/lib/credentials/types.d.ts.map +1 -1
  58. package/lib/credentials/types.js +2 -3
  59. package/lib/credentials/types.js.map +1 -1
  60. package/lib/credentials/types.mjs +2 -3
  61. package/lib/credentials/types.mjs.map +1 -1
  62. package/lib/credentials/user-oauth.js +1 -1
  63. package/lib/credentials/user-oauth.js.map +1 -1
  64. package/lib/credentials/user-oauth.mjs +1 -1
  65. package/lib/credentials/user-oauth.mjs.map +1 -1
  66. package/lib/middleware.d.mts.map +1 -1
  67. package/lib/middleware.d.ts.map +1 -1
  68. package/lib/middleware.js +30 -7
  69. package/lib/middleware.js.map +1 -1
  70. package/lib/middleware.mjs +30 -7
  71. package/lib/middleware.mjs.map +1 -1
  72. package/package.json +3 -1
  73. package/resources/beta/agents/agents.d.mts +46 -1
  74. package/resources/beta/agents/agents.d.mts.map +1 -1
  75. package/resources/beta/agents/agents.d.ts +46 -1
  76. package/resources/beta/agents/agents.d.ts.map +1 -1
  77. package/resources/beta/agents/agents.js +25 -10
  78. package/resources/beta/agents/agents.js.map +1 -1
  79. package/resources/beta/agents/agents.mjs +25 -10
  80. package/resources/beta/agents/agents.mjs.map +1 -1
  81. package/resources/beta/agents/versions.d.mts +9 -0
  82. package/resources/beta/agents/versions.d.mts.map +1 -1
  83. package/resources/beta/agents/versions.d.ts +9 -0
  84. package/resources/beta/agents/versions.d.ts.map +1 -1
  85. package/resources/beta/agents/versions.js +5 -2
  86. package/resources/beta/agents/versions.js.map +1 -1
  87. package/resources/beta/agents/versions.mjs +5 -2
  88. package/resources/beta/agents/versions.mjs.map +1 -1
  89. package/resources/beta/beta.d.mts +5 -5
  90. package/resources/beta/beta.d.mts.map +1 -1
  91. package/resources/beta/beta.d.ts +5 -5
  92. package/resources/beta/beta.d.ts.map +1 -1
  93. package/resources/beta/beta.js.map +1 -1
  94. package/resources/beta/beta.mjs.map +1 -1
  95. package/resources/beta/deployment-runs.d.mts +24 -6
  96. package/resources/beta/deployment-runs.d.mts.map +1 -1
  97. package/resources/beta/deployment-runs.d.ts +24 -6
  98. package/resources/beta/deployment-runs.d.ts.map +1 -1
  99. package/resources/beta/deployment-runs.js +10 -4
  100. package/resources/beta/deployment-runs.js.map +1 -1
  101. package/resources/beta/deployment-runs.mjs +10 -4
  102. package/resources/beta/deployment-runs.mjs.map +1 -1
  103. package/resources/beta/deployments.d.mts +75 -2
  104. package/resources/beta/deployments.d.mts.map +1 -1
  105. package/resources/beta/deployments.d.ts +75 -2
  106. package/resources/beta/deployments.d.ts.map +1 -1
  107. package/resources/beta/deployments.js +40 -16
  108. package/resources/beta/deployments.js.map +1 -1
  109. package/resources/beta/deployments.mjs +40 -16
  110. package/resources/beta/deployments.mjs.map +1 -1
  111. package/resources/beta/dreams.d.mts +73 -1
  112. package/resources/beta/dreams.d.mts.map +1 -1
  113. package/resources/beta/dreams.d.ts +73 -1
  114. package/resources/beta/dreams.d.ts.map +1 -1
  115. package/resources/beta/dreams.js +25 -10
  116. package/resources/beta/dreams.js.map +1 -1
  117. package/resources/beta/dreams.mjs +25 -10
  118. package/resources/beta/dreams.mjs.map +1 -1
  119. package/resources/beta/environments/environments.d.mts +54 -0
  120. package/resources/beta/environments/environments.d.mts.map +1 -1
  121. package/resources/beta/environments/environments.d.ts +54 -0
  122. package/resources/beta/environments/environments.d.ts.map +1 -1
  123. package/resources/beta/environments/environments.js +30 -12
  124. package/resources/beta/environments/environments.js.map +1 -1
  125. package/resources/beta/environments/environments.mjs +30 -12
  126. package/resources/beta/environments/environments.mjs.map +1 -1
  127. package/resources/beta/environments/work.d.mts +36 -0
  128. package/resources/beta/environments/work.d.mts.map +1 -1
  129. package/resources/beta/environments/work.d.ts +36 -0
  130. package/resources/beta/environments/work.d.ts.map +1 -1
  131. package/resources/beta/environments/work.js +20 -8
  132. package/resources/beta/environments/work.js.map +1 -1
  133. package/resources/beta/environments/work.mjs +20 -8
  134. package/resources/beta/environments/work.mjs.map +1 -1
  135. package/resources/beta/files.d.mts +48 -1
  136. package/resources/beta/files.d.mts.map +1 -1
  137. package/resources/beta/files.d.ts +48 -1
  138. package/resources/beta/files.d.ts.map +1 -1
  139. package/resources/beta/files.js +22 -9
  140. package/resources/beta/files.js.map +1 -1
  141. package/resources/beta/files.mjs +22 -9
  142. package/resources/beta/files.mjs.map +1 -1
  143. package/resources/beta/index.d.mts +2 -2
  144. package/resources/beta/index.d.mts.map +1 -1
  145. package/resources/beta/index.d.ts +2 -2
  146. package/resources/beta/index.d.ts.map +1 -1
  147. package/resources/beta/index.js.map +1 -1
  148. package/resources/beta/index.mjs.map +1 -1
  149. package/resources/beta/memory-stores/memories.d.mts +51 -4
  150. package/resources/beta/memory-stores/memories.d.mts.map +1 -1
  151. package/resources/beta/memory-stores/memories.d.ts +51 -4
  152. package/resources/beta/memory-stores/memories.d.ts.map +1 -1
  153. package/resources/beta/memory-stores/memories.js +25 -10
  154. package/resources/beta/memory-stores/memories.js.map +1 -1
  155. package/resources/beta/memory-stores/memories.mjs +25 -10
  156. package/resources/beta/memory-stores/memories.mjs.map +1 -1
  157. package/resources/beta/memory-stores/memory-stores.d.mts +54 -0
  158. package/resources/beta/memory-stores/memory-stores.d.mts.map +1 -1
  159. package/resources/beta/memory-stores/memory-stores.d.ts +54 -0
  160. package/resources/beta/memory-stores/memory-stores.d.ts.map +1 -1
  161. package/resources/beta/memory-stores/memory-stores.js +30 -12
  162. package/resources/beta/memory-stores/memory-stores.js.map +1 -1
  163. package/resources/beta/memory-stores/memory-stores.mjs +30 -12
  164. package/resources/beta/memory-stores/memory-stores.mjs.map +1 -1
  165. package/resources/beta/memory-stores/memory-versions.d.mts +31 -4
  166. package/resources/beta/memory-stores/memory-versions.d.mts.map +1 -1
  167. package/resources/beta/memory-stores/memory-versions.d.ts +31 -4
  168. package/resources/beta/memory-stores/memory-versions.d.ts.map +1 -1
  169. package/resources/beta/memory-stores/memory-versions.js +15 -6
  170. package/resources/beta/memory-stores/memory-versions.js.map +1 -1
  171. package/resources/beta/memory-stores/memory-versions.mjs +15 -6
  172. package/resources/beta/memory-stores/memory-versions.mjs.map +1 -1
  173. package/resources/beta/messages/batches.d.mts +54 -0
  174. package/resources/beta/messages/batches.d.mts.map +1 -1
  175. package/resources/beta/messages/batches.d.ts +54 -0
  176. package/resources/beta/messages/batches.d.ts.map +1 -1
  177. package/resources/beta/messages/batches.js +25 -11
  178. package/resources/beta/messages/batches.js.map +1 -1
  179. package/resources/beta/messages/batches.mjs +25 -11
  180. package/resources/beta/messages/batches.mjs.map +1 -1
  181. package/resources/beta/messages/index.d.mts +1 -1
  182. package/resources/beta/messages/index.d.mts.map +1 -1
  183. package/resources/beta/messages/index.d.ts +1 -1
  184. package/resources/beta/messages/index.d.ts.map +1 -1
  185. package/resources/beta/messages/index.js.map +1 -1
  186. package/resources/beta/messages/index.mjs.map +1 -1
  187. package/resources/beta/messages/messages.d.mts +148 -3
  188. package/resources/beta/messages/messages.d.mts.map +1 -1
  189. package/resources/beta/messages/messages.d.ts +148 -3
  190. package/resources/beta/messages/messages.d.ts.map +1 -1
  191. package/resources/beta/messages/messages.js +4 -2
  192. package/resources/beta/messages/messages.js.map +1 -1
  193. package/resources/beta/messages/messages.mjs +4 -2
  194. package/resources/beta/messages/messages.mjs.map +1 -1
  195. package/resources/beta/models.d.mts +18 -0
  196. package/resources/beta/models.d.mts.map +1 -1
  197. package/resources/beta/models.d.ts +18 -0
  198. package/resources/beta/models.d.ts.map +1 -1
  199. package/resources/beta/models.js +10 -4
  200. package/resources/beta/models.js.map +1 -1
  201. package/resources/beta/models.mjs +10 -4
  202. package/resources/beta/models.mjs.map +1 -1
  203. package/resources/beta/organization/compliance-settings.d.mts +76 -0
  204. package/resources/beta/organization/compliance-settings.d.mts.map +1 -0
  205. package/resources/beta/organization/compliance-settings.d.ts +76 -0
  206. package/resources/beta/organization/compliance-settings.d.ts.map +1 -0
  207. package/resources/beta/organization/compliance-settings.js +52 -0
  208. package/resources/beta/organization/compliance-settings.js.map +1 -0
  209. package/resources/beta/organization/compliance-settings.mjs +48 -0
  210. package/resources/beta/organization/compliance-settings.mjs.map +1 -0
  211. package/resources/beta/organization/external-keys.d.mts +6 -3
  212. package/resources/beta/organization/external-keys.d.mts.map +1 -1
  213. package/resources/beta/organization/external-keys.d.ts +6 -3
  214. package/resources/beta/organization/external-keys.d.ts.map +1 -1
  215. package/resources/beta/organization/index.d.mts +1 -0
  216. package/resources/beta/organization/index.d.mts.map +1 -1
  217. package/resources/beta/organization/index.d.ts +1 -0
  218. package/resources/beta/organization/index.d.ts.map +1 -1
  219. package/resources/beta/organization/index.js +3 -1
  220. package/resources/beta/organization/index.js.map +1 -1
  221. package/resources/beta/organization/index.mjs +1 -0
  222. package/resources/beta/organization/index.mjs.map +1 -1
  223. package/resources/beta/organization/organization.d.mts +4 -0
  224. package/resources/beta/organization/organization.d.mts.map +1 -1
  225. package/resources/beta/organization/organization.d.ts +4 -0
  226. package/resources/beta/organization/organization.d.ts.map +1 -1
  227. package/resources/beta/organization/organization.js +4 -0
  228. package/resources/beta/organization/organization.js.map +1 -1
  229. package/resources/beta/organization/organization.mjs +4 -0
  230. package/resources/beta/organization/organization.mjs.map +1 -1
  231. package/resources/beta/organization/workspaces/workspaces.d.mts +28 -12
  232. package/resources/beta/organization/workspaces/workspaces.d.mts.map +1 -1
  233. package/resources/beta/organization/workspaces/workspaces.d.ts +28 -12
  234. package/resources/beta/organization/workspaces/workspaces.d.ts.map +1 -1
  235. package/resources/beta/organization/workspaces/workspaces.js.map +1 -1
  236. package/resources/beta/organization/workspaces/workspaces.mjs.map +1 -1
  237. package/resources/beta/sessions/events.d.mts +28 -1
  238. package/resources/beta/sessions/events.d.mts.map +1 -1
  239. package/resources/beta/sessions/events.d.ts +28 -1
  240. package/resources/beta/sessions/events.d.ts.map +1 -1
  241. package/resources/beta/sessions/events.js +15 -6
  242. package/resources/beta/sessions/events.js.map +1 -1
  243. package/resources/beta/sessions/events.mjs +15 -6
  244. package/resources/beta/sessions/events.mjs.map +1 -1
  245. package/resources/beta/sessions/resources.d.mts +45 -0
  246. package/resources/beta/sessions/resources.d.mts.map +1 -1
  247. package/resources/beta/sessions/resources.d.ts +45 -0
  248. package/resources/beta/sessions/resources.d.ts.map +1 -1
  249. package/resources/beta/sessions/resources.js +25 -10
  250. package/resources/beta/sessions/resources.js.map +1 -1
  251. package/resources/beta/sessions/resources.mjs +25 -10
  252. package/resources/beta/sessions/resources.mjs.map +1 -1
  253. package/resources/beta/sessions/sessions.d.mts +64 -10
  254. package/resources/beta/sessions/sessions.d.mts.map +1 -1
  255. package/resources/beta/sessions/sessions.d.ts +64 -10
  256. package/resources/beta/sessions/sessions.d.ts.map +1 -1
  257. package/resources/beta/sessions/sessions.js +30 -12
  258. package/resources/beta/sessions/sessions.js.map +1 -1
  259. package/resources/beta/sessions/sessions.mjs +30 -12
  260. package/resources/beta/sessions/sessions.mjs.map +1 -1
  261. package/resources/beta/sessions/threads/events.d.mts +18 -0
  262. package/resources/beta/sessions/threads/events.d.mts.map +1 -1
  263. package/resources/beta/sessions/threads/events.d.ts +18 -0
  264. package/resources/beta/sessions/threads/events.d.ts.map +1 -1
  265. package/resources/beta/sessions/threads/events.js +10 -4
  266. package/resources/beta/sessions/threads/events.js.map +1 -1
  267. package/resources/beta/sessions/threads/events.mjs +10 -4
  268. package/resources/beta/sessions/threads/events.mjs.map +1 -1
  269. package/resources/beta/sessions/threads/threads.d.mts +27 -0
  270. package/resources/beta/sessions/threads/threads.d.mts.map +1 -1
  271. package/resources/beta/sessions/threads/threads.d.ts +27 -0
  272. package/resources/beta/sessions/threads/threads.d.ts.map +1 -1
  273. package/resources/beta/sessions/threads/threads.js +15 -6
  274. package/resources/beta/sessions/threads/threads.js.map +1 -1
  275. package/resources/beta/sessions/threads/threads.mjs +15 -6
  276. package/resources/beta/sessions/threads/threads.mjs.map +1 -1
  277. package/resources/beta/skills/skills.d.mts +36 -0
  278. package/resources/beta/skills/skills.d.mts.map +1 -1
  279. package/resources/beta/skills/skills.d.ts +36 -0
  280. package/resources/beta/skills/skills.d.ts.map +1 -1
  281. package/resources/beta/skills/skills.js +20 -8
  282. package/resources/beta/skills/skills.js.map +1 -1
  283. package/resources/beta/skills/skills.mjs +20 -8
  284. package/resources/beta/skills/skills.mjs.map +1 -1
  285. package/resources/beta/skills/versions.d.mts +45 -0
  286. package/resources/beta/skills/versions.d.mts.map +1 -1
  287. package/resources/beta/skills/versions.d.ts +45 -0
  288. package/resources/beta/skills/versions.d.ts.map +1 -1
  289. package/resources/beta/skills/versions.js +22 -9
  290. package/resources/beta/skills/versions.js.map +1 -1
  291. package/resources/beta/skills/versions.mjs +22 -9
  292. package/resources/beta/skills/versions.mjs.map +1 -1
  293. package/resources/beta/tunnels/certificates.d.mts +36 -0
  294. package/resources/beta/tunnels/certificates.d.mts.map +1 -1
  295. package/resources/beta/tunnels/certificates.d.ts +36 -0
  296. package/resources/beta/tunnels/certificates.d.ts.map +1 -1
  297. package/resources/beta/tunnels/certificates.js +20 -8
  298. package/resources/beta/tunnels/certificates.js.map +1 -1
  299. package/resources/beta/tunnels/certificates.mjs +20 -8
  300. package/resources/beta/tunnels/certificates.mjs.map +1 -1
  301. package/resources/beta/tunnels/tunnels.d.mts +54 -0
  302. package/resources/beta/tunnels/tunnels.d.mts.map +1 -1
  303. package/resources/beta/tunnels/tunnels.d.ts +54 -0
  304. package/resources/beta/tunnels/tunnels.d.ts.map +1 -1
  305. package/resources/beta/tunnels/tunnels.js +30 -12
  306. package/resources/beta/tunnels/tunnels.js.map +1 -1
  307. package/resources/beta/tunnels/tunnels.mjs +30 -12
  308. package/resources/beta/tunnels/tunnels.mjs.map +1 -1
  309. package/resources/beta/user-profiles.d.mts +21 -25
  310. package/resources/beta/user-profiles.d.mts.map +1 -1
  311. package/resources/beta/user-profiles.d.ts +21 -25
  312. package/resources/beta/user-profiles.d.ts.map +1 -1
  313. package/resources/beta/vaults/credentials.d.mts +63 -0
  314. package/resources/beta/vaults/credentials.d.mts.map +1 -1
  315. package/resources/beta/vaults/credentials.d.ts +63 -0
  316. package/resources/beta/vaults/credentials.d.ts.map +1 -1
  317. package/resources/beta/vaults/credentials.js +35 -14
  318. package/resources/beta/vaults/credentials.js.map +1 -1
  319. package/resources/beta/vaults/credentials.mjs +35 -14
  320. package/resources/beta/vaults/credentials.mjs.map +1 -1
  321. package/resources/beta/vaults/vaults.d.mts +54 -0
  322. package/resources/beta/vaults/vaults.d.mts.map +1 -1
  323. package/resources/beta/vaults/vaults.d.ts +54 -0
  324. package/resources/beta/vaults/vaults.d.ts.map +1 -1
  325. package/resources/beta/vaults/vaults.js +30 -12
  326. package/resources/beta/vaults/vaults.js.map +1 -1
  327. package/resources/beta/vaults/vaults.mjs +30 -12
  328. package/resources/beta/vaults/vaults.mjs.map +1 -1
  329. package/resources/completions.d.mts +9 -0
  330. package/resources/completions.d.mts.map +1 -1
  331. package/resources/completions.d.ts +9 -0
  332. package/resources/completions.d.ts.map +1 -1
  333. package/resources/completions.js +5 -2
  334. package/resources/completions.js.map +1 -1
  335. package/resources/completions.mjs +5 -2
  336. package/resources/completions.mjs.map +1 -1
  337. package/resources/files.d.mts +104 -15
  338. package/resources/files.d.mts.map +1 -1
  339. package/resources/files.d.ts +104 -15
  340. package/resources/files.d.ts.map +1 -1
  341. package/resources/files.js +79 -10
  342. package/resources/files.js.map +1 -1
  343. package/resources/files.mjs +79 -10
  344. package/resources/files.mjs.map +1 -1
  345. package/resources/index.d.mts +2 -2
  346. package/resources/index.d.mts.map +1 -1
  347. package/resources/index.d.ts +2 -2
  348. package/resources/index.d.ts.map +1 -1
  349. package/resources/index.js.map +1 -1
  350. package/resources/index.mjs.map +1 -1
  351. package/resources/messages/batches.d.mts +68 -6
  352. package/resources/messages/batches.d.mts.map +1 -1
  353. package/resources/messages/batches.d.ts +68 -6
  354. package/resources/messages/batches.d.ts.map +1 -1
  355. package/resources/messages/batches.js +52 -13
  356. package/resources/messages/batches.js.map +1 -1
  357. package/resources/messages/batches.mjs +52 -13
  358. package/resources/messages/batches.mjs.map +1 -1
  359. package/resources/messages/index.d.mts +1 -1
  360. package/resources/messages/index.d.mts.map +1 -1
  361. package/resources/messages/index.d.ts +1 -1
  362. package/resources/messages/index.d.ts.map +1 -1
  363. package/resources/messages/index.js.map +1 -1
  364. package/resources/messages/index.mjs.map +1 -1
  365. package/resources/messages/messages.d.mts +21 -5
  366. package/resources/messages/messages.d.mts.map +1 -1
  367. package/resources/messages/messages.d.ts +21 -5
  368. package/resources/messages/messages.d.ts.map +1 -1
  369. package/resources/messages/messages.js +10 -4
  370. package/resources/messages/messages.js.map +1 -1
  371. package/resources/messages/messages.mjs +10 -4
  372. package/resources/messages/messages.mjs.map +1 -1
  373. package/resources/models.d.mts +31 -0
  374. package/resources/models.d.mts.map +1 -1
  375. package/resources/models.d.ts +31 -0
  376. package/resources/models.d.ts.map +1 -1
  377. package/resources/models.js +23 -4
  378. package/resources/models.js.map +1 -1
  379. package/resources/models.mjs +23 -4
  380. package/resources/models.mjs.map +1 -1
  381. package/resources/skills/index.d.mts +1 -1
  382. package/resources/skills/index.d.mts.map +1 -1
  383. package/resources/skills/index.d.ts +1 -1
  384. package/resources/skills/index.d.ts.map +1 -1
  385. package/resources/skills/index.js.map +1 -1
  386. package/resources/skills/index.mjs.map +1 -1
  387. package/resources/skills/skills.d.mts +75 -10
  388. package/resources/skills/skills.d.mts.map +1 -1
  389. package/resources/skills/skills.d.ts +75 -10
  390. package/resources/skills/skills.d.ts.map +1 -1
  391. package/resources/skills/skills.js +64 -8
  392. package/resources/skills/skills.js.map +1 -1
  393. package/resources/skills/skills.mjs +64 -8
  394. package/resources/skills/skills.mjs.map +1 -1
  395. package/resources/skills/versions.d.mts +75 -5
  396. package/resources/skills/versions.d.mts.map +1 -1
  397. package/resources/skills/versions.d.ts +75 -5
  398. package/resources/skills/versions.d.ts.map +1 -1
  399. package/resources/skills/versions.js +67 -7
  400. package/resources/skills/versions.js.map +1 -1
  401. package/resources/skills/versions.mjs +67 -7
  402. package/resources/skills/versions.mjs.map +1 -1
  403. package/src/client.ts +12 -1
  404. package/src/core/credentials.ts +5 -7
  405. package/src/core/streaming.ts +4 -2
  406. package/src/internal/file-store.ts +11 -10
  407. package/src/internal/node.browser.ts +22 -0
  408. package/src/internal/node.ts +14 -0
  409. package/src/lib/BetaMessageStream.ts +4 -0
  410. package/src/lib/credentials/credential-chain.ts +1 -1
  411. package/src/lib/credentials/identity-token.ts +1 -1
  412. package/src/lib/credentials/types.ts +2 -3
  413. package/src/lib/credentials/user-oauth.ts +1 -1
  414. package/src/lib/middleware.ts +33 -9
  415. package/src/resources/beta/agents/agents.ts +76 -10
  416. package/src/resources/beta/agents/versions.ts +15 -2
  417. package/src/resources/beta/beta.ts +16 -1
  418. package/src/resources/beta/deployment-runs.ts +36 -10
  419. package/src/resources/beta/deployments.ts +123 -18
  420. package/src/resources/beta/dreams.ts +117 -10
  421. package/src/resources/beta/environments/environments.ts +90 -12
  422. package/src/resources/beta/environments/work.ts +60 -8
  423. package/src/resources/beta/files.ts +75 -11
  424. package/src/resources/beta/index.ts +6 -0
  425. package/src/resources/beta/memory-stores/memories.ts +81 -14
  426. package/src/resources/beta/memory-stores/memory-stores.ts +90 -12
  427. package/src/resources/beta/memory-stores/memory-versions.ts +49 -10
  428. package/src/resources/beta/messages/batches.ts +85 -11
  429. package/src/resources/beta/messages/index.ts +4 -0
  430. package/src/resources/beta/messages/messages.ts +173 -10
  431. package/src/resources/beta/models.ts +30 -4
  432. package/src/resources/beta/organization/compliance-settings.ts +106 -0
  433. package/src/resources/beta/organization/external-keys.ts +6 -3
  434. package/src/resources/beta/organization/index.ts +11 -0
  435. package/src/resources/beta/organization/organization.ts +28 -0
  436. package/src/resources/beta/organization/workspaces/workspaces.ts +28 -12
  437. package/src/resources/beta/sessions/events.ts +46 -7
  438. package/src/resources/beta/sessions/resources.ts +75 -10
  439. package/src/resources/beta/sessions/sessions.ts +100 -22
  440. package/src/resources/beta/sessions/threads/events.ts +30 -4
  441. package/src/resources/beta/sessions/threads/threads.ts +45 -6
  442. package/src/resources/beta/skills/skills.ts +60 -8
  443. package/src/resources/beta/skills/versions.ts +72 -9
  444. package/src/resources/beta/tunnels/certificates.ts +60 -8
  445. package/src/resources/beta/tunnels/tunnels.ts +90 -12
  446. package/src/resources/beta/user-profiles.ts +24 -27
  447. package/src/resources/beta/vaults/credentials.ts +105 -14
  448. package/src/resources/beta/vaults/vaults.ts +90 -12
  449. package/src/resources/completions.ts +15 -2
  450. package/src/resources/files.ts +161 -18
  451. package/src/resources/index.ts +5 -0
  452. package/src/resources/messages/batches.ts +137 -13
  453. package/src/resources/messages/index.ts +4 -0
  454. package/src/resources/messages/messages.ts +40 -12
  455. package/src/resources/models.ts +43 -4
  456. package/src/resources/skills/index.ts +2 -0
  457. package/src/resources/skills/skills.ts +127 -13
  458. package/src/resources/skills/versions.ts +115 -11
  459. package/src/tools/agent-toolset/fs-util.ts +22 -9
  460. package/src/tools/agent-toolset/memories.ts +5 -3
  461. package/src/tools/agent-toolset/skills.ts +5 -10
  462. package/src/version.ts +1 -1
  463. package/tools/agent-toolset/fs-util.d.mts +11 -4
  464. package/tools/agent-toolset/fs-util.d.mts.map +1 -1
  465. package/tools/agent-toolset/fs-util.d.ts +11 -4
  466. package/tools/agent-toolset/fs-util.d.ts.map +1 -1
  467. package/tools/agent-toolset/fs-util.js +27 -19
  468. package/tools/agent-toolset/fs-util.js.map +1 -1
  469. package/tools/agent-toolset/fs-util.mjs +17 -8
  470. package/tools/agent-toolset/fs-util.mjs.map +1 -1
  471. package/tools/agent-toolset/memories.d.mts.map +1 -1
  472. package/tools/agent-toolset/memories.d.ts.map +1 -1
  473. package/tools/agent-toolset/memories.js +6 -4
  474. package/tools/agent-toolset/memories.js.map +1 -1
  475. package/tools/agent-toolset/memories.mjs +5 -3
  476. package/tools/agent-toolset/memories.mjs.map +1 -1
  477. package/tools/agent-toolset/skills.d.mts.map +1 -1
  478. package/tools/agent-toolset/skills.d.ts.map +1 -1
  479. package/tools/agent-toolset/skills.js +15 -21
  480. package/tools/agent-toolset/skills.js.map +1 -1
  481. package/tools/agent-toolset/skills.mjs +4 -9
  482. package/tools/agent-toolset/skills.mjs.map +1 -1
  483. package/version.d.mts +1 -1
  484. package/version.d.ts +1 -1
  485. package/version.js +1 -1
  486. package/version.mjs +1 -1
@@ -14,17 +14,25 @@ export class Models extends APIResource {
14
14
  *
15
15
  * The Models API response can be used to determine information about a specific
16
16
  * model or resolve a model alias to a model ID.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const modelInfo = await client.models.retrieve('model_id');
21
+ * ```
17
22
  */
18
23
  retrieve(
19
24
  modelID: string,
20
25
  params: ModelRetrieveParams | null | undefined = {},
21
26
  options?: RequestOptions,
22
27
  ): APIPromise<ModelInfo> {
23
- const { betas } = params ?? {};
28
+ const { betas, workspace_id } = params ?? {};
24
29
  return this._client.get(path`/v1/models/${modelID}`, {
25
30
  ...options,
26
31
  headers: buildHeaders([
27
- { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
32
+ {
33
+ ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined),
34
+ ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined),
35
+ },
28
36
  options?.headers,
29
37
  ]),
30
38
  });
@@ -35,17 +43,28 @@ export class Models extends APIResource {
35
43
  *
36
44
  * The Models API response can be used to determine which models are available for
37
45
  * use in the API. More recently released models are listed first.
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * // Automatically fetches more pages as needed.
50
+ * for await (const modelInfo of client.models.list()) {
51
+ * // ...
52
+ * }
53
+ * ```
38
54
  */
39
55
  list(
40
56
  params: ModelListParams | null | undefined = {},
41
57
  options?: RequestOptions,
42
58
  ): PagePromise<ModelInfosPage, ModelInfo> {
43
- const { betas, ...query } = params ?? {};
59
+ const { betas, workspace_id, ...query } = params ?? {};
44
60
  return this._client.getAPIList('/v1/models', Page<ModelInfo>, {
45
61
  query,
46
62
  ...options,
47
63
  headers: buildHeaders([
48
- { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
64
+ {
65
+ ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined),
66
+ ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined),
67
+ },
49
68
  options?.headers,
50
69
  ]),
51
70
  });
@@ -249,6 +268,16 @@ export interface ModelRetrieveParams {
249
268
  * Optional header to specify the beta version(s) you want to use.
250
269
  */
251
270
  betas?: Array<BetaAPI.AnthropicBeta>;
271
+
272
+ /**
273
+ * Optional header to select the Workspace for this request. The value is a
274
+ * Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
275
+ *
276
+ * Only needed for credentials that can act on more than one Workspace. A
277
+ * credential that belongs to a specific Workspace may omit it; if sent, it must
278
+ * match that Workspace.
279
+ */
280
+ workspace_id?: string;
252
281
  }
253
282
 
254
283
  export interface ModelListParams extends PageParams {
@@ -256,6 +285,16 @@ export interface ModelListParams extends PageParams {
256
285
  * Header param: Optional header to specify the beta version(s) you want to use.
257
286
  */
258
287
  betas?: Array<BetaAPI.AnthropicBeta>;
288
+
289
+ /**
290
+ * Header param: Optional header to select the Workspace for this request. The
291
+ * value is a Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
292
+ *
293
+ * Only needed for credentials that can act on more than one Workspace. A
294
+ * credential that belongs to a specific Workspace may omit it; if sent, it must
295
+ * match that Workspace.
296
+ */
297
+ workspace_id?: string;
259
298
  }
260
299
 
261
300
  export declare namespace Models {
@@ -6,7 +6,9 @@ export {
6
6
  type Skill,
7
7
  type SkillSource,
8
8
  type SkillCreateParams,
9
+ type SkillRetrieveParams,
9
10
  type SkillListParams,
11
+ type SkillDeleteParams,
10
12
  type SkillsPageCursor,
11
13
  } from './skills';
12
14
  export {
@@ -15,6 +15,7 @@ import {
15
15
  import { APIPromise } from '../../core/api-promise';
16
16
  import { PageCursor, type PageCursorParams, PagePromise } from '../../core/pagination';
17
17
  import { type Uploadable } from '../../core/uploads';
18
+ import { buildHeaders } from '../../internal/headers';
18
19
  import { RequestOptions } from '../../internal/request-options';
19
20
  import { multipartFormRequestOptions } from '../../internal/uploads';
20
21
  import { path } from '../../internal/utils/path';
@@ -24,36 +25,103 @@ export class Skills extends APIResource {
24
25
 
25
26
  /**
26
27
  * Create Skill
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * const skill = await client.skills.create({
32
+ * files: [fs.createReadStream('path/to/file')],
33
+ * });
34
+ * ```
27
35
  */
28
- create(body: SkillCreateParams, options?: RequestOptions): APIPromise<Skill> {
36
+ create(params: SkillCreateParams, options?: RequestOptions): APIPromise<Skill> {
37
+ const { workspace_id, ...body } = params;
29
38
  return this._client.post(
30
39
  '/v1/skills',
31
- multipartFormRequestOptions({ body, ...options }, this._client, false),
40
+ multipartFormRequestOptions(
41
+ {
42
+ body,
43
+ ...options,
44
+ headers: buildHeaders([
45
+ { ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined) },
46
+ options?.headers,
47
+ ]),
48
+ },
49
+ this._client,
50
+ false,
51
+ ),
32
52
  );
33
53
  }
34
54
 
35
55
  /**
36
56
  * Get Skill
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * const skill = await client.skills.retrieve('skill_id');
61
+ * ```
37
62
  */
38
- retrieve(skillID: string, options?: RequestOptions): APIPromise<Skill> {
39
- return this._client.get(path`/v1/skills/${skillID}`, options);
63
+ retrieve(
64
+ skillID: string,
65
+ params: SkillRetrieveParams | null | undefined = {},
66
+ options?: RequestOptions,
67
+ ): APIPromise<Skill> {
68
+ const { workspace_id } = params ?? {};
69
+ return this._client.get(path`/v1/skills/${skillID}`, {
70
+ ...options,
71
+ headers: buildHeaders([
72
+ { ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined) },
73
+ options?.headers,
74
+ ]),
75
+ });
40
76
  }
41
77
 
42
78
  /**
43
79
  * List Skills
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * // Automatically fetches more pages as needed.
84
+ * for await (const skill of client.skills.list()) {
85
+ * // ...
86
+ * }
87
+ * ```
44
88
  */
45
89
  list(
46
- query: SkillListParams | null | undefined = {},
90
+ params: SkillListParams | null | undefined = {},
47
91
  options?: RequestOptions,
48
92
  ): PagePromise<SkillsPageCursor, Skill> {
49
- return this._client.getAPIList('/v1/skills', PageCursor<Skill>, { query, ...options });
93
+ const { workspace_id, ...query } = params ?? {};
94
+ return this._client.getAPIList('/v1/skills', PageCursor<Skill>, {
95
+ query,
96
+ ...options,
97
+ headers: buildHeaders([
98
+ { ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined) },
99
+ options?.headers,
100
+ ]),
101
+ });
50
102
  }
51
103
 
52
104
  /**
53
105
  * Delete Skill
106
+ *
107
+ * @example
108
+ * ```ts
109
+ * const deletedSkill = await client.skills.delete('skill_id');
110
+ * ```
54
111
  */
55
- delete(skillID: string, options?: RequestOptions): APIPromise<DeletedSkill> {
56
- return this._client.delete(path`/v1/skills/${skillID}`, options);
112
+ delete(
113
+ skillID: string,
114
+ params: SkillDeleteParams | null | undefined = {},
115
+ options?: RequestOptions,
116
+ ): APIPromise<DeletedSkill> {
117
+ const { workspace_id } = params ?? {};
118
+ return this._client.delete(path`/v1/skills/${skillID}`, {
119
+ ...options,
120
+ headers: buildHeaders([
121
+ { ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined) },
122
+ options?.headers,
123
+ ]),
124
+ });
57
125
  }
58
126
  }
59
127
 
@@ -142,7 +210,7 @@ export interface SkillSource {
142
210
 
143
211
  export interface SkillCreateParams {
144
212
  /**
145
- * Files to upload for the skill.
213
+ * Body param: Files to upload for the skill.
146
214
  *
147
215
  * All files must be in the same top-level directory and must include a SKILL.md
148
216
  * file at the root of that directory.
@@ -150,16 +218,38 @@ export interface SkillCreateParams {
150
218
  files: Array<Uploadable>;
151
219
 
152
220
  /**
153
- * Human-readable, single-line label for the Skill. Maximum 255 characters. Always
154
- * set: derived from the SKILL.md frontmatter `name` when omitted at creation. Not
155
- * unique.
221
+ * Body param: Human-readable, single-line label for the Skill. Maximum 255
222
+ * characters. Always set: derived from the SKILL.md frontmatter `name` when
223
+ * omitted at creation. Not unique.
156
224
  */
157
225
  display_name?: string | null;
226
+
227
+ /**
228
+ * Header param: Optional header to select the Workspace for this request. The
229
+ * value is a Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
230
+ *
231
+ * Only needed for credentials that can act on more than one Workspace. A
232
+ * credential that belongs to a specific Workspace may omit it; if sent, it must
233
+ * match that Workspace.
234
+ */
235
+ workspace_id?: string;
236
+ }
237
+
238
+ export interface SkillRetrieveParams {
239
+ /**
240
+ * Optional header to select the Workspace for this request. The value is a
241
+ * Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
242
+ *
243
+ * Only needed for credentials that can act on more than one Workspace. A
244
+ * credential that belongs to a specific Workspace may omit it; if sent, it must
245
+ * match that Workspace.
246
+ */
247
+ workspace_id?: string;
158
248
  }
159
249
 
160
250
  export interface SkillListParams extends PageCursorParams {
161
251
  /**
162
- * Filter skills by source.
252
+ * Query param: Filter skills by source.
163
253
  *
164
254
  * If provided, only skills from the specified source will be returned:
165
255
  *
@@ -167,6 +257,28 @@ export interface SkillListParams extends PageCursorParams {
167
257
  * - `"anthropic"`: only return Anthropic-created skills
168
258
  */
169
259
  source?: string | null;
260
+
261
+ /**
262
+ * Header param: Optional header to select the Workspace for this request. The
263
+ * value is a Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
264
+ *
265
+ * Only needed for credentials that can act on more than one Workspace. A
266
+ * credential that belongs to a specific Workspace may omit it; if sent, it must
267
+ * match that Workspace.
268
+ */
269
+ workspace_id?: string;
270
+ }
271
+
272
+ export interface SkillDeleteParams {
273
+ /**
274
+ * Optional header to select the Workspace for this request. The value is a
275
+ * Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
276
+ *
277
+ * Only needed for credentials that can act on more than one Workspace. A
278
+ * credential that belongs to a specific Workspace may omit it; if sent, it must
279
+ * match that Workspace.
280
+ */
281
+ workspace_id?: string;
170
282
  }
171
283
 
172
284
  Skills.Versions = Versions;
@@ -178,7 +290,9 @@ export declare namespace Skills {
178
290
  type SkillSource as SkillSource,
179
291
  type SkillsPageCursor as SkillsPageCursor,
180
292
  type SkillCreateParams as SkillCreateParams,
293
+ type SkillRetrieveParams as SkillRetrieveParams,
181
294
  type SkillListParams as SkillListParams,
295
+ type SkillDeleteParams as SkillDeleteParams,
182
296
  };
183
297
 
184
298
  export {
@@ -4,6 +4,7 @@ import { APIResource } from '../../core/resource';
4
4
  import { APIPromise } from '../../core/api-promise';
5
5
  import { PageCursor, type PageCursorParams, PagePromise } from '../../core/pagination';
6
6
  import { type Uploadable } from '../../core/uploads';
7
+ import { buildHeaders } from '../../internal/headers';
7
8
  import { RequestOptions } from '../../internal/request-options';
8
9
  import { multipartFormRequestOptions } from '../../internal/uploads';
9
10
  import { path } from '../../internal/utils/path';
@@ -11,50 +12,113 @@ import { path } from '../../internal/utils/path';
11
12
  export class Versions extends APIResource {
12
13
  /**
13
14
  * Create Skill Version
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const skillVersion = await client.skills.versions.create(
19
+ * 'skill_id',
20
+ * { files: [fs.createReadStream('path/to/file')] },
21
+ * );
22
+ * ```
14
23
  */
15
- create(skillID: string, body: VersionCreateParams, options?: RequestOptions): APIPromise<SkillVersion> {
24
+ create(skillID: string, params: VersionCreateParams, options?: RequestOptions): APIPromise<SkillVersion> {
25
+ const { workspace_id, ...body } = params;
16
26
  return this._client.post(
17
27
  path`/v1/skills/${skillID}/versions`,
18
- multipartFormRequestOptions({ body, ...options }, this._client, false),
28
+ multipartFormRequestOptions(
29
+ {
30
+ body,
31
+ ...options,
32
+ headers: buildHeaders([
33
+ { ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined) },
34
+ options?.headers,
35
+ ]),
36
+ },
37
+ this._client,
38
+ false,
39
+ ),
19
40
  );
20
41
  }
21
42
 
22
43
  /**
23
44
  * Get Skill Version
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * const skillVersion = await client.skills.versions.retrieve(
49
+ * 'version',
50
+ * { skill_id: 'skill_id' },
51
+ * );
52
+ * ```
24
53
  */
25
54
  retrieve(
26
55
  version: string,
27
56
  params: VersionRetrieveParams,
28
57
  options?: RequestOptions,
29
58
  ): APIPromise<SkillVersion> {
30
- const { skill_id } = params;
31
- return this._client.get(path`/v1/skills/${skill_id}/versions/${version}`, options);
59
+ const { skill_id, workspace_id } = params;
60
+ return this._client.get(path`/v1/skills/${skill_id}/versions/${version}`, {
61
+ ...options,
62
+ headers: buildHeaders([
63
+ { ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined) },
64
+ options?.headers,
65
+ ]),
66
+ });
32
67
  }
33
68
 
34
69
  /**
35
70
  * List Skill Versions
71
+ *
72
+ * @example
73
+ * ```ts
74
+ * // Automatically fetches more pages as needed.
75
+ * for await (const skillVersion of client.skills.versions.list(
76
+ * 'skill_id',
77
+ * )) {
78
+ * // ...
79
+ * }
80
+ * ```
36
81
  */
37
82
  list(
38
83
  skillID: string,
39
- query: VersionListParams | null | undefined = {},
84
+ params: VersionListParams | null | undefined = {},
40
85
  options?: RequestOptions,
41
86
  ): PagePromise<SkillVersionsPageCursor, SkillVersion> {
87
+ const { workspace_id, ...query } = params ?? {};
42
88
  return this._client.getAPIList(path`/v1/skills/${skillID}/versions`, PageCursor<SkillVersion>, {
43
89
  query,
44
90
  ...options,
91
+ headers: buildHeaders([
92
+ { ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined) },
93
+ options?.headers,
94
+ ]),
45
95
  });
46
96
  }
47
97
 
48
98
  /**
49
99
  * Delete Skill Version
100
+ *
101
+ * @example
102
+ * ```ts
103
+ * const deletedSkillVersion =
104
+ * await client.skills.versions.delete('version', {
105
+ * skill_id: 'skill_id',
106
+ * });
107
+ * ```
50
108
  */
51
109
  delete(
52
110
  version: string,
53
111
  params: VersionDeleteParams,
54
112
  options?: RequestOptions,
55
113
  ): APIPromise<DeletedSkillVersion> {
56
- const { skill_id } = params;
57
- return this._client.delete(path`/v1/skills/${skill_id}/versions/${version}`, options);
114
+ const { skill_id, workspace_id } = params;
115
+ return this._client.delete(path`/v1/skills/${skill_id}/versions/${version}`, {
116
+ ...options,
117
+ headers: buildHeaders([
118
+ { ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined) },
119
+ options?.headers,
120
+ ]),
121
+ });
58
122
  }
59
123
  }
60
124
 
@@ -119,32 +183,72 @@ export interface SkillVersion {
119
183
 
120
184
  export interface VersionCreateParams {
121
185
  /**
122
- * Files to upload for the skill.
186
+ * Body param: Files to upload for the skill.
123
187
  *
124
188
  * All files must be in the same top-level directory and must include a SKILL.md
125
189
  * file at the root of that directory.
126
190
  */
127
191
  files: Array<Uploadable>;
192
+
193
+ /**
194
+ * Header param: Optional header to select the Workspace for this request. The
195
+ * value is a Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
196
+ *
197
+ * Only needed for credentials that can act on more than one Workspace. A
198
+ * credential that belongs to a specific Workspace may omit it; if sent, it must
199
+ * match that Workspace.
200
+ */
201
+ workspace_id?: string;
128
202
  }
129
203
 
130
204
  export interface VersionRetrieveParams {
131
205
  /**
132
- * Unique identifier for the skill.
206
+ * Path param: Unique identifier for the skill.
133
207
  *
134
208
  * The format and length of IDs may change over time.
135
209
  */
136
210
  skill_id: string;
211
+
212
+ /**
213
+ * Header param: Optional header to select the Workspace for this request. The
214
+ * value is a Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
215
+ *
216
+ * Only needed for credentials that can act on more than one Workspace. A
217
+ * credential that belongs to a specific Workspace may omit it; if sent, it must
218
+ * match that Workspace.
219
+ */
220
+ workspace_id?: string;
137
221
  }
138
222
 
139
- export interface VersionListParams extends PageCursorParams {}
223
+ export interface VersionListParams extends PageCursorParams {
224
+ /**
225
+ * Header param: Optional header to select the Workspace for this request. The
226
+ * value is a Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
227
+ *
228
+ * Only needed for credentials that can act on more than one Workspace. A
229
+ * credential that belongs to a specific Workspace may omit it; if sent, it must
230
+ * match that Workspace.
231
+ */
232
+ workspace_id?: string;
233
+ }
140
234
 
141
235
  export interface VersionDeleteParams {
142
236
  /**
143
- * Unique identifier for the skill.
237
+ * Path param: Unique identifier for the skill.
144
238
  *
145
239
  * The format and length of IDs may change over time.
146
240
  */
147
241
  skill_id: string;
242
+
243
+ /**
244
+ * Header param: Optional header to select the Workspace for this request. The
245
+ * value is a Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
246
+ *
247
+ * Only needed for credentials that can act on more than one Workspace. A
248
+ * credential that belongs to a specific Workspace may omit it; if sent, it must
249
+ * match that Workspace.
250
+ */
251
+ workspace_id?: string;
148
252
  }
149
253
 
150
254
  export declare namespace Versions {
@@ -5,15 +5,19 @@
5
5
  * and these helpers can be reused by every file tool.
6
6
  */
7
7
 
8
- import * as fs from 'node:fs/promises';
9
- import * as path from 'node:path';
10
- import { randomUUID } from 'node:crypto';
8
+ import type { FileHandle } from 'node:fs/promises';
9
+ import { crypto, fs as nodefs, path } from '../../internal/node';
11
10
  import { ToolError } from '../../lib/tools/ToolError';
12
11
 
13
- /** Mode for directories the file tools create — not world-writable under a 0 umask. */
14
- export const DIR_CREATE_MODE = 0o755;
15
- /** Mode for files the file tools create. */
16
- export const FILE_CREATE_MODE = 0o644;
12
+ const fs = nodefs.promises;
13
+
14
+ /** Mode for directories the file tools create: owner-only under any umask, like the memory tool. */
15
+ export const DIR_CREATE_MODE = 0o700;
16
+ /**
17
+ * Mode for files the file tools create: owner-only, so other local users can't
18
+ * read what an agent wrote. A file that already exists keeps its own mode.
19
+ */
20
+ export const FILE_CREATE_MODE = 0o600;
17
21
 
18
22
  /** True when `p` is `root` itself or lexically contained within it. */
19
23
  export function isWithin(root: string, p: string): boolean {
@@ -137,13 +141,22 @@ export async function confineToRoot(
137
141
  * Atomically write `content` to `targetPath`: write a sibling temp file, fsync
138
142
  * it, then rename over the target. The rename is atomic on most filesystems, so
139
143
  * a crash mid-write never leaves the target half-written.
144
+ *
145
+ * A new file is created {@link FILE_CREATE_MODE}; an existing one keeps its
146
+ * permission bits (the rename replaces the inode, so they are copied onto the
147
+ * temp file first) — an edit must not strip `+x` or sharing the owner chose.
140
148
  */
141
149
  export async function atomicWriteFile(targetPath: string, content: string): Promise<void> {
142
150
  const dir = path.dirname(targetPath);
143
- const tempPath = path.join(dir, `.tmp-${process.pid}-${randomUUID()}`);
144
- let handle: fs.FileHandle | undefined;
151
+ const tempPath = path.join(dir, `.tmp-${process.pid}-${crypto.randomUUID()}`);
152
+ const existingMode = await fs.stat(targetPath).then(
153
+ (st) => st.mode & 0o777,
154
+ () => undefined,
155
+ );
156
+ let handle: FileHandle | undefined;
145
157
  try {
146
158
  handle = await fs.open(tempPath, 'wx', FILE_CREATE_MODE);
159
+ if (existingMode !== undefined) await handle.chmod(existingMode);
147
160
  await handle.writeFile(content, 'utf-8');
148
161
  await handle.sync();
149
162
  await handle.close();
@@ -10,8 +10,7 @@
10
10
  * it is reachable through the shimmed `node.ts` entry point.
11
11
  */
12
12
 
13
- import * as path from 'node:path';
14
- import { createHash } from 'node:crypto';
13
+ import { crypto, path } from '../../internal/node';
15
14
  import type { Anthropic } from '../../client';
16
15
  import { AnthropicError } from '../../core/error';
17
16
  import { loggerFor, type Logger } from '../../internal/utils/log';
@@ -51,7 +50,10 @@ export const MARKER_PATH = '.anthropic-memory-store';
51
50
  const MARKER_VERSION = 1;
52
51
 
53
52
  function markerSha(memoryStoreId: string): string {
54
- return createHash('sha256').update(`version ${MARKER_VERSION}\n${memoryStoreId}`, 'utf-8').digest('hex');
53
+ return crypto
54
+ .createHash('sha256')
55
+ .update(`version ${MARKER_VERSION}\n${memoryStoreId}`, 'utf-8')
56
+ .digest('hex');
55
57
  }
56
58
 
57
59
  /** How long a file must stay missing locally before its server delete goes out. */
@@ -5,19 +5,14 @@
5
5
  * `node.ts` — distinct enough, and large enough, to review on its own.
6
6
  */
7
7
 
8
- import * as fs from 'node:fs/promises';
9
- import * as fssync from 'node:fs';
10
- import * as path from 'node:path';
11
- import { execFile } from 'node:child_process';
12
- import { promisify } from 'node:util';
13
- import { Readable } from 'node:stream';
14
- import { pipeline } from 'node:stream/promises';
8
+ import { child_process, fs as fssync, path, stream, util } from '../../internal/node';
15
9
  import { AnthropicError } from '../../core/error';
16
10
  import { loggerFor } from '../../internal/utils/log';
17
11
  import { DIR_CREATE_MODE, errnoCode } from './fs-util';
18
12
  import type { AgentToolContext } from './node';
19
13
 
20
- const execFileAsync = promisify(execFile);
14
+ const fs = fssync.promises;
15
+ const execFileAsync = util.promisify(child_process.execFile);
21
16
 
22
17
  /**
23
18
  * Download the session agent's skills into `{ctx.workdir}/skills/<name>/`.
@@ -265,8 +260,8 @@ export async function extractSkillArchive(resp: Response, dest: string): Promise
265
260
  if (!resp.body) {
266
261
  throw new AnthropicError('skill download response had no body');
267
262
  }
268
- await pipeline(
269
- Readable.fromWeb(resp.body as Parameters<typeof Readable.fromWeb>[0]),
263
+ await stream.promises.pipeline(
264
+ stream.Readable.fromWeb(resp.body as Parameters<typeof stream.Readable.fromWeb>[0]),
270
265
  fssync.createWriteStream(tmp),
271
266
  );
272
267
  const stage = path.join(path.dirname(dest), `.skill-stage-${process.pid}-${Date.now()}`);
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.122.0'; // x-release-please-version
1
+ export const VERSION = '0.124.0'; // x-release-please-version
@@ -4,10 +4,13 @@
4
4
  * error messages. Kept out of `node.ts` so the tool implementations stay focused
5
5
  * and these helpers can be reused by every file tool.
6
6
  */
7
- /** Mode for directories the file tools create — not world-writable under a 0 umask. */
8
- export declare const DIR_CREATE_MODE = 493;
9
- /** Mode for files the file tools create. */
10
- export declare const FILE_CREATE_MODE = 420;
7
+ /** Mode for directories the file tools create: owner-only under any umask, like the memory tool. */
8
+ export declare const DIR_CREATE_MODE = 448;
9
+ /**
10
+ * Mode for files the file tools create: owner-only, so other local users can't
11
+ * read what an agent wrote. A file that already exists keeps its own mode.
12
+ */
13
+ export declare const FILE_CREATE_MODE = 384;
11
14
  /** True when `p` is `root` itself or lexically contained within it. */
12
15
  export declare function isWithin(root: string, p: string): boolean;
13
16
  /**
@@ -62,6 +65,10 @@ export declare function confineToRoot(root: string, p: string, opts?: {
62
65
  * Atomically write `content` to `targetPath`: write a sibling temp file, fsync
63
66
  * it, then rename over the target. The rename is atomic on most filesystems, so
64
67
  * a crash mid-write never leaves the target half-written.
68
+ *
69
+ * A new file is created {@link FILE_CREATE_MODE}; an existing one keeps its
70
+ * permission bits (the rename replaces the inode, so they are copied onto the
71
+ * temp file first) — an edit must not strip `+x` or sharing the owner chose.
65
72
  */
66
73
  export declare function atomicWriteFile(targetPath: string, content: string): Promise<void>;
67
74
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"fs-util.d.mts","sourceRoot":"","sources":["../../src/tools/agent-toolset/fs-util.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,uFAAuF;AACvF,eAAO,MAAM,eAAe,MAAQ,CAAC;AACrC,4CAA4C;AAC5C,eAAO,MAAM,gBAAgB,MAAQ,CAAC;AAEtC,uEAAuE;AACvE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAGzD;AAED;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAK1G;AAKD,2EAA2E;AAC3E,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAG1D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA8B/D;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,CAAC,EAAE,MAAM,EACT,IAAI,CAAC,EAAE;IAAE,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAC1C,OAAO,CAAC,MAAM,CAAC,CAiBjB;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBxF;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAwBjE"}
1
+ {"version":3,"file":"fs-util.d.mts","sourceRoot":"","sources":["../../src/tools/agent-toolset/fs-util.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,oGAAoG;AACpG,eAAO,MAAM,eAAe,MAAQ,CAAC;AACrC;;;GAGG;AACH,eAAO,MAAM,gBAAgB,MAAQ,CAAC;AAEtC,uEAAuE;AACvE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAGzD;AAED;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAK1G;AAKD,2EAA2E;AAC3E,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAG1D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA8B/D;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,CAAC,EAAE,MAAM,EACT,IAAI,CAAC,EAAE;IAAE,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAC1C,OAAO,CAAC,MAAM,CAAC,CAiBjB;AAED;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBxF;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAwBjE"}