@anthropic-ai/claude-code 0.2.29 → 0.2.30

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 (415) hide show
  1. package/cli.mjs +442 -690
  2. package/package.json +1 -5
  3. package/vendor/sdk/CHANGELOG.md +0 -1421
  4. package/vendor/sdk/LICENSE +0 -8
  5. package/vendor/sdk/README.md +0 -536
  6. package/vendor/sdk/_shims/MultipartBody.d.ts +0 -9
  7. package/vendor/sdk/_shims/MultipartBody.d.ts.map +0 -1
  8. package/vendor/sdk/_shims/MultipartBody.js +0 -16
  9. package/vendor/sdk/_shims/MultipartBody.js.map +0 -1
  10. package/vendor/sdk/_shims/MultipartBody.mjs +0 -12
  11. package/vendor/sdk/_shims/MultipartBody.mjs.map +0 -1
  12. package/vendor/sdk/_shims/README.md +0 -46
  13. package/vendor/sdk/_shims/auto/runtime-bun.d.ts +0 -5
  14. package/vendor/sdk/_shims/auto/runtime-bun.d.ts.map +0 -1
  15. package/vendor/sdk/_shims/auto/runtime-bun.js +0 -21
  16. package/vendor/sdk/_shims/auto/runtime-bun.js.map +0 -1
  17. package/vendor/sdk/_shims/auto/runtime-bun.mjs +0 -2
  18. package/vendor/sdk/_shims/auto/runtime-bun.mjs.map +0 -1
  19. package/vendor/sdk/_shims/auto/runtime-node.d.ts +0 -5
  20. package/vendor/sdk/_shims/auto/runtime-node.d.ts.map +0 -1
  21. package/vendor/sdk/_shims/auto/runtime-node.js +0 -21
  22. package/vendor/sdk/_shims/auto/runtime-node.js.map +0 -1
  23. package/vendor/sdk/_shims/auto/runtime-node.mjs +0 -2
  24. package/vendor/sdk/_shims/auto/runtime-node.mjs.map +0 -1
  25. package/vendor/sdk/_shims/auto/runtime.d.ts +0 -5
  26. package/vendor/sdk/_shims/auto/runtime.d.ts.map +0 -1
  27. package/vendor/sdk/_shims/auto/runtime.js +0 -21
  28. package/vendor/sdk/_shims/auto/runtime.js.map +0 -1
  29. package/vendor/sdk/_shims/auto/runtime.mjs +0 -2
  30. package/vendor/sdk/_shims/auto/runtime.mjs.map +0 -1
  31. package/vendor/sdk/_shims/auto/types-node.d.ts +0 -5
  32. package/vendor/sdk/_shims/auto/types-node.d.ts.map +0 -1
  33. package/vendor/sdk/_shims/auto/types-node.js +0 -21
  34. package/vendor/sdk/_shims/auto/types-node.js.map +0 -1
  35. package/vendor/sdk/_shims/auto/types-node.mjs +0 -2
  36. package/vendor/sdk/_shims/auto/types-node.mjs.map +0 -1
  37. package/vendor/sdk/_shims/auto/types.d.ts +0 -101
  38. package/vendor/sdk/_shims/auto/types.js +0 -3
  39. package/vendor/sdk/_shims/auto/types.mjs +0 -3
  40. package/vendor/sdk/_shims/bun-runtime.d.ts +0 -6
  41. package/vendor/sdk/_shims/bun-runtime.d.ts.map +0 -1
  42. package/vendor/sdk/_shims/bun-runtime.js +0 -14
  43. package/vendor/sdk/_shims/bun-runtime.js.map +0 -1
  44. package/vendor/sdk/_shims/bun-runtime.mjs +0 -10
  45. package/vendor/sdk/_shims/bun-runtime.mjs.map +0 -1
  46. package/vendor/sdk/_shims/index.d.ts +0 -81
  47. package/vendor/sdk/_shims/index.js +0 -13
  48. package/vendor/sdk/_shims/index.mjs +0 -7
  49. package/vendor/sdk/_shims/manual-types.d.ts +0 -12
  50. package/vendor/sdk/_shims/manual-types.js +0 -3
  51. package/vendor/sdk/_shims/manual-types.mjs +0 -3
  52. package/vendor/sdk/_shims/node-runtime.d.ts +0 -3
  53. package/vendor/sdk/_shims/node-runtime.d.ts.map +0 -1
  54. package/vendor/sdk/_shims/node-runtime.js +0 -89
  55. package/vendor/sdk/_shims/node-runtime.js.map +0 -1
  56. package/vendor/sdk/_shims/node-runtime.mjs +0 -56
  57. package/vendor/sdk/_shims/node-runtime.mjs.map +0 -1
  58. package/vendor/sdk/_shims/node-types.d.ts +0 -42
  59. package/vendor/sdk/_shims/node-types.js +0 -3
  60. package/vendor/sdk/_shims/node-types.mjs +0 -3
  61. package/vendor/sdk/_shims/registry.d.ts +0 -37
  62. package/vendor/sdk/_shims/registry.d.ts.map +0 -1
  63. package/vendor/sdk/_shims/registry.js +0 -41
  64. package/vendor/sdk/_shims/registry.js.map +0 -1
  65. package/vendor/sdk/_shims/registry.mjs +0 -37
  66. package/vendor/sdk/_shims/registry.mjs.map +0 -1
  67. package/vendor/sdk/_shims/web-runtime.d.ts +0 -5
  68. package/vendor/sdk/_shims/web-runtime.d.ts.map +0 -1
  69. package/vendor/sdk/_shims/web-runtime.js +0 -78
  70. package/vendor/sdk/_shims/web-runtime.js.map +0 -1
  71. package/vendor/sdk/_shims/web-runtime.mjs +0 -71
  72. package/vendor/sdk/_shims/web-runtime.mjs.map +0 -1
  73. package/vendor/sdk/_shims/web-types.d.ts +0 -83
  74. package/vendor/sdk/_shims/web-types.js +0 -3
  75. package/vendor/sdk/_shims/web-types.mjs +0 -3
  76. package/vendor/sdk/_vendor/partial-json-parser/parser.d.ts +0 -3
  77. package/vendor/sdk/_vendor/partial-json-parser/parser.d.ts.map +0 -1
  78. package/vendor/sdk/_vendor/partial-json-parser/parser.js +0 -226
  79. package/vendor/sdk/_vendor/partial-json-parser/parser.js.map +0 -1
  80. package/vendor/sdk/_vendor/partial-json-parser/parser.mjs +0 -223
  81. package/vendor/sdk/_vendor/partial-json-parser/parser.mjs.map +0 -1
  82. package/vendor/sdk/core.d.ts +0 -248
  83. package/vendor/sdk/core.d.ts.map +0 -1
  84. package/vendor/sdk/core.js +0 -935
  85. package/vendor/sdk/core.js.map +0 -1
  86. package/vendor/sdk/core.mjs +0 -903
  87. package/vendor/sdk/core.mjs.map +0 -1
  88. package/vendor/sdk/error.d.ts +0 -48
  89. package/vendor/sdk/error.d.ts.map +0 -1
  90. package/vendor/sdk/error.js +0 -114
  91. package/vendor/sdk/error.js.map +0 -1
  92. package/vendor/sdk/error.mjs +0 -98
  93. package/vendor/sdk/error.mjs.map +0 -1
  94. package/vendor/sdk/index.d.mts +0 -152
  95. package/vendor/sdk/index.d.ts +0 -152
  96. package/vendor/sdk/index.d.ts.map +0 -1
  97. package/vendor/sdk/index.js +0 -179
  98. package/vendor/sdk/index.js.map +0 -1
  99. package/vendor/sdk/index.mjs +0 -136
  100. package/vendor/sdk/index.mjs.map +0 -1
  101. package/vendor/sdk/internal/decoders/jsonl.d.ts +0 -12
  102. package/vendor/sdk/internal/decoders/jsonl.d.ts.map +0 -1
  103. package/vendor/sdk/internal/decoders/jsonl.js +0 -35
  104. package/vendor/sdk/internal/decoders/jsonl.js.map +0 -1
  105. package/vendor/sdk/internal/decoders/jsonl.mjs +0 -31
  106. package/vendor/sdk/internal/decoders/jsonl.mjs.map +0 -1
  107. package/vendor/sdk/internal/decoders/line.d.ts +0 -20
  108. package/vendor/sdk/internal/decoders/line.d.ts.map +0 -1
  109. package/vendor/sdk/internal/decoders/line.js +0 -123
  110. package/vendor/sdk/internal/decoders/line.js.map +0 -1
  111. package/vendor/sdk/internal/decoders/line.mjs +0 -119
  112. package/vendor/sdk/internal/decoders/line.mjs.map +0 -1
  113. package/vendor/sdk/internal/stream-utils.d.ts +0 -8
  114. package/vendor/sdk/internal/stream-utils.d.ts.map +0 -1
  115. package/vendor/sdk/internal/stream-utils.js +0 -39
  116. package/vendor/sdk/internal/stream-utils.js.map +0 -1
  117. package/vendor/sdk/internal/stream-utils.mjs +0 -35
  118. package/vendor/sdk/internal/stream-utils.mjs.map +0 -1
  119. package/vendor/sdk/lib/BetaMessageStream.d.ts +0 -114
  120. package/vendor/sdk/lib/BetaMessageStream.d.ts.map +0 -1
  121. package/vendor/sdk/lib/BetaMessageStream.js +0 -547
  122. package/vendor/sdk/lib/BetaMessageStream.js.map +0 -1
  123. package/vendor/sdk/lib/BetaMessageStream.mjs +0 -543
  124. package/vendor/sdk/lib/BetaMessageStream.mjs.map +0 -1
  125. package/vendor/sdk/lib/MessageStream.d.ts +0 -114
  126. package/vendor/sdk/lib/MessageStream.d.ts.map +0 -1
  127. package/vendor/sdk/lib/MessageStream.js +0 -547
  128. package/vendor/sdk/lib/MessageStream.js.map +0 -1
  129. package/vendor/sdk/lib/MessageStream.mjs +0 -543
  130. package/vendor/sdk/lib/MessageStream.mjs.map +0 -1
  131. package/vendor/sdk/node_modules/@types/node/LICENSE +0 -21
  132. package/vendor/sdk/node_modules/@types/node/README.md +0 -15
  133. package/vendor/sdk/node_modules/@types/node/assert/strict.d.ts +0 -8
  134. package/vendor/sdk/node_modules/@types/node/assert.d.ts +0 -985
  135. package/vendor/sdk/node_modules/@types/node/async_hooks.d.ts +0 -522
  136. package/vendor/sdk/node_modules/@types/node/buffer.buffer.d.ts +0 -385
  137. package/vendor/sdk/node_modules/@types/node/buffer.d.ts +0 -1903
  138. package/vendor/sdk/node_modules/@types/node/child_process.d.ts +0 -1549
  139. package/vendor/sdk/node_modules/@types/node/cluster.d.ts +0 -578
  140. package/vendor/sdk/node_modules/@types/node/compatibility/disposable.d.ts +0 -14
  141. package/vendor/sdk/node_modules/@types/node/compatibility/index.d.ts +0 -9
  142. package/vendor/sdk/node_modules/@types/node/compatibility/indexable.d.ts +0 -20
  143. package/vendor/sdk/node_modules/@types/node/compatibility/iterators.d.ts +0 -20
  144. package/vendor/sdk/node_modules/@types/node/console.d.ts +0 -452
  145. package/vendor/sdk/node_modules/@types/node/constants.d.ts +0 -19
  146. package/vendor/sdk/node_modules/@types/node/crypto.d.ts +0 -4453
  147. package/vendor/sdk/node_modules/@types/node/dgram.d.ts +0 -596
  148. package/vendor/sdk/node_modules/@types/node/diagnostics_channel.d.ts +0 -546
  149. package/vendor/sdk/node_modules/@types/node/dns/promises.d.ts +0 -475
  150. package/vendor/sdk/node_modules/@types/node/dns.d.ts +0 -853
  151. package/vendor/sdk/node_modules/@types/node/dom-events.d.ts +0 -124
  152. package/vendor/sdk/node_modules/@types/node/domain.d.ts +0 -170
  153. package/vendor/sdk/node_modules/@types/node/events.d.ts +0 -819
  154. package/vendor/sdk/node_modules/@types/node/fs/promises.d.ts +0 -1205
  155. package/vendor/sdk/node_modules/@types/node/fs.d.ts +0 -4237
  156. package/vendor/sdk/node_modules/@types/node/globals.d.ts +0 -442
  157. package/vendor/sdk/node_modules/@types/node/globals.typedarray.d.ts +0 -21
  158. package/vendor/sdk/node_modules/@types/node/http.d.ts +0 -1839
  159. package/vendor/sdk/node_modules/@types/node/http2.d.ts +0 -2517
  160. package/vendor/sdk/node_modules/@types/node/https.d.ts +0 -544
  161. package/vendor/sdk/node_modules/@types/node/index.d.ts +0 -90
  162. package/vendor/sdk/node_modules/@types/node/inspector.d.ts +0 -2775
  163. package/vendor/sdk/node_modules/@types/node/module.d.ts +0 -291
  164. package/vendor/sdk/node_modules/@types/node/net.d.ts +0 -924
  165. package/vendor/sdk/node_modules/@types/node/os.d.ts +0 -473
  166. package/vendor/sdk/node_modules/@types/node/package.json +0 -225
  167. package/vendor/sdk/node_modules/@types/node/path.d.ts +0 -191
  168. package/vendor/sdk/node_modules/@types/node/perf_hooks.d.ts +0 -753
  169. package/vendor/sdk/node_modules/@types/node/process.d.ts +0 -1553
  170. package/vendor/sdk/node_modules/@types/node/punycode.d.ts +0 -117
  171. package/vendor/sdk/node_modules/@types/node/querystring.d.ts +0 -141
  172. package/vendor/sdk/node_modules/@types/node/readline/promises.d.ts +0 -154
  173. package/vendor/sdk/node_modules/@types/node/readline.d.ts +0 -715
  174. package/vendor/sdk/node_modules/@types/node/repl.d.ts +0 -430
  175. package/vendor/sdk/node_modules/@types/node/stream/consumers.d.ts +0 -12
  176. package/vendor/sdk/node_modules/@types/node/stream/promises.d.ts +0 -90
  177. package/vendor/sdk/node_modules/@types/node/stream/web.d.ts +0 -523
  178. package/vendor/sdk/node_modules/@types/node/stream.d.ts +0 -1731
  179. package/vendor/sdk/node_modules/@types/node/string_decoder.d.ts +0 -67
  180. package/vendor/sdk/node_modules/@types/node/test.d.ts +0 -1245
  181. package/vendor/sdk/node_modules/@types/node/timers/promises.d.ts +0 -93
  182. package/vendor/sdk/node_modules/@types/node/timers.d.ts +0 -126
  183. package/vendor/sdk/node_modules/@types/node/tls.d.ts +0 -1203
  184. package/vendor/sdk/node_modules/@types/node/trace_events.d.ts +0 -171
  185. package/vendor/sdk/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +0 -385
  186. package/vendor/sdk/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -19
  187. package/vendor/sdk/node_modules/@types/node/ts5.6/index.d.ts +0 -90
  188. package/vendor/sdk/node_modules/@types/node/tty.d.ts +0 -206
  189. package/vendor/sdk/node_modules/@types/node/url.d.ts +0 -957
  190. package/vendor/sdk/node_modules/@types/node/util.d.ts +0 -2083
  191. package/vendor/sdk/node_modules/@types/node/v8.d.ts +0 -753
  192. package/vendor/sdk/node_modules/@types/node/vm.d.ts +0 -666
  193. package/vendor/sdk/node_modules/@types/node/wasi.d.ts +0 -160
  194. package/vendor/sdk/node_modules/@types/node/worker_threads.d.ts +0 -695
  195. package/vendor/sdk/node_modules/@types/node/zlib.d.ts +0 -517
  196. package/vendor/sdk/node_modules/undici-types/README.md +0 -6
  197. package/vendor/sdk/node_modules/undici-types/agent.d.ts +0 -31
  198. package/vendor/sdk/node_modules/undici-types/api.d.ts +0 -43
  199. package/vendor/sdk/node_modules/undici-types/balanced-pool.d.ts +0 -18
  200. package/vendor/sdk/node_modules/undici-types/cache.d.ts +0 -36
  201. package/vendor/sdk/node_modules/undici-types/client.d.ts +0 -97
  202. package/vendor/sdk/node_modules/undici-types/connector.d.ts +0 -34
  203. package/vendor/sdk/node_modules/undici-types/content-type.d.ts +0 -21
  204. package/vendor/sdk/node_modules/undici-types/cookies.d.ts +0 -28
  205. package/vendor/sdk/node_modules/undici-types/diagnostics-channel.d.ts +0 -67
  206. package/vendor/sdk/node_modules/undici-types/dispatcher.d.ts +0 -241
  207. package/vendor/sdk/node_modules/undici-types/errors.d.ts +0 -128
  208. package/vendor/sdk/node_modules/undici-types/fetch.d.ts +0 -209
  209. package/vendor/sdk/node_modules/undici-types/file.d.ts +0 -39
  210. package/vendor/sdk/node_modules/undici-types/filereader.d.ts +0 -54
  211. package/vendor/sdk/node_modules/undici-types/formdata.d.ts +0 -108
  212. package/vendor/sdk/node_modules/undici-types/global-dispatcher.d.ts +0 -9
  213. package/vendor/sdk/node_modules/undici-types/global-origin.d.ts +0 -7
  214. package/vendor/sdk/node_modules/undici-types/handlers.d.ts +0 -9
  215. package/vendor/sdk/node_modules/undici-types/header.d.ts +0 -4
  216. package/vendor/sdk/node_modules/undici-types/index.d.ts +0 -63
  217. package/vendor/sdk/node_modules/undici-types/interceptors.d.ts +0 -5
  218. package/vendor/sdk/node_modules/undici-types/mock-agent.d.ts +0 -50
  219. package/vendor/sdk/node_modules/undici-types/mock-client.d.ts +0 -25
  220. package/vendor/sdk/node_modules/undici-types/mock-errors.d.ts +0 -12
  221. package/vendor/sdk/node_modules/undici-types/mock-interceptor.d.ts +0 -93
  222. package/vendor/sdk/node_modules/undici-types/mock-pool.d.ts +0 -25
  223. package/vendor/sdk/node_modules/undici-types/package.json +0 -55
  224. package/vendor/sdk/node_modules/undici-types/patch.d.ts +0 -71
  225. package/vendor/sdk/node_modules/undici-types/pool-stats.d.ts +0 -19
  226. package/vendor/sdk/node_modules/undici-types/pool.d.ts +0 -28
  227. package/vendor/sdk/node_modules/undici-types/proxy-agent.d.ts +0 -30
  228. package/vendor/sdk/node_modules/undici-types/readable.d.ts +0 -61
  229. package/vendor/sdk/node_modules/undici-types/webidl.d.ts +0 -220
  230. package/vendor/sdk/node_modules/undici-types/websocket.d.ts +0 -131
  231. package/vendor/sdk/package.json +0 -124
  232. package/vendor/sdk/pagination.d.ts +0 -27
  233. package/vendor/sdk/pagination.d.ts.map +0 -1
  234. package/vendor/sdk/pagination.js +0 -60
  235. package/vendor/sdk/pagination.js.map +0 -1
  236. package/vendor/sdk/pagination.mjs +0 -56
  237. package/vendor/sdk/pagination.mjs.map +0 -1
  238. package/vendor/sdk/resource.d.ts +0 -6
  239. package/vendor/sdk/resource.d.ts.map +0 -1
  240. package/vendor/sdk/resource.js +0 -11
  241. package/vendor/sdk/resource.js.map +0 -1
  242. package/vendor/sdk/resource.mjs +0 -7
  243. package/vendor/sdk/resource.mjs.map +0 -1
  244. package/vendor/sdk/resources/beta/beta.d.ts +0 -57
  245. package/vendor/sdk/resources/beta/beta.d.ts.map +0 -1
  246. package/vendor/sdk/resources/beta/beta.js +0 -44
  247. package/vendor/sdk/resources/beta/beta.js.map +0 -1
  248. package/vendor/sdk/resources/beta/beta.mjs +0 -17
  249. package/vendor/sdk/resources/beta/beta.mjs.map +0 -1
  250. package/vendor/sdk/resources/beta/index.d.ts +0 -4
  251. package/vendor/sdk/resources/beta/index.d.ts.map +0 -1
  252. package/vendor/sdk/resources/beta/index.js +0 -12
  253. package/vendor/sdk/resources/beta/index.js.map +0 -1
  254. package/vendor/sdk/resources/beta/index.mjs +0 -5
  255. package/vendor/sdk/resources/beta/index.mjs.map +0 -1
  256. package/vendor/sdk/resources/beta/messages/batches.d.ts +0 -289
  257. package/vendor/sdk/resources/beta/messages/batches.d.ts.map +0 -1
  258. package/vendor/sdk/resources/beta/messages/batches.js +0 -112
  259. package/vendor/sdk/resources/beta/messages/batches.js.map +0 -1
  260. package/vendor/sdk/resources/beta/messages/batches.mjs +0 -107
  261. package/vendor/sdk/resources/beta/messages/batches.mjs.map +0 -1
  262. package/vendor/sdk/resources/beta/messages/index.d.ts +0 -3
  263. package/vendor/sdk/resources/beta/messages/index.d.ts.map +0 -1
  264. package/vendor/sdk/resources/beta/messages/index.js +0 -10
  265. package/vendor/sdk/resources/beta/messages/index.js.map +0 -1
  266. package/vendor/sdk/resources/beta/messages/index.mjs +0 -4
  267. package/vendor/sdk/resources/beta/messages/index.mjs.map +0 -1
  268. package/vendor/sdk/resources/beta/messages/messages.d.ts +0 -1038
  269. package/vendor/sdk/resources/beta/messages/messages.d.ts.map +0 -1
  270. package/vendor/sdk/resources/beta/messages/messages.js +0 -93
  271. package/vendor/sdk/resources/beta/messages/messages.js.map +0 -1
  272. package/vendor/sdk/resources/beta/messages/messages.mjs +0 -66
  273. package/vendor/sdk/resources/beta/messages/messages.mjs.map +0 -1
  274. package/vendor/sdk/resources/beta/models.d.ts +0 -49
  275. package/vendor/sdk/resources/beta/models.d.ts.map +0 -1
  276. package/vendor/sdk/resources/beta/models.js +0 -30
  277. package/vendor/sdk/resources/beta/models.js.map +0 -1
  278. package/vendor/sdk/resources/beta/models.mjs +0 -25
  279. package/vendor/sdk/resources/beta/models.mjs.map +0 -1
  280. package/vendor/sdk/resources/completions.d.ts +0 -166
  281. package/vendor/sdk/resources/completions.d.ts.map +0 -1
  282. package/vendor/sdk/resources/completions.js +0 -17
  283. package/vendor/sdk/resources/completions.js.map +0 -1
  284. package/vendor/sdk/resources/completions.mjs +0 -13
  285. package/vendor/sdk/resources/completions.mjs.map +0 -1
  286. package/vendor/sdk/resources/index.d.ts +0 -6
  287. package/vendor/sdk/resources/index.d.ts.map +0 -1
  288. package/vendor/sdk/resources/index.js +0 -29
  289. package/vendor/sdk/resources/index.js.map +0 -1
  290. package/vendor/sdk/resources/index.mjs +0 -7
  291. package/vendor/sdk/resources/index.mjs.map +0 -1
  292. package/vendor/sdk/resources/messages/batches.d.ts +0 -253
  293. package/vendor/sdk/resources/messages/batches.d.ts.map +0 -1
  294. package/vendor/sdk/resources/messages/batches.js +0 -102
  295. package/vendor/sdk/resources/messages/batches.js.map +0 -1
  296. package/vendor/sdk/resources/messages/batches.mjs +0 -97
  297. package/vendor/sdk/resources/messages/batches.mjs.map +0 -1
  298. package/vendor/sdk/resources/messages/index.d.ts +0 -3
  299. package/vendor/sdk/resources/messages/index.d.ts.map +0 -1
  300. package/vendor/sdk/resources/messages/index.js +0 -10
  301. package/vendor/sdk/resources/messages/index.js.map +0 -1
  302. package/vendor/sdk/resources/messages/index.mjs +0 -4
  303. package/vendor/sdk/resources/messages/index.mjs.map +0 -1
  304. package/vendor/sdk/resources/messages/messages.d.ts +0 -1028
  305. package/vendor/sdk/resources/messages/messages.d.ts.map +0 -1
  306. package/vendor/sdk/resources/messages/messages.js +0 -82
  307. package/vendor/sdk/resources/messages/messages.js.map +0 -1
  308. package/vendor/sdk/resources/messages/messages.mjs +0 -54
  309. package/vendor/sdk/resources/messages/messages.mjs.map +0 -1
  310. package/vendor/sdk/resources/models.d.ts +0 -49
  311. package/vendor/sdk/resources/models.d.ts.map +0 -1
  312. package/vendor/sdk/resources/models.js +0 -30
  313. package/vendor/sdk/resources/models.js.map +0 -1
  314. package/vendor/sdk/resources/models.mjs +0 -25
  315. package/vendor/sdk/resources/models.mjs.map +0 -1
  316. package/vendor/sdk/resources/shared.d.ts +0 -42
  317. package/vendor/sdk/resources/shared.d.ts.map +0 -1
  318. package/vendor/sdk/resources/shared.js +0 -4
  319. package/vendor/sdk/resources/shared.js.map +0 -1
  320. package/vendor/sdk/resources/shared.mjs +0 -3
  321. package/vendor/sdk/resources/shared.mjs.map +0 -1
  322. package/vendor/sdk/resources/top-level.d.ts +0 -2
  323. package/vendor/sdk/resources/top-level.d.ts.map +0 -1
  324. package/vendor/sdk/resources/top-level.js +0 -4
  325. package/vendor/sdk/resources/top-level.js.map +0 -1
  326. package/vendor/sdk/resources/top-level.mjs +0 -3
  327. package/vendor/sdk/resources/top-level.mjs.map +0 -1
  328. package/vendor/sdk/shims/node.d.ts +0 -30
  329. package/vendor/sdk/shims/node.d.ts.map +0 -1
  330. package/vendor/sdk/shims/node.js +0 -31
  331. package/vendor/sdk/shims/node.js.map +0 -1
  332. package/vendor/sdk/shims/node.mjs +0 -5
  333. package/vendor/sdk/shims/node.mjs.map +0 -1
  334. package/vendor/sdk/shims/web.d.ts +0 -26
  335. package/vendor/sdk/shims/web.d.ts.map +0 -1
  336. package/vendor/sdk/shims/web.js +0 -31
  337. package/vendor/sdk/shims/web.js.map +0 -1
  338. package/vendor/sdk/shims/web.mjs +0 -5
  339. package/vendor/sdk/shims/web.mjs.map +0 -1
  340. package/vendor/sdk/src/_shims/MultipartBody.ts +0 -9
  341. package/vendor/sdk/src/_shims/README.md +0 -46
  342. package/vendor/sdk/src/_shims/auto/runtime-bun.ts +0 -4
  343. package/vendor/sdk/src/_shims/auto/runtime-node.ts +0 -4
  344. package/vendor/sdk/src/_shims/auto/runtime.ts +0 -4
  345. package/vendor/sdk/src/_shims/auto/types-node.ts +0 -4
  346. package/vendor/sdk/src/_shims/auto/types.d.ts +0 -101
  347. package/vendor/sdk/src/_shims/auto/types.js +0 -3
  348. package/vendor/sdk/src/_shims/auto/types.mjs +0 -3
  349. package/vendor/sdk/src/_shims/bun-runtime.ts +0 -14
  350. package/vendor/sdk/src/_shims/index.d.ts +0 -81
  351. package/vendor/sdk/src/_shims/index.js +0 -13
  352. package/vendor/sdk/src/_shims/index.mjs +0 -7
  353. package/vendor/sdk/src/_shims/manual-types.d.ts +0 -12
  354. package/vendor/sdk/src/_shims/manual-types.js +0 -3
  355. package/vendor/sdk/src/_shims/manual-types.mjs +0 -3
  356. package/vendor/sdk/src/_shims/node-runtime.ts +0 -81
  357. package/vendor/sdk/src/_shims/node-types.d.ts +0 -42
  358. package/vendor/sdk/src/_shims/node-types.js +0 -3
  359. package/vendor/sdk/src/_shims/node-types.mjs +0 -3
  360. package/vendor/sdk/src/_shims/registry.ts +0 -67
  361. package/vendor/sdk/src/_shims/web-runtime.ts +0 -103
  362. package/vendor/sdk/src/_shims/web-types.d.ts +0 -83
  363. package/vendor/sdk/src/_shims/web-types.js +0 -3
  364. package/vendor/sdk/src/_shims/web-types.mjs +0 -3
  365. package/vendor/sdk/src/_vendor/partial-json-parser/README.md +0 -3
  366. package/vendor/sdk/src/_vendor/partial-json-parser/parser.ts +0 -264
  367. package/vendor/sdk/src/core.ts +0 -1250
  368. package/vendor/sdk/src/error.ts +0 -133
  369. package/vendor/sdk/src/index.ts +0 -465
  370. package/vendor/sdk/src/internal/decoders/jsonl.ts +0 -41
  371. package/vendor/sdk/src/internal/decoders/line.ts +0 -145
  372. package/vendor/sdk/src/internal/stream-utils.ts +0 -32
  373. package/vendor/sdk/src/lib/.keep +0 -4
  374. package/vendor/sdk/src/lib/BetaMessageStream.ts +0 -661
  375. package/vendor/sdk/src/lib/MessageStream.ts +0 -662
  376. package/vendor/sdk/src/pagination.ts +0 -92
  377. package/vendor/sdk/src/resource.ts +0 -11
  378. package/vendor/sdk/src/resources/beta/beta.ts +0 -249
  379. package/vendor/sdk/src/resources/beta/index.ts +0 -83
  380. package/vendor/sdk/src/resources/beta/messages/batches.ts +0 -486
  381. package/vendor/sdk/src/resources/beta/messages/index.ts +0 -87
  382. package/vendor/sdk/src/resources/beta/messages/messages.ts +0 -1444
  383. package/vendor/sdk/src/resources/beta/models.ts +0 -78
  384. package/vendor/sdk/src/resources/completions.ts +0 -210
  385. package/vendor/sdk/src/resources/index.ts +0 -95
  386. package/vendor/sdk/src/resources/messages/batches.ts +0 -352
  387. package/vendor/sdk/src/resources/messages/index.ts +0 -85
  388. package/vendor/sdk/src/resources/messages/messages.ts +0 -1412
  389. package/vendor/sdk/src/resources/models.ts +0 -75
  390. package/vendor/sdk/src/resources/shared.ts +0 -72
  391. package/vendor/sdk/src/resources/top-level.ts +0 -3
  392. package/vendor/sdk/src/shims/node.ts +0 -50
  393. package/vendor/sdk/src/shims/web.ts +0 -50
  394. package/vendor/sdk/src/streaming.ts +0 -372
  395. package/vendor/sdk/src/tsconfig.json +0 -11
  396. package/vendor/sdk/src/uploads.ts +0 -255
  397. package/vendor/sdk/src/version.ts +0 -1
  398. package/vendor/sdk/streaming.d.ts +0 -36
  399. package/vendor/sdk/streaming.d.ts.map +0 -1
  400. package/vendor/sdk/streaming.js +0 -316
  401. package/vendor/sdk/streaming.js.map +0 -1
  402. package/vendor/sdk/streaming.mjs +0 -310
  403. package/vendor/sdk/streaming.mjs.map +0 -1
  404. package/vendor/sdk/uploads.d.ts +0 -75
  405. package/vendor/sdk/uploads.d.ts.map +0 -1
  406. package/vendor/sdk/uploads.js +0 -171
  407. package/vendor/sdk/uploads.js.map +0 -1
  408. package/vendor/sdk/uploads.mjs +0 -158
  409. package/vendor/sdk/uploads.mjs.map +0 -1
  410. package/vendor/sdk/version.d.ts +0 -2
  411. package/vendor/sdk/version.d.ts.map +0 -1
  412. package/vendor/sdk/version.js +0 -5
  413. package/vendor/sdk/version.js.map +0 -1
  414. package/vendor/sdk/version.mjs +0 -2
  415. package/vendor/sdk/version.mjs.map +0 -1
@@ -1,123 +0,0 @@
1
- "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
- if (kind === "m") throw new TypeError("Private method is not writable");
4
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
- };
8
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
- };
13
- var _LineDecoder_carriageReturnIndex;
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.LineDecoder = void 0;
16
- const error_1 = require("../../error.js");
17
- /**
18
- * A re-implementation of httpx's `LineDecoder` in Python that handles incrementally
19
- * reading lines from text.
20
- *
21
- * https://github.com/encode/httpx/blob/920333ea98118e9cf617f246905d7b202510941c/httpx/_decoders.py#L258
22
- */
23
- class LineDecoder {
24
- constructor() {
25
- _LineDecoder_carriageReturnIndex.set(this, void 0);
26
- this.buffer = new Uint8Array();
27
- __classPrivateFieldSet(this, _LineDecoder_carriageReturnIndex, null, "f");
28
- }
29
- decode(chunk) {
30
- if (chunk == null) {
31
- return [];
32
- }
33
- const binaryChunk = chunk instanceof ArrayBuffer ? new Uint8Array(chunk)
34
- : typeof chunk === 'string' ? new TextEncoder().encode(chunk)
35
- : chunk;
36
- let newData = new Uint8Array(this.buffer.length + binaryChunk.length);
37
- newData.set(this.buffer);
38
- newData.set(binaryChunk, this.buffer.length);
39
- this.buffer = newData;
40
- const lines = [];
41
- let patternIndex;
42
- while ((patternIndex = findNewlineIndex(this.buffer, __classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f"))) != null) {
43
- if (patternIndex.carriage && __classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") == null) {
44
- // skip until we either get a corresponding `\n`, a new `\r` or nothing
45
- __classPrivateFieldSet(this, _LineDecoder_carriageReturnIndex, patternIndex.index, "f");
46
- continue;
47
- }
48
- // we got double \r or \rtext\n
49
- if (__classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") != null &&
50
- (patternIndex.index !== __classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") + 1 || patternIndex.carriage)) {
51
- lines.push(this.decodeText(this.buffer.slice(0, __classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") - 1)));
52
- this.buffer = this.buffer.slice(__classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f"));
53
- __classPrivateFieldSet(this, _LineDecoder_carriageReturnIndex, null, "f");
54
- continue;
55
- }
56
- const endIndex = __classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") !== null ? patternIndex.preceding - 1 : patternIndex.preceding;
57
- const line = this.decodeText(this.buffer.slice(0, endIndex));
58
- lines.push(line);
59
- this.buffer = this.buffer.slice(patternIndex.index);
60
- __classPrivateFieldSet(this, _LineDecoder_carriageReturnIndex, null, "f");
61
- }
62
- return lines;
63
- }
64
- decodeText(bytes) {
65
- if (bytes == null)
66
- return '';
67
- if (typeof bytes === 'string')
68
- return bytes;
69
- // Node:
70
- if (typeof Buffer !== 'undefined') {
71
- if (bytes instanceof Buffer) {
72
- return bytes.toString();
73
- }
74
- if (bytes instanceof Uint8Array) {
75
- return Buffer.from(bytes).toString();
76
- }
77
- throw new error_1.AnthropicError(`Unexpected: received non-Uint8Array (${bytes.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`);
78
- }
79
- // Browser
80
- if (typeof TextDecoder !== 'undefined') {
81
- if (bytes instanceof Uint8Array || bytes instanceof ArrayBuffer) {
82
- this.textDecoder ?? (this.textDecoder = new TextDecoder('utf8'));
83
- return this.textDecoder.decode(bytes);
84
- }
85
- throw new error_1.AnthropicError(`Unexpected: received non-Uint8Array/ArrayBuffer (${bytes.constructor.name}) in a web platform. Please report this error.`);
86
- }
87
- throw new error_1.AnthropicError(`Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.`);
88
- }
89
- flush() {
90
- if (!this.buffer.length) {
91
- return [];
92
- }
93
- return this.decode('\n');
94
- }
95
- }
96
- exports.LineDecoder = LineDecoder;
97
- _LineDecoder_carriageReturnIndex = new WeakMap();
98
- // prettier-ignore
99
- LineDecoder.NEWLINE_CHARS = new Set(['\n', '\r']);
100
- LineDecoder.NEWLINE_REGEXP = /\r\n|[\n\r]/g;
101
- /**
102
- * This function searches the buffer for the end patterns, (\r or \n)
103
- * and returns an object with the index preceding the matched newline and the
104
- * index after the newline char. `null` is returned if no new line is found.
105
- *
106
- * ```ts
107
- * findNewLineIndex('abc\ndef') -> { preceding: 2, index: 3 }
108
- * ```
109
- */
110
- function findNewlineIndex(buffer, startIndex) {
111
- const newline = 0x0a; // \n
112
- const carriage = 0x0d; // \r
113
- for (let i = startIndex ?? 0; i < buffer.length; i++) {
114
- if (buffer[i] === newline) {
115
- return { preceding: i, index: i + 1, carriage: false };
116
- }
117
- if (buffer[i] === carriage) {
118
- return { preceding: i, index: i + 1, carriage: true };
119
- }
120
- }
121
- return null;
122
- }
123
- //# sourceMappingURL=line.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"line.js","sourceRoot":"","sources":["../../src/internal/decoders/line.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0CAA6C;AAI7C;;;;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AAO,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;SACxD;QAED,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;YAC1B,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;SACvD;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,119 +0,0 @@
1
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
- if (kind === "m") throw new TypeError("Private method is not writable");
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
- };
7
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
- };
12
- var _LineDecoder_carriageReturnIndex;
13
- import { AnthropicError } from "../../error.mjs";
14
- /**
15
- * A re-implementation of httpx's `LineDecoder` in Python that handles incrementally
16
- * reading lines from text.
17
- *
18
- * https://github.com/encode/httpx/blob/920333ea98118e9cf617f246905d7b202510941c/httpx/_decoders.py#L258
19
- */
20
- export class LineDecoder {
21
- constructor() {
22
- _LineDecoder_carriageReturnIndex.set(this, void 0);
23
- this.buffer = new Uint8Array();
24
- __classPrivateFieldSet(this, _LineDecoder_carriageReturnIndex, null, "f");
25
- }
26
- decode(chunk) {
27
- if (chunk == null) {
28
- return [];
29
- }
30
- const binaryChunk = chunk instanceof ArrayBuffer ? new Uint8Array(chunk)
31
- : typeof chunk === 'string' ? new TextEncoder().encode(chunk)
32
- : chunk;
33
- let newData = new Uint8Array(this.buffer.length + binaryChunk.length);
34
- newData.set(this.buffer);
35
- newData.set(binaryChunk, this.buffer.length);
36
- this.buffer = newData;
37
- const lines = [];
38
- let patternIndex;
39
- while ((patternIndex = findNewlineIndex(this.buffer, __classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f"))) != null) {
40
- if (patternIndex.carriage && __classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") == null) {
41
- // skip until we either get a corresponding `\n`, a new `\r` or nothing
42
- __classPrivateFieldSet(this, _LineDecoder_carriageReturnIndex, patternIndex.index, "f");
43
- continue;
44
- }
45
- // we got double \r or \rtext\n
46
- if (__classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") != null &&
47
- (patternIndex.index !== __classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") + 1 || patternIndex.carriage)) {
48
- lines.push(this.decodeText(this.buffer.slice(0, __classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") - 1)));
49
- this.buffer = this.buffer.slice(__classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f"));
50
- __classPrivateFieldSet(this, _LineDecoder_carriageReturnIndex, null, "f");
51
- continue;
52
- }
53
- const endIndex = __classPrivateFieldGet(this, _LineDecoder_carriageReturnIndex, "f") !== null ? patternIndex.preceding - 1 : patternIndex.preceding;
54
- const line = this.decodeText(this.buffer.slice(0, endIndex));
55
- lines.push(line);
56
- this.buffer = this.buffer.slice(patternIndex.index);
57
- __classPrivateFieldSet(this, _LineDecoder_carriageReturnIndex, null, "f");
58
- }
59
- return lines;
60
- }
61
- decodeText(bytes) {
62
- if (bytes == null)
63
- return '';
64
- if (typeof bytes === 'string')
65
- return bytes;
66
- // Node:
67
- if (typeof Buffer !== 'undefined') {
68
- if (bytes instanceof Buffer) {
69
- return bytes.toString();
70
- }
71
- if (bytes instanceof Uint8Array) {
72
- return Buffer.from(bytes).toString();
73
- }
74
- throw new AnthropicError(`Unexpected: received non-Uint8Array (${bytes.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`);
75
- }
76
- // Browser
77
- if (typeof TextDecoder !== 'undefined') {
78
- if (bytes instanceof Uint8Array || bytes instanceof ArrayBuffer) {
79
- this.textDecoder ?? (this.textDecoder = new TextDecoder('utf8'));
80
- return this.textDecoder.decode(bytes);
81
- }
82
- throw new AnthropicError(`Unexpected: received non-Uint8Array/ArrayBuffer (${bytes.constructor.name}) in a web platform. Please report this error.`);
83
- }
84
- throw new AnthropicError(`Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.`);
85
- }
86
- flush() {
87
- if (!this.buffer.length) {
88
- return [];
89
- }
90
- return this.decode('\n');
91
- }
92
- }
93
- _LineDecoder_carriageReturnIndex = new WeakMap();
94
- // prettier-ignore
95
- LineDecoder.NEWLINE_CHARS = new Set(['\n', '\r']);
96
- LineDecoder.NEWLINE_REGEXP = /\r\n|[\n\r]/g;
97
- /**
98
- * This function searches the buffer for the end patterns, (\r or \n)
99
- * and returns an object with the index preceding the matched newline and the
100
- * index after the newline char. `null` is returned if no new line is found.
101
- *
102
- * ```ts
103
- * findNewLineIndex('abc\ndef') -> { preceding: 2, index: 3 }
104
- * ```
105
- */
106
- function findNewlineIndex(buffer, startIndex) {
107
- const newline = 0x0a; // \n
108
- const carriage = 0x0d; // \r
109
- for (let i = startIndex ?? 0; i < buffer.length; i++) {
110
- if (buffer[i] === newline) {
111
- return { preceding: i, index: i + 1, carriage: false };
112
- }
113
- if (buffer[i] === carriage) {
114
- return { preceding: i, index: i + 1, carriage: true };
115
- }
116
- }
117
- return null;
118
- }
119
- //# sourceMappingURL=line.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"line.mjs","sourceRoot":"","sources":["../../src/internal/decoders/line.ts"],"names":[],"mappings":";;;;;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AAC,KAAK,OAAO,EAAE;YACzB,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;SACxD;QAED,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;YAC1B,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;SACvD;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,8 +0,0 @@
1
- /**
2
- * Most browsers don't yet have async iterable support for ReadableStream,
3
- * and Node has a very different way of reading bytes from its "ReadableStream".
4
- *
5
- * This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490
6
- */
7
- export declare function ReadableStreamToAsyncIterable<T>(stream: any): AsyncIterableIterator<T>;
8
- //# sourceMappingURL=stream-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stream-utils.d.ts","sourceRoot":"","sources":["../src/internal/stream-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAyBtF"}
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ReadableStreamToAsyncIterable = void 0;
4
- /**
5
- * Most browsers don't yet have async iterable support for ReadableStream,
6
- * and Node has a very different way of reading bytes from its "ReadableStream".
7
- *
8
- * This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490
9
- */
10
- function ReadableStreamToAsyncIterable(stream) {
11
- if (stream[Symbol.asyncIterator])
12
- return stream;
13
- const reader = stream.getReader();
14
- return {
15
- async next() {
16
- try {
17
- const result = await reader.read();
18
- if (result?.done)
19
- reader.releaseLock(); // release lock when stream becomes closed
20
- return result;
21
- }
22
- catch (e) {
23
- reader.releaseLock(); // release lock when stream becomes errored
24
- throw e;
25
- }
26
- },
27
- async return() {
28
- const cancelPromise = reader.cancel();
29
- reader.releaseLock();
30
- await cancelPromise;
31
- return { done: true, value: undefined };
32
- },
33
- [Symbol.asyncIterator]() {
34
- return this;
35
- },
36
- };
37
- }
38
- exports.ReadableStreamToAsyncIterable = ReadableStreamToAsyncIterable;
39
- //# sourceMappingURL=stream-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stream-utils.js","sourceRoot":"","sources":["../src/internal/stream-utils.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,SAAgB,6BAA6B,CAAI,MAAW;IAC1D,IAAI,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC;QAAE,OAAO,MAAM,CAAC;IAEhD,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;IAClC,OAAO;QACL,KAAK,CAAC,IAAI;YACR,IAAI;gBACF,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;gBACnC,IAAI,MAAM,EAAE,IAAI;oBAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,0CAA0C;gBAClF,OAAO,MAAM,CAAC;aACf;YAAC,OAAO,CAAC,EAAE;gBACV,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,2CAA2C;gBACjE,MAAM,CAAC,CAAC;aACT;QACH,CAAC;QACD,KAAK,CAAC,MAAM;YACV,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;YACtC,MAAM,CAAC,WAAW,EAAE,CAAC;YACrB,MAAM,aAAa,CAAC;YACpB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;QAC1C,CAAC;QACD,CAAC,MAAM,CAAC,aAAa,CAAC;YACpB,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC;AAzBD,sEAyBC"}
@@ -1,35 +0,0 @@
1
- /**
2
- * Most browsers don't yet have async iterable support for ReadableStream,
3
- * and Node has a very different way of reading bytes from its "ReadableStream".
4
- *
5
- * This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490
6
- */
7
- export function ReadableStreamToAsyncIterable(stream) {
8
- if (stream[Symbol.asyncIterator])
9
- return stream;
10
- const reader = stream.getReader();
11
- return {
12
- async next() {
13
- try {
14
- const result = await reader.read();
15
- if (result?.done)
16
- reader.releaseLock(); // release lock when stream becomes closed
17
- return result;
18
- }
19
- catch (e) {
20
- reader.releaseLock(); // release lock when stream becomes errored
21
- throw e;
22
- }
23
- },
24
- async return() {
25
- const cancelPromise = reader.cancel();
26
- reader.releaseLock();
27
- await cancelPromise;
28
- return { done: true, value: undefined };
29
- },
30
- [Symbol.asyncIterator]() {
31
- return this;
32
- },
33
- };
34
- }
35
- //# sourceMappingURL=stream-utils.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stream-utils.mjs","sourceRoot":"","sources":["../src/internal/stream-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,6BAA6B,CAAI,MAAW;IAC1D,IAAI,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC;QAAE,OAAO,MAAM,CAAC;IAEhD,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;IAClC,OAAO;QACL,KAAK,CAAC,IAAI;YACR,IAAI;gBACF,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;gBACnC,IAAI,MAAM,EAAE,IAAI;oBAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,0CAA0C;gBAClF,OAAO,MAAM,CAAC;aACf;YAAC,OAAO,CAAC,EAAE;gBACV,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,2CAA2C;gBACjE,MAAM,CAAC,CAAC;aACT;QACH,CAAC;QACD,KAAK,CAAC,MAAM;YACV,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;YACtC,MAAM,CAAC,WAAW,EAAE,CAAC;YACrB,MAAM,aAAa,CAAC;YACpB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;QAC1C,CAAC;QACD,CAAC,MAAM,CAAC,aAAa,CAAC;YACpB,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,114 +0,0 @@
1
-
2
- import * as Core from '@anthropic-ai/sdk/core';
3
- import { AnthropicError, APIUserAbortError } from '@anthropic-ai/sdk/error';
4
- import { type BetaContentBlock, Messages as BetaMessages, type BetaMessage, type BetaRawMessageStreamEvent as BetaMessageStreamEvent, type BetaMessageParam, type MessageCreateParams as BetaMessageCreateParams, type MessageCreateParamsBase as BetaMessageCreateParamsBase, type BetaTextCitation } from '@anthropic-ai/sdk/resources/beta/messages/messages';
5
- import { type ReadableStream, type Response } from '@anthropic-ai/sdk/_shims/index';
6
- export interface MessageStreamEvents {
7
- connect: () => void;
8
- streamEvent: (event: BetaMessageStreamEvent, snapshot: BetaMessage) => void;
9
- text: (textDelta: string, textSnapshot: string) => void;
10
- citation: (citation: BetaTextCitation, citationsSnapshot: BetaTextCitation[]) => void;
11
- inputJson: (partialJson: string, jsonSnapshot: unknown) => void;
12
- thinking: (thinkingDelta: string, thinkingSnapshot: string) => void;
13
- message: (message: BetaMessage) => void;
14
- contentBlock: (content: BetaContentBlock) => void;
15
- finalMessage: (message: BetaMessage) => void;
16
- error: (error: AnthropicError) => void;
17
- abort: (error: APIUserAbortError) => void;
18
- end: () => void;
19
- }
20
- export declare class BetaMessageStream implements AsyncIterable<BetaMessageStreamEvent> {
21
- #private;
22
- messages: BetaMessageParam[];
23
- receivedMessages: BetaMessage[];
24
- controller: AbortController;
25
- constructor();
26
- get response(): Response | null | undefined;
27
- get request_id(): string | null | undefined;
28
- /**
29
- * Returns the `MessageStream` data, the raw `Response` instance and the ID of the request,
30
- * returned vie the `request-id` header which is useful for debugging requests and resporting
31
- * issues to Anthropic.
32
- *
33
- * This is the same as the `APIPromise.withResponse()` method.
34
- *
35
- * This method will raise an error if you created the stream using `MessageStream.fromReadableStream`
36
- * as no `Response` is available.
37
- */
38
- withResponse(): Promise<{
39
- data: BetaMessageStream;
40
- response: Response;
41
- request_id: string | null | undefined;
42
- }>;
43
- /**
44
- * Intended for use on the frontend, consuming a stream produced with
45
- * `.toReadableStream()` on the backend.
46
- *
47
- * Note that messages sent to the model do not appear in `.on('message')`
48
- * in this context.
49
- */
50
- static fromReadableStream(stream: ReadableStream): BetaMessageStream;
51
- static createMessage(messages: BetaMessages, params: BetaMessageCreateParamsBase, options?: Core.RequestOptions): BetaMessageStream;
52
- protected _run(executor: () => Promise<any>): void;
53
- protected _addMessageParam(message: BetaMessageParam): void;
54
- protected _addMessage(message: BetaMessage, emit?: boolean): void;
55
- protected _createMessage(messages: BetaMessages, params: BetaMessageCreateParams, options?: Core.RequestOptions): Promise<void>;
56
- protected _connected(response: Response | null): void;
57
- get ended(): boolean;
58
- get errored(): boolean;
59
- get aborted(): boolean;
60
- abort(): void;
61
- /**
62
- * Adds the listener function to the end of the listeners array for the event.
63
- * No checks are made to see if the listener has already been added. Multiple calls passing
64
- * the same combination of event and listener will result in the listener being added, and
65
- * called, multiple times.
66
- * @returns this MessageStream, so that calls can be chained
67
- */
68
- on<Event extends keyof MessageStreamEvents>(event: Event, listener: MessageStreamEvents[Event]): this;
69
- /**
70
- * Removes the specified listener from the listener array for the event.
71
- * off() will remove, at most, one instance of a listener from the listener array. If any single
72
- * listener has been added multiple times to the listener array for the specified event, then
73
- * off() must be called multiple times to remove each instance.
74
- * @returns this MessageStream, so that calls can be chained
75
- */
76
- off<Event extends keyof MessageStreamEvents>(event: Event, listener: MessageStreamEvents[Event]): this;
77
- /**
78
- * Adds a one-time listener function for the event. The next time the event is triggered,
79
- * this listener is removed and then invoked.
80
- * @returns this MessageStream, so that calls can be chained
81
- */
82
- once<Event extends keyof MessageStreamEvents>(event: Event, listener: MessageStreamEvents[Event]): this;
83
- /**
84
- * This is similar to `.once()`, but returns a Promise that resolves the next time
85
- * the event is triggered, instead of calling a listener callback.
86
- * @returns a Promise that resolves the next time given event is triggered,
87
- * or rejects if an error is emitted. (If you request the 'error' event,
88
- * returns a promise that resolves with the error).
89
- *
90
- * Example:
91
- *
92
- * const message = await stream.emitted('message') // rejects if the stream errors
93
- */
94
- emitted<Event extends keyof MessageStreamEvents>(event: Event): Promise<Parameters<MessageStreamEvents[Event]> extends [infer Param] ? Param : Parameters<MessageStreamEvents[Event]> extends [] ? void : Parameters<MessageStreamEvents[Event]>>;
95
- done(): Promise<void>;
96
- get currentMessage(): BetaMessage | undefined;
97
- /**
98
- * @returns a promise that resolves with the the final assistant Message response,
99
- * or rejects if an error occurred or the stream ended prematurely without producing a Message.
100
- */
101
- finalMessage(): Promise<BetaMessage>;
102
- /**
103
- * @returns a promise that resolves with the the final assistant Message's text response, concatenated
104
- * together if there are more than one text blocks.
105
- * Rejects if an error occurred or the stream ended prematurely without producing a Message.
106
- */
107
- finalText(): Promise<string>;
108
- protected _emit<Event extends keyof MessageStreamEvents>(event: Event, ...args: Parameters<MessageStreamEvents[Event]>): void;
109
- protected _emitFinal(): void;
110
- protected _fromReadableStream(readableStream: ReadableStream, options?: Core.RequestOptions): Promise<void>;
111
- [Symbol.asyncIterator](): AsyncIterator<BetaMessageStreamEvent>;
112
- toReadableStream(): ReadableStream;
113
- }
114
- //# sourceMappingURL=BetaMessageStream.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BetaMessageStream.d.ts","sourceRoot":"","sources":["../src/lib/BetaMessageStream.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EACL,KAAK,gBAAgB,EACrB,QAAQ,IAAI,Y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